1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SVX_GRFPAGE_HXX
21 #define _SVX_GRFPAGE_HXX
23 #include <vcl/fixed.hxx>
24 #include <vcl/button.hxx>
25 #include <vcl/field.hxx>
26 #include <vcl/graph.hxx>
27 #include <sfx2/tabdlg.hxx>
30 class SvxGrfCropPage
: public SfxTabPage
32 using Window::CalcZoom
;
33 using TabPage::ActivatePage
;
34 using TabPage::DeactivatePage
;
36 class SvxCropExample
: public Window
39 Point aTopLeft
, aBottomRight
;
43 SvxCropExample( Window
* pPar
, const ResId
& rResId
);
45 virtual void Paint( const Rectangle
& rRect
);
47 void SetTopLeft( const Point
& rNew
) { aTopLeft
= rNew
; }
48 void SetTop( long nVal
) { aTopLeft
.X() = nVal
; }
49 void SetBottom( long nVal
) { aBottomRight
.X() = nVal
; }
50 void SetLeft( long nVal
) { aTopLeft
.Y() = nVal
; }
51 void SetRight( long nVal
) { aBottomRight
.Y() = nVal
; }
52 void SetBottomRight(const Point
& rNew
) { aBottomRight
= rNew
; }
53 void SetFrameSize( const Size
& rSz
);
54 void SetGraphic( const Graphic
& rGrf
) { aGrf
= rGrf
; }
55 const Graphic
& GetGraphic() const { return aGrf
; }
59 RadioButton aZoomConstRB
;
60 RadioButton aSizeConstRB
;
68 MetricField aBottomMF
;
71 FixedText aWidthZoomFT
;
72 MetricField aWidthZoomMF
;
73 FixedText aHeightZoomFT
;
74 MetricField aHeightZoomMF
;
80 MetricField aHeightMF
;
81 FixedText aOrigSizeFT
;
82 PushButton aOrigSizePB
;
85 SvxCropExample aExampleWN
;
93 const MetricField
* pLastCropField
;
97 sal_Bool bInitialized
;
98 sal_Bool bSetOrigSize
;
101 SvxGrfCropPage( Window
*pParent
, const SfxItemSet
&rSet
);
102 virtual ~SvxGrfCropPage();
104 DECL_LINK( ZoomHdl
, MetricField
* );
105 DECL_LINK( SizeHdl
, MetricField
* );
106 DECL_LINK( CropHdl
, const MetricField
* );
107 DECL_LINK( CropLoseFocusHdl
, MetricField
* );
108 DECL_LINK( CropModifyHdl
, MetricField
* );
109 DECL_LINK(OrigSizeHdl
, void *);
110 DECL_LINK(Timeout
, void *);
113 void CalcMinMaxBorder();
114 void GraphicHasChanged(sal_Bool bFound
);
115 virtual void ActivatePage(const SfxItemSet
& rSet
);
117 Size
GetGrfOrigSize( const Graphic
& ) const;
119 static SfxTabPage
*Create( Window
*pParent
, const SfxItemSet
&rSet
);
121 virtual sal_Bool
FillItemSet( SfxItemSet
&rSet
);
122 virtual void Reset( const SfxItemSet
&rSet
);
123 virtual int DeactivatePage( SfxItemSet
*pSet
);
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */