Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreTextRange.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_TEXT_RANGE__
8 #define __HDI_CORE_TEXT_RANGE__
9 
10 #include <vector>
11 
12 #include "hdicoreTypes.h"
13 
14 namespace hdi
15 {
16  namespace plugin
17  {
18  class TextRange;
19  }
20 
21  namespace core
22  {
23  class TextArt;
24  class TextCharFeatures;
25  class TextCharInspector;
26  class TextCharStyleSet;
27  class TextPara;
28  class TextParaFeatures;
29  class TextParaInspector;
30  class TextParaStyleSet;
31  class TextRangeSet;
32  class TextStory;
33  class TextWord;
34 
38  class TextRange
39  {
40  public:
41  typedef std::vector< TextArt* > TextArtVector;
42  typedef std::vector< TextPara* > TextParaVector;
43  typedef std::vector< TextRange* > TextRangeVector;
44  typedef std::vector< TextWord* > TextWordVector;
45 
46  enum CollapseDirection
47  {
48  UnknownCollapseDir = 0,
49  CollapseEndDir = 10,
50  CollapseStartDir = 20
51  };
52 
62  TextRange();
63 
71  TextRange(const TextRange& tr_);
72 
78  virtual ~TextRange();
79 
85  virtual TextRange& operator=(const TextRange& rhs_);
86 
95  virtual bool operator==(const TextRange& rhs_) const;
96 
105  virtual bool operator!=(const TextRange& rhs_) const;
106 
118  virtual std::auto_ptr<ATE::ITextRange> ateTextRange() const;
119 
127  virtual bool isEmpty() const;
128 
136  virtual std::auto_ptr<TextRange> duplicate() const;
137 
145  virtual int32_t start() const;
146 
154  virtual void setStart(const int32_t start_);
155 
163  virtual int32_t end() const;
164 
172  virtual void setEnd(const int32_t end_);
173 
181  virtual int32_t size() const;
182 
191  virtual void setRange(const int32_t start_, const int32_t end_);
192 
202  virtual void collapse(const CollapseDirection dir_ = CollapseEndDir);
203 
217  virtual int32_t move(const int32_t unit_);
218 
226  virtual std::auto_ptr<TextStory> story() const;
227 
235  virtual void setStory(const TextStory& story_);
236 
244  virtual std::auto_ptr<TextRangeSet> selections() const;
245 
255  virtual TextArtVector textFrames() const;
256 
266  virtual TextParaVector paragraphs() const;
267 
277  virtual TextWordVector words() const;
278 
289  virtual TextRangeVector runs() const;
290 
299  virtual std::auto_ptr<TextCharInspector> charInspector() const;
300 
309  virtual std::auto_ptr<TextParaInspector> paraInspector() const;
310 
318  virtual std::auto_ptr<TextCharStyleSet> namedCharStyles() const;
319 
331  virtual bool setNamedCharStyle(const std::string& name_);
332 
339  virtual void clearNamedCharStyle();
340 
348  virtual std::auto_ptr<TextParaStyleSet> namedParaStyles() const;
349 
361  virtual bool setNamedParaStyle(const std::string& name_);
362 
369  virtual void clearNamedParaStyle();
370 
380  virtual std::auto_ptr<TextCharFeatures> uniqueCharFeatures() const;
381 
391  virtual std::auto_ptr<TextParaFeatures> uniqueParaFeatures() const;
392 
401  virtual bool hasLocalCharFeatures() const;
402 
413  virtual std::auto_ptr<TextCharFeatures> localCharFeatures() const;
414 
428  virtual void setLocalCharFeatures(const TextCharFeatures& feat_);
429 
441  virtual void replaceOrAddLocalCharFeatures(const TextCharFeatures& feat_);
442 
450  virtual void clearLocalCharFeatures();
451 
460  virtual bool hasLocalParaFeatures() const;
461 
472  virtual std::auto_ptr<TextParaFeatures> localParaFeatures() const;
473 
487  virtual void setLocalParaFeatures(const TextParaFeatures& feat_);
488 
500  virtual void replaceOrAddLocalParaFeatures(const TextParaFeatures& feat_);
501 
509  virtual void clearLocalParaFeatures();
510 
521  virtual void insertBefore(const std::string& text_);
522 
533  virtual void insertAfter(const std::string& text_);
534 
545  virtual void insertBefore(const TextRange& otherRange_);
546 
557  virtual void insertAfter(const TextRange& otherRange_);
558 
572  virtual std::string contents(const std::string& le_ = "\n") const;
573 
582  virtual void select(const bool addToCurrSelection_ = false);
583 
590  virtual void deselect();
591 
599  virtual void changeCase(const CaseChangeType type_);
600 
610  virtual void fitHeadlines();
611 
620  virtual void remove();
621 
622 
623  private:
624  friend plugin::TextRange* __accessImpl(const TextRange&);
625  friend TextRange __accessCtor(const plugin::TextRange&);
626 
630  plugin::TextRange* __impl;
631 
637  TextRange(const plugin::TextRange&);
638  };
639 
640  typedef std::auto_ptr<TextRange> TextRangeAP;
641 
642  extern plugin::TextRange* __accessImpl(const TextRange&);
643  extern TextRange __accessCtor(const plugin::TextRange&);
644  }
645 }
646 
647 #endif
648 // __HDI_CORE_TEXT_RANGE__
virtual void collapse(const CollapseDirection dir_=CollapseEndDir)
Resets start or end point of the target range so that it contains only one character, either the first or the last.
virtual std::auto_ptr< TextCharFeatures > uniqueCharFeatures() const
Retrieves the unique character features used in the target text range. Unique features are those whic...
virtual int32_t move(const int32_t unit_)
Moves the target text range by adding or subtracting a number of characters to or from the start and ...
virtual TextArtVector textFrames() const
Gets a vector of the text frames contained in this text range.
Allows for easy manipulation of Illustrator text ranges.
Definition: hdicoreTextRange.h:38
virtual int32_t size() const
Retrieves the number of characters in the target text range.
virtual bool isEmpty() const
Gets whether the target TextRange object is empty.
Allows for easy manipulation of Illustrator text character features.
Definition: hdicoreTextCharFeatures.h:31
virtual std::auto_ptr< TextRangeSet > selections() const
Retrieves the selected text within this text range.
virtual std::auto_ptr< TextStory > story() const
Retrieves the story that contains this text range.
TextRange()
Creates a new TextRange object.
virtual void select(const bool addToCurrSelection_=false)
Selects the text in the target text range.
virtual void changeCase(const CaseChangeType type_)
Changes the case of the text in the target text range.
virtual void setLocalParaFeatures(const TextParaFeatures &feat_)
Replaces all of the local overrides for all paragraphs in the target text range with a new set of fea...
virtual ~TextRange()
Destructs a TextRange object.
virtual void setLocalCharFeatures(const TextCharFeatures &feat_)
Replaces all of the local overrides for all characters in the target text range with a new set of fea...
virtual void insertAfter(const std::string &text_)
Inserts text into the target text range after the current end point.
virtual void deselect()
Deselects the text in the target text range; this can result in a discontiguous selection, if this text range is a subset of the selected text.
Definition: hdicoreTextStory.h:30
virtual std::auto_ptr< TextRange > duplicate() const
Duplicates the target text range, returning a new unique TextRange object.
virtual void insertBefore(const std::string &text_)
Inserts text into the target text range before the current start point.
virtual std::auto_ptr< TextCharStyleSet > namedCharStyles() const
Retrieves a set of all named character styles used in the target text range.
virtual void clearLocalCharFeatures()
Removes all local overrides for all characters in the target text range. All character features are t...
virtual void setRange(const int32_t start_, const int32_t end_)
Convenience method to set both the start and end points of the target text range. ...
virtual bool setNamedParaStyle(const std::string &name_)
Associates a named paragraph style to the target text range. The inherited values can be overridden b...
virtual TextRangeVector runs() const
Gets a vector of the text ranges (that share character attributes) contained in this text range...
virtual void clearNamedParaStyle()
Removes the association of the target text range and its character style. Copies the feature values o...
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
virtual std::auto_ptr< TextParaStyleSet > namedParaStyles() const
Retrieves a set of all named paragraph styles used in the target text range.
virtual std::auto_ptr< ATE::ITextRange > ateTextRange() const
Gets the ATE text range ref around which the target object is wrapped.
virtual std::auto_ptr< TextParaFeatures > uniqueParaFeatures() const
Retrieves the unique paragraph features used in the target text range. Unique features are those whic...
Allows for easy manipulation of Illustrator text paragraph features.
Definition: hdicoreTextParaFeatures.h:27
virtual bool operator==(const TextRange &rhs_) const
Tests whether a given TextRange object is the same as another.
Definition: hdicoreaiArray.h:12
virtual TextWordVector words() const
Gets a vector of the words contained in this text range.
virtual TextRange & operator=(const TextRange &rhs_)
Overloaded assignment operator for TextRange objects.
virtual TextParaVector paragraphs() const
Gets a vector of the paragraphs contained in this text range.
virtual void clearLocalParaFeatures()
Removes all local overrides for all paragraphs in the target text range. All paragraph features are t...
virtual void replaceOrAddLocalParaFeatures(const TextParaFeatures &feat_)
Modifies the local overrides for all paragraphs in the target text range. All values that are assigne...
virtual int32_t start() const
Gets the start offset of the target text range.
virtual std::string contents(const std::string &le_="\n") const
Gets the value (contents) of the text range.
virtual void setEnd(const int32_t end_)
Sets the end offset of the target text range.
virtual void clearNamedCharStyle()
Removes the association of the target text range and its character style. Copies the feature values o...
virtual void setStart(const int32_t start_)
Sets the start offset of the target text range.
virtual void setStory(const TextStory &story_)
Sets the story that contains this text range.
virtual std::auto_ptr< TextParaFeatures > localParaFeatures() const
Retrieves the paragraph features that have local overrides in the target text range, and whose local values are the same in all text runs in the range.
virtual std::auto_ptr< TextCharInspector > charInspector() const
Creates an inspector with which to access the character features of all characters in the target text...
virtual bool setNamedCharStyle(const std::string &name_)
Associates a named character style to the target text range. The inherited values can be overridden b...
virtual bool hasLocalParaFeatures() const
Reports whether there any local paragraph feature overrides for paragraphs contained in the target te...
virtual bool hasLocalCharFeatures() const
Reports whether there any local character feature overrides for characters contained in the target te...
virtual int32_t end() const
Gets the end offset of the target text range.
virtual std::auto_ptr< TextParaInspector > paraInspector() const
Creates an inspector with which to access the paragraph features of all paragraphs in the target text...
virtual bool operator!=(const TextRange &rhs_) const
Tests whether a given TextRange object is not the same as another.
virtual void fitHeadlines()
Adjusts the tracking of the text in the target range to fit on one line spanning the width of the are...
virtual std::auto_ptr< TextCharFeatures > localCharFeatures() const
Retrieves the character features that have local overrides in the target text range, and whose local values are the same in all text runs in the range.
virtual void replaceOrAddLocalCharFeatures(const TextCharFeatures &feat_)
Modifies the local overrides for all characters in the target text range. All values that are assigne...