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>
44#include <svx/svxids.hrc>
68#include <osl/diagnose.h>
76#include <document.hxx>
84#include <charthelper.hxx>
98#define DET_ARROW_OFFSET 1000
126 OSL_ENSURE(
pData,
"ScUndoObjData: Data missing");
145 OSL_ENSURE(
pData,
"ScUndoObjData: Data missing");
177 if (
mxObj->IsInserted() &&
mxObj->getSdrPageFromSdrObject())
180 mxObj->getSdrModelFromSdrObject().Broadcast(aHint);
197 if (
mxObj->IsInserted() &&
mxObj->getSdrPageFromSdrObject())
200 mxObj->getSdrModelFromSdrObject().Broadcast(aHint);
222#define MAXMM 10000000
241 nClipEndX = nClipEndX + nClipStartX;
242 nClipEndY += nClipStartY;
244 return ScRange(nClipStartX, nClipStartY, nClipTab, nClipEndX, nClipEndY, nClipTab);
250 pGlobalDrawPersist ? pGlobalDrawPersist : (pDocument ? pDocument->GetDocumentShell() : nullptr)),
254 bAdjustEnabled( true ),
255 bHyphenatorSet( false )
327 if ( pHitOutlinerPool )
348 Broadcast(
SdrHint(SdrHintKind::ModelCleared));
376 auto pSet = &pSheet->GetItemSet();
415 css::uno::Reference< css::linguistic2::XHyphenator >
435 for (sal_uInt16
i=0;
i<
nCount && !bFound;
i++)
446 auto pNewModel = std::make_unique<ScDrawLayer>(
nullptr,
aName);
447 auto pNewPool =
static_cast<ScStyleSheetPool*
>(pNewModel->GetStyleSheetPool());
450 return pNewModel.release();
459 InsertPage(pPage.get(),
static_cast<sal_uInt16
>(nTab));
461 AddCalcUndo(std::make_unique<SdrUndoNewPage>(*pPage));
476 AddCalcUndo(std::make_unique<SdrUndoDelPage>(*pPage));
495 sal_uInt16 nMinPos = std::min(nOldPos, nNewPos);
509 if (pOldPage && pNewPage)
527 pNewObject->NbcMove(
Size(0,0));
537 AddCalcUndo( std::make_unique<SdrUndoInsertObj>( *pNewObject ) );
539 pOldObject = aIter.
Next();
553 if (nEnd >= nPageSize)
555 nEnd = nPageSize - 1;
557 for (
SCTAB i = nStart;
i <= nEnd; ++
i)
578 return rPos.
Col() >= nCol1 && rPos.
Col() <= nCol2 &&
579 rPos.
Row() >= nRow1 && rPos.
Row() <= nRow2;
583 SCCOL nDx,
SCROW nDy,
bool bUpdateNoteCaptionPos )
586 OSL_ENSURE(pPage,
"Page not found");
601 bool bChange =
false;
604 pData->maStart.IncCol( nDx );
605 pData->maStart.IncRow( nDy );
610 pData->maEnd.IncCol( nDx );
611 pData->maEnd.IncRow( nDy );
616 if (
dynamic_cast<const SdrRectObj*
>( pObj) !=
nullptr &&
pData->maStart.IsValid() &&
pData->maEnd.IsValid() )
621 if ( pNoRotatedAnchor )
625 if ( aOldSttNoRotatedAnchor.
IsValid() &&
IsInBlock( aOldSttNoRotatedAnchor, nCol1,nRow1, nCol2,nRow2 ) )
630 if ( aOldEndNoRotatedAnchor.
IsValid() &&
IsInBlock( aOldEndNoRotatedAnchor, nCol1,nRow1, nCol2,nRow2 ) )
637 AddCalcUndo( std::make_unique<ScUndoObjData>( pObj, aOldStt, aOldEnd,
pData->maStart,
pData->maEnd ) );
651 if ( rSize != pPage->
GetSize() )
683 switch (eObjectHandling)
701 switch (eObjectHandling)
733 Point aAvailableDiff(aWantedDiff);
736 if (aAvailableDiff.Y() > nHeight)
737 aAvailableDiff.setY( nHeight );
738 if (aAvailableDiff.X() > nWidth)
739 aAvailableDiff.setX( nWidth );
740 return aAvailableDiff;
755 if (std::abs(rRectA.
Left() - rRectB.
Left()) > 1)
757 if (std::abs(rRectA.
Top() - rRectB.
Top()) > 1)
759 if (std::abs(rRectA.
Right() - rRectB.
Right()) > 1)
766bool lcl_NeedsMirrorYCorrection(
const SdrObject* pObj)
784 const bool bNeedsMirrorYCorrection = lcl_NeedsMirrorYCorrection(pObj);
785 if (bNeedsMirrorYCorrection)
789 const Point aRight(aLeft.X() + 1000, aLeft.Y());
797 Point aStartPoint(aStartCellRect.Left(), aStartCellRect.Top());
805 Point aEndPoint(aEndCellRect.Left(), aEndCellRect.Top());
811 aNewRectangle.Normalize();
812 if (!lcl_AreRectanglesApproxEqual(pObj->
GetLogicRect(), aNewRectangle))
816 if (bNeedsMirrorYCorrection)
820 const Point aRight(aLeft.X() + 1000, aLeft.Y());
828 bool bNegativePage,
bool bCanResize)
861 aEnd += lcl_calcAvailableDiff(*
pDoc, nCol2, nRow2, nTab2, rData.
maEndOffset);
865 else if (!aLastCellRect.
IsEmpty())
878 if(nCurrentWidth + 1 == nLastWidth || nCurrentWidth == nLastWidth + 1)
880 nCurrentWidth = nLastWidth;
883 if(nCurrentHeight + 1 == nLastHeight || nCurrentHeight == nLastHeight + 1)
885 nCurrentHeight = nLastHeight;
889 double fWidthFactor(nCurrentWidth == nLastWidth || 0 == nLastWidth
891 :
static_cast<double>(nCurrentWidth) /
static_cast<double>(nLastWidth));
892 double fHeightFactor(nCurrentHeight == nLastHeight || 0 == nLastHeight
894 :
static_cast<double>(nCurrentHeight) /
static_cast<double>(nLastHeight));
897 const bool bIsGrowing(nCurrentWidth > nLastWidth || nCurrentHeight > nLastHeight);
898 const bool bIsShrinking(nCurrentWidth < nLastWidth || nCurrentHeight < nLastHeight);
899 const bool bIsSizeChanged(bIsGrowing || bIsShrinking);
908 assert(nWidth &&
"div-by-zero");
909 double fMaxWidthFactor =
static_cast<double>(nCurrentWidth)
910 /
static_cast<double>(nWidth);
912 assert(nHeight &&
"div-by-zero");
913 double fMaxHeightFactor =
static_cast<double>(nCurrentHeight)
914 /
static_cast<double>(nHeight);
915 double fMaxFactor = std::min(fMaxHeightFactor, fMaxWidthFactor);
920 fWidthFactor = std::max(fWidthFactor, fHeightFactor);
922 else if(bIsShrinking)
924 fWidthFactor = std::min(fWidthFactor, fHeightFactor);
928 fWidthFactor = fHeightFactor = std::min(fWidthFactor, fMaxFactor);
935 bool bNeedToScale(bIsGrowing);
937 if(!bNeedToScale && bIsShrinking)
941 const bool bFitsInX(aRect.
Right() <= aCurrentCellRect.
Left() + nCurrentWidth);
942 const bool bFitsInY(aRect.
Bottom() <= aCurrentCellRect.
Top() + nCurrentHeight);
945 bNeedToScale = (!bFitsInX || !bFitsInY);
957 aChange.
scale(fWidthFactor, fHeightFactor);
1015 pDoc->
GetMMRect(nCol1, nRow1, nCol1, nRow1, nTab1,
false ));
1028 static_cast<SdrPathObj*
>(pObj)->GetPathPoly().getB2DPolygon(0));
1067 lcl_SetLogicRectFromAnchor(pObj, rNoRotatedAnchor,
pDoc);
1107 OSL_ENSURE(
pDoc,
"ScDrawLayer::RecalcPos - missing document" );
1113 OSL_ENSURE( rData.
maStart.
IsValid(),
"ScDrawLayer::RecalcPos - invalid position for cell note" );
1120 if (bUpdateNoteCaptionPos && pObj->
IsVisible())
1127 pNote->UpdateCaptionPos( rData.
maStart );
1152 if ( bNegativePage )
1158 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1190 Point aStartPos = aPos;
1191 if ( bNegativePage )
1192 aStartPos.
setX( -aStartPos.
X() );
1193 if ( pObj->
GetPoint( 0 ) != aStartPos )
1196 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1205 if (aEndPos.
Y() < 0)
1207 if ( bNegativePage )
1208 aEndPos.
setX( -aEndPos.
X() );
1209 if ( pObj->
GetPoint( 1 ) != aEndPos )
1212 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1228 Point aEndPos = aPos;
1229 if ( bNegativePage )
1230 aEndPos.
setX( -aEndPos.
X() );
1231 if ( pObj->
GetPoint( 1 ) != aEndPos )
1234 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1243 if (aStartPos.
X() < 0)
1245 if (aStartPos.
Y() < 0)
1247 if ( bNegativePage )
1248 aStartPos.
setX( -aStartPos.
X() );
1249 if ( pObj->
GetPoint( 0 ) != aStartPos )
1252 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1281 if (!lcl_AreRectanglesApproxEqual(aNew, aOld))
1284 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1289 if (pObj->
IsPolyObj() && nOldWidth && nOldHeight)
1295 double fXFrac =
static_cast<double>(aNew.
GetWidth()) /
static_cast<double>(nOldWidth);
1296 double fYFrac =
static_cast<double>(aNew.
GetHeight()) /
static_cast<double>(nOldHeight);
1317 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
1328 if (bEndAnchorIsBad)
1345 OSL_ENSURE(
pDoc,
"ScDrawLayer::GetPrintArea without document" );
1350 OSL_ENSURE( rRange.
aEnd.
Tab() == nTab,
"GetPrintArea: Tab differ" );
1367 for (
i=0;
i<nStartCol;
i++)
1371 for (
i=nStartCol;
i<=nEndCol;
i++)
1385 if ( bNegativePage )
1389 ::std::swap( nStartX, nEndX );
1393 OSL_ENSURE(pPage,
"Page not found");
1404 if ( !bSetHor && ( aObjRect.
Right() < nStartX || aObjRect.
Left() > nEndX ) )
1406 if ( !bSetVer && ( aObjRect.
Bottom() < nStartY || aObjRect.
Top() > nEndY ) )
1413 if (aObjRect.
Left() < nStartX) nStartX = aObjRect.
Left();
1414 if (aObjRect.
Right() > nEndX) nEndX = aObjRect.
Right();
1418 if (aObjRect.
Top() < nStartY) nStartY = aObjRect.
Top();
1419 if (aObjRect.
Bottom() > nEndY) nEndY = aObjRect.
Bottom();
1428 if ( bNegativePage )
1432 ::std::swap( nStartX, nEndX );
1437 OSL_ENSURE( nStartX<=nEndX && nStartY<=nEndY,
"Start/End wrong in ScDrawLayer::GetPrintArea" );
1447 if (nWidth <= nStartX)
1452 if (nWidth > nStartX)
1462 if (nWidth <= nEndX)
1484 (nRow>0 ? (nRow-1) : 0));
1523 std::unique_ptr<SdrUndoGroup> pRet = std::move(
pUndoGroup);
1530 SCCOL nDx,
SCROW nDy,
bool bInsDel,
bool bUpdateNoteCaptionPos )
1532 OSL_ENSURE(
pDoc,
"ScDrawLayer::MoveArea without document" );
1548 for (
SCCOL s=0; s<nDx; s++)
1551 for (
SCCOL s=-1; s>=nDx; s--)
1558 if ( bNegativePage )
1559 aMove.
setX( -aMove.
X() );
1564 if ( aMove.
X() != 0 && nDx < 0 )
1566 if ( aMove.
Y() < 0 )
1572 MoveCells( nTab, nCol1,nRow1, nCol2,nRow2, nDx,nDy, bUpdateNoteCaptionPos );
1577 OSL_ENSURE(
pDoc,
"ScDrawLayer::HasObjectsInRows without document" );
1582 OSL_ENSURE(pPage,
"Page not found");
1609 if ( bNegativePage )
1612 bool bFound =
false;
1619 aObjRect =
pObject->GetSnapRect();
1632 OSL_ENSURE(
pDoc,
"ScDrawLayer::DeleteObjectsInArea without document" );
1637 OSL_ENSURE(pPage,
"Page ?");
1654 std::vector<SdrObject*> ppObj;
1655 ppObj.reserve(nObjCount);
1669 aObjRect =
pObject->GetLogicRect();
1675 aObjRect =
pObject->GetCurrentBoundRect();
1694 for (
auto p : ppObj)
1697 for (
auto p : ppObj)
1703 OSL_ENSURE(
pDoc,
"ScDrawLayer::DeleteObjectsInSelection without document" );
1713 for (
const SCTAB nTab : rMark)
1715 if (nTab >= nTabCount)
1730 std::vector<SdrObject*> ppObj;
1731 ppObj.reserve(nObjCount);
1743 bool bObjectInMarkArea =
1747 bool bObjectAnchoredToMarkedCell
1752 if (bObjectInMarkArea || bObjectAnchoredToMarkedCell)
1764 for (
auto p : ppObj)
1767 for (
auto p : ppObj)
1800 bObjectInArea = bObjectInArea || aClipRange.
Contains(pObjData->
maStart);
1817 pDestPage = pDestModel->
GetPage(
static_cast<sal_uInt16
>(nTab) );
1820 OSL_ENSURE( pDestPage,
"no page" );
1861 pOldObject = aIter.
Next();
1873 const ScRange & rRange = rRanges[
i ];
1874 if ( !rClipRange.
Contains( rRange ) )
1887 bool bChanged =
false;
1895 if ( rSourceRange.
Contains( rRange ) )
1900 if (!rRange.
Move( nDiffX, nDiffY, nDiffZ, aErrorRange, rDoc ))
1902 assert(!
"can't move range");
1914 const ScRange& rDestRange,
bool bTransposing)
1916 OSL_ENSURE(
pDoc,
"ScDrawLayer::CopyFromClip without document" );
1925 OSL_FAIL(
"CopyFromClip, bDrawIsInUndo");
1931 SdrPage* pSrcPage = pClipModel->
GetPage(
static_cast<sal_uInt16
>(nSourceTab));
1933 OSL_ENSURE( pSrcPage && pDestPage,
"draw page missing" );
1934 if ( !pSrcPage || !pDestPage )
1954 OUString aDestTabName;
1955 bool bRestoreDestTabName =
false;
1956 if (!bSameDoc && !bDestClip)
1958 OUString aSourceTabName;
1959 if (pClipDoc->
GetName(nSourceTab, aSourceTabName) &&
pDoc->
GetName(nDestTab, aDestTabName)
1962 bRestoreDestTabName =
pDoc->
RenameTab( nDestTab, aSourceTabName );
1966 SCTAB nClipTab = bRestoreDestTabName ? nDestTab : nSourceTab;
1970 bool bSourceRTL = pClipDoc->
IsLayoutRTL(nSourceTab);
1979 pOldObject = aIter.
Next();
1992 aSrcObjStart = (*pObjData).maStart;
1998 if (!rSourceRange.
Contains(aSrcObjStart))
2000 pOldObject = aIter.
Next();
2006 if (pObjData && pClipDoc->
RowFiltered((*pObjData).maStart.Row(), nSourceTab))
2008 pOldObject = aIter.
Next();
2014 if (pStyleSheet && !bSameDoc)
2016 pStyleSheet->GetName(),
2017 pStyleSheet->GetFamily(),
true);
2048 aDestObjStart.
IncCol(nStartColDiff);
2049 aDestObjStart.
IncRow(nStartRowDiff);
2053 ScAddress aSrcObjEnd = (*pObjData).maEnd;
2054 SCCOL nColsToAdd = aSrcObjEnd.
Col() - aSrcObjStart.
Col();
2059 aDestObjEnd.
IncCol(nColsToAdd);
2060 aDestObjEnd.
IncRow(nRowsToAdd);
2065 Point aSrcObjTopLeftOffset = (*pObjData).maStartOffset;
2068 aSrcObjStart.
Row(), nSourceTab,
false );
2074 : double(aSrcObjTopLeftOffset.
X()) / double(aSrcStartRect.
getOpenWidth());
2078 : double(aSrcObjTopLeftOffset.
Y()) / double(aSrcStartRect.
getOpenHeight());
2080 Point aSrcObjBottomRightOffset = (*pObjData).maEndOffset;
2083 aSrcObjEnd.
Row(), nSourceTab,
false );
2089 : double(aSrcObjBottomRightOffset.
X()) / double(aSrcEndRect.
getOpenWidth());
2093 : double(aSrcObjBottomRightOffset.
Y()) / double(aSrcEndRect.
getOpenHeight());
2106 Point aDestObjTopLeft = aDestStartRect.
TopLeft() + aDestObjTopLeftOffset;
2113 Point aDestObjBottomRight = aDestEndRect.
TopLeft() + aDestObjBottomRightOffset;
2117 aNewObjRect = lcl_makeSafeRectangle(aNewObjRect);
2118 if (pNewObject->GetObjIdentifier() == SdrObjKind::CustomShape)
2119 pNewObject->AdjustToMaxRect(aNewObjRect);
2121 pNewObject->SetSnapRect(aNewObjRect);
2132 aSrcObjStart.
Row(), nSourceTab)
2136 std::swap(nStartRowDiff, nStartColDiff);
2138 aDestObjStart.
IncCol(nStartColDiff);
2139 aDestObjStart.
IncRow(nStartRowDiff);
2144 aSrcObjStart.
Row(), nSourceTab,
false );
2153 : double(aSrcObjTopLeftOffset.
X()) / double(aSrcStartRect.
getOpenWidth());
2157 : double(aSrcObjTopLeftOffset.
Y()) / double(aSrcStartRect.
getOpenHeight());
2166 Point aDestObjTopLeft = aDestStartRect.
TopLeft() + aDestObjTopLeftOffset;
2170 pNewObject->NbcMove(
Size(aMoveBy.
getX(), aMoveBy.
getY()));
2195 AddCalcUndo(std::make_unique<SdrUndoInsertObj>(*pNewObject));
2198 if (pNewObject->GetObjIdentifier() == SdrObjKind::OLE2)
2200 uno::Reference<embed::XEmbeddedObject> xIPObj
2201 =
static_cast<SdrOle2Obj*
>(pNewObject.get())->GetObjRef();
2202 uno::Reference<embed::XClassifiedObject> xClassified = xIPObj;
2204 if (xClassified.is())
2208 aObjectClassName =
SvGlobalName(xClassified->getClassID());
2210 catch (uno::Exception&)
2218 uno::Reference<chart2::XChartDocument> xNewChart(
2220 if (xNewChart.is() && !xNewChart->hasInternalDataProvider())
2223 =
static_cast<SdrOle2Obj*
>(pNewObject.get())->GetPersistName();
2224 ::std::vector<ScRangeList> aRangesVector;
2226 if (!aRangesVector.empty())
2228 bool bInSourceRange =
false;
2232 if ((bInSourceRange || bSameDoc) && !bDestClip)
2236 if (rDestPos != aClipRange.
aStart)
2252 uno::Reference<chart::XChartDocument> xOldChartDoc(
2254 uno::Reference<chart::XChartDocument> xNewChartDoc(xNewChart,
2256 if (xOldChartDoc.is() && xNewChartDoc.is())
2257 xNewChartDoc->attachData(xOldChartDoc->getData());
2265 pOldObject = aIter.
Next();
2268 if( bRestoreDestTabName )
2274 OSL_ENSURE(
pDoc,
"ScDrawLayer::MirrorRTL - missing document" );
2282 bool bCanMirror = ( nIdent != SdrObjKind::Graphic && nIdent != SdrObjKind::OLE2 );
2300 if (!pNoRotatedAnchor)
2309 assert(pNoRotatedAnchor);
2312 Point aRef1( 0, 0 );
2313 Point aRef2( 0, 1 );
2315 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
2316 pObj->
Mirror( aRef1, aRef2 );
2322 const Point aMirroredLogicLT = aLogicLT +
Point(nInverseShift, 0);
2323 const Point aOffsetDiff = aMirroredLogicLT - aOldLogicRect.
TopLeft();
2330 Point aRef1( 0, 0 );
2331 Point aRef2( 0, 1 );
2333 AddCalcUndo( std::make_unique<SdrUndoGeoObj>( *pObj ) );
2334 pObj->
Mirror( aRef1, aRef2 );
2345 AddCalcUndo( std::make_unique<SdrUndoMoveObj>( *pObj, aMoveSize ) );
2346 pObj->
Move( aMoveSize );
2364 AddCalcUndo( std::make_unique<SdrUndoMoveObj>( *pObj, aMoveSize ) );
2365 pObj->
Move( aMoveSize );
2388 OSL_ENSURE( rDoc.
ValidColRowTab( rPos.
Col(), rPos.
Row(), rPos.
Tab() ),
"ScDrawLayer::GetCellRect - invalid cell address" );
2393 for(
SCCOL nCol = 0; nCol < rPos.
Col(); ++nCol )
2395 if( rPos.
Row() > 0 )
2408 Point aBotRight = aTopLeft;
2409 for(
SCCOL nCol = rPos.
Col(); nCol <= aEndPos.
Col(); ++nCol )
2434 if (
aName.isEmpty() )
2445 return ( pObj->
GetName() == rName ||
2453 for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++)
2456 OSL_ENSURE(pPage,
"Page ?");
2463 if (
nId == SdrObjKind::NONE ||
pObject->GetObjIdentifier() ==
nId )
2466 rFoundTab =
static_cast<SCTAB>(nTab);
2480 OUString aBase =
ScResId(STR_GRAPHICNAME) +
" ";
2483 OUString aGraphicName;
2489 aGraphicName = aBase + OUString::number(
nId );
2490 bThere = (
GetNamedObject( aGraphicName, SdrObjKind::NONE, nDummy ) != nullptr );
2496 return aGraphicName;
2504 for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++)
2507 OSL_ENSURE(pPage,
"Page ?");
2520 if (
pObject->GetObjIdentifier() == SdrObjKind::Graphic &&
pObject->GetName().isEmpty())
2534 for( sal_uInt16 i = 0;
i <
nCount;
i++ )
2537 if( pData &&
pData->GetInventor() == SdrInventor::ScOrSwDraw &&
pData->GetId() == nId )
2543 void DeleteFirstUserDataOfType(
SdrObject *pObj, sal_uInt16 nId)
2546 for( sal_uInt16 i = nCount;
i > 0;
i-- )
2549 if( pData &&
pData->GetInventor() == SdrInventor::ScOrSwDraw &&
pData->GetId() == nId )
2576 bool bResizeWithCell )
2605 if (lcl_NeedsMirrorYCorrection(&rObj))
2609 const Point aRight(aLeft.
X() + 1000, aLeft.
Y());
2618 static_cast<SdrMeasureObj&
>(rObj).TakeUnrotatedSnapRect(aObjRect2);
2704 return GetFirstUserDataOfType(&rObj,
SC_UD_OBJDATA) !=
nullptr;
2741std::vector<SdrObject*>
2746 return std::vector<SdrObject*>();
2748 std::vector<SdrObject*> aObjects;
2762std::map<SCROW, std::vector<SdrObject*>>
2767 return std::map<SCROW, std::vector<SdrObject*>>();
2769 std::map<SCROW, std::vector<SdrObject*>> aRowObjects;
2772 ScRange aRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab);
2815 return std::vector<SdrObject*>();
2817 std::vector<SdrObject*> aObjects;
2841 pObjData->
maStart = rNewPosition;
2844 const SCCOL nObjectColSpan = aOldEnd.
Col() - aOldStart.
Col();
2845 const SCROW nObjectRowSpan = aOldEnd.
Row() - aOldStart.
Row();
2847 aNewEnd.
IncRow(nObjectRowSpan);
2848 aNewEnd.
IncCol(nObjectColSpan);
2849 pObjData->
maEnd = aNewEnd;
2858 sal_uInt16 nFound = 0;
2859 for( sal_uInt16
i = 0;
i <
nCount;
i++ )
2865 if( pObj && bCreate )
2879 if( pObj && bCreate )
2893 if (
pData->maStart.IsValid() )
2894 pData->maStart.SetTab( nTab );
2895 if (
pData->maEnd.IsValid() )
2896 pData->maEnd.SetTab( nTab );
2942 css::uno::Reference< css::uno::XInterface > xRet;
constexpr auto convertTwipToMm100(N n)
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
void SetName(const OUString &rName)
LanguageType getLanguageType(bool bResolveSystem=true) const
static css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator()
static bool isKorean(LanguageType nLang)
SfxItemPool * GetEditTextObjectPool() const
void SetStyleSheetPool(SfxStyleSheetPool *pSPool)
void SetCalcFieldValueHdl(const Link< EditFieldInfo *, void > &rLink)
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
void IncCol(SCCOL nDelta=1)
void IncRow(SCROW nDelta=1)
static css::uno::Reference< css::chart2::XChartDocument > GetChartFromSdrObject(const SdrObject *pObject)
static Color GetCommentColor()
SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC ScRange GetRange(SCTAB nTab, const tools::Rectangle &rMMRect, bool bHiddenAsZero=true) const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
ScClipParam & GetClipParam()
SC_DLLPUBLIC tools::Long GetColOffset(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC void InitDrawLayer(SfxObjectShell *pDocShell=nullptr)
SC_DLLPUBLIC bool ValidNewTabName(const OUString &rName) const
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
SCROW GetRowForHeight(SCTAB nTab, tools::Long nHeight) const
Given the height i.e.
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC SCROW MaxRow() const
bool ValidColRowTab(SCCOL nCol, SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC void GetChartRanges(std::u16string_view rChartName, std::vector< ScRangeList > &rRanges, const ScDocument &rSheetNameDoc)
SC_DLLPUBLIC ScPostIt * GetNote(const ScAddress &rPos)
SC_DLLPUBLIC void EnableUndo(bool bVal)
SC_DLLPUBLIC bool IsNegativePage(SCTAB nTab) const
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
void GetClipArea(SCCOL &nClipX, SCROW &nClipY, bool bIncludeFiltered)
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
void SetChartRanges(std::u16string_view rChartName, const std::vector< ScRangeList > &rRanges)
bool IsUndoEnabled() const
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
SC_DLLPUBLIC ScColumnsRange GetColumnsRange(SCTAB nTab, SCCOL nColBegin, SCCOL nColEnd) const
void SetChartListenerCollectionNeedsUpdate(bool bFlg)
void GetClipStart(SCCOL &nClipX, SCROW &nClipY)
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC tools::Long GetRowOffset(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
bool IsImportingXML() const
SC_DLLPUBLIC SCTAB GetTableCount() const
static SfxObjectShell * pGlobalDrawPersist
void ScCopyPage(sal_uInt16 nOldPos, sal_uInt16 nNewPos)
void CreateDefaultStyles()
static ScDrawObjData * GetObjDataTab(SdrObject *pObj, SCTAB nTab)
static tools::Rectangle GetCellRect(const ScDocument &rDoc, const ScAddress &rPos, bool bMergedCell)
Returns the rectangle for the passed cell address in 1/100 mm.
virtual css::uno::Reference< css::uno::XInterface > createUnoModel() override
void ResetTab(SCTAB nStart, SCTAB nEnd)
std::map< SCROW, std::vector< SdrObject * > > GetObjectsAnchoredToRange(SCTAB nTab, SCCOL nCol, SCROW nStartRow, SCROW nEndRow)
void MoveArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, bool bInsDel, bool bUpdateNoteCaptionPos)
void ScRenamePage(SCTAB nTab, const OUString &rNewName)
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
static OUString GetVisibleName(const SdrObject *pObj)
static void GetCellAnchorFromPosition(const tools::Rectangle &rRectangle, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bHiddenAsZero=true)
static void SetNonRotatedAnchor(SdrObject &, const ScDrawObjData &rAnchor)
static bool IsNoteCaption(SdrObject *pObj)
Returns true, if the passed object is the caption of a cell note.
ScDocument * GetDocument() const
void SetPageSize(sal_uInt16 nPageNo, const Size &rSize, bool bUpdateNoteCaptionPos, const ScObjectHandling eObjectHandling=ScObjectHandling::RecalcPosMode)
static ScMacroInfo * GetMacroInfo(SdrObject *pObj, bool bCreate=false)
void EnsureGraphicNames()
static void SetCellAnchoredFromPosition(SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab, bool bResizeWithCell)
std::vector< SdrObject * > GetObjectsAnchoredToCols(SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol)
std::unique_ptr< SdrUndoGroup > pUndoGroup
void RecalcPos(SdrObject *pObj, ScDrawObjData &rData, bool bNegativePage, bool bUpdateNoteCaptionPos)
void DeleteObjectsInArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bAnchored=false)
virtual ~ScDrawLayer() override
bool HasObjectsAnchoredInRange(const ScRange &rRange)
static void SetPageAnchored(SdrObject &)
bool ScAddPage(SCTAB nTab)
void BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager)
std::unique_ptr< SdrUndoGroup > GetCalcUndo()
void ScMovePage(sal_uInt16 nOldPos, sal_uInt16 nNewPos)
void DeleteObjectsInSelection(const ScMarkData &rMark)
static ScAnchorType GetAnchorType(const SdrObject &)
static ScDrawObjData * GetNonRotatedObjData(SdrObject *pObj, bool bCreate=false)
void CopyFromClip(ScDrawLayer *pClipModel, SCTAB nSourceTab, const ScRange &rSourceRange, const ScAddress &rDestPos, const ScRange &rDestRange, bool bTransposing=false)
static bool IsResizeWithCell(const SdrObject &rObj)
static ScDrawObjData * GetNoteCaptionData(SdrObject *pObj, SCTAB nTab)
Returns the object data, if the passed object is a cell note caption.
bool HasObjectsInRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow)
void MirrorRTL(SdrObject *pObj)
void ScRemovePage(SCTAB nTab)
bool GetPrintArea(ScRange &rRange, bool bSetHor, bool bSetVer) const
void MoveObject(SdrObject *pObj, const ScAddress &rNewPosition)
void AddCalcUndo(std::unique_ptr< SdrUndoAction > pUndo)
ScDrawLayer(ScDocument *pDocument, OUString aName)
virtual rtl::Reference< SdrPage > AllocPage(bool bMasterPage) override
static void SetCellAnchored(SdrObject &, const ScDrawObjData &rAnchor)
void CopyToClip(ScDocument *pClipDoc, SCTAB nTab, const tools::Rectangle &rRange)
void MoveCells(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, bool bUpdateNoteCaptionPos)
void MoveRTL(SdrObject *pObj)
static void MirrorRectRTL(tools::Rectangle &rRect)
void InitializeCellAnchoredObj(SdrObject *pObj, ScDrawObjData &rData)
std::vector< SdrObject * > GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow)
void ResizeLastRectFromAnchor(const SdrObject *pObj, ScDrawObjData &rData, bool bNegativePage, bool bCanResize)
static void UpdateCellAnchorFromPositionEnd(const SdrObject &rObj, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bUseLogicRect=true)
static void SetGlobalDrawPersist(SfxObjectShell *pPersist)
virtual void SetChanged(bool bFlg=true) override
static bool IsCellAnchored(const SdrObject &rObj)
OUString GetNewGraphicName(tools::Long *pnCounter=nullptr) const
virtual SdrModel * AllocModel() const override
SdrObject * GetNamedObject(std::u16string_view rName, SdrObjKind nId, SCTAB &rFoundTab) const
const tools::Rectangle & getShapeRect() const
const tools::Rectangle & getLastCellRect() const
void setShapeRect(const ScDocument *rDoc, tools::Rectangle rNewRect, bool bIsVisible=true)
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
bool IsAllMarked(const ScRange &rRange) const
const ScRange & GetMultiMarkArea() const
bool IsMultiMarked() const
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
SCCOL GetColMerge() const
SCROW GetRowMerge() const
static void FillToEditItemSet(SfxItemSet &rEditSet, const SfxItemSet &rSrcSet, const SfxItemSet *pCondSet=nullptr)
Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet.
Additional class containing cell annotation data.
bool Move(SCCOL aDeltaX, SCROW aDeltaY, SCTAB aDeltaZ, ScRange &rErrorRange, const ScDocument &rDoc)
bool Contains(const ScAddress &) const
is Address& fully in Range?
void CopyUsedGraphicStylesFrom(SfxStyleSheetBasePool *pSrcPool)
void CopyStyleFrom(SfxStyleSheetBasePool *pSrcPool, const OUString &rName, SfxStyleFamily eFamily, bool bNewStyleHierarchy=false)
ScTabDeletedHint(SCTAB nTabNo)
virtual ~ScTabDeletedHint() override
virtual ~ScTabSizeChangedHint() override
ScTabSizeChangedHint(SCTAB nTabNo)
virtual void Redo() override
virtual ~ScUndoAnchorData() override
virtual void Undo() override
ScUndoAnchorData(SdrObject *pObj, ScDocument *pDoc, SCTAB nTab)
virtual ~ScUndoObjData() override
virtual void Redo() override
virtual void Undo() override
ScUndoObjData(SdrObject *pObj, const ScAddress &rOS, const ScAddress &rOE, const ScAddress &rNS, const ScAddress &rNE)
const OUString & GetControlLayerName() const
SdrLayer * NewLayer(const OUString &rName, sal_uInt16 nPos=0xFFFF)
virtual void TakeUnrotatedSnapRect(tools::Rectangle &rRect) const override
virtual void SetChanged(bool bFlg=true)
void SetVOCInvalidationIsReliable(bool b)
void SetDefaultStyleSheet(SfxStyleSheet *pDefSS)
virtual void MovePage(sal_uInt16 nPgNum, sal_uInt16 nNewPos)
void ClearModel(bool bCalledFromDestructor)
SdrOutliner & GetDrawOutliner(const SdrTextObj *pObj=nullptr) const
const SfxItemPool & GetItemPool() const
void SetScaleUnit(MapUnit eMap)
void SetStyleSheetPool(SfxStyleSheetBasePool *pPool)
void EnableUndo(bool bEnable)
rtl::Reference< SfxItemPool > m_pItemPool
SfxStyleSheetBasePool * GetStyleSheetPool() const
void SetDisableTextEditUsesCommonUndoManager(bool bNew)
virtual void DeletePage(sal_uInt16 nPgNum)
void SetPropertyList(XPropertyListRef const &p)
const SdrPage * GetPage(sal_uInt16 nPgNum) const
const SdrLayerAdmin & GetLayerAdmin() const
sal_uInt16 GetPageCount() const
SdrOutliner & GetHitTestOutliner() const
void InsertObjectThenMakeNameUnique(SdrObject *pObj)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
bool IsResizeProtect() const
virtual void NbcSetLogicRect(const tools::Rectangle &rRect)
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact)
void AppendUserData(std::unique_ptr< SdrObjUserData > pData)
virtual Point GetPoint(sal_uInt32 i) const
void BroadcastObjectChange() const
sal_uInt16 GetUserDataCount() const
void SetVisible(bool bVisible)
virtual void Mirror(const Point &rRef1, const Point &rRef2)
virtual bool IsPolyObj() const
virtual void Move(const Size &rSiz)
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual void NbcMirror(const Point &rRef1, const Point &rRef2)
SdrModel & getSdrModelFromSdrObject() const
virtual const tools::Rectangle & GetSnapRect() const
virtual void SetLogicRect(const tools::Rectangle &rRect)
SfxStyleSheet * GetStyleSheet() const
virtual const OUString & GetName() const
SdrObjUserData * GetUserData(sal_uInt16 nNum) const
virtual void AdjustToMaxRect(const tools::Rectangle &rMaxRect, bool bShrinkOnly=false)
void SetPoint(const Point &rPnt, sal_uInt32 i)
virtual SdrObjKind GetObjIdentifier() const
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const=0
virtual void SetSnapRect(const tools::Rectangle &rRect)
virtual SdrLayerID GetLayer() const
void DeleteUserData(sal_uInt16 nNum)
virtual void SetRelativePos(const Point &rPnt)
virtual bool shouldKeepAspectRatio() const
virtual void NbcMove(const Size &rSiz)
virtual Point GetRelativePos() const
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const
virtual const tools::Rectangle & GetLogicRect() const
const OUString & GetPersistName() const
virtual void SetSize(const Size &aSiz)
rtl::Reference< SdrObject > mxObj
SfxItemPool * GetSecondaryPool() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
void SetPoolDefaultItem(const SfxPoolItem &)
void SetDefaultMetric(MapUnit eNewMetric)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
css::uno::Reference< css::frame::XModel3 > GetModel() const
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
static sal_uInt16 IsChart(const SvGlobalName &rName)
const XColorListRef & GetColorList() const
static XColorListRef GetStdColorList()
void translate(double fX, double fY)
void scale(double fX, double fY)
void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void setClosed(bool bNew)
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
static E3dObjFactory * pF3d
static bool lcl_IsAllInRange(const ::std::vector< ScRangeList > &rRangesVector, const ScRange &rClipRange)
static bool lcl_MoveRanges(::std::vector< ScRangeList > &rRangesVector, const ScRange &rSourceRange, const ScAddress &rDestPos, const ScDocument &rDoc)
static ScRange lcl_getClipRangeFromClipDoc(ScDocument *pClipDoc, SCTAB nClipTab)
static bool IsNamedObject(const SdrObject *pObj, std::u16string_view rName)
static bool IsInBlock(const ScAddress &rPos, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
static void lcl_ReverseTwipsToMM(tools::Rectangle &rRect)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxScriptSpaceItem > EE_PARA_ASIANCJKSPACING(EE_PARA_START+4)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
EmbeddedObjectRef * pObject
constexpr SdrLayerID SC_LAYER_HIDDEN(4)
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_INTERN(2)
constexpr SdrLayerID SC_LAYER_BACK(1)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
tools::Long FRound(double fVal)
#define LANGUAGE_JAPANESE
#define LINK(Instance, Class, Member)
std::unique_ptr< sal_Int32[]> pData
B2DRange getRange(const B2DPolygon &rCandidate)
B2IRange fround(const B2DRange &rRange)
constexpr auto toTwips(N number, Length from)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
SdrOnOffItem makeSdrShadowItem(bool bShadow)
SdrMetricItem makeSdrShadowXDistItem(tools::Long nDist)
SdrMetricItem makeSdrShadowYDistItem(tools::Long nDist)
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
SdrMetricItem makeSdrTextUpperDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextRightDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLowerDistItem(tools::Long mnHeight)
SdrMetricItem makeSdrTextLeftDistItem(tools::Long mnHeight)
bool isTransposed() const
Was this clip transposed?
UNDERLYING_TYPE get() const
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW