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/frmdirlbox.hxx>
26 #include <svx/swframeexample.hxx>
27 #include <swtypes.hxx>
29 #include "prcntfld.hxx"
31 namespace sfx2
{class FileDialogHelper
;}
34 // OD 12.11.2003 #i22341#
38 class SwFramePage
: public SfxTabPage
40 bool m_bAtHorzPosModified
;
41 bool m_bAtVertPosModified
;
46 bool m_bIsVerticalFrame
; //current frame is in vertical environment - strings are exchanged
48 bool m_bIsVerticalL2R
;
49 bool m_bIsInRightToLeft
; // current frame is in right-to-left environment - strings are exchanged
51 sal_uInt16 m_nHtmlMode
;
54 SwTwips m_nUpperBorder
;
55 SwTwips m_nLowerBorder
;
56 double m_fWidthHeightRatio
; //width-to-height ratio to support the KeepRatio button
58 // OD 12.11.2003 #i22341# - keep content position of character for
59 // to character anchored objects.
60 const SwPosition
* mpToCharContentPos
;
68 FrameMap
const * m_pVMap
;
69 FrameMap
const * m_pHMap
;
71 bool m_bAllowVertPositioning
;
73 bool m_bIsMathBaselineAlignment
;
75 SwFrameExample m_aExampleWN
;
78 std::unique_ptr
<weld::Label
> m_xWidthFT
;
79 std::unique_ptr
<weld::Label
> m_xWidthAutoFT
;
80 std::unique_ptr
<weld::CheckButton
> m_xRelWidthCB
;
81 std::unique_ptr
<weld::ComboBox
> m_xRelWidthRelationLB
;
82 std::unique_ptr
<weld::CheckButton
> m_xAutoWidthCB
;
84 std::unique_ptr
<weld::Label
> m_xHeightFT
;
85 std::unique_ptr
<weld::Label
> m_xHeightAutoFT
;
86 std::unique_ptr
<weld::CheckButton
> m_xRelHeightCB
;
87 std::unique_ptr
<weld::ComboBox
> m_xRelHeightRelationLB
;
88 std::unique_ptr
<weld::CheckButton
> m_xAutoHeightCB
;
90 std::unique_ptr
<weld::CheckButton
> m_xFixedRatioCB
;
91 std::unique_ptr
<weld::Button
> m_xRealSizeBT
;
94 std::unique_ptr
<weld::Widget
> m_xAnchorFrame
;
95 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtPageRB
;
96 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtParaRB
;
97 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtCharRB
;
98 std::unique_ptr
<weld::RadioButton
> m_xAnchorAsCharRB
;
99 std::unique_ptr
<weld::RadioButton
> m_xAnchorAtFrameRB
;
102 std::unique_ptr
<weld::Label
> m_xHorizontalFT
;
103 std::unique_ptr
<weld::ComboBox
> m_xHorizontalDLB
;
104 std::unique_ptr
<weld::Label
> m_xAtHorzPosFT
;
105 std::unique_ptr
<weld::MetricSpinButton
> m_xAtHorzPosED
;
106 std::unique_ptr
<weld::Label
> m_xHoriRelationFT
;
107 std::unique_ptr
<weld::ComboBox
> m_xHoriRelationLB
;
109 std::unique_ptr
<weld::CheckButton
> m_xMirrorPagesCB
;
111 std::unique_ptr
<weld::Label
> m_xVerticalFT
;
112 std::unique_ptr
<weld::ComboBox
> m_xVerticalDLB
;
113 std::unique_ptr
<weld::Label
> m_xAtVertPosFT
;
114 std::unique_ptr
<weld::MetricSpinButton
> m_xAtVertPosED
;
115 std::unique_ptr
<weld::Label
> m_xVertRelationFT
;
116 std::unique_ptr
<weld::ComboBox
> m_xVertRelationLB
;
117 // #i18732# - check box for new option 'FollowTextFlow'
118 std::unique_ptr
<weld::CheckButton
> m_xFollowTextFlowCB
;
121 std::unique_ptr
<weld::CustomWeld
> m_xExampleWN
;
123 std::unique_ptr
<SwPercentField
> m_xWidthED
;
124 std::unique_ptr
<SwPercentField
> m_xHeightED
;
126 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
127 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
129 DECL_LINK(RangeModifyClickHdl
, weld::ToggleButton
&, void);
130 void RangeModifyHdl();
131 DECL_LINK(AnchorTypeHdl
, weld::ToggleButton
&, void);
132 DECL_LINK(PosHdl
, weld::ComboBox
&, void);
133 DECL_LINK(RelHdl
, weld::ComboBox
&, void);
134 void InitPos(RndStdIds eId
, sal_Int16 nH
, sal_Int16 nHRel
,
135 sal_Int16 nV
, sal_Int16 nVRel
,
136 tools::Long nX
, tools::Long nY
);
138 DECL_LINK(RealSizeHdl
, weld::Button
&, void);
139 DECL_LINK(RelSizeClickHdl
, weld::ToggleButton
&, void);
140 DECL_LINK(MirrorHdl
, weld::ToggleButton
&, void);
142 DECL_LINK(AutoWidthClickHdl
, weld::ToggleButton
&, void);
143 DECL_LINK(AutoHeightClickHdl
, weld::ToggleButton
&, void);
146 void UpdateExample();
147 DECL_LINK(ModifyHdl
, weld::MetricSpinButton
&, void);
149 void Init(const SfxItemSet
& rSet
);
150 // OD 12.11.2003 #i22341# - adjustment to handle maps, that are ambiguous
152 sal_Int32
FillPosLB( const FrameMap
* _pMap
,
153 const sal_Int16 _nAlign
,
154 const sal_Int16 _nRel
,
155 weld::ComboBox
& _rLB
);
156 // OD 14.11.2003 #i22341# - adjustment to handle maps, that are ambiguous
157 // in their string entries.
158 void FillRelLB( const FrameMap
* _pMap
,
159 const sal_uInt16 _nLBSelPos
,
160 const sal_Int16 _nAlign
,
161 const sal_Int16 _nRel
,
162 weld::ComboBox
& _rLB
,
164 static sal_Int32
GetMapPos(const FrameMap
*pMap
, const weld::ComboBox
& rAlignLB
);
165 static sal_Int16
GetAlignment(FrameMap
const *pMap
, sal_Int32 nMapPos
, const weld::ComboBox
& rRelationLB
);
166 static sal_Int16
GetRelation(const weld::ComboBox
& rRelationLB
);
167 RndStdIds
GetAnchor() const;
169 void setOptimalFrameWidth();
170 void setOptimalRelWidth();
172 void EnableGraficMode(); // hides auto check boxes and re-org controls for "Real Size" button
174 SwWrtShell
*getFrameDlgParentShell();
176 static const sal_uInt16 aPageRg
[];
179 SwFramePage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
180 virtual ~SwFramePage() override
;
182 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
183 static const sal_uInt16
* GetRanges() { return aPageRg
; }
185 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
186 virtual void Reset(const SfxItemSet
*rSet
) override
;
188 void SetNewFrame(bool bNewFrame
) { m_bNew
= bNewFrame
; }
189 void SetFormatUsed(bool bFormat
);
190 void SetFrameType(const OUString
&rType
) { m_sDlgType
= rType
; }
191 bool IsInGraficMode() const { return m_sDlgType
== "PictureDialog" || m_sDlgType
== "ObjectDialog"; }
192 void EnableVerticalPositioning( bool bEnable
);
195 class SwGrfExtPage
: public SfxTabPage
197 OUString aFilterName
;
198 OUString aGrfName
, aNewGrfName
;
200 std::unique_ptr
<::sfx2::FileDialogHelper
> m_xGrfDlg
;
206 std::unique_ptr
<weld::Widget
> m_xMirror
;
207 std::unique_ptr
<weld::CheckButton
> m_xMirrorVertBox
;
208 std::unique_ptr
<weld::CheckButton
> m_xMirrorHorzBox
;
209 std::unique_ptr
<weld::RadioButton
> m_xAllPagesRB
;
210 std::unique_ptr
<weld::RadioButton
> m_xLeftPagesRB
;
211 std::unique_ptr
<weld::RadioButton
> m_xRightPagesRB
;
213 std::unique_ptr
<weld::Entry
> m_xConnectED
;
214 std::unique_ptr
<weld::Button
> m_xBrowseBT
;
215 std::unique_ptr
<weld::Frame
> m_xLinkFrame
;
217 // RotGrfFlyFrame: Need Angle and RotateControls now
218 std::unique_ptr
<weld::Frame
> m_xFlAngle
;
219 std::unique_ptr
<weld::MetricSpinButton
> m_xNfAngle
;
220 std::unique_ptr
<svx::DialControl
> m_xCtlAngle
;
221 std::unique_ptr
<weld::CustomWeld
> m_xCtlAngleWin
;
222 std::unique_ptr
<weld::CustomWeld
> m_xBmpWin
;
225 // handler for mirroring
226 DECL_LINK(MirrorHdl
, weld::ToggleButton
&, void);
227 DECL_LINK(BrowseHdl
, weld::Button
&, void);
229 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
232 SwGrfExtPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
233 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
234 virtual ~SwGrfExtPage() override
;
236 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
237 virtual void Reset(const SfxItemSet
*rSet
) override
;
238 virtual DeactivateRC
DeactivatePage(SfxItemSet
*pSet
) override
;
241 class SwFrameURLPage
: public SfxTabPage
244 std::unique_ptr
<weld::Entry
> m_xURLED
;
245 std::unique_ptr
<weld::Button
> m_xSearchPB
;
246 std::unique_ptr
<weld::Entry
> m_xNameED
;
247 std::unique_ptr
<weld::ComboBox
> m_xFrameCB
;
250 std::unique_ptr
<weld::CheckButton
> m_xServerCB
;
251 std::unique_ptr
<weld::CheckButton
> m_xClientCB
;
253 DECL_LINK(InsertFileHdl
, weld::Button
&, void);
256 SwFrameURLPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
257 virtual ~SwFrameURLPage() override
;
259 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
261 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
262 virtual void Reset(const SfxItemSet
*rSet
) override
;
265 class SwFrameAddPage
: public SfxTabPage
267 SwWrtShell
* m_pWrtSh
;
274 std::unique_ptr
<weld::Widget
> m_xNameFrame
;
275 std::unique_ptr
<weld::Label
> m_xNameFT
;
276 std::unique_ptr
<weld::Entry
> m_xNameED
;
277 std::unique_ptr
<weld::Label
> m_xAltNameFT
;
278 std::unique_ptr
<weld::Entry
> m_xAltNameED
;
279 std::unique_ptr
<weld::Label
> m_xDescriptionFT
;
280 std::unique_ptr
<weld::TextView
> m_xDescriptionED
;
281 std::unique_ptr
<weld::Label
> m_xPrevFT
;
282 std::unique_ptr
<weld::ComboBox
> m_xPrevLB
;
283 std::unique_ptr
<weld::Label
> m_xNextFT
;
284 std::unique_ptr
<weld::ComboBox
> m_xNextLB
;
286 std::unique_ptr
<weld::Widget
> m_xProtectFrame
;
287 std::unique_ptr
<weld::CheckButton
> m_xProtectContentCB
;
288 std::unique_ptr
<weld::CheckButton
> m_xProtectFrameCB
;
289 std::unique_ptr
<weld::CheckButton
> m_xProtectSizeCB
;
291 std::unique_ptr
<weld::Widget
> m_xContentAlignFrame
;
292 std::unique_ptr
<weld::ComboBox
> m_xVertAlignLB
;
294 std::unique_ptr
<weld::Widget
> m_xPropertiesFrame
;
295 std::unique_ptr
<weld::CheckButton
> m_xEditInReadonlyCB
;
296 std::unique_ptr
<weld::CheckButton
> m_xPrintFrameCB
;
297 std::unique_ptr
<weld::Label
> m_xTextFlowFT
;
298 std::unique_ptr
<svx::FrameDirectionListBox
> m_xTextFlowLB
;
300 DECL_LINK(EditModifyHdl
, weld::Entry
&, void);
301 DECL_LINK(ChainModifyHdl
, weld::ComboBox
&, void);
303 static const sal_uInt16 aAddPgRg
[];
306 SwFrameAddPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
&rSet
);
307 virtual ~SwFrameAddPage() override
;
309 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*rSet
);
310 static const sal_uInt16
* GetRanges() { return aAddPgRg
; }
312 virtual bool FillItemSet(SfxItemSet
*rSet
) override
;
313 virtual void Reset(const SfxItemSet
*rSet
) override
;
315 void SetFormatUsed(bool bFormat
);
316 void SetFrameType(const OUString
&rType
) { m_sDlgType
= rType
; }
317 void SetNewFrame(bool bNewFrame
) { m_bNew
= bNewFrame
; }
318 void SetShell(SwWrtShell
* pSh
) { m_pWrtSh
= pSh
; }
322 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX
324 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */