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:22:11 +0000
commit0d60b0dc1208b01b659fd1af4b33d1a7f6ee737d (patch)
tree2a9c66a14d062ac2045628968835d35a4030a012
parentab80caf6359ac1bcf95b113b6c3b543dee0ed105 (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/29482 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-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 f55e570aec17..e086951bb4bd 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -629,10 +629,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 56090ca95bcf..d72bc2055913 100644
--- a/sc/source/filter/xml/xmlcelli.hxx
+++ b/sc/source/filter/xml/xmlcelli.hxx
@@ -143,7 +143,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 25eb6032f75b..aa8ec4a5f99e 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2951,9 +2951,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 f62f350a69ee..3b0a675296ea 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1893,6 +1893,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 882f1f0edfb6..6fc09d1bbae0 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -739,6 +739,7 @@ enum ScXMLCellTextURLAttrTokens
{
XML_TOK_CELL_TEXT_URL_ATTR_UREF,
XML_TOK_CELL_TEXT_URL_ATTR_TYPE,
+ XML_TOK_CELL_TEXT_URL_TARGET_FRAME
};
/**