ACF $AcfVersion:0$
CMultiPageDocumentFilePersistenceComp.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// ACF includes
9
10
11namespace idoc
12{
13
14
26 virtual public ifile::IFilePersistence
27{
28public:
30
37
39 I_REGISTER_INTERFACE(ifile::IFileTypeInfo);
40 I_REGISTER_INTERFACE(ifile::IFilePersistence);
41 I_ASSIGN(m_pageObjectPersistenceCompPtr, "BitmapPersistence", "Component used for persistence of the single page of the bitmap document", true, "BitmapPersistence");
42 I_ASSIGN(m_operationModeAttrPtr, "OperationMode", "Operation mode. 0 - flat structure, all files will be placed into the target folder\n1 - Files will be placed into the document's own folder\n2 - Same as 1, but the folder wll be compressed", true, OM_FOLDER);
43 I_ASSIGN(m_defaultPageSuffixAttrPtr, "DefaultPageFileExtension", "Default extension used for the page files", false, "png");
44 I_ASSIGN(m_defaultDocumentSuffixAttrPtr, "DefaultDocumentFileExtension", "Default extension used for the document files", true, "mbd");
45 I_END_COMPONENT;
46
47 // reimplemented (ifile::IFilePersistence)
49 const istd::IChangeable* dataObjectPtr,
50 const QString* filePathPtr = NULL,
51 int flags = -1,
52 bool beQuiet = true) const override;
55 const QString& filePath = QString(),
56 ibase::IProgressManager* progressManagerPtr = NULL) const override;
58 const istd::IChangeable& data,
59 const QString& filePath = QString(),
60 ibase::IProgressManager* progressManagerPtr = NULL) const override;
61
62 // reimplemented (ifile::IFileTypeInfo)
63 virtual bool GetFileExtensions(QStringList& result, const istd::IChangeable* dataObjectPtr = NULL, int flags = -1, bool doAppend = false) const override;
64 virtual QString GetTypeDescription(const QString* extensionPtr = NULL) const override;
65
66protected:
67 // reimplemented (icomp::CComponentBase)
68 virtual void OnComponentCreated() override;
69
70protected:
71 virtual bool SerializeDocumentMetaInfo(const idoc::IMultiPageDocument& document, iser::IArchive& archive) const;
72 virtual bool SerializePageMetaInfo(idoc::IMultiPageDocument& document, int pageIndex, iser::IArchive& archive) const;
73private:
77 QString GetInfoFilePath(const QString documentFilePath) const;
78
79private:
80 I_REF(ifile::IFilePersistence, m_pageObjectPersistenceCompPtr);
81 I_ATTR(int, m_operationModeAttrPtr);
82 I_ATTR(QByteArray, m_defaultDocumentSuffixAttrPtr);
83 I_ATTR(QByteArray, m_defaultPageSuffixAttrPtr);
84
85 QString m_defaultSuffix;
86 QString m_defaultPageSuffix;
87
88 static iser::CArchiveTag s_pagesTag;
89 static iser::CArchiveTag s_pageFileTag;
90};
91
92
93} // namespace idoc
94
95
96
97
Consume information about progress of some process.
File based persistence of the multi-paged bitmap document.
virtual ifile::IFilePersistence::OperationState SaveToFile(const istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const override
This function saves data data to file filePath.
virtual QString GetTypeDescription(const QString *extensionPtr=NULL) const override
Get description of object type associated with single extension.
virtual void OnComponentCreated() override
Called when component is created.
virtual bool IsOperationSupported(const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=NULL, int flags=-1, bool beQuiet=true) const override
Returns true if object dataObject can be loaded/saved.
virtual ifile::IFilePersistence::OperationState LoadFromFile(istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const override
This function loads data data from file filePath.
virtual bool GetFileExtensions(QStringList &result, const istd::IChangeable *dataObjectPtr=NULL, int flags=-1, bool doAppend=false) const override
Get file extensions supported by this loader.
virtual bool SerializeDocumentMetaInfo(const idoc::IMultiPageDocument &document, iser::IArchive &archive) const
virtual bool SerializePageMetaInfo(idoc::IMultiPageDocument &document, int pageIndex, iser::IArchive &archive) const
Simple interface for a structured document.
Interface providing loading and saving of data objects.
OperationState
Result of operation.
Provide loading and saving of objects.
Template wrapper adding comprehensive logging functionality to components.
Process tag used to group data in archive stream.
Definition CArchiveTag.h:22
Represents an input/output persistence archive for object serialization.
Definition IArchive.h:164
Common interface for data model objects, which can be changed.
Definition IChangeable.h:28
#define NULL
Definition istd.h:74
Contains the system independent basic implementations of Document/View design pattern.