Author: jim
Date: Thu Sep 21 12:30:32 2017
New Revision: 1809153
URL: http://svn.apache.org/viewvc?rev=1809153&view=rev
Log:
OLE update verification. Keep user in-the-know and query them.
Modified:
openoffice/branches/AOO414/main/comphelper/source/container/embeddedobjectcontainer.cxx
openoffice/branches/AOO414/main/sc/source/core/data/documen2.cxx
openoffice/branches/AOO414/main/sfx2/inc/sfx2/linkmgr.hxx
openoffice/branches/AOO414/main/sfx2/source/appl/linkmgr2.cxx
Modified:
openoffice/branches/AOO414/main/comphelper/source/container/embeddedobjectcontainer.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO414/main/comphelper/source/container/embeddedobjectcontainer.cxx?rev=1809153&r1=1809152&r2=1809153&view=diff
==============================================================================
---
openoffice/branches/AOO414/main/comphelper/source/container/embeddedobjectcontainer.cxx
(original)
+++
openoffice/branches/AOO414/main/comphelper/source/container/embeddedobjectcontainer.cxx
Thu Sep 21 12:30:32 2017
@@ -127,7 +127,7 @@ EmbeddedObjectContainer::EmbeddedObjectC
pImpl = new EmbedImpl;
pImpl->mxStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
pImpl->mbOwnsStorage = true;
- pImpl->mbUserAllowsLinkUpdate = false;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
}
@@ -136,7 +136,7 @@ EmbeddedObjectContainer::EmbeddedObjectC
pImpl = new EmbedImpl;
pImpl->mxStorage = rStor;
pImpl->mbOwnsStorage = false;
- pImpl->mbUserAllowsLinkUpdate = false;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
}
@@ -145,7 +145,7 @@ EmbeddedObjectContainer::EmbeddedObjectC
pImpl = new EmbedImpl;
pImpl->mxStorage = rStor;
pImpl->mbOwnsStorage = false;
- pImpl->mbUserAllowsLinkUpdate = false;
+ pImpl->mbUserAllowsLinkUpdate = true;
pImpl->mpTempObjectContainer = 0;
pImpl->m_xModel = xModel;
}
Modified: openoffice/branches/AOO414/main/sc/source/core/data/documen2.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO414/main/sc/source/core/data/documen2.cxx?rev=1809153&r1=1809152&r2=1809153&view=diff
==============================================================================
--- openoffice/branches/AOO414/main/sc/source/core/data/documen2.cxx (original)
+++ openoffice/branches/AOO414/main/sc/source/core/data/documen2.cxx Thu Sep 21
12:30:32 2017
@@ -229,7 +229,10 @@ ScDocument::ScDocument( ScDocumentMode e
if ( eMode == SCDOCMODE_DOCUMENT )
{
if ( pDocShell )
- pLinkManager = new sfx2::LinkManager( pDocShell );
+ {
+ pLinkManager = new sfx2::LinkManager(pDocShell);
+ pLinkManager->SetAutoAskUpdateAllLinks();
+ }
xPoolHelper = new ScPoolHelper( this );
@@ -269,6 +272,7 @@ sfx2::LinkManager* ScDocument::GetLinkMa
if ( bAutoCalc && !pLinkManager && pShell)
{
pLinkManager = new sfx2::LinkManager( pShell );
+ pLinkManager->SetAutoAskUpdateAllLinks();
}
return pLinkManager;
}
Modified: openoffice/branches/AOO414/main/sfx2/inc/sfx2/linkmgr.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO414/main/sfx2/inc/sfx2/linkmgr.hxx?rev=1809153&r1=1809152&r2=1809153&view=diff
==============================================================================
--- openoffice/branches/AOO414/main/sfx2/inc/sfx2/linkmgr.hxx (original)
+++ openoffice/branches/AOO414/main/sfx2/inc/sfx2/linkmgr.hxx Thu Sep 21
12:30:32 2017
@@ -55,6 +55,13 @@ class SFX2_DLLPUBLIC LinkManager
SvLinkSources aServerTbl;
SfxObjectShell *pPersist; // LinkMgr muss vor SfxObjectShell freigegeben
werden
+
+ sal_Bool mAutoAskUpdateAllLinks;
+ sal_Bool mUpdateAsked;
+ sal_Bool mAllowUpdate;
+
+ sal_Bool GetUserAllowsLinkUpdate(Window *pParent);
+ void SetUserAllowsLinkUpdate(SvBaseLink *pLink, sal_Bool allows);
protected:
sal_Bool InsertLink( SvBaseLink* pLink, sal_uInt16
nObjType, sal_uInt16 nUpdateType,
const String* pName = 0
);
@@ -105,6 +112,10 @@ public:
SvLinkSourceRef CreateObj( SvBaseLink* );
+
+ // Automatically ask user about update all links, on first insert
+ void SetAutoAskUpdateAllLinks();
+
void UpdateAllLinks( sal_Bool bAskUpdate = sal_True,
sal_Bool
bCallErrHdl = sal_True,
sal_Bool bUpdateGrfLinks = sal_False,
Modified: openoffice/branches/AOO414/main/sfx2/source/appl/linkmgr2.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO414/main/sfx2/source/appl/linkmgr2.cxx?rev=1809153&r1=1809152&r2=1809153&view=diff
==============================================================================
--- openoffice/branches/AOO414/main/sfx2/source/appl/linkmgr2.cxx (original)
+++ openoffice/branches/AOO414/main/sfx2/source/appl/linkmgr2.cxx Thu Sep 21
12:30:32 2017
@@ -65,11 +65,12 @@ public:
SV_IMPL_PTRARR( SvBaseLinks, SvBaseLinkRefPtr )
LinkManager::LinkManager(SfxObjectShell* p)
- : pPersist( p )
+ : pPersist(p),
+ mUpdateAsked(sal_False),
+ mAutoAskUpdateAllLinks(sal_False)
{
}
-
LinkManager::~LinkManager()
{
SvBaseLinkRef** ppRef = (SvBaseLinkRef**)aLinkTbl.GetData();
@@ -157,6 +158,12 @@ sal_Bool LinkManager::Insert( SvBaseLink
SvBaseLinkRef* pTmp = new SvBaseLinkRef( pLink );
pLink->SetLinkManager( this );
aLinkTbl.Insert( pTmp, aLinkTbl.Count() );
+ Window *parent = GetPersist()->GetDialogParent();
+ if (mAutoAskUpdateAllLinks)
+ {
+ SetUserAllowsLinkUpdate(pLink, GetUserAllowsLinkUpdate(parent));
+ }
+
return sal_True;
}
@@ -268,6 +275,35 @@ sal_Bool LinkManager::GetDisplayNames( c
return bRet;
}
+void LinkManager::SetAutoAskUpdateAllLinks()
+{
+ mAutoAskUpdateAllLinks = sal_True;
+}
+
+sal_Bool LinkManager::GetUserAllowsLinkUpdate(Window *pParentWin)
+{
+ if (!mUpdateAsked)
+ {
+ if (QueryBox(pParentWin, WB_YES_NO | WB_DEF_NO,
SfxResId(STR_QUERY_UPDATE_LINKS)).Execute() == RET_YES)
+ mAllowUpdate = sal_True;
+ else
+ mAllowUpdate = sal_False;
+ mUpdateAsked = sal_True;
+ }
+ return mAllowUpdate;
+}
+
+void LinkManager::SetUserAllowsLinkUpdate(SvBaseLink *pLink, sal_Bool allows)
+{
+ SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist();
+
+ if (pShell)
+ {
+ comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer =
pShell->getEmbeddedObjectContainer();
+ rEmbeddedObjectContainer.setUserAllowsLinkUpdate(allows);
+ }
+}
+
void LinkManager::UpdateAllLinks(
sal_Bool bAskUpdate,
@@ -313,26 +349,20 @@ void LinkManager::UpdateAllLinks(
if( !pLink->IsVisible() ||
( !bUpdateGrfLinks && OBJECT_CLIENT_GRF ==
pLink->GetObjType() ))
continue;
-
- if( bAskUpdate )
+
+ sal_Bool allows = sal_False;
+
+ if (bAskUpdate)
{
- int nRet = QueryBox( pParentWin, WB_YES_NO | WB_DEF_NO, SfxResId(
STR_QUERY_UPDATE_LINKS ) ).Execute();
- SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist();
+ allows = GetUserAllowsLinkUpdate(pParentWin);
+ }
- if(pShell)
- {
- comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer
= pShell->getEmbeddedObjectContainer();
- rEmbeddedObjectContainer.setUserAllowsLinkUpdate(RET_YES ==
nRet);
- }
+ SetUserAllowsLinkUpdate(pLink, allows);
+ bAskUpdate = sal_False; // one time is OK
- if (RET_YES != nRet)
- {
- return; // nothing should be updated
- }
- bAskUpdate = sal_False; // one time is OK
- }
+ if (allows)
+ pLink->Update();
- pLink->Update();
}
}