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>
29f120fe41SAndre 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>
34facb16e7SArmin Le Grand #include <svx/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;
4758e893aeSArmin Le Grand class XLineEndList;
48d5370dc8SArmin Le Grand class ListBox;
498dcb2a10SAndre Fischer class ToolBox;
508dcb2a10SAndre Fischer class FloatingWindow;
518dcb2a10SAndre Fischer 
528dcb2a10SAndre Fischer namespace {
538dcb2a10SAndre Fischer     const String Dash_Name[] =
548dcb2a10SAndre Fischer     {
558dcb2a10SAndre Fischer         String("Ultrafine dashed", 16,  RTL_TEXTENCODING_ASCII_US),				//0
568dcb2a10SAndre Fischer         String("Dashed (variable)", 17,RTL_TEXTENCODING_ASCII_US ),				//6
578dcb2a10SAndre Fischer         String("Fine dashed (variable)",22,  RTL_TEXTENCODING_ASCII_US),		//5
588dcb2a10SAndre Fischer         String("Fine dashed", 11, RTL_TEXTENCODING_ASCII_US),					//1
598dcb2a10SAndre Fischer         String("Fine dotted", 11, RTL_TEXTENCODING_ASCII_US),					//3
608dcb2a10SAndre Fischer         String("Ultrafine dotted (variable)",27, RTL_TEXTENCODING_ASCII_US),	//8
618dcb2a10SAndre Fischer         String("3 dashes 3 dots (variable)", 26, RTL_TEXTENCODING_ASCII_US),	//7
628dcb2a10SAndre Fischer         String("2 dots 1 dash",13,RTL_TEXTENCODING_ASCII_US  )	,				//9
638dcb2a10SAndre Fischer         String("Ultrafine 2 dots 3 dashes",  25, RTL_TEXTENCODING_ASCII_US),	//2
648dcb2a10SAndre Fischer         String("Line with fine dots", 19, RTL_TEXTENCODING_ASCII_US)			//4
658dcb2a10SAndre Fischer     };
668dcb2a10SAndre Fischer 
678dcb2a10SAndre Fischer 
688dcb2a10SAndre Fischer     const XDash Dash_Set[] =
698dcb2a10SAndre Fischer     {
708dcb2a10SAndre Fischer         //Dash, dots, dotlen, dash, dashlen, distance
718dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1, 51, 1, 51, 51),									//0
728dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1, 197, 0,0, 127),							//6
738dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1, 197,0,0,197),								//5
748dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,508, 1,508, 508),									//1
758dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,  0, 0,  0, 457),									//3
768dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 1,  0, 0, 0, 50),								//8
778dcb2a10SAndre Fischer         XDash(XDASH_RECTRELATIVE, 3, 197, 3, 0, 100),							//7
788dcb2a10SAndre Fischer         XDash(XDASH_RECT, 2, 0, 1, 203,203)	,									//9
798dcb2a10SAndre Fischer         XDash(XDASH_RECT, 2, 51, 3,254, 127),									//2
808dcb2a10SAndre Fischer         XDash(XDASH_RECT, 1,2007,10, 0, 152)									//4
818dcb2a10SAndre Fischer     };
828dcb2a10SAndre Fischer 
838dcb2a10SAndre Fischer     #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US)
848dcb2a10SAndre Fischer 
858dcb2a10SAndre Fischer } //end of anonymous namespace
8658e893aeSArmin Le Grand 
8758e893aeSArmin Le Grand 
8858e893aeSArmin Le Grand namespace svx { namespace sidebar {
8958e893aeSArmin Le Grand 
908dcb2a10SAndre Fischer class PopupContainer;
918dcb2a10SAndre Fischer class ColorPopup;
928dcb2a10SAndre Fischer class LineStyleControl;
938dcb2a10SAndre Fischer class LineWidthControl;
948dcb2a10SAndre Fischer 
958dcb2a10SAndre Fischer 
9658e893aeSArmin Le Grand class LinePropertyPanel
9758e893aeSArmin Le Grand :   public Control,
98f120fe41SAndre Fischer     public ::sfx2::sidebar::IContextChangeReceiver,
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();
12358e893aeSArmin Le Grand 
1248dcb2a10SAndre Fischer     void SetLineDashItem(XLineDashItem* pDash);
1258dcb2a10SAndre Fischer     void SetLineStyleItem(XLineStyleItem* pStyle);
1268dcb2a10SAndre Fischer 
1278dcb2a10SAndre Fischer     void SetWidth(long nWidth);
1288dcb2a10SAndre Fischer     void SetWidthIcon(int n);
1298dcb2a10SAndre Fischer     void SetWidthIcon();
1308dcb2a10SAndre Fischer 
1318dcb2a10SAndre Fischer     void EndLineStylePopupMode (void);
1328dcb2a10SAndre Fischer     void EndLineWidthPopupMode (void);
1338dcb2a10SAndre Fischer 
13458e893aeSArmin Le Grand private:
13558e893aeSArmin Le Grand     //ui controls
13658e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
1378d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
13858e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
13958e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTColor;
1408d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
14158e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
14258e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
1438d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBStyleBackground;
14458e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBStyle;
14558e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
14658e893aeSArmin Le Grand     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
14758e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
148*a567bdc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBStart;
149*a567bdc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEnd;
150d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
151d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
152d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
153d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
15458e893aeSArmin Le Grand 
15558e893aeSArmin Le Grand     //ControllerItem
15658e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStyleControl;
15758e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maDashControl;
15858e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maWidthControl;
159d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maColorControl;
16058e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStartControl;
16158e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEndControl;
16258e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
163d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maTransControl;
164d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
165d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maCapStyle;
16658e893aeSArmin Le Grand 
16758e893aeSArmin Le Grand     Color                                                   maColor;
16858e893aeSArmin Le Grand     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
16958e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
17058e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
17158e893aeSArmin Le Grand     sal_uInt16                                              mnTrans;
17258e893aeSArmin Le Grand     SfxMapUnit                                              meMapUnit;
17358e893aeSArmin Le Grand     sal_Int32                                               mnWidthCoreValue;
17458e893aeSArmin Le Grand     XLineEndList*                                           mpLineEndList;
17558e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
17658e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
17758e893aeSArmin Le Grand 
17858e893aeSArmin Le Grand     //popup windows
1798dcb2a10SAndre Fischer     ColorPopup maColorPopup;
1808dcb2a10SAndre Fischer     LineStylePopup maLineStylePopup;
1818dcb2a10SAndre Fischer     LineWidthPopup maLineWidthPopup;
18258e893aeSArmin Le Grand 
18358e893aeSArmin Le Grand     // images from ressource
18458e893aeSArmin Le Grand     Image                                                   maIMGColor;
18558e893aeSArmin Le Grand     Image                                                   maIMGNone;
18658e893aeSArmin Le Grand 
18758e893aeSArmin Le Grand     // multi-images
1888dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIcon;
1898dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIcon;
1908dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIconH;	//high contrast
1918dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIconH;	//high contrast
19258e893aeSArmin Le Grand 
19358e893aeSArmin Le Grand     cssu::Reference< css::frame::XFrame >                   mxFrame;
19458e893aeSArmin Le Grand     ::sfx2::sidebar::EnumContext                            maContext;
19558e893aeSArmin Le Grand     SfxBindings*                                            mpBindings;
19658e893aeSArmin Le Grand 
19758e893aeSArmin Le Grand     /// bitfield
19858e893aeSArmin Le Grand 	bool				mbColorAvailable : 1;
19958e893aeSArmin Le Grand 	bool				mbStyleAvailable : 1;
20058e893aeSArmin Le Grand 	bool				mbDashAvailable : 1;
20158e893aeSArmin Le Grand 	bool				mbTransAvailable : 1;
20258e893aeSArmin Le Grand 	bool				mbWidthValuable : 1;
20358e893aeSArmin Le Grand 	bool				mbStartAvailable : 1;
20458e893aeSArmin Le Grand 	bool				mbEndAvailable : 1;
20558e893aeSArmin Le Grand 
20658e893aeSArmin Le Grand     void SetupIcons(void);
20758e893aeSArmin Le Grand 	void Initialize();
20858e893aeSArmin Le Grand 	void FillLineEndList();
20958e893aeSArmin Le Grand 	void SelectEndStyle(bool bStart);
21058e893aeSArmin Le Grand 
21158e893aeSArmin Le Grand 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
21258e893aeSArmin Le Grand 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
21358e893aeSArmin Le Grand 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
21458e893aeSArmin Le Grand 	DECL_LINK(ToolboxStyleSelectHdl, ToolBox*);
21558e893aeSArmin Le Grand 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
21658e893aeSArmin Le Grand 	DECL_LINK(ChangeTransparentHdl , void *);
21758e893aeSArmin Le Grand 	DECL_LINK(ChangeStartHdl, void *);
21858e893aeSArmin Le Grand 	DECL_LINK(ChangeEndHdl, void *);
219d5370dc8SArmin Le Grand 	DECL_LINK(ChangeEdgeStyleHdl, void *);
220d5370dc8SArmin Le Grand 	DECL_LINK(ChangeCapStyleHdl, void *);
22158e893aeSArmin Le Grand 
22258e893aeSArmin Le Grand     // constructor/destuctor
22358e893aeSArmin Le Grand     LinePropertyPanel(
22458e893aeSArmin Le Grand         Window* pParent,
22558e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
22658e893aeSArmin Le Grand         SfxBindings* pBindings);
22758e893aeSArmin Le Grand     virtual ~LinePropertyPanel(void);
22858e893aeSArmin Le Grand 
22958e893aeSArmin Le Grand     void SetStyleIcon();
2308dcb2a10SAndre Fischer     void SetColor(
2318dcb2a10SAndre Fischer         const String& rsColorName,
2328dcb2a10SAndre Fischer         const Color aColor);
23358e893aeSArmin Le Grand 
2348dcb2a10SAndre Fischer     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
2358dcb2a10SAndre Fischer     PopupControl* CreateLineStylePopupControl (PopupContainer* pParent);
2368dcb2a10SAndre Fischer     PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
23758e893aeSArmin Le Grand };
23858e893aeSArmin Le Grand 
2398dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
24058e893aeSArmin Le Grand 
2418dcb2a10SAndre Fischer #endif
2424e8031e0SArmin Le Grand 
2434e8031e0SArmin Le Grand // eof
244