summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-08 17:40:32 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-08 19:25:38 -0400
commitd64b5cc1c3d232ba42479fe0a3c186ecabd25144 (patch)
treeb97a85cc801efe431d49caad3459271155fecb9c /sc
parent11637831312a7a92af9c0148aa6b1e30db4b55b2 (diff)
fdo#62116: Be sure to convert relative URLs into absolute ones.
Just to preserve the old (and correct) behavior. Change-Id: I229e0b80097f6d70ff3023072b52576815010b15
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/ods/rich-text-cells.odsbin17572 -> 18264 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx10
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx3
3 files changed, 12 insertions, 1 deletions
diff --git a/sc/qa/unit/data/ods/rich-text-cells.ods b/sc/qa/unit/data/ods/rich-text-cells.ods
index a869b0be873a..da3a1edcada3 100644
--- a/sc/qa/unit/data/ods/rich-text-cells.ods
+++ b/sc/qa/unit/data/ods/rich-text-cells.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index ff09d2759fe1..d89d95d9de64 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -48,6 +48,7 @@
#include <editeng/brushitem.hxx>
#include <editeng/justifyitem.hxx>
#include <editeng/borderline.hxx>
+#include "editeng/flditem.hxx"
#include <dbdata.hxx>
#include "validat.hxx"
#include "formulacell.hxx"
@@ -1757,6 +1758,15 @@ void ScFiltersTest::testRichTextContentODS()
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
CPPUNIT_ASSERT_MESSAGE("Date field item not found.", pEditText->HasField(text::textfield::Type::DOCINFO_TITLE));
+ // URL for a file in the same directory. It should be converted into an absolute URL on import.
+ aPos.IncRow();
+ pEditText = pDoc->GetEditText(aPos);
+ CPPUNIT_ASSERT_MESSAGE("Failed to retrieve edit text object.", pEditText);
+ const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL);
+ CPPUNIT_ASSERT_MESSAGE("Failed to get the URL data.", pData && pData->GetClassId() == text::textfield::Type::URL);
+ const SvxURLField* pURLData = static_cast<const SvxURLField*>(pData);
+ CPPUNIT_ASSERT_MESSAGE("URL is not absolute with respect to the file system.", pURLData->GetURL().startsWith("file:///"));
+
xDocSh->DoClose();
}
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 5f4acb9bc8fb..b97a2458cc6c 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -598,7 +598,8 @@ void ScXMLTableRowCellContext::PushParagraphFieldDocTitle(const OUString& rStyle
void ScXMLTableRowCellContext::PushParagraphFieldURL(
const OUString& rURL, const OUString& rRep, const OUString& rStyleName)
{
- PushParagraphField(new SvxURLField(rURL, rRep, SVXURLFORMAT_REPR), rStyleName);
+ OUString aAbsURL = GetScImport().GetAbsoluteReference(rURL);
+ PushParagraphField(new SvxURLField(aAbsURL, rRep, SVXURLFORMAT_REPR), rStyleName);
}
void ScXMLTableRowCellContext::PushParagraphEnd()