[Libreoffice-commits] core.git: sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Sun Oct 2 22:28:32 UTC 2016
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 b11ad787372c4b833cc58a3738e375af26309b8d
Author: Markus Mohrhard <markus.mohrhard at 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 <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.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 8c440ff..1369dbc 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 2c54516..21a9f21 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 4853373..d28fea3 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 018b56e..e972a15 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 4f8d32b..0e10678 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
};
/**
More information about the Libreoffice-commits
mailing list