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 <vcl/ctrl.hxx>
26 #include <sfx2/sidebar/SidebarPanelBase.hxx>
27 #include <sfx2/sidebar/ControllerItem.hxx>
28 #include <svx/xgrad.hxx>
29 #include <svx/itemwin.hxx>
30 #include <svx/xfillit0.hxx>
31 #include <svx/xflclit.hxx>
32 #include <svx/xflgrit.hxx>
33 #include <svx/xflhtit.hxx>
34 #include <svx/xbtmpit.hxx>
35 #include <svx/drawitem.hxx>
36 #include <vcl/lstbox.hxx>
37 #include <vcl/field.hxx>
38 #include <vcl/fixed.hxx>
39 #include <svl/intitem.hxx>
40 #include <svx/tbxcolorupdate.hxx>
41 #include <svx/sidebar/PropertyPanelTools.hxx>
42 #include <com/sun/star/ui/XUIElement.hpp>
43 #include <boost/scoped_ptr.hpp>
44 
45 //////////////////////////////////////////////////////////////////////////////
46 // pedefines
47 class XFillFloatTransparenceItem;
48 namespace svx { class ToolboxButtonColorUpdater; }
49 class SvxColorPage;
50 class SvxAreaTrGrPage;
51 
52 //////////////////////////////////////////////////////////////////////////////
53 // namespace open
54 
55 namespace svx { namespace sidebar {
56 
57 class AreaPropertyPanel
58 :   public Control,
59     public ::sfx2::sidebar::SidebarPanelBase::ContextChangeReceiverInterface,
60     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
61 {
62 private:
63     friend class SvxColorPage;
64     friend class SvxAreaTrGrPage;
65 
66 public:
67     static AreaPropertyPanel* Create(
68         Window* pParent,
69         const cssu::Reference<css::frame::XFrame>& rxFrame,
70         SfxBindings* pBindings);
71 
72     virtual void DataChanged(
73         const DataChangedEvent& rEvent);
74 
75     virtual void HandleContextChange(
76         const ::sfx2::sidebar::EnumContext aContext);
77 
78     virtual void NotifyItemUpdate(
79         const sal_uInt16 nSId,
80         const SfxItemState eState,
81         const SfxPoolItem* pState);
82 
83     SfxBindings* GetBindings();
84 
85 private:
86     sal_uInt16                                          meLastXFS;
87     Color                                               maLastColor;
88 
89     sal_uInt16                                          mnLastPosGradient;
90     sal_uInt16                                          mnLastPosHatch;
91     sal_uInt16                                          mnLastPosBitmap;
92     sal_uInt16                                          mnLastTransSolid;
93 
94     XGradient                                           maGradientLinear;
95     XGradient                                           maGradientAxial;
96     XGradient                                           maGradientRadial;
97     XGradient                                           maGradientElliptical;
98     XGradient                                           maGradientSquare;
99     XGradient                                           maGradientRect;
100 
101     //ui controls
102     ::boost::scoped_ptr< FixedText >                    mpColorTextFT;
103     ::boost::scoped_ptr< SvxFillTypeBox >               mpLbFillType;
104     ::boost::scoped_ptr< SvxFillAttrBox >               mpLbFillAttr;
105     ::boost::scoped_ptr< ToolBox >                      mpToolBoxColor; // for new color picker
106     ::boost::scoped_ptr< FixedText >                    mpTrspTextFT;
107     ::boost::scoped_ptr< ListBox >                      mpLBTransType;
108     ::boost::scoped_ptr< MetricField >                  mpMTRTransparent;
109     ::boost::scoped_ptr< ToolBox >                      mpBTNGradient;
110 
111     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
112 
113     ::boost::scoped_ptr< XFillStyleItem >               mpStyleItem;
114     ::boost::scoped_ptr< XFillColorItem >               mpColorItem;
115     ::boost::scoped_ptr< XFillGradientItem >            mpFillGradientItem;
116     ::boost::scoped_ptr< XFillHatchItem >               mpHatchItem;
117     ::boost::scoped_ptr< XFillBitmapItem >              mpBitmapItem;
118     ::boost::scoped_ptr< SvxColorTableItem >            mpColorTableItem;
119     ::boost::scoped_ptr< SvxGradientListItem >          mpGradientListItem;
120     ::boost::scoped_ptr< SvxHatchListItem >             mpHatchListItem;
121     ::boost::scoped_ptr< SvxBitmapListItem >            mpBitmapListItem;
122 
123     ::sfx2::sidebar::ControllerItem                     maStyleControl;
124     ::sfx2::sidebar::ControllerItem                     maColorControl;
125     ::sfx2::sidebar::ControllerItem                     maGradientControl;
126     ::sfx2::sidebar::ControllerItem                     maHatchControl;
127     ::sfx2::sidebar::ControllerItem                     maBitmapControl;
128     ::sfx2::sidebar::ControllerItem                     maColorTableControl;
129     ::sfx2::sidebar::ControllerItem                     maGradientListControl;
130     ::sfx2::sidebar::ControllerItem                     maHatchListControl;
131     ::sfx2::sidebar::ControllerItem                     maBitmapListControl;
132     ::sfx2::sidebar::ControllerItem                     maTransTypeController;
133     ::sfx2::sidebar::ControllerItem                     maTransController;
134     ::sfx2::sidebar::ControllerItem                     maTransGradientController;
135 
136     Image                                               maImgAxial;
137     Image                                               maImgElli;
138     Image                                               maImgQuad;
139     Image                                               maImgRadial;
140     Image                                               maImgSquare;
141     Image                                               maImgLinear;
142     Image                                               maImgColor;
143 
144     //for high contract
145     Image                                               maImgAxialH;
146     Image                                               maImgElliH;
147     Image                                               maImgQuadH;
148     Image                                               maImgRadialH;
149     Image                                               maImgSquareH;
150     Image                                               maImgLinearH;
151     Image                                               maImgColorH;
152 
153     String                                              msHelpFillType;
154     String                                              msHelpFillAttr;
155 
156     ::boost::scoped_ptr< PropertyPanelPopuplWindow >    mpTrGrFloatWin;
157     ::boost::scoped_ptr< SvxAreaTrGrPage >              mpTrGrPage;
158     ::boost::scoped_ptr< PropertyPanelPopuplWindow >    mpFloatWinColor;
159     ::boost::scoped_ptr< SvxColorPage >                 mpPageColor;
160     ::boost::scoped_ptr< XFillFloatTransparenceItem >   mpGradientItem;
161     ::boost::scoped_ptr< SfxUInt16Item >                mpTransTypeItem;
162 
163     cssu::Reference<css::frame::XFrame>                 mxFrame;
164     ::sfx2::sidebar::EnumContext                        maContext;
165     SfxBindings*                                        mpBindings;
166 
167     /// bitfield
168     bool                                                mbTBShow;
169     bool                                                mbColorAvail;
170 
171     DECL_LINK(SelectFillTypeHdl, ListBox* );
172     DECL_LINK(SelectFillAttrHdl, ListBox* );
173     DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker
174     DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
175     DECL_LINK(ModifyTransparentHdl_Impl, void*);
176     DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
177     DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
178 
179     // for transparency gradient
180     void ImpEnsureTrGrFloatWinAndTrGrPage();
181     SvxAreaTrGrPage* GetTrGrPage();
182     PropertyPanelPopuplWindow* GetTrGrFloatWin();
183 
184     // for color picker
185     void ImpEnsureFloatWinColorAndPageColor();
186     SvxColorPage* GetColorPage();
187     PropertyPanelPopuplWindow* GetColorFloatWin();
188 
189     // constructor/destuctor
190     AreaPropertyPanel(
191         Window* pParent,
192         const cssu::Reference<css::frame::XFrame>& rxFrame,
193         SfxBindings* pBindings);
194     virtual ~AreaPropertyPanel(void);
195 
196     void SetupIcons(void);
197     void Initialize();
198     void Update();
199 };
200 
201 //////////////////////////////////////////////////////////////////////////////
202 // namespace close
203 
204 }} // end of namespace ::svx::sidebar
205 
206 //////////////////////////////////////////////////////////////////////////////
207 
208 #endif // SVX_PROPERTYPANEL_AREAPAGE_HXX
209 
210 //////////////////////////////////////////////////////////////////////////////
211 // eof
212