86 return m_documentPages.count();
93 Q_ASSERT(pageIndex < m_documentPages.count());
94 Q_ASSERT(pageIndex >= 0);
95 Q_ASSERT(m_documentPages.at(pageIndex).pagePtr.IsValid());
97 return *m_documentPages.at(pageIndex).pagePtr.GetPtr();
104 Q_ASSERT(pageIndex < m_documentPages.count());
105 Q_ASSERT(pageIndex >= 0);
107 return &m_documentPages.at(pageIndex).pageMetaInfo;
116 m_documentPages.clear();
123 Q_ASSERT(pageIndex < m_documentPages.count());
124 Q_ASSERT(pageIndex >= 0);
128 m_documentPages.removeAt(pageIndex);
153 return GetPagesCount();
160 Q_ASSERT(index < m_documentPages.count());
177 return GetOptionName(index).toUtf8();
198 bool retVal = archive.
BeginTag(metaInfoTag);
199 retVal = retVal && BaseClass2::Serialize(archive);
200 retVal = retVal && archive.
EndTag(metaInfoTag);
203 int pagesCount = m_documentPages.count();
205 retVal = retVal && archive.
BeginMultiTag(pagesTag, pageTag, pagesCount);
208 for (
int pageIndex = 0; pageIndex < pagesCount; ++pageIndex){
209 retVal = retVal && archive.
BeginTag(pageTag);
210 retVal = retVal && SerializePage(archive, m_documentPages[pageIndex]);
211 retVal = retVal && archive.
EndTag(pageTag);
217 m_documentPages.clear();
219 for (
int pageIndex = 0; pageIndex < pagesCount; ++pageIndex){
220 this->InsertPage(
NULL,
NULL, pageIndex);
222 retVal = retVal && archive.
BeginTag(pageTag);
223 retVal = retVal && SerializePage(archive, m_documentPages[pageIndex]);
224 retVal = retVal && archive.
EndTag(pageTag);
228 retVal = retVal && archive.
EndTag(pagesTag);
241 if (sourcePtr !=
NULL){
244 m_documentPages.clear();
246 for (
int pageIndex = 0; pageIndex < sourcePtr->
m_documentPages.count(); ++pageIndex){
248 if (pagePtr ==
NULL){
253 Q_ASSERT(sourcePagePtr !=
NULL);
255 if (!pagePtr->
CopyFrom(*sourcePagePtr)){
259 if (!m_documentPages[pageIndex].pageMetaInfo.CopyFrom(sourcePtr->
m_documentPages.at(pageIndex).pageMetaInfo)){
264 if (!BaseClass2::CopyFrom(
object, mode)){
276 m_documentPages.clear();
279 for (
int pageIndex = 0; pageIndex < pagesCount; ++pageIndex){
281 if (pagePtr ==
NULL){
286 if (!pagePtr->
CopyFrom(sourcePage)){
291 if (metaInfoPtr !=
NULL){
292 if (!m_documentPages[pageIndex].pageMetaInfo.CopyFrom(*metaInfoPtr)){
298 if (!BaseClass2::CopyFrom(
object, mode)){
307 if (docProviderPtr !=
NULL){
309 if (sourceDocPtr !=
NULL){
311 return CopyFrom(*sourceDocPtr, mode);
336 bool retVal = archive.
BeginTag(pageTitleTag);
338 retVal = retVal && archive.
EndTag(pageTitleTag);
341 if (serializablePagePtr !=
NULL){
342 retVal = retVal && archive.
BeginTag(pageContentTag);
343 retVal = serializablePagePtr->
Serialize(archive);
344 retVal = retVal && archive.
EndTag(pageContentTag);
347 qWarning(
"Page object doesn't support serialization");
Simple interface for a structured document.
virtual const istd::IChangeable & GetDocumentPage(int pageIndex) const =0
Get the document page.
virtual const idoc::IDocumentMetaInfo * GetPageMetaInfo(int pageIndex) const =0
Get meta info of the given page if exists.
virtual int GetPagesCount() const =0
Get number of pages in the document.
Common interface for a provider of a multi-page document.
virtual const IMultiPageDocument * GetDocument() const =0
Get multi-page document instance.
Generic implementation of IMultiPageDocument interface.
virtual bool IsOptionEnabled(int index) const override
Return true if the option is enabled and can be selected.
virtual bool ResetData(CompatibilityMode mode) override
Reset data to its default state.
virtual bool CopyFrom(const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
Copy this object from another one.
virtual int GetPagesCount() const override
virtual bool SerializePage(iser::IArchive &archive, Page &pageItem)
Serialize a single page item into or from the archive.
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
virtual bool RemovePage(int pageIndex) override
virtual int GetOptionsFlags() const override
Get constraints flags.
virtual QString GetOptionDescription(int index) const override
Get human-readable description for an option.
virtual void ResetPages() override
virtual QByteArray GetOptionId(int index) const override
Get option ID.
virtual const idoc::IDocumentMetaInfo * GetPageMetaInfo(int pageIndex) const override
virtual const istd::IChangeable & GetDocumentPage(int pageIndex) const override
virtual QString GetOptionName(int index) const override
Get name of specified option.
virtual int GetOptionsCount() const override
Get number of managed options.
CStandardDocumentMetaInfo BaseClass2
virtual const IDocumentMetaInfo & GetDocumentMetaInfo() const override
Constraints of selection from set of possibilities.
Process tag used to group data in archive stream.
@ TT_GROUP
Normal tag used for grouping of tags or processed elements.
@ TT_MULTIPLE
Multiple tag containing variable number of child tags.
Represents an input/output persistence archive for object serialization.
virtual bool EndTag(const CArchiveTag &tag)=0
Ends a tagged section in the archive.
virtual bool BeginMultiTag(const CArchiveTag &tag, const CArchiveTag &subTag, int &count)=0
Begins a tagged section containing multiple elements of the same type.
virtual bool IsStoring() const =0
Checks if this archive is in storing (writing) or loading (reading) mode.
virtual bool BeginTag(const CArchiveTag &tag)=0
Begins a tagged section in the archive.
Common class for all classes which objects can be archived or restored from archive.
virtual bool Serialize(IArchive &archive)=0
Load or store state of this object as a archive stream.
Help class which provides the automatic update mechanism of the model.
Common interface for data model objects, which can be changed.
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
virtual bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS)
Copy this object from another one.
Interface * GetPtr() noexcept
Contains the system independent basic implementations of Document/View design pattern.
idoc::TMultiPageDocumentWrap< idoc::IMultiPageDocument > CMultiPageDocumentBase
idoc::CStandardDocumentMetaInfo pageMetaInfo
istd::IChangeableSharedPtr pagePtr