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