statusbarcontroller.cxx (9e0e4191) | statusbarcontroller.cxx (0c02d14e) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 91 unchanged lines hidden (view full) --- 100 { 101 const sal_uInt16 nItemId = pStatusBar->GetItemId(nPos); 102 if ( pStatusBar->GetItemCommand(nItemId) == String(m_aCommandURL) ) 103 { 104 m_nId = nItemId; 105 break; 106 } 107 } | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 91 unchanged lines hidden (view full) --- 100 { 101 const sal_uInt16 nItemId = pStatusBar->GetItemId(nPos); 102 if ( pStatusBar->GetItemCommand(nItemId) == String(m_aCommandURL) ) 103 { 104 m_nId = nItemId; 105 break; 106 } 107 } |
108 109 SfxStatusBarControl *pController = 0; |
|
108 if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) | 110 if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) |
109 { 110 m_pController = TStatusbarHelper::createFromQuery(new SvxZoomSliderControl(m_nSlotId = SID_ATTR_ZOOMSLIDER,m_nId,*pStatusBar)); | 111 { 112 pController = new SvxZoomSliderControl(m_nSlotId = SID_ATTR_ZOOMSLIDER,m_nId,*pStatusBar); |
111 } // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) 112 else if ( m_aCommandURL.equalsAscii(".uno:Zoom") ) | 113 } // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) 114 else if ( m_aCommandURL.equalsAscii(".uno:Zoom") ) |
113 { 114 m_pController = TStatusbarHelper::createFromQuery(new SvxZoomStatusBarControl(m_nSlotId = SID_ATTR_ZOOM,m_nId,*pStatusBar)); | 115 { 116 pController = new SvxZoomStatusBarControl(m_nSlotId = SID_ATTR_ZOOM,m_nId,*pStatusBar); |
115 } 116 | 117 } 118 |
117 if ( m_pController.is() ) | 119 if ( pController ) |
118 { | 120 { |
119 m_pController->initialize(_rArguments); 120 m_pController->update(); | 121 m_rController.set( pController ); 122 if ( m_rController.is() ) 123 { 124 m_rController->initialize(_rArguments); 125 m_rController->update(); 126 } |
121 } 122 123 addStatusListener(m_aCommandURL); 124 update(); 125 } 126} 127// XStatusListener 128void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEvent)throw ( RuntimeException ) 129{ 130 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 131 ::osl::MutexGuard aGuard(m_aMutex); 132 | 127 } 128 129 addStatusListener(m_aCommandURL); 130 update(); 131 } 132} 133// XStatusListener 134void SAL_CALL OStatusbarController::statusChanged( const FeatureStateEvent& _aEvent)throw ( RuntimeException ) 135{ 136 ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 137 ::osl::MutexGuard aGuard(m_aMutex); 138 |
133 if ( m_pController.is() ) | 139 if ( m_rController.is() ) |
134 { 135 if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) 136 { 137 Sequence< PropertyValue > aSeq; 138 if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 2 ) 139 { 140 SvxZoomSliderItem aZoomSlider(100,20,400); 141 aZoomSlider.PutValue(_aEvent.State); | 140 { 141 if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) 142 { 143 Sequence< PropertyValue > aSeq; 144 if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 2 ) 145 { 146 SvxZoomSliderItem aZoomSlider(100,20,400); 147 aZoomSlider.PutValue(_aEvent.State); |
142 static_cast<SvxZoomSliderControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoomSlider); | 148 static_cast<SvxZoomSliderControl*>(m_rController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoomSlider); |
143 } 144 } // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) 145 else if ( m_aCommandURL.equalsAscii(".uno:Zoom") ) 146 { 147 Sequence< PropertyValue > aSeq; 148 if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 3 ) 149 { 150 SvxZoomItem aZoom; 151 aZoom.PutValue(_aEvent.State); | 149 } 150 } // if ( m_aCommandURL.equalsAscii(".uno:ZoomSlider") ) 151 else if ( m_aCommandURL.equalsAscii(".uno:Zoom") ) 152 { 153 Sequence< PropertyValue > aSeq; 154 if ( (_aEvent.State >>= aSeq) && aSeq.getLength() == 3 ) 155 { 156 SvxZoomItem aZoom; 157 aZoom.PutValue(_aEvent.State); |
152 static_cast<SvxZoomStatusBarControl*>(m_pController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoom); | 158 static_cast<SvxZoomStatusBarControl*>(m_rController.get())->StateChanged(m_nSlotId,SFX_ITEM_AVAILABLE,&aZoom); |
153 } 154 } 155 } 156} 157 158// XStatusbarController 159::sal_Bool SAL_CALL OStatusbarController::mouseButtonDown(const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) 160{ | 159 } 160 } 161 } 162} 163 164// XStatusbarController 165::sal_Bool SAL_CALL OStatusbarController::mouseButtonDown(const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) 166{ |
161 return m_pController.is() && m_pController.getRef()->mouseButtonDown(_aEvent); | 167 return m_rController.is() && m_rController->mouseButtonDown(_aEvent); |
162} 163 164::sal_Bool SAL_CALL OStatusbarController::mouseMove( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) 165{ | 168} 169 170::sal_Bool SAL_CALL OStatusbarController::mouseMove( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) 171{ |
166 return m_pController.is() && m_pController.getRef()->mouseMove(_aEvent); | 172 return m_rController.is() && m_rController->mouseMove(_aEvent); |
167} 168 169::sal_Bool SAL_CALL OStatusbarController::mouseButtonUp( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) 170{ | 173} 174 175::sal_Bool SAL_CALL OStatusbarController::mouseButtonUp( const ::com::sun::star::awt::MouseEvent& _aEvent)throw (::com::sun::star::uno::RuntimeException) 176{ |
171 return m_pController.is() && m_pController.getRef()->mouseButtonUp(_aEvent); | 177 return m_rController.is() && m_rController->mouseButtonUp(_aEvent); |
172} 173 174void SAL_CALL OStatusbarController::command( 175 const ::com::sun::star::awt::Point& aPos, 176 ::sal_Int32 nCommand, 177 ::sal_Bool bMouseEvent, 178 const ::com::sun::star::uno::Any& aData ) 179throw (::com::sun::star::uno::RuntimeException) 180{ | 178} 179 180void SAL_CALL OStatusbarController::command( 181 const ::com::sun::star::awt::Point& aPos, 182 ::sal_Int32 nCommand, 183 ::sal_Bool bMouseEvent, 184 const ::com::sun::star::uno::Any& aData ) 185throw (::com::sun::star::uno::RuntimeException) 186{ |
181 if ( m_pController.is() ) 182 m_pController.getRef()->command( aPos, nCommand, bMouseEvent, aData ); | 187 if ( m_rController.is() ) 188 m_rController->command( aPos, nCommand, bMouseEvent, aData ); |
183} 184 185void SAL_CALL OStatusbarController::paint( 186 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, 187 const ::com::sun::star::awt::Rectangle& rOutputRectangle, | 189} 190 191void SAL_CALL OStatusbarController::paint( 192 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, 193 const ::com::sun::star::awt::Rectangle& rOutputRectangle, |
188 ::sal_Int32 nItemId, | |
189 ::sal_Int32 nStyle ) 190throw (::com::sun::star::uno::RuntimeException) 191{ | 194 ::sal_Int32 nStyle ) 195throw (::com::sun::star::uno::RuntimeException) 196{ |
192 if ( m_pController.is() ) 193 m_pController.getRef()->paint( xGraphics, rOutputRectangle, nItemId, nStyle ); | 197 if ( m_rController.is() ) 198 m_rController->paint( xGraphics, rOutputRectangle, nStyle ); |
194} 195 | 199} 200 |
196void SAL_CALL OStatusbarController::click() throw (::com::sun::star::uno::RuntimeException) | 201void SAL_CALL OStatusbarController::click( 202 const ::com::sun::star::awt::Point& aPos ) 203throw (::com::sun::star::uno::RuntimeException) |
197{ | 204{ |
198 if ( m_pController.is() ) 199 m_pController.getRef()->click(); | 205 if ( m_rController.is() ) 206 m_rController->click( aPos ); |
200} 201 | 207} 208 |
202void SAL_CALL OStatusbarController::doubleClick() throw (::com::sun::star::uno::RuntimeException) | 209void SAL_CALL OStatusbarController::doubleClick( 210 const ::com::sun::star::awt::Point& aPos ) 211throw (::com::sun::star::uno::RuntimeException) |
203{ | 212{ |
204 if ( m_pController.is() ) 205 m_pController.getRef()->doubleClick(); | 213 if ( m_rController.is() ) 214 m_rController->doubleClick( aPos ); |
206} 207// ----------------------------------------------------------------------------- 208void SAL_CALL OStatusbarController::update() throw ( RuntimeException ) 209{ 210 ::svt::StatusbarController::update(); | 215} 216// ----------------------------------------------------------------------------- 217void SAL_CALL OStatusbarController::update() throw ( RuntimeException ) 218{ 219 ::svt::StatusbarController::update(); |
211 Reference< XUpdatable > xUp(m_pController.getRef(),UNO_QUERY); 212 if ( xUp.is() ) 213 xUp->update(); | 220 if ( m_rController.is() ) 221 m_rController->update(); |
214} 215// ----------------------------------------------------------------------------- 216// XComponent 217void SAL_CALL OStatusbarController::dispose() throw (::com::sun::star::uno::RuntimeException) 218{ | 222} 223// ----------------------------------------------------------------------------- 224// XComponent 225void SAL_CALL OStatusbarController::dispose() throw (::com::sun::star::uno::RuntimeException) 226{ |
219 Reference< XComponent > xComp( m_pController.getRef(), UNO_QUERY ); 220 ::comphelper::disposeComponent(xComp); 221 m_pController.dispose(); | 227 if ( m_rController.is() ) 228 ::comphelper::disposeComponent( m_rController ); 229 |
222 svt::StatusbarController::dispose(); 223} 224// ============================================================================= 225} // rptui 226// ============================================================================= | 230 svt::StatusbarController::dispose(); 231} 232// ============================================================================= 233} // rptui 234// ============================================================================= |