CMultiPageDocumentFilePersistenceComp.h
Go to the documentation of this file.
1 #ifndef idoc_CMultiPageDocumentFilePersistenceComp_included
2 #define idoc_CMultiPageDocumentFilePersistenceComp_included
3 
4 
5 // ACF includes
7 #include <ilog/TLoggerCompWrap.h>
9 
10 
11 namespace idoc
12 {
13 
14 
26  virtual public ifile::IFilePersistence
27 {
28 public:
30 
32  {
36  };
37 
38  I_BEGIN_COMPONENT(CMultiPageDocumentFilePersistenceComp);
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, "");
44  I_END_COMPONENT;
45 
46  // reimplemented (ifile::IFilePersistence)
47  virtual bool IsOperationSupported(
48  const istd::IChangeable* dataObjectPtr,
49  const QString* filePathPtr = NULL,
50  int flags = -1,
51  bool beQuiet = true) const;
52  virtual int LoadFromFile(
53  istd::IChangeable& data,
54  const QString& filePath = QString(),
55  ibase::IProgressManager* progressManagerPtr = NULL) const;
56  virtual int SaveToFile(
57  const istd::IChangeable& data,
58  const QString& filePath = QString(),
59  ibase::IProgressManager* progressManagerPtr = NULL) const;
60 
61  // reimplemented (ifile::IFileTypeInfo)
62  virtual bool GetFileExtensions(QStringList& result, const istd::IChangeable* dataObjectPtr = NULL, int flags = -1, bool doAppend = false) const;
63  virtual QString GetTypeDescription(const QString* extensionPtr = NULL) const;
64 
65 protected:
66  // reimplemented (icomp::CComponentBase)
67  virtual void OnComponentCreated();
68 
69 protected:
70  virtual bool SerializeDocumentMetaInfo(const idoc::IMultiPageDocument& document, iser::IArchive& archive) const;
71  virtual bool SerializePageMetaInfo(idoc::IMultiPageDocument& document, int pageIndex, iser::IArchive& archive) const;
72 private:
76  QString GetInfoFilePath(const QString documentFilePath) const;
77 
78 private:
79  I_REF(ifile::IFilePersistence, m_pageObjectPersistenceCompPtr);
80  I_ATTR(int, m_operationModeAttrPtr);
81  I_ATTR(QByteArray, m_defaultPageSuffixAttrPtr);
82 
83  QString m_defaultSuffix;
84  QString m_defaultPageSuffix;
85 
86  static iser::CArchiveTag s_pagesTag;
87  static iser::CArchiveTag s_pageFileTag;
88 };
89 
90 
91 } // namespace idoc
92 
93 
94 #endif // !idoc_CMultiPageDocumentFilePersistenceComp_included
95 
96 
Provide loading and saving of objects.
Definition: IFileTypeInfo.h:22
virtual int SaveToFile(const istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
This function saves data data to file filePath.
Simple interface for a structured document.
Wrapper provider of log-functionality for component based implementations.
Represent input/output persistence archive.
Definition: IArchive.h:30
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
virtual bool SerializePageMetaInfo(idoc::IMultiPageDocument &document, int pageIndex, iser::IArchive &archive) const
virtual bool IsOperationSupported(const istd::IChangeable *dataObjectPtr, const QString *filePathPtr=NULL, int flags=-1, bool beQuiet=true) const
Returns true if object dataObject can be loaded/saved.
virtual QString GetTypeDescription(const QString *extensionPtr=NULL) const
Get description of object type associated with single extension.
#define NULL
Definition: istd.h:64
File based persistence of the multi-paged bitmap document.
virtual int LoadFromFile(istd::IChangeable &data, const QString &filePath=QString(), ibase::IProgressManager *progressManagerPtr=NULL) const
This function loads data data from file filePath.
Interface providing loading and saving of data objects.
Process tag used to group data in archive stream.
Definition: CArchiveTag.h:21
virtual bool SerializeDocumentMetaInfo(const idoc::IMultiPageDocument &document, iser::IArchive &archive) const
Consume information about progress of some process.
virtual bool GetFileExtensions(QStringList &result, const istd::IChangeable *dataObjectPtr=NULL, int flags=-1, bool doAppend=false) const
Get file extensions supported by this loader.

© 2007-2017 Witold Gantzke and Kirill Lepskiy