bump product version to 6.3.0.0.beta1
[LibreOffice.git] / cui / source / inc / cuitabarea.hxx
blob4b2dd2f3ac840d37778412cf357db74e75d652f3
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 #ifndef INCLUDED_CUI_SOURCE_INC_CUITABAREA_HXX
20 #define INCLUDED_CUI_SOURCE_INC_CUITABAREA_HXX
22 #include <svtools/valueset.hxx>
23 #include <svx/dlgctrl.hxx>
24 #include <svx/xfillit0.hxx>
25 #include <svx/tabarea.hxx>
26 #include <svx/hexcolorcontrol.hxx>
27 #include <svx/SvxColorValueSet.hxx>
28 #include <svx/SvxPresetListBox.hxx>
29 #include <svx/Palette.hxx>
30 #include <svx/PaletteManager.hxx>
31 #include <svx/svdview.hxx>
33 #define NO_BUTTON_SELECTED -1
35 class ColorListBox;
36 class SdrModel;
37 class SvxBitmapCtl;
38 class SvxColorListBox;
40 /************************************************************************/
41 class ButtonBox
43 private:
44 sal_Int32 mnCurrentButton;
45 std::vector<weld::ToggleButton*> maButtonList;
46 std::map<weld::ToggleButton*, sal_Int32 > maButtonToPos;
47 void SelectButtonImpl( sal_Int32 nPos )
49 if(mnCurrentButton != NO_BUTTON_SELECTED)
51 maButtonList[mnCurrentButton]->set_active(false);
53 mnCurrentButton = nPos;
54 maButtonList[mnCurrentButton]->set_active(true);
56 public:
57 ButtonBox()
59 mnCurrentButton = NO_BUTTON_SELECTED;
61 void AddButton(weld::ToggleButton* pButton)
63 maButtonList.push_back(pButton);
64 maButtonToPos.insert( std::make_pair(pButton, maButtonList.size() - 1) );
66 sal_Int32 GetCurrentButtonPos() { return mnCurrentButton; }
67 sal_Int32 GetButtonPos(weld::ToggleButton* pButton)
69 std::map<weld::ToggleButton*, sal_Int32>::const_iterator aBtnPos = maButtonToPos.find(pButton);
70 if(aBtnPos != maButtonToPos.end())
71 return aBtnPos->second;
72 else
73 return -1;
75 void SelectButton(weld::ToggleButton* pButton)
77 sal_Int32 nPos = GetButtonPos(pButton);
78 if(nPos != -1)
79 SelectButtonImpl(nPos);
83 enum class PageType
85 Area,
86 Gradient,
87 Hatch,
88 Bitmap,
89 Shadow,
90 Transparence,
93 class SvxAreaTabDialog final : public SfxTabDialogController
95 SdrModel* mpDrawModel;
97 XColorListRef mpColorList;
98 XColorListRef mpNewColorList;
99 XGradientListRef mpGradientList;
100 XGradientListRef mpNewGradientList;
101 XHatchListRef mpHatchingList;
102 XHatchListRef mpNewHatchingList;
103 XBitmapListRef mpBitmapList;
104 XBitmapListRef mpNewBitmapList;
105 XPatternListRef mpPatternList;
106 XPatternListRef mpNewPatternList;
108 ChangeType mnColorListState;
109 ChangeType mnBitmapListState;
110 ChangeType mnPatternListState;
111 ChangeType mnGradientListState;
112 ChangeType mnHatchingListState;
114 virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
116 virtual short Ok() override;
117 DECL_LINK(CancelHdlImpl, weld::Button&, void);
118 void SavePalettes();
120 public:
121 SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow);
123 void SetNewColorList( XColorListRef const & pColorList )
124 { mpNewColorList = pColorList; }
125 const XColorListRef& GetNewColorList() const { return mpNewColorList; }
128 /************************************************************************/
130 class SvxTransparenceTabPage : public SfxTabPage
132 using TabPage::ActivatePage;
133 using TabPage::DeactivatePage;
134 static const sal_uInt16 pTransparenceRanges[];
136 const SfxItemSet& rOutAttrs;
138 PageType nPageType;
139 sal_uInt16 nDlgType;
141 bool bBitmap;
143 XFillAttrSetItem aXFillAttr;
144 SfxItemSet& rXFSet;
146 SvxXRectPreview m_aCtlBitmapPreview;
147 SvxXRectPreview m_aCtlXRectPreview;
149 // main selection
150 std::unique_ptr<weld::RadioButton> m_xRbtTransOff;
151 std::unique_ptr<weld::RadioButton> m_xRbtTransLinear;
152 std::unique_ptr<weld::RadioButton> m_xRbtTransGradient;
154 /// linear transparency
155 std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
157 // gradient transparency
158 std::unique_ptr<weld::Widget> m_xGridGradient;
159 std::unique_ptr<weld::ComboBox> m_xLbTrgrGradientType;
160 std::unique_ptr<weld::Label> m_xFtTrgrCenterX;
161 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterX;
162 std::unique_ptr<weld::Label> m_xFtTrgrCenterY;
163 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterY;
164 std::unique_ptr<weld::Label> m_xFtTrgrAngle;
165 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrAngle;
166 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrBorder;
167 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrStartValue;
168 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrEndValue;
169 std::unique_ptr<weld::Widget> m_xCtlBitmapBorder;
170 std::unique_ptr<weld::Widget> m_xCtlXRectBorder;
172 // preview
173 std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
174 std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
176 DECL_LINK(ClickTransOffHdl_Impl, weld::ToggleButton&, void);
177 DECL_LINK(ClickTransLinearHdl_Impl, weld::ToggleButton&, void);
178 DECL_LINK(ClickTransGradientHdl_Impl, weld::ToggleButton&, void );
179 DECL_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
180 DECL_LINK(ModifiedTrgrEditHdl_Impl, weld::MetricSpinButton&, void);
181 DECL_LINK(ModifiedTrgrListBoxHdl_Impl, weld::ComboBox&, void);
182 void ModifiedTrgrHdl_Impl(const weld::ComboBox*);
184 void ActivateLinear(bool bActivate);
185 void ActivateGradient(bool bActivate);
186 void SetControlState_Impl(css::awt::GradientStyle eXGS);
188 bool InitPreview ( const SfxItemSet& rSet );
189 void InvalidatePreview (bool bEnable = true );
191 public:
192 SvxTransparenceTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
193 virtual ~SvxTransparenceTabPage() override;
195 static VclPtr<SfxTabPage> Create(TabPageParent, const SfxItemSet*);
196 static const sal_uInt16* GetRanges() { return pTransparenceRanges; }
198 virtual bool FillItemSet(SfxItemSet*) override;
199 virtual void Reset(const SfxItemSet*) override;
200 virtual void ChangesApplied() override;
201 virtual void ActivatePage(const SfxItemSet& rSet) override;
202 virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override;
204 void SetPageType(PageType nInType) { nPageType = nInType; }
205 void SetDlgType(sal_uInt16 nInType) { nDlgType = nInType; }
206 virtual void PageCreated(const SfxAllItemSet& aSet) override;
209 /************************************************************************/
211 class SvxAreaTabPage : public SfxTabPage
213 static const sal_uInt16 pAreaRanges[];
214 private:
215 ScopedVclPtr<SfxTabPage> m_pFillTabPage;
216 ButtonBox maBox;
218 XColorListRef m_pColorList;
219 XGradientListRef m_pGradientList;
220 XHatchListRef m_pHatchingList;
221 XBitmapListRef m_pBitmapList;
222 XPatternListRef m_pPatternList;
224 // Placeholders for pointer-based entries; these will be inited
225 // to point to these so that the page is usable without that
226 // SvxAreaTabDialog has to call the setter methods (e.g. SetColorChgd).
227 // Without that the pages used in SvxAreaTabDialog are not usable
228 ChangeType maFixed_ChangeType;
230 ChangeType* m_pnColorListState;
231 ChangeType* m_pnBitmapListState;
232 ChangeType* m_pnPatternListState;
233 ChangeType* m_pnGradientListState;
234 ChangeType* m_pnHatchingListState;
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::ToggleButton> m_xBtnNone;
244 std::unique_ptr<weld::ToggleButton> m_xBtnColor;
245 std::unique_ptr<weld::ToggleButton> m_xBtnGradient;
246 std::unique_ptr<weld::ToggleButton> m_xBtnHatch;
247 std::unique_ptr<weld::ToggleButton> m_xBtnBitmap;
248 std::unique_ptr<weld::ToggleButton> m_xBtnPattern;
250 void SetOptimalSize(weld::DialogController* pController);
252 void SelectFillType( weld::ToggleButton& rButton, const SfxItemSet* _pSet = nullptr );
253 SfxTabPage* GetFillTabPage() { return m_pFillTabPage; }
255 bool IsBtnClicked() { return m_bBtnClicked; }
257 private:
258 DECL_LINK(SelectFillTypeHdl_Impl, weld::ToggleButton&, 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 using TabPage::ActivatePage;
269 using TabPage::DeactivatePage;
271 SvxAreaTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
272 virtual ~SvxAreaTabPage() override;
273 virtual void dispose() override;
275 static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
276 static const sal_uInt16* GetRanges() { return pAreaRanges; }
278 virtual bool FillItemSet( SfxItemSet* ) override;
279 virtual void Reset( const SfxItemSet * ) override;
280 virtual void ActivatePage( const SfxItemSet& rSet ) override;
281 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
283 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
284 void SetGradientList( XGradientListRef const & pGrdLst)
285 { m_pGradientList = pGrdLst; }
286 void SetHatchingList( XHatchListRef const & pHtchLst)
287 { m_pHatchingList = pHtchLst; }
288 void SetBitmapList( XBitmapListRef const & pBmpLst) { m_pBitmapList = pBmpLst; }
289 void SetPatternList( XPatternListRef const &pPtrnLst ) { m_pPatternList = pPtrnLst; }
290 virtual void PageCreated(const SfxAllItemSet& aSet) override;
291 void CreatePage(sal_Int32 nId, SfxTabPage* pTab);
292 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
293 void SetGrdChgd( ChangeType* pIn ) { m_pnGradientListState = pIn; }
294 void SetHtchChgd( ChangeType* pIn ) { m_pnHatchingListState = pIn; }
295 void SetBmpChgd( ChangeType* pIn ) { m_pnBitmapListState = pIn; }
296 void SetPtrnChgd( ChangeType* pIn ) { m_pnPatternListState = pIn; }
300 class SvxShadowTabPage : public SvxTabPage
302 using TabPage::ActivatePage;
303 using TabPage::DeactivatePage;
304 static const sal_uInt16 pShadowRanges[];
306 private:
307 const SfxItemSet& m_rOutAttrs;
309 XColorListRef m_pColorList;
310 ChangeType* m_pnColorListState;
311 PageType m_nPageType;
312 sal_uInt16 m_nDlgType;
314 XFillAttrSetItem m_aXFillAttr;
315 SfxItemSet& m_rXFSet;
316 MapUnit m_ePoolUnit;
318 SvxRectCtl m_aCtlPosition;
319 SvxXShadowPreview m_aCtlXRectPreview;
320 std::unique_ptr<weld::CheckButton> m_xTsbShowShadow;
321 std::unique_ptr<weld::Widget> m_xGridShadow;
322 std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
323 std::unique_ptr<ColorListBox> m_xLbShadowColor;
324 std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
325 std::unique_ptr<weld::CustomWeld> m_xCtlPosition;
326 std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
328 DECL_LINK(ClickShadowHdl_Impl, weld::ToggleButton&, void);
329 DECL_LINK(ModifyShadowHdl_Impl, weld::MetricSpinButton&, void);
330 DECL_LINK(SelectShadowHdl_Impl, ColorListBox&, void);
332 public:
333 SvxShadowTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
334 virtual ~SvxShadowTabPage() override;
335 virtual void dispose() override;
337 static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
338 static const sal_uInt16* GetRanges() { return pShadowRanges; }
340 virtual bool FillItemSet( SfxItemSet* ) override;
341 virtual void Reset( const SfxItemSet * ) override;
342 virtual void ActivatePage( const SfxItemSet& rSet ) override;
343 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
344 virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
346 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
347 void SetPageType( PageType nInType ) { m_nPageType = nInType; }
348 void SetDlgType( sal_uInt16 nInType ) { m_nDlgType = nInType; }
349 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
350 virtual void PageCreated(const SfxAllItemSet& aSet) override;
353 /************************************************************************/
355 class SvxGradientTabPage : public SfxTabPage
357 using TabPage::ActivatePage;
358 using TabPage::DeactivatePage;
360 private:
361 const SfxItemSet& m_rOutAttrs;
363 XColorListRef m_pColorList;
364 XGradientListRef m_pGradientList;
366 ChangeType* m_pnGradientListState;
367 ChangeType* m_pnColorListState;
369 XFillAttrSetItem m_aXFillAttr;
370 SfxItemSet& m_rXFSet;
372 SvxXRectPreview m_aCtlPreview;
373 std::unique_ptr<weld::ComboBox> m_xLbGradientType;
374 std::unique_ptr<weld::Label> m_xFtCenter;
375 std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterX;
376 std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterY;
377 std::unique_ptr<weld::Label> m_xFtAngle;
378 std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
379 std::unique_ptr<weld::Scale> m_xSliderAngle;
380 std::unique_ptr<weld::MetricSpinButton> m_xMtrBorder;
381 std::unique_ptr<weld::Scale> m_xSliderBorder;
382 std::unique_ptr<ColorListBox> m_xLbColorFrom;
383 std::unique_ptr<weld::MetricSpinButton> m_xMtrColorFrom;
384 std::unique_ptr<ColorListBox> m_xLbColorTo;
385 std::unique_ptr<weld::MetricSpinButton> m_xMtrColorTo;
386 std::unique_ptr<SvxPresetListBox> m_xGradientLB;
387 std::unique_ptr<weld::SpinButton> m_xMtrIncrement;
388 std::unique_ptr<weld::CheckButton> m_xCbIncrement;
389 std::unique_ptr<weld::Button> m_xBtnAdd;
390 std::unique_ptr<weld::Button> m_xBtnModify;
391 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
392 std::unique_ptr<weld::CustomWeld> m_xGradientLBWin;
394 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
395 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
396 DECL_LINK( ChangeGradientHdl, SvtValueSet*, void );
397 void ChangeGradientHdl_Impl();
398 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
399 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
400 DECL_LINK( ModifiedEditHdl_Impl, weld::SpinButton&, void );
401 DECL_LINK( ModifiedMetricHdl_Impl, weld::MetricSpinButton&, void );
402 DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
403 DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
404 DECL_LINK( ChangeAutoStepHdl_Impl, weld::ToggleButton&, void );
405 DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
406 void ModifiedHdl_Impl(void const *);
408 void SetControlState_Impl( css::awt::GradientStyle eXGS );
409 sal_Int32 SearchGradientList(const OUString& rGradientName);
411 public:
412 SvxGradientTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
413 virtual ~SvxGradientTabPage() override;
414 virtual void dispose() override;
416 void Construct();
418 static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
419 virtual bool FillItemSet( SfxItemSet* ) override;
420 virtual void Reset( const SfxItemSet * ) override;
422 virtual void ActivatePage( const SfxItemSet& rSet ) override;
423 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
425 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
426 void SetGradientList( XGradientListRef const & pGrdLst)
427 { m_pGradientList = pGrdLst; }
428 void SetGrdChgd( ChangeType* pIn ) { m_pnGradientListState = pIn; }
429 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
432 /************************************************************************/
434 class SvxHatchTabPage : public SfxTabPage
436 using TabPage::ActivatePage;
437 using TabPage::DeactivatePage;
439 private:
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;
451 MapUnit m_ePoolUnit;
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, SvtValueSet*, 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::ToggleButton&, 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(const OUString& rHatchName);
483 public:
484 SvxHatchTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
485 virtual ~SvxHatchTabPage() override;
486 virtual void dispose() override;
488 void Construct();
490 static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
491 virtual bool FillItemSet( SfxItemSet* ) override;
492 virtual void Reset( const SfxItemSet * ) override;
494 virtual void ActivatePage( const SfxItemSet& rSet ) override;
495 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
497 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
498 void SetHatchingList( XHatchListRef const & pHtchLst)
499 { m_pHatchingList = pHtchLst; }
501 void SetHtchChgd( ChangeType* pIn ) { m_pnHatchingListState = pIn; }
502 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
504 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
507 /************************************************************************/
509 class SvxBitmapTabPage : public SfxTabPage
511 using TabPage::ActivatePage;
512 using TabPage::DeactivatePage;
513 static const sal_uInt16 pBitmapRanges[];
514 private:
516 const SfxItemSet& m_rOutAttrs;
518 XBitmapListRef m_pBitmapList;
519 ChangeType* m_pnBitmapListState;
521 double m_fObjectWidth;
522 double m_fObjectHeight;
523 bool m_bLogicalSize;
525 XFillAttrSetItem m_aXFillAttr;
526 SfxItemSet& m_rXFSet;
527 const SdrView* mpView;
528 MapUnit mePoolUnit;
529 FieldUnit meFieldUnit;
530 Size rBitmapSize;
531 Size rFilledSize;
532 Size rZoomedSize;
534 SvxXRectPreview m_aCtlBitmapPreview;
535 std::unique_ptr<SvxPresetListBox> m_xBitmapLB;
536 std::unique_ptr<weld::ComboBox> m_xBitmapStyleLB;
537 std::unique_ptr<weld::Container> m_xSizeBox;
538 std::unique_ptr<weld::CheckButton> m_xTsbScale;
539 std::unique_ptr<weld::MetricSpinButton> m_xBitmapWidth;
540 std::unique_ptr<weld::MetricSpinButton> m_xBitmapHeight;
541 std::unique_ptr<weld::Container> m_xPositionBox;
542 std::unique_ptr<weld::ComboBox> m_xPositionLB;
543 std::unique_ptr<weld::Container> m_xPositionOffBox;
544 std::unique_ptr<weld::MetricSpinButton> m_xPositionOffX;
545 std::unique_ptr<weld::MetricSpinButton> m_xPositionOffY;
546 std::unique_ptr<weld::Container> m_xTileOffBox;
547 std::unique_ptr<weld::ComboBox> m_xTileOffLB;
548 std::unique_ptr<weld::MetricSpinButton> m_xTileOffset;
549 std::unique_ptr<weld::Button> m_xBtnImport;
550 std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
551 std::unique_ptr<weld::CustomWeld> m_xBitmapLBWin;
553 DECL_LINK( ModifyBitmapHdl, SvtValueSet*, void );
554 DECL_LINK( ClickScaleHdl, weld::Button&, void );
555 DECL_LINK( ModifyBitmapStyleHdl, weld::ComboBox&, void );
556 DECL_LINK( ModifyBitmapSizeHdl, weld::MetricSpinButton&, void );
557 DECL_LINK( ModifyBitmapPositionHdl, weld::ComboBox&, void );
558 DECL_LINK( ModifyPositionOffsetHdl, weld::MetricSpinButton&, void );
559 DECL_LINK( ModifyTileOffsetHdl, weld::MetricSpinButton&, void );
560 DECL_LINK( ClickRenameHdl, SvxPresetListBox*, void );
561 DECL_LINK( ClickDeleteHdl, SvxPresetListBox*, void );
562 DECL_LINK( ClickImportHdl, weld::Button&, void );
563 void ClickBitmapHdl_Impl();
564 void CalculateBitmapPresetSize();
565 sal_Int32 SearchBitmapList(const OUString& rBitmapName);
566 sal_Int32 SearchBitmapList(const GraphicObject& rGraphicObject);
568 public:
569 SvxBitmapTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
570 virtual ~SvxBitmapTabPage() override;
571 virtual void dispose() override;
573 void Construct();
575 static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
577 virtual bool FillItemSet( SfxItemSet* ) override;
578 virtual void Reset( const SfxItemSet * ) override;
579 virtual void ActivatePage( const SfxItemSet& rSet ) override;
580 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
582 void SetBitmapList( const XBitmapListRef& pBmpLst) { m_pBitmapList = pBmpLst; }
583 void SetBmpChgd( ChangeType* pIn ) { m_pnBitmapListState = pIn; }
586 /************************************************************************/
588 class SvxPatternTabPage : public SvxTabPage
590 using TabPage::ActivatePage;
591 using TabPage::DeactivatePage;
593 private:
594 const SfxItemSet& m_rOutAttrs;
596 XColorListRef m_pColorList;
597 XPatternListRef m_pPatternList;
599 ChangeType* m_pnPatternListState;
600 ChangeType* m_pnColorListState;
602 XFillAttrSetItem m_aXFillAttr;
603 SfxItemSet& m_rXFSet;
605 SvxXRectPreview m_aCtlPreview;
606 std::unique_ptr<SvxPixelCtl> m_xCtlPixel;
607 std::unique_ptr<ColorListBox> m_xLbColor;
608 std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
609 std::unique_ptr<SvxPresetListBox> m_xPatternLB;
610 std::unique_ptr<weld::Button> m_xBtnAdd;
611 std::unique_ptr<weld::Button> m_xBtnModify;
612 std::unique_ptr<weld::CustomWeld> m_xCtlPixelWin;
613 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
614 std::unique_ptr<weld::CustomWeld> m_xPatternLBWin;
615 std::unique_ptr<SvxBitmapCtl> m_xBitmapCtl;
617 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
618 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
619 DECL_LINK( ChangePatternHdl_Impl, SvtValueSet*, void );
620 DECL_LINK( ChangeColorHdl_Impl, ColorListBox&, void );
621 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
622 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
624 sal_Int32 SearchPatternList(const OUString& rPatternName);
626 public:
627 SvxPatternTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
628 virtual ~SvxPatternTabPage() override;
629 virtual void dispose() override;
631 void Construct();
633 static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
634 virtual bool FillItemSet( SfxItemSet* ) override;
635 virtual void Reset( const SfxItemSet * ) override;
637 virtual void ActivatePage( const SfxItemSet& rSet ) override;
638 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
640 virtual void PointChanged( weld::DrawingArea*, RectPoint eRP ) override;
642 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
643 void SetPatternList( XPatternListRef const & pPatternList) { m_pPatternList = pPatternList; }
644 void SetPtrnChgd( ChangeType* pIn ) { m_pnPatternListState = pIn; }
645 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
646 void ChangeColor_Impl();
649 /************************************************************************/
651 enum class ColorModel
653 RGB,
654 CMYK
657 class SvxColorTabPage : public SfxTabPage
659 using TabPage::ActivatePage;
660 using TabPage::DeactivatePage;
662 private:
663 VclPtr<Window> mpTopDlg;
665 const SfxItemSet& rOutAttrs;
667 XColorListRef pColorList;
669 ChangeType* pnColorListState;
671 XFillAttrSetItem aXFillAttr;
672 SfxItemSet& rXFSet;
674 ColorModel eCM;
676 Color aPreviousColor;
677 Color aCurrentColor;
679 css::uno::Reference< css::uno::XComponentContext > m_context;
681 PaletteManager maPaletteManager;
682 SvxXRectPreview m_aCtlPreviewOld;
683 SvxXRectPreview m_aCtlPreviewNew;
684 std::unique_ptr<ColorValueSet> m_xValSetColorList;
685 std::unique_ptr<ColorValueSet> m_xValSetRecentList;
686 std::unique_ptr<weld::ComboBox> m_xSelectPalette;
687 std::unique_ptr<weld::RadioButton> m_xRbRGB;
688 std::unique_ptr<weld::RadioButton> m_xRbCMYK;
689 std::unique_ptr<weld::Widget> m_xRGBcustom;
690 std::unique_ptr<weld::Widget> m_xRGBpreset;
691 std::unique_ptr<weld::Entry> m_xRpreset;
692 std::unique_ptr<weld::Entry> m_xGpreset;
693 std::unique_ptr<weld::Entry> m_xBpreset;
694 std::unique_ptr<weld::SpinButton> m_xRcustom;
695 std::unique_ptr<weld::SpinButton> m_xGcustom;
696 std::unique_ptr<weld::SpinButton> m_xBcustom;
697 std::unique_ptr<weld::HexColorControl> m_xHexpreset;
698 std::unique_ptr<weld::HexColorControl> m_xHexcustom;
699 std::unique_ptr<weld::Widget> m_xCMYKcustom;
700 std::unique_ptr<weld::Widget> m_xCMYKpreset;
701 std::unique_ptr<weld::Entry> m_xCpreset;
702 std::unique_ptr<weld::Entry> m_xYpreset;
703 std::unique_ptr<weld::Entry> m_xMpreset;
704 std::unique_ptr<weld::Entry> m_xKpreset;
705 std::unique_ptr<weld::MetricSpinButton> m_xCcustom;
706 std::unique_ptr<weld::MetricSpinButton> m_xYcustom;
707 std::unique_ptr<weld::MetricSpinButton> m_xMcustom;
708 std::unique_ptr<weld::MetricSpinButton> m_xKcustom;
709 std::unique_ptr<weld::Button> m_xBtnAdd;
710 std::unique_ptr<weld::Button> m_xBtnDelete;
711 std::unique_ptr<weld::Button> m_xBtnWorkOn;
712 std::unique_ptr<weld::CustomWeld> m_xCtlPreviewOld;
713 std::unique_ptr<weld::CustomWeld> m_xCtlPreviewNew;
714 std::unique_ptr<weld::CustomWeld> m_xValSetColorListWin;
715 std::unique_ptr<weld::CustomWeld> m_xValSetRecentListWin;
717 static void ConvertColorValues (Color& rColor, ColorModel eModell);
718 static void RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK );
719 static void CmykToRgb_Impl( Color& rColor, const sal_uInt16 nKey );
720 sal_uInt16 ColorToPercent_Impl( sal_uInt16 nColor );
721 sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent );
723 void ImpColorCountChanged();
724 void FillPaletteLB();
726 DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
727 DECL_LINK(ClickWorkOnHdl_Impl, weld::Button&, void);
728 DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void);
730 DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
731 DECL_LINK( SelectValSetHdl_Impl, SvtValueSet*, void );
732 DECL_LINK( SelectColorModeHdl_Impl, weld::ToggleButton&, void );
733 void ChangeColor(const Color &rNewColor, bool bUpdatePreset = true);
734 void SetColorModel(ColorModel eModel);
735 void ChangeColorModel();
736 void UpdateColorValues( bool bUpdatePreset = true );
737 DECL_LINK(SpinValueHdl_Impl, weld::SpinButton&, void);
738 DECL_LINK(MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void);
739 DECL_LINK(ModifiedHdl_Impl, weld::Entry&, void);
741 void UpdateModified();
743 static sal_Int32 FindInCustomColors( OUString const & aColorName );
744 sal_Int32 FindInPalette( const Color& rColor );
746 public:
747 SvxColorTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
748 virtual ~SvxColorTabPage() override;
749 virtual void dispose() override;
751 void Construct();
753 static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
754 virtual bool FillItemSet( SfxItemSet* ) override;
755 virtual void Reset( const SfxItemSet * ) override;
757 virtual void ActivatePage( const SfxItemSet& rSet ) override;
758 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
760 void SetPropertyList( XPropertyListType t, const XPropertyListRef &xRef );
761 void SetColorList( const XColorListRef& pColList );
764 void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; }
766 void SetCtlPreviewOld( SfxItemSet& rAttrs ) { m_aCtlPreviewOld.SetAttributes( rAttrs ); }
768 virtual void FillUserData() override;
771 #endif // INCLUDED_CUI_SOURCE_INC_CUITABAREA_HXX
773 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */