/************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ #ifndef __MISC_HELPER_HXX_ #define __MISC_HELPER_HXX_ #include #include #include #include #include #include #include class SvtLanguageTable; // flags for script types in use within selection #define LS_SCRIPT_LATIN 0x0001 #define LS_SCRIPT_ASIAN 0x0002 #define LS_SCRIPT_COMPLEX 0x0004 namespace framework { // menu ids for language status bar control enum LangMenuIDs { MID_LANG_SEL_1 = 1, // need to start with 1 since xPopupMenu->execute will return 0 if the menu is cancelled MID_LANG_SEL_2, MID_LANG_SEL_3, MID_LANG_SEL_4, MID_LANG_SEL_5, MID_LANG_SEL_6, MID_LANG_SEL_7, MID_LANG_SEL_8, MID_LANG_SEL_9, MID_LANG_SEL_NONE, MID_LANG_SEL_RESET, MID_LANG_SEL_MORE, MID_LANG_PARA_SEPERATOR, MID_LANG_PARA_STRING, MID_LANG_PARA_1, MID_LANG_PARA_2, MID_LANG_PARA_3, MID_LANG_PARA_4, MID_LANG_PARA_5, MID_LANG_PARA_6, MID_LANG_PARA_7, MID_LANG_PARA_8, MID_LANG_PARA_9, MID_LANG_PARA_NONE, MID_LANG_PARA_RESET, MID_LANG_PARA_MORE, }; inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang ) { return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); } class LanguageGuessingHelper { mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; public: LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) : m_xServiceManager(_xServiceManager){} ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const; }; ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory ,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame ,::rtl::OUString& _rModuleIdentifier ,sal_Bool& _rIni ,const sal_Char* _pName); void FillLangItems( std::set< ::rtl::OUString > &rLangItems, const SvtLanguageTable &rLanguageTable, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &rxFrame, const LanguageGuessingHelper & rLangGuessHelper, sal_Int16 nScriptType, const ::rtl::OUString & rCurLang, const ::rtl::OUString & rKeyboardLang, const ::rtl::OUString & rGuessedTextLang ); } // namespace framework #endif // __MISC_HELPER_HXX_