26#include <com/sun/star/uno/Any.hxx>
27#include <com/sun/star/uno/Sequence.hxx>
28#include <com/sun/star/frame/XFrame.hpp>
34#include <unordered_map>
42#define PATHDELIMITER "/"
44#define SETNODE_DISABLED "Disabled"
46#define PROPERTYNAME_CMD "Command"
60 m_aCommandHashMap.clear();
63 bool HasEntries()
const
65 return ( !m_aCommandHashMap.empty() );
68 bool Lookup(
const OUString& aCmd )
const
70 CommandHashMap::const_iterator pEntry = m_aCommandHashMap.find( aCmd );
71 return ( pEntry != m_aCommandHashMap.end() );
74 void AddCommand(
const OUString& aCmd )
76 m_aCommandHashMap.emplace( aCmd, 0 );
80 typedef std::unordered_map<OUString, sal_Int32>
89 return theCommandOptionsMutex;
94typedef ::std::vector< css::uno::WeakReference< css::frame::XFrame > >
SvtFrameVector;
155 Sequence< Any > lValues = GetProperties ( lNames );
160 DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()),
"SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" );
168 for( nItem=0; nItem < lNames.getLength(); ++nItem )
171 lValues[nItem] >>= sCmd;
178 Sequence<OUString> aNotifySeq {
"Disabled" };
179 EnableNotification( aNotifySeq,
true );
186 assert(!IsModified());
196 Sequence< Any > lValues = GetProperties ( lNames );
201 DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()),
"SvtCommandOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
211 for( nItem=0; nItem < lNames.getLength(); ++nItem )
214 lValues[nItem] >>= sCmd;
222 css::uno::Reference< css::frame::XFrame >
xFrame(pIt->get(), css::uno::UNO_QUERY);
237 SAL_WARN(
"unotools.config",
"SvtCommandOptions_Impl::ImplCommit(): Not implemented yet!");
261 css::uno::WeakReference< css::frame::XFrame > xWeak(
xFrame);
262 SvtFrameVector::const_iterator pIt = ::std::find(
m_lFrames.begin(),
m_lFrames.end(), xWeak);
275 for (OUString& rItem : asNonConstRange(lDisabledItems))
279 return lDisabledItems;
284std::weak_ptr<SvtCommandOptions_Impl> g_pCommandOptions;
293 m_pImpl = g_pCommandOptions.lock();
296 m_pImpl = std::make_shared<SvtCommandOptions_Impl>();
316 return m_pImpl->HasEntriesDisabled();
324 return m_pImpl->LookupDisabled( aCommandURL );
static void holdConfigItem(EItem eItem)
virtual void Notify(const Sequence< OUString > &lPropertyNames) override
SvtCmdOptions m_aDisabledCommands
virtual void ImplCommit() override
virtual ~SvtCommandOptions_Impl() override
bool HasEntriesDisabled() const
Sequence< OUString > impl_GetPropertyNames()
void EstablishFrameCallback(const css::uno::Reference< css::frame::XFrame > &xFrame)
bool LookupDisabled(const OUString &) const
bool LookupDisabled(const OUString &aCommandURL) const
bool HasEntriesDisabled() const
virtual ~SvtCommandOptions() override
std::shared_ptr< SvtCommandOptions_Impl > m_pImpl
void EstablishFrameCallback(const css::uno::Reference< css::frame::XFrame > &xFrame)
constexpr OUStringLiteral ROOTNODE_CMDOPTIONS
::std::vector< css::uno::WeakReference< css::frame::XFrame > > SvtFrameVector
#define DBG_ASSERT(sCon, aError)
static std::mutex & GetOwnStaticMutex()
std::unordered_map< sal_Int16, sal_Int16 > CommandHashMap
#define SAL_WARN(area, stream)
Reference< XFrame > xFrame