[Libreoffice-commits] .: 2 commits - sc/inc sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed May 25 12:53:04 PDT 2011
sc/inc/arealink.hxx | 4 +--
sc/inc/document.hxx | 6 ++---
sc/inc/externalrefmgr.hxx | 3 +-
sc/inc/sc.hrc | 4 ++-
sc/inc/tablink.hxx | 4 +--
sc/source/core/data/documen8.cxx | 33 ++++++++++++++++++++++++-------
sc/source/core/inc/ddelink.hxx | 4 +--
sc/source/core/tool/ddelink.cxx | 8 ++++---
sc/source/ui/docshell/arealink.cxx | 8 ++++---
sc/source/ui/docshell/docsh4.cxx | 2 -
sc/source/ui/docshell/externalrefmgr.cxx | 10 +++++----
sc/source/ui/docshell/tablink.cxx | 5 ++--
sc/source/ui/src/scstring.src | 5 ++++
13 files changed, 65 insertions(+), 31 deletions(-)
New commits:
commit 9c097de3cc321b78c3d7b02739603fcc44b44415
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed May 25 15:33:36 2011 -0400
Launch error message in case the external doc could not be reached.
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index a7f4452..19eaf1e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -636,9 +636,9 @@ public:
on first call. */
ScFormulaParserPool& GetFormulaParserPool() const;
- sal_Bool HasDdeLinks() const;
- sal_Bool HasAreaLinks() const;
- void UpdateExternalRefLinks();
+ bool HasDdeLinks() const;
+ bool HasAreaLinks() const;
+ void UpdateExternalRefLinks(Window* pWin);
void UpdateDdeLinks();
void UpdateAreaLinks();
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index ffaa64c..ac00c69 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1014,8 +1014,10 @@
#define SCSTR_SET_TAB_BG_COLOR (STR_START + 403)
#define SCSTR_NO_TAB_BG_COLOR (STR_START + 404)
+#define SCSTR_EXTDOC_NOT_LOADED (STR_START + 405)
-#define STR_END (SCSTR_NO_TAB_BG_COLOR)
+
+#define STR_END (SCSTR_EXTDOC_NOT_LOADED)
#define BMP_START (STR_END)
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 7820315..de0cd98 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -35,6 +35,7 @@
#include <editeng/eeitem.hxx>
#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
#include <editeng/editobj.hxx>
#include <editeng/editstat.hxx>
#include <editeng/frmdiritem.hxx>
@@ -97,6 +98,7 @@
#include "macromgr.hxx"
#include "dpobject.hxx"
#include "docuno.hxx"
+#include "scresid.hxx"
#define GET_SCALEVALUE(set,id) ((const SfxUInt16Item&)(set.Get( id ))).GetValue()
@@ -985,7 +987,7 @@ void ScDocument::LoadDdeLinks(SvStream& rStream)
}
}
-sal_Bool ScDocument::HasDdeLinks() const
+bool ScDocument::HasDdeLinks() const
{
if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager
{
@@ -993,7 +995,7 @@ sal_Bool ScDocument::HasDdeLinks() const
sal_uInt16 nCount = rLinks.Count();
for (sal_uInt16 i=0; i<nCount; i++)
if ((*rLinks[i])->ISA(ScDdeLink))
- return sal_True;
+ return true;
}
return false;
@@ -1012,7 +1014,7 @@ sal_Bool ScDocument::IsInLinkUpdate() const
return bInLinkUpdate || IsInDdeLinkUpdate();
}
-void ScDocument::UpdateExternalRefLinks()
+void ScDocument::UpdateExternalRefLinks(Window* pWin)
{
if (!GetLinkManager())
return;
@@ -1027,8 +1029,25 @@ void ScDocument::UpdateExternalRefLinks()
ScExternalRefLink* pRefLink = dynamic_cast<ScExternalRefLink*>(pBase);
if (pRefLink)
{
- pRefLink->Update();
- bAny = true;
+ if (pRefLink->Update())
+ bAny = true;
+ else
+ {
+ // Update failed. Notify the user.
+
+ String aFile;
+ pLinkManager->GetDisplayNames(pRefLink, NULL, &aFile, NULL, NULL);
+ // Decode encoded URL for display friendliness.
+ INetURLObject aUrl(aFile,INetURLObject::WAS_ENCODED);
+ aFile = aUrl.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS);
+
+ rtl::OUStringBuffer aBuf;
+ aBuf.append(String(ScResId(SCSTR_EXTDOC_NOT_LOADED)));
+ aBuf.appendAscii("\n\n");
+ aBuf.append(aFile);
+ ErrorBox aBox(pWin, WB_OK, aBuf.makeStringAndClear());
+ aBox.Execute();
+ }
}
}
if (bAny)
@@ -1315,7 +1334,7 @@ bool ScDocument::SetDdeLinkResultMatrix( sal_uInt16 nDdePos, ScMatrixRef pResult
//------------------------------------------------------------------------
-sal_Bool ScDocument::HasAreaLinks() const
+bool ScDocument::HasAreaLinks() const
{
if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager
{
@@ -1323,7 +1342,7 @@ sal_Bool ScDocument::HasAreaLinks() const
sal_uInt16 nCount = rLinks.Count();
for (sal_uInt16 i=0; i<nCount; i++)
if ((*rLinks[i])->ISA(ScAreaLink))
- return sal_True;
+ return true;
}
return false;
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 36e0e8e..bd8b15a 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -492,7 +492,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
if (nDlgRet == RET_YES || nSet==LM_ALWAYS)
{
ReloadTabLinks();
- aDocument.UpdateExternalRefLinks();
+ aDocument.UpdateExternalRefLinks(GetActiveDialogParent());
aDocument.UpdateDdeLinks();
aDocument.UpdateAreaLinks();
diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src
index 170939e..42582f7 100644
--- a/sc/source/ui/src/scstring.src
+++ b/sc/source/ui/src/scstring.src
@@ -854,3 +854,8 @@ String SCSTR_WARN_ME_IN_FUTURE_CHECK
{
Text [ en-US ] = "Warn me about this in the future.";
};
+
+String SCSTR_EXTDOC_NOT_LOADED
+{
+ Text [ en-US ] = "The following external file could not be loaded. Data linked from this file did not get updated." ;
+};
commit 39d8552e8ebc4cfec392d3b1d1b740f15647af51
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed May 25 15:24:51 2011 -0400
Adjusted for signature change in DataChanged().
diff --git a/sc/inc/arealink.hxx b/sc/inc/arealink.hxx
index 80ecc70..0f3424e 100644
--- a/sc/inc/arealink.hxx
+++ b/sc/inc/arealink.hxx
@@ -62,8 +62,8 @@ public:
virtual ~ScAreaLink();
virtual void Closed();
- virtual void DataChanged( const String& rMimeType,
- const ::com::sun::star::uno::Any & rValue );
+ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+ const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
virtual void Edit( Window*, const Link& rEndEditHdl );
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 13cbeae..aa6f5cb 100644
--- a/sc/inc/externalrefmgr.hxx
+++ b/sc/inc/externalrefmgr.hxx
@@ -70,7 +70,8 @@ public:
virtual ~ScExternalRefLink();
virtual void Closed();
- virtual void DataChanged(const String& rMimeType, const ::com::sun::star::uno::Any & rValue);
+ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+ const String& rMimeType, const ::com::sun::star::uno::Any & rValue);
virtual void Edit(Window* pParent, const Link& rEndEditHdl);
void SetDoReferesh(bool b);
diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx
index 402675e..ad22d97 100644
--- a/sc/inc/tablink.hxx
+++ b/sc/inc/tablink.hxx
@@ -58,8 +58,8 @@ public:
const String& rFilter, const String& rOpt, sal_uLong nRefresh );
virtual ~ScTableLink();
virtual void Closed();
- virtual void DataChanged( const String& rMimeType,
- const ::com::sun::star::uno::Any & rValue );
+ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+ const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
virtual void Edit( Window*, const Link& rEndEditHdl );
diff --git a/sc/source/core/inc/ddelink.hxx b/sc/source/core/inc/ddelink.hxx
index 2b3bf4b..863d9b8 100644
--- a/sc/source/core/inc/ddelink.hxx
+++ b/sc/source/core/inc/ddelink.hxx
@@ -68,8 +68,8 @@ public:
void Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
// von SvBaseLink ueberladen:
- virtual void DataChanged( const String& rMimeType,
- const ::com::sun::star::uno::Any & rValue );
+ virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
+ const String& rMimeType, const ::com::sun::star::uno::Any & rValue );
// von SvtBroadcaster ueberladen:
virtual void ListenersGone();
diff --git a/sc/source/core/tool/ddelink.cxx b/sc/source/core/tool/ddelink.cxx
index f4b1f5d..1eae9af 100644
--- a/sc/source/core/tool/ddelink.cxx
+++ b/sc/source/core/tool/ddelink.cxx
@@ -132,12 +132,12 @@ void ScDdeLink::Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const
rHdr.EndEntry();
}
-void ScDdeLink::DataChanged( const String& rMimeType,
- const ::com::sun::star::uno::Any & rValue )
+sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
+ const String& rMimeType, const ::com::sun::star::uno::Any & rValue )
{
// wir koennen nur Strings...
if ( FORMAT_STRING != SotExchange::GetFormatIdFromMimeType( rMimeType ))
- return;
+ return SUCCESS;
String aLinkStr;
ScByteSequenceToString::GetString( aLinkStr, rValue, DDE_TXT_ENCODING );
@@ -225,6 +225,8 @@ void ScDdeLink::DataChanged( const String& rMimeType,
aHint.SetDdeLink( aAppl, aTopic, aItem, nMode );
pDoc->BroadcastUno( aHint );
}
+
+ return SUCCESS;
}
void ScDdeLink::ResetValue()
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index e9e97bd..bb216b6 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -118,14 +118,14 @@ void ScAreaLink::Edit(Window* pParent, const Link& /* rEndEditHdl */ )
pDlg->StartExecuteModal( LINK( this, ScAreaLink, AreaEndEditHdl ) );
}
-void ScAreaLink::DataChanged( const String&,
- const ::com::sun::star::uno::Any& )
+::sfx2::SvBaseLink::UpdateResult ScAreaLink::DataChanged(
+ const String&, const ::com::sun::star::uno::Any& )
{
// bei bInCreate nichts tun, damit Update gerufen werden kann, um den Status im
// LinkManager zu setzen, ohne die Daten im Dokument zu aendern
if (bInCreate)
- return;
+ return SUCCESS;
sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
if (pLinkManager!=NULL)
@@ -152,6 +152,8 @@ void ScAreaLink::DataChanged( const String&,
Refresh( aFile, aFilter, aArea, GetRefreshDelay() );
}
+
+ return SUCCESS;
}
void ScAreaLink::Closed()
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 6d39d73..b503897 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1264,21 +1264,21 @@ void ScExternalRefLink::Closed()
pMgr->breakLink(mnFileId);
}
-void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rValue*/)
+::sfx2::SvBaseLink::UpdateResult ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rValue*/)
{
if (!mbDoRefresh)
- return;
+ return SUCCESS;
String aFile, aFilter;
mpDoc->GetLinkManager()->GetDisplayNames(this, NULL, &aFile, NULL, &aFilter);
ScExternalRefManager* pMgr = mpDoc->GetExternalRefManager();
if (!pMgr->isFileLoadable(aFile))
- return;
+ return ERROR_GENERAL;
const String* pCurFile = pMgr->getExternalFileName(mnFileId);
if (!pCurFile)
- return;
+ return ERROR_GENERAL;
if (pCurFile->Equals(aFile))
{
@@ -1294,6 +1294,8 @@ void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rV
maFilterName = aFilter;
aMod.SetDocumentModified();
}
+
+ return SUCCESS;
}
void ScExternalRefLink::Edit(Window* pParent, const Link& /*rEndEditHdl*/)
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 457fa20..ef12a6c 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -141,8 +141,8 @@ void ScTableLink::Edit( Window* pParent, const Link& rEndEditHdl )
SvBaseLink::Edit( pParent, LINK( this, ScTableLink, TableEndEditHdl ) );
}
-void ScTableLink::DataChanged( const String&,
- const ::com::sun::star::uno::Any& )
+::sfx2::SvBaseLink::UpdateResult ScTableLink::DataChanged(
+ const String&, const ::com::sun::star::uno::Any& )
{
sfx2::LinkManager* pLinkManager=pImpl->m_pDocSh->GetDocument()->GetLinkManager();
if (pLinkManager!=NULL)
@@ -158,6 +158,7 @@ void ScTableLink::DataChanged( const String&,
if (!bInCreate)
Refresh( aFile, aFilter, NULL, GetRefreshDelay() ); // don't load twice
}
+ return SUCCESS;
}
void ScTableLink::Closed()
More information about the Libreoffice-commits
mailing list