diff --git a/SOURCES/0001-disable-generation-of-ole-previews-in-ODF-format-unt.patch b/SOURCES/0001-disable-generation-of-ole-previews-in-ODF-format-unt.patch new file mode 100644 index 0000000..7df8b23 --- /dev/null +++ b/SOURCES/0001-disable-generation-of-ole-previews-in-ODF-format-unt.patch @@ -0,0 +1,575 @@ +From da6682c1cf339cb711a6ba2d28673978d42e446a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 13 Sep 2016 12:32:04 +0100 +Subject: [PATCH] disable generation of ole previews in ODF format until after + load +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +so the user update links dialog can control their generation + +SdrEmbedObjectLink becomes exposed to calc so it can +detect if the link dialog needs to be used to update +ole links. + +Reviewed-on: https://gerrit.libreoffice.org/28879 +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 74844277cc2194c9e43f5bd7a6f78a9603da32f3) + +detangle gadzillion checks into something readable + +no logic change intended + +(cherry picked from commit fad9786b06d188ba6e354620f57176f3d94a6637) + ++ partial merge of + +commit c09b3e32372537be739182b02ae83a96386d1e1c +Author: Noel Grandin +Date: Tue Mar 8 13:13:59 2016 +0200 + + loplugin:constantparam in sw + +for bool bUI is always true in UpdateLinks + +Unmodified default SdrOle2Obj size is 101x101 + +svx/source/unodraw/unoshape.cxx + +sets a css::awt::Size maSize to 100, 100 + +svx/source/unodraw/unopage.cxx + +increases that by 1, 1 + +awt::Size aSize = xShape->getSize(); +aSize.Width += 1; +aSize.Height += 1; + +to call SdrObjFactory::MakeNewObject with 101, 101 +so default size is 101x101 (getWidth() vs GetWidth() confusion ?) + +Reviewed-on: https://gerrit.libreoffice.org/28895 +Reviewed-by: Caolán McNamara +Tested-by: Caolán McNamara +(cherry picked from commit 7f0a219c9ad38ae33b51ff69d545f69659691c1e) + +b6af93afc1f80b7fc36239c96d5e0a71fcbcb789 +4d4375dff64d7b8e236d1a24322e749e04ee530f +Reviewed-on: https://gerrit.libreoffice.org/28930 +Tested-by: Jenkins +Reviewed-by: Michael Stahl +Reviewed-by: Eike Rathke +Tested-by: Eike Rathke + +(cherry picked from commit 2ff4c68b63c4842ec85a21287317096b6ca8e66e) + +Change-Id: Id1dd7ea17342140eab9307d546528747e3a98090 +--- + embeddedobj/source/commonembedding/visobj.cxx | 6 +- + include/svx/svdoole2.hxx | 16 ++++ + sc/inc/documentlinkmgr.hxx | 5 +- + sc/source/ui/docshell/docsh.cxx | 7 +- + sc/source/ui/docshell/docsh4.cxx | 12 ++- + sc/source/ui/docshell/documentlinkmgr.cxx | 26 ++++++- + sc/source/ui/view/tabvwsh4.cxx | 2 +- + sd/source/core/drawdoc.cxx | 6 ++ + sd/source/ui/docshell/docshel4.cxx | 5 +- + svx/source/svdraw/svdoole2.cxx | 20 ----- + svx/source/unodraw/unoshap4.cxx | 4 +- + sw/inc/IDocumentLinksAdministration.hxx | 2 +- + .../doc/DocumentLinksAdministrationManager.cxx | 85 ++++++++++++---------- + .../inc/DocumentLinksAdministrationManager.hxx | 2 +- + sw/source/filter/basflt/shellio.cxx | 2 +- + sw/source/uibase/app/docsh.cxx | 2 +- + sw/source/uibase/app/docshini.cxx | 3 + + 17 files changed, 131 insertions(+), 74 deletions(-) + +diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx +index fea7c3a2cf0a..3ee85851af9f 100644 +--- a/embeddedobj/source/commonembedding/visobj.cxx ++++ b/embeddedobj/source/commonembedding/visobj.cxx +@@ -174,7 +174,11 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe + bool bBackToLoaded = false; + if ( m_nObjectState == embed::EmbedStates::LOADED ) + { +- changeState( embed::EmbedStates::RUNNING ); ++ awt::Size aOrigSize = getVisualAreaSize(nAspect); ++ changeState(embed::EmbedStates::RUNNING); ++ awt::Size aNewSize = getVisualAreaSize(nAspect); ++ if (aOrigSize.Width != aNewSize.Width || aOrigSize.Height != aNewSize.Height) ++ setVisualAreaSize(nAspect, aOrigSize); + + // the links should be switched back to loaded state for now to avoid locking problems + bBackToLoaded = m_bIsLink; +diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx +index f14646b20428..7f47ebff607b 100644 +--- a/include/svx/svdoole2.hxx ++++ b/include/svx/svdoole2.hxx +@@ -22,6 +22,7 @@ + + #include + #include ++#include + + #include + +@@ -179,6 +180,21 @@ public: + virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE; + }; + ++class SVX_DLLPUBLIC SdrEmbedObjectLink : public sfx2::SvBaseLink ++{ ++ SdrOle2Obj* pObj; ++ ++public: ++ explicit SdrEmbedObjectLink(SdrOle2Obj* pObj); ++ virtual ~SdrEmbedObjectLink(); ++ ++ virtual void Closed() override; ++ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged( ++ const OUString& rMimeType, const css::uno::Any & rValue ) override; ++ ++ bool Connect() { return GetRealObject() != nullptr; } ++}; ++ + #endif // INCLUDED_SVX_SVDOOLE2_HXX + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +diff --git a/sc/inc/documentlinkmgr.hxx b/sc/inc/documentlinkmgr.hxx +index 0af5cf896c63..cc42410ca3dc 100644 +--- a/sc/inc/documentlinkmgr.hxx ++++ b/sc/inc/documentlinkmgr.hxx +@@ -53,14 +53,17 @@ public: + bool idleCheckLinks(); + + bool hasDdeLinks() const; ++ bool hasDdeOrOleLinks() const; + +- bool updateDdeLinks( vcl::Window* pWin ); ++ bool updateDdeOrOleLinks(vcl::Window* pWin); + + bool updateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem ); + + size_t getDdeLinkCount() const; + + void disconnectDdeLinks(); ++private: ++ bool hasDdeOrOleLinks(bool bDde, bool bOle) const; + }; + + } +diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx +index d0c083625465..25dab86e5ca0 100644 +--- a/sc/source/ui/docshell/docsh.cxx ++++ b/sc/source/ui/docshell/docsh.cxx +@@ -561,9 +561,12 @@ bool ScDocShell::Load( SfxMedium& rMedium ) + + GetUndoManager()->Clear(); + +- bool bRet = SfxObjectShell::Load( rMedium ); +- if( bRet ) ++ bool bRet = SfxObjectShell::Load(rMedium); ++ if (bRet) + { ++ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); ++ + if (GetMedium()) + { + SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, false); +diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx +index 969c678e4ce1..9fcf549c8920 100644 +--- a/sc/source/ui/docshell/docsh4.cxx ++++ b/sc/source/ui/docshell/docsh4.cxx +@@ -29,6 +29,7 @@ using namespace ::com::sun::star; + + #include "scitems.hxx" + #include ++#include + #include + #include + #include +@@ -42,6 +43,7 @@ using namespace ::com::sun::star; + #include + #include + #include ++#include + #include + #include + #include +@@ -407,6 +409,9 @@ void ScDocShell::Execute( SfxRequest& rReq ) + break; + case SID_UPDATETABLINKS: + { ++ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); ++ + ScDocument& rDoc = GetDocument(); + + ScLkUpdMode nSet = rDoc.GetLinkMode(); +@@ -450,9 +455,9 @@ void ScDocShell::Execute( SfxRequest& rReq ) + ReloadTabLinks(); + aDocument.UpdateExternalRefLinks(GetActiveDialogParent()); + +- bool bAny = aDocument.GetDocLinkManager().updateDdeLinks(GetActiveDialogParent()); ++ bool bAnyDde = aDocument.GetDocLinkManager().updateDdeOrOleLinks(GetActiveDialogParent()); + +- if (bAny) ++ if (bAnyDde) + { + // Formeln berechnen und painten wie im TrackTimeHdl + aDocument.TrackFormulas(); +@@ -468,7 +473,10 @@ void ScDocShell::Execute( SfxRequest& rReq ) + rReq.Done(); + } + else ++ { ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + rReq.Ignore(); ++ } + } + break; + +diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx +index 42745eb3f344..8e5a5c3a02bb 100644 +--- a/sc/source/ui/docshell/documentlinkmgr.cxx ++++ b/sc/source/ui/docshell/documentlinkmgr.cxx +@@ -23,7 +23,7 @@ + #include + #include + +-#include ++#include + #include + + #include +@@ -115,6 +115,16 @@ bool DocumentLinkManager::idleCheckLinks() + + bool DocumentLinkManager::hasDdeLinks() const + { ++ return hasDdeOrOleLinks(true, false); ++} ++ ++bool DocumentLinkManager::hasDdeOrOleLinks() const ++{ ++ return hasDdeOrOleLinks(true, true); ++} ++ ++bool DocumentLinkManager::hasDdeOrOleLinks(bool bDde, bool bOle) const ++{ + if (!mpImpl->mpLinkManager) + return false; + +@@ -122,14 +132,16 @@ bool DocumentLinkManager::hasDdeLinks() const + for (size_t i = 0, n = rLinks.size(); i < n; ++i) + { + sfx2::SvBaseLink* pBase = *rLinks[i]; +- if (dynamic_cast(pBase)) ++ if (bDde && dynamic_cast(pBase)) ++ return true; ++ if (bOle && dynamic_cast(pBase)) + return true; + } + + return false; + } + +-bool DocumentLinkManager::updateDdeLinks( vcl::Window* pWin ) ++bool DocumentLinkManager::updateDdeOrOleLinks( vcl::Window* pWin ) + { + if (!mpImpl->mpLinkManager) + return false; +@@ -143,6 +155,14 @@ bool DocumentLinkManager::updateDdeLinks( vcl::Window* pWin ) + for (size_t i = 0, n = rLinks.size(); i < n; ++i) + { + sfx2::SvBaseLink* pBase = *rLinks[i]; ++ ++ SdrEmbedObjectLink* pOleLink = dynamic_cast(pBase); ++ if (pOleLink) ++ { ++ pOleLink->Update(); ++ continue; ++ } ++ + ScDdeLink* pDdeLink = dynamic_cast(pBase); + if (!pDdeLink) + continue; +diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx +index 64a6e9f0f063..ff3a5a1d94f1 100644 +--- a/sc/source/ui/view/tabvwsh4.cxx ++++ b/sc/source/ui/view/tabvwsh4.cxx +@@ -1584,7 +1584,7 @@ void ScTabViewShell::Construct( TriState nForceDesignMode ) + if (!bLink) + { + const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager(); +- if (rMgr.hasDdeLinks() || rDoc.HasAreaLinks()) ++ if (rMgr.hasDdeOrOleLinks() || rDoc.HasAreaLinks()) + bLink = true; + } + if (bLink) +diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx +index f820fabaab81..6b5673f66592 100644 +--- a/sd/source/core/drawdoc.cxx ++++ b/sd/source/core/drawdoc.cxx +@@ -694,6 +694,12 @@ void SdDrawDocument::UpdateAllLinks() + { + pDocLockedInsertingLinks = this; // lock inserting links. only links in this document should by resolved + ++ if (mpDocSh) ++ { ++ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = mpDocSh->getEmbeddedObjectContainer(); ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); ++ } ++ + pLinkManager->UpdateAllLinks(); // query box: update all links? + + if( pDocLockedInsertingLinks == this ) +diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx +index bed2fd7b4e97..b56f46e717f9 100644 +--- a/sd/source/ui/docshell/docshel4.cxx ++++ b/sd/source/ui/docshell/docshel4.cxx +@@ -285,8 +285,11 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) + } + + bRet = SfxObjectShell::Load( rMedium ); +- if( bRet ) ++ if (bRet) + { ++ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); ++ + bRet = SdXMLFilter( rMedium, *this, true, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError ); + } + +diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx +index 403646b6f10e..8985a3bb8a60 100644 +--- a/svx/source/svdraw/svdoole2.cxx ++++ b/svx/source/svdraw/svdoole2.cxx +@@ -58,7 +58,6 @@ + #include + + #include +-#include + #include + #include + +@@ -588,25 +587,6 @@ void SdrLightEmbeddedClient_Impl::setWindow(const uno::Reference< awt::XWindow > + m_xWindow = _xWindow; + } + +- +- +-class SdrEmbedObjectLink : public sfx2::SvBaseLink +-{ +- SdrOle2Obj* pObj; +- +-public: +- SdrEmbedObjectLink(SdrOle2Obj* pObj); +- virtual ~SdrEmbedObjectLink(); +- +- virtual void Closed() SAL_OVERRIDE; +- virtual ::sfx2::SvBaseLink::UpdateResult DataChanged( +- const OUString& rMimeType, const ::com::sun::star::uno::Any & rValue ) SAL_OVERRIDE; +- +- bool Connect() { return GetRealObject() != NULL; } +-}; +- +- +- + SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject): + ::sfx2::SvBaseLink( ::SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::SVXB ), + pObj(pObject) +diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx +index 9b9d7500b162..002f69e35dec 100644 +--- a/svx/source/unodraw/unoshap4.cxx ++++ b/svx/source/unodraw/unoshap4.cxx +@@ -416,7 +416,7 @@ bool SvxOle2Shape::createObject( const SvGlobalName &aClassName ) + if( xObj.is() ) + { + Rectangle aRect = pOle2Obj->GetLogicRect(); +- if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 ) ++ if ( aRect.GetWidth() == 101 && aRect.GetHeight() == 101 ) + { + // TODO/LATER: is it possible that this method is used to create an iconified object? + // default size +@@ -484,7 +484,7 @@ bool SvxOle2Shape::createLink( const OUString& aLinkURL ) + if( xObj.is() ) + { + Rectangle aRect = pOle2Obj->GetLogicRect(); +- if ( aRect.GetWidth() == 100 && aRect.GetHeight() == 100 ) ++ if ( aRect.GetWidth() == 101 && aRect.GetHeight() == 101 ) + { + // default size + try +diff --git a/sw/inc/IDocumentLinksAdministration.hxx b/sw/inc/IDocumentLinksAdministration.hxx +index 8d4f4c74d47f..e618b111e427 100644 +--- a/sw/inc/IDocumentLinksAdministration.hxx ++++ b/sw/inc/IDocumentLinksAdministration.hxx +@@ -46,7 +46,7 @@ using rtl::OUString; + /** #i42634# Moved common code of SwReader::Read() and + SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks(): + */ +- virtual void UpdateLinks(bool bUI) = 0; ++ virtual void UpdateLinks() = 0; + + /** SS fuers Linken von Dokumentteilen / ?? for linking of parts of documents. + */ +diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +index 989a85240f58..882050b52f45 100644 +--- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx ++++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +@@ -199,47 +199,58 @@ const sfx2::LinkManager& DocumentLinksAdministrationManager::GetLinkManager() co + + // #i42634# Moved common code of SwReader::Read() and SwDocShell::UpdateLinks() + // to new SwDoc::UpdateLinks(): +-void DocumentLinksAdministrationManager::UpdateLinks( bool bUI ) ++void DocumentLinksAdministrationManager::UpdateLinks() + { +- SfxObjectCreateMode eMode; +- sal_uInt16 nLinkMode = m_rDoc.GetDocumentSettingManager().getLinkUpdateMode( true ); +- if ( m_rDoc.GetDocShell()) { +- sal_uInt16 nUpdateDocMode = m_rDoc.GetDocShell()->GetUpdateDocMode(); +- if( (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) && +- !GetLinkManager().GetLinks().empty() && +- SfxObjectCreateMode::INTERNAL != +- ( eMode = m_rDoc.GetDocShell()->GetCreateMode()) && +- SfxObjectCreateMode::ORGANIZER != eMode && +- SfxObjectCreateMode::PREVIEW != eMode && +- !m_rDoc.GetDocShell()->IsPreview() ) ++ if (!m_rDoc.GetDocShell()) ++ return; ++ SfxObjectCreateMode eMode = m_rDoc.GetDocShell()->GetCreateMode(); ++ if (eMode == SfxObjectCreateMode::INTERNAL) ++ return; ++ if (eMode == SfxObjectCreateMode::ORGANIZER) ++ return; ++ if (eMode == SfxObjectCreateMode::PREVIEW) ++ return; ++ if (m_rDoc.GetDocShell()->IsPreview()) ++ return; ++ if (GetLinkManager().GetLinks().empty()) ++ return; ++ sal_uInt16 nLinkMode = m_rDoc.GetDocumentSettingManager().getLinkUpdateMode(true); ++ sal_uInt16 nUpdateDocMode = m_rDoc.GetDocShell()->GetUpdateDocMode(); ++ if (nLinkMode == NEVER && nUpdateDocMode != document::UpdateDocMode::FULL_UPDATE) ++ return; ++ ++ bool bAskUpdate = nLinkMode == MANUAL; ++ bool bUpdate = true; ++ switch(nUpdateDocMode) ++ { ++ case document::UpdateDocMode::NO_UPDATE: bUpdate = false;break; ++ case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break; ++ case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break; ++ } ++ if (nLinkMode == AUTOMATIC && !bAskUpdate) ++ { ++ SfxMedium * medium = m_rDoc.GetDocShell()->GetMedium(); ++ if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( ++ medium == nullptr ? OUString() : medium->GetName())) + { +- bool bAskUpdate = nLinkMode == MANUAL; +- bool bUpdate = true; +- switch(nUpdateDocMode) +- { +- case document::UpdateDocMode::NO_UPDATE: bUpdate = false;break; +- case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break; +- case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break; +- } +- if (nLinkMode == AUTOMATIC && !bAskUpdate) +- { +- SfxMedium * medium = m_rDoc.GetDocShell()->GetMedium(); +- if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( +- medium == nullptr ? OUString() : medium->GetName())) +- { +- bAskUpdate = true; +- } +- } +- if( bUpdate && (bUI || !bAskUpdate) ) +- { +- SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium(); +- SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0; +- vcl::Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0; +- +- GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); +- } ++ bAskUpdate = true; + } + } ++ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = m_rDoc.GetDocShell()->getEmbeddedObjectContainer(); ++ if (bUpdate) ++ { ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); ++ ++ SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium(); ++ SfxFrame* pFrame = pMedium ? pMedium->GetLoadTargetFrame() : nullptr; ++ vcl::Window* pDlgParent = pFrame ? &pFrame->GetWindow() : nullptr; ++ ++ GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); ++ } ++ else ++ { ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); ++ } + } + + bool DocumentLinksAdministrationManager::GetData( const OUString& rItem, const OUString& rMimeType, +diff --git a/sw/source/core/inc/DocumentLinksAdministrationManager.hxx b/sw/source/core/inc/DocumentLinksAdministrationManager.hxx +index 79eb9adf3b96..712cb7942b74 100644 +--- a/sw/source/core/inc/DocumentLinksAdministrationManager.hxx ++++ b/sw/source/core/inc/DocumentLinksAdministrationManager.hxx +@@ -47,7 +47,7 @@ public: + + const sfx2::LinkManager& GetLinkManager() const SAL_OVERRIDE; + +- void UpdateLinks(bool bUI) SAL_OVERRIDE; ++ void UpdateLinks() override; + + bool GetData(const OUString& rItem, const OUString& rMimeType, ::com::sun::star::uno::Any& rValue) const SAL_OVERRIDE; + +diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx +index d42b0642a52c..b111e80d73cc 100644 +--- a/sw/source/filter/basflt/shellio.cxx ++++ b/sw/source/filter/basflt/shellio.cxx +@@ -364,7 +364,7 @@ sal_uLong SwReader::Read( const Reader& rOptions ) + // #i42634# Moved common code of SwReader::Read() and + // SwDocShell::UpdateLinks() to new SwDoc::UpdateLinks(): + // ATM still with Update +- pDoc->getIDocumentLinksAdministration().UpdateLinks( true ); ++ pDoc->getIDocumentLinksAdministration().UpdateLinks(); + + // not insert: set the redline mode read from settings.xml + eOld = static_cast( +diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx +index 6655f045539e..dd307248832e 100644 +--- a/sw/source/uibase/app/docsh.cxx ++++ b/sw/source/uibase/app/docsh.cxx +@@ -1179,7 +1179,7 @@ void SwDocShell::CalcLayoutForOLEObjects() + // read by the binary filter: + void SwDocShell::UpdateLinks() + { +- GetDoc()->getIDocumentLinksAdministration().UpdateLinks(true); ++ GetDoc()->getIDocumentLinksAdministration().UpdateLinks(); + // #i50703# Update footnote numbers + SwTextFootnote::SetUniqueSeqRefNo( *GetDoc() ); + SwNodeIndex aTmp( GetDoc()->GetNodes() ); +diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx +index fca4e2e44657..faefa968d26c 100644 +--- a/sw/source/uibase/app/docshini.cxx ++++ b/sw/source/uibase/app/docshini.cxx +@@ -486,6 +486,9 @@ bool SwDocShell::Load( SfxMedium& rMedium ) + bool bRet = false; + if( SfxObjectShell::Load( rMedium )) + { ++ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); ++ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); ++ + SAL_INFO( "sw.ui", "after SfxInPlaceObject::Load" ); + if (m_pDoc) // for last version!! + RemoveLink(); // release the existing +-- +2.12.0 + diff --git a/SOURCES/0001-fix-Link-operator.patch b/SOURCES/0001-fix-Link-operator.patch new file mode 100644 index 0000000..638cdca --- /dev/null +++ b/SOURCES/0001-fix-Link-operator.patch @@ -0,0 +1,87 @@ +From 7e4dd61f264a906885cde307929b300287dab8c5 Mon Sep 17 00:00:00 2001 +From: Noel Grandin +Date: Tue, 22 Dec 2015 09:05:32 +0200 +Subject: [PATCH] fix Link::operator< + +so that it is consistent with operator== + +plus c615943bda57eadfa73c14a7314938aabe0bd16f +and f120abb446bf3f5230ed06a3b148654dde36bb94 + +just in case + +(cherry picked from commit 144e73f50c49333f61c6f27b882be9dbc232ceb4) + +Change-Id: Ie4c68a1f02d8c298fe99e42c5854f89db79bf3bc +--- + include/tools/link.hxx | 10 ++++++++-- + vcl/source/control/combobox.cxx | 6 ++++++ + vcl/source/control/lstbox.cxx | 2 ++ + 3 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/include/tools/link.hxx b/include/tools/link.hxx +index fa86e5d..a3ad0c3 100644 +--- a/include/tools/link.hxx ++++ b/include/tools/link.hxx +@@ -131,8 +131,14 @@ public: + bool operator !() const { return !IsSet(); } + + bool operator <(Link const & other) const { +- return reinterpret_cast(function_) +- < reinterpret_cast(other.function_); ++ sal_uIntPtr ptr1 = reinterpret_cast(function_); ++ sal_uIntPtr ptr2 = reinterpret_cast(other.function_); ++ if (ptr1 < ptr2) ++ return true; ++ else if (ptr1 > ptr2) ++ return false; ++ else ++ return instance_ < other.instance_; + }; + + bool operator ==(Link const & other) const +diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx +index 19c95e7..9e05a69 100644 +--- a/vcl/source/control/combobox.cxx ++++ b/vcl/source/control/combobox.cxx +@@ -953,11 +953,15 @@ OUString ComboBox::GetEntry( sal_Int32 nPos ) const + + sal_Int32 ComboBox::GetEntryCount() const + { ++ if (!mpImplLB) ++ return 0; + return mpImplLB->GetEntryList()->GetEntryCount() - mpImplLB->GetEntryList()->GetMRUCount(); + } + + bool ComboBox::IsTravelSelect() const + { ++ if (!mpImplLB) ++ return false; + return mpImplLB->IsTravelSelect(); + } + +@@ -974,6 +978,8 @@ void ComboBox::EnableMultiSelection( bool bMulti ) + + bool ComboBox::IsMultiSelectionEnabled() const + { ++ if (!mpImplLB) ++ return false; + return mpImplLB->IsMultiSelectionEnabled(); + } + +diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx +index 1b0943b..8c701c7 100644 +--- a/vcl/source/control/lstbox.cxx ++++ b/vcl/source/control/lstbox.cxx +@@ -1215,6 +1215,8 @@ void ListBox::EnableMultiSelection( bool bMulti, bool bStackSelection ) + + bool ListBox::IsMultiSelectionEnabled() const + { ++ if (!mpImplLB) ++ return false; + return mpImplLB->IsMultiSelectionEnabled(); + } + +-- +2.9.3 + diff --git a/SOURCES/0001-lp-1566050-prevent-cyclic-reference-zombies.patch b/SOURCES/0001-lp-1566050-prevent-cyclic-reference-zombies.patch new file mode 100644 index 0000000..4131b85 --- /dev/null +++ b/SOURCES/0001-lp-1566050-prevent-cyclic-reference-zombies.patch @@ -0,0 +1,40 @@ +From 25b8bcab289f13cab6c0a154a0c32ab19de2ef21 Mon Sep 17 00:00:00 2001 +From: Bjoern Michaelsen +Date: Tue, 12 Apr 2016 12:20:07 +0200 +Subject: [PATCH] lp#1566050: prevent cyclic reference zombies + +regression, likely from 2660d24a07866e083c5135ea263030f3e3a2e729: + +1/ Since that change mxAccessible in ScCsvGrid holds a rtl::Reference on +a ScAccessibleCsvGrid +2/ Which in turn holds a VclPtr<> (aka a rtl::Reference with lipstick) +on the ScCsvControl + +These are a circular references, making both of them live forever and +leak past the point where on LibreOffice close all of Vcl is long gone, +when these are dtored. Clearing mxAccessible on disposing should help. + +Change-Id: Iebb2635ec4ea143e7f0dbfebad2e6141a68e72e8 +Reviewed-on: https://gerrit.libreoffice.org/24020 +Reviewed-by: Noel Grandin +Tested-by: Noel Grandin +(cherry picked from commit 941e891d16853e5eff3e40cf48cdafb3146b2750) +--- + sc/source/ui/dbgui/csvcontrol.cxx | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sc/source/ui/dbgui/csvcontrol.cxx b/sc/source/ui/dbgui/csvcontrol.cxx +index b53b5bc..7449192 100644 +--- a/sc/source/ui/dbgui/csvcontrol.cxx ++++ b/sc/source/ui/dbgui/csvcontrol.cxx +@@ -81,6 +81,7 @@ void ScCsvControl::dispose() + { + if( mxAccessible.is() ) + mxAccessible->dispose(); ++ mxAccessible = nullptr; // lp#1566050: prevent cyclic reference zombies + Control::dispose(); + } + +-- +2.9.3 + diff --git a/SOURCES/0001-tdf-80999-Canceling-password-prompt-should-abort-det.patch b/SOURCES/0001-tdf-80999-Canceling-password-prompt-should-abort-det.patch new file mode 100644 index 0000000..b2bec4d --- /dev/null +++ b/SOURCES/0001-tdf-80999-Canceling-password-prompt-should-abort-det.patch @@ -0,0 +1,78 @@ +From 307cf8f9a19bc768d28394cc183a3d8bf634b7de Mon Sep 17 00:00:00 2001 +From: Maxim Monastirsky +Date: Wed, 27 Apr 2016 16:19:13 +0300 +Subject: [PATCH] tdf#80999 Canceling password prompt should abort detection + +... instead of continuing the detection loop and being +"detected" as plain text. The detection API will from now +return a type based on the file extension only, which is +far more useful than "plain text" anyway. Plus the media +descriptor has a flag to indicate that the detection wasn't +completed, which can be also used by the loading code to +abort the loading process. + +Change-Id: Ida37e2687bd5cd86b5780620724e9bce82e11946 +Reviewed-on: https://gerrit.libreoffice.org/24428 +Tested-by: Jenkins +Reviewed-by: Maxim Monastirsky +(cherry picked from commit 579c2de3a88483eff0664d3a303b19cbd386db47) +--- + framework/source/loadenv/loadenv.cxx | 5 +++++ + oox/source/core/filterdetect.cxx | 18 +++++++++++++----- + 2 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx +index 4261971..05e7821 100644 +--- a/framework/source/loadenv/loadenv.cxx ++++ b/framework/source/loadenv/loadenv.cxx +@@ -789,6 +789,11 @@ void LoadEnv::impl_detectTypeAndFilter() + aWriteLock.clear(); + // <- SAFE + ++ // We do have potentially correct type, but the detection process was aborted. ++ if (m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ABORTED(), false)) ++ throw LoadEnvException( ++ LoadEnvException::ID_UNSUPPORTED_CONTENT, "type detection aborted"); ++ + // But the type isn't enough. For loading sometimes we need more information. + // E.g. for our "_default" feature, where we recycle any frame which contains + // and "Untitled" document, we must know if the new document is based on a template! +diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx +index d48d25c..94ea20e 100644 +--- a/oox/source/core/filterdetect.cxx ++++ b/oox/source/core/filterdetect.cxx +@@ -386,11 +386,7 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq + OUString aFilterName; + MediaDescriptor aMediaDescriptor( rMediaDescSeq ); + +- /* Check that the user has not chosen to abort detection, e.g. by hitting +- 'Cancel' in the password input dialog. This may happen because this +- filter detection is used by different filters. */ +- bool bAborted = aMediaDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_ABORTED(), false ); +- if( !bAborted ) try ++ try + { + aMediaDescriptor.addInputStream(); + +@@ -419,6 +415,18 @@ OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& rMediaDescSeq + } + catch( const Exception& ) + { ++ if ( aMediaDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_ABORTED(), false ) ) ++ /* The user chose to abort detection, e.g. by hitting 'Cancel' in the password input dialog, ++ so we have to return non-empty type name to abort the detection loop. The loading code is ++ supposed to check whether the "Aborted" flag is present in the descriptor, and to not attempt ++ to actually load the file then. ++ ++ The returned type name is the one we got as an input, which typically was detected by the flat ++ detection (i.e. by file extension), so normally that's the correct one. Also at this point we ++ already know that the file is OLE encrypted package, so trying with other type detectors doesn't ++ make much sense anyway. ++ */ ++ aFilterName = aMediaDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_TYPENAME(), OUString() ); + } + + // write back changed media descriptor members +-- +2.9.3 + diff --git a/SPECS/libreoffice.spec b/SPECS/libreoffice.spec index dcb3a27..87cb111 100644 --- a/SPECS/libreoffice.spec +++ b/SPECS/libreoffice.spec @@ -52,7 +52,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 3%{?libo_prerelease}%{?dist} +Release: 5%{?libo_prerelease}%{?dist}.1 License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0 Group: Applications/Productivity URL: http://www.libreoffice.org/ @@ -307,6 +307,10 @@ Patch76: 0001-tdf-86575-for-OOXML-write-plain-REF-if-deleted-parts.patch Patch77: 0001-improve-perf.-of-VCL-event-dispatch.patch Patch78: 0001-rtf-m_aStates-can-be-empty-in-the-inner-condition.patch Patch79: 0001-Resolves-rhbz-1364335-tooltips-are-truncated.patch +Patch80: 0001-lp-1566050-prevent-cyclic-reference-zombies.patch +Patch81: 0001-fix-Link-operator.patch +Patch82: 0001-tdf-80999-Canceling-password-prompt-should-abort-det.patch +Patch83: 0001-disable-generation-of-ole-previews-in-ODF-format-unt.patch %if 0%{?rhel} # not upstreamed @@ -2237,6 +2241,18 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Sun Mar 26 2017 David Tardon - 1:5.0.6.2-5.1 +- Resolves: rhbz#1435534 CVE-2017-3157 Arbitrary file disclosure in Calc and + Writer + +* Thu Feb 09 2017 Michael Stahl - 1:5.0.6.2-5 +- Resolves: rhbz#1426348 Encrypted files opening as plain text after + cancelling password dialog + +* Fri Dec 02 2016 Caolán McNamara - 1:5.0.6.2-4 +- Resolves: rhbz#1425535 crash in calc on exit after using csv dialog with a11y enabled +- Resolves: rhbz#1425536 crash in calc on closing dialog with a11y enabled + * Tue Aug 23 2016 David Tardon - 1:5.0.6.2-3 - Resolves: rhbz#1364335 tooltips are truncated