Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <uielement/simpletextstatusbarcontroller.hxx>
30 : : #include <classes/fwkresid.hxx>
31 : : #include <services.h>
32 : : #include <classes/resource.hrc>
33 : : #include <osl/mutex.hxx>
34 : : #include <vcl/svapp.hxx>
35 : : #include <vcl/window.hxx>
36 : : #include <vcl/status.hxx>
37 : : #include <toolkit/unohlp.hxx>
38 : : #include <toolkit/helper/convert.hxx>
39 : :
40 : : using namespace ::rtl;
41 : : using namespace ::cppu;
42 : : using namespace ::com::sun::star;
43 : : using namespace ::com::sun::star::awt;
44 : : using namespace ::com::sun::star::uno;
45 : : using namespace ::com::sun::star::lang;
46 : : using namespace ::com::sun::star::frame;
47 : :
48 : : namespace framework
49 : : {
50 : :
51 [ # # ][ # # ]: 22 : DEFINE_XSERVICEINFO_MULTISERVICE ( SimpleTextStatusbarController ,
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
52 : : OWeakObject ,
53 : : SERVICENAME_STATUSBARCONTROLLER ,
54 : : IMPLEMENTATIONNAME_SIMPLETEXTSTATUSBARCONTROLLER
55 : : )
56 : :
57 : 0 : DEFINE_INIT_SERVICE ( SimpleTextStatusbarController, {} )
58 : :
59 : 0 : SimpleTextStatusbarController::SimpleTextStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
60 [ # # ]: 0 : svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 )
61 : : {
62 : 0 : }
63 : :
64 : 0 : SimpleTextStatusbarController::~SimpleTextStatusbarController()
65 : : {
66 [ # # ]: 0 : }
67 : :
68 : : // XInterface
69 : 0 : Any SAL_CALL SimpleTextStatusbarController::queryInterface( const Type& rType )
70 : : throw ( RuntimeException )
71 : : {
72 : 0 : return svt::StatusbarController::queryInterface( rType );
73 : : }
74 : :
75 : 0 : void SAL_CALL SimpleTextStatusbarController::acquire() throw ()
76 : : {
77 : 0 : svt::StatusbarController::acquire();
78 : 0 : }
79 : :
80 : 0 : void SAL_CALL SimpleTextStatusbarController::release() throw ()
81 : : {
82 : 0 : svt::StatusbarController::release();
83 : 0 : }
84 : :
85 : 0 : void SAL_CALL SimpleTextStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
86 : : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
87 : : {
88 [ # # ]: 0 : const rtl::OUString aPropValueName( RTL_CONSTASCII_USTRINGPARAM( "Value" ));
89 : :
90 [ # # ]: 0 : SolarMutexGuard aSolarMutexGuard;
91 : :
92 [ # # ]: 0 : svt::StatusbarController::initialize( aArguments );
93 : :
94 : 0 : rtl::OUString aValue;
95 : 0 : beans::PropertyValue aPropValue;
96 : :
97 : : // Check arguments for optional "Value" property. We need it
98 : : // to set our internal simple text.
99 [ # # ]: 0 : for ( int i = 0; i < aArguments.getLength(); i++ )
100 : : {
101 [ # # ][ # # ]: 0 : if (( aArguments[i] >>= aPropValue ) && ( aPropValue.Name.equals( aPropValueName )))
[ # # ][ # # ]
102 : : {
103 : 0 : aPropValue.Value >>= aValue;
104 : 0 : break;
105 : : }
106 : : }
107 : :
108 : 0 : m_aText = aValue;
109 [ # # ][ # # ]: 0 : if ( m_xParentWindow.is() && m_nID > 0 )
[ # # ]
110 : : {
111 [ # # ]: 0 : Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
112 [ # # ][ # # ]: 0 : if ( pWindow && ( pWindow->GetType() == WINDOW_STATUSBAR ))
[ # # ][ # # ]
113 : : {
114 : 0 : StatusBar* pStatusBar = (StatusBar *)pWindow;
115 [ # # ][ # # ]: 0 : pStatusBar->SetItemText( m_nID, m_aText );
[ # # ]
116 : : }
117 [ # # ]: 0 : }
118 : 0 : }
119 : :
120 : : // XComponent
121 : 0 : void SAL_CALL SimpleTextStatusbarController::dispose()
122 : : throw (::com::sun::star::uno::RuntimeException)
123 : : {
124 : 0 : svt::StatusbarController::dispose();
125 : 0 : }
126 : :
127 : : // XEventListener
128 : 0 : void SAL_CALL SimpleTextStatusbarController::disposing( const EventObject& Source )
129 : : throw ( RuntimeException )
130 : : {
131 : 0 : svt::StatusbarController::disposing( Source );
132 : 0 : }
133 : :
134 : : // XStatusListener
135 : 0 : void SAL_CALL SimpleTextStatusbarController::statusChanged( const FeatureStateEvent& )
136 : : throw ( RuntimeException )
137 : : {
138 : 0 : }
139 : :
140 : : // XStatusbarController
141 : 0 : ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseButtonDown(
142 : : const ::com::sun::star::awt::MouseEvent& )
143 : : throw (::com::sun::star::uno::RuntimeException)
144 : : {
145 : 0 : return sal_False;
146 : : }
147 : :
148 : 0 : ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseMove(
149 : : const ::com::sun::star::awt::MouseEvent& )
150 : : throw (::com::sun::star::uno::RuntimeException)
151 : : {
152 : 0 : return sal_False;
153 : : }
154 : :
155 : 0 : ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseButtonUp(
156 : : const ::com::sun::star::awt::MouseEvent& )
157 : : throw (::com::sun::star::uno::RuntimeException)
158 : : {
159 : 0 : return sal_False;
160 : : }
161 : :
162 : 0 : void SAL_CALL SimpleTextStatusbarController::command(
163 : : const ::com::sun::star::awt::Point& aPos,
164 : : ::sal_Int32 nCommand,
165 : : ::sal_Bool bMouseEvent,
166 : : const ::com::sun::star::uno::Any& aData )
167 : : throw (::com::sun::star::uno::RuntimeException)
168 : : {
169 : 0 : svt::StatusbarController::command( aPos, nCommand, bMouseEvent, aData );
170 : 0 : }
171 : :
172 : 0 : void SAL_CALL SimpleTextStatusbarController::paint(
173 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
174 : : const ::com::sun::star::awt::Rectangle& rOutputRectangle,
175 : : ::sal_Int32 nItemId,
176 : : ::sal_Int32 nStyle )
177 : : throw (::com::sun::star::uno::RuntimeException)
178 : : {
179 : 0 : svt::StatusbarController::paint( xGraphics, rOutputRectangle, nItemId, nStyle );
180 : 0 : }
181 : :
182 : 0 : void SAL_CALL SimpleTextStatusbarController::click()
183 : : throw (::com::sun::star::uno::RuntimeException)
184 : : {
185 : 0 : svt::StatusbarController::click();
186 : 0 : }
187 : :
188 : 0 : void SAL_CALL SimpleTextStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
189 : : {
190 : 0 : svt::StatusbarController::doubleClick();
191 : 0 : }
192 : :
193 : : }
194 : :
195 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|