InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IAdaptiveHelper.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Sachin Singhal
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 2018 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: All information contained herein is, and remains
18 // the property of Adobe Systems Incorporated and its suppliers,
19 // if any. The intellectual and technical concepts contained
20 // herein are proprietary to Adobe Systems Incorporated and its
21 // suppliers and may be covered by U.S. and Foreign Patents,
22 // patents in process, and are protected by trade secret or copyright law.
23 // Dissemination of this information or reproduction of this material
24 // is strictly forbidden unless prior written permission is obtained
25 // from Adobe Systems Incorporated.
26 //
27 //========================================================================================
28 
29 #ifndef __IAdaptiveHelper__
30 #define __IAdaptiveHelper__
31 
32 #include "IPMUnknown.h"
33 #include "AutoLayoutID.h"
34 #include "UIDList.h"
35 #include "ErrorUtils.h"
36 #include "IXPAttributeSuite.h"
37 
38 //Move to AdaptiveCore
39 #define NORMAILZE_ERROR(err) if(err == kItemDoesNotIntersectBoundsError || err == kItemTooSmallError || err == kUnableToSetBoundingBoxError) \
40  { ErrorUtils::PMSetGlobalErrorCode(kSuccess); err = kSuccess; }
41 #define SHOW_ERROR(err, msg) if (err != kSuccess) \
42  ASSERT_FAIL(msg);
43 #ifdef DEBUG
44 #define HANDLE_ADAPTIVE_ERR(err, msg) NORMAILZE_ERROR(err) \
45  SHOW_ERROR(err, msg);
46 #else
47 #define HANDLE_ADAPTIVE_ERR(err, msg) NORMAILZE_ERROR(err);
48 #endif
49 
50 enum OptionsFlag {
51  kDefaultSettings = 0,
52  kMaintainAspectRatioForNonRectangular = 1,
53  kResizeIrrespectiveOfAspectRatio = 2,
54 };
55 
57 {
58 public:
59  /* Default IID to be used by UseDefaultIID() */
60  enum { kDefaultIID = IID_IADAPTIVEHELPER };
61 
66  virtual PMRect GetBoundsForPageItem(UIDRef pageItemRef) = 0;
67 
74  virtual PMRect GetFinalBoundsForPageItem(const UIDRef& pageItemRef, const PMRect& initialBounds, const uint32& options = 0) = 0;
75 
81  virtual void SetRecommendedBoundsForPageItem(UIDRef pageItemRef, PMRect recommendedBounds) = 0;
82 
86  virtual bool16 ShouldHandleHidden() = 0;
87 
91  virtual bool16 ShouldHandleLocked() = 0;
92 
96  virtual bool16 ShouldHandleText() = 0;
97 
102 
107  virtual bool16 ShouldMaintainAspectRatioForPI(UIDRef pageItemRef) = 0;
108 
109  virtual void RegisterMaxFontScaleOf(UID uid, PMReal fontScale) = 0;
110  virtual PMReal GetBestPossibleTextScaleFactor(const UIDRef uidRef, const PMReal& hScale, const PMReal& vScale) = 0;
111  virtual PMReal GetFontScale(UID itemUID) = 0;
112 
113  virtual bool16 LiesInsideMargin(const UIDRef& pageItemRef, const PMRect& initialBounds) = 0;
114 
115  virtual ErrorCode AdjustEffects(const UIDList& itemList, const PMRect& initialBounds, const PMRect& finalBounds) = 0;
116  virtual PMPoint GetMinSizeOfObject(UIDRef pageItemRef) = 0;
117  virtual PMRect GetRelativeFinalBounds(PMRect initialBounds, PMRect initialReferenceBounds, PMRect finalReferenceBounds) = 0;
118 
119  virtual PMReal GetMaxAllowedFontSize() = 0;
120  virtual PMReal GetMinAllowedFontSize() = 0;
121  virtual void PreprocessText(UIDRef uidRef) = 0;
122  virtual UID GetSpreadUID(UIDRef pageItemUID) = 0;
123 };
124 
125 
126 #endif // __IAdaptiveHelper__