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 .
19 #ifndef INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX
20 #define INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX
22 #include <svx/dlgctrl.hxx>
23 #include <svx/dialcontrol.hxx>
24 #include <svx/anchorid.hxx>
25 #include <basegfx/range/b2drange.hxx>
30 /*************************************************************************
32 |* Transform-Tab-Dialog
34 \************************************************************************/
36 struct SvxSwFrameValidation
;
37 class SvxTransformTabDialog
: public SfxTabDialogController
42 SvxAnchorIds nAnchorCtrls
;
43 Link
<SvxSwFrameValidation
&,void> aValidateLink
;
45 virtual void PageCreated(const OString
& rId
, SfxTabPage
&rPage
) override
;
48 SvxTransformTabDialog(weld::Window
* pParent
, const SfxItemSet
* pAttr
,
50 SvxAnchorIds nAnchorTypes
);
52 //link for the Writer to validate positions
53 void SetValidateFramePosLink( const Link
<SvxSwFrameValidation
&,void>& rLink
);
56 /*************************************************************************
58 |* position and size tab page
60 \************************************************************************/
62 class SvxPositionSizeTabPage
: public SvxTabPage
64 static const sal_uInt16 pPosSizeRanges
[];
67 const SfxItemSet
& mrOutAttrs
;
69 const SdrView
* mpView
;
72 basegfx::B2DRange maRange
;
73 basegfx::B2DRange maWorkRange
;
74 basegfx::B2DPoint maAnchor
;
78 TriState mnProtectSizeState
;
80 bool mbProtectDisabled
;
82 bool mbAdjustDisabled
;
83 bool mbIgnoreAutoGrowWidth
;
84 bool mbIgnoreAutoGrowHeight
;
93 SvxRectCtl m_aCtlSize
;
96 std::unique_ptr
<weld::Widget
> m_xFlPosition
;
97 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosX
;
98 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosY
;
99 std::unique_ptr
<weld::CustomWeld
> m_xCtlPos
;
102 std::unique_ptr
<weld::Widget
> m_xFlSize
;
103 std::unique_ptr
<weld::Label
> m_xFtWidth
;
104 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrWidth
;
105 std::unique_ptr
<weld::Label
> m_xFtHeight
;
106 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrHeight
;
107 std::unique_ptr
<weld::CheckButton
> m_xCbxScale
;
108 std::unique_ptr
<weld::CustomWeld
> m_xCtlSize
;
111 std::unique_ptr
<weld::Widget
> m_xFlProtect
;
112 std::unique_ptr
<weld::CheckButton
> m_xTsbPosProtect
;
113 std::unique_ptr
<weld::CheckButton
> m_xTsbSizeProtect
;
116 std::unique_ptr
<weld::Widget
> m_xFlAdjust
;
117 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowWidth
;
118 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowHeight
;
120 DECL_LINK(ChangePosProtectHdl
, weld::ToggleButton
&, void);
121 DECL_LINK(ChangeSizeProtectHdl
, weld::ToggleButton
&, void);
123 void SetMinMaxPosition();
124 void GetTopLeftPosition(double& rfX
, double& rfY
, const basegfx::B2DRange
& rRange
);
126 DECL_LINK( ChangeWidthHdl
, weld::MetricSpinButton
&, void );
127 DECL_LINK( ChangeHeightHdl
, weld::MetricSpinButton
&, void );
128 DECL_LINK( ClickSizeProtectHdl
, weld::ToggleButton
&, void );
129 DECL_LINK( ClickAutoHdl
, weld::ToggleButton
&, void );
132 SvxPositionSizeTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
133 virtual ~SvxPositionSizeTabPage() override
;
135 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
136 static const sal_uInt16
* GetRanges() { return pPosSizeRanges
; }
138 virtual bool FillItemSet( SfxItemSet
* ) override
;
139 virtual void Reset( const SfxItemSet
* ) override
;
141 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
142 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
144 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
147 void SetView( const SdrView
* pSdrView
) { mpView
= pSdrView
; }
149 virtual void FillUserData() override
;
151 void DisableResize();
152 void DisableProtect();
154 void UpdateControlStates();
157 /*************************************************************************
159 |* rotation angle tab page
161 \************************************************************************/
162 class SvxAngleTabPage
: public SvxTabPage
164 static const sal_uInt16 pAngleRanges
[];
167 const SfxItemSet
& rOutAttrs
;
168 const SdrView
* pView
;
171 basegfx::B2DRange maRange
;
172 basegfx::B2DPoint maAnchor
;
177 svx::SvxDialControl m_aCtlAngle
;
178 SvxRectCtl m_aCtlRect
;
180 std::unique_ptr
<weld::Widget
> m_xFlPosition
;
181 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosX
;
182 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosY
;
183 std::unique_ptr
<weld::CustomWeld
> m_xCtlRect
;
184 std::unique_ptr
<weld::Widget
> m_xFlAngle
;
185 std::unique_ptr
<weld::SpinButton
> m_xNfAngle
;
186 std::unique_ptr
<weld::CustomWeld
> m_xCtlAngle
;
189 SvxAngleTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
190 virtual ~SvxAngleTabPage() override
;
192 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
193 static const sal_uInt16
* GetRanges() { return pAngleRanges
; }
195 virtual bool FillItemSet( SfxItemSet
* ) override
;
196 virtual void Reset( const SfxItemSet
* ) override
;
198 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
199 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
201 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
204 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
207 /*************************************************************************
209 |* slant/corner radius tab page
211 \************************************************************************/
212 class SvxSlantTabPage
: public SfxTabPage
214 static const sal_uInt16 pSlantRanges
[];
217 const SfxItemSet
& rOutAttrs
;
219 const SdrView
* pView
;
224 std::unique_ptr
<weld::Widget
> m_xFlRadius
;
225 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrRadius
;
226 std::unique_ptr
<weld::Widget
> m_xFlAngle
;
227 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrAngle
;
228 std::unique_ptr
<weld::Widget
> m_aControlGroups
[2];
229 std::unique_ptr
<weld::Widget
> m_aControlGroupX
[2];
230 std::unique_ptr
<weld::MetricSpinButton
> m_aControlX
[2];
231 std::unique_ptr
<weld::Widget
> m_aControlGroupY
[2];
232 std::unique_ptr
<weld::MetricSpinButton
> m_aControlY
[2];
235 SvxSlantTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
236 virtual ~SvxSlantTabPage() override
;
238 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
239 static const sal_uInt16
* GetRanges() { return pSlantRanges
; }
241 virtual bool FillItemSet( SfxItemSet
* ) override
;
242 virtual void Reset( const SfxItemSet
* ) override
;
244 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
245 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
248 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
252 #endif // INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX
254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */