bump product version to 6.4.0.3
[LibreOffice.git] / cui / source / inc / cuitabarea.hxx
blob0ef979f11c85881914313bc18b472194bf80b9e2
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/xflasit.hxx>
25 #include <svx/tabarea.hxx>
26 #include <svx/hexcolorcontrol.hxx>
27 #include <svx/SvxColorValueSet.hxx>
28 #include <svx/SvxPresetListBox.hxx>
29 #include <svx/PaletteManager.hxx>
30 #include <svx/svdview.hxx>
32 #define NO_BUTTON_SELECTED -1
34 class ColorListBox;
35 class SdrModel;
36 class SvxBitmapCtl;
37 class SvxColorListBox;
39 /************************************************************************/
40 class ButtonBox
42 private:
43 sal_Int32 mnCurrentButton;
44 std::vector<weld::ToggleButton*> maButtonList;
45 std::map<weld::ToggleButton*, sal_Int32 > maButtonToPos;
46 void SelectButtonImpl( sal_Int32 nPos )
48 if(mnCurrentButton != NO_BUTTON_SELECTED)
50 maButtonList[mnCurrentButton]->set_active(false);
52 mnCurrentButton = nPos;
53 maButtonList[mnCurrentButton]->set_active(true);
55 public:
56 ButtonBox()
58 mnCurrentButton = NO_BUTTON_SELECTED;
60 void AddButton(weld::ToggleButton* pButton)
62 maButtonList.push_back(pButton);
63 maButtonToPos.insert( std::make_pair(pButton, maButtonList.size() - 1) );
65 sal_Int32 GetCurrentButtonPos() const { return mnCurrentButton; }
66 sal_Int32 GetButtonPos(weld::ToggleButton* pButton)
68 std::map<weld::ToggleButton*, sal_Int32>::const_iterator aBtnPos = maButtonToPos.find(pButton);
69 if(aBtnPos != maButtonToPos.end())
70 return aBtnPos->second;
71 else
72 return -1;
74 void SelectButton(weld::ToggleButton* pButton)
76 sal_Int32 nPos = GetButtonPos(pButton);
77 if(nPos != -1)
78 SelectButtonImpl(nPos);
82 enum class PageType
84 Area,
85 Gradient,
86 Hatch,
87 Bitmap,
88 Shadow,
89 Transparence,
92 class SvxAreaTabDialog final : public SfxTabDialogController
94 SdrModel* mpDrawModel;
96 XColorListRef mpColorList;
97 XColorListRef mpNewColorList;
98 XGradientListRef mpGradientList;
99 XGradientListRef mpNewGradientList;
100 XHatchListRef mpHatchingList;
101 XHatchListRef mpNewHatchingList;
102 XBitmapListRef mpBitmapList;
103 XBitmapListRef mpNewBitmapList;
104 XPatternListRef mpPatternList;
105 XPatternListRef mpNewPatternList;
107 ChangeType mnColorListState;
108 ChangeType mnBitmapListState;
109 ChangeType mnPatternListState;
110 ChangeType mnGradientListState;
111 ChangeType mnHatchingListState;
113 virtual void PageCreated(const OString& 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);
122 void SetNewColorList( XColorListRef const & pColorList )
123 { mpNewColorList = pColorList; }
124 const XColorListRef& GetNewColorList() const { return mpNewColorList; }
127 /************************************************************************/
129 class SvxTransparenceTabPage : public SfxTabPage
131 static const sal_uInt16 pTransparenceRanges[];
133 const SfxItemSet& rOutAttrs;
135 PageType nPageType;
136 sal_uInt16 nDlgType;
138 bool bBitmap;
140 XFillAttrSetItem aXFillAttr;
141 SfxItemSet& rXFSet;
143 SvxXRectPreview m_aCtlBitmapPreview;
144 SvxXRectPreview m_aCtlXRectPreview;
146 // main selection
147 std::unique_ptr<weld::RadioButton> m_xRbtTransOff;
148 std::unique_ptr<weld::RadioButton> m_xRbtTransLinear;
149 std::unique_ptr<weld::RadioButton> m_xRbtTransGradient;
151 /// linear transparency
152 std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
154 // gradient transparency
155 std::unique_ptr<weld::Widget> m_xGridGradient;
156 std::unique_ptr<weld::ComboBox> m_xLbTrgrGradientType;
157 std::unique_ptr<weld::Label> m_xFtTrgrCenterX;
158 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterX;
159 std::unique_ptr<weld::Label> m_xFtTrgrCenterY;
160 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterY;
161 std::unique_ptr<weld::Label> m_xFtTrgrAngle;
162 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrAngle;
163 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrBorder;
164 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrStartValue;
165 std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrEndValue;
166 std::unique_ptr<weld::Widget> m_xCtlBitmapBorder;
167 std::unique_ptr<weld::Widget> m_xCtlXRectBorder;
169 // preview
170 std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
171 std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
173 DECL_LINK(ClickTransOffHdl_Impl, weld::ToggleButton&, void);
174 DECL_LINK(ClickTransLinearHdl_Impl, weld::ToggleButton&, void);
175 DECL_LINK(ClickTransGradientHdl_Impl, weld::ToggleButton&, void );
176 DECL_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
177 DECL_LINK(ModifiedTrgrEditHdl_Impl, weld::MetricSpinButton&, void);
178 DECL_LINK(ModifiedTrgrListBoxHdl_Impl, weld::ComboBox&, void);
179 void ModifiedTrgrHdl_Impl(const weld::ComboBox*);
181 void ActivateLinear(bool bActivate);
182 void ActivateGradient(bool bActivate);
183 void SetControlState_Impl(css::awt::GradientStyle eXGS);
185 bool InitPreview ( const SfxItemSet& rSet );
186 void InvalidatePreview (bool bEnable = true );
188 public:
189 SvxTransparenceTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
190 virtual ~SvxTransparenceTabPage() override;
192 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
193 static const sal_uInt16* GetRanges() { return pTransparenceRanges; }
195 virtual bool FillItemSet(SfxItemSet*) override;
196 virtual void Reset(const SfxItemSet*) override;
197 virtual void ChangesApplied() override;
198 virtual void ActivatePage(const SfxItemSet& rSet) override;
199 virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override;
201 void SetPageType(PageType nInType) { nPageType = nInType; }
202 void SetDlgType(sal_uInt16 nInType) { nDlgType = nInType; }
203 virtual void PageCreated(const SfxAllItemSet& aSet) override;
206 /************************************************************************/
208 class SvxAreaTabPage : public SfxTabPage
210 static const sal_uInt16 pAreaRanges[];
211 private:
212 std::unique_ptr<SfxTabPage> m_xFillTabPage;
213 ButtonBox maBox;
215 XColorListRef m_pColorList;
216 XGradientListRef m_pGradientList;
217 XHatchListRef m_pHatchingList;
218 XBitmapListRef m_pBitmapList;
219 XPatternListRef m_pPatternList;
221 // Placeholders for pointer-based entries; these will be inited
222 // to point to these so that the page is usable without that
223 // SvxAreaTabDialog has to call the setter methods (e.g. SetColorChgd).
224 // Without that the pages used in SvxAreaTabDialog are not usable
225 ChangeType maFixed_ChangeType;
227 ChangeType* m_pnColorListState;
228 ChangeType* m_pnBitmapListState;
229 ChangeType* m_pnPatternListState;
230 ChangeType* m_pnGradientListState;
231 ChangeType* m_pnHatchingListState;
233 XFillAttrSetItem m_aXFillAttr;
234 SfxItemSet& m_rXFSet;
236 bool m_bBtnClicked = false;
238 protected:
239 std::unique_ptr<weld::Container> m_xFillTab;
240 std::unique_ptr<weld::ToggleButton> m_xBtnNone;
241 std::unique_ptr<weld::ToggleButton> m_xBtnColor;
242 std::unique_ptr<weld::ToggleButton> m_xBtnGradient;
243 std::unique_ptr<weld::ToggleButton> m_xBtnHatch;
244 std::unique_ptr<weld::ToggleButton> m_xBtnBitmap;
245 std::unique_ptr<weld::ToggleButton> m_xBtnPattern;
247 void SetOptimalSize(weld::DialogController* pController);
249 void SelectFillType( weld::ToggleButton& rButton, const SfxItemSet* _pSet = nullptr );
250 SfxTabPage* GetFillTabPage() { return m_xFillTabPage.get(); }
252 bool IsBtnClicked() const { return m_bBtnClicked; }
254 private:
255 DECL_LINK(SelectFillTypeHdl_Impl, weld::ToggleButton&, void);
257 template< typename TabPage >
258 bool FillItemSet_Impl( SfxItemSet* );
259 template< typename TabPage >
260 void Reset_Impl( const SfxItemSet* );
261 template< typename TabPage >
262 DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet );
264 public:
265 SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
266 virtual ~SvxAreaTabPage() override;
268 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
269 static const sal_uInt16* GetRanges() { return pAreaRanges; }
271 virtual bool FillItemSet( SfxItemSet* ) override;
272 virtual void Reset( const SfxItemSet * ) override;
273 virtual void ActivatePage( const SfxItemSet& rSet ) override;
274 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
276 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
277 void SetGradientList( XGradientListRef const & pGrdLst)
278 { m_pGradientList = pGrdLst; }
279 void SetHatchingList( XHatchListRef const & pHtchLst)
280 { m_pHatchingList = pHtchLst; }
281 void SetBitmapList( XBitmapListRef const & pBmpLst) { m_pBitmapList = pBmpLst; }
282 void SetPatternList( XPatternListRef const &pPtrnLst ) { m_pPatternList = pPtrnLst; }
283 virtual void PageCreated(const SfxAllItemSet& aSet) override;
284 void CreatePage(sal_Int32 nId, SfxTabPage* pTab);
285 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
286 void SetGrdChgd( ChangeType* pIn ) { m_pnGradientListState = pIn; }
287 void SetHtchChgd( ChangeType* pIn ) { m_pnHatchingListState = pIn; }
288 void SetBmpChgd( ChangeType* pIn ) { m_pnBitmapListState = pIn; }
289 void SetPtrnChgd( ChangeType* pIn ) { m_pnPatternListState = pIn; }
293 class SvxShadowTabPage : public SvxTabPage
295 static const sal_uInt16 pShadowRanges[];
297 private:
298 const SfxItemSet& m_rOutAttrs;
300 XColorListRef m_pColorList;
301 ChangeType* m_pnColorListState;
302 PageType m_nPageType;
303 sal_uInt16 m_nDlgType;
305 XFillAttrSetItem m_aXFillAttr;
306 SfxItemSet& m_rXFSet;
307 MapUnit m_ePoolUnit;
309 SvxRectCtl m_aCtlPosition;
310 SvxXShadowPreview m_aCtlXRectPreview;
311 std::unique_ptr<weld::CheckButton> m_xTsbShowShadow;
312 std::unique_ptr<weld::Widget> m_xGridShadow;
313 std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
314 std::unique_ptr<ColorListBox> m_xLbShadowColor;
315 std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
316 std::unique_ptr<weld::CustomWeld> m_xCtlPosition;
317 std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
319 DECL_LINK(ClickShadowHdl_Impl, weld::ToggleButton&, void);
320 DECL_LINK(ModifyShadowHdl_Impl, weld::MetricSpinButton&, void);
321 DECL_LINK(SelectShadowHdl_Impl, ColorListBox&, void);
323 public:
324 SvxShadowTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
325 virtual ~SvxShadowTabPage() override;
327 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
328 static const sal_uInt16* GetRanges() { return pShadowRanges; }
330 virtual bool FillItemSet( SfxItemSet* ) override;
331 virtual void Reset( const SfxItemSet * ) override;
332 virtual void ActivatePage( const SfxItemSet& rSet ) override;
333 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
334 virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
336 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
337 void SetPageType( PageType nInType ) { m_nPageType = nInType; }
338 void SetDlgType( sal_uInt16 nInType ) { m_nDlgType = nInType; }
339 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
340 virtual void PageCreated(const SfxAllItemSet& aSet) override;
343 /************************************************************************/
345 class SvxGradientTabPage : public SfxTabPage
347 private:
348 const SfxItemSet& m_rOutAttrs;
350 XColorListRef m_pColorList;
351 XGradientListRef m_pGradientList;
353 ChangeType* m_pnGradientListState;
354 ChangeType* m_pnColorListState;
356 XFillAttrSetItem m_aXFillAttr;
357 SfxItemSet& m_rXFSet;
359 SvxXRectPreview m_aCtlPreview;
360 std::unique_ptr<weld::ComboBox> m_xLbGradientType;
361 std::unique_ptr<weld::Label> m_xFtCenter;
362 std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterX;
363 std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterY;
364 std::unique_ptr<weld::Label> m_xFtAngle;
365 std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
366 std::unique_ptr<weld::Scale> m_xSliderAngle;
367 std::unique_ptr<weld::MetricSpinButton> m_xMtrBorder;
368 std::unique_ptr<weld::Scale> m_xSliderBorder;
369 std::unique_ptr<ColorListBox> m_xLbColorFrom;
370 std::unique_ptr<weld::MetricSpinButton> m_xMtrColorFrom;
371 std::unique_ptr<ColorListBox> m_xLbColorTo;
372 std::unique_ptr<weld::MetricSpinButton> m_xMtrColorTo;
373 std::unique_ptr<SvxPresetListBox> m_xGradientLB;
374 std::unique_ptr<weld::SpinButton> m_xMtrIncrement;
375 std::unique_ptr<weld::CheckButton> m_xCbIncrement;
376 std::unique_ptr<weld::Button> m_xBtnAdd;
377 std::unique_ptr<weld::Button> m_xBtnModify;
378 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
379 std::unique_ptr<weld::CustomWeld> m_xGradientLBWin;
381 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
382 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
383 DECL_LINK( ChangeGradientHdl, SvtValueSet*, void );
384 void ChangeGradientHdl_Impl();
385 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
386 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
387 DECL_LINK( ModifiedEditHdl_Impl, weld::SpinButton&, void );
388 DECL_LINK( ModifiedMetricHdl_Impl, weld::MetricSpinButton&, void );
389 DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
390 DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
391 DECL_LINK( ChangeAutoStepHdl_Impl, weld::ToggleButton&, void );
392 DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
393 void ModifiedHdl_Impl(void const *);
395 void SetControlState_Impl( css::awt::GradientStyle eXGS );
396 sal_Int32 SearchGradientList(const OUString& rGradientName);
398 public:
399 SvxGradientTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
400 virtual ~SvxGradientTabPage() override;
402 void Construct();
404 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
405 virtual bool FillItemSet( SfxItemSet* ) override;
406 virtual void Reset( const SfxItemSet * ) override;
408 virtual void ActivatePage( const SfxItemSet& rSet ) override;
409 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
411 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
412 void SetGradientList( XGradientListRef const & pGrdLst)
413 { m_pGradientList = pGrdLst; }
414 void SetGrdChgd( ChangeType* pIn ) { m_pnGradientListState = pIn; }
415 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
418 /************************************************************************/
420 class SvxHatchTabPage : public SfxTabPage
422 private:
423 const SfxItemSet& m_rOutAttrs;
425 XColorListRef m_pColorList;
426 XHatchListRef m_pHatchingList;
428 ChangeType* m_pnHatchingListState;
429 ChangeType* m_pnColorListState;
431 XFillAttrSetItem m_aXFillAttr;
432 SfxItemSet& m_rXFSet;
434 MapUnit m_ePoolUnit;
436 SvxXRectPreview m_aCtlPreview;
437 std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
438 std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
439 std::unique_ptr<weld::Scale> m_xSliderAngle;
440 std::unique_ptr<weld::ComboBox> m_xLbLineType;
441 std::unique_ptr<ColorListBox> m_xLbLineColor;
442 std::unique_ptr<weld::CheckButton> m_xCbBackgroundColor;
443 std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
444 std::unique_ptr<SvxPresetListBox> m_xHatchLB;
445 std::unique_ptr<weld::Button> m_xBtnAdd;
446 std::unique_ptr<weld::Button> m_xBtnModify;
447 std::unique_ptr<weld::CustomWeld> m_xHatchLBWin;
448 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
450 DECL_LINK(ChangeHatchHdl, SvtValueSet*, void);
451 void ChangeHatchHdl_Impl();
452 DECL_LINK( ModifiedEditHdl_Impl, weld::MetricSpinButton&, void );
453 DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
454 DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
455 DECL_LINK( ToggleHatchBackgroundColor_Impl, weld::ToggleButton&, void );
456 DECL_LINK( ModifiedBackgroundHdl_Impl, ColorListBox&, void );
457 DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
458 void ModifiedHdl_Impl(void const *);
459 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
460 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
461 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
462 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
464 sal_Int32 SearchHatchList(const OUString& rHatchName);
466 public:
467 SvxHatchTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
468 virtual ~SvxHatchTabPage() override;
470 void Construct();
472 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
473 virtual bool FillItemSet( SfxItemSet* ) override;
474 virtual void Reset( const SfxItemSet * ) override;
476 virtual void ActivatePage( const SfxItemSet& rSet ) override;
477 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
479 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
480 void SetHatchingList( XHatchListRef const & pHtchLst)
481 { m_pHatchingList = pHtchLst; }
483 void SetHtchChgd( ChangeType* pIn ) { m_pnHatchingListState = pIn; }
484 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
487 /************************************************************************/
489 class SvxBitmapTabPage : public SfxTabPage
491 static const sal_uInt16 pBitmapRanges[];
492 private:
494 const SfxItemSet& m_rOutAttrs;
496 XBitmapListRef m_pBitmapList;
497 ChangeType* m_pnBitmapListState;
499 double m_fObjectWidth;
500 double m_fObjectHeight;
501 bool m_bLogicalSize;
503 XFillAttrSetItem m_aXFillAttr;
504 SfxItemSet& m_rXFSet;
505 const SdrView* mpView;
506 MapUnit mePoolUnit;
507 FieldUnit meFieldUnit;
508 Size rBitmapSize;
509 Size rFilledSize;
510 Size rZoomedSize;
512 SvxXRectPreview m_aCtlBitmapPreview;
513 std::unique_ptr<SvxPresetListBox> m_xBitmapLB;
514 std::unique_ptr<weld::ComboBox> m_xBitmapStyleLB;
515 std::unique_ptr<weld::Container> m_xSizeBox;
516 std::unique_ptr<weld::CheckButton> m_xTsbScale;
517 std::unique_ptr<weld::MetricSpinButton> m_xBitmapWidth;
518 std::unique_ptr<weld::MetricSpinButton> m_xBitmapHeight;
519 std::unique_ptr<weld::Container> m_xPositionBox;
520 std::unique_ptr<weld::ComboBox> m_xPositionLB;
521 std::unique_ptr<weld::Container> m_xPositionOffBox;
522 std::unique_ptr<weld::MetricSpinButton> m_xPositionOffX;
523 std::unique_ptr<weld::MetricSpinButton> m_xPositionOffY;
524 std::unique_ptr<weld::Container> m_xTileOffBox;
525 std::unique_ptr<weld::ComboBox> m_xTileOffLB;
526 std::unique_ptr<weld::MetricSpinButton> m_xTileOffset;
527 std::unique_ptr<weld::Button> m_xBtnImport;
528 std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
529 std::unique_ptr<weld::CustomWeld> m_xBitmapLBWin;
531 DECL_LINK( ModifyBitmapHdl, SvtValueSet*, void );
532 DECL_LINK( ClickScaleHdl, weld::Button&, void );
533 DECL_LINK( ModifyBitmapStyleHdl, weld::ComboBox&, void );
534 DECL_LINK( ModifyBitmapSizeHdl, weld::MetricSpinButton&, void );
535 DECL_LINK( ModifyBitmapPositionHdl, weld::ComboBox&, void );
536 DECL_LINK( ModifyPositionOffsetHdl, weld::MetricSpinButton&, void );
537 DECL_LINK( ModifyTileOffsetHdl, weld::MetricSpinButton&, void );
538 DECL_LINK( ClickRenameHdl, SvxPresetListBox*, void );
539 DECL_LINK( ClickDeleteHdl, SvxPresetListBox*, void );
540 DECL_LINK( ClickImportHdl, weld::Button&, void );
541 void ClickBitmapHdl_Impl();
542 void CalculateBitmapPresetSize();
543 sal_Int32 SearchBitmapList(const OUString& rBitmapName);
544 sal_Int32 SearchBitmapList(const GraphicObject& rGraphicObject);
546 public:
547 SvxBitmapTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
548 virtual ~SvxBitmapTabPage() override;
550 void Construct();
552 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
554 virtual bool FillItemSet( SfxItemSet* ) override;
555 virtual void Reset( const SfxItemSet * ) override;
556 virtual void ActivatePage( const SfxItemSet& rSet ) override;
557 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
559 void SetBitmapList( const XBitmapListRef& pBmpLst) { m_pBitmapList = pBmpLst; }
560 void SetBmpChgd( ChangeType* pIn ) { m_pnBitmapListState = pIn; }
563 /************************************************************************/
565 class SvxPatternTabPage : public SvxTabPage
567 private:
568 const SfxItemSet& m_rOutAttrs;
570 XColorListRef m_pColorList;
571 XPatternListRef m_pPatternList;
573 ChangeType* m_pnPatternListState;
574 ChangeType* m_pnColorListState;
576 XFillAttrSetItem m_aXFillAttr;
577 SfxItemSet& m_rXFSet;
579 SvxXRectPreview m_aCtlPreview;
580 std::unique_ptr<SvxPixelCtl> m_xCtlPixel;
581 std::unique_ptr<ColorListBox> m_xLbColor;
582 std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
583 std::unique_ptr<SvxPresetListBox> m_xPatternLB;
584 std::unique_ptr<weld::Button> m_xBtnAdd;
585 std::unique_ptr<weld::Button> m_xBtnModify;
586 std::unique_ptr<weld::CustomWeld> m_xCtlPixelWin;
587 std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
588 std::unique_ptr<weld::CustomWeld> m_xPatternLBWin;
589 std::unique_ptr<SvxBitmapCtl> m_xBitmapCtl;
591 DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
592 DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
593 DECL_LINK( ChangePatternHdl_Impl, SvtValueSet*, void );
594 DECL_LINK( ChangeColorHdl_Impl, ColorListBox&, void );
595 DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
596 DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
598 sal_Int32 SearchPatternList(const OUString& rPatternName);
600 public:
601 SvxPatternTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
602 virtual ~SvxPatternTabPage() override;
604 void Construct();
606 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
607 virtual bool FillItemSet( SfxItemSet* ) override;
608 virtual void Reset( const SfxItemSet * ) override;
610 virtual void ActivatePage( const SfxItemSet& rSet ) override;
611 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
613 virtual void PointChanged( weld::DrawingArea*, RectPoint eRP ) override;
615 void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
616 void SetPatternList( XPatternListRef const & pPatternList) { m_pPatternList = pPatternList; }
617 void SetPtrnChgd( ChangeType* pIn ) { m_pnPatternListState = pIn; }
618 void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
619 void ChangeColor_Impl();
622 /************************************************************************/
624 enum class ColorModel
626 RGB,
627 CMYK
630 class SvxColorTabPage : public SfxTabPage
632 private:
633 const SfxItemSet& rOutAttrs;
635 XColorListRef pColorList;
637 ChangeType* pnColorListState;
639 XFillAttrSetItem aXFillAttr;
640 SfxItemSet& rXFSet;
642 ColorModel eCM;
644 Color aPreviousColor;
645 Color aCurrentColor;
647 css::uno::Reference< css::uno::XComponentContext > m_context;
649 PaletteManager maPaletteManager;
650 SvxXRectPreview m_aCtlPreviewOld;
651 SvxXRectPreview m_aCtlPreviewNew;
652 std::unique_ptr<ColorValueSet> m_xValSetColorList;
653 std::unique_ptr<ColorValueSet> m_xValSetRecentList;
654 std::unique_ptr<weld::ComboBox> m_xSelectPalette;
655 std::unique_ptr<weld::RadioButton> m_xRbRGB;
656 std::unique_ptr<weld::RadioButton> m_xRbCMYK;
657 std::unique_ptr<weld::Widget> m_xRGBcustom;
658 std::unique_ptr<weld::Widget> m_xRGBpreset;
659 std::unique_ptr<weld::Entry> m_xRpreset;
660 std::unique_ptr<weld::Entry> m_xGpreset;
661 std::unique_ptr<weld::Entry> m_xBpreset;
662 std::unique_ptr<weld::SpinButton> m_xRcustom;
663 std::unique_ptr<weld::SpinButton> m_xGcustom;
664 std::unique_ptr<weld::SpinButton> m_xBcustom;
665 std::unique_ptr<weld::HexColorControl> m_xHexpreset;
666 std::unique_ptr<weld::HexColorControl> m_xHexcustom;
667 std::unique_ptr<weld::Widget> m_xCMYKcustom;
668 std::unique_ptr<weld::Widget> m_xCMYKpreset;
669 std::unique_ptr<weld::Entry> m_xCpreset;
670 std::unique_ptr<weld::Entry> m_xYpreset;
671 std::unique_ptr<weld::Entry> m_xMpreset;
672 std::unique_ptr<weld::Entry> m_xKpreset;
673 std::unique_ptr<weld::MetricSpinButton> m_xCcustom;
674 std::unique_ptr<weld::MetricSpinButton> m_xYcustom;
675 std::unique_ptr<weld::MetricSpinButton> m_xMcustom;
676 std::unique_ptr<weld::MetricSpinButton> m_xKcustom;
677 std::unique_ptr<weld::Button> m_xBtnAdd;
678 std::unique_ptr<weld::Button> m_xBtnDelete;
679 std::unique_ptr<weld::Button> m_xBtnWorkOn;
680 std::unique_ptr<weld::CustomWeld> m_xCtlPreviewOld;
681 std::unique_ptr<weld::CustomWeld> m_xCtlPreviewNew;
682 std::unique_ptr<weld::CustomWeld> m_xValSetColorListWin;
683 std::unique_ptr<weld::CustomWeld> m_xValSetRecentListWin;
685 static void ConvertColorValues (Color& rColor, ColorModel eModell);
686 static void RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK );
687 static void CmykToRgb_Impl( Color& rColor, const sal_uInt16 nKey );
688 sal_uInt16 ColorToPercent_Impl( sal_uInt16 nColor );
689 sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent );
691 void ImpColorCountChanged();
692 void FillPaletteLB();
694 DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
695 DECL_LINK(ClickWorkOnHdl_Impl, weld::Button&, void);
696 DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void);
698 DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
699 DECL_LINK( SelectValSetHdl_Impl, SvtValueSet*, void );
700 DECL_LINK( SelectColorModeHdl_Impl, weld::ToggleButton&, void );
701 void ChangeColor(const Color &rNewColor, bool bUpdatePreset = true);
702 void SetColorModel(ColorModel eModel);
703 void ChangeColorModel();
704 void UpdateColorValues( bool bUpdatePreset = true );
705 DECL_LINK(SpinValueHdl_Impl, weld::SpinButton&, void);
706 DECL_LINK(MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void);
707 DECL_LINK(ModifiedHdl_Impl, weld::Entry&, void);
709 void UpdateModified();
711 static sal_Int32 FindInCustomColors( OUString const & aColorName );
712 sal_Int32 FindInPalette( const Color& rColor );
714 public:
715 SvxColorTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
716 virtual ~SvxColorTabPage() override;
718 void Construct();
720 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
721 virtual bool FillItemSet( SfxItemSet* ) override;
722 virtual void Reset( const SfxItemSet * ) override;
724 virtual void ActivatePage( const SfxItemSet& rSet ) override;
725 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
727 void SetPropertyList( XPropertyListType t, const XPropertyListRef &xRef );
728 void SetColorList( const XColorListRef& pColList );
731 void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; }
733 void SetCtlPreviewOld( const SfxItemSet& rAttrs ) { m_aCtlPreviewOld.SetAttributes( rAttrs ); }
735 virtual void FillUserData() override;
738 #endif // INCLUDED_CUI_SOURCE_INC_CUITABAREA_HXX
740 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */