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;
271 case RES_POOLCOLL_TOX_ILLUS1: nRet = ww::stiToCaption; 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 GetFormatCol(rDoc, m_aSects.back()).GetNumCols();
1118}
1119
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 return aSet.Get(RES_COL);
1135}
1136
1138{
1139 if ( !m_aSects.empty() )
1140 return &m_aSects.back();
1141
1142 return nullptr;
1143}
1144
1146 const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo, bool bIsFirstParagraph )
1147{
1148 if (HeaderFooterWritten()) {
1149 return; // #i117955# prevent new sections in endnotes
1150 }
1151 m_aSects.emplace_back( pPd, pSectionFormat, nLnNumRestartNo, std::nullopt, nullptr, bIsFirstParagraph );
1153}
1154
1155void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwPageDesc* pPd,
1156 const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo )
1157{
1158 if (HeaderFooterWritten()) {
1159 return; // #i117955# prevent new sections in endnotes
1160 }
1161 m_aCps.push_back( nStartCp );
1162 AppendSection( pPd, pSectionFormat, nLnNumRestartNo );
1163}
1164
1166 const SwNode& rNd, const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo )
1167{
1168 if (HeaderFooterWritten()) {
1169 return; // #i117955# prevent new sections in endnotes
1170 }
1171
1172 WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFormat, nLnNumRestartNo, rPD.GetNumOffset(), &rNd );
1173
1174 m_aSects.push_back( aI );
1176}
1177
1179 const SwNode& rNd, const SwSectionFormat* pSectionFormat, sal_uLong nLnNumRestartNo )
1180{
1181 if (HeaderFooterWritten()) {
1182 return; // #i117955# prevent new sections in endnotes
1183 }
1184 m_aCps.push_back( nStartCp );
1185 AppendSection( rPD, rNd, pSectionFormat, nLnNumRestartNo );
1186}
1187
1189{
1190 sal_uInt8 nInfoFlags = 0;
1191 const SwFootnoteInfo& rInfo = rWrt.m_rDoc.GetFootnoteInfo();
1192 if( !rInfo.m_aErgoSum.isEmpty() ) nInfoFlags |= 0x02;
1193 if( !rInfo.m_aQuoVadis.isEmpty() ) nInfoFlags |= 0x04;
1194
1195 sal_uInt8 nEmptyStt = 0;
1196 if( nInfoFlags )
1197 {
1198 m_pTextPos->Append( nCpStt ); // empty footnote separator
1199
1200 if( 0x02 & nInfoFlags ) // Footnote continuation separator
1201 {
1202 m_pTextPos->Append( nCpStt );
1203 rWrt.WriteStringAsPara( rInfo.m_aErgoSum );
1204 rWrt.WriteStringAsPara( OUString() );
1205 nCpStt = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1206 }
1207 else
1208 m_pTextPos->Append( nCpStt );
1209
1210 if( 0x04 & nInfoFlags ) // Footnote continuation notice
1211 {
1212 m_pTextPos->Append( nCpStt );
1213 rWrt.WriteStringAsPara( rInfo.m_aQuoVadis );
1214 rWrt.WriteStringAsPara( OUString() );
1215 nCpStt = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1216 }
1217 else
1218 m_pTextPos->Append( nCpStt );
1219
1220 nEmptyStt = 3;
1221 }
1222
1223 while( 6 > nEmptyStt++ )
1224 m_pTextPos->Append( nCpStt );
1225
1226 // set the flags at the Dop right away
1227 WW8Dop& rDop = *rWrt.m_pDop;
1228 // Footnote Info
1229 switch( rInfo.m_eNum )
1230 {
1231 case FTNNUM_PAGE: rDop.rncFootnote = 2; break;
1232 case FTNNUM_CHAPTER: rDop.rncFootnote = 1; break;
1233 default: rDop.rncFootnote = 0; break;
1234 } // rncFootnote
1236 rDop.nFootnote = rInfo.m_nFootnoteOffset + 1;
1237 rDop.fpc = rWrt.m_bFootnoteAtTextEnd ? 2 : 1;
1238
1239 // Endnote Info
1240 rDop.rncEdn = 0; // rncEdn: Don't Restart
1241 const SwEndNoteInfo& rEndInfo = rWrt.m_rDoc.GetEndNoteInfo();
1243 rDop.nEdn = rEndInfo.m_nFootnoteOffset + 1;
1244 rDop.epc = rWrt.m_bEndAtTextEnd ? 3 : 0;
1245}
1246
1247void MSWordSections::SetHeaderFlag( sal_uInt8& rHeadFootFlags, const SwFormat& rFormat,
1248 sal_uInt8 nFlag )
1249{
1250 const SwFormatHeader* pItem = rFormat.GetItemIfSet(RES_HEADER);
1251 if( pItem && pItem->IsActive() && pItem->GetHeaderFormat() )
1252 rHeadFootFlags |= nFlag;
1253}
1254
1255void MSWordSections::SetFooterFlag( sal_uInt8& rHeadFootFlags, const SwFormat& rFormat,
1256 sal_uInt8 nFlag )
1257{
1258 const SwFormatFooter* pItem = rFormat.GetItemIfSet(RES_FOOTER);
1259 if( pItem && pItem->IsActive() && pItem->GetFooterFormat() )
1260 rHeadFootFlags |= nFlag;
1261}
1262
1264 const SwFormat& rFormat, sal_uLong& rCpPos, sal_uInt8 nHFFlags,
1265 sal_uInt8 nFlag, sal_uInt8 nBreakCode)
1266{
1267 if ( nFlag & nHFFlags )
1268 {
1269 m_pTextPos->Append( rCpPos );
1270 rWrt.WriteHeaderFooterText( rFormat, bHeader);
1271 rWrt.WriteStringAsPara( OUString() ); // CR to the end ( otherwise WW complains )
1272 rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1273 }
1274 else
1275 {
1276 m_pTextPos->Append( rCpPos );
1277 if ((bHeader? rWrt.m_bHasHdr : rWrt.m_bHasFtr) && nBreakCode!=0)
1278 {
1279 rWrt.WriteStringAsPara( OUString() ); // Empty paragraph for empty header/footer
1280 rWrt.WriteStringAsPara( OUString() ); // a CR that WW8 needs for end of the stream
1281 rCpPos = rWrt.Fc2Cp( rWrt.Strm().Tell() );
1282 }
1283 }
1284}
1285
1287{
1288 if (rInfo.IsProtected())
1289 mbDocumentIsProtected = true;
1290}
1291
1293{
1294 bool bRet = false;
1295 if (
1297 (reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) != pSectionFormat)
1298 )
1299 {
1300 const SwSection *pSection = pSectionFormat->GetSection();
1301 if (pSection && pSection->IsProtect())
1302 {
1303 bRet = true;
1304 }
1305 }
1306 return bRet;
1307}
1308
1310{
1311 // 2 values getting set
1312 // Dop.fFacingPages == Header and Footer different
1313 // Dop.fSwapBordersFacingPgs == mirrored borders
1314 sal_uInt16 nEnd = 0;
1315 for( const WW8_SepInfo& rSepInfo : m_aSects )
1316 {
1317 if( !rSepInfo.pSectionFormat )
1318 {
1319 const SwPageDesc* pPd = rSepInfo.pPageDesc;
1320 if( pPd->GetFollow() && pPd != pPd->GetFollow() &&
1321 pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
1322 rSepInfo.pPDNd &&
1323 pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd ) )
1324 // so this is first page and subsequent, so only respect follow
1325 pPd = pPd->GetFollow();
1326
1327 // left-/right chain of pagedescs ?
1328 else if( !( 1 & nEnd ) &&
1329 pPd->GetFollow() && pPd != pPd->GetFollow() &&
1330 pPd->GetFollow()->GetFollow() == pPd &&
1331 (( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1332 UseOnPage::Right == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ||
1333 ( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1334 UseOnPage::Left == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ))
1335 {
1336 rWrt.m_pDop->fFacingPages = rWrt.m_pDop->fMirrorMargins = true;
1337 nEnd |= 1;
1338 }
1339
1340 if( !( 1 & nEnd ) &&
1341 ( !pPd->IsHeaderShared() || !pPd->IsFooterShared() ))
1342 {
1343 rWrt.m_pDop->fFacingPages = true;
1344 nEnd |= 1;
1345 }
1346 if( !( 2 & nEnd ) &&
1348 {
1349 rWrt.m_pDop->fSwapBordersFacingPgs =
1350 rWrt.m_pDop->fMirrorMargins = true;
1351 nEnd |= 2;
1352 }
1353
1354 if( 3 == nEnd )
1355 break; // We do not need to go any further
1356 }
1357 }
1358}
1359
1361{
1362 const SvxBoxItem* pItem = rFormat.GetItemIfSet(RES_BOX);
1363 return pItem &&
1364 ( pItem->GetTop() ||
1365 pItem->GetBottom() ||
1366 pItem->GetLeft() ||
1367 pItem->GetRight() );
1368}
1369
1371{
1372 m_rWW8Export.m_pO->clear();
1373}
1374
1376{
1378 const SwEndNoteInfo& rEndNoteInfo = m_rWW8Export.m_rDoc.GetEndNoteInfo();
1380 switch( rInfo.m_eNum )
1381 {
1382 case FTNNUM_PAGE: m_rWW8Export.m_pO->push_back( sal_uInt8/*rncRstPage*/ (2) ); break;
1383 case FTNNUM_CHAPTER: m_rWW8Export.m_pO->push_back( sal_uInt8/*rncRstSect*/ (1) ); break;
1384 default: m_rWW8Export.m_pO->push_back( sal_uInt8/*rncCont*/ (0) ); break;
1385 }
1386
1393}
1394
1396{
1397 //If the document is to be exported as protected, then if a segment
1398 //is not protected, set the unlocked flag
1399 if ( m_rWW8Export.m_pSepx->DocumentIsProtected() && !bProtected )
1400 {
1402 m_rWW8Export.m_pO->push_back( 1 );
1403 }
1404}
1405
1407{
1408 // sprmSNLnnMod - activate Line Numbering and define Modulo
1411
1412 // sprmSDxaLnn - xPosition of Line Number
1415
1416 // sprmSLnc - restart number: 0 per page, 1 per section, 2 never restart
1417 if ( nRestartNo || !rLnNumInfo.IsRestartEachPage() )
1418 {
1420 m_rWW8Export.m_pO->push_back( nRestartNo ? 1 : 2 );
1421 }
1422
1423 // sprmSLnnMin - Restart the Line Number with given value
1424 if ( nRestartNo )
1425 {
1427 SwWW8Writer::InsUInt16( *m_rWW8Export.m_pO, o3tl::narrowing<sal_uInt16>(nRestartNo) - 1 );
1428 }
1429}
1430
1432{
1433 // sprmSFTitlePage
1435 m_rWW8Export.m_pO->push_back( 1 );
1436}
1437
1438void WW8AttributeOutput::SectionPageBorders( const SwFrameFormat* pPdFormat, const SwFrameFormat* pPdFirstPgFormat )
1439{
1440 // write border of page
1441 sal_uInt16 nPgBorder = MSWordSections::HasBorderItem( *pPdFormat ) ? 0 : USHRT_MAX;
1442 if ( pPdFormat != pPdFirstPgFormat )
1443 {
1444 if ( MSWordSections::HasBorderItem( *pPdFirstPgFormat ) )
1445 {
1446 if ( USHRT_MAX == nPgBorder )
1447 {
1448 nPgBorder = 1;
1449 // only the first page outlined -> Get the BoxItem from the correct format
1450 m_rWW8Export.m_pISet = &pPdFirstPgFormat->GetAttrSet();
1451 OutputItem( pPdFirstPgFormat->GetFormatAttr( RES_BOX ) );
1452 }
1453 }
1454 else if ( !nPgBorder )
1455 nPgBorder = 2;
1456 }
1457
1458 // [MS-DOC] 2.9.255 SPgbPropOperand; 2.9.185 PgbOffsetFrom
1459 if (m_bFromEdge)
1460 nPgBorder |= (1<<5);
1461
1462 if ( USHRT_MAX != nPgBorder )
1463 {
1464 // write the Flag and Border Attribute
1467 }
1468}
1469
1471{
1473 m_rWW8Export.m_pO->push_back( bBiDi? 1: 0 );
1474}
1475
1476void WW8AttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, const ::std::optional<sal_uInt16>& oPageRestartNumber )
1477{
1478 // sprmSNfcPgn
1481 m_rWW8Export.m_pO->push_back( nb );
1482
1483 if ( oPageRestartNumber )
1484 {
1485 // sprmSFPgnRestart
1487 m_rWW8Export.m_pO->push_back( 1 );
1488
1489 // sprmSPgnStart
1491 SwWW8Writer::InsUInt16( *m_rWW8Export.m_pO, *oPageRestartNumber );
1492 }
1493}
1494
1496{
1497 if ( 2 != nBreakCode ) // new page is the default
1498 {
1500 m_rWW8Export.m_pO->push_back( nBreakCode );
1501 }
1502}
1503
1505{
1506 if ( !pA )
1507 return;
1508
1509 if ( !m_pO->empty() ) // are there attributes ?
1510 {
1511 pA->m_nLen = m_pO->size();
1512 pA->m_pData.reset(new sal_uInt8 [m_pO->size()]);
1513 // store for later
1514 memcpy( pA->m_pData.get(), m_pO->data(), m_pO->size() );
1515 m_pO->clear(); // clear HdFt-Text
1516 }
1517 else // no attributes there
1518 {
1519 pA->m_pData.reset();
1520 pA->m_nLen = 0;
1521 }
1522}
1523
1524void WW8AttributeOutput::TextVerticalAdjustment( const drawing::TextVerticalAdjust nVA )
1525{
1526 if ( drawing::TextVerticalAdjust_TOP == nVA ) // top alignment is the default
1527 return;
1528
1529 sal_uInt8 nMSVA = 0;
1530 switch( nVA )
1531 {
1532 case drawing::TextVerticalAdjust_CENTER:
1533 nMSVA = 1;
1534 break;
1535 case drawing::TextVerticalAdjust_BOTTOM: //Writer = 2, Word = 3
1536 nMSVA = 3;
1537 break;
1538 case drawing::TextVerticalAdjust_BLOCK: //Writer = 3, Word = 2
1539 nMSVA = 2;
1540 break;
1541 default:
1542 break;
1543 }
1545 m_rWW8Export.m_pO->push_back( nMSVA );
1546}
1547
1549 const SwFrameFormat& rFormat, const SwFrameFormat& rLeftHeaderFormat, const SwFrameFormat& rLeftFooterFormat, const SwFrameFormat& rFirstPageFormat, sal_uInt8 nBreakCode, bool /*bEvenAndOddHeaders*/ )
1550{
1551 sal_uLong nCpPos = Fc2Cp( Strm().Tell() );
1552
1554 if ( !(nHeadFootFlags & WW8_HEADER_EVEN) && m_pDop->fFacingPages )
1555 m_pSepx->OutHeaderFooter( *this, true, rFormat, nCpPos, nHeadFootFlags, WW8_HEADER_ODD, nBreakCode );
1556 else
1557 m_pSepx->OutHeaderFooter( *this, true, rLeftHeaderFormat, nCpPos, nHeadFootFlags, WW8_HEADER_EVEN, nBreakCode );
1559 m_pSepx->OutHeaderFooter( *this, true, rFormat, nCpPos, nHeadFootFlags, WW8_HEADER_ODD, nBreakCode );
1560
1562 if ( !(nHeadFootFlags & WW8_FOOTER_EVEN) && m_pDop->fFacingPages )
1563 m_pSepx->OutHeaderFooter( *this, false, rFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD, nBreakCode );
1564 else
1565 m_pSepx->OutHeaderFooter( *this, false, rLeftFooterFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_EVEN, nBreakCode );
1567 m_pSepx->OutHeaderFooter( *this, false, rFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_ODD, nBreakCode );
1568
1569 //#i24344# Drawing objects cannot be directly shared between main hd/ft
1570 //and title hd/ft so we need to differentiate them
1572 m_pSepx->OutHeaderFooter( *this, true, rFirstPageFormat, nCpPos, nHeadFootFlags, WW8_HEADER_FIRST, nBreakCode );
1573 m_pSepx->OutHeaderFooter( *this, false, rFirstPageFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_FIRST, nBreakCode );
1574}
1575
1576namespace
1577{
1582bool UsePrevSectionNextStyle(sal_uInt8 nBreakCode, const SwPageDesc* pPd,
1583 const WW8_SepInfo& rSepInfo)
1584{
1585 if (nBreakCode != 0)
1586 {
1587 // Not a continuous section break.
1588 return false;
1589 }
1590
1591 if (!pPd->GetFollow())
1592 {
1593 // Page style has no follow style.
1594 return false;
1595 }
1596
1597 // We start a continuous section break without headers/footers. Possibly the importer had
1598 // headers/footers for this section break and put them to the closest page break's page style's
1599 // next page style. See "find a node in the section that has a page break" in writerfilter/.
1600 // Try the last-in-practice paragraph of the previous section.
1601 const SwSectionFormat* pSection = rSepInfo.pSectionFormat;
1602 if (pSection == reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)))
1603 {
1604 return false;
1605 }
1606
1607 const SwNodeIndex* pSectionStart = pSection->GetContent().GetContentIdx();
1608 if (!pSectionStart)
1609 {
1610 return false;
1611 }
1612
1613 SwPaM aPaM(*pSectionStart);
1614 aPaM.Move(fnMoveBackward);
1615 if (!aPaM.GetPointNode().IsTextNode())
1616 {
1617 return false;
1618 }
1619
1620 SwTextNode* pTextNode = aPaM.GetPointNode().GetTextNode();
1621 const SwAttrSet* pParaProps = &pTextNode->GetSwAttrSet();
1622 sal_uInt32 nCharHeight = pParaProps->GetSize().GetHeight();
1623 if (nCharHeight > 20)
1624 {
1625 return false;
1626 }
1627
1628 aPaM.Move(fnMoveBackward);
1629 if (!aPaM.GetPointNode().IsTextNode())
1630 {
1631 return false;
1632 }
1633
1634 pTextNode = aPaM.GetPointNode().GetTextNode();
1635 pParaProps = &pTextNode->GetSwAttrSet();
1636 return pParaProps->HasItem(RES_PAGEDESC);
1637}
1638}
1639
1641{
1642 const SwPageDesc* pPd = rSepInfo.pPageDesc;
1643
1644 if ( rSepInfo.pSectionFormat && !pPd )
1645 pPd = &m_rDoc.GetPageDesc( 0 );
1646
1647 m_pCurrentPageDesc = pPd;
1648
1649 if ( !pPd )
1650 return;
1651
1652 bool bOldPg = m_bOutPageDescs;
1653 m_bOutPageDescs = true;
1654 const SwPageDesc* pSavedPageDesc = pPd;
1655
1657
1659
1660 // forms
1662
1663 // line numbers
1664 const SwLineNumberInfo& rLnNumInfo = m_rDoc.GetLineNumberInfo();
1665 if ( rLnNumInfo.IsPaintLineNumbers() )
1666 AttrOutput().SectionLineNumbering( rSepInfo.nLnNumRestartNo, rLnNumInfo );
1667
1668 /* sprmSBkc, break code: 0 No break, 1 New column
1669 2 New page, 3 Even page, 4 Odd page
1670 */
1671 sal_uInt8 nBreakCode = 2; // default start new page
1672 bool bOutPgDscSet = true, bLeftRightPgChain = false, bOutputStyleItemSet = false;
1673 const SwFrameFormat* pPdFormat = &pPd->GetMaster();
1674 bool bUsePrevSectionNextStyle = false;
1675 if ( rSepInfo.pSectionFormat )
1676 {
1677 // if pSectionFormat is set, then there is a SectionNode
1678 // valid pointer -> start Section ,
1679 // 0xfff -> Section terminated
1680 nBreakCode = 0; // consecutive section
1681
1682 if (rSepInfo.pPDNd && (rSepInfo.pPDNd->IsContentNode() || rSepInfo.pPDNd->IsTableNode()))
1683 {
1684 const SfxItemSet* pSet
1685 = rSepInfo.pPDNd->IsContentNode()
1686 ? &rSepInfo.pPDNd->GetContentNode()->GetSwAttrSet()
1687 : &rSepInfo.pPDNd->GetTableNode()->GetTable().GetFrameFormat()->GetAttrSet();
1688
1689 if (!NoPageBreakSection(pSet))
1690 nBreakCode = 2;
1691 }
1692
1693 if (reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) != rSepInfo.pSectionFormat)
1694 {
1695 if ( nBreakCode == 0 )
1696 bOutPgDscSet = false;
1697
1698 // produce Itemset, which inherits PgDesk-Attr-Set:
1699 // as child also the parent is searched if 'deep'-OutputItemSet
1700 const SfxItemSet* pPdSet = &pPdFormat->GetAttrSet();
1701
1702 bUsePrevSectionNextStyle = GetExportFormat() == ExportFormat::DOCX
1703 && UsePrevSectionNextStyle(nBreakCode, pPd, rSepInfo);
1704 if (bUsePrevSectionNextStyle)
1705 {
1706 // Take page margins from the previous section's next style.
1707 pPdSet = &pPd->GetFollow()->GetMaster().GetAttrSet();
1708 }
1709
1710 SfxItemSet aSet( *pPdSet->GetPool(), pPdSet->GetRanges() );
1711 aSet.SetParent( pPdSet );
1712
1713 // at the child ONLY change column structure according to Sect-Attr.
1714
1715 const SvxLRSpaceItem &rSectionLR =
1717 const SvxLRSpaceItem &rPageLR =
1718 pPdFormat->GetFormatAttr( RES_LR_SPACE );
1719
1720 SvxLRSpaceItem aResultLR( rPageLR.GetLeft() +
1721 rSectionLR.GetLeft(), rPageLR.GetRight() +
1722 rSectionLR.GetRight(), 0, RES_LR_SPACE );
1723 //i120133: The Section width should consider section indent value.
1724 if (rSectionLR.GetLeft()+rSectionLR.GetRight()!=0)
1725 {
1726 const SwFormatCol& rCol = rSepInfo.pSectionFormat->GetFormatAttr(RES_COL);
1727 SwFormatCol aCol(rCol);
1728 aCol.SetAdjustValue(rSectionLR.GetLeft()+rSectionLR.GetRight());
1729 aSet.Put(aCol);
1730 }
1731 else
1732 aSet.Put(rSepInfo.pSectionFormat->GetFormatAttr(RES_COL));
1733
1734 aSet.Put( aResultLR );
1735
1736 // and write into the WW-File
1737 const SfxItemSet* pOldI = m_pISet;
1738 m_pISet = &aSet;
1739
1740 // Switch off test on default item values, if page description
1741 // set (value of <bOutPgDscSet>) isn't written.
1742 AttrOutput().OutputStyleItemSet( aSet, bOutPgDscSet );
1743 bOutputStyleItemSet = true;
1744
1745 //Cannot export as normal page framedir, as continuous sections
1746 //cannot contain any grid settings like proper sections
1747 AttrOutput().SectionBiDi( SvxFrameDirection::Horizontal_RL_TB == TrueFrameDirection( *rSepInfo.pSectionFormat ) );
1748
1749 m_pISet = pOldI;
1750 }
1751 }
1752
1753 // Libreoffice 4.0 introduces support for page styles (SwPageDesc) with
1754 // a different header/footer for the first page. The same effect can be
1755 // achieved by chaining two page styles together (SwPageDesc::GetFollow)
1756 // which are identical except for header/footer.
1757 // The latter method was previously used by the doc/docx import filter.
1758 // In both of these cases, we emit a single Word section with different
1759 // first page header/footer.
1760 const SwFrameFormat* pPdFirstPgFormat = &pPd->GetFirstMaster();
1761 bool titlePage = !pPd->IsFirstShared();
1762 if ( bOutPgDscSet )
1763 {
1764 // if a Follow is set and it does not point to itself,
1765 // then there is a page chain.
1766 // If this emulates a "first page", we can detect it here and write
1767 // it as title page.
1768 // With Left/Right changes it's different - we have to detect where
1769 // the change of pages is, but here it's too late for that!
1770 if ( pPd->GetFollow() && pPd != pPd->GetFollow() &&
1771 pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
1772 pPd->IsHeaderShared() && pPd->IsFooterShared() &&
1773 ( !rSepInfo.pPDNd || pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd ) ) )
1774 {
1775 const SwPageDesc *pFollow = pPd->GetFollow();
1776 const SwFrameFormat& rFollowFormat = pFollow->GetMaster();
1777 if (sw::util::IsPlausableSingleWordSection(*pPdFirstPgFormat, rFollowFormat))
1778 {
1779 if (titlePage)
1780 {
1781 // Do nothing. First format is already set.
1782 }
1783 else if (rSepInfo.pPDNd)
1784 pPdFirstPgFormat = pPd->GetPageFormatOfNode( *rSepInfo.pPDNd );
1785 else
1786 pPdFirstPgFormat = &pPd->GetMaster();
1787
1788 m_pCurrentPageDesc = pPd = pFollow;
1789 pPdFormat = &rFollowFormat;
1790
1791 // has different headers/footers for the title page
1792 titlePage = true;
1793 }
1794 }
1795 else if (nBreakCode == 2 && pPd == m_pPreviousSectionPageDesc && pPd->GetFollow() == pPd)
1796 {
1797 // The first title page has already been displayed in the previous section. Drop it.
1798 titlePage = false;
1799 }
1800
1801 const SfxItemSet* pOldI = m_pISet;
1802
1803 const SfxPoolItem* pItem;
1804 if ( titlePage && SfxItemState::SET ==
1805 pPdFirstPgFormat->GetItemState( RES_PAPER_BIN, true, &pItem ) )
1806 {
1807 m_pISet = &pPdFirstPgFormat->GetAttrSet();
1808 m_bOutFirstPage = true;
1809 AttrOutput().OutputItem( *pItem );
1810 m_bOutFirstPage = false;
1811 }
1812
1813 // left-/right chain of pagedescs ?
1814 if ( pPd->GetFollow() && pPd != pPd->GetFollow() &&
1815 pPd->GetFollow()->GetFollow() == pPd &&
1816 (( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1817 UseOnPage::Right == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ||
1818 ( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) &&
1819 UseOnPage::Left == ( UseOnPage::All & pPd->GetFollow()->ReadUseOn() )) ))
1820 {
1821 bLeftRightPgChain = true;
1822
1823 // which is the reference point? (left or right?)
1824 // assume it is on the right side!
1825 if ( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) )
1826 {
1827 nBreakCode = 3;
1828 pPdFormat = &pPd->GetMaster(); //use the current page for settings (margins/width etc)
1829 pPd = pPd->GetFollow(); //switch to the right page for the right/odd header/footer
1830 }
1831 else
1832 nBreakCode = 4;
1833 }
1834
1835 m_pISet = &pPdFormat->GetAttrSet();
1836 if (!bOutputStyleItemSet)
1837 {
1838 if (titlePage)
1839 {
1840 m_pFirstPageFormat = pPdFirstPgFormat;
1841 }
1842
1843 AttrOutput().OutputStyleItemSet( pPdFormat->GetAttrSet(), false );
1844
1845 if (titlePage)
1846 {
1847 m_pFirstPageFormat = nullptr;
1848 }
1849 }
1850 AttrOutput().SectionPageBorders( pPdFormat, pPdFirstPgFormat );
1851 m_pISet = pOldI;
1852
1853 // then the rest of the settings from PageDesc
1855
1856 // will it be only left or only right pages?
1857 if ( 2 == nBreakCode )
1858 {
1859 if ( UseOnPage::Left == ( UseOnPage::All & pPd->ReadUseOn() ) )
1860 nBreakCode = 3;
1861 else if ( UseOnPage::Right == ( UseOnPage::All & pPd->ReadUseOn() ) )
1862 nBreakCode = 4;
1863 }
1864 }
1865
1866 if (titlePage)
1868
1869 AttrOutput().SectionType( nBreakCode );
1870
1871 if( rSepInfo.pPageDesc ) {
1873 }
1874
1875 // Header or Footer
1876 sal_uInt8 nHeadFootFlags = 0;
1877 // Should we output a w:evenAndOddHeaders tag or not?
1878 // N.B.: despite its name this tag affects _both_ headers and footers!
1879 bool bEvenAndOddHeaders = true;
1880 bool bEvenAndOddFooters = true;
1881
1882 const SwFrameFormat* pPdLeftHeaderFormat = nullptr;
1883 const SwFrameFormat* pPdLeftFooterFormat = nullptr;
1884 if (bLeftRightPgChain)
1885 {
1886 const SwFrameFormat* pHeaderFormat = pPd->GetStashedFrameFormat(true, true, true);
1887 const SwFrameFormat* pFooterFormat = pPd->GetStashedFrameFormat(false, true, true);
1888 if (pHeaderFormat)
1889 {
1890 pPdLeftHeaderFormat = pHeaderFormat;
1891 bEvenAndOddHeaders = false;
1892 }
1893 else
1894 {
1895 pPdLeftHeaderFormat = &pPd->GetFollow()->GetFirstLeft();
1896 }
1897 if (pFooterFormat)
1898 {
1899 pPdLeftFooterFormat = pFooterFormat;
1900 bEvenAndOddFooters = false;
1901 }
1902 else
1903 {
1904 pPdLeftFooterFormat = &pPd->GetFollow()->GetFirstLeft();
1905 }
1906 }
1907 else
1908 {
1909 const SwFrameFormat* pHeaderFormat = pPd->GetStashedFrameFormat(true, true, false);
1910 const SwFrameFormat* pFooterFormat = pPd->GetStashedFrameFormat(false, true, false);
1911 if (pHeaderFormat)
1912 {
1913 pPdLeftHeaderFormat = pHeaderFormat;
1914 bEvenAndOddHeaders = false;
1915 }
1916 else
1917 {
1918 pPdLeftHeaderFormat = &pPd->GetLeft();
1919 }
1920 if (pFooterFormat)
1921 {
1922 pPdLeftFooterFormat = pFooterFormat;
1923 bEvenAndOddFooters = false;
1924 }
1925 else
1926 {
1927 pPdLeftFooterFormat = &pPd->GetLeft();
1928 }
1929 }
1930
1931 // Ensure that headers are written if section is first paragraph
1932 if (nBreakCode != 0 || (rSepInfo.pSectionFormat && rSepInfo.bIsFirstParagraph))
1933 {
1934 if ( titlePage )
1935 {
1936 // there is a First Page:
1937 MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFormat, WW8_HEADER_FIRST );
1938 MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFirstPgFormat, WW8_FOOTER_FIRST );
1939 }
1940 else
1941 {
1942 if ( pPd->GetStashedFrameFormat(true, true, true) && pPdLeftHeaderFormat && pPdLeftHeaderFormat->GetHeader().GetHeaderFormat() )
1943 {
1944 MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftHeaderFormat, WW8_HEADER_FIRST );
1945 }
1946 if ( pPd->GetStashedFrameFormat(false, true, true) && pPdLeftFooterFormat && pPdLeftFooterFormat->GetFooter().GetFooterFormat() )
1947 {
1948 MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFooterFormat, WW8_FOOTER_FIRST );
1949 }
1950 }
1951
1952 MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFormat, WW8_HEADER_ODD );
1953 MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFormat, WW8_FOOTER_ODD );
1954
1955 if ( !pPd->IsHeaderShared() || bLeftRightPgChain )
1956 {
1957 MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftHeaderFormat, WW8_HEADER_EVEN );
1958 }
1959 else if ( pPd->IsHeaderShared() && pPd->GetStashedFrameFormat(true, true, false) && pPdLeftHeaderFormat && pPdLeftHeaderFormat->GetHeader().GetHeaderFormat() )
1960 {
1961 MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftHeaderFormat, WW8_HEADER_EVEN );
1962 bEvenAndOddHeaders = false;
1963 }
1964
1965 if ( !pPd->IsFooterShared() || bLeftRightPgChain )
1966 {
1967 MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFooterFormat, WW8_FOOTER_EVEN );
1968 }
1969 else if ( pPd->IsFooterShared() && pPd->GetStashedFrameFormat(false, true, false) && pPdLeftFooterFormat && pPdLeftFooterFormat->GetFooter().GetFooterFormat() )
1970 {
1971 MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFooterFormat, WW8_FOOTER_EVEN );
1972 bEvenAndOddFooters = false;
1973 }
1974 }
1975
1976 // binary filters only
1978
1979 /*
1980 !!!!!!!!!!!
1981 // borders at header and footer texts would be done like this:
1982 // This should use something like pOut,
1983 // which is repeated with every special text line.
1984 const SwFrameFormat* pFFormat = rFt.GetFooterFormat();
1985 const SvxBoxItem& rBox = pFFormat->GetBox(false);
1986 OutWW8_SwFormatBox1( m_rWW8Export.pOut, rBox, false);
1987 !!!!!!!!!!!
1988 You can turn this into paragraph attributes, which are then observed in each paragraph.
1989 Applies to background / border.
1990 !!!!!!!!!!!
1991 */
1992
1993 const SwTextNode *pOldPageRoot = GetHdFtPageRoot();
1994 SetHdFtPageRoot( rSepInfo.pPDNd ? rSepInfo.pPDNd->GetTextNode() : nullptr );
1995
1996 if (bUsePrevSectionNextStyle && nHeadFootFlags == 0)
1997 {
1998 // Take headers/footers from the previous section's next style.
1999 pPdFormat = &pPd->GetFollow()->GetMaster();
2000 MSWordSections::SetHeaderFlag(nHeadFootFlags, *pPdFormat, WW8_HEADER_ODD);
2001 MSWordSections::SetFooterFlag(nHeadFootFlags, *pPdFormat, WW8_FOOTER_ODD);
2002 }
2003
2004 WriteHeadersFooters( nHeadFootFlags, *pPdFormat, *pPdLeftHeaderFormat, *pPdLeftFooterFormat, *pPdFirstPgFormat, nBreakCode, bEvenAndOddHeaders && bEvenAndOddFooters );
2005
2006 SetHdFtPageRoot( pOldPageRoot );
2007
2009
2010 // outside of the section properties again
2011 m_bOutPageDescs = bOldPg;
2012 m_pPreviousSectionPageDesc = pSavedPageDesc;
2013}
2014
2016{
2017 sal_uLong nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2018
2019 OSL_ENSURE( !m_pTextPos, "who set the pointer?" );
2020 m_pTextPos.reset( new WW8_WrPlc0( nCpStart ) );
2021
2022 WriteFootnoteEndText( rWrt, nCpStart );
2023 CheckForFacinPg( rWrt );
2024
2025 unsigned int nOldIndex = rWrt.GetHdFtIndex();
2026 rWrt.SetHdFtIndex( 0 );
2027
2028 for (const WW8_SepInfo & rSepInfo : m_aSects)
2029 {
2030 auto pAttrDesc = std::make_shared<WW8_PdAttrDesc>();
2031 m_SectionAttributes.push_back(pAttrDesc);
2032
2033 rWrt.SectionProperties( rSepInfo, pAttrDesc.get() );
2034
2035 // FIXME: this writes the section properties, but not of all sections;
2036 // it's possible that later in the document (e.g. in endnotes) sections
2037 // are added, but they won't have their properties written here!
2039 }
2040 rWrt.SetHdFtIndex( nOldIndex ); //0
2041
2042 if ( m_pTextPos->Count() )
2043 {
2044 // HdFt available?
2045 sal_uLong nCpEnd = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2046 m_pTextPos->Append( nCpEnd ); // End of last Header/Footer for PlcfHdd
2047
2048 if ( nCpEnd > nCpStart )
2049 {
2050 ++nCpEnd;
2051 m_pTextPos->Append( nCpEnd + 1 ); // End of last Header/Footer for PlcfHdd
2052
2053 rWrt.WriteStringAsPara( OUString() ); // CR to the end ( otherwise WW complains )
2054 }
2055 rWrt.m_pFieldHdFt->Finish( nCpEnd, rWrt.m_pFib->m_ccpText + rWrt.m_pFib->m_ccpFootnote );
2056 rWrt.m_pFib->m_ccpHdr = nCpEnd - nCpStart;
2057 }
2058 else
2059 {
2060 m_pTextPos.reset();
2061 }
2062
2063 return rWrt.m_pFib->m_ccpHdr != 0;
2064}
2065
2067{
2068 OSL_ENSURE(m_SectionAttributes.size() == static_cast<size_t>(m_aSects.size())
2069 , "WriteSepx(): arrays out of sync!");
2070 for (const auto & rSectionAttribute : m_SectionAttributes) // all sections
2071 {
2072 WW8_PdAttrDesc *const pA = rSectionAttribute.get();
2073 if (pA->m_nLen && pA->m_pData != nullptr)
2074 {
2075 pA->m_nSepxFcPos = rStrm.Tell();
2077 rStrm.WriteBytes(pA->m_pData.get(), pA->m_nLen);
2078 }
2079 }
2080}
2081
2083{
2084 OSL_ENSURE(m_SectionAttributes.size() == static_cast<size_t>(m_aSects.size())
2085 , "WritePlcSed(): arrays out of sync!");
2086 OSL_ENSURE( m_aCps.size() == m_aSects.size() + 1, "WrPlcSepx: DeSync" );
2087 sal_uInt64 nFcStart = rWrt.m_pTableStrm->Tell();
2088
2089 for( decltype(m_aSects)::size_type i = 0; i <= m_aSects.size(); i++ )
2090 {
2091 sal_uInt32 nP = m_aCps[i];
2092 rWrt.m_pTableStrm->WriteUInt32(nP);
2093 }
2094
2095 static WW8_SED aSed = {{4, 0},{0, 0, 0, 0},{0, 0},{0xff, 0xff, 0xff, 0xff}};
2096
2097 for (const auto & rSectionAttribute : m_SectionAttributes)
2098 {
2099 // Sepx-Pos
2100 UInt32ToSVBT32( rSectionAttribute->m_nSepxFcPos, aSed.fcSepx );
2101 rWrt.m_pTableStrm->WriteBytes(&aSed, sizeof(aSed));
2102 }
2103 rWrt.m_pFib->m_fcPlcfsed = nFcStart;
2104 rWrt.m_pFib->m_lcbPlcfsed = rWrt.m_pTableStrm->Tell() - nFcStart;
2105}
2106
2108{
2109 // Don't write out the PlcfHdd if ccpHdd is 0: it's a validation failure case.
2110 if( rWrt.m_pFib->m_ccpHdr != 0 && m_pTextPos && m_pTextPos->Count() )
2111 {
2112 rWrt.m_pFib->m_fcPlcfhdd = rWrt.m_pTableStrm->Tell();
2113 m_pTextPos->Write( *rWrt.m_pTableStrm ); // Plc0
2114 rWrt.m_pFib->m_lcbPlcfhdd = rWrt.m_pTableStrm->Tell() -
2115 rWrt.m_pFib->m_fcPlcfhdd;
2116 }
2117}
2118
2119void MSWordExportBase::WriteHeaderFooterText( const SwFormat& rFormat, bool bHeader )
2120{
2121 const SwFormatContent *pContent;
2122 if ( bHeader )
2123 {
2124 m_bHasHdr = true;
2125 const SwFormatHeader& rHd = rFormat.GetHeader();
2126 OSL_ENSURE( rHd.GetHeaderFormat(), "Header text is not here" );
2127
2128 if ( !rHd.GetHeaderFormat() )
2129 return;
2130
2131 pContent = &rHd.GetHeaderFormat()->GetContent();
2132 }
2133 else
2134 {
2135 m_bHasFtr = true;
2136 const SwFormatFooter& rFt = rFormat.GetFooter();
2137 OSL_ENSURE( rFt.GetFooterFormat(), "Footer text is not here" );
2138
2139 if ( !rFt.GetFooterFormat() )
2140 return;
2141
2142 pContent = &rFt.GetFooterFormat()->GetContent();
2143 }
2144
2145 const SwNodeIndex* pSttIdx = pContent->GetContentIdx();
2146
2147 if ( pSttIdx )
2148 {
2149 SwNodeIndex aIdx( *pSttIdx, 1 ),
2150 aEnd( *pSttIdx->GetNode().EndOfSectionNode() );
2151 SwNodeOffset nStart = aIdx.GetIndex();
2152 SwNodeOffset nEnd = aEnd.GetIndex();
2153
2154 // range, i.e. valid node
2155 if ( nStart < nEnd )
2156 {
2157 bool bOldKF = m_bOutKF;
2158 m_bOutKF = true;
2159 WriteSpecialText( nStart, nEnd, TXT_HDFT );
2160 m_bOutKF = bOldKF;
2161 }
2162 else
2163 pSttIdx = nullptr;
2164 }
2165
2166 if ( !pSttIdx )
2167 {
2168 // there is no Header/Footer, but a CR is still necessary
2169 OSL_ENSURE( pSttIdx, "Header/Footer text is not really present" );
2171 }
2172}
2173
2174// class WW8_WrPlcFootnoteEdn : Collect the Footnotes and Endnotes and output their text
2175// and Plcs at the end of the document.
2176// WW8_WrPlcFootnoteEdn is the class for Footnotes and Endnotes
2177
2179{
2180}
2181
2183{
2184}
2185
2187{
2188 m_aCps.push_back( nCp );
2189 m_aContent.push_back( &rFootnote );
2190}
2191
2192WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd)
2193 :
2195 m_nRangeStart(nRangeStart),
2196 m_nRangeEnd(nRangeEnd)
2197{
2198 mpRichText = pPostIt->GetTextObject();
2199 if (!mpRichText)
2200 msSimpleText = pPostIt->GetText();
2201 msOwner = pPostIt->GetPar1();
2202 m_sInitials = pPostIt->GetInitials();
2203 maDateTime = DateTime(pPostIt->GetDate(), pPostIt->GetTime());
2204}
2205
2207 :
2208 mpRichText(nullptr),
2209 msSimpleText(pRedline->GetComment()),
2210 msOwner(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())),
2211 maDateTime(pRedline->GetTimeStamp()),
2212 m_nRangeStart(0),
2213 m_nRangeEnd(0)
2214{
2215}
2216
2218{
2220 {
2221 return true;
2222 }
2223
2224 return !m_bIgnoreEmpty;
2225}
2226
2227void WW8_WrPlcAnnotations::AddRangeStartPosition(const OUString& rName, WW8_CP nStartCp,
2228 bool bIgnoreEmpty)
2229{
2230 m_aRangeStartPositions[rName] = std::make_pair(nStartCp, bIgnoreEmpty);
2231}
2232
2234{
2235 m_aCps.push_back( nCp );
2237 if( m_aRangeStartPositions.find(pPostIt->GetName()) != m_aRangeStartPositions.end() )
2238 {
2239 auto [nStartCp, bIgnoreEmpty] = m_aRangeStartPositions[pPostIt->GetName()];
2240 p = new WW8_Annotation(pPostIt, nStartCp, nCp);
2241 p->m_bIgnoreEmpty = bIgnoreEmpty;
2242 m_aRangeStartPositions.erase(pPostIt->GetName());
2243 }
2244 else
2245 {
2246 p = new WW8_Annotation(pPostIt, nCp, nCp);
2247 }
2248 m_aContent.push_back( p );
2249}
2250
2252{
2253 maProcessedRedlines.insert(pRedline);
2254 m_aCps.push_back( nCp );
2255 WW8_Annotation* p = new WW8_Annotation(pRedline);
2256 m_aContent.push_back( p );
2257}
2258
2260{
2261 return maProcessedRedlines.find(pRedline) == maProcessedRedlines.end();
2262}
2263
2265{
2266 for(const void * p : m_aContent)
2267 delete static_cast<WW8_Annotation const *>(p);
2268}
2269
2271 WW8_CP& rCount )
2272{
2273 sal_uInt16 nLen = m_aContent.size();
2274 if ( !nLen )
2275 return false;
2276
2277 sal_uLong nCpStart = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2278 m_pTextPos.reset( new WW8_WrPlc0( nCpStart ) );
2279 sal_uInt16 i;
2280
2281 switch ( nTTyp )
2282 {
2283 case TXT_ATN:
2284 for ( i = 0; i < nLen; i++ )
2285 {
2286 // beginning for PlcfAtnText
2287 m_pTextPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
2288
2289 rWrt.WritePostItBegin();
2290 const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(m_aContent[i]);
2291 if (rAtn.mpRichText)
2292 rWrt.WriteOutliner(*rAtn.mpRichText, nTTyp);
2293 else
2294 {
2295 OUString sText(rAtn.msSimpleText);
2296 rWrt.WriteStringAsPara(sText.replace(0x0A, 0x0B));
2297 }
2298 }
2299 break;
2300
2301 case TXT_TXTBOX:
2302 case TXT_HFTXTBOX:
2303 for ( i = 0; i < nLen; i++ )
2304 {
2305 // textbox content
2306 WW8_CP nCP = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2307 m_aCps.insert( m_aCps.begin()+i, nCP );
2308 m_pTextPos->Append( nCP );
2309
2310 if( m_aContent[ i ] != nullptr )
2311 {
2312 // is it a writer or sdr - textbox?
2313 const SdrObject& rObj = *static_cast<SdrObject const *>(m_aContent[ i ]);
2314 if (rObj.GetObjInventor() == SdrInventor::FmForm)
2315 {
2316 sal_uInt8 nOldTyp = rWrt.m_nTextTyp;
2317 rWrt.m_nTextTyp = nTTyp;
2318 rWrt.GetOCXExp().ExportControl(rWrt, dynamic_cast<const SdrUnoObj&>(rObj));
2319 rWrt.m_nTextTyp = nOldTyp;
2320 }
2321 else if( auto pText = DynCastSdrTextObj(&rObj) )
2322 rWrt.WriteSdrTextObj(*pText, nTTyp);
2323 else
2324 {
2325 const SwFrameFormat* pFormat = ::FindFrameFormat( &rObj );
2326 OSL_ENSURE( pFormat, "where is the format?" );
2327
2328 const SwNodeIndex* pNdIdx = pFormat->GetContent().GetContentIdx();
2329 OSL_ENSURE( pNdIdx, "where is the StartNode of the Textbox?" );
2330 rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
2331 pNdIdx->GetNode().EndOfSectionIndex(),
2332 nTTyp );
2333 {
2334 SwNodeIndex aContentIdx = *pNdIdx;
2335 ++aContentIdx;
2336 if ( aContentIdx.GetNode().IsTableNode() )
2337 {
2338 bool bContainsOnlyTables = true;
2339 do {
2340 aContentIdx = *(aContentIdx.GetNode().EndOfSectionNode());
2341 ++aContentIdx;
2342 if ( !aContentIdx.GetNode().IsTableNode() &&
2343 aContentIdx.GetIndex() != pNdIdx->GetNode().EndOfSectionIndex() )
2344 {
2345 bContainsOnlyTables = false;
2346 }
2347 } while ( aContentIdx.GetNode().IsTableNode() );
2348 if ( bContainsOnlyTables )
2349 {
2350 // Additional paragraph containing a space to
2351 // assure that by WW created RTF from written WW8
2352 // does not crash WW.
2353 rWrt.WriteStringAsPara( " " );
2354 }
2355 }
2356 }
2357 }
2358 }
2359 else if (i < m_aSpareFormats.size() && m_aSpareFormats[i])
2360 {
2361 const SwFrameFormat& rFormat = *m_aSpareFormats[i];
2362 const SwNodeIndex* pNdIdx = rFormat.GetContent().GetContentIdx();
2363 rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
2364 pNdIdx->GetNode().EndOfSectionIndex(), nTTyp );
2365 }
2366
2367 // CR at end of one textbox text ( otherwise WW gpft :-( )
2368 rWrt.WriteStringAsPara( OUString() );
2369 }
2370 break;
2371
2372 case TXT_EDN:
2373 case TXT_FTN:
2374 for ( i = 0; i < nLen; i++ )
2375 {
2376 // beginning for PlcfFootnoteText/PlcfEdnText
2377 m_pTextPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
2378
2379 // Note content
2380 const SwFormatFootnote* pFootnote = static_cast<SwFormatFootnote const *>(m_aContent[ i ]);
2381 rWrt.WriteFootnoteBegin( *pFootnote );
2382 const SwNodeIndex* pIdx = pFootnote->GetTextFootnote()->GetStartNode();
2383 OSL_ENSURE( pIdx, "Where is the start node of Foot-/Endnote?" );
2384 rWrt.WriteSpecialText( pIdx->GetIndex() + 1,
2385 pIdx->GetNode().EndOfSectionIndex(),
2386 nTTyp );
2387 }
2388 break;
2389
2390 default:
2391 OSL_ENSURE( false, "What kind of SubDocType is that?" );
2392 }
2393
2394 m_pTextPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
2395 // CR to the end ( otherwise WW complains )
2396 rWrt.WriteStringAsPara( OUString() );
2397
2398 WW8_CP nCpEnd = rWrt.Fc2Cp( rWrt.Strm().Tell() );
2399 m_pTextPos->Append( nCpEnd );
2400 rCount = nCpEnd - nCpStart;
2401
2402 return ( rCount != 0 );
2403}
2404
2405static bool lcl_AuthorComp( const std::pair<OUString,OUString>& aFirst, const std::pair<OUString,OUString>& aSecond)
2406{
2407 return aFirst.first < aSecond.first;
2408}
2409
2410static bool lcl_PosComp( const std::pair<WW8_CP, int>& aFirst, const std::pair<WW8_CP, int>& aSecond)
2411{
2412 return aFirst.first < aSecond.first;
2413}
2414
2416 WW8_FC& rTextStart, sal_Int32& rTextCount, WW8_FC& rRefStart, sal_Int32& rRefCount ) const
2417{
2418
2419 sal_uInt64 nFcStart = rWrt.m_pTableStrm->Tell();
2420 sal_uInt16 nLen = m_aCps.size();
2421 if ( !nLen )
2422 return;
2423
2424 OSL_ENSURE( m_aCps.size() + 2 == m_pTextPos->Count(), "WritePlc: DeSync" );
2425
2426 std::vector<std::pair<OUString,OUString> > aStrArr;
2427 WW8Fib& rFib = *rWrt.m_pFib; // n+1-th CP-Pos according to the manual
2428 bool bWriteCP = true;
2429
2430 switch ( nTTyp )
2431 {
2432 case TXT_ATN:
2433 {
2434 std::vector< std::pair<WW8_CP, int> > aRangeStartPos; // The second of the pair is the original index before sorting.
2435 std::vector< std::pair<WW8_CP, int> > aRangeEndPos; // Same, so we can map between the indexes before/after sorting.
2436 std::map<int, int> aAtnStartMap; // Maps from annotation index to start index.
2437 std::map<int, int> aStartAtnMap; // Maps from start index to annotation index.
2438 std::map<int, int> aStartEndMap; // Maps from start index to end index.
2439 // then write first the GrpXstAtnOwners
2440 int nIdx = 0;
2441 for ( sal_uInt16 i = 0; i < nLen; ++i )
2442 {
2443 const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(m_aContent[i]);
2444 aStrArr.emplace_back(rAtn.msOwner,rAtn.m_sInitials);
2445 // record start and end positions for ranges
2446 if (rAtn.HasRange())
2447 {
2448 aRangeStartPos.emplace_back(rAtn.m_nRangeStart, nIdx);
2449 aRangeEndPos.emplace_back(rAtn.m_nRangeEnd, nIdx);
2450 ++nIdx;
2451 }
2452 }
2453
2454 //sort and remove duplicates
2455 std::sort(aStrArr.begin(), aStrArr.end(),&lcl_AuthorComp);
2456 auto aIter = std::unique(aStrArr.begin(), aStrArr.end());
2457 aStrArr.erase(aIter, aStrArr.end());
2458
2459 // Also sort the start and end positions. We need to reference
2460 // the start index in the annotation table and also need to
2461 // reference the end index in the start table, so build a map
2462 // that knows what index to reference, after sorting.
2463 std::sort(aRangeStartPos.begin(), aRangeStartPos.end(), &lcl_PosComp);
2464 for (decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i)
2465 {
2466 aAtnStartMap[aRangeStartPos[i].second] = i;
2467 aStartAtnMap[i] = aRangeStartPos[i].second;
2468 }
2469 std::sort(aRangeEndPos.begin(), aRangeEndPos.end(), &lcl_PosComp);
2470 for (decltype(aRangeEndPos)::size_type i = 0; i < aRangeEndPos.size(); ++i)
2471 aStartEndMap[aAtnStartMap[ aRangeEndPos[i].second ]] = i;
2472
2473 for ( decltype(aStrArr)::size_type i = 0; i < aStrArr.size(); ++i )
2474 {
2475 const OUString& sAuthor = aStrArr[i].first;
2476 SwWW8Writer::WriteShort(*rWrt.m_pTableStrm, sAuthor.getLength());
2478 false);
2479 }
2480
2481 rFib.m_fcGrpStAtnOwners = nFcStart;
2482 nFcStart = rWrt.m_pTableStrm->Tell();
2483 rFib.m_lcbGrpStAtnOwners = nFcStart - rFib.m_fcGrpStAtnOwners;
2484
2485 // Commented text ranges
2486 if( !aRangeStartPos.empty() )
2487 {
2488 // Commented text ranges starting positions (Plcfbkf.aCP)
2489 rFib.m_fcPlcfAtnbkf = nFcStart;
2490 for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2491 {
2492 SwWW8Writer::WriteLong( *rWrt.m_pTableStrm, aRangeStartPos[i].first );
2493 }
2495
2496 // Commented text ranges additional information (Plcfbkf.aFBKF)
2497 for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2498 {
2499 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, aStartEndMap[i] ); // FBKF.ibkl
2500 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, 0 ); // FBKF.bkc
2501 }
2502
2503 nFcStart = rWrt.m_pTableStrm->Tell();
2504 rFib.m_lcbPlcfAtnbkf = nFcStart - rFib.m_fcPlcfAtnbkf;
2505
2506 // Commented text ranges ending positions (PlcfBkl.aCP)
2507 rFib.m_fcPlcfAtnbkl = nFcStart;
2508 for ( decltype(aRangeEndPos)::size_type i = 0; i < aRangeEndPos.size(); ++i )
2509 {
2510 SwWW8Writer::WriteLong( *rWrt.m_pTableStrm, aRangeEndPos[i].first );
2511 }
2513
2514 nFcStart = rWrt.m_pTableStrm->Tell();
2515 rFib.m_lcbPlcfAtnbkl = nFcStart - rFib.m_fcPlcfAtnbkl;
2516
2517 // Commented text ranges as bookmarks (SttbfAtnBkmk)
2518 rFib.m_fcSttbfAtnbkmk = nFcStart;
2519 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, sal_Int16(sal_uInt16(0xFFFF)) ); // SttbfAtnBkmk.fExtend
2520 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, aRangeStartPos.size() ); // SttbfAtnBkmk.cData
2521 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, 0xA ); // SttbfAtnBkmk.cbExtra
2522
2523 for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2524 {
2525 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, 0 ); // SttbfAtnBkmk.cchData
2526 // One ATNBE structure for all text ranges
2527 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, 0x0100 ); // ATNBE.bmc
2528 SwWW8Writer::WriteLong( *rWrt.m_pTableStrm, aStartAtnMap[i] ); // ATNBE.lTag
2529 SwWW8Writer::WriteLong( *rWrt.m_pTableStrm, -1 ); // ATNBE.lTagOld
2530 }
2531
2532 nFcStart = rWrt.m_pTableStrm->Tell();
2533 rFib.m_lcbSttbfAtnbkmk = nFcStart - rFib.m_fcSttbfAtnbkmk;
2534 }
2535
2536 // Write the extended >= Word XP ATRD records
2537 for( sal_uInt16 i = 0; i < nLen; ++i )
2538 {
2539 const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(m_aContent[i]);
2540
2541 sal_uInt32 nDTTM = sw::ms::DateTime2DTTM(rAtn.maDateTime);
2542
2543 SwWW8Writer::WriteLong( *rWrt.m_pTableStrm, nDTTM );
2548 }
2549
2550 rFib.m_fcAtrdExtra = nFcStart;
2551 nFcStart = rWrt.m_pTableStrm->Tell();
2552 rFib.m_lcbAtrdExtra = nFcStart - rFib.m_fcAtrdExtra;
2553 rFib.m_fcHplxsdr = 0x01010002; //WTF, but apparently necessary
2554 rFib.m_lcbHplxsdr = 0;
2555 }
2556 break;
2557 case TXT_TXTBOX:
2558 case TXT_HFTXTBOX:
2559 {
2560 m_pTextPos->Write( *rWrt.m_pTableStrm );
2561 const std::vector<sal_uInt32>* pShapeIds = GetShapeIdArr();
2562 OSL_ENSURE( pShapeIds, "Where are the ShapeIds?" );
2563
2564 for ( sal_uInt16 i = 0; i < nLen; ++i )
2565 {
2566 // write textbox story - FTXBXS
2567 // is it a writer or sdr - textbox?
2568 const SdrObject* pObj = static_cast<SdrObject const *>(m_aContent[ i ]);
2569 sal_Int32 nCnt = 1;
2570 if (DynCastSdrTextObj( pObj ))
2571 {
2572 // find the "highest" SdrObject of this
2573 const SwFrameFormat& rFormat = *::FindFrameFormat( pObj );
2574
2575 const SwFormatChain* pChn = &rFormat.GetChain();
2576 while ( pChn->GetNext() )
2577 {
2578 // has a chain?
2579 // then calc the cur pos in the chain
2580 ++nCnt;
2581 pChn = &pChn->GetNext()->GetChain();
2582 }
2583 }
2584 if( nullptr == pObj )
2585 {
2586 if (i < m_aSpareFormats.size() && m_aSpareFormats[i])
2587 {
2588 const SwFrameFormat& rFormat = *m_aSpareFormats[i];
2589
2590 const SwFormatChain* pChn = &rFormat.GetChain();
2591 while( pChn->GetNext() )
2592 {
2593 // has a chain?
2594 // then calc the cur pos in the chain
2595 ++nCnt;
2596 pChn = &pChn->GetNext()->GetChain();
2597 }
2598 }
2599 }
2600 // long cTxbx / iNextReuse
2601 SwWW8Writer::WriteLong( *rWrt.m_pTableStrm, nCnt );
2602 // long cReusable
2604 // short fReusable
2606 // long reserved
2608 // long lid
2610 (*pShapeIds)[i]);
2611 // long txidUndo
2613 }
2615 bWriteCP = false;
2616 }
2617 break;
2618 }
2619
2620 if ( bWriteCP )
2621 {
2622 // write CP Positions
2623 for ( sal_uInt16 i = 0; i < nLen; i++ )
2625
2626 // n+1-th CP-Pos according to the manual
2628 rFib.m_ccpText + rFib.m_ccpFootnote + rFib.m_ccpHdr + rFib.m_ccpEdn +
2629 rFib.m_ccpTxbx + rFib.m_ccpHdrTxbx + 1 );
2630
2631 if ( TXT_ATN == nTTyp )
2632 {
2633 sal_uInt16 nlTag = 0;
2634 for ( sal_uInt16 i = 0; i < nLen; ++i )
2635 {
2636 const WW8_Annotation& rAtn = *static_cast<const WW8_Annotation*>(m_aContent[i]);
2637
2638 //aStrArr is sorted
2639 auto aIter = std::lower_bound(aStrArr.begin(),
2640 aStrArr.end(), std::pair<OUString,OUString>(rAtn.msOwner,OUString()),
2642 OSL_ENSURE(aIter != aStrArr.end() && aIter->first == rAtn.msOwner,
2643 "Impossible");
2644 sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin());
2645 OUString sInitials( aIter->second );
2646 sal_uInt8 nInitialsLen = static_cast<sal_uInt8>(sInitials.getLength());
2647 if ( nInitialsLen > 9 )
2648 {
2649 sInitials = sInitials.copy( 0, 9 );
2650 nInitialsLen = 9;
2651 }
2652
2653 // xstUsrInitl[ 10 ] pascal-style String holding initials
2654 // of annotation author
2655 SwWW8Writer::WriteShort(*rWrt.m_pTableStrm, nInitialsLen);
2657 false);
2659 (9 - nInitialsLen) * 2 );
2660
2661 // documents layout of WriteShort's below:
2662
2663 // SVBT16 ibst; // index into GrpXstAtnOwners
2664 // SVBT16 ak; // not used
2665 // SVBT16 grfbmc; // not used
2666 // SVBT32 ITagBkmk; // when not -1, this tag identifies the ATNBE
2667
2668 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, nFndPos );
2671 if (rAtn.HasRange())
2672 {
2673 SwWW8Writer::WriteLong( *rWrt.m_pTableStrm, nlTag );
2674 ++nlTag;
2675 }
2676 else
2678 }
2679 }
2680 else
2681 {
2682 sal_uInt16 nNo = 0;
2683 for ( sal_uInt16 i = 0; i < nLen; ++i ) // write Flags
2684 {
2685 const SwFormatFootnote* pFootnote = static_cast<SwFormatFootnote const *>(m_aContent[ i ]);
2687 !pFootnote->GetNumStr().isEmpty() ? 0 : ++nNo );
2688 }
2689 }
2690 }
2691 rRefStart = nFcStart;
2692 nFcStart = rWrt.m_pTableStrm->Tell();
2693 rRefCount = nFcStart - rRefStart;
2694
2695 m_pTextPos->Write( *rWrt.m_pTableStrm );
2696
2697 switch ( nTTyp )
2698 {
2699 case TXT_TXTBOX:
2700 case TXT_HFTXTBOX:
2701 for ( sal_uInt16 i = 0; i < nLen; ++i )
2702 {
2703 // write break descriptor (BKD)
2704 // short itxbxs
2706 // short dcpDepend
2708 // short flags : icol/fTableBreak/fColumnBreak/fMarked/
2709 // fUnk/fTextOverflow
2710 SwWW8Writer::WriteShort( *rWrt.m_pTableStrm, 0x800 );
2711 }
2713 break;
2714 }
2715
2716 rTextStart = nFcStart;
2717 rTextCount = rWrt.m_pTableStrm->Tell() - nFcStart;
2718}
2719
2720const std::vector<sal_uInt32>* WW8_WrPlcSubDoc::GetShapeIdArr() const
2721{
2722 return nullptr;
2723}
2724
2725/* 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:5779
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:5518
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:1669
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:2119
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:1802
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:1640
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:887
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:3267
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:1137
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:1360
virtual ~MSWordSections()
Definition: wrtw8sty.cxx:1093
void AppendSection(const SwPageDesc *pPd, const SwSectionFormat *pSectionFormat, sal_uLong nLnNumRestartNo, bool bIsFirstParagraph=false)
Definition: wrtw8sty.cxx:1145
static void SetFooterFlag(sal_uInt8 &rHeadFootFlags, const SwFormat &rFormat, sal_uInt8 nFlag)
Definition: wrtw8sty.cxx:1255
void NeedsDocumentProtected(const WW8_SepInfo &rInfo)
Definition: wrtw8sty.cxx:1286
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:1247
virtual bool HeaderFooterWritten()
Definition: wrtw8sty.cxx:1101
void CheckForFacinPg(const WW8Export &rWrt) const
Definition: wrtw8sty.cxx:1309
static const SwFormatCol & GetFormatCol(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 FontPitchType(FontPitch ePitch) const
Font pitch.
void FontAlternateName(std::u16string_view rName) const
Alternate name for the font.
void FontFamilyType(FontFamily eFamily, const wwFont &rFont) const
Font family.
void StartFont(std::u16string_view rFamilyName) const
Start the font.
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:727
Definition: doc.hxx:197
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:645
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1081
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:755
const SwLineNumberInfo & GetLineNumberInfo() const
Definition: lineinfo.cxx:49
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:649
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:793
const SwEndNoteInfo & GetEndNoteInfo() const
Definition: doc.hxx:647
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:791
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
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
void SetAdjustValue(sal_Int16 n)
Definition: fmtclds.hxx:96
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
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
SfxPoolItem subclass for footnotes and endnotes, stored in the anchor text node.
Definition: fmtftn.hxx:47
const OUString & GetNumStr() const
Definition: fmtftn.hxx:72
const SwTextFootnote * GetTextFootnote() const
Definition: fmtftn.hxx:87
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:72
< 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:3011
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:901
SwSectionNode * GetSectionNode()
Definition: node.hxx:658
bool IsContentNode() const
Definition: node.hxx:188
bool IsSectionNode() const
Definition: node.hxx:192
bool IsTableNode() const
Definition: node.hxx:191
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:968
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwTableNode * GetTableNode()
Definition: node.hxx:650
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
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:188
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:1818
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:341
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:88
static void InsAsString16(ww::bytes &rO, const OUString &rStr)
Definition: wrtww8.cxx:1729
static void FillCount(SvStream &rStrm, sal_uLong nCount)
Definition: wrtww8.cxx:935
static void InsUInt16(ww::bytes &rO, sal_uInt16 n)
Definition: wrtww8.cxx:1711
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:1746
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:1406
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:1476
virtual void SectionPageBorders(const SwFrameFormat *pFormat, const SwFrameFormat *pFirstPageFormat) override
Description of the page borders.
Definition: wrtw8sty.cxx:1438
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:1470
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:1524
sal_uInt16 m_nPOPosStdLen1
For output of styles.
virtual void StartSection() override
Start of the section properties.
Definition: wrtw8sty.cxx:1370
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:1431
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:1495
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:1395
virtual void SectFootnoteEndnotePr() override
for footnote/endnote section properties
Definition: wrtw8sty.cxx:1375
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:1313
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:2781
void WriteStringAsPara(const OUString &rText)
Definition: wrtww8.cxx:1782
void WriteOutliner(const OutlinerParaObject &rOutliner, sal_uInt8 nTyp)
Definition: wrtw8esh.cxx:1337
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:1548
static sal_uInt8 GetNumId(sal_uInt16 eNumType)
Converts the SVX numbering type to MSONFC.
Definition: ww8atr.cxx:793
WW8_CP Fc2Cp(sal_uLong nFc) const
Definition: wrtww8.hxx:1108
void WriteFootnoteBegin(const SwFormatFootnote &rFootnote, ww::bytes *pO=nullptr)
Definition: ww8atr.cxx:3578
virtual void SetupSectionPositions(WW8_PdAttrDesc *pA) override
Setup the pA's info.
Definition: wrtw8sty.cxx:1504
std::unique_ptr< ww::bytes > m_pO
Buffer.
Definition: wrtww8.hxx:999
FIB - the File Information Block.
Definition: ww8scan.hxx:1106
WW8_CP m_ccpHdr
Definition: ww8scan.hxx:1212
sal_Int32 m_lcbSttbfffn
Definition: ww8scan.hxx:1303
WW8_FC m_fcPlcfAtnbkf
Definition: ww8scan.hxx:1397
sal_Int32 m_lcbPlcfAtnbkf
Definition: ww8scan.hxx:1398
WW8_FC m_fcSttbfffn
Definition: ww8scan.hxx:1302
WW8_FC m_fcPlcfAtnbkl
Definition: ww8scan.hxx:1400
sal_uInt32 m_lcbAtrdExtra
Definition: ww8scan.hxx:1486
WW8_CP m_ccpFootnote
Definition: ww8scan.hxx:1211
WW8_CP m_ccpEdn
Definition: ww8scan.hxx:1215
sal_Int32 m_lcbGrpStAtnOwners
Definition: ww8scan.hxx:1368
sal_Int32 m_lcbSttbfAtnbkmk
Definition: ww8scan.hxx:1371
WW8_CP m_ccpHdrTxbx
Definition: ww8scan.hxx:1217
sal_Int32 m_lcbStshfOrig
Definition: ww8scan.hxx:1250
WW8_FC m_fcStshf
Definition: ww8scan.hxx:1251
sal_Int32 m_lcbPlcfAtnbkl
Definition: ww8scan.hxx:1401
WW8_FC m_fcAtrdExtra
Definition: ww8scan.hxx:1485
WW8_CP m_ccpTxbx
Definition: ww8scan.hxx:1216
WW8_FC m_fcStshfOrig
Definition: ww8scan.hxx:1247
sal_uInt32 m_lcbHplxsdr
Definition: ww8scan.hxx:1520
WW8_FC m_fcSttbfAtnbkmk
Definition: ww8scan.hxx:1370
WW8_FC m_fcGrpStAtnOwners
Definition: ww8scan.hxx:1367
WW8_FC m_fcHplxsdr
Definition: ww8scan.hxx:1519
sal_Int32 m_lcbStshf
Definition: ww8scan.hxx:1252
WW8_CP m_ccpText
Definition: ww8scan.hxx:1210
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:2227
virtual ~WW8_WrPlcAnnotations() override
Definition: wrtw8sty.cxx:2264
o3tl::sorted_vector< const SwRedlineData * > maProcessedRedlines
Definition: wrtww8.hxx:1278
void Append(WW8_CP nCp, const SwPostItField *pPostIt)
Definition: wrtw8sty.cxx:2233
bool IsNewRedlineComment(const SwRedlineData *pRedLine)
Definition: wrtw8sty.cxx:2259
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:2186
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:1263
void WritePlcSed(WW8Export &rWrt) const
Definition: wrtw8sty.cxx:2082
virtual bool HeaderFooterWritten() override
Definition: wrtw8sty.cxx:1106
void WriteSepx(SvStream &rStrm) const
Definition: wrtw8sty.cxx:2066
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:1155
void WritePlcHdd(WW8Export &rWrt) const
Definition: wrtw8sty.cxx:2107
bool WriteKFText(WW8Export &rWrt)
Definition: wrtw8sty.cxx:2015
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:1188
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:2182
void WriteGenericPlc(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_FC &rTextStt, sal_Int32 &rTextCnt, WW8_FC &rRefStt, sal_Int32 &rRefCnt) const
Definition: wrtw8sty.cxx:2415
std::vector< WW8_CP > m_aCps
Definition: wrtww8.hxx:1226
virtual const std::vector< sal_uInt32 > * GetShapeIdArr() const
Definition: wrtw8sty.cxx:2720
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:2270
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
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:1601
const HdFtFlags WW8_FOOTER_ODD
Definition: ww8scan.hxx:1600
const HdFtFlags WW8_FOOTER_EVEN
Definition: ww8scan.hxx:1599
const HdFtFlags WW8_HEADER_EVEN
Definition: ww8scan.hxx:1597
const HdFtFlags WW8_FOOTER_FIRST
Definition: ww8scan.hxx:1602
const HdFtFlags WW8_HEADER_ODD
Definition: ww8scan.hxx:1598
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_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:372
@ RES_POOLCOLL_MARGINAL
Marginalia.
Definition: poolfmt.hxx:258
@ RES_POOLCOLL_TOX_CNTNTH
Subgroup table of contents.
Definition: poolfmt.hxx:376
@ 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:369
@ RES_POOLCOLL_HEADLINE8
Heading 8.
Definition: poolfmt.hxx:269
@ RES_POOLCOLL_DOC_APPENDIX
Doc. appendix.
Definition: poolfmt.hxx:427
@ 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:391
@ RES_POOLCOLL_NUM_LEVEL4
4th level.
Definition: poolfmt.hxx:294
@ RES_POOLCOLL_DOC_TITLE
Doc. title.
Definition: poolfmt.hxx:425
@ RES_POOLCOLL_BULLET_NONUM5
No numbering.
Definition: poolfmt.hxx:322
@ RES_POOLCOLL_TOX_CNTNT5
Content 5th level.
Definition: poolfmt.hxx:381
@ 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:370
@ RES_POOLCOLL_NUM_LEVEL3
3rd level.
Definition: poolfmt.hxx:290
@ RES_POOLCOLL_TOX_CNTNT1
Content 1st level.
Definition: poolfmt.hxx:377
@ 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_TOX_ILLUS1
Illustrations all levels.
Definition: poolfmt.hxx:399
@ RES_POOLCOLL_HEADLINE2
Heading 2.
Definition: poolfmt.hxx:263
@ RES_POOLCOLL_DOC_SUBTITLE
Doc. subtitle.
Definition: poolfmt.hxx:426
@ RES_POOLCOLL_TOX_CNTNT9
Content 9th level.
Definition: poolfmt.hxx:394
@ 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:410
@ 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:1607
sal_uInt16 rncFootnote
Definition: ww8scan.hxx:1629
sal_uInt16 rncEdn
Definition: ww8scan.hxx:1686
sal_uInt16 epc
Definition: ww8scan.hxx:1688
sal_Int16 nfcEdnRef
Definition: ww8scan.hxx:1780
sal_uInt16 nFootnote
Definition: ww8scan.hxx:1630
sal_Int16 nfcFootnoteRef
Definition: ww8scan.hxx:1779
sal_uInt16 fpc
Definition: ww8scan.hxx:1624
sal_uInt16 nEdn
Definition: ww8scan.hxx:1687
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:2217
WW8_Annotation(const SwPostItField *pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd)
Definition: wrtw8sty.cxx:2192
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:1292
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:254
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:2405
static bool lcl_PosComp(const std::pair< WW8_CP, int > &aFirst, const std::pair< WW8_CP, int > &aSecond)
Definition: wrtw8sty.cxx:2410
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[]