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/dlgutil.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 OUString
& 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 WhichRangesContainer 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
;
95 SvxRatioConnector m_aRatioTop
;
96 SvxRatioConnector m_aRatioBottom
;
99 std::unique_ptr
<weld::Widget
> m_xFlPosition
;
100 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosX
;
101 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrPosY
;
102 std::unique_ptr
<weld::CustomWeld
> m_xCtlPos
;
105 std::unique_ptr
<weld::Widget
> m_xFlSize
;
106 std::unique_ptr
<weld::Label
> m_xFtWidth
;
107 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrWidth
;
108 std::unique_ptr
<weld::Label
> m_xFtHeight
;
109 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrHeight
;
110 std::unique_ptr
<weld::CheckButton
> m_xCbxScale
;
111 std::unique_ptr
<weld::Image
> m_xCbxScaleImg
;
112 std::unique_ptr
<weld::CustomWeld
> m_xImgRatioTop
;
113 std::unique_ptr
<weld::CustomWeld
> m_xImgRatioBottom
;
114 std::unique_ptr
<weld::CustomWeld
> m_xCtlSize
;
117 std::unique_ptr
<weld::Widget
> m_xFlProtect
;
118 std::unique_ptr
<weld::CheckButton
> m_xTsbPosProtect
;
119 std::unique_ptr
<weld::CheckButton
> m_xTsbSizeProtect
;
122 std::unique_ptr
<weld::Widget
> m_xFlAdjust
;
123 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowWidth
;
124 std::unique_ptr
<weld::CheckButton
> m_xTsbAutoGrowHeight
;
126 DECL_LINK(ChangePosProtectHdl
, weld::Toggleable
&, void);
127 DECL_LINK(ChangeSizeProtectHdl
, weld::Toggleable
&, void);
129 void SetMinMaxPosition();
130 void GetTopLeftPosition(double& rfX
, double& rfY
, const basegfx::B2DRange
& rRange
);
132 DECL_LINK( ChangeWidthHdl
, weld::MetricSpinButton
&, void );
133 DECL_LINK( ChangeHeightHdl
, weld::MetricSpinButton
&, void );
134 DECL_LINK( ClickSizeProtectHdl
, weld::Toggleable
&, void );
135 DECL_LINK( ClickAutoHdl
, weld::Toggleable
&, void );
138 SvxPositionSizeTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
139 virtual ~SvxPositionSizeTabPage() override
;
141 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
142 static const WhichRangesContainer
& GetRanges() { return pPosSizeRanges
; }
144 virtual bool FillItemSet( SfxItemSet
* ) override
;
145 virtual void Reset( const SfxItemSet
* ) override
;
147 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
148 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
150 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
153 void SetView( const SdrView
* pSdrView
) { mpView
= pSdrView
; }
155 virtual void FillUserData() override
;
157 void DisableResize();
158 void DisableProtect();
160 void UpdateControlStates();
163 /*************************************************************************
165 |* rotation angle tab page
167 \************************************************************************/
168 class SvxAngleTabPage
: public SvxTabPage
170 static const WhichRangesContainer pAngleRanges
;
173 const SdrView
* pView
;
176 basegfx::B2DRange maRange
;
177 basegfx::B2DPoint maAnchor
;
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::MetricSpinButton
> m_xNfAngle
;
190 std::unique_ptr
<svx::DialControl
> m_xCtlAngle
;
191 std::unique_ptr
<weld::CustomWeld
> m_xCtlAngleWin
;
194 SvxAngleTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
195 virtual ~SvxAngleTabPage() override
;
197 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
198 static const WhichRangesContainer
& GetRanges() { return pAngleRanges
; }
200 virtual bool FillItemSet( SfxItemSet
* ) override
;
201 virtual void Reset( const SfxItemSet
* ) override
;
203 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
204 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
206 virtual void PointChanged(weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
209 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
212 /*************************************************************************
214 |* slant/corner radius tab page
216 \************************************************************************/
217 class SvxSlantTabPage
: public SfxTabPage
219 static const WhichRangesContainer pSlantRanges
;
222 const SdrView
* pView
;
227 std::unique_ptr
<weld::Widget
> m_xFlRadius
;
228 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrRadius
;
229 std::unique_ptr
<weld::Widget
> m_xFlAngle
;
230 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrAngle
;
231 std::unique_ptr
<weld::Widget
> m_aControlGroups
[2];
232 std::unique_ptr
<weld::Widget
> m_aControlGroupX
[2];
233 std::unique_ptr
<weld::MetricSpinButton
> m_aControlX
[2];
234 std::unique_ptr
<weld::Widget
> m_aControlGroupY
[2];
235 std::unique_ptr
<weld::MetricSpinButton
> m_aControlY
[2];
238 SvxSlantTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
239 virtual ~SvxSlantTabPage() override
;
241 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
242 static const WhichRangesContainer
& GetRanges() { return pSlantRanges
; }
244 virtual bool FillItemSet( SfxItemSet
* ) override
;
245 virtual void Reset( const SfxItemSet
* ) override
;
247 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
248 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
251 void SetView( const SdrView
* pSdrView
) { pView
= pSdrView
; }
255 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */