1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ 29 #define __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ 30 31 #include <macros/generic.hxx> 32 #include <macros/xinterface.hxx> 33 #include <macros/xtypeprovider.hxx> 34 #include <macros/xserviceinfo.hxx> 35 #include <stdtypes.h> 36 #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> 37 #include <svtools/statusbarcontroller.hxx> 38 #include <rtl/ustring.hxx> 39 40 #include "helper/mischelper.hxx" 41 42 #include <set> 43 44 class SvtLanguageTable; 45 46 47 // component helper namespace 48 namespace framework { 49 50 class LangSelectionStatusbarController : public svt::StatusbarController 51 { 52 public: 53 explicit LangSelectionStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 54 55 // XServiceInfo 56 DECLARE_XSERVICEINFO 57 58 // XInterface 59 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); 60 virtual void SAL_CALL acquire() throw (); 61 virtual void SAL_CALL release() throw (); 62 63 // XInitialization 64 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 65 66 // XComponent 67 virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); 68 69 // XEventListener 70 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); 71 72 // XStatusListener 73 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); 74 75 // XStatusbarController 76 virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); 77 virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); 78 virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); 79 virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, 80 ::sal_Int32 nCommand, 81 ::sal_Bool bMouseEvent, 82 const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); 83 virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, 84 const ::com::sun::star::awt::Rectangle& rOutputRectangle, 85 ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); 86 virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); 87 virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); 88 89 private: 90 virtual ~LangSelectionStatusbarController() {} 91 LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined 92 void operator =(LangSelectionStatusbarController &); // not defined 93 94 95 sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text) 96 sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004 97 ::rtl::OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages 98 ::rtl::OUString m_aKeyboardLang; // the keyboard language 99 ::rtl::OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed 100 LanguageGuessingHelper m_aLangGuessHelper; 101 102 void LangMenu() throw (::com::sun::star::uno::RuntimeException); 103 }; 104 105 } // framework namespace 106 107 #endif // __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ 108