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 INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
21 #define INCLUDED_CUI_SOURCE_INC_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>
29 class SvxCropExample
: public vcl::Window
32 Point aTopLeft
, aBottomRight
;
36 SvxCropExample( vcl::Window
* pPar
, WinBits nStyle
);
38 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
39 virtual void Resize() SAL_OVERRIDE
;
40 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
42 void SetTopLeft( const Point
& rNew
) { aTopLeft
= rNew
; }
43 void SetTop( long nVal
) { aTopLeft
.X() = nVal
; }
44 void SetBottom( long nVal
) { aBottomRight
.X() = nVal
; }
45 void SetLeft( long nVal
) { aTopLeft
.Y() = nVal
; }
46 void SetRight( long nVal
) { aBottomRight
.Y() = nVal
; }
47 void SetBottomRight(const Point
& rNew
) { aBottomRight
= rNew
; }
48 void SetFrameSize( const Size
& rSz
);
49 void SetGraphic( const Graphic
& rGrf
) { aGrf
= rGrf
; }
50 const Graphic
& GetGraphic() const { return aGrf
; }
53 class SvxGrfCropPage
: public SfxTabPage
55 friend class VclPtr
<SvxGrfCropPage
>;
56 using Window::CalcZoom
;
57 using TabPage::ActivatePage
;
58 using TabPage::DeactivatePage
;
60 VclPtr
<VclContainer
> m_pCropFrame
;
61 VclPtr
<RadioButton
> m_pZoomConstRB
;
62 VclPtr
<RadioButton
> m_pSizeConstRB
;
63 VclPtr
<MetricField
> m_pLeftMF
;
64 VclPtr
<MetricField
> m_pRightMF
;
65 VclPtr
<MetricField
> m_pTopMF
;
66 VclPtr
<MetricField
> m_pBottomMF
;
68 VclPtr
<VclContainer
> m_pScaleFrame
;
69 VclPtr
<MetricField
> m_pWidthZoomMF
;
70 VclPtr
<MetricField
> m_pHeightZoomMF
;
72 VclPtr
<VclContainer
> m_pSizeFrame
;
73 VclPtr
<MetricField
> m_pWidthMF
;
74 VclPtr
<MetricField
> m_pHeightMF
;
76 VclPtr
<VclContainer
> m_pOrigSizeGrid
;
77 VclPtr
<FixedText
> m_pOrigSizeFT
;
78 VclPtr
<PushButton
> m_pOrigSizePB
;
81 VclPtr
<SvxCropExample
> m_pExampleWN
;
85 OUString aGraphicName
;
89 VclPtr
<MetricField
> pLastCropField
;
97 SvxGrfCropPage( vcl::Window
*pParent
, const SfxItemSet
&rSet
);
98 virtual ~SvxGrfCropPage();
99 virtual void dispose() SAL_OVERRIDE
;
101 DECL_LINK( ZoomHdl
, MetricField
* );
102 DECL_LINK( SizeHdl
, MetricField
* );
103 DECL_LINK( CropHdl
, const MetricField
* );
104 DECL_LINK( CropLoseFocusHdl
, MetricField
* );
105 DECL_LINK( CropModifyHdl
, MetricField
* );
106 DECL_LINK(OrigSizeHdl
, void *);
107 DECL_LINK_TYPED(Timeout
, Timer
*, void);
110 void CalcMinMaxBorder();
111 void GraphicHasChanged(bool bFound
);
112 virtual void ActivatePage(const SfxItemSet
& rSet
) SAL_OVERRIDE
;
114 Size
GetGrfOrigSize( const Graphic
& ) const;
116 static VclPtr
<SfxTabPage
> Create( vcl::Window
*pParent
, const SfxItemSet
*rSet
);
118 virtual bool FillItemSet( SfxItemSet
*rSet
) SAL_OVERRIDE
;
119 virtual void Reset( const SfxItemSet
*rSet
) SAL_OVERRIDE
;
120 virtual sfxpg
DeactivatePage( SfxItemSet
*pSet
) SAL_OVERRIDE
;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */