Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / sidebar / AreaPropertyPanelBase.hxx
blob5582973ce99975074237131a7e3ca79544484e7a
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_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX
20 #define INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANELBASE_HXX
22 #include <memory>
23 #include "AreaTransparencyGradientPopup.hxx"
24 #include <vcl/ctrl.hxx>
25 #include <sfx2/sidebar/SidebarPanelBase.hxx>
26 #include <sfx2/sidebar/ControllerItem.hxx>
27 #include <sfx2/sidebar/SidebarController.hxx>
28 #include <sfx2/sidebar/SidebarToolBox.hxx>
29 #include <svx/colorbox.hxx>
30 #include <svx/xgrad.hxx>
31 #include <svx/itemwin.hxx>
32 #include <svx/xfillit0.hxx>
33 #include <svx/xflclit.hxx>
34 #include <svx/xflgrit.hxx>
35 #include <svx/xflhtit.hxx>
36 #include <svx/xbtmpit.hxx>
37 #include <svx/drawitem.hxx>
38 #include <svx/sidebar/PanelLayout.hxx>
39 #include <vcl/lstbox.hxx>
40 #include <vcl/field.hxx>
41 #include <vcl/slider.hxx>
42 #include <vcl/fixed.hxx>
43 #include <vcl/vclptr.hxx>
44 #include <svl/intitem.hxx>
45 #include <com/sun/star/ui/XUIElement.hpp>
46 #include <svx/svxdllapi.h>
48 class XFillFloatTransparenceItem;
49 class XFillTransparenceItem;
50 class XFillStyleItem;
51 class XFillGradientItem;
52 class XFillColorItem;
53 class XFillHatchItem;
54 class XFillBitmapItem;
56 namespace svx { namespace sidebar {
58 class SVX_DLLPUBLIC AreaPropertyPanelBase
59 : public PanelLayout,
60 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
62 public:
64 virtual void dispose() override;
66 virtual void DataChanged(
67 const DataChangedEvent& rEvent) override;
69 virtual void NotifyItemUpdate(
70 const sal_uInt16 nSId,
71 const SfxItemState eState,
72 const SfxPoolItem* pState,
73 const bool bIsEnabled) override;
75 const static sal_Int32 DEFAULT_CENTERX;
76 const static sal_Int32 DEFAULT_CENTERY;
77 const static sal_Int32 DEFAULT_ANGLE;
78 const static sal_Int32 DEFAULT_STARTVALUE;
79 const static sal_Int32 DEFAULT_ENDVALUE;
80 const static sal_Int32 DEFAULT_BORDER;
82 const XGradient& GetGradient (const css::awt::GradientStyle eStyle) const;
83 void SetGradient (const XGradient& rGradient);
84 sal_Int32 GetSelectedTransparencyTypeIndex() const;
86 // constructor/destructor
87 AreaPropertyPanelBase(
88 vcl::Window* pParent,
89 const css::uno::Reference<css::frame::XFrame>& rxFrame);
91 virtual ~AreaPropertyPanelBase() override;
93 virtual void setFillTransparence(const XFillTransparenceItem& rItem) = 0;
94 virtual void setFillFloatTransparence(const XFillFloatTransparenceItem& rItem) = 0;
95 virtual void setFillStyle(const XFillStyleItem& rItem) = 0;
96 virtual void setFillStyleAndColor(const XFillStyleItem* pStyleItem, const XFillColorItem& aColorItem) = 0;
97 virtual void setFillStyleAndGradient(const XFillStyleItem* pStyleItem, const XFillGradientItem& aGradientItem) = 0;
98 virtual void setFillStyleAndHatch(const XFillStyleItem* pStyleItem, const XFillHatchItem& aHatchItem) = 0;
99 virtual void setFillStyleAndBitmap(const XFillStyleItem* pStyleItem, const XFillBitmapItem& aHatchItem) = 0;
101 void updateFillTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
102 void updateFillFloatTransparence(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
103 void updateFillStyle(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
104 void updateFillGradient(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
105 void updateFillHatch(bool bDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
106 void updateFillColor(bool bDefaultOrSet, const SfxPoolItem* pState);
107 void updateFillBitmap(bool BDisabled, bool bDefaultOrSet, const SfxPoolItem* pState);
109 protected:
110 sal_uInt16 meLastXFS;
112 sal_Int32 mnLastPosGradient;
113 sal_Int32 mnLastPosHatch;
114 sal_Int32 mnLastPosBitmap;
115 sal_Int32 mnLastPosPattern;
116 sal_uInt16 mnLastTransSolid;
118 XGradient maGradientLinear;
119 XGradient maGradientAxial;
120 XGradient maGradientRadial;
121 XGradient maGradientElliptical;
122 XGradient maGradientSquare;
123 XGradient maGradientRect;
125 //ui controls
126 VclPtr<FixedText> mpColorTextFT;
127 VclPtr<SvxFillTypeBox> mpLbFillType;
128 VclPtr<SvxFillAttrBox> mpLbFillAttr;
129 VclPtr<SvxColorListBox> mpLbFillGradFrom;
130 VclPtr<SvxColorListBox> mpLbFillGradTo;
131 VclPtr<sfx2::sidebar::SidebarToolBox> mpToolBoxColor; // for new color picker
132 VclPtr<FixedText> mpTrspTextFT;
133 VclPtr<ListBox> mpLBTransType;
134 VclPtr<MetricField> mpMTRTransparent;
135 VclPtr<Slider> mpSldTransparent;
136 VclPtr<ToolBox> mpBTNGradient;
137 VclPtr<MetricField> mpMTRAngle;
138 VclPtr<ListBox> mpGradientStyle;
139 VclPtr<PushButton> mpBmpImport;
141 std::unique_ptr< XFillStyleItem > mpStyleItem;
142 std::unique_ptr< XFillColorItem > mpColorItem;
143 std::unique_ptr< XFillGradientItem > mpFillGradientItem;
144 std::unique_ptr< XFillHatchItem > mpHatchItem;
145 std::unique_ptr< XFillBitmapItem > mpBitmapItem;
147 Image maImgAxial;
148 Image maImgElli;
149 Image maImgQuad;
150 Image maImgRadial;
151 Image maImgSquare;
152 Image maImgLinear;
154 VclPtr<AreaTransparencyGradientPopup> mxTrGrPopup;
156 std::unique_ptr< XFillFloatTransparenceItem > mpFloatTransparenceItem;
157 std::unique_ptr< SfxUInt16Item > mpTransparanceItem;
159 DECL_LINK(SelectFillTypeHdl, ListBox&, void );
160 DECL_LINK(SelectFillAttrHdl, ListBox&, void );
161 DECL_LINK(SelectFillColorHdl, SvxColorListBox&, void);
162 DECL_LINK(ChangeGradientAngle, Edit&, void);
163 DECL_LINK(ChangeTrgrTypeHdl_Impl, ListBox&, void);
164 DECL_LINK(ModifyTransparentHdl_Impl, Edit&, void);
165 DECL_LINK(ModifyTransSliderHdl, Slider*, void);
166 DECL_LINK(ClickImportBitmapHdl, Button*, void);
168 // for transparency gradient
169 DECL_LINK( ClickTrGrHdl_Impl, ToolBox*, void );
171 void Initialize();
172 void Update();
173 void ImpUpdateTransparencies();
174 void SetTransparency(sal_uInt16 nVal);
175 void SelectFillAttrHdl_Impl();
178 } } // end of namespace svx::sidebar
180 #endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */