ITextEdit.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
11 #include <Bentley/bvector.h>
14 
16 
19 
22 
25 
28 typedef bvector<ITextPartIdPtr> T_ITextPartIdPtrVector;
29 
32 
35 
38 
41 
42 //=======================================================================================
43 // This class exists so that handlers can have their own private way of describing the text within them, and guarantees whatever they hand out is reference counted.
44 // @bsiclass Bentley Systems
45 //=======================================================================================
47  {
48 private:
49  virtual void MakeClassAbstract() = 0;
50 public:
51 
52  }; // ITextPartId
53 
54 //=======================================================================================
56 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
57 // @bsiclass Bentley Systems
58 //=======================================================================================
60  {
61 private:
62  virtual void MakeClassAbstract() = 0;
63 public:
64 
66  public: DGNPLATFORM_EXPORT bool ShouldIncludeEmptyParts () const;
67 
70  public: DGNPLATFORM_EXPORT void SetShouldIncludeEmptyParts (bool);
71 
73  public: DGNPLATFORM_EXPORT bool ShouldRequireFieldSupport () const;
74 
77  public: DGNPLATFORM_EXPORT void SetShouldRequireFieldSupport (bool);
78 
80  public: DGNPLATFORM_EXPORT static ITextQueryOptionsPtr CreateDefault ();
81 
82  }; // ITextQueryOptions
83 
84 //=======================================================================================
85 // Element handlers implement this interface to expose formatted text in a read-only fashion. The handler will return one or more generic reference counted objects known as ITextPartId; these have no meaning to users of the API other than to feed them back into this interface. The general workflow is to query the handler for its ITextPartId(s), and then ask for a TextBlock representing a specific ITextPartId. Some element handlers implement ITextEdit instead (a sub-class of this class) to indicate that they also support text write operations. Some element handlers expose multiple pieces of text (e.g. dimenions); text elements (see ITextQuery::IsTextElement) will only ever expose a single piece of text. Regardless of whether the element returns a single ITextPartId or not, you must still ask for a ITextPartId, and provide one for all operations.
86 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
87 // @bsiclass Bentley Systems
88 //=======================================================================================
90  {
91 private:
93 
94 private:
95  virtual void MakeClassAbstract() = 0;
96 public:
97 
99  public: DGNPLATFORM_EXPORT bool IsTextElement (ElementHandleCR) const;
100 
102  public: DGNPLATFORM_EXPORT bool DoesSupportFields (ElementHandleCR) const;
103 
105  public: DGNPLATFORM_EXPORT ITextPartIdPtr GetTextPartId (ElementHandleCR, HitPathCR) const;
106 
110 
113  public: DGNPLATFORM_EXPORT TextBlockPtr GetTextPart (ElementHandleCR, ITextPartIdCR) const;
114 
115  }; // ITextQuery
116 
117 //=======================================================================================
119 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
120 // @bsiclass Bentley Systems
121 //=======================================================================================
123  {
124 private:
125  virtual void MakeClassAbstract() = 0;
126 public:
127 
130  DGNPLATFORM_EXPORT bool GetPreventStyleNone() const;
131 
133  DGNPLATFORM_EXPORT void SetPreventStyleNone(bool);
134 
136  DGNPLATFORM_EXPORT static ITextEditRestrictionsPtr CreateDefault();
137 
138  }; // ITextEditRestrictions
139 
140 //=======================================================================================
141 // Element handlers implement this interface to expose formatted text in a read/write fashion. This interface cannot be used to create text, but merely to replace. Additionally, this interface is not responsible for deleting elements when asked to replace with a blank TextBlock; check the return status if this a potential case for you, and manually delete. As an extension to ITextQuery, the handler will return one or more generic reference counted objects known as ITextPartId; these have no meaning to users of the API other than to feed them back into this interface. The general workflow is to query the handler for its ITextPartId(s), ask for a TextBlock representing a specific ITextPartId, modify it, and then replace that same ITextPartId with your modified TextBlock. Regardless of whether the element returns a single ITextPartId or not, you must still ask for a ITextPartId, and provide one for all operations.
142 // @bsiclass Bentley Systems
143 //=======================================================================================
145  {
146  //=======================================================================================
147  // Describes the outcome of the ITextEdit::ReplaceText method.
148  // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
149  // @bsiclass Bentley Systems
150  //=======================================================================================
151  public: enum ReplaceStatus
152  {
153  ReplaceStatus_Success = 0,
154  ReplaceStatus_Error = 1,
155  ReplaceStatus_Delete = 2
156 
157  }; // ReplaceStatus
158 
159 private:
160  virtual void MakeClassAbstract() = 0;
161 public:
162 
164  public: DGNPLATFORM_EXPORT ITextEditRestrictionsPtr GetTextPartEditRestrictions(ElementHandleCR, ITextPartIdCR) const;
165 
168  public: DGNPLATFORM_EXPORT ReplaceStatus ReplaceTextPart (EditElementHandleR, ITextPartIdCR, TextBlockCR);
169 
170  }; // ITextEdit
171 
173 
RefCountedPtr< ITextQueryOptions > ITextQueryOptionsPtr
Ref-counted wrapper for ITextQueryOptions.
Definition: ITextEdit.h:21
struct DgnPlatform::ITextPartId const & ITextPartIdCR
Definition: DgnPlatform.h:337
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
Allows handlers to restrict editing of text parts.
Definition: ITextEdit.h:122
Definition: ITextEdit.h:89
RefCountedPtr< ITextEditRestrictions > ITextEditRestrictionsPtr
Ref-counted wrapper for ITextQueryOptions.
Definition: ITextEdit.h:24
#define DECLARE_KEY_METHOD
Definition: Bentley.h:95
A writeable "handle" to an MSElement.
Definition: ElementHandle.h:470
T_ITextPartIdPtrVector const & T_ITextPartIdPtrVectorCR
Definition: ITextEdit.h:40
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
RefCountedPtr< ITextPartId > ITextPartIdPtr
Ref-counted wrapper for ITextPartId.
Definition: ITextEdit.h:18
Allows you to pre-filter the ITextPartId collection. This can be used to increase performance by prev...
Definition: ITextEdit.h:59
ReplaceStatus
Definition: ITextEdit.h:151
T_ITextPartIdPtrVector * T_ITextPartIdPtrVectorP
Definition: ITextEdit.h:31
Definition: ITextEdit.h:46
struct DgnPlatform::ITextQueryOptions const & ITextQueryOptionsCR
Definition: DgnPlatform.h:339
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
Definition: ITextEdit.h:144
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
Base class to make a class non-copyable.
Definition: NonCopyableClass.h:23
struct DgnPlatform::TextBlock const & TextBlockCR
Definition: DgnPlatform.h:457
struct DgnPlatform::HitPath const & HitPathCR
Definition: DgnPlatform.h:274
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
bvector< ITextPartIdPtr > T_ITextPartIdPtrVector
A collection of ITextPartIds.
Definition: ITextEdit.h:28
T_ITextPartIdPtrVector const * T_ITextPartIdPtrVectorCP
Definition: ITextEdit.h:37
struct DgnPlatform::ElementHandle const & ElementHandleCR
Definition: DgnPlatform.h:260
T_ITextPartIdPtrVector & T_ITextPartIdPtrVectorR
Definition: ITextEdit.h:34
#define EXPORT_VTABLE_ATTRIBUTE
Definition: Bentley.h:67

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.