tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / cui / source / inc / cuitabarea.hxx
blob30feba7fe85f5bfa3b9cbfad1108ef3f1775f42f
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 .
19 #pragma once
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
33 class ColorListBox;
34 class SdrModel;
35 class SvxBitmapCtl;
37 /************************************************************************/
38 class ButtonBox
40 private:
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);
53 public:
54 ButtonBox()
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;
69 else
70 return -1;
72 void SelectButton(weld::Toggleable* pButton)
74 sal_Int32 nPos = GetButtonPos(pButton);
75 if(nPos != -1)
76 SelectButtonImpl(nPos);
80 enum class PageType
82 Area,
83 Gradient,
84 Hatch,
85 Bitmap,
86 Shadow,
87 Transparence,
90 class AreaTabHelper
92 public:
93 static OUString GetPalettePath();
96 class SvxAreaTabDialog final : public SfxTabDialogController
98 SdrModel* mpDrawModel;
100 XColorListRef mpColorList;
101 XColorListRef mpNewColorList;
102 XGradientListRef mpGradientList;
103 XGradientListRef mpNewGradientList;
104 XHatchListRef mpHatchingList;
105 XHatchListRef mpNewHatchingList;
106 XBitmapListRef mpBitmapList;
107 XBitmapListRef mpNewBitmapList;
108 XPatternListRef mpPatternList;
109 XPatternListRef mpNewPatternList;
111 ChangeType mnColorListState;
113 virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
115 virtual short Ok() override;
116 DECL_LINK(CancelHdlImpl, weld::Button&, void);
117 void SavePalettes();
119 public:
120 SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow,
121 bool bSlideBackground);
123 void SetNewColorList( XColorListRef const & pColorList )
124 { mpNewColorList = pColorList; }
125 const XColorListRef& GetNewColorList() const { return mpNewColorList; }
128 /************************************************************************/
130 class SvxTransparenceTabPage : public SfxTabPage
132 static const WhichRangesContainer pTransparenceRanges;
134 const SfxItemSet& rOutAttrs;
136 PageType nPageType;
137 sal_uInt16 nDlgType;
139 bool bBitmap;
141 XFillAttrSetItem aXFillAttr;
142 SfxItemSet& rXFSet;
144 SvxXRectPreview m_aCtlBitmapPreview;
145 SvxXRectPreview m_aCtlXRectPreview;
147 // main selection
148 std::unique_ptr<weld::RadioButton> m_xRbtTransOff;
149 std::unique_ptr<weld::RadioButton> m_xRbtTransLinear;
150 std::unique_ptr<weld::RadioButton> m_xRbtTransGradient;
152 /// linear transparency
153 std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
155 // gradient transparency
156 std::unique_ptr<weld::Widget> m_xGridGradient;
157 std::unique_ptr<weld::ComboBox> m_xLbTrgrGradientType;
158 std::unique_ptr<weld::Label> m_xFtTrgrCenterX;
159 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterX;
160 std::unique_ptr<weld::Label> m_xFtTrgrCenterY;
161 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterY;
162 std::unique_ptr<weld::Label> m_xFtTrgrAngle;
163 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrAngle;
164 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrBorder;
165 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrStartValue;
166 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrEndValue;
167 std::unique_ptr<weld::Widget> m_xCtlBitmapBorder;
168 std::unique_ptr<weld::Widget> m_xCtlXRectBorder;
170 // preview
171 std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
172 std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
174 // MCGR: Preserve ColorStops until we have a UI to edit these
175 basegfx::BColorStops maColorStops;
177 DECL_LINK(ClickTransOffHdl_Impl, weld::Toggleable&, void);
178 DECL_LINK(ClickTransLinearHdl_Impl, weld::Toggleable&, void);
179 DECL_LINK(ClickTransGradientHdl_Impl, weld::Toggleable&, void );
180 DECL_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
181 DECL_LINK(ModifiedTrgrEditHdl_Impl, weld::MetricSpinButton&, void);
182 DECL_LINK(ModifiedTrgrListBoxHdl_Impl, weld::ComboBox&, void);
183 void ModifiedTrgrHdl_Impl(const weld::ComboBox*);
185 void ActivateLinear(bool bActivate);
186 void ActivateGradient(bool bActivate);
187 void SetControlState_Impl(css::awt::GradientStyle eXGS);
189 bool InitPreview ( const SfxItemSet& rSet );
190 void InvalidatePreview (bool bEnable = true );
192 // MCGR: Preserve ColorStops until we have a UI to edit these
193 basegfx::BColorStops createColorStops();
195 public:
196 SvxTransparenceTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
197 virtual ~SvxTransparenceTabPage() override;
199 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
200 static const WhichRangesContainer & GetRanges() { return pTransparenceRanges; }
202 virtual bool FillItemSet(SfxItemSet*) override;
203 virtual void Reset(const SfxItemSet*) override;
204 virtual void ChangesApplied() override;
205 virtual void ActivatePage(const SfxItemSet& rSet) override;
206 virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override;
208 void SetPageType(PageType nInType) { nPageType = nInType; }
209 void SetDlgType(sal_uInt16 nInType) { nDlgType = nInType; }
210 virtual void PageCreated(const SfxAllItemSet& aSet) override;
213 /************************************************************************/
215 class SvxAreaTabPage : public SfxTabPage
217 static const WhichRangesContainer pAreaRanges;
218 private:
219 std::unique_ptr<SfxTabPage> m_xFillTabPage;
220 ButtonBox maBox;
222 XColorListRef m_pColorList;
223 XGradientListRef m_pGradientList;
224 XHatchListRef m_pHatchingList;
225 XBitmapListRef m_pBitmapList;
226 XPatternListRef m_pPatternList;
228 // Placeholders for pointer-based entries; these will be inited
229 // to point to these so that the page is usable without that
230 // SvxAreaTabDialog has to call the setter methods (e.g. SetColorChgd).
231 // Without that the pages used in SvxAreaTabDialog are not usable
232 ChangeType maFixed_ChangeType;
234 ChangeType* m_pnColorListState;
236 XFillAttrSetItem m_aXFillAttr;
237 SfxItemSet& m_rXFSet;
239 bool m_bBtnClicked = false;
241 protected:
242 std::unique_ptr<weld::Container> m_xFillTab;
243 std::unique_ptr<weld::Toggleable> m_xBtnNone;
244 std::unique_ptr<weld::Toggleable> m_xBtnColor;
245 std::unique_ptr<weld::Toggleable> m_xBtnGradient;
246 std::unique_ptr<weld::Toggleable> m_xBtnHatch;
247 std::unique_ptr<weld::Toggleable> m_xBtnBitmap;
248 std::unique_ptr<weld::Toggleable> m_xBtnPattern;
249 std::unique_ptr<weld::Toggleable> m_xBtnUseBackground;
251 void SetOptimalSize(weld::DialogController* pController);
253 void SelectFillType( weld::Toggleable& rButton, const SfxItemSet* _pSet = nullptr );
255 bool IsBtnClicked() const { return m_bBtnClicked; }
257 private:
258 DECL_LINK(SelectFillTypeHdl_Impl, weld::Toggleable&, void);
260 template< typename TabPage >
261 bool FillItemSet_Impl( SfxItemSet* );
262 template< typename TabPage >
263 void Reset_Impl( const SfxItemSet* );
264 template< typename TabPage >
265 DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet );
267 public:
268 SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController,
269 const SfxItemSet& rInAttrs, bool bSlideBackground = false);
270 virtual ~SvxAreaTabPage() override;
272 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
273 static std::unique_ptr<SfxTabPage>
274 CreateWithSlideBackground(weld::Container* pPage, weld::DialogController* pController,
275 const SfxItemSet*);
276 static const WhichRangesContainer & GetRanges() { return pAreaRanges; }
278 virtual OUString GetAllStrings() override;
280 virtual bool FillItemSet( SfxItemSet* ) override;
281 virtual void Reset( const SfxItemSet * ) override;
282 virtual void ActivatePage( const SfxItemSet& rSet ) override;
283 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
285 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
286 void SetGradientList( XGradientListRef const & pGrdLst)
287 { m_pGradientList = pGrdLst; }
288 void SetHatchingList( XHatchListRef const & pHtchLst)
289 { m_pHatchingList = pHtchLst; }
290 void SetBitmapList( XBitmapListRef const & pBmpLst) { m_pBitmapList = pBmpLst; }
291 void SetPatternList( XPatternListRef const &pPtrnLst ) { m_pPatternList = pPtrnLst; }
292 virtual void PageCreated(const SfxAllItemSet& aSet) override;
293 void CreatePage(sal_Int32 nId, SfxTabPage& rTab);
294 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
298 class SvxShadowTabPage : public SvxTabPage
300 static const WhichRangesContainer pShadowRanges;
302 private:
303 const SfxItemSet& m_rOutAttrs;
305 XColorListRef m_pColorList;
306 ChangeType* m_pnColorListState;
307 PageType m_nPageType;
308 sal_uInt16 m_nDlgType;
310 XFillAttrSetItem m_aXFillAttr;
311 SfxItemSet& m_rXFSet;
312 MapUnit m_ePoolUnit;
314 SvxRectCtl m_aCtlPosition;
315 SvxXShadowPreview m_aCtlXRectPreview;
316 std::unique_ptr<weld::CheckButton> m_xTsbShowShadow;
317 std::unique_ptr<weld::Widget> m_xGridShadow;
318 std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
319 std::unique_ptr<ColorListBox> m_xLbShadowColor;
320 std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
321 std::unique_ptr<weld::MetricSpinButton> m_xLbShadowBlurMetric;
322 std::unique_ptr<weld::CustomWeld> m_xCtlPosition;
323 std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
325 DECL_LINK(ClickShadowHdl_Impl, weld::Toggleable&, void);
326 DECL_LINK(ModifyShadowHdl_Impl, weld::MetricSpinButton&, void);
327 DECL_LINK(SelectShadowHdl_Impl, ColorListBox&, void);
329 public:
330 SvxShadowTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
331 virtual ~SvxShadowTabPage() override;
333 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
334 static const WhichRangesContainer & GetRanges() { return pShadowRanges; }
336 virtual bool FillItemSet( SfxItemSet* ) override;
337 virtual void Reset( const SfxItemSet * ) override;
338 virtual void ActivatePage( const SfxItemSet& rSet ) override;
339 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
340 virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
342 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
343 void SetPageType( PageType nInType ) { m_nPageType = nInType; }
344 void SetDlgType( sal_uInt16 nInType ) { m_nDlgType = nInType; }
345 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
346 virtual void PageCreated(const SfxAllItemSet& aSet) override;
349 /************************************************************************/
351 class SvxGradientTabPage : public SfxTabPage
353 private:
354 const SfxItemSet& m_rOutAttrs;
356 XColorListRef m_pColorList;
357 XGradientListRef m_pGradientList;
359 ChangeType m_nGradientListState;
360 ChangeType* m_pnColorListState;
362 XFillAttrSetItem m_aXFillAttr;
363 SfxItemSet& m_rXFSet;
365 // MCGR: Preserve ColorStops until we have a UI to edit these
366 basegfx::BColorStops m_aColorStops;
368 SvxXRectPreview m_aCtlPreview;
369 std::unique_ptr<weld::ComboBox> m_xLbGradientType;
370 std::unique_ptr<weld::Label> m_xFtCenter;
371 std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterX;
372 std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterY;
373 std::unique_ptr<weld::Label> m_xFtAngle;
374 std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
375 std::unique_ptr<weld::Scale> m_xSliderAngle;
376 std::unique_ptr<weld::MetricSpinButton> m_xMtrBorder;
377 std::unique_ptr<weld::Scale> m_xSliderBorder;
378 std::unique_ptr<ColorListBox> m_xLbColorFrom;
379 std::unique_ptr<weld::MetricSpinButton> m_xMtrColorFrom;
380 std::unique_ptr<ColorListBox> m_xLbColorTo;
381 std::unique_ptr<weld::MetricSpinButton> m_xMtrColorTo;
382 std::unique_ptr<SvxPresetListBox> m_xGradientLB;
383 std::unique_ptr<weld::SpinButton> m_xMtrIncrement;
384 std::unique_ptr<weld::CheckButton> m_xCbIncrement;
385 std::unique_ptr<weld::Button> m_xBtnAdd;
386 std::unique_ptr<weld::Button> m_xBtnModify;
387 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
388 std::unique_ptr<weld::CustomWeld> m_xGradientLBWin;
390 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
391 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
392 DECL_LINK( ChangeGradientHdl, ValueSet*, void );
393 void ChangeGradientHdl_Impl();
394 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
395 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
396 DECL_LINK( ModifiedEditHdl_Impl, weld::SpinButton&, void );
397 DECL_LINK( ModifiedMetricHdl_Impl, weld::MetricSpinButton&, void );
398 DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
399 DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
400 DECL_LINK( ChangeAutoStepHdl_Impl, weld::Toggleable&, void );
401 DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
402 void ModifiedHdl_Impl(void const *);
404 void SetControlState_Impl( css::awt::GradientStyle eXGS );
405 sal_Int32 SearchGradientList(std::u16string_view rGradientName);
407 // MCGR: Preserve ColorStops until we have a UI to edit these
408 basegfx::BColorStops createColorStops();
410 public:
411 SvxGradientTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
412 virtual ~SvxGradientTabPage() override;
414 void Construct();
416 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
417 virtual bool FillItemSet( SfxItemSet* ) override;
418 virtual void Reset( const SfxItemSet * ) override;
420 virtual void ActivatePage( const SfxItemSet& rSet ) override;
421 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
423 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
424 void SetGradientList( XGradientListRef const & pGrdLst)
425 { m_pGradientList = pGrdLst; }
426 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
429 /************************************************************************/
431 class SvxHatchTabPage : public SfxTabPage
433 private:
434 const SfxItemSet& m_rOutAttrs;
436 XColorListRef m_pColorList;
437 XHatchListRef m_pHatchingList;
439 ChangeType m_nHatchingListState;
440 ChangeType* m_pnColorListState;
442 XFillAttrSetItem m_aXFillAttr;
443 SfxItemSet& m_rXFSet;
445 MapUnit m_ePoolUnit;
447 SvxXRectPreview m_aCtlPreview;
448 std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
449 std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
450 std::unique_ptr<weld::Scale> m_xSliderAngle;
451 std::unique_ptr<weld::ComboBox> m_xLbLineType;
452 std::unique_ptr<ColorListBox> m_xLbLineColor;
453 std::unique_ptr<weld::CheckButton> m_xCbBackgroundColor;
454 std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
455 std::unique_ptr<SvxPresetListBox> m_xHatchLB;
456 std::unique_ptr<weld::Button> m_xBtnAdd;
457 std::unique_ptr<weld::Button> m_xBtnModify;
458 std::unique_ptr<weld::CustomWeld> m_xHatchLBWin;
459 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
461 DECL_LINK(ChangeHatchHdl, ValueSet*, void);
462 void ChangeHatchHdl_Impl();
463 DECL_LINK( ModifiedEditHdl_Impl, weld::MetricSpinButton&, void );
464 DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
465 DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
466 DECL_LINK( ToggleHatchBackgroundColor_Impl, weld::Toggleable&, void );
467 DECL_LINK( ModifiedBackgroundHdl_Impl, ColorListBox&, void );
468 DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
469 void ModifiedHdl_Impl(void const *);
470 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
471 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
472 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
473 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
475 sal_Int32 SearchHatchList(std::u16string_view rHatchName);
477 public:
478 SvxHatchTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
479 virtual ~SvxHatchTabPage() override;
481 void Construct();
483 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
484 virtual bool FillItemSet( SfxItemSet* ) override;
485 virtual void Reset( const SfxItemSet * ) override;
487 virtual void ActivatePage( const SfxItemSet& rSet ) override;
488 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
490 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
491 void SetHatchingList( XHatchListRef const & pHtchLst)
492 { m_pHatchingList = pHtchLst; }
494 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
497 /************************************************************************/
499 class SvxBitmapTabPage : public SfxTabPage
501 private:
503 const SfxItemSet& m_rOutAttrs;
505 XBitmapListRef m_pBitmapList;
506 ChangeType m_nBitmapListState;
508 double m_fObjectWidth;
509 double m_fObjectHeight;
510 bool m_bLogicalSize;
512 XFillAttrSetItem m_aXFillAttr;
513 SfxItemSet& m_rXFSet;
514 const SdrView* mpView;
515 MapUnit mePoolUnit;
516 FieldUnit meFieldUnit;
517 Size rBitmapSize;
518 Size rFilledSize;
519 Size rZoomedSize;
521 SvxXRectPreview m_aCtlBitmapPreview;
522 std::unique_ptr<SvxPresetListBox> m_xBitmapLB;
523 std::unique_ptr<weld::ComboBox> m_xBitmapStyleLB;
524 std::unique_ptr<weld::Container> m_xSizeBox;
525 std::unique_ptr<weld::CheckButton> m_xTsbScale;
526 std::unique_ptr<weld::MetricSpinButton> m_xBitmapWidth;
527 std::unique_ptr<weld::MetricSpinButton> m_xBitmapHeight;
528 std::unique_ptr<weld::Container> m_xPositionBox;
529 std::unique_ptr<weld::ComboBox> m_xPositionLB;
530 std::unique_ptr<weld::Container> m_xPositionOffBox;
531 std::unique_ptr<weld::MetricSpinButton> m_xPositionOffX;
532 std::unique_ptr<weld::MetricSpinButton> m_xPositionOffY;
533 std::unique_ptr<weld::Container> m_xTileOffBox;
534 std::unique_ptr<weld::ComboBox> m_xTileOffLB;
535 std::unique_ptr<weld::MetricSpinButton> m_xTileOffset;
536 std::unique_ptr<weld::Button> m_xBtnImport;
537 std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
538 std::unique_ptr<weld::CustomWeld> m_xBitmapLBWin;
540 DECL_LINK( ModifyBitmapHdl, ValueSet*, void );
541 DECL_LINK( ClickScaleHdl, weld::Toggleable&, void );
542 DECL_LINK( ModifyBitmapStyleHdl, weld::ComboBox&, void );
543 DECL_LINK( ModifyBitmapSizeHdl, weld::MetricSpinButton&, void );
544 DECL_LINK( ModifyBitmapPositionHdl, weld::ComboBox&, void );
545 DECL_LINK( ModifyPositionOffsetHdl, weld::MetricSpinButton&, void );
546 DECL_LINK( ModifyTileOffsetHdl, weld::MetricSpinButton&, void );
547 DECL_LINK( ClickRenameHdl, SvxPresetListBox*, void );
548 DECL_LINK( ClickDeleteHdl, SvxPresetListBox*, void );
549 DECL_LINK( ClickImportHdl, weld::Button&, void );
550 void ClickBitmapHdl_Impl();
551 void CalculateBitmapPresetSize();
552 sal_Int32 SearchBitmapList(std::u16string_view rBitmapName);
553 sal_Int32 SearchBitmapList(const GraphicObject& rGraphicObject);
554 tools::Long AddBitmap(const GraphicObject& rGraphicObject, const OUString& rName,
555 bool bOnlyForThisDocument = false);
557 public:
558 SvxBitmapTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
559 virtual ~SvxBitmapTabPage() override;
561 void Construct();
563 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
565 virtual bool FillItemSet( SfxItemSet* ) override;
566 virtual void Reset( const SfxItemSet * ) override;
567 virtual void ActivatePage( const SfxItemSet& rSet ) override;
568 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
570 void SetBitmapList( const XBitmapListRef& pBmpLst) { m_pBitmapList = pBmpLst; }
573 /************************************************************************/
575 class SvxPatternTabPage : public SvxTabPage
577 private:
578 const SfxItemSet& m_rOutAttrs;
580 XColorListRef m_pColorList;
581 XPatternListRef m_pPatternList;
583 ChangeType m_nPatternListState;
584 ChangeType* m_pnColorListState;
586 XFillAttrSetItem m_aXFillAttr;
587 SfxItemSet& m_rXFSet;
589 SvxXRectPreview m_aCtlPreview;
590 std::unique_ptr<SvxPixelCtl> m_xCtlPixel;
591 std::unique_ptr<ColorListBox> m_xLbColor;
592 std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
593 std::unique_ptr<SvxPresetListBox> m_xPatternLB;
594 std::unique_ptr<weld::Button> m_xBtnAdd;
595 std::unique_ptr<weld::Button> m_xBtnModify;
596 std::unique_ptr<weld::CustomWeld> m_xCtlPixelWin;
597 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
598 std::unique_ptr<weld::CustomWeld> m_xPatternLBWin;
599 std::unique_ptr<SvxBitmapCtl> m_xBitmapCtl;
601 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
602 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
603 DECL_LINK( ChangePatternHdl_Impl, ValueSet*, void );
604 DECL_LINK( ChangeColorHdl_Impl, ColorListBox&, void );
605 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
606 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
608 sal_Int32 SearchPatternList(std::u16string_view rPatternName);
610 public:
611 SvxPatternTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
612 virtual ~SvxPatternTabPage() override;
614 void Construct();
616 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
617 virtual bool FillItemSet( SfxItemSet* ) override;
618 virtual void Reset( const SfxItemSet * ) override;
620 virtual void ActivatePage( const SfxItemSet& rSet ) override;
621 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
623 virtual void PointChanged( weld::DrawingArea*, RectPoint eRP ) override;
625 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
626 void SetPatternList( XPatternListRef const & pPatternList) { m_pPatternList = pPatternList; }
627 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
628 void ChangeColor_Impl();
631 /************************************************************************/
633 enum class ColorModel
635 RGB,
636 CMYK
639 class SvxColorTabPage : public SfxTabPage
641 private:
642 const SfxItemSet& rOutAttrs;
644 XColorListRef pColorList;
646 ChangeType* pnColorListState;
648 XFillAttrSetItem aXFillAttr;
649 SfxItemSet& rXFSet;
651 ColorModel eCM;
653 Color m_aPreviousColor;
654 NamedColor m_aCurrentColor;
656 PaletteManager maPaletteManager;
657 SvxXRectPreview m_aCtlPreviewOld;
658 SvxXRectPreview m_aCtlPreviewNew;
659 std::unique_ptr<SvxColorValueSet> m_xValSetColorList;
660 std::unique_ptr<SvxColorValueSet> m_xValSetRecentList;
661 std::unique_ptr<weld::ComboBox> m_xSelectPalette;
662 std::unique_ptr<weld::RadioButton> m_xRbRGB;
663 std::unique_ptr<weld::RadioButton> m_xRbCMYK;
664 std::unique_ptr<weld::Widget> m_xRGBcustom;
665 std::unique_ptr<weld::Widget> m_xRGBpreset;
666 std::unique_ptr<weld::Entry> m_xRpreset;
667 std::unique_ptr<weld::Entry> m_xGpreset;
668 std::unique_ptr<weld::Entry> m_xBpreset;
669 std::unique_ptr<weld::SpinButton> m_xRcustom;
670 std::unique_ptr<weld::SpinButton> m_xGcustom;
671 std::unique_ptr<weld::SpinButton> m_xBcustom;
672 std::unique_ptr<weld::HexColorControl> m_xHexpreset;
673 std::unique_ptr<weld::HexColorControl> m_xHexcustom;
674 std::unique_ptr<weld::Widget> m_xCMYKcustom;
675 std::unique_ptr<weld::Widget> m_xCMYKpreset;
676 std::unique_ptr<weld::Entry> m_xCpreset;
677 std::unique_ptr<weld::Entry> m_xYpreset;
678 std::unique_ptr<weld::Entry> m_xMpreset;
679 std::unique_ptr<weld::Entry> m_xKpreset;
680 std::unique_ptr<weld::MetricSpinButton> m_xCcustom;
681 std::unique_ptr<weld::MetricSpinButton> m_xYcustom;
682 std::unique_ptr<weld::MetricSpinButton> m_xMcustom;
683 std::unique_ptr<weld::MetricSpinButton> m_xKcustom;
684 std::unique_ptr<weld::Button> m_xBtnAdd;
685 std::unique_ptr<weld::Button> m_xBtnDelete;
686 std::unique_ptr<weld::Button> m_xBtnWorkOn;
687 std::unique_ptr<weld::Button> m_xMoreColors;
688 std::unique_ptr<weld::CustomWeld> m_xCtlPreviewOld;
689 std::unique_ptr<weld::CustomWeld> m_xCtlPreviewNew;
690 std::unique_ptr<weld::CustomWeld> m_xValSetColorListWin;
691 std::unique_ptr<weld::CustomWeld> m_xValSetRecentListWin;
693 static void ConvertColorValues (Color& rColor, ColorModel eModell);
694 static void RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK );
695 static void CmykToRgb_Impl( Color& rColor, const sal_uInt16 nKey );
696 sal_uInt16 ColorToPercent_Impl( sal_uInt16 nColor );
697 sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent );
699 void ImpColorCountChanged();
700 void FillPaletteLB();
702 DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
703 DECL_LINK(ClickWorkOnHdl_Impl, weld::Button&, void);
704 DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void);
705 DECL_STATIC_LINK(SvxColorTabPage, OnMoreColorsClick, weld::Button&, void);
707 DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
708 DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void );
709 DECL_LINK( SelectColorModeHdl_Impl, weld::Toggleable&, void );
710 void ChangeColor(const NamedColor &rNewColor, bool bUpdatePreset = true);
711 void SetColorModel(ColorModel eModel);
712 void ChangeColorModel();
713 void UpdateColorValues( bool bUpdatePreset = true );
714 DECL_LINK(SpinValueHdl_Impl, weld::SpinButton&, void);
715 DECL_LINK(MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void);
716 DECL_LINK(ModifiedHdl_Impl, weld::Entry&, void);
718 void UpdateModified();
720 static sal_Int32 FindInCustomColors( std::u16string_view aColorName );
721 sal_Int32 FindInPalette( const Color& rColor );
723 public:
724 SvxColorTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
725 virtual ~SvxColorTabPage() override;
727 void Construct();
729 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
730 virtual bool FillItemSet( SfxItemSet* ) override;
731 virtual void Reset( const SfxItemSet * ) override;
733 virtual void ActivatePage( const SfxItemSet& rSet ) override;
734 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
736 void SetPropertyList( XPropertyListType t, const XPropertyListRef &xRef );
737 void SetColorList( const XColorListRef& pColList );
740 void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; }
742 virtual void FillUserData() override;
745 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */