diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-06 16:24:07 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-01-06 16:41:24 -0500 |
commit | 248a6136b898389a5d3d351859591b2de458ce90 (patch) | |
tree | e7fabaf9b96867d5dd6de8355cec47a13b781765 /sc | |
parent | bf6ccec6334141be5e0247f9cf3f34762f668e40 (diff) |
Fix re-calculation of the position of circular drawing objects.
Cell-anchored circular drawing objects would get distorted whenever
its bounding rectangle changes, either via insertion / removal of
columns / rows, or changing the row height / column width.
This commit fixes it by differentiating the validation circles, which
needs its own re-calc algorithm, from the normal circular drawing
objects.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/userdat.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/postit.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/userdat.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/detfunc.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/drawvie3.cxx | 2 |
6 files changed, 12 insertions, 10 deletions
diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx index 259e99d53090..ed6adc283292 100644 --- a/sc/inc/userdat.hxx +++ b/sc/inc/userdat.hxx @@ -59,11 +59,13 @@ public: class ScDrawObjData : public SdrObjUserData { public: + enum Type { CellNote, ValidationCircle, DrawingObject }; + ScAddress maStart; ScAddress maEnd; Point maStartOffset; Point maEndOffset; - bool mbNote; + Type meType; Rectangle maLastRect; explicit ScDrawObjData(); diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 2e2d00a4e606..91820f494dcc 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -610,7 +610,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati if( !pDoc ) return; - if( rData.mbNote ) + if (rData.meType == ScDrawObjData::CellNote) { OSL_ENSURE( rData.maStart.IsValid(), "ScDrawLayer::RecalcPos - invalid position for cell note" ); /* #i109372# On insert/remove rows/columns/cells: Updating the caption @@ -636,13 +636,12 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati SCROW nRow2 = rData.maEnd.Row(); SCTAB nTab2 = rData.maEnd.Tab(); - // validation circle - bool bCircle = pObj->ISA( SdrCircObj ); // detective arrow bool bArrow = pObj->IsPolyObj() && (pObj->GetPointCount() == 2); - if( bCircle ) + if (rData.meType == ScDrawObjData::ValidationCircle) { + // Validation circle for detective. rData.maLastRect = pObj->GetLogicRect(); Point aPos( pDoc->GetColOffset( nCol1, nTab1 ), pDoc->GetRowOffset( nRow1, nTab1 ) ); @@ -1835,13 +1834,13 @@ ScDrawObjData* ScDrawLayer::GetObjDataTab( SdrObject* pObj, SCTAB nTab ) bool ScDrawLayer::IsNoteCaption( SdrObject* pObj ) { ScDrawObjData* pData = pObj ? GetObjData( pObj ) : 0; - return pData && pData->mbNote; + return pData && pData->meType == ScDrawObjData::CellNote; } ScDrawObjData* ScDrawLayer::GetNoteCaptionData( SdrObject* pObj, SCTAB nTab ) { ScDrawObjData* pData = pObj ? GetObjDataTab( pObj, nTab ) : 0; - return (pData && pData->mbNote) ? pData : 0; + return (pData && pData->meType == ScDrawObjData::CellNote) ? pData : 0; } ScIMapInfo* ScDrawLayer::GetIMapInfo( SdrObject* pObj ) diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index a8881c0f15c6..04001c362793 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -109,7 +109,7 @@ void ScCaptionUtil::SetCaptionUserData( SdrCaptionObj& rCaption, const ScAddress ScDrawObjData* pObjData = ScDrawLayer::GetObjData( &rCaption, true ); OSL_ENSURE( pObjData, "ScCaptionUtil::SetCaptionUserData - missing drawing object user data" ); pObjData->maStart = rPos; - pObjData->mbNote = true; + pObjData->meType = ScDrawObjData::CellNote; } void ScCaptionUtil::SetDefaultItems( SdrCaptionObj& rCaption, ScDocument& rDoc ) diff --git a/sc/source/core/data/userdat.cxx b/sc/source/core/data/userdat.cxx index 2b2db805fde6..694763417e2c 100644 --- a/sc/source/core/data/userdat.cxx +++ b/sc/source/core/data/userdat.cxx @@ -70,7 +70,7 @@ ScDrawObjData::ScDrawObjData() : SdrObjUserData( SC_DRAWLAYER, SC_UD_OBJDATA, 0 ), maStart( ScAddress::INITIALIZE_INVALID ), maEnd( ScAddress::INITIALIZE_INVALID ), - mbNote( false ) + meType( DrawingObject ) { } diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 567ba49fa079..ebf9ef8d3944 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -681,6 +681,7 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, sal_True ); pData->maStart.Set( nCol, nRow, nTab); pData->maEnd.SetInvalid(); + pData->meType = ScDrawObjData::ValidationCircle; Modified(); } diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx index ed701a2d62ab..4479cdf7e6db 100644 --- a/sc/source/ui/view/drawvie3.cxx +++ b/sc/source/ui/view/drawvie3.cxx @@ -163,7 +163,7 @@ void adjustAnchoredPosition(const SdrHint& rHint, const ScDocument& rDoc, SCTAB if (!pAnchor) return; - if (pAnchor->mbNote) + if (pAnchor->meType == ScDrawObjData::CellNote) return; if (pAnchor->maLastRect == pObj->GetLogicRect()) |