26#include <com/sun/star/awt/MenuItemStyle.hpp>
27#include <com/sun/star/beans/PropertyValue.hpp>
28#include <com/sun/star/frame/XDispatchProvider.hpp>
29#include <com/sun/star/view/XPrintable.hpp>
30#include <com/sun/star/util/XURLTransformer.hpp>
38#include <osl/mutex.hxx>
56 return "com.sun.star.comp.framework.FontSizeMenuController";
70 svt::PopupMenuControllerBase( xContext )
81 OUString aPrinterName;
89 if ( xPrintable.is() )
92 for ( PropertyValue
const & prop : aPrinterSeq )
94 if ( prop.Name ==
"Name" )
96 prop.Value >>= aPrinterName;
111 sal_uInt16 nChecked = 0;
112 sal_uInt16 nItemCount = rPopupMenu->getItemCount();
113 for( sal_uInt16
i = 0;
i < nItemCount;
i++ )
115 sal_uInt16 nItemId = rPopupMenu->getItemId(
i );
119 rPopupMenu->checkItem( nItemId,
true );
123 if ( rPopupMenu->isItemChecked( nItemId ) )
128 rPopupMenu->checkItem( nChecked,
false );
134 resetPopupMenu( rPopupMenu );
136 std::unique_ptr<FontList> pFontList;
138 OUString aPrinterName;
144 if ( !aPrinterName.isEmpty() )
147 if ( pInfoPrinter && pInfoPrinter->GetFontFaceCollectionCount() > 0 )
148 pFontList.reset(
new FontList( pInfoPrinter.
get() ));
158 static constexpr OUStringLiteral aFontHeightCommand(
u".uno:FontHeight?FontHeight.Height:float=" );
164 if (!aFontSizeNames.IsEmpty())
167 sal_Int32
nCount = aFontSizeNames.Count();
170 OUString aSizeName = aFontSizeNames.GetIndexName(
i );
171 sal_Int32 nSize = aFontSizeNames.GetIndexSize(
i );
173 rPopupMenu->insertItem(
nPos + 1, aSizeName, css::awt::MenuItemStyle::RADIOCHECK | css::awt::MenuItemStyle::AUTOCHECK,
nPos);
176 float fPoint = float(nSize) / 10;
177 aCommand = aFontHeightCommand + OUString::number( fPoint );
187 const int* pTempAry = pAry;
191 rPopupMenu->insertItem(
nPos + 1, rI18nHelper.
GetNum(*pTempAry, 1,
true,
false),
192 css::awt::MenuItemStyle::RADIOCHECK | css::awt::MenuItemStyle::AUTOCHECK,
nPos);
195 float fPoint = float(*pTempAry) / 10;
196 aCommand = aFontHeightCommand + OUString::number( fPoint );
215 if ( m_xPopupMenu.is() )
217 m_xPopupMenu.clear();
223 css::awt::FontDescriptor aFontDescriptor;
224 css::frame::status::FontHeight aFontHeight;
226 if ( Event.State >>= aFontDescriptor )
230 if ( m_xPopupMenu.is() )
233 else if ( Event.State >>= aFontHeight )
238 if ( m_xPopupMenu.is() )
261 throwIfDisposed(aLock);
275 svt::PopupMenuControllerBase::updatePopupMenu();
279extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
281 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 OutputDevice * GetDefaultDevice()
static const AllSettings & GetSettings()
static const int * GetStdSizeAry()
void disposeAndReset(reference_type *pBody)
reference_type * get() const
OUString GetNum(tools::Long nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
Reference< XDispatch > xDispatch
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral SERVICENAME_POPUPMENUCONTROLLER
Reference< XController > xController