6#include <QtCore/QByteArray>
7#include <QtCore/QString>
42 const QByteArray& documentTypeId,
43 bool createView =
true,
44 const QByteArray& viewTypeId =
"",
47 bool* ignoredPtr =
NULL)
override;
49 const QByteArray* documentTypeIdPtr,
50 const QString* fileNamePtr =
NULL,
51 bool createView =
true,
52 const QByteArray& viewTypeId =
"",
56 bool* ignoredPtr =
NULL,
59 int documentIndex = -1,
60 bool requestFileName =
false,
63 bool* ignoredPtr =
NULL,
66 virtual bool CloseDocument(
int documentIndex = -1,
bool beQuiet =
false,
bool* ignoredPtr =
NULL)
override;
89 const QString& filePath,
91 const QByteArray& viewTypeId,
92 QByteArray& documentTypeId,
101 const QByteArray& documentTypeId,
103 const QByteArray& viewTypeId,
182 QByteArray m_documentTypeId;
183 QByteArray m_viewTypeId;
187 UndoManagerObserver m_undoManagerObserver;
Consume information about progress of some process.
Basic implementation of a template-based single document manager.
virtual istd::IPolymorphic * AddViewToDocument(const istd::IChangeable &document, const QByteArray &viewTypeId=QByteArray()) override
Add a new view to the document.
QString GetCurrentDocumentFilePath() const
virtual bool OpenDocument(const QByteArray *documentTypeIdPtr, const QString *fileNamePtr=NULL, bool createView=true, const QByteArray &viewTypeId="", istd::IChangeableSharedPtr *documentPtr=nullptr, FileToTypeMap *loadedMapPtr=NULL, bool beQuiet=false, bool *ignoredPtr=NULL, ibase::IProgressManager *progressManagerPtr=NULL) override
Opens document(s) from the file list.
virtual bool CloseDocument(int documentIndex=-1, bool beQuiet=false, bool *ignoredPtr=NULL) override
Close document and all its views.
virtual void OnViewRemoved(istd::IPolymorphic *viewPtr)=0
Called before view is removed.
virtual QByteArray GetDocumentTypeId(const istd::IChangeable &document) const override
Get ID of document type managed by this object.
virtual void BeforeSavingDocument(const QString &filePath)
Called just before the document is saved via persistence.
virtual bool InsertNewDocument(const QByteArray &documentTypeId, bool createView=true, const QByteArray &viewTypeId="", istd::IChangeableSharedPtr *newDocumentPtr=nullptr, bool beQuiet=false, bool *ignoredPtr=NULL) override
Creates a new document with the document ID documentTypeId.
virtual bool QueryDocumentSave(bool *ignoredPtr)=0
Query user if this document can be closed.
bool NewDocument(const QByteArray &documentTypeId, bool createView, const QByteArray &viewTypeId, bool initialize, bool beQuiet, bool *ignoredPtr)
Create instance of specified document without attaching to this manager.
virtual idoc::IUndoManager * GetUndoManagerForDocument(const istd::IChangeable *documentPtr) const override
Return undo manager for document documentPtr.
virtual bool OpenSingleDocument(const QString &filePath, bool createView, const QByteArray &viewTypeId, QByteArray &documentTypeId, bool beQuiet, bool *ignoredPtr, ibase::IProgressManager *progressManagerPtr)
Open single document using its file path.
virtual void AfterSavingDocument(bool saveState)
Called immediately after saving the document via persistence.
bool RegisterDocument()
Register (attach) created document as new working document.
bool SerializeOpenDocument(iser::IArchive &archive)
Serializes open documents information.
virtual istd::IPolymorphic * GetActiveView() const override
Return the active document.
virtual void OnViewRegistered(istd::IPolymorphic *viewPtr)=0
Called after view is registered.
virtual istd::IPolymorphic * GetViewFromIndex(int documentIndex, int viewIndex) const override
Get single view using its and document indices.
virtual void OnDocumentRegistered()=0
Called after document is registered.
virtual int GetViewsCount(int documentIndex) const override
Get number of view for specified document.
void OnUndoManagerUpdate(const istd::IChangeable::ChangeSet &changeSet)
virtual QString GetOpenFilePath(const QByteArray *documentTypeIdPtr=NULL) const =0
Gets open file names.
virtual bool CloseView(istd::IPolymorphic *viewPtr=NULL, bool beQuiet=false, bool *ignoredPtr=NULL) override
Close view.
virtual istd::IChangeable & GetDocumentFromIndex(int index, DocumentInfo *documentInfoPtr=NULL) const override
Get document at specified index.
virtual int GetDocumentsCount() const override
Get number of opened documents.
virtual bool SaveDocument(int documentIndex=-1, bool requestFileName=false, FileToTypeMap *savedMapPtr=NULL, bool beQuiet=false, bool *ignoredPtr=NULL, ibase::IProgressManager *progressManagerPtr=NULL) override
Save document.
virtual istd::IChangeable * GetDocumentFromView(const istd::IPolymorphic &view, DocumentInfo *documentInfoPtr=NULL) const override
Return the document assigned to view.
virtual QString GetSaveFilePath(const QByteArray &documentTypeId, const istd::IChangeable *dataObjectPtr, const QString ¤tFilePath) const =0
Gets save file name.
virtual bool SaveDirtyDocuments(bool beQuiet=false, bool *ignoredPtr=NULL) override
Ask user (optional) and save all dirty (changed) documents.
CSingleDocumentManagerBase()
virtual void OnDocumentClosed()=0
Called before document is closed.
bool HasDocumentPendingChanges() const
virtual void OnUpdate(const istd::IChangeable::ChangeSet &changeSet) override
Called on update of observed model.
Base implementation of document manager.
QMap< QString, QByteArray > FileToTypeMap
Map from file path to document type ID's.
Interface providing UNDO/REDO functionality.
Basic implementation for a single model observer.
Represents an input/output persistence archive for object serialization.
Set of change flags (its IDs).
Common interface for data model objects, which can be changed.
Base interface for all used interfaces and implementations.
Contains the system independent basic implementations of Document/View design pattern.
Information about a document managed by the document manager.