Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreCurrentDocument.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_CURRENT_DOCUMENT__
8 #define __HDI_CORE_CURRENT_DOCUMENT__
9 
10 #include <vector>
11 
12 #include "hdicoreTypes.h"
13 #include "hdicoreArtboardPoint.h"
14 #include "hdicoreArtboardRect.h"
15 #include "hdicoreFileFormat.h"
16 #include "hdicorePathStyle.h"
17 #include "hdicoreSize.h"
18 
19 namespace hdi
20 {
21  namespace core
22  {
23  class Art;
24  class Artboard;
25  class ArtStyle;
26  class DocumentView;
27  class Font;
28  class Grid;
29  class Layer;
30  class Pattern;
31  class Symbol;
32  class TextRangeSet;
33  class TextStory;
34 
35  namespace ai
36  {
37  class Dictionary;
38  }
39 
40  #if defined(MAC_ENV)
41  typedef NSWindow* PlatformDocWindowPtr;
42  #elif defined(WIN_ENV)
43  typedef HWND PlatformDocWindowPtr;
44  #endif
45 
51  {
52  public:
53  typedef std::vector< Art* > ArtVector;
54  typedef std::vector<MatchArtSpec> MatchArtSpecVector;
55 
59  class Setup
60  {
61  public:
66 
71 
75  double resolution;
76 
82 
86  bool printTiles;
87 
93 
99  Setup();
100 
106  virtual ~Setup();
107  };
108 
109  typedef std::auto_ptr<Setup> SetupAP;
110 
118  std::auto_ptr<ai::Dictionary> dictionary();
119 
131  AIDocumentHandle aiDocumentHandle() const;
132 
144  PlatformDocWindowPtr platformWindow() const;
145 
155  std::string filePath() const;
156 
164  std::string fileName() const;
165 
173  ArtboardRect maxBounds() const;
174 
182  RulerUnits rulerUnits() const;
183 
191  std::auto_ptr<Setup> setup() const;
192 
200  bool hasTextFocus() const;
201 
209  std::auto_ptr<TextStory> focusedText() const;
210 
220  bool setFocusedText(const TextStory& story_);
221 
227  void loseTextFocus();
228 
241  std::auto_ptr<TextRangeSet> selectedText() const;
242 
250  bool modified() const;
251 
262  void setModified(const bool mod_);
263 
274  void sync() const;
275 
283  void redraw() const;
284 
301  void syncAndRedraw() const;
302 
310  bool save() const;
311 
326  bool save(const std::string& path_, const FileFormat& ff_, const bool prompt_ = true) const;
327 
343  bool save(
344  const std::string& path_,
345  const FileFormat& ff_,
346  const FileFormat::Options opt_,
347  const bool prompt_ = true
348  ) const;
349 
357  bool close() const;
358 
369  void undo() const;
370 
381  void redo() const;
382 
393  bool anyArtSelected() const;
394 
404  ArtVector selectedArt() const;
405 
411  void deselectAllArt() const;
412 
427  ArtVector matchingArt(const MatchArtSpecVector& specs_) const;
428 
439  ArtVector artOfType(const MatchArtType type_) const;
440 
449 
465  bool selectedArtPathStyle(PathStyle& style__, PathStyle::Map& map__) const;
466 
474  void setSelectedArtPathStyle(const PathStyle& style_);
475 
484  void setSelectedArtPathStyle(const PathStyle& style_, const PathStyle::Map& map_);
485 
493  uint32_t viewCount() const;
494 
503  std::auto_ptr<DocumentView> viewAtIndex(const uint32_t index_) const;
504 
512  std::auto_ptr<DocumentView> currentView() const;
513 
521  uint32_t layerCount() const;
522 
530  std::auto_ptr<Layer> firstLayer() const;
531 
539  std::auto_ptr<Layer> lastLayer() const;
540 
549  std::auto_ptr<Layer> layerByTitle(const std::string& title_) const;
550 
559  std::auto_ptr<Layer> layerAtIndex(const uint32_t index_) const;
560 
568  std::auto_ptr<Layer> currentLayer() const;
569 
577  void setCurrentLayer(const Layer& layer_);
578 
586  bool inIsolationMode() const;
587 
595  std::auto_ptr<Art> isolatedArt() const;
596 
610  bool enterIsolationMode(const Art& art_, const bool hideOtherArt_);
611 
619  void exitIsolationMode() const;
620 
632  bool inPatternEditingMode() const;
633 
642  bool enterPatternEditingMode(const Pattern& toEdit_);
643 
656  bool applyPatternEditingModeChanges(const Pattern& editPatt_);
657 
665  void exitPatternEditingMode() const;
666 
678  bool inSymbolEditingMode() const;
679 
693  bool enterSymbolEditingMode(const Symbol& toEdit_, const Art* const inst_ = NULL);
694 
708  bool applySymbolEditingModeChanges(const Symbol& editSym_);
709 
717  void exitSymbolEditingMode() const;
718 
726  uint32_t artboardCount() const;
727 
736  std::auto_ptr<Artboard> artboardByTitle(const std::string& title_) const;
737 
746  std::auto_ptr<Artboard> artboardAtIndex(const uint32_t index_) const;
747 
758  bool insertArtboard(const uint32_t index_, Artboard& ab__) const;
759 
767  std::auto_ptr<Artboard> currentArtboard() const;
768 
776  void setCurrentArtboard(const Artboard& artboard_);
777 
785  uint32_t artStyleCount() const;
786 
795  std::auto_ptr<ArtStyle> artStyleAtIndex(const uint32_t index_) const;
796 
804  uint32_t patternCount() const;
805 
814  std::auto_ptr<Pattern> patternAtIndex(const uint32_t index_) const;
815 
823  uint32_t symbolDefCount() const;
824 
833  std::auto_ptr<Symbol> symbolDefAtIndex(const uint32_t index_) const;
834 
842  Grid* const grid() const;
843 
851  DocumentColorModel colorModel() const;
852 
861  PathStyle defaultPathStyle() const;
862 
871  void setDefaultPathStyle(const PathStyle& style_);
872 
880  PathStyle defaultTextStyle() const;
881 
889  void setDefaultTextStyle(const PathStyle& style_);
890 
898  std::auto_ptr<Font> currentFont() const;
899 
907  void setCurrentFont(const Font& font_);
908 
921  ArtVector artAtPoint(const ArtboardPoint& pt_, const HitRequest request_) const;
922 
923 
924  private:
925  // Only the Illustrator class can construct a CurrentDocument object
926  friend class Illustrator;
927 
931  void* __data;
932 
938  CurrentDocument();
939 
946 
952  ~CurrentDocument();
953 
959  CurrentDocument& operator=(const CurrentDocument&);
960  };
961  }
962 }
963 
964 #endif
965 // __HDI_CORE_CURRENT_DOCUMENT__
ArtVector artOfType(const MatchArtType type_) const
Gets a vector of art in the document whose type matches the given type.
PathStyle defaultTextStyle() const
Retrieves the default path style that tools should use when creating text objects.
bool insertArtboard(const uint32_t index_, Artboard &ab__) const
Inserts a new artboard at a given position in the artboard list in the current document.
Handles general art-related functionality.
Definition: hdicoreArt.h:47
void loseTextFocus()
Ends text editing mode for the current document.
bool close() const
Closes the current document.
void exitSymbolEditingMode() const
Ends symbol editing mode in the current document, discarding any changes made to the symbol...
bool enterIsolationMode(const Art &art_, const bool hideOtherArt_)
Enters isolation mode of the given art object or one of its parents.
bool tileFullPages
Ignored when printTiles is false; otherwise, controls whether many tiles are created to print the ent...
Definition: hdicoreCurrentDocument.h:92
ArtVector artAtPoint(const ArtboardPoint &pt_, const HitRequest request_) const
Gets a vector of all art found at a given point on the document.
void exitPatternEditingMode() const
Ends pattern editing mode in the current document, discarding any changes made to the pattern...
uint32_t artStyleCount() const
Gets the number of art styles in the document.
PlatformDocWindowPtr platformWindow() const
Gets the platform-specific window handle for the document.
RulerUnits rulerUnits() const
Gets the ruler units for the current document.
bool inPatternEditingMode() const
Gets whether the current document is in pattern editing mode (similar to isolation mode...
void setSelectedArtPathStyle(const PathStyle &style_)
Sets the path style of the currently selected art in the document.
bool anyArtSelected() const
Gets whether any art is selected at all in the document.
std::auto_ptr< ai::Dictionary > dictionary()
Gets the built-in document data dictionary object for the current document.
std::auto_ptr< Layer > layerAtIndex(const uint32_t index_) const
Gets a given layer, by its index, in the current document.
void sync() const
Updates cached artwork properties for the current document.
void setCurrentFont(const Font &font_)
Sets the current font for the document.
Handles general pattern-related functionality.
Definition: hdicorePattern.h:27
Describes all styling attributes of a path.
Definition: hdicorePathStyle.h:427
std::auto_ptr< Artboard > artboardByTitle(const std::string &title_) const
Gets a given artboard, by its name, in the current document (case-insensitive)
std::auto_ptr< Artboard > artboardAtIndex(const uint32_t index_) const
Gets a given artboard, by its index, in the current document.
ArtboardRect maxBounds() const
Gets the max bounds rect for the current document.
void setCurrentLayer(const Layer &layer_)
Sets the currently selected layer in the current document.
void undo() const
Undoes the most recent undoable transaction for the current document (same as the user using the undo...
Header file for Illustrator file format manipulation.
bool inSymbolEditingMode() const
Gets whether the current document is in symbol editing mode (similar to isolation mode...
Describes a rectangular area on the Illustrator artboard.
Definition: hdicoreArtboardRect.h:25
std::auto_ptr< Symbol > symbolDefAtIndex(const uint32_t index_) const
Gets a given symbol definition, by its index, in the current doc.
std::auto_ptr< TextStory > focusedText() const
Gets the story that has editing focus (i.e. has some selected range)
std::string fileName() const
Gets the name of the current document.
std::auto_ptr< Pattern > patternAtIndex(const uint32_t index_) const
Gets a given pattern, by its index, in the current doc.
void redo() const
Redoes the most recent redoable transaction for the current document (same as the user using the redo...
ArtVector matchingArt(const MatchArtSpecVector &specs_) const
Gets a vector of art in the document whose specs match those given.
void setDefaultPathStyle(const PathStyle &style_)
Sets the default path style that tools should use when creating new objects other than text objects...
PathStyle defaultPathStyle() const
Retrieves the default path style that tools should use when creating new objects other than text obje...
std::auto_ptr< ArtStyle > artStyleAtIndex(const uint32_t index_) const
Gets a given art style, by its index, in the current doc.
Definition: hdicoreTextStory.h:30
Header file for geometric rectangle manipulation on the Illustrator artboard.
Setup()
Constructs a new Setup object with default values.
bool applyPatternEditingModeChanges(const Pattern &editPatt_)
Ends pattern editing mode, applying the changes made for the given pattern.
bool enterSymbolEditingMode(const Symbol &toEdit_, const Art *const inst_=NULL)
Enters symbol editing mode for the current document, creating a prototype (i.e. temporary copy) of th...
void setCurrentArtboard(const Artboard &artboard_)
Sets the currently selected artboard in the current document.
virtual ~Setup()
Destructs a Setup object.
Handles general symbol-related functionality.
Definition: hdicoreSymbol.h:24
bool modified() const
Gets whether the current document has been modified.
Header file for describing 2D dimensions (width and height)
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
PathStyle selectedArtPathStyle() const
Gets the path style of the currently selected art in the document.
Describes a file format that Illustrator can either read or write.
Definition: hdicoreFileFormat.h:21
std::auto_ptr< Artboard > currentArtboard() const
Gets the current (active) artboard in the document.
Size size
Document dimensions.
Definition: hdicoreCurrentDocument.h:65
Acts as a StrokeStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:433
Font class to allow for easy font manipulation.
Definition: hdicoreFont.h:170
Allows for layer metadata access, visibility manipulation, locking, sibling access, etc.
Definition: hdicoreLayer.h:27
bool hasTextFocus() const
Gets whether the current document is in text editing mode.
Header file for path style-related classes.
Header file for geometric point manipulation on the Illustrator artboard.
uint32_t layerCount() const
Gets a count of the layers in the current document.
std::auto_ptr< Art > isolatedArt() const
Gets the currently isolated art.
std::auto_ptr< Layer > layerByTitle(const std::string &title_) const
Gets a given layer, by its name, in the current document (case-insensitive)
void setModified(const bool mod_)
Sets whether the current document is in a modified state.
Current (focused) document class to allow for metadata access, updating, dictionary access...
Definition: hdicoreCurrentDocument.h:50
AIDocumentHandle aiDocumentHandle() const
Gets the document handle around which the target object is wrapped.
Grid *const grid() const
Gets the grid object for the current document.
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:24
Describes the setup options of an existing document.
Definition: hdicoreCurrentDocument.h:59
Definition: hdicoreaiArray.h:12
std::auto_ptr< DocumentView > viewAtIndex(const uint32_t index_) const
Gets a given document view, by its index, in the current document.
bool showPlacedImages
Indicates whether placed images are shown.
Definition: hdicoreCurrentDocument.h:70
bool save() const
Saves the current document, prompting the user if it has not been saved before.
bool applySymbolEditingModeChanges(const Symbol &editSym_)
Ends symbol editing mode, applying the changes made for the given symbol prototype to the symbol sour...
std::auto_ptr< TextRangeSet > selectedText() const
Gets the set of selected text ranges for the current document.
Allows access to a wide variety of Illustrator app-related runtime attributes, documents, fonts, etc.
Definition: hdicoreIllustrator.h:48
DocumentColorModel colorModel() const
Gets the color model for the current document.
bool printTiles
Controls whether multiple tiled pages are printed (or just a single page)
Definition: hdicoreCurrentDocument.h:86
uint32_t viewCount() const
Gets a count of the views in the current document.
uint32_t patternCount() const
Gets the number of patterns in the document.
void exitIsolationMode() const
Ends isolation mode in the current document.
bool splitLongPaths
Controls whether long paths are split. Which paths are affected also depends on the bezier resolution...
Definition: hdicoreCurrentDocument.h:81
double resolution
Bezier resolution in dpi.
Definition: hdicoreCurrentDocument.h:75
Represents an individual artboard in the current document.
Definition: hdicoreArtboard.h:31
void setDefaultTextStyle(const PathStyle &style_)
Sets the default path style that tools should use when creating text objects.
std::auto_ptr< Layer > lastLayer() const
Gets the last layer in the list in the current document.
std::auto_ptr< Layer > currentLayer() const
Gets the currently selected layer of the current document.
void deselectAllArt() const
Deselects all currently selected art.
std::auto_ptr< DocumentView > currentView() const
Gets the current view for the current document.
std::string filePath() const
Gets the complete path to the current document.
std::auto_ptr< Layer > firstLayer() const
Gets the first layer in the list in the current document.
bool setFocusedText(const TextStory &story_)
Sets the story that should have editing focus, and the editing caret is placed at the start of said s...
std::auto_ptr< Font > currentFont() const
Gets the current font for the document.
ArtVector selectedArt() const
Gets a vector of all currently selected art in the document.
bool inIsolationMode() const
Gets whether the current document is in isolation mode.
uint32_t artboardCount() const
Gets the number of artboards in the document.
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:28
void syncAndRedraw() const
Updates cached artwork properties for the current document, synchronizes the current context...
std::auto_ptr< Setup > setup() const
Gets the setup options for the current document.
Allows manipulation of Illustrator's built-in grids.
Definition: hdicoreGrid.h:20
Options
Used to specify the capabilities of a file format.
Definition: hdicoreFileFormat.h:40
void redraw() const
Forces the art in the current document to be redrawn.
uint32_t symbolDefCount() const
Gets the number of symbol definitions in the document.
bool enterPatternEditingMode(const Pattern &toEdit_)
Enters pattern editing mode for the current document.