10#include <QtCore/QByteArray>
11#include <QtCore/QString>
44 const QByteArray& documentTypeId,
45 bool createView =
true,
46 const QByteArray& viewTypeId =
"",
49 bool* ignoredPtr =
nullptr);
51 const QByteArray* documentTypeIdPtr,
52 const QString* fileNamePtr =
nullptr,
53 bool createView =
true,
54 const QByteArray& viewTypeId =
"",
58 bool* ignoredPtr =
nullptr,
61 int documentIndex = -1,
62 bool requestFileName =
false,
65 bool* ignoredPtr =
nullptr,
68 virtual bool CloseDocument(
int documentIndex = -1,
bool beQuiet =
false,
bool* ignoredPtr =
nullptr);
69 virtual bool CloseView(istd::IPolymorphic* viewPtr =
nullptr,
bool beQuiet =
false,
bool* ignoredPtr =
nullptr);
81 const QString& filePath,
83 const QByteArray& viewTypeId,
84 QByteArray& documentTypeId,
93 const QByteArray& documentTypeId,
95 const QByteArray& viewTypeId,
127 virtual QString
GetOpenFilePath(
const QByteArray* documentTypeIdPtr =
nullptr)
const = 0;
147 QByteArray m_documentTypeId;
148 QByteArray m_viewTypeId;
149 std::unique_ptr<istd::IChangeable> m_documentPtr;
150 std::unique_ptr<idoc::IUndoManager> m_undoManagerPtr;
151 std::unique_ptr<istd::IPolymorphic> m_viewPtr;
Basic implementation of a template-based single document manager.
virtual int GetViewsCount(int documentIndex) const
Get number of view for specified document.
virtual istd::IPolymorphic * AddViewToDocument(const istd::IChangeable &document, const QByteArray &viewTypeId=QByteArray())
Add a new view to the document.
virtual istd::IPolymorphic * GetViewFromIndex(int documentIndex, int viewIndex) const
Get single view using its and document indices.
QString GetCurrentDocumentFilePath() const
virtual bool SaveDirtyDocuments(bool beQuiet=false, bool *ignoredPtr=nullptr)
Ask user (optional) and save all dirty (changed) documents.
virtual void OnViewRemoved(istd::IPolymorphic *viewPtr)=0
Called before view is removed.
virtual QString GetOpenFilePath(const QByteArray *documentTypeIdPtr=nullptr) const =0
Gets open file names.
virtual bool SaveDocument(int documentIndex=-1, bool requestFileName=false, FileToTypeMap *savedMapPtr=nullptr, bool beQuiet=false, bool *ignoredPtr=nullptr, iproc::IProgressManager *progressManagerPtr=nullptr)
Save document.
virtual bool OpenSingleDocument(const QString &filePath, bool createView, const QByteArray &viewTypeId, QByteArray &documentTypeId, bool beQuiet, bool *ignoredPtr, iproc::IProgressManager *progressManagerPtr)
Open single document using its file path.
virtual bool QueryDocumentSave(bool *ignoredPtr)=0
Query user if this document can be closed.
virtual int GetDocumentsCount() const
Get number of opened documents.
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.
bool RegisterDocument()
Register (attach) created document as new working document.
bool SerializeOpenDocument(iser::IArchive &archive)
Serializes open documents information.
virtual istd::IPolymorphic * GetActiveView() const
Return the active document.
virtual void OnViewRegistered(istd::IPolymorphic *viewPtr)=0
Called after view is registered.
virtual void OnUpdate(const istd::IChangeable::ChangeSet &changeSet)
Called on update of observed model.
virtual bool CloseDocument(int documentIndex=-1, bool beQuiet=false, bool *ignoredPtr=nullptr)
Close document and all its views.
virtual idoc::IUndoManager * GetUndoManagerForDocument(const istd::IChangeable *documentPtr) const
Return undo mananger for document documenPtr.
virtual QByteArray GetDocumentTypeId(const istd::IChangeable &document) const
Get ID of document type managed by this object.
virtual bool CloseView(istd::IPolymorphic *viewPtr=nullptr, bool beQuiet=false, bool *ignoredPtr=nullptr)
Close view.
virtual bool InsertNewDocument(const QByteArray &documentTypeId, bool createView=true, const QByteArray &viewTypeId="", istd::IChangeable **newDocumentPtr=nullptr, bool beQuiet=false, bool *ignoredPtr=nullptr)
Creates a new document with the document ID documentTypeId.
virtual istd::IChangeable * GetDocumentFromView(const istd::IPolymorphic &view, DocumentInfo *documentInfoPtr=nullptr) const
Return the document assigned to view.
virtual bool OpenDocument(const QByteArray *documentTypeIdPtr, const QString *fileNamePtr=nullptr, bool createView=true, const QByteArray &viewTypeId="", istd::IChangeable **documentPtr=nullptr, FileToTypeMap *loadedMapPtr=nullptr, bool beQuiet=false, bool *ignoredPtr=nullptr, iproc::IProgressManager *progressManagerPtr=nullptr)
Opens document(s) from the file list.
virtual QString GetSaveFilePath(const QByteArray &documentTypeId, const istd::IChangeable *dataObjectPtr, const QString ¤tFilePath) const =0
Gets save file name.
CSingleDocumentManagerBase()
bool HasDocumentPendingChanges() const
virtual istd::IChangeable & GetDocumentFromIndex(int index, DocumentInfo *documentInfoPtr=nullptr) const
Get document at specified index.
Base implementation of document manager.
QMap< QString, QByteArray > FileToTypeMap
Map from file path to ducument type ID's.
Interface providing UNDO/REDO functionality.
Basic implementation for a single model observer.
Consume information about progress of some process.
Represent input/output persistence archive.
Set of change flags (its IDs).
Common interface for data model objects, which can be changed.
Contains the system indenendent basic implementations of Document/View design pattern.