1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: grfpage.hxx,v $
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>
37 #ifndef _BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
40 #ifndef _FIELD_HXX //autogen
41 #include <vcl/field.hxx>
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
56 Point aTopLeft
, aBottomRight
;
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
; }
76 RadioButton aZoomConstRB
;
77 RadioButton aSizeConstRB
;
85 MetricField aBottomMF
;
88 FixedText aWidthZoomFT
;
89 MetricField aWidthZoomMF
;
90 FixedText aHeightZoomFT
;
91 MetricField aHeightZoomMF
;
97 MetricField aHeightMF
;
98 FixedText aOrigSizeFT
;
99 PushButton aOrigSizePB
;
102 SvxCropExample aExampleWN
;
109 const MetricField
* pLastCropField
;
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
* );
129 void CalcMinMaxBorder();
130 void GraphicHasChanged(BOOL bFound
);
131 virtual void ActivatePage(const SfxItemSet
& rSet
);
133 Size
GetGrfOrigSize( const Graphic
& ) const;
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
);