1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
23 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
24 #include <svx/sidebar/AreaTransparencyGradientPopup.hxx>
25 #include <sfx2/sidebar/ControllerItem.hxx>
26 #include <svx/colorbox.hxx>
27 #include <basegfx/utils/bgradient.hxx>
28 #include <svx/xfilluseslidebackgrounditem.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>
34 #include <sfx2/sidebar/PanelLayout.hxx>
35 #include <svl/intitem.hxx>
36 #include <svx/svxdllapi.h>
37 #include <vcl/EnumContext.hxx>
39 class ToolbarUnoDispatcher
;
40 class XFillFloatTransparenceItem
;
41 class XFillUseSlideBackgroundItem
;
42 class XFillTransparenceItem
;
44 class XFillGradientItem
;
47 class XFillBitmapItem
;
49 namespace svx::sidebar
{
51 class UNLESS_MERGELIBS(SVX_DLLPUBLIC
) AreaPropertyPanelBase
53 public ::sfx2::sidebar::IContextChangeReceiver
,
54 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
58 virtual void NotifyItemUpdate(
59 const sal_uInt16 nSId
,
60 const SfxItemState eState
,
61 const SfxPoolItem
* pState
) override
;
63 virtual void GetControlState(
64 const sal_uInt16
/*nSId*/,
65 boost::property_tree::ptree
& /*rState*/) override
{};
67 const static sal_Int32 DEFAULT_CENTERX
;
68 const static sal_Int32 DEFAULT_CENTERY
;
69 const static sal_Int32 DEFAULT_ANGLE
;
70 const static sal_Int32 DEFAULT_STARTVALUE
;
71 const static sal_Int32 DEFAULT_ENDVALUE
;
72 const static sal_Int32 DEFAULT_BORDER
;
74 const basegfx::BGradient
& GetGradient (const css::awt::GradientStyle eStyle
) const;
75 void SetGradient (const basegfx::BGradient
& rGradient
);
76 sal_Int32
GetSelectedTransparencyTypeIndex() const;
78 // constructor/destructor
79 AreaPropertyPanelBase(
80 weld::Widget
* pParent
,
81 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
);
83 virtual ~AreaPropertyPanelBase() override
;
85 virtual void setFillTransparence(const XFillTransparenceItem
& rItem
) = 0;
86 virtual void setFillFloatTransparence(const XFillFloatTransparenceItem
& rItem
) = 0;
87 virtual void setFillStyle(const XFillStyleItem
& rItem
) = 0;
88 virtual void setFillStyleAndColor(const XFillStyleItem
* pStyleItem
, const XFillColorItem
& aColorItem
) = 0;
89 virtual void setFillStyleAndGradient(const XFillStyleItem
* pStyleItem
, const XFillGradientItem
& aGradientItem
) = 0;
90 virtual void setFillStyleAndHatch(const XFillStyleItem
* pStyleItem
, const XFillHatchItem
& aHatchItem
) = 0;
91 virtual void setFillStyleAndBitmap(const XFillStyleItem
* pStyleItem
, const XFillBitmapItem
& aHatchItem
) = 0;
92 virtual void setFillUseBackground(const XFillStyleItem
* pStyleItem
, const XFillUseSlideBackgroundItem
& rItem
) = 0;
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 void updateFillUseBackground(bool BDisabled
, bool bDefaultOrSet
, const SfxPoolItem
* pState
);
107 const css::uno::Reference
<css::frame::XFrame
>& mxFrame
;
108 vcl::EnumContext maContext
;
110 sal_uInt16 meLastXFS
;
112 sal_Int32 mnLastPosHatch
;
113 sal_Int32 mnLastPosBitmap
;
114 sal_Int32 mnLastPosPattern
;
115 sal_uInt16 mnLastTransSolid
;
116 OUString msUseBackgroundText
;
118 basegfx::BGradient maGradientLinear
;
119 basegfx::BGradient maGradientAxial
;
120 basegfx::BGradient maGradientRadial
;
121 basegfx::BGradient maGradientElliptical
;
122 basegfx::BGradient maGradientSquare
;
123 basegfx::BGradient maGradientRect
;
126 std::unique_ptr
<weld::Label
> mxColorTextFT
;
127 std::unique_ptr
<weld::ComboBox
> mxLbFillType
;
128 std::unique_ptr
<weld::ComboBox
> mxLbFillAttr
;
129 std::unique_ptr
<ColorListBox
> mxLbFillGradFrom
;
130 std::unique_ptr
<ColorListBox
> mxLbFillGradTo
;
131 std::unique_ptr
<weld::Toolbar
> mxToolBoxColor
; // for new color picker
132 std::unique_ptr
<ToolbarUnoDispatcher
> mxColorDispatch
;
133 std::unique_ptr
<weld::Label
> mxTrspTextFT
;
134 std::unique_ptr
<weld::ComboBox
> mxLBTransType
;
135 std::unique_ptr
<weld::MetricSpinButton
> mxMTRTransparent
;
136 std::unique_ptr
<weld::Scale
> mxSldTransparent
;
137 std::unique_ptr
<weld::Toolbar
> mxBTNGradient
;
138 std::unique_ptr
<weld::MetricSpinButton
> mxMTRAngle
;
139 std::unique_ptr
<weld::ComboBox
> mxGradientStyle
;
140 std::unique_ptr
<weld::Button
> mxBmpImport
;
141 std::unique_ptr
<AreaTransparencyGradientPopup
> mxTrGrPopup
;
143 std::unique_ptr
< XFillStyleItem
> mpStyleItem
;
144 std::unique_ptr
< XFillColorItem
> mpColorItem
;
145 std::unique_ptr
< XFillGradientItem
> mpFillGradientItem
;
146 std::unique_ptr
< XFillHatchItem
> mpHatchItem
;
147 std::unique_ptr
< XFillBitmapItem
> mpBitmapItem
;
152 OUString maImgRadial
;
153 OUString maImgSquare
;
154 OUString maImgLinear
;
156 std::unique_ptr
< XFillFloatTransparenceItem
> mpFloatTransparenceItem
;
157 std::unique_ptr
< SfxUInt16Item
> mpTransparenceItem
;
159 // MCGR: Preserve ColorStops until we have a UI to edit these
160 basegfx::BColorStops maColorStops
;
162 DECL_DLLPRIVATE_LINK(SelectFillTypeHdl
, weld::ComboBox
&, void );
163 DECL_DLLPRIVATE_LINK(SelectFillAttrHdl
, weld::ComboBox
&, void );
164 DECL_DLLPRIVATE_LINK(SelectFillColorHdl
, ColorListBox
&, void);
165 DECL_DLLPRIVATE_LINK(ChangeGradientAngle
, weld::MetricSpinButton
&, void);
166 DECL_DLLPRIVATE_LINK(ChangeTrgrTypeHdl_Impl
, weld::ComboBox
&, void);
167 DECL_DLLPRIVATE_LINK(ModifyTransparentHdl_Impl
, weld::MetricSpinButton
&, void);
168 DECL_DLLPRIVATE_LINK(ModifyTransSliderHdl
, weld::Scale
&, void);
169 DECL_DLLPRIVATE_LINK(ClickImportBitmapHdl
, weld::Button
&, void);
170 DECL_DLLPRIVATE_LINK(ToolbarHdl_Impl
, const OUString
&, void);
172 void ImpUpdateTransparencies();
173 void SetTransparency(sal_uInt16 nVal
);
174 void SelectFillAttrHdl_Impl();
175 void FillStyleChanged(bool bUpdateModel
);
177 // MCGR: Preserve ColorStops until we have a UI to edit these
178 basegfx::BColorStops
createColorStops();
180 virtual void HandleContextChange(const vcl::EnumContext
& rContext
) override
;
183 } // end of namespace svx::sidebar
185 #endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */