diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-04-02 08:54:59 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-04-03 09:43:56 +0200 |
commit | b9955b2083ffdc1f99bc8be6b09d806fa3279a16 (patch) | |
tree | 8deabb3c56c55833392d8454feac519740caaafd /sw/source | |
parent | 14198f2191f216592f00b72221771704b3ce4636 (diff) |
tdf#93173: Remove arbitrary line spacing limit
OASIS Open Document Format for Office Applications (OpenDocument) v.1.2
doesn't limit the value of fo:line-height. But we have arbitrary limits
in proportional mode for both minimal (50%) and maximal (200%) values.
The implementation uses sal_uInt16 to store the value, so fix places
where sal_uInt8 was unreasonably used to set it, change the upper limit
to max sal_uInt16 value, and set lower limit to 6% (to match Word's
minimal factor of 0.06).
Change-Id: I4c2ac5f0acf65d7573328e71bcf36ac9abb5ffd5
Reviewed-on: https://gerrit.libreoffice.org/52252
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/DocumentStylePoolManager.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/html/svxcss1.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/shells/txtattr.cxx | 2 |
4 files changed, 7 insertions, 10 deletions
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx index 5e9eb561de21..c94d940b3716 100644 --- a/sw/source/core/doc/DocumentStylePoolManager.cxx +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -677,7 +677,7 @@ SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId, { SvxLineSpacingItem aLSpc( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING ); SvxULSpaceItem aUL( 0, PT_7, RES_UL_SPACE ); - aLSpc.SetPropLineSpace( sal_uInt8(115) ); + aLSpc.SetPropLineSpace( 115 ); if( m_rDoc.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE) ) aUL.SetLower( HTML_PARSPACE ); aSet.Put( aUL ); aSet.Put( aLSpc ); diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 78ec9ef1342c..a46aba97c2cc 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -1612,7 +1612,7 @@ static void ParseCSS1_line_height( const CSS1Expression *pExpr, OSL_ENSURE( pExpr, "no expression" ); sal_uInt16 nHeight = 0; - sal_uInt8 nPropHeight = 0; + sal_uInt16 nPropHeight = 0; switch( pExpr->GetType() ) { @@ -1633,14 +1633,12 @@ static void ParseCSS1_line_height( const CSS1Expression *pExpr, break; case CSS1_PERCENTAGE: { - sal_uInt16 nPHeight = static_cast<sal_uInt16>(pExpr->GetNumber()); - nPropHeight = nPHeight <= 200 ? static_cast<sal_uInt8>(nPHeight) : 200; + nPropHeight = static_cast<sal_uInt16>(pExpr->GetNumber()); } break; case CSS1_NUMBER: { - sal_uInt16 nPHeight = static_cast<sal_uInt16>(pExpr->GetNumber() * 100); - nPropHeight = nPHeight <= 200 ? static_cast<sal_uInt8>(nPHeight) : 200; + nPropHeight = static_cast<sal_uInt16>(pExpr->GetNumber() * 100); } break; default: diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 2f6e45f1d373..353e0226dad5 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4224,9 +4224,8 @@ void SwWW8ImplReader::Read_LineSpace( sal_uInt16, const sal_uInt8* pData, short { long n = nSpace * 10 / 24; // WW: 240 = 100%, SW: 100 = 100% - // as discussed with AMA, the limit is nonsensical - if( n>200 ) n = 200; // SW_UI maximum - aLSpc.SetPropLineSpace( static_cast<sal_uInt8>(n) ); + if( n>SAL_MAX_UINT16 ) n = SAL_MAX_UINT16; + aLSpc.SetPropLineSpace( static_cast<sal_uInt16>(n) ); const SvxFontHeightItem* pH = static_cast<const SvxFontHeightItem*>( GetFormatAttr( RES_CHRATR_FONTSIZE )); nSpaceTw = static_cast<sal_uInt16>( n * pH->GetHeight() / 100 ); diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index ff92c7266691..64ed0aa509de 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -304,7 +304,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq) void SwTextShell::ExecParaAttr(SfxRequest &rReq) { SvxAdjust eAdjst; - sal_uInt8 ePropL; + sal_uInt16 ePropL; const SfxItemSet* pArgs = rReq.GetArgs(); // Get both attributes immediately isn't more expensive!! |