22#include <com/sun/star/container/XContentEnumerationAccess.hpp>
23#include <com/sun/star/uno/XComponentContext.hpp>
24#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
25#include <officecfg/Office/Common.hxx>
28#include <osl/mutex.hxx>
47 return "com.sun.star.comp.framework.MacrosMenuController";
61 svt::PopupMenuControllerBase( xContext ),
73 bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
79 resetPopupMenu(rPopupMenu);
80 assert(rPopupMenu->getItemCount() == 0);
83 OUString
aCommand(
".uno:MacroDialog");
86 rPopupMenu->insertItem(2, aDisplayName, 0, 0);
103 if ( m_xPopupMenu.is() )
107 m_xPopupMenu.clear();
114 if ( m_xPopupMenu.is() )
122 static constexpr OUStringLiteral aCmdBase(
u".uno:ScriptOrganizer?ScriptOrganizer.Language:string=");
123 static constexpr OUStringLiteral ellipsis(
u"..." );
124 static constexpr OUStringLiteral providerKey(
u"com.sun.star.script.provider.ScriptProviderFor");
125 sal_uInt16 itemId = startItemId;
127 Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration (
"com.sun.star.script.provider.LanguageScriptProvider" );
129 sal_Int16
nPos = rPopupMenu->getItemCount();
131 while ( xEnum->hasMoreElements() )
134 if ( !( xEnum->nextElement() >>= xServiceInfo ) )
140 for ( OUString
const & serviceName : serviceNames )
142 if ( serviceName.startsWith( providerKey ) )
145 OUString aDisplayName = serviceName.copy( providerKey.getLength() );
146 if( aDisplayName ==
"Java" || aDisplayName ==
"Basic" )
152 aDisplayName += ellipsis;
153 rPopupMenu->insertItem(itemId, aDisplayName, 0,
nPos++);
154 rPopupMenu->setCommand(itemId,
aCommand);
164extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
166 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
PropertiesInfo aProperties
constexpr OUStringLiteral sServiceName
css::uno::Reference< css::lang::XComponent > m_xFrame
css::uno::Reference< css::frame::XDispatch > m_xDispatch
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral SERVICENAME_POPUPMENUCONTROLLER
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetMenuLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)