summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-10-02 18:27:32 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-10-02 22:24:51 +0000
commitb11ad787372c4b833cc58a3738e375af26309b8d (patch)
tree1222fc70a289e6a63bd8b3aa4cd19ee6500f18ca /sc/source/filter/xml
parent5961d5a0e543d7af7c2bd269b2627c6f8d67d036 (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>
Diffstat (limited to 'sc/source/filter/xml')
-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 8c440ffdf889..1369dbccd002 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 2c545161918f..21a9f21b3bc6 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 485337398fb3..d28fea37ac85 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3007,9 +3007,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 018b56ed93cc..e972a15a0853 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1890,6 +1890,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 4f8d32b751b1..0e10678f5d70 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -720,6 +720,7 @@ enum ScXMLCellTextURLAttrTokens
{
XML_TOK_CELL_TEXT_URL_ATTR_UREF,
XML_TOK_CELL_TEXT_URL_ATTR_TYPE,
+ XML_TOK_CELL_TEXT_URL_TARGET_FRAME
};
/**