embeddedobj/source/commonembedding/visobj.cxx | 6 - filter/source/msfilter/svdfppt.cxx | 4 include/filter/msfilter/svdfppt.hxx | 12 +- include/svx/svdoole2.hxx | 21 +++ libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 | 25 ++++ libmwaw/UnpackedTarball_libmwaw.mk | 4 lotuswordpro/source/filter/lwpidxmgr.cxx | 7 - lotuswordpro/source/filter/lwpobjstrm.cxx | 2 lotuswordpro/source/filter/lwpsilverbullet.cxx | 5 lotuswordpro/source/filter/lwptabrack.cxx | 5 lotuswordpro/source/filter/lwptoc.cxx | 13 +- sc/source/ui/docshell/docsh.cxx | 3 sc/source/ui/docshell/docsh4.cxx | 7 + 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 sw/inc/doc.hxx | 6 - sw/source/core/doc/docnew.cxx | 101 +++++++++--------- sw/source/filter/basflt/shellio.cxx | 3 sw/source/filter/ww8/ww8par2.cxx | 29 ++--- sw/source/filter/xml/xmltexti.cxx | 11 + sw/source/ui/app/docsh.cxx | 2 tools/inc/poly.h | 2 tools/source/generic/poly.cxx | 13 +- 26 files changed, 199 insertions(+), 119 deletions(-)
New commits: commit 84cfb927c236a45d7fc40fbadf0654dee8a81108 Author: Caolán McNamara <[email protected]> AuthorDate: Tue May 1 12:57:02 2018 +0100 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Aug 17 17:08:35 2018 +0200 set Referer on link mediadescriptor to allow determining if the source document is from a trusted/untrusted location Reviewed-on: https://gerrit.libreoffice.org/53693 Tested-by: Jenkins <[email protected]> Reviewed-by: Stephan Bergmann <[email protected]> (cherry picked from commit cd25a97bbadc0a5c1fd6b0e8603c8b6ebd051926) Reviewed-on: https://gerrit.libreoffice.org/53803 Reviewed-by: Miklos Vajna <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Mike Kaganski <[email protected]> (cherry picked from commit 2d87c267267530077a94c894bc619831b01d1c04) Conflicts: sw/source/filter/xml/xmltexti.cxx (cherry picked from commit d7b0063c32502f01fcec72492d131760f4fda990) Conflicts: sw/source/filter/xml/xmltexti.cxx Change-Id: I780568652d2ef0cc8543c27ba26289277b5d9d0c diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index a84f99c57a77..509acc65807c 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -572,16 +572,21 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink( uno::Sequence< beans::PropertyValue > aMediaDescriptor( 1 ); aMediaDescriptor[0].Name = OUString("URL"); aMediaDescriptor[0].Value <<= OUString( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( pDoc && pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() ) + + if (SfxMedium* pMedium = pDoc && pDoc->GetDocShell() ? pDoc->GetDocShell()->GetMedium() : nullptr) { - uno::Reference< task::XInteractionHandler > xInteraction = - pDoc->GetDocShell()->GetMedium()->GetInteractionHandler(); + uno::Reference< task::XInteractionHandler > xInteraction = pMedium->GetInteractionHandler(); if ( xInteraction.is() ) { aMediaDescriptor.realloc( 2 ); aMediaDescriptor[1].Name = OUString( "InteractionHandler" ); aMediaDescriptor[1].Value <<= xInteraction; } + + const sal_Int32 nLen = aMediaDescriptor.getLength() + 1; + aMediaDescriptor.realloc(nLen); + aMediaDescriptor[nLen - 1].Name = "Referer"; + aMediaDescriptor[nLen - 1].Value <<= pMedium->GetName(); } uno::Reference < embed::XEmbeddedObject > xObj( commit 525c62496ab7f2e5ef9c83c371f17b6ff8044328 Author: Caolán McNamara <[email protected]> AuthorDate: Sun May 27 23:52:15 2018 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Aug 17 17:04:04 2018 +0200 add ww6 test dir and fix a crash Change-Id: Id08176640672095c03e0b124cd65a9dce26ac2db diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 01baf330889e..94635d8c8e90 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -4281,6 +4281,14 @@ void WW8RStyle::ImportOldFormatStyles() std::vector< std::vector<sal_uInt8> > aConvertedChpx; while (nByteCount < cbChpx) { + if (stcp == aCHPXOffsets.size()) + { + //more data than style slots, skip remainder + rSt.SeekRel(cbChpx-nByteCount); + nByteCount += cbChpx-nByteCount; + break; + } + sal_uInt8 cb; rSt >> cb; nByteCount++; @@ -4303,12 +4311,7 @@ void WW8RStyle::ImportOldFormatStyles() else aConvertedChpx.push_back( std::vector<sal_uInt8>() ); - stcp++; - if (stcp == nStyles) - { - rSt.SeekRel(cbChpx-nByteCount); - nByteCount += cbChpx-nByteCount; - } + ++stcp; } std::vector<pxoffset> aPAPXOffsets(stcp); @@ -4318,6 +4321,12 @@ void WW8RStyle::ImportOldFormatStyles() stcp=0; while (nByteCount < cbPapx) { + if (stcp == aPAPXOffsets.size()) + { + rSt.SeekRel(cbPapx-nByteCount); + nByteCount += cbPapx-nByteCount; + } + sal_uInt8 cb; rSt >> cb; nByteCount++; @@ -4339,13 +4348,7 @@ void WW8RStyle::ImportOldFormatStyles() nByteCount += nRemainder; } - stcp++; - - if (stcp == nStyles) - { - rSt.SeekRel(cbPapx-nByteCount); - nByteCount += cbPapx-nByteCount; - } + ++stcp; } sal_uInt16 iMac; commit 78adfd841feba0ffcfe48215841f1790b5960722 Author: Caolán McNamara <[email protected]> AuthorDate: Sun May 27 23:51:33 2018 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Aug 17 17:03:51 2018 +0200 fix crash on loading certain ppts Change-Id: I544a67e3706c7d12414cc075118ef2f0f5ddd0f6 diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 5c638b860fe7..e812c6d359d5 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -4058,13 +4058,13 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd rIn >> aTxMasterStyleHd; if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) { - sal_uInt16 nLevelAnz; + sal_uInt16 nLevelAnz(0); rIn >> nLevelAnz; sal_uInt16 nLev = 0; sal_Bool bFirst = sal_True; bFoundTxMasterStyleAtom04 = sal_True; - while ( rIn.GetError() == 0 && rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() && nLev < nLevelAnz ) + while ( rIn.GetError() == 0 && rIn.Tell() < aTxMasterStyleHd.GetRecEndFilePos() && nLev < nLevelAnz && nLev < nMaxPPTLevels) { if ( nLev ) { diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index c32b9de25556..0ad9079a3ac8 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -165,6 +165,8 @@ const sal_uInt32 PPTInventor = sal_uInt32('P') * 0x00000001 + sal_uInt32('T') * 0x00010000 + sal_uInt32('0') * 0x01000000; +const int nMaxPPTLevels = 5; + // Object-Ids fuer StarDraw UserData #define PPT_OBJECTINFO_ID (1) @@ -693,7 +695,7 @@ struct PPTExtParaLevel struct PPTExtParaSheet { - PPTExtParaLevel aExtParaLevel[ 5 ]; + PPTExtParaLevel aExtParaLevel[nMaxPPTLevels]; }; struct PPTBuGraEntry @@ -740,7 +742,7 @@ struct PPTCharLevel struct PPTCharSheet { - PPTCharLevel maCharLevel[ 5 ]; + PPTCharLevel maCharLevel[nMaxPPTLevels]; explicit PPTCharSheet( sal_uInt32 nInstance ); PPTCharSheet( const PPTCharSheet& rCharSheet ); @@ -773,7 +775,7 @@ struct PPTParaSheet { public: - PPTParaLevel maParaLevel[ 5 ]; + PPTParaLevel maParaLevel[nMaxPPTLevels]; explicit PPTParaSheet( sal_uInt32 nInstance ); PPTParaSheet( const PPTParaSheet& rParaSheet ); @@ -956,8 +958,8 @@ struct PPTRuler sal_Int32 nFlags; sal_uInt16 nDefaultTab; - sal_uInt16 nTextOfs[ 5 ]; - sal_uInt16 nBulletOfs[ 5 ]; + sal_uInt16 nTextOfs[nMaxPPTLevels]; + sal_uInt16 nBulletOfs[nMaxPPTLevels]; PPTTabEntry* pTab; sal_uInt16 nTabCount; commit 5803c91fe4836aa29c28da3cf29791a0416b16d4 Author: Caolán McNamara <[email protected]> AuthorDate: Sun May 27 23:39:50 2018 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Aug 17 16:51:07 2018 +0200 ofz#372 check if ImplSplit succeeded (cherry picked from commit 62a97e6a561ce65e88d4c537a1b82c336f012722) (cherry picked from commit 6431e2bff67e81b4aff4e3b52e67903e1cd566f3) Reviewed-on: https://gerrit.libreoffice.org/32640 Tested-by: Jenkins <[email protected]> Reviewed-by: Markus Mohrhard <[email protected]> Change-Id: I1e34295fe3ee5f77e787f583616d52fa92a0eca4 diff --git a/tools/inc/poly.h b/tools/inc/poly.h index 9f05dcc2b3e4..91ffb557a123 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -42,7 +42,7 @@ public: void ImplSetSize( sal_uInt16 nSize, sal_Bool bResize = sal_True ); void ImplCreateFlagArray(); - void ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL ); + bool ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL ); }; #define MAX_POLYGONS ((sal_uInt16)0x3FF0) diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 689f35a8f480..0c27dce9dd51 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -207,13 +207,16 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, sal_Bool bResize ) mnPoints = nNewSize; } -void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly ) +bool ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly ) { const sal_uIntPtr nSpaceSize = nSpace * sizeof( Point ); //Can't fit this in :-(, throw ? if (mnPoints + nSpace > USHRT_MAX) - return; + { + SAL_WARN("tools", "Polygon needs " << mnPoints + nSpace << " points, but only " << USHRT_MAX << " possible"); + return false; + } const sal_uInt16 nNewSize = mnPoints + nSpace; @@ -268,6 +271,8 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI mpPointAry = pNewAry; mnPoints = nNewSize; } + + return true; } void ImplPolygon::ImplCreateFlagArray() @@ -1467,8 +1472,8 @@ void Polygon::Insert( sal_uInt16 nPos, const Point& rPt, PolyFlags eFlags ) if( nPos >= mpImplPolygon->mnPoints ) nPos = mpImplPolygon->mnPoints; - mpImplPolygon->ImplSplit( nPos, 1 ); - mpImplPolygon->mpPointAry[ nPos ] = rPt; + if (mpImplPolygon->ImplSplit( nPos, 1 )) + mpImplPolygon->mpPointAry[ nPos ] = rPt; if( POLY_NORMAL != eFlags ) { commit 55497d7ff1bb4aa8cd3a07a2e268ba131ce473b8 Author: Caolán McNamara <[email protected]> AuthorDate: Sun May 27 23:23:41 2018 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Aug 17 16:50:48 2018 +0200 disable generation of ole previews in ODF format until after load 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 <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit 74844277cc2194c9e43f5bd7a6f78a9603da32f3) detangle gadzillion checks into something readable no logic change intended (cherry picked from commit fad9786b06d188ba6e354620f57176f3d94a6637) 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 <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit 7f0a219c9ad38ae33b51ff69d545f69659691c1e) Reviewed-on: https://gerrit.libreoffice.org/28926 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Eike Rathke <[email protected]> Tested-by: Eike Rathke <[email protected]> Change-Id: Id1dd7ea17342140eab9307d546528747e3a98090 b6af93afc1f80b7fc36239c96d5e0a71fcbcb789 4d4375dff64d7b8e236d1a24322e749e04ee530f diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx index 38c89fd704c3..de5af79c9894 100644 --- a/embeddedobj/source/commonembedding/visobj.cxx +++ b/embeddedobj/source/commonembedding/visobj.cxx @@ -182,7 +182,11 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe sal_Bool bBackToLoaded = sal_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 36a829ebd8d3..b51786f7f98c 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -29,7 +29,9 @@ #include <vcl/graph.hxx> #include <vcl/gdimtf.hxx> #include <sot/storage.hxx> -#include "svx/svxdllapi.h" +#include <svx/svxdllapi.h> +#include <sfx2/lnkbase.hxx> +#include <sfx2/linkmgr.hxx> //************************************************************ // SdrOle2Obj @@ -192,6 +194,21 @@ public: virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const; }; -#endif //_SVDOOLE2_HXX +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/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 5009ee03f583..52cbf7786c6c 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -544,6 +544,9 @@ sal_Bool ScDocShell::Load( SfxMedium& rMedium ) sal_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 d778e7823ee0..4d9ab8313b6b 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 <sfx2/fcontnr.hxx> +#include <sfx2/linkmgr.hxx> #include <sfx2/objface.hxx> #include <sfx2/docfile.hxx> #include <svtools/ehdl.hxx> @@ -42,6 +43,7 @@ using namespace ::com::sun::star; #include <svx/drawitem.hxx> #include <svx/fmshell.hxx> #include <svtools/xwindowitem.hxx> +#include <svx/svdoole2.hxx> #include <sfx2/passwd.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/dispatch.hxx> @@ -415,6 +417,8 @@ void ScDocShell::Execute( SfxRequest& rReq ) case SID_UPDATETABLINKS: { ScDocument* pDoc = GetDocument(); + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); ScLkUpdMode nSet=pDoc->GetLinkMode(); @@ -463,7 +467,10 @@ void ScDocShell::Execute( SfxRequest& rReq ) rReq.Done(); } else + { + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); rReq.Ignore(); + } } break; diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 2dd69a9fdec0..5cf3d4a583d5 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -683,6 +683,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 9c998a33a4d7..a4cd65058070 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -291,8 +291,11 @@ sal_Bool DrawDocShell::Load( SfxMedium& rMedium ) } bRet = SfxObjectShell::Load( rMedium ); - if( bRet ) + if(bRet) { + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + bRet = SdXMLFilter( rMedium, *this, sal_True, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError ); } diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 89e4e3d81c67..f361fc822634 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -56,7 +56,6 @@ #include <comphelper/classids.hxx> #include <sot/formats.hxx> -#include <sfx2/linkmgr.hxx> #include <svtools/transfer.hxx> #include <cppuhelper/implbase5.hxx> @@ -591,25 +590,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(); - virtual ::sfx2::SvBaseLink::UpdateResult DataChanged( - const String& rMimeType, const ::com::sun::star::uno::Any & rValue ); - - bool Connect() { return GetRealObject() != NULL; } -}; - -// ----------------------------------------------------------------------------- - SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject): ::sfx2::SvBaseLink( ::sfx2::LINKUPDATE_ONCALL, SOT_FORMATSTR_ID_SVXB ), pObj(pObject) diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 59b8b59ac43b..6db82753fe3b 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -408,7 +408,7 @@ sal_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 @@ -472,7 +472,7 @@ sal_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 a4c5a6aee1e0..d80f7861e696 100644 --- a/sw/inc/IDocumentLinksAdministration.hxx +++ b/sw/inc/IDocumentLinksAdministration.hxx @@ -44,7 +44,7 @@ namespace sfx2 { class SvLinkSource; class LinkManager; } /** #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/inc/doc.hxx b/sw/inc/doc.hxx index fc258ef8ac21..1aea72272258 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -794,9 +794,9 @@ public: virtual void SetVisibleLinks(bool bFlag); virtual sfx2::LinkManager& GetLinkManager(); virtual const sfx2::LinkManager& GetLinkManager() const; - virtual void UpdateLinks(bool bUI); - virtual bool GetData(const OUString& rItem, const String& rMimeType, ::com::sun::star::uno::Any& rValue) const; - virtual bool SetData(const OUString& rItem, const String& rMimeType, const ::com::sun::star::uno::Any& rValue); + virtual void UpdateLinks(); + virtual bool GetData(const OUString& rItem, const OUString& rMimeType, ::com::sun::star::uno::Any& rValue) const; + virtual bool SetData(const OUString& rItem, const OUString& rMimeType, const ::com::sun::star::uno::Any& rValue); virtual ::sfx2::SvLinkSource* CreateLinkSource(const OUString& rItem); virtual bool EmbedAllLinks(); virtual void SetLinksUpdated(const bool bNewLinksUpdated); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 93525caf1c1e..7a586efc6179 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -946,56 +946,59 @@ IGrammarContact* getGrammarContact( const SwTxtNode& rTxtNode ) // #i42634# Moved common code of SwReader::Read() and SwDocShell::UpdateLinks() // to new SwDoc::UpdateLinks(): -void SwDoc::UpdateLinks( bool bUI ) +void SwDoc::UpdateLinks( ) { - SfxObjectCreateMode eMode; - sal_uInt16 nLinkMode = getLinkUpdateMode( true ); - if ( GetDocShell()) { - sal_uInt16 nUpdateDocMode = GetDocShell()->GetUpdateDocMode(); - if( (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) && - !GetLinkManager().GetLinks().empty() && - SFX_CREATE_MODE_INTERNAL != - ( eMode = GetDocShell()->GetCreateMode()) && - SFX_CREATE_MODE_ORGANIZER != eMode && - SFX_CREATE_MODE_PREVIEW != eMode && - !GetDocShell()->IsPreview() ) - { - ViewShell* pVSh = 0; - 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 = GetDocShell()->GetMedium(); - if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( - medium == nullptr ? OUString() : medium->GetName())) - { - bAskUpdate = true; - } - } - if( bUpdate && (bUI || !bAskUpdate) ) - { - SfxMedium* pMedium = GetDocShell()->GetMedium(); - SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0; - Window* pDlgParent = pFrm ? &pFrm->GetWindow() : 0; - if( GetCurrentViewShell() && !GetEditShell( &pVSh ) && !pVSh ) //swmod 071108//swmod 071225 - { - ViewShell aVSh( *this, 0, 0 ); - - SET_CURR_SHELL( &aVSh ); - GetLinkManager().UpdateAllLinks( bAskUpdate , true, false, pDlgParent ); - } - else - GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); - } - } - } - + if (!GetDocShell()) + return; + SfxObjectCreateMode eMode = GetDocShell()->GetCreateMode(); + if (eMode == SfxObjectCreateMode::SFX_CREATE_MODE_INTERNAL) + return; + if (eMode == SfxObjectCreateMode::SFX_CREATE_MODE_ORGANIZER) + return; + if (eMode == SfxObjectCreateMode::SFX_CREATE_MODE_PREVIEW) + return; + if (GetDocShell()->IsPreview()) + return; + if (GetLinkManager().GetLinks().empty()) + return; + sal_uInt16 nLinkMode = getLinkUpdateMode(true); + sal_uInt16 nUpdateDocMode = 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 = GetDocShell()->GetMedium(); + if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( + medium == nullptr ? OUString() : medium->GetName())) + { + bAskUpdate = true; + } + } + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = GetDocShell()->getEmbeddedObjectContainer(); + if (bUpdate) + { + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); + + SfxMedium* pMedium = GetDocShell()->GetMedium(); + SfxFrame* pFrame = pMedium ? pMedium->GetLoadTargetFrame() : nullptr; + + Window* pDlgParent = pFrame ? &pFrame->GetWindow() : nullptr; + + GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); + } + else + { + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + } } ::sfx2::IXmlIdRegistry& diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 0e70a2d1889d..ef9774ea152d 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -368,7 +368,8 @@ 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->UpdateLinks( true ); + //pDoc->getIDocumentLinksAdministration().UpdateLinks(); + pDoc->UpdateLinks(); // not insert: set the redline mode read from settings.xml eOld = static_cast<RedlineMode_t>( diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 4a1aa27a03bf..30014092bf82 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -1164,7 +1164,7 @@ void SwDocShell::CalcLayoutForOLEObjects() // read by the binary filter: void SwDocShell::UpdateLinks() { - GetDoc()->UpdateLinks(true); + GetDoc()->UpdateLinks(); // #i50703# Update footnote numbers SwTxtFtn::SetUniqueSeqRefNo( *GetDoc() ); SwNodeIndex aTmp( GetDoc()->GetNodes() ); commit f91a18f1b0cc6769f3c2ab536ae2b8dd4b4c7f93 Author: Caolán McNamara <[email protected]> AuthorDate: Sun May 27 17:04:50 2018 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Aug 17 16:45:23 2018 +0200 [PATCH] guard against corrupt m_nNumTabs Includes: - guard against corrupt LwpTocSuperLayout - guard against corrupt SilverBullet - guard against corrupt ObjIndexData Change-Id: I41b8514a127d463ac951e5855f09416fa0456b1b diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx index ccd2c388a612..4a23c2980458 100644 --- a/lotuswordpro/source/filter/lwpidxmgr.cxx +++ b/lotuswordpro/source/filter/lwpidxmgr.cxx @@ -155,7 +155,10 @@ void LwpIndexManager::ReadRootData(LwpObjectStream* pObjStrm) sal_uInt16 KeyCount = pObjStrm->QuickReaduInt16(); m_nLeafCount = KeyCount ? KeyCount + 1 : 0; - if(KeyCount) + if (m_nLeafCount > SAL_N_ELEMENTS(m_ChildIndex)) + throw std::range_error("corrupt RootData"); + + if (KeyCount) { //read object keys LwpKey* akey = new LwpKey(); @@ -215,7 +218,7 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm) vObjIndexs[k]->offset = pObjStrm->QuickReaduInt32(); for (k = 0; k < LeafCount; k++) - m_TempVec[k] = pObjStrm->QuickReaduInt32(); + m_TempVec.at(k) = pObjStrm->QuickReaduInt32(); } for( sal_uInt16 j=0; j<LeafCount; j++ ) diff --git a/lotuswordpro/source/filter/lwpobjstrm.cxx b/lotuswordpro/source/filter/lwpobjstrm.cxx index b9dc3926eaad..0de01a5c647b 100644 --- a/lotuswordpro/source/filter/lwpobjstrm.cxx +++ b/lotuswordpro/source/filter/lwpobjstrm.cxx @@ -170,7 +170,7 @@ sal_uInt16 LwpObjectStream::QuickRead(void* buf, sal_uInt16 len) memset(buf, 0, len); if( len > m_nBufSize - m_nReadPos ) { - assert(false); + SAL_WARN("lwp", "read request longer than buffer"); len = m_nBufSize - m_nReadPos; } if( m_pContentBuf && len) diff --git a/lotuswordpro/source/filter/lwpsilverbullet.cxx b/lotuswordpro/source/filter/lwpsilverbullet.cxx index 27dedc073512..51734ee0bbce 100644 --- a/lotuswordpro/source/filter/lwpsilverbullet.cxx +++ b/lotuswordpro/source/filter/lwpsilverbullet.cxx @@ -93,7 +93,10 @@ void LwpSilverBullet::Read() sal_uInt16 nNumPos = m_pObjStrm->QuickReaduInt16(); - for (sal_uInt8 nC = 0; nC < nNumPos; nC++) + if (nNumPos > SAL_N_ELEMENTS(m_pResetPositionFlags)) + throw std::range_error("corrupt SilverBullet"); + + for (sal_uInt16 nC = 0; nC < nNumPos; nC++) m_pResetPositionFlags[nC] = m_pObjStrm->QuickReaduInt8(); m_nUseCount = m_pObjStrm->QuickReaduInt32(); diff --git a/lotuswordpro/source/filter/lwptabrack.cxx b/lotuswordpro/source/filter/lwptabrack.cxx index 32f229949e56..87a91d233047 100644 --- a/lotuswordpro/source/filter/lwptabrack.cxx +++ b/lotuswordpro/source/filter/lwptabrack.cxx @@ -87,11 +87,12 @@ LwpTabRack::LwpTabRack(LwpObjectHeader objHdr, LwpSvStream* pStrm):LwpObject(obj void LwpTabRack::Read() { -// LwpObjectID m_NextID; m_NextID.ReadIndexed(m_pObjStrm); m_nNumTabs = m_pObjStrm->QuickReaduInt16(); - for( int i=0; i<m_nNumTabs; i++ ) + if (m_nNumTabs > MaxTabs) + throw std::range_error("corrupt LwpTabRack"); + for (int i=0; i<m_nNumTabs; ++i) { m_aTabs[i].Read(m_pObjStrm); m_pObjStrm->SkipExtra(); diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx index ef4af4549ca3..6b055d4ed30d 100644 --- a/lotuswordpro/source/filter/lwptoc.cxx +++ b/lotuswordpro/source/filter/lwptoc.cxx @@ -101,17 +101,22 @@ void LwpTocSuperLayout::Read() m_SearchItems.Read(m_pObjStrm); - sal_uInt16 i; sal_uInt16 count = m_pObjStrm->QuickReaduInt16(); - for (i = 0; (i < MAX_LEVELS) && (count > 0); i++, count--) + if (count > MAX_LEVELS) + throw std::range_error("corrupt LwpTocSuperLayout"); + for (sal_uInt16 i = 0; i < count; ++i) m_DestName[i].Read(m_pObjStrm); count = m_pObjStrm->QuickReaduInt16(); - for (i = 0; (i < MAX_LEVELS) && (count > 0); i++, count--) + if (count > MAX_LEVELS) + throw std::range_error("corrupt LwpTocSuperLayout"); + for (sal_uInt16 i = 0; i < count; ++i) m_DestPGName[i].Read(m_pObjStrm); count = m_pObjStrm->QuickReaduInt16(); - for (i = 0; i < count; i++) + if (count > MAX_LEVELS) + throw std::range_error("corrupt LwpTocSuperLayout"); + for (sal_uInt16 i = 0; i < count; ++i) m_nFlags[i] = m_pObjStrm->QuickReaduInt32(); m_pObjStrm->SkipExtra(); commit 8ccb90ac2560668e9a10189d53a3634b91b07975 Author: David Tardon <[email protected]> AuthorDate: Fri Aug 17 16:35:11 2018 +0200 Commit: Thorsten Behrens <[email protected]> CommitDate: Fri Aug 17 16:35:11 2018 +0200 use correct size (cherry picked from commit d1ae31a1fc49ec7a68b2a07c5e5e97d95b346ca9) Reviewed-on: https://gerrit.libreoffice.org/38827 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Michael Stahl <[email protected]> (cherry picked from commit 54e7b46718bf2f47c7f55a93cfbb23681429ffc6) Change-Id: I620ada9b209bb2084eccaa81385beb6306d6a3d0 diff --git a/libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 b/libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 new file mode 100644 index 000000000000..44095ad6ec99 --- /dev/null +++ b/libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 @@ -0,0 +1,25 @@ +From 68b3b74569881248bfb6cbb4266177cc253b292f Mon Sep 17 00:00:00 2001 +From: David Tardon <[email protected]> +Date: Sat, 8 Apr 2017 14:03:29 +0200 +Subject: [PATCH] ofz#1037 resize vector correctly + +--- + src/lib/MsWrd1Parser.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/lib/MsWrd1Parser.cxx b/src/lib/MsWrd1Parser.cxx +index 63547e6..3626064 100644 +--- a/src/lib/MSW1Parser.cxx ++++ b/src/lib/MSW1Parser.cxx +@@ -902,7 +902,7 @@ bool MsWrd1Parser::readFootnoteCorrespondance(MWAWVec2i limits) + int id = fIt++->second; + fPos[1] = fIt==footnoteMap.end() ? m_state->m_eot : fIt->first; + if (id >= int(m_state->m_footnotesList.size())) +- m_state->m_footnotesList.resize(size_t(id),0); ++ m_state->m_footnotesList.resize(size_t(id)+1,0); + m_state->m_footnotesList[size_t(id)]=fPos; + } + ascii().addDelimiter(input->tell(),'|'); +-- +2.13.0 + diff --git a/libmwaw/UnpackedTarball_libmwaw.mk b/libmwaw/UnpackedTarball_libmwaw.mk index 96fe9df6afa0..f897f708c9aa 100644 --- a/libmwaw/UnpackedTarball_libmwaw.mk +++ b/libmwaw/UnpackedTarball_libmwaw.mk @@ -11,4 +11,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libmwaw)) $(eval $(call gb_UnpackedTarball_set_tarball,libmwaw,$(MWAW_TARBALL))) +$(eval $(call gb_UnpackedTarball_add_patches,libmwaw, \ + libmwaw/0001-ofz-1037-resize-vector-correctly.patch.1 \ +)) + # vim: set noet sw=4 ts=4: _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
