xref: /AOO41X/main/svx/source/sidebar/line/LinePropertyPanel.hxx (revision 8dcb2a100eb78f12871a9e67d867e1bc0c7bdb07)
1*8dcb2a10SAndre Fischer /**************************************************************
2*8dcb2a10SAndre Fischer  *
3*8dcb2a10SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4*8dcb2a10SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5*8dcb2a10SAndre Fischer  * distributed with this work for additional information
6*8dcb2a10SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7*8dcb2a10SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8*8dcb2a10SAndre Fischer  * "License"); you may not use this file except in compliance
9*8dcb2a10SAndre Fischer  * with the License.  You may obtain a copy of the License at
10*8dcb2a10SAndre Fischer  *
11*8dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12*8dcb2a10SAndre Fischer  *
13*8dcb2a10SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14*8dcb2a10SAndre Fischer  * software distributed under the License is distributed on an
15*8dcb2a10SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*8dcb2a10SAndre Fischer  * KIND, either express or implied.  See the License for the
17*8dcb2a10SAndre Fischer  * specific language governing permissions and limitations
18*8dcb2a10SAndre Fischer  * under the License.
19*8dcb2a10SAndre Fischer  *
20*8dcb2a10SAndre Fischer  *************************************************************/
21*8dcb2a10SAndre Fischer 
22*8dcb2a10SAndre Fischer #ifndef SVX_PROPERTYPANEL_LINEPAGE_HXX
23*8dcb2a10SAndre Fischer #define SVX_PROPERTYPANEL_LINEPAGE_HXX
24*8dcb2a10SAndre Fischer 
25*8dcb2a10SAndre Fischer #include <svx/xdash.hxx>
26*8dcb2a10SAndre Fischer #include <vcl/ctrl.hxx>
27*8dcb2a10SAndre Fischer #include <sfx2/sidebar/SidebarPanelBase.hxx>
28*8dcb2a10SAndre Fischer #include <sfx2/sidebar/ControllerItem.hxx>
29*8dcb2a10SAndre Fischer #include <vcl/fixed.hxx>
30*8dcb2a10SAndre Fischer #include <vcl/field.hxx>
31*8dcb2a10SAndre Fischer #include <boost/scoped_ptr.hpp>
32*8dcb2a10SAndre Fischer #include <boost/scoped_array.hpp>
33*8dcb2a10SAndre Fischer #include "sidebar/ColorPopup.hxx"
34*8dcb2a10SAndre Fischer #include "LineStylePopup.hxx"
35*8dcb2a10SAndre Fischer #include "LineWidthPopup.hxx"
36*8dcb2a10SAndre Fischer 
37*8dcb2a10SAndre Fischer 
38*8dcb2a10SAndre Fischer namespace svx { class ToolboxButtonColorUpdater; }
39*8dcb2a10SAndre Fischer class SvxLineColorPage;
40*8dcb2a10SAndre Fischer class SvxLineStylePage;
41*8dcb2a10SAndre Fischer class SvxLineWidthPage;
42*8dcb2a10SAndre Fischer class XLineStyleItem;
43*8dcb2a10SAndre Fischer class XLineDashItem;
44*8dcb2a10SAndre Fischer class XLineStartItem;
45*8dcb2a10SAndre Fischer class XLineEndItem;
46*8dcb2a10SAndre Fischer class LineEndLB_LPP;
47*8dcb2a10SAndre Fischer class XLineEndList;
48*8dcb2a10SAndre Fischer class ListBox;
49*8dcb2a10SAndre Fischer class ToolBox;
50*8dcb2a10SAndre Fischer class FloatingWindow;
51*8dcb2a10SAndre Fischer 
52*8dcb2a10SAndre Fischer namespace {
53*8dcb2a10SAndre Fischer     const String Dash_Name[] =
54*8dcb2a10SAndre Fischer     {
55*8dcb2a10SAndre Fischer         String("Ultrafine dashed", 16,  RTL_TEXTENCODING_ASCII_US),				//0
56*8dcb2a10SAndre Fischer         String("Dashed (variable)", 17,RTL_TEXTENCODING_ASCII_US ),				//6
57*8dcb2a10SAndre Fischer         String("Fine dashed (variable)",22,  RTL_TEXTENCODING_ASCII_US),		//5
58*8dcb2a10SAndre Fischer         String("Fine dashed", 11, RTL_TEXTENCODING_ASCII_US),					//1
59*8dcb2a10SAndre Fischer         String("Fine dotted", 11, RTL_TEXTENCODING_ASCII_US),					//3
60*8dcb2a10SAndre Fischer         String("Ultrafine dotted (variable)",27, RTL_TEXTENCODING_ASCII_US),	//8
61*8dcb2a10SAndre Fischer         String("3 dashes 3 dots (variable)", 26, RTL_TEXTENCODING_ASCII_US),	//7
62*8dcb2a10SAndre Fischer         String("2 dots 1 dash",13,RTL_TEXTENCODING_ASCII_US  )	,				//9
63*8dcb2a10SAndre Fischer         String("Ultrafine 2 dots 3 dashes",  25, RTL_TEXTENCODING_ASCII_US),	//2
64*8dcb2a10SAndre Fischer         String("Line with fine dots", 19, RTL_TEXTENCODING_ASCII_US)			//4
65*8dcb2a10SAndre Fischer     };
66*8dcb2a10SAndre Fischer 
67*8dcb2a10SAndre Fischer 
68*8dcb2a10SAndre Fischer     const XDash Dash_Set[] =
69*8dcb2a10SAndre Fischer     {
70*8dcb2a10SAndre Fischer         //Dash, dots, dotlen, dash, dashlen, distance
71*8dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1, 51, 1, 51, 51),									//0
72*8dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1, 197, 0,0, 127),							//6
73*8dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1, 197,0,0,197),								//5
74*8dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,508, 1,508, 508),									//1
75*8dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,  0, 0,  0, 457),									//3
76*8dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1,  0, 0, 0, 50),								//8
77*8dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 3, 197, 3, 0, 100),							//7
78*8dcb2a10SAndre Fischer         XDash(XDASH_RECT, 2, 0, 1, 203,203)	,									//9
79*8dcb2a10SAndre Fischer         XDash(XDASH_RECT, 2, 51, 3,254, 127),									//2
80*8dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,2007,10, 0, 152)									//4
81*8dcb2a10SAndre Fischer     };
82*8dcb2a10SAndre Fischer 
83*8dcb2a10SAndre Fischer     #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US)
84*8dcb2a10SAndre Fischer 
85*8dcb2a10SAndre Fischer } //end of anonymous namespace
86*8dcb2a10SAndre Fischer 
87*8dcb2a10SAndre Fischer 
88*8dcb2a10SAndre Fischer namespace svx { namespace sidebar {
89*8dcb2a10SAndre Fischer 
90*8dcb2a10SAndre Fischer class PopupContainer;
91*8dcb2a10SAndre Fischer class ColorPopup;
92*8dcb2a10SAndre Fischer class LineStyleControl;
93*8dcb2a10SAndre Fischer class LineWidthControl;
94*8dcb2a10SAndre Fischer 
95*8dcb2a10SAndre Fischer 
96*8dcb2a10SAndre Fischer class LinePropertyPanel
97*8dcb2a10SAndre Fischer :   public Control,
98*8dcb2a10SAndre Fischer     public ::sfx2::sidebar::SidebarPanelBase::ContextChangeReceiverInterface,
99*8dcb2a10SAndre Fischer     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
100*8dcb2a10SAndre Fischer {
101*8dcb2a10SAndre Fischer private:
102*8dcb2a10SAndre Fischer     friend class ::SvxLineStylePage;
103*8dcb2a10SAndre Fischer     friend class ::SvxLineWidthPage;
104*8dcb2a10SAndre Fischer 
105*8dcb2a10SAndre Fischer public:
106*8dcb2a10SAndre Fischer     static LinePropertyPanel* Create(
107*8dcb2a10SAndre Fischer         Window* pParent,
108*8dcb2a10SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
109*8dcb2a10SAndre Fischer         SfxBindings* pBindings);
110*8dcb2a10SAndre Fischer 
111*8dcb2a10SAndre Fischer     virtual void DataChanged(
112*8dcb2a10SAndre Fischer         const DataChangedEvent& rEvent);
113*8dcb2a10SAndre Fischer 
114*8dcb2a10SAndre Fischer     virtual void HandleContextChange(
115*8dcb2a10SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
116*8dcb2a10SAndre Fischer 
117*8dcb2a10SAndre Fischer     virtual void NotifyItemUpdate(
118*8dcb2a10SAndre Fischer         const sal_uInt16 nSId,
119*8dcb2a10SAndre Fischer         const SfxItemState eState,
120*8dcb2a10SAndre Fischer         const SfxPoolItem* pState);
121*8dcb2a10SAndre Fischer 
122*8dcb2a10SAndre Fischer     SfxBindings* GetBindings();
123*8dcb2a10SAndre Fischer     void ShowMenu (void);
124*8dcb2a10SAndre Fischer 
125*8dcb2a10SAndre Fischer     void SetLineDashItem(XLineDashItem* pDash);
126*8dcb2a10SAndre Fischer     void SetLineStyleItem(XLineStyleItem* pStyle);
127*8dcb2a10SAndre Fischer 
128*8dcb2a10SAndre Fischer     void SetWidth(long nWidth);
129*8dcb2a10SAndre Fischer     void SetWidthIcon(int n);
130*8dcb2a10SAndre Fischer     void SetWidthIcon();
131*8dcb2a10SAndre Fischer 
132*8dcb2a10SAndre Fischer     void EndLineStylePopupMode (void);
133*8dcb2a10SAndre Fischer     void EndLineWidthPopupMode (void);
134*8dcb2a10SAndre Fischer 
135*8dcb2a10SAndre Fischer private:
136*8dcb2a10SAndre Fischer     //ui controls
137*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
138*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
139*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
140*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTColor;
141*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
142*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
143*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
144*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< Window >                           mpTBStyleBackground;
145*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< ToolBox >                          mpTBStyle;
146*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
147*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
148*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
149*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBStart;
150*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBEnd;
151*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
152*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
153*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
154*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
155*8dcb2a10SAndre Fischer 
156*8dcb2a10SAndre Fischer     //ControllerItem
157*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maStyleControl;
158*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maDashControl;
159*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maWidthControl;
160*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maColorControl;
161*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maStartControl;
162*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maEndControl;
163*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
164*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maTransControl;
165*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
166*8dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maCapStyle;
167*8dcb2a10SAndre Fischer 
168*8dcb2a10SAndre Fischer     Color                                                   maColor;
169*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
170*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
171*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
172*8dcb2a10SAndre Fischer     sal_uInt16                                              mnTrans;
173*8dcb2a10SAndre Fischer     SfxMapUnit                                              meMapUnit;
174*8dcb2a10SAndre Fischer     sal_Int32                                               mnWidthCoreValue;
175*8dcb2a10SAndre Fischer     XLineEndList*                                           mpLineEndList;
176*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
177*8dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
178*8dcb2a10SAndre Fischer 
179*8dcb2a10SAndre Fischer     //popup windows
180*8dcb2a10SAndre Fischer     ColorPopup maColorPopup;
181*8dcb2a10SAndre Fischer     LineStylePopup maLineStylePopup;
182*8dcb2a10SAndre Fischer     LineWidthPopup maLineWidthPopup;
183*8dcb2a10SAndre Fischer 
184*8dcb2a10SAndre Fischer     // images from ressource
185*8dcb2a10SAndre Fischer     Image                                                   maIMGColor;
186*8dcb2a10SAndre Fischer     Image                                                   maIMGNone;
187*8dcb2a10SAndre Fischer 
188*8dcb2a10SAndre Fischer     // multi-images
189*8dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIcon;
190*8dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIcon;
191*8dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIconH;	//high contrast
192*8dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIconH;	//high contrast
193*8dcb2a10SAndre Fischer 
194*8dcb2a10SAndre Fischer     cssu::Reference< css::frame::XFrame >                   mxFrame;
195*8dcb2a10SAndre Fischer     ::sfx2::sidebar::EnumContext                            maContext;
196*8dcb2a10SAndre Fischer     SfxBindings*                                            mpBindings;
197*8dcb2a10SAndre Fischer 
198*8dcb2a10SAndre Fischer     /// bitfield
199*8dcb2a10SAndre Fischer 	bool				mbColorAvailable : 1;
200*8dcb2a10SAndre Fischer 	bool				mbStyleAvailable : 1;
201*8dcb2a10SAndre Fischer 	bool				mbDashAvailable : 1;
202*8dcb2a10SAndre Fischer 	bool				mbTransAvailable : 1;
203*8dcb2a10SAndre Fischer 	bool				mbWidthValuable : 1;
204*8dcb2a10SAndre Fischer 	bool				mbStartAvailable : 1;
205*8dcb2a10SAndre Fischer 	bool				mbEndAvailable : 1;
206*8dcb2a10SAndre Fischer 
207*8dcb2a10SAndre Fischer     void SetupIcons(void);
208*8dcb2a10SAndre Fischer 	void Initialize();
209*8dcb2a10SAndre Fischer 	void FillLineEndList();
210*8dcb2a10SAndre Fischer 	void SelectEndStyle(bool bStart);
211*8dcb2a10SAndre Fischer 
212*8dcb2a10SAndre Fischer 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
213*8dcb2a10SAndre Fischer 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
214*8dcb2a10SAndre Fischer 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
215*8dcb2a10SAndre Fischer 	DECL_LINK(ToolboxStyleSelectHdl, ToolBox*);
216*8dcb2a10SAndre Fischer 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
217*8dcb2a10SAndre Fischer 	DECL_LINK(ChangeTransparentHdl , void *);
218*8dcb2a10SAndre Fischer 	DECL_LINK(ChangeStartHdl, void *);
219*8dcb2a10SAndre Fischer 	DECL_LINK(ChangeEndHdl, void *);
220*8dcb2a10SAndre Fischer 	DECL_LINK(ChangeEdgeStyleHdl, void *);
221*8dcb2a10SAndre Fischer 	DECL_LINK(ChangeCapStyleHdl, void *);
222*8dcb2a10SAndre Fischer 
223*8dcb2a10SAndre Fischer     // constructor/destuctor
224*8dcb2a10SAndre Fischer     LinePropertyPanel(
225*8dcb2a10SAndre Fischer         Window* pParent,
226*8dcb2a10SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
227*8dcb2a10SAndre Fischer         SfxBindings* pBindings);
228*8dcb2a10SAndre Fischer     virtual ~LinePropertyPanel(void);
229*8dcb2a10SAndre Fischer 
230*8dcb2a10SAndre Fischer     void SetStyleIcon();
231*8dcb2a10SAndre Fischer     void SetColor(
232*8dcb2a10SAndre Fischer         const String& rsColorName,
233*8dcb2a10SAndre Fischer         const Color aColor);
234*8dcb2a10SAndre Fischer 
235*8dcb2a10SAndre Fischer     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
236*8dcb2a10SAndre Fischer     PopupControl* CreateLineStylePopupControl (PopupContainer* pParent);
237*8dcb2a10SAndre Fischer     PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
238*8dcb2a10SAndre Fischer };
239*8dcb2a10SAndre Fischer 
240*8dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
241*8dcb2a10SAndre Fischer 
242*8dcb2a10SAndre Fischer #endif
243