LCOV - code coverage report
Current view: top level - framework/source/uielement - langselectionstatusbarcontroller.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 53 158 33.5 %
Date: 2012-08-25 Functions: 12 24 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 58 404 14.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <uielement/langselectionstatusbarcontroller.hxx>
      31                 :            : #include <classes/fwkresid.hxx>
      32                 :            : #include <services.h>
      33                 :            : #include <classes/resource.hrc>
      34                 :            : #include <osl/mutex.hxx>
      35                 :            : #include <vcl/svapp.hxx>
      36                 :            : #include <vcl/window.hxx>
      37                 :            : #include <vcl/status.hxx>
      38                 :            : #include <toolkit/unohlp.hxx>
      39                 :            : #include <toolkit/helper/convert.hxx>
      40                 :            : 
      41                 :            : #include <com/sun/star/frame/XPopupMenuController.hpp>
      42                 :            : #include <toolkit/helper/vclunohelper.hxx>
      43                 :            : #include <com/sun/star/awt/PopupMenu.hpp>
      44                 :            : #include <com/sun/star/awt/PopupMenuDirection.hpp>
      45                 :            : #include <svtools/langtab.hxx>
      46                 :            : #include "sal/types.h"
      47                 :            : #include <vcl/svapp.hxx>
      48                 :            : #include <com/sun/star/awt/MenuItemStyle.hpp>
      49                 :            : #include <com/sun/star/document/XDocumentLanguages.hpp>
      50                 :            : #include <i18npool/mslangid.hxx>
      51                 :            : #include <com/sun/star/i18n/ScriptType.hpp>
      52                 :            : #include <com/sun/star/frame/XModule.hpp>
      53                 :            : #include <com/sun/star/frame/XModel.hpp>
      54                 :            : 
      55                 :            : #include <classes/fwkresid.hxx>
      56                 :            : #include <classes/resource.hrc>
      57                 :            : #include <com/sun/star/frame/XFrame.hpp>
      58                 :            : #include <com/sun/star/frame/XDispatch.hpp>
      59                 :            : #include <com/sun/star/frame/XDispatchProvider.hpp>
      60                 :            : #include <com/sun/star/util/URLTransformer.hpp>
      61                 :            : #include <com/sun/star/util/XURLTransformer.hpp>
      62                 :            : #include <comphelper/processfactory.hxx>
      63                 :            : #include <comphelper/componentcontext.hxx>
      64                 :            : 
      65                 :            : #include <toolkit/unohlp.hxx>
      66                 :            : #include <tools/gen.hxx>
      67                 :            : #include <com/sun/star/awt/Command.hpp>
      68                 :            : #include <svl/languageoptions.hxx>
      69                 :            : #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
      70                 :            : 
      71                 :            : #include "helper/mischelper.hxx"
      72                 :            : 
      73                 :            : #include <map>
      74                 :            : #include <set>
      75                 :            : 
      76                 :            : using namespace ::cppu;
      77                 :            : using namespace ::com::sun::star;
      78                 :            : using namespace ::com::sun::star::uno;
      79                 :            : using namespace ::com::sun::star::lang;
      80                 :            : using namespace ::com::sun::star::frame;
      81                 :            : using namespace ::com::sun::star::i18n;
      82                 :            : using namespace ::com::sun::star::document;
      83                 :            : 
      84                 :            : using ::rtl::OUString;
      85                 :            : 
      86                 :            : 
      87                 :            : namespace framework
      88                 :            : {
      89                 :            : 
      90                 :            : 
      91 [ +  - ][ +  - ]:       1382 : DEFINE_XSERVICEINFO_MULTISERVICE        (   LangSelectionStatusbarController            ,
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ #  # ][ #  # ]
      92                 :            :                                             OWeakObject                             ,
      93                 :            :                                             SERVICENAME_STATUSBARCONTROLLER         ,
      94                 :            :                                             IMPLEMENTATIONNAME_LANGSELECTIONSTATUSBARCONTROLLER
      95                 :            :                                         )
      96                 :            : 
      97                 :        764 : DEFINE_INIT_SERVICE                     (   LangSelectionStatusbarController, {} )
      98                 :            : 
      99                 :        764 : LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
     100                 :            :     svt::StatusbarController( xServiceManager, uno::Reference< frame::XFrame >(), OUString(), 0 ),
     101                 :            :     m_bShowMenu( sal_True ),
     102                 :            :     m_nScriptType( LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX ),
     103 [ +  - ][ +  - ]:        764 :     m_aLangGuessHelper( xServiceManager )
     104                 :            : {
     105                 :        764 : }
     106                 :            : 
     107                 :            : // XInterface
     108                 :       6876 : Any SAL_CALL LangSelectionStatusbarController::queryInterface( const Type& rType )
     109                 :            : throw ( RuntimeException )
     110                 :            : {
     111                 :       6876 :     return svt::StatusbarController::queryInterface( rType );
     112                 :            : }
     113                 :            : 
     114                 :      19699 : void SAL_CALL LangSelectionStatusbarController::acquire() throw ()
     115                 :            : {
     116                 :      19699 :     svt::StatusbarController::acquire();
     117                 :      19699 : }
     118                 :            : 
     119                 :      19699 : void SAL_CALL LangSelectionStatusbarController::release() throw ()
     120                 :            : {
     121                 :      19699 :     svt::StatusbarController::release();
     122                 :      19699 : }
     123                 :            : 
     124                 :        764 : void SAL_CALL LangSelectionStatusbarController::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
     125                 :            : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
     126                 :            : {
     127                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::initialize" );
     128         [ +  - ]:        764 :     SolarMutexGuard aSolarMutexGuard;
     129                 :            : 
     130         [ +  - ]:        764 :     svt::StatusbarController::initialize( aArguments );
     131                 :            : 
     132 [ +  - ][ +  - ]:        764 :     if ( m_xParentWindow.is() && m_nID > 0 )
                 [ +  - ]
     133                 :            :     {
     134         [ +  - ]:        764 :         Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
     135 [ +  - ][ +  - ]:        764 :         if ( pWindow && ( pWindow->GetType() == WINDOW_STATUSBAR ))
         [ +  - ][ +  - ]
     136                 :            :         {
     137                 :        764 :             StatusBar* pStatusBar = (StatusBar *)pWindow;
     138 [ +  - ][ +  - ]:        764 :             pStatusBar->SetItemText( m_nID, FwkResId( STR_LANGSTATUS_MULTIPLE_LANGUAGES ) );
         [ +  - ][ +  - ]
     139                 :            :         }
     140         [ +  - ]:        764 :     }
     141                 :        764 : }
     142                 :            : 
     143                 :            : // XComponent
     144                 :        764 : void SAL_CALL LangSelectionStatusbarController::dispose()
     145                 :            : throw (::com::sun::star::uno::RuntimeException)
     146                 :            : {
     147                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::dispose" );
     148                 :        764 :     svt::StatusbarController::dispose();
     149                 :        764 : }
     150                 :            : 
     151                 :            : // XEventListener
     152                 :          0 : void SAL_CALL LangSelectionStatusbarController::disposing( const com::sun::star::lang::EventObject& Source )
     153                 :            : throw ( RuntimeException )
     154                 :            : {
     155                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::disposing" );
     156                 :          0 :     svt::StatusbarController::disposing( Source );
     157                 :          0 : }
     158                 :            : 
     159                 :            : // XStatusbarController
     160                 :          0 : ::sal_Bool SAL_CALL LangSelectionStatusbarController::mouseButtonDown(
     161                 :            :     const ::com::sun::star::awt::MouseEvent& )
     162                 :            : throw (::com::sun::star::uno::RuntimeException)
     163                 :            : {
     164                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::mouseButtonDown" );
     165                 :          0 :     return sal_False;
     166                 :            : }
     167                 :            : 
     168                 :          0 : ::sal_Bool SAL_CALL LangSelectionStatusbarController::mouseMove(
     169                 :            :     const ::com::sun::star::awt::MouseEvent& )
     170                 :            : throw (::com::sun::star::uno::RuntimeException)
     171                 :            : {
     172                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::mouseMove" );
     173                 :          0 :     return sal_False;
     174                 :            : }
     175                 :            : 
     176                 :          0 : ::sal_Bool SAL_CALL LangSelectionStatusbarController::mouseButtonUp(
     177                 :            :     const ::com::sun::star::awt::MouseEvent& )
     178                 :            : throw (::com::sun::star::uno::RuntimeException)
     179                 :            : {
     180                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::mouseButtonUp" );
     181                 :          0 :     return sal_False;
     182                 :            : }
     183                 :            : 
     184                 :          0 : void LangSelectionStatusbarController::LangMenu()
     185                 :            : throw (::com::sun::star::uno::RuntimeException)
     186                 :            : {
     187                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::LangMenu" );
     188         [ #  # ]:          0 :     if (!m_bShowMenu)
     189                 :          0 :         return;
     190                 :            : 
     191                 :            :     //add context menu
     192 [ #  # ][ #  # ]:          0 :     Reference< awt::XPopupMenu > xPopupMenu( awt::PopupMenu::create( comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
         [ #  # ][ #  # ]
     193                 :            :     //sub menu that contains all items except the last two items: Separator + Set Language for Paragraph
     194 [ #  # ][ #  # ]:          0 :     Reference< awt::XPopupMenu > subPopupMenu( awt::PopupMenu::create( comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) );
         [ #  # ][ #  # ]
     195                 :            : 
     196         [ #  # ]:          0 :     SvtLanguageTable    aLanguageTable;
     197                 :            : 
     198                 :            :     // get languages to be displayed in the menu
     199         [ #  # ]:          0 :     std::set< OUString > aLangItems;
     200                 :            :     FillLangItems( aLangItems, aLanguageTable, m_xFrame, m_aLangGuessHelper,
     201         [ #  # ]:          0 :             m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedTextLang );
     202                 :            : 
     203                 :            :     // add first few entries to main menu
     204                 :          0 :     sal_Int16 nItemId = static_cast< sal_Int16 >(MID_LANG_SEL_1);
     205         [ #  # ]:          0 :     const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*"));  // multiple languages in current selection
     206                 :          0 :     const OUString sEmpty;  // 'no language found' from language guessing
     207         [ #  # ]:          0 :     std::map< sal_Int16, OUString > aLangMap;
     208                 :          0 :     std::set< OUString >::const_iterator it;
     209         [ #  # ]:          0 :     for (it = aLangItems.begin(); it != aLangItems.end(); ++it)
     210                 :            :     {
     211                 :          0 :         const OUString & rStr( *it );
     212   [ #  #  #  #  :          0 :         if ( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) ) &&
           #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     213                 :          0 :              rStr != sAsterix &&
     214                 :          0 :              rStr != sEmpty)
     215                 :            :         {
     216                 :            :             DBG_ASSERT( MID_LANG_SEL_1 <= nItemId && nItemId <= MID_LANG_SEL_9,
     217                 :            :                     "nItemId outside of expected range!" );
     218 [ #  # ][ #  # ]:          0 :             xPopupMenu->insertItem( nItemId, rStr, css::awt::MenuItemStyle::RADIOCHECK, nItemId );
     219         [ #  # ]:          0 :             if ( rStr == m_aCurLang )
     220                 :            :             {
     221                 :            :                 //make a sign for the current language
     222 [ #  # ][ #  # ]:          0 :                 xPopupMenu->checkItem( nItemId, sal_True );
     223                 :            :             }
     224         [ #  # ]:          0 :             aLangMap[ nItemId ] = rStr;
     225                 :          0 :             ++nItemId;
     226                 :            :         }
     227                 :            :     }
     228 [ #  # ][ #  # ]:          0 :     xPopupMenu->insertItem( MID_LANG_SEL_NONE,  String( FwkResId( STR_LANGSTATUS_NONE )), css::awt::MenuItemStyle::RADIOCHECK, MID_LANG_SEL_NONE );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     229 [ #  # ][ #  # ]:          0 :     if ( aLanguageTable.GetString( LANGUAGE_NONE ) == m_aCurLang )
     230 [ #  # ][ #  # ]:          0 :         xPopupMenu->checkItem( MID_LANG_SEL_NONE, sal_True );
     231                 :            : 
     232 [ #  # ][ #  # ]:          0 :     xPopupMenu->insertItem( MID_LANG_SEL_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), 0, MID_LANG_SEL_RESET );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     233 [ #  # ][ #  # ]:          0 :     xPopupMenu->insertItem( MID_LANG_SEL_MORE,  String( FwkResId( STR_LANGSTATUS_MORE )), 0, MID_LANG_SEL_MORE );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     234                 :            : 
     235                 :            :     // add entries to submenu ('set language for paragraph')
     236                 :          0 :     nItemId = static_cast< sal_Int16 >(MID_LANG_PARA_1);
     237         [ #  # ]:          0 :     for (it = aLangItems.begin(); it != aLangItems.end(); ++it)
     238                 :            :     {
     239                 :          0 :         const OUString & rStr( *it );
     240   [ #  #  #  #  :          0 :         if( rStr != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&&
           #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     241                 :          0 :             rStr != sAsterix &&
     242                 :          0 :             rStr != sEmpty)
     243                 :            :         {
     244                 :            :             DBG_ASSERT( MID_LANG_PARA_1 <= nItemId && nItemId <= MID_LANG_PARA_9,
     245                 :            :                     "nItemId outside of expected range!" );
     246 [ #  # ][ #  # ]:          0 :             subPopupMenu->insertItem( nItemId, rStr, 0, nItemId );
     247         [ #  # ]:          0 :             aLangMap[nItemId] = rStr;
     248                 :          0 :             ++nItemId;
     249                 :            :         }
     250                 :            :     }
     251 [ #  # ][ #  # ]:          0 :     subPopupMenu->insertItem( MID_LANG_PARA_NONE,  String( FwkResId( STR_LANGSTATUS_NONE )), 0, MID_LANG_PARA_NONE );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     252 [ #  # ][ #  # ]:          0 :     subPopupMenu->insertItem( MID_LANG_PARA_RESET, String( FwkResId( STR_RESET_TO_DEFAULT_LANGUAGE )), 0, MID_LANG_PARA_RESET );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     253 [ #  # ][ #  # ]:          0 :     subPopupMenu->insertItem( MID_LANG_PARA_MORE,  String( FwkResId( STR_LANGSTATUS_MORE )), 0, MID_LANG_PARA_MORE );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     254                 :            : 
     255                 :            :     // add last two entries to main menu
     256 [ #  # ][ #  # ]:          0 :     xPopupMenu->insertSeparator( MID_LANG_PARA_SEPERATOR );
     257 [ #  # ][ #  # ]:          0 :     xPopupMenu->insertItem( MID_LANG_PARA_STRING, String( FwkResId( STR_SET_LANGUAGE_FOR_PARAGRAPH )), 0, MID_LANG_PARA_STRING );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     258 [ #  # ][ #  # ]:          0 :     xPopupMenu->setPopupMenu( MID_LANG_PARA_STRING, subPopupMenu );
     259                 :            : 
     260                 :            : 
     261                 :            :     // now display the popup menu and execute every command ...
     262                 :            : 
     263         [ #  # ]:          0 :     Reference< awt::XWindowPeer > xParent( m_xParentWindow, UNO_QUERY );
     264                 :            : 
     265                 :          0 :     com::sun::star::awt::Rectangle aRectangle;
     266         [ #  # ]:          0 :     Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
     267         [ #  # ]:          0 :     const Point mMousePos = pWindow->GetPointerPosPixel();
     268                 :          0 :     aRectangle.X = mMousePos.X();
     269                 :          0 :     aRectangle.Y = mMousePos.Y();
     270 [ #  # ][ #  # ]:          0 :     sal_Int16 nId = xPopupMenu->execute( xParent, aRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 );
     271                 :            :     //click "More..."
     272 [ #  # ][ #  # ]:          0 :     if ( nId && m_xFrame.is() )
                 [ #  # ]
     273                 :            :     {
     274         [ #  # ]:          0 :         uno::Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
     275                 :          0 :         util::URL aURL;
     276                 :            : 
     277 [ #  # ][ #  # ]:          0 :         if (MID_LANG_SEL_1 <= nId && nId <= MID_LANG_SEL_9)
     278                 :            :         {
     279                 :            :             //set selected language as current language for selection
     280 [ #  # ][ #  # ]:          0 :             String aSelectedLang = aLangMap[nId];
     281         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:LanguageStatus?Language:string=Current_"));
     282 [ #  # ][ #  # ]:          0 :             aURL.Complete += aSelectedLang;
     283                 :            :         }
     284         [ #  # ]:          0 :         else if (nId == MID_LANG_SEL_NONE)
     285                 :            :         {
     286                 :            :             //set None as current language for selection
     287         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE"));
     288                 :            :         }
     289         [ #  # ]:          0 :         else if (nId == MID_LANG_SEL_RESET)
     290                 :            :         {
     291                 :            :             // reset language attributes for selection
     292         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES"));
     293                 :            :         }
     294         [ #  # ]:          0 :         else if (nId == MID_LANG_SEL_MORE)
     295                 :            :         {
     296                 :            :             //open the dialog "format/character" for current selection
     297         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FontDialog?Language:string=*"));
     298                 :            :         }
     299 [ #  # ][ #  # ]:          0 :         else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9)
     300                 :            :         {
     301                 :            :             //set selected language for current paragraph
     302 [ #  # ][ #  # ]:          0 :             String aSelectedLang = aLangMap[nId];
     303         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:LanguageStatus?Language:string=Paragraph_"));
     304 [ #  # ][ #  # ]:          0 :             aURL.Complete += aSelectedLang;
     305                 :            :         }
     306         [ #  # ]:          0 :         else if (nId == MID_LANG_PARA_NONE)
     307                 :            :         {
     308                 :            :             //set None as language for current paragraph
     309         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE"));
     310                 :            :         }
     311         [ #  # ]:          0 :         else if (nId == MID_LANG_PARA_RESET)
     312                 :            :         {
     313                 :            :             // reset language attributes for paragraph
     314         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES"));
     315                 :            :         }
     316         [ #  # ]:          0 :         else if (nId == MID_LANG_PARA_MORE)
     317                 :            :         {
     318                 :            :             //open the dialog "format/character" for current paragraph
     319         [ #  # ]:          0 :             aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FontDialogForParagraph"));
     320                 :            :         }
     321                 :            : 
     322 [ #  # ][ #  # ]:          0 :         uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(::comphelper::ComponentContext(m_xServiceManager).getUNOContext()) );
         [ #  # ][ #  # ]
     323 [ #  # ][ #  # ]:          0 :         xURLTransformer->parseStrict( aURL );
     324 [ #  # ][ #  # ]:          0 :         uno::Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, OUString(), 0);
     325         [ #  # ]:          0 :         if( xDispatch.is() )
     326                 :            :         {
     327         [ #  # ]:          0 :             uno::Sequence< beans::PropertyValue > aPV;
     328 [ #  # ][ #  # ]:          0 :             xDispatch->dispatch( aURL, aPV);
                 [ #  # ]
     329                 :          0 :         }
     330         [ #  # ]:          0 :     }
     331                 :            : }
     332                 :            : 
     333                 :          0 : void SAL_CALL LangSelectionStatusbarController::command(
     334                 :            :     const ::com::sun::star::awt::Point& /*aPos*/,
     335                 :            :     ::sal_Int32 nCommand,
     336                 :            :     ::sal_Bool /*bMouseEvent*/,
     337                 :            :     const ::com::sun::star::uno::Any& /*aData*/ )
     338                 :            : throw (::com::sun::star::uno::RuntimeException)
     339                 :            : {
     340                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::command" );
     341         [ #  # ]:          0 :     if ( nCommand & ::awt::Command::CONTEXTMENU )
     342                 :            :     {
     343                 :          0 :         LangMenu();
     344                 :            :     }
     345                 :          0 : }
     346                 :            : 
     347                 :          0 : void SAL_CALL LangSelectionStatusbarController::paint(
     348                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics,
     349                 :            :     const ::com::sun::star::awt::Rectangle& rOutputRectangle,
     350                 :            :     ::sal_Int32 nItemId,
     351                 :            :     ::sal_Int32 nStyle )
     352                 :            : throw (::com::sun::star::uno::RuntimeException)
     353                 :            : {
     354                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::paint" );
     355                 :          0 :     svt::StatusbarController::paint( xGraphics, rOutputRectangle, nItemId, nStyle );
     356                 :          0 : }
     357                 :            : 
     358                 :          0 : void SAL_CALL LangSelectionStatusbarController::click()
     359                 :            : throw (::com::sun::star::uno::RuntimeException)
     360                 :            : {
     361                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::click" );
     362                 :          0 :     LangMenu();
     363                 :          0 : }
     364                 :            : 
     365                 :          0 : void SAL_CALL LangSelectionStatusbarController::doubleClick()
     366                 :            : throw (::com::sun::star::uno::RuntimeException)
     367                 :            : {
     368                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::doubleClick" );
     369                 :          0 :     svt::StatusbarController::doubleClick();
     370                 :          0 : }
     371                 :            : 
     372                 :            : // XStatusListener
     373                 :       1363 : void SAL_CALL LangSelectionStatusbarController::statusChanged( const FeatureStateEvent& Event )
     374                 :            : throw ( RuntimeException )
     375                 :            : {
     376                 :            :     // This function will be called when observed data changes,
     377                 :            :     // for example the selection or keyboard language.
     378                 :            :     // - It displays the language in use in the status bar
     379                 :            :     // - and it stores the relevant data for creating the menu
     380                 :            :     //   at some later point in the member variables
     381                 :            :     //      m_nScriptType, m_aCurLang, m_aKeyboardLang, m_aGuessedText
     382                 :            : 
     383                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "LangSelectionStatusbarController::statusChanged" );
     384         [ +  - ]:       1363 :     SolarMutexGuard aSolarMutexGuard;
     385                 :            : 
     386         [ -  + ]:       1363 :     if ( m_bDisposed )
     387                 :       1363 :         return;
     388                 :            : 
     389                 :       1363 :     m_bShowMenu = sal_True;
     390                 :            : 
     391                 :       1363 :     m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX;  //set the default value
     392         [ +  - ]:       1363 :     Window* pWindow = VCLUnoHelper::GetWindow( m_xParentWindow );
     393 [ +  - ][ +  - ]:       1363 :     if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR && m_nID != 0 )
         [ +  - ][ +  - ]
                 [ +  - ]
     394                 :            :     {
     395                 :       1363 :         OUString               aStrValue;
     396         [ +  - ]:       1363 :         Sequence< OUString > aSeq;
     397                 :            : 
     398                 :       1363 :         StatusBar*    pStatusBar = (StatusBar *)pWindow;
     399         [ -  + ]:       1363 :         if ( Event.State >>= aStrValue )
     400 [ #  # ][ #  # ]:          0 :             pStatusBar->SetItemText( m_nID, aStrValue );
                 [ #  # ]
     401 [ +  - ][ +  + ]:       1363 :         else if ( Event.State >>= aSeq )
     402                 :            :         {
     403         [ +  - ]:        597 :             if ( aSeq.getLength() == 4 )
     404                 :            :             {
     405 [ +  - ][ +  - ]:        597 :                 const String aMultipleLangText( FwkResId( STR_LANGSTATUS_MULTIPLE_LANGUAGES ) );
     406         [ +  - ]:        597 :                 OUString aStatusText = aSeq[0];
     407         [ -  + ]:        597 :                 if ( 0 == aStatusText.compareToAscii( "*" ))
     408         [ #  # ]:          0 :                     aStatusText = aMultipleLangText;
     409 [ +  - ][ +  - ]:        597 :                 pStatusBar->SetItemText( m_nID, aStatusText );
                 [ +  - ]
     410                 :            : 
     411                 :            :                 // Retrieve all other values from the sequence and
     412                 :            :                 // store it members!
     413         [ +  - ]:        597 :                 m_aCurLang      = aSeq[0];
     414         [ +  - ]:        597 :                 m_nScriptType   = static_cast< sal_Int16 >( aSeq[1].toInt32() );
     415         [ +  - ]:        597 :                 m_aKeyboardLang = aSeq[2];
     416 [ +  - ][ +  - ]:        597 :                 m_aGuessedTextLang  = aSeq[3];
     417                 :            :             }
     418                 :            :         }
     419         [ +  - ]:        766 :         else if ( !Event.State.hasValue() )
     420                 :            :         {
     421 [ +  - ][ +  - ]:        766 :             pStatusBar->SetItemText( m_nID, String() );
                 [ +  - ]
     422                 :        766 :             m_bShowMenu = sal_False;    // no language -> no menu
     423         [ +  - ]:       1363 :         }
     424 [ +  - ][ +  - ]:       1363 :     }
     425                 :            : }
     426                 :            : 
     427                 :            : }
     428                 :            : 
     429                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10