summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-05-25 15:33:36 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-05-25 15:33:36 -0400
commit225520a39c881b2d6cf7fd10531eacc5cad22bc8 (patch)
tree95d736c67e455be72ec14a3d15ab7ecae6262826 /sc
parent0b83a9aff542dfb44c4a0a247cfc49dcdf40808c (diff)
Launch error message in case the external doc could not be reached.
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx6
-rw-r--r--sc/inc/sc.hrc4
-rw-r--r--sc/source/core/data/documen8.cxx33
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/src/scstring.src5
5 files changed, 38 insertions, 12 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 524280b8af95..0cf2c94a15f6 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 edf2eaeffec6..134c2d350908 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 cec0c0c45ca0..955e1c9eb3a5 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 c15b4a23eedf..5da6df7c4433 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 55620f450995..b8e9c00721be 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." ;
+};