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

Complex document template consists of more simple templates. More...

#include <CCompositeDocumentTemplateComp.h>

Inheritance diagram for idoc::CCompositeDocumentTemplateComp:
icomp::CComponentBase idoc::IDocumentTemplate icomp::IComponent idoc::IDocumentTypesInfo istd::IPolymorphic istd::IPolymorphic

Public Types

typedef icomp::CComponentBase BaseClass
 
- Public Types inherited from idoc::IDocumentTemplate
typedef istd::TUniqueInterfacePtr< istd::IPolymorphicViewUniquePtr
 Type definitions for view smart pointers.
 
typedef istd::TSharedInterfacePtr< istd::IPolymorphicViewSharedPtr
 
- 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.
 

Public Member Functions

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.
 
virtual Ids GetViewTypeIds (const QByteArray &documentTypeId) const override
 Return supported view type IDs for specified document type.
 
virtual QString GetViewTypeName (const QByteArray &documentTypeId, const QByteArray &viewTypeId) const override
 Get human readable name of some view type ID.
 
virtual ifile::IFilePersistenceGetFileLoader (const QByteArray &documentTypeId) const override
 Get file loader/saver for specified document ID.
 
virtual istd::IChangeableUniquePtr CreateDocument (QByteArray &documentTypeId, bool initialize=true, bool beQuiet=false, bool *ignoredFlagPtr=NULL) const override
 Creates a document instance for document type documentTypeId.
 
virtual ViewUniquePtr CreateView (const QByteArray &documentTypeId, istd::IChangeable *documentPtr, const QByteArray &viewTypeId=QByteArray()) const override
 Creates a view instance for document document of type viewTypeId.
 
virtual idoc::IUndoManagerUniquePtr CreateUndoManager (const QByteArray &documentTypeId, istd::IChangeable *documentPtr) const override
 Creates an undo manager for a given document documentPtr.
 
- Public Member Functions inherited from icomp::CComponentBase
 CComponentBase ()
 Create component and assign it to specific context.
 
virtual const icomp::IComponentGetParentComponent (bool ownerOnly=false) const override
 Get parent of this component.
 
virtual void * GetInterface (const istd::CClassInfo &interfaceType, const QByteArray &subId="") override
 Get access to specified component interface.
 
virtual IComponentContextSharedPtr GetComponentContext () const override
 Get access to component context describing all application-specified component information loaded from components registry.
 
virtual void SetComponentContext (const IComponentContextSharedPtr &contextPtr, const icomp::IComponent *parentPtr, bool isParentOwner) override
 Set component context of this component.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Protected Member Functions

virtual void OnComponentCreated () override
 
virtual void OnComponentDestroyed () override
 
- Protected Member Functions inherited from icomp::CComponentBase
bool IsComponentActive () const
 Check if component is active.
 
virtual const icomp::IRealComponentStaticInfoGetComponentStaticInfo () const =0
 Get access to static info of this component.
 

Additional Inherited Members

- Static Protected Member Functions inherited from icomp::CComponentBase
static const icomp::IRealComponentStaticInfoInitStaticInfo (IComponent *componentPtr)
 
static QByteArray GetComponentId (const icomp::IComponentContext *componentContextPtr, const QByteArray &contextId=QByteArray())
 

Detailed Description

Complex document template consists of more simple templates.

Definition at line 17 of file CCompositeDocumentTemplateComp.h.

Member Typedef Documentation

◆ BaseClass

Definition at line 22 of file CCompositeDocumentTemplateComp.h.

Member Function Documentation

◆ CreateDocument()

virtual istd::IChangeableUniquePtr idoc::CCompositeDocumentTemplateComp::CreateDocument ( QByteArray &  documentTypeId,
bool  initialize = true,
bool  beQuiet = false,
bool *  ignoredFlagPtr = NULL 
) const
overridevirtual

Creates a document instance for document type documentTypeId.

Parameters
documentTypeIdID of document type, can be empty for default document. If document type is undefined (empty), this field will be used to return ID of used type.
initializeIf true, document should be filled with initial data (operation new), otherwise initialization is not needed (e.g., for document loading - filling of data will be done by loader).
beQuietIf true, no user interaction dialogs will be shown.
ignoredFlagPtrOptional output flag indicating that the user canceled this operation.
Returns
Unique pointer to the created document, or nullptr if creation failed.
Example
QByteArray docType = "TextDocument";
istd::IChangeableUniquePtr doc = tmpl->CreateDocument(docType, true);
if (doc) {
// Document created successfully
}

Implements idoc::IDocumentTemplate.

◆ CreateUndoManager()

virtual idoc::IUndoManagerUniquePtr idoc::CCompositeDocumentTemplateComp::CreateUndoManager ( const QByteArray &  documentTypeId,
istd::IChangeable documentPtr 
) const
overridevirtual

Creates an undo manager for a given document documentPtr.

Parameters
documentTypeIdID of document type.
documentPtrPointer to document object that will use this undo manager.
Returns
Unique pointer to created instance of undo manager, or nullptr if creating of undo manager was impossible.

The undo manager tracks changes to the document and allows them to be undone/redone. Not all document types support undo functionality.

Implements idoc::IDocumentTemplate.

◆ CreateView()

virtual ViewUniquePtr idoc::CCompositeDocumentTemplateComp::CreateView ( const QByteArray &  documentTypeId,
istd::IChangeable documentPtr,
const QByteArray &  viewTypeId = QByteArray() 
) const
overridevirtual

Creates a view instance for document document of type viewTypeId.

Parameters
documentTypeIdID of document type.
documentPtrPointer to document object that this view will display.
viewTypeIdOptional ID specifying view type if more view types are supported. If empty or not provided, the first/default view type for this document type is used. Use GetViewTypeIds() to discover available view types for a document type.
Returns
Unique pointer to the created view, or nullptr if creation failed.

The view is responsible for displaying the document's content to the user. Some document types support multiple view types (e.g., text view, hex view, preview).

Example
// Create default view
istd::IPolymorphic* view = tmpl->CreateView(docTypeId, doc.Get()).Release();
// Create specific view type
QByteArray viewType = "HexView";
istd::IPolymorphic* hexView = tmpl->CreateView(docTypeId, doc.Get(), viewType).Release();
Base interface for all used interfaces and implementations.

Implements idoc::IDocumentTemplate.

◆ GetDefaultDirectory()

virtual QString idoc::CCompositeDocumentTemplateComp::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::CCompositeDocumentTemplateComp::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.

◆ GetDocumentTypeIds()

virtual Ids idoc::CCompositeDocumentTemplateComp::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::CCompositeDocumentTemplateComp::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::CCompositeDocumentTemplateComp::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.

◆ GetFileLoader()

virtual ifile::IFilePersistence * idoc::CCompositeDocumentTemplateComp::GetFileLoader ( const QByteArray &  documentTypeId) const
overridevirtual

Get file loader/saver for specified document ID.

Parameters
documentTypeIdType ID of document that will be loaded/saved.
Returns
Pointer to file persistence object that handles I/O operations, or NULL if not supported.

The file persistence object handles reading and writing documents to/from files.

Implements idoc::IDocumentTemplate.

◆ GetViewTypeIds()

virtual Ids idoc::CCompositeDocumentTemplateComp::GetViewTypeIds ( const QByteArray &  documentTypeId) const
overridevirtual

Return supported view type IDs for specified document type.

Parameters
documentTypeIdID of document type.
Returns
Vector of view type IDs that can display this document type.

A single document type may support multiple view types (e.g., text view, hex view, preview).

Implements idoc::IDocumentTemplate.

◆ GetViewTypeName()

virtual QString idoc::CCompositeDocumentTemplateComp::GetViewTypeName ( const QByteArray &  documentTypeId,
const QByteArray &  viewTypeId 
) const
overridevirtual

Get human readable name of some view type ID.

Parameters
documentTypeIdID of document type.
viewTypeIdID of view type.
Returns
Localized human-readable name for the view type (e.g., "Text View", "Hex View").

Implements idoc::IDocumentTemplate.

◆ IsFeatureSupported()

virtual bool idoc::CCompositeDocumentTemplateComp::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.

◆ OnComponentCreated()

virtual void idoc::CCompositeDocumentTemplateComp::OnComponentCreated ( )
overrideprotectedvirtual

Reimplemented from icomp::CComponentBase.

◆ OnComponentDestroyed()

virtual void idoc::CCompositeDocumentTemplateComp::OnComponentDestroyed ( )
overrideprotectedvirtual

Reimplemented from icomp::CComponentBase.


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