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 
258dcb2a10SAndre 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>
29*f120fe41SAndre Fischer #include <sfx2/sidebar/IContextChangeReceiver.hxx>
3058e893aeSArmin Le Grand #include <vcl/fixed.hxx>
3158e893aeSArmin Le Grand #include <vcl/field.hxx>
3258e893aeSArmin Le Grand #include <boost/scoped_ptr.hpp>
338dcb2a10SAndre Fischer #include <boost/scoped_array.hpp>
348dcb2a10SAndre Fischer #include "sidebar/ColorPopup.hxx"
358dcb2a10SAndre Fischer #include "LineStylePopup.hxx"
368dcb2a10SAndre Fischer #include "LineWidthPopup.hxx"
3758e893aeSArmin Le Grand 
3858e893aeSArmin Le Grand 
3958e893aeSArmin Le Grand namespace svx { class ToolboxButtonColorUpdater; }
4058e893aeSArmin Le Grand class SvxLineColorPage;
4158e893aeSArmin Le Grand class SvxLineStylePage;
4258e893aeSArmin Le Grand class SvxLineWidthPage;
4358e893aeSArmin Le Grand class XLineStyleItem;
4458e893aeSArmin Le Grand class XLineDashItem;
4558e893aeSArmin Le Grand class XLineStartItem;
4658e893aeSArmin Le Grand class XLineEndItem;
47fb2c9d94SAndre Fischer class LineEndLB_LPP;
4858e893aeSArmin Le Grand class XLineEndList;
49d5370dc8SArmin Le Grand class ListBox;
508dcb2a10SAndre Fischer class ToolBox;
518dcb2a10SAndre Fischer class FloatingWindow;
528dcb2a10SAndre Fischer 
538dcb2a10SAndre Fischer namespace {
548dcb2a10SAndre Fischer     const String Dash_Name[] =
558dcb2a10SAndre Fischer     {
568dcb2a10SAndre Fischer         String("Ultrafine dashed", 16,  RTL_TEXTENCODING_ASCII_US),				//0
578dcb2a10SAndre Fischer         String("Dashed (variable)", 17,RTL_TEXTENCODING_ASCII_US ),				//6
588dcb2a10SAndre Fischer         String("Fine dashed (variable)",22,  RTL_TEXTENCODING_ASCII_US),		//5
598dcb2a10SAndre Fischer         String("Fine dashed", 11, RTL_TEXTENCODING_ASCII_US),					//1
608dcb2a10SAndre Fischer         String("Fine dotted", 11, RTL_TEXTENCODING_ASCII_US),					//3
618dcb2a10SAndre Fischer         String("Ultrafine dotted (variable)",27, RTL_TEXTENCODING_ASCII_US),	//8
628dcb2a10SAndre Fischer         String("3 dashes 3 dots (variable)", 26, RTL_TEXTENCODING_ASCII_US),	//7
638dcb2a10SAndre Fischer         String("2 dots 1 dash",13,RTL_TEXTENCODING_ASCII_US  )	,				//9
648dcb2a10SAndre Fischer         String("Ultrafine 2 dots 3 dashes",  25, RTL_TEXTENCODING_ASCII_US),	//2
658dcb2a10SAndre Fischer         String("Line with fine dots", 19, RTL_TEXTENCODING_ASCII_US)			//4
668dcb2a10SAndre Fischer     };
678dcb2a10SAndre Fischer 
688dcb2a10SAndre Fischer 
698dcb2a10SAndre Fischer     const XDash Dash_Set[] =
708dcb2a10SAndre Fischer     {
718dcb2a10SAndre Fischer         //Dash, dots, dotlen, dash, dashlen, distance
728dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1, 51, 1, 51, 51),									//0
738dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1, 197, 0,0, 127),							//6
748dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1, 197,0,0,197),								//5
758dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,508, 1,508, 508),									//1
768dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,  0, 0,  0, 457),									//3
778dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1,  0, 0, 0, 50),								//8
788dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 3, 197, 3, 0, 100),							//7
798dcb2a10SAndre Fischer         XDash(XDASH_RECT, 2, 0, 1, 203,203)	,									//9
808dcb2a10SAndre Fischer         XDash(XDASH_RECT, 2, 51, 3,254, 127),									//2
818dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,2007,10, 0, 152)									//4
828dcb2a10SAndre Fischer     };
838dcb2a10SAndre Fischer 
848dcb2a10SAndre Fischer     #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US)
858dcb2a10SAndre Fischer 
868dcb2a10SAndre Fischer } //end of anonymous namespace
8758e893aeSArmin Le Grand 
8858e893aeSArmin Le Grand 
8958e893aeSArmin Le Grand namespace svx { namespace sidebar {
9058e893aeSArmin Le Grand 
918dcb2a10SAndre Fischer class PopupContainer;
928dcb2a10SAndre Fischer class ColorPopup;
938dcb2a10SAndre Fischer class LineStyleControl;
948dcb2a10SAndre Fischer class LineWidthControl;
958dcb2a10SAndre Fischer 
968dcb2a10SAndre Fischer 
9758e893aeSArmin Le Grand class LinePropertyPanel
9858e893aeSArmin Le Grand :   public Control,
99*f120fe41SAndre Fischer     public ::sfx2::sidebar::IContextChangeReceiver,
10058e893aeSArmin Le Grand     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
10158e893aeSArmin Le Grand {
10258e893aeSArmin Le Grand private:
10335fa8f12SArmin Le Grand     friend class ::SvxLineStylePage;
10435fa8f12SArmin Le Grand     friend class ::SvxLineWidthPage;
10558e893aeSArmin Le Grand 
10658e893aeSArmin Le Grand public:
10758e893aeSArmin Le Grand     static LinePropertyPanel* Create(
10858e893aeSArmin Le Grand         Window* pParent,
10958e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
11058e893aeSArmin Le Grand         SfxBindings* pBindings);
11158e893aeSArmin Le Grand 
11258e893aeSArmin Le Grand     virtual void DataChanged(
11358e893aeSArmin Le Grand         const DataChangedEvent& rEvent);
11458e893aeSArmin Le Grand 
11558e893aeSArmin Le Grand     virtual void HandleContextChange(
11658e893aeSArmin Le Grand         const ::sfx2::sidebar::EnumContext aContext);
11758e893aeSArmin Le Grand 
11858e893aeSArmin Le Grand     virtual void NotifyItemUpdate(
11958e893aeSArmin Le Grand         const sal_uInt16 nSId,
12058e893aeSArmin Le Grand         const SfxItemState eState,
12158e893aeSArmin Le Grand         const SfxPoolItem* pState);
12258e893aeSArmin Le Grand 
12358e893aeSArmin Le Grand     SfxBindings* GetBindings();
1246cdc6e4fSArmin Le Grand     void ShowMenu (void);
12558e893aeSArmin Le Grand 
1268dcb2a10SAndre Fischer     void SetLineDashItem(XLineDashItem* pDash);
1278dcb2a10SAndre Fischer     void SetLineStyleItem(XLineStyleItem* pStyle);
1288dcb2a10SAndre Fischer 
1298dcb2a10SAndre Fischer     void SetWidth(long nWidth);
1308dcb2a10SAndre Fischer     void SetWidthIcon(int n);
1318dcb2a10SAndre Fischer     void SetWidthIcon();
1328dcb2a10SAndre Fischer 
1338dcb2a10SAndre Fischer     void EndLineStylePopupMode (void);
1348dcb2a10SAndre Fischer     void EndLineWidthPopupMode (void);
1358dcb2a10SAndre Fischer 
13658e893aeSArmin Le Grand private:
13758e893aeSArmin Le Grand     //ui controls
13858e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
1398d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
14058e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
14158e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTColor;
1428d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
14358e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
14458e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
1458d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBStyleBackground;
14658e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBStyle;
14758e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
14858e893aeSArmin Le Grand     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
14958e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
150d5370dc8SArmin Le Grand     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBStart;
151d5370dc8SArmin Le Grand     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBEnd;
152d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
153d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
154d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
155d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
15658e893aeSArmin Le Grand 
15758e893aeSArmin Le Grand     //ControllerItem
15858e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStyleControl;
15958e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maDashControl;
16058e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maWidthControl;
161d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maColorControl;
16258e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStartControl;
16358e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEndControl;
16458e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
165d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maTransControl;
166d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
167d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maCapStyle;
16858e893aeSArmin Le Grand 
16958e893aeSArmin Le Grand     Color                                                   maColor;
17058e893aeSArmin Le Grand     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
17158e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
17258e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
17358e893aeSArmin Le Grand     sal_uInt16                                              mnTrans;
17458e893aeSArmin Le Grand     SfxMapUnit                                              meMapUnit;
17558e893aeSArmin Le Grand     sal_Int32                                               mnWidthCoreValue;
17658e893aeSArmin Le Grand     XLineEndList*                                           mpLineEndList;
17758e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
17858e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
17958e893aeSArmin Le Grand 
18058e893aeSArmin Le Grand     //popup windows
1818dcb2a10SAndre Fischer     ColorPopup maColorPopup;
1828dcb2a10SAndre Fischer     LineStylePopup maLineStylePopup;
1838dcb2a10SAndre Fischer     LineWidthPopup maLineWidthPopup;
18458e893aeSArmin Le Grand 
18558e893aeSArmin Le Grand     // images from ressource
18658e893aeSArmin Le Grand     Image                                                   maIMGColor;
18758e893aeSArmin Le Grand     Image                                                   maIMGNone;
18858e893aeSArmin Le Grand 
18958e893aeSArmin Le Grand     // multi-images
1908dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIcon;
1918dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIcon;
1928dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIconH;	//high contrast
1938dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIconH;	//high contrast
19458e893aeSArmin Le Grand 
19558e893aeSArmin Le Grand     cssu::Reference< css::frame::XFrame >                   mxFrame;
19658e893aeSArmin Le Grand     ::sfx2::sidebar::EnumContext                            maContext;
19758e893aeSArmin Le Grand     SfxBindings*                                            mpBindings;
19858e893aeSArmin Le Grand 
19958e893aeSArmin Le Grand     /// bitfield
20058e893aeSArmin Le Grand 	bool				mbColorAvailable : 1;
20158e893aeSArmin Le Grand 	bool				mbStyleAvailable : 1;
20258e893aeSArmin Le Grand 	bool				mbDashAvailable : 1;
20358e893aeSArmin Le Grand 	bool				mbTransAvailable : 1;
20458e893aeSArmin Le Grand 	bool				mbWidthValuable : 1;
20558e893aeSArmin Le Grand 	bool				mbStartAvailable : 1;
20658e893aeSArmin Le Grand 	bool				mbEndAvailable : 1;
20758e893aeSArmin Le Grand 
20858e893aeSArmin Le Grand     void SetupIcons(void);
20958e893aeSArmin Le Grand 	void Initialize();
21058e893aeSArmin Le Grand 	void FillLineEndList();
21158e893aeSArmin Le Grand 	void SelectEndStyle(bool bStart);
21258e893aeSArmin Le Grand 
21358e893aeSArmin Le Grand 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
21458e893aeSArmin Le Grand 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
21558e893aeSArmin Le Grand 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
21658e893aeSArmin Le Grand 	DECL_LINK(ToolboxStyleSelectHdl, ToolBox*);
21758e893aeSArmin Le Grand 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
21858e893aeSArmin Le Grand 	DECL_LINK(ChangeTransparentHdl , void *);
21958e893aeSArmin Le Grand 	DECL_LINK(ChangeStartHdl, void *);
22058e893aeSArmin Le Grand 	DECL_LINK(ChangeEndHdl, void *);
221d5370dc8SArmin Le Grand 	DECL_LINK(ChangeEdgeStyleHdl, void *);
222d5370dc8SArmin Le Grand 	DECL_LINK(ChangeCapStyleHdl, void *);
22358e893aeSArmin Le Grand 
22458e893aeSArmin Le Grand     // constructor/destuctor
22558e893aeSArmin Le Grand     LinePropertyPanel(
22658e893aeSArmin Le Grand         Window* pParent,
22758e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
22858e893aeSArmin Le Grand         SfxBindings* pBindings);
22958e893aeSArmin Le Grand     virtual ~LinePropertyPanel(void);
23058e893aeSArmin Le Grand 
23158e893aeSArmin Le Grand     void SetStyleIcon();
2328dcb2a10SAndre Fischer     void SetColor(
2338dcb2a10SAndre Fischer         const String& rsColorName,
2348dcb2a10SAndre Fischer         const Color aColor);
23558e893aeSArmin Le Grand 
2368dcb2a10SAndre Fischer     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
2378dcb2a10SAndre Fischer     PopupControl* CreateLineStylePopupControl (PopupContainer* pParent);
2388dcb2a10SAndre Fischer     PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
23958e893aeSArmin Le Grand };
24058e893aeSArmin Le Grand 
2418dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
24258e893aeSArmin Le Grand 
2438dcb2a10SAndre Fischer #endif
244