Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <uielement/simpletextstatusbarcontroller.hxx>
21 : #include <classes/fwkresid.hxx>
22 : #include <services.h>
23 : #include <classes/resource.hrc>
24 : #include <osl/mutex.hxx>
25 : #include <vcl/svapp.hxx>
26 : #include <vcl/window.hxx>
27 : #include <vcl/status.hxx>
28 : #include <toolkit/unohlp.hxx>
29 : #include <toolkit/helper/convert.hxx>
30 :
31 : using namespace ::rtl;
32 : using namespace ::cppu;
33 : using namespace ::com::sun::star;
34 : using namespace ::com::sun::star::awt;
35 : using namespace ::com::sun::star::uno;
36 : using namespace ::com::sun::star::lang;
37 : using namespace ::com::sun::star::frame;
38 :
39 : namespace framework
40 : {
41 :
42 0 : DEFINE_XSERVICEINFO_MULTISERVICE ( SimpleTextStatusbarController ,
43 : OWeakObject ,
44 : SERVICENAME_STATUSBARCONTROLLER ,
45 : IMPLEMENTATIONNAME_SIMPLETEXTSTATUSBARCONTROLLER
46 : )
47 :
48 0 : DEFINE_INIT_SERVICE ( SimpleTextStatusbarController, {} )
49 :
50 0 : SimpleTextStatusbarController::SimpleTextStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
51 0 : svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), rtl::OUString(), 0 )
52 : {
53 0 : }
54 :
55 0 : SimpleTextStatusbarController::~SimpleTextStatusbarController()
56 : {
57 0 : }
58 :
59 : // XInterface
60 0 : Any SAL_CALL SimpleTextStatusbarController::queryInterface( const Type& rType )
61 : throw ( RuntimeException )
62 : {
63 0 : return svt::StatusbarController::queryInterface( rType );
64 : }
65 :
66 0 : void SAL_CALL SimpleTextStatusbarController::acquire() throw ()
67 : {
68 0 : svt::StatusbarController::acquire();
69 0 : }
70 :
71 0 : void SAL_CALL SimpleTextStatusbarController::release() throw ()
72 : {
73 0 : svt::StatusbarController::release();
74 0 : }
75 :
76 0 : void SAL_CALL SimpleTextStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
77 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
78 : {
79 0 : const rtl::OUString aPropValueName( RTL_CONSTASCII_USTRINGPARAM( "Value" ));
80 :
81 0 : SolarMutexGuard aSolarMutexGuard;
82 :
83 0 : svt::StatusbarController::initialize( aArguments );
84 :
85 0 : rtl::OUString aValue;
86 0 : beans::PropertyValue aPropValue;
87 :
88 : // Check arguments for optional "Value" property. We need it
89 : // to set our internal simple text.
90 0 : for ( int i = 0; i < aArguments.getLength(); i++ )
91 : {
92 0 : if (( aArguments[i] >>= aPropValue ) && ( aPropValue.Name.equals( aPropValueName )))
93 : {
94 0 : aPropValue.Value >>= aValue;
95 0 : break;
96 : }
97 : }
98 :
99 0 : m_aText = aValue;
100 0 : if ( m_xParentWindow.is() && m_nID > 0 )
101 : {
102 0 : Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
103 0 : if ( pWindow && ( pWindow->GetType() == WINDOW_STATUSBAR ))
104 : {
105 0 : StatusBar* pStatusBar = (StatusBar *)pWindow;
106 0 : pStatusBar->SetItemText( m_nID, m_aText );
107 : }
108 0 : }
109 0 : }
110 :
111 : // XComponent
112 0 : void SAL_CALL SimpleTextStatusbarController::dispose()
113 : throw (::com::sun::star::uno::RuntimeException)
114 : {
115 0 : svt::StatusbarController::dispose();
116 0 : }
117 :
118 : // XEventListener
119 0 : void SAL_CALL SimpleTextStatusbarController::disposing( const EventObject& Source )
120 : throw ( RuntimeException )
121 : {
122 0 : svt::StatusbarController::disposing( Source );
123 0 : }
124 :
125 : // XStatusListener
126 0 : void SAL_CALL SimpleTextStatusbarController::statusChanged( const FeatureStateEvent& )
127 : throw ( RuntimeException )
128 : {
129 0 : }
130 :
131 : // XStatusbarController
132 0 : ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseButtonDown(
133 : const ::com::sun::star::awt::MouseEvent& )
134 : throw (::com::sun::star::uno::RuntimeException)
135 : {
136 0 : return sal_False;
137 : }
138 :
139 0 : ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseMove(
140 : const ::com::sun::star::awt::MouseEvent& )
141 : throw (::com::sun::star::uno::RuntimeException)
142 : {
143 0 : return sal_False;
144 : }
145 :
146 0 : ::sal_Bool SAL_CALL SimpleTextStatusbarController::mouseButtonUp(
147 : const ::com::sun::star::awt::MouseEvent& )
148 : throw (::com::sun::star::uno::RuntimeException)
149 : {
150 0 : return sal_False;
151 : }
152 :
153 0 : void SAL_CALL SimpleTextStatusbarController::command(
154 : const ::com::sun::star::awt::Point& aPos,
155 : ::sal_Int32 nCommand,
156 : ::sal_Bool bMouseEvent,
157 : const ::com::sun::star::uno::Any& aData )
158 : throw (::com::sun::star::uno::RuntimeException)
159 : {
160 0 : svt::StatusbarController::command( aPos, nCommand, bMouseEvent, aData );
161 0 : }
162 :
163 0 : void SAL_CALL SimpleTextStatusbarController::paint(
164 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
165 : const ::com::sun::star::awt::Rectangle& rOutputRectangle,
166 : ::sal_Int32 nItemId,
167 : ::sal_Int32 nStyle )
168 : throw (::com::sun::star::uno::RuntimeException)
169 : {
170 0 : svt::StatusbarController::paint( xGraphics, rOutputRectangle, nItemId, nStyle );
171 0 : }
172 :
173 0 : void SAL_CALL SimpleTextStatusbarController::click()
174 : throw (::com::sun::star::uno::RuntimeException)
175 : {
176 0 : svt::StatusbarController::click();
177 0 : }
178 :
179 0 : void SAL_CALL SimpleTextStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException)
180 : {
181 0 : svt::StatusbarController::doubleClick();
182 0 : }
183 :
184 : }
185 :
186 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|