[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/source
Vasily Melenchuk
Vasily.Melenchuk at cib.de
Fri Dec 1 14:24:29 UTC 2017
Rebased ref, commits from common ancestor:
commit 23fa3482d9506544f5f345f38000267798ac1231
Author: Vasily Melenchuk <Vasily.Melenchuk at cib.de>
Date: Wed Nov 8 16:53:12 2017 +0300
tdf#113901: Grid offset for notes and temporary notes modified.
Older calculations for gird offset were incomplete: are not used for notes
(only for temporary ones on mouse over), were not taken into account during
temporary note disappear and contain duplicated code from
ScDrawView::SyncForGrid()
New approach elminate described above problems.
Reviewed-on: https://gerrit.libreoffice.org/44464
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
Conflicts:
sc/source/ui/docshell/docfunc.cxx
sc/source/ui/inc/notemark.hxx
sc/source/ui/view/notemark.cxx
Change-Id: I5f92971e156f37f052b4e6d47b2f16480bdbaf7e
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index c42f04e1bb31..4065a8ddb2cf 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -27,6 +27,8 @@
#include <vcl/virdev.hxx>
#include <vcl/waitobj.hxx>
#include <svl/PasswordHelper.hxx>
+#include <o3tl/make_unique.hxx>
+#include <svx/svdocapt.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/ModuleType.hpp>
@@ -1224,6 +1226,7 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
if (rDoc.IsStreamValid(rPos.Tab()))
rDoc.SetStreamValid(rPos.Tab(), false);
+ ScDocShell::GetViewData()->GetScDrawView()->SyncForGrid(pNote->GetCaption());
rDocShell.SetDocumentModified();
return true;
diff --git a/sc/source/ui/inc/notemark.hxx b/sc/source/ui/inc/notemark.hxx
index b6f8f8d70d00..60d599794f01 100644
--- a/sc/source/ui/inc/notemark.hxx
+++ b/sc/source/ui/inc/notemark.hxx
@@ -27,6 +27,7 @@
class SdrModel;
class SdrObject;
+class ScDrawView;
class ScNoteMarker
{
@@ -45,6 +46,7 @@ private:
bool bByKeyboard;
Rectangle aRect;
+ ScDrawView* aDrawView;
SdrModel* pModel;
SdrObject* pObject;
bool bVisible;
@@ -54,7 +56,7 @@ private:
public:
ScNoteMarker( vcl::Window* pWin, vcl::Window* pRight, vcl::Window* pBottom, vcl::Window* pDiagonal,
ScDocument* pD, ScAddress aPos, const OUString& rUser,
- const MapMode& rMap, bool bLeftEdge, bool bForce, bool bKeyboard );
+ const MapMode& rMap, bool bLeftEdge, bool bForce, bool bKeyboard, ScDrawView * pDrawView );
~ScNoteMarker();
void Draw();
@@ -62,7 +64,6 @@ public:
const ScAddress& GetDocPos() const { return aDocPos; }
bool IsByKeyboard() const { return bByKeyboard; }
- void SetGridOff( const Point& rOff ) { aGridOff = rOff; }
};
#endif
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 2d853957135f..6c460d83300e 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -208,26 +208,7 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
mpNoteMarker.reset(new ScNoteMarker(pLeft, pRight, pBottom, pDiagonal,
pDoc, aCellPos, aTrackText,
- aMapMode, bLeftEdge, bFast, bKeyboard));
- if ( pViewData->GetScDrawView() )
- {
- // get position for aCellPos
- // 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, true );
- MapMode aDrawMode = GetDrawMapMode();
- Point aCurPosHmm = PixelToLogic(aScreenPos, aDrawMode );
- Point aGridOff = aCurPosHmm -aOldPos;
- // fdo#63323 fix the X Position for the showing comment when
- // the mouse over the cell when the sheet are RTL
- if ( pDoc->IsNegativePage(nTab))
- aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
- mpNoteMarker->SetGridOff( aGridOff );
- }
+ aMapMode, bLeftEdge, bFast, bKeyboard, pViewData->GetScDrawView()));
}
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 c9d12e421c24..ac72593b1477 100644
--- a/sc/source/ui/view/notemark.cxx
+++ b/sc/source/ui/view/notemark.cxx
@@ -30,13 +30,14 @@
#include "notemark.hxx"
#include "document.hxx"
#include "postit.hxx"
+#include "drawview.hxx"
#define SC_NOTEMARK_TIME 800
#define SC_NOTEMARK_SHORT 70
ScNoteMarker::ScNoteMarker( vcl::Window* pWin, vcl::Window* pRight, vcl::Window* pBottom, vcl::Window* pDiagonal,
ScDocument* pD, ScAddress aPos, const OUString& rUser,
- const MapMode& rMap, bool bLeftEdge, bool bForce, bool bKeyboard ) :
+ const MapMode& rMap, bool bLeftEdge, bool bForce, bool bKeyboard, ScDrawView *pDrawView) :
pWindow( pWin ),
pRightWin( pRight ),
pBottomWin( pBottom ),
@@ -47,6 +48,7 @@ ScNoteMarker::ScNoteMarker( vcl::Window* pWin, vcl::Window* pRight, vcl::Window*
aMapMode( rMap ),
bLeft( bLeftEdge ),
bByKeyboard( bKeyboard ),
+ aDrawView ( pDrawView ),
pModel( nullptr ),
pObject( nullptr ),
bVisible( false )
@@ -97,8 +99,12 @@ IMPL_LINK_NOARG_TYPED(ScNoteMarker, TimeHdl, Timer *, void)
pObject = ScNoteUtil::CreateTempCaption( *pDoc, aDocPos, *pPage, aUserText, aVisRect, bLeft );
if( pObject )
{
- pObject->SetGridOffset( aGridOff );
+ aDrawView->SyncForGrid(pObject);
aRect = pObject->GetCurrentBoundRect();
+
+ // Need to include grid offset: GetCurrentBoundRect is removing it
+ // but we need to know actual rect position
+ aRect += pObject->GetGridOffset();
}
// Insert page so that the model recognise it and also deleted
More information about the Libreoffice-commits
mailing list