CSingleDocumentTemplateBase.h
Go to the documentation of this file.
1 #ifndef idoc_CSingleDocumentTemplateBase_included
2 #define idoc_CSingleDocumentTemplateBase_included
3 
4 
5 // ACF includes
6 #include <imod/IModel.h>
8 
9 
10 namespace idoc
11 {
12 
13 
14 class IDocumentManager;
15 
16 
21 {
22 public:
24 
25  const QByteArray& GetDocumentTypeId() const;
26  virtual void SetSupportedFeatures(int featureFlags);
27  virtual void SetDocumentTypeId(const QByteArray& id);
28  virtual void SetDocumentTypeName(const QString& name);
29  virtual void SetViewTypeId(const QByteArray& id);
30  virtual void SetViewTypeName(const QString& name);
31  virtual void SetDefaultDirectory(const QString& defaultDirectory);
32 
33  // reimplemented (idoc::IDocumentTypesInfo)
34  virtual bool IsFeatureSupported(int featureFlags, const QByteArray& documentTypeId) const;
35  virtual Ids GetDocumentTypeIds() const;
36  virtual QString GetDocumentTypeName(const QByteArray& documentTypeId) const;
37  virtual ifile::IFileTypeInfo* GetDocumentFileTypeInfo(const QByteArray& documentTypeId) const;
38  virtual Ids GetDocumentTypeIdsForFile(const QString& filePath) const;
39  virtual QString GetDefaultDirectory(const QString& sugestedDir = "", const QByteArray* documentTypeIdPtr = NULL) const;
40 
41  // reimplemented (idoc::IDocumentTemplate)
42  virtual Ids GetViewTypeIds(const QByteArray& documentTypeId) const;
43  virtual QString GetViewTypeName(
44  const QByteArray& documentTypeId,
45  const QByteArray& viewTypeId) const;
46 
47 protected:
48  bool IsDocumentTypeSupported(const QByteArray& documentTypeId) const;
49  bool IsViewTypeSupported(const QByteArray& viewTypeId) const;
50 
51 private:
52  QString m_defaultDirectory;
53 
54  QByteArray m_documentTypeId;
55  QString m_documentTypeName;
56  QByteArray m_viewTypeId;
57  QString m_viewTypeName;
58 
59  int m_supportedFeatures;
60 };
61 
62 
63 // inline methods
64 
65 inline const QByteArray& CSingleDocumentTemplateBase::GetDocumentTypeId() const
66 {
67  return m_documentTypeId;
68 }
69 
70 
71 // inline protected methods
72 
73 inline bool CSingleDocumentTemplateBase::IsDocumentTypeSupported(const QByteArray& documentTypeId) const
74 {
75  return documentTypeId.isEmpty() || (documentTypeId == m_documentTypeId); // default or the same type is accepted
76 }
77 
78 
79 inline bool CSingleDocumentTemplateBase::IsViewTypeSupported(const QByteArray& viewTypeId) const
80 {
81  return viewTypeId.isEmpty() || (viewTypeId == m_viewTypeId); // default or the same type is accepted
82 }
83 
84 
85 } // namespace idoc
86 
87 
88 #endif // !idoc_CSingleDocumentTemplateBase_included
89 
Provide loading and saving of objects.
Definition: IFileTypeInfo.h:22
virtual QString GetViewTypeName(const QByteArray &documentTypeId, const QByteArray &viewTypeId) const
Get human readable name of some view type ID.
virtual QString GetDocumentTypeName(const QByteArray &documentTypeId) const
Get human readable name of some document type ID.
virtual void SetDefaultDirectory(const QString &defaultDirectory)
bool IsViewTypeSupported(const QByteArray &viewTypeId) const
virtual void SetDocumentTypeName(const QString &name)
virtual void SetSupportedFeatures(int featureFlags)
virtual void SetDocumentTypeId(const QByteArray &id)
virtual Ids GetViewTypeIds(const QByteArray &documentTypeId) const
Return supported view type IDs for specified document type.
Base class implementing document template for single document type.
virtual bool IsFeatureSupported(int featureFlags, const QByteArray &documentTypeId) const
Return true, if the feature(s) is supported by this document template.
bool IsDocumentTypeSupported(const QByteArray &documentTypeId) const
virtual Ids GetDocumentTypeIds() const
Get list of supported document ID's can be created for specified file.
Common interface for a document template.
virtual QString GetDefaultDirectory(const QString &sugestedDir="", const QByteArray *documentTypeIdPtr=NULL) const
Return default directory for specified document type.
#define NULL
Definition: istd.h:64
virtual void SetViewTypeId(const QByteArray &id)
QVector< QByteArray > Ids
virtual ifile::IFileTypeInfo * GetDocumentFileTypeInfo(const QByteArray &documentTypeId) const
Get file type information object for some selected document type.
virtual Ids GetDocumentTypeIdsForFile(const QString &filePath) const
Get list of supported document ID's can be created for specified file.
virtual void SetViewTypeName(const QString &name)
const QByteArray & GetDocumentTypeId() const

© 2007-2017 Witold Gantzke and Kirill Lepskiy