Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / inc / grfpage.hxx
blobb1e9578c1aa5954fd3fd439f460f2022f930494f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
38 Size aFrameSize;
39 Point aTopLeft, aBottomRight;
40 Graphic aGrf;
42 public:
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; }
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;
70 FixedLine aZoomFL;
71 FixedText aWidthZoomFT;
72 MetricField aWidthZoomMF;
73 FixedText aHeightZoomFT;
74 MetricField aHeightZoomMF;
76 FixedLine aSizeFL;
77 FixedText aWidthFT;
78 MetricField aWidthMF;
79 FixedText aHeightFT;
80 MetricField aHeightMF;
81 FixedText aOrigSizeFT;
82 PushButton aOrigSizePB;
84 // Example
85 SvxCropExample aExampleWN;
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;
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 *);
112 void CalcZoom();
113 void CalcMinMaxBorder();
114 void GraphicHasChanged(sal_Bool bFound);
115 virtual void ActivatePage(const SfxItemSet& rSet);
117 Size GetGrfOrigSize( const Graphic& ) const;
118 public:
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 );
127 #endif
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */