ACF $AcfVersion:0$
Public Member Functions | Protected Member Functions | List of all members
idoc::CTmplBasedDocumentManagerBase Class Reference

Base implementation of document manager. More...

#include <CTmplBasedDocumentManagerBase.h>

Inheritance diagram for idoc::CTmplBasedDocumentManagerBase:
idoc::IDocumentManager istd::IChangeable idoc::IDocumentTypesInfo istd::IPolymorphic istd::IPolymorphic idoc::CMultiDocumentManagerBase idoc::CSingleDocumentManagerBase iqtdoc::TQtDocumentManagerWrap< idoc::CMultiDocumentManagerBase, iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QMdiArea > > > iqtdoc::TQtDocumentManagerWrap< idoc::CSingleDocumentManagerBase, iqtgui::TRestorableGuiWrap< iqtgui::TGuiComponentBase< QWidget > > > iqtdoc::CMultiDocumentWorkspaceGuiComp iqtdoc::CSingleDocumentWorkspaceGuiComp

Public Member Functions

 CTmplBasedDocumentManagerBase ()
 
virtual int GetAllowedOperationFlags (const istd::IPolymorphic *viewPtr=NULL) const override
 Get flags of allowed operations.
 
virtual bool IsFeatureSupported (int featureFlags, const QByteArray &documentTypeId) const override
 Return true, if the feature(s) is supported by this document template.
 
virtual Ids GetDocumentTypeIds () const override
 Get list of supported document type IDs.
 
virtual QString GetDocumentTypeName (const QByteArray &documentTypeId) const override
 Get human readable name of some document type ID.
 
virtual ifile::IFileTypeInfoGetDocumentFileTypeInfo (const QByteArray &documentTypeId) const override
 Get file type information object for some selected document type.
 
virtual Ids GetDocumentTypeIdsForFile (const QString &filePath) const override
 Get list of supported document IDs that can handle the specified file.
 
virtual QString GetDefaultDirectory (const QString &sugestedDir="", const QByteArray *documentTypeIdPtr=NULL) const override
 Return default directory for specified document type.
 
- Public Member Functions inherited from idoc::IDocumentManager
virtual idoc::IUndoManagerGetUndoManagerForDocument (const istd::IChangeable *documentPtr) const =0
 Return undo manager for document documentPtr.
 
virtual int GetDocumentsCount () const =0
 Get number of opened documents.
 
virtual istd::IChangeableGetDocumentFromIndex (int index, DocumentInfo *documentInfoPtr=NULL) const =0
 Get document at specified index.
 
virtual int GetViewsCount (int documentIndex) const =0
 Get number of view for specified document.
 
virtual istd::IPolymorphicGetViewFromIndex (int documentIndex, int viewIndex) const =0
 Get single view using its and document indices.
 
virtual istd::IPolymorphicGetActiveView () const =0
 Return the active document.
 
virtual void SetActiveView (istd::IPolymorphic *viewPtr)=0
 Indicate that some view is active now.
 
virtual istd::IChangeableGetDocumentFromView (const istd::IPolymorphic &view, DocumentInfo *documentInfoPtr=NULL) const =0
 Return the document assigned to view.
 
virtual istd::IPolymorphicAddViewToDocument (const istd::IChangeable &document, const QByteArray &viewTypeId=QByteArray())=0
 Add a new view to the document.
 
virtual QByteArray GetDocumentTypeId (const istd::IChangeable &document) const =0
 Get ID of document type managed by this object.
 
virtual bool InsertNewDocument (const QByteArray &documentTypeId, bool createView=true, const QByteArray &viewTypeId="", istd::IChangeableSharedPtr *newDocumentPtr=nullptr, bool beQuiet=false, bool *ignoredPtr=NULL)=0
 Creates a new document with the document ID documentTypeId.
 
virtual bool OpenDocument (const QByteArray *documentTypeIdPtr=NULL, 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)=0
 Opens document(s) from the file list.
 
virtual bool SaveDocument (int documentIndex=-1, bool requestFileName=false, FileToTypeMap *savedMapPtr=NULL, bool beQuiet=false, bool *ignoredPtr=NULL, ibase::IProgressManager *progressManagerPtr=NULL)=0
 Save document.
 
virtual bool SaveDirtyDocuments (bool beQuiet=false, bool *ignoredPtr=NULL)=0
 Ask user (optional) and save all dirty (changed) documents.
 
virtual bool CloseDocument (int documentIndex=-1, bool beQuiet=false, bool *ignoredPtr=NULL)=0
 Close document and all its views.
 
virtual bool CloseView (istd::IPolymorphic *viewPtr=NULL, bool beQuiet=false, bool *ignoredPtr=NULL)=0
 Close view.
 
- Public Member Functions inherited from istd::IChangeable
virtual int GetSupportedOperations () const
 Get set of flags for supported operations.
 
virtual bool CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS)
 Copy this object from another one.
 
virtual bool IsEqual (const IChangeable &object) const
 Compare this object with another object.
 
virtual istd::TUniqueInterfacePtr< istd::IChangeableCloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const
 Make a copy of this object.
 
virtual bool ResetData (CompatibilityMode mode=CM_WITHOUT_REFS)
 Reset data to its default state.
 
virtual void BeginChanges (const ChangeSet &changeSet)
 Starts the change transaction.
 
virtual void EndChanges (const ChangeSet &changeSet)
 Ends the change transaction.
 
virtual void BeginChangeGroup (const ChangeSet &changeSet)
 Starts group of changes.
 
virtual void EndChangeGroup (const ChangeSet &changeSet)
 Ends group of changes.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Member Functions

virtual const idoc::IDocumentTemplateGetDocumentTemplate () const
 
void SetDocumentTemplate (const idoc::IDocumentTemplate *documentTemplatePtr)
 
- Protected Member Functions inherited from istd::IChangeable
virtual void OnBeginChanges ()
 Callback function for begin change event.
 
virtual void OnEndChanges (const ChangeSet &changeSet)
 Callback function for end change event.
 

Additional Inherited Members

- Public Types inherited from idoc::IDocumentManager
enum  ChangeFlags {
  CF_DOCUMENT_RENAMED = 0x834d670 , CF_DOCUMENT_CREATED , CF_DOCUMENT_REMOVED , CF_DOCUMENT_COUNT_CHANGED ,
  CF_VIEW_ACTIVATION_CHANGED
}
 Possible changes in the manager data model. More...
 
enum  OperationFlags {
  OF_FILE_NEW = 0x0001 , OF_FILE_OPEN = 0x0002 , OF_FILE_SAVE = 0x0004 , OF_FILE_SAVE_AS = 0x0008 ,
  OF_KNOWN_PATH = 0x0010
}
 Flags describing possible operations that can be performed by the document manager. More...
 
typedef QMap< QString, QByteArray > FileToTypeMap
 Map from file path to document type ID's.
 
- Public Types inherited from istd::IChangeable
enum  ChangeFlags {
  CF_ACF_INTERNAL = 0 , CF_ALL_DATA , CF_ANY , CF_DESTROYING ,
  CF_DELEGATED , CF_NO_UNDO
}
 Data model change notification flags. More...
 
enum  SupportedOperations {
  SO_NONE = 0 , SO_OBSERVE = 1 << 0 , SO_COPY = 1 << 1 , SO_CLONE = 1 << 2 ,
  SO_COMPARE = 1 << 3 , SO_RESET = 1 << 4
}
 Flags for supported operations. More...
 
enum  CompatibilityMode { CM_STRICT , CM_WITHOUT_REFS , CM_WITH_REFS , CM_CONVERT }
 Control how relationship betweeen objects are interpreted. More...
 
typedef QMultiMap< QByteArray, QVariant > ChangeInfoMap
 
- Public Types inherited from idoc::IDocumentTypesInfo
enum  SupportedFeatures { SF_NEW_DOCUMENT = 0x0001 , SF_EDIT_DOCUMENT = 0x0010 , SF_DEFAULT = 0xffff }
 Enumeration for supported types of operations with documents. More...
 
typedef QVector< QByteArray > Ids
 Type definition for document type ID collections.
 
- Static Public Member Functions inherited from istd::IChangeable
static const ChangeSetGetNoChanges ()
 Get empty set of changes.
 
static const ChangeSetGetAnyChange ()
 Get anonymous change set.
 
static const ChangeSetGetAllChanges ()
 Get anonymous change set.
 
static const ChangeSetGetDelegatedChanges ()
 Get delegated change set.
 

Detailed Description

Base implementation of document manager.

This implementation base on the document template concept.

See also
IDocumentTemplate

Definition at line 21 of file CTmplBasedDocumentManagerBase.h.

Constructor & Destructor Documentation

◆ CTmplBasedDocumentManagerBase()

idoc::CTmplBasedDocumentManagerBase::CTmplBasedDocumentManagerBase ( )

Member Function Documentation

◆ GetAllowedOperationFlags()

virtual int idoc::CTmplBasedDocumentManagerBase::GetAllowedOperationFlags ( const istd::IPolymorphic viewPtr = NULL) const
overridevirtual

Get flags of allowed operations.

Parameters
viewPtrOptional pointer to a specific view to check operations for. If NULL, checks operations for the active view/document.
Returns
Bitwise OR of OperationFlags indicating which operations are currently allowed.
Example
int flags = docMgr->GetAllowedOperationFlags();
// New document creation is supported
}
// Saving is available
}
@ OF_FILE_NEW
New document creation is supported.
@ OF_FILE_SAVE
Saving documents is supported.

Implements idoc::IDocumentManager.

◆ GetDefaultDirectory()

virtual QString idoc::CTmplBasedDocumentManagerBase::GetDefaultDirectory ( const QString &  sugestedDir = "",
const QByteArray *  documentTypeIdPtr = NULL 
) const
overridevirtual

Return default directory for specified document type.

Parameters
suggestedDirTemplate directory suggested by user or application.
documentTypeIdPtrOptional pointer to ID of document type.
Returns
Resolved default directory path to use for file dialogs.

If suggestedDir is provided and valid, it may be used. Otherwise, the type-specific default directory is returned.

Implements idoc::IDocumentTypesInfo.

◆ GetDocumentFileTypeInfo()

virtual ifile::IFileTypeInfo * idoc::CTmplBasedDocumentManagerBase::GetDocumentFileTypeInfo ( const QByteArray &  documentTypeId) const
overridevirtual

Get file type information object for some selected document type.

Parameters
documentTypeIdID of document type as returned by GetDocumentTypeIds().
Returns
Pointer to file type info providing file extensions, filters, etc., or NULL if not available.

Implements idoc::IDocumentTypesInfo.

◆ GetDocumentTemplate()

virtual const idoc::IDocumentTemplate * idoc::CTmplBasedDocumentManagerBase::GetDocumentTemplate ( ) const
protectedvirtual

◆ GetDocumentTypeIds()

virtual Ids idoc::CTmplBasedDocumentManagerBase::GetDocumentTypeIds ( ) const
overridevirtual

Get list of supported document type IDs.

Returns
Vector of document type IDs supported by this template/manager.

Implements idoc::IDocumentTypesInfo.

◆ GetDocumentTypeIdsForFile()

virtual Ids idoc::CTmplBasedDocumentManagerBase::GetDocumentTypeIdsForFile ( const QString &  filePath) const
overridevirtual

Get list of supported document IDs that can handle the specified file.

Parameters
filePathFull path to file to check.
Returns
Vector of document type IDs that can open/handle this file.

This method determines which document types are compatible with a given file based on file extension, content analysis, or other criteria.

Implements idoc::IDocumentTypesInfo.

◆ GetDocumentTypeName()

virtual QString idoc::CTmplBasedDocumentManagerBase::GetDocumentTypeName ( const QByteArray &  documentTypeId) const
overridevirtual

Get human readable name of some document type ID.

Parameters
documentTypeIdID of document type as returned by GetDocumentTypeIds().
Returns
Localized, user-friendly name of the document type (e.g., "Text Document", "Image File").

Implements idoc::IDocumentTypesInfo.

◆ IsFeatureSupported()

virtual bool idoc::CTmplBasedDocumentManagerBase::IsFeatureSupported ( int  featureFlags,
const QByteArray &  documentTypeId 
) const
overridevirtual

Return true, if the feature(s) is supported by this document template.

Parameters
featureFlagsBitwise OR of SupportedFeatures flags to check.
documentTypeIdID of document type to check.
Returns
True if all specified features are supported for this document type.

Implements idoc::IDocumentTypesInfo.

◆ SetDocumentTemplate()

void idoc::CTmplBasedDocumentManagerBase::SetDocumentTemplate ( const idoc::IDocumentTemplate documentTemplatePtr)
protected

The documentation for this class was generated from the following file: