Update ooo320-m1
[ooovba.git] / svx / source / cui / grfpage.hxx
blob2f66c75bdd1a591b29e385c693259277ae64870d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: grfpage.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_GRFPAGE_HXX
32 #define _SVX_GRFPAGE_HXX
34 #ifndef _FIXED_HXX //autogen
35 #include <vcl/fixed.hxx>
36 #endif
37 #ifndef _BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
39 #endif
40 #ifndef _FIELD_HXX //autogen
41 #include <vcl/field.hxx>
42 #endif
43 #include <vcl/graph.hxx>
44 #include <sfx2/tabdlg.hxx>
47 class SvxGrfCropPage : public SfxTabPage
49 using Window::CalcZoom;
50 using TabPage::ActivatePage;
51 using TabPage::DeactivatePage;
53 class SvxCropExample : public Window
55 Size aFrameSize;
56 Point aTopLeft, aBottomRight;
57 Graphic aGrf;
59 public:
60 SvxCropExample( Window* pPar, const ResId& rResId );
62 virtual void Paint( const Rectangle& rRect );
64 void SetTopLeft( const Point& rNew ) { aTopLeft = rNew; }
65 void SetTop( long nVal ) { aTopLeft.X() = nVal; }
66 void SetBottom( long nVal ) { aBottomRight.X() = nVal; }
67 void SetLeft( long nVal ) { aTopLeft.Y() = nVal; }
68 void SetRight( long nVal) { aBottomRight.Y() = nVal; }
69 void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; }
70 void SetFrameSize( const Size& rSz );
71 void SetGraphic( const Graphic& rGrf ) { aGrf = rGrf; }
72 const Graphic& GetGraphic() const { return aGrf; }
75 FixedLine aCropFL;
76 RadioButton aZoomConstRB;
77 RadioButton aSizeConstRB;
78 FixedText aLeftFT;
79 MetricField aLeftMF;
80 FixedText aRightFT;
81 MetricField aRightMF;
82 FixedText aTopFT;
83 MetricField aTopMF;
84 FixedText aBottomFT;
85 MetricField aBottomMF;
87 FixedLine aZoomFL;
88 FixedText aWidthZoomFT;
89 MetricField aWidthZoomMF;
90 FixedText aHeightZoomFT;
91 MetricField aHeightZoomMF;
93 FixedLine aSizeFL;
94 FixedText aWidthFT;
95 MetricField aWidthMF;
96 FixedText aHeightFT;
97 MetricField aHeightMF;
98 FixedText aOrigSizeFT;
99 PushButton aOrigSizePB;
101 // Example
102 SvxCropExample aExampleWN;
105 Timer aTimer;
106 String aGraphicName;
107 Size aOrigSize;
108 Size aPageSize;
109 const MetricField* pLastCropField;
110 long nOldWidth;
111 long nOldHeight;
112 BOOL bReset;
113 BOOL bInitialized;
114 BOOL bSetOrigSize;
117 SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet );
118 virtual ~SvxGrfCropPage();
120 DECL_LINK( ZoomHdl, MetricField * );
121 DECL_LINK( SizeHdl, MetricField * );
122 DECL_LINK( CropHdl, const MetricField * );
123 DECL_LINK( CropLoseFocusHdl, MetricField * );
124 DECL_LINK( CropModifyHdl, MetricField * );
125 DECL_LINK( OrigSizeHdl, PushButton * );
126 DECL_LINK( Timeout, Timer * );
128 void CalcZoom();
129 void CalcMinMaxBorder();
130 void GraphicHasChanged(BOOL bFound);
131 virtual void ActivatePage(const SfxItemSet& rSet);
133 Size GetGrfOrigSize( const Graphic& ) const;
134 public:
135 static SfxTabPage *Create( Window *pParent, const SfxItemSet &rSet );
137 virtual BOOL FillItemSet( SfxItemSet &rSet );
138 virtual void Reset( const SfxItemSet &rSet );
139 virtual int DeactivatePage( SfxItemSet *pSet );
143 #endif