xref: /trunk/main/svx/inc/svx/linectrl.hxx (revision c7be74b1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVX_LINECTRL_HXX
24 #define _SVX_LINECTRL_HXX
25 
26 
27 #include <svtools/valueset.hxx>
28 #include <svl/lstner.hxx>
29 #include <sfx2/tbxctrl.hxx>
30 #include "svx/svxdllapi.h"
31 
32 class XLineStyleItem;
33 class XLineDashItem;
34 class SvxLineBox;
35 class SvxMetricField;
36 class SvxColorBox;
37 class XLineEndList;
38 typedef ::boost::shared_ptr< XLineEndList > XLineEndListSharedPtr;
39 
40 //========================================================================
41 // SvxLineStyleController:
42 //========================================================================
43 
44 class SVX_DLLPUBLIC SvxLineStyleToolBoxControl : public SfxToolBoxControl
45 {
46 private:
47 	XLineStyleItem*		pStyleItem;
48 	XLineDashItem* 		pDashItem;
49 
50 	sal_Bool				bUpdate;
51 
52 public:
53 	SFX_DECL_TOOLBOX_CONTROL();
54 
55 	SvxLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
56 	~SvxLineStyleToolBoxControl();
57 
58 	virtual void		StateChanged( sal_uInt16 nSID, SfxItemState eState,
59 									  const SfxPoolItem* pState );
60 	void 		        Update( const SfxPoolItem* pState );
61 	virtual Window*		CreateItemWindow( Window *pParent );
62 };
63 
64 //========================================================================
65 // SvxLineWidthController:
66 //========================================================================
67 
68 class SVX_DLLPUBLIC SvxLineWidthToolBoxControl : public SfxToolBoxControl
69 {
70 public:
71 	SFX_DECL_TOOLBOX_CONTROL();
72 
73 	SvxLineWidthToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
74 	~SvxLineWidthToolBoxControl();
75 
76 	virtual void		StateChanged( sal_uInt16 nSID, SfxItemState eState,
77 									  const SfxPoolItem* pState );
78 	virtual Window*		CreateItemWindow( Window *pParent );
79 };
80 
81 //========================================================================
82 // SvxLineColorController:
83 //========================================================================
84 
85 class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl
86 {
87 public:
88 	SFX_DECL_TOOLBOX_CONTROL();
89 
90 	SvxLineColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
91 	~SvxLineColorToolBoxControl();
92 
93 	virtual void		StateChanged( sal_uInt16 nSID, SfxItemState eState,
94 									  const SfxPoolItem* pState );
95 	void 		        Update( const SfxPoolItem* pState );
96 	virtual Window*		CreateItemWindow( Window *pParent );
97 };
98 
99 //========================================================================
100 // class SvxLineEndWindow
101 //========================================================================
102 class SvxLineEndWindow : public SfxPopupWindow
103 {
104 	using FloatingWindow::StateChanged;
105 
106 private:
107 	XLineEndListSharedPtr   maLineEndList;
108 	ValueSet		aLineEndSet;
109 	sal_uInt16			nCols;
110 	sal_uInt16			nLines;
111 	sal_uIntPtr 			nLineEndWidth;
112 	Size			aBmpSize;
113 	sal_Bool			bPopupMode;
114 	bool			mbInResize;
115     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
116 
117 
118 	DECL_LINK( SelectHdl, void * );
119 	void			FillValueSet();
120 	void 			SetSize();
121     void            implInit();
122 
123 protected:
124 	virtual void	Resizing( Size& rSize );
125 	virtual void    Resize();
126 	virtual sal_Bool	Close();
127 	virtual void	PopupModeEnd();
128 
129     /** This function is called when the window gets the focus.  It grabs
130         the focus to the line ends value set so that it can be controlled with
131         the keyboard.
132     */
133 	virtual void GetFocus (void);
134 
135 public:
136     SvxLineEndWindow( sal_uInt16 nId,
137                       const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
138                       const String& rWndTitle );
139     SvxLineEndWindow( sal_uInt16 nId,
140                       const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
141                       Window* pParentWindow,
142                       const String& rWndTitle );
143 	~SvxLineEndWindow();
144 
145 	void            StartSelection();
146 
147 	virtual void	StateChanged( sal_uInt16 nSID, SfxItemState eState,
148 								  const SfxPoolItem* pState );
149 	virtual SfxPopupWindow* Clone() const;
150 };
151 
152 //========================================================================
153 // class SvxColorToolBoxControl
154 //========================================================================
155 
156 class SVX_DLLPUBLIC SvxLineEndToolBoxControl : public SfxToolBoxControl
157 {
158 public:
159 	SFX_DECL_TOOLBOX_CONTROL();
160 	SvxLineEndToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
161 	~SvxLineEndToolBoxControl();
162 
163 	virtual void				StateChanged( sal_uInt16 nSID, SfxItemState eState,
164 											  const SfxPoolItem* pState );
165 	virtual SfxPopupWindowType	GetPopupWindowType() const;
166 	virtual SfxPopupWindow*		CreatePopupWindow();
167 };
168 
169 
170 
171 #endif
172 
173