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 using TabPage::ActivatePage
;
65 using TabPage::DeactivatePage
;
66 static const sal_uInt16 pPosSizeRanges
[];
69 const SfxItemSet
& mrOutAttrs
;
71 const SdrView
* mpView
;
74 basegfx::B2DRange maRange
;
75 basegfx::B2DRange maWorkRange
;
76 basegfx::B2DPoint maAnchor
;
80 TriState mnProtectSizeState
;
82 bool mbProtectDisabled
;
84 bool mbAdjustDisabled
;
85 bool mbIgnoreAutoGrowWidth
;
86 bool mbIgnoreAutoGrowHeight
;
95 SvxRectCtl m_aCtlSize
;
98 std::unique_ptr
<weld::Widget
> m_xFlPosition
;
99 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosX
;
100 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosY
;
101 std::unique_ptr
<weld::CustomWeld
> m_xCtlPos
;
104 std::unique_ptr
<weld::Widget
> m_xFlSize
;
105 std::unique_ptr
<weld::Label
> m_xFtWidth
;
106 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrWidth
;
107 std::unique_ptr
<weld::Label
> m_xFtHeight
;
108 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrHeight
;
109 std::unique_ptr
<weld::CheckButton
> m_xCbxScale
;
110 std::unique_ptr
<weld::CustomWeld
> m_xCtlSize
;
113 std::unique_ptr
<weld::Widget
> m_xFlProtect
;
114 std::unique_ptr
<weld::CheckButton
> m_xTsbPosProtect
;
115 std::unique_ptr
<weld::CheckButton
> m_xTsbSizeProtect
;
118 std::unique_ptr
<weld::Widget
> m_xFlAdjust
;
119 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowWidth
;
120 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowHeight
;
122 DECL_LINK(ChangePosProtectHdl
, weld::ToggleButton
&, void);
123 DECL_LINK(ChangeSizeProtectHdl
, weld::ToggleButton
&, void);
125 void SetMinMaxPosition();
126 void GetTopLeftPosition(double& rfX
, double& rfY
, const basegfx::B2DRange
& rRange
);
128 DECL_LINK( ChangeWidthHdl
, weld::MetricSpinButton
&, void );
129 DECL_LINK( ChangeHeightHdl
, weld::MetricSpinButton
&, void );
130 DECL_LINK( ClickSizeProtectHdl
, weld::ToggleButton
&, void );
131 DECL_LINK( ClickAutoHdl
, weld::ToggleButton
&, void );
134 SvxPositionSizeTabPage(TabPageParent pParent
, const SfxItemSet
& rInAttrs
);
135 virtual ~SvxPositionSizeTabPage() override
;
137 static VclPtr
<SfxTabPage
> Create( TabPageParent
, const SfxItemSet
* );
138 static const sal_uInt16
* GetRanges() { return pPosSizeRanges
; }
140 virtual bool FillItemSet( SfxItemSet
* ) override
;
141 virtual void Reset( const SfxItemSet
* ) override
;
143 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
144 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
146 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
149 void SetView( const SdrView
* pSdrView
) { mpView
= pSdrView
; }
151 virtual void FillUserData() override
;
153 void DisableResize();
154 void DisableProtect();
156 void UpdateControlStates();
159 /*************************************************************************
161 |* rotation angle tab page
163 \************************************************************************/
164 class SvxAngleTabPage
: public SvxTabPage
166 using TabPage::ActivatePage
;
167 using TabPage::DeactivatePage
;
168 static const sal_uInt16 pAngleRanges
[];
171 const SfxItemSet
& rOutAttrs
;
172 const SdrView
* pView
;
175 basegfx::B2DRange maRange
;
176 basegfx::B2DPoint maAnchor
;
181 svx::SvxDialControl m_aCtlAngle
;
182 SvxRectCtl m_aCtlRect
;
184 std::unique_ptr
<weld::Widget
> m_xFlPosition
;
185 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosX
;
186 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosY
;
187 std::unique_ptr
<weld::CustomWeld
> m_xCtlRect
;
188 std::unique_ptr
<weld::Widget
> m_xFlAngle
;
189 std::unique_ptr
<weld::SpinButton
> m_xNfAngle
;
190 std::unique_ptr
<weld::CustomWeld
> m_xCtlAngle
;
193 SvxAngleTabPage(TabPageParent pParent
, const SfxItemSet
& rInAttrs
);
194 virtual ~SvxAngleTabPage() override
;
196 static VclPtr
<SfxTabPage
> Create( TabPageParent
, const SfxItemSet
* );
197 static const sal_uInt16
* GetRanges() { return pAngleRanges
; }
199 virtual bool FillItemSet( SfxItemSet
* ) override
;
200 virtual void Reset( const SfxItemSet
* ) override
;
202 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
203 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
205 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
208 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
211 /*************************************************************************
213 |* slant/corner radius tab page
215 \************************************************************************/
216 class SvxSlantTabPage
: public SfxTabPage
218 using TabPage::ActivatePage
;
219 using TabPage::DeactivatePage
;
220 static const sal_uInt16 pSlantRanges
[];
223 const SfxItemSet
& rOutAttrs
;
225 const SdrView
* pView
;
230 std::unique_ptr
<weld::Widget
> m_xFlRadius
;
231 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrRadius
;
232 std::unique_ptr
<weld::Widget
> m_xFlAngle
;
233 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrAngle
;
234 std::unique_ptr
<weld::Widget
> m_aControlGroups
[2];
235 std::unique_ptr
<weld::Widget
> m_aControlGroupX
[2];
236 std::unique_ptr
<weld::MetricSpinButton
> m_aControlX
[2];
237 std::unique_ptr
<weld::Widget
> m_aControlGroupY
[2];
238 std::unique_ptr
<weld::MetricSpinButton
> m_aControlY
[2];
241 SvxSlantTabPage(TabPageParent pParent
, const SfxItemSet
& rInAttrs
);
242 virtual ~SvxSlantTabPage() override
;
244 static VclPtr
<SfxTabPage
> Create( TabPageParent
, const SfxItemSet
* );
245 static const sal_uInt16
* GetRanges() { return pSlantRanges
; }
247 virtual bool FillItemSet( SfxItemSet
* ) override
;
248 virtual void Reset( const SfxItemSet
* ) override
;
250 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
251 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
254 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
258 #endif // INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX
260 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */