LibreOffice Module sw (master)  1
wrtw8sty.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 <algorithm>
21 
22 #include <memory>
23 
24 #include <com/sun/star/i18n/ScriptType.hpp>
25 #include <hintids.hxx>
26 #include <editeng/boxitem.hxx>
27 #include <editeng/fontitem.hxx>
28 #include <svx/svdobj.hxx>
29 #include <svx/svdotext.hxx>
30 #include <svx/svdouno.hxx>
31 #include <editeng/lrspitem.hxx>
32 #include <editeng/fhgtitem.hxx>
33 #include <doc.hxx>
34 #include "wrtww8.hxx"
35 #include <docary.hxx>
36 #include <poolfmt.hxx>
37 #include <fmtpdsc.hxx>
38 #include <pagedesc.hxx>
39 #include <ndtxt.hxx>
40 #include <ftninfo.hxx>
41 #include <fmthdft.hxx>
42 #include <section.hxx>
43 #include <fmtcntnt.hxx>
44 #include <fmtftn.hxx>
45 #include <ndindex.hxx>
46 #include <txtftn.hxx>
47 #include <charfmt.hxx>
48 #include <docufld.hxx>
49 #include <dcontact.hxx>
50 #include <fmtcnct.hxx>
51 #include <ftnidx.hxx>
52 #include <fmtclds.hxx>
53 #include <lineinfo.hxx>
54 #include <fmtline.hxx>
55 #include <swtable.hxx>
56 #include <redline.hxx>
57 #include <msfilter.hxx>
58 #include <swmodule.hxx>
59 #include <charatr.hxx>
60 
61 #include "sprmids.hxx"
62 
63 #include "writerhelper.hxx"
64 #include "writerwordglue.hxx"
65 #include <wwstyles.hxx>
66 #include "ww8par.hxx"
67 #include "ww8attributeoutput.hxx"
68 #include "docxattributeoutput.hxx"
69 #include "rtfattributeoutput.hxx"
70 
71 #include <unordered_set>
72 
73 using namespace css;
74 using namespace sw::util;
75 using namespace nsHdFtFlags;
76 
79 {
80  std::unique_ptr<sal_uInt8[]> m_pData;
81  sal_uInt16 m_nLen;
83  WW8_PdAttrDesc() : m_nLen(0), m_nSepxFcPos(0xffffffff) /*default: none*/
84  { }
85 };
86 
87 namespace {
88 
89 struct WW8_SED
90 {
91  SVBT16 aBits1; // orientation change + internal, Default: 6
92  SVBT32 fcSepx; // FC file offset to beginning of SEPX for section.
93  // 0xFFFFFFFF for no Sprms
94  SVBT16 fnMpr; // used internally by Windows Word, Default: 0
95  SVBT32 fcMpr; // FC, points to offset in FC space for MacWord
96  // Default: 0xffffffff ( nothing )
97  // cbSED is 12 (decimal)), C (hex).
98 };
99 
100 }
101 
102 // class WW8_WrPlc0 is only used for header and footer positioning
103 // ie there is no content support structure
105 {
106 private:
107  std::vector<sal_uLong> aPos; // PTRARR of CPs / FCs
109 
110  WW8_WrPlc0(WW8_WrPlc0 const&) = delete;
111  WW8_WrPlc0& operator=(WW8_WrPlc0 const&) = delete;
112 
113 public:
114  explicit WW8_WrPlc0( sal_uLong nOffset );
115  sal_uInt16 Count() const { return aPos.size(); }
116  void Append( sal_uLong nStartCpOrFc );
117  void Write( SvStream& rStrm );
118 };
119 
120 // Styles
121 
122 #define WW8_RESERVED_SLOTS 15
123 
124 // GetId( SwCharFormat ) for use in text -> zero is not allowed,
125 // use "Default Char Style" instead
126 sal_uInt16 MSWordExportBase::GetId( const SwCharFormat* pFormat ) const
127 {
128  sal_uInt16 nRet = m_pStyles->GetSlot( pFormat );
129  return ( nRet != 0x0fff ) ? nRet : 10; // Default Char Style
130 }
131 
132 // GetId( SwTextFormatColl ) for use in TextNodes -> zero is not allowed,
133 // "Standard" instead
134 sal_uInt16 MSWordExportBase::GetId( const SwTextFormatColl& rColl ) const
135 {
136  sal_uInt16 nRet = m_pStyles->GetSlot( &rColl );
137  return ( nRet != 0xfff ) ? nRet : 0; // Default TextFormatColl
138 }
139 
140 //typedef pFormatT
141 MSWordStyles::MSWordStyles( MSWordExportBase& rExport, bool bListStyles )
142  : m_rExport( rExport ),
143  m_bListStyles(bListStyles)
144 {
145  // if exist any Foot-/End-Notes then get from the EndNoteInfo struct
146  // the CharFormats. They will create it!
148  {
153  }
154  sal_uInt16 nAlloc = WW8_RESERVED_SLOTS + m_rExport.m_pDoc->GetCharFormats()->size() - 1 +
156  (bListStyles ? m_rExport.m_pDoc->GetNumRuleTable().size() - 1 : 0);
157 
158  // somewhat generous ( free for up to 15 )
159  m_pFormatA.reset( new SwFormat*[ nAlloc ] );
160  memset( m_pFormatA.get(), 0, nAlloc * sizeof( SwFormat* ) );
161  memset( m_aHeadingParagraphStyles, -1 , MAXLEVEL * sizeof( sal_uInt16));
162 
164  BuildStyleIds();
165 }
166 
168 {
169 }
170 
171 // Sty_SetWWSlot() dependencies for the styles -> zero is allowed
172 sal_uInt16 MSWordStyles::GetSlot( const SwFormat* pFormat ) const
173 {
174  sal_uInt16 n;
175  for ( n = 0; n < m_nUsedSlots; n++ )
176  if ( m_pFormatA[n] == pFormat )
177  return n;
178  return 0xfff; // 0xfff: WW: zero
179 }
180 
181 sal_uInt16 MSWordStyles::BuildGetSlot( const SwFormat& rFormat )
182 {
183  sal_uInt16 nRet = rFormat.GetPoolFormatId();
184  switch ( nRet )
185  {
187  nRet = 0;
188  break;
189 
199  nRet -= RES_POOLCOLL_HEADLINE1-1;
200  break;
201 
202  default:
203  nRet = m_nUsedSlots++;
204  break;
205  }
206  return nRet;
207 }
208 
209 
210 sal_uInt16 MSWordStyles::GetWWId( const SwFormat& rFormat )
211 {
212  sal_uInt16 nRet = ww::stiUser; // user style as default
213  sal_uInt16 nPoolId = rFormat.GetPoolFormatId();
214  if( nPoolId == RES_POOLCOLL_STANDARD )
215  nRet = 0;
216  else if( nPoolId >= RES_POOLCOLL_HEADLINE1 &&
217  nPoolId <= RES_POOLCOLL_HEADLINE9 )
218  nRet = static_cast< sal_uInt16 >(nPoolId + 1 - RES_POOLCOLL_HEADLINE1);
219  else if( nPoolId >= RES_POOLCOLL_TOX_IDX1 &&
220  nPoolId <= RES_POOLCOLL_TOX_IDX3 )
221  nRet = static_cast< sal_uInt16 >(nPoolId + 10 - RES_POOLCOLL_TOX_IDX1);
222  else if( nPoolId >= RES_POOLCOLL_TOX_CNTNT1 &&
223  nPoolId <= RES_POOLCOLL_TOX_CNTNT5 )
224  nRet = static_cast< sal_uInt16 >(nPoolId + 19 - RES_POOLCOLL_TOX_CNTNT1);
225  else if( nPoolId >= RES_POOLCOLL_TOX_CNTNT6 &&
226  nPoolId <= RES_POOLCOLL_TOX_CNTNT9 )
227  nRet = static_cast< sal_uInt16 >(nPoolId + 24 - RES_POOLCOLL_TOX_CNTNT6);
228  else
229  switch( nPoolId )
230  {
231  case RES_POOLCOLL_FOOTNOTE: nRet = 29; break;
232  case RES_POOLCOLL_MARGINAL: nRet = 30; break;
233  case RES_POOLCOLL_HEADER: nRet = 31; break;
234  case RES_POOLCOLL_FOOTER: nRet = 32; break;
235  case RES_POOLCOLL_TOX_IDXH: nRet = 33; break;
236  case RES_POOLCOLL_LABEL: nRet = 34; break;
237  case RES_POOLCOLL_LABEL_DRAWING: nRet = 35; break;
238  case RES_POOLCOLL_JAKETADRESS: nRet = 36; break;
239  case RES_POOLCOLL_SENDADRESS: nRet = 37; break;
240  case RES_POOLCOLL_ENDNOTE: nRet = 43; break;
241  case RES_POOLCOLL_TOX_AUTHORITIESH: nRet = 44; break;
242  case RES_POOLCOLL_TOX_CNTNTH: nRet = 46; break;
243  case RES_POOLCOLL_BULLET_LEVEL1: nRet = 48; break;
244  case RES_POOLCOLL_LISTS_BEGIN: nRet = 47; break;
245  case RES_POOLCOLL_NUM_LEVEL1: nRet = 49; break;
246  case RES_POOLCOLL_BULLET_LEVEL2: nRet = 54; break;
247  case RES_POOLCOLL_BULLET_LEVEL3: nRet = 55; break;
248  case RES_POOLCOLL_BULLET_LEVEL4: nRet = 56; break;
249  case RES_POOLCOLL_BULLET_LEVEL5: nRet = 57; break;
250  case RES_POOLCOLL_NUM_LEVEL2: nRet = 58; break;
251  case RES_POOLCOLL_NUM_LEVEL3: nRet = 59; break;
252  case RES_POOLCOLL_NUM_LEVEL4: nRet = 60; break;
253  case RES_POOLCOLL_NUM_LEVEL5: nRet = 61; break;
254  case RES_POOLCOLL_DOC_TITLE: nRet = 62; break;
255  case RES_POOLCOLL_DOC_APPENDIX: nRet = 63; break;
256  case RES_POOLCOLL_SIGNATURE: nRet = 64; break;
257  case RES_POOLCOLL_TEXT: nRet = 66; break;
258  case RES_POOLCOLL_TEXT_MOVE: nRet = 67; break;
259  case RES_POOLCOLL_BULLET_NONUM1: nRet = 68; break;
260  case RES_POOLCOLL_BULLET_NONUM2: nRet = 69; break;
261  case RES_POOLCOLL_BULLET_NONUM3: nRet = 70; break;
262  case RES_POOLCOLL_BULLET_NONUM4: nRet = 71; break;
263  case RES_POOLCOLL_BULLET_NONUM5: nRet = 72; break;
264  case RES_POOLCOLL_DOC_SUBTITLE: nRet = 74; break;
265  case RES_POOLCOLL_GREETING: nRet = 75; break;
266  case RES_POOLCOLL_TEXT_IDENT: nRet = 77; break;
267 
268  case RES_POOLCHR_FOOTNOTE_ANCHOR: nRet = 38; break;
269  case RES_POOLCHR_ENDNOTE_ANCHOR: nRet = 42; break;
270  case RES_POOLCHR_INET_NORMAL: nRet = 85; break;
271  case RES_POOLCHR_INET_VISIT: nRet = 86; break;
272  case RES_POOLCHR_HTML_STRONG: nRet = 87; break;
273  case RES_POOLCHR_HTML_EMPHASIS: nRet = 88; break;
274  case RES_POOLCHR_LINENUM: nRet = 40; break;
275  case RES_POOLCHR_PAGENO: nRet = 41; break;
276  }
277  return nRet;
278 }
279 
281 {
282  m_nUsedSlots = WW8_RESERVED_SLOTS; // reserved slots for standard, headingX, and others
283 
284  const SwCharFormats& rArr = *m_rExport.m_pDoc->GetCharFormats(); // first CharFormat
285  // the default character style ( 0 ) will not be outputted !
286  for( size_t n = 1; n < rArr.size(); n++ )
287  {
288  SwCharFormat* pFormat = rArr[n];
289  m_pFormatA[ BuildGetSlot( *pFormat ) ] = pFormat;
290  }
291 
292  const SwTextFormatColls& rArr2 = *m_rExport.m_pDoc->GetTextFormatColls(); // then TextFormatColls
293  // the default character style ( 0 ) will not be outputted !
294  for( size_t n = 1; n < rArr2.size(); n++ )
295  {
296  SwTextFormatColl* pFormat = rArr2[n];
297  sal_uInt16 nId = BuildGetSlot( *pFormat ) ;
298  m_pFormatA[ nId ] = pFormat;
299  if ( pFormat->IsAssignedToListLevelOfOutlineStyle() )
300  {
301  int nLvl = pFormat->GetAssignedOutlineStyleLevel() ;
302  if (nLvl >= 0 && nLvl < MAXLEVEL)
303  m_aHeadingParagraphStyles[nLvl] = nId ;
304  }
305  }
306 
307  if (!m_bListStyles)
308  return;
309 
310  const SwNumRuleTable& rNumRuleTable = m_rExport.m_pDoc->GetNumRuleTable();
311  for (size_t i = 0; i < rNumRuleTable.size(); ++i)
312  {
313  const SwNumRule* pNumRule = rNumRuleTable[i];
314  if (pNumRule->IsAutoRule() || pNumRule->GetName().startsWith("WWNum"))
315  continue;
316  sal_uInt16 nSlot = BuildGetSlot(*pNumRule);
317  m_aNumRules[nSlot] = pNumRule;
318  }
319 }
320 
321 OString MSWordStyles::CreateStyleId(const OUString &rName)
322 {
323  OStringBuffer aStyleIdBuf(rName.getLength());
324  for (int i = 0; i < rName.getLength(); ++i)
325  {
326  sal_Unicode nChar = rName[i];
327  if (('0' <= nChar && nChar <= '9') ||
328  ('a' <= nChar && nChar <= 'z') ||
329  ('A' <= nChar && nChar <= 'Z'))
330  {
331  // first letter should be uppercase
332  if (aStyleIdBuf.isEmpty() && 'a' <= nChar && nChar <= 'z')
333  aStyleIdBuf.append(char(nChar - ('a' - 'A')));
334  else
335  aStyleIdBuf.append(char(nChar));
336  }
337  }
338  return aStyleIdBuf.makeStringAndClear();
339 }
340 
342 {
343  std::unordered_set<OString> aUsed;
344 
345  m_aStyleIds.emplace_back("Normal");
346  aUsed.insert("normal");
347 
348  for (sal_uInt16 n = 1; n < m_nUsedSlots; ++n)
349  {
350  OUString aName;
351  if(m_pFormatA[n])
352  aName = m_pFormatA[n]->GetName();
353  else if (m_aNumRules.find(n) != m_aNumRules.end())
354  aName = m_aNumRules[n]->GetName();
355 
356  OString aStyleId = CreateStyleId(aName);
357 
358  if (aStyleId.isEmpty())
359  aStyleId = "Style";
360 
361  OString aLower(aStyleId.toAsciiLowerCase());
362 
363  // check for uniqueness & construct something unique if we have to
364  if (aUsed.insert(aLower).second)
365  {
366  m_aStyleIds.push_back(aStyleId);
367  }
368  else
369  {
370  int nFree = 1;
371  while (!aUsed.insert(aLower + OString::number(nFree)).second)
372  ++nFree;
373 
374  m_aStyleIds.emplace_back(aStyleId + OString::number(nFree));
375  }
376  }
377 }
378 
379 OString const & MSWordStyles::GetStyleId(sal_uInt16 nId) const
380 {
381  return m_aStyleIds[nId];
382 }
383 
385 static void impl_SkipOdd(std::unique_ptr<ww::bytes> const& pO, std::size_t nTableStrmTell)
386 {
387  if ( ( nTableStrmTell + pO->size() ) & 1 ) // start on even
388  pO->push_back( sal_uInt8(0) ); // Address
389 }
390 
392 {
394 
395  short nLen = m_rWW8Export.pO->size() - 2; // length of the style
396  sal_uInt8* p = m_rWW8Export.pO->data() + nPOPosStdLen1;
397  ShortToSVBT16( nLen, p ); // add
398  p = m_rWW8Export.pO->data() + nPOPosStdLen2;
399  ShortToSVBT16( nLen, p ); // also
400 
402  m_rWW8Export.pO->clear();
403 }
404 
405 void WW8AttributeOutput::StartStyle( const OUString& rName, StyleType eType, sal_uInt16 nWwBase,
406  sal_uInt16 nWwNext, sal_uInt16 nWwId, sal_uInt16 /*nId*/, bool bAutoUpdate )
407 {
408  sal_uInt8 aWW8_STD[ sizeof( WW8_STD ) ] = {};
409  sal_uInt8* pData = aWW8_STD;
410 
411  sal_uInt16 nBit16 = 0x1000; // fInvalHeight
412  nBit16 |= (ww::stiNil & nWwId);
413  Set_UInt16( pData, nBit16 );
414 
415  nBit16 = nWwBase << 4; // istdBase
416  nBit16 |= (eType == STYLE_TYPE_PARA ? 1 : 2); // sgc
417  Set_UInt16( pData, nBit16 );
418 
419  nBit16 = nWwNext << 4; // istdNext
420  nBit16 |= (eType == STYLE_TYPE_PARA ? 2 : 1); // cupx
421  Set_UInt16( pData, nBit16 );
422 
423  pData += sizeof( sal_uInt16 ); // bchUpe
424 
425  nBit16 = bAutoUpdate ? 1 : 0; // fAutoRedef : 1
426  Set_UInt16( pData, nBit16 );
427  // now new:
428  // from Ver8 there are two fields more:
429  // sal_uInt16 fHidden : 1; /* hidden from UI?
430  // sal_uInt16 : 14; /* unused bits
431 
432  sal_uInt16 nLen = static_cast< sal_uInt16 >( ( pData - aWW8_STD ) + 1 +
433  (2 * (rName.getLength() + 1)) ); // temporary
434 
435  nPOPosStdLen1 = m_rWW8Export.pO->size(); // Adr1 for adding the length
436 
438  m_rWW8Export.pO->insert( m_rWW8Export.pO->end(), aWW8_STD, pData );
439 
440  nPOPosStdLen2 = nPOPosStdLen1 + 8; // Adr2 for adding of "end of upx"
441 
442  // write names
443  SwWW8Writer::InsUInt16( *m_rWW8Export.pO, rName.getLength() ); // length
445  m_rWW8Export.pO->push_back( sal_uInt8(0) ); // Despite P-String 0 at the end!
446 }
447 
448 void MSWordStyles::SetStyleDefaults( const SwFormat& rFormat, bool bPap )
449 {
450  const SwModify* pOldMod = m_rExport.m_pOutFormatNode;
451  m_rExport.m_pOutFormatNode = &rFormat;
452  bool aFlags[ static_cast< sal_uInt16 >(RES_FRMATR_END) - RES_CHRATR_BEGIN ];
453  sal_uInt16 nStt, nEnd, n;
454  if( bPap )
455  {
456  nStt = RES_PARATR_BEGIN;
457  nEnd = RES_FRMATR_END;
458  }
459  else
460  {
461  nStt = RES_CHRATR_BEGIN;
462  nEnd = RES_TXTATR_END;
463  }
464 
465  // dynamic defaults
466  const SfxItemPool& rPool = *rFormat.GetAttrSet().GetPool();
467  for( n = nStt; n < nEnd; ++n )
468  aFlags[ n - RES_CHRATR_BEGIN ] = nullptr != rPool.GetPoolDefaultItem( n )
469  || SfxItemState::SET == m_rExport.m_pDoc->GetDfltTextFormatColl()->GetItemState( n, false );
470 
471  // static defaults, that differs between WinWord and SO
472  if( bPap )
473  {
474  aFlags[ static_cast< sal_uInt16 >(RES_PARATR_WIDOWS) - RES_CHRATR_BEGIN ] = true;
475  aFlags[ static_cast< sal_uInt16 >(RES_PARATR_HYPHENZONE) - RES_CHRATR_BEGIN ] = true;
476  aFlags[ static_cast< sal_uInt16 >(RES_FRAMEDIR) - RES_CHRATR_BEGIN ] = true;
477  }
478  else
479  {
480  aFlags[ RES_CHRATR_FONTSIZE - RES_CHRATR_BEGIN ] = true;
481  aFlags[ RES_CHRATR_LANGUAGE - RES_CHRATR_BEGIN ] = true;
482  }
483 
484  const SfxItemSet* pOldI = m_rExport.GetCurItemSet();
485  m_rExport.SetCurItemSet( &rFormat.GetAttrSet() );
486 
487  const bool* pFlags = aFlags + ( nStt - RES_CHRATR_BEGIN );
488  for ( n = nStt; n < nEnd; ++n, ++pFlags )
489  {
490  if ( *pFlags && !m_rExport.ignoreAttributeForStyleDefaults( n )
491  && SfxItemState::SET != rFormat.GetItemState(n, false))
492  {
493  //If we are a character property then see if it is one of the
494  //western/asian ones that must be collapsed together for export to
495  //word. If so default to the western variant.
496  if ( bPap || m_rExport.CollapseScriptsforWordOk(
497  i18n::ScriptType::LATIN, n) )
498  {
499  m_rExport.AttrOutput().OutputItem( rFormat.GetFormatAttr( n ) );
500  }
501  }
502  }
503 
504  m_rExport.SetCurItemSet( pOldI );
505  m_rExport.m_pOutFormatNode = pOldMod;
506 }
507 
508 void WW8AttributeOutput::StartStyleProperties( bool bParProp, sal_uInt16 nStyle )
509 {
511 
512  sal_uInt16 nLen = bParProp ? 2 : 0; // default length
513  m_nStyleLenPos = m_rWW8Export.pO->size(); // adding length
514  // Don't save pointer, because it
515  // changes by _grow!
516 
517  SwWW8Writer::InsUInt16( *m_rWW8Export.pO, nLen ); // Style-Len
518 
520 
521  if ( bParProp )
522  SwWW8Writer::InsUInt16( *m_rWW8Export.pO, nStyle ); // Style-Number
523 }
524 
525 void MSWordStyles::WriteProperties( const SwFormat* pFormat, bool bParProp, sal_uInt16 nPos,
526  bool bInsDefCharSiz )
527 {
528  m_rExport.AttrOutput().StartStyleProperties( bParProp, nPos );
529 
530  OSL_ENSURE( m_rExport.m_pCurrentStyle == nullptr, "Current style not NULL" ); // set current style before calling out
531  m_rExport.m_pCurrentStyle = pFormat;
532 
533  m_rExport.OutputFormat( *pFormat, bParProp, !bParProp );
534 
535  OSL_ENSURE( m_rExport.m_pCurrentStyle == pFormat, "current style was changed" );
536  // reset current style...
537  m_rExport.m_pCurrentStyle = nullptr;
538 
539  if ( bInsDefCharSiz ) // not derived from other Style
540  SetStyleDefaults( *pFormat, bParProp );
541 
543 }
544 
545 void WW8AttributeOutput::EndStyleProperties( bool /*bParProp*/ )
546 {
547  sal_uInt16 nLen = m_rWW8Export.pO->size() - m_nStyleStartSize;
548  sal_uInt8* pUpxLen = m_rWW8Export.pO->data() + m_nStyleLenPos; // adding length
549  ShortToSVBT16( nLen, pUpxLen ); // add default length
550 }
551 
552 void MSWordStyles::GetStyleData( SwFormat* pFormat, bool& bFormatColl, sal_uInt16& nBase, sal_uInt16& nNext )
553 {
554  bFormatColl = pFormat->Which() == RES_TXTFMTCOLL || pFormat->Which() == RES_CONDTXTFMTCOLL;
555 
556  // Default: none
557  nBase = 0xfff;
558 
559  // Derived from?
560  if ( !pFormat->IsDefault() )
561  nBase = GetSlot( pFormat->DerivedFrom() );
562 
563  SwFormat* pNext;
564  if ( bFormatColl )
565  pNext = &static_cast<SwTextFormatColl*>(pFormat)->GetNextTextFormatColl();
566  else
567  pNext = pFormat; // CharFormat: next CharFormat == self
568 
569  nNext = GetSlot( pNext );
570 }
571 
573 {
574  m_rWW8Export.pTableStrm->WriteUInt16(0); // empty Style
575 }
576 
577 void MSWordStyles::OutputStyle(const SwNumRule* pNumRule, sal_uInt16 nPos)
578 {
580  /*nBase =*/ 0, /*nWwNext =*/ 0, /*nWWId =*/ 0, nPos,
581  /*bAutoUpdateFormat =*/ false );
582 
584 }
585 
586 // OutputStyle applies for TextFormatColls and CharFormats
587 void MSWordStyles::OutputStyle( SwFormat* pFormat, sal_uInt16 nPos )
588 {
589  if ( !pFormat )
591  else
592  {
593  bool bFormatColl;
594  sal_uInt16 nBase, nWwNext;
595 
596  GetStyleData( pFormat, bFormatColl, nBase, nWwNext );
597 
598  OUString aName = pFormat->GetName();
599  // We want to map LO's default style to Word's "Normal" style.
600  // Word looks for this specific style name when reading docx files.
601  // (It must be the English word regardless of language settings)
602  if ( nPos == 0 )
603  {
604  assert( pFormat->GetPoolFormatId() == RES_POOLCOLL_STANDARD );
605  aName = "Normal";
606  }
607  else if (aName.equalsIgnoreAsciiCase("Normal"))
608  {
609  // If LO has a style named "Normal"(!) rename it to something unique
610  const OUString aBaseName = "LO-" + aName;
611  aName = aBaseName;
612  // Check if we still have a clash, in which case we add a suffix
613  for ( int nSuffix = 0; ; ++nSuffix ) {
614  bool clash=false;
615  for ( sal_uInt16 n = 1; n < m_nUsedSlots; ++n )
616  if ( m_pFormatA[n] &&
617  m_pFormatA[n]->GetName().equalsIgnoreAsciiCase(aName) )
618  {
619  clash = true;
620  break;
621  }
622  if (!clash)
623  break;
624  // TODO: verify if we really need to increment nSuffix in 2 places
625  aName = aBaseName + OUString::number(++nSuffix);
626  }
627  }
628  else if (!bFormatColl && m_rExport.GetExportFormat() == MSWordExportBase::DOCX &&
629  m_rExport.m_pStyles->GetStyleId(nPos).startsWith("ListLabel"))
630  {
631  // tdf#92335 don't export redundant DOCX import style "ListLabel"
632  return;
633  }
634  else if (aName.equalsIgnoreAsciiCase("Internet Link"))
635  {
636  aName = "Hyperlink";
637  }
638  else if (aName.equalsIgnoreAsciiCase("Visited Internet Link"))
639  {
640  aName = "FollowedHyperlink";
641  }
642 
643  m_rExport.AttrOutput().StartStyle( aName, (bFormatColl ? STYLE_TYPE_PARA : STYLE_TYPE_CHAR),
644  nBase, nWwNext, GetWWId( *pFormat ), nPos,
645  pFormat->IsAutoUpdateFormat() );
646 
647  if ( bFormatColl )
648  WriteProperties( pFormat, true, nPos, nBase==0xfff ); // UPX.papx
649 
650  WriteProperties( pFormat, false, nPos, bFormatColl && nBase==0xfff ); // UPX.chpx
651 
653  }
654 }
655 
657 {
658  WW8Fib& rFib = *m_rWW8Export.pFib;
659 
660  sal_uLong nCurPos = m_rWW8Export.pTableStrm->Tell();
661  if ( nCurPos & 1 ) // start on even
662  {
663  m_rWW8Export.pTableStrm->WriteChar( char(0) ); // Address
664  ++nCurPos;
665  }
666  rFib.m_fcStshfOrig = rFib.m_fcStshf = nCurPos;
667  m_nStyleCountPos = nCurPos + 2; // count is added later
668 
669  static sal_uInt8 aStShi[] = {
670  0x12, 0x00,
671  0x0F, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x5B, 0x00,
672  0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
673  0x00, 0x00 };
674 
675  m_rWW8Export.pTableStrm->WriteBytes(&aStShi, sizeof(aStShi));
676 }
677 
678 void WW8AttributeOutput::EndStyles( sal_uInt16 nNumberOfStyles )
679 {
680  WW8Fib& rFib = *m_rWW8Export.pFib;
681 
684 }
685 
687 {
688  m_rExport.m_bStyDef = true;
689 
691 
692  sal_uInt16 n;
693  // HACK
694  // Ms Office seems to have an internal limitation of 4091 styles
695  // and refuses to load .docx with more, even though the spec seems to allow that;
696  // so simply if there are more styles, don't export those
697  // Implementing check for all exports DOCX, DOC, RTF
698  sal_uInt16 const nLimit = MSWORD_MAX_STYLES_LIMIT;
699  m_nUsedSlots = std::min(nLimit, m_nUsedSlots);
700 
701  for ( n = 0; n < m_nUsedSlots; n++ )
702  {
703  if (m_aNumRules.find(n) != m_aNumRules.end())
704  OutputStyle(m_aNumRules[n], n);
705  else
706  OutputStyle( m_pFormatA[n], n );
707  }
708 
709  m_rExport.AttrOutput().EndStyles( m_nUsedSlots );
710 
711  m_rExport.m_bStyDef = false;
712 }
713 
714 const SwNumRule* MSWordStyles::GetSwNumRule(sal_uInt16 nId) const
715 {
716  std::map<sal_uInt16, const SwNumRule*>::const_iterator it = m_aNumRules.find(nId);
717  assert(it != m_aNumRules.end());
718  return it->second;
719 }
720 
721 // Fonts
722 
723 wwFont::wwFont(const OUString &rFamilyName, FontPitch ePitch, FontFamily eFamily,
724  rtl_TextEncoding eChrSet)
725  : mbAlt(false), mePitch(ePitch), meFamily(eFamily), meChrSet(eChrSet)
726 {
727  FontMapExport aResult(rFamilyName);
728  msFamilyNm = aResult.msPrimary;
729  msAltNm = aResult.msSecondary;
730  if (!msAltNm.isEmpty() && msAltNm != msFamilyNm &&
731  (msFamilyNm.getLength() + msAltNm.getLength() + 2 <= 65) )
732  {
733  //max size of szFfn in 65 chars
734  mbAlt = true;
735  }
736 
737  maWW8_FFN[0] = static_cast<sal_uInt8>( 6 - 1 + 0x22 + ( 2 * ( 1 + msFamilyNm.getLength() ) ));
738  if (mbAlt)
739  maWW8_FFN[0] = static_cast< sal_uInt8 >(maWW8_FFN[0] + 2 * ( 1 + msAltNm.getLength()));
740 
741  sal_uInt8 aB = 0;
742  switch(ePitch)
743  {
744  case PITCH_VARIABLE:
745  aB |= 2; // aF.prg = 2
746  break;
747  case PITCH_FIXED:
748  aB |= 1;
749  break;
750  default: // aF.prg = 0 : DEFAULT_PITCH (windows.h)
751  break;
752  }
753  aB |= 1 << 2; // aF.fTrueType = 1; don't know any better;
754 
755  switch(eFamily)
756  {
757  case FAMILY_ROMAN:
758  aB |= 1 << 4; // aF.ff = 1;
759  break;
760  case FAMILY_SWISS:
761  aB |= 2 << 4; // aF.ff = 2;
762  break;
763  case FAMILY_MODERN:
764  aB |= 3 << 4; // aF.ff = 3;
765  break;
766  case FAMILY_SCRIPT:
767  aB |= 4 << 4; // aF.ff = 4;
768  break;
769  case FAMILY_DECORATIVE:
770  aB |= 5 << 4; // aF.ff = 5;
771  break;
772  default: // aF.ff = 0; FF_DONTCARE (windows.h)
773  break;
774  }
775  maWW8_FFN[1] = aB;
776 
777  ShortToSVBT16( 400, &maWW8_FFN[2] ); // don't know any better
778  // 400 == FW_NORMAL (windows.h)
779 
780  //#i61927# For unicode fonts like Arial Unicode, Word 97+ sets the chs
781  //to SHIFTJIS presumably to capture that it's a multi-byte encoding font
782  //but Word95 doesn't do this, and sets it to 0 (ANSI), so we should do the
783  //same
785 
786  if (mbAlt)
787  maWW8_FFN[5] = static_cast< sal_uInt8 >(msFamilyNm.getLength() + 1);
788 }
789 
790 void wwFont::Write(SvStream *pTableStrm) const
791 {
792  pTableStrm->WriteBytes(maWW8_FFN, sizeof(maWW8_FFN)); // fixed part
793  // from Ver8 following two fields intersected,
794  // we ignore them.
795  //char panose[ 10 ]; // 0x6 PANOSE
796  //char fs[ 24 ]; // 0x10 FONTSIGNATURE
797  SwWW8Writer::FillCount(*pTableStrm, 0x22);
798  SwWW8Writer::WriteString16(*pTableStrm, msFamilyNm, true);
799  if (mbAlt)
800  SwWW8Writer::WriteString16(*pTableStrm, msAltNm, true);
801 }
802 
803 void wwFont::WriteDocx( DocxAttributeOutput* rAttrOutput ) const
804 {
805  // no font embedding, panose id, subsetting, ... implemented
806 
807  if (!msFamilyNm.isEmpty())
808  {
809  rAttrOutput->StartFont( msFamilyNm );
810 
811  if ( mbAlt )
812  rAttrOutput->FontAlternateName( msAltNm );
814  rAttrOutput->FontFamilyType( meFamily );
815  rAttrOutput->FontPitchType( mePitch );
816  rAttrOutput->EmbedFont( msFamilyNm, meFamily, mePitch );
817 
818  rAttrOutput->EndFont();
819  }
820 }
821 
822 void wwFont::WriteRtf( const RtfAttributeOutput* rAttrOutput ) const
823 {
824  rAttrOutput->FontFamilyType( meFamily, *this );
825  rAttrOutput->FontPitchType( mePitch );
826  rAttrOutput->FontCharset(
828  rAttrOutput->StartFont( msFamilyNm );
829  if ( mbAlt )
830  rAttrOutput->FontAlternateName( msAltNm );
831  rAttrOutput->EndFont();
832 }
833 
834 bool operator<(const wwFont &r1, const wwFont &r2)
835 {
836  int nRet = memcmp(r1.maWW8_FFN, r2.maWW8_FFN, sizeof(r1.maWW8_FFN));
837  if (nRet == 0)
838  {
839  nRet = r1.msFamilyNm.compareTo(r2.msFamilyNm);
840  if (nRet == 0)
841  nRet = r1.msAltNm.compareTo(r2.msAltNm);
842  }
843  return nRet < 0;
844 }
845 
846 sal_uInt16 wwFontHelper::GetId(const wwFont &rFont)
847 {
848  sal_uInt16 nRet;
849  std::map<wwFont, sal_uInt16>::const_iterator aIter = maFonts.find(rFont);
850  if (aIter != maFonts.end())
851  nRet = aIter->second;
852  else
853  {
854  nRet = static_cast< sal_uInt16 >(maFonts.size());
855  maFonts[rFont] = nRet;
856  }
857  return nRet;
858 }
859 
861 {
862  GetId(wwFont("Times New Roman", PITCH_VARIABLE,
863  FAMILY_ROMAN, RTL_TEXTENCODING_MS_1252));
864 
866  RTL_TEXTENCODING_SYMBOL));
867 
869  RTL_TEXTENCODING_MS_1252));
870 
871  const SvxFontItem* pFont = GetDfltAttr(RES_CHRATR_FONT);
872 
873  GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(),
874  pFont->GetFamily(), pFont->GetCharSet()));
875 
876  const SfxItemPool& rPool = rDoc.GetAttrPool();
877  if (nullptr != (pFont = rPool.GetPoolDefaultItem(RES_CHRATR_FONT)))
878  {
879  GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(),
880  pFont->GetFamily(), pFont->GetCharSet()));
881  }
882 
883  if (!bLoadAllFonts)
884  return;
885 
886  const sal_uInt16 aTypes[] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT, 0 };
887  for (const sal_uInt16* pId = aTypes; *pId; ++pId)
888  {
889  for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(*pId))
890  {
891  pFont = static_cast<const SvxFontItem*>(pItem);
892  GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(),
893  pFont->GetFamily(), pFont->GetCharSet()));
894  }
895  }
896 }
897 
898 sal_uInt16 wwFontHelper::GetId(const SvxFontItem& rFont)
899 {
900  wwFont aFont(rFont.GetFamilyName(), rFont.GetPitch(), rFont.GetFamily(),
901  rFont.GetCharSet());
902  return GetId(aFont);
903 }
904 
905 std::vector< const wwFont* > wwFontHelper::AsVector() const
906 {
907  std::vector<const wwFont *> aFontList( maFonts.size() );
908 
909  for ( const auto& aFont : maFonts )
910  aFontList[aFont.second] = &aFont.first;
911 
912  return aFontList;
913 }
914 
915 void wwFontHelper::WriteFontTable(SvStream *pTableStream, WW8Fib& rFib)
916 {
917  rFib.m_fcSttbfffn = pTableStream->Tell();
918  /*
919  * Reserve some space to fill in the len after we know how big it is
920  */
921  SwWW8Writer::WriteLong(*pTableStream, 0);
922 
923  /*
924  * Convert from fast insertion map to linear vector in the order that we
925  * want to write.
926  */
927  std::vector<const wwFont *> aFontList( AsVector() );
928 
929  /*
930  * Write them all to pTableStream
931  */
932  for ( auto aFont : aFontList )
933  aFont->Write(pTableStream);
934 
935  /*
936  * Write the position and len in the FIB
937  */
938  rFib.m_lcbSttbfffn = pTableStream->Tell() - rFib.m_fcSttbfffn;
939  SwWW8Writer::WriteLong( *pTableStream, rFib.m_fcSttbfffn, maFonts.size());
940 }
941 
943 {
944  std::vector<const wwFont *> aFontList( AsVector() );
945 
946  for ( auto aFont : aFontList )
947  aFont->WriteDocx(&rAttrOutput);
948 }
949 
951 {
952  std::vector<const wwFont *> aFontList( AsVector() );
953 
954  for ( auto aFont : aFontList )
955  aFont->WriteRtf(&rAttrOutput);
956 }
957 
959  : nOfs( nOffset )
960 {
961 }
962 
963 void WW8_WrPlc0::Append( sal_uLong nStartCpOrFc )
964 {
965  aPos.push_back( nStartCpOrFc - nOfs );
966 }
967 
969 {
970  for( const auto& rPos : aPos )
971  {
972  rStrm.WriteUInt32(rPos);
973  }
974 }
975 
976 // class MSWordSections : translate PageDescs into Sections
977 // also deals with header and footer
978 
980  : mbDocumentIsProtected( false )
981 {
982  const SwSectionFormat *pFormat = nullptr;
983  rExport.m_pCurrentPageDesc = &rExport.m_pDoc->GetPageDesc( 0 );
984 
985  const SfxPoolItem* pI;
986  const SwNode* pNd = rExport.m_pCurPam->GetContentNode();
987  const SfxItemSet* pSet = pNd ? &static_cast<const SwContentNode*>(pNd)->GetSwAttrSet() : nullptr;
988 
989  sal_uLong nRstLnNum = pSet ? pSet->Get( RES_LINENUMBER ).GetStartValue() : 0;
990 
991  const SwTableNode* pTableNd = rExport.m_pCurPam->GetNode().FindTableNode();
992  const SwSectionNode* pSectNd = nullptr;
993  if ( pTableNd )
994  {
995  pSet = &pTableNd->GetTable().GetFrameFormat()->GetAttrSet();
996  pNd = pTableNd;
997  }
998  else if (pNd && nullptr != ( pSectNd = pNd->FindSectionNode() ))
999  {
1000  if ( SectionType::ToxHeader == pSectNd->GetSection().GetType() &&
1001  pSectNd->StartOfSectionNode()->IsSectionNode() )
1002  {
1003  pSectNd = pSectNd->StartOfSectionNode()->GetSectionNode();
1004  }
1005 
1006  if ( SectionType::ToxContent == pSectNd->GetSection().GetType() )
1007  {
1008  pNd = pSectNd;
1009  rExport.m_pCurPam->GetPoint()->nNode = *pNd;
1010  }
1011 
1012  if ( SectionType::Content == pSectNd->GetSection().GetType() )
1013  pFormat = pSectNd->GetSection().GetFormat();
1014  }
1015 
1016  // tdf#118393: FILESAVE: DOCX Export loses header/footer
1017  rExport.m_bFirstTOCNodeWithSection = pSectNd &&
1018  ( SectionType::ToxHeader == pSectNd->GetSection().GetType() ||
1019  SectionType::ToxContent == pSectNd->GetSection().GetType() );
1020 
1021  // Try to get page descriptor of the first node
1022  if ( pSet &&
1023  SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC, true, &pI ) &&
1024  static_cast<const SwFormatPageDesc*>(pI)->GetPageDesc() )
1025  {
1026  AppendSection( *static_cast<const SwFormatPageDesc*>(pI), *pNd, pFormat, nRstLnNum );
1027  }
1028  else
1029  AppendSection( rExport.m_pCurrentPageDesc, pFormat, nRstLnNum, /*bIsFirstParagraph=*/true );
1030 }
1031 
1033  : MSWordSections( rExport )
1034  , m_bHeaderFooterWritten( false )
1035 {
1036  // to be in sync with the AppendSection() call in the MSWordSections
1037  // constructor
1038  aCps.push_back( 0 );
1039 }
1040 
1042 {
1043 }
1044 
1046 {
1047 }
1048 
1050 {
1051  return false; // only relevant for WW8
1052 }
1053 
1055 {
1056  return m_bHeaderFooterWritten;
1057 }
1058 
1059 sal_uInt16 MSWordSections::CurrentNumberOfColumns( const SwDoc &rDoc ) const
1060 {
1061  OSL_ENSURE( !aSects.empty(), "no segment inserted yet" );
1062  if ( aSects.empty() )
1063  return 1;
1064 
1065  return NumberOfColumns( rDoc, aSects.back() );
1066 }
1067 
1068 sal_uInt16 MSWordSections::NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo& rInfo )
1069 {
1070  const SwPageDesc* pPd = rInfo.pPageDesc;
1071  if ( !pPd )
1072  pPd = &rDoc.GetPageDesc( 0 );
1073 
1074  const SfxItemSet &rSet = pPd->GetMaster().GetAttrSet();
1075  SfxItemSet aSet( *rSet.GetPool(), svl::Items<RES_COL, RES_COL>{} );
1076  aSet.SetParent( &rSet );
1077 
1078  //0xffffffff, what the hell is going on with that!, fixme most terribly
1079  if ( rInfo.pSectionFormat && reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) != rInfo.pSectionFormat )
1080  aSet.Put( rInfo.pSectionFormat->GetFormatAttr( RES_COL ) );
1081 
1082  const SwFormatCol& rCol = aSet.Get( RES_COL );
1083  const SwColumns& rColumns = rCol.GetColumns();
1084  return rColumns.size();
1085 }
1086 
1088 {
1089  if ( !aSects.empty() )
1090  return &aSects.back();
1091 
1092  return nullptr;
1093 }
1094 
1096  const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo, bool bIsFirstParagraph )
1097 {
1098  if (HeaderFooterWritten()) {
1099  return; // #i117955# prevent new sections in endnotes
1100  }
1101  aSects.emplace_back( pPd, pSectionFormat, nLnNumRestartNo, std::nullopt, nullptr, bIsFirstParagraph );
1102  NeedsDocumentProtected( aSects.back() );
1103 }
1104 
1105 void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwPageDesc* pPd,
1106  const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo )
1107 {
1108  if (HeaderFooterWritten()) {
1109  return; // #i117955# prevent new sections in endnotes
1110  }
1111  aCps.push_back( nStartCp );
1112  AppendSection( pPd, pSectionFormat, nLnNumRestartNo );
1113 }
1114 
1116  const SwNode& rNd, const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo )
1117 {
1118  if (HeaderFooterWritten()) {
1119  return; // #i117955# prevent new sections in endnotes
1120  }
1121 
1122  WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFormat, nLnNumRestartNo, rPD.GetNumOffset(), &rNd );
1123 
1124  aSects.push_back( aI );
1125  NeedsDocumentProtected( aI );
1126 }
1127 
1129  const SwNode& rNd, const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo )
1130 {
1131  if (HeaderFooterWritten()) {
1132  return; // #i117955# prevent new sections in endnotes
1133  }
1134  aCps.push_back( nStartCp );
1135  AppendSection( rPD, rNd, pSectionFormat, nLnNumRestartNo );
1136 }
1137 
1139 {
1140  sal_uInt8 nInfoFlags = 0;
1141  const SwFootnoteInfo& rInfo = rWrt.m_pDoc->GetFootnoteInfo();
1142  if( !rInfo.m_aErgoSum.isEmpty() ) nInfoFlags |= 0x02;
1143  if( !rInfo.m_aQuoVadis.isEmpty() ) nInfoFlags |= 0x04;
1144 
1145  sal_uInt8 nEmptyStt = 0;
1146  if( nInfoFlags )
1147  {
1148  pTextPos->Append( nCpStt ); // empty footnote separator
1149 
1150  if( 0x02 & nInfoFlags ) // Footnote continuation separator
1151  {
1152  pTextPos->Append( nCpStt );
1153  rWrt.WriteStringAsPara( rInfo.m_aErgoSum );
1154  rWrt.WriteStringAsPara( OUString() );
1155  nCpStt = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1156  }
1157  else
1158  pTextPos->Append( nCpStt );
1159 
1160  if( 0x04 & nInfoFlags ) // Footnote continuation notice
1161  {
1162  pTextPos->Append( nCpStt );
1163  rWrt.WriteStringAsPara( rInfo.m_aQuoVadis );
1164  rWrt.WriteStringAsPara( OUString() );
1165  nCpStt = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1166  }
1167  else
1168  pTextPos->Append( nCpStt );
1169 
1170  nEmptyStt = 3;
1171  }
1172 
1173  while( 6 > nEmptyStt++ )
1174  pTextPos->Append( nCpStt );
1175 
1176  // set the flags at the Dop right away
1177  WW8Dop& rDop = *rWrt.pDop;
1178  // Footnote Info
1179  switch( rInfo.m_eNum )
1180  {
1181  case FTNNUM_PAGE: rDop.rncFootnote = 2; break;
1182  case FTNNUM_CHAPTER: rDop.rncFootnote = 1; break;
1183  default: rDop.rncFootnote = 0; break;
1184  } // rncFootnote
1186  rDop.nFootnote = rInfo.m_nFootnoteOffset + 1;
1187  rDop.fpc = rWrt.m_bFootnoteAtTextEnd ? 2 : 1;
1188 
1189  // Endnote Info
1190  rDop.rncEdn = 0; // rncEdn: Don't Restart
1191  const SwEndNoteInfo& rEndInfo = rWrt.m_pDoc->GetEndNoteInfo();
1193  rDop.nEdn = rEndInfo.m_nFootnoteOffset + 1;
1194  rDop.epc = rWrt.m_bEndAtTextEnd ? 3 : 0;
1195 }
1196 
1197 void MSWordSections::SetHeaderFlag( sal_uInt8& rHeadFootFlags, const SwFormat& rFormat,
1198  sal_uInt8 nFlag )
1199 {
1200  const SfxPoolItem* pItem;
1201  if( SfxItemState::SET == rFormat.GetItemState(RES_HEADER, true, &pItem)
1202  && static_cast<const SwFormatHeader*>(pItem)->IsActive() &&
1203  static_cast<const SwFormatHeader*>(pItem)->GetHeaderFormat() )
1204  rHeadFootFlags |= nFlag;
1205 }
1206 
1207 void MSWordSections::SetFooterFlag( sal_uInt8& rHeadFootFlags, const SwFormat& rFormat,
1208  sal_uInt8 nFlag )
1209 {
1210  const SfxPoolItem* pItem;
1211  if( SfxItemState::SET == rFormat.GetItemState(RES_FOOTER, true, &pItem)
1212  && static_cast<const SwFormatFooter*>(pItem)->IsActive() &&
1213  static_cast<const SwFormatFooter*>(pItem)->GetFooterFormat() )
1214  rHeadFootFlags |= nFlag;
1215 }
1216 
1217 void WW8_WrPlcSepx::OutHeaderFooter( WW8Export& rWrt, bool bHeader,
1218  const SwFormat& rFormat, sal_uLong& rCpPos, sal_uInt8 nHFFlags,
1219  sal_uInt8 nFlag, sal_uInt8 nBreakCode)
1220 {
1221  if ( nFlag & nHFFlags )
1222  {
1223  pTextPos->Append( rCpPos );
1224  rWrt.WriteHeaderFooterText( rFormat, bHeader);
1225  rWrt.WriteStringAsPara( OUString() ); // CR to the end ( otherwise WW complains )
1226  rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1227  }
1228  else
1229  {
1230  pTextPos->Append( rCpPos );
1231  if ((bHeader? rWrt.m_bHasHdr : rWrt.m_bHasFtr) && nBreakCode!=0)
1232  {
1233  rWrt.WriteStringAsPara( OUString() ); // Empty paragraph for empty header/footer
1234  rWrt.WriteStringAsPara( OUString() ); // a CR that WW8 needs for end of the stream
1235  rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1236  }
1237  }
1238 }
1239 
1241 {
1242  if (rInfo.IsProtected())
1243  mbDocumentIsProtected = true;
1244 }
1245 
1247 {
1248  bool bRet = false;
1249  if (
1250  pSectionFormat &&
1251  (reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) != pSectionFormat)
1252  )
1253  {
1254  const SwSection *pSection = pSectionFormat->GetSection();
1255  if (pSection && pSection->IsProtect())
1256  {
1257  bRet = true;
1258  }
1259  }
1260  return bRet;
1261 }
1262 
1264 {
1265  // 2 values getting set
1266  // Dop.fFacingPages == Header and Footer different
1267  // Dop.fSwapBordersFacingPgs == mirrored borders
1268  sal_uInt16 nEnde = 0;
1269  for( const WW8_SepInfo& rSepInfo : aSects )
1270  {
1271  if( !rSepInfo.pSectionFormat )
1272  {
1273  const SwPageDesc* pPd = rSepInfo.pPageDesc;
1274  if( pPd->GetFollow() && pPd != pPd->GetFollow() &&
1275  pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
1276  rSepInfo.pPDNd &&
1277  pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd ) )
1278  // so this is first page and subsequent, so only respect follow
1279  pPd = pPd->GetFollow();
1280 
1281  // left-/right chain of pagedescs ?
1282  else if( !( 1 & nEnde ) &&
1283  pPd->GetFollow() && pPd != pPd->GetFollow() &&
1284  pPd->GetFollow()->GetFollow() == pPd &&
1285  (( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1286  UseOnPage::Right == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ||
1287  ( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1288  UseOnPage::Left == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ))
1289  {
1290  rWrt.pDop->fFacingPages = rWrt.pDop->fMirrorMargins = true;
1291  nEnde |= 1;
1292  }
1293 
1294  if( !( 1 & nEnde ) &&
1295  ( !pPd->IsHeaderShared() || !pPd->IsFooterShared() ))
1296  {
1297  rWrt.pDop->fFacingPages = true;
1298  nEnde |= 1;
1299  }
1300  if( !( 2 & nEnde ) &&
1302  {
1303  rWrt.pDop->fSwapBordersFacingPgs =
1304  rWrt.pDop->fMirrorMargins = true;
1305  nEnde |= 2;
1306  }
1307 
1308  if( 3 == nEnde )
1309  break; // We do not need to go any further
1310  }
1311  }
1312 }
1313 
1315 {
1316  const SfxPoolItem* pItem;
1317  return SfxItemState::SET == rFormat.GetItemState(RES_BOX, true, &pItem) &&
1318  ( static_cast<const SvxBoxItem*>(pItem)->GetTop() ||
1319  static_cast<const SvxBoxItem*>(pItem)->GetBottom() ||
1320  static_cast<const SvxBoxItem*>(pItem)->GetLeft() ||
1321  static_cast<const SvxBoxItem*>(pItem)->GetRight() );
1322 }
1323 
1325 {
1326  m_rWW8Export.pO->clear();
1327 }
1328 
1330 {
1332  const SwEndNoteInfo& rEndNoteInfo = m_rWW8Export.m_pDoc->GetEndNoteInfo();
1334  switch( rInfo.m_eNum )
1335  {
1336  case FTNNUM_PAGE: m_rWW8Export.pO->push_back( sal_uInt8/*rncRstPage*/ (2) ); break;
1337  case FTNNUM_CHAPTER: m_rWW8Export.pO->push_back( sal_uInt8/*rncRstSect*/ (1) ); break;
1338  default: m_rWW8Export.pO->push_back( sal_uInt8/*rncCont*/ (0) ); break;
1339  }
1340 
1345  nId = WW8Export::GetNumId(rEndNoteInfo.m_aFormat.GetNumberingType());
1347 }
1348 
1350 {
1351  //If the document is to be exported as protected, then if a segment
1352  //is not protected, set the unlocked flag
1353  if ( m_rWW8Export.pSepx->DocumentIsProtected() && !bProtected )
1354  {
1356  m_rWW8Export.pO->push_back( 1 );
1357  }
1358 }
1359 
1361 {
1362  // sprmSNLnnMod - activate Line Numbering and define Modulo
1365 
1366  // sprmSDxaLnn - xPosition of Line Number
1369 
1370  // sprmSLnc - restart number: 0 per page, 1 per section, 2 never restart
1371  if ( nRestartNo || !rLnNumInfo.IsRestartEachPage() )
1372  {
1374  m_rWW8Export.pO->push_back( nRestartNo ? 1 : 2 );
1375  }
1376 
1377  // sprmSLnnMin - Restart the Line Number with given value
1378  if ( nRestartNo )
1379  {
1381  SwWW8Writer::InsUInt16( *m_rWW8Export.pO, static_cast<sal_uInt16>(nRestartNo) - 1 );
1382  }
1383 }
1384 
1386 {
1387  // sprmSFTitlePage
1389  m_rWW8Export.pO->push_back( 1 );
1390 }
1391 
1392 void WW8AttributeOutput::SectionPageBorders( const SwFrameFormat* pPdFormat, const SwFrameFormat* pPdFirstPgFormat )
1393 {
1394  // write border of page
1395  sal_uInt16 nPgBorder = MSWordSections::HasBorderItem( *pPdFormat ) ? 0 : USHRT_MAX;
1396  if ( pPdFormat != pPdFirstPgFormat )
1397  {
1398  if ( MSWordSections::HasBorderItem( *pPdFirstPgFormat ) )
1399  {
1400  if ( USHRT_MAX == nPgBorder )
1401  {
1402  nPgBorder = 1;
1403  // only the first page outlined -> Get the BoxItem from the correct format
1404  m_rWW8Export.m_pISet = &pPdFirstPgFormat->GetAttrSet();
1405  OutputItem( pPdFirstPgFormat->GetFormatAttr( RES_BOX ) );
1406  }
1407  }
1408  else if ( !nPgBorder )
1409  nPgBorder = 2;
1410  }
1411 
1412  // [MS-DOC] 2.9.255 SPgbPropOperand; 2.9.185 PgbOffsetFrom
1413  if (m_bFromEdge)
1414  nPgBorder |= (1<<5);
1415 
1416  if ( USHRT_MAX != nPgBorder )
1417  {
1418  // write the Flag and Border Attribute
1420  SwWW8Writer::InsUInt16( *m_rWW8Export.pO, nPgBorder );
1421  }
1422 }
1423 
1425 {
1427  m_rWW8Export.pO->push_back( bBiDi? 1: 0 );
1428 }
1429 
1430 void WW8AttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, const ::std::optional<sal_uInt16>& oPageRestartNumber )
1431 {
1432  // sprmSNfcPgn
1433  sal_uInt8 nb = WW8Export::GetNumId( nNumType );
1435  m_rWW8Export.pO->push_back( nb );
1436 
1437  if ( oPageRestartNumber )
1438  {
1439  // sprmSFPgnRestart
1441  m_rWW8Export.pO->push_back( 1 );
1442 
1443  // sprmSPgnStart
1445  SwWW8Writer::InsUInt16( *m_rWW8Export.pO, *oPageRestartNumber );
1446  }
1447 }
1448 
1450 {
1451  if ( 2 != nBreakCode ) // new page is the default
1452  {
1454  m_rWW8Export.pO->push_back( nBreakCode );
1455  }
1456 }
1457 
1459 {
1460  if ( !pA )
1461  return;
1462 
1463  if ( !pO->empty() ) // are there attributes ?
1464  {
1465  pA->m_nLen = pO->size();
1466  pA->m_pData.reset(new sal_uInt8 [pO->size()]);
1467  // store for later
1468  memcpy( pA->m_pData.get(), pO->data(), pO->size() );
1469  pO->clear(); // clear HdFt-Text
1470  }
1471  else // no attributes there
1472  {
1473  pA->m_pData.reset();
1474  pA->m_nLen = 0;
1475  }
1476 }
1477 
1478 void WW8AttributeOutput::TextVerticalAdjustment( const drawing::TextVerticalAdjust nVA )
1479 {
1480  if ( drawing::TextVerticalAdjust_TOP != nVA ) // top alignment is the default
1481  {
1482  sal_uInt8 nMSVA = 0;
1483  switch( nVA )
1484  {
1485  case drawing::TextVerticalAdjust_CENTER:
1486  nMSVA = 1;
1487  break;
1488  case drawing::TextVerticalAdjust_BOTTOM: //Writer = 2, Word = 3
1489  nMSVA = 3;
1490  break;
1491  case drawing::TextVerticalAdjust_BLOCK: //Writer = 3, Word = 2
1492  nMSVA = 2;
1493  break;
1494  default:
1495  break;
1496  }
1498  m_rWW8Export.pO->push_back( nMSVA );
1499  }
1500 }
1501 
1503  const SwFrameFormat& rFormat, const SwFrameFormat& rLeftFormat, const SwFrameFormat& rFirstPageFormat, sal_uInt8 nBreakCode )
1504 {
1505  sal_uLong nCpPos = Fc2Cp( Strm().Tell() );
1506 
1508  if ( !(nHeadFootFlags & WW8_HEADER_EVEN) && pDop->fFacingPages )
1509  pSepx->OutHeaderFooter( *this, true, rFormat, nCpPos, nHeadFootFlags, WW8_HEADER_ODD, nBreakCode );
1510  else
1511  pSepx->OutHeaderFooter( *this, true, rLeftFormat, nCpPos, nHeadFootFlags, WW8_HEADER_EVEN, nBreakCode );
1513  pSepx->OutHeaderFooter( *this, true, rFormat, nCpPos, nHeadFootFlags, WW8_HEADER_ODD, nBreakCode );
1514 
1516  if ( !(nHeadFootFlags & WW8_FOOTER_EVEN) && pDop->fFacingPages )
1517  pSepx->OutHeaderFooter( *this, false, rFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD, nBreakCode );
1518  else
1519  pSepx->OutHeaderFooter( *this, false, rLeftFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_EVEN, nBreakCode );
1521  pSepx->OutHeaderFooter( *this, false, rFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD, nBreakCode );
1522 
1523  //#i24344# Drawing objects cannot be directly shared between main hd/ft
1524  //and title hd/ft so we need to differentiate them
1526  pSepx->OutHeaderFooter( *this, true, rFirstPageFormat, nCpPos, nHeadFootFlags, WW8_HEADER_FIRST, nBreakCode );
1527  pSepx->OutHeaderFooter( *this, false, rFirstPageFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_FIRST, nBreakCode );
1528 }
1529 
1530 namespace
1531 {
1536 bool UsePrevSectionNextStyle(sal_uInt8 nBreakCode, const SwPageDesc* pPd,
1537  const WW8_SepInfo& rSepInfo)
1538 {
1539  if (nBreakCode != 0)
1540  {
1541  // Not a continuous section break.
1542  return false;
1543  }
1544 
1545  if (!pPd->GetFollow())
1546  {
1547  // Page style has no follow style.
1548  return false;
1549  }
1550 
1551  // We start a continuous section break without headers/footers. Possibly the importer had
1552  // headers/footers for this section break and put them to the closest page break's page style's
1553  // next page style. See "find a node in the section that has a page break" in writerfilter/.
1554  // Try the last-in-practice paragraph of the previous section.
1555  const SwSectionFormat* pSection = rSepInfo.pSectionFormat;
1556  if (pSection == reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)))
1557  {
1558  return false;
1559  }
1560 
1561  const SwNodeIndex* pSectionStart = pSection->GetContent().GetContentIdx();
1562  if (!pSectionStart)
1563  {
1564  return false;
1565  }
1566 
1567  SwPaM aPaM(*pSectionStart);
1568  aPaM.Move(fnMoveBackward);
1569  if (!aPaM.GetNode().IsTextNode())
1570  {
1571  return false;
1572  }
1573 
1574  SwTextNode* pTextNode = aPaM.GetNode().GetTextNode();
1575  const SwAttrSet* pParaProps = &pTextNode->GetSwAttrSet();
1576  sal_uInt32 nCharHeight = pParaProps->GetSize().GetHeight();
1577  if (nCharHeight > 20)
1578  {
1579  return false;
1580  }
1581 
1582  aPaM.Move(fnMoveBackward);
1583  if (!aPaM.GetNode().IsTextNode())
1584  {
1585  return false;
1586  }
1587 
1588  pTextNode = aPaM.GetNode().GetTextNode();
1589  pParaProps = &pTextNode->GetSwAttrSet();
1590  return pParaProps->HasItem(RES_PAGEDESC);
1591 }
1592 }
1593 
1595 {
1596  const SwPageDesc* pPd = rSepInfo.pPageDesc;
1597 
1598  if ( rSepInfo.pSectionFormat && !pPd )
1599  pPd = &m_pDoc->GetPageDesc( 0 );
1600 
1601  m_pCurrentPageDesc = pPd;
1602 
1603  if ( !pPd )
1604  return;
1605 
1606  bool bOldPg = m_bOutPageDescs;
1607  m_bOutPageDescs = true;
1608 
1610 
1612 
1613  // forms
1615 
1616  // line numbers
1617  const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo();
1618  if ( rLnNumInfo.IsPaintLineNumbers() )
1619  AttrOutput().SectionLineNumbering( rSepInfo.nLnNumRestartNo, rLnNumInfo );
1620 
1621  /* sprmSBkc, break code: 0 No break, 1 New column
1622  2 New page, 3 Even page, 4 Odd page
1623  */
1624  sal_uInt8 nBreakCode = 2; // default start new page
1625  bool bOutPgDscSet = true, bLeftRightPgChain = false, bOutputStyleItemSet = false;
1626  bool bEnsureHeaderFooterWritten = rSepInfo.pSectionFormat && rSepInfo.bIsFirstParagraph;
1627  const SwFrameFormat* pPdFormat = &pPd->GetMaster();
1628  bool bUsePrevSectionNextStyle = false;
1629  if ( rSepInfo.pSectionFormat )
1630  {
1631  // if pSectionFormat is set, then there is a SectionNode
1632  // valid pointer -> start Section ,
1633  // 0xfff -> Section terminated
1634  nBreakCode = 0; // consecutive section
1635 
1636  if ( rSepInfo.pPDNd && rSepInfo.pPDNd->IsContentNode() )
1637  {
1638  if ( !NoPageBreakSection( &rSepInfo.pPDNd->GetContentNode()->GetSwAttrSet() ) )
1639  {
1640  nBreakCode = 2;
1641  }
1642  }
1643 
1644  if ( reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) == rSepInfo.pSectionFormat )
1645  bEnsureHeaderFooterWritten |= !rSepInfo.pPDNd && GetExportFormat() != ExportFormat::RTF;
1646  else
1647  {
1648  if ( nBreakCode == 0 )
1649  bOutPgDscSet = false;
1650 
1651  // produce Itemset, which inherits PgDesk-Attr-Set:
1652  // as child also the parent is searched if 'deep'-OutputItemSet
1653  const SfxItemSet* pPdSet = &pPdFormat->GetAttrSet();
1654 
1655  bUsePrevSectionNextStyle = GetExportFormat() == ExportFormat::DOCX
1656  && UsePrevSectionNextStyle(nBreakCode, pPd, rSepInfo);
1657  if (bUsePrevSectionNextStyle)
1658  {
1659  // Take page margins from the previous section's next style.
1660  pPdSet = &pPd->GetFollow()->GetMaster().GetAttrSet();
1661  }
1662 
1663  SfxItemSet aSet( *pPdSet->GetPool(), pPdSet->GetRanges() );
1664  aSet.SetParent( pPdSet );
1665 
1666  // at the child ONLY change column structure according to Sect-Attr.
1667 
1668  const SvxLRSpaceItem &rSectionLR =
1669  ItemGet<SvxLRSpaceItem>( *(rSepInfo.pSectionFormat), RES_LR_SPACE );
1670  const SvxLRSpaceItem &rPageLR =
1671  ItemGet<SvxLRSpaceItem>( *pPdFormat, RES_LR_SPACE );
1672 
1673  SvxLRSpaceItem aResultLR( rPageLR.GetLeft() +
1674  rSectionLR.GetLeft(), rPageLR.GetRight() +
1675  rSectionLR.GetRight(), 0, 0, RES_LR_SPACE );
1676  //i120133: The Section width should consider section indent value.
1677  if (rSectionLR.GetLeft()+rSectionLR.GetRight()!=0)
1678  {
1679  const SwFormatCol& rCol = dynamic_cast<const SwFormatCol&>(rSepInfo.pSectionFormat->GetFormatAttr(RES_COL));
1680  SwFormatCol aCol(rCol);
1681  aCol.SetAdjustValue(rSectionLR.GetLeft()+rSectionLR.GetRight());
1682  aSet.Put(aCol);
1683  }
1684  else
1685  aSet.Put(rSepInfo.pSectionFormat->GetFormatAttr(RES_COL));
1686 
1687  aSet.Put( aResultLR );
1688 
1689  // and write into the WW-File
1690  const SfxItemSet* pOldI = m_pISet;
1691  m_pISet = &aSet;
1692 
1693  // Switch off test on default item values, if page description
1694  // set (value of <bOutPgDscSet>) isn't written.
1695  AttrOutput().OutputStyleItemSet( aSet, bOutPgDscSet );
1696  bOutputStyleItemSet = true;
1697 
1698  //Cannot export as normal page framedir, as continuous sections
1699  //cannot contain any grid settings like proper sections
1700  AttrOutput().SectionBiDi( SvxFrameDirection::Horizontal_RL_TB == TrueFrameDirection( *rSepInfo.pSectionFormat ) );
1701 
1702  m_pISet = pOldI;
1703  }
1704  }
1705 
1706  // Libreoffice 4.0 introduces support for page styles (SwPageDesc) with
1707  // a different header/footer for the first page. The same effect can be
1708  // achieved by chaining two page styles together (SwPageDesc::GetFollow)
1709  // which are identical except for header/footer.
1710  // The latter method was previously used by the doc/docx import filter.
1711  // In both of these cases, we emit a single Word section with different
1712  // first page header/footer.
1713  const SwFrameFormat* pPdFirstPgFormat = &pPd->GetFirstMaster();
1714  bool titlePage = !pPd->IsFirstShared();
1715  if ( bOutPgDscSet )
1716  {
1717  // if a Follow is set and it does not point to itself,
1718  // then there is a page chain.
1719  // If this emulates a "first page", we can detect it here and write
1720  // it as title page.
1721  // With Left/Right changes it's different - we have to detect where
1722  // the change of pages is, but here it's too late for that!
1723  // tdf#101814 if there is already an explicit first-page, no point
1724  // in checking heuristics here.
1725  if ( !titlePage && pPd->GetFollow() && pPd != pPd->GetFollow() &&
1726  pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
1727  pPd->IsHeaderShared() && pPd->IsFooterShared() &&
1728  ( !rSepInfo.pPDNd || pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd ) ) )
1729  {
1730  const SwPageDesc *pFollow = pPd->GetFollow();
1731  const SwFrameFormat& rFollowFormat = pFollow->GetMaster();
1732  if (sw::util::IsPlausableSingleWordSection(*pPdFirstPgFormat, rFollowFormat))
1733  {
1734  if (rSepInfo.pPDNd)
1735  pPdFirstPgFormat = pPd->GetPageFormatOfNode( *rSepInfo.pPDNd );
1736  else
1737  pPdFirstPgFormat = &pPd->GetMaster();
1738 
1739  m_pCurrentPageDesc = pPd = pFollow;
1740  pPdFormat = &rFollowFormat;
1741 
1742  // has different headers/footers for the title page
1743  titlePage = true;
1744  }
1745  }
1746 
1747  if( titlePage )
1749 
1750  const SfxItemSet* pOldI = m_pISet;
1751 
1752  const SfxPoolItem* pItem;
1753  if ( titlePage && SfxItemState::SET ==
1754  pPdFirstPgFormat->GetItemState( RES_PAPER_BIN, true, &pItem ) )
1755  {
1756  m_pISet = &pPdFirstPgFormat->GetAttrSet();
1757  m_bOutFirstPage = true;
1758  AttrOutput().OutputItem( *pItem );
1759  m_bOutFirstPage = false;
1760  }
1761 
1762  // left-/right chain of pagedescs ?
1763  if ( pPd->GetFollow() && pPd != pPd->GetFollow() &&
1764  pPd->GetFollow()->GetFollow() == pPd &&
1765  (( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1766  UseOnPage::Right == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ||
1767  ( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1768  UseOnPage::Left == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ))
1769  {
1770  bLeftRightPgChain = true;
1771 
1772  // which is the reference point? (left or right?)
1773  // assume it is on the right side!
1774  if ( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) )
1775  {
1776  nBreakCode = 3;
1777  pPd = pPd->GetFollow();
1778  pPdFormat = &pPd->GetMaster();
1779  }
1780  else
1781  nBreakCode = 4;
1782  }
1783 
1784  m_pISet = &pPdFormat->GetAttrSet();
1785  if (!bOutputStyleItemSet)
1786  AttrOutput().OutputStyleItemSet( pPdFormat->GetAttrSet(), false );
1787  AttrOutput().SectionPageBorders( pPdFormat, pPdFirstPgFormat );
1788  m_pISet = pOldI;
1789 
1790  // then the rest of the settings from PageDesc
1792 
1793  // will it be only left or only right pages?
1794  if ( 2 == nBreakCode )
1795  {
1796  if ( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) )
1797  nBreakCode = 3;
1798  else if ( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) )
1799  nBreakCode = 4;
1800  }
1801  }
1802 
1803  AttrOutput().SectionType( nBreakCode );
1804 
1805  if( rSepInfo.pPageDesc ) {
1807  }
1808 
1809  // Header or Footer
1810  sal_uInt8 nHeadFootFlags = 0;
1811 
1812  const SwFrameFormat* pPdLeftFormat = bLeftRightPgChain
1813  ? &pPd->GetFollow()->GetMaster()
1814  : &pPd->GetLeft();
1815 
1816  // Ensure that headers are written if section is first paragraph
1817  if ( nBreakCode != 0 || bEnsureHeaderFooterWritten )
1818  {
1819  if ( titlePage )
1820  {
1821  // there is a First Page:
1822  MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFormat, WW8_HEADER_FIRST );
1823  MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFirstPgFormat, WW8_FOOTER_FIRST );
1824  }
1825  MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFormat, WW8_HEADER_ODD );
1826  MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFormat, WW8_FOOTER_ODD );
1827 
1828  if ( !pPd->IsHeaderShared() || bLeftRightPgChain )
1829  MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFormat, WW8_HEADER_EVEN );
1830 
1831  if ( !pPd->IsFooterShared() || bLeftRightPgChain )
1832  MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFormat, WW8_FOOTER_EVEN );
1833  }
1834 
1835  // binary filters only
1836  SetupSectionPositions( pA );
1837 
1838  /*
1839  !!!!!!!!!!!
1840  // borders at header and footer texts would be done like this:
1841  // This should use something like pOut,
1842  // which is repeated with every special text line.
1843  const SwFrameFormat* pFFormat = rFt.GetFooterFormat();
1844  const SvxBoxItem& rBox = pFFormat->GetBox(false);
1845  OutWW8_SwFormatBox1( m_rWW8Export.pOut, rBox, false);
1846  !!!!!!!!!!!
1847  You can turn this into paragraph attributes, which are then observed in each paragraph.
1848  Applies to background / border.
1849  !!!!!!!!!!!
1850  */
1851 
1852  const SwTextNode *pOldPageRoot = GetHdFtPageRoot();
1853  SetHdFtPageRoot( rSepInfo.pPDNd ? rSepInfo.pPDNd->GetTextNode() : nullptr );
1854 
1855  if (bUsePrevSectionNextStyle && nHeadFootFlags == 0)
1856  {
1857  // Take headers/footers from the previous section's next style.
1858  pPdFormat = &pPd->GetFollow()->GetMaster();
1859  MSWordSections::SetHeaderFlag(nHeadFootFlags, *pPdFormat, WW8_HEADER_ODD);
1860  MSWordSections::SetFooterFlag(nHeadFootFlags, *pPdFormat, WW8_FOOTER_ODD);
1861  }
1862 
1863  WriteHeadersFooters( nHeadFootFlags, *pPdFormat, *pPdLeftFormat, *pPdFirstPgFormat, nBreakCode );
1864 
1865  SetHdFtPageRoot( pOldPageRoot );
1866 
1867  AttrOutput().EndSection();
1868 
1869  // outside of the section properties again
1870  m_bOutPageDescs = bOldPg;
1871 }
1872 
1874 {
1875  sal_uLong nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1876 
1877  OSL_ENSURE( !pTextPos, "who set the pointer?" );
1878  pTextPos.reset( new WW8_WrPlc0( nCpStart ) );
1879 
1880  WriteFootnoteEndText( rWrt, nCpStart );
1881  CheckForFacinPg( rWrt );
1882 
1883  unsigned int nOldIndex = rWrt.GetHdFtIndex();
1884  rWrt.SetHdFtIndex( 0 );
1885 
1886  for (const WW8_SepInfo & rSepInfo : aSects)
1887  {
1888  auto pAttrDesc = std::make_shared<WW8_PdAttrDesc>();
1889  m_SectionAttributes.push_back(pAttrDesc);
1890 
1891  rWrt.SectionProperties( rSepInfo, pAttrDesc.get() );
1892 
1893  // FIXME: this writes the section properties, but not of all sections;
1894  // it's possible that later in the document (e.g. in endnotes) sections
1895  // are added, but they won't have their properties written here!
1896  m_bHeaderFooterWritten = true;
1897  }
1898  rWrt.SetHdFtIndex( nOldIndex ); //0
1899 
1900  if ( pTextPos->Count() )
1901  {
1902  // HdFt available?
1903  sal_uLong nCpEnd = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1904  pTextPos->Append( nCpEnd ); // End of last Header/Footer for PlcfHdd
1905 
1906  if ( nCpEnd > nCpStart )
1907  {
1908  ++nCpEnd;
1909  pTextPos->Append( nCpEnd + 1 ); // End of last Header/Footer for PlcfHdd
1910 
1911  rWrt.WriteStringAsPara( OUString() ); // CR to the end ( otherwise WW complains )
1912  }
1913  rWrt.m_pFieldHdFt->Finish( nCpEnd, rWrt.pFib->m_ccpText + rWrt.pFib->m_ccpFootnote );
1914  rWrt.pFib->m_ccpHdr = nCpEnd - nCpStart;
1915  }
1916  else
1917  {
1918  pTextPos.reset();
1919  }
1920 
1921  return rWrt.pFib->m_ccpHdr != 0;
1922 }
1923 
1925 {
1926  OSL_ENSURE(m_SectionAttributes.size() == static_cast<size_t>(aSects.size())
1927  , "WriteSepx(): arrays out of sync!");
1928  for (const auto & rSectionAttribute : m_SectionAttributes) // all sections
1929  {
1930  WW8_PdAttrDesc *const pA = rSectionAttribute.get();
1931  if (pA->m_nLen && pA->m_pData != nullptr)
1932  {
1933  pA->m_nSepxFcPos = rStrm.Tell();
1934  rStrm.WriteUInt16(pA->m_nLen);
1935  rStrm.WriteBytes(pA->m_pData.get(), pA->m_nLen);
1936  }
1937  }
1938 }
1939 
1941 {
1942  OSL_ENSURE(m_SectionAttributes.size() == static_cast<size_t>(aSects.size())
1943  , "WritePlcSed(): arrays out of sync!");
1944  OSL_ENSURE( aCps.size() == aSects.size() + 1, "WrPlcSepx: DeSync" );
1945  sal_uLong nFcStart = rWrt.pTableStrm->Tell();
1946 
1947  for( decltype(aSects)::size_type i = 0; i <= aSects.size(); i++ )
1948  {
1949  sal_uInt32 nP = aCps[i];
1950  rWrt.pTableStrm->WriteUInt32(nP);
1951  }
1952 
1953  static WW8_SED aSed = {{4, 0},{0, 0, 0, 0},{0, 0},{0xff, 0xff, 0xff, 0xff}};
1954 
1955  for (const auto & rSectionAttribute : m_SectionAttributes)
1956  {
1957  // Sepx-Pos
1958  UInt32ToSVBT32( rSectionAttribute->m_nSepxFcPos, aSed.fcSepx );
1959  rWrt.pTableStrm->WriteBytes(&aSed, sizeof(aSed));
1960  }
1961  rWrt.pFib->m_fcPlcfsed = nFcStart;
1962  rWrt.pFib->m_lcbPlcfsed = rWrt.pTableStrm->Tell() - nFcStart;
1963 }
1964 
1966 {
1967  // Don't write out the PlcfHdd if ccpHdd is 0: it's a validation failure case.
1968  if( rWrt.pFib->m_ccpHdr != 0 && pTextPos && pTextPos->Count() )
1969  {
1970  rWrt.pFib->m_fcPlcfhdd = rWrt.pTableStrm->Tell();
1971  pTextPos->Write( *rWrt.pTableStrm ); // Plc0
1972  rWrt.pFib->m_lcbPlcfhdd = rWrt.pTableStrm->Tell() -
1973  rWrt.pFib->m_fcPlcfhdd;
1974  }
1975 }
1976 
1977 void MSWordExportBase::WriteHeaderFooterText( const SwFormat& rFormat, bool bHeader )
1978 {
1979  const SwFormatContent *pContent;
1980  if ( bHeader )
1981  {
1982  m_bHasHdr = true;
1983  const SwFormatHeader& rHd = rFormat.GetHeader();
1984  OSL_ENSURE( rHd.GetHeaderFormat(), "Header text is not here" );
1985  pContent = &rHd.GetHeaderFormat()->GetContent();
1986  }
1987  else
1988  {
1989  m_bHasFtr = true;
1990  const SwFormatFooter& rFt = rFormat.GetFooter();
1991  OSL_ENSURE( rFt.GetFooterFormat(), "Footer text is not here" );
1992  pContent = &rFt.GetFooterFormat()->GetContent();
1993  }
1994 
1995  const SwNodeIndex* pSttIdx = pContent->GetContentIdx();
1996 
1997  if ( pSttIdx )
1998  {
1999  SwNodeIndex aIdx( *pSttIdx, 1 ),
2000  aEnd( *pSttIdx->GetNode().EndOfSectionNode() );
2001  sal_uLong nStart = aIdx.GetIndex();
2002  sal_uLong nEnd = aEnd.GetIndex();
2003 
2004  // range, i.e. valid node
2005  if ( nStart < nEnd )
2006  {
2007  bool bOldKF = m_bOutKF;
2008  m_bOutKF = true;
2009  WriteSpecialText( nStart, nEnd, TXT_HDFT );
2010  m_bOutKF = bOldKF;
2011  }
2012  else
2013  pSttIdx = nullptr;
2014  }
2015 
2016  if ( !pSttIdx )
2017  {
2018  // there is no Header/Footer, but a CR is still necessary
2019  OSL_ENSURE( pSttIdx, "Header/Footer text is not really present" );
2021  }
2022 }
2023 
2024 // class WW8_WrPlcFootnoteEdn : Collect the Footnotes and Endnotes and output their text
2025 // and Plcs at the end of the document.
2026 // WW8_WrPlcFootnoteEdn is the class for Footnotes and Endnotes
2027 
2029 {
2030 }
2031 
2033 {
2034 }
2035 
2037 {
2038  aCps.push_back( nCp );
2039  aContent.push_back( &rFootnote );
2040 }
2041 
2042 WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd)
2043  :
2045  m_nRangeStart(nRangeStart),
2046  m_nRangeEnd(nRangeEnd)
2047 {
2048  mpRichText = pPostIt->GetTextObject();
2049  if (!mpRichText)
2050  msSimpleText = pPostIt->GetText();
2051  msOwner = pPostIt->GetPar1();
2052  m_sInitials = pPostIt->GetInitials();
2053  maDateTime = DateTime(pPostIt->GetDate(), pPostIt->GetTime());
2054 }
2055 
2057  :
2058  mpRichText(nullptr),
2059  msSimpleText(pRedline->GetComment()),
2060  msOwner(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())),
2061  maDateTime(pRedline->GetTimeStamp()),
2062  m_nRangeStart(0),
2063  m_nRangeEnd(0)
2064 {
2065 }
2066 
2068 {
2069  if (m_nRangeStart != m_nRangeEnd)
2070  {
2071  return true;
2072  }
2073 
2074  return !m_bIgnoreEmpty;
2075 }
2076 
2077 void WW8_WrPlcAnnotations::AddRangeStartPosition(const OUString& rName, WW8_CP nStartCp,
2078  bool bIgnoreEmpty)
2079 {
2080  m_aRangeStartPositions[rName] = std::make_pair(nStartCp, bIgnoreEmpty);
2081 }
2082 
2084 {
2085  aCps.push_back( nCp );
2086  WW8_Annotation* p;
2087  if( m_aRangeStartPositions.find(pPostIt->GetName()) != m_aRangeStartPositions.end() )
2088  {
2089  auto [nStartCp, bIgnoreEmpty] = m_aRangeStartPositions[pPostIt->GetName()];
2090  p = new WW8_Annotation(pPostIt, nStartCp, nCp);
2091  p->m_bIgnoreEmpty = bIgnoreEmpty;
2092  m_aRangeStartPositions.erase(pPostIt->GetName());
2093  }
2094  else
2095  {
2096  p = new WW8_Annotation(pPostIt, nCp, nCp);
2097  }
2098  aContent.push_back( p );
2099 }
2100 
2102 {
2103  maProcessedRedlines.insert(pRedline);
2104  aCps.push_back( nCp );
2105  WW8_Annotation* p = new WW8_Annotation(pRedline);
2106  aContent.push_back( p );
2107 }
2108 
2110 {
2111  return maProcessedRedlines.find(pRedline) == maProcessedRedlines.end();
2112 }
2113 
2115 {
2116  for(const void * p : aContent)
2117  delete static_cast<WW8_Annotation const *>(p);
2118 }
2119 
2121  WW8_CP& rCount )
2122 {
2123  sal_uInt16 nLen = aContent.size();
2124  if ( !nLen )
2125  return false;
2126 
2127  sal_uLong nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2128  pTextPos.reset( new WW8_WrPlc0( nCpStart ) );
2129  sal_uInt16 i;
2130 
2131  switch ( nTTyp )
2132  {
2133  case TXT_ATN:
2134  for ( i = 0; i < nLen; i++ )
2135  {
2136  // beginning for PlcfAtnText
2137  pTextPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
2138 
2139  rWrt.WritePostItBegin();
2140  const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(aContent[i]);
2141  if (rAtn.mpRichText)
2142  rWrt.WriteOutliner(*rAtn.mpRichText, nTTyp);
2143  else
2144  {
2145  OUString sText(rAtn.msSimpleText);
2146  rWrt.WriteStringAsPara(sText.replace(0x0A, 0x0B));
2147  }
2148  }
2149  break;
2150 
2151  case TXT_TXTBOX:
2152  case TXT_HFTXTBOX:
2153  for ( i = 0; i < nLen; i++ )
2154  {
2155  // textbox content
2156  WW8_CP nCP = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2157  aCps.insert( aCps.begin()+i, nCP );
2158  pTextPos->Append( nCP );
2159 
2160  if( aContent[ i ] != nullptr )
2161  {
2162  // is it a writer or sdr - textbox?
2163  const SdrObject& rObj = *static_cast<SdrObject const *>(aContent[ i ]);
2164  if (rObj.GetObjInventor() == SdrInventor::FmForm)
2165  {
2166  sal_uInt8 nOldTyp = rWrt.m_nTextTyp;
2167  rWrt.m_nTextTyp = nTTyp;
2168  rWrt.GetOCXExp().ExportControl(rWrt, dynamic_cast<const SdrUnoObj&>(rObj));
2169  rWrt.m_nTextTyp = nOldTyp;
2170  }
2171  else if( dynamic_cast<const SdrTextObj*>( &rObj) != nullptr )
2172  rWrt.WriteSdrTextObj(dynamic_cast<const SdrTextObj&>(rObj), nTTyp);
2173  else
2174  {
2175  const SwFrameFormat* pFormat = ::FindFrameFormat( &rObj );
2176  OSL_ENSURE( pFormat, "where is the format?" );
2177 
2178  const SwNodeIndex* pNdIdx = pFormat->GetContent().GetContentIdx();
2179  OSL_ENSURE( pNdIdx, "where is the StartNode of the Textbox?" );
2180  rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
2181  pNdIdx->GetNode().EndOfSectionIndex(),
2182  nTTyp );
2183  {
2184  SwNodeIndex aContentIdx = *pNdIdx;
2185  ++aContentIdx;
2186  if ( aContentIdx.GetNode().IsTableNode() )
2187  {
2188  bool bContainsOnlyTables = true;
2189  do {
2190  aContentIdx = *(aContentIdx.GetNode().EndOfSectionNode());
2191  ++aContentIdx;
2192  if ( !aContentIdx.GetNode().IsTableNode() &&
2193  aContentIdx.GetIndex() != pNdIdx->GetNode().EndOfSectionIndex() )
2194  {
2195  bContainsOnlyTables = false;
2196  }
2197  } while ( aContentIdx.GetNode().IsTableNode() );
2198  if ( bContainsOnlyTables )
2199  {
2200  // Additional paragraph containing a space to
2201  // assure that by WW created RTF from written WW8
2202  // does not crash WW.
2203  rWrt.WriteStringAsPara( " " );
2204  }
2205  }
2206  }
2207  }
2208  }
2209  else if (i < aSpareFormats.size() && aSpareFormats[i])
2210  {
2211  const SwFrameFormat& rFormat = *aSpareFormats[i];
2212  const SwNodeIndex* pNdIdx = rFormat.GetContent().GetContentIdx();
2213  rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
2214  pNdIdx->GetNode().EndOfSectionIndex(), nTTyp );
2215  }
2216 
2217  // CR at end of one textbox text ( otherwise WW gpft :-( )
2218  rWrt.WriteStringAsPara( OUString() );
2219  }
2220  break;
2221 
2222  case TXT_EDN:
2223  case TXT_FTN:
2224  for ( i = 0; i < nLen; i++ )
2225  {
2226  // beginning for PlcfFootnoteText/PlcfEdnText
2227  pTextPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
2228 
2229  // Note content
2230  const SwFormatFootnote* pFootnote = static_cast<SwFormatFootnote const *>(aContent[ i ]);
2231  rWrt.WriteFootnoteBegin( *pFootnote );
2232  const SwNodeIndex* pIdx = pFootnote->GetTextFootnote()->GetStartNode();
2233  OSL_ENSURE( pIdx, "Where is the start node of Foot-/Endnote?" );
2234  rWrt.WriteSpecialText( pIdx->GetIndex() + 1,
2235  pIdx->GetNode().EndOfSectionIndex(),
2236  nTTyp );
2237  }
2238  break;
2239 
2240  default:
2241  OSL_ENSURE( false, "What kind of SubDocType is that?" );
2242  }
2243 
2244  pTextPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
2245  // CR to the end ( otherwise WW complains )
2246  rWrt.WriteStringAsPara( OUString() );
2247 
2248  WW8_CP nCpEnd = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2249  pTextPos->Append( nCpEnd );
2250  rCount = nCpEnd - nCpStart;
2251 
2252  return ( rCount != 0 );
2253 }
2254 
2255 static bool lcl_AuthorComp( const std::pair<OUString,OUString>& aFirst, const std::pair<OUString,OUString>& aSecond)
2256 {
2257  return aFirst.first < aSecond.first;
2258 }
2259 
2260 static bool lcl_PosComp( const std::pair<WW8_CP, int>& aFirst, const std::pair<WW8_CP, int>& aSecond)
2261 {
2262  return aFirst.first < aSecond.first;
2263 }
2264 
2266  WW8_FC& rTextStart, sal_Int32& rTextCount, WW8_FC& rRefStart, sal_Int32& rRefCount ) const
2267 {
2268 
2269  sal_uLong nFcStart = rWrt.pTableStrm->Tell();
2270  sal_uInt16 nLen = aCps.size();
2271  if ( !nLen )
2272  return;
2273 
2274  OSL_ENSURE( aCps.size() + 2 == pTextPos->Count(), "WritePlc: DeSync" );
2275 
2276  std::vector<std::pair<OUString,OUString> > aStrArr;
2277  WW8Fib& rFib = *rWrt.pFib; // n+1-th CP-Pos according to the manual
2278  bool bWriteCP = true;
2279 
2280  switch ( nTTyp )
2281  {
2282  case TXT_ATN:
2283  {
2284  std::vector< std::pair<WW8_CP, int> > aRangeStartPos; // The second of the pair is the original index before sorting.
2285  std::vector< std::pair<WW8_CP, int> > aRangeEndPos; // Same, so we can map between the indexes before/after sorting.
2286  std::map<int, int> aAtnStartMap; // Maps from annotation index to start index.
2287  std::map<int, int> aStartAtnMap; // Maps from start index to annotation index.
2288  std::map<int, int> aStartEndMap; // Maps from start index to end index.
2289  // then write first the GrpXstAtnOwners
2290  int nIdx = 0;
2291  for ( sal_uInt16 i = 0; i < nLen; ++i )
2292  {
2293  const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(aContent[i]);
2294  aStrArr.emplace_back(rAtn.msOwner,rAtn.m_sInitials);
2295  // record start and end positions for ranges
2296  if (rAtn.HasRange())
2297  {
2298  aRangeStartPos.emplace_back(rAtn.m_nRangeStart, nIdx);
2299  aRangeEndPos.emplace_back(rAtn.m_nRangeEnd, nIdx);
2300  ++nIdx;
2301  }
2302  }
2303 
2304  //sort and remove duplicates
2305  std::sort(aStrArr.begin(), aStrArr.end(),&lcl_AuthorComp);
2306  auto aIter = std::unique(aStrArr.begin(), aStrArr.end());
2307  aStrArr.erase(aIter, aStrArr.end());
2308 
2309  // Also sort the start and end positions. We need to reference
2310  // the start index in the annotation table and also need to
2311  // reference the end index in the start table, so build a map
2312  // that knows what index to reference, after sorting.
2313  std::sort(aRangeStartPos.begin(), aRangeStartPos.end(), &lcl_PosComp);
2314  for (decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i)
2315  {
2316  aAtnStartMap[aRangeStartPos[i].second] = i;
2317  aStartAtnMap[i] = aRangeStartPos[i].second;
2318  }
2319  std::sort(aRangeEndPos.begin(), aRangeEndPos.end(), &lcl_PosComp);
2320  for (decltype(aRangeEndPos)::size_type i = 0; i < aRangeEndPos.size(); ++i)
2321  aStartEndMap[aAtnStartMap[ aRangeEndPos[i].second ]] = i;
2322 
2323  for ( decltype(aStrArr)::size_type i = 0; i < aStrArr.size(); ++i )
2324  {
2325  const OUString& sAuthor = aStrArr[i].first;
2326  SwWW8Writer::WriteShort(*rWrt.pTableStrm, sAuthor.getLength());
2327  SwWW8Writer::WriteString16(*rWrt.pTableStrm, sAuthor,
2328  false);
2329  }
2330 
2331  rFib.m_fcGrpStAtnOwners = nFcStart;
2332  nFcStart = rWrt.pTableStrm->Tell();
2333  rFib.m_lcbGrpStAtnOwners = nFcStart - rFib.m_fcGrpStAtnOwners;
2334 
2335  // Commented text ranges
2336  if( !aRangeStartPos.empty() )
2337  {
2338  // Commented text ranges starting positions (Plcfbkf.aCP)
2339  rFib.m_fcPlcfAtnbkf = nFcStart;
2340  for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2341  {
2342  SwWW8Writer::WriteLong( *rWrt.pTableStrm, aRangeStartPos[i].first );
2343  }
2344  SwWW8Writer::WriteLong( *rWrt.pTableStrm, rFib.m_ccpText + 1);
2345 
2346  // Commented text ranges additional information (Plcfbkf.aFBKF)
2347  for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2348  {
2349  SwWW8Writer::WriteShort( *rWrt.pTableStrm, aStartEndMap[i] ); // FBKF.ibkl
2350  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); // FBKF.bkc
2351  }
2352 
2353  nFcStart = rWrt.pTableStrm->Tell();
2354  rFib.m_lcbPlcfAtnbkf = nFcStart - rFib.m_fcPlcfAtnbkf;
2355 
2356  // Commented text ranges ending positions (PlcfBkl.aCP)
2357  rFib.m_fcPlcfAtnbkl = nFcStart;
2358  for ( decltype(aRangeEndPos)::size_type i = 0; i < aRangeEndPos.size(); ++i )
2359  {
2360  SwWW8Writer::WriteLong( *rWrt.pTableStrm, aRangeEndPos[i].first );
2361  }
2362  SwWW8Writer::WriteLong( *rWrt.pTableStrm, rFib.m_ccpText + 1);
2363 
2364  nFcStart = rWrt.pTableStrm->Tell();
2365  rFib.m_lcbPlcfAtnbkl = nFcStart - rFib.m_fcPlcfAtnbkl;
2366 
2367  // Commented text ranges as bookmarks (SttbfAtnBkmk)
2368  rFib.m_fcSttbfAtnbkmk = nFcStart;
2369  SwWW8Writer::WriteShort( *rWrt.pTableStrm, sal_Int16(sal_uInt16(0xFFFF)) ); // SttbfAtnBkmk.fExtend
2370  SwWW8Writer::WriteShort( *rWrt.pTableStrm, aRangeStartPos.size() ); // SttbfAtnBkmk.cData
2371  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0xA ); // SttbfAtnBkmk.cbExtra
2372 
2373  for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2374  {
2375  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); // SttbfAtnBkmk.cchData
2376  // One ATNBE structure for all text ranges
2377  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0x0100 ); // ATNBE.bmc
2378  SwWW8Writer::WriteLong( *rWrt.pTableStrm, aStartAtnMap[i] ); // ATNBE.lTag
2379  SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 ); // ATNBE.lTagOld
2380  }
2381 
2382  nFcStart = rWrt.pTableStrm->Tell();
2383  rFib.m_lcbSttbfAtnbkmk = nFcStart - rFib.m_fcSttbfAtnbkmk;
2384  }
2385 
2386  // Write the extended >= Word XP ATRD records
2387  for( sal_uInt16 i = 0; i < nLen; ++i )
2388  {
2389  const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(aContent[i]);
2390 
2391  sal_uInt32 nDTTM = sw::ms::DateTime2DTTM(rAtn.maDateTime);
2392 
2393  SwWW8Writer::WriteLong( *rWrt.pTableStrm, nDTTM );
2394  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
2395  SwWW8Writer::WriteLong( *rWrt.pTableStrm, 0 );
2396  SwWW8Writer::WriteLong( *rWrt.pTableStrm, 0 );
2397  SwWW8Writer::WriteLong( *rWrt.pTableStrm, 0 );
2398  }
2399 
2400  rFib.m_fcAtrdExtra = nFcStart;
2401  nFcStart = rWrt.pTableStrm->Tell();
2402  rFib.m_lcbAtrdExtra = nFcStart - rFib.m_fcAtrdExtra;
2403  rFib.m_fcHplxsdr = 0x01010002; //WTF, but apparently necessary
2404  rFib.m_lcbHplxsdr = 0;
2405  }
2406  break;
2407  case TXT_TXTBOX:
2408  case TXT_HFTXTBOX:
2409  {
2410  pTextPos->Write( *rWrt.pTableStrm );
2411  const std::vector<sal_uInt32>* pShapeIds = GetShapeIdArr();
2412  OSL_ENSURE( pShapeIds, "Where are the ShapeIds?" );
2413 
2414  for ( sal_uInt16 i = 0; i < nLen; ++i )
2415  {
2416  // write textbox story - FTXBXS
2417  // is it a writer or sdr - textbox?
2418  const SdrObject* pObj = static_cast<SdrObject const *>(aContent[ i ]);
2419  sal_Int32 nCnt = 1;
2420  if (dynamic_cast< const SdrTextObj *>( pObj ))
2421  {
2422  // find the "highest" SdrObject of this
2423  const SwFrameFormat& rFormat = *::FindFrameFormat( pObj );
2424 
2425  const SwFormatChain* pChn = &rFormat.GetChain();
2426  while ( pChn->GetNext() )
2427  {
2428  // has a chain?
2429  // then calc the cur pos in the chain
2430  ++nCnt;
2431  pChn = &pChn->GetNext()->GetChain();
2432  }
2433  }
2434  if( nullptr == pObj )
2435  {
2436  if (i < aSpareFormats.size() && aSpareFormats[i])
2437  {
2438  const SwFrameFormat& rFormat = *aSpareFormats[i];
2439 
2440  const SwFormatChain* pChn = &rFormat.GetChain();
2441  while( pChn->GetNext() )
2442  {
2443  // has a chain?
2444  // then calc the cur pos in the chain
2445  ++nCnt;
2446  pChn = &pChn->GetNext()->GetChain();
2447  }
2448  }
2449  }
2450  // long cTxbx / iNextReuse
2451  SwWW8Writer::WriteLong( *rWrt.pTableStrm, nCnt );
2452  // long cReusable
2453  SwWW8Writer::WriteLong( *rWrt.pTableStrm, 0 );
2454  // short fReusable
2455  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
2456  // long reserved
2457  SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 );
2458  // long lid
2460  (*pShapeIds)[i]);
2461  // long txidUndo
2462  SwWW8Writer::WriteLong( *rWrt.pTableStrm, 0 );
2463  }
2464  SwWW8Writer::FillCount( *rWrt.pTableStrm, 22 );
2465  bWriteCP = false;
2466  }
2467  break;
2468  }
2469 
2470  if ( bWriteCP )
2471  {
2472  // write CP Positions
2473  for ( sal_uInt16 i = 0; i < nLen; i++ )
2474  SwWW8Writer::WriteLong( *rWrt.pTableStrm, aCps[ i ] );
2475 
2476  // n+1-th CP-Pos according to the manual
2478  rFib.m_ccpText + rFib.m_ccpFootnote + rFib.m_ccpHdr + rFib.m_ccpEdn +
2479  rFib.m_ccpTxbx + rFib.m_ccpHdrTxbx + 1 );
2480 
2481  if ( TXT_ATN == nTTyp )
2482  {
2483  sal_uInt16 nlTag = 0;
2484  for ( sal_uInt16 i = 0; i < nLen; ++i )
2485  {
2486  const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(aContent[i]);
2487 
2488  //aStrArr is sorted
2489  auto aIter = std::lower_bound(aStrArr.begin(),
2490  aStrArr.end(), std::pair<OUString,OUString>(rAtn.msOwner,OUString()),
2491  &lcl_AuthorComp);
2492  OSL_ENSURE(aIter != aStrArr.end() && aIter->first == rAtn.msOwner,
2493  "Impossible");
2494  sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin());
2495  OUString sInitials( aIter->second );
2496  sal_uInt8 nInitialsLen = static_cast<sal_uInt8>(sInitials.getLength());
2497  if ( nInitialsLen > 9 )
2498  {
2499  sInitials = sInitials.copy( 0, 9 );
2500  nInitialsLen = 9;
2501  }
2502 
2503  // xstUsrInitl[ 10 ] pascal-style String holding initials
2504  // of annotation author
2505  SwWW8Writer::WriteShort(*rWrt.pTableStrm, nInitialsLen);
2506  SwWW8Writer::WriteString16(*rWrt.pTableStrm, sInitials,
2507  false);
2509  (9 - nInitialsLen) * 2 );
2510 
2511  // documents layout of WriteShort's below:
2512 
2513  // SVBT16 ibst; // index into GrpXstAtnOwners
2514  // SVBT16 ak; // not used
2515  // SVBT16 grfbmc; // not used
2516  // SVBT32 ITagBkmk; // when not -1, this tag identifies the ATNBE
2517 
2518  SwWW8Writer::WriteShort( *rWrt.pTableStrm, nFndPos );
2519  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
2520  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
2521  if (rAtn.HasRange())
2522  {
2523  SwWW8Writer::WriteLong( *rWrt.pTableStrm, nlTag );
2524  ++nlTag;
2525  }
2526  else
2527  SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 );
2528  }
2529  }
2530  else
2531  {
2532  sal_uInt16 nNo = 0;
2533  for ( sal_uInt16 i = 0; i < nLen; ++i ) // write Flags
2534  {
2535  const SwFormatFootnote* pFootnote = static_cast<SwFormatFootnote const *>(aContent[ i ]);
2537  !pFootnote->GetNumStr().isEmpty() ? 0 : ++nNo );
2538  }
2539  }
2540  }
2541  rRefStart = nFcStart;
2542  nFcStart = rWrt.pTableStrm->Tell();
2543  rRefCount = nFcStart - rRefStart;
2544 
2545  pTextPos->Write( *rWrt.pTableStrm );
2546 
2547  switch ( nTTyp )
2548  {
2549  case TXT_TXTBOX:
2550  case TXT_HFTXTBOX:
2551  for ( sal_uInt16 i = 0; i < nLen; ++i )
2552  {
2553  // write break descriptor (BKD)
2554  // short itxbxs
2556  // short dcpDepend
2557  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
2558  // short flags : icol/fTableBreak/fColumnBreak/fMarked/
2559  // fUnk/fTextOverflow
2560  SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0x800 );
2561  }
2562  SwWW8Writer::FillCount( *rWrt.pTableStrm, 6 );
2563  break;
2564  }
2565 
2566  rTextStart = nFcStart;
2567  rTextCount = rWrt.pTableStrm->Tell() - nFcStart;
2568 }
2569 
2570 const std::vector<sal_uInt32>* WW8_WrPlcSubDoc::GetShapeIdArr() const
2571 {
2572  return nullptr;
2573 }
2574 
2575 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::map< wwFont, sal_uInt16 > maFonts
Keep track of fonts that need to be exported.
Definition: wrtww8.hxx:325
virtual void EndStyleProperties(bool bParProp) override
End of (paragraph or run) properties of a style.
Definition: wrtw8sty.cxx:545
o3tl::sorted_vector< const SwRedlineData * > maProcessedRedlines
Definition: wrtww8.hxx:1273
long GetLeft() const
bool WriteGenericText(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_CP &rCount)
Definition: wrtw8sty.cxx:2120
Date GetDate() const
Definition: docufld.hxx:474
sal_uInt16 CurrentNumberOfColumns(const SwDoc &rDoc) const
Number of columns based on the most recent WW8_SepInfo.
Definition: wrtw8sty.cxx:1059
WW8_CP m_nRangeEnd
Definition: wrtww8.hxx:1260
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:955
SvxNumType GetNumberingType() const
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
Subgroup labels.
Definition: poolfmt.hxx:345
static sal_uInt16 GetWWId(const SwFormat &rFormat)
Definition: wrtw8sty.cxx:210
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
Definition: docftn.cxx:183
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Definition: fmtpdsc.hxx:65
Exporter of the binary Word file formats.
Definition: wrtww8.hxx:988
sal_uInt16 nEdn
Definition: ww8scan.hxx:1678
static bool lcl_AuthorComp(const std::pair< OUString, OUString > &aFirst, const std::pair< OUString, OUString > &aSecond)
Definition: wrtw8sty.cxx:2255
WW8_FC m_fcStshf
Definition: ww8scan.hxx:1242
virtual AttributeOutputBase & AttrOutput() const =0
Access to the attribute output class.
void SetHdFtIndex(unsigned int nHdFtIndex)
Definition: wrtww8.hxx:1136
#define RES_COL
Definition: hintids.hxx:309
void WriteProperties(const SwFormat *pFormat, bool bPap, sal_uInt16 nPos, bool bInsDefCharSiz)
Outputs attributes of one style.
Definition: wrtw8sty.cxx:525
const HdFtFlags WW8_FOOTER_FIRST
Definition: ww8scan.hxx:1593
sal_uInt16 rncEdn
Definition: ww8scan.hxx:1677
virtual void SectionTitlePage()=0
Has different headers/footers for the title page.
Class to collect and output the sections/headers/footers.
Definition: wrtww8.hxx:198
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:587
virtual void EndStyles(sal_uInt16 nNumberOfStyles)=0
End of the styles table.
std::unique_ptr< ww::bytes > pO
Buffer.
Definition: wrtww8.hxx:991
SvStream * pTableStrm
Definition: wrtww8.hxx:993
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
unsigned int GetHdFtIndex() const
Definition: wrtww8.hxx:1135
The class that has handlers for various resource types when exporting as DOCX.
void AddRangeStartPosition(const OUString &rName, WW8_CP nStartCp, bool bIgnoreEmpty)
Definition: wrtw8sty.cxx:2077
const sal_uInt16 sprmSBkc
Definition: sprmids.hxx:539
#define WW8_RESERVED_SLOTS
Definition: wrtw8sty.cxx:122
std::vector< SwColumn > SwColumns
Definition: fmtclds.hxx:57
const SvxFontHeightItem & GetSize(bool=true) const
Definition: charatr.hxx:78
bool IsSectionNode() const
Definition: node.hxx:644
std::unique_ptr< WW8Fib > pFib
File Information Block.
Definition: wrtww8.hxx:995
#define RES_CONDTXTFMTCOLL
Definition: hintids.hxx:373
sal_Int32 m_lcbStshf
Definition: ww8scan.hxx:1243
bool m_bEndAtTextEnd
Definition: wrtww8.hxx:563
void EmbedFont(const OUString &name, FontFamily family, FontPitch pitch)
Write out the font into the document, if it's an embedded font.
FAMILY_SCRIPT
#define RES_HEADER
Definition: hintids.hxx:296
std::unique_ptr< WW8_WrPlcField > m_pFieldHdFt
Definition: wrtww8.hxx:526
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:218
void SetStyleDefaults(const SwFormat &rFormat, bool bPap)
Definition: wrtw8sty.cxx:448
sal_uInt8 SVBT16[2]
SvStream & WriteUInt16(sal_uInt16 nUInt16)
const sal_uInt16 sprmSPgnStart97
Definition: sprmids.hxx:554
bool IsDefault() const
Definition: format.hxx:109
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:170
void WriteStringAsPara(const OUString &rText)
Definition: wrtww8.cxx:1794
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:62
const SwLineNumberInfo & GetLineNumberInfo() const
Definition: lineinfo.cxx:49
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:172
bool HasRange() const
An annotation has a range if start != end or the m_bIgnoreEmpty flag is cleared.
Definition: wrtw8sty.cxx:2067
void OutputStyle(SwFormat *pFormat, sal_uInt16 nPos)
Outputs one style - called (in a loop) from OutputStylesTable().
Definition: wrtw8sty.cxx:587
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
FAMILY_MODERN
virtual void StartStyleProperties(bool bParProp, sal_uInt16 nStyle) override
Start of (paragraph or run) properties of a style.
Definition: wrtw8sty.cxx:508
void Append(sal_uLong nStartCpOrFc)
Definition: wrtw8sty.cxx:963
sal_uInt16 GetId(const SwTextFormatColl &rColl) const
Return the numeric id of the style.
Definition: wrtw8sty.cxx:134
bool m_bFootnoteAtTextEnd
Definition: wrtww8.hxx:562
std::unique_ptr< ContentProperties > pData
const sal_uInt16 sprmSRncFtn
Definition: sprmids.hxx:582
const sal_uInt16 sprmSNLnnMod
Definition: sprmids.hxx:547
WW8_CP m_nRangeStart
Definition: wrtww8.hxx:1260
bool mbAlt
Definition: wrtww8.hxx:307
sal_uInt16 m_nStyleStartSize
For output of styles.
FontFamily meFamily
Definition: wrtww8.hxx:309
sal_uInt16 GetCountBy() const
Definition: lineinfo.hxx:74
virtual void EndStyles(sal_uInt16 nNumberOfStyles) override
End of the styles table.
Definition: wrtw8sty.cxx:678
void SetAdjustValue(sal_Int16 n)
Definition: fmtclds.hxx:96
OUString msFamilyNm
Definition: wrtww8.hxx:305
const SfxPoolItem * GetPoolDefaultItem(sal_uInt16 nWhich) const
virtual void SectFootnoteEndnotePr() override
for footnote/endnote section properties
Definition: wrtw8sty.cxx:1329
void OutputStylesTable()
Output the styles table.
Definition: wrtw8sty.cxx:686
std::vector< const SwFrameFormat * > aSpareFormats
Definition: wrtww8.hxx:1223
Pages/field.
Definition: poolfmt.hxx:115
virtual void EndSection()=0
End of the section properties.
sal_uIntPtr sal_uLong
const sal_uInt16 sprmSPgbProp
Definition: sprmids.hxx:570
#define RES_FRAMEDIR
Definition: hintids.hxx:320
void EndFont() const
End the font.
void WriteFontTable(SvStream *pTableStream, WW8Fib &pFib)
Definition: wrtw8sty.cxx:915
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:219
Doc. subtitle.
Definition: poolfmt.hxx:424
bool IsAutoRule() const
Definition: numrule.hxx:227
#define RES_FRMATR_END
Definition: hintids.hxx:331
sal_Int64 n
void WritePlcHdd(WW8Export &rWrt) const
Definition: wrtw8sty.cxx:1965
void WriteFootnoteEndText(WW8Export &rWrt, sal_uLong nCpStt)
Definition: wrtw8sty.cxx:1138
bool m_bOutPageDescs
PageDescs (section properties) are being written.
Definition: wrtww8.hxx:554
Definition: doc.hxx:186
sal_Int16 nfcFootnoteRef
Definition: ww8scan.hxx:1770
tools::Time GetTime() const
Definition: docufld.hxx:475
void StartFont(const OUString &rFamilyName) const
Start the font.
sal_Int16 nId
Content 1st level.
Definition: poolfmt.hxx:375
virtual bool CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich)=0
Guess the script (asian/western).
virtual OUString GetPar1() const override
Author.
Definition: docufld.cxx:1798
const_iterator find(const Value &x) const
#define RES_CHRATR_FONT
Definition: hintids.hxx:169
void WriteRtf(const RtfAttributeOutput *rAttrOutput) const
Definition: wrtw8sty.cxx:822
SwNode & GetNode() const
Definition: ndindex.hxx:119
const OUString & GetName() const
Definition: numrule.hxx:222
virtual void StartStyles() override
Start of the styles table.
Definition: wrtw8sty.cxx:656
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
SwSectionFormat * GetFormat()
Definition: section.hxx:337
WW8_FC m_fcPlcfAtnbkf
Definition: ww8scan.hxx:1388
#define RES_CHRATR_CJK_FONT
Definition: hintids.hxx:184
FAMILY_ROMAN
WW8_CP Fc2Cp(sal_uLong nFc) const
Definition: wrtww8.hxx:1104
void BuildStyleIds()
Based on pFormatA, fill in m_aStyleIds with unique, MS-like names.
Definition: wrtw8sty.cxx:341
MSWordStyles(const MSWordStyles &)=delete
virtual void SectionFormProtection(bool bProtected) override
Protection of forms.
Definition: wrtw8sty.cxx:1349
virtual const std::vector< sal_uInt32 > * GetShapeIdArr() const
Definition: wrtw8sty.cxx:2570
bool m_bOutFirstPage
Definition: wrtww8.hxx:555
virtual bool HeaderFooterWritten() override
Definition: wrtw8sty.cxx:1054
std::vector< const wwFont * > AsVector() const
Convert from fast insertion map to linear vector in the order that we want to write.
Definition: wrtw8sty.cxx:905
std::vector< sal_uLong > aPos
Definition: wrtw8sty.cxx:107
const SwNumRule * GetSwNumRule(sal_uInt16 nId) const
Get numbering rule of the nId-th style.
Definition: wrtw8sty.cxx:714
::std::optional< sal_uInt16 > oPgRestartNo
Definition: wrtww8.hxx:182
#define RES_TXTATR_END
Definition: hintids.hxx:252
const SfxItemSet * GetCurItemSet() const
Getter for pISet.
Definition: wrtww8.hxx:731
sal_uInt16 nPOPosStdLen1
For output of styles.
FontPitch GetPitch() const
rtl_TextEncoding meChrSet
Definition: wrtww8.hxx:310
virtual ExportFormat GetExportFormat() const =0
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
OString const & GetStyleId(sal_uInt16 nId) const
Get styleId of the nId-th style (nId is its position in pFormatA).
Definition: wrtw8sty.cxx:379
FontFamily GetFamily() const
sal_uInt32 m_lcbAtrdExtra
Definition: ww8scan.hxx:1477
sal_uLong m_nStyleCountPos
For output of styles.
Content 5th level.
Definition: poolfmt.hxx:379
static void SetHeaderFlag(sal_uInt8 &rHeadFootFlags, const SwFormat &rFormat, sal_uInt8 nFlag)
Definition: wrtw8sty.cxx:1197
sal_uInt8 SVBT32[4]
#define MSWORD_MAX_STYLES_LIMIT
Definition: wrtww8.hxx:1634
WW8_FC m_fcSttbfAtnbkmk
Definition: ww8scan.hxx:1361
const SwSection & GetSection() const
Definition: node.hxx:541
void SectionProperties(const WW8_SepInfo &rSectionInfo, WW8_PdAttrDesc *pA=nullptr)
Write section properties.
Definition: wrtw8sty.cxx:1594
const SwTextFootnote * GetTextFootnote() const
Definition: fmtftn.hxx:86
std::vector< WW8_SepInfo > aSects
Definition: wrtww8.hxx:202
sal_uInt16 sal_Unicode
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
bool IsRestartEachPage() const
Definition: lineinfo.hxx:89
void FontCharset(sal_uInt8 nCharSet) const
Font charset.
void FontPitchType(FontPitch ePitch) const
Font pitch.
bool IsFollowNextPageOfNode(const SwNode &rNd) const
Definition: pagedesc.cxx:346
virtual void EndStyle()=0
End of a style in the styles table.
void OutputFormat(const SwFormat &rFormat, bool bPapFormat, bool bChpFormat, bool bFlyFormat=false)
Output attributes.
Definition: ww8atr.cxx:788
rtl_TextEncoding GetCharSet() const
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:775
virtual void SectionLineNumbering(sal_uLong nRestartNo, const SwLineNumberInfo &rLnNumInfo) override
Numbering of the lines in the document.
Definition: wrtw8sty.cxx:1360
void StartFont(const OUString &rFamilyName) const
Start the font.
The class that has handlers for various resource types when exporting as RTF.
const OUString & GetName() const
Definition: format.hxx:111
const sal_uInt16 sprmSNfcPgn
Definition: sprmids.hxx:543
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
bool bIsFirstParagraph
Definition: wrtww8.hxx:183
StyleType
FontPitch mePitch
Definition: wrtww8.hxx:308
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
const OUString & GetText() const
Definition: docufld.hxx:485
std::shared_ptr< SwUnoCursor > & m_pCurPam
Definition: wrtww8.hxx:577
Content 6th level.
Definition: poolfmt.hxx:389
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
#define RES_PAPER_BIN
Definition: hintids.hxx:290
SvStream & WriteUInt32(sal_uInt32 nUInt32)
void Append(WW8_CP nCp, const SwPostItField *pPostIt)
Definition: wrtw8sty.cxx:2083
void WritePostItBegin(ww::bytes *pO=nullptr)
Definition: ww8atr.cxx:2598
const SwTable & GetTable() const
Definition: node.hxx:497
const HdFtFlags WW8_FOOTER_EVEN
Definition: ww8scan.hxx:1590
DateTime maDateTime
Definition: wrtww8.hxx:1259
void Set_UInt16(sal_uInt8 *&p, sal_uInt16 n)
Definition: ww8struc.hxx:47
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
const OUString & GetNumStr() const
Definition: fmtftn.hxx:71
void Write(SvStream *pTableStram) const
Definition: wrtw8sty.cxx:790
#define RES_TXTFMTCOLL
Definition: hintids.hxx:370
#define RES_PARATR_BEGIN
Definition: hintids.hxx:254
PITCH_VARIABLE
void FontAlternateName(const OUString &rName) const
Alternate name for the font.
Text body indent.
Definition: poolfmt.hxx:254
virtual void SectFootnoteEndnotePr()
for footnote/endnote section properties
SwFrameFormat * FindFrameFormat(SdrObject *pObj)
The Get reverse way: seeks the format to the specified object.
Definition: dcontact.cxx:120
std::map< sal_uInt16, const SwNumRule * > m_aNumRules
Slot <-> List style map.
Definition: wrtww8.hxx:1580
bool IsNewRedlineComment(const SwRedlineData *pRedLine)
Definition: wrtw8sty.cxx:2109
virtual void EndStyle() override
End of a style in the styles table.
Definition: wrtw8sty.cxx:391
void OutputItem(const SfxPoolItem &rHt)
Call the right virtual function according to the type of the item.
Definition: ww8atr.cxx:5210
FAMILY_DECORATIVE
bool m_bHeaderFooterWritten
Definition: wrtww8.hxx:250
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
virtual void SectionBiDi(bool bBiDi) override
Columns populated from right/numbers on the right side?
Definition: wrtw8sty.cxx:1424
virtual void DefaultStyle() override
Write default style.
Definition: wrtw8sty.cxx:572
Collects and outputs fonts.
Definition: wrtww8.hxx:299
const sal_uInt16 sprmSVjc
Definition: sprmids.hxx:552
virtual void TextVerticalAdjustment(const css::drawing::TextVerticalAdjust) override
Definition: wrtw8sty.cxx:1478
virtual void SetupSectionPositions(WW8_PdAttrDesc *)
Setup the pA's info.
Definition: wrtww8.hxx:780
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
const HdFtFlags WW8_HEADER_ODD
Definition: ww8scan.hxx:1589
void Write(SvStream &rStrm)
Definition: wrtw8sty.cxx:968
Base class for various Writer styles.
Definition: format.hxx:43
sal_uInt16 rncFootnote
Definition: ww8scan.hxx:1620
sal_Int32 m_lcbGrpStAtnOwners
Definition: ww8scan.hxx:1359
void ExportControl(WW8Export &rWrt, const SdrUnoObj &rFormObj)
Definition: wrtw8esh.cxx:3021
SwMSConvertControls & GetOCXExp()
Definition: wrtww8.hxx:1052
static void WriteString16(SvStream &rStrm, const OUString &rStr, bool bAddZero)
Definition: wrtww8.cxx:1758
virtual void SetupSectionPositions(WW8_PdAttrDesc *pA) override
Setup the pA's info.
Definition: wrtw8sty.cxx:1458
bool IsProtected() const
Definition: wrtw8sty.cxx:1246
bool IsContentNode() const
Definition: node.hxx:628
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool IsHeaderShared() const
Definition: pagedesc.hxx:298
const SwTextNode * GetHdFtPageRoot() const
Top node of host page when in header/footer.
Definition: wrtww8.hxx:786
void FontFamilyType(FontFamily eFamily, const wwFont &rFont) const
Font family.
sal_uInt16 GetPosFromLeft() const
Definition: lineinfo.hxx:71
SwFootnoteNum m_eNum
Definition: ftninfo.hxx:97
virtual ~MSWordSections()
Definition: wrtw8sty.cxx:1041
WW8Export & m_rWW8Export
Reference to the export, where to get the data from.
virtual ~WW8_WrPlcSubDoc()
Definition: wrtw8sty.cxx:2032
void EndFont() const
End the font.
Style of a layout element.
Definition: frmfmt.hxx:57
WW8_FC m_fcHplxsdr
Definition: ww8scan.hxx:1510
const sal_uInt16 sprmSLnnMin
Definition: sprmids.hxx:553
#define SW_MOD()
Definition: swmodule.hxx:256
const OutlinerParaObject * mpRichText
Definition: wrtww8.hxx:1255
OUString msOwner
Definition: wrtww8.hxx:1257
Footnote anchor.
Definition: poolfmt.hxx:128
virtual void SectionType(sal_uInt8 nBreakCode)=0
The type of breaking.
void WritePlcSed(WW8Export &rWrt) const
Definition: wrtw8sty.cxx:1940
sal_Int16 nfcEdnRef
Definition: ww8scan.hxx:1771
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void SetCurItemSet(const SfxItemSet *pS)
Setter for pISet.
Definition: wrtww8.hxx:734
Complimentary close.
Definition: poolfmt.hxx:255
const SwSectionFormat * pSectionFormat
Definition: wrtww8.hxx:179
void BuildStylesTable()
Create the style table, called from the constructor.
Definition: wrtw8sty.cxx:280
#define RES_CHRATR_CTL_FONT
Definition: hintids.hxx:189
static sal_uInt16 NumberOfColumns(const SwDoc &rDoc, const WW8_SepInfo &rInfo)
Number of columns of the provided WW8_SepInfo.
Definition: wrtw8sty.cxx:1068
Internet visited.
Definition: poolfmt.hxx:122
int i
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
std::unique_ptr< WW8_WrPlcSepx > pSepx
Sections/headers/footers.
Definition: wrtww8.hxx:999
WW8_FC m_nSepxFcPos
Definition: wrtw8sty.cxx:82
std::vector< WW8_CP > aCps
Definition: wrtww8.hxx:1221
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
WW8_CP m_ccpHdrTxbx
Definition: ww8scan.hxx:1208
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
WW8_WrPlcSepx(const WW8_WrPlcSepx &)=delete
For the output of sections.
Definition: wrtw8sty.cxx:78
const sal_uInt16 sprmSFBiDi
Definition: sprmids.hxx:564
Subgroup footer.
Definition: poolfmt.hxx:336
sal_Int32 m_lcbSttbfAtnbkmk
Definition: ww8scan.hxx:1362
bool IsProtect() const
Definition: section.cxx:350
PITCH_FIXED
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
sal_uInt16 epc
Definition: ww8scan.hxx:1679
void WriteDocx(DocxAttributeOutput *rAttrOutput) const
Definition: wrtw8sty.cxx:803
void FontAlternateName(const OUString &rName) const
Alternate name for the font.
void CheckForFacinPg(const WW8Export &rWrt) const
Definition: wrtw8sty.cxx:1263
virtual void DefaultStyle()=0
Write default style.
sal_uInt8 rtl_TextEncodingToWinCharsetRTF(OUString const &rFontName, OUString const &rAltName, rtl_TextEncoding eTextEncoding)
MSOffice appears to set the charset of unicode fonts to MS 932.
DateTime maDateTime
const SwModify * m_pOutFormatNode
Definition: wrtww8.hxx:538
std::unique_ptr< WW8Dop > pDop
Document Properties.
Definition: wrtww8.hxx:996
Text body.
Definition: poolfmt.hxx:251
bool m_bFirstTOCNodeWithSection
Definition: wrtww8.hxx:498
std::unique_ptr< WW8_WrPlc0 > pTextPos
Definition: wrtww8.hxx:1224
sal_uInt16 m_nFootnoteOffset
Definition: ftninfo.hxx:47
static bool lcl_PosComp(const std::pair< WW8_CP, int > &aFirst, const std::pair< WW8_CP, int > &aSecond)
Definition: wrtw8sty.cxx:2260
bool mbDocumentIsProtected
Definition: wrtww8.hxx:201
SwContentNode * GetContentNode()
Definition: node.hxx:615
#define RES_PARATR_HYPHENZONE
Definition: hintids.hxx:261
static void WriteShort(SvStream &rStrm, sal_Int16 nVal)
Definition: wrtww8.hxx:962
std::unique_ptr< SwFormat *[]> m_pFormatA
Slot <-> Character and paragraph style array (0 for list styles).
Definition: wrtww8.hxx:1577
UseOnPage ReadUseOn() const
Definition: pagedesc.hxx:215
std::vector< const void * > aContent
Definition: wrtww8.hxx:1222
static sal_uInt8 GetNumId(sal_uInt16 eNumType)
Converts the SVX numbering type to MSONFC.
Definition: ww8atr.cxx:716
virtual void SectionPageNumbering(sal_uInt16 nNumType, const ::std::optional< sal_uInt16 > &oPageRestartNumber)=0
The style of the page numbers.
WW8_FC m_fcGrpStAtnOwners
Definition: ww8scan.hxx:1358
const WW8_SepInfo * CurrentSectionInfo()
The most recent WW8_SepInfo.
Definition: wrtw8sty.cxx:1087
std::size_t WriteBytes(const void *pData, std::size_t nSize)
Internet normal.
Definition: poolfmt.hxx:121
::rtl::Reference< Content > pContent
size_t size() const
Definition: docary.hxx:84
Header Left&Right.
Definition: poolfmt.hxx:331
#define RES_CHRATR_BEGIN
Definition: hintids.hxx:162
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
SvxNumberType m_aFormat
Definition: ftninfo.hxx:46
virtual bool HeaderFooterWritten()
Definition: wrtw8sty.cxx:1049
Endnote anchor.
Definition: poolfmt.hxx:129
OUString msSimpleText
Definition: wrtww8.hxx:1256
void AppendSep(WW8_CP nStartCp, const SwPageDesc *pPd, const SwSectionFormat *pSectionFormat, sal_uLong nLnNumRestartNo)
Definition: wrtw8sty.cxx:1105
virtual void StartSection()=0
Start of the section properties.
bool operator<(const wwFont &r1, const wwFont &r2)
Definition: wrtw8sty.cxx:834
virtual void SectionTitlePage() override
Has different headers/footers for the title page.
Definition: wrtw8sty.cxx:1385
std::vector< OString > m_aStyleIds
We need to build style id's for DOCX export; ideally we should roundtrip that, but this is good enoug...
Definition: wrtww8.hxx:1583
Label drawing objects.
Definition: poolfmt.hxx:358
sal_uLong nLnNumRestartNo
Definition: wrtww8.hxx:181
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:396
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:31
Marks a node in the document model.
Definition: ndindex.hxx:31
#define RES_LINENUMBER
Definition: hintids.hxx:316
std::unique_ptr< sal_uInt8[]> m_pData
Definition: wrtw8sty.cxx:80
bool IsFooterShared() const
Definition: pagedesc.hxx:302
wwFont(const OUString &rFamilyName, FontPitch ePitch, FontFamily eFamily, rtl_TextEncoding eChrSet)
Definition: wrtw8sty.cxx:723
static void SetFooterFlag(sal_uInt8 &rHeadFootFlags, const SwFormat &rFormat, sal_uInt8 nFlag)
Definition: wrtw8sty.cxx:1207
bool m_bListStyles
If list styles are requested to be exported as well.
Definition: wrtww8.hxx:1579
void WriteGenericPlc(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_FC &rTextStt, sal_Int32 &rTextCnt, WW8_FC &rRefStt, sal_Int32 &rRefCnt) const
Definition: wrtw8sty.cxx:2265
const_iterator end() const
const sal_uInt16 sprmSNfcFtnRef
Definition: sprmids.hxx:585
sal_Int32 m_lcbStshfOrig
Definition: ww8scan.hxx:1241
MSWordExportBase & m_rExport
Definition: wrtww8.hxx:1575
bool empty() const
void InsUInt16(sal_uInt16 n)
Definition: wrtww8.hxx:1155
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:168
WW8_CP m_ccpTxbx
Definition: ww8scan.hxx:1207
FontPitch
Find suitable names for exporting this font.
Definition: msfilter.hxx:246
virtual void SectionPageNumbering(sal_uInt16 nNumType, const ::std::optional< sal_uInt16 > &oPageRestartNumber) override
The style of the page numbers.
Definition: wrtw8sty.cxx:1430
static bool HasBorderItem(const SwFormat &rFormat)
Should we output borders?
Definition: wrtw8sty.cxx:1314
virtual void SectionPageBorders(const SwFrameFormat *pFormat, const SwFrameFormat *pFirstPageFormat)=0
Description of the page borders.
void SetHdFtPageRoot(const SwTextNode *pNd)
Top node of host page when in header/footer.
Definition: wrtww8.hxx:783
SfxItemPool * GetPool() const
void OutHeaderFooter(WW8Export &rWrt, bool bHeader, const SwFormat &rFormat, sal_uLong &rCpPos, sal_uInt8 nHFFlags, sal_uInt8 nFlag, sal_uInt8 nBreakCode)
Definition: wrtw8sty.cxx:1217
WW8_FC m_fcAtrdExtra
Definition: ww8scan.hxx:1476
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
Text body first line indent.
Definition: poolfmt.hxx:252
const OUString & GetName() const
Definition: docufld.hxx:488
virtual SdrInventor GetObjInventor() const
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:37
virtual void StartStyle(const OUString &rName, StyleType eType, sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwIdi, sal_uInt16 nId, bool bAutoUpdate) override
Start of a style in the styles table.
Definition: wrtw8sty.cxx:405
sal_Int32 WW8_CP
Definition: ww8struc.hxx:153
const sal_uInt16 sprmSNfcEdnRef
Definition: sprmids.hxx:587
static OString CreateStyleId(const OUString &rName)
create style id using only ASCII characters of the style name
Definition: wrtw8sty.cxx:321
virtual void EndStyleProperties(bool bParProp)=0
End of (paragraph or run) properties of a style.
STD - STyle Definition.
Definition: ww8struc.hxx:169
#define RES_LR_SPACE
Definition: hintids.hxx:291
std::vector< std::shared_ptr< WW8_PdAttrDesc > > m_SectionAttributes
Definition: wrtww8.hxx:248
virtual void SectionFormProtection(bool bProtected)=0
Protection of forms.
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:246
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
void FontPitchType(FontPitch ePitch) const
Font pitch.
virtual ~WW8_WrPlcAnnotations() override
Definition: wrtw8sty.cxx:2114
#define RES_FOOTER
Definition: hintids.hxx:297
void WriteHeaderFooterText(const SwFormat &rFormat, bool bHeader)
Write header/footer text.
Definition: wrtw8sty.cxx:1977
WW8_FC m_fcSttbfffn
Definition: ww8scan.hxx:1293
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
void AppendSection(const SwPageDesc *pPd, const SwSectionFormat *pSectionFormat, sal_uLong nLnNumRestartNo, bool bIsFirstParagraph=false)
Definition: wrtw8sty.cxx:1095
void NeedsDocumentProtected(const WW8_SepInfo &rInfo)
Definition: wrtw8sty.cxx:1240
const sal_uInt16 sprmSDxaLnn
Definition: sprmids.hxx:548
WW8_CP m_ccpEdn
Definition: ww8scan.hxx:1206
FontFamily
const OUString & GetFamilyName() const
WW8_FC m_fcPlcfAtnbkl
Definition: ww8scan.hxx:1391
SwFormat * DerivedFrom() const
Definition: format.hxx:108
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:217
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
sal_uInt16 BuildGetSlot(const SwFormat &rFormat)
Get slot number during building the style table.
Definition: wrtw8sty.cxx:181
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
Content 9th level.
Definition: poolfmt.hxx:392
bool m_bIgnoreEmpty
Definition: wrtww8.hxx:1261
const OutlinerParaObject * GetTextObject() const
Definition: docufld.hxx:490
drawing::TextVerticalAdjust GetVerticalAdjustment() const
Definition: pagedesc.hxx:242
Doc. appendix.
Definition: poolfmt.hxx:425
virtual void StartStyleProperties(bool bParProp, sal_uInt16 nStyle)=0
Start of (paragraph or run) properties of a style.
sal_uInt32 GetHeight() const
const SwPageDesc * m_pCurrentPageDesc
Definition: wrtww8.hxx:496
const SwPageDesc * pPageDesc
Definition: wrtww8.hxx:178
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:737
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
const SwFrameFormat * GetPageFormatOfNode(const SwNode &rNd, bool bCheckForThisPgDc=true) const
Definition: pagedesc.cxx:321
SwCharFormat * GetCharFormat(SwDoc &rDoc) const
Definition: docftn.cxx:141
const sal_uInt16 sprmSFProtected
Definition: sprmids.hxx:536
void Append(WW8_CP nCp, const SwFormatFootnote &rFootnote)
Definition: wrtw8sty.cxx:2036
SvStream & Strm() const
Definition: wrtww8.hxx:1184
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool IsPaintLineNumbers() const
Definition: lineinfo.hxx:80
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:777
unsigned char sal_uInt8
sal_uInt16 m_aHeadingParagraphStyles[MAXLEVEL]
Definition: wrtww8.hxx:1576
void GetStyleData(SwFormat *pFormat, bool &bFormatColl, sal_uInt16 &nBase, sal_uInt16 &nNext)
Return information about one style.
Definition: wrtw8sty.cxx:552
void WriteSpecialText(sal_uLong nStart, sal_uLong nEnd, sal_uInt8 nTTyp)
Set the pCurPam appropriately and call WriteText().
Definition: wrtww8.cxx:1814
sal_uInt8 rtl_TextEncodingToWinCharset(rtl_TextEncoding eTextEncoding)
MSOffice appears to set the charset of unicode fonts to MS 932.
sal_uInt32 DateTime2DTTM(const DateTime &rDT)
Convert from DTTM to Writer's DateTime.
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:253
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1065
Marginalia.
Definition: poolfmt.hxx:258
bool bLoadAllFonts
If true, all fonts are loaded before processing the document.
Definition: wrtww8.hxx:341
OUString aName
FAMILY_SWISS
sal_Int32 m_lcbSttbfffn
Definition: ww8scan.hxx:1294
bool WriteKFText(WW8Export &rWrt)
Definition: wrtw8sty.cxx:1873
const HdFtFlags WW8_HEADER_FIRST
Definition: ww8scan.hxx:1592
Document Properties.
Definition: ww8scan.hxx:1597
sal_uInt16 Count() const
Definition: wrtw8sty.cxx:115
virtual ~WW8_WrPlcSepx() override
Definition: wrtw8sty.cxx:1045
void FontCharset(sal_uInt8 nCharSet, rtl_TextEncoding nEncoding) const
Font charset.
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
void WriteFootnoteBegin(const SwFormatFootnote &rFootnote, ww::bytes *pO=nullptr)
Definition: ww8atr.cxx:3363
WW8_WrPlc0(WW8_WrPlc0 const &)=delete
static void impl_SkipOdd(std::unique_ptr< ww::bytes > const &pO, std::size_t nTableStrmTell)
For WW8 only - extend pO so that the size of pTableStrm is even.
Definition: wrtw8sty.cxx:385
sal_uInt8 m_nTextTyp
Definition: wrtww8.hxx:548
WW8_Annotation(const SwPostItField *pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd)
Definition: wrtw8sty.cxx:2042
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
void WriteSdrTextObj(const SdrTextObj &rObj, sal_uInt8 nTyp)
Definition: wrtw8esh.cxx:1315
void IncrementHdFtIndex()
Definition: wrtww8.hxx:1137
virtual void EmptyParagraph()=0
Empty paragraph.
sal_uInt16 GetId(const SvxFontItem &rFont)
Definition: wrtw8sty.cxx:898
sal_uInt64 Tell() const
void * p
FIB - the File Information Block.
Definition: ww8scan.hxx:1096
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:377
void WriteSepx(SvStream &rStrm) const
Definition: wrtw8sty.cxx:1924
std::unique_ptr< WW8_WrPlc0 > pTextPos
Definition: wrtww8.hxx:251
virtual void StartSection() override
Start of the section properties.
Definition: wrtw8sty.cxx:1324
sal_uInt16 GetSlot(const SwFormat *pFormat) const
Get id of the style (rFormat).
Definition: wrtw8sty.cxx:172
WW8_CP m_ccpText
Definition: ww8scan.hxx:1201
sal_uInt16 fpc
Definition: ww8scan.hxx:1615
sal_uLong nOfs
Definition: wrtw8sty.cxx:108
bool IsPlausableSingleWordSection(const SwFrameFormat &rTitleFormat, const SwFrameFormat &rFollowFormat)
See if two page formats can be expressed as a single word section.
virtual void SectionBiDi(bool bBiDi)=0
Columns populated from right/numbers on the right side?
WW8_CP m_ccpFootnote
Definition: ww8scan.hxx:1202
std::vector< WW8_CP > aCps
Definition: wrtww8.hxx:247
SvStream & WriteChar(char nChar)
OUString m_sInitials
Definition: wrtww8.hxx:1258
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
static void InsUInt16(ww::bytes &rO, sal_uInt16 n)
Definition: wrtww8.cxx:1722
sal_uInt16 m_nLen
Definition: wrtw8sty.cxx:81
sal_uInt32 m_lcbHplxsdr
Definition: ww8scan.hxx:1511
void OutputStyleItemSet(const SfxItemSet &rSet, bool bTestForDefault)
Use OutputItem() on an item set - for styles.
Definition: ww8atr.cxx:5456
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
long GetRight() const
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
void InitFontTable(const SwDoc &rDoc)
rDoc used only to get the initial standard font(s) in use.
Definition: wrtw8sty.cxx:860
sal_uInt16 m_nUsedSlots
Definition: wrtww8.hxx:1578
OUString msAltNm
Definition: wrtww8.hxx:306
OUString m_aQuoVadis
Definition: ftninfo.hxx:94
#define RES_PARATR_WIDOWS
Definition: hintids.hxx:259
#define RES_BOX
Definition: hintids.hxx:306
const sal_uInt16 * GetRanges() const
virtual void SectionLineNumbering(sal_uLong nRestartNo, const SwLineNumberInfo &rLnNumInfo)=0
Numbering of the lines in the document.
virtual bool ignoreAttributeForStyleDefaults(sal_uInt16) const
Used to filter out attributes that can be e.g. written to .doc but not to .docx.
Definition: wrtww8.hxx:689
SwNodeIndex * GetStartNode() const
Definition: txtftn.hxx:41
Line numbering.
Definition: poolfmt.hxx:126
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:630
const SwFormat * m_pCurrentStyle
Definition: wrtww8.hxx:539
Base class for WW8Export and DocxExport.
Definition: wrtww8.hxx:453
bool IsTableNode() const
Definition: node.hxx:640
Subgroup index tables.
Definition: poolfmt.hxx:367
WW8_FC m_fcStshfOrig
Definition: ww8scan.hxx:1238
virtual void StartStyle(const OUString &rName, StyleType eType, sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId, bool bAutoUpdate)=0
Start of a style in the styles table.
Subgroup table of contents.
Definition: poolfmt.hxx:374
virtual void WriteHeadersFooters(sal_uInt8 nHeadFootFlags, const SwFrameFormat &rFormat, const SwFrameFormat &rLeftFormat, const SwFrameFormat &rFirstPageFormat, sal_uInt8 nBreakCode)=0
Output the actual headers and footers.
SwSectionNode * GetSectionNode()
Definition: node.hxx:607
virtual void StartStyles()=0
Start of the styles table.
virtual void WriteHeadersFooters(sal_uInt8 nHeadFootFlags, const SwFrameFormat &rFormat, const SwFrameFormat &rLeftFormat, const SwFrameFormat &rFirstPageFormat, sal_uInt8 nBreakCode) override
Output the actual headers and footers.
Definition: wrtw8sty.cxx:1502
virtual void SectionPageBorders(const SwFrameFormat *pFormat, const SwFrameFormat *pFirstPageFormat) override
Description of the page borders.
Definition: wrtw8sty.cxx:1392
const SfxItemSet * m_pISet
Definition: wrtww8.hxx:460
bool IsFirstShared() const
Definition: pagedesc.cxx:376
void WriteOutliner(const OutlinerParaObject &rOutliner, sal_uInt8 nTyp)
Definition: wrtw8esh.cxx:1343
SectionType GetType() const
Definition: section.hxx:171
static bool NoPageBreakSection(const SfxItemSet *pSet)
Definition: wrtw8nds.cxx:3120
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
std::map< const OUString, std::pair< WW8_CP, bool > > m_aRangeStartPositions
Definition: wrtww8.hxx:1275
const OUString & GetInitials() const
Definition: docufld.hxx:486
SwSection * GetSection() const
Definition: section.cxx:671
std::pair< const_iterator, bool > insert(Value &&x)
#define RES_PAGEDESC
Definition: hintids.hxx:293
MSWordSections(const MSWordSections &)
index of authorities.
Definition: poolfmt.hxx:408
sal_Int32 WW8_FC
Definition: ww8struc.hxx:152
sal_uInt8 maWW8_FFN[6]
Definition: wrtww8.hxx:304
static void WriteLong(SvStream &rStrm, sal_Int32 nVal)
Definition: wrtww8.hxx:965
static void FillCount(SvStream &rStrm, sal_uLong nCount)
Definition: wrtww8.cxx:944
virtual void TextVerticalAdjustment(const css::drawing::TextVerticalAdjust)
WW8_CP m_ccpHdr
Definition: ww8scan.hxx:1203
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:626
const sal_uInt16 sprmSLnc
Definition: sprmids.hxx:546
SvxFrameDirection TrueFrameDirection(const SwFrameFormat &rFlyFormat) const
Right to left?
Definition: wrtw8nds.cxx:1622
static void InsAsString16(ww::bytes &rO, const OUString &rStr)
Definition: wrtww8.cxx:1740
SwDoc * m_pDoc
Definition: wrtww8.hxx:575
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:628
virtual void SectionType(sal_uInt8 nBreakCode) override
The type of breaking.
Definition: wrtw8sty.cxx:1449
OUString m_aErgoSum
Definition: ftninfo.hxx:95
sal_uInt16 nFootnote
Definition: ww8scan.hxx:1621
sal_Int32 m_lcbPlcfAtnbkl
Definition: ww8scan.hxx:1392
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
const HdFtFlags WW8_FOOTER_ODD
Definition: ww8scan.hxx:1591
sal_Int32 m_lcbPlcfAtnbkf
Definition: ww8scan.hxx:1389
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1317
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:836
const sal_uInt16 sprmSFTitlePage
Definition: sprmids.hxx:540
const SwNode * pPDNd
Definition: wrtww8.hxx:180
std::unique_ptr< MSWordStyles > m_pStyles
Definition: wrtww8.hxx:502
const HdFtFlags WW8_HEADER_EVEN
Definition: ww8scan.hxx:1588
const sal_uInt16 sprmSFPgnRestart
Definition: sprmids.hxx:544
void FontFamilyType(FontFamily eFamily) const
Font family.
Base class of the Writer document model elements.
Definition: node.hxx:79
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:193