summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2021-10-04 19:23:51 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2021-10-06 01:22:29 +0200
commit02111da55639dc6a15f7ad1c2bfde1c9d8700880 (patch)
tree3b72dcd78febc40bfa6dd23c6075cb0a5c17e492
parent816e01bf67067ebe32dbc730bef386fdc54b8a66 (diff)
Revert "sw: allow the width of a line portion to be larger...
...than 65536 twips" The originating 301278b656e76b6f42af5cf8a6f5c6c02acfffeb will be reverted in libreoffice-7-2. This reverts commit 6fdd0a3f8b3448a9a246496191908c92156cc38b. Change-Id: Ia4f231af90d17eeaa0db4272c8a80e48181647dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122945 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sw/qa/core/text/data/line-width.fodt32
-rw-r--r--sw/qa/core/text/text.cxx19
-rw-r--r--sw/source/core/edit/edattr.cxx4
-rw-r--r--sw/source/core/text/itrcrsr.cxx12
-rw-r--r--sw/source/core/text/porglue.cxx2
-rw-r--r--sw/source/core/text/porlin.cxx2
-rw-r--r--sw/source/core/text/porlin.hxx4
-rw-r--r--sw/source/core/text/pormulti.cxx2
-rw-r--r--sw/source/core/text/pormulti.hxx2
9 files changed, 14 insertions, 65 deletions
diff --git a/sw/qa/core/text/data/line-width.fodt b/sw/qa/core/text/data/line-width.fodt
deleted file mode 100644
index a6b2b2f5c62b..000000000000
--- a/sw/qa/core/text/data/line-width.fodt
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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 be6406f6b654..d38b6a3e62cc 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -151,25 +151,6 @@ 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 = createSwDoc(DATA_DIRECTORY, "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 6ab5a3ae9ad8..4992cc965715 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -531,10 +531,10 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
SwFrame* pFrame = pCNd->getLayoutFrame( GetLayout() );
if ( pFrame )
{
- const sal_uInt32 nFrameWidth = o3tl::narrowing<sal_uInt32>( pFrame->IsVertical() ?
+ const sal_uInt16 nFrameWidth = o3tl::narrowing<sal_uInt16>( pFrame->IsVertical() ?
pFrame->getFrameArea().Height() :
pFrame->getFrameArea().Width() );
- bRet = o3tl::narrowing<SwTwips>(nFrameWidth) > ( nNext + MM50 );
+ bRet = nFrameWidth > ( nNext + MM50 );
}
else
bRet = false;
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 2974826154bb..138359e68c41 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1266,7 +1266,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_uInt32 nWidth30, sal_uInt16 nX)
+static bool ConsiderNextPortionForCursorOffset(const SwLinePortion* pPor, sal_uInt16 nWidth30, sal_uInt16 nX)
{
if (!pPor->GetNextPortion() || pPor->IsBreakPortion())
{
@@ -1323,7 +1323,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
// Until here everything in document coordinates.
x -= nLeftMargin;
- sal_uInt32 nX = sal_uInt16( x );
+ sal_uInt16 nX = sal_uInt16( x );
// If there are attribute changes in the line, search for the paragraph,
// in which nX is situated.
@@ -1342,7 +1342,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_uInt32 nWidth = pPor->Width();
+ sal_uInt16 nWidth = pPor->Width();
if ( m_pCurr->IsSpaceAdd() || pKanaComp )
{
if ( pPor->InSpaceGrp() && nSpaceAdd )
@@ -1372,7 +1372,7 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
}
- sal_uInt32 nWidth30;
+ sal_uInt16 nWidth30;
if ( pPor->IsPostItsPortion() )
nWidth30 = 0;
else
@@ -1691,12 +1691,12 @@ TextFrameIndex SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
}
pCurrPart = pCurrPart->GetFollow();
}
- nX = std::max(o3tl::narrowing<sal_uInt32>(0), nX - nSumBorderWidth);
+ nX = std::max(0, nX - nSumBorderWidth);
}
// Shift the offset with the left border width
else if( GetInfo().GetFont()->GetLeftBorder() && !pPor->GetJoinBorderWithPrev() )
{
- nX = std::max(o3tl::narrowing<sal_uInt32>(0), nX - GetInfo().GetFont()->GetLeftBorderSpace());
+ nX = std::max(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 4ccfbbb62172..7c09ded23a2f 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 || o3tl::narrowing<SwTwips>(pPrev->PrtWidth()) >= nRightGlue ||
+ if( bNoMove || 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 c5dc41ff3db5..e0a157d9d579 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 ? -o3tl::narrowing<SwTwips>(PrtWidth()) : o3tl::narrowing<SwTwips>(PrtWidth()) ) );
+ rInf.Y( rInf.Y() + ( bB2T ? -PrtWidth() : 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 3dc7ff9e287d..bca2025a2c6b 100644
--- a/sw/source/core/text/porlin.hxx
+++ b/sw/source/core/text/porlin.hxx
@@ -77,8 +77,8 @@ public:
sal_uInt32 GetAscent() const { return mnAscent; }
void SetAscent( const sal_uInt32 nNewAsc ) { mnAscent = nNewAsc; }
void PrtWidth( sal_uInt16 nNewWidth ) { Width( nNewWidth ); }
- sal_uInt32 PrtWidth() const { return Width(); }
- void AddPrtWidth( const sal_uInt32 nNew ) { Width( Width() + nNew ); }
+ sal_uInt16 PrtWidth() const { return Width(); }
+ void AddPrtWidth( const sal_uInt16 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 b94302bd8ed7..55cb637e34ea 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_uInt32& nX,
+ sal_uInt16& nX,
TextFrameIndex const nCurrStart,
tools::Long nSpaceAdd )
: pTextCursor(pCursor),
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index c1df8b0400f2..8cd9e78f928f 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -241,7 +241,7 @@ class SwTextCursorSave
bool bSpaceChg;
public:
SwTextCursorSave( SwTextCursor* pTextCursor, SwMultiPortion* pMulti,
- SwTwips nY, sal_uInt32& nX, TextFrameIndex nCurrStart, tools::Long nSpaceAdd);
+ SwTwips nY, sal_uInt16& nX, TextFrameIndex nCurrStart, tools::Long nSpaceAdd);
~SwTextCursorSave();
};