summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-09-13 12:32:04 +0100
committerAndras Timar <andras.timar@collabora.com>2017-03-22 11:39:01 +0100
commit5d40e1fdbec357bd5b2d98bd68634d0842582cc0 (patch)
treed8b08300996bb2d09cdc567b0a9001f5e24e1359 /sc
parentfb069a007d866132c6aacfc33b5671a94046a274 (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (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 <noel@peralex.com> 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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 7f0a219c9ad38ae33b51ff69d545f69659691c1e) b6af93afc1f80b7fc36239c96d5e0a71fcbcb789 4d4375dff64d7b8e236d1a24322e749e04ee530f Reviewed-on: https://gerrit.libreoffice.org/28930 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 2ff4c68b63c4842ec85a21287317096b6ca8e66e) Change-Id: Id1dd7ea17342140eab9307d546528747e3a98090
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/documentlinkmgr.hxx5
-rw-r--r--sc/source/ui/docshell/docsh.cxx7
-rw-r--r--sc/source/ui/docshell/docsh4.cxx12
-rw-r--r--sc/source/ui/docshell/documentlinkmgr.cxx26
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx2
5 files changed, 43 insertions, 9 deletions
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 57667ff7c8fc..4a839f88d158 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 <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>
@@ -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 <sc.hrc>
#include <scresid.hxx>
-#include <sfx2/linkmgr.hxx>
+#include <svx/svdoole2.hxx>
#include <vcl/layout.hxx>
#include <boost/noncopyable.hpp>
@@ -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<ScDdeLink*>(pBase))
+ if (bDde && dynamic_cast<ScDdeLink*>(pBase))
+ return true;
+ if (bOle && dynamic_cast<SdrEmbedObjectLink*>(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<SdrEmbedObjectLink*>(pBase);
+ if (pOleLink)
+ {
+ pOleLink->Update();
+ continue;
+ }
+
ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>(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)