20#include <config_wasm_strip.h>
28#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
29#include <com/sun/star/document/XDocumentProperties.hpp>
30#include <com/sun/star/document/XStorageBasedDocument.hpp>
31#include <com/sun/star/drawing/XShape.hpp>
32#include <com/sun/star/i18n/ScriptType.hpp>
33#include <com/sun/star/frame/XModel.hpp>
34#include <com/sun/star/xml/dom/XDocument.hpp>
35#include <com/sun/star/xml/sax/XSAXSerializable.hpp>
36#include <com/sun/star/xml/sax/Writer.hpp>
37#include <com/sun/star/awt/XControlModel.hpp>
38#include <com/sun/star/io/XSeekable.hpp>
39#include <com/sun/star/io/XStreamListener.hpp>
40#include <com/sun/star/sdb/CommandType.hpp>
41#include <com/sun/star/text/XTextFieldsSupplier.hpp>
42#include <com/sun/star/util/XModifiable.hpp>
43#include <com/sun/star/xml/xslt/XSLTTransformer.hpp>
45#include <oox/token/namespaces.hxx>
46#include <oox/token/tokens.hxx>
61#include <condition_variable>
93#include <oox/token/properties.hxx>
105using namespace ::
oox;
129 if ( nScript == i18n::ScriptType::ASIAN )
143 else if ( nScript != i18n::ScriptType::COMPLEX )
162 std::vector< OUString > aStarts;
163 std::vector< OUString > aEnds;
166 if (
GetBookmarks( rNode, nCurrentPos, nCurrentPos + nLen, aMarks ) )
168 for (
IMark* pMark : aMarks )
170 const sal_Int32 nStart = pMark->GetMarkStart().GetContentIndex();
171 const sal_Int32 nEnd = pMark->GetMarkEnd().GetContentIndex();
173 if ( nStart == nCurrentPos )
174 aStarts.push_back( pMark->GetName() );
176 if ( nEnd == nCurrentPos )
177 aEnds.push_back( pMark->GetName() );
182 const sal_Int32 nEnd =
aStr.getLength();
184 if ( nCurrentPos == nEnd )
187 m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds, pRedlineData );
192 std::vector< OUString > aStarts { rName };
193 std::vector< OUString > aEnds { rName };
200 std::vector< OUString > aStarts;
201 std::vector< OUString > aEnds;
206 for (
IMark* pMark : aMarks )
208 const sal_Int32 nStart = pMark->GetMarkStart().GetContentIndex();
209 const sal_Int32 nEnd = pMark->GetMarkEnd().GetContentIndex();
211 if ( nStart == nCurrentPos )
212 aStarts.push_back( pMark->GetName() );
214 if ( nEnd == nCurrentPos )
215 aEnds.push_back( pMark->GetName() );
244 if (
static_cast<const SwTextFormatColl*
>(pParent)->IsAssignedToListLevelOfOutlineStyle())
248 pSerializer->singleElementNS(XML_w, XML_outlineLvl,
FSNS(XML_w, XML_val),
"9");
260 sal_uInt8 nBreakCode,
bool bEvenAndOddHeaders )
271 const bool bPrevSectionHadHeader =
m_bHasHdr;
272 const bool bPrevSectionHadFooter =
m_bHasFtr;
282 else if (bPrevSectionHadHeader && nBreakCode == 2)
288 else if (bPrevSectionHadHeader && nBreakCode == 2)
293 else if (bPrevSectionHadHeader && nBreakCode == 2)
303 else if (bPrevSectionHadFooter && nBreakCode == 2)
309 else if (bPrevSectionHadFooter && nBreakCode == 2)
314 else if (bPrevSectionHadFooter && nBreakCode == 2)
323 m_pAttrOutput->WriteField_Impl( pField, eFieldType, rFieldCmd, nMode );
333 SAL_INFO(
"sw.ww8",
"TODO DocxExport::WriteHyperlinkData().");
337 const OUString& rHelp,
338 const OUString& rToolTip,
339 const OUString& rSelected,
340 const uno::Sequence<OUString>& rListItems)
348 if ( !rHelp.isEmpty() )
349 m_pDocumentFS->singleElementNS(XML_w, XML_helpText,
FSNS(XML_w, XML_val), rHelp);
351 if ( !rToolTip.isEmpty() )
352 m_pDocumentFS->singleElementNS(XML_w, XML_statusText,
FSNS(XML_w, XML_val), rToolTip);
364 SAL_WARN_IF(25 < rListItems.getLength(),
"sw.ww8",
"DocxExport::DoComboBox data loss with more than 25 entries");
365 auto const nSize(
std::min(sal_Int32(25), rListItems.getLength()));
366 for (
auto i = 0;
i < nSize; ++
i)
368 m_pDocumentFS->singleElementNS(XML_w, XML_listEntry,
FSNS(XML_w, XML_val), rListItems[
i]);
385 OUString aFileName =
"charts/chart" + OUString::number(
nCount) +
".xml";
389 aFileName =
"word/charts/chart" + OUString::number(
nCount) +
".xml";
392 "application/vnd.openxmlformats-officedocument.drawingml.chart+xml" );
394#if !ENABLE_WASM_STRIP_CHART
399 css::uno::Reference<css::util::XModifiable> xModifiable(
xModel, css::uno::UNO_QUERY);
400 const bool bOldModified = xModifiable && xModifiable->isModified();
402 if (!bOldModified && xModifiable && xModifiable->isModified())
405 xModifiable->setModified(bOldModified);
409 pChartFS->endDocument();
415 uno::Reference <embed::XEmbeddedObject> xObj( rObject.
GetOleRef() );
416 uno::Reference<uno::XComponentContext>
const xContext(
420 OUString sRelationType;
422 const char * pProgID(
nullptr);
424 uno::Reference<io::XInputStream>
const xInStream =
434 assert(!sRelationType.isEmpty());
436 OUString sFileName =
"embeddings/oleObject" + OUString::number( ++
m_nOLEObjects ) +
"." +
sSuffix;
437 uno::Reference<io::XOutputStream>
const xOutStream =
439 assert(xOutStream.is());
445 catch (uno::Exception
const&)
452 sRelationType, sFileName );
455 io_rProgID = OUString::createFromAscii(pProgID);
462 const uno::Reference<awt::XControlModel>& rxControlModel)
467 const OUString sBinaryFileName =
"word/activeX/activeX" + OUString::number(
m_nActiveXControls) +
".bin";
471 uno::Reference<io::XStream> xOutStorage(
m_rFilter.
openFragmentStream(sBinaryFileName,
"application/vnd.ms-office.activeX"), uno::UNO_QUERY);
475 uno::Reference<io::XOutputStream> xOutputStream(aOleStorage.
openOutputStream(
"contents"), uno::UNO_SET_THROW);
479 return std::make_pair<OString, OString>(OString(), OString());
482 exportHelper.
exportControl(xOutputStream, rxShape->getSize(),
true);
487 const OUString sXMLFileName =
"word/activeX/activeX" + OUString::number(
m_nActiveXControls ) +
".xml";
492 sBinaryFileName.subView(sBinaryFileName.lastIndexOf(
"/") + 1) );
494 pActiveXFS->singleElementNS(XML_ax, XML_ocx,
497 FSNS(XML_ax, XML_classid),
"{" +
sGUID +
"}",
498 FSNS(XML_ax, XML_persistence),
"persistStorage",
499 FSNS(XML_r, XML_id), sBinaryId);
503 sXMLFileName.subView(sBinaryFileName.indexOf(
"/") + 1)),
504 RTL_TEXTENCODING_UTF8);
506 pActiveXFS->endDocument();
508 return std::pair<OString, OString>(sXMLId,
sName);
513 uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
515 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GroupShape"))
517 else if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape"))
537 rGraphicExportCache.push();
566 rGraphicExportCache.pop();
622 SAL_INFO(
"sw.ww8",
"TODO DocxExport::OutputGrfNode( const SwGrfNode& )" );
627 SAL_INFO(
"sw.ww8",
"TODO DocxExport::OutputOLENode( const SwOLENode& )" );
644 const SwPageDesc* pNewPgDesc,
bool bExtraPageBreak )
653 OSL_ENSURE( pNewPgDescFormat || pNewPgDesc,
"Neither page desc format nor page desc provided." );
655 if ( pNewPgDescFormat )
657 m_pSections->AppendSection( *pNewPgDescFormat, rNd, pFormat, nLnNm );
659 else if ( pNewPgDesc )
661 m_pSections->AppendSection( pNewPgDesc, rNd, pFormat, nLnNm );
677 "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" );
688 pStylesFS->endDocument();
702 "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" );
719 pFootnotesFS->endDocument();
732 "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" );
749 pEndnotesFS->endDocument();
763 "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" );
767 const auto eHasProperties =
m_pAttrOutput->WritePostitFields();
769 pPostitFS->endElementNS( XML_w, XML_comments );
770 pPostitFS->endDocument();
777 u"commentsExtended.xml");
780 "word/commentsExtended.xml",
781 "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml");
783 pPostitFS->startElementNS(XML_w15, XML_commentsEx,
786 FSNS(XML_mc, XML_Ignorable),
"w15");
790 pPostitFS->endElementNS(XML_w15, XML_commentsEx);
791 pPostitFS->endDocument();
804 "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" );
810 pNumberingFS->startElementNS( XML_w, XML_numbering,
817 FSNS( XML_mc, XML_Ignorable ),
"w14" );
825 pNumberingFS->endElementNS( XML_w, XML_numbering );
831 pNumberingFS->endDocument();
841 OUString
aName(
"header" + OUString::number( ++
m_nHeaders ) +
".xml" );
848 "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" );
854 OUString
aName(
"footer" + OUString::number( ++
m_nFooters ) +
".xml" );
861 "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" );
874 if (pFormat ==
nullptr)
888 sal_Int32 nReference;
891 pFS->endElementNS( XML_w, XML_hdr );
892 nReference = XML_headerReference;
896 pFS->endElementNS( XML_w, XML_ftr );
897 nReference = XML_footerReference;
903 FSNS( XML_r, XML_id ), aRelId );
915 "word/fontTable.xml",
916 "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" );
918 pFS->startElementNS( XML_w, XML_fonts,
931 pFS->endElementNS( XML_w, XML_fonts );
940 uno::Reference<document::XDocumentProperties> xDocProps;
941 bool bSecurityOptOpenReadOnly =
false;
944 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
945 pDocShell->
GetModel( ), uno::UNO_QUERY );
946 xDocProps = xDPS->getDocumentProperties();
961 uno::Reference<text::XTextFieldsSupplier>
xModel(pDocShell->
GetModel(), uno::UNO_QUERY);
962 uno::Reference<container::XNameAccess> xTextFieldMasters =
xModel->getTextFieldMasters();
963 uno::Sequence<rtl::OUString> aMasterNames = xTextFieldMasters->getElementNames();
964 if (!aMasterNames.hasElements())
970 bool bStarted =
false;
971 constexpr OUStringLiteral aPrefix(
u"com.sun.star.text.fieldmaster.User.");
972 for (
const auto& rMasterName : std::as_const(aMasterNames))
974 if (!rMasterName.startsWith(aPrefix))
980 uno::Reference<beans::XPropertySet> xField;
981 xTextFieldMasters->getByName(rMasterName) >>= xField;
987 OUString aKey = rMasterName.copy(aPrefix.getLength());
989 xField->getPropertyValue(
"Content") >>= aValue;
993 pFS->startElementNS(XML_w, XML_docVars);
995 pFS->singleElementNS(XML_w, XML_docVar,
FSNS(XML_w, XML_name), aKey,
996 FSNS(XML_w, XML_val), aValue);
1001 pFS->endElementNS(XML_w, XML_docVars);
1007 sal_Int32 & rTargetCompatibilityMode) ->
void
1012 rpFS->singleElementNS(XML_w, XML_noLeading);
1013 if (rTargetCompatibilityMode > 14)
1015 rTargetCompatibilityMode = 14;
1021 rpFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn);
1025 rpFS->singleElementNS(XML_w, XML_usePrinterMetrics);
1030 rpFS->singleElementNS(XML_w, XML_doNotBreakWrappedTables);
1047 "word/settings.xml",
1048 "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" );
1050 pFS->startElementNS( XML_w, XML_settings,
1055 if (aInfo.hasElements())
1057 OUString sAlgorithm, sSalt,
sHash;
1059 for (
const auto& prop : aInfo)
1061 if (prop.Name ==
"algorithm-name")
1062 prop.Value >>= sAlgorithm;
1063 else if (prop.Name ==
"salt")
1064 prop.Value >>= sSalt;
1065 else if (prop.Name ==
"iteration-count")
1067 else if (prop.Name ==
"hash")
1068 prop.Value >>=
sHash;
1070 if (!sAlgorithm.isEmpty() && !sSalt.isEmpty() && !
sHash.isEmpty())
1072 sal_Int32 nAlgorithmSid = 0;
1073 if (sAlgorithm ==
"MD2")
1075 else if (sAlgorithm ==
"MD4")
1077 else if (sAlgorithm ==
"MD5")
1079 else if (sAlgorithm ==
"SHA-1")
1081 else if (sAlgorithm ==
"MAC")
1083 else if (sAlgorithm ==
"RIPEMD")
1085 else if (sAlgorithm ==
"RIPEMD-160")
1087 else if (sAlgorithm ==
"HMAC")
1089 else if (sAlgorithm ==
"SHA-256")
1091 else if (sAlgorithm ==
"SHA-384")
1093 else if (sAlgorithm ==
"SHA-512")
1096 if (nAlgorithmSid != 0)
1097 pFS->singleElementNS(XML_w, XML_writeProtection,
1098 FSNS(XML_w, XML_cryptProviderType),
"rsaAES",
1099 FSNS(XML_w, XML_cryptAlgorithmClass),
"hash",
1100 FSNS(XML_w, XML_cryptAlgorithmType),
"typeAny",
1101 FSNS(XML_w, XML_cryptAlgorithmSid), OString::number(nAlgorithmSid),
1102 FSNS(XML_w, XML_cryptSpinCount), OString::number(
nCount),
1104 FSNS(XML_w, XML_salt), sSalt);
1111 pFS->singleElementNS(XML_w, XML_view,
FSNS(XML_w, XML_val),
"web");
1122 case SvxZoomType::WHOLEPAGE:
1123 pAttributeList->add(
FSNS(XML_w, XML_val),
"fullPage");
1125 case SvxZoomType::PAGEWIDTH:
1126 pAttributeList->add(
FSNS(XML_w, XML_val),
"bestFit");
1128 case SvxZoomType::OPTIMAL:
1129 pAttributeList->add(
FSNS(XML_w, XML_val),
"textFit");
1136 pAttributeList->add(
FSNS(XML_w, XML_percent), aZoom);
1137 pFS->singleElementNS(XML_w, XML_zoom, pAttributeList);
1141 if (std::unique_ptr<SvxBrushItem> oBrush =
getBackground(); oBrush)
1144 pFS->singleElementNS(XML_w, XML_displayBackgroundShape);
1149 pFS->singleElementNS( XML_w, XML_revisionView,
1150 FSNS( XML_w, XML_insDel ),
"0",
1151 FSNS( XML_w, XML_formatting ),
"0" );
1154 pFS->singleElementNS(XML_w, XML_trackRevisions);
1158 pFS->singleElementNS(XML_w, XML_mirrorMargins);
1162 pFS->singleElementNS(XML_w, XML_gutterAtTop);
1167 pFS->singleElementNS(XML_w, XML_embedTrueTypeFonts);
1171 pFS->singleElementNS(XML_w, XML_embedSystemFonts);
1175 pFS->singleElementNS( XML_w, XML_defaultTabStop,
FSNS( XML_w, XML_val ),
1180 if ( !
aData.sDataSource.isEmpty() &&
aData.nCommandType == css::sdb::CommandType::TABLE && !
aData.sCommand.isEmpty() )
1182 OUString sDataSource =
1188 pFS->startElementNS( XML_w, XML_mailMerge );
1189 pFS->singleElementNS(XML_w, XML_mainDocumentType,
1190 FSNS( XML_w, XML_val ),
"formLetters" );
1191 pFS->singleElementNS(XML_w, XML_dataType,
1192 FSNS( XML_w, XML_val ),
"textFile" );
1193 pFS->singleElementNS( XML_w, XML_query,
1194 FSNS( XML_w, XML_val ), sDataSource );
1195 pFS->endElementNS( XML_w, XML_mailMerge );
1200 pFS->singleElementNS(XML_w, XML_autoHyphenation,
FSNS(XML_w, XML_val),
"true");
1208 pFS->singleElementNS(XML_w, XML_doNotHyphenateCaps);
1211 pFS->singleElementNS(XML_w, XML_hyphenationZone,
FSNS(XML_w, XML_val),
1212 OString::number(nHyphenZone));
1217 pFS->singleElementNS(XML_w, XML_evenAndOddHeaders);
1228 uno::Reference< beans::XPropertySet > xPropSet( pDocShell->
GetBaseModel(), uno::UNO_QUERY_THROW );
1230 bool bUseGrabBagProtection =
false;
1231 bool bWriterWantsToProtect =
false;
1232 bool bWriterWantsToProtectForm =
false;
1233 bool bWriterWantsToProtectRedline =
false;
1234 bool bHasDummyRedlineProtectionKey =
false;
1235 bool bReadOnlyStatusUnchanged =
true;
1236 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1240 bWriterWantsToProtect = bWriterWantsToProtectForm =
true;
1242 if ( xPropSetInfo->hasPropertyByName(
"RedlineProtectionKey" ) )
1244 uno::Sequence<sal_Int8> aKey;
1245 xPropSet->getPropertyValue(
"RedlineProtectionKey" ) >>= aKey;
1246 bool bHasRedlineProtectionKey = aKey.hasElements();
1247 bHasDummyRedlineProtectionKey = aKey.getLength() == 1 && aKey[0] == 1;
1248 if ( bHasRedlineProtectionKey && !bHasDummyRedlineProtectionKey )
1249 bWriterWantsToProtect = bWriterWantsToProtectRedline =
true;
1267 sal_Int32 nTargetCompatibilityMode =
1270 bool bHasCompatibilityMode =
false;
1272 if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) )
1274 uno::Sequence< beans::PropertyValue > propList;
1275 xPropSet->getPropertyValue( aGrabBagName ) >>= propList;
1277 for(
const auto& rProp : std::as_const(propList) )
1279 if ( rProp.Name ==
"ThemeFontLangProps" )
1281 uno::Sequence< beans::PropertyValue > themeFontLangProps;
1282 rProp.Value >>= themeFontLangProps;
1283 OUString aValues[3];
1284 for(
const auto& rThemeFontLangProp : std::as_const(themeFontLangProps) )
1286 if( rThemeFontLangProp.Name ==
"val" )
1287 rThemeFontLangProp.Value >>= aValues[0];
1288 else if( rThemeFontLangProp.Name ==
"eastAsia" )
1289 rThemeFontLangProp.Value >>= aValues[1];
1290 else if( rThemeFontLangProp.Name ==
"bidi" )
1291 rThemeFontLangProp.Value >>= aValues[2];
1293 pFS->singleElementNS( XML_w, XML_themeFontLang,
1294 FSNS( XML_w, XML_val ), aValues[0],
1295 FSNS( XML_w, XML_eastAsia ), aValues[1],
1296 FSNS( XML_w, XML_bidi ), aValues[2] );
1298 else if ( rProp.Name ==
"CompatSettings" )
1300 pFS->startElementNS(XML_w, XML_compat);
1304 uno::Sequence< beans::PropertyValue > aCompatSettingsSequence;
1305 rProp.Value >>= aCompatSettingsSequence;
1307 for(
const auto& rCompatSetting : std::as_const(aCompatSettingsSequence))
1309 uno::Sequence< beans::PropertyValue > aCompatSetting;
1310 rCompatSetting.Value >>= aCompatSetting;
1315 for(
const auto& rPropVal : std::as_const(aCompatSetting))
1317 if( rPropVal.Name ==
"name" )
1318 rPropVal.Value >>=
aName;
1319 else if( rPropVal.Name ==
"uri" )
1320 rPropVal.Value >>= aUri;
1321 else if( rPropVal.Name ==
"val" )
1322 rPropVal.Value >>= aValue;
1324 if (
aName ==
"compatibilityMode" )
1326 bHasCompatibilityMode =
true;
1332 if ( aValue.toInt32() > nTargetCompatibilityMode )
1333 aValue = OUString::number(nTargetCompatibilityMode);
1336 pFS->singleElementNS( XML_w, XML_compatSetting,
1338 FSNS( XML_w, XML_uri ), aUri,
1339 FSNS( XML_w, XML_val ), aValue);
1342 if ( !bHasCompatibilityMode )
1344 pFS->singleElementNS( XML_w, XML_compatSetting,
1345 FSNS( XML_w, XML_name ),
"compatibilityMode",
1346 FSNS( XML_w, XML_uri ),
"http://schemas.microsoft.com/office/word",
1347 FSNS( XML_w, XML_val ), OString::number(nTargetCompatibilityMode));
1348 bHasCompatibilityMode =
true;
1351 pFS->endElementNS( XML_w, XML_compat );
1353 else if (rProp.Name ==
"DocumentProtection")
1355 uno::Sequence< beans::PropertyValue > rAttributeList;
1356 rProp.Value >>= rAttributeList;
1358 if (rAttributeList.hasElements())
1361 bool bIsProtectionTrackChanges =
false;
1363 bool bEnforced =
false;
1364 for (
const auto& rAttribute : std::as_const(rAttributeList))
1368 {
"edit", XML_edit },
1369 {
"enforcement", XML_enforcement },
1370 {
"formatting", XML_formatting },
1371 {
"cryptProviderType", XML_cryptProviderType },
1372 {
"cryptAlgorithmClass", XML_cryptAlgorithmClass },
1373 {
"cryptAlgorithmType", XML_cryptAlgorithmType },
1374 {
"cryptAlgorithmSid", XML_cryptAlgorithmSid },
1375 {
"cryptSpinCount", XML_cryptSpinCount },
1376 {
"hash", XML_hash },
1377 {
"salt", XML_salt },
1383 OUString sValue = rAttribute.Value.get<OUString>();
1384 xAttributeList->add(
FSNS(XML_w,
nToken), sValue.toUtf8());
1385 if (
nToken == XML_edit && sValue ==
"trackedChanges" )
1386 bIsProtectionTrackChanges =
true;
1387 else if (
nToken == XML_edit && sValue ==
"readOnly" )
1392 else if (
nToken == XML_enforcement )
1393 bEnforced = sValue.toBoolean();
1401 bUseGrabBagProtection = !bWriterWantsToProtect;
1408 bUseGrabBagProtection = (!bIsProtectionTrackChanges || bHasDummyRedlineProtectionKey)
1409 && bReadOnlyStatusUnchanged;
1412 if ( bUseGrabBagProtection )
1414 pFS->singleElementNS(XML_w, XML_documentProtection, xAttributeList);
1419 else if (rProp.Name ==
"HyphenationZone")
1421 sal_Int16 nHyphenationZone = *o3tl::doAccess<sal_Int16>(rProp.Value);
1422 if (nHyphenationZone > 0)
1423 pFS->singleElementNS(XML_w, XML_hyphenationZone,
FSNS(XML_w, XML_val),
1424 OString::number(nHyphenationZone));
1428 if ( !bHasCompatibilityMode )
1430 pFS->startElementNS(XML_w, XML_compat);
1434 pFS->singleElementNS( XML_w, XML_compatSetting,
1435 FSNS( XML_w, XML_name ),
"compatibilityMode",
1436 FSNS( XML_w, XML_uri ),
"http://schemas.microsoft.com/office/word",
1437 FSNS( XML_w, XML_val ), OString::number(nTargetCompatibilityMode));
1438 pFS->endElementNS( XML_w, XML_compat );
1443 if ( !bUseGrabBagProtection )
1447 if ( bWriterWantsToProtectForm )
1451 pFS->singleElementNS(XML_w, XML_documentProtection,
1452 FSNS(XML_w, XML_edit),
"forms",
1453 FSNS(XML_w, XML_enforcement),
"true");
1456 else if ( bWriterWantsToProtectRedline )
1460 pFS->singleElementNS(XML_w, XML_documentProtection,
1461 FSNS(XML_w, XML_edit),
"trackedChanges",
1462 FSNS(XML_w, XML_enforcement),
"1");
1467 pFS->endElementNS( XML_w, XML_settings );
1482 aThemeExport.
write(
u"word/theme/theme1.xml", *pTheme);
1490 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1492 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1495 uno::Reference<xml::dom::XDocument> glossaryDocDom;
1496 uno::Sequence< uno::Sequence<beans::NamedValue> > glossaryDomList;
1497 uno::Sequence< beans::PropertyValue > propList;
1498 xPropSet->getPropertyValue(
aName ) >>= propList;
1499 sal_Int32 collectedProperties = 0;
1500 for (
const auto& rProp : std::as_const(propList) )
1502 OUString propName = rProp.Name;
1503 if ( propName ==
"OOXGlossary" )
1505 rProp.Value >>= glossaryDocDom;
1506 collectedProperties++;
1508 if (propName ==
"OOXGlossaryDom")
1510 rProp.Value >>= glossaryDomList;
1511 collectedProperties++;
1513 if (collectedProperties == 2)
1518 if ( !glossaryDocDom.is() )
1523 u"glossary/document.xml" );
1526 "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml" );
1528 uno::Reference< xml::sax::XSAXSerializable > serializer( glossaryDocDom, uno::UNO_QUERY );
1530 writer->setOutputStream( xOutputStream );
1531 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1532 uno::Sequence< beans::StringPair >() );
1534 for (
const uno::Sequence<beans::NamedValue>& glossaryElement : glossaryDomList)
1536 OUString gTarget, gType, gId, contentType, targetMode;
1537 uno::Reference<xml::dom::XDocument> xDom;
1538 for (
const auto& [
name,
value] : glossaryElement)
1542 else if (
name ==
"Type")
1544 else if (
name ==
"Target")
1546 else if (
name ==
"TargetMode")
1547 value >>= targetMode;
1548 else if (
name ==
"_contentType")
1549 value >>= contentType;
1550 else if (
name ==
"_relDom")
1553 if (gId.isEmpty() || gType.isEmpty() || gTarget.isEmpty())
1555 const bool bExternal = targetMode ==
"External";
1556 if (!bExternal && !xDom)
1560 SAL_WARN(
"sw.ww8",
"Glossary internal relation without DOM: Id=\"" + gId
1561 +
"\" Type=\"" + gType +
"\" Target=\"" + gTarget +
"\"");
1566 PropertySet aProps(xOutputStream);
1567 aProps.setAnyProperty( PROP_RelId,
uno::Any( gId.toInt32() ));
1571 uno::Reference< xml::sax::XSAXSerializable > gserializer( xDom, uno::UNO_QUERY );
1572 writer->setOutputStream(
GetFilter().openFragmentStream(
"word/glossary/" + gTarget, contentType ) );
1573 gserializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1574 uno::Sequence< beans::StringPair >() );
1579 class XsltTransformListener :
public ::cppu::WeakImplHelper<io::XStreamListener>
1582 XsltTransformListener() : m_bDone(false) {}
1585 std::unique_lock<std::mutex> g(m_mutex);
1586 m_cond.wait(g, [
this]() {
return m_bDone; });
1591 std::condition_variable m_cond;
1594 virtual void SAL_CALL disposing(
const lang::EventObject&)
noexcept override {}
1595 virtual void SAL_CALL started() noexcept
override {}
1596 virtual void SAL_CALL closed() noexcept
override { notifyDone(); }
1597 virtual void SAL_CALL terminated() noexcept
override { notifyDone(); }
1598 virtual void SAL_CALL error(
const uno::Any& e)
override
1605 std::scoped_lock<std::mutex> g(m_mutex);
1607 m_cond.notify_all();
1612static void lcl_UpdateXmlValues(
const SdtData& sdtData,
const uno::Reference<css::io::XInputStream>& xInputStream,
const uno::Reference<css::io::XOutputStream>& xOutputStream)
1614 uno::Sequence<uno::Any> aArgs{
1618 uno::Any(beans::NamedValue(
"StylesheetText",
uno::Any(OUString(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> \
1620 xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\
1623 <xsl:template match=\"@* | node()\">\
1625 <xsl:apply-templates select=\"@* | node()\"/>\
1628 <xsl:template match = \"" + sdtData.
xpath +
"\">\
1630 <xsl:text>" + sdtData.
data +
"</xsl:text>\
1637 css::uno::Reference<css::xml::xslt::XXSLTTransformer> xTransformer =
1639 xTransformer->setInputStream(xInputStream);
1640 xTransformer->setOutputStream(xOutputStream);
1643 xTransformer->addListener(xListener);
1645 xTransformer->start();
1653 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1657 uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomlist;
1658 uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomPropslist;
1659 uno::Sequence< beans::PropertyValue > propList;
1661 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1662 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXCustomXml"; });
1663 if (pProp != std::cend(propList))
1664 pProp->Value >>= customXmlDomlist;
1666 pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1667 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXCustomXmlProps"; });
1668 if (pProp != std::cend(propList))
1669 pProp->Value >>= customXmlDomPropslist;
1671 for (sal_Int32 j = 0; j < customXmlDomlist.getLength(); j++)
1673 uno::Reference<xml::dom::XDocument> customXmlDom = customXmlDomlist[j];
1674 uno::Reference<xml::dom::XDocument> customXmlDomProps = customXmlDomPropslist[j];
1675 if (customXmlDom.is())
1679 Concat2View(
"../customXml/item"+OUString::number(j+1)+
".xml" ));
1681 uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDom, uno::UNO_QUERY );
1684 uno::Reference < css::io::XOutputStream > xOutStream =
GetFilter().
openFragmentStream(
"customXml/item" + OUString::number(j + 1) +
".xml",
1689 uno::Reference< io::XStream > xMemStream(
1692 uno::UNO_QUERY_THROW);
1694 writer->setOutputStream(xMemStream->getOutputStream());
1696 serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
1697 uno::Sequence< beans::StringPair >());
1699 uno::Reference< io::XStream > xXSLTInStream = xMemStream;
1700 uno::Reference< io::XStream > xXSLTOutStream;
1716 uno::UNO_QUERY_THROW);
1719 xXSLTInStream.set( xXSLTOutStream );
1726 writer->setOutputStream(xOutStream);
1728 serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
1729 uno::Sequence< beans::StringPair >());
1733 if (customXmlDomProps.is())
1735 uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDomProps, uno::UNO_QUERY );
1737 writer->setOutputStream(
GetFilter().openFragmentStream(
"customXml/itemProps"+OUString::number(j+1)+
".xml",
1738 "application/vnd.openxmlformats-officedocument.customXmlProperties+xml" ) );
1739 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1740 uno::Sequence< beans::StringPair >() );
1744 "application/xml" ) ,
1746 Concat2View(
"itemProps"+OUString::number(j+1)+
".xml" ));
1754 if (!xStorageBasedDocument.is())
1757 uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage();
1758 OUString aMacrosName(
"_MS_VBA_Macros");
1759 if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName))
1762 const sal_Int32 nOpenMode = embed::ElementModes::READ;
1763 uno::Reference<io::XStream> xMacrosStream = xDocumentStorage->openStreamElement(aMacrosName, nOpenMode);
1764 uno::Reference<io::XOutputStream> xProjectStream;
1765 if (xMacrosStream.is())
1771 uno::Reference<io::XStream> xOutputStream(xProjectStream, uno::UNO_QUERY);
1772 if (!xOutputStream.is())
1777 pOut->WriteStream(*pIn);
1783 OUString aDataName(
"_MS_VBA_Macros_XML");
1784 if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aDataName))
1787 uno::Reference<io::XStream> xDataStream = xDocumentStorage->openStreamElement(aDataName, nOpenMode);
1788 if (!xDataStream.is())
1795 uno::Reference<io::XStream> xOutputStream(
GetFilter().openFragmentStream(
"word/vbaData.xml",
"application/vnd.ms-word.vbaData+xml"), uno::UNO_QUERY);
1796 if (!xOutputStream.is())
1801 pOut->WriteStream(*pIn);
1804 if (!xProjectStream.is())
1814 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1816 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1819 uno::Sequence< beans::PropertyValue > embeddingsList;
1820 uno::Sequence< beans::PropertyValue > propList;
1821 xPropSet->getPropertyValue(
aName ) >>= propList;
1822 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1823 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXEmbeddings"; });
1824 if (pProp != std::cend(propList))
1825 pProp->Value >>= embeddingsList;
1826 for (
const auto& rEmbedding : std::as_const(embeddingsList))
1828 OUString embeddingPath = rEmbedding.Name;
1829 uno::Reference<io::XInputStream> embeddingsStream;
1830 rEmbedding.Value >>= embeddingsStream;
1831 if (!embeddingsStream)
1834 OUString contentType;
1835 if (css::uno::Reference<css::beans::XPropertySet> xProps{ embeddingsStream,
1836 css::uno::UNO_QUERY })
1840 const css::uno::Any val = xProps->getPropertyValue(
"MediaType");
1841 val >>= contentType;
1843 catch (
const css::beans::UnknownPropertyException&)
1849 if (contentType.isEmpty())
1852 if (embeddingPath.endsWith(
".xlsm"))
1853 contentType =
"application/vnd.ms-excel.sheet.macroEnabled.12";
1854 else if (embeddingPath.endsWith(
".bin"))
1855 contentType =
"application/vnd.openxmlformats-officedocument.oleObject";
1857 contentType =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1865 uno::Reference<io::XSeekable> xSeekable(embeddingsStream, uno::UNO_QUERY);
1870 catch(
const uno::Exception&)
1872 TOOLS_WARN_EXCEPTION(
"sw.ww8",
"WriteEmbeddings() ::Failed to copy Inputstream to outputstream exception caught");
1874 xOutStream->closeOutput();
1880 bool bMirroredMargins =
false;
1883 bMirroredMargins =
true;
1885 return bMirroredMargins;
1898 if (std::unique_ptr<SvxBrushItem> oBrush =
getBackground(); oBrush)
1900 Color backgroundColor = oBrush->GetColor();
1904 aBackgroundColorStr);
1944 pAttr->add(
FSNS( XML_mc, XML_Ignorable ),
"w14 wp14 w15" );
1958 bool bNeedsLastParaId)
1964 sal_Int32 nParaId = 0;
1965 for( sal_Int32
n = 0;
n < nPara; ++
n )
1971 bNeedsLastParaId &&
n == nPara - 1);
1974 sal_Int32 nCurrentPos = 0;
1975 const sal_Int32 nEnd =
aStr.getLength();
1988 bool bTextAtr = aAttrIter.
IsTextAttr( nCurrentPos );
1991 if( nCurrentPos == 0 && nNextAttr - nCurrentPos ==
aStr.getLength())
1995 OUString tmp(
aStr.copy( nCurrentPos, nNextAttr - nCurrentPos ));
2000 aAttrIter.
OutAttr( nCurrentPos );
2003 nCurrentPos = nNextAttr;
2004 eChrSet = eNextChrSet;
2009 }
while( nCurrentPos < nEnd );
2021 sal_Int32 nWordCompatibilityMode = -1;
2023 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
2026 uno::Sequence< beans::PropertyValue > propList;
2029 for (
const auto& rProp : std::as_const(propList))
2031 if (rProp.Name ==
"CompatSettings")
2033 css::uno::Sequence< css::beans::PropertyValue > aCurrentCompatSettings;
2034 rProp.Value >>= aCurrentCompatSettings;
2036 for (
const auto& rCurrentCompatSetting : std::as_const(aCurrentCompatSettings))
2038 uno::Sequence< beans::PropertyValue > aCompatSetting;
2039 rCurrentCompatSetting.Value >>= aCompatSetting;
2045 for (
const auto& rPropVal : std::as_const(aCompatSetting))
2047 if ( rPropVal.Name ==
"name" ) rPropVal.Value >>=
sName;
2048 if ( rPropVal.Name ==
"uri" ) rPropVal.Value >>= sUri;
2049 if ( rPropVal.Name ==
"val" ) rPropVal.Value >>= sVal;
2052 if (
sName ==
"compatibilityMode" && sUri ==
"http://schemas.microsoft.com/office/word")
2054 const sal_Int32 nValidMode = sVal.toInt32();
2056 if (nValidMode > 10 && nValidMode > nWordCompatibilityMode)
2057 nWordCompatibilityMode = nValidMode;
2065 return nWordCompatibilityMode;
2074 std::shared_ptr<SwUnoCursor> & pCurrentPam,
2075 SwPaM& rOriginalPam,
bool bDocm,
bool bTemplate)
2077 m_rFilter( rFilter ),
2081 m_nActiveXControls( 0 ),
2082 m_nHeadersFootersInSection(0),
2084 m_bTemplate(bTemplate),
2092 u"word/document.xml" );
2095 OUString aMediaType;
2100 aMediaType =
"application/vnd.ms-word.template.macroEnabledTemplate.main+xml";
2104 aMediaType =
"application/vnd.ms-word.document.macroEnabled.main+xml";
2111 aMediaType =
"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml";
2115 aMediaType =
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
2144: evenAndOddHeaders( false )
2145, defaultTabStop( 0 )
2146, revisionView( true )
2147, trackRevisions( false )
@ DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
@ DO_NOT_BREAK_WRAPPED_TABLES
constexpr OUStringLiteral sMediaType
virtual void EndParagraphProperties(const SfxItemSet &rParagraphMarkerProperties, const SwRedlineData *pRedlineData, const SwRedlineData *pRedlineParagraphMarkerDeleted, const SwRedlineData *pRedlineParagraphMarkerInserted)=0
Called after we end outputting the attributes.
virtual void EmptyParagraph()=0
Empty paragraph.
virtual sal_Int32 StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, bool bGenerateParaId)=0
Start of the paragraph.
virtual void EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner)=0
End of the paragraph.
virtual void RunText(const OUString &rText, rtl_TextEncoding eCharSet=RTL_TEXTENCODING_UTF8, const OUString &rSymbolFont=OUString())=0
Output text (inside a run).
virtual void EndRun(const SwTextNode *pNode, sal_Int32 nPos, sal_Int32 nLen, bool bLastRun=false)=0
End of the text run.
virtual void StartRunProperties()=0
Called before we start outputting the attributes.
virtual void StartParagraphProperties()=0
Called before we start outputting the attributes.
virtual void StartRun(const SwRedlineData *pRedlineData, sal_Int32 nPos, bool bSingleEmptyRun=false)=0
Start of the text run.
virtual void SectionBreaks(const SwNode &rNode)=0
Called in order to output section breaks.
virtual void EndRunProperties(const SwRedlineData *pRedlineData)=0
Called after we end outputting the attributes.
virtual void SectionBreak(sal_uInt8 nC, bool bBreakAfter, const WW8_SepInfo *pSectionInfo=nullptr, bool bExtraPageBreak=false)=0
Write a section break msword::ColumnBreak or msword::PageBreak bBreakAfter: the break must be schedul...
The class that has handlers for various resource types when exporting as DOCX.
static void WriteFootnoteEndnotePr(::sax_fastparser::FSHelperPtr const &fs, int tag, const SwEndNoteInfo &info, int listtag)
writes the footnotePr/endnotePr (depending on tag) section
The physical access to the DOCX document (for writing).
virtual void WriteNumbering() override
Write the numbering table.
rtl::Reference< sax_fastparser::FastAttributeList > MainXmlNamespaces()
All xml namespaces to be used at the top of any text .xml file (main doc, headers,...
virtual void AppendAnnotationMarks(const SwWW8AttrIter &rAttrs, sal_Int32 nCurrentPos, sal_Int32 nLen) override
sal_Int32 m_nFooters
Footer counter.
void WriteTheme()
Write word/theme/theme1.xml.
virtual MSWordSections & Sections() const override
Access to the sections/headers/footres.
virtual void OutputField(const SwField *pField, ww::eField eFieldType, const OUString &rFieldCmd, FieldFlags nMode=FieldFlags::All) override
Write the field.
void WritePostitFields()
Write comments.xml.
virtual bool DisallowInheritingOutlineNumbering(const SwFormat &rFormat) override
Return value indicates if an inherited outline numbering is suppressed.
OString AddRelation(const OUString &rType, std::u16string_view rTarget)
Returns the relationd id.
std::pair< OString, OString > WriteActiveXObject(const uno::Reference< css::drawing::XShape > &rxShape, const uno::Reference< awt::XControlModel > &rxControlModel)
sal_Int32 WriteOutliner(const OutlinerParaObject &rOutliner, sal_uInt8 nTyp, bool bNeedsLastParaId)
virtual void PrepareNewPageDesc(const SfxItemSet *pSet, const SwNode &rNd, const SwFormatPageDesc *pNewPgDescFormat, const SwPageDesc *pNewPgDesc, bool bExtraPageBreak=false) override
Get ready for a new section.
virtual void AppendBookmark(const OUString &rName) override
void WriteProperties()
Write docProps/core.xml.
const ::sax_fastparser::FSHelperPtr & GetFS() const
virtual void AppendBookmarks(const SwTextNode &rNode, sal_Int32 nCurrentPos, sal_Int32 nLen, const SwRedlineData *pRedlineData=nullptr) override
std::vector< SdtData > m_SdtData
Storage for sdt data which need to be written to other XMLs.
void WriteSettings()
Write word/settings.xml.
virtual ErrCode ExportDocument_Impl() override
Format-dependent part of the actual export.
virtual void OutputOLENode(const SwOLENode &) override
Output SwOLENode.
bool m_bDocm
If the result will be a .docm file or not.
virtual void ExportGrfBullet(const SwTextNode &) override
virtual sal_uInt64 ReplaceCr(sal_uInt8 nChar) override
OString WriteOLEObject(SwOLEObj &rObject, OUString &io_rProgID)
sal_Int32 m_nHeadersFootersInSection
Footer and Header counter in Section properties.
::sax_fastparser::FSHelperPtr m_pDocumentFS
Fast serializer for the document output.
std::unique_ptr< DocxSdrExport > m_pSdrExport
Exporter of drawings.
::sax_fastparser::FSHelperPtr mpFS
Fast serializer to output the data.
virtual void OutputGrfNode(const SwGrfNode &) override
Output SwGrfNode.
virtual void AppendSection(const SwPageDesc *pPageDesc, const SwSectionFormat *pFormat, sal_uLong nLnNum) override
DocxExportFilter & m_rFilter
Pointer to the filter that owns us.
void InitStyles()
Setup pStyles and write styles.xml.
void WriteMainText()
FIXME this is temporary, remotely reminding the method of the same name in WW8Export.
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.
std::unique_ptr< MSWordSections > m_pSections
Sections/headers/footers.
void WriteHeaderFooter(const SwFormat *pFormat, bool bHeader, const char *pType)
Write reference to a header/footer + the actual xml containing the text.
virtual void OutputLinkedOLE(const OUString &) override
virtual void DoFormText(const SwInputField *pField) override
bool const m_bTemplate
Export is done into template (.dotx)
void WriteFootnotesEndnotes()
Write footnotes.xml and endnotes.xml.
std::unique_ptr< DocxAttributeOutput > m_pAttrOutput
Attribute output for document.
bool isMirroredMargin()
return true if Page Layout is set as Mirrored
sal_Int32 m_nOLEObjects
OLE objects counter.
virtual ~DocxExport() override
Destructor.
virtual void DoComboBox(const OUString &rName, const OUString &rHelp, const OUString &ToolTip, const OUString &rSelected, const css::uno::Sequence< OUString > &rListItems) override
virtual bool CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich) override
Guess the script (asian/western).
virtual void WriteHyperlinkData(const ::sw::mark::IFieldmark &rFieldmark) override
virtual bool ignoreAttributeForStyleDefaults(sal_uInt16 nWhich) const override
Used to filter out attributes that can be e.g. written to .doc but not to .docx.
void WriteVBA()
Writes word/vbaProject.bin.
virtual void OutputEndNode(const SwEndNode &) override
Output SwEndNode.
void WriteFonts()
Write word/fontTable.xml.
void WriteEmbeddings()
Write word/embeddings/Worksheet[n].xlsx.
std::unique_ptr< oox::vml::VMLExport > m_pVMLExport
Exporter of the VML shapes.
virtual AttributeOutputBase & AttrOutput() const override
Access to the attribute output class.
std::unique_ptr< oox::drawingml::DrawingML > m_pDrawingML
Access to the DrawingML writer.
DocxAttributeOutput & DocxAttrOutput() const
Access to the derived attribute output class.
void SetFS(::sax_fastparser::FSHelperPtr const &mpFS)
void WriteDocVars(const sax_fastparser::FSHelperPtr &pFS)
Writes the <w:docVars> part of settings.xml.
virtual void WriteFormData(const ::sw::mark::IFieldmark &rFieldmark) override
Write the data of the form field.
OString OutputChart(css::uno::Reference< css::frame::XModel > const &xModel, sal_Int32 nCount, ::sax_fastparser::FSHelperPtr const &m_pSerializer)
Returns the relationd id.
DocxSettingsData m_aSettings
DocxExportFilter & GetFilter()
DocxExport(DocxExportFilter &rFilter, SwDoc &rDocument, std::shared_ptr< SwUnoCursor > &pCurrentPam, SwPaM &rOriginalPam, bool bDocm, bool bTemplate)
Pass the pDocument, pCurrentPam and pOriginalPam to the base class.
sal_Int32 getWordCompatibilityModeFromGrabBag() const
sal_Int32 m_nHeaders
Header counter.
sal_Int32 m_nActiveXControls
ActiveX controls counter.
void OutputDML(css::uno::Reference< css::drawing::XShape > const &xShape)
Writes the shape using drawingML syntax.
void WriteCustomXml()
Write customXml/item[n].xml and customXml/itemProps[n].xml.
Handles DOCX export of drawings.
virtual sal_Int32 GetParagraphCount() const=0
virtual OUString GetText(sal_Int32 nPara) const=0
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
Base class for WW8Export and DocxExport.
void WriteText()
Iterate through the nodes and call the appropriate OutputNode() on them.
void WriteHeaderFooterText(const SwFormat &rFormat, bool bHeader)
Write header/footer text.
int CollectGrfsOfBullets()
Populates m_vecBulletPic with all the bullet graphics used by numberings.
bool IsInTable() const
Return whether currently exported node is in table.
bool m_bOrigShowChanges
Remember the original Show Changes mode.
virtual void OutputEndNode(const SwEndNode &)
Output SwEndNode.
RedlineFlags m_nOrigRedlineFlags
Remember the original redline mode.
std::unique_ptr< SvxBrushItem > getBackground()
Get background color of the document, if there is one.
sal_Int32 m_nLinkedTextboxesChainId
std::unique_ptr< MSWordStyles > m_pStyles
std::vector< ::sw::mark::IMark * > IMarkVector
Used to split the runs according to the bookmarks start and ends.
wwFontHelper m_aFontHelper
static sal_uLong GetSectionLineNo(const SfxItemSet *pSet, const SwNode &rNd)
Line number of the section start.
const SwPageDesc * m_pCurrentPageDesc
void SectionProperties(const WW8_SepInfo &rSectionInfo, WW8_PdAttrDesc *pA=nullptr)
Write section properties.
bool GetBookmarks(const SwTextNode &rNd, sal_Int32 nStt, sal_Int32 nEnd, IMarkVector &rArr)
bool GetAnnotationMarks(const SwWW8AttrIter &rAttrs, sal_Int32 nStt, sal_Int32 nEnd, IMarkVector &rArr)
std::unique_ptr< SwNumRuleTable > m_pUsedNumTable
std::shared_ptr< SwUnoCursor > & m_pCurPam
std::map< OUString, LinkedTextboxInfo > m_aLinkedTextboxesHelper
static const SwSectionFormat * GetSectionFormat(const SwNode &rNd)
Format of the section.
void AbstractNumberingDefinitions()
Write all Levels for all SwNumRules - LVLF.
virtual bool ignoreAttributeForStyleDefaults(sal_uInt16) const
Used to filter out attributes that can be e.g. written to .doc but not to .docx.
void BulletDefinitions()
Write the numbering picture bullets.
void NumberingDefinitions()
Write static data of SwNumRule - LSTF.
Class to collect and output the sections/headers/footers.
Class to collect and output the styles table.
Used to export formatted text associated to drawings.
void OutAttr(sal_Int32 nSwPos)
rtl_TextEncoding GetNextCharSet() const
void OutParaAttr(bool bCharAttr, const std::set< sal_uInt16 > *pWhichsToIgnore=nullptr)
rtl_TextEncoding GetNodeCharSet() const
void NextPara(sal_Int32 nPar)
bool IsTextAttr(sal_Int32 nSwPos)
sal_Int32 WhereNext() const
const EditTextObject & GetTextObject() const
const SdrPage * GetPage(sal_uInt16 nPgNum) const
std::shared_ptr< model::Theme > const & GetTheme() const
SdrPageProperties & getSdrPageProperties()
bool IsSecurityOptOpenReadOnly() const
css::uno::Reference< css::frame::XModel3 > GetModel() const
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
const css::uno::Sequence< css::beans::PropertyValue > & GetModifyPasswordInfo() const
sal_uInt16 & GetTextHyphenZone()
bool IsNoCapsHyphenation() const
const SwFormatLineNumber & GetLineNumber(bool=true) const
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
SwDBData const & GetDBData()
const SwFootnoteInfo & GetFootnoteInfo() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
IDocumentSettingAccess const & getIDocumentSettingAccess() const
const SwEndNoteInfo & GetEndNoteInfo() const
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
const SwAttrPool & GetAttrPool() const
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
SwDocShell * GetDocShell()
const SwPageDesc & GetPageDesc(const size_t i) const
Ends a section of nodes in the document model.
Base class of all fields.
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Marks a node in the document model.
Base class of the Writer document model elements.
SwSectionNode * GetSectionNode()
bool IsContentNode() const
bool IsSectionNode() const
const SwStartNode * StartOfSectionNode() const
SwContentNode * GetContentNode()
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
PaM is Point and Mark: a selection of the document model.
UseOnPage ReadUseOn() const
const SwSection & GetSection() const
SwSectionFormat * GetFormat()
SectionType GetType() const
Represents the style of a paragraph.
SwTextNode is a paragraph in the document model.
const OUString & GetText() const
SvxZoomType GetZoomType() const
sal_uInt16 GetZoom() const
bool getBrowseMode() const
const SwViewOption * GetViewOptions() const
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
css::uno::Reference< css::io::XOutputStream > openOutputStream(const OUString &rStreamName)
void write(OUString const &rPath, model::Theme const &rTheme)
OoxmlVersion getVersion() const
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
::sax_fastparser::FSHelperPtr openFragmentStreamWithSerializer(const OUString &rStreamName, const OUString &rMediaType)
OUString addRelation(const OUString &rType, std::u16string_view rTarget)
css::uno::Reference< css::io::XOutputStream > openFragmentStream(const OUString &rStreamName, const OUString &rMediaType)
OUString getNamespaceURL(sal_Int32 nNSID) const
void exportDocumentProperties(const css::uno::Reference< css::document::XDocumentProperties > &xProperties, bool bSecurityOptOpenReadOnly)
static GraphicExportCache & get()
ShapeExport & WriteShape(const css::uno::Reference< css::drawing::XShape > &xShape)
static rtl::Reference< FastAttributeList > createAttrList()
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
std::shared_ptr< WW8TableNodeInfoInner > Pointer_t
std::shared_ptr< WW8TableNodeInfo > Pointer_t
void WriteFontTable(SvStream *pTableStream, WW8Fib &pFib)
#define TOOLS_WARN_EXCEPTION(area, stream)
sal_Int32 DocxStringGetToken(DocxStringTokenMap const *pMap, std::u16string_view rName)
static void lcl_UpdateXmlValues(const SdtData &sdtData, const uno::Reference< css::io::XInputStream > &xInputStream, const uno::Reference< css::io::XOutputStream > &xOutputStream)
static auto WriteCompat(SwDoc const &rDoc, ::sax_fastparser::FSHelperPtr const &rpFS, sal_Int32 &rTargetCompatibilityMode) -> void
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(121)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
constexpr OUStringLiteral aData
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
Reference< XComponentContext > getProcessComponentContext()
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
OString ConvertColor(const Color &rColor)
const sal_uInt8 PageBreak
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
uno::Reference< io::XInputStream > GetOLEObjectStream(uno::Reference< uno::XComponentContext > const &xContext, uno::Reference< embed::XEmbeddedObject > const &xObj, std::u16string_view i_rProgID, OUString &o_rMediaType, OUString &o_rRelationType, OUString &o_rSuffix, const char *&o_rpProgID)
OUString getRelationship(Relationship eRelationship)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
bool getOutputStream(ProgramOptions const &options, OString const &extension, std::ostream **ppOutputStream, OString &targetSourceFileName, OString &tmpSourceFileName)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
@ RES_POOLCOLL_STANDARD
Standard.
OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace
bool evenAndOddHeaders
returns true if there are any non-default settings (i.e. something to write)
All the information that should be stashed away when we're in the middle of of a table export and sti...
Data to keep and write to XMLs.
Reference< XModel > xModel
constexpr OUStringLiteral UNO_NAME_MISC_OBJ_INTEROPGRABBAG
OUString FieldString(ww::eField eIndex)