48 #include <oox/token/namespaces.hxx>
49 #include <oox/token/tokens.hxx>
104 #include <tools/datetime.hxx>
107 #include <rtl/tencinfo.h>
120 #include <lineinfo.hxx>
142 #include <osl/file.hxx>
146 #include <com/sun/star/i18n/ScriptType.hpp>
147 #include <com/sun/star/i18n/XBreakIterator.hpp>
148 #include <com/sun/star/chart2/XChartDocument.hpp>
149 #include <com/sun/star/drawing/ShadingPattern.hpp>
150 #include <com/sun/star/text/GraphicCrop.hpp>
151 #include <com/sun/star/embed/EmbedStates.hpp>
152 #include <com/sun/star/embed/Aspects.hpp>
157 #include <string_view>
160 #include <unicode/regex.h>
162 using ::editeng::SvxBorderLine;
165 using namespace docx;
192 class FFDataWriterHelper
195 void writeCommonStart(
const OUString& rName,
196 const OUString& rEntryMacro,
197 const OUString& rExitMacro,
198 const OUString& rHelp,
199 const OUString& rHint )
201 m_pSerializer->startElementNS(XML_w, XML_ffData);
202 m_pSerializer->singleElementNS(XML_w, XML_name,
FSNS(XML_w, XML_val), rName);
203 m_pSerializer->singleElementNS(XML_w, XML_enabled);
204 m_pSerializer->singleElementNS(XML_w, XML_calcOnExit,
FSNS(XML_w, XML_val),
"0");
206 if ( !rEntryMacro.isEmpty() )
207 m_pSerializer->singleElementNS( XML_w, XML_entryMacro,
208 FSNS(XML_w, XML_val), rEntryMacro );
210 if ( !rExitMacro.isEmpty() )
211 m_pSerializer->singleElementNS(XML_w, XML_exitMacro,
FSNS(XML_w, XML_val), rExitMacro);
213 if ( !rHelp.isEmpty() )
214 m_pSerializer->singleElementNS( XML_w, XML_helpText,
216 FSNS(XML_w, XML_val), rHelp );
218 if ( !rHint.isEmpty() )
219 m_pSerializer->singleElementNS( XML_w, XML_statusText,
221 FSNS(XML_w, XML_val), rHint );
226 m_pSerializer->endElementNS( XML_w, XML_ffData );
230 void WriteFormCheckbox(
const OUString& rName,
231 const OUString& rEntryMacro,
232 const OUString& rExitMacro,
233 const OUString& rHelp,
234 const OUString& rHint,
237 writeCommonStart( rName, rEntryMacro, rExitMacro, rHelp, rHint );
239 m_pSerializer->startElementNS(XML_w, XML_checkBox);
242 m_pSerializer->startElementNS(XML_w, XML_sizeAuto);
243 m_pSerializer->endElementNS( XML_w, XML_sizeAuto );
245 m_pSerializer->singleElementNS(XML_w, XML_checked);
246 m_pSerializer->endElementNS( XML_w, XML_checkBox );
250 void WriteFormText(
const OUString& rName,
251 const OUString& rEntryMacro,
252 const OUString& rExitMacro,
253 const OUString& rHelp,
254 const OUString& rHint,
255 const OUString& rType,
256 const OUString& rDefaultText,
257 sal_uInt16 nMaxLength,
258 const OUString& rFormat )
260 writeCommonStart( rName, rEntryMacro, rExitMacro, rHelp, rHint );
262 m_pSerializer->startElementNS(XML_w, XML_textInput);
263 if ( !rType.isEmpty() )
264 m_pSerializer->singleElementNS(XML_w,
XML_type,
FSNS(XML_w, XML_val), rType);
265 if ( !rDefaultText.isEmpty() )
266 m_pSerializer->singleElementNS(XML_w, XML_default,
FSNS(XML_w, XML_val), rDefaultText);
268 m_pSerializer->singleElementNS( XML_w, XML_maxLength,
269 FSNS(XML_w, XML_val), OString::number(nMaxLength) );
270 if ( !rFormat.isEmpty() )
271 m_pSerializer->singleElementNS(XML_w, XML_format,
FSNS(XML_w, XML_val), rFormat);
272 m_pSerializer->endElementNS( XML_w, XML_textInput );
278 class FieldMarkParamsHelper
282 explicit FieldMarkParamsHelper(
const sw::mark::IFieldmark& rFieldmark ) : mrFieldmark( rFieldmark ) {}
283 OUString
const & getName()
const {
return mrFieldmark.
GetName(); }
284 template <
typename T >
285 bool extractParam(
const OUString& rKey, T& rResult )
287 bool bResult =
false;
290 sw::mark::IFieldmark::parameter_map_t::const_iterator it = mrFieldmark.
GetParameters()->find( rKey );
292 bResult = ( it->second >>= rResult );
299 OUString NumberToHexBinary(sal_Int32
n)
303 return aBuf.makeStringAndClear();
311 m_pSerializer->singleElementNS(XML_w, XML_rtl,
FSNS(XML_w, XML_val),
"true");
317 return rName ==
u"Title" || rName ==
u"Subtitle" || rName ==
u"Company";
323 pAttrList = FastSerializerHelper::createAttrList();
326 va_start(args, nAttrs);
327 for (sal_Int32
i = 0;
i < nAttrs;
i++)
329 sal_Int32 nName = va_arg(args, sal_Int32);
330 const char* pValue = va_arg(args,
const char*);
332 pAttrList->add(nName, pValue);
346 m_aFloatingTablesOfParagraph.insert(&rFrameFormat);
357 m_rExport.SetFloatingTableFrame(pParentFrame);
358 m_rExport.m_pParentFrame =
nullptr;
360 GetExport().WriteText();
362 m_rExport.SetFloatingTableFrame(
nullptr);
372 ++m_nCloseContentControlInThisRun;
377 const auto& rExport = rDocxAttributeOutput.
GetExport();
379 for( sal_uInt16 nCnt = rExport.m_rDoc.GetSpzFrameFormats()->size(); nCnt; )
381 const SwFrameFormat* pFrameFormat = (*rExport.m_rDoc.GetSpzFrameFormats())[ --nCnt ];
385 if (!pPosition || ! rExport.m_pCurPam->GetNode().GetTextNode())
417 std::map<OUString, css::uno::Any> aTableGrabBag = pTableGrabBag->
GetGrabBag();
419 if (aTableGrabBag.find(
"TablePosition") == aTableGrabBag.end())
429 bool bGenerateParaId)
434 if ( !m_aFramesOfParagraph.size() || !m_nTextFrameLevel )
435 m_aFramesOfParagraph.push(std::vector<ww8::Frame>());
439 if (!pTextNodeInfo && !m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen())
451 if ( m_tableReference->m_nTableDepth > 0 && !m_tableReference->m_bTableCellOpen )
454 if ( pDeepInner->getCell() == 0 )
455 StartTableRow( pDeepInner );
457 const sal_uInt32 nCell = pDeepInner->getCell();
458 const sal_uInt32 nRow = pDeepInner->getRow();
460 SyncNodelessCells(pDeepInner, nCell, nRow);
461 StartTableCell(pDeepInner, nCell, nRow);
464 sal_uInt32 nRow = pTextNodeInfo->getRow();
465 sal_uInt32 nCell = pTextNodeInfo->getCell();
471 sal_uInt32 nCurrentDepth = pTextNodeInfo->getDepth();
473 if ( nCurrentDepth > m_tableReference->m_nTableDepth )
476 for ( sal_uInt32 nDepth = m_tableReference->m_nTableDepth + 1; nDepth <= nCurrentDepth; ++nDepth )
480 StartTable( pInner );
481 StartTableRow( pInner );
483 StartTableCell(pInner, 0, nDepth == nCurrentDepth ? nRow : 0);
486 m_tableReference->m_nTableDepth = nCurrentDepth;
494 bool bEndParaSdt =
false;
495 if (m_aParagraphSdt.m_bStartedSdt)
504 const std::map<OUString, css::uno::Any>& rMap = rParaGrabBag.
GetGrabBag();
505 bEndParaSdt = m_aParagraphSdt.m_bStartedSdt && rMap.find(
"ParaSdtEndBefore") != rMap.end();
510 bool bOneliner = m_aParagraphSdt.m_bStartedSdt && !m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen() &&
lcl_isOnelinerSdt(m_aStartedParagraphSdtPrAlias);
511 if (bEndParaSdt || (m_aParagraphSdt.m_bStartedSdt && m_bHadSectPr) || bOneliner)
514 m_aParagraphSdt.EndSdtBlock(m_pSerializer);
515 m_aStartedParagraphSdtPrAlias.clear();
517 m_bHadSectPr =
false;
523 std::optional<OUString> aParaId;
524 sal_Int32 nParaId = 0;
527 nParaId = m_nNextParaId++;
528 aParaId = NumberToHexBinary(nParaId);
530 m_pSerializer->startElementNS(XML_w, XML_p,
FSNS(XML_w14, XML_paraId), aParaId);
537 m_pSectionInfo.reset();
539 m_bParagraphOpened =
true;
540 m_bIsFirstParagraph =
false;
549 case text::VertOrientation::CENTER:
550 case text::VertOrientation::LINE_CENTER:
552 case text::VertOrientation::BOTTOM:
554 case text::VertOrientation::LINE_BOTTOM:
556 case text::VertOrientation::TOP:
558 case text::VertOrientation::LINE_TOP:
569 case text::HoriOrientation::LEFT:
570 return bIsPosToggle ?
"inside" :
"left";
571 case text::HoriOrientation::INSIDE:
573 case text::HoriOrientation::RIGHT:
574 return bIsPosToggle ?
"outside" :
"right";
575 case text::HoriOrientation::OUTSIDE:
577 case text::HoriOrientation::CENTER:
578 case text::HoriOrientation::FULL:
589 case text::RelOrientation::PAGE_PRINT_AREA:
591 case text::RelOrientation::PAGE_FRAME:
593 case text::RelOrientation::FRAME:
594 case text::RelOrientation::TEXT_LINE:
604 case text::RelOrientation::PAGE_PRINT_AREA:
606 case text::RelOrientation::PAGE_FRAME:
608 case text::RelOrientation::CHAR:
609 case text::RelOrientation::PAGE_RIGHT:
610 case text::RelOrientation::FRAME:
618 if (m_pTokenChildren.is() )
619 m_pTokenChildren.clear();
620 if (m_pDataBindingAttrs.is() )
621 m_pDataBindingAttrs.clear();
622 if (m_pTextAttrs.is())
623 m_pTextAttrs.clear();
624 if (!m_aAlias.isEmpty())
626 if (!m_aPlaceHolderDocPart.isEmpty())
627 m_aPlaceHolderDocPart.clear();
635 if (m_nSdtPrToken <= 0 && !m_pDataBindingAttrs.is() && !m_bHasId)
641 pSerializer->startElementNS(XML_w, XML_sdt);
644 pSerializer->startElementNS(XML_w, XML_sdtPr);
646 if (m_nSdtPrToken > 0 && m_pTokenChildren.is())
648 if (!m_pTokenAttributes.is())
649 pSerializer->startElement(m_nSdtPrToken);
653 pSerializer->startElement(m_nSdtPrToken, xAttrList);
656 if (m_nSdtPrToken ==
FSNS(XML_w, XML_date) || m_nSdtPrToken ==
FSNS(XML_w, XML_docPartObj) || m_nSdtPrToken ==
FSNS(XML_w, XML_docPartList) || m_nSdtPrToken ==
FSNS(XML_w14, XML_checkbox)) {
657 const uno::Sequence<xml::FastAttribute> aChildren = m_pTokenChildren->getFastAttributes();
658 for (
const auto& rChild : aChildren)
659 pSerializer->singleElement(rChild.Token,
FSNS(XML_w, XML_val), rChild.Value);
662 pSerializer->endElement(m_nSdtPrToken);
664 else if ((m_nSdtPrToken > 0) && m_nSdtPrToken !=
FSNS(XML_w, XML_id) && !(bRunTextIsOn && bParagraphHasDrawing))
666 if (!m_pTokenAttributes.is())
667 pSerializer->singleElement(m_nSdtPrToken);
671 pSerializer->singleElement(m_nSdtPrToken, xAttrList);
675 WriteExtraParams(pSerializer);
677 pSerializer->endElementNS(XML_w, XML_sdtPr);
680 pSerializer->startElementNS(XML_w, XML_sdtContent);
686 m_bStartedSdt =
true;
690 m_pTokenChildren.clear();
691 m_pDataBindingAttrs.clear();
692 m_pTextAttrs.clear();
699 if (m_nSdtPrToken ==
FSNS(XML_w, XML_id) || m_bHasId)
701 pSerializer->singleElementNS(XML_w, XML_id,
FSNS(XML_w, XML_val),
704 if (m_pDataBindingAttrs.is())
707 pSerializer->singleElementNS(XML_w, XML_dataBinding, xAttrList);
710 if (m_pTextAttrs.is())
713 pSerializer->singleElementNS(XML_w, XML_text, xAttrList);
716 if (!m_aPlaceHolderDocPart.isEmpty())
718 pSerializer->startElementNS(XML_w, XML_placeholder);
719 pSerializer->singleElementNS(XML_w, XML_docPart,
FSNS(XML_w, XML_val), m_aPlaceHolderDocPart);
720 pSerializer->endElementNS(XML_w, XML_placeholder);
724 pSerializer->singleElementNS(XML_w15, XML_color,
FSNS(XML_w, XML_val),
m_aColor);
727 if (!m_aAlias.isEmpty())
728 pSerializer->singleElementNS(XML_w, XML_alias,
FSNS(XML_w, XML_val), m_aAlias);
733 pSerializer->endElementNS(XML_w, XML_sdtContent);
734 pSerializer->endElementNS(XML_w, XML_sdt);
735 m_bStartedSdt =
false;
740 for (
const beans::PropertyValue& aPropertyValue : aGrabBagSdt)
742 if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_checkbox")
744 m_nSdtPrToken =
FSNS(XML_w14, XML_checkbox);
745 uno::Sequence<beans::PropertyValue> aGrabBag;
746 aPropertyValue.Value >>= aGrabBag;
747 for (
const auto& rProp : std::as_const(aGrabBag))
749 OUString sValue = rProp.Value.get<OUString>();
750 if (rProp.Name ==
"ooxml:CT_SdtCheckbox_checked")
752 FSNS(XML_w14, XML_checked),
754 else if (rProp.Name ==
"ooxml:CT_SdtCheckbox_checkedState")
756 FSNS(XML_w14, XML_checkedState),
758 else if (rProp.Name ==
"ooxml:CT_SdtCheckbox_uncheckedState")
760 FSNS(XML_w14, XML_uncheckedState),
764 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_dataBinding" && !m_pDataBindingAttrs.is())
766 uno::Sequence<beans::PropertyValue> aGrabBag;
767 aPropertyValue.Value >>= aGrabBag;
768 for (
const auto& rProp : std::as_const(aGrabBag))
770 OUString sValue = rProp.Value.get<OUString>();
771 if (rProp.Name ==
"ooxml:CT_DataBinding_prefixMappings")
773 FSNS( XML_w, XML_prefixMappings ),
775 else if (rProp.Name ==
"ooxml:CT_DataBinding_xpath")
777 FSNS( XML_w, XML_xpath ),
779 else if (rProp.Name ==
"ooxml:CT_DataBinding_storeItemID")
781 FSNS( XML_w, XML_storeItemID ),
785 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_text")
787 uno::Sequence<beans::PropertyValue> aGrabBag;
788 aPropertyValue.Value >>= aGrabBag;
789 if (aGrabBag.hasElements())
791 for (
const auto& rProp : std::as_const(aGrabBag))
793 OUString sValue = rProp.Value.get<OUString>();
794 if (rProp.Name ==
"ooxml:CT_SdtText_multiLine")
796 FSNS(XML_w, XML_multiLine),
803 m_nSdtPrToken =
FSNS(XML_w, XML_text);
806 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPlaceholder_docPart")
808 uno::Sequence<beans::PropertyValue> aGrabBag;
809 aPropertyValue.Value >>= aGrabBag;
810 for (
const auto& rProp : std::as_const(aGrabBag))
812 OUString sValue = rProp.Value.get<OUString>();
813 if (rProp.Name ==
"ooxml:CT_SdtPlaceholder_docPart_val")
814 m_aPlaceHolderDocPart = sValue;
817 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_color")
819 uno::Sequence<beans::PropertyValue> aGrabBag;
820 aPropertyValue.Value >>= aGrabBag;
821 for (
const auto& rProp : std::as_const(aGrabBag))
823 OUString sValue = rProp.Value.get<OUString>();
824 if (rProp.Name ==
"ooxml:CT_SdtColor_val")
828 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_alias" && m_aAlias.isEmpty())
830 if (!(aPropertyValue.Value >>= m_aAlias))
831 SAL_WARN(
"sw.ww8",
"DocxAttributeOutput::GrabBag: unexpected sdt alias value");
833 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_id")
835 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_citation")
836 m_nSdtPrToken =
FSNS(XML_w, XML_citation);
837 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_docPartObj" ||
838 aPropertyValue.Name ==
"ooxml:CT_SdtPr_docPartList")
840 if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_docPartObj")
841 m_nSdtPrToken =
FSNS(XML_w, XML_docPartObj);
842 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_docPartList")
843 m_nSdtPrToken =
FSNS(XML_w, XML_docPartList);
845 uno::Sequence<beans::PropertyValue> aGrabBag;
846 aPropertyValue.Value >>= aGrabBag;
847 for (
const auto& rProp : std::as_const(aGrabBag))
849 OUString sValue = rProp.Value.get<OUString>();
850 if (rProp.Name ==
"ooxml:CT_SdtDocPart_docPartGallery")
852 FSNS(XML_w, XML_docPartGallery),
854 else if (rProp.Name ==
"ooxml:CT_SdtDocPart_docPartCategory")
856 FSNS(XML_w, XML_docPartCategory),
858 else if (rProp.Name ==
"ooxml:CT_SdtDocPart_docPartUnique")
860 if (sValue.isEmpty())
867 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_equation")
868 m_nSdtPrToken =
FSNS(XML_w, XML_equation);
869 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_picture")
870 m_nSdtPrToken =
FSNS(XML_w, XML_picture);
871 else if (aPropertyValue.Name ==
"ooxml:CT_SdtPr_group")
872 m_nSdtPrToken =
FSNS(XML_w, XML_group);
874 SAL_WARN(
"sw.ww8",
"GetSdtParamsFromGrabBag unhandled SdtPr grab bag property " << aPropertyValue.Name);
884 attrList->add(
FSNS( XML_w, XML_w), OString::number(rSize.
Width()));
885 attrList->add(
FSNS( XML_w, XML_h), OString::number(rSize.
Height()));
887 attrList->add(
FSNS( XML_w, XML_x), OString::number(aPos.X));
888 attrList->add(
FSNS( XML_w, XML_y), OString::number(aPos.Y));
895 attrList->add(
FSNS(XML_w, XML_hSpace), OString::number((nLeft + nRight) / 2));
896 attrList->add(
FSNS(XML_w, XML_vSpace), OString::number((nUpper + nLower) / 2));
903 case css::text::WrapTextMode_NONE:
904 attrList->add(
FSNS( XML_w, XML_wrap),
"notBeside");
906 case css::text::WrapTextMode_DYNAMIC:
907 attrList->add(
FSNS(XML_w, XML_wrap),
"auto");
909 case css::text::WrapTextMode_PARALLEL:
911 attrList->add(
FSNS(XML_w, XML_wrap),
"around");
914 attrList->add(
FSNS( XML_w, XML_vAnchor), relativeFromV );
915 attrList->add(
FSNS( XML_w, XML_hAnchor), relativeFromH );
916 attrList->add(
FSNS( XML_w, XML_hRule),
"exact");
918 m_pSerializer->singleElementNS( XML_w, XML_framePr, attrList );
923 uno::Reference< drawing::XShape > xShape;
926 xShape.set(const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY);
927 uno::Reference< beans::XPropertySet > xPropertySet(xShape, uno::UNO_QUERY);
928 uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
929 if (xPropertySet.is())
930 xPropSetInfo = xPropertySet->getPropertySetInfo();
932 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"FrameInteropGrabBag"))
934 uno::Sequence< beans::PropertyValue > propList;
935 xPropertySet->getPropertyValue(
"FrameInteropGrabBag") >>= propList;
936 auto pProp = std::find_if(std::cbegin(propList), std::cend(propList),
937 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"ParaFrameProperties"; });
938 if (pProp != std::cend(propList))
939 aFrameProperties = pProp->
Value;
941 bool bFrameProperties =
false;
942 aFrameProperties >>= bFrameProperties;
943 return bFrameProperties;
950 std::vector< std::shared_ptr <ww8::Frame> > aFramePrTextbox;
954 if( m_nTextFrameLevel == 1 && !m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen() )
958 assert(!m_pPostponedCustomShape);
959 m_pPostponedCustomShape.reset(
new std::vector<PostponedDrawing>);
962 size_t nFrames = m_aFramesOfParagraph.size() ? m_aFramesOfParagraph.top().size() : 0;
965 m_bParagraphFrameOpen =
true;
969 if (!TextBoxIsFramePr(rFrameFormat) || m_bWritingHeaderFooter)
971 if (m_aRunSdt.m_bStartedSdt)
974 m_aRunSdt.EndSdtBlock(m_pSerializer);
976 m_pSerializer->startElementNS(XML_w, XML_r);
977 m_pSerializer->startElementNS(XML_mc, XML_AlternateContent);
978 m_pSerializer->startElementNS(XML_mc, XML_Choice, XML_Requires,
"wps");
984 SetAlternateContentChoiceOpen(
true );
992 m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>();
1001 m_rExport.SdrExporter().writeDMLTextFrame(&aFrame, m_anchorId++);
1003 m_pSerializer->endElementNS(XML_mc, XML_Choice);
1004 SetAlternateContentChoiceOpen(
false );
1009 m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>();
1012 m_pSerializer->startElementNS(XML_mc, XML_Fallback);
1015 m_rExport.SdrExporter().writeVMLTextFrame(&aFrame);
1017 m_rExport.m_pTableInfo = pOldTableInfo;
1019 m_pSerializer->endElementNS(XML_mc, XML_Fallback);
1020 m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
1021 m_pSerializer->endElementNS( XML_w, XML_r );
1022 m_bParagraphFrameOpen =
false;
1026 std::shared_ptr<ww8::Frame> pFramePr = std::make_shared<ww8::Frame>(aFrame);
1027 aFramePrTextbox.push_back(pFramePr);
1030 nFrames = m_aFramesOfParagraph.size() ? m_aFramesOfParagraph.top().size() : 0;
1032 if (!m_pPostponedCustomShape->empty())
1034 m_pSerializer->startElementNS(XML_w, XML_r);
1035 WritePostponedCustomShape();
1036 m_pSerializer->endElementNS( XML_w, XML_r );
1038 m_pPostponedCustomShape.reset();
1040 if ( m_aFramesOfParagraph.size() )
1041 m_aFramesOfParagraph.top().clear();
1043 if (!pTextNodeInfoInner)
1046 m_aFloatingTablesOfParagraph.clear();
1050 --m_nTextFrameLevel;
1051 if ( m_aFramesOfParagraph.size() && !m_nTextFrameLevel )
1052 m_aFramesOfParagraph.pop();
1057 if(m_nHyperLinkCount > 0)
1059 for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < m_nHyperLinkCount; ++nHyperLinkToClose)
1060 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
1061 m_nHyperLinkCount = 0;
1064 if (m_aRunSdt.m_bStartedSdt)
1067 m_aRunSdt.EndSdtBlock(m_pSerializer);
1070 if (m_bPageBreakAfter)
1074 m_bPageBreakAfter =
false;
1077 m_pSerializer->endElementNS( XML_w, XML_p );
1079 if (!m_bAnchorLinkedToNode && !m_aParagraphSdt.m_bStartedSdt)
1081 m_aParagraphSdt.WriteSdtBlock(m_pSerializer, m_bRunTextIsOn, m_rExport.SdrExporter().IsParagraphHasDrawing());
1083 if (m_aParagraphSdt.m_bStartedSdt)
1085 if (m_tableReference->m_bTableCellOpen)
1086 m_tableReference->m_bTableCellParaSdtOpen =
true;
1087 if (m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen())
1088 m_rExport.SdrExporter().setParagraphSdtOpen(
true);
1095 m_aParagraphSdt.m_nSdtPrToken = 0;
1096 m_aParagraphSdt.m_bHasId =
false;
1097 m_aParagraphSdt.DeleteAndResetTheLists();
1103 for (
const auto & pFrame : aFramePrTextbox )
1106 m_pCurrentFrame = pFrame.get();
1107 m_rExport.SdrExporter().writeOnlyTextOfFrame(pFrame.get());
1108 m_pCurrentFrame =
nullptr;
1114 m_rExport.SdrExporter().setParagraphHasDrawing(
false);
1115 m_bRunTextIsOn =
false;
1118 aFramePrTextbox.clear();
1120 FinishTableRowCell( pTextNodeInfoInner );
1122 if( !m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen() )
1123 m_bParagraphOpened =
false;
1126 m_aBookmarksOfParagraphStart.clear();
1127 m_aBookmarksOfParagraphEnd.clear();
1130 #define MAX_CELL_IN_WORD 62
1134 sal_Int32 nOpenCell = m_LastOpenCell.back();
1136 EndTableCell(nOpenCell);
1138 sal_Int32 nClosedCell = m_LastClosedCell.back();
1139 for (sal_Int32
i = nClosedCell+1;
i < nCell; ++
i)
1145 StartTableRow(pInner);
1147 StartTableCell(pInner,
i, nRow);
1148 m_pSerializer->singleElementNS(XML_w, XML_p);
1159 sal_uInt32 nRow = pInner->getRow();
1160 sal_Int32 nCell = pInner->getCell();
1162 InitTableHelper( pInner );
1170 const bool limitWorkaround = (nCell >=
MAX_CELL_IN_WORD && !pInner->isEndOfLine());
1171 const bool bEndCell = pInner->isEndOfCell() && !limitWorkaround;
1172 const bool bEndRow = pInner->isEndOfLine();
1176 while (pInner->getDepth() < m_tableReference->m_nTableDepth)
1180 assert(m_LastOpenCell.back() == -1 && m_LastClosedCell.back() == -1);
1184 SyncNodelessCells(pInner, nCell, nRow);
1186 sal_Int32 nClosedCell = m_LastClosedCell.back();
1187 if (nCell == nClosedCell)
1191 StartTableCell(pInner, nCell, nRow);
1195 sal_Int32 nRemainingCells = xRowSpans->size() - nCell;
1196 for (sal_Int32
i = 1;
i < nRemainingCells; ++
i)
1198 if (bForceEmptyParagraph)
1200 m_pSerializer->singleElementNS(XML_w, XML_p);
1203 EndTableCell(nCell);
1205 StartTableCell(pInner, nCell, nRow);
1209 if (bForceEmptyParagraph)
1211 m_pSerializer->singleElementNS(XML_w, XML_p);
1214 EndTableCell(nCell);
1222 if (pInner->isFinalEndOfLine())
1228 m_pSerializer->singleElementNS(XML_w, XML_p);
1245 m_rExport.OutputSectionBreaks(pTextNode->
GetpSwAttrSet(), *pTextNode, m_tableReference->m_bTableCellOpen);
1251 m_rExport.OutputSectionBreaks(&(pFormat->
GetAttrSet()), *pTableNode);
1262 m_rExport.OutputSectionBreaks(pTextNode->
GetpSwAttrSet(), *pTextNode, m_tableReference->m_bTableCellOpen);
1269 m_rExport.OutputSectionBreaks(&(pFormat->
GetAttrSet()), *pTableNode);
1278 m_pSerializer->startElementNS(XML_w, XML_pPr);
1281 if (m_pSectionInfo && m_rExport.m_nTextTyp ==
TXT_MAINTEXT)
1283 m_rExport.SectionProperties( *m_pSectionInfo );
1284 m_pSectionInfo.reset();
1287 InitCollectedParagraphProperties();
1292 m_pParagraphSpacingAttrList.clear();
1295 static const sal_Int32 aOrder[] =
1297 FSNS( XML_w, XML_pStyle ),
1298 FSNS( XML_w, XML_keepNext ),
1299 FSNS( XML_w, XML_keepLines ),
1300 FSNS( XML_w, XML_pageBreakBefore ),
1301 FSNS( XML_w, XML_framePr ),
1302 FSNS( XML_w, XML_widowControl ),
1303 FSNS( XML_w, XML_numPr ),
1304 FSNS( XML_w, XML_suppressLineNumbers ),
1305 FSNS( XML_w, XML_pBdr ),
1306 FSNS( XML_w, XML_shd ),
1307 FSNS( XML_w, XML_tabs ),
1308 FSNS( XML_w, XML_suppressAutoHyphens ),
1309 FSNS( XML_w, XML_kinsoku ),
1310 FSNS( XML_w, XML_wordWrap ),
1311 FSNS( XML_w, XML_overflowPunct ),
1312 FSNS( XML_w, XML_topLinePunct ),
1313 FSNS( XML_w, XML_autoSpaceDE ),
1314 FSNS( XML_w, XML_autoSpaceDN ),
1315 FSNS( XML_w, XML_bidi ),
1316 FSNS( XML_w, XML_adjustRightInd ),
1317 FSNS( XML_w, XML_snapToGrid ),
1318 FSNS( XML_w, XML_spacing ),
1319 FSNS( XML_w, XML_ind ),
1320 FSNS( XML_w, XML_contextualSpacing ),
1321 FSNS( XML_w, XML_mirrorIndents ),
1322 FSNS( XML_w, XML_suppressOverlap ),
1323 FSNS( XML_w, XML_jc ),
1324 FSNS( XML_w, XML_textDirection ),
1325 FSNS( XML_w, XML_textAlignment ),
1326 FSNS( XML_w, XML_textboxTightWrap ),
1327 FSNS( XML_w, XML_outlineLvl ),
1328 FSNS( XML_w, XML_divId ),
1329 FSNS( XML_w, XML_cnfStyle ),
1330 FSNS( XML_w, XML_rPr ),
1331 FSNS( XML_w, XML_sectPr ),
1332 FSNS( XML_w, XML_pPrChange )
1343 if ( m_rExport.SdrExporter().getFlyAttrList().is() )
1346 m_rExport.SdrExporter().getFlyAttrList().clear();
1348 m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList );
1351 if ( m_pParagraphSpacingAttrList.is() )
1354 m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList );
1357 if ( m_pBackgroundAttrList.is() )
1360 m_pSerializer->singleElementNS( XML_w, XML_shd, xAttrList );
1374 sal_uInt16 nWhichId = aIter.FirstWhich();
1377 bool bFontSizeWritten =
false;
1380 if (rParagraphMarkerProperties.
GetItemState(nWhichId,
true, &pItem) == SfxItemState::SET)
1386 if (!bFontSizeWritten || !bFontSizeItem)
1389 bFontSizeWritten =
true;
1394 lcl_writeParagraphMarkerProperties(rAttributeOutput, *pAutoFormat->
GetStyleHandle());
1397 nWhichId = aIter.NextWhich();
1402 const char *RubyAlignValues[] =
1413 const char *lclConvertWW8JCToOOXMLRubyAlign(sal_Int32 nJC)
1416 if ( nJC >=0 && nJC < nElements )
1417 return RubyAlignValues[nJC];
1418 return RubyAlignValues[0];
1431 WriteCollectedParagraphProperties();
1434 WriteCollectedParagraphProperties();
1440 m_pSerializer->startElementNS(XML_w, XML_rPr);
1442 InitCollectedRunProperties();
1450 m_pFontsAttrList.clear();
1452 m_pEastAsianLayoutAttrList.clear();
1454 m_pCharLangAttrList.clear();
1456 lcl_writeParagraphMarkerProperties(*
this, rParagraphMarkerProperties);
1459 WriteCollectedRunProperties();
1462 m_pFontsAttrList = pFontsAttrList_Original.get();
1463 m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original.get();
1464 m_pCharLangAttrList = pCharLangAttrList_Original.get();
1466 if ( pRedlineParagraphMarkerDeleted )
1468 StartRedline( pRedlineParagraphMarkerDeleted );
1469 EndRedline( pRedlineParagraphMarkerDeleted );
1471 if ( pRedlineParagraphMarkerInserted )
1473 StartRedline( pRedlineParagraphMarkerInserted );
1474 EndRedline( pRedlineParagraphMarkerInserted );
1479 m_pSerializer->endElementNS( XML_w, XML_rPr );
1481 if (!m_bWritingHeaderFooter && m_pCurrentFrame)
1483 const SwFrameFormat& rFrameFormat = m_pCurrentFrame->GetFrameFormat();
1485 if (TextBoxIsFramePr(rFrameFormat))
1487 const Size aSize = m_pCurrentFrame->GetSize();
1488 PopulateFrameProperties(&rFrameFormat, aSize);
1493 m_pSerializer->endElementNS( XML_w, XML_pPr );
1498 if (!aStatements.empty())
1500 m_pSerializer->startElementNS(XML_w, XML_smartTag,
1501 FSNS(XML_w, XML_uri),
"http://www.w3.org/1999/02/22-rdf-syntax-ns#",
1502 FSNS(XML_w, XML_element),
"RDF");
1503 m_pSerializer->startElementNS(XML_w, XML_smartTagPr);
1504 for (
const auto& rStatement : aStatements)
1505 m_pSerializer->singleElementNS(XML_w, XML_attr,
1506 FSNS(XML_w, XML_name), rStatement.first,
1507 FSNS(XML_w, XML_val), rStatement.second);
1508 m_pSerializer->endElementNS(XML_w, XML_smartTagPr);
1509 m_pSerializer->endElementNS(XML_w, XML_smartTag);
1514 m_pSerializer->startElementNS(XML_w, XML_r);
1515 m_pSerializer->singleElementNS(XML_w, XML_br,
FSNS(XML_w,
XML_type),
"column");
1516 m_pSerializer->endElementNS( XML_w, XML_r );
1524 if ( m_bPostponedPageBreak && !m_bWritingHeaderFooter )
1526 m_pSerializer->startElementNS(XML_w, XML_r);
1527 m_pSerializer->singleElementNS(XML_w, XML_br,
FSNS(XML_w,
XML_type),
"page");
1528 m_pSerializer->endElementNS( XML_w, XML_r );
1530 m_bPostponedPageBreak =
false;
1540 m_nStateOfFlyFrame = nStateOfFlyFrame;
1545 m_bAnchorLinkedToNode = bAnchorLinkedToNode ;
1550 m_bPostponedProcessingFly =
false ;
1555 return m_bPostponedProcessingFly;
1562 m_pRedlineData = pRedlineData;
1579 int nFieldsInPrevHyperlink = m_nFieldsInHyperlink;
1581 if ( m_pHyperlinkAttrList.is() )
1583 m_nFieldsInHyperlink = 0;
1587 for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin() + nFieldsInPrevHyperlink; pIt != m_Fields.end(); )
1592 (!(pIt->eType ==
ww::eFILLIN && static_cast<const SwInputField*>(pIt->pField.get())->getGrabBagParams().hasElements()))
1595 StartField_Impl( pNode, nPos, *pIt );
1601 pIt = m_Fields.erase( pIt );
1605 if (m_startedHyperlink || m_pHyperlinkAttrList.is())
1607 ++m_nFieldsInHyperlink;
1619 bool bCloseEarlierSDT =
false;
1627 if (m_aRunSdt.m_nSdtPrToken > 0)
1628 bCloseEarlierSDT =
true;
1630 m_aRunSdt.EndSdtBlock(m_pSerializer);
1631 m_bEndCharSdt =
false;
1634 for (; m_nCloseContentControlInPreviousRun > 0; --m_nCloseContentControlInPreviousRun)
1637 WriteContentControlEnd();
1640 if ( m_closeHyperlinkInPreviousRun )
1642 if ( m_startedHyperlink )
1644 for (
int i = 0;
i < nFieldsInPrevHyperlink;
i++ )
1648 EndField_Impl( pNode, nPos, m_Fields.back( ) );
1649 m_Fields.pop_back();
1651 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
1652 m_startedHyperlink =
false;
1653 m_endPageRef =
false;
1654 m_nHyperLinkCount--;
1656 m_closeHyperlinkInPreviousRun =
false;
1660 for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); )
1665 (pIt->eType ==
ww::eFILLIN && static_cast<const SwInputField*>(pIt->pField.get())->getGrabBagParams().hasElements())))
1667 StartRedline( m_pRedlineData );
1668 StartField_Impl( pNode, nPos, *pIt,
true );
1669 EndRedline( m_pRedlineData );
1671 if (m_startedHyperlink)
1672 ++m_nFieldsInHyperlink;
1677 pIt = m_Fields.erase( pIt );
1681 if (pIt->bSep && !pIt->pField)
1686 if (!m_sFieldBkm.isEmpty())
1688 DoWriteBookmarkTagStart(m_sFieldBkm);
1689 DoWriteBookmarkTagEnd(m_nNextBookmarkId);
1690 m_nNextBookmarkId++;
1691 m_sFieldBkm.clear();
1693 CmdEndField_Impl(pNode, nPos,
true);
1697 pIt = m_Fields.erase( pIt );
1705 bool newStartedHyperlink(
false);
1706 if ( m_pHyperlinkAttrList.is() )
1712 if (!m_closeHyperlinkInThisRun)
1715 for (
auto it = m_Fields.rbegin(); it != m_Fields.rend(); )
1717 if (it->bClose && !it->pField)
1719 EndField_Impl( pNode, nPos, *it );
1720 it = decltype(m_Fields)::reverse_iterator(m_Fields.erase(it.base() - 1));
1728 newStartedHyperlink =
true;
1732 m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
1733 m_startedHyperlink =
true;
1734 m_nHyperLinkCount++;
1737 WriteContentControlStart();
1740 StartRedline( m_pRedlineData );
1745 DoWriteBookmarksStart(m_rBookmarksStart, m_pMoveRedlineData);
1746 DoWriteBookmarksEnd(m_rBookmarksEnd);
1747 DoWritePermissionsStart();
1748 DoWriteAnnotationMarks();
1750 if( m_closeHyperlinkInThisRun && m_startedHyperlink && !m_hyperLinkAnchor.isEmpty() && m_hyperLinkAnchor.startsWith(
"_Toc"))
1753 m_pSerializer->startElementNS(XML_w, XML_r);
1754 m_pSerializer->startElementNS(XML_w, XML_rPr);
1755 m_pSerializer->singleElementNS(XML_w, XML_webHidden);
1756 m_pSerializer->endElementNS( XML_w, XML_rPr );
1757 m_pSerializer->startElementNS(XML_w, XML_fldChar,
FSNS(XML_w, XML_fldCharType),
"begin");
1758 m_pSerializer->endElementNS( XML_w, XML_fldChar );
1759 m_pSerializer->endElementNS( XML_w, XML_r );
1762 m_pSerializer->startElementNS(XML_w, XML_r);
1763 m_pSerializer->startElementNS(XML_w, XML_rPr);
1764 m_pSerializer->singleElementNS(XML_w, XML_webHidden);
1765 m_pSerializer->endElementNS( XML_w, XML_rPr );
1766 sToken =
"PAGEREF " + m_hyperLinkAnchor +
" \\h";
1767 DoWriteCmd( sToken );
1768 m_pSerializer->endElementNS( XML_w, XML_r );
1771 m_pSerializer->startElementNS(XML_w, XML_r);
1772 m_pSerializer->startElementNS(XML_w, XML_rPr);
1773 m_pSerializer->singleElementNS(XML_w, XML_webHidden);
1774 m_pSerializer->endElementNS( XML_w, XML_rPr );
1775 m_pSerializer->singleElementNS( XML_w, XML_fldChar,
1776 FSNS( XML_w, XML_fldCharType ),
"separate" );
1777 m_pSerializer->endElementNS( XML_w, XML_r );
1779 m_endPageRef =
true;
1782 DoWriteBookmarkStartIfExist(nPos);
1784 m_pSerializer->startElementNS(XML_w, XML_r);
1785 if(GetExport().m_bTabInTOC && m_pHyperlinkAttrList.is())
1791 if ( !m_sRawText.isEmpty() )
1793 RunText( m_sRawText );
1800 m_pSerializer->endElementNS( XML_w, XML_r );
1804 EndRedline( m_pRedlineData );
1808 if ( !m_bAnchorLinkedToNode && !m_aRunSdt.m_bStartedSdt)
1810 m_aRunSdt.WriteSdtBlock(m_pSerializer, m_bRunTextIsOn, m_rExport.SdrExporter().IsParagraphHasDrawing());
1816 m_aRunSdt.m_nSdtPrToken = 0;
1817 m_aRunSdt.DeleteAndResetTheLists();
1820 if (bCloseEarlierSDT)
1823 m_aRunSdt.EndSdtBlock(m_pSerializer);
1830 DoWritePermissionsEnd();
1832 for (
const auto& rpMath : m_aPostponedMaths)
1833 WritePostponedMath(rpMath.pMathObject, rpMath.nMathObjAlignment);
1834 m_aPostponedMaths.clear();
1836 for (
const auto& rpControl : m_aPostponedFormControls)
1837 WritePostponedFormControl(rpControl);
1838 m_aPostponedFormControls.clear();
1840 WritePostponedActiveXControl(
false);
1842 WritePendingPlaceholder();
1844 if ( !m_bWritingField )
1846 m_pRedlineData =
nullptr;
1849 for (; m_nCloseContentControlInThisRun > 0; --m_nCloseContentControlInThisRun)
1852 WriteContentControlEnd();
1855 if ( m_closeHyperlinkInThisRun )
1857 if ( m_startedHyperlink )
1862 m_pSerializer->startElementNS(XML_w, XML_r);
1863 m_pSerializer->startElementNS(XML_w, XML_rPr);
1864 m_pSerializer->singleElementNS(XML_w, XML_webHidden);
1865 m_pSerializer->endElementNS( XML_w, XML_rPr );
1866 m_pSerializer->singleElementNS( XML_w, XML_fldChar,
1867 FSNS( XML_w, XML_fldCharType ),
"end" );
1868 m_pSerializer->endElementNS( XML_w, XML_r );
1869 m_endPageRef =
false;
1870 m_hyperLinkAnchor.clear();
1872 for (
int i = 0;
i < m_nFieldsInHyperlink;
i++ )
1876 EndField_Impl( pNode, nPos, m_Fields.back( ) );
1877 m_Fields.pop_back();
1879 m_nFieldsInHyperlink = 0;
1881 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
1882 m_startedHyperlink =
false;
1883 m_nHyperLinkCount--;
1885 m_closeHyperlinkInThisRun =
false;
1888 if (!newStartedHyperlink)
1890 while ( m_Fields.begin() != m_Fields.end() )
1892 EndField_Impl( pNode, nPos, m_Fields.front( ) );
1893 m_Fields.erase( m_Fields.begin( ) );
1895 m_nFieldsInHyperlink = 0;
1899 for (
auto it = m_Fields.rbegin(); it != m_Fields.rend(); )
1901 if (it->bClose && !it->pField)
1903 EndField_Impl( pNode, nPos, *it );
1904 it = decltype(m_Fields)::reverse_iterator(m_Fields.erase(it.base() - 1));
1912 if ( m_pRedlineData )
1914 EndRedline( m_pRedlineData );
1915 m_pRedlineData =
nullptr;
1918 DoWriteBookmarksStart(m_rFinalBookmarksStart);
1919 DoWriteBookmarksEnd(m_rFinalBookmarksEnd);
1920 DoWriteBookmarkEndIfExist(nPos);
1925 m_pSerializer->singleElementNS(XML_w, XML_bookmarkStart,
1926 FSNS(XML_w, XML_id), OString::number(m_nNextBookmarkId),
1932 m_pSerializer->singleElementNS(XML_w, XML_bookmarkEnd,
1933 FSNS(XML_w, XML_id), OString::number(nId));
1942 const OUString &rAuthor(
SW_MOD()->GetRedlineAuthor( pRedlineData->
GetAuthor() ) );
1944 bool bNoDate = bRemovePersonalInfo ||
1950 pAttributeList->add(
FSNS(XML_w, XML_id), OString::number(m_nNextBookmarkId));
1951 pAttributeList->add(
FSNS(XML_w, XML_author ), bRemovePersonalInfo
1952 ?
"Author" + OString::number( GetExport().GetInfoID(rAuthor) )
1956 pAttributeList->add(
FSNS(XML_w, XML_name), bookmarkName);
1957 m_pSerializer->singleElementNS( XML_w, bFrom ? XML_moveFromRangeStart : XML_moveToRangeStart, pAttributeList );
1962 m_pSerializer->singleElementNS(XML_w, bFrom
1963 ? XML_moveFromRangeEnd
1964 : XML_moveToRangeEnd,
1965 FSNS(XML_w, XML_id), OString::number(nId));
1970 auto aRange = m_aBookmarksOfParagraphStart.equal_range(nRunPos);
1971 for(
auto aIter = aRange.first; aIter != aRange.second; ++aIter)
1973 DoWriteBookmarkTagStart(aIter->second);
1974 m_rOpenedBookmarksIds[aIter->second] = m_nNextBookmarkId;
1976 m_nNextBookmarkId++;
1982 auto aRange = m_aBookmarksOfParagraphEnd.equal_range(nRunPos);
1983 for(
auto aIter = aRange.first; aIter != aRange.second; ++aIter)
1986 auto pPos = m_rOpenedBookmarksIds.find(aIter->second);
1987 if (pPos != m_rOpenedBookmarksIds.end())
1990 DoWriteBookmarkTagEnd(pPos->second);
1991 m_rOpenedBookmarksIds.erase(aIter->second);
1999 for (
const OUString & bookmarkName : rStarts)
2005 BookmarkToWord(bookmarkName, &bMove, &bFrom), RTL_TEXTENCODING_UTF8);
2012 if ( pRedlineData && pRedlineData->
IsMoved() )
2013 DoWriteMoveRangeTagStart(sBookmarkName, bFrom, pRedlineData);
2016 DoWriteBookmarkTagStart(bookmarkName);
2018 m_rOpenedBookmarksIds[bookmarkName] = m_nNextBookmarkId;
2019 m_sLastOpenedBookmark = sBookmarkName;
2020 m_nNextBookmarkId++;
2028 for (
const OUString & bookmarkName : rEnds)
2031 auto pPos = m_rOpenedBookmarksIds.find(bookmarkName);
2033 if (pPos != m_rOpenedBookmarksIds.end())
2040 DoWriteMoveRangeTagEnd(pPos->second, bFrom);
2042 DoWriteBookmarkTagEnd(pPos->second);
2044 m_rOpenedBookmarksIds.erase(bookmarkName);
2059 std::u16string_view permissionIdAndName;
2063 const std::size_t separatorIndex = permissionIdAndName.find(
u':');
2064 assert(separatorIndex != std::u16string_view::npos);
2065 const std::u16string_view permissionId = permissionIdAndName.substr(0, separatorIndex);
2066 const std::u16string_view permissionName = permissionIdAndName.substr(separatorIndex + 1);
2068 m_pSerializer->singleElementNS(XML_w, XML_permStart,
2075 permission,
u"permission-for-user:", &permissionIdAndName);
2076 assert(ok); (
void)ok;
2077 const std::size_t separatorIndex = permissionIdAndName.find(
u':');
2078 assert(separatorIndex != std::u16string_view::npos);
2079 const std::u16string_view permissionId = permissionIdAndName.substr(0, separatorIndex);
2080 const std::u16string_view permissionName = permissionIdAndName.substr(separatorIndex + 1);
2082 m_pSerializer->singleElementNS(XML_w, XML_permStart,
2098 std::u16string_view permissionIdAndName;
2100 auto const ok =
o3tl::starts_with(permission,
u"permission-for-group:", &permissionIdAndName) ||
2102 assert(ok); (
void)ok;
2104 const std::size_t separatorIndex = permissionIdAndName.find(
u':');
2105 assert(separatorIndex != std::u16string_view::npos);
2106 const std::u16string_view permissionId = permissionIdAndName.substr(0, separatorIndex);
2108 m_pSerializer->singleElementNS(XML_w, XML_permEnd,
2115 for (
const OUString & permission : m_rPermissionsStart)
2117 DoWritePermissionTagStart(permission);
2119 m_rPermissionsStart.clear();
2125 for (
const OUString & permission : m_rPermissionsEnd)
2127 DoWritePermissionTagEnd(permission);
2129 m_rPermissionsEnd.clear();
2135 for (
const auto & rName : m_rAnnotationMarksStart )
2143 if ( m_rOpenedAnnotationMarksIds.end() == m_rOpenedAnnotationMarksIds.find( rName ) )
2145 const sal_Int32
nId = m_nNextAnnotationMarkId++;
2146 m_rOpenedAnnotationMarksIds[rName] = nId;
2147 m_pSerializer->singleElementNS( XML_w, XML_commentRangeStart,
2148 FSNS( XML_w, XML_id ), OString::number(nId) );
2149 m_sLastOpenedAnnotationMark = rName;
2152 m_rAnnotationMarksStart.clear();
2155 for (
const auto & rName : m_rAnnotationMarksEnd )
2158 std::map< OString, sal_Int32 >::iterator pPos = m_rOpenedAnnotationMarksIds.find( rName );
2159 if ( pPos != m_rOpenedAnnotationMarksIds.end( ) )
2161 const sal_Int32
nId = ( *pPos ).second;
2162 m_pSerializer->singleElementNS( XML_w, XML_commentRangeEnd,
2163 FSNS( XML_w, XML_id ), OString::number(nId) );
2164 m_rOpenedAnnotationMarksIds.erase( rName );
2166 m_pSerializer->startElementNS(XML_w, XML_r);
2167 m_pSerializer->singleElementNS( XML_w, XML_commentReference,
FSNS( XML_w, XML_id ),
2168 OString::number(nId) );
2169 m_pSerializer->endElementNS(XML_w, XML_r);
2172 m_rAnnotationMarksEnd.clear();
2177 const ::sw::mark::IFieldmark& rFieldmark = *rInfos.
pFieldmark;
2178 FieldMarkParamsHelper params( rFieldmark );
2180 OUString sEntryMacro;
2181 params.extractParam(
"EntryMacro", sEntryMacro);
2182 OUString sExitMacro;
2183 params.extractParam(
"ExitMacro", sExitMacro);
2185 params.extractParam(
"Help", sHelp);
2187 params.extractParam(
"Hint", sHint);
2188 if ( sHint.isEmpty() )
2189 params.extractParam(
"Description", sHint);
2193 uno::Sequence< OUString> vListEntries;
2194 OUString
sName, sSelected;
2200 sName = params.getName();
2201 sal_Int32 nSelectedIndex = 0;
2205 if (nSelectedIndex < vListEntries.getLength() )
2206 sSelected = vListEntries[ nSelectedIndex ];
2209 GetExport().DoComboBox( sName, OUString(), OUString(), sSelected, vListEntries );
2214 bool bChecked =
false;
2219 if ( pCheckboxFm && pCheckboxFm->
IsChecked() )
2222 FFDataWriterHelper ffdataOut( m_pSerializer );
2223 ffdataOut.WriteFormCheckbox( sName, sEntryMacro, sExitMacro, sHelp, sHint, bChecked );
2228 params.extractParam(
"Type", sType);
2229 OUString sDefaultText;
2230 params.extractParam(
"Content", sDefaultText);
2231 sal_uInt16 nMaxLength = 0;
2232 params.extractParam(
"MaxLength", nMaxLength);
2234 params.extractParam(
"Format", sFormat);
2235 FFDataWriterHelper ffdataOut( m_pSerializer );
2236 ffdataOut.WriteFormText( params.getName(), sEntryMacro, sExitMacro, sHelp, sHint,
2237 sType, sDefaultText, nMaxLength, sFormat );
2243 m_pSerializer->startElementNS(XML_w, XML_sdt);
2244 m_pSerializer->startElementNS(XML_w, XML_sdtPr);
2246 if(!sFullDate.isEmpty())
2247 m_pSerializer->startElementNS(XML_w, XML_date,
FSNS(XML_w, XML_fullDate), sFullDate);
2249 m_pSerializer->startElementNS(XML_w, XML_date);
2252 OUString sDateFormat1 = sDateFormat.replaceAll(
"\"",
"'");
2253 m_pSerializer->singleElementNS(XML_w, XML_dateFormat,
2254 FSNS(XML_w, XML_val), sDateFormat1);
2255 m_pSerializer->singleElementNS(XML_w, XML_lid,
2256 FSNS(XML_w, XML_val), sLang);
2257 m_pSerializer->singleElementNS(XML_w, XML_storeMappedDataAs,
2258 FSNS(XML_w, XML_val),
"dateTime");
2259 m_pSerializer->singleElementNS(XML_w, XML_calendar,
2260 FSNS(XML_w, XML_val),
"gregorian");
2261 m_pSerializer->endElementNS(XML_w, XML_date);
2263 if (aGrabBagSdt.hasElements())
2271 m_pSerializer->endElementNS(XML_w, XML_sdtPr);
2273 m_pSerializer->startElementNS(XML_w, XML_sdtContent);
2278 m_pSerializer->startElementNS(XML_w, XML_sdt);
2279 m_pSerializer->startElementNS(XML_w, XML_sdtPr);
2281 if (aGrabBagSdt.hasElements())
2295 OUString sPrefixMapping, sXpath;
2296 for (
const auto& rProp : std::as_const(aGrabBagSdt))
2298 if (rProp.Name ==
"ooxml:CT_SdtPr_dataBinding")
2300 uno::Sequence<beans::PropertyValue> aDataBindingProps;
2301 rProp.Value >>= aDataBindingProps;
2302 for (
const auto& rDBProp : std::as_const(aDataBindingProps))
2304 if (rDBProp.Name ==
"ooxml:CT_DataBinding_prefixMappings")
2305 sPrefixMapping = rDBProp.Value.get<OUString>();
2306 else if (rDBProp.Name ==
"ooxml:CT_DataBinding_xpath")
2307 sXpath = rDBProp.Value.get<OUString>();
2312 if (sXpath.getLength())
2315 m_rExport.AddSdtData(sPrefixMapping, sXpath, sValue);
2319 m_pSerializer->endElementNS(XML_w, XML_sdtPr);
2321 m_pSerializer->startElementNS(XML_w, XML_sdtContent);
2326 if (!m_pContentControl)
2331 m_pSerializer->startElementNS(XML_w, XML_sdt);
2332 m_pSerializer->startElementNS(XML_w, XML_sdtPr);
2333 if (m_pContentControl->GetShowingPlaceHolder())
2335 m_pSerializer->singleElementNS(XML_w, XML_showingPlcHdr);
2338 if (m_pContentControl->GetCheckbox())
2340 m_pSerializer->startElementNS(XML_w14, XML_checkbox);
2341 m_pSerializer->singleElementNS(XML_w14, XML_checked,
FSNS(XML_w14, XML_val),
2342 OString::number(
int(m_pContentControl->GetChecked())));
2343 OUString aCheckedState = m_pContentControl->GetCheckedState();
2344 if (!aCheckedState.isEmpty())
2346 m_pSerializer->singleElementNS(XML_w14, XML_checkedState,
FSNS(XML_w14, XML_val),
2347 OString::number(aCheckedState[0], 16));
2349 OUString aUncheckedState = m_pContentControl->GetUncheckedState();
2350 if (!aUncheckedState.isEmpty())
2352 m_pSerializer->singleElementNS(XML_w14, XML_uncheckedState,
FSNS(XML_w14, XML_val),
2353 OString::number(aUncheckedState[0], 16));
2355 m_pSerializer->endElementNS(XML_w14, XML_checkbox);
2358 if (m_pContentControl->HasListItems())
2360 m_pSerializer->startElementNS(XML_w, XML_dropDownList);
2361 for (
const auto& rItem : m_pContentControl->GetListItems())
2363 m_pSerializer->singleElementNS(XML_w, XML_listItem,
2364 FSNS(XML_w, XML_displayText), rItem.m_aDisplayText,
2365 FSNS(XML_w, XML_value), rItem.m_aValue);
2367 m_pSerializer->endElementNS(XML_w, XML_dropDownList);
2370 m_pSerializer->endElementNS(XML_w, XML_sdtPr);
2371 m_pSerializer->startElementNS(XML_w, XML_sdtContent);
2372 m_pContentControl =
nullptr;
2377 m_pSerializer->endElementNS(XML_w, XML_sdtContent);
2378 m_pSerializer->endElementNS(XML_w, XML_sdt);
2382 std::u16string_view rName,
2383 OUString
const& rSelected,
2384 uno::Sequence<OUString>
const& rListItems)
2386 m_pSerializer->startElementNS(XML_w, XML_sdt);
2387 m_pSerializer->startElementNS(XML_w, XML_sdtPr);
2389 m_pSerializer->singleElementNS(XML_w, XML_alias,
2398 m_pSerializer->startElementNS(XML_w, XML_dropDownList,
2399 FSNS(XML_w, XML_lastValue), OString::number(nId));
2401 for (
auto const& rItem : rListItems)
2404 m_pSerializer->singleElementNS(XML_w, XML_listItem,
2405 FSNS(XML_w, XML_value), item,
2406 FSNS(XML_w, XML_displayText), item);
2409 m_pSerializer->endElementNS(XML_w, XML_dropDownList);
2410 m_pSerializer->endElementNS(XML_w, XML_sdtPr);
2412 m_pSerializer->startElementNS(XML_w, XML_sdtContent);
2416 uno::Sequence<OUString>
const& rListItems)
2427 if (rListItems.size())
2429 m_pSerializer->startElementNS(XML_w, XML_r);
2430 m_pSerializer->startElementNS(XML_w, XML_t);
2431 m_pSerializer->writeEscaped(rListItems[nId]);
2432 m_pSerializer->endElementNS(XML_w, XML_t);
2433 m_pSerializer->endElementNS(XML_w, XML_r);
2436 WriteContentControlEnd();
2444 RunText(rInfos.
pField->ExpandField(
true,
nullptr));
2450 FieldMarkParamsHelper params(rFieldmark);
2453 OUString sCurrentDate;
2455 if(!sCurrentDate.isEmpty())
2457 sFullDate = sCurrentDate +
"T00:00:00Z";
2468 OUString sDateFormat;
2473 uno::Sequence<beans::PropertyValue> aSdtParams;
2476 WriteFormDateStart( sFullDate, sDateFormat, sLang, aSdtParams);
2483 WriteSdtDropDownStart(rField2.
GetName(),
2494 m_sRawText = rField.
GetPar1();
2502 m_pSerializer->startElementNS(XML_w, XML_r);
2506 m_pSerializer->startElementNS( XML_w, XML_fldChar,
2507 FSNS( XML_w, XML_fldCharType ),
"begin" );
2509 WriteFFData(rInfos);
2510 m_pSerializer->endElementNS( XML_w, XML_fldChar );
2513 m_pSerializer->endElementNS( XML_w, XML_r );
2515 CmdField_Impl( pNode, nPos, rInfos, bWriteRun );
2522 m_pSerializer->startElementNS( XML_w, XML_fldChar,
2523 FSNS( XML_w, XML_fldCharType ),
"begin",
2524 FSNS( XML_w, XML_fldLock ),
"true" );
2528 m_pSerializer->startElementNS( XML_w, XML_fldChar,
2529 FSNS( XML_w, XML_fldCharType ),
"begin" );
2533 WriteFFData( rInfos );
2535 m_pSerializer->endElementNS( XML_w, XML_fldChar );
2538 m_pSerializer->endElementNS( XML_w, XML_r );
2543 CmdField_Impl( pNode, nPos, rInfos, bWriteRun );
2545 m_bWritingField =
true;
2556 m_aSeqBookmarksNames[sSeqName].push_back(m_sLastOpenedBookmark);
2559 sal_Int32 nTextToken = XML_instrText;
2560 if ( m_pRedlineData && m_pRedlineData->GetType() == RedlineType::Delete )
2561 nTextToken = XML_delInstrText;
2563 m_pSerializer->startElementNS(XML_w, nTextToken,
FSNS(XML_xml, XML_space),
"preserve");
2564 m_pSerializer->writeEscaped( rCmd );
2565 m_pSerializer->endElementNS( XML_w, nTextToken );
2574 bool bWriteCombChars(
false);
2575 m_pSerializer->startElementNS(XML_w, XML_r);
2578 bWriteCombChars =
true;
2580 DoWriteFieldRunProperties( pNode, nPos, bWriteCombChars );
2583 sal_Int32 nIdx { rInfos.
sCmd.isEmpty() ? -1 : 0 };
2586 OUString sToken = rInfos.
sCmd.getToken( 0,
'\t', nIdx );
2593 sToken = sToken.replaceAll(
"NNNN",
"dddd");
2594 sToken = sToken.replaceAll(
"NN",
"ddd");
2599 bool bIsChanged =
true;
2604 OUString sActualFormula = sToken.trim();
2605 const std::map<OUString, uno::Any>& rGrabBag = pItem->GetGrabBag();
2606 std::map<OUString, uno::Any>::const_iterator aStoredFormula = rGrabBag.find(
"CellFormulaConverted");
2607 if ( aStoredFormula != rGrabBag.end() && sActualFormula.indexOf(
'=') == 0 &&
2610 aStoredFormula = rGrabBag.find(
"CellFormula");
2611 if ( aStoredFormula != rGrabBag.end() )
2613 sToken =
" =" + aStoredFormula->second.get<OUString>();
2622 UErrorCode nErr(U_ZERO_ERROR);
2623 icu::UnicodeString sInput(sToken.getStr());
2625 icu::RegexMatcher aMatcher(
"<([A-Z]{1,3}[0-9]+(:[A-Z]{1,3}[0-9]+)?)>", sInput, 0, nErr);
2626 sInput = aMatcher.replaceAll(icu::UnicodeString(
"$1"), nErr);
2628 icu::RegexMatcher aMatcher2(
"\\bMEAN\\b", sInput, UREGEX_CASE_INSENSITIVE, nErr);
2629 sToken = aMatcher2.replaceAll(icu::UnicodeString(
"AVERAGE"), nErr).getTerminatedBuffer();
2634 DoWriteCmd( sToken );
2643 m_pSerializer->endElementNS( XML_w, XML_r );
2648 sal_Int32
const nPos,
bool const bWriteRun)
2653 m_pSerializer->startElementNS(XML_w, XML_r);
2654 DoWriteFieldRunProperties( pNode, nPos );
2657 m_pSerializer->singleElementNS( XML_w, XML_fldChar,
2658 FSNS( XML_w, XML_fldCharType ),
"separate" );
2662 m_pSerializer->endElementNS( XML_w, XML_r );
2707 m_bPreventDoubleFieldsHandling =
true;
2710 m_pSerializer->startElementNS(XML_w, XML_rPr);
2713 if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList.is() )
2715 m_pSerializer->singleElementNS(XML_w, XML_webHidden);
2720 aAttrIt.
OutAttr( nPos, bWriteCombChars );
2723 WriteCollectedRunProperties();
2725 m_pSerializer->endElementNS( XML_w, XML_rPr );
2728 m_bPreventDoubleFieldsHandling =
false;
2735 WriteContentControlEnd();
2751 WriteContentControlEnd();
2758 CmdField_Impl( pNode, nPos, rInfos,
true );
2759 CmdEndField_Impl( pNode, nPos,
true );
2763 if ( !m_sFieldBkm.isEmpty() )
2765 DoWriteBookmarkTagStart(m_sFieldBkm);
2771 m_pSerializer->startElementNS(XML_w, XML_r);
2772 DoWriteFieldRunProperties( pNode, nPos );
2782 sExpand = rInfos.
pField->ExpandField(
true,
nullptr);
2785 RunText(sExpand.replace(0x0A, 0x0B));
2787 m_pSerializer->endElementNS( XML_w, XML_r );
2791 if ( !m_sFieldBkm.isEmpty() )
2793 DoWriteBookmarkTagEnd(m_nNextBookmarkId);
2795 m_nNextBookmarkId++;
2801 m_bWritingField =
false;
2802 m_pSerializer->startElementNS(XML_w, XML_r);
2803 DoWriteFieldRunProperties( pNode, nPos );
2804 m_pSerializer->singleElementNS(XML_w, XML_fldChar,
FSNS(XML_w, XML_fldCharType),
"end");
2805 m_pSerializer->endElementNS( XML_w, XML_r );
2811 m_sFieldBkm.clear();
2815 sal_uInt16 nSubType = rInfos.
pField->GetSubType( );
2821 m_sFieldBkm.clear();
2824 if (m_sFieldBkm.isEmpty())
2828 m_pSerializer->startElementNS(XML_w, XML_r);
2829 m_pSerializer->singleElementNS( XML_w, XML_fldChar,
2830 FSNS( XML_w, XML_fldCharType ),
"begin" );
2831 m_pSerializer->endElementNS( XML_w, XML_r );
2834 rInfos.
sCmd +=
"\"";
2835 rInfos.
sCmd += m_sFieldBkm;
2836 rInfos.
sCmd +=
"\" ";
2839 m_sFieldBkm = OUString( );
2842 EndField_Impl( pNode, nPos, rInfos );
2851 m_pSerializer->startElementNS(XML_w, XML_rPr);
2853 if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList.is() )
2855 m_pSerializer->singleElementNS(XML_w, XML_webHidden);
2857 InitCollectedRunProperties();
2859 assert( !m_pPostponedGraphic );
2860 m_pPostponedGraphic.reset(
new std::vector<PostponedGraphic>);
2862 assert( !m_pPostponedDiagrams );
2863 m_pPostponedDiagrams.reset(
new std::vector<PostponedDiagram>);
2865 assert(!m_pPostponedDMLDrawings);
2866 m_pPostponedDMLDrawings.reset(
new std::vector<PostponedDrawing>);
2868 assert( !m_pPostponedOLEs );
2869 m_pPostponedOLEs.reset(
new std::vector<PostponedOLE>);
2874 m_pFontsAttrList =
nullptr;
2875 m_pEastAsianLayoutAttrList =
nullptr;
2876 m_pCharLangAttrList =
nullptr;
2879 static const sal_Int32 aOrder[] =
2881 FSNS( XML_w, XML_rStyle ),
2882 FSNS( XML_w, XML_rFonts ),
2883 FSNS( XML_w, XML_b ),
2884 FSNS( XML_w, XML_bCs ),
2885 FSNS( XML_w, XML_i ),
2886 FSNS( XML_w, XML_iCs ),
2887 FSNS( XML_w, XML_caps ),
2888 FSNS( XML_w, XML_smallCaps ),
2889 FSNS( XML_w, XML_strike ),
2890 FSNS( XML_w, XML_dstrike ),
2891 FSNS( XML_w, XML_outline ),
2892 FSNS( XML_w, XML_shadow ),
2893 FSNS( XML_w, XML_emboss ),
2894 FSNS( XML_w, XML_imprint ),
2895 FSNS( XML_w, XML_noProof ),
2896 FSNS( XML_w, XML_snapToGrid ),
2897 FSNS( XML_w, XML_vanish ),
2898 FSNS( XML_w, XML_webHidden ),
2899 FSNS( XML_w, XML_color ),
2900 FSNS( XML_w, XML_spacing ),
2901 FSNS( XML_w, XML_w ),
2902 FSNS( XML_w, XML_kern ),
2903 FSNS( XML_w, XML_position ),
2904 FSNS( XML_w, XML_sz ),
2905 FSNS( XML_w, XML_szCs ),
2906 FSNS( XML_w, XML_highlight ),
2907 FSNS( XML_w, XML_u ),
2908 FSNS( XML_w, XML_effect ),
2909 FSNS( XML_w, XML_bdr ),
2910 FSNS( XML_w, XML_shd ),
2911 FSNS( XML_w, XML_fitText ),
2912 FSNS( XML_w, XML_vertAlign ),
2913 FSNS( XML_w, XML_rtl ),
2914 FSNS( XML_w, XML_cs ),
2915 FSNS( XML_w, XML_em ),
2916 FSNS( XML_w, XML_lang ),
2917 FSNS( XML_w, XML_eastAsianLayout ),
2918 FSNS( XML_w, XML_specVanish ),
2919 FSNS( XML_w, XML_oMath ),
2920 FSNS( XML_w, XML_rPrChange ),
2921 FSNS( XML_w, XML_del ),
2922 FSNS( XML_w14, XML_glow ),
2923 FSNS( XML_w14, XML_shadow ),
2924 FSNS( XML_w14, XML_reflection ),
2925 FSNS( XML_w14, XML_textOutline ),
2926 FSNS( XML_w14, XML_textFill ),
2927 FSNS( XML_w14, XML_scene3d ),
2928 FSNS( XML_w14, XML_props3d ),
2929 FSNS( XML_w14, XML_ligatures ),
2930 FSNS( XML_w14, XML_numForm ),
2931 FSNS( XML_w14, XML_numSpacing ),
2932 FSNS( XML_w14, XML_stylisticSets ),
2933 FSNS( XML_w14, XML_cntxtAlts ),
2951 const NameToId constNameToIdMapping[] =
2953 { OUString(
"glow"),
FSNS( XML_w14, XML_glow ) },
2954 { OUString(
"shadow"),
FSNS( XML_w14, XML_shadow ) },
2955 { OUString(
"reflection"),
FSNS( XML_w14, XML_reflection ) },
2956 { OUString(
"textOutline"),
FSNS( XML_w14, XML_textOutline ) },
2957 { OUString(
"textFill"),
FSNS( XML_w14, XML_textFill ) },
2958 { OUString(
"scene3d"),
FSNS( XML_w14, XML_scene3d ) },
2959 { OUString(
"props3d"),
FSNS( XML_w14, XML_props3d ) },
2960 { OUString(
"ligatures"),
FSNS( XML_w14, XML_ligatures ) },
2961 { OUString(
"numForm"),
FSNS( XML_w14, XML_numForm ) },
2962 { OUString(
"numSpacing"),
FSNS( XML_w14, XML_numSpacing ) },
2963 { OUString(
"stylisticSets"),
FSNS( XML_w14, XML_stylisticSets ) },
2964 { OUString(
"cntxtAlts"),
FSNS( XML_w14, XML_cntxtAlts ) },
2966 { OUString(
"val"),
FSNS( XML_w14, XML_val ) },
2967 { OUString(
"rad"),
FSNS( XML_w14, XML_rad ) },
2968 { OUString(
"blurRad"),
FSNS( XML_w14, XML_blurRad ) },
2969 { OUString(
"stA"),
FSNS( XML_w14, XML_stA ) },
2970 { OUString(
"stPos"),
FSNS( XML_w14, XML_stPos ) },
2971 { OUString(
"endA"),
FSNS( XML_w14, XML_endA ) },
2972 { OUString(
"endPos"),
FSNS( XML_w14, XML_endPos ) },
2973 { OUString(
"dist"),
FSNS( XML_w14, XML_dist ) },
2974 { OUString(
"dir"),
FSNS( XML_w14, XML_dir ) },
2975 { OUString(
"fadeDir"),
FSNS( XML_w14, XML_fadeDir ) },
2976 { OUString(
"sx"),
FSNS( XML_w14, XML_sx ) },
2977 { OUString(
"sy"),
FSNS( XML_w14, XML_sy ) },
2978 { OUString(
"kx"),
FSNS( XML_w14, XML_kx ) },
2979 { OUString(
"ky"),
FSNS( XML_w14, XML_ky ) },
2980 { OUString(
"algn"),
FSNS( XML_w14, XML_algn ) },
2981 { OUString(
"w"),
FSNS( XML_w14, XML_w ) },
2982 { OUString(
"cap"),
FSNS( XML_w14, XML_cap ) },
2983 { OUString(
"cmpd"),
FSNS( XML_w14, XML_cmpd ) },
2984 { OUString(
"pos"),
FSNS( XML_w14, XML_pos ) },
2985 { OUString(
"ang"),
FSNS( XML_w14, XML_ang ) },
2986 { OUString(
"scaled"),
FSNS( XML_w14, XML_scaled ) },
2987 { OUString(
"path"),
FSNS( XML_w14, XML_path ) },
2988 { OUString(
"l"),
FSNS( XML_w14, XML_l ) },
2989 { OUString(
"t"),
FSNS( XML_w14, XML_t ) },
2990 { OUString(
"r"),
FSNS( XML_w14, XML_r ) },
2991 { OUString(
"b"),
FSNS( XML_w14, XML_b ) },
2992 { OUString(
"lim"),
FSNS( XML_w14, XML_lim ) },
2993 { OUString(
"prst"),
FSNS( XML_w14, XML_prst ) },
2994 { OUString(
"rig"),
FSNS( XML_w14, XML_rig ) },
2995 { OUString(
"lat"),
FSNS( XML_w14, XML_lat ) },
2996 { OUString(
"lon"),
FSNS( XML_w14, XML_lon ) },
2997 { OUString(
"rev"),
FSNS( XML_w14, XML_rev ) },
2998 { OUString(
"h"),
FSNS( XML_w14, XML_h ) },
2999 { OUString(
"extrusionH"),
FSNS( XML_w14, XML_extrusionH ) },
3000 { OUString(
"contourW"),
FSNS( XML_w14, XML_contourW ) },
3001 { OUString(
"prstMaterial"),
FSNS( XML_w14, XML_prstMaterial ) },
3002 { OUString(
"id"),
FSNS( XML_w14, XML_id ) },
3004 { OUString(
"schemeClr"),
FSNS( XML_w14, XML_schemeClr ) },
3005 { OUString(
"srgbClr"),
FSNS( XML_w14, XML_srgbClr ) },
3006 { OUString(
"tint"),
FSNS( XML_w14, XML_tint ) },
3007 { OUString(
"shade"),
FSNS( XML_w14, XML_shade ) },
3008 { OUString(
"alpha"),
FSNS( XML_w14, XML_alpha ) },
3009 { OUString(
"hueMod"),
FSNS( XML_w14, XML_hueMod ) },
3010 { OUString(
"sat"),
FSNS( XML_w14, XML_sat ) },
3011 { OUString(
"satOff"),
FSNS( XML_w14, XML_satOff ) },
3012 { OUString(
"satMod"),
FSNS( XML_w14, XML_satMod ) },
3013 { OUString(
"lum"),
FSNS( XML_w14, XML_lum ) },
3014 { OUString(
"lumOff"),
FSNS( XML_w14, XML_lumOff ) },
3015 { OUString(
"lumMod"),
FSNS( XML_w14, XML_lumMod ) },
3016 { OUString(
"noFill"),
FSNS( XML_w14, XML_noFill ) },
3017 { OUString(
"solidFill"),
FSNS( XML_w14, XML_solidFill ) },
3018 { OUString(
"gradFill"),
FSNS( XML_w14, XML_gradFill ) },
3019 { OUString(
"gsLst"),
FSNS( XML_w14, XML_gsLst ) },
3020 { OUString(
"gs"),
FSNS( XML_w14, XML_gs ) },
3021 { OUString(
"pos"),
FSNS( XML_w14, XML_pos ) },
3022 { OUString(
"lin"),
FSNS( XML_w14, XML_lin ) },
3023 { OUString(
"path"),
FSNS( XML_w14, XML_path ) },
3024 { OUString(
"fillToRect"),
FSNS( XML_w14, XML_fillToRect ) },
3025 { OUString(
"prstDash"),
FSNS( XML_w14, XML_prstDash ) },
3026 { OUString(
"round"),
FSNS( XML_w14, XML_round ) },
3027 { OUString(
"bevel"),
FSNS( XML_w14, XML_bevel ) },
3028 { OUString(
"miter"),
FSNS( XML_w14, XML_miter ) },
3029 { OUString(
"camera"),
FSNS( XML_w14, XML_camera ) },
3030 { OUString(
"lightRig"),
FSNS( XML_w14, XML_lightRig ) },
3031 { OUString(
"rot"),
FSNS( XML_w14, XML_rot ) },
3032 { OUString(
"bevelT"),
FSNS( XML_w14, XML_bevelT ) },
3033 { OUString(
"bevelB"),
FSNS( XML_w14, XML_bevelB ) },
3034 { OUString(
"extrusionClr"),
FSNS( XML_w14, XML_extrusionClr ) },
3035 { OUString(
"contourClr"),
FSNS( XML_w14, XML_contourClr ) },
3036 { OUString(
"styleSet"),
FSNS( XML_w14, XML_styleSet ) },
3039 std::optional<sal_Int32> lclGetElementIdForName(std::u16string_view rName)
3041 for (
auto const & i : constNameToIdMapping)
3043 if (rName ==
i.maName)
3048 return std::optional<sal_Int32>();
3051 void lclProcessRecursiveGrabBag(sal_Int32 aElementId,
const css::uno::Sequence<css::beans::PropertyValue>& rElements,
sax_fastparser::FSHelperPtr const & pSerializer)
3053 css::uno::Sequence<css::beans::PropertyValue> aAttributes;
3056 for (
const auto& rElement : rElements)
3058 if (rElement.Name ==
"attributes")
3060 rElement.Value >>= aAttributes;
3064 for (
const auto& rAttribute : std::as_const(aAttributes))
3071 aValue = OString::number(aAny.get<sal_Int32>());
3078 std::optional<sal_Int32> aSubElementId = lclGetElementIdForName(rAttribute.Name);
3080 pAttributes->add(*aSubElementId, aValue);
3083 pSerializer->startElement(aElementId, pAttributes);
3085 for (
const auto& rElement : rElements)
3087 css::uno::Sequence<css::beans::PropertyValue> aSumElements;
3089 std::optional<sal_Int32> aSubElementId = lclGetElementIdForName(rElement.Name);
3092 rElement.Value >>= aSumElements;
3093 lclProcessRecursiveGrabBag(*aSubElementId, aSumElements, pSerializer);
3097 pSerializer->endElement(aElementId);
3105 if ( m_pFontsAttrList.is() )
3108 m_pSerializer->singleElementNS( XML_w, XML_rFonts, xAttrList );
3111 if ( m_pColorAttrList.is() )
3115 m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList );
3118 if ( m_pEastAsianLayoutAttrList.is() )
3121 m_pSerializer->singleElementNS( XML_w, XML_eastAsianLayout, xAttrList );
3124 if ( m_pCharLangAttrList.is() )
3127 m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList );
3130 if (m_nCharTransparence != 0 && m_pColorAttrList && m_aTextEffectsGrabBag.empty())
3132 const char* pVal =
nullptr;
3133 m_pColorAttrList->getAsChar(
FSNS(XML_w, XML_val), pVal);
3134 if (std::string_view(
"auto") != pVal)
3136 m_pSerializer->startElementNS(XML_w14, XML_textFill);
3137 m_pSerializer->startElementNS(XML_w14, XML_solidFill);
3138 m_pSerializer->startElementNS(XML_w14, XML_srgbClr,
FSNS(XML_w14, XML_val), pVal);
3140 m_pSerializer->singleElementNS(XML_w14, XML_alpha,
FSNS(XML_w14, XML_val), OString::number(nTransparence));
3141 m_pSerializer->endElementNS(XML_w14, XML_srgbClr);
3142 m_pSerializer->endElementNS(XML_w14, XML_solidFill);
3143 m_pSerializer->endElementNS(XML_w14, XML_textFill);
3144 m_nCharTransparence = 0;
3147 m_pColorAttrList.clear();
3148 for (
const beans::PropertyValue &
i : m_aTextEffectsGrabBag)
3150 std::optional<sal_Int32> aElementId = lclGetElementIdForName(
i.Name);
3153 uno::Sequence<beans::PropertyValue> aGrabBagSeq;
3154 i.Value >>= aGrabBagSeq;
3155 lclProcessRecursiveGrabBag(*aElementId, aGrabBagSeq, m_pSerializer);
3158 m_aTextEffectsGrabBag.clear();
3169 WriteCollectedRunProperties();
3172 WriteCollectedRunProperties();
3177 m_pSerializer->endElementNS( XML_w, XML_rPr );
3180 FootnoteEndnoteReference();
3188 WritePostponedGraphic();
3190 WritePostponedDiagram();
3192 WritePostponedChart();
3195 WritePostponedDMLDrawing();
3197 WritePostponedOLE();
3199 WritePostponedActiveXControl(
true);
3207 uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObj)->getUnoShape());
3208 uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
3209 if( !xPropSet.is() )
3212 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
3213 uno::Sequence< beans::PropertyValue > aGrabBag;
3214 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"FrameInteropGrabBag"))
3216 xPropSet->getPropertyValue(
"FrameInteropGrabBag") >>= aGrabBag;
3218 else if(xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"InteropGrabBag"))
3220 xPropSet->getPropertyValue(
"InteropGrabBag") >>= aGrabBag;
3223 auto pProp = std::find_if(std::cbegin(aGrabBag), std::cend(aGrabBag),
3224 [
this](
const beans::PropertyValue& rProp) {
3225 return "SdtEndBefore" == rProp.Name && m_aRunSdt.m_bStartedSdt && !m_bEndCharSdt; });
3226 if (pProp != std::cend(aGrabBag))
3227 pProp->Value >>= m_bEndCharSdt;
3232 for (
const auto & rPostponedDiagram : *m_pPostponedGraphic)
3233 FlyFrameGraphic(rPostponedDiagram.grfNode, rPostponedDiagram.size,
3235 rPostponedDiagram.pSdrObj);
3236 m_pPostponedGraphic.reset();
3241 for(
const auto & rPostponedDiagram : *m_pPostponedDiagrams )
3242 m_rExport.SdrExporter().writeDiagram(rPostponedDiagram.object,
3243 *rPostponedDiagram.frame, m_anchorId++);
3244 m_pPostponedDiagrams.reset();
3249 if( m_footnoteEndnoteRefTag == 0 )
3253 const SwEndNoteInfo& rInfo = m_footnoteEndnoteRefTag == XML_footnoteRef ?
3254 m_rExport.m_rDoc.GetFootnoteInfo() : m_rExport.m_rDoc.GetEndNoteInfo();
3258 const OString aStyleId(m_rExport.m_pStyles->GetStyleId(m_rExport.GetId(pCharFormat)));
3259 m_pSerializer->startElementNS(XML_w, XML_rPr);
3260 m_pSerializer->singleElementNS(XML_w, XML_rStyle,
FSNS(XML_w, XML_val), aStyleId);
3261 m_pSerializer->endElementNS( XML_w, XML_rPr );
3264 if (m_footnoteCustomLabel.isEmpty())
3265 m_pSerializer->singleElementNS(XML_w, m_footnoteEndnoteRefTag);
3267 RunText(m_footnoteCustomLabel);
3268 m_footnoteEndnoteRefTag = 0;
3287 if ( pBegin >= pEnd )
3291 if ( *pBegin ==
' ' || *( pEnd - 1 ) ==
' ' )
3293 pSerializer->startElementNS(XML_w, nTextToken,
FSNS(XML_xml, XML_space),
"preserve");
3296 pSerializer->startElementNS(XML_w, nTextToken);
3298 pSerializer->writeEscaped( std::u16string_view( pBegin, pEnd - pBegin ) );
3300 pSerializer->endElementNS( XML_w, nTextToken );
3307 if( m_closeHyperlinkInThisRun )
3309 m_closeHyperlinkInPreviousRun =
true;
3311 if (m_nCloseContentControlInThisRun > 0)
3313 ++m_nCloseContentControlInPreviousRun;
3314 --m_nCloseContentControlInThisRun;
3316 m_bRunTextIsOn =
true;
3319 const sal_Unicode *pEnd = pBegin + rText.getLength();
3322 sal_Int32 nTextToken = XML_t;
3323 if ( m_pRedlineData && !m_pRedlineData->IsMoved() &&
3324 m_pRedlineData->GetType() == RedlineType::Delete )
3326 nTextToken = XML_delText;
3331 for (
const sal_Unicode *pIt = pBegin; pIt < pEnd; ++pIt )
3337 m_pSerializer->singleElementNS(XML_w, XML_tab);
3342 if (
impl_WriteRunText( m_pSerializer, nTextToken, pBegin, pIt ) || prevUnicode < 0x0020)
3344 m_pSerializer->singleElementNS(XML_w, XML_br);
3351 m_pSerializer->singleElementNS(XML_w, XML_noBreakHyphen);
3356 m_pSerializer->singleElementNS(XML_w, XML_softHyphen);
3360 if ( *pIt < 0x0020 )
3363 SAL_INFO(
"sw.ww8",
"Ignored control code in a text run: " <<
unsigned(*pIt) );
3380 WW8Ruby aWW8Ruby( rNode, rRuby, GetExport() );
3381 SAL_INFO(
"sw.ww8",
"TODO DocxAttributeOutput::StartRuby( const SwTextNode& rNode, const SwFormatRuby& rRuby )" );
3382 EndRun( &rNode, nPos );
3383 assert(!m_closeHyperlinkInThisRun);
3384 assert(!m_closeHyperlinkInPreviousRun);
3385 m_pSerializer->startElementNS(XML_w, XML_r);
3386 m_pSerializer->startElementNS(XML_w, XML_ruby);
3387 m_pSerializer->startElementNS(XML_w, XML_rubyPr);
3389 m_pSerializer->singleElementNS( XML_w, XML_rubyAlign,
3390 FSNS( XML_w, XML_val ), lclConvertWW8JCToOOXMLRubyAlign(aWW8Ruby.
GetJC()) );
3392 sal_uInt32 nHpsBaseText = (aWW8Ruby.
GetBaseHeight() + 5) / 10;
3393 m_pSerializer->singleElementNS(XML_w, XML_hps,
FSNS(XML_w, XML_val), OString::number(nHps));
3395 m_pSerializer->singleElementNS( XML_w, XML_hpsRaise,
3396 FSNS( XML_w, XML_val ), OString::number(nHpsBaseText) );
3398 m_pSerializer->singleElementNS( XML_w, XML_hpsBaseText,
3399 FSNS( XML_w, XML_val ), OString::number(nHpsBaseText) );
3404 m_pSerializer->singleElementNS(XML_w, XML_lid,
FSNS(XML_w, XML_val), sLang);
3406 m_pSerializer->endElementNS( XML_w, XML_rubyPr );
3408 m_pSerializer->startElementNS(XML_w, XML_rt);
3409 StartRun(
nullptr, nPos );
3410 StartRunProperties( );
3424 EndRunProperties(
nullptr );
3426 EndRun( &rNode, nPos );
3427 m_pSerializer->endElementNS( XML_w, XML_rt );
3429 m_pSerializer->startElementNS(XML_w, XML_rubyBase);
3430 StartRun(
nullptr, nPos );
3435 SAL_INFO(
"sw.ww8",
"TODO DocxAttributeOutput::EndRuby()" );
3436 EndRun( &rNode, nPos );
3437 m_pSerializer->endElementNS( XML_w, XML_rubyBase );
3438 m_pSerializer->endElementNS( XML_w, XML_ruby );
3439 m_pSerializer->endElementNS( XML_w, XML_r );
3440 StartRun(
nullptr, nPos);
3447 if ( !pMark->isEmpty() )
3449 OUString sURL = *pLinkURL;
3451 if ( bBookMarkOnly )
3456 sURL +=
" \\l \"" + *pMark +
"\"";
3458 if ( !rTarget.isEmpty() )
3459 sURL +=
" \\n " + rTarget;
3464 return bBookMarkOnly;
3469 m_aBookmarksOfParagraphStart.insert(std::pair<sal_Int32, OUString>(nFirstRunPos, rName));
3470 m_aBookmarksOfParagraphEnd.insert(std::pair<sal_Int32, OUString>(nLastRunPos, rName));
3478 bool bBookmarkOnly = AnalyzeURL( rUrl, rTarget, &sUrl, &sMark );
3480 m_hyperLinkAnchor = sMark;
3482 if ( !sMark.isEmpty() && !bBookmarkOnly )
3489 m_pHyperlinkAttrList = FastSerializerHelper::createAttrList();
3491 if ( !bBookmarkOnly )
3493 OString
sId =
OUStringToOString( GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(),
3495 sUrl, true ), RTL_TEXTENCODING_UTF8 );
3497 m_pHyperlinkAttrList->add(
FSNS(XML_r, XML_id), sId);
3504 if (sMark.endsWith(
"|sequence"))
3506 sal_Int32
nPos = sMark.indexOf(
'!');
3510 OUString aSequenceName = sMark.copy(0, nPos);
3512 sal_uInt32
nIndex =
o3tl::toUInt32(sMark.subView(nPos + 1, sMark.getLength() - nPos -
sizeof(
"|sequence")));
3513 std::map<OUString, std::vector<OString> >::iterator it = m_aSeqBookmarksNames.find(aSequenceName);
3514 if (it != m_aSeqBookmarksNames.end())
3516 std::vector<OString>& rNames = it->second;
3517 if (rNames.size() > nIndex)
3519 sMark = OStringToOUString(rNames[nIndex], RTL_TEXTENCODING_UTF8);
3523 else if (sMark.endsWith(
"|toxmark"))
3525 if (
auto const it = GetExport().m_TOXMarkBookmarksByURL.find(sMark);
3526 it != GetExport().m_TOXMarkBookmarksByURL.end())
3532 sMark = sMark.replace(
' ',
'_');
3533 m_pHyperlinkAttrList->add(
FSNS( XML_w, XML_anchor ),
3537 if ( !rTarget.isEmpty() )
3540 m_pHyperlinkAttrList->add(
FSNS(XML_w, XML_tgtFrame), soTarget);
3549 m_closeHyperlinkInThisRun =
true;
3550 if(m_startedHyperlink && !m_hyperLinkAnchor.isEmpty() && m_hyperLinkAnchor.startsWith(
"_Toc"))
3552 m_endPageRef =
true;
3558 ww::eField const eType, OUString
const*
const pBookmarkName)
3560 WriteField_Impl(
nullptr, eType, rText,
FieldFlags::All, pBookmarkName);
3568 if ( !pRedlineData )
3574 OString
aId( OString::number( pRedlineData->
GetSeqNo() ) );
3575 const OUString &rAuthor(
SW_MOD()->GetRedlineAuthor( pRedlineData->
GetAuthor() ) );
3577 bool bNoDate = bRemovePersonalInfo ||
3580 switch( pRedlineData->
GetType() )
3582 case RedlineType::Insert:
3585 case RedlineType::Delete:
3588 case RedlineType::Format:
3593 pAttributeList->add(
FSNS( XML_w, XML_id ), aId);
3594 pAttributeList->add(
FSNS( XML_w, XML_author ), bRemovePersonalInfo
3595 ?
"Author" + OString::number( GetExport().GetInfoID(rAuthor) )
3596 : rAuthor.toUtf8());
3599 m_pSerializer->startElementNS( XML_w, XML_rPrChange, pAttributeList );
3608 if (pFormattingChanges)
3616 m_pSerializer->startElementNS(XML_w, XML_rPr);
3620 m_rExport.OutputItemSet( *pChangesSet,
false,
true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF );
3622 m_pSerializer->endElementNS( XML_w, XML_rPr );
3629 m_pSerializer->endElementNS( XML_w, XML_rPrChange );
3632 case RedlineType::ParagraphFormat:
3637 pAttributeList->add(
FSNS( XML_w, XML_id ), aId);
3638 pAttributeList->add(
FSNS( XML_w, XML_author ), bRemovePersonalInfo
3639 ?
"Author" + OString::number( GetExport().GetInfoID(rAuthor) )
3640 : rAuthor.toUtf8());
3643 m_pSerializer->startElementNS( XML_w, XML_pPrChange, pAttributeList );
3652 if (pFormattingChanges)
3656 const OUString & sParaStyleName = pFormattingChanges->
GetFormatName();
3657 if (pChangesSet || !sParaStyleName.isEmpty())
3661 m_pSerializer->startElementNS(XML_w, XML_pPr);
3664 if ( !sStyleName.isEmpty() )
3665 m_pSerializer->singleElementNS(XML_w, XML_pStyle,
FSNS(XML_w, XML_val), sStyleName);
3673 m_rExport.SdrExporter().getFlyAttrList().clear();
3675 m_pParagraphSpacingAttrList.clear();
3679 m_rExport.OutputItemSet( *pChangesSet,
true,
false, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF );
3682 WriteCollectedParagraphProperties();
3685 m_rExport.SdrExporter().getFlyAttrList() = pFlyAttrList_Original;
3686 m_pParagraphSpacingAttrList = pParagraphSpacingAttrList_Original;
3688 m_pSerializer->endElementNS( XML_w, XML_pPr );
3694 m_pSerializer->endElementNS( XML_w, XML_pPrChange );
3708 if ( !pRedlineData )
3712 StartRedline( pRedlineData->
Next() );
3714 OString
aId( OString::number( m_nRedlineId++ ) );
3719 const OUString &rAuthor(
SW_MOD()->GetRedlineAuthor( pRedlineData->
GetAuthor() ) );
3721 ?
"Author" + OUString::number( GetExport().GetInfoID(rAuthor) )
3722 : rAuthor, RTL_TEXTENCODING_UTF8 ) );
3725 bool bNoDate = bRemovePersonalInfo ||
3727 bool bMoved = pRedlineData->
IsMoved();
3728 switch ( pRedlineData->
GetType() )
3730 case RedlineType::Insert:
3731 case RedlineType::Delete:
3733 sal_Int32 eElement = RedlineType::Insert == pRedlineData->
GetType()
3734 ? ( bMoved ? XML_moveTo : XML_ins )
3735 : ( bMoved ? XML_moveFrom : XML_del );
3737 m_pSerializer->startElementNS( XML_w, eElement,
3738 FSNS( XML_w, XML_id ), aId,
3739 FSNS( XML_w, XML_author ), aAuthor );
3741 m_pSerializer->startElementNS( XML_w, eElement,
3742 FSNS( XML_w, XML_id ), aId,
3743 FSNS( XML_w, XML_author ), aAuthor,
3747 case RedlineType::Format:
3748 SAL_INFO(
"sw.ww8",
"TODO DocxAttributeOutput::StartRedline()" );
3757 if ( !pRedlineData || m_bWritingField )
3760 bool bMoved = pRedlineData->
IsMoved();
3761 switch ( pRedlineData->
GetType() )
3763 case RedlineType::Insert:
3764 m_pSerializer->endElementNS( XML_w, bMoved ? XML_moveTo : XML_ins );
3767 case RedlineType::Delete:
3768 m_pSerializer->endElementNS( XML_w, bMoved ? XML_moveFrom : XML_del );
3771 case RedlineType::Format:
3772 SAL_INFO(
"sw.ww8",
"TODO DocxAttributeOutput::EndRedline()" );
3779 EndRedline( pRedlineData->
Next() );
3784 SAL_INFO(
"sw.ww8",
"TODO DocxAttributeOutput::FormatDrop( const SwTextNode& rNode, const SwFormatDrop& rSwFormatDrop, sal_uInt16 nStyle )" );
3789 OString aStyleId(m_rExport.m_pStyles->GetStyleId(nStyle));
3791 m_pSerializer->singleElementNS(XML_w, XML_pStyle,
FSNS(XML_w, XML_val), aStyleId);
3795 bool bWriteShadow,
const table::BorderLine2* rStyleProps =
nullptr )
3804 const char* pVal =
"nil";
3805 if ( pBorderLine && !pBorderLine->isEmpty( ) )
3807 switch (pBorderLine->GetBorderLineStyle())
3809 case SvxBorderLineStyle::SOLID:
3812 case SvxBorderLineStyle::DOTTED:
3815 case SvxBorderLineStyle::DASHED:
3818 case SvxBorderLineStyle::DOUBLE:
3819 case SvxBorderLineStyle::DOUBLE_THIN:
3822 case SvxBorderLineStyle::THINTHICK_SMALLGAP:
3823 pVal =
"thinThickSmallGap";
3825 case SvxBorderLineStyle::THINTHICK_MEDIUMGAP:
3826 pVal =
"thinThickMediumGap";
3828 case SvxBorderLineStyle::THINTHICK_LARGEGAP:
3829 pVal =
"thinThickLargeGap";
3831 case SvxBorderLineStyle::THICKTHIN_SMALLGAP:
3832 pVal =
"thickThinSmallGap";
3834 case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP:
3835 pVal =
"thickThinMediumGap";
3837 case SvxBorderLineStyle::THICKTHIN_LARGEGAP:
3838 pVal =
"thickThinLargeGap";
3840 case SvxBorderLineStyle::EMBOSSED:
3841 pVal =
"threeDEmboss";
3843 case SvxBorderLineStyle::ENGRAVED:
3844 pVal =
"threeDEngrave";
3846 case SvxBorderLineStyle::OUTSET:
3849 case SvxBorderLineStyle::INSET:
3852 case SvxBorderLineStyle::FINE_DASHED:
3853 pVal =
"dashSmallGap";
3855 case SvxBorderLineStyle::DASH_DOT:
3858 case SvxBorderLineStyle::DASH_DOT_DOT:
3859 pVal =
"dotDotDash";
3861 case SvxBorderLineStyle::NONE:
3866 else if ( !rStyleProps || !rStyleProps->LineWidth )
3874 if( rStyleProps !=
nullptr && pBorderLine && !pBorderLine->isEmpty() &&
3875 pBorderLine->GetBorderLineStyle() ==
static_cast<SvxBorderLineStyle>(rStyleProps->LineStyle) &&
3881 pAttr->add(
FSNS( XML_w, XML_val ), OString( pVal ) );
3883 if ( pBorderLine && !pBorderLine->isEmpty() )
3888 pBorderLine->GetBorderLineStyle(), pBorderLine->GetWidth()));
3890 sal_Int32 nWidth = sal_Int32( fConverted / 2.5 );
3891 const sal_Int32 nMinWidth = 2;
3892 const sal_Int32 nMaxWidth = 96;
3894 if ( nWidth > nMaxWidth )
3896 else if ( nWidth < nMinWidth )
3899 pAttr->add(
FSNS( XML_w, XML_sz ), OString::number( nWidth ) );
3902 pAttr->add(
FSNS(XML_w, XML_space), OString::number(rtl::math::round(nDist / 20.0)));
3906 pAttr->add(
FSNS( XML_w, XML_color ), sColor );
3912 pAttr->add(
FSNS( XML_w, XML_shadow ),
"1" );
3915 pSerializer->singleElementNS( XML_w, elementToken, pAttr );
3922 rOptions.
tag = XML_tcBorders;
3934 rOptions.
tag = XML_pBdr;
3946 css::table::BorderLine2> &rTableStyleConf )
3950 SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
3953 const sal_Int32 aXmlElements[] =
3960 bool tagWritten =
false;
3963 for(
int i = 0;
i < 4; ++
i, ++pBrd )
3965 const SvxBorderLine* pLn = rBox.
GetLine( *pBrd );
3966 const table::BorderLine2 *aStyleProps =
nullptr;
3967 if( rTableStyleConf.find( *pBrd ) != rTableStyleConf.end() )
3968 aStyleProps = &rTableStyleConf[ *pBrd ];
3972 pSerializer->startElementNS(XML_w, rOptions.
tag);
3976 bool bWriteShadow =
false;
3989 bWriteShadow =
true;
3996 ((rOptions.
aShadowLocation == SvxShadowLocation::TopLeft || rOptions.
aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::TOP ) ||
3997 ((rOptions.
aShadowLocation == SvxShadowLocation::TopLeft || rOptions.
aShadowLocation == SvxShadowLocation::BottomLeft) && *pBrd == SvxBoxItemLine::LEFT ) ||
3998 ((rOptions.
aShadowLocation == SvxShadowLocation::BottomLeft ) && *pBrd == SvxBoxItemLine::BOTTOM) ||
3999 ((rOptions.
aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::RIGHT )
4002 bWriteShadow =
true;
4006 sal_uInt16 nDist = 0;
4011 if ( *pBrd == SvxBoxItemLine::TOP)
4013 else if ( *pBrd == SvxBoxItemLine::LEFT)
4015 else if ( *pBrd == SvxBoxItemLine::BOTTOM)
4017 else if ( *pBrd == SvxBoxItemLine::RIGHT)
4026 impl_borderLine( pSerializer, aXmlElements[
i], pLn, nDist, bWriteShadow, aStyleProps );
4029 pSerializer->endElementNS( XML_w, rOptions.
tag );
4037 SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
4040 const sal_Int32 aXmlElements[] =
4043 bUseStartEnd ? XML_start : XML_left,
4045 bUseStartEnd ? XML_end : XML_right
4047 bool tagWritten =
false;
4049 for(
int i = 0;
i < 4; ++
i, ++pBrd )
4051 sal_Int32 nDist = sal_Int32( rBox.
GetDistance( *pBrd ) );
4053 if (pDefaultMargins)
4056 if (sal_Int32( pDefaultMargins->GetDistance( *pBrd ) ) == nDist)
4061 pSerializer->startElementNS(XML_w, tag);
4064 pSerializer->singleElementNS( XML_w, aXmlElements[
i],
4065 FSNS( XML_w, XML_w ), OString::number(nDist),
4069 pSerializer->endElementNS( XML_w, tag );
4075 m_pSerializer->startElementNS(XML_w, XML_tcPr);
4077 const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( );
4082 TableCellRedline( pTableTextNodeInfoInner );
4085 SwTwips nWidth = GetGridCols( pTableTextNodeInfoInner )->at( nCell );
4087 nWidth = nWidth - GetGridCols( pTableTextNodeInfoInner )->at( nCell - 1 );
4088 m_pSerializer->singleElementNS( XML_w, XML_tcW,
4089 FSNS( XML_w, XML_w ), OString::number(nWidth),
4096 if (nCell < rTableCells.size() )
4099 const sal_uInt16 nColSpan = rCell.
GetColSpan();
4101 m_pSerializer->singleElementNS( XML_w, XML_gridSpan,
4102 FSNS( XML_w, XML_val ), OString::number(nColSpan) );
4107 sal_Int32 vSpan = (*xRowSpans)[nCell];
4110 m_pSerializer->singleElementNS(XML_w, XML_vMerge,
FSNS(XML_w, XML_val),
"restart");
4112 else if ( vSpan < 0 )
4114 m_pSerializer->singleElementNS(XML_w, XML_vMerge,
FSNS(XML_w, XML_val),
"continue");
4119 const std::map<OUString, uno::Any>& rGrabBag = pItem->GetGrabBag();
4120 std::map<OUString, uno::Any>::const_iterator it = rGrabBag.find(
"CellCnfStyle");
4121 if (it != rGrabBag.end())
4123 uno::Sequence<beans::PropertyValue> aAttributes = it->second.get< uno::Sequence<beans::PropertyValue> >();
4124 m_pTableStyleExport->CnfStyle(aAttributes);
4130 const SvxBoxItem& rDefaultBox = (*m_TableFirstCells.rbegin())->getTableBox( )->GetFrameFormat( )->GetBox( );
4134 m_aTableStyleConfs.back());
4137 TableBackgrounds( pTableTextNodeInfoInner );
4144 TableVerticalCell( pTableTextNodeInfoInner );
4146 m_pSerializer->endElementNS( XML_w, XML_tcPr );
4151 const SwTable* pTable = pTableTextNodeInfoInner->getTable();
4152 if (m_xTableWrt && pTable == m_xTableWrt->GetTable())
4156 bool bRelBoxSize =
false;
4159 GetTablePageSize( pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize );
4162 const sal_uInt32 nTableSz =
static_cast<sal_uInt32
>(pFormat->GetFrameSize( ).GetWidth( ));
4173 m_aTableStyleConfs.push_back({});
4178 m_pSerializer->startElementNS(XML_w, XML_tbl);
4180 m_TableFirstCells.push_back(pTableTextNodeInfoInner);
4181 m_LastOpenCell.push_back(-1);
4182 m_LastClosedCell.push_back(-1);
4184 InitTableHelper( pTableTextNodeInfoInner );
4185 TableDefinition( pTableTextNodeInfoInner );
4190 m_pSerializer->endElementNS( XML_w, XML_tbl );
4192 if ( m_tableReference->m_nTableDepth > 0 )
4193 --m_tableReference->m_nTableDepth;
4195 m_LastClosedCell.pop_back();
4196 m_LastOpenCell.pop_back();
4197 m_TableFirstCells.pop_back();
4202 if( !m_TableFirstCells.empty() )
4203 m_tableReference->m_bTableCellOpen =
true;
4206 m_xTableWrt.reset();
4208 m_aTableStyleConfs.pop_back();
4213 m_pSerializer->startElementNS(XML_w, XML_tr);
4216 m_pSerializer->startElementNS(XML_w, XML_trPr);
4219 const SwTable *pTable = pTableTextNodeInfoInner->getTable( );
4220 if ( pTable->
GetRowsToRepeat( ) > pTableTextNodeInfoInner->getRow( ) )
4221 m_pSerializer->singleElementNS(XML_w, XML_tblHeader,
FSNS(XML_w, XML_val),
"true");
4223 TableRowRedline( pTableTextNodeInfoInner );
4224 TableHeight( pTableTextNodeInfoInner );
4225 TableCanSplit( pTableTextNodeInfoInner );
4227 const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox();
4231 const std::map<OUString, uno::Any>& rGrabBag = pItem->GetGrabBag();
4232 std::map<OUString, uno::Any>::const_iterator it = rGrabBag.find(
"RowCnfStyle");
4233 if (it != rGrabBag.end())
4235 uno::Sequence<beans::PropertyValue> aAttributes = it->second.get< uno::Sequence<beans::PropertyValue> >();
4236 m_pTableStyleExport->CnfStyle(aAttributes);
4241 m_pSerializer->endElementNS( XML_w, XML_trPr );
4246 m_pSerializer->endElementNS( XML_w, XML_tr );
4247 m_LastOpenCell.back() = -1;
4248 m_LastClosedCell.back() = -1;
4253 m_LastOpenCell.back() = nCell;
4255 InitTableHelper( pTableTextNodeInfoInner );
4257 m_pSerializer->startElementNS(XML_w, XML_tc);
4260 TableCellProperties( pTableTextNodeInfoInner, nCell, nRow );
4262 m_tableReference->m_bTableCellOpen =
true;
4267 m_LastClosedCell.back() = nCell;
4268 m_LastOpenCell.back() = -1;
4270 if (m_tableReference->m_bTableCellParaSdtOpen)
4273 m_pSerializer->endElementNS( XML_w, XML_tc );
4275 m_tableReference->m_bTableCellOpen =
false;
4276 m_tableReference->m_bTableCellParaSdtOpen =
false;
4291 OString lcl_padStartToLength(OString
const & aString, sal_Int32 nLen,
char cFill)
4293 if (nLen > aString.getLength())
4295 sal_Int32 nDiff = nLen - aString.getLength();
4298 aBuffer.append(aString);
4299 return aBuffer.makeStringAndClear();
4308 sal_Int32 lcl_getWordCompatibilityMode(
const DocxExport& rDocExport)
4315 if (nWordCompatibilityMode == -1 || 14 < nWordCompatibilityMode)
4317 nWordCompatibilityMode = 14;
4321 return nWordCompatibilityMode;
4331 m_pSerializer->startElementNS(XML_w, XML_tblPr);
4333 static const sal_Int32 aOrder[] =
4335 FSNS( XML_w, XML_tblStyle ),
4336 FSNS( XML_w, XML_tblpPr ),
4337 FSNS( XML_w, XML_tblOverlap ),
4338 FSNS( XML_w, XML_bidiVisual ),
4339 FSNS( XML_w, XML_tblStyleRowBandSize ),
4340 FSNS( XML_w, XML_tblStyleColBandSize ),
4341 FSNS( XML_w, XML_tblW ),
4342 FSNS( XML_w, XML_jc ),
4343 FSNS( XML_w, XML_tblCellSpacing ),
4344 FSNS( XML_w, XML_tblInd ),
4345 FSNS( XML_w, XML_tblBorders ),
4346 FSNS( XML_w, XML_shd ),
4347 FSNS( XML_w, XML_tblLayout ),
4348 FSNS( XML_w, XML_tblCellMar ),
4349 FSNS( XML_w, XML_tblLook ),
4350 FSNS( XML_w, XML_tblPrChange )
4359 const char* widthType =
"dxa";
4362 const SwTable *pTable = pTableTextNodeInfoInner->getTable();
4367 const ww8::Frame* pFloatingTableFrame = m_rExport.GetFloatingTableFrame();
4368 if (pFloatingTableFrame)
4375 bool isWidthRelative =
false;
4376 xPropertySet->getPropertyValue(
"IsWidthRelative") >>= isWidthRelative;
4377 if (!isWidthRelative && !nWidthPercent)
4380 short nHoriOrient = -1;
4381 xPropertySet->getPropertyValue(
"HoriOrient") >>= nHoriOrient;
4382 isWidthRelative = nHoriOrient == text::HoriOrientation::FULL;
4383 if (isWidthRelative)
4384 nWidthPercent = 100;
4400 nPageSize = nWidthPercent * 50 ;
4405 bool bRelBoxSize =
false;
4407 GetTablePageSize( pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize );
4413 m_pSerializer->singleElementNS( XML_w, XML_tblW,
4414 FSNS( XML_w, XML_w ), OString::number(nPageSize),
4418 m_pSerializer->singleElementNS( XML_w, XML_tblLayout,
4422 std::map<OUString, css::uno::Any> aGrabBag =
4427 std::map<SvxBoxItemLine, css::table::BorderLine2>& rTableStyleConf = m_aTableStyleConfs.back();
4428 rTableStyleConf.clear();
4431 for(
const auto & rGrabBagElement : aGrabBag )
4433 if( rGrabBagElement.first ==
"TableStyleName")
4435 OString sStyleName =
OUStringToOString( rGrabBagElement.second.get<OUString>(), RTL_TEXTENCODING_UTF8 );
4436 m_pSerializer->singleElementNS(XML_w, XML_tblStyle,
FSNS(XML_w, XML_val), sStyleName);
4438 else if( rGrabBagElement.first ==
"TableStyleTopBorder" )
4439 rTableStyleConf[SvxBoxItemLine::TOP] = rGrabBagElement.second.get<table::BorderLine2>();
4440 else if( rGrabBagElement.first ==
"TableStyleBottomBorder" )
4441 rTableStyleConf[SvxBoxItemLine::BOTTOM]
4442 = rGrabBagElement.second.get<table::BorderLine2>();
4443 else if( rGrabBagElement.first ==
"TableStyleLeftBorder" )
4444 rTableStyleConf[SvxBoxItemLine::LEFT]
4445 = rGrabBagElement.second.get<table::BorderLine2>();
4446 else if( rGrabBagElement.first ==
"TableStyleRightBorder" )
4447 rTableStyleConf[SvxBoxItemLine::RIGHT]
4448 = rGrabBagElement.second.get<table::BorderLine2>();
4449 else if (rGrabBagElement.first ==
"TableStyleLook")
4452 const uno::Sequence<beans::PropertyValue> aAttributeList = rGrabBagElement.second.get< uno::Sequence<beans::PropertyValue> >();
4454 for (
const auto& rAttribute : aAttributeList)
4456 if (rAttribute.Name ==
"val")
4457 pAttributeList->add(
FSNS(XML_w, XML_val), lcl_padStartToLength(OString::number(rAttribute.Value.get<sal_Int32>(), 16), 4,
'0'));
4462 {
"firstRow", XML_firstRow},
4463 {
"lastRow", XML_lastRow},
4464 {
"firstColumn", XML_firstColumn},
4465 {
"lastColumn", XML_lastColumn},
4466 {
"noHBand", XML_noHBand},
4467 {
"noVBand", XML_noVBand},
4472 pAttributeList->add(
FSNS(XML_w,
nToken), (rAttribute.Value.get<sal_Int32>() ?
"1" :
"0"));
4476 m_pSerializer->singleElementNS(XML_w, XML_tblLook, pAttributeList);
4478 else if (rGrabBagElement.first ==
"TablePosition" &&
4481 rGrabBagElement.second !=
uno::Any() )
4484 const uno::Sequence<beans::PropertyValue> aTablePosition = rGrabBagElement.second.get<uno::Sequence<beans::PropertyValue> >();
4486 const ww8::Frame* pFrame = m_rExport.GetFloatingTableFrame();
4490 OString sOrientation;
4494 OString sTblpXSpec =
convertToOOXMLHoriOrient( pFrame->GetFrameFormat().GetHoriOrient().GetHoriOrient(), pFrame->GetFrameFormat().GetHoriOrient().IsPosToggle() );
4498 attrListTablePos->add(
FSNS(XML_w, XML_vertAnchor), sOrientation);
4500 if( !sTblpYSpec.isEmpty() )
4501 attrListTablePos->add(
FSNS(XML_w, XML_tblpYSpec), sTblpYSpec);
4504 attrListTablePos->add(
FSNS(XML_w, XML_horzAnchor), sOrientation);
4506 if( !sTblpXSpec.isEmpty() )
4507 attrListTablePos->add(
FSNS(XML_w, XML_tblpXSpec), sTblpXSpec);
4509 nValue = pFrame->GetFrameFormat().GetULSpace().GetLower();
4511 attrListTablePos->add(
FSNS( XML_w, XML_bottomFromText ), OString::number( nValue ) );
4513 nValue = pFrame->GetFrameFormat().GetLRSpace().GetLeft();
4515 attrListTablePos->add(
FSNS( XML_w, XML_leftFromText ), OString::number( nValue ) );
4517 nValue = pFrame->GetFrameFormat().GetLRSpace().GetRight();
4519 attrListTablePos->add(
FSNS( XML_w, XML_rightFromText ), OString::number( nValue ) );
4521 nValue = pFrame->GetFrameFormat().GetULSpace().GetUpper();
4523 attrListTablePos->add(
FSNS( XML_w, XML_topFromText ), OString::number( nValue ) );
4525 if( sTblpXSpec.isEmpty() )
4527 nValue = pFrame->GetFrameFormat().GetHoriOrient().GetPos();
4531 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
4534 sal_uInt16 nLeftDistance = rBox.
GetDistance(SvxBoxItemLine::LEFT);
4535 nValue += nLeftDistance;
4542 nValue += (nWidth / 2);
4545 attrListTablePos->add(
FSNS( XML_w, XML_tblpX ), OString::number( nValue ) );
4548 if( sTblpYSpec.isEmpty() )
4550 nValue = pFrame->GetFrameFormat().GetVertOrient().GetPos();
4551 attrListTablePos->add(
FSNS( XML_w, XML_tblpY ), OString::number( nValue ) );
4557 for (
const auto& rProp : aTablePosition)
4559 if (rProp.Name ==
"vertAnchor" && !rProp.Value.get<OUString>().isEmpty())
4561 OString sOrientation =
OUStringToOString( rProp.Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
4562 attrListTablePos->add(
FSNS(XML_w, XML_vertAnchor), sOrientation);
4564 else if (rProp.Name ==
"tblpYSpec" && !rProp.Value.get<OUString>().isEmpty())
4566 OString sOrientation =
OUStringToOString( rProp.Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
4567 attrListTablePos->add(
FSNS(XML_w, XML_tblpYSpec), sOrientation);
4569 else if (rProp.Name ==
"horzAnchor" && !rProp.Value.get<OUString>().isEmpty())
4571 OString sOrientation =
OUStringToOString( rProp.Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
4572 attrListTablePos->add(
FSNS(XML_w, XML_horzAnchor), sOrientation);
4574 else if (rProp.Name ==
"tblpXSpec" && !rProp.Value.get<OUString>().isEmpty())
4576 OString sOrientation =
OUStringToOString( rProp.Value.get<OUString>(), RTL_TEXTENCODING_UTF8);
4577 attrListTablePos->add(
FSNS(XML_w, XML_tblpXSpec), sOrientation);
4579 else if (rProp.Name ==
"bottomFromText")
4581 sal_Int32
nValue = rProp.Value.get<sal_Int32>();
4582 attrListTablePos->add(
FSNS( XML_w, XML_bottomFromText ), OString::number( nValue ) );
4584 else if (rProp.Name ==
"leftFromText")
4586 sal_Int32
nValue = rProp.Value.get<sal_Int32>();
4587 attrListTablePos->add(
FSNS( XML_w, XML_leftFromText ), OString::number( nValue ) );
4589 else if (rProp.Name ==
"rightFromText")
4591 sal_Int32
nValue = rProp.Value.get<sal_Int32>();
4592 attrListTablePos->add(
FSNS( XML_w, XML_rightFromText ), OString::number( nValue ) );
4594 else if (rProp.Name ==
"topFromText")
4596 sal_Int32
nValue = rProp.Value.get<sal_Int32>();
4597 attrListTablePos->add(
FSNS( XML_w, XML_topFromText ), OString::number( nValue ) );
4599 else if (rProp.Name ==
"tblpX")
4601 sal_Int32
nValue = rProp.Value.get<sal_Int32>();
4602 attrListTablePos->add(
FSNS( XML_w, XML_tblpX ), OString::number( nValue ) );
4604 else if (rProp.Name ==
"tblpY")
4606 sal_Int32
nValue = rProp.Value.get<sal_Int32>();
4607 attrListTablePos->add(
FSNS( XML_w, XML_tblpY ), OString::number( nValue ) );
4612 m_pSerializer->singleElementNS( XML_w, XML_tblpPr, attrListTablePos);
4613 attrListTablePos =
nullptr;
4616 SAL_WARN(
"sw.ww8",
"DocxAttributeOutput::TableDefinition: unhandled property: " << rGrabBagElement.first);
4621 sal_Int32 nIndent = 0;
4624 case text::HoriOrientation::CENTER:
4627 case text::HoriOrientation::RIGHT:
4635 case text::HoriOrientation::LEFT_AND_WIDTH:
4651 sal_Int32 nMode = lcl_getWordCompatibilityMode(m_rExport);
4653 const SwFrameFormat* pFrameFormat = pTableTextNodeInfoInner->getTableBox()->GetFrameFormat();
4654 if ((0 < nMode && nMode <= 14) && m_tableReference->m_nTableDepth == 0)
4665 m_pSerializer->singleElementNS(XML_w, XML_jc,
FSNS(XML_w, XML_val), pJcVal);
4673 m_pSerializer->singleElementNS( XML_w, XML_shd,
4674 FSNS( XML_w, XML_fill ), sColor,
4675 FSNS( XML_w, XML_val ),
"clear" );
4679 TableDefaultBorders( pTableTextNodeInfoInner );
4682 TableDefaultCellMargins( pTableTextNodeInfoInner );
4684 TableBidi( pTableTextNodeInfoInner );
4687 m_pSerializer->singleElementNS( XML_w, XML_tblInd,
4688 FSNS( XML_w, XML_w ), OString::number(nIndent),
4694 m_pSerializer->endElementNS( XML_w, XML_tblPr );
4697 m_pSerializer->startElementNS(XML_w, XML_tblGrid);
4699 ww8::WidthsPtr pColumnWidths = GetColumnWidths( pTableTextNodeInfoInner );
4700 for (
auto aColumnWidth : *pColumnWidths )
4702 sal_Int32 nWidth = sal_Int32( aColumnWidth ) - nPrv;
4703 m_pSerializer->singleElementNS( XML_w, XML_gridCol,
4704 FSNS( XML_w, XML_w ), OString::number(nWidth) );
4705 nPrv = sal_Int32( aColumnWidth );
4708 m_pSerializer->endElementNS( XML_w, XML_tblGrid );
4719 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
4729 const SwTable *pTable = pTableTextNodeInfoInner->getTable();
4730 const SwTableBox *pTableBox = pTableTextNodeInfoInner->getTableBox( );
4739 if ( pRowColorProp && aColor ==
COL_AUTO)
4740 aColor = pRowColorProp->
GetColor();
4744 if ( pTableColorProp && aColor ==
COL_AUTO )
4745 aColor = pTableColorProp->
GetColor();
4749 std::map<OUString, css::uno::Any> aGrabBag =
4752 OString sOriginalColor;
4753 std::map<OUString, css::uno::Any>::iterator aGrabBagElement = aGrabBag.find(
"originalColor");
4754 if( aGrabBagElement != aGrabBag.end() )
4755 sOriginalColor =
OUStringToOString( aGrabBagElement->second.get<OUString>(), RTL_TEXTENCODING_UTF8 );
4757 if ( sOriginalColor != sColor )
4760 if ( sColor !=
"auto" )
4762 m_pSerializer->singleElementNS( XML_w, XML_shd,
4763 FSNS( XML_w, XML_fill ), sColor,
4764 FSNS( XML_w, XML_val ),
"clear" );
4771 for(
const auto & rGrabBagElement : aGrabBag )
4773 if (!rGrabBagElement.second.has<OUString>())
4776 OString sValue =
OUStringToOString( rGrabBagElement.second.get<OUString>(), RTL_TEXTENCODING_UTF8 );
4777 if( rGrabBagElement.first ==
"themeFill")
4779 else if( rGrabBagElement.first ==
"themeFillTint")
4781 else if( rGrabBagElement.first ==
"themeFillShade")
4783 else if( rGrabBagElement.first ==
"fill" )
4785 else if( rGrabBagElement.first ==
"themeColor")
4787 else if( rGrabBagElement.first ==
"themeTint")
4789 else if( rGrabBagElement.first ==
"themeShade")
4791 else if( rGrabBagElement.first ==
"color")
4793 else if( rGrabBagElement.first ==
"val")
4796 m_pSerializer->singleElementNS( XML_w, XML_shd, pAttrList.get() );
4802 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
4813 const SwRedlineTable& aRedlineTable = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable();
4816 bool bIsInExtra =
false;
4820 const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetExtraRedlineTable();
4821 for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTable.
GetSize(); ++nCurRedlinePos )
4825 if (pTableRowRedline && &pTableRowRedline->
GetTableLine() == pTabLine)
4841 OString
aId( OString::number( m_nRedlineId++ ) );
4842 const OUString &rAuthor(
SW_MOD()->GetRedlineAuthor( aRedlineData.
GetAuthor() ) );
4844 ?
"Author" + OUString::number( GetExport().GetInfoID(rAuthor) )
4845 : rAuthor, RTL_TEXTENCODING_UTF8 ) );
4848 bool bNoDate = bRemovePersonalInfo ||
4852 m_pSerializer->singleElementNS( XML_w,
4853 RedlineType::Delete == pRedline->
GetType() ? XML_del : XML_ins,
4854 FSNS( XML_w, XML_id ), aId,
4855 FSNS( XML_w, XML_author ), aAuthor );
4857 m_pSerializer->singleElementNS( XML_w,
4858 RedlineType::Delete == pRedline->
GetType() ? XML_del : XML_ins,
4859 FSNS( XML_w, XML_id ), aId,
4860 FSNS( XML_w, XML_author ), aAuthor,
4868 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
4874 const SwExtraRedlineTable& aExtraRedlineTable = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetExtraRedlineTable();
4875 for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTable.
GetSize(); ++nCurRedlinePos )
4879 if (pTableCellRedline && &pTableCellRedline->
GetTableBox() == pTabBox)
4884 switch (nRedlineType)
4886 case RedlineType::TableCellInsert:
4887 case RedlineType::TableCellDelete:
4889 OString
aId( OString::number( m_nRedlineId++ ) );
4890 const OUString &rAuthor(
SW_MOD()->GetRedlineAuthor( aRedlineData.
GetAuthor() ) );
4892 ?
"Author" + OUString::number( GetExport().GetInfoID(rAuthor) )
4893 : rAuthor, RTL_TEXTENCODING_UTF8 ) );
4895 sal_Int32 nElement = nRedlineType == RedlineType::TableCellInsert
4899 bool bNoDate = bRemovePersonalInfo || ( aDateTime.
GetYear() == 1970 &&
4902 m_pSerializer->singleElementNS( XML_w, nElement,
4903 FSNS( XML_w, XML_id ), aId,
4904 FSNS( XML_w, XML_author ), aAuthor );
4906 m_pSerializer->singleElementNS( XML_w, nElement,
4907 FSNS( XML_w, XML_id ), aId,
4908 FSNS( XML_w, XML_author ), aAuthor,
4920 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
4929 const char *pRule =
nullptr;
4939 m_pSerializer->singleElementNS( XML_w, XML_trHeight,
4940 FSNS( XML_w, XML_val ), OString::number(nHeight),
4941 FSNS( XML_w, XML_hRule ), pRule );
4946 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
4954 m_pSerializer->singleElementNS(XML_w, XML_cantSplit,
FSNS(XML_w, XML_val),
"true");
4959 const SwTable * pTable = pTableTextNodeInfoInner->getTable();
4962 if ( m_rExport.TrueFrameDirection( *pFrameFormat ) == SvxFrameDirection::Horizontal_RL_TB )
4964 m_pSerializer->singleElementNS(XML_w, XML_bidiVisual,
FSNS(XML_w, XML_val),
"true");
4970 const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
4973 if ( SvxFrameDirection::Vertical_RL_TB == m_rExport.TrueFrameDirection( *pFrameFormat ) )
4974 m_pSerializer->singleElementNS(XML_w, XML_textDirection,
FSNS(XML_w, XML_val),
"tbRl");
4975 else if ( SvxFrameDirection::Vertical_LR_BT == m_rExport.TrueFrameDirection( *pFrameFormat ) )
4977 m_pSerializer->singleElementNS(XML_w, XML_textDirection,
FSNS(XML_w, XML_val),
"btLr");
4981 SwWriteTableRow *pRow = rRows[ pTableTextNodeInfoInner->getRow( ) ].get();
4982 sal_uInt32 nCell = pTableTextNodeInfoInner->getCell();
4984 if (nCell >= rTableCells.size() )
4990 case text::VertOrientation::TOP:
4992 case text::VertOrientation::CENTER:
4993 m_pSerializer->singleElementNS(XML_w, XML_vAlign,
FSNS(XML_w, XML_val),
"center");
4995 case text::VertOrientation::BOTTOM:
4996 m_pSerializer->singleElementNS(XML_w, XML_vAlign,
FSNS(XML_w, XML_val),
"bottom");
5007 FinishTableRowCell( pNodeInfoInner,
true );
5012 SAL_INFO(
"sw.ww8",
"TODO: DocxAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )" );
5017 SAL_INFO(
"sw.ww8",
"TODO: DocxAttributeOutput::TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )" );
5022 SAL_INFO(
"sw.ww8",
"TODO: DocxAttributeOutput::TableRowEnd( sal_uInt32 nDepth = 1 )" );
5027 m_pSerializer->startElementNS( XML_w, XML_styles,
5028 FSNS( XML_xmlns, XML_w ), GetExport().GetFilter().getNamespaceURL(OOX_NS(doc)),
5029 FSNS( XML_xmlns, XML_w14 ), GetExport().GetFilter().getNamespaceURL(OOX_NS(w14)),
5030 FSNS( XML_xmlns, XML_mc ), GetExport().GetFilter().getNamespaceURL(OOX_NS(mce)),
5031 FSNS( XML_mc, XML_Ignorable ),
"w14" );
5042 if (sName == pMap->
pToken)
5053 {
"defQFormat", XML_defQFormat},
5054 {
"defUnhideWhenUsed", XML_defUnhideWhenUsed},
5055 {
"defSemiHidden", XML_defSemiHidden},
5056 {
"count", XML_count},
5057 {
"defUIPriority", XML_defUIPriority},
5058 {
"defLockedState", XML_defLockedState},
5064 {
"locked", XML_locked},
5065 {
"uiPriority", XML_uiPriority},
5066 {
"semiHidden", XML_semiHidden},
5067 {
"unhideWhenUsed", XML_unhideWhenUsed},
5068 {
"qFormat", XML_qFormat},
5077 uno::Reference<beans::XPropertySet> xPropertySet(m_rExport.m_rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW);
5078 uno::Sequence<beans::PropertyValue> aInteropGrabBag;
5079 xPropertySet->getPropertyValue(
"InteropGrabBag") >>= aInteropGrabBag;
5080 uno::Sequence<beans::PropertyValue> aLatentStyles;
5081 auto pProp = std::find_if(std::cbegin(aInteropGrabBag), std::cend(aInteropGrabBag),
5082 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"latentStyles"; });
5083 if (pProp != std::cend(aInteropGrabBag))
5084 pProp->Value >>= aLatentStyles;
5085 if (!aLatentStyles.hasElements())
5090 uno::Sequence<beans::PropertyValue> aLsdExceptions;
5091 for (
const auto& rLatentStyle : std::as_const(aLatentStyles))
5095 else if (rLatentStyle.Name ==
"lsdExceptions")
5096 rLatentStyle.Value >>= aLsdExceptions;
5099 m_pSerializer->startElementNS(XML_w, XML_latentStyles, pAttributeList);
5100 pAttributeList =
nullptr;
5103 for (
const auto& rLsdException : std::as_const(aLsdExceptions))
5105 pAttributeList = FastSerializerHelper::createAttrList();
5107 uno::Sequence<beans::PropertyValue> aAttributes;
5108 rLsdException.Value >>= aAttributes;
5109 for (
const auto& rAttribute : std::as_const(aAttributes))
5113 m_pSerializer->singleElementNS(XML_w, XML_lsdException, pAttributeList);
5114 pAttributeList =
nullptr;
5117 m_pSerializer->endElementNS(XML_w, XML_latentStyles);
5122 bool bMustWrite =
true;
5123 switch (rHt.
Which())
5138 bMustWrite =
static_cast< const SvxEscapementItem&
>(rHt).GetEscapement() != SvxEscapement::Off;
5216 bMustWrite =
static_cast< const SvxEmphasisMarkItem&
>(rHt).GetEmphasisMark() != FontEmphasisMark::NONE;
5249 bMustWrite =
static_cast< const SvxLineSpacingItem&
>(rHt).GetInterLineSpaceRule() != SvxInterLineSpaceRule::Off;
5252 bMustWrite =
static_cast< const SvxAdjustItem&
>(rHt).GetAdjust() != SvxAdjust::Left;
5289 SAL_INFO(
"sw.ww8",
"Unhandled SfxPoolItem with id " << rHt.
Which() );
5300 m_pSerializer->startElementNS(XML_w, XML_docDefaults);
5303 m_pSerializer->startElementNS(XML_w, XML_rPrDefault);
5305 StartStyleProperties(
false, 0);
5308 OutputDefaultItem(m_rExport.m_rDoc.GetDefault(
i));
5310 EndStyleProperties(
false);
5312 m_pSerializer->endElementNS(XML_w, XML_rPrDefault);
5315 m_pSerializer->startElementNS(XML_w, XML_pPrDefault);
5317 StartStyleProperties(
true, 0);
5320 OutputDefaultItem(m_rExport.m_rDoc.GetDefault(
i));
5322 EndStyleProperties(
true);
5324 m_pSerializer->endElementNS(XML_w, XML_pPrDefault);
5326 m_pSerializer->endElementNS(XML_w, XML_docDefaults);
5336 m_pTableStyleExport->TableStyles(nCountStylesToWrite);
5337 m_pSerializer->endElementNS( XML_w, XML_styles );
5343 SAL_INFO(
"sw.ww8",
"TODO DocxAttributeOutput::DefaultStyle()");
5350 const css::uno::Reference<css::beans::XPropertySet>& xShapePropSet,
5353 uno::Reference<graphic::XGraphic> xGraphic;
5354 xShapePropSet->getPropertyValue(
"Graphic") >>= xGraphic;
5355 const Graphic aGraphic(xGraphic);
5359 const MapMode aMap100mm( MapUnit::Map100thMM );
5361 if (rMapMode.
GetMapUnit() == MapUnit::MapPixel)
5366 css::text::GraphicCrop aGraphicCropStruct;
5367 xShapePropSet->getPropertyValue(
"GraphicCrop") >>= aGraphicCropStruct;
5368 sal_Int32 nCropL = aGraphicCropStruct.Left;
5369 sal_Int32 nCropR = aGraphicCropStruct.Right;
5370 sal_Int32 nCropT = aGraphicCropStruct.Top;
5371 sal_Int32 nCropB = aGraphicCropStruct.Bottom;
5377 nCropL -= pBoxItem->
GetDistance( SvxBoxItemLine::LEFT );
5378 nCropR -= pBoxItem->
GetDistance( SvxBoxItemLine::RIGHT );
5379 nCropT -= pBoxItem->
GetDistance( SvxBoxItemLine::TOP );
5380 nCropB -= pBoxItem->
GetDistance( SvxBoxItemLine::BOTTOM );
5383 if ( !((0 != nCropL) || (0 != nCropT) || (0 != nCropR) || (0 != nCropB)) )
5386 double widthMultiplier = 100000.0/aOriginalSize.Width();
5387 double heightMultiplier = 100000.0/aOriginalSize.Height();
5389 sal_Int32
left =
static_cast<sal_Int32
>(rtl::math::round(nCropL * widthMultiplier));
5390 sal_Int32
right =
static_cast<sal_Int32
>(rtl::math::round(nCropR * widthMultiplier));
5391 sal_Int32
top =
static_cast<sal_Int32
>(rtl::math::round(nCropT * heightMultiplier));
5392 sal_Int32
bottom =
static_cast<sal_Int32
>(rtl::math::round(nCropB * heightMultiplier));
5394 m_pSerializer->singleElementNS( XML_a, XML_srcRect,
5395 XML_l, OString::number(left),
5396 XML_t, OString::number(top),
5397 XML_r, OString::number(right),
5398 XML_b, OString::number(bottom) );
5402 css::uno::Reference<css::drawing::XShape> xShape)
5409 SAL_INFO(
"sw.ww8",
"TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size& rSize, const SwFlyFrameFormat* pOLEFrameFormat, SwOLENode* pOLENode, const SdrObject* pSdrObj ) - some stuff still missing" );
5411 GetSdtEndBefore(pSdrObj);
5414 assert(pGrfNode || (pOLEFrameFormat && pOLENode));
5418 sal_Int32 nImageType;
5425 sal_Int32
const nFragment(aFileName.indexOf(
'#'));
5426 sal_Int32
const nForbiddenU(aFileName.indexOf(
"%5C"));
5427 sal_Int32
const nForbiddenL(aFileName.indexOf(
"%5c"));
5428 if ( (nForbiddenU != -1 && (nFragment == -1 || nForbiddenU < nFragment))
5429 || (nForbiddenL != -1 && (nFragment == -1 || nForbiddenL < nFragment)))