merge the formfield patch from ooo-build
[ooovba.git] / framework / source / uielement / simpletextstatusbarcontroller.cxx
blob20fdf961f0a5980bb1022bdde70ba7bbbb28c274
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: simpletextstatusbarcontroller.cxx,v $
10 * $Revision: 1.5.82.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_framework.hxx"
33 #include <uielement/simpletextstatusbarcontroller.hxx>
34 #include <classes/fwkresid.hxx>
35 #include <services.h>
36 #include <classes/resource.hrc>
37 #include <vos/mutex.hxx>
38 #include <vcl/svapp.hxx>
39 #include <vcl/window.hxx>
40 #include <vcl/status.hxx>
41 #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
42 #include <toolkit/unohlp.hxx>
43 #endif
44 #include <toolkit/helper/convert.hxx>
46 using namespace ::rtl;
47 using namespace ::cppu;
48 using namespace ::com::sun::star;
49 using namespace ::com::sun::star::awt;
50 using namespace ::com::sun::star::uno;
51 using namespace ::com::sun::star::lang;
52 using namespace ::com::sun::star::frame;
54 namespace framework
57 DEFINE_XSERVICEINFO_MULTISERVICE ( SimpleTextStatusbarController ,
58 OWeakObject ,
59 SERVICENAME_STATUSBARCONTROLLER ,
60 IMPLEMENTATIONNAME_SIMPLETEXTSTATUSBARCONTROLLER
63 DEFINE_INIT_SERVICE ( SimpleTextStatusbarController, {} )
65 SimpleTextStatusbarController::SimpleTextStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
66 svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 )
70 SimpleTextStatusbarController::~SimpleTextStatusbarController()
74 // XInterface
75 Any SAL_CALL SimpleTextStatusbarController::queryInterface( const Type& rType )
76 throw ( RuntimeException )
78 return svt::StatusbarController::queryInterface( rType );
81 void SAL_CALL SimpleTextStatusbarController::acquire() throw ()
83 svt::StatusbarController::acquire();
86 void SAL_CALL SimpleTextStatusbarController::release() throw ()
88 svt::StatusbarController::release();
91 void SAL_CALL SimpleTextStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
92 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
94 const rtl::OUString aPropValueName( RTL_CONSTASCII_USTRINGPARAM( "Value" ));
96 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
98 svt::StatusbarController::initialize( aArguments );
100 rtl::OUString aValue;
101 beans::PropertyValue aPropValue;
103 // Check arguments for optional "Value" property. We need it
104 // to set our internal simple text.
105 for ( int i = 0; i < aArguments.getLength(); i++ )
107 if (( aArguments[i] >>= aPropValue ) && ( aPropValue.Name.equals( aPropValueName )))
109 aPropValue.Value >>= aValue;
110 break;
114 m_aText = aValue;
115 if ( m_xParentWindow.is() && m_nID > 0 )
117 Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
118 if ( pWindow && ( pWindow->GetType() == WINDOW_STATUSBAR ))
120 StatusBar* pStatusBar = (StatusBar *)pWindow;
121 pStatusBar->SetItemText( m_nID, m_aText );
126 // XComponent
127 void SAL_CALL SimpleTextStatusbarController::dispose()
128 throw (::com::sun::star::uno::RuntimeException)
130 svt::StatusbarController::dispose();
133 // XEventListener
134 void SAL_CALL SimpleTextStatusbarController::disposing( const EventObject& Source )
135 throw ( RuntimeException )
137 svt::StatusbarController::disposing( Source );
140 // XStatusListener
141 void SAL_CALL SimpleTextStatusbarController::statusChanged( const FeatureStateEvent& )
142 throw ( RuntimeException )
146 // XStatusbarController
147 ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseButtonDown(
148 const ::com::sun::star::awt::MouseEvent& )
149 throw (::com::sun::star::uno::RuntimeException)
151 return sal_False;
154 ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseMove(
155 const ::com::sun::star::awt::MouseEvent& )
156 throw (::com::sun::star::uno::RuntimeException)
158 return sal_False;
161 ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseButtonUp(
162 const ::com::sun::star::awt::MouseEvent& )
163 throw (::com::sun::star::uno::RuntimeException)
165 return sal_False;
168 void SAL_CALL SimpleTextStatusbarController::command(
169 const ::com::sun::star::awt::Point& aPos,
170 ::sal_Int32 nCommand,
171 ::sal_Bool bMouseEvent,
172 const ::com::sun::star::uno::Any& aData )
173 throw (::com::sun::star::uno::RuntimeException)
175 svt::StatusbarController::command( aPos, nCommand, bMouseEvent, aData );
178 void SAL_CALL SimpleTextStatusbarController::paint(
179 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
180 const ::com::sun::star::awt::Rectangle& rOutputRectangle,
181 ::sal_Int32 nItemId,
182 ::sal_Int32 nStyle )
183 throw (::com::sun::star::uno::RuntimeException)
185 svt::StatusbarController::paint( xGraphics, rOutputRectangle, nItemId, nStyle );
188 void SAL_CALL SimpleTextStatusbarController::click()
189 throw (::com::sun::star::uno::RuntimeException)
191 svt::StatusbarController::click();
194 void SAL_CALL SimpleTextStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
196 svt::StatusbarController::doubleClick();