[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jan 6 13:27:34 PST 2012


 sc/inc/userdat.hxx               |    4 +++-
 sc/source/core/data/drwlayer.cxx |   11 +++++------
 sc/source/core/data/postit.cxx   |    2 +-
 sc/source/core/data/userdat.cxx  |    2 +-
 sc/source/core/tool/detfunc.cxx  |    1 +
 sc/source/ui/view/drawvie3.cxx   |    2 +-
 6 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 753aaaa259a6b5a1b9ac4a270d4a38c7111714b9
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Jan 6 16:24:07 2012 -0500

    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.

diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx
index 259e99d..ed6adc2 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 2e2d00a..91820f4 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 a8881c0..04001c3 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 2b2db80..6947634 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 567ba49..ebf9ef8 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 ed701a2..4479cdf 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())


More information about the Libreoffice-commits mailing list