InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IRulerData.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Burbidge
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __IRULERDATA__
25 #define __IRULERDATA__
26 
27 #include "PMTypes.h"
28 #include "PMPoint.h"
29 #include "RulerID.h"
30 
31 //========================================================================================
32 // Forward declaration
33 //========================================================================================
34 
35 class IPMFont;
36 class IControlView;
37 
38 //========================================================================================
39 // CLASS RulerTickSpec
40 //========================================================================================
41 
43 {
44  typedef base_type data_type;
45  PMReal fStartingZoomFactor;
46  PMReal fMajorDivisionLength;
47  K2Vector<int16> fSubDivisionsCount;
48  K2Vector<int16> fTickHeightPercentages;
49 };
50 
51 //========================================================================================
52 // CLASS IRulerData
53 //========================================================================================
54 
55 class IRulerData : public IPMUnknown
56 {
57 // ----- Constructors/desctructors
58 public:
59  enum { kDefaultIID = IID_IRULERDATA };
60 
61  virtual void Init(const ClassID& unitOfMeasureID) = 0;
62  // Initialize the data that describes the appearance of a ruler. Get the appearance
63  // data from the unit of measure boss.
64 
65 // ----- Accessors
66 public:
67  virtual IPMFont* QueryFont() const = 0;
68  virtual PMReal GetFontPtSize() const = 0;
69  virtual ClassID GetUnitOfMeasure() const = 0;
70 
71  virtual PMReal GetMajorDivisionLength(const PMReal &curZoomFactor) const = 0;
72 
73  virtual int16 GetFractionFlag() const = 0;
74  virtual int16 GetDecimalFlag() const = 0;
75  virtual int32 GetNumberOfTickSpecs() const = 0;
76  virtual const RulerTickSpec &GetTickSpec(const PMReal& curZoomFactor) const = 0;
77 
78  // inVal is in pasteboard coords
79  // The result is in pasteboard coords
80  // returns kTrue if hit a tick mark, else false
81  virtual bool16 GetHorzAdjustedValue (PMReal* inOutVal, const PMReal& xScaleFactor, const PMReal& xTranslation) const = 0;
82  virtual bool16 GetVertAdjustedValue (PMReal* inOutVal, const PMReal& yScaleFactor, const PMReal& yTranslation) const = 0;
83 
84  virtual PMReal GetNearestTick(const PMReal &position, const PMReal &zoomFactor, bool16 isHorzRuler, PMReal& lowerBound, PMReal& upperBound) = 0;
85 };
86 
87 #endif