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