Fix integer type of EditCharAttrib nStart/nEnd members

Looks reasonable to replace assignment to nEndField from USHRT_MAX with -1 in
ImpEditEngine::AddPortionIterated (editeng/source/editeng/impedit4.cxx).  This
apparently needs to just be an arbitrary value that EditPaM::GetIndex() will
never have.  Looks like 3cbfcee36d "xub_StrLen and
tools/string.hxx final straw" missed that (as that commit's message
acknowledges).

Change-Id: I5840d52d12a71937a5ed2779bfd5de071f702300
This commit is contained in:
Stephan Bergmann
2017-03-29 11:43:49 +02:00
parent 63da00becc
commit 1672b25eb4
4 changed files with 77 additions and 75 deletions

View File

@@ -52,7 +52,7 @@
// class EditCharAttrib // class EditCharAttrib
EditCharAttrib::EditCharAttrib( const SfxPoolItem& rAttr, sal_uInt16 nS, sal_uInt16 nE ) : EditCharAttrib::EditCharAttrib( const SfxPoolItem& rAttr, sal_Int32 nS, sal_Int32 nE ) :
nStart(nS), nEnd(nE), bFeature(false), bEdge(false) nStart(nS), nEnd(nE), bFeature(false), bEdge(false)
{ {
pItem = &rAttr; pItem = &rAttr;
@@ -72,8 +72,10 @@ void EditCharAttrib::SetFont( SvxFont&, OutputDevice* )
void EditCharAttrib::dumpAsXml(xmlTextWriterPtr pWriter) const void EditCharAttrib::dumpAsXml(xmlTextWriterPtr pWriter) const
{ {
xmlTextWriterStartElement(pWriter, BAD_CAST("EditCharAttrib")); xmlTextWriterStartElement(pWriter, BAD_CAST("EditCharAttrib"));
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nStart"), "%d", nStart); xmlTextWriterWriteFormatAttribute(
xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nEnd"), "%d", nEnd); pWriter, BAD_CAST("nStart"), "%" SAL_PRIdINT32, nStart);
xmlTextWriterWriteFormatAttribute(
pWriter, BAD_CAST("nEnd"), "%" SAL_PRIdINT32, nEnd);
pItem->dumpAsXml(pWriter); pItem->dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter); xmlTextWriterEndElement(pWriter);
} }
@@ -81,7 +83,7 @@ void EditCharAttrib::dumpAsXml(xmlTextWriterPtr pWriter) const
// class EditCharAttribFont // class EditCharAttribFont
EditCharAttribFont::EditCharAttribFont( const SvxFontItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribFont::EditCharAttribFont( const SvxFontItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_FONTINFO || rAttr.Which() == EE_CHAR_FONTINFO_CJK || rAttr.Which() == EE_CHAR_FONTINFO_CTL); assert(rAttr.Which() == EE_CHAR_FONTINFO || rAttr.Which() == EE_CHAR_FONTINFO_CJK || rAttr.Which() == EE_CHAR_FONTINFO_CTL);
@@ -100,7 +102,7 @@ void EditCharAttribFont::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribItalic // class EditCharAttribItalic
EditCharAttribItalic::EditCharAttribItalic( const SvxPostureItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribItalic::EditCharAttribItalic( const SvxPostureItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_ITALIC || rAttr.Which() == EE_CHAR_ITALIC_CJK || rAttr.Which() == EE_CHAR_ITALIC_CTL); assert(rAttr.Which() == EE_CHAR_ITALIC || rAttr.Which() == EE_CHAR_ITALIC_CJK || rAttr.Which() == EE_CHAR_ITALIC_CTL);
@@ -114,7 +116,7 @@ void EditCharAttribItalic::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribWeight // class EditCharAttribWeight
EditCharAttribWeight::EditCharAttribWeight( const SvxWeightItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribWeight::EditCharAttribWeight( const SvxWeightItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_WEIGHT || rAttr.Which() == EE_CHAR_WEIGHT_CJK || rAttr.Which() == EE_CHAR_WEIGHT_CTL); assert(rAttr.Which() == EE_CHAR_WEIGHT || rAttr.Which() == EE_CHAR_WEIGHT_CJK || rAttr.Which() == EE_CHAR_WEIGHT_CTL);
@@ -128,7 +130,7 @@ void EditCharAttribWeight::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribUnderline // class EditCharAttribUnderline
EditCharAttribUnderline::EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribUnderline::EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_UNDERLINE); assert(rAttr.Which() == EE_CHAR_UNDERLINE);
@@ -146,7 +148,7 @@ void EditCharAttribUnderline::SetFont( SvxFont& rFont, OutputDevice* pOutDev )
// class EditCharAttribOverline // class EditCharAttribOverline
EditCharAttribOverline::EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribOverline::EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_OVERLINE); assert(rAttr.Which() == EE_CHAR_OVERLINE);
@@ -162,7 +164,7 @@ void EditCharAttribOverline::SetFont( SvxFont& rFont, OutputDevice* pOutDev )
// class EditCharAttribFontHeight // class EditCharAttribFontHeight
EditCharAttribFontHeight::EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribFontHeight::EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_FONTHEIGHT || rAttr.Which() == EE_CHAR_FONTHEIGHT_CJK || rAttr.Which() == EE_CHAR_FONTHEIGHT_CTL); assert(rAttr.Which() == EE_CHAR_FONTHEIGHT || rAttr.Which() == EE_CHAR_FONTHEIGHT_CJK || rAttr.Which() == EE_CHAR_FONTHEIGHT_CTL);
@@ -177,7 +179,7 @@ void EditCharAttribFontHeight::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribFontWidth // class EditCharAttribFontWidth
EditCharAttribFontWidth::EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribFontWidth::EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_FONTWIDTH); assert(rAttr.Which() == EE_CHAR_FONTWIDTH);
@@ -191,7 +193,7 @@ void EditCharAttribFontWidth::SetFont( SvxFont& /*rFont*/, OutputDevice* )
// class EditCharAttribStrikeout // class EditCharAttribStrikeout
EditCharAttribStrikeout::EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribStrikeout::EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_STRIKEOUT); assert(rAttr.Which() == EE_CHAR_STRIKEOUT);
@@ -205,7 +207,7 @@ void EditCharAttribStrikeout::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribCaseMap // class EditCharAttribCaseMap
EditCharAttribCaseMap::EditCharAttribCaseMap( const SvxCaseMapItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribCaseMap::EditCharAttribCaseMap( const SvxCaseMapItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_CASEMAP); assert(rAttr.Which() == EE_CHAR_CASEMAP);
@@ -219,7 +221,7 @@ void EditCharAttribCaseMap::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribColor // class EditCharAttribColor
EditCharAttribColor::EditCharAttribColor( const SvxColorItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribColor::EditCharAttribColor( const SvxColorItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_COLOR); assert(rAttr.Which() == EE_CHAR_COLOR);
@@ -235,8 +237,8 @@ void EditCharAttribColor::SetFont( SvxFont& rFont, OutputDevice* )
EditCharAttribBackgroundColor::EditCharAttribBackgroundColor( EditCharAttribBackgroundColor::EditCharAttribBackgroundColor(
const SvxBackgroundColorItem& rAttr, const SvxBackgroundColorItem& rAttr,
sal_uInt16 _nStart, sal_Int32 _nStart,
sal_uInt16 _nEnd ) sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_BKGCOLOR); assert(rAttr.Which() == EE_CHAR_BKGCOLOR);
@@ -250,7 +252,7 @@ void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* )
} }
// class EditCharAttribLanguage // class EditCharAttribLanguage
EditCharAttribLanguage::EditCharAttribLanguage( const SvxLanguageItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribLanguage::EditCharAttribLanguage( const SvxLanguageItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert((rAttr.Which() == EE_CHAR_LANGUAGE) || (rAttr.Which() == EE_CHAR_LANGUAGE_CJK) || (rAttr.Which() == EE_CHAR_LANGUAGE_CTL)); assert((rAttr.Which() == EE_CHAR_LANGUAGE) || (rAttr.Which() == EE_CHAR_LANGUAGE_CJK) || (rAttr.Which() == EE_CHAR_LANGUAGE_CTL));
@@ -264,7 +266,7 @@ void EditCharAttribLanguage::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribShadow // class EditCharAttribShadow
EditCharAttribShadow::EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribShadow::EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_SHADOW); assert(rAttr.Which() == EE_CHAR_SHADOW);
@@ -278,7 +280,7 @@ void EditCharAttribShadow::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribEscapement // class EditCharAttribEscapement
EditCharAttribEscapement::EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribEscapement::EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_ESCAPEMENT); assert(rAttr.Which() == EE_CHAR_ESCAPEMENT);
@@ -300,7 +302,7 @@ void EditCharAttribEscapement::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribOutline // class EditCharAttribOutline
EditCharAttribOutline::EditCharAttribOutline( const SvxContourItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribOutline::EditCharAttribOutline( const SvxContourItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_OUTLINE); assert(rAttr.Which() == EE_CHAR_OUTLINE);
@@ -314,7 +316,7 @@ void EditCharAttribOutline::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribTab // class EditCharAttribTab
EditCharAttribTab::EditCharAttribTab( const SfxVoidItem& rAttr, sal_uInt16 nPos ) EditCharAttribTab::EditCharAttribTab( const SfxVoidItem& rAttr, sal_Int32 nPos )
: EditCharAttrib( rAttr, nPos, nPos+1 ) : EditCharAttrib( rAttr, nPos, nPos+1 )
{ {
SetFeature( true ); SetFeature( true );
@@ -327,7 +329,7 @@ void EditCharAttribTab::SetFont( SvxFont&, OutputDevice* )
// class EditCharAttribLineBreak // class EditCharAttribLineBreak
EditCharAttribLineBreak::EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_uInt16 nPos ) EditCharAttribLineBreak::EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_Int32 nPos )
: EditCharAttrib( rAttr, nPos, nPos+1 ) : EditCharAttrib( rAttr, nPos, nPos+1 )
{ {
SetFeature( true ); SetFeature( true );
@@ -340,7 +342,7 @@ void EditCharAttribLineBreak::SetFont( SvxFont&, OutputDevice* )
// class EditCharAttribField // class EditCharAttribField
EditCharAttribField::EditCharAttribField( const SvxFieldItem& rAttr, sal_uInt16 nPos ) EditCharAttribField::EditCharAttribField( const SvxFieldItem& rAttr, sal_Int32 nPos )
: EditCharAttrib( rAttr, nPos, nPos+1 ) : EditCharAttrib( rAttr, nPos, nPos+1 )
{ {
SetFeature( true ); // !!! SetFeature( true ); // !!!
@@ -407,7 +409,7 @@ bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const
// class EditCharAttribPairKerning // class EditCharAttribPairKerning
EditCharAttribPairKerning::EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribPairKerning::EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_PAIRKERNING); assert(rAttr.Which() == EE_CHAR_PAIRKERNING);
@@ -421,7 +423,7 @@ void EditCharAttribPairKerning::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribKerning // class EditCharAttribKerning
EditCharAttribKerning::EditCharAttribKerning( const SvxKerningItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribKerning::EditCharAttribKerning( const SvxKerningItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_KERNING); assert(rAttr.Which() == EE_CHAR_KERNING);
@@ -435,7 +437,7 @@ void EditCharAttribKerning::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribWordLineMode // class EditCharAttribWordLineMode
EditCharAttribWordLineMode::EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribWordLineMode::EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_WLM); assert(rAttr.Which() == EE_CHAR_WLM);
@@ -449,7 +451,7 @@ void EditCharAttribWordLineMode::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribEmphasisMark // class EditCharAttribEmphasisMark
EditCharAttribEmphasisMark::EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribEmphasisMark::EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_EMPHASISMARK); assert(rAttr.Which() == EE_CHAR_EMPHASISMARK);
@@ -463,7 +465,7 @@ void EditCharAttribEmphasisMark::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribRelief // class EditCharAttribRelief
EditCharAttribRelief::EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribRelief::EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_RELIEF); assert(rAttr.Which() == EE_CHAR_RELIEF);
@@ -476,7 +478,7 @@ void EditCharAttribRelief::SetFont( SvxFont& rFont, OutputDevice* )
// class EditCharAttribGrabBag // class EditCharAttribGrabBag
EditCharAttribGrabBag::EditCharAttribGrabBag( const SfxGrabBagItem& rAttr, sal_uInt16 _nStart, sal_uInt16 _nEnd ) EditCharAttribGrabBag::EditCharAttribGrabBag( const SfxGrabBagItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd )
: EditCharAttrib( rAttr, _nStart, _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd )
{ {
assert(rAttr.Which() == EE_CHAR_GRABBAG); assert(rAttr.Which() == EE_CHAR_GRABBAG);

View File

@@ -68,13 +68,13 @@ class EditCharAttrib
protected: protected:
const SfxPoolItem* pItem; const SfxPoolItem* pItem;
sal_uInt16 nStart; sal_Int32 nStart;
sal_uInt16 nEnd; sal_Int32 nEnd;
bool bFeature :1; bool bFeature :1;
bool bEdge :1; bool bEdge :1;
public: public:
EditCharAttrib( const SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttrib( const SfxPoolItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual ~EditCharAttrib(); virtual ~EditCharAttrib();
EditCharAttrib(const EditCharAttrib&) = delete; EditCharAttrib(const EditCharAttrib&) = delete;
@@ -85,25 +85,25 @@ public:
sal_uInt16 Which() const { return pItem->Which(); } sal_uInt16 Which() const { return pItem->Which(); }
const SfxPoolItem* GetItem() const { return pItem; } const SfxPoolItem* GetItem() const { return pItem; }
sal_uInt16& GetStart() { return nStart; } sal_Int32& GetStart() { return nStart; }
sal_uInt16& GetEnd() { return nEnd; } sal_Int32& GetEnd() { return nEnd; }
sal_uInt16 GetStart() const { return nStart; } sal_Int32 GetStart() const { return nStart; }
sal_uInt16 GetEnd() const { return nEnd; } sal_Int32 GetEnd() const { return nEnd; }
inline sal_uInt16 GetLen() const; inline sal_Int32 GetLen() const;
inline void MoveForward( sal_uInt16 nDiff ); inline void MoveForward( sal_Int32 nDiff );
inline void MoveBackward( sal_uInt16 nDiff ); inline void MoveBackward( sal_Int32 nDiff );
inline void Expand( sal_uInt16 nDiff ); inline void Expand( sal_Int32 nDiff );
inline void Collaps( sal_uInt16 nDiff ); inline void Collaps( sal_Int32 nDiff );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev );
bool IsIn( sal_uInt16 nIndex ) const bool IsIn( sal_Int32 nIndex ) const
{ return ( ( nStart <= nIndex ) && ( nEnd >= nIndex ) ); } { return ( ( nStart <= nIndex ) && ( nEnd >= nIndex ) ); }
bool IsInside( sal_uInt16 nIndex ) const bool IsInside( sal_Int32 nIndex ) const
{ return ( ( nStart < nIndex ) && ( nEnd > nIndex ) ); } { return ( ( nStart < nIndex ) && ( nEnd > nIndex ) ); }
bool IsEmpty() const bool IsEmpty() const
{ return nStart == nEnd; } { return nStart == nEnd; }
@@ -115,34 +115,34 @@ public:
void SetEdge( bool b ) { bEdge = b; } void SetEdge( bool b ) { bEdge = b; }
}; };
inline sal_uInt16 EditCharAttrib::GetLen() const inline sal_Int32 EditCharAttrib::GetLen() const
{ {
DBG_ASSERT( nEnd >= nStart, "EditCharAttrib: nEnd < nStart!" ); DBG_ASSERT( nEnd >= nStart, "EditCharAttrib: nEnd < nStart!" );
return nEnd-nStart; return nEnd-nStart;
} }
inline void EditCharAttrib::MoveForward( sal_uInt16 nDiff ) inline void EditCharAttrib::MoveForward( sal_Int32 nDiff )
{ {
DBG_ASSERT( SAL_MAX_INT32 - nDiff > nEnd, "EditCharAttrib: MoveForward?!" ); DBG_ASSERT( SAL_MAX_INT32 - nDiff > nEnd, "EditCharAttrib: MoveForward?!" );
nStart = nStart + nDiff; nStart = nStart + nDiff;
nEnd = nEnd + nDiff; nEnd = nEnd + nDiff;
} }
inline void EditCharAttrib::MoveBackward( sal_uInt16 nDiff ) inline void EditCharAttrib::MoveBackward( sal_Int32 nDiff )
{ {
DBG_ASSERT( (nStart - nDiff) >= 0, "EditCharAttrib: MoveBackward?!" ); DBG_ASSERT( (nStart - nDiff) >= 0, "EditCharAttrib: MoveBackward?!" );
nStart = nStart - nDiff; nStart = nStart - nDiff;
nEnd = nEnd - nDiff; nEnd = nEnd - nDiff;
} }
inline void EditCharAttrib::Expand( sal_uInt16 nDiff ) inline void EditCharAttrib::Expand( sal_Int32 nDiff )
{ {
DBG_ASSERT( SAL_MAX_INT32 - nDiff > nEnd, "EditCharAttrib: Expand?!" ); DBG_ASSERT( SAL_MAX_INT32 - nDiff > nEnd, "EditCharAttrib: Expand?!" );
DBG_ASSERT( !bFeature, "Please do not expand any features!" ); DBG_ASSERT( !bFeature, "Please do not expand any features!" );
nEnd = nEnd + nDiff; nEnd = nEnd + nDiff;
} }
inline void EditCharAttrib::Collaps( sal_uInt16 nDiff ) inline void EditCharAttrib::Collaps( sal_Int32 nDiff )
{ {
DBG_ASSERT( nEnd - nDiff >= nStart, "EditCharAttrib: Collaps?!" ); DBG_ASSERT( nEnd - nDiff >= nStart, "EditCharAttrib: Collaps?!" );
DBG_ASSERT( !bFeature, "Please do not shrink any Features!" ); DBG_ASSERT( !bFeature, "Please do not shrink any Features!" );
@@ -155,7 +155,7 @@ inline void EditCharAttrib::Collaps( sal_uInt16 nDiff )
class EditCharAttribFont: public EditCharAttrib class EditCharAttribFont: public EditCharAttrib
{ {
public: public:
EditCharAttribFont( const SvxFontItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribFont( const SvxFontItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -166,7 +166,7 @@ public:
class EditCharAttribWeight : public EditCharAttrib class EditCharAttribWeight : public EditCharAttrib
{ {
public: public:
EditCharAttribWeight( const SvxWeightItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribWeight( const SvxWeightItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -176,7 +176,7 @@ public:
class EditCharAttribItalic : public EditCharAttrib class EditCharAttribItalic : public EditCharAttrib
{ {
public: public:
EditCharAttribItalic( const SvxPostureItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribItalic( const SvxPostureItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -187,7 +187,7 @@ public:
class EditCharAttribShadow : public EditCharAttrib class EditCharAttribShadow : public EditCharAttrib
{ {
public: public:
EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribShadow( const SvxShadowedItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -198,7 +198,7 @@ public:
class EditCharAttribEscapement : public EditCharAttrib class EditCharAttribEscapement : public EditCharAttrib
{ {
public: public:
EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribEscapement( const SvxEscapementItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -209,7 +209,7 @@ public:
class EditCharAttribOutline : public EditCharAttrib class EditCharAttribOutline : public EditCharAttrib
{ {
public: public:
EditCharAttribOutline( const SvxContourItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribOutline( const SvxContourItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -220,7 +220,7 @@ public:
class EditCharAttribStrikeout : public EditCharAttrib class EditCharAttribStrikeout : public EditCharAttrib
{ {
public: public:
EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribStrikeout( const SvxCrossedOutItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -231,7 +231,7 @@ public:
class EditCharAttribCaseMap : public EditCharAttrib class EditCharAttribCaseMap : public EditCharAttrib
{ {
public: public:
EditCharAttribCaseMap( const SvxCaseMapItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribCaseMap( const SvxCaseMapItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -242,7 +242,7 @@ public:
class EditCharAttribUnderline : public EditCharAttrib class EditCharAttribUnderline : public EditCharAttrib
{ {
public: public:
EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribUnderline( const SvxUnderlineItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -253,7 +253,7 @@ public:
class EditCharAttribOverline : public EditCharAttrib class EditCharAttribOverline : public EditCharAttrib
{ {
public: public:
EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribOverline( const SvxOverlineItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -264,7 +264,7 @@ public:
class EditCharAttribEmphasisMark : public EditCharAttrib class EditCharAttribEmphasisMark : public EditCharAttrib
{ {
public: public:
EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribEmphasisMark( const SvxEmphasisMarkItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -275,7 +275,7 @@ public:
class EditCharAttribRelief : public EditCharAttrib class EditCharAttribRelief : public EditCharAttrib
{ {
public: public:
EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribRelief( const SvxCharReliefItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -286,7 +286,7 @@ public:
class EditCharAttribFontHeight : public EditCharAttrib class EditCharAttribFontHeight : public EditCharAttrib
{ {
public: public:
EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribFontHeight( const SvxFontHeightItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -297,7 +297,7 @@ public:
class EditCharAttribFontWidth : public EditCharAttrib class EditCharAttribFontWidth : public EditCharAttrib
{ {
public: public:
EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribFontWidth( const SvxCharScaleWidthItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -308,7 +308,7 @@ public:
class EditCharAttribColor : public EditCharAttrib class EditCharAttribColor : public EditCharAttrib
{ {
public: public:
EditCharAttribColor( const SvxColorItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribColor( const SvxColorItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -319,8 +319,8 @@ class EditCharAttribBackgroundColor : public EditCharAttrib
{ {
public: public:
EditCharAttribBackgroundColor(const SvxBackgroundColorItem& rAttr, EditCharAttribBackgroundColor(const SvxBackgroundColorItem& rAttr,
sal_uInt16 nStart, sal_Int32 nStart,
sal_uInt16 nEnd ); sal_Int32 nEnd );
virtual void SetFont(SvxFont& rFont, OutputDevice* pOutDev) override; virtual void SetFont(SvxFont& rFont, OutputDevice* pOutDev) override;
}; };
@@ -330,7 +330,7 @@ public:
class EditCharAttribLanguage : public EditCharAttrib class EditCharAttribLanguage : public EditCharAttrib
{ {
public: public:
EditCharAttribLanguage( const SvxLanguageItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribLanguage( const SvxLanguageItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -341,7 +341,7 @@ public:
class EditCharAttribTab : public EditCharAttrib class EditCharAttribTab : public EditCharAttrib
{ {
public: public:
EditCharAttribTab( const SfxVoidItem& rAttr, sal_uInt16 nPos ); EditCharAttribTab( const SfxVoidItem& rAttr, sal_Int32 nPos );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -352,7 +352,7 @@ public:
class EditCharAttribLineBreak : public EditCharAttrib class EditCharAttribLineBreak : public EditCharAttrib
{ {
public: public:
EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_uInt16 nPos ); EditCharAttribLineBreak( const SfxVoidItem& rAttr, sal_Int32 nPos );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -369,7 +369,7 @@ class EditCharAttribField: public EditCharAttrib
EditCharAttribField& operator = ( const EditCharAttribField& rAttr ) = delete; EditCharAttribField& operator = ( const EditCharAttribField& rAttr ) = delete;
public: public:
EditCharAttribField( const SvxFieldItem& rAttr, sal_uInt16 nPos ); EditCharAttribField( const SvxFieldItem& rAttr, sal_Int32 nPos );
EditCharAttribField( const EditCharAttribField& rAttr ); EditCharAttribField( const EditCharAttribField& rAttr );
virtual ~EditCharAttribField() override; virtual ~EditCharAttribField() override;
@@ -393,7 +393,7 @@ public:
class EditCharAttribPairKerning : public EditCharAttrib class EditCharAttribPairKerning : public EditCharAttrib
{ {
public: public:
EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribPairKerning( const SvxAutoKernItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -404,7 +404,7 @@ public:
class EditCharAttribKerning : public EditCharAttrib class EditCharAttribKerning : public EditCharAttrib
{ {
public: public:
EditCharAttribKerning( const SvxKerningItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribKerning( const SvxKerningItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -415,7 +415,7 @@ public:
class EditCharAttribWordLineMode: public EditCharAttrib class EditCharAttribWordLineMode: public EditCharAttrib
{ {
public: public:
EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribWordLineMode( const SvxWordLineModeItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override; virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) override;
}; };
@@ -425,7 +425,7 @@ public:
class EditCharAttribGrabBag: public EditCharAttrib class EditCharAttribGrabBag: public EditCharAttrib
{ {
public: public:
EditCharAttribGrabBag( const SfxGrabBagItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd ); EditCharAttribGrabBag( const SfxGrabBagItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd );
}; };

View File

@@ -358,9 +358,9 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox )
aCharAttribs.append(": "); aCharAttribs.append(": ");
aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetItem()->Which())); aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetItem()->Which()));
aCharAttribs.append('\t'); aCharAttribs.append('\t');
aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetStart())); aCharAttribs.append(rAttr->GetStart());
aCharAttribs.append('\t'); aCharAttribs.append('\t');
aCharAttribs.append(static_cast<sal_Int32>(rAttr->GetEnd())); aCharAttribs.append(rAttr->GetEnd());
if ( rAttr->IsEmpty() ) if ( rAttr->IsEmpty() )
bZeroAttr = true; bZeroAttr = true;
fprintf(fp, "%s => ", aCharAttribs.getStr()); fprintf(fp, "%s => ", aCharAttribs.getStr());

View File

@@ -2067,7 +2067,7 @@ void ImpEditEngine::AddPortionIterated(
pFieldAttr->GetStart() == aCursor.GetIndex() && pFieldAttr->GetStart() == aCursor.GetIndex() &&
pFieldAttr->GetStart() != pFieldAttr->GetEnd() && pFieldAttr->GetStart() != pFieldAttr->GetEnd() &&
pFieldAttr->Which() == EE_FEATURE_FIELD; pFieldAttr->Which() == EE_FEATURE_FIELD;
sal_Int32 nEndField = bIsField ? pFieldAttr->GetEnd() : USHRT_MAX; sal_Int32 nEndField = bIsField ? pFieldAttr->GetEnd() : -1;
do do
{ {
aCursor = CursorRight( aCursor); aCursor = CursorRight( aCursor);