SvtCommandOptions_Impl::SvtCommandOptions_Impl() // Init baseclasses first
: ConfigItem( ROOTNODE_CMDOPTIONS ) // Init member then...
{ // Get names and values of all accessible menu entries and fill internal structures. // See impl_GetPropertyNames() for further information.
Sequence< OUString > lNames = impl_GetPropertyNames ();
Sequence< Any > lValues = GetProperties ( lNames );
// Safe impossible cases. // We need values from ALL configuration keys. // Follow assignment use order of values in relation to our list of key names!
DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" );
// Copy values from list in right order to our internal member. // Attention: List for names and values have an internal construction pattern!
sal_Int32 nItem = 0;
OUString sCmd;
// Get names/values for disabled commands. for( nItem=0; nItem < lNames.getLength(); ++nItem )
{ // Currently only one value
lValues[nItem] >>= sCmd;
m_aDisabledCommands.AddCommand( sCmd );
}
/*TODO: Not used in the moment! see Notify() ... // Enable notification mechanism of our baseclass.
// We need it to get information about changes outside these class on our used configuration keys! */
Sequence<OUString> aNotifySeq { u"Disabled"_ustr };
EnableNotification( aNotifySeq, true );
}
// destructor
SvtCommandOptions_Impl::~SvtCommandOptions_Impl()
{
assert(!IsModified()); // should have been committed
}
// Safe impossible cases. // We need values from ALL configuration keys. // Follow assignment use order of values in relation to our list of key names!
DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
// Copy values from list in right order to our internal member. // Attention: List for names and values have an internal construction pattern!
sal_Int32 nItem = 0;
OUString sCmd;
m_aDisabledCommands.Clear();
// Get names/values for disabled commands. for( nItem=0; nItem < lNames.getLength(); ++nItem )
{ // Currently only one value
lValues[nItem] >>= sCmd;
m_aDisabledCommands.AddCommand( sCmd );
}
// don't forget to update all existing frames and her might cached dispatch objects! // But look for already killed frames. We hold weak references instead of hard ones ... for (SvtFrameVector::iterator pIt = m_lFrames.begin(); pIt != m_lFrames.end(); )
{
css::uno::Reference< css::frame::XFrame > xFrame(pIt->get(), css::uno::UNO_QUERY); if (xFrame.is())
{
aGuard.unlock(); // because we can call back into ourself
xFrame->contextChanged();
aGuard.lock();
++pIt;
} else
pIt = m_lFrames.erase(pIt);
}
}
// public method
void SvtCommandOptions_Impl::ImplCommit()
{
SAL_WARN("unotools.config","SvtCommandOptions_Impl::ImplCommit(): Not implemented yet!");
}
void SvtCommandOptions_Impl::EstablishFrameCallback(const css::uno::Reference< css::frame::XFrame >& xFrame)
{ // check if frame already exists inside list // ignore double registrations // every frame must be notified one times only!
css::uno::WeakReference< css::frame::XFrame > xWeak(xFrame);
SvtFrameVector::const_iterator pIt = ::std::find(m_lFrames.begin(), m_lFrames.end(), xWeak); if (pIt == m_lFrames.end())
m_lFrames.push_back(xWeak);
}
// private method
Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames()
{ // First get ALL names of current existing list items in configuration!
Sequence< OUString > lDisabledItems = GetNodeNames( u"" SETNODE_DISABLED ""_ustr, utl::ConfigNameFormat::LocalPath );
// Expand all keys for (OUString& rItem : asNonConstRange(lDisabledItems))
rItem = SETNODE_DISABLED PATHDELIMITER + rItem + PATHDELIMITER PROPERTYNAME_CMD;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.