1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ 25 #define __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ 26 27 #include <macros/generic.hxx> 28 #include <macros/xinterface.hxx> 29 #include <macros/xtypeprovider.hxx> 30 #include <macros/xserviceinfo.hxx> 31 #include <stdtypes.h> 32 #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> 33 #include <svtools/statusbarcontroller.hxx> 34 #include <rtl/ustring.hxx> 35 36 #include "helper/mischelper.hxx" 37 38 #include <set> 39 40 class SvtLanguageTable; 41 42 43 // component helper namespace 44 namespace framework { 45 46 class LangSelectionStatusbarController : public svt::StatusbarController 47 { 48 public: 49 explicit LangSelectionStatusbarController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); 50 51 // XServiceInfo 52 DECLARE_XSERVICEINFO 53 54 // XInterface 55 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); 56 virtual void SAL_CALL acquire() throw (); 57 virtual void SAL_CALL release() throw (); 58 59 // XInitialization 60 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); 61 62 // XComponent 63 virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); 64 65 // XEventListener 66 virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& Source ) throw ( ::com::sun::star::uno::RuntimeException ); 67 68 // XStatusListener 69 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); 70 71 // XStatusbarController 72 virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); 73 virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); 74 virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); 75 virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, 76 ::sal_Int32 nCommand, 77 ::sal_Bool bMouseEvent, 78 const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); 79 virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, 80 const ::com::sun::star::awt::Rectangle& rOutputRectangle, 81 ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); 82 virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); 83 virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); 84 85 private: 86 virtual ~LangSelectionStatusbarController() {} 87 LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined 88 void operator =(LangSelectionStatusbarController &); // not defined 89 90 91 sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text) 92 sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004 93 ::rtl::OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages 94 ::rtl::OUString m_aKeyboardLang; // the keyboard language 95 ::rtl::OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed 96 LanguageGuessingHelper m_aLangGuessHelper; 97 98 void LangMenu() throw (::com::sun::star::uno::RuntimeException); 99 }; 100 101 } // framework namespace 102 103 #endif // __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ 104