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     void ShowMenu (void);
85 
86 private:
87     sal_uInt16                                          meLastXFS;
88     Color                                               maLastColor;
89 
90     sal_uInt16                                          mnLastPosGradient;
91     sal_uInt16                                          mnLastPosHatch;
92     sal_uInt16                                          mnLastPosBitmap;
93     sal_uInt16                                          mnLastTransSolid;
94 
95     XGradient                                           maGradientLinear;
96     XGradient                                           maGradientAxial;
97     XGradient                                           maGradientRadial;
98     XGradient                                           maGradientElliptical;
99     XGradient                                           maGradientSquare;
100     XGradient                                           maGradientRect;
101 
102     //ui controls
103     ::boost::scoped_ptr< FixedText >                    mpColorTextFT;
104     ::boost::scoped_ptr< SvxFillTypeBox >               mpLbFillType;
105     ::boost::scoped_ptr< SvxFillAttrBox >               mpLbFillAttr;
106     ::boost::scoped_ptr< Window >                       mpToolBoxColorBackground;
107     ::boost::scoped_ptr< ToolBox >                      mpToolBoxColor; // for new color picker
108     ::boost::scoped_ptr< FixedText >                    mpTrspTextFT;
109     ::boost::scoped_ptr< ListBox >                      mpLBTransType;
110     ::boost::scoped_ptr< MetricField >                  mpMTRTransparent;
111     ::boost::scoped_ptr< Window >                       mpBTNGradientBackground;
112     ::boost::scoped_ptr< ToolBox >                      mpBTNGradient;
113 
114     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
115 
116     ::boost::scoped_ptr< XFillStyleItem >               mpStyleItem;
117     ::boost::scoped_ptr< XFillColorItem >               mpColorItem;
118     ::boost::scoped_ptr< XFillGradientItem >            mpFillGradientItem;
119     ::boost::scoped_ptr< XFillHatchItem >               mpHatchItem;
120     ::boost::scoped_ptr< XFillBitmapItem >              mpBitmapItem;
121     ::boost::scoped_ptr< SvxColorTableItem >            mpColorTableItem;
122     ::boost::scoped_ptr< SvxGradientListItem >          mpGradientListItem;
123     ::boost::scoped_ptr< SvxHatchListItem >             mpHatchListItem;
124     ::boost::scoped_ptr< SvxBitmapListItem >            mpBitmapListItem;
125 
126     ::sfx2::sidebar::ControllerItem                     maStyleControl;
127     ::sfx2::sidebar::ControllerItem                     maColorControl;
128     ::sfx2::sidebar::ControllerItem                     maGradientControl;
129     ::sfx2::sidebar::ControllerItem                     maHatchControl;
130     ::sfx2::sidebar::ControllerItem                     maBitmapControl;
131     ::sfx2::sidebar::ControllerItem                     maColorTableControl;
132     ::sfx2::sidebar::ControllerItem                     maGradientListControl;
133     ::sfx2::sidebar::ControllerItem                     maHatchListControl;
134     ::sfx2::sidebar::ControllerItem                     maBitmapListControl;
135     ::sfx2::sidebar::ControllerItem                     maTransTypeController;
136     ::sfx2::sidebar::ControllerItem                     maTransController;
137     ::sfx2::sidebar::ControllerItem                     maTransGradientController;
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     ::boost::scoped_ptr< PropertyPanelPopuplWindow >    mpTrGrFloatWin;
160     ::boost::scoped_ptr< SvxAreaTrGrPage >              mpTrGrPage;
161 
162     ::boost::scoped_ptr< PropertyPanelPopuplWindow >    mpFloatWinColor;
163     ::boost::scoped_ptr< SvxColorPage >                 mpPageColor;
164 
165     ::boost::scoped_ptr< XFillFloatTransparenceItem >   mpGradientItem;
166     ::boost::scoped_ptr< SfxUInt16Item >                mpTransTypeItem;
167 
168     cssu::Reference<css::frame::XFrame>                 mxFrame;
169     ::sfx2::sidebar::EnumContext                        maContext;
170     SfxBindings*                                        mpBindings;
171 
172     /// bitfield
173     bool                                                mbTBShow : 1;
174     bool                                                mbColorAvail : 1;
175 
176     DECL_LINK(SelectFillTypeHdl, ListBox* );
177     DECL_LINK(SelectFillAttrHdl, ListBox* );
178     DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker
179     DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
180     DECL_LINK(ModifyTransparentHdl_Impl, void*);
181     DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
182     DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
183 
184     // for transparency gradient
185     void ImpEnsureTrGrFloatWinAndTrGrPage();
186     SvxAreaTrGrPage* GetTrGrPage();
187     PropertyPanelPopuplWindow* GetTrGrFloatWin();
188 
189     // for color picker
190     void ImpEnsureFloatWinColorAndPageColor();
191     SvxColorPage* GetColorPage();
192     PropertyPanelPopuplWindow* GetColorFloatWin();
193 
194     // constructor/destuctor
195     AreaPropertyPanel(
196         Window* pParent,
197         const cssu::Reference<css::frame::XFrame>& rxFrame,
198         SfxBindings* pBindings);
199     virtual ~AreaPropertyPanel(void);
200 
201     void SetupIcons(void);
202     void Initialize();
203     void Update();
204 };
205 
206 //////////////////////////////////////////////////////////////////////////////
207 // namespace close
208 
209 }} // end of namespace ::svx::sidebar
210 
211 //////////////////////////////////////////////////////////////////////////////
212 
213 #endif // SVX_PROPERTYPANEL_AREAPAGE_HXX
214 
215 //////////////////////////////////////////////////////////////////////////////
216 // eof
217