summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-01-13 11:03:17 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-01-21 16:59:44 +0100
commit31d6684c9a0e366f82b7cc92e43576f4495aaef6 (patch)
tree118b27a16399e391d2f1dee1752a1fb1574ca1c7 /sw/source/filter
parentbfc53a1d1fd99fef142ad040263a03734583e611 (diff)
tdf#135014 sw: fix crash exporting numbering to DOCX
It can happen that the default SwNumRule of a SwList isn't used by anything directly, but there are other SwNumRule associated with that SwList and then the DOCX export needs to export it as an abstract numbering definition. (regression from 632ee9aae6d5f3cf08b6d6b2789310c20db713b7) Change-Id: I6b1851980464aaa95bf731a60b7d11ab91cec7b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109303 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit cd1c9f5167e797807d6726219f06190657f58372) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109335 Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit e0be320cc790856df4d9a102d15de08aa16217fa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109336 Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/writer/writer.cxx10
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx4
3 files changed, 12 insertions, 4 deletions
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index fa56eb08f519..cd59f2f445e5 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -359,15 +359,18 @@ void Writer::PutNumFormatFontsInAttrPool()
// it can be removed - it is already in the Pool
SfxItemPool& rPool = m_pDoc->GetAttrPool();
const SwNumRuleTable& rListTable = m_pDoc->GetNumRuleTable();
- const SwNumRule* pRule;
const SwNumFormat* pFormat;
const vcl::Font* pFont;
const vcl::Font* pDefFont = &numfunc::GetDefBulletFont();
bool bCheck = false;
for( size_t nGet = rListTable.size(); nGet; )
- if( SwDoc::IsUsed( *(pRule = rListTable[ --nGet ] )))
+ {
+ SwNumRule const*const pRule = rListTable[ --nGet ];
+ if (m_pDoc->IsUsed(*pRule))
+ {
for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
+ {
if( SVX_NUM_CHAR_SPECIAL == (pFormat = &pRule->Get( nLvl ))->GetNumberingType() ||
SVX_NUM_BITMAP == pFormat->GetNumberingType() )
{
@@ -386,6 +389,9 @@ void Writer::PutNumFormatFontsInAttrPool()
pFont->GetFamilyName(), pFont->GetStyleName(),
pFont->GetPitch(), pFont->GetCharSet(), RES_CHRATR_FONT ));
}
+ }
+ }
+ }
}
void Writer::PutEditEngFontsInAttrPool()
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 366cc18b3b0c..3072798aed37 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -214,7 +214,7 @@ void RtfExport::BuildNumbering()
for (auto n = rListTable.size(); n;)
{
SwNumRule* pRule = rListTable[--n];
- if (!SwDoc::IsUsed(*pRule))
+ if (!m_pDoc->IsUsed(*pRule))
continue;
if (IsExportNumRule(*pRule))
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 088f5d445996..d0514482e5e1 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -96,6 +96,8 @@ sal_uInt16 MSWordExportBase::OverrideNumRule(
const sal_uInt16 absnumdef = rListId == rAbstractRule.GetDefaultListId()
? GetNumberingId(rAbstractRule)
: DuplicateAbsNum(rListId, rAbstractRule);
+ assert(numdef != USHRT_MAX);
+ assert(absnumdef != USHRT_MAX);
auto const mapping = std::make_pair(numdef, absnumdef);
auto it = m_OverridingNums.insert(std::make_pair(m_pUsedNumTable->size(), mapping));
@@ -125,7 +127,7 @@ sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule )
for ( sal_uInt16 n = m_pUsedNumTable->size(); n; )
{
const SwNumRule& rRule = *(*m_pUsedNumTable)[ --n ];
- if ( !SwDoc::IsUsed( rRule ) )
+ if (!m_pDoc->IsUsed(rRule))
{
m_pUsedNumTable->erase( m_pUsedNumTable->begin() + n );
}