158e893aeSArmin Le Grand /**************************************************************
258e893aeSArmin Le Grand  *
358e893aeSArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
458e893aeSArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
558e893aeSArmin Le Grand  * distributed with this work for additional information
658e893aeSArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
758e893aeSArmin Le Grand  * to you under the Apache License, Version 2.0 (the
858e893aeSArmin Le Grand  * "License"); you may not use this file except in compliance
958e893aeSArmin Le Grand  * with the License.  You may obtain a copy of the License at
1058e893aeSArmin Le Grand  *
1158e893aeSArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
1258e893aeSArmin Le Grand  *
1358e893aeSArmin Le Grand  * Unless required by applicable law or agreed to in writing,
1458e893aeSArmin Le Grand  * software distributed under the License is distributed on an
1558e893aeSArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1658e893aeSArmin Le Grand  * KIND, either express or implied.  See the License for the
1758e893aeSArmin Le Grand  * specific language governing permissions and limitations
1858e893aeSArmin Le Grand  * under the License.
1958e893aeSArmin Le Grand  *
2058e893aeSArmin Le Grand  *************************************************************/
2158e893aeSArmin Le Grand 
2258e893aeSArmin Le Grand #ifndef SVX_PROPERTYPANEL_LINEPAGE_HXX
2358e893aeSArmin Le Grand #define SVX_PROPERTYPANEL_LINEPAGE_HXX
2458e893aeSArmin Le Grand 
25*8dcb2a10SAndre Fischer #include <svx/xdash.hxx>
2658e893aeSArmin Le Grand #include <vcl/ctrl.hxx>
2758e893aeSArmin Le Grand #include <sfx2/sidebar/SidebarPanelBase.hxx>
2858e893aeSArmin Le Grand #include <sfx2/sidebar/ControllerItem.hxx>
2958e893aeSArmin Le Grand #include <vcl/fixed.hxx>
3058e893aeSArmin Le Grand #include <vcl/field.hxx>
3158e893aeSArmin Le Grand #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"
3658e893aeSArmin Le Grand 
3758e893aeSArmin Le Grand 
3858e893aeSArmin Le Grand namespace svx { class ToolboxButtonColorUpdater; }
3958e893aeSArmin Le Grand class SvxLineColorPage;
4058e893aeSArmin Le Grand class SvxLineStylePage;
4158e893aeSArmin Le Grand class SvxLineWidthPage;
4258e893aeSArmin Le Grand class XLineStyleItem;
4358e893aeSArmin Le Grand class XLineDashItem;
4458e893aeSArmin Le Grand class XLineStartItem;
4558e893aeSArmin Le Grand class XLineEndItem;
46fb2c9d94SAndre Fischer class LineEndLB_LPP;
4758e893aeSArmin Le Grand class XLineEndList;
48d5370dc8SArmin Le Grand 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
8658e893aeSArmin Le Grand 
8758e893aeSArmin Le Grand 
8858e893aeSArmin Le Grand namespace svx { namespace sidebar {
8958e893aeSArmin Le Grand 
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 
9658e893aeSArmin Le Grand class LinePropertyPanel
9758e893aeSArmin Le Grand :   public Control,
9858e893aeSArmin Le Grand     public ::sfx2::sidebar::SidebarPanelBase::ContextChangeReceiverInterface,
9958e893aeSArmin Le Grand     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
10058e893aeSArmin Le Grand {
10158e893aeSArmin Le Grand private:
10235fa8f12SArmin Le Grand     friend class ::SvxLineStylePage;
10335fa8f12SArmin Le Grand     friend class ::SvxLineWidthPage;
10458e893aeSArmin Le Grand 
10558e893aeSArmin Le Grand public:
10658e893aeSArmin Le Grand     static LinePropertyPanel* Create(
10758e893aeSArmin Le Grand         Window* pParent,
10858e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
10958e893aeSArmin Le Grand         SfxBindings* pBindings);
11058e893aeSArmin Le Grand 
11158e893aeSArmin Le Grand     virtual void DataChanged(
11258e893aeSArmin Le Grand         const DataChangedEvent& rEvent);
11358e893aeSArmin Le Grand 
11458e893aeSArmin Le Grand     virtual void HandleContextChange(
11558e893aeSArmin Le Grand         const ::sfx2::sidebar::EnumContext aContext);
11658e893aeSArmin Le Grand 
11758e893aeSArmin Le Grand     virtual void NotifyItemUpdate(
11858e893aeSArmin Le Grand         const sal_uInt16 nSId,
11958e893aeSArmin Le Grand         const SfxItemState eState,
12058e893aeSArmin Le Grand         const SfxPoolItem* pState);
12158e893aeSArmin Le Grand 
12258e893aeSArmin Le Grand     SfxBindings* GetBindings();
1236cdc6e4fSArmin Le Grand     void ShowMenu (void);
12458e893aeSArmin Le Grand 
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 
13558e893aeSArmin Le Grand private:
13658e893aeSArmin Le Grand     //ui controls
13758e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
1388d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
13958e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
14058e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTColor;
1418d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
14258e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
14358e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
1448d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBStyleBackground;
14558e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBStyle;
14658e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
14758e893aeSArmin Le Grand     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
14858e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
149d5370dc8SArmin Le Grand     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBStart;
150d5370dc8SArmin Le Grand     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBEnd;
151d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
152d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
153d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
154d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
15558e893aeSArmin Le Grand 
15658e893aeSArmin Le Grand     //ControllerItem
15758e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStyleControl;
15858e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maDashControl;
15958e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maWidthControl;
160d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maColorControl;
16158e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStartControl;
16258e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEndControl;
16358e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
164d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maTransControl;
165d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
166d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maCapStyle;
16758e893aeSArmin Le Grand 
16858e893aeSArmin Le Grand     Color                                                   maColor;
16958e893aeSArmin Le Grand     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
17058e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
17158e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
17258e893aeSArmin Le Grand     sal_uInt16                                              mnTrans;
17358e893aeSArmin Le Grand     SfxMapUnit                                              meMapUnit;
17458e893aeSArmin Le Grand     sal_Int32                                               mnWidthCoreValue;
17558e893aeSArmin Le Grand     XLineEndList*                                           mpLineEndList;
17658e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
17758e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
17858e893aeSArmin Le Grand 
17958e893aeSArmin Le Grand     //popup windows
180*8dcb2a10SAndre Fischer     ColorPopup maColorPopup;
181*8dcb2a10SAndre Fischer     LineStylePopup maLineStylePopup;
182*8dcb2a10SAndre Fischer     LineWidthPopup maLineWidthPopup;
18358e893aeSArmin Le Grand 
18458e893aeSArmin Le Grand     // images from ressource
18558e893aeSArmin Le Grand     Image                                                   maIMGColor;
18658e893aeSArmin Le Grand     Image                                                   maIMGNone;
18758e893aeSArmin Le Grand 
18858e893aeSArmin Le Grand     // 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
19358e893aeSArmin Le Grand 
19458e893aeSArmin Le Grand     cssu::Reference< css::frame::XFrame >                   mxFrame;
19558e893aeSArmin Le Grand     ::sfx2::sidebar::EnumContext                            maContext;
19658e893aeSArmin Le Grand     SfxBindings*                                            mpBindings;
19758e893aeSArmin Le Grand 
19858e893aeSArmin Le Grand     /// bitfield
19958e893aeSArmin Le Grand 	bool				mbColorAvailable : 1;
20058e893aeSArmin Le Grand 	bool				mbStyleAvailable : 1;
20158e893aeSArmin Le Grand 	bool				mbDashAvailable : 1;
20258e893aeSArmin Le Grand 	bool				mbTransAvailable : 1;
20358e893aeSArmin Le Grand 	bool				mbWidthValuable : 1;
20458e893aeSArmin Le Grand 	bool				mbStartAvailable : 1;
20558e893aeSArmin Le Grand 	bool				mbEndAvailable : 1;
20658e893aeSArmin Le Grand 
20758e893aeSArmin Le Grand     void SetupIcons(void);
20858e893aeSArmin Le Grand 	void Initialize();
20958e893aeSArmin Le Grand 	void FillLineEndList();
21058e893aeSArmin Le Grand 	void SelectEndStyle(bool bStart);
21158e893aeSArmin Le Grand 
21258e893aeSArmin Le Grand 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
21358e893aeSArmin Le Grand 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
21458e893aeSArmin Le Grand 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
21558e893aeSArmin Le Grand 	DECL_LINK(ToolboxStyleSelectHdl, ToolBox*);
21658e893aeSArmin Le Grand 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
21758e893aeSArmin Le Grand 	DECL_LINK(ChangeTransparentHdl , void *);
21858e893aeSArmin Le Grand 	DECL_LINK(ChangeStartHdl, void *);
21958e893aeSArmin Le Grand 	DECL_LINK(ChangeEndHdl, void *);
220d5370dc8SArmin Le Grand 	DECL_LINK(ChangeEdgeStyleHdl, void *);
221d5370dc8SArmin Le Grand 	DECL_LINK(ChangeCapStyleHdl, void *);
22258e893aeSArmin Le Grand 
22358e893aeSArmin Le Grand     // constructor/destuctor
22458e893aeSArmin Le Grand     LinePropertyPanel(
22558e893aeSArmin Le Grand         Window* pParent,
22658e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
22758e893aeSArmin Le Grand         SfxBindings* pBindings);
22858e893aeSArmin Le Grand     virtual ~LinePropertyPanel(void);
22958e893aeSArmin Le Grand 
23058e893aeSArmin Le Grand     void SetStyleIcon();
231*8dcb2a10SAndre Fischer     void SetColor(
232*8dcb2a10SAndre Fischer         const String& rsColorName,
233*8dcb2a10SAndre Fischer         const Color aColor);
23458e893aeSArmin Le Grand 
235*8dcb2a10SAndre Fischer     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
236*8dcb2a10SAndre Fischer     PopupControl* CreateLineStylePopupControl (PopupContainer* pParent);
237*8dcb2a10SAndre Fischer     PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
23858e893aeSArmin Le Grand };
23958e893aeSArmin Le Grand 
240*8dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
24158e893aeSArmin Le Grand 
242*8dcb2a10SAndre Fischer #endif
243