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