xref: /trunk/main/cui/source/inc/transfrm.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_TRANSFRM_HXX
28 #define _SVX_TRANSFRM_HXX
29 
30 // include ---------------------------------------------------------------
31 
32 #include <svx/dlgctrl.hxx>
33 
34 #ifndef _FIXED_HXX //autogen
35 #include <vcl/fixed.hxx>
36 #endif
37 
38 // #i75273#
39 #include <basegfx/range/b2drange.hxx>
40 
41 // predefines
42 class SdrView;
43 
44 /*************************************************************************
45 |*
46 |* Transform-Tab-Dialog
47 |*
48 \************************************************************************/
49 
50 /** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor
51     to disable the size controls */
52 const sal_uInt16 SVX_OBJ_NORESIZE = 0x0100;
53 
54 /** put this into the nAnchorTypes parameter of the SvxTransformTabDialog c'tor
55     to disable the protect controls */
56 const sal_uInt16 SVX_OBJ_NOPROTECT = 0x0200;
57 
58 class SvxTransformTabDialog : public SfxTabDialog
59 {
60 private:
61     const SdrView*      pView;
62 
63     sal_uInt16              nAnchorCtrls;
64     Link                aValidateLink;
65 
66     virtual void        PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
67 
68 public:
69 
70             SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr,
71                             const SdrView* pView,
72                             sal_uInt16 nAnchorTypes = 0);
73             ~SvxTransformTabDialog();
74 
75             //link for the Writer to validate positions
76             void SetValidateFramePosLink( const Link& rLink );
77 };
78 
79 /*************************************************************************
80 |*
81 |* position and size tab page
82 |*
83 \************************************************************************/
84 
85 class SvxPositionSizeTabPage : public SvxTabPage
86 {
87     using TabPage::ActivatePage;
88     using TabPage::DeactivatePage;
89 
90 private:
91     // position
92     FixedLine           maFlPosition;
93     FixedText           maFtPosX;
94     MetricField         maMtrPosX;
95     FixedText           maFtPosY;
96     MetricField         maMtrPosY;
97     FixedText           maFtPosReference;
98     SvxRectCtl          maCtlPos;
99 
100     // size
101     FixedLine           maFlSize;
102     FixedText           maFtWidth;
103     MetricField         maMtrWidth;
104     FixedText           maFtHeight;
105     MetricField         maMtrHeight;
106     CheckBox            maCbxScale;
107     FixedText           maFtSizeReference;
108     SvxRectCtl          maCtlSize;
109 
110     // protect
111     FixedLine           maFlProtect;
112     TriStateBox         maTsbPosProtect;
113     TriStateBox         maTsbSizeProtect;
114 
115     // adjust
116     FixedLine           maFlAdjust;
117     TriStateBox         maTsbAutoGrowWidth;
118     TriStateBox         maTsbAutoGrowHeight;
119 
120     FixedLine           maFlDivider;
121 
122 private:
123     const SfxItemSet&   mrOutAttrs;
124 
125     const SdrView*      mpView;
126 
127     // #i75273#
128     basegfx::B2DRange   maRange;
129     basegfx::B2DRange   maWorkRange;
130     basegfx::B2DPoint   maAnchor;
131 
132     SfxMapUnit          mePoolUnit;
133     FieldUnit           meDlgUnit;
134     MapUnit             meMapUnit;
135     TriState            mnProtectSizeState;
136     bool                mbPageDisabled;
137     bool                mbProtectDisabled;
138     bool                mbSizeDisabled;
139     bool                mbAdjustDisabled;
140 
141     // frome size
142     // #i75273#
143     double              mfOldWidth;
144     double              mfOldHeight;
145     RECT_POINT          meRP;
146 
147     //------------------------------------
148 #if _SOLAR__PRIVATE
149     DECL_LINK( ChangePosProtectHdl, void * );
150     DECL_LINK( ChangeSizeProtectHdl, void * );
151     DECL_LINK( ChangePosXHdl, void * );
152     DECL_LINK( ChangePosYHdl, void * );
153 //  DECL_LINK( SetAnchorHdl, ListBox * );
154 //  DECL_LINK( SetOrientHdl, ListBox * );
155 
156     void SetMinMaxPosition();
157     void GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange);
158 #endif
159 
160 #if _SOLAR__PRIVATE
161     DECL_LINK( ChangeWidthHdl, void * );
162     DECL_LINK( ChangeHeightHdl, void * );
163     DECL_LINK( ClickSizeProtectHdl, void * );
164     DECL_LINK( ClickAutoHdl, void * );
165 
166     void        SetMaxSize( Rectangle aRect );
167     Rectangle   GetRect();
168 #endif
169 
170 public:
171     SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs  );
172 
173     static SfxTabPage* Create( Window*, const SfxItemSet& );
174     static sal_uInt16*     GetRanges();
175 
176     virtual sal_Bool FillItemSet( SfxItemSet& );
177     virtual void Reset( const SfxItemSet & );
178 
179     virtual void ActivatePage( const SfxItemSet& rSet );
180     virtual int  DeactivatePage( SfxItemSet* pSet );
181 
182     virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
183 
184     void         Construct();
185     void         SetView( const SdrView* pSdrView ) { mpView = pSdrView; }
186 
187 //  void         ShowAnchorCtrls(sal_uInt16 nAnchorCtrls); // Writer-spezifische Controls anzeigen
188     virtual void FillUserData();
189 
190     void        DisableResize();
191     void        DisableProtect();
192 
193     void        UpdateControlStates();
194 };
195 
196 /*************************************************************************
197 |*
198 |* Drehwinkel-Tab-Page
199 |*
200 \************************************************************************/
201 class SvxAngleTabPage : public SvxTabPage
202 {
203     using TabPage::ActivatePage;
204     using TabPage::DeactivatePage;
205 
206 private:
207     FixedLine           aFlPosition;
208     FixedText           aFtPosX;
209     MetricField         aMtrPosX;
210     FixedText           aFtPosY;
211     MetricField         aMtrPosY;
212     FixedText           aFtPosPresets;
213     SvxRectCtl          aCtlRect;
214 
215     FixedLine           aFlAngle;
216     FixedText           aFtAngle;
217     MetricField         aMtrAngle;
218     FixedText           aFtAnglePresets;
219     SvxRectCtl          aCtlAngle;
220 
221     const SfxItemSet&   rOutAttrs;
222     const SdrView*      pView;
223 
224     // #i75273#
225     basegfx::B2DRange   maRange;
226     basegfx::B2DPoint   maAnchor;
227 
228     SfxMapUnit          ePoolUnit;
229     FieldUnit           eDlgUnit;
230     MapUnit             eMapUnit;
231     //------------------------------------
232 #if _SOLAR__PRIVATE
233     DECL_LINK( ModifiedHdl, void * );
234 #endif
235 public:
236          SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs  );
237 
238     static SfxTabPage* Create( Window*, const SfxItemSet& );
239     static sal_uInt16*     GetRanges();
240 
241     virtual sal_Bool FillItemSet( SfxItemSet& );
242     virtual void Reset( const SfxItemSet & );
243 
244     virtual void ActivatePage( const SfxItemSet& rSet );
245     virtual int  DeactivatePage( SfxItemSet* pSet );
246 
247     virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
248 
249     void         Construct();
250     void         SetView( const SdrView* pSdrView ) { pView = pSdrView; }
251 };
252 
253 /*************************************************************************
254 |*
255 |* Schraegstellen/Eckenradius-Tab-Page
256 |*
257 \************************************************************************/
258 class SvxSlantTabPage : public SvxTabPage
259 {
260     using TabPage::ActivatePage;
261     using TabPage::DeactivatePage;
262 
263 private:
264     FixedLine           aFlRadius;
265     FixedText           aFtRadius;
266     MetricField         aMtrRadius;
267     //TriStateBox           aTsbVertical;
268     FixedLine           aFlAngle;
269     FixedText           aFtAngle;
270     MetricField         aMtrAngle;
271     //SvxRectCtl            aCtlAngle;
272 
273     const SfxItemSet&   rOutAttrs;
274 
275     const SdrView*      pView;
276 
277     // #i75273#
278     basegfx::B2DRange   maRange;
279 
280     SfxMapUnit          ePoolUnit;
281     FieldUnit           eDlgUnit;
282     MapUnit             eMapUnit;
283     //------------------------------------
284 public:
285          SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs  );
286 
287     static SfxTabPage* Create( Window*, const SfxItemSet& );
288     static sal_uInt16*     GetRanges();
289 
290     virtual sal_Bool FillItemSet( SfxItemSet& );
291     virtual void Reset( const SfxItemSet & );
292 
293     virtual void ActivatePage( const SfxItemSet& rSet );
294     virtual int  DeactivatePage( SfxItemSet* pSet );
295 
296     virtual void PointChanged( Window* pWindow, RECT_POINT eRP );
297 
298     void         Construct();
299     void         SetView( const SdrView* pSdrView ) { pView = pSdrView; }
300 };
301 
302 
303 
304 #endif // _SVX_TRANSFRM_HXX
305 
306