sc/source/filter/xml/celltextparacontext.cxx | 9 ++++++--- sc/source/filter/xml/celltextparacontext.hxx | 3 ++- sc/source/filter/xml/xmlcelli.cxx | 6 ++++-- sc/source/filter/xml/xmlcelli.hxx | 2 +- sc/source/filter/xml/xmlexprt.cxx | 6 +++++- sc/source/filter/xml/xmlimprt.cxx | 1 + sc/source/filter/xml/xmlimprt.hxx | 1 + 7 files changed, 20 insertions(+), 8 deletions(-)
New commits: commit 7f3fac39496db4fefc088a8c57781baae92da388 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Sun Oct 2 18:27:32 2016 +0200 support TargetFrame in url field import/export code, tdf#77873 Change-Id: Id09ecbd10b8ee60371f223d62f2dd6fe1c2296ca Reviewed-on: https://gerrit.libreoffice.org/29459 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> (cherry picked from commit b11ad787372c4b833cc58a3738e375af26309b8d) Reviewed-on: https://gerrit.libreoffice.org/29463 Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/filter/xml/celltextparacontext.cxx b/sc/source/filter/xml/celltextparacontext.cxx index 3f6c64b..dc89e14 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 65487b8..f6b8e2c 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 47c1a84..5c8a4f1 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 883b3c7..42d2562 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 fbcddd5..9d8a265 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 524892f..a82de48 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 518a33d..570d2f2 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 }; /** _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits