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 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.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 +++ 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 <vcl/svapp.hxx>
#include <unotools/ucbstreamhelper.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 "drwlayer.hxx"
#include "drawpage.hxx" #include "drawpage.hxx"
#include "global.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" ); DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos - missing document" );
if( !pDoc ) if( !pDoc )
@@ -565,6 +602,8 @@ @@ -578,6 +615,8 @@
if( bCircle ) 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 ) ); Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) );
TwipsToMM( aPos.X() ); TwipsToMM( aPos.X() );
TwipsToMM( aPos.Y() ); TwipsToMM( aPos.Y() );
@@ -585,11 +624,18 @@ @@ -598,11 +637,18 @@
{ {
if (bRecording) if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) ); 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) //! nicht mehrere Undos fuer ein Objekt erzeugen (hinteres kann dann weggelassen werden)
SCCOL nLastCol; SCCOL nLastCol;
@@ -610,6 +656,8 @@ @@ -623,6 +669,8 @@
{ {
if (bRecording) if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) ); 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 ); pObj->SetPoint( aStartPos, 0 );
} }
@@ -624,6 +672,8 @@ @@ -637,6 +685,8 @@
{ {
if (bRecording) if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) ); 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 ); pObj->SetPoint( aEndPos, 1 );
} }
} }
@@ -644,6 +694,8 @@ @@ -657,6 +707,8 @@
{ {
if (bRecording) if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) ); 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 ); pObj->SetPoint( aEndPos, 1 );
} }
@@ -660,45 +712,68 @@ @@ -673,45 +725,68 @@
{ {
if (bRecording) if (bRecording)
AddCalcUndo( new SdrUndoGeoObj( *pObj ) ); 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; 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, 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 @@ @@ -1072,11 +1002,6 @@
aTopLeft.Y() += aMove.Y(); 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 // Detektiv-Pfeile: Zellpositionen anpassen
// //
@@ -1101,8 +1026,6 @@ @@ -1114,8 +1039,6 @@
aTopLeft.X() = -aTopLeft.X(); aTopLeft.X() = -aTopLeft.X();
nDifTwips = -nDifTwips; 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 ) void ScDrawLayer::HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips )
@@ -1133,8 +1056,6 @@ @@ -1146,8 +1069,6 @@
MirrorRectRTL( aRect ); MirrorRectRTL( aRect );
aTopLeft.X() = -aTopLeft.X(); 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 ); - MoveAreaTwips( nTab, aRect, Point( 0,nDifTwips ), aTopLeft );
} }
BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow ) BOOL ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes )
@@ -1846,35 +1767,105 @@ @@ -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 ) +void ScDrawLayer::SetCellAnchored( SdrObject &rObj, const ScDrawObjData &rAnchor )
+{ {
- ScAnchorType eOldAnchorType = GetAnchor( pObj );
+ ScDrawObjData* pAnchor = GetObjData( &rObj, true ); + ScDrawObjData* pAnchor = GetObjData( &rObj, true );
+ pAnchor->maStart = rAnchor.maStart; + pAnchor->maStart = rAnchor.maStart;
+ pAnchor->maEnd = rAnchor.maEnd; + 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(); + aAnchor.maStartOffset.X() = aObjRect.Left()-aCellRect.Left();
+ else + else
+ aAnchor.maStartOffset.X() = aCellRect.Right()-aObjRect.Right(); + 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; + aAnchor.maEnd = aRange.aEnd;
+ aCellRect = rDoc.GetMMRect( aRange.aEnd.Col(), aRange.aEnd.Row(), + aCellRect = rDoc.GetMMRect( aRange.aEnd.Col(), aRange.aEnd.Row(),
+ aRange.aEnd.Col(), aRange.aEnd.Row(), aRange.aEnd.Tab() ); + 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(); + aAnchor.maEndOffset.X() = aObjRect.Right()-aCellRect.Left();
+ else + else
+ aAnchor.maEndOffset.X() = aCellRect.Right()-aObjRect.Left(); + aAnchor.maEndOffset.X() = aCellRect.Right()-aObjRect.Left();
+
- if ( eOldAnchorType != eType )
- pObj->notifyShapePropertyChange( ::svx::eSpreadsheetAnchor );
+ SetCellAnchored( rObj, aAnchor ); + SetCellAnchored( rObj, aAnchor );
+} }
+
-ScAnchorType ScDrawLayer::GetAnchor( const SdrObject* pObj )
+void ScDrawLayer::UpdateCellAnchorFromPositionEnd( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab ) +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()); + Rectangle aObjRect(rObj.GetLogicRect());
+ ScRange aRange = rDoc.GetRange( nTab, aObjRect ); + 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 ); + ScDrawObjData* pAnchor = GetObjData( &rObj, true );
+ pAnchor->maEnd = aRange.aEnd; + pAnchor->maEnd = aRange.aEnd;
+ +
@ -543,19 +548,14 @@ diff -ru sc.orig/source/core/data/drwlayer.cxx sc/source/core/data/drwlayer.cxx
+ else + else
+ pAnchor->maEndOffset.X() = aCellRect.Right()-aObjRect.Left(); + pAnchor->maEndOffset.X() = aCellRect.Right()-aObjRect.Left();
+} +}
+
- if ( eOldAnchorType != eType )
- pObj->notifyShapePropertyChange( ::svx::eSpreadsheetAnchor );
+void ScDrawLayer::SetPageAnchored( SdrObject &rObj ) +void ScDrawLayer::SetPageAnchored( SdrObject &rObj )
+{ +{
+ DeleteFirstUserDataOfType(&rObj, SC_UD_OBJDATA); + DeleteFirstUserDataOfType(&rObj, SC_UD_OBJDATA);
} +}
+
-ScAnchorType ScDrawLayer::GetAnchor( const SdrObject* pObj )
+ScAnchorType ScDrawLayer::GetAnchorType( const SdrObject &rObj ) +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 + //If this object has a cell anchor associated with it
+ //then its cell-anchored, otherwise its page-anchored + //then its cell-anchored, otherwise its page-anchored
+ return ScDrawLayer::GetObjData(const_cast<SdrObject*>(&rObj)) ? SCA_CELL : SCA_PAGE; + 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 ) if( pObj && bCreate )
{ {
ScDrawObjData* pData = new ScDrawObjData; ScDrawObjData* pData = new ScDrawObjData;
@@ -1911,15 +1902,7 @@ @@ -1888,15 +1879,7 @@
ScIMapInfo* ScDrawLayer::GetIMapInfo( SdrObject* pObj ) // static 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: // static:
@@ -1972,7 +1955,7 @@ @@ -1949,7 +1932,7 @@
else if ( pObj->ISA( SdrOle2Obj ) ) // OLE-Objekt else if ( pObj->ISA( SdrOle2Obj ) ) // OLE-Objekt
{ {
// TODO/LEAN: working with visual area needs running state // 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; bObjSupported = TRUE;
} }
@@ -1990,14 +1973,9 @@ @@ -1967,14 +1950,9 @@
ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, BOOL bCreate ) // static ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, BOOL bCreate ) // static
{ {

Loading…
Cancel
Save