namespace formula {
+const sal_uInt16 errNONE = 0;
const sal_uInt16 errIllegalChar = 501;
const sal_uInt16 errIllegalArgument = 502;
const sal_uInt16 errIllegalFPOperation = 503; // #NUM!
sc/source/core/tool/unitconv \
sc/source/core/tool/userlist \
sc/source/core/tool/viewopti \
+ sc/source/core/tool/webservicelink \
sc/source/core/tool/zforauto \
sc/source/filter/xml/datastreamimport \
sc/source/filter/xml/XMLCalculationSettingsContext \
{
SCDOCMODE_DOCUMENT,
SCDOCMODE_CLIP,
- SCDOCMODE_UNDO
+ SCDOCMODE_UNDO,
+ SCDOCMODE_FUNCTIONACCESS
};
struct ScDocStat
bool bCalculatingFormulaTree;
bool bIsClip;
bool bIsUndo;
+ bool bIsFunctionAccess;
bool bIsVisible; // set from view ctor
bool bIsEmbedded; // display/adjust Embedded area?
// for detective update, is set for each change of a formula
bool bDetectiveDirty;
- bool bHasMacroFunc; // valid only after loading
+ bool bLinkFormulaNeedingCheck; // valid only after loading, for ocDde and ocWebservice
sal_uInt8 nAsianCompression;
sal_uInt8 nAsianKerning;
bool IsClipboard() const { return bIsClip; }
bool IsUndoEnabled() const { return mbUndoEnabled; }
SC_DLLPUBLIC void EnableUndo( bool bVal );
+ bool IsFunctionAccess() const { return bIsFunctionAccess; }
bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; }
void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; }
bool IsDetectiveDirty() const { return bDetectiveDirty; }
void SetDetectiveDirty(bool bSet) { bDetectiveDirty = bSet; }
- bool GetHasMacroFunc() const { return bHasMacroFunc; }
- void SetHasMacroFunc(bool bSet) { bHasMacroFunc = bSet; }
+ bool HasLinkFormulaNeedingCheck() const { return bLinkFormulaNeedingCheck; }
+ void SetLinkFormulaNeedingCheck(bool bSet) { bLinkFormulaNeedingCheck = bSet; }
+ /** Check token array and set link check if ocDde/ocWebservice is contained. */
+ SC_DLLPUBLIC void CheckLinkFormulaNeedingCheck( const ScTokenArray& rCode );
static bool CheckMacroWarn();
bool idleCheckLinks();
bool hasDdeLinks() const;
- bool hasDdeOrOleLinks() const;
+ bool hasDdeOrOleOrWebServiceLinks() const;
- bool updateDdeOrOleLinks(vcl::Window* pWin);
+ bool updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin);
void updateDdeLink( const OUString& rAppl, const OUString& rTopic, const OUString& rItem );
void disconnectDdeLinks();
private:
- bool hasDdeOrOleLinks(bool bDde, bool bOle) const;
+ bool hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, bool bWebService) const;
};
}
Compile( GetExpression(aSrcPos, 0, 0, eTempGrammar1),
GetExpression(aSrcPos, 1, 0, eTempGrammar2),
aStrNmsp1, aStrNmsp2, eTempGrammar1, eTempGrammar2, true );
+
+ // Importing ocDde/ocWebservice?
+ if (pFormula1)
+ mpDoc->CheckLinkFormulaNeedingCheck(*pFormula1);
+ if (pFormula2)
+ mpDoc->CheckLinkFormulaNeedingCheck(*pFormula2);
}
void ScConditionEntry::SetSrcString( const OUString& rNew )
eHardRecalcState(HARDRECALCSTATE_OFF),
nVisibleTab( 0 ),
eLinkMode(LM_UNKNOWN),
- bAutoCalc( eMode == SCDOCMODE_DOCUMENT ),
+ bAutoCalc( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS ),
bAutoCalcShellDisabled( false ),
bForcedFormulaPending( false ),
bCalculatingFormulaTree( false ),
bIsClip( eMode == SCDOCMODE_CLIP ),
bIsUndo( eMode == SCDOCMODE_UNDO ),
+ bIsFunctionAccess( eMode == SCDOCMODE_FUNCTIONACCESS ),
bIsVisible( false ),
bIsEmbedded( false ),
bInsertingFromOtherDoc( false ),
bInDtorClear( false ),
bExpandRefs( false ),
bDetectiveDirty( false ),
- bHasMacroFunc( false ),
+ bLinkFormulaNeedingCheck( false ),
nAsianCompression(SC_ASIANCOMPRESSION_INVALID),
nAsianKerning(SC_ASIANKERNING_INVALID),
bPastingDrawFromOtherDoc( false ),
eSrcSet = osl_getThreadTextEncoding();
- if ( eMode == SCDOCMODE_DOCUMENT )
+ /* TODO: for SCDOCMODE_FUNCTIONACCESS it might not even be necessary to
+ * have all of these available. */
+ if ( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS )
{
xPoolHelper = new ScPoolHelper( this );
#include "stringutil.hxx"
#include <documentlinkmgr.hxx>
#include <scopetools.hxx>
+#include <tokenarray.hxx>
#include <memory>
}
}
+void ScDocument::CheckLinkFormulaNeedingCheck( const ScTokenArray& rCode )
+{
+ if (HasLinkFormulaNeedingCheck())
+ return;
+
+ // Prefer RPN over tokenized formula if available.
+ if (rCode.GetCodeLen())
+ {
+ if (rCode.HasOpCodeRPN(ocDde) || rCode.HasOpCodeRPN(ocWebservice))
+ SetLinkFormulaNeedingCheck(true);
+ }
+ else if (rCode.GetLen())
+ {
+ if (rCode.HasOpCode(ocDde) || rCode.HasOpCode(ocWebservice))
+ SetLinkFormulaNeedingCheck(true);
+ }
+ else
+ {
+ assert(!"called with empty ScTokenArray");
+ }
+}
+
// TimerDelays etc.
void ScDocument::KeyInput( const KeyEvent& )
{
bChanged = true;
}
- // Same as in Load: after loading, it must be known if ocMacro is in any formula
- // (for macro warning, CompileXML is called at the end of loading XML file)
- if ( !pDocument->GetHasMacroFunc() && pCode->HasOpCodeRPN( ocMacro ) )
- pDocument->SetHasMacroFunc( true );
+ // After loading, it must be known if ocDde/ocWebservice is in any formula
+ // (for external links warning, CompileXML is called at the end of loading XML file)
+ pDocument->CheckLinkFormulaNeedingCheck(*pCode);
//volatile cells must be added here for import
if( pCode->IsRecalcModeAlways() || pCode->IsRecalcModeForced() ||
--- /dev/null
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_SOURCE_CORE_INC_WEBSERVICE_HXX
+#define INCLUDED_SC_SOURCE_CORE_INC_WEBSERVICE_HXX
+
+#include <address.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <svl/broadcast.hxx>
+#include <types.hxx>
+
+class ScDocument;
+
+class ScWebServiceLink : public ::sfx2::SvBaseLink, public SvtBroadcaster
+{
+private:
+ ScDocument* pDoc;
+ OUString aURL; // connection/ link data
+ bool bHasResult; // is set aResult is useful
+ OUString aResult;
+
+public:
+ ScWebServiceLink(ScDocument* pD, const OUString& rURL);
+ virtual ~ScWebServiceLink() override;
+
+ // SvBaseLink override:
+ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(const OUString& rMimeType,
+ const css::uno::Any& rValue) override;
+
+ // SvtBroadcaster override:
+ virtual void ListenersGone() override;
+
+ // for interpreter:
+
+ const OUString& GetResult() const { return aResult; }
+ bool HasResult() const { return bHasResult; }
+
+ const OUString& GetURL() const { return aURL; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
pBindings->Invalidate( SID_LINKS ); // Link-Manager enablen
}
+ //if the document was just loaded, but the ScDdeLink entry was missing, then
+ //don't update this link until the links are updated in response to the users
+ //decision
+ if (!pDok->HasLinkFormulaNeedingCheck())
+ {
//TODO: evaluate asynchron ???
- pLink->TryUpdate(); // TryUpdate doesn't call Update multiple times
+ pLink->TryUpdate(); // TryUpdate doesn't call Update multiple times
+ }
if (pMyFormulaCell)
{
#include "scmatrix.hxx"
#include <rtl/strbuf.hxx>
#include <formula/errorcodes.hxx>
+#include <sfx2/bindings.hxx>
#include <svtools/miscopt.hxx>
+#include <tools/urlobj.hxx>
#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <datastreamgettime.hxx>
#include <dpobject.hxx>
#include <document.hxx>
+#include <tokenarray.hxx>
+#include <webservicelink.hxx>
+
+#include <sc.hrc>
#include <cstring>
#include <memory>
}
}
+static ScWebServiceLink* lcl_GetWebServiceLink(const sfx2::LinkManager* pLinkMgr, const OUString& rURL)
+{
+ size_t nCount = pLinkMgr->GetLinks().size();
+ for (size_t i=0; i<nCount; ++i)
+ {
+ ::sfx2::SvBaseLink* pBase = pLinkMgr->GetLinks()[i].get();
+ if (ScWebServiceLink* pLink = dynamic_cast<ScWebServiceLink*>(pBase))
+ {
+ if (pLink->GetURL() == rURL)
+ return pLink;
+ }
+ }
+
+ return nullptr;
+}
+
+static bool lcl_FunctionAccessLoadWebServiceLink( OUString& rResult, ScDocument* pDoc, const OUString& rURI )
+{
+ // For FunctionAccess service always force a changed data update.
+ ScWebServiceLink aLink( pDoc, rURI);
+ if (aLink.DataChanged( OUString(), css::uno::Any()) != sfx2::SvBaseLink::UpdateResult::SUCCESS)
+ return false;
+
+ if (!aLink.HasResult())
+ return false;
+
+ rResult = aLink.GetResult();
+
+ return true;
+}
+
void ScInterpreter::ScWebservice()
{
sal_uInt8 nParamCount = GetByte();
return;
}
- uno::Reference< ucb::XSimpleFileAccess3 > xFileAccess( ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ), uno::UNO_QUERY );
- if(!xFileAccess.is())
+ INetURLObject aObj(aURI, INetProtocol::File);
+ INetProtocol eProtocol = aObj.GetProtocol();
+ if (eProtocol != INetProtocol::Http && eProtocol != INetProtocol::Https)
{
PushError( formula::errNoValue );
return;
}
- uno::Reference< io::XInputStream > xStream;
- try {
- xStream = xFileAccess->openFileRead( aURI );
- }
- catch (...)
- {
- // don't let any exceptions pass
- PushError( formula::errNoValue );
- return;
- }
- if ( !xStream.is() )
+ if (!mpLinkManager)
{
- PushError( formula::errNoValue );
+ if (!pDok->IsFunctionAccess() || pDok->HasLinkFormulaNeedingCheck())
+ {
+ PushError( formula::errNoValue);
+ }
+ else
+ {
+ OUString aResult;
+ if (lcl_FunctionAccessLoadWebServiceLink( aResult, pDok, aURI))
+ PushString( aResult);
+ else
+ PushError( formula::errNoValue);
+ }
+
return;
}
- const sal_Int32 BUF_LEN = 8000;
- uno::Sequence< sal_Int8 > buffer( BUF_LEN );
- OStringBuffer aBuffer( 64000 );
+ // Need to reinterpret after loading (build links)
+ if (rArr.IsRecalcModeNormal())
+ rArr.SetExclusiveRecalcModeOnLoad();
+
+ // while the link is not evaluated, idle must be disabled (to avoid circular references)
+ bool bOldEnabled = pDok->IsIdleEnabled();
+ pDok->EnableIdle(false);
+
+ // Get/ Create link object
+ ScWebServiceLink* pLink = lcl_GetWebServiceLink(mpLinkManager, aURI);
+
+ bool bWasError = (pMyFormulaCell && pMyFormulaCell->GetRawError() != formula::errNONE);
- sal_Int32 nRead = 0;
- while ( ( nRead = xStream->readBytes( buffer, BUF_LEN ) ) == BUF_LEN )
+ if (!pLink)
{
- aBuffer.append( reinterpret_cast< const char* >( buffer.getConstArray() ), nRead );
- }
+ pLink = new ScWebServiceLink(pDok, aURI);
+ mpLinkManager->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, aURI);
+ if ( mpLinkManager->GetLinks().size() == 1 ) // the first one?
+ {
+ SfxBindings* pBindings = pDok->GetViewBindings();
+ if (pBindings)
+ pBindings->Invalidate( SID_LINKS ); // Link-Manager enabled
+ }
+
+ //if the document was just loaded, but the ScDdeLink entry was missing, then
+ //don't update this link until the links are updated in response to the users
+ //decision
+ if (!pDok->HasLinkFormulaNeedingCheck())
+ {
+ pLink->Update();
+ }
- if ( nRead > 0 )
+ if (pMyFormulaCell)
+ {
+ // StartListening after the Update to avoid circular references
+ pMyFormulaCell->StartListening(*pLink);
+ }
+ }
+ else
{
- aBuffer.append( reinterpret_cast< const char* >( buffer.getConstArray() ), nRead );
+ if (pMyFormulaCell)
+ pMyFormulaCell->StartListening(*pLink);
}
- xStream->closeInput();
+ // If an new Error from Reschedule appears when the link is executed then reset the errorflag
+ if (pMyFormulaCell && pMyFormulaCell->GetRawError() != formula::errNONE && !bWasError)
+ pMyFormulaCell->SetErrCode(formula::errNONE);
+
+ // check the value
+ if (pLink->HasResult())
+ PushString(pLink->GetResult());
+ else
+ PushError(formula::errNoValue);
- OUString aContent = OStringToOUString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
- PushString( aContent );
+ pDok->EnableIdle(bOldEnabled);
+ mpLinkManager->CloseCachedComps();
}
}
mnMaxCol (-1)
{
if (!rSymbol.isEmpty())
- CompileRangeData( rSymbol, pDoc->IsImportingXML());
+ {
// Let the compiler set an error on unknown names for a subsequent
// CompileUnresolvedXML().
+ const bool bImporting = pDoc->IsImportingXML();
+ CompileRangeData( rSymbol, bImporting);
+ if (bImporting)
+ pDoc->CheckLinkFormulaNeedingCheck( *pCode);
+ }
else
{
// #i63513#/#i65690# don't leave pCode as NULL.
// Don't let the compiler set an error for unknown names on final
// compile, errors are handled by the interpreter thereafter.
CompileRangeData( aSymbol, false);
+ rCxt.getDoc()->CheckLinkFormulaNeedingCheck( *pCode);
}
}
--- /dev/null
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <comphelper/fileformat.h>
+#include <comphelper/string.hxx>
+#include <osl/thread.h>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/bindings.hxx>
+
+#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+
+#include <webservicelink.hxx>
+#include <brdcst.hxx>
+#include <document.hxx>
+#include <scmatrix.hxx>
+#include <patattr.hxx>
+#include <rechead.hxx>
+#include <rangeseq.hxx>
+#include <sc.hrc>
+#include <hints.hxx>
+
+ScWebServiceLink::ScWebServiceLink(ScDocument* pD, const OUString& rURL)
+ : ::sfx2::SvBaseLink(SfxLinkUpdateMode::ALWAYS, SotClipboardFormatId::STRING)
+ , pDoc(pD)
+ , aURL(rURL)
+ , bHasResult(false)
+{
+}
+
+ScWebServiceLink::~ScWebServiceLink() {}
+
+sfx2::SvBaseLink::UpdateResult ScWebServiceLink::DataChanged(const OUString&, const css::uno::Any&)
+{
+ aResult.clear();
+ bHasResult = false;
+
+ css::uno::Reference<css::ucb::XSimpleFileAccess3> xFileAccess(
+ css::ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext()),
+ css::uno::UNO_QUERY);
+ if (!xFileAccess.is())
+ return ERROR_GENERAL;
+
+ css::uno::Reference<css::io::XInputStream> xStream;
+ try
+ {
+ xStream = xFileAccess->openFileRead(aURL);
+ }
+ catch (...)
+ {
+ // don't let any exceptions pass
+ return ERROR_GENERAL;
+ }
+ if (!xStream.is())
+ return ERROR_GENERAL;
+
+ const sal_Int32 BUF_LEN = 8000;
+ css::uno::Sequence<sal_Int8> buffer(BUF_LEN);
+ OStringBuffer aBuffer(64000);
+
+ sal_Int32 nRead = 0;
+ while ((nRead = xStream->readBytes(buffer, BUF_LEN)) == BUF_LEN)
+ aBuffer.append(reinterpret_cast<const char*>(buffer.getConstArray()), nRead);
+
+ if (nRead > 0)
+ aBuffer.append(reinterpret_cast<const char*>(buffer.getConstArray()), nRead);
+
+ xStream->closeInput();
+
+ aResult = OStringToOUString(aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
+ bHasResult = true;
+
+ // Something happened...
+ if (HasListeners())
+ {
+ Broadcast(ScHint(SC_HINT_DATACHANGED, ScAddress()));
+ pDoc->TrackFormulas(); // must happen immediately
+ pDoc->StartTrackTimer();
+ }
+
+ return SUCCESS;
+}
+
+void ScWebServiceLink::ListenersGone()
+{
+ ScDocument* pStackDoc = pDoc; // member pDoc can't be used after removing the link
+
+ sfx2::LinkManager* pLinkMgr = pDoc->GetLinkManager();
+ pLinkMgr->Remove(this); // deletes this
+
+ if (pLinkMgr->GetLinks().empty()) // deleted the last one ?
+ {
+ SfxBindings* pBindings = pStackDoc->GetViewBindings(); // don't use member pDoc!
+ if (pBindings)
+ pBindings->Invalidate(SID_LINKS);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
{
pCell = new ScFormulaCell(&rDoc.getDoc(), aScPos, *pResult);
pCell->GetCode()->WrapReference(aScPos, EXC_MAXCOL8, EXC_MAXROW8);
+ rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode());
rDoc.getDoc().EnsureTable(aScPos.Tab());
rDoc.setFormulaCell(aScPos, pCell);
SetLastFormula(aScPos.Col(), aScPos.Row(), fCurVal, nXF, pCell);
<< nMerk0 << ocClose;
aPool >> aStack;
pExtName->CreateDdeData( GetDoc(), aApplic, aTopic );
+ GetDoc().SetLinkFormulaNeedingCheck(true);
}
}
break;
ScFormulaCell* pCell = new ScFormulaCell(pD, aPos, *pErgebnis);
pCell->GetCode()->WrapReference(aPos, EXC_MAXCOL8, EXC_MAXROW8);
+ rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode());
rDoc.getDoc().EnsureTable(aPos.Tab());
rDoc.setFormulaCell(aPos, pCell);
pCell->SetNeedNumberFormat(false);
rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_CondFormat );
// formula converter owns pTokArr -> create a copy of the token array
if( pTokArr )
+ {
xTokArr1.reset( pTokArr->Clone() );
+ GetDocRef().CheckLinkFormulaNeedingCheck( *xTokArr1);
+ }
}
::std::unique_ptr< ScTokenArray > pTokArr2;
rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_CondFormat );
// formula converter owns pTokArr -> create a copy of the token array
if( pTokArr )
+ {
pTokArr2.reset( pTokArr->Clone() );
+ GetDocRef().CheckLinkFormulaNeedingCheck( *pTokArr2);
+ }
}
// *** create the Calc conditional formatting ***
}
}
if (pData)
+ {
+ GetDoc().CheckLinkFormulaNeedingCheck( *pData->GetCode());
mpScData = pData; // cache for later use
+ }
}
XclImpNameManager::XclImpNameManager( const XclImpRoot& rRoot ) :
{
pTokenArray2.reset(new ScTokenArray());
ScTokenConversion::ConvertToTokenArray( rDoc, *pTokenArray2.get(), maModel.maFormulas[ 1 ] );
+ rDoc.CheckLinkFormulaNeedingCheck( *pTokenArray2.get());
}
ScTokenArray aTokenArray;
OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, maModel.maFormulas[ 0 ] );
+ rDoc.CheckLinkFormulaNeedingCheck( aTokenArray);
ScCondFormatEntry* pNewEntry = new ScCondFormatEntry(eOperator,
&aTokenArray, pTokenArray2.get(), &rDoc, aPos, aStyleName);
mpFormat->AddEntry(pNewEntry);
#include "tokenarray.hxx"
#include "tokenuno.hxx"
#include "compiler.hxx"
+#include "document.hxx"
namespace oox {
namespace xls {
// after, a resulting error must be reset.
sal_uInt16 nErr = pArray->GetCodeError();
aCompiler.CompileTokenArray();
+ getScDocument().CheckLinkFormulaNeedingCheck( *pArray);
pArray->DelRPN();
pArray->SetCodeError(nErr);
continue;
aCompiler.CompileTokenArray(); // Generate RPN tokens.
+
+ // Check if ocDde/ocWebservice is in any formula for external links warning.
+ rDoc.getDoc().CheckLinkFormulaNeedingCheck(*pCode);
+
ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, pCode);
rDoc.setFormulaCell(aPos, pCell);
rCache.store(aPos, pCell);
ReloadTabLinks();
aDocument.UpdateExternalRefLinks(GetActiveDialogParent());
- bool bAnyDde = aDocument.GetDocLinkManager().updateDdeOrOleLinks(GetActiveDialogParent());
+ bool bAnyDde = aDocument.GetDocLinkManager().updateDdeOrOleOrWebServiceLinks(GetActiveDialogParent());
if (bAnyDde)
{
rEmbeddedObjectContainer.setUserAllowsLinkUpdate(false);
rReq.Ignore();
}
+
+ rDoc.SetLinkFormulaNeedingCheck(false);
}
break;
#include <documentlinkmgr.hxx>
#include <datastream.hxx>
#include <ddelink.hxx>
+#include <webservicelink.hxx>
#include <sc.hrc>
#include <scresid.hxx>
bool DocumentLinkManager::hasDdeLinks() const
{
- return hasDdeOrOleLinks(true, false);
+ return hasDdeOrOleOrWebServiceLinks(true, false, false);
}
-bool DocumentLinkManager::hasDdeOrOleLinks() const
+bool DocumentLinkManager::hasDdeOrOleOrWebServiceLinks() const
{
- return hasDdeOrOleLinks(true, true);
+ return hasDdeOrOleOrWebServiceLinks(true, true, true);
}
-bool DocumentLinkManager::hasDdeOrOleLinks(bool bDde, bool bOle) const
+bool DocumentLinkManager::hasDdeOrOleOrWebServiceLinks(bool bDde, bool bOle, bool bWebService) const
{
if (!mpImpl->mpLinkManager)
return false;
return true;
if (bOle && dynamic_cast<SdrEmbedObjectLink*>(pBase))
return true;
+ if (bWebService && dynamic_cast<ScWebServiceLink*>(pBase))
+ return true;
}
return false;
}
-bool DocumentLinkManager::updateDdeOrOleLinks( vcl::Window* pWin )
+bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(vcl::Window* pWin)
{
if (!mpImpl->mpLinkManager)
return false;
continue;
}
+ ScWebServiceLink* pWebserviceLink = dynamic_cast<ScWebServiceLink*>(pBase);
+ if (pWebserviceLink)
+ {
+ pWebserviceLink->Update();
+ continue;
+ }
+
ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>(pBase);
if (!pDdeLink)
continue;
ScDocument* ScTempDocSource::CreateDocument()
{
- ScDocument* pDoc = new ScDocument; // SCDOCMODE_DOCUMENT
+ ScDocument* pDoc = new ScDocument( SCDOCMODE_FUNCTIONACCESS );
pDoc->MakeTable( 0 );
return pDoc;
}
if (!bLink)
{
const sc::DocumentLinkManager& rMgr = rDoc.GetDocLinkManager();
- if (rMgr.hasDdeOrOleLinks() || rDoc.HasAreaLinks())
+ if (rDoc.HasLinkFormulaNeedingCheck() || rDoc.HasAreaLinks() || rMgr.hasDdeOrOleOrWebServiceLinks())
bLink = true;
}
if (bLink)