LibreOffice Module svx (master)  1
AreaPropertyPanelBase.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX
20 #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX
21 
22 #include <memory>
25 #include <svx/colorbox.hxx>
26 #include <svx/xgrad.hxx>
27 #include <svx/xfillit0.hxx>
28 #include <svx/xflclit.hxx>
29 #include <svx/xflgrit.hxx>
30 #include <svx/xflhtit.hxx>
31 #include <svx/xbtmpit.hxx>
33 #include <svl/intitem.hxx>
34 #include <svx/svxdllapi.h>
35 #include <sfx2/sidebar/Panel.hxx>
36 
40 class XFillStyleItem;
41 class XFillGradientItem;
42 class XFillColorItem;
43 class XFillHatchItem;
44 class XFillBitmapItem;
45 
46 namespace svx::sidebar {
47 
49 : public PanelLayout,
51 {
52 public:
53 
54  virtual void dispose() override;
55 
56  virtual void DataChanged(
57  const DataChangedEvent& rEvent) override;
58 
59  virtual void NotifyItemUpdate(
60  const sal_uInt16 nSId,
61  const SfxItemState eState,
62  const SfxPoolItem* pState) override;
63 
64  virtual void GetControlState(
65  const sal_uInt16 /*nSId*/,
66  boost::property_tree::ptree& /*rState*/) override {};
67 
68  const static sal_Int32 DEFAULT_CENTERX;
69  const static sal_Int32 DEFAULT_CENTERY;
70  const static sal_Int32 DEFAULT_ANGLE;
71  const static sal_Int32 DEFAULT_STARTVALUE;
72  const static sal_Int32 DEFAULT_ENDVALUE;
73  const static sal_Int32 DEFAULT_BORDER;
74 
75  const XGradient& GetGradient (const css::awt::GradientStyle eStyle) const;
76  void SetGradient (const XGradient& rGradient);
77  sal_Int32 GetSelectedTransparencyTypeIndex() const;
78 
79  // constructor/destructor
81  vcl::Window* pParent,
82  const css::uno::Reference<css::frame::XFrame>& rxFrame);
83 
84  virtual ~AreaPropertyPanelBase() override;
85 
86  virtual void setFillTransparence(const XFillTransparenceItem& rItem) = 0;
87  virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) = 0;
88  virtual void setFillStyle(const XFillStyleItem& rItem) = 0;
89  virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& aColorItem) = 0;
90  virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& aGradientItem) = 0;
91  virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& aHatchItem) = 0;
92  virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& aHatchItem) = 0;
93 
94  void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
95  void updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
96  void updateFillStyle(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
97  void updateFillGradient(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
98  void updateFillHatch(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
99  void updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState);
100  void updateFillBitmap(bool BDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
101 
102 private:
103  void Initialize();
104 
105 protected:
106  sal_uInt16 meLastXFS;
107 
108  sal_Int32 mnLastPosHatch;
109  sal_Int32 mnLastPosBitmap;
110  sal_Int32 mnLastPosPattern;
111  sal_uInt16 mnLastTransSolid;
112 
119 
120  //ui controls
121  std::unique_ptr<weld::Label> mxColorTextFT;
122  std::unique_ptr<weld::ComboBox> mxLbFillType;
123  std::unique_ptr<weld::ComboBox> mxLbFillAttr;
124  std::unique_ptr<ColorListBox> mxLbFillGradFrom;
125  std::unique_ptr<ColorListBox> mxLbFillGradTo;
126  std::unique_ptr<weld::Toolbar> mxToolBoxColor; // for new color picker
127  std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch;
128  std::unique_ptr<weld::Label> mxTrspTextFT;
129  std::unique_ptr<weld::ComboBox> mxLBTransType;
130  std::unique_ptr<weld::MetricSpinButton> mxMTRTransparent;
131  std::unique_ptr<weld::Scale> mxSldTransparent;
132  std::unique_ptr<weld::Toolbar> mxBTNGradient;
133  std::unique_ptr<weld::MetricSpinButton> mxMTRAngle;
134  std::unique_ptr<weld::ComboBox> mxGradientStyle;
135  std::unique_ptr<weld::Button> mxBmpImport;
136  std::unique_ptr<AreaTransparencyGradientPopup> mxTrGrPopup;
137 
138  std::unique_ptr< XFillStyleItem > mpStyleItem;
139  std::unique_ptr< XFillColorItem > mpColorItem;
140  std::unique_ptr< XFillGradientItem > mpFillGradientItem;
141  std::unique_ptr< XFillHatchItem > mpHatchItem;
142  std::unique_ptr< XFillBitmapItem > mpBitmapItem;
143 
144  OUString maImgAxial;
145  OUString maImgElli;
146  OUString maImgQuad;
147  OUString maImgRadial;
148  OUString maImgSquare;
149  OUString maImgLinear;
150 
152 
153  std::unique_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem;
154  std::unique_ptr< SfxUInt16Item > mpTransparanceItem;
155 
156  DECL_LINK(SelectFillTypeHdl, weld::ComboBox&, void );
157  DECL_LINK(SelectFillAttrHdl, weld::ComboBox&, void );
158  DECL_LINK(SelectFillColorHdl, ColorListBox&, void);
159  DECL_LINK(ChangeGradientAngle, weld::MetricSpinButton&, void);
160  DECL_LINK(ChangeTrgrTypeHdl_Impl, weld::ComboBox&, void);
161  DECL_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
162  DECL_LINK(ModifyTransSliderHdl, weld::Scale&, void);
163  DECL_LINK(ClickImportBitmapHdl, weld::Button&, void);
164  DECL_LINK(ToolbarHdl_Impl, const OString&, void);
165 
166  void Update();
167  void ImpUpdateTransparencies();
168  void SetTransparency(sal_uInt16 nVal);
169  void SelectFillAttrHdl_Impl();
170 };
171 
172 } // end of namespace svx::sidebar
173 
174 #endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX
175 
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< ColorListBox > mxLbFillGradTo
std::unique_ptr< weld::Toolbar > mxBTNGradient
std::unique_ptr< weld::ComboBox > mxGradientStyle
std::unique_ptr< weld::Scale > mxSldTransparent
std::unique_ptr< weld::ComboBox > mxLbFillAttr
std::unique_ptr< weld::Label > mxColorTextFT
std::unique_ptr< XFillBitmapItem > mpBitmapItem
VclPtr< sfx2::sidebar::Panel > mpPanel
std::unique_ptr< SfxUInt16Item > mpTransparanceItem
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
std::unique_ptr< ColorListBox > mxLbFillGradFrom
std::unique_ptr< weld::MetricSpinButton > mxMTRAngle
std::unique_ptr< XFillStyleItem > mpStyleItem
std::unique_ptr< XFillColorItem > mpColorItem
std::unique_ptr< AreaTransparencyGradientPopup > mxTrGrPopup
std::unique_ptr< weld::MetricSpinButton > mxMTRTransparent
std::unique_ptr< ToolbarUnoDispatcher > mxColorDispatch
std::unique_ptr< weld::ComboBox > mxLBTransType
std::unique_ptr< weld::Label > mxTrspTextFT
std::unique_ptr< XFillHatchItem > mpHatchItem
virtual void GetControlState(const sal_uInt16, boost::property_tree::ptree &) override
SfxItemState
std::unique_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem
std::unique_ptr< weld::ComboBox > mxLbFillType
std::unique_ptr< weld::Toolbar > mxToolBoxColor
void dispose()
std::unique_ptr< XFillGradientItem > mpFillGradientItem
std::unique_ptr< weld::Button > mxBmpImport