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"))
614 SAL_INFO(
"sw.ww8",
"TODO DocxExport::OutputGrfNode( const SwGrfNode& )" );
619 SAL_INFO(
"sw.ww8",
"TODO DocxExport::OutputOLENode( const SwOLENode& )" );
636 const SwPageDesc* pNewPgDesc,
bool bExtraPageBreak )
645 OSL_ENSURE( pNewPgDescFormat || pNewPgDesc,
"Neither page desc format nor page desc provided." );
647 if ( pNewPgDescFormat )
649 m_pSections->AppendSection( *pNewPgDescFormat, rNd, pFormat, nLnNm );
651 else if ( pNewPgDesc )
653 m_pSections->AppendSection( pNewPgDesc, rNd, pFormat, nLnNm );
669 "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" );
680 pStylesFS->endDocument();
694 "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" );
711 pFootnotesFS->endDocument();
724 "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" );
741 pEndnotesFS->endDocument();
755 "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" );
759 const auto eHasProperties =
m_pAttrOutput->WritePostitFields();
761 pPostitFS->endElementNS( XML_w, XML_comments );
762 pPostitFS->endDocument();
769 u"commentsExtended.xml");
772 "word/commentsExtended.xml",
773 "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml");
775 pPostitFS->startElementNS(XML_w15, XML_commentsEx,
778 FSNS(XML_mc, XML_Ignorable),
"w15");
782 pPostitFS->endElementNS(XML_w15, XML_commentsEx);
783 pPostitFS->endDocument();
796 "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" );
802 pNumberingFS->startElementNS( XML_w, XML_numbering,
809 FSNS( XML_mc, XML_Ignorable ),
"w14" );
817 pNumberingFS->endElementNS( XML_w, XML_numbering );
823 pNumberingFS->endDocument();
833 OUString
aName(
"header" + OUString::number( ++
m_nHeaders ) +
".xml" );
840 "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" );
846 OUString
aName(
"footer" + OUString::number( ++
m_nFooters ) +
".xml" );
853 "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" );
866 if (pFormat ==
nullptr)
880 sal_Int32 nReference;
883 pFS->endElementNS( XML_w, XML_hdr );
884 nReference = XML_headerReference;
888 pFS->endElementNS( XML_w, XML_ftr );
889 nReference = XML_footerReference;
895 FSNS( XML_r, XML_id ), aRelId );
907 "word/fontTable.xml",
908 "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" );
910 pFS->startElementNS( XML_w, XML_fonts,
923 pFS->endElementNS( XML_w, XML_fonts );
932 uno::Reference<document::XDocumentProperties> xDocProps;
933 bool bSecurityOptOpenReadOnly =
false;
936 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
937 pDocShell->
GetModel( ), uno::UNO_QUERY );
938 xDocProps = xDPS->getDocumentProperties();
953 uno::Reference<text::XTextFieldsSupplier>
xModel(pDocShell->
GetModel(), uno::UNO_QUERY);
954 uno::Reference<container::XNameAccess> xTextFieldMasters =
xModel->getTextFieldMasters();
955 uno::Sequence<rtl::OUString> aMasterNames = xTextFieldMasters->getElementNames();
956 if (!aMasterNames.hasElements())
962 bool bStarted =
false;
963 constexpr OUStringLiteral aPrefix(
u"com.sun.star.text.fieldmaster.User.");
964 for (
const auto& rMasterName : std::as_const(aMasterNames))
966 if (!rMasterName.startsWith(aPrefix))
972 uno::Reference<beans::XPropertySet> xField;
973 xTextFieldMasters->getByName(rMasterName) >>= xField;
979 OUString aKey = rMasterName.copy(aPrefix.getLength());
981 xField->getPropertyValue(
"Content") >>= aValue;
985 pFS->startElementNS(XML_w, XML_docVars);
987 pFS->singleElementNS(XML_w, XML_docVar,
FSNS(XML_w, XML_name), aKey,
988 FSNS(XML_w, XML_val), aValue);
993 pFS->endElementNS(XML_w, XML_docVars);
999 sal_Int32 & rTargetCompatibilityMode) ->
void
1003 rpFS->singleElementNS(XML_w, XML_noLeading);
1004 if (rTargetCompatibilityMode > 14)
1006 rTargetCompatibilityMode = 14;
1012 rpFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn);
1016 rpFS->singleElementNS(XML_w, XML_usePrinterMetrics);
1032 "word/settings.xml",
1033 "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" );
1035 pFS->startElementNS( XML_w, XML_settings,
1040 if (aInfo.hasElements())
1042 OUString sAlgorithm, sSalt,
sHash;
1044 for (
const auto& prop : aInfo)
1046 if (prop.Name ==
"algorithm-name")
1047 prop.Value >>= sAlgorithm;
1048 else if (prop.Name ==
"salt")
1049 prop.Value >>= sSalt;
1050 else if (prop.Name ==
"iteration-count")
1052 else if (prop.Name ==
"hash")
1053 prop.Value >>=
sHash;
1055 if (!sAlgorithm.isEmpty() && !sSalt.isEmpty() && !
sHash.isEmpty())
1057 sal_Int32 nAlgorithmSid = 0;
1058 if (sAlgorithm ==
"MD2")
1060 else if (sAlgorithm ==
"MD4")
1062 else if (sAlgorithm ==
"MD5")
1064 else if (sAlgorithm ==
"SHA-1")
1066 else if (sAlgorithm ==
"MAC")
1068 else if (sAlgorithm ==
"RIPEMD")
1070 else if (sAlgorithm ==
"RIPEMD-160")
1072 else if (sAlgorithm ==
"HMAC")
1074 else if (sAlgorithm ==
"SHA-256")
1076 else if (sAlgorithm ==
"SHA-384")
1078 else if (sAlgorithm ==
"SHA-512")
1081 if (nAlgorithmSid != 0)
1082 pFS->singleElementNS(XML_w, XML_writeProtection,
1083 FSNS(XML_w, XML_cryptProviderType),
"rsaAES",
1084 FSNS(XML_w, XML_cryptAlgorithmClass),
"hash",
1085 FSNS(XML_w, XML_cryptAlgorithmType),
"typeAny",
1086 FSNS(XML_w, XML_cryptAlgorithmSid), OString::number(nAlgorithmSid).getStr(),
1087 FSNS(XML_w, XML_cryptSpinCount), OString::number(
nCount).getStr(),
1088 FSNS(XML_w, XML_hash),
sHash.toUtf8().getStr(),
1089 FSNS(XML_w, XML_salt), sSalt.toUtf8().getStr());
1096 pFS->singleElementNS(XML_w, XML_view,
FSNS(XML_w, XML_val),
"web");
1107 case SvxZoomType::WHOLEPAGE:
1108 pAttributeList->add(
FSNS(XML_w, XML_val),
"fullPage");
1110 case SvxZoomType::PAGEWIDTH:
1111 pAttributeList->add(
FSNS(XML_w, XML_val),
"bestFit");
1113 case SvxZoomType::OPTIMAL:
1114 pAttributeList->add(
FSNS(XML_w, XML_val),
"textFit");
1121 pAttributeList->add(
FSNS(XML_w, XML_percent), aZoom);
1122 pFS->singleElementNS(XML_w, XML_zoom, pAttributeList);
1126 if (std::unique_ptr<SvxBrushItem> oBrush =
getBackground(); oBrush)
1129 pFS->singleElementNS(XML_w, XML_displayBackgroundShape);
1134 pFS->singleElementNS( XML_w, XML_revisionView,
1135 FSNS( XML_w, XML_insDel ),
"0",
1136 FSNS( XML_w, XML_formatting ),
"0" );
1139 pFS->singleElementNS(XML_w, XML_trackRevisions);
1143 pFS->singleElementNS(XML_w, XML_mirrorMargins);
1147 pFS->singleElementNS(XML_w, XML_gutterAtTop);
1152 pFS->singleElementNS(XML_w, XML_embedTrueTypeFonts);
1156 pFS->singleElementNS(XML_w, XML_embedSystemFonts);
1160 pFS->singleElementNS( XML_w, XML_defaultTabStop,
FSNS( XML_w, XML_val ),
1165 if ( !
aData.sDataSource.isEmpty() &&
aData.nCommandType == css::sdb::CommandType::TABLE && !
aData.sCommand.isEmpty() )
1167 OUString sDataSource =
1173 pFS->startElementNS( XML_w, XML_mailMerge );
1174 pFS->singleElementNS(XML_w, XML_mainDocumentType,
1175 FSNS( XML_w, XML_val ),
"formLetters" );
1176 pFS->singleElementNS(XML_w, XML_dataType,
1177 FSNS( XML_w, XML_val ),
"textFile" );
1178 pFS->singleElementNS( XML_w, XML_query,
1180 pFS->endElementNS( XML_w, XML_mailMerge );
1185 pFS->singleElementNS(XML_w, XML_autoHyphenation,
FSNS(XML_w, XML_val),
"true");
1193 pFS->singleElementNS(XML_w, XML_doNotHyphenateCaps);
1196 pFS->singleElementNS(XML_w, XML_hyphenationZone,
FSNS(XML_w, XML_val),
1197 OString::number(nHyphenZone));
1202 pFS->singleElementNS(XML_w, XML_evenAndOddHeaders);
1213 uno::Reference< beans::XPropertySet > xPropSet( pDocShell->
GetBaseModel(), uno::UNO_QUERY_THROW );
1215 bool bUseGrabBagProtection =
false;
1216 bool bWriterWantsToProtect =
false;
1217 bool bWriterWantsToProtectForm =
false;
1218 bool bWriterWantsToProtectRedline =
false;
1219 bool bHasDummyRedlineProtectionKey =
false;
1220 bool bReadOnlyStatusUnchanged =
true;
1221 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1225 bWriterWantsToProtect = bWriterWantsToProtectForm =
true;
1227 if ( xPropSetInfo->hasPropertyByName(
"RedlineProtectionKey" ) )
1229 uno::Sequence<sal_Int8> aKey;
1230 xPropSet->getPropertyValue(
"RedlineProtectionKey" ) >>= aKey;
1231 bool bHasRedlineProtectionKey = aKey.hasElements();
1232 bHasDummyRedlineProtectionKey = aKey.getLength() == 1 && aKey[0] == 1;
1233 if ( bHasRedlineProtectionKey && !bHasDummyRedlineProtectionKey )
1234 bWriterWantsToProtect = bWriterWantsToProtectRedline =
true;
1252 sal_Int32 nTargetCompatibilityMode = 15;
1253 bool bHasCompatibilityMode =
false;
1255 if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) )
1257 uno::Sequence< beans::PropertyValue > propList;
1258 xPropSet->getPropertyValue( aGrabBagName ) >>= propList;
1260 for(
const auto& rProp : std::as_const(propList) )
1262 if ( rProp.Name ==
"ThemeFontLangProps" )
1264 uno::Sequence< beans::PropertyValue > themeFontLangProps;
1265 rProp.Value >>= themeFontLangProps;
1266 OUString aValues[3];
1267 for(
const auto& rThemeFontLangProp : std::as_const(themeFontLangProps) )
1269 if( rThemeFontLangProp.Name ==
"val" )
1270 rThemeFontLangProp.Value >>= aValues[0];
1271 else if( rThemeFontLangProp.Name ==
"eastAsia" )
1272 rThemeFontLangProp.Value >>= aValues[1];
1273 else if( rThemeFontLangProp.Name ==
"bidi" )
1274 rThemeFontLangProp.Value >>= aValues[2];
1276 pFS->singleElementNS( XML_w, XML_themeFontLang,
1277 FSNS( XML_w, XML_val ), aValues[0],
1278 FSNS( XML_w, XML_eastAsia ), aValues[1],
1279 FSNS( XML_w, XML_bidi ), aValues[2] );
1281 else if ( rProp.Name ==
"CompatSettings" )
1283 pFS->startElementNS(XML_w, XML_compat);
1287 uno::Sequence< beans::PropertyValue > aCompatSettingsSequence;
1288 rProp.Value >>= aCompatSettingsSequence;
1290 for(
const auto& rCompatSetting : std::as_const(aCompatSettingsSequence))
1292 uno::Sequence< beans::PropertyValue > aCompatSetting;
1293 rCompatSetting.Value >>= aCompatSetting;
1298 for(
const auto& rPropVal : std::as_const(aCompatSetting))
1300 if( rPropVal.Name ==
"name" )
1301 rPropVal.Value >>=
aName;
1302 else if( rPropVal.Name ==
"uri" )
1303 rPropVal.Value >>= aUri;
1304 else if( rPropVal.Name ==
"val" )
1305 rPropVal.Value >>= aValue;
1307 if (
aName ==
"compatibilityMode" )
1309 bHasCompatibilityMode =
true;
1315 if ( aValue.toInt32() > nTargetCompatibilityMode )
1316 aValue = OUString::number(nTargetCompatibilityMode);
1319 pFS->singleElementNS( XML_w, XML_compatSetting,
1321 FSNS( XML_w, XML_uri ), aUri,
1322 FSNS( XML_w, XML_val ), aValue);
1325 if ( !bHasCompatibilityMode )
1327 pFS->singleElementNS( XML_w, XML_compatSetting,
1328 FSNS( XML_w, XML_name ),
"compatibilityMode",
1329 FSNS( XML_w, XML_uri ),
"http://schemas.microsoft.com/office/word",
1330 FSNS( XML_w, XML_val ), OString::number(nTargetCompatibilityMode));
1331 bHasCompatibilityMode =
true;
1334 pFS->endElementNS( XML_w, XML_compat );
1336 else if (rProp.Name ==
"DocumentProtection")
1338 uno::Sequence< beans::PropertyValue > rAttributeList;
1339 rProp.Value >>= rAttributeList;
1341 if (rAttributeList.hasElements())
1344 bool bIsProtectionTrackChanges =
false;
1346 bool bEnforced =
false;
1347 for (
const auto& rAttribute : std::as_const(rAttributeList))
1351 {
"edit", XML_edit },
1352 {
"enforcement", XML_enforcement },
1353 {
"formatting", XML_formatting },
1354 {
"cryptProviderType", XML_cryptProviderType },
1355 {
"cryptAlgorithmClass", XML_cryptAlgorithmClass },
1356 {
"cryptAlgorithmType", XML_cryptAlgorithmType },
1357 {
"cryptAlgorithmSid", XML_cryptAlgorithmSid },
1358 {
"cryptSpinCount", XML_cryptSpinCount },
1359 {
"hash", XML_hash },
1360 {
"salt", XML_salt },
1366 OUString sValue = rAttribute.Value.get<OUString>();
1367 xAttributeList->add(
FSNS(XML_w,
nToken), sValue.toUtf8());
1368 if (
nToken == XML_edit && sValue ==
"trackedChanges" )
1369 bIsProtectionTrackChanges =
true;
1370 else if (
nToken == XML_edit && sValue ==
"readOnly" )
1375 else if (
nToken == XML_enforcement )
1376 bEnforced = sValue.toBoolean();
1384 bUseGrabBagProtection = !bWriterWantsToProtect;
1391 bUseGrabBagProtection = (!bIsProtectionTrackChanges || bHasDummyRedlineProtectionKey)
1392 && bReadOnlyStatusUnchanged;
1395 if ( bUseGrabBagProtection )
1397 pFS->singleElementNS(XML_w, XML_documentProtection, xAttributeList);
1402 else if (rProp.Name ==
"HyphenationZone")
1404 sal_Int16 nHyphenationZone = *o3tl::doAccess<sal_Int16>(rProp.Value);
1405 if (nHyphenationZone > 0)
1406 pFS->singleElementNS(XML_w, XML_hyphenationZone,
FSNS(XML_w, XML_val),
1407 OString::number(nHyphenationZone));
1411 if ( !bHasCompatibilityMode )
1413 pFS->startElementNS(XML_w, XML_compat);
1417 pFS->singleElementNS( XML_w, XML_compatSetting,
1418 FSNS( XML_w, XML_name ),
"compatibilityMode",
1419 FSNS( XML_w, XML_uri ),
"http://schemas.microsoft.com/office/word",
1420 FSNS( XML_w, XML_val ), OString::number(nTargetCompatibilityMode));
1421 pFS->endElementNS( XML_w, XML_compat );
1426 if ( !bUseGrabBagProtection )
1430 if ( bWriterWantsToProtectForm )
1434 pFS->singleElementNS(XML_w, XML_documentProtection,
1435 FSNS(XML_w, XML_edit),
"forms",
1436 FSNS(XML_w, XML_enforcement),
"true");
1439 else if ( bWriterWantsToProtectRedline )
1443 pFS->singleElementNS(XML_w, XML_documentProtection,
1444 FSNS(XML_w, XML_edit),
"trackedChanges",
1445 FSNS(XML_w, XML_enforcement),
"1");
1450 pFS->endElementNS( XML_w, XML_settings );
1459 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1461 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1464 uno::Reference<xml::dom::XDocument> themeDom;
1465 uno::Sequence< beans::PropertyValue > propList;
1466 xPropSet->getPropertyValue(
aName ) >>= propList;
1467 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1468 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXTheme"; });
1469 if (pProp != std::cend(propList))
1470 pProp->Value >>= themeDom;
1473 if ( !themeDom.is() )
1478 u"theme/theme1.xml" );
1480 uno::Reference< xml::sax::XSAXSerializable > serializer( themeDom, uno::UNO_QUERY );
1482 writer->setOutputStream(
GetFilter().openFragmentStream(
"word/theme/theme1.xml",
1483 "application/vnd.openxmlformats-officedocument.theme+xml" ) );
1484 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1485 uno::Sequence< beans::StringPair >() );
1493 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1495 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1498 uno::Reference<xml::dom::XDocument> glossaryDocDom;
1499 uno::Sequence< uno::Sequence<beans::NamedValue> > glossaryDomList;
1500 uno::Sequence< beans::PropertyValue > propList;
1501 xPropSet->getPropertyValue(
aName ) >>= propList;
1502 sal_Int32 collectedProperties = 0;
1503 for (
const auto& rProp : std::as_const(propList) )
1505 OUString propName = rProp.Name;
1506 if ( propName ==
"OOXGlossary" )
1508 rProp.Value >>= glossaryDocDom;
1509 collectedProperties++;
1511 if (propName ==
"OOXGlossaryDom")
1513 rProp.Value >>= glossaryDomList;
1514 collectedProperties++;
1516 if (collectedProperties == 2)
1521 if ( !glossaryDocDom.is() )
1526 u"glossary/document.xml" );
1529 "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml" );
1531 uno::Reference< xml::sax::XSAXSerializable > serializer( glossaryDocDom, uno::UNO_QUERY );
1533 writer->setOutputStream( xOutputStream );
1534 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1535 uno::Sequence< beans::StringPair >() );
1537 for (
const uno::Sequence<beans::NamedValue>& glossaryElement : glossaryDomList)
1539 OUString gTarget, gType, gId, contentType, targetMode;
1540 uno::Reference<xml::dom::XDocument> xDom;
1541 for (
const auto& [
name,
value] : glossaryElement)
1545 else if (
name ==
"Type")
1547 else if (
name ==
"Target")
1549 else if (
name ==
"TargetMode")
1550 value >>= targetMode;
1551 else if (
name ==
"_contentType")
1552 value >>= contentType;
1553 else if (
name ==
"_relDom")
1556 if (gId.isEmpty() || gType.isEmpty() || gTarget.isEmpty())
1558 const bool bExternal = targetMode ==
"External";
1559 if (!bExternal && !xDom)
1563 SAL_WARN(
"sw.ww8",
"Glossary internal relation without DOM: Id=\"" + gId
1564 +
"\" Type=\"" + gType +
"\" Target=\"" + gTarget +
"\"");
1569 PropertySet aProps(xOutputStream);
1570 aProps.setAnyProperty( PROP_RelId,
uno::Any( gId.toInt32() ));
1574 uno::Reference< xml::sax::XSAXSerializable > gserializer( xDom, uno::UNO_QUERY );
1575 writer->setOutputStream(
GetFilter().openFragmentStream(
"word/glossary/" + gTarget, contentType ) );
1576 gserializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1577 uno::Sequence< beans::StringPair >() );
1582 class XsltTransformListener :
public ::cppu::WeakImplHelper<io::XStreamListener>
1585 XsltTransformListener() : m_bDone(false) {}
1588 std::unique_lock<std::mutex> g(m_mutex);
1589 m_cond.wait(g, [
this]() {
return m_bDone; });
1594 std::condition_variable m_cond;
1597 virtual void SAL_CALL disposing(
const lang::EventObject&)
noexcept override {}
1598 virtual void SAL_CALL started() noexcept
override {}
1599 virtual void SAL_CALL closed() noexcept
override { notifyDone(); }
1600 virtual void SAL_CALL terminated() noexcept
override { notifyDone(); }
1601 virtual void SAL_CALL error(
const uno::Any& e)
override
1608 std::scoped_lock<std::mutex> g(m_mutex);
1610 m_cond.notify_all();
1615static void lcl_UpdateXmlValues(
const SdtData& sdtData,
const uno::Reference<css::io::XInputStream>& xInputStream,
const uno::Reference<css::io::XOutputStream>& xOutputStream)
1617 uno::Sequence<uno::Any> aArgs{
1621 uno::Any(beans::NamedValue(
"StylesheetText",
uno::Any(OUString(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?> \
1623 xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\
1626 <xsl:template match=\"@* | node()\">\
1628 <xsl:apply-templates select=\"@* | node()\"/>\
1631 <xsl:template match = \"" + sdtData.
xpath +
"\">\
1633 <xsl:text>" + sdtData.
data +
"</xsl:text>\
1640 css::uno::Reference<css::xml::xslt::XXSLTTransformer> xTransformer =
1642 xTransformer->setInputStream(xInputStream);
1643 xTransformer->setOutputStream(xOutputStream);
1646 xTransformer->addListener(xListener);
1648 xTransformer->start();
1656 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1660 uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomlist;
1661 uno::Sequence<uno::Reference<xml::dom::XDocument> > customXmlDomPropslist;
1662 uno::Sequence< beans::PropertyValue > propList;
1664 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1665 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXCustomXml"; });
1666 if (pProp != std::cend(propList))
1667 pProp->Value >>= customXmlDomlist;
1669 pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1670 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXCustomXmlProps"; });
1671 if (pProp != std::cend(propList))
1672 pProp->Value >>= customXmlDomPropslist;
1674 for (sal_Int32 j = 0; j < customXmlDomlist.getLength(); j++)
1676 uno::Reference<xml::dom::XDocument> customXmlDom = customXmlDomlist[j];
1677 uno::Reference<xml::dom::XDocument> customXmlDomProps = customXmlDomPropslist[j];
1678 if (customXmlDom.is())
1682 Concat2View(
"../customXml/item"+OUString::number(j+1)+
".xml" ));
1684 uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDom, uno::UNO_QUERY );
1687 uno::Reference < css::io::XOutputStream > xOutStream =
GetFilter().
openFragmentStream(
"customXml/item" + OUString::number(j + 1) +
".xml",
1692 uno::Reference< io::XStream > xMemStream(
1695 uno::UNO_QUERY_THROW);
1697 writer->setOutputStream(xMemStream->getOutputStream());
1699 serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
1700 uno::Sequence< beans::StringPair >());
1702 uno::Reference< io::XStream > xXSLTInStream = xMemStream;
1703 uno::Reference< io::XStream > xXSLTOutStream;
1719 uno::UNO_QUERY_THROW);
1722 xXSLTInStream.set( xXSLTOutStream );
1729 writer->setOutputStream(xOutStream);
1731 serializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(writer, uno::UNO_QUERY_THROW),
1732 uno::Sequence< beans::StringPair >());
1736 if (customXmlDomProps.is())
1738 uno::Reference< xml::sax::XSAXSerializable > serializer( customXmlDomProps, uno::UNO_QUERY );
1740 writer->setOutputStream(
GetFilter().openFragmentStream(
"customXml/itemProps"+OUString::number(j+1)+
".xml",
1741 "application/vnd.openxmlformats-officedocument.customXmlProperties+xml" ) );
1742 serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ),
1743 uno::Sequence< beans::StringPair >() );
1747 "application/xml" ) ,
1749 Concat2View(
"itemProps"+OUString::number(j+1)+
".xml" ));
1757 if (!xStorageBasedDocument.is())
1760 uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage();
1761 OUString aMacrosName(
"_MS_VBA_Macros");
1762 if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName))
1765 const sal_Int32 nOpenMode = embed::ElementModes::READ;
1766 uno::Reference<io::XStream> xMacrosStream = xDocumentStorage->openStreamElement(aMacrosName, nOpenMode);
1767 uno::Reference<io::XOutputStream> xProjectStream;
1768 if (xMacrosStream.is())
1774 uno::Reference<io::XStream> xOutputStream(xProjectStream, uno::UNO_QUERY);
1775 if (!xOutputStream.is())
1780 pOut->WriteStream(*pIn);
1786 OUString aDataName(
"_MS_VBA_Macros_XML");
1787 if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aDataName))
1790 uno::Reference<io::XStream> xDataStream = xDocumentStorage->openStreamElement(aDataName, nOpenMode);
1791 if (!xDataStream.is())
1798 uno::Reference<io::XStream> xOutputStream(
GetFilter().openFragmentStream(
"word/vbaData.xml",
"application/vnd.ms-word.vbaData+xml"), uno::UNO_QUERY);
1799 if (!xOutputStream.is())
1804 pOut->WriteStream(*pIn);
1807 if (!xProjectStream.is())
1817 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1819 if ( !xPropSetInfo->hasPropertyByName(
aName ) )
1822 uno::Sequence< beans::PropertyValue > embeddingsList;
1823 uno::Sequence< beans::PropertyValue > propList;
1824 xPropSet->getPropertyValue(
aName ) >>= propList;
1825 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
1826 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"OOXEmbeddings"; });
1827 if (pProp != std::cend(propList))
1828 pProp->Value >>= embeddingsList;
1829 for (
const auto& rEmbedding : std::as_const(embeddingsList))
1831 OUString embeddingPath = rEmbedding.Name;
1832 uno::Reference<io::XInputStream> embeddingsStream;
1833 rEmbedding.Value >>= embeddingsStream;
1834 if (!embeddingsStream)
1837 OUString contentType;
1838 if (css::uno::Reference<css::beans::XPropertySet> xProps{ embeddingsStream,
1839 css::uno::UNO_QUERY })
1843 const css::uno::Any val = xProps->getPropertyValue(
"MediaType");
1844 val >>= contentType;
1846 catch (
const css::beans::UnknownPropertyException&)
1852 if (contentType.isEmpty())
1855 if (embeddingPath.endsWith(
".xlsm"))
1856 contentType =
"application/vnd.ms-excel.sheet.macroEnabled.12";
1857 else if (embeddingPath.endsWith(
".bin"))
1858 contentType =
"application/vnd.openxmlformats-officedocument.oleObject";
1860 contentType =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
1868 uno::Reference<io::XSeekable> xSeekable(embeddingsStream, uno::UNO_QUERY);
1873 catch(
const uno::Exception&)
1875 TOOLS_WARN_EXCEPTION(
"sw.ww8",
"WriteEmbeddings() ::Failed to copy Inputstream to outputstream exception caught");
1877 xOutStream->closeOutput();
1883 bool bMirroredMargins =
false;
1886 bMirroredMargins =
true;
1888 return bMirroredMargins;
1896 if ( getenv(
"SW_DEBUG_DOM") )
1906 if (std::unique_ptr<SvxBrushItem> oBrush =
getBackground(); oBrush)
1908 Color backgroundColor = oBrush->GetColor();
1912 aBackgroundColorStr);
1952 pAttr->add(
FSNS( XML_mc, XML_Ignorable ),
"w14 wp14 w15" );
1966 bool bNeedsLastParaId)
1972 sal_Int32 nParaId = 0;
1973 for( sal_Int32
n = 0;
n < nPara; ++
n )
1979 bNeedsLastParaId &&
n == nPara - 1);
1982 sal_Int32 nCurrentPos = 0;
1983 const sal_Int32 nEnd =
aStr.getLength();
1996 bool bTextAtr = aAttrIter.
IsTextAttr( nCurrentPos );
1999 if( nCurrentPos == 0 && nNextAttr - nCurrentPos ==
aStr.getLength())
2003 OUString tmp(
aStr.copy( nCurrentPos, nNextAttr - nCurrentPos ));
2008 aAttrIter.
OutAttr( nCurrentPos );
2011 nCurrentPos = nNextAttr;
2012 eChrSet = eNextChrSet;
2017 }
while( nCurrentPos < nEnd );
2029 sal_Int32 nWordCompatibilityMode = -1;
2031 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
2034 uno::Sequence< beans::PropertyValue > propList;
2037 for (
const auto& rProp : std::as_const(propList))
2039 if (rProp.Name ==
"CompatSettings")
2041 css::uno::Sequence< css::beans::PropertyValue > aCurrentCompatSettings;
2042 rProp.Value >>= aCurrentCompatSettings;
2044 for (
const auto& rCurrentCompatSetting : std::as_const(aCurrentCompatSettings))
2046 uno::Sequence< beans::PropertyValue > aCompatSetting;
2047 rCurrentCompatSetting.Value >>= aCompatSetting;
2053 for (
const auto& rPropVal : std::as_const(aCompatSetting))
2055 if ( rPropVal.Name ==
"name" ) rPropVal.Value >>=
sName;
2056 if ( rPropVal.Name ==
"uri" ) rPropVal.Value >>= sUri;
2057 if ( rPropVal.Name ==
"val" ) rPropVal.Value >>= sVal;
2060 if (
sName ==
"compatibilityMode" && sUri ==
"http://schemas.microsoft.com/office/word")
2062 const sal_Int32 nValidMode = sVal.toInt32();
2064 if (nValidMode > 10 && nValidMode > nWordCompatibilityMode)
2065 nWordCompatibilityMode = nValidMode;
2073 return nWordCompatibilityMode;
2082 std::shared_ptr<SwUnoCursor> & pCurrentPam,
2083 SwPaM& rOriginalPam,
bool bDocm,
bool bTemplate)
2085 m_rFilter( rFilter ),
2089 m_nActiveXControls( 0 ),
2090 m_nHeadersFootersInSection(0),
2092 m_bTemplate(bTemplate),
2100 u"word/document.xml" );
2103 OUString aMediaType;
2108 aMediaType =
"application/vnd.ms-word.template.macroEnabledTemplate.main+xml";
2112 aMediaType =
"application/vnd.ms-word.document.macroEnabled.main+xml";
2119 aMediaType =
"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml";
2123 aMediaType =
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml";
2152: evenAndOddHeaders( false )
2153, defaultTabStop( 0 )
2154, revisionView( true )
2155, trackRevisions( false )
@ DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
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.
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
void dumpAsXml(xmlTextWriterPtr=nullptr) const
Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by...
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)
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 void PushExportGraphics()
static void PopExportGraphics()
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< SwTextGridItem > RES_TEXTGRID(115)
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
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)