[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/qa writerfilter/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 22 11:44:56 UTC 2019
sw/qa/extras/ooxmlexport/data/tdf127741.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 10 +++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 28 +++++++++++-----------
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 3 --
4 files changed, 24 insertions(+), 17 deletions(-)
New commits:
commit ccb38977541c304ff08ebe1a1b24c512ab670acf
Author: Tünde Tóth <tundeth at gmail.com>
AuthorDate: Tue Oct 8 13:58:44 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Oct 22 13:44:16 2019 +0200
tdf#127741 DOCX import: format hyperlink with Default character style
according to correct hyperlink handling, avoiding various editing
and layout problems; "sticky" and not easily removable character style
around the hyperlink and multiple blue hyperlink colors.
Set also Visited/Unvisited link character styles when the style of
the hyperlink is not the requested "Internet Link".
Change-Id: I3d7ba8dd225c693cc9f521b37767cf1e1e09d7c0
Reviewed-on: https://gerrit.libreoffice.org/80449
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-on: https://gerrit.libreoffice.org/80907
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf127741.docx b/sw/qa/extras/ooxmlexport/data/tdf127741.docx
new file mode 100644
index 000000000000..1bedb9ade516
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127741.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 9a5c10f01748..8539548fc22c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -458,6 +458,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121663, "tdf121663.docx")
assertXPath(pXmlDoc, "//w:lnNumType", "distance", "283");
}
+DECLARE_OOXMLEXPORT_TEST(testTdf127741, "tdf127741.docx")
+{
+ uno::Reference<text::XTextRange> xPara = getParagraph(1);
+ uno::Reference<beans::XPropertySet> xRun(getRun(xPara,1), uno::UNO_QUERY);
+ OUString unVisitedStyleName = getProperty<OUString>(xRun, "UnvisitedCharStyleName");
+ CPPUNIT_ASSERT(unVisitedStyleName.equalsIgnoreAsciiCase("Internet Link"));
+ OUString visitedStyleName = getProperty<OUString>(xRun, "VisitedCharStyleName");
+ CPPUNIT_ASSERT(visitedStyleName.equalsIgnoreAsciiCase("Visited Internet Link"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index d9e93f8a848b..a32991c6a4cc 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1678,15 +1678,6 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper
}
else
{
- if (IsOpenField() && GetTopFieldContext()->GetFieldId() == FIELD_HYPERLINK)
- {
- // It is content of hyperlink field. We need to create and remember
- // character style for later applying to hyperlink
- PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(GetTopContext()->GetPropertyValues());
- OUString sHyperlinkStyleName = GetStyleSheetTable()->getOrCreateCharStyle(aProps, /*bAlwaysCreate=*/false);
- GetTopFieldContext()->SetHyperlinkStyle(sHyperlinkStyleName);
- }
-
xTextRange = xTextAppend->appendTextPortion(rString, aValues);
}
}
@@ -5241,11 +5232,20 @@ void DomainMapper_Impl::PopFieldContext()
}
else
{
- if (!pContext->GetHyperlinkStyle().isEmpty())
- {
- xCrsrProperties->setPropertyValue("VisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle()));
- xCrsrProperties->setPropertyValue("UnvisitedCharStyleName", uno::makeAny(pContext->GetHyperlinkStyle()));
- }
+ uno::Any aAny = xCrsrProperties->getPropertyValue("CharStyleName");
+ OUString charStyle;
+ if (css::uno::fromAny(aAny, &charStyle))
+ {
+ if(!charStyle.isEmpty() && charStyle.equalsIgnoreAsciiCase("Internet Link"))
+ {
+ xCrsrProperties->setPropertyValue("CharStyleName", uno::makeAny(OUString("Default Style")));
+ }
+ else
+ {
+ xCrsrProperties->setPropertyValue("VisitedCharStyleName", aAny);
+ xCrsrProperties->setPropertyValue("UnvisitedCharStyleName", aAny);
+ }
+ }
}
}
else if(m_bStartGenericField)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index e5bd1efdbe85..3e8a2236da92 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -150,7 +150,6 @@ class FieldContext : public virtual SvRefBase
OUString m_sHyperlinkURL;
/// A frame for the hyperlink when one exists.
OUString m_sHyperlinkTarget;
- OUString m_sHyperlinkStyle;
FFDataHandler::Pointer_t m_pFFDataHandler;
FormControlHelper::Pointer_t m_pFormControlHelper;
@@ -195,8 +194,6 @@ public:
const OUString& GetHyperlinkURL() { return m_sHyperlinkURL; }
void SetHyperlinkTarget(const OUString& rTarget) { m_sHyperlinkTarget = rTarget; }
const OUString& GetHyperlinkTarget() { return m_sHyperlinkTarget; }
- void SetHyperlinkStyle(const OUString& rStyle) { m_sHyperlinkStyle = rStyle; }
- const OUString& GetHyperlinkStyle() { return m_sHyperlinkStyle; }
void setFFDataHandler(FFDataHandler::Pointer_t pFFDataHandler) { m_pFFDataHandler = pFFDataHandler; }
const FFDataHandler::Pointer_t& getFFDataHandler() const { return m_pFFDataHandler; }
More information about the Libreoffice-commits
mailing list