diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/number.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/text/txttab.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8num.cxx | 32 |
4 files changed, 33 insertions, 18 deletions
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 481ebfada8eb..c636273e6f54 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -664,6 +664,13 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto if (nPosition >= 0) sLevelFormat = sLevelFormat.replaceAt(nPosition, sFind.getLength(), sReplacement); } + + // As a fallback: caller code expects nonempty string as a result. + // But if we have empty string (and had no errors before) this is valid result. + // So use classical hack with zero-width-space as a string filling. + if (sLevelFormat.isEmpty()) + sLevelFormat = OUStringChar(CHAR_ZWSP); + aStr = sLevelFormat; } else diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index c2fded221827..37b00c532bae 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -122,7 +122,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto // #i24363# tab stops relative to indent // nSearchPos: The current position relative to the tabs origin - const SwTwips nSearchPos = bRTL ? + SwTwips nSearchPos = bRTL ? nTabLeft - nCurrentAbsPos : nCurrentAbsPos - nTabLeft; @@ -130,6 +130,14 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto // any hard set tab stops: // Note: If there are no user defined tab stops, there is always a // default tab stop. + + // If search is started from zero position (beginning of line), than + // lets do it from -1: this will allow to include into account potential + // tab stop at zero position. Yes, it will be zero width tab useless + // mostly, but this have sense in case of lists. + if (nSearchPos == 0) + nSearchPos = -1; + const SvxTabStop* pTabStop = m_aLineInf.GetTabStop( nSearchPos, nMyRight ); if ( pTabStop ) { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 478179cf8d0a..efaa4cd7eb9c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6840,7 +6840,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 nLevel, // indentation m_pSerializer->startElementNS(XML_w, XML_pPr); - if( nListTabPos != 0 ) + if( nListTabPos >= 0 ) { m_pSerializer->startElementNS(XML_w, XML_tabs); m_pSerializer->singleElementNS( XML_w, XML_tab, diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index d08a7703ce50..aef96bcd23cb 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -493,12 +493,7 @@ void MSWordExportBase::NumberingLevel( const vcl::Font* pBulletFont=nullptr; rtl_TextEncoding eChrSet=0; FontFamily eFamily=FAMILY_DECORATIVE; - if (rRule.Get(nLvl).HasListFormat()) - { - // Nothing to construct: we have it already - sNumStr = rRule.Get(nLvl).GetListFormat(); - } - else if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() || + if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() || SVX_NUM_BITMAP == rFormat.GetNumberingType()) { // Use bullet @@ -506,7 +501,9 @@ void MSWordExportBase::NumberingLevel( } else { - // Construct list format string from prefix, level numbers and suffix + // Create level string + // For docx it is not the best way: we can just take it from rRule.Get(nLvl).GetListFormat() + // But for compatibility with doc we follow same routine if (SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType()) { sal_uInt8* pLvlPos = aNumLvlPos; @@ -517,20 +514,23 @@ void MSWordExportBase::NumberingLevel( // now search the nums in the string for (sal_uInt8 i = 0; i <= nLvl; ++i) { - OUString sSrch( OUString::number( i )); - sal_Int32 nFnd = sNumStr.indexOf( sSrch ); - if( -1 != nFnd ) + OUString sSrch(OUString::number(i)); + sal_Int32 nFnd = sNumStr.indexOf(sSrch); + if (-1 != nFnd) { - *pLvlPos = static_cast<sal_uInt8>(nFnd + rFormat.GetPrefix().getLength() + 1 ); + *pLvlPos = static_cast<sal_uInt8>(nFnd + rFormat.GetPrefix().getLength() + 1); ++pLvlPos; - sNumStr = sNumStr.replaceAt( nFnd, 1, OUString(static_cast<char>(i)) ); + sNumStr = sNumStr.replaceAt(nFnd, 1, OUString(static_cast<char>(i))); } } } - if (!rFormat.GetPrefix().isEmpty()) - sNumStr = rFormat.GetPrefix() + sNumStr; - sNumStr += rFormat.GetSuffix(); + if (!rRule.Get(nLvl).HasListFormat()) + { + if (!rFormat.GetPrefix().isEmpty()) + sNumStr = rFormat.GetPrefix() + sNumStr; + sNumStr += rFormat.GetSuffix(); + } } if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() || @@ -582,7 +582,7 @@ void MSWordExportBase::NumberingLevel( sal_Int16 nIndentAt = 0; sal_Int16 nFirstLineIndex = 0; - sal_Int16 nListTabPos = 0; + sal_Int16 nListTabPos = -1; // #i86652# if (rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION) |