Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / inc / frmpage.hxx
blob6f05ca1d651a3f1d511d69f72c6067e9668f0dab
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
28 #include "bmpwin.hxx"
29 #include "prcntfld.hxx"
31 namespace sfx2{class FileDialogHelper;}
32 class SwWrtShell;
33 struct FrameMap;
34 // OD 12.11.2003 #i22341#
35 struct SwPosition;
37 /// This is the Position & Size tab page of the Insert -> Frame -> Frame dialog.
38 class SwFramePage final : public SfxTabPage
40 bool m_bAtHorzPosModified;
41 bool m_bAtVertPosModified;
43 bool m_bFormat;
44 bool m_bNew;
45 bool m_bNoModifyHdl;
46 bool m_bIsVerticalFrame; //current frame is in vertical environment - strings are exchanged
47 // #mongolianlayout#
48 bool m_bIsVerticalL2R;
49 bool m_bIsInRightToLeft; // current frame is in right-to-left environment - strings are exchanged
50 bool m_bHtmlMode;
51 sal_uInt16 m_nHtmlMode;
52 OUString m_sDlgType;
53 Size m_aGrfSize;
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 SwFormatAnchor* mpToCharContentPos;
62 // old alignment
63 sal_Int16 m_nOldH;
64 sal_Int16 m_nOldHRel;
65 sal_Int16 m_nOldV;
66 sal_Int16 m_nOldVRel;
68 FrameMap const * m_pVMap;
69 FrameMap const * m_pHMap;
71 bool m_bAllowVertPositioning;
72 bool m_bIsMathOLE;
73 bool m_bIsMathBaselineAlignment;
75 SwFrameExample m_aExampleWN;
77 // size
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;
93 // anchor
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;
101 // position
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;
119 std::unique_ptr<weld::CheckButton> m_xFlySplitCB;
121 // example
122 std::unique_ptr<weld::CustomWeld> m_xExampleWN;
124 std::unique_ptr<SwPercentField> m_xWidthED;
125 std::unique_ptr<SwPercentField> m_xHeightED;
127 virtual void ActivatePage(const SfxItemSet& rSet) override;
128 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
130 DECL_LINK(RangeModifyClickHdl, weld::Toggleable&, void);
131 void RangeModifyHdl();
132 DECL_LINK(AnchorTypeHdl, weld::Toggleable&, void);
133 DECL_LINK(PosHdl, weld::ComboBox&, void);
134 DECL_LINK(RelHdl, weld::ComboBox&, void);
135 void InitPos(RndStdIds eId, sal_Int16 nH, sal_Int16 nHRel,
136 sal_Int16 nV, sal_Int16 nVRel,
137 tools::Long nX, tools::Long nY);
139 DECL_LINK(RealSizeHdl, weld::Button&, void);
140 DECL_LINK(RelSizeClickHdl, weld::Toggleable&, void);
141 DECL_LINK(MirrorHdl, weld::Toggleable&, void);
143 DECL_LINK(AutoWidthClickHdl, weld::Toggleable&, void);
144 DECL_LINK(AutoHeightClickHdl, weld::Toggleable&, void);
146 // update example
147 void UpdateExample();
148 DECL_LINK(ModifyHdl, weld::MetricSpinButton&, void);
150 void Init(const SfxItemSet& rSet);
151 // OD 12.11.2003 #i22341# - adjustment to handle maps, that are ambiguous
152 // in the alignment.
153 sal_Int32 FillPosLB( const FrameMap* _pMap,
154 const sal_Int16 _nAlign,
155 const sal_Int16 _nRel,
156 weld::ComboBox& _rLB );
157 // OD 14.11.2003 #i22341# - adjustment to handle maps, that are ambiguous
158 // in their string entries.
159 void FillRelLB( const FrameMap* _pMap,
160 const sal_uInt16 _nLBSelPos,
161 const sal_Int16 _nAlign,
162 const sal_Int16 _nRel,
163 weld::ComboBox& _rLB,
164 weld::Label& _rFT );
165 static sal_Int32 GetMapPos(const FrameMap *pMap, const weld::ComboBox& rAlignLB);
166 static sal_Int16 GetAlignment(FrameMap const *pMap, sal_Int32 nMapPos, const weld::ComboBox& rRelationLB);
167 static sal_Int16 GetRelation(const weld::ComboBox& rRelationLB);
168 RndStdIds GetAnchor() const;
170 void setOptimalFrameWidth();
171 void setOptimalRelWidth();
173 void EnableGraficMode(); // hides auto check boxes and re-org controls for "Real Size" button
175 SwWrtShell *getFrameDlgParentShell();
177 static const WhichRangesContainer s_aPageRg;
179 public:
180 SwFramePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
181 virtual ~SwFramePage() override;
183 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet);
184 static WhichRangesContainer GetRanges() { return s_aPageRg; }
186 virtual bool FillItemSet(SfxItemSet *rSet) override;
187 virtual void Reset(const SfxItemSet *rSet) override;
189 void SetNewFrame(bool bNewFrame) { m_bNew = bNewFrame; }
190 void SetFormatUsed(bool bFormat);
191 void SetFrameType(const OUString &rType) { m_sDlgType = rType; }
192 bool IsInGraficMode() const { return m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog"; }
193 void EnableVerticalPositioning( bool bEnable );
196 /// Tabpage providing the functionality behind Format -> Image -> Properties and then the Rotation
197 /// tabpage.
198 class SwGrfExtPage final : public SfxTabPage
200 OUString m_aFilterName;
201 OUString m_aGrfName, m_aNewGrfName;
203 std::unique_ptr<::sfx2::FileDialogHelper> m_xGrfDlg;
205 bool m_bHtmlMode;
207 // mirror
208 BmpWindow m_aBmpWin;
209 std::unique_ptr<weld::Widget> m_xMirror;
210 std::unique_ptr<weld::CheckButton> m_xMirrorVertBox;
211 std::unique_ptr<weld::CheckButton> m_xMirrorHorzBox;
212 std::unique_ptr<weld::RadioButton> m_xAllPagesRB;
213 std::unique_ptr<weld::RadioButton> m_xLeftPagesRB;
214 std::unique_ptr<weld::RadioButton> m_xRightPagesRB;
216 std::unique_ptr<weld::Entry> m_xConnectED;
217 std::unique_ptr<weld::Button> m_xBrowseBT;
218 std::unique_ptr<weld::Frame> m_xLinkFrame;
220 // RotGrfFlyFrame: Need Angle and RotateControls now
221 std::unique_ptr<weld::Frame> m_xFlAngle;
222 std::unique_ptr<weld::MetricSpinButton> m_xNfAngle;
223 std::unique_ptr<svx::DialControl> m_xCtlAngle;
224 std::unique_ptr<weld::CustomWeld> m_xCtlAngleWin;
225 std::unique_ptr<weld::CustomWeld> m_xBmpWin;
227 // tdf#138843 add place holder for the graphic type
228 std::unique_ptr<weld::Label> m_xLabelGraphicType;
230 // handler for mirroring
231 DECL_LINK(MirrorHdl, weld::Toggleable&, void);
232 DECL_LINK(BrowseHdl, weld::Button&, void);
234 virtual void ActivatePage(const SfxItemSet& rSet) override;
236 public:
237 SwGrfExtPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
238 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet);
239 virtual ~SwGrfExtPage() override;
241 virtual bool FillItemSet(SfxItemSet *rSet) override;
242 virtual void Reset(const SfxItemSet *rSet) override;
243 virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override;
246 class SwFrameURLPage final : public SfxTabPage
248 // hyperlink
249 std::unique_ptr<weld::Entry> m_xURLED;
250 std::unique_ptr<weld::Button> m_xSearchPB;
251 std::unique_ptr<weld::Entry> m_xNameED;
252 std::unique_ptr<weld::ComboBox> m_xFrameCB;
254 // image map
255 std::unique_ptr<weld::CheckButton> m_xServerCB;
256 std::unique_ptr<weld::CheckButton> m_xClientCB;
258 DECL_LINK(InsertFileHdl, weld::Button&, void);
260 public:
261 SwFrameURLPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
262 virtual ~SwFrameURLPage() override;
264 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet);
266 virtual bool FillItemSet(SfxItemSet *rSet) override;
267 virtual void Reset(const SfxItemSet *rSet) override;
270 class SwFrameAddPage final : public SfxTabPage
272 SwWrtShell* m_pWrtSh;
274 OUString m_sDlgType;
275 bool m_bHtmlMode;
276 bool m_bFormat;
277 bool m_bNew;
279 std::unique_ptr<weld::Widget> m_xNameFrame;
280 std::unique_ptr<weld::Label> m_xNameFT;
281 std::unique_ptr<weld::Entry> m_xNameED;
282 std::unique_ptr<weld::Label> m_xAltNameFT;
283 std::unique_ptr<weld::Entry> m_xAltNameED;
284 std::unique_ptr<weld::Label> m_xDescriptionFT;
285 std::unique_ptr<weld::TextView> m_xDescriptionED;
286 std::unique_ptr<weld::CheckButton> m_xDecorativeCB;
287 std::unique_ptr<weld::Widget> m_xSequenceFrame;
288 std::unique_ptr<weld::ComboBox> m_xPrevLB;
289 std::unique_ptr<weld::ComboBox> m_xNextLB;
291 std::unique_ptr<weld::Widget> m_xProtectFrame;
292 std::unique_ptr<weld::CheckButton> m_xProtectContentCB;
293 std::unique_ptr<weld::CheckButton> m_xProtectFrameCB;
294 std::unique_ptr<weld::CheckButton> m_xProtectSizeCB;
296 std::unique_ptr<weld::Widget> m_xContentAlignFrame;
297 std::unique_ptr<weld::ComboBox> m_xVertAlignLB;
299 std::unique_ptr<weld::Widget> m_xPropertiesFrame;
300 std::unique_ptr<weld::CheckButton> m_xEditInReadonlyCB;
301 std::unique_ptr<weld::CheckButton> m_xPrintFrameCB;
302 std::unique_ptr<weld::Label> m_xTextFlowFT;
303 std::unique_ptr<svx::FrameDirectionListBox> m_xTextFlowLB;
305 DECL_LINK(EditModifyHdl, weld::Entry&, void);
306 DECL_LINK(DecorativeHdl, weld::Toggleable&, void);
307 DECL_LINK(ChainModifyHdl, weld::ComboBox&, void);
309 static const WhichRangesContainer s_aAddPgRg;
311 public:
312 SwFrameAddPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
313 virtual ~SwFrameAddPage() override;
315 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet);
316 static WhichRangesContainer GetRanges() { return s_aAddPgRg; }
318 virtual bool FillItemSet(SfxItemSet *rSet) override;
319 virtual void Reset(const SfxItemSet *rSet) override;
321 void SetFormatUsed(bool bFormat);
322 void SetFrameType(const OUString &rType) { m_sDlgType = rType; }
323 void SetNewFrame(bool bNewFrame) { m_bNew = bNewFrame; }
324 void SetShell(SwWrtShell* pSh) { m_pWrtSh = pSh; }
328 #endif // INCLUDED_SW_SOURCE_UIBASE_INC_FRMPAGE_HXX
330 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */