[Libreoffice-commits] core.git: sw/source
Mark Hung
marklh9 at gmail.com
Sat Apr 15 11:47:29 UTC 2017
sw/source/core/text/portxt.cxx | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
New commits:
commit cf3cc3e1c6da6eaaba35f9daa0452b2e0e98a88d
Author: Mark Hung <marklh9 at gmail.com>
Date: Sat Apr 8 21:29:06 2017 +0800
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 at libreoffice.org>
Reviewed-by: Mark Hung <marklh9 at gmail.com>
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() )
More information about the Libreoffice-commits
mailing list