GlobalEventConfig_Impl::GlobalEventConfig_Impl()
: ConfigItem( u"Office.Events/ApplicationEvents"_ustr, ConfigItemMode::NONE )
{ // the supported event names for (const GlobalEventId id : o3tl::enumrange<GlobalEventId>())
m_supportedEvents[id] = pEventAsciiNames[id];
initBindingInfo();
/*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"Events"_ustr };
EnableNotification( aNotifySeq, true );
}
// destructor
GlobalEventConfig_Impl::~GlobalEventConfig_Impl()
{
assert(!IsModified()); // should have been committed
}
void GlobalEventConfig_Impl::ImplCommit()
{ //DF need to check it this is correct??
SAL_INFO("unotools", "In GlobalEventConfig_Impl::ImplCommit"); // clear the existing nodes
ClearNodeSet( u"" SETNODE_BINDINGS ""_ustr );
OUString sNode; //step through the list of events for(constauto& rEntry : m_eventBindingHash)
{ //no point in writing out empty bindings! if(rEntry.second.isEmpty() ) continue;
sNode = SETNODE_BINDINGS PATHDELIMITER "BindingType['" +
rEntry.first + "']" PATHDELIMITER PROPERTYNAME_BINDINGURL;
SAL_INFO("unotools", "writing binding for: " << sNode); //write the data to the registry
SetSetProperties(u"" SETNODE_BINDINGS ""_ustr,{ comphelper::makePropertyValue(sNode, rEntry.second) });
}
}
// private method
void GlobalEventConfig_Impl::initBindingInfo()
{ // Get ALL names of current existing list items in configuration! const Sequence< OUString > lEventNames = GetNodeNames( u"" SETNODE_BINDINGS ""_ustr, utl::ConfigNameFormat::LocalPath );
// never accessed before - is it supported in general?
SupportedEventsVector::iterator pos = ::std::find(
m_supportedEvents.begin(), m_supportedEvents.end(), aName ); return pos != m_supportedEvents.end();
}
Type const & GlobalEventConfig_Impl::getElementType( )
{ //DF definitely not sure about this?? return cppu::UnoType<Sequence<beans::PropertyValue>>::get();
}
GlobalEventConfig::GlobalEventConfig()
{ // Global access, must be guarded (multithreading!).
std::unique_lock aGuard( GetOwnStaticMutex() ); // Increase our refcount ...
++m_nRefCount; // ... and initialize our data container only if it not already exist! if( m_pImpl == nullptr )
{
m_pImpl = new GlobalEventConfig_Impl;
aGuard.unlock();
ItemHolder1::holdConfigItem(EItem::EventConfig);
}
}
GlobalEventConfig::~GlobalEventConfig()
{ // Global access, must be guarded (multithreading!)
std::unique_lock aGuard( GetOwnStaticMutex() ); // Decrease our refcount.
--m_nRefCount; // If last instance was deleted ... // we must destroy our static data container! if( m_nRefCount <= 0 )
{ delete m_pImpl;
m_pImpl = nullptr;
}
}
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.