21 #include <vcl/font.hxx>
27 #include <com/sun/star/i18n/ScriptType.hpp>
43 const OUString
sPrefix(
"WW8TempExport" + OUString::number( m_nUniqueList++ ));
47 m_pUsedNumTable->push_back( pMyNumRule );
52 pMyNumRule->
Set(
i, rSubRule );
59 SwNumRule*
const pMyNumRule = DuplicateNumRuleImpl(pRule);
63 pMyNumRule->
Set(nLevel, aNumFormat);
65 return GetNumberingId(*pMyNumRule);
73 auto const it(m_Lists.find(rListId));
74 if (it != m_Lists.end())
80 auto const pNewAbstractRule = DuplicateNumRuleImpl(&rAbstractRule);
81 assert(GetNumberingId(*pNewAbstractRule) == m_pUsedNumTable->size() - 1);
82 (
void) pNewAbstractRule;
83 m_Lists.insert(std::make_pair(rListId, m_pUsedNumTable->size() - 1));
84 return m_pUsedNumTable->size() - 1;
95 OUString
const& rListId,
98 const sal_uInt16 numdef = GetNumberingId(rExistingRule);
101 ? GetNumberingId(rAbstractRule)
102 : DuplicateAbsNum(rListId, rAbstractRule);
103 assert(numdef != USHRT_MAX);
104 assert(absnumdef != USHRT_MAX);
105 auto const mapping = std::make_pair(numdef, absnumdef);
107 auto it = m_OverridingNums.insert(std::make_pair(m_pUsedNumTable->size(), mapping));
109 m_pUsedNumTable->push_back(
nullptr);
112 return it.first->first;
116 sal_uInt16 nLevelNum,
119 m_ListLevelOverrides[nListId][nLevelNum] = nStartAt;
124 if ( !m_pUsedNumTable )
130 bool bOutlineRuleAdded(
false );
131 for ( sal_uInt16
n = m_pUsedNumTable->size();
n; )
133 const SwNumRule& rRule = *(*m_pUsedNumTable)[ --
n ];
136 m_pUsedNumTable->erase( m_pUsedNumTable->begin() +
n );
140 bOutlineRuleAdded =
true;
144 if ( !bOutlineRuleAdded )
148 m_pUsedNumTable->push_back( pR );
152 sal_uInt16 nRet = o3tl::narrowing<sal_uInt16>(m_pUsedNumTable->GetPos(p));
162 "<GetWordFirstLineOffset> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION" );
169 return nFirstLineOffset;
174 if ( !m_pUsedNumTable )
178 m_pFib->m_fcPlcfLst = m_pTableStrm->Tell();
179 m_pTableStrm->WriteUInt16( m_pUsedNumTable->size() );
180 NumberingDefinitions();
182 m_pFib->m_lcbPlcfLst = m_pTableStrm->Tell() - m_pFib->m_fcPlcfLst;
185 AbstractNumberingDefinitions();
188 OutOverrideListTab();
196 m_rWW8Export.m_pTableStrm->WriteUInt32( nId );
197 m_rWW8Export.m_pTableStrm->WriteUInt32( nId );
201 m_rWW8Export.m_pTableStrm->WriteUInt16( 0xFFF );
207 m_rWW8Export.m_pTableStrm->WriteUChar( nFlags ).WriteUChar( 0 );
212 if ( !m_pUsedNumTable )
215 sal_uInt16
nCount = m_pUsedNumTable->size();
218 for ( sal_uInt16
n = 0;
n < nCount; ++
n )
220 const SwNumRule * pRule = (*m_pUsedNumTable)[
n ];
223 AttrOutput().NumberingDefinition(
n + 1, *pRule);
227 auto it = m_OverridingNums.find(
n);
228 assert(it != m_OverridingNums.end());
229 pRule = (*m_pUsedNumTable)[it->second.first];
231 AttrOutput().OverrideNumberingDefinition(*pRule,
n + 1, it->second.second + 1, m_ListLevelOverrides[
n]);
258 case style::NumberingType::SYMBOL_CHICAGO:
271 sal_uInt16 nNumberingType,
278 sal_Int16 nFirstLineIndex,
279 sal_Int16 nListTabPos,
280 const OUString &rNumberingString,
285 m_rWW8Export.m_pTableStrm->WriteUInt32( nStart );
289 m_rWW8Export.m_pTableStrm->WriteUChar(nNumId);
295 case SvxAdjust::Center:
298 case SvxAdjust::Right:
305 m_rWW8Export.m_pTableStrm->WriteUChar( nAlign );
312 m_rWW8Export.m_pTableStrm->WriteUChar( nFollow );
315 m_rWW8Export.m_pTableStrm->WriteUInt32( 0 );
316 m_rWW8Export.m_pTableStrm->WriteUInt32( 0 );
319 std::unique_ptr<ww::bytes> pCharAtrs;
322 std::unique_ptr<ww::bytes> pOldpO = std::move(m_rWW8Export.m_pO);
326 sal_uInt16 nFontID = m_rWW8Export.m_aFontHelper.GetId( *pFont );
329 m_rWW8Export.InsUInt16( nFontID );
331 m_rWW8Export.InsUInt16( nFontID );
334 m_rWW8Export.OutputItemSet( *pOutSet,
false,
true, i18n::ScriptType::LATIN, m_rWW8Export.m_bExportModeRTF );
338 int nIndex = m_rWW8Export.GetGrfIndex(*pBrush);
342 m_rWW8Export.InsUInt32(nIndex);
344 m_rWW8Export.InsUInt16(1);
348 pCharAtrs = std::move(m_rWW8Export.m_pO);
349 m_rWW8Export.m_pO = std::move(pOldpO);
351 m_rWW8Export.m_pTableStrm->WriteUChar(
sal_uInt8(pCharAtrs ? pCharAtrs->size() : 0));
357 0x15, 0xc6, 0x05, 0x00, 0x01, 0, 0, 0x06
359 m_rWW8Export.m_pTableStrm->WriteUChar(
sal_uInt8(
sizeof( aPapSprms ) ) );
362 m_rWW8Export.m_pTableStrm->WriteUInt16( 0 );
372 m_rWW8Export.m_pTableStrm->WriteBytes(aPapSprms,
sizeof(aPapSprms));
375 if (pCharAtrs && !pCharAtrs->empty())
376 m_rWW8Export.m_pTableStrm->WriteBytes(pCharAtrs->data(), pCharAtrs->size());
379 m_rWW8Export.m_pTableStrm->WriteUInt16( rNumberingString.getLength() );
385 sal_uInt16
nCount = m_pUsedNumTable->size();
388 for( n = 0; n < nCount; ++n )
390 if (
nullptr == (*m_pUsedNumTable)[ n ])
395 AttrOutput().StartAbstractNumbering( n + 1 );
397 const SwNumRule& rRule = *(*m_pUsedNumTable)[ n ];
401 for( nLvl = 0; nLvl < nLevels; ++nLvl )
403 NumberingLevel(rRule, nLvl);
406 AttrOutput().EndAbstractNumbering();
452 OSL_FAIL(
"unknown GetLabelFollowedBy() return value" );
460 bool bWriteBullet =
false;
461 std::optional<vcl::Font> pBulletFont;
462 rtl_TextEncoding eChrSet=0;
469 sNumStr = OUString(&cBullet, 1);
482 OUString sSrch(
"%" + OUString::number(
i+1) +
"%");
483 sal_Int32 nFnd = sNumStr.indexOf(sSrch);
486 *pLvlPos =
static_cast<sal_uInt8>(nFnd + 1);
488 sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), rtl::OUStringChar(static_cast<char>(
i)));
505 eChrSet = pBulletFont->GetCharSet();
506 sFontName = pBulletFont->GetFamilyName();
507 eFamily = pBulletFont->GetFamilyType();
510 SubstituteBullet(sNumStr, eChrSet, sFontName);
514 std::unique_ptr<wwFont> pPseudoFont;
530 if (sFontName.isEmpty())
531 sFontName = pBulletFont->GetFamilyName();
533 pPseudoFont.reset(
new wwFont( sFontName, pBulletFont->GetPitch(),
540 sal_Int16 nIndentAt = 0;
541 sal_Int16 nFirstLineIndex = 0;
542 sal_Int16 nListTabPos = -1;
552 nIndentAt =
static_cast<sal_Int16
>(rFormat.
GetIndentAt());
558 AttrOutput().NumberingLevel( nLvl,
564 pPseudoFont.get(), pOutSet,
565 nIndentAt, nFirstLineIndex, nListTabPos,
572 if( !m_pUsedNumTable )
576 sal_uInt16
nCount = m_pUsedNumTable->size();
579 m_pFib->m_fcPlfLfo = m_pTableStrm->Tell();
580 m_pTableStrm->WriteUInt32( nCount );
583 for( n = 0; n < nCount; ++n )
585 m_pTableStrm->WriteUInt32( n + 1 );
589 for( n = 0; n < nCount; ++n )
590 m_pTableStrm->WriteInt32( -1 );
593 m_pFib->m_lcbPlfLfo = m_pTableStrm->Tell() - m_pFib->m_fcPlfLfo;
598 if( !m_pUsedNumTable )
602 sal_uInt16 nNms = 0,
nCount = m_pUsedNumTable->size();
604 m_pFib->m_fcSttbListNames = m_pTableStrm->Tell();
605 m_pTableStrm->WriteInt16( -1 );
606 m_pTableStrm->WriteUInt32(
nCount );
608 for( ; nNms <
nCount; ++nNms )
610 const SwNumRule& rRule = *(*m_pUsedNumTable)[ nNms ];
615 m_pTableStrm->WriteUInt16( sNm.getLength() );
622 m_pFib->m_lcbSttbListNames = m_pTableStrm->Tell() - m_pFib->m_fcSttbListNames;
626 rtl_TextEncoding& rChrSet, OUString& rFontName )
const
628 if (!m_bSubstituteBullets)
630 OUString sFontName = rFontName;
633 if (rNumStr[0] !=
u'\0')
635 rNumStr = rNumStr.replaceAt(0, 1, rtl::OUStringChar(
639 rFontName = sFontName;
sal_uInt16 DuplicateNumRule(const SwNumRule *pRule, sal_uInt8 nLevel, sal_uInt16 nVal)
In case of numbering restart.
SvxNumType GetNumberingType() const
bool IsUsed(const sw::BroadcastingModify &) const
sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet, rtl_TextEncoding &r_ioChrSet, OUString &r_ioFontName)
std::unique_ptr< sal_Int32[]> pData
void AddListLevelOverride(sal_uInt16 nListId, sal_uInt16 nLevelNum, sal_uInt16 nStartAt)
Store list level overrides (restart of list)
std::vector< sal_uInt8 > bytes
const OUString & GetDefaultListId() const
constexpr sal_uInt8 MAXLEVEL
virtual void WriteNumbering() override
Output the numbering table.
const OUString & GetName() const
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
static constexpr sal_uInt16 val
sal_Int32 nFirstLineOffset
virtual void NumberingDefinition(sal_uInt16 nId, const SwNumRule &rRule) override
Definition of a numbering instance.
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
bool IsStarSymbol(std::u16string_view rFontName)
void Set_UInt16(sal_uInt8 *&p, sal_uInt16 n)
Collects and outputs fonts.
sal_uInt16 DuplicateAbsNum(OUString const &rListId, SwNumRule const &rAbstractRule)
check if a new abstractNum is needed for this list
bool IsContinusNum() const
static void WriteString16(SvStream &rStrm, const OUString &rStr, bool bAddZero)
SwNumRule * DuplicateNumRuleImpl(const SwNumRule *pRule)
void SubstituteBullet(OUString &rNumStr, rtl_TextEncoding &rChrSet, OUString &rFontName) const
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
static sal_uInt8 GetNumId(sal_uInt16 eNumType)
Converts the SVX numbering type to MSONFC.
#define LANGUAGE_CHINESE_SIMPLIFIED
sal_Int16 GetWordFirstLineOffset(const SwNumFormat &rFormat)
const SwNumFormat & Get(sal_uInt16 i) const
sal_uInt16 GetNumberingId(const SwNumRule &rNumRule)
Return the numeric id of the numbering rule.
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
LanguageType GetLanguage() const
void Set(sal_uInt16 i, const SwNumFormat *)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const SwNumRuleTable & GetNumRuleTable() const
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
void NumberingDefinitions()
Write static data of SwNumRule - LSTF.
sal_uInt16 OverrideNumRule(SwNumRule const &rExistingRule, OUString const &rListId, SwNumRule const &rAbstractRule)
Create a overriding numbering definition (if it does not yet exist)
void OutOverrideListTab()
static sal_uInt8 GetLevelNFC(sal_uInt16 eNumType, const SfxItemSet *pOutSet, sal_uInt8 nDefault)
Converts the SVX numbering type to MSONFC.
static void WriteLong(SvStream &rStrm, sal_Int32 nVal)
static void FillCount(SvStream &rStrm, sal_uLong nCount)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
virtual void NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, sal_uInt16 nNumberingType, SvxAdjust eAdjust, const sal_uInt8 *pNumLvlPos, sal_uInt8 nFollow, const wwFont *pFont, const SfxItemSet *pOutSet, sal_Int16 nIndentAt, sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos, const OUString &rNumberingString, const SvxBrushItem *pBrush) override
All the numbering level information.
const SwAttrPool & GetAttrPool() const
void AbstractNumberingDefinitions()
Write all Levels for all SwNumRules - LVLF.
SwNumRule * GetOutlineNumRule() const
void NumberingLevel(SwNumRule const &rRule, sal_uInt8 nLvl)
Write one numbering level.