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 
39 class XFillStyleItem;
40 class XFillGradientItem;
41 class XFillColorItem;
42 class XFillHatchItem;
43 class XFillBitmapItem;
44 
45 namespace svx::sidebar {
46 
48 : public PanelLayout,
50 {
51 public:
52 
53  virtual void NotifyItemUpdate(
54  const sal_uInt16 nSId,
55  const SfxItemState eState,
56  const SfxPoolItem* pState) override;
57 
58  virtual void GetControlState(
59  const sal_uInt16 /*nSId*/,
60  boost::property_tree::ptree& /*rState*/) override {};
61 
62  const static sal_Int32 DEFAULT_CENTERX;
63  const static sal_Int32 DEFAULT_CENTERY;
64  const static sal_Int32 DEFAULT_ANGLE;
65  const static sal_Int32 DEFAULT_STARTVALUE;
66  const static sal_Int32 DEFAULT_ENDVALUE;
67  const static sal_Int32 DEFAULT_BORDER;
68 
69  const XGradient& GetGradient (const css::awt::GradientStyle eStyle) const;
70  void SetGradient (const XGradient& rGradient);
71  sal_Int32 GetSelectedTransparencyTypeIndex() const;
72 
73  // constructor/destructor
75  weld::Widget* pParent,
76  const css::uno::Reference<css::frame::XFrame>& rxFrame);
77 
78  virtual ~AreaPropertyPanelBase() override;
79 
80  virtual void setFillTransparence(const XFillTransparenceItem& rItem) = 0;
81  virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) = 0;
82  virtual void setFillStyle(const XFillStyleItem& rItem) = 0;
83  virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& aColorItem) = 0;
84  virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& aGradientItem) = 0;
85  virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& aHatchItem) = 0;
86  virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& aHatchItem) = 0;
87 
88  void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
89  void updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
90  void updateFillStyle(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
91  void updateFillGradient(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
92  void updateFillHatch(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
93  void updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState);
94  void updateFillBitmap(bool BDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
95 
96 private:
97  void Initialize();
98 
99 protected:
100  sal_uInt16 meLastXFS;
101 
102  sal_Int32 mnLastPosHatch;
103  sal_Int32 mnLastPosBitmap;
104  sal_Int32 mnLastPosPattern;
105  sal_uInt16 mnLastTransSolid;
106 
113 
114  //ui controls
115  std::unique_ptr<weld::Label> mxColorTextFT;
116  std::unique_ptr<weld::ComboBox> mxLbFillType;
117  std::unique_ptr<weld::ComboBox> mxLbFillAttr;
118  std::unique_ptr<ColorListBox> mxLbFillGradFrom;
119  std::unique_ptr<ColorListBox> mxLbFillGradTo;
120  std::unique_ptr<weld::Toolbar> mxToolBoxColor; // for new color picker
121  std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch;
122  std::unique_ptr<weld::Label> mxTrspTextFT;
123  std::unique_ptr<weld::ComboBox> mxLBTransType;
124  std::unique_ptr<weld::MetricSpinButton> mxMTRTransparent;
125  std::unique_ptr<weld::Scale> mxSldTransparent;
126  std::unique_ptr<weld::Toolbar> mxBTNGradient;
127  std::unique_ptr<weld::MetricSpinButton> mxMTRAngle;
128  std::unique_ptr<weld::ComboBox> mxGradientStyle;
129  std::unique_ptr<weld::Button> mxBmpImport;
130  std::unique_ptr<AreaTransparencyGradientPopup> mxTrGrPopup;
131 
132  std::unique_ptr< XFillStyleItem > mpStyleItem;
133  std::unique_ptr< XFillColorItem > mpColorItem;
134  std::unique_ptr< XFillGradientItem > mpFillGradientItem;
135  std::unique_ptr< XFillHatchItem > mpHatchItem;
136  std::unique_ptr< XFillBitmapItem > mpBitmapItem;
137 
138  OUString maImgAxial;
139  OUString maImgElli;
140  OUString maImgQuad;
141  OUString maImgRadial;
142  OUString maImgSquare;
143  OUString maImgLinear;
144 
145  std::unique_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem;
146  std::unique_ptr< SfxUInt16Item > mpTransparanceItem;
147 
148  DECL_LINK(SelectFillTypeHdl, weld::ComboBox&, void );
149  DECL_LINK(SelectFillAttrHdl, weld::ComboBox&, void );
150  DECL_LINK(SelectFillColorHdl, ColorListBox&, void);
151  DECL_LINK(ChangeGradientAngle, weld::MetricSpinButton&, void);
152  DECL_LINK(ChangeTrgrTypeHdl_Impl, weld::ComboBox&, void);
153  DECL_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
154  DECL_LINK(ModifyTransSliderHdl, weld::Scale&, void);
155  DECL_LINK(ClickImportBitmapHdl, weld::Button&, void);
156  DECL_LINK(ToolbarHdl_Impl, const OString&, void);
157 
158  void Update();
159  void ImpUpdateTransparencies();
160  void SetTransparency(sal_uInt16 nVal);
161  void SelectFillAttrHdl_Impl();
162 };
163 
164 } // end of namespace svx::sidebar
165 
166 #endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX
167 
168 /* 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
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
std::unique_ptr< XFillGradientItem > mpFillGradientItem
std::unique_ptr< weld::Button > mxBmpImport