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