summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2017-04-08 21:29:06 +0800
committerMark Hung <marklh9@gmail.com>2017-04-15 13:47:03 +0200
commitcf3cc3e1c6da6eaaba35f9daa0452b2e0e98a88d (patch)
tree8591757111112440f768b61cc5ec368ff378c349
parent25f079087fb4368b94ec3cc791fb04eeb1405bb3 (diff)
tdf#106639 Don't add space if Snap To Chars of text grid is effective.
SwFntObj::DrawText() don't process added space of justified text if Snap to Chars is effective when text grid is Lines and Chars, however SwTextCursor::GetCursorOfst and SwTextCursor::GetCharRect count them despite that and make the cursor movement irregular. Change-Id: Ic31577e207b5a033298970a831016221f99d3499 Reviewed-on: https://gerrit.libreoffice.org/36291 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Hung <marklh9@gmail.com>
-rw-r--r--sw/source/core/text/portxt.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 9547147c4245..cd508425cb94 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -28,6 +28,8 @@
#include <porglue.hxx>
#include <portab.hxx>
#include <porfld.hxx>
+#include <pagefrm.hxx>
+#include <tgrditem.hxx>
#include <wrong.hxx>
#include <viewsh.hxx>
#include <IDocumentSettingAccess.hxx>
@@ -563,6 +565,14 @@ sal_Int32 SwTextPortion::GetSpaceCnt( const SwTextSizeInfo &rInf,
{
sal_Int32 nCnt = 0;
sal_Int32 nPos = 0;
+
+ if ( rInf.SnapToGrid() )
+ {
+ SwTextGridItem const*const pGrid(GetGridItem(rInf.GetTextFrame()->FindPageFrame()));
+ if (pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars())
+ return 0;
+ }
+
if ( InExpGrp() )
{
if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() )
@@ -593,6 +603,13 @@ long SwTextPortion::CalcSpacing( long nSpaceAdd, const SwTextSizeInfo &rInf ) co
{
sal_Int32 nCnt = 0;
+ if ( rInf.SnapToGrid() )
+ {
+ SwTextGridItem const*const pGrid(GetGridItem(rInf.GetTextFrame()->FindPageFrame()));
+ if (pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars())
+ return 0;
+ }
+
if ( InExpGrp() )
{
if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() )