1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef SVX_PROPERTYPANEL_AREAPAGE_HXX
23 #define SVX_PROPERTYPANEL_AREAPAGE_HXX
24 
25 #include <svx/sidebar/ColorPopup.hxx>
26 #include "AreaTransparencyGradientPopup.hxx"
27 #include <vcl/ctrl.hxx>
28 #include <sfx2/sidebar/SidebarPanelBase.hxx>
29 #include <sfx2/sidebar/ControllerItem.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 <vcl/lstbox.hxx>
39 #include <vcl/field.hxx>
40 #include <vcl/fixed.hxx>
41 #include <svl/intitem.hxx>
42 #include <svx/tbxcolorupdate.hxx>
43 #include <com/sun/star/ui/XUIElement.hpp>
44 #include <boost/scoped_ptr.hpp>
45 
46 
47 class XFillFloatTransparenceItem;
48 namespace svx { class ToolboxButtonColorUpdater; }
49 
50 
51 namespace svx { namespace sidebar {
52 
53 class PopupContainer;
54 class AreaTransparencyGradientControl;
55 
56 class AreaPropertyPanel
57 :   public Control,
58     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
59 {
60 public:
61     static AreaPropertyPanel* Create(
62         Window* pParent,
63         const cssu::Reference<css::frame::XFrame>& rxFrame,
64         SfxBindings* pBindings);
65 
66     virtual void DataChanged(
67         const DataChangedEvent& rEvent);
68 
69     virtual void NotifyItemUpdate(
70         const sal_uInt16 nSId,
71         const SfxItemState eState,
72         const SfxPoolItem* pState,
73         const bool bIsEnabled);
74 
75     SfxBindings* GetBindings();
76 
77     const static sal_Int32 DEFAULT_CENTERX;
78     const static sal_Int32 DEFAULT_CENTERY;
79     const static sal_Int32 DEFAULT_ANGLE;
80     const static sal_Int32 DEFAULT_STARTVALUE;
81     const static sal_Int32 DEFAULT_ENDVALUE;
82     const static sal_Int32 DEFAULT_BORDER;
83 
84     XGradient GetGradient (const XGradientStyle eStyle) const;
85     void SetGradient (const XGradient& rGradient);
86     sal_Int32 GetSelectedTransparencyTypeIndex (void) const;
87 
88 private:
89     sal_uInt16                                          meLastXFS;
90     Color                                               maLastColor;
91 
92     sal_uInt16                                          mnLastPosGradient;
93     sal_uInt16                                          mnLastPosHatch;
94     sal_uInt16                                          mnLastPosBitmap;
95     sal_uInt16                                          mnLastTransSolid;
96 
97     XGradient                                           maGradientLinear;
98     XGradient                                           maGradientAxial;
99     XGradient                                           maGradientRadial;
100     XGradient                                           maGradientElliptical;
101     XGradient                                           maGradientSquare;
102     XGradient                                           maGradientRect;
103 
104     //ui controls
105     ::boost::scoped_ptr< FixedText >                    mpColorTextFT;
106     ::boost::scoped_ptr< SvxFillTypeBox >               mpLbFillType;
107     ::boost::scoped_ptr< SvxFillAttrBox >               mpLbFillAttr;
108     ::boost::scoped_ptr< Window >                       mpToolBoxColorBackground;
109     ::boost::scoped_ptr< ToolBox >                      mpToolBoxColor; // for new color picker
110     ::boost::scoped_ptr< FixedText >                    mpTrspTextFT;
111     ::boost::scoped_ptr< ListBox >                      mpLBTransType;
112     ::boost::scoped_ptr< MetricField >                  mpMTRTransparent;
113     ::boost::scoped_ptr< Window >                       mpBTNGradientBackground;
114     ::boost::scoped_ptr< ToolBox >                      mpBTNGradient;
115 
116     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
117 
118     ::boost::scoped_ptr< XFillStyleItem >               mpStyleItem;
119     ::boost::scoped_ptr< XFillColorItem >               mpColorItem;
120     ::boost::scoped_ptr< XFillGradientItem >            mpFillGradientItem;
121     ::boost::scoped_ptr< XFillHatchItem >               mpHatchItem;
122     ::boost::scoped_ptr< XFillBitmapItem >              mpBitmapItem;
123     ::boost::scoped_ptr< SvxColorTableItem >            mpColorTableItem;
124     ::boost::scoped_ptr< SvxGradientListItem >          mpGradientListItem;
125     ::boost::scoped_ptr< SvxHatchListItem >             mpHatchListItem;
126     ::boost::scoped_ptr< SvxBitmapListItem >            mpBitmapListItem;
127 
128     ::sfx2::sidebar::ControllerItem                     maStyleControl;
129     ::sfx2::sidebar::ControllerItem                     maColorControl;
130     ::sfx2::sidebar::ControllerItem                     maGradientControl;
131     ::sfx2::sidebar::ControllerItem                     maHatchControl;
132     ::sfx2::sidebar::ControllerItem                     maBitmapControl;
133     ::sfx2::sidebar::ControllerItem                     maColorTableControl;
134     ::sfx2::sidebar::ControllerItem                     maGradientListControl;
135     ::sfx2::sidebar::ControllerItem                     maHatchListControl;
136     ::sfx2::sidebar::ControllerItem                     maBitmapListControl;
137     ::sfx2::sidebar::ControllerItem                     maFillTransparenceController;
138     ::sfx2::sidebar::ControllerItem                     maFillFloatTransparenceController;
139 
140     Image                                               maImgAxial;
141     Image                                               maImgElli;
142     Image                                               maImgQuad;
143     Image                                               maImgRadial;
144     Image                                               maImgSquare;
145     Image                                               maImgLinear;
146     Image                                               maImgColor;
147 
148     //for high contract
149     Image                                               maImgAxialH;
150     Image                                               maImgElliH;
151     Image                                               maImgQuadH;
152     Image                                               maImgRadialH;
153     Image                                               maImgSquareH;
154     Image                                               maImgLinearH;
155     Image                                               maImgColorH;
156 
157     String                                              msHelpFillType;
158     String                                              msHelpFillAttr;
159 
160     AreaTransparencyGradientPopup maTrGrPopup;
161     ColorPopup maColorPopup;
162 
163     ::boost::scoped_ptr< XFillFloatTransparenceItem >   mpFloatTransparenceItem;
164     ::boost::scoped_ptr< SfxUInt16Item >                mpTransparanceItem;
165 
166     cssu::Reference<css::frame::XFrame>                 mxFrame;
167     SfxBindings*                                        mpBindings;
168 
169     /// bitfield
170     bool                                                mbTBShow : 1;
171     bool                                                mbColorAvail : 1;
172 
173     DECL_LINK(SelectFillTypeHdl, ListBox* );
174     DECL_LINK(SelectFillAttrHdl, ListBox* );
175     DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
176     DECL_LINK(ModifyTransparentHdl_Impl, void*);
177     DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
178 
179     // for transparency gradient
180     PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent);
181     DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
182 
183     // for color picker
184     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
185     DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker
186 
187     // constructor/destuctor
188     AreaPropertyPanel(
189         Window* pParent,
190         const cssu::Reference<css::frame::XFrame>& rxFrame,
191         SfxBindings* pBindings);
192     virtual ~AreaPropertyPanel(void);
193 
194     void SetupIcons(void);
195     void Initialize();
196     void Update();
197     void ImpUpdateTransparencies();
198 
199     Color GetLastColor (void) const;
200     void SetColor (
201         const String& rsColorName,
202         const Color aColor);
203 };
204 
205 
206 } } // end of namespace ::svx::sidebar
207 
208 
209 
210 #endif // SVX_PROPERTYPANEL_AREAPAGE_HXX
211 
212 // eof
213