xref: /AOO41X/main/svx/source/sidebar/line/LinePropertyPanel.hxx (revision 4e8031e0a9bc16df402a00dc593d120d34289fa7)
18dcb2a10SAndre Fischer /**************************************************************
28dcb2a10SAndre Fischer  *
38dcb2a10SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
48dcb2a10SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
58dcb2a10SAndre Fischer  * distributed with this work for additional information
68dcb2a10SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
78dcb2a10SAndre Fischer  * to you under the Apache License, Version 2.0 (the
88dcb2a10SAndre Fischer  * "License"); you may not use this file except in compliance
98dcb2a10SAndre Fischer  * with the License.  You may obtain a copy of the License at
108dcb2a10SAndre Fischer  *
118dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
128dcb2a10SAndre Fischer  *
138dcb2a10SAndre Fischer  * Unless required by applicable law or agreed to in writing,
148dcb2a10SAndre Fischer  * software distributed under the License is distributed on an
158dcb2a10SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
168dcb2a10SAndre Fischer  * KIND, either express or implied.  See the License for the
178dcb2a10SAndre Fischer  * specific language governing permissions and limitations
188dcb2a10SAndre Fischer  * under the License.
198dcb2a10SAndre Fischer  *
208dcb2a10SAndre Fischer  *************************************************************/
218dcb2a10SAndre Fischer 
228dcb2a10SAndre Fischer #ifndef SVX_PROPERTYPANEL_LINEPAGE_HXX
238dcb2a10SAndre Fischer #define SVX_PROPERTYPANEL_LINEPAGE_HXX
248dcb2a10SAndre Fischer 
258dcb2a10SAndre Fischer #include <svx/xdash.hxx>
268dcb2a10SAndre Fischer #include <vcl/ctrl.hxx>
278dcb2a10SAndre Fischer #include <sfx2/sidebar/SidebarPanelBase.hxx>
288dcb2a10SAndre Fischer #include <sfx2/sidebar/ControllerItem.hxx>
29f120fe41SAndre Fischer #include <sfx2/sidebar/IContextChangeReceiver.hxx>
308dcb2a10SAndre Fischer #include <vcl/fixed.hxx>
318dcb2a10SAndre Fischer #include <vcl/field.hxx>
328dcb2a10SAndre Fischer #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"
378dcb2a10SAndre Fischer 
388dcb2a10SAndre Fischer 
398dcb2a10SAndre Fischer namespace svx { class ToolboxButtonColorUpdater; }
408dcb2a10SAndre Fischer class SvxLineColorPage;
418dcb2a10SAndre Fischer class SvxLineStylePage;
428dcb2a10SAndre Fischer class SvxLineWidthPage;
438dcb2a10SAndre Fischer class XLineStyleItem;
448dcb2a10SAndre Fischer class XLineDashItem;
458dcb2a10SAndre Fischer class XLineStartItem;
468dcb2a10SAndre Fischer class XLineEndItem;
478dcb2a10SAndre Fischer class LineEndLB_LPP;
488dcb2a10SAndre Fischer class XLineEndList;
498dcb2a10SAndre Fischer 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
878dcb2a10SAndre Fischer 
888dcb2a10SAndre Fischer 
898dcb2a10SAndre Fischer namespace svx { namespace sidebar {
908dcb2a10SAndre Fischer 
918dcb2a10SAndre Fischer class PopupContainer;
928dcb2a10SAndre Fischer class ColorPopup;
938dcb2a10SAndre Fischer class LineStyleControl;
948dcb2a10SAndre Fischer class LineWidthControl;
958dcb2a10SAndre Fischer 
968dcb2a10SAndre Fischer 
978dcb2a10SAndre Fischer class LinePropertyPanel
988dcb2a10SAndre Fischer :   public Control,
99f120fe41SAndre Fischer     public ::sfx2::sidebar::IContextChangeReceiver,
1008dcb2a10SAndre Fischer     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
1018dcb2a10SAndre Fischer {
1028dcb2a10SAndre Fischer private:
1038dcb2a10SAndre Fischer     friend class ::SvxLineStylePage;
1048dcb2a10SAndre Fischer     friend class ::SvxLineWidthPage;
1058dcb2a10SAndre Fischer 
1068dcb2a10SAndre Fischer public:
1078dcb2a10SAndre Fischer     static LinePropertyPanel* Create(
1088dcb2a10SAndre Fischer         Window* pParent,
1098dcb2a10SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
1108dcb2a10SAndre Fischer         SfxBindings* pBindings);
1118dcb2a10SAndre Fischer 
1128dcb2a10SAndre Fischer     virtual void DataChanged(
1138dcb2a10SAndre Fischer         const DataChangedEvent& rEvent);
1148dcb2a10SAndre Fischer 
1158dcb2a10SAndre Fischer     virtual void HandleContextChange(
1168dcb2a10SAndre Fischer         const ::sfx2::sidebar::EnumContext aContext);
1178dcb2a10SAndre Fischer 
1188dcb2a10SAndre Fischer     virtual void NotifyItemUpdate(
1198dcb2a10SAndre Fischer         const sal_uInt16 nSId,
1208dcb2a10SAndre Fischer         const SfxItemState eState,
1218dcb2a10SAndre Fischer         const SfxPoolItem* pState);
1228dcb2a10SAndre Fischer 
1238dcb2a10SAndre Fischer     SfxBindings* GetBindings();
1248dcb2a10SAndre Fischer 
1258dcb2a10SAndre Fischer     void SetLineDashItem(XLineDashItem* pDash);
1268dcb2a10SAndre Fischer     void SetLineStyleItem(XLineStyleItem* pStyle);
1278dcb2a10SAndre Fischer 
1288dcb2a10SAndre Fischer     void SetWidth(long nWidth);
1298dcb2a10SAndre Fischer     void SetWidthIcon(int n);
1308dcb2a10SAndre Fischer     void SetWidthIcon();
1318dcb2a10SAndre Fischer 
1328dcb2a10SAndre Fischer     void EndLineStylePopupMode (void);
1338dcb2a10SAndre Fischer     void EndLineWidthPopupMode (void);
1348dcb2a10SAndre Fischer 
1358dcb2a10SAndre Fischer private:
1368dcb2a10SAndre Fischer     //ui controls
1378dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
1388dcb2a10SAndre Fischer     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
1398dcb2a10SAndre Fischer     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
1408dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTColor;
1418dcb2a10SAndre Fischer     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
1428dcb2a10SAndre Fischer     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
1438dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
1448dcb2a10SAndre Fischer     ::boost::scoped_ptr< Window >                           mpTBStyleBackground;
1458dcb2a10SAndre Fischer     ::boost::scoped_ptr< ToolBox >                          mpTBStyle;
1468dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
1478dcb2a10SAndre Fischer     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
1488dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
1498dcb2a10SAndre Fischer     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBStart;
1508dcb2a10SAndre Fischer     ::boost::scoped_ptr< LineEndLB_LPP >                    mpLBEnd;
1518dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
1528dcb2a10SAndre Fischer     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
1538dcb2a10SAndre Fischer     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
1548dcb2a10SAndre Fischer     ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
1558dcb2a10SAndre Fischer 
1568dcb2a10SAndre Fischer     //ControllerItem
1578dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maStyleControl;
1588dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maDashControl;
1598dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maWidthControl;
1608dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maColorControl;
1618dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maStartControl;
1628dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maEndControl;
1638dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
1648dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maTransControl;
1658dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
1668dcb2a10SAndre Fischer     ::sfx2::sidebar::ControllerItem                         maCapStyle;
1678dcb2a10SAndre Fischer 
1688dcb2a10SAndre Fischer     Color                                                   maColor;
1698dcb2a10SAndre Fischer     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
1708dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
1718dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
1728dcb2a10SAndre Fischer     sal_uInt16                                              mnTrans;
1738dcb2a10SAndre Fischer     SfxMapUnit                                              meMapUnit;
1748dcb2a10SAndre Fischer     sal_Int32                                               mnWidthCoreValue;
1758dcb2a10SAndre Fischer     XLineEndList*                                           mpLineEndList;
1768dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
1778dcb2a10SAndre Fischer     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
1788dcb2a10SAndre Fischer 
1798dcb2a10SAndre Fischer     //popup windows
1808dcb2a10SAndre Fischer     ColorPopup maColorPopup;
1818dcb2a10SAndre Fischer     LineStylePopup maLineStylePopup;
1828dcb2a10SAndre Fischer     LineWidthPopup maLineWidthPopup;
1838dcb2a10SAndre Fischer 
1848dcb2a10SAndre Fischer     // images from ressource
1858dcb2a10SAndre Fischer     Image                                                   maIMGColor;
1868dcb2a10SAndre Fischer     Image                                                   maIMGNone;
1878dcb2a10SAndre Fischer 
1888dcb2a10SAndre Fischer     // multi-images
1898dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIcon;
1908dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIcon;
1918dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGStyleIconH;	//high contrast
1928dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIconH;	//high contrast
1938dcb2a10SAndre Fischer 
1948dcb2a10SAndre Fischer     cssu::Reference< css::frame::XFrame >                   mxFrame;
1958dcb2a10SAndre Fischer     ::sfx2::sidebar::EnumContext                            maContext;
1968dcb2a10SAndre Fischer     SfxBindings*                                            mpBindings;
1978dcb2a10SAndre Fischer 
1988dcb2a10SAndre Fischer     /// bitfield
1998dcb2a10SAndre Fischer 	bool				mbColorAvailable : 1;
2008dcb2a10SAndre Fischer 	bool				mbStyleAvailable : 1;
2018dcb2a10SAndre Fischer 	bool				mbDashAvailable : 1;
2028dcb2a10SAndre Fischer 	bool				mbTransAvailable : 1;
2038dcb2a10SAndre Fischer 	bool				mbWidthValuable : 1;
2048dcb2a10SAndre Fischer 	bool				mbStartAvailable : 1;
2058dcb2a10SAndre Fischer 	bool				mbEndAvailable : 1;
2068dcb2a10SAndre Fischer 
2078dcb2a10SAndre Fischer     void SetupIcons(void);
2088dcb2a10SAndre Fischer 	void Initialize();
2098dcb2a10SAndre Fischer 	void FillLineEndList();
2108dcb2a10SAndre Fischer 	void SelectEndStyle(bool bStart);
2118dcb2a10SAndre Fischer 
2128dcb2a10SAndre Fischer 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
2138dcb2a10SAndre Fischer 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
2148dcb2a10SAndre Fischer 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
2158dcb2a10SAndre Fischer 	DECL_LINK(ToolboxStyleSelectHdl, ToolBox*);
2168dcb2a10SAndre Fischer 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
2178dcb2a10SAndre Fischer 	DECL_LINK(ChangeTransparentHdl , void *);
2188dcb2a10SAndre Fischer 	DECL_LINK(ChangeStartHdl, void *);
2198dcb2a10SAndre Fischer 	DECL_LINK(ChangeEndHdl, void *);
2208dcb2a10SAndre Fischer 	DECL_LINK(ChangeEdgeStyleHdl, void *);
2218dcb2a10SAndre Fischer 	DECL_LINK(ChangeCapStyleHdl, void *);
2228dcb2a10SAndre Fischer 
2238dcb2a10SAndre Fischer     // constructor/destuctor
2248dcb2a10SAndre Fischer     LinePropertyPanel(
2258dcb2a10SAndre Fischer         Window* pParent,
2268dcb2a10SAndre Fischer         const cssu::Reference<css::frame::XFrame>& rxFrame,
2278dcb2a10SAndre Fischer         SfxBindings* pBindings);
2288dcb2a10SAndre Fischer     virtual ~LinePropertyPanel(void);
2298dcb2a10SAndre Fischer 
2308dcb2a10SAndre Fischer     void SetStyleIcon();
2318dcb2a10SAndre Fischer     void SetColor(
2328dcb2a10SAndre Fischer         const String& rsColorName,
2338dcb2a10SAndre Fischer         const Color aColor);
2348dcb2a10SAndre Fischer 
2358dcb2a10SAndre Fischer     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
2368dcb2a10SAndre Fischer     PopupControl* CreateLineStylePopupControl (PopupContainer* pParent);
2378dcb2a10SAndre Fischer     PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
2388dcb2a10SAndre Fischer };
2398dcb2a10SAndre Fischer 
2408dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
2418dcb2a10SAndre Fischer 
2428dcb2a10SAndre Fischer #endif
243*4e8031e0SArmin Le Grand 
244*4e8031e0SArmin Le Grand // eof
245