basctl/source/basicide/baside2b.cxx | 2 basctl/source/basicide/baside3.cxx | 2 basctl/source/basicide/basides1.cxx | 4 basctl/source/basicide/macrodlg.cxx | 4 basctl/source/basicide/moduldl2.cxx | 29 ++-- basctl/source/basicide/moduldlg.cxx | 16 +- basctl/source/basicide/scriptdocument.cxx | 14 +- basic/source/basmgr/basicmanagerrepository.cxx | 22 +-- basic/source/basmgr/basmgr.cxx | 4 cui/source/dialogs/MacroManagerDialog.cxx | 28 ++-- desktop/qa/desktop_lib/test_desktop_lib.cxx | 11 + desktop/source/lib/init.cxx | 20 +++ editeng/source/editeng/editobj.cxx | 21 +++ editeng/source/editeng/editobj2.hxx | 1 include/basctl/scriptdocument.hxx | 4 include/basic/basmgr.hxx | 14 +- include/editeng/editobj.hxx | 3 include/sfx2/app.hxx | 6 include/sfx2/objsh.hxx | 6 sax/source/tools/CachedOutputStream.hxx | 10 - sax/source/tools/fastserializer.cxx | 31 ++--- sax/source/tools/fastserializer.hxx | 9 - sc/inc/viewopti.hxx | 2 sc/source/core/tool/viewopti.cxx | 152 +++++++++++++------------ sfx2/source/appl/appbas.cxx | 6 sfx2/source/appl/appbaslib.cxx | 17 -- sfx2/source/doc/objmisc.cxx | 9 + sfx2/source/doc/objstor.cxx | 42 +----- sfx2/source/doc/objxtor.cxx | 11 - sfx2/source/doc/sfxbasemodel.cxx | 4 sfx2/source/inc/appbaslib.hxx | 2 sfx2/source/inc/objshimp.hxx | 4 sw/source/filter/html/htmlbas.cxx | 6 sw/source/filter/ww8/docxattributeoutput.cxx | 43 +++---- sw/source/filter/ww8/docxexport.cxx | 40 ++---- sw/source/filter/ww8/docxexportfilter.cxx | 30 +--- sw/source/filter/ww8/wrtw8nds.cxx | 2 sw/source/filter/ww8/wrtww8.cxx | 31 ++--- sw/source/filter/ww8/wrtww8.hxx | 5 sw/source/filter/ww8/wrtww8gr.cxx | 17 ++ sw/source/uibase/wrtsh/wrtsh1.cxx | 5 ucb/source/ucp/webdav-curl/CurlSession.cxx | 74 ++++++++++++ 42 files changed, 441 insertions(+), 322 deletions(-)
New commits: commit 1435d2790ed4cf4bd7587bc58f738a2d3f86175f Author: Caolán McNamara <[email protected]> AuthorDate: Sun Feb 9 21:37:00 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:52:41 2025 +0000 cut down the amount of GetBaseModel querying Change-Id: Ib7007a223373232006b8c4261778748b6fe3bf97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181321 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3bb41bde8bb0..20614995e38b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4939,9 +4939,8 @@ DocxStringTokenMap const aExceptionTokens[] = { void DocxAttributeOutput::LatentStyles() { // Do we have latent styles available? - rtl::Reference<SwXTextDocument> xPropertySet(m_rExport.m_rDoc.GetDocShell()->GetBaseModel()); uno::Sequence<beans::PropertyValue> aInteropGrabBag; - xPropertySet->getPropertyValue(u"InteropGrabBag"_ustr) >>= aInteropGrabBag; + m_rExport.m_xTextDoc->getPropertyValue(u"InteropGrabBag"_ustr) >>= aInteropGrabBag; uno::Sequence<beans::PropertyValue> aLatentStyles; auto pProp = std::find_if(std::cbegin(aInteropGrabBag), std::cend(aInteropGrabBag), [](const beans::PropertyValue& rProp) { return rProp.Name == "latentStyles"; }); @@ -5928,9 +5927,8 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S OSL_ASSERT(pFlyFrameFormat); // get interoperability information about embedded objects - rtl::Reference< SwXTextDocument > xPropSet( m_rExport.m_rDoc.GetDocShell()->GetBaseModel() ); uno::Sequence< beans::PropertyValue > aGrabBag, aObjectsInteropList,aObjectInteropAttributes; - xPropSet->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= aGrabBag; + m_rExport.m_xTextDoc->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= aGrabBag; auto pProp = std::find_if(std::cbegin(aGrabBag), std::cend(aGrabBag), [](const beans::PropertyValue& rProp) { return rProp.Name == "EmbeddedObjects"; }); if (pProp != std::cend(aGrabBag)) diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index ffeb0b85a099..9745f4ba71c2 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1247,15 +1247,13 @@ void DocxExport::WriteSettings() m_pAttrOutput->WriteFootnoteEndnotePr( pFS, XML_endnotePr, m_rDoc.GetEndNoteInfo(), XML_endnote ); // Has themeFontLang information - rtl::Reference< SwXTextDocument > xPropSet( pDocShell->GetBaseModel() ); - bool bUseGrabBagProtection = false; bool bWriterWantsToProtect = false; bool bWriterWantsToProtectForm = false; bool bWriterWantsToProtectRedline = false; bool bHasDummyRedlineProtectionKey = false; bool bReadOnlyStatusUnchanged = true; - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo = m_xTextDoc->getPropertySetInfo(); if ( m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::PROTECT_FORM) || m_pSections->DocumentIsProtected() ) { @@ -1264,7 +1262,7 @@ void DocxExport::WriteSettings() if ( xPropSetInfo->hasPropertyByName( u"RedlineProtectionKey"_ustr ) ) { uno::Sequence<sal_Int8> aKey; - xPropSet->getPropertyValue( u"RedlineProtectionKey"_ustr ) >>= aKey; + m_xTextDoc->getPropertyValue( u"RedlineProtectionKey"_ustr ) >>= aKey; bool bHasRedlineProtectionKey = aKey.hasElements(); bHasDummyRedlineProtectionKey = aKey.getLength() == 1 && aKey[0] == 1; if ( bHasRedlineProtectionKey && !bHasDummyRedlineProtectionKey ) @@ -1294,7 +1292,7 @@ void DocxExport::WriteSettings() if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) ) { uno::Sequence< beans::PropertyValue > propList; - xPropSet->getPropertyValue( aGrabBagName ) >>= propList; + m_xTextDoc->getPropertyValue( aGrabBagName ) >>= propList; for (const auto& rProp : propList) { @@ -1539,9 +1537,7 @@ void DocxExport::WriteTheme() // See OOXMLDocumentImpl::resolveGlossaryStream void DocxExport::WriteGlossary() { - rtl::Reference< SwXTextDocument > xPropSet( m_rDoc.GetDocShell()->GetBaseModel() ); - - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo = m_xTextDoc->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; if ( !xPropSetInfo->hasPropertyByName( aName ) ) return; @@ -1549,7 +1545,7 @@ void DocxExport::WriteGlossary() uno::Reference<xml::dom::XDocument> glossaryDocDom; uno::Sequence< uno::Sequence<beans::NamedValue> > glossaryDomList; uno::Sequence< beans::PropertyValue > propList; - xPropSet->getPropertyValue( aName ) >>= propList; + m_xTextDoc->getPropertyValue( aName ) >>= propList; sal_Int32 collectedProperties = 0; for (const auto& rProp : propList) { @@ -1700,16 +1696,14 @@ static void lcl_UpdateXmlValues(const SdtData& sdtData, const uno::Reference<css void DocxExport::WriteCustomXml() { - rtl::Reference< SwXTextDocument > xPropSet( m_rDoc.GetDocShell()->GetBaseModel() ); - - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo = m_xTextDoc->getPropertySetInfo(); if ( !xPropSetInfo->hasPropertyByName( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) ) return; uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomlist; uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomPropslist; uno::Sequence< beans::PropertyValue > propList; - xPropSet->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= propList; + m_xTextDoc->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= propList; auto pProp = std::find_if(std::cbegin(propList), std::cend(propList), [](const beans::PropertyValue& rProp) { return rProp.Name == "OOXCustomXml"; }); if (pProp != std::cend(propList)) @@ -1799,15 +1793,10 @@ void DocxExport::WriteCustomXml() void DocxExport::WriteVBA() { - SwDocShell* pShell = m_rDoc.GetDocShell(); - if (!pShell) - return; - - rtl::Reference<SwXTextDocument> xStorageBasedDocument(pShell->GetBaseModel()); - if (!xStorageBasedDocument.is()) + if (!m_xTextDoc) return; - uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage(); + uno::Reference<embed::XStorage> xDocumentStorage = m_xTextDoc->getDocumentStorage(); OUString aMacrosName(u"_MS_VBA_Macros"_ustr); if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName)) return; @@ -1866,16 +1855,14 @@ void DocxExport::WriteEmbeddings() if (!pShell) return; - rtl::Reference< SwXTextDocument > xPropSet( pShell->GetBaseModel() ); - - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo = m_xTextDoc->getPropertySetInfo(); OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; if ( !xPropSetInfo->hasPropertyByName( aName ) ) return; uno::Sequence< beans::PropertyValue > embeddingsList; uno::Sequence< beans::PropertyValue > propList; - xPropSet->getPropertyValue( aName ) >>= propList; + m_xTextDoc->getPropertyValue( aName ) >>= propList; auto pProp = std::find_if(std::cbegin(propList), std::cend(propList), [](const beans::PropertyValue& rProp) { return rProp.Name == "OOXEmbeddings"; }); if (pProp != std::cend(propList)) @@ -2122,12 +2109,11 @@ sal_Int32 DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt sal_Int32 DocxExport::getWordCompatibilityModeFromGrabBag() const { sal_Int32 nWordCompatibilityMode = -1; - rtl::Reference< SwXTextDocument > xPropSet(m_rDoc.GetDocShell()->GetBaseModel()); - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo = m_xTextDoc->getPropertySetInfo(); if (xPropSetInfo->hasPropertyByName(UNO_NAME_MISC_OBJ_INTEROPGRABBAG)) { uno::Sequence< beans::PropertyValue > propList; - xPropSet->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= propList; + m_xTextDoc->getPropertyValue( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) >>= propList; for (const auto& rProp : propList) { diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index 2a4630a0a40a..8ea56f2f3661 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -73,26 +73,18 @@ bool DocxExportFilter::exportDocument() // Check whether application is in headless mode if (!Application::IsHeadlessModeEnabled()) { - if (SwDocShell* pShell = pDoc->GetDocShell()) + uno::Reference<embed::XStorage> xDocumentStorage = + pTextDoc->getDocumentStorage(); + if (xDocumentStorage.is() && xDocumentStorage->hasByName(u"_MS_VBA_Macros"_ustr)) { - rtl::Reference<SwXTextDocument> xStorageBasedDocument( - pShell->GetBaseModel()); - if (xStorageBasedDocument.is()) - { - uno::Reference<embed::XStorage> xDocumentStorage = - xStorageBasedDocument->getDocumentStorage(); - if (xDocumentStorage.is() && xDocumentStorage->hasByName(u"_MS_VBA_Macros"_ustr)) - { - // Let user know that macros won't be saved in this format - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( - nullptr, - VclMessageType::Warning, VclButtonsType::OkCancel, - SwResId(STR_CANT_SAVE_MACROS)) - ); - if (xBox->run() == RET_CANCEL) - return false; - } - } + // Let user know that macros won't be saved in this format + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( + nullptr, + VclMessageType::Warning, VclButtonsType::OkCancel, + SwResId(STR_CANT_SAVE_MACROS)) + ); + if (xBox->run() == RET_CANCEL) + return false; } } } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index d13aa46e0b09..f69d32753a59 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -121,7 +121,6 @@ #include <fmtwrapinfluenceonobjpos.hxx> #include <officecfg/Office/Common.hxx> #include <fmtanchr.hxx> -#include <unotxdoc.hxx> using namespace css; using namespace sw::util; @@ -3990,7 +3989,10 @@ MSWordExportBase::MSWordExportBase( SwDoc& rDocument, std::shared_ptr<SwUnoCurso , m_pOrigPam(pOriginalPam) { if (SwDocShell* pShell = rDocument.GetDocShell()) - m_bHasBailsMetaData = SwRDFHelper::hasMetadataGraph(pShell->GetBaseModel(), u"urn:bails"_ustr); + { + m_xTextDoc = pShell->GetBaseModel(); + m_bHasBailsMetaData = SwRDFHelper::hasMetadataGraph(m_xTextDoc, u"urn:bails"_ustr); + } } MSWordExportBase::~MSWordExportBase() diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index b9c524bed3d4..bd116fa83f12 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -40,6 +40,7 @@ #include "WW8TableInfo.hxx" #include <calbck.hxx> #include <IDocumentRedlineAccess.hxx> +#include <unotxdoc.hxx> #include <vcl/graph.hxx> @@ -578,6 +579,7 @@ public: bool m_bHasBailsMetaData; // false if there is no urn:bails metadata in the document SwDoc& m_rDoc; + rtl::Reference<SwXTextDocument> m_xTextDoc; SwNodeOffset m_nCurStart, m_nCurEnd; std::shared_ptr<SwUnoCursor> & m_pCurPam; SwPaM *m_pOrigPam; commit b194c5c989576c4406a094eac22f176375a2bfac Author: Caolán McNamara <[email protected]> AuthorDate: Sat Feb 8 19:46:50 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:48:10 2025 +0000 check once if there are any urn:bails metadata in the document for the common case that there are none at all, in which case we don't have to check every paragraph for its metadata. Change-Id: I65a59041d1eeb56db6e312c8b130fbd7d519306a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181304 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bb252ea81660..3bb41bde8bb0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1709,23 +1709,26 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar m_pSerializer->endElementNS( XML_w, XML_pPr ); - // RDF metadata for this text node. - SwTextNode* pTextNode = m_rExport.m_pCurPam->GetPointNode().GetTextNode(); - std::map<OUString, OUString> aStatements; - if (pTextNode) - aStatements = SwRDFHelper::getTextNodeStatements(u"urn:bails"_ustr, *pTextNode); - if (!aStatements.empty()) - { - m_pSerializer->startElementNS(XML_w, XML_smartTag, - FSNS(XML_w, XML_uri), "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - FSNS(XML_w, XML_element), "RDF"); - m_pSerializer->startElementNS(XML_w, XML_smartTagPr); - for (const auto& rStatement : aStatements) - m_pSerializer->singleElementNS(XML_w, XML_attr, - FSNS(XML_w, XML_name), rStatement.first, - FSNS(XML_w, XML_val), rStatement.second); - m_pSerializer->endElementNS(XML_w, XML_smartTagPr); - m_pSerializer->endElementNS(XML_w, XML_smartTag); + if (m_rExport.m_bHasBailsMetaData) + { + // RDF metadata for this text node. + SwTextNode* pTextNode = m_rExport.m_pCurPam->GetPointNode().GetTextNode(); + std::map<OUString, OUString> aStatements; + if (pTextNode) + aStatements = SwRDFHelper::getTextNodeStatements(u"urn:bails"_ustr, *pTextNode); + if (!aStatements.empty()) + { + m_pSerializer->startElementNS(XML_w, XML_smartTag, + FSNS(XML_w, XML_uri), "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + FSNS(XML_w, XML_element), "RDF"); + m_pSerializer->startElementNS(XML_w, XML_smartTagPr); + for (const auto& rStatement : aStatements) + m_pSerializer->singleElementNS(XML_w, XML_attr, + FSNS(XML_w, XML_name), rStatement.first, + FSNS(XML_w, XML_val), rStatement.second); + m_pSerializer->endElementNS(XML_w, XML_smartTagPr); + m_pSerializer->endElementNS(XML_w, XML_smartTag); + } } if ((m_nColBreakStatus == COLBRK_WRITE || m_nColBreakStatus == COLBRK_WRITEANDPOSTPONE) diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index a2b5897ff195..646ed67a955f 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2565,7 +2565,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // At the moment smarttags are only written for paragraphs, at the // beginning of the paragraph. - if (nCurrentPos == 0) + if (nCurrentPos == 0 && m_bHasBailsMetaData) AppendSmartTags(rNode); bool bTextAtr = aAttrIter.IsTextAttr( nCurrentPos ); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 43f142d24cfc..d13aa46e0b09 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -121,6 +121,7 @@ #include <fmtwrapinfluenceonobjpos.hxx> #include <officecfg/Office/Common.hxx> #include <fmtanchr.hxx> +#include <unotxdoc.hxx> using namespace css; using namespace sw::util; @@ -3981,12 +3982,15 @@ MSWordExportBase::MSWordExportBase( SwDoc& rDocument, std::shared_ptr<SwUnoCurso , m_bExportModeRTF(false) , m_bFontSizeWritten(false) , m_bAddFootnoteTab(false) + , m_bHasBailsMetaData(false) , m_rDoc(rDocument) , m_nCurStart(pCurrentPam->GetPoint()->GetNodeIndex()) , m_nCurEnd(pCurrentPam->GetMark()->GetNodeIndex()) , m_pCurPam(pCurrentPam) , m_pOrigPam(pOriginalPam) { + if (SwDocShell* pShell = rDocument.GetDocShell()) + m_bHasBailsMetaData = SwRDFHelper::hasMetadataGraph(pShell->GetBaseModel(), u"urn:bails"_ustr); } MSWordExportBase::~MSWordExportBase() diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 20288160c1af..b9c524bed3d4 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -575,6 +575,7 @@ public: /// Is font size written already as part of the current character properties? bool m_bFontSizeWritten; bool m_bAddFootnoteTab; // only one aesthetic spacing tab per footnote + bool m_bHasBailsMetaData; // false if there is no urn:bails metadata in the document SwDoc& m_rDoc; SwNodeOffset m_nCurStart, m_nCurEnd; commit a23afee944c05395d2c5fee987372e609fa292db Author: Caolán McNamara <[email protected]> AuthorDate: Tue Feb 4 20:08:17 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:47:50 2025 +0000 filter out instance metadata connections Change-Id: Iad8b06515700f88c07bd22fa31fb2deb85dde805 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181144 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Ashod Nakashian <[email protected]> diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx index fc88f9d46c84..028ada4a5ad7 100644 --- a/ucb/source/ucp/webdav-curl/CurlSession.cxx +++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx @@ -49,6 +49,11 @@ #include <tuple> #include <utility> +#ifndef _WIN32 +#include <arpa/inet.h> +#include <netinet/in.h> +#endif + using namespace ::com::sun::star; namespace @@ -646,6 +651,67 @@ static auto ExtractRealm(ResponseHeaders const& rHeaders, char const* const pAut return buf.makeStringAndClear(); } +#ifndef _WIN32 + +static std::string makeIPAddress(const sockaddr& ai_addr) +{ + char addrstr[INET6_ADDRSTRLEN]; + + static_assert(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN, "ipv6 addresses are longer than ipv4"); + const void* inAddr = nullptr; + switch (ai_addr.sa_family) + { + case AF_INET: + { + auto ipv4 = reinterpret_cast<const sockaddr_in*>(&ai_addr); + inAddr = &(ipv4->sin_addr); + break; + } + case AF_INET6: + { + auto ipv6 = reinterpret_cast<const sockaddr_in6*>(&ai_addr); + inAddr = &(ipv6->sin6_addr); + break; + } + } + + if (!inAddr) + { + SAL_WARN("ucb.ucp.webdav.curl", "Unknown sa_family: " << ai_addr.sa_family); + return std::string(); + } + + const char* result = inet_ntop(ai_addr.sa_family, inAddr, addrstr, sizeof(addrstr)); + if (!result) + { + SAL_WARN("ucb.ucp.webdav.curl", "inet_ntop failure"); + return std::string(); + } + return std::string(result); +} + +// filter out connections to instance metadata +static curl_socket_t opensocket_callback(void* /*clientp*/, curlsocktype purpose, + struct curl_sockaddr* address) +{ + if (purpose == CURLSOCKTYPE_IPCXN) + { + if (address->family == AF_INET && makeIPAddress(address->addr) == "169.254.169.254") + { + SAL_WARN("ucb.ucp.webdav.curl", "ignoring instance metadata ip"); + return CURL_SOCKET_BAD; + } + else if (address->family == AF_INET6 && makeIPAddress(address->addr) == "fd00:ec2::254") + { + SAL_WARN("ucb.ucp.webdav.curl", "ignoring instance metadata ip"); + return CURL_SOCKET_BAD; + } + } + return socket(address->family, address->socktype, address->protocol); +} + +#endif + CurlSession::CurlSession(uno::Reference<uno::XComponentContext> xContext, ::rtl::Reference<DAVSessionFactory> const& rpFactory, OUString const& rURI, uno::Sequence<beans::NamedValue> const& rFlags, @@ -763,6 +829,14 @@ CurlSession::CurlSession(uno::Reference<uno::XComponentContext> xContext, rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_SSL_VERIFYHOST, 0L); assert(rc == CURLE_OK); } + +#ifndef _WIN32 + if (comphelper::LibreOfficeKit::isActive()) + { + rc = curl_easy_setopt(m_pCurl.get(), CURLOPT_OPENSOCKETFUNCTION, opensocket_callback); + assert(rc == CURLE_OK); + } +#endif } CurlSession::~CurlSession() {} commit d2b00d6f6fed8cbd6b3ececeead6f10394e02c5a Author: Caolán McNamara <[email protected]> AuthorDate: Wed Feb 5 19:25:04 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:47:15 2025 +0000 defer creating SwMSConvertControls until its needed which might be never Change-Id: I9b1baf2098e092020aa8d10b55622c645e15e745 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181195 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index da7e708aa570..43f142d24cfc 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3443,9 +3443,6 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) m_pRedlAuthors = nullptr; m_aTOXArr.clear(); - if ( !m_pOCXExp && m_rDoc.GetDocShell() ) - m_pOCXExp.reset(new SwMSConvertControls(m_rDoc.GetDocShell(), m_pCurPam.get())); - // #i81405# - Collect anchored objects before changing the redline mode. m_aFrames = GetFrames( m_rDoc, bWriteAll? nullptr : m_pOrigPam ); @@ -4033,6 +4030,13 @@ MSWordSections& WW8Export::Sections() const return *m_pSepx; } +SwMSConvertControls& WW8Export::GetOCXExp() +{ + if (!m_pOCXExp) + m_pOCXExp.reset(new SwMSConvertControls(m_rDoc.GetDocShell(), GetWriter().m_pCurrentPam.get())); + return *m_pOCXExp; +} + SwWW8Writer::SwWW8Writer(std::u16string_view rFltName, const OUString& rBaseURL) : m_pExport( nullptr ), mpMedium( nullptr ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 89999b4a90e3..20288160c1af 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1067,7 +1067,7 @@ public: bool MiserableFormFieldExportHack(const SwFrameFormat& rFrameFormat); - SwMSConvertControls& GetOCXExp() { return *m_pOCXExp; } + SwMSConvertControls& GetOCXExp(); void ExportDopTypography(WW8DopTypography &rTypo); sal_uInt16 AddRedlineAuthor( std::size_t nId ); commit 5e2b8ade503d3e74b981fbf61ca5b453cf0ddf5a Author: Caolán McNamara <[email protected]> AuthorDate: Fri Feb 7 09:27:00 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:46:55 2025 +0000 add Writer/Content/NonprintingCharacter to allowed list Change-Id: I18f44e52d2cd576cd5f94e77305c364f9379e45d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181234 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8350bbfcf599..2005b935484d 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5066,7 +5066,8 @@ static void updateConfig(const OUString& rConfigPath) u"/org.openoffice.Office.Writer/Grid"_ustr, u"/org.openoffice.Office.Writer/Print"_ustr, - u"/org.openoffice.Office.Writer/Content/Display/GraphicObject"_ustr + u"/org.openoffice.Office.Writer/Content/Display/GraphicObject"_ustr, + u"/org.openoffice.Office.Writer/Content/NonprintingCharacter"_ustr }; xUpdate->insertModificationXcuFile(xcustat.getFileURL(), aAllowedSubset, {}); } commit de7fc90b33f3f79e44b64dec71ff39282537f729 Author: Caolán McNamara <[email protected]> AuthorDate: Tue Jan 28 14:59:18 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:46:33 2025 +0000 Don't broadcast SfxHintId::TitleChanged if title doesn't change Change-Id: Id3a0adb8903f269a94fdfb63220305780b96db4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180852 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 0a58635a2f7d..a0296194e807 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -865,9 +865,14 @@ void SfxObjectShell::InvalidateName() { pImpl->aTitle.clear(); - SetName( GetTitle( SFX_TITLE_APINAME ) ); - Broadcast( SfxHint(SfxHintId::TitleChanged) ); + OUString sOldName = GetName(); + OUString sNewName = GetTitle(SFX_TITLE_APINAME); + if (sOldName != sNewName) + { + SetName(sNewName); + Broadcast(SfxHint(SfxHintId::TitleChanged)); + } } commit b2bb043af4f08bc77e3e5b59f588c00dc7f789c9 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Feb 5 16:19:54 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:46:13 2025 +0000 defer getting SvtFilterOptions until its needed which might be never Change-Id: I72c71efd754f40371ce77dd507bdd530ec376855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181189 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index cad075e97d8b..da7e708aa570 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3443,21 +3443,6 @@ ErrCode MSWordExportBase::ExportDocument( bool bWriteAll ) m_pRedlAuthors = nullptr; m_aTOXArr.clear(); - if ( !m_oOLEExp ) - { - sal_uInt32 nSvxMSDffOLEConvFlags = 0; - if (officecfg::Office::Common::Filter::Microsoft::Export::MathToMathType::get()) - nSvxMSDffOLEConvFlags |= OLE_STARMATH_2_MATHTYPE; - if (officecfg::Office::Common::Filter::Microsoft::Export::WriterToWinWord::get()) - nSvxMSDffOLEConvFlags |= OLE_STARWRITER_2_WINWORD; - if (officecfg::Office::Common::Filter::Microsoft::Export::CalcToExcel::get()) - nSvxMSDffOLEConvFlags |= OLE_STARCALC_2_EXCEL; - if (officecfg::Office::Common::Filter::Microsoft::Export::ImpressToPowerPoint::get()) - nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT; - - m_oOLEExp.emplace( nSvxMSDffOLEConvFlags ); - } - if ( !m_pOCXExp && m_rDoc.GetDocShell() ) m_pOCXExp.reset(new SwMSConvertControls(m_rDoc.GetDocShell(), m_pCurPam.get())); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 721cd574be08..f56074685a3a 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -61,6 +61,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <drawdoc.hxx> #include <o3tl/string_view.hxx> +#include <officecfg/Office/Common.hxx> using namespace ::com::sun::star; @@ -237,6 +238,22 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) { sal_Int64 nAspect = rOLENode.GetAspect(); svt::EmbeddedObjectRef aObjRef( xObj, nAspect ); + + if ( !m_oOLEExp ) + { + sal_uInt32 nSvxMSDffOLEConvFlags = 0; + if (officecfg::Office::Common::Filter::Microsoft::Export::MathToMathType::get()) + nSvxMSDffOLEConvFlags |= OLE_STARMATH_2_MATHTYPE; + if (officecfg::Office::Common::Filter::Microsoft::Export::WriterToWinWord::get()) + nSvxMSDffOLEConvFlags |= OLE_STARWRITER_2_WINWORD; + if (officecfg::Office::Common::Filter::Microsoft::Export::CalcToExcel::get()) + nSvxMSDffOLEConvFlags |= OLE_STARCALC_2_EXCEL; + if (officecfg::Office::Common::Filter::Microsoft::Export::ImpressToPowerPoint::get()) + nSvxMSDffOLEConvFlags |= OLE_STARIMPRESS_2_POWERPOINT; + + m_oOLEExp.emplace( nSvxMSDffOLEConvFlags ); + } + m_oOLEExp->ExportOLEObject( aObjRef, *xOleStg ); if ( nAspect == embed::Aspects::MSOLE_ICON ) { commit 82cfb00e9e2ecd828f5007b469ff56baed61b054 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Feb 5 14:20:59 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:45:51 2025 +0000 realloc-ing to 0 is common which frees, we can use a std::vector for this temp storage and avoid the reallocation churn. Change-Id: If7ea4ecb1e6c6a13934b5b9cc59fbb6c80180a42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181184 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 47230fbc20b8..6a5ef7d48ba9 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -700,8 +700,8 @@ namespace sax_fastparser { Int8Sequence& FastSaxSerializer::ForMerge::getData() { - merge( maData, maPostponed, true ); - maPostponed.realloc( 0 ); + merge( maData, maPostponed.data(), maPostponed.size(), true ); + maPostponed.resize(0); return maData; } @@ -716,7 +716,7 @@ namespace sax_fastparser { } std::cerr << " Postponed: "; - for ( sal_Int32 i=0, len=maPostponed.getLength(); i < len; i++ ) + for ( sal_Int32 i=0, len=maPostponed.size(); i < len; i++ ) { std::cerr << maPostponed[i]; } @@ -737,12 +737,12 @@ namespace sax_fastparser { void FastSaxSerializer::ForMerge::postpone( const Int8Sequence &rWhat ) { - merge( maPostponed, rWhat, true ); + const sal_Int8* pData = rWhat.getConstArray(); + maPostponed.insert(maPostponed.end(), pData, pData + rWhat.getLength()); } - void FastSaxSerializer::ForMerge::merge( Int8Sequence &rTop, const Int8Sequence &rMerge, bool bAppend ) + void FastSaxSerializer::ForMerge::merge(Int8Sequence &rTop, const sal_Int8* pMerge, sal_Int32 nMergeLen, bool bAppend) { - sal_Int32 nMergeLen = rMerge.getLength(); if ( nMergeLen <= 0 ) return; @@ -752,16 +752,21 @@ namespace sax_fastparser { if ( bAppend ) { // append the rMerge to the rTop - memcpy( rTop.getArray() + nTopLen, rMerge.getConstArray(), nMergeLen ); + memcpy( rTop.getArray() + nTopLen, pMerge, nMergeLen ); } else { // prepend the rMerge to the rTop memmove( rTop.getArray() + nMergeLen, rTop.getConstArray(), nTopLen ); - memcpy( rTop.getArray(), rMerge.getConstArray(), nMergeLen ); + memcpy( rTop.getArray(), pMerge, nMergeLen ); } } + void FastSaxSerializer::ForMerge::merge( Int8Sequence &rTop, const Int8Sequence &rMerge, bool bAppend ) + { + merge(rTop, rMerge.getConstArray(), rMerge.getLength(), bAppend); + } + void FastSaxSerializer::ForMerge::resetData( ) { maData = Int8Sequence(); diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index 3ed38d59b91c..fc5d6c838717 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -166,7 +166,7 @@ private: class ForMerge : public ForMergeBase { Int8Sequence maData; - Int8Sequence maPostponed; + std::vector<sal_Int8> maPostponed; public: sal_Int32 const m_Tag; @@ -194,6 +194,8 @@ private: protected: void resetData( ); static void merge( Int8Sequence &rTop, const Int8Sequence &rMerge, bool bAppend ); + private: + static void merge( Int8Sequence &rTop, const sal_Int8* pMerge, sal_Int32 nMergeLen, bool bAppend ); }; class ForSort : public ForMerge commit a9458d02ee82e40c48d7190ee32b1dc8997a5c90 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Feb 5 11:47:42 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:45:30 2025 +0000 use more ByteSequence in sax Change-Id: I514b022256acc60c20e430ef6e68815a47859ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181185 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/sax/source/tools/CachedOutputStream.hxx b/sax/source/tools/CachedOutputStream.hxx index 873ed51fe06a..77e21b1d417f 100644 --- a/sax/source/tools/CachedOutputStream.hxx +++ b/sax/source/tools/CachedOutputStream.hxx @@ -21,11 +21,13 @@ namespace sax_fastparser { +typedef rtl::ByteSequence Int8Sequence; + class ForMergeBase { public: virtual ~ForMergeBase() {} - virtual void append( const css::uno::Sequence<sal_Int8>& rWhat ) = 0; + virtual void append( const Int8Sequence& rWhat ) = 0; }; class CachedOutputStream @@ -35,7 +37,7 @@ class CachedOutputStream /// ForMerge structure is used for sorting elements in Writer std::shared_ptr< ForMergeBase > mpForMerge; - const rtl::ByteSequence maCache; + const Int8Sequence maCache; /// Output stream, usually writing data into files. css::uno::Reference< css::io::XOutputStream > mxOutputStream; uno_Sequence *pSeq; @@ -89,7 +91,7 @@ public: if (mbWriteToOutStream) mxOutputStream->writeBytes( css::uno::Sequence<sal_Int8>(pStr, nLen) ); else - mpForMerge->append( css::uno::Sequence<sal_Int8>(pStr, nLen) ); + mpForMerge->append( Int8Sequence(pStr, nLen) ); return; } } @@ -106,7 +108,7 @@ public: if (mbWriteToOutStream) mxOutputStream->writeBytes( css::uno::toUnoSequence(maCache) ); else - mpForMerge->append( css::uno::toUnoSequence(maCache) ); + mpForMerge->append( maCache ); // and next time write to the beginning mnCacheWrittenSize = 0; } diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index ed1fbfafb4a0..47230fbc20b8 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -601,7 +601,7 @@ namespace sax_fastparser { maMarkStack.top()->m_DebugStartedElements.pop_front(); } #endif - Sequence<sal_Int8> aSeq( maMarkStack.top()->getData() ); + Int8Sequence aSeq( maMarkStack.top()->getData() ); maMarkStack.pop(); mbMarkStackEmpty = true; maCachedOutputStream.resetOutputToStream(); @@ -698,7 +698,7 @@ namespace sax_fastparser { maCachedOutputStream.writeBytes( reinterpret_cast<const sal_Int8*>(pStr), nLen ); } - FastSaxSerializer::Int8Sequence& FastSaxSerializer::ForMerge::getData() + Int8Sequence& FastSaxSerializer::ForMerge::getData() { merge( maData, maPostponed, true ); maPostponed.realloc( 0 ); @@ -730,7 +730,7 @@ namespace sax_fastparser { merge( maData, rWhat, false ); } - void FastSaxSerializer::ForMerge::append( const css::uno::Sequence<sal_Int8> &rWhat ) + void FastSaxSerializer::ForMerge::append( const Int8Sequence &rWhat ) { merge( maData, rWhat, true ); } @@ -783,7 +783,7 @@ namespace sax_fastparser { append( rWhat ); } - void FastSaxSerializer::ForSort::append( const css::uno::Sequence<sal_Int8> &rWhat ) + void FastSaxSerializer::ForSort::append( const Int8Sequence &rWhat ) { merge( maData[mnCurrentElement], rWhat, true ); } @@ -803,7 +803,7 @@ namespace sax_fastparser { } } - FastSaxSerializer::Int8Sequence& FastSaxSerializer::ForSort::getData() + Int8Sequence& FastSaxSerializer::ForSort::getData() { sort( ); return ForMerge::getData(); diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx index 8d97caf305a4..3ed38d59b91c 100644 --- a/sax/source/tools/fastserializer.hxx +++ b/sax/source/tools/fastserializer.hxx @@ -45,7 +45,6 @@ typedef std::vector<TokenValue> TokenValueList; /// Receives notification of sax document events to write into an XOutputStream. class FastSaxSerializer { - typedef css::uno::Sequence< ::sal_Int8 > Int8Sequence; typedef css::uno::Sequence< ::sal_Int32 > Int32Sequence; public: @@ -189,7 +188,7 @@ private: #endif virtual void prepend( const Int8Sequence &rWhat ); - virtual void append( const css::uno::Sequence<sal_Int8> &rWhat ) override; + virtual void append( const Int8Sequence &rWhat ) override; void postpone( const Int8Sequence &rWhat ); protected: @@ -220,7 +219,7 @@ private: #endif virtual void prepend( const Int8Sequence &rWhat ) override; - virtual void append( const css::uno::Sequence<sal_Int8> &rWhat ) override; + virtual void append( const Int8Sequence &rWhat ) override; private: void sort(); }; commit 5154e9f8917135a07864b1ccec8959b4f9ad4db4 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Feb 5 10:22:46 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:45:04 2025 +0000 avoid uno casting cost, and simplify these are always XStorageBasedLibraryContainers, so transport around as that and can avoid casting and some expensive throw/catches Change-Id: I772efceea3bb4f38d70be0497345f5f81173494c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181156 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index b7b75b958183..d9a3d83e21e2 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1124,7 +1124,7 @@ void EditorWindow::CreateEditEngine() // set readonly mode for readonly libraries ScriptDocument aDocument(rModulWindow.GetDocument()); OUString aOULibName(rModulWindow.GetLibName()); - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); if (xModLibContainer.is() && xModLibContainer->hasByName(aOULibName) && xModLibContainer->isLibraryReadOnly(aOULibName)) diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 2b2b12b9f0a2..8839731ba926 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -95,7 +95,7 @@ DialogWindow::DialogWindow(DialogWindowLayout* pParent, ScriptDocument const& rD SetHelpId( HID_BASICIDE_DIALOGWINDOW ); // set readonly mode for readonly libraries - Reference< script::XLibraryContainer2 > xDlgLibContainer( GetDocument().getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( GetDocument().getLibraryContainer( E_DIALOGS ) ); if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) ) SetReadOnly(true); diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 1417b3799fb6..7a896cac61d7 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -1278,8 +1278,8 @@ void Shell::GetState(SfxItemSet &rSet) case SID_BASICIDE_NEWMODULE: case SID_BASICIDE_NEWDIALOG: { - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ) ); if ( ( xModLibContainer.is() && xModLibContainer->hasByName( m_aCurLibName ) && xModLibContainer->isLibraryReadOnly( m_aCurLibName ) ) || ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( m_aCurLibName ) && xDlgLibContainer->isLibraryReadOnly( m_aCurLibName ) ) ) rSet.DisableItem(nWh); diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 18ab8e2290f9..8cc6214ae155 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -383,8 +383,8 @@ void MacroChooser::CheckButtons() { const ScriptDocument& aDocument( aDesc.GetDocument() ); const OUString& aOULibName( aDesc.GetLibName() ); - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ) ); if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) { diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 269cf3ff3d3b..fbf972e4f0c0 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -274,8 +274,8 @@ IMPL_LINK(LibPage, EditingEntryHdl, const weld::TreeIter&, rIter, bool) } // check, if library is readonly - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ) ); if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) && !xModLibContainer->isLibraryLink( aLibName ) ) || ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) ) { @@ -317,11 +317,11 @@ IMPL_LINK(LibPage, EditedEntryHdl, const IterString&, rIterString, bool) { try { - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ) ); if ( xModLibContainer.is() ) xModLibContainer->renameLibrary( aOldName, sNewName ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ) ); if ( xDlgLibContainer.is() ) xDlgLibContainer->renameLibrary( aOldName, sNewName ); @@ -378,8 +378,8 @@ void LibPage::CheckButtons() return; OUString aLibName = m_xLibBox->get_text(*xCur, 0); - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ) ); if ( m_eCurLocation == LIBRARY_LOCATION_SHARE ) { @@ -735,9 +735,9 @@ void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog, { OUString aLibName(rView.get_text(nLib)); Reference<script::XLibraryContainer2> xModLibContainer( - rDocument.getLibraryContainer(E_SCRIPTS), UNO_QUERY); + rDocument.getLibraryContainer(E_SCRIPTS)); Reference<script::XLibraryContainer2> xDlgLibContainer( - rDocument.getLibraryContainer(E_DIALOGS), UNO_QUERY); + rDocument.getLibraryContainer(E_DIALOGS)); // check, if the library is already existing if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) || @@ -958,8 +958,7 @@ void ImportLib(const ScriptDocument& rDocument, weld::Dialog* pDialog, void Export(const ScriptDocument& rDocument, const OUString& aLibName, weld::Dialog* pDialog) { // Password verification - Reference<script::XLibraryContainer2> xModLibContainer(rDocument.getLibraryContainer(E_SCRIPTS), - UNO_QUERY); + Reference<script::XLibraryContainer2> xModLibContainer(rDocument.getLibraryContainer(E_SCRIPTS)); if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && !xModLibContainer->isLibraryLoaded( aLibName ) ) { @@ -1190,8 +1189,8 @@ void LibPage::DeleteCurrent() // check, if library is link bool bIsLibraryLink = false; - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ) ); if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryLink( aLibName ) ) || ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryLink( aLibName ) ) ) { @@ -1280,7 +1279,7 @@ void LibPage::ImpInsertLibEntry( const OUString& rLibName, int nPos ) { // check, if library is password protected bool bProtected = false; - Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ) ); if ( xModLibContainer.is() && xModLibContainer->hasByName( rLibName ) ) { Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); @@ -1374,9 +1373,9 @@ void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument, // cannot be renamed/moved since the SfxLibraryContainer::renameLibrary // moves the folders/files on the file system Reference<script::XLibraryContainer2> xModLibContainer( - rDocument.getLibraryContainer(E_SCRIPTS), UNO_QUERY); + rDocument.getLibraryContainer(E_SCRIPTS)); Reference<script::XLibraryContainer2> xDlgLibContainer( - rDocument.getLibraryContainer(E_DIALOGS), UNO_QUERY); + rDocument.getLibraryContainer(E_DIALOGS)); Reference<script::XPersistentLibraryContainer> xModPersLibContainer(xModLibContainer, UNO_QUERY); if (xModPersLibContainer.is()) diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 991fd7d8a4c0..4ca3e2f7f5e6 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -64,8 +64,8 @@ IMPL_LINK(ObjectPage, EditingEntryHdl, const weld::TreeIter&, rEntry, bool) EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(&rEntry); const ScriptDocument& aDocument( aDesc.GetDocument() ); const OUString& aLibName( aDesc.GetLibName() ); - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ) ); if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) ) || ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) ) ) ) { @@ -283,8 +283,8 @@ private: const ScriptDocument& aDocument( aDesc.GetDocument() ); const OUString& aLibName( aDesc.GetLibName() ); // allow MOVE mode only for libraries, which are not readonly - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ) ); if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) ) || ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) ) ) ) { @@ -355,7 +355,7 @@ private: const OUString& aDestLibName = aDestDesc.GetLibName(); // check if module library is not loaded, readonly or password protected - Reference< script::XLibraryContainer2 > xModLibContainer( rDestDoc.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( rDestDoc.getLibraryContainer( E_SCRIPTS ) ); if ( xModLibContainer.is() && xModLibContainer->hasByName( aDestLibName ) ) { if ( !xModLibContainer->isLibraryLoaded( aDestLibName ) ) @@ -370,7 +370,7 @@ private: } // check if dialog library is not loaded or readonly - Reference< script::XLibraryContainer2 > xDlgLibContainer( rDestDoc.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( rDestDoc.getLibraryContainer( E_DIALOGS ) ); if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aDestLibName ) ) { if ( !xDlgLibContainer->isLibraryLoaded( aDestLibName ) ) @@ -647,8 +647,8 @@ void ObjectPage::CheckButtons() bool bReadOnly = false; if ( nDepth > 0 ) { - Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); - Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); + Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) ); + Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ) ); if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) ) || ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) ) ) { diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 722c5c1d8ba8..7bfc082052c2 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -75,6 +75,7 @@ namespace basctl using ::com::sun::star::frame::XModel; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::script::XLibraryContainer; + using ::com::sun::star::script::XStorageBasedLibraryContainer; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; @@ -206,7 +207,7 @@ namespace basctl getDocumentRef() const { return m_xDocument; } /// returns a library container belonging to the document - Reference< XLibraryContainer > + Reference< XStorageBasedLibraryContainer > getLibraryContainer( LibraryContainerType _eType ) const; /// determines whether a given library is part of the shared installation @@ -332,23 +333,22 @@ namespace basctl return m_bValid; } - Reference< XLibraryContainer > ScriptDocument::Impl::getLibraryContainer( LibraryContainerType _eType ) const + Reference<XStorageBasedLibraryContainer> ScriptDocument::Impl::getLibraryContainer( LibraryContainerType _eType ) const { OSL_ENSURE( isValid(), "ScriptDocument::Impl::getLibraryContainer: invalid!" ); - Reference< XLibraryContainer > xContainer; + Reference<XStorageBasedLibraryContainer> xContainer; if ( !isValid() ) return xContainer; try { if ( isApplication() ) - xContainer.set( _eType == E_SCRIPTS ? SfxGetpApp()->GetBasicContainer() : SfxGetpApp()->GetDialogContainer(), UNO_QUERY_THROW ); + xContainer.set(_eType == E_SCRIPTS ? SfxGetpApp()->GetBasicContainer() : SfxGetpApp()->GetDialogContainer()); else { xContainer.set( - _eType == E_SCRIPTS ? m_xScriptAccess->getBasicLibraries() : m_xScriptAccess->getDialogLibraries(), - UNO_QUERY_THROW ); + _eType == E_SCRIPTS ? m_xScriptAccess->getBasicLibraries() : m_xScriptAccess->getDialogLibraries()); } } catch( const Exception& ) @@ -1160,7 +1160,7 @@ namespace basctl } - Reference< XLibraryContainer > ScriptDocument::getLibraryContainer( LibraryContainerType _eType ) const + Reference< XStorageBasedLibraryContainer > ScriptDocument::getLibraryContainer( LibraryContainerType _eType ) const { return m_pImpl->getLibraryContainer( _eType ); } diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 260369cbab21..6581f225f8b3 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -55,7 +55,7 @@ namespace basic using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::embed::XStorage; - using ::com::sun::star::script::XPersistentLibraryContainer; + using ::com::sun::star::script::XStorageBasedLibraryContainer; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::document::XStorageBasedDocument; @@ -168,15 +168,15 @@ namespace basic */ static bool impl_getDocumentLibraryContainers_nothrow( const Reference< XModel >& _rxDocument, - Reference< XPersistentLibraryContainer >& _out_rxBasicLibraries, - Reference< XPersistentLibraryContainer >& _out_rxDialogLibraries + Reference<XStorageBasedLibraryContainer>& _out_rxBasicLibraries, + Reference<XStorageBasedLibraryContainer>& _out_rxDialogLibraries ); /** initializes the given library containers, which belong to a document */ static void impl_initDocLibraryContainers_nothrow( - const Reference< XPersistentLibraryContainer >& _rxBasicLibraries, - const Reference< XPersistentLibraryContainer >& _rxDialogLibraries + const Reference<XStorageBasedLibraryContainer>& _rxBasicLibraries, + const Reference<XStorageBasedLibraryContainer>& _rxDialogLibraries ); // OEventListenerAdapter overridables @@ -374,7 +374,7 @@ namespace basic return m_aStore.find(xNormalized) != m_aStore.end(); } - void ImplRepository::impl_initDocLibraryContainers_nothrow( const Reference< XPersistentLibraryContainer >& _rxBasicLibraries, const Reference< XPersistentLibraryContainer >& _rxDialogLibraries ) + void ImplRepository::impl_initDocLibraryContainers_nothrow( const Reference<XStorageBasedLibraryContainer>& _rxBasicLibraries, const Reference<XStorageBasedLibraryContainer>& _rxDialogLibraries ) { OSL_PRECOND( _rxBasicLibraries.is() && _rxDialogLibraries.is(), "ImplRepository::impl_initDocLibraryContainers_nothrow: illegal library containers, this will crash!" ); @@ -413,8 +413,8 @@ namespace basic // the document is not able to provide the storage it is based on. return false; } - Reference< XPersistentLibraryContainer > xBasicLibs; - Reference< XPersistentLibraryContainer > xDialogLibs; + Reference<XStorageBasedLibraryContainer> xBasicLibs; + Reference<XStorageBasedLibraryContainer> xDialogLibs; if ( !impl_getDocumentLibraryContainers_nothrow( _rxDocumentModel, xBasicLibs, xDialogLibs ) ) { m_aStore.erase(location); @@ -519,15 +519,15 @@ namespace basic bool ImplRepository::impl_getDocumentLibraryContainers_nothrow( const Reference< XModel >& _rxDocument, - Reference< XPersistentLibraryContainer >& _out_rxBasicLibraries, Reference< XPersistentLibraryContainer >& _out_rxDialogLibraries ) + Reference<XStorageBasedLibraryContainer>& _out_rxBasicLibraries, Reference<XStorageBasedLibraryContainer>& _out_rxDialogLibraries ) { _out_rxBasicLibraries.clear(); _out_rxDialogLibraries.clear(); try { Reference< XEmbeddedScripts > xScripts( _rxDocument, UNO_QUERY_THROW ); - _out_rxBasicLibraries.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW ); - _out_rxDialogLibraries.set( xScripts->getDialogLibraries(), UNO_QUERY_THROW ); + _out_rxBasicLibraries.set( xScripts->getBasicLibraries() ); + _out_rxDialogLibraries.set( xScripts->getDialogLibraries() ); } catch( const Exception& ) { diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 5784697e6f47..3112021319da 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -510,12 +510,12 @@ static void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInf } } -const uno::Reference< script::XPersistentLibraryContainer >& BasicManager::GetDialogLibraryContainer() const +const uno::Reference< script::XStorageBasedLibraryContainer >& BasicManager::GetDialogLibraryContainer() const { return maContainerInfo.mxDialogCont; } -const uno::Reference< script::XPersistentLibraryContainer >& BasicManager::GetScriptLibraryContainer() const +const uno::Reference< script::XStorageBasedLibraryContainer >& BasicManager::GetScriptLibraryContainer() const { return maContainerInfo.mxScriptCont; } diff --git a/cui/source/dialogs/MacroManagerDialog.cxx b/cui/source/dialogs/MacroManagerDialog.cxx index fb46edd48640..f39f82ca11c4 100644 --- a/cui/source/dialogs/MacroManagerDialog.cxx +++ b/cui/source/dialogs/MacroManagerDialog.cxx @@ -413,7 +413,7 @@ void ScriptContainersListBox::Insert( OUString aLibName = m_xTreeView->get_text(*xNewEntryIter); css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - aDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + aDocument.getLibraryContainer(basctl::E_SCRIPTS)); if (xModLibContainer.is() && xModLibContainer->hasByName(aLibName)) { css::uno::Reference<css::script::XLibraryContainerPassword> xPasswd( @@ -572,7 +572,7 @@ IMPL_LINK(ScriptContainersListBox, QueryTooltip, const weld::TreeIter&, rEntryIt return OUString(); css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - aDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + aDocument.getLibraryContainer(basctl::E_SCRIPTS)); // check for linked library OUString aLibName = m_xTreeView->get_text(rEntryIter); if (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) @@ -605,7 +605,7 @@ IMPL_LINK(ScriptContainersListBox, ExpandingHdl, const weld::TreeIter&, rEntryIt // check if the library is password protected css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - aDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + aDocument.getLibraryContainer(basctl::E_SCRIPTS)); if (xModLibContainer.is() && xModLibContainer->hasByName(aLibName)) { css::uno::Reference<css::script::XLibraryContainerPassword> xPasswd( @@ -963,7 +963,7 @@ void MacroManagerDialog::UpdateUI() { // if this is a Basic linked library use the link url name for the description string css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - aDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + aDocument.getLibraryContainer(basctl::E_SCRIPTS)); OUString aLibName = rTreeView.get_text(*xSelectedIter); if (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) && xModLibContainer->isLibraryLink(aLibName)) @@ -1077,7 +1077,7 @@ void MacroManagerDialog::CheckButtons() { // check, if library is readonly css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - aDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + aDocument.getLibraryContainer(basctl::E_SCRIPTS)); bool bReadOnly = xModLibContainer.is() && xModLibContainer->hasByName(aLibName) && xModLibContainer->isLibraryReadOnly(aLibName); @@ -1111,9 +1111,9 @@ void MacroManagerDialog::CheckButtons() ScriptContainerType::LIBRARY); css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - aDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + aDocument.getLibraryContainer(basctl::E_SCRIPTS)); css::uno::Reference<css::script::XLibraryContainer2> xDlgLibContainer( - aDocument.getLibraryContainer(basctl::E_DIALOGS), css::uno::UNO_QUERY); + aDocument.getLibraryContainer(basctl::E_DIALOGS)); bool bReadOnly = (xModLibContainer.is() && xModLibContainer->hasByName(aLibName) @@ -1260,7 +1260,7 @@ void MacroManagerDialog::BasicScriptsCreateLibrary(const basctl::ScriptDocument& // cannot be renamed/moved since the SfxLibraryContainer::renameLibrary // moves the folders/files on the file system css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - rDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + rDocument.getLibraryContainer(basctl::E_SCRIPTS)); css::uno::Reference<css::script::XPersistentLibraryContainer> xModPersLibContainer( xModLibContainer, css::uno::UNO_QUERY); if (xModPersLibContainer.is()) @@ -1681,9 +1681,9 @@ bool MacroManagerDialog::IsLibraryReadOnlyOrFailedPasswordQuery( const basctl::ScriptDocument& rDocument, weld::TreeIter* pIter) { css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - rDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + rDocument.getLibraryContainer(basctl::E_SCRIPTS)); css::uno::Reference<css::script::XLibraryContainer2> xDlgLibContainer( - rDocument.getLibraryContainer(basctl::E_DIALOGS), css::uno::UNO_QUERY); + rDocument.getLibraryContainer(basctl::E_DIALOGS)); OUString aLibName = m_xScriptContainersListBox->GetContainerName(*pIter, ScriptContainerType::LIBRARY); @@ -1768,11 +1768,11 @@ void MacroManagerDialog::BasicScriptsLibraryModuleDialogRename( try { css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - rDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + rDocument.getLibraryContainer(basctl::E_SCRIPTS)); if (xModLibContainer.is() && xModLibContainer->hasByName(sOldName)) xModLibContainer->renameLibrary(sOldName, sNewName); css::uno::Reference<css::script::XLibraryContainer2> xDlgLibContainer( - rDocument.getLibraryContainer(basctl::E_DIALOGS), css::uno::UNO_QUERY); + rDocument.getLibraryContainer(basctl::E_DIALOGS)); if (xDlgLibContainer.is() && xDlgLibContainer->hasByName(sOldName)) xDlgLibContainer->renameLibrary(sOldName, sNewName); } @@ -1855,9 +1855,9 @@ void MacroManagerDialog::BasicScriptsLibraryModuleDialogDelete( // check, if library is link bool bIsLibraryLink = false; css::uno::Reference<css::script::XLibraryContainer2> xModLibContainer( - rDocument.getLibraryContainer(basctl::E_SCRIPTS), css::uno::UNO_QUERY); + rDocument.getLibraryContainer(basctl::E_SCRIPTS)); css::uno::Reference<css::script::XLibraryContainer2> xDlgLibContainer( - rDocument.getLibraryContainer(basctl::E_DIALOGS), css::uno::UNO_QUERY); + rDocument.getLibraryContainer(basctl::E_DIALOGS)); if ((xModLibContainer.is() && xModLibContainer->hasByName(aLibName) && xModLibContainer->isLibraryLink(aLibName)) || (xDlgLibContainer.is() && xDlgLibContainer->hasByName(aLibName) diff --git a/include/basctl/scriptdocument.hxx b/include/basctl/scriptdocument.hxx index 645ca1ab055f..b03cdafa1e04 100644 --- a/include/basctl/scriptdocument.hxx +++ b/include/basctl/scriptdocument.hxx @@ -21,7 +21,7 @@ #include "basctldllapi.h" -#include <com/sun/star/script/XLibraryContainer.hpp> +#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/io/XInputStreamProvider.hpp> @@ -210,7 +210,7 @@ namespace basctl If the document is not valid, <NULL/> is returned. */ - css::uno::Reference< css::script::XLibraryContainer > + css::uno::Reference< css::script::XStorageBasedLibraryContainer > getLibraryContainer( LibraryContainerType _eType ) const; /** determines whether there exists a library of the given type, with the given name diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx index b650c6f6cba7..4e8357b0d5f2 100644 --- a/include/basic/basmgr.hxx +++ b/include/basic/basmgr.hxx @@ -29,7 +29,7 @@ namespace basic { class SfxScriptLibraryContainer; } namespace com::sun::star::script { class XLibraryContainer; } -namespace com::sun::star::script { class XPersistentLibraryContainer; } +namespace com::sun::star::script { class XStorageBasedLibraryContainer; } namespace com::sun::star::script { class XStarBasicAccess; } class BasicManager; @@ -58,8 +58,8 @@ namespace basic { class ImplRepository; } struct LibraryContainerInfo { - css::uno::Reference< css::script::XPersistentLibraryContainer > mxScriptCont; - css::uno::Reference< css::script::XPersistentLibraryContainer > mxDialogCont; + css::uno::Reference< css::script::XStorageBasedLibraryContainer > mxScriptCont; + css::uno::Reference< css::script::XStorageBasedLibraryContainer > mxDialogCont; basic::SfxScriptLibraryContainer* mpOldBasicPassword; LibraryContainerInfo() @@ -69,8 +69,8 @@ struct LibraryContainerInfo LibraryContainerInfo ( - css::uno::Reference< css::script::XPersistentLibraryContainer > xScriptCont, - css::uno::Reference< css::script::XPersistentLibraryContainer > xDialogCont, + css::uno::Reference< css::script::XStorageBasedLibraryContainer > xScriptCont, + css::uno::Reference< css::script::XStorageBasedLibraryContainer > xDialogCont, basic::SfxScriptLibraryContainer* pOldBasicPassword ) : mxScriptCont(std::move( xScriptCont )) @@ -136,9 +136,9 @@ public: */ void SetLibraryContainerInfo( const LibraryContainerInfo& rInfo ); - const css::uno::Reference< css::script::XPersistentLibraryContainer >& + const css::uno::Reference< css::script::XStorageBasedLibraryContainer >& GetDialogLibraryContainer() const; - const css::uno::Reference< css::script::XPersistentLibraryContainer >& + const css::uno::Reference< css::script::XStorageBasedLibraryContainer >& GetScriptLibraryContainer() const; bool LoadLib( sal_uInt16 nLib ); diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index d8c1ca989496..2d86b11323e5 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -33,7 +33,7 @@ #include <sfx2/shell.hxx> namespace com::sun::star::frame { class XFrame; } -namespace com::sun::star::script { class XLibraryContainer; } +namespace com::sun::star::script { class XStorageBasedLibraryContainer; } namespace weld { class Window; } @@ -155,8 +155,8 @@ public: static ErrCode CallAppBasic( const OUString& i_macroName ) { return CallBasic( i_macroName, SfxApplication::GetBasicManager(), nullptr, nullptr ); } static BasicManager* GetBasicManager(); - css::script::XLibraryContainer * GetDialogContainer(); - css::script::XLibraryContainer * GetBasicContainer(); + css::script::XStorageBasedLibraryContainer* GetDialogContainer(); + css::script::XStorageBasedLibraryContainer* GetBasicContainer(); static StarBASIC* GetBasic(); void SaveBasicAndDialogContainer() const; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 1c9281b49b87..ef558146780c 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -104,7 +104,7 @@ namespace com::sun::star::embed { class XStorage; } namespace com::sun::star::frame { class XModel; } namespace com::sun::star::graphic { class XGraphic; } namespace com::sun::star::io { class XStream; } -namespace com::sun::star::script { class XLibraryContainer; } +namespace com::sun::star::script { class XStorageBasedLibraryContainer ; } namespace com::sun::star::security { class XCertificate; } namespace com::sun::star::security { class XDocumentDigitalSignatures; } namespace com::sun::star::security { struct DocumentSignatureInformation; } @@ -577,9 +577,9 @@ public: sal_uInt16 GetAutoStyleFilterIndex() const; bool HasBasic() const; BasicManager* GetBasicManager() const; - css::uno::Reference< css::script::XLibraryContainer > + css::uno::Reference< css::script::XStorageBasedLibraryContainer > GetBasicContainer(); - css::uno::Reference< css::script::XLibraryContainer > + css::uno::Reference< css::script::XStorageBasedLibraryContainer > GetDialogContainer(); StarBASIC* GetBasic() const; diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 8929ccf908cf..942967ff21fb 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -23,7 +23,7 @@ #include <cassert> -#include <com/sun/star/script/XLibraryContainer.hpp> +#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> #include <officecfg/Office/Common.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> @@ -70,7 +70,7 @@ BasicManager* SfxApplication::GetBasicManager() #endif } -XLibraryContainer * SfxApplication::GetDialogContainer() +XStorageBasedLibraryContainer* SfxApplication::GetDialogContainer() { #if !HAVE_FEATURE_SCRIPTING return nullptr; @@ -84,7 +84,7 @@ XLibraryContainer * SfxApplication::GetDialogContainer() } -XLibraryContainer * SfxApplication::GetBasicContainer() +XStorageBasedLibraryContainer* SfxApplication::GetBasicContainer() { #if !HAVE_FEATURE_SCRIPTING return nullptr; diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index 2d32e59ee9bc..1f8c96bbfe4a 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -67,15 +67,8 @@ void SfxBasicManagerHolder::reset( BasicManager* _pBasicManager ) return; StartListening(*mpBasicManager); - try - { - mxBasicContainer.set( mpBasicManager->GetScriptLibraryContainer(), UNO_QUERY_THROW ); - mxDialogContainer.set( mpBasicManager->GetDialogLibraryContainer(), UNO_QUERY_THROW ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION("sfx.appl"); - } + mxBasicContainer.set( mpBasicManager->GetScriptLibraryContainer() ); + mxDialogContainer.set( mpBasicManager->GetDialogLibraryContainer() ); #endif } @@ -130,7 +123,7 @@ void SfxBasicManagerHolder::storeLibrariesToStorage( const Reference< XStorage > #endif } -XLibraryContainer * SfxBasicManagerHolder::getLibraryContainer( ContainerType _eType ) +XStorageBasedLibraryContainer* SfxBasicManagerHolder::getLibraryContainer( ContainerType _eType ) { OSL_PRECOND( isValid(), "SfxBasicManagerHolder::getLibraryContainer: not initialized!" ); @@ -167,7 +160,7 @@ com_sun_star_comp_sfx2_ApplicationDialogLibraryContainer_get_implementation( css::uno::Sequence<css::uno::Any> const &) { SfxApplication::GetBasicManager(); - css::uno::XInterface* pRet = SfxGetpApp()->GetDialogContainer(); + css::uno::XInterface* pRet = static_cast<css::script::XLibraryContainer*>(SfxGetpApp()->GetDialogContainer()); pRet->acquire(); return pRet; } @@ -179,7 +172,7 @@ com_sun_star_comp_sfx2_ApplicationScriptLibraryContainer_get_implementation( css::uno::Sequence<css::uno::Any> const &) { SfxApplication::GetBasicManager(); - css::uno::XInterface* pRet = SfxGetpApp()->GetBasicContainer(); + css::uno::XInterface* pRet = static_cast<css::script::XLibraryContainer*>(SfxGetpApp()->GetBasicContainer()); pRet->acquire(); return pRet; } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 8b73bbc5ae98..7178a1cb6499 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2280,23 +2280,10 @@ bool SfxObjectShell::ConnectTmpStorage_Impl( { pImpl->aBasicManager.setStorage( xTmpStorage ); - // Get rid of this workaround after issue i113914 is fixed - try - { - uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY ); - if (xBasicLibraries) - xBasicLibraries->setRootStorage( xTmpStorage ); - } - catch( uno::Exception& ) - {} - try - { - uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY ); - if (xDialogLibraries) - xDialogLibraries->setRootStorage( xTmpStorage ); - } - catch( uno::Exception& ) - {} + if (pImpl->xBasicLibraries) + pImpl->xBasicLibraries->setRootStorage( xTmpStorage ); + if (pImpl->xDialogLibraries) + pImpl->xDialogLibraries->setRootStorage( xTmpStorage ); } } catch( uno::Exception& ) @@ -2446,23 +2433,10 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed, bool bRegisterRecent ) // Set storage in document library containers pImpl->aBasicManager.setStorage( xStorage ); - // Get rid of this workaround after issue i113914 is fixed - try - { - uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries( pImpl->xBasicLibraries, uno::UNO_QUERY ); - if (xBasicLibraries) - xBasicLibraries->setRootStorage( xStorage ); - } - catch( uno::Exception& ) - {} - try - { - uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries( pImpl->xDialogLibraries, uno::UNO_QUERY ); - if (xDialogLibraries) - xDialogLibraries->setRootStorage( xStorage ); - } - catch( uno::Exception& ) - {} + if (pImpl->xBasicLibraries) + pImpl->xBasicLibraries->setRootStorage( xStorage ); + if (pImpl->xDialogLibraries) + pImpl->xDialogLibraries->setRootStorage( xStorage ); } else { diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index e7f62a14dca2..2ff3be238f14 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -717,8 +717,8 @@ bool SfxObjectShell::HasBasic() const #if HAVE_FEATURE_SCRIPTING namespace { - const Reference< XLibraryContainer >& - lcl_getOrCreateLibraryContainer( bool _bScript, Reference< XLibraryContainer >& _rxContainer, + const Reference< XStorageBasedLibraryContainer >& + lcl_getOrCreateLibraryContainer( bool _bScript, Reference< XStorageBasedLibraryContainer >& _rxContainer, const Reference< XModel >& _rxDocument ) { if ( !_rxContainer.is() ) @@ -732,8 +732,7 @@ namespace ? DocumentScriptLibraryContainer::create( xContext, xStorageDoc ) : DocumentDialogLibraryContainer::create( - xContext, xStorageDoc ) - , UNO_QUERY_THROW ); + xContext, xStorageDoc )); } catch (const Exception&) { @@ -745,7 +744,7 @@ namespace } #endif -Reference< XLibraryContainer > SfxObjectShell::GetDialogContainer() +Reference< XStorageBasedLibraryContainer > SfxObjectShell::GetDialogContainer() { #if HAVE_FEATURE_SCRIPTING try @@ -767,7 +766,7 @@ Reference< XLibraryContainer > SfxObjectShell::GetDialogContainer() return SfxGetpApp()->GetDialogContainer(); } -Reference< XLibraryContainer > SfxObjectShell::GetBasicContainer() +Reference< XStorageBasedLibraryContainer > SfxObjectShell::GetBasicContainer() { #if HAVE_FEATURE_SCRIPTING if (!comphelper::IsFuzzing()) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index c0b143c290ca..2d9518530416 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2460,7 +2460,7 @@ Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getBas Reference< script::XStorageBasedLibraryContainer > xBasicLibraries; if ( m_pData->m_pObjectShell.is() ) - xBasicLibraries.set(m_pData->m_pObjectShell->GetBasicContainer(), UNO_QUERY); + xBasicLibraries.set(m_pData->m_pObjectShell->GetBasicContainer()); return xBasicLibraries; } @@ -2470,7 +2470,7 @@ Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getDia Reference< script::XStorageBasedLibraryContainer > xDialogLibraries; if ( m_pData->m_pObjectShell.is() ) - xDialogLibraries.set(m_pData->m_pObjectShell->GetDialogContainer(), UNO_QUERY); + xDialogLibraries.set(m_pData->m_pObjectShell->GetDialogContainer()); return xDialogLibraries; } diff --git a/sfx2/source/inc/appbaslib.hxx b/sfx2/source/inc/appbaslib.hxx index 04f419996008..34dc04438bef 100644 --- a/sfx2/source/inc/appbaslib.hxx +++ b/sfx2/source/inc/appbaslib.hxx @@ -62,7 +62,7 @@ public: */ void reset( BasicManager* _pBasicManager ); - css::script::XLibraryContainer * + css::script::XStorageBasedLibraryContainer* getLibraryContainer( ContainerType _eType ); /** calls the storeLibraries at both our script and basic library container diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 87499380e997..e4c4e07c8f6a 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -55,9 +55,9 @@ struct SfxObjectShell_Impl final : public ::sfx2::IMacroDocumentAccess std::unique_ptr<::comphelper::EmbeddedObjectContainer> mxObjectContainer; SfxBasicManagerHolder aBasicManager; SfxObjectShell& rDocShell; - css::uno::Reference< css::script::XLibraryContainer > + css::uno::Reference< css::script::XStorageBasedLibraryContainer > xBasicLibraries; - css::uno::Reference< css::script::XLibraryContainer > + css::uno::Reference< css::script::XStorageBasedLibraryContainer > xDialogLibraries; ::sfx2::DocumentMacroMode aMacroMode; diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 1ed9c751080d..0dd129f831c2 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/script/XLibraryContainer.hpp> +#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <fmtfld.hxx> @@ -114,7 +114,7 @@ void SwHTMLParser::EndScript() aLibName = "Standard"; // get module library container - Reference< script::XLibraryContainer > xModLibContainer = pDocSh->GetBasicContainer(); + Reference< script::XStorageBasedLibraryContainer > xModLibContainer = pDocSh->GetBasicContainer(); if ( xModLibContainer.is() ) { @@ -156,7 +156,7 @@ void SwHTMLParser::EndScript() } // get dialog library container - Reference< script::XLibraryContainer > xDlgLibContainer = pDocSh->GetDialogContainer(); + Reference< script::XStorageBasedLibraryContainer > xDlgLibContainer = pDocSh->GetDialogContainer(); if ( xDlgLibContainer.is() ) { commit bd55eb2fe3737509cf5d125dff827775248967ac Author: Caolán McNamara <[email protected]> AuthorDate: Tue Feb 4 16:18:23 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:44:40 2025 +0000 make calc Display config listen for changes Change-Id: I36a9118f8a29ccd543da9510e9ecf11ebf02b2f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181131 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx index 2b0a7ef725af..eb3fcbc87199 100644 --- a/sc/inc/viewopti.hxx +++ b/sc/inc/viewopti.hxx @@ -162,9 +162,11 @@ class ScViewCfg : public ScViewOptions DECL_LINK( LayoutCommitHdl, ScLinkConfigItem&, void ); DECL_LINK( DisplayCommitHdl, ScLinkConfigItem&, void ); + DECL_LINK( DisplayNotifyHdl, ScLinkConfigItem&, void ); DECL_LINK( GridCommitHdl, ScLinkConfigItem&, void ); DECL_LINK( GridNotifyHdl, ScLinkConfigItem&, void ); + void ReadDisplayCfg(); void ReadGridCfg(); static css::uno::Sequence<OUString> GetLayoutPropertyNames(); diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx index bd2f110640d3..1d5980ee0a24 100644 --- a/sc/source/core/tool/viewopti.cxx +++ b/sc/source/core/tool/viewopti.cxx @@ -284,8 +284,6 @@ ScViewCfg::ScViewCfg() : aDisplayItem( CFGPATH_DISPLAY ), aGridItem( CFGPATH_GRID ) { - sal_Int32 nIntVal = 0; - Sequence<OUString> aNames = GetLayoutPropertyNames(); Sequence<Any> aValues = aLayoutItem.GetProperties(aNames); aLayoutItem.EnableNotification(aNames); @@ -346,73 +344,10 @@ ScViewCfg::ScViewCfg() : } aLayoutItem.SetCommitLink( LINK( this, ScViewCfg, LayoutCommitHdl ) ); - aNames = GetDisplayPropertyNames(); - aValues = aDisplayItem.GetProperties(aNames); - aDisplayItem.EnableNotification(aNames); - pValues = aValues.getConstArray(); - OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed"); - if(aValues.getLength() == aNames.getLength()) - { - for(int nProp = 0; nProp < aNames.getLength(); nProp++) - { - OSL_ENSURE(pValues[nProp].hasValue(), "property value missing"); - if(pValues[nProp].hasValue()) - { - switch(nProp) - { - case SCDISPLAYOPT_FORMULA: - SetOption( VOPT_FORMULAS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; - case SCDISPLAYOPT_ZEROVALUE: - SetOption( VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; - case SCDISPLAYOPT_NOTETAG: - SetOption( VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; - case SCDISPLAYOPT_NOTEAUTHOR: - SetOption( VOPT_NOTEAUTHOR, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; - case SCDISPLAYOPT_FORMULAMARK: - SetOption( VOPT_FORMULAS_MARKS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; - case SCDISPLAYOPT_VALUEHI: - SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; - case SCDISPLAYOPT_ANCHOR: - SetOption( VOPT_ANCHOR, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); - break; - case SCDISPLAYOPT_OBJECTGRA: - if ( pValues[nProp] >>= nIntVal ) - { - //#i80528# adapt to new range eventually - if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); - - SetObjMode( VOBJ_TYPE_OLE, static_cast<ScVObjMode>(nIntVal)); - } - break; - case SCDISPLAYOPT_CHART: - if ( pValues[nProp] >>= nIntVal ) - { - //#i80528# adapt to new range eventually - if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); - - SetObjMode( VOBJ_TYPE_CHART, static_cast<ScVObjMode>(nIntVal)); - } - break; - case SCDISPLAYOPT_DRAWING: - if ( pValues[nProp] >>= nIntVal ) - { - //#i80528# adapt to new range eventually - if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); - - SetObjMode( VOBJ_TYPE_DRAW, static_cast<ScVObjMode>(nIntVal)); - } - break; - } - } - } - } + aDisplayItem.EnableNotification(GetDisplayPropertyNames()); + ReadDisplayCfg(); aDisplayItem.SetCommitLink( LINK( this, ScViewCfg, DisplayCommitHdl ) ); + aDisplayItem.SetNotifyLink( LINK( this, ScViewCfg, DisplayNotifyHdl ) ); aGridItem.EnableNotification(GetGridPropertyNames()); ReadGridCfg(); @@ -471,6 +406,82 @@ IMPL_LINK_NOARG(ScViewCfg, LayoutCommitHdl, ScLinkConfigItem&, void) aLayoutItem.PutProperties(aNames, aValues); } +void ScViewCfg::ReadDisplayCfg() +{ + const Sequence<OUString> aNames = GetDisplayPropertyNames(); + const Sequence<Any> aValues = aDisplayItem.GetProperties(aNames); + OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed"); + if (aValues.getLength() != aNames.getLength()) + return; + + sal_Int32 nIntVal = 0; + + const Any* pValues = aValues.getConstArray(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + OSL_ENSURE(pValues[nProp].hasValue(), "property value missing"); + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case SCDISPLAYOPT_FORMULA: + SetOption( VOPT_FORMULAS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCDISPLAYOPT_ZEROVALUE: + SetOption( VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCDISPLAYOPT_NOTETAG: + SetOption( VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCDISPLAYOPT_NOTEAUTHOR: + SetOption( VOPT_NOTEAUTHOR, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCDISPLAYOPT_FORMULAMARK: + SetOption( VOPT_FORMULAS_MARKS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCDISPLAYOPT_VALUEHI: + SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCDISPLAYOPT_ANCHOR: + SetOption( VOPT_ANCHOR, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCDISPLAYOPT_OBJECTGRA: + if ( pValues[nProp] >>= nIntVal ) + { + //#i80528# adapt to new range eventually + if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); + + SetObjMode( VOBJ_TYPE_OLE, static_cast<ScVObjMode>(nIntVal)); + } + break; + case SCDISPLAYOPT_CHART: + if ( pValues[nProp] >>= nIntVal ) + { + //#i80528# adapt to new range eventually + if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); + + SetObjMode( VOBJ_TYPE_CHART, static_cast<ScVObjMode>(nIntVal)); + } + break; + case SCDISPLAYOPT_DRAWING: + if ( pValues[nProp] >>= nIntVal ) + { + //#i80528# adapt to new range eventually + if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); + + SetObjMode( VOBJ_TYPE_DRAW, static_cast<ScVObjMode>(nIntVal)); + } + break; + } + } + } +} + +IMPL_LINK_NOARG(ScViewCfg, DisplayNotifyHdl, ScLinkConfigItem&, void) +{ + ReadDisplayCfg(); +} + IMPL_LINK_NOARG(ScViewCfg, DisplayCommitHdl, ScLinkConfigItem&, void) { Sequence<OUString> aNames = GetDisplayPropertyNames(); @@ -567,7 +578,10 @@ void ScViewCfg::ReadGridCfg() SetGridOptions( aGrid ); } -IMPL_LINK_NOARG(ScViewCfg, GridNotifyHdl, ScLinkConfigItem&, void) { ReadGridCfg(); } +IMPL_LINK_NOARG(ScViewCfg, GridNotifyHdl, ScLinkConfigItem&, void) +{ + ReadGridCfg(); +} IMPL_LINK_NOARG(ScViewCfg, GridCommitHdl, ScLinkConfigItem&, void) { commit 1acada580300fc2a742950a72eb4c9ae98c305a4 Author: Caolán McNamara <[email protected]> AuthorDate: Tue Feb 4 13:55:59 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:44:14 2025 +0000 Filter kit xcu to an allowed subset of options Change-Id: I577de4f4c9ec2207be466fd2c2b1fa2548fe0197 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181115 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b686c2379e78..8350bbfcf599 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5051,7 +5051,24 @@ static void updateConfig(const OUString& rConfigPath) } SAL_INFO("lok", "Installing XCU Item: " << xcustat.getFileName()); - xUpdate->insertModificationXcuFile(xcustat.getFileURL(), { u"/"_ustr }, {}); + // Filter xcu to a subset of options to allow + const uno::Sequence<OUString> aAllowedSubset{ + u"/org.openoffice.Office.Calc/Grid"_ustr, + u"/org.openoffice.Office.Calc/Print"_ustr, + u"/org.openoffice.Office.Calc/Content/Display/ObjectGraphic"_ustr, + u"/org.openoffice.Office.Calc/Content/Display/FormulaMark"_ustr, + + u"/org.openoffice.Office.Draw/Grid"_ustr, + u"/org.openoffice.Office.Draw/Print"_ustr, + + u"/org.openoffice.Office.Impress/Grid"_ustr, + u"/org.openoffice.Office.Impress/Print"_ustr, + + u"/org.openoffice.Office.Writer/Grid"_ustr, + u"/org.openoffice.Office.Writer/Print"_ustr, + u"/org.openoffice.Office.Writer/Content/Display/GraphicObject"_ustr + }; + xUpdate->insertModificationXcuFile(xcustat.getFileURL(), aAllowedSubset, {}); } } } commit 612b858daca0c2e50d6de8d9b4eddb61df9ef457 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Jan 1 21:55:00 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Wed Feb 12 12:42:52 2025 +0000 undo/redo of comment insertion assumes Par2 content matches TextObject contents (as much as conversion to plain text makes possible) To make things easier, add an EditTextObject::GetText() like EditEngine::GetText() that serializes multiple paragraphs in an equivalent way so there isn't a need to create an editengine just to do this conversion. Modify and extend DesktopLOKTest::testCommentsCallbacksWriter to use a html payload and add a undo/redo to it. Change-Id: I4d895138e919bab54ebbbcb966f9b9faef574086 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179594 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180377 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 7bca2926e948..cc8bbe5400e9 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2583,7 +2583,7 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT_EQUAL(nCommentId2, aView2.m_aCommentCallbackResult.get<int>("id")); // Reply to nCommentId1 again - aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Text\": { \"type\": \"string\", \"value\": \"Reply comment again\" } }"; + aCommandArgs = "{ \"Id\": { \"type\": \"string\", \"value\": \"" + OString::number(nCommentId1) + "\" }, \"Html\": { \"type\": \"string\", \"value\": \"Reply comment again\" } }"; pDocument->pClass->postUnoCommand(pDocument, ".uno:ReplyComment", aCommandArgs.getStr(), false); Scheduler::ProcessEventsToIdle(); @@ -2595,6 +2595,15 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT_EQUAL(std::string("<div>Reply comment again</div>"), aView1.m_aCommentCallbackResult.get<std::string>("html")); CPPUNIT_ASSERT_EQUAL(std::string("<div>Reply comment again</div>"), aView2.m_aCommentCallbackResult.get<std::string>("html")); + // Ensure that an undo and redo restores the html contents + aView1.m_aCommentCallbackResult.clear(); + aView2.m_aCommentCallbackResult.clear(); -e ... etc. - the rest is truncated
