[Libreoffice-commits] core.git: Branch 'distro/vector/vector-7.0' - 2 commits - sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 9 12:25:40 UTC 2021
sw/qa/core/text/data/line-height.fodt | 32 +++++++++++++++++++++++++++++++
sw/qa/core/text/data/line-width.fodt | 32 +++++++++++++++++++++++++++++++
sw/qa/core/text/text.cxx | 35 ++++++++++++++++++++++++++++++++++
sw/source/core/edit/edattr.cxx | 4 +--
sw/source/core/inc/txtfrm.hxx | 2 -
sw/source/core/text/frmcrsr.cxx | 2 -
sw/source/core/text/frmform.cxx | 8 +++----
sw/source/core/text/frmpaint.cxx | 4 +--
sw/source/core/text/inftxt.cxx | 4 +--
sw/source/core/text/itrcrsr.cxx | 22 ++++++++++-----------
sw/source/core/text/itrform2.cxx | 26 ++++++++++++-------------
sw/source/core/text/itrpaint.cxx | 12 +++++------
sw/source/core/text/itrtxt.cxx | 10 ++++-----
sw/source/core/text/itrtxt.hxx | 8 +++----
sw/source/core/text/porfld.cxx | 8 +++----
sw/source/core/text/porfly.cxx | 2 -
sw/source/core/text/porglue.cxx | 2 -
sw/source/core/text/porlay.cxx | 6 ++---
sw/source/core/text/porlay.hxx | 6 ++---
sw/source/core/text/porlin.cxx | 2 -
sw/source/core/text/porlin.hxx | 12 +++++------
sw/source/core/text/pormulti.cxx | 12 +++++------
sw/source/core/text/pormulti.hxx | 2 -
sw/source/core/text/possiz.hxx | 30 ++++++++++++++---------------
sw/source/core/text/txtdrop.cxx | 10 ++++-----
sw/source/core/text/txtfrm.cxx | 4 +--
26 files changed, 198 insertions(+), 99 deletions(-)
New commits:
commit 9aa3b30c9b6e44af62f48f9a8f9beb2c713f962a
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Jun 9 09:09:16 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jun 9 14:24:53 2021 +0200
sw: allow the width of a line portion to be larger than 65536 twips
The line portion width can be quite large if the line contains an
as-char image.
Found by asking -fsanitize=implicit-unsigned-integer-truncation
-fsanitize=implicit-signed-integer-truncation to flag the problematic
conversions.
(cherry picked from commit 6fdd0a3f8b3448a9a246496191908c92156cc38b)
Conflicts:
sw/source/core/edit/edattr.cxx
sw/source/core/text/pormulti.hxx
Change-Id: I303b9c71dcd979d79b9c9aee5283b268cc4e3b8c
diff --git a/sw/qa/core/text/data/line-width.fodt b/sw/qa/core/text/data/line-width.fodt
new file mode 100644
index 000000000000..a6b2b2f5c62b
--- /dev/null
+++ b/sw/qa/core/text/data/line-width.fodt
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:automatic-styles>
+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"/>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-height="84.1cm" fo:page-width="118.9cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:margin-left="0cm" fo:margin-right="0cm"/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:p><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="as-char" svg:height="84.1cm" svg:width="118.9cm" draw:z-index="0"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+ UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+ AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+ AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+ BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+ cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+ /878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+ QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+ YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+ 2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+ cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+ AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+ hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+ 5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+ AABJRU5ErkJggg==
+ </office:binary-data></draw:image></draw:frame></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index bbeb12780e05..23f3294b5303 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -94,6 +94,25 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineHeight)
assertXPath(pXmlDoc, "//fly/infos/bounds", "top", OUString::number(DOCUMENTBORDER));
}
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineWidth)
+{
+ // Given a document with an as-char image, width in twips not fitting into sal_uInt16:
+ SwDoc* pDoc = createDoc("line-width.fodt");
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ sal_Int32 nOldLeft = pWrtShell->GetCharRect().Left();
+
+ // When moving the cursor to the right:
+ pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
+
+ // Then make sure we move to the right by the image width:
+ sal_Int32 nNewLeft = pWrtShell->GetCharRect().Left();
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected greater than: 65536
+ // - Actual : 1872
+ // i.e. the width (around 67408 twips) was truncated.
+ CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(65536), nNewLeft - nOldLeft);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 20abffc64ea4..20762df86cb9 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -530,10 +530,10 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
SwFrame* pFrame = pCNd->getLayoutFrame( GetLayout() );
if ( pFrame )
{
- const sal_uInt16 nFrameWidth = static_cast<sal_uInt16>( pFrame->IsVertical() ?
+ const sal_uInt16 nFrameWidth = static_cast<sal_uInt32>( pFrame->IsVertical() ?
pFrame->getFrameArea().Height() :
pFrame->getFrameArea().Width() );
- bRet = nFrameWidth > ( nNext + MM50 );
+ bRet = static_cast<SwTwips>(nFrameWidth) > ( nNext + MM50 );
}
else
bRet = false;
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 14cf60dfa1e0..550dc19054cc 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1264,7 +1264,7 @@ void SwTextCursor::GetCharRect( SwRect* pOrig, TextFrameIndex const nOfst,
* Determines if SwTextCursor::GetModelPositionForViewPoint() should consider the next portion when calculating the
* doc model position from a Point.
*/
-static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt16 nWidth30, sal_uInt16 nX)
+static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt32 nWidth30, sal_uInt16 nX)
{
if (!pPor->GetNextPortion())
{
@@ -1311,7 +1311,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
// Until here everything in document coordinates.
x -= nLeftMargin;
- sal_uInt16 nX = sal_uInt16( x );
+ sal_uInt32 nX = sal_uInt16( x );
// If there are attribute changes in the line, search for the paragraph,
// in which nX is situated.
@@ -1330,7 +1330,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
// nWidth is the width of the line, or the width of
// the paragraph with the font change, in which nX is situated.
- sal_uInt16 nWidth = pPor->Width();
+ sal_uInt32 nWidth = pPor->Width();
if ( m_pCurr->IsSpaceAdd() || pKanaComp )
{
if ( pPor->InSpaceGrp() && nSpaceAdd )
@@ -1360,7 +1360,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
}
- sal_uInt16 nWidth30;
+ sal_uInt32 nWidth30;
if ( pPor->IsPostItsPortion() )
nWidth30 = 30 + pPor->GetViewWidth( GetInfo() ) / 2;
else
@@ -1665,12 +1665,12 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
pCurrPart = pCurrPart->GetFollow();
}
- nX = std::max(0, nX - nSumBorderWidth);
+ nX = std::max(static_cast<sal_uInt32>(0), nX - nSumBorderWidth);
}
// Shift the offset with the left border width
else if( GetInfo().GetFont()->GetLeftBorder() && !pPor->GetJoinBorderWithPrev() )
{
- nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
+ nX = std::max(static_cast<sal_uInt32>(0), nX - GetInfo().GetFont()->GetLeftBorderSpace());
}
aDrawInf.SetOffset( nX );
diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx
index 0d34ea304919..6058e805188d 100644
--- a/sw/source/core/text/porglue.cxx
+++ b/sw/source/core/text/porglue.cxx
@@ -215,7 +215,7 @@ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr )
}
while( pPrev != pLeft )
{
- if( bNoMove || pPrev->PrtWidth() >= nRightGlue ||
+ if( bNoMove || static_cast<SwTwips>(pPrev->PrtWidth()) >= nRightGlue ||
pPrev->InHyphGrp() || pPrev->IsKernPortion() )
{
// The portion before the pRight cannot be moved
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index a9b057faa454..39e13a6a5ed5 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -290,7 +290,7 @@ void SwLinePortion::Move( SwTextPaintInfo &rInf )
rInf.IncKanaIdx();
}
if( rInf.IsRotated() )
- rInf.Y( rInf.Y() + ( bB2T ? -PrtWidth() : PrtWidth() ) );
+ rInf.Y( rInf.Y() + ( bB2T ? -static_cast<SwTwips>(PrtWidth()) : static_cast<SwTwips>(PrtWidth()) ) );
else if ( bCounterDir )
rInf.X( rInf.X() - PrtWidth() );
else
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 910b0c17c888..37f801c7e1de 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -78,8 +78,8 @@ public:
sal_uInt32 GetAscent() const { return nAscent; }
void SetAscent( const sal_uInt32 nNewAsc ) { nAscent = nNewAsc; }
void PrtWidth( sal_uInt16 nNewWidth ) { Width( nNewWidth ); }
- sal_uInt16 PrtWidth() const { return Width(); }
- void AddPrtWidth( const sal_uInt16 nNew ) { Width( Width() + nNew ); }
+ sal_uInt32 PrtWidth() const { return Width(); }
+ void AddPrtWidth( const sal_uInt32 nNew ) { Width( Width() + nNew ); }
void SubPrtWidth( const sal_uInt16 nNew ) { Width( Width() - nNew ); }
// Insert methods
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 88913b6fbe2a..17cd6c552fee 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -2511,7 +2511,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
SwMultiPortion* pMulti,
SwTwips nY,
- sal_uInt16& nX,
+ sal_uInt32& nX,
TextFrameIndex const nCurrStart,
long nSpaceAdd )
: pTextCursor(pCursor),
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index 8a0d352dfa9a..e90c1eb282c1 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -242,7 +242,7 @@ class SwTextCursorSave
bool bSpaceChg;
public:
SwTextCursorSave( SwTextCursor* pTextCursor, SwMultiPortion* pMulti,
- SwTwips nY, sal_uInt16& nX, TextFrameIndex nCurrStart, long nSpaceAdd);
+ SwTwips nY, sal_uInt32& nX, TextFrameIndex nCurrStart, long nSpaceAdd);
~SwTextCursorSave();
};
commit df2cff0a3d9270d1466d6321de87657313e49ea2
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu May 20 18:02:12 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jun 8 15:55:00 2021 +0200
sw: allow the height of a line to be larger than 65536 twips
The line height can be quite large if the line contains an as-char
image.
Found by temporarily changing static_cast<sal_uInt16>() in sw/ to a
template function to make these conversions implicit (excluding cases
where the input and output types can't convert implicitly), then asking
-fsanitize=implicit-unsigned-integer-truncation
-fsanitize=implicit-signed-integer-truncation to flag the problematic
conversions.
The first hit was in SwFlyCntPortion::SetBase() (that's where 67408
turns into 1872), then the same pattern at many other places.
(cherry picked from commit 301278b656e76b6f42af5cf8a6f5c6c02acfffeb)
Conflicts:
sw/qa/core/text/text.cxx
sw/source/core/text/frmform.cxx
sw/source/core/text/porfly.cxx
sw/source/core/text/porlay.cxx
sw/source/core/text/porlay.hxx
sw/source/core/text/porlin.hxx
sw/source/core/text/pormulti.cxx
sw/source/core/text/porrst.cxx
sw/source/core/text/possiz.hxx
Change-Id: Ie12f490ed8dd5c531f11506c97598ce4f7610e2e
diff --git a/sw/qa/core/text/data/line-height.fodt b/sw/qa/core/text/data/line-height.fodt
new file mode 100644
index 000000000000..d784ec241bed
--- /dev/null
+++ b/sw/qa/core/text/data/line-height.fodt
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:automatic-styles>
+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"/>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="84.1cm" fo:page-height="118.9cm" fo:margin-top="0cm" fo:margin-bottom="0cm" fo:margin-left="0cm" fo:margin-right="0cm"/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:p><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="as-char" svg:width="84.1cm" svg:height="118.9cm" draw:z-index="0"><draw:image draw:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+ UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+ AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+ AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+ BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+ cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+ /878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+ QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+ YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+ 2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+ cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+ AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+ hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+ 5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+ AABJRU5ErkJggg==
+ </office:binary-data></draw:image></draw:frame></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 3f7cfb5272dd..bbeb12780e05 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -78,6 +78,22 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText)
assertXPath(pXmlDoc, "//floattransparent");
}
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testLineHeight)
+{
+ // Given a document with an as-char image, height in twips not fitting into sal_uInt16:
+ createDoc("line-height.fodt");
+
+ // When laying out that document:
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+ // Then make sure its top is the top of the page:
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 284
+ // - Actual : -65252
+ // due to various unsigned integer truncations.
+ assertXPath(pXmlDoc, "//fly/infos/bounds", "top", OUString::number(DOCUMENTBORDER));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 0f96e6676291..aa93e41a0136 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -568,7 +568,7 @@ public:
virtual void CheckDirection( bool bVert ) override;
/// Returns the sum of line height in pLine
- sal_uInt16 GetParHeight() const;
+ sal_uInt32 GetParHeight() const;
inline SwTextFrame *GetFollow();
inline const SwTextFrame *GetFollow() const;
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 9fd60520c325..ef7d5cbcc634 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -590,7 +590,7 @@ bool SwTextFrame::GetModelPositionForViewPoint_(SwPosition* pPos, const Point& r
// See comment in AdjustFrame()
SwTwips nMaxY = getFrameArea().Top() + getFramePrintArea().Top() + getFramePrintArea().Height();
aLine.TwipsToLine( rPoint.Y() );
- while( aLine.Y() + aLine.GetLineHeight() > nMaxY )
+ while( aLine.Y() + static_cast<SwTwips>(aLine.GetLineHeight()) > nMaxY )
{
if( !aLine.Prev() )
break;
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 71e417c3ad54..087d9e5fcc48 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1176,8 +1176,8 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
const SwLineLayout *pOldCur = rLine.GetCurr();
const TextFrameIndex nOldLen = pOldCur->GetLen();
- const sal_uInt16 nOldAscent = pOldCur->GetAscent();
- const sal_uInt16 nOldHeight = pOldCur->Height();
+ const sal_uInt32 nOldAscent = pOldCur->GetAscent();
+ const sal_uInt32 nOldHeight = pOldCur->Height();
const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
const bool bOldHyph = pOldCur->IsEndHyph();
SwTwips nOldTop = 0;
@@ -1199,7 +1199,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
bOldHyph == pNew->IsEndHyph();
if ( bUnChg && !bPrev )
{
- const long nWidthDiff = nOldWidth > pNew->Width()
+ const long nWidthDiff = nOldWidth > static_cast<SwTwips>(pNew->Width())
? nOldWidth - pNew->Width()
: pNew->Width() - nOldWidth;
@@ -1253,7 +1253,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
rLine.SetUnclipped( false );
}
}
- SwTwips nRght = std::max( nOldWidth, pNew->Width() +
+ SwTwips nRght = std::max( nOldWidth, static_cast<SwTwips>(pNew->Width()) +
pNew->GetHangingMargin() );
SwViewShell *pSh = getRootFrame()->GetCurrShell();
const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : nullptr;
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index ec3fd196d60a..1dd972ec50c7 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -331,7 +331,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf );
bool bNoDummy = !aLine.GetNext(); // Only one empty line!
- while( aLine.Y() + aLine.GetLineHeight() <= rRect.Top() )
+ while( aLine.Y() + static_cast<SwTwips>(aLine.GetLineHeight()) <= rRect.Top() )
{
if( !aLine.GetCurr()->IsDummy() &&
( rLineInf.IsCountBlankLines() ||
@@ -371,7 +371,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
if( bLineNum &&
( aExtra.HasNumber() || aExtra.HasDivider() ) )
{
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
aLine.CalcAscentAndHeight( nTmpAscent, nTmpHeight );
aExtra.PaintExtra( aLine.Y(), nTmpAscent,
nTmpHeight, bRed );
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index b7a58b198c6c..1964b8873e27 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1023,13 +1023,13 @@ void SwTextPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
{
aRect.Pos().AdjustY(20 - GetAscent() );
aRect.Pos().AdjustX(20 );
- if( aSize.Height() > rPor.Height() )
+ if( aSize.Height() > static_cast<SwTwips>(rPor.Height()) )
aRect.Height( rPor.Height() );
cChar = CHAR_LEFT_ARROW;
}
else
{
- if( aSize.Height() > rPor.Height() )
+ if( aSize.Height() > static_cast<SwTwips>(rPor.Height()) )
aRect.Height( rPor.Height() );
aRect.Pos().AdjustY( -(aRect.Height() + 20) );
aRect.Pos().AdjustX( -(aRect.Width() + 20) );
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index cb830f327412..14cf60dfa1e0 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -428,7 +428,7 @@ void SwTextCursor::GetEndCharRect(SwRect* pOrig, const TextFrameIndex nOfst,
long nLast = 0;
SwLinePortion *pPor = m_pCurr->GetFirstPortion();
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
sal_uInt16 nPorHeight = nTmpHeight;
sal_uInt16 nPorAscent = nTmpAscent;
@@ -479,7 +479,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
SwTextSizeInfo aInf( GetInfo(), &aText, m_nStart );
if( GetPropFont() )
aInf.GetFont()->SetProportion( GetPropFont() );
- sal_uInt16 nTmpAscent, nTmpHeight; // Line height
+ sal_uInt32 nTmpAscent, nTmpHeight; // Line height
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
const Size aCharSize( 1, nTmpHeight );
const Point aCharPos;
@@ -505,8 +505,8 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
}
else
{
- sal_uInt16 nPorHeight = nTmpHeight;
- sal_uInt16 nPorAscent = nTmpAscent;
+ sal_uInt32 nPorHeight = nTmpHeight;
+ sal_uInt32 nPorAscent = nTmpAscent;
SwTwips nX = 0;
SwTwips nTmpFirst = 0;
SwLinePortion *pPor = m_pCurr->GetFirstPortion();
@@ -1051,7 +1051,7 @@ void SwTextCursor::GetCharRect_( SwRect* pOrig, TextFrameIndex const nOfst,
nPorHeight = nPorAscent;
pOrig->Height( nPorHeight +
static_cast<SwDropPortion*>(pPor)->GetDropDescent() );
- if( nTmpHeight < pOrig->Height() )
+ if( static_cast<SwTwips>(nTmpHeight) < pOrig->Height() )
{
nTmpAscent = nPorAscent;
nTmpHeight = sal_uInt16( pOrig->Height() );
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 8d0cda953729..65e9a255a01e 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1553,8 +1553,8 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
// Recycling must be suppressed by changed line height and also
// by changed ascent (lowering of baseline).
- const sal_uInt16 nOldHeight = m_pCurr->Height();
- const sal_uInt16 nOldAscent = m_pCurr->GetAscent();
+ const sal_uInt32 nOldHeight = m_pCurr->Height();
+ const sal_uInt32 nOldAscent = m_pCurr->GetAscent();
m_pCurr->SetEndHyph( false );
m_pCurr->SetMidHyph( false );
@@ -1634,7 +1634,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
if ( IsFlyInCntBase() && (!IsQuick() || (pPorTmp && pPorTmp->IsFlyCntPortion() && !pPorTmp->GetNextPortion() &&
m_pCurr->Height() > pPorTmp->Height())))
{
- sal_uInt16 nTmpAscent, nTmpHeight;
+ sal_uInt32 nTmpAscent, nTmpHeight;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
AlignFlyInCntBase( Y() + long( nTmpAscent ) );
m_pCurr->CalcLine( *this, GetInfo() );
@@ -1751,7 +1751,7 @@ void SwTextFormatter::RecalcRealHeight()
void SwTextFormatter::CalcRealHeight( bool bNewLine )
{
- sal_uInt16 nLineHeight = m_pCurr->Height();
+ sal_uInt32 nLineHeight = m_pCurr->Height();
m_pCurr->SetClipping( false );
SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
@@ -2075,8 +2075,8 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
- const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
- sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
+ const sal_uInt32 nTmpHeight = pCurrent->GetRealHeight();
+ sal_uInt32 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
AsCharFlags nFlags = AsCharFlags::UlSpace;
if( GetMulti() )
{
@@ -2341,7 +2341,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
nAscent = pLast->GetAscent();
nHeight = pLast->Height();
- if ( m_pCurr->GetRealHeight() > nHeight )
+ if ( static_cast<SwTwips>(m_pCurr->GetRealHeight()) > nHeight )
nTop += m_pCurr->GetRealHeight() - nHeight;
else
// Important for fixed space between lines
@@ -2472,7 +2472,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
if( nH < SAL_MAX_UINT16 )
pFly->Height( sal_uInt16( nH ) );
}
- if( nAscent < pFly->Height() )
+ if( nAscent < static_cast<SwTwips>(pFly->Height()) )
pFly->SetAscent( sal_uInt16(nAscent) );
else
pFly->SetAscent( pFly->Height() );
@@ -2488,7 +2488,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
else
{
pFly->Height( sal_uInt16(aInter.Height()) );
- if( nAscent < pFly->Height() )
+ if( nAscent < static_cast<SwTwips>(pFly->Height()) )
pFly->SetAscent( sal_uInt16(nAscent) );
else
pFly->SetAscent( pFly->Height() );
@@ -2564,7 +2564,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
// we use this one when calculating the base, or the frame would be positioned
// too much to the top, sliding down after all causing a repaint in an area
// he actually never was in.
- sal_uInt16 nAscent = 0;
+ sal_uInt32 nAscent = 0;
const bool bTextFrameVertical = GetInfo().GetTextFrame()->IsVertical();
@@ -2574,9 +2574,9 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
pFly->GetRefPoint().Y() );
if ( bUseFlyAscent )
- nAscent = static_cast<sal_uInt16>( std::abs( int( bTextFrameVertical ?
+ nAscent = std::abs( int( bTextFrameVertical ?
pFly->GetRelPos().X() :
- pFly->GetRelPos().Y() ) ) );
+ pFly->GetRelPos().Y() ) );
// Check if be prefer to use the ascent of the last portion:
if ( IsQuick() ||
@@ -2585,7 +2585,7 @@ SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
{
nAscent = rInf.GetLast()->GetAscent();
}
- else if( nAscent > nFlyAsc )
+ else if( static_cast<SwTwips>(nAscent) > nFlyAsc )
nFlyAsc = nAscent;
Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent );
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 28eb142d63af..055aedac2da6 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -83,14 +83,14 @@ SwLinePortion *SwTextPainter::CalcPaintOfst( const SwRect &rPaint )
{
SwLinePortion *pLast = nullptr;
// 7529 and 4757: not <= nPaintOfst
- while( pPor && GetInfo().X() + pPor->Width() + (pPor->Height()/2)
+ while( pPor && static_cast<SwTwips>(GetInfo().X() + pPor->Width() + (pPor->Height()/2))
< nPaintOfst )
{
if( pPor->InSpaceGrp() && GetInfo().GetSpaceAdd() )
{
long nTmp = GetInfo().X() +pPor->Width() +
pPor->CalcSpacing( GetInfo().GetSpaceAdd(), GetInfo() );
- if( nTmp + (pPor->Height()/2) >= nPaintOfst )
+ if( static_cast<SwTwips>(nTmp + (pPor->Height()/2)) >= nPaintOfst )
break;
GetInfo().X( nTmp );
GetInfo().SetIdx( GetInfo().GetIdx() + pPor->GetLen() );
@@ -178,7 +178,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
&& GetDropLines() >= GetLineNr();
}
- sal_uInt16 nTmpHeight, nTmpAscent;
+ sal_uInt32 nTmpHeight, nTmpAscent;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
// bClip decides if there's a need to clip
@@ -192,7 +192,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
if( GetInfo().GetPos().X() < rPaint.Left() ||
GetInfo().GetPos().Y() < rPaint.Top() ||
- GetInfo().GetPos().Y() + nTmpHeight > rPaint.Top() + rPaint.Height() )
+ GetInfo().GetPos().Y() + static_cast<SwTwips>(nTmpHeight) > rPaint.Top() + rPaint.Height() )
{
bClip = false;
rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() );
@@ -339,7 +339,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
// A safety distance of half the height is added, so that
// TTF-"f" isn't overlapping into the page margin.
if( bClip &&
- GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 ) > nMaxRight )
+ static_cast<SwTwips>(GetInfo().X() + pPor->Width() + ( pPor->Height() / 2 )) > nMaxRight )
{
bClip = false;
rClip.ChgClip( rPaint, m_pFrame, m_pCurr->HasUnderscore() );
@@ -459,7 +459,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip,
SwTwips nDiff = GetInfo().Y() + nTmpHeight - nTmpAscent - GetTextFrame()->getFrameArea().Bottom();
if( ( nDiff > 0 &&
(GetEnd() < TextFrameIndex(GetInfo().GetText().getLength()) ||
- ( nDiff > nTmpHeight/2 && GetPrevLine() ) ) ) ||
+ ( nDiff > static_cast<SwTwips>(nTmpHeight)/2 && GetPrevLine() ) ) ) ||
(nDiff >= 0 && bNextUndersized) )
{
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index b285307a8449..ce733517f83c 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -60,7 +60,7 @@ void SwTextIter::Init()
m_nLineNr = 1;
}
-void SwTextIter::CalcAscentAndHeight( sal_uInt16 &rAscent, sal_uInt16 &rHeight ) const
+void SwTextIter::CalcAscentAndHeight( sal_uInt32 &rAscent, sal_uInt32 &rHeight ) const
{
rHeight = GetLineHeight();
rAscent = m_pCurr->GetAscent() + rHeight - m_pCurr->Height();
@@ -209,9 +209,9 @@ const SwLineLayout *SwTextCursor::CharCursorToLine(TextFrameIndex const nPositio
return bPrevious ? PrevLine() : m_pCurr;
}
-sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
+sal_uInt32 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
const SwLinePortion* pPor,
- sal_uInt16 nPorHeight, sal_uInt16 nPorAscent,
+ sal_uInt32 nPorHeight, sal_uInt32 nPorAscent,
const bool bAutoToCentered ) const
{
if ( pPor )
@@ -220,7 +220,7 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
nPorAscent = pPor->GetAscent();
}
- sal_uInt16 nOfst = rLine.GetRealHeight() - rLine.Height();
+ sal_uInt32 nOfst = rLine.GetRealHeight() - rLine.Height();
SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
@@ -297,7 +297,7 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
void SwTextIter::TwipsToLine( const SwTwips y)
{
- while( m_nY + GetLineHeight() <= y && Next() )
+ while( m_nY + static_cast<SwTwips>(GetLineHeight()) <= y && Next() )
;
while( m_nY > y && Prev() )
;
diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx
index 81e67503d3fb..b7522b10b370 100644
--- a/sw/source/core/text/itrtxt.hxx
+++ b/sw/source/core/text/itrtxt.hxx
@@ -113,8 +113,8 @@ public:
// Truncates all after pCurr
void TruncLines( bool bNoteFollow = false );
- sal_uInt16 GetLineHeight() const { return m_pCurr->GetRealHeight(); }
- void CalcAscentAndHeight( sal_uInt16 &rAscent, sal_uInt16 &rHeight ) const;
+ sal_uInt32 GetLineHeight() const { return m_pCurr->GetRealHeight(); }
+ void CalcAscentAndHeight( sal_uInt32 &rAscent, sal_uInt32 &rHeight ) const;
// Lots of trouble for querying pCurr == pPara
bool IsFirstTextLine() const
@@ -287,8 +287,8 @@ public:
// calculates baseline for portion rPor
// bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE
- sal_uInt16 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
- sal_uInt16 nPorHeight = 0, sal_uInt16 nAscent = 0,
+ sal_uInt32 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
+ sal_uInt32 nPorHeight = 0, sal_uInt32 nAscent = 0,
const bool bAutoToCentered = false ) const;
static void SetRightMargin( const bool bNew ){ bRightMargin = bNew; }
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
old mode 100644
new mode 100755
index fb414dc8772e..f3616306f7cd
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -591,10 +591,10 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf )
// Height has to be changed
if ( rInf.IsMulti() )
{
- if ( Height() < nDiff )
+ if ( static_cast<SwTwips>(Height()) < nDiff )
Height( sal_uInt16( nDiff ) );
}
- else if( Width() < nDiff )
+ else if( static_cast<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
}
return bFull;
@@ -865,7 +865,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
SetHide( true );
}
- if( Width() < nDiff )
+ if( static_cast<SwTwips>(Width()) < nDiff )
Width( sal_uInt16(nDiff) );
return bFull;
}
@@ -1250,7 +1250,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
Height( Height() + nMainAscent - GetAscent() );
SetAscent( nMainAscent );
}
- if( Height() < nMainAscent + nMainDescent )
+ if( static_cast<SwTwips>(Height()) < nMainAscent + nMainDescent )
Height( nMainAscent + nMainDescent );
// We calculate the x positions of the characters in both lines...
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index d785a9f3c74d..36cc0a68ef74 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -385,7 +385,7 @@ void SwFlyCntPortion::SetBase( const SwTextFrame& rFrame, const Point &rBase,
SwTwips nRelPos = aObjPositioning.GetRelPosY();
if ( nRelPos < 0 )
{
- nAscent = static_cast<sal_uInt16>(-nRelPos);
+ nAscent = -nRelPos;
if( nAscent > Height() )
Height( nAscent );
}
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 499dac050009..7a01618fc646 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -358,7 +358,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
}
else
{
- const sal_uInt16 nLineHeight = Height();
+ const sal_uInt32 nLineHeight = Height();
Init( GetNextPortion() );
SwLinePortion *pPos = mpNextPortion;
SwLinePortion *pLast = this;
@@ -421,8 +421,8 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
// We had an attribute change: Sum up/build maxima of length and mass
- sal_uInt16 nPosHeight = pPos->Height();
- sal_uInt16 nPosAscent = pPos->GetAscent();
+ sal_uInt32 nPosHeight = pPos->Height();
+ sal_uInt32 nPosAscent = pPos->GetAscent();
SAL_WARN_IF( nPosHeight < nPosAscent,
"sw.core", "SwLineLayout::CalcLine: bad ascent or height" );
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index ea82202470c1..13fcda69ac79 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -81,7 +81,7 @@ private:
SwLineLayout *m_pNext; // The next Line
std::unique_ptr<std::vector<long>> m_pLLSpaceAdd; // Used for justified alignment
std::unique_ptr<std::deque<sal_uInt16>> m_pKanaComp; // Used for Kana compression
- sal_uInt16 m_nRealHeight; // The height resulting from line spacing and register
+ sal_uInt32 m_nRealHeight; // The height resulting from line spacing and register
bool m_bFormatAdj : 1;
bool m_bDummy : 1;
bool m_bEndHyph : 1;
@@ -149,8 +149,8 @@ public:
// Collects the data for the line
void CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf );
- void SetRealHeight( sal_uInt16 nNew ) { m_nRealHeight = nNew; }
- sal_uInt16 GetRealHeight() const { return m_nRealHeight; }
+ void SetRealHeight( sal_uInt32 nNew ) { m_nRealHeight = nNew; }
+ sal_uInt32 GetRealHeight() const { return m_nRealHeight; }
// Creates the glue chain for short lines
SwMarginPortion *CalcLeftMargin();
diff --git a/sw/source/core/text/porlin.hxx b/sw/source/core/text/porlin.hxx
index 615c90022d23..910b0c17c888 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -54,7 +54,7 @@ protected:
SwLinePortion *mpNextPortion;
// Count of chars and spaces on the line
TextFrameIndex nLineLength;
- sal_uInt16 nAscent; // Maximum ascender
+ sal_uInt32 nAscent; // Maximum ascender
SwLinePortion();
private:
@@ -74,9 +74,9 @@ public:
TextFrameIndex GetLen() const { return nLineLength; }
void SetLen(TextFrameIndex const nLen) { nLineLength = nLen; }
void SetNextPortion( SwLinePortion *pNew ){ mpNextPortion = pNew; }
- sal_uInt16 &GetAscent() { return nAscent; }
- sal_uInt16 GetAscent() const { return nAscent; }
- void SetAscent( const sal_uInt16 nNewAsc ) { nAscent = nNewAsc; }
+ sal_uInt32 &GetAscent() { return nAscent; }
+ sal_uInt32 GetAscent() const { return nAscent; }
+ void SetAscent( const sal_uInt32 nNewAsc ) { nAscent = nNewAsc; }
void PrtWidth( sal_uInt16 nNewWidth ) { Width( nNewWidth ); }
sal_uInt16 PrtWidth() const { return Width(); }
void AddPrtWidth( const sal_uInt16 nNew ) { Width( Width() + nNew ); }
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 2154eba1df73..88913b6fbe2a 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -399,7 +399,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
pBracket->nAscent = rInf.GetAscent();
pBracket->nHeight = aSize.Height();
pTmpFnt->SetActual( nActualScr );
- if( nMaxWidth > aSize.Width() )
+ if( nMaxWidth > static_cast<SwTwips>(aSize.Width()) )
{
pBracket->nPreWidth = aSize.Width();
nMaxWidth -= aSize.Width();
@@ -428,7 +428,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
}
if( aSize.Height() > pBracket->nHeight )
pBracket->nHeight = aSize.Height();
- if( nMaxWidth > aSize.Width() )
+ if( nMaxWidth > static_cast<SwTwips>(aSize.Width()) )
{
pBracket->nPostWidth = aSize.Width();
nMaxWidth -= aSize.Width();
@@ -1680,7 +1680,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
}
else if ( rMulti.IsRuby() && rMulti.OnRight() && GetInfo().IsRuby() )
{
- SwTwips nLineDiff = std::max(( rMulti.GetRoot().Height() - pPor->Width() ) / 2, 0 );
+ SwTwips nLineDiff = std::max(( rMulti.GetRoot().Height() - pPor->Width() ) / 2, static_cast<sal_uInt32>(0) );
GetInfo().Y( nOfst + nLineDiff );
// Draw the ruby text on top of the preserved space.
GetInfo().X( GetInfo().X() - pPor->Height() );
@@ -2169,7 +2169,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
// Setting this to the portion width ( = rMulti.Width() )
// can make GetTextBreak inside SwTextGuess::Guess return too small
// values. Therefore we add some extra twips.
- if( nActWidth > nTmpX + rMulti.Width() + 6 )
+ if( nActWidth > nTmpX + static_cast<SwTwips>(rMulti.Width()) + 6 )
nActWidth = nTmpX + rMulti.Width() + 6;
nMaxWidth = nActWidth;
nActWidth = ( 3 * nMaxWidth + nMinWidth + 3 ) / 4;
@@ -2520,7 +2520,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
{
pCursor->m_nStart = nCurrStart;
pCursor->m_pCurr = &pMulti->GetRoot();
- while( pCursor->Y() + pCursor->GetLineHeight() < nY &&
+ while( pCursor->Y() + static_cast<SwTwips>(pCursor->GetLineHeight()) < nY &&
pCursor->Next() )
; // nothing
nWidth = pCursor->m_pCurr->Width();
diff --git a/sw/source/core/text/possiz.hxx b/sw/source/core/text/possiz.hxx
index eaad3597f460..7bab8436bd46 100644
--- a/sw/source/core/text/possiz.hxx
+++ b/sw/source/core/text/possiz.hxx
@@ -25,41 +25,41 @@
// Compared to the SV sizes SwPosSize is always positive
class SwPosSize
{
- sal_uInt16 nWidth;
- sal_uInt16 nHeight;
+ sal_uInt32 nWidth;
+ sal_uInt32 nHeight;
public:
- SwPosSize( const sal_uInt16 nW = 0, const sal_uInt16 nH = 0 )
+ SwPosSize( const sal_uInt32 nW = 0, const sal_uInt32 nH = 0 )
: nWidth(nW)
, nHeight(nH)
{
}
explicit SwPosSize( const Size &rSize )
- : nWidth(sal_uInt16(rSize.Width()))
- ,nHeight(sal_uInt16(rSize.Height()))
+ : nWidth(sal_uInt32(rSize.Width()))
+ ,nHeight(sal_uInt32(rSize.Height()))
{
}
#if defined(__COVERITY__)
~SwPosSize() COVERITY_NOEXCEPT_FALSE {}
#endif
- sal_uInt16 Height() const { return nHeight; }
- void Height( const sal_uInt16 nNew ) { nHeight = nNew; }
- sal_uInt16 Width() const { return nWidth; }
- void Width( const sal_uInt16 nNew ) { nWidth = nNew; }
+ sal_uInt32 Height() const { return nHeight; }
+ void Height( const sal_uInt32 nNew ) { nHeight = nNew; }
+ sal_uInt32 Width() const { return nWidth; }
+ void Width( const sal_uInt32 nNew ) { nWidth = nNew; }
Size SvLSize() const { return Size( nWidth, nHeight ); }
void SvLSize( const Size &rSize )
{
- nWidth = sal_uInt16(rSize.Width());
- nHeight = sal_uInt16(rSize.Height());
+ nWidth = sal_uInt32(rSize.Width());
+ nHeight = sal_uInt32(rSize.Height());
}
void SvXSize( const Size &rSize )
{
- nHeight = sal_uInt16(rSize.Width());
- nWidth = sal_uInt16(rSize.Height());
+ nHeight = sal_uInt32(rSize.Width());
+ nWidth = sal_uInt32(rSize.Height());
}
SwPosSize& operator=( const Size &rSize )
{
- nWidth = sal_uInt16(rSize.Width());
- nHeight = sal_uInt16(rSize.Height());
+ nWidth = sal_uInt32(rSize.Width());
+ nHeight = sal_uInt32(rSize.Height());
return *this;
}
};
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index b1a3bb1214af..a2c93680d181 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -484,8 +484,8 @@ void SwTextFormatter::CalcDropHeight( const sal_uInt16 nLines )
{
const SwLinePortion *const pOldCurr = GetCurr();
sal_uInt16 nDropHght = 0;
- sal_uInt16 nAscent = 0;
- sal_uInt16 nHeight = 0;
+ sal_uInt32 nAscent = 0;
+ sal_uInt32 nHeight = 0;
sal_uInt16 nDropLns = 0;
const bool bRegisterOld = IsRegisterOn();
m_bRegisterOn = false;
@@ -545,8 +545,8 @@ void SwTextFormatter::CalcDropHeight( const sal_uInt16 nLines )
void SwTextFormatter::GuessDropHeight( const sal_uInt16 nLines )
{
OSL_ENSURE( nLines, "GuessDropHeight: Give me more Lines!" );
- sal_uInt16 nAscent = 0;
- sal_uInt16 nHeight = 0;
+ sal_uInt32 nAscent = 0;
+ sal_uInt32 nHeight = 0;
SetDropLines( nLines );
if ( GetDropLines() > 1 )
{
@@ -678,7 +678,7 @@ void SwTextPainter::PaintDropPortion()
Point aLineOrigin( GetTopLeft() );
aLineOrigin.AdjustX(nX );
- sal_uInt16 nTmpAscent, nTmpHeight;
+ sal_uInt32 nTmpAscent, nTmpHeight;
CalcAscentAndHeight( nTmpAscent, nTmpHeight );
aLineOrigin.AdjustY(nTmpAscent );
GetInfo().SetIdx( GetStart() );
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6445b593e5f8..a506e17526b8 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -3311,7 +3311,7 @@ bool SwTextFrame::WouldFit( SwTwips &rMaxHeight, bool &bSplit, bool bTst )
return bRet;
}
-sal_uInt16 SwTextFrame::GetParHeight() const
+sal_uInt32 SwTextFrame::GetParHeight() const
{
OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
"SwTextFrame::GetParHeight with swapped frame" );
@@ -3332,7 +3332,7 @@ sal_uInt16 SwTextFrame::GetParHeight() const
// TODO: Refactor and improve code
const SwLineLayout* pLineLayout = GetPara();
- sal_uInt16 nHeight = pLineLayout ? pLineLayout->GetRealHeight() : 0;
+ sal_uInt32 nHeight = pLineLayout ? pLineLayout->GetRealHeight() : 0;
// Is this paragraph scrolled? Our height until now is at least
// one line height too low then
More information about the Libreoffice-commits
mailing list