24#include <com/sun/star/awt/MenuItemStyle.hpp>
25#include <com/sun/star/frame/XDispatchProvider.hpp>
26#include <com/sun/star/util/XURLTransformer.hpp>
38#include <osl/mutex.hxx>
60 return "com.sun.star.comp.framework.LanguageSelectionMenuController";
75 :
svt::PopupMenuControllerBase(xContext)
78 , m_aLangGuessHelper(xContext)
96 if ( m_xPopupMenu.is() )
110 m_nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
114 if ( Event.State >>=
aSeq )
116 if (
aSeq.getLength() == 4 )
126 else if ( !Event.State.hasValue() )
164 resetPopupMenu( rPopupMenu );
168 OUString aCmd_Dialog;
169 OUString aCmd_Language;
172 aCmd_Dialog +=
".uno:FontDialog?Page:string=font";
173 aCmd_Language +=
".uno:LanguageStatus?Language:string=Current_";
177 aCmd_Dialog +=
".uno:FontDialogForParagraph";
178 aCmd_Language +=
".uno:LanguageStatus?Language:string=Paragraph_";
182 aCmd_Dialog +=
".uno:LanguageStatus?Language:string=*";
183 aCmd_Language +=
".uno:LanguageStatus?Language:string=Default_";
187 std::set< OUString > aLangItems;
194 sal_Int16 nItemId = 0;
195 static constexpr OUStringLiteral sAsterisk(
u"*");
197 for (
auto const& langItem : aLangItems)
199 if (langItem !=
sNone &&
200 langItem != sAsterisk &&
204 rPopupMenu->insertItem(nItemId, langItem, css::awt::MenuItemStyle::CHECKABLE, nItemId - 1);
205 OUString aCmd = aCmd_Language + langItem;
206 rPopupMenu->setCommand(nItemId, aCmd);
209 rPopupMenu->checkItem(nItemId, bChecked);
215 rPopupMenu->insertItem(nItemId,
FwkResId(STR_LANGSTATUS_NONE), 0, nItemId - 1);
216 OUString aCmd = aCmd_Language +
"LANGUAGE_NONE";
217 rPopupMenu->setCommand(nItemId, aCmd);
221 rPopupMenu->insertItem(nItemId,
FwkResId(STR_RESET_TO_DEFAULT_LANGUAGE), 0, nItemId - 1);
222 aCmd = aCmd_Language +
"RESET_LANGUAGES";
223 rPopupMenu->setCommand(nItemId, aCmd);
227 rPopupMenu->insertItem(nItemId,
FwkResId(STR_LANGSTATUS_MORE), 0, nItemId - 1);
228 rPopupMenu->setCommand(nItemId, aCmd_Dialog);
233 svt::PopupMenuControllerBase::updatePopupMenu();
251 if ( m_aCommandURL ==
".uno:SetLanguageSelectionMenu" )
255 else if ( m_aCommandURL ==
".uno:SetLanguageParagraphMenu" )
259 else if ( m_aCommandURL ==
".uno:SetLanguageAllTextMenu" )
268 bool bInitialized( m_bInitialized );
271 svt::PopupMenuControllerBase::initializeImpl(rGuard,
aArguments);
273 if ( m_bInitialized )
285extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
287 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
constexpr OUStringLiteral sServiceName
css::uno::Reference< css::lang::XComponent > m_xFrame
css::uno::Reference< css::frame::XDispatch > m_xDispatch
static OUString GetLanguageString(const LanguageType eType)
Reference< XDispatch > xDispatch
OUString FwkResId(TranslateId aId)
Sequence< PropertyValue > aArguments
Sequence< sal_Int8 > aSeq
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral SERVICENAME_POPUPMENUCONTROLLER
void FillLangItems(std::set< OUString > &rLangItems, const uno::Reference< frame::XFrame > &rxFrame, const LanguageGuessingHelper &rLangGuessHelper, SvtScriptType nScriptType, const OUString &rCurLang, const OUString &rKeyboardLang, const OUString &rGuessedTextLang)
constexpr OUStringLiteral sNone