[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 4 08:51:09 PST 2012


 sc/source/ui/inc/notemark.hxx  |    3 ++-
 sc/source/ui/view/gridwin5.cxx |   20 +++++++++++++++++++-
 sc/source/ui/view/notemark.cxx |    3 +++
 sc/source/ui/view/viewfun6.cxx |    3 +++
 4 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit cce13e3f6a42c10232653dbd52088743f935c7d0
Author: Noel Power <noel.power at suse.com>
Date:   Tue Dec 4 16:49:34 2012 +0000

    fix problem with captions inserted at problematic zoom levels
    
    also makes sure that caption drawn ( when hovering over note cell ) is drawn
    at the correct position also ( e.g. corrected for zoom pos )
    
    Change-Id: I7c06dd74d26e37d69bcc5a5734fae676aa7599e7

diff --git a/sc/source/ui/inc/notemark.hxx b/sc/source/ui/inc/notemark.hxx
index 501ec7f..acf4757 100644
--- a/sc/source/ui/inc/notemark.hxx
+++ b/sc/source/ui/inc/notemark.hxx
@@ -48,7 +48,7 @@ private:
     SdrModel*       pModel;
     SdrObject*      pObject;
     sal_Bool            bVisible;
-
+    Point       aGridOff;
     DECL_LINK( TimeHdl, void* );
 
 public:
@@ -62,6 +62,7 @@ public:
 
     ScAddress   GetDocPos() const       { return aDocPos; }
     sal_Bool        IsByKeyboard() const    { return bByKeyboard; }
+    void        SetGridOff( const Point& rOff ) { aGridOff = rOff; }
 };
 
 
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index a82fc30..e7e3edc 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -204,9 +204,27 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
                 aOrigin.Y() += aLeftSize.Height();
             aMapMode.SetOrigin( aOrigin );
 
-            pNoteMarker = new ScNoteMarker( pLeft, pRight, pBottom, pDiagonal,
+            pNoteMarker = new ScNoteMarker(  pLeft, pRight, pBottom, pDiagonal,
                                             pDoc, aCellPos, aTrackText,
                                             aMapMode, bLeftEdge, bFast, bKeyboard );
+            if ( ScDrawView* pDrawView = pViewData->GetScDrawView() )
+            {
+                // get position for aCellPos
+                if ( pDoc )
+                {
+                    // get draw position in hmm for aCellPos
+                    Point aOldPos( pDoc->GetColOffset( aCellPos.Col(), aCellPos.Tab() ), pDoc->GetRowOffset( aCellPos.Row(), aCellPos.Tab() ) );
+                    aOldPos.X() = sc::TwipsToHMM( aOldPos.X() );
+                    aOldPos.Y() = sc::TwipsToHMM( aOldPos.Y() );
+                    // get screen pos in hmm for aCellPos
+                    // and equiv screen pos
+                    Point aScreenPos = pViewData->GetScrPos( aCellPos.Col(), aCellPos.Row(), eWhich, sal_True );
+                    MapMode aDrawMode = GetDrawMapMode();
+                    Point aCurPosHmm = PixelToLogic(aScreenPos, aDrawMode );
+                    Point aGridOff = aCurPosHmm -aOldPos;
+                    pNoteMarker->SetGridOff( aGridOff );
+                }
+            }
         }
 
         bDone = true;       // something is shown (old or new)
diff --git a/sc/source/ui/view/notemark.cxx b/sc/source/ui/view/notemark.cxx
index 0958d8d..2735a25 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -98,7 +98,10 @@ IMPL_LINK_NOARG(ScNoteMarker, TimeHdl)
         {
             pObject = ScNoteUtil::CreateTempCaption( *pDoc, aDocPos, *pPage, aUserText, aVisRect, bLeft );
             if( pObject )
+            {
+                pObject->SetGridOffset( aGridOff );
                 aRect = pObject->GetCurrentBoundRect();
+            }
 
             // Page einfuegen damit das Model sie kennt und auch deleted
             pModel->InsertPage( pPage );
diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx
index e9ec827..86b04f6 100644
--- a/sc/source/ui/view/viewfun6.cxx
+++ b/sc/source/ui/view/viewfun6.cxx
@@ -42,6 +42,7 @@
 #include "externalrefmgr.hxx"
 #include "cell.hxx"
 #include "markdata.hxx"
+#include "drawview.hxx"
 
 #include <vector>
 
@@ -313,6 +314,8 @@ void ScViewFunc::EditNote()
             return a caption object. */
         if( SdrCaptionObj* pCaption = pNote->GetCaption() )
         {
+            if ( ScDrawView* pScDrawView = GetScDrawView() )
+               pScDrawView->SyncForGrid( pCaption );
             // #i33764# enable the resize handles before starting edit mode
             if( FuPoor* pDraw = GetDrawFuncPtr() )
                 static_cast< FuSelection* >( pDraw )->ActivateNoteHandles( pCaption );


More information about the Libreoffice-commits mailing list