20#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
21#include <com/sun/star/beans/XPropertySet.hpp>
22#include <com/sun/star/document/XDocumentProperties.hpp>
23#include <com/sun/star/xml/sax/SAXException.hpp>
24#include <ooxml/resourceids.hxx>
30#include <com/sun/star/uno/XComponentContext.hpp>
31#include <com/sun/star/graphic/XGraphic.hpp>
32#include <com/sun/star/beans/XPropertyState.hpp>
33#include <com/sun/star/container/XNamed.hpp>
34#include <com/sun/star/document/PrinterIndependentLayout.hpp>
35#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
36#include <com/sun/star/embed/XEmbeddedObject.hpp>
37#include <com/sun/star/i18n/NumberFormatMapper.hpp>
38#include <com/sun/star/i18n/NumberFormatIndex.hpp>
39#include <com/sun/star/lang/XServiceInfo.hpp>
40#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
41#include <com/sun/star/style/LineNumberPosition.hpp>
42#include <com/sun/star/style/LineSpacing.hpp>
43#include <com/sun/star/style/LineSpacingMode.hpp>
44#include <com/sun/star/text/ChapterFormat.hpp>
45#include <com/sun/star/text/FilenameDisplayFormat.hpp>
46#include <com/sun/star/text/SetVariableType.hpp>
47#include <com/sun/star/text/XDocumentIndex.hpp>
48#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
49#include <com/sun/star/text/XFootnote.hpp>
50#include <com/sun/star/text/XEndnotesSupplier.hpp>
51#include <com/sun/star/text/XFootnotesSupplier.hpp>
52#include <com/sun/star/text/XLineNumberingProperties.hpp>
53#include <com/sun/star/style/XStyle.hpp>
54#include <com/sun/star/text/LabelFollow.hpp>
55#include <com/sun/star/text/PageNumberType.hpp>
56#include <com/sun/star/text/HoriOrientation.hpp>
57#include <com/sun/star/text/VertOrientation.hpp>
58#include <com/sun/star/text/ReferenceFieldPart.hpp>
59#include <com/sun/star/text/RelOrientation.hpp>
60#include <com/sun/star/text/ReferenceFieldSource.hpp>
61#include <com/sun/star/text/SizeType.hpp>
62#include <com/sun/star/text/TextContentAnchorType.hpp>
63#include <com/sun/star/text/WrapTextMode.hpp>
64#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
65#include <com/sun/star/text/XDependentTextField.hpp>
66#include <com/sun/star/text/XParagraphCursor.hpp>
67#include <com/sun/star/text/XRedline.hpp>
68#include <com/sun/star/text/XTextFieldsSupplier.hpp>
69#include <com/sun/star/text/XTextFrame.hpp>
70#include <com/sun/star/text/RubyPosition.hpp>
71#include <com/sun/star/text/XTextRangeCompare.hpp>
72#include <com/sun/star/style/DropCapFormat.hpp>
73#include <com/sun/star/util/NumberFormatter.hpp>
74#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
75#include <com/sun/star/util/XNumberFormatter.hpp>
76#include <com/sun/star/document/XViewDataSupplier.hpp>
77#include <com/sun/star/container/XIndexContainer.hpp>
78#include <com/sun/star/text/ControlCharacter.hpp>
79#include <com/sun/star/text/XTextColumns.hpp>
80#include <com/sun/star/awt/CharSet.hpp>
81#include <com/sun/star/lang/XMultiServiceFactory.hpp>
82#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
83#include <com/sun/star/embed/ElementModes.hpp>
84#include <com/sun/star/document/XImporter.hpp>
85#include <com/sun/star/document/XFilter.hpp>
103#include <oox/token/tokens.hxx>
109#include <unordered_map>
113#include <officecfg/Office/Common.hxx>
124#include <com/sun/star/drawing/FillStyle.hpp>
126#include <unicode/errorcode.h>
127#include <unicode/regex.h>
140 if ( !pStyleSheetProperties )
145 if( xStyles->hasByName( rname ) )
148 xStyles->getByName( rname ) >>= xStyle;
160 if ( !rxFieldProps.is() )
163 if ( !pFFDataHandler->getName().isEmpty() )
164 rxFieldProps->setPropertyValue(
"Name",
uno::Any( pFFDataHandler->getName() ) );
168 ::std::copy( rEntries.begin(), rEntries.end(), sItems.getArray());
169 if ( sItems.hasElements() )
170 rxFieldProps->setPropertyValue(
"Items",
uno::Any( sItems ) );
172 sal_Int32 nResult = pFFDataHandler->getDropDownResult().toInt32();
174 rxFieldProps->setPropertyValue(
"SelectedItem",
uno::Any( std::as_const(sItems)[ nResult ] ) );
175 if ( !pFFDataHandler->getHelpText().isEmpty() )
176 rxFieldProps->setPropertyValue(
"Help",
uno::Any( pFFDataHandler->getHelpText() ) );
181 if ( rxFieldProps.is() && pFFDataHandler )
183 rxFieldProps->setPropertyValue
185 uno::Any(pFFDataHandler->getStatusText()));
186 rxFieldProps->setPropertyValue
188 uno::Any(pFFDataHandler->getHelpText()));
189 rxFieldProps->setPropertyValue
191 uno::Any(pFFDataHandler->getTextDefault()));
205 if (pEntry->m_pProperties)
207 std::optional<PropertyMap::Property> aProperty =
208 pEntry->m_pProperties->getProperty(eId);
211 if (pEntry->m_pProperties->props().GetListId())
215 return aProperty->second;
220 if (!pEntry->m_sBaseStyleIdentifier.isEmpty())
221 pNewEntry = rStyleSheet->FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier);
223 SAL_WARN_IF(pEntry == pNewEntry,
"writerfilter.dmapper",
"circular loop in style hierarchy?");
225 if (pEntry == pNewEntry)
236struct FieldConversion
249 if (rFieldStack.size() < 2)
254 return rFieldStack[rFieldStack.size() - 2];
260 if (!pInner->GetFieldId())
265 std::optional<FieldId> oOuterFieldId = pOuter->GetFieldId();
268 OUString
aCommand = pOuter->GetCommand();
286 switch (*oOuterFieldId)
290 switch (*pInner->GetFieldId())
322 m_eDocumentType( eDocumentType ),
323 m_rDMapper( rDMapper ),
324 m_pOOXMLDocument(nullptr),
325 m_xTextDocument(
xModel,
uno::UNO_QUERY ),
326 m_xTextFactory(
xModel,
uno::UNO_QUERY ),
328 m_bForceGenericFields(!
utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::
Filter::Microsoft::
Import::ForceImportWWFieldsAsGenericFields::
get()),
329 m_bIsDecimalComma( false ),
330 m_bSetUserFieldContent( false ),
331 m_bSetCitation( false ),
332 m_bSetDateValue( false ),
333 m_bIsFirstSection( true ),
334 m_bIsColumnBreakDeferred( false ),
335 m_bIsPageBreakDeferred( false ),
336 m_nLineBreaksDeferred( 0 ),
337 m_bIsBreakDeferredByAnchor(false),
338 m_bSdtEndDeferred(false),
339 m_bParaSdtEndDeferred(false),
341 m_bStartTOCHeaderFooter(false),
342 m_bStartedTOC(false),
343 m_bStartIndex(false),
344 m_bStartBibliography(false),
345 m_nStartGenericField(0),
346 m_bTextInserted(false),
347 m_bTextDeleted(false),
349 m_bFrameDirectionSet(false),
350 m_bInDocDefaultsImport(false),
351 m_bInStyleSheetImport( false ),
352 m_bInNumberingImport(false),
353 m_bInAnyTableImport( false ),
355 m_bDiscardHeaderFooter( false ),
356 m_bInFootOrEndnote(false),
357 m_bInFootnote(false),
358 m_bHasFootnoteStyle(false),
359 m_bCheckFootnoteStyle(false),
363 m_nFirstFootnoteIndex(-1),
364 m_nFirstEndnoteIndex(-1),
365 m_bLineNumberingSet( false ),
366 m_bIsInFootnoteProperties( false ),
367 m_bIsParaMarkerChange( false ),
368 m_bIsParaMarkerMove( false ),
369 m_bRedlineImageInPreviousRun( false ),
370 m_bParaChanged( false ),
371 m_bIsFirstParaInSection( true ),
372 m_bIsFirstParaInSectionAfterRedline( true ),
373 m_bDummyParaAddedForTableInSection( false ),
374 m_bDummyParaAddedForTableInSectionPage( false ),
375 m_bTextFrameInserted(false),
376 m_bIsPreviousParagraphFramed( false ),
377 m_bIsLastParaInSection( false ),
378 m_bIsLastSectionGroup( false ),
379 m_bIsInComments( false ),
380 m_bParaSectpr( false ),
381 m_bUsingEnhancedFields( false ),
383 m_bIsFirstRun(false),
384 m_bIsOutsideAParagraph(true),
385 m_nAnnotationId( -1 ),
387 m_xInsertTextRange(rMediaDesc.getUnpackedValueOrDefault(
"TextInsertModeRange",
uno::
Reference<
text::XTextRange>())),
388 m_xAltChunkStartingRange(rMediaDesc.getUnpackedValueOrDefault(
"AltChunkStartingRange",
uno::
Reference<
text::XTextRange>())),
389 m_bIsInTextBox(false),
390 m_bIsNewDoc(!rMediaDesc.getUnpackedValueOrDefault(
"InsertMode", false)),
391 m_bIsAltChunk(rMediaDesc.getUnpackedValueOrDefault(
"AltChunkMode", false)),
392 m_bIsReadGlossaries(rMediaDesc.getUnpackedValueOrDefault(
"ReadGlossaries", false)),
394 m_nTableCellDepth(0),
395 m_nLastTableCellParagraphDepth(0),
398 m_bCheckFirstFootnoteTab(false),
399 m_bIgnoreNextTab(false),
400 m_bIsSplitPara(false),
401 m_bIsActualParagraphFramed( false ),
402 m_bParaHadField(false),
403 m_bSaveParaHadField(false),
404 m_bParaAutoBefore(false),
405 m_bFirstParagraphInCell(true),
406 m_bSaveFirstParagraphInCell(false),
407 m_bParaWithInlineObject(false),
410 m_aBaseUrl = rMediaDesc.getUnpackedValueOrDefault(
413 m_aBaseUrl = rMediaDesc.getUnpackedValueOrDefault(
421 throw uno::Exception(
"failed to find body text of the insert position",
nullptr);
474 xSupplier->getStyleFamilies()->getByName(
"PageStyles") >>=
m_xPageStyles1;
481 static const char DEFAULT_STYLE[] =
"Converted";
485 sal_Int32 nMaxIndex = 0;
489 for (
const auto& rStyleName : aPageStyleNames )
491 if ( rStyleName.startsWith( DEFAULT_STYLE ) )
503 return sPageStyleName;
519 static const char cListLabel[] =
"ListLabel ";
524 sal_Int32 nMaxIndex = 0;
525 for (
const auto& rStyleName : aCharacterStyleNames )
528 if ( rStyleName.startsWith( cListLabel, &
sSuffix ) )
530 sal_Int32 nSuffix =
sSuffix.toInt32();
531 if( nSuffix > 0 && nSuffix > nMaxIndex )
540 return sPageStyleName;
573 xSettings->setPropertyValue( rPropName, rValue );
575 catch(
const uno::Exception& )
588 if (!xParagraphProps.is())
593 uno::Any aPageDescName = xParagraphProps->getPropertyValue(
"PageDescName");
594 OUString sPageDescName;
595 aPageDescName >>= sPageDescName;
596 if (sPageDescName.isEmpty())
602 uno::Reference<text::XParagraphCursor> xParaCursor(xCursor, uno::UNO_QUERY);
603 if (!xParaCursor.is())
609 if (!xParaCursor->gotoNextParagraph(
true))
614 uno::Reference<container::XEnumerationAccess> xEnumerationAccess(xParaCursor, uno::UNO_QUERY);
615 if (!xEnumerationAccess.is())
620 uno::Reference<container::XEnumeration> xEnumeration = xEnumerationAccess->createEnumeration();
621 if (!xEnumeration.is())
626 xEnumeration->nextElement();
627 if (!xEnumeration->hasMoreElements())
634 uno::Reference<beans::XPropertySet> xNextParagraph(xEnumeration->nextElement(), uno::UNO_QUERY);
635 if (!xNextParagraph.is())
641 OUString sNextPageDescName;
642 xNextParagraph->getPropertyValue(
"PageDescName") >>= sNextPageDescName;
643 if (!sNextPageDescName.isEmpty())
649 xNextParagraph->setPropertyValue(
"PageDescName", aPageDescName);
658 if (!pSectionContext)
664 if (!xTextAppend.is())
673 pListTable->DisposeNumPicBullets();
681 CopyPageDescNameToNextParagraph(xParagraph, xCursor);
682 xParagraph->dispose();
694 if (xTextAppend.is())
703 bool bAlreadyExpanded)
710 if (!bAlreadyExpanded)
711 xCursor->goLeft(1,
true);
713 [xCursor, bAlreadyExpanded]()
715 if (!bAlreadyExpanded)
716 xCursor->goRight(1,
true);
720 if (!xParaEnumAccess.is())
725 if (!xParaEnum->hasMoreElements())
730 uno::UNO_QUERY_THROW);
732 while (xRunEnum->hasMoreElements())
735 uno::Any aType(xProps->getPropertyValue(
"TextPortionType"));
738 if (
sType ==
"Bookmark")
741 uno::UNO_QUERY_THROW);
742 sName = xBookmark->getName();
758 if (!xTextAppend.is())
773 xCursor = xTextAppend->createTextCursor();
774 xCursor->gotoEnd(
false);
791 xParagraph.set(xEA->createEnumeration()->nextElement(), uno::UNO_QUERY);
795 xCursor->goLeft(1,
true);
804 static constexpr OUStringLiteral RecordChanges(
u"RecordChanges");
807 [xDocProps, aPreviousValue = xDocProps->getPropertyValue(RecordChanges)]()
808 { xDocProps->setPropertyValue(RecordChanges, aPreviousValue); });
811 xDocProps->setPropertyValue(RecordChanges,
uno::Any(
false));
817 uno::UNO_QUERY_THROW);
818 auto xDrawPage = xDrawPageSupplier->getDrawPage();
819 if (xDrawPage && xDrawPage->hasElements())
823 uno::UNO_QUERY_THROW);
824 auto xEnumeration = xEA->createEnumeration();
826 uno::UNO_QUERY_THROW);
830 uno::UNO_QUERY_THROW);
831 const sal_Int32
count = xDrawPage->getCount();
832 for (sal_Int32
i = 0;
i <
count; ++
i)
837 uno::UNO_QUERY_THROW);
840 if (xRegionCompare->compareRegionStarts(xAnchor, xParaRange) <= 0
841 && xRegionCompare->compareRegionEnds(xAnchor, xParaRange) >= 0)
843 xShape->attach(xPrevParagraph);
846 catch (
const uno::Exception&)
854 xParagraph->dispose();
860 OUString sLastBookmarkName;
866 xCursor->setString(OUString());
870 if (sLastBookmarkName.getLength())
873 if (sBookmarkNameAfterRemoval.isEmpty())
878 uno::UNO_QUERY_THROW);
881 uno::UNO_QUERY_THROW);
882 xBkmNamed->setName(sLastBookmarkName);
883 xTextAppend->insertTextContent(xCursor, xBookmark, !xCursor->isCollapsed());
888 catch(
const uno::Exception& )
977 = xTextAppend->getText()->createTextCursorByRange(xTextAppend->getEnd());
979 bool bStart = !xCursor->goLeft(1,
false);
980 m_xSdtStarts.push({bStart, OUString(), xCursor->getStart()});
1003 SAL_WARN(
"writerfilter.dmapper",
"DomainMapper_Impl::PopSdt: no start position");
1013 if (xParagraphCursor.is()
1014 &&
m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtRun_sdtContent)
1016 xCursor->gotoRange(xEnd,
false);
1017 xParagraphCursor->gotoStartOfParagraph(
false);
1023 xCursor->goRight(1,
false);
1025 xCursor->gotoRange(xEnd,
true);
1027 std::optional<OUString> oData =
m_pSdtHelper->getValueFromDataBinding();
1028 if (oData.has_value())
1031 xCursor->setString(*oData);
1035 if (xPropertyState.is())
1037 xPropertyState->setPropertyToDefault(
"CharStyleName");
1042 m_xTextFactory->createInstance(
"com.sun.star.text.ContentControl"), uno::UNO_QUERY);
1046 xContentControlProps->setPropertyValue(
"ShowingPlaceHolder",
1052 xContentControlProps->setPropertyValue(
"PlaceholderDocPart",
1056 if (!
m_pSdtHelper->GetDataBindingPrefixMapping().isEmpty())
1058 xContentControlProps->setPropertyValue(
"DataBindingPrefixMappings",
1063 xContentControlProps->setPropertyValue(
"DataBindingXpath",
1066 if (!
m_pSdtHelper->GetDataBindingStoreItemID().isEmpty())
1068 xContentControlProps->setPropertyValue(
"DataBindingStoreItemID",
1074 xContentControlProps->setPropertyValue(
"Color",
1080 xContentControlProps->setPropertyValue(
"Appearance",
1086 xContentControlProps->setPropertyValue(
"Alias",
1092 xContentControlProps->setPropertyValue(
"Tag",
1113 xContentControlProps->setPropertyValue(
"Checkbox",
uno::Any(
true));
1117 xContentControlProps->setPropertyValue(
"CheckedState",
1120 xContentControlProps->setPropertyValue(
"UncheckedState",
1127 std::vector<OUString>& rDisplayTexts =
m_pSdtHelper->getDropDownDisplayTexts();
1128 std::vector<OUString>& rValues =
m_pSdtHelper->getDropDownItems();
1129 if (rDisplayTexts.size() == rValues.size())
1132 beans::PropertyValues* pItems = aItems.getArray();
1133 for (
size_t i = 0;
i < rValues.size(); ++
i)
1141 xContentControlProps->setPropertyValue(
"ListItems",
uno::Any(aItems));
1144 xContentControlProps->setPropertyValue(
"DropDown",
uno::Any(
true));
1148 xContentControlProps->setPropertyValue(
"ComboBox",
uno::Any(
true));
1155 xContentControlProps->setPropertyValue(
"Picture",
uno::Any(
true));
1158 bool bDateFromDataBinding =
false;
1161 xContentControlProps->setPropertyValue(
"Date",
uno::Any(
true));
1162 OUString aDateFormat =
m_pSdtHelper->getDateFormat().makeStringAndClear();
1163 xContentControlProps->setPropertyValue(
"DateFormat",
1164 uno::Any(aDateFormat.replaceAll(
"'",
"\"")));
1165 xContentControlProps->setPropertyValue(
"DateLanguage",
1167 OUString aCurrentDate =
m_pSdtHelper->getDate().makeStringAndClear();
1168 if (oData.has_value())
1170 aCurrentDate = *oData;
1171 bDateFromDataBinding =
true;
1173 xContentControlProps->setPropertyValue(
"CurrentDate",
1179 xContentControlProps->setPropertyValue(
"PlainText",
uno::Any(
true));
1182 xText->insertTextContent(xCursor, xContentControl,
true);
1184 if (bDateFromDataBinding)
1186 OUString aDateString;
1187 xContentControlProps->getPropertyValue(
"DateString") >>= aDateString;
1188 xCursor->setString(aDateString);
1209 if (xTextAppend.is() && pSectionContext_)
1210 pSectionContext_->
SetStart( xTextAppend->getEnd() );
1334 for(
const auto& rTabStop : rInitTabStops)
1342 sal_Int32 nConverted = rTabStop.Position;
1344 [&nConverted](
const DeletableTabStop& rCurrentTabStop) { return rCurrentTabStop.Position == nConverted; });
1359 std::vector<style::TabStop> aRet;
1362 if (!rStop.bDeleted)
1363 aRet.push_back(rStop);
1399 if ( pEntry && !pEntry->m_sConvertedStyleName.isEmpty() )
1403 return pEntry->m_sConvertedStyleName;
1415 if(pEntry->m_pProperties)
1417 std::optional<PropertyMap::Property> aProperty =
1418 pEntry->m_pProperties->getProperty(eId);
1422 *pIsDocDefault = pEntry->m_pProperties->isDocDefault(eId);
1424 return aProperty->second;
1429 if ( !pEntry->m_sBaseStyleIdentifier.isEmpty() )
1430 pNewEntry =
GetStyleSheetTable()->FindStyleSheetByISTD(pEntry->m_sBaseStyleIdentifier);
1432 SAL_WARN_IF( pEntry == pNewEntry,
"writerfilter.dmapper",
"circular loop in style hierarchy?");
1434 if (pEntry == pNewEntry)
1440 if ( bDocDefaults && bPara )
1443 if ( pDefaultParaProps )
1445 std::optional<PropertyMap::Property> aProperty = pDefaultParaProps->getProperty(eId);
1449 *pIsDocDefault =
true;
1451 return aProperty->second;
1458 if ( pDefaultCharProps )
1460 std::optional<PropertyMap::Property> aProperty = pDefaultCharProps->getProperty(eId);
1464 *pIsDocDefault =
true;
1466 return aProperty->second;
1472 *pIsDocDefault =
false;
1504 std::optional<PropertyMap::Property> aProperty = rContext->getProperty(eId);
1506 return aProperty->second;
1511 if (pParaContext && rContext != pParaContext)
1513 std::optional<PropertyMap::Property> aProperty = pParaContext->getProperty(eId);
1515 return aProperty->second;
1533 return pList ? pList->GetStyleName() : OUString();
1547 switch (deferredBreakType)
1570 switch (deferredBreakType)
1585 switch (deferredBreakType)
1648 if (!xStartTextRange.is())
1651 xRangeCursor->gotoRange( xEndTextRange,
true );
1654 if(!xTextRangeProperties.is())
1671 sal_Int32 nWidth = 0;
1672 sal_Int32 nIndexOfWidthProperty = -1;
1673 sal_Int16
nType = text::SizeType::FIX;
1674 for (
size_t i = 0;
nType == text::SizeType::FIX &&
i < rFrameProperties.size(); ++
i)
1676 if (rFrameProperties[
i].
Name ==
"WidthType")
1677 rFrameProperties[
i].Value >>=
nType;
1678 else if (rFrameProperties[
i].
Name ==
"Width")
1679 nIndexOfWidthProperty =
i;
1681 if (nIndexOfWidthProperty > -1 &&
nType == text::SizeType::FIX)
1682 rFrameProperties[nIndexOfWidthProperty].Value >>= nWidth;
1684 for(
size_t nProperty = 0; nProperty <
SAL_N_ELEMENTS( aBorderProperties ); ++nProperty)
1686 const OUString & sPropertyName =
getPropertyName(aBorderProperties[nProperty]);
1687 beans::PropertyValue aValue;
1688 aValue.Name = sPropertyName;
1689 aValue.Value = xTextRangeProperties->getPropertyValue(sPropertyName);
1691 xTextRangeProperties->setPropertyValue( sPropertyName,
uno::Any(table::BorderLine2()));
1694 sal_Int32 nDistance = 0;
1695 aValue.Value >>= nDistance;
1699 if (nProperty > 5 || bIsRTFImport)
1700 aValue.Value <<= sal_Int32(0);
1704 if (!bIsRTFImport && nProperty < 6 && nWidth && nDistance)
1706 nWidth += nDistance;
1707 rFrameProperties[nIndexOfWidthProperty].Value <<= nWidth;
1710 if (aValue.Value.hasValue())
1711 rFrameProperties.push_back(aValue);
1714 catch(
const uno::Exception& )
1726 xTextAppend->createTextCursorByRange( rAppendContext.
xInsertPosition.is() ? rAppendContext.
xInsertPosition : xTextAppend->getEnd()), uno::UNO_QUERY_THROW );
1727 pToBeSavedProperties->SetEndingRange(xParaCursor->getStart());
1728 xParaCursor->gotoStartOfParagraph(
false );
1730 pToBeSavedProperties->SetStartingRange(xParaCursor->getStart());
1739std::vector<css::beans::PropertyValue>
1742 std::vector<beans::PropertyValue> aFrameProperties;
1747 std::vector<const ParagraphProperties*> vProps;
1748 vProps.emplace_back(&rProps);
1752 while (nSafetyLimit-- && pStyle && pStyle->m_pProperties)
1754 vProps.emplace_back(&pStyle->m_pProperties->props());
1755 assert(pStyle->m_sBaseStyleIdentifier != pStyle->m_sStyleName);
1756 if (pStyle->m_sBaseStyleIdentifier.isEmpty())
1760 SAL_WARN_IF(!nSafetyLimit,
"writerfilter.dmapper",
"Inheritance loop likely: early exit");
1763 sal_Int32 nWidth = -1;
1764 for (
const auto pProp : vProps)
1766 if (pProp->Getw() < 0)
1768 nWidth = pProp->Getw();
1771 bool bAutoWidth = nWidth < 1;
1774 aFrameProperties.push_back(
1776 aFrameProperties.push_back(
1778 bAutoWidth ? text::SizeType::MIN : text::SizeType::FIX));
1780 bool bValidH =
false;
1782 for (
const auto pProp : vProps)
1784 if (pProp->Geth() < 0)
1786 nHeight = pProp->Geth();
1790 aFrameProperties.push_back(
1793 sal_Int16 nhRule = -1;
1794 for (
const auto pProp : vProps)
1796 if (pProp->GethRule() < 0)
1798 nhRule = pProp->GethRule();
1803 if (bValidH && nHeight)
1807 nhRule = text::SizeType::MIN;
1811 nhRule = text::SizeType::VARIABLE;
1814 aFrameProperties.push_back(
1817 bool bValidX =
false;
1819 for (
const auto pProp : vProps)
1821 bValidX = pProp->IsxValid();
1827 aFrameProperties.push_back(
1831 for (
const auto pProp : vProps)
1833 if (pProp->GetxAlign() < 0)
1835 nHoriOrient = pProp->GetxAlign();
1838 aFrameProperties.push_back(
1843 for (
const auto pProp : vProps)
1845 if (pProp->GethAnchor() < 0)
1847 nHAnchor = pProp->GethAnchor();
1850 aFrameProperties.push_back(
1853 bool bValidY =
false;
1855 for (
const auto pProp : vProps)
1857 bValidY = pProp->IsyValid();
1863 aFrameProperties.push_back(
1867 for (
const auto pProp : vProps)
1869 if (pProp->GetyAlign() < 0)
1871 nVertOrient = pProp->GetyAlign();
1874 aFrameProperties.push_back(
1881 if (!bValidY && nVertOrient)
1883 nVAnchor = text::RelOrientation::PAGE_PRINT_AREA;
1885 for (
const auto pProp : vProps)
1887 if (pProp->GetvAnchor() < 0)
1889 nVAnchor = pProp->GetvAnchor();
1892 aFrameProperties.push_back(
1895 text::WrapTextMode nWrap = text::WrapTextMode_NONE;
1896 for (
const auto pProp : vProps)
1898 if (pProp->GetWrap() == text::WrapTextMode::WrapTextMode_MAKE_FIXED_SIZE)
1900 nWrap = pProp->GetWrap();
1903 aFrameProperties.push_back(
1906 sal_Int32 nRightDist = 0;
1907 sal_Int32 nLeftDist = 0;
1908 for (
const auto pProp : vProps)
1910 if (pProp->GethSpace() < 0)
1912 nLeftDist = nRightDist = pProp->GethSpace();
1917 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
1920 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
1922 sal_Int32 nBottomDist = 0;
1923 sal_Int32 nTopDist = 0;
1924 for (
const auto pProp : vProps)
1926 if (pProp->GetvSpace() < 0)
1928 nTopDist = nBottomDist = pProp->GetvSpace();
1933 nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
1936 nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
1938 catch (
const uno::Exception&)
1942 return aFrameProperties;
1960 std::vector<beans::PropertyValue> aFrameProperties
1965 aFrameProperties.push_back(
1969 if (bPreventOverlap)
1979 { {
"ParaFrameProperties",
uno::Any(
true) } }));
1990 std::move(aFrameProperties));
1997 if (!pEntryProperties)
2006 if (rEntry->m_sBaseStyleIdentifier.isEmpty())
2009 const StyleSheetEntryPtr pParent = rStyleTable->FindStyleSheetByISTD(rEntry->m_sBaseStyleIdentifier);
2011 if (!pParent || pParent == rEntry)
2014 rNumberingFromBaseStyle =
true;
2016 return lcl_getListId(pParent, rStyleTable, rNumberingFromBaseStyle);
2026 sal_Int16 nListLevel = -1;
2032 aLvl->second >>= nListLevel;
2034 if (nListLevel != -1)
2042 if (!pEntryProperties)
2047 if (nListLevel >= 0)
2051 if (pEntry->m_sBaseStyleIdentifier.isEmpty())
2056 if (!pParent || pParent == pEntry)
2072 bool bDummy =
false;
2081 auto pLevel = pList->GetLevel(nListLevel);
2082 if (!pLevel && pList->GetAbstractDefinition())
2083 pLevel = pList->GetAbstractDefinition()->GetLevel(nListLevel);
2087 if (!pLevel->GetParaStyle())
2090 pLevel->SetParaStyle(pMyStyle);
2092 else if (pLevel->GetParaStyle() != pMyStyle)
2109 if (pFieldContext && !pFieldContext->IsCommandCompleted())
2111 std::vector<OUString> aCommandParts = pFieldContext->GetCommandParts();
2112 if (!aCommandParts.empty() && aCommandParts[0] ==
"IF")
2119 if (pFieldContext && pFieldContext->IsCommandCompleted())
2121 if (pFieldContext->GetFieldId() ==
FIELD_IF)
2125 pFieldContext->GetParagraphsToFinish().push_back(aFinish);
2146 SAL_WARN_IF(!pEntry,
"writerfilter.dmapper",
"no style sheet found");
2148 sal_Int32 nListId = pParaContext ? pParaContext->
props().
GetListId() : -1;
2149 bool isNumberingViaStyle(
false);
2150 bool isNumberingViaRule = nListId > -1;
2151 if ( !bRemove && pStyleSheetProperties && pParaContext )
2153 if (!pEntry || pEntry->m_nStyleTypeCode != StyleType::STYLE_TYPE_PARA) {
2157 SAL_WARN(
"writerfilter.dmapper",
"Paragraph style is incorrect. Ignored");
2161 bool bNumberingFromBaseStyle =
false;
2162 if (!isNumberingViaRule)
2167 sal_Int16 nListLevel =
GetListLevel(pEntry, pParaContext);
2169 if (nListLevel == -1 && nListId > (
IsOOXMLImport() ? 0 : -1))
2172 if (!bNoNumbering && nListLevel >= 0 && nListLevel < 9)
2179 if (bNoNumbering || nListLevel == 9)
2184 else if ( !isNumberingViaRule )
2186 isNumberingViaStyle =
true;
2203 if ( isNumberingViaStyle )
2209 std::optional<PropertyMap::Property> oProperty;
2212 if (!pEntry->m_sBaseStyleIdentifier.isEmpty())
2226 sal_Int32 nParaRightMargin;
2227 if ( pParentProperties && (oProperty = pParentProperties->
getProperty(
PROP_PARA_RIGHT_MARGIN)) && (nParaRightMargin = oProperty->second.get<sal_Int32>()) != 0 )
2230 const sal_Int32 nFirstLineIndent =
getNumberingProperty(nListId, nListLevel,
"FirstLineIndent");
2232 if (nFirstLineIndent != 0)
2234 if (nParaLeftMargin != 0)
2246 else if (isNumberingViaRule)
2253 const sal_Int32 nFirstLineIndent =
getNumberingProperty(nListId, nListLevel,
"FirstLineIndent");
2255 if (nFirstLineIndent != 0)
2257 if (nParaLeftMargin != 0)
2262 if (nListId == 0 && !pList)
2284 const bool bAllowAdjustments = !
GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing();
2285 sal_Int32 nBeforeAutospacing = -1;
2289 if ( bIsAutoSet || bNoTopmargin )
2296 sal_Int32 nStyleAuto = -1;
2299 nBeforeAutospacing = 0;
2302 if ( nBeforeAutospacing > -1 && pParaContext )
2304 if (bAllowAdjustments)
2311 if (nBeforeAutospacing && bIsAutoSet)
2313 nBeforeAutospacing = 0;
2319 sal_Int32 nAfterAutospacing = -1;
2322 bool bAppliedBottomAutospacing =
false;
2323 if (bIsAutoSet || bNoBottomMargin)
2328 sal_Int32 nStyleAuto = -1;
2331 nAfterAutospacing = 0;
2334 if ( nAfterAutospacing > -1 && pParaContext )
2337 bAppliedBottomAutospacing = bAllowAdjustments;
2364 std::optional<PropertyMap::Property> aParaStyle
2369 aParaStyle->second >>=
sName;
2375 sal::static_int_cast<Id>(pParaContext->
props().
GetDropCap()) != NS_ooxml::LN_Value_doc_ST_DropCap_none;
2377 style::DropCapFormat aDrop;
2379 bool bKeepLastParagraphProperties =
false;
2383 xTextAppend->createTextCursorByRange(xTextAppend->getEnd()), uno::UNO_QUERY_THROW);
2385 xParaCursor->gotoStartOfParagraph(
true );
2391 sal_Int32
nCount = xParaCursor->getString().getLength();
2396 if( sal::static_int_cast<Id>(rAppendContext.
pLastParagraphProperties->GetDropCap()) != NS_ooxml::LN_Value_doc_ST_DropCap_none)
2401 aDrop.Lines = nLines > 0 && nLines < SAL_MAX_INT8 ? static_cast<sal_Int8>(nLines) : 2;
2404 aDrop.Distance = nHSpace > 0 && nHSpace < SAL_MAX_INT16 ? static_cast<sal_Int16>(nHSpace) : 0;
2412 std::vector<beans::PropertyValue> aCurrFrameProperties;
2413 std::vector<beans::PropertyValue> aPrevFrameProperties;
2417 aPrevFrameProperties
2421 if (bIsFrameMode && aPrevFrameProperties == aCurrFrameProperties)
2426 : xTextAppend->getEnd());
2427 bKeepLastParagraphProperties =
true;
2441 bool bPreventOverlap = !
IsRTFImport() && bIsFrameMode && !bIsDropCap;
2446 sal_Int32 nCurrVertPos = 0;
2447 sal_Int32 nPrevVertPos = 0;
2448 for (
size_t i = 0; bPreventOverlap &&
i < aCurrFrameProperties.size(); ++
i)
2450 if (aCurrFrameProperties[
i].
Name ==
"VertOrientRelation")
2452 aCurrFrameProperties[
i].Value >>= nVertOrientRelation;
2454 bPreventOverlap =
false;
2456 else if (aCurrFrameProperties[
i].
Name ==
"VertOrient")
2458 aCurrFrameProperties[
i].Value >>= nVertOrient;
2460 bPreventOverlap =
false;
2462 else if (aCurrFrameProperties[
i].
Name ==
"VertOrientPosition")
2464 aCurrFrameProperties[
i].Value >>= nCurrVertPos;
2466 if (nCurrVertPos > 20 || nCurrVertPos < -20)
2467 bPreventOverlap =
false;
2470 for (
size_t i = 0; bPreventOverlap &&
i < aPrevFrameProperties.size(); ++
i)
2472 if (aPrevFrameProperties[
i].
Name ==
"VertOrientRelation")
2474 aPrevFrameProperties[
i].Value >>= nVertOrientRelation;
2476 bPreventOverlap =
false;
2478 else if (aPrevFrameProperties[
i].
Name ==
"VertOrient")
2480 aPrevFrameProperties[
i].Value >>= nVertOrient;
2482 bPreventOverlap =
false;
2484 else if (aPrevFrameProperties[
i].
Name ==
"VertOrientPosition")
2486 aPrevFrameProperties[
i].Value >>= nPrevVertPos;
2487 if (nPrevVertPos != nCurrVertPos)
2488 bPreventOverlap =
false;
2495 if (!bIsDropCap && bIsFrameMode)
2498 lcl_AddRange(pToBeSavedProperties, xTextAppend, rAppendContext);
2510 lcl_AddRange(pToBeSavedProperties, xTextAppend, rAppendContext);
2516 aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues());
2521 std::vector<beans::NamedValue> charProperties;
2526 if (it->Name.startsWith(
"Char"))
2528 charProperties.emplace_back(it->Name, it->Value);
2535 if (!charProperties.empty())
2537 aProperties.push_back(beans::PropertyValue(
"ListAutoFormat",
2543 if( aDrop.Lines > 1 )
2545 beans::PropertyValue aValue;
2547 aValue.Value <<= aDrop;
2554 rAppendContext.
xCursor->gotoNextParagraph(
false);
2566 xCursor = xTextAppend->getText()->createTextCursor();
2568 xCursor->gotoEnd(
false);
2575 auto itNumberingRules = std::find_if(
aProperties.begin(),
aProperties.end(), [](
const beans::PropertyValue& rValue)
2577 return rValue.Name ==
"NumberingRules";
2580 assert( isNumberingViaRule == (itNumberingRules !=
aProperties.end()) );
2581 isNumberingViaRule = (itNumberingRules !=
aProperties.end());
2585 OUString aCurrentNumberingName;
2586 OUString aPreviousNumberingName;
2587 if (isNumberingViaRule)
2589 assert(itNumberingRules !=
aProperties.end() &&
"by definition itNumberingRules is valid if isNumberingViaRule is true");
2591 if (xCurrentNumberingRules.is())
2592 aCurrentNumberingName = xCurrentNumberingRules->getName();
2596 aPreviousNumberingName = xPreviousNumberingRules->getName();
2598 catch (
const uno::Exception&)
2603 else if (
m_xPreviousParagraph->getPropertySetInfo()->hasPropertyByName(
"NumberingStyleName") &&
2612 if (!aPreviousNumberingName.isEmpty()
2613 && (aCurrentNumberingName == aPreviousNumberingName
2614 || !isNumberingViaRule))
2618 const auto & rPrevProperties = aPrevPropertiesSeq;
2619 bool bParaAutoBefore =
m_bParaAutoBefore || std::any_of(rPrevProperties.begin(), rPrevProperties.end(), [](
const beans::PropertyValue& rValue)
2621 return rValue.Name ==
"ParaTopMarginBeforeAutoSpacing";
2626 auto itParaStyle = std::find_if(
aProperties.begin(),
aProperties.end(), [](
const beans::PropertyValue& rValue)
2628 return rValue.Name ==
"ParaStyleName";
2630 bParaAutoBefore = itParaStyle !=
aProperties.end() &&
2634 if (bParaAutoBefore)
2637 auto itParaTopMargin = std::find_if(
aProperties.begin(),
aProperties.end(), [](
const beans::PropertyValue& rValue)
2639 return rValue.Name ==
"ParaTopMargin";
2642 itParaTopMargin->Value <<=
static_cast<sal_Int32
>(0);
2647 bool bPrevParaAutoAfter = std::any_of(rPrevProperties.begin(), rPrevProperties.end(), [](
const beans::PropertyValue& rValue)
2649 return rValue.Name ==
"ParaBottomMarginAfterAutoSpacing";
2651 if (bPrevParaAutoAfter)
2665 if (!rAnchored.m_xRedlineForInline)
2669 auto xAnchorRange = rAnchored.m_xAnchoredObject->getAnchor();
2671 xAnchorRange->getText()->createTextCursorByRange(xAnchorRange);
2672 xCursorOnImage->goRight(1,
true);
2673 CreateRedline( xCursorOnImage, rAnchored.m_xRedlineForInline );
2681 (isNumberingViaStyle || isNumberingViaRule))
2683 assert(pParaContext);
2687 pList->GetAbstractDefinition();
2694 if (!paraId.isEmpty())
2696 OUString
const listId = pAbsList->MapListId(paraId);
2697 if (listId != paraId)
2704 sal_Int16 nCurrentLevel =
GetListLevel(pEntry, pPropertyMap);
2705 if (nCurrentLevel == -1)
2711 sal_Int16 nOverrideLevel = pListLevel->GetStartOverride();
2742 xCursor->goLeft(1,
true);
2743 xCursor->setString(OUString());
2749 if (xTextRange.is())
2756 xCur->gotoEnd(
false );
2763 xCur->goLeft(1,
false);
2764 while ( xCur->goLeft(1,
true) )
2766 OUString sChar = xCur->getString();
2767 if ( sChar ==
" " || sChar ==
"\t" || sChar == OUStringChar(
u'\x00A0') )
2768 xCur->setString(
"");
2776 xCur->gotoEnd(
false);
2779 xCur->goLeft( 1 ,
true );
2786 css::uno::Reference<css::beans::XPropertySet> xParaProps(xTextRange, uno::UNO_QUERY);
2795 xCur->gotoEnd(
false);
2796 xCur->goLeft(1,
false);
2799 xParaCursor->gotoStartOfParagraph(
false);
2802 TableParagraph aPending{xParaCursor, xCur, pParaContext, xParaProps};
2807 std::optional<PropertyMap::Property> pHidden;
2810 bool bIsHidden = {};
2811 pHidden->second >>= bIsHidden;
2817 pHidden->second >>= bIsHidden;
2821 xCur3->goRight(1,
true);
2839 if ( bTopSet != bBottomSet || bBottomSet != bContextSet )
2846 xParaProps->setPropertyValue(
"ParaTopMargin", aMargin);
2852 xParaProps->setPropertyValue(
"ParaBottomMargin", aMargin);
2858 xParaProps->setPropertyValue(
"ParaContextMargin", aMargin);
2869 if (bLeftSet != bRightSet || bRightSet != bFirstSet)
2875 xParaProps->setPropertyValue(
"ParaLeftMargin", aMargin);
2876 else if (isNumberingViaStyle)
2879 if (nParaLeftMargin != 0)
2880 xParaProps->setPropertyValue(
"ParaLeftMargin",
uno::Any(nParaLeftMargin));
2887 xParaProps->setPropertyValue(
"ParaRightMargin", aMargin);
2893 xParaProps->setPropertyValue(
"ParaFirstLineIndent", aMargin);
2894 else if (isNumberingViaStyle)
2897 if (nFirstLineIndent != 0)
2898 xParaProps->setPropertyValue(
"ParaFirstLineIndent",
uno::Any(nFirstLineIndent));
2904 if( !bKeepLastParagraphProperties )
2907 catch(
const lang::IllegalArgumentException&)
2911 catch(
const uno::Exception&)
2942 if (
const OUString sParaId = pParaContext->
props().
GetParaId(); !sParaId.isEmpty())
3000 for(
auto& rValue : asNonConstRange(aValues) )
3002 if (rValue.Name ==
"CharHidden")
3003 rValue.Value <<=
false;
3011 auto pCurrentRedline =
m_aRedlines.top().size() > 0
3019 (
m_previousRedline->m_nToken & 0xffff) == (pCurrentRedline->m_nToken & 0xffff) &&
3024 assert(xCursor.is());
3025 xCursor->gotoEnd(
false);
3026 xCursor->goLeft(2,
true);
3027 if ( xCursor->getString() ==
u"" )
3029 xCursor->goRight(1,
true);
3030 xCursor->setString(
"");
3031 xCursor->gotoEnd(
false);
3032 xCursor->goLeft(1,
true);
3033 xCursor->setString(
"");
3043 xTextRange = xTextAppend->insertTextPortion(rString, aValues,
m_aTextAppendStack.top().xInsertPosition);
3052 xTextRange = xTextAppend->appendTextPortion(rString, aValues);
3058 assert(xTOCTextCursor.is());
3059 xTOCTextCursor->gotoEnd(
false);
3062 xTOCTextCursor->goLeft(1,
false);
3064 xTextRange = xTextAppend->insertTextPortion(rString, aValues, xTOCTextCursor);
3065 SAL_WARN_IF(!xTextRange.is(),
"writerfilter.dmapper",
"insertTextPortion failed");
3066 if (!xTextRange.is())
3067 throw uno::Exception(
"insertTextPortion failed",
nullptr);
3069 xTOCTextCursor->gotoRange(xTextRange->getEnd(),
true);
3081 OUString sDoubleSpace(
" ");
3088 ((pContext->getProperty(
PROP_CHAR_FONT_NAME)->second >>= sFontName) && sFontName.indexOf(
"Courier") == -1)))
3092 const sal_Unicode aExtraSpace[5] = { 0x2006, 0x20, 0x2006, 0x20, 0 };
3093 const sal_Unicode aExtraSpace2[4] = { 0x20, 0x2006, 0x20, 0 };
3094 xTextRange = xTextAppend->appendTextPortion(rString.replaceAll(sDoubleSpace, aExtraSpace,
nPos)
3095 .replaceAll(sDoubleSpace, aExtraSpace2,
nPos), aValues);
3099 xTextRange = xTextAppend->appendTextPortion(rString, aValues);
3113 catch(
const lang::IllegalArgumentException&)
3117 catch(
const uno::Exception&)
3132 OSL_ENSURE( xTextAppendAndConvert.is(),
"trying to append a text content without XTextAppendAndConvert" );
3139 xTextAppendAndConvert->insertTextContentWithProperties( xContent, xPropertyValues,
m_aTextAppendStack.top().xInsertPosition );
3141 xTextAppendAndConvert->appendTextContent( xContent, xPropertyValues );
3143 catch(
const lang::IllegalArgumentException&)
3146 catch(
const uno::Exception&)
3158 OUString aCLSID = pOLEHandler->getCLSID();
3159 if (aCLSID.isEmpty())
3163 xOLEProperties->setPropertyValue(
"CLSID",
uno::Any(aCLSID));
3165 OUString aDrawAspect = pOLEHandler->GetDrawAspect();
3166 if(!aDrawAspect.isEmpty())
3167 xOLEProperties->setPropertyValue(
"DrawAspect",
uno::Any(aDrawAspect));
3169 awt::Size aSize = pOLEHandler->getSize();
3173 aSize.Height = 1000;
3179 OUString aVisAreaWidth = pOLEHandler->GetVisAreaWidth();
3180 if(!aVisAreaWidth.isEmpty())
3181 xOLEProperties->setPropertyValue(
"VisibleAreaWidth",
uno::Any(aVisAreaWidth));
3183 OUString aVisAreaHeight = pOLEHandler->GetVisAreaHeight();
3184 if(!aVisAreaHeight.isEmpty())
3185 xOLEProperties->setPropertyValue(
"VisibleAreaHeight",
uno::Any(aVisAreaHeight));
3191 if (xReplacementProperties.is())
3193 table::BorderLine2 aBorderProps;
3194 xReplacementProperties->getPropertyValue(
"LineColor") >>= aBorderProps.Color;
3195 xReplacementProperties->getPropertyValue(
"LineWidth") >>= aBorderProps.LineWidth;
3196 xReplacementProperties->getPropertyValue(
"LineStyle") >>= aBorderProps.LineStyle;
3198 if (aBorderProps.LineStyle)
3200 xOLEProperties->setPropertyValue(
"RightBorder",
uno::Any(aBorderProps));
3201 xOLEProperties->setPropertyValue(
"TopBorder",
uno::Any(aBorderProps));
3202 xOLEProperties->setPropertyValue(
"LeftBorder",
uno::Any(aBorderProps));
3203 xOLEProperties->setPropertyValue(
"BottomBorder",
uno::Any(aBorderProps));
3205 OUString pProperties[] = {
3210 "HoriOrientPosition",
3212 "VertOrientPosition",
3213 "VertOrientRelation",
3214 "HoriOrientRelation",
3220 for (
const OUString& s : pProperties)
3222 const uno::Any aVal = xReplacementProperties->getPropertyValue(s);
3223 xOLEProperties->setPropertyValue(s, aVal);
3226 if (xReplacementProperties->getPropertyValue(
"FillStyle").get<css::drawing::FillStyle>()
3227 != css::drawing::FillStyle::FillStyle_NONE)
3229 xOLEProperties->setPropertyValue(
3230 "FillStyle", xReplacementProperties->getPropertyValue(
"FillStyle"));
3231 xOLEProperties->setPropertyValue(
3232 "FillColor", xReplacementProperties->getPropertyValue(
"FillColor"));
3233 xOLEProperties->setPropertyValue(
3234 "FillColor2", xReplacementProperties->getPropertyValue(
"FillColor2"));
3252 if (!aCLSID.isEmpty())
3256 catch(
const uno::Exception& )
3299 if( oox::FormulaImExportBase* formulaimport =
dynamic_cast< oox::FormulaImExportBase*
>( xInterface.get()))
3300 size = formulaimport->getFormulaSize();
3306 uno::Any(text::TextContentAnchorType_AS_CHARACTER));
3311 catch(
const uno::Exception& )
3330 if(xTextAppend.is())
3335 xTextAppend->createTextCursorByRange( xBefore ), uno::UNO_QUERY_THROW);
3337 xCursor->gotoStartOfParagraph(
false );
3341 xCursor->gotoEnd(
true );
3343 xCursor->goLeft(1,
true);
3344 css::uno::Reference<css::text::XTextRange> xTextRange(xCursor, css::uno::UNO_QUERY_THROW);
3346 if (css::uno::Reference<css::text::XDocumentIndexesSupplier> xIndexSupplier{
3349 css::uno::Reference<css::text::XTextRangeCompare> xCompare(
3350 xTextAppend, css::uno::UNO_QUERY);
3351 const auto xIndexAccess = xIndexSupplier->getDocumentIndexes();
3352 for (sal_Int32
i = xIndexAccess->getCount();
i > 0; --
i)
3354 if (css::uno::Reference<css::text::XDocumentIndex> xIndex{
3355 xIndexAccess->getByIndex(
i - 1), css::uno::UNO_QUERY })
3357 const auto xIndexTextRange = xIndex->getAnchor();
3358 if (xCompare->compareRegionStarts(xTextRange, xIndexTextRange) == 0
3359 && xCompare->compareRegionEnds(xTextRange, xIndexTextRange) == 0)
3367 xCursor->goRight(1,
true);
3375 xSection->attach( xTextRange );
3376 xRet.set(xSection, uno::UNO_QUERY );
3378 catch(
const uno::Exception&)
3394 if (bSetAnchorToChar)
3397 uno::Any aEmptyBorder{table::BorderLine2()};
3398 static const std::vector<PropertyIds> aBorderIds
3400 for (
size_t i = 0;
i < aBorderIds.size(); ++
i)
3403 static const std::vector<PropertyIds> aMarginIds
3408 for (
size_t i = 0;
i < aMarginIds.size(); ++
i)
3425 if ((aFooterHeader.second && !bDynamicHeightTop) || (!aFooterHeader.second && !bDynamicHeightBottom))
3431 xRangeStart = xCursor->getStart();
3432 xCursor->gotoEnd(
false);
3433 xRangeEnd = xCursor->getStart();
3435 std::vector<beans::PropertyValue> aFrameProperties
3453 if (!aFooterHeader.second)
3457 xRangeStart->getText(), uno::UNO_QUERY);
3458 xBodyText->convertToTextFrame(xTextAppend, xRangeEnd,
3485 if(!pSectionContext)
3501 if (!xPageStyle.is())
3510 xPageStyle->setPropertyValue(
3521 xPageStyle->getPropertyValue(
getPropertyName(bLeft? ePropTextLeft: ePropText)) >>= xText;
3526 : xText->createTextCursorByRange(xText->getStart())));
3530 : xText->createTextCursorByRange(xText->getStart())),
3536 bool bIsShared =
false;
3540 xPageStyle->getPropertyValue(
getPropertyName(ePropShared)) >>= bIsShared;
3545 xPageStyle->getPropertyValue(
getPropertyName(bLeft ? ePropTextLeft : ePropText))
3551 : xText->createTextCursorByRange(xText->getStart())));
3557 catch(
const uno::Exception& )
3609 m_aRedlines.push(std::vector< RedlineParamsPtr >());
3614 OUString sFootnoteCharStyleName;
3617 aProp->second >>= sFootnoteCharStyleName;
3628 OUString(
"com.sun.star.text.Footnote" ) : OUString(
"com.sun.star.text.Endnote" )),
3629 uno::UNO_QUERY_THROW );
3631 pTopContext->SetFootnote(xFootnote, sFootnoteCharStyleName);
3637 xFootnoteText->createTextCursorByRange(xFootnoteText->getStart())));
3640 std::vector< RedlineParamsPtr > aFootnoteRedline = std::move(
m_aRedlines.top());
3646 if (!sFootnoteCharStyleName.isEmpty())
3651 catch(
const uno::Exception& )
3663 bool bRedlineMoved =
false;
3667 switch ( pRedline->m_nToken & 0xffff )
3673 bRedlineMoved =
true;
3680 bRedlineMoved =
true;
3686 case XML_ParagraphFormat:
3690 throw lang::IllegalArgumentException(
"illegal redline token type",
nullptr, 0);
3692 beans::PropertyValues aRedlineProperties( 4 );
3693 beans::PropertyValue * pRedlineProperties = aRedlineProperties.getArray( );
3695 pRedlineProperties[0].Value <<= pRedline->m_sAuthor;
3700 if ( aDateTime.Year == 0 && aDateTime.Month == 0 && aDateTime.Day == 0 )
3702 aDateTime.Year = 1970;
3703 aDateTime.Month = 1;
3706 pRedlineProperties[1].Value <<= aDateTime;
3708 pRedlineProperties[2].Value <<= pRedline->m_aRevertProperties;
3709 pRedlineProperties[3].Name =
"RedlineMoved";
3710 pRedlineProperties[3].Value <<= bRedlineMoved;
3715 xRedline->makeRedline(
sType, aRedlineProperties );
3733 catch(
const uno::Exception & )
3780 for(
const auto& rRedline : avRedLines )
3786 for(
const auto& rRedline : avRedLines )
3820 assert(pContext->GetFootnote().
is());
3840 uno::UNO_QUERY_THROW );
3846 catch(
const uno::Exception&)
3854 std::deque<css::uno::Any>& rRedlines,
3855 std::vector<sal_Int32>& redPos,
3856 std::vector<sal_Int32>& redLen,
3860 for(
size_t i = 0;
i < rRedlines.size();
i+=3)
3863 rRedlines[
i] >>= xRange;
3869 xRangeCursor = xSrc->createTextCursorByRange( xRange );
3871 catch(
const uno::Exception& )
3874 if (xRangeCursor.is())
3877 sal_Int32 nLen = xRange->getString().getLength();
3878 redLen.push_back(nLen);
3879 xRangeCursor->gotoRange(xSrc->getStart(),
true);
3880 redPos.push_back(xRangeCursor->getString().getLength() - nLen);
3889 redLen.push_back(-1);
3890 redPos.push_back(-1);
3897 std::deque<css::uno::Any>& rRedlines,
3898 std::vector<sal_Int32>& redPos,
3899 std::vector<sal_Int32>& redLen,
3903 for(
size_t i = 0; redIdx > -1 && i <= sal::static_int_cast<size_t>(redIdx);
i+=3)
3906 beans::PropertyValues aRedlineProperties( 3 );
3908 if (redPos[
i/3] == -1)
3910 rRedlines[
i+1] >>=
sType;
3911 rRedlines[
i+2] >>= aRedlineProperties;
3913 xCrsr->goRight(redPos[
i/3],
false);
3914 xCrsr->goRight(redLen[
i/3],
true);
3917 xRedline->makeRedline(
sType, aRedlineProperties );
3919 catch(
const uno::Exception&)
3935 xTxt.set( xSrc, uno::UNO_QUERY_THROW );
3936 xTxt2.set( xDest, uno::UNO_QUERY_THROW );
3937 xTxt2->copyText( xTxt );
3940 std::vector<sal_Int32> redPos, redLen;
3947 for(
size_t i = 0; redIdx > -1 && i <= sal::static_int_cast<size_t>(redIdx) + 2;
i++)
3963 auto xFootnotes = xFootnotesSupplier->getFootnotes();
3967 xFootnotes->getByIndex(0) >>= xFirstNote;
3969 xText->setString(
"");
3975 xFootnotes->getByIndex(
i) >>= xNote;
3976 xNote->getAnchor()->setString(
"");
3981 auto xEndnotes = xEndnotesSupplier->getEndnotes();
3985 xEndnotes->getByIndex(0) >>= xFirstNote;
3987 xText->setString(
"");
3993 xEndnotes->getByIndex(
i) >>= xNote;
3994 xNote->getAnchor()->setString(
"");
4008 std::deque<sal_Int32> aSortedIds = rNoteIds;
4009 std::sort(aSortedIds.begin(), aSortedIds.end());
4010 std::map<sal_Int32, size_t> aMapIds;
4012 for (
size_t i = 0;
i < aSortedIds.size(); ++
i)
4013 aMapIds[aSortedIds[
i]] =
i;
4015 std::deque<sal_Int32> aOrigNoteIds = rNoteIds;
4016 for (
size_t i = 0;
i < rNoteIds.size(); ++
i)
4017 rNoteIds[aMapIds[aOrigNoteIds[
i]]] =
i;
4018 rFirstNoteIndex = rNoteIds.front();
4019 rNoteIds.pop_front();
4029 bool bCopied =
false;
4034 auto xFootnotes = xFootnotesSupplier->getFootnotes();
4035 auto xEndnotes = xEndnotesSupplier->getEndnotes();
4036 if ( ( (
IsInFootnote() && xFootnotes->getCount() > 1 &&
4037 ( xFootnotes->getByIndex(xFootnotes->getCount()-1) >>= xNoteLast ) ) ||
4039 ( xEndnotes->getByIndex(xEndnotes->getCount()-1) >>= xNoteLast ) )
4040 ) && xNoteLast->getLabel().isEmpty() )
4065 xEndnotes->getByIndex(
m_aEndnoteIds.front()) >>= xNoteFirst;
4072 catch (uno::Exception
const&)
4093 SAL_WARN(
"writerfilter.dmapper",
"PopFootOrEndnote() is called without PushFootOrEndnote()?");
4133 bool bMarker =
false;
4135 if (xTextRangeCompare->compareRegionStarts(aAnnotationPosition.
m_xStart, aAnnotationPosition.
m_xEnd) == 0)
4139 xText->insertString(xCursor,
"x",
false);
4143 xCursor->gotoRange(aAnnotationPosition.
m_xEnd,
true);
4153 xCursor->goLeft(1,
true);
4154 xCursor->setString(OUString());
4159 catch (uno::Exception
const&)
4202 if (xSInfo->supportsService(
"com.sun.star.drawing.GroupShape"))
4206 const sal_uInt32 nShapeCount = xShapes.is() ? xShapes->getCount() : 0;
4207 for ( sal_uInt32
i = 0;
i < nShapeCount; ++
i )
4214 xFramePropertySet.set(
xFrame, uno::UNO_QUERY_THROW);
4221 const bool bOnlyApplyCharHeight = !aGrabBag[
"mso-pStyle"].hasValue();
4223 OUString sStyleName;
4224 aGrabBag[
"mso-pStyle"] >>= sStyleName;
4246 for (
const auto& eId : eIds )
4254 if ( beans::PropertyState_DEFAULT_VALUE == xShapePropertyState->getPropertyState(sPropName) )
4260 xFramePropertySet->setPropertyValue(sPropName, aProp);
4262 xShapePropertySet->setPropertyValue(sPropName, aProp);
4266 catch (
const uno::Exception&)
4268 TOOLS_WARN_EXCEPTION(
"writerfilter.dmapper",
"PushShapeContext() text stylesheet property exception" );
4273 catch (
const uno::Exception&)
4287 else if (xSInfo->supportsService(
"com.sun.star.drawing.OLE2Shape"))
4312 xTextCursor = xShapeTextRange->getText()->createTextCursorByRange(
4313 xShapeTextRange->getStart());
4326 text::TextContentAnchorType nAnchorType(text::TextContentAnchorType_AT_PARAGRAPH);
4328 bool checkZOrderStatus =
false;
4329 if (xSInfo->supportsService(
"com.sun.star.text.TextFrame"))
4336 xShapePropertySet->getPropertyValue(
"FrameInteropGrabBag") >>= aGrabBag;
4338 for (
const auto& rProp : std::as_const(aGrabBag))
4340 if (rProp.Name ==
"VML-Z-ORDER")
4343 sal_Int32 zOrder(0);
4344 rProp.Value >>= zOrder;
4345 xShapePropertySet->setPropertyValue(
"ZOrder",
uno::Any(pZOrderHelper->
findZOrder(zOrder)));
4346 pZOrderHelper->
addItem(xShapePropertySet, zOrder);
4348 checkZOrderStatus =
true;
4350 else if ( rProp.Name ==
"TxbxHasLink" )
4362 xTextAppend->insertTextContent(xTextRange, xTextContent,
false);
4366 xPropertySet->setPropertyValue(
"FrameInteropGrabBag",
uno::Any(aGrabBag));
4368 else if (nAnchorType == text::TextContentAnchorType_AS_CHARACTER)
4381 xShapePropertySet->getPropertyValue(
"InteropGrabBag") >>= aGrabBag;
4382 for (
const auto& rProp : std::as_const(aGrabBag))
4384 if (rProp.Name ==
"VML-Z-ORDER")
4387 sal_Int32 zOrder(0);
4388 rProp.Value >>= zOrder;
4389 xShapePropertySet->setPropertyValue(
"ZOrder",
uno::Any(pZOrderHelper->
findZOrder(zOrder)));
4390 pZOrderHelper->
addItem(xShapePropertySet, zOrder);
4392 checkZOrderStatus =
true;
4394 else if ( rProp.Name ==
"TxbxHasLink" )
4407 if(xShapePropertySet.is())
4409 xPropSetInfo = xShapePropertySet->getPropertySetInfo();
4410 if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(
"InteropGrabBag"))
4415 xShapePropertySet->setPropertyValue(
"InteropGrabBag",
uno::Any(aShapeGrabBag));
4421 xProps->setPropertyValue(
4428 catch (
const uno::Exception& )
4442 awt::Size aSize = xShape->getSize( );
4453 OUString
const name(xShapeName->getName());
4454 if (!
name.isEmpty())
4458 xEmbedName->setName(
name);
4460 catch (uno::RuntimeException
const&)
4491 catch (
const uno::RuntimeException& )
4505 if ( xDrawPage.is() )
4506 xDrawPage->remove( xShape );
4508 catch(
const uno::Exception& )
4515 css::awt::Size aShapeSize;
4518 aShapeSize = xShape->getSize();
4520 catch (
const css::uno::RuntimeException& e)
4524 SAL_WARN(
"writerfilter.dmapper",
"getSize failed. " << e.Message);
4526 if( aShapeSize.Width <= 2 )
4542 bool bIsSdtEndBefore =
false;
4547 for (
const auto& rCurrentCharProp : currentCharProps)
4549 if (rCurrentCharProp.Name ==
"CharInteropGrabBag")
4552 rCurrentCharProp.Value >>= aCharGrabBag;
4553 for (
const auto& rProp : std::as_const(aCharGrabBag))
4555 if(rProp.Name ==
"SdtEndBefore")
4557 rProp.Value >>= bIsSdtEndBefore;
4563 return bIsSdtEndBefore;
4580 if ( !xPreviousNumberingRules.is() || xPreviousNumberingRules->getName().isEmpty() )
4598 = xMultiServiceFactory->createInstance(
"com.sun.star.comp.Writer.WriterFilter");
4607 if (!xStorageAccess.is())
4613 rStreamName, embed::ElementModes::READ);
4622 if (pSectionContext)
4627 {
"InputStream",
uno::Any(xInputStream) },
4629 {
"TextInsertModeRange",
uno::Any(xInsertTextRange) },
4630 {
"AltChunkMode",
uno::Any(
true) },
4631 {
"AltChunkStartingRange",
uno::Any(xSectionStartingRange) },
4636 xFilter->filter(aDescriptor);
4638 catch (
const uno::Exception& rException)
4640 SAL_WARN(
"writerfilter",
"DomainMapper_Impl::HandleAltChunk: failed to handle alt chunk: "
4641 << rException.Message);
4649 if (nAlignment != NS_ooxml::LN_Value_ST_PTabAlignment_left)
4660 if (!xTextAppend.is())
4667 if (!xInsertPosition.is())
4669 xInsertPosition = xTextAppend->getEnd();
4672 = xTextAppend->createTextCursorByRange(xInsertPosition);
4675 xCursor->goLeft(1,
true);
4676 if (xCursor->getString() !=
"\t")
4683 if (!xParagraphCursor.is())
4688 xCursor->collapseToStart();
4689 xParagraphCursor->gotoStartOfParagraph(
true);
4690 if (xCursor->isCollapsed())
4696 xCursor->collapseToEnd();
4697 xCursor->goRight(1,
true);
4705 case NS_ooxml::LN_Value_ST_BrClear_left:
4709 case NS_ooxml::LN_Value_ST_BrClear_right:
4713 case NS_ooxml::LN_Value_ST_BrClear_all:
4741 sal_Int16 nRet = style::NumberingType::PAGE_DESCRIPTOR;
4746 constexpr OUStringLiteral rSeparator(
u"\\* ");
4747 if (
size_t nStartIndex = rCommand.find(rSeparator); nStartIndex != std::u16string_view::npos)
4749 sal_Int32 nStartIndex2 = nStartIndex + rSeparator.getLength();
4753 if( !sNumber.isEmpty() )
4756 struct NumberingPairs
4758 const char* cWordName;
4761 static const NumberingPairs aNumberingPairs[] =
4763 {
"Arabic", style::NumberingType::ARABIC}
4764 ,{
"ROMAN", style::NumberingType::ROMAN_UPPER}
4765 ,{
"roman", style::NumberingType::ROMAN_LOWER}
4766 ,{
"ALPHABETIC", style::NumberingType::CHARS_UPPER_LETTER}
4767 ,{
"alphabetic", style::NumberingType::CHARS_LOWER_LETTER}
4768 ,{
"CircleNum", style::NumberingType::CIRCLE_NUMBER}
4769 ,{
"ThaiArabic", style::NumberingType::CHARS_THAI}
4770 ,{
"ThaiCardText", style::NumberingType::CHARS_THAI}
4771 ,{
"ThaiLetter", style::NumberingType::CHARS_THAI}
4778 ,{
"Aiueo", style::NumberingType::AIU_FULLWIDTH_JA}
4779 ,{
"Iroha", style::NumberingType::IROHA_FULLWIDTH_JA}
4786 ,{
"ArabicAlpha", style::NumberingType::CHARS_ARABIC}
4787 ,{
"ArabicAbjad", style::NumberingType::FULLWIDTH_ARABIC}
4788 ,{
"Ganada", style::NumberingType::HANGUL_JAMO_KO}
4789 ,{
"Chosung", style::NumberingType::HANGUL_SYLLABLE_KO}
4790 ,{
"KoreanCounting", style::NumberingType::NUMBER_HANGUL_KO}
4791 ,{
"KoreanLegal", style::NumberingType::NUMBER_LEGAL_KO}
4792 ,{
"KoreanDigital", style::NumberingType::NUMBER_DIGITAL_KO}
4793 ,{
"KoreanDigital2", style::NumberingType::NUMBER_DIGITAL2_KO}
4839 for(
const NumberingPairs& rNumberingPair : aNumberingPairs)
4841 if( sNumber.equalsAscii(rNumberingPair.cWordName ))
4843 nRet = rNumberingPair.nType;
4857 sal_Int32 delimPos = rCommand.indexOf(
"\\@");
4861 const sal_Int32 nQuoteIndex = rCommand.indexOf(
'\"');
4862 if (nQuoteIndex != -1)
4864 sal_Int32 wsChars = nQuoteIndex - delimPos - 2;
4865 command = rCommand.replaceAt(delimPos+2, wsChars,
u"");
4870 command = OUString::Concat(rCommand.subView(0, delimPos + 2)) +
"\"" +
o3tl::trim(rCommand.subView(delimPos + 2)) +
"\"";
4881 size_t & rIndex,
bool & rHaveToken,
bool & rIsSwitch)
4886 OUStringBuffer token;
4887 bool bQuoted(
false);
4888 for (; rIndex < rCommand.size(); ++rIndex)
4891 switch (currentChar)
4895 if (rIndex == rCommand.size() - 1)
4897 SAL_INFO(
"writerfilter.dmapper",
"field: trailing escape");
4902 if (bQuoted ||
'\\' == nextChar)
4905 token.append(nextChar);
4910 if (token.isEmpty())
4914 return OUString(rCommand.substr(rIndex - 2, 2)).toAsciiUpperCase();
4918 return token.makeStringAndClear();
4924 if (bQuoted || !token.isEmpty())
4931 return token.makeStringAndClear();
4945 if (!token.isEmpty())
4949 return token.makeStringAndClear();
4954 if (token.isEmpty())
4964 token.append(currentChar);
4968 assert(rIndex == rCommand.size());
4973 "field argument with unterminated quote");
4975 rHaveToken = !token.isEmpty();
4976 return token.makeStringAndClear();
4979std::tuple<OUString, std::vector<OUString>, std::vector<OUString> >
splitFieldCommand(std::u16string_view rCommand)
4982 std::vector<OUString> arguments;
4983 std::vector<OUString> switches;
4984 size_t nStartIndex(0);
4988 if ((rCommand.size() >= nStartIndex + 2) &&
4989 (rCommand[nStartIndex] == L
'\\') &&
4990 (rCommand[nStartIndex + 1] != L
'\\') &&
4991 (rCommand[nStartIndex + 1] != L
' '))
5000 OUString
const token =
5002 assert(nStartIndex <= rCommand.size());
5005 if (
sType.isEmpty())
5007 sType = token.toAsciiUpperCase();
5009 else if (bIsSwitch || !switches.empty())
5011 switches.push_back(token);
5015 arguments.push_back(token);
5018 }
while (nStartIndex < rCommand.size());
5020 return std::make_tuple(
sType, arguments, switches);
5029 size_t nIndex = rCommand.find(
' ', 2);
5030 if (
nIndex == std::u16string_view::npos)
5032 while (
nIndex < rCommand.size() && rCommand[
nIndex] ==
' ')
5034 std::u16string_view sShortCommand( rCommand.substr(
nIndex ) );
5037 sal_Int32 nIndex2 = 0;
5038 std::u16string_view sRet =
o3tl::getToken(sShortCommand, 0,
' ', nIndex2);
5040 rHint = sShortCommand.substr( nIndex2 );
5041 if( rHint.isEmpty() )
5043 return OUString(sRet);
5046static size_t nextCode(std::u16string_view rCommand,
size_t pos)
5048 bool inQuotes =
false;
5049 for (;
pos < rCommand.size(); ++
pos)
5051 switch (rCommand[
pos])
5054 inQuotes = !inQuotes;
5063 return std::u16string_view::npos;
5070 if (rCommand[
i] == cSwitch)
5073 return std::u16string_view::npos;
5077 std::u16string_view rCommand,
5081 if (
size_t i =
findCode(rCommand, cSwitch);
i < rCommand.size())
5085 if (next < rCommand.size())
5098 return OUString(
o3tl::trim(sValue)).replaceAll(
"\"",
"").replaceAll(
u"“",
"").replaceAll(
u"”",
"");
5107 bool const bDetectFormat)
5111 bool bHijri = 0 < rCommand.indexOf(
"\\h ");
5112 lang::Locale aUSLocale;
5113 aUSLocale.Language =
"en";
5114 aUSLocale.Country =
"US";
5116 lang::Locale aCurrentLocale;
5119 if (sFormatString.isEmpty())
5124 sal_Int32
nPos = rCommand.indexOf(
" \\");
5125 OUString sCommand =
nPos == -1 ? rCommand.trim()
5127 if (sCommand ==
"CREATEDATE" || sCommand ==
"PRINTDATE" || sCommand ==
"SAVEDATE")
5131 css::uno::Reference<css::i18n::XNumberFormatCode>
const& xNumberFormatCode =
5133 sFormatString = xNumberFormatCode->getFormatCode(
5134 css::i18n::NumberFormatIndex::DATE_SYSTEM_SHORT, aCurrentLocale).Code;
5135 nPos = sFormatString.indexOf(
"YYYY");
5137 sFormatString = sFormatString.replaceFirst(
"YY",
"YYYY");
5138 if (aCurrentLocale == aUSLocale)
5139 sFormatString +=
" h:mm:ss AM/PM";
5141 sFormatString +=
" hh:mm:ss AM/PM";
5143 catch(
const uno::Exception&)
5158 xFormatter->attachNumberFormatsSupplier( xNumberSupplier );
5159 nKey = xFormatter->detectNumberFormat( 0, rCommand );
5163 nKey = xNumberSupplier->getNumberFormats()->addNewConverted( sFormat, aUSLocale, aCurrentLocale );
5165 xPropertySet->setPropertyValue(
5169 catch(
const uno::Exception&)
5176 auto pProp = std::find_if(grabBag.begin(), grabBag.end(),
5177 [&
name](
const beans::PropertyValue& rProp) { return rProp.Name == name; });
5178 if (pProp != grabBag.end())
5179 return pProp->Value;
5190 struct TextFramesForChaining {
5191 css::uno::Reference< css::drawing::XShape > xShape;
5194 OUString s_mso_next_textbox;
5196 TextFramesForChaining() :
nId(0), nSeq(0) {}
5198 typedef std::map <OUString, TextFramesForChaining> ChainMap;
5202 ChainMap aTextFramesForChainingHelper;
5203 ::std::vector<TextFramesForChaining> chainingWPS;
5204 OUString sChainNextName(
"ChainNextName");
5212 if( xPropertySet.is() )
5213 xPropertySetInfo = xPropertySet->getPropertySetInfo();
5217 TextFramesForChaining aChainStruct;
5218 OUString sShapeName;
5219 OUString sLinkChainName;
5223 if ( xServiceInfo->supportsService(
"com.sun.star.text.TextFrame") )
5225 xPropertySet->getPropertyValue(
"FrameInteropGrabBag") >>= aGrabBag;
5226 xPropertySet->getPropertyValue(
"LinkDisplayName") >>= sShapeName;
5230 xPropertySet->getPropertyValue(
"InteropGrabBag") >>= aGrabBag;
5231 xPropertySet->getPropertyValue(
"ChainName") >>= sShapeName;
5241 aChainStruct.shapeName = sShapeName;
5243 if (!sLinkChainName.isEmpty())
5245 aChainStruct.xShape = rTextFrame;
5246 aTextFramesForChainingHelper[sLinkChainName] = aChainStruct;
5248 if (aChainStruct.s_mso_next_textbox.isEmpty())
5250 aChainStruct.xShape = rTextFrame;
5251 if (!sLinkChainName.isEmpty())
5253 aChainStruct.shapeName = sLinkChainName;
5255 chainingWPS.emplace_back(aChainStruct);
5260 for (
auto& msoItem : aTextFramesForChainingHelper)
5264 if( !msoItem.second.s_mso_next_textbox.isEmpty()
5265 && msoItem.second.s_mso_next_textbox != msoItem.first )
5267 ChainMap::iterator nextFinder=aTextFramesForChainingHelper.find(msoItem.second.s_mso_next_textbox);
5268 if( nextFinder != aTextFramesForChainingHelper.end() )
5271 if (msoItem.second.shapeName.isEmpty())
5276 xNamed->setName( msoItem.first );
5277 msoItem.second.shapeName = msoItem.first;
5280 if (nextFinder->second.shapeName.isEmpty())
5285 xNamed->setName( nextFinder->first );
5286 nextFinder->second.shapeName = msoItem.first;
5294 xPropertySet->setPropertyValue(sChainNextName,
uno::Any(nextFinder->second.shapeName));
5297 if( nextFinder->second.s_mso_next_textbox.isEmpty() )
5298 aTextFramesForChainingHelper.erase(nextFinder->first);
5304 const sal_Int32 nDirection = 1;
5307 for (
const auto& rOuter : chainingWPS)
5309 for (
const auto& rInner : chainingWPS)
5311 if (rInner.nId == rOuter.nId)
5313 if (rInner.nSeq == (rOuter.nSeq + nDirection))
5319 xPropertySet->setPropertyValue(sChainNextName,
uno::Any(rInner.shapeName));
5327 catch (
const uno::Exception&)
5341 m_xTextFactory->createInstance(
"com.sun.star.text.TextFrame"), uno::UNO_QUERY_THROW);
5345 uno::UNO_QUERY_THROW)
5346 ->appendTextContent(xTBoxFrame, beans::PropertyValues());
5356 catch (uno::Exception& e)
5358 SAL_WARN(
"writerfilter.dmapper",
"Exception during creating textbox (" + e.Message +
")!");
5392 for (sal_Int32
i = 0;
i < xGroup->getCount(); ++
i)
5397 if (!xProps->getPropertyValue(
"TextBox").get<
bool>())
5411 xProps->setPropertyValue(
"TextBoxContent",
uno::Any(xTextBox));
5415 SAL_WARN(
"writerfilter.dmapper",
"Exception while trying to attach textboxes!");
5423 OUString sTextBoxName;
5425 if (xName && !xName->getName().isEmpty())
5426 sTextBoxName = xName->getName();
5430 if (xProps->getPropertySetInfo()->hasPropertyByName(
"InteropGrabBag"))
5431 xProps->getPropertyValue(
"InteropGrabBag") >>= aOldGrabBagSeq;
5434 if (!aOldGrabBagSeq.hasElements())
5438 bool bSuccess =
false;
5439 beans::PropertyValues aNewGrabBagSeq;
5443 if (aHasLink.hasValue() && aHasLink.get<
bool>())
5446 for (sal_uInt32
i = 0;
i < aOldGrabBagSeq.size(); ++
i)
5448 aNewGrabBagSeq.realloc(
i + 1);
5450 if (!aOldGrabBagSeq[
i].
Name.isEmpty() && !aLinkProp.Name.isEmpty()
5451 && (aOldGrabBagSeq[
i].Name == aLinkProp.Name))
5453 aNewGrabBagSeq.getArray()[
i] = aLinkProp;
5458 aNewGrabBagSeq.getArray()[
i] = aOldGrabBagSeq[
i];
5464 aNewGrabBagSeq.realloc(aNewGrabBagSeq.size() + 1);
5465 aNewGrabBagSeq.getArray()[aNewGrabBagSeq.size() - 1] = aLinkProp;
5471 if (aNewGrabBagSeq.hasElements() && bSuccess)
5473 xProps->setPropertyValue(
"InteropGrabBag",
uno::Any(aNewGrabBagSeq));
5479 SAL_WARN(
"writerfilter.dmapper",
"Exception while trying to link textboxes!");
5489 OUString sFieldMasterService( OUString::createFromAscii(pFieldMasterService) );
5490 OUStringBuffer aFieldMasterName;
5491 OUString sDatabaseDataSourceName =
GetSettingsTable()->GetCurrentDatabaseDataSource();
5492 bool bIsMergeField = sFieldMasterService.endsWith(
"Database");
5493 aFieldMasterName.appendAscii( pFieldMasterService );
5494 aFieldMasterName.append(
'.');
5495 if ( bIsMergeField && !sDatabaseDataSourceName.isEmpty() )
5497 aFieldMasterName.append(sDatabaseDataSourceName +
".");
5499 aFieldMasterName.append(rFieldMasterName);
5500 OUString sFieldMasterName = aFieldMasterName.makeStringAndClear();
5501 if(xFieldMasterAccess->hasByName(sFieldMasterName))
5504 xMaster.set(xFieldMasterAccess->getByName(sFieldMasterName), uno::UNO_QUERY_THROW);
5509 xMaster.set(
m_xTextFactory->createInstance(sFieldMasterService), uno::UNO_QUERY_THROW);
5510 if ( !bIsMergeField || sDatabaseDataSourceName.isEmpty() )
5513 xMaster->setPropertyValue(
5518 xMaster->setPropertyValue(
5520 uno::Any(sDatabaseDataSourceName.copy(0, sDatabaseDataSourceName.indexOf(
'.'))));
5521 xMaster->setPropertyValue(
5524 xMaster->setPropertyValue(
5526 uno::Any(sDatabaseDataSourceName.copy(sDatabaseDataSourceName.indexOf(
'.') + 1)));
5527 xMaster->setPropertyValue(
5548 if (xTextAppend.is())
5549 xCrsr = xTextAppend->createTextCursorByRange(
5552 : xTextAppend->getEnd());
5557 xStart = xCrsr->getStart();
5583 : m_bTextInserted(bTextInserted)
5584 , m_nTableDepth(nTableDepth)
5596 : m_bFieldCommandCompleted(false)
5597 , m_xStartRange(
std::move( xStart ))
5598 , m_bFieldLocked( false )
5599 , m_bCommandType(false)
5612 if (xTextField.is())
5615 assert(xServiceInfo.is());
5617 assert(!xServiceInfo->supportsService(
"com.sun.star.text.Fieldmark")
5618 && !xServiceInfo->supportsService(
"com.sun.star.text.FormFieldmark"));
5636 ::std::vector<OUString> aResult;
5638 bool bInString =
false;
5643 bool bInStringNext = bInString;
5645 if (sToken.isEmpty())
5648 if (sToken[0] ==
'"')
5650 bInStringNext =
true;
5651 sToken = sToken.copy(1);
5653 if (sToken.endsWith(
"\""))
5655 bInStringNext =
false;
5656 sToken = sToken.copy(0, sToken.getLength() - 1);
5661 sPart +=
" " + sToken;
5664 aResult.push_back(sPart);
5675 aResult.push_back(sToken);
5679 bInString = bInStringNext;
5697 OSL_ENSURE( pContext,
"no field context available");
5702 pContext->AppendCommand( rPartOfCommand );
5712 std::unordered_map<OUString, ww::eField> mapID
5809 auto const it = mapID.find(rType);
5810 return (it == mapID.end()) ?
ww::eNONE : it->second;
5840 {
"IF", {
"ConditionalText",
FIELD_IF }},
5873 {
"TOC", {
"com.sun.star.text.ContentIndex",
FIELD_TOC }},
5874 {
"TC", {
"com.sun.star.text.ContentIndexMark",
FIELD_TC }},
5878 {
"INDEX", {
"com.sun.star.text.DocumentIndex",
FIELD_INDEX }},
5879 {
"XE", {
"com.sun.star.text.DocumentIndexMark",
FIELD_XE }},
5881 {
"CITATION", {
"com.sun.star.text.TextField.Bibliography",
FIELD_CITATION }},
5884 return aFieldConversionMap;
5896 return aEnhancedFieldConversionMap;
5904 OUString sVariable, sHint;
5909 if(sHint.getLength() >= 2)
5911 std::u16string_view sTmp =
o3tl::trim(sHint);
5914 sHint = sTmp.substr(1, sTmp.size() - 2);
5921 (
"com.sun.star.text.FieldMaster.SetExpression", sVariable);
5928 ( xFieldInterface, uno::UNO_QUERY_THROW );
5929 xDependentField->attachTextFieldMaster( xMaster );
5946 OUString sVariable, sHint;
5950 if(!sVariable.isEmpty())
5955 (
"com.sun.star.text.FieldMaster.SetExpression", sVariable );
5961 ( xFieldInterface, uno::UNO_QUERY_THROW );
5962 xDependentField->attachTextFieldMaster( xMaster );
5965 xFieldProperties->setPropertyValue(
5968 xFieldProperties->setPropertyValue(
5979 xFieldInterface =
nullptr;
5998 OUString
changed = input.replaceAll(
" <> ",
" NEQ ");
6016 icu::ErrorCode status;
6017 icu::UnicodeString usInput(
changed.getStr());
6018 const uint32_t rMatcherFlags = UREGEX_CASE_INSENSITIVE;
6019 OUString regex =
"\\b(AND|OR|ROUND)\\s*\\(\\s*([^" + listSeparator +
"]+)\\s*" + listSeparator +
"\\s*([^)]+)\\s*\\)";
6020 icu::UnicodeString usRegex(regex.getStr());
6021 icu::RegexMatcher rmatch1(usRegex, usInput, rMatcherFlags, status);
6022 usInput = rmatch1.replaceAll(icu::UnicodeString(
"(($2) $1 ($3))"), status);
6026 usInput.findAndReplace(icu::UnicodeString(listSeparator.getStr()),
"|");
6030 icu::RegexMatcher rmatch2(
"\\b([A-Z]{1,3}[0-9]+)\\b(?![(])", usInput, rMatcherFlags, status);
6031 usInput = rmatch2.replaceAll(icu::UnicodeString(
"<$1>"), status);
6036 icu::RegexMatcher rmatch3(
"(<[a-z]{1,3}[0-9]+>|\\b(above|below|left|right)\\b)", usInput, rMatcherFlags, status);
6037 icu::UnicodeString replacedCellRefs;
6038 while (rmatch3.find(status) && status.isSuccess()) {
6039 rmatch3.appendReplacement(replacedCellRefs, rmatch3.group(status).toUpper(), status);
6041 rmatch3.appendTail(replacedCellRefs);
6044 icu::RegexMatcher rmatch4(
"<([A-Z]{1,3}[0-9]+)>:<([A-Z]{1,3}[0-9]+)>", replacedCellRefs, rMatcherFlags, status);
6045 usInput = rmatch4.replaceAll(icu::UnicodeString(
"<$1:$2>"), status);
6048 icu::RegexMatcher rmatch5(
"\\bDEFINED\\s*\\(<([A-Z]+[0-9]+)>\\)", usInput, rMatcherFlags, status);
6049 usInput = rmatch5.replaceAll(icu::UnicodeString(
"DEFINED($1)"), status);
6052 icu::RegexMatcher rmatch6(
"\\b(ABOVE|BELOW|LEFT|RIGHT)\\b", usInput, rMatcherFlags, status);
6053 usInput = rmatch6.replaceAll(icu::UnicodeString(
" $1 "), status);
6060 icu::RegexMatcher rmatch7(
"\\b([0-9]+),([0-9]+([eE][-]?[0-9]+)?)\\b", usInput, rMatcherFlags, status);
6061 usInput = rmatch7.replaceAll(icu::UnicodeString(
"$1.$2"), status);
6064 return OUString(usInput.getTerminatedBuffer());
6071 OUString command = pContext->GetCommand().trim();
6075 sal_Int32 delimPos = command.indexOf(
"\\#");
6078 command = command.replaceAt(delimPos, command.getLength() - delimPos,
u"").trim();
6082 if (command.getLength() < 2)
6090 xFieldProperties->setPropertyValue(
"IsShowFormula",
uno::Any(
false));
6104 const OUString & rCommand(pContext->GetCommand());
6105 sal_Int32
nIndex = 0, nEnd = 0;
6107 nIndex = rCommand.indexOf(
"\\* jc" );
6112 const sal_Int32 aRubyAlignValues[] =
6114 NS_ooxml::LN_Value_ST_RubyAlign_center,
6115 NS_ooxml::LN_Value_ST_RubyAlign_distributeLetter,
6116 NS_ooxml::LN_Value_ST_RubyAlign_distributeSpace,
6117 NS_ooxml::LN_Value_ST_RubyAlign_left,
6118 NS_ooxml::LN_Value_ST_RubyAlign_right,
6119 NS_ooxml::LN_Value_ST_RubyAlign_rightVertical,
6126 nIndex = rCommand.indexOf(
"\\* hps" );
6133 nIndex = rCommand.indexOf(
"\\o");
6139 nEnd = rCommand.lastIndexOf(
')');
6145 std::u16string_view sRubyParts = rCommand.subView(
nIndex+1,nEnd-
nIndex-1);
6151 if ((nIndex2 = sPart1.find(
'(')) != std::u16string_view::npos && (nEnd2 = sPart1.rfind(
')')) != std::u16string_view::npos && nEnd2 > nIndex2)
6153 aInfo.
sRubyText = sPart1.substr(nIndex2+1,nEnd2-nIndex2-1);
6160 double fVal = double(aInfo.
nHps) / 2.;
6166 PropertyValueVector_t aProps = comphelper::sequenceToContainer< PropertyValueVector_t >(pRubyContext->GetPropertyValues());
6171 pCharContext->InsertProps(pContext->getProperties());
6174 if ( aInfo.
nRubyAlign == NS_ooxml::LN_Value_ST_RubyAlign_rightVertical )
6189 (
"com.sun.star.text.FieldMaster.SetExpression",
6193 uno::Any(text::SetVariableType::SEQUENCE));
6196 xFieldProperties->setPropertyValue(
6201 ( xFieldInterface, uno::UNO_QUERY_THROW );
6202 xDependentField->attachTextFieldMaster( xMaster );
6206 (std::u16string_view,
6211 xFieldProperties->setPropertyValue
6218 xFieldProperties->setPropertyValue(
6227 OUString
const& rFirstParam,
6232 if (rFirstParam.isEmpty())
6237 struct DocPropertyMap
6239 const char* pDocPropertyName;
6240 const char* pServiceName;
6243 static const DocPropertyMap aDocProperties[] =
6245 {
"CreateTime",
"DocInfo.CreateDateTime", SET_DATE},
6246 {
"Characters",
"CharacterCount", SET_ARABIC},
6247 {
"Comments",
"DocInfo.Description", 0},
6248 {
"Keywords",
"DocInfo.KeyWords", 0},
6249 {
"LastPrinted",
"DocInfo.PrintDateTime", 0},
6250 {
"LastSavedBy",
"DocInfo.ChangeAuthor", 0},
6251 {
"LastSavedTime",
"DocInfo.ChangeDateTime", SET_DATE},
6252 {
"Paragraphs",
"ParagraphCount", SET_ARABIC},
6253 {
"RevisionNumber",
"DocInfo.Revision", 0},
6254 {
"Subject",
"DocInfo.Subject", 0},
6255 {
"Template",
"TemplateName", 0},
6256 {
"Title",
"DocInfo.Title", 0},
6257 {
"TotalEditingTime",
"DocInfo.EditTime", 0},
6258 {
"Words",
"WordCount", SET_ARABIC}
6271 OUString sFieldServiceName;
6273 if (!xPropertySetInfo->hasPropertyByName(rFirstParam))
6277 if (rFirstParam.equalsAscii(aDocProperties[nMap].pDocPropertyName))
6279 sFieldServiceName = OUString::createFromAscii(aDocProperties[nMap].pServiceName);
6285 pContext->CacheVariableValue(xUserDefinedProps->getPropertyValue(rFirstParam));
6288 bool bIsCustomField =
false;
6289 if(sFieldServiceName.isEmpty())
6293 bIsCustomField =
true;
6302 if( bIsCustomField )
6304 xFieldProperties->setPropertyValue(
6306 pContext->SetCustomField( xFieldProperties );
6310 if(0 != (aDocProperties[nMap].nFlags & SET_ARABIC))
6311 xFieldProperties->setPropertyValue(
6313 uno::Any( style::NumberingType::ARABIC ));
6314 else if(0 != (aDocProperties[nMap].nFlags & SET_DATE))
6316 xFieldProperties->setPropertyValue(
6329 std::vector<css::beans::PropertyValues> aNewLevel;
6330 aNewLevel.reserve(aLevel.getLength() + 5);
6332 static constexpr OUStringLiteral tokType(
u"TokenType");
6333 static constexpr OUStringLiteral tokHStart(
u"TokenHyperlinkStart");
6334 static constexpr OUStringLiteral tokHEnd(
u"TokenHyperlinkEnd");
6335 static constexpr OUStringLiteral tokPNum(
u"TokenPageNumber");
6336 static constexpr OUStringLiteral tokENum(
u"TokenEntryNumber");
6341 for (
const auto& item : aLevel)
6344 if (
auto it = std::find_if(item.begin(), item.end(),
6345 [](
const auto&
p) { return p.Name == tokType; });
6347 it->Value >>= tokenType;
6349 if (bHyperlinks && (tokenType == tokHStart || tokenType == tokHEnd))
6352 if (!sChapterNoSeparator.isEmpty() && tokenType == tokPNum)
6355 aNewLevel.push_back(
6362 aNewLevel.push_back(item);
6364 if (numtab && tokenType == tokENum)
6367 aNewLevel.push_back(
6386 if(!xTextAppend.is())
6397 xCursor->gotoStartOfParagraph(
false );
6401 xCursor->gotoEnd(
true );
6404 OUString sResult = xCursor->getString();
6410 catch(
const uno::Exception&)
6417css::uno::Reference<css::beans::XPropertySet>
6431 const auto xTextRange = xTextAppend->getEnd();
6439 = xTextRange->getText()->createTextCursor();
6440 assert(xTOCTextCursor.is());
6441 xTOCTextCursor->gotoEnd(
false);
6444 catch (
const uno::Exception&)
6447 "DomainMapper_Impl::StartIndexSectionChecked:");
6462static auto FilterChars(std::u16string_view
const& rStyleName) -> OUString
6469 OUStringBuffer
result(s.size());
6470 for (
size_t i = 0;
i < s.size(); ++
i)
6477 if (
i < s.size() - 1)
6484 return result.makeStringAndClear();
6489 assert(!rTOCStyleName.isEmpty());
6492 return pStyle->m_sStyleName;
6498 SAL_INFO(
"writerfilter.dmapper",
"cloning TOC paragraph style (presumed built-in) " << rTOCStyleName <<
" from " << pStyle->m_sStyleName);
6509 const OUString & sTOCServiceName)
6514 bool bTableOfFigures =
false;
6515 bool bHyperlinks =
false;
6516 bool bFromOutline =
false;
6517 bool bFromEntries =
false;
6518 bool bHideTabLeaderPageNumbers = false ;
6519 bool bIsTabEntry = false ;
6520 bool bNewLine = false ;
6521 bool bParagraphOutlineLevel =
false;
6523 sal_Int16 nMaxLevel = 10;
6525 OUString sChapterNoSeparator;
6526 OUString sFigureSequence;
6527 OUString aBookmarkName;
6532 bTableOfFigures =
true;
6537 aBookmarkName = sValue.trim().replaceAll(
"\"",
"");
6543 bTableOfFigures =
true;
6544 sFigureSequence = sValue.trim();
6545 sFigureSequence = sFigureSequence.replaceAll(
"\"",
"").replaceAll(
"'",
"");
6557 bFromEntries =
true;
6578 bFromOutline =
true;
6579 if (sValue.isEmpty())
6593 OUString sToken = sValue.getToken(1,
'"');
6594 sTemplate = sToken.isEmpty() ? sValue : sToken;
6599 bFromOutline =
true;
6600 bParagraphOutlineLevel =
true;
6606 bIsTabEntry = true ;
6616 bHideTabLeaderPageNumbers = true ;
6620 if( !bFromOutline && !bFromEntries && sTemplate.isEmpty() )
6621 bFromOutline =
true;
6630 if (aTocTitle.isEmpty() || bTableOfFigures)
6640 const auto xTextCursor = xTextAppend->getText()->createTextCursor();
6642 xTextCursor->gotoEnd(
false);
6648 css::uno::Reference<css::text::XTextRange> xTextRangeEndOfTocHeader =
GetTopTextAppend()->getEnd();
6662 pContext->SetTOC(xTOC);
6670 if (!aBookmarkName.isEmpty())
6672 if (!bTableOfFigures)
6681 if( !sTemplate.isEmpty() )
6687 sal_Int32 nPosition = 0;
6688 auto const tsep(sTemplate.indexOf(
',') != -1 ?
',' :
';');
6689 while( nPosition >= 0)
6691 OUString sStyleName = sTemplate.getToken(0, tsep, nPosition);
6693 while( sStyleName.isEmpty() && nPosition > 0 )
6694 sStyleName = sTemplate.getToken(0, tsep, nPosition);
6698 if( !sStyleName.isEmpty() )
6699 aMap.emplace(nLevel, sStyleName);
6703 for( nLevel = 1; nLevel < 10; ++nLevel)
6705 sal_Int32 nLevelCount =
aMap.count( nLevel );
6708 TOCStyleMap::iterator aTOCStyleIter =
aMap.find( nLevel );
6711 for (
auto& rStyle : asNonConstRange(aStyles) )
6717 xParaStyles->replaceByIndex(nLevel - 1,
uno::Any(aStyles));
6725 if (
auto xSupplier =
GetTextDocument().query<text::XChapterNumberingSupplier>())
6726 xChapterNumberingRules = xSupplier->getChapterNumberingRules();
6728 if (
auto xStylesSupplier =
GetTextDocument().query<style::XStyleFamiliesSupplier>())
6730 auto xStyleFamilies = xStylesSupplier->getStyleFamilies();
6736 sal_Int32 nLevelCount = xLevelFormats->getCount();
6738 for( sal_Int32 nLevel = 1; nLevel < nLevelCount; ++nLevel)
6741 xLevelFormats->getByIndex( nLevel ) >>= aLevel;
6744 std::optional<style::TabStop> numTab;
6745 if (xChapterNumberingRules && xStyles)
6750 xChapterNumberingRules->getByIndex(nLevel - 1) >>=
props;
6751 bool bHasNumbering =
false;
6752 bool bUseTabStop =
false;
6753 for (
const auto& propval :
props)
6757 if (propval.Name ==
"NumberingType")
6758 bHasNumbering = propval.Value != style::NumberingType::NUMBER_NONE;
6759 else if (propval.Name ==
"LabelFollowedBy")
6760 bUseTabStop = propval.Value == text::LabelFollow::LISTTAB;
6763 if (bHasNumbering && bUseTabStop)
6766 xTOC->getPropertyValue(
"ParaStyleLevel" + OUString::number(nLevel)) >>= style;
6768 if (xStyles->getByName(style) >>= xStyle)
6773 if (xPropState->getPropertyState(
"ParaTabStops")
6774 == beans::PropertyState_DIRECT_VALUE)
6777 xStyle->getPropertyValue(
"ParaTabStops") >>= tabStops)
6781 if (tabStops.getLength() > 1)
6782 numTab = tabStops[0];
6799 bHyperlinks, sChapterNoSeparator,
6801 xLevelFormats->replaceByIndex( nLevel,
uno::Any( aNewLevel ) );
6806 if (!sFigureSequence.isEmpty())
6810 if (!sTemplate.isEmpty())
6813 xTOC->setPropertyValue(
"CreateFromParagraphStyle",
uno::Any(sConvertedStyleName));
6821 xLevelFormats->getByIndex( 1 ) >>= aLevel;
6824 bHyperlinks, sChapterNoSeparator,
6826 xLevelFormats->replaceByIndex( 1,
uno::Any( aNewLevel ) );
6834 const OUString & sObjectType,
6846 if(xTextAppend.is())
6851 xTextAppend->createTextCursorByRange( xStart ), uno::UNO_QUERY_THROW);
6853 xCursor->gotoStartOfParagraph(
false );
6854 xCursor->gotoRange( xEnd,
true );
6857 xCursor->goLeft(1,
true);
6863 catch(
const uno::Exception&)
6866 xRet.set(xSection, uno::UNO_QUERY );
6868 catch(
const uno::Exception&)
6878 const OUString & sTOCServiceName)
6883 SAL_WARN(
"writerfilter.dmapper",
"no text append stack");
6895 pContext->SetTOC( xTOC );
6904 const OUString & sTOCServiceName)
6908 OUString sUserIndex;
6916 :
"com.sun.star.text.UserIndex");
6927 xTOC->setPropertyValue(
"IsCommaSeparated",
uno::Any(
true));
6931 xTOC->setPropertyValue(
"UseAlphabeticalSeparators",
uno::Any(
true));
6933 if( !sUserIndex.isEmpty() )
6935 xTOC->setPropertyValue(
"UserIndexName",
uno::Any(sUserIndex));
6938 pContext->SetTOC( xTOC );
6946 sValue = sValue.replaceAll(
"\"",
"");
6952 if (xTextColumns.is())
6954 xTextColumns->setColumnCount( sValue.toInt32() );
6963 std::optional<FieldId>
const oFieldId) ->
void
6968 xTextAppend->createTextCursorByRange(xStartRange);
6969 if (rTextAppendStack.top().xInsertPosition.is())
6972 rTextAppendStack.top().xTextAppend,
6974 if (xCompare->compareRegionStarts(xStartRange, rTextAppendStack.top().xInsertPosition) < 0)
6976 SAL_WARN(
"writerfilter.dmapper",
"invalid field mark positions");
6979 xCursor->gotoRange(rTextAppendStack.top().xInsertPosition,
true);
6983 xCursor->gotoEnd(
true);
6985 xTextAppend->insertTextContent(xCursor, xTextContent,
true);
6996 xCursor->gotoRange(xTextContent->getAnchor()->getEnd(),
false);
6997 xCursor->goLeft(1,
false);
6998 xTextAppend->insertControlCharacter(xCursor, text::ControlCharacter::PARAGRAPH_BREAK,
false);
6999 xCursor->goLeft(1,
false);
7005 std::optional<FieldId>
const oFieldId) ->
void
7012 xCursor->gotoRange(rTextAppendStack.top().xInsertPosition,
false);
7013 xCursor->goRight(1,
true);
7014 xCursor->setString(OUString());
7017 rTextAppendStack.pop();
7031 OSL_ENSURE( pContext,
"no field context available");
7040 if (!pContext->GetCommandIsEmpty(
false))
7041 pContext->SetCommandType(
false);
7051 OUString
const sFirstParam(vArguments.empty() ? OUString() : vArguments.front());
7057 if (xTextAppend.is())
7062 xCrsr->gotoEnd(
false);
7076 FieldConversionMap_t::const_iterator
const aIt = aFieldConversionMap.find(
sType);
7077 if (aIt != aFieldConversionMap.end()
7084 pContext->SetFieldId(aIt->second.eFieldId);
7085 bool bCreateEnhancedField =
false;
7087 bool bCreateField =
true;
7088 switch (aIt->second.eFieldId)
7102 bCreateField =
false;
7112 bCreateField =
false;
7113 bCreateEnhancedField =
true;
7118 bCreateField =
false;
7130 bCreateField =
false;
7138 bCreateField =
false;
7141 if( bCreateField || bCreateEnhancedField )
7145 if ( bCreateEnhancedField )
7148 FieldConversionMap_t::const_iterator aEnhancedIt =
7149 aEnhancedFieldConversionMap.find(
sType);
7150 if ( aEnhancedIt != aEnhancedFieldConversionMap.end())
7151 sServiceName += OUString::createFromAscii(aEnhancedIt->second.cFieldServiceName );
7155 sServiceName +=
"TextField." + OUString::createFromAscii(aIt->second.cFieldServiceName );
7167 xFieldProperties.set( xFieldInterface, uno::UNO_QUERY_THROW);
7170 switch( aIt->second.eFieldId )
7187 aIt->second.eFieldId);
7190 if (xFieldProperties.is())
7193 if (pContext->IsFieldLocked())
7195 xFieldProperties->setPropertyValue(
7201 xFieldProperties->setPropertyValue(
7205 xFieldProperties->setPropertyValue(
7222 xFieldProperties->setPropertyValue(
7231 if (pContext->IsFieldLocked())
7233 xFieldProperties->setPropertyValue(
7236 xFieldProperties->setPropertyValue(
7251 "com.sun.star.text.FieldMaster.User", sFirstParam);
7253 xFieldInterface, uno::UNO_QUERY_THROW);
7254 xDependentField->attachTextFieldMaster(xMaster);
7264 OUString
aCommand = pContext->GetCommand().trim();
7269 xFieldInterface =
m_xTextFactory->createInstance(
"com.sun.star.text.TextField." + aResult.
sType);
7272 uno::UNO_QUERY_THROW);
7278 sal_Int32 nSpaceIndex =
aCommand.indexOf(
' ');
7287 sal_Int32 nStartIndex =
aCommand.indexOf(
'(');
7288 sal_Int32 nEndIndex =
aCommand.indexOf(
')');
7289 if (nStartIndex > 0 && nEndIndex > 0)
7293 OUString aContent =
aCommand.copy(nStartIndex + 1, nEndIndex - nStartIndex - 1);
7304 else if (
aCommand.startsWith(
"\\* jc"))
7312 if (xFieldProperties.is())
7313 xFieldProperties->setPropertyValue(
7318 sal_Int32 nNumberingTypeIndex = pContext->GetCommand().indexOf(
"\\p");
7319 if (xFieldProperties.is())
7320 xFieldProperties->setPropertyValue(
7322 uno::Any( nNumberingTypeIndex > 0 ? text::FilenameDisplayFormat::FULL : text::FilenameDisplayFormat::NAME_AND_EXT ));
7336 if (bCreateEnhancedField)
7339 pFFDataHandler(pContext->getFFDataHandler());
7345 pContext->setFormControlHelper(pFormControlHelper);
7350 if ( pFFDataHandler && !pFFDataHandler->getName().isEmpty() )
7351 xNamed->setName( pFFDataHandler->getName() );
7352 pContext->SetFormField( xFormField );
7355 xFormField, pContext->GetStartRange(),
7356 pContext->GetFieldId());
7370 ::std::vector<OUString> aParts = pContext->GetCommandParts();
7377 if (!aParts.empty() && aParts[0] ==
"HYPERLINK")
7378 aParts.erase(aParts.begin());
7380 ::std::vector<OUString>::const_iterator aItEnd = aParts.end();
7381 ::std::vector<OUString>::const_iterator aPartIt = aParts.begin();
7386 while (aPartIt != aItEnd)
7388 if ( *aPartIt ==
"\\l" )
7392 if (aPartIt == aItEnd)
7395 sURL +=
"#" + *aPartIt;
7397 else if (*aPartIt ==
"\\m" || *aPartIt ==
"\\n" || *aPartIt ==
"\\h")
7400 else if ( *aPartIt ==
"\\o" || *aPartIt ==
"\\t" )
7404 if (aPartIt == aItEnd)
7417 if (!sURL.isEmpty())
7419 if (sURL.startsWith(
"file:///"))
7423 sURL = sURL.replaceAll(
"\\\\",
"/");
7427 sURL = sURL.replace(
'\\',
'/');
7432 else if (!sURL.startsWith(
"#")) {
7434 sURL = rtl::Uri::convertRelToAbs(
7436 }
catch (rtl::MalformedUriException & e) {
7438 "writerfilter.dmapper",
7439 "MalformedUriException "
7443 pContext->SetHyperlinkURL(sURL);
7446 if (!sTarget.isEmpty())
7447 pContext->SetHyperlinkTarget(sTarget);
7452 if (vArguments.size() < 3)
7454 SAL_WARN(
"writerfilter.dmapper",
"IF field requires at least 3 parameters!");
7458 if (xFieldProperties.is())
7462 OUString sCondition;
7464 while (
i < vArguments.size() - 2) {
7465 if (!sCondition.isEmpty())
7467 sCondition += vArguments[
i++];
7470 xFieldProperties->setPropertyValue(
7471 "TrueContent",
uno::Any(vArguments[vArguments.size() - 2]));
7472 xFieldProperties->setPropertyValue(
7473 "FalseContent",
uno::Any(vArguments[vArguments.size() - 1]));
7474 xFieldProperties->setPropertyValue(
7475 "Condition",
uno::Any(sCondition));
7483 if (!sFirstParam.isEmpty())
7485 xFieldProperties->setPropertyValue(
7492 xFieldProperties->setPropertyValue(
7497 if (xFieldProperties.is())
7499 sal_Int32
nIndex =
sizeof(
" MACROBUTTON ");
7500 OUString sCommand = pContext->GetCommand();
7503 if (sCommand.getLength() >=
nIndex)
7505 OUString sMacro = sCommand.getToken(0,
' ',
nIndex);
7506 xFieldProperties->setPropertyValue(
7511 if (sCommand.getLength() >
nIndex + 1)
7513 xFieldProperties->setPropertyValue(
7531 xDependentField->attachTextFieldMaster( xMaster );
7539 if (xFieldProperties.is())
7541 xFieldProperties->setPropertyValue(
7544 xFieldProperties->setPropertyValue(
7546 uno::Any( text::PageNumberType_CURRENT ));
7552 if (xFieldProperties.is() && !
IsInTOC())
7560 if (!xFieldMasterAccess->hasByName(
7561 "com.sun.star.text.FieldMaster.SetExpression."
7564 xFieldProperties->setPropertyValue(
7566 uno::Any( sal_Int16(text::ReferenceFieldSource::BOOKMARK)) );
7567 xFieldProperties->setPropertyValue(
7570 sal_Int16 nFieldPart = (bPageRef ? text::ReferenceFieldPart::PAGE : text::ReferenceFieldPart::TEXT);
7575 nFieldPart = text::ReferenceFieldPart::UP_DOWN;
7580 nFieldPart = text::ReferenceFieldPart::NUMBER;
7585 nFieldPart = text::ReferenceFieldPart::NUMBER_NO_CONTEXT;
7590 nFieldPart = text::ReferenceFieldPart::NUMBER_FULL_CONTEXT;
7592 xFieldProperties->setPropertyValue(
7597 xFieldInterface =
m_xTextFactory->createInstance(
"com.sun.star.text.TextField.GetExpression");
7598 xFieldProperties.set(xFieldInterface, uno::UNO_QUERY);
7599 xFieldProperties->setPropertyValue(
7612 OUString sCmd(pContext->GetCommand());
7619 "com.sun.star.text.FieldMaster.SetExpression",
7620 OUString(sSeqName));
7622 xMaster->setPropertyValue(
7624 uno::Any(text::SetVariableType::SEQUENCE));
7627 xFieldProperties->setPropertyValue(
7633 xDependentField->attachTextFieldMaster( xMaster );
7635 OUString
sFormula = OUString::Concat(sSeqName) +
"+1";
7647 xFieldProperties->setPropertyValue(
7653 if (nNumberingType == style::NumberingType::PAGE_DESCRIPTOR)
7654 nNumberingType = style::NumberingType::ARABIC;
7655 xFieldProperties->setPropertyValue(
7667 if (!sFirstParam.isEmpty())
7669 xFieldProperties->setPropertyValue(
7678 OUString sSymbol(
sal_Unicode( sFirstParam.startsWithIgnoreAsciiCase(
"0x") ?
o3tl::toUInt32(sFirstParam.subView(2),16) : sFirstParam.toUInt32() ) );
7683 sFont = sFont.trim();
7684 if (sFont.startsWith(
"\""))
7685 sFont = sFont.copy(1);
7686 if (sFont.endsWith(
"\""))
7687 sFont = sFont.copy(0,sFont.getLength()-1);
7692 if (xTextAppend.is())
7698 xCrsr->gotoEnd(
false);
7699 xText->insertString(xCrsr, sSymbol,
true);
7717 if (pContext->IsFieldLocked())
7719 xFieldProperties->setPropertyValue(
7729 if (!sFirstParam.isEmpty())
7731 xFieldProperties->setPropertyValue(
7741 OUString::createFromAscii(aIt->second.cFieldServiceName));
7745 OUString::createFromAscii(aIt->second.cFieldServiceName));
7749 OUString::createFromAscii(aIt->second.cFieldServiceName));
7758 OUString sUserIndex;
7759 OUString sFieldServiceName =
7761 ?
"com.sun.star.text.UserIndexMark"
7762 : OUString::createFromAscii(aIt->second.cFieldServiceName);
7765 uno::UNO_QUERY_THROW);
7767 if (!sFirstParam.isEmpty())
7769 xTC->setPropertyValue(sUserIndex.isEmpty()
7770 ? OUString(
"PrimaryKey")
7771 : OUString(
"AlternativeText"),
7776 if (!sUserIndex.isEmpty())
7778 xTC->setPropertyValue(
"UserIndexName",
7783 if (xTextAppend.is())
7789 xCrsr->gotoEnd(
false);
7801 OUString::createFromAscii(aIt->second.cFieldServiceName));
7803 uno::UNO_QUERY_THROW);
7804 OUString sCmd(pContext->GetCommand());
7805 if( !sCmd.isEmpty()){
7809 xTC->setPropertyValue(
"Fields",
uno::Any(aValues));
7814 =
m_aFieldStack.back()->getProperties()->GetPropertyValues();
7827 OUString::createFromAscii(aIt->second.cFieldServiceName)),
7828 uno::UNO_QUERY_THROW);
7829 if (!sFirstParam.isEmpty())
7843 sal_Int32 nLevel = sValue.toInt32();
7844 if( !sValue.isEmpty() && nLevel >= 0 && nLevel <= 10 )
7852 pContext->SetTC( xTC );
7858 if (xFieldProperties.is())
7859 xFieldProperties->setPropertyValue(
7865 if (!bCreateEnhancedField)
7875 OUString aCode( pContext->GetCommand().trim() );
7879 xFieldInterface =
m_xTextFactory->createInstance(
"com.sun.star.text.Fieldmark");
7883 pContext->GetFieldId());
7886 pContext->SetFormField( xFormField );
7903 catch(
const uno::Exception& )
7907 pContext->SetCommandCompleted();
7917 OSL_ENSURE( pContext,
"no field context available");
7920 bRet = pContext->GetTextField().
is()
7944 SAL_WARN_IF(!pContext,
"writerfilter.dmapper",
"no field context");
7953 if (pOuter->IsCommandCompleted())
7956 pOuter->AppendResult(rString);
7962 pContext->AppendResult(rString);
7970 return d.GetUNODateTime();
7981 OSL_ENSURE( pContext,
"no field context available");
7989 std::vector<OUString> aParentParts = pParentContext->GetCommandParts();
7991 if (!aParentParts.empty() && aParentParts[0] ==
"IF")
8004 OSL_ENSURE( xTextField.is()
8007 ,
"DomainMapper_Impl::SetFieldResult: field not created" );
8016 xDependentField->getTextFieldMaster()->setPropertyValue(
8027 bool bIsSetbiblio = xServiceInfo->supportsService(
"com.sun.star.text.TextField.Bibliography");
8030 uno::Any aProperty = xFieldProperties->getPropertyValue(
"Fields");
8032 aProperty >>= aValues;
8033 beans::PropertyValue propertyVal;
8034 sal_Int32 nTitleFoundIndex = -1;
8035 for (sal_Int32
i = 0;
i < aValues.getLength(); ++
i)
8037 propertyVal = aValues[
i];
8038 if (propertyVal.Name ==
"Title")
8040 nTitleFoundIndex =
i;
8044 if (nTitleFoundIndex != -1)
8047 uno::Any aValue(propertyVal.Value);
8048 aValue >>= titleStr;
8049 titleStr += rResult;
8050 propertyVal.
Value <<= titleStr;
8051 aValues.getArray()[nTitleFoundIndex] = propertyVal;
8055 aValues.realloc(aValues.getLength() + 1);
8056 propertyVal.Name =
"Title";
8057 propertyVal.Value <<= rResult;
8058 aValues.getArray()[aValues.getLength() - 1] = propertyVal;
8060 xFieldProperties->setPropertyValue(
"Fields",
8069 xFormatter->attachNumberFormatsSupplier( xNumberSupplier );
8074 xFieldProperties->getPropertyValue(
"NumberFormat" ) >>= nKey;
8075 xFieldProperties->setPropertyValue(
8087 const bool bHasContent = xServiceInfo->supportsService(
"com.sun.star.text.TextField.SetExpression") ||
8088 xServiceInfo->supportsService(
"com.sun.star.text.TextField.Input");
8094 uno::Any aValue(xFieldProperties->getPropertyValue(
8098 xFieldProperties->setPropertyValue(
8107 OUString sVariable = pContext->GetVariableValue();
8108 if (rResult.getLength() != sVariable.getLength())
8110 sal_Int32 nLen = sVariable.indexOf(
'\x0');
8112 sVariable = sVariable.copy(0, nLen);
8114 bool bCustomFixedField = rResult != sVariable &&
8115 xServiceInfo->supportsService(
"com.sun.star.text.TextField.DocInfo.Custom");
8117 if (bCustomFixedField || xServiceInfo->supportsService(
8118 "com.sun.star.text.TextField.DocInfo.CreateDateTime"))
8121 xFieldProperties->setPropertyValue(
"IsFixed",
uno::Any(
true));
8125 catch(
const beans::UnknownPropertyException& )
8131 catch (
const uno::Exception&)
8148 pContext->setFFDataHandler(pFFDataHandler);
8169 OSL_ENSURE( pContext,
"no field context available");
8172 if( !pContext->IsCommandCompleted() )
8175 if (!pContext->GetResult().isEmpty())
8178 if(xFieldProperties.is())
8187 if(xTextAppend.is())
8192 if( xToInsert.is() )
8202 = xTextAppend->createTextCursorByRange(
8205 : xTextAppend->getEnd());
8206 xCursor->goLeft(1,
true);
8208 xCursor->setString(OUString());
8212 xTextAppend->finishParagraph(css::beans::PropertyValues());
8216 xTextAppend->finishParagraphInsert(css::beans::PropertyValues(),
8233 xToInsert.set(pContext->GetTC(), uno::UNO_QUERY);
8235 xToInsert = pContext->GetTextField();
8254 if (pFormControlHelper)
8264 if (pFormControlHelper->hasFFDataHandler())
8266 xToInsert.set(xFormField, uno::UNO_QUERY);
8267 if (xFormField.is() && xToInsert.is())
8270 pContext->GetFieldId());
8271 pFormControlHelper->processField(xFormField);
8275 pFormControlHelper->insertControl(xCrsr);
8281 pContext->GetFieldId());
8286 else if (!pContext->GetHyperlinkURL().isEmpty() && xCrsr.is())
8294 xCrsr->gotoEnd(
true);
8298 SvxUnoTextRangeBase* pDrawText =
dynamic_cast<SvxUnoTextRangeBase*
>(xCrsr.get());
8300 pDrawText->attachField( std::make_unique<SvxURLField>(pContext->GetHyperlinkURL(), xCrsr->getString(), SvxURLFormat::AppDefault) );
8305 Any(pContext->GetHyperlinkURL()));
8307 if (!pContext->GetHyperlinkTarget().isEmpty())
8308 xCrsrProperties->setPropertyValue(
"HyperLinkTarget",
uno::Any(pContext->GetHyperlinkTarget()));
8318 uno::Any aAny = xCrsrProperties->getPropertyValue(
"CharStyleName");
8320 if (css::uno::fromAny(aAny, &charStyle))
8322 if (charStyle.isEmpty())
8324 xCrsrProperties->setPropertyValue(
"VisitedCharStyleName",
uno::Any(OUString(
"Default Style")));
8325 xCrsrProperties->setPropertyValue(
"UnvisitedCharStyleName",
uno::Any(OUString(
"Default Style")));
8327 else if (charStyle.equalsIgnoreAsciiCase(
"Internet Link"))
8329 xCrsrProperties->setPropertyValue(
"CharStyleName",
uno::Any(OUString(
"Default Style")));
8333 xCrsrProperties->setPropertyValue(
"VisitedCharStyleName", aAny);
8334 xCrsrProperties->setPropertyValue(
"UnvisitedCharStyleName", aAny);
8352 catch(
const lang::IllegalArgumentException&)
8356 catch(
const uno::Exception&)
8365 std::vector<FieldParagraph> aParagraphsToFinish;
8368 aParagraphsToFinish = pContext->GetParagraphsToFinish();
8375 for (
const auto& rFinish : aParagraphsToFinish)
8391 if (pFFDataHandler && pFFDataHandler->getName() == rBookmarkName)
8428 BookmarkMap_t::iterator aBookmarkIter =
m_aBookmarkMap.find( rId );
8439 if( aBookmarkIter->second.m_bIsStartOfText && !bIsAfterDummyPara)
8441 xCursor = xText->createTextCursorByRange( xText->getStart() );
8445 xCursor = xText->createTextCursorByRange( aBookmarkIter->second.m_xTextRange );
8447 if (!aBookmarkIter->second.m_bIsStartOfText)
8449 xCursor->goRight( 1,
false );
8452 xCursor->gotoRange( xTextAppend->getEnd(),
true );
8459 xCursor->goLeft( 1,
false );
8461 xCursor->gotoRange(xStart,
true );
8464 SAL_WARN_IF(aBookmarkIter->second.m_sBookmarkName.isEmpty(),
"writerfilter.dmapper",
"anonymous bookmark");
8466 xBkmNamed->setName( aBookmarkIter->second.m_sBookmarkName );
8475 bool bIsStart =
true;
8477 if (xTextAppend.is())
8480 xTextAppend->createTextCursorByRange(
8483 : xTextAppend->getEnd() );
8488 if (!bIsAfterDummyPara)
8489 bIsStart = !xCursor->goLeft(1,
false);
8490 xCurrent = xCursor->getStart();
8497 catch(
const uno::Exception& )
8505 static constexpr OUStringLiteral MoveFrom_Bookmark_NamePrefix =
u"__RefMoveFrom__";
8506 static constexpr OUStringLiteral MoveTo_Bookmark_NamePrefix =
u"__RefMoveTo__";
8517 aPremIter->second.m_Ed = user;
8526 aPremIter->second.m_EdGrp =
group;
8551 PermMap_t::iterator aPermIter =
m_aPermMap.find(permissinId);
8559 bool bIsStart =
true;
8561 if (xTextAppend.is())
8565 if (!bIsAfterDummyPara)
8566 bIsStart = !xCursor->goLeft(1,
false);
8567 xCurrent = xCursor->getStart();
8584 if (aPermIter->second.m_bIsStartOfText && !bIsAfterDummyPara)
8586 xCursor = xText->createTextCursorByRange(xText->getStart());
8590 xCursor = xText->createTextCursorByRange(aPermIter->second.m_xTextRange);
8592 if (!aPermIter->second.m_bIsStartOfText)
8594 xCursor->goRight(1,
false);
8597 xCursor->gotoRange(xTextAppend->getEnd(),
true);
8602 xCursor->goLeft(1,
false);
8608 xPermNamed->setName(aPermIter->second.createBookmarkName());
8611 const bool bAbsorb = !xCursor->isCollapsed();
8613 xTextAppend->insertTextContent(xCurrent, xPerm, bAbsorb);
8625 catch (
const uno::Exception&)
8633 const sal_Int32 nAnnotationId)
8641 if (xTextAppend.is())
8645 xCursor = xTextAppend->createTextCursorByRange(xTextAppend->getEnd());
8649 xCurrent = xCursor->getStart();
8656 aAnnotationPosition.
m_xStart = xCurrent;
8660 aAnnotationPosition.
m_xEnd = xCurrent;
8697 bool bHasGrabBag =
false;
8699 if (xPropertySet.is())
8702 bHasGrabBag = xPropertySetInfo->hasPropertyByName(
"FrameInteropGrabBag");
8707 aFrameGrabBag[
"SdtPr"] <<=
m_pSdtHelper->getInteropGrabBagAndClear();
8719 if(xPropertySet.is() && bHasGrabBag)
8724 xPropertySet->setPropertyValue(
"FrameInteropGrabBag",
uno::Any(aFrameGrabBag));
8740 xEmbeddedProps->setPropertyValue(
"AnchorType",
uno::Any(text::TextContentAnchorType_AT_CHARACTER));
8743 xEmbeddedProps->setPropertyValue(
"HoriOrient", xShapeProps->getPropertyValue(
"HoriOrient"));
8744 xEmbeddedProps->setPropertyValue(
"HoriOrientPosition", xShapeProps->getPropertyValue(
"HoriOrientPosition"));
8745 xEmbeddedProps->setPropertyValue(
"HoriOrientRelation", xShapeProps->getPropertyValue(
"HoriOrientRelation"));
8746 xEmbeddedProps->setPropertyValue(
"VertOrient", xShapeProps->getPropertyValue(
"VertOrient"));
8747 xEmbeddedProps->setPropertyValue(
"VertOrientPosition", xShapeProps->getPropertyValue(
"VertOrientPosition"));
8748 xEmbeddedProps->setPropertyValue(
"VertOrientRelation", xShapeProps->getPropertyValue(
"VertOrientRelation"));
8750 xEmbeddedProps->setPropertyValue(
"TextWrap", xShapeProps->getPropertyValue(
"TextWrap"));
8753 xEmbeddedProps->setPropertyValue(
"ZOrder", xShapeProps->getPropertyValue(
"ZOrder"));
8757 OSL_ENSURE( xTextContent.is(),
"DomainMapper_Impl::ImportGraphic");
8758 if( xTextContent.is())
8760 bool bAppend =
true;
8765 if(xTextAppend.is())
8771 xCrsr->gotoEnd(
false);
8776 xCrsr->gotoEnd(
false);
8782 catch(
const uno::Exception& )
8848 catch(
const uno::Exception& )
8896 std::vector<beans::PropertyValue>&& rFrameProperties
8901 "frame properties not removed");
8912 std::vector<sal_Int32> redPos, redLen;
8928 catch(
const uno::Exception&)
8940 if ( redPos[
i/3] != -1 )
8957 pNew->m_nToken = XML_mod;
8966 if( sprmId == NS_ooxml::LN_EG_RPrContent_rPrChange )
8968 else if( sprmId == NS_ooxml::LN_CT_PPr_pPrChange )
8970 else if( sprmId != NS_ooxml::LN_CT_ParaRPr_rPrChange )
8999 SAL_INFO(
"writerfilter.dmapper",
"numberingChange not implemented");
9018 SAL_INFO(
"writerfilter.dmapper",
"numberingChange not implemented");
9035 SAL_INFO(
"writerfilter.dmapper",
"no current redline");
9060 SAL_WARN(
"writerfilter.dmapper",
"RemoveTopRedline called with empty stack");
9061 throw uno::Exception(
"RemoveTopRedline failed",
nullptr);
9081 style::LineSpacing aSpacing;
9082 aSpacing.Mode = style::LineSpacingMode::PROP;
9083 aSpacing.Height = sal_Int16(115);
9089 std::vector<beans::PropertyValue> aViewProps;
9092 aViewProps.emplace_back(
"ZoomFactor", -1,
uno::Any(
m_pSettingsTable->GetZoomFactor()), beans::PropertyState_DIRECT_VALUE);
9093 aViewProps.emplace_back(
"VisibleBottom", -1,
uno::Any(sal_Int32(0)), beans::PropertyState_DIRECT_VALUE);
9094 aViewProps.emplace_back(
"ZoomType", -1,
9096 beans::PropertyState_DIRECT_VALUE);
9101 xViewDataSupplier->setViewData(xBox);
9107 xSettings->setPropertyValue(
"DoNotJustifyLinesWithManualBreak",
uno::Any(
true) );
9109 xSettings->setPropertyValue(
"PrinterIndependentLayout",
uno::Any(document::PrinterIndependentLayout::DISABLED));
9114 xSettings->setPropertyValue(
"AddParaTableSpacing",
uno::Any(
m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing()));
9120 xSettings->setPropertyValue(
"ProtectForm",
uno::Any(
true ));
9122 xSettings->setPropertyValue(
"LoadReadonly",
uno::Any(
true ));
9125 xSettings->setPropertyValue(
"GutterAtTop",
uno::Any(
true));
9129 if (aWriteProtection.hasElements())
9130 xSettings->setPropertyValue(
"ModifyPasswordInfo",
uno::Any(aWriteProtection));
9132 catch(
const uno::Exception&)
9147 return pSectionContext;
9173 if (nNumberingLevel < 0)
9174 nNumberingLevel = 0;
9178 const OUString aListName = pList->GetStyleName();
9182 xStyleFamilies->getByName(
"NumberingStyles") >>= xNumberingStyles;
9185 if (xNumberingRules.is())
9188 xNumberingRules->getByIndex(nNumberingLevel) >>= aProps;
9189 auto pProp = std::find_if(std::cbegin(aProps), std::cend(aProps),
9190 [&aProp](
const beans::PropertyValue& rProp) {
return rProp.Name == aProp; });
9191 if (pProp != std::cend(aProps))
9192 pProp->Value >>= nRet;
9195 catch(
const uno::Exception& )
9210 xNumberingRules.set(pProp->second, uno::UNO_QUERY);
9213 sal_Int32 nNumberingLevel = 0;
9215 pProp->second >>= nNumberingLevel;
9216 if (xNumberingRules.is())
9219 xNumberingRules->getByIndex(nNumberingLevel) >>= aProps;
9220 auto pPropVal = std::find_if(std::cbegin(aProps), std::cend(aProps),
9221 [&aProp](
const beans::PropertyValue& rProp) {
return rProp.Name == aProp; });
9222 if (pPropVal != std::cend(aProps))
9223 pPropVal->Value >>= nRet;
9251 beans::PropertyValue aProperty;
9252 aProperty.Name = aKey;
9253 aProperty.Value <<= aValue;
9254 rInteropGrabBag.push_back(aProperty);
9261 beans::PropertyValue aProperty;
9262 aProperty.Name = aKey;
9265 rInteropGrabBag.push_back(aProperty);
9298 case NS_ooxml::LN_headerl:
9301 case NS_ooxml::LN_headerr:
9304 case NS_ooxml::LN_headerf:
9307 case NS_ooxml::LN_footerl:
9310 case NS_ooxml::LN_footerr:
9313 case NS_ooxml::LN_footerf:
9316 case NS_ooxml::LN_footnote:
9317 case NS_ooxml::LN_endnote:
9320 case NS_ooxml::LN_annotation :
9329 catch (xml::sax::SAXException
const&)
9337 case NS_ooxml::LN_headerl:
9338 case NS_ooxml::LN_headerr:
9339 case NS_ooxml::LN_headerf:
9340 case NS_ooxml::LN_footerl:
9341 case NS_ooxml::LN_footerr:
9342 case NS_ooxml::LN_footerf:
9345 case NS_ooxml::LN_footnote:
9346 case NS_ooxml::LN_endnote:
9349 case NS_ooxml::LN_annotation :
9360 case NS_ooxml::LN_footnote:
9361 case NS_ooxml::LN_endnote:
9389 bool bConnectBorders =
true;
9392 if (bConnectBorders)
9408 return pHandler->getFontNameForTheme(
id);
std::vector< css::beans::PropertyValue > PropertyValueVector_t
const char * cFieldServiceName
constexpr sal_Int8 header[]
PropertiesInfo aProperties
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
constexpr OUStringLiteral sServiceName
SvStream & WriteStream(SvStream &rStream)
css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const
const_iterator find(const Value &x) const
const_iterator end() const
std::pair< const_iterator, bool > insert(Value &&x)
css::uno::Any getProperty(sal_Int32 nPropId)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
Reference to a resource that generates events and sends them to a handler.
static TagLogger & getInstance()
void startElement(const std::string &name)
void chars(const std::string &chars)
void attribute(const std::string &name, const std::string &value)
void element(const std::string &name)
void unoPropertySet(const css::uno::Reference< css::beans::XPropertySet > &rPropSet)
virtual css::uno::Any getAny() const =0
Returns representation of the value as uno::Any.
Class to handle events generated by TableManager::resolveCurrentTable().
const TableParagraphVectorPtr & getCurrentParagraphs()
virtual void startLevel() override
Start a new table level.
virtual void cellProps(const TablePropertyMapPtr &pProps) override
Handle properties of the current cell.
virtual void endLevel() override
End a table level.
void setIsInShape(bool bIsInShape)
std::deque< sal_Int32 > m_aFootnoteIds
css::uno::Reference< css::text::XTextAppend > GetCurrentXText()
css::uno::Reference< css::container::XNameContainer > m_xCharacterStyles
void SetLineNumbering(sal_Int32 nLnnMod, sal_uInt32 nLnc, sal_Int32 ndxaLnn)
void AddDummyParaForTableInSection()
tools::SvRef< SdtHelper > m_pSdtHelper
sal_Int32 getCurrentNumberingProperty(const OUString &aProp)
Get a property of the current numbering style's current level.
void handleRubyEQField(const FieldContextPtr &pContext)
bool m_bParaAutoBefore
Current paragraph has automatic before spacing.
std::vector< css::beans::PropertyValue > m_aFrameProperties
RedlineParamsPtr m_pParaMarkerRedline
bool isSdtEndDeferred() const
css::uno::Reference< css::text::XTextDocument > m_xTextDocument
OUString m_sCurrentPermEdGrp
void SetCurrentRedlineToken(sal_Int32 nToken)
void SetNumberFormat(const OUString &rCommand, css::uno::Reference< css::beans::XPropertySet > const &xPropertySet, bool bDetectFormat=false)
bool m_bIsFirstParaInSection
std::vector< css::beans::PropertyValue > m_aInteropGrabBag
A toplevel dmapper grabbag, like 'pPr'.
bool IsBreakDeferredByAnchor()
void commentProps(const OUString &sId, const CommentProperties &rProps)
void SetPageMarginTwip(PageMarElement eElement, sal_Int32 nValue)
void SetDocumentSettingsProperty(const OUString &rPropName, const css::uno::Any &rValue)
OUString m_sCurrentParaStyleName
css::uno::Reference< css::lang::XMultiServiceFactory > m_xTextFactory
css::uno::Reference< css::drawing::XShape > PopPendingShape()
Get the first pending shape, if there are any.
void StartParaMarkerChange()
bool handlePreviousParagraphBorderInBetween() const
Check if previous paragraph has borders in between and do the border magic to it if so.
void ExecuteFrameConversion()
bool m_bIsSplitPara
If the document needs to split paragraph.
bool GetIsDummyParaAddedForTableInSection() const
void appendTextContent(const css::uno::Reference< css::text::XTextContent > &, const css::uno::Sequence< css::beans::PropertyValue > &)
bool isBreakDeferred(BreakType deferredBreakType)
bool m_bRedlineImageInPreviousRun
bool m_bSaveFirstParagraphInCell
void RegisterFrameConversion(css::uno::Reference< css::text::XTextRange > const &xFrameStartRange, css::uno::Reference< css::text::XTextRange > const &xFrameEndRange, std::vector< css::beans::PropertyValue > &&aFrameProperties)
void HandleLineBreak(const PropertyMapPtr &pPropertyMap)
Handles <w:br>.
void setPermissionRangeEdGrp(const OUString &group)
bool IsSdtEndBefore()
Check if "SdtEndBefore" property is set.
std::optional< sal_Int16 > PopFrameDirection()
void HandlePTab(sal_Int32 nAlignment)
Handles <w:ptab>.
void EndParaMarkerChange()
OUString GetListStyleName(sal_Int32 nListId)
ListsManager::Pointer const & GetListTable()
void InitTabStopFromStyle(const css::uno::Sequence< css::style::TabStop > &rInitTabStops)
std::stack< HeaderFooterContext > m_aHeaderFooterStack
bool m_bStartTOCHeaderFooter
std::queue< OUString > m_aPositivePercentages
ST_PositivePercentage values we received.
void adjustLastPara(sal_Int8 nAlign)
std::stack< std::vector< RedlineParamsPtr > > m_aRedlines
void PushFootOrEndnote(bool bIsFootnote)
void PushProperties(ContextType eId)
sal_Int32 GetFootnoteCount() const
bool m_bUsingEnhancedFields
bool m_bSdt
If the current paragraph is inside a structured document element.
bool m_bFirstParagraphInCell
Current paragraph in a table is first paragraph of a cell.
void SetIsLastParagraphInSection(bool bIsLast)
void SetIsFirstParagraphInShape(bool bIsFirst)
void SetParaSectpr(bool bParaSectpr)
std::unordered_map< sal_Int32, AnnotationPosition > m_aAnnotationPositions
OUString ConvertTOCStyleName(OUString const &)
void PopPageHeaderFooter()
void IncorporateTabStop(const DeletableTabStop &aTabStop)
void appendTableHandler()
bool IsInCustomFootnote() const
const std::stack< BookmarkInsertPosition > & GetSdtStarts() const
Gives access to the currently open run/inline SDTs.
FontTablePtr const & GetFontTable()
void PushTextBoxContent()
sal_Int16 GetListLevel(const StyleSheetEntryPtr &pEntry, const PropertyMapPtr &pParaContext=nullptr)
Return the paragraph's list level (from styles, unless pParacontext is provided).
bool GetIsFirstParagraphInShape() const
void CheckParaMarkerRedline(css::uno::Reference< css::text::XTextRange > const &xRange)
css::uno::Reference< css::text::XTextRange > m_xSdtEntryStart
void ValidateListLevel(const OUString &sStyleIdentifierD)
RedlineParamsPtr m_previousRedline
void SetCurrentRedlineInitials(const OUString &sInitials)
PropertyMapPtr GetTopContextOfType(ContextType eId)
void SetFieldResult(OUString const &rResult)
void handleFieldFormula(const FieldContextPtr &pContext, css::uno::Reference< css::beans::XPropertySet > const &xFieldProperties)
void enableInteropGrabBag(const OUString &aName)
Enable, disable and check status of grabbags.
writerfilter::ooxml::OOXMLDocument * getDocumentReference() const
enum writerfilter::dmapper::DomainMapper_Impl::HeaderFooterImportState m_eInHeaderFooterImport
OUString m_aInteropGrabBagName
Name of m_aInteropGrabBag.
unsigned int m_nStartGenericField
std::deque< FieldContextPtr > m_aFieldStack
bool HasTopAnchoredObjects() const
std::unordered_map< OUString, CommentProperties > m_aCommentProps
bool m_bSetUserFieldContent
bool IsFieldResultAsString()
void deferBreak(BreakType deferredBreakType)
css::uno::Reference< css::text::XText > m_xBodyText
bool m_bIsFirstParaInSectionAfterRedline
const css::uno::Reference< css::text::XTextDocument > & GetTextDocument() const
static void fillEmptyFrameProperties(std::vector< css::beans::PropertyValue > &rFrameProperties, bool bSetAnchorToChar)
bool IsDiscardHeaderFooter() const
std::stack< PropertyMapPtr > m_aPropertyStacks[NUMBER_OF_CONTEXTS]
bool m_bStartBibliography
void SetSdt(bool bSdt)
Setter method for m_bSdt.
sal_Int32 m_sCurrentPermId
bool IsInFootnote() const
std::stack< BookmarkInsertPosition > m_xSdtStarts
const css::uno::Reference< css::lang::XMultiServiceFactory > & GetTextFactory() const
bool m_bParaChanged
If the current paragraph has any runs.
void CreateRedline(css::uno::Reference< css::text::XTextRange > const &xRange, const RedlineParamsPtr &pRedline)
void HandleLineBreakClear(sal_Int32 nClear)
Handles <w:br w:clear="...">.
void appendGrabBag(std::vector< css::beans::PropertyValue > &rInteropGrabBag, const OUString &aKey, const OUString &aValue)
Append a property to a sub-grabbag if necessary (e.g. 'lineRule', 'auto')
OUString m_sCurrentPermEd
css::uno::Reference< css::beans::XPropertySet > m_xPreviousParagraph
void ConvertHeaderFooterToTextFrame(bool, bool)
sal_Int32 m_nTableDepth
This contains the raw table depth.
RedlineParamsPtr m_pParaMarkerRedlineMove
void CheckRedline(css::uno::Reference< css::text::XTextRange > const &xRange)
void SetIsDummyParaAddedForTableInSectionPage(bool bIsAdded)
OUString GetUnusedPageStyleName()
bool m_bCheckFootnoteStyle
void SetIsTextFrameInserted(bool bIsInserted)
Track if a textframe has been inserted into this section.
PropertyMapPtr m_pLastSectionContext
css::uno::Reference< css::text::XTextRange > m_xGlossaryEntryStart
DomainMapper & m_rDMapper
bool m_bSdtEndDeferred
If we want to set "sdt end" on the next character context.
o3tl::sorted_vector< sal_Int32 > m_aListOverrideApplied
bool m_bForceGenericFields
PropertyMapPtr m_pLastCharacterContext
std::stack< std::pair< TextAppendContext, bool > > m_aHeaderFooterTextAppendStack
void SetIsPreviousParagraphFramed(bool bIsFramed)
SectionPropertyMap * GetSectionContext()
std::deque< css::uno::Reference< css::drawing::XShape > > m_aPendingShapes
void handleFieldAsk(const FieldContextPtr &pContext, css::uno::Reference< css::uno::XInterface > &xFieldInterface, css::uno::Reference< css::beans::XPropertySet > const &xFieldProperties)
OUString m_sDefaultParaStyleName
void PushPageFooter(SectionPropertyMap::PageType eType)
void SetIsOutsideAParagraph(bool bval)
ListsManager::Pointer m_pListTable
PropertyMapPtr m_pFootnoteContext
css::uno::Any GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara, bool *bIsDocDefault=nullptr)
void PushListProperties(const PropertyMapPtr &pListProperties)
void disableInteropGrabBag()
void SetCurrentRedlineRevertProperties(const css::uno::Sequence< css::beans::PropertyValue > &aProperties)
void deferCharacterProperty(sal_Int32 id, const css::uno::Any &value)
Used for attributes/sprms which cannot be evaluated immediately (e.g.
std::vector< css::beans::PropertyValue > MakeFrameProperties(const ParagraphProperties &rProps)
css::uno::Reference< css::embed::XStorage > m_xDocumentStorage
SkipFootnoteSeparator m_eSkipFootnoteState
Skip paragraphs from the <w:separator/> footnote.
ContextType GetTopContextType() const
void SetMoveBookmark(bool IsFrom)
void AttachTextBoxContentToShape(css::uno::Reference< css::drawing::XShape > xShape)
bool m_bParaSdtEndDeferred
If we want to set "paragraph sdt end" on the next paragraph context.
void setSdtEndDeferred(bool bSdtEndDeferred)
css::uno::Sequence< css::style::TabStop > GetCurrentTabStopAndClear()
void setPermissionRangeEd(const OUString &user)
css::uno::Reference< css::beans::XPropertySet > StartIndexSectionChecked(const OUString &sServiceName)
static void handleAuthor(std::u16string_view rFirstParam, css::uno::Reference< css::beans::XPropertySet > const &xFieldProperties, FieldId eFieldId)
::std::vector< DeletableTabStop > m_aCurrentTabStops
void AppendFieldCommand(OUString const &rPartOfCommand)
std::vector< css::beans::PropertyValue > m_aSubInteropGrabBag
A sub-grabbag of m_aInteropGrabBag, like 'spacing'.
css::uno::Reference< css::container::XNameContainer > const & GetCharacterStyles()
bool IsInHeaderFooter() const
OUString m_sCurrentBkmkName
DomainMapper_Impl(DomainMapper &rDMapper, css::uno::Reference< css::uno::XComponentContext > xContext, css::uno::Reference< css::lang::XComponent > const &xModel, SourceDocumentType eDocumentType, utl::MediaDescriptor const &rMediaDesc)
DomainMapperTableManager & getTableManager()
void StartCustomFootnote(const PropertyMapPtr pContext)
SettingsTablePtr const & GetSettingsTable()
css::uno::Reference< css::beans::XPropertySet > FindOrCreateFieldMaster(const char *pFieldMasterService, const OUString &rFieldMasterName)
const PropertyMapPtr & GetTopContext() const
void PopFieldContext()
The end of field is reached (cFieldEnd appeared) - the command might still be open.
css::uno::Reference< css::beans::XPropertySet > appendTextSectionAfter(css::uno::Reference< css::text::XTextRange > const &xBefore)
void ApplySettingsTable()
bool m_bIsColumnBreakDeferred
void PushPendingShape(const css::uno::Reference< css::drawing::XShape > &xShape)
Add a pending shape: it's currently inserted into the document, but it should be removed before the i...
sal_Int32 m_nLineBreaksDeferred
void SetIsFirstParagraphInSectionAfterRedline(bool bIsFirstAfterRedline)
void SetIsFirstParagraphInSection(bool bIsFirst)
bool GetIsTextFrameInserted() const
bool GetIsFirstParagraphInSection(bool bAfterRedline=false) const
void SetCurrentRedlineId(sal_Int32 nId)
bool IsInFootOrEndnote() const
void RemoveLastParagraph()
void PushStyleProperties(const PropertyMapPtr &pStyleProperties)
void handleBibliography(const FieldContextPtr &pContext, const OUString &sTOCServiceName)
bool isParaSdtEndDeferred() const
css::uno::Reference< css::text::XText > const & GetBodyText()
void handleFieldSet(const FieldContextPtr &pContext, css::uno::Reference< css::uno::XInterface > const &xFieldInterface, css::uno::Reference< css::beans::XPropertySet > const &xFieldProperties)
bool m_bIsActualParagraphFramed
Handle redline text portions in a frame, footnotes and redlines: store their data,...
css::uno::Reference< css::text::XTextAppend > const & GetTopTextAppend()
sal_Int32 m_nTableCellDepth
Raw table cell depth.
bool m_bDiscardHeaderFooter
std::map< sal_Int32, css::uno::Any > m_deferredCharacterProperties
css::uno::Any GetPropertyFromParaStyleSheet(PropertyIds eId)
void AppendFieldResult(std::u16string_view rResult)
OUString m_sAnnotationImportedParaId
sal_Int32 m_nFirstFootnoteIndex
void SetCurrentRedlineAuthor(const OUString &sAuthor)
std::optional< sal_Int16 > m_oLineBreakClear
void StartParaMarkerMove()
GraphicImportPtr const & GetGraphicImport()
bool IsOOXMLImport() const
RedlineParamsPtr m_currentRedline
void CheckUnregisteredFrameConversion(bool bPreventOverlap=false)
void substream(Id rName, ::writerfilter::Reference< Stream >::Pointer_t const &ref)
bool IsAnyTableImport() const
std::vector< AnchoredObjectsInfo > m_aAnchoredObjectAnchors
Paragraphs with anchored objects in the current section.
void RemoveDummyParaForTableInSection()
bool m_bIsLastSectionGroup
void SetIsLastSectionGroup(bool bIsLast)
std::deque< css::uno::Any > m_aStoredRedlines[StoredRedlines::NONE]
BookmarkMap_t m_aBookmarkMap
void StartOrEndBookmark(const OUString &rId)
css::uno::Reference< css::text::XTextRange > m_xInsertTextRange
void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType)
css::uno::Reference< css::beans::XPropertySet > m_xDocumentSettings
css::uno::Reference< css::beans::XPropertySet > m_xAnnotationField
bool m_bTextFrameInserted
void PushShapeContext(const css::uno::Reference< css::drawing::XShape > &xShape)
bool isInteropGrabBagEnabled() const
std::pair< OUString, OUString > m_aAligns
ST_AlignH/V values we received.
std::pair< OUString, OUString > m_aPositionOffsets
ST_PositionOffset values we received.
std::unique_ptr< ThemeHandler > const & getThemeHandler()
PropertyMapPtr m_pTopContext
sal_Int32 GetCurrentRedlineToken() const
SettingsTablePtr m_pSettingsTable
bool m_bStartedTOC
If we got any text that is the pre-rendered result of the TOC field.
void handleToc(const FieldContextPtr &pContext, const OUString &sTOCServiceName)
void PushFieldContext()
A field context starts with a cFieldStart.
css::uno::Any GetPropertyFromCharStyleSheet(PropertyIds eId, const PropertyMapPtr &rContext)
void appendOLE(const OUString &rStreamName, const std::shared_ptr< OLEHandler > &pOleHandler)
void SetIsDummyParaAddedForTableInSection(bool bIsAdded)
void appendTextPortion(const OUString &rString, const PropertyMapPtr &pPropertyMap)
std::optional< int > m_xNextUnusedCharacterStyleNo
OUString GetCurrentParaStyleName()
css::uno::Reference< css::text::XTextCursor > m_xTOCMarkerCursor
bool m_bIsBreakDeferredByAnchor
void appendGlossaryEntry()
AutoText import: each entry is placed in the separate section.
css::uno::Any GetAnyProperty(PropertyIds eId, const PropertyMapPtr &rContext)
OUString GetUnusedCharacterStyleName()
OUString m_sCurrentBkmkId
void AddAnnotationPosition(const bool bStart, const sal_Int32 nAnnotationId)
void handleIndex(const FieldContextPtr &pContext, const OUString &sTOCServiceName)
StyleSheetTablePtr m_pStyleSheetTable
css::uno::Reference< css::text::XTextContent > m_xEmbedded
bool m_bIsFirstParaInShape
void AddNewRedline(sal_uInt32 sprmId)
std::vector< css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining
void clearDeferredBreaks()
bool m_bIsPageBreakDeferred
css::uno::Reference< css::container::XNameContainer > const & GetPageStyles()
bool CopyTemporaryNotes(css::uno::Reference< css::text::XFootnote > xNoteSrc, css::uno::Reference< css::text::XFootnote > xNoteDest)
sal_Int32 m_nAnnotationId
void startOrEndPermissionRange(sal_Int32 permissinId)
bool m_bAnnotationResolved
void handleAutoNum(const FieldContextPtr &pContext, css::uno::Reference< css::uno::XInterface > const &xFieldInterface, css::uno::Reference< css::beans::XPropertySet > const &xFieldProperties)
bool IsParaWithInlineObject() const
void SetFieldFFData(const FFDataHandler::Pointer_t &pFFDataHandler)
void processDeferredCharacterProperties(bool bCharContext=true)
Processes properties deferred using deferCharacterProperty().
void PopProperties(ContextType eId)
bool m_bHasFtn
If the current section has footnotes.
bool m_bParaSectpr
If the current paragraph contains section property definitions.
bool m_bParaWithInlineObject
Current paragraph had at least one inline object in it.
std::stack< TextAppendContext > m_aTextAppendStack
void UpdateEmbeddedShapeProps(const css::uno::Reference< css::drawing::XShape > &xShape)
SmartTagHandler m_aSmartTagHandler
css::uno::Reference< css::text::XTextRange > m_xFrameStartRange
void ResetGraphicImport()
bool hasTableManager() const
std::deque< sal_Int32 > m_aEndnoteIds
std::optional< int > m_xNextUnusedPageStyleNo
bool m_bDummyParaAddedForTableInSection
enum GraphicImportType m_eGraphicImportType
bool IsOpenFieldCommand() const
css::uno::Reference< css::text::XTextRange > m_xFrameEndRange
bool m_bIsDecimalComma
Type of decimal symbol associated to the document language in Writer locale definition.
FieldContextPtr const & GetTopFieldContext()
OUString m_sAnnotationParent
void finishParagraph(const PropertyMapPtr &pPropertyMap, const bool bRemove=false, const bool bNoNumbering=false)
bool m_bDummyParaAddedForTableInSectionPage
void PushPageHeader(SectionPropertyMap::PageType eType)
void SetCurrentRedlineIsRead()
OUString convertFieldFormula(const OUString &input)
Converts a Microsoft Word field formula into LibreOffice syntax.
OUString m_sCurrentBkmkPrefix
void appendTableManager()
StyleSheetTablePtr const & GetStyleSheetTable()
tools::SvRef< DomainMapperTableHandler > m_pTableHandler
OUString getFontNameForTheme(const Id id)
std::stack< ContextType > m_aContextStack
OUString extractTocTitle()
Returns title of the TOC placed in paragraph(s) before TOC field inside STD-frame.
std::queue< css::uno::Reference< css::text::XTextFrame > > m_xPendingTextBoxFrames
sal_Int32 getNumberingProperty(const sal_Int32 nListId, sal_Int32 nListLevel, const OUString &aProp)
void clearDeferredBreak(BreakType deferredBreakType)
css::uno::Reference< css::beans::XPropertySet > const & GetDocumentSettings()
sal_Int32 m_nLastTableCellParagraphDepth
Table cell depth of the last finished paragraph.
bool m_bInStyleSheetImport
bool GetIsPreviousParagraphFramed() const
void ImportGraphic(const writerfilter::Reference< Properties >::Pointer_t &)
bool m_bSaxError
SAXException was seen so document will be abandoned.
void RemoveTemporaryFootOrEndnotes()
void SetIsBreakDeferredByAnchor()
void SetIsFirstRun(bool bval)
sal_Int32 m_nFirstEndnoteIndex
bool m_bRemoveThisParagraph
This is a continuation of already finished paragraph - e.g., first in an index section.
sal_Int32 GetEndnoteCount() const
void handleDocProperty(const FieldContextPtr &pContext, OUString const &rFirstParam, css::uno::Reference< css::uno::XInterface > &xFieldInterface)
bool m_bIsLastParaInSection
bool m_bCheckFirstFootnoteTab
If the next tab should be ignored, used for footnotes.
void HandleAltChunk(const OUString &rStreamName)
Handles <w:altChunk>.
bool m_bIsParaMarkerChange
bool m_bParaHadField
Current paragraph had at least one field in it.
writerfilter::ooxml::OOXMLDocument * m_pOOXMLDocument
css::uno::Reference< css::container::XNameContainer > m_xPageStyles1
GraphicImportPtr m_pGraphicImport
void SetCurrentRedlineDate(const OUString &sDate)
OUString GetDefaultParaStyleName()
void SetBookmarkName(const OUString &rBookmarkName)
void setParaSdtEndDeferred(bool bParaSdtEndDeferred)
void ClearPreviousParagraph()
Forget about the previous paragraph, as it's not inside the same start/end node.
bool IsOutsideAParagraph() const
void appendStarMath(const Value &v)
void CloseFieldCommand()
The field command has to be closed (cFieldSep appeared).
std::stack< AnchoredContext > m_aAnchoredStack
css::uno::Reference< css::beans::XPropertySet > createSectionForRange(css::uno::Reference< css::text::XTextRange > xStart, css::uno::Reference< css::text::XTextRange > xEnd, const OUString &sObjectType, bool stepLeft)
css::uno::Reference< css::uno::XComponentContext > m_xComponentContext
GraphicZOrderHelper * graphicZOrderHelper()
OUString getOrCreateCharStyle(PropertyValueVector_t &rCharProperties, bool bAlwaysCreate)
void processDeferredCharacterProperties(const std::map< sal_Int32, css::uno::Any > &rDeferredCharacterProperties, bool bCharContext=true)
::std::vector< OUString > DropDownEntries_t
FieldContext(css::uno::Reference< css::text::XTextRange > xStart)
void AppendCommand(std::u16string_view rPart)
css::uno::Reference< css::text::XTextField > m_xTextField
PropertyMapPtr m_pProperties
(Character) properties of the field itself.
::std::vector< OUString > GetCommandParts() const
OUString m_sVariableValue
const OUString & GetCommand() const
void CacheVariableValue(const css::uno::Any &rAny)
void SetTextField(css::uno::Reference< css::text::XTextField > const &xTextField)
sal_Int32 findZOrder(sal_Int32 relativeHeight, bool bOldStyle=false)
void addItem(css::uno::Reference< css::beans::XPropertySet > const &props, sal_Int32 relativeHeight)
This class provides access to the defined numbering styles.
ParagraphProperties & props()
const OUString & GetParaStyleName() const
sal_Int32 GetListId() const
void ResetFrameProperties()
void SetListId(sal_Int32 nId)
const OUString & GetParaId() const
void SetParaStyleName(const OUString &rSet)
sal_Int32 GetDropCap() const
Helper to create form controls from w:sdt tokens.
const css::uno::Reference< css::text::XTextRange > & GetStartingRange() const
void ClearHeaderFooterLinkToPrevious(bool bHeader, PageType eType)
void addRelativeWidthShape(css::uno::Reference< css::drawing::XShape > xShape)
css::uno::Reference< css::beans::XPropertySet > GetPageStyle(DomainMapper_Impl &rDM_Impl, bool bFirst)
void SetStart(const css::uno::Reference< css::text::XTextRange > &xRange)
void handle(const css::uno::Reference< css::text::XTextRange > &xParagraph)
Set m_aAttributes as RDF statements on xParagraph.
sal_Int16 GetListLevel() const
void handle(const css::uno::Reference< css::text::XTextRange > &rHandle)
Set the current handle.
void setCellLastParaAfterAutospacing(bool bIsAfterAutospacing)
void setHandler(const tools::SvRef< DomainMapperTableHandler > &pTableDataHandler)
Set handler for resolveCurrentTable.
#define SAL_NEWLINE_STRING
#define suppress_fun_call_w_exception(expr)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define DBG_UNHANDLED_EXCEPTION(...)
Reference< XComponentContext > const m_xComponentContext
void SAL_CALL changed(::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue > &Properties) override
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
std::vector< HistoryItem > GetList(EHistoryType eHistory)
double getLength(const B2DPolygon &rCandidate)
Reference< XMultiServiceFactory > getProcessServiceFactory()
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
std::u16string_view findQuotedText(std::u16string_view rCommand, std::u16string_view cStartQuote, const sal_Unicode uEndQuote)
EquationResult ParseCombinedChars(const OUString &rStr)
OUString CreateDOCXStyleId(std::u16string_view const aName)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::basic_string_view< charT, traits > trim(std::basic_string_view< charT, traits > str)
constexpr bool ends_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
enumrange< T >::Iterator begin(enumrange< T >)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString ConvertMSFormatStringToSO(const OUString &rFormat, lang::Locale &rLocale, bool bHijri)
text::RubyAdjust convertRubyAlign(sal_Int32 nIntValue)
sal_Int32 convertTwipToMM100(sal_Int32 _t)
util::DateTime ConvertDateStringToDateTime(std::u16string_view rDateTime)
static sal_Int16 lcl_ParseNumberingType(std::u16string_view rCommand)
static void lcl_CopyRedlines(uno::Reference< text::XText > const &xSrc, std::deque< css::uno::Any > &rRedlines, std::vector< sal_Int32 > &redPos, std::vector< sal_Int32 > &redLen, sal_Int32 &redIdx)
static OUString UnquoteFieldText(std::u16string_view s)
static bool IsFieldNestingAllowed(const FieldContextPtr &pOuter, const FieldContextPtr &pInner)
Decides if the pInner field inside pOuter is allowed in Writer core, depending on their type.
static void lcl_PasteRedlines(uno::Reference< text::XText > const &xDest, std::deque< css::uno::Any > &rRedlines, std::vector< sal_Int32 > &redPos, std::vector< sal_Int32 > &redLen, sal_Int32 redIdx)
OUString getPropertyName(PropertyIds eId)
static const FieldConversionMap_t & lcl_GetFieldConversion()
static void lcl_handleTextField(const uno::Reference< beans::XPropertySet > &rxFieldProps, const FFDataHandler::Pointer_t &pFFDataHandler)
constexpr sal_Int32 DEFAULT_FRAME_MIN_WIDTH
static OUString lcl_FindLastBookmark(const uno::Reference< text::XTextCursor > &xCursor, bool bAlreadyExpanded)
static auto InsertFieldmark(std::stack< TextAppendContext > &rTextAppendStack, uno::Reference< text::XFormField > const &xFormField, uno::Reference< text::XTextRange > const &xStartRange, std::optional< FieldId > const oFieldId) -> void
bool isCharacterProperty(const PropertyIds eId)
static uno::Sequence< beans::PropertyValues > lcl_createTOXLevelHyperlinks(bool bHyperlinks, const OUString &sChapterNoSeparator, const uno::Sequence< beans::PropertyValues > &aLevel, const std::optional< style::TabStop > numtab)
static auto FilterChars(std::u16string_view const &rStyleName) -> OUString
This is a heuristic to find Word's w:styleId value from localised style name.
static size_t nextCode(std::u16string_view rCommand, size_t pos)
std::unordered_map< OUString, FieldConversion > FieldConversionMap_t
static OUString lcl_ExtractToken(std::u16string_view rCommand, size_t &rIndex, bool &rHaveToken, bool &rIsSwitch)
static util::DateTime lcl_dateTimeFromSerial(const double &dSerial)
static auto PopFieldmark(std::stack< TextAppendContext > &rTextAppendStack, uno::Reference< text::XTextCursor > const &xCursor, std::optional< FieldId > const oFieldId) -> void
static void lcl_convertToNoteIndices(std::deque< sal_Int32 > &rNoteIds, sal_Int32 &rFirstNoteIndex)
static FieldContextPtr GetParentFieldContext(const std::deque< FieldContextPtr > &rFieldStack)
Gives access to the parent field context of the topmost one, if there is any.
std::tuple< OUString, std::vector< OUString >, std::vector< OUString > > splitFieldCommand(std::u16string_view rCommand)
static OUString lcl_ParseFormat(const OUString &rCommand)
static const FieldConversionMap_t & lcl_GetEnhancedFieldConversion()
@ PROP_CELL_FORMULA_CONVERTED
@ PROP_TOP_BORDER_DISTANCE
@ PROP_VERT_ORIENT_POSITION
@ PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING
@ PROP_COUNT_LINES_IN_FRAMES
@ PROP_LEVEL_PARAGRAPH_STYLES
@ PROP_RESTART_AT_EACH_PAGE
@ PROP_CREATE_FROM_LEVEL_PARAGRAPH_STYLES
@ PROP_CURRENT_PRESENTATION
@ PROP_PARA_CONNECT_BORDERS
@ PROP_RIGHT_BORDER_DISTANCE
@ PROP_CURSOR_NOT_IGNORE_TABLES_IN_HF
@ PROP_CHAR_HEIGHT_COMPLEX
@ PROP_REDLINE_REVERT_PROPERTIES
@ PROP_HORI_ORIENT_POSITION
@ PROP_TOC_PARAGRAPH_OUTLINE_LEVEL
@ PROP_CHAR_FONT_NAME_ASIAN
@ PROP_REFERENCE_FIELD_SOURCE
@ PROP_EMBED_SYSTEM_FONTS
@ PROP_NUMBERING_STYLE_NAME
@ PROP_BACK_COLOR_TRANSPARENCY
@ PROP_PARA_BOTTOM_MARGIN
@ PROP_LEFT_BORDER_DISTANCE
@ PROP_REFERENCE_FIELD_PART
@ PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING
@ PROP_HORI_ORIENT_RELATION
@ PROP_PARA_CONTEXT_MARGIN
@ PROP_PARA_FIRST_LINE_INDENT
@ PROP_CREATE_FROM_OUTLINE
@ PROP_CHAR_FONT_CHAR_SET
@ PROP_HIDE_TAB_LEADER_AND_PAGE_NUMBERS
@ PROP_BOTTOM_BORDER_DISTANCE
@ PROP_CHAR_FONT_NAME_COMPLEX
@ PROP_VERT_ORIENT_RELATION
@ PROP_PARA_LINE_NUMBER_COUNT
static void lcl_AddRange(ParagraphPropertiesPtr const &pToBeSavedProperties, uno::Reference< text::XTextAppend > const &xTextAppend, TextAppendContext const &rAppendContext)
SkipFootnoteSeparator
Two special footnotes are a separator line, and a continuation line.
constexpr sal_Int32 DEFAULT_FRAME_MIN_HEIGHT
static void lcl_MoveBorderPropertiesToFrame(std::vector< beans::PropertyValue > &rFrameProperties, uno::Reference< text::XTextRange > const &xStartTextRange, uno::Reference< text::XTextRange > const &xEndTextRange, bool bIsRTFImport)
static sal_Int32 lcl_getListId(const StyleSheetEntryPtr &rEntry, const StyleSheetTablePtr &rStyleTable, bool &rNumberingFromBaseStyle)
Check if the style or its parent has a list id, recursively.
static OUString lcl_ExtractVariableAndHint(std::u16string_view rCommand, OUString &rHint)
static bool lcl_FindInCommand(std::u16string_view rCommand, sal_Unicode cSwitch, OUString &rValue)
static uno::Any lcl_GetPropertyFromParaStyleSheetNoNum(PropertyIds eId, StyleSheetEntryPtr pEntry, const StyleSheetTablePtr &rStyleSheet)
Very similar to DomainMapper_Impl::GetPropertyFromStyleSheet It is focused on paragraph properties se...
static OUString lcl_trim(std::u16string_view sValue)
std::multimap< sal_Int32, OUString > TOCStyleMap
ContextType
property stack element
static uno::Any lcl_getGrabBagValue(const uno::Sequence< beans::PropertyValue > &grabBag, OUString const &name)
static ww::eField GetWW8FieldId(OUString const &rType)
static void lcl_linenumberingHeaderFooter(const uno::Reference< container::XNameContainer > &xStyles, const OUString &rname, DomainMapper_Impl *dmapper)
constexpr sal_Int32 DEFAULT_VALUE
static size_t findCode(std::u16string_view rCommand, sal_Unicode cSwitch)
@ IMPORT_AS_DETECTED_ANCHOR
@ IMPORT_AS_DETECTED_INLINE
static void lcl_handleDropdownField(const uno::Reference< beans::XPropertySet > &rxFieldProps, const FFDataHandler::Pointer_t &pFFDataHandler)
HashMap_OWString_Interface aMap
constexpr OUStringLiteral ODF_CODE_PARAM
constexpr OUStringLiteral ODF_UNHANDLED
constexpr OUStringLiteral ODF_ID_PARAM
Stores original/in-file-format info about a single anchored object.
css::uno::Reference< css::text::XTextContent > m_xAnchoredObject
RedlineParamsPtr m_xRedlineForInline
Stores info about objects anchored to a given paragraph.
std::vector< AnchoredObjectInfo > m_aAnchoredObjects
css::uno::Reference< css::text::XTextRange > m_xParagraph
Stores the start/end positions of an annotation before its insertion.
css::uno::Reference< css::text::XTextRange > m_xEnd
css::uno::Reference< css::text::XTextRange > m_xStart
helper to remember bookmark start position
css::uno::Reference< css::text::XTextRange > m_xTextRange
Information about a paragraph to be finished after a field end.
Information about a paragraph to be finished after a table end.
css::uno::Reference< css::text::XTextRange > xInsertPosition
std::vector< AnchoredObjectInfo > m_aAnchoredObjects
Objects anchored to the current paragraph, may affect the paragraph spacing.
css::uno::Reference< css::text::XTextAppend > xTextAppend
css::uno::Reference< css::text::XParagraphCursor > xCursor
ParagraphPropertiesPtr pLastParagraphProperties
Reference< XFrame > xFrame
Reference< XModel > xModel