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