summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-10-02 18:27:32 +0200
committerEike Rathke <erack@redhat.com>2016-10-04 15:23:28 +0000
commit7f3fac39496db4fefc088a8c57781baae92da388 (patch)
treeda9a3c164a8a1a18077e9551323a2164edec1490
parent59a4486bb8519fbd54da0a924b7a5f9b712b3bf2 (diff)
support TargetFrame in url field import/export code, tdf#77873
Change-Id: Id09ecbd10b8ee60371f223d62f2dd6fe1c2296ca Reviewed-on: https://gerrit.libreoffice.org/29459 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit b11ad787372c4b833cc58a3738e375af26309b8d) Reviewed-on: https://gerrit.libreoffice.org/29463 Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/filter/xml/celltextparacontext.cxx9
-rw-r--r--sc/source/filter/xml/celltextparacontext.hxx3
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx6
-rw-r--r--sc/source/filter/xml/xmlcelli.hxx2
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx6
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx1
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx1
7 files changed, 20 insertions, 8 deletions
diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx
index 3f6c64b53a18..dc89e141fbf4 100644
--- a/sc/source/filter/xml/celltextparacontext.cxx
+++ b/sc/source/filter/xml/celltextparacontext.cxx
@@ -94,9 +94,9 @@ void ScXMLCellTextParaContext::PushFieldTitle(const OUString& rStyleName)
}
void ScXMLCellTextParaContext::PushFieldURL(
- const OUString& rURL, const OUString& rRep, const OUString& rStyleName)
+ const OUString& rURL, const OUString& rRep, const OUString& rStyleName, const OUString& rTargetFrame)
{
- mrParentCxt.PushParagraphFieldURL(rURL, rRep, rStyleName);
+ mrParentCxt.PushParagraphFieldURL(rURL, rRep, rStyleName, rTargetFrame);
}
ScXMLCellTextSpanContext::ScXMLCellTextSpanContext(
@@ -325,6 +325,9 @@ void ScXMLCellFieldURLContext::StartElement(const uno::Reference<xml::sax::XAttr
case XML_TOK_CELL_TEXT_URL_ATTR_TYPE:
// Ignored for now.
break;
+ case XML_TOK_CELL_TEXT_URL_TARGET_FRAME:
+ maTargetFrame = rAttrValue;
+ break;
default:
;
}
@@ -333,7 +336,7 @@ void ScXMLCellFieldURLContext::StartElement(const uno::Reference<xml::sax::XAttr
void ScXMLCellFieldURLContext::EndElement()
{
- mrParentCxt.PushFieldURL(maURL, maRep, maStyleName);
+ mrParentCxt.PushFieldURL(maURL, maRep, maStyleName, maTargetFrame);
}
void ScXMLCellFieldURLContext::Characters(const OUString& rChars)
diff --git a/sc/source/filter/xml/celltextparacontext.hxx b/sc/source/filter/xml/celltextparacontext.hxx
index 65487b8fb6b8..f6b8e2c2060e 100644
--- a/sc/source/filter/xml/celltextparacontext.hxx
+++ b/sc/source/filter/xml/celltextparacontext.hxx
@@ -35,7 +35,7 @@ public:
void PushFieldSheetName(const OUString& rStyleName);
void PushFieldDate(const OUString& rStyleName);
void PushFieldTitle(const OUString& rStyleName);
- void PushFieldURL(const OUString& rURL, const OUString& rRep, const OUString& rStyleName);
+ void PushFieldURL(const OUString& rURL, const OUString& rRep, const OUString& rStyleName, const OUString& rTargetFrame);
};
/**
@@ -122,6 +122,7 @@ class ScXMLCellFieldURLContext : public ScXMLImportContext
OUString maStyleName;
OUString maURL;
OUString maRep;
+ OUString maTargetFrame;
public:
ScXMLCellFieldURLContext(ScXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLName, ScXMLCellTextParaContext& rParent);
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 47c1a84296d9..5c8a4f1e9b50 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -630,10 +630,12 @@ void ScXMLTableRowCellContext::PushParagraphFieldDocTitle(const OUString& rStyle
}
void ScXMLTableRowCellContext::PushParagraphFieldURL(
- const OUString& rURL, const OUString& rRep, const OUString& rStyleName)
+ const OUString& rURL, const OUString& rRep, const OUString& rStyleName, const OUString& rTargetFrame)
{
OUString aAbsURL = GetScImport().GetAbsoluteReference(rURL);
- PushParagraphField(new SvxURLField(aAbsURL, rRep, SVXURLFORMAT_REPR), rStyleName);
+ SvxURLField* pURLField = new SvxURLField(aAbsURL, rRep, SVXURLFORMAT_REPR);
+ pURLField->SetTargetFrame(rTargetFrame);
+ PushParagraphField(pURLField, rStyleName);
}
void ScXMLTableRowCellContext::PushParagraphEnd()
diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx
index 883b3c71bb7d..42d2562ef819 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -145,7 +145,7 @@ public:
void PushParagraphFieldDate(const OUString& rStyleName);
void PushParagraphFieldSheetName(const OUString& rStyleName);
void PushParagraphFieldDocTitle(const OUString& rStyleName);
- void PushParagraphFieldURL(const OUString& rURL, const OUString& rRep, const OUString& rStyleName);
+ void PushParagraphFieldURL(const OUString& rURL, const OUString& rRep, const OUString& rStyleName, const OUString& rTargetFrame);
void PushParagraphEnd();
void SetAnnotation( const ScAddress& rPosition );
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index fbcddd547793..9d8a265c7870 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2981,9 +2981,13 @@ void writeContent(
{
// <text:a xlink:href="url" xlink:type="simple">value</text:a>
- OUString aURL = static_cast<const SvxURLField*>(pField)->GetURL();
+ const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField);
+ OUString aURL = pURLField->GetURL();
rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, rExport.GetRelativeReference(aURL));
rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, "simple");
+ OUString aTargetFrame = pURLField->GetTargetFrame();
+ if (!aTargetFrame.isEmpty())
+ rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, aTargetFrame);
OUString aElemName = rExport.GetNamespaceMap().GetQNameByKey(
XML_NAMESPACE_TEXT, GetXMLToken(XML_A));
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 524892f1ed88..a82de485c12e 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1891,6 +1891,7 @@ const SvXMLTokenMap& ScXMLImport::GetCellTextURLAttrTokenMap()
{
{ XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_CELL_TEXT_URL_ATTR_UREF },
{ XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_CELL_TEXT_URL_ATTR_TYPE },
+ { XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, XML_TOK_CELL_TEXT_URL_TARGET_FRAME },
XML_TOKEN_MAP_END
};
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 518a33da12b5..570d2f206c28 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -737,6 +737,7 @@ enum ScXMLCellTextURLAttrTokens
{
XML_TOK_CELL_TEXT_URL_ATTR_UREF,
XML_TOK_CELL_TEXT_URL_ATTR_TYPE,
+ XML_TOK_CELL_TEXT_URL_TARGET_FRAME
};
/**