sw content controls, DOCX export: handle SDT end at para end
Once the DOCX import maps Run SDTs to SwContentControl, make -C sw -sr CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testTdf148361 starts to fail without this fix. Previously we only tested SwContentControl end in the middle of a paragraph. Fix the paragraph end case similar to how hyperlinks are handled to be consistent. Change-Id: I0633ca8d7d909a2cb3c70e7edce3a85df5fac3f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132944 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -367,7 +367,10 @@ void DocxAttributeOutput::StartContentControl(const SwFormatContentControl& rFor
|
||||
m_pContentControl = rFormatContentControl.GetContentControl();
|
||||
}
|
||||
|
||||
void DocxAttributeOutput::EndContentControl() { ++m_nCloseContentControl; }
|
||||
void DocxAttributeOutput::EndContentControl()
|
||||
{
|
||||
++m_nCloseContentControlInThisRun;
|
||||
}
|
||||
|
||||
static void checkAndWriteFloatingTables(DocxAttributeOutput& rDocxAttributeOutput)
|
||||
{
|
||||
@@ -1628,8 +1631,9 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool /
|
||||
m_bEndCharSdt = false;
|
||||
}
|
||||
|
||||
for (; m_nCloseContentControl > 0; --m_nCloseContentControl)
|
||||
for (; m_nCloseContentControlInPreviousRun > 0; --m_nCloseContentControlInPreviousRun)
|
||||
{
|
||||
// Not the last run of this paragraph.
|
||||
m_pSerializer->endElementNS(XML_w, XML_sdtContent);
|
||||
m_pSerializer->endElementNS(XML_w, XML_sdt);
|
||||
}
|
||||
@@ -1854,6 +1858,13 @@ void DocxAttributeOutput::EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool /
|
||||
m_pRedlineData = nullptr;
|
||||
}
|
||||
|
||||
for (; m_nCloseContentControlInThisRun > 0; --m_nCloseContentControlInThisRun)
|
||||
{
|
||||
// Last run of this paragraph.
|
||||
m_pSerializer->endElementNS(XML_w, XML_sdtContent);
|
||||
m_pSerializer->endElementNS(XML_w, XML_sdt);
|
||||
}
|
||||
|
||||
if ( m_closeHyperlinkInThisRun )
|
||||
{
|
||||
if ( m_startedHyperlink )
|
||||
@@ -3259,6 +3270,10 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh
|
||||
{
|
||||
m_closeHyperlinkInPreviousRun = true;
|
||||
}
|
||||
if (m_nCloseContentControlInThisRun > 0)
|
||||
{
|
||||
++m_nCloseContentControlInPreviousRun;
|
||||
}
|
||||
m_bRunTextIsOn = true;
|
||||
// one text can be split into more <w:t>blah</w:t>'s by line breaks etc.
|
||||
const sal_Unicode *pBegin = rText.getStr();
|
||||
|
@@ -911,7 +911,8 @@ private:
|
||||
o3tl::sorted_vector<const SwFrameFormat*> m_aFloatingTablesOfParagraph;
|
||||
sal_Int32 m_nTextFrameLevel;
|
||||
|
||||
sal_Int32 m_nCloseContentControl = 0;
|
||||
sal_Int32 m_nCloseContentControlInThisRun = 0;
|
||||
sal_Int32 m_nCloseContentControlInPreviousRun = 0;
|
||||
|
||||
// close of hyperlink needed
|
||||
bool m_closeHyperlinkInThisRun;
|
||||
|
Reference in New Issue
Block a user