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_CUI_SOURCE_INC_CUITABLINE_HXX
21 #define INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
24 #include <editeng/brushitem.hxx>
25 #include <sfx2/tabdlg.hxx>
26 #include <svx/svdpage.hxx>
27 #include <svx/tabarea.hxx>
28 #include <svx/xlnasit.hxx>
29 #include <svx/xtable.hxx>
30 #include <svx/dlgctrl.hxx>
31 #include <vcl/customweld.hxx>
36 class SvxLineTabDialog final
: public SfxTabDialogController
39 const SdrObject
* pObj
;
41 XColorListRef pColorList
;
42 XColorListRef mpNewColorList
;
43 XDashListRef pDashList
;
44 XDashListRef pNewDashList
;
45 XLineEndListRef pLineEndList
;
46 XLineEndListRef pNewLineEndList
;
49 ChangeType nLineEndListState
;
50 ChangeType nDashListState
;
51 ChangeType mnColorListState
;
55 sal_Int32 nPosLineEndLb
;
57 virtual void PageCreated(const OString
& rId
, SfxTabPage
&rPage
) override
;
59 virtual short Ok() override
;
60 DECL_LINK(CancelHdlImpl
, weld::Button
&, void);
64 SvxLineTabDialog(weld::Window
* pParent
, const SfxItemSet
* pAttr
,
65 SdrModel
* pModel
, const SdrObject
* pObj
,
68 void SetNewDashList( XDashListRef
const & pInLst
)
69 { pNewDashList
= pInLst
; }
70 const XDashListRef
& GetNewDashList() const { return pNewDashList
; }
72 void SetNewLineEndList( XLineEndListRef
const & pInLst
)
73 { pNewLineEndList
= pInLst
; }
74 const XLineEndListRef
& GetNewLineEndList() const { return pNewLineEndList
; }
76 void SetNewColorList( XColorListRef
const & pColTab
) { mpNewColorList
= pColTab
; }
77 const XColorListRef
& GetNewColorList() const { return mpNewColorList
; }
80 /*************************************************************************/
84 std::unique_ptr
<SvxBrushItem
> pBrushItem
;
88 class SvxLineTabPage
: public SfxTabPage
90 static const sal_uInt16 pLineRanges
[];
92 //#58425# symbols on a line (e. g. StarChart) ->
93 /** a list of symbols to be shown in menu. Symbol at position SID_ATTR_SYMBOLTYPE is to be shown in preview.
94 The list position is to be used cyclic. */
95 SdrObjList
* m_pSymbolList
;
97 /// a graphic to be displayed in the preview in case that an automatic symbol is chosen
98 Graphic m_aAutoSymbolGraphic
;
100 /// attributes for the shown symbols; only necessary if not equal to line properties
101 SfxItemSet
* m_pSymbolAttr
;
103 std::vector
<OUString
> m_aGrfNames
;
104 std::vector
< std::unique_ptr
<SvxBmpItemInfo
> >
105 m_aGalleryBrushItems
;
106 std::vector
< std::unique_ptr
<SvxBmpItemInfo
> >
108 bool m_bLastWidthModified
;
109 Size m_aSymbolLastSize
;
110 Graphic m_aSymbolGraphic
;
114 const SfxItemSet
& m_rOutAttrs
;
117 XLineAttrSetItem m_aXLineAttr
;
118 SfxItemSet
& m_rXLSet
;
120 XDashListRef m_pDashList
;
121 XLineEndListRef m_pLineEndList
;
123 ChangeType
* m_pnLineEndListState
;
124 ChangeType
* m_pnDashListState
;
125 ChangeType
* m_pnColorListState
;
126 PageType m_nPageType
;
127 sal_uInt16 m_nDlgType
;
128 sal_Int32
* m_pPosDashLb
;
129 sal_Int32
* m_pPosLineEndLb
;
133 sal_Int32 m_nActLineWidth
;
135 SvxXLinePreview m_aCtlPreview
;
136 std::unique_ptr
<weld::Widget
> m_xBoxColor
;
137 std::unique_ptr
<SvxLineLB
> m_xLbLineStyle
;
138 std::unique_ptr
<ColorListBox
> m_xLbColor
;
139 std::unique_ptr
<weld::Widget
> m_xBoxWidth
;
140 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrLineWidth
;
141 std::unique_ptr
<weld::Widget
> m_xBoxTransparency
;
142 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTransparent
;
143 std::unique_ptr
<weld::Widget
> m_xFlLineEnds
;
144 std::unique_ptr
<weld::Widget
> m_xBoxArrowStyles
;
145 std::unique_ptr
<SvxLineEndLB
> m_xLbStartStyle
;
146 std::unique_ptr
<weld::Widget
> m_xBoxStart
;
147 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrStartWidth
;
148 std::unique_ptr
<weld::CheckButton
> m_xTsbCenterStart
;
149 std::unique_ptr
<weld::Widget
> m_xBoxEnd
;
150 std::unique_ptr
<SvxLineEndLB
> m_xLbEndStyle
;
151 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrEndWidth
;
152 std::unique_ptr
<weld::CheckButton
> m_xTsbCenterEnd
;
153 std::unique_ptr
<weld::CheckButton
> m_xCbxSynchronize
;
154 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreview
;
156 std::unique_ptr
<weld::Widget
> m_xFLEdgeStyle
;
157 std::unique_ptr
<weld::Widget
> m_xGridEdgeCaps
;
158 std::unique_ptr
<weld::ComboBox
> m_xLBEdgeStyle
;
161 std::unique_ptr
<weld::ComboBox
> m_xLBCapStyle
;
163 std::unique_ptr
<weld::Widget
> m_xFlSymbol
;
164 std::unique_ptr
<weld::Widget
> m_xGridIconSize
;
165 std::unique_ptr
<weld::MenuButton
> m_xSymbolMB
;
166 std::unique_ptr
<weld::Menu
> m_xSymbolsMenu
;
167 std::unique_ptr
<weld::Menu
> m_xGalleryMenu
;
168 std::unique_ptr
<weld::MetricSpinButton
> m_xSymbolWidthMF
;
169 std::unique_ptr
<weld::MetricSpinButton
> m_xSymbolHeightMF
;
170 std::unique_ptr
<weld::CheckButton
> m_xSymbolRatioCB
;
172 // handler for gallery popup menu button + size
173 DECL_LINK(GraphicHdl_Impl
, const OString
&, void);
174 DECL_LINK(SizeHdl_Impl
, weld::MetricSpinButton
&, void);
175 DECL_LINK(MenuCreateHdl_Impl
, weld::ToggleButton
&, void);
176 DECL_LINK(RatioHdl_Impl
, weld::ToggleButton
&, void);
178 DECL_LINK(ClickInvisibleHdl_Impl
, weld::ComboBox
&, void);
179 void ClickInvisibleHdl_Impl();
180 DECL_LINK(ChangeStartClickHdl_Impl
, weld::Button
&, void);
181 DECL_LINK(ChangeStartListBoxHdl_Impl
, weld::ComboBox
&, void);
182 DECL_LINK(ChangeStartModifyHdl_Impl
, weld::MetricSpinButton
&, void);
183 DECL_LINK(ChangeEndListBoxHdl_Impl
, weld::ComboBox
&, void);
184 DECL_LINK(ChangeEndModifyHdl_Impl
, weld::MetricSpinButton
&, void);
185 DECL_LINK(ChangeEndClickHdl_Impl
, weld::Button
&, void);
186 DECL_LINK(ChangePreviewListBoxHdl_Impl
, ColorListBox
&, void);
187 DECL_LINK(ChangePreviewModifyHdl_Impl
, weld::MetricSpinButton
&, void);
188 void ChangePreviewHdl_Impl(const weld::MetricSpinButton
*);
189 DECL_LINK(ChangeTransparentHdl_Impl
, weld::MetricSpinButton
&, void);
191 DECL_LINK(ChangeEdgeStyleHdl_Impl
, weld::ComboBox
&, void);
194 DECL_LINK(ChangeCapStyleHdl_Impl
, weld::ComboBox
&, void);
196 void FillXLSet_Impl();
198 void FillListboxes();
201 void ShowSymbolControls(bool bOn
);
203 SvxLineTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
204 virtual ~SvxLineTabPage() override
;
208 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
209 static const sal_uInt16
* GetRanges() { return pLineRanges
; }
211 virtual bool FillItemSet( SfxItemSet
* ) override
;
212 virtual void Reset( const SfxItemSet
* ) override
;
214 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
215 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
217 virtual void FillUserData() override
;
219 void SetDashList( XDashListRef
const & pDshLst
) { m_pDashList
= pDshLst
; }
220 void SetLineEndList( XLineEndListRef
const & pLneEndLst
) { m_pLineEndList
= pLneEndLst
; }
221 void SetObjSelected( bool bHasObj
) { m_bObjSelected
= bHasObj
; }
223 void SetPageType( PageType nInType
) { m_nPageType
= nInType
; }
224 void SetDlgType( sal_uInt16 nInType
) { m_nDlgType
= nInType
; }
225 void SetPosDashLb( sal_Int32
* pInPos
) { m_pPosDashLb
= pInPos
; }
226 void SetPosLineEndLb( sal_Int32
* pInPos
) { m_pPosLineEndLb
= pInPos
; }
228 void SetLineEndChgd( ChangeType
* pIn
) { m_pnLineEndListState
= pIn
; }
229 void SetDashChgd( ChangeType
* pIn
) { m_pnDashListState
= pIn
; }
230 void SetColorChgd( ChangeType
* pIn
) { m_pnColorListState
= pIn
; }
232 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
235 /*************************************************************************/
237 class SvxLineDefTabPage
: public SfxTabPage
240 const SfxItemSet
& rOutAttrs
;
243 XLineAttrSetItem aXLineAttr
;
246 XDashListRef pDashList
;
248 ChangeType
* pnDashListState
;
251 sal_Int32
* pPosDashLb
;
256 SvxXLinePreview m_aCtlPreview
;
257 std::unique_ptr
<SvxLineLB
> m_xLbLineStyles
;
258 std::unique_ptr
<weld::ComboBox
> m_xLbType1
;
259 std::unique_ptr
<weld::ComboBox
> m_xLbType2
;
260 std::unique_ptr
<weld::SpinButton
> m_xNumFldNumber1
;
261 std::unique_ptr
<weld::SpinButton
> m_xNumFldNumber2
;
262 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrLength1
;
263 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrLength2
;
264 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrDistance
;
265 std::unique_ptr
<weld::CheckButton
> m_xCbxSynchronize
;
266 std::unique_ptr
<weld::Button
> m_xBtnAdd
;
267 std::unique_ptr
<weld::Button
> m_xBtnModify
;
268 std::unique_ptr
<weld::Button
> m_xBtnDelete
;
269 std::unique_ptr
<weld::Button
> m_xBtnLoad
;
270 std::unique_ptr
<weld::Button
> m_xBtnSave
;
271 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreview
;
273 void FillDash_Impl();
274 void FillDialog_Impl();
276 DECL_LINK(ClickAddHdl_Impl
, weld::Button
&, void);
277 DECL_LINK(ClickModifyHdl_Impl
, weld::Button
&, void);
278 DECL_LINK(ClickDeleteHdl_Impl
, weld::Button
&, void);
279 DECL_LINK(SelectLinestyleListBoxHdl_Impl
, weld::ComboBox
&, void);
280 void SelectLinestyleHdl_Impl(const weld::ComboBox
*);
281 DECL_LINK(ChangePreviewHdl_Impl
, weld::MetricSpinButton
&, void);
282 DECL_LINK(ChangeNumber1Hdl_Impl
, weld::SpinButton
&, void);
283 DECL_LINK(ChangeNumber2Hdl_Impl
, weld::SpinButton
&, void);
284 DECL_LINK(ClickLoadHdl_Impl
, weld::Button
&, void);
285 DECL_LINK(ClickSaveHdl_Impl
, weld::Button
&, void);
286 DECL_LINK(ChangeMetricHdl_Impl
, weld::ToggleButton
&, void);
287 DECL_LINK(SelectTypeListBoxHdl_Impl
, weld::ComboBox
&, void);
288 void SelectTypeHdl_Impl(const weld::ComboBox
*);
289 void ChangeMetricHdl_Impl(const weld::ToggleButton
*);
291 void CheckChanges_Impl();
294 SvxLineDefTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
295 virtual ~SvxLineDefTabPage() override
;
299 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
300 virtual bool FillItemSet( SfxItemSet
* ) override
;
301 virtual void Reset( const SfxItemSet
* ) override
;
303 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
304 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
306 void SetDashList( XDashListRef
const & pDshLst
) { pDashList
= pDshLst
; }
308 void SetPageType( PageType
* pInType
) { pPageType
= pInType
; }
309 void SetDlgType( sal_uInt16 nInType
) { nDlgType
= nInType
; }
310 void SetPosDashLb( sal_Int32
* pInPos
) { pPosDashLb
= pInPos
; }
312 void SetDashChgd( ChangeType
* pIn
) { pnDashListState
= pIn
; }
315 /*************************************************************************/
317 class SvxLineEndDefTabPage
: public SfxTabPage
320 const SfxItemSet
& rOutAttrs
;
321 const SdrObject
* pPolyObj
;
323 XLineAttrSetItem aXLineAttr
;
326 XLineEndListRef pLineEndList
;
328 ChangeType
* pnLineEndListState
;
331 sal_Int32
* pPosLineEndLb
;
333 SvxXLinePreview m_aCtlPreview
;
334 std::unique_ptr
<weld::Entry
> m_xEdtName
;
335 std::unique_ptr
<SvxLineEndLB
> m_xLbLineEnds
;
336 std::unique_ptr
<weld::Button
> m_xBtnAdd
;
337 std::unique_ptr
<weld::Button
> m_xBtnModify
;
338 std::unique_ptr
<weld::Button
> m_xBtnDelete
;
339 std::unique_ptr
<weld::Button
> m_xBtnLoad
;
340 std::unique_ptr
<weld::Button
> m_xBtnSave
;
341 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreview
;
343 DECL_LINK(ClickAddHdl_Impl
, weld::Button
&, void);
344 DECL_LINK(ClickModifyHdl_Impl
, weld::Button
&, void);
345 DECL_LINK(ClickDeleteHdl_Impl
, weld::Button
&, void);
346 DECL_LINK(ClickLoadHdl_Impl
, weld::Button
&, void);
347 DECL_LINK(ClickSaveHdl_Impl
, weld::Button
&, void);
348 DECL_LINK(SelectLineEndHdl_Impl
, weld::ComboBox
&, void);
350 void SelectLineEndHdl_Impl();
351 void CheckChanges_Impl();
354 SvxLineEndDefTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
355 virtual ~SvxLineEndDefTabPage() override
;
359 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
360 virtual bool FillItemSet( SfxItemSet
* ) override
;
361 virtual void Reset( const SfxItemSet
* ) override
;
363 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
364 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
366 void SetLineEndList( XLineEndListRef
const & pInList
) { pLineEndList
= pInList
; }
367 void SetPolyObj( const SdrObject
* pObj
) { pPolyObj
= pObj
; }
369 void SetPageType( PageType
* pInType
) { pPageType
= pInType
; }
370 void SetDlgType( sal_uInt16 nInType
) { nDlgType
= nInType
; }
371 void SetPosLineEndLb( sal_Int32
* pInPos
) { pPosLineEndLb
= pInPos
; }
373 void SetLineEndChgd( ChangeType
* pIn
) { pnLineEndListState
= pIn
; }
376 #endif // INCLUDED_CUI_SOURCE_INC_CUITABLINE_HXX
378 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */