diff options
Diffstat (limited to 'filter/source/config')
67 files changed, 1499 insertions, 783 deletions
diff --git a/filter/source/config/cache/basecontainer.cxx b/filter/source/config/cache/basecontainer.cxx index 10dd76d82d3e..fe05d7f5ba2b 100644 --- a/filter/source/config/cache/basecontainer.cxx +++ b/filter/source/config/cache/basecontainer.cxx @@ -21,21 +21,16 @@ #include "basecontainer.hxx" #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> -#include <com/sun/star/document/FilterConfigRefresh.hpp> #include <com/sun/star/uno/Type.h> #include <comphelper/enumhelper.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/supportsservice.hxx> #include <osl/diagnose.h> -#define LOAD_IMPLICIT - namespace filter::config{ BaseContainer::BaseContainer() - : BaseLock ( ) - , m_eType() - , m_lListener (m_aLock) + : m_eType() { GetTheFilterCache().load(FilterCache::E_CONTAINS_STANDARD); } @@ -46,28 +41,22 @@ BaseContainer::~BaseContainer() } -void BaseContainer::init(const css::uno::Reference< css::uno::XComponentContext >& rxContext , - const OUString& sImplementationName, +void BaseContainer::init(const OUString& sImplementationName, const css::uno::Sequence< OUString >& lServiceNames , FilterCache::EItemType eType ) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); m_sImplementationName = sImplementationName; m_lServiceNames = lServiceNames ; m_eType = eType ; - m_xRefreshBroadcaster = css::document::FilterConfigRefresh::create(rxContext); // <- SAFE } -void BaseContainer::impl_loadOnDemand() +void BaseContainer::impl_loadOnDemand(std::unique_lock<std::mutex>& /*rGuard*/) { -#ifdef LOAD_IMPLICIT - // SAFE -> - osl::MutexGuard aLock(m_aLock); - // A generic container needs all items of a set of our cache! // Of course it can block for a while, till the cache is really filled. // Note: don't load all sets supported by the cache here! @@ -93,33 +82,25 @@ void BaseContainer::impl_loadOnDemand() } GetTheFilterCache().load(eRequiredState); - // <- SAFE -#endif } -void BaseContainer::impl_initFlushMode() +void BaseContainer::impl_initFlushMode(std::unique_lock<std::mutex>& /*rGuard*/) { - // SAFE -> - osl::MutexGuard aLock(m_aLock); if (!m_pFlushCache) m_pFlushCache = GetTheFilterCache().clone(); if (!m_pFlushCache) throw css::uno::RuntimeException( "Can not create write copy of internal used cache on demand.", - static_cast< OWeakObject* >(this)); - // <- SAFE + getXWeak()); } -FilterCache* BaseContainer::impl_getWorkingCache() const +FilterCache* BaseContainer::impl_getWorkingCache(std::unique_lock<std::mutex>& /*rGuard*/) const { - // SAFE -> - osl::MutexGuard aLock(m_aLock); if (m_pFlushCache) return m_pFlushCache.get(); else return &GetTheFilterCache(); - // <- SAFE } @@ -158,15 +139,15 @@ void SAL_CALL BaseContainer::insertByName(const OUString& sItem , throw css::lang::IllegalArgumentException(ex.Message, static_cast< css::container::XNameContainer* >(this), 2); } - impl_loadOnDemand(); - // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); // create write copy of used cache on demand ... - impl_initFlushMode(); + impl_initFlushMode(aLock); - FilterCache* pCache = impl_getWorkingCache(); + FilterCache* pCache = impl_getWorkingCache(aLock); if (pCache->hasItem(m_eType, sItem)) throw css::container::ElementExistException(OUString(), static_cast< css::container::XNameContainer* >(this)); pCache->setItem(m_eType, sItem, aItem); @@ -176,15 +157,15 @@ void SAL_CALL BaseContainer::insertByName(const OUString& sItem , void SAL_CALL BaseContainer::removeByName(const OUString& sItem) { - impl_loadOnDemand(); - // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); // create write copy of used cache on demand ... - impl_initFlushMode(); + impl_initFlushMode(aLock); - FilterCache* pCache = impl_getWorkingCache(); + FilterCache* pCache = impl_getWorkingCache(aLock); pCache->removeItem(m_eType, sItem); // throw exceptions automatically // <- SAFE ---------------------------------- } @@ -208,15 +189,15 @@ void SAL_CALL BaseContainer::replaceByName(const OUString& sItem , throw css::lang::IllegalArgumentException(ex.Message, static_cast< css::container::XNameContainer* >(this), 2); } - impl_loadOnDemand(); - // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); // create write copy of used cache on demand ... - impl_initFlushMode(); + impl_initFlushMode(aLock); - FilterCache* pCache = impl_getWorkingCache(); + FilterCache* pCache = impl_getWorkingCache(aLock); if (!pCache->hasItem(m_eType, sItem)) throw css::container::NoSuchElementException(OUString(), static_cast< css::container::XNameContainer* >(this)); pCache->setItem(m_eType, sItem, aItem); @@ -232,17 +213,15 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const OUString& sItem) css::uno::Any aValue; - impl_loadOnDemand(); - // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); - CacheItem aItem; try { - FilterCache* pCache = impl_getWorkingCache(); - aItem = pCache->getItem(m_eType, sItem); - pCache->addStatePropsToItem(m_eType, sItem, aItem); // add implicit props "Finalized"/"Mandatory" + FilterCache* pCache = impl_getWorkingCache(aLock); + aValue = pCache->getItemWithStateProps(m_eType, sItem); } catch(const css::container::NoSuchElementException&) { @@ -251,10 +230,8 @@ css::uno::Any SAL_CALL BaseContainer::getByName(const OUString& sItem) catch(const css::uno::Exception&) { // TODO invalid cache!? How should it be handled right? - aItem.clear(); } - aValue <<= aItem.getAsPackedPropertyValueList(); // <- SAFE return aValue; @@ -265,14 +242,14 @@ css::uno::Sequence< OUString > SAL_CALL BaseContainer::getElementNames() { css::uno::Sequence< OUString > lNames; - impl_loadOnDemand(); - // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); try { - FilterCache* pCache = impl_getWorkingCache(); + FilterCache* pCache = impl_getWorkingCache(aLock); std::vector<OUString> lKeys = pCache->getItemNames(m_eType); lNames = comphelper::containerToSequence(lKeys); } @@ -292,14 +269,14 @@ sal_Bool SAL_CALL BaseContainer::hasByName(const OUString& sItem) { bool bHasOne = false; - impl_loadOnDemand(); - // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); try { - FilterCache* pCache = impl_getWorkingCache(); + FilterCache* pCache = impl_getWorkingCache(aLock); bHasOne = pCache->hasItem(m_eType, sItem); } catch(const css::uno::Exception&) @@ -326,14 +303,14 @@ sal_Bool SAL_CALL BaseContainer::hasElements() { bool bHasSome = false; - impl_loadOnDemand(); - // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); try { - FilterCache* pCache = impl_getWorkingCache(); + FilterCache* pCache = impl_getWorkingCache(aLock); bHasSome = pCache->hasItems(m_eType); } catch(const css::uno::Exception&) @@ -352,7 +329,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea { OSL_FAIL("not pure virtual ... but not really implemented .-)"); - return new ::comphelper::OEnumerationByName(this, css::uno::Sequence< OUString >()); + return new ::comphelper::OEnumerationByName(this, {}); } @@ -360,21 +337,17 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea { std::vector<OUString> lKeys; - impl_loadOnDemand(); - // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); + + impl_loadOnDemand(aLock); try { - // convert the given properties first to our internal representation - CacheItem lProps; - lProps << lProperties; - // search the key names of all items, where its properties match // the given ones in its minimum - FilterCache* pCache = impl_getWorkingCache(); - lKeys = pCache->getMatchingItemsByProps(m_eType, lProps); + FilterCache* pCache = impl_getWorkingCache(aLock); + lKeys = pCache->getMatchingItemsByProps(m_eType, std::span<const css::beans::NamedValue>( lProperties.getConstArray(), lProperties.getLength() )); } catch(const css::uno::Exception&) { @@ -395,20 +368,19 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL BaseContainer::crea Further its easier to work directly with the return value instead of checking of NULL returns! */ - css::uno::Sequence< OUString > lSubSet = comphelper::containerToSequence(lKeys); - return new ::comphelper::OEnumerationByName(this, lSubSet); + return new ::comphelper::OEnumerationByName(this, std::move(lKeys)); } void SAL_CALL BaseContainer::flush() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); if (!m_pFlushCache) throw css::lang::WrappedTargetRuntimeException( "Can not guarantee cache consistency. Special flush container does not exists!", - static_cast< OWeakObject* >(this), + getXWeak(), css::uno::Any()); try @@ -430,63 +402,30 @@ void SAL_CALL BaseContainer::flush() // later again ... throw css::lang::WrappedTargetRuntimeException( "Flush rejected by internal container.", - static_cast< OWeakObject* >(this), - css::uno::makeAny(ex)); + getXWeak(), + css::uno::Any(ex)); } m_pFlushCache.reset(); - css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster = m_xRefreshBroadcaster; - - aLock.clear(); - // <- SAFE - - if (xRefreshBroadcaster.is()) - xRefreshBroadcaster->refresh(); - - // notify listener outside the lock! - // The used listener helper lives if we live - // and is threadsafe by itself. - // Further it's not a good idea to hold the own lock - // if an outside object is called :-) css::lang::EventObject aSource (static_cast< css::util::XFlushable* >(this)); - comphelper::OInterfaceContainerHelper2* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XFlushListener>::get()); - if (!pContainer) - return; + m_lListener.notifyEach( aLock, &css::util::XFlushListener::flushed, aSource); - comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); - while (pIterator.hasMoreElements()) - { - try - { - // ... this pointer can be interesting to find out, where will be called as listener - // Don't optimize it to a direct iterator cast :-) - css::util::XFlushListener* pListener = static_cast<css::util::XFlushListener*>(pIterator.next()); - pListener->flushed(aSource); - } - catch(const css::uno::Exception&) - { - // ignore any "damaged" flush listener! - // May its remote reference is broken ... - pIterator.remove(); - } - } + // <- SAFE } void SAL_CALL BaseContainer::addFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener) { - // no locks necessary - // used helper lives if we live and is threadsafe by itself ... - m_lListener.addInterface(cppu::UnoType<css::util::XFlushListener>::get(), xListener); + std::unique_lock g(m_aMutex); + m_lListener.addInterface(g, xListener); } void SAL_CALL BaseContainer::removeFlushListener(const css::uno::Reference< css::util::XFlushListener >& xListener) { - // no locks necessary - // used helper lives if we live and is threadsafe by itself ... - m_lListener.removeInterface(cppu::UnoType<css::util::XFlushListener>::get(), xListener); + std::unique_lock g(m_aMutex); + m_lListener.removeInterface(g, xListener); } } // namespace filter::config diff --git a/filter/source/config/cache/basecontainer.hxx b/filter/source/config/cache/basecontainer.hxx index dee054d90731..f1f63b10bc42 100644 --- a/filter/source/config/cache/basecontainer.hxx +++ b/filter/source/config/cache/basecontainer.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainerQuery.hpp> #include <com/sun/star/util/XFlushable.hpp> -#include <comphelper/multicontainer2.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/weakref.hxx> #include <rtl/ustring.hxx> @@ -49,8 +49,7 @@ namespace filter::config { present by this base class!) was full initialized inside our own ctor as first! */ -class BaseContainer : public BaseLock - , public ::cppu::WeakImplHelper< css::lang::XServiceInfo , +class BaseContainer : public ::cppu::WeakImplHelper< css::lang::XServiceInfo , css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess css::container::XContainerQuery , css::util::XFlushable > @@ -59,9 +58,7 @@ class BaseContainer : public BaseLock // member protected: - - // TODO - css::uno::WeakReference< css::util::XRefreshable > m_xRefreshBroadcaster; + mutable std::mutex m_aMutex; /** @short the implementation name of our derived class, which we provide at the interface XServiceInfo of our class... */ @@ -93,7 +90,7 @@ class BaseContainer : public BaseLock FilterCache::EItemType m_eType; /** @short holds all listener, which are registered at this instance. */ - comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener; + comphelper::OInterfaceContainerHelper4<css::util::XFlushListener> m_lListener; // native interface @@ -145,10 +142,9 @@ class BaseContainer : public BaseLock specify, which sub container of the used filter cache must be wrapped by this container interface. */ - void init(const css::uno::Reference< css::uno::XComponentContext >& rxContext , - const OUString& sImplementationName, - const css::uno::Sequence< OUString >& lServiceNames , - FilterCache::EItemType eType ); + void init( const OUString& sImplementationName, + const css::uno::Sequence< OUString >& lServiceNames , + FilterCache::EItemType eType ); // helper @@ -159,7 +155,7 @@ class BaseContainer : public BaseLock /** @short check if the underlying configuration data was already loaded and do it if necessary automatically. */ - void impl_loadOnDemand(); + void impl_loadOnDemand(std::unique_lock<std::mutex>& rGuard); /** @short it creates the global instance m_pFilterCache, which is a copy @@ -171,7 +167,7 @@ class BaseContainer : public BaseLock @throws css::uno::RuntimeException */ - void impl_initFlushMode(); + void impl_initFlushMode(std::unique_lock<std::mutex>& rGuard); /** @short returns a pointer to the current used cache member. @@ -192,7 +188,7 @@ class BaseContainer : public BaseLock aLock.clear(); // after this point p can't b e guaranteed any longer! */ - FilterCache* impl_getWorkingCache() const; + FilterCache* impl_getWorkingCache(std::unique_lock<std::mutex>& rGuard) const; // uno interface diff --git a/filter/source/config/cache/cacheitem.cxx b/filter/source/config/cache/cacheitem.cxx index a406b16ff130..dddb7d464286 100644 --- a/filter/source/config/cache/cacheitem.cxx +++ b/filter/source/config/cache/cacheitem.cxx @@ -40,13 +40,7 @@ CacheItem::CacheItem() void CacheItem::update(const CacheItem& rUpdateItem) { for (auto const& elem : rUpdateItem) - { - iterator pItThis = find(elem.first); - if (pItThis == end()) - (*this)[elem.first] = elem.second; // add new prop - else - pItThis->second = elem.second; // change value of existing prop - } + (*this)[elem.first] = elem.second; } @@ -83,28 +77,35 @@ void CacheItem::validateUINames(const OUString& sActLocale) } -css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList() +css::uno::Sequence< css::beans::PropertyValue > CacheItem::getAsPackedPropertyValueList(bool bFinalized, bool bMandatory) const { sal_Int32 c = static_cast<sal_Int32>(size()); sal_Int32 i = 0; - css::uno::Sequence< css::beans::PropertyValue > lList(c); + css::uno::Sequence< css::beans::PropertyValue > lList(c+2); css::beans::PropertyValue* pList = lList.getArray(); for (const_iterator pProp = begin(); pProp != end() ; ++pProp ) { - const OUString& rName = pProp->first; + const OUString& rName = pProp->first.maString; const css::uno::Any& rValue = pProp->second; if (!rValue.hasValue()) continue; + assert (rName != PROPNAME_FINALIZED && rName != PROPNAME_MANDATORY); pList[i].Name = rName ; pList[i].Value = rValue; ++i; } + pList[i].Name = PROPNAME_FINALIZED ; + pList[i].Value <<= bFinalized; + ++i; + pList[i].Name = PROPNAME_MANDATORY ; + pList[i].Value <<= bMandatory; + ++i; lList.realloc(i); return lList; @@ -122,169 +123,159 @@ static bool isSubSet(const css::uno::Any& aSubSet, return false; } - css::uno::TypeClass aTypeClass = aT1.getTypeClass(); - switch(aTypeClass) + if (aSubSet.hasValue() && aSet.hasValue()) { - - case css::uno::TypeClass_BOOLEAN : - case css::uno::TypeClass_BYTE : - case css::uno::TypeClass_SHORT : - case css::uno::TypeClass_UNSIGNED_SHORT : - case css::uno::TypeClass_LONG : - case css::uno::TypeClass_UNSIGNED_LONG : - case css::uno::TypeClass_HYPER : - case css::uno::TypeClass_UNSIGNED_HYPER : - case css::uno::TypeClass_FLOAT : - case css::uno::TypeClass_DOUBLE : - { - bool bIs = (aSubSet == aSet); - return bIs; - } - - - case css::uno::TypeClass_STRING : + css::uno::TypeClass aTypeClass = aT1.getTypeClass(); + switch(aTypeClass) { - OUString v1; - OUString v2; - if ( - (aSubSet >>= v1) && - (aSet >>= v2) - ) + case css::uno::TypeClass_BOOLEAN : + case css::uno::TypeClass_BYTE : + case css::uno::TypeClass_SHORT : + case css::uno::TypeClass_UNSIGNED_SHORT : + case css::uno::TypeClass_LONG : + case css::uno::TypeClass_UNSIGNED_LONG : + case css::uno::TypeClass_HYPER : + case css::uno::TypeClass_UNSIGNED_HYPER : + case css::uno::TypeClass_FLOAT : + case css::uno::TypeClass_DOUBLE : { - bool bIs = v1 == v2; + bool bIs = (aSubSet == aSet); return bIs; } - } - break; - case css::uno::TypeClass_STRUCT : - { - css::beans::PropertyValue p1; - css::beans::PropertyValue p2; + case css::uno::TypeClass_STRING : + return aSubSet == aSet; + break; - if ( - (aSubSet >>= p1) && - (aSet >>= p2) - ) - { - bool bIs = (p1.Name == p2.Name) && isSubSet(p1.Value, p2.Value); - return bIs; - } - css::beans::NamedValue n1; - css::beans::NamedValue n2; - - if ( - (aSubSet >>= n1) && - (aSet >>= n2) - ) + case css::uno::TypeClass_STRUCT : { - bool bIs = (n1.Name == n2.Name) && isSubSet(n1.Value, n2.Value); - return bIs; - } - } - break; + css::beans::PropertyValue p1; + css::beans::PropertyValue p2; + if ( + (aSubSet >>= p1) && + (aSet >>= p2) + ) + { + bool bIs = (p1.Name == p2.Name) && isSubSet(p1.Value, p2.Value); + return bIs; + } - case css::uno::TypeClass_SEQUENCE : - { - css::uno::Sequence< OUString > uno_s1; - css::uno::Sequence< OUString > uno_s2; - - if ( - (aSubSet >>= uno_s1) && - (aSet >>= uno_s2) - ) - { - std::vector<OUString> stl_s1(comphelper::sequenceToContainer< std::vector<OUString> >(uno_s1)); - std::vector<OUString> stl_s2(comphelper::sequenceToContainer< std::vector<OUString> >(uno_s2)); + css::beans::NamedValue n1; + css::beans::NamedValue n2; - for (auto const& elem : stl_s1) + if ( + (aSubSet >>= n1) && + (aSet >>= n2) + ) { - if (::std::find(stl_s2.begin(), stl_s2.end(), elem) == stl_s2.end()) - { - return false; - } + bool bIs = (n1.Name == n2.Name) && isSubSet(n1.Value, n2.Value); + return bIs; } - return true; } + break; - css::uno::Sequence< css::beans::PropertyValue > uno_p1; - css::uno::Sequence< css::beans::PropertyValue > uno_p2; - if ( - (aSubSet >>= uno_p1) && - (aSet >>= uno_p2) - ) + case css::uno::TypeClass_SEQUENCE : { - ::comphelper::SequenceAsHashMap stl_p1(uno_p1); - ::comphelper::SequenceAsHashMap stl_p2(uno_p2); + css::uno::Sequence< OUString > uno_s1; + css::uno::Sequence< OUString > uno_s2; - for (auto const& elem : stl_p1) + if ( + (aSubSet >>= uno_s1) && + (aSet >>= uno_s2) + ) { - ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_p2.find(elem.first); - if (it2 == stl_p2.end()) - { - return false; - } - if (!isSubSet(elem.second, it2->second)) + auto s2Begin = uno_s2.getConstArray(); + auto s2End = uno_s2.getConstArray() + uno_s2.getLength(); + + for (auto const& elem : uno_s1) { - return false; + if (::std::find(s2Begin, s2End, elem) == s2End) + { + return false; + } } + return true; } - return true; - } - css::uno::Sequence< css::beans::NamedValue > uno_n1; - css::uno::Sequence< css::beans::NamedValue > uno_n2; + css::uno::Sequence< css::beans::PropertyValue > uno_p1; + css::uno::Sequence< css::beans::PropertyValue > uno_p2; - if ( - (aSubSet >>= uno_n1) && - (aSet >>= uno_n2) - ) - { - ::comphelper::SequenceAsHashMap stl_n1(uno_n1); - ::comphelper::SequenceAsHashMap stl_n2(uno_n2); - - for (auto const& elem : stl_n1) + if ( + (aSubSet >>= uno_p1) && + (aSet >>= uno_p2) + ) { - ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_n2.find(elem.first); - if (it2 == stl_n2.end()) + ::comphelper::SequenceAsHashMap stl_p1(uno_p1); + ::comphelper::SequenceAsHashMap stl_p2(uno_p2); + + for (auto const& elem : stl_p1) { - return false; + ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_p2.find(elem.first); + if (it2 == stl_p2.end()) + { + return false; + } + if (!isSubSet(elem.second, it2->second)) + { + return false; + } } - if (!isSubSet(elem.second, it2->second)) + return true; + } + + css::uno::Sequence< css::beans::NamedValue > uno_n1; + css::uno::Sequence< css::beans::NamedValue > uno_n2; + + if ( + (aSubSet >>= uno_n1) && + (aSet >>= uno_n2) + ) + { + ::comphelper::SequenceAsHashMap stl_n1(uno_n1); + ::comphelper::SequenceAsHashMap stl_n2(uno_n2); + + for (auto const& elem : stl_n1) { - return false; + ::comphelper::SequenceAsHashMap::const_iterator it2 = stl_n2.find(elem.first); + if (it2 == stl_n2.end()) + { + return false; + } + if (!isSubSet(elem.second, it2->second)) + { + return false; + } } + return true; } - return true; } + break; + default: break; } - break; - default: break; } - OSL_FAIL("isSubSet() ... this point should not be reached!"); return false; } -bool CacheItem::haveProps(const CacheItem& lProps) const +bool CacheItem::haveProps(std::span< const css::beans::NamedValue > lProps) const { for (auto const& prop : lProps) { // i) one required property does not exist at this item => return false - const_iterator pItThis = find(prop.first); + const_iterator pItThis = find(prop.Name); if (pItThis == end()) { return false; } // ii) one item does not have the right value => return false - if (!isSubSet(prop.second, pItThis->second)) + if (!isSubSet(prop.Value, pItThis->second)) { return false; } @@ -297,7 +288,7 @@ bool CacheItem::haveProps(const CacheItem& lProps) const } -bool CacheItem::dontHaveProps(const CacheItem& lProps) const +bool CacheItem::dontHaveProps(std::span< const css::beans::NamedValue > lProps) const { for (auto const& prop : lProps) { @@ -305,7 +296,7 @@ bool CacheItem::dontHaveProps(const CacheItem& lProps) const // => continue with next one, because // "excluding" means... "don't have it". // And "not exists" matches to "don't have it". - const_iterator pItThis = find(prop.first); + const_iterator pItThis = find(prop.Name); if (pItThis == end()) { continue; @@ -314,7 +305,7 @@ bool CacheItem::dontHaveProps(const CacheItem& lProps) const // ii) one item have the right value => return false // because this item has the requested property... // But we checked for "don't have it" here. - if (isSubSet(prop.second, pItThis->second)) + if (isSubSet(prop.Value, pItThis->second)) { return false; } diff --git a/filter/source/config/cache/cacheitem.hxx b/filter/source/config/cache/cacheitem.hxx index f0c3558da856..9ed263442150 100644 --- a/filter/source/config/cache/cacheitem.hxx +++ b/filter/source/config/cache/cacheitem.hxx @@ -19,30 +19,16 @@ #pragma once +#include <span> #include <unordered_map> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> #include <vector> #include <comphelper/sequenceashashmap.hxx> -#include <osl/mutex.hxx> - namespace filter::config { -/** @short Must be used as first derived base class - to get a full initialized mutex member, - which can be used during the ctor runs too! - */ -struct BaseLock -{ - public: - - // must be mutable to be usable in const environments too! - mutable ::osl::Mutex m_aLock; -}; - - /** @short represent an item of a FilterCache instance. @@ -88,7 +74,7 @@ class CacheItem : public ::comphelper::SequenceAsHashMap @return sal_True if all given properties exists at this item; sal_False otherwise. */ - bool haveProps(const CacheItem& lProps) const; + bool haveProps(std::span< const css::beans::NamedValue > lProps) const; /** @short check, if the given properties don't exist @@ -104,7 +90,7 @@ class CacheItem : public ::comphelper::SequenceAsHashMap @return sal_False if at least on property exists at this item(!); sal_True otherwise. */ - bool dontHaveProps(const CacheItem& lProps) const; + bool dontHaveProps(std::span< const css::beans::NamedValue > lProps) const; /** @short because we know two UIName properties @@ -132,7 +118,7 @@ class CacheItem : public ::comphelper::SequenceAsHashMap as a list of all properties of this cacheitem, where empty properties was removed. */ - css::uno::Sequence< css::beans::PropertyValue > getAsPackedPropertyValueList(); + css::uno::Sequence< css::beans::PropertyValue > getAsPackedPropertyValueList(bool bFinalized, bool bMandatory) const; }; diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx index 9616d7373df1..c613d0549185 100644 --- a/filter/source/config/cache/cacheupdatelistener.cxx +++ b/filter/source/config/cache/cacheupdatelistener.cxx @@ -19,23 +19,23 @@ #include "cacheupdatelistener.hxx" +#include "configflush.hxx" #include <com/sun/star/util/XChangesNotifier.hpp> #include <com/sun/star/util/XRefreshable.hpp> -#include <com/sun/star/document/FilterConfigRefresh.hpp> #include <unotools/configpaths.hxx> #include <rtl/ustring.hxx> #include <comphelper/processfactory.hxx> +#include <utility> namespace filter::config{ CacheUpdateListener::CacheUpdateListener(FilterCache &rFilterCache, - const css::uno::Reference< css::uno::XInterface >& xConfigAccess, + css::uno::Reference< css::uno::XInterface > xConfigAccess, FilterCache::EItemType eConfigType) - : BaseLock() - , m_rCache(rFilterCache) - , m_xConfig(xConfigAccess) + : m_rCache(rFilterCache) + , m_xConfig(std::move(xConfigAccess)) , m_eConfigType(eConfigType) { } @@ -47,9 +47,9 @@ CacheUpdateListener::~CacheUpdateListener() void CacheUpdateListener::startListening() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); - aLock.clear(); + aLock.unlock(); // <- SAFE if (!xNotifier.is()) @@ -63,9 +63,9 @@ void CacheUpdateListener::startListening() void CacheUpdateListener::stopListening() { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); css::uno::Reference< css::util::XChangesNotifier > xNotifier(m_xConfig, css::uno::UNO_QUERY); - aLock.clear(); + aLock.unlock(); // <- SAFE if (!xNotifier.is()) @@ -79,7 +79,7 @@ void CacheUpdateListener::stopListening() void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEvent& aEvent) { // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); // disposed ? if ( ! m_xConfig.is()) @@ -87,7 +87,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven FilterCache::EItemType eType = m_eConfigType; - aLock.clear(); + aLock.unlock(); // <- SAFE std::vector<OUString> lChangedItems; @@ -162,9 +162,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven // notify sfx cache about the changed filter cache .-) if (bNotifyRefresh) { - css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - css::uno::Reference< css::util::XRefreshable > xRefreshBroadcaster = - css::document::FilterConfigRefresh::create(xContext); + rtl::Reference< ConfigFlush > xRefreshBroadcaster = new ConfigFlush(); xRefreshBroadcaster->refresh(); } } @@ -173,7 +171,7 @@ void SAL_CALL CacheUpdateListener::changesOccurred(const css::util::ChangesEven void SAL_CALL CacheUpdateListener::disposing(const css::lang::EventObject& aEvent) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); if (aEvent.Source == m_xConfig) m_xConfig.clear(); // <- SAFE diff --git a/filter/source/config/cache/cacheupdatelistener.hxx b/filter/source/config/cache/cacheupdatelistener.hxx index 9567b3bd3042..3870b9916859 100644 --- a/filter/source/config/cache/cacheupdatelistener.hxx +++ b/filter/source/config/cache/cacheupdatelistener.hxx @@ -21,6 +21,7 @@ #include "filtercache.hxx" #include <com/sun/star/util/XChangesListener.hpp> #include <cppuhelper/implbase.hxx> +#include <mutex> namespace filter::config { @@ -30,14 +31,15 @@ namespace filter::config { global filter cache, if the underlying configuration wa changed by other processes. */ -class CacheUpdateListener : public BaseLock // must be the first one to guarantee right initialized mutex member! - , public ::cppu::WeakImplHelper< css::util::XChangesListener > +class CacheUpdateListener : public ::cppu::WeakImplHelper< css::util::XChangesListener > { // member private: + std::mutex m_aMutex; + /** @short reference to the singleton(!) filter cache implementation, which should be updated by this thread. */ FilterCache &m_rCache; @@ -73,7 +75,7 @@ class CacheUpdateListener : public BaseLock // must be the first one to guarante specify the type of configuration. */ CacheUpdateListener(FilterCache &rFilterCache, - const css::uno::Reference< css::uno::XInterface >& xConfigAccess, + css::uno::Reference< css::uno::XInterface > xConfigAccess, FilterCache::EItemType eConfigType); diff --git a/filter/source/config/cache/configflush.cxx b/filter/source/config/cache/configflush.cxx index 017fd8b19bb1..ed4da6d71185 100644 --- a/filter/source/config/cache/configflush.cxx +++ b/filter/source/config/cache/configflush.cxx @@ -26,8 +26,6 @@ namespace filter::config{ ConfigFlush::ConfigFlush() - : BaseLock ( ) - , m_lListener(m_aLock) { } @@ -58,46 +56,25 @@ void SAL_CALL ConfigFlush::refresh() // and is threadsafe by itself. // Further it's not a good idea to hold the own lock // if an outside object is called :-) - css::lang::EventObject aSource (static_cast< css::util::XRefreshable* >(this)); - comphelper::OInterfaceContainerHelper2* pContainer = m_lListener.getContainer(cppu::UnoType<css::util::XRefreshListener>::get()); - if (!pContainer) + std::unique_lock g(m_aMutex); + if (!m_aRefreshListeners.getLength(g)) return; - - comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer); - while (pIterator.hasMoreElements()) - { - try - { - // ... this pointer can be interesting to find out, where will be called as listener - // Don't optimize it to a direct iterator cast :-) - css::util::XRefreshListener* pListener = static_cast<css::util::XRefreshListener*>(pIterator.next()); - pListener->refreshed(aSource); - } - catch(const css::uno::Exception&) - { - // ignore any "damaged" flush listener! - // May its remote reference is broken ... - pIterator.remove(); - } - } + css::lang::EventObject aSource(static_cast< css::util::XRefreshable* >(this)); + m_aRefreshListeners.notifyEach(g, &css::util::XRefreshListener::refreshed, aSource); } void SAL_CALL ConfigFlush::addRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener) { - // no locks necessary - // used helper lives if we live and is threadsafe by itself ... - m_lListener.addInterface(cppu::UnoType<css::util::XRefreshListener>::get(), - xListener); + std::unique_lock g(m_aMutex); + m_aRefreshListeners.addInterface(g, xListener); } void SAL_CALL ConfigFlush::removeRefreshListener(const css::uno::Reference< css::util::XRefreshListener >& xListener) { - // no locks necessary - // used helper lives if we live and is threadsafe by itself ... - m_lListener.removeInterface(cppu::UnoType<css::util::XRefreshListener>::get(), - xListener); + std::unique_lock g(m_aMutex); + m_aRefreshListeners.removeInterface(g, xListener); } diff --git a/filter/source/config/cache/configflush.hxx b/filter/source/config/cache/configflush.hxx index 20b1c14caae6..ba20c9e9d505 100644 --- a/filter/source/config/cache/configflush.hxx +++ b/filter/source/config/cache/configflush.hxx @@ -18,10 +18,9 @@ */ #pragma once -#include "cacheitem.hxx" #include <com/sun/star/util/XRefreshable.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <comphelper/multicontainer2.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <cppuhelper/implbase.hxx> @@ -34,14 +33,14 @@ namespace filter::config { @descr Such refresh listener will be called in case the type/filter configuration will be changed at runtime. */ -class ConfigFlush final : public BaseLock - , public ::cppu::WeakImplHelper< +class ConfigFlush final : public ::cppu::WeakImplHelper< css::util::XRefreshable, css::lang::XServiceInfo > { - /** @short holds all listener, which are registered at this instance. */ - comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener; + std::mutex m_aMutex; + /** @short holds all listener, which are registered at this instance. */ + comphelper::OInterfaceContainerHelper4<css::util::XRefreshListener> m_aRefreshListeners; // native interface diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx index 6f72bf52fea8..a371fccf406e 100644 --- a/filter/source/config/cache/constant.hxx +++ b/filter/source/config/cache/constant.hxx @@ -18,68 +18,64 @@ */ #pragma once -/* disable impl_loadOnDemand function of BaseContainer for certain - functions, where it the feature "impl_loadItemOnDemand() of class FilterCache - can be used instead of loadAll()!*/ -// #define LOAD_IMPLICIT - +#include <rtl/ustring.hxx> /** @short used to identify a some generic item properties against the configuration API and can be used at all name containers (based on this filtercache) too. */ -inline constexpr OUStringLiteral PROPNAME_NAME = u"Name"; +inline constexpr OUString PROPNAME_NAME = u"Name"_ustr; /** @short used to identify a type item property against the configuration API and can be used at all name containers (based on this filtercache) too. */ -inline constexpr OUStringLiteral PROPNAME_UINAME = u"UIName"; -inline constexpr OUStringLiteral PROPNAME_UINAMES = u"UINames"; -inline constexpr OUStringLiteral PROPNAME_PREFERRED = u"Preferred"; -inline constexpr OUStringLiteral PROPNAME_PREFERREDFILTER = u"PreferredFilter"; -inline constexpr OUStringLiteral PROPNAME_DETECTSERVICE = u"DetectService"; -inline constexpr OUStringLiteral PROPNAME_MEDIATYPE = u"MediaType"; -inline constexpr OUStringLiteral PROPNAME_CLIPBOARDFORMAT = u"ClipboardFormat"; -inline constexpr OUStringLiteral PROPNAME_URLPATTERN = u"URLPattern"; -inline constexpr OUStringLiteral PROPNAME_EXTENSIONS = u"Extensions"; +inline constexpr OUString PROPNAME_UINAME = u"UIName"_ustr; +inline constexpr OUString PROPNAME_UINAMES = u"UINames"_ustr; +inline constexpr OUString PROPNAME_PREFERRED = u"Preferred"_ustr; +inline constexpr OUString PROPNAME_PREFERREDFILTER = u"PreferredFilter"_ustr; +inline constexpr OUString PROPNAME_DETECTSERVICE = u"DetectService"_ustr; +inline constexpr OUString PROPNAME_MEDIATYPE = u"MediaType"_ustr; +inline constexpr OUString PROPNAME_CLIPBOARDFORMAT = u"ClipboardFormat"_ustr; +inline constexpr OUString PROPNAME_URLPATTERN = u"URLPattern"_ustr; +inline constexpr OUString PROPNAME_EXTENSIONS = u"Extensions"_ustr; /** @short used to identify a filter item property against the configuration API and can be used at all name containers (based on this filtercache) too. */ -inline constexpr OUStringLiteral PROPNAME_TYPE = u"Type"; -inline constexpr OUStringLiteral PROPNAME_DOCUMENTSERVICE = u"DocumentService"; -inline constexpr OUStringLiteral PROPNAME_FILTERSERVICE = u"FilterService"; -inline constexpr OUStringLiteral PROPNAME_UICOMPONENT = u"UIComponent"; -inline constexpr OUStringLiteral PROPNAME_FLAGS = u"Flags"; -inline constexpr OUStringLiteral PROPNAME_USERDATA = u"UserData"; -inline constexpr OUStringLiteral PROPNAME_TEMPLATENAME = u"TemplateName"; -inline constexpr OUStringLiteral PROPNAME_FILEFORMATVERSION = u"FileFormatVersion"; -inline constexpr OUStringLiteral PROPNAME_EXPORTEXTENSION = u"ExportExtension"; -inline constexpr OUStringLiteral PROPNAME_ENABLED = u"Enabled"; +inline constexpr OUString PROPNAME_TYPE = u"Type"_ustr; +inline constexpr OUString PROPNAME_DOCUMENTSERVICE = u"DocumentService"_ustr; +inline constexpr OUString PROPNAME_FILTERSERVICE = u"FilterService"_ustr; +inline constexpr OUString PROPNAME_UICOMPONENT = u"UIComponent"_ustr; +inline constexpr OUString PROPNAME_FLAGS = u"Flags"_ustr; +inline constexpr OUString PROPNAME_USERDATA = u"UserData"_ustr; +inline constexpr OUString PROPNAME_TEMPLATENAME = u"TemplateName"_ustr; +inline constexpr OUString PROPNAME_FILEFORMATVERSION = u"FileFormatVersion"_ustr; +inline constexpr OUString PROPNAME_EXPORTEXTENSION = u"ExportExtension"_ustr; +inline constexpr OUString PROPNAME_ENABLED = u"Enabled"_ustr; /** @short used to identify a frame loader or detect service item property against the configuration API and can be used at all name containers (based on this filtercache) too. */ -inline constexpr OUStringLiteral PROPNAME_TYPES = u"Types"; +inline constexpr OUString PROPNAME_TYPES = u"Types"_ustr; /** @short used to identify the list of sorted filters for a specific office module */ -inline constexpr OUStringLiteral PROPNAME_SORTEDFILTERLIST = u"SortedFilterList"; +inline constexpr OUString PROPNAME_SORTEDFILTERLIST = u"SortedFilterList"_ustr; /** @short implicit properties. which are used at the container interface only. */ -inline constexpr OUStringLiteral PROPNAME_FINALIZED = u"Finalized"; -inline constexpr OUStringLiteral PROPNAME_MANDATORY = u"Mandatory"; +inline constexpr OUString PROPNAME_FINALIZED = u"Finalized"_ustr; +inline constexpr OUString PROPNAME_MANDATORY = u"Mandatory"_ustr; /** @short used to identify a set of items against the configuration API. */ -inline constexpr OUStringLiteral CFGSET_TYPES = u"Types"; -inline constexpr OUStringLiteral CFGSET_FILTERS = u"Filters"; -inline constexpr OUStringLiteral CFGSET_FRAMELOADERS = u"FrameLoaders"; -inline constexpr OUStringLiteral CFGSET_CONTENTHANDLERS = u"ContentHandlers"; +inline constexpr OUString CFGSET_TYPES = u"Types"_ustr; +inline constexpr OUString CFGSET_FILTERS = u"Filters"_ustr; +inline constexpr OUString CFGSET_FRAMELOADERS = u"FrameLoaders"_ustr; +inline constexpr OUString CFGSET_CONTENTHANDLERS = u"ContentHandlers"_ustr; /** @short used to address some configuration keys directly. @@ -88,8 +84,8 @@ inline constexpr OUStringLiteral CFGSET_CONTENTHANDLERS = u"ContentHandlers"; @TODO define these direct keys ... */ -inline constexpr OUStringLiteral CFGDIRECTKEY_OFFICELOCALE = u"/org.openoffice.Setup/L10N/ooLocale"; -inline constexpr OUStringLiteral CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openoffice.TypeDetection.Misc/Defaults/DefaultFrameLoader"; +inline constexpr OUString CFGDIRECTKEY_OFFICELOCALE = u"/org.openoffice.Setup/L10N/ooLocale"_ustr; +inline constexpr OUString CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openoffice.TypeDetection.Misc/Defaults/DefaultFrameLoader"_ustr; #define CFGDIRECTKEY_PRODUCTNAME "/org.openoffice.Setup/Product/ooName" // Note that these flag bits have parallel names in @@ -97,55 +93,55 @@ inline constexpr OUStringLiteral CFGDIRECTKEY_DEFAULTFRAMELOADER = u"/org.openof // documentation on their meaning. /** @short names of filter flags, sorted in alphabetical order */ -inline constexpr OUStringLiteral FLAGNAME_3RDPARTYFILTER = u"3RDPARTYFILTER"; -inline constexpr OUStringLiteral FLAGNAME_ALIEN = u"ALIEN"; -inline constexpr OUStringLiteral FLAGNAME_CONSULTSERVICE = u"CONSULTSERVICE"; -inline constexpr OUStringLiteral FLAGNAME_DEFAULT = u"DEFAULT"; -inline constexpr OUStringLiteral FLAGNAME_ENCRYPTION = u"ENCRYPTION"; -inline constexpr OUStringLiteral FLAGNAME_EXPORT = u"EXPORT"; -inline constexpr OUStringLiteral FLAGNAME_GPGENCRYPTION = u"GPGENCRYPTION"; -inline constexpr OUStringLiteral FLAGNAME_IMPORT = u"IMPORT"; -inline constexpr OUStringLiteral FLAGNAME_INTERNAL = u"INTERNAL"; -inline constexpr OUStringLiteral FLAGNAME_NOTINFILEDIALOG = u"NOTINFILEDIALOG"; -inline constexpr OUStringLiteral FLAGNAME_NOTINSTALLED = u"NOTINSTALLED"; -inline constexpr OUStringLiteral FLAGNAME_OWN = u"OWN"; -inline constexpr OUStringLiteral FLAGNAME_PACKED = u"PACKED"; -inline constexpr OUStringLiteral FLAGNAME_PASSWORDTOMODIFY = u"PASSWORDTOMODIFY"; -inline constexpr OUStringLiteral FLAGNAME_PREFERRED = u"PREFERRED"; -inline constexpr OUStringLiteral FLAGNAME_STARTPRESENTATION = u"STARTPRESENTATION"; -inline constexpr OUStringLiteral FLAGNAME_READONLY = u"READONLY"; -inline constexpr OUStringLiteral FLAGNAME_SUPPORTSSELECTION = u"SUPPORTSSELECTION"; -inline constexpr OUStringLiteral FLAGNAME_TEMPLATE = u"TEMPLATE"; -inline constexpr OUStringLiteral FLAGNAME_TEMPLATEPATH = u"TEMPLATEPATH"; -inline constexpr OUStringLiteral FLAGNAME_COMBINED = u"COMBINED"; -inline constexpr OUStringLiteral FLAGNAME_SUPPORTSSIGNING = u"SUPPORTSSIGNING"; -inline constexpr OUStringLiteral FLAGNAME_EXOTIC = u"EXOTIC"; +inline constexpr OUString FLAGNAME_3RDPARTYFILTER = u"3RDPARTYFILTER"_ustr; +inline constexpr OUString FLAGNAME_ALIEN = u"ALIEN"_ustr; +inline constexpr OUString FLAGNAME_CONSULTSERVICE = u"CONSULTSERVICE"_ustr; +inline constexpr OUString FLAGNAME_DEFAULT = u"DEFAULT"_ustr; +inline constexpr OUString FLAGNAME_ENCRYPTION = u"ENCRYPTION"_ustr; +inline constexpr OUString FLAGNAME_EXPORT = u"EXPORT"_ustr; +inline constexpr OUString FLAGNAME_GPGENCRYPTION = u"GPGENCRYPTION"_ustr; +inline constexpr OUString FLAGNAME_IMPORT = u"IMPORT"_ustr; +inline constexpr OUString FLAGNAME_INTERNAL = u"INTERNAL"_ustr; +inline constexpr OUString FLAGNAME_NOTINFILEDIALOG = u"NOTINFILEDIALOG"_ustr; +inline constexpr OUString FLAGNAME_NOTINSTALLED = u"NOTINSTALLED"_ustr; +inline constexpr OUString FLAGNAME_OWN = u"OWN"_ustr; +inline constexpr OUString FLAGNAME_PACKED = u"PACKED"_ustr; +inline constexpr OUString FLAGNAME_PASSWORDTOMODIFY = u"PASSWORDTOMODIFY"_ustr; +inline constexpr OUString FLAGNAME_PREFERRED = u"PREFERRED"_ustr; +inline constexpr OUString FLAGNAME_STARTPRESENTATION = u"STARTPRESENTATION"_ustr; +inline constexpr OUString FLAGNAME_READONLY = u"READONLY"_ustr; +inline constexpr OUString FLAGNAME_SUPPORTSSELECTION = u"SUPPORTSSELECTION"_ustr; +inline constexpr OUString FLAGNAME_TEMPLATE = u"TEMPLATE"_ustr; +inline constexpr OUString FLAGNAME_TEMPLATEPATH = u"TEMPLATEPATH"_ustr; +inline constexpr OUString FLAGNAME_COMBINED = u"COMBINED"_ustr; +inline constexpr OUString FLAGNAME_SUPPORTSSIGNING = u"SUPPORTSSIGNING"_ustr; +inline constexpr OUString FLAGNAME_EXOTIC = u"EXOTIC"_ustr; /** @short some uno service names. */ -inline constexpr OUStringLiteral SERVICE_CONFIGURATIONUPDATEACCESS = u"com.sun.star.configuration.ConfigurationUpdateAccess"; -inline constexpr OUStringLiteral SERVICE_CONFIGURATIONACCESS = u"com.sun.star.configuration.ConfigurationAccess"; +inline constexpr OUString SERVICE_CONFIGURATIONUPDATEACCESS = u"com.sun.star.configuration.ConfigurationUpdateAccess"_ustr; +inline constexpr OUString SERVICE_CONFIGURATIONACCESS = u"com.sun.star.configuration.ConfigurationAccess"_ustr; /** @short some configuration paths. */ -inline constexpr OUStringLiteral CFGPACKAGE_TD_TYPES = u"/org.openoffice.TypeDetection.Types"; -inline constexpr OUStringLiteral CFGPACKAGE_TD_FILTERS = u"/org.openoffice.TypeDetection.Filter"; -inline constexpr OUStringLiteral CFGPACKAGE_TD_OTHERS = u"/org.openoffice.TypeDetection.Misc"; -inline constexpr OUStringLiteral CFGPACKAGE_TD_OLD = u"/org.openoffice.Office.TypeDetection"; +inline constexpr OUString CFGPACKAGE_TD_TYPES = u"/org.openoffice.TypeDetection.Types"_ustr; +inline constexpr OUString CFGPACKAGE_TD_FILTERS = u"/org.openoffice.TypeDetection.Filter"_ustr; +inline constexpr OUString CFGPACKAGE_TD_OTHERS = u"/org.openoffice.TypeDetection.Misc"_ustr; +inline constexpr OUString CFGPACKAGE_TD_OLD = u"/org.openoffice.Office.TypeDetection"_ustr; /** @short some default values. */ -inline constexpr OUStringLiteral DEFAULT_OFFICELOCALE = u"en-US"; +inline constexpr OUString DEFAULT_OFFICELOCALE = u"en-US"_ustr; /** @short used for the queries of the FilterFactory service. */ -inline constexpr OUStringLiteral QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE = u"matchByDocumentService"; -inline constexpr OUStringLiteral QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE = u"getDefaultFilterForType"; -inline constexpr OUStringLiteral QUERY_IDENTIFIER_GET_SORTED_FILTERLIST = u"getSortedFilterList()"; +inline constexpr OUString QUERY_IDENTIFIER_MATCHBYDOCUMENTSERVICE = u"matchByDocumentService"_ustr; +inline constexpr OUString QUERY_IDENTIFIER_GETPREFERREDFILTERFORTYPE = u"getDefaultFilterForType"_ustr; +inline constexpr OUString QUERY_IDENTIFIER_GET_SORTED_FILTERLIST = u"getSortedFilterList()"_ustr; -inline constexpr OUStringLiteral QUERY_PARAM_IFLAGS = u"iflags"; -inline constexpr OUStringLiteral QUERY_PARAM_EFLAGS = u"eflags"; -inline constexpr OUStringLiteral QUERY_PARAM_MODULE = u"module"; +inline constexpr OUString QUERY_PARAM_IFLAGS = u"iflags"_ustr; +inline constexpr OUString QUERY_PARAM_EFLAGS = u"eflags"_ustr; +inline constexpr OUString QUERY_PARAM_MODULE = u"module"_ustr; #define QUERY_CONSTVALUE_ALL "all" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/config/cache/contenthandlerfactory.cxx b/filter/source/config/cache/contenthandlerfactory.cxx index a3bf71cf22ed..f844362b6907 100644 --- a/filter/source/config/cache/contenthandlerfactory.cxx +++ b/filter/source/config/cache/contenthandlerfactory.cxx @@ -29,8 +29,7 @@ namespace filter::config{ ContentHandlerFactory::ContentHandlerFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext) : m_xContext(rxContext) { - BaseContainer::init(rxContext , - "com.sun.star.comp.filter.config.ContentHandlerFactory" , + BaseContainer::init("com.sun.star.comp.filter.config.ContentHandlerFactory" , { "com.sun.star.frame.ContentHandlerFactory" }, FilterCache::E_CONTENTHANDLER ); } @@ -53,7 +52,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea css::uno::Reference< css::uno::XInterface > xHandler; // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); auto & cache = GetTheFilterCache(); @@ -75,7 +74,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ContentHandlerFactory::crea aHandler >> lConfig; ::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer< ::std::vector< css::uno::Any > >(lArguments)); - stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig)); + stlArguments.insert(stlArguments.begin(), css::uno::Any(lConfig)); xInit->initialize(comphelper::containerToSequence(stlArguments)); } diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 0167bddd4f6f..2abf11a5ada9 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -19,7 +19,7 @@ #include <memory> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include "filtercache.hxx" #include "constant.hxx" #include "cacheupdatelistener.hxx" @@ -51,13 +51,13 @@ #include <i18nlangtag/languagetag.hxx> #include <officecfg/Setup.hxx> +#include <o3tl/string_view.hxx> namespace filter::config{ FilterCache::FilterCache() - : BaseLock ( ) - , m_eFillState(E_CONTAINS_NOTHING ) + : m_eFillState(E_CONTAINS_NOTHING ) { int i = 0; OUString sStandardProps[10]; @@ -119,7 +119,7 @@ FilterCache::~FilterCache() std::unique_ptr<FilterCache> FilterCache::clone() const { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); auto pClone = std::make_unique<FilterCache>(); @@ -151,7 +151,7 @@ std::unique_ptr<FilterCache> FilterCache::clone() const void FilterCache::takeOver(const FilterCache& rClone) { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // a) // Don't copy the configuration access points here! @@ -199,7 +199,7 @@ void FilterCache::takeOver(const FilterCache& rClone) void FilterCache::load(EFillState eRequired) { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // check if required fill state is already reached ... // There is nothing to do then. @@ -238,18 +238,18 @@ void FilterCache::load(EFillState eRequired) bool FilterCache::isFillState(FilterCache::EFillState eState) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); return ((m_eFillState & eState) == eState); // <- SAFE } std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eType , - const CacheItem& lIProps, - const CacheItem& lEProps) const + std::span< const css::beans::NamedValue > lIProps, + std::span< const css::beans::NamedValue > lEProps) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -257,6 +257,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp const CacheItemList& rList = impl_getItemList(eType); std::vector<OUString> lKeys; + lKeys.reserve(rList.size()); // search items, which provides all needed properties of set "lIProps" // but not of set "lEProps"! @@ -279,7 +280,7 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp bool FilterCache::hasItems(EItemType eType) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -294,7 +295,7 @@ bool FilterCache::hasItems(EItemType eType) const std::vector<OUString> FilterCache::getItemNames(EItemType eType) const { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -315,7 +316,7 @@ bool FilterCache::hasItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -347,8 +348,17 @@ CacheItem FilterCache::getItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); + CacheItem aItem = impl_getItem(eType, sItem); + // <- SAFE + return aItem; +} + + +CacheItem& FilterCache::impl_getItem( EItemType eType, + const OUString& sItem) +{ // search for right list // An exception is thrown if "eType" is unknown. // => rList will be valid everytimes next line is reached. @@ -389,7 +399,6 @@ CacheItem FilterCache::getItem( EItemType eType, } return pIt->second; - // <- SAFE } @@ -397,7 +406,7 @@ void FilterCache::removeItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -418,7 +427,7 @@ void FilterCache::setItem( EItemType eType , const CacheItem& aValue) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. @@ -445,17 +454,18 @@ void FilterCache::refreshItem( EItemType eType, const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); impl_loadItemOnDemand(eType, sItem); } -void FilterCache::addStatePropsToItem( EItemType eType, - const OUString& sItem, - CacheItem& rItem) +css::uno::Any FilterCache::getItemWithStateProps( EItemType eType, + const OUString& sItem) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); + + const CacheItem& rItem = impl_getItem(eType, sItem); // Note: Opening of the configuration layer throws some exceptions // if it failed. So we mustn't check any reference here... @@ -494,9 +504,8 @@ void FilterCache::addStatePropsToItem( EItemType eType, (sItem == sDefaultFrameLoader ) ) { - rItem[PROPNAME_FINALIZED] <<= true; - rItem[PROPNAME_MANDATORY] <<= true; - return; + css::uno::Sequence aProps = rItem.getAsPackedPropertyValueList(true, true); + return css::uno::Any(aProps); } /* <-- HACK */ @@ -514,17 +523,16 @@ void FilterCache::addStatePropsToItem( EItemType eType, default: break; } + bool bFinalized, bMandatory; try { css::uno::Reference< css::beans::XProperty > xItem; xSet->getByName(sItem) >>= xItem; css::beans::Property aDescription = xItem->getAsProperty(); - bool bFinalized = ((aDescription.Attributes & css::beans::PropertyAttribute::READONLY ) == css::beans::PropertyAttribute::READONLY ); - bool bMandatory = ((aDescription.Attributes & css::beans::PropertyAttribute::REMOVABLE) != css::beans::PropertyAttribute::REMOVABLE); + bFinalized = ((aDescription.Attributes & css::beans::PropertyAttribute::READONLY ) == css::beans::PropertyAttribute::READONLY ); + bMandatory = ((aDescription.Attributes & css::beans::PropertyAttribute::REMOVABLE) != css::beans::PropertyAttribute::REMOVABLE); - rItem[PROPNAME_FINALIZED] <<= bFinalized; - rItem[PROPNAME_MANDATORY] <<= bMandatory; } catch(const css::container::NoSuchElementException&) { @@ -537,10 +545,13 @@ void FilterCache::addStatePropsToItem( EItemType eType, => mark item as FINALIZED / MANDATORY, we don't support writing to the old format */ - rItem[PROPNAME_FINALIZED] <<= true; - rItem[PROPNAME_MANDATORY] <<= true; + bFinalized = true; + bMandatory = true; } + css::uno::Sequence<css::beans::PropertyValue> aProps = rItem.getAsPackedPropertyValueList(bFinalized, bMandatory); + + return css::uno::Any(aProps); // <- SAFE } @@ -559,7 +570,7 @@ void FilterCache::removeStatePropsFromItem(CacheItem& rItem) void FilterCache::flush() { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // renew all dependencies and optimizations impl_validateAndOptimize(); @@ -623,7 +634,7 @@ void FilterCache::impl_flushByList(const css::uno::Reference< css::container::XN CacheItemList::const_iterator pItem = rCache.find(item); impl_saveItem(xItem, eType, pItem->second); - xAddRemoveSet->insertByName(item, css::uno::makeAny(xItem)); + xAddRemoveSet->insertByName(item, css::uno::Any(xItem)); } break; @@ -661,7 +672,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , sExtension = sExtension.toAsciiLowerCase(); // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // i) Step over all well known URL pattern @@ -710,7 +721,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); switch(eType) { @@ -729,7 +740,7 @@ const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const CacheItemList& FilterCache::impl_getItemList(EItemType eType) { // SAFE -> ---------------------------------- - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); switch(eType) { @@ -747,7 +758,7 @@ CacheItemList& FilterCache::impl_getItemList(EItemType eType) css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider) { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); OUString sPath ; css::uno::Reference< css::uno::XInterface >* pConfig = nullptr; @@ -762,7 +773,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig return m_xConfigTypes; sPath = CFGPACKAGE_TD_TYPES; pConfig = &m_xConfigTypes; - sRtlLog = "impl_openconfig(E_PROVIDER_TYPES)"; + sRtlLog = "impl_openconfig(E_PROVIDER_TYPES)"_ostr; } break; @@ -772,7 +783,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig return m_xConfigFilters; sPath = CFGPACKAGE_TD_FILTERS; pConfig = &m_xConfigFilters; - sRtlLog = "impl_openconfig(E_PROVIDER_FILTERS)"; + sRtlLog = "impl_openconfig(E_PROVIDER_FILTERS)"_ostr; } break; @@ -782,7 +793,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig return m_xConfigOthers; sPath = CFGPACKAGE_TD_OTHERS; pConfig = &m_xConfigOthers; - sRtlLog = "impl_openconfig(E_PROVIDER_OTHERS)"; + sRtlLog = "impl_openconfig(E_PROVIDER_OTHERS)"_ostr; } break; @@ -792,7 +803,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig // the old configuration format only. It's not cached! sPath = CFGPACKAGE_TD_OLD; pConfig = &xOld; - sRtlLog = "impl_openconfig(E_PROVIDER_OLD)"; + sRtlLog = "impl_openconfig(E_PROVIDER_OLD)"_ostr; } break; @@ -829,7 +840,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfig return *pConfig; } -css::uno::Any FilterCache::impl_getDirectCFGValue(const OUString& sDirectKey) +css::uno::Any FilterCache::impl_getDirectCFGValue(std::u16string_view sDirectKey) { OUString sRoot; OUString sKey ; @@ -873,11 +884,11 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess bool bLocalesMode) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); css::uno::Reference< css::uno::XInterface > xCfg; - if (!utl::ConfigManager::IsFuzzing()) + if (!comphelper::IsFuzzing()) { try { @@ -890,14 +901,14 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess // set root path aParam.Name = "nodepath"; aParam.Value <<= sRoot; - lParams.push_back(css::uno::makeAny(aParam)); + lParams.push_back(css::uno::Any(aParam)); // enable "all locales mode" ... if required if (bLocalesMode) { aParam.Name = "locale"; aParam.Value <<= OUString("*"); - lParams.push_back(css::uno::makeAny(aParam)); + lParams.push_back(css::uno::Any(aParam)); } // open it @@ -933,7 +944,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess void FilterCache::impl_validateAndOptimize() { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // First check if any filter or type could be read // from the underlying configuration! @@ -1014,7 +1025,7 @@ void FilterCache::impl_validateAndOptimize() // create an optimized registration for this type to // its set list of extensions/url pattern. If it's a "normal" type - // set it at the end of this optimized list. But if its + // set it at the end of this optimized list. But if it's // a "Preferred" one - set it to the front of this list. // Of course multiple "Preferred" registrations can occur // (they shouldn't - but they can!) ... Ignore it. The last @@ -1177,7 +1188,7 @@ void FilterCache::impl_validateAndOptimize() CacheItem& rLoader = frameLoader.second; css::uno::Any& rTypesReg = rLoader[PROPNAME_TYPES]; - std::vector<OUString> lTypesReg (comphelper::sequenceToContainer< std::vector<OUString> >(rTypesReg.get<css::uno::Sequence<OUString> >())); + const css::uno::Sequence<OUString> lTypesReg = rTypesReg.get<css::uno::Sequence<OUString> >(); for (auto const& typeReg : lTypesReg) { @@ -1260,7 +1271,7 @@ FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css:: void FilterCache::impl_load(EFillState eRequiredState) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); // Attention: Detect services are part of the standard set! // So there is no need to handle it separately. @@ -1273,7 +1284,7 @@ void FilterCache::impl_load(EFillState eRequiredState) ) { // Attention! If config couldn't be opened successfully - // and exception os thrown automatically and must be forwarded + // and exception is thrown automatically and must be forwarded // to our caller... css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); { @@ -1290,7 +1301,7 @@ void FilterCache::impl_load(EFillState eRequiredState) ) { // Attention! If config couldn't be opened successfully - // and exception os thrown automatically and must be forwarded + // and exception is thrown automatically and must be forwarded // to our call... css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); { @@ -1307,7 +1318,7 @@ void FilterCache::impl_load(EFillState eRequiredState) ) { // Attention! If config couldn't be opened successfully - // and exception os thrown automatically and must be forwarded + // and exception is thrown automatically and must be forwarded // to our call... css::uno::Reference< css::container::XNameAccess > xFilters(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW); { @@ -1324,7 +1335,7 @@ void FilterCache::impl_load(EFillState eRequiredState) ) { // Attention! If config couldn't be opened successfully - // and exception os thrown automatically and must be forwarded + // and exception is thrown automatically and must be forwarded // to our call... css::uno::Reference< css::container::XNameAccess > xLoaders(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); { @@ -1341,7 +1352,7 @@ void FilterCache::impl_load(EFillState eRequiredState) ) { // Attention! If config couldn't be opened successfully - // and exception os thrown automatically and must be forwarded + // and exception is thrown automatically and must be forwarded // to our call... css::uno::Reference< css::container::XNameAccess > xHandlers(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); { @@ -1473,7 +1484,7 @@ void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::containe { // SAFE -> ---------------------------------- - osl::ClearableMutexGuard aLock(m_aLock); + osl::ClearableMutexGuard aLock(m_aMutex); OUString sActLocale = m_sActLocale ; aLock.clear(); // <- SAFE ---------------------------------- @@ -1816,6 +1827,37 @@ void FilterCache::impl_saveItem(const css::uno::Reference< css::container::XName } } +namespace { + constexpr struct { + SfxFilterFlags eFlag; + OUString aName; + } flagFilterSwitcher[] = { + { SfxFilterFlags::STARONEFILTER, FLAGNAME_3RDPARTYFILTER }, + { SfxFilterFlags::ALIEN, FLAGNAME_ALIEN }, + { SfxFilterFlags::CONSULTSERVICE, FLAGNAME_CONSULTSERVICE }, + { SfxFilterFlags::DEFAULT, FLAGNAME_DEFAULT }, + { SfxFilterFlags::ENCRYPTION, FLAGNAME_ENCRYPTION }, + { SfxFilterFlags::EXPORT, FLAGNAME_EXPORT }, + { SfxFilterFlags::IMPORT, FLAGNAME_IMPORT }, + { SfxFilterFlags::INTERNAL, FLAGNAME_INTERNAL }, + { SfxFilterFlags::NOTINFILEDLG, FLAGNAME_NOTINFILEDIALOG }, + { SfxFilterFlags::MUSTINSTALL, FLAGNAME_NOTINSTALLED }, + { SfxFilterFlags::OWN, FLAGNAME_OWN }, + { SfxFilterFlags::PACKED, FLAGNAME_PACKED }, + { SfxFilterFlags::PASSWORDTOMODIFY, FLAGNAME_PASSWORDTOMODIFY }, + { SfxFilterFlags::PREFERED, FLAGNAME_PREFERRED }, + { SfxFilterFlags::STARTPRESENTATION, FLAGNAME_STARTPRESENTATION }, + { SfxFilterFlags::OPENREADONLY, FLAGNAME_READONLY }, + { SfxFilterFlags::SUPPORTSSELECTION, FLAGNAME_SUPPORTSSELECTION }, + { SfxFilterFlags::TEMPLATE, FLAGNAME_TEMPLATE }, + { SfxFilterFlags::TEMPLATEPATH, FLAGNAME_TEMPLATEPATH }, + { SfxFilterFlags::COMBINED, FLAGNAME_COMBINED }, + { SfxFilterFlags::SUPPORTSSIGNING, FLAGNAME_SUPPORTSSIGNING }, + { SfxFilterFlags::GPGENCRYPTION, FLAGNAME_GPGENCRYPTION }, + { SfxFilterFlags::EXOTIC, FLAGNAME_EXOTIC }, + }; +} + /*----------------------------------------------- static! => no locks necessary -----------------------------------------------*/ @@ -1823,29 +1865,11 @@ css::uno::Sequence< OUString > FilterCache::impl_convertFlagField2FlagNames(SfxF { std::vector<OUString> lFlagNames; - if (nFlags & SfxFilterFlags::STARONEFILTER ) lFlagNames.emplace_back(FLAGNAME_3RDPARTYFILTER ); - if (nFlags & SfxFilterFlags::ALIEN ) lFlagNames.emplace_back(FLAGNAME_ALIEN ); - if (nFlags & SfxFilterFlags::CONSULTSERVICE ) lFlagNames.emplace_back(FLAGNAME_CONSULTSERVICE ); - if (nFlags & SfxFilterFlags::DEFAULT ) lFlagNames.emplace_back(FLAGNAME_DEFAULT ); - if (nFlags & SfxFilterFlags::ENCRYPTION ) lFlagNames.emplace_back(FLAGNAME_ENCRYPTION ); - if (nFlags & SfxFilterFlags::EXPORT ) lFlagNames.emplace_back(FLAGNAME_EXPORT ); - if (nFlags & SfxFilterFlags::IMPORT ) lFlagNames.emplace_back(FLAGNAME_IMPORT ); - if (nFlags & SfxFilterFlags::INTERNAL ) lFlagNames.emplace_back(FLAGNAME_INTERNAL ); - if (nFlags & SfxFilterFlags::NOTINFILEDLG ) lFlagNames.emplace_back(FLAGNAME_NOTINFILEDIALOG ); - if (nFlags & SfxFilterFlags::MUSTINSTALL ) lFlagNames.emplace_back(FLAGNAME_NOTINSTALLED ); - if (nFlags & SfxFilterFlags::OWN ) lFlagNames.emplace_back(FLAGNAME_OWN ); - if (nFlags & SfxFilterFlags::PACKED ) lFlagNames.emplace_back(FLAGNAME_PACKED ); - if (nFlags & SfxFilterFlags::PASSWORDTOMODIFY ) lFlagNames.emplace_back(FLAGNAME_PASSWORDTOMODIFY ); - if (nFlags & SfxFilterFlags::PREFERED ) lFlagNames.emplace_back(FLAGNAME_PREFERRED ); - if (nFlags & SfxFilterFlags::STARTPRESENTATION) lFlagNames.emplace_back(FLAGNAME_STARTPRESENTATION); - if (nFlags & SfxFilterFlags::OPENREADONLY ) lFlagNames.emplace_back(FLAGNAME_READONLY ); - if (nFlags & SfxFilterFlags::SUPPORTSSELECTION) lFlagNames.emplace_back(FLAGNAME_SUPPORTSSELECTION); - if (nFlags & SfxFilterFlags::TEMPLATE ) lFlagNames.emplace_back(FLAGNAME_TEMPLATE ); - if (nFlags & SfxFilterFlags::TEMPLATEPATH ) lFlagNames.emplace_back(FLAGNAME_TEMPLATEPATH ); - if (nFlags & SfxFilterFlags::COMBINED ) lFlagNames.emplace_back(FLAGNAME_COMBINED ); - if (nFlags & SfxFilterFlags::SUPPORTSSIGNING) lFlagNames.emplace_back(FLAGNAME_SUPPORTSSIGNING); - if (nFlags & SfxFilterFlags::GPGENCRYPTION) lFlagNames.emplace_back(FLAGNAME_GPGENCRYPTION); - if (nFlags & SfxFilterFlags::EXOTIC) lFlagNames.emplace_back(FLAGNAME_EXOTIC); + for (const auto& [eFlag, aName] : flagFilterSwitcher) + { + if (nFlags & eFlag) + lFlagNames.emplace_back(aName); + } return comphelper::containerToSequence(lFlagNames); } @@ -1861,120 +1885,12 @@ SfxFilterFlags FilterCache::impl_convertFlagNames2FlagField(const css::uno::Sequ sal_Int32 c = lNames.getLength(); for (sal_Int32 i=0; i<c; ++i) { - if (pNames[i] == FLAGNAME_3RDPARTYFILTER) - { - nField |= SfxFilterFlags::STARONEFILTER; - continue; - } - if (pNames[i] == FLAGNAME_ALIEN) - { - nField |= SfxFilterFlags::ALIEN; - continue; - } - if (pNames[i] == FLAGNAME_CONSULTSERVICE) - { - nField |= SfxFilterFlags::CONSULTSERVICE; - continue; - } - if (pNames[i] == FLAGNAME_DEFAULT) - { - nField |= SfxFilterFlags::DEFAULT; - continue; - } - if (pNames[i] == FLAGNAME_ENCRYPTION) - { - nField |= SfxFilterFlags::ENCRYPTION; - continue; - } - if (pNames[i] == FLAGNAME_EXOTIC) - { - nField |= SfxFilterFlags::EXOTIC; - continue; - } - if (pNames[i] == FLAGNAME_EXPORT) + for (const auto& [eFlag, aName] : flagFilterSwitcher) { - nField |= SfxFilterFlags::EXPORT; - continue; - } - if (pNames[i] == FLAGNAME_GPGENCRYPTION) - { - nField |= SfxFilterFlags::GPGENCRYPTION; - continue; - } - if (pNames[i] == FLAGNAME_IMPORT) - { - nField |= SfxFilterFlags::IMPORT; - continue; - } - if (pNames[i] == FLAGNAME_INTERNAL) - { - nField |= SfxFilterFlags::INTERNAL; - continue; - } - if (pNames[i] == FLAGNAME_NOTINFILEDIALOG) - { - nField |= SfxFilterFlags::NOTINFILEDLG; - continue; - } - if (pNames[i] == FLAGNAME_NOTINSTALLED) - { - nField |= SfxFilterFlags::MUSTINSTALL; - continue; - } - if (pNames[i] == FLAGNAME_OWN) - { - nField |= SfxFilterFlags::OWN; - continue; - } - if (pNames[i] == FLAGNAME_PACKED) - { - nField |= SfxFilterFlags::PACKED; - continue; - } - if (pNames[i] == FLAGNAME_PASSWORDTOMODIFY) - { - nField |= SfxFilterFlags::PASSWORDTOMODIFY; - continue; - } - if (pNames[i] == FLAGNAME_PREFERRED) - { - nField |= SfxFilterFlags::PREFERED; - continue; - } - if (pNames[i] == FLAGNAME_STARTPRESENTATION) - { - nField |= SfxFilterFlags::STARTPRESENTATION; - continue; - } - if (pNames[i] == FLAGNAME_SUPPORTSSIGNING) - { - nField |= SfxFilterFlags::SUPPORTSSIGNING; - continue; - } - if (pNames[i] == FLAGNAME_READONLY) - { - nField |= SfxFilterFlags::OPENREADONLY; - continue; - } - if (pNames[i] == FLAGNAME_SUPPORTSSELECTION) - { - nField |= SfxFilterFlags::SUPPORTSSELECTION; - continue; - } - if (pNames[i] == FLAGNAME_TEMPLATE) - { - nField |= SfxFilterFlags::TEMPLATE; - continue; - } - if (pNames[i] == FLAGNAME_TEMPLATEPATH) - { - nField |= SfxFilterFlags::TEMPLATEPATH; - continue; - } - if (pNames[i] == FLAGNAME_COMBINED) - { - nField |= SfxFilterFlags::COMBINED; - continue; + if (pNames[i] == aName) { + nField |= eFlag; + break; + } } } @@ -2147,14 +2063,14 @@ CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::containe } -std::vector<OUString> FilterCache::impl_tokenizeString(const OUString& sData , +std::vector<OUString> FilterCache::impl_tokenizeString(std::u16string_view sData , sal_Unicode cSeparator) { std::vector<OUString> lData ; sal_Int32 nToken = 0; do { - OUString sToken = sData.getToken(0, cSeparator, nToken); + OUString sToken( o3tl::getToken(sData, 0, cSeparator, nToken) ); lData.push_back(sToken); } while(nToken >= 0); @@ -2170,8 +2086,8 @@ OUString FilterCache::impl_searchFrameLoaderForType(const OUString& sType) const { const OUString& sItem = frameLoader.first; ::comphelper::SequenceAsHashMap lProps(frameLoader.second); - std::vector<OUString> lTypes( - comphelper::sequenceToContainer< std::vector<OUString> >(lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >())); + const css::uno::Sequence<OUString> lTypes = + lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >(); if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end()) return sItem; @@ -2187,8 +2103,8 @@ OUString FilterCache::impl_searchContentHandlerForType(const OUString& sType) co { const OUString& sItem = contentHandler.first; ::comphelper::SequenceAsHashMap lProps(contentHandler.second); - std::vector<OUString> lTypes( - comphelper::sequenceToContainer< std::vector<OUString> >( lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >() )); + const css::uno::Sequence<OUString> lTypes = + lProps[PROPNAME_TYPES].get<css::uno::Sequence<OUString> >(); if (::std::find(lTypes.begin(), lTypes.end(), sType) != lTypes.end()) return sItem; } @@ -2204,7 +2120,7 @@ bool FilterCache::impl_isModuleInstalled(const OUString& sModule) // SAFE -> { - osl::MutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aMutex); if (!m_xModuleCfg.is()) { m_xModuleCfg = officecfg::Setup::Office::Factories::get(); diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index a0ef79c93931..8445efea8227 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -22,6 +22,7 @@ #include <memory> #include "cacheitem.hxx" +#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -29,6 +30,7 @@ #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Any.h> #include <comphelper/documentconstants.hxx> +#include <cppuhelper/basemutex.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> @@ -54,7 +56,7 @@ class CacheUpdateListener; Further we make it public. So any user of this class can lock us from outside too. */ -class FilterCache : public BaseLock +class FilterCache : public cppu::BaseMutex { // public types @@ -360,9 +362,9 @@ class FilterCache : public BaseLock if some input parameter are wrong or the cache itself is not valid any longer, because any operation before damage it. */ - std::vector<OUString> getMatchingItemsByProps( EItemType eType , - const CacheItem& lIProps , - const CacheItem& lEProps = CacheItem()) const; + std::vector<OUString> getMatchingItemsByProps( EItemType eType, + std::span< const css::beans::NamedValue > lIProps, + std::span< const css::beans::NamedValue > lEProps = {}) const; /** @short indicates if the requested sub container @@ -523,10 +525,8 @@ class FilterCache : public BaseLock was not migrated to the new one. So we can't provide write access to such items... */ - void addStatePropsToItem( EItemType eType, - const OUString& sItem, - CacheItem& rItem); - + css::uno::Any getItemWithStateProps( EItemType eType, + const OUString& sItem); /** TODO document me @@ -599,6 +599,7 @@ class FilterCache : public BaseLock CacheItemList& impl_getItemList(EItemType eType); + CacheItem& impl_getItem( EItemType eType, const OUString& sItem); /** @short return a valid configuration update access to the underlying configuration package, which @@ -664,7 +665,7 @@ class FilterCache : public BaseLock Can be empty if an internal error occurred or if the requested key does not exists! */ - css::uno::Any impl_getDirectCFGValue(const OUString& sDirectKey); + css::uno::Any impl_getDirectCFGValue(std::u16string_view sDirectKey); /** @short load the underlying configuration into this cache. @@ -890,7 +891,7 @@ class FilterCache : public BaseLock /** TODO */ - static std::vector<OUString> impl_tokenizeString(const OUString& sData , + static std::vector<OUString> impl_tokenizeString(std::u16string_view sData , sal_Unicode cSeparator); diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index 8832330d5a04..9b0793b94e1e 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -55,9 +55,9 @@ FilterCache& GetTheFilterCache() FilterFactory::FilterFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext) : m_xContext(rxContext) { - BaseContainer::init(rxContext , - "com.sun.star.comp.filter.config.FilterFactory" , - { "com.sun.star.document.FilterFactory" }, + static const css::uno::Sequence<OUString> sServiceNames { "com.sun.star.document.FilterFactory" }; + BaseContainer::init("com.sun.star.comp.filter.config.FilterFactory" , + sServiceNames, FilterCache::E_FILTER ); } @@ -77,7 +77,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan const css::uno::Sequence< css::uno::Any >& lArguments) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); auto & cache = GetTheFilterCache(); @@ -103,7 +103,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FilterFactory::createInstan aFilter >> lConfig; ::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer< ::std::vector< css::uno::Any > >(lArguments)); - stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig)); + stlArguments.insert(stlArguments.begin(), css::uno::Any(lConfig)); xInit->initialize(comphelper::containerToSequence(stlArguments)); } @@ -121,14 +121,13 @@ css::uno::Sequence< OUString > SAL_CALL FilterFactory::getAvailableServiceNames( Of course we can't check for corrupted service names here. We can check for empty strings only... */ - CacheItem lIProps; - CacheItem lEProps; - lEProps[PROPNAME_FILTERSERVICE] <<= OUString(); + css::beans::NamedValue lEProps[] { + { PROPNAME_FILTERSERVICE, css::uno::Any(OUString()) } }; std::vector<OUString> lUNOFilters; try { - lUNOFilters = GetTheFilterCache().getMatchingItemsByProps(FilterCache::E_FILTER, lIProps, lEProps); + lUNOFilters = GetTheFilterCache().getMatchingItemsByProps(FilterCache::E_FILTER, {}, lEProps); } catch(const css::uno::RuntimeException&) { throw; } @@ -153,8 +152,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea if (pos != -1) { OSL_FAIL("DEPRECATED!\nPlease use new query format: 'matchByDocumentService=...'"); - OUString sPatchedQuery(OUString::Concat("matchByDocumentService=") + sNewQuery.subView(7)); - sNewQuery = sPatchedQuery; + sNewQuery = OUString::Concat("matchByDocumentService=") + sNewQuery.subView(7); } // analyze query and split it into its tokens @@ -167,10 +165,10 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea { // SAFE -> ---------------------- { - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); // May be not all filters was loaded ... // But we need it now! - impl_loadOnDemand(); + impl_loadOnDemand(aLock); } // <- SAFE ---------------------- @@ -187,8 +185,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL FilterFactory::crea // pack list of item names as an enum list // Attention: Do not return empty reference for empty list! // The outside check "hasMoreElements()" should be enough, to detect this state :-) - css::uno::Sequence< OUString > lSet = comphelper::containerToSequence(lEnumSet); - return new ::comphelper::OEnumerationByName(this, lSet); + return new ::comphelper::OEnumerationByName(this, std::move(lEnumSet)); } @@ -253,10 +250,10 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer nEFlags = pIt->second.toInt32(); // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); // search suitable filters - FilterCache* pCache = impl_getWorkingCache(); + FilterCache* pCache = impl_getWorkingCache(aLock); std::vector<OUString> lFilterNames = pCache->getItemNames(FilterCache::E_FILTER); std::vector<OUString> lResult ; @@ -314,7 +311,7 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer { continue; } } - aLock.clear(); + aLock.unlock(); // <- SAFE ---------------------- return lResult; @@ -391,7 +388,7 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokeniz { // more complex search for all filters // We check first, which office modules are installed... - std::vector<OUString> lModules = impl_getListOfInstalledModules(); + const css::uno::Sequence<OUString> lModules = impl_getListOfInstalledModules(); for (auto const& module : lModules) { std::vector<OUString> lFilters4Module = impl_getSortedFilterListForModule(module, nIFlags, nEFlags); @@ -406,17 +403,10 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokeniz } -std::vector<OUString> FilterFactory::impl_getListOfInstalledModules() const +css::uno::Sequence<OUString> FilterFactory::impl_getListOfInstalledModules() { - // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); - css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aLock.clear(); - // <- SAFE ---------------------- - - css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get(xContext); - std::vector<OUString> lModules(comphelper::sequenceToContainer< std::vector<OUString> >(xModuleConfig->getElementNames())); - return lModules; + css::uno::Reference< css::container::XNameAccess > xModuleConfig = officecfg::Setup::Office::Factories::get(); + return xModuleConfig->getElementNames(); } @@ -427,14 +417,13 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS std::vector<OUString> lSortedFilters = impl_readSortedFilterListFromConfig(sModule); // get all filters for the requested module - CacheItem lIProps; - lIProps[PROPNAME_DOCUMENTSERVICE] <<= sModule; + css::beans::NamedValue lIProps[] { { PROPNAME_DOCUMENTSERVICE, css::uno::Any(sModule) } }; // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); - FilterCache* pCache = impl_getWorkingCache(); + std::unique_lock aLock(m_aMutex); + FilterCache* pCache = impl_getWorkingCache(aLock); std::vector<OUString> lOtherFilters = pCache->getMatchingItemsByProps(FilterCache::E_FILTER, lIProps); - aLock.clear(); + aLock.unlock(); // <- SAFE ---------------------- // bring "other" filters in an alphabetical order @@ -453,13 +442,11 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS // remove all filters from this merged list, which does not fit the flag specification if (nIFlags != -1) { - auto pItToErase = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nIFlags, true)); - lMergedFilters.erase(pItToErase, lMergedFilters.end()); + std::erase_if(lMergedFilters, stlcomp_removeIfMatchFlags(pCache, nIFlags, true)); } if (nEFlags != -1) { - auto pItToErase = ::std::remove_if(lMergedFilters.begin(), lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nEFlags, false)); - lMergedFilters.erase(pItToErase, lMergedFilters.end()); + std::erase_if(lMergedFilters, stlcomp_removeIfMatchFlags(pCache, nEFlags, false)); } // sort the default filter to the front of this list @@ -469,17 +456,11 @@ std::vector<OUString> FilterFactory::impl_getSortedFilterListForModule(const OUS } -std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) const +std::vector<OUString> FilterFactory::impl_readSortedFilterListFromConfig(const OUString& sModule) { - // SAFE -> ---------------------- - osl::ClearableMutexGuard aLock(m_aLock); - css::uno::Reference< css::uno::XComponentContext > xContext = m_xContext; - aLock.clear(); - // <- SAFE ---------------------- - try { - css::uno::Reference< css::container::XNameAccess > xUISortConfig = officecfg::TypeDetection::UISort::ModuleDependendFilterOrder::get(xContext); + css::uno::Reference< css::container::XNameAccess > xUISortConfig = officecfg::TypeDetection::UISort::ModuleDependendFilterOrder::get(); // don't check the module name here. If it does not exists, an exception is thrown and caught below. // We return an empty list as result then. css::uno::Reference< css::container::XNameAccess > xModule; diff --git a/filter/source/config/cache/filterfactory.hxx b/filter/source/config/cache/filterfactory.hxx index 19abea5d6db0..9be370f4dc56 100644 --- a/filter/source/config/cache/filterfactory.hxx +++ b/filter/source/config/cache/filterfactory.hxx @@ -95,7 +95,7 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer /** TODO document me */ - std::vector<OUString> impl_getListOfInstalledModules() const; + static css::uno::Sequence<OUString> impl_getListOfInstalledModules(); /** @short implement the container string query: @@ -126,7 +126,7 @@ class FilterFactory : public ::cppu::ImplInheritanceHelper< BaseContainer @return A string list of internal filter names. Can be empty. */ - std::vector<OUString> impl_readSortedFilterListFromConfig(const OUString& sModule) const; + static std::vector<OUString> impl_readSortedFilterListFromConfig(const OUString& sModule); }; diff --git a/filter/source/config/cache/frameloaderfactory.cxx b/filter/source/config/cache/frameloaderfactory.cxx index a3aef82e4c6c..ee78ebd98979 100644 --- a/filter/source/config/cache/frameloaderfactory.cxx +++ b/filter/source/config/cache/frameloaderfactory.cxx @@ -29,8 +29,7 @@ namespace filter::config{ FrameLoaderFactory::FrameLoaderFactory(const css::uno::Reference< css::uno::XComponentContext >& rxContext) : m_xContext(rxContext) { - BaseContainer::init(rxContext , - "com.sun.star.comp.filter.config.FrameLoaderFactory" , + BaseContainer::init("com.sun.star.comp.filter.config.FrameLoaderFactory" , { "com.sun.star.frame.FrameLoaderFactory" }, FilterCache::E_FRAMELOADER ); } @@ -51,7 +50,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI const css::uno::Sequence< css::uno::Any >& lArguments) { // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); auto & cache = GetTheFilterCache(); @@ -73,7 +72,7 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL FrameLoaderFactory::createI aLoader >> lConfig; ::std::vector< css::uno::Any > stlArguments(comphelper::sequenceToContainer< ::std::vector<css::uno::Any> >(lArguments)); - stlArguments.insert(stlArguments.begin(), css::uno::makeAny(lConfig)); + stlArguments.insert(stlArguments.begin(), css::uno::Any(lConfig)); xInit->initialize(comphelper::containerToSequence(stlArguments)); } diff --git a/filter/source/config/cache/querytokenizer.cxx b/filter/source/config/cache/querytokenizer.cxx index 9b64f68fe6d8..f5b021f53b45 100644 --- a/filter/source/config/cache/querytokenizer.cxx +++ b/filter/source/config/cache/querytokenizer.cxx @@ -20,23 +20,24 @@ #include "querytokenizer.hxx" #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> namespace filter::config{ -QueryTokenizer::QueryTokenizer(const OUString& sQuery) +QueryTokenizer::QueryTokenizer(std::u16string_view sQuery) : m_bValid(true) { sal_Int32 token = 0; while(token != -1) { - OUString sToken = sQuery.getToken(0, ':', token); - if (!sToken.isEmpty()) + std::u16string_view sToken = o3tl::getToken(sQuery,0, ':', token); + if (!sToken.empty()) { sal_Int32 nIdx{ 0 }; - const OUString sKey{ sToken.getToken(0, '=', nIdx) }; - const OUString sVal{ sToken.getToken(0, ':', nIdx) }; + const OUString sKey{ o3tl::getToken(sToken, 0, '=', nIdx) }; + const OUString sVal{ o3tl::getToken(sToken, 0, ':', nIdx) }; if (sKey.isEmpty()) m_bValid = false; diff --git a/filter/source/config/cache/querytokenizer.hxx b/filter/source/config/cache/querytokenizer.hxx index e0b8d5218130..0c7e79b3ddc7 100644 --- a/filter/source/config/cache/querytokenizer.hxx +++ b/filter/source/config/cache/querytokenizer.hxx @@ -73,7 +73,7 @@ class QueryTokenizer : public std::unordered_map< OUString, OUString > @param sQuery the query string. */ - explicit QueryTokenizer(const OUString& sQuery); + explicit QueryTokenizer(std::u16string_view sQuery); /** @short destruct an instance of this class. diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 9f80798a8cb7..065fe483a3dd 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -25,16 +25,25 @@ #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/embed/StorageFormats.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/packages/zip/ZipIOException.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> + +#include <sfx2/brokenpackageint.hxx> +#include <o3tl/string_view.hxx> #include <tools/wldcrd.hxx> #include <sal/log.hxx> #include <framework/interaction.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/urlobj.hxx> #include <comphelper/fileurl.hxx> +#include <comphelper/lok.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/scopeguard.hxx> +#include <utility> #define DEBUG_TYPE_DETECTION 0 @@ -54,8 +63,7 @@ TypeDetection::TypeDetection(const css::uno::Reference< css::uno::XComponentCont , m_bCancel(false) { css::frame::Desktop::create(m_xContext)->addTerminateListener(m_xTerminateListener); - BaseContainer::init(rxContext , - "com.sun.star.comp.filter.config.TypeDetection" , + BaseContainer::init("com.sun.star.comp.filter.config.TypeDetection" , { "com.sun.star.document.TypeDetection" }, FilterCache::E_TYPE ); } @@ -72,7 +80,7 @@ OUString SAL_CALL TypeDetection::queryTypeByURL(const OUString& sURL) OUString sType; // SAFE -> - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); css::util::URL aURL; aURL.Complete = sURL; @@ -125,7 +133,7 @@ namespace { * In each category, rank them from strictly-structured to * loosely-structured. */ -int getFlatTypeRank(const OUString& rType) +int getFlatTypeRank(std::u16string_view rType) { // List formats from more complex to less complex. // TODO: Add more. @@ -210,6 +218,7 @@ int getFlatTypeRank(const OUString& rType) "calc_SYLK", "calc_DIF", "calc_dBase", + "Apache Parquet", // Binary (raster and vector image files) "emf_MS_Windows_Metafile", @@ -232,6 +241,7 @@ int getFlatTypeRank(const OUString& rType) "pcd_Photo_CD_Base", "pcd_Photo_CD_Base4", "pcd_Photo_CD_Base16", + "webp_WebP", "impress_CGM_Computer_Graphics_Metafile", // There is binary and ascii variants ? "draw_WordPerfect_Graphics", "draw_Visio_Document", @@ -282,11 +292,11 @@ int getFlatTypeRank(const OUString& rType) "math_MathType_3x", // MathType equation embedded in Word doc. }; - size_t n = SAL_N_ELEMENTS(ranks); + size_t n = std::size(ranks); for (size_t i = 0; i < n; ++i) { - if (rType.equalsAscii(ranks[i])) + if (o3tl::equalsAscii(rType, ranks[i])) return n - i - 1; } @@ -344,7 +354,7 @@ class FindByType { OUString maType; public: - explicit FindByType(const OUString& rType) : maType(rType) {} + explicit FindByType(OUString aType) : maType(std::move(aType)) {} bool operator() (const FlatDetectionInfo& rInfo) const { return rInfo.sType == maType; @@ -377,7 +387,7 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: try { // SAFE -> ---------------------------------- - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); // parse given URL to split it into e.g. main and jump marks ... sURL = stlDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString()); @@ -403,9 +413,9 @@ OUString SAL_CALL TypeDetection::queryTypeByDescriptor(css::uno::Sequence< css:: } FlatDetection lFlatTypes; - impl_getAllFormatTypes(aURL, stlDescriptor, lFlatTypes); + impl_getAllFormatTypes(aLock, aURL, stlDescriptor, lFlatTypes); - aLock.clear(); + aLock.unlock(); // <- SAFE ---------------------------------- // Properly prioritize all candidate types. @@ -487,25 +497,25 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes OUString sRealType = sType; // SAFE -> - ::osl::ResettableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); // Attention: For executing next lines of code, We must be sure that // all filters already loaded :-( // That can disturb our "load on demand feature". But we have no other chance! cache.load(FilterCache::E_CONTAINS_FILTERS); - CacheItem lIProps; - lIProps[PROPNAME_DOCUMENTSERVICE] <<= sDocumentService; - lIProps[PROPNAME_TYPE ] <<= sRealType; + css::beans::NamedValue lIProps[] { + { PROPNAME_DOCUMENTSERVICE, uno::Any(sDocumentService) }, + { PROPNAME_TYPE, uno::Any(sRealType) } }; std::vector<OUString> lFilters = cache.getMatchingItemsByProps(FilterCache::E_FILTER, lIProps); - aLock.clear(); + aLock.unlock(); // <- SAFE for (auto const& filter : lFilters) { // SAFE -> - aLock.reset(); + aLock.lock(); try { CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, filter); @@ -518,7 +528,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes break; } catch(const css::uno::Exception&) {} - aLock.clear(); + aLock.unlock(); // <- SAFE } @@ -544,16 +554,10 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes sFilter.clear(); try { - // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); - CacheItem aType = cache.getItem(FilterCache::E_TYPE, sType); aType[PROPNAME_PREFERREDFILTER] >>= sFilter; cache.getItem(FilterCache::E_FILTER, sFilter); - aLock.clear(); - // <- SAFE - // no exception => found valid type and filter => set it on the given descriptor rDescriptor[utl::MediaDescriptor::PROP_TYPENAME ] <<= sType ; rDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] <<= sFilter; @@ -567,27 +571,19 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes sFilter.clear(); try { - // SAFE -> - ::osl::ResettableMutexGuard aLock(m_aLock); - // Attention: For executing next lines of code, We must be sure that // all filters already loaded :-( // That can disturb our "load on demand feature". But we have no other chance! cache.load(FilterCache::E_CONTAINS_FILTERS); - CacheItem lIProps; - lIProps[PROPNAME_TYPE] <<= sType; + css::beans::NamedValue lIProps[] { + { PROPNAME_TYPE, uno::Any(sType) } }; std::vector<OUString> lFilters = cache.getMatchingItemsByProps(FilterCache::E_FILTER, lIProps); - aLock.clear(); - // <- SAFE - for (auto const& filter : lFilters) { sFilter = filter; - // SAFE -> - aLock.reset(); try { CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter); @@ -599,8 +595,6 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes } catch(const css::uno::Exception&) { continue; } - aLock.clear(); - // <- SAFE sFilter.clear(); } @@ -618,6 +612,7 @@ void TypeDetection::impl_checkResultsAndAddBestFilter(utl::MediaDescriptor& rDes bool TypeDetection::impl_getPreselectionForType( + std::unique_lock<std::mutex>& /*rGuard*/, const OUString& sPreSelType, const util::URL& aParsedURL, FlatDetection& rFlatTypes, bool bDocService) { // Can be used to suppress execution of some parts of this method @@ -639,10 +634,7 @@ bool TypeDetection::impl_getPreselectionForType( CacheItem aType; try { - // SAFE -> -------------------------- - osl::MutexGuard aLock(m_aLock); aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sType); - // <- SAFE -------------------------- } catch(const css::container::NoSuchElementException&) { @@ -669,8 +661,8 @@ bool TypeDetection::impl_getPreselectionForType( // otherwise we must know, if it matches to the given URL really. // especially if it matches by its extension or pattern registration. - std::vector<OUString> lExtensions(comphelper::sequenceToContainer< std::vector<OUString> >(aType[PROPNAME_EXTENSIONS].get<css::uno::Sequence<OUString> >() )); - std::vector<OUString> lURLPattern(comphelper::sequenceToContainer< std::vector<OUString> >(aType[PROPNAME_URLPATTERN].get<css::uno::Sequence<OUString> >() )); + const css::uno::Sequence<OUString> lExtensions = aType[PROPNAME_EXTENSIONS].get<css::uno::Sequence<OUString> >(); + const css::uno::Sequence<OUString> lURLPattern = aType[PROPNAME_URLPATTERN].get<css::uno::Sequence<OUString> >(); for (auto const& extension : lExtensions) { @@ -719,25 +711,22 @@ bool TypeDetection::impl_getPreselectionForType( } void TypeDetection::impl_getPreselectionForDocumentService( + std::unique_lock<std::mutex>& rGuard, const OUString& sPreSelDocumentService, const util::URL& aParsedURL, FlatDetection& rFlatTypes) { // get all filters, which match to this doc service std::vector<OUString> lFilters; try { - // SAFE -> -------------------------- - osl::MutexGuard aLock(m_aLock); - // Attention: For executing next lines of code, We must be sure that // all filters already loaded :-( // That can disturb our "load on demand feature". But we have no other chance! auto & cache = GetTheFilterCache(); cache.load(FilterCache::E_CONTAINS_FILTERS); - CacheItem lIProps; - lIProps[PROPNAME_DOCUMENTSERVICE] <<= sPreSelDocumentService; + css::beans::NamedValue lIProps[] { + { PROPNAME_DOCUMENTSERVICE, css::uno::Any(sPreSelDocumentService) } }; lFilters = cache.getMatchingItemsByProps(FilterCache::E_FILTER, lIProps); - // <- SAFE -------------------------- } catch (const css::container::NoSuchElementException&) { @@ -751,20 +740,19 @@ void TypeDetection::impl_getPreselectionForDocumentService( // is an easier job than removing them .-) for (auto const& filter : lFilters) { - OUString aType = impl_getTypeFromFilter(filter); + OUString aType = impl_getTypeFromFilter(rGuard, filter); if (aType.isEmpty()) continue; - impl_getPreselectionForType(aType, aParsedURL, rFlatTypes, true); + impl_getPreselectionForType(rGuard, aType, aParsedURL, rFlatTypes, true); } } -OUString TypeDetection::impl_getTypeFromFilter(const OUString& rFilterName) +OUString TypeDetection::impl_getTypeFromFilter(std::unique_lock<std::mutex>& /*rGuard*/, const OUString& rFilterName) { CacheItem aFilter; try { - osl::MutexGuard aLock(m_aLock); aFilter = GetTheFilterCache().getItem(FilterCache::E_FILTER, rFilterName); } catch (const container::NoSuchElementException&) @@ -778,6 +766,7 @@ OUString TypeDetection::impl_getTypeFromFilter(const OUString& rFilterName) } void TypeDetection::impl_getAllFormatTypes( + std::unique_lock<std::mutex>& rGuard, const util::URL& aParsedURL, utl::MediaDescriptor const & rDescriptor, FlatDetection& rFlatTypes) { rFlatTypes.clear(); @@ -786,7 +775,6 @@ void TypeDetection::impl_getAllFormatTypes( std::vector<OUString> aFilterNames; try { - osl::MutexGuard aLock(m_aLock); auto & cache = GetTheFilterCache(); cache.load(FilterCache::E_CONTAINS_FILTERS); aFilterNames = cache.getItemNames(FilterCache::E_FILTER); @@ -799,7 +787,7 @@ void TypeDetection::impl_getAllFormatTypes( // Retrieve the default type for each of these filters, and store them. for (auto const& filterName : aFilterNames) { - OUString aType = impl_getTypeFromFilter(filterName); + OUString aType = impl_getTypeFromFilter(rGuard, filterName); if (aType.isEmpty()) continue; @@ -842,12 +830,81 @@ void TypeDetection::impl_getAllFormatTypes( // Mark pre-selected type (if any) to have it prioritized. OUString sSelectedType = rDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_TYPENAME, OUString()); if (!sSelectedType.isEmpty()) - impl_getPreselectionForType(sSelectedType, aParsedURL, rFlatTypes, false); + impl_getPreselectionForType(rGuard, sSelectedType, aParsedURL, rFlatTypes, false); // Mark all types preferred by the current document service, to have it prioritized. OUString sSelectedDoc = rDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTSERVICE, OUString()); if (!sSelectedDoc.isEmpty()) - impl_getPreselectionForDocumentService(sSelectedDoc, aParsedURL, rFlatTypes); + impl_getPreselectionForDocumentService(rGuard, sSelectedDoc, aParsedURL, rFlatTypes); +} + + +static bool isBrokenZIP(const css::uno::Reference<css::io::XInputStream>& xStream, + const css::uno::Reference<css::uno::XComponentContext>& xContext) +{ + try + { + // Only consider seekable streams starting with "PK", to avoid false detections + css::uno::Reference<css::io::XSeekable> xSeek(xStream, css::uno::UNO_QUERY_THROW); + comphelper::ScopeGuard restorePos( + [xSeek, nPos = xSeek->getPosition()] + { + try + { + xSeek->seek(nPos); + } + catch (const css::uno::Exception&) + { + } + }); + css::uno::Sequence<sal_Int8> magic(2); + xStream->readBytes(magic, 2); + if (magic.getLength() < 2 || magic[0] != 'P' || magic[1] != 'K') + return false; + } + catch (const css::uno::Exception&) + { + return false; + } + + std::vector<css::uno::Any> aArguments{ + css::uno::Any(xStream), + css::uno::Any(css::beans::NamedValue("AllowRemoveOnInsert", css::uno::Any(false))), + css::uno::Any(css::beans::NamedValue("StorageFormat", + css::uno::Any(css::embed::StorageFormats::ZIP))), + }; + try + { + // If this is a broken ZIP package, or not a ZIP, this would throw ZipIOException + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.packages.comp.ZipPackage", comphelper::containerToSequence(aArguments), + xContext); + } + catch (const css::packages::zip::ZipIOException&) + { + // Now test if repair will succeed + aArguments.emplace_back(css::beans::NamedValue("RepairPackage", css::uno::Any(true))); + try + { + // If this is a broken ZIP package that can be repaired, this would succeed, + // and the result will be not empty + if (css::uno::Reference<css::beans::XPropertySet> xPackage{ + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.packages.comp.ZipPackage", + comphelper::containerToSequence(aArguments), xContext), + css::uno::UNO_QUERY }) + if (bool bHasElements; xPackage->getPropertyValue("HasElements") >>= bHasElements) + return bHasElements; + } + catch (const css::uno::Exception&) + { + } + } + catch (const css::uno::Exception&) + { + } + // The package is either not broken, or is not a repairable ZIP + return false; } @@ -860,6 +917,65 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r // a set and a not set value. rLastChance.clear(); + // tdf#96401: First of all, check if this is a broken ZIP package. Not doing this here would + // make some filters silently not recognize their content in broken packages, and some filters + // show a warning and mistakenly claim own content based on user choice. + if (bAllowDeep && !rDescriptor.getUnpackedValueOrDefault("RepairPackage", false) + && rDescriptor.getUnpackedValueOrDefault("RepairAllowed", true) + && rDescriptor.contains(utl::MediaDescriptor::PROP_INTERACTIONHANDLER)) + { + try + { + impl_openStream(rDescriptor); + if (auto xStream = rDescriptor.getUnpackedValueOrDefault( + utl::MediaDescriptor::PROP_INPUTSTREAM, + css::uno::Reference<css::io::XInputStream>())) + { + css::uno::Reference<css::uno::XComponentContext> xContext; + + // SAFE -> + { + std::unique_lock aLock(m_aMutex); + xContext = m_xContext; + } + // <- SAFE + + if (isBrokenZIP(xStream, xContext)) + { + if (css::uno::Reference<css::task::XInteractionHandler> xInteraction{ + rDescriptor.getValue(utl::MediaDescriptor::PROP_INTERACTIONHANDLER), + css::uno::UNO_QUERY }) + { + INetURLObject aURL(rDescriptor.getUnpackedValueOrDefault( + utl::MediaDescriptor::PROP_URL, OUString())); + OUString aDocumentTitle + = aURL.getName(INetURLObject::LAST_SEGMENT, true, + INetURLObject::DecodeMechanism::WithCharset); + + // Ask the user whether they wants to try to repair + RequestPackageReparation aRequest(aDocumentTitle); + xInteraction->handle(aRequest.GetRequest()); + + if (aRequest.isApproved()) + { + // lok: we want to overwrite file in jail, so don't use template flag + const bool bIsLOK = comphelper::LibreOfficeKit::isActive(); + rDescriptor[utl::MediaDescriptor::PROP_DOCUMENTTITLE] <<= aDocumentTitle; + rDescriptor[utl::MediaDescriptor::PROP_ASTEMPLATE] <<= !bIsLOK; + rDescriptor["RepairPackage"] <<= true; + } + else + rDescriptor["RepairAllowed"] <<= false; // Do not ask again + } + } + } + } + catch (const css::uno::Exception&) + { + // No problem + } + } + // step over all possible types for this URL. // solutions: // a) no types => no detection @@ -896,9 +1012,9 @@ OUString TypeDetection::impl_detectTypeFlatAndDeep( utl::MediaDescriptor& r try { // SAFE -> ---------------------------------- - osl::ClearableMutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); CacheItem aType = GetTheFilterCache().getItem(FilterCache::E_TYPE, sFlatType); - aLock.clear(); + aLock.unlock(); OUString sDetectService; aType[PROPNAME_DETECTSERVICE] >>= sDetectService; @@ -974,7 +1090,7 @@ OUString TypeDetection::impl_askDetectService(const OUString& sDet // SAFE -> { - osl::MutexGuard aLock(m_aLock); + std::unique_lock aLock(m_aMutex); xContext = m_xContext; } // <- SAFE @@ -1090,7 +1206,6 @@ OUString TypeDetection::impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescript OUString sFilter = aRequest.getFilter(); if (!impl_validateAndSetFilterOnDescriptor(rDescriptor, sFilter)) return OUString(); - OUString sType; rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] >>= sType; return sType; @@ -1118,7 +1233,7 @@ void TypeDetection::impl_openStream(utl::MediaDescriptor& rDescriptor) if ( !bSuccess ) throw css::uno::Exception( "Could not open stream for <" + sURL + ">", - static_cast<OWeakObject *>(this)); + getXWeak()); if ( !bRequestedReadOnly ) { @@ -1145,16 +1260,11 @@ void TypeDetection::impl_removeTypeFilterFromDescriptor(utl::MediaDescriptor& rD bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor, const OUString& sType ) { - // SAFE -> + if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType)) { - osl::MutexGuard aLock(m_aLock); - if (GetTheFilterCache().hasItem(FilterCache::E_TYPE, sType)) - { - rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sType; - return true; - } + rDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sType; + return true; } - // <- SAFE // remove all related information from the descriptor impl_removeTypeFilterFromDescriptor(rDescriptor); @@ -1162,22 +1272,16 @@ bool TypeDetection::impl_validateAndSetTypeOnDescriptor( utl::MediaDescript } -bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescriptor& rDescriptor, - const OUString& sFilter ) +bool TypeDetection::impl_validateAndSetFilterOnDescriptor( utl::MediaDescriptor& rDescriptor, + const OUString& sFilter ) { try { - // SAFE -> - osl::ClearableMutexGuard aLock(m_aLock); - auto & cache = GetTheFilterCache(); CacheItem aFilter = cache.getItem(FilterCache::E_FILTER, sFilter); OUString sType; aFilter[PROPNAME_TYPE] >>= sType; - aLock.clear(); - // <- SAFE - // found valid type and filter => set it on the given descriptor rDescriptor[utl::MediaDescriptor::PROP_TYPENAME ] <<= sType ; rDescriptor[utl::MediaDescriptor::PROP_FILTERNAME] <<= sFilter; diff --git a/filter/source/config/cache/typedetection.hxx b/filter/source/config/cache/typedetection.hxx index 79145e836d17..6ff70e64eba4 100644 --- a/filter/source/config/cache/typedetection.hxx +++ b/filter/source/config/cache/typedetection.hxx @@ -24,6 +24,7 @@ #include <unotools/mediadescriptor.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/implbase.hxx> +#include <comphelper/compbase.hxx> namespace filter::config { @@ -69,18 +70,21 @@ public: private: - bool impl_getPreselectionForType( + static bool impl_getPreselectionForType( + std::unique_lock<std::mutex>& rGuard, const OUString& sPreSelType, const css::util::URL& aParsedURL, FlatDetection& rFlatTypes, bool bDocService); - void impl_getPreselectionForDocumentService( + static void impl_getPreselectionForDocumentService( + std::unique_lock<std::mutex>& rGuard, const OUString& sPreSelDocumentService, const css::util::URL& aParsedURL, FlatDetection& rFlatTypes); - OUString impl_getTypeFromFilter(const OUString& rFilterName); + static OUString impl_getTypeFromFilter(std::unique_lock<std::mutex>& rGuard, const OUString& rFilterName); /** * Get all format types that we handle. */ - void impl_getAllFormatTypes( + static void impl_getAllFormatTypes( + std::unique_lock<std::mutex>& rGuard, const css::util::URL& aParsedURL, utl::MediaDescriptor const & rDescriptor, FlatDetection& rFlatTypes); @@ -172,7 +176,7 @@ private: @return [string] a valid type name or an empty string if user canceled interaction. */ - OUString impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescriptor& rDescriptor); + static OUString impl_askUserForTypeAndFilterIfAllowed(utl::MediaDescriptor& rDescriptor); /** @short check if an input stream is already part of the @@ -229,8 +233,8 @@ private: @return TRUE the specified type and its registrations was valid(!) and could be set on the descriptor. */ - bool impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor, - const OUString& sType ); + static bool impl_validateAndSetTypeOnDescriptor( utl::MediaDescriptor& rDescriptor, + const OUString& sType ); /** @short validate the specified filter and its relationships @@ -250,7 +254,8 @@ private: @return TRUE the specified type and its registrations was valid(!) and could be set on the descriptor. */ - bool impl_validateAndSetFilterOnDescriptor( utl::MediaDescriptor& rDescriptor, + static bool impl_validateAndSetFilterOnDescriptor( + utl::MediaDescriptor& rDescriptor, const OUString& sFilter ); @@ -316,15 +321,14 @@ public: }; -class TerminateDetection : public cppu::WeakComponentImplHelper<css::frame::XTerminateListener> +class TerminateDetection : public comphelper::WeakComponentImplHelper<css::frame::XTerminateListener> { private: - osl::Mutex m_aLock; TypeDetection* m_pTypeDetection; public: - using cppu::WeakComponentImplHelperBase::disposing; + using comphelper::WeakComponentImplHelperBase::disposing; virtual void SAL_CALL disposing(const css::lang::EventObject&) override { } @@ -340,8 +344,7 @@ public: } TerminateDetection(TypeDetection* pTypeDetection) - : cppu::WeakComponentImplHelper<css::frame::XTerminateListener>(m_aLock) - , m_pTypeDetection(pTypeDetection) + : m_pTypeDetection(pTypeDetection) { } }; diff --git a/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu new file mode 100644 index 000000000000..79c118c46d10 --- /dev/null +++ b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="APNG - Animated Portable Network Graphic" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">APNG - Animated Portable Network Graphics</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/EMZ___Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/filters/EMZ___Compressed_MS_Windows_Metafile.xcu new file mode 100644 index 000000000000..4d76ea375bad --- /dev/null +++ b/filter/source/config/fragments/filters/EMZ___Compressed_MS_Windows_Metafile.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="EMZ - Compressed MS Windows Metafile" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">EMZ - Compressed Enhanced Metafile</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu index eab7c73e316d..73ea306af0b1 100644 --- a/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu +++ b/filter/source/config/fragments/filters/MS_PowerPoint_97.xcu @@ -19,7 +19,7 @@ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value>sdfilt</value></prop> + <prop oor:name="UserData"><value>sd</value></prop> <prop oor:name="UIName"> <value xml:lang="en-US">PowerPoint 97–2003</value> </prop> diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu index 24683ea1b8b7..62358fa79ec0 100644 --- a/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu +++ b/filter/source/config/fragments/filters/MS_PowerPoint_97_AutoPlay.xcu @@ -19,7 +19,7 @@ <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN STARTPRESENTATION</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value>sdfilt</value></prop> + <prop oor:name="UserData"><value>sd</value></prop> <prop oor:name="UIName"> <value xml:lang="en-US">PowerPoint 97–2003 AutoPlay</value> </prop> diff --git a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu index 4de589b1d908..098b2947afee 100644 --- a/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu +++ b/filter/source/config/fragments/filters/MS_PowerPoint_97_Vorlage.xcu @@ -19,7 +19,7 @@ <prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE TEMPLATEPATH ALIEN</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"/> - <prop oor:name="UserData"><value>sdfilt</value></prop> + <prop oor:name="UserData"><value>sd</value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>impress_MS_PowerPoint_97_Vorlage</value></prop> <prop oor:name="TemplateName"/> diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu index c4e6f828cc77..91c7e02d226f 100644 --- a/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu +++ b/filter/source/config/fragments/filters/MS_Word_2007_XML.xcu @@ -21,8 +21,9 @@ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop> <prop oor:name="UserData"><value>OXML</value></prop> <prop oor:name="UIName"> - <value xml:lang="en-US">Word 2007–365</value> + <value xml:lang="en-US">Word 2007</value> </prop> + <!-- ECMA 376 1st edition --> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>writer_MS_Word_2007</value></prop> <prop oor:name="TemplateName"/> diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu index cd81c9943032..ab1823a70316 100644 --- a/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu +++ b/filter/source/config/fragments/filters/MS_Word_2007_XML_Template.xcu @@ -20,7 +20,8 @@ <prop oor:name="UIComponent"/> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop> <prop oor:name="UserData"><value>OXML</value></prop> - <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 Template</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 Template</value></prop> + <!-- ECMA 376 1st edition --> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>writer_MS_Word_2007_Template</value></prop> <prop oor:name="TemplateName"/> diff --git a/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu b/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu index 0f1bdb7239e4..87b561b025f7 100644 --- a/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu +++ b/filter/source/config/fragments/filters/MS_Word_2007_XML_VBA.xcu @@ -10,7 +10,8 @@ <prop oor:name="UIComponent"/> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop> <prop oor:name="UserData"><value>OXML</value></prop> - <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 VBA</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 VBA</value></prop> + <!-- ECMA 376 1st edition --> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>writer_MS_Word_2007_VBA</value></prop> <prop oor:name="TemplateName"/> diff --git a/filter/source/config/fragments/filters/OOXML_Text.xcu b/filter/source/config/fragments/filters/OOXML_Text.xcu index ebaab6406fd6..bbcceb1713d8 100644 --- a/filter/source/config/fragments/filters/OOXML_Text.xcu +++ b/filter/source/config/fragments/filters/OOXML_Text.xcu @@ -16,12 +16,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <node oor:name="Office Open XML Text" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY</value></prop> + <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER ENCRYPTION PASSWORDTOMODIFY SUPPORTSSIGNING</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop> <prop oor:name="UserData"><value></value></prop> <prop oor:name="UIName"> - <value xml:lang="en-US">Office Open XML Text (Transitional)</value> + <value xml:lang="en-US">Word 2010–365 Document</value> </prop> <!-- ISO/IEC 29500:2008 --> <prop oor:name="FileFormatVersion"><value>1</value></prop> diff --git a/filter/source/config/fragments/filters/OOXML_Text_Template.xcu b/filter/source/config/fragments/filters/OOXML_Text_Template.xcu index 88fbf7047140..55d326563bf6 100644 --- a/filter/source/config/fragments/filters/OOXML_Text_Template.xcu +++ b/filter/source/config/fragments/filters/OOXML_Text_Template.xcu @@ -16,12 +16,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <node oor:name="Office Open XML Text Template" oor:op="replace"> - <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH</value></prop> + <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH</value></prop> <prop oor:name="UIComponent"/> <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop> <prop oor:name="UserData"><value></value></prop> <prop oor:name="UIName"> - <value xml:lang="en-US">Office Open XML Text Template (Transitional)</value> + <value xml:lang="en-US">Word 2010–365 Template</value> </prop> <!-- ISO/IEC 29500:2008 --> <prop oor:name="FileFormatVersion"><value>1</value></prop> diff --git a/filter/source/config/fragments/filters/SVGZ___Compressed_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/filters/SVGZ___Compressed_Scalable_Vector_Graphics.xcu new file mode 100644 index 000000000000..35753a1f1a8b --- /dev/null +++ b/filter/source/config/fragments/filters/SVGZ___Compressed_Scalable_Vector_Graphics.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="SVGZ - Compressed Scalable Vector Graphics" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">SVGZ - Compressed Scalable Vector Graphics</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/WEBP___WebP.xcu b/filter/source/config/fragments/filters/WEBP___WebP.xcu new file mode 100644 index 000000000000..9c650e3de42e --- /dev/null +++ b/filter/source/config/fragments/filters/WEBP___WebP.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="WEBP - WebP" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/WMZ___Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/filters/WMZ___Compressed_MS_Windows_Metafile.xcu new file mode 100644 index 000000000000..875dfb8ac295 --- /dev/null +++ b/filter/source/config/fragments/filters/WMZ___Compressed_MS_Windows_Metafile.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="WMZ - Compressed MS Windows Metafile" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WMZ - Compressed Windows Metafile</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/calc_Parquet.xcu b/filter/source/config/fragments/filters/calc_Parquet.xcu new file mode 100644 index 000000000000..5b0fea8257bb --- /dev/null +++ b/filter/source/config/fragments/filters/calc_Parquet.xcu @@ -0,0 +1,19 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. +--> +<node oor:name="Apache Parquet Spreadsheet" oor:op="replace"> + <prop oor:name="Flags"><value>IMPORT ALIEN PREFERRED</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"/> + <prop oor:name="Type"><value>Apache Parquet</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">Apache Parquet Spreadsheet</value> + </prop> +</node> diff --git a/filter/source/config/fragments/filters/calc_webp_Export.xcu b/filter/source/config/fragments/filters/calc_webp_Export.xcu new file mode 100644 index 000000000000..a6e5d18a3347 --- /dev/null +++ b/filter/source/config/fragments/filters/calc_webp_Export.xcu @@ -0,0 +1,20 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. +--> + <node oor:name="calc_webp_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER SUPPORTSSELECTION</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"><value>com.sun.star.comp.GraphicExportFilter</value></prop> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/draw_apng_Export.xcu b/filter/source/config/fragments/filters/draw_apng_Export.xcu new file mode 100644 index 000000000000..f413ca74711a --- /dev/null +++ b/filter/source/config/fragments/filters/draw_apng_Export.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="draw_apng_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">APNG - Animated Portable Network Graphics</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/draw_emz_Export.xcu b/filter/source/config/fragments/filters/draw_emz_Export.xcu new file mode 100644 index 000000000000..5c1aae3a761c --- /dev/null +++ b/filter/source/config/fragments/filters/draw_emz_Export.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="draw_emz_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">EMZ - Compressed Enhanced Metafile</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/draw_html_Export.xcu b/filter/source/config/fragments/filters/draw_html_Export.xcu index 179c7bb7edc0..ebb14b75b19f 100644 --- a/filter/source/config/fragments/filters/draw_html_Export.xcu +++ b/filter/source/config/fragments/filters/draw_html_Export.xcu @@ -17,8 +17,8 @@ --> <node oor:name="draw_html_Export" oor:op="replace"> <prop oor:name="Flags"><value>EXPORT ALIEN</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.comp.draw.SdHtmlOptionsDialog</value></prop> - <prop oor:name="FilterService"/> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"></prop> <prop oor:name="UserData"><value></value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>graphic_HTML</value></prop> diff --git a/filter/source/config/fragments/filters/draw_svgz_Export.xcu b/filter/source/config/fragments/filters/draw_svgz_Export.xcu new file mode 100644 index 000000000000..59af9fa1d5d4 --- /dev/null +++ b/filter/source/config/fragments/filters/draw_svgz_Export.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="draw_svgz_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">SVGZ - Compressed Scalable Vector Graphics</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/draw_webp_Export.xcu b/filter/source/config/fragments/filters/draw_webp_Export.xcu new file mode 100644 index 000000000000..e6da69197a61 --- /dev/null +++ b/filter/source/config/fragments/filters/draw_webp_Export.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="draw_webp_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/draw_wmz_Export.xcu b/filter/source/config/fragments/filters/draw_wmz_Export.xcu new file mode 100644 index 000000000000..272880aa4b0a --- /dev/null +++ b/filter/source/config/fragments/filters/draw_wmz_Export.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="draw_wmz_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WMZ - Compressed Windows Metafile</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/impress_html_Export.xcu b/filter/source/config/fragments/filters/impress_html_Export.xcu index 65a5c5dadf78..1e0fb435e01e 100644 --- a/filter/source/config/fragments/filters/impress_html_Export.xcu +++ b/filter/source/config/fragments/filters/impress_html_Export.xcu @@ -17,8 +17,8 @@ --> <node oor:name="impress_html_Export" oor:op="replace"> <prop oor:name="Flags"><value>EXPORT ALIEN</value></prop> - <prop oor:name="UIComponent"><value>com.sun.star.comp.draw.SdHtmlOptionsDialog</value></prop> - <prop oor:name="FilterService"/> + <prop oor:name="UIComponent"/> + <prop oor:name="FilterService"></prop> <prop oor:name="UserData"><value></value></prop> <prop oor:name="FileFormatVersion"><value>0</value></prop> <prop oor:name="Type"><value>graphic_HTML</value></prop> diff --git a/filter/source/config/fragments/filters/impress_webp_Export.xcu b/filter/source/config/fragments/filters/impress_webp_Export.xcu new file mode 100644 index 000000000000..00284a272cba --- /dev/null +++ b/filter/source/config/fragments/filters/impress_webp_Export.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="impress_webp_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN SUPPORTSSELECTION</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"/> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/writer_web_webp_Export.xcu b/filter/source/config/fragments/filters/writer_web_webp_Export.xcu new file mode 100644 index 000000000000..5273bb72228b --- /dev/null +++ b/filter/source/config/fragments/filters/writer_web_webp_Export.xcu @@ -0,0 +1,21 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> + <node oor:name="writer_web_webp_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"><value>com.sun.star.comp.GraphicExportFilter</value></prop> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/filters/writer_webp_Export.xcu b/filter/source/config/fragments/filters/writer_webp_Export.xcu new file mode 100644 index 000000000000..ceb56a8c035f --- /dev/null +++ b/filter/source/config/fragments/filters/writer_webp_Export.xcu @@ -0,0 +1,30 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="writer_webp_Export" oor:op="replace"> + <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="FilterService"><value>com.sun.star.comp.GraphicExportFilter</value></prop> + <prop oor:name="UserData"><value></value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="FileFormatVersion"><value>0</value></prop> + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="TemplateName"/> + <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu new file mode 100644 index 000000000000..2bf240fa801a --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="apng_Export" oor:op="replace" > + <prop oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</value></prop> + <prop oor:name="FormatName"><value>SVEAPNG</value></prop> + <prop oor:name="RealFilterName"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">APNG - Animated Portable Network Graphics</value> + </prop> + <prop oor:name="Flags"><value>EXPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/emz_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/emz_Export.xcu new file mode 100644 index 000000000000..40ccb11105b3 --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/emz_Export.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="emz_Export" oor:op="replace" > + <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="FormatName"><value>SVEMZ</value></prop> + <prop oor:name="RealFilterName"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">EMZ - Compressed Enhanced Metafile</value> + </prop> + <prop oor:name="Flags"><value>EXPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/emz_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/emz_Import.xcu new file mode 100644 index 000000000000..590ef29d567b --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/emz_Import.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="emz_Import" oor:op="replace" > + <prop oor:name="Type"><value>emz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="FormatName"><value>SVEMZ</value></prop> + <prop oor:name="RealFilterName"><value>EMZ - Compressed MS Windows Metafile</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="UIName"> + <value xml:lang="en-US">EMZ - Compressed Enhanced Metafile</value> + </prop> + <prop oor:name="Flags"><value>IMPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/svgz_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/svgz_Export.xcu new file mode 100644 index 000000000000..8231ca965ff1 --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/svgz_Export.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="svgz_Export" oor:op="replace" > + <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</value></prop> + <prop oor:name="FormatName"><value>SVESVGZ</value></prop> + <prop oor:name="RealFilterName"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">SVGZ - Compressed Scalable Vector Graphics</value> + </prop> + <prop oor:name="Flags"><value>EXPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/svgz_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/svgz_Import.xcu new file mode 100644 index 000000000000..fe0d2deaac2a --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/svgz_Import.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="svgz_Import" oor:op="replace" > + <prop oor:name="Type"><value>svgz_Compressed_Scalable_Vector_Graphics</value></prop> + <prop oor:name="FormatName"><value>SVISVGZ</value></prop> + <prop oor:name="RealFilterName"><value>SVGZ - Compressed Scalable Vector Graphics</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="UIName"> + <value xml:lang="en-US">SVGZ - Compressed Scalable Vector Graphics</value> + </prop> + <prop oor:name="Flags"><value>IMPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu new file mode 100644 index 000000000000..70ff15429734 --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="webp_Export" oor:op="replace" > + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="FormatName"><value>SVEWEBP</value></prop> + <prop oor:name="RealFilterName"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="Flags"><value>EXPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu new file mode 100644 index 000000000000..cdce5c9e4047 --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="webp_Import" oor:op="replace" > + <prop oor:name="Type"><value>webp_WebP</value></prop> + <prop oor:name="FormatName"><value>SVIWEBP</value></prop> + <prop oor:name="RealFilterName"><value>WEBP - WebP</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="UIName"> + <value xml:lang="en-US">WEBP - WebP Image</value> + </prop> + <prop oor:name="Flags"><value>IMPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/wmz_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/wmz_Export.xcu new file mode 100644 index 000000000000..69b9aec9e0e2 --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/wmz_Export.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="wmz_Export" oor:op="replace" > + <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="FormatName"><value>SVWMZ</value></prop> + <prop oor:name="RealFilterName"/> + <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop> + <prop oor:name="UIName"> + <value xml:lang="en-US">WMZ - Compressed Windows Metafile</value> + </prop> + <prop oor:name="Flags"><value>EXPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/internalgraphicfilters/wmz_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/wmz_Import.xcu new file mode 100644 index 000000000000..9f124f1a1817 --- /dev/null +++ b/filter/source/config/fragments/internalgraphicfilters/wmz_Import.xcu @@ -0,0 +1,27 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="wmz_Import" oor:op="replace" > + <prop oor:name="Type"><value>wmz_Compressed_MS_Windows_Metafile</value></prop> + <prop oor:name="FormatName"><value>SVWMZ</value></prop> + <prop oor:name="RealFilterName"><value>WMZ - Compressed MS Windows Metafile</value></prop> + <prop oor:name="UIComponent"/> + <prop oor:name="UIName"> + <value xml:lang="en-US">WMZ - Compressed Windows Metafile</value> + </prop> + <prop oor:name="Flags"><value>IMPORT</value></prop> + </node> diff --git a/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu b/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu new file mode 100644 index 000000000000..b094e81e912d --- /dev/null +++ b/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu @@ -0,0 +1,29 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="apng_Animated_Portable_Network_Graphic" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>apng</value></prop> + <prop oor:name="MediaType"><value>image/apng</value></prop> + <prop oor:name="Preferred"><value>false</value></prop> + <prop oor:name="PreferredFilter"><value>APNG - Animated Portable Network Graphic</value></prop> + <prop oor:name="UIName"> + <value>APNG - Animated Portable Network Graphic</value> + </prop> + <prop oor:name="ClipboardFormat"/> + </node> diff --git a/filter/source/config/fragments/types/calc_Parquet.xcu b/filter/source/config/fragments/types/calc_Parquet.xcu new file mode 100644 index 000000000000..6c29d886c92f --- /dev/null +++ b/filter/source/config/fragments/types/calc_Parquet.xcu @@ -0,0 +1,17 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. +--> +<node oor:name="Apache Parquet" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.sc.OrcusFilterDetect</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>parquet</value></prop> + <prop oor:name="MediaType"/> + <prop oor:name="Preferred"><value>true</value></prop> + <prop oor:name="PreferredFilter"><value>Apache Parquet Spreadsheet</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Apache Parquet</value></prop> + <prop oor:name="ClipboardFormat"/> +</node> diff --git a/filter/source/config/fragments/types/emz_Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/emz_Compressed_MS_Windows_Metafile.xcu new file mode 100644 index 000000000000..b2dfeb3f9532 --- /dev/null +++ b/filter/source/config/fragments/types/emz_Compressed_MS_Windows_Metafile.xcu @@ -0,0 +1,29 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="emz_Compressed_MS_Windows_Metafile" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>emz</value></prop> + <prop oor:name="MediaType"><value>image/x-emf</value></prop> + <prop oor:name="Preferred"><value>false</value></prop> + <prop oor:name="PreferredFilter"><value>EMZ - Compressed MS Windows Metafile</value></prop> + <prop oor:name="UIName"> + <value>EMZ - Compressed Enhanced Meta File</value> + </prop> + <prop oor:name="ClipboardFormat"/> + </node> diff --git a/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu index 7fe5e2adbfda..0b5be4b19923 100644 --- a/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu +++ b/filter/source/config/fragments/types/png_Portable_Network_Graphic.xcu @@ -18,7 +18,7 @@ <node oor:name="png_Portable_Network_Graphic" oor:op="replace" > <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>png</value></prop> + <prop oor:name="Extensions"><value>png apng</value></prop> <prop oor:name="MediaType"><value>image/png</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>PNG - Portable Network Graphic</value></prop> diff --git a/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu index a2015a536873..04b08c08b664 100644 --- a/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu +++ b/filter/source/config/fragments/types/svg_Scalable_Vector_Graphics.xcu @@ -18,7 +18,7 @@ <node oor:name="svg_Scalable_Vector_Graphics" oor:op="replace" > <prop oor:name="DetectService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop> <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>svg svgz</value></prop> + <prop oor:name="Extensions"><value>svg</value></prop> <prop oor:name="MediaType"><value>image/svg+xml</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>SVG - Scalable Vector Graphics</value></prop> diff --git a/filter/source/config/fragments/types/svgz_Compressed_Scalable_Vector_Graphics.xcu b/filter/source/config/fragments/types/svgz_Compressed_Scalable_Vector_Graphics.xcu new file mode 100644 index 000000000000..7ba66f15f092 --- /dev/null +++ b/filter/source/config/fragments/types/svgz_Compressed_Scalable_Vector_Graphics.xcu @@ -0,0 +1,29 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="svgz_Compressed_Scalable_Vector_Graphics" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>svgz</value></prop> + <prop oor:name="MediaType"><value>image/svg+xml</value></prop> + <prop oor:name="Preferred"><value>false</value></prop> + <prop oor:name="PreferredFilter"><value>SVGZ - Compressed Scalable Vector Graphics</value></prop> + <prop oor:name="UIName"> + <value>SVGZ - Compressed Scalable Vector Graphics</value> + </prop> + <prop oor:name="ClipboardFormat"/> + </node> diff --git a/filter/source/config/fragments/types/webp_WebP.xcu b/filter/source/config/fragments/types/webp_WebP.xcu new file mode 100644 index 000000000000..e58984fbedc7 --- /dev/null +++ b/filter/source/config/fragments/types/webp_WebP.xcu @@ -0,0 +1,29 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="webp_WebP" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>webp</value></prop> + <prop oor:name="MediaType"><value>image/webp</value></prop> + <prop oor:name="Preferred"><value>false</value></prop> + <prop oor:name="PreferredFilter"><value>WEBP - WebP</value></prop> + <prop oor:name="UIName"> + <value>WEBP - WebP Image</value> + </prop> + <prop oor:name="ClipboardFormat"/> + </node> diff --git a/filter/source/config/fragments/types/wmz_Compressed_MS_Windows_Metafile.xcu b/filter/source/config/fragments/types/wmz_Compressed_MS_Windows_Metafile.xcu new file mode 100644 index 000000000000..859c9d6d27bd --- /dev/null +++ b/filter/source/config/fragments/types/wmz_Compressed_MS_Windows_Metafile.xcu @@ -0,0 +1,29 @@ +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + <node oor:name="wmz_Compressed_MS_Windows_Metafile" oor:op="replace" > + <prop oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop> + <prop oor:name="URLPattern"/> + <prop oor:name="Extensions"><value>wmz</value></prop> + <prop oor:name="MediaType"><value>image/x-wmf</value></prop> + <prop oor:name="Preferred"><value>false</value></prop> + <prop oor:name="PreferredFilter"><value>WMZ - Compressed MS Windows Metafile</value></prop> + <prop oor:name="UIName"> + <value>WMZ - Compressed Windows Metafile</value> + </prop> + <prop oor:name="ClipboardFormat"/> + </node> diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu index 75cb091cd0aa..11396057a026 100644 --- a/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu +++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML.xcu @@ -22,6 +22,6 @@ <prop oor:name="MediaType"><value>application/msword</value></prop> <prop oor:name="Preferred"><value>true</value></prop> <prop oor:name="PreferredFilter"><value>MS Word 2007 XML</value></prop> - <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Word 2007</value></prop> <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop> </node> diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu index 391cc20cec3b..059e7078a40e 100644 --- a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu +++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_Template.xcu @@ -22,6 +22,6 @@ <prop oor:name="MediaType"><value>application/msword</value></prop> <prop oor:name="Preferred"><value>true</value></prop> <prop oor:name="PreferredFilter"><value>MS Word 2007 XML Template</value></prop> - <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 Template</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 Template</value></prop> <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop> </node> diff --git a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu index 8a44c1e5f3a2..0519bcd7dac7 100644 --- a/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu +++ b/filter/source/config/fragments/types/writer_MS_Word_2007_XML_VBA.xcu @@ -12,6 +12,6 @@ <prop oor:name="MediaType"><value>application/msword</value></prop> <prop oor:name="Preferred"><value>true</value></prop> <prop oor:name="PreferredFilter"><value>MS Word 2007 XML VBA</value></prop> - <prop oor:name="UIName"><value xml:lang="en-US">Word 2007–365 VBA</value></prop> + <prop oor:name="UIName"><value xml:lang="en-US">Word 2007 VBA</value></prop> <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop> </node> diff --git a/filter/source/config/fragments/types/writer_OOXML.xcu b/filter/source/config/fragments/types/writer_OOXML.xcu index 8d6a025fdac2..079a6421f072 100644 --- a/filter/source/config/fragments/types/writer_OOXML.xcu +++ b/filter/source/config/fragments/types/writer_OOXML.xcu @@ -23,7 +23,7 @@ <prop oor:name="Preferred"><value>true</value></prop> <prop oor:name="PreferredFilter"><value>Office Open XML Text</value></prop> <prop oor:name="UIName"> - <value>Office Open XML Text Document (Transitional)</value> + <value>Word 2010–365 Document</value> </prop> <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop> </node> diff --git a/filter/source/config/fragments/types/writer_OOXML_Template.xcu b/filter/source/config/fragments/types/writer_OOXML_Template.xcu index 39f499eb6b68..a9d424b967b4 100644 --- a/filter/source/config/fragments/types/writer_OOXML_Template.xcu +++ b/filter/source/config/fragments/types/writer_OOXML_Template.xcu @@ -23,7 +23,7 @@ <prop oor:name="Preferred"><value>true</value></prop> <prop oor:name="PreferredFilter"><value>Office Open XML Text Template</value></prop> <prop oor:name="UIName"> - <value>Office Open XML Text Template (Transitional)</value> + <value>Word 2010–365 Template</value> </prop> <prop oor:name="ClipboardFormat"><value>MSWordDoc</value></prop> </node> diff --git a/filter/source/config/tools/merge/FCFGMerge.cfg b/filter/source/config/tools/merge/FCFGMerge.cfg index 8a0b4b78fec8..041a16a9f17b 100644 --- a/filter/source/config/tools/merge/FCFGMerge.cfg +++ b/filter/source/config/tools/merge/FCFGMerge.cfg @@ -32,7 +32,7 @@ loglevel = 2 # This extension is used for all XML files. It doesn't # matter if it's used for reading fragments or writing # XML packages. -# Must be given without any additional signes like "." +# Must be given without any additional signs like "." # or "*."! # # [REQUIRED] @@ -44,7 +44,7 @@ extension_xcu=xcu # This extension is used for all Package files. It doesn't # matter if it's used for reading such files or writing # it. -# Must be given without any additional signes like "." +# Must be given without any additional signs like "." # or "*."! # # [REQUIRED] |