LibreOffice Module sw (master)  1
wrtw8num.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <hintids.hxx>
21 #include <vcl/font.hxx>
22 #include <editeng/langitem.hxx>
23 #include <doc.hxx>
24 #include <docary.hxx>
25 #include <numrule.hxx>
26 #include <charfmt.hxx>
27 #include <com/sun/star/i18n/ScriptType.hpp>
28 
29 #include "sprmids.hxx"
30 
31 #include "ww8attributeoutput.hxx"
32 #include "writerhelper.hxx"
33 #include "writerwordglue.hxx"
34 #include "wrtww8.hxx"
35 #include "ww8par.hxx"
36 
37 using namespace ::com::sun::star;
38 using namespace sw::types;
39 using namespace sw::util;
40 
42 {
43  const OUString sPrefix("WW8TempExport" + OUString::number( m_nUniqueList++ ));
44  SwNumRule* pMyNumRule =
45  new SwNumRule( m_rDoc.GetUniqueNumRuleName( &sPrefix ),
47  m_pUsedNumTable->push_back( pMyNumRule );
48 
49  for ( sal_uInt16 i = 0; i < MAXLEVEL; i++ )
50  {
51  const SwNumFormat& rSubRule = pRule->Get(i);
52  pMyNumRule->Set( i, rSubRule );
53  }
54  return pMyNumRule;
55 }
56 
57 sal_uInt16 MSWordExportBase::DuplicateNumRule(const SwNumRule* pRule, sal_uInt8 nLevel, sal_uInt16 nVal)
58 {
59  SwNumRule* const pMyNumRule = DuplicateNumRuleImpl(pRule);
60 
61  SwNumFormat aNumFormat(pMyNumRule->Get(nLevel));
62  aNumFormat.SetStart(nVal);
63  pMyNumRule->Set(nLevel, aNumFormat);
64 
65  return GetNumberingId(*pMyNumRule);
66 }
67 
68 // multiple SwList can be based on the same SwNumRule; ensure one w:abstractNum
69 // per SwList
70 sal_uInt16 MSWordExportBase::DuplicateAbsNum(OUString const& rListId,
71  SwNumRule const& rAbstractRule)
72 {
73  auto const it(m_Lists.find(rListId));
74  if (it != m_Lists.end())
75  {
76  return it->second;
77  }
78  else
79  {
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;
85  }
86 }
87 
88 // Ideally we want to map SwList to w:abstractNum and SwNumRule to w:num
89 // The current approach is to keep exporting every SwNumRule to
90 // 1 w:abstractNum and 1 w:num, and then add extra w:num via this function
91 // that reference an existing w:abstractNum and may override its formatting;
92 // of course this will end up exporting some w:num that aren't actually used.
94  SwNumRule const& rExistingRule,
95  OUString const& rListId,
96  SwNumRule const& rAbstractRule)
97 {
98  const sal_uInt16 numdef = GetNumberingId(rExistingRule);
99 
100  const sal_uInt16 absnumdef = rListId == rAbstractRule.GetDefaultListId()
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);
106 
107  auto it = m_OverridingNums.insert(std::make_pair(m_pUsedNumTable->size(), mapping));
108 
109  m_pUsedNumTable->push_back(nullptr); // dummy, it's unique_ptr...
110  ++m_nUniqueList; // counter for DuplicateNumRule...
111 
112  return it.first->first;
113 }
114 
116  sal_uInt16 nLevelNum,
117  sal_uInt16 nStartAt)
118 {
119  m_ListLevelOverrides[nListId][nLevelNum] = nStartAt;
120 }
121 
122 sal_uInt16 MSWordExportBase::GetNumberingId( const SwNumRule& rNumRule )
123 {
124  if ( !m_pUsedNumTable )
125  {
126  m_pUsedNumTable.reset(new SwNumRuleTable);
127  m_pUsedNumTable->insert( m_pUsedNumTable->begin(), m_rDoc.GetNumRuleTable().begin(), m_rDoc.GetNumRuleTable().end() );
128  // Check, if the outline rule is already inserted into <pUsedNumTable>.
129  // If yes, do not insert it again.
130  bool bOutlineRuleAdded( false );
131  for ( sal_uInt16 n = m_pUsedNumTable->size(); n; )
132  {
133  const SwNumRule& rRule = *(*m_pUsedNumTable)[ --n ];
134  if (!m_rDoc.IsUsed(rRule))
135  {
136  m_pUsedNumTable->erase( m_pUsedNumTable->begin() + n );
137  }
138  else if ( &rRule == m_rDoc.GetOutlineNumRule() )
139  {
140  bOutlineRuleAdded = true;
141  }
142  }
143 
144  if ( !bOutlineRuleAdded )
145  {
146  // still need to paste the OutlineRule
148  m_pUsedNumTable->push_back( pR );
149  }
150  }
151  SwNumRule* p = const_cast<SwNumRule*>(&rNumRule);
152  sal_uInt16 nRet = o3tl::narrowing<sal_uInt16>(m_pUsedNumTable->GetPos(p));
153 
154  return nRet;
155 }
156 
157 // GetFirstLineOffset should problem never appear unadorned apart from
158 // here in the ww export filter
159 sal_Int16 GetWordFirstLineOffset(const SwNumFormat &rFormat)
160 {
162  "<GetWordFirstLineOffset> - misusage: position-and-space-mode does not equal LABEL_WIDTH_AND_POSITION" );
163 
164  short nFirstLineOffset;
165  if (rFormat.GetNumAdjust() == SvxAdjust::Right)
166  nFirstLineOffset = -rFormat.GetCharTextDistance();
167  else
168  nFirstLineOffset = rFormat.GetFirstLineOffset(); //TODO: overflow
169  return nFirstLineOffset;
170 }
171 
173 {
174  if ( !m_pUsedNumTable )
175  return; // no numbering is used
176 
177  // list formats - LSTF
178  m_pFib->m_fcPlcfLst = m_pTableStrm->Tell();
179  m_pTableStrm->WriteUInt16( m_pUsedNumTable->size() );
180  NumberingDefinitions();
181  // set len to FIB
182  m_pFib->m_lcbPlcfLst = m_pTableStrm->Tell() - m_pFib->m_fcPlcfLst;
183 
184  // list formats - LVLF
185  AbstractNumberingDefinitions();
186 
187  // list formats - LFO
188  OutOverrideListTab();
189 
190  // list formats - ListNames
191  OutListNamesTab();
192 }
193 
194 void WW8AttributeOutput::NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule )
195 {
196  m_rWW8Export.m_pTableStrm->WriteUInt32( nId );
197  m_rWW8Export.m_pTableStrm->WriteUInt32( nId );
198 
199  // not associated with a Style
200  for ( int i = 0; i < WW8ListManager::nMaxLevel; ++i )
201  m_rWW8Export.m_pTableStrm->WriteUInt16( 0xFFF );
202 
203  sal_uInt8 nFlags = 0;
204  if ( rRule.IsContinusNum() )
205  nFlags |= 0x1;
206 
207  m_rWW8Export.m_pTableStrm->WriteUChar( nFlags ).WriteUChar( 0/*nDummy*/ );
208 }
209 
211 {
212  if ( !m_pUsedNumTable )
213  return; // no numbering is used
214 
215  sal_uInt16 nCount = m_pUsedNumTable->size();
216 
217  // Write static data of SwNumRule - LSTF
218  for ( sal_uInt16 n = 0; n < nCount; ++n )
219  {
220  const SwNumRule * pRule = (*m_pUsedNumTable)[ n ];
221  if (pRule)
222  {
223  AttrOutput().NumberingDefinition(n + 1, *pRule);
224  }
225  else
226  {
227  auto it = m_OverridingNums.find(n);
228  assert(it != m_OverridingNums.end());
229  pRule = (*m_pUsedNumTable)[it->second.first];
230  assert(pRule);
231  AttrOutput().OverrideNumberingDefinition(*pRule, n + 1, it->second.second + 1, m_ListLevelOverrides[n]);
232  }
233  }
234 }
235 
241 static sal_uInt8 GetLevelNFC(sal_uInt16 eNumType, const SfxItemSet* pOutSet, sal_uInt8 nDefault)
242 {
243  sal_uInt8 nRet = nDefault;
244  switch( eNumType )
245  {
247  nRet = 35;
248  if ( pOutSet ) {
249  const SvxLanguageItem& rLang = pOutSet->Get( RES_CHRATR_CJK_LANGUAGE);
250  const LanguageType eLang = rLang.GetLanguage();
251  if (LANGUAGE_CHINESE_SIMPLIFIED ==eLang) {
252  nRet = 39;
253  }
254  }
255  break;
256 
257  // LVLF can't contain 0x08, msonfcHex.
258  case style::NumberingType::SYMBOL_CHICAGO:
259  // No SVX_NUM_SYMBOL_CHICAGO here: LVLF can't contain 0x09, msonfcChiManSty.
260  nRet = 0;
261  break;
262  // LVLF can't contain 0x0F / 15, msonfcSbChar / decimalHalfWidth.
263  // LVLF can't contain 0x13 / 19, msonfcDArabic / decimalFullWidth2
264  }
265  return nRet;
266 }
267 
268 
270  sal_uInt16 nStart,
271  sal_uInt16 nNumberingType,
272  SvxAdjust eAdjust,
273  const sal_uInt8 *pNumLvlPos,
274  sal_uInt8 nFollow,
275  const wwFont *pFont,
276  const SfxItemSet *pOutSet,
277  sal_Int16 nIndentAt,
278  sal_Int16 nFirstLineIndex,
279  sal_Int16 nListTabPos,
280  const OUString &rNumberingString,
281  const SvxBrushItem* pBrush //For i120928,to transfer graphic of bullet
282  )
283 {
284  // Start value
285  m_rWW8Export.m_pTableStrm->WriteUInt32( nStart );
286 
287  // Type
288  sal_uInt8 nNumId = GetLevelNFC(nNumberingType, pOutSet, WW8Export::GetNumId(nNumberingType));
289  m_rWW8Export.m_pTableStrm->WriteUChar(nNumId);
290 
291  // Justification
292  sal_uInt8 nAlign;
293  switch ( eAdjust )
294  {
295  case SvxAdjust::Center:
296  nAlign = 1;
297  break;
298  case SvxAdjust::Right:
299  nAlign = 2;
300  break;
301  default:
302  nAlign = 0;
303  break;
304  }
305  m_rWW8Export.m_pTableStrm->WriteUChar( nAlign );
306 
307  // Write the rgbxchNums[9], positions of placeholders for paragraph
308  // numbers in the text
309  m_rWW8Export.m_pTableStrm->WriteBytes(pNumLvlPos, WW8ListManager::nMaxLevel);
310 
311  // Type of the character between the bullet and the text
312  m_rWW8Export.m_pTableStrm->WriteUChar( nFollow );
313 
314  // dxaSoace/dxaIndent (Word 6 compatibility)
315  m_rWW8Export.m_pTableStrm->WriteUInt32( 0 );
316  m_rWW8Export.m_pTableStrm->WriteUInt32( 0 );
317 
318  // cbGrpprlChpx
319  std::unique_ptr<ww::bytes> pCharAtrs;
320  if ( pOutSet )
321  {
322  std::unique_ptr<ww::bytes> pOldpO = std::move(m_rWW8Export.m_pO);
323  m_rWW8Export.m_pO.reset(new ww::bytes);
324  if ( pFont )
325  {
326  sal_uInt16 nFontID = m_rWW8Export.m_aFontHelper.GetId( *pFont );
327 
328  m_rWW8Export.InsUInt16( NS_sprm::CRgFtc0::val );
329  m_rWW8Export.InsUInt16( nFontID );
330  m_rWW8Export.InsUInt16( NS_sprm::CRgFtc2::val );
331  m_rWW8Export.InsUInt16( nFontID );
332  }
333 
334  m_rWW8Export.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN, m_rWW8Export.m_bExportModeRTF );
335  //For i120928,achieve graphic's index of bullet from the bullet bookmark
336  if (SVX_NUM_BITMAP == nNumberingType && pBrush)
337  {
338  int nIndex = m_rWW8Export.GetGrfIndex(*pBrush);
339  if ( nIndex != -1 )
340  {
341  m_rWW8Export.InsUInt16(NS_sprm::CPbiIBullet::val);
342  m_rWW8Export.InsUInt32(nIndex);
343  m_rWW8Export.InsUInt16(NS_sprm::CPbiGrf::val);
344  m_rWW8Export.InsUInt16(1);
345  }
346  }
347 
348  pCharAtrs = std::move(m_rWW8Export.m_pO);
349  m_rWW8Export.m_pO = std::move(pOldpO);
350  }
351  m_rWW8Export.m_pTableStrm->WriteUChar(sal_uInt8(pCharAtrs ? pCharAtrs->size() : 0));
352 
353  // cbGrpprlPapx
354  sal_uInt8 aPapSprms [] = {
355  0x5e, 0x84, 0, 0, // sprmPDxaLeft
356  0x60, 0x84, 0, 0, // sprmPDxaLeft1
357  0x15, 0xc6, 0x05, 0x00, 0x01, 0, 0, 0x06
358  };
359  m_rWW8Export.m_pTableStrm->WriteUChar( sal_uInt8( sizeof( aPapSprms ) ) );
360 
361  // reserved
362  m_rWW8Export.m_pTableStrm->WriteUInt16( 0 );
363 
364  // pap sprms
365  sal_uInt8* pData = aPapSprms + 2;
366  Set_UInt16( pData, nIndentAt );
367  pData += 2;
368  Set_UInt16( pData, nFirstLineIndex );
369  pData += 5;
370  Set_UInt16( pData, nListTabPos );
371 
372  m_rWW8Export.m_pTableStrm->WriteBytes(aPapSprms, sizeof(aPapSprms));
373 
374  // write Chpx
375  if (pCharAtrs && !pCharAtrs->empty())
376  m_rWW8Export.m_pTableStrm->WriteBytes(pCharAtrs->data(), pCharAtrs->size());
377 
378  // write the num string
379  m_rWW8Export.m_pTableStrm->WriteUInt16( rNumberingString.getLength() );
380  SwWW8Writer::WriteString16( *m_rWW8Export.m_pTableStrm, rNumberingString, false );
381 }
382 
384 {
385  sal_uInt16 nCount = m_pUsedNumTable->size();
386  sal_uInt16 n;
387 
388  for( n = 0; n < nCount; ++n )
389  {
390  if (nullptr == (*m_pUsedNumTable)[ n ])
391  {
392  continue;
393  }
394 
395  AttrOutput().StartAbstractNumbering( n + 1 );
396 
397  const SwNumRule& rRule = *(*m_pUsedNumTable)[ n ];
398  sal_uInt8 nLvl;
399  sal_uInt8 nLevels = static_cast< sal_uInt8 >(rRule.IsContinusNum() ?
401  for( nLvl = 0; nLvl < nLevels; ++nLvl )
402  {
403  NumberingLevel(rRule, nLvl);
404  }
405 
406  AttrOutput().EndAbstractNumbering();
407  }
408 }
409 
411  SwNumRule const& rRule, sal_uInt8 const nLvl)
412 {
413  // write the static data of the SwNumFormat of this level
414  sal_uInt8 aNumLvlPos[WW8ListManager::nMaxLevel] = { 0,0,0,0,0,0,0,0,0 };
415 
416  const SwNumFormat& rFormat = rRule.Get( nLvl );
417 
418  sal_uInt8 nFollow = 0;
419  // #i86652#
421  {
422  // <nFollow = 2>, if minimum label width equals 0 and
423  // minimum distance between label and text equals 0
424  nFollow = (rFormat.GetFirstLineOffset() == 0 &&
425  rFormat.GetCharTextDistance() == 0)
426  ? 2 : 0; // ixchFollow: 0 - tab, 1 - blank, 2 - nothing
427  }
429  {
430  switch (rFormat.GetLabelFollowedBy())
431  {
433  {
434  // 0 (tab) unless there would be no content before the tab, in which case 2 (nothing)
435  nFollow = (SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType()) ? 0 : 2;
436  }
437  break;
439  {
440  // 1 (space) unless there would be no content before the space in which case 2 (nothing)
441  nFollow = (SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType()) ? 1 : 2;
442  }
443  break;
445  {
446  nFollow = 2;
447  }
448  break;
449  default:
450  {
451  nFollow = 0;
452  OSL_FAIL( "unknown GetLabelFollowedBy() return value" );
453  }
454  }
455  }
456 
457  // Build the NumString for this Level
458  OUString sNumStr;
459  OUString sFontName;
460  bool bWriteBullet = false;
461  std::optional<vcl::Font> pBulletFont;
462  rtl_TextEncoding eChrSet=0;
464  if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() ||
465  SVX_NUM_BITMAP == rFormat.GetNumberingType())
466  {
467  // Use bullet
468  sal_UCS4 cBullet = rFormat.GetBulletChar();
469  sNumStr = OUString(&cBullet, 1);
470  }
471  else
472  {
473  // Create level string
474  if (rFormat.HasListFormat())
475  {
476  sal_uInt8* pLvlPos = aNumLvlPos;
477  sNumStr = rFormat.GetListFormat();
478 
479  // now search the nums in the string
480  for (sal_uInt8 i = 0; i <= nLvl; ++i)
481  {
482  OUString sSrch("%" + OUString::number(i+1) + "%");
483  sal_Int32 nFnd = sNumStr.indexOf(sSrch);
484  if (-1 != nFnd)
485  {
486  *pLvlPos = static_cast<sal_uInt8>(nFnd + 1);
487  ++pLvlPos;
488  sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), rtl::OUStringChar(static_cast<char>(i)));
489  }
490  }
491  }
492  }
493 
494  if (SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType() ||
495  SVX_NUM_BITMAP == rFormat.GetNumberingType())
496  {
497  bWriteBullet = true;
498 
499  pBulletFont = rFormat.GetBulletFont();
500  if (!pBulletFont)
501  {
502  pBulletFont = numfunc::GetDefBulletFont();
503  }
504 
505  eChrSet = pBulletFont->GetCharSet();
506  sFontName = pBulletFont->GetFamilyName();
507  eFamily = pBulletFont->GetFamilyType();
508 
509  if (IsStarSymbol(sFontName))
510  SubstituteBullet(sNumStr, eChrSet, sFontName);
511  }
512 
513  // Attributes of the numbering
514  std::unique_ptr<wwFont> pPseudoFont;
515  const SfxItemSet* pOutSet = nullptr;
516 
517  // cbGrpprlChpx
519  if (rFormat.GetCharFormat() || bWriteBullet)
520  {
521  if (bWriteBullet)
522  {
523  pOutSet = &aSet;
524 
525  if (rFormat.GetCharFormat())
526  aSet.Put( rFormat.GetCharFormat()->GetAttrSet() );
527  aSet.ClearItem( RES_CHRATR_CJK_FONT );
528  aSet.ClearItem( RES_CHRATR_FONT );
529 
530  if (sFontName.isEmpty())
531  sFontName = pBulletFont->GetFamilyName();
532 
533  pPseudoFont.reset(new wwFont( sFontName, pBulletFont->GetPitch(),
534  eFamily, eChrSet));
535  }
536  else
537  pOutSet = &rFormat.GetCharFormat()->GetAttrSet();
538  }
539 
540  sal_Int16 nIndentAt = 0;
541  sal_Int16 nFirstLineIndex = 0;
542  sal_Int16 nListTabPos = -1;
543 
544  // #i86652#
546  {
547  nIndentAt = nListTabPos = rFormat.GetAbsLSpace(); //TODO: overflow
548  nFirstLineIndex = GetWordFirstLineOffset(rFormat);
549  }
551  {
552  nIndentAt = static_cast<sal_Int16>(rFormat.GetIndentAt());
553  nFirstLineIndex = static_cast<sal_Int16>(rFormat.GetFirstLineIndent());
554  nListTabPos = rFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB?
555  static_cast<sal_Int16>( rFormat.GetListtabPos() ) : 0;
556  }
557 
558  AttrOutput().NumberingLevel( nLvl,
559  rFormat.GetStart(),
560  rFormat.GetNumberingType(),
561  rFormat.GetNumAdjust(),
562  aNumLvlPos,
563  nFollow,
564  pPseudoFont.get(), pOutSet,
565  nIndentAt, nFirstLineIndex, nListTabPos,
566  sNumStr,
567  rFormat.GetNumberingType()==SVX_NUM_BITMAP ? rFormat.GetBrush() : nullptr);
568 }
569 
571 {
572  if( !m_pUsedNumTable )
573  return ; // no numbering is used
574 
575  // write the "list format override" - LFO
576  sal_uInt16 nCount = m_pUsedNumTable->size();
577  sal_uInt16 n;
578 
579  m_pFib->m_fcPlfLfo = m_pTableStrm->Tell();
580  m_pTableStrm->WriteUInt32( nCount );
581 
582  // LFO ([MS-DOC] 2.9.131)
583  for( n = 0; n < nCount; ++n )
584  {
585  m_pTableStrm->WriteUInt32( n + 1 );
586  SwWW8Writer::FillCount( *m_pTableStrm, 12 );
587  }
588  // LFOData ([MS-DOC] 2.9.132)
589  for( n = 0; n < nCount; ++n )
590  m_pTableStrm->WriteInt32( -1 ); // no overwrite
591 
592  // set len to FIB
593  m_pFib->m_lcbPlfLfo = m_pTableStrm->Tell() - m_pFib->m_fcPlfLfo;
594 }
595 
597 {
598  if( !m_pUsedNumTable )
599  return ; // no numbering is used
600 
601  // write the "list format override" - LFO
602  sal_uInt16 nNms = 0, nCount = m_pUsedNumTable->size();
603 
604  m_pFib->m_fcSttbListNames = m_pTableStrm->Tell();
605  m_pTableStrm->WriteInt16( -1 );
606  m_pTableStrm->WriteUInt32( nCount );
607 
608  for( ; nNms < nCount; ++nNms )
609  {
610  const SwNumRule& rRule = *(*m_pUsedNumTable)[ nNms ];
611  OUString sNm;
612  if( !rRule.IsAutoRule() )
613  sNm = rRule.GetName();
614 
615  m_pTableStrm->WriteUInt16( sNm.getLength() );
616  if (!sNm.isEmpty())
617  SwWW8Writer::WriteString16(*m_pTableStrm, sNm, false);
618  }
619 
620  SwWW8Writer::WriteLong( *m_pTableStrm, m_pFib->m_fcSttbListNames + 2, nNms );
621  // set len to FIB
622  m_pFib->m_lcbSttbListNames = m_pTableStrm->Tell() - m_pFib->m_fcSttbListNames;
623 }
624 
625 void MSWordExportBase::SubstituteBullet( OUString& rNumStr,
626  rtl_TextEncoding& rChrSet, OUString& rFontName ) const
627 {
628  if (!m_bSubstituteBullets)
629  return;
630  OUString sFontName = rFontName;
631 
632  // If Bullet char is "", don't change
633  if (rNumStr[0] != u'\0')
634  {
635  rNumStr = rNumStr.replaceAt(0, 1, rtl::OUStringChar(
636  msfilter::util::bestFitOpenSymbolToMSFont(rNumStr[0], rChrSet, sFontName)));
637  }
638 
639  rFontName = sFontName;
640 }
641 
642 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 DuplicateNumRule(const SwNumRule *pRule, sal_uInt8 nLevel, sal_uInt16 nVal)
In case of numbering restart.
Definition: wrtw8num.cxx:57
SvxNumType GetNumberingType() const
tools::Long GetFirstLineIndent() const
bool IsUsed(const sw::BroadcastingModify &) const
Definition: poolfmt.cxx:86
sal_Int32 nIndex
sal_UCS4 GetBulletChar() const
sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet, rtl_TextEncoding &r_ioChrSet, OUString &r_ioFontName)
sal_uInt32 sal_UCS4
std::unique_ptr< sal_Int32[]> pData
const SvxBrushItem * GetBrush() const
void AddListLevelOverride(sal_uInt16 nListId, sal_uInt16 nLevelNum, sal_uInt16 nStartAt)
Store list level overrides (restart of list)
Definition: wrtw8num.cxx:115
SVX_NUM_NUMBER_NONE
std::vector< sal_uInt8 > bytes
Definition: types.hxx:29
const OUString & GetDefaultListId() const
Definition: numrule.hxx:194
bool IsAutoRule() const
Definition: numrule.hxx:229
sal_Int64 n
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
tools::Long GetListtabPos() const
virtual void WriteNumbering() override
Output the numbering table.
Definition: wrtw8num.cxx:172
const OUString & GetName() const
Definition: numrule.hxx:224
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Definition: docnum.cxx:2551
static constexpr sal_uInt16 val
Definition: sprmids.hxx:278
sal_Int32 nFirstLineOffset
virtual void NumberingDefinition(sal_uInt16 nId, const SwNumRule &rRule) override
Definition of a numbering instance.
Definition: wrtw8num.cxx:194
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
bool IsStarSymbol(std::u16string_view rFontName)
void OutListNamesTab()
Definition: wrtw8num.cxx:596
bool HasListFormat() const
SwDoc & m_rDoc
Definition: docbm.cxx:1201
int nCount
short GetCharTextDistance() const
void Set_UInt16(sal_uInt8 *&p, sal_uInt16 n)
Definition: ww8struc.hxx:47
FAMILY_DECORATIVE
Collects and outputs fonts.
Definition: wrtww8.hxx:296
sal_uInt16 DuplicateAbsNum(OUString const &rListId, SwNumRule const &rAbstractRule)
check if a new abstractNum is needed for this list
Definition: wrtw8num.cxx:70
bool IsContinusNum() const
Definition: numrule.hxx:235
static void WriteString16(SvStream &rStrm, const OUString &rStr, bool bAddZero)
Definition: wrtww8.cxx:1742
SVX_NUM_BITMAP
SVX_NUM_CHAR_SPECIAL
SwCharFormat * GetCharFormat() const
Definition: numrule.hxx:74
OUString GetListFormat(bool bIncludePrefixSuffix=true) const
SwNumRule * DuplicateNumRuleImpl(const SwNumRule *pRule)
Definition: wrtw8num.cxx:41
SvxAdjust
int i
void SubstituteBullet(OUString &rNumStr, rtl_TextEncoding &rChrSet, OUString &rFontName) const
Definition: wrtw8num.cxx:625
LabelFollowedBy GetLabelFollowedBy() const
sal_Int32 GetAbsLSpace() const
iterator begin()
Definition: docary.hxx:88
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1391
static sal_uInt8 GetNumId(sal_uInt16 eNumType)
Converts the SVX numbering type to MSONFC.
Definition: ww8atr.cxx:725
float u
#define LANGUAGE_CHINESE_SIMPLIFIED
SvxAdjust GetNumAdjust() const
sal_uInt16 GetStart() const
OUString sPrefix
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
iterator end()
Definition: docary.hxx:90
sal_Int16 GetWordFirstLineOffset(const SwNumFormat &rFormat)
Definition: wrtw8num.cxx:159
FontFamily
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:86
sal_uInt16 GetNumberingId(const SwNumRule &rNumRule)
Return the numeric id of the numbering rule.
Definition: wrtw8num.cxx:122
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
LanguageType GetLanguage() const
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:617
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
unsigned char sal_uInt8
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1065
SVX_NUM_NUMBER_LOWER_ZH
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
void NumberingDefinitions()
Write static data of SwNumRule - LSTF.
Definition: wrtw8num.cxx:210
void * p
sal_uInt16 OverrideNumRule(SwNumRule const &rExistingRule, OUString const &rListId, SwNumRule const &rAbstractRule)
Create a overriding numbering definition (if it does not yet exist)
Definition: wrtw8num.cxx:93
sal_Int32 GetFirstLineOffset() const
void SetStart(sal_uInt16 nSet)
void OutOverrideListTab()
Definition: wrtw8num.cxx:570
static sal_uInt8 GetLevelNFC(sal_uInt16 eNumType, const SfxItemSet *pOutSet, sal_uInt8 nDefault)
Converts the SVX numbering type to MSONFC.
Definition: wrtw8num.cxx:241
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
tools::Long GetIndentAt() const
static void WriteLong(SvStream &rStrm, sal_Int32 nVal)
Definition: wrtww8.hxx:969
static void FillCount(SvStream &rStrm, sal_uLong nCount)
Definition: wrtww8.cxx:931
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.
Definition: wrtw8num.cxx:269
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
void AbstractNumberingDefinitions()
Write all Levels for all SwNumRules - LVLF.
Definition: wrtw8num.cxx:383
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1023
const std::optional< vcl::Font > & GetBulletFont() const
void NumberingLevel(SwNumRule const &rRule, sal_uInt8 nLvl)
Write one numbering level.
Definition: wrtw8num.cxx:410
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo