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