bin/lo-xlate-lang | 1 chart2/source/tools/CharacterProperties.cxx | 2 cui/source/dialogs/tipofthedaydlg.cxx | 28 - cui/source/factory/dlgfact.cxx | 11 cui/source/factory/dlgfact.hxx | 8 cui/source/inc/securityoptions.hxx | 1 cui/source/inc/tipofthedaydlg.hxx | 2 cui/source/options/optinet2.cxx | 38 - cui/source/options/securityoptions.cxx | 30 + distro-configs/CPiOSBranding.conf | 32 - download.lst | 4 filter/qa/pdf.cxx | 10 filter/source/config/cache/filtercache.cxx | 224 +++++----- filter/source/config/cache/filtercache.hxx | 41 - filter/source/storagefilterdetect/filterdetect.cxx | 52 +- include/sfx2/sfxdlg.hxx | 2 include/sfx2/sfxsids.hrc | 1 include/svx/svxdlg.hxx | 2 include/unotest/macros_test.hxx | 6 include/vcl/abstdlg.hxx | 8 oox/source/core/xmlfilterbase.cxx | 4 package/source/zipapi/ZipFile.cxx | 45 +- sc/qa/extras/macros-test.cxx | 27 + sc/qa/extras/testdocuments/tdf159412.fods | 41 + sc/source/core/data/colcontainer.cxx | 5 sc/source/core/data/table2.cxx | 2 scripting/source/basprov/basscript.cxx | 19 sfx2/sdi/appslots.sdi | 4 sfx2/sdi/sfx.sdi | 17 sfx2/source/appl/appserv.cxx | 14 sfx2/source/doc/docfile.cxx | 15 sfx2/source/doc/objstor.cxx | 1 sfx2/source/view/viewfrm.cxx | 3 shell/source/unix/exec/shellexec.cxx | 30 + slideshow/source/engine/slideoverlaybutton.cxx | 10 slideshow/source/engine/slideoverlaybutton.hxx | 1 solenv/clang-format/excludelist | 2 svgio/inc/svgstyleattributes.hxx | 3 svgio/inc/svgsymbolnode.hxx | 15 svgio/qa/cppunit/SvgImportTest.cxx | 21 svgio/qa/cppunit/data/tdf156834.svg | 3 svgio/qa/cppunit/data/tdf158445.svg | 5 svgio/source/svgreader/svgcharacternode.cxx | 1 svgio/source/svgreader/svgstyleattributes.cxx | 4 svgio/source/svgreader/svgsymbolnode.cxx | 94 ++++ sw/Library_sw.mk | 1 sw/inc/IDocumentSettingAccess.hxx | 2 sw/qa/extras/odfexport/data/footnote_spacing_hanging_para.doc |binary sw/qa/extras/odfexport/data/footnote_spacing_hanging_para.docx |binary sw/qa/extras/odfexport/data/footnote_spacing_hanging_para.rtf | 209 +++++++++ sw/qa/extras/odfexport/odfexport2.cxx | 99 ++++ sw/qa/extras/odfimport/data/unreferenced_stream.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 15 sw/source/core/access/AccessibilityCheck.cxx | 4 sw/source/core/doc/DocumentSettingManager.cxx | 11 sw/source/core/inc/DocumentSettingManager.hxx | 1 sw/source/core/text/inftxt.cxx | 2 sw/source/core/text/porfld.cxx | 7 sw/source/core/unocore/unoportenum.cxx | 16 sw/source/filter/ww8/ww8par.cxx | 1 sw/source/uibase/uno/SwXDocumentSettings.cxx | 13 toolkit/source/awt/vclxmenu.cxx | 7 unotest/source/cpp/macros_test.cxx | 46 +- unotools/source/config/optionsdlg.cxx | 4 vcl/inc/skia/zone.hxx | 7 vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 10 vcl/source/app/salvtables.cxx | 6 vcl/source/window/menu.cxx | 10 writerfilter/source/dmapper/DomainMapper.cxx | 2 writerfilter/source/filter/WriterFilter.cxx | 1 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx | 9 xmlsecurity/qa/unit/signing/signing.cxx | 5 xmlsecurity/qa/unit/signing/signing2.cxx | 5 xmlsecurity/source/dialogs/certificatechooser.cxx | 3 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 75 ++- 75 files changed, 1113 insertions(+), 347 deletions(-)
New commits: commit 1d5d02e099a5465a82613044a8a61cd618c877c3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Feb 2 18:51:59 2024 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#159461 deadlock in Dialog "XML Filter Settings" revert commit 15405dc68b2e88b53585578567da13e3e99962db Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Feb 20 15:43:41 2023 +0200 osl::Mutex->std::mutex in FilterCache There is much recursive behaviour going on here, via the configmgr and the listeners that FilterCache has. Change-Id: Ice003404dffad9e5e63bcff30c2ceede4f52cab8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162930 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit b23aec2266da4cc2b3f4a34037d3a073a36d3d83) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162905 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 8a6f88703823..7e32ce03c871 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -119,7 +119,7 @@ FilterCache::~FilterCache() std::unique_ptr<FilterCache> FilterCache::clone() const { // SAFE -> ---------------------------------- - std::unique_lock aGuard(m_aMutex); + 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 -> ---------------------------------- - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // a) // Don't copy the configuration access points here! @@ -192,14 +192,14 @@ void FilterCache::takeOver(const FilterCache& rClone) // Because we can't be sure, that changed filters on one clone // and changed types of another clone work together. // But here we can check against the later changes... - impl_validateAndOptimize(aGuard); + impl_validateAndOptimize(); // <- SAFE ---------------------------------- } void FilterCache::load(EFillState eRequired) { // SAFE -> ---------------------------------- - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // check if required fill state is already reached ... // There is nothing to do then. @@ -217,28 +217,28 @@ void FilterCache::load(EFillState eRequired) // office document with a minimal set of values. if (m_eFillState == E_CONTAINS_NOTHING) { - impl_getDirectCFGValue(aGuard, CFGDIRECTKEY_OFFICELOCALE) >>= m_sActLocale; + impl_getDirectCFGValue(CFGDIRECTKEY_OFFICELOCALE) >>= m_sActLocale; if (m_sActLocale.isEmpty()) { m_sActLocale = DEFAULT_OFFICELOCALE; } // Support the old configuration support. Read it only one times during office runtime! - impl_readOldFormat(aGuard); + impl_readOldFormat(); } // b) If the required fill state was not reached // but std values was already loaded ... // we must load some further missing items. - impl_load(aGuard, eRequired); + impl_load(eRequired); // <- SAFE } bool FilterCache::isFillState(FilterCache::EFillState eState) const { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); return ((m_eFillState & eState) == eState); // <- SAFE } @@ -249,12 +249,12 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp std::span< const css::beans::NamedValue > lEProps) const { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - const CacheItemList& rList = impl_getItemList(aGuard, eType); + const CacheItemList& rList = impl_getItemList(eType); std::vector<OUString> lKeys; lKeys.reserve(rList.size()); @@ -280,12 +280,12 @@ std::vector<OUString> FilterCache::getMatchingItemsByProps( EItemType eTyp bool FilterCache::hasItems(EItemType eType) const { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - const CacheItemList& rList = impl_getItemList(aGuard, eType); + const CacheItemList& rList = impl_getItemList(eType); return !rList.empty(); // <- SAFE @@ -295,17 +295,12 @@ bool FilterCache::hasItems(EItemType eType) const std::vector<OUString> FilterCache::getItemNames(EItemType eType) const { // SAFE -> - std::unique_lock aGuard(m_aMutex); - return getItemNames(aGuard, eType); - // <- SAFE -} + osl::MutexGuard aLock(m_aMutex); -std::vector<OUString> FilterCache::getItemNames(std::unique_lock<std::mutex>& rGuard, EItemType eType) const -{ // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - const CacheItemList& rList = impl_getItemList(rGuard, eType); + const CacheItemList& rList = impl_getItemList(eType); std::vector<OUString> lKeys; for (auto const& elem : rList) @@ -313,6 +308,7 @@ std::vector<OUString> FilterCache::getItemNames(std::unique_lock<std::mutex>& rG lKeys.push_back(elem.first); } return lKeys; + // <- SAFE } @@ -320,12 +316,12 @@ bool FilterCache::hasItem( EItemType eType, const OUString& sItem) { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - const CacheItemList& rList = impl_getItemList(aGuard, eType); + const CacheItemList& rList = impl_getItemList(eType); // if item could not be found - check if it can be loaded // from the underlying configuration layer. Might it was not already @@ -336,7 +332,7 @@ bool FilterCache::hasItem( EItemType eType, try { - impl_loadItemOnDemand(aGuard, eType, sItem); + impl_loadItemOnDemand(eType, sItem); // no exception => item could be loaded! return true; } @@ -352,22 +348,21 @@ CacheItem FilterCache::getItem( EItemType eType, const OUString& sItem) { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); - CacheItem aItem = impl_getItem(aGuard, eType, sItem); + CacheItem aItem = impl_getItem(eType, sItem); // <- SAFE return aItem; } -CacheItem& FilterCache::impl_getItem( std::unique_lock<std::mutex>& rGuard, - EItemType eType, +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. - CacheItemList& rList = impl_getItemList(rGuard, eType); + CacheItemList& rList = impl_getItemList(eType); // check if item exists ... CacheItemList::iterator pIt = rList.find(sItem); @@ -377,7 +372,7 @@ CacheItem& FilterCache::impl_getItem( std::unique_lock<std::mutex>& rGuard, // underlying configuration layer. // Note: NoSuchElementException is thrown automatically here if // item could not be loaded! - pIt = impl_loadItemOnDemand(rGuard, eType, sItem); + pIt = impl_loadItemOnDemand(eType, sItem); } /* Workaround for #137955# @@ -395,7 +390,7 @@ CacheItem& FilterCache::impl_getItem( std::unique_lock<std::mutex>& rGuard, // but it is there to load help pages bool bIsHelpFilter = sItem == "writer_web_HTML_help"; - if ( !bIsHelpFilter && !impl_isModuleInstalled(rGuard, sDocService) ) + if ( !bIsHelpFilter && !impl_isModuleInstalled(sDocService) ) { OUString sMsg("The requested filter '" + sItem + "' exists ... but it should not; because the corresponding LibreOffice module was not installed."); @@ -411,16 +406,16 @@ void FilterCache::removeItem( EItemType eType, const OUString& sItem) { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - CacheItemList& rList = impl_getItemList(aGuard, eType); + CacheItemList& rList = impl_getItemList(eType); CacheItemList::iterator pItem = rList.find(sItem); if (pItem == rList.end()) - pItem = impl_loadItemOnDemand(aGuard, eType, sItem); // throws NoSuchELementException! + pItem = impl_loadItemOnDemand(eType, sItem); // throws NoSuchELementException! rList.erase(pItem); impl_addItem2FlushList(eType, sItem); @@ -432,12 +427,12 @@ void FilterCache::setItem( EItemType eType , const CacheItem& aValue) { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - CacheItemList& rList = impl_getItemList(aGuard, eType); + CacheItemList& rList = impl_getItemList(eType); // name must be part of the property set too ... otherwise our // container query can't work correctly @@ -459,8 +454,8 @@ void FilterCache::refreshItem( EItemType eType, const OUString& sItem) { // SAFE -> - std::unique_lock aGuard(m_aMutex); - impl_loadItemOnDemand(aGuard, eType, sItem); + osl::MutexGuard aLock(m_aMutex); + impl_loadItemOnDemand(eType, sItem); } @@ -468,9 +463,9 @@ css::uno::Any FilterCache::getItemWithStateProps( EItemType eType, const OUString& sItem) { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); - const CacheItem& rItem = impl_getItem(aGuard, eType, sItem); + 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... @@ -480,14 +475,14 @@ css::uno::Any FilterCache::getItemWithStateProps( EItemType eType, { case E_TYPE : { - xPackage.set(impl_openConfig(aGuard, E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); + xPackage.set(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); xPackage->getByName(CFGSET_TYPES) >>= xSet; } break; case E_FILTER : { - xPackage.set(impl_openConfig(aGuard, E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW); + xPackage.set(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW); xPackage->getByName(CFGSET_FILTERS) >>= xSet; } break; @@ -501,7 +496,7 @@ css::uno::Any FilterCache::getItemWithStateProps( EItemType eType, about FINALIZED and MANDATORY very easy ... :-( => set it to readonly/required everytimes :-) */ - css::uno::Any aDirectValue = impl_getDirectCFGValue(aGuard, CFGDIRECTKEY_DEFAULTFRAMELOADER); + css::uno::Any aDirectValue = impl_getDirectCFGValue(CFGDIRECTKEY_DEFAULTFRAMELOADER); OUString sDefaultFrameLoader; if ( (aDirectValue >>= sDefaultFrameLoader) && @@ -514,14 +509,14 @@ css::uno::Any FilterCache::getItemWithStateProps( EItemType eType, } /* <-- HACK */ - xPackage.set(impl_openConfig(aGuard, E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); + xPackage.set(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); xPackage->getByName(CFGSET_FRAMELOADERS) >>= xSet; } break; case E_CONTENTHANDLER : { - xPackage.set(impl_openConfig(aGuard, E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); + xPackage.set(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); xPackage->getByName(CFGSET_CONTENTHANDLERS) >>= xSet; } break; @@ -575,14 +570,14 @@ void FilterCache::removeStatePropsFromItem(CacheItem& rItem) void FilterCache::flush() { // SAFE -> - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // renew all dependencies and optimizations - impl_validateAndOptimize(aGuard); + impl_validateAndOptimize(); if (!m_lChangedTypes.empty()) { - css::uno::Reference< css::container::XNameAccess > xConfig(impl_openConfig(aGuard, E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xConfig(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::container::XNameAccess > xSet ; xConfig->getByName(CFGSET_TYPES) >>= xSet; @@ -594,7 +589,7 @@ void FilterCache::flush() if (!m_lChangedFilters.empty()) { - css::uno::Reference< css::container::XNameAccess > xConfig(impl_openConfig(aGuard, E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xConfig(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW); css::uno::Reference< css::container::XNameAccess > xSet ; xConfig->getByName(CFGSET_FILTERS) >>= xSet; @@ -677,7 +672,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , sExtension = sExtension.toAsciiLowerCase(); // SAFE -> ---------------------------------- - std::unique_lock aGuard(m_aMutex); + osl::MutexGuard aLock(m_aMutex); // i) Step over all well known URL pattern @@ -723,8 +718,11 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , // <- SAFE ---------------------------------- } -const CacheItemList& FilterCache::impl_getItemList(std::unique_lock<std::mutex>& /*rGuard*/, EItemType eType) const +const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const { + // SAFE -> ---------------------------------- + osl::MutexGuard aLock(m_aMutex); + switch(eType) { case E_TYPE : return m_lTypes ; @@ -736,10 +734,14 @@ const CacheItemList& FilterCache::impl_getItemList(std::unique_lock<std::mutex>& throw css::uno::RuntimeException("unknown sub container requested.", css::uno::Reference< css::uno::XInterface >()); + // <- SAFE ---------------------------------- } -CacheItemList& FilterCache::impl_getItemList(std::unique_lock<std::mutex>& /*rGuard*/, EItemType eType) +CacheItemList& FilterCache::impl_getItemList(EItemType eType) { + // SAFE -> ---------------------------------- + osl::MutexGuard aLock(m_aMutex); + switch(eType) { case E_TYPE : return m_lTypes ; @@ -751,10 +753,13 @@ CacheItemList& FilterCache::impl_getItemList(std::unique_lock<std::mutex>& /*rGu throw css::uno::RuntimeException("unknown sub container requested.", css::uno::Reference< css::uno::XInterface >()); + // <- SAFE ---------------------------------- } -css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(std::unique_lock<std::mutex>& rGuard, EConfigProvider eProvider) +css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider) { + osl::MutexGuard aLock(m_aMutex); + OUString sPath ; css::uno::Reference< css::uno::XInterface >* pConfig = nullptr; css::uno::Reference< css::uno::XInterface > xOld ; @@ -807,7 +812,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(std::un { SAL_INFO( "filter.config", "" << sRtlLog); - *pConfig = impl_createConfigAccess(rGuard, sPath , + *pConfig = impl_createConfigAccess(sPath , false, // bReadOnly true ); // bLocalesMode } @@ -835,7 +840,7 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(std::un return *pConfig; } -css::uno::Any FilterCache::impl_getDirectCFGValue(std::unique_lock<std::mutex>& rGuard, std::u16string_view sDirectKey) +css::uno::Any FilterCache::impl_getDirectCFGValue(std::u16string_view sDirectKey) { OUString sRoot; OUString sKey ; @@ -847,7 +852,7 @@ css::uno::Any FilterCache::impl_getDirectCFGValue(std::unique_lock<std::mutex>& ) return css::uno::Any(); - css::uno::Reference< css::uno::XInterface > xCfg = impl_createConfigAccess(rGuard, sRoot , + css::uno::Reference< css::uno::XInterface > xCfg = impl_createConfigAccess(sRoot , true , // bReadOnly false); // bLocalesMode if (!xCfg.is()) @@ -874,11 +879,13 @@ css::uno::Any FilterCache::impl_getDirectCFGValue(std::unique_lock<std::mutex>& } -css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess(std::unique_lock<std::mutex>& /*rGuard*/, - const OUString& sRoot , +css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess(const OUString& sRoot , bool bReadOnly , bool bLocalesMode) { + // SAFE -> + osl::MutexGuard aLock(m_aMutex); + css::uno::Reference< css::uno::XInterface > xCfg; if (!utl::ConfigManager::IsFuzzing()) @@ -930,11 +937,15 @@ css::uno::Reference< css::uno::XInterface > FilterCache::impl_createConfigAccess } return xCfg; + // <- SAFE } -void FilterCache::impl_validateAndOptimize(std::unique_lock<std::mutex>& rGuard) +void FilterCache::impl_validateAndOptimize() { + // SAFE -> + osl::MutexGuard aLock(m_aMutex); + // First check if any filter or type could be read // from the underlying configuration! bool bSomeTypesShouldExist = ((m_eFillState & E_CONTAINS_STANDARD ) == E_CONTAINS_STANDARD ); @@ -1148,7 +1159,7 @@ void FilterCache::impl_validateAndOptimize(std::unique_lock<std::mutex>& rGuard) // create dependencies between the global default frame loader // and all types (and of course if registered filters), which // does not registered for any other loader. - css::uno::Any aDirectValue = impl_getDirectCFGValue(rGuard, CFGDIRECTKEY_DEFAULTFRAMELOADER); + css::uno::Any aDirectValue = impl_getDirectCFGValue(CFGDIRECTKEY_DEFAULTFRAMELOADER); OUString sDefaultFrameLoader; if ( @@ -1164,7 +1175,7 @@ void FilterCache::impl_validateAndOptimize(std::unique_lock<std::mutex>& rGuard) // b) step over all well known frame loader services // and remove all types from list a), which already // referenced by a loader b) - std::vector<OUString> lTypes = getItemNames(rGuard, E_TYPE); + std::vector<OUString> lTypes = getItemNames(E_TYPE); for (auto & frameLoader : m_lFrameLoaders) { // Note: of course the default loader must be ignored here. @@ -1201,6 +1212,8 @@ void FilterCache::impl_validateAndOptimize(std::unique_lock<std::mutex>& rGuard) #if OSL_DEBUG_LEVEL > 0 OSL_ENSURE(!nWarnings, OUStringToOString(sLogOut,RTL_TEXTENCODING_UTF8).getStr()); #endif + + // <- SAFE } void FilterCache::impl_addItem2FlushList( EItemType eType, @@ -1255,8 +1268,11 @@ FilterCache::EItemFlushState FilterCache::impl_specifyFlushOperation(const css:: return eState; } -void FilterCache::impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRequiredState) +void FilterCache::impl_load(EFillState eRequiredState) { + // SAFE -> + osl::MutexGuard aLock(m_aMutex); + // Attention: Detect services are part of the standard set! // So there is no need to handle it separately. @@ -1270,10 +1286,10 @@ void FilterCache::impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRe // Attention! If config couldn't be opened successfully // and exception is thrown automatically and must be forwarded // to our caller... - css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(rGuard, E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); { SAL_INFO( "filter.config", "FilterCache::load std"); - impl_loadSet(rGuard, xTypes, E_TYPE, E_READ_STANDARD, &m_lTypes); + impl_loadSet(xTypes, E_TYPE, E_READ_STANDARD, &m_lTypes); } } @@ -1287,10 +1303,10 @@ void FilterCache::impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRe // Attention! If config couldn't be opened successfully // and exception is thrown automatically and must be forwarded // to our call... - css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(rGuard, E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xTypes(impl_openConfig(E_PROVIDER_TYPES), css::uno::UNO_QUERY_THROW); { SAL_INFO( "filter.config", "FilterCache::load all types"); - impl_loadSet(rGuard, xTypes, E_TYPE, E_READ_UPDATE, &m_lTypes); + impl_loadSet(xTypes, E_TYPE, E_READ_UPDATE, &m_lTypes); } } @@ -1304,10 +1320,10 @@ void FilterCache::impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRe // Attention! If config couldn't be opened successfully // and exception is thrown automatically and must be forwarded // to our call... - css::uno::Reference< css::container::XNameAccess > xFilters(impl_openConfig(rGuard, E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xFilters(impl_openConfig(E_PROVIDER_FILTERS), css::uno::UNO_QUERY_THROW); { SAL_INFO( "filter.config", "FilterCache::load all filters"); - impl_loadSet(rGuard, xFilters, E_FILTER, E_READ_ALL, &m_lFilters); + impl_loadSet(xFilters, E_FILTER, E_READ_ALL, &m_lFilters); } } @@ -1321,10 +1337,10 @@ void FilterCache::impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRe // Attention! If config couldn't be opened successfully // and exception is thrown automatically and must be forwarded // to our call... - css::uno::Reference< css::container::XNameAccess > xLoaders(impl_openConfig(rGuard, E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xLoaders(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); { SAL_INFO( "filter.config", "FilterCache::load all frame loader"); - impl_loadSet(rGuard, xLoaders, E_FRAMELOADER, E_READ_ALL, &m_lFrameLoaders); + impl_loadSet(xLoaders, E_FRAMELOADER, E_READ_ALL, &m_lFrameLoaders); } } @@ -1338,10 +1354,10 @@ void FilterCache::impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRe // Attention! If config couldn't be opened successfully // and exception is thrown automatically and must be forwarded // to our call... - css::uno::Reference< css::container::XNameAccess > xHandlers(impl_openConfig(rGuard, E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::container::XNameAccess > xHandlers(impl_openConfig(E_PROVIDER_OTHERS), css::uno::UNO_QUERY_THROW); { SAL_INFO( "filter.config", "FilterCache::load all content handler"); - impl_loadSet(rGuard, xHandlers, E_CONTENTHANDLER, E_READ_ALL, &m_lContentHandlers); + impl_loadSet(xHandlers, E_CONTENTHANDLER, E_READ_ALL, &m_lContentHandlers); } } @@ -1350,11 +1366,12 @@ void FilterCache::impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRe // any data read? // yes! => validate it and update optimized structures. - impl_validateAndOptimize(rGuard); + impl_validateAndOptimize(); + + // <- SAFE } -void FilterCache::impl_loadSet(std::unique_lock<std::mutex>& rGuard, - const css::uno::Reference< css::container::XNameAccess >& xConfig, +void FilterCache::impl_loadSet(const css::uno::Reference< css::container::XNameAccess >& xConfig, EItemType eType , EReadOption eOption, CacheItemList* pCache ) @@ -1421,7 +1438,7 @@ void FilterCache::impl_loadSet(std::unique_lock<std::mutex>& rGuard, { try { - (*pCache)[pItems[i]] = impl_loadItem(rGuard, xSet, eType, pItems[i], eOption); + (*pCache)[pItems[i]] = impl_loadItem(xSet, eType, pItems[i], eOption); } catch(const css::uno::Exception& ex) { @@ -1445,7 +1462,7 @@ void FilterCache::impl_loadSet(std::unique_lock<std::mutex>& rGuard, } try { - CacheItem aItem = impl_loadItem(rGuard, xSet, eType, pItems[i], eOption); + CacheItem aItem = impl_loadItem(xSet, eType, pItems[i], eOption); pItem->second.update(aItem); } catch(const css::uno::Exception& ex) @@ -1462,12 +1479,15 @@ void FilterCache::impl_loadSet(std::unique_lock<std::mutex>& rGuard, } } -void FilterCache::impl_readPatchUINames(std::unique_lock<std::mutex>& /*rGuard*/, - const css::uno::Reference< css::container::XNameAccess >& xNode, - CacheItem& rItem) +void FilterCache::impl_readPatchUINames(const css::uno::Reference< css::container::XNameAccess >& xNode, + CacheItem& rItem) { + // SAFE -> ---------------------------------- + osl::ClearableMutexGuard aLock(m_aMutex); OUString sActLocale = m_sActLocale ; + aLock.clear(); + // <- SAFE ---------------------------------- css::uno::Any aVal = xNode->getByName(PROPNAME_UINAME); css::uno::Reference< css::container::XNameAccess > xUIName; @@ -1537,8 +1557,7 @@ void FilterCache::impl_savePatchUINames(const css::uno::Reference< css::containe will force a crash during destruction) can be solved ... -----------------------------------------------*/ -CacheItem FilterCache::impl_loadItem(std::unique_lock<std::mutex>& rGuard, - const css::uno::Reference< css::container::XNameAccess >& xSet , +CacheItem FilterCache::impl_loadItem(const css::uno::Reference< css::container::XNameAccess >& xSet , EItemType eType , const OUString& sItem , EReadOption eOption) @@ -1582,7 +1601,7 @@ CacheItem FilterCache::impl_loadItem(std::unique_lock<std::mutex>& rGuard, // read optional properties of a type // no else here! Is an additional switch ... if (eOption == E_READ_UPDATE || eOption == E_READ_ALL) - impl_readPatchUINames(rGuard, xItem, aItem); + impl_readPatchUINames(xItem, aItem); } break; @@ -1619,7 +1638,7 @@ CacheItem FilterCache::impl_loadItem(std::unique_lock<std::mutex>& rGuard, // will be finished really #ifdef AS_ENABLE_FILTER_UINAMES if (eOption == E_READ_UPDATE || eOption == E_READ_ALL) - impl_readPatchUINames(rGuard, xItem, aItem); + impl_readPatchUINames(xItem, aItem); #endif // AS_ENABLE_FILTER_UINAMES } break; @@ -1634,8 +1653,7 @@ CacheItem FilterCache::impl_loadItem(std::unique_lock<std::mutex>& rGuard, return aItem; } -CacheItemList::iterator FilterCache::impl_loadItemOnDemand( std::unique_lock<std::mutex>& rGuard, - EItemType eType, +CacheItemList::iterator FilterCache::impl_loadItemOnDemand( EItemType eType, const OUString& sItem) { CacheItemList* pList = nullptr; @@ -1647,7 +1665,7 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( std::unique_lock<std case E_TYPE : { pList = &m_lTypes; - xConfig = impl_openConfig(rGuard, E_PROVIDER_TYPES); + xConfig = impl_openConfig(E_PROVIDER_TYPES); sSet = CFGSET_TYPES; } break; @@ -1655,7 +1673,7 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( std::unique_lock<std case E_FILTER : { pList = &m_lFilters; - xConfig = impl_openConfig(rGuard, E_PROVIDER_FILTERS); + xConfig = impl_openConfig(E_PROVIDER_FILTERS); sSet = CFGSET_FILTERS; } break; @@ -1663,7 +1681,7 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( std::unique_lock<std case E_FRAMELOADER : { pList = &m_lFrameLoaders; - xConfig = impl_openConfig(rGuard, E_PROVIDER_OTHERS); + xConfig = impl_openConfig(E_PROVIDER_OTHERS); sSet = CFGSET_FRAMELOADERS; } break; @@ -1671,7 +1689,7 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( std::unique_lock<std case E_CONTENTHANDLER : { pList = &m_lContentHandlers; - xConfig = impl_openConfig(rGuard, E_PROVIDER_OTHERS); + xConfig = impl_openConfig(E_PROVIDER_OTHERS); sSet = CFGSET_CONTENTHANDLERS; } break; @@ -1689,7 +1707,7 @@ CacheItemList::iterator FilterCache::impl_loadItemOnDemand( std::unique_lock<std if (bItemInConfig) { - (*pList)[sItem] = impl_loadItem(rGuard, xSet, eType, sItem, E_READ_ALL); + (*pList)[sItem] = impl_loadItem(xSet, eType, sItem, E_READ_ALL); } else { @@ -1951,14 +1969,14 @@ void FilterCache::impl_interpretDataVal4Filter(const OUString& sValue, TODO work on a cache copy first, which can be flushed afterwards That would be useful to guarantee a consistent cache. -----------------------------------------------*/ -void FilterCache::impl_readOldFormat(std::unique_lock<std::mutex>& rGuard) +void FilterCache::impl_readOldFormat() { // Attention: Opening/Reading of this old configuration format has to be handled gracefully. // It's optional and should not disturb our normal work! // E.g. we must check, if the package exists... try { - css::uno::Reference< css::uno::XInterface > xInt = impl_openConfig(rGuard, E_PROVIDER_OLD); + css::uno::Reference< css::uno::XInterface > xInt = impl_openConfig(E_PROVIDER_OLD); css::uno::Reference< css::container::XNameAccess > xCfg(xInt, css::uno::UNO_QUERY_THROW); OUString TYPES_SET("Types"); @@ -1970,7 +1988,7 @@ void FilterCache::impl_readOldFormat(std::unique_lock<std::mutex>& rGuard) xCfg->getByName(TYPES_SET) >>= xSet; const css::uno::Sequence< OUString > lItems = xSet->getElementNames(); for (const OUString& rName : lItems) - m_lTypes[rName] = impl_readOldItem(rGuard, xSet, E_TYPE, rName); + m_lTypes[rName] = impl_readOldItem(xSet, E_TYPE, rName); } OUString FILTER_SET("Filters"); @@ -1981,7 +1999,7 @@ void FilterCache::impl_readOldFormat(std::unique_lock<std::mutex>& rGuard) xCfg->getByName(FILTER_SET) >>= xSet; const css::uno::Sequence< OUString > lItems = xSet->getElementNames(); for (const OUString& rName : lItems) - m_lFilters[rName] = impl_readOldItem(rGuard, xSet, E_FILTER, rName); + m_lFilters[rName] = impl_readOldItem(xSet, E_FILTER, rName); } } /* corrupt filter addon? Because it's external (optional) code... we can ignore it. Addon won't work then... @@ -1993,8 +2011,7 @@ void FilterCache::impl_readOldFormat(std::unique_lock<std::mutex>& rGuard) } } -CacheItem FilterCache::impl_readOldItem(std::unique_lock<std::mutex>& rGuard, - const css::uno::Reference< css::container::XNameAccess >& xSet , +CacheItem FilterCache::impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet , EItemType eType, const OUString& sItem) { @@ -2010,7 +2027,7 @@ CacheItem FilterCache::impl_readOldItem(std::unique_lock<std::mutex>& rGuard, // Isn't used any longer! // UIName - impl_readPatchUINames(rGuard, xItem, aItem); + impl_readPatchUINames(xItem, aItem); // Data OUString sData; @@ -2097,16 +2114,21 @@ OUString FilterCache::impl_searchContentHandlerForType(const OUString& sType) co #endif -bool FilterCache::impl_isModuleInstalled(std::unique_lock<std::mutex>& /*rGuard*/, const OUString& sModule) +bool FilterCache::impl_isModuleInstalled(const OUString& sModule) { css::uno::Reference< css::container::XNameAccess > xCfg; - if (!m_xModuleCfg.is()) + // SAFE -> { - m_xModuleCfg = officecfg::Setup::Office::Factories::get(); - } + osl::MutexGuard aLock(m_aMutex); + if (!m_xModuleCfg.is()) + { + m_xModuleCfg = officecfg::Setup::Office::Factories::get(); + } - xCfg = m_xModuleCfg; + xCfg = m_xModuleCfg; + } + // <- SAFE if (xCfg.is()) return xCfg->hasByName(sModule); diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index abfa712895d1..8445efea8227 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -20,7 +20,6 @@ #pragma once #include <memory> -#include <mutex> #include "cacheitem.hxx" #include <com/sun/star/beans/NamedValue.hpp> @@ -57,7 +56,7 @@ class CacheUpdateListener; Further we make it public. So any user of this class can lock us from outside too. */ -class FilterCache +class FilterCache : public cppu::BaseMutex { // public types @@ -162,7 +161,6 @@ class FilterCache private: - mutable std::mutex m_aMutex; /** @short holds the used configuration provider alive, which provides access to the list of types. */ @@ -583,7 +581,6 @@ class FilterCache private: - std::vector<OUString> getItemNames(std::unique_lock<std::mutex>& rGuard, EItemType eType) const; /** @short return a reference to one of our internal sub container, which contains items of the @@ -598,11 +595,11 @@ class FilterCache @throw [css::uno::Exception] if the required list does not exist. */ - const CacheItemList& impl_getItemList(std::unique_lock<std::mutex>& rGuard, EItemType eType) const; + const CacheItemList& impl_getItemList(EItemType eType) const; - CacheItemList& impl_getItemList(std::unique_lock<std::mutex>& rGuard, EItemType eType); + CacheItemList& impl_getItemList(EItemType eType); - CacheItem& impl_getItem( std::unique_lock<std::mutex>& rGuard, EItemType eType, const OUString& sItem); + CacheItem& impl_getItem( EItemType eType, const OUString& sItem); /** @short return a valid configuration update access to the underlying configuration package, which @@ -623,7 +620,7 @@ class FilterCache all necessary listener connections will be established too. So this cache will be informed about outside updates. */ - css::uno::Reference< css::uno::XInterface > impl_openConfig(std::unique_lock<std::mutex>& rGuard, EConfigProvider eProvide); + css::uno::Reference< css::uno::XInterface > impl_openConfig(EConfigProvider eProvide); /** @short tries to open the requested configuration root @@ -644,8 +641,7 @@ class FilterCache and initialized within the requested modes successfully; a NULL reference otherwise. */ - static css::uno::Reference< css::uno::XInterface > impl_createConfigAccess(std::unique_lock<std::mutex>& rGuard, - const OUString& sRoot , + css::uno::Reference< css::uno::XInterface > impl_createConfigAccess(const OUString& sRoot , bool bReadOnly , bool bLocalesMode); @@ -669,7 +665,7 @@ class FilterCache Can be empty if an internal error occurred or if the requested key does not exists! */ - static css::uno::Any impl_getDirectCFGValue(std::unique_lock<std::mutex>& rGuard, std::u16string_view sDirectKey); + css::uno::Any impl_getDirectCFGValue(std::u16string_view sDirectKey); /** @short load the underlying configuration into this cache. @@ -684,7 +680,7 @@ class FilterCache @throws css::uno::Exception */ - void impl_load(std::unique_lock<std::mutex>& rGuard, EFillState eRequiredState); + void impl_load(EFillState eRequiredState); /** @short validate the whole cache and create @@ -703,7 +699,7 @@ class FilterCache @throw [css::uno::Exception] if cache is invalid and could not be repaired. */ - void impl_validateAndOptimize(std::unique_lock<std::mutex>& rGuard); + void impl_validateAndOptimize(); private: @@ -733,8 +729,7 @@ class FilterCache @throw [css::uno::Exception] if an unrecoverable error occurs inside this operation. */ - void impl_loadSet(std::unique_lock<std::mutex>& rGuard, - const css::uno::Reference< css::container::XNameAccess >& xConfig, + void impl_loadSet(const css::uno::Reference< css::container::XNameAccess >& xConfig, EItemType eType , EReadOption eOption, CacheItemList* pCache ); @@ -762,8 +757,7 @@ class FilterCache @throw [css::uno::Exception] if an unrecoverable error occurs inside this operation. */ - CacheItem impl_loadItem(std::unique_lock<std::mutex>& rGuard, - const css::uno::Reference< css::container::XNameAccess >& xSet , + CacheItem impl_loadItem(const css::uno::Reference< css::container::XNameAccess >& xSet , EItemType eType , const OUString& sItem , EReadOption eOption); @@ -794,8 +788,7 @@ class FilterCache @throw [css::uno::Exception] if an unrecoverable error occurs inside this operation. */ - CacheItemList::iterator impl_loadItemOnDemand( std::unique_lock<std::mutex>& rGuard, - EItemType eType, + CacheItemList::iterator impl_loadItemOnDemand( EItemType eType, const OUString& sItem); @@ -862,8 +855,7 @@ class FilterCache @throws css::uno::Exception */ - void impl_readPatchUINames(std::unique_lock<std::mutex>& rGuard, - const css::uno::Reference< css::container::XNameAccess >& xNode, + void impl_readPatchUINames(const css::uno::Reference< css::container::XNameAccess >& xNode, CacheItem& rItem); @@ -875,14 +867,13 @@ class FilterCache const CacheItem& rItem); /** TODO */ - void impl_readOldFormat(std::unique_lock<std::mutex>& rGuard); + void impl_readOldFormat(); /** TODO @throws css::uno::Exception */ - CacheItem impl_readOldItem(std::unique_lock<std::mutex>& rGuard, - const css::uno::Reference< css::container::XNameAccess >& xSet , + CacheItem impl_readOldItem(const css::uno::Reference< css::container::XNameAccess >& xSet , EItemType eType, const OUString& sItem); @@ -918,7 +909,7 @@ class FilterCache @return sal_True if the requested module is installed; sal_False otherwise. */ - bool impl_isModuleInstalled(std::unique_lock<std::mutex>& rGuard, const OUString& sModule); + bool impl_isModuleInstalled(const OUString& sModule); /** @short convert a list of flag names to its int representation. commit 31ac452f5f20c51dea3c3f022928627037486118 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Feb 5 14:54:04 2024 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#159566: match 'central' dominant-baseline to 'middle' Inkscape also does it the same way Change-Id: I3e1cea091e7314886bbc9135c55698892239bec7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163006 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 358061b4a480ea763ea541094cef2112f917eb93) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163013 Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx index 60781942667b..4516773e83a6 100644 --- a/svgio/inc/svgstyleattributes.hxx +++ b/svgio/inc/svgstyleattributes.hxx @@ -166,7 +166,8 @@ namespace svgio::svgreader { Auto, Middle, - Hanging + Hanging, + Central }; enum class Visibility diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index d99e56bfef35..9324ad1b1849 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -764,7 +764,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156834) CPPUNIT_ASSERT (pDocument); - assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, 3); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, 4); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "text"_ostr, "Auto"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "x"_ostr, "30"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]"_ostr, "y"_ostr, "20"); @@ -776,6 +776,10 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156834) assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "text"_ostr, "Hanging"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "x"_ostr, "30"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]"_ostr, "y"_ostr, "94"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "text"_ostr, "Central"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "x"_ostr, "30"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]"_ostr, "y"_ostr, "116"); } CPPUNIT_TEST_FIXTURE(Test, testTdf104339) diff --git a/svgio/qa/cppunit/data/tdf156834.svg b/svgio/qa/cppunit/data/tdf156834.svg index 74dc1548186e..0ef81f9a6acf 100644 --- a/svgio/qa/cppunit/data/tdf156834.svg +++ b/svgio/qa/cppunit/data/tdf156834.svg @@ -1,7 +1,8 @@ <svg viewBox="0 0 200 120" xmlns="http://www.w3.org/2000/svg"> - <path d="M20,20 L180,20 M20,50 L180,50 M20,80 L180,80" stroke="grey" /> + <path d="M20,20 L180,20 M20,50 L180,50 M20,80 L180,80 M20,110 L180,110" stroke="grey" /> <text dominant-baseline="auto" x="30" y="20" font-size="20">Auto</text> <text dominant-baseline="middle" x="30" y="50" font-size="20">Middle</text> <text dominant-baseline="Hanging" x="30" y="80" font-size="20">Hanging</text> + <text dominant-baseline="central" x="30" y="110" font-size="20">Central</text> </svg> diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 7d5a2fcb9feb..02bc3911a3b8 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -287,6 +287,7 @@ namespace svgio::svgreader switch(aDominantBaseline) { case DominantBaseline::Middle: + case DominantBaseline::Central: { aPosition.setY(aPosition.getY() - aRange.getCenterY()); break; diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 869b071dade7..731df59aeebf 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -1969,6 +1969,10 @@ namespace svgio::svgreader { setDominantBaseline(DominantBaseline::Hanging); } + else if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"central")) + { + setDominantBaseline(DominantBaseline::Central); + } else { // no DominantBaseline commit 66ea81d4e5e1844d39c121fbb453869e0a00ba62 Author: Patrick Luby <plub...@libreoffice.org> AuthorDate: Fri Feb 2 16:06:21 2024 -0500 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#147291 add more default certificate manager application for macOS Add the following applications to the macOS GUI servers list: - Trusted Key Manager - CertEurope - SCInterface Manager and SmartCard tools Change-Id: Iec78171c6e82f0a072f5f06b79606560a8cc03cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162942 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomac...@gmail.com> Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> (cherry picked from commit 538f7b45c0c2c08124e9ea51a0947504f142a4f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162909 diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index d717ec9feaad..b1a2cd57c95e 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -128,6 +128,8 @@ namespace #elif defined MACOSX constexpr std::u16string_view aGUIServers[] = { u"/Applications/GPG Keychain.app", + u"/Applications/Trusted Key Manager.app", // tdf#147291 + u"/Applications/SCinterface/scManager.app", // tdf#147291 u"/System/Applications/Utilities/Keychain Access.app"}; #else constexpr std::u16string_view aGUIServers[] commit a095f81eb4bed9c0b67651de9206a5ecc643f274 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Feb 5 10:32:48 2024 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 Resolves: tdf#156352 disable sorting while adding rows looks like the new row gets sorted immediately when added as an empty row into the first row, so accessing it by index later to set it text/id get an unexpected result. pause sorting while inserting the entries and enable it again when finished for the easiest fix. Change-Id: Ib028b193afbf2b9026841b19419e012b70448e39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162906 Reviewed-by: Patrick Luby <guibomac...@gmail.com> Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 9dba3e9e9066..730549093390 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -56,7 +56,6 @@ CertificateChooser::CertificateChooser(weld::Window* _pParent, { auto nControlWidth = m_xCertLB->get_approximate_digit_width() * 105; m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12)); - m_xCertLB->make_sorted(); m_xCertLB->connect_changed( LINK( this, CertificateChooser, CertificateHighlightHdl ) ); m_xCertLB->connect_row_activated( LINK( this, CertificateChooser, CertificateSelectHdl ) ); @@ -136,6 +135,7 @@ void CertificateChooser::ImplInitialize(bool mbSearch) return; m_xCertLB->clear(); + m_xCertLB->make_unsorted(); m_xCertLB->freeze(); SvtUserOptions aUserOpts; @@ -257,6 +257,7 @@ void CertificateChooser::ImplInitialize(bool mbSearch) m_xCertLB->thaw(); m_xCertLB->unselect_all(); + m_xCertLB->make_sorted(); if (oSelectRow) { commit 3d6c2e298337569775585f4569ebc1feb89bce9a Author: Patrick Luby <plub...@libreoffice.org> AuthorDate: Thu Feb 1 11:07:30 2024 -0500 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#159307 add default macOS certificate manager applications Most, if not all, of the Linux certificate manager applications are not available on macOS so create a separate list for macOS. Also, fix uncloseable windows due to uncaught exceptions thrown by XSystemShellExecute::execute(). Failure to catch such exceptions would cause the document window to be uncloseable and the application to be unquittable. Change-Id: I9bc6dc9c6c9d054252b634874045cb066023214a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162887 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> (cherry picked from commit 29bf86f7cb367705b13049e5f0b3faa8bb93638a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162900 Reviewed-by: Patrick Luby <guibomac...@gmail.com> diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index f2bb37241b7c..d717ec9feaad 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -74,6 +74,10 @@ #include <Shlobj.h> #endif +#if defined MACOSX +#include <sys/stat.h> +#endif + using namespace comphelper; using namespace css::security; using namespace css::uno; @@ -121,6 +125,10 @@ namespace u"GNU\GnuPG\bin\kleopatra.exe", u"GNU\GnuPG\bin\launch-gpa.exe", u"GNU\GnuPG\bin\gpa.exe"}; +#elif defined MACOSX + constexpr std::u16string_view aGUIServers[] + = { u"/Applications/GPG Keychain.app", + u"/System/Applications/Utilities/Keychain Access.app"}; #else constexpr std::u16string_view aGUIServers[] = { u"kleopatra", u"seahorse", u"gpa", u"kgpg"}; @@ -175,12 +183,34 @@ void GetCertificateManager(OUString& sExecutable) for (const auto& rServer: aGUIServers) { - osl::FileBase::RC searchError = osl::File::searchFileURL( - OUString(rServer), aPath, - aFoundGUIServer); - if (searchError == osl::FileBase::E_None) + bool bSetCertMgrPath = false; + +#ifdef MACOSX + // On macOS, the list of default certificate manager applications + // includes absolute paths so check if the path exists and is a + // directory + if (rServer.starts_with('/')) + { + OString aSysPath = OUString(rServer).toUtf8(); + if (struct stat st; stat(aSysPath.getStr(), &st) == 0 && S_ISDIR(st.st_mode)) + { + bSetCertMgrPath = true; + sExecutable = rServer; + } + } +#endif + + if (!bSetCertMgrPath) + { + osl::FileBase::RC searchError = osl::File::searchFileURL( + OUString(rServer), aPath, + aFoundGUIServer); + if (searchError == osl::FileBase::E_None && osl::File::getSystemPathFromFileURL(aFoundGUIServer, sExecutable) == osl::FileBase::E_None) + bSetCertMgrPath = true; + } + + if (bSetCertMgrPath) { - osl::File::getSystemPathFromFileURL(aFoundGUIServer, sExecutable); std::shared_ptr<comphelper::ConfigurationChanges> pBatch( comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Security::Scripting::CertMgrPath::set(sExecutable, @@ -558,8 +588,22 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void) uno::Reference<css::system::XSystemShellExecute> xSystemShell( css::system::SystemShellExecute::create(xContext)); - xSystemShell->execute(sExecutable, OUString(), - css::system::SystemShellExecuteFlags::DEFAULTS); + try + { + xSystemShell->execute(sExecutable, OUString(), + css::system::SystemShellExecuteFlags::DEFAULTS); + } + catch (...) + { + // Related tdf#159307 fix uncloseable windows due to uncaught exception + // XSystemShellExecute::execute() throws an exception for a variety + // of common error conditions such as files or directories that + // are non-existent or non-executable. Failure to catch such + // exceptions would cause the document window to be uncloseable + // and the application to be unquittable. + TOOLS_WARN_EXCEPTION( "xmlsecurity.dialogs", "executable failed!" ); + sExecutable = OUString(); + } } OUString sDialogText = (sExecutable.isEmpty() ? commit 19bfcc8e429950fa3fbf4cc22fde0190994a75e2 Author: Vladislav Tarakanov <vladislav.taraka...@bk.ru> AuthorDate: Thu Jan 4 20:09:38 2024 +0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#158924 Handle multi-clicks for navigation bar Added handling for navigation bar buttons when many quick clicks have been made. To do this, after processing the first click, the number of clicks in the series is stored in a new variable. Until the entire series of clicks has been processed, the slide switch will not occur. Change-Id: I8f4416a0c7928bb78609be8ff52252782c37f5a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161625 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit ab320f4e11c70b50e5beddf12ad925f192941d9a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162904 diff --git a/slideshow/source/engine/slideoverlaybutton.cxx b/slideshow/source/engine/slideoverlaybutton.cxx index 40ade676b383..987cd11dfb8c 100644 --- a/slideshow/source/engine/slideoverlaybutton.cxx +++ b/slideshow/source/engine/slideoverlaybutton.cxx @@ -170,7 +170,15 @@ bool SlideOverlayButton::handleMouseReleased(const css::awt::MouseEvent& e) && clickPnt.getY() > btnPnt.getY() && clickPnt.getY() < btnPnt.getY() + mxIconBitmap->getSize().Height) { - mClickHandler(clickPnt); + if (mnIgnoreClicksCnt == 0) + { + mnIgnoreClicksCnt = e.ClickCount - 1; + mClickHandler(clickPnt); + } + else + { + mnIgnoreClicksCnt--; + } return true; } return false; diff --git a/slideshow/source/engine/slideoverlaybutton.hxx b/slideshow/source/engine/slideoverlaybutton.hxx index db733a2b2cd4..7358743ee3e9 100644 --- a/slideshow/source/engine/slideoverlaybutton.hxx +++ b/slideshow/source/engine/slideoverlaybutton.hxx @@ -96,6 +96,7 @@ private: ViewsVecT maViews; ScreenUpdater& mrScreenUpdater; bool mbVisible = false; + sal_Int32 mnIgnoreClicksCnt = 0; }; } commit f7f4d1b6c3aa9bc8f0432aab1e2b9bcf922eb2b8 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Feb 2 12:55:34 2024 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 Avoid infinite loop (24-2-specific) The 'continue' didn't increment nPos. In master, this is fixed by commit a53f0dc811a115cd68a5c297a68eeb5a9d3bb5ef (Extract Local file header and Data descriptor handling into own functions, 2024-02-02) Change-Id: Id20a1a543250efe0d359ec6d0f05fc23cff1c5ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162902 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 71fd66f08196..3d382bd3a305 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -1314,7 +1314,10 @@ void ZipFile::recover() [path = OUString(aEntry.sPath + "/")](const auto& r) { return r.first.startsWith(path); }) != aEntries.end()) + { + nPos += 4; continue; + } aEntries.emplace( aEntry.sPath, aEntry ); commit 62ce179bf18ce3457a563d85144048741ee528ae Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Feb 1 13:35:43 2024 +0600 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#159496: clear mxObjectContainer in PrepareSecondTryLoad_Impl The problem here is that the object container has own reference to the storage object. In SfxBaseModel::load, when preparing for a second try, the storage gets disposed, and a cleanup is performed; but previously, the reference to the disposed storage was used in the object container, and thus generated a failure when it was used to import the OLE. Clearing it allows to re-create it properly, with the updated storage. Change-Id: I08b7503d79240ccc51b253fe1f4e99a0232995b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162866 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 6bddbe51cee5c4aea023cc68771800f46a4aad2f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162828 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index ea1063ea81c1..17ee6bf6217d 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -400,6 +400,7 @@ void SfxObjectShell::PrepareSecondTryLoad_Impl() { // only for internal use pImpl->m_xDocStorage.clear(); + pImpl->mxObjectContainer.reset(); pImpl->m_bIsInit = false; ResetError(); } commit 3d4d69fc34779082ef5cf8237730cc135751426f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Feb 1 20:55:40 2024 +0600 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#154587: allow directory entries in ZIP packages The problem in the bugdoc was the directory entries. These entries are valid in ZIP packages (even if not common); they may be useful to e.g. define per-directory permissions (ACLs). In normal mode, ZipFile reads central directory; there we can read if the entry has FAT file attributes; and then, if the entry is a directory. Then it is OK to skip it. In repair mode, central directory is not used, local file headers don't contain a "directory" flag. A workaround is used, checking if there are entries that represent directories of other entries. Also this change fixes some places that didn't pass the recovery flag correctly. Change-Id: I324671841a2c4d0f279b03801d95c8f2eeb99b46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162888 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 747463809e50c132557a95dcee6709a1fa82d760) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162897 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 2c0cfa9732eb..55e43cc08921 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -287,8 +287,10 @@ void XmlFilterBase::importDocumentProperties() rtl::Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) ); xInputStream = xDetector->extractUnencryptedPackage( aMediaDesc ); Reference< XComponent > xModel = getModel(); + const bool repairPackage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false); Reference< XStorage > xDocumentStorage ( - ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( OFOPXML_STORAGE_FORMAT_STRING, xInputStream ) ); + ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( + OFOPXML_STORAGE_FORMAT_STRING, xInputStream, {}, repairPackage)); Reference< XInterface > xTemp = xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.OOXMLDocumentPropertiesImporter", xContext); diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 474b73ff53db..71fd66f08196 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -38,6 +38,7 @@ #include <rtl/digest.h> #include <sal/log.hxx> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <algorithm> @@ -1073,7 +1074,7 @@ sal_Int32 ZipFile::readCEN() if ( nTestSig != CENSIG ) throw ZipException("Invalid CEN header (bad signature)" ); - aMemGrabber.skipBytes ( 2 ); + sal_uInt16 versionMadeBy = aMemGrabber.ReadUInt16(); aEntry.nVersion = aMemGrabber.ReadInt16(); aEntry.nFlag = aMemGrabber.ReadInt16(); @@ -1093,7 +1094,8 @@ sal_Int32 ZipFile::readCEN() aEntry.nPathLen = aMemGrabber.ReadInt16(); aEntry.nExtraLen = aMemGrabber.ReadInt16(); nCommentLen = aMemGrabber.ReadInt16(); - aMemGrabber.skipBytes ( 8 ); + aMemGrabber.skipBytes ( 4 ); + sal_uInt32 externalFileAttributes = aMemGrabber.ReadUInt32(); sal_uInt64 nOffset = aMemGrabber.ReadUInt32(); if ( aEntry.nPathLen < 0 ) @@ -1132,6 +1134,15 @@ sal_Int32 ZipFile::readCEN() throw ZipException("Integer-overflow"); aMemGrabber.skipBytes(nCommentLen); + + // Is this a FAT-compatible empty entry? + if (aEntry.nSize == 0 && (versionMadeBy & 0xff00) == 0) + { + constexpr sal_uInt32 FILE_ATTRIBUTE_DIRECTORY = 16; + if (externalFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + continue; // This is a directory entry, not a stream - skip it + } + aEntries[aEntry.sPath] = aEntry; } @@ -1253,6 +1264,7 @@ void ZipFile::recover() RTL_TEXTENCODING_UTF8 ); aEntry.nPathLen = static_cast< sal_Int16 >(aFileName.getLength()); } + aEntry.sPath = aEntry.sPath.replace('\', '/'); // read 64bit header if (aEntry.nExtraLen > 0) @@ -1294,7 +1306,33 @@ void ZipFile::recover() aEntry.nSize = 0; } + // Do not add this entry, if it is empty and is a directory of + // an already existing entry + if (aEntry.nSize == 0 && aEntry.nCompressedSize == 0 + && std::find_if( + aEntries.begin(), aEntries.end(), + [path = OUString(aEntry.sPath + "/")](const auto& r) + { return r.first.startsWith(path); }) + != aEntries.end()) + continue; + aEntries.emplace( aEntry.sPath, aEntry ); + + // Drop any "directory" entry corresponding to this one's path; + // since we don't use central directory, we don't see external + // file attributes, so sanitize here + sal_Int32 i = 0; + for (OUString subdir = aEntry.sPath.getToken(0, '/', i); i >= 0; + subdir += OUString::Concat("/") + + o3tl::getToken(aEntry.sPath, 0, '/', i)) + { + if (auto it = aEntries.find(subdir); it != aEntries.end()) + { + // if not empty, let it fail later in ZipPackage::getZipFileContents + if (it->second.nSize == 0 && it->second.nCompressedSize == 0) + aEntries.erase(it); + } + } } } } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 422fa98ac360..c961733d85ac 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -1980,10 +1980,13 @@ uno::Reference<embed::XStorage> SfxMedium::GetScriptingStorageToSign_Impl() SAL_WARN_IF(!pImpl->m_xODFDecryptedInnerPackageStream.is(), "sfx.doc", "no inner package stream?"); if (pImpl->m_xODFDecryptedInnerPackageStream.is()) { + const SfxBoolItem* pRepairItem = GetItemSet().GetItem(SID_REPAIRPACKAGE, false); + const bool bRepairPackage = pRepairItem && pRepairItem->GetValue(); pImpl->m_xODFDecryptedInnerZipStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( ZIP_STORAGE_FORMAT_STRING, - pImpl->m_xODFDecryptedInnerPackageStream->getInputStream()); + pImpl->m_xODFDecryptedInnerPackageStream->getInputStream(), {}, + bRepairPackage); } } return pImpl->m_xODFDecryptedInnerZipStorage; @@ -2004,15 +2007,21 @@ uno::Reference< embed::XStorage > const & SfxMedium::GetZipStorageToSign_Impl( b try { + const SfxBoolItem* pRepairItem = GetItemSet().GetItem(SID_REPAIRPACKAGE, false); + const bool bRepairPackage = pRepairItem && pRepairItem->GetValue(); // we can not sign document if there is no stream // should it be possible at all? if ( !bReadOnly && pImpl->xStream.is() ) { - pImpl->m_xZipStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( ZIP_STORAGE_FORMAT_STRING, pImpl->xStream ); + pImpl->m_xZipStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream( + ZIP_STORAGE_FORMAT_STRING, pImpl->xStream, css::embed::ElementModes::READWRITE, + {}, bRepairPackage); } else if ( pImpl->xInputStream.is() ) { - pImpl->m_xZipStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( ZIP_STORAGE_FORMAT_STRING, pImpl->xInputStream ); + pImpl->m_xZipStorage + = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( + ZIP_STORAGE_FORMAT_STRING, pImpl->xInputStream, {}, bRepairPackage); } } catch( const uno::Exception& ) commit 7358ec0ed266eaf5dbecd7f4299bc3e0e69418b5 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Jan 31 10:30:18 2024 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 curl: upgrade to release 8.6.0 Fixes CVE-2024-0853 Change-Id: Iabba0748f7c48ee03a8223aef9ca81bf379738e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162793 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 9667ea7e274c4e29cf7c35d9e124a8fbcb2af3da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162812 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp> diff --git a/download.lst b/download.lst index c1bde8be9ab8..75917e55d553 100644 --- a/download.lst +++ b/download.lst @@ -80,8 +80,8 @@ CPPUNIT_TARBALL := cppunit-1.15.1.tar.gz # three static lines # so that git cherry-pick # will not run into conflicts -CURL_SHA256SUM := 42ab8db9e20d8290a3b633e7fbb3cec15db34df65fd1015ef8ac1e4723750eeb -CURL_TARBALL := curl-8.5.0.tar.xz +CURL_SHA256SUM := 3ccd55d91af9516539df80625f818c734dc6f2ecf9bada33c76765e99121db15 +CURL_TARBALL := curl-8.6.0.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts commit fef28fc5e1093d876e2a26a19433b3da71be525d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jan 30 14:13:41 2024 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#158695 convert-to bogusly needs libcui (--disable-gui build) Change-Id: I8e13902c4ee9b4b17e921b68b0626f7728cb0c18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit 8d26ca7f9ac37b5ada0a2c463b37181bcc8301a8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162810 Tested-by: René Engelhard <r...@debian.org> Reviewed-by: René Engelhard <r...@debian.org> diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index bd5d831f7f2f..707f5506d6a6 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -56,7 +56,6 @@ $(eval $(call gb_Library_use_libraries,sw,\ comphelper \ cppu \ cppuhelper \ - cui \ $(call gb_Helper_optional,DBCONNECTIVITY, \ dbtools) \ docmodel \ commit e506f4f437be8502b921922c03486596833215cf Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Feb 1 09:30:50 2024 +0600 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#159474: fix handling of pre-set RepairPackage property StorageFilterDetect::detect had a wrong logic here, only honoring repair request in case it haappened interactively inside it. The pre-existing RepairPackage set to true was treated as "do not try to repair". Change-Id: I3fb63a5d72097a79977e8ed734f8e69dd2ea999a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162858 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162867 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/filter/source/storagefilterdetect/filterdetect.cxx b/filter/source/storagefilterdetect/filterdetect.cxx index c73355e02a9d..1d0d7557d273 100644 --- a/filter/source/storagefilterdetect/filterdetect.cxx +++ b/filter/source/storagefilterdetect/filterdetect.cxx @@ -121,44 +121,44 @@ OUString SAL_CALL StorageFilterDetect::detect(uno::Sequence<beans::PropertyValue if ( ( aWrap.TargetException >>= aZipException ) && !aRequestedTypeName.isEmpty() ) { // The package is a broken one. - uno::Reference< task::XInteractionHandler > xInteraction = - aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER, uno::Reference< task::XInteractionHandler >() ); - - if ( xInteraction.is() ) + INetURLObject aParser( + aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_URL, OUString())); + OUString aDocumentTitle = aParser.getName(INetURLObject::LAST_SEGMENT, true, + INetURLObject::DecodeMechanism::WithCharset); + bool bRepairPackage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false); + // fdo#46310 Don't ask to repair if the user rejected it once. + if (!bRepairPackage && aMediaDesc.getUnpackedValueOrDefault("RepairAllowed", true)) { - INetURLObject aParser( aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL, OUString() ) ); - OUString aDocumentTitle = aParser.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset ); - bool bRepairPackage = aMediaDesc.getUnpackedValueOrDefault( "RepairPackage", false ); - // fdo#46310 Don't try to repair if the user rejected it once. - bool bRepairAllowed = aMediaDesc.getUnpackedValueOrDefault( "RepairAllowed", true ); + uno::Reference< task::XInteractionHandler > xInteraction = + aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER, uno::Reference< task::XInteractionHandler >() ); - if ( !bRepairPackage && bRepairAllowed ) + if ( xInteraction.is() ) { // Ask the user whether he wants to try to repair. - RequestPackageReparation aRequest( aDocumentTitle ); - xInteraction->handle( aRequest.GetRequest() ); - - if ( aRequest.isApproved() ) - { - aTypeName = aRequestedTypeName; - // lok: we want to overwrite file in jail, so don't use template flag - const bool bIsLOK = comphelper::LibreOfficeKit::isActive(); - aMediaDesc[MediaDescriptor::PROP_DOCUMENTTITLE] <<= aDocumentTitle; - aMediaDesc[MediaDescriptor::PROP_ASTEMPLATE] <<= !bIsLOK; - aMediaDesc["RepairPackage"] <<= true; - } - else + RequestPackageReparation aRequest(aDocumentTitle); + xInteraction->handle(aRequest.GetRequest()); + bRepairPackage = aRequest.isApproved(); + if (!bRepairPackage) { // Repair either not allowed or not successful. NotifyBrokenPackage aNotifyRequest( aDocumentTitle ); xInteraction->handle( aNotifyRequest.GetRequest() ); aMediaDesc["RepairAllowed"] <<= false; } - - // Write the changes back. - aMediaDesc >> rDescriptor; } } + if (bRepairPackage) + { + aTypeName = aRequestedTypeName; + // lok: we want to overwrite file in jail, so don't use template flag + const bool bIsLOK = comphelper::LibreOfficeKit::isActive(); + aMediaDesc[MediaDescriptor::PROP_DOCUMENTTITLE] <<= aDocumentTitle; + aMediaDesc[MediaDescriptor::PROP_ASTEMPLATE] <<= !bIsLOK; + aMediaDesc["RepairPackage"] <<= true; + } + + // Write the changes back. + aMediaDesc >> rDescriptor; } } catch( uno::RuntimeException& ) diff --git a/sw/qa/extras/odfimport/data/unreferenced_stream.odt b/sw/qa/extras/odfimport/data/unreferenced_stream.odt new file mode 100644 index 000000000000..0cdba0d48529 Binary files /dev/null and b/sw/qa/extras/odfimport/data/unreferenced_stream.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 6ccc8cce3bc5..168de4fb6db7 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -1534,5 +1534,20 @@ CPPUNIT_TEST_FIXTURE(Test, testEmptyTrailingSpans) CPPUNIT_ASSERT_DOUBLES_EQUAL(184, height2, 1); // allow a bit of room for rounding just in case } +CPPUNIT_TEST_FIXTURE(Test, testBrokenPackage_Tdf159474) +{ + // Given an invalid ODF having a stream not referenced in manifest.xml + const OUString url = createFileURL(u"unreferenced_stream.odt"); + // It expectedly fails to load normally: + CPPUNIT_ASSERT_ASSERTION_FAIL(loadFromDesktop(url, {}, {})); + // importing it must succeed with RepairPackage set to true. + mxComponent + = loadFromDesktop(url, {}, { comphelper::makePropertyValue(u"RepairPackage"_ustr, true) }); + // The document imports in repair mode; the original broken package is used as a template, + // and the loaded document has no URL: + CPPUNIT_ASSERT(mxComponent.queryThrow<frame::XModel>()->getURL().isEmpty()); + CPPUNIT_ASSERT_EQUAL(u"Empty document"_ustr, getParagraph(1)->getString()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit c23648abcf78eee2f6c2c3e0f1e9d842daba49b0 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Wed Nov 8 12:25:47 2023 -0900 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:51 2024 +0100 tdf#158101 Make non-gtk backends context popup menu item visibility behavior like gtk For context popup menus, gtk's native popup menu hides disabled menu items. This patch makes this the behavior for non-gtk backends while preserving the intent of commit a0955317900075371d6adb7f924af24c22f02d09 to make VCL PopupMenu respect the officecfg::Office::Common::View::Menu::DontHideDisabledEntry setting. Change-Id: Ice59f2b5ec20dac9d1b0891ccbd83dbbcd308078 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159192 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> (cherry picked from commit 1ac7350a7032a760be22cce845eab7efe435827d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162825 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 37785849c551..20d3d5d2d18a 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -481,8 +481,13 @@ sal_Int16 VCLXMenu::execute( if ( !mpMenu || !IsPopupMenu() ) return 0; } + PopupMenu* pPopupMenu = static_cast<PopupMenu*>(pMenu.get()); + MenuFlags nMenuFlags = pPopupMenu->GetMenuFlags(); + // #102790# context menus shall never show disabled entries + nMenuFlags |= MenuFlags::HideDisabledEntries; + pPopupMenu->SetMenuFlags(nMenuFlags); // cannot call this with mutex locked because it will call back into us - return static_cast<PopupMenu*>(pMenu.get())->Execute( + return pPopupMenu->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle( rPos ), static_cast<PopupMenuFlags>(nFlags) | PopupMenuFlags::NoMouseUpClose ); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 95beb907f6c0..50ecd194bdcd 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1068,6 +1068,12 @@ void SalInstanceToolbar::set_menu_item_active(const OUString& rIdent, bool bActi { if (bActive) { + MenuFlags nMenuFlags = pPopup->GetMenuFlags(); + if (officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get()) + nMenuFlags &= ~MenuFlags::HideDisabledEntries; + else + nMenuFlags |= MenuFlags::HideDisabledEntries; + pPopup->SetMenuFlags(nMenuFlags); tools::Rectangle aRect = m_xToolBox->GetItemRect(nItemId); pPopup->Execute(m_xToolBox, aRect, PopupMenuFlags::ExecuteDown); } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 82d630742ab5..a0a03be455cb 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2863,9 +2863,12 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& pParentWin, tools::Rectang if (bRealExecute) nPopupModeFlags |= FloatWinPopupFlags::NewLevel; + // MenuFlags get clobbered in the Activate function. Restore them after calling. + MenuFlags nMenuFlagsSaved = GetMenuFlags(); bInCallback = true; // set it here, if Activate overridden Activate(); bInCallback = false; + SetMenuFlags(nMenuFlagsSaved); if (pParentWin->isDisposed()) return false; @@ -2884,13 +2887,6 @@ bool PopupMenu::PrepareRun(const VclPtr<vcl::Window>& pParentWin, tools::Rectang else nMenuFlags &= ~MenuFlags::HideDisabledEntries; } - else - { - if (officecfg::Office::Common::View::Menu::DontHideDisabledEntry::get()) - nMenuFlags &= ~MenuFlags::HideDisabledEntries; - else - nMenuFlags |= MenuFlags::HideDisabledEntries; - } sal_uInt16 nVisibleEntries = ImplGetVisibleItemCount(); if ( !nVisibleEntries ) commit 22345c29d126cc7d250ed0c8e35173d1722160f6 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 31 15:45:32 2024 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:50 2024 +0100 tdf#159350 Hiding Options dialog tabpages stopped working regression from commit 3ed7511eca99819012fc1baa490ef85963a9472e Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jul 26 15:21:35 2021 +0200 simplify SvtOptionsDialogOptions Change-Id: If300aefd3b249e64c15bc664ed16c00e743c2b80 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162836 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit 8d9fba2ece350f82f307493b184447dbb44a971d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162826 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/unotools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx index c88bd095106c..12bd76ee7503 100644 --- a/unotools/source/config/optionsdlg.cxx +++ b/unotools/source/config/optionsdlg.cxx @@ -45,7 +45,7 @@ static void ReadNode( SvtOptionsDialogOptions::SvtOptionsDialogOptions() { Reference<css::container::XHierarchicalNameAccess> xHierarchyAccess = utl::ConfigManager::acquireTree(u"Office.OptionsDialog"); - const Sequence< OUString > aNodeSeq = utl::ConfigItem::GetNodeNames( xHierarchyAccess, ROOT_NODE, utl::ConfigNameFormat::LocalPath); + const Sequence< OUString > aNodeSeq = utl::ConfigItem::GetNodeNames( xHierarchyAccess, ROOT_NODE, utl::ConfigNameFormat::LocalNode); OUString sNode( ROOT_NODE + g_sPathDelimiter ); for ( const auto& rNode : aNodeSeq ) { @@ -102,7 +102,7 @@ static void ReadNode( if ( _eType != NT_Option ) { OUString sNodes( sNode + sSet ); - const Sequence< OUString > aNodes = utl::ConfigItem::GetNodeNames( xHierarchyAccess, sNodes, utl::ConfigNameFormat::LocalPath ); + const Sequence< OUString > aNodes = utl::ConfigItem::GetNodeNames( xHierarchyAccess, sNodes, utl::ConfigNameFormat::LocalNode ); for ( const auto& rNode : aNodes ) { OUString sSubNodeName( sNodes + g_sPathDelimiter + rNode ); commit 0e6b781753e980b08989e315ed481047837fce3b Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Mon Jan 22 13:19:26 2024 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Feb 6 12:28:50 2024 +0100 tdf#159128 UI: Open Security settings option directly Open Security Option Setting page directly from Security pop up warning infobar. Follow up of 1f440348eb0892fd2c9597806d87b5fe9d60d49a (tdf#157482 UI: Turn Security Warnings popup windows into infobars) cherry-pick from commit: 2c16ea16b305dc546164e28cf6b212ebccc44ec4 Change-Id: Iac116677801bdb13a9680bcfdf532ec3d874ce0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162393 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162491 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index ffb5fd301069..c53e3432a2a4 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -116,6 +116,7 @@ IMPL_ABSTDLG_CLASS(AbstractScreenshotAnnotationDlg) IMPL_ABSTDLG_CLASS(AbstractSignatureLineDialog) IMPL_ABSTDLG_CLASS(AbstractSignSignatureLineDialog) IMPL_ABSTDLG_CLASS(AbstractSvxCharacterMapDialog) +IMPL_ABSTDLG_CLASS(AbstractSecurityOptionsDialog) IMPL_ABSTDLG_CLASS(AbstractSvxHpLinkDlg) IMPL_ABSTDLG_CLASS(AbstractSvxJSearchOptionsDialog) IMPL_ABSTDLG_CLASS(AbstractSvxMultiPathDialog) @@ -874,6 +875,16 @@ VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateFrameDialog(weld::Wi return nullptr; } +VclPtr<AbstractSecurityOptionsDialog> AbstractDialogFactory_Impl::CreateSvxSecurityOptionsDialog(weld::Window* pParent) +{ + return VclPtr<AbstractSecurityOptionsDialog_Impl>::Create(std::make_unique<svx::SecurityOptionsDialog>(pParent)); +} + +bool AbstractSecurityOptionsDialog_Impl::SetSecurityOptions() +{ + return m_xDlg->SetSecurityOptions(); +} + // TabDialog outside the drawing layer VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateAutoCorrTabDialog(weld::Window* pParent, const SfxItemSet* pAttrSet) { diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 1da0ec35ec38..02ba9a1b0f9d 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -49,6 +49,7 @@ #include <postdlg.hxx> #include <QrCodeGenDialog.hxx> #include <screenshotannotationdlg.hxx> +#include <securityoptions.hxx> #include <showcols.hxx> #include <SignatureLineDialog.hxx> #include <SignSignatureLineDialog.hxx> @@ -402,6 +403,11 @@ DECL_ABSTDLG_CLASS_UNIQUE(AbstractSvxCharacterMapDialog,SfxAbstractDialog,SvxCha DECL_ABSTDLG_CLASS(AbstractScreenshotAnnotationDlg,ScreenshotAnnotationDlg) }; +// AbstractSecurityOptionsDialog_Impl +DECL_ABSTDLG_CLASS(AbstractSecurityOptionsDialog, svx::SecurityOptionsDialog) + virtual bool SetSecurityOptions() override; +}; + // AbstractSignatureLineDialog_Impl DECL_ABSTDLG_CLASS(AbstractSignatureLineDialog,SignatureLineDialog) }; @@ -592,6 +598,8 @@ public: virtual VclPtr<AbstractScreenshotAnnotationDlg> CreateScreenshotAnnotationDlg(weld::Dialog& rParentDialog) override; + virtual VclPtr<AbstractSecurityOptionsDialog> CreateSvxSecurityOptionsDialog(weld::Window* pParent) override; + virtual VclPtr<AbstractSignatureLineDialog> CreateSignatureLineDialog(weld::Window* pParent, const css::uno::Reference<css::frame::XModel> xModel, bool bEditExisting) override; diff --git a/cui/source/options/securityoptions.hxx b/cui/source/inc/securityoptions.hxx similarity index 99% rename from cui/source/options/securityoptions.hxx rename to cui/source/inc/securityoptions.hxx index 7884ccfbd30e..6839e3931822 100644 --- a/cui/source/options/securityoptions.hxx +++ b/cui/source/inc/securityoptions.hxx @@ -72,6 +72,7 @@ namespace svx DECL_LINK(ShowPersonalInfosToggle, weld::Toggleable&, void); + bool SetSecurityOptions(); void changeKeepSecurityInfosEnabled(); }; } diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 083c3e40f784..eaf0e8616bfd 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -27,7 +27,6 @@ #include <vcl/weld.hxx> #include <sfx2/filedlghelper.hxx> #include <vcl/svapp.hxx> -#include <unotools/securityoptions.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <comphelper/diagnose_ex.hxx> @@ -52,7 +51,7 @@ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/task/PasswordContainer.hpp> #include <com/sun/star/task/XPasswordContainer2.hpp> -#include "securityoptions.hxx" +#include <securityoptions.hxx> #include "webconninfo.hxx" #include "certpath.hxx" #include "tsaurls.hxx" @@ -834,25 +833,6 @@ DeactivateRC SvxSecurityTabPage::DeactivatePage( SfxItemSet* _pSet ) return DeactivateRC::LeavePage; } -namespace -{ - bool CheckAndSave( SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModified ) - { - bool bModified = false; - if ( !SvtSecurityOptions::IsReadOnly( _eOpt ) ) - { - bModified = SvtSecurityOptions::IsOptionSet( _eOpt ) != _bIsChecked; - if ( bModified ) - { - SvtSecurityOptions::SetOption( _eOpt, _bIsChecked ); - _rModified = true; - } - } - - return bModified; - } -} - OUString SvxSecurityTabPage::GetAllStrings() { OUString sAllStrings; @@ -892,20 +872,8 @@ bool SvxSecurityTabPage::FillItemSet( SfxItemSet* ) { bool bModified = false; - if (m_xSecOptDlg) - { - CheckAndSave( SvtSecurityOptions::EOption::DocWarnSaveOrSend, m_xSecOptDlg->IsSaveOrSendDocsChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnSigning, m_xSecOptDlg->IsSignDocsChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnPrint, m_xSecOptDlg->IsPrintDocsChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnCreatePdf, m_xSecOptDlg->IsCreatePdfChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, m_xSecOptDlg->IsRemovePersInfoChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, m_xSecOptDlg->IsRemoveRedlineInfoChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, m_xSecOptDlg->IsRemoveDocUserInfoChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, m_xSecOptDlg->IsRemoveNoteAuthorInfoChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, m_xSecOptDlg->IsRemoveDocVersionInfoChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::DocWarnRecommendPassword, m_xSecOptDlg->IsRecommPasswdChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::CtrlClickHyperlink, m_xSecOptDlg->IsCtrlHyperlinkChecked(), bModified ); - CheckAndSave( SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, m_xSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified ); + if (m_xSecOptDlg) { + bModified = m_xSecOptDlg->SetSecurityOptions(); } std::shared_ptr<comphelper::ConfigurationChanges> pBatch( diff --git a/cui/source/options/securityoptions.cxx b/cui/source/options/securityoptions.cxx index d583f626183e..d7523973e367 100644 --- a/cui/source/options/securityoptions.cxx +++ b/cui/source/options/securityoptions.cxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <securityoptions.hxx> #include <unotools/securityoptions.hxx> -#include "securityoptions.hxx" namespace { @@ -31,6 +31,15 @@ namespace rCheckBox.set_active(SvtSecurityOptions::IsOptionSet(eOption)); return bEnable; } + + void CheckAndSave(SvtSecurityOptions::EOption _eOpt, const bool _bIsChecked, bool& _rModified) + { + if (!SvtSecurityOptions::IsReadOnly(_eOpt) && SvtSecurityOptions::IsOptionSet(_eOpt) != _bIsChecked) + { + SvtSecurityOptions::SetOption(_eOpt, _bIsChecked); + _rModified = true; + } + } } namespace svx @@ -103,6 +112,25 @@ void SecurityOptionsDialog::init() changeKeepSecurityInfosEnabled(); } +bool SecurityOptionsDialog::SetSecurityOptions() +{ + bool bModified = false; + CheckAndSave(SvtSecurityOptions::EOption::DocWarnSaveOrSend, IsSaveOrSendDocsChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnSigning, IsSignDocsChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnPrint, IsPrintDocsChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnCreatePdf, IsCreatePdfChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo, IsRemovePersInfoChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepRedlineInfo, IsRemoveRedlineInfoChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepDocUserInfo, IsRemoveDocUserInfoChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo, IsRemoveNoteAuthorInfoChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnKeepDocVersionInfo, IsRemoveDocVersionInfoChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::DocWarnRecommendPassword, IsRecommPasswdChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::CtrlClickHyperlink, IsCtrlHyperlinkChecked(), bModified); + CheckAndSave(SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, IsBlockUntrustedRefererLinksChecked(), bModified); + + return bModified; +} + void SecurityOptionsDialog::changeKeepSecurityInfosEnabled() { bool bEnable = m_xRemovePersInfoCB->get_active(); diff --git a/include/sfx2/sfxdlg.hxx b/include/sfx2/sfxdlg.hxx index 2513bbbb00f1..31bd0c3108ad 100644 --- a/include/sfx2/sfxdlg.hxx +++ b/include/sfx2/sfxdlg.hxx @@ -135,6 +135,8 @@ public: virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML=false, sfx2::SvBaseLink* p=nullptr) = 0; virtual VclPtr<VclAbstractDialog> CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) = 0; + virtual VclPtr<AbstractSecurityOptionsDialog> CreateSvxSecurityOptionsDialog(weld::Window* pParent) = 0; + virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame) = 0; diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 3e1775788dc2..c5479d836855 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -670,6 +670,7 @@ class SvxZoomItem; #define SID_BASICIDE_WATCH TypedWhichId<SfxBoolItem>( SID_BASICIDE_START + 55 ) #define SID_BASICIDE_STACK TypedWhichId<SfxBoolItem>( SID_BASICIDE_START + 56 ) #define SID_OPTIONS_TREEDIALOG ( SID_BASICIDE_START + 862) +#define SID_OPTIONS_SECURITY ( SID_BASICIDE_START + 863) // SlotIds for Apps -------------------------------------------------------- #define FN_PARAM (SID_SW_START + 1100) diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 41158ef2a415..2e6c7d672fc6 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -425,6 +425,8 @@ public: virtual DialogGetRanges GetDialogGetRangesFunc() = 0; + virtual VclPtr<AbstractSecurityOptionsDialog> CreateSvxSecurityOptionsDialog(weld::Window* pParent) override = 0; + virtual VclPtr<AbstractScriptSelectorDialog> CreateScriptSelectorDialog(weld::Window* pParent, const css::uno::Reference< css::frame::XFrame >& rxFrame) override = 0; diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 793d8cdd36a9..137117866d75 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -103,6 +103,14 @@ public: virtual void AllowEmpty() = 0; }; -e ... etc. - the rest is truncated