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
10*f6e50924SAndrew Rist  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist  *
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.
19*f6e50924SAndrew Rist  *
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 "tbunocontroller.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/frame/status/FontHeight.hpp>
30cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
31cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vcl/svapp.hxx>
34cdf0e10cSrcweir #include <vcl/window.hxx>
35cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
36cdf0e10cSrcweir #include <svtools/ctrltool.hxx>
37cdf0e10cSrcweir #include <svtools/ctrlbox.hxx>
38cdf0e10cSrcweir #include <vos/mutex.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <memory>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #define LOGICAL_EDIT_HEIGHT         12
43cdf0e10cSrcweir 
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace svx
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class FontHeightToolBoxControl;
50cdf0e10cSrcweir class SvxFontSizeBox_Impl : public FontSizeBox
51cdf0e10cSrcweir {
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir                         SvxFontSizeBox_Impl( Window* pParent,
54cdf0e10cSrcweir                                              const uno::Reference< frame::XDispatchProvider >& rDispatchProvider,
55cdf0e10cSrcweir                                              const uno::Reference< frame::XFrame >& _xFrame,
56cdf0e10cSrcweir 										     FontHeightToolBoxControl& rCtrl );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     void                statusChanged_Impl( long nHeight, bool bErase = false );
59cdf0e10cSrcweir     void                UpdateFont( const ::com::sun::star::awt::FontDescriptor& rCurrentFont );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     virtual long		Notify( NotifyEvent& rNEvt );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir protected:
64cdf0e10cSrcweir 	virtual void        Select();
65cdf0e10cSrcweir     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
66cdf0e10cSrcweir 
67cdf0e10cSrcweir private:
68cdf0e10cSrcweir 	FontHeightToolBoxControl*	               m_pCtrl;
69cdf0e10cSrcweir 	String							           m_aCurText;
70cdf0e10cSrcweir     Size                                       m_aLogicalSize;
71cdf0e10cSrcweir 	sal_Bool							           m_bRelease;
72cdf0e10cSrcweir     uno::Reference< frame::XDispatchProvider > m_xDispatchProvider;
73cdf0e10cSrcweir     uno::Reference< frame::XFrame >            m_xFrame;
74cdf0e10cSrcweir     uno::Reference< awt::XWindow >             m_xOldFocusWindow;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	void				ReleaseFocus_Impl();
77cdf0e10cSrcweir };
78cdf0e10cSrcweir 
79cdf0e10cSrcweir //========================================================================
80cdf0e10cSrcweir // class SvxFontSizeBox_Impl --------------------------------------------------
81cdf0e10cSrcweir //========================================================================
82cdf0e10cSrcweir 
SvxFontSizeBox_Impl(Window * _pParent,const uno::Reference<frame::XDispatchProvider> & _rDispatchProvider,const uno::Reference<frame::XFrame> & _xFrame,FontHeightToolBoxControl & _rCtrl)83cdf0e10cSrcweir SvxFontSizeBox_Impl::SvxFontSizeBox_Impl(
84cdf0e10cSrcweir     Window*                                           _pParent,
85cdf0e10cSrcweir     const uno::Reference< frame::XDispatchProvider >& _rDispatchProvider,
86cdf0e10cSrcweir     const uno::Reference< frame::XFrame >&            _xFrame,
87cdf0e10cSrcweir     FontHeightToolBoxControl&                         _rCtrl ) :
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	FontSizeBox( _pParent, WinBits( WB_DROPDOWN ) ),
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	m_pCtrl		        ( &_rCtrl ),
92cdf0e10cSrcweir     m_aLogicalSize      ( 30,100 ),
93cdf0e10cSrcweir 	m_bRelease	        ( sal_True ),
94cdf0e10cSrcweir     m_xDispatchProvider ( _rDispatchProvider ),
95cdf0e10cSrcweir     m_xFrame            ( _xFrame )
96cdf0e10cSrcweir {
97cdf0e10cSrcweir     SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
98cdf0e10cSrcweir 	SetValue( 0 );
99cdf0e10cSrcweir 	SetText( String() );
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir // -----------------------------------------------------------------------
103cdf0e10cSrcweir 
ReleaseFocus_Impl()104cdf0e10cSrcweir void SvxFontSizeBox_Impl::ReleaseFocus_Impl()
105cdf0e10cSrcweir {
106cdf0e10cSrcweir 	if ( !m_bRelease )
107cdf0e10cSrcweir 	{
108cdf0e10cSrcweir 		m_bRelease = sal_True;
109cdf0e10cSrcweir 		return;
110cdf0e10cSrcweir     }
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() )
113cdf0e10cSrcweir         m_xFrame->getContainerWindow()->setFocus();
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir // -----------------------------------------------------------------------
117cdf0e10cSrcweir 
Select()118cdf0e10cSrcweir void SvxFontSizeBox_Impl::Select()
119cdf0e10cSrcweir {
120cdf0e10cSrcweir 	FontSizeBox::Select();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	if ( !IsTravelSelect() )
123cdf0e10cSrcweir 	{
124cdf0e10cSrcweir 		sal_Int64 nSelVal = GetValue();
125cdf0e10cSrcweir 		float fSelVal     = float( nSelVal ) / 10;
126cdf0e10cSrcweir 
127cdf0e10cSrcweir         uno::Sequence< beans::PropertyValue > aArgs( 1 );
128cdf0e10cSrcweir         aArgs[0].Name  = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight.Height" ));
129cdf0e10cSrcweir         aArgs[0].Value = uno::makeAny( fSelVal );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
132cdf0e10cSrcweir             This instance may be deleted in the meantime (i.e. when a dialog is opened
133cdf0e10cSrcweir             while in Dispatch()), accessing members will crash in this case. */
134cdf0e10cSrcweir         ReleaseFocus_Impl();
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         m_pCtrl->dispatchCommand( aArgs );
137cdf0e10cSrcweir 	}
138cdf0e10cSrcweir }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir // -----------------------------------------------------------------------
141cdf0e10cSrcweir 
statusChanged_Impl(long nPoint,bool bErase)142cdf0e10cSrcweir void SvxFontSizeBox_Impl::statusChanged_Impl( long nPoint, bool bErase )
143cdf0e10cSrcweir {
144cdf0e10cSrcweir 	if ( !bErase )
145cdf0e10cSrcweir 	{
146cdf0e10cSrcweir 		// Metric Umrechnen
147cdf0e10cSrcweir         long nVal = nPoint;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 		// ge"andert => neuen Wert setzen
150cdf0e10cSrcweir 		if ( GetValue() != nVal )
151cdf0e10cSrcweir 			SetValue( nVal );
152cdf0e10cSrcweir 	}
153cdf0e10cSrcweir 	else
154cdf0e10cSrcweir 	{
155cdf0e10cSrcweir 		// Wert in der Anzeige l"oschen
156cdf0e10cSrcweir 		SetValue( -1L );
157cdf0e10cSrcweir 		SetText( String() );
158cdf0e10cSrcweir 	}
159cdf0e10cSrcweir     SaveValue();
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir // -----------------------------------------------------------------------
163cdf0e10cSrcweir 
UpdateFont(const::com::sun::star::awt::FontDescriptor & rCurrentFont)164cdf0e10cSrcweir void SvxFontSizeBox_Impl::UpdateFont( const ::com::sun::star::awt::FontDescriptor& rCurrentFont )
165cdf0e10cSrcweir {
166cdf0e10cSrcweir 	// Sizes-Liste auff"ullen
167cdf0e10cSrcweir 	sal_Int64 nOldVal = GetValue(); // alten Wert merken
168cdf0e10cSrcweir     const FontList* _pFontList = NULL;
169cdf0e10cSrcweir     ::std::auto_ptr<FontList> aHold( new FontList( this ));
170cdf0e10cSrcweir     _pFontList = aHold.get();
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     if ( rCurrentFont.Name.getLength() > 0 )
173cdf0e10cSrcweir 	{
174cdf0e10cSrcweir         FontInfo _aFontInfo;
175cdf0e10cSrcweir         _aFontInfo.SetName( rCurrentFont.Name );
176cdf0e10cSrcweir         _aFontInfo.SetStyleName( rCurrentFont.StyleName );
177cdf0e10cSrcweir         _aFontInfo.SetHeight( rCurrentFont.Height );
178cdf0e10cSrcweir         Fill( &_aFontInfo, _pFontList );
179cdf0e10cSrcweir 	}
180cdf0e10cSrcweir 	else
181cdf0e10cSrcweir 	{
182cdf0e10cSrcweir 		Fill( NULL, _pFontList );
183cdf0e10cSrcweir 	}
184cdf0e10cSrcweir 	SetValue( nOldVal ); // alten Wert wiederherstellen
185cdf0e10cSrcweir 	m_aCurText = GetText(); // zum R"ucksetzen bei ESC merken
186cdf0e10cSrcweir }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir // -----------------------------------------------------------------------
189cdf0e10cSrcweir 
Notify(NotifyEvent & rNEvt)190cdf0e10cSrcweir long SvxFontSizeBox_Impl::Notify( NotifyEvent& rNEvt )
191cdf0e10cSrcweir {
192cdf0e10cSrcweir 	long nHandled = 0;
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 	if ( rNEvt.GetType() == EVENT_KEYINPUT )
195cdf0e10cSrcweir 	{
196cdf0e10cSrcweir 		sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 		switch ( nCode )
199cdf0e10cSrcweir 		{
200cdf0e10cSrcweir 			case KEY_RETURN:
201cdf0e10cSrcweir 			case KEY_TAB:
202cdf0e10cSrcweir 			{
203cdf0e10cSrcweir 				if ( KEY_TAB == nCode )
204cdf0e10cSrcweir 					m_bRelease = sal_False;
205cdf0e10cSrcweir 				else
206cdf0e10cSrcweir 					nHandled = 1;
207cdf0e10cSrcweir 				Select();
208cdf0e10cSrcweir 				break;
209cdf0e10cSrcweir 			}
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 			case KEY_ESCAPE:
212cdf0e10cSrcweir 				SetText( m_aCurText );
213cdf0e10cSrcweir 				ReleaseFocus_Impl();
214cdf0e10cSrcweir 				nHandled = 1;
215cdf0e10cSrcweir 				break;
216cdf0e10cSrcweir 		}
217cdf0e10cSrcweir 	}
218cdf0e10cSrcweir     else if( EVENT_LOSEFOCUS == rNEvt.GetType() )
219cdf0e10cSrcweir 	{
220cdf0e10cSrcweir 		Window* pFocusWin = Application::GetFocusWindow();
221cdf0e10cSrcweir 		if(!HasFocus() && GetSubEdit() != pFocusWin)
222cdf0e10cSrcweir 			SetText(GetSavedValue());
223cdf0e10cSrcweir 	}
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     return nHandled ? nHandled : FontSizeBox::Notify( rNEvt );
226cdf0e10cSrcweir }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir // ---------------------------------------------------------------------------
229cdf0e10cSrcweir 
DataChanged(const DataChangedEvent & rDCEvt)230cdf0e10cSrcweir void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
233cdf0e10cSrcweir          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
234cdf0e10cSrcweir     {
235cdf0e10cSrcweir         SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT ));
236cdf0e10cSrcweir         Size aDropSize( m_aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT );
237cdf0e10cSrcweir         SetDropDownSizePixel( LogicToPixel( aDropSize, MAP_APPFONT ));
238cdf0e10cSrcweir     }
239cdf0e10cSrcweir 
240cdf0e10cSrcweir     FontSizeBox::DataChanged( rDCEvt );
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir //========================================================================
244cdf0e10cSrcweir // class FontHeightToolBoxControl
245cdf0e10cSrcweir //========================================================================
246cdf0e10cSrcweir 
FontHeightToolBoxControl(const uno::Reference<lang::XMultiServiceFactory> & rServiceManager)247cdf0e10cSrcweir FontHeightToolBoxControl::FontHeightToolBoxControl(
248cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
249cdf0e10cSrcweir     svt::ToolboxController( rServiceManager,
250cdf0e10cSrcweir                             uno::Reference< frame::XFrame >(),
251cdf0e10cSrcweir                             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontHeight" )) ),
252cdf0e10cSrcweir     m_pBox( NULL )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir     addStatusListener( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharFontName" )));
255cdf0e10cSrcweir }
256cdf0e10cSrcweir 
~FontHeightToolBoxControl()257cdf0e10cSrcweir FontHeightToolBoxControl::~FontHeightToolBoxControl()
258cdf0e10cSrcweir {
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir // XInterface
queryInterface(const::com::sun::star::uno::Type & aType)262cdf0e10cSrcweir ::com::sun::star::uno::Any SAL_CALL FontHeightToolBoxControl::queryInterface( const ::com::sun::star::uno::Type& aType )
263cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
264cdf0e10cSrcweir {
265cdf0e10cSrcweir     uno::Any a = ToolboxController::queryInterface( aType );
266cdf0e10cSrcweir     if ( a.hasValue() )
267cdf0e10cSrcweir         return a;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     return ::cppu::queryInterface( aType, static_cast< lang::XServiceInfo* >( this ));
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
acquire()272cdf0e10cSrcweir void SAL_CALL FontHeightToolBoxControl::acquire() throw ()
273cdf0e10cSrcweir {
274cdf0e10cSrcweir     ToolboxController::acquire();
275cdf0e10cSrcweir }
276cdf0e10cSrcweir 
release()277cdf0e10cSrcweir void SAL_CALL FontHeightToolBoxControl::release() throw ()
278cdf0e10cSrcweir {
279cdf0e10cSrcweir     ToolboxController::release();
280cdf0e10cSrcweir }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir // XServiceInfo
supportsService(const::rtl::OUString & ServiceName)283cdf0e10cSrcweir sal_Bool SAL_CALL FontHeightToolBoxControl::supportsService( const ::rtl::OUString& ServiceName )
284cdf0e10cSrcweir throw(uno::RuntimeException)
285cdf0e10cSrcweir {
286cdf0e10cSrcweir     const uno::Sequence< ::rtl::OUString > aSNL( getSupportedServiceNames() );
287cdf0e10cSrcweir     const ::rtl::OUString * pArray = aSNL.getConstArray();
288cdf0e10cSrcweir 
289cdf0e10cSrcweir     for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
290cdf0e10cSrcweir         if( pArray[i] == ServiceName )
291cdf0e10cSrcweir             return true;
292cdf0e10cSrcweir 
293cdf0e10cSrcweir     return false;
294cdf0e10cSrcweir }
295cdf0e10cSrcweir 
getImplementationName()296cdf0e10cSrcweir ::rtl::OUString SAL_CALL FontHeightToolBoxControl::getImplementationName()
297cdf0e10cSrcweir throw( uno::RuntimeException )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir 	return getImplementationName_Static();
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
getSupportedServiceNames()302cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL FontHeightToolBoxControl::getSupportedServiceNames(  )
303cdf0e10cSrcweir throw( uno::RuntimeException )
304cdf0e10cSrcweir {
305cdf0e10cSrcweir     return getSupportedServiceNames_Static();
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
getSupportedServiceNames_Static()308cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > FontHeightToolBoxControl::getSupportedServiceNames_Static()
309cdf0e10cSrcweir throw()
310cdf0e10cSrcweir {
311cdf0e10cSrcweir     uno::Sequence< ::rtl::OUString > aSNS( 1 );
312cdf0e10cSrcweir     aSNS.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
313cdf0e10cSrcweir     return aSNS;
314cdf0e10cSrcweir }
315cdf0e10cSrcweir 
316cdf0e10cSrcweir // XComponent
dispose()317cdf0e10cSrcweir void SAL_CALL FontHeightToolBoxControl::dispose()
318cdf0e10cSrcweir throw (uno::RuntimeException)
319cdf0e10cSrcweir {
320cdf0e10cSrcweir     svt::ToolboxController::dispose();
321cdf0e10cSrcweir 
322cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
323cdf0e10cSrcweir     delete m_pBox;
324cdf0e10cSrcweir     m_pBox = 0;
325cdf0e10cSrcweir }
326cdf0e10cSrcweir 
327cdf0e10cSrcweir // XStatusListener
statusChanged(const frame::FeatureStateEvent & rEvent)328cdf0e10cSrcweir void SAL_CALL FontHeightToolBoxControl::statusChanged(
329cdf0e10cSrcweir     const frame::FeatureStateEvent& rEvent )
330cdf0e10cSrcweir throw ( uno::RuntimeException )
331cdf0e10cSrcweir {
332cdf0e10cSrcweir     if ( m_pBox )
333cdf0e10cSrcweir     {
334cdf0e10cSrcweir         vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
335cdf0e10cSrcweir         if ( rEvent.FeatureURL.Path.equalsAscii( "FontHeight" ))
336cdf0e10cSrcweir         {
337cdf0e10cSrcweir 	        if ( rEvent.IsEnabled )
338cdf0e10cSrcweir 	        {
339cdf0e10cSrcweir                 m_pBox->Enable();
340cdf0e10cSrcweir                 frame::status::FontHeight aFontHeight;
341cdf0e10cSrcweir                 if ( rEvent.State >>= aFontHeight )
342cdf0e10cSrcweir                     m_pBox->statusChanged_Impl( long( 10. * aFontHeight.Height ), false );
343cdf0e10cSrcweir                 else
344cdf0e10cSrcweir                     m_pBox->statusChanged_Impl( long( -1 ), true );
345cdf0e10cSrcweir             }
346cdf0e10cSrcweir             else
347cdf0e10cSrcweir                 m_pBox->Disable();
348cdf0e10cSrcweir         }
349cdf0e10cSrcweir         else if ( rEvent.FeatureURL.Path.equalsAscii( "CharFontName" ))
350cdf0e10cSrcweir         {
351cdf0e10cSrcweir             if ( rEvent.State >>= m_aCurrentFont )
352cdf0e10cSrcweir                 m_pBox->UpdateFont( m_aCurrentFont );
353cdf0e10cSrcweir         }
354cdf0e10cSrcweir     }
355cdf0e10cSrcweir }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir // XToolbarController
execute(sal_Int16)358cdf0e10cSrcweir void SAL_CALL FontHeightToolBoxControl::execute( sal_Int16 /*KeyModifier*/ )
359cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
360cdf0e10cSrcweir {
361cdf0e10cSrcweir }
362cdf0e10cSrcweir 
click()363cdf0e10cSrcweir void SAL_CALL FontHeightToolBoxControl::click()
364cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
365cdf0e10cSrcweir {
366cdf0e10cSrcweir }
367cdf0e10cSrcweir 
doubleClick()368cdf0e10cSrcweir void SAL_CALL FontHeightToolBoxControl::doubleClick()
369cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
370cdf0e10cSrcweir {
371cdf0e10cSrcweir }
372cdf0e10cSrcweir 
createPopupWindow()373cdf0e10cSrcweir uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createPopupWindow()
374cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir     return uno::Reference< awt::XWindow >();
377cdf0e10cSrcweir }
378cdf0e10cSrcweir 
createItemWindow(const uno::Reference<awt::XWindow> & Parent)379cdf0e10cSrcweir uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWindow(
380cdf0e10cSrcweir     const uno::Reference< awt::XWindow >& Parent )
381cdf0e10cSrcweir     throw (::com::sun::star::uno::RuntimeException)
382cdf0e10cSrcweir {
383cdf0e10cSrcweir     uno::Reference< awt::XWindow > xItemWindow;
384cdf0e10cSrcweir     uno::Reference< awt::XWindow > xParent( Parent );
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     Window* pParent = VCLUnoHelper::GetWindow( xParent );
387cdf0e10cSrcweir     if ( pParent )
388cdf0e10cSrcweir     {
389cdf0e10cSrcweir         vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
390cdf0e10cSrcweir         m_pBox = new SvxFontSizeBox_Impl(
391cdf0e10cSrcweir                         pParent,
392cdf0e10cSrcweir                         uno::Reference< frame::XDispatchProvider >( m_xFrame, uno::UNO_QUERY ),
393cdf0e10cSrcweir                         m_xFrame,
394cdf0e10cSrcweir                         *this );
395cdf0e10cSrcweir         xItemWindow = VCLUnoHelper::GetInterface( m_pBox );
396cdf0e10cSrcweir     }
397cdf0e10cSrcweir 
398cdf0e10cSrcweir     return xItemWindow;
399cdf0e10cSrcweir }
400cdf0e10cSrcweir 
dispatchCommand(const uno::Sequence<beans::PropertyValue> & rArgs)401cdf0e10cSrcweir void FontHeightToolBoxControl::dispatchCommand(
402cdf0e10cSrcweir     const uno::Sequence< beans::PropertyValue >& rArgs )
403cdf0e10cSrcweir {
404cdf0e10cSrcweir     uno::Reference< frame::XDispatchProvider > xDispatchProvider( m_xFrame, uno::UNO_QUERY );
405cdf0e10cSrcweir     if ( xDispatchProvider.is() )
406cdf0e10cSrcweir     {
407cdf0e10cSrcweir         util::URL                               aURL;
408cdf0e10cSrcweir         uno::Reference< frame::XDispatch >      xDispatch;
409cdf0e10cSrcweir         uno::Reference< util::XURLTransformer > xURLTransformer = getURLTransformer();
410cdf0e10cSrcweir 
411cdf0e10cSrcweir         aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontHeight" ));
412cdf0e10cSrcweir         xURLTransformer->parseStrict( aURL );
413cdf0e10cSrcweir         xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 );
414cdf0e10cSrcweir         if ( xDispatch.is() )
415cdf0e10cSrcweir             xDispatch->dispatch( aURL, rArgs );
416cdf0e10cSrcweir     }
417cdf0e10cSrcweir }
418cdf0e10cSrcweir 
FontHeightToolBoxControl_createInstance(const uno::Reference<lang::XMultiServiceFactory> & rSMgr)419cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL FontHeightToolBoxControl_createInstance(
420cdf0e10cSrcweir     const uno::Reference< lang::XMultiServiceFactory >& rSMgr )
421cdf0e10cSrcweir {
422cdf0e10cSrcweir 	return *new FontHeightToolBoxControl( rSMgr );
423cdf0e10cSrcweir }
424cdf0e10cSrcweir 
425cdf0e10cSrcweir }
426