Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVX_GRFPAGE_HXX
30 : : #define _SVX_GRFPAGE_HXX
31 : :
32 : : #include <vcl/fixed.hxx>
33 : : #include <vcl/button.hxx>
34 : : #include <vcl/field.hxx>
35 : : #include <vcl/graph.hxx>
36 : : #include <sfx2/tabdlg.hxx>
37 : :
38 : :
39 : : class SvxGrfCropPage : public SfxTabPage
40 : : {
41 : : using Window::CalcZoom;
42 : : using TabPage::ActivatePage;
43 : : using TabPage::DeactivatePage;
44 : :
45 [ # # ][ # # ]: 0 : class SvxCropExample : public Window
46 : : {
47 : : Size aFrameSize;
48 : : Point aTopLeft, aBottomRight;
49 : : Graphic aGrf;
50 : :
51 : : public:
52 : : SvxCropExample( Window* pPar, const ResId& rResId );
53 : :
54 : : virtual void Paint( const Rectangle& rRect );
55 : :
56 : : void SetTopLeft( const Point& rNew ) { aTopLeft = rNew; }
57 : 0 : void SetTop( long nVal ) { aTopLeft.X() = nVal; }
58 : 0 : void SetBottom( long nVal ) { aBottomRight.X() = nVal; }
59 : 0 : void SetLeft( long nVal ) { aTopLeft.Y() = nVal; }
60 : 0 : void SetRight( long nVal) { aBottomRight.Y() = nVal; }
61 : : void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; }
62 : : void SetFrameSize( const Size& rSz );
63 : 0 : void SetGraphic( const Graphic& rGrf ) { aGrf = rGrf; }
64 : : const Graphic& GetGraphic() const { return aGrf; }
65 : : };
66 : :
67 : : FixedLine aCropFL;
68 : : RadioButton aZoomConstRB;
69 : : RadioButton aSizeConstRB;
70 : : FixedText aLeftFT;
71 : : MetricField aLeftMF;
72 : : FixedText aRightFT;
73 : : MetricField aRightMF;
74 : : FixedText aTopFT;
75 : : MetricField aTopMF;
76 : : FixedText aBottomFT;
77 : : MetricField aBottomMF;
78 : :
79 : : FixedLine aZoomFL;
80 : : FixedText aWidthZoomFT;
81 : : MetricField aWidthZoomMF;
82 : : FixedText aHeightZoomFT;
83 : : MetricField aHeightZoomMF;
84 : :
85 : : FixedLine aSizeFL;
86 : : FixedText aWidthFT;
87 : : MetricField aWidthMF;
88 : : FixedText aHeightFT;
89 : : MetricField aHeightMF;
90 : : FixedText aOrigSizeFT;
91 : : PushButton aOrigSizePB;
92 : :
93 : : // Example
94 : : SvxCropExample aExampleWN;
95 : :
96 : :
97 : : Timer aTimer;
98 : : String aGraphicName;
99 : : Size aOrigSize;
100 : : Size aOrigPixelSize;
101 : : Size aPageSize;
102 : : const MetricField* pLastCropField;
103 : : long nOldWidth;
104 : : long nOldHeight;
105 : : sal_Bool bReset;
106 : : sal_Bool bInitialized;
107 : : sal_Bool bSetOrigSize;
108 : :
109 : :
110 : : SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet );
111 : : virtual ~SvxGrfCropPage();
112 : :
113 : : DECL_LINK( ZoomHdl, MetricField * );
114 : : DECL_LINK( SizeHdl, MetricField * );
115 : : DECL_LINK( CropHdl, const MetricField * );
116 : : DECL_LINK( CropLoseFocusHdl, MetricField * );
117 : : DECL_LINK( CropModifyHdl, MetricField * );
118 : : DECL_LINK(OrigSizeHdl, void *);
119 : : DECL_LINK(Timeout, void *);
120 : :
121 : : void CalcZoom();
122 : : void CalcMinMaxBorder();
123 : : void GraphicHasChanged(sal_Bool bFound);
124 : : virtual void ActivatePage(const SfxItemSet& rSet);
125 : :
126 : : Size GetGrfOrigSize( const Graphic& ) const;
127 : : public:
128 : : static SfxTabPage *Create( Window *pParent, const SfxItemSet &rSet );
129 : :
130 : : virtual sal_Bool FillItemSet( SfxItemSet &rSet );
131 : : virtual void Reset( const SfxItemSet &rSet );
132 : : virtual int DeactivatePage( SfxItemSet *pSet );
133 : : };
134 : :
135 : :
136 : : #endif
137 : :
138 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|