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 .
21 #include <svx/dlgctrl.hxx>
22 #include <svx/dialcontrol.hxx>
23 #include <svx/anchorid.hxx>
24 #include <basegfx/range/b2drange.hxx>
29 /*************************************************************************
31 |* Transform-Tab-Dialog
33 \************************************************************************/
35 struct SvxSwFrameValidation
;
36 class SvxTransformTabDialog
: public SfxTabDialogController
41 SvxAnchorIds nAnchorCtrls
;
42 Link
<SvxSwFrameValidation
&,void> aValidateLink
;
44 virtual void PageCreated(const OUString
& rId
, SfxTabPage
&rPage
) override
;
47 SvxTransformTabDialog(weld::Window
* pParent
, const SfxItemSet
* pAttr
,
49 SvxAnchorIds nAnchorTypes
);
51 //link for the Writer to validate positions
52 void SetValidateFramePosLink( const Link
<SvxSwFrameValidation
&,void>& rLink
);
55 /*************************************************************************
57 |* position and size tab page
59 \************************************************************************/
61 class SvxPositionSizeTabPage
: public SvxTabPage
63 static const WhichRangesContainer pPosSizeRanges
;
66 const SfxItemSet
& mrOutAttrs
;
68 const SdrView
* mpView
;
71 basegfx::B2DRange maRange
;
72 basegfx::B2DRange maWorkRange
;
73 basegfx::B2DPoint maAnchor
;
77 TriState mnProtectSizeState
;
79 bool mbProtectDisabled
;
81 bool mbAdjustDisabled
;
82 bool mbIgnoreAutoGrowWidth
;
83 bool mbIgnoreAutoGrowHeight
;
92 SvxRectCtl m_aCtlSize
;
95 std::unique_ptr
<weld::Widget
> m_xFlPosition
;
96 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosX
;
97 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosY
;
98 std::unique_ptr
<weld::CustomWeld
> m_xCtlPos
;
101 std::unique_ptr
<weld::Widget
> m_xFlSize
;
102 std::unique_ptr
<weld::Label
> m_xFtWidth
;
103 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrWidth
;
104 std::unique_ptr
<weld::Label
> m_xFtHeight
;
105 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrHeight
;
106 std::unique_ptr
<weld::CheckButton
> m_xCbxScale
;
107 std::unique_ptr
<weld::CustomWeld
> m_xCtlSize
;
110 std::unique_ptr
<weld::Widget
> m_xFlProtect
;
111 std::unique_ptr
<weld::CheckButton
> m_xTsbPosProtect
;
112 std::unique_ptr
<weld::CheckButton
> m_xTsbSizeProtect
;
115 std::unique_ptr
<weld::Widget
> m_xFlAdjust
;
116 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowWidth
;
117 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowHeight
;
119 DECL_LINK(ChangePosProtectHdl
, weld::Toggleable
&, void);
120 DECL_LINK(ChangeSizeProtectHdl
, weld::Toggleable
&, void);
122 void SetMinMaxPosition();
123 void GetTopLeftPosition(double& rfX
, double& rfY
, const basegfx::B2DRange
& rRange
);
125 DECL_LINK( ChangeWidthHdl
, weld::MetricSpinButton
&, void );
126 DECL_LINK( ChangeHeightHdl
, weld::MetricSpinButton
&, void );
127 DECL_LINK( ClickSizeProtectHdl
, weld::Toggleable
&, void );
128 DECL_LINK( ClickAutoHdl
, weld::Toggleable
&, void );
131 SvxPositionSizeTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
132 virtual ~SvxPositionSizeTabPage() override
;
134 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
135 static WhichRangesContainer
GetRanges() { return pPosSizeRanges
; }
137 virtual bool FillItemSet( SfxItemSet
* ) override
;
138 virtual void Reset( const SfxItemSet
* ) override
;
140 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
141 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
143 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
146 void SetView( const SdrView
* pSdrView
) { mpView
= pSdrView
; }
148 virtual void FillUserData() override
;
150 void DisableResize();
151 void DisableProtect();
153 void UpdateControlStates();
156 /*************************************************************************
158 |* rotation angle tab page
160 \************************************************************************/
161 class SvxAngleTabPage
: public SvxTabPage
163 static const WhichRangesContainer pAngleRanges
;
166 const SdrView
* pView
;
169 basegfx::B2DRange maRange
;
170 basegfx::B2DPoint maAnchor
;
175 SvxRectCtl m_aCtlRect
;
177 std::unique_ptr
<weld::Widget
> m_xFlPosition
;
178 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosX
;
179 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosY
;
180 std::unique_ptr
<weld::CustomWeld
> m_xCtlRect
;
181 std::unique_ptr
<weld::Widget
> m_xFlAngle
;
182 std::unique_ptr
<weld::MetricSpinButton
> m_xNfAngle
;
183 std::unique_ptr
<svx::DialControl
> m_xCtlAngle
;
184 std::unique_ptr
<weld::CustomWeld
> m_xCtlAngleWin
;
187 SvxAngleTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
188 virtual ~SvxAngleTabPage() override
;
190 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
191 static WhichRangesContainer
GetRanges() { return pAngleRanges
; }
193 virtual bool FillItemSet( SfxItemSet
* ) override
;
194 virtual void Reset( const SfxItemSet
* ) override
;
196 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
197 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
199 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
202 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
205 /*************************************************************************
207 |* slant/corner radius tab page
209 \************************************************************************/
210 class SvxSlantTabPage
: public SfxTabPage
212 static const WhichRangesContainer pSlantRanges
;
215 const SdrView
* pView
;
220 std::unique_ptr
<weld::Widget
> m_xFlRadius
;
221 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrRadius
;
222 std::unique_ptr
<weld::Widget
> m_xFlAngle
;
223 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrAngle
;
224 std::unique_ptr
<weld::Widget
> m_aControlGroups
[2];
225 std::unique_ptr
<weld::Widget
> m_aControlGroupX
[2];
226 std::unique_ptr
<weld::MetricSpinButton
> m_aControlX
[2];
227 std::unique_ptr
<weld::Widget
> m_aControlGroupY
[2];
228 std::unique_ptr
<weld::MetricSpinButton
> m_aControlY
[2];
231 SvxSlantTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
232 virtual ~SvxSlantTabPage() override
;
234 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
235 static WhichRangesContainer
GetRanges() { return pSlantRanges
; }
237 virtual bool FillItemSet( SfxItemSet
* ) override
;
238 virtual void Reset( const SfxItemSet
* ) override
;
240 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
241 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
244 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */