21 #include <string_view>
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>
45 #include <strings.hrc>
60 while(
nullptr != (pStNd = aIdx.GetNode().
GetStartNode()) )
63 if (
nullptr != ( pONd = aIdx.GetNode().
GetOLENode() ) &&
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;
124 while(
nullptr != (pStNd = aIdx.GetNode().
GetStartNode()) )
127 if (
nullptr != ( pONd = aIdx.GetNode().
GetOLENode() ) &&
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;
179 std::u16string_view aCellRangeNoTableName(
o3tl::getToken(rCellRangeName, nToken,
'.' ) );
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()->nNode = *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 )
424 const OUString aRange(
o3tl::getToken(rRangeRepresentation, 0,
';', nPos ) );
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;
457 static 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();
648 std::vector<std::vector<char>>
aMap(nRows);
649 for (sal_Int32
i = 0;
i < nRows; ++
i)
650 aMap[
i].resize(nCols);
656 for (
const OUString& rSubRange : std::as_const(aSubRanges))
658 OUString aTableName, aStartCell, aEndCell;
660 rSubRange, aTableName, aStartCell, aEndCell );
661 OSL_ENSURE(bOk2,
"failed to get table and start/end cells");
663 sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
666 OSL_ENSURE( nStartRow <= nEndRow && nStartCol <= nEndCol,
667 "cell range not normalized");
670 if( nStartRow < 0 || nEndRow >= nRows ||
671 nStartCol < 0 || nEndCol >= nCols )
673 throw lang::IllegalArgumentException();
675 for (sal_Int32 k1 = nStartRow; k1 <= nEndRow; ++k1)
677 for (sal_Int32 k2 = nStartCol; k2 <= nEndCol; ++k2)
686 sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
687 sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
688 std::vector<sal_Int32> aLabelIdx(oiEnd);
689 std::vector<sal_Int32> aDataStartIdx(oiEnd);
690 std::vector<sal_Int32> aDataLen(oiEnd);
691 for (oi = 0; oi < oiEnd; ++oi)
694 aDataStartIdx[oi] = -1;
698 for (oi = 0; oi < oiEnd; ++oi)
703 char &rChar = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii];
706 if (rChar ==
'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
715 if (rChar ==
'x' && aDataStartIdx[oi] == -1)
717 aDataStartIdx[oi] = ii;
721 while (ii< iiEnd &&
'x' == (bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
731 if (
'x' == (bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
732 throw lang::IllegalArgumentException();
745 sal_Int32 nNumLDS = 0;
748 sal_Int32 nFirstSeqLen = 0;
749 sal_Int32 nFirstSeqLabelIdx = -1;
750 bool bFirstFound =
false;
751 for (oi = 0; oi < oiEnd; ++oi)
754 if (aDataStartIdx[oi] != -1 &&
755 (!bFirstIsLabel || aLabelIdx[oi] != -1))
760 nFirstSeqLen = aDataLen[oi];
761 nFirstSeqLabelIdx = aLabelIdx[oi];
766 if (nFirstSeqLen != aDataLen[oi] ||
767 nFirstSeqLabelIdx != aLabelIdx[oi])
768 throw lang::IllegalArgumentException();
774 throw lang::IllegalArgumentException();
782 uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aLabelSeqs(nNumLDS);
783 uno::Reference<chart2::data::XDataSequence>* pLabelSeqs = aLabelSeqs.getArray();
784 uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aDataSeqs(nNumLDS);
785 uno::Reference<chart2::data::XDataSequence>* pDataSeqs = aDataSeqs.getArray();
786 sal_Int32 nSeqsIdx = 0;
787 for (oi = 0; oi < oiEnd; ++oi)
790 if (!(aDataStartIdx[oi] != -1 &&
791 (!bFirstIsLabel || aLabelIdx[oi] != -1)))
798 if (bDtaSrcIsColumns)
800 aLabelDesc.
nTop = aLabelIdx[oi];
801 aLabelDesc.
nLeft = oi;
805 aDataDesc.
nTop = aDataStartIdx[oi];
806 aDataDesc.
nLeft = oi;
807 aDataDesc.
nBottom = aDataDesc.
nTop + aDataLen[oi] - 1;
812 aLabelDesc.
nTop = oi;
813 aLabelDesc.
nLeft = aLabelIdx[oi];
818 aDataDesc.
nLeft = aDataStartIdx[oi];
820 aDataDesc.
nRight = aDataDesc.
nLeft + aDataLen[oi] - 1;
822 const OUString aBaseName = pTableFormat->
GetName() +
".";
824 OUString aLabelRange;
825 if (aLabelIdx[oi] != -1)
827 aLabelRange = aBaseName
832 OUString aDataRange = aBaseName
837 std::shared_ptr<SwUnoCursor> pLabelUnoCursor;
838 std::shared_ptr<SwUnoCursor> pDataUnoCursor;
845 OSL_ENSURE(pDataUnoCursor,
"pointer to data sequence missing");
848 if (pLabelUnoCursor || pDataUnoCursor)
851 OSL_ENSURE(nSeqsIdx == nNumLDS,
"mismatch between sequence size and num,ber of entries");
854 uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aLDS(nNumLDS);
855 uno::Reference<chart2::data::XLabeledDataSequence>* pLDS = aLDS.getArray();
856 for (sal_Int32
i = 0;
i < nNumLDS; ++
i)
859 pLabeledDtaSeq->setLabel(pLabelSeqs[
i]);
860 pLabeledDtaSeq->setValues(pDataSeqs[i]);
861 pLDS[i] = pLabeledDtaSeq;
865 if (aSequenceMapping.hasElements())
867 uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aOld_LDS(aLDS);
868 uno::Reference<chart2::data::XLabeledDataSequence>* pOld_LDS = aOld_LDS.getArray();
870 sal_Int32 nNewCnt = 0;
871 for (sal_Int32 nIdx : std::as_const(aSequenceMapping))
875 if (0 <= nIdx && nIdx < nNumLDS && pOld_LDS[nIdx].is())
877 pLDS[nNewCnt++] = pOld_LDS[nIdx];
880 pOld_LDS[nIdx].clear();
884 for (sal_Int32
i = 0;
i < nNumLDS; ++
i)
886 if (pOld_LDS[
i].is())
887 pLDS[nNewCnt++] = pOld_LDS[
i];
889 OSL_ENSURE(nNewCnt == nNumLDS,
"unexpected size of resulting sequence");
897 const uno::Sequence< beans::PropertyValue >& rArguments )
901 bool bPossible =
true;
906 catch (lang::IllegalArgumentException &)
915 const uno::Sequence< beans::PropertyValue >& rArguments )
931 std::u16string_view rCellRangeRepresentation )
934 if (std::u16string_view::npos == rCellRangeRepresentation.find(
';' ))
937 OUString aTableName, aStartCell, aEndCell;
939 aTableName, aStartCell, aEndCell,
false );
940 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
951 aStartCell, aEndCell,
false );
958 const uno::Reference< chart2::data::XDataSource >& xDataSource )
962 throw lang::DisposedException();
964 uno::Sequence< beans::PropertyValue > aResult;
965 if (!xDataSource.is())
968 const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aDS_LDS( xDataSource->getDataSequences() );
969 const uno::Reference< chart2::data::XLabeledDataSequence > *pDS_LDS = aDS_LDS.getConstArray();
970 sal_Int32 nNumDS_LDS = aDS_LDS.getLength();
974 OSL_FAIL(
"XLabeledDataSequence in data source contains 0 entries" );
981 sal_Int32 nTableRows = 0;
982 sal_Int32 nTableCols = 0;
985 std::vector< std::vector< char > >
aMap;
987 uno::Sequence< sal_Int32 > aSequenceMapping( nNumDS_LDS );
988 sal_Int32 *pSequenceMapping = aSequenceMapping.getArray();
990 OUString aCellRanges;
991 sal_Int16 nDtaSrcIsColumns = -1;
992 sal_Int32 nLabelSeqLen = -1;
997 for (sal_Int32 nDS1 = 0; nDS1 < nNumDS_LDS; ++nDS1)
999 uno::Reference< chart2::data::XLabeledDataSequence > xLabeledDataSequence( pDS_LDS[nDS1] );
1000 if( !xLabeledDataSequence.is() )
1002 OSL_FAIL(
"got NULL for XLabeledDataSequence from Data source");
1005 const uno::Reference< chart2::data::XDataSequence > xCurLabel = xLabeledDataSequence->getLabel();
1006 const uno::Reference< chart2::data::XDataSequence > xCurValues = xLabeledDataSequence->getValues();
1010 sal_Int32 nCurLabelSeqLen = -1;
1011 sal_Int32 nCurValuesSeqLen = -1;
1013 nCurLabelSeqLen = xCurLabel->getData().getLength();
1014 if (xCurValues.is())
1015 nCurValuesSeqLen = xCurValues->getData().getLength();
1018 if (nLabelSeqLen == -1)
1019 nLabelSeqLen = nCurLabelSeqLen;
1020 if (nLabelSeqLen != nCurLabelSeqLen)
1025 OUString aLabelTableName, aLabelStartCell, aLabelEndCell;
1026 OUString aValuesTableName, aValuesStartCell, aValuesEndCell;
1027 OUString aLabelRange, aValuesRange;
1029 aLabelRange = xCurLabel->getSourceRangeRepresentation();
1030 if (xCurValues.is())
1031 aValuesRange = xCurValues->getSourceRangeRepresentation();
1033 aLabelTableName, aLabelStartCell, aLabelEndCell )) ||
1035 aValuesTableName, aValuesStartCell, aValuesEndCell ))
1041 if (aTableName.isEmpty())
1042 aTableName = aValuesTableName;
1043 if (aTableName.isEmpty() ||
1044 aTableName != aValuesTableName ||
1045 (!aLabelTableName.isEmpty() && aTableName != aLabelTableName))
1053 sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
1054 const OUString aCell( !aLabelStartCell.isEmpty() ? aLabelStartCell : aValuesStartCell );
1055 OSL_ENSURE( !aCell.isEmpty() ,
"start cell missing?" );
1059 sal_Int16 nDirection = -1;
1060 if (nFirstCol == nLastCol && nFirstRow == nLastRow)
1062 OSL_ENSURE( nCurLabelSeqLen == 0 && nCurValuesSeqLen == 1,
1063 "trying to determine 'DataRowSource': something's fishy... should have been a single cell");
1068 if (nFirstCol == nLastCol && nFirstRow != nLastRow)
1070 else if (nFirstCol != nLastCol && nFirstRow == nLastRow)
1074 OSL_FAIL(
"trying to determine 'DataRowSource': unexpected case found" );
1079 if (nDtaSrcIsColumns == -1)
1080 nDtaSrcIsColumns = nDirection;
1081 if (nDtaSrcIsColumns != nDirection)
1083 nDtaSrcIsColumns = -2;
1086 if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
1090 OSL_ENSURE( nDtaSrcIsColumns == 0 ||
1091 nDtaSrcIsColumns == 1,
1092 "unexpected value for 'nDtaSrcIsColumns'" );
1093 pSequenceMapping[nDS1] = nDtaSrcIsColumns ? nFirstCol : nFirstRow;
1102 aMap.resize( nTableRows );
1103 for (sal_Int32
i = 0;
i < nTableRows; ++
i)
1104 aMap[
i].resize( nTableCols );
1106 if (!aLabelStartCell.isEmpty() && !aLabelEndCell.isEmpty())
1108 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
1111 if (nStartRow < 0 || nEndRow >= nTableRows ||
1112 nStartCol < 0 || nEndCol >= nTableCols)
1116 for (sal_Int32
i = nStartRow;
i <= nEndRow; ++
i)
1118 for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
1120 char &rChar = aMap[
i][k];
1128 if (!aValuesStartCell.isEmpty() && !aValuesEndCell.isEmpty())
1130 sal_Int32 nStartCol = -1, nStartRow = -1, nEndCol = -1, nEndRow = -1;
1133 if (nStartRow < 0 || nEndRow >= nTableRows ||
1134 nStartCol < 0 || nEndCol >= nTableCols)
1138 for (sal_Int32
i = nStartRow;
i <= nEndRow; ++
i)
1140 for (sal_Int32 k = nStartCol; k <= nEndCol; ++k)
1142 char &rChar = aMap[
i][k];
1152 #if OSL_DEBUG_LEVEL > 0
1156 sal_Int32 nStartRow = -1, nStartCol = -1, nEndRow = -1, nEndCol = -1;
1161 OSL_ENSURE( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurLabel->getData().getLength()) ||
1162 (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurLabel->getData().getLength()),
1163 "label sequence length does not match range representation!" );
1165 if (xCurValues.is())
1169 OSL_ENSURE( (nStartCol == nEndCol && (nEndRow - nStartRow + 1) == xCurValues->getData().getLength()) ||
1170 (nStartRow == nEndRow && (nEndCol - nStartCol + 1) == xCurValues->getData().getLength()),
1171 "value sequence length does not match range representation!" );
1179 const OUString aCellRangeBase = aTableName +
".";
1181 for (sal_Int32
i = 0;
i < nTableRows; ++
i)
1183 for (sal_Int32 k = 0; k < nTableCols; ++k)
1185 if (aMap[
i][k] !=
'\0')
1188 sal_Int32 nRowIndex1 =
i;
1189 sal_Int32 nColIndex1 = k;
1190 sal_Int32 nRowSubLen = 0;
1191 sal_Int32 nColSubLen = 0;
1192 while (nRowIndex1 < nTableRows && aMap[nRowIndex1++][k] !=
'\0')
1196 while (nColIndex1 < nTableCols && aMap[
i][nColIndex1] !=
'\0'
1197 && aMap[
i + nRowSubLen-1][nColIndex1] !=
'\0')
1203 OUString aEndCell(
sw_GetCellName( k + nColSubLen - 1,
i + nRowSubLen - 1) );
1204 aCurRange = aCellRangeBase + aStartCell +
":" + aEndCell;
1205 if (!aCellRanges.isEmpty())
1207 aCellRanges += aCurRange;
1210 for (sal_Int32 nRowIndex2 = 0; nRowIndex2 < nRowSubLen; ++nRowIndex2)
1211 for (sal_Int32 nColumnIndex2 = 0; nColumnIndex2 < nColSubLen; ++nColumnIndex2)
1212 aMap[
i + nRowIndex2][k + nColumnIndex2] =
'\0';
1218 uno::Sequence< OUString > aSortedRanges;
1221 OUString aSortedCellRanges;
1222 for (
const OUString& rSortedRange : std::as_const(aSortedRanges))
1224 if (!aSortedCellRanges.isEmpty())
1225 aSortedCellRanges +=
";";
1226 aSortedCellRanges += rSortedRange;
1231 uno::Sequence< sal_Int32 > aSortedMapping( aSequenceMapping );
1232 auto [
begin,
end] = asNonConstRange(aSortedMapping);
1234 bool bNeedSequenceMapping =
false;
1235 for (sal_Int32
i = 0;
i < aSequenceMapping.getLength(); ++
i)
1237 auto it = std::find( std::cbegin(aSortedMapping), std::cend(aSortedMapping),
1238 aSequenceMapping[
i] );
1239 pSequenceMapping[i] = std::distance(std::cbegin(aSortedMapping), it);
1241 if (i != std::as_const(aSequenceMapping)[i])
1242 bNeedSequenceMapping =
true;
1247 if (!bNeedSequenceMapping)
1248 aSequenceMapping.realloc(0);
1252 OSL_ENSURE(nLabelSeqLen >= 0 || nLabelSeqLen == -2 ,
1253 "unexpected value for 'nLabelSeqLen'" );
1254 bool bFirstCellIsLabel =
false;
1255 if (nLabelSeqLen > 0)
1256 bFirstCellIsLabel =
true;
1258 OSL_ENSURE( !aSortedCellRanges.isEmpty(),
"CellRangeRepresentation missing" );
1262 auto pResult = aResult.getArray();
1263 sal_Int32 nProps = 0;
1264 pResult[nProps ].Name =
"FirstCellAsLabel";
1265 pResult[nProps++].Value <<= bFirstCellIsLabel;
1266 pResult[nProps ].Name =
"CellRangeRepresentation";
1267 pResult[nProps++].Value <<= aSortedCellRanges;
1268 if (!aBrokenCellRangeForExport.isEmpty())
1270 pResult[nProps ].Name =
"BrokenCellRangeForExport";
1271 pResult[nProps++].Value <<= aBrokenCellRangeForExport;
1273 if (nDtaSrcIsColumns == 0 || nDtaSrcIsColumns == 1)
1275 chart::ChartDataRowSource eDataRowSource = (nDtaSrcIsColumns == 1) ?
1276 chart::ChartDataRowSource_COLUMNS : chart::ChartDataRowSource_ROWS;
1277 pResult[nProps ].Name =
"DataRowSource";
1278 pResult[nProps++].Value <<= eDataRowSource;
1280 if (aSequenceMapping.hasElements())
1282 pResult[nProps ].Name =
"SequenceMapping";
1283 pResult[nProps++].Value <<= aSequenceMapping;
1286 aResult.realloc( nProps );
1292 std::u16string_view rRangeRepresentation,
bool bTestOnly )
1295 throw lang::DisposedException();
1298 std::shared_ptr<SwUnoCursor> pUnoCursor;
1300 &pTableFormat, pUnoCursor );
1301 if (!pTableFormat || !pUnoCursor)
1302 throw lang::IllegalArgumentException();
1309 throw lang::IllegalArgumentException();
1311 OSL_ENSURE( pTableFormat && pUnoCursor,
"table format or cursor missing" );
1312 uno::Reference< chart2::data::XDataSequence > xDataSeq;
1320 const OUString& rRangeRepresentation )
1324 bool bPossible =
true;
1329 catch (lang::IllegalArgumentException &)
1338 const OUString& rRangeRepresentation )
1347 return uno::Reference< sheet::XRangeSelection >();
1350 uno::Reference<css::chart2::data::XDataSequence> SAL_CALL
1352 const OUString& ,
const OUString& ,
1355 return uno::Reference<css::chart2::data::XDataSequence>();
1360 bool bMustDispose(
false );
1376 m_aDataSequences.clear();
1379 lang::EventObject aEvtObj( static_cast< chart2::data::XDataProvider * >(
this) );
1385 const uno::Reference< lang::XEventListener >& rxListener )
1393 const uno::Reference< lang::XEventListener >& rxListener )
1402 return "SwChartDataProvider";
1412 return {
"com.sun.star.chart2.data.DataProvider"};
1427 OSL_ENSURE( pTable,
"table pointer is NULL" );
1435 for (
const auto& rItem : rSet)
1437 uno::Reference< chart2::data::XDataSequence > xTemp(rItem);
1438 uno::Reference< util::XModifiable > xRef( xTemp, uno::UNO_QUERY );
1442 xRef->setModified(
true );
1453 OSL_ENSURE( pTable,
"table pointer is NULL" );
1463 Set_DataSequenceRef_t::iterator aIt( rSet.begin() );
1464 Set_DataSequenceRef_t::iterator aEndIt( rSet.end() );
1465 Set_DataSequenceRef_t::iterator aDelIt;
1466 while (aIt != aEndIt)
1469 bool bNowEmpty =
false;
1470 bool bSeqDisposed =
false;
1473 uno::Reference< chart2::data::XDataSequence > xTemp(*aIt);
1482 bNowEmpty = pDataSeq->
DeleteBox( rBox );
1484 catch (
const lang::DisposedException&)
1487 bSeqDisposed =
true;
1498 rSet.erase( aDelIt );
1499 if (pDataSeq && !bSeqDisposed)
1507 OSL_ENSURE( pTable,
"table pointer is NULL" );
1520 for (
const auto& rItem : aSet)
1522 uno::Reference< chart2::data::XDataSequence > xTemp(rItem);
1523 uno::Reference< lang::XComponent > xRef( xTemp, uno::UNO_QUERY );
1555 sal_uInt16 nLines,
bool bBehind )
1560 const size_t nBoxes = rBoxes.
size();
1561 if (nBoxes < 1 || nLines < 1)
1567 if (!(pFirstBox && pLastBox))
1570 sal_Int32 nFirstCol = -1, nFirstRow = -1, nLastCol = -1, nLastRow = -1;
1574 bool bAddCols =
false;
1575 if (nFirstCol == nLastCol && nFirstRow != nLastRow)
1577 if (nFirstCol != nLastCol && nFirstRow != nLastRow)
1581 sal_Int32 nFirstNewCol = nFirstCol;
1582 sal_Int32 nFirstNewRow = bBehind ? nFirstRow + 1 : nFirstRow - nLines;
1585 OSL_ENSURE( nFirstCol == nLastCol,
"column indices seem broken" );
1586 nFirstNewCol = bBehind ? nFirstCol + 1 : nFirstCol - nLines;
1587 nFirstNewRow = nFirstRow;
1592 for (
const auto& rItem : rSet)
1594 uno::Reference< chart2::data::XDataSequence > xTemp(rItem);
1595 uno::Reference< chart2::data::XTextualDataSequence > xRef( xTemp, uno::UNO_QUERY );
1598 const sal_Int32 nLen = xRef->getTextualData().getLength();
1601 auto pDataSeq = comphelper::getFromUnoTunnel<SwChartDataSequence>(xRef);
1605 pDataSeq->FillRangeDesc( aDesc );
1607 chart::ChartDataRowSource eDRSource = chart::ChartDataRowSource_COLUMNS;
1609 eDRSource = chart::ChartDataRowSource_ROWS;
1611 if (!bAddCols && eDRSource == chart::ChartDataRowSource_COLUMNS)
1614 pDataSeq->ExtendTo(
true, nFirstNewRow, nLines );
1616 else if (bAddCols && eDRSource == chart::ChartDataRowSource_ROWS)
1619 pDataSeq->ExtendTo(
false, nFirstNewCol, nLines );
1632 throw lang::DisposedException();
1634 if (rRangeRepresentation.isEmpty())
1637 OUStringBuffer aRes;
1641 SwTable* pFirstFoundTable =
nullptr;
1644 const OUString aRange( rRangeRepresentation.getToken(0,
';', nPos) );
1646 std::shared_ptr<SwUnoCursor> pCursor;
1649 throw lang::IllegalArgumentException();
1652 throw uno::RuntimeException(
"Table too complex.");
1655 if (!pFirstFoundTable)
1656 pFirstFoundTable = pTable;
1657 if (pTable != pFirstFoundTable)
1658 throw lang::IllegalArgumentException();
1660 OUString aTableName;
1661 OUString aStartCell;
1664 throw lang::IllegalArgumentException();
1666 sal_Int32 nCol, nRow;
1668 if (nCol < 0 || nRow < 0)
1669 throw uno::RuntimeException(
"Cell not found.");
1678 if (aStartCell != aEndCell && !aEndCell.isEmpty())
1681 if (nCol < 0 || nRow < 0)
1682 throw uno::RuntimeException(
"Cell not found.");
1689 if (!aRes.isEmpty())
1695 return aRes.makeStringAndClear();
1702 throw lang::DisposedException();
1704 if (rXMLRange.isEmpty())
1707 OUStringBuffer aRes;
1711 OUString aFirstFoundTable;
1715 OUString aRange( rXMLRange.getToken(0,
' ', nPos) );
1722 if (aFirstFoundTable.isEmpty())
1723 aFirstFoundTable = aCellRange.aTableName;
1724 if (aCellRange.aTableName != aFirstFoundTable)
1725 throw lang::IllegalArgumentException();
1727 OUString aTmp = aCellRange.aTableName +
"." +
1729 aCellRange.aUpperLeft.nRow );
1731 if (!aCellRange.aLowerRight.bIsEmpty)
1734 aCellRange.aLowerRight.nRow );
1737 if (!aRes.isEmpty())
1743 return aRes.makeStringAndClear();
1747 const uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > &rLDS ) :
1764 return "SwChartDataSource";
1774 return {
"com.sun.star.chart2.data.DataSource" };
1780 const std::shared_ptr<SwUnoCursor>& pTableCursor ) :
1781 m_pFormat(&rTableFormat),
1782 m_aRowLabelText(
SwResId( STR_CHART2_ROW_LABEL_TEXT ) ),
1783 m_aColLabelText(
SwResId( STR_CHART2_COL_LABEL_TEXT ) ),
1784 m_xDataProvider( &rProvider ),
1785 m_pTableCursor( pTableCursor ),
1797 uno::Reference< chart2::data::XDataSequence > xRef(
this);
1799 m_xDataProvider->addEventListener( static_cast< lang::XEventListener * >(
this) );
1802 OSL_FAIL(
"table missing" );
1805 catch (uno::RuntimeException &)
1810 catch (uno::Exception &)
1815 #if OSL_DEBUG_LEVEL > 0
1819 OSL_ENSURE(pUnoTableCursor,
"SwChartDataSequence: cursor not SwUnoTableCursor");
1826 m_pFormat( rObj.m_pFormat ),
1828 m_aRowLabelText(
SwResId(STR_CHART2_ROW_LABEL_TEXT) ),
1829 m_aColLabelText(
SwResId(STR_CHART2_COL_LABEL_TEXT) ),
1830 m_xDataProvider( rObj.m_xDataProvider ),
1831 m_pTableCursor( rObj.m_pTableCursor ),
1832 m_pPropSet( rObj.m_pPropSet )
1844 uno::Reference< chart2::data::XDataSequence > xRef(
this);
1846 m_xDataProvider->addEventListener( static_cast< lang::XEventListener * >(
this) );
1849 OSL_FAIL(
"table missing" );
1852 catch (uno::RuntimeException &)
1857 catch (uno::Exception &)
1862 #if OSL_DEBUG_LEVEL > 0
1866 OSL_ENSURE(pUnoTableCursor,
"SwChartDataSequence: cursor not SwUnoTableCursor");
1877 return theSwChartDataSequenceUnoTunnelId.
getSeq();
1890 throw lang::DisposedException();
1897 OSL_ENSURE( !aCellRange.isEmpty(),
"failed to get cell range" );
1898 aRes = pTableFormat->
GetName() +
"." + aCellRange;
1904 chart2::data::LabelOrigin eLabelOrigin )
1908 throw lang::DisposedException();
1910 uno::Sequence< OUString > aLabels;
1917 throw uno::RuntimeException(
"No table format found.");
1920 throw uno::RuntimeException(
"No table found.");
1922 throw uno::RuntimeException(
"Table too complex.");
1925 OSL_ENSURE( !aCellRange.isEmpty(),
"failed to get cell range" );
1927 OSL_ENSURE( bOk,
"failed to get SwRangeDescriptor" );
1932 sal_Int32 nColSpan = aDesc.
nRight - aDesc.
nLeft + 1;
1933 sal_Int32 nRowSpan = aDesc.
nBottom - aDesc.
nTop + 1;
1934 OSL_ENSURE( nColSpan == 1 || nRowSpan == 1,
1935 "unexpected range of selected cells" );
1938 bool bReturnEmptyText =
false;
1939 bool bUseCol =
true;
1940 if (eLabelOrigin == chart2::data::LabelOrigin_COLUMN)
1942 else if (eLabelOrigin == chart2::data::LabelOrigin_ROW)
1944 else if (eLabelOrigin == chart2::data::LabelOrigin_SHORT_SIDE)
1946 bUseCol = nColSpan < nRowSpan;
1947 bReturnEmptyText = nColSpan == nRowSpan;
1949 else if (eLabelOrigin == chart2::data::LabelOrigin_LONG_SIDE)
1951 bUseCol = nColSpan > nRowSpan;
1952 bReturnEmptyText = nColSpan == nRowSpan;
1955 OSL_FAIL(
"unexpected case" );
1960 sal_Int32 nSeqLen = bUseCol ? nColSpan : nRowSpan;
1961 aLabels.realloc( nSeqLen );
1962 OUString *
pLabels = aLabels.getArray();
1963 for (sal_Int32
i = 0;
i < nSeqLen; ++
i)
1965 if (!bReturnEmptyText)
1968 sal_Int32 nCol = aDesc.
nLeft;
1969 sal_Int32 nRow = aDesc.
nTop;
1976 sal_Int32 nLen = aCellName.getLength();
1981 while (pBuf < pEnd && (
'0' > *pBuf || *pBuf >
'9'))
1984 if (pBuf < pEnd && (
'0' <= *pBuf && *pBuf <=
'9'))
1987 std::u16string_view aNew;
1990 aRplc =
"%COLUMNLETTER";
1991 aNew = aCellName.subView(0, pBuf - aCellName.getStr());
1995 aRplc =
"%ROWNUMBER";
1996 aNew = std::u16string_view(pBuf, (aCellName.getStr() + nLen) - pBuf);
1998 aText = aText.replaceFirst( aRplc, aNew );
2019 throw lang::DisposedException();
2022 return std::vector< css::uno::Reference< css::table::XCell > >();
2024 if(pTable->IsTableComplex())
2025 return std::vector< css::uno::Reference< css::table::XCell > >();
2028 return std::vector< css::uno::Reference< css::table::XCell > >();
2036 uno::Sequence< OUString > vTextData(vCells.size());
2037 std::transform(vCells.begin(),
2039 vTextData.getArray(),
2040 [] (decltype(vCells)::value_type& xCell)
2049 uno::Sequence< uno::Any > vAnyData(vCells.size());
2050 std::transform(vCells.begin(),
2052 vAnyData.getArray(),
2053 [] (decltype(vCells)::value_type& xCell)
2054 {
return static_cast<SwXCell*
>(xCell.get())->GetAny(); });
2062 uno::Sequence< double > vNumData(vCells.size());
2063 std::transform(vCells.begin(),
2065 vNumData.getArray(),
2066 [] (decltype(vCells)::value_type& xCell)
2067 {
return static_cast<SwXCell*
>(xCell.get())->GetForcedNumericalValue(); });
2075 throw lang::DisposedException();
2083 throw lang::DisposedException();
2090 const OUString& rPropertyName,
2095 throw lang::DisposedException();
2098 throw beans::UnknownPropertyException(rPropertyName);
2101 throw lang::IllegalArgumentException();
2105 const OUString& rPropertyName )
2109 throw lang::DisposedException();
2112 throw beans::UnknownPropertyException(rPropertyName);
2119 const uno::Reference< beans::XPropertyChangeListener >& )
2121 OSL_FAIL(
"not implemented" );
2126 const uno::Reference< beans::XPropertyChangeListener >& )
2128 OSL_FAIL(
"not implemented" );
2133 const uno::Reference< beans::XVetoableChangeListener >& )
2135 OSL_FAIL(
"not implemented" );
2140 const uno::Reference< beans::XVetoableChangeListener >& )
2142 OSL_FAIL(
"not implemented" );
2147 return "SwChartDataSequence";
2157 return {
"com.sun.star.chart2.data.DataSequence" };
2162 if(rHint.
GetId() == SfxHintId::Dying)
2170 else if (rHint.
GetId() == SfxHintId::SwLegacyModify)
2180 throw lang::DisposedException();
2190 throw lang::DisposedException();
2197 const uno::Reference< util::XModifyListener >& rxListener )
2205 const uno::Reference< util::XModifyListener >& rxListener )
2215 throw lang::DisposedException();
2216 if (rSource.Source == static_cast<cppu::OWeakObject*>(
m_xDataProvider.get()))
2224 bool bMustDispose(
false );
2240 uno::Reference< chart2::data::XDataSequence > xRef(
this);
2244 OSL_FAIL(
"table missing" );
2272 lang::EventObject aEvtObj( static_cast< chart2::data::XDataSequence * >(
this) );
2279 const uno::Reference< lang::XEventListener >& rxListener )
2287 const uno::Reference< lang::XEventListener >& rxListener )
2297 throw lang::DisposedException();
2300 bool bNowEmpty =
false;
2312 else if (pPointStartNode == rBox.
GetSttNd() || pMarkStartNode == rBox.
GetSttNd())
2314 sal_Int32 nPointRow = -1, nPointCol = -1;
2315 sal_Int32 nMarkRow = -1, nMarkCol = -1;
2322 OSL_ENSURE( nPointRow >= 0 && nPointCol >= 0,
"invalid row and col" );
2323 OSL_ENSURE( nMarkRow >= 0 && nMarkCol >= 0,
"invalid row and col" );
2326 OSL_ENSURE( nPointRow == nMarkRow || nPointCol == nMarkCol,
2327 "row/col indices not matching" );
2328 OSL_ENSURE( nPointRow != nMarkRow || nPointCol != nMarkCol,
2329 "point and mark are identical" );
2330 bool bMoveVertical = (nPointCol == nMarkCol);
2331 bool bMoveHorizontal = (nPointRow == nMarkRow);
2334 bool bMoveLeft =
false;
2335 bool bMoveUp =
false;
2338 if (pPointStartNode == rBox.
GetSttNd())
2339 bMoveUp = nPointRow > nMarkRow;
2341 bMoveUp = nMarkRow > nPointRow;
2343 else if (bMoveHorizontal)
2345 if (pPointStartNode == rBox.
GetSttNd())
2346 bMoveLeft = nPointCol > nMarkCol;
2348 bMoveLeft = nMarkCol > nPointCol;
2351 OSL_FAIL(
"neither vertical nor horizontal movement" );
2355 sal_Int32 nRow = (pPointStartNode == rBox.
GetSttNd()) ? nPointRow : nMarkRow;
2356 sal_Int32 nCol = (pPointStartNode == rBox.
GetSttNd()) ? nPointCol : nMarkCol;
2358 nRow += bMoveUp ? -1 : +1;
2359 if (bMoveHorizontal)
2360 nCol += bMoveLeft ? -1 : +1;
2390 OSL_FAIL(
"neither point nor mark available for change" );
2394 OSL_FAIL(
"failed to get position" );
2429 sal_Int32 nFirstNew, sal_Int32 nCount )
2432 if (!pUnoTableCursor)
2441 if (nCount < 1 || nFirstNew < 0 || pTable->IsTableComplex())
2448 const OUString aEndBox( pEndBox->
GetName() );
2451 pStartBox = pTable->
GetTableBox( pStartNd->GetIndex() );
2452 const OUString aStartBox( pStartBox->
GetName() );
2456 OUString sDescrip = aStartBox +
":" + aEndBox;
2459 bool bChanged =
false;
2460 OUString aNewStartCell;
2461 OUString aNewEndCell;
2462 if (bExtendCol && aDesc.nBottom + 1 == nFirstNew)
2466 OSL_ENSURE( aDesc.nLeft == aDesc.nRight,
"data-sequence is not a column" );
2468 aNewEndCell =
sw_GetCellName(aDesc.nRight, aDesc.nBottom + nCount);
2471 else if (bExtendCol && aDesc.nTop - nCount == nFirstNew)
2475 OSL_ENSURE( aDesc.nLeft == aDesc.nRight,
"data-sequence is not a column" );
2476 aNewStartCell =
sw_GetCellName(aDesc.nLeft, aDesc.nTop - nCount);
2480 else if (!bExtendCol && aDesc.nRight + 1 == nFirstNew)
2484 OSL_ENSURE( aDesc.nTop == aDesc.nBottom,
"data-sequence is not a row" );
2486 aNewEndCell =
sw_GetCellName(aDesc.nRight + nCount, aDesc.nBottom);
2489 else if (!bExtendCol && aDesc.nLeft - nCount == nFirstNew)
2493 OSL_ENSURE( aDesc.nTop == aDesc.nBottom,
"data-sequence is not a row" );
2494 aNewStartCell =
sw_GetCellName(aDesc.nLeft - nCount, aDesc.nTop);
2525 throw lang::DisposedException();
2530 uno::Reference< chart2::data::XDataSequence >& rxDest,
2531 const uno::Reference< chart2::data::XDataSequence >& rxSource)
2533 uno::Reference< util::XModifyListener > xML(
this);
2534 uno::Reference< lang::XEventListener > xEL(
this);
2537 uno::Reference< util::XModifyBroadcaster > xMB( rxDest, uno::UNO_QUERY );
2539 xMB->removeModifyListener( xML );
2540 uno::Reference< lang::XComponent > xC( rxDest, uno::UNO_QUERY );
2542 xC->removeEventListener( xEL );
2547 xC.set( rxDest, uno::UNO_QUERY );
2549 xC->addEventListener( xEL );
2550 xMB.set( rxDest, uno::UNO_QUERY );
2552 xMB->addModifyListener( xML );
2556 const uno::Reference< chart2::data::XDataSequence >& rxSequence )
2560 throw lang::DisposedException();
2574 throw lang::DisposedException();
2579 const uno::Reference< chart2::data::XDataSequence >& rxSequence )
2583 throw lang::DisposedException();
2597 throw lang::DisposedException();
2599 uno::Reference< util::XCloneable > xDataCloneable(
m_xData, uno::UNO_QUERY );
2600 uno::Reference< util::XCloneable > xLabelsCloneable(
m_xLabels, uno::UNO_QUERY );
2602 if (xDataCloneable.is())
2604 uno::Reference< chart2::data::XDataSequence > xDataClone( xDataCloneable->createClone(), uno::UNO_QUERY );
2605 pRes->setValues( xDataClone );
2608 if (xLabelsCloneable.is())
2610 uno::Reference< chart2::data::XDataSequence > xLabelsClone( xLabelsCloneable->createClone(), uno::UNO_QUERY );
2611 pRes->setLabel( xLabelsClone );
2618 return "SwChartLabeledDataSequence";
2622 const OUString& rServiceName )
2629 return {
"com.sun.star.chart2.data.LabeledDataSequence" };
2633 const lang::EventObject& rSource )
2636 uno::Reference< uno::XInterface > xRef( rSource.Source );
2649 const lang::EventObject& rEvent )
2658 const uno::Reference< util::XModifyListener >& rxListener )
2666 const uno::Reference< util::XModifyListener >& rxListener )
2675 bool bMustDispose(
false );
2687 lang::EventObject aEvtObj( static_cast< chart2::data::XLabeledDataSequence * >(
this) );
2695 const uno::Reference< lang::XEventListener >& rxListener )
2703 const uno::Reference< lang::XEventListener >& rxListener )
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
css::uno::Reference< css::chart2::data::XDataSource > Impl_createDataSource(const css::uno::Sequence< css::beans::PropertyValue > &aArguments, bool bTestOnly=false)
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...
#define LINK(Instance, Class, Member)
bool IsTableComplex() const
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
std::shared_ptr< SwUnoCursor > CreateUnoCursor(const SwPosition &rPos, bool bTableCursor=false)
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
const Value & back() const
virtual void SAL_CALL dispose() override
static void GetTableByName(const SwDoc &rDoc, std::u16string_view rTableName, SwFrameFormat **ppTableFormat, SwTable **ppTable)
Marks a position in the document model.
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
void StartOrContinueLocking()
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
const SwOLEObj & GetOLEObj() const
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
SwChartLockController_Helper(const SwChartLockController_Helper &)=delete
virtual void SAL_CALL setLabel(const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence) override
virtual ~SwChartDataProvider() override
const OUString & GetChartTableName() const
const SwPosition * GetMark() const
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
~SwChartLockController_Helper()
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
void FillRangeDesc(SwRangeDescriptor &rRangeDesc) const
virtual OUString SAL_CALL convertRangeToXML(const OUString &aRangeRepresentation) override
virtual OUString SAL_CALL getSourceRangeRepresentation() override
SwChartLabeledDataSequence()
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
void RemoveDataSequence(const SwTable &rTable, css::uno::Reference< css::chart2::data::XDataSequence > const &rxDataSequence)
std::vector< css::uno::Reference< css::table::XCell > > GetCells()
SwTableLine * front() const
bool HasWriterListeners() const
OUString sw_GetCellName(sal_Int32 nColumn, sal_Int32 nRow)
get cell name at a specified coordinate
SwTableFormat * GetFrameFormat()
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
#define PROPERTY_MAP_CHART2_DATA_SEQUENCE
::comphelper::OInterfaceContainerHelper4< css::util::XModifyListener > m_aModifyListeners
bool FillRangeDescriptor(SwRangeDescriptor &rDesc, std::u16string_view rCellRangeName)
rCellRangeName needs to be of one of the following formats:
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
void InvalidateTable(const SwTable *pTable, bool bImmediate=false)
OUString SwResId(TranslateId aId)
HashMap_OWString_Interface aMap
virtual css::uno::Sequence< double > SAL_CALL getNumericalData() override
std::set< css::uno::WeakReference< css::chart2::data::XDataSequence >, lt_DataSequenceRef > Set_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...
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
enumrange< T >::Iterator begin(enumrange< T >)
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
CellRange getCellRangeFromXMLString(const OUString &rXMLString)
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments(const css::uno::Reference< css::chart2::data::XDataSource > &xDataSource) override
svt::EmbeddedObjectRef & GetObject()
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
void AddDataSequence(const SwTable &rTable, css::uno::Reference< css::chart2::data::XDataSequence > const &rxDataSequence)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual void SAL_CALL setModified(sal_Bool bModified) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
#define suppress_fun_call_w_exception(expr)
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual OUString GetName() const override
static SW_DLLPUBLIC void GetCellPosition(const OUString &rCellName, sal_Int32 &o_rColumn, sal_Int32 &o_rRow)
get position of a cell with a given name
virtual void SAL_CALL dispose() override
static OUString GetCellRangeName(const SwFrameFormat &rTableFormat, SwUnoCursor &rTableCursor)
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getLabel() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual ~SwChartLabeledDataSequence() override
const OUString & GetCurrentPersistName() const
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
virtual OUString SAL_CALL getImplementationName() override
const css::uno::Sequence< sal_Int8 > & getSeq() const
static void GetFormatAndCreateCursorFromRangeRep(const SwDoc *pDoc, std::u16string_view rRangeRepresentation, SwFrameFormat **ppTableFormat, std::shared_ptr< SwUnoCursor > &rpUnoCursor)
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
static SwTable * FindTable(SwFrameFormat const *const pFormat)
virtual ~SwChartDataSource() override
virtual OUString SAL_CALL convertRangeFromXML(const OUString &aXMLRange) override
virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const OUString &aRangeRepresentation) override
SwFrameFormat * m_pFormat
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
void sw_NormalizeRange(OUString &rCell1, OUString &rCell2)
cleanup order in a range
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
const SwStartNode * StartOfSectionNode() const
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
const SwPosition * GetPoint() const
SwChartDataSource(const SwChartDataSource &)=delete
rtl::Reference< SwChartDataProvider > m_xDataProvider
sw::UnoCursorPointer m_pTableCursor
void DisposeAllDataSequences(const SwTable *pTable)
virtual sal_Bool SAL_CALL isModified() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
css::uno::Reference< css::chart2::data::XDataSequence > m_xLabels
SwContentNode * GetContentNode()
SwNodeOffset GetIndex() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
virtual void SAL_CALL dispose() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
SwFrameFormat * GetFrameFormat() const
bool DeleteBox(const SwTableBox &rBox)
virtual void Start(bool bStartTimer=true) override
virtual SwChartLockController_Helper & GetChartControllerHelper()=0
returns chart controller helper that is used to lock/unlock all charts when relevant parts of tables ...
static bool GetTableAndCellsFromRangeRep(std::u16string_view rRangeRepresentation, OUString &rTableName, OUString &rStartCell, OUString &rEndCell, bool bSortStartEndCells=true)
int sw_CompareCellsByColFirst(const OUString &rCellName1, const OUString &rCellName2)
compare position of two cells (check columns first)
static::rtl::Reference< SwXCellRange > CreateXCellRange(const sw::UnoCursorPointer &pCursor, SwFrameFormat &rFrameFormat, SwRangeDescriptor const &rDesc)
virtual void SAL_CALL setValues(const css::uno::Reference< css::chart2::data::XDataSequence > &xSequence) override
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListeners
Marks a node in the document model.
virtual ~SwChartDataSequence() override
css::uno::Reference< css::chart2::data::XDataSequence > m_xData
bool StartListening(SvtBroadcaster &rBroadcaster)
SwStartNode * GetStartNode()
virtual void Notify(const SfxHint &rHint) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getValues() override
void SetTimeout(sal_uInt64 nTimeoutMs)
IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListeners
SwTableLines & GetTabLines()
enumrange< T >::Iterator end(enumrange< T >)
SwTable is one table in the document model, containing rows (which contain cells).
virtual OUString SAL_CALL getImplementationName() override
const SfxItemPropertySet * m_pPropSet
int sw_CompareCellRanges(const OUString &rRange1StartCell, const OUString &rRange1EndCell, const OUString &rRange2StartCell, const OUString &rRange2EndCell, bool bCmpColsFirst)
compare position of two cell ranges
OUString getXMLStringFromCellRange(const CellRange &rRange)
virtual sal_Bool SAL_CALL createDataSourcePossible(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
std::unique_ptr< uint8_t[]> pLabels
SvtBroadcaster & GetNotifier()
::comphelper::OInterfaceContainerHelper4< css::util::XModifyListener > m_aModifyListeners
cppu::WeakImplHelper< css::chart2::data::XDataSequence, css::chart2::data::XTextualDataSequence, css::chart2::data::XNumericalDataSequence, css::util::XCloneable, css::beans::XPropertySet, css::lang::XServiceInfo, css::lang::XUnoTunnel, css::util::XModifiable, css::lang::XEventListener, css::lang::XComponent > SwChartDataSequenceBaseClass
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
SwTableBoxes & GetTabBoxes()
const SwStartNode * GetSttNd() const
void LockUnlockAllCharts(bool bLock)
void reset(std::shared_ptr< SwUnoCursor > pNew)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEvtListeners
virtual OUString SAL_CALL getImplementationName() override
IMPL_LINK_NOARG(SwChartLockController_Helper, DoUnlockAllCharts, Timer *, void)
if(aStr!=aBuf) UpdateName_Impl(m_xFollowLb.get()
virtual css::uno::Sequence< OUString > SAL_CALL getTextualData() override
Map_Set_DataSequenceRef_t m_aDataSequences
SwTableBox is one table cell in the document model.
css::chart2::data::DataSequenceRole m_aRole
SwUnoPropertyMapProvider aSwMapProvider
static void LaunchModifiedEvent(::comphelper::OInterfaceContainerHelper4< util::XModifyListener > &rICH, const uno::Reference< uno::XInterface > &rxI)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
size_t GetTableFrameFormatCount(bool bUsed) const
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getData() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL generateLabel(css::chart2::data::LabelOrigin eLabelOrigin) override
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
const SwStartNode * FindTableBoxStartNode() const
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
SwNodeOffset Count() const
static void SortSubranges(uno::Sequence< OUString > &rSubRanges, bool bCmpByColumn)
css::uno::Reference< css::chart2::data::XDataSequence > Impl_createDataSequenceByRangeRepresentation(std::u16string_view aRangeRepresentation, bool bTestOnly=false)
static std::mutex & GetChartMutex()
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
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 createDataSequenceByValueArray(const OUString &aRole, const OUString &aRangeRepresentation, const OUString &aRoleQualifier) override
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
void notifyEach(std::unique_lock< std::mutex > &rGuard, void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
OUString getString(const Any &_rAny)
void DeleteBox(const SwTable *pTable, const SwTableBox &rBox)
static bool GetSubranges(std::u16string_view rRangeRepresentation, uno::Sequence< OUString > &rSubRanges, bool bNormalize)
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
SwChartDataSequence(const SwChartDataSequence &rObj)
void SetDataSequence(css::uno::Reference< css::chart2::data::XDataSequence > &rxDest, const css::uno::Reference< css::chart2::data::XDataSequence > &rxSource)
SwContentNode * GoNext(SwNodeIndex *) const
virtual OUString SAL_CALL getImplementationName() override
static OUString GetRangeRepFromTableAndCells(std::u16string_view rTableName, std::u16string_view rStartCell, std::u16string_view rEndCell, bool bForceEndCellName)
virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex(::sal_Int32 nIndex) override
virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation(const OUString &aRangeRepresentation) override
css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > m_aLDS
virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource(const css::uno::Sequence< css::beans::PropertyValue > &aArguments) override
SwChartDataProvider(const SwChartDataProvider &)=delete
static void DoUpdateAllCharts(SwDoc *pDoc)
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
bool m_bDetectedRangeSegmentation false
Base class of the Writer document model elements.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override