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_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX
21 #define INCLUDED_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX
23 #include <sfx2/tabdlg.hxx>
24 #include <svx/dialcontrol.hxx>
25 #include <svx/dlgutil.hxx>
26 #include <svx/frmdirlbox.hxx>
27 #include <svx/swframeexample.hxx>
28 #include <swtypes.hxx>
30 #include "prcntfld.hxx"
32 namespace sfx2
{class FileDialogHelper
;}
35 // OD 12.11.2003 #i22341#
38 /// This is the Position & Size tab page of the Insert -> Frame -> Frame dialog.
39 class SwFramePage final
: public SfxTabPage
41 bool m_bAtHorzPosModified
;
42 bool m_bAtVertPosModified
;
47 bool m_bIgnoreFixedRatio
= false;
48 bool m_bIsVerticalFrame
; //current frame is in vertical environment - strings are exchanged
50 bool m_bIsVerticalL2R
;
51 bool m_bIsInRightToLeft
; // current frame is in right-to-left environment - strings are exchanged
53 sal_uInt16 m_nHtmlMode
;
56 SwTwips m_nUpperBorder
;
57 SwTwips m_nLowerBorder
;
58 double m_fWidthHeightRatio
; //width-to-height ratio to support the KeepRatio button
60 // OD 12.11.2003 #i22341# - keep content position of character for
61 // to character anchored objects.
62 const SwFormatAnchor
* mpToCharContentPos
;
70 FrameMap
const * m_pVMap
;
71 FrameMap
const * m_pHMap
;
73 bool m_bAllowVertPositioning
;
75 bool m_bIsMathBaselineAlignment
;
77 SwFrameExample m_aExampleWN
;
79 SvxRatioConnector m_aRatioTop
;
80 SvxRatioConnector m_aRatioBottom
;
83 std::unique_ptr
<weld::Label
> m_xWidthFT
;
84 std::unique_ptr
<weld::Label
> m_xWidthAutoFT
;
85 std::unique_ptr
<weld::CheckButton
> m_xRelWidthCB
;
86 std::unique_ptr
<weld::ComboBox
> m_xRelWidthRelationLB
;
87 std::unique_ptr
<weld::CheckButton
> m_xAutoWidthCB
;
89 std::unique_ptr
<weld::Label
> m_xHeightFT
;
90 std::unique_ptr
<weld::Label
> m_xHeightAutoFT
;
91 std::unique_ptr
<weld::CheckButton
> m_xRelHeightCB
;
92 std::unique_ptr
<weld::ComboBox
> m_xRelHeightRelationLB
;
93 std::unique_ptr
<weld::CheckButton
> m_xAutoHeightCB
;
95 std::unique_ptr
<weld::CheckButton
> m_xFixedRatioCB
;
96 std::unique_ptr
<weld::Image
> m_xCbxScaleImg
;
97 std::unique_ptr
<weld::CustomWeld
> m_xImgRatioTop
;
98 std::unique_ptr
<weld::CustomWeld
> m_xImgRatioBottom
;
100 std::unique_ptr
<weld::Button
> m_xRealSizeBT
;
103 std::unique_ptr
<weld::Widget
> m_xProtectFrame
;
104 std::unique_ptr
<weld::CheckButton
> m_xProtectContentCB
;
105 std::unique_ptr
<weld::CheckButton
> m_xProtectFrameCB
;
106 std::unique_ptr
<weld::CheckButton
> m_xProtectSizeCB
;
109 std::unique_ptr
<weld::Widget
> m_xAnchorFrame
;
110 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtPageRB
;
111 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtParaRB
;
112 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtCharRB
;
113 std::unique_ptr
<weld::RadioButton
> m_xAnchorAsCharRB
;
114 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtFrameRB
;
117 std::unique_ptr
<weld::Label
> m_xHorizontalFT
;
118 std::unique_ptr
<weld::ComboBox
> m_xHorizontalDLB
;
119 std::unique_ptr
<weld::Label
> m_xAtHorzPosFT
;
120 std::unique_ptr
<weld::MetricSpinButton
> m_xAtHorzPosED
;
121 std::unique_ptr
<weld::Label
> m_xHoriRelationFT
;
122 std::unique_ptr
<weld::ComboBox
> m_xHoriRelationLB
;
124 std::unique_ptr
<weld::CheckButton
> m_xMirrorPagesCB
;
126 std::unique_ptr
<weld::Label
> m_xVerticalFT
;
127 std::unique_ptr
<weld::ComboBox
> m_xVerticalDLB
;
128 std::unique_ptr
<weld::Label
> m_xAtVertPosFT
;
129 std::unique_ptr
<weld::MetricSpinButton
> m_xAtVertPosED
;
130 std::unique_ptr
<weld::Label
> m_xVertRelationFT
;
131 std::unique_ptr
<weld::ComboBox
> m_xVertRelationLB
;
132 // #i18732# - check box for new option 'FollowTextFlow'
133 std::unique_ptr
<weld::CheckButton
> m_xFollowTextFlowCB
;
134 std::unique_ptr
<weld::CheckButton
> m_xFlySplitCB
;
137 std::unique_ptr
<weld::CustomWeld
> m_xExampleWN
;
139 std::unique_ptr
<SwPercentField
> m_xWidthED
;
140 std::unique_ptr
<SwPercentField
> m_xHeightED
;
142 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
143 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
145 DECL_LINK(RangeModifyClickHdl
, weld::Toggleable
&, void);
146 void RangeModifyHdl();
147 DECL_LINK(AnchorTypeHdl
, weld::Toggleable
&, void);
148 DECL_LINK(PosHdl
, weld::ComboBox
&, void);
149 DECL_LINK(RelHdl
, weld::ComboBox
&, void);
150 void InitPos(RndStdIds eId
, sal_Int16 nH
, sal_Int16 nHRel
,
151 sal_Int16 nV
, sal_Int16 nVRel
,
152 tools::Long nX
, tools::Long nY
);
154 DECL_LINK(RealSizeHdl
, weld::Button
&, void);
155 DECL_LINK(RelSizeClickHdl
, weld::Toggleable
&, void);
156 DECL_LINK(MirrorHdl
, weld::Toggleable
&, void);
158 DECL_LINK(AutoWidthClickHdl
, weld::Toggleable
&, void);
159 DECL_LINK(AutoHeightClickHdl
, weld::Toggleable
&, void);
160 DECL_LINK(RatioClickHdl
, weld::Toggleable
&, void);
163 void UpdateExample();
164 DECL_LINK(ModifyHdl
, weld::MetricSpinButton
&, void);
166 void Init(const SfxItemSet
& rSet
);
167 // OD 12.11.2003 #i22341# - adjustment to handle maps, that are ambiguous
169 sal_Int32
FillPosLB( const FrameMap
* _pMap
,
170 const sal_Int16 _nAlign
,
171 const sal_Int16 _nRel
,
172 weld::ComboBox
& _rLB
);
173 // OD 14.11.2003 #i22341# - adjustment to handle maps, that are ambiguous
174 // in their string entries.
175 void FillRelLB( const FrameMap
* _pMap
,
176 const sal_uInt16 _nLBSelPos
,
177 const sal_Int16 _nAlign
,
178 const sal_Int16 _nRel
,
179 weld::ComboBox
& _rLB
,
181 static sal_Int32
GetMapPos(const FrameMap
*pMap
, const weld::ComboBox
& rAlignLB
);
182 static sal_Int16
GetAlignment(FrameMap
const *pMap
, sal_Int32 nMapPos
, const weld::ComboBox
& rRelationLB
);
183 static sal_Int16
GetRelation(const weld::ComboBox
& rRelationLB
);
184 RndStdIds
GetAnchor() const;
186 void setOptimalFrameWidth();
187 void setOptimalRelWidth();
189 void EnableGraficMode(); // hides auto check boxes and re-org controls for "Real Size" button
191 SwWrtShell
*getFrameDlgParentShell();
193 static const WhichRangesContainer s_aPageRg
;
196 SwFramePage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
197 virtual ~SwFramePage() override
;
199 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
200 static const WhichRangesContainer
& GetRanges() { return s_aPageRg
; }
202 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
203 virtual void Reset(const SfxItemSet
*rSet
) override
;
205 void SetNewFrame(bool bNewFrame
) { m_bNew
= bNewFrame
; }
206 void SetFormatUsed(bool bFormat
);
207 void SetFrameType(const OUString
&rType
) { m_sDlgType
= rType
; }
208 bool IsInGraficMode() const { return m_sDlgType
== "PictureDialog" || m_sDlgType
== "ObjectDialog"; }
209 void EnableVerticalPositioning( bool bEnable
);
212 /// Tabpage providing the functionality behind Format -> Image -> Properties and then the Rotation
214 class SwGrfExtPage final
: public SfxTabPage
216 OUString m_aFilterName
;
217 OUString m_aGrfName
, m_aNewGrfName
;
219 std::unique_ptr
<::sfx2::FileDialogHelper
> m_xGrfDlg
;
225 std::unique_ptr
<weld::Widget
> m_xMirror
;
226 std::unique_ptr
<weld::CheckButton
> m_xMirrorVertBox
;
227 std::unique_ptr
<weld::CheckButton
> m_xMirrorHorzBox
;
228 std::unique_ptr
<weld::RadioButton
> m_xAllPagesRB
;
229 std::unique_ptr
<weld::RadioButton
> m_xLeftPagesRB
;
230 std::unique_ptr
<weld::RadioButton
> m_xRightPagesRB
;
232 std::unique_ptr
<weld::Entry
> m_xConnectED
;
233 std::unique_ptr
<weld::Button
> m_xBrowseBT
;
234 std::unique_ptr
<weld::Frame
> m_xLinkFrame
;
236 // RotGrfFlyFrame: Need Angle and RotateControls now
237 std::unique_ptr
<weld::Frame
> m_xFlAngle
;
238 std::unique_ptr
<weld::MetricSpinButton
> m_xNfAngle
;
239 std::unique_ptr
<svx::DialControl
> m_xCtlAngle
;
240 std::unique_ptr
<weld::CustomWeld
> m_xCtlAngleWin
;
241 std::unique_ptr
<weld::CustomWeld
> m_xBmpWin
;
243 // tdf#138843 add place holder for the graphic type
244 std::unique_ptr
<weld::Label
> m_xLabelGraphicType
;
246 // handler for mirroring
247 DECL_LINK(MirrorHdl
, weld::Toggleable
&, void);
248 DECL_LINK(BrowseHdl
, weld::Button
&, void);
250 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
253 SwGrfExtPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
254 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
255 virtual ~SwGrfExtPage() override
;
257 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
258 virtual void Reset(const SfxItemSet
*rSet
) override
;
259 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
262 class SwFrameURLPage final
: public SfxTabPage
265 std::unique_ptr
<weld::Entry
> m_xURLED
;
266 std::unique_ptr
<weld::Button
> m_xSearchPB
;
267 std::unique_ptr
<weld::Entry
> m_xNameED
;
268 std::unique_ptr
<weld::ComboBox
> m_xFrameCB
;
271 std::unique_ptr
<weld::CheckButton
> m_xServerCB
;
272 std::unique_ptr
<weld::CheckButton
> m_xClientCB
;
274 DECL_LINK(InsertFileHdl
, weld::Button
&, void);
277 SwFrameURLPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
278 virtual ~SwFrameURLPage() override
;
280 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
282 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
283 virtual void Reset(const SfxItemSet
*rSet
) override
;
286 class SwFrameAddPage final
: public SfxTabPage
288 SwWrtShell
* m_pWrtSh
;
295 std::unique_ptr
<weld::Widget
> m_xNameFrame
;
296 std::unique_ptr
<weld::Label
> m_xNameFT
;
297 std::unique_ptr
<weld::Entry
> m_xNameED
;
298 std::unique_ptr
<weld::Label
> m_xAltNameFT
;
299 std::unique_ptr
<weld::Entry
> m_xAltNameED
;
300 std::unique_ptr
<weld::Label
> m_xDescriptionFT
;
301 std::unique_ptr
<weld::TextView
> m_xDescriptionED
;
302 std::unique_ptr
<weld::CheckButton
> m_xDecorativeCB
;
303 std::unique_ptr
<weld::Widget
> m_xSequenceFrame
;
304 std::unique_ptr
<weld::ComboBox
> m_xPrevLB
;
305 std::unique_ptr
<weld::ComboBox
> m_xNextLB
;
307 std::unique_ptr
<weld::Widget
> m_xContentAlignFrame
;
308 std::unique_ptr
<weld::ComboBox
> m_xVertAlignLB
;
310 std::unique_ptr
<weld::Widget
> m_xPropertiesFrame
;
311 std::unique_ptr
<weld::CheckButton
> m_xEditInReadonlyCB
;
312 std::unique_ptr
<weld::CheckButton
> m_xPrintFrameCB
;
313 std::unique_ptr
<weld::Label
> m_xTextFlowFT
;
314 std::unique_ptr
<svx::FrameDirectionListBox
> m_xTextFlowLB
;
316 DECL_LINK(EditModifyHdl
, weld::Entry
&, void);
317 DECL_LINK(DecorativeHdl
, weld::Toggleable
&, void);
318 DECL_LINK(ChainModifyHdl
, weld::ComboBox
&, void);
320 static const WhichRangesContainer s_aAddPgRg
;
323 SwFrameAddPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
324 virtual ~SwFrameAddPage() override
;
326 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
327 static const WhichRangesContainer
& GetRanges() { return s_aAddPgRg
; }
329 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
330 virtual void Reset(const SfxItemSet
*rSet
) override
;
332 void SetFormatUsed(bool bFormat
);
333 void SetFrameType(const OUString
&rType
) { m_sDlgType
= rType
; }
334 void SetNewFrame(bool bNewFrame
) { m_bNew
= bNewFrame
; }
335 void SetShell(SwWrtShell
* pSh
) { m_pWrtSh
= pSh
; }
339 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX
341 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */