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 // XInitialization 55 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); 56 57 // XStatusListener 58 virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); 59 60 // XStatusbarController 61 virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, 62 ::sal_Int32 nCommand, 63 ::sal_Bool bMouseEvent, 64 const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); 65 virtual void SAL_CALL click( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException); 66 67 private: ~LangSelectionStatusbarController()68 virtual ~LangSelectionStatusbarController() {} 69 LangSelectionStatusbarController(LangSelectionStatusbarController &); // not defined 70 void operator =(LangSelectionStatusbarController &); // not defined 71 72 73 sal_Bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text) 74 sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004 75 ::rtl::OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages 76 ::rtl::OUString m_aKeyboardLang; // the keyboard language 77 ::rtl::OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed 78 LanguageGuessingHelper m_aLangGuessHelper; 79 80 void LangMenu( const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException); 81 }; 82 83 } // framework namespace 84 85 #endif // __FRAMEWORK_UIELEMENT_LANGSELECTIONSTATUSBARCONTROLLER_HXX_ 86