summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2025-01-04 11:44:39 +0100
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2025-01-06 11:10:38 +0100
commit7112bc2a98b06217302fb18e52fcbd03f8744f79 (patch)
treed97e21c45ad91687b216ff8d16cc4c318f329bbb /sc
parenta48561a28741436b03006f100b947403e4cddfc9 (diff)
tdf#132770 - FORMATTING: Import inserted text tag <ins> (underlined)
Change-Id: I5819ce4d4551bbd781921d847131f15cf2b94a38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179771 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/filter/html/data/tdf132770_inserted_text.html1
-rw-r--r--sc/qa/filter/html/html.cxx24
-rw-r--r--sc/source/filter/html/htmlpars.cxx2
3 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/filter/html/data/tdf132770_inserted_text.html b/sc/qa/filter/html/data/tdf132770_inserted_text.html
new file mode 100644
index 000000000000..d07966ffef47
--- /dev/null
+++ b/sc/qa/filter/html/data/tdf132770_inserted_text.html
@@ -0,0 +1 @@
+<p><ins>ins</ins></p> \ No newline at end of file
diff --git a/sc/qa/filter/html/html.cxx b/sc/qa/filter/html/html.cxx
index 2f6b9cb249b8..2c1d02aab0b5 100644
--- a/sc/qa/filter/html/html.cxx
+++ b/sc/qa/filter/html/html.cxx
@@ -14,6 +14,7 @@
#include <com/sun/star/table/XCellRange.hpp>
#include <editeng/crossedoutitem.hxx>
+#include <editeng/udlnitem.hxx>
#include <comphelper/propertyvalue.hxx>
#include <svl/numformat.hxx>
@@ -231,6 +232,29 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf79298_strikeout_variants)
}
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf132770_inserted_text)
+{
+ // Given a document with an inserted text tag <ins>
+ OUString aURL = createFileURL(u"tdf132770_inserted_text.html");
+
+ // When loading that document to Calc:
+ uno::Sequence<beans::PropertyValue> aParams = {
+ comphelper::makePropertyValue(u"DocumentService"_ustr,
+ u"com.sun.star.sheet.SpreadsheetDocument"_ustr),
+ };
+ loadWithParams(aURL, aParams);
+
+ // Verify HTML inserted text tag <ins>
+ ScDocument* pDoc = getScDoc();
+ const ScPatternAttr* pAttr = pDoc->GetPattern(ScAddress(0, 0, 0));
+ CPPUNIT_ASSERT_MESSAGE("Failed to get cell attribute.", pAttr);
+ const SvxUnderlineItem& rUnderlineItem = pAttr->GetItem(ATTR_FONT_UNDERLINE);
+ // Without the accompanying fix in place, this tests would have failed with:
+ // - Expected: 1 (FontLineStyle::LINESTYLE_SINGLE)
+ // - Actual : 0 (FontLineStyle::NONE)
+ CPPUNIT_ASSERT_EQUAL(FontLineStyle::LINESTYLE_SINGLE, rUnderlineItem.GetLineStyle());
+}
+
CPPUNIT_TEST_FIXTURE(Test, testCopyText)
{
// Given a document with 01 in A1:
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 6c225c3020c8..a4e0f7069a1f 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1804,6 +1804,7 @@ void ScHTMLLayoutParser::ProcToken( HtmlImportInfo* pInfo )
}
break;
case HtmlTokenId::UNDERLINE_ON :
+ case HtmlTokenId::INSERTEDTEXT_ON:
{
if ( IsAtBeginningOfText( pInfo ) )
mxActEntry->aItemSet.Put( SvxUnderlineItem( LINESTYLE_SINGLE,
@@ -3099,6 +3100,7 @@ void ScHTMLQueryParser::ProcessToken( const HtmlImportInfo& rInfo )
break;
case HtmlTokenId::UNDERLINE_ON: // <u>
+ case HtmlTokenId::INSERTEDTEXT_ON: // <ins>
mpCurrTable->PutItem( SvxUnderlineItem( LINESTYLE_SINGLE, ATTR_FONT_UNDERLINE ) );
break;
default: break;