20 #include <com/sun/star/uno/Reference.hxx>
21 #include <com/sun/star/chart/XChartDocument.hpp>
22 #include <com/sun/star/chart2/XChartDocument.hpp>
23 #include <com/sun/star/embed/XClassifiedObject.hpp>
24 #include <com/sun/star/embed/XEmbeddedObject.hpp>
43 #include <svx/svxids.hrc>
62 #include <document.hxx>
65 #include <globstr.hrc>
70 #include <charthelper.hxx>
81 #define DET_ARROW_OFFSET 1000
109 OSL_ENSURE(pData,
"ScUndoObjData: Data missing");
128 OSL_ENSURE(pData,
"ScUndoObjData: Data missing");
205 #define MAXMM 10000000
210 FieldUnit::TWIP, FieldUnit::MM_100TH) );
216 FieldUnit::MM_100TH, FieldUnit::TWIP) );
238 nClipEndX = nClipEndX + nClipStartX;
239 nClipEndY += nClipStartY;
241 return ScRange(nClipStartX, nClipStartY, nClipTab, nClipEndX, nClipEndY, nClipTab);
247 pGlobalDrawPersist ? pGlobalDrawPersist : (pDocument ? pDocument->GetDocumentShell() : nullptr)),
251 bAdjustEnabled( true ),
252 bHyphenatorSet( false )
318 if ( pHitOutlinerPool )
339 Broadcast(
SdrHint(SdrHintKind::ModelCleared));
355 css::uno::Reference< css::linguistic2::XHyphenator >
375 for (sal_uInt16
i=0;
i<nCount && !bFound;
i++)
396 InsertPage(pPage, static_cast<sal_uInt16>(nTab));
398 AddCalcUndo(std::make_unique<SdrUndoNewPage>(*pPage));
413 AddCalcUndo(std::make_unique<SdrUndoDelPage>(*pPage));
432 sal_uInt16 nMinPos = std::min(nOldPos, nNewPos);
446 if (pOldPage && pNewPage)
464 pNewObject->NbcMove(
Size(0,0));
474 AddCalcUndo( std::make_unique<SdrUndoInsertObj>( *pNewObject ) );
476 pOldObject = aIter.
Next();
490 if (nEnd >= nPageSize)
492 nEnd = nPageSize - 1;
494 for (
SCTAB i = nStart;
i <= nEnd; ++
i)
515 return rPos.
Col() >= nCol1 && rPos.
Col() <= nCol2 &&
516 rPos.
Row() >= nRow1 && rPos.
Row() <= nRow2;
520 SCCOL nDx,
SCROW nDy,
bool bUpdateNoteCaptionPos )
523 OSL_ENSURE(pPage,
"Page not found");
530 for (
size_t i = 0;
i < nCount; ++
i )
538 bool bChange =
false;
558 if ( pNoRotatedAnchor )
567 RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos );
579 if ( rSize != pPage->
GetSize() )
601 for (
size_t i = 0;
i < nCount; ++
i )
606 RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos );
627 Point aAvailableDiff(aWantedDiff);
630 if (aAvailableDiff.Y() > nHeight)
631 aAvailableDiff.setY( nHeight );
632 if (aAvailableDiff.X() > nWidth)
633 aAvailableDiff.setX( nWidth );
634 return aAvailableDiff;
641 return tools::Rectangle(static_cast<tools::Long>(aRange.getMinX()), static_cast<tools::Long>(aRange.getMinY()),
642 static_cast<tools::Long>(aRange.getMaxX()), static_cast<tools::Long>(aRange.getMaxY()));
649 if (std::abs(rRectA.
Left() - rRectB.
Left()) > 1)
651 if (std::abs(rRectA.
Top() - rRectB.
Top()) > 1)
653 if (std::abs(rRectA.
Right() - rRectB.
Right()) > 1)
660 bool lcl_NeedsMirrorYCorrection(
SdrObject* pObj)
678 const bool bNeedsMirrorYCorrection = lcl_NeedsMirrorYCorrection(pObj);
679 if (bNeedsMirrorYCorrection)
683 const Point aRight(aLeft.X() + 1000, aLeft.Y());
691 Point aStartPoint(aStartCellRect.Left(), aStartCellRect.Top());
698 Point aEndPoint(aEndCellRect.Left(), aEndCellRect.Top());
704 aNewRectangle.Justify();
705 if (!lcl_AreRectanglesApproxEqual(pObj->
GetLogicRect(), aNewRectangle))
709 if (bNeedsMirrorYCorrection)
713 const Point aRight(aLeft.X() + 1000, aLeft.Y());
721 bool bUseLogicRect,
bool bNegativePage,
bool bCanResize)
734 aPos += lcl_calcAvailableDiff(*pDoc, nCol1, nRow1, nTab1, rData.
maStartOffset);
748 if (rData.
mbWasInHiddenRow || aLastCellRect.IsEmpty() || nRow1 != nRow2 || nCol1 != nCol2)
754 aEnd += lcl_calcAvailableDiff(*pDoc, nCol2, nRow2, nTab2, rData.
maEndOffset);
758 else if (!aLastCellRect.IsEmpty())
766 const tools::Long nLastWidth(aLastCellRect.GetWidth());
767 const tools::Long nLastHeight(aLastCellRect.GetHeight());
771 if(nCurrentWidth + 1 == nLastWidth || nCurrentWidth == nLastWidth + 1)
773 nCurrentWidth = nLastWidth;
776 if(nCurrentHeight + 1 == nLastHeight || nCurrentHeight == nLastHeight + 1)
778 nCurrentHeight = nLastHeight;
782 double fWidthFactor(nCurrentWidth == nLastWidth || 0 == nLastWidth
784 : static_cast<double>(nCurrentWidth) / static_cast<double>(nLastWidth));
785 double fHeightFactor(nCurrentHeight == nLastHeight || 0 == nLastHeight
787 : static_cast<double>(nCurrentHeight) / static_cast<double>(nLastHeight));
790 const bool bIsGrowing(nCurrentWidth > nLastWidth || nCurrentHeight > nLastHeight);
791 const bool bIsShrinking(nCurrentWidth < nLastWidth || nCurrentHeight < nLastHeight);
792 const bool bIsSizeChanged(bIsGrowing || bIsShrinking);
801 assert(nWidth &&
"div-by-zero");
802 double fMaxWidthFactor =
static_cast<double>(nCurrentWidth)
803 / static_cast<double>(nWidth);
805 assert(nHeight &&
"div-by-zero");
806 double fMaxHeightFactor =
static_cast<double>(nCurrentHeight)
807 / static_cast<double>(nHeight);
808 double fMaxFactor = std::min(fMaxHeightFactor, fMaxWidthFactor);
813 fWidthFactor = std::max(fWidthFactor, fHeightFactor);
815 else if(bIsShrinking)
817 fWidthFactor = std::min(fWidthFactor, fHeightFactor);
821 fWidthFactor = fHeightFactor = std::min(fWidthFactor, fMaxFactor);
828 bool bNeedToScale(bIsGrowing);
830 if(!bNeedToScale && bIsShrinking)
834 const bool bFitsInX(aRect.
Right() <= aCurrentCellRect.
Left() + nCurrentWidth);
835 const bool bFitsInY(aRect.
Bottom() <= aCurrentCellRect.
Top() + nCurrentHeight);
838 bNeedToScale = (!bFitsInX || !bFitsInY);
850 aChange.
scale(fWidthFactor, fHeightFactor);
909 pDoc->
GetMMRect(nCol1, nRow1, nCol1, nRow1, nTab1,
false ));
922 static_cast<SdrPathObj*>(pObj)->GetPathPoly().getB2DPolygon(0));
925 const Point aPointLT(
FRound(std::min(aB2DPoint0.getX(), aB2DPoint1.getX())),
926 FRound(std::min(aB2DPoint0.getY(), aB2DPoint1.getY())));
927 const Point aPointRB(
FRound(std::max(aB2DPoint0.getX(), aB2DPoint1.getX())),
928 FRound(std::max(aB2DPoint0.getY(), aB2DPoint1.getY())));
953 lcl_SetLogicRectFromAnchor(pObj, rNoRotatedAnchor, pDoc);
992 OSL_ENSURE( pDoc,
"ScDrawLayer::RecalcPos - missing document" );
998 OSL_ENSURE( rData.
maStart.
IsValid(),
"ScDrawLayer::RecalcPos - invalid position for cell note" );
1003 if( bUpdateNoteCaptionPos )
1009 pNote->UpdateCaptionPos( rData.
maStart );
1032 if ( bNegativePage )
1038 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1058 if (!pDoc->
ColHidden(nCol1, nTab1,
nullptr, &nLastCol))
1059 aPos.AdjustX(pDoc->
GetColWidth( nCol1, nTab1 ) / 4 );
1060 if (!pDoc->
RowHidden(nRow1, nTab1,
nullptr, &nLastRow))
1064 Point aStartPos = aPos;
1065 if ( bNegativePage )
1066 aStartPos.setX( -aStartPos.X() );
1067 if ( pObj->
GetPoint( 0 ) != aStartPos )
1070 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1079 if (aEndPos.Y() < 0)
1081 if ( bNegativePage )
1082 aEndPos.setX( -aEndPos.X() );
1083 if ( pObj->
GetPoint( 1 ) != aEndPos )
1086 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1096 if (!pDoc->
ColHidden(nCol2, nTab2,
nullptr, &nLastCol))
1097 aPos.AdjustX(pDoc->
GetColWidth( nCol2, nTab2 ) / 4 );
1098 if (!pDoc->
RowHidden(nRow2, nTab2,
nullptr, &nLastRow))
1102 Point aEndPos = aPos;
1103 if ( bNegativePage )
1104 aEndPos.setX( -aEndPos.X() );
1105 if ( pObj->
GetPoint( 1 ) != aEndPos )
1108 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1117 if (aStartPos.X() < 0)
1119 if (aStartPos.Y() < 0)
1121 if ( bNegativePage )
1122 aStartPos.setX( -aStartPos.X() );
1123 if ( pObj->
GetPoint( 0 ) != aStartPos )
1126 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1155 if (!lcl_AreRectanglesApproxEqual(aNew, aOld))
1158 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1163 if (pObj->
IsPolyObj() && nOldWidth && nOldHeight)
1166 Size aSizeMove(aNew.
Left()-aOld.Left(), aNew.
Top()-aOld.Top());
1169 double fXFrac =
static_cast<double>(aNew.
GetWidth()) / static_cast<double>(nOldWidth);
1170 double fYFrac =
static_cast<double>(aNew.
GetHeight()) / static_cast<double>(nOldHeight);
1192 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1202 if (bEndAnchorIsBad)
1219 OSL_ENSURE( pDoc,
"ScDrawLayer::GetPrintArea without document" );
1224 OSL_ENSURE( rRange.
aEnd.
Tab() == nTab,
"GetPrintArea: Tab differ" );
1241 for (i=0; i<nStartCol; i++)
1245 for (i=nStartCol; i<=nEndCol; i++)
1259 if ( bNegativePage )
1263 ::std::swap( nStartX, nEndX );
1267 OSL_ENSURE(pPage,
"Page not found");
1278 if ( !bSetHor && ( aObjRect.
Right() < nStartX || aObjRect.
Left() > nEndX ) )
1280 if ( !bSetVer && ( aObjRect.
Bottom() < nStartY || aObjRect.
Top() > nEndY ) )
1287 if (aObjRect.
Left() < nStartX) nStartX = aObjRect.
Left();
1288 if (aObjRect.
Right() > nEndX) nEndX = aObjRect.
Right();
1292 if (aObjRect.
Top() < nStartY) nStartY = aObjRect.
Top();
1293 if (aObjRect.
Bottom() > nEndY) nEndY = aObjRect.
Bottom();
1298 pObject = aIter.
Next();
1302 if ( bNegativePage )
1306 ::std::swap( nStartX, nEndX );
1311 OSL_ENSURE( nStartX<=nEndX && nStartY<=nEndY,
"Start/End wrong in ScDrawLayer::GetPrintArea" );
1321 if (nWidth <= nStartX)
1326 if (nWidth > nStartX)
1336 if (nWidth <= nEndX)
1358 (nRow>0 ? (nRow-1) : 0));
1397 std::unique_ptr<SdrUndoGroup> pRet = std::move(
pUndoGroup);
1404 SCCOL nDx,
SCROW nDy,
bool bInsDel,
bool bUpdateNoteCaptionPos )
1406 OSL_ENSURE( pDoc,
"ScDrawLayer::MoveArea without document" );
1422 for (
SCCOL s=0; s<nDx; s++)
1425 for (
SCCOL s=-1; s>=nDx; s--)
1426 aMove.AdjustX( -(pDoc->
GetColWidth(s+nCol1,nTab)) );
1428 aMove.AdjustY(pDoc->
GetRowHeight( nRow1, nRow1+nDy-1, nTab) );
1430 aMove.AdjustY( -sal_Int16(pDoc->
GetRowHeight( nRow1+nDy, nRow1-1, nTab)) );
1432 if ( bNegativePage )
1433 aMove.setX( -aMove.X() );
1438 if ( aMove.X() != 0 && nDx < 0 )
1439 aTopLeft.AdjustX(aMove.X() );
1440 if ( aMove.Y() < 0 )
1441 aTopLeft.AdjustY(aMove.Y() );
1446 MoveCells( nTab, nCol1,nRow1, nCol2,nRow2, nDx,nDy, bUpdateNoteCaptionPos );
1451 OSL_ENSURE( pDoc,
"ScDrawLayer::HasObjectsInRows without document" );
1456 OSL_ENSURE(pPage,
"Page not found");
1483 if ( bNegativePage )
1486 bool bFound =
false;
1491 while ( pObject && !bFound )
1497 pObject = aIter.
Next();
1506 OSL_ENSURE( pDoc,
"ScDrawLayer::DeleteObjectsInArea without document" );
1511 OSL_ENSURE(pPage,
"Page ?");
1521 size_t nDelCount = 0;
1529 std::unique_ptr<SdrObject*[]> ppObj(
new SdrObject*[nObjCount]);
1545 ppObj[nDelCount++] = pObject;
1556 ppObj[nDelCount++] = pObject;
1559 ppObj[nDelCount++] = pObject;
1564 pObject = aIter.
Next();
1568 for (
size_t i=1;
i<=nDelCount; ++
i)
1569 AddCalcUndo( std::make_unique<SdrUndoRemoveObj>( *ppObj[nDelCount-
i] ) );
1571 for (
size_t i=1;
i<=nDelCount; ++
i)
1577 OSL_ENSURE( pDoc,
"ScDrawLayer::DeleteObjectsInSelection without document" );
1588 for (
const SCTAB nTab : rMark)
1590 if (nTab >= nTabCount)
1600 size_t nDelCount = 0;
1606 std::unique_ptr<SdrObject*[]> ppObj(
new SdrObject*[nObjCount]);
1618 bool bObjectInMarkArea =
1619 aMarkBound.
IsInside(aObjRect) && rMark.IsAllMarked(aRange);
1622 bool bObjectAnchoredToMarkedCell
1624 && pObjData && rMark.IsCellMarked(pObjData->
maStart.
Col(),
1626 if (bObjectInMarkArea || bObjectAnchoredToMarkedCell)
1628 ppObj[nDelCount++] = pObject;
1632 pObject = aIter.
Next();
1638 for (
size_t i=1;
i<=nDelCount; ++
i)
1639 AddCalcUndo( std::make_unique<SdrUndoRemoveObj>( *ppObj[nDelCount-
i] ) );
1641 for (
size_t i=1;
i<=nDelCount; ++
i)
1669 bool bObjectInArea = rRange.
IsInside(aObjRect);
1674 bObjectInArea = bObjectInArea || aClipRange.
In(pObjData->
maStart);
1692 pDestPage = pDestModel->
GetPage( static_cast<sal_uInt16>(nTab) );
1695 OSL_ENSURE( pDestPage,
"no page" );
1703 pNewObject->NbcMove(
Size(0,0));
1711 pOldObject = aIter.
Next();
1723 const ScRange & rRange = rRanges[
i ];
1724 if ( !rClipRange.
In( rRange ) )
1736 bool bChanged =
false;
1744 if ( rSourceRange.
In( rRange ) )
1749 if (!rRange.
Move( nDiffX, nDiffY, nDiffZ, aErrorRange))
1751 assert(!
"can't move range");
1764 OSL_ENSURE( pDoc,
"ScDrawLayer::CopyFromClip without document" );
1773 OSL_FAIL(
"CopyFromClip, bDrawIsInUndo");
1777 bool bMirrorObj = ( rSourceRange.
Left() < 0 && rSourceRange.
Right() < 0 &&
1778 rDestRange.
Left() > 0 && rDestRange.
Right() > 0 ) ||
1779 ( rSourceRange.
Left() > 0 && rSourceRange.
Right() > 0 &&
1780 rDestRange.
Left() < 0 && rDestRange.
Right() < 0 );
1787 SdrPage* pSrcPage = pClipModel->
GetPage(static_cast<sal_uInt16>(nSourceTab));
1789 OSL_ENSURE( pSrcPage && pDestPage,
"draw page missing" );
1790 if ( !pSrcPage || !pDestPage )
1800 bool bSameDoc = pDoc && pClipDoc && pDoc->
GetPool() == pClipDoc->
GetPool();
1805 OUString aDestTabName;
1806 bool bRestoreDestTabName =
false;
1807 if( pOldObject && !bSameDoc && !bDestClip )
1809 if( pDoc && pClipDoc )
1811 OUString aSourceTabName;
1812 if( pClipDoc->
GetName( nSourceTab, aSourceTabName )
1813 && pDoc->
GetName( nDestTab, aDestTabName ) )
1815 if( aSourceTabName != aDestTabName &&
1818 bRestoreDestTabName = pDoc->
RenameTab( nDestTab, aSourceTabName );
1825 Size aMove( rDestRange.
Left() - aMirroredSource.
Left(), rDestRange.
Top() - aMirroredSource.
Top() );
1832 tools::Long nWidthDiff = nDestWidth - nSourceWidth;
1833 tools::Long nHeightDiff = nDestHeight - nSourceHeight;
1837 bool bResize =
false;
1840 if ( std::abs(nWidthDiff) > 1 && nDestWidth > 1 && nSourceWidth > 1 )
1842 aHorFract =
Fraction( nDestWidth, nSourceWidth );
1845 if ( std::abs(nHeightDiff) > 1 && nDestHeight > 1 && nSourceHeight > 1 )
1847 aVerFract =
Fraction( nDestHeight, nSourceHeight );
1857 SCTAB nClipTab = bRestoreDestTabName ? nDestTab : nSourceTab;
1860 bool bObjectInArea = rSourceRange.
IsInside(aObjRect);
1863 bObjectInArea = bObjectInArea || aClipRange.
In(pObjData->
maStart);
1873 pNewObject->NbcMove( aMove );
1875 pNewObject->NbcResize( aRefPos, aHorFract, aVerFract );
1879 AddCalcUndo( std::make_unique<SdrUndoInsertObj>( *pNewObject ) );
1883 if ( pNewObject->GetObjIdentifier() ==
OBJ_OLE2 )
1885 uno::Reference< embed::XEmbeddedObject > xIPObj =
static_cast<SdrOle2Obj*
>(pNewObject)->GetObjRef();
1886 uno::Reference< embed::XClassifiedObject > xClassified = xIPObj;
1888 if ( xClassified.is() )
1891 aObjectClassName =
SvGlobalName( xClassified->getClassID() );
1892 }
catch( uno::Exception& )
1901 if( xNewChart.is() && !xNewChart->hasInternalDataProvider() )
1903 OUString aChartName =
static_cast<SdrOle2Obj*
>(pNewObject)->GetPersistName();
1904 ::std::vector< ScRangeList > aRangesVector;
1906 if( !aRangesVector.empty() )
1908 bool bInSourceRange =
false;
1915 if ( ( bInSourceRange || bSameDoc ) && !bDestClip )
1917 if ( bInSourceRange )
1919 if ( rDestPos != aClipRange.
aStart )
1937 uno::Reference< chart::XChartDocument > xNewChartDoc( xNewChart, uno::UNO_QUERY );
1938 if( xOldChartDoc.is() && xNewChartDoc.is() )
1939 xNewChartDoc->attachData( xOldChartDoc->getData() );
1949 pOldObject = aIter.
Next();
1952 if( bRestoreDestTabName )
1953 pDoc->
RenameTab( nDestTab, aDestTabName );
1972 Point aRef1( 0, 0 );
1973 Point aRef2( 0, 1 );
1975 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1976 pObj->
Mirror( aRef1, aRef2 );
1986 AddCalcUndo( std::make_unique<SdrUndoMoveObj>( *pObj, aMoveSize ) );
1987 pObj->
Move( aMoveSize );
2002 OSL_ENSURE( rDoc.
ValidColRowTab( rPos.
Col(), rPos.
Row(), rPos.
Tab() ),
"ScDrawLayer::GetCellRect - invalid cell address" );
2007 for(
SCCOL nCol = 0; nCol < rPos.
Col(); ++nCol )
2009 if( rPos.
Row() > 0 )
2022 Point aBotRight = aTopLeft;
2023 for(
SCCOL nCol = rPos.
Col(); nCol <= aEndPos.
Col(); ++nCol )
2028 aTopLeft.setX( static_cast< tools::Long >( aTopLeft.X() *
HMM_PER_TWIPS ) );
2029 aTopLeft.setY( static_cast< tools::Long >( aTopLeft.Y() *
HMM_PER_TWIPS ) );
2030 aBotRight.setX( static_cast< tools::Long >( aBotRight.X() *
HMM_PER_TWIPS ) );
2031 aBotRight.setY( static_cast< tools::Long >( aBotRight.Y() *
HMM_PER_TWIPS ) );
2050 if ( aName.isEmpty() )
2051 aName = static_cast<const SdrOle2Obj*>(pObj)->GetPersistName();
2061 return ( pObj->
GetName() == rName ||
2063 static_cast<const SdrOle2Obj*
>(pObj)->GetPersistName() == rName ) );
2069 for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++)
2072 OSL_ENSURE(pPage,
"Page ?");
2082 rFoundTab =
static_cast<SCTAB>(nTab);
2086 pObject = aIter.
Next();
2096 OUString aBase =
ScResId(STR_GRAPHICNAME) +
" ";
2099 OUString aGraphicName;
2105 aGraphicName = aBase + OUString::number( nId );
2106 bThere = (
GetNamedObject( aGraphicName, 0, nDummy ) != nullptr );
2112 return aGraphicName;
2120 for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++)
2123 OSL_ENSURE(pPage,
"Page ?");
2139 pObject = aIter.
Next();
2150 for( sal_uInt16 i = 0;
i < nCount;
i++ )
2153 if( pData && pData->
GetInventor() == SdrInventor::ScOrSwDraw && pData->
GetId() == nId )
2159 void DeleteFirstUserDataOfType(
SdrObject *pObj, sal_uInt16 nId)
2162 for( sal_uInt16 i = nCount;
i > 0;
i-- )
2165 if( pData && pData->
GetInventor() == SdrInventor::ScOrSwDraw && pData->
GetId() == nId )
2192 bool bResizeWithCell )
2221 if (lcl_NeedsMirrorYCorrection(&rObj))
2225 const Point aRight(aLeft.X() + 1000, aLeft.Y());
2234 static_cast<SdrMeasureObj&
>(rObj).TakeUnrotatedSnapRect(aObjRect2);
2290 pAnchor->
maEnd = aRange.aEnd;
2293 aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aEnd.Tab() );
2305 return GetFirstUserDataOfType(&rObj,
SC_UD_OBJDATA) !=
nullptr;
2342 std::vector<SdrObject*>
2347 return std::vector<SdrObject*>();
2349 std::vector<SdrObject*> aObjects;
2355 if (!dynamic_cast<SdrCaptionObj*>(pObject))
2358 if (pObjData && aRange.
In(pObjData->
maStart))
2359 aObjects.push_back(pObject);
2361 pObject = aIter.
Next();
2366 std::map<SCROW, std::vector<SdrObject*>>
2371 return std::map<
SCROW, std::vector<SdrObject*>>();
2373 std::map<SCROW, std::vector<SdrObject*>> aRowObjects;
2376 ScRange aRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab);
2379 if (!dynamic_cast<SdrCaptionObj*>(pObject))
2382 if (pObjData && aRange.
In(pObjData->
maStart))
2383 aRowObjects[pObjData->
maStart.
Row()].push_back(pObject);
2385 pObject = aIter.
Next();
2396 if (!pPage || pPage->GetObjCount() < 1)
2403 if (!dynamic_cast<SdrCaptionObj*>(pObject))
2406 if (pObjData && rRange.
In(pObjData->
maStart))
2409 pObject = aIter.
Next();
2419 return std::vector<SdrObject*>();
2421 std::vector<SdrObject*> aObjects;
2427 if (!dynamic_cast<SdrCaptionObj*>(pObject))
2430 if (pObjData && aRange.
In(pObjData->
maStart))
2431 aObjects.push_back(pObject);
2433 pObject = aIter.
Next();
2448 pObjData->
maStart = rNewPosition;
2451 const SCCOL nObjectColSpan = aOldEnd.
Col() - aOldStart.
Col();
2452 const SCROW nObjectRowSpan = aOldEnd.
Row() - aOldStart.
Row();
2454 aNewEnd.
IncRow(nObjectRowSpan);
2455 aNewEnd.
IncCol(nObjectColSpan);
2456 pObjData->
maEnd = aNewEnd;
2459 RecalcPos(pObject, *pObjData,
false,
false);
2465 sal_uInt16 nFound = 0;
2466 for( sal_uInt16
i = 0;
i < nCount;
i++ )
2470 return static_cast<ScDrawObjData*>(pData);
2472 if( pObj && bCreate )
2486 if( pObj && bCreate )
2549 css::uno::Reference< css::uno::XInterface > xRet;
SdrOutliner & GetDrawOutliner(const SdrTextObj *pObj=nullptr) const
void BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
#define LINK(Instance, Class, Member)
std::map< SCROW, std::vector< SdrObject * > > GetObjectsAnchoredToRange(SCTAB nTab, SCCOL nCol, SCROW nStartRow, SCROW nEndRow)
void EnsureGraphicNames()
SCCOL GetColMerge() const
static void GetCellAnchorFromPosition(const tools::Rectangle &rRectangle, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bHiddenAsZero=true)
static SfxObjectShell * pGlobalDrawPersist
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
SdrMetricItem makeSdrShadowYDistItem(tools::Long nDist)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
constexpr TypedWhichId< SvxScriptSpaceItem > EE_PARA_ASIANCJKSPACING(EE_PARA_START+4)
static void SetVisualCellAnchored(SdrObject &, const ScDrawObjData &rAnchor)
void GetClipStart(SCCOL &nClipX, SCROW &nClipY)
virtual void SetSize(const Size &aSiz)
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
virtual const tools::Rectangle & GetCurrentBoundRect() const
std::vector< SdrObject * > GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow)
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
void SetPoint(const Point &rPnt, sal_uInt32 i)
void MirrorRTL(SdrObject *pObj)
std::unique_ptr< ContentProperties > pData
virtual ~ScDrawLayer() override
void SetName(const OUString &rStr, const bool bSetChanged=true)
virtual bool IsPolyObj() const
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact)
static css::uno::Reference< css::chart2::XChartDocument > GetChartFromSdrObject(const SdrObject *pObject)
static void SetPageAnchored(SdrObject &)
void ResizeLastRectFromAnchor(const SdrObject *pObj, ScDrawObjData &rData, bool bUseLogicRect, bool bNegativePage, bool bCanResize)
LanguageType getLanguageType(bool bResolveSystem=true) const
ScUndoObjData(SdrObject *pObj, const ScAddress &rOS, const ScAddress &rOE, const ScAddress &rNS, const ScAddress &rNE)
static ScMacroInfo * GetMacroInfo(SdrObject *pObj, bool bCreate=false)
void ResetTab(SCTAB nStart, SCTAB nEnd)
static const AllSettings & GetSettings()
virtual Point GetRelativePos() const
SC_DLLPUBLIC bool ValidNewTabName(const OUString &rName) const
virtual void SetChanged(bool bFlg=true) override
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
SdrObject * GetObj(size_t nNum) const
static bool IsCellAnchored(const SdrObject &rObj)
static bool lcl_MoveRanges(::std::vector< ScRangeList > &rRangesVector, const ScRange &rSourceRange, const ScAddress &rDestPos)
size_t GetObjCount() const
void PutInOrder(ScAddress &rAddress)
void DeleteObjectsInArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bAnchored=false)
static void lcl_ReverseTwipsToMM(tools::Rectangle &rRect)
SC_DLLPUBLIC bool Move(SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, ScRange &rErrorRange, const ScDocument *pDocument=nullptr)
bool HasObjectsInRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow)
constexpr SdrLayerID SC_LAYER_BACK(1)
std::vector< SdrObject * > GetObjectsAnchoredToCols(SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol)
void CopyFromClip(ScDrawLayer *pClipModel, SCTAB nSourceTab, const tools::Rectangle &rSourceRange, const ScAddress &rDestPos, const tools::Rectangle &rDestRange)
static tools::Rectangle GetCellRect(const ScDocument &rDoc, const ScAddress &rPos, bool bMergedCell)
Returns the rectangle for the passed cell address in 1/100 mm.
void RecalcPos(SdrObject *pObj, ScDrawObjData &rData, bool bNegativePage, bool bUpdateNoteCaptionPos)
css::uno::Reference< css::frame::XModel > GetModel() const
virtual ~ScTabDeletedHint() override
SC_DLLPUBLIC ScRange GetRange(SCTAB nTab, const tools::Rectangle &rMMRect, bool bHiddenAsZero=true) const
virtual SdrObjKind GetObjIdentifier() const
void DeleteObjectsInSelection(const ScMarkData &rMark)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
EmbeddedObjectRef * pObject
void GetClipArea(SCCOL &nClipX, SCROW &nClipY, bool bIncludeFiltered)
bool ValidColRowTab(SCCOL nCol, SCROW nRow, SCTAB nTab) const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
static sal_uInt16 IsChart(const SvGlobalName &rName)
virtual void Redo() override
void MoveArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, bool bInsDel, bool bUpdateNoteCaptionPos)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
virtual const tools::Rectangle & GetSnapRect() const
virtual css::uno::Reference< css::uno::XInterface > createUnoModel() override
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
Notes.
static void SetGlobalDrawPersist(SfxObjectShell *pPersist)
void setShapeRect(const ScDocument *rDoc, tools::Rectangle rNewRect, bool bIsVisible=true)
static bool lcl_IsAllInRange(const ::std::vector< ScRangeList > &rRangesVector, const ScRange &rClipRange)
void EnableUndo(bool bEnable)
void SetChartListenerCollectionNeedsUpdate(bool bFlg)
virtual ~ScUndoObjData() override
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
ScUndoAnchorData(SdrObject *pObj, ScDocument *pDoc, SCTAB nTab)
virtual SdrPage * AllocPage(bool bMasterPage) override
SdrPage * getSdrPageFromSdrObject() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
SC_DLLPUBLIC SCTAB GetTableCount() const
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
Additional class containing cell annotation data.
bool IsMultiMarked() const
void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
virtual void SetChanged(bool bFlg=true)
void SetName(const OUString &rName)
B2IRange fround(const B2DRange &rRange)
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
static XColorListRef GetStdColorList()
void ScMovePage(sal_uInt16 nOldPos, sal_uInt16 nNewPos)
const LanguageTag & GetLanguageTag() const
SdrOutliner & GetHitTestOutliner() const
virtual void DeletePage(sal_uInt16 nPgNum)
virtual void Redo() override
ScDocument * GetDocument() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
const tools::Rectangle & getShapeRect() const
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
void SetPageSize(sal_uInt16 nPageNo, const Size &rSize, bool bUpdateNoteCaptionPos)
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
bool GetPrintArea(ScRange &rRange, bool bSetHor, bool bSetVer) const
SC_DLLPUBLIC void InitDrawLayer(SfxObjectShell *pDocShell=nullptr)
static void SetCellAnchored(SdrObject &, const ScDrawObjData &rAnchor)
bool IsImportingXML() const
void IncCol(SCCOL nDelta=1)
tools::Long FRound(double fVal)
virtual void NbcMirror(const Point &rRef1, const Point &rRef2)
ScDrawLayer(ScDocument *pDocument, const OUString &rName)
static ScAnchorType GetAnchorType(const SdrObject &)
static ScDrawObjData * GetNoteCaptionData(SdrObject *pObj, SCTAB nTab)
Returns the object data, if the passed object is a cell note caption.
static void SetCellAnchoredFromPosition(SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab, bool bResizeWithCell)
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false)
static ScRange lcl_getClipRangeFromClipDoc(ScDocument *pClipDoc, SCTAB nClipTab)
static css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator()
void BroadcastObjectChange() const
virtual ~ScUndoAnchorData() override
const SdrPage * GetPage(sal_uInt16 nPgNum) const
SdrLayer * NewLayer(const OUString &rName, sal_uInt16 nPos=0xFFFF)
static bool IsNamedObject(const SdrObject *pObj, std::u16string_view rName)
void SetCalcFieldValueHdl(const Link< EditFieldInfo *, void > &rLink)
void IncRow(SCROW nDelta=1)
bool ScAddPage(SCTAB nTab)
static tools::Long TwipsToHmm(tools::Long nVal)
void DeleteUserData(sal_uInt16 nNum)
OUString ScResId(const char *pId)
void scale(double fX, double fY)
SdrModel & getSdrModelFromSdrObject() const
void MoveObject(SdrObject *pObj, const ScAddress &rNewPosition)
void AddCalcUndo(std::unique_ptr< SdrUndoAction > pUndo)
void SetVisible(bool bVisible)
virtual void SetLogicRect(const tools::Rectangle &rRect)
OUString GetNewGraphicName(tools::Long *pnCounter=nullptr) const
virtual void Move(const Size &rSiz)
SfxItemPool * GetEditTextObjectPool() const
static bool IsInBlock(const ScAddress &rPos, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
bool IsResizeProtect() const
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
const XColorListRef & GetColorList() const
virtual void Undo() override
virtual void SetRelativePos(const Point &rPnt)
SCROW GetRowForHeight(SCTAB nTab, sal_uLong nHeight) const
Given the height i.e.
bool In(const ScAddress &) const
is Address& in Range?
virtual SdrObject * RemoveObject(size_t nObjNum)
virtual void Mirror(const Point &rRef1, const Point &rRef2)
B2DRange getRange(const B2DPolygon &rCandidate)
void AppendUserData(std::unique_ptr< SdrObjUserData > pData)
virtual SdrLayerID GetLayer() const
SfxItemPool * GetSecondaryPool() const
SdrObject * GetNamedObject(std::u16string_view rName, sal_uInt16 nId, SCTAB &rFoundTab) const
SfxItemPool * m_pItemPool
void MoveCells(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, bool bUpdateNoteCaptionPos)
virtual void Undo() override
void SetDefaultMetric(MapUnit eNewMetric)
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
void ScRenamePage(SCTAB nTab, const OUString &rNewName)
std::unique_ptr< SdrUndoGroup > GetCalcUndo()
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
virtual void NbcSetLogicRect(const tools::Rectangle &rRect)
SdrMetricItem makeSdrShadowXDistItem(tools::Long nDist)
static ScDrawObjData * GetObjDataTab(SdrObject *pObj, SCTAB nTab)
virtual void NbcMove(const Size &rSiz)
constexpr SdrLayerID SC_LAYER_FRONT(0)
static ScDrawObjData * GetNonRotatedObjData(SdrObject *pObj, bool bCreate=false)
SdrObjUserData * GetUserData(sal_uInt16 nNum) const
constexpr SdrLayerID SC_LAYER_INTERN(2)
static void MirrorRectRTL(tools::Rectangle &rRect)
static void UpdateCellAnchorFromPositionEnd(const SdrObject &rObj, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bUseLogicRect=true)
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
static OUString GetVisibleName(const SdrObject *pObj)
std::unique_ptr< SdrUndoGroup > pUndoGroup
void InitializeCellAnchoredObj(SdrObject *pObj, ScDrawObjData &rData)
static bool isKorean(LanguageType nLang)
SC_DLLPUBLIC void GetChartRanges(std::u16string_view rChartName, std::vector< ScRangeList > &rRanges, const ScDocument &rSheetNameDoc)
sal_uInt16 GetUserDataCount() const
void translate(double fX, double fY)
virtual ~ScTabSizeChangedHint() override
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
virtual void MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
void SetControlLayerName(const OUString &rNewName)
SC_DLLPUBLIC ScColumnsRange GetColumnsRange(SCTAB nTab, SCCOL nColBegin, SCCOL nColEnd) const
bool HasObjectsAnchoredInRange(const ScRange &rRange)
virtual void SetSnapRect(const tools::Rectangle &rRect)
virtual bool shouldKeepAspectRatio() const
static bool IsNoteCaption(SdrObject *pObj)
Returns true, if the passed object is the caption of a cell note.
double ConvertDoubleValue(double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
SfxObjectShell * GetDocumentShell() const
bool IsUndoEnabled() const
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
const SfxItemPool & GetItemPool() const
SCROW GetRowMerge() const
void SetScaleUnit(MapUnit eMap)
void GetMultiMarkArea(ScRange &rRange) const
virtual const tools::Rectangle & GetLogicRect() const
void ScCopyPage(sal_uInt16 nOldPos, sal_uInt16 nNewPos)
ScTabDeletedHint(SCTAB nTabNo)
static E3dObjFactory * pF3d
void SetDisableTextEditUsesCommonUndoManager(bool bNew)
const SdrLayerAdmin & GetLayerAdmin() const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
void SetChartRanges(std::u16string_view rChartName, const std::vector< ScRangeList > &rRanges)
SdrInventor GetInventor() const
static tools::Long HmmToTwips(tools::Long nVal)
void SetPropertyList(XPropertyListRef const &p)
virtual Point GetPoint(sal_uInt32 i) const
#define LANGUAGE_JAPANESE
void ClearModel(bool bCalledFromDestructor)
void ScRemovePage(SCTAB nTab)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
const tools::Rectangle & getLastCellRect() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
ScTabSizeChangedHint(SCTAB nTabNo)
SC_DLLPUBLIC sal_uLong GetColOffset(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
static bool IsResizeWithCell(const SdrObject &rObj)
sal_uInt16 GetPageCount() const
SC_DLLPUBLIC sal_uLong GetRowOffset(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
void SetPoolDefaultItem(const SfxPoolItem &)
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
void CopyToClip(ScDocument *pClipDoc, SCTAB nTab, const tools::Rectangle &rRange)
virtual SdrModel * AllocModel() const override