xref: /aoo41x/main/svx/source/tbxctrls/itemwin.cxx (revision 97e8a929)
1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <tools/shl.hxx>
29cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
30cdf0e10cSrcweir #include <sfx2/objsh.hxx>
31cdf0e10cSrcweir #include <sfx2/viewsh.hxx>
32cdf0e10cSrcweir #include <sfx2/module.hxx>
33cdf0e10cSrcweir #include <tools/urlobj.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #define _SVX_ITEMWIN_CXX
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <vcl/svapp.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <svx/dialogs.hrc>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #define DELAY_TIMEOUT			100
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include <svx/xlnclit.hxx>
44cdf0e10cSrcweir #include <svx/xlnwtit.hxx>
45cdf0e10cSrcweir #include <svx/xlineit0.hxx>
46cdf0e10cSrcweir #include <svx/xlndsit.hxx>
47cdf0e10cSrcweir #include <svx/xtable.hxx>
48cdf0e10cSrcweir #include "svx/drawitem.hxx"
49cdf0e10cSrcweir #include <svx/dialmgr.hxx>
50cdf0e10cSrcweir #include "svx/dlgutil.hxx"
51cdf0e10cSrcweir #include <svx/itemwin.hxx>
52cdf0e10cSrcweir #include "svx/linectrl.hxx"
53cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
54cdf0e10cSrcweir 
55cdf0e10cSrcweir using namespace ::com::sun::star::uno;
56cdf0e10cSrcweir using namespace ::com::sun::star::frame;
57cdf0e10cSrcweir using namespace ::com::sun::star::util;
58cdf0e10cSrcweir using namespace ::com::sun::star::lang;
59cdf0e10cSrcweir using namespace ::com::sun::star::beans;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir #define LOGICAL_EDIT_HEIGHT         12
62cdf0e10cSrcweir //========================================================================
63cdf0e10cSrcweir // SvxLineBox
64cdf0e10cSrcweir //========================================================================
65cdf0e10cSrcweir 
SvxLineBox(Window * pParent,const Reference<XFrame> & rFrame,WinBits nBits)66cdf0e10cSrcweir SvxLineBox::SvxLineBox( Window* pParent, const Reference< XFrame >& rFrame, WinBits nBits ) :
67cdf0e10cSrcweir 	LineLB( pParent, nBits ),
68cdf0e10cSrcweir 	meBmpMode	( GetSettings().GetStyleSettings().GetHighContrastMode() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL ),
69cdf0e10cSrcweir 	nCurPos		( 0 ),
70cdf0e10cSrcweir     aLogicalSize(40,140),
71cdf0e10cSrcweir     bRelease    ( sal_True ),
72cdf0e10cSrcweir 	mpSh		( NULL ),
73cdf0e10cSrcweir     mxFrame     ( rFrame )
74cdf0e10cSrcweir {
75cdf0e10cSrcweir     SetSizePixel( LogicToPixel( aLogicalSize, MAP_APPFONT ));
76cdf0e10cSrcweir     Show();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	aDelayTimer.SetTimeout( DELAY_TIMEOUT );
79cdf0e10cSrcweir 	aDelayTimer.SetTimeoutHdl( LINK( this, SvxLineBox, DelayHdl_Impl ) );
80cdf0e10cSrcweir 	aDelayTimer.Start();
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir // -----------------------------------------------------------------------
84cdf0e10cSrcweir 
~SvxLineBox()85cdf0e10cSrcweir SvxLineBox::~SvxLineBox()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
89cdf0e10cSrcweir // -----------------------------------------------------------------------
90cdf0e10cSrcweir 
IMPL_LINK(SvxLineBox,DelayHdl_Impl,Timer *,EMPTYARG)91cdf0e10cSrcweir IMPL_LINK( SvxLineBox, DelayHdl_Impl, Timer *, EMPTYARG )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	if ( GetEntryCount() == 0 )
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		mpSh = SfxObjectShell::Current();
96cdf0e10cSrcweir 		FillControl();
97cdf0e10cSrcweir 	}
98cdf0e10cSrcweir 	return 0;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir // -----------------------------------------------------------------------
102cdf0e10cSrcweir 
Select()103cdf0e10cSrcweir void SvxLineBox::Select()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     // Call the parent's Select() member to trigger accessibility events.
106cdf0e10cSrcweir     LineLB::Select();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	if ( !IsTravelSelect() )
109cdf0e10cSrcweir 	{
110cdf0e10cSrcweir 		XLineStyle eXLS;
111cdf0e10cSrcweir 		sal_uInt16 nPos = GetSelectEntryPos();
112cdf0e10cSrcweir //		SfxDispatcher* pDisp = rBindings.GetDispatcher();
113cdf0e10cSrcweir 		//DBG_ASSERT( pDisp, "invalid Dispatcher" );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 		switch ( nPos )
116cdf0e10cSrcweir 		{
117cdf0e10cSrcweir 			case 0:
118cdf0e10cSrcweir 				eXLS = XLINE_NONE;
119cdf0e10cSrcweir 				break;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 			case 1:
122cdf0e10cSrcweir 				eXLS = XLINE_SOLID;
123cdf0e10cSrcweir 				break;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 			default:
126cdf0e10cSrcweir 			{
127cdf0e10cSrcweir 				eXLS = XLINE_DASH;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 				if ( nPos != LISTBOX_ENTRY_NOTFOUND &&
130cdf0e10cSrcweir 					 SfxObjectShell::Current()	&&
131cdf0e10cSrcweir 					 SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) )
132cdf0e10cSrcweir 				{
133cdf0e10cSrcweir 					// LineDashItem wird nur geschickt, wenn es auch einen Dash besitzt.
134cdf0e10cSrcweir 					// Notify k"ummert sich darum!
135cdf0e10cSrcweir 					SvxDashListItem aItem( *(const SvxDashListItem*)(
136cdf0e10cSrcweir 						SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) ) );
137cdf0e10cSrcweir 					XLineDashItem aLineDashItem( GetSelectEntry(),
138cdf0e10cSrcweir 						aItem.GetDashList()->GetDash( nPos - 2 )->GetDash() );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir                     Any a;
141cdf0e10cSrcweir                     Sequence< PropertyValue > aArgs( 1 );
142cdf0e10cSrcweir                     aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineDash" ));
143cdf0e10cSrcweir                     aLineDashItem.QueryValue ( a );
144cdf0e10cSrcweir                     aArgs[0].Value = a;
145cdf0e10cSrcweir                     SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
146cdf0e10cSrcweir                                                  ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineDash" )),
147cdf0e10cSrcweir                                                  aArgs );
148cdf0e10cSrcweir //                    pDisp->Execute( SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aLineDashItem, 0L );
149cdf0e10cSrcweir 				}
150cdf0e10cSrcweir 			}
151cdf0e10cSrcweir 			break;
152cdf0e10cSrcweir 		}
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 		XLineStyleItem aLineStyleItem( eXLS );
155cdf0e10cSrcweir         Any a;
156cdf0e10cSrcweir         Sequence< PropertyValue > aArgs( 1 );
157cdf0e10cSrcweir         aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XLineStyle" ));
158cdf0e10cSrcweir         aLineStyleItem.QueryValue ( a );
159cdf0e10cSrcweir         aArgs[0].Value = a;
160cdf0e10cSrcweir         SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
161cdf0e10cSrcweir                                      ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:XLineStyle" )),
162cdf0e10cSrcweir                                      aArgs );
163cdf0e10cSrcweir //		pDisp->Execute( SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aLineStyleItem, 0L );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir         nCurPos = GetSelectEntryPos();
166cdf0e10cSrcweir 		ReleaseFocus_Impl();
167cdf0e10cSrcweir 	}
168cdf0e10cSrcweir }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir // -----------------------------------------------------------------------
171cdf0e10cSrcweir 
PreNotify(NotifyEvent & rNEvt)172cdf0e10cSrcweir long SvxLineBox::PreNotify( NotifyEvent& rNEvt )
173cdf0e10cSrcweir {
174cdf0e10cSrcweir 	sal_uInt16 nType = rNEvt.GetType();
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     switch(nType)
177cdf0e10cSrcweir     {
178cdf0e10cSrcweir         case EVENT_MOUSEBUTTONDOWN:
179cdf0e10cSrcweir         case EVENT_GETFOCUS:
180cdf0e10cSrcweir             nCurPos = GetSelectEntryPos();
181cdf0e10cSrcweir         break;
182cdf0e10cSrcweir         case EVENT_LOSEFOCUS:
183cdf0e10cSrcweir             SelectEntryPos(nCurPos);
184cdf0e10cSrcweir         break;
185cdf0e10cSrcweir         case EVENT_KEYINPUT:
186cdf0e10cSrcweir         {
187cdf0e10cSrcweir             const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
188cdf0e10cSrcweir             if( pKEvt->GetKeyCode().GetCode() == KEY_TAB)
189cdf0e10cSrcweir             {
190cdf0e10cSrcweir                 bRelease = sal_False;
191cdf0e10cSrcweir                 Select();
192cdf0e10cSrcweir             }
193cdf0e10cSrcweir         }
194cdf0e10cSrcweir         break;
195cdf0e10cSrcweir     }
196cdf0e10cSrcweir 	return LineLB::PreNotify( rNEvt );
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir // -----------------------------------------------------------------------
200cdf0e10cSrcweir 
Notify(NotifyEvent & rNEvt)201cdf0e10cSrcweir long SvxLineBox::Notify( NotifyEvent& rNEvt )
202cdf0e10cSrcweir {
203cdf0e10cSrcweir 	long nHandled = LineLB::Notify( rNEvt );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	if ( rNEvt.GetType() == EVENT_KEYINPUT )
206cdf0e10cSrcweir 	{
207cdf0e10cSrcweir 		const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 		switch ( pKEvt->GetKeyCode().GetCode() )
210cdf0e10cSrcweir 		{
211cdf0e10cSrcweir 			case KEY_RETURN:
212cdf0e10cSrcweir 				Select();
213cdf0e10cSrcweir 				nHandled = 1;
214cdf0e10cSrcweir 				break;
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 			case KEY_ESCAPE:
217cdf0e10cSrcweir 				SelectEntryPos( nCurPos );
218cdf0e10cSrcweir 				ReleaseFocus_Impl();
219cdf0e10cSrcweir 				nHandled = 1;
220cdf0e10cSrcweir 				break;
221cdf0e10cSrcweir         }
222cdf0e10cSrcweir 	}
223cdf0e10cSrcweir 	return nHandled;
224cdf0e10cSrcweir }
225cdf0e10cSrcweir 
226cdf0e10cSrcweir // -----------------------------------------------------------------------
227cdf0e10cSrcweir 
ReleaseFocus_Impl()228cdf0e10cSrcweir void SvxLineBox::ReleaseFocus_Impl()
229cdf0e10cSrcweir {
230cdf0e10cSrcweir     if(!bRelease)
231cdf0e10cSrcweir     {
232cdf0e10cSrcweir         bRelease = sal_True;
233cdf0e10cSrcweir         return;
234cdf0e10cSrcweir     }
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 	if( SfxViewShell::Current() )
237cdf0e10cSrcweir 	{
238cdf0e10cSrcweir 		Window* pShellWnd = SfxViewShell::Current()->GetWindow();
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 		if ( pShellWnd )
241cdf0e10cSrcweir 			pShellWnd->GrabFocus();
242cdf0e10cSrcweir 	}
243cdf0e10cSrcweir }
244cdf0e10cSrcweir /* -----------------------------08.03.2002 15:39------------------------------
245cdf0e10cSrcweir 
246cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
DataChanged(const DataChangedEvent & rDCEvt)247cdf0e10cSrcweir void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt )
248cdf0e10cSrcweir {
249cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
250cdf0e10cSrcweir          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
251cdf0e10cSrcweir     {
252cdf0e10cSrcweir         SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
253cdf0e10cSrcweir         Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
254cdf0e10cSrcweir         SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
255cdf0e10cSrcweir    }
256cdf0e10cSrcweir 
257cdf0e10cSrcweir     LineLB::DataChanged( rDCEvt );
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
260cdf0e10cSrcweir          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
261cdf0e10cSrcweir     {
262cdf0e10cSrcweir 		BmpColorMode eMode = GetSettings().GetStyleSettings().GetHighContrastMode() ? BMP_COLOR_HIGHCONTRAST : BMP_COLOR_NORMAL;
263cdf0e10cSrcweir 		if( eMode != meBmpMode )
264cdf0e10cSrcweir 		{
265cdf0e10cSrcweir 			meBmpMode = eMode;
266cdf0e10cSrcweir 			FillControl();
267cdf0e10cSrcweir 		}
268cdf0e10cSrcweir  	}
269cdf0e10cSrcweir }
270cdf0e10cSrcweir 
FillControl()271cdf0e10cSrcweir void SvxLineBox::FillControl()
272cdf0e10cSrcweir {
273*97e8a929SArmin Le Grand 	// FillStyles();
274cdf0e10cSrcweir     if ( !mpSh )
275cdf0e10cSrcweir         mpSh = SfxObjectShell::Current();
276cdf0e10cSrcweir 
277cdf0e10cSrcweir     if( mpSh )
278cdf0e10cSrcweir 	{
279cdf0e10cSrcweir 		const SvxDashListItem* pItem = (const SvxDashListItem*)( mpSh->GetItem( SID_DASH_LIST ) );
280cdf0e10cSrcweir 		if ( pItem )
281cdf0e10cSrcweir 			Fill( pItem->GetDashList() );
282cdf0e10cSrcweir 	}
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 
285cdf0e10cSrcweir //	rBindings.Invalidate( SID_ATTR_LINE_DASH );
286cdf0e10cSrcweir }
287cdf0e10cSrcweir //========================================================================
288cdf0e10cSrcweir // SvxColorBox
289cdf0e10cSrcweir //========================================================================
290cdf0e10cSrcweir 
SvxColorBox(Window * pParent,const::rtl::OUString & rCommand,const Reference<XFrame> & rFrame,WinBits nBits)291cdf0e10cSrcweir SvxColorBox::SvxColorBox(
292cdf0e10cSrcweir     Window* pParent,
293cdf0e10cSrcweir     const ::rtl::OUString& rCommand,
294cdf0e10cSrcweir     const Reference< XFrame >& rFrame,
295cdf0e10cSrcweir     WinBits nBits ) :
296cdf0e10cSrcweir 	ColorLB( pParent, nBits ),
297cdf0e10cSrcweir 	nCurPos		( 0 ),
298cdf0e10cSrcweir     aLogicalSize(45,80),
299cdf0e10cSrcweir     bRelease    ( sal_True ),
300cdf0e10cSrcweir     maCommand   ( rCommand ),
301cdf0e10cSrcweir     mxFrame     ( rFrame )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir     SetSizePixel( LogicToPixel( aLogicalSize , MAP_APPFONT));
304cdf0e10cSrcweir     Show();
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     SfxObjectShell* pSh = SfxObjectShell::Current();
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	if ( pSh )
309cdf0e10cSrcweir 	{
310cdf0e10cSrcweir 		const SvxColorTableItem* pItem =
311cdf0e10cSrcweir 			(const SvxColorTableItem*)(	pSh->GetItem( SID_COLOR_TABLE ) );
312cdf0e10cSrcweir 		if(pItem)
313cdf0e10cSrcweir 			Fill( pItem->GetColorTable() );
314cdf0e10cSrcweir 	}
315cdf0e10cSrcweir }
316cdf0e10cSrcweir 
317cdf0e10cSrcweir // -----------------------------------------------------------------------
318cdf0e10cSrcweir 
IMPL_LINK(SvxColorBox,DelayHdl_Impl,Timer *,EMPTYARG)319cdf0e10cSrcweir IMPL_LINK( SvxColorBox, DelayHdl_Impl, Timer *, EMPTYARG )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir 	SfxObjectShell* pSh = SfxObjectShell::Current();
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	if ( pSh )
324cdf0e10cSrcweir 	{
325cdf0e10cSrcweir 		const SvxColorTableItem* pItem = (const SvxColorTableItem*)( pSh->GetItem( SID_COLOR_TABLE ) );
326cdf0e10cSrcweir 		if ( pItem )
327cdf0e10cSrcweir 			Fill( pItem->GetColorTable() );
328cdf0e10cSrcweir //		rBindings.Invalidate( nId );
329cdf0e10cSrcweir 	}
330cdf0e10cSrcweir 	return 0;
331cdf0e10cSrcweir }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir // -----------------------------------------------------------------------
334cdf0e10cSrcweir 
~SvxColorBox()335cdf0e10cSrcweir SvxColorBox::~SvxColorBox()
336cdf0e10cSrcweir {
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
339cdf0e10cSrcweir // -----------------------------------------------------------------------
340cdf0e10cSrcweir 
Update(const XLineColorItem * pItem)341cdf0e10cSrcweir void SvxColorBox::Update( const XLineColorItem* pItem )
342cdf0e10cSrcweir {
343cdf0e10cSrcweir 	if ( pItem )
344cdf0e10cSrcweir 		SelectEntry( pItem->GetColorValue() );
345cdf0e10cSrcweir 	else
346cdf0e10cSrcweir 		SetNoSelection();
347cdf0e10cSrcweir }
348cdf0e10cSrcweir 
349cdf0e10cSrcweir // -----------------------------------------------------------------------
350cdf0e10cSrcweir 
Select()351cdf0e10cSrcweir void SvxColorBox::Select()
352cdf0e10cSrcweir {
353cdf0e10cSrcweir 	// OJ: base class call needed here because otherwise no event is send for accessibility
354cdf0e10cSrcweir 	ColorLB::Select();
355cdf0e10cSrcweir 	if ( !IsTravelSelect() )
356cdf0e10cSrcweir 	{
357cdf0e10cSrcweir 		XLineColorItem aLineColorItem( GetSelectEntry(), GetSelectEntryColor() );
358cdf0e10cSrcweir 
359cdf0e10cSrcweir         INetURLObject aObj( maCommand );
360cdf0e10cSrcweir 
361cdf0e10cSrcweir         Any a;
362cdf0e10cSrcweir         Sequence< PropertyValue > aArgs( 1 );
363cdf0e10cSrcweir         aArgs[0].Name = aObj.GetURLPath();
364cdf0e10cSrcweir         aLineColorItem.QueryValue( a );
365cdf0e10cSrcweir         aArgs[0].Value = a;
366cdf0e10cSrcweir         SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
367cdf0e10cSrcweir                                      maCommand,
368cdf0e10cSrcweir                                      aArgs );
369cdf0e10cSrcweir //        rBindings.GetDispatcher()->Execute( nId, SFX_CALLMODE_RECORD, &aLineColorItem, 0L );
370cdf0e10cSrcweir 
371cdf0e10cSrcweir         nCurPos = GetSelectEntryPos();
372cdf0e10cSrcweir 		ReleaseFocus_Impl();
373cdf0e10cSrcweir 	}
374cdf0e10cSrcweir }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir // -----------------------------------------------------------------------
377cdf0e10cSrcweir 
PreNotify(NotifyEvent & rNEvt)378cdf0e10cSrcweir long SvxColorBox::PreNotify( NotifyEvent& rNEvt )
379cdf0e10cSrcweir {
380cdf0e10cSrcweir 	sal_uInt16 nType = rNEvt.GetType();
381cdf0e10cSrcweir 
382cdf0e10cSrcweir     switch(nType)
383cdf0e10cSrcweir     {
384cdf0e10cSrcweir         case  EVENT_MOUSEBUTTONDOWN:
385cdf0e10cSrcweir         case EVENT_GETFOCUS:
386cdf0e10cSrcweir             nCurPos = GetSelectEntryPos();
387cdf0e10cSrcweir         break;
388cdf0e10cSrcweir         case EVENT_LOSEFOCUS:
389cdf0e10cSrcweir             SelectEntryPos(nCurPos);
390cdf0e10cSrcweir         break;
391cdf0e10cSrcweir         case EVENT_KEYINPUT:
392cdf0e10cSrcweir         {
393cdf0e10cSrcweir             const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
394cdf0e10cSrcweir 
395cdf0e10cSrcweir             if( pKEvt->GetKeyCode().GetCode() == KEY_TAB)
396cdf0e10cSrcweir             {
397cdf0e10cSrcweir                 bRelease = sal_False;
398cdf0e10cSrcweir                 Select();
399cdf0e10cSrcweir             }
400cdf0e10cSrcweir         }
401cdf0e10cSrcweir     }
402cdf0e10cSrcweir 
403cdf0e10cSrcweir 	return ColorLB::PreNotify( rNEvt );
404cdf0e10cSrcweir }
405cdf0e10cSrcweir 
406cdf0e10cSrcweir // -----------------------------------------------------------------------
407cdf0e10cSrcweir 
Notify(NotifyEvent & rNEvt)408cdf0e10cSrcweir long SvxColorBox::Notify( NotifyEvent& rNEvt )
409cdf0e10cSrcweir {
410cdf0e10cSrcweir 	long nHandled = ColorLB::Notify( rNEvt );
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 	if ( rNEvt.GetType() == EVENT_KEYINPUT )
413cdf0e10cSrcweir 	{
414cdf0e10cSrcweir 		const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 		switch ( pKEvt->GetKeyCode().GetCode() )
417cdf0e10cSrcweir 		{
418cdf0e10cSrcweir 			case KEY_RETURN:
419cdf0e10cSrcweir 				Select();
420cdf0e10cSrcweir 				nHandled = 1;
421cdf0e10cSrcweir 				break;
422cdf0e10cSrcweir 
423cdf0e10cSrcweir 			case KEY_ESCAPE:
424cdf0e10cSrcweir 				SelectEntryPos( nCurPos );
425cdf0e10cSrcweir 				ReleaseFocus_Impl();
426cdf0e10cSrcweir 				nHandled = 1;
427cdf0e10cSrcweir 				break;
428cdf0e10cSrcweir         }
429cdf0e10cSrcweir 	}
430cdf0e10cSrcweir 	return nHandled;
431cdf0e10cSrcweir }
432cdf0e10cSrcweir /* -----------------------------08.03.2002 15:35------------------------------
433cdf0e10cSrcweir 
434cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
DataChanged(const DataChangedEvent & rDCEvt)435cdf0e10cSrcweir void SvxColorBox::DataChanged( const DataChangedEvent& rDCEvt )
436cdf0e10cSrcweir {
437cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
438cdf0e10cSrcweir          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
439cdf0e10cSrcweir     {
440cdf0e10cSrcweir         SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
441cdf0e10cSrcweir         Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
442cdf0e10cSrcweir         SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
443cdf0e10cSrcweir     }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir     ColorLB::DataChanged( rDCEvt );
446cdf0e10cSrcweir }
447cdf0e10cSrcweir // -----------------------------------------------------------------------
448cdf0e10cSrcweir 
ReleaseFocus_Impl()449cdf0e10cSrcweir void SvxColorBox::ReleaseFocus_Impl()
450cdf0e10cSrcweir {
451cdf0e10cSrcweir     if(!bRelease)
452cdf0e10cSrcweir     {
453cdf0e10cSrcweir         bRelease = sal_True;
454cdf0e10cSrcweir         return;
455cdf0e10cSrcweir     }
456cdf0e10cSrcweir 
457cdf0e10cSrcweir 	if( SfxViewShell::Current() )
458cdf0e10cSrcweir 	{
459cdf0e10cSrcweir 		Window* pShellWnd = SfxViewShell::Current()->GetWindow();
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 		if ( pShellWnd )
462cdf0e10cSrcweir 			pShellWnd->GrabFocus();
463cdf0e10cSrcweir 	}
464cdf0e10cSrcweir }
465cdf0e10cSrcweir 
466cdf0e10cSrcweir //========================================================================
467cdf0e10cSrcweir // SvxMetricField
468cdf0e10cSrcweir //========================================================================
469cdf0e10cSrcweir 
SvxMetricField(Window * pParent,const Reference<XFrame> & rFrame,WinBits nBits)470cdf0e10cSrcweir SvxMetricField::SvxMetricField(
471cdf0e10cSrcweir     Window* pParent, const Reference< XFrame >& rFrame, WinBits nBits ) :
472cdf0e10cSrcweir 	MetricField( pParent, nBits ),
473cdf0e10cSrcweir 	aCurTxt( String() ),
474cdf0e10cSrcweir     mxFrame( rFrame )
475cdf0e10cSrcweir {
476cdf0e10cSrcweir 	Size aSize = Size(GetTextWidth( String::CreateFromAscii("99,99mm") ),GetTextHeight());
477cdf0e10cSrcweir 	aSize.Width() += 20;
478cdf0e10cSrcweir 	aSize.Height() += 6;
479cdf0e10cSrcweir 	SetSizePixel( aSize );
480cdf0e10cSrcweir     aLogicalSize = PixelToLogic(aSize, MAP_APPFONT);
481cdf0e10cSrcweir 	SetUnit( FUNIT_MM );
482cdf0e10cSrcweir 	SetDecimalDigits( 2 );
483cdf0e10cSrcweir 	SetMax( 5000 );
484cdf0e10cSrcweir 	SetMin( 0 );
485cdf0e10cSrcweir 	SetLast( 5000 );
486cdf0e10cSrcweir 	SetFirst( 0 );
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 	eDlgUnit = SfxModule::GetModuleFieldUnit( mxFrame );
489cdf0e10cSrcweir 	SetFieldUnit( *this, eDlgUnit, sal_False );
490cdf0e10cSrcweir 	Show();
491cdf0e10cSrcweir }
492cdf0e10cSrcweir 
493cdf0e10cSrcweir // -----------------------------------------------------------------------
494cdf0e10cSrcweir 
~SvxMetricField()495cdf0e10cSrcweir SvxMetricField::~SvxMetricField()
496cdf0e10cSrcweir {
497cdf0e10cSrcweir }
498cdf0e10cSrcweir 
499cdf0e10cSrcweir // -----------------------------------------------------------------------
500cdf0e10cSrcweir 
Update(const XLineWidthItem * pItem)501cdf0e10cSrcweir void SvxMetricField::Update( const XLineWidthItem* pItem )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir 	if ( pItem )
504cdf0e10cSrcweir 	{
505cdf0e10cSrcweir 		if ( pItem->GetValue() != GetCoreValue( *this, ePoolUnit ) )
506cdf0e10cSrcweir 			SetMetricValue( *this, pItem->GetValue(), ePoolUnit );
507cdf0e10cSrcweir 	}
508cdf0e10cSrcweir 	else
509cdf0e10cSrcweir 		SetText( String() );
510cdf0e10cSrcweir }
511cdf0e10cSrcweir 
512cdf0e10cSrcweir // -----------------------------------------------------------------------
513cdf0e10cSrcweir 
Modify()514cdf0e10cSrcweir void SvxMetricField::Modify()
515cdf0e10cSrcweir {
516cdf0e10cSrcweir 	MetricField::Modify();
517cdf0e10cSrcweir 	long nTmp = GetCoreValue( *this, ePoolUnit );
518cdf0e10cSrcweir 	XLineWidthItem aLineWidthItem( nTmp );
519cdf0e10cSrcweir 
520cdf0e10cSrcweir     Any a;
521cdf0e10cSrcweir     Sequence< PropertyValue > aArgs( 1 );
522cdf0e10cSrcweir     aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LineWidth" ));
523cdf0e10cSrcweir     aLineWidthItem.QueryValue( a );
524cdf0e10cSrcweir     aArgs[0].Value = a;
525cdf0e10cSrcweir     SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
526cdf0e10cSrcweir                                  ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LineWidth" )),
527cdf0e10cSrcweir                                  aArgs );
528cdf0e10cSrcweir //	rBindings.GetDispatcher()->Execute( SID_ATTR_LINE_WIDTH, SFX_CALLMODE_RECORD, &aLineWidthItem, 0L );
529cdf0e10cSrcweir }
530cdf0e10cSrcweir 
531cdf0e10cSrcweir // -----------------------------------------------------------------------
532cdf0e10cSrcweir 
ReleaseFocus_Impl()533cdf0e10cSrcweir void SvxMetricField::ReleaseFocus_Impl()
534cdf0e10cSrcweir {
535cdf0e10cSrcweir 	if( SfxViewShell::Current() )
536cdf0e10cSrcweir 	{
537cdf0e10cSrcweir 		Window* pShellWnd = SfxViewShell::Current()->GetWindow();
538cdf0e10cSrcweir 		if ( pShellWnd )
539cdf0e10cSrcweir 			pShellWnd->GrabFocus();
540cdf0e10cSrcweir 	}
541cdf0e10cSrcweir }
542cdf0e10cSrcweir 
543cdf0e10cSrcweir // -----------------------------------------------------------------------
544cdf0e10cSrcweir 
Down()545cdf0e10cSrcweir void SvxMetricField::Down()
546cdf0e10cSrcweir {
547cdf0e10cSrcweir 	sal_Int64 nValue = GetValue();
548cdf0e10cSrcweir 	nValue -= GetSpinSize();
549cdf0e10cSrcweir 
550cdf0e10cSrcweir 	// Um unter OS/2 einen Sprung auf Max zu verhindern
551cdf0e10cSrcweir 	if ( nValue >= GetMin() )
552cdf0e10cSrcweir 		MetricField::Down();
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
555cdf0e10cSrcweir // -----------------------------------------------------------------------
556cdf0e10cSrcweir 
Up()557cdf0e10cSrcweir void SvxMetricField::Up()
558cdf0e10cSrcweir {
559cdf0e10cSrcweir 	MetricField::Up();
560cdf0e10cSrcweir }
561cdf0e10cSrcweir 
562cdf0e10cSrcweir // -----------------------------------------------------------------------
563cdf0e10cSrcweir 
SetCoreUnit(SfxMapUnit eUnit)564cdf0e10cSrcweir void SvxMetricField::SetCoreUnit( SfxMapUnit eUnit )
565cdf0e10cSrcweir {
566cdf0e10cSrcweir 	ePoolUnit = eUnit;
567cdf0e10cSrcweir }
568cdf0e10cSrcweir 
569cdf0e10cSrcweir // -----------------------------------------------------------------------
570cdf0e10cSrcweir 
RefreshDlgUnit()571cdf0e10cSrcweir void SvxMetricField::RefreshDlgUnit()
572cdf0e10cSrcweir {
573cdf0e10cSrcweir 	FieldUnit eTmpUnit = SfxModule::GetModuleFieldUnit( mxFrame );
574cdf0e10cSrcweir 	if ( eDlgUnit != eTmpUnit )
575cdf0e10cSrcweir 	{
576cdf0e10cSrcweir 		eDlgUnit = eTmpUnit;
577cdf0e10cSrcweir 		SetFieldUnit( *this, eDlgUnit, sal_False );
578cdf0e10cSrcweir 	}
579cdf0e10cSrcweir }
580cdf0e10cSrcweir 
581cdf0e10cSrcweir // -----------------------------------------------------------------------
582cdf0e10cSrcweir 
PreNotify(NotifyEvent & rNEvt)583cdf0e10cSrcweir long SvxMetricField::PreNotify( NotifyEvent& rNEvt )
584cdf0e10cSrcweir {
585cdf0e10cSrcweir 	sal_uInt16 nType = rNEvt.GetType();
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 	if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
588cdf0e10cSrcweir 		aCurTxt = GetText();
589cdf0e10cSrcweir 
590cdf0e10cSrcweir 	return MetricField::PreNotify( rNEvt );
591cdf0e10cSrcweir }
592cdf0e10cSrcweir 
593cdf0e10cSrcweir // -----------------------------------------------------------------------
594cdf0e10cSrcweir 
Notify(NotifyEvent & rNEvt)595cdf0e10cSrcweir long SvxMetricField::Notify( NotifyEvent& rNEvt )
596cdf0e10cSrcweir {
597cdf0e10cSrcweir 	long nHandled = MetricField::Notify( rNEvt );
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 	if ( rNEvt.GetType() == EVENT_KEYINPUT )
600cdf0e10cSrcweir 	{
601cdf0e10cSrcweir 		const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
602cdf0e10cSrcweir 		const KeyCode& rKey = pKEvt->GetKeyCode();
603cdf0e10cSrcweir 		SfxViewShell* pSh = SfxViewShell::Current();
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 		if ( rKey.GetModifier() && rKey.GetGroup() != KEYGROUP_CURSOR && pSh )
606cdf0e10cSrcweir 			pSh->KeyInput( *pKEvt );
607cdf0e10cSrcweir 		else
608cdf0e10cSrcweir 		{
609cdf0e10cSrcweir 			bool bHandled = sal_False;
610cdf0e10cSrcweir 
611cdf0e10cSrcweir 			switch ( rKey.GetCode() )
612cdf0e10cSrcweir 			{
613cdf0e10cSrcweir 				case KEY_RETURN:
614cdf0e10cSrcweir 					Reformat();
615cdf0e10cSrcweir 					bHandled = sal_True;
616cdf0e10cSrcweir 					break;
617cdf0e10cSrcweir 
618cdf0e10cSrcweir 				case KEY_ESCAPE:
619cdf0e10cSrcweir 					SetText( aCurTxt );
620cdf0e10cSrcweir 					bHandled = sal_True;
621cdf0e10cSrcweir 					break;
622cdf0e10cSrcweir 			}
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 			if ( bHandled )
625cdf0e10cSrcweir 			{
626cdf0e10cSrcweir 				nHandled = 1;
627cdf0e10cSrcweir 				Modify();
628cdf0e10cSrcweir 				ReleaseFocus_Impl();
629cdf0e10cSrcweir 			}
630cdf0e10cSrcweir 		}
631cdf0e10cSrcweir 	}
632cdf0e10cSrcweir 	return nHandled;
633cdf0e10cSrcweir }
634cdf0e10cSrcweir /* -----------------------------08.03.2002 15:32------------------------------
635cdf0e10cSrcweir 
636cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
DataChanged(const DataChangedEvent & rDCEvt)637cdf0e10cSrcweir void SvxMetricField::DataChanged( const DataChangedEvent& rDCEvt )
638cdf0e10cSrcweir {
639cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
640cdf0e10cSrcweir          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
641cdf0e10cSrcweir     {
642cdf0e10cSrcweir         SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
643cdf0e10cSrcweir     }
644cdf0e10cSrcweir 
645cdf0e10cSrcweir     MetricField::DataChanged( rDCEvt );
646cdf0e10cSrcweir }
647cdf0e10cSrcweir 
648cdf0e10cSrcweir //========================================================================
649cdf0e10cSrcweir // SvxFillTypeBox
650cdf0e10cSrcweir //========================================================================
651cdf0e10cSrcweir 
SvxFillTypeBox(Window * pParent,WinBits nBits)652cdf0e10cSrcweir SvxFillTypeBox::SvxFillTypeBox( Window* pParent, WinBits nBits ) :
653cdf0e10cSrcweir 	FillTypeLB( pParent, nBits | WB_TABSTOP ),
654cdf0e10cSrcweir 	nCurPos	( 0 ),
655cdf0e10cSrcweir     bSelect ( sal_False ),
656cdf0e10cSrcweir     bRelease(sal_True)
657cdf0e10cSrcweir {
658cdf0e10cSrcweir     SetSizePixel( LogicToPixel( Size(40, 40 ),MAP_APPFONT ));
659cdf0e10cSrcweir     Fill();
660cdf0e10cSrcweir 	SelectEntryPos( XFILL_SOLID );
661cdf0e10cSrcweir 	Show();
662cdf0e10cSrcweir }
663cdf0e10cSrcweir 
664cdf0e10cSrcweir // -----------------------------------------------------------------------
665cdf0e10cSrcweir 
~SvxFillTypeBox()666cdf0e10cSrcweir SvxFillTypeBox::~SvxFillTypeBox()
667cdf0e10cSrcweir {
668cdf0e10cSrcweir }
669cdf0e10cSrcweir 
670cdf0e10cSrcweir // -----------------------------------------------------------------------
671cdf0e10cSrcweir 
PreNotify(NotifyEvent & rNEvt)672cdf0e10cSrcweir long SvxFillTypeBox::PreNotify( NotifyEvent& rNEvt )
673cdf0e10cSrcweir {
674cdf0e10cSrcweir 	sal_uInt16 nType = rNEvt.GetType();
675cdf0e10cSrcweir 
676cdf0e10cSrcweir 	if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
677cdf0e10cSrcweir 		nCurPos = GetSelectEntryPos();
678cdf0e10cSrcweir 	else if ( EVENT_LOSEFOCUS == nType
679cdf0e10cSrcweir 		&& Application::GetFocusWindow()
680cdf0e10cSrcweir 		&& !IsWindowOrChild( Application::GetFocusWindow(), sal_True ) )
681cdf0e10cSrcweir 	{
682cdf0e10cSrcweir 		if ( !bSelect )
683cdf0e10cSrcweir 			SelectEntryPos( nCurPos );
684cdf0e10cSrcweir 		else
685cdf0e10cSrcweir 			bSelect = sal_False;
686cdf0e10cSrcweir 	}
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 	return FillTypeLB::PreNotify( rNEvt );
689cdf0e10cSrcweir }
690cdf0e10cSrcweir 
691cdf0e10cSrcweir // -----------------------------------------------------------------------
692cdf0e10cSrcweir 
Notify(NotifyEvent & rNEvt)693cdf0e10cSrcweir long SvxFillTypeBox::Notify( NotifyEvent& rNEvt )
694cdf0e10cSrcweir {
695cdf0e10cSrcweir 	long nHandled = FillTypeLB::Notify( rNEvt );
696cdf0e10cSrcweir 
697cdf0e10cSrcweir 	if ( rNEvt.GetType() == EVENT_KEYINPUT )
698cdf0e10cSrcweir 	{
699cdf0e10cSrcweir 		const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
700cdf0e10cSrcweir 		switch ( pKEvt->GetKeyCode().GetCode() )
701cdf0e10cSrcweir 		{
702cdf0e10cSrcweir             case KEY_RETURN:
703cdf0e10cSrcweir                 nHandled = 1;
704cdf0e10cSrcweir                 ( (Link&)GetSelectHdl() ).Call( this );
705cdf0e10cSrcweir             break;
706cdf0e10cSrcweir             case KEY_TAB:
707cdf0e10cSrcweir                 bRelease = sal_False;
708cdf0e10cSrcweir                 ( (Link&)GetSelectHdl() ).Call( this );
709cdf0e10cSrcweir                 bRelease = sal_True;
710cdf0e10cSrcweir                 break;
711cdf0e10cSrcweir 
712cdf0e10cSrcweir 			case KEY_ESCAPE:
713cdf0e10cSrcweir 				SelectEntryPos( nCurPos );
714cdf0e10cSrcweir 				ReleaseFocus_Impl();
715cdf0e10cSrcweir 				nHandled = 1;
716cdf0e10cSrcweir 				break;
717cdf0e10cSrcweir 		}
718cdf0e10cSrcweir 	}
719cdf0e10cSrcweir 	return nHandled;
720cdf0e10cSrcweir }
721cdf0e10cSrcweir 
722cdf0e10cSrcweir // -----------------------------------------------------------------------
723cdf0e10cSrcweir 
ReleaseFocus_Impl()724cdf0e10cSrcweir void SvxFillTypeBox::ReleaseFocus_Impl()
725cdf0e10cSrcweir {
726cdf0e10cSrcweir 	if( SfxViewShell::Current() )
727cdf0e10cSrcweir 	{
728cdf0e10cSrcweir 		Window* pShellWnd = SfxViewShell::Current()->GetWindow();
729cdf0e10cSrcweir 
730cdf0e10cSrcweir 		if ( pShellWnd )
731cdf0e10cSrcweir 			pShellWnd->GrabFocus();
732cdf0e10cSrcweir 	}
733cdf0e10cSrcweir }
734cdf0e10cSrcweir 
735cdf0e10cSrcweir //========================================================================
736cdf0e10cSrcweir // SvxFillAttrBox
737cdf0e10cSrcweir //========================================================================
738cdf0e10cSrcweir 
SvxFillAttrBox(Window * pParent,WinBits nBits)739cdf0e10cSrcweir SvxFillAttrBox::SvxFillAttrBox( Window* pParent, WinBits nBits ) :
740cdf0e10cSrcweir 
741cdf0e10cSrcweir 	FillAttrLB( pParent, nBits | WB_TABSTOP ),
742cdf0e10cSrcweir 
743cdf0e10cSrcweir     nCurPos( 0 ),
744cdf0e10cSrcweir     bRelease( sal_True )
745cdf0e10cSrcweir 
746cdf0e10cSrcweir {
747cdf0e10cSrcweir 	SetPosPixel( Point( 90, 0 ) );
748cdf0e10cSrcweir     SetSizePixel( LogicToPixel( Size(50, 80 ), MAP_APPFONT ));
749cdf0e10cSrcweir 	Show();
750cdf0e10cSrcweir }
751cdf0e10cSrcweir 
752cdf0e10cSrcweir // -----------------------------------------------------------------------
753cdf0e10cSrcweir 
~SvxFillAttrBox()754cdf0e10cSrcweir SvxFillAttrBox::~SvxFillAttrBox()
755cdf0e10cSrcweir {
756cdf0e10cSrcweir }
757cdf0e10cSrcweir 
758cdf0e10cSrcweir // -----------------------------------------------------------------------
759cdf0e10cSrcweir 
PreNotify(NotifyEvent & rNEvt)760cdf0e10cSrcweir long SvxFillAttrBox::PreNotify( NotifyEvent& rNEvt )
761cdf0e10cSrcweir {
762cdf0e10cSrcweir 	sal_uInt16 nType = rNEvt.GetType();
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 	if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
765cdf0e10cSrcweir 		nCurPos = GetSelectEntryPos();
766cdf0e10cSrcweir 
767cdf0e10cSrcweir 	return FillAttrLB::PreNotify( rNEvt );
768cdf0e10cSrcweir }
769cdf0e10cSrcweir 
770cdf0e10cSrcweir // -----------------------------------------------------------------------
771cdf0e10cSrcweir 
Notify(NotifyEvent & rNEvt)772cdf0e10cSrcweir long SvxFillAttrBox::Notify( NotifyEvent& rNEvt )
773cdf0e10cSrcweir {
774cdf0e10cSrcweir 	long nHandled = FillAttrLB::Notify( rNEvt );
775cdf0e10cSrcweir 
776cdf0e10cSrcweir 	if ( rNEvt.GetType() == EVENT_KEYINPUT )
777cdf0e10cSrcweir 	{
778cdf0e10cSrcweir 		const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
779cdf0e10cSrcweir 
780cdf0e10cSrcweir 		switch ( pKEvt->GetKeyCode().GetCode() )
781cdf0e10cSrcweir 		{
782cdf0e10cSrcweir 			case KEY_RETURN:
783cdf0e10cSrcweir 				( (Link&)GetSelectHdl() ).Call( this );
784cdf0e10cSrcweir 				nHandled = 1;
785cdf0e10cSrcweir             break;
786cdf0e10cSrcweir             case KEY_TAB:
787cdf0e10cSrcweir                 bRelease = sal_False;
788cdf0e10cSrcweir                 GetSelectHdl().Call( this );
789cdf0e10cSrcweir                 bRelease = sal_True;
790cdf0e10cSrcweir             break;
791cdf0e10cSrcweir 			case KEY_ESCAPE:
792cdf0e10cSrcweir 				SelectEntryPos( nCurPos );
793cdf0e10cSrcweir 				ReleaseFocus_Impl();
794cdf0e10cSrcweir 				nHandled = 1;
795cdf0e10cSrcweir 				break;
796cdf0e10cSrcweir 		}
797cdf0e10cSrcweir 	}
798cdf0e10cSrcweir 	return nHandled;
799cdf0e10cSrcweir }
800cdf0e10cSrcweir 
801cdf0e10cSrcweir // -----------------------------------------------------------------------
802cdf0e10cSrcweir 
Select()803cdf0e10cSrcweir void SvxFillAttrBox::Select()
804cdf0e10cSrcweir {
805cdf0e10cSrcweir 	FillAttrLB::Select();
806cdf0e10cSrcweir }
807cdf0e10cSrcweir 
808cdf0e10cSrcweir // -----------------------------------------------------------------------
809cdf0e10cSrcweir 
ReleaseFocus_Impl()810cdf0e10cSrcweir void SvxFillAttrBox::ReleaseFocus_Impl()
811cdf0e10cSrcweir {
812cdf0e10cSrcweir 	if( SfxViewShell::Current() )
813cdf0e10cSrcweir 	{
814cdf0e10cSrcweir 		Window* pShellWnd = SfxViewShell::Current()->GetWindow();
815cdf0e10cSrcweir 
816cdf0e10cSrcweir 		if ( pShellWnd )
817cdf0e10cSrcweir 			pShellWnd->GrabFocus();
818cdf0e10cSrcweir 	}
819cdf0e10cSrcweir }
820