Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreCurrentDocument.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_CURRENT_DOCUMENT__
8#define __HDI_CORE_CURRENT_DOCUMENT__
9
10#if defined(HDI_CORE_AIP_MODE)
11
12#include <vector>
13
14#include "hdicoreTypes.h"
16#include "hdicoreArtboardRect.h"
17#include "hdicoreFileFormat.h"
18#include "hdicorePathStyle.h"
19#include "hdicoreSize.h"
20
21namespace hdi
22{
23 namespace core
24 {
25 class Art;
26 class Artboard;
27 class ArtStyle;
28 class DocumentView;
29 class Font;
30 class Grid;
31 class Layer;
32 class Pattern;
33 class Symbol;
34 class TextRangeSet;
35 class TextStory;
36
37 namespace ai
38 {
39 class Dictionary;
40 }
41
47 {
48 public:
49 typedef std::vector< std::shared_ptr<Art> > ArtVector;
50 typedef std::vector<MatchArtSpec> MatchArtSpecVector;
51
55 class Setup
56 {
57 public:
62
67
71 double resolution;
72
78
83
89
96
102 virtual ~Setup();
103 };
104
105 typedef std::unique_ptr<Setup> SetupUP;
106 typedef std::shared_ptr<Setup> SetupSP;
107 typedef std::weak_ptr<Setup> SetupWP;
108
116 std::unique_ptr<ai::Dictionary> dictionary();
117
129 AIDocumentHandle aiDocumentHandle() const;
130
144 PlatformDocWindowPtr platformWindow() const;
145
155 std::string filePath() const;
156
164 std::string fileName() const;
165
174
186 double scale() const;
187
196
204 std::unique_ptr<Setup> setup() const;
205
213 bool hasTextFocus() const;
214
222 std::unique_ptr<TextStory> focusedText() const;
223
233 bool setFocusedText(const TextStory& story_);
234
241
254 std::unique_ptr<TextRangeSet> selectedText() const;
255
263 bool modified() const;
264
275 void setModified(const bool mod_);
276
287 void sync() const;
288
296 void redraw() const;
297
313 void syncAndRedraw() const;
314
322 bool save() const;
323
338 bool save(const std::string& path_, const FileFormat& ff_, const bool prompt_ = true) const;
339
355 bool save(
356 const std::string& path_,
357 const FileFormat& ff_,
358 const FileFormat::Options opt_,
359 const bool prompt_ = true
360 ) const;
361
369 bool close() const;
370
381 void undo() const;
382
393 void redo() const;
394
405 void cut();
406
417 void copy();
418
428 void paste();
429
440 bool anyArtSelected() const;
441
449 ArtVector selectedArt() const;
450
456 void deselectAllArt() const;
457
470 ArtVector matchingArt(const MatchArtSpecVector& specs_) const;
471
480 ArtVector artOfType(const MatchArtType type_) const;
481
490
506 bool selectedArtPathStyle(PathStyle& style__, PathStyle::Map& map__) const;
507
516
525 void setSelectedArtPathStyle(const PathStyle& style_, const PathStyle::Map& map_);
526
534 uint32_t viewCount() const;
535
544 std::unique_ptr<DocumentView> viewAtIndex(const uint32_t index_) const;
545
553 std::unique_ptr<DocumentView> currentView() const;
554
562 uint32_t layerCount() const;
563
571 std::unique_ptr<Layer> firstLayer() const;
572
580 std::unique_ptr<Layer> lastLayer() const;
581
590 std::unique_ptr<Layer> layerByTitle(const std::string& title_) const;
591
600 std::unique_ptr<Layer> layerAtIndex(const uint32_t index_) const;
601
609 std::unique_ptr<Layer> currentLayer() const;
610
618 void setCurrentLayer(const Layer& layer_);
619
627 bool inIsolationMode() const;
628
636 std::unique_ptr<Art> isolatedArt() const;
637
651 bool enterIsolationMode(const Art& art_, const bool hideOtherArt_);
652
660 void exitIsolationMode() const;
661
674
683 bool enterPatternEditingMode(const Pattern& toEdit_);
684
698
707
720
734 bool enterSymbolEditingMode(const Symbol& toEdit_, const Art* const inst_ = NULL);
735
750
759
767 uint32_t artboardCount() const;
768
777 std::unique_ptr<Artboard> artboardByTitle(const std::string& title_) const;
778
787 std::unique_ptr<Artboard> artboardAtIndex(const uint32_t index_) const;
788
799 bool insertArtboard(const uint32_t index_, Artboard& ab__) const;
800
808 std::unique_ptr<Artboard> currentArtboard() const;
809
817 void setCurrentArtboard(const Artboard& artboard_);
818
826 uint32_t artStyleCount() const;
827
836 std::unique_ptr<ArtStyle> artStyleAtIndex(const uint32_t index_) const;
837
845 uint32_t patternCount() const;
846
855 std::unique_ptr<Pattern> patternAtIndex(const uint32_t index_) const;
856
864 uint32_t symbolDefCount() const;
865
874 std::unique_ptr<Symbol> symbolDefAtIndex(const uint32_t index_) const;
875
883 Grid* const grid() const;
884
893
903
912 void setDefaultPathStyle(const PathStyle& style_);
913
922
930 void setDefaultTextStyle(const PathStyle& style_);
931
939 std::unique_ptr<Font> currentFont() const;
940
948 void setCurrentFont(const Font& font_);
949
967 ArtVector artAtPoint(
968 const ArtboardPoint& pt_,
969 const HitRequest request_,
970 const double tolerance_ = 2.0,
971 const bool adjustToZoom_ = true
972 ) const;
973
974
975 private:
976 // Only the Illustrator class can construct a CurrentDocument object
977 friend class Illustrator;
978
982 void* __data;
983
990
997
1004
1010 CurrentDocument& operator=(const CurrentDocument&);
1011 };
1012 }
1013}
1014
1015#endif
1016// HDI_CORE_AIP_MODE
1017
1018#endif
1019// __HDI_CORE_CURRENT_DOCUMENT__
Handles general art-related functionality.
Definition: hdicoreArt.h:51
Represents an individual artboard in the current document.
Definition: hdicoreArtboard.h:35
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:31
Describes a rectangular area on the Illustrator artboard.
Definition: hdicoreArtboardRect.h:28
Describes the setup options of an existing document.
Definition: hdicoreCurrentDocument.h:56
Setup()
Constructs a new Setup object with default values.
Size size
Document dimensions.
Definition: hdicoreCurrentDocument.h:61
bool tileFullPages
Ignored when printTiles is false; otherwise, controls whether many tiles are created to print the ent...
Definition: hdicoreCurrentDocument.h:88
double resolution
Bezier resolution in dpi.
Definition: hdicoreCurrentDocument.h:71
virtual ~Setup()
Destructs a Setup object.
bool splitLongPaths
Controls whether long paths are split. Which paths are affected also depends on the bezier resolution...
Definition: hdicoreCurrentDocument.h:77
bool showPlacedImages
Indicates whether placed images are shown.
Definition: hdicoreCurrentDocument.h:66
bool printTiles
Controls whether multiple tiled pages are printed (or just a single page)
Definition: hdicoreCurrentDocument.h:82
Current (focused) document class to allow for metadata access, updating, dictionary access,...
Definition: hdicoreCurrentDocument.h:47
std::unique_ptr< Font > currentFont() const
Gets the current font for the document.
void setModified(const bool mod_)
Sets whether the current document is in a modified state.
PathStyle defaultTextStyle() const
Retrieves the default path style that tools should use when creating text objects.
std::unique_ptr< Pattern > patternAtIndex(const uint32_t index_) const
Gets a given pattern, by its index, in the current doc.
std::unique_ptr< Layer > layerByTitle(const std::string &title_) const
Gets a given layer, by its name, in the current document (case-insensitive)
bool anyArtSelected() const
Gets whether any art is selected at all in the document.
void cut()
Performs a cut operation, removing any selected art objects from the document and placing them in the...
bool applySymbolEditingModeChanges(const Symbol &editSym_)
Ends symbol editing mode, applying the changes made for the given symbol prototype to the symbol sour...
bool inSymbolEditingMode() const
Gets whether the current document is in symbol editing mode (similar to isolation mode,...
bool save() const
Saves the current document, prompting the user if it has not been saved before.
std::unique_ptr< Art > isolatedArt() const
Gets the currently isolated art.
ArtboardRect maxBounds() const
Gets the max bounds rect for the current document.
void setDefaultPathStyle(const PathStyle &style_)
Sets the default path style that tools should use when creating new objects other than text objects.
void copy()
Performs a copy operation, placing any selected art objects from the current document in the clipboar...
void sync() const
Updates cached artwork properties for the current document.
bool applyPatternEditingModeChanges(const Pattern &editPatt_)
Ends pattern editing mode, applying the changes made for the given pattern.
std::unique_ptr< DocumentView > viewAtIndex(const uint32_t index_) const
Gets a given document view, by its index, in the current document.
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.
ArtVector artAtPoint(const ArtboardPoint &pt_, const HitRequest request_, const double tolerance_=2.0, const bool adjustToZoom_=true) const
Gets a vector of all art found at a given point on the document.
void exitIsolationMode() const
Ends isolation mode in the current document.
RulerUnits rulerUnits() const
Gets the ruler units for the current document.
bool selectedArtPathStyle(PathStyle &style__, PathStyle::Map &map__) const
Gets the path style and map of the currently selected art in the document.
void setDefaultTextStyle(const PathStyle &style_)
Sets the default path style that tools should use when creating text objects.
PlatformDocWindowPtr platformWindow() const
Gets the platform-specific window handle for the document.
void setCurrentLayer(const Layer &layer_)
Sets the currently selected layer in the current document.
bool hasTextFocus() const
Gets whether the current document is in text editing mode.
void setSelectedArtPathStyle(const PathStyle &style_, const PathStyle::Map &map_)
Sets the path style of the currently selected art in the document, taking a map into account.
PathStyle defaultPathStyle() const
Retrieves the default path style that tools should use when creating new objects other than text obje...
std::unique_ptr< Artboard > artboardAtIndex(const uint32_t index_) const
Gets a given artboard, by its index, in the current document.
uint32_t artboardCount() const
Gets the number of artboards in the document.
PathStyle selectedArtPathStyle() const
Gets the path style of the currently selected art in the document.
void exitSymbolEditingMode() const
Ends symbol editing mode in the current document, discarding any changes made to the symbol.
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...
std::unique_ptr< Layer > layerAtIndex(const uint32_t index_) const
Gets a given layer, by its index, in the current document.
ArtVector matchingArt(const MatchArtSpecVector &specs_) const
Gets a vector of art in the document whose specs match those given.
AIDocumentHandle aiDocumentHandle() const
Gets the document handle around which the target object is wrapped.
void setSelectedArtPathStyle(const PathStyle &style_)
Sets the path style of the currently selected art in the document.
std::unique_ptr< ArtStyle > artStyleAtIndex(const uint32_t index_) const
Gets a given art style, by its index, in the current doc.
void setCurrentArtboard(const Artboard &artboard_)
Sets the currently selected artboard in the current document.
void redraw() const
Forces the art in the current document to be redrawn.
bool save(const std::string &path_, const FileFormat &ff_, const bool prompt_=true) const
Saves the current document with the given parameters, even if the document has not been saved before ...
bool modified() const
Gets whether the current document has been modified.
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...
bool close() const
Closes the current document.
uint32_t symbolDefCount() const
Gets the number of symbol definitions in the document.
void syncAndRedraw() const
Updates cached artwork properties for the current document, synchronizes the current context,...
double scale() const
Gets the scale of the current doc.
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.
void exitPatternEditingMode() const
Ends pattern editing mode in the current document, discarding any changes made to the pattern.
DocumentColorModel colorModel() const
Gets the color model for the current document.
bool enterIsolationMode(const Art &art_, const bool hideOtherArt_)
Enters isolation mode of the given art object or one of its parents.
bool inIsolationMode() const
Gets whether the current document is in isolation mode.
std::unique_ptr< TextRangeSet > selectedText() const
Gets the set of selected text ranges for the current document.
std::unique_ptr< Artboard > artboardByTitle(const std::string &title_) const
Gets a given artboard, by its name, in the current document (case-insensitive)
uint32_t layerCount() const
Gets a count of the layers in the current document.
std::unique_ptr< Layer > firstLayer() const
Gets the first layer in the list in the current document.
ArtVector artOfType(const MatchArtType type_) const
Gets a vector of art in the document whose type matches the given type.
std::string filePath() const
Gets the complete path to the current document.
std::unique_ptr< ai::Dictionary > dictionary()
Gets the built-in document data dictionary object for the current document.
void paste()
Pastes the contents of the clipboard on the current document.
ArtVector selectedArt() const
Gets a vector of all currently selected art in the document.
Grid *const grid() const
Gets the grid object for the current document.
std::unique_ptr< Symbol > symbolDefAtIndex(const uint32_t index_) const
Gets a given symbol definition, by its index, in the current doc.
uint32_t artStyleCount() const
Gets the number of art styles in the document.
bool inPatternEditingMode() const
Gets whether the current document is in pattern editing mode (similar to isolation mode,...
std::unique_ptr< Setup > setup() const
Gets the setup options for the current document.
std::unique_ptr< Layer > currentLayer() const
Gets the currently selected layer of the current document.
std::unique_ptr< Layer > lastLayer() const
Gets the last layer in the list in the current document.
std::string fileName() const
Gets the name of the current document.
std::unique_ptr< TextStory > focusedText() const
Gets the story that has editing focus (i.e. has some selected range)
void setCurrentFont(const Font &font_)
Sets the current font for the document.
void deselectAllArt() const
Deselects all currently selected art.
std::unique_ptr< Artboard > currentArtboard() const
Gets the current (active) artboard in the document.
void redo() const
Redoes the most recent redoable transaction for the current document (same as the user using the redo...
bool enterPatternEditingMode(const Pattern &toEdit_)
Enters pattern editing mode for the current document.
bool save(const std::string &path_, const FileFormat &ff_, const FileFormat::Options opt_, const bool prompt_=true) const
Saves the current document with the given parameters and options, even if the document has not been s...
std::unique_ptr< DocumentView > currentView() const
Gets the current view for the current document.
void undo() const
Undoes the most recent undoable transaction for the current document (same as the user using the undo...
void loseTextFocus()
Ends text editing mode for the current document.
Describes a file format that Illustrator can either read or write.
Definition: hdicoreFileFormat.h:24
Options
Used to specify the capabilities of a file format.
Definition: hdicoreFileFormat.h:43
Font class to allow for easy font manipulation.
Definition: hdicoreFont.h:183
Allows manipulation of Illustrator's built-in grids.
Definition: hdicoreGrid.h:23
Allows access to a wide variety of Illustrator app-related runtime attributes, documents,...
Definition: hdicoreIllustrator.h:47
Allows for layer metadata access, visibility manipulation, locking, etc.
Definition: hdicoreLayer.h:39
Acts as a StrokeStyle value map, indicating which values are "known".
Definition: hdicorePathStyle.h:448
Describes all styling attributes of a path.
Definition: hdicorePathStyle.h:442
Handles general pattern-related functionality.
Definition: hdicorePattern.h:30
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:25
Handles general symbol-related functionality.
Definition: hdicoreSymbol.h:27
Definition: hdicoreTextStory.h:33
Header file for geometric point manipulation on the Illustrator artboard.
Header file for geometric rectangle manipulation on the Illustrator artboard.
Header file for Illustrator file format manipulation.
Header file for path style-related classes.
Header file for describing 2D dimensions (width and height)
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
DocumentColorModel
Indicates the color model of new document.
Definition: hdicoreTypes.h:366
HitRequest
Describes the types of hit tests that can be performed (AKA a hit request)
Definition: hdicoreTypes.h:348
MatchArtType
Indicates a type of art (when searching the document artwork tree for art objects)
Definition: hdicoreTypes.h:184
RulerUnits
Indicates the ruler units of a document.
Definition: hdicoreTypes.h:531