diff options
-rw-r--r-- | embeddedobj/source/commonembedding/visobj.cxx | 6 | ||||
-rw-r--r-- | include/svx/svdoole2.hxx | 16 | ||||
-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 | ||||
-rw-r--r-- | sd/source/core/drawdoc.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdoole2.cxx | 20 | ||||
-rw-r--r-- | svx/source/unodraw/unoshap4.cxx | 4 | ||||
-rw-r--r-- | sw/inc/IDocumentLinksAdministration.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 85 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentLinksAdministrationManager.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/app/docshini.cxx | 3 |
17 files changed, 131 insertions, 74 deletions
diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx index fea7c3a2cf0a..3ee85851af9f 100644 --- a/embeddedobj/source/commonembedding/visobj.cxx +++ b/embeddedobj/source/commonembedding/visobj.cxx @@ -174,7 +174,11 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe bool bBackToLoaded = 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 2d0b49d6da46..239284b07cb4 100644 --- a/include/svx/svdoole2.hxx +++ b/include/svx/svdoole2.hxx @@ -22,6 +22,7 @@ #include <svx/svdorect.hxx> #include <svx/svxdllapi.h> +#include <sfx2/linkmgr.hxx> #include <com/sun/star/uno/Reference.h> @@ -176,6 +177,21 @@ public: virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override; }; +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/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) diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 6702e9d7ad0b..751dbdbdbdb4 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -696,6 +696,12 @@ void SdDrawDocument::UpdateAllLinks() { s_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 (s_pDocLockedInsertingLinks == this) diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index e5b2830c9f08..7d2695be2709 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -287,8 +287,11 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) } bRet = SfxObjectShell::Load( rMedium ); - if( bRet ) + if (bRet) { + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + bRet = SdXMLFilter( rMedium, *this, true, SDXMLMODE_Normal, SotStorage::GetVersion( rMedium.GetStorage() ) ).Import( nError ); } diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index e786dbfb56e3..d29245656a24 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -58,7 +58,6 @@ #include <comphelper/classids.hxx> #include <sot/formats.hxx> -#include <sfx2/linkmgr.hxx> #include <svtools/transfer.hxx> #include <cppuhelper/implbase.hxx> @@ -588,25 +587,6 @@ void SdrLightEmbeddedClient_Impl::setWindow(const uno::Reference< awt::XWindow > m_xWindow = _xWindow; } - - -class 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; } -}; - - - SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject): ::sfx2::SvBaseLink( ::SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::SVXB ), pObj(pObject) diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 03c85d4ce9ed..ce748bf6377f 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -420,7 +420,7 @@ 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 @@ -488,7 +488,7 @@ 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 db7aebed2bf8..0c9edea72da3 100644 --- a/sw/inc/IDocumentLinksAdministration.hxx +++ b/sw/inc/IDocumentLinksAdministration.hxx @@ -46,7 +46,7 @@ using rtl::OUString; /** #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/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index a249f2c82bbf..397edae7abe8 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -197,47 +197,58 @@ const sfx2::LinkManager& DocumentLinksAdministrationManager::GetLinkManager() co // #i42634# Moved common code of SwReader::Read() and SwDocShell::UpdateLinks() // to new SwDoc::UpdateLinks(): -void DocumentLinksAdministrationManager::UpdateLinks( bool bUI ) +void DocumentLinksAdministrationManager::UpdateLinks() { - SfxObjectCreateMode eMode; - sal_uInt16 nLinkMode = m_rDoc.GetDocumentSettingManager().getLinkUpdateMode( true ); - if ( m_rDoc.GetDocShell()) { - sal_uInt16 nUpdateDocMode = m_rDoc.GetDocShell()->GetUpdateDocMode(); - if( (nLinkMode != NEVER || document::UpdateDocMode::FULL_UPDATE == nUpdateDocMode) && - !GetLinkManager().GetLinks().empty() && - SfxObjectCreateMode::INTERNAL != - ( eMode = m_rDoc.GetDocShell()->GetCreateMode()) && - SfxObjectCreateMode::ORGANIZER != eMode && - SfxObjectCreateMode::PREVIEW != eMode && - !m_rDoc.GetDocShell()->IsPreview() ) + if (!m_rDoc.GetDocShell()) + return; + SfxObjectCreateMode eMode = m_rDoc.GetDocShell()->GetCreateMode(); + if (eMode == SfxObjectCreateMode::INTERNAL) + return; + if (eMode == SfxObjectCreateMode::ORGANIZER) + return; + if (eMode == SfxObjectCreateMode::PREVIEW) + return; + if (m_rDoc.GetDocShell()->IsPreview()) + return; + if (GetLinkManager().GetLinks().empty()) + return; + sal_uInt16 nLinkMode = m_rDoc.GetDocumentSettingManager().getLinkUpdateMode(true); + sal_uInt16 nUpdateDocMode = m_rDoc.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 = m_rDoc.GetDocShell()->GetMedium(); + if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( + medium == nullptr ? OUString() : medium->GetName())) { - 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 = m_rDoc.GetDocShell()->GetMedium(); - if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks( - medium == nullptr ? OUString() : medium->GetName())) - { - bAskUpdate = true; - } - } - if( bUpdate && (bUI || !bAskUpdate) ) - { - SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium(); - SfxFrame* pFrame = pMedium ? pMedium->GetLoadTargetFrame() : nullptr; - vcl::Window* pDlgParent = pFrame ? &pFrame->GetWindow() : nullptr; - - GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); - } + bAskUpdate = true; } } + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = m_rDoc.GetDocShell()->getEmbeddedObjectContainer(); + if (bUpdate) + { + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true); + + SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium(); + SfxFrame* pFrame = pMedium ? pMedium->GetLoadTargetFrame() : nullptr; + vcl::Window* pDlgParent = pFrame ? &pFrame->GetWindow() : nullptr; + + GetLinkManager().UpdateAllLinks( bAskUpdate, true, false, pDlgParent ); + } + else + { + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + } } bool DocumentLinksAdministrationManager::GetData( const OUString& rItem, const OUString& rMimeType, diff --git a/sw/source/core/inc/DocumentLinksAdministrationManager.hxx b/sw/source/core/inc/DocumentLinksAdministrationManager.hxx index dcd329978cb8..1fbd4039d106 100644 --- a/sw/source/core/inc/DocumentLinksAdministrationManager.hxx +++ b/sw/source/core/inc/DocumentLinksAdministrationManager.hxx @@ -47,7 +47,7 @@ public: const sfx2::LinkManager& GetLinkManager() const override; - void UpdateLinks(bool bUI) override; + void UpdateLinks() override; bool GetData(const OUString& rItem, const OUString& rMimeType, css::uno::Any& rValue) const override; diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index a2e6a5c6c6e5..eb951001a67b 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -364,7 +364,7 @@ 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->getIDocumentLinksAdministration().UpdateLinks( true ); + pDoc->getIDocumentLinksAdministration().UpdateLinks(); // not insert: set the redline mode read from settings.xml eOld = static_cast<RedlineMode_t>( diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 72533e5f6f1b..cb1d38032620 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -1206,7 +1206,7 @@ void SwDocShell::CalcLayoutForOLEObjects() // read by the binary filter: void SwDocShell::UpdateLinks() { - GetDoc()->getIDocumentLinksAdministration().UpdateLinks(true); + GetDoc()->getIDocumentLinksAdministration().UpdateLinks(); // #i50703# Update footnote numbers SwTextFootnote::SetUniqueSeqRefNo( *GetDoc() ); SwNodeIndex aTmp( GetDoc()->GetNodes() ); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 2844b23cde5b..7993f944fd73 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -492,6 +492,9 @@ bool SwDocShell::Load( SfxMedium& rMedium ) bool bRet = false; if( SfxObjectShell::Load( rMedium )) { + comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = getEmbeddedObjectContainer(); + rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false); + SAL_INFO( "sw.ui", "after SfxInPlaceObject::Load" ); if (m_pDoc) // for last version!! RemoveLink(); // release the existing |