|
|
|
@ -87,7 +87,7 @@ diff -ru sc.orig/source/core/data/documen3.cxx sc/source/core/data/documen3.cxx
|
|
|
|
|
diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
--- sc.orig/source/core/data/drwlayer.cxx 2009-06-04 12:39:09.000000000 +0100
|
|
|
|
|
+++ sc/source/core/data/drwlayer.cxx 2009-06-05 12:28:12.000000000 +0100
|
|
|
|
|
@@ -68,6 +68,9 @@
|
|
|
|
|
@@ -69,6 +69,9 @@
|
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
|
#include <unotools/ucbstreamhelper.hxx>
|
|
|
|
|
|
|
|
|
@ -97,8 +97,8 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
#include "drwlayer.hxx"
|
|
|
|
|
#include "drawpage.hxx"
|
|
|
|
|
#include "global.hxx"
|
|
|
|
|
@@ -526,7 +529,41 @@
|
|
|
|
|
}
|
|
|
|
|
@@ -539,7 +542,41 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-void ScDrawLayer::RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos )
|
|
|
|
@ -138,126 +138,126 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
+
|
|
|
|
|
+void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos )
|
|
|
|
|
{
|
|
|
|
|
DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos - missing document" );
|
|
|
|
|
if( !pDoc )
|
|
|
|
|
@@ -565,6 +602,8 @@
|
|
|
|
|
DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos - missing document" );
|
|
|
|
|
if( !pDoc )
|
|
|
|
|
@@ -578,6 +615,8 @@
|
|
|
|
|
|
|
|
|
|
if( bCircle )
|
|
|
|
|
{
|
|
|
|
|
if( bCircle )
|
|
|
|
|
{
|
|
|
|
|
+ rData.maLastRect = pObj->GetLogicRect();
|
|
|
|
|
+
|
|
|
|
|
Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
|
|
|
|
|
TwipsToMM( aPos.X() );
|
|
|
|
|
TwipsToMM( aPos.Y() );
|
|
|
|
|
@@ -585,11 +624,18 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
- pObj->SetLogicRect(aRect);
|
|
|
|
|
Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
|
|
|
|
|
TwipsToMM( aPos.X() );
|
|
|
|
|
TwipsToMM( aPos.Y() );
|
|
|
|
|
@@ -598,11 +637,18 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
- pObj->SetLogicRect(aRect);
|
|
|
|
|
+ rData.maLastRect = lcl_makeSafeRectangle(aRect);
|
|
|
|
|
+ pObj->SetLogicRect(rData.maLastRect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if( bArrow )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if( bArrow )
|
|
|
|
|
{
|
|
|
|
|
+ rData.maLastRect = pObj->GetLogicRect();
|
|
|
|
|
+ basegfx::B2DPolygon aCalcPoly;
|
|
|
|
|
+ Point aOrigStartPos(pObj->GetPoint(0));
|
|
|
|
|
+ Point aOrigEndPos(pObj->GetPoint(1));
|
|
|
|
|
+ aCalcPoly.append(basegfx::B2DPoint(aOrigStartPos.X(), aOrigStartPos.Y()));
|
|
|
|
|
+ aCalcPoly.append(basegfx::B2DPoint(aOrigEndPos.X(), aOrigEndPos.Y()));
|
|
|
|
|
//! nicht mehrere Undos fuer ein Objekt erzeugen (hinteres kann dann weggelassen werden)
|
|
|
|
|
//! nicht mehrere Undos fuer ein Objekt erzeugen (hinteres kann dann weggelassen werden)
|
|
|
|
|
|
|
|
|
|
SCCOL nLastCol;
|
|
|
|
|
@@ -610,6 +656,8 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
@@ -623,6 +669,8 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
+
|
|
|
|
|
+ rData.maLastRect = lcl_UpdateCalcPoly(aCalcPoly, 0, aStartPos);
|
|
|
|
|
pObj->SetPoint( aStartPos, 0 );
|
|
|
|
|
}
|
|
|
|
|
pObj->SetPoint( aStartPos, 0 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -624,6 +672,8 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
@@ -637,6 +685,8 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
+
|
|
|
|
|
+ rData.maLastRect = lcl_UpdateCalcPoly(aCalcPoly, 1, aEndPos);
|
|
|
|
|
pObj->SetPoint( aEndPos, 1 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -644,6 +694,8 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
pObj->SetPoint( aEndPos, 1 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -657,6 +707,8 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
+
|
|
|
|
|
+ rData.maLastRect = lcl_UpdateCalcPoly(aCalcPoly, 1, aEndPos);
|
|
|
|
|
pObj->SetPoint( aEndPos, 1 );
|
|
|
|
|
}
|
|
|
|
|
pObj->SetPoint( aEndPos, 1 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -660,45 +712,68 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
@@ -673,45 +725,68 @@
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
+
|
|
|
|
|
+ rData.maLastRect = lcl_UpdateCalcPoly(aCalcPoly, 0, aStartPos);
|
|
|
|
|
pObj->SetPoint( aStartPos, 0 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
- else // Referenz-Rahmen
|
|
|
|
|
pObj->SetPoint( aStartPos, 0 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
- else // Referenz-Rahmen
|
|
|
|
|
+ else
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
+ bool bCanResize = bValid2 && !pObj->IsResizeProtect();
|
|
|
|
|
+
|
|
|
|
|
+ //First time positioning, must be able to at least move it
|
|
|
|
|
+ if (rData.maLastRect.IsEmpty())
|
|
|
|
|
+ rData.maLastRect = pObj->GetLogicRect();
|
|
|
|
|
+
|
|
|
|
|
DBG_ASSERT( bValid1, "ScDrawLayer::RecalcPos - invalid start position" );
|
|
|
|
|
Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
|
|
|
|
|
TwipsToMM( aPos.X() );
|
|
|
|
|
TwipsToMM( aPos.Y() );
|
|
|
|
|
DBG_ASSERT( bValid1, "ScDrawLayer::RecalcPos - invalid start position" );
|
|
|
|
|
Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
|
|
|
|
|
TwipsToMM( aPos.X() );
|
|
|
|
|
TwipsToMM( aPos.Y() );
|
|
|
|
|
+ aPos += lcl_calcAvailableDiff(*pDoc, nCol1, nRow1, nTab1, rData.maStartOffset);
|
|
|
|
|
|
|
|
|
|
- if( bValid2 )
|
|
|
|
|
- if( bValid2 )
|
|
|
|
|
+ if( bCanResize )
|
|
|
|
|
{
|
|
|
|
|
- Point aEnd( pDoc->GetColOffset( nCol2 + 1, nTab2 ), pDoc->GetRowOffset( nRow2 + 1, nTab2 ) );
|
|
|
|
|
{
|
|
|
|
|
- Point aEnd( pDoc->GetColOffset( nCol2 + 1, nTab2 ), pDoc->GetRowOffset( nRow2 + 1, nTab2 ) );
|
|
|
|
|
+ Point aEnd( pDoc->GetColOffset( nCol2, nTab2 ), pDoc->GetRowOffset( nRow2, nTab2 ) );
|
|
|
|
|
TwipsToMM( aEnd.X() );
|
|
|
|
|
TwipsToMM( aEnd.Y() );
|
|
|
|
|
TwipsToMM( aEnd.X() );
|
|
|
|
|
TwipsToMM( aEnd.Y() );
|
|
|
|
|
+ aEnd += lcl_calcAvailableDiff(*pDoc, nCol2, nRow2, nTab2, rData.maEndOffset);
|
|
|
|
|
|
|
|
|
|
Rectangle aNew( aPos, aEnd );
|
|
|
|
|
if ( bNegativePage )
|
|
|
|
|
MirrorRectRTL( aNew );
|
|
|
|
|
if ( pObj->GetLogicRect() != aNew )
|
|
|
|
|
{
|
|
|
|
|
Rectangle aNew( aPos, aEnd );
|
|
|
|
|
if ( bNegativePage )
|
|
|
|
|
MirrorRectRTL( aNew );
|
|
|
|
|
if ( pObj->GetLogicRect() != aNew )
|
|
|
|
|
{
|
|
|
|
|
+ Rectangle aOld(pObj->GetLogicRect());
|
|
|
|
|
+
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
- pObj->SetLogicRect(aNew);
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
- pObj->SetLogicRect(aNew);
|
|
|
|
|
+ rData.maLastRect = lcl_makeSafeRectangle(aNew);
|
|
|
|
|
+ pObj->SetLogicRect(rData.maLastRect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ( bNegativePage )
|
|
|
|
|
- aPos.X() = -aPos.X();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ( bNegativePage )
|
|
|
|
|
- aPos.X() = -aPos.X();
|
|
|
|
|
+ aPos.X() = -aPos.X() - rData.maLastRect.GetWidth();
|
|
|
|
|
if ( pObj->GetRelativePos() != aPos )
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
if ( pObj->GetRelativePos() != aPos )
|
|
|
|
|
{
|
|
|
|
|
if (bRecording)
|
|
|
|
|
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
|
|
|
|
|
+ rData.maLastRect.SetPos( aPos );
|
|
|
|
|
pObj->SetRelativePos( aPos );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pObj->SetRelativePos( aPos );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * If we were not allowed resize the object, then the end cell anchor
|
|
|
|
@ -267,193 +267,193 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
+ bool bEndAnchorIsBad = !bValid2 || pObj->IsResizeProtect();
|
|
|
|
|
+ if (bEndAnchorIsBad)
|
|
|
|
|
+ ScDrawLayer::UpdateCellAnchorFromPositionEnd(*pObj, *pDoc, nTab1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -873,151 +948,6 @@
|
|
|
|
|
return pRet;
|
|
|
|
|
@@ -886,151 +961,6 @@
|
|
|
|
|
return pRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-// MoveAreaTwips: all measures are kept in twips
|
|
|
|
|
-void ScDrawLayer::MoveAreaTwips( SCTAB nTab, const Rectangle& rArea,
|
|
|
|
|
- const Point& rMove, const Point& rTopLeft )
|
|
|
|
|
- const Point& rMove, const Point& rTopLeft )
|
|
|
|
|
-{
|
|
|
|
|
- if (!rMove.X() && !rMove.Y())
|
|
|
|
|
- return; // nix
|
|
|
|
|
- if (!rMove.X() && !rMove.Y())
|
|
|
|
|
- return; // nix
|
|
|
|
|
-
|
|
|
|
|
- SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
|
|
|
|
|
- DBG_ASSERT(pPage,"Page nicht gefunden");
|
|
|
|
|
- if (!pPage)
|
|
|
|
|
- return;
|
|
|
|
|
- SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab));
|
|
|
|
|
- DBG_ASSERT(pPage,"Page nicht gefunden");
|
|
|
|
|
- if (!pPage)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
- BOOL bNegativePage = pDoc && pDoc->IsNegativePage( nTab );
|
|
|
|
|
- BOOL bNegativePage = pDoc && pDoc->IsNegativePage( nTab );
|
|
|
|
|
-
|
|
|
|
|
- // fuer Shrinking!
|
|
|
|
|
- Rectangle aNew( rArea );
|
|
|
|
|
- BOOL bShrink = FALSE;
|
|
|
|
|
- if ( rMove.X() < 0 || rMove.Y() < 0 ) // verkleinern
|
|
|
|
|
- {
|
|
|
|
|
- if ( rTopLeft != rArea.TopLeft() ) // sind gleich beim Verschieben von Zellen
|
|
|
|
|
- {
|
|
|
|
|
- bShrink = TRUE;
|
|
|
|
|
- aNew.Left() = rTopLeft.X();
|
|
|
|
|
- aNew.Top() = rTopLeft.Y();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- SdrObjListIter aIter( *pPage, IM_FLAT );
|
|
|
|
|
- SdrObject* pObject = aIter.Next();
|
|
|
|
|
- while (pObject)
|
|
|
|
|
- {
|
|
|
|
|
- if( GetAnchor( pObject ) == SCA_CELL )
|
|
|
|
|
- {
|
|
|
|
|
- if ( GetObjData( pObject ) ) // Detektiv-Pfeil ?
|
|
|
|
|
- {
|
|
|
|
|
- // hier nichts
|
|
|
|
|
- }
|
|
|
|
|
- else if ( pObject->ISA( SdrEdgeObj ) ) // Verbinder?
|
|
|
|
|
- {
|
|
|
|
|
- // hier auch nichts
|
|
|
|
|
- //! nicht verbundene Enden wie bei Linien (s.u.) behandeln?
|
|
|
|
|
- }
|
|
|
|
|
- else if ( pObject->IsPolyObj() && pObject->GetPointCount()==2 )
|
|
|
|
|
- {
|
|
|
|
|
- for (USHORT i=0; i<2; i++)
|
|
|
|
|
- {
|
|
|
|
|
- BOOL bMoved = FALSE;
|
|
|
|
|
- Point aPoint = pObject->GetPoint(i);
|
|
|
|
|
- lcl_ReverseTwipsToMM( aPoint );
|
|
|
|
|
- if (rArea.IsInside(aPoint))
|
|
|
|
|
- {
|
|
|
|
|
- aPoint += rMove; bMoved = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- else if (bShrink && aNew.IsInside(aPoint))
|
|
|
|
|
- {
|
|
|
|
|
- // Punkt ist in betroffener Zelle - Test auf geloeschten Bereich
|
|
|
|
|
- if ( rMove.X() && aPoint.X() >= rArea.Left() + rMove.X() )
|
|
|
|
|
- {
|
|
|
|
|
- aPoint.X() = rArea.Left() + rMove.X() - SHRINK_DIST_TWIPS;
|
|
|
|
|
- if ( aPoint.X() < 0 ) aPoint.X() = 0;
|
|
|
|
|
- bMoved = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- if ( rMove.Y() && aPoint.Y() >= rArea.Top() + rMove.Y() )
|
|
|
|
|
- {
|
|
|
|
|
- aPoint.Y() = rArea.Top() + rMove.Y() - SHRINK_DIST_TWIPS;
|
|
|
|
|
- if ( aPoint.Y() < 0 ) aPoint.Y() = 0;
|
|
|
|
|
- bMoved = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if( bMoved )
|
|
|
|
|
- {
|
|
|
|
|
- AddCalcUndo( new SdrUndoGeoObj( *pObject ) );
|
|
|
|
|
- lcl_TwipsToMM( aPoint );
|
|
|
|
|
- pObject->SetPoint( aPoint, i );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- Rectangle aObjRect = pObject->GetLogicRect();
|
|
|
|
|
- // aOldMMPos: not converted, millimeters
|
|
|
|
|
- Point aOldMMPos = bNegativePage ? aObjRect.TopRight() : aObjRect.TopLeft();
|
|
|
|
|
- lcl_ReverseTwipsToMM( aObjRect );
|
|
|
|
|
- Point aTopLeft = bNegativePage ? aObjRect.TopRight() : aObjRect.TopLeft(); // logical left
|
|
|
|
|
- Size aMoveSize;
|
|
|
|
|
- BOOL bDoMove = FALSE;
|
|
|
|
|
- if (rArea.IsInside(aTopLeft))
|
|
|
|
|
- {
|
|
|
|
|
- aMoveSize = Size(rMove.X(),rMove.Y());
|
|
|
|
|
- bDoMove = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- else if (bShrink && aNew.IsInside(aTopLeft))
|
|
|
|
|
- {
|
|
|
|
|
- // Position ist in betroffener Zelle - Test auf geloeschten Bereich
|
|
|
|
|
- if ( rMove.X() && aTopLeft.X() >= rArea.Left() + rMove.X() )
|
|
|
|
|
- {
|
|
|
|
|
- aMoveSize.Width() = rArea.Left() + rMove.X() - SHRINK_DIST - aTopLeft.X();
|
|
|
|
|
- bDoMove = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- if ( rMove.Y() && aTopLeft.Y() >= rArea.Top() + rMove.Y() )
|
|
|
|
|
- {
|
|
|
|
|
- aMoveSize.Height() = rArea.Top() + rMove.Y() - SHRINK_DIST - aTopLeft.Y();
|
|
|
|
|
- bDoMove = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if ( bDoMove )
|
|
|
|
|
- {
|
|
|
|
|
- if ( bNegativePage )
|
|
|
|
|
- {
|
|
|
|
|
- if ( aTopLeft.X() + aMoveSize.Width() > 0 )
|
|
|
|
|
- aMoveSize.Width() = -aTopLeft.X();
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if ( aTopLeft.X() + aMoveSize.Width() < 0 )
|
|
|
|
|
- aMoveSize.Width() = -aTopLeft.X();
|
|
|
|
|
- }
|
|
|
|
|
- if ( aTopLeft.Y() + aMoveSize.Height() < 0 )
|
|
|
|
|
- aMoveSize.Height() = -aTopLeft.Y();
|
|
|
|
|
- // fuer Shrinking!
|
|
|
|
|
- Rectangle aNew( rArea );
|
|
|
|
|
- BOOL bShrink = FALSE;
|
|
|
|
|
- if ( rMove.X() < 0 || rMove.Y() < 0 ) // verkleinern
|
|
|
|
|
- {
|
|
|
|
|
- if ( rTopLeft != rArea.TopLeft() ) // sind gleich beim Verschieben von Zellen
|
|
|
|
|
- {
|
|
|
|
|
- bShrink = TRUE;
|
|
|
|
|
- aNew.Left() = rTopLeft.X();
|
|
|
|
|
- aNew.Top() = rTopLeft.Y();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- SdrObjListIter aIter( *pPage, IM_FLAT );
|
|
|
|
|
- SdrObject* pObject = aIter.Next();
|
|
|
|
|
- while (pObject)
|
|
|
|
|
- {
|
|
|
|
|
- if( GetAnchor( pObject ) == SCA_CELL )
|
|
|
|
|
- {
|
|
|
|
|
- if ( GetObjData( pObject ) ) // Detektiv-Pfeil ?
|
|
|
|
|
- {
|
|
|
|
|
- // hier nichts
|
|
|
|
|
- }
|
|
|
|
|
- else if ( pObject->ISA( SdrEdgeObj ) ) // Verbinder?
|
|
|
|
|
- {
|
|
|
|
|
- // hier auch nichts
|
|
|
|
|
- //! nicht verbundene Enden wie bei Linien (s.u.) behandeln?
|
|
|
|
|
- }
|
|
|
|
|
- else if ( pObject->IsPolyObj() && pObject->GetPointCount()==2 )
|
|
|
|
|
- {
|
|
|
|
|
- for (USHORT i=0; i<2; i++)
|
|
|
|
|
- {
|
|
|
|
|
- BOOL bMoved = FALSE;
|
|
|
|
|
- Point aPoint = pObject->GetPoint(i);
|
|
|
|
|
- lcl_ReverseTwipsToMM( aPoint );
|
|
|
|
|
- if (rArea.IsInside(aPoint))
|
|
|
|
|
- {
|
|
|
|
|
- aPoint += rMove; bMoved = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- else if (bShrink && aNew.IsInside(aPoint))
|
|
|
|
|
- {
|
|
|
|
|
- // Punkt ist in betroffener Zelle - Test auf geloeschten Bereich
|
|
|
|
|
- if ( rMove.X() && aPoint.X() >= rArea.Left() + rMove.X() )
|
|
|
|
|
- {
|
|
|
|
|
- aPoint.X() = rArea.Left() + rMove.X() - SHRINK_DIST_TWIPS;
|
|
|
|
|
- if ( aPoint.X() < 0 ) aPoint.X() = 0;
|
|
|
|
|
- bMoved = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- if ( rMove.Y() && aPoint.Y() >= rArea.Top() + rMove.Y() )
|
|
|
|
|
- {
|
|
|
|
|
- aPoint.Y() = rArea.Top() + rMove.Y() - SHRINK_DIST_TWIPS;
|
|
|
|
|
- if ( aPoint.Y() < 0 ) aPoint.Y() = 0;
|
|
|
|
|
- bMoved = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if( bMoved )
|
|
|
|
|
- {
|
|
|
|
|
- AddCalcUndo( new SdrUndoGeoObj( *pObject ) );
|
|
|
|
|
- lcl_TwipsToMM( aPoint );
|
|
|
|
|
- pObject->SetPoint( aPoint, i );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- Rectangle aObjRect = pObject->GetLogicRect();
|
|
|
|
|
- // aOldMMPos: not converted, millimeters
|
|
|
|
|
- Point aOldMMPos = bNegativePage ? aObjRect.TopRight() : aObjRect.TopLeft();
|
|
|
|
|
- lcl_ReverseTwipsToMM( aObjRect );
|
|
|
|
|
- Point aTopLeft = bNegativePage ? aObjRect.TopRight() : aObjRect.TopLeft(); // logical left
|
|
|
|
|
- Size aMoveSize;
|
|
|
|
|
- BOOL bDoMove = FALSE;
|
|
|
|
|
- if (rArea.IsInside(aTopLeft))
|
|
|
|
|
- {
|
|
|
|
|
- aMoveSize = Size(rMove.X(),rMove.Y());
|
|
|
|
|
- bDoMove = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- else if (bShrink && aNew.IsInside(aTopLeft))
|
|
|
|
|
- {
|
|
|
|
|
- // Position ist in betroffener Zelle - Test auf geloeschten Bereich
|
|
|
|
|
- if ( rMove.X() && aTopLeft.X() >= rArea.Left() + rMove.X() )
|
|
|
|
|
- {
|
|
|
|
|
- aMoveSize.Width() = rArea.Left() + rMove.X() - SHRINK_DIST - aTopLeft.X();
|
|
|
|
|
- bDoMove = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- if ( rMove.Y() && aTopLeft.Y() >= rArea.Top() + rMove.Y() )
|
|
|
|
|
- {
|
|
|
|
|
- aMoveSize.Height() = rArea.Top() + rMove.Y() - SHRINK_DIST - aTopLeft.Y();
|
|
|
|
|
- bDoMove = TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if ( bDoMove )
|
|
|
|
|
- {
|
|
|
|
|
- if ( bNegativePage )
|
|
|
|
|
- {
|
|
|
|
|
- if ( aTopLeft.X() + aMoveSize.Width() > 0 )
|
|
|
|
|
- aMoveSize.Width() = -aTopLeft.X();
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if ( aTopLeft.X() + aMoveSize.Width() < 0 )
|
|
|
|
|
- aMoveSize.Width() = -aTopLeft.X();
|
|
|
|
|
- }
|
|
|
|
|
- if ( aTopLeft.Y() + aMoveSize.Height() < 0 )
|
|
|
|
|
- aMoveSize.Height() = -aTopLeft.Y();
|
|
|
|
|
-
|
|
|
|
|
- // get corresponding move size in millimeters:
|
|
|
|
|
- Point aNewPos( aTopLeft.X() + aMoveSize.Width(), aTopLeft.Y() + aMoveSize.Height() );
|
|
|
|
|
- lcl_TwipsToMM( aNewPos );
|
|
|
|
|
- aMoveSize = Size( aNewPos.X() - aOldMMPos.X(), aNewPos.Y() - aOldMMPos.Y() ); // millimeters
|
|
|
|
|
- // get corresponding move size in millimeters:
|
|
|
|
|
- Point aNewPos( aTopLeft.X() + aMoveSize.Width(), aTopLeft.Y() + aMoveSize.Height() );
|
|
|
|
|
- lcl_TwipsToMM( aNewPos );
|
|
|
|
|
- aMoveSize = Size( aNewPos.X() - aOldMMPos.X(), aNewPos.Y() - aOldMMPos.Y() ); // millimeters
|
|
|
|
|
-
|
|
|
|
|
- AddCalcUndo( new SdrUndoMoveObj( *pObject, aMoveSize ) );
|
|
|
|
|
- pObject->Move( aMoveSize );
|
|
|
|
|
- }
|
|
|
|
|
- else if ( rArea.IsInside( bNegativePage ? aObjRect.BottomLeft() : aObjRect.BottomRight() ) &&
|
|
|
|
|
- !pObject->IsResizeProtect() )
|
|
|
|
|
- {
|
|
|
|
|
- // geschuetzte Groessen werden nicht veraendert
|
|
|
|
|
- // (Positionen schon, weil sie ja an der Zelle "verankert" sind)
|
|
|
|
|
- AddCalcUndo( new SdrUndoGeoObj( *pObject ) );
|
|
|
|
|
- long nOldSizeX = aObjRect.Right() - aObjRect.Left() + 1;
|
|
|
|
|
- long nOldSizeY = aObjRect.Bottom() - aObjRect.Top() + 1;
|
|
|
|
|
- long nLogMoveX = rMove.X() * ( bNegativePage ? -1 : 1 ); // logical direction
|
|
|
|
|
- pObject->Resize( aOldMMPos, Fraction( nOldSizeX+nLogMoveX, nOldSizeX ),
|
|
|
|
|
- Fraction( nOldSizeY+rMove.Y(), nOldSizeY ) );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- pObject = aIter.Next();
|
|
|
|
|
- }
|
|
|
|
|
- AddCalcUndo( new SdrUndoMoveObj( *pObject, aMoveSize ) );
|
|
|
|
|
- pObject->Move( aMoveSize );
|
|
|
|
|
- }
|
|
|
|
|
- else if ( rArea.IsInside( bNegativePage ? aObjRect.BottomLeft() : aObjRect.BottomRight() ) &&
|
|
|
|
|
- !pObject->IsResizeProtect() )
|
|
|
|
|
- {
|
|
|
|
|
- // geschuetzte Groessen werden nicht veraendert
|
|
|
|
|
- // (Positionen schon, weil sie ja an der Zelle "verankert" sind)
|
|
|
|
|
- AddCalcUndo( new SdrUndoGeoObj( *pObject ) );
|
|
|
|
|
- long nOldSizeX = aObjRect.Right() - aObjRect.Left() + 1;
|
|
|
|
|
- long nOldSizeY = aObjRect.Bottom() - aObjRect.Top() + 1;
|
|
|
|
|
- long nLogMoveX = rMove.X() * ( bNegativePage ? -1 : 1 ); // logical direction
|
|
|
|
|
- pObject->Resize( aOldMMPos, Fraction( nOldSizeX+nLogMoveX, nOldSizeX ),
|
|
|
|
|
- Fraction( nOldSizeY+rMove.Y(), nOldSizeY ) );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- pObject = aIter.Next();
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
void ScDrawLayer::MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
|
|
|
|
|
SCsCOL nDx,SCsROW nDy, BOOL bInsDel, bool bUpdateNoteCaptionPos )
|
|
|
|
|
SCsCOL nDx,SCsROW nDy, BOOL bInsDel, bool bUpdateNoteCaptionPos )
|
|
|
|
|
{
|
|
|
|
|
@@ -1059,11 +989,6 @@
|
|
|
|
|
aTopLeft.Y() += aMove.Y();
|
|
|
|
|
}
|
|
|
|
|
@@ -1072,11 +1002,6 @@
|
|
|
|
|
aTopLeft.Y() += aMove.Y();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- // drawing objects are now directly included in cut&paste
|
|
|
|
|
- // -> only update references when inserting/deleting (or changing widths or heights)
|
|
|
|
|
- if ( bInsDel )
|
|
|
|
|
- MoveAreaTwips( nTab, aRect, aMove, aTopLeft );
|
|
|
|
|
- // drawing objects are now directly included in cut&paste
|
|
|
|
|
- // -> only update references when inserting/deleting (or changing widths or heights)
|
|
|
|
|
- if ( bInsDel )
|
|
|
|
|
- MoveAreaTwips( nTab, aRect, aMove, aTopLeft );
|
|
|
|
|
-
|
|
|
|
|
//
|
|
|
|
|
// Detektiv-Pfeile: Zellpositionen anpassen
|
|
|
|
|
//
|
|
|
|
|
@@ -1101,8 +1026,6 @@
|
|
|
|
|
aTopLeft.X() = -aTopLeft.X();
|
|
|
|
|
nDifTwips = -nDifTwips;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// Detektiv-Pfeile: Zellpositionen anpassen
|
|
|
|
|
//
|
|
|
|
|
@@ -1114,8 +1039,6 @@
|
|
|
|
|
aTopLeft.X() = -aTopLeft.X();
|
|
|
|
|
nDifTwips = -nDifTwips;
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
- MoveAreaTwips( nTab, aRect, Point( nDifTwips,0 ), aTopLeft );
|
|
|
|
|
- MoveAreaTwips( nTab, aRect, Point( nDifTwips,0 ), aTopLeft );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips )
|
|
|
|
|
@@ -1133,8 +1056,6 @@
|
|
|
|
|
MirrorRectRTL( aRect );
|
|
|
|
|
aTopLeft.X() = -aTopLeft.X();
|
|
|
|
|
}
|
|
|
|
|
@@ -1146,8 +1069,6 @@
|
|
|
|
|
MirrorRectRTL( aRect );
|
|
|
|
|
aTopLeft.X() = -aTopLeft.X();
|
|
|
|
|
}
|
|
|
|
|
-
|
|
|
|
|
- MoveAreaTwips( nTab, aRect, Point( 0,nDifTwips ), aTopLeft );
|
|
|
|
|
- MoveAreaTwips( nTab, aRect, Point( 0,nDifTwips ), aTopLeft );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
|
|
|
|
|
@@ -1846,35 +1767,105 @@
|
|
|
|
|
}
|
|
|
|
|
BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes )
|
|
|
|
|
@@ -1823,35 +1744,105 @@
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-void ScDrawLayer::SetAnchor( SdrObject* pObj, ScAnchorType eType )
|
|
|
|
@ -484,7 +484,8 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void ScDrawLayer::SetCellAnchored( SdrObject &rObj, const ScDrawObjData &rAnchor )
|
|
|
|
|
+{
|
|
|
|
|
{
|
|
|
|
|
- ScAnchorType eOldAnchorType = GetAnchor( pObj );
|
|
|
|
|
+ ScDrawObjData* pAnchor = GetObjData( &rObj, true );
|
|
|
|
|
+ pAnchor->maStart = rAnchor.maStart;
|
|
|
|
|
+ pAnchor->maEnd = rAnchor.maEnd;
|
|
|
|
@ -508,7 +509,11 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
+ aAnchor.maStartOffset.X() = aObjRect.Left()-aCellRect.Left();
|
|
|
|
|
+ else
|
|
|
|
|
+ aAnchor.maStartOffset.X() = aCellRect.Right()-aObjRect.Right();
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- // Ein an der Seite verankertes Objekt zeichnet sich durch eine Anker-Pos
|
|
|
|
|
- // von (0,1) aus. Das ist ein shabby Trick, der aber funktioniert!
|
|
|
|
|
- Point aAnchor( 0, eType == SCA_PAGE ? 1 : 0 );
|
|
|
|
|
- pObj->SetAnchorPos( aAnchor );
|
|
|
|
|
+ aAnchor.maEnd = aRange.aEnd;
|
|
|
|
|
+ aCellRect = rDoc.GetMMRect( aRange.aEnd.Col(), aRange.aEnd.Row(),
|
|
|
|
|
+ aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aEnd.Tab() );
|
|
|
|
@ -517,20 +522,20 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
+ aAnchor.maEndOffset.X() = aObjRect.Right()-aCellRect.Left();
|
|
|
|
|
+ else
|
|
|
|
|
+ aAnchor.maEndOffset.X() = aCellRect.Right()-aObjRect.Left();
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- if ( eOldAnchorType != eType )
|
|
|
|
|
- pObj->notifyShapePropertyChange( ::svx::eSpreadsheetAnchor );
|
|
|
|
|
+ SetCellAnchored( rObj, aAnchor );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-ScAnchorType ScDrawLayer::GetAnchor( const SdrObject* pObj )
|
|
|
|
|
+void ScDrawLayer::UpdateCellAnchorFromPositionEnd( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab )
|
|
|
|
|
{
|
|
|
|
|
- ScAnchorType eOldAnchorType = GetAnchor( pObj );
|
|
|
|
|
- Point aAnchor( pObj->GetAnchorPos() );
|
|
|
|
|
- return ( aAnchor.Y() != 0 ) ? SCA_PAGE : SCA_CELL;
|
|
|
|
|
+ Rectangle aObjRect(rObj.GetLogicRect());
|
|
|
|
|
+ ScRange aRange = rDoc.GetRange( nTab, aObjRect );
|
|
|
|
|
|
|
|
|
|
- // Ein an der Seite verankertes Objekt zeichnet sich durch eine Anker-Pos
|
|
|
|
|
- // von (0,1) aus. Das ist ein shabby Trick, der aber funktioniert!
|
|
|
|
|
- Point aAnchor( 0, eType == SCA_PAGE ? 1 : 0 );
|
|
|
|
|
- pObj->SetAnchorPos( aAnchor );
|
|
|
|
|
+
|
|
|
|
|
+ ScDrawObjData* pAnchor = GetObjData( &rObj, true );
|
|
|
|
|
+ pAnchor->maEnd = aRange.aEnd;
|
|
|
|
|
+
|
|
|
|
@ -543,19 +548,14 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
+ else
|
|
|
|
|
+ pAnchor->maEndOffset.X() = aCellRect.Right()-aObjRect.Left();
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
- if ( eOldAnchorType != eType )
|
|
|
|
|
- pObj->notifyShapePropertyChange( ::svx::eSpreadsheetAnchor );
|
|
|
|
|
+
|
|
|
|
|
+void ScDrawLayer::SetPageAnchored( SdrObject &rObj )
|
|
|
|
|
+{
|
|
|
|
|
+ DeleteFirstUserDataOfType(&rObj, SC_UD_OBJDATA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-ScAnchorType ScDrawLayer::GetAnchor( const SdrObject* pObj )
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+ScAnchorType ScDrawLayer::GetAnchorType( const SdrObject &rObj )
|
|
|
|
|
{
|
|
|
|
|
- Point aAnchor( pObj->GetAnchorPos() );
|
|
|
|
|
- return ( aAnchor.Y() != 0 ) ? SCA_PAGE : SCA_CELL;
|
|
|
|
|
+{
|
|
|
|
|
+ //If this object has a cell anchor associated with it
|
|
|
|
|
+ //then its cell-anchored, otherwise its page-anchored
|
|
|
|
|
+ return ScDrawLayer::GetObjData(const_cast<SdrObject*>(&rObj)) ? SCA_CELL : SCA_PAGE;
|
|
|
|
@ -563,47 +563,47 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
|
|
|
|
|
|
|
|
|
|
ScDrawObjData* ScDrawLayer::GetObjData( SdrObject* pObj, BOOL bCreate ) // static
|
|
|
|
|
{
|
|
|
|
|
- USHORT nCount = pObj ? pObj->GetUserDataCount() : 0;
|
|
|
|
|
- for( USHORT i = 0; i < nCount; i++ )
|
|
|
|
|
- {
|
|
|
|
|
- SdrObjUserData* pData = pObj->GetUserData( i );
|
|
|
|
|
- if( pData && pData->GetInventor() == SC_DRAWLAYER
|
|
|
|
|
- && pData->GetId() == SC_UD_OBJDATA )
|
|
|
|
|
- return (ScDrawObjData*) pData;
|
|
|
|
|
- }
|
|
|
|
|
- USHORT nCount = pObj ? pObj->GetUserDataCount() : 0;
|
|
|
|
|
- for( USHORT i = 0; i < nCount; i++ )
|
|
|
|
|
- {
|
|
|
|
|
- SdrObjUserData* pData = pObj->GetUserData( i );
|
|
|
|
|
- if( pData && pData->GetInventor() == SC_DRAWLAYER
|
|
|
|
|
- && pData->GetId() == SC_UD_OBJDATA )
|
|
|
|
|
- return (ScDrawObjData*) pData;
|
|
|
|
|
- }
|
|
|
|
|
+ if (SdrObjUserData *pData = GetFirstUserDataOfType(pObj, SC_UD_OBJDATA))
|
|
|
|
|
+ return (ScDrawObjData*) pData;
|
|
|
|
|
+
|
|
|
|
|
if( pObj && bCreate )
|
|
|
|
|
{
|
|
|
|
|
ScDrawObjData* pData = new ScDrawObjData;
|
|
|
|
|
@@ -1911,15 +1902,7 @@
|
|
|
|
|
if( pObj && bCreate )
|
|
|
|
|
{
|
|
|
|
|
ScDrawObjData* pData = new ScDrawObjData;
|
|
|
|
|
@@ -1888,15 +1879,7 @@
|
|
|
|
|
|
|
|
|
|
ScIMapInfo* ScDrawLayer::GetIMapInfo( SdrObject* pObj ) // static
|
|
|
|
|
{
|
|
|
|
|
- USHORT nCount = pObj->GetUserDataCount();
|
|
|
|
|
- for( USHORT i = 0; i < nCount; i++ )
|
|
|
|
|
- {
|
|
|
|
|
- SdrObjUserData* pData = pObj->GetUserData( i );
|
|
|
|
|
- if( pData && pData->GetInventor() == SC_DRAWLAYER
|
|
|
|
|
- && pData->GetId() == SC_UD_IMAPDATA )
|
|
|
|
|
- return (ScIMapInfo*) pData;
|
|
|
|
|
- }
|
|
|
|
|
- return NULL;
|
|
|
|
|
- USHORT nCount = pObj->GetUserDataCount();
|
|
|
|
|
- for( USHORT i = 0; i < nCount; i++ )
|
|
|
|
|
- {
|
|
|
|
|
- SdrObjUserData* pData = pObj->GetUserData( i );
|
|
|
|
|
- if( pData && pData->GetInventor() == SC_DRAWLAYER
|
|
|
|
|
- && pData->GetId() == SC_UD_IMAPDATA )
|
|
|
|
|
- return (ScIMapInfo*) pData;
|
|
|
|
|
- }
|
|
|
|
|
- return NULL;
|
|
|
|
|
+ return (ScIMapInfo*)GetFirstUserDataOfType(pObj, SC_UD_IMAPDATA);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// static:
|
|
|
|
|
@@ -1972,7 +1955,7 @@
|
|
|
|
|
else if ( pObj->ISA( SdrOle2Obj ) ) // OLE-Objekt
|
|
|
|
|
{
|
|
|
|
|
@@ -1949,7 +1932,7 @@
|
|
|
|
|
else if ( pObj->ISA( SdrOle2Obj ) ) // OLE-Objekt
|
|
|
|
|
{
|
|
|
|
|
// TODO/LEAN: working with visual area needs running state
|
|
|
|
|
- aGraphSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize();
|
|
|
|
|
- aGraphSize = ((SdrOle2Obj*)pObj)->GetOrigObjSize();
|
|
|
|
|
+ aGraphSize = ((const SdrOle2Obj*)pObj)->GetOrigObjSize();
|
|
|
|
|
bObjSupported = TRUE;
|
|
|
|
|
}
|
|
|
|
|
bObjSupported = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1990,14 +1973,9 @@
|
|
|
|
|
@@ -1967,14 +1950,9 @@
|
|
|
|
|
|
|
|
|
|
ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, BOOL bCreate ) // static
|
|
|
|
|
{
|
|
|
|
|