diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-09-13 12:32:04 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-09-16 21:35:57 +0000 |
commit | 2ff4c68b63c4842ec85a21287317096b6ca8e66e (patch) | |
tree | fb32b63f77061ed4694bf9ad2b4895bd453cba77 /sc | |
parent | 3bf31803959ccc54bb949630f936a768ef47a90b (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)
Change-Id: Id1dd7ea17342140eab9307d546528747e3a98090
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>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/documentlinkmgr.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/docshell/documentlinkmgr.cxx | 26 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh4.cxx | 2 |
5 files changed, 43 insertions, 9 deletions
diff --git a/sc/inc/documentlinkmgr.hxx b/sc/inc/documentlinkmgr.hxx index 3f9cc0c7a4cd..a50175fb25cc 100644 --- a/sc/inc/documentlinkmgr.hxx +++ b/sc/inc/documentlinkmgr.hxx @@ -54,14 +54,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 452a03ad66ce..dde5d3c97a87 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -562,9 +562,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 0a0a7c394b0d..48bd2fc98b14 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 9609781eec55..069d39c40226 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> @@ -113,6 +113,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; @@ -120,14 +130,16 @@ bool DocumentLinkManager::hasDdeLinks() const for (size_t i = 0, n = rLinks.size(); i < n; ++i) { sfx2::SvBaseLink* pBase = rLinks[i].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; @@ -141,6 +153,14 @@ bool DocumentLinkManager::updateDdeLinks( vcl::Window* pWin ) for (size_t i = 0, n = rLinks.size(); i < n; ++i) { sfx2::SvBaseLink* pBase = rLinks[i].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 5a6413e90313..cbb2f0e7736a 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) |