summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdbg.cxx2
-rw-r--r--editeng/source/items/numitem.cxx14
-rw-r--r--editeng/source/uno/unonrule.cxx4
3 files changed, 12 insertions, 8 deletions
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx
index 51bf4a63498f..28e9b4d53a6f 100644
--- a/editeng/source/editeng/editdbg.cxx
+++ b/editeng/source/editeng/editdbg.cxx
@@ -88,7 +88,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
if ( pFmt )
{
aDebStr.append('(');
- aDebStr.append(static_cast<sal_Int32>(pFmt->GetFirstLineOffset()));
+ aDebStr.append(pFmt->GetFirstLineOffset());
aDebStr.append(',');
aDebStr.append(pFmt->GetAbsLSpace());
aDebStr.append(',');
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index f85c4aec9855..0e8c012a5df9 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -197,8 +197,10 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
rStream.ReadUInt16( nStart );
rStream.ReadUInt16( nTmp16 ); cBullet = static_cast<sal_Unicode>(nTmp16);
- rStream.ReadInt16( nFirstLineOffset );
- sal_Int16 temp;
+ sal_Int16 temp = 0;
+ rStream.ReadInt16( temp );
+ nFirstLineOffset = temp;
+ temp = 0;
rStream.ReadInt16( temp );
nAbsLSpace = temp;
rStream.SeekRel(2); //skip old now unused nLSpace;
@@ -261,7 +263,9 @@ void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverte
rStream.WriteUInt16( nStart );
rStream.WriteUInt16( cBullet );
- rStream.WriteInt16( nFirstLineOffset );
+ rStream.WriteInt16(
+ sal_Int16(o3tl::clamp<sal_Int32>(nFirstLineOffset, SAL_MIN_INT16, SAL_MAX_INT16)) );
+ //TODO: better way to handle out-of-bounds value?
rStream.WriteInt16(
sal_Int16(o3tl::clamp<sal_Int32>(nAbsLSpace, SAL_MIN_INT16, SAL_MAX_INT16)) );
//TODO: better way to handle out-of-bounds value?
@@ -452,11 +456,11 @@ sal_Int32 SvxNumberFormat::GetAbsLSpace() const
? nAbsLSpace
: static_cast<sal_Int32>( GetFirstLineIndent() + GetIndentAt() );
}
-short SvxNumberFormat::GetFirstLineOffset() const
+sal_Int32 SvxNumberFormat::GetFirstLineOffset() const
{
return mePositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
? nFirstLineOffset
- : static_cast<short>( GetFirstLineIndent() );
+ : static_cast<sal_Int32>( GetFirstLineIndent() );
}
short SvxNumberFormat::GetCharTextDistance() const
{
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 30c7deab2e94..74ac1596146a 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -248,7 +248,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex(sal
aVal <<= rFmt.GetAbsLSpace();
pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_LEFT_MARGIN, -1, aVal, beans::PropertyState_DIRECT_VALUE);
- aVal <<= static_cast<sal_Int32>(rFmt.GetFirstLineOffset());
+ aVal <<= rFmt.GetFirstLineOffset();
pArray[nIdx++] = beans::PropertyValue(UNO_NAME_NRULE_FIRST_LINE_OFFSET, -1, aVal, beans::PropertyState_DIRECT_VALUE);
pArray[nIdx++] = beans::PropertyValue("SymbolTextDistance", -1, aVal, beans::PropertyState_DIRECT_VALUE);
@@ -411,7 +411,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence<beans::Propert
sal_Int32 nMargin = 0;
if( aVal >>= nMargin )
{
- aFmt.SetFirstLineOffset(static_cast<sal_uInt16>(nMargin));
+ aFmt.SetFirstLineOffset(nMargin);
continue;
}
}