23 #include <com/sun/star/embed/ElementModes.hpp>
24 #include <com/sun/star/embed/XStorage.hpp>
25 #include <com/sun/star/frame/XModel.hpp>
26 #include <com/sun/star/packages/XPackageEncryption.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <osl/endian.h>
38 #include <drawdoc.hxx>
59 #include <../../core/inc/rootfrm.hxx>
80 #include <section.hxx>
87 #include <strings.hrc>
98 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
99 #include <com/sun/star/document/XDocumentProperties.hpp>
107 #include <rtl/random.h>
151 {
return !bCombined && nIMax && nEndFc ==
reinterpret_cast<sal_Int32*
>(pFkp)[nIMax]; }
152 void MergeToNew(
short& rVarLen,
sal_uInt8 *& pNewSprms );
154 {
return !bCombined && nIMax && !nOldVarLen; }
156 {
reinterpret_cast<sal_Int32*
>(pFkp)[nIMax] = nEnd; }
158 WW8_FC GetStartFc()
const;
173 : nStartCp( nSCp ), nStartFc( nSFc ), nStatus( 0x0040 )
183 typedef std::pair<bool,OUString>
BKMK;
184 typedef std::pair<tools::Long,BKMK>
BKMKCP;
185 typedef std::multimap<tools::Long,BKMKCP*>
BKMKCPs;
214 for (
auto& rEntry : aSttCps)
218 delete rEntry.second;
219 rEntry.second =
nullptr;
226 std::pair<BKMKNames::iterator, bool> aResult = maSwBkmkNms.insert(std::pair<OUString,tools::Long>(rNm,0L));
230 BKMKCP* pBKCP =
new BKMKCP(static_cast<tools::Long>(nStartCp),aBK);
231 aSttCps.insert(std::pair<tools::Long,BKMKCP*>(nStartCp,pBKCP));
232 aResult.first->second =
static_cast<tools::Long>(nStartCp);
236 std::pair<CPItr,CPItr> aRange = aSttCps.equal_range(aResult.first->second);
237 for (
CPItr aItr = aRange.first;aItr != aRange.second;++aItr)
239 if (aItr->second && aItr->second->second.second == rNm)
241 if (aItr->second->second.first)
243 aItr->second->first =
static_cast<tools::Long>(nStartCp);
255 std::vector<OUString> aNames;
260 for (
const auto& rEntry : aSttCps)
264 aEndCps.insert(std::pair<tools::Long,BKMKCP*>(rEntry.second->first, rEntry.second));
265 aNames.push_back(rEntry.second->second.second);
272 for (
const auto& rEntry : aEndCps)
276 rEntry.second->first = n;
285 rWrt.
pFib->m_fcPlcfbkf = rStrm.
Tell();
288 for (
const auto& rEntry : aSttCps)
295 rWrt.
pFib->m_lcbPlcfbkf = rStrm.
Tell() - rWrt.
pFib->m_fcPlcfbkf;
296 rWrt.
pFib->m_fcPlcfbkl = rStrm.
Tell();
299 rWrt.
pFib->m_lcbPlcfbkl = rStrm.
Tell() - rWrt.
pFib->m_fcPlcfbkl;
304 std::pair<CPItr,CPItr> aRange = aSttCps.equal_range(nFrom);
305 CPItr aItr = aRange.first;
306 while (aItr != aRange.second)
310 if (aItr->second->first == static_cast<tools::Long>(nFrom))
312 aItr->second->second.first =
true;
313 aItr->second->first = nTo;
315 aSttCps.insert(std::pair<tools::Long,BKMKCP*>(nTo,aItr->second));
316 aItr->second =
nullptr;
317 aRange = aSttCps.equal_range(nFrom);
337 void Append(
WW8_CP nStartCp,
WW8_CP nEndCp,
const std::map<OUString, OUString>& rStatements);
347 m_aStartCPs.push_back(nStartCp);
348 m_aEndCPs.push_back(nEndCp);
349 m_aStatements.push_back(rStatements);
354 if (m_aStartCPs.empty())
358 rExport.
pDop->fEmbedFactoids =
true;
362 rExport.
pFib->m_fcSttbfBkmkFactoid = rStream.
Tell();
368 for (
size_t i = 0;
i < m_aStartCPs.size(); ++
i)
377 rExport.
pFib->m_lcbSttbfBkmkFactoid = rStream.
Tell() - rExport.
pFib->m_fcSttbfBkmkFactoid;
379 rExport.
pFib->m_fcPlcfBkfFactoid = rStream.
Tell();
380 for (
const WW8_CP& rCP : m_aStartCPs)
385 for (
size_t i = 0;
i < m_aStartCPs.size(); ++
i)
392 rExport.
pFib->m_lcbPlcfBkfFactoid = rStream.
Tell() - rExport.
pFib->m_fcPlcfBkfFactoid;
394 rExport.
pFib->m_fcPlcfBklFactoid = rStream.
Tell();
395 for (
const WW8_CP& rCP : m_aEndCPs)
400 for (
size_t i = 0;
i < m_aEndCPs.size(); ++
i)
405 rExport.
pFib->m_lcbPlcfBklFactoid = rStream.
Tell() - rExport.
pFib->m_fcPlcfBklFactoid;
407 rExport.
pFib->m_fcFactoidData = rStream.
Tell();
410 aFactoidType.
m_nId = 1;
411 aFactoidType.
m_aUri =
"http://www.w3.org/1999/02/22-rdf-syntax-ns#";
412 aFactoidType.
m_aTag =
"RDF";
416 std::set<OUString> aSet;
417 for (
const std::map<OUString, OUString>& rStatements : m_aStatements)
420 for (
const auto& rPair : rStatements)
422 aSet.insert(rPair.first);
423 aSet.insert(rPair.second);
427 for (
const std::map<OUString, OUString>& rStatements : m_aStatements)
430 aPropertyBag.
m_nId = 1;
431 for (
const auto& rPair : rStatements)
434 aProperty.
m_nKey = std::distance(aSet.begin(), aSet.find(rPair.first));
435 aProperty.
m_nValue = std::distance(aSet.begin(), aSet.find(rPair.second));
441 aSmartTagData.
Write(rExport);
442 rExport.
pFib->m_lcbFactoidData = rStream.
Tell() - rExport.
pFib->m_fcFactoidData;
445 #define DEFAULT_STYLES_COUNT 16
448 #define sMainStream OUString("WordDocument")
449 #define sCompObj "\1CompObj"
465 rDop.
dxaTab =
static_cast<sal_uInt16
>(rTabStop[0].GetTabPos());
471 switch ( pViewShell->GetViewOptions()->GetZoomType() )
473 case SvxZoomType::WHOLEPAGE: rDop.
zkSaved = 1;
break;
474 case SvxZoomType::PAGEWIDTH: rDop.
zkSaved = 2;
break;
475 case SvxZoomType::OPTIMAL: rDop.
zkSaved = 3;
break;
477 rDop.
wScaleSaved = pViewShell->GetViewOptions()->GetZoom();
489 rDop.
cPg =
static_cast< sal_Int16
>(rDStat.
nPage);
494 OSL_ENSURE(pDocShell,
"no SwDocShell");
495 uno::Reference<document::XDocumentProperties> xDocProps;
496 uno::Reference<beans::XPropertySet> xProps;
499 uno::Reference<lang::XComponent> xModelComp = pDocShell->GetModel();
500 xProps.set(xModelComp, uno::UNO_QUERY);
501 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(xModelComp, uno::UNO_QUERY_THROW);
502 xDocProps = xDPS->getDocumentProperties();
503 OSL_ENSURE(xDocProps.is(),
"DocumentProperties is null");
505 rDop.
lKeyProtDoc = pDocShell->GetModifyPasswordHash();
508 if ((rWrt.
pSepx && rWrt.
pSepx->DocumentIsProtected()) ||
532 ::util::DateTime uDT = xDocProps->getCreationDate();
534 uDT = xDocProps->getModificationDate();
536 uDT = xDocProps->getPrintDate();
561 if( nMSStrByteLen > rSWStr.getLength() )
562 nMSStrByteLen = rSWStr.getLength()+1;
565 return memcmp( rSWStr.getStr(), pMSStr, nMSStrByteLen );
579 0x0021, 0x0025, 0x0029, 0x002c, 0x002e, 0x003a, 0x003b, 0x003f,
580 0x005d, 0x007d, 0x00a2, 0x00b0, 0x2019, 0x201d, 0x2030, 0x2032,
581 0x2033, 0x2103, 0x3001, 0x3002, 0x3005, 0x3009, 0x300b, 0x300d,
582 0x300f, 0x3011, 0x3015, 0x3041, 0x3043, 0x3045, 0x3047, 0x3049,
583 0x3063, 0x3083, 0x3085, 0x3087, 0x308e, 0x309b, 0x309c, 0x309d,
584 0x309e, 0x30a1, 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30c3, 0x30e3,
585 0x30e5, 0x30e7, 0x30ee, 0x30f5, 0x30f6, 0x30fb, 0x30fc, 0x30fd,
586 0x30fe, 0xff01, 0xff05, 0xff09, 0xff0c, 0xff0e, 0xff1a, 0xff1b,
587 0xff1f, 0xff3d, 0xff5d, 0xff61, 0xff63, 0xff64, 0xff65, 0xff67,
588 0xff68, 0xff69, 0xff6a, 0xff6b, 0xff6c, 0xff6d, 0xff6e, 0xff6f,
589 0xff70, 0xff9e, 0xff9f, 0xffe0
593 0x0021, 0x0029, 0x002c, 0x002e, 0x003a, 0x003b, 0x003f, 0x005d,
594 0x007d, 0x00a8, 0x00b7, 0x02c7, 0x02c9, 0x2015, 0x2016, 0x2019,
595 0x201d, 0x2026, 0x2236, 0x3001, 0x3002, 0x3003, 0x3005, 0x3009,
596 0x300b, 0x300d, 0x300f, 0x3011, 0x3015, 0x3017, 0xff01, 0xff02,
597 0xff07, 0xff09, 0xff0c, 0xff0e, 0xff1a, 0xff1b, 0xff1f, 0xff3d,
598 0xff40, 0xff5c, 0xff5d, 0xff5e, 0xffe0
602 0x0021, 0x0025, 0x0029, 0x002c, 0x002e, 0x003a, 0x003b, 0x003f,
603 0x005d, 0x007d, 0x00a2, 0x00b0, 0x2019, 0x201d, 0x2032, 0x2033,
604 0x2103, 0x3009, 0x300b, 0x300d, 0x300f, 0x3011, 0x3015, 0xff01,
605 0xff05, 0xff09, 0xff0c, 0xff0e, 0xff1a, 0xff1b, 0xff1f, 0xff3d,
610 0x0021, 0x0029, 0x002c, 0x002e, 0x003a, 0x003b, 0x003f, 0x005d,
611 0x007d, 0x00a2, 0x00b7, 0x2013, 0x2014, 0x2019, 0x201d, 0x2022,
612 0x2025, 0x2026, 0x2027, 0x2032, 0x2574, 0x3001, 0x3002, 0x3009,
613 0x300b, 0x300d, 0x300f, 0x3011, 0x3015, 0x301e, 0xfe30, 0xfe31,
614 0xfe33, 0xfe34, 0xfe36, 0xfe38, 0xfe3a, 0xfe3c, 0xfe3e, 0xfe40,
615 0xfe42, 0xfe44, 0xfe4f, 0xfe50, 0xfe51, 0xfe52, 0xfe54, 0xfe55,
616 0xfe56, 0xfe57, 0xfe5a, 0xfe5c, 0xfe5e, 0xff01, 0xff09, 0xff0c,
617 0xff0e, 0xff1a, 0xff1b, 0xff1f, 0xff5c, 0xff5d, 0xff64
625 0x0024, 0x0028, 0x005b, 0x005c, 0x007b, 0x00a3, 0x00a5, 0x2018,
626 0x201c, 0x3008, 0x300a, 0x300c, 0x300e, 0x3010, 0x3014, 0xff04,
627 0xff08, 0xff3b, 0xff5b, 0xff62, 0xffe1, 0xffe5
631 0x0028, 0x005b, 0x007b, 0x00b7, 0x2018, 0x201c, 0x3008, 0x300a,
632 0x300c, 0x300e, 0x3010, 0x3014, 0x3016, 0xff08, 0xff0e, 0xff3b,
633 0xff5b, 0xffe1, 0xffe5
637 0x0028, 0x005b, 0x005c, 0x007b, 0x00a3, 0x00a5, 0x2018, 0x201c,
638 0x3008, 0x300a, 0x300c, 0x300e, 0x3010, 0x3014, 0xff04, 0xff08,
639 0xff3b, 0xff5b, 0xffe6
643 0x0028, 0x005b, 0x007b, 0x00a3, 0x00a5, 0x2018, 0x201c, 0x2035,
644 0x3008, 0x300a, 0x300c, 0x300e, 0x3010, 0x3014, 0x301d, 0xfe35,
645 0xfe37, 0xfe39, 0xfe3b, 0xfe3d, 0xfe3f, 0xfe41, 0xfe43, 0xfe59,
646 0xfe5b, 0xfe5d, 0xff08, 0xff5b
650 const i18n::ForbiddenCharacters *pForbidden =
nullptr;
651 const i18n::ForbiddenCharacters *pUseMe =
nullptr;
680 if (
nullptr != pForbidden)
684 aLangNotEnd[ nIdx ],
sizeof(aLangNotEnd[ nIdx ]) ) ||
686 aLangNotBegin[ nIdx ],
sizeof(aLangNotBegin[ nIdx ]) ) )
702 pForbidden->beginLine,
724 OSL_ENSURE( nNoNeeded<=1,
"Example of unexportable forbidden chars" );
729 (pUseMe->beginLine.getLength());
734 (pUseMe->endLine.getLength());
762 if (nWhich && SfxItemState::SET != m_pISet->GetItemState(nWhich,
true, &pItem))
765 else if( m_pChpIter )
766 pItem = m_pChpIter->HasTextItem( nWhich );
769 OSL_ENSURE(
false,
"Where is my ItemSet / pChpIter ?" );
777 assert((m_pISet || m_pChpIter) &&
"Where is my ItemSet / pChpIter ?");
784 OSL_ENSURE(nWhich != 0,
"All broken, Impossible");
785 return m_pISet->Get(nWhich);
787 return m_pChpIter->GetItem( nWhich );
792 nDataLen(16 * nStructSz),
793 nStructSiz( nStructSz )
803 bool b = !
aPos.empty();
804 OSL_ENSURE(b,
"Prev called on empty list");
805 return b ?
aPos.back() : 0;
811 aPos.push_back( nCp );
826 aPos.push_back( nLastCp );
835 decltype(
aPos)::size_type
i;
836 for( i = 0; i <
aPos.size(); ++i )
854 pfc = &rWrt.
pFib->m_fcPlcffldMom;
855 plc = &rWrt.
pFib->m_lcbPlcffldMom;
858 pfc = &rWrt.
pFib->m_fcPlcffldHdr;
859 plc = &rWrt.
pFib->m_lcbPlcffldHdr;
863 pfc = &rWrt.
pFib->m_fcPlcffldFootnote;
864 plc = &rWrt.
pFib->m_lcbPlcffldFootnote;
868 pfc = &rWrt.
pFib->m_fcPlcffldEdn;
869 plc = &rWrt.
pFib->m_lcbPlcffldEdn;
873 pfc = &rWrt.
pFib->m_fcPlcffldAtn;
874 plc = &rWrt.
pFib->m_lcbPlcffldAtn;
878 pfc = &rWrt.
pFib->m_fcPlcffldTxbx;
879 plc = &rWrt.
pFib->m_lcbPlcffldTxbx;
883 pfc = &rWrt.
pFib->m_fcPlcffldHdrTxbx;
884 plc = &rWrt.
pFib->m_lcbPlcffldHdrTxbx;
907 rWrt.
pFib->m_fcPlcfTch = nFcStart;
921 UInt32ToSVBT32(nData,nLittle);
928 static const sal_uInt32 aNulls[16] =
930 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
943 sal_uInt64 nCurPos = rStrm.
Tell();
945 nEndPos = (nCurPos + 0x1ff) & ~0x1ffUL;
947 if( nEndPos > nCurPos )
949 #if OSL_DEBUG_LEVEL > 0
951 OSL_ENSURE( nEndPos == nCurPos,
"Wrong FillUntil()" );
961 m_Fkps.push_back(std::make_unique<WW8_WrFkp>(
ePlc, nStartFc));
981 if (
PAP ==
ePlc && 488 <= nVarLen)
994 nVarLen =
static_cast< short >(p - aHugePapx);
995 pSprms = pNewSprms = aHugePapx;
1009 bool bOk = pF->
Append(nEndFc, nVarLen, pNewSprms);
1015 m_Fkps.push_back(std::unique_ptr<WW8_WrFkp>(pF));
1016 if( !pF->
Append( nEndFc, nVarLen, pNewSprms ) )
1018 OSL_ENSURE(
false,
"Unable to insert Sprm" );
1021 if( pNewSprms != pSprms )
1029 for(
const std::unique_ptr<WW8_WrFkp> & rp :
m_Fkps)
1037 rWrt.
pFib->m_cpnBteChp = m_Fkps.size();
1042 rWrt.
pFib->m_cpnBtePap = m_Fkps.size();
1049 decltype(
m_Fkps)::size_type
i;
1051 for (i = 0; i <
m_Fkps.size(); ++i)
1054 m_Fkps[ i ]->GetStartFc() );
1058 m_Fkps[ i - 1 ]->GetEndFc() );
1061 for (i = 0; i <
m_Fkps.size(); ++i)
1068 rWrt.
pFib->m_fcPlcfbteChpx = nFcStart;
1073 rWrt.
pFib->m_fcPlcfbtePapx = nFcStart;
1079 : ePlc(ePl), nStartGrp(511), nOldStartGrp(511),
1080 nItemSize( (
CHP == ePl ) ? 1 : 13 ),
1081 nIMax(0), nOldVarLen(0), bCombined(false)
1085 memset(
pFkp, 0, 4 * 128 );
1086 memset(
pOfs, 0, 4 * 128 );
1087 reinterpret_cast<sal_Int32*
>(
pFkp)[0] = nStartFc;
1092 delete[]
reinterpret_cast<sal_Int32 *
>(
pFkp);
1093 delete[]
reinterpret_cast<sal_Int32 *
>(
pOfs);
1101 for(
sal_uInt8 n = static_cast< sal_uInt8 >(nVarLen - 1); 3 <
n; --
n )
1109 for( i = 0; i <
nIMax; i++ )
1114 const sal_uInt8*
p =
pFkp + (
static_cast<sal_uInt16
>(nStart) << 1 );
1117 : ((static_cast<sal_uInt16>(*p++) << 1 ) == (( nVarLen+1) & 0xfffe)) )
1118 && !memcmp( p, pSprms, nVarLen ) )
1128 sal_uInt8 *pStart=
nullptr,*pRet=
nullptr;
1137 const sal_uInt8*
p =
pFkp + (
static_cast<sal_uInt16
>(nStart) << 1 );
1148 memcpy(pRet,p,rLen);
1155 assert((!nVarLen || pSprms) &&
"Item pointer missing");
1157 OSL_ENSURE( nVarLen < ( (
ePlc ==
PAP ) ? 497U : 502U ),
"Sprms too long !" );
1161 OSL_ENSURE(
false,
"Fkp::Append: Fkp is already combined" );
1164 sal_Int32
n =
reinterpret_cast<sal_Int32*
>(
pFkp)[
nIMax];
1167 OSL_ENSURE( nEndFc >= n,
"+Fkp: FC backwards" );
1168 OSL_ENSURE( !nVarLen || !pSprms || nEndFc != n,
1169 "+Fkp: used same FC multiple times" );
1178 if (nVarLen && !nOldP)
1183 : (
nStartGrp - (((nVarLen + 1) & 0xFFFE)+1)) & 0xFFFE )
1195 reinterpret_cast<sal_Int32*
>(
pFkp)[
nIMax + 1] = nEndFc;
1198 if( nVarLen && !nOldP )
1206 ? ( nVarLen < 256 ) ? static_cast<sal_uInt8>(nVarLen) : 255
1207 : ( ( nVarLen + 1 ) >> 1 ));
1209 pFkp[ nOffset ] = nCnt;
1210 memcpy(
pFkp + nOffset + 1, pSprms, nVarLen );
1233 #if defined OSL_BIGENDIAN // only the FCs will be rotated here
1237 for( i = 0, p = (sal_uInt32*)
pFkp; i <=
nIMax; i++, p++ )
1238 *p = OSL_SWAPDWORD( *p );
1239 #endif // ifdef OSL_BIGENDIAN
1248 for( p =
pFkp + 511 - 4; p >= pEnd; p-- )
1258 UInt32ToSVBT32( rGrf.
GetFPos(), nPos );
1259 memcpy( p, nPos, 4 );
1284 memcpy( pNew +
nOldVarLen, rpNewSprms, rVarLen );
1292 for (sal_uInt16
n = 0;
n <
nIMax; ++
n)
1313 return SVBT32ToUInt32(
pFkp );
1314 return reinterpret_cast<sal_Int32*
>(
pFkp)[0];
1320 return SVBT32ToUInt32( &(
pFkp[
nIMax*4]) );
1321 return reinterpret_cast<sal_Int32*
>(
pFkp)[nIMax];
1339 if ( !nStartCp && !
m_Pcts.empty())
1341 OSL_ENSURE(1 ==
m_Pcts.size(),
"empty Piece!");
1351 nStartCp +=
m_Pcts.back()->GetStartCp();
1354 m_Pcts.push_back(std::make_unique<WW8_WrPc>(nStartFc, nStartCp));
1359 sal_uInt64 nPctStart;
1364 nOldPos = nPctStart + 1;
1367 for (
auto const& it :
m_Pcts)
1375 nStartCp += m_Pcts.back()->GetStartCp();
1379 for (
auto const& it : m_Pcts)
1387 rWrt.
pFib->m_fcClx = nPctStart;
1389 rWrt.
pFib->m_lcbClx = nEndPos - nPctStart;
1393 nEndPos - nPctStart-5 );
1399 OSL_ENSURE( !
m_Pcts.empty(),
"SetParaBreak : m_Pcts.empty()" );
1400 m_Pcts.back()->SetStatus();
1406 OSL_ENSURE( !
m_Pcts.empty(),
"Fc2Cp no piece available" );
1410 return nFc +
m_Pcts.back()->GetStartCp();
1415 std::vector< const ::sw::mark::IMark* >
aArr;
1416 sal_uInt16 nContent;
1417 const sal_Int32 nCurrentEnd = nCurrentPos + nLen;
1422 for(const ::sw::mark::IMark*
p : aArr)
1424 const ::sw::mark::IMark& rBkmk = *
p;
1425 if(dynamic_cast< const ::sw::mark::IFieldmark *>(&rBkmk))
1428 const SwPosition* pPos = &rBkmk.GetMarkPos();
1430 if(rBkmk.IsExpanded())
1431 pOPos = &rBkmk.GetOtherMarkPos();
1436 pOPos = &rBkmk.GetMarkPos();
1441 nContent < nCurrentEnd ) )
1448 nContent < nCurrentEnd )
1463 const sal_Int32 nStart = pMark->GetMarkStart().nContent.GetIndex();
1464 if (nStart == nCurrentPos)
1476 if (!aStatements.empty())
1503 std::unique_ptr<SvxBrushItem> aBrush = std::make_unique<SvxBrushItem>(
RES_BACKGROUND);
1506 if (SfxItemState::SET == eState)
1509 if (aBrush->GetColor() !=
COL_AUTO)
1521 for (
size_t n = 0;
n < nCountRule; ++
n)
1525 for (sal_uInt16 nLvl = 0; nLvl < nLevels; ++nLvl)
1547 if (0 != aSize.Height() && 0 != aSize.Width())
1548 m_vecBulletPic.push_back(pGraf);
1561 const MapMode aMapMode(MapUnit::MapTwip);
1569 if (0 != aSize.Height() && 0 != aSize.Width())
1581 OUString aPicBullets(
"_PictureBullets");
1583 for (
int i = 0;
i < nCount;
i++)
1621 m_pChpPlc->AppendFkpEntry(
Strm().Tell(), static_cast< short >(pArr - aArr), aArr );
1648 rWW8Wrt.
pFib->m_lcbSttbfRMark);
1662 sal_Int32& rfcSttbf, sal_Int32& rlcbSttbf)
1664 sal_uInt16
n,
nCount =
static_cast< sal_uInt16
>(rStrings.size());
1671 rfcSttbf = rStrm.
Tell();
1674 for( n = 0; n < nCount; ++n )
1676 const OUString& rNm = rStrings[n];
1680 rlcbSttbf = rStrm.
Tell() - rfcSttbf;
1687 sal_uInt64 nOldPos = rStrm.
Tell();
1690 rStrm.
Seek( nOldPos );
1695 sal_uInt64 nOldPos = rStrm.
Tell();
1698 rStrm.
Seek( nOldPos );
1704 ShortToSVBT16( n, nL );
1705 rO.push_back(nL[0]);
1706 rO.push_back(nL[1]);
1712 UInt32ToSVBT32( n, nL );
1713 rO.push_back(nL[0]);
1714 rO.push_back(nL[1]);
1715 rO.push_back(nL[2]);
1716 rO.push_back(nL[3]);
1722 for (sal_Int32
n = 0, nLen = rStr.getLength();
n < nLen; ++
n, ++pStr)
1727 rtl_TextEncoding eCodeSet)
1730 const char *pStart = sTmp.getStr();
1731 const char *pEnd = pStart + sTmp.getLength();
1733 rO.insert( rO.end(), pStart, pEnd );
1745 if (!aBytes.empty())
1746 rStrm.
WriteBytes(aBytes.data(), aBytes.size());
1756 rStrm.
WriteBytes(aBytes.data(), aBytes.size());
1760 bool bAddZero, rtl_TextEncoding eCodeSet)
1765 aBytes.push_back(0);
1768 if (!aBytes.empty())
1769 rStrm.
WriteBytes(aBytes.data(), aBytes.size());
1774 if( !rText.isEmpty() )
1784 aArr.push_back( 1 );
1788 m_pPapPlc->AppendFkpEntry( nPos, aArr.size(), aArr.data() );
1829 sal_Int32
const nLen)
1832 SAL_INFO(
"sw.ww8.level2",
"<OutSwString>" );
1836 if( nStt || nLen != rStr.getLength() )
1838 OUString sOut( rStr.copy( nStt, nLen ) );
1852 SAL_INFO(
"sw.ww8.level2",
"</OutSwString>" );
1857 if (pTableTextNodeInfoInner && pTableTextNodeInfoInner->getDepth() == 1 && pTableTextNodeInfoInner->isEndOfCell())
1877 if ( nStt !=
m_pCurPam->GetMark()->nNode.GetIndex() &&
1892 aData.
pOOld =
nullptr;
1954 rData.
pOOld =
nullptr;
1966 OSL_ENSURE(
pO->empty(),
"pO is not empty in WW8Export::RestoreData()" );
1977 sal_uInt32 nDepth = pTableTextNodeInfoInner->getDepth();
1988 if ( nDepth > 1 && pTableTextNodeInfoInner->isEndOfCell() )
1997 sal_uInt32 nDepth = pTableTextNodeInfoInner->getDepth();
2003 if ( !pTableTextNodeInfoInner->isEndOfLine() )
2044 sal_uInt16 nFlags = 0;
2048 else if (nRowSpan < 0)
2051 if (pBox !=
nullptr)
2056 case text::VertOrientation::CENTER:
2059 case text::VertOrientation::BOTTOM:
2073 static_cast<const SwTextNode*
>(pCNd)->GetParaAttr(aCoreSet,
2074 0, static_cast<const SwTextNode*>(pCNd)->GetText().getLength());
2076 if ( SfxItemState::SET == aCoreSet.GetItemState(
RES_CHRATR_ROTATE,
true, &pRotItem))
2079 if(pRotate && pRotate->
GetValue() == 900_deg10)
2081 nFlags = nFlags | 0x0004 | 0x0008;
2083 else if(pRotate && pRotate->
GetValue() == 2700_deg10 )
2085 nFlags = nFlags | 0x0004 | 0x0010;
2097 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
2108 sal_uInt16 nTextFlow = 0;
2111 case SvxFrameDirection::Vertical_RL_TB:
2114 case SvxFrameDirection::Vertical_LR_BT:
2133 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
2153 const SwTable * pTable = pTableTextNodeInfoInner->getTable();
2173 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
2198 const SwTable * pTable = pTableTextNodeInfoInner->getTable();
2203 SAL_WARN(
"sw.ww8",
"FrameFormat is nil" );
2223 case text::HoriOrientation::CENTER:
2229 case text::HoriOrientation::RIGHT:
2238 case text::HoriOrientation::LEFT:
2245 case text::HoriOrientation::LEFT_AND_WIDTH:
2260 const SwTable * pTable = pTableTextNodeInfoInner->getTable();
2277 sal_uInt8 const nTPc = (nPadding << 4) | (nPcVert << 2) | nPcHorz;
2298 const SwTable * pTable = pTableTextNodeInfoInner->getTable();
2307 pTableTextNodeInfoInner->getTableBoxesOfRow();
2309 sal_uInt32 nBoxes = pTableBoxes->size();
2314 sal_uInt16 nSprmSize = 2 + (nBoxes + 1) * 2 + nBoxes * 20;
2331 SAL_WARN(
"sw.ww8",
"FrameFormat is nil" );
2351 case text::HoriOrientation::CENTER:
2352 case text::HoriOrientation::RIGHT:
2356 nTableOffset = rHori.
GetPos();
2358 nTableOffset += rLRSp.
GetLeft();
2363 SwTwips nLeftPageMargin, nRightPageMargin;
2366 nTableOffset = nPageSize - nLeftPageMargin - nRightPageMargin - nTableWidth - nTableOffset;
2375 for (
const auto nCol : *pGridCols )
2382 ww8::RowSpans::const_iterator aItRowSpans = pRowSpans->begin();
2384 for (
const SwTableBox * pTabBox1 : *pTableBoxes)
2389 if (pTabBox1 !=
nullptr)
2390 pBoxFormat = pTabBox1->GetFrameFormat();
2396 static sal_uInt8 aNullBytes[] = { 0x0, 0x0 };
2399 if (pBoxFormat !=
nullptr)
2414 if ( nWidthPercent > 0 && nWidthPercent <= 600 )
2424 return pTableTextNodeInfoInner->getGridColsOfRow(*
this);
2430 return pTableTextNodeInfoInner->getGridColsOfRow(*
this,
true);
2437 const SwNode *pTextNd = pTableTextNodeInfoInner->
getNode( );
2443 SAL_WARN(
"sw.ww8",
"FrameFormat is nil" );
2451 nWidthPercent = 100;
2452 bool bRelBoxSize = nWidthPercent != 0;
2454 if (nTableSz >
USHRT_MAX/2 && !bRelBoxSize)
2456 OSL_ENSURE(bRelBoxSize,
"huge table width but not relative, suspicious");
2464 if ( aRect.IsEmpty() )
2472 nPageSize = aRect.
Width();
2473 if ( 0 == nPageSize )
2482 nPageSize = aRect.Width();
2483 if ( bManualAligned )
2492 if ( nWidthPercent )
2494 nPageSize *= nWidthPercent;
2498 SAL_WARN(
"sw.ww8",
"nWidthPercent is zero" );
2503 nPageSize = nTableSz;
2506 rPageSize = nPageSize;
2507 rRelBoxSize = bRelBoxSize;
2515 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
2520 SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT,
2521 SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
2525 for (
int i = 0;
i < 4; ++
i )
2542 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
2545 sal_uInt8 nBoxes = std::min<size_t>(rTabBoxes.size(), 255);
2551 SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT,
2552 SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
2555 sal_uInt16 nDefaultMargin[4] = {31681, 31681, 31681, 31681};
2557 if ( nBoxes && rTabBoxes.size() == nBoxes )
2559 const SvxBoxItem& rBox = rTabBoxes[ nBoxes-1 ]->GetFrameFormat()->GetBox();
2560 for (
int i = 0;
i < 4; ++
i )
2566 for (
unsigned n = 0;
n <= nBoxes; ++
n )
2568 const SvxBoxItem * pBox = (
n == nBoxes) ?
nullptr :
2569 &rTabBoxes[
n]->GetFrameFormat()->GetBox();
2572 else if( !pBox || *pLastBox != *pBox )
2584 sal_uInt16 nMargin[4];
2586 for (
int i = 0;
i < 4; ++
i )
2588 nMargin[
i] = std::min(sal_uInt16(31680), pLastBox->GetDistance( aBorders[
i] ));
2589 if ( nMargin[i] == nDefaultMargin[i] )
2593 for (
int p = 0;
p < 4; ++
p )
2595 if ( nMargin[i] == nMargin[
p] )
2597 nSideBits[p] |= 1 << i;
2604 for (
int i = 0;
i < 4; ++
i )
2626 const SwTable * pTab = pTableTextNodeInfoInner->getTable();
2627 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
2633 m_rWW8Export.
pO->push_back( static_cast<sal_uInt8>(nBoxes * 2) );
2637 if ( pTableColorProp )
2638 aRowColor = pTableColorProp->
GetColor();
2642 aRowColor = pRowColorProp->
GetColor();
2648 Color aColor = aRowColor;
2652 aColor = pCellColorProp->
GetColor();
2671 for (sal_uInt32
m : aSprmIds)
2695 if ( nStart >= nStop )
2699 m_rWW8Export.
pO->push_back( static_cast<sal_uInt8>((nStop-nStart) * 10) );
2705 Color aColor = aRowColor;
2709 aColor = pCellColorProp->
GetColor();
2732 class TrackContentToExport
2739 : m_pCurPam(pCurPam)
2740 , m_nStart(nCurStart)
2750 if (bSimpleContentRemains)
2764 if (pNextNode && pCurrentNode != pNextNode)
2766 return pNextNode->
GetIndex() >= m_nStart &&
2779 while (aContentTracking.contentRemainsToExport(
m_pTableInfo.get()))
2828 bool bNeedExportBreakHere =
true;
2830 bNeedExportBreakHere =
false;
2838 && pTempItem &&
static_cast<const SwFormatPageDesc*
>(pTempItem)->GetRegisteredIn())
2841 bNeedExportBreakHere =
false;
2855 if (nColumnCount > 1 && rNoBalanced.
GetValue())
2857 bNeedExportBreakHere =
false;
2862 bNeedExportBreakHere =
false;
2865 if (bNeedExportBreakHere)
2870 if ( !pParentFormat )
2875 nRstLnNum = static_cast<SwContentNode&>(aIdx.
GetNode()).GetSwAttrSet().
2876 GetLineNumber().GetStartValue();
2903 if (pCurrentNode == pNextNode)
2905 SAL_WARN(
"sw.ww8",
"loop in TableInfo");
2906 pNextNode =
nullptr;
2909 if (pNextNode !=
nullptr)
2918 SAL_INFO(
"sw.ww8.level2",
"</WriteText>" );
2923 SAL_INFO(
"sw.ww8.level2",
"<WriteMainText>" );
2931 if( 0 ==
Strm().Tell() -
pFib->m_fcMin )
2946 SAL_INFO(
"sw.ww8.level2",
"</WriteMainText>" );
2951 bool bResult =
false;
2953 if (m_pCurPam !=
nullptr)
2961 if (pTableNodeInfo && pTableNodeInfo->getDepth() > 0)
2986 pEdn->WritePlc( *
this );
2991 pSepx->WritePlcSed( *
this );
2992 pSepx->WritePlcHdd( *
this );
3056 WW8SttbAssoc * pSttbfAssoc =
dynamic_cast<WW8SttbAssoc *
>
3061 std::vector<OUString> aStrings(pSttbfAssoc->
getStrings());
3063 pFib->m_lcbSttbfAssoc);
3074 pFib->m_fReadOnlyRecommended =
3076 pFib->m_fWriteReservation =
3085 bool bNeedsFinalPara =
false;
3093 bNeedsFinalPara |=
pFootnote->WriteText( *
this );
3094 bNeedsFinalPara |=
pSepx->WriteKFText( *
this );
3096 bNeedsFinalPara |=
pEdn->WriteText( *
this );
3104 if (bNeedsFinalPara)
3107 m_pPapPlc->AppendFkpEntry(
Strm().Tell(), nSprmsLen, pLastSprms);
3109 delete[] pLastSprms;
3121 if( rURL.isEmpty() || rURL[0] !=
'#' )
3130 OUString sCmp = aURL.copy(nPos+1).replaceAll(
" ",
"");
3131 if( sCmp.isEmpty() )
3134 sCmp = sCmp.toAsciiLowerCase();
3136 bool noBookmark =
false;
3138 if( sCmp ==
"outline" )
3147 nIdx = aPos.nNode.GetIndex();
3151 else if( sCmp ==
"graphic" )
3162 else if( sCmp ==
"frame" )
3173 else if( sCmp ==
"ole" )
3184 else if( sCmp ==
"region" )
3190 if (aName == pFormat->GetSection()->GetSectionName()
3191 &&
nullptr != (pIdx =
const_cast<SwNodeIndex*
>(pFormat->GetContent().GetContentIdx())))
3199 else if( sCmp ==
"table" )
3216 aImplicitBookmark.first = aURL;
3217 aImplicitBookmark.second = nIdx;
3246 auto pURL =
dynamic_cast<const SwFormatURL*
>(pItem);
3251 const ImageMap *pIMap = pURL->GetMap();
3255 for (
size_t i=0;
i < pIMap->GetIMapObjectCount(); ++
i)
3275 for (std::size_t nI = 0, nBlock = 0; nI < nLen; nI +=
WW_BLOCKSIZE, ++nBlock)
3277 std::size_t nBS = std::min(nLen - nI, WW_BLOCKSIZE);
3282 rCtx.
Encode(in, nBS, in, nBS);
3315 sal_uInt32 nSvxMSDffOLEConvFlags = 0;
3368 m_pOrigPam->DeleteMark();
3379 uno::Sequence< beans::NamedValue > aEncryptionData;
3384 if ( pEncryptionDataItem && ( pEncryptionDataItem->
GetValue() >>= aEncryptionData ) && !rCodec.
InitCodec( aEncryptionData ) )
3386 OSL_ENSURE(
false,
"Unexpected EncryptionData!" );
3387 aEncryptionData.realloc( 0 );
3390 if ( !aEncryptionData.hasElements() )
3394 if ( pPasswordItem && !pPasswordItem->
GetValue().isEmpty() && pPasswordItem->
GetValue().getLength() <= 15 )
3399 rtl_random_getBytes( aRandomPool, pDocId, 16 );
3401 rtl_random_destroyPool( aRandomPool );
3403 sal_uInt16 aPassword[16] = {};
3405 const OUString& sPassword(pPasswordItem->
GetValue());
3406 for ( sal_Int32 nChar = 0; nChar < sPassword.getLength(); ++nChar )
3407 aPassword[nChar] = sPassword[nChar];
3409 rCodec.
InitKey( aPassword, pDocId );
3416 if ( aEncryptionData.hasElements() )
3421 return aEncryptionData.hasElements();
3432 xWwStrm->SetBufferSize( 32768 );
3434 pFib->m_fWhichTableStm =
true;
3438 xDataStrm->SetBufferSize( 32768 );
3439 xTableStrm->SetBufferSize( 16384 );
3441 xTableStrm->SetEndian( SvStreamEndian::LITTLE );
3442 xDataStrm->SetEndian( SvStreamEndian::LITTLE );
3462 aTempMain.
GetStream( StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE ) );
3466 pDataStrm = aTempData.
GetStream( StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE );
3468 sal_uInt8 const aRC4EncryptionHeader[ 52 ] = {0};
3508 pDop->fRMView = pLayout ==
nullptr || !pLayout->IsHideRedlines();
3515 if (pStdTextFormatColl && SfxItemState::SET == pStdTextFormatColl->
GetItemState(
3526 SvStream *pStrmTemp, *pTableStrmTemp, *pDataStrmTemp;
3527 pStrmTemp = xWwStrm.
get();
3528 pTableStrmTemp = xTableStrm.get();
3529 pDataStrmTemp = xDataStrm.
get();
3531 if ( pDataStrmTemp && pDataStrmTemp != pStrmTemp) {
3532 err = EncryptRC4(aCtx, *
pDataStrm, *pDataStrmTemp);
3538 err = EncryptRC4(aCtx, *
pTableStrm, *pTableStrmTemp);
3545 pTableStrmTemp->
Seek( 0 );
3565 pFib->m_fEncrypted =
true;
3566 pFib->m_fObfuscated =
false;
3567 pFib->m_nHash = 0x34;
3570 pStrmTemp->
Seek( 0 );
3571 pFib->WriteHeader( *pStrmTemp );
3604 xWwStrm->SetBufferSize( 0 );
3605 xTableStrm->SetBufferSize( 0 );
3606 xDataStrm->SetBufferSize( 0 );
3621 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
3622 0xFF, 0xFF, 0xFF, 0xFF, 0x06, 0x09, 0x02, 0x00,
3623 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00,
3624 0x00, 0x00, 0x00, 0x46,
3626 0x18, 0x00, 0x00, 0x00,
3627 'M',
'i',
'c',
'r',
'o',
's',
'o',
'f',
3628 't',
' ',
'W',
'o',
'r',
'd',
'-',
'D',
3629 'o',
'k',
'u',
'm',
'e',
'n',
't', 0x0,
3631 0x0A, 0x00, 0x00, 0x00,
3632 'M',
'S',
'W',
'o',
'r',
'd',
'D',
'o',
3635 0x10, 0x00, 0x00, 0x00,
3636 'W',
'o',
'r',
'd',
'.',
'D',
'o',
'c',
3637 'u',
'm',
'e',
'n',
't',
'.',
'8', 0x0,
3639 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
3640 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
3645 aGName, SotClipboardFormatId::NONE,
"Microsoft Word-Document");
3647 xStor->WriteBytes(pData,
sizeof(pData));
3650 OSL_ENSURE(pDocShell,
"no SwDocShell");
3652 if (!pDocShell)
return;
3654 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
3655 pDocShell->
GetModel(), uno::UNO_QUERY_THROW);
3656 uno::Reference<document::XDocumentProperties> xDocProps(
3657 xDPS->getDocumentProperties());
3658 OSL_ENSURE(xDocProps.is(),
"DocumentProperties is null");
3660 if (!xDocProps.is())
3665 std::shared_ptr<GDIMetaFile> xMetaFile =
3667 uno::Sequence<sal_Int8> metaFile(
3678 uno::Reference< packages::XPackageEncryption > xPackageEncryption;
3679 std::shared_ptr<SvStream> pSotStorageStream;
3680 uno::Sequence< beans::NamedValue > aEncryptionData;
3685 if (pEncryptionDataItem && (pEncryptionDataItem->
GetValue() >>= aEncryptionData))
3690 if (sCryptoType.getLength())
3694 uno::makeAny(beans::NamedValue(
"Binary", uno::makeAny(
true))) };
3695 xPackageEncryption.set(
3696 xComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext(
3697 "com.sun.star.comp.oox.crypto." + sCryptoType,
aArguments, xComponentContext), uno::UNO_QUERY);
3699 if (xPackageEncryption.is())
3704 pSotStorageStream = std::make_shared<SvMemoryStream>();
3713 if (xPackageEncryption.is())
3716 pSotStorageStream->Seek(0);
3719 xPackageEncryption->setupEncryption(aEncryptionData);
3722 uno::Sequence<beans::NamedValue> aStreams = xPackageEncryption->encrypt(xInputStream);
3725 for (
const beans::NamedValue & aStreamData : std::as_const(aStreams))
3732 while (pStorage && idx >= 0)
3734 OUString sPathElem = aStreamData.Name.getToken(0, L
'/', idx);
3735 if (!sPathElem.isEmpty())
3739 sFileName = sPathElem;
3762 uno::Sequence<sal_Int8> aStreamContent;
3763 aStreamData.Value >>= aStreamContent;
3764 size_t nBytesWritten = pStream->WriteBytes(aStreamContent.getArray(), aStreamContent.getLength());
3765 if (nBytesWritten != static_cast<size_t>(aStreamContent.getLength()))
3779 if( pViewShell !=
nullptr )
3813 const OUString* pFileName )
3825 , m_pTopNodeOfHdFtPage(nullptr)
3827 , m_pRedlAuthors(nullptr)
3829 , m_nCharFormatStart(0)
3830 , m_nFormatCollStart(0)
3831 , m_nStyleBeforeFly(0)
3832 , m_nLastFormatId(0)
3836 , m_bOrigShowChanges(true)
3837 , m_pCurrentPageDesc(nullptr)
3838 , m_bFirstTOCNodeWithSection(false)
3839 , m_pChpIter(nullptr)
3841 , m_pTextBxs(nullptr)
3842 , m_pHFTextBxs(nullptr)
3843 , m_pParentFrame(nullptr)
3844 , m_pFlyOffset(nullptr)
3846 , m_pStyAttr(nullptr)
3847 , m_pOutFormatNode(nullptr)
3848 , m_pCurrentStyle(nullptr)
3849 , m_pSdrObjs(nullptr)
3850 , m_pHFSdrObjs(nullptr)
3851 , m_pEscher(nullptr)
3854 , m_bBreakBefore(false)
3856 , m_bOutFlyFrameAttrs(false)
3857 , m_bOutPageDescs(false)
3858 , m_bOutFirstPage(false)
3859 , m_bOutTable(false)
3861 , m_bInWriteEscher(false)
3862 , m_bStartTOX(false)
3863 , m_bInWriteTOX(false)
3864 , m_bFootnoteAtTextEnd(false)
3865 , m_bEndAtTextEnd(false)
3868 , m_bSubstituteBullets(true)
3869 , m_bTabInTOC(false)
3870 , m_bHideTabLeaderAndPageNumbers(false)
3871 , m_bExportModeRTF(false)
3872 , m_bFontSizeWritten(false)
3873 , m_bAddFootnoteTab(false)
3875 , m_nCurStart(pCurrentPam->GetPoint()->nNode.GetIndex())
3876 , m_nCurEnd(pCurrentPam->GetMark()->nNode.GetIndex())
3877 , m_pCurPam(pCurrentPam)
3878 , m_pOrigPam(pOriginalPam)
3897 SwDoc& rDocument, std::shared_ptr<SwUnoCursor> & pCurrentPam,
SwPaM* pOriginalPam,
3900 , pTableStrm(nullptr)
3901 , pDataStrm(nullptr)
3903 , m_pWriter(pWriter)
3924 m_pExport( nullptr ),
3942 extern "C" SAL_DLLPUBLIC_EXPORT
void ExportDOC(
const OUString& rFltName,
const OUString& rBaseURL,
WriterRef& xRet )
3959 rWrt.
pFib->m_ccpText );
3965 rWrt.
pFib->m_ccpText + rWrt.
pFib->m_ccpFootnote
3966 + rWrt.
pFib->m_ccpHdr + rWrt.
pFib->m_ccpAtn );
3976 rWrt.
pFib->m_lcbPlcffndText, rWrt.
pFib->m_fcPlcffndRef,
3977 rWrt.
pFib->m_lcbPlcffndRef );
3982 rWrt.
pFib->m_lcbPlcfendText, rWrt.
pFib->m_fcPlcfendRef,
3983 rWrt.
pFib->m_lcbPlcfendRef );
3991 rWrt.
pFib->m_ccpText + rWrt.
pFib->m_ccpFootnote
3992 + rWrt.
pFib->m_ccpHdr );
3999 rWrt.
pFib->m_lcbPlcfandText, rWrt.
pFib->m_fcPlcfandRef,
4000 rWrt.
pFib->m_lcbPlcfandRef );
4008 rWrt.
pFib->m_lcbPlcftxbxBkd, rWrt.
pFib->m_fcPlcftxbxText,
4009 rWrt.
pFib->m_lcbPlcftxbxText );
4014 rWrt.
pFib->m_lcbPlcfHdrtxbxBkd, rWrt.
pFib->m_fcPlcfHdrtxbxText,
4015 rWrt.
pFib->m_lcbPlcfHdrtxbxText );
4026 uno::Reference < io::XStream > xSrcStream =
4027 xSrcRoot->openStreamElement(
SL::aMSMacroCmds, embed::ElementModes::READ );
4032 pFib->m_lcbCmds = pStream->TellEnd();
4035 std::unique_ptr<sal_uInt8[]> pBuffer(
new sal_uInt8[
pFib->m_lcbCmds] );
4036 bool bReadOk =
checkRead(*pStream, pBuffer.get(),
pFib->m_lcbCmds);
4041 catch (
const uno::Exception& )
4058 const ::sw::mark::IFieldmark* pFieldmark = &rFieldmark;
4065 SAL_WARN(
"sw.ww8",
"unknown field type" );
4075 ::sw::mark::IFieldmark::parameter_map_t::const_iterator pParameter = rFieldmark.GetParameters()->find(
"name");
4077 if ( pParameter != rFieldmark.GetParameters()->end() )
4080 pParameter->second >>= aName;
4081 const sal_Int32 nLen = std::min( sal_Int32(20), aName.getLength() );
4082 ffname = aName.copy(0, nLen);
4091 0x03, 0x6a, 0,0,0,0,
4100 m_pChpPlc->AppendFkpEntry(
Strm().Tell(),
sizeof( aArr1 ), aArr1 );
4108 FFDataHeader() : version( 0xFFFFFFFF ), bits(0), cch(0), hps(0) {}
4111 FFDataHeader aFieldHeader;
4112 aFieldHeader.bits |= (type & 0x03);
4114 sal_Int32 ffres = 0;
4115 if ( pAsCheckbox && pAsCheckbox->IsChecked() )
4117 else if ( type == 2 )
4119 ::sw::mark::IFieldmark::parameter_map_t::const_iterator pResParameter = rFieldmark.GetParameters()->find(
ODF_FORMDROPDOWN_RESULT);
4120 if(pResParameter != rFieldmark.GetParameters()->end())
4121 pResParameter->second >>= ffres;
4125 aFieldHeader.bits |= ( (ffres<<2) & 0x7C );
4129 OUString ffhelptext = rFieldmark.GetFieldHelptext();
4130 if ( ffhelptext.getLength() > 255 )
4131 ffhelptext = ffhelptext.copy(0, 255);
4132 OUString ffstattext;
4133 OUString ffentrymcr;
4137 sal_uInt16
nType = 0;
4138 pParameter = rFieldmark.GetParameters()->find(
"Type");
4139 if ( pParameter != rFieldmark.GetParameters()->end() )
4142 pParameter->second >>= aType;
4143 if ( aType ==
"number" ) nType = 1;
4144 else if ( aType ==
"date" ) nType = 2;
4145 else if ( aType ==
"currentTime" ) nType = 3;
4146 else if ( aType ==
"currentDate" ) nType = 4;
4147 else if ( aType ==
"calculated" ) nType = 5;
4148 aFieldHeader.bits |= nType<<11;
4151 if ( nType < 3 || nType == 5 )
4153 pParameter = rFieldmark.GetParameters()->find(
"Content");
4154 if ( pParameter != rFieldmark.GetParameters()->end() )
4156 OUString aDefaultText;
4157 pParameter->second >>= aDefaultText;
4158 const sal_Int32 nLen = std::min( sal_Int32(255), aDefaultText.getLength() );
4159 ffdeftext = aDefaultText.copy (0, nLen);
4163 pParameter = rFieldmark.GetParameters()->find(
"MaxLength");
4164 if ( pParameter != rFieldmark.GetParameters()->end() )
4167 pParameter->second >>= nLength;
4168 nLength = std::min( sal_uInt16(32767), nLength );
4169 aFieldHeader.cch = nLength;
4172 pParameter = rFieldmark.GetParameters()->find(
"Format");
4173 if ( pParameter != rFieldmark.GetParameters()->end() )
4176 pParameter->second >>= aFormat;
4177 const sal_Int32 nLen = std::min( sal_Int32(64), aFormat.getLength() );
4178 ffformat = aFormat.copy(0, nLen);
4182 pParameter = rFieldmark.GetParameters()->find(
"Help");
4183 if ( ffhelptext.isEmpty() && pParameter != rFieldmark.GetParameters()->end() )
4186 pParameter->second >>= aHelpText;
4187 const sal_Int32 nLen = std::min( sal_Int32(255), aHelpText.getLength() );
4188 ffhelptext = aHelpText.copy (0, nLen);
4190 if ( !ffhelptext.isEmpty() )
4191 aFieldHeader.bits |= 0x1<<7;
4193 pParameter = rFieldmark.GetParameters()->find(
"Description");
4194 if ( pParameter == rFieldmark.GetParameters()->end() )
4195 pParameter = rFieldmark.GetParameters()->find(
"Hint");
4196 if ( pParameter != rFieldmark.GetParameters()->end() )
4198 OUString aStatusText;
4199 pParameter->second >>= aStatusText;
4200 const sal_Int32 nLen = std::min( sal_Int32(138), aStatusText.getLength() );
4201 ffstattext = aStatusText.copy (0, nLen);
4203 if ( !ffstattext.isEmpty() )
4204 aFieldHeader.bits |= 0x1<<8;
4206 pParameter = rFieldmark.GetParameters()->find(
"EntryMacro");
4207 if ( pParameter != rFieldmark.GetParameters()->end() )
4209 OUString aEntryMacro;
4210 pParameter->second >>= aEntryMacro;
4211 const sal_Int32 nLen = std::min( sal_Int32(32), aEntryMacro.getLength() );
4212 ffentrymcr = aEntryMacro.copy (0, nLen);
4215 pParameter = rFieldmark.GetParameters()->find(
"ExitMacro");
4216 if ( pParameter != rFieldmark.GetParameters()->end() )
4218 OUString aExitMacro;
4219 pParameter->second >>= aExitMacro;
4220 const sal_Int32 nLen = std::min( sal_Int32(32), aExitMacro.getLength() );
4221 ffexitmcr = aExitMacro.copy (0, nLen);
4224 std::vector< OUString > aListItems;
4227 aFieldHeader.bits |= 0x8000;
4228 const ::sw::mark::IFieldmark::parameter_map_t*
const pParameters = rFieldmark.GetParameters();
4230 if(pListEntries != pParameters->end())
4232 uno::Sequence< OUString > vListEntries;
4233 pListEntries->second >>= vListEntries;
4234 copy(vListEntries.begin(), vListEntries.end(), back_inserter(aListItems));
4241 0,0,0,0,0,0,0,0,0,0,
4242 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
4243 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
4244 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
4247 sal_uInt32 slen =
sizeof(sal_uInt32)
4248 +
sizeof(aFieldData)
4249 +
sizeof( aFieldHeader.version ) +
sizeof( aFieldHeader.bits ) +
sizeof( aFieldHeader.cch ) +
sizeof( aFieldHeader.hps )
4250 + 2*ffname.getLength() + 4
4251 + 2*ffformat.getLength() + 4
4252 + 2*ffhelptext.getLength() + 4
4253 + 2*ffstattext.getLength() + 4
4254 + 2*ffentrymcr.getLength() + 4
4255 + 2*ffexitmcr.getLength() + 4;
4259 slen += 2*ffdeftext.getLength() + 4;
4263 const int items = aListItems.size();
4264 for(
int i = 0;
i < items;
i++ ) {
4265 OUString item = aListItems[
i];
4266 slen += 2 * item.getLength() + 2;
4272 int len =
sizeof( aFieldData );
4273 OSL_ENSURE( len == 0x44-
sizeof(sal_uInt32),
"SwWW8Writer::WriteFormData(..) - wrong aFieldData length" );
4292 const int items=aListItems.size();
4294 for(
int i=0;
i<items;
i++) {
4295 OUString item=aListItems[
i];
4312 SAL_INFO(
"sw.ww8",
"<OutWW8_TableNodeInfoInner>" << pNodeInfoInner->toString());
4317 sal_uInt32 nShadowsBefore = pNodeInfoInner->getShadowsBefore();
4318 if (nShadowsBefore > 0)
4321 pTmpNodeInfoInner = std::make_shared<ww8::WW8TableNodeInfoInner>(
nullptr);
4323 pTmpNodeInfoInner->setDepth(pNodeInfoInner->getDepth());
4324 pTmpNodeInfoInner->setEndOfCell(
true);
4326 for (sal_uInt32
n = 0;
n < nShadowsBefore; ++
n)
4339 if (pNodeInfoInner->isEndOfCell())
4341 SAL_INFO(
"sw.ww8",
"<endOfCell/>" );
4352 sal_uInt32 nShadowsAfter = pNodeInfoInner->getShadowsAfter();
4353 if (nShadowsAfter > 0)
4356 pTmpNodeInfoInner= std::make_shared<ww8::WW8TableNodeInfoInner>(
nullptr);
4358 pTmpNodeInfoInner->setDepth(pNodeInfoInner->getDepth());
4359 pTmpNodeInfoInner->setEndOfCell(
true);
4361 for (sal_uInt32
n = 0;
n < nShadowsAfter; ++
n)
4373 if (pNodeInfoInner->isEndOfLine())
4375 SAL_INFO(
"sw.ww8",
"<endOfLine/>" );
4379 ShortToSVBT16(0, nStyle);
4386 SAL_INFO(
"sw.ww8",
"</OutWW8_TableNodeInfoInner>" );
4398 SAL_INFO(
"sw.ww8", pNodeInfo->toString());
4401 ww8::WW8TableNodeInfo::Inners_t::const_reverse_iterator aIt(aInners.rbegin());
4402 ww8::WW8TableNodeInfo::Inners_t::const_reverse_iterator aEnd(aInners.rend());
4411 SAL_INFO(
"sw.ww8",
"</OutWW8_SwStartNode>" );
4425 SAL_INFO(
"sw.ww8", pNodeInfo->toString());
4428 for (
const auto& rEntry : aInners)
4434 SAL_INFO(
"sw.ww8",
"</OutWW8_SwEndNode>" );
4441 m_pKeyMap = std::make_shared<NfKeywordTable>();
std::shared_ptr< NfKeywordTable > m_pKeyMap
bool WriteGenericText(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_CP &rCount)
bool IsHyphen(sal_Unicode cChar)
SvxNumType GetNumberingType() const
Starts a section of nodes in the document model.
RedlineFlags m_nOrigRedlineFlags
Remember the original redline mode.
tools::Long GetWidth() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
static void InsUInt32(ww::bytes &rO, sal_uInt32 n)
bool InitCodec(const css::uno::Sequence< css::beans::NamedValue > &aData)
Exporter of the binary Word file formats.
ErrCode WriteStorageImpl()
MSWordExportBase(SwDoc &rDocument, std::shared_ptr< SwUnoCursor > &pCurrentPam, SwPaM *pOriginalPam)
virtual AttributeOutputBase & AttrOutput() const =0
Access to the attribute output class.
virtual void SectionBreaksAndFrames(const SwTextNode &rNode)=0
sal_uLong GetIndex() const
sal_uInt32 m_nValue
Index into MSOPropertyBagStore::m_aStringTable.
bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength)
IDocumentStatistics const & getIDocumentStatistics() const
SwNode & GetNode(bool bPoint=true) const
const sw::BroadcastingModify * m_pOutFormatNode
virtual void TableInfoRow(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo) override
Class to collect and output the sections/headers/footers.
std::unique_ptr< ww::bytes > pO
Buffer.
virtual sal_uInt32 Getn32DummyCompatibilityOptions2() const =0
Get the n32DummyCompatibilityOptions2.
std::unique_ptr< SvxMSExportOLEObjects > m_pOLEExp
virtual bool InitCipher(sal_uInt32 nCounter) override
Represents the style of a paragraph.
sal_uInt16 AddRedlineAuthor(std::size_t nId)
virtual ~SwWW8Writer() override
Marks a position in the document model.
void OutSwString(const OUString &, sal_Int32 nStt, sal_Int32 nLen)
void AddRangeStartPosition(const OUString &rName, WW8_CP nStartCp, bool bIgnoreEmpty)
void MoveFieldMarks(WW8_CP nFrom, WW8_CP nTo)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
std::unique_ptr< WW8_WrPlcField > m_pFieldHFTextBxs
bool IsSectionNode() const
std::unique_ptr< WW8Fib > pFib
File Information Block.
virtual AttributeOutputBase & AttrOutput() const override
memory leak #i120098#, to hold the reference to unnamed SotStorage obj
const SfxPoolItem & GetItem(sal_uInt16 nWhich) const
std::pair< bool, OUString > BKMK
virtual void TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo) override
std::unique_ptr< WW8_WrPlcField > m_pFieldHdFt
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
sal_uInt16 GetLower() const
SvStream & WriteUInt16(sal_uInt16 nUInt16)
#define DEFAULT_STYLES_COUNT
FKP - Formatted disK Page.
void WriteStringAsPara(const OUString &rText)
const ww8::Frame * pOldFlyFormat
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
IDocumentExternalData const & getIDocumentExternalData() const
RndStdIds m_eNewAnchorType
virtual const SwRootFrame * GetCurrentLayout() const =0
SvStream & WriteInt32(sal_Int32 nInt32)
sal_uInt16 GetId(const SwTextFormatColl &rColl) const
Return the numeric id of the style.
bool m_bFootnoteAtTextEnd
SwDocShell * GetDocShell()
virtual void InitKey(const sal_uInt16 pPassData[16], const sal_uInt8 pDocId[16]) override
virtual void CalcLayout()
std::unique_ptr< ContentProperties > pData
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual void OutputEndNode(const SwEndNode &)
Output SwEndNode.
#define OLE_STARIMPRESS_2_POWERPOINT
virtual void AppendBookmarks(const SwTextNode &rNd, sal_Int32 nCurrentPos, sal_Int32 nLen) override
static void WriteString_xstz(SvStream &rStrm, const OUString &rStr, bool bAddZero)
std::vector< const SwTOXType * > m_aTOXArr
virtual void TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo) override
sal_uInt8 * CopyLastSprms(sal_uInt8 &rLen)
ww8::WW8Sttb< ww8::WW8Struct > WW8SttbAssoc
SAL_DLLPUBLIC_EXPORT sal_uInt32 SaveOrDelMSVBAStorage_ww8(SfxObjectShell &rDoc, SotStorage &rStor, sal_Bool bSaveInto, const OUString &rStorageName)
BitmapChecksum GetChecksum() const
virtual sal_uInt64 TellEnd()
std::vector< sal_uInt8 > bytes
std::multimap< tools::Long, BKMKCP * > BKMKCPs
std::unique_ptr< WW8_WrPlcField > m_pFieldMain
[MS-DOC] SmartTagData: stores information about all smart tags in the document.
void WriteAsStringTable(const std::vector< OUString > &, sal_Int32 &rfcSttbf, sal_Int32 &rlcbSttbf)
tools::Long GetRight() const
virtual void SaveData(sal_uLong nStt, sal_uLong nEnd)
Remember some of the members so that we can recurse in WriteText().
virtual ErrCode ExportDocument_Impl()=0
Format-dependent part of the actual export.
WW8_FC GetStartFc() const
void WriteFontTable(SvStream *pTableStream, WW8Fib &pFib)
const SwPosition * GetMark() const
const SwAttrSet * m_pStyAttr
const SwPageDesc * FindPageDesc(size_t *pPgDescNdIdx=nullptr) const
Search PageDesc with which this node is formatted.
virtual const css::i18n::ForbiddenCharacters * getForbiddenCharacters(LanguageType nLang, bool bLocaleData) const =0
Return the forbidden characters.
#define OLE_STARCALC_2_EXCEL
bool bOldWriteAll
WW8Export only.
bool m_bOutPageDescs
PageDescs (section properties) are being written.
virtual void TableBidi(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo) override
WW8_CP GetStartCp() const
std::vector< MSOFactoidType > m_aFactoidTypes
#define STREAM_SEEK_TO_END
virtual void TableCellRedline(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo) override
sal_uInt16 GetDistance(SvxBoxItemLine nLine) const
const ContentProperties & rData
sal_Int32 cLinesFootnoteEdn
sal_uInt64 Seek(sal_uInt64 nPos)
sal_uInt16 AddName(const OUString &rNm)
sal_uInt16 m_nCharFormatStart
constexpr OUStringLiteral aMSMacroCmds
SwTableLine is one table row in the document model.
virtual void WriteNumbering() override
Output the numbering table.
std::shared_ptr< SwUnoCursor > pOldPam
static void WriteString8(SvStream &rStrm, std::u16string_view rStr, bool bAddZero, rtl_TextEncoding eCodeSet)
void EndProgress(SwDocShell const *pDocShell)
sal_uInt16 GetRowsToRepeat() const
Structure that is used to save some of the WW8Export/DocxExport data.
SwSectionFormat * GetFormat()
sal_uInt16 m_nStyleBeforeFly
style number of the node
void ExportDopTypography(WW8DopTypography &rTypo)
bool IsImpress2PowerPoint() const
WW8_CP Fc2Cp(sal_uLong nFc) const
css::uno::Reference< css::frame::XModel > GetModel() const
Of course Writer needs its own rectangles.
std::unique_ptr< WW8_WrPlcField > m_pFieldTextBxs
void Set_UInt32(sal_uInt8 *&p, sal_uInt32 n)
std::shared_ptr< T > make_shared(Args &&...args)
static constexpr sal_uInt16 val
static sal_uLong FillUntil(SvStream &rStrm, sal_uLong nEndPos=0)
bool IsMath2MathType() const
std::vector< OUString > maAuthors
Value const & at(size_type nPos) const
virtual void AppendSmartTags(SwTextNode &rTextNode) override
void Write(WW8Export &rExport)
std::unique_ptr< SwMSConvertControls > m_pOCXExp
The root element of a Writer document layout.
void WritePc(WW8Export &rWrt)
std::unique_ptr< WW8_WrPlcField > m_pFieldEdn
WW8_CP Fc2Cp(sal_uLong nFc) const
SwTableFormat * GetFrameFormat()
#define ODF_FORMDROPDOWN_RESULT
std::shared_ptr< Widths > WidthsPtr
std::unique_ptr< WW8_WrPlcField > m_pFieldAtn
Value in Var-direction gives minimum (can be exceeded but not be less).
virtual void TableCanSplit(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo) override