summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-09-13 12:32:04 +0100
committerEike Rathke <erack@redhat.com>2016-09-16 21:58:36 +0000
commit8c20df32c8278bc4a076cef285db7788627f4c07 (patch)
tree13e3684eb3ecf23391346b330873035389c5a988 /sc
parent13ba2592254c861dafa337121902168d83f610bd (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) Change-Id: Id1dd7ea17342140eab9307d546528747e3a98090 detangle gadzillion checks into something readable no logic change intended Change-Id: Ib6af93afc1f80b7fc36239c96d5e0a71fcbcb789 (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 ?) Change-Id: I4d4375dff64d7b8e236d1a24322e749e04ee530f 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) Reviewed-on: https://gerrit.libreoffice.org/28926 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
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 4553470af3e8..d5d801a4aeb2 100644
--- a/sc/inc/documentlinkmgr.hxx
+++ b/sc/inc/documentlinkmgr.hxx
@@ -55,14 +55,17 @@ public:
bool idleCheckLinks();
bool hasDdeLinks() const;
+ bool hasDdeOrOleLinks() const;
- bool updateDdeLinks( vcl::Window* pWin );
+ bool updateDdeOrOleLinks(vcl::Window* pWin);
void 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 163024e2d1b5..dcb772277563 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -559,9 +559,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())
{
const SfxUInt16Item* pUpdateDocItem = SfxItemSet::GetItem<SfxUInt16Item>(rMedium.GetItemSet(), SID_UPDATEDOCMODE, false);
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index bdf1c5260151..853692cf898e 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -30,6 +30,7 @@ using namespace ::com::sun::star;
#include "scitems.hxx"
#include <editeng/flstitem.hxx>
#include <sfx2/fcontnr.hxx>
+#include <sfx2/linkmgr.hxx>
#include <sfx2/objface.hxx>
#include <sfx2/docfile.hxx>
#include <svtools/ehdl.hxx>
@@ -43,6 +44,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>
@@ -400,6 +402,9 @@ void ScDocShell::Execute( SfxRequest& rReq )
break;
case SID_UPDATETABLINKS:
{
+ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer();
+ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
+
ScDocument& rDoc = GetDocument();
ScLkUpdMode nSet = rDoc.GetLinkMode();
@@ -443,9 +448,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();
@@ -461,7 +466,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 02f00e9068df..520b8542afc0 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 <memory>
@@ -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 (const auto & rLink : rLinks)
{
sfx2::SvBaseLink* pBase = rLink.get();
- 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 (const auto & rLink : rLinks)
{
sfx2::SvBaseLink* pBase = rLink.get();
+
+ 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 2d8825b2dec0..a8f319708bb3 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1564,7 +1564,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)