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