diff options
-rw-r--r-- | cui/source/tabpages/paragrph.cxx | 2 | ||||
-rw-r--r-- | cui/uiconfig/ui/paraindentspacing.ui | 4 | ||||
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 92 | ||||
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 5 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 8 | ||||
-rw-r--r-- | forms/source/richtext/rtattributehandler.cxx | 2 | ||||
-rw-r--r-- | include/editeng/lspcitem.hxx | 2 | ||||
-rw-r--r-- | svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx | 2 | ||||
-rw-r--r-- | svx/uiconfig/ui/paralinespacingcontrol.ui | 4 | ||||
-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 |
13 files changed, 59 insertions, 79 deletions
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index 61cdb6603321..8d00045bcebd 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -124,7 +124,7 @@ void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace, case LLINESPACE_PROP: rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto ); - rLineSpace.SetPropLineSpace( static_cast<sal_uInt8>(lValue) ); + rLineSpace.SetPropLineSpace( static_cast<sal_uInt16>(lValue) ); break; case LLINESPACE_MIN: diff --git a/cui/uiconfig/ui/paraindentspacing.ui b/cui/uiconfig/ui/paraindentspacing.ui index fa98c493d871..7bb095e945f0 100644 --- a/cui/uiconfig/ui/paraindentspacing.ui +++ b/cui/uiconfig/ui/paraindentspacing.ui @@ -14,8 +14,8 @@ <property name="page_increment">10</property> </object> <object class="GtkAdjustment" id="adjustmentLINEDISTPERCENT"> - <property name="lower">50</property> - <property name="upper">200</property> + <property name="lower">6</property> + <property name="upper">65535</property> <property name="value">100</property> <property name="step_increment">1</property> <property name="page_increment">10</property> diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 5346dae6a0aa..cb9b49cc7275 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -171,63 +171,55 @@ void Test::testLineSpacing() CPPUNIT_ASSERT_EQUAL(sal_uLong(aTextLen), rDoc.GetTextLen()); CPPUNIT_ASSERT_EQUAL(aText, rDoc.GetParaAsString(sal_Int32(0))); - // Get ItemSet for line spacing - 60% - std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(aEditEngine.GetEmptyItemSet())); - SvxLineSpacingItem aLineSpacing(LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL); - aLineSpacing.SetPropLineSpace(60); - pSet->Put(aLineSpacing); - - // Set font - SvxFontItem aFont(EE_CHAR_FONTINFO); - aFont.SetFamilyName("Liberation Sans"); - pSet->Put(aFont); - SvxFontHeightItem aFontSize(240, 100, EE_CHAR_FONTHEIGHT); - pSet->Put(aFontSize); - - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(3), pSet->Count()); - - // Select all paragraphs and set spacing + // Select all paragraphs ESelection aSelection(0, 0, 0, aTextLen); - aEditEngine.QuickSetAttribs(*pSet, aSelection); + + auto doTest = [&](sal_uInt16 nSpace, sal_uInt16 nExpMaxAscent, sal_uInt32 nExpLineHeight) + { + std::unique_ptr<SfxItemSet> pSet(new SfxItemSet(aEditEngine.GetEmptyItemSet())); + SvxLineSpacingItem aLineSpacing(LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL); + aLineSpacing.SetPropLineSpace(nSpace); + pSet->Put(aLineSpacing); + + // Set font + SvxFontItem aFont(EE_CHAR_FONTINFO); + aFont.SetFamilyName("Liberation Sans"); + pSet->Put(aFont); + SvxFontHeightItem aFontSize(240, 100, EE_CHAR_FONTHEIGHT); + pSet->Put(aFontSize); + + CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(3), pSet->Count()); + + aEditEngine.QuickSetAttribs(*pSet, aSelection); + + // Assert changes + ParaPortion* pParaPortion = aEditEngine.GetParaPortions()[0]; + ContentNode* const pNode = pParaPortion->GetNode(); + const SvxLineSpacingItem& rLSItem = pNode->GetContentAttribs().GetItem(EE_PARA_SBL); + CPPUNIT_ASSERT_EQUAL(SvxInterLineSpaceRule::Prop, rLSItem.GetInterLineSpaceRule()); + CPPUNIT_ASSERT_EQUAL(nSpace, rLSItem.GetPropLineSpace()); + + // Check the first line + ParagraphInfos aInfo = aEditEngine.GetParagraphInfos(0); + CPPUNIT_ASSERT_EQUAL(nExpMaxAscent, aInfo.nFirstLineMaxAscent); + CPPUNIT_ASSERT_EQUAL(nExpLineHeight, aEditEngine.GetLineHeight(0)); + }; + + // Test first case - 60% + doTest(60, 122, 153); // Force multiple lines aEditEngine.SetPaperSize(Size(1000, 6000)); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), aEditEngine.GetLineCount(0)); - // Assert changes - ParaPortion* pParaPortion = aEditEngine.GetParaPortions()[0]; - ContentNode* const pNode = pParaPortion->GetNode(); - const SvxLineSpacingItem& rLSItem = pNode->GetContentAttribs().GetItem(EE_PARA_SBL); - CPPUNIT_ASSERT_EQUAL(SvxInterLineSpaceRule::Prop, rLSItem.GetInterLineSpaceRule()); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(60), rLSItem.GetPropLineSpace()); - - // Check the first line - ParagraphInfos aInfo = aEditEngine.GetParagraphInfos(0); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(122), aInfo.nFirstLineMaxAscent); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(153), static_cast<sal_uInt16>(aEditEngine.GetLineHeight(0))); - - // Prepare second case - 150% - std::unique_ptr<SfxItemSet> pSet2(new SfxItemSet(aEditEngine.GetEmptyItemSet())); - SvxLineSpacingItem aLineSpacing2(LINE_SPACE_DEFAULT_HEIGHT, EE_PARA_SBL); - aLineSpacing2.SetPropLineSpace(150); - pSet2->Put(aLineSpacing2); - pSet2->Put(aFont); - pSet2->Put(aFontSize); - - CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(3), pSet2->Count()); - - // Select all paragraphs and set spacing - aEditEngine.QuickSetAttribs(*pSet2, aSelection); + // Test second case - 150% + doTest(150, 337, 382); - // Assert changes - const SvxLineSpacingItem& rLSItem2 = pNode->GetContentAttribs().GetItem(EE_PARA_SBL); - CPPUNIT_ASSERT_EQUAL(SvxInterLineSpaceRule::Prop, rLSItem2.GetInterLineSpaceRule()); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(150), rLSItem2.GetPropLineSpace()); - - // Check the first line - ParagraphInfos aInfo2 = aEditEngine.GetParagraphInfos(0); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(337), aInfo2.nFirstLineMaxAscent); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(382), static_cast<sal_uInt16>(aEditEngine.GetLineHeight(0))); + // Test lower Word limit - 6% (factor 0.06) + doTest(6, 12, 15); + + // Test upper Word limit - 13200% (factor 132) + doTest(13200, 33615, 33660); } void Test::testConstruction() diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 0c81088e140e..449877044175 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -428,10 +428,7 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) nTokenValue = short( 100L * aLSpace.GetLineHeight() / nTokenValue ); - if( nTokenValue > 200 ) // Data value for PropLnSp - nTokenValue = 200; // is one BYTE !!! - - aLSpace.SetPropLineSpace( static_cast<sal_uInt8>(nTokenValue) ); + aLSpace.SetPropLineSpace( static_cast<sal_uInt16>(nTokenValue) ); aLSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto ); pSet->Put( aLSpace ); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index ee33fe0192df..fb548d0dda6a 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -6263,12 +6263,6 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& if ( bIsHardAttribute ) { - if ( pPortion && ( nVal2 > 200 ) ) - { - sal_uInt32 nFontHeight; - pPortion->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance ); - nVal2 = -static_cast<sal_Int16>( ( nFontHeight * nVal * 8 ) / 100 ); - } SdrTextFixedCellHeightItem aHeightItem(true); aHeightItem.SetWhich(SDRATTR_TEXT_USEFIXEDCELLHEIGHT); rSet.Put( aHeightItem ); @@ -6279,7 +6273,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& aItem.SetInterLineSpaceRule(SvxInterLineSpaceRule::Off); } else { - sal_uInt8 nPropLineSpace = static_cast<sal_uInt8>(nVal2); + sal_uInt16 nPropLineSpace = static_cast<sal_uInt16>(nVal2); aItem.SetPropLineSpace( nPropLineSpace ); aItem.SetLineSpaceRule( SvxLineSpaceRule::Auto ); } diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx index 8d0737b7852c..c78e3524bb04 100644 --- a/forms/source/richtext/rtattributehandler.cxx +++ b/forms/source/richtext/rtattributehandler.cxx @@ -229,7 +229,7 @@ namespace frm if ( 100 == m_nLineSpace ) aLineSpacing.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off ); else - aLineSpacing.SetPropLineSpace( static_cast<sal_uInt8>(m_nLineSpace) ); + aLineSpacing.SetPropLineSpace( m_nLineSpace ); _rNewAttribs.Put( aLineSpacing ); } diff --git a/include/editeng/lspcitem.hxx b/include/editeng/lspcitem.hxx index a12af58db17e..f2adaa316e5c 100644 --- a/include/editeng/lspcitem.hxx +++ b/include/editeng/lspcitem.hxx @@ -80,7 +80,7 @@ public: // To increase or decrease the row height. sal_uInt16 GetPropLineSpace() const { return nPropLineSpace; } - void SetPropLineSpace( const sal_uInt8 nProp ) + void SetPropLineSpace( const sal_uInt16 nProp ) { nPropLineSpace = nProp; eInterLineSpaceRule = SvxInterLineSpaceRule::Prop; diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index 7b05cde25876..183c9405631d 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -395,7 +395,7 @@ void ParaLineSpacingControl::SetLineSpace(SvxLineSpacingItem& rLineSpace, sal_In case LLINESPACE_PROP: rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto ); - rLineSpace.SetPropLineSpace( static_cast<sal_uInt8>(lValue) ); + rLineSpace.SetPropLineSpace( static_cast<sal_uInt16>(lValue) ); break; case LLINESPACE_MIN: diff --git a/svx/uiconfig/ui/paralinespacingcontrol.ui b/svx/uiconfig/ui/paralinespacingcontrol.ui index ebf72843eb3a..63dd0d5d3e14 100644 --- a/svx/uiconfig/ui/paralinespacingcontrol.ui +++ b/svx/uiconfig/ui/paralinespacingcontrol.ui @@ -2,8 +2,8 @@ <interface domain="svx"> <!-- interface-requires gtk+ 3.10 --> <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">50</property> - <property name="upper">200</property> + <property name="lower">6</property> + <property name="upper">65535</property> <property name="value">100</property> <property name="step_increment">10</property> <property name="page_increment">10</property> 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!! |