1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_framework.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <uielement/langselectionmenucontroller.hxx> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 34*cdf0e10cSrcweir // my own includes 35*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 36*cdf0e10cSrcweir #include <threadhelp/resetableguard.hxx> 37*cdf0e10cSrcweir #include "services.h" 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 40*cdf0e10cSrcweir // interface includes 41*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 42*cdf0e10cSrcweir #include <com/sun/star/awt/XDevice.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/awt/MenuItemStyle.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 48*cdf0e10cSrcweir // includes of other projects 49*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #ifndef _VCL_MENU_HXX_ 52*cdf0e10cSrcweir #include <vcl/menu.hxx> 53*cdf0e10cSrcweir #endif 54*cdf0e10cSrcweir #include <vcl/svapp.hxx> 55*cdf0e10cSrcweir #include <vcl/i18nhelp.hxx> 56*cdf0e10cSrcweir #include <tools/urlobj.hxx> 57*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 58*cdf0e10cSrcweir #ifndef _VCL_MNEMONIC_HXX_ 59*cdf0e10cSrcweir #include <vcl/mnemonic.hxx> 60*cdf0e10cSrcweir #endif 61*cdf0e10cSrcweir #include <com/sun/star/awt/XMenuExtended.hpp> 62*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir #include <com/sun/star/document/XDocumentLanguages.hpp> 65*cdf0e10cSrcweir #include <com/sun/star/frame/XPopupMenuController.hpp> 66*cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 69*cdf0e10cSrcweir #include <svl/languageoptions.hxx> 70*cdf0e10cSrcweir #include <com/sun/star/awt/MenuItemStyle.hpp> 71*cdf0e10cSrcweir #include <svtools/langtab.hxx> 72*cdf0e10cSrcweir #include <classes/fwlresid.hxx> 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir #ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_ 75*cdf0e10cSrcweir #include <classes/resource.hrc> 76*cdf0e10cSrcweir #endif 77*cdf0e10cSrcweir #include <dispatch/uieventloghelper.hxx> 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir #include "helper/mischelper.hxx" 80*cdf0e10cSrcweir #include <vos/mutex.hxx> 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir #include <map> 83*cdf0e10cSrcweir #include <set> 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 86*cdf0e10cSrcweir // Defines 87*cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 88*cdf0e10cSrcweir // 89*cdf0e10cSrcweir using namespace ::com::sun::star; 90*cdf0e10cSrcweir using namespace com::sun::star::uno; 91*cdf0e10cSrcweir using namespace com::sun::star::lang; 92*cdf0e10cSrcweir using namespace com::sun::star::frame; 93*cdf0e10cSrcweir using namespace com::sun::star::beans; 94*cdf0e10cSrcweir using namespace com::sun::star::util; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir using ::rtl::OUString; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir namespace framework 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir DEFINE_XSERVICEINFO_MULTISERVICE ( LanguageSelectionMenuController , 102*cdf0e10cSrcweir OWeakObject , 103*cdf0e10cSrcweir SERVICENAME_POPUPMENUCONTROLLER , 104*cdf0e10cSrcweir IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER 105*cdf0e10cSrcweir ) 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {} ) 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) : 110*cdf0e10cSrcweir svt::PopupMenuControllerBase( xServiceManager ), 111*cdf0e10cSrcweir m_bShowMenu( sal_True ), 112*cdf0e10cSrcweir m_aLangGuessHelper( xServiceManager ) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir LanguageSelectionMenuController::~LanguageSelectionMenuController() 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // XEventListener 121*cdf0e10cSrcweir void SAL_CALL LanguageSelectionMenuController::disposing( const EventObject& ) throw ( RuntimeException ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY ); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir osl::MutexGuard aLock( m_aMutex ); 126*cdf0e10cSrcweir m_xFrame.clear(); 127*cdf0e10cSrcweir m_xDispatch.clear(); 128*cdf0e10cSrcweir m_xLanguageDispatch.clear(); 129*cdf0e10cSrcweir m_xServiceManager.clear(); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir if ( m_xPopupMenu.is() ) 132*cdf0e10cSrcweir m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); 133*cdf0e10cSrcweir m_xPopupMenu.clear(); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir // XStatusListener 137*cdf0e10cSrcweir void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose) 142*cdf0e10cSrcweir return; 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir m_bShowMenu = sal_True; 145*cdf0e10cSrcweir m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir OUString aStrValue; 148*cdf0e10cSrcweir Sequence< OUString > aSeq; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir if ( Event.State >>= aSeq ) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir if ( aSeq.getLength() == 4 ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir // Retrieve all other values from the sequence and 155*cdf0e10cSrcweir // store it members! 156*cdf0e10cSrcweir m_aCurLang = aSeq[0]; 157*cdf0e10cSrcweir m_nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); 158*cdf0e10cSrcweir m_aKeyboardLang = aSeq[2]; 159*cdf0e10cSrcweir m_aGuessedTextLang = aSeq[3]; 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir else if ( !Event.State.hasValue() ) 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir m_bShowMenu = sal_False; // no language -> no sub-menu entries -> disable menu 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir // XMenuListener 169*cdf0e10cSrcweir void LanguageSelectionMenuController::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aTargetURL) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir Reference< XDispatch > xDispatch = _xDispatch; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir if ( aTargetURL.Complete == m_aMenuCommandURL_Font ) 174*cdf0e10cSrcweir { //open format/character dialog for current selection 175*cdf0e10cSrcweir xDispatch = m_xMenuDispatch_Font; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir else if ( aTargetURL.Complete == m_aMenuCommandURL_Lang ) 178*cdf0e10cSrcweir { //open language tab-page in tools/options dialog 179*cdf0e10cSrcweir xDispatch = m_xMenuDispatch_Lang; 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir else if ( aTargetURL.Complete == m_aMenuCommandURL_CharDlgForParagraph ) 182*cdf0e10cSrcweir { //open format/character dialog for current selection 183*cdf0e10cSrcweir xDispatch = m_xMenuDispatch_CharDlgForParagraph; 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir if ( !xDispatch.is() ) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 189*cdf0e10cSrcweir if ( xDispatchProvider.is() ) 190*cdf0e10cSrcweir xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir if ( xDispatch.is() ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir Sequence<PropertyValue> aArgs; 196*cdf0e10cSrcweir if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# 197*cdf0e10cSrcweir UiEventLogHelper( OUString::createFromAscii("LanguageSelectionMenuController")).log( m_xServiceManager, m_xFrame, aTargetURL, aArgs ); 198*cdf0e10cSrcweir xDispatch->dispatch( aTargetURL, aArgs ); 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir // XPopupMenuController 203*cdf0e10cSrcweir void LanguageSelectionMenuController::impl_setPopupMenu() 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir // Register for language updates 210*cdf0e10cSrcweir aTargetURL.Complete = m_aLangStatusCommandURL; 211*cdf0e10cSrcweir m_xURLTransformer->parseStrict( aTargetURL ); 212*cdf0e10cSrcweir m_xLanguageDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir // Register for setting languages and opening language dialog 215*cdf0e10cSrcweir aTargetURL.Complete = m_aMenuCommandURL_Lang; 216*cdf0e10cSrcweir m_xURLTransformer->parseStrict( aTargetURL ); 217*cdf0e10cSrcweir m_xMenuDispatch_Lang = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir // Register for opening character dialog 220*cdf0e10cSrcweir aTargetURL.Complete = m_aMenuCommandURL_Font; 221*cdf0e10cSrcweir m_xURLTransformer->parseStrict( aTargetURL ); 222*cdf0e10cSrcweir m_xMenuDispatch_Font = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir // Register for opening character dialog with preselected paragraph 225*cdf0e10cSrcweir aTargetURL.Complete = m_aMenuCommandURL_CharDlgForParagraph; 226*cdf0e10cSrcweir m_xURLTransformer->parseStrict( aTargetURL ); 227*cdf0e10cSrcweir m_xMenuDispatch_CharDlgForParagraph = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir void LanguageSelectionMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu , const Mode eMode ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir VCLXPopupMenu* pVCLPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); 233*cdf0e10cSrcweir PopupMenu* pPopupMenu = 0; 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir resetPopupMenu( rPopupMenu ); 238*cdf0e10cSrcweir if (!m_bShowMenu) 239*cdf0e10cSrcweir return; 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir if ( pVCLPopupMenu ) 242*cdf0e10cSrcweir pPopupMenu = (PopupMenu *)pVCLPopupMenu->GetMenu(); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir String aCmd; 245*cdf0e10cSrcweir String aCmd_Dialog; 246*cdf0e10cSrcweir String aCmd_Language; 247*cdf0e10cSrcweir if( eMode == MODE_SetLanguageSelectionMenu ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir aCmd_Dialog.AppendAscii(".uno:FontDialog?Language:string=*"); 250*cdf0e10cSrcweir aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Current_"); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir else if ( eMode == MODE_SetLanguageParagraphMenu ) 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir aCmd_Dialog.AppendAscii(".uno:FontDialogForParagraph"); 255*cdf0e10cSrcweir aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Paragraph_"); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir else if ( eMode == MODE_SetLanguageAllTextMenu ) 258*cdf0e10cSrcweir { 259*cdf0e10cSrcweir aCmd_Dialog.AppendAscii(".uno:LanguageStatus?Language:string=*"); 260*cdf0e10cSrcweir aCmd_Language.AppendAscii(".uno:LanguageStatus?Language:string=Default_"); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir SvtLanguageTable aLanguageTable; 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir // get languages to be displayed in the menu 266*cdf0e10cSrcweir std::set< OUString > aLangItems; 267*cdf0e10cSrcweir FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper, 268*cdf0e10cSrcweir m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang ); 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir // 271*cdf0e10cSrcweir // now add menu entries 272*cdf0e10cSrcweir // the different menues purpose will be handled by the different string 273*cdf0e10cSrcweir // for aCmd_Dialog and aCmd_Language 274*cdf0e10cSrcweir // 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir sal_Int16 nItemId = 1; // in this control the item id is not important for executing the command 277*cdf0e10cSrcweir const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection 278*cdf0e10cSrcweir const OUString sEmpty; // 'no language found' from language guessing 279*cdf0e10cSrcweir std::map< sal_Int16, OUString > aLangMap; 280*cdf0e10cSrcweir std::set< OUString >::const_iterator it; 281*cdf0e10cSrcweir for (it = aLangItems.begin(); it != aLangItems.end(); ++it) 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir const OUString & rStr( *it ); 284*cdf0e10cSrcweir if (rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&& 285*cdf0e10cSrcweir rStr != sAsterix && 286*cdf0e10cSrcweir rStr != sEmpty) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir pPopupMenu->InsertItem( nItemId, rStr ); 289*cdf0e10cSrcweir aCmd = aCmd_Language; 290*cdf0e10cSrcweir aCmd += String( rStr ); 291*cdf0e10cSrcweir pPopupMenu->SetItemCommand( nItemId, aCmd ); 292*cdf0e10cSrcweir if (rStr == m_aCurLang && eMode == MODE_SetLanguageSelectionMenu ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir //make a sign for the current language 295*cdf0e10cSrcweir pPopupMenu->CheckItem( nItemId, sal_True ); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir aLangMap[ nItemId ] = rStr; 298*cdf0e10cSrcweir ++nItemId; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir // entry for LANGUAGE_NONE 303*cdf0e10cSrcweir ++nItemId; 304*cdf0e10cSrcweir pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_NONE )) ); 305*cdf0e10cSrcweir aCmd=aCmd_Language; 306*cdf0e10cSrcweir aCmd.AppendAscii("LANGUAGE_NONE"); 307*cdf0e10cSrcweir pPopupMenu->SetItemCommand( nItemId, aCmd ); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir // entry for 'Reset to default language' 310*cdf0e10cSrcweir ++nItemId; 311*cdf0e10cSrcweir pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_RESET_TO_DEFAULT_LANGUAGE )) ); 312*cdf0e10cSrcweir aCmd=aCmd_Language; 313*cdf0e10cSrcweir aCmd.AppendAscii("RESET_LANGUAGES"); 314*cdf0e10cSrcweir pPopupMenu->SetItemCommand( nItemId, aCmd ); 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // entry for opening the Format/Character dialog 317*cdf0e10cSrcweir ++nItemId; 318*cdf0e10cSrcweir pPopupMenu->InsertItem( nItemId, String(FwlResId( STR_LANGSTATUS_MORE ))); 319*cdf0e10cSrcweir pPopupMenu->SetItemCommand( nItemId, aCmd_Dialog ); 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir void SAL_CALL LanguageSelectionMenuController::updatePopupMenu() throw ( ::com::sun::star::uno::RuntimeException ) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir svt::PopupMenuControllerBase::updatePopupMenu(); 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir // Force status update to get information about the current languages 328*cdf0e10cSrcweir osl::ClearableMutexGuard aLock( m_aMutex ); 329*cdf0e10cSrcweir Reference< XDispatch > xDispatch( m_xLanguageDispatch ); 330*cdf0e10cSrcweir com::sun::star::util::URL aTargetURL; 331*cdf0e10cSrcweir aTargetURL.Complete = m_aLangStatusCommandURL; 332*cdf0e10cSrcweir m_xURLTransformer->parseStrict( aTargetURL ); 333*cdf0e10cSrcweir aLock.clear(); 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir if ( xDispatch.is() ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir xDispatch->addStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); 338*cdf0e10cSrcweir xDispatch->removeStatusListener( SAL_STATIC_CAST( XStatusListener*, this ), aTargetURL ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir // TODO: Fill menu with the information retrieved by the status update 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir if( m_aCommandURL.equalsAscii( ".uno:SetLanguageSelectionMenu" )) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir fillPopupMenu(m_xPopupMenu, MODE_SetLanguageSelectionMenu ); 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir else if( m_aCommandURL.equalsAscii( ".uno:SetLanguageParagraphMenu" )) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir fillPopupMenu(m_xPopupMenu, MODE_SetLanguageParagraphMenu ); 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir else if( m_aCommandURL.equalsAscii( ".uno:SetLanguageAllTextMenu" )) 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir fillPopupMenu(m_xPopupMenu, MODE_SetLanguageAllTextMenu ); 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir // XInitialization 358*cdf0e10cSrcweir void SAL_CALL LanguageSelectionMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir osl::MutexGuard aLock( m_aMutex ); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir sal_Bool bInitalized( m_bInitialized ); 363*cdf0e10cSrcweir if ( !bInitalized ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir svt::PopupMenuControllerBase::initialize(aArguments); 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir if ( m_bInitialized ) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir m_aLangStatusCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:LanguageStatus" )); 370*cdf0e10cSrcweir m_aMenuCommandURL_Lang = m_aLangStatusCommandURL; 371*cdf0e10cSrcweir m_aMenuCommandURL_Font = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialog" )); 372*cdf0e10cSrcweir m_aMenuCommandURL_CharDlgForParagraph = OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FontDialogForParagraph" )); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379