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 <svtools/valueset.hxx>
22 #include <svx/dlgctrl.hxx>
23 #include <svx/xflasit.hxx>
24 #include <svx/tabarea.hxx>
25 #include <svx/hexcolorcontrol.hxx>
26 #include <svx/SvxColorValueSet.hxx>
27 #include <svx/SvxPresetListBox.hxx>
28 #include <svx/PaletteManager.hxx>
29 #include <svx/svdview.hxx>
31 #define NO_BUTTON_SELECTED -1
37 /************************************************************************/
41 sal_Int32 mnCurrentButton
;
42 std::vector
<weld::Toggleable
*> maButtonList
;
43 std::map
<weld::Toggleable
*, sal_Int32
> maButtonToPos
;
44 void SelectButtonImpl( sal_Int32 nPos
)
46 if(mnCurrentButton
!= NO_BUTTON_SELECTED
)
48 maButtonList
[mnCurrentButton
]->set_active(false);
50 mnCurrentButton
= nPos
;
51 maButtonList
[mnCurrentButton
]->set_active(true);
56 mnCurrentButton
= NO_BUTTON_SELECTED
;
58 void AddButton(weld::Toggleable
* pButton
)
60 maButtonList
.push_back(pButton
);
61 maButtonToPos
.insert( std::make_pair(pButton
, maButtonList
.size() - 1) );
63 sal_Int32
GetCurrentButtonPos() const { return mnCurrentButton
; }
64 sal_Int32
GetButtonPos(weld::Toggleable
* pButton
)
66 std::map
<weld::Toggleable
*, sal_Int32
>::const_iterator aBtnPos
= maButtonToPos
.find(pButton
);
67 if(aBtnPos
!= maButtonToPos
.end())
68 return aBtnPos
->second
;
72 void SelectButton(weld::Toggleable
* pButton
)
74 sal_Int32 nPos
= GetButtonPos(pButton
);
76 SelectButtonImpl(nPos
);
90 class SvxAreaTabDialog final
: public SfxTabDialogController
92 SdrModel
* mpDrawModel
;
94 XColorListRef mpColorList
;
95 XColorListRef mpNewColorList
;
96 XGradientListRef mpGradientList
;
97 XGradientListRef mpNewGradientList
;
98 XHatchListRef mpHatchingList
;
99 XHatchListRef mpNewHatchingList
;
100 XBitmapListRef mpBitmapList
;
101 XBitmapListRef mpNewBitmapList
;
102 XPatternListRef mpPatternList
;
103 XPatternListRef mpNewPatternList
;
105 ChangeType mnColorListState
;
106 ChangeType mnBitmapListState
;
107 ChangeType mnPatternListState
;
108 ChangeType mnGradientListState
;
109 ChangeType mnHatchingListState
;
111 virtual void PageCreated(const OUString
& rId
, SfxTabPage
&rPage
) override
;
113 virtual short Ok() override
;
114 DECL_LINK(CancelHdlImpl
, weld::Button
&, void);
118 SvxAreaTabDialog(weld::Window
* pParent
, const SfxItemSet
* pAttr
, SdrModel
* pModel
, bool bShadow
,
119 bool bSlideBackground
);
121 void SetNewColorList( XColorListRef
const & pColorList
)
122 { mpNewColorList
= pColorList
; }
123 const XColorListRef
& GetNewColorList() const { return mpNewColorList
; }
126 /************************************************************************/
128 class SvxTransparenceTabPage
: public SfxTabPage
130 static const WhichRangesContainer pTransparenceRanges
;
132 const SfxItemSet
& rOutAttrs
;
139 XFillAttrSetItem aXFillAttr
;
142 SvxXRectPreview m_aCtlBitmapPreview
;
143 SvxXRectPreview m_aCtlXRectPreview
;
146 std::unique_ptr
<weld::RadioButton
> m_xRbtTransOff
;
147 std::unique_ptr
<weld::RadioButton
> m_xRbtTransLinear
;
148 std::unique_ptr
<weld::RadioButton
> m_xRbtTransGradient
;
150 /// linear transparency
151 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTransparent
;
153 // gradient transparency
154 std::unique_ptr
<weld::Widget
> m_xGridGradient
;
155 std::unique_ptr
<weld::ComboBox
> m_xLbTrgrGradientType
;
156 std::unique_ptr
<weld::Label
> m_xFtTrgrCenterX
;
157 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTrgrCenterX
;
158 std::unique_ptr
<weld::Label
> m_xFtTrgrCenterY
;
159 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTrgrCenterY
;
160 std::unique_ptr
<weld::Label
> m_xFtTrgrAngle
;
161 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTrgrAngle
;
162 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTrgrBorder
;
163 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTrgrStartValue
;
164 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTrgrEndValue
;
165 std::unique_ptr
<weld::Widget
> m_xCtlBitmapBorder
;
166 std::unique_ptr
<weld::Widget
> m_xCtlXRectBorder
;
169 std::unique_ptr
<weld::CustomWeld
> m_xCtlBitmapPreview
;
170 std::unique_ptr
<weld::CustomWeld
> m_xCtlXRectPreview
;
172 // MCGR: Preserve ColorStops until we have a UI to edit these
173 basegfx::BColorStops maColorStops
;
175 DECL_LINK(ClickTransOffHdl_Impl
, weld::Toggleable
&, void);
176 DECL_LINK(ClickTransLinearHdl_Impl
, weld::Toggleable
&, void);
177 DECL_LINK(ClickTransGradientHdl_Impl
, weld::Toggleable
&, void );
178 DECL_LINK(ModifyTransparentHdl_Impl
, weld::MetricSpinButton
&, void);
179 DECL_LINK(ModifiedTrgrEditHdl_Impl
, weld::MetricSpinButton
&, void);
180 DECL_LINK(ModifiedTrgrListBoxHdl_Impl
, weld::ComboBox
&, void);
181 void ModifiedTrgrHdl_Impl(const weld::ComboBox
*);
183 void ActivateLinear(bool bActivate
);
184 void ActivateGradient(bool bActivate
);
185 void SetControlState_Impl(css::awt::GradientStyle eXGS
);
187 bool InitPreview ( const SfxItemSet
& rSet
);
188 void InvalidatePreview (bool bEnable
= true );
190 // MCGR: Preserve ColorStops until we have a UI to edit these
191 basegfx::BColorStops
createColorStops();
194 SvxTransparenceTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
195 virtual ~SvxTransparenceTabPage() override
;
197 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
*);
198 static WhichRangesContainer
GetRanges() { return pTransparenceRanges
; }
200 virtual bool FillItemSet(SfxItemSet
*) override
;
201 virtual void Reset(const SfxItemSet
*) override
;
202 virtual void ChangesApplied() override
;
203 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
204 virtual DeactivateRC
DeactivatePage(SfxItemSet
* pSet
) override
;
206 void SetPageType(PageType nInType
) { nPageType
= nInType
; }
207 void SetDlgType(sal_uInt16 nInType
) { nDlgType
= nInType
; }
208 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
211 /************************************************************************/
213 class SvxAreaTabPage
: public SfxTabPage
215 static const WhichRangesContainer pAreaRanges
;
217 std::unique_ptr
<SfxTabPage
> m_xFillTabPage
;
220 XColorListRef m_pColorList
;
221 XGradientListRef m_pGradientList
;
222 XHatchListRef m_pHatchingList
;
223 XBitmapListRef m_pBitmapList
;
224 XPatternListRef m_pPatternList
;
226 // Placeholders for pointer-based entries; these will be inited
227 // to point to these so that the page is usable without that
228 // SvxAreaTabDialog has to call the setter methods (e.g. SetColorChgd).
229 // Without that the pages used in SvxAreaTabDialog are not usable
230 ChangeType maFixed_ChangeType
;
232 ChangeType
* m_pnColorListState
;
233 ChangeType
* m_pnBitmapListState
;
234 ChangeType
* m_pnPatternListState
;
235 ChangeType
* m_pnGradientListState
;
236 ChangeType
* m_pnHatchingListState
;
238 XFillAttrSetItem m_aXFillAttr
;
239 SfxItemSet
& m_rXFSet
;
241 bool m_bBtnClicked
= false;
244 std::unique_ptr
<weld::Container
> m_xFillTab
;
245 std::unique_ptr
<weld::Toggleable
> m_xBtnNone
;
246 std::unique_ptr
<weld::Toggleable
> m_xBtnColor
;
247 std::unique_ptr
<weld::Toggleable
> m_xBtnGradient
;
248 std::unique_ptr
<weld::Toggleable
> m_xBtnHatch
;
249 std::unique_ptr
<weld::Toggleable
> m_xBtnBitmap
;
250 std::unique_ptr
<weld::Toggleable
> m_xBtnPattern
;
251 std::unique_ptr
<weld::Toggleable
> m_xBtnUseBackground
;
253 void SetOptimalSize(weld::DialogController
* pController
);
255 void SelectFillType( weld::Toggleable
& rButton
, const SfxItemSet
* _pSet
= nullptr );
256 SfxTabPage
* GetFillTabPage() { return m_xFillTabPage
.get(); }
258 bool IsBtnClicked() const { return m_bBtnClicked
; }
261 DECL_LINK(SelectFillTypeHdl_Impl
, weld::Toggleable
&, void);
263 template< typename TabPage
>
264 bool FillItemSet_Impl( SfxItemSet
* );
265 template< typename TabPage
>
266 void Reset_Impl( const SfxItemSet
* );
267 template< typename TabPage
>
268 DeactivateRC
DeactivatePage_Impl( SfxItemSet
* pSet
);
271 SvxAreaTabPage(weld::Container
* pPage
, weld::DialogController
* pController
,
272 const SfxItemSet
& rInAttrs
, bool bSlideBackground
= false);
273 virtual ~SvxAreaTabPage() override
;
275 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
276 static std::unique_ptr
<SfxTabPage
>
277 CreateWithSlideBackground(weld::Container
* pPage
, weld::DialogController
* pController
,
279 static WhichRangesContainer
GetRanges() { return pAreaRanges
; }
281 virtual bool FillItemSet( SfxItemSet
* ) override
;
282 virtual void Reset( const SfxItemSet
* ) override
;
283 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
284 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
286 void SetColorList( XColorListRef
const & pColorList
) { m_pColorList
= pColorList
; }
287 void SetGradientList( XGradientListRef
const & pGrdLst
)
288 { m_pGradientList
= pGrdLst
; }
289 void SetHatchingList( XHatchListRef
const & pHtchLst
)
290 { m_pHatchingList
= pHtchLst
; }
291 void SetBitmapList( XBitmapListRef
const & pBmpLst
) { m_pBitmapList
= pBmpLst
; }
292 void SetPatternList( XPatternListRef
const &pPtrnLst
) { m_pPatternList
= pPtrnLst
; }
293 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
294 void CreatePage(sal_Int32 nId
, SfxTabPage
& rTab
);
295 void SetColorChgd( ChangeType
* pIn
) { m_pnColorListState
= pIn
; }
296 void SetGrdChgd( ChangeType
* pIn
) { m_pnGradientListState
= pIn
; }
297 void SetHtchChgd( ChangeType
* pIn
) { m_pnHatchingListState
= pIn
; }
298 void SetBmpChgd( ChangeType
* pIn
) { m_pnBitmapListState
= pIn
; }
299 void SetPtrnChgd( ChangeType
* pIn
) { m_pnPatternListState
= pIn
; }
303 class SvxShadowTabPage
: public SvxTabPage
305 static const WhichRangesContainer pShadowRanges
;
308 const SfxItemSet
& m_rOutAttrs
;
310 XColorListRef m_pColorList
;
311 ChangeType
* m_pnColorListState
;
312 PageType m_nPageType
;
313 sal_uInt16 m_nDlgType
;
315 XFillAttrSetItem m_aXFillAttr
;
316 SfxItemSet
& m_rXFSet
;
319 SvxRectCtl m_aCtlPosition
;
320 SvxXShadowPreview m_aCtlXRectPreview
;
321 std::unique_ptr
<weld::CheckButton
> m_xTsbShowShadow
;
322 std::unique_ptr
<weld::Widget
> m_xGridShadow
;
323 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrDistance
;
324 std::unique_ptr
<ColorListBox
> m_xLbShadowColor
;
325 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrTransparent
;
326 std::unique_ptr
<weld::MetricSpinButton
> m_xLbShadowBlurMetric
;
327 std::unique_ptr
<weld::CustomWeld
> m_xCtlPosition
;
328 std::unique_ptr
<weld::CustomWeld
> m_xCtlXRectPreview
;
330 DECL_LINK(ClickShadowHdl_Impl
, weld::Toggleable
&, void);
331 DECL_LINK(ModifyShadowHdl_Impl
, weld::MetricSpinButton
&, void);
332 DECL_LINK(SelectShadowHdl_Impl
, ColorListBox
&, void);
335 SvxShadowTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
336 virtual ~SvxShadowTabPage() override
;
338 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
339 static WhichRangesContainer
GetRanges() { return pShadowRanges
; }
341 virtual bool FillItemSet( SfxItemSet
* ) override
;
342 virtual void Reset( const SfxItemSet
* ) override
;
343 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
344 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
345 virtual void PointChanged( weld::DrawingArea
* pWindow
, RectPoint eRP
) override
;
347 void SetColorList( XColorListRef
const & pColorList
) { m_pColorList
= pColorList
; }
348 void SetPageType( PageType nInType
) { m_nPageType
= nInType
; }
349 void SetDlgType( sal_uInt16 nInType
) { m_nDlgType
= nInType
; }
350 void SetColorChgd( ChangeType
* pIn
) { m_pnColorListState
= pIn
; }
351 virtual void PageCreated(const SfxAllItemSet
& aSet
) override
;
354 /************************************************************************/
356 class SvxGradientTabPage
: public SfxTabPage
359 const SfxItemSet
& m_rOutAttrs
;
361 XColorListRef m_pColorList
;
362 XGradientListRef m_pGradientList
;
364 ChangeType
* m_pnGradientListState
;
365 ChangeType
* m_pnColorListState
;
367 XFillAttrSetItem m_aXFillAttr
;
368 SfxItemSet
& m_rXFSet
;
370 // MCGR: Preserve ColorStops until we have a UI to edit these
371 basegfx::BColorStops m_aColorStops
;
373 SvxXRectPreview m_aCtlPreview
;
374 std::unique_ptr
<weld::ComboBox
> m_xLbGradientType
;
375 std::unique_ptr
<weld::Label
> m_xFtCenter
;
376 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrCenterX
;
377 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrCenterY
;
378 std::unique_ptr
<weld::Label
> m_xFtAngle
;
379 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrAngle
;
380 std::unique_ptr
<weld::Scale
> m_xSliderAngle
;
381 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrBorder
;
382 std::unique_ptr
<weld::Scale
> m_xSliderBorder
;
383 std::unique_ptr
<ColorListBox
> m_xLbColorFrom
;
384 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrColorFrom
;
385 std::unique_ptr
<ColorListBox
> m_xLbColorTo
;
386 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrColorTo
;
387 std::unique_ptr
<SvxPresetListBox
> m_xGradientLB
;
388 std::unique_ptr
<weld::SpinButton
> m_xMtrIncrement
;
389 std::unique_ptr
<weld::CheckButton
> m_xCbIncrement
;
390 std::unique_ptr
<weld::Button
> m_xBtnAdd
;
391 std::unique_ptr
<weld::Button
> m_xBtnModify
;
392 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreview
;
393 std::unique_ptr
<weld::CustomWeld
> m_xGradientLBWin
;
395 DECL_LINK( ClickAddHdl_Impl
, weld::Button
&, void );
396 DECL_LINK( ClickModifyHdl_Impl
, weld::Button
&, void );
397 DECL_LINK( ChangeGradientHdl
, ValueSet
*, void );
398 void ChangeGradientHdl_Impl();
399 DECL_LINK( ClickRenameHdl_Impl
, SvxPresetListBox
*, void );
400 DECL_LINK( ClickDeleteHdl_Impl
, SvxPresetListBox
*, void );
401 DECL_LINK( ModifiedEditHdl_Impl
, weld::SpinButton
&, void );
402 DECL_LINK( ModifiedMetricHdl_Impl
, weld::MetricSpinButton
&, void );
403 DECL_LINK( ModifiedColorListBoxHdl_Impl
, ColorListBox
&, void );
404 DECL_LINK( ModifiedListBoxHdl_Impl
, weld::ComboBox
&, void );
405 DECL_LINK( ChangeAutoStepHdl_Impl
, weld::Toggleable
&, void );
406 DECL_LINK( ModifiedSliderHdl_Impl
, weld::Scale
&, void );
407 void ModifiedHdl_Impl(void const *);
409 void SetControlState_Impl( css::awt::GradientStyle eXGS
);
410 sal_Int32
SearchGradientList(std::u16string_view rGradientName
);
412 // MCGR: Preserve ColorStops until we have a UI to edit these
413 basegfx::BColorStops
createColorStops();
416 SvxGradientTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
417 virtual ~SvxGradientTabPage() override
;
421 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
422 virtual bool FillItemSet( SfxItemSet
* ) override
;
423 virtual void Reset( const SfxItemSet
* ) override
;
425 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
426 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
428 void SetColorList( XColorListRef
const & pColorList
) { m_pColorList
= pColorList
; }
429 void SetGradientList( XGradientListRef
const & pGrdLst
)
430 { m_pGradientList
= pGrdLst
; }
431 void SetGrdChgd( ChangeType
* pIn
) { m_pnGradientListState
= pIn
; }
432 void SetColorChgd( ChangeType
* pIn
) { m_pnColorListState
= pIn
; }
435 /************************************************************************/
437 class SvxHatchTabPage
: public SfxTabPage
440 const SfxItemSet
& m_rOutAttrs
;
442 XColorListRef m_pColorList
;
443 XHatchListRef m_pHatchingList
;
445 ChangeType
* m_pnHatchingListState
;
446 ChangeType
* m_pnColorListState
;
448 XFillAttrSetItem m_aXFillAttr
;
449 SfxItemSet
& m_rXFSet
;
453 SvxXRectPreview m_aCtlPreview
;
454 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrDistance
;
455 std::unique_ptr
<weld::MetricSpinButton
> m_xMtrAngle
;
456 std::unique_ptr
<weld::Scale
> m_xSliderAngle
;
457 std::unique_ptr
<weld::ComboBox
> m_xLbLineType
;
458 std::unique_ptr
<ColorListBox
> m_xLbLineColor
;
459 std::unique_ptr
<weld::CheckButton
> m_xCbBackgroundColor
;
460 std::unique_ptr
<ColorListBox
> m_xLbBackgroundColor
;
461 std::unique_ptr
<SvxPresetListBox
> m_xHatchLB
;
462 std::unique_ptr
<weld::Button
> m_xBtnAdd
;
463 std::unique_ptr
<weld::Button
> m_xBtnModify
;
464 std::unique_ptr
<weld::CustomWeld
> m_xHatchLBWin
;
465 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreview
;
467 DECL_LINK(ChangeHatchHdl
, ValueSet
*, void);
468 void ChangeHatchHdl_Impl();
469 DECL_LINK( ModifiedEditHdl_Impl
, weld::MetricSpinButton
&, void );
470 DECL_LINK( ModifiedListBoxHdl_Impl
, weld::ComboBox
&, void );
471 DECL_LINK( ModifiedColorListBoxHdl_Impl
, ColorListBox
&, void );
472 DECL_LINK( ToggleHatchBackgroundColor_Impl
, weld::Toggleable
&, void );
473 DECL_LINK( ModifiedBackgroundHdl_Impl
, ColorListBox
&, void );
474 DECL_LINK( ModifiedSliderHdl_Impl
, weld::Scale
&, void );
475 void ModifiedHdl_Impl(void const *);
476 DECL_LINK( ClickAddHdl_Impl
, weld::Button
&, void );
477 DECL_LINK( ClickModifyHdl_Impl
, weld::Button
&, void );
478 DECL_LINK( ClickRenameHdl_Impl
, SvxPresetListBox
*, void );
479 DECL_LINK( ClickDeleteHdl_Impl
, SvxPresetListBox
*, void );
481 sal_Int32
SearchHatchList(std::u16string_view rHatchName
);
484 SvxHatchTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
485 virtual ~SvxHatchTabPage() override
;
489 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
490 virtual bool FillItemSet( SfxItemSet
* ) override
;
491 virtual void Reset( const SfxItemSet
* ) override
;
493 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
494 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
496 void SetColorList( XColorListRef
const & pColorList
) { m_pColorList
= pColorList
; }
497 void SetHatchingList( XHatchListRef
const & pHtchLst
)
498 { m_pHatchingList
= pHtchLst
; }
500 void SetHtchChgd( ChangeType
* pIn
) { m_pnHatchingListState
= pIn
; }
501 void SetColorChgd( ChangeType
* pIn
) { m_pnColorListState
= pIn
; }
504 /************************************************************************/
506 class SvxBitmapTabPage
: public SfxTabPage
510 const SfxItemSet
& m_rOutAttrs
;
512 XBitmapListRef m_pBitmapList
;
513 ChangeType
* m_pnBitmapListState
;
515 double m_fObjectWidth
;
516 double m_fObjectHeight
;
519 XFillAttrSetItem m_aXFillAttr
;
520 SfxItemSet
& m_rXFSet
;
521 const SdrView
* mpView
;
523 FieldUnit meFieldUnit
;
528 SvxXRectPreview m_aCtlBitmapPreview
;
529 std::unique_ptr
<SvxPresetListBox
> m_xBitmapLB
;
530 std::unique_ptr
<weld::ComboBox
> m_xBitmapStyleLB
;
531 std::unique_ptr
<weld::Container
> m_xSizeBox
;
532 std::unique_ptr
<weld::CheckButton
> m_xTsbScale
;
533 std::unique_ptr
<weld::MetricSpinButton
> m_xBitmapWidth
;
534 std::unique_ptr
<weld::MetricSpinButton
> m_xBitmapHeight
;
535 std::unique_ptr
<weld::Container
> m_xPositionBox
;
536 std::unique_ptr
<weld::ComboBox
> m_xPositionLB
;
537 std::unique_ptr
<weld::Container
> m_xPositionOffBox
;
538 std::unique_ptr
<weld::MetricSpinButton
> m_xPositionOffX
;
539 std::unique_ptr
<weld::MetricSpinButton
> m_xPositionOffY
;
540 std::unique_ptr
<weld::Container
> m_xTileOffBox
;
541 std::unique_ptr
<weld::ComboBox
> m_xTileOffLB
;
542 std::unique_ptr
<weld::MetricSpinButton
> m_xTileOffset
;
543 std::unique_ptr
<weld::Button
> m_xBtnImport
;
544 std::unique_ptr
<weld::CustomWeld
> m_xCtlBitmapPreview
;
545 std::unique_ptr
<weld::CustomWeld
> m_xBitmapLBWin
;
547 DECL_LINK( ModifyBitmapHdl
, ValueSet
*, void );
548 DECL_LINK( ClickScaleHdl
, weld::Toggleable
&, void );
549 DECL_LINK( ModifyBitmapStyleHdl
, weld::ComboBox
&, void );
550 DECL_LINK( ModifyBitmapSizeHdl
, weld::MetricSpinButton
&, void );
551 DECL_LINK( ModifyBitmapPositionHdl
, weld::ComboBox
&, void );
552 DECL_LINK( ModifyPositionOffsetHdl
, weld::MetricSpinButton
&, void );
553 DECL_LINK( ModifyTileOffsetHdl
, weld::MetricSpinButton
&, void );
554 DECL_LINK( ClickRenameHdl
, SvxPresetListBox
*, void );
555 DECL_LINK( ClickDeleteHdl
, SvxPresetListBox
*, void );
556 DECL_LINK( ClickImportHdl
, weld::Button
&, void );
557 void ClickBitmapHdl_Impl();
558 void CalculateBitmapPresetSize();
559 sal_Int32
SearchBitmapList(std::u16string_view rBitmapName
);
560 sal_Int32
SearchBitmapList(const GraphicObject
& rGraphicObject
);
563 SvxBitmapTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
564 virtual ~SvxBitmapTabPage() override
;
568 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
570 virtual bool FillItemSet( SfxItemSet
* ) override
;
571 virtual void Reset( const SfxItemSet
* ) override
;
572 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
573 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
575 void SetBitmapList( const XBitmapListRef
& pBmpLst
) { m_pBitmapList
= pBmpLst
; }
576 void SetBmpChgd( ChangeType
* pIn
) { m_pnBitmapListState
= pIn
; }
579 /************************************************************************/
581 class SvxPatternTabPage
: public SvxTabPage
584 const SfxItemSet
& m_rOutAttrs
;
586 XColorListRef m_pColorList
;
587 XPatternListRef m_pPatternList
;
589 ChangeType
* m_pnPatternListState
;
590 ChangeType
* m_pnColorListState
;
592 XFillAttrSetItem m_aXFillAttr
;
593 SfxItemSet
& m_rXFSet
;
595 SvxXRectPreview m_aCtlPreview
;
596 std::unique_ptr
<SvxPixelCtl
> m_xCtlPixel
;
597 std::unique_ptr
<ColorListBox
> m_xLbColor
;
598 std::unique_ptr
<ColorListBox
> m_xLbBackgroundColor
;
599 std::unique_ptr
<SvxPresetListBox
> m_xPatternLB
;
600 std::unique_ptr
<weld::Button
> m_xBtnAdd
;
601 std::unique_ptr
<weld::Button
> m_xBtnModify
;
602 std::unique_ptr
<weld::CustomWeld
> m_xCtlPixelWin
;
603 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreview
;
604 std::unique_ptr
<weld::CustomWeld
> m_xPatternLBWin
;
605 std::unique_ptr
<SvxBitmapCtl
> m_xBitmapCtl
;
607 DECL_LINK( ClickAddHdl_Impl
, weld::Button
&, void );
608 DECL_LINK( ClickModifyHdl_Impl
, weld::Button
&, void );
609 DECL_LINK( ChangePatternHdl_Impl
, ValueSet
*, void );
610 DECL_LINK( ChangeColorHdl_Impl
, ColorListBox
&, void );
611 DECL_LINK( ClickRenameHdl_Impl
, SvxPresetListBox
*, void );
612 DECL_LINK( ClickDeleteHdl_Impl
, SvxPresetListBox
*, void );
614 sal_Int32
SearchPatternList(std::u16string_view rPatternName
);
617 SvxPatternTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
618 virtual ~SvxPatternTabPage() override
;
622 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
623 virtual bool FillItemSet( SfxItemSet
* ) override
;
624 virtual void Reset( const SfxItemSet
* ) override
;
626 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
627 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
629 virtual void PointChanged( weld::DrawingArea
*, RectPoint eRP
) override
;
631 void SetColorList( XColorListRef
const & pColorList
) { m_pColorList
= pColorList
; }
632 void SetPatternList( XPatternListRef
const & pPatternList
) { m_pPatternList
= pPatternList
; }
633 void SetPtrnChgd( ChangeType
* pIn
) { m_pnPatternListState
= pIn
; }
634 void SetColorChgd( ChangeType
* pIn
) { m_pnColorListState
= pIn
; }
635 void ChangeColor_Impl();
638 /************************************************************************/
640 enum class ColorModel
646 class SvxColorTabPage
: public SfxTabPage
649 const SfxItemSet
& rOutAttrs
;
651 XColorListRef pColorList
;
653 ChangeType
* pnColorListState
;
655 XFillAttrSetItem aXFillAttr
;
660 Color m_aPreviousColor
;
661 NamedColor m_aCurrentColor
;
663 PaletteManager maPaletteManager
;
664 SvxXRectPreview m_aCtlPreviewOld
;
665 SvxXRectPreview m_aCtlPreviewNew
;
666 std::unique_ptr
<SvxColorValueSet
> m_xValSetColorList
;
667 std::unique_ptr
<SvxColorValueSet
> m_xValSetRecentList
;
668 std::unique_ptr
<weld::ComboBox
> m_xSelectPalette
;
669 std::unique_ptr
<weld::RadioButton
> m_xRbRGB
;
670 std::unique_ptr
<weld::RadioButton
> m_xRbCMYK
;
671 std::unique_ptr
<weld::Widget
> m_xRGBcustom
;
672 std::unique_ptr
<weld::Widget
> m_xRGBpreset
;
673 std::unique_ptr
<weld::Entry
> m_xRpreset
;
674 std::unique_ptr
<weld::Entry
> m_xGpreset
;
675 std::unique_ptr
<weld::Entry
> m_xBpreset
;
676 std::unique_ptr
<weld::SpinButton
> m_xRcustom
;
677 std::unique_ptr
<weld::SpinButton
> m_xGcustom
;
678 std::unique_ptr
<weld::SpinButton
> m_xBcustom
;
679 std::unique_ptr
<weld::HexColorControl
> m_xHexpreset
;
680 std::unique_ptr
<weld::HexColorControl
> m_xHexcustom
;
681 std::unique_ptr
<weld::Widget
> m_xCMYKcustom
;
682 std::unique_ptr
<weld::Widget
> m_xCMYKpreset
;
683 std::unique_ptr
<weld::Entry
> m_xCpreset
;
684 std::unique_ptr
<weld::Entry
> m_xYpreset
;
685 std::unique_ptr
<weld::Entry
> m_xMpreset
;
686 std::unique_ptr
<weld::Entry
> m_xKpreset
;
687 std::unique_ptr
<weld::MetricSpinButton
> m_xCcustom
;
688 std::unique_ptr
<weld::MetricSpinButton
> m_xYcustom
;
689 std::unique_ptr
<weld::MetricSpinButton
> m_xMcustom
;
690 std::unique_ptr
<weld::MetricSpinButton
> m_xKcustom
;
691 std::unique_ptr
<weld::Button
> m_xBtnAdd
;
692 std::unique_ptr
<weld::Button
> m_xBtnDelete
;
693 std::unique_ptr
<weld::Button
> m_xBtnWorkOn
;
694 std::unique_ptr
<weld::Button
> m_xMoreColors
;
695 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreviewOld
;
696 std::unique_ptr
<weld::CustomWeld
> m_xCtlPreviewNew
;
697 std::unique_ptr
<weld::CustomWeld
> m_xValSetColorListWin
;
698 std::unique_ptr
<weld::CustomWeld
> m_xValSetRecentListWin
;
700 static void ConvertColorValues (Color
& rColor
, ColorModel eModell
);
701 static void RgbToCmyk_Impl( Color
& rColor
, sal_uInt16
& rK
);
702 static void CmykToRgb_Impl( Color
& rColor
, const sal_uInt16 nKey
);
703 sal_uInt16
ColorToPercent_Impl( sal_uInt16 nColor
);
704 sal_uInt16
PercentToColor_Impl( sal_uInt16 nPercent
);
706 void ImpColorCountChanged();
707 void FillPaletteLB();
709 DECL_LINK(ClickAddHdl_Impl
, weld::Button
&, void);
710 DECL_LINK(ClickWorkOnHdl_Impl
, weld::Button
&, void);
711 DECL_LINK(ClickDeleteHdl_Impl
, weld::Button
&, void);
712 DECL_STATIC_LINK(SvxColorTabPage
, OnMoreColorsClick
, weld::Button
&, void);
714 DECL_LINK(SelectPaletteLBHdl
, weld::ComboBox
&, void);
715 DECL_LINK( SelectValSetHdl_Impl
, ValueSet
*, void );
716 DECL_LINK( SelectColorModeHdl_Impl
, weld::Toggleable
&, void );
717 void ChangeColor(const NamedColor
&rNewColor
, bool bUpdatePreset
= true);
718 void SetColorModel(ColorModel eModel
);
719 void ChangeColorModel();
720 void UpdateColorValues( bool bUpdatePreset
= true );
721 DECL_LINK(SpinValueHdl_Impl
, weld::SpinButton
&, void);
722 DECL_LINK(MetricSpinValueHdl_Impl
, weld::MetricSpinButton
&, void);
723 DECL_LINK(ModifiedHdl_Impl
, weld::Entry
&, void);
725 void UpdateModified();
727 static sal_Int32
FindInCustomColors( std::u16string_view aColorName
);
728 sal_Int32
FindInPalette( const Color
& rColor
);
731 SvxColorTabPage(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rInAttrs
);
732 virtual ~SvxColorTabPage() override
;
736 static std::unique_ptr
<SfxTabPage
> Create( weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* );
737 virtual bool FillItemSet( SfxItemSet
* ) override
;
738 virtual void Reset( const SfxItemSet
* ) override
;
740 virtual void ActivatePage( const SfxItemSet
& rSet
) override
;
741 virtual DeactivateRC
DeactivatePage( SfxItemSet
* pSet
) override
;
743 void SetPropertyList( XPropertyListType t
, const XPropertyListRef
&xRef
);
744 void SetColorList( const XColorListRef
& pColList
);
747 void SetColorChgd( ChangeType
* pIn
) { pnColorListState
= pIn
; }
749 void SetCtlPreviewOld( const SfxItemSet
& rAttrs
) { m_aCtlPreviewOld
.SetAttributes( rAttrs
); }
751 virtual void FillUserData() override
;
754 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */