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>
58#include <condition_variable>
88#include <oox/token/properties.hxx>
100using namespace ::
oox;
124 if ( nScript == i18n::ScriptType::ASIAN )
138 else if ( nScript != i18n::ScriptType::COMPLEX )
157 std::vector< OUString > aStarts;
158 std::vector< OUString > aEnds;
161 if (
GetBookmarks( rNode, nCurrentPos, nCurrentPos + nLen, aMarks ) )
163 for (
IMark* pMark : aMarks )
165 const sal_Int32 nStart = pMark->GetMarkStart().GetContentIndex();
166 const sal_Int32 nEnd = pMark->GetMarkEnd().GetContentIndex();
168 if ( nStart == nCurrentPos )
169 aStarts.push_back( pMark->GetName() );
171 if ( nEnd == nCurrentPos )
172 aEnds.push_back( pMark->GetName() );
177 const sal_Int32 nEnd =
aStr.getLength();
179 if ( nCurrentPos == nEnd )
182 m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds, pRedlineData );
187 std::vector< OUString > aStarts { rName };
188 std::vector< OUString > aEnds { rName };
195 std::vector< OUString > aStarts;
196 std::vector< OUString > aEnds;
201 for (
IMark* pMark : aMarks )
203 const sal_Int32 nStart = pMark->GetMarkStart().GetContentIndex();
204 const sal_Int32 nEnd = pMark->GetMarkEnd().GetContentIndex();
206 if ( nStart == nCurrentPos )
207 aStarts.push_back( pMark->GetName() );
209 if ( nEnd == nCurrentPos )
210 aEnds.push_back( pMark->GetName() );
239 if (
static_cast<const SwTextFormatColl*
>(pParent)->IsAssignedToListLevelOfOutlineStyle())
243 pSerializer->singleElementNS(XML_w, XML_outlineLvl,
FSNS(XML_w, XML_val),
"9");
255 sal_uInt8 nBreakCode,
bool bEvenAndOddHeaders )
266 const bool bPrevSectionHadHeader =
m_bHasHdr;
267 const bool bPrevSectionHadFooter =
m_bHasFtr;
277 else if (bPrevSectionHadHeader && nBreakCode == 2)
283 else if (bPrevSectionHadHeader && nBreakCode == 2)
288 else if (bPrevSectionHadHeader && nBreakCode == 2)
298 else if (bPrevSectionHadFooter && nBreakCode == 2)
304 else if (bPrevSectionHadFooter && nBreakCode == 2)
309 else if (bPrevSectionHadFooter && nBreakCode == 2)
318 m_pAttrOutput->WriteField_Impl( pField, eFieldType, rFieldCmd, nMode );
328 SAL_INFO(
"sw.ww8",
"TODO DocxExport::WriteHyperlinkData().");
332 const OUString& rHelp,
333 const OUString& rToolTip,
334 const OUString& rSelected,
335 const uno::Sequence<OUString>& rListItems)
343 if ( !rHelp.isEmpty() )
344 m_pDocumentFS->singleElementNS(XML_w, XML_helpText,
FSNS(XML_w, XML_val), rHelp);
346 if ( !rToolTip.isEmpty() )
347 m_pDocumentFS->singleElementNS(XML_w, XML_statusText,
FSNS(XML_w, XML_val), rToolTip);
359 SAL_WARN_IF(25 < rListItems.getLength(),
"sw.ww8",
"DocxExport::DoComboBox data loss with more than 25 entries");
360 auto const nSize(
std::min(sal_Int32(25), rListItems.getLength()));
361 for (
auto i = 0;
i < nSize; ++
i)
363 m_pDocumentFS->singleElementNS(XML_w, XML_listEntry,
FSNS(XML_w, XML_val), rListItems[
i]);
380 OUString aFileName =
"charts/chart" + OUString::number(
nCount) +
".xml";
384 aFileName =
"word/charts/chart" + OUString::number(
nCount) +
".xml";
387 "application/vnd.openxmlformats-officedocument.drawingml.chart+xml" );
389#if !ENABLE_WASM_STRIP_CHART
394 css::uno::Reference<css::util::XModifiable> xModifiable(
xModel, css::uno::UNO_QUERY);
395 const bool bOldModified = xModifiable && xModifiable->isModified();
397 if (!bOldModified && xModifiable && xModifiable->isModified())
400 xModifiable->setModified(bOldModified);
404 pChartFS->endDocument();
410 uno::Reference <embed::XEmbeddedObject> xObj( rObject.
GetOleRef() );
411 uno::Reference<uno::XComponentContext>
const xContext(
415 OUString sRelationType;
417 const char * pProgID(
nullptr);
419 uno::Reference<io::XInputStream>
const xInStream =
429 assert(!sRelationType.isEmpty());
431 OUString sFileName =
"embeddings/oleObject" + OUString::number( ++
m_nOLEObjects ) +
"." +
sSuffix;
432 uno::Reference<io::XOutputStream>
const xOutStream =
434 assert(xOutStream.is());
440 catch (uno::Exception
const&)
447 sRelationType, sFileName );
450 io_rProgID = OUString::createFromAscii(pProgID);
457 const uno::Reference<awt::XControlModel>& rxControlModel)
462 const OUString sBinaryFileName =
"word/activeX/activeX" + OUString::number(
m_nActiveXControls) +
".bin";
466 uno::Reference<io::XStream> xOutStorage(
m_rFilter.
openFragmentStream(sBinaryFileName,
"application/vnd.ms-office.activeX"), uno::UNO_QUERY);
470 uno::Reference<io::XOutputStream> xOutputStream(aOleStorage.
openOutputStream(
"contents"), uno::UNO_SET_THROW);
474 return std::make_pair<OString, OString>(OString(), OString());
477 exportHelper.
exportControl(xOutputStream, rxShape->getSize(),
true);
482 const OUString sXMLFileName =
"word/activeX/activeX" + OUString::number(
m_nActiveXControls ) +
".xml";
487 sBinaryFileName.subView(sBinaryFileName.lastIndexOf(
"/") + 1) );
489 pActiveXFS->singleElementNS(XML_ax, XML_ocx,
492 FSNS(XML_ax, XML_classid),
"{" +
sGUID +
"}",
493 FSNS(XML_ax, XML_persistence),
"persistStorage",
494 FSNS(XML_r, XML_id), sBinaryId);
498 sXMLFileName.subView(sBinaryFileName.indexOf(
"/") + 1)),
499 RTL_TEXTENCODING_UTF8);
501 pActiveXFS->endDocument();
503 return std::pair<OString, OString>(sXMLId,
sName);
508 uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
510 if (xServiceInfo->supportsService(
"com.sun.star.drawing.GroupShape"))
512 else if (xServiceInfo->supportsService(
"com.sun.star.drawing.GraphicObjectShape"))
532 rGraphicExportCache.push();
561 rGraphicExportCache.pop();
617 SAL_INFO(
"sw.ww8",
"TODO DocxExport::OutputGrfNode( const SwGrfNode& )" );
622 SAL_INFO(
"sw.ww8",
"TODO DocxExport::OutputOLENode( const SwOLENode& )" );
639 const SwPageDesc* pNewPgDesc,
bool bExtraPageBreak )
648 OSL_ENSURE( pNewPgDescFormat || pNewPgDesc,
"Neither page desc format nor page desc provided." );
650 if ( pNewPgDescFormat )
652 m_pSections->AppendSection( *pNewPgDescFormat, rNd, pFormat, nLnNm );
654 else if ( pNewPgDesc )
656 m_pSections->AppendSection( pNewPgDesc, rNd, pFormat, nLnNm );
672 "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" );
683 pStylesFS->endDocument();
697 "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" );
714 pFootnotesFS->endDocument();
727 "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" );
744 pEndnotesFS->endDocument();
758 "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" );
762 const auto eHasProperties =
m_pAttrOutput->WritePostitFields();
764 pPostitFS->endElementNS( XML_w, XML_comments );
765 pPostitFS->endDocument();
772 u"commentsExtended.xml");
775 "word/commentsExtended.xml",
776 "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml");
778 pPostitFS->startElementNS(XML_w15, XML_commentsEx,
781 FSNS(XML_mc, XML_Ignorable),
"w15");
785 pPostitFS->endElementNS(XML_w15, XML_commentsEx);
786 pPostitFS->endDocument();
799 "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" );
805 pNumberingFS->startElementNS( XML_w, XML_numbering,
812 FSNS( XML_mc, XML_Ignorable ),
"w14" );
820 pNumberingFS->endElementNS( XML_w, XML_numbering );
826 pNumberingFS->endDocument();
836 OUString
aName(
"header" + OUString::number( ++
m_nHeaders ) +
".xml" );
843 "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" );
849 OUString
aName(
"footer" + OUString::number( ++
m_nFooters ) +
".xml" );
856 "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" );
869 if (pFormat ==
nullptr)
883 sal_Int32 nReference;
886 pFS->endElementNS( XML_w, XML_hdr );
887 nReference = XML_headerReference;
891 pFS->endElementNS( XML_w, XML_ftr );
892 nReference = XML_footerReference;
898 FSNS( XML_r, XML_id ), aRelId );
910 "word/fontTable.xml",
911 "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" );
913 pFS->startElementNS( XML_w, XML_fonts,
926 pFS->endElementNS( XML_w, XML_fonts );
935 uno::Reference<document::XDocumentProperties> xDocProps;
936 bool bSecurityOptOpenReadOnly =
false;
939 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
940 pDocShell->
GetModel( ), uno::UNO_QUERY );
941 xDocProps = xDPS->getDocumentProperties();
956 uno::Reference<text::XTextFieldsSupplier>
xModel(pDocShell->
GetModel(), uno::UNO_QUERY);
957 uno::Reference<container::XNameAccess> xTextFieldMasters =
xModel->getTextFieldMasters();
958 uno::Sequence<rtl::OUString> aMasterNames = xTextFieldMasters->getElementNames();
959 if (!aMasterNames.hasElements())
965 bool bStarted =
false;
966 constexpr OUStringLiteral aPrefix(
u"com.sun.star.text.fieldmaster.User.");
967 for (
const auto& rMasterName : std::as_const(aMasterNames))
969 if (!rMasterName.startsWith(aPrefix))
975 uno::Reference<beans::XPropertySet> xField;
976 xTextFieldMasters->getByName(rMasterName) >>= xField;
982 OUString aKey = rMasterName.copy(aPrefix.getLength());
984 xField->getPropertyValue(
"Content") >>= aValue;
988 pFS->startElementNS(XML_w, XML_docVars);
990 pFS->singleElementNS(XML_w, XML_docVar,
FSNS(XML_w, XML_name), aKey,
991 FSNS(XML_w, XML_val), aValue);
996 pFS->endElementNS(XML_w, XML_docVars);
1002 sal_Int32 & rTargetCompatibilityMode) ->
void
1007 rpFS->singleElementNS(XML_w, XML_noLeading);
1008 if (rTargetCompatibilityMode > 14)
1010 rTargetCompatibilityMode = 14;
1016 rpFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn);
1020 rpFS->singleElementNS(XML_w, XML_usePrinterMetrics);
1025 rpFS->singleElementNS(XML_w, XML_doNotBreakWrappedTables);
1042 "word/settings.xml",
1043 "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" );
1045 pFS->startElementNS( XML_w, XML_settings,
1050 if (aInfo.hasElements())
1052 OUString sAlgorithm, sSalt,
sHash;
1054 for (
const auto& prop : aInfo)
1056 if (prop.Name ==
"algorithm-name")
1057 prop.Value >>= sAlgorithm;
1058 else if (prop.Name ==
"salt")
1059 prop.Value >>= sSalt;
1060 else if (prop.Name ==
"iteration-count")
1062 else if (prop.Name ==
"hash")
1063 prop.Value >>=
sHash;
1065 if (!sAlgorithm.isEmpty() && !sSalt.isEmpty() && !
sHash.isEmpty())
1067 sal_Int32 nAlgorithmSid = 0;
1068 if (sAlgorithm ==
"MD2")
1070 else if (sAlgorithm ==
"MD4")
1072 else if (sAlgorithm ==
"MD5")
1074 else if (sAlgorithm ==
"SHA-1")
1076 else if (sAlgorithm ==
"MAC")
1078 else if (sAlgorithm ==
"RIPEMD")
1080 else if (sAlgorithm ==
"RIPEMD-160")
1082 else if (sAlgorithm ==
"HMAC")
1084 else if (sAlgorithm ==
"SHA-256")
1086 else if (sAlgorithm ==
"SHA-384")
1088 else if (sAlgorithm ==
"SHA-512")
1091 if (nAlgorithmSid != 0)
1092 pFS->singleElementNS(XML_w, XML_writeProtection,
1093 FSNS(XML_w, XML_cryptProviderType),
"rsaAES",
1094 FSNS(XML_w, XML_cryptAlgorithmClass),
"hash",
1095 FSNS(XML_w, XML_cryptAlgorithmType),
"typeAny",
1096 FSNS(XML_w, XML_cryptAlgorithmSid), OString::number(nAlgorithmSid),
1097 FSNS(XML_w, XML_cryptSpinCount), OString::number(
nCount),
1099 FSNS(XML_w, XML_salt), sSalt);
1106 pFS->singleElementNS(XML_w, XML_view,
FSNS(XML_w, XML_val),
"web");
1117 case SvxZoomType::WHOLEPAGE:
1118 pAttributeList->add(
FSNS(XML_w, XML_val),
"fullPage");
1120 case SvxZoomType::PAGEWIDTH:
1121 pAttributeList->add(
FSNS(XML_w, XML_val),
"bestFit");
1123 case SvxZoomType::OPTIMAL:
1124 pAttributeList->add(
FSNS(XML_w, XML_val),
"textFit");
1131 pAttributeList->add(
FSNS(XML_w, XML_percent), aZoom);
1132 pFS->singleElementNS(XML_w, XML_zoom, pAttributeList);
1136 if (std::unique_ptr<SvxBrushItem> oBrush =
getBackground(); oBrush)
1139 pFS->singleElementNS(XML_w, XML_displayBackgroundShape);
1144 pFS->singleElementNS( XML_w, XML_revisionView,
1145 FSNS( XML_w, XML_insDel ),
"0",
1146 FSNS( XML_w, XML_formatting ),
"0" );
1149 pFS->singleElementNS(XML_w, XML_trackRevisions);
1153 pFS->singleElementNS(XML_w, XML_mirrorMargins);
1157 pFS->singleElementNS(XML_w, XML_gutterAtTop);
1162 pFS->singleElementNS(XML_w, XML_embedTrueTypeFonts);
1166 pFS->singleElementNS(XML_w, XML_embedSystemFonts);
1170 pFS->singleElementNS( XML_w, XML_defaultTabStop,
FSNS( XML_w, XML_val ),
1175 if ( !
aData.sDataSource.isEmpty() &&
aData.nCommandType == css::sdb::CommandType::TABLE && !
aData.sCommand.isEmpty() )
1177 OUString sDataSource =
1183 pFS->startElementNS( XML_w, XML_mailMerge );
1184 pFS->singleElementNS(XML_w, XML_mainDocumentType,
1185 FSNS( XML_w, XML_val ),
"formLetters" );
1186 pFS->singleElementNS(XML_w, XML_dataType,
1187 FSNS( XML_w, XML_val ),
"textFile" );
1188 pFS->singleElementNS( XML_w, XML_query,
1189 FSNS( XML_w, XML_val ), sDataSource );
1190 pFS->endElementNS( XML_w, XML_mailMerge );
1195 pFS->singleElementNS(XML_w, XML_autoHyphenation,
FSNS(XML_w, XML_val),
"true");
1203 pFS->singleElementNS(XML_w, XML_doNotHyphenateCaps);
1206 pFS->singleElementNS(XML_w, XML_hyphenationZone,
FSNS(XML_w, XML_val),
1207 OString::number(nHyphenZone));
1212 pFS->singleElementNS(XML_w, XML_evenAndOddHeaders);
1223 uno::Reference< beans::XPropertySet > xPropSet( pDocShell->
GetBaseModel(), uno::UNO_QUERY_THROW );
1225 bool bUseGrabBagProtection =
false;
1226 bool bWriterWantsToProtect =
false;
1227 bool bWriterWantsToProtectForm =
false;
1228 bool bWriterWantsToProtectRedline =
false;
1229 bool bHasDummyRedlineProtectionKey =
false;
1230 bool bReadOnlyStatusUnchanged =
true;
1231 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1235 bWriterWantsToProtect = bWriterWantsToProtectForm =
true;
1237 if ( xPropSetInfo->hasPropertyByName(
"RedlineProtectionKey" ) )
1239 uno::Sequence<sal_Int8> aKey;
1240 xPropSet->getPropertyValue(
"RedlineProtectionKey" ) >>= aKey;
1241 bool bHasRedlineProtectionKey = aKey.hasElements();
1242 bHasDummyRedlineProtectionKey = aKey.getLength() == 1 && aKey[0] == 1;
1243 if ( bHasRedlineProtectionKey && !bHasDummyRedlineProtectionKey )
1244 bWriterWantsToProtect = bWriterWantsToProtectRedline =
true;
1262 sal_Int32 nTargetCompatibilityMode =
1265 bool bHasCompatibilityMode =
false;
1267 if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) )
1269 uno::Sequence< beans::PropertyValue > propList;
1270 xPropSet->getPropertyValue( aGrabBagName ) >>= propList;
1272 for(
const auto& rProp : std::as_const(propList) )
1274 if ( rProp.Name ==
"ThemeFontLangProps" )
1276 uno::Sequence< beans::PropertyValue > themeFontLangProps;
1277 rProp.Value >>= themeFontLangProps;
1278 OUString aValues[3];
1279 for(
const auto& rThemeFontLangProp : std::as_const(themeFontLangProps) )
1281 if( rThemeFontLangProp.Name ==
"val" )
1282 rThemeFontLangProp.Value >>= aValues[0];
1283 else if( rThemeFontLangProp.Name ==
"eastAsia" )
1284 rThemeFontLangProp.Value >>= aValues[1];
1285 else if( rThemeFontLangProp.Name ==
"bidi" )
1286 rThemeFontLangProp.Value >>= aValues[2];
1288 pFS->singleElementNS( XML_w, XML_themeFontLang,
1289 FSNS( XML_w, XML_val ), aValues[0],
1290 FSNS( XML_w, XML_eastAsia ), aValues[1],
1291 FSNS( XML_w, XML_bidi ), aValues[2] );
1293 else if ( rProp.Name ==
"CompatSettings" )
1295 pFS->startElementNS(XML_w, XML_compat);
1299 uno::Sequence< beans::PropertyValue > aCompatSettingsSequence;
1300 rProp.Value >>= aCompatSettingsSequence;
1302 for(
const auto& rCompatSetting : std::as_const(aCompatSettingsSequence))
1304 uno::Sequence< beans::PropertyValue > aCompatSetting;
1305 rCompatSetting.Value >>= aCompatSetting;
1310 for(
const auto& rPropVal : std::as_const(aCompatSetting))
1312 if( rPropVal.Name ==
"name" )
1313 rPropVal.Value >>=
aName;
1314 else if( rPropVal.Name ==
"uri" )
1315 rPropVal.Value >>= aUri;
1316 else if( rPropVal.Name ==
"val" )
1317 rPropVal.Value >>= aValue;
1319 if (
aName ==
"compatibilityMode" )
1321 bHasCompatibilityMode =
true;
1327 if ( aValue.toInt32() > nTargetCompatibilityMode )
1328 aValue = OUString::number(nTargetCompatibilityMode);
1331 pFS->singleElementNS( XML_w, XML_compatSetting,
1333 FSNS( XML_w, XML_uri ), aUri,
1334 FSNS( XML_w, XML_val ), aValue);
1337 if ( !bHasCompatibilityMode )
1339 pFS->singleElementNS( XML_w, XML_compatSetting,
1340 FSNS( XML_w, XML_name ),
"compatibilityMode",
1341 FSNS( XML_w, XML_uri ),
"http://schemas.microsoft.com/office/word",
1342 FSNS( XML_w, XML_val ), OString::number(nTargetCompatibilityMode));
1343 bHasCompatibilityMode =
true;
1346 pFS->endElementNS( XML_w, XML_compat );
1348 else if (rProp.Name ==
"DocumentProtection")
1350 uno::Sequence< beans::PropertyValue > rAttributeList;
1351 rProp.Value >>= rAttributeList;
1353 if (rAttributeList.hasElements())
1356 bool bIsProtectionTrackChanges =
false;
1358 bool bEnforced =
false;
1359 for (
const auto& rAttribute : std::as_const(rAttributeList))
1363 {
"edit", XML_edit },
1364 {
"enforcement", XML_enforcement },
1365 {
"formatting", XML_formatting },
1366 {
"cryptProviderType", XML_cryptProviderType },
1367 {
"cryptAlgorithmClass", XML_cryptAlgorithmClass },
1368 {
"cryptAlgorithmType", XML_cryptAlgorithmType },
1369 {
"cryptAlgorithmSid", XML_cryptAlgorithmSid },
1370 {
"cryptSpinCount", XML_cryptSpinCount },
1371 {
"hash", XML_hash },
1372 {
"salt", XML_salt },
1378 OUString sValue = rAttribute.Value.get<OUString>();
1379 xAttributeList->add(
FSNS(XML_w,
nToken), sValue.toUtf8());
1380 if (
nToken == XML_edit && sValue ==
"trackedChanges" )
1381 bIsProtectionTrackChanges =
true;
1382 else if (
nToken == XML_edit && sValue ==
"readOnly" )
1387 else if (
nToken == XML_enforcement )
1388 bEnforced = sValue.toBoolean();
1396 bUseGrabBagProtection = !bWriterWantsToProtect;
1403 bUseGrabBagProtection = (!bIsProtectionTrackChanges || bHasDummyRedlineProtectionKey)
1404 && bReadOnlyStatusUnchanged;
1407 if ( bUseGrabBagProtection )
1409 pFS->singleElementNS(XML_w, XML_documentProtection, xAttributeList);
1414 else if (rProp.Name ==
"HyphenationZone")
1416 sal_Int16 nHyphenationZone = *o3tl::doAccess<sal_Int16>(rProp.Value);
1417 if (nHyphenationZone > 0)
1418 pFS->singleElementNS(XML_w, XML_hyphenationZone,
FSNS(XML_w, XML_val),
1419 OString::number(nHyphenationZone));
1423 if ( !bHasCompatibilityMode )
1425 pFS->startElementNS(XML_w, XML_compat);
1429 pFS->singleElementNS( XML_w, XML_compatSetting,
1430 FSNS( XML_w, XML_name ),
"compatibilityMode",
1431 FSNS( XML_w, XML_uri ),
"http://schemas.microsoft.com/office/word",
1432 FSNS( XML_w, XML_val ), OString::number(nTargetCompatibilityMode));
1433 pFS->endElementNS( XML_w, XML_compat );
1438 if ( !bUseGrabBagProtection )
1442 if ( bWriterWantsToProtectForm )
1446 pFS->singleElementNS(XML_w, XML_documentProtection,
1447 FSNS(XML_w, XML_edit),
"forms",
1448 FSNS(XML_w, XML_enforcement),
"true");
1451 else if ( bWriterWantsToProtectRedline )
1455 pFS->singleElementNS(XML_w, XML_documentProtection,
1456 FSNS(XML_w, XML_edit),
"trackedChanges",
1457 FSNS(XML_w, XML_enforcement),
"1");
1462 pFS->endElementNS( XML_w, XML_settings );
1471 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1473 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1476 uno::Reference<xml::dom::XDocument> themeDom;
1477 uno::Sequence< beans::PropertyValue > propList;
1478 xPropSet->getPropertyValue(
aName ) >>= propList;
1479 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1480 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXTheme"; });
1481 if (pProp != std::cend(propList))
1482 pProp->Value >>= themeDom;
1485 if ( !themeDom.is() )
1490 u"theme/theme1.xml" );
1492 uno::Reference< xml::sax::XSAXSerializable > serializer( themeDom, uno::UNO_QUERY );
1494 writer->setOutputStream(
GetFilter().openFragmentStream(
"word/theme/theme1.xml",
1495 "application/vnd.openxmlformats-officedocument.theme+xml" ) );
1496 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1497 uno::Sequence< beans::StringPair >() );
1505 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1507 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1510 uno::Reference<xml::dom::XDocument> glossaryDocDom;
1511 uno::Sequence< uno::Sequence<beans::NamedValue> > glossaryDomList;
1512 uno::Sequence< beans::PropertyValue > propList;
1513 xPropSet->getPropertyValue(
aName ) >>= propList;
1514 sal_Int32 collectedProperties = 0;
1515 for (
const auto& rProp : std::as_const(propList) )
1517 OUString propName = rProp.Name;
1518 if ( propName ==
"OOXGlossary" )
1520 rProp.Value >>= glossaryDocDom;
1521 collectedProperties++;
1523 if (propName ==
"OOXGlossaryDom")
1525 rProp.Value >>= glossaryDomList;
1526 collectedProperties++;
1528 if (collectedProperties == 2)
1533 if ( !glossaryDocDom.is() )
1538 u"glossary/document.xml" );
1541 "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml" );
1543 uno::Reference< xml::sax::XSAXSerializable > serializer( glossaryDocDom, uno::UNO_QUERY );
1545 writer->setOutputStream( xOutputStream );
1546 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1547 uno::Sequence< beans::StringPair >() );
1549 for (
const uno::Sequence<beans::NamedValue>& glossaryElement : glossaryDomList)
1551 OUString gTarget, gType, gId, contentType, targetMode;
1552 uno::Reference<xml::dom::XDocument> xDom;
1553 for (
const auto& [
name,
value] : glossaryElement)
1557 else if (
name ==
"Type")
1559 else if (
name ==
"Target")
1561 else if (
name ==
"TargetMode")
1562 value >>= targetMode;
1563 else if (
name ==
"_contentType")
1564 value >>= contentType;
1565 else if (
name ==
"_relDom")
1568 if (gId.isEmpty() || gType.isEmpty() || gTarget.isEmpty())
1570 const bool bExternal = targetMode ==
"External";
1571 if (!bExternal && !xDom)
1575 SAL_WARN(
"sw.ww8",
"Glossary internal relation without DOM: Id=\"" + gId
1576 +
"\" Type=\"" + gType +
"\" Target=\"" + gTarget +
"\"");
1581 PropertySet aProps(xOutputStream);
1582 aProps.setAnyProperty( PROP_RelId,
uno::Any( gId.toInt32() ));
1586 uno::Reference< xml::sax::XSAXSerializable > gserializer( xDom, uno::UNO_QUERY );
1587 writer->setOutputStream(
GetFilter().openFragmentStream(
"word/glossary/" + gTarget, contentType ) );
1588 gserializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1589 uno::Sequence< beans::StringPair >() );
1594 class XsltTransformListener :
public ::cppu::WeakImplHelper<io::XStreamListener>
1597 XsltTransformListener() : m_bDone(false) {}
1600 std::unique_lock<std::mutex> g(m_mutex);
1601 m_cond.wait(g, [
this]() {
return m_bDone; });
1606 std::condition_variable m_cond;
1609 virtual void SAL_CALL disposing(
const lang::EventObject&)
noexcept override {}
1610 virtual void SAL_CALL started() noexcept
override {}
1611 virtual void SAL_CALL closed() noexcept
override { notifyDone(); }
1612 virtual void SAL_CALL terminated() noexcept
override { notifyDone(); }
1613 virtual void SAL_CALL error(
const uno::Any& e)
override
1620 std::scoped_lock<std::mutex> g(m_mutex);
1622 m_cond.notify_all();
1627static void lcl_UpdateXmlValues(
const SdtData& sdtData,
const uno::Reference<css::io::XInputStream>& xInputStream,
const uno::Reference<css::io::XOutputStream>& xOutputStream)
1629 uno::Sequence<uno::Any> aArgs{
1633 uno::Any(beans::NamedValue(
"StylesheetText",
uno::Any(OUString(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> \
1635 xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\
1638 <xsl:template match=\"@* | node()\">\
1640 <xsl:apply-templates select=\"@* | node()\"/>\
1643 <xsl:template match = \"" + sdtData.
xpath +
"\">\
1645 <xsl:text>" + sdtData.
data +
"</xsl:text>\
1652 css::uno::Reference<css::xml::xslt::XXSLTTransformer> xTransformer =
1654 xTransformer->setInputStream(xInputStream);
1655 xTransformer->setOutputStream(xOutputStream);
1658 xTransformer->addListener(xListener);
1660 xTransformer->start();
1668 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1672 uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomlist;
1673 uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomPropslist;
1674 uno::Sequence< beans::PropertyValue > propList;
1676 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1677 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXCustomXml"; });
1678 if (pProp != std::cend(propList))
1679 pProp->Value >>= customXmlDomlist;
1681 pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1682 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXCustomXmlProps"; });
1683 if (pProp != std::cend(propList))
1684 pProp->Value >>= customXmlDomPropslist;
1686 for (sal_Int32 j = 0; j < customXmlDomlist.getLength(); j++)
1688 uno::Reference<xml::dom::XDocument> customXmlDom = customXmlDomlist[j];
1689 uno::Reference<xml::dom::XDocument> customXmlDomProps = customXmlDomPropslist[j];
1690 if (customXmlDom.is())
1694 Concat2View(
"../customXml/item"+OUString::number(j+1)+
".xml" ));
1696 uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDom, uno::UNO_QUERY );
1699 uno::Reference < css::io::XOutputStream > xOutStream =
GetFilter().
openFragmentStream(
"customXml/item" + OUString::number(j + 1) +
".xml",
1704 uno::Reference< io::XStream > xMemStream(
1707 uno::UNO_QUERY_THROW);
1709 writer->setOutputStream(xMemStream->getOutputStream());
1711 serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
1712 uno::Sequence< beans::StringPair >());
1714 uno::Reference< io::XStream > xXSLTInStream = xMemStream;
1715 uno::Reference< io::XStream > xXSLTOutStream;
1731 uno::UNO_QUERY_THROW);
1734 xXSLTInStream.set( xXSLTOutStream );
1741 writer->setOutputStream(xOutStream);
1743 serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
1744 uno::Sequence< beans::StringPair >());
1748 if (customXmlDomProps.is())
1750 uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDomProps, uno::UNO_QUERY );
1752 writer->setOutputStream(
GetFilter().openFragmentStream(
"customXml/itemProps"+OUString::number(j+1)+
".xml",
1753 "application/vnd.openxmlformats-officedocument.customXmlProperties+xml" ) );
1754 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1755 uno::Sequence< beans::StringPair >() );
1759 "application/xml" ) ,
1761 Concat2View(
"itemProps"+OUString::number(j+1)+
".xml" ));
1769 if (!xStorageBasedDocument.is())
1772 uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage();
1773 OUString aMacrosName(
"_MS_VBA_Macros");
1774 if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName))
1777 const sal_Int32 nOpenMode = embed::ElementModes::READ;
1778 uno::Reference<io::XStream> xMacrosStream = xDocumentStorage->openStreamElement(aMacrosName, nOpenMode);
1779 uno::Reference<io::XOutputStream> xProjectStream;
1780 if (xMacrosStream.is())
1786 uno::Reference<io::XStream> xOutputStream(xProjectStream, uno::UNO_QUERY);
1787 if (!xOutputStream.is())
1792 pOut->WriteStream(*pIn);
1798 OUString aDataName(
"_MS_VBA_Macros_XML");
1799 if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aDataName))
1802 uno::Reference<io::XStream> xDataStream = xDocumentStorage->openStreamElement(aDataName, nOpenMode);
1803 if (!xDataStream.is())
1810 uno::Reference<io::XStream> xOutputStream(
GetFilter().openFragmentStream(
"word/vbaData.xml",
"application/vnd.ms-word.vbaData+xml"), uno::UNO_QUERY);
1811 if (!xOutputStream.is())
1816 pOut->WriteStream(*pIn);
1819 if (!xProjectStream.is())
1829 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1831 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1834 uno::Sequence< beans::PropertyValue > embeddingsList;
1835 uno::Sequence< beans::PropertyValue > propList;
1836 xPropSet->getPropertyValue(
aName ) >>= propList;
1837 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1838 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXEmbeddings"; });
1839 if (pProp != std::cend(propList))
1840 pProp->Value >>= embeddingsList;
1841 for (
const auto& rEmbedding : std::as_const(embeddingsList))
1843 OUString embeddingPath = rEmbedding.Name;
1844 uno::Reference<io::XInputStream> embeddingsStream;
1845 rEmbedding.Value >>= embeddingsStream;
1846 if (!embeddingsStream)
1849 OUString contentType;
1850 if (css::uno::Reference<css::beans::XPropertySet> xProps{ embeddingsStream,
1851 css::uno::UNO_QUERY })
1855 const css::uno::Any val = xProps->getPropertyValue(
"MediaType");
1856 val >>= contentType;
1858 catch (
const css::beans::UnknownPropertyException&)
1864 if (contentType.isEmpty())
1867 if (embeddingPath.endsWith(
".xlsm"))
1868 contentType =
"application/vnd.ms-excel.sheet.macroEnabled.12";
1869 else if (embeddingPath.endsWith(
".bin"))
1870 contentType =
"application/vnd.openxmlformats-officedocument.oleObject";
1872 contentType =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1880 uno::Reference<io::XSeekable> xSeekable(embeddingsStream, uno::UNO_QUERY);
1885 catch(
const uno::Exception&)
1887 TOOLS_WARN_EXCEPTION(
"sw.ww8",
"WriteEmbeddings() ::Failed to copy Inputstream to outputstream exception caught");
1889 xOutStream->closeOutput();
1895 bool bMirroredMargins =
false;
1898 bMirroredMargins =
true;
1900 return bMirroredMargins;
1913 if (std::unique_ptr<SvxBrushItem> oBrush =
getBackground(); oBrush)
1915 Color backgroundColor = oBrush->GetColor();
1919 aBackgroundColorStr);
1959 pAttr->add(
FSNS( XML_mc, XML_Ignorable ),
"w14 wp14 w15" );
1973 bool bNeedsLastParaId)
1979 sal_Int32 nParaId = 0;
1980 for( sal_Int32
n = 0;
n < nPara; ++
n )
1986 bNeedsLastParaId &&
n == nPara - 1);
1989 sal_Int32 nCurrentPos = 0;
1990 const sal_Int32 nEnd =
aStr.getLength();
2003 bool bTextAtr = aAttrIter.
IsTextAttr( nCurrentPos );
2006 if( nCurrentPos == 0 && nNextAttr - nCurrentPos ==
aStr.getLength())
2010 OUString tmp(
aStr.copy( nCurrentPos, nNextAttr - nCurrentPos ));
2015 aAttrIter.
OutAttr( nCurrentPos );
2018 nCurrentPos = nNextAttr;
2019 eChrSet = eNextChrSet;
2024 }
while( nCurrentPos < nEnd );
2036 sal_Int32 nWordCompatibilityMode = -1;
2038 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
2041 uno::Sequence< beans::PropertyValue > propList;
2044 for (
const auto& rProp : std::as_const(propList))
2046 if (rProp.Name ==
"CompatSettings")
2048 css::uno::Sequence< css::beans::PropertyValue > aCurrentCompatSettings;
2049 rProp.Value >>= aCurrentCompatSettings;
2051 for (
const auto& rCurrentCompatSetting : std::as_const(aCurrentCompatSettings))
2053 uno::Sequence< beans::PropertyValue > aCompatSetting;
2054 rCurrentCompatSetting.Value >>= aCompatSetting;
2060 for (
const auto& rPropVal : std::as_const(aCompatSetting))
2062 if ( rPropVal.Name ==
"name" ) rPropVal.Value >>=
sName;
2063 if ( rPropVal.Name ==
"uri" ) rPropVal.Value >>= sUri;
2064 if ( rPropVal.Name ==
"val" ) rPropVal.Value >>= sVal;
2067 if (
sName ==
"compatibilityMode" && sUri ==
"http://schemas.microsoft.com/office/word")
2069 const sal_Int32 nValidMode = sVal.toInt32();
2071 if (nValidMode > 10 && nValidMode > nWordCompatibilityMode)
2072 nWordCompatibilityMode = nValidMode;
2080 return nWordCompatibilityMode;
2089 std::shared_ptr<SwUnoCursor> & pCurrentPam,
2090 SwPaM& rOriginalPam,
bool bDocm,
bool bTemplate)
2092 m_rFilter( rFilter ),
2096 m_nActiveXControls( 0 ),
2097 m_nHeadersFootersInSection(0),
2099 m_bTemplate(bTemplate),
2107 u"word/document.xml" );
2110 OUString aMediaType;
2115 aMediaType =
"application/vnd.ms-word.template.macroEnabledTemplate.main+xml";
2119 aMediaType =
"application/vnd.ms-word.document.macroEnabled.main+xml";
2126 aMediaType =
"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml";
2130 aMediaType =
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
2159: evenAndOddHeaders( false )
2160, defaultTabStop( 0 )
2161, revisionView( true )
2162, 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 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
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
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)
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)