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 <svx/sidebar/AreaTransparencyGradientPopup.hxx>
24 #include <sfx2/sidebar/ControllerItem.hxx>
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>
32 #include <sfx2/sidebar/PanelLayout.hxx>
33 #include <svl/intitem.hxx>
34 #include <svx/svxdllapi.h>
35 #include <sfx2/sidebar/Panel.hxx>
37 class ToolbarUnoDispatcher
;
38 class XFillFloatTransparenceItem
;
39 class XFillTransparenceItem
;
41 class XFillGradientItem
;
44 class XFillBitmapItem
;
46 namespace svx::sidebar
{
48 class SVX_DLLPUBLIC AreaPropertyPanelBase
50 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
54 virtual void dispose() override
;
56 virtual void DataChanged(
57 const DataChangedEvent
& rEvent
) override
;
59 virtual void NotifyItemUpdate(
60 const sal_uInt16 nSId
,
61 const SfxItemState eState
,
62 const SfxPoolItem
* pState
) override
;
64 virtual void GetControlState(
65 const sal_uInt16
/*nSId*/,
66 boost::property_tree::ptree
& /*rState*/) override
{};
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
;
75 const XGradient
& GetGradient (const css::awt::GradientStyle eStyle
) const;
76 void SetGradient (const XGradient
& rGradient
);
77 sal_Int32
GetSelectedTransparencyTypeIndex() const;
79 // constructor/destructor
80 AreaPropertyPanelBase(
82 const css::uno::Reference
<css::frame::XFrame
>& rxFrame
);
84 virtual ~AreaPropertyPanelBase() override
;
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;
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
);
106 sal_uInt16 meLastXFS
;
108 sal_Int32 mnLastPosHatch
;
109 sal_Int32 mnLastPosBitmap
;
110 sal_Int32 mnLastPosPattern
;
111 sal_uInt16 mnLastTransSolid
;
113 XGradient maGradientLinear
;
114 XGradient maGradientAxial
;
115 XGradient maGradientRadial
;
116 XGradient maGradientElliptical
;
117 XGradient maGradientSquare
;
118 XGradient maGradientRect
;
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
;
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
;
147 OUString maImgRadial
;
148 OUString maImgSquare
;
149 OUString maImgLinear
;
151 VclPtr
<sfx2::sidebar::Panel
> mpPanel
;
153 std::unique_ptr
< XFillFloatTransparenceItem
> mpFloatTransparenceItem
;
154 std::unique_ptr
< SfxUInt16Item
> mpTransparanceItem
;
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);
167 void ImpUpdateTransparencies();
168 void SetTransparency(sal_uInt16 nVal
);
169 void SelectFillAttrHdl_Impl();
172 } // end of namespace svx::sidebar
174 #endif // INCLUDED_SVX_SOURCE_SIDEBAR_AREA_AREAPROPERTYPANEL_HXX
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */