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