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>
2958e893aeSArmin Le Grand #include <vcl/fixed.hxx>
3058e893aeSArmin Le Grand #include <vcl/field.hxx>
3158e893aeSArmin Le Grand #include <boost/scoped_ptr.hpp>
328dcb2a10SAndre Fischer #include <boost/scoped_array.hpp>
33facb16e7SArmin Le Grand #include <svx/sidebar/ColorPopup.hxx>
348dcb2a10SAndre Fischer #include "LineWidthPopup.hxx"
3558e893aeSArmin Le Grand 
3658e893aeSArmin Le Grand namespace svx { class ToolboxButtonColorUpdater; }
3758e893aeSArmin Le Grand class SvxLineColorPage;
3858e893aeSArmin Le Grand class SvxLineStylePage;
3958e893aeSArmin Le Grand class SvxLineWidthPage;
4058e893aeSArmin Le Grand class XLineStyleItem;
4158e893aeSArmin Le Grand class XLineDashItem;
4258e893aeSArmin Le Grand class XLineStartItem;
4358e893aeSArmin Le Grand class XLineEndItem;
4458e893aeSArmin Le Grand class XLineEndList;
4597e8a929SArmin Le Grand class XDashList;
46d5370dc8SArmin Le Grand class ListBox;
478dcb2a10SAndre Fischer class ToolBox;
488dcb2a10SAndre Fischer class FloatingWindow;
498dcb2a10SAndre Fischer 
50*c7be74b1SArmin Le Grand typedef ::boost::shared_ptr< XLineEndList > XLineEndListSharedPtr;
51*c7be74b1SArmin Le Grand typedef ::boost::shared_ptr< XDashList > XDashListSharedPtr;
52*c7be74b1SArmin Le Grand 
538dcb2a10SAndre Fischer namespace {
548dcb2a10SAndre Fischer     #define SIDEBAR_LINE_WIDTH_GLOBAL_VALUE String("PopupPanel_LineWidth", 20, RTL_TEXTENCODING_ASCII_US)
558dcb2a10SAndre Fischer } //end of anonymous namespace
5658e893aeSArmin Le Grand 
5758e893aeSArmin Le Grand namespace svx { namespace sidebar {
5858e893aeSArmin Le Grand 
598dcb2a10SAndre Fischer class PopupContainer;
608dcb2a10SAndre Fischer class ColorPopup;
618dcb2a10SAndre Fischer class LineWidthControl;
628dcb2a10SAndre Fischer 
638dcb2a10SAndre Fischer 
6458e893aeSArmin Le Grand class LinePropertyPanel
6558e893aeSArmin Le Grand :   public Control,
6658e893aeSArmin Le Grand     public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
6758e893aeSArmin Le Grand {
6858e893aeSArmin Le Grand private:
6935fa8f12SArmin Le Grand     friend class ::SvxLineStylePage;
7035fa8f12SArmin Le Grand     friend class ::SvxLineWidthPage;
7158e893aeSArmin Le Grand 
7258e893aeSArmin Le Grand public:
7358e893aeSArmin Le Grand     static LinePropertyPanel* Create(
7458e893aeSArmin Le Grand         Window* pParent,
7558e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
7658e893aeSArmin Le Grand         SfxBindings* pBindings);
7758e893aeSArmin Le Grand 
7858e893aeSArmin Le Grand     virtual void DataChanged(
7958e893aeSArmin Le Grand         const DataChangedEvent& rEvent);
8058e893aeSArmin Le Grand 
8158e893aeSArmin Le Grand     virtual void NotifyItemUpdate(
8258e893aeSArmin Le Grand         const sal_uInt16 nSId,
8358e893aeSArmin Le Grand         const SfxItemState eState,
8445da7d5eSAndre Fischer         const SfxPoolItem* pState,
8545da7d5eSAndre Fischer         const bool bIsEnabled);
8658e893aeSArmin Le Grand 
8758e893aeSArmin Le Grand     SfxBindings* GetBindings();
8858e893aeSArmin Le Grand 
898dcb2a10SAndre Fischer     void SetWidth(long nWidth);
908dcb2a10SAndre Fischer     void SetWidthIcon(int n);
918dcb2a10SAndre Fischer     void SetWidthIcon();
928dcb2a10SAndre Fischer 
938dcb2a10SAndre Fischer     void EndLineWidthPopupMode (void);
948dcb2a10SAndre Fischer 
9558e893aeSArmin Le Grand private:
9658e893aeSArmin Le Grand     //ui controls
9758e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTWidth;
988d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBWidthBackground;
9958e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBWidth;
10058e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTColor;
1018d3cb1a4SArmin Le Grand     ::boost::scoped_ptr< Window >                           mpTBColorBackground;
10258e893aeSArmin Le Grand     ::boost::scoped_ptr< ToolBox >                          mpTBColor;
10358e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTStyle;
10497e8a929SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBStyle;
10558e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTTrancparency;
10658e893aeSArmin Le Grand     ::boost::scoped_ptr< MetricField >                      mpMFTransparent;
10758e893aeSArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTArrow;
108a567bdc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBStart;
109a567bdc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEnd;
110d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTEdgeStyle;
111d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBEdgeStyle;
112d5370dc8SArmin Le Grand     ::boost::scoped_ptr< FixedText >                        mpFTCapStyle;
113d5370dc8SArmin Le Grand     ::boost::scoped_ptr< ListBox >                          mpLBCapStyle;
11458e893aeSArmin Le Grand 
11558e893aeSArmin Le Grand     //ControllerItem
11658e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStyleControl;
11758e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maDashControl;
11858e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maWidthControl;
119d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maColorControl;
12058e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maStartControl;
12158e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEndControl;
12258e893aeSArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maLineEndListControl;
12397e8a929SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maLineStyleListControl;
124d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maTransControl;
125d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maEdgeStyle;
126d5370dc8SArmin Le Grand     ::sfx2::sidebar::ControllerItem                         maCapStyle;
12758e893aeSArmin Le Grand 
12858e893aeSArmin Le Grand     Color                                                   maColor;
12958e893aeSArmin Le Grand     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpColorUpdater;
13058e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStyleItem >                   mpStyleItem;
13158e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineDashItem >                    mpDashItem;
13258e893aeSArmin Le Grand     sal_uInt16                                              mnTrans;
13358e893aeSArmin Le Grand     SfxMapUnit                                              meMapUnit;
13458e893aeSArmin Le Grand     sal_Int32                                               mnWidthCoreValue;
135*c7be74b1SArmin Le Grand     XLineEndListSharedPtr                                   maLineEndList;
136*c7be74b1SArmin Le Grand     XDashListSharedPtr                                      maLineStyleList;
13758e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineStartItem >                   mpStartItem;
13858e893aeSArmin Le Grand     ::boost::scoped_ptr< XLineEndItem >                     mpEndItem;
13958e893aeSArmin Le Grand 
14058e893aeSArmin Le Grand     //popup windows
1418dcb2a10SAndre Fischer     ColorPopup maColorPopup;
1428dcb2a10SAndre Fischer     LineWidthPopup maLineWidthPopup;
14358e893aeSArmin Le Grand 
14458e893aeSArmin Le Grand     // images from ressource
14558e893aeSArmin Le Grand     Image                                                   maIMGColor;
14658e893aeSArmin Le Grand     Image                                                   maIMGNone;
14758e893aeSArmin Le Grand 
14858e893aeSArmin Le Grand     // multi-images
1498dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIcon;
1508dcb2a10SAndre Fischer     ::boost::scoped_array<Image>                            mpIMGWidthIconH;	//high contrast
15158e893aeSArmin Le Grand 
15258e893aeSArmin Le Grand     cssu::Reference< css::frame::XFrame >                   mxFrame;
15358e893aeSArmin Le Grand     SfxBindings*                                            mpBindings;
15458e893aeSArmin Le Grand 
15558e893aeSArmin Le Grand     /// bitfield
15658e893aeSArmin Le Grand 	bool				mbColorAvailable : 1;
15758e893aeSArmin Le Grand 	bool				mbWidthValuable : 1;
15858e893aeSArmin Le Grand 
15958e893aeSArmin Le Grand     void SetupIcons(void);
16058e893aeSArmin Le Grand 	void Initialize();
16158e893aeSArmin Le Grand 	void FillLineEndList();
16297e8a929SArmin Le Grand 	void FillLineStyleList();
16358e893aeSArmin Le Grand 	void SelectEndStyle(bool bStart);
16497e8a929SArmin Le Grand 	void SelectLineStyle();
16558e893aeSArmin Le Grand 
16658e893aeSArmin Le Grand 	DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
16758e893aeSArmin Le Grand 	DECL_LINK(ImplWidthPopupModeEndHdl, FloatingWindow* );
16858e893aeSArmin Le Grand 	DECL_LINK(ToolboxColorSelectHdl, ToolBox*);
16997e8a929SArmin Le Grand 	DECL_LINK(ChangeLineStyleHdl, ToolBox*);
17058e893aeSArmin Le Grand 	DECL_LINK(ToolboxWidthSelectHdl, ToolBox*);
17158e893aeSArmin Le Grand 	DECL_LINK(ChangeTransparentHdl , void *);
17258e893aeSArmin Le Grand 	DECL_LINK(ChangeStartHdl, void *);
17358e893aeSArmin Le Grand 	DECL_LINK(ChangeEndHdl, void *);
174d5370dc8SArmin Le Grand 	DECL_LINK(ChangeEdgeStyleHdl, void *);
175d5370dc8SArmin Le Grand 	DECL_LINK(ChangeCapStyleHdl, void *);
17658e893aeSArmin Le Grand 
17758e893aeSArmin Le Grand     // constructor/destuctor
17858e893aeSArmin Le Grand     LinePropertyPanel(
17958e893aeSArmin Le Grand         Window* pParent,
18058e893aeSArmin Le Grand         const cssu::Reference<css::frame::XFrame>& rxFrame,
18158e893aeSArmin Le Grand         SfxBindings* pBindings);
18258e893aeSArmin Le Grand     virtual ~LinePropertyPanel(void);
18358e893aeSArmin Le Grand 
1848dcb2a10SAndre Fischer     void SetColor(
1858dcb2a10SAndre Fischer         const String& rsColorName,
1868dcb2a10SAndre Fischer         const Color aColor);
18758e893aeSArmin Le Grand 
1888dcb2a10SAndre Fischer     PopupControl* CreateColorPopupControl (PopupContainer* pParent);
1898dcb2a10SAndre Fischer     PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
19058e893aeSArmin Le Grand };
19158e893aeSArmin Le Grand 
1928dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
19358e893aeSArmin Le Grand 
1948dcb2a10SAndre Fischer #endif
1954e8031e0SArmin Le Grand 
1964e8031e0SArmin Le Grand // eof
197