xref: /AOO41X/main/framework/source/uielement/langselectionstatusbarcontroller.cxx (revision 450ff861bccba1a5c8d0630859b2204b7e91f462)
16d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
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
10cdf0e10cSrcweir  *
116d739b60SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
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/langselectionstatusbarcontroller.hxx>
28cdf0e10cSrcweir #include <classes/fwkresid.hxx>
29cdf0e10cSrcweir #include <services.h>
30cdf0e10cSrcweir #include <classes/resource.hrc>
31cdf0e10cSrcweir #include <vos/mutex.hxx>
32cdf0e10cSrcweir #include <vcl/svapp.hxx>
33cdf0e10cSrcweir #include <vcl/window.hxx>
34cdf0e10cSrcweir #include <vcl/status.hxx>
35cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <com/sun/star/frame/XPopupMenuController.hpp>
38cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
39cdf0e10cSrcweir #include <com/sun/star/awt/PopupMenuDirection.hpp>
40cdf0e10cSrcweir #include <svtools/langtab.hxx>
41cdf0e10cSrcweir #include "sal/types.h"
42cdf0e10cSrcweir #include <vcl/svapp.hxx>
43cdf0e10cSrcweir #include <com/sun/star/awt/MenuItemStyle.hpp>
44cdf0e10cSrcweir #include <com/sun/star/document/XDocumentLanguages.hpp>
45cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
46cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp>
47cdf0e10cSrcweir #include <com/sun/star/frame/XModule.hpp>
48cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir #include <classes/fwkresid.hxx>
51cdf0e10cSrcweir #ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_
52cdf0e10cSrcweir #include <classes/resource.hrc>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
55cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp>
56cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
57cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp>
58cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
59cdf0e10cSrcweir 
60*450ff861SAriel Constenla-Haile #include <toolkit/helper/vclunohelper.hxx>
61cdf0e10cSrcweir #include <tools/gen.hxx>
62cdf0e10cSrcweir #include <com/sun/star/awt/Command.hpp>
63cdf0e10cSrcweir #include <svl/languageoptions.hxx>
64cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
65cdf0e10cSrcweir #include <dispatch/uieventloghelper.hxx>
66cdf0e10cSrcweir 
67cdf0e10cSrcweir #include "helper/mischelper.hxx"
68cdf0e10cSrcweir 
69*450ff861SAriel Constenla-Haile #include <rtl/ustrbuf.hxx>
70*450ff861SAriel Constenla-Haile 
71cdf0e10cSrcweir #include <map>
72cdf0e10cSrcweir #include <set>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir using namespace ::cppu;
75cdf0e10cSrcweir using namespace ::com::sun::star;
76cdf0e10cSrcweir using namespace ::com::sun::star::uno;
77cdf0e10cSrcweir using namespace ::com::sun::star::lang;
78cdf0e10cSrcweir using namespace ::com::sun::star::frame;
79cdf0e10cSrcweir using namespace ::com::sun::star::i18n;
80cdf0e10cSrcweir using namespace ::com::sun::star::document;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir using ::rtl::OUString;
83*450ff861SAriel Constenla-Haile using ::rtl::OUStringBuffer;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir namespace framework
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 
89cdf0e10cSrcweir DEFINE_XSERVICEINFO_MULTISERVICE        (   LangSelectionStatusbarController     	    ,
90cdf0e10cSrcweir                                             OWeakObject                             ,
91cdf0e10cSrcweir                                             SERVICENAME_STATUSBARCONTROLLER		    ,
92cdf0e10cSrcweir 											IMPLEMENTATIONNAME_LANGSELECTIONSTATUSBARCONTROLLER
93cdf0e10cSrcweir 										)
94cdf0e10cSrcweir 
95cdf0e10cSrcweir DEFINE_INIT_SERVICE                     (   LangSelectionStatusbarController, {} )
96cdf0e10cSrcweir 
97cdf0e10cSrcweir LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
98cdf0e10cSrcweir     svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), OUString(), 0 ),
99cdf0e10cSrcweir 	m_bShowMenu( sal_True ),
100cdf0e10cSrcweir     m_nScriptType( LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX ),
101cdf0e10cSrcweir     m_aLangGuessHelper( xServiceManager )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir void SAL_CALL LangSelectionStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
106cdf0e10cSrcweir throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::initialize" );
109cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     svt::StatusbarController::initialize( aArguments );
112cdf0e10cSrcweir 
113*450ff861SAriel Constenla-Haile     if ( m_xStatusbarItem.is() )
114cdf0e10cSrcweir     {
115*450ff861SAriel Constenla-Haile         m_xStatusbarItem->setText( String( FwkResId( STR_LANGSTATUS_MULTIPLE_LANGUAGES ) ) );
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119*450ff861SAriel Constenla-Haile void LangSelectionStatusbarController::LangMenu(
120*450ff861SAriel Constenla-Haile     const ::com::sun::star::awt::Point& aPos )
121cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::LangMenu" );
124cdf0e10cSrcweir 	if (!m_bShowMenu)
125cdf0e10cSrcweir 		return;
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	//add context menu
128cdf0e10cSrcweir     const static OUString s_sPopupMenu(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.PopupMenu"));
129cdf0e10cSrcweir 	Reference< awt::XPopupMenu > xPopupMenu( m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY );
130cdf0e10cSrcweir     //sub menu that contains all items except the last two items: Separator + Set Language for Paragraph
131cdf0e10cSrcweir 	Reference< awt::XPopupMenu > subPopupMenu(m_xServiceManager->createInstance( s_sPopupMenu ), UNO_QUERY );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     SvtLanguageTable    aLanguageTable;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     // get languages to be displayed in the menu
136cdf0e10cSrcweir     std::set< OUString > aLangItems;
137cdf0e10cSrcweir     FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper,
138cdf0e10cSrcweir             m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     //
141cdf0e10cSrcweir     // add first few entries to main menu
142cdf0e10cSrcweir     //
143cdf0e10cSrcweir 	sal_Int16 nItemId = static_cast< sal_Int16 >(MID_LANG_SEL_1);
144cdf0e10cSrcweir     const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*"));  // multiple languages in current selection
145cdf0e10cSrcweir     const OUString sEmpty;  // 'no language found' from language guessing
146cdf0e10cSrcweir     std::map< sal_Int16, OUString > aLangMap;
147cdf0e10cSrcweir     std::set< OUString >::const_iterator it;
148cdf0e10cSrcweir     for (it = aLangItems.begin(); it != aLangItems.end(); ++it)
149cdf0e10cSrcweir     {
150cdf0e10cSrcweir         const OUString & rStr( *it );
151cdf0e10cSrcweir         if ( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) ) &&
152cdf0e10cSrcweir              rStr != sAsterix &&
153cdf0e10cSrcweir              rStr != sEmpty)
154cdf0e10cSrcweir 		{
155cdf0e10cSrcweir             DBG_ASSERT( MID_LANG_SEL_1 <= nItemId && nItemId <= MID_LANG_SEL_9,
156cdf0e10cSrcweir                     "nItemId outside of expected range!" );
157*450ff861SAriel Constenla-Haile 	        xPopupMenu->insertItem( nItemId, rStr, 0, nItemId );
158cdf0e10cSrcweir 		    if ( rStr == m_aCurLang )
159cdf0e10cSrcweir 	        {
160cdf0e10cSrcweir 				//make a sign for the current language
161cdf0e10cSrcweir                 xPopupMenu->checkItem( nItemId, sal_True );
162cdf0e10cSrcweir 		    }
163cdf0e10cSrcweir             aLangMap[ nItemId ] = rStr;
164cdf0e10cSrcweir 			++nItemId;
165cdf0e10cSrcweir 		}
166cdf0e10cSrcweir     }
167*450ff861SAriel Constenla-Haile     xPopupMenu->insertItem( MID_LANG_SEL_NONE,  String( FwkResId( STR_LANGSTATUS_NONE )), 0, MID_LANG_SEL_NONE );
168*450ff861SAriel Constenla-Haile     xPopupMenu->insertItem( MID_LANG_SEL_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), 0, MID_LANG_SEL_RESET );
169*450ff861SAriel Constenla-Haile     xPopupMenu->insertItem( MID_LANG_SEL_MORE,  String( FwkResId( STR_LANGSTATUS_MORE )), 0, MID_LANG_SEL_MORE );
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     //
172cdf0e10cSrcweir     // add entries to submenu ('set language for paragraph')
173cdf0e10cSrcweir     //
174cdf0e10cSrcweir 	nItemId = static_cast< sal_Int16 >(MID_LANG_PARA_1);
175cdf0e10cSrcweir     for (it = aLangItems.begin(); it != aLangItems.end(); ++it)
176cdf0e10cSrcweir     {
177cdf0e10cSrcweir         const OUString & rStr( *it );
178cdf0e10cSrcweir         if( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&&
179cdf0e10cSrcweir             rStr != sAsterix &&
180cdf0e10cSrcweir             rStr != sEmpty)
181cdf0e10cSrcweir 		{
182cdf0e10cSrcweir             DBG_ASSERT( MID_LANG_PARA_1 <= nItemId && nItemId <= MID_LANG_PARA_9,
183cdf0e10cSrcweir                     "nItemId outside of expected range!" );
184*450ff861SAriel Constenla-Haile             subPopupMenu->insertItem( nItemId, rStr, 0, nItemId );
185cdf0e10cSrcweir 			aLangMap[nItemId] = rStr;
186cdf0e10cSrcweir             ++nItemId;
187cdf0e10cSrcweir 		}
188cdf0e10cSrcweir     }
189*450ff861SAriel Constenla-Haile     subPopupMenu->insertItem( MID_LANG_PARA_NONE,  String( FwkResId( STR_LANGSTATUS_NONE )), 0, MID_LANG_PARA_NONE );
190*450ff861SAriel Constenla-Haile     subPopupMenu->insertItem( MID_LANG_PARA_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), 0, MID_LANG_PARA_RESET );
191*450ff861SAriel Constenla-Haile     subPopupMenu->insertItem( MID_LANG_PARA_MORE,  String( FwkResId( STR_LANGSTATUS_MORE )), 0, MID_LANG_PARA_MORE );
192cdf0e10cSrcweir 
193cdf0e10cSrcweir     //
194cdf0e10cSrcweir     // add last two entries to main menu
195cdf0e10cSrcweir     //
196cdf0e10cSrcweir 	xPopupMenu->insertSeparator( MID_LANG_PARA_SEPERATOR );
197*450ff861SAriel Constenla-Haile     xPopupMenu->insertItem( MID_LANG_PARA_STRING, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), 0, MID_LANG_PARA_STRING );
198cdf0e10cSrcweir 	xPopupMenu->setPopupMenu( MID_LANG_PARA_STRING, subPopupMenu );
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     //
202cdf0e10cSrcweir     // now display the popup menu and execute every command ...
203cdf0e10cSrcweir     //
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	Reference< awt::XWindowPeer > xParent( m_xParentWindow, UNO_QUERY );
206cdf0e10cSrcweir 	com::sun::star::awt::Rectangle aRectangle;
207*450ff861SAriel Constenla-Haile     aRectangle.X = aPos.X;
208*450ff861SAriel Constenla-Haile 	aRectangle.Y = aPos.Y;
209cdf0e10cSrcweir 	sal_Int16 nId = xPopupMenu->execute( xParent, aRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 );
210cdf0e10cSrcweir     //click "More..."
211cdf0e10cSrcweir     if ( nId && m_xFrame.is() )
212cdf0e10cSrcweir     {
213*450ff861SAriel Constenla-Haile         OUStringBuffer aBuff;
214*450ff861SAriel Constenla-Haile         //set selected language as current language for selection
215*450ff861SAriel Constenla-Haile         const OUString aSelectedLang = aLangMap[nId];
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 		if (MID_LANG_SEL_1 <= nId && nId <= MID_LANG_SEL_9)
218cdf0e10cSrcweir 		{
219*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:LanguageStatus?Language:string=Current_") ));
220*450ff861SAriel Constenla-Haile 			aBuff.append( aSelectedLang );
221cdf0e10cSrcweir 		}
222cdf0e10cSrcweir 		else if (nId == MID_LANG_SEL_NONE)
223cdf0e10cSrcweir 		{
224cdf0e10cSrcweir             //set None as current language for selection
225*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE") ));
226cdf0e10cSrcweir 		}
227cdf0e10cSrcweir 		else if (nId == MID_LANG_SEL_RESET)
228cdf0e10cSrcweir 		{
229cdf0e10cSrcweir             // reset language attributes for selection
230*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES") ));
231cdf0e10cSrcweir         }
232cdf0e10cSrcweir 		else if (nId == MID_LANG_SEL_MORE)
233cdf0e10cSrcweir 		{
234cdf0e10cSrcweir 			//open the dialog "format/character" for current selection
235*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:FontDialog?Language:string=*") ));
236cdf0e10cSrcweir 		}
237cdf0e10cSrcweir         else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9)
238cdf0e10cSrcweir 		{
239*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:LanguageStatus?Language:string=Paragraph_") ));
240*450ff861SAriel Constenla-Haile             aBuff.append( aSelectedLang );
241cdf0e10cSrcweir 		}
242cdf0e10cSrcweir         else if (nId == MID_LANG_PARA_NONE)
243cdf0e10cSrcweir         {
244cdf0e10cSrcweir             //set None as language for current paragraph
245*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE") ));
246cdf0e10cSrcweir         }
247cdf0e10cSrcweir         else if (nId == MID_LANG_PARA_RESET)
248cdf0e10cSrcweir         {
249cdf0e10cSrcweir             // reset language attributes for paragraph
250*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES") ));
251cdf0e10cSrcweir         }
252cdf0e10cSrcweir         else if (nId == MID_LANG_PARA_MORE)
253cdf0e10cSrcweir 		{
254cdf0e10cSrcweir 			//open the dialog "format/character" for current paragraph
255*450ff861SAriel Constenla-Haile             aBuff.appendAscii( RTL_CONSTASCII_STRINGPARAM( (".uno:FontDialogForParagraph") ));
256cdf0e10cSrcweir 		}
257cdf0e10cSrcweir 
258*450ff861SAriel Constenla-Haile         const Sequence< beans::PropertyValue > aDummyArgs;
259*450ff861SAriel Constenla-Haile         execute( aBuff.makeStringAndClear(), aDummyArgs );
260cdf0e10cSrcweir     }
261cdf0e10cSrcweir }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir void SAL_CALL LangSelectionStatusbarController::command(
264*450ff861SAriel Constenla-Haile     const ::com::sun::star::awt::Point& aPos,
265cdf0e10cSrcweir     ::sal_Int32 nCommand,
266cdf0e10cSrcweir     ::sal_Bool /*bMouseEvent*/,
267cdf0e10cSrcweir     const ::com::sun::star::uno::Any& /*aData*/ )
268cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::command" );
271cdf0e10cSrcweir 	if ( nCommand & ::awt::Command::CONTEXTMENU )
272cdf0e10cSrcweir 	{
273*450ff861SAriel Constenla-Haile         LangMenu( aPos );
274cdf0e10cSrcweir 	}
275cdf0e10cSrcweir }
276cdf0e10cSrcweir 
277*450ff861SAriel Constenla-Haile void SAL_CALL LangSelectionStatusbarController::click(
278*450ff861SAriel Constenla-Haile     const ::com::sun::star::awt::Point& aPos )
279cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException)
280cdf0e10cSrcweir {
281cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::click" );
282*450ff861SAriel Constenla-Haile     LangMenu( aPos );
283cdf0e10cSrcweir }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir // XStatusListener
286cdf0e10cSrcweir void SAL_CALL LangSelectionStatusbarController::statusChanged( const FeatureStateEvent& Event )
287cdf0e10cSrcweir throw ( RuntimeException )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir     // This function will be called when observed data changes,
290cdf0e10cSrcweir     // for example the selection or keyboard language.
291cdf0e10cSrcweir     // - It displays the language in use in the status bar
292cdf0e10cSrcweir     // - and it stores the relevant data for creating the menu
293cdf0e10cSrcweir     //   at some later point in the member variables
294cdf0e10cSrcweir     //      m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedText
295cdf0e10cSrcweir 
296cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::statusChanged" );
297cdf0e10cSrcweir     vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
298cdf0e10cSrcweir 
299cdf0e10cSrcweir     if ( m_bDisposed )
300cdf0e10cSrcweir         return;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	m_bShowMenu = sal_True;
303cdf0e10cSrcweir 	m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX;  //set the default value
304*450ff861SAriel Constenla-Haile 
305*450ff861SAriel Constenla-Haile     if ( m_xStatusbarItem.is() )
306cdf0e10cSrcweir     {
307cdf0e10cSrcweir         OUString aStrValue;
308cdf0e10cSrcweir         Sequence< OUString > aSeq;
309cdf0e10cSrcweir 
310cdf0e10cSrcweir         if ( Event.State >>= aStrValue )
311*450ff861SAriel Constenla-Haile             m_xStatusbarItem->setText( aStrValue );
312cdf0e10cSrcweir         else if ( Event.State >>= aSeq )
313cdf0e10cSrcweir         {
314cdf0e10cSrcweir             if ( aSeq.getLength() == 4 )
315cdf0e10cSrcweir             {
316cdf0e10cSrcweir 				OUString aStatusText = aSeq[0];
317*450ff861SAriel Constenla-Haile 				if ( 0 == aStatusText.compareToAscii( RTL_CONSTASCII_STRINGPARAM("*") ))
318*450ff861SAriel Constenla-Haile                 {
319*450ff861SAriel Constenla-Haile                     aStatusText = String( FwkResId( STR_LANGSTATUS_MULTIPLE_LANGUAGES ) );
320*450ff861SAriel Constenla-Haile                 }
321*450ff861SAriel Constenla-Haile                 m_xStatusbarItem->setText( aStatusText );
322cdf0e10cSrcweir 
323cdf0e10cSrcweir                 // Retrieve all other values from the sequence and
324cdf0e10cSrcweir                 // store it members!
325cdf0e10cSrcweir 				m_aCurLang      = aSeq[0];
326cdf0e10cSrcweir                 m_nScriptType   = static_cast< sal_Int16 >( aSeq[1].toInt32() );
327cdf0e10cSrcweir 	            m_aKeyboardLang = aSeq[2];
328cdf0e10cSrcweir                 m_aGuessedTextLang  = aSeq[3];
329cdf0e10cSrcweir             }
330cdf0e10cSrcweir         }
331cdf0e10cSrcweir         else if ( !Event.State.hasValue() )
332cdf0e10cSrcweir 		{
333*450ff861SAriel Constenla-Haile             m_xStatusbarItem->setText( OUString() );
334cdf0e10cSrcweir 			m_bShowMenu = sal_False;	// no language -> no menu
335cdf0e10cSrcweir 		}
336cdf0e10cSrcweir     }
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
339cdf0e10cSrcweir }
340cdf0e10cSrcweir 
341