Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Friends | List of all members
hdi::core::CurrentDocument Class Reference

Current (focused) document class to allow for metadata access, updating, dictionary access, selected art access, layer access, etc. More...

#include <hdicoreCurrentDocument.h>

Classes

class  Setup
 Describes the setup options of an existing document. More...
 

Public Types

typedef std::vector< std::shared_ptr< Art > > ArtVector
 
typedef std::vector< MatchArtSpecMatchArtSpecVector
 
typedef std::unique_ptr< SetupSetupUP
 
typedef std::shared_ptr< SetupSetupSP
 
typedef std::weak_ptr< SetupSetupWP
 

Public Member Functions

std::unique_ptr< ai::Dictionarydictionary ()
 Gets the built-in document data dictionary object for the current document.
 
AIDocumentHandle aiDocumentHandle () const
 Gets the document handle around which the target object is wrapped.
 
PlatformDocWindowPtr platformWindow () const
 Gets the platform-specific window handle for the document.
 
std::string filePath () const
 Gets the complete path to the current document.
 
std::string fileName () const
 Gets the name of the current document.
 
ArtboardRect maxBounds () const
 Gets the max bounds rect for the current document.
 
double scale () const
 Gets the scale of the current doc.
 
RulerUnits rulerUnits () const
 Gets the ruler units for the current document.
 
std::unique_ptr< Setupsetup () const
 Gets the setup options for the current document.
 
bool hasTextFocus () const
 Gets whether the current document is in text editing mode.
 
std::unique_ptr< TextStoryfocusedText () const
 Gets the story that has editing focus (i.e. has some selected range)
 
bool setFocusedText (const TextStory &story_)
 Sets the story that should have editing focus, and the editing caret is placed at the start of said story.
 
void loseTextFocus ()
 Ends text editing mode for the current document.
 
std::unique_ptr< TextRangeSetselectedText () const
 Gets the set of selected text ranges for the current document.
 
bool modified () const
 Gets whether the current document has been modified.
 
void setModified (const bool mod_)
 Sets whether the current document is in a modified state.
 
void sync () const
 Updates cached artwork properties for the current document.
 
void redraw () const
 Forces the art in the current document to be redrawn.
 
void syncAndRedraw () const
 Updates cached artwork properties for the current document, synchronizes the current context, and forces the art in the current document to be redrawn.
 
bool save () const
 Saves the current document, prompting the user if it has not been saved before.
 
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 (and without affecting the modification status of the 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 saved before (and without affecting the modification status of the document)
 
bool close () const
 Closes the current document.
 
void undo () const
 Undoes the most recent undoable transaction for the current document (same as the user using the undo menu item)
 
void redo () const
 Redoes the most recent redoable transaction for the current document (same as the user using the redo menu item)
 
void cut ()
 Performs a cut operation, removing any selected art objects from the document and placing them in the clipboard.
 
void copy ()
 Performs a copy operation, placing any selected art objects from the current document in the clipboard.
 
void paste ()
 Pastes the contents of the clipboard on the current document.
 
bool anyArtSelected () const
 Gets whether any art is selected at all in the document.
 
ArtVector selectedArt () const
 Gets a vector of all currently selected art in the document.
 
void deselectAllArt () const
 Deselects all currently selected art.
 
ArtVector matchingArt (const MatchArtSpecVector &specs_) const
 Gets a vector of art in the document whose specs match those given.
 
ArtVector artOfType (const MatchArtType type_) const
 Gets a vector of art in the document whose type matches the given type.
 
PathStyle selectedArtPathStyle () const
 Gets the path style of the currently selected art in the document.
 
bool selectedArtPathStyle (PathStyle &style__, PathStyle::Map &map__) const
 Gets the path style and map of the currently selected art in the document.
 
void setSelectedArtPathStyle (const PathStyle &style_)
 Sets the path style of the currently selected art in the document.
 
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.
 
uint32_t viewCount () const
 Gets a count of the views in the current document.
 
std::unique_ptr< DocumentViewviewAtIndex (const uint32_t index_) const
 Gets a given document view, by its index, in the current document.
 
std::unique_ptr< DocumentViewcurrentView () const
 Gets the current view for the current document.
 
uint32_t layerCount () const
 Gets a count of the layers in the current document.
 
std::unique_ptr< LayerfirstLayer () const
 Gets the first layer in the list in the current document.
 
std::unique_ptr< LayerlastLayer () const
 Gets the last layer in the list in the current document.
 
std::unique_ptr< LayerlayerByTitle (const std::string &title_) const
 Gets a given layer, by its name, in the current document (case-insensitive)
 
std::unique_ptr< LayerlayerAtIndex (const uint32_t index_) const
 Gets a given layer, by its index, in the current document.
 
std::unique_ptr< LayercurrentLayer () const
 Gets the currently selected layer of the current document.
 
void setCurrentLayer (const Layer &layer_)
 Sets the currently selected layer in the current document.
 
bool inIsolationMode () const
 Gets whether the current document is in isolation mode.
 
std::unique_ptr< ArtisolatedArt () const
 Gets the currently isolated art.
 
bool enterIsolationMode (const Art &art_, const bool hideOtherArt_)
 Enters isolation mode of the given art object or one of its parents.
 
void exitIsolationMode () const
 Ends isolation mode in the current document.
 
bool inPatternEditingMode () const
 Gets whether the current document is in pattern editing mode (similar to isolation mode, but for editing a pattern in-place)
 
bool enterPatternEditingMode (const Pattern &toEdit_)
 Enters pattern editing mode for the current document.
 
bool applyPatternEditingModeChanges (const Pattern &editPatt_)
 Ends pattern editing mode, applying the changes made for the given pattern.
 
void exitPatternEditingMode () const
 Ends pattern editing mode in the current document, discarding any changes made to the pattern.
 
bool inSymbolEditingMode () const
 Gets whether the current document is in symbol editing mode (similar to isolation mode, but for editing a prototype of the symbol source art in-place)
 
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 the symbol source art for in-place editing.
 
bool applySymbolEditingModeChanges (const Symbol &editSym_)
 Ends symbol editing mode, applying the changes made for the given symbol prototype to the symbol source art.
 
void exitSymbolEditingMode () const
 Ends symbol editing mode in the current document, discarding any changes made to the symbol.
 
uint32_t artboardCount () const
 Gets the number of artboards in the document.
 
std::unique_ptr< ArtboardartboardByTitle (const std::string &title_) const
 Gets a given artboard, by its name, in the current document (case-insensitive)
 
std::unique_ptr< ArtboardartboardAtIndex (const uint32_t index_) const
 Gets a given artboard, by its index, in the current document.
 
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.
 
std::unique_ptr< ArtboardcurrentArtboard () const
 Gets the current (active) artboard in the document.
 
void setCurrentArtboard (const Artboard &artboard_)
 Sets the currently selected artboard in the current document.
 
uint32_t artStyleCount () const
 Gets the number of art styles in the document.
 
std::unique_ptr< ArtStyleartStyleAtIndex (const uint32_t index_) const
 Gets a given art style, by its index, in the current doc.
 
uint32_t patternCount () const
 Gets the number of patterns in the document.
 
std::unique_ptr< PatternpatternAtIndex (const uint32_t index_) const
 Gets a given pattern, by its index, in the current doc.
 
uint32_t symbolDefCount () const
 Gets the number of symbol definitions in the document.
 
std::unique_ptr< SymbolsymbolDefAtIndex (const uint32_t index_) const
 Gets a given symbol definition, by its index, in the current doc.
 
Grid *const grid () const
 Gets the grid object for the current document.
 
DocumentColorModel colorModel () const
 Gets the color model for the current document.
 
PathStyle defaultPathStyle () const
 Retrieves the default path style that tools should use when creating new objects other than text objects.
 
void setDefaultPathStyle (const PathStyle &style_)
 Sets the default path style that tools should use when creating new objects other than text objects.
 
PathStyle defaultTextStyle () const
 Retrieves the default path style that tools should use when creating text objects.
 
void setDefaultTextStyle (const PathStyle &style_)
 Sets the default path style that tools should use when creating text objects.
 
std::unique_ptr< FontcurrentFont () const
 Gets the current font for the document.
 
void setCurrentFont (const Font &font_)
 Sets the current font for 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.
 

Friends

class Illustrator
 

Detailed Description

Current (focused) document class to allow for metadata access, updating, dictionary access, selected art access, layer access, etc.

Member Function Documentation

◆ aiDocumentHandle()

AIDocumentHandle hdi::core::CurrentDocument::aiDocumentHandle ( ) const

Gets the document handle around which the target object is wrapped.

Author
GW
Date
11/2013
Returns
AIDocumentHandle for this object
Note
Generally, you shouldn't need to call this method. Only use it if you know what you're doing. If a specific piece of functionality provided by Illustrator is not handled by this class (or related classes), then it should probably be added to the hdi_core library.

◆ anyArtSelected()

bool hdi::core::CurrentDocument::anyArtSelected ( ) const

Gets whether any art is selected at all in the document.

Author
GW
Date
12/2015
Returns
true for any art being selected, false otherwise
Note
This method is much faster for large documents with large selections than getting all of the currently selected art and simply checking if the vector is not empty.

◆ applyPatternEditingModeChanges()

bool hdi::core::CurrentDocument::applyPatternEditingModeChanges ( const Pattern editPatt_)

Ends pattern editing mode, applying the changes made for the given pattern.

Author
GW
Date
11/2015
Parameters
editPatt_The pattern currently being edited
Returns
true if editPatt_ is actually being edited and the changes were applied
Note
This method is safe to call if not currently in isolation mode
If you want to exit pattern editing mode without saving any of the changes made, call the exitPatternEditingMode() method instead.

◆ applySymbolEditingModeChanges()

bool hdi::core::CurrentDocument::applySymbolEditingModeChanges ( const Symbol editSym_)

Ends symbol editing mode, applying the changes made for the given symbol prototype to the symbol source art.

Author
GW
Date
11/2015
Parameters
editSym_The symbol currently being edited
Returns
true if editSym_ is actually being edited and the changes were applied
Note
This method is safe to call if not currently in isolation mode
If you want to exit symbol editing mode without saving any of the changes made to the prototype, call the exitSymbolEditingMode() method instead.

◆ artAtPoint()

ArtVector hdi::core::CurrentDocument::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.

Author
GW
Date
08/2013
Parameters
pt_Point at which to check for art
request_As art is found with hit requests, this specifies what art to look for
tolerance_Point radius around pt_ in which a hit is valid
adjustToZoom_Adjust the tolerance_ argument to take document zoom into account
Returns
An artwork vector whose entries match the provided specs, in order from the top-most art found to the bottom-most
Note
If adjustToZoom_ is true, then the tolerance_ argument specifies the point radius around pt_ at 100% document zoom. If the document is zoomed to 200%, tolerance_ will be adjusted to 1/2 the given value; if zoomed to 400%, tolerance_ will be adjusted to 1/4 the given value; etc.

◆ artboardAtIndex()

std::unique_ptr< Artboard > hdi::core::CurrentDocument::artboardAtIndex ( const uint32_t  index_) const

Gets a given artboard, by its index, in the current document.

Author
GW
Date
08/2013
Parameters
index_Index number of the artboard in question
Returns
Artboard object with the specified index

◆ artboardByTitle()

std::unique_ptr< Artboard > hdi::core::CurrentDocument::artboardByTitle ( const std::string &  title_) const

Gets a given artboard, by its name, in the current document (case-insensitive)

Author
GW
Date
01/2017
Parameters
title_Title of the artboard in question, as UTF-8
Returns
The artboard in question, or NULL for none

◆ artboardCount()

uint32_t hdi::core::CurrentDocument::artboardCount ( ) const

Gets the number of artboards in the document.

Author
GW
Date
08/2013
Returns
A count of the number of artboards in the current document

◆ artOfType()

ArtVector hdi::core::CurrentDocument::artOfType ( const MatchArtType  type_) const

Gets a vector of art in the document whose type matches the given type.

Author
GW
Date
08/2013
Parameters
type_Logical OR of types of art to find
Returns
An artwork vector whose entries match the provided art type(s)

◆ artStyleAtIndex()

std::unique_ptr< ArtStyle > hdi::core::CurrentDocument::artStyleAtIndex ( const uint32_t  index_) const

Gets a given art style, by its index, in the current doc.

Author
GW
Date
11/2013
Parameters
index_Index number of the style in question
Returns
The ArtStyle object with the specified index

◆ artStyleCount()

uint32_t hdi::core::CurrentDocument::artStyleCount ( ) const

Gets the number of art styles in the document.

Author
GW
Date
11/2013
Returns
A count of the number of art styles in the current document

◆ close()

bool hdi::core::CurrentDocument::close ( ) const

Closes the current document.

Author
GW
Date
10/2013
Returns
true if the document was closed, false otherwise

◆ colorModel()

DocumentColorModel hdi::core::CurrentDocument::colorModel ( ) const

Gets the color model for the current document.

Author
GW
Date
08/2013
Returns
Current color model for the target document

◆ copy()

void hdi::core::CurrentDocument::copy ( )

Performs a copy operation, placing any selected art objects from the current document in the clipboard.

Author
GW
Date
04/2021
Note
Use only when this plug-in is issuing a command and is entirely in control of that command. Do not call when responding to messages invoked by other commands, such as save, close, update, and so on.

◆ currentArtboard()

std::unique_ptr< Artboard > hdi::core::CurrentDocument::currentArtboard ( ) const

Gets the current (active) artboard in the document.

Author
GW
Date
08/2013
Returns
An Artboard object for the currently selected artboard, or NULL if none

◆ currentFont()

std::unique_ptr< Font > hdi::core::CurrentDocument::currentFont ( ) const

Gets the current font for the document.

Author
GW
Date
04/2016
Returns
The current document's current font, or NULL for none/error

◆ currentLayer()

std::unique_ptr< Layer > hdi::core::CurrentDocument::currentLayer ( ) const

Gets the currently selected layer of the current document.

Author
GW
Date
08/2013
Returns
A Layer object for the currently selected layer, or NULL if none

◆ currentView()

std::unique_ptr< DocumentView > hdi::core::CurrentDocument::currentView ( ) const

Gets the current view for the current document.

Author
GW
Date
08/2013
Returns
The current document view, or NULL if none/error

◆ cut()

void hdi::core::CurrentDocument::cut ( )

Performs a cut operation, removing any selected art objects from the document and placing them in the clipboard.

Author
GW
Date
04/2021
Note
Use only when this plug-in is issuing a command and is entirely in control of that command. Do not call when responding to messages invoked by other commands, such as save, close, update, and so on.

◆ defaultPathStyle()

PathStyle hdi::core::CurrentDocument::defaultPathStyle ( ) const

Retrieves the default path style that tools should use when creating new objects other than text objects.

Author
GW
Date
08/2014
Returns
The default path style

◆ defaultTextStyle()

PathStyle hdi::core::CurrentDocument::defaultTextStyle ( ) const

Retrieves the default path style that tools should use when creating text objects.

Author
GW
Date
08/2014
Returns
The default text style

◆ deselectAllArt()

void hdi::core::CurrentDocument::deselectAllArt ( ) const

Deselects all currently selected art.

Author
GW
Date
08/2013

◆ dictionary()

std::unique_ptr< ai::Dictionary > hdi::core::CurrentDocument::dictionary ( )

Gets the built-in document data dictionary object for the current document.

Author
GW
Date
08/2013
Returns
The Dictionary object for the current document

◆ enterIsolationMode()

bool hdi::core::CurrentDocument::enterIsolationMode ( const Art art_,
const bool  hideOtherArt_ 
)

Enters isolation mode of the given art object or one of its parents.

Author
GW
Date
11/2015
Parameters
art_Art to be isolated
hideOtherArt_true to make non-isolated invisible, false to dim it instead
Returns
true for successful isolation, false otherwise
Note
When isolating a piece of art, this will look up the parent lineage and automatically isolate the first parent that can be isolated (as Illustrator does not allow "leaf art", such as paths, to be isolated).

◆ enterPatternEditingMode()

bool hdi::core::CurrentDocument::enterPatternEditingMode ( const Pattern toEdit_)

Enters pattern editing mode for the current document.

Author
GW
Date
11/2015
Parameters
toEdit_The pattern to be edited
Returns
true if pattern editing mode was entered successfully, false otherwise

◆ enterSymbolEditingMode()

bool hdi::core::CurrentDocument::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 the symbol source art for in-place editing.

Author
GW
Date
11/2015
Parameters
toEdit_The symbol to be edited
inst_An optional instance of the symbol
Returns
true if symbol editing mode was entered successfully, false otherwise
Note
If inst_ is NULL, then editing will take place in the center of the artboard. Otherwise, editing will take place wherever the instance is located.

◆ exitIsolationMode()

void hdi::core::CurrentDocument::exitIsolationMode ( ) const

Ends isolation mode in the current document.

Author
GW
Date
08/2013
Note
This method is safe to call if not currently in isolation mode

◆ exitPatternEditingMode()

void hdi::core::CurrentDocument::exitPatternEditingMode ( ) const

Ends pattern editing mode in the current document, discarding any changes made to the pattern.

Author
GW
Date
11/2015
Note
This method is safe to call if not currently in pattern editing mode

◆ exitSymbolEditingMode()

void hdi::core::CurrentDocument::exitSymbolEditingMode ( ) const

Ends symbol editing mode in the current document, discarding any changes made to the symbol.

Author
GW
Date
11/2015
Note
This method is safe to call if not currently in symbol editing mode

◆ fileName()

std::string hdi::core::CurrentDocument::fileName ( ) const

Gets the name of the current document.

Author
GW
Date
08/2013
Returns
The name of the target document, as UTF-8

◆ filePath()

std::string hdi::core::CurrentDocument::filePath ( ) const

Gets the complete path to the current document.

Author
GW
Date
08/2013
Returns
The URL (location) of the target document, as UTF-8
Note
In the case of a new (never saved) document, this simply returns the file name

◆ firstLayer()

std::unique_ptr< Layer > hdi::core::CurrentDocument::firstLayer ( ) const

Gets the first layer in the list in the current document.

Author
GW
Date
08/2013
Returns
The Layer object for the first layer in the document

◆ focusedText()

std::unique_ptr< TextStory > hdi::core::CurrentDocument::focusedText ( ) const

Gets the story that has editing focus (i.e. has some selected range)

Author
GW
Date
10/2015
Returns
The focused story, or NULL for none/error

◆ grid()

Grid *const hdi::core::CurrentDocument::grid ( ) const

Gets the grid object for the current document.

Author
GW
Date
08/2013
Returns
A Grid object for the grid of the current document

◆ hasTextFocus()

bool hdi::core::CurrentDocument::hasTextFocus ( ) const

Gets whether the current document is in text editing mode.

Author
GW
Date
08/2013
Returns
true if the target document has text editing focus, false otherwise

◆ inIsolationMode()

bool hdi::core::CurrentDocument::inIsolationMode ( ) const

Gets whether the current document is in isolation mode.

Author
GW
Date
08/2013
Returns
true if in isolation mode, false otherwise

◆ inPatternEditingMode()

bool hdi::core::CurrentDocument::inPatternEditingMode ( ) const

Gets whether the current document is in pattern editing mode (similar to isolation mode, but for editing a pattern in-place)

Author
GW
Date
11/2015
Returns
true if in pattern editing mode, false otherwise
Note
When a document is in pattern editing mode, the inIsolationMode() method will also return true. To determine if in pattern editing mode, use this method instead.

◆ insertArtboard()

bool hdi::core::CurrentDocument::insertArtboard ( const uint32_t  index_,
Artboard ab__ 
) const

Inserts a new artboard at a given position in the artboard list in the current document.

Author
GW
Date
08/2013
Parameters
index_Index at which to create the new artboard
ab__Return-by-reference for the new Artboard object at the specified index
Returns
true if the artboard was created and inserted, false otherwise

◆ inSymbolEditingMode()

bool hdi::core::CurrentDocument::inSymbolEditingMode ( ) const

Gets whether the current document is in symbol editing mode (similar to isolation mode, but for editing a prototype of the symbol source art in-place)

Author
GW
Date
11/2015
Returns
true if in symbol editing mode, false otherwise
Note
When a document is in symbol editing mode, the inIsolationMode() method will also return true. To determine if in symbol editing mode, use this method instead.

◆ isolatedArt()

std::unique_ptr< Art > hdi::core::CurrentDocument::isolatedArt ( ) const

Gets the currently isolated art.

Author
GW
Date
08/2013
Returns
Art object for the currently isolated art

◆ lastLayer()

std::unique_ptr< Layer > hdi::core::CurrentDocument::lastLayer ( ) const

Gets the last layer in the list in the current document.

Author
GW
Date
08/2013
Returns
The Layer object for the last layer in the document

◆ layerAtIndex()

std::unique_ptr< Layer > hdi::core::CurrentDocument::layerAtIndex ( const uint32_t  index_) const

Gets a given layer, by its index, in the current document.

Author
GW
Date
08/2013
Parameters
index_Index number of the layer in question
Returns
The layer in question, or NULL for none

◆ layerByTitle()

std::unique_ptr< Layer > hdi::core::CurrentDocument::layerByTitle ( const std::string &  title_) const

Gets a given layer, by its name, in the current document (case-insensitive)

Author
GW
Date
08/2013
Parameters
title_Title of the layer in question, as UTF-8
Returns
The layer in question, or NULL for none

◆ layerCount()

uint32_t hdi::core::CurrentDocument::layerCount ( ) const

Gets a count of the layers in the current document.

Author
GW
Date
08/2013
Returns
A count of the number of layers in the current document

◆ loseTextFocus()

void hdi::core::CurrentDocument::loseTextFocus ( )

Ends text editing mode for the current document.

Author
GW
Date
10/2015

◆ matchingArt()

ArtVector hdi::core::CurrentDocument::matchingArt ( const MatchArtSpecVector &  specs_) const

Gets a vector of art in the document whose specs match those given.

Author
GW
Date
08/2013
Parameters
specs_Vector of match specifications
Returns
An artwork vector whose entries match the provided specifications
Note
This method takes a vector of specs so the caller can specify a multitude of artwork properties, thereby acquiring a vector of artwork that (currently) exhibit all of the provided properties.

◆ maxBounds()

ArtboardRect hdi::core::CurrentDocument::maxBounds ( ) const

Gets the max bounds rect for the current document.

Author
GW
Date
08/2013
Returns
Maximum bounds for the target document

◆ modified()

bool hdi::core::CurrentDocument::modified ( ) const

Gets whether the current document has been modified.

Author
GW
Date
08/2013
Returns
true if the target document has been edited since it was last saved, or false otherwise

◆ paste()

void hdi::core::CurrentDocument::paste ( )

Pastes the contents of the clipboard on the current document.

Author
GW
Date
04/2021
Note
Use only when this plug-in is issuing a command and is entirely in control of that command. Do not call when responding to messages invoked by other commands, such as save, close, update, and so on.

◆ patternAtIndex()

std::unique_ptr< Pattern > hdi::core::CurrentDocument::patternAtIndex ( const uint32_t  index_) const

Gets a given pattern, by its index, in the current doc.

Author
GW
Date
11/2013
Parameters
index_Index number of the pattern in question
Returns
The Pattern object with the specified index

◆ patternCount()

uint32_t hdi::core::CurrentDocument::patternCount ( ) const

Gets the number of patterns in the document.

Author
GW
Date
11/2013
Returns
A count of the number of patterns in the current document

◆ platformWindow()

PlatformDocWindowPtr hdi::core::CurrentDocument::platformWindow ( ) const

Gets the platform-specific window handle for the document.

Author
GW
Date
02/2015
Returns
Pointer to platform-specific window. See PlatformDocWindowPtr typedef.
Warning
On Mac, the caller must perform a release when they are done with the returned object.
Note
Generally, you shouldn't need to call this method. Only use it if you know what you're doing. If a specific piece of UI functionality is not handled by this class (or related classes), then it should probably be added to the hdi_core library.

◆ redo()

void hdi::core::CurrentDocument::redo ( ) const

Redoes the most recent redoable transaction for the current document (same as the user using the redo menu item)

Author
GW
Date
11/2015
Note
Use only when this plug-in is issuing a command and is entirely in control of that command. Do not call when responding to messages invoked by other commands, such as save, close, update, and so on.

◆ redraw()

void hdi::core::CurrentDocument::redraw ( ) const

Forces the art in the current document to be redrawn.

Author
GW
Date
08/2013
Note
With large documents, this method can have a significant performance hit.

◆ rulerUnits()

RulerUnits hdi::core::CurrentDocument::rulerUnits ( ) const

Gets the ruler units for the current document.

Author
GW
Date
08/2013
Returns
The current ruler units for the target document

◆ save() [1/3]

bool hdi::core::CurrentDocument::save ( ) const

Saves the current document, prompting the user if it has not been saved before.

Author
GW
Date
10/2013
Returns
true if the document was saved, false otherwise

◆ save() [2/3]

bool hdi::core::CurrentDocument::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 (and without affecting the modification status of the document)

Author
GW
Date
12/2014
Parameters
path_Path, as UTF-8, to which the document should be saved
ff_File format to use when writing the document to disk
prompt_Whether to prompt the user for configuration of the file before writing
Returns
true if the document was written to disk successfully
Note
If inadequate formatting parameters are available, then the user will be prompted for configuration even if prompt_ is false.

◆ save() [3/3]

bool hdi::core::CurrentDocument::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 saved before (and without affecting the modification status of the document)

Author
GW
Date
12/2014
Parameters
path_Path, as UTF-8, to which the document should be saved
ff_File format to use when writing the document to disk
opt_Bitwise OR of write options
prompt_Whether to prompt the user for configuration of the file before writing
Returns
true if the document was written to disk successfully
Note
If inadequate formatting parameters are available, then the user will be prompted for configuration even if prompt_ is false.

◆ scale()

double hdi::core::CurrentDocument::scale ( ) const

Gets the scale of the current doc.

Author
GW
Date
12/2019
Returns
The current doc scale
Note
Use this method to determine whether a document is in large canvas mode. As of Illustrator 24.2, this method will return 10.0 for large canvas mode (and of course 1.0 for "regular" canvas mode).

◆ selectedArt()

ArtVector hdi::core::CurrentDocument::selectedArt ( ) const

Gets a vector of all currently selected art in the document.

Author
GW
Date
08/2013
Returns
An artwork vector of all currently selected art

◆ selectedArtPathStyle() [1/2]

PathStyle hdi::core::CurrentDocument::selectedArtPathStyle ( ) const

Gets the path style of the currently selected art in the document.

Author
GW
Date
08/2013
Returns
A path style representing the style of the currently selected art

◆ selectedArtPathStyle() [2/2]

bool hdi::core::CurrentDocument::selectedArtPathStyle ( PathStyle style__,
PathStyle::Map map__ 
) const

Gets the path style and map of the currently selected art in the document.

Author
GW
Date
08/2013
Parameters
style__Return-by-reference for the path style of the currently selected art
map__Return-by-reference for a path style map, indicating which path style properties are fully known (or unknown)
Returns
true if the style and map could be acquired, false otherwise
Note
In general, the purpose of a map is to indicate which values are known/common across all target artwork. For example, if two pieces of art were selected, one with a stroke and the other with no stroke, then the map would indicate that the stroke is "unknown". If the same pieces of both had a fill, then the map would indicate that the fill is "known".

◆ selectedText()

std::unique_ptr< TextRangeSet > hdi::core::CurrentDocument::selectedText ( ) const

Gets the set of selected text ranges for the current document.

Author
GW
Date
10/2015
Returns
The selected text ranges (see notes)
Note
The text selection can describe multiple discontiguous ranges of text across multiple art objects. If the document is in text editing mode, the result is a range representing the caret or the user selection. If the document is not in text editing mode, there might be multiple ranges for the selected text frame object(s).

◆ setCurrentArtboard()

void hdi::core::CurrentDocument::setCurrentArtboard ( const Artboard artboard_)

Sets the currently selected artboard in the current document.

Author
GW
Date
08/2013
Parameters
artboard_The artboard to select

◆ setCurrentFont()

void hdi::core::CurrentDocument::setCurrentFont ( const Font font_)

Sets the current font for the document.

Author
GW
Date
04/2016
Parameters
font_New font object for the document

◆ setCurrentLayer()

void hdi::core::CurrentDocument::setCurrentLayer ( const Layer layer_)

Sets the currently selected layer in the current document.

Author
GW
Date
08/2013
Parameters
layer_The layer to select

◆ setDefaultPathStyle()

void hdi::core::CurrentDocument::setDefaultPathStyle ( const PathStyle style_)

Sets the default path style that tools should use when creating new objects other than text objects.

Author
GW
Date
08/2014
Parameters
style_New default path style

◆ setDefaultTextStyle()

void hdi::core::CurrentDocument::setDefaultTextStyle ( const PathStyle style_)

Sets the default path style that tools should use when creating text objects.

Author
GW
Date
08/2014
Parameters
style_New default text style

◆ setFocusedText()

bool hdi::core::CurrentDocument::setFocusedText ( const TextStory story_)

Sets the story that should have editing focus, and the editing caret is placed at the start of said story.

Author
GW
Date
10/2015
Parameters
story_Story to put into editing mode
Returns
true if the story was focused, false otherwise

◆ setModified()

void hdi::core::CurrentDocument::setModified ( const bool  mod_)

Sets whether the current document is in a modified state.

Author
GW
Date
08/2013
Parameters
mod_true to put the document in a modified state, false otherwise
Note
This method is useful if you've made some small/internal change to the document that you do not wish the user to become aware of

◆ setSelectedArtPathStyle() [1/2]

void hdi::core::CurrentDocument::setSelectedArtPathStyle ( const PathStyle style_)

Sets the path style of the currently selected art in the document.

Author
GW
Date
08/2013
Parameters
style_New path styling for the currently selected art

◆ setSelectedArtPathStyle() [2/2]

void hdi::core::CurrentDocument::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.

Author
GW
Date
08/2013
Parameters
style_New path styling for the currently selected art
map_Style map, indicating which path style properties are fully known (or unknown)

◆ setup()

std::unique_ptr< Setup > hdi::core::CurrentDocument::setup ( ) const

Gets the setup options for the current document.

Author
GW
Date
08/2013
Returns
The current setup options for the target document

◆ symbolDefAtIndex()

std::unique_ptr< Symbol > hdi::core::CurrentDocument::symbolDefAtIndex ( const uint32_t  index_) const

Gets a given symbol definition, by its index, in the current doc.

Author
GW
Date
11/2013
Parameters
index_Index number of the symbol def in question
Returns
The Symbol object with the specified index

◆ symbolDefCount()

uint32_t hdi::core::CurrentDocument::symbolDefCount ( ) const

Gets the number of symbol definitions in the document.

Author
GW
Date
11/2013
Returns
A count of the number of symbol definitions in the current document

◆ sync()

void hdi::core::CurrentDocument::sync ( ) const

Updates cached artwork properties for the current document.

Author
GW
Date
08/2013
Note
In general, when Illustrator behaves in a mildly erroneous (but consistent) manner, e.g. artwork not selecting properly under certain repeatable circumstances, calling this method (either before or after the call that introduced the erroneous behavior) will sometimes resolve the problem. The only people that know why are on the Illustrator team...

◆ syncAndRedraw()

void hdi::core::CurrentDocument::syncAndRedraw ( ) const

Updates cached artwork properties for the current document, synchronizes the current context, and forces the art in the current document to be redrawn.

Author
GW
Date
09/2014
Note
It is well known that after creating text art objects anew and setting their contents, this method must be called thereafter if you would like to select the text art objects before your plugin's context exits. Otherwise, you would have to select the text after a delay (i.e. in a timer) of some sort.
Do not confuse this with the sync() and redraw() methods, as the underlying Illustrator suite call for this method is not the same as the others. It is entirely possible that the underlying suite call performs additional tasks over calling sync() and redraw() together, but the only people that know for sure are on the Illustrator team...

◆ undo()

void hdi::core::CurrentDocument::undo ( ) const

Undoes the most recent undoable transaction for the current document (same as the user using the undo menu item)

Author
GW
Date
11/2015
Note
Use only when this plug-in is issuing a command and is entirely in control of that command. Do not call when responding to messages invoked by other commands, such as save, close, update, and so on.

◆ viewAtIndex()

std::unique_ptr< DocumentView > hdi::core::CurrentDocument::viewAtIndex ( const uint32_t  index_) const

Gets a given document view, by its index, in the current document.

Author
GW
Date
08/2013
Parameters
index_Index number of the document view in question
Returns
The view in question, or NULL for none

◆ viewCount()

uint32_t hdi::core::CurrentDocument::viewCount ( ) const

Gets a count of the views in the current document.

Author
GW
Date
08/2013
Returns
A count of the number of views in the current document