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