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*6a606da0SAndre Fischer #include <sfx2/sidebar/GridLayouter.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 "LineWidthPopup.hxx"
3658e893aeSArmin Le Grand 
3758e893aeSArmin Le Grand namespace svx { class ToolboxButtonColorUpdater; }
3858e893aeSArmin Le Grand class SvxLineColorPage;
3958e893aeSArmin Le Grand class SvxLineStylePage;
4058e893aeSArmin Le Grand class SvxLineWidthPage;
4158e893aeSArmin Le Grand class XLineStyleItem;
4258e893aeSArmin Le Grand class XLineDashItem;
4358e893aeSArmin Le Grand class XLineStartItem;
4458e893aeSArmin Le Grand class XLineEndItem;
4558e893aeSArmin Le Grand class XLineEndList;
4697e8a929SArmin Le Grand class XDashList;
47d5370dc8SArmin Le Grand class ListBox;
488dcb2a10SAndre Fischer class ToolBox;
498dcb2a10SAndre Fischer class FloatingWindow;
508dcb2a10SAndre Fischer 
51c7be74b1SArmin Le Grand typedef ::boost::shared_ptr< XLineEndList > XLineEndListSharedPtr;
52c7be74b1SArmin Le Grand typedef ::boost::shared_ptr< XDashList > XDashListSharedPtr;
53c7be74b1SArmin Le Grand 
548dcb2a10SAndre Fischer namespace {
558dcb2a10SAndre Fischer     #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US)
568dcb2a10SAndre Fischer } //end of anonymous namespace
5758e893aeSArmin Le Grand 
5858e893aeSArmin Le Grand namespace svx { namespace sidebar {
5958e893aeSArmin Le Grand 
608dcb2a10SAndre Fischer class PopupContainer;
618dcb2a10SAndre Fischer class ColorPopup;
628dcb2a10SAndre Fischer class LineWidthControl;
638dcb2a10SAndre Fischer 
648dcb2a10SAndre Fischer 
6558e893aeSArmin Le Grand class LinePropertyPanel
6658e893aeSArmin Le Grand :   public Control,
6758e893aeSArmin Le Grand     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
6858e893aeSArmin Le Grand {
6958e893aeSArmin Le Grand private:
7035fa8f12SArmin Le Grand     friend class ::SvxLineStylePage;
7135fa8f12SArmin Le Grand     friend class ::SvxLineWidthPage;
7258e893aeSArmin Le Grand 
7358e893aeSArmin Le Grand public:
7458e893aeSArmin Le Grand     static LinePropertyPanel* Create(
7558e893aeSArmin Le Grand         Window* pParent,
7658e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
7758e893aeSArmin Le Grand         SfxBindings* pBindings);
7858e893aeSArmin Le Grand 
7958e893aeSArmin Le Grand     virtual void DataChanged(
8058e893aeSArmin Le Grand         const DataChangedEvent& rEvent);
8158e893aeSArmin Le Grand 
8258e893aeSArmin Le Grand     virtual void NotifyItemUpdate(
8358e893aeSArmin Le Grand         const sal_uInt16 nSId,
8458e893aeSArmin Le Grand         const SfxItemState eState,
8545da7d5eSAndre Fischer         const SfxPoolItem* pState,
8645da7d5eSAndre Fischer         const bool bIsEnabled);
8758e893aeSArmin Le Grand 
8858e893aeSArmin Le Grand     SfxBindings* GetBindings();
8958e893aeSArmin Le Grand 
908dcb2a10SAndre Fischer     void SetWidth(long nWidth);
918dcb2a10SAndre Fischer     void SetWidthIcon(int n);
928dcb2a10SAndre Fischer     void SetWidthIcon();
938dcb2a10SAndre Fischer 
948dcb2a10SAndre Fischer     void EndLineWidthPopupMode (void);
958dcb2a10SAndre Fischer 
96*6a606da0SAndre Fischer     virtual void Resize (void);
97*6a606da0SAndre Fischer 
9858e893aeSArmin Le Grand private:
9958e893aeSArmin Le Grand     //ui controls
10058e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
1018d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
10258e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
10358e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTColor;
1048d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
10558e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
10658e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
10797e8a929SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBStyle;
10858e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
10958e893aeSArmin Le Grand     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
11058e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
111a567bdc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBStart;
112a567bdc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEnd;
113d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
114d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
115d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
116d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
11758e893aeSArmin Le Grand 
11858e893aeSArmin Le Grand     //ControllerItem
11958e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStyleControl;
12058e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maDashControl;
12158e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maWidthControl;
122d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maColorControl;
12358e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStartControl;
12458e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEndControl;
12558e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
12697e8a929SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maLineStyleListControl;
127d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maTransControl;
128d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
129d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maCapStyle;
13058e893aeSArmin Le Grand 
13158e893aeSArmin Le Grand     Color                                                   maColor;
13258e893aeSArmin Le Grand     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
13358e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
13458e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
13558e893aeSArmin Le Grand     sal_uInt16                                              mnTrans;
13658e893aeSArmin Le Grand     SfxMapUnit                                              meMapUnit;
13758e893aeSArmin Le Grand     sal_Int32                                               mnWidthCoreValue;
138c7be74b1SArmin Le Grand     XLineEndListSharedPtr                                   maLineEndList;
139c7be74b1SArmin Le Grand     XDashListSharedPtr                                      maLineStyleList;
14058e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
14158e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
14258e893aeSArmin Le Grand 
14358e893aeSArmin Le Grand     //popup windows
1448dcb2a10SAndre Fischer     ColorPopup maColorPopup;
1458dcb2a10SAndre Fischer     LineWidthPopup maLineWidthPopup;
14658e893aeSArmin Le Grand 
14758e893aeSArmin Le Grand     // images from ressource
14858e893aeSArmin Le Grand     Image                                                   maIMGColor;
14958e893aeSArmin Le Grand     Image                                                   maIMGNone;
15058e893aeSArmin Le Grand 
15158e893aeSArmin Le Grand     // multi-images
1528dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIcon;
1538dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIconH;	//high contrast
15458e893aeSArmin Le Grand 
15558e893aeSArmin Le Grand     cssu::Reference< css::frame::XFrame >                   mxFrame;
15658e893aeSArmin Le Grand     SfxBindings*                                            mpBindings;
15758e893aeSArmin Le Grand 
15858e893aeSArmin Le Grand     /// bitfield
15958e893aeSArmin Le Grand 	bool				mbColorAvailable : 1;
16058e893aeSArmin Le Grand 	bool				mbWidthValuable : 1;
16158e893aeSArmin Le Grand 
162*6a606da0SAndre Fischer     ::sfx2::sidebar::GridLayouter maLayouter;
163*6a606da0SAndre Fischer 
16458e893aeSArmin Le Grand     void SetupIcons(void);
16558e893aeSArmin Le Grand 	void Initialize();
16658e893aeSArmin Le Grand 	void FillLineEndList();
16797e8a929SArmin Le Grand 	void FillLineStyleList();
16858e893aeSArmin Le Grand 	void SelectEndStyle(bool bStart);
16997e8a929SArmin Le Grand 	void SelectLineStyle();
17058e893aeSArmin Le Grand 
17158e893aeSArmin Le Grand 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
17258e893aeSArmin Le Grand 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
17358e893aeSArmin Le Grand 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
17497e8a929SArmin Le Grand 	DECL_LINK(ChangeLineStyleHdl, ToolBox*);
17558e893aeSArmin Le Grand 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
17658e893aeSArmin Le Grand 	DECL_LINK(ChangeTransparentHdl , void *);
17758e893aeSArmin Le Grand 	DECL_LINK(ChangeStartHdl, void *);
17858e893aeSArmin Le Grand 	DECL_LINK(ChangeEndHdl, void *);
179d5370dc8SArmin Le Grand 	DECL_LINK(ChangeEdgeStyleHdl, void *);
180d5370dc8SArmin Le Grand 	DECL_LINK(ChangeCapStyleHdl, void *);
18158e893aeSArmin Le Grand 
18258e893aeSArmin Le Grand     // constructor/destuctor
18358e893aeSArmin Le Grand     LinePropertyPanel(
18458e893aeSArmin Le Grand         Window* pParent,
18558e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
18658e893aeSArmin Le Grand         SfxBindings* pBindings);
18758e893aeSArmin Le Grand     virtual ~LinePropertyPanel(void);
18858e893aeSArmin Le Grand 
1898dcb2a10SAndre Fischer     void SetColor(
1908dcb2a10SAndre Fischer         const String& rsColorName,
1918dcb2a10SAndre Fischer         const Color aColor);
19258e893aeSArmin Le Grand 
1938dcb2a10SAndre Fischer     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
1948dcb2a10SAndre Fischer     PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
19558e893aeSArmin Le Grand };
19658e893aeSArmin Le Grand 
1978dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
19858e893aeSArmin Le Grand 
1998dcb2a10SAndre Fischer #endif
2004e8031e0SArmin Le Grand 
2014e8031e0SArmin Le Grand // eof
202