24#include <com/sun/star/awt/MenuItemStyle.hpp>
25#include <com/sun/star/frame/XDispatchProvider.hpp>
26#include <com/sun/star/frame/XFrame.hpp>
27#include <com/sun/star/util/XURLTransformer.hpp>
34#include <osl/mutex.hxx>
40using namespace css::uno;
41using namespace css::lang;
42using namespace css::frame;
43using namespace css::beans;
44using namespace css::util;
59 return "com.sun.star.comp.framework.FontMenuController";
73 svt::PopupMenuControllerBase( xContext )
86 resetPopupMenu( rPopupMenu );
88 std::vector<OUString> aVector;
89 aVector.reserve(rFontNameSeq.getLength());
90 for ( OUString
const & s : rFontNameSeq )
96 static constexpr OUStringLiteral aFontNameCommandPrefix(
u".uno:CharFontName?CharFontName.FamilyName:string=" );
97 const sal_Int16
nCount =
static_cast<sal_Int16
>(aVector.size());
100 const OUString& rName = aVector[
i];
101 m_xPopupMenu->insertItem(
i+1, rName, css::awt::MenuItemStyle::RADIOCHECK | css::awt::MenuItemStyle::AUTOCHECK,
i );
103 m_xPopupMenu->checkItem(
i+1,
true );
105 m_xPopupMenu->setCommand(
i + 1, aFontNameCommand);
112 Reference< css::awt::XMenuListener > xHolder(
this);
119 if ( m_xPopupMenu.is() )
120 m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(
this) );
121 m_xPopupMenu.clear();
127 css::awt::FontDescriptor aFontDescriptor;
128 Sequence< OUString > aFontNameSeq;
130 if ( Event.State >>= aFontDescriptor )
135 else if ( Event.State >>= aFontNameSeq )
138 if ( m_xPopupMenu.is() )
148 if ( !m_xPopupMenu.is() )
152 sal_uInt16 nChecked = 0;
153 sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
154 for( sal_uInt16
i = 0;
i < nItemCount;
i++ )
156 sal_uInt16 nItemId = m_xPopupMenu->getItemId(
i );
158 if ( m_xPopupMenu->isItemChecked( nItemId ) )
161 OUString aText = m_xPopupMenu->getItemText( nItemId );
164 sal_Int32
nIndex = aText.indexOf(
'~' );
166 aText = aText.replaceAt(
nIndex, 1,
u"" );
171 m_xPopupMenu->checkItem( nItemId,
true );
177 m_xPopupMenu->checkItem( nChecked,
false );
183 Reference< XDispatchProvider > xDispatchProvider(
m_xFrame, UNO_QUERY );
194 svt::PopupMenuControllerBase::updatePopupMenu();
212extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
214 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
const vcl::I18nHelper & GetUILocaleI18nHelper() const
static const AllSettings & GetSettings()
static OUString encode(std::u16string_view rText, Part ePart, EncodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
static OUString EraseAllMnemonicChars(const OUString &rStr)
sal_Int32 CompareString(const OUString &rStr1, const OUString &rStr2) const
Reference< XDispatch > xDispatch
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral SERVICENAME_POPUPMENUCONTROLLER