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 INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
21 : #define INCLUDED_CUI_SOURCE_INC_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 0 : class SvxCropExample : public Window
30 : {
31 : Size aFrameSize;
32 : Point aTopLeft, aBottomRight;
33 : Graphic aGrf;
34 :
35 : public:
36 : SvxCropExample( Window* pPar, WinBits nStyle );
37 :
38 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
39 : virtual void Resize() SAL_OVERRIDE;
40 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
41 :
42 : void SetTopLeft( const Point& rNew ) { aTopLeft = rNew; }
43 0 : void SetTop( long nVal ) { aTopLeft.X() = nVal; }
44 0 : void SetBottom( long nVal ) { aBottomRight.X() = nVal; }
45 0 : void SetLeft( long nVal ) { aTopLeft.Y() = nVal; }
46 0 : void SetRight( long nVal) { aBottomRight.Y() = nVal; }
47 : void SetBottomRight(const Point& rNew ) { aBottomRight = rNew; }
48 : void SetFrameSize( const Size& rSz );
49 0 : void SetGraphic( const Graphic& rGrf ) { aGrf = rGrf; }
50 : const Graphic& GetGraphic() const { return aGrf; }
51 : };
52 :
53 : class SvxGrfCropPage : public SfxTabPage
54 : {
55 : using Window::CalcZoom;
56 : using TabPage::ActivatePage;
57 : using TabPage::DeactivatePage;
58 :
59 : VclContainer* m_pCropFrame;
60 : RadioButton* m_pZoomConstRB;
61 : RadioButton* m_pSizeConstRB;
62 : MetricField* m_pLeftMF;
63 : MetricField* m_pRightMF;
64 : MetricField* m_pTopMF;
65 : MetricField* m_pBottomMF;
66 :
67 : VclContainer* m_pScaleFrame;
68 : MetricField* m_pWidthZoomMF;
69 : MetricField* m_pHeightZoomMF;
70 :
71 : VclContainer* m_pSizeFrame;
72 : MetricField* m_pWidthMF;
73 : MetricField* m_pHeightMF;
74 :
75 : VclContainer* m_pOrigSizeGrid;
76 : FixedText* m_pOrigSizeFT;
77 : PushButton* m_pOrigSizePB;
78 :
79 : // Example
80 : SvxCropExample* m_pExampleWN;
81 :
82 :
83 : Timer aTimer;
84 : OUString aGraphicName;
85 : Size aOrigSize;
86 : Size aOrigPixelSize;
87 : Size aPageSize;
88 : const MetricField* pLastCropField;
89 : long nOldWidth;
90 : long nOldHeight;
91 : sal_Bool bReset;
92 : sal_Bool bInitialized;
93 : sal_Bool bSetOrigSize;
94 :
95 :
96 : SvxGrfCropPage( Window *pParent, const SfxItemSet &rSet );
97 : virtual ~SvxGrfCropPage();
98 :
99 : DECL_LINK( ZoomHdl, MetricField * );
100 : DECL_LINK( SizeHdl, MetricField * );
101 : DECL_LINK( CropHdl, const MetricField * );
102 : DECL_LINK( CropLoseFocusHdl, MetricField * );
103 : DECL_LINK( CropModifyHdl, MetricField * );
104 : DECL_LINK(OrigSizeHdl, void *);
105 : DECL_LINK(Timeout, void *);
106 :
107 : void CalcZoom();
108 : void CalcMinMaxBorder();
109 : void GraphicHasChanged(sal_Bool bFound);
110 : virtual void ActivatePage(const SfxItemSet& rSet) SAL_OVERRIDE;
111 :
112 : Size GetGrfOrigSize( const Graphic& ) const;
113 : public:
114 : static SfxTabPage *Create( Window *pParent, const SfxItemSet &rSet );
115 :
116 : virtual bool FillItemSet( SfxItemSet &rSet ) SAL_OVERRIDE;
117 : virtual void Reset( const SfxItemSet &rSet ) SAL_OVERRIDE;
118 : virtual int DeactivatePage( SfxItemSet *pSet ) SAL_OVERRIDE;
119 : };
120 :
121 :
122 : #endif
123 :
124 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|