MUSX Document Model
|
Represents a page text assignment with positioning and page range properties. More...
#include <Others.h>
Public Types | |
enum class | PageAssignType { AllPages , Even , Odd } |
Which pages a multipage assignment appears on. More... | |
using | HorizontalAlignment = options::TextOptions::HorizontalAlignment |
Horizontal alignment options for page text positioning. | |
using | VerticalAlignment = options::TextOptions::VerticalAlignment |
Vertical alignment options for page text positioning. | |
![]() | |
enum class | ShareMode { All , Partial , None } |
Describes how this instance is shared between part and score. More... | |
using | SharedNodes = std::set< std::string > |
The container type for shared nodes. | |
Public Member Functions | |
PageTextAssign (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci) | |
Constructor function. | |
MusxInstance< TextBlock > | getTextBlock () const |
Gets the TextBlock for this assignment, or nullptr if none. | |
std::optional< PageCmper > | calcStartPageNumber (Cmper forPartId) const |
Return the starting page number, taking into account leading blank pages in all parts. This calculation mimics observed behavior in Finale. | |
std::optional< PageCmper > | calcEndPageNumber (Cmper forPartId) const |
Return the ending page number, taking into account leading blank pages in all parts This calculation mimics observed behavior in Finale. | |
util::EnigmaParsingContext | getRawTextCtx (Cmper forPartId, std::optional< Cmper > forPageId=std::nullopt) const |
Gets the raw text for parsing this assignment, or nullptr if none. | |
bool | isMultiPage () const |
Returns true if this is a multi-page assignment. | |
bool | isMultiAssignedThruLastPage () const |
Returns true if this is a multi-page assignment that is assigned to through last page, no matter how many. | |
void | integrityCheck (const std::shared_ptr< Base > &ptrToThis) override |
Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes. | |
![]() | |
OthersBase (const OthersBase &)=default | |
explicit default copy constructor | |
OthersBase (OthersBase &&) noexcept=default | |
explicit default move constructor | |
Cmper | getCmper () const |
Gets the cmper key value. | |
std::optional< Inci > | getInci () const |
Gets the optional array index (inci ). | |
Cmper | getRequestedPartId () const |
If this instance was retrieved from an object pool, it contains the part ID that was used to retrieve it. If this value is different than getSourcePartId, then this instance is a copy of the pool instance. | |
![]() | |
virtual | ~Base () noexcept(false)=default |
Virtual destructor for polymorphic behavior. | |
DocumentPtr | getDocument () const |
Gets a reference to the Document. | |
Cmper | getSourcePartId () const |
Gets the source partId for this instance. If an instance is fully shared with the score, the source is SCORE_PARTID. If an instance is partially shared or non shared, the source is the ID of the part that sourced it. | |
ShareMode | getShareMode () const |
Gets the sharing mode for this instance. | |
const SharedNodes & | getUnlinkedNodes () const |
Gets the unlinked nodes for this instance. (Only populated for ShareMode::Partial ) | |
void | addUnlinkedNode (const std::string &nodeName) |
Adds a shared node for this instance. | |
virtual bool | requireAllFields () const |
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class. | |
Static Public Member Functions | |
static MusxInstance< others::PageTextAssign > | getForPageId (const DocumentPtr &document, Cmper partId, PageCmper pageId, Inci inci) |
Returns a specific page text assignment for a given page number in a given part. This allows the caller not to have to know the conversion to page assignment IDs. | |
static std::vector< MusxInstance< others::PageTextAssign > > | getArrayForPageId (const DocumentPtr &document, Cmper partId, PageCmper pageId) |
Returns all the page text assignments for a given page number in a given part. This allows the caller not to have to know the conversion to page assignment IDs. | |
static const xml::XmlElementArray< PageTextAssign > & | xmlMappingArray () |
Required for musx::factory::FieldPopulator. | |
Public Attributes | |
Cmper | block {} |
The Cmper for the assigned TextBlock. (xml tag is <block> ) | |
Evpu | xDisp {} |
The horizontal displacement from the default position. (xml tag is <xdisp> ) | |
Evpu | yDisp {} |
The vertical displacement from the default position. (xml tag is <ydisp> ) | |
PageCmper | startPage {} |
PageCmper | endPage {} |
PageAssignType | oddEven {} |
Determines if a multipage assignment appears on all, even (left), or odd (right) pages. | |
HorizontalAlignment | hPosLp {} |
Horizontal alignment on left or all pages (depending on indRpPos). (xml tag is <hposLp> ) | |
HorizontalAlignment | hPosRp {} |
Horizontal alignment on right pages (if indRpPos is true). (xml tag is <hposRp> ) | |
bool | hidden {} |
Indicates if the page text appears only on screen. (xml tag is <postIt> ) | |
VerticalAlignment | vPos {} |
Vertical alignment. (xml tag is <vpos> ) | |
bool | hPosPageEdge {} |
bool | vPosPageEdge {} |
bool | indRpPos {} |
Individual right page positioning indicator. (xml tag is <indRpPos> ) | |
Evpu | rightPgXDisp {} |
Horizontal displacement for right pages (if indRpPos is true). (xml tag is <rightPgXdisp> ) | |
Evpu | rightPgYDisp {} |
Vertical displacement for right pages (if indRpPos is true). (xml tag is <rightPgYdisp> ) | |
Static Public Attributes | |
static constexpr std::string_view | XmlNodeName = "pageTextAssign" |
The XML node name for this type. | |
Additional Inherited Members | |
![]() | |
OthersBase (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, std::optional< Inci > inci=std::nullopt) | |
Constructs an OthersBase object. | |
OthersBase & | operator= (const OthersBase &other) |
Assignment operator delegates to base, preserving OthersBase state. | |
OthersBase & | operator= (OthersBase &&other) noexcept |
Assignment operator delegates to base, preserving OthersBase state. | |
![]() | |
Base (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode) | |
Constructs the base class. | |
Base (const Base &)=default | |
explicit default copy constructor | |
Base (Base &&) noexcept=default | |
explicit default move constructor | |
Base & | operator= (const Base &) |
no-op copy assignment operator allows subclasses to copy their values. | |
Base & | operator= (Base &&) noexcept |
no-op move assignment operator allows subclasses to move their values. | |
Represents a page text assignment with positioning and page range properties.
Instances of PageTextAssign use page assignment IDs rather than straightforward page numbers. This allows their page assignments to shift based on how many leading blank pages exist in the current score or part view vs. all the others. If all score and parts have the same number of leading blank pages, then page assignment IDs are the same as page numbers.
If the cmper is non-0, the startPage and endPage values are not used and the cmper specifies a page assignment ID that defines which page this text is assigned to.
If the cmper is 0, the startPage and endPage values specify the range of page assignment IDs to which this text is assigned. An endPage of 0 indicates the last page of the document.
If cmper is non-zero, startPage and endPage should have the same value as the cmper.
The inci value specifies a particular page text when more than one exists for the cmper value.
This class is identified by the XML node name "pageTextAssign".
|
strong |
std::optional< PageCmper > musx::dom::others::PageTextAssign::calcEndPageNumber | ( | Cmper | forPartId | ) | const |
Return the ending page number, taking into account leading blank pages in all parts This calculation mimics observed behavior in Finale.
forPartId
on which the part appears. If the attachment does not appear on the part, the function returns std::nullopt. std::optional< PageCmper > musx::dom::others::PageTextAssign::calcStartPageNumber | ( | Cmper | forPartId | ) | const |
Return the starting page number, taking into account leading blank pages in all parts. This calculation mimics observed behavior in Finale.
forPartId
on which the part appears. If the attachment does not appear on the part, the function returns std::nullopt.
|
static |
Returns all the page text assignments for a given page number in a given part. This allows the caller not to have to know the conversion to page assignment IDs.
document | The document to search. |
partId | The ID of the linked part to search. |
pageId | The page number to search for, or zero for all multipage assignments. |
|
static |
Returns a specific page text assignment for a given page number in a given part. This allows the caller not to have to know the conversion to page assignment IDs.
document | The document to search. |
partId | The ID of the linked part to search. |
pageId | The page number to search for, or zero for multipage assignments. |
inci | The inci of the specific page text assignment to retrieve. |
util::EnigmaParsingContext musx::dom::others::PageTextAssign::getRawTextCtx | ( | Cmper | forPartId, |
std::optional< Cmper > | forPageId = std::nullopt |
||
) | const |
Gets the raw text for parsing this assignment, or nullptr if none.
forPartId | The part to use for ^partname and ^totpages inserts. |
forPageId | The page number to use for ^page inserts if this is a multipage instance. This value is ignored for single page instances. Note that this is a page number and not a page ID. See calcStartPageNumber and calcEndPageNumber. |
|
inlineoverridevirtual |
Allows a class to determine if it has been properly contructed by the factory and fix issues that it can, such as creating default instances of contained classes.
The default implementation should always be called inside an overridden implementation.
ptrToThis | This instance in a shared_ptr. (Avoids need for shared_from_this.) |
musx::dom::integrity_error | if there is a problem. |
Reimplemented from musx::dom::Base.
PageCmper musx::dom::others::PageTextAssign::endPage {} |
The last page assignment ID on which the text appears. A value of zero indicates the last page in the document, whatever number it may be. Note that the page assignment ID may be different than the page number. See calcEndPageNumber.
bool musx::dom::others::PageTextAssign::hPosPageEdge {} |
If true, horizontal position is relative to page edge. Otherwise it is relative to the left / right page margins. (xml tag is <hposPageEdge>
)
PageCmper musx::dom::others::PageTextAssign::startPage {} |
The first page assignment ID on which the text appears. Note that the page assignment ID may be different than the page number. See calcStartPageNumber.
bool musx::dom::others::PageTextAssign::vPosPageEdge {} |
If true, vertical position is relative to page edge. Otherwise it is relative to the top / bottom page margins. (xml tag is <vposPageEdge>
)