Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreIllustrator.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_ILLUSTRATOR__
8 #define __HDI_CORE_ILLUSTRATOR__
9 
10 #include <map>
11 #include <vector>
12 
13 #include "hdicoreColor.h"
14 #include "hdicoreTypes.h"
15 
19 #define HDI_CORE_ILLUSTRATOR hdi::core::Illustrator::instance()
20 
21 namespace hdi
22 {
23  namespace core
24  {
25  #if defined(MAC_ENV)
26  typedef NSApplication* PlatformAppPtr;
27  #elif defined(WIN_ENV)
28  typedef HINSTANCE PlatformAppPtr;
29  #endif
30 
31  namespace ai
32  {
33  class Preferences;
34  }
35 
36  class CurrentDocument;
37  class Document;
38  class FileFormat;
39  class Font;
40  class LiveEffect;
41  class MenuGroup;
42  class ThirdPartyPlugin;
43  class Typeface;
44 
49  {
50  public:
51  struct SuiteInfo;
52 
53  typedef std::vector< Font* > FontVector;
54  typedef std::map<std::string, SuiteInfo> SuiteInfoMap;
55  typedef std::map< std::string, ThirdPartyPlugin* > ThirdPartyPluginMap;
56 
61  {
62  PanelOrControlBarType = 10,
63  ModalOrFloatingDialogType = 20
64  };
65 
70  {
71  WindowBackgroundColor = 10,
72  LabelTextColor = 20,
73  LabelTextDisabledColor = 30,
74  FieldTextColor = 40,
75  FieldTextDisabledColor = 50,
76  FieldBackgroundColor = 60,
77  FocusRingColor = 70,
78  ShadowColor = 80,
79  HighlightColor = 90
80  };
81 
87  {
88  UnknownFolderType = 0,
89  ApplicationFolderType = 10,
90  PluginsFolderType = 20,
91  PrimaryScratchFolderType = 30,
92  SecondaryScratchFolderType = 40,
93  PreferencesFolderType = 50,
94  UserSupportFolderType = 60,
95  UserSupportAIFolderType = 70,
96  UserSupportAIPluginsFolderType = 80,
97  ApplicationSupportCommonFolderType = 90,
98  ApplicationSupportCommonColorFolderType = 100,
99  ApplicationSupportCommonTypeSupportFolderType = 110,
100  ApplicationSupportCommonFontsFolderType = 120,
101  ApplicationSupportCommonFontsRequiredFolderType = 130,
102  ApplicationSupportCommonFontsRequiredCMapsFolderType = 140,
103  RequiredFontsFolderType = 150,
104  FontsFolderType = 160,
105  MyDocumentsFolderType = 170,
106  ApplicationSupportCommonWorkflowFolderType = 180,
107  PrinterDescriptionsFolderType = 190,
108  RequiredPluginsFolderType = 200,
109  SettingsFolderType = 210,
110  ColorTableSettingsFolderType = 220,
111  OptimizeSettingsFolderType = 230,
112  HelpFolderType = 240,
113  RootFolderType = 250,
114  PresetsFolderType = 260,
115  PresetActionsFolderType = 270,
116  PresetBrushesFolderType = 280,
117  PresetGradientsFolderType = 290,
118  PresetKeyboardShortcutsFolderType = 300,
119  PresetPatternsFolderType = 310,
120  PresetScriptsFolderType = 320,
121  PresetStylesFolderType = 330,
122  PresetSwatchesFolderType = 340,
123  DictionariesFolderType = 350,
124  LegalFolderType = 360,
125  SampleFilesFolderType = 370,
126  UtilitiesFolderType = 380,
127  PackageFolderType = 390,
128  ApplicationSupportCommonFontsRequiredBaseFolderType = 400,
129  HelpersFolderType = 410,
130  PreviewInFolderType = 420,
131  RidersFileFolderType = 430,
132  HyphenationDictFolderType = 440,
133  ApplicationSupportCommonPDFLFolderType = 450,
134  ApplicationSupportCommonPDFL5FolderType = 460,
135  ApplicationSupportCommonPDFL5CMapsFolderType = 470,
136  ApplicationSupportCommonPDFL5FontsFolderType = 480,
137  ApplicationSupportCommonPrintSupportFolderType = 490,
138  ApplicationSupportCommonColorProfilesFolderType = 500,
139  ApplicationSupportCommonColorSettingsFolderType = 510,
140  ContentsFolderType = 520,
141  HelpImagesFolderType = 530,
142  FontsCMapsFolderType = 540,
143  PresetSymbolsFolderType = 550,
144  TsumeFolderType = 560,
145  SpellingDictFolderType = 570,
146  PresetTemplatesFolderType = 580,
147  FontsCFFolderType = 590,
148  ApplicationSupportCommonKinsokuSetFolderType = 600,
149  ApplicationSupportCommonMojikumeSetFolderType = 610,
150  PresetBlankDocumentsFolderType = 620,
151  UserSupportCommonFontsFolderType = 630,
152  FontsCFTempFolderType = 640,
153  LogsFolderType = 650,
154  SampleArtFolderType = 660,
155  SampleSVGFolderType = 670,
156  SampleGraphDesignsFolderType = 680,
157  SampleDataDrivenGraphicsFolderType = 690,
158  WorkspacesFolderType = 700,
159  PresetColorBooksFolderType = 710,
160  PresetLegacyColorBooksFolderType = 720,
161  PresetSwatchExchangeFolderType = 730,
162  ApplicationSupportCommonLinguisticsFolderType = 740,
163  ApplicationSupportCommonLinguisticsProvidersFolderType = 750,
164  DemonstratorFolderType = 760,
165  ResourcesFolderType = 770,
166  CoolExtrasFolderType = 780,
167  OutputSettingsFolderType = 790,
168  StartupScriptsFolderType = 800,
169  DesktopFolderType = 810,
170  IllustratorFormatsFolderType = 820,
171  AdditionalAIPluginsFolderType = 830,
172  UserWritableStartupFileFolderType = 840,
173  UserWritablePresetBrushesFolderType = 850,
174  UserWritablePresetStylesFolderType = 860,
175  UserWritablePresetSwatchesFolderType = 870,
176  UserWritablePresetSwatchExchangeFolderType = 880,
177  UserWritablePresetSymbolsFolderType = 890,
178  PresetFlashPanelsFolderType = 900,
179  UserWritablePresetSettingsFolderType = 910,
180  UserWritablePresetOptimizeSettingsFolderType = 920,
181  UserWritablePresetOutputSettingsFolderType = 930,
182  UserWritablePresetColorTableSettingsFolderType = 940,
183  RequiredStartupProfilesFolderType = 950,
184  PresetWorkspacesFolderType = 960,
185  PresetWelcomeScreenFolderType = 970,
186  RequiredFolderType = 980,
187  RequiredResourcesFolderType = 990,
188  RequiredLocalizedResourcesFolderType = 1000,
189  WSMgrCfgFolderType = 1010,
190  ModifiedWorkspacesFolderType = 1020,
191  ToolsFolderType = 1030,
192  PreferencesRootFolderType = 1040,
193  RequiredLinguisticsFolderType = 1050, // Illustrator 17 and above only
194  TemporaryFolder = 1060 // Illustrator 19 and above only
195  };
196 
200  struct SuiteInfo
201  {
205  const std::string name;
206 
210  const int32_t internalVersion;
211 
216  const int32_t externalVersion;
217 
223  SuiteInfo();
224 
232  SuiteInfo(const SuiteInfo& si_);
233 
243  SuiteInfo(const std::string& name_, const int32_t intVers_, const int32_t extVers_);
244 
250  virtual ~SuiteInfo();
251 
260  bool operator==(const SuiteInfo& rhs_) const;
261 
270  bool operator!=(const SuiteInfo& rhs_) const;
271  };
272 
273  typedef std::auto_ptr<SuiteInfo> SuiteInfoAP;
274 
282  static Illustrator* instance();
283 
289  ~Illustrator();
290 
298  PlatformAppPtr platformApp() const;
299 
313  void* alloc(const int32_t size_) const;
314 
330  void* realloc(void* const block_, const int32_t newSize_) const;
331 
339  void free(void* const block_) const;
340 
348  std::string userName() const;
349 
357  std::string userOrganization() const;
358 
366  std::string serialNumber() const;
367 
375  int32_t majorVersion() const;
376 
384  int32_t minorVersion() const;
385 
393  int32_t revisionVersion() const;
394 
405  int16_t bitness() const;
406 
416  std::string versionString(const bool useRevision_ = false) const;
417 
425  std::string versionDescription() const;
426 
434  SuiteInfoMap allSuites() const;
435 
446  ThirdPartyPluginMap allPlugins() const;
447 
456  std::auto_ptr<ThirdPartyPlugin> pluginWithName(const std::string& name_) const;
457 
465  ai::Preferences* const preferences() const;
466 
475 
483  uint32_t documentCount() const;
484 
493  std::auto_ptr<Document> documentAtIndex(const uint32_t index_) const;
494 
506  std::auto_ptr<Document> openDocument(
507  const std::string& path_,
508  const DocumentColorModel colorModel_,
509  const bool showDialog_,
510  const bool forceCopy_ = false
511  ) const;
512 
521  bool openURL(const std::string& url_) const;
522 
532  void cacheFonts();
533 
539  void clearFontCache();
540 
548  uint32_t fontCount() const;
549 
558  std::auto_ptr<Font> fontAtIndex(const uint32_t index_) const;
559 
568  std::auto_ptr<Font> fontWithName(const std::string& faceName_) const;
569 
579  FontVector allFonts() const;
580 
588  uint32_t typefaceCount() const;
589 
598  std::auto_ptr<Typeface> typefaceAtIndex(const uint32_t index_) const;
599 
607  Locale locale() const;
608 
616  std::string localeString() const;
617 
625  uint32_t fileFormatCount() const;
626 
635  std::auto_ptr<FileFormat> fileFormatAtIndex(const uint32_t index_) const;
636 
646  bool registerFileFormat(FileFormat& ff_);
647 
655  uint32_t liveEffectCount() const;
656 
665  std::auto_ptr<LiveEffect> liveEffectAtIndex(const uint32_t index_) const;
666 
674  uint32_t menuGroupCount() const;
675 
690  std::auto_ptr<MenuGroup> menuGroupAtIndex(const uint32_t index_) const;
691 
697  void suspendExistingContext();
698 
704  void resumeSuspendedContext();
705 
711  void pushContext();
712 
718  void popContext();
719 
720  #if HDI_CORE_COMPILE_AI21_PLUS
721 
728  bool hasContext() const;
729  #endif
730 
739  std::string folderPath(const FolderType folder_) const;
740 
750  bool checkFolderForFile(const FolderType folder_, const std::string& fileName_) const;
751 
760  bool existsInPluginsFolder(const std::string& fileName_) const;
761 
770  bool existsInToolsFolder(const std::string& fileName_) const;
771 
783  bool fileSavePrompt(const std::string& title_, const std::string& fileName_, std::string& path__) const;
784 
794  bool fileOpenPrompt(const std::string& title_, std::string& path__) const;
795 
805  bool folderPrompt(const std::string& title_, std::string& path__) const;
806 
814  bool uiThemeDark() const;
815 
826  Color uiThemeColor(const ThemeWindowType dialog_, const ThemeComponentType component_) const;
827 
828 
829  private:
833  static Illustrator* __instance;
834 
838  void* __data;
839 
845  Illustrator();
846 
852  Illustrator(const Illustrator&);
853 
859  Illustrator& operator=(const Illustrator&);
860  };
861  }
862 }
863 
864 #endif
865 // __HDI_CORE_ILLUSTRATOR__
const std::string name
Stores the name of the suite.
Definition: hdicoreIllustrator.h:205
std::auto_ptr< LiveEffect > liveEffectAtIndex(const uint32_t index_) const
Gets a live effect object via its index.
SuiteInfo()
Constructs a new SuiteInfo object with default values.
void free(void *const block_) const
Frees a block of memory previously allocated with the Illustrator::alloc() method.
bool fileOpenPrompt(const std::string &title_, std::string &path__) const
Displays to the user a prompt to choose a file to be read from disk.
static Illustrator * instance()
Acquires an instance of the Illustrator class.
std::string versionDescription() const
Gets the Illustrator version description, a.k.a. the marketed version name.
Stores basic information about an Illustrator suite.
Definition: hdicoreIllustrator.h:200
int32_t revisionVersion() const
Gets the Illustrator revision/bugfix version number (e.g. "2" from "16.0.2")
PlatformAppPtr platformApp() const
Gets a pointer to the platform object representing the current Illustrator instance.
Describes an RGB color, with opacity, typically for UI purposes.
Definition: hdicoreColor.h:24
ThemeWindowType
Used when querying for current UI colors.
Definition: hdicoreIllustrator.h:60
uint32_t menuGroupCount() const
Gets the count of menu groups in Illustrator (at all levels)
uint32_t fontCount() const
Gets the count of available fonts.
bool uiThemeDark() const
Gets whether the current Illustrator UI theme color is considered dark.
bool operator!=(const SuiteInfo &rhs_) const
Compares one SuiteInfo object to another to check for inequality.
std::auto_ptr< ThirdPartyPlugin > pluginWithName(const std::string &name_) const
Gets a specific plugin by its name (must be an exact match)
uint32_t fileFormatCount() const
Gets the count of available file formats.
const int32_t externalVersion
Stores the external (public) version number of the suite (what would be used to acquire the suite) ...
Definition: hdicoreIllustrator.h:216
Allows access to and manipulation of Illustrator app preferences; can be used to store plugin prefere...
Definition: hdicoreaiPreferences.h:26
bool registerFileFormat(FileFormat &ff_)
Registers a new file format with Illustrator, which will be displayed in Illustrator's file dialog...
SuiteInfoMap allSuites() const
Gets a map of all available suites, keyed on their name.
std::auto_ptr< MenuGroup > menuGroupAtIndex(const uint32_t index_) const
Gets a menu group object via its index.
void suspendExistingContext()
Suspends the existing Illustrator app context, storing it for later resuming.
Header file for describing Illustrator UI colors.
void pushContext()
Pushes a new Illustrator app context onto the stack.
uint32_t documentCount() const
Gets the open document count.
std::string serialNumber() const
Gets the serial number of the registered Illustrator user.
uint32_t typefaceCount() const
Gets the count of available typefaces.
std::string localeString() const
Gets a string describing the current locale of Illustrator.
std::auto_ptr< Typeface > typefaceAtIndex(const uint32_t index_) const
Gets a Typeface object via its index.
Color uiThemeColor(const ThemeWindowType dialog_, const ThemeComponentType component_) const
Gets the current color for a given widget component.
std::auto_ptr< FileFormat > fileFormatAtIndex(const uint32_t index_) const
Gets a file format object via its index.
bool hasContext() const
Checks whether an Illustrator app context currently exists.
ai::Preferences *const preferences() const
Convenience method to return the ai::Preferences instance.
void * alloc(const int32_t size_) const
Allocates a block of memory in Illustrator's memory heap (rather than the caller's memory heap); requ...
void clearFontCache()
Clears fonts previously cached by the cacheFonts() method.
void popContext()
Pops a previously pushed Illustrator app context from the stack.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
std::auto_ptr< Font > fontWithName(const std::string &faceName_) const
Gets a Font object via its name (case-insensitive)
Describes a file format that Illustrator can either read or write.
Definition: hdicoreFileFormat.h:21
bool fileSavePrompt(const std::string &title_, const std::string &fileName_, std::string &path__) const
Displays to the user a prompt to choose a location and file name for some data to be written to disk...
void * realloc(void *const block_, const int32_t newSize_) const
Reallocates a block of memory in Illustrator's memory heap (that was previously allocated using the I...
void cacheFonts()
Caches all the available fonts in an internal map until clearFontCache() is called.
Current (focused) document class to allow for metadata access, updating, dictionary access...
Definition: hdicoreCurrentDocument.h:50
FontVector allFonts() const
Gets a vector containing Font objects for all available fonts.
uint32_t liveEffectCount() const
Gets the count of available live effects.
FolderType
Describes a particular folder in an Illustrator installation, whose path can be acquired via the Illu...
Definition: hdicoreIllustrator.h:86
bool operator==(const SuiteInfo &rhs_) const
Compares one SuiteInfo object to another to check for equality.
Definition: hdicoreaiArray.h:12
ThirdPartyPluginMap allPlugins() const
Gets a map of all available plugins, keyed on their name.
bool existsInToolsFolder(const std::string &fileName_) const
Verifies that a file is located in the Illustrator tools folder.
std::auto_ptr< Document > documentAtIndex(const uint32_t index_) const
Gets an open document by its index.
int32_t minorVersion() const
Gets the Illustrator minor version number (e.g. "0" from "16.0.2")
Allows access to a wide variety of Illustrator app-related runtime attributes, documents, fonts, etc.
Definition: hdicoreIllustrator.h:48
int16_t bitness() const
Gets the bitness of Illustrator at runtime.
const int32_t internalVersion
Stores the internal version number of the suite.
Definition: hdicoreIllustrator.h:210
int32_t majorVersion() const
Gets the Illustrator major version number (e.g. "16" from "16.0.2")
Locale locale() const
Gets the current locale of Illustrator.
std::string folderPath(const FolderType folder_) const
Gets the folder path for a given illustrator folder.
std::string userName() const
Gets the name of the registered Illustrator user.
void resumeSuspendedContext()
Resumes a previously suspended Illustrator app context.
std::string versionString(const bool useRevision_=false) const
Gets the Illustrator version as a string (e.g. "16.0" for Illustrator 16)
std::auto_ptr< Font > fontAtIndex(const uint32_t index_) const
Gets a Font object via its index.
bool openURL(const std::string &url_) const
Causes the OS's default browser to open a given URL.
~Illustrator()
Destructs an Illustrator object.
bool checkFolderForFile(const FolderType folder_, const std::string &fileName_) const
Checks whether a given file exists within one of Illustrator's support folders.
ThemeComponentType
Used when querying for current UI colors.
Definition: hdicoreIllustrator.h:69
CurrentDocument *const currentDocument()
Acquires an instance of the CurrentDocument class for the current document.
virtual ~SuiteInfo()
Destructs a SuiteInfo object.
std::string userOrganization() const
Gets the organization/company name of the registered Illustrator user.
std::auto_ptr< Document > openDocument(const std::string &path_, const DocumentColorModel colorModel_, const bool showDialog_, const bool forceCopy_=false) const
Opens a document and returns it.
bool existsInPluginsFolder(const std::string &fileName_) const
Verifies that a file is located in one of the Illustrator plugins folders.
bool folderPrompt(const std::string &title_, std::string &path__) const
Displays to the user a prompt to choose a folder on disk.