Go to the documentation of this file.
1 #ifndef idoc_CSingleDocumentTemplateComp_included
2 #define idoc_CSingleDocumentTemplateComp_included
5 // ACF includes
6 #include <imod/IModel.h>
7 #include <icomp/CComponentBase.h>
12 namespace idoc
13 {
20 {
21 public:
25  I_BEGIN_COMPONENT(CSingleDocumentTemplateComp);
26  I_REGISTER_INTERFACE(idoc::IDocumentTemplate);
27  I_ASSIGN(m_documentTypeIdAttrPtr, "DocumentTypeId", "ID of supported document", true, "Default");
28  I_ASSIGN(m_documentTypeNameAttrPtr, "DocumentTypeName", "Human readable name of document", false, "");
29  I_ASSIGN(m_defaultDirectoryAttrPtr, "DefaultDirectory", "Default file directory for open file dialog", true, ".");
30  I_ASSIGN(m_documentCompFact, "DocumentFactory", "Document factory", true, "DocumentFactory");
31  I_ASSIGN_TO(m_modelCompFact, m_documentCompFact, true);
32  I_ASSIGN(m_viewCompFact, "ViewFactory", "Create of document GUI", true, "ViewFactory");
33  I_ASSIGN(m_fileLoaderCompPtr, "DocumentLoader", "Provide document loading and saving", true, "DocumentLoader");
34  I_ASSIGN(m_undoManagerCompFact, "UndoManager", "Undo manager providing undo functionality", false, "UndoManager");
35  I_ASSIGN_TO(m_undoManagerObserverCompFact, m_undoManagerCompFact, true);
36  I_ASSIGN(m_isNewSupportedAttrPtr, "IsNewSupported", "Template supports the new operation", true, false);
37  I_ASSIGN(m_isEditSupportedAttrPtr, "IsEditSupported", "Template supports the edit operation", true, false);
40  // reimplemented (idoc::IDocumentTemplate)
41  virtual ifile::IFilePersistence* GetFileLoader(const QByteArray& documentTypeId) const;
43  QByteArray& documentTypeId,
44  bool initialize = true,
45  bool beQuiet = false,
46  bool* ignoredFlagPtr = NULL) const;
48  const QByteArray& documentTypeId,
49  istd::IChangeable* documentPtr,
50  const QByteArray& viewTypeId = QByteArray()) const;
51  idoc::IUndoManager* CreateUndoManager(const QByteArray& documentTypeId, istd::IChangeable* documentPtr) const;
53 protected:
61  virtual istd::IPolymorphic* ExtractViewInterface(icomp::IComponent* componentPtr) const;
63  // reimplemented (icomp::CComponentBase)
64  virtual void OnComponentCreated();
66 private:
67  I_ATTR(bool, m_isNewSupportedAttrPtr);
68  I_ATTR(bool, m_isEditSupportedAttrPtr);
69  I_ATTR(QByteArray, m_documentTypeIdAttrPtr);
70  I_TEXTATTR(m_documentTypeNameAttrPtr);
71  I_ATTR(QString, m_defaultDirectoryAttrPtr);
72  I_FACT(istd::IChangeable, m_documentCompFact);
73  I_FACT(imod::IModel, m_modelCompFact);
74  I_FACT(imod::IObserver, m_viewCompFact);
75  I_REF(ifile::IFilePersistence, m_fileLoaderCompPtr);
76  I_FACT(idoc::IUndoManager, m_undoManagerCompFact);
77  I_FACT(imod::IObserver, m_undoManagerObserverCompFact);
78 };
81 } // namespace idoc
84 #endif // !idoc_CSingleDocumentTemplateComp_included
virtual istd::IPolymorphic * CreateView(const QByteArray &documentTypeId, istd::IChangeable *documentPtr, const QByteArray &viewTypeId=QByteArray()) const
Creates a view instance for document document of type viewTypeId.
virtual ifile::IFilePersistence * GetFileLoader(const QByteArray &documentTypeId) const
Get file loader/saver for spacified document ID.
Document template component supported only one type of the provided document.
virtual istd::IPolymorphic * ExtractViewInterface(icomp::IComponent *componentPtr) const
Extract pointer of view interface from factorisied view component.
Base class for component implementation.
Main component interface.
Definition: IComponent.h:31
Base class implementing document template for single document type.
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
Base interface for all used interfaces and implementations.
Definition: IPolymorphic.h:17
Common interface for a document template.
virtual istd::IChangeable * CreateDocument(QByteArray &documentTypeId, bool initialize=true, bool beQuiet=false, bool *ignoredFlagPtr=NULL) const
Creates a document instance for document type documentTypeId.
#define NULL
Definition: istd.h:64
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition: IObserver.h:24
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
Interface providing loading and saving of data objects.
Interface providing UNDO/REDO functionality.
Definition: IUndoManager.h:16
idoc::IUndoManager * CreateUndoManager(const QByteArray &documentTypeId, istd::IChangeable *documentPtr) const
Creates an undo manger for a given document documentPtr.

© 2007-2017 Witold Gantzke and Kirill Lepskiy