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< ToolBox >                      mpToolBoxColor; // for new color picker
107     ::boost::scoped_ptr< FixedText >                    mpTrspTextFT;
108     ::boost::scoped_ptr< ListBox >                      mpLBTransType;
109     ::boost::scoped_ptr< MetricField >                  mpMTRTransparent;
110     ::boost::scoped_ptr< ToolBox >                      mpBTNGradient;
111 
112     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
113 
114     ::boost::scoped_ptr< XFillStyleItem >               mpStyleItem;
115     ::boost::scoped_ptr< XFillColorItem >               mpColorItem;
116     ::boost::scoped_ptr< XFillGradientItem >            mpFillGradientItem;
117     ::boost::scoped_ptr< XFillHatchItem >               mpHatchItem;
118     ::boost::scoped_ptr< XFillBitmapItem >              mpBitmapItem;
119     ::boost::scoped_ptr< SvxColorTableItem >            mpColorTableItem;
120     ::boost::scoped_ptr< SvxGradientListItem >          mpGradientListItem;
121     ::boost::scoped_ptr< SvxHatchListItem >             mpHatchListItem;
122     ::boost::scoped_ptr< SvxBitmapListItem >            mpBitmapListItem;
123 
124     ::sfx2::sidebar::ControllerItem                     maStyleControl;
125     ::sfx2::sidebar::ControllerItem                     maColorControl;
126     ::sfx2::sidebar::ControllerItem                     maGradientControl;
127     ::sfx2::sidebar::ControllerItem                     maHatchControl;
128     ::sfx2::sidebar::ControllerItem                     maBitmapControl;
129     ::sfx2::sidebar::ControllerItem                     maColorTableControl;
130     ::sfx2::sidebar::ControllerItem                     maGradientListControl;
131     ::sfx2::sidebar::ControllerItem                     maHatchListControl;
132     ::sfx2::sidebar::ControllerItem                     maBitmapListControl;
133     ::sfx2::sidebar::ControllerItem                     maTransTypeController;
134     ::sfx2::sidebar::ControllerItem                     maTransController;
135     ::sfx2::sidebar::ControllerItem                     maTransGradientController;
136 
137     Image                                               maImgAxial;
138     Image                                               maImgElli;
139     Image                                               maImgQuad;
140     Image                                               maImgRadial;
141     Image                                               maImgSquare;
142     Image                                               maImgLinear;
143     Image                                               maImgColor;
144 
145     //for high contract
146     Image                                               maImgAxialH;
147     Image                                               maImgElliH;
148     Image                                               maImgQuadH;
149     Image                                               maImgRadialH;
150     Image                                               maImgSquareH;
151     Image                                               maImgLinearH;
152     Image                                               maImgColorH;
153 
154     String                                              msHelpFillType;
155     String                                              msHelpFillAttr;
156 
157     ::boost::scoped_ptr< PropertyPanelPopuplWindow >    mpTrGrFloatWin;
158     ::boost::scoped_ptr< SvxAreaTrGrPage >              mpTrGrPage;
159     ::boost::scoped_ptr< PropertyPanelPopuplWindow >    mpFloatWinColor;
160     ::boost::scoped_ptr< SvxColorPage >                 mpPageColor;
161     ::boost::scoped_ptr< XFillFloatTransparenceItem >   mpGradientItem;
162     ::boost::scoped_ptr< SfxUInt16Item >                mpTransTypeItem;
163 
164     cssu::Reference<css::frame::XFrame>                 mxFrame;
165     ::sfx2::sidebar::EnumContext                        maContext;
166     SfxBindings*                                        mpBindings;
167 
168     /// bitfield
169     bool                                                mbTBShow : 1;
170     bool                                                mbColorAvail : 1;
171 
172     DECL_LINK(SelectFillTypeHdl, ListBox* );
173     DECL_LINK(SelectFillAttrHdl, ListBox* );
174     DECL_LINK(ToolBoxColorDropHdl, ToolBox *); //for new color picker
175     DECL_LINK(ChangeTrgrTypeHdl_Impl, void*);
176     DECL_LINK(ModifyTransparentHdl_Impl, void*);
177     DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
178     DECL_LINK( ImplPopupModeEndHdl, FloatingWindow* );
179 
180     // for transparency gradient
181     void ImpEnsureTrGrFloatWinAndTrGrPage();
182     SvxAreaTrGrPage* GetTrGrPage();
183     PropertyPanelPopuplWindow* GetTrGrFloatWin();
184 
185     // for color picker
186     void ImpEnsureFloatWinColorAndPageColor();
187     SvxColorPage* GetColorPage();
188     PropertyPanelPopuplWindow* GetColorFloatWin();
189 
190     // constructor/destuctor
191     AreaPropertyPanel(
192         Window* pParent,
193         const cssu::Reference<css::frame::XFrame>& rxFrame,
194         SfxBindings* pBindings);
195     virtual ~AreaPropertyPanel(void);
196 
197     void SetupIcons(void);
198     void Initialize();
199     void Update();
200 };
201 
202 //////////////////////////////////////////////////////////////////////////////
203 // namespace close
204 
205 }} // end of namespace ::svx::sidebar
206 
207 //////////////////////////////////////////////////////////////////////////////
208 
209 #endif // SVX_PROPERTYPANEL_AREAPAGE_HXX
210 
211 //////////////////////////////////////////////////////////////////////////////
212 // eof
213