summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-12-16 09:06:53 +0100
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-12-16 12:44:41 +0100
commitf81a81ae97964ab586fda3ab15e000bf5f3cc84f (patch)
tree2f31b4b7e7475ed349d6f62a49483ef4c9c37ed7
parent94d90f0c1a733e995f8677df58b1c4a4c5e3315b (diff)
tdf#164299 fix crash in pasting HTML table
Supports <colgroup> element now. Change-Id: I4fe49f3c79c567e9364a1642e716846256c6070b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178536 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> (cherry picked from commit 728f5eb01de33bd1f16f25d9bd7cdef6fa0909de) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178568 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: allotropia jenkins <jenkins@allotropia.de>
-rw-r--r--svx/source/table/tablehtmlimporter.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/svx/source/table/tablehtmlimporter.cxx b/svx/source/table/tablehtmlimporter.cxx
index c2384466bb8b..d63d8ffe5640 100644
--- a/svx/source/table/tablehtmlimporter.cxx
+++ b/svx/source/table/tablehtmlimporter.cxx
@@ -423,6 +423,16 @@ static sal_Int32 lcl_GetWidth(const HTMLOptions& options)
}
return 1000;
}
+static sal_Int32 lcl_GetSpan(const HTMLOptions& options)
+{
+ for (HTMLOptions::const_iterator optionIt = options.begin(); optionIt != options.end();
+ ++optionIt)
+ {
+ if (optionIt->GetToken() == HtmlOptionId::SPAN)
+ return optionIt->GetNumber();
+ }
+ return 1;
+}
void SdrTableHTMLParser::ProcToken(HtmlImportInfo* pInfo)
{
HTMLParser* pHtmlParser = static_cast<HTMLParser*>(pInfo->pParser);
@@ -493,6 +503,23 @@ void SdrTableHTMLParser::ProcToken(HtmlImportInfo* pInfo)
break;
case HtmlTokenId::COL_OFF:
break;
+ case HtmlTokenId::COLGROUP_ON:
+ {
+ const sal_Int32 nSpan = lcl_GetSpan(options);
+ for (sal_Int32 nCol = 0; nCol < nSpan; ++nCol)
+ {
+ std::shared_ptr<HTMLCellDefault> pDefault(mpInsDefault.release());
+ maDefaultList.push_back(pDefault);
+ const sal_Int32 nSize = lcl_GetWidth(options) + mnLastEdge;
+ if (nSize > mnLastEdge)
+ InsertColumnEdge(nSize);
+ mnLastEdge = nSize;
+ mpInsDefault.reset(new HTMLCellDefault());
+ }
+ }
+ break;
+ case HtmlTokenId::COLGROUP_OFF:
+ break;
default:
break;