f41
Caolán McNamara 14 years ago
parent da1d217923
commit eda739924d

@ -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,7 +97,7 @@ 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 @@
}
}
@ -140,7 +140,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
{
DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos - missing document" );
if( !pDoc )
@@ -565,6 +602,8 @@
@@ -578,6 +615,8 @@
if( bCircle )
{
@ -149,7 +149,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
TwipsToMM( aPos.X() );
TwipsToMM( aPos.Y() );
@@ -585,11 +624,18 @@
@@ -598,11 +637,18 @@
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
@ -169,7 +169,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
//! nicht mehrere Undos fuer ein Objekt erzeugen (hinteres kann dann weggelassen werden)
SCCOL nLastCol;
@@ -610,6 +656,8 @@
@@ -623,6 +669,8 @@
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
@ -178,7 +178,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
pObj->SetPoint( aStartPos, 0 );
}
@@ -624,6 +672,8 @@
@@ -637,6 +685,8 @@
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
@ -187,7 +187,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
pObj->SetPoint( aEndPos, 1 );
}
}
@@ -644,6 +694,8 @@
@@ -657,6 +707,8 @@
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
@ -196,7 +196,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
pObj->SetPoint( aEndPos, 1 );
}
@@ -660,45 +712,68 @@
@@ -673,45 +725,68 @@
{
if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) );
@ -270,7 +270,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
}
}
@@ -873,151 +948,6 @@
@@ -886,151 +961,6 @@
return pRet;
}
@ -422,7 +422,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
void ScDrawLayer::MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
SCsCOL nDx,SCsROW nDy, BOOL bInsDel, bool bUpdateNoteCaptionPos )
{
@@ -1059,11 +989,6 @@
@@ -1072,11 +1002,6 @@
aTopLeft.Y() += aMove.Y();
}
@ -434,7 +434,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
//
// Detektiv-Pfeile: Zellpositionen anpassen
//
@@ -1101,8 +1026,6 @@
@@ -1114,8 +1039,6 @@
aTopLeft.X() = -aTopLeft.X();
nDifTwips = -nDifTwips;
}
@ -443,7 +443,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
}
void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips )
@@ -1133,8 +1056,6 @@
@@ -1146,8 +1069,6 @@
MirrorRectRTL( aRect );
aTopLeft.X() = -aTopLeft.X();
}
@ -451,8 +451,8 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
- 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 @@
}
}
@ -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;
@ -577,7 +577,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
if( pObj && bCreate )
{
ScDrawObjData* pData = new ScDrawObjData;
@@ -1911,15 +1902,7 @@
@@ -1888,15 +1879,7 @@
ScIMapInfo* ScDrawLayer::GetIMapInfo( SdrObject* pObj ) // static
{
@ -594,7 +594,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
}
// static:
@@ -1972,7 +1955,7 @@
@@ -1949,7 +1932,7 @@
else if ( pObj->ISA( SdrOle2Obj ) ) // OLE-Objekt
{
// TODO/LEAN: working with visual area needs running state
@ -603,7 +603,7 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
bObjSupported = TRUE;
}
@@ -1990,14 +1973,9 @@
@@ -1967,14 +1950,9 @@
ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, BOOL bCreate ) // static
{

Loading…
Cancel
Save