Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SVX_GRFPAGE_HXX
21 : #define _SVX_GRFPAGE_HXX
22 :
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>
28 :
29 :
30 : class SvxGrfCropPage : public SfxTabPage
31 : {
32 : using Window::CalcZoom;
33 : using TabPage::ActivatePage;
34 : using TabPage::DeactivatePage;
35 :
36 0 : class SvxCropExample : public Window
37 : {
38 : Size aFrameSize;
39 : Point aTopLeft, aBottomRight;
40 : Graphic aGrf;
41 :
42 : public:
43 : SvxCropExample( Window* pPar, const ResId& rResId );
44 :
45 : virtual void Paint( const Rectangle& rRect );
46 :
47 : void SetTopLeft( const Point& rNew ) { aTopLeft = rNew; }
48 0 : void SetTop( long nVal ) { aTopLeft.X() = nVal; }
49 0 : void SetBottom( long nVal ) { aBottomRight.X() = nVal; }
50 0 : void SetLeft( long nVal ) { aTopLeft.Y() = nVal; }
51 0 : void SetRight( long nVal) { aBottomRight.Y() = nVal; }
52 : void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; }
53 : void SetFrameSize( const Size& rSz );
54 0 : void SetGraphic( const Graphic& rGrf ) { aGrf = rGrf; }
55 : const Graphic& GetGraphic() const { return aGrf; }
56 : };
57 :
58 : FixedLine aCropFL;
59 : RadioButton aZoomConstRB;
60 : RadioButton aSizeConstRB;
61 : FixedText aLeftFT;
62 : MetricField aLeftMF;
63 : FixedText aRightFT;
64 : MetricField aRightMF;
65 : FixedText aTopFT;
66 : MetricField aTopMF;
67 : FixedText aBottomFT;
68 : MetricField aBottomMF;
69 :
70 : FixedLine aZoomFL;
71 : FixedText aWidthZoomFT;
72 : MetricField aWidthZoomMF;
73 : FixedText aHeightZoomFT;
74 : MetricField aHeightZoomMF;
75 :
76 : FixedLine aSizeFL;
77 : FixedText aWidthFT;
78 : MetricField aWidthMF;
79 : FixedText aHeightFT;
80 : MetricField aHeightMF;
81 : FixedText aOrigSizeFT;
82 : PushButton aOrigSizePB;
83 :
84 : // Example
85 : SvxCropExample aExampleWN;
86 :
87 :
88 : Timer aTimer;
89 : String aGraphicName;
90 : Size aOrigSize;
91 : Size aOrigPixelSize;
92 : Size aPageSize;
93 : const MetricField* pLastCropField;
94 : long nOldWidth;
95 : long nOldHeight;
96 : sal_Bool bReset;
97 : sal_Bool bInitialized;
98 : sal_Bool bSetOrigSize;
99 :
100 :
101 : SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet );
102 : virtual ~SvxGrfCropPage();
103 :
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 *);
111 :
112 : void CalcZoom();
113 : void CalcMinMaxBorder();
114 : void GraphicHasChanged(sal_Bool bFound);
115 : virtual void ActivatePage(const SfxItemSet& rSet);
116 :
117 : Size GetGrfOrigSize( const Graphic& ) const;
118 : public:
119 : static SfxTabPage *Create( Window *pParent, const SfxItemSet &rSet );
120 :
121 : virtual sal_Bool FillItemSet( SfxItemSet &rSet );
122 : virtual void Reset( const SfxItemSet &rSet );
123 : virtual int DeactivatePage( SfxItemSet *pSet );
124 : };
125 :
126 :
127 : #endif
128 :
129 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|