28#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
29#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
30#include <com/sun/star/style/ParagraphAdjust.hpp>
31#include <com/sun/star/table/TableBorderDistances.hpp>
32#include <com/sun/star/table/TableBorder.hpp>
33#include <com/sun/star/table/BorderLine2.hpp>
34#include <com/sun/star/table/BorderLineStyle.hpp>
35#include <com/sun/star/table/XCellRange.hpp>
36#include <com/sun/star/text/HoriOrientation.hpp>
37#include <com/sun/star/text/SizeType.hpp>
38#include <com/sun/star/text/TextContentAnchorType.hpp>
39#include <com/sun/star/text/WritingMode2.hpp>
40#include <com/sun/star/text/XTextField.hpp>
41#include <com/sun/star/text/XTextRangeCompare.hpp>
42#include <com/sun/star/beans/XPropertySet.hpp>
43#include <com/sun/star/beans/XPropertyState.hpp>
44#include <com/sun/star/container/XEnumeration.hpp>
45#include <com/sun/star/container/XEnumerationAccess.hpp>
46#include <com/sun/star/drawing/FillStyle.hpp>
50#include <osl/diagnose.h>
55#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
56#include <com/sun/star/style/BreakType.hpp>
57#include <officecfg/Office/Writer.hxx>
61#include <rtl/ustring.hxx>
69#define DEF_BORDER_DIST 190
70#define CNF_FIRST_ROW 0x800
71#define CNF_LAST_ROW 0x400
72#define CNF_FIRST_COLUMN 0x200
73#define CNF_LAST_COLUMN 0x100
74#define CNF_ODD_VBAND 0x080
75#define CNF_EVEN_VBAND 0x040
76#define CNF_ODD_HBAND 0x020
77#define CNF_EVEN_HBAND 0x010
78#define CNF_FIRST_ROW_LAST_COLUMN 0x008
79#define CNF_FIRST_ROW_FIRST_COLUMN 0x004
80#define CNF_LAST_ROW_LAST_COLUMN 0x002
81#define CNF_LAST_ROW_FIRST_COLUMN 0x001
85#define MAXTABLECELLS 63
88 css::uno::Reference<css::text::XTextAppendAndConvert> xText,
90 : m_xText(
std::move(xText)),
91 m_rDMapper_Impl( rDMapper_Impl ),
92 m_bHadFootOrEndnote(false)
115 std::optional<PropertyMap::Property> pOrigVal = pOrig->getProperty(
nId);
119 pDest->Insert(
nId, pOrigVal->second,
false );
124 sal_uInt32 nCell, sal_uInt32 nFirstCell, sal_uInt32 nLastCell, sal_Int32 nRow,
bool bIsEndRow,
bool bMergedVertically )
126 const bool bIsStartCol = nCell == nFirstCell;
127 const bool bIsEndCol = nCell == nLastCell;
137 aVertProp = pVerticalVal->second;
141 aVertProp = pVerticalVal->second;
142 pCellProps->Erase( pVerticalVal->first );
146 if ( !pHorizontalVal )
149 if ( pHorizontalVal )
150 aHorizProp = pHorizontalVal->second;
154 aHorizProp = pHorizontalVal->second;
155 pCellProps->Erase( pHorizontalVal->first );
167 if ( !bIsEndCol && nCell >= nFirstCell )
169 if ( !bIsStartCol && nCell <= nLastCell )
176 if ( pHorizontalVal && !bMergedVertically )
180 if ( bMergedVertically )
186 if ( pHorizontalVal )
190 if ( nRow > 0 && !bIsEndRow )
192 if ( pHorizontalVal )
265bool lcl_extractTableBorderProperty(
const PropertyMapPtr& pTableProperties,
const PropertyIds nId, TableInfo
const & rInfo, table::BorderLine2& rLine)
267 if (!pTableProperties)
270 const std::optional<PropertyMap::Property> aTblBorder = pTableProperties->getProperty(nId);
273 OSL_VERIFY(aTblBorder->second >>= rLine);
275 rInfo.pTableBorders->Insert( nId,
uno::Any( rLine ) );
276 rInfo.pTableDefaults->Erase( nId );
284void lcl_extractHoriOrient(std::vector<beans::PropertyValue>& rFrameProperties, sal_Int32& nHoriOrient)
287 for (
const beans::PropertyValue & rFrameProperty : rFrameProperties)
289 if (rFrameProperty.Name ==
"HoriOrient")
291 sal_Int32
nValue = rFrameProperty.Value.get<sal_Int32>();
299void lcl_DecrementHoriOrientPosition(std::vector<beans::PropertyValue>& rFrameProperties, sal_Int32 nAmount)
302 for (beans::PropertyValue & rPropertyValue : rFrameProperties)
304 if (rPropertyValue.Name ==
"HoriOrientPosition")
306 sal_Int32
nValue = rPropertyValue.Value.get<sal_Int32>();
308 rPropertyValue.Value <<=
nValue;
314void lcl_adjustBorderDistance(TableInfo& rInfo,
const table::BorderLine2& rLeftBorder,
315 const table::BorderLine2& rRightBorder)
338 const sal_Int32 nActualL
339 = std::max<sal_Int32>(rLeftBorder.LineWidth / 2, rInfo.nLeftBorderDistance);
340 const sal_Int32 nActualR
341 = std::max<sal_Int32>(nActualL + rRightBorder.LineWidth / 2,
342 rInfo.nLeftBorderDistance + rInfo.nRightBorderDistance)
344 rInfo.nLeftBorderDistance = nActualL;
345 rInfo.nRightBorderDistance = nActualR;
351 std::vector<beans::PropertyValue>& rFrameProperties,
352 bool bConvertToFloatingInFootnote)
364 if (bConvertToFloatingInFootnote)
367 aGrabBag[
"TablePosition"] =
uno::Any();
374 OUString sTableStyleName;
375 aTableStyleVal->second >>= sTableStyleName;
377 const StyleSheetEntryPtr pStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( sTableStyleName );
381 aGrabBag[
"TableStyleName"] <<= sTableStyleName;
391 PropertyMapPtr pMergedProperties = pStyleSheet->GetMergedInheritedProperties(pStyleSheetTable);
393 table::BorderLine2 aBorderLine;
395 if (lcl_extractTableBorderProperty(pMergedProperties,
PROP_TOP_BORDER, rStyleInfo, aBorderLine))
397 aGrabBag[
"TableStyleTopBorder"] <<= aBorderLine;
399 if (lcl_extractTableBorderProperty(pMergedProperties,
PROP_BOTTOM_BORDER, rStyleInfo, aBorderLine))
401 aGrabBag[
"TableStyleBottomBorder"] <<= aBorderLine;
403 if (lcl_extractTableBorderProperty(pMergedProperties,
PROP_LEFT_BORDER, rStyleInfo, aBorderLine))
405 aGrabBag[
"TableStyleLeftBorder"] <<= aBorderLine;
407 if (lcl_extractTableBorderProperty(pMergedProperties,
PROP_RIGHT_BORDER, rStyleInfo, aBorderLine))
409 aGrabBag[
"TableStyleRightBorder"] <<= aBorderLine;
414 if (pMergedProperties)
415 pMergedProperties->dumpXml();
441 aGrabBag[
"TableStyleLook"] = oTableLook->second;
449 aTblLook->second >>= rInfo.
nTblLook;
488 if (!aGrabBag.
empty())
494 if (oLeftMarginFromStyle)
511 table::TableBorderDistances aDistances;
512 aDistances.IsTopDistanceValid =
513 aDistances.IsBottomDistanceValid =
514 aDistances.IsLeftDistanceValid =
515 aDistances.IsRightDistanceValid =
true;
524 if (!rFrameProperties.empty() && nMode < 15)
532 table::TableBorder aTableBorder;
533 table::BorderLine2 aBorderLine, aLeftBorder, aRightBorder;
537 aTableBorder.TopLine = aBorderLine;
538 aTableBorder.IsTopLineValid =
true;
542 aTableBorder.BottomLine = aBorderLine;
543 aTableBorder.IsBottomLineValid =
true;
547 aTableBorder.LeftLine = aLeftBorder;
548 aTableBorder.IsLeftLineValid =
true;
553 aTableBorder.RightLine = aRightBorder;
554 aTableBorder.IsRightLineValid =
true;
558 aTableBorder.HorizontalLine = aBorderLine;
559 aTableBorder.IsHorizontalLineValid =
true;
563 aTableBorder.VerticalLine = aBorderLine;
564 aTableBorder.IsVerticalLineValid =
true;
567 aTableBorder.Distance = 0;
568 aTableBorder.IsDistanceValid =
false;
585 std::optional<PropertyMap::Property> aCellBorder
588 aCellBorder->second >>= aLeftBorder;
591 aCellBorder->second >>= aRightBorder;
593 if (rInfo.nNestLevel == 1 && aLeftBorder.LineWidth && !rFrameProperties.empty())
595 lcl_DecrementHoriOrientPosition(rFrameProperties, aLeftBorder.LineWidth * 0.5);
597 lcl_adjustBorderDistance(rInfo, aLeftBorder, aRightBorder);
602 if (0 < nMode && nMode <= 14 && rInfo.nNestLevel == 1)
604 const sal_Int32 nAdjustedMargin =
nLeftMargin - rInfo.nLeftBorderDistance;
614 const sal_Int32 nAdjustedMargin =
nLeftMargin + (aLeftBorder.LineWidth / 2);
618 sal_Int32 nTableWidth = 0;
619 sal_Int32 nTableWidthType = text::SizeType::FIX;
622 if( nTableWidthType == text::SizeType::FIX )
624 if( nTableWidth > 0 )
631 nTableWidthType = text::SizeType::VARIABLE;
634 if (nTableWidthType != text::SizeType::FIX)
640 sal_Int32 nHoriOrient = text::HoriOrientation::LEFT_AND_WIDTH;
643 lcl_extractHoriOrient( rFrameProperties, nHoriOrient );
648 uno::Any(sal_Int16(text::WritingMode2::CONTEXT)),
657 bool bRowCanSplit =
true;
658 oSplitAllowed->second >>= bRowCanSplit;
691 return aCellProperties;
694 PropertyMapVector2::const_iterator aRowOfCellsIterator =
m_aCellProperties.begin();
695 PropertyMapVector2::const_iterator aRowOfCellsIteratorEnd =
m_aCellProperties.end();
696 PropertyMapVector2::const_iterator aLastRowIterator =
m_aCellProperties.end() - 1;
699 css::uno::Sequence<css::beans::PropertyValues>* pCellProperties = aCellProperties.getArray();
701 while( aRowOfCellsIterator != aRowOfCellsIteratorEnd )
704 PropertyMapVector1::const_iterator aCellIterator = aRowOfCellsIterator->begin();
705 PropertyMapVector1::const_iterator aCellIteratorEnd = aRowOfCellsIterator->end();
707 sal_Int32 nRowStyleMask = 0;
714 else if (aRowOfCellsIterator==aLastRowIterator)
740 pCellProperties[nRow].realloc( aRowOfCellsIterator->size() );
741 beans::PropertyValues* pSingleCellProperties = pCellProperties[nRow].getArray();
743 while( aCellIterator != aCellIteratorEnd )
747 PropertyMapVector1::const_iterator aLastCellIterator = aRowOfCellsIterator->end() - 1;
748 bool bIsEndCol = aCellIterator == aLastCellIterator;
749 bool bIsEndRow = aRowOfCellsIterator == aLastRowIterator;
760 sal_Int32 nCellStyleMask = 0;
761 if (aCellIterator==aRowOfCellsIterator->begin())
784 sal_Int32 nCnfStyleMask = nCellStyleMask + nRowStyleMask;
805 std::optional<PropertyMap::Property> oStyleCellBorder = pStyleProps->getProperty(rBorder);
806 std::optional<PropertyMap::Property> oDirectCellBorder = (*aCellIterator)->getProperty(rBorder);
807 if (oStyleCellBorder && oDirectCellBorder)
810 table::BorderLine2 aStyleCellBorder = oStyleCellBorder->second.
get<table::BorderLine2>();
811 table::BorderLine2 aDirectCellBorder = oDirectCellBorder->second.get<table::BorderLine2>();
816 pStyleProps->Erase(rBorder);
817 (*aCellIterator)->Erase(rBorder);
821 std::optional<PropertyMap::Property> oTableBorder = rInfo.
pTableBorders->getProperty(rBorder);
824 table::BorderLine2 aTableBorder = oTableBorder->second.
get<table::BorderLine2>();
830 pStyleProps->Erase(rBorder);
831 (*aCellIterator)->Erase(rBorder);
838 pAllCellProps->InsertProps( pStyleProps );
846 pAllCellProps->InsertProps(*aCellIterator);
847 std::swap(*(*aCellIterator), *pAllCellProps );
864 bool isOneCol =
true;
885 bool bMergedVertically = oProp && oProp->second.get<
bool>();
886 if ( bMergedVertically )
889 sal_Int32 nLastMergedRow = 0;
896 bMergedVertically = oProp && !oProp->second.get<
bool>();
897 if ( bMergedVertically )
901 bMergedVertically =
false;
906 if ( nRow < nLastMergedRow )
929 const std::optional<PropertyMap::Property> aHorizontalMergeVal = (*aCellIterator)->getProperty(
PROP_HORIZONTAL_MERGE);
930 if (aHorizontalMergeVal)
932 if (aHorizontalMergeVal->second.get<
bool>())
936 rMerges.push_back(aMerge);
938 else if (!rMerges.empty())
947 pSingleCellProperties[nCell] = (*aCellIterator)->GetPropertyValues();
956 ++aRowOfCellsIterator;
964 return aCellProperties;
981static bool lcl_emptyRow(std::vector<RowSequence_t>& rTableRanges, sal_Int32 nRow)
983 if (nRow >=
static_cast<sal_Int32
>(rTableRanges.size()))
985 SAL_WARN(
"writerfilter.dmapper",
"m_aCellProperties not in sync with rTableRanges?");
990 if (!rRowSeq.hasElements())
992 SAL_WARN(
"writerfilter.dmapper",
"m_aCellProperties not in sync with rTableRanges?");
996 if (!rRowSeq[0][0].is())
1000 SAL_WARN(
"writerfilter.dmapper",
"rRowSeq[0][0] is an empty reference");
1010 bool bRangesAreNotEqual = std::any_of(rRowSeq.begin(), rRowSeq.end(),
1012 return xTextRangeCompare->compareRegionStarts(rCellSeq[0], rCellSeq[1]) != 0; });
1013 if (bRangesAreNotEqual)
1016 catch (
const lang::IllegalArgumentException&)
1030 css::uno::Sequence<css::beans::PropertyValues> aRowProperties(
m_aRowProperties.size() );
1031 auto aRowPropertiesRange = asNonConstRange(aRowProperties);
1052 aRowPropertiesRange[nRow] = rRow->GetPropertyValues();
1068 return aRowProperties;
1071static bool isAbsent(
const std::vector<beans::PropertyValue>& propvals,
const OUString& name)
1073 return std::find_if(propvals.begin(), propvals.end(),
1074 [&
name](
const beans::PropertyValue& propval)
1075 { return propval.Name == name; })
1091 std::vector<beans::PropertyValue> aProps;
1092 std::optional<OUString> oParagraphText;
1094 for(
auto const& eId : aAllTableParaProperties )
1098 bool bSetDirectlyInParaLevel = rParaProp.
m_pPropertyMap->isSet(eId);
1110 auto pCellProp = std::find_if(rCellProperties.begin(), rCellProperties.end(),
1111 [&](
const beans::PropertyValue& rProp) { return rProp.Name == sPropertyName; });
1113 if (pCellProp != rCellProperties.end())
1115 if (bSetDirectlyInParaLevel)
1117 if (!oParagraphText)
1122 xParagraph->gotoStartOfParagraph(
true );
1123 oParagraphText = xParagraph->getString();
1126 if (oParagraphText->isEmpty())
1132 auto pFillStyleProp = std::find_if(rCellProperties.begin(), rCellProperties.end(),
1133 [](
const beans::PropertyValue& rProp) { return rProp.Name ==
"FillStyle"; });
1134 if ( pFillStyleProp == rCellProperties.end() ||
1135 pFillStyleProp->Value !=
uno::Any(drawing::FillStyle_SOLID) )
1141 OUString sParaStyleName;
1142 rParaProp.
m_rPropertySet->getPropertyValue(
"ParaStyleName") >>= sParaStyleName;
1149 bool bCompatOverride =
false;
1153 bCompatOverride = aParaStyle ==
uno::Any(
double(11)) || aParaStyle ==
uno::Any(
double(12));
1156 style::ParagraphAdjust eAdjust(style::ParagraphAdjust_CENTER);
1157 aParaStyle >>= eAdjust;
1158 bCompatOverride = eAdjust == style::ParagraphAdjust_LEFT;
1168 if (!aParaStyle.
hasValue() || bDocDefault || bCompatOverride)
try
1178 catch (
const uno::Exception & )
1186 if (!aProps.empty())
1190 rParaProp.
m_rPropertySet->getPropertySetInfo(), uno::UNO_SET_THROW);
1191 auto props = xPropSetInfo->getProperties();
1193 std::transform(
props.begin(),
props.end(), propNames.getArray(),
1194 [](
const beans::Property& prop) { return prop.Name; });
1196 uno::UNO_QUERY_THROW);
1199 for (
auto& val : xTolPara->getDirectPropertyValuesTolerant(propNames))
1203 if (val.Result == beans::TolerantPropertySetResultType::SUCCESS
1204 && val.State == beans::PropertyState_DIRECT_VALUE
1216 uno::UNO_QUERY_THROW);
1217 xCursorProps->setPropertyValue(
"ParaAutoStyleDef",
1227 sal_Int32 nRows = xTableRows->getCount();
1228 for (sal_Int32 nRow = 0; nRow < nRows; ++nRow)
1236 xCellProperties->getPropertyValue(
"CellInteropGrabBag") >>= aCellGrabBag;
1238 bool bReplace =
false;
1239 for (
const auto& rProp : std::as_const(aCellGrabBag))
1241 if ( rProp.Name ==
"CellFormulaConverted" )
1244 struct RangeDirection
1250 static const RangeDirection pDirections[] =
1252 { OUString(
" LEFT "), -1, 0},
1253 { OUString(
" RIGHT "), 1, 0},
1254 { OUString(
" ABOVE "), 0, -1},
1255 { OUString(
" BELOW "), 0, 1 }
1257 for (
const RangeDirection& rRange : pDirections)
1259 if (
sFormula.indexOf(rRange.m_sName) > -1 )
1263 bool bFoundFirst =
false;
1266 OUString sLastValueCell;
1270 sal_Int32 nCell = 0;
1274 xCellRange->getCellByPosition(nCol + nCell * rRange.m_nCol, nRow + nCell * rRange.m_nRow),
1275 uno::UNO_QUERY_THROW);
1278 sLastCell = xCell->getPropertyValue(
"CellName").get<OUString>();
1279 if (sNextCell.isEmpty())
1280 sNextCell = sLastCell;
1283 OUString sCellText = xText->getString().replace(
',',
'.');
1284 if (sCellText.endsWith(
"%"))
1285 sCellText = sCellText.copy(0, sCellText.getLength()-1);
1287 rtl_math_ConversionStatus eConversionStatus;
1288 sal_Int32 nParsedEnd;
1289 rtl::math::stringToDouble(sCellText,
'.',
',', &eConversionStatus, &nParsedEnd);
1290 if ( eConversionStatus != rtl_math_ConversionStatus_Ok || nParsedEnd == 0 )
1303 sLastValueCell = sLastCell;
1307 catch (
const lang::IndexOutOfBoundsException & )
1311 if ( !sNextCell.isEmpty() )
1313 OUString sRange =
"<" + sNextCell +
":" +
1314 ( sLastValueCell.isEmpty() ? sLastCell : sLastValueCell ) +
">";
1329 while ( xRunEnum->hasMoreElements() )
1333 if ( xRunProperties->getPropertyValue(
"TextPortionType") ==
uno::Any(OUString(
"TextField")) )
1338 if ( rProp.Value != xFieldProperties->getPropertyValue(
"Content") )
1342 auto aGrabBag = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aCellGrabBag);
1343 beans::PropertyValue aValue;
1344 aValue.Name =
"CellFormulaConverted";
1346 aGrabBag.push_back(aValue);
1354 catch (
const lang::IndexOutOfBoundsException & )
1370 std::vector<beans::PropertyValue> aFrameProperties = comphelper::sequenceToContainer<std::vector<beans::PropertyValue> >
1377 bool bConvertToFloating = aFrameProperties.empty() &&
1378 nestedTableLevel <= 1 &&
1380 bool bFloating = !aFrameProperties.empty() || bConvertToFloating;
1385 std::vector<HorizontallyMergedCell> aMerges;
1401 if (bConvertToFloating)
1409 pAllTableProps->InsertProps(aTableInfo.pTableDefaults);
1410 if ( aTableInfo.pTableStyle )
1411 pAllTableProps->InsertProps(aTableInfo.pTableStyle->GetProperties(
CNF_ALL ));
1412 for (
const auto& eId : pAllTableProps->GetPropertyIds())
1415 pAllTableProps->Erase(eId);
1417 std::vector< PropertyIds > aAllTableParaProperties = pAllTableProps->GetPropertyIds();
1419 if ( !aAllTableParaProperties.empty() )
1425 for (
size_t nCell = 0; nCell <
m_aTableRanges[nRow].size(); ++nCell)
1428 if (!rStartPara.is())
1432 bool bApply =
false;
1434 std::vector<TableParagraph>::iterator aIt = pTableParagraphs->begin();
1435 while ( aIt != pTableParagraphs->end() )
try
1437 if (!bApply && xTextRangeCompare->compareRegionStarts(rStartPara, aIt->m_rStartParagraph) == 0)
1441 bool bEndOfApply = (xTextRangeCompare->compareRegionEnds(rEndPara, aIt->m_rEndParagraph) == 0);
1443 if ( nCell < sal::static_int_cast<std::size_t>(aCellProperties[nRow].
getLength()) )
1446 aIt = pTableParagraphs->erase(aIt);
1453 catch(
const lang::IllegalArgumentException & )
1468 if (rLastRow.hasElements())
1471 xEnd = rLastCell[1];
1483 if (!aMerges.empty())
1485 static const std::vector<std::u16string_view> aBorderNames
1486 = {
u"TopBorder",
u"LeftBorder",
u"BottomBorder",
u"RightBorder" };
1489 for (std::vector<HorizontallyMergedCell>::reverse_iterator it = aMerges.rbegin(); it != aMerges.rend(); ++it)
1493 xCellRange->getCellByPosition(it->m_nFirstCol, it->m_nFirstRow),
1494 uno::UNO_QUERY_THROW);
1496 = xFirstCell->getPropertyValue(
"CellName").get<OUString>();
1498 if (it->m_nLastCol != -1)
1502 table::BorderLine2 aBorderValues[4];
1503 for (
size_t i = 0;
i < aBorderNames.size(); ++
i)
1504 xFirstCell->getPropertyValue(OUString(aBorderNames[
i]))
1505 >>= aBorderValues[
i];
1508 xCellRange->getCellByPosition(it->m_nLastCol, it->m_nLastRow),
1509 uno::UNO_QUERY_THROW);
1511 = xLastCell->getPropertyValue(
"CellName").get<OUString>();
1514 xCursor->gotoCellByName(aLast,
true);
1516 xCursor->mergeRange();
1521 for (
size_t i = 0;
i < aBorderNames.size(); ++
i)
1524 xFirstCell->setPropertyValue(
1525 OUString(aBorderNames[
i]),
uno::Any(aBorderValues[
i]));
1536 catch (
const lang::IllegalArgumentException & )
1543 catch (
const uno::Exception & )
1553 bool bIsRelative =
false;
1554 xTableProperties->getPropertyValue(
"IsWidthRelative") >>= bIsRelative;
1557 beans::PropertyValue aValue;
1558 aValue.Name =
"Width";
1559 aValue.Value = xTableProperties->getPropertyValue(
"Width");
1560 aFrameProperties.push_back(aValue);
1564 beans::PropertyValue aValue;
1565 aValue.Name =
"FrameWidthPercent";
1566 aValue.Value = xTableProperties->getPropertyValue(
"RelativeWidth");
1567 aFrameProperties.push_back(aValue);
1570 xTableProperties->setPropertyValue(
"RelativeWidth",
uno::Any(sal_Int16(100)));
1574 xTableProperties->setPropertyValue(
"LeftMargin",
uno::Any(sal_Int32(0)));
1577 xTableProperties->getPropertyValue(
"BreakType") >>= eBreakType;
1578 if (eBreakType != style::BreakType_NONE)
1582 xTableProperties->setPropertyValue(
"BreakType",
uno::Any(style::BreakType_NONE));
1585 if (nestedTableLevel >= 2)
1588 aFrameProperties.push_back(
1592 if (nestedTableLevel <= 1)
1599 sal_Int32 nTableWidth = 0;
1601 sal_Int32 nTableWidthType = text::SizeType::FIX;
1609 if (xTextAppendAndConvert.is() && !(nestedTableLevel >= 2 && bTableStartsAtCellStart))
1612 std::vector<sal_Int32> redPos, redLen;
1613 std::vector<OUString> redCell;
1614 std::vector<OUString> redTable;
1618 xFrameAnchor.set(xContent->getAnchor(), uno::UNO_QUERY);
1620 bool bConvertToFloatingInFootnote =
false;
1621 if (xContent.is() && xContent->getAnchor().is())
1626 bConvertToFloatingInFootnote = xText->supportsService(
"com.sun.star.text.Footnote");
1633 if ( bConvertToFloatingInFootnote && xContent.is() )
1636 xContent->getAnchor(), uno::UNO_QUERY);
1637 if ( xParagraph.is() )
1639 xParagraph->setPropertyValue(
"ParaTopMargin",
1640 uno::Any(
static_cast<sal_Int32
>(0)));
1641 xParagraph->setPropertyValue(
"ParaBottomMargin",
1642 uno::Any(
static_cast<sal_Int32
>(0)));
1653 if (xParagraph.is())
1656 xParagraph->getPropertyValue(
"CharHidden") >>= bCharHidden;
1659 xParagraph->setPropertyValue(
"CharHidden",
uno::Any(
false));
1667 if (xFrameAnchor.is() && eBreakType != style::BreakType_NONE)
1670 xFrameAnchor->setPropertyValue(
"BreakType",
uno::Any(eBreakType));
1693 if (pProps !=
nullptr)
1728 pProps->printProperties();
1735 xStart =
start->getStart();
1750 xEnd =
end->getEnd();
#define CNF_LAST_ROW_LAST_COLUMN
#define CNF_FIRST_ROW_FIRST_COLUMN
#define CNF_LAST_ROW_FIRST_COLUMN
#define CNF_FIRST_ROW_LAST_COLUMN
css::uno::Sequence< css::beans::PropertyValue > getAsConstPropertyValueList() const
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)
bool m_bHadFootOrEndnote
Did we have a foot or endnote in this table?
void endCell(const css::uno::Reference< css::text::XTextRange > &end)
Handle end of cell.
void ApplyParagraphPropertiesFromTableStyle(TableParagraph rParaProp, std::vector< PropertyIds > aAllTableProperties, const css::beans::PropertyValues rCellProperties)
TablePropertyMapPtr m_aTableProperties
void startCell(const css::uno::Reference< css::text::XTextRange > &start, const TablePropertyMapPtr &pProps)
Handle start of cell.
PropertyMapVector1 m_aRowProperties
TableStyleSheetEntry * endTableGetTableStyle(TableInfo &rInfo, std::vector< css::beans::PropertyValue > &rFrameProperties, bool bConvertToFloating)
void endRow()
Handle end of row.
css::uno::Reference< css::text::XTextAppendAndConvert > m_xText
std::vector< css::uno::Reference< css::text::XTextRange > > m_aCellRange
void startRow(const TablePropertyMapPtr &pProps)
Handle start of row.
PropertyMapVector2 m_aCellProperties
std::vector< RowSequence_t > m_aTableRanges
void endTable(unsigned int nestedTableLevel, bool bTableStartsAtCellStart)
Handle end of table.
void setHadFootOrEndnote(bool bHadFootOrEndnote)
~DomainMapperTableHandler() override
DomainMapper_Impl & getDomainMapperImpl()
CellPropertyValuesSeq_t endTableGetCellProperties(TableInfo &rInfo, std::vector< HorizontallyMergedCell > &rMerges)
css::uno::Sequence< css::beans::PropertyValues > endTableGetRowProperties()
std::vector< CellSequence_t > m_aRowRanges
DomainMapper_Impl & m_rDMapper_Impl
void startTable(const TablePropertyMapPtr &pProps)
Handle start of table.
DomainMapperTableHandler(css::uno::Reference< css::text::XTextAppendAndConvert > xText, DomainMapper_Impl &rDMapper_Impl)
const TableParagraphVectorPtr & getCurrentParagraphs()
css::uno::Sequence< css::beans::PropertyValue > getCurrentTablePosition()
static void fillEmptyFrameProperties(std::vector< css::beans::PropertyValue > &rFrameProperties, bool bSetAnchorToChar)
css::uno::Any GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara, bool *bIsDocDefault=nullptr)
DomainMapperTableManager & getTableManager()
SettingsTablePtr const & GetSettingsTable()
bool IsInFootOrEndnote() const
css::uno::Reference< css::text::XTextAppend > const & GetTopTextAppend()
std::deque< css::uno::Any > m_aStoredRedlines[StoredRedlines::NONE]
StyleSheetTablePtr const & GetStyleSheetTable()
OUString GetDefaultParaStyleName()
sal_uInt32 getGridAfter(sal_uInt32 nRow)
sal_uInt32 findColumn(const sal_uInt32 nRow, const sal_uInt32 nCell)
Given a zero-based row/cell, return the zero-based grid it belongs to, or SAL_MAX_UINT16 for invalid.
sal_uInt32 findColumnCell(const sal_uInt32 nRow, const sal_uInt32 nCol)
Given a zero-based row/col, return the zero-based cell describing that grid, or SAL_MAX_UINT16 for in...
sal_uInt32 getGridBefore(sal_uInt32 nRow)
PropertyMapPtr GetProperties(sal_Int32 nMask)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define TOOLS_INFO_EXCEPTION(area, stream)
#define SAL_WARN(area, stream)
tools::Long const nLeftMargin
double getLength(const B2DPolygon &rCandidate)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
OUString getPropertyName(PropertyIds eId)
bool isCharacterProperty(const PropertyIds eId)
bool isParagraphProperty(const PropertyIds eId)
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValues > > CellPropertyValuesSeq_t
std::shared_ptr< std::vector< TableParagraph > > TableParagraphVectorPtr
void lcl_DumpPropertyValueSeq(css::uno::Sequence< css::beans::PropertyValues > const &rPropValSeq)
css::uno::Sequence< CellSequence_t > RowSequence_t
static bool lcl_emptyRow(std::vector< RowSequence_t > &rTableRanges, sal_Int32 nRow)
Are all cells in this row empty?
void BeforeConvertToTextFrame(std::deque< css::uno::Any > &rFramedRedlines, std::vector< sal_Int32 > &redPos, std::vector< sal_Int32 > &redLen, std::vector< OUString > &redCell, std::vector< OUString > &redTable)
static bool lcl_hideMarks(PropertyMapVector1 &rCellProperties)
Do all cells in this row have a CellHideMark property?
tools::SvRef< PropertyMap > PropertyMapPtr
@ PROP_TOP_BORDER_DISTANCE
@ META_PROP_CELL_MAR_RIGHT
@ PROP_RIGHT_BORDER_DISTANCE
@ META_PROP_HORIZONTAL_BORDER
@ META_PROP_VERTICAL_BORDER
@ META_PROP_TABLE_STYLE_NAME
@ PROP_LEFT_BORDER_DISTANCE
@ PROP_TABLE_BORDER_DISTANCES
@ PROP_PARA_FIRST_LINE_INDENT
@ PROP_BOTTOM_BORDER_DISTANCE
@ META_PROP_CELL_MAR_BOTTOM
@ META_PROP_CELL_MAR_LEFT
@ PROP_TABLE_INTEROP_GRAB_BAG
static void lcl_debug_BorderLine(table::BorderLine const &rLine)
static void lcl_mergeBorder(PropertyIds nId, const PropertyMapPtr &pOrig, const PropertyMapPtr &pDest)
static void lcl_debug_TableBorder(table::TableBorder const &rBorder)
static void lcl_convertFormulaRanges(const uno::Reference< text::XTextTable > &xTable)
void AfterConvertToTextFrame(DomainMapper_Impl &rDM_Impl, std::deque< css::uno::Any > &aFramedRedlines, std::vector< sal_Int32 > &redPos, std::vector< sal_Int32 > &redLen, std::vector< OUString > &redCell, std::vector< OUString > &redTable)
css::uno::Sequence< css::uno::Reference< css::text::XTextRange > > CellSequence_t
void lcl_DumpPropertyValues(beans::PropertyValues const &rValues)
static void lcl_computeCellBorders(const PropertyMapPtr &pTableBorders, const PropertyMapPtr &pCellProps, sal_uInt32 nCell, sal_uInt32 nFirstCell, sal_uInt32 nLastCell, sal_Int32 nRow, bool bIsEndRow, bool bMergedVertically)
std::vector< PropertyMapPtr > PropertyMapVector1
static bool isAbsent(const std::vector< beans::PropertyValue > &propvals, const OUString &name)
std::string XTextRangeToString(uno::Reference< text::XTextRange > const &textRange)
A horizontally merged cell is in fact a range of cells till its merge is performed.
css::beans::PropertyValues aTableProperties
sal_Int32 nTopBorderDistance
PropertyMapPtr pTableBorders
PropertyMapPtr pTableDefaults
TableStyleSheetEntry * pTableStyle
sal_Int32 nLeftBorderDistance
sal_Int32 nBottomBorderDistance
sal_Int32 nRightBorderDistance
std::vector< PropertyIds > aTablePropertyIds
Information about a paragraph to be finished after a table end.
PropertyMapPtr m_pPropertyMap
css::uno::Reference< css::text::XTextRange > m_rEndParagraph
css::uno::Reference< css::beans::XPropertySet > m_rPropertySet