Rebased ref, commits from common ancestor:
commit f89c0499c8ad6a18e06cd34fac4175c4837b657d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue May 1 12:57:02 2018 +0100
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Fri Aug 17 18:25:38 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 <c...@libreoffice.org>
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>
    (cherry picked from commit cd25a97bbadc0a5c1fd6b0e8603c8b6ebd051926)
    
    Reviewed-on: https://gerrit.libreoffice.org/53803
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    (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 8f15c7ea741b63ae56cf1fa5a9ae76b52d746bfe
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun May 27 23:52:15 2018 +0200
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Fri Aug 17 18:25:38 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 ab1eeab502f9b4188432d6774c49de83ef722da9
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun May 27 23:51:33 2018 +0200
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Fri Aug 17 18:25:37 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 285f44147f425d05c2fc1bc4acc774699c6b1628
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun May 27 23:39:50 2018 +0200
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Fri Aug 17 18:25:36 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 <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
    
    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 24fc51f9004a9f675c6960220bde51e350cd1d01
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun May 27 23:23:41 2018 +0200
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Fri Aug 17 18:25:36 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 <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>
    (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 <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit 7f0a219c9ad38ae33b51ff69d545f69659691c1e)
    Reviewed-on: https://gerrit.libreoffice.org/28926
    Reviewed-by: Michael Stahl <mst...@redhat.com>
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>
    
    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..5943e0f8682a 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 String& 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..e2efb9e868ca 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -794,7 +794,7 @@ public:
     virtual void SetVisibleLinks(bool bFlag);
     virtual sfx2::LinkManager& GetLinkManager();
     virtual const sfx2::LinkManager& GetLinkManager() const;
-    virtual void UpdateLinks(bool bUI);
+    virtual void UpdateLinks();
     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 ::sfx2::SvLinkSource* CreateLinkSource(const OUString& rItem);
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() );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to