Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Classes | Public Types | Public Member Functions | Friends | List of all members
hdi::core::Layer Class Reference

Allows for layer metadata access, visibility manipulation, locking, sibling access, etc. More...

#include <hdicoreLayer.h>

Classes

class  Iterator
 Allows for iteration through the siblings of a layer, a la std::vector iteration. More...
 

Public Types

typedef std::auto_ptr< IteratorIteratorAP
 

Public Member Functions

 Layer ()
 Constructs an empty Layer object. More...
 
 Layer (const Layer &layer_)
 Constructs a Layer object from an existing Layer object (copy constructor) More...
 
 Layer (const AILayerHandle aiLayer_)
 Constructs a new Layer object from an AILayerHandle. More...
 
 Layer (const PaintOrder order_, const Layer *const prep_=NULL)
 Inserts a new layer at a given position in the layer list in the current document. More...
 
virtual ~Layer ()
 Layer destructor. More...
 
virtual Layeroperator= (const Layer &rhs_)
 Assigns one Layer object to another. More...
 
virtual AILayerHandle aiLayerHandle () const
 Gets the layer handle around which the target object is wrapped. More...
 
virtual bool isEmpty () const
 Gets whether the target Layer object is empty (constructed with the default ctor) More...
 
virtual bool dispose ()
 Removes the layer from the document. More...
 
virtual bool editable () const
 Gets whether the target layer is editable. More...
 
virtual void setEditable (const bool editable_)
 Sets whether the target layer is editable. More...
 
virtual bool locked () const
 Gets whether the target layer is locked. More...
 
virtual void setLocked (const bool locked_)
 Sets whether the target layer is locked. More...
 
virtual std::string name () const
 Gets the name for the target layer. More...
 
virtual void setName (const std::string &name_)
 Sets the name for the target layer. More...
 
virtual void show ()
 Shows the layer. More...
 
virtual void hide ()
 Hides the layer. More...
 
virtual bool visible () const
 Gets whether the target layer is visible. More...
 
virtual void setVisible (const bool visible_)
 Sets whether the target layer is visible. More...
 
virtual std::auto_ptr< Artgroup () const
 Gets the first (invisible) art group inside the layer. More...
 
virtual bool active () const
 Gets whether the target Layer object is the active (current) layer. More...
 
virtual bool hasArt () const
 Gets whether the target layer has any art. More...
 
virtual bool hasSelectedArt () const
 Gets whether any of the target layer's art is selected. More...
 
virtual void deselectArt () const
 Deselects all of the target layer's art. More...
 
virtual Color color () const
 Gets the color of the layer in the layer list. More...
 
virtual void setColor (const Color &color_)
 Sets the color of the layer in the layer list. More...
 
virtual std::auto_ptr< Layerparent () const
 Gets the parent layer object for the target layer. More...
 
virtual std::auto_ptr< LayerfirstChild () const
 Gets the first child layer object for the target layer. More...
 
virtual std::auto_ptr< Layersibling () const
 Gets the next sibling layer object for the target layer. More...
 
virtual std::auto_ptr< LayerpriorSibling () const
 Gets the previous sibling layer object for the target layer. More...
 
virtual std::auto_ptr< LayernextPreorderLayer () const
 Gets the next layer in preorder traversal, which returns descendents first. More...
 
virtual bool preview () const
 Gets the target layer's preview or outline mode setting. More...
 
virtual void setPreview (const bool preview_)
 Sets the target layer to preview or outline mode. More...
 
virtual bool printed () const
 Gets whether the target layer is considered printable when printing the document. More...
 
virtual void setPrinted (const bool printed_)
 Sets whether the target layer is considered printable when printing the document. More...
 
virtual bool dimsPlacedImages () const
 Gets whether images in the target layer are automatically dimmed. More...
 
virtual void setDimsPlacedImages (const bool dim_)
 Sets whether images in the target layer are automatically dimmed. More...
 
virtual bool convertToGroup ()
 Converts the target layer to an artwork group. More...
 
virtual bool operator== (const Layer &rhs_) const
 Tests whether a given Layer object is the same as another. More...
 
virtual bool operator!= (const Layer &rhs_) const
 Tests whether a given Layer object is not the same as another. More...
 
virtual bool valid () const
 Tests the validity of the target layer by checking its topmost "invisible" group. More...
 
Iterator begin () const
 Gets an iterator for the layer in the target's parent layer, starting with the target. More...
 

Friends

class CurrentDocument
 
plugin::Layer * __accessImpl (const Layer &)
 
Layer __accessCtor (plugin::Layer *&)
 

Detailed Description

Allows for layer metadata access, visibility manipulation, locking, sibling access, etc.

Constructor & Destructor Documentation

hdi::core::Layer::Layer ( )

Constructs an empty Layer object.

Author
GW
Date
08/2013
Note
To test if a Layer object is empty, call isEmpty() on it
Empty Layer objects do not relate to any layer in the current Illustrator document; they are designed to be "receivers" of some other Layer object via the overloaded assignment operator. Empty Layer objects are useless until such time (though it is safe to call any of their methods).
hdi::core::Layer::Layer ( const Layer layer_)

Constructs a Layer object from an existing Layer object (copy constructor)

Author
GW
Date
08/2013
Parameters
layer_Existing Layer object
hdi::core::Layer::Layer ( const AILayerHandle  aiLayer_)

Constructs a new Layer object from an AILayerHandle.

Author
GW
Date
08/2015
Parameters
aiLayer_Raw Illustrator AILayerHandle
hdi::core::Layer::Layer ( const PaintOrder  order_,
const Layer *const  prep_ = NULL 
)

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

Author
GW
Date
08/2013
Parameters
order_Order in which to create the layer
prep_Prepositional layer to which order_ will apply
Warning
This method does not assume responsibility of the memory for the prep_ argument.
virtual hdi::core::Layer::~Layer ( )
virtual

Layer destructor.

Author
GW
Date
08/2013

Member Function Documentation

virtual bool hdi::core::Layer::active ( ) const
virtual

Gets whether the target Layer object is the active (current) layer.

Author
GW
Date
08/2013
Returns
true if the layer is active, false otherwise
virtual AILayerHandle hdi::core::Layer::aiLayerHandle ( ) const
virtual

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

Author
GW
Date
11/2013
Returns
AILayerHandle 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.
Iterator hdi::core::Layer::begin ( ) const

Gets an iterator for the layer in the target's parent layer, starting with the target.

Author
GW
Date
08/2013
Returns
An Iterator object, for iterating through the target's siblings
// Here's an example, iterating through all top-level layers of a document:
HDI_CORE_ILLUSTRATOR->currentDocument()->firstLayer(layer0);
for(hdi::core::Layer::Iterator iter = layer0.begin(); !iter.atEnd(); ++iter)
{
// Do stuff with iter.layer() ...
}
// Here's another example, reverse iterating through all top-level layers of a document:
HDI_CORE_ILLUSTRATOR->currentDocument()->lastLayer(layerN);
for(hdi::core::Layer::Iterator iter = layerN.begin(); !iter.atEnd(); --iter)
{
// Do more stuff with iter.layer() ...
}
virtual Color hdi::core::Layer::color ( ) const
virtual

Gets the color of the layer in the layer list.

Author
GW
Date
08/2013
Returns
A Color object representing the RGB color of the layer in the Illustrator Layers panel
virtual bool hdi::core::Layer::convertToGroup ( )
virtual

Converts the target layer to an artwork group.

Author
GW
Date
02/2016
Returns
true if the conversion was successful, false otherwise
Warning
Conversion is a destructive process. Once the target layer has been converted, the Layer object will become empty (i.e. its isEmpty() method will return true).
Note
Top-level layers cannot be converted; only sublayers.
Sublayers that themselves contain sublayers cannot be converted.
virtual void hdi::core::Layer::deselectArt ( ) const
virtual

Deselects all of the target layer's art.

Author
GW
Date
08/2013
Note
This method can be called whether or not any art is actually selected.
virtual bool hdi::core::Layer::dimsPlacedImages ( ) const
virtual

Gets whether images in the target layer are automatically dimmed.

Author
GW
Date
08/2013
Returns
true for dimming images, false otherwise
virtual bool hdi::core::Layer::dispose ( )
virtual

Removes the layer from the document.

Author
GW
Date
08/2013
Returns
true for successful disposal, false otherwise
Note
After calling dispose(), this object is basically useless! The actual layer is gone, so obviously none of these methods will work after that.
virtual bool hdi::core::Layer::editable ( ) const
virtual

Gets whether the target layer is editable.

Author
GW
Date
08/2013
Returns
true for the layer being editable (unlocked), false otherwise
Note
This method always returns the opposite of locked() method.
virtual std::auto_ptr<Layer> hdi::core::Layer::firstChild ( ) const
virtual

Gets the first child layer object for the target layer.

Author
GW
Date
08/2013
Returns
A Layer object for the container's first child, or NULL if none
virtual std::auto_ptr<Art> hdi::core::Layer::group ( ) const
virtual

Gets the first (invisible) art group inside the layer.

Author
GW
Date
08/2013
Returns
The Art object representing the layer group (layers are merely art groups with a little "sugar" added)
virtual bool hdi::core::Layer::hasArt ( ) const
virtual

Gets whether the target layer has any art.

Author
GW
Date
08/2013
Returns
true if the layer contains art, false otherwise
virtual bool hdi::core::Layer::hasSelectedArt ( ) const
virtual

Gets whether any of the target layer's art is selected.

Author
GW
Date
08/2013
Returns
true if the layer has any art selected, false otherwise
virtual void hdi::core::Layer::hide ( )
virtual

Hides the layer.

Author
GW
Date
08/2013
virtual bool hdi::core::Layer::isEmpty ( ) const
virtual

Gets whether the target Layer object is empty (constructed with the default ctor)

Author
GW
Date
08/2013
Returns
true if the target Layer object is empty, false otherwise
virtual bool hdi::core::Layer::locked ( ) const
virtual

Gets whether the target layer is locked.

Author
GW
Date
08/2013
Returns
true for the layer being locked (uneditable), false otherwise
Note
Always returns the opposite of editable() method.
virtual std::string hdi::core::Layer::name ( ) const
virtual

Gets the name for the target layer.

Author
GW
Date
08/2013
Returns
The name of the layer, as UTF-8
virtual std::auto_ptr<Layer> hdi::core::Layer::nextPreorderLayer ( ) const
virtual

Gets the next layer in preorder traversal, which returns descendents first.

Author
GW
Date
08/2013
Returns
A Layer object for the target's next preorder child or sibling (for recursive looping), or NULL if none
virtual bool hdi::core::Layer::operator!= ( const Layer rhs_) const
virtual

Tests whether a given Layer object is not the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Layer to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different layers, false otherwise
virtual Layer& hdi::core::Layer::operator= ( const Layer rhs_)
virtual

Assigns one Layer object to another.

Author
GW
Date
08/2013
Parameters
rhs_Existing Layer object to copy values from
Returns
The target Layer object, but with its values updated to match that of the rhs_ argument
virtual bool hdi::core::Layer::operator== ( const Layer rhs_) const
virtual

Tests whether a given Layer object is the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Layer to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same layer, false otherwise
virtual std::auto_ptr<Layer> hdi::core::Layer::parent ( ) const
virtual

Gets the parent layer object for the target layer.

Author
GW
Date
08/2013
Returns
The parent layer object, or NULL for none
virtual bool hdi::core::Layer::preview ( ) const
virtual

Gets the target layer's preview or outline mode setting.

Author
GW
Date
08/2013
Returns
true for preview, false for outline
virtual bool hdi::core::Layer::printed ( ) const
virtual

Gets whether the target layer is considered printable when printing the document.

Author
GW
Date
08/2013
Returns
true for printable, false otherwise
virtual std::auto_ptr<Layer> hdi::core::Layer::priorSibling ( ) const
virtual

Gets the previous sibling layer object for the target layer.

Author
GW
Date
08/2013
Returns
A Layer object for the target's previous sibling, or NULL if none
virtual void hdi::core::Layer::setColor ( const Color color_)
virtual

Sets the color of the layer in the layer list.

Author
GW
Date
08/2013
Parameters
color_New layer color
virtual void hdi::core::Layer::setDimsPlacedImages ( const bool  dim_)
virtual

Sets whether images in the target layer are automatically dimmed.

Author
GW
Date
08/2013
Parameters
dim_true to dim images, false otherwise
virtual void hdi::core::Layer::setEditable ( const bool  editable_)
virtual

Sets whether the target layer is editable.

Author
GW
Date
08/2013
Parameters
editable_true to allow editing, false otherwise
Note
Always sets the layer to be locked.
virtual void hdi::core::Layer::setLocked ( const bool  locked_)
virtual

Sets whether the target layer is locked.

Author
GW
Date
08/2013
Parameters
locked_true to lock, false otherwise
Note
Always makes the layer uneditable.
virtual void hdi::core::Layer::setName ( const std::string &  name_)
virtual

Sets the name for the target layer.

Author
GW
Date
08/2013
Parameters
name_New layer name, as UTF-8
virtual void hdi::core::Layer::setPreview ( const bool  preview_)
virtual

Sets the target layer to preview or outline mode.

Author
GW
Date
08/2013
Parameters
preview_true for preview, false for outline
virtual void hdi::core::Layer::setPrinted ( const bool  printed_)
virtual

Sets whether the target layer is considered printable when printing the document.

Author
GW
Date
08/2013
Parameters
printed_true for printable, false otherwise
virtual void hdi::core::Layer::setVisible ( const bool  visible_)
virtual

Sets whether the target layer is visible.

Author
GW
Date
08/2013
Parameters
visible_true to make visible, false to hide
Note
This method simply calls show() or hide() as appropriate
virtual void hdi::core::Layer::show ( )
virtual

Shows the layer.

Author
GW
Date
08/2013
virtual std::auto_ptr<Layer> hdi::core::Layer::sibling ( ) const
virtual

Gets the next sibling layer object for the target layer.

Author
GW
Date
08/2013
Returns
A Layer object for the target's sibling, or NULL if none
virtual bool hdi::core::Layer::valid ( ) const
virtual

Tests the validity of the target layer by checking its topmost "invisible" group.

Author
GW
Date
08/2013
Returns
true if the layer's group is valid, false otherwise
virtual bool hdi::core::Layer::visible ( ) const
virtual

Gets whether the target layer is visible.

Author
GW
Date
08/2013
Returns
true for visible, false for hidden