Adobe.com
Contents Suites Classes Class Index Member Index

IAIArtboards.hpp

Go to the documentation of this file.
00001 #pragma once
00002 #ifndef _IAI_ARTBOARDS_
00003 #define _IAI_ARTBOARDS_
00004 
00005 /*
00006 * Name: IAIArtboards.hpp
00007 * Author: Started by Pushp
00008 * Date: November, 2008
00009 * Purpose: Adobe Illustrator Artboard Interfaces
00010 *
00011 * ADOBE SYSTEMS INCORPORATED
00012 * Copyright 2009 Adobe Systems Incorporated.
00013 * All rights reserved.
00014 *
00015 * NOTICE:  Adobe permits you to use, modify, and distribute this file
00016 * in accordance with the terms of the Adobe license agreement
00017 * accompanying it. If you have received this file from a source other
00018 * than Adobe, then your use, modification, or distribution of it
00019 * requires the prior written permission of Adobe.
00020 *
00021 */
00022 #include "AITypes.h"
00023 #include "IAIUnicodeString.h"
00024 class CAIArtboardProperties;
00025 class CAIArtboardList;
00026 
00029 #define kAICantDeleteLastArtboardErr            'CDLC'
00030 
00032 #define kAIExceededMaxArtboardLimitErr          'EMxL'
00033 
00035 #define kNotFoundErr            '!FND'
00036 
00037 #define kActiveArtboard -1
00038 
00039 namespace ai
00040 {
00042         typedef ai::int32 ArtboardID;
00044         typedef CAIArtboardProperties* ArtboardRef;
00046         typedef CAIArtboardList* ArtboardListRef;
00047 
00052         class ArtboardProperties
00053         {
00054         public:
00056                 typedef enum
00057                 {
00058                         kNone = 0,
00059                         kCenter = 1,
00060                         kCrossHair = 1<<1,
00061                         kSafeAreas = 1<<2
00062                 } DisplayMarkType;
00063 
00065                 ArtboardProperties();
00066 
00068                 ArtboardProperties(const ArtboardProperties&);
00069 
00071                 ~ArtboardProperties();
00073                 ArtboardProperties& operator=(const ArtboardProperties&);
00074 
00078                 bool IsValid() const
00079                 {
00080                         return fImpl != NULL;
00081                 }
00082 
00086                 AIErr GetPosition(AIRealRect& value) const;
00087 
00092                 AIErr SetPosition(AIRealRect value);
00093 
00097                 AIErr GetPAR(AIReal& value) const;
00098 
00103                 AIErr SetPAR(AIReal value);
00104 
00109                 AIErr GetShowDisplayMark(DisplayMarkType mark, bool& show) const;
00110 
00115                 AIErr SetShowDisplayMark(DisplayMarkType mark,bool show);
00116 
00120                 AIErr GetName(ai::UnicodeString& name) const;
00121 
00125                 AIErr SetName(const ai::UnicodeString& name);
00126 
00130                 AIErr GetRulerOrigin(AIRealPoint& rulerOrigin) const;
00131 
00135                 AIErr SetRulerOrigin(const AIRealPoint& rulerOrigin);
00136 
00141                 AIErr IsDefaultName(AIBoolean& isDefault) const;
00142 
00144                 AIErr SetIsDefaultName(const AIBoolean& isDefault);
00145 
00146         public: // internal use public interface
00147                 ArtboardProperties(const ArtboardRef ref);
00148                 void deleteImpl();
00149         private:
00150                 friend class ArtboardList;
00151                 ArtboardRef fImpl;
00152         };
00153 
00157         class ArtboardList
00158         {
00159         public:
00160                 /* Constructs an ArtboardList object for the current document*/
00161                 ArtboardList();
00162 
00164                 ~ArtboardList();
00169                 bool IsValid() const
00170                 {
00171                         return fImpl != NULL;
00172                 }
00173 
00180                 AIErr AddNew(ArtboardProperties& newArtboard, ArtboardID& index);
00181 
00188                 AIErr Insert(ArtboardProperties& artboard, ArtboardID& index);
00189 
00194                 AIErr Delete(ArtboardID index);
00198                 AIErr GetCount(ArtboardID& count) const;
00199 
00205                 ArtboardProperties GetArtboardProperties(ArtboardID index);
00206 
00212                 AIErr Update(ArtboardID index, const ArtboardProperties& artboard);
00213 
00218                 AIErr GetActive(ArtboardID& index) const;
00219 
00223                 AIErr SetActive(ArtboardID index);
00224 
00225         public: // internal use public interface
00226                 ArtboardList(const ArtboardList&);
00227                 ArtboardList& operator=(const ArtboardList&);
00228                 ArtboardList(ArtboardListRef);
00229                 void deleteImpl();
00230 
00231         private:
00232                 ArtboardListRef fImpl;
00233         };
00234 
00237         namespace ArtboardUtils
00238         {
00242                 inline AIErr GetCount(ArtboardID& count)
00243                 {
00244                         ArtboardList list;
00245                         return list.GetCount(count);
00246                 }
00251                 inline AIErr GetPosition(ArtboardID index,AIRealRect& rect)
00252                 {
00253                         ArtboardList list;
00254                         ArtboardProperties artboard(list.GetArtboardProperties(index));
00255                         if(!artboard.IsValid()) return kBadParameterErr;
00256                         return artboard.GetPosition(rect);
00257                 }
00261                 inline AIErr GetActiveArtboardPosition(AIRealRect& rect)
00262                 {
00263                         AIErr error = kNoErr;
00264                         ArtboardList list;
00265                         ArtboardID index;
00266                         error = list.GetActive(index);
00267                         GetPosition(index,rect);
00268                         return error;
00269                 }
00273                 inline AIErr GetActiveArtboardIndex(ArtboardID& index)
00274                 {
00275                         AIErr error = kNoErr;
00276                         ArtboardList list;
00277                         error = list.GetActive(index);
00278                         return error;
00279                 }
00285                 AIErr GetArtboardName(ai::UnicodeString& name,bool& isDefault, ArtboardID index = kActiveArtboard);
00286 
00291                 AIErr GetArtboardIndexByName(const ai::UnicodeString& name, ai::ArtboardID& index);
00292         }
00293 }
00294 
00295 #endif //_IAI_ARTBOARDS_


Contents Suites Classes Class Index Member Index
Adobe Solutions Network
 
Copyright © 2016 Adobe Systems Incorporated. All rights reserved.
Terms of Use Online Privacy Policy Adobe and accessibility Avoid software piracy Permissions and Trademarks