| langselectionmenucontroller.cxx (437a6594) | langselectionmenucontroller.cxx (aac4b212) |
|---|---|
| 1/************************************************************** | 1/************************************************************** |
| 2 * | 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 9 * with the License. You may obtain a copy of the License at | 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 9 * with the License. You may obtain a copy of the License at |
| 10 * | 10 * |
| 11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 * | 12 * |
| 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
| 19 * | 19 * |
| 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_framework.hxx" 26 27#include <uielement/langselectionmenucontroller.hxx> --- 71 unchanged lines hidden (view full) --- 99 IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER 100 ) 101 102DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {} ) 103 104LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : 105 svt::PopupMenuControllerBase( xServiceManager ), 106 m_bShowMenu( sal_True ), | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_framework.hxx" 26 27#include <uielement/langselectionmenucontroller.hxx> --- 71 unchanged lines hidden (view full) --- 99 IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER 100 ) 101 102DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {} ) 103 104LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : 105 svt::PopupMenuControllerBase( xServiceManager ), 106 m_bShowMenu( sal_True ), |
| 107 m_aLangGuessHelper( xServiceManager ) | 107 m_aLangGuessHelper( xServiceManager ) |
| 108{ 109} 110 111LanguageSelectionMenuController::~LanguageSelectionMenuController() 112{ 113} 114 115// XEventListener 116void SAL_CALL LanguageSelectionMenuController::disposing( const EventObject& ) throw ( RuntimeException ) 117{ | 108{ 109} 110 111LanguageSelectionMenuController::~LanguageSelectionMenuController() 112{ 113} 114 115// XEventListener 116void SAL_CALL LanguageSelectionMenuController::disposing( const EventObject& ) throw ( RuntimeException ) 117{ |
| 118 Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); | 118 Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); |
| 119 | 119 |
| 120 osl::MutexGuard aLock( m_aMutex ); 121 m_xFrame.clear(); 122 m_xDispatch.clear(); 123 m_xLanguageDispatch.clear(); 124 m_xServiceManager.clear(); | 120 osl::MutexGuard aLock( m_aMutex ); 121 m_xFrame.clear(); 122 m_xDispatch.clear(); 123 m_xLanguageDispatch.clear(); 124 m_xServiceManager.clear(); |
| 125 | 125 |
| 126 if ( m_xPopupMenu.is() ) 127 m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); 128 m_xPopupMenu.clear(); | 126 if ( m_xPopupMenu.is() ) 127 m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); 128 m_xPopupMenu.clear(); |
| 129} 130 131// XStatusListener 132void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) 133{ | 129} 130 131// XStatusListener 132void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) 133{ |
| 134 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); | 134 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); |
| 135 | 135 |
| 136 if (rBHelper.bDisposed || rBHelper.bInDispose) 137 return; | 136 if (rBHelper.bDisposed || rBHelper.bInDispose) 137 return; |
| 138 139 m_bShowMenu = sal_True; | 138 139 m_bShowMenu = sal_True; |
| 140 m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value | 140 m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; // set the default value |
| 141 | 141 |
| 142 OUString aStrValue; 143 Sequence< OUString > aSeq; | 142 OUString aStrValue; 143 Sequence< OUString > aSeq; |
| 144 | 144 |
| 145 if ( Event.State >>= aSeq ) 146 { 147 if ( aSeq.getLength() == 4 ) 148 { 149 // Retrieve all other values from the sequence and 150 // store it members! 151 m_aCurLang = aSeq[0]; 152 m_nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); 153 m_aKeyboardLang = aSeq[2]; 154 m_aGuessedTextLang = aSeq[3]; 155 } 156 } 157 else if ( !Event.State.hasValue() ) | 145 if ( Event.State >>= aSeq ) |
| 158 { | 146 { |
| 159 m_bShowMenu = sal_False; // no language -> no sub-menu entries -> disable menu | 147 if ( aSeq.getLength() == 4 ) 148 { 149 // Retrieve all other values from the sequence and 150 // store it members! 151 m_aCurLang = aSeq[0]; 152 m_nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); 153 m_aKeyboardLang = aSeq[2]; 154 m_aGuessedTextLang = aSeq[3]; 155 } |
| 160 } | 156 } |
| 157 else if ( !Event.State.hasValue() ) 158 { 159 m_bShowMenu = sal_False; // no language -> no sub-menu entries -> disable menu 160 } |
|
| 161} 162 163// XMenuListener 164void LanguageSelectionMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL) 165{ | 161} 162 163// XMenuListener 164void LanguageSelectionMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL) 165{ |
| 166 Reference< XDispatch > xDispatch = _xDispatch; | 166 Reference< XDispatch > xDispatch = _xDispatch; |
| 167 168 if ( aTargetURL.Complete == m_aMenuCommandURL_Font ) | 167 168 if ( aTargetURL.Complete == m_aMenuCommandURL_Font ) |
| 169 { //open format/character dialog for current selection | 169 { // open format/character dialog for current selection |
| 170 xDispatch = m_xMenuDispatch_Font; 171 } 172 else if ( aTargetURL.Complete == m_aMenuCommandURL_Lang ) | 170 xDispatch = m_xMenuDispatch_Font; 171 } 172 else if ( aTargetURL.Complete == m_aMenuCommandURL_Lang ) |
| 173 { //open language tab-page in tools/options dialog | 173 { // open language tab-page in tools/options dialog |
| 174 xDispatch = m_xMenuDispatch_Lang; 175 } 176 else if ( aTargetURL.Complete == m_aMenuCommandURL_CharDlgForParagraph ) | 174 xDispatch = m_xMenuDispatch_Lang; 175 } 176 else if ( aTargetURL.Complete == m_aMenuCommandURL_CharDlgForParagraph ) |
| 177 { //open format/character dialog for current selection | 177 { // open format/character dialog for current selection |
| 178 xDispatch = m_xMenuDispatch_CharDlgForParagraph; 179 } 180 181 if ( !xDispatch.is() ) 182 { 183 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 184 if ( xDispatchProvider.is() ) 185 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); 186 } 187 188 if ( xDispatch.is() ) | 178 xDispatch = m_xMenuDispatch_CharDlgForParagraph; 179 } 180 181 if ( !xDispatch.is() ) 182 { 183 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 184 if ( xDispatchProvider.is() ) 185 xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); 186 } 187 188 if ( xDispatch.is() ) |
| 189 { 190 Sequence<PropertyValue> aArgs; 191 if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# 192 UiEventLogHelper( OUString::createFromAscii("LanguageSelectionMenuController")).log( m_xServiceManager, m_xFrame, aTargetURL, aArgs ); 193 xDispatch->dispatch( aTargetURL, aArgs ); | 189 { 190 Sequence<PropertyValue> aArgs; 191 if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# 192 UiEventLogHelper( OUString::createFromAscii("LanguageSelectionMenuController")).log( m_xServiceManager, m_xFrame, aTargetURL, aArgs ); 193 xDispatch->dispatch( aTargetURL, aArgs ); |
| 194 } 195} 196 197// XPopupMenuController 198void LanguageSelectionMenuController::impl_setPopupMenu() 199{ | 194 } 195} 196 197// XPopupMenuController 198void LanguageSelectionMenuController::impl_setPopupMenu() 199{ |
| 200 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); | 200 Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); |
| 201 | 201 |
| 202 com::sun::star::util::URL aTargetURL; | 202 com::sun::star::util::URL aTargetURL; |
| 203 | 203 |
| 204 // Register for language updates 205 aTargetURL.Complete = m_aLangStatusCommandURL; 206 m_xURLTransformer->parseStrict( aTargetURL ); 207 m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); | 204 // Register for language updates 205 aTargetURL.Complete = m_aLangStatusCommandURL; 206 m_xURLTransformer->parseStrict( aTargetURL ); 207 m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); |
| 208 209 // Register for setting languages and opening language dialog | 208 209 // Register for setting languages and opening language dialog |
| 210 aTargetURL.Complete = m_aMenuCommandURL_Lang; 211 m_xURLTransformer->parseStrict( aTargetURL ); 212 m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); | 210 aTargetURL.Complete = m_aMenuCommandURL_Lang; 211 m_xURLTransformer->parseStrict( aTargetURL ); 212 m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); |
| 213 214 // Register for opening character dialog | 213 214 // Register for opening character dialog |
| 215 aTargetURL.Complete = m_aMenuCommandURL_Font; 216 m_xURLTransformer->parseStrict( aTargetURL ); 217 m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); | 215 aTargetURL.Complete = m_aMenuCommandURL_Font; 216 m_xURLTransformer->parseStrict( aTargetURL ); 217 m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); |
| 218 219 // Register for opening character dialog with preselected paragraph | 218 219 // Register for opening character dialog with preselected paragraph |
| 220 aTargetURL.Complete = m_aMenuCommandURL_CharDlgForParagraph; 221 m_xURLTransformer->parseStrict( aTargetURL ); 222 m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); | 220 aTargetURL.Complete = m_aMenuCommandURL_CharDlgForParagraph; 221 m_xURLTransformer->parseStrict( aTargetURL ); 222 m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); |
| 223} 224 225void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu , const Mode eMode ) 226{ | 223} 224 225void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu , const Mode eMode ) 226{ |
| 227 VCLXPopupMenu* pVCLPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); 228 PopupMenu* pPopupMenu = 0; | 227 VCLXPopupMenu* pVCLPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); 228 PopupMenu* pPopupMenu = 0; |
| 229 | 229 |
| 230 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); | 230 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); |
| 231 | 231 |
| 232 resetPopupMenu( rPopupMenu ); | 232 resetPopupMenu( rPopupMenu ); |
| 233 if (!m_bShowMenu) 234 return; 235 | 233 if (!m_bShowMenu) 234 return; 235 |
| 236 if ( pVCLPopupMenu ) 237 pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu(); | 236 if ( pVCLPopupMenu ) 237 pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu(); |
| 238 239 String aCmd; 240 String aCmd_Dialog; 241 String aCmd_Language; | 238 239 String aCmd; 240 String aCmd_Dialog; 241 String aCmd_Language; |
| 242 if( eMode == MODE_SetLanguageSelectionMenu ) | 242 if( eMode == MODE_SetLanguageSelectionMenu ) |
| 243 { | 243 { |
| 244 aCmd_Dialog.AppendAscii(".uno:FontDialog?Language:string=*"); | 244 aCmd_Dialog.AppendAscii(".uno:FontDialog?Language:string=*"); |
| 245 aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Current_"); 246 } 247 else if ( eMode == MODE_SetLanguageParagraphMenu ) 248 { 249 aCmd_Dialog.AppendAscii(".uno:FontDialogForParagraph"); 250 aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Paragraph_"); 251 } | 245 aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Current_"); 246 } 247 else if ( eMode == MODE_SetLanguageParagraphMenu ) 248 { 249 aCmd_Dialog.AppendAscii(".uno:FontDialogForParagraph"); 250 aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Paragraph_"); 251 } |
| 252 else if ( eMode == MODE_SetLanguageAllTextMenu ) 253 { 254 aCmd_Dialog.AppendAscii(".uno:LanguageStatus?Language:string=*"); 255 aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Default_"); 256 } | 252 else if ( eMode == MODE_SetLanguageAllTextMenu ) 253 { 254 aCmd_Dialog.AppendAscii(".uno:LanguageStatus?Language:string=*"); 255 aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Default_"); 256 } |
| 257 | 257 |
| 258 SvtLanguageTable aLanguageTable; | 258 SvtLanguageTable aLanguageTable; |
| 259 | 259 |
| 260 // get languages to be displayed in the menu 261 std::set< OUString > aLangItems; 262 FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper, 263 m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang ); | 260 // get languages to be displayed in the menu 261 std::set< OUString > aLangItems; 262 FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper, 263 m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang ); |
| 264 | 264 |
| 265 // 266 // now add menu entries 267 // the different menues purpose will be handled by the different string 268 // for aCmd_Dialog and aCmd_Language 269 // | 265 // now add menu entries 266 // the different menu purposes will be handled by the different string 267 // for aCmd_Dialog and aCmd_Language |
| 270 | 268 |
| 271 sal_Int16 nItemId = 1; // in this control the item id is not important for executing the command 272 const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection 273 const OUString sEmpty; // 'no language found' from language guessing 274 std::map< sal_Int16, OUString > aLangMap; 275 std::set< OUString >::const_iterator it; 276 for (it = aLangItems.begin(); it != aLangItems.end(); ++it) | 269 sal_Int16 nItemId = 1; // in this control the item id is not important for executing the command 270 const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection 271 const OUString sEmpty; // 'no language found' from language guessing 272 std::map< sal_Int16, OUString > aLangMap; 273 std::set< OUString >::const_iterator it; 274 for (it = aLangItems.begin(); it != aLangItems.end(); ++it) |
| 277 { | 275 { |
| 278 const OUString & rStr( *it ); 279 if (rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& 280 rStr != sAsterix && 281 rStr != sEmpty) | 276 const OUString & rStr( *it ); 277 if (rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& 278 rStr != sAsterix && 279 rStr != sEmpty) |
| 282 { 283 pPopupMenu->InsertItem( nItemId, rStr ); 284 aCmd = aCmd_Language; 285 aCmd += String( rStr ); 286 pPopupMenu->SetItemCommand( nItemId, aCmd ); | 280 { 281 pPopupMenu->InsertItem( nItemId, rStr ); 282 aCmd = aCmd_Language; 283 aCmd += String( rStr ); 284 pPopupMenu->SetItemCommand( nItemId, aCmd ); |
| 287 if (rStr == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu ) | 285 if (rStr == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu ) |
| 288 { 289 //make a sign for the current language 290 pPopupMenu->CheckItem( nItemId, sal_True ); 291 } | 286 { 287 //make a sign for the current language 288 pPopupMenu->CheckItem( nItemId, sal_True ); 289 } |
| 292 aLangMap[ nItemId ] = rStr; 293 ++nItemId; | 290 aLangMap[ nItemId ] = rStr; 291 ++nItemId; |
| 294 } 295 } 296 | 292 } 293 } 294 |
| 297 // entry for LANGUAGE_NONE | 295 // entry for LANGUAGE_NONE |
| 298 ++nItemId; 299 pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) ); 300 aCmd=aCmd_Language; 301 aCmd.AppendAscii("LANGUAGE_NONE"); 302 pPopupMenu->SetItemCommand( nItemId, aCmd ); 303 | 296 ++nItemId; 297 pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) ); 298 aCmd=aCmd_Language; 299 aCmd.AppendAscii("LANGUAGE_NONE"); 300 pPopupMenu->SetItemCommand( nItemId, aCmd ); 301 |
| 304 // entry for 'Reset to default language' | 302 // entry for 'Reset to default language' |
| 305 ++nItemId; 306 pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_RESET_TO_DEFAULT_LANGUAGE )) ); 307 aCmd=aCmd_Language; 308 aCmd.AppendAscii("RESET_LANGUAGES"); 309 pPopupMenu->SetItemCommand( nItemId, aCmd ); 310 | 303 ++nItemId; 304 pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_RESET_TO_DEFAULT_LANGUAGE )) ); 305 aCmd=aCmd_Language; 306 aCmd.AppendAscii("RESET_LANGUAGES"); 307 pPopupMenu->SetItemCommand( nItemId, aCmd ); 308 |
| 311 // entry for opening the Format/Character dialog | 309 // entry for opening the Format/Character dialog |
| 312 ++nItemId; 313 pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_MORE ))); | 310 ++nItemId; 311 pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_MORE ))); |
| 314 pPopupMenu->SetItemCommand( nItemId, aCmd_Dialog ); | 312 pPopupMenu->SetItemCommand( nItemId, aCmd_Dialog ); |
| 315} 316 317 318void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) 319{ 320 svt::PopupMenuControllerBase::updatePopupMenu(); 321 | 313} 314 315 316void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) 317{ 318 svt::PopupMenuControllerBase::updatePopupMenu(); 319 |
| 322 // Force status update to get information about the current languages 323 osl::ClearableMutexGuard aLock( m_aMutex ); 324 Reference< XDispatch > xDispatch( m_xLanguageDispatch ); 325 com::sun::star::util::URL aTargetURL; 326 aTargetURL.Complete = m_aLangStatusCommandURL; 327 m_xURLTransformer->parseStrict( aTargetURL ); 328 aLock.clear(); | 320 // Force status update to get information about the current languages 321 osl::ClearableMutexGuard aLock( m_aMutex ); 322 Reference< XDispatch > xDispatch( m_xLanguageDispatch ); 323 com::sun::star::util::URL aTargetURL; 324 aTargetURL.Complete = m_aLangStatusCommandURL; 325 m_xURLTransformer->parseStrict( aTargetURL ); 326 aLock.clear(); |
| 329 | 327 |
| 330 if ( xDispatch.is() ) 331 { 332 xDispatch->addStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); 333 xDispatch->removeStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); 334 } | 328 if ( xDispatch.is() ) 329 { 330 xDispatch->addStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); 331 xDispatch->removeStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); 332 } |
| 335 | 333 |
| 336 // TODO: Fill menu with the information retrieved by the status update | 334 // TODO: Fill menu with the information retrieved by the status update |
| 337 | 335 |
| 338 if( m_aCommandURL.equalsAscii( ".uno:SetLanguageSelectionMenu" )) | 336 if( m_aCommandURL.equalsAscii( ".uno:SetLanguageSelectionMenu" )) |
| 339 { | 337 { |
| 340 fillPopupMenu(m_xPopupMenu, MODE_SetLanguageSelectionMenu ); | 338 fillPopupMenu(m_xPopupMenu, MODE_SetLanguageSelectionMenu ); |
| 341 } 342 else if( m_aCommandURL.equalsAscii( ".uno:SetLanguageParagraphMenu" )) 343 { 344 fillPopupMenu(m_xPopupMenu, MODE_SetLanguageParagraphMenu ); 345 } | 339 } 340 else if( m_aCommandURL.equalsAscii( ".uno:SetLanguageParagraphMenu" )) 341 { 342 fillPopupMenu(m_xPopupMenu, MODE_SetLanguageParagraphMenu ); 343 } |
| 346 else if( m_aCommandURL.equalsAscii( ".uno:SetLanguageAllTextMenu" )) | 344 else if( m_aCommandURL.equalsAscii( ".uno:SetLanguageAllTextMenu" )) |
| 347 { | 345 { |
| 348 fillPopupMenu(m_xPopupMenu, MODE_SetLanguageAllTextMenu ); | 346 fillPopupMenu(m_xPopupMenu, MODE_SetLanguageAllTextMenu ); |
| 349 } 350} 351 352// XInitialization 353void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) 354{ | 347 } 348} 349 350// XInitialization 351void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) 352{ |
| 355 osl::MutexGuard aLock( m_aMutex ); | 353 osl::MutexGuard aLock( m_aMutex ); |
| 356 | 354 |
| 357 sal_Bool bInitialized( m_bInitialized ); 358 if ( !bInitialized ) 359 { | 355 sal_Bool bInitialized( m_bInitialized ); 356 if ( !bInitialized ) 357 { |
| 360 svt::PopupMenuControllerBase::initialize(aArguments); 361 | 358 svt::PopupMenuControllerBase::initialize(aArguments); 359 |
| 362 if ( m_bInitialized ) 363 { | 360 if ( m_bInitialized ) 361 { |
| 364 m_aLangStatusCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" )); 365 m_aMenuCommandURL_Lang = m_aLangStatusCommandURL; 366 m_aMenuCommandURL_Font = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" )); 367 m_aMenuCommandURL_CharDlgForParagraph = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" )); | 362 m_aLangStatusCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" )); 363 m_aMenuCommandURL_Lang = m_aLangStatusCommandURL; 364 m_aMenuCommandURL_Font = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" )); 365 m_aMenuCommandURL_CharDlgForParagraph = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" )); |
| 368 } 369 } | 366 } 367 } |
| 370} 371 372} 373 | 368} 369 370} 371 |
| 372/* vim: set noet sw=4 ts=4: */ |
|