MUSX Document Model
Loading...
Searching...
No Matches
musx::dom::others::PageTextAssign Class Reference

Represents a page text assignment with positioning and page range properties. More...

#include <Others.h>

+ Inheritance diagram for musx::dom::others::PageTextAssign:

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.
 
- Public Types inherited from musx::dom::Base
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< TextBlockgetTextBlock () const
 Gets the TextBlock for this assignment, or nullptr if none.
 
std::optional< PageCmpercalcStartPageNumber (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< PageCmpercalcEndPageNumber (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.
 
- Public Member Functions inherited from musx::dom::OthersBase
 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< IncigetInci () 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.
 
- Public Member Functions inherited from musx::dom::Base
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 SharedNodesgetUnlinkedNodes () 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::PageTextAssigngetForPageId (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

- Protected Member Functions inherited from musx::dom::OthersBase
 OthersBase (const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, std::optional< Inci > inci=std::nullopt)
 Constructs an OthersBase object.
 
OthersBaseoperator= (const OthersBase &other)
 Assignment operator delegates to base, preserving OthersBase state.
 
OthersBaseoperator= (OthersBase &&other) noexcept
 Assignment operator delegates to base, preserving OthersBase state.
 
- Protected Member Functions inherited from musx::dom::Base
 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
 
Baseoperator= (const Base &)
 no-op copy assignment operator allows subclasses to copy their values.
 
Baseoperator= (Base &&) noexcept
 no-op move assignment operator allows subclasses to move their values.
 

Detailed Description

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".

Member Enumeration Documentation

◆ PageAssignType

Which pages a multipage assignment appears on.

Enumerator
AllPages 

default (may not appear in xml)

Member Function Documentation

◆ calcEndPageNumber()

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.

Returns
The first page in forPartId on which the part appears. If the attachment does not appear on the part, the function returns std::nullopt.

◆ calcStartPageNumber()

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.

Returns
The first page in forPartId on which the part appears. If the attachment does not appear on the part, the function returns std::nullopt.

◆ getArrayForPageId()

std::vector< MusxInstance< PageTextAssign > > musx::dom::others::PageTextAssign::getArrayForPageId ( const DocumentPtr document,
Cmper  partId,
PageCmper  pageId 
)
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.

Parameters
documentThe document to search.
partIdThe ID of the linked part to search.
pageIdThe page number to search for, or zero for all multipage assignments.

◆ getForPageId()

MusxInstance< PageTextAssign > musx::dom::others::PageTextAssign::getForPageId ( const DocumentPtr document,
Cmper  partId,
PageCmper  pageId,
Inci  inci 
)
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.

Parameters
documentThe document to search.
partIdThe ID of the linked part to search.
pageIdThe page number to search for, or zero for multipage assignments.
inciThe inci of the specific page text assignment to retrieve.

◆ getRawTextCtx()

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.

Parameters
forPartIdThe part to use for ^partname and ^totpages inserts.
forPageIdThe 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.

◆ integrityCheck()

void musx::dom::others::PageTextAssign::integrityCheck ( const std::shared_ptr< Base > &  ptrToThis)
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.

Parameters
ptrToThisThis instance in a shared_ptr. (Avoids need for shared_from_this.)
Exceptions
musx::dom::integrity_errorif there is a problem.

Reimplemented from musx::dom::Base.

Member Data Documentation

◆ endPage

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.

◆ hPosPageEdge

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>)

◆ startPage

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.

◆ vPosPageEdge

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>)