24#include <com/sun/star/i18n/ScriptType.hpp>
33#include <rtl/character.hxx>
55#include <lineinfo.hxx>
73#include <unordered_set>
165#define WW8_RESERVED_SLOTS 15
171 sal_uInt16 nRet =
m_pStyles->GetSlot( pFormat );
172 return ( nRet != 0x0fff ) ? nRet : 10;
179 sal_uInt16 nRet =
m_pStyles->GetSlot( &rColl );
180 return ( nRet != 0xfff ) ? nRet : 0;
185 : m_rExport( rExport ),
186 m_bListStyles(bListStyles)
212 for (
size_t slot = 0; slot <
m_aStyles.size(); ++slot)
326 for (
size_t n = 1;
n < rArr2.
size(); ++
n)
367 (void)ret.endsWith(
" (WW)", &ret);
373 std::unordered_set<OUString> aUsed;
375 auto makeUniqueName = [&aUsed](OUString&
name) {
377 OUString lower(
name.toAsciiLowerCase());
378 if (!aUsed.insert(lower).second)
381 while (!aUsed.insert(lower + OUString::number(nFree)).second)
384 name += OUString::number(nFree);
394 aUsed.insert(
"normal");
399 if (!entry.ww_name.isEmpty())
403 assert(entry.format);
406 makeUniqueName(entry.ww_name);
412 if (!entry.ww_name.isEmpty())
416 else if (entry.num_rule)
420 makeUniqueName(entry.ww_name);
431 std::unordered_set<OString> aUsed;
437 if (aStyleId.isEmpty())
440 OString aLower(aStyleId.toAsciiLowerCase());
443 if (!aUsed.insert(aLower).second)
446 while (!aUsed.insert(aLower + OString::number(nFree)).second)
449 aStyleId += OString::number(nFree);
451 entry.style_id = aStyleId;
457 assert(!
m_aStyles[nSlot].style_id.isEmpty());
465 assert(!
m_aStyles[slot].ww_name.isEmpty());
472static void impl_SkipOdd(std::unique_ptr<ww::bytes>
const& pO, std::size_t nTableStrmTell)
474 if ( ( nTableStrmTell + pO->size() ) & 1 )
484 ShortToSVBT16( nLen,
p );
486 ShortToSVBT16( nLen,
p );
493 sal_uInt16 nWwNext, sal_uInt16 , sal_uInt16 nWwId, sal_uInt16 ,
bool bAutoUpdate )
498 sal_uInt16 nBit16 = 0x1000;
502 nBit16 = nWwBase << 4;
506 nBit16 = nWwNext << 4;
510 pData +=
sizeof( sal_uInt16 );
512 nBit16 = bAutoUpdate ? 1 : 0;
519 sal_uInt16 nLen =
static_cast< sal_uInt16
>( (
pData - aWW8_STD ) + 1 +
520 (2 * (rName.getLength() + 1)) );
540 sal_uInt16 nStt, nEnd,
n;
554 for(
n = nStt;
n < nEnd; ++
n )
575 for (
n = nStt;
n < nEnd; ++
n, ++pFlags )
584 i18n::ScriptType::LATIN,
n) )
599 sal_uInt16 nLen = bParProp ? 2 : 0;
613 bool bInsDefCharSiz )
626 if ( bInsDefCharSiz )
636 ShortToSVBT16( nLen, pUpxLen );
655 pNext = &pFormatColl->GetNextTextFormatColl();
656 pLink = pFormatColl->GetLinkedCharFormat();
661 auto pCharFormat =
static_cast<const SwCharFormat*
>(pFormat);
662 pLink = pCharFormat->GetLinkedParaFormat();
690 else if (!entry.format)
697 sal_uInt16 nBase, nWwNext;
698 sal_uInt16 nWwLink = 0x0FFF;
700 GetStyleData(entry.format, bFormatColl, nBase, nWwNext, nWwLink);
703 entry.style_id.startsWith(
"ListLabel"))
710 nBase, nWwNext, nWwLink,
m_aStyles[nSlot].ww_id, nSlot,
711 entry.format->IsAutoUpdateOnDirectFormat() );
716 WriteProperties( entry.format,
false, nSlot, bFormatColl && nBase==0xfff );
737 0x0F, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x5B, 0x00,
738 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
764 for (
size_t slot = 0; slot <
m_aStyles.size(); ++slot)
775 rtl_TextEncoding eChrSet)
776 : mbAlt(false), mePitch(ePitch), meFamily(eFamily), meChrSet(eChrSet)
900 std::map<wwFont, sal_uInt16>::const_iterator aIter =
maFonts.find(rFont);
902 nRet = aIter->second;
905 nRet =
static_cast< sal_uInt16
>(
maFonts.size());
917 RTL_TEXTENCODING_SYMBOL));
920 RTL_TEXTENCODING_MS_1252));
929 if (
nullptr != pFont)
939 for (
const sal_uInt16* pId =
aTypes; *pId; ++pId)
959 std::vector<const wwFont *> aFontList(
maFonts.size() );
961 for (
const auto& aFont :
maFonts )
962 aFontList[aFont.second] = &aFont.first;
979 std::vector<const wwFont *> aFontList(
AsVector() );
984 for (
auto aFont : aFontList )
985 aFont->Write(pTableStream);
996 std::vector<const wwFont *> aFontList(
AsVector() );
998 for (
auto aFont : aFontList )
999 aFont->WriteDocx(&rAttrOutput);
1004 std::vector<const wwFont *> aFontList(
AsVector() );
1006 for (
auto aFont : aFontList )
1007 aFont->WriteRtf(&rAttrOutput);
1022 for(
const auto& rPos :
m_aPos )
1032 : mbDocumentIsProtected( false )
1060 rExport.
m_pCurPam->GetPoint()->Assign(*pNd);
1076 pDescItem->GetPageDesc() )
1086 , m_bHeaderFooterWritten( false )
1113 OSL_ENSURE( !
m_aSects.empty(),
"no segment inserted yet" );
1151 m_aSects.emplace_back( pPd, pSectionFormat, nLnNumRestartNo, std::nullopt,
nullptr, bIsFirstParagraph );
1161 m_aCps.push_back( nStartCp );
1184 m_aCps.push_back( nStartCp );
1192 if( !rInfo.
m_aErgoSum.isEmpty() ) nInfoFlags |= 0x02;
1193 if( !rInfo.
m_aQuoVadis.isEmpty() ) nInfoFlags |= 0x04;
1200 if( 0x02 & nInfoFlags )
1210 if( 0x04 & nInfoFlags )
1223 while( 6 > nEmptyStt++ )
1252 rHeadFootFlags |= nFlag;
1260 rHeadFootFlags |= nFlag;
1267 if ( nFlag & nHFFlags )
1314 sal_uInt16 nEnd = 0;
1317 if( !rSepInfo.pSectionFormat )
1328 else if( !( 1 & nEnd ) &&
1336 rWrt.
m_pDop->fFacingPages = rWrt.
m_pDop->fMirrorMargins =
true;
1340 if( !( 1 & nEnd ) &&
1343 rWrt.
m_pDop->fFacingPages =
true;
1346 if( !( 2 & nEnd ) &&
1349 rWrt.
m_pDop->fSwapBordersFacingPgs =
1350 rWrt.
m_pDop->fMirrorMargins =
true;
1442 if ( pPdFormat != pPdFirstPgFormat )
1446 if ( USHRT_MAX == nPgBorder )
1454 else if ( !nPgBorder )
1460 nPgBorder |= (1<<5);
1462 if ( USHRT_MAX != nPgBorder )
1483 if ( oPageRestartNumber )
1497 if ( 2 != nBreakCode )
1509 if ( !
m_pO->empty() )
1526 if ( drawing::TextVerticalAdjust_TOP == nVA )
1532 case drawing::TextVerticalAdjust_CENTER:
1535 case drawing::TextVerticalAdjust_BOTTOM:
1538 case drawing::TextVerticalAdjust_BLOCK:
1555 m_pSepx->OutHeaderFooter( *
this,
true, rFormat, nCpPos, nHeadFootFlags,
WW8_HEADER_ODD, nBreakCode );
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 );
1563 m_pSepx->OutHeaderFooter( *
this,
false, rFormat, nCpPos, nHeadFootFlags,
WW8_FOOTER_ODD, nBreakCode );
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 );
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 );
1585 if (nBreakCode != 0)
1613 SwPaM aPaM(*pSectionStart);
1615 if (!aPaM.GetPointNode().IsTextNode())
1623 if (nCharHeight > 20)
1629 if (!aPaM.GetPointNode().IsTextNode())
1672 bool bOutPgDscSet =
true, bLeftRightPgChain =
false, bOutputStyleItemSet =
false;
1674 bool bUsePrevSectionNextStyle =
false;
1695 if ( nBreakCode == 0 )
1696 bOutPgDscSet =
false;
1703 && UsePrevSectionNextStyle(nBreakCode, pPd, rSepInfo);
1704 if (bUsePrevSectionNextStyle)
1734 aSet.
Put( aResultLR );
1743 bOutputStyleItemSet =
true;
1783 else if (rSepInfo.
pPDNd)
1789 pPdFormat = &rFollowFormat;
1804 if ( titlePage && SfxItemState::SET ==
1821 bLeftRightPgChain =
true;
1836 if (!bOutputStyleItemSet)
1857 if ( 2 == nBreakCode )
1879 bool bEvenAndOddHeaders =
true;
1880 bool bEvenAndOddFooters =
true;
1884 if (bLeftRightPgChain)
1890 pPdLeftHeaderFormat = pHeaderFormat;
1891 bEvenAndOddHeaders =
false;
1899 pPdLeftFooterFormat = pFooterFormat;
1900 bEvenAndOddFooters =
false;
1913 pPdLeftHeaderFormat = pHeaderFormat;
1914 bEvenAndOddHeaders =
false;
1918 pPdLeftHeaderFormat = &pPd->
GetLeft();
1922 pPdLeftFooterFormat = pFooterFormat;
1923 bEvenAndOddFooters =
false;
1927 pPdLeftFooterFormat = &pPd->
GetLeft();
1962 bEvenAndOddHeaders =
false;
1972 bEvenAndOddFooters =
false;
1996 if (bUsePrevSectionNextStyle && nHeadFootFlags == 0)
2004 WriteHeadersFooters( nHeadFootFlags, *pPdFormat, *pPdLeftHeaderFormat, *pPdLeftFooterFormat, *pPdFirstPgFormat, nBreakCode, bEvenAndOddHeaders && bEvenAndOddFooters );
2019 OSL_ENSURE( !
m_pTextPos,
"who set the pointer?" );
2030 auto pAttrDesc = std::make_shared<WW8_PdAttrDesc>();
2048 if ( nCpEnd > nCpStart )
2056 rWrt.
m_pFib->m_ccpHdr = nCpEnd - nCpStart;
2063 return rWrt.
m_pFib->m_ccpHdr != 0;
2069 ,
"WriteSepx(): arrays out of sync!");
2085 ,
"WritePlcSed(): arrays out of sync!");
2086 OSL_ENSURE(
m_aCps.size() ==
m_aSects.size() + 1,
"WrPlcSepx: DeSync" );
2095 static WW8_SED aSed = {{4, 0},{0, 0, 0, 0},{0, 0},{0xff, 0xff, 0xff, 0xff}};
2100 UInt32ToSVBT32( rSectionAttribute->m_nSepxFcPos, aSed.fcSepx );
2103 rWrt.
m_pFib->m_fcPlcfsed = nFcStart;
2115 rWrt.
m_pFib->m_fcPlcfhdd;
2155 if ( nStart < nEnd )
2169 OSL_ENSURE( pSttIdx,
"Header/Footer text is not really present" );
2195 m_nRangeStart(nRangeStart),
2196 m_nRangeEnd(nRangeEnd)
2208 mpRichText(nullptr),
2209 msSimpleText(pRedline->GetComment()),
2210 msOwner(
SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())),
2241 p->m_bIgnoreEmpty = bIgnoreEmpty;
2284 for (
i = 0;
i < nLen;
i++ )
2303 for (
i = 0;
i < nLen;
i++ )
2326 OSL_ENSURE( pFormat,
"where is the format?" );
2329 OSL_ENSURE( pNdIdx,
"where is the StartNode of the Textbox?" );
2338 bool bContainsOnlyTables =
true;
2345 bContainsOnlyTables =
false;
2348 if ( bContainsOnlyTables )
2374 for (
i = 0;
i < nLen;
i++ )
2383 OSL_ENSURE( pIdx,
"Where is the start node of Foot-/Endnote?" );
2391 OSL_ENSURE(
false,
"What kind of SubDocType is that?" );
2400 rCount = nCpEnd - nCpStart;
2402 return ( rCount != 0 );
2405static bool lcl_AuthorComp(
const std::pair<OUString,OUString>& aFirst,
const std::pair<OUString,OUString>& aSecond)
2407 return aFirst.first < aSecond.first;
2410static bool lcl_PosComp(
const std::pair<WW8_CP, int>& aFirst,
const std::pair<WW8_CP, int>& aSecond)
2412 return aFirst.first < aSecond.first;
2416 WW8_FC& rTextStart, sal_Int32& rTextCount,
WW8_FC& rRefStart, sal_Int32& rRefCount )
const
2420 sal_uInt16 nLen =
m_aCps.size();
2424 OSL_ENSURE(
m_aCps.size() + 2 ==
m_pTextPos->Count(),
"WritePlc: DeSync" );
2426 std::vector<std::pair<OUString,OUString> > aStrArr;
2428 bool bWriteCP =
true;
2434 std::vector< std::pair<WW8_CP, int> > aRangeStartPos;
2435 std::vector< std::pair<WW8_CP, int> > aRangeEndPos;
2436 std::map<int, int> aAtnStartMap;
2437 std::map<int, int> aStartAtnMap;
2438 std::map<int, int> aStartEndMap;
2441 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
2449 aRangeEndPos.emplace_back(rAtn.
m_nRangeEnd, nIdx);
2456 auto aIter = std::unique(aStrArr.begin(), aStrArr.end());
2457 aStrArr.erase(aIter, aStrArr.end());
2463 std::sort(aRangeStartPos.begin(), aRangeStartPos.end(), &
lcl_PosComp);
2464 for (
decltype(aRangeStartPos)::size_type
i = 0;
i < aRangeStartPos.size(); ++
i)
2466 aAtnStartMap[aRangeStartPos[
i].second] =
i;
2467 aStartAtnMap[
i] = aRangeStartPos[
i].second;
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;
2473 for (
decltype(aStrArr)::size_type
i = 0;
i < aStrArr.size(); ++
i )
2475 const OUString& sAuthor = aStrArr[
i].first;
2486 if( !aRangeStartPos.empty() )
2490 for (
decltype(aRangeStartPos)::size_type
i = 0;
i < aRangeStartPos.size(); ++
i )
2497 for (
decltype(aRangeStartPos)::size_type
i = 0;
i < aRangeStartPos.size(); ++
i )
2508 for (
decltype(aRangeEndPos)::size_type
i = 0;
i < aRangeEndPos.size(); ++
i )
2523 for (
decltype(aRangeStartPos)::size_type
i = 0;
i < aRangeStartPos.size(); ++
i )
2537 for( sal_uInt16
i = 0;
i < nLen; ++
i )
2562 OSL_ENSURE( pShapeIds,
"Where are the ShapeIds?" );
2564 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
2584 if(
nullptr == pObj )
2623 for ( sal_uInt16
i = 0;
i < nLen;
i++ )
2633 sal_uInt16 nlTag = 0;
2634 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
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,
2644 sal_uInt16 nFndPos =
static_cast< sal_uInt16
>(aIter - aStrArr.begin());
2645 OUString sInitials( aIter->second );
2647 if ( nInitialsLen > 9 )
2649 sInitials = sInitials.copy( 0, 9 );
2659 (9 - nInitialsLen) * 2 );
2683 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
2687 !pFootnote->
GetNumStr().isEmpty() ? 0 : ++nNo );
2691 rRefStart = nFcStart;
2693 rRefCount = nFcStart - rRefStart;
2701 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
2716 rTextStart = nFcStart;
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.
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.
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.
SvxFrameDirection TrueFrameDirection(const SwFrameFormat &rFlyFormat) const
Right to left?
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.
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.
bool m_bFootnoteAtTextEnd
const sw::BroadcastingModify * m_pOutFormatNode
void WriteSpecialText(SwNodeOffset nStart, SwNodeOffset nEnd, sal_uInt8 nTTyp)
Set the pCurPam appropriately and call WriteText().
const SwPageDesc * m_pPreviousSectionPageDesc
std::unique_ptr< MSWordStyles > m_pStyles
const SwTextNode * GetHdFtPageRoot() const
Top node of host page when in header/footer.
const SwPageDesc * m_pCurrentPageDesc
std::unique_ptr< WW8_WrPlcField > m_pFieldHdFt
void SectionProperties(const WW8_SepInfo &rSectionInfo, WW8_PdAttrDesc *pA=nullptr)
Write section properties.
const SfxItemSet * m_pISet
const SwFormat * m_pCurrentStyle
void OutputFormat(const SwFormat &rFormat, bool bPapFormat, bool bChpFormat, bool bFlyFormat=false)
Output attributes.
const SwFrameFormat * m_pFirstPageFormat
bool m_bOutPageDescs
PageDescs (section properties) are being written.
void SetHdFtPageRoot(const SwTextNode *pNd)
Top node of host page when in header/footer.
virtual AttributeOutputBase & AttrOutput() const =0
Access to the attribute output class.
std::shared_ptr< SwUnoCursor > & m_pCurPam
virtual bool ignoreAttributeForStyleDefaults(sal_uInt16) const
Used to filter out attributes that can be e.g. written to .doc but not to .docx.
virtual void SetupSectionPositions(WW8_PdAttrDesc *)
Setup the pA's info.
void SetCurItemSet(const SfxItemSet *pS)
Setter for pISet.
bool m_bFirstTOCNodeWithSection
virtual ExportFormat GetExportFormat() const =0
sal_uInt16 GetId(const SwTextFormatColl &rColl) const
Return the numeric id of the style.
static bool NoPageBreakSection(const SfxItemSet *pSet)
Class to collect and output the sections/headers/footers.
bool mbDocumentIsProtected
const WW8_SepInfo * CurrentSectionInfo()
The most recent WW8_SepInfo.
sal_uInt16 CurrentNumberOfColumns(const SwDoc &rDoc) const
Number of columns based on the most recent WW8_SepInfo.
MSWordSections(const MSWordSections &)
static bool HasBorderItem(const SwFormat &rFormat)
Should we output borders?
virtual ~MSWordSections()
void AppendSection(const SwPageDesc *pPd, const SwSectionFormat *pSectionFormat, sal_uLong nLnNumRestartNo, bool bIsFirstParagraph=false)
static void SetFooterFlag(sal_uInt8 &rHeadFootFlags, const SwFormat &rFormat, sal_uInt8 nFlag)
void NeedsDocumentProtected(const WW8_SepInfo &rInfo)
std::vector< WW8_SepInfo > m_aSects
static void SetHeaderFlag(sal_uInt8 &rHeadFootFlags, const SwFormat &rFormat, sal_uInt8 nFlag)
virtual bool HeaderFooterWritten()
void CheckForFacinPg(const WW8Export &rWrt) const
static const SwFormatCol & GetFormatCol(const SwDoc &rDoc, const WW8_SepInfo &rInfo)
Number of columns of the provided WW8_SepInfo.
static OString CreateStyleId(std::u16string_view aName)
create style id using only ASCII characters of the style name
void GetStyleData(const SwFormat *pFormat, bool &bFormatColl, sal_uInt16 &nBase, sal_uInt16 &nNext, sal_uInt16 &nLink)
Return information about one style.
MSWordExportBase & m_rExport
void BuildStyleIds()
Based on style names, fill in unique, MS-like names.
void WriteProperties(const SwFormat *pFormat, bool bPap, sal_uInt16 nPos, bool bInsDefCharSiz)
Outputs attributes of one style.
void BuildStylesTable()
Create the style table, called from the constructor.
void OutputStyle(sal_uInt16 nSlot)
Outputs one style - called (in a loop) from OutputStylesTable().
OUString GetStyleWWName(SwFormat const *pFormat) const
the awful TOC field references names, not styleIds
OString const & GetStyleId(sal_uInt16 nSlot) const
Get styleId of the nSlot-th style (nSlot is its position in m_aStyles).
void SetStyleDefaults(const SwFormat &rFormat, bool bPap)
static sal_uInt16 GetWWId(const SwFormat &rFormat)
void OutputStylesTable()
Output the styles table.
sal_uInt16 GetSlot(const SwFormat *pFormat) const
Get slot of the style (rFormat).
MSWordStyles(const MSWordStyles &)=delete
std::vector< MapEntry > m_aStyles
Slot <-> Character/paragraph/list style array.
void BuildWwNames()
Generate proper Word names, taking mapping between special types into account.
bool m_bListStyles
If list styles are requested to be exported as well.
sal_uInt16 m_aHeadingParagraphStyles[MAXLEVEL]
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
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
const SvxFontHeightItem & GetSize(bool=true) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
const SwFootnoteInfo & GetFootnoteInfo() const
const SwNumRuleTable & GetNumRuleTable() const
const SwCharFormats * GetCharFormats() const
const SwLineNumberInfo & GetLineNumberInfo() const
SwFootnoteIdxs & GetFootnoteIdxs()
const SwTextFormatColls * GetTextFormatColls() const
const SwEndNoteInfo & GetEndNoteInfo() const
const SwTextFormatColl * GetDfltTextFormatColl() const
const SwAttrPool & GetAttrPool() const
const SwPageDesc & GetPageDesc(const size_t i) const
sal_uInt16 m_nFootnoteOffset
SwCharFormat * GetCharFormat(SwDoc &rDoc) const
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
Content, content of frame (header, footer, fly).
const SwNodeIndex * GetContentIdx() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
SwPageDesc * GetPageDesc()
const ::std::optional< sal_uInt16 > & GetNumOffset() const
< purpose of derivation from SwClient: character style for displaying the numbers.
sal_uInt16 GetCountBy() const
bool IsRestartEachPage() const
bool IsPaintLineNumbers() const
sal_uInt16 GetPosFromLeft() const
void ExportControl(WW8Export &rWrt, const SdrUnoObj &rFormObj)
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwSectionNode * GetSectionNode()
bool IsContentNode() const
bool IsSectionNode() const
SwSectionNode * FindSectionNode()
Search section node, in which it is.
const SwStartNode * StartOfSectionNode() const
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
SwTableNode * GetTableNode()
const SwEndNode * EndOfSectionNode() const
const OUString & GetName() const
PaM is Point and Mark: a selection of the document model.
SwFrameFormat & GetMaster()
bool IsHeaderShared() const
const SwFrameFormat * GetPageFormatOfNode(const SwNode &rNd, bool bCheckForThisPgDc=true) const
const SvxNumberType & GetNumType() const
bool IsFirstShared() const
bool IsFooterShared() const
SwFrameFormat & GetFirstLeft()
SwFrameFormat & GetFirstMaster()
SwFrameFormat & GetLeft()
const SwPageDesc * GetFollow() const
bool IsFollowNextPageOfNode(const SwNode &rNd) const
drawing::TextVerticalAdjust GetVerticalAdjustment() const
UseOnPage ReadUseOn() const
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
const OUString & GetInitials() const
virtual OUString GetPar1() const override
Author.
const OUString & GetText() const
const OUString & GetName() const
const OutlinerParaObject * GetTextObject() const
tools::Time GetTime() const
A section node represents the start of a section on the UI, i.e.
const SwSection & GetSection() const
SwSectionFormat * GetFormat()
SectionType GetType() const
const SwTable & GetTable() const
SwTableFormat * GetFrameFormat()
Represents the style of a paragraph.
bool IsAssignedToListLevelOfOutlineStyle() const
int GetAssignedOutlineStyleLevel() const
SwTextNode is a paragraph in the document model.
static void InsAsString16(ww::bytes &rO, const OUString &rStr)
static void FillCount(SvStream &rStrm, sal_uLong nCount)
static void InsUInt16(ww::bytes &rO, sal_uInt16 n)
static void WriteLong(SvStream &rStrm, sal_Int32 nVal)
static void WriteString16(SvStream &rStrm, const OUString &rStr, bool bAddZero)
static void WriteShort(SvStream &rStrm, sal_Int16 nVal)
virtual void SectionLineNumbering(sal_uLong nRestartNo, const SwLineNumberInfo &rLnNumInfo) override
Numbering of the lines in the document.
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.
sal_uInt16 m_nStyleLenPos
virtual void SectionPageNumbering(sal_uInt16 nNumType, const ::std::optional< sal_uInt16 > &oPageRestartNumber) override
The style of the page numbers.
virtual void SectionPageBorders(const SwFrameFormat *pFormat, const SwFrameFormat *pFirstPageFormat) override
Description of the page borders.
sal_uInt16 m_nStyleStartSize
For output of styles.
virtual void StartStyles() override
Start of the styles table.
virtual void SectionBiDi(bool bBiDi) override
Columns populated from right/numbers on the right side?
virtual void StartStyleProperties(bool bParProp, sal_uInt16 nStyle) override
Start of (paragraph or run) properties of a style.
virtual void TextVerticalAdjustment(const css::drawing::TextVerticalAdjust) override
sal_uInt16 m_nPOPosStdLen1
For output of styles.
virtual void StartSection() override
Start of the section properties.
virtual void EndStyle() override
End of a style in the styles table.
sal_uInt16 m_nPOPosStdLen2
virtual void EndStyles(sal_uInt16 nNumberOfStyles) override
End of the styles table.
virtual void SectionTitlePage() override
Has different headers/footers for the title page.
virtual void DefaultStyle() override
Write default style.
virtual void EndStyleProperties(bool bParProp) override
End of (paragraph or run) properties of a style.
virtual void SectionType(sal_uInt8 nBreakCode) override
The type of breaking.
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.
virtual void SectFootnoteEndnotePr() override
for footnote/endnote section properties
Exporter of the binary Word file formats.
void IncrementHdFtIndex()
void WriteSdrTextObj(const SdrTextObj &rObj, sal_uInt8 nTyp)
std::unique_ptr< WW8_WrPlcSepx > m_pSepx
Sections/headers/footers.
void InsUInt16(sal_uInt16 n)
SwMSConvertControls & GetOCXExp()
void WritePostItBegin(ww::bytes *pO=nullptr)
void WriteStringAsPara(const OUString &rText)
void WriteOutliner(const OutlinerParaObject &rOutliner, sal_uInt8 nTyp)
void SetHdFtIndex(unsigned int nHdFtIndex)
std::unique_ptr< WW8Dop > m_pDop
Document Properties.
unsigned int GetHdFtIndex() const
std::unique_ptr< WW8Fib > m_pFib
File Information Block.
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.
static sal_uInt8 GetNumId(sal_uInt16 eNumType)
Converts the SVX numbering type to MSONFC.
WW8_CP Fc2Cp(sal_uLong nFc) const
void WriteFootnoteBegin(const SwFormatFootnote &rFootnote, ww::bytes *pO=nullptr)
virtual void SetupSectionPositions(WW8_PdAttrDesc *pA) override
Setup the pA's info.
std::unique_ptr< ww::bytes > m_pO
Buffer.
FIB - the File Information Block.
sal_Int32 m_lcbPlcfAtnbkf
sal_uInt32 m_lcbAtrdExtra
sal_Int32 m_lcbGrpStAtnOwners
sal_Int32 m_lcbSttbfAtnbkmk
sal_Int32 m_lcbPlcfAtnbkl
WW8_FC m_fcGrpStAtnOwners
WW8_WrPlc0 & operator=(WW8_WrPlc0 const &)=delete
std::vector< sal_uLong > m_aPos
void Write(SvStream &rStrm)
void Append(sal_uLong nStartCpOrFc)
WW8_WrPlc0(WW8_WrPlc0 const &)=delete
void AddRangeStartPosition(const OUString &rName, WW8_CP nStartCp, bool bIgnoreEmpty)
virtual ~WW8_WrPlcAnnotations() override
o3tl::sorted_vector< const SwRedlineData * > maProcessedRedlines
void Append(WW8_CP nCp, const SwPostItField *pPostIt)
bool IsNewRedlineComment(const SwRedlineData *pRedLine)
std::map< const OUString, std::pair< WW8_CP, bool > > m_aRangeStartPositions
std::unique_ptr< WW8_WrPlc0 > m_pTextPos
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)
void WritePlcSed(WW8Export &rWrt) const
virtual bool HeaderFooterWritten() override
void WriteSepx(SvStream &rStrm) const
std::vector< std::shared_ptr< WW8_PdAttrDesc > > m_SectionAttributes
void AppendSep(WW8_CP nStartCp, const SwPageDesc *pPd, const SwSectionFormat *pSectionFormat, sal_uLong nLnNumRestartNo)
void WritePlcHdd(WW8Export &rWrt) const
bool WriteKFText(WW8Export &rWrt)
bool m_bHeaderFooterWritten
virtual ~WW8_WrPlcSepx() override
void WriteFootnoteEndText(WW8Export &rWrt, sal_uLong nCpStt)
std::vector< WW8_CP > m_aCps
std::vector< const void * > m_aContent
virtual ~WW8_WrPlcSubDoc()
void WriteGenericPlc(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_FC &rTextStt, sal_Int32 &rTextCnt, WW8_FC &rRefStt, sal_Int32 &rRefCnt) const
std::vector< WW8_CP > m_aCps
virtual const std::vector< sal_uInt32 > * GetShapeIdArr() const
std::unique_ptr< WW8_WrPlc0 > m_pTextPos
std::vector< const SwFrameFormat * > m_aSpareFormats
bool WriteGenericText(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_CP &rCount)
const_iterator find(const Value &x) const
const_iterator end() const
std::pair< const_iterator, bool > insert(Value &&x)
Find suitable names for exporting this font.
std::map< wwFont, sal_uInt16 > maFonts
Keep track of fonts that need to be exported.
void InitFontTable(const SwDoc &rDoc)
rDoc used only to get the initial standard font(s) in use.
sal_uInt16 GetId(const SvxFontItem &rFont)
void WriteFontTable(SvStream *pTableStream, WW8Fib &pFib)
std::vector< const wwFont * > AsVector() const
Convert from fast insertion map to linear vector in the order that we want to write.
bool m_bLoadAllFonts
If true, all fonts are loaded before processing the document.
Collects and outputs fonts.
void WriteRtf(const RtfAttributeOutput *rAttrOutput) const
void Write(SvStream *pTableStram) const
void WriteDocx(DocxAttributeOutput *rAttrOutput) const
rtl_TextEncoding meChrSet
wwFont(std::u16string_view rFamilyName, FontPitch ePitch, FontFamily eFamily, rtl_TextEncoding eChrSet)
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.
std::unique_ptr< sal_Int32[]> pData
OUString CreateDOCXStyleId(std::u16string_view const aName)
const HdFtFlags WW8_HEADER_FIRST
const HdFtFlags WW8_FOOTER_ODD
const HdFtFlags WW8_FOOTER_EVEN
const HdFtFlags WW8_HEADER_EVEN
const HdFtFlags WW8_FOOTER_FIRST
const HdFtFlags WW8_HEADER_ODD
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.
const char * GetEnglishNameFromSti(sti eSti) noexcept
Find the WinWord english name from a sti index.
SwMoveFnCollection const & fnMoveBackward
@ RES_POOLCOLL_BULLET_LEVEL2
2nd level.
@ RES_POOLCOLL_NUM_LEVEL5
5th level.
@ RES_POOLCOLL_BULLET_NONUM2
No numbering.
@ RES_POOLCOLL_HEADLINE5
Heading 5.
@ RES_POOLCOLL_TEXT
Text body.
@ RES_POOLCOLL_STANDARD
Standard.
@ RES_POOLCOLL_GREETING
Complimentary close.
@ RES_POOLCOLL_HEADLINE6
Heading 6.
@ RES_POOLCOLL_SIGNATURE
Signature.
@ RES_POOLCOLL_BULLET_LEVEL4
4th level.
@ RES_POOLCOLL_TOX_IDX3
3rd level.
@ RES_POOLCOLL_MARGINAL
Marginalia.
@ RES_POOLCOLL_TOX_CNTNTH
Subgroup table of contents.
@ RES_POOLCOLL_LABEL
Subgroup labels.
@ RES_POOLCOLL_BULLET_LEVEL1
1st level.
@ RES_POOLCOLL_TOX_IDXH
Subgroup index tables.
@ RES_POOLCOLL_HEADLINE8
Heading 8.
@ RES_POOLCOLL_DOC_APPENDIX
Doc. appendix.
@ RES_POOLCOLL_ENVELOPE_ADDRESS
Addressee.
@ RES_POOLCOLL_BULLET_NONUM1
No numbering.
@ RES_POOLCOLL_HEADER
Header Left&Right.
@ RES_POOLCOLL_TOX_CNTNT6
Content 6th level.
@ RES_POOLCOLL_NUM_LEVEL4
4th level.
@ RES_POOLCOLL_DOC_TITLE
Doc. title.
@ RES_POOLCOLL_BULLET_NONUM5
No numbering.
@ RES_POOLCOLL_TOX_CNTNT5
Content 5th level.
@ RES_POOLCOLL_HEADLINE9
Heading 9.
@ RES_POOLCOLL_BULLET_NONUM3
No numbering.
@ RES_POOLCOLL_TOX_IDX1
1st level.
@ RES_POOLCOLL_NUM_LEVEL3
3rd level.
@ RES_POOLCOLL_TOX_CNTNT1
Content 1st level.
@ RES_POOLCOLL_BULLET_LEVEL3
3rd Level.
@ RES_POOLCOLL_TEXT_MOVE
Text body indent.
@ RES_POOLCOLL_SEND_ADDRESS
Sender.
@ RES_POOLCOLL_LISTS_BEGIN
Group lists.
@ RES_POOLCOLL_NUM_LEVEL2
2nd level.
@ RES_POOLCOLL_NUM_LEVEL1
1st level.
@ RES_POOLCOLL_TOX_ILLUS1
Illustrations all levels.
@ RES_POOLCOLL_HEADLINE2
Heading 2.
@ RES_POOLCOLL_DOC_SUBTITLE
Doc. subtitle.
@ RES_POOLCOLL_TOX_CNTNT9
Content 9th level.
@ RES_POOLCOLL_HEADLINE4
Heading 4.
@ RES_POOLCOLL_BULLET_NONUM4
No numbering.
@ RES_POOLCOLL_FOOTNOTE
Footnotes.
@ RES_POOLCOLL_TOX_AUTHORITIESH
index of authorities.
@ RES_POOLCOLL_HEADLINE7
Heading 7.
@ RES_POOLCOLL_BULLET_LEVEL5
5th level.
@ RES_POOLCOLL_HEADLINE1
Heading 1.
@ RES_POOLCOLL_FOOTER
Subgroup footer.
@ RES_POOLCOLL_TEXT_IDENT
Text body first line indent.
@ RES_POOLCOLL_HEADLINE3
Heading 3.
@ RES_POOLCOLL_ENDNOTE
Endnotes.
@ RES_POOLCHR_INET_VISIT
Internet visited.
@ RES_POOLCHR_HTML_EMPHASIS
@ RES_POOLCHR_ENDNOTE_ANCHOR
Endnote anchor.
@ RES_POOLCHR_PAGENO
Pages/field.
@ RES_POOLCHR_INET_NORMAL
Internet normal.
@ RES_POOLCHR_HTML_STRONG
@ RES_POOLCHR_LINENUM
Line numbering.
@ RES_POOLCHR_FOOTNOTE_ANCHOR
Footnote anchor.
static constexpr sal_uInt16 val
const OutlinerParaObject * mpRichText
bool HasRange() const
An annotation has a range if start != end or the m_bIgnoreEmpty flag is cleared.
WW8_Annotation(const SwPostItField *pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd)
For the output of sections.
std::unique_ptr< sal_uInt8[]> m_pData
sal_uLong nLnNumRestartNo
::std::optional< sal_uInt16 > oPgRestartNo
const SwSectionFormat * pSectionFormat
const SwPageDesc * pPageDesc
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)
constexpr sal_uInt8 MAXLEVEL
bool operator<(const wwFont &r1, const wwFont &r2)
static OUString StripWWSuffix(const OUString &s)
static bool lcl_AuthorComp(const std::pair< OUString, OUString > &aFirst, const std::pair< OUString, OUString > &aSecond)
static bool lcl_PosComp(const std::pair< WW8_CP, int > &aFirst, const std::pair< WW8_CP, int > &aSecond)
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.
static sal_uInt16 BuildGetSlot(const SwFormat &rFormat)
Get reserved slot number during building the style table.
#define WW8_RESERVED_SLOTS
#define MSWORD_MAX_STYLES_LIMIT
void Set_UInt16(sal_uInt8 *&p, sal_uInt16 n)