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