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>
36#include <unoprnms.hxx>
73 uno::Reference< util::XModifiable > xModif( xIP->getComponent(), uno::UNO_QUERY_THROW );
74 xModif->setModified(
true );
76 catch ( uno::Exception& )
88 , m_aUnlockTimer(
"sw::SwChartLockController_Helper aUnlockTimer" )
89 , m_bIsLocked( false )
120 uno::Reference< frame::XModel > xRes;
133 xRes.set( xIP->getComponent(), uno::UNO_QUERY );
137 xRes->lockControllers();
139 xRes->unlockControllers();
162 const uno::Reference< uno::XInterface > &rxI )
164 lang::EventObject aEvtObj( rxI );
166 rICH.
notifyEach( aGuard, &util::XModifyListener::modified, aEvtObj );
176 std::u16string_view rCellRangeName )
178 sal_Int32
nToken = std::u16string_view::npos == rCellRangeName.find(
'.') ? 0 : 1;
180 OUString aTLName(
o3tl::getToken(aCellRangeNoTableName, 0,
':') );
181 OUString aBRName(
o3tl::getToken(aCellRangeNoTableName, 1,
':') );
182 if(aTLName.isEmpty() || aBRName.isEmpty())
189 OSL_ENSURE( rDesc.
nTop != -1 &&
193 "failed to get range descriptor" );
195 "invalid range descriptor");
206 if (!pUnoTableCursor)
226 OSL_ENSURE( pStartBox,
"start box not found" );
227 OSL_ENSURE( pEndBox,
"end box not found" );
240 aRes = pStartBox->
GetName() +
":";
251 std::u16string_view rStartCell, std::u16string_view rEndCell,
252 bool bForceEndCellName )
254 OSL_ENSURE( !rTableName.empty(),
"table name missing" );
255 OSL_ENSURE( !rStartCell.empty(),
"cell name missing" );
256 OUString aRes = OUString::Concat(rTableName) +
"." + rStartCell;
258 if (!rEndCell.empty())
260 aRes += OUString::Concat(
":") + rEndCell;
262 else if (bForceEndCellName)
264 aRes += OUString::Concat(
":") + rStartCell;
271 std::u16string_view rRangeRepresentation,
272 OUString &rTableName,
273 OUString &rStartCell,
275 bool bSortStartEndCells =
true )
282 size_t nIdx = rRangeRepresentation.find(
'.' );
283 if (nIdx != std::u16string_view::npos)
285 aTableName = rRangeRepresentation.substr( 0, nIdx );
286 std::u16string_view aRange = rRangeRepresentation.substr( nIdx + 1 );
287 size_t nPos = aRange.find(
':' );
288 if (
nPos != std::u16string_view::npos)
290 aStartCell = aRange.substr( 0,
nPos );
291 aEndCell = aRange.substr(
nPos + 1 );
297 OUString aTmp( aStartCell );
298 aStartCell = aEndCell;
304 aStartCell = aEndCell = aRange;
308 bool bSuccess = !aTableName.isEmpty() &&
309 !aStartCell.isEmpty() && !aEndCell.isEmpty();
312 rTableName = aTableName;
313 rStartCell = aStartCell;
327 for (
size_t i = 0;
i <
nCount && !pTableFormat; ++
i)
330 if(rTableName == rTableFormat.
GetName())
331 pTableFormat = &rTableFormat;
335 *ppTableFormat = pTableFormat;
343 std::u16string_view rRangeRepresentation,
345 std::shared_ptr<SwUnoCursor>& rpUnoCursor )
351 aTableName, aStartCell, aEndCell );
356 *ppTableFormat =
nullptr;
364 if (*ppTableFormat !=
nullptr && (*ppTableFormat)->
GetName() == aTableName)
365 pTableFormat = *ppTableFormat;
369 *ppTableFormat = pTableFormat;
379 pTable ? pTable->
GetTableBox( aStartCell,
true ) :
nullptr;
388 pUnoCursor->SetRemainInSection(
false );
395 pUnoCursor->SetMark();
396 pUnoCursor->GetPoint()->Assign( *pBRBox->
GetSttNd() );
403 rpUnoCursor = pUnoCursor;
410 uno::Sequence< OUString > &rSubRanges,
bool bNormalize )
414 uno::Sequence< OUString > aRanges( nLen );
419 OUString *pRanges = aRanges.getArray();
420 OUString aFirstTable;
422 for( sal_Int32
i = 0;
i < nLen && bRes; ++
i )
425 if (!aRange.isEmpty())
427 pRanges[nCnt] = aRange;
429 OUString aTableName, aStartCell, aEndCell;
431 aTableName, aStartCell, aEndCell ))
438 aStartCell, aEndCell,
true );
443 aFirstTable = aTableName;
445 if (aFirstTable != aTableName) bRes =
false;
451 aRanges.realloc( nCnt );
453 rSubRanges = aRanges;
457static void SortSubranges( uno::Sequence< OUString > &rSubRanges,
bool bCmpByColumn )
459 sal_Int32 nLen = rSubRanges.getLength();
460 OUString *pSubRanges = rSubRanges.getArray();
462 OUString aSmallestTableName;
463 OUString aSmallestStartCell;
464 OUString aSmallestEndCell;
466 for (sal_Int32
i = 0;
i < nLen; ++
i)
468 sal_Int32 nIdxOfSmallest =
i;
470 aSmallestTableName, aSmallestStartCell, aSmallestEndCell );
471 if (aSmallestEndCell.isEmpty())
472 aSmallestEndCell = aSmallestStartCell;
474 for (sal_Int32 k =
i+1; k < nLen; ++k)
481 aTableName, aStartCell, aEndCell );
482 if (aEndCell.isEmpty())
483 aEndCell = aStartCell;
487 aSmallestStartCell, aSmallestEndCell, bCmpByColumn ))
490 aSmallestTableName = aTableName;
491 aSmallestStartCell = aStartCell;
492 aSmallestEndCell = aEndCell;
497 const OUString aTmp( pSubRanges[ nIdxOfSmallest ] );
498 pSubRanges[ nIdxOfSmallest ] = pSubRanges[
i ];
499 pSubRanges[
i ] = aTmp;
514 const uno::Sequence< beans::PropertyValue >& rArguments,
bool bTestOnly )
518 throw lang::DisposedException();
520 uno::Reference< chart2::data::XDataSource > xRes;
523 throw uno::RuntimeException(
"Not connected to a document.");
526 OUString aRangeRepresentation;
527 uno::Sequence< sal_Int32 > aSequenceMapping;
528 bool bFirstIsLabel =
false;
529 bool bDtaSrcIsColumns =
true;
532 OUString aChartOleObjectName;
533 sal_Int32 nArgs = rArguments.getLength();
534 OSL_ENSURE( nArgs != 0,
"no properties provided" );
537 for (
const beans::PropertyValue& rArg : rArguments)
539 if ( rArg.Name ==
"DataRowSource" )
541 chart::ChartDataRowSource eSource;
542 if (!(rArg.Value >>= eSource))
545 if (!(rArg.Value >>= nTmp))
546 throw lang::IllegalArgumentException();
547 eSource =
static_cast< chart::ChartDataRowSource
>( nTmp );
549 bDtaSrcIsColumns = eSource == chart::ChartDataRowSource_COLUMNS;
551 else if ( rArg.Name ==
"FirstCellAsLabel" )
553 if (!(rArg.Value >>= bFirstIsLabel))
554 throw lang::IllegalArgumentException();
556 else if ( rArg.Name ==
"CellRangeRepresentation" )
558 if (!(rArg.Value >>= aRangeRepresentation))
559 throw lang::IllegalArgumentException();
561 else if ( rArg.Name ==
"SequenceMapping" )
563 if (!(rArg.Value >>= aSequenceMapping))
564 throw lang::IllegalArgumentException();
566 else if ( rArg.Name ==
"ChartOleObjectName" )
568 if (!(rArg.Value >>= aChartOleObjectName))
569 throw lang::IllegalArgumentException();
573 uno::Sequence< OUString > aSubRanges;
575 bool bOk =
GetSubranges( aRangeRepresentation, aSubRanges,
true );
577 if (!bOk &&
m_pDoc && !aChartOleObjectName.isEmpty() )
581 OUString aChartTableName;
586 SwNode* pNode = rNodes[nN];
600 if( !aChartTableName.isEmpty() )
606 if (aRangeRepresentation.isEmpty())
609 aRangeRepresentation = aRangeRepresentation.copy( 1 );
622 aChartTableName, aNewStartCell, aNewEndCell,
true );
623 bOk =
GetSubranges( aRangeRepresentation, aSubRanges,
true );
627 throw lang::IllegalArgumentException();
633 std::shared_ptr<SwUnoCursor> pUnoCursor;
634 if (aSubRanges.hasElements())
637 if (!pTableFormat || !pUnoCursor)
638 throw lang::IllegalArgumentException();
651 for (sal_Int32
i = 0;
i < nRows; ++
i)
652 nCols = std::max(nCols,
static_cast<sal_Int32
>(pTable->
GetTabLines()[
i]->GetTabBoxes().
size()));
654 std::vector<std::vector<char>>
aMap(nRows);
655 for (sal_Int32
i = 0;
i < nRows; ++
i)
656 aMap[
i].resize(nCols);
662 for (
const OUString& rSubRange : std::as_const(aSubRanges))
664 OUString aTableName, aStartCell, aEndCell;
666 rSubRange, aTableName, aStartCell, aEndCell );
667 OSL_ENSURE(bOk2,
"failed to get table and start/end cells");
669 sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
672 OSL_ENSURE( nStartRow <= nEndRow && nStartCol <= nEndCol,
673 "cell range not normalized");
676 if( nStartRow < 0 || nEndRow >= nRows ||
677 nStartCol < 0 || nEndCol >= nCols )
679 throw lang::IllegalArgumentException();
681 for (sal_Int32 k1 = nStartRow; k1 <= nEndRow; ++k1)
683 for (sal_Int32 k2 = nStartCol; k2 <= nEndCol; ++k2)
692 sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
693 sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
694 std::vector<sal_Int32> aLabelIdx(oiEnd);
695 std::vector<sal_Int32> aDataStartIdx(oiEnd);
696 std::vector<sal_Int32> aDataLen(oiEnd);
697 for (oi = 0; oi < oiEnd; ++oi)
700 aDataStartIdx[oi] = -1;
704 for (oi = 0; oi < oiEnd; ++oi)
709 char &rChar = bDtaSrcIsColumns ?
aMap[ii][oi] :
aMap[oi][ii];
712 if (rChar ==
'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
721 if (rChar ==
'x' && aDataStartIdx[oi] == -1)
723 aDataStartIdx[oi] = ii;
727 while (ii< iiEnd &&
'x' == (bDtaSrcIsColumns ?
aMap[ii][oi] :
aMap[oi][ii]))
737 if (
'x' == (bDtaSrcIsColumns ?
aMap[ii][oi] :
aMap[oi][ii]))
738 throw lang::IllegalArgumentException();
751 sal_Int32 nNumLDS = 0;
754 for (oi = 0; oi < oiEnd; ++oi)
757 if (aDataStartIdx[oi] != -1 &&
758 (!bFirstIsLabel || aLabelIdx[oi] != -1))
765 throw lang::IllegalArgumentException();
773 uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aLabelSeqs(nNumLDS);
774 uno::Reference<chart2::data::XDataSequence>* pLabelSeqs = aLabelSeqs.getArray();
775 uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aDataSeqs(nNumLDS);
776 uno::Reference<chart2::data::XDataSequence>* pDataSeqs = aDataSeqs.getArray();
777 sal_Int32 nSeqsIdx = 0;
778 for (oi = 0; oi < oiEnd; ++oi)
781 if (!(aDataStartIdx[oi] != -1 &&
782 (!bFirstIsLabel || aLabelIdx[oi] != -1)))
789 if (bDtaSrcIsColumns)
791 aLabelDesc.
nTop = aLabelIdx[oi];
792 aLabelDesc.
nLeft = oi;
796 aDataDesc.
nTop = aDataStartIdx[oi];
797 aDataDesc.
nLeft = oi;
798 aDataDesc.
nBottom = aDataDesc.
nTop + aDataLen[oi] - 1;
803 aLabelDesc.
nTop = oi;
804 aLabelDesc.
nLeft = aLabelIdx[oi];
809 aDataDesc.
nLeft = aDataStartIdx[oi];
811 aDataDesc.
nRight = aDataDesc.
nLeft + aDataLen[oi] - 1;
813 const OUString aBaseName = pTableFormat->
GetName() +
".";
815 OUString aLabelRange;
816 if (aLabelIdx[oi] != -1)
818 aLabelRange = aBaseName
823 OUString aDataRange = aBaseName
828 std::shared_ptr<SwUnoCursor> pLabelUnoCursor;
829 std::shared_ptr<SwUnoCursor> pDataUnoCursor;
836 OSL_ENSURE(pDataUnoCursor,
"pointer to data sequence missing");
839 if (pLabelUnoCursor || pDataUnoCursor)
842 OSL_ENSURE(nSeqsIdx == nNumLDS,
"mismatch between sequence size and num,ber of entries");
845 uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aLDS(nNumLDS);
846 uno::Reference<chart2::data::XLabeledDataSequence>* pLDS = aLDS.getArray();
847 for (sal_Int32
i = 0;
i < nNumLDS; ++
i)
850 pLabeledDtaSeq->setLabel(pLabelSeqs[
i]);
851 pLabeledDtaSeq->setValues(pDataSeqs[
i]);
852 pLDS[
i] = pLabeledDtaSeq;
856 if (aSequenceMapping.hasElements())
858 uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aOld_LDS(aLDS);
859 uno::Reference<chart2::data::XLabeledDataSequence>* pOld_LDS = aOld_LDS.getArray();
861 sal_Int32 nNewCnt = 0;
862 for (sal_Int32 nIdx : std::as_const(aSequenceMapping))
866 if (0 <= nIdx && nIdx < nNumLDS && pOld_LDS[nIdx].is())
868 pLDS[nNewCnt++] = pOld_LDS[nIdx];
871 pOld_LDS[nIdx].clear();
875 for (sal_Int32
i = 0;
i < nNumLDS; ++
i)
877 if (pOld_LDS[
i].is())
878 pLDS[nNewCnt++] = pOld_LDS[
i];
880 OSL_ENSURE(nNewCnt == nNumLDS,
"unexpected size of resulting sequence");
888 const uno::Sequence< beans::PropertyValue >& rArguments )
892 bool bPossible =
true;
897 catch (lang::IllegalArgumentException &)
906 const uno::Sequence< beans::PropertyValue >& rArguments )
922 std::u16string_view rCellRangeRepresentation )
925 if (std::u16string_view::npos == rCellRangeRepresentation.find(
';' ))
928 OUString aTableName, aStartCell, aEndCell;
930 aTableName, aStartCell, aEndCell,
false );
931 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
942 aStartCell, aEndCell,
false );
949 const uno::Reference< chart2::data::XDataSource >& xDataSource )
953 throw lang::DisposedException();
955 uno::Sequence< beans::PropertyValue > aResult;
956 if (!xDataSource.is())
959 const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDS_LDS( xDataSource->getDataSequences() );
960 const uno::Reference< chart2::data::XLabeledDataSequence > *pDS_LDS = aDS_LDS.getConstArray();
961 sal_Int32 nNumDS_LDS = aDS_LDS.getLength();
965 OSL_FAIL(
"XLabeledDataSequence in data source contains 0 entries" );
972 sal_Int32 nTableRows = 0;
973 sal_Int32 nTableCols = 0;
976 std::vector< std::vector< char > >
aMap;
978 uno::Sequence< sal_Int32 > aSequenceMapping( nNumDS_LDS );
979 sal_Int32 *pSequenceMapping = aSequenceMapping.getArray();
981 OUString aCellRanges;
982 sal_Int16 nDtaSrcIsColumns = -1;
983 sal_Int32 nLabelSeqLen = -1;
988 for (sal_Int32 nDS1 = 0; nDS1 < nNumDS_LDS; ++nDS1)
990 uno::Reference< chart2::data::XLabeledDataSequence > xLabeledDataSequence( pDS_LDS[nDS1] );
991 if( !xLabeledDataSequence.is() )
993 OSL_FAIL(
"got NULL for XLabeledDataSequence from Data source");
996 const uno::Reference< chart2::data::XDataSequence > xCurLabel = xLabeledDataSequence->getLabel();
997 const uno::Reference< chart2::data::XDataSequence > xCurValues = xLabeledDataSequence->getValues();
1001 sal_Int32 nCurLabelSeqLen = -1;
1002 sal_Int32 nCurValuesSeqLen = -1;
1004 nCurLabelSeqLen = xCurLabel->getData().getLength();
1005 if (xCurValues.is())
1006 nCurValuesSeqLen = xCurValues->getData().getLength();
1009 if (nLabelSeqLen == -1)
1010 nLabelSeqLen = nCurLabelSeqLen;
1011 if (nLabelSeqLen != nCurLabelSeqLen)
1016 OUString aLabelTableName, aLabelStartCell, aLabelEndCell;
1017 OUString aValuesTableName, aValuesStartCell, aValuesEndCell;
1018 OUString aLabelRange, aValuesRange;
1020 aLabelRange = xCurLabel->getSourceRangeRepresentation();
1021 if (xCurValues.is())
1022 aValuesRange = xCurValues->getSourceRangeRepresentation();
1024 aLabelTableName, aLabelStartCell, aLabelEndCell )) ||
1026 aValuesTableName, aValuesStartCell, aValuesEndCell ))
1032 if (aTableName.isEmpty())
1033 aTableName = aValuesTableName;
1034 if (aTableName.isEmpty() ||
1035 aTableName != aValuesTableName ||
1036 (!aLabelTableName.isEmpty() && aTableName != aLabelTableName))
1044 sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
1045 const OUString aCell( !aLabelStartCell.isEmpty() ? aLabelStartCell : aValuesStartCell );
1046 OSL_ENSURE( !aCell.isEmpty() ,
"start cell missing?" );
1050 sal_Int16 nDirection = -1;
1051 if (nFirstCol == nLastCol && nFirstRow == nLastRow)
1053 OSL_ENSURE( nCurLabelSeqLen == 0 && nCurValuesSeqLen == 1,
1054 "trying to determine 'DataRowSource': something's fishy... should have been a single cell");
1059 if (nFirstCol == nLastCol && nFirstRow != nLastRow)
1061 else if (nFirstCol != nLastCol && nFirstRow == nLastRow)
1065 OSL_FAIL(
"trying to determine 'DataRowSource': unexpected case found" );
1070 if (nDtaSrcIsColumns == -1)
1071 nDtaSrcIsColumns = nDirection;
1072 if (nDtaSrcIsColumns != nDirection)
1074 nDtaSrcIsColumns = -2;
1077 if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
1081 OSL_ENSURE( nDtaSrcIsColumns == 0 ||
1082 nDtaSrcIsColumns == 1,
1083 "unexpected value for 'nDtaSrcIsColumns'" );
1084 pSequenceMapping[nDS1] = nDtaSrcIsColumns ? nFirstCol : nFirstRow;
1093 aMap.resize( nTableRows );
1094 for (sal_Int32
i = 0;
i < nTableRows; ++
i)
1095 aMap[
i].resize( nTableCols );
1097 if (!aLabelStartCell.isEmpty() && !aLabelEndCell.isEmpty())
1099 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
1102 if (nStartRow < 0 || nEndRow >= nTableRows ||
1103 nStartCol < 0 || nEndCol >= nTableCols)
1107 for (sal_Int32
i = nStartRow;
i <= nEndRow; ++
i)
1109 for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
1111 char &rChar =
aMap[
i][k];
1119 if (!aValuesStartCell.isEmpty() && !aValuesEndCell.isEmpty())
1121 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
1124 if (nStartRow < 0 || nEndRow >= nTableRows ||
1125 nStartCol < 0 || nEndCol >= nTableCols)
1129 for (sal_Int32
i = nStartRow;
i <= nEndRow; ++
i)
1131 for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
1133 char &rChar =
aMap[
i][k];
1143#if OSL_DEBUG_LEVEL > 0
1147 sal_Int32 nStartRow = -1, nStartCol = -1, nEndRow = -1, nEndCol = -1;
1152 OSL_ENSURE( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurLabel->getData().getLength()) ||
1153 (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurLabel->getData().getLength()),
1154 "label sequence length does not match range representation!" );
1156 if (xCurValues.is())
1160 OSL_ENSURE( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurValues->getData().getLength()) ||
1161 (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurValues->getData().getLength()),
1162 "value sequence length does not match range representation!" );
1170 const OUString aCellRangeBase = aTableName +
".";
1172 for (sal_Int32
i = 0;
i < nTableRows; ++
i)
1174 for (sal_Int32 k = 0; k < nTableCols; ++k)
1176 if (
aMap[
i][k] !=
'\0')
1179 sal_Int32 nRowIndex1 =
i;
1180 sal_Int32 nColIndex1 = k;
1181 sal_Int32 nRowSubLen = 0;
1182 sal_Int32 nColSubLen = 0;
1183 while (nRowIndex1 < nTableRows &&
aMap[nRowIndex1++][k] !=
'\0')
1187 while (nColIndex1 < nTableCols &&
aMap[
i][nColIndex1] !=
'\0'
1188 &&
aMap[
i + nRowSubLen-1][nColIndex1] !=
'\0')
1194 OUString aEndCell(
sw_GetCellName( k + nColSubLen - 1,
i + nRowSubLen - 1) );
1195 aCurRange = aCellRangeBase + aStartCell +
":" + aEndCell;
1196 if (!aCellRanges.isEmpty())
1198 aCellRanges += aCurRange;
1201 for (sal_Int32 nRowIndex2 = 0; nRowIndex2 < nRowSubLen; ++nRowIndex2)
1202 for (sal_Int32 nColumnIndex2 = 0; nColumnIndex2 < nColSubLen; ++nColumnIndex2)
1203 aMap[
i + nRowIndex2][k + nColumnIndex2] =
'\0';
1209 uno::Sequence< OUString > aSortedRanges;
1212 OUString aSortedCellRanges;
1213 for (
const OUString& rSortedRange : std::as_const(aSortedRanges))
1215 if (!aSortedCellRanges.isEmpty())
1216 aSortedCellRanges +=
";";
1217 aSortedCellRanges += rSortedRange;
1222 uno::Sequence< sal_Int32 > aSortedMapping( aSequenceMapping );
1223 auto [
begin,
end] = asNonConstRange(aSortedMapping);
1225 bool bNeedSequenceMapping =
false;
1226 for (sal_Int32
i = 0;
i < aSequenceMapping.getLength(); ++
i)
1228 auto it = std::find( std::cbegin(aSortedMapping), std::cend(aSortedMapping),
1229 aSequenceMapping[
i] );
1230 pSequenceMapping[
i] = std::distance(std::cbegin(aSortedMapping), it);
1232 if (
i != std::as_const(aSequenceMapping)[
i])
1233 bNeedSequenceMapping =
true;
1238 if (!bNeedSequenceMapping)
1239 aSequenceMapping.realloc(0);
1243 OSL_ENSURE(nLabelSeqLen >= 0 || nLabelSeqLen == -2 ,
1244 "unexpected value for 'nLabelSeqLen'" );
1245 bool bFirstCellIsLabel =
false;
1246 if (nLabelSeqLen > 0)
1247 bFirstCellIsLabel =
true;
1249 OSL_ENSURE( !aSortedCellRanges.isEmpty(),
"CellRangeRepresentation missing" );
1253 auto pResult = aResult.getArray();
1254 sal_Int32 nProps = 0;
1255 pResult[nProps ].Name =
"FirstCellAsLabel";
1256 pResult[nProps++].Value <<= bFirstCellIsLabel;
1257 pResult[nProps ].Name =
"CellRangeRepresentation";
1258 pResult[nProps++].Value <<= aSortedCellRanges;
1259 if (!aBrokenCellRangeForExport.isEmpty())
1261 pResult[nProps ].Name =
"BrokenCellRangeForExport";
1262 pResult[nProps++].Value <<= aBrokenCellRangeForExport;
1264 if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
1266 chart::ChartDataRowSource eDataRowSource = (nDtaSrcIsColumns == 1) ?
1267 chart::ChartDataRowSource_COLUMNS : chart::ChartDataRowSource_ROWS;
1268 pResult[nProps ].Name =
"DataRowSource";
1269 pResult[nProps++].Value <<= eDataRowSource;
1271 if (aSequenceMapping.hasElements())
1273 pResult[nProps ].Name =
"SequenceMapping";
1274 pResult[nProps++].Value <<= aSequenceMapping;
1277 aResult.realloc( nProps );
1283 std::u16string_view rRangeRepresentation,
bool bTestOnly )
1286 throw lang::DisposedException();
1289 std::shared_ptr<SwUnoCursor> pUnoCursor;
1291 &pTableFormat, pUnoCursor );
1292 if (!pTableFormat || !pUnoCursor)
1293 throw lang::IllegalArgumentException();
1300 throw lang::IllegalArgumentException();
1302 OSL_ENSURE( pTableFormat && pUnoCursor,
"table format or cursor missing" );
1303 uno::Reference< chart2::data::XDataSequence > xDataSeq;
1311 const OUString& rRangeRepresentation )
1315 bool bPossible =
true;
1320 catch (lang::IllegalArgumentException &)
1329 const OUString& rRangeRepresentation )
1338 return uno::Reference< sheet::XRangeSelection >();
1341uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
1343 const OUString& ,
const OUString& ,
1346 return uno::Reference<css::chart2::data::XDataSequence>();
1351 bool bMustDispose(
false );
1370 lang::EventObject aEvtObj(
static_cast< chart2::data::XDataProvider *
>(
this) );
1376 const uno::Reference< lang::XEventListener >& rxListener )
1384 const uno::Reference< lang::XEventListener >& rxListener )
1393 return "SwChartDataProvider";
1403 return {
"com.sun.star.chart2.data.DataProvider"};
1409 assert(std::find_if(rVec.begin(), rVec.end(),
1412 return i.get() == rxDataSequence;
1413 }) == rVec.end() &&
"duplicate insert");
1414 rVec.push_back( rxDataSequence );
1420 rVec.erase( std::remove_if(rVec.begin(), rVec.end(),
1423 return i.get() == rxDataSequence;
1429 OSL_ENSURE( pTable,
"table pointer is NULL" );
1443 xRef->setModified(
true );
1454 OSL_ENSURE( pTable,
"table pointer is NULL" );
1464 auto aIt( rVec.begin() );
1465 while (aIt != rVec.end())
1467 bool bNowEmpty =
false;
1468 bool bSeqDisposed =
false;
1477 bNowEmpty = pDataSeq->DeleteBox( rBox );
1479 catch (
const lang::DisposedException&)
1482 bSeqDisposed =
true;
1488 aIt = rVec.erase( aIt );
1489 if (pDataSeq && !bSeqDisposed)
1490 pDataSeq->dispose();
1499 OSL_ENSURE( pTable,
"table pointer is NULL" );
1546 sal_uInt16 nLines,
bool bBehind )
1551 const size_t nBoxes = rBoxes.
size();
1552 if (nBoxes < 1 || nLines < 1)
1558 if (!(pFirstBox && pLastBox))
1561 sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
1565 bool bAddCols =
false;
1566 if (nFirstCol == nLastCol && nFirstRow != nLastRow)
1568 if (nFirstCol != nLastCol && nFirstRow != nLastRow)
1572 sal_Int32 nFirstNewCol = nFirstCol;
1573 sal_Int32 nFirstNewRow = bBehind ? nFirstRow + 1 : nFirstRow - nLines;
1576 OSL_ENSURE( nFirstCol == nLastCol,
"column indices seem broken" );
1577 nFirstNewCol = bBehind ? nFirstCol + 1 : nFirstCol - nLines;
1578 nFirstNewRow = nFirstRow;
1588 const sal_Int32 nLen = pDataSeq->getTextualData().getLength();
1592 pDataSeq->FillRangeDesc( aDesc );
1594 chart::ChartDataRowSource eDRSource = chart::ChartDataRowSource_COLUMNS;
1596 eDRSource = chart::ChartDataRowSource_ROWS;
1598 if (!bAddCols && eDRSource == chart::ChartDataRowSource_COLUMNS)
1601 pDataSeq->ExtendTo(
true, nFirstNewRow, nLines );
1603 else if (bAddCols && eDRSource == chart::ChartDataRowSource_ROWS)
1606 pDataSeq->ExtendTo(
false, nFirstNewCol, nLines );
1618 throw lang::DisposedException();
1620 if (rRangeRepresentation.isEmpty())
1623 OUStringBuffer aRes;
1627 SwTable* pFirstFoundTable =
nullptr;
1630 const OUString aRange( rRangeRepresentation.getToken(0,
';',
nPos) );
1632 std::shared_ptr<SwUnoCursor> pCursor;
1635 throw lang::IllegalArgumentException();
1638 throw uno::RuntimeException(
"Table too complex.");
1641 if (!pFirstFoundTable)
1642 pFirstFoundTable = pTable;
1643 if (pTable != pFirstFoundTable)
1644 throw lang::IllegalArgumentException();
1646 OUString aTableName;
1647 OUString aStartCell;
1650 throw lang::IllegalArgumentException();
1652 sal_Int32 nCol, nRow;
1654 if (nCol < 0 || nRow < 0)
1655 throw uno::RuntimeException(
"Cell not found.");
1664 if (aStartCell != aEndCell && !aEndCell.isEmpty())
1667 if (nCol < 0 || nRow < 0)
1668 throw uno::RuntimeException(
"Cell not found.");
1675 if (!aRes.isEmpty())
1681 return aRes.makeStringAndClear();
1688 throw lang::DisposedException();
1690 if (rXMLRange.isEmpty())
1693 OUStringBuffer aRes;
1697 OUString aFirstFoundTable;
1701 OUString aRange( rXMLRange.getToken(0,
' ',
nPos) );
1708 if (aFirstFoundTable.isEmpty())
1710 if (aCellRange.
aTableName != aFirstFoundTable)
1711 throw lang::IllegalArgumentException();
1713 OUString aTmp = aCellRange.
aTableName +
"." +
1723 if (!aRes.isEmpty())
1729 return aRes.makeStringAndClear();
1733 const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > &rLDS ) :
1750 return "SwChartDataSource";
1760 return {
"com.sun.star.chart2.data.DataSource" };
1766 const std::shared_ptr<SwUnoCursor>& pTableCursor ) :
1767 m_pFormat(&rTableFormat),
1768 m_aRowLabelText(
SwResId( STR_CHART2_ROW_LABEL_TEXT ) ),
1769 m_aColLabelText(
SwResId( STR_CHART2_COL_LABEL_TEXT ) ),
1770 m_xDataProvider( &rProvider ),
1771 m_pTableCursor( pTableCursor ),
1784 m_xDataProvider->addEventListener(
static_cast< lang::XEventListener *
>(
this) );
1787 OSL_FAIL(
"table missing" );
1790 catch (uno::RuntimeException &)
1795 catch (uno::Exception &)
1800#if OSL_DEBUG_LEVEL > 0
1804 OSL_ENSURE(pUnoTableCursor,
"SwChartDataSequence: cursor not SwUnoTableCursor");
1811 m_pFormat( rObj.m_pFormat ),
1813 m_aRowLabelText(
SwResId(STR_CHART2_ROW_LABEL_TEXT) ),
1814 m_aColLabelText(
SwResId(STR_CHART2_COL_LABEL_TEXT) ),
1815 m_xDataProvider( rObj.m_xDataProvider ),
1816 m_pTableCursor( rObj.m_pTableCursor ),
1817 m_pPropSet( rObj.m_pPropSet )
1830 m_xDataProvider->addEventListener(
static_cast< lang::XEventListener *
>(
this) );
1833 OSL_FAIL(
"table missing" );
1836 catch (uno::RuntimeException &)
1841 catch (uno::Exception &)
1846#if OSL_DEBUG_LEVEL > 0
1850 OSL_ENSURE(pUnoTableCursor,
"SwChartDataSequence: cursor not SwUnoTableCursor");
1862 throw lang::DisposedException();
1869 OSL_ENSURE( !aCellRange.isEmpty(),
"failed to get cell range" );
1870 aRes = pTableFormat->
GetName() +
"." + aCellRange;
1876 chart2::data::LabelOrigin eLabelOrigin )
1880 throw lang::DisposedException();
1882 uno::Sequence< OUString > aLabels;
1889 throw uno::RuntimeException(
"No table format found.");
1892 throw uno::RuntimeException(
"No table found.");
1894 throw uno::RuntimeException(
"Table too complex.");
1897 OSL_ENSURE( !aCellRange.isEmpty(),
"failed to get cell range" );
1899 OSL_ENSURE( bOk,
"failed to get SwRangeDescriptor" );
1904 sal_Int32 nColSpan = aDesc.
nRight - aDesc.
nLeft + 1;
1905 sal_Int32 nRowSpan = aDesc.
nBottom - aDesc.
nTop + 1;
1906 OSL_ENSURE( nColSpan == 1 || nRowSpan == 1,
1907 "unexpected range of selected cells" );
1910 bool bReturnEmptyText =
false;
1911 bool bUseCol =
true;
1912 if (eLabelOrigin == chart2::data::LabelOrigin_COLUMN)
1914 else if (eLabelOrigin == chart2::data::LabelOrigin_ROW)
1916 else if (eLabelOrigin == chart2::data::LabelOrigin_SHORT_SIDE)
1918 bUseCol = nColSpan < nRowSpan;
1919 bReturnEmptyText = nColSpan == nRowSpan;
1921 else if (eLabelOrigin == chart2::data::LabelOrigin_LONG_SIDE)
1923 bUseCol = nColSpan > nRowSpan;
1924 bReturnEmptyText = nColSpan == nRowSpan;
1927 OSL_FAIL(
"unexpected case" );
1932 sal_Int32 nSeqLen = bUseCol ? nColSpan : nRowSpan;
1933 aLabels.realloc( nSeqLen );
1934 OUString *
pLabels = aLabels.getArray();
1935 for (sal_Int32
i = 0;
i < nSeqLen; ++
i)
1937 if (!bReturnEmptyText)
1940 sal_Int32 nCol = aDesc.
nLeft;
1941 sal_Int32 nRow = aDesc.
nTop;
1948 sal_Int32 nLen = aCellName.getLength();
1953 while (pBuf < pEnd && (
'0' > *pBuf || *pBuf >
'9'))
1956 if (pBuf < pEnd && (
'0' <= *pBuf && *pBuf <=
'9'))
1959 std::u16string_view aNew;
1962 aRplc =
"%COLUMNLETTER";
1963 aNew = aCellName.subView(0, pBuf - aCellName.getStr());
1967 aRplc =
"%ROWNUMBER";
1968 aNew = std::u16string_view(pBuf, (aCellName.getStr() + nLen) - pBuf);
1970 aText = aText.replaceFirst( aRplc, aNew );
1991 throw lang::DisposedException();
1994 return std::vector< css::uno::Reference< css::table::XCell > >();
1996 if(pTable->IsTableComplex())
1997 return std::vector< css::uno::Reference< css::table::XCell > >();
2000 return std::vector< css::uno::Reference< css::table::XCell > >();
2008 uno::Sequence< OUString > vTextData(vCells.size());
2009 std::transform(vCells.begin(),
2011 vTextData.getArray(),
2012 [] (
decltype(vCells)::value_type& xCell)
2013 { return static_cast<SwXCell*>(xCell.get())->getString(); });
2021 uno::Sequence< uno::Any > vAnyData(vCells.size());
2022 std::transform(vCells.begin(),
2024 vAnyData.getArray(),
2025 [] (
decltype(vCells)::value_type& xCell)
2026 { return static_cast<SwXCell*>(xCell.get())->GetAny(); });
2034 uno::Sequence< double > vNumData(vCells.size());
2035 std::transform(vCells.begin(),
2037 vNumData.getArray(),
2038 [] (
decltype(vCells)::value_type& xCell)
2039 { return static_cast<SwXCell*>(xCell.get())->GetForcedNumericalValue(); });
2047 throw lang::DisposedException();
2055 throw lang::DisposedException();
2062 const OUString& rPropertyName,
2067 throw lang::DisposedException();
2070 throw beans::UnknownPropertyException(rPropertyName);
2073 throw lang::IllegalArgumentException();
2077 const OUString& rPropertyName )
2081 throw lang::DisposedException();
2084 throw beans::UnknownPropertyException(rPropertyName);
2091 const uno::Reference< beans::XPropertyChangeListener >& )
2093 OSL_FAIL(
"not implemented" );
2098 const uno::Reference< beans::XPropertyChangeListener >& )
2100 OSL_FAIL(
"not implemented" );
2105 const uno::Reference< beans::XVetoableChangeListener >& )
2107 OSL_FAIL(
"not implemented" );
2112 const uno::Reference< beans::XVetoableChangeListener >& )
2114 OSL_FAIL(
"not implemented" );
2119 return "SwChartDataSequence";
2129 return {
"com.sun.star.chart2.data.DataSequence" };
2134 if(rHint.
GetId() == SfxHintId::Dying)
2142 else if (rHint.
GetId() == SfxHintId::SwLegacyModify)
2152 throw lang::DisposedException();
2162 throw lang::DisposedException();
2169 const uno::Reference< util::XModifyListener >& rxListener )
2177 const uno::Reference< util::XModifyListener >& rxListener )
2187 throw lang::DisposedException();
2196 bool bMustDispose(
false );
2215 OSL_FAIL(
"table missing" );
2243 lang::EventObject aEvtObj(
static_cast< chart2::data::XDataSequence *
>(
this) );
2250 const uno::Reference< lang::XEventListener >& rxListener )
2258 const uno::Reference< lang::XEventListener >& rxListener )
2268 throw lang::DisposedException();
2271 bool bNowEmpty =
false;
2283 else if (pPointStartNode == rBox.
GetSttNd() || pMarkStartNode == rBox.
GetSttNd())
2285 sal_Int32 nPointRow = -1, nPointCol = -1;
2286 sal_Int32 nMarkRow = -1, nMarkCol = -1;
2293 OSL_ENSURE( nPointRow >= 0 && nPointCol >= 0,
"invalid row and col" );
2294 OSL_ENSURE( nMarkRow >= 0 && nMarkCol >= 0,
"invalid row and col" );
2297 OSL_ENSURE( nPointRow == nMarkRow || nPointCol == nMarkCol,
2298 "row/col indices not matching" );
2299 OSL_ENSURE( nPointRow != nMarkRow || nPointCol != nMarkCol,
2300 "point and mark are identical" );
2301 bool bMoveVertical = (nPointCol == nMarkCol);
2302 bool bMoveHorizontal = (nPointRow == nMarkRow);
2305 bool bMoveLeft =
false;
2306 bool bMoveUp =
false;
2309 if (pPointStartNode == rBox.
GetSttNd())
2310 bMoveUp = nPointRow > nMarkRow;
2312 bMoveUp = nMarkRow > nPointRow;
2314 else if (bMoveHorizontal)
2316 if (pPointStartNode == rBox.
GetSttNd())
2317 bMoveLeft = nPointCol > nMarkCol;
2319 bMoveLeft = nMarkCol > nPointCol;
2322 OSL_FAIL(
"neither vertical nor horizontal movement" );
2326 sal_Int32 nRow = (pPointStartNode == rBox.
GetSttNd()) ? nPointRow : nMarkRow;
2327 sal_Int32 nCol = (pPointStartNode == rBox.
GetSttNd()) ? nPointCol : nMarkCol;
2329 nRow += bMoveUp ? -1 : +1;
2330 if (bMoveHorizontal)
2331 nCol += bMoveLeft ? -1 : +1;
2360 OSL_FAIL(
"neither point nor mark available for change" );
2364 OSL_FAIL(
"failed to get position" );
2399 sal_Int32 nFirstNew, sal_Int32 nCount )
2402 if (!pUnoTableCursor)
2411 if (
nCount < 1 || nFirstNew < 0 || pTable->IsTableComplex())
2418 const OUString aEndBox( pEndBox->
GetName() );
2422 const OUString aStartBox( pStartBox->
GetName() );
2426 OUString sDescrip = aStartBox +
":" + aEndBox;
2429 bool bChanged =
false;
2430 OUString aNewStartCell;
2431 OUString aNewEndCell;
2432 if (bExtendCol && aDesc.
nBottom + 1 == nFirstNew)
2436 OSL_ENSURE( aDesc.
nLeft == aDesc.
nRight,
"data-sequence is not a column" );
2441 else if (bExtendCol && aDesc.
nTop -
nCount == nFirstNew)
2445 OSL_ENSURE( aDesc.
nLeft == aDesc.
nRight,
"data-sequence is not a column" );
2450 else if (!bExtendCol && aDesc.
nRight + 1 == nFirstNew)
2454 OSL_ENSURE( aDesc.
nTop == aDesc.
nBottom,
"data-sequence is not a row" );
2459 else if (!bExtendCol && aDesc.
nLeft -
nCount == nFirstNew)
2463 OSL_ENSURE( aDesc.
nTop == aDesc.
nBottom,
"data-sequence is not a row" );
2495 throw lang::DisposedException();
2500 uno::Reference< chart2::data::XDataSequence >& rxDest,
2501 const uno::Reference< chart2::data::XDataSequence >& rxSource)
2503 uno::Reference< util::XModifyListener > xML(
this);
2504 uno::Reference< lang::XEventListener > xEL(
this);
2507 uno::Reference< util::XModifyBroadcaster > xMB( rxDest, uno::UNO_QUERY );
2509 xMB->removeModifyListener( xML );
2510 uno::Reference< lang::XComponent > xC( rxDest, uno::UNO_QUERY );
2512 xC->removeEventListener( xEL );
2517 xC.set( rxDest, uno::UNO_QUERY );
2519 xC->addEventListener( xEL );
2520 xMB.set( rxDest, uno::UNO_QUERY );
2522 xMB->addModifyListener( xML );
2526 const uno::Reference< chart2::data::XDataSequence >& rxSequence )
2530 throw lang::DisposedException();
2544 throw lang::DisposedException();
2549 const uno::Reference< chart2::data::XDataSequence >& rxSequence )
2553 throw lang::DisposedException();
2567 throw lang::DisposedException();
2569 uno::Reference< util::XCloneable > xDataCloneable(
m_xData, uno::UNO_QUERY );
2570 uno::Reference< util::XCloneable > xLabelsCloneable(
m_xLabels, uno::UNO_QUERY );
2572 if (xDataCloneable.is())
2574 uno::Reference< chart2::data::XDataSequence > xDataClone( xDataCloneable->createClone(), uno::UNO_QUERY );
2575 pRes->setValues( xDataClone );
2578 if (xLabelsCloneable.is())
2580 uno::Reference< chart2::data::XDataSequence > xLabelsClone( xLabelsCloneable->createClone(), uno::UNO_QUERY );
2581 pRes->setLabel( xLabelsClone );
2588 return "SwChartLabeledDataSequence";
2592 const OUString& rServiceName )
2599 return {
"com.sun.star.chart2.data.LabeledDataSequence" };
2603 const lang::EventObject& rSource )
2606 uno::Reference< uno::XInterface > xRef( rSource.Source );
2619 const lang::EventObject& rEvent )
2628 const uno::Reference< util::XModifyListener >& rxListener )
2636 const uno::Reference< util::XModifyListener >& rxListener )
2645 bool bMustDispose(
false );
2657 lang::EventObject aEvtObj(
static_cast< chart2::data::XLabeledDataSequence *
>(
this) );
2665 const uno::Reference< lang::XEventListener >& rxListener )
2673 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)
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Marks a node in the document model.
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
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
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
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
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 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