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 <sfx2/sidebar/GridLayouter.hxx>
31 #include <svx/xgrad.hxx>
32 #include <svx/itemwin.hxx>
33 #include <svx/xfillit0.hxx>
34 #include <svx/xflclit.hxx>
35 #include <svx/xflgrit.hxx>
36 #include <svx/xflhtit.hxx>
37 #include <svx/xbtmpit.hxx>
38 #include <svx/drawitem.hxx>
39 #include <vcl/lstbox.hxx>
40 #include <vcl/field.hxx>
41 #include <vcl/fixed.hxx>
42 #include <svl/intitem.hxx>
43 #include <svx/tbxcolorupdate.hxx>
44 #include <com/sun/star/ui/XUIElement.hpp>
45 #include <boost/scoped_ptr.hpp>
46 
47 
48 class XFillFloatTransparenceItem;
49 namespace svx { class ToolboxButtonColorUpdater; }
50 
51 
52 namespace svx { namespace sidebar {
53 
54 class PopupContainer;
55 class AreaTransparencyGradientControl;
56 
57 class AreaPropertyPanel
58 :   public Control,
59     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
60 {
61 public:
62     static AreaPropertyPanel* Create(
63         Window* pParent,
64         const cssu::Reference<css::frame::XFrame>& rxFrame,
65         SfxBindings* pBindings);
66 
67     virtual void DataChanged(
68         const DataChangedEvent& rEvent);
69 
70     virtual void NotifyItemUpdate(
71         const sal_uInt16 nSId,
72         const SfxItemState eState,
73         const SfxPoolItem* pState,
74         const bool bIsEnabled);
75 
76     SfxBindings* GetBindings();
77 
78     const static sal_Int32 DEFAULT_CENTERX;
79     const static sal_Int32 DEFAULT_CENTERY;
80     const static sal_Int32 DEFAULT_ANGLE;
81     const static sal_Int32 DEFAULT_STARTVALUE;
82     const static sal_Int32 DEFAULT_ENDVALUE;
83     const static sal_Int32 DEFAULT_BORDER;
84 
85     XGradient GetGradient (const XGradientStyle eStyle) const;
86     void SetGradient (const XGradient& rGradient);
87     sal_Int32 GetSelectedTransparencyTypeIndex (void) const;
88 
89     virtual void Resize (void);
90 
91 private:
92     sal_uInt16                                          meLastXFS;
93     Color                                               maLastColor;
94 
95     sal_uInt16                                          mnLastPosGradient;
96     sal_uInt16                                          mnLastPosHatch;
97     sal_uInt16                                          mnLastPosBitmap;
98     sal_uInt16                                          mnLastTransSolid;
99 
100     XGradient                                           maGradientLinear;
101     XGradient                                           maGradientAxial;
102     XGradient                                           maGradientRadial;
103     XGradient                                           maGradientElliptical;
104     XGradient                                           maGradientSquare;
105     XGradient                                           maGradientRect;
106 
107     //ui controls
108     ::boost::scoped_ptr< FixedText >                    mpColorTextFT;
109     ::boost::scoped_ptr< SvxFillTypeBox >               mpLbFillType;
110     ::boost::scoped_ptr< SvxFillAttrBox >               mpLbFillAttr;
111     ::boost::scoped_ptr< Window >                       mpToolBoxColorBackground;
112     ::boost::scoped_ptr< ToolBox >                      mpToolBoxColor; // for new color picker
113     ::boost::scoped_ptr< FixedText >                    mpTrspTextFT;
114     ::boost::scoped_ptr< ListBox >                      mpLBTransType;
115     ::boost::scoped_ptr< MetricField >                  mpMTRTransparent;
116     ::boost::scoped_ptr< Window >                       mpBTNGradientBackground;
117     ::boost::scoped_ptr< ToolBox >                      mpBTNGradient;
118 
119     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
120 
121     ::boost::scoped_ptr< XFillStyleItem >               mpStyleItem;
122     ::boost::scoped_ptr< XFillColorItem >               mpColorItem;
123     ::boost::scoped_ptr< XFillGradientItem >            mpFillGradientItem;
124     ::boost::scoped_ptr< XFillHatchItem >               mpHatchItem;
125     ::boost::scoped_ptr< XFillBitmapItem >              mpBitmapItem;
126 
127     ::sfx2::sidebar::ControllerItem                     maStyleControl;
128     ::sfx2::sidebar::ControllerItem                     maColorControl;
129     ::sfx2::sidebar::ControllerItem                     maGradientControl;
130     ::sfx2::sidebar::ControllerItem                     maHatchControl;
131     ::sfx2::sidebar::ControllerItem                     maBitmapControl;
132     ::sfx2::sidebar::ControllerItem                     maColorTableControl;
133     ::sfx2::sidebar::ControllerItem                     maGradientListControl;
134     ::sfx2::sidebar::ControllerItem                     maHatchListControl;
135     ::sfx2::sidebar::ControllerItem                     maBitmapListControl;
136     ::sfx2::sidebar::ControllerItem                     maFillTransparenceController;
137     ::sfx2::sidebar::ControllerItem                     maFillFloatTransparenceController;
138 
139     Image                                               maImgAxial;
140     Image                                               maImgElli;
141     Image                                               maImgQuad;
142     Image                                               maImgRadial;
143     Image                                               maImgSquare;
144     Image                                               maImgLinear;
145     Image                                               maImgColor;
146 
147     //for high contract
148     Image                                               maImgAxialH;
149     Image                                               maImgElliH;
150     Image                                               maImgQuadH;
151     Image                                               maImgRadialH;
152     Image                                               maImgSquareH;
153     Image                                               maImgLinearH;
154     Image                                               maImgColorH;
155 
156     String                                              msHelpFillType;
157     String                                              msHelpFillAttr;
158 
159     AreaTransparencyGradientPopup maTrGrPopup;
160     ColorPopup maColorPopup;
161 
162     ::boost::scoped_ptr< XFillFloatTransparenceItem >   mpFloatTransparenceItem;
163     ::boost::scoped_ptr< SfxUInt16Item >                mpTransparanceItem;
164 
165     cssu::Reference<css::frame::XFrame>                 mxFrame;
166     SfxBindings*                                        mpBindings;
167 
168     /// bitfield
169     bool                                                mbColorAvail : 1;
170 
171     ::sfx2::sidebar::GridLayouter maLayouter;
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