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_LINEPAGE_HXX
23 #define SVX_PROPERTYPANEL_LINEPAGE_HXX
24 
25 #include <vcl/ctrl.hxx>
26 #include <sfx2/sidebar/SidebarPanelBase.hxx>
27 #include <sfx2/sidebar/ControllerItem.hxx>
28 #include <vcl/fixed.hxx>
29 #include <vcl/field.hxx>
30 #include <svx/sidebar/PropertyPanelTools.hxx>
31 #include <boost/scoped_ptr.hpp>
32 
33 //////////////////////////////////////////////////////////////////////////////
34 // pedefines
35 
36 namespace svx { class ToolboxButtonColorUpdater; }
37 class SvxLineColorPage;
38 class SvxLineStylePage;
39 class SvxLineWidthPage;
40 class XLineStyleItem;
41 class XLineDashItem;
42 class XLineStartItem;
43 class XLineEndItem;
44 class LineEndLB;
45 class XLineEndList;
46 
47 //////////////////////////////////////////////////////////////////////////////
48 // namespace open
49 
50 namespace svx { namespace sidebar {
51 
52 class LinePropertyPanel
53 :   public Control,
54     public ::sfx2::sidebar::SidebarPanelBase::ContextChangeReceiverInterface,
55     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
56 {
57 private:
58     friend class ::SvxLineColorPage;
59     friend class ::SvxLineStylePage;
60     friend class ::SvxLineWidthPage;
61 
62 public:
63     static LinePropertyPanel* Create(
64         Window* pParent,
65         const cssu::Reference<css::frame::XFrame>& rxFrame,
66         SfxBindings* pBindings);
67 
68     virtual void DataChanged(
69         const DataChangedEvent& rEvent);
70 
71     virtual void HandleContextChange(
72         const ::sfx2::sidebar::EnumContext aContext);
73 
74     virtual void NotifyItemUpdate(
75         const sal_uInt16 nSId,
76         const SfxItemState eState,
77         const SfxPoolItem* pState);
78 
79     SfxBindings* GetBindings();
80     void ShowMenu (void);
81 
82 private:
83     //ui controls
84     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
85     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
86     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
87     ::boost::scoped_ptr< FixedText >                        mpFTColor;
88     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
89     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
90     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
91     ::boost::scoped_ptr< Window >                           mpTBStyleBackground;
92     ::boost::scoped_ptr< ToolBox >                          mpTBStyle;
93     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
94     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
95     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
96     ::boost::scoped_ptr< LineEndLB >                        mpLBStart;
97     ::boost::scoped_ptr< LineEndLB >                        mpLBEnd;
98 
99     //ControllerItem
100     ::sfx2::sidebar::ControllerItem                         maColorControl;
101     ::sfx2::sidebar::ControllerItem                         maStyleControl;
102     ::sfx2::sidebar::ControllerItem                         maDashControl;
103     ::sfx2::sidebar::ControllerItem                         maWidthControl;
104     ::sfx2::sidebar::ControllerItem                         maTransControl;
105     ::sfx2::sidebar::ControllerItem                         maStartControl;
106     ::sfx2::sidebar::ControllerItem                         maEndControl;
107     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
108 
109     Color                                                   maColor;
110     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
111     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
112     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
113     sal_uInt16                                              mnTrans;
114     SfxMapUnit                                              meMapUnit;
115     sal_Int32                                               mnWidthCoreValue;
116     XLineEndList*                                           mpLineEndList;
117     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
118     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
119 
120     //popup windows
121     ::boost::scoped_ptr< PropertyPanelPopuplWindow >        mpFloatWinColor;
122     ::boost::scoped_ptr< SvxLineColorPage >                 mpPageColor;
123     ::boost::scoped_ptr< PropertyPanelPopuplWindow >        mpFloatWinStyle;
124     ::boost::scoped_ptr< SvxLineStylePage >                 mpPageStyle;
125     ::boost::scoped_ptr< PropertyPanelPopuplWindow >        mpFloatWinWidth;
126     ::boost::scoped_ptr< SvxLineWidthPage >                 mpPageWidth;
127 
128     // images from ressource
129     Image                                                   maIMGColor;
130     Image                                                   maIMGNone;
131 
132     // multi-images
133     ::boost::scoped_ptr< Image >                            mpIMGStyleIcon;
134     ::boost::scoped_ptr< Image >                            mpIMGWidthIcon;
135     ::boost::scoped_ptr< Image >                            mpIMGStyleIconH;	//high contrast
136     ::boost::scoped_ptr< Image >                            mpIMGWidthIconH;	//high contrast
137 
138     cssu::Reference< css::frame::XFrame >                   mxFrame;
139     ::sfx2::sidebar::EnumContext                            maContext;
140     SfxBindings*                                            mpBindings;
141 
142     /// bitfield
143 	bool				mbColorAvailable : 1;
144 	bool				mbStyleAvailable : 1;
145 	bool				mbDashAvailable : 1;
146 	bool				mbTransAvailable : 1;
147 	bool				mbWidthValuable : 1;
148 	bool				mbStartAvailable : 1;
149 	bool				mbEndAvailable : 1;
150 
151     void SetupIcons(void);
152 	void Initialize();
153 	void FillLineEndList();
154 	void SelectEndStyle(bool bStart);
155 
156 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
157 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
158 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
159 	DECL_LINK(ToolboxStyleSelectHdl, ToolBox*);
160 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
161 	DECL_LINK(ChangeTransparentHdl , void *);
162 	DECL_LINK(ChangeStartHdl, void *);
163 	DECL_LINK(ChangeEndHdl, void *);
164 
165     // constructor/destuctor
166     LinePropertyPanel(
167         Window* pParent,
168         const cssu::Reference<css::frame::XFrame>& rxFrame,
169         SfxBindings* pBindings);
170     virtual ~LinePropertyPanel(void);
171 
172     void SetStyleIcon();
173     void SetColor(Color aColor);
174     void SetLineStyleItem(XLineStyleItem* pStyle);
175     void SetLineDashItem(XLineDashItem* pDash);
176     void SetWidth(long nWidth);
177     void SetWidthIcon(int n);
178     void SetWidthIcon();
179 
180     void ImpEnsureFloatWinColorAndPageColor();
181     SvxLineColorPage* GetColorPage();
182     PropertyPanelPopuplWindow* GetColorFloatWin();
183 
184     void ImpEnsureFloatWinStyleAndPageStyle();
185     SvxLineStylePage* GetStylePage();
186     PropertyPanelPopuplWindow* GetStyleFloatWin();
187 
188     void ImpEnsureFloatWinWidthAndPageWidth();
189     SvxLineWidthPage* GetWidthPage();
190     PropertyPanelPopuplWindow* GetWidthFloatWin();
191 };
192 
193 //////////////////////////////////////////////////////////////////////////////
194 // namespace close
195 
196 }} // end of namespace ::svx::sidebar
197 
198 //////////////////////////////////////////////////////////////////////////////
199 
200 #endif // SVX_PROPERTYPANEL_LINEPAGE_HXX
201 
202 //////////////////////////////////////////////////////////////////////////////
203 // eof
204