23#include <com/sun/star/chart/ChartDataRowSource.hpp>
24#include <com/sun/star/chart2/data/LabelOrigin.hpp>
25#include <com/sun/star/embed/XEmbeddedObject.hpp>
26#include <com/sun/star/frame/XModel.hpp>
37#include <unoprnms.hxx>
74 uno::Reference< util::XModifiable > xModif( xIP->getComponent(), uno::UNO_QUERY_THROW );
75 xModif->setModified(
true );
77 catch ( uno::Exception& )
89 , m_aUnlockTimer(
"sw::SwChartLockController_Helper aUnlockTimer" )
90 , m_bIsLocked( false )
121 uno::Reference< frame::XModel > xRes;
134 xRes.set( xIP->getComponent(), uno::UNO_QUERY );
138 xRes->lockControllers();
140 xRes->unlockControllers();
163 const uno::Reference< uno::XInterface > &rxI )
165 lang::EventObject aEvtObj( rxI );
167 rICH.
notifyEach( aGuard, &util::XModifyListener::modified, aEvtObj );
177 std::u16string_view rCellRangeName )
179 sal_Int32
nToken = std::u16string_view::npos == rCellRangeName.find(
'.') ? 0 : 1;
181 OUString aTLName(
o3tl::getToken(aCellRangeNoTableName, 0,
':') );
182 OUString aBRName(
o3tl::getToken(aCellRangeNoTableName, 1,
':') );
183 if(aTLName.isEmpty() || aBRName.isEmpty())
190 OSL_ENSURE( rDesc.
nTop != -1 &&
194 "failed to get range descriptor" );
196 "invalid range descriptor");
207 if (!pUnoTableCursor)
233 OSL_ENSURE( pStartBox,
"start box not found" );
234 OSL_ENSURE( pEndBox,
"end box not found" );
247 aRes = pStartBox->
GetName() +
":";
258 std::u16string_view rStartCell, std::u16string_view rEndCell,
259 bool bForceEndCellName )
261 OSL_ENSURE( !rTableName.empty(),
"table name missing" );
262 OSL_ENSURE( !rStartCell.empty(),
"cell name missing" );
263 OUString aRes = OUString::Concat(rTableName) +
"." + rStartCell;
265 if (!rEndCell.empty())
267 aRes += OUString::Concat(
":") + rEndCell;
269 else if (bForceEndCellName)
271 aRes += OUString::Concat(
":") + rStartCell;
278 std::u16string_view rRangeRepresentation,
279 OUString &rTableName,
280 OUString &rStartCell,
282 bool bSortStartEndCells =
true )
289 size_t nIdx = rRangeRepresentation.find(
'.' );
290 if (nIdx != std::u16string_view::npos)
292 aTableName = rRangeRepresentation.substr( 0, nIdx );
293 std::u16string_view aRange = rRangeRepresentation.substr( nIdx + 1 );
294 size_t nPos = aRange.find(
':' );
295 if (
nPos != std::u16string_view::npos)
297 aStartCell = aRange.substr( 0,
nPos );
298 aEndCell = aRange.substr(
nPos + 1 );
304 OUString aTmp( aStartCell );
305 aStartCell = aEndCell;
311 aStartCell = aEndCell = aRange;
315 bool bSuccess = !aTableName.isEmpty() &&
316 !aStartCell.isEmpty() && !aEndCell.isEmpty();
319 rTableName = aTableName;
320 rStartCell = aStartCell;
334 for (
size_t i = 0;
i <
nCount && !pTableFormat; ++
i)
337 if(rTableName == rTableFormat.
GetName())
338 pTableFormat = &rTableFormat;
342 *ppTableFormat = pTableFormat;
350 std::u16string_view rRangeRepresentation,
352 std::shared_ptr<SwUnoCursor>& rpUnoCursor )
358 aTableName, aStartCell, aEndCell );
363 *ppTableFormat =
nullptr;
371 if (*ppTableFormat !=
nullptr && (*ppTableFormat)->
GetName() == aTableName)
372 pTableFormat = *ppTableFormat;
376 *ppTableFormat = pTableFormat;
386 pTable ? pTable->
GetTableBox( aStartCell,
true ) :
nullptr;
395 pUnoCursor->SetRemainInSection(
false );
402 pUnoCursor->SetMark();
403 pUnoCursor->GetPoint()->Assign( *pBRBox->
GetSttNd() );
410 rpUnoCursor = pUnoCursor;
417 uno::Sequence< OUString > &rSubRanges,
bool bNormalize )
421 uno::Sequence< OUString > aRanges( nLen );
426 OUString *pRanges = aRanges.getArray();
427 OUString aFirstTable;
429 for( sal_Int32
i = 0;
i < nLen && bRes; ++
i )
432 if (!aRange.isEmpty())
434 pRanges[nCnt] = aRange;
436 OUString aTableName, aStartCell, aEndCell;
438 aTableName, aStartCell, aEndCell ))
445 aStartCell, aEndCell,
true );
450 aFirstTable = aTableName;
452 if (aFirstTable != aTableName) bRes =
false;
458 aRanges.realloc( nCnt );
460 rSubRanges = aRanges;
464static void SortSubranges( uno::Sequence< OUString > &rSubRanges,
bool bCmpByColumn )
466 sal_Int32 nLen = rSubRanges.getLength();
467 OUString *pSubRanges = rSubRanges.getArray();
469 OUString aSmallestTableName;
470 OUString aSmallestStartCell;
471 OUString aSmallestEndCell;
473 for (sal_Int32
i = 0;
i < nLen; ++
i)
475 sal_Int32 nIdxOfSmallest =
i;
477 aSmallestTableName, aSmallestStartCell, aSmallestEndCell );
478 if (aSmallestEndCell.isEmpty())
479 aSmallestEndCell = aSmallestStartCell;
481 for (sal_Int32 k =
i+1; k < nLen; ++k)
488 aTableName, aStartCell, aEndCell );
489 if (aEndCell.isEmpty())
490 aEndCell = aStartCell;
494 aSmallestStartCell, aSmallestEndCell, bCmpByColumn ))
497 aSmallestTableName = aTableName;
498 aSmallestStartCell = aStartCell;
499 aSmallestEndCell = aEndCell;
504 const OUString aTmp( pSubRanges[ nIdxOfSmallest ] );
505 pSubRanges[ nIdxOfSmallest ] = pSubRanges[
i ];
506 pSubRanges[
i ] = aTmp;
521 const uno::Sequence< beans::PropertyValue >& rArguments,
bool bTestOnly )
525 throw lang::DisposedException();
527 uno::Reference< chart2::data::XDataSource > xRes;
530 throw uno::RuntimeException(
"Not connected to a document.");
533 OUString aRangeRepresentation;
534 uno::Sequence< sal_Int32 > aSequenceMapping;
535 bool bFirstIsLabel =
false;
536 bool bDtaSrcIsColumns =
true;
539 OUString aChartOleObjectName;
540 sal_Int32 nArgs = rArguments.getLength();
541 OSL_ENSURE( nArgs != 0,
"no properties provided" );
544 for (
const beans::PropertyValue& rArg : rArguments)
546 if ( rArg.Name ==
"DataRowSource" )
548 chart::ChartDataRowSource eSource;
549 if (!(rArg.Value >>= eSource))
552 if (!(rArg.Value >>= nTmp))
553 throw lang::IllegalArgumentException();
554 eSource =
static_cast< chart::ChartDataRowSource
>( nTmp );
556 bDtaSrcIsColumns = eSource == chart::ChartDataRowSource_COLUMNS;
558 else if ( rArg.Name ==
"FirstCellAsLabel" )
560 if (!(rArg.Value >>= bFirstIsLabel))
561 throw lang::IllegalArgumentException();
563 else if ( rArg.Name ==
"CellRangeRepresentation" )
565 if (!(rArg.Value >>= aRangeRepresentation))
566 throw lang::IllegalArgumentException();
568 else if ( rArg.Name ==
"SequenceMapping" )
570 if (!(rArg.Value >>= aSequenceMapping))
571 throw lang::IllegalArgumentException();
573 else if ( rArg.Name ==
"ChartOleObjectName" )
575 if (!(rArg.Value >>= aChartOleObjectName))
576 throw lang::IllegalArgumentException();
580 uno::Sequence< OUString > aSubRanges;
582 bool bOk =
GetSubranges( aRangeRepresentation, aSubRanges,
true );
584 if (!bOk &&
m_pDoc && !aChartOleObjectName.isEmpty() )
588 OUString aChartTableName;
593 SwNode* pNode = rNodes[nN];
607 if( !aChartTableName.isEmpty() )
613 if (aRangeRepresentation.isEmpty())
616 aRangeRepresentation = aRangeRepresentation.copy( 1 );
629 aChartTableName, aNewStartCell, aNewEndCell,
true );
630 bOk =
GetSubranges( aRangeRepresentation, aSubRanges,
true );
634 throw lang::IllegalArgumentException();
640 std::shared_ptr<SwUnoCursor> pUnoCursor;
641 if (aSubRanges.hasElements())
644 if (!pTableFormat || !pUnoCursor)
645 throw lang::IllegalArgumentException();
658 for (sal_Int32
i = 0;
i < nRows; ++
i)
659 nCols = std::max(nCols,
static_cast<sal_Int32
>(pTable->
GetTabLines()[
i]->GetTabBoxes().
size()));
661 std::vector<std::vector<char>>
aMap(nRows);
662 for (sal_Int32
i = 0;
i < nRows; ++
i)
663 aMap[
i].resize(nCols);
669 for (
const OUString& rSubRange : std::as_const(aSubRanges))
671 OUString aTableName, aStartCell, aEndCell;
673 rSubRange, aTableName, aStartCell, aEndCell );
674 OSL_ENSURE(bOk2,
"failed to get table and start/end cells");
676 sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
679 OSL_ENSURE( nStartRow <= nEndRow && nStartCol <= nEndCol,
680 "cell range not normalized");
683 if( nStartRow < 0 || nEndRow >= nRows ||
684 nStartCol < 0 || nEndCol >= nCols )
686 throw lang::IllegalArgumentException();
688 for (sal_Int32 k1 = nStartRow; k1 <= nEndRow; ++k1)
690 for (sal_Int32 k2 = nStartCol; k2 <= nEndCol; ++k2)
699 sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
700 sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
701 std::vector<sal_Int32> aLabelIdx(oiEnd);
702 std::vector<sal_Int32> aDataStartIdx(oiEnd);
703 std::vector<sal_Int32> aDataLen(oiEnd);
704 for (oi = 0; oi < oiEnd; ++oi)
707 aDataStartIdx[oi] = -1;
711 for (oi = 0; oi < oiEnd; ++oi)
716 char &rChar = bDtaSrcIsColumns ?
aMap[ii][oi] :
aMap[oi][ii];
719 if (rChar ==
'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
728 if (rChar ==
'x' && aDataStartIdx[oi] == -1)
730 aDataStartIdx[oi] = ii;
734 while (ii< iiEnd &&
'x' == (bDtaSrcIsColumns ?
aMap[ii][oi] :
aMap[oi][ii]))
744 if (
'x' == (bDtaSrcIsColumns ?
aMap[ii][oi] :
aMap[oi][ii]))
745 throw lang::IllegalArgumentException();
758 sal_Int32 nNumLDS = 0;
761 for (oi = 0; oi < oiEnd; ++oi)
764 if (aDataStartIdx[oi] != -1 &&
765 (!bFirstIsLabel || aLabelIdx[oi] != -1))
772 throw lang::IllegalArgumentException();
780 uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aLabelSeqs(nNumLDS);
781 uno::Reference<chart2::data::XDataSequence>* pLabelSeqs = aLabelSeqs.getArray();
782 uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aDataSeqs(nNumLDS);
783 uno::Reference<chart2::data::XDataSequence>* pDataSeqs = aDataSeqs.getArray();
784 sal_Int32 nSeqsIdx = 0;
785 for (oi = 0; oi < oiEnd; ++oi)
788 if (!(aDataStartIdx[oi] != -1 &&
789 (!bFirstIsLabel || aLabelIdx[oi] != -1)))
796 if (bDtaSrcIsColumns)
798 aLabelDesc.
nTop = aLabelIdx[oi];
799 aLabelDesc.
nLeft = oi;
803 aDataDesc.
nTop = aDataStartIdx[oi];
804 aDataDesc.
nLeft = oi;
805 aDataDesc.
nBottom = aDataDesc.
nTop + aDataLen[oi] - 1;
810 aLabelDesc.
nTop = oi;
811 aLabelDesc.
nLeft = aLabelIdx[oi];
816 aDataDesc.
nLeft = aDataStartIdx[oi];
818 aDataDesc.
nRight = aDataDesc.
nLeft + aDataLen[oi] - 1;
820 const OUString aBaseName = pTableFormat->
GetName() +
".";
822 OUString aLabelRange;
823 if (aLabelIdx[oi] != -1)
825 aLabelRange = aBaseName
830 OUString aDataRange = aBaseName
835 std::shared_ptr<SwUnoCursor> pLabelUnoCursor;
836 std::shared_ptr<SwUnoCursor> pDataUnoCursor;
843 OSL_ENSURE(pDataUnoCursor,
"pointer to data sequence missing");
846 if (pLabelUnoCursor || pDataUnoCursor)
849 OSL_ENSURE(nSeqsIdx == nNumLDS,
"mismatch between sequence size and num,ber of entries");
852 uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aLDS(nNumLDS);
853 uno::Reference<chart2::data::XLabeledDataSequence>* pLDS = aLDS.getArray();
854 for (sal_Int32
i = 0;
i < nNumLDS; ++
i)
857 pLabeledDtaSeq->setLabel(pLabelSeqs[
i]);
858 pLabeledDtaSeq->setValues(pDataSeqs[
i]);
859 pLDS[
i] = pLabeledDtaSeq;
863 if (aSequenceMapping.hasElements())
865 uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aOld_LDS(aLDS);
866 uno::Reference<chart2::data::XLabeledDataSequence>* pOld_LDS = aOld_LDS.getArray();
868 sal_Int32 nNewCnt = 0;
869 for (sal_Int32 nIdx : std::as_const(aSequenceMapping))
873 if (0 <= nIdx && nIdx < nNumLDS && pOld_LDS[nIdx].is())
875 pLDS[nNewCnt++] = pOld_LDS[nIdx];
878 pOld_LDS[nIdx].clear();
882 for (sal_Int32
i = 0;
i < nNumLDS; ++
i)
884 if (pOld_LDS[
i].is())
885 pLDS[nNewCnt++] = pOld_LDS[
i];
887 OSL_ENSURE(nNewCnt == nNumLDS,
"unexpected size of resulting sequence");
895 const uno::Sequence< beans::PropertyValue >& rArguments )
899 bool bPossible =
true;
904 catch (lang::IllegalArgumentException &)
913 const uno::Sequence< beans::PropertyValue >& rArguments )
929 std::u16string_view rCellRangeRepresentation )
932 if (std::u16string_view::npos == rCellRangeRepresentation.find(
';' ))
935 OUString aTableName, aStartCell, aEndCell;
937 aTableName, aStartCell, aEndCell,
false );
938 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
949 aStartCell, aEndCell,
false );
956 const uno::Reference< chart2::data::XDataSource >& xDataSource )
960 throw lang::DisposedException();
962 uno::Sequence< beans::PropertyValue > aResult;
963 if (!xDataSource.is())
966 const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDS_LDS( xDataSource->getDataSequences() );
967 const uno::Reference< chart2::data::XLabeledDataSequence > *pDS_LDS = aDS_LDS.getConstArray();
968 sal_Int32 nNumDS_LDS = aDS_LDS.getLength();
972 OSL_FAIL(
"XLabeledDataSequence in data source contains 0 entries" );
979 sal_Int32 nTableRows = 0;
980 sal_Int32 nTableCols = 0;
983 std::vector< std::vector< char > >
aMap;
985 uno::Sequence< sal_Int32 > aSequenceMapping( nNumDS_LDS );
986 sal_Int32 *pSequenceMapping = aSequenceMapping.getArray();
988 OUString aCellRanges;
989 sal_Int16 nDtaSrcIsColumns = -1;
990 sal_Int32 nLabelSeqLen = -1;
995 for (sal_Int32 nDS1 = 0; nDS1 < nNumDS_LDS; ++nDS1)
997 uno::Reference< chart2::data::XLabeledDataSequence > xLabeledDataSequence( pDS_LDS[nDS1] );
998 if( !xLabeledDataSequence.is() )
1000 OSL_FAIL(
"got NULL for XLabeledDataSequence from Data source");
1003 const uno::Reference< chart2::data::XDataSequence > xCurLabel = xLabeledDataSequence->getLabel();
1004 const uno::Reference< chart2::data::XDataSequence > xCurValues = xLabeledDataSequence->getValues();
1008 sal_Int32 nCurLabelSeqLen = -1;
1009 sal_Int32 nCurValuesSeqLen = -1;
1011 nCurLabelSeqLen = xCurLabel->getData().getLength();
1012 if (xCurValues.is())
1013 nCurValuesSeqLen = xCurValues->getData().getLength();
1016 if (nLabelSeqLen == -1)
1017 nLabelSeqLen = nCurLabelSeqLen;
1018 if (nLabelSeqLen != nCurLabelSeqLen)
1023 OUString aLabelTableName, aLabelStartCell, aLabelEndCell;
1024 OUString aValuesTableName, aValuesStartCell, aValuesEndCell;
1025 OUString aLabelRange, aValuesRange;
1027 aLabelRange = xCurLabel->getSourceRangeRepresentation();
1028 if (xCurValues.is())
1029 aValuesRange = xCurValues->getSourceRangeRepresentation();
1031 aLabelTableName, aLabelStartCell, aLabelEndCell )) ||
1033 aValuesTableName, aValuesStartCell, aValuesEndCell ))
1039 if (aTableName.isEmpty())
1040 aTableName = aValuesTableName;
1041 if (aTableName.isEmpty() ||
1042 aTableName != aValuesTableName ||
1043 (!aLabelTableName.isEmpty() && aTableName != aLabelTableName))
1051 sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
1052 const OUString aCell( !aLabelStartCell.isEmpty() ? aLabelStartCell : aValuesStartCell );
1053 OSL_ENSURE( !aCell.isEmpty() ,
"start cell missing?" );
1057 sal_Int16 nDirection = -1;
1058 if (nFirstCol == nLastCol && nFirstRow == nLastRow)
1060 OSL_ENSURE( nCurLabelSeqLen == 0 && nCurValuesSeqLen == 1,
1061 "trying to determine 'DataRowSource': something's fishy... should have been a single cell");
1066 if (nFirstCol == nLastCol && nFirstRow != nLastRow)
1068 else if (nFirstCol != nLastCol && nFirstRow == nLastRow)
1072 OSL_FAIL(
"trying to determine 'DataRowSource': unexpected case found" );
1077 if (nDtaSrcIsColumns == -1)
1078 nDtaSrcIsColumns = nDirection;
1079 if (nDtaSrcIsColumns != nDirection)
1081 nDtaSrcIsColumns = -2;
1084 if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
1088 OSL_ENSURE( nDtaSrcIsColumns == 0 ||
1089 nDtaSrcIsColumns == 1,
1090 "unexpected value for 'nDtaSrcIsColumns'" );
1091 pSequenceMapping[nDS1] = nDtaSrcIsColumns ? nFirstCol : nFirstRow;
1100 aMap.resize( nTableRows );
1101 for (sal_Int32
i = 0;
i < nTableRows; ++
i)
1102 aMap[
i].resize( nTableCols );
1104 if (!aLabelStartCell.isEmpty() && !aLabelEndCell.isEmpty())
1106 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
1109 if (nStartRow < 0 || nEndRow >= nTableRows ||
1110 nStartCol < 0 || nEndCol >= nTableCols)
1114 for (sal_Int32
i = nStartRow;
i <= nEndRow; ++
i)
1116 for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
1118 char &rChar =
aMap[
i][k];
1126 if (!aValuesStartCell.isEmpty() && !aValuesEndCell.isEmpty())
1128 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
1131 if (nStartRow < 0 || nEndRow >= nTableRows ||
1132 nStartCol < 0 || nEndCol >= nTableCols)
1136 for (sal_Int32
i = nStartRow;
i <= nEndRow; ++
i)
1138 for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
1140 char &rChar =
aMap[
i][k];
1150#if OSL_DEBUG_LEVEL > 0
1154 sal_Int32 nStartRow = -1, nStartCol = -1, nEndRow = -1, nEndCol = -1;
1159 OSL_ENSURE( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurLabel->getData().getLength()) ||
1160 (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurLabel->getData().getLength()),
1161 "label sequence length does not match range representation!" );
1163 if (xCurValues.is())
1167 OSL_ENSURE( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurValues->getData().getLength()) ||
1168 (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurValues->getData().getLength()),
1169 "value sequence length does not match range representation!" );
1177 const OUString aCellRangeBase = aTableName +
".";
1179 for (sal_Int32
i = 0;
i < nTableRows; ++
i)
1181 for (sal_Int32 k = 0; k < nTableCols; ++k)
1183 if (
aMap[
i][k] !=
'\0')
1186 sal_Int32 nRowIndex1 =
i;
1187 sal_Int32 nColIndex1 = k;
1188 sal_Int32 nRowSubLen = 0;
1189 sal_Int32 nColSubLen = 0;
1190 while (nRowIndex1 < nTableRows &&
aMap[nRowIndex1++][k] !=
'\0')
1194 while (nColIndex1 < nTableCols &&
aMap[
i][nColIndex1] !=
'\0'
1195 &&
aMap[
i + nRowSubLen-1][nColIndex1] !=
'\0')
1201 OUString aEndCell(
sw_GetCellName( k + nColSubLen - 1,
i + nRowSubLen - 1) );
1202 aCurRange = aCellRangeBase + aStartCell +
":" + aEndCell;
1203 if (!aCellRanges.isEmpty())
1205 aCellRanges += aCurRange;
1208 for (sal_Int32 nRowIndex2 = 0; nRowIndex2 < nRowSubLen; ++nRowIndex2)
1209 for (sal_Int32 nColumnIndex2 = 0; nColumnIndex2 < nColSubLen; ++nColumnIndex2)
1210 aMap[
i + nRowIndex2][k + nColumnIndex2] =
'\0';
1216 uno::Sequence< OUString > aSortedRanges;
1219 OUString aSortedCellRanges;
1220 for (
const OUString& rSortedRange : std::as_const(aSortedRanges))
1222 if (!aSortedCellRanges.isEmpty())
1223 aSortedCellRanges +=
";";
1224 aSortedCellRanges += rSortedRange;
1229 uno::Sequence< sal_Int32 > aSortedMapping( aSequenceMapping );
1230 auto [
begin,
end] = asNonConstRange(aSortedMapping);
1232 bool bNeedSequenceMapping =
false;
1233 for (sal_Int32
i = 0;
i < aSequenceMapping.getLength(); ++
i)
1235 auto it = std::find( std::cbegin(aSortedMapping), std::cend(aSortedMapping),
1236 aSequenceMapping[
i] );
1237 pSequenceMapping[
i] = std::distance(std::cbegin(aSortedMapping), it);
1239 if (
i != std::as_const(aSequenceMapping)[
i])
1240 bNeedSequenceMapping =
true;
1245 if (!bNeedSequenceMapping)
1246 aSequenceMapping.realloc(0);
1250 OSL_ENSURE(nLabelSeqLen >= 0 || nLabelSeqLen == -2 ,
1251 "unexpected value for 'nLabelSeqLen'" );
1252 bool bFirstCellIsLabel =
false;
1253 if (nLabelSeqLen > 0)
1254 bFirstCellIsLabel =
true;
1256 OSL_ENSURE( !aSortedCellRanges.isEmpty(),
"CellRangeRepresentation missing" );
1260 auto pResult = aResult.getArray();
1261 sal_Int32 nProps = 0;
1262 pResult[nProps ].Name =
"FirstCellAsLabel";
1263 pResult[nProps++].Value <<= bFirstCellIsLabel;
1264 pResult[nProps ].Name =
"CellRangeRepresentation";
1265 pResult[nProps++].Value <<= aSortedCellRanges;
1266 if (!aBrokenCellRangeForExport.isEmpty())
1268 pResult[nProps ].Name =
"BrokenCellRangeForExport";
1269 pResult[nProps++].Value <<= aBrokenCellRangeForExport;
1271 if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
1273 chart::ChartDataRowSource eDataRowSource = (nDtaSrcIsColumns == 1) ?
1274 chart::ChartDataRowSource_COLUMNS : chart::ChartDataRowSource_ROWS;
1275 pResult[nProps ].Name =
"DataRowSource";
1276 pResult[nProps++].Value <<= eDataRowSource;
1278 if (aSequenceMapping.hasElements())
1280 pResult[nProps ].Name =
"SequenceMapping";
1281 pResult[nProps++].Value <<= aSequenceMapping;
1284 aResult.realloc( nProps );
1290 std::u16string_view rRangeRepresentation,
bool bTestOnly )
1293 throw lang::DisposedException();
1296 std::shared_ptr<SwUnoCursor> pUnoCursor;
1298 &pTableFormat, pUnoCursor );
1299 if (!pTableFormat || !pUnoCursor)
1300 throw lang::IllegalArgumentException();
1307 throw lang::IllegalArgumentException();
1309 OSL_ENSURE( pTableFormat && pUnoCursor,
"table format or cursor missing" );
1310 uno::Reference< chart2::data::XDataSequence > xDataSeq;
1318 const OUString& rRangeRepresentation )
1322 bool bPossible =
true;
1327 catch (lang::IllegalArgumentException &)
1336 const OUString& rRangeRepresentation )
1345 return uno::Reference< sheet::XRangeSelection >();
1348uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
1350 const OUString& ,
const OUString& ,
1353 return uno::Reference<css::chart2::data::XDataSequence>();
1358 bool bMustDispose(
false );
1377 lang::EventObject aEvtObj(
static_cast< chart2::data::XDataProvider *
>(
this) );
1383 const uno::Reference< lang::XEventListener >& rxListener )
1391 const uno::Reference< lang::XEventListener >& rxListener )
1400 return "SwChartDataProvider";
1410 return {
"com.sun.star.chart2.data.DataProvider"};
1416 assert(std::find_if(rVec.begin(), rVec.end(),
1419 return i.get() == rxDataSequence;
1420 }) == rVec.end() &&
"duplicate insert");
1421 rVec.push_back( rxDataSequence );
1427 rVec.erase( std::remove_if(rVec.begin(), rVec.end(),
1430 return i.get() == rxDataSequence;
1436 OSL_ENSURE( pTable,
"table pointer is NULL" );
1450 xRef->setModified(
true );
1461 OSL_ENSURE( pTable,
"table pointer is NULL" );
1471 auto aIt( rVec.begin() );
1472 while (aIt != rVec.end())
1474 bool bNowEmpty =
false;
1475 bool bSeqDisposed =
false;
1484 bNowEmpty = pDataSeq->DeleteBox( rBox );
1486 catch (
const lang::DisposedException&)
1489 bSeqDisposed =
true;
1495 aIt = rVec.erase( aIt );
1496 if (pDataSeq && !bSeqDisposed)
1497 pDataSeq->dispose();
1506 OSL_ENSURE( pTable,
"table pointer is NULL" );
1553 sal_uInt16 nLines,
bool bBehind )
1558 const size_t nBoxes = rBoxes.
size();
1559 if (nBoxes < 1 || nLines < 1)
1565 if (!(pFirstBox && pLastBox))
1568 sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
1572 bool bAddCols =
false;
1573 if (nFirstCol == nLastCol && nFirstRow != nLastRow)
1575 if (nFirstCol != nLastCol && nFirstRow != nLastRow)
1579 sal_Int32 nFirstNewCol = nFirstCol;
1580 sal_Int32 nFirstNewRow = bBehind ? nFirstRow + 1 : nFirstRow - nLines;
1583 OSL_ENSURE( nFirstCol == nLastCol,
"column indices seem broken" );
1584 nFirstNewCol = bBehind ? nFirstCol + 1 : nFirstCol - nLines;
1585 nFirstNewRow = nFirstRow;
1595 const sal_Int32 nLen = pDataSeq->getTextualData().getLength();
1599 pDataSeq->FillRangeDesc( aDesc );
1601 chart::ChartDataRowSource eDRSource = chart::ChartDataRowSource_COLUMNS;
1603 eDRSource = chart::ChartDataRowSource_ROWS;
1605 if (!bAddCols && eDRSource == chart::ChartDataRowSource_COLUMNS)
1608 pDataSeq->ExtendTo(
true, nFirstNewRow, nLines );
1610 else if (bAddCols && eDRSource == chart::ChartDataRowSource_ROWS)
1613 pDataSeq->ExtendTo(
false, nFirstNewCol, nLines );
1625 throw lang::DisposedException();
1627 if (rRangeRepresentation.isEmpty())
1630 OUStringBuffer aRes;
1634 SwTable* pFirstFoundTable =
nullptr;
1637 const OUString aRange( rRangeRepresentation.getToken(0,
';',
nPos) );
1639 std::shared_ptr<SwUnoCursor> pCursor;
1642 throw lang::IllegalArgumentException();
1645 throw uno::RuntimeException(
"Table too complex.");
1648 if (!pFirstFoundTable)
1649 pFirstFoundTable = pTable;
1650 if (pTable != pFirstFoundTable)
1651 throw lang::IllegalArgumentException();
1653 OUString aTableName;
1654 OUString aStartCell;
1657 throw lang::IllegalArgumentException();
1659 sal_Int32 nCol, nRow;
1661 if (nCol < 0 || nRow < 0)
1662 throw uno::RuntimeException(
"Cell not found.");
1671 if (aStartCell != aEndCell && !aEndCell.isEmpty())
1674 if (nCol < 0 || nRow < 0)
1675 throw uno::RuntimeException(
"Cell not found.");
1682 if (!aRes.isEmpty())
1688 return aRes.makeStringAndClear();
1695 throw lang::DisposedException();
1697 if (rXMLRange.isEmpty())
1700 OUStringBuffer aRes;
1704 OUString aFirstFoundTable;
1708 OUString aRange( rXMLRange.getToken(0,
' ',
nPos) );
1715 if (aFirstFoundTable.isEmpty())
1717 if (aCellRange.
aTableName != aFirstFoundTable)
1718 throw lang::IllegalArgumentException();
1720 OUString aTmp = aCellRange.
aTableName +
"." +
1730 if (!aRes.isEmpty())
1736 return aRes.makeStringAndClear();
1740 const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > &rLDS ) :
1757 return "SwChartDataSource";
1767 return {
"com.sun.star.chart2.data.DataSource" };
1773 const std::shared_ptr<SwUnoCursor>& pTableCursor ) :
1774 m_pFormat(&rTableFormat),
1775 m_aRowLabelText(
SwResId( STR_CHART2_ROW_LABEL_TEXT ) ),
1776 m_aColLabelText(
SwResId( STR_CHART2_COL_LABEL_TEXT ) ),
1777 m_xDataProvider( &rProvider ),
1778 m_pTableCursor( pTableCursor ),
1791 m_xDataProvider->addEventListener(
static_cast< lang::XEventListener *
>(
this) );
1794 OSL_FAIL(
"table missing" );
1797 catch (uno::RuntimeException &)
1802 catch (uno::Exception &)
1807#if OSL_DEBUG_LEVEL > 0
1811 OSL_ENSURE(pUnoTableCursor,
"SwChartDataSequence: cursor not SwUnoTableCursor");
1818 m_pFormat( rObj.m_pFormat ),
1820 m_aRowLabelText(
SwResId(STR_CHART2_ROW_LABEL_TEXT) ),
1821 m_aColLabelText(
SwResId(STR_CHART2_COL_LABEL_TEXT) ),
1822 m_xDataProvider( rObj.m_xDataProvider ),
1823 m_pTableCursor( rObj.m_pTableCursor ),
1824 m_pPropSet( rObj.m_pPropSet )
1837 m_xDataProvider->addEventListener(
static_cast< lang::XEventListener *
>(
this) );
1840 OSL_FAIL(
"table missing" );
1843 catch (uno::RuntimeException &)
1848 catch (uno::Exception &)
1853#if OSL_DEBUG_LEVEL > 0
1857 OSL_ENSURE(pUnoTableCursor,
"SwChartDataSequence: cursor not SwUnoTableCursor");
1869 throw lang::DisposedException();
1876 OSL_ENSURE( !aCellRange.isEmpty(),
"failed to get cell range" );
1877 aRes = pTableFormat->
GetName() +
"." + aCellRange;
1883 chart2::data::LabelOrigin eLabelOrigin )
1887 throw lang::DisposedException();
1889 uno::Sequence< OUString > aLabels;
1896 throw uno::RuntimeException(
"No table format found.");
1899 throw uno::RuntimeException(
"No table found.");
1901 throw uno::RuntimeException(
"Table too complex.");
1904 OSL_ENSURE( !aCellRange.isEmpty(),
"failed to get cell range" );
1906 OSL_ENSURE( bOk,
"failed to get SwRangeDescriptor" );
1911 sal_Int32 nColSpan = aDesc.
nRight - aDesc.
nLeft + 1;
1912 sal_Int32 nRowSpan = aDesc.
nBottom - aDesc.
nTop + 1;
1913 OSL_ENSURE( nColSpan == 1 || nRowSpan == 1,
1914 "unexpected range of selected cells" );
1917 bool bReturnEmptyText =
false;
1918 bool bUseCol =
true;
1919 if (eLabelOrigin == chart2::data::LabelOrigin_COLUMN)
1921 else if (eLabelOrigin == chart2::data::LabelOrigin_ROW)
1923 else if (eLabelOrigin == chart2::data::LabelOrigin_SHORT_SIDE)
1925 bUseCol = nColSpan < nRowSpan;
1926 bReturnEmptyText = nColSpan == nRowSpan;
1928 else if (eLabelOrigin == chart2::data::LabelOrigin_LONG_SIDE)
1930 bUseCol = nColSpan > nRowSpan;
1931 bReturnEmptyText = nColSpan == nRowSpan;
1934 OSL_FAIL(
"unexpected case" );
1939 sal_Int32 nSeqLen = bUseCol ? nColSpan : nRowSpan;
1940 aLabels.realloc( nSeqLen );
1941 OUString *
pLabels = aLabels.getArray();
1942 for (sal_Int32
i = 0;
i < nSeqLen; ++
i)
1944 if (!bReturnEmptyText)
1947 sal_Int32 nCol = aDesc.
nLeft;
1948 sal_Int32 nRow = aDesc.
nTop;
1955 sal_Int32 nLen = aCellName.getLength();
1960 while (pBuf < pEnd && (
'0' > *pBuf || *pBuf >
'9'))
1963 if (pBuf < pEnd && (
'0' <= *pBuf && *pBuf <=
'9'))
1966 std::u16string_view aNew;
1969 aRplc =
"%COLUMNLETTER";
1970 aNew = aCellName.subView(0, pBuf - aCellName.getStr());
1974 aRplc =
"%ROWNUMBER";
1975 aNew = std::u16string_view(pBuf, (aCellName.getStr() + nLen) - pBuf);
1977 aText = aText.replaceFirst( aRplc, aNew );
1998 throw lang::DisposedException();
2001 return std::vector< css::uno::Reference< css::table::XCell > >();
2003 if(pTable->IsTableComplex())
2004 return std::vector< css::uno::Reference< css::table::XCell > >();
2007 return std::vector< css::uno::Reference< css::table::XCell > >();
2015 uno::Sequence< OUString > vTextData(vCells.size());
2016 std::transform(vCells.begin(),
2018 vTextData.getArray(),
2019 [] (
decltype(vCells)::value_type& xCell)
2020 { return static_cast<SwXCell*>(xCell.get())->getString(); });
2030 uno::Sequence< uno::Any > vAnyData(vCells.size());
2031 std::transform(vCells.begin(),
2033 vAnyData.getArray(),
2034 [] (
decltype(vCells)::value_type& xCell)
2035 { return static_cast<SwXCell*>(xCell.get())->GetAny(); });
2038 catch (
const lang::DisposedException&)
2042 return uno::Sequence< uno::Any >{};
2049 uno::Sequence< double > vNumData(vCells.size());
2050 std::transform(vCells.begin(),
2052 vNumData.getArray(),
2053 [] (
decltype(vCells)::value_type& xCell)
2054 { return static_cast<SwXCell*>(xCell.get())->GetForcedNumericalValue(); });
2062 throw lang::DisposedException();
2070 throw lang::DisposedException();
2077 const OUString& rPropertyName,
2082 throw lang::DisposedException();
2085 throw beans::UnknownPropertyException(rPropertyName);
2088 throw lang::IllegalArgumentException();
2092 const OUString& rPropertyName )
2096 throw lang::DisposedException();
2099 throw beans::UnknownPropertyException(rPropertyName);
2106 const uno::Reference< beans::XPropertyChangeListener >& )
2108 OSL_FAIL(
"not implemented" );
2113 const uno::Reference< beans::XPropertyChangeListener >& )
2115 OSL_FAIL(
"not implemented" );
2120 const uno::Reference< beans::XVetoableChangeListener >& )
2122 OSL_FAIL(
"not implemented" );
2127 const uno::Reference< beans::XVetoableChangeListener >& )
2129 OSL_FAIL(
"not implemented" );
2134 return "SwChartDataSequence";
2144 return {
"com.sun.star.chart2.data.DataSequence" };
2149 if(rHint.
GetId() == SfxHintId::Dying)
2157 else if (rHint.
GetId() == SfxHintId::SwLegacyModify)
2167 throw lang::DisposedException();
2177 throw lang::DisposedException();
2184 const uno::Reference< util::XModifyListener >& rxListener )
2192 const uno::Reference< util::XModifyListener >& rxListener )
2202 throw lang::DisposedException();
2211 bool bMustDispose(
false );
2230 OSL_FAIL(
"table missing" );
2258 lang::EventObject aEvtObj(
static_cast< chart2::data::XDataSequence *
>(
this) );
2265 const uno::Reference< lang::XEventListener >& rxListener )
2273 const uno::Reference< lang::XEventListener >& rxListener )
2283 throw lang::DisposedException();
2286 bool bNowEmpty =
false;
2298 else if (pPointStartNode == rBox.
GetSttNd() || pMarkStartNode == rBox.
GetSttNd())
2300 sal_Int32 nPointRow = -1, nPointCol = -1;
2301 sal_Int32 nMarkRow = -1, nMarkCol = -1;
2308 OSL_ENSURE( nPointRow >= 0 && nPointCol >= 0,
"invalid row and col" );
2309 OSL_ENSURE( nMarkRow >= 0 && nMarkCol >= 0,
"invalid row and col" );
2312 OSL_ENSURE( nPointRow == nMarkRow || nPointCol == nMarkCol,
2313 "row/col indices not matching" );
2314 OSL_ENSURE( nPointRow != nMarkRow || nPointCol != nMarkCol,
2315 "point and mark are identical" );
2316 bool bMoveVertical = (nPointCol == nMarkCol);
2317 bool bMoveHorizontal = (nPointRow == nMarkRow);
2320 bool bMoveLeft =
false;
2321 bool bMoveUp =
false;
2324 if (pPointStartNode == rBox.
GetSttNd())
2325 bMoveUp = nPointRow > nMarkRow;
2327 bMoveUp = nMarkRow > nPointRow;
2329 else if (bMoveHorizontal)
2331 if (pPointStartNode == rBox.
GetSttNd())
2332 bMoveLeft = nPointCol > nMarkCol;
2334 bMoveLeft = nMarkCol > nPointCol;
2337 OSL_FAIL(
"neither vertical nor horizontal movement" );
2341 sal_Int32 nRow = (pPointStartNode == rBox.
GetSttNd()) ? nPointRow : nMarkRow;
2342 sal_Int32 nCol = (pPointStartNode == rBox.
GetSttNd()) ? nPointCol : nMarkCol;
2344 nRow += bMoveUp ? -1 : +1;
2345 if (bMoveHorizontal)
2346 nCol += bMoveLeft ? -1 : +1;
2375 OSL_FAIL(
"neither point nor mark available for change" );
2379 OSL_FAIL(
"failed to get position" );
2414 sal_Int32 nFirstNew, sal_Int32 nCount )
2417 if (!pUnoTableCursor)
2426 if (
nCount < 1 || nFirstNew < 0 || pTable->IsTableComplex())
2433 const OUString aEndBox( pEndBox->
GetName() );
2437 const OUString aStartBox( pStartBox->
GetName() );
2441 OUString sDescrip = aStartBox +
":" + aEndBox;
2444 bool bChanged =
false;
2445 OUString aNewStartCell;
2446 OUString aNewEndCell;
2447 if (bExtendCol && aDesc.
nBottom + 1 == nFirstNew)
2451 OSL_ENSURE( aDesc.
nLeft == aDesc.
nRight,
"data-sequence is not a column" );
2456 else if (bExtendCol && aDesc.
nTop -
nCount == nFirstNew)
2460 OSL_ENSURE( aDesc.
nLeft == aDesc.
nRight,
"data-sequence is not a column" );
2465 else if (!bExtendCol && aDesc.
nRight + 1 == nFirstNew)
2469 OSL_ENSURE( aDesc.
nTop == aDesc.
nBottom,
"data-sequence is not a row" );
2474 else if (!bExtendCol && aDesc.
nLeft -
nCount == nFirstNew)
2478 OSL_ENSURE( aDesc.
nTop == aDesc.
nBottom,
"data-sequence is not a row" );
2510 throw lang::DisposedException();
2515 uno::Reference< chart2::data::XDataSequence >& rxDest,
2516 const uno::Reference< chart2::data::XDataSequence >& rxSource)
2518 uno::Reference< util::XModifyListener > xML(
this);
2519 uno::Reference< lang::XEventListener > xEL(
this);
2522 uno::Reference< util::XModifyBroadcaster > xMB( rxDest, uno::UNO_QUERY );
2524 xMB->removeModifyListener( xML );
2525 uno::Reference< lang::XComponent > xC( rxDest, uno::UNO_QUERY );
2527 xC->removeEventListener( xEL );
2532 xC.set( rxDest, uno::UNO_QUERY );
2534 xC->addEventListener( xEL );
2535 xMB.set( rxDest, uno::UNO_QUERY );
2537 xMB->addModifyListener( xML );
2541 const uno::Reference< chart2::data::XDataSequence >& rxSequence )
2545 throw lang::DisposedException();
2559 throw lang::DisposedException();
2564 const uno::Reference< chart2::data::XDataSequence >& rxSequence )
2568 throw lang::DisposedException();
2582 throw lang::DisposedException();
2584 uno::Reference< util::XCloneable > xDataCloneable(
m_xData, uno::UNO_QUERY );
2585 uno::Reference< util::XCloneable > xLabelsCloneable(
m_xLabels, uno::UNO_QUERY );
2587 if (xDataCloneable.is())
2589 uno::Reference< chart2::data::XDataSequence > xDataClone( xDataCloneable->createClone(), uno::UNO_QUERY );
2590 pRes->setValues( xDataClone );
2593 if (xLabelsCloneable.is())
2595 uno::Reference< chart2::data::XDataSequence > xLabelsClone( xLabelsCloneable->createClone(), uno::UNO_QUERY );
2596 pRes->setLabel( xLabelsClone );
2603 return "SwChartLabeledDataSequence";
2607 const OUString& rServiceName )
2614 return {
"com.sun.star.chart2.data.LabeledDataSequence" };
2618 const lang::EventObject& rSource )
2621 uno::Reference< uno::XInterface > xRef( rSource.Source );
2634 const lang::EventObject& rEvent )
2643 const uno::Reference< util::XModifyListener >& rxListener )
2651 const uno::Reference< util::XModifyListener >& rxListener )
2660 bool bMustDispose(
false );
2672 lang::EventObject aEvtObj(
static_cast< chart2::data::XLabeledDataSequence *
>(
this) );
2680 const uno::Reference< lang::XEventListener >& rxListener )
2688 const uno::Reference< lang::XEventListener >& rxListener )
virtual SwChartLockController_Helper & GetChartControllerHelper()=0
returns chart controller helper that is used to lock/unlock all charts when relevant parts of tables ...
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
bool StartListening(SvtBroadcaster &rBroadcaster)
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListeners
void InvalidateTable(const SwTable *pTable, bool bImmediate=false)
void RemoveDataSequence(const SwTable &rTable, rtl::Reference< SwChartDataSequence > const &rxDataSequence)
SwChartDataProvider(const SwChartDataProvider &)=delete
virtual sal_Bool SAL_CALL createDataSourcePossible(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByValueArray(const OUString &aRole, const OUString &aRangeRepresentation, const OUString &aRoleQualifier) override
css::uno::Reference< css::chart2::data::XDataSource > Impl_createDataSource(const css::uno::Sequence< css::beans::PropertyValue > &aArguments, bool bTestOnly=false)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual void SAL_CALL dispose() override
virtual OUString SAL_CALL convertRangeToXML(const OUString &aRangeRepresentation) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
css::uno::Reference< css::chart2::data::XDataSequence > Impl_createDataSequenceByRangeRepresentation(std::u16string_view aRangeRepresentation, bool bTestOnly=false)
virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const OUString &aRangeRepresentation) override
virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource) override
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override
virtual OUString SAL_CALL convertRangeFromXML(const OUString &aXMLRange) override
void AddRowCols(const SwTable &rTable, const SwSelBoxes &rBoxes, sal_uInt16 nLines, bool bBehind)
SwChartDataProvider::AddRowCols tries to notify charts of added columns or rows and extends the value...
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
static OUString GetBrokenCellRangeForExport(std::u16string_view rCellRangeRepresentation)
Fix for #i79009 we need to return a property that has the same value as the property 'CellRangeRepres...
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const OUString &aRangeRepresentation) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ~SwChartDataProvider() override
void AddDataSequence(const SwTable &rTable, rtl::Reference< SwChartDataSequence > const &rxDataSequence)
virtual OUString SAL_CALL getImplementationName() override
Map_Set_DataSequenceRef_t m_aDataSequences
void DisposeAllDataSequences(const SwTable *pTable)
void DeleteBox(const SwTable *pTable, const SwTableBox &rBox)
std::vector< unotools::WeakReference< SwChartDataSequence > > Vec_DataSequenceRef_t
void ExtendTo(bool bExtendCol, sal_Int32 nFirstNew, sal_Int32 nCount)
Extends the data-sequence by new cells added at the end of the direction the data-sequence points to.
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEvtListeners
virtual css::uno::Sequence< OUString > SAL_CALL getTextualData() override
virtual void Notify(const SfxHint &rHint) override
std::vector< css::uno::Reference< css::table::XCell > > GetCells()
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
const SfxItemPropertySet * m_pPropSet
virtual OUString SAL_CALL getImplementationName() override
::comphelper::OInterfaceContainerHelper4< css::util::XModifyListener > m_aModifyListeners
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
SwFrameFormat * GetFrameFormat() const
SwFrameFormat * m_pFormat
virtual css::uno::Sequence< double > SAL_CALL getNumericalData() override
virtual void SAL_CALL setModified(sal_Bool bModified) override
virtual OUString SAL_CALL getSourceRangeRepresentation() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
void FillRangeDesc(SwRangeDescriptor &rRangeDesc) const
virtual void SAL_CALL dispose() override
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getData() override
bool DeleteBox(const SwTableBox &rBox)
css::chart2::data::DataSequenceRole m_aRole
SwChartDataSequence(const SwChartDataSequence &rObj)
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
sw::UnoCursorPointer m_pTableCursor
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
rtl::Reference< SwChartDataProvider > m_xDataProvider
virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex(::sal_Int32 nIndex) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual ~SwChartDataSequence() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Bool SAL_CALL isModified() override
virtual css::uno::Sequence< OUString > SAL_CALL generateLabel(css::chart2::data::LabelOrigin eLabelOrigin) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
SwChartDataSource(const SwChartDataSource &)=delete
virtual OUString SAL_CALL getImplementationName() override
virtual ~SwChartDataSource() override
css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > m_aLDS
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override
static void DoUpdateAllCharts(SwDoc *pDoc)
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL dispose() override
SwChartLabeledDataSequence()
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::chart2::data::XDataSequence > m_xData
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getLabel() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
::comphelper::OInterfaceContainerHelper4< css::util::XModifyListener > m_aModifyListeners
virtual void SAL_CALL setValues(const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListeners
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL setLabel(const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence) override
virtual ~SwChartLabeledDataSequence() override
css::uno::Reference< css::chart2::data::XDataSequence > m_xLabels
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
void SetDataSequence(css::uno::Reference< css::chart2::data::XDataSequence > &rxDest, const css::uno::Reference< css::chart2::data::XDataSequence > &rxSource)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getValues() override
void StartOrContinueLocking()
SwChartLockController_Helper(const SwChartLockController_Helper &)=delete
~SwChartLockController_Helper()
void LockUnlockAllCharts(bool bLock)
size_t GetTableFrameFormatCount(bool bUsed) const
IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
SwTableFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Marks a node in the document model.
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset nIdx)
Base class of the Writer document model elements.
SwStartNode * GetStartNode()
SwNodeOffset GetIndex() const
const SwStartNode * FindTableBoxStartNode() const
const SwStartNode * StartOfSectionNode() const
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
SwContentNode * GetContentNode()
const SwEndNode * EndOfSectionNode() const
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
SwContentNode * GoNext(SwNodeIndex *) const
SwNodeOffset Count() const
const SwOLEObj & GetOLEObj() const
const OUString & GetChartTableName() const
svt::EmbeddedObjectRef & GetObject()
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
const OUString & GetCurrentPersistName() const
const SwPosition * GetMark() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
const SwPosition * GetPoint() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Starts a section of nodes in the document model.
SwTableBox is one table cell in the document model.
const SwStartNode * GetSttNd() const
void DeleteBox(size_t nPos)
size_t GetSelectedBoxesCount() const
SwTableBoxes & GetTabBoxes()
SwTableLine * front() const
SwTable is one table in the document model, containing rows (which contain cells).
SwTableLines & GetTabLines()
SwTableFormat * GetFrameFormat()
bool IsTableComplex() const
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
static SwTable * FindTable(SwFrameFormat const *const pFormat)
static ::rtl::Reference< SwXCellRange > CreateXCellRange(const sw::UnoCursorPointer &pCursor, SwFrameFormat &rFrameFormat, SwRangeDescriptor const &rDesc)
static void GetCellPosition(std::u16string_view aCellName, sal_Int32 &o_rColumn, sal_Int32 &o_rRow)
get position of a cell with a given name
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event) const
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
const Value & back() const
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
void reset(std::shared_ptr< SwUnoCursor > pNew)
#define suppress_fun_call_w_exception(expr)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define LINK(Instance, Class, Member)
OUString getXMLStringFromCellRange(const CellRange &rRange)
CellRange getCellRangeFromXMLString(const OUString &rXMLString)
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
enumrange< T >::Iterator begin(enumrange< T >)
HashMap_OWString_Interface aMap
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
std::unique_ptr< uint8_t[]> pLabels
Marks a position in the document model.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
OUString SwResId(TranslateId aId)
IMPL_LINK_NOARG(SwChartLockController_Helper, DoUnlockAllCharts, Timer *, void)
static void SortSubranges(uno::Sequence< OUString > &rSubRanges, bool bCmpByColumn)
static bool GetSubranges(std::u16string_view rRangeRepresentation, uno::Sequence< OUString > &rSubRanges, bool bNormalize)
static bool GetTableAndCellsFromRangeRep(std::u16string_view rRangeRepresentation, OUString &rTableName, OUString &rStartCell, OUString &rEndCell, bool bSortStartEndCells=true)
static OUString GetCellRangeName(const SwFrameFormat &rTableFormat, SwUnoCursor &rTableCursor)
static void GetTableByName(const SwDoc &rDoc, std::u16string_view rTableName, SwFrameFormat **ppTableFormat, SwTable **ppTable)
static void GetFormatAndCreateCursorFromRangeRep(const SwDoc *pDoc, std::u16string_view rRangeRepresentation, SwFrameFormat **ppTableFormat, std::shared_ptr< SwUnoCursor > &rpUnoCursor)
static std::mutex & GetChartMutex()
static OUString GetRangeRepFromTableAndCells(std::u16string_view rTableName, std::u16string_view rStartCell, std::u16string_view rEndCell, bool bForceEndCellName)
static void LaunchModifiedEvent(::comphelper::OInterfaceContainerHelper4< util::XModifyListener > &rICH, const uno::Reference< uno::XInterface > &rxI)
bool FillRangeDescriptor(SwRangeDescriptor &rDesc, std::u16string_view rCellRangeName)
rCellRangeName needs to be of one of the following formats:
cppu::WeakImplHelper< css::chart2::data::XDataSequence, css::chart2::data::XTextualDataSequence, css::chart2::data::XNumericalDataSequence, css::util::XCloneable, css::beans::XPropertySet, css::lang::XServiceInfo, css::util::XModifiable, css::lang::XEventListener, css::lang::XComponent > SwChartDataSequenceBaseClass
SwUnoPropertyMapProvider aSwMapProvider
#define PROPERTY_MAP_CHART2_DATA_SEQUENCE
constexpr OUStringLiteral UNO_NAME_ROLE
void sw_NormalizeRange(OUString &rCell1, OUString &rCell2)
cleanup order in a range
int sw_CompareCellsByColFirst(std::u16string_view aCellName1, std::u16string_view aCellName2)
compare position of two cells (check columns first)
OUString sw_GetCellName(sal_Int32 nColumn, sal_Int32 nRow)
get cell name at a specified coordinate
int sw_CompareCellRanges(std::u16string_view aRange1StartCell, std::u16string_view aRange1EndCell, std::u16string_view aRange2StartCell, std::u16string_view aRange2EndCell, bool bCmpColsFirst)
compare position of two cell ranges