diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-18 11:58:06 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-18 14:57:51 -0400 |
commit | e4784750705b3d2649b461ade363c84bd1b2b10b (patch) | |
tree | 4d87b8063341d6e19fefa92e9f343a05241d29f1 /editeng | |
parent | 808dd658a265f565a638556322250a0957e8e535 (diff) |
String & bool cleanup.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editattr.cxx | 31 | ||||
-rw-r--r-- | editeng/source/editeng/editattr.hxx | 17 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 4 |
5 files changed, 34 insertions, 22 deletions
diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index 131f8896be1d..d5b640faa26f 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -328,6 +328,23 @@ void EditCharAttribField::SetFont( SvxFont& rFont, OutputDevice* ) rFont.SetColor( *pTxtColor ); } +const rtl::OUString& EditCharAttribField::GetFieldValue() const +{ + return aFieldValue; +} + +void EditCharAttribField::SetFieldValue(const rtl::OUString& rVal) +{ + aFieldValue = rVal; +} + +void EditCharAttribField::Reset() +{ + aFieldValue = rtl::OUString(); + delete pTxtColor; pTxtColor = NULL; + delete pFldColor; pFldColor = NULL; +} + EditCharAttribField::EditCharAttribField( const EditCharAttribField& rAttr ) : EditCharAttrib( *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd() ), aFieldValue( rAttr.aFieldValue ) @@ -342,22 +359,22 @@ EditCharAttribField::~EditCharAttribField() Reset(); } -sal_Bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const +bool EditCharAttribField::operator == ( const EditCharAttribField& rAttr ) const { if ( aFieldValue != rAttr.aFieldValue ) - return sal_False; + return false; if ( ( pTxtColor && !rAttr.pTxtColor ) || ( !pTxtColor && rAttr.pTxtColor ) ) - return sal_False; + return false; if ( ( pTxtColor && rAttr.pTxtColor ) && ( *pTxtColor != *rAttr.pTxtColor ) ) - return sal_False; + return false; if ( ( pFldColor && !rAttr.pFldColor ) || ( !pFldColor && rAttr.pFldColor ) ) - return sal_False; + return false; if ( ( pFldColor && rAttr.pFldColor ) && ( *pFldColor != *rAttr.pFldColor ) ) - return sal_False; + return false; - return sal_True; + return true; } // ------------------------------------------------------------------------- diff --git a/editeng/source/editeng/editattr.hxx b/editeng/source/editeng/editattr.hxx index 4a0f711f1a94..1a371d038927 100644 --- a/editeng/source/editeng/editattr.hxx +++ b/editeng/source/editeng/editattr.hxx @@ -342,7 +342,7 @@ public: // ------------------------------------------------------------------------- class EditCharAttribField: public EditCharAttrib { - XubString aFieldValue; + rtl::OUString aFieldValue; Color* pTxtColor; Color* pFldColor; @@ -353,23 +353,18 @@ public: EditCharAttribField( const EditCharAttribField& rAttr ); ~EditCharAttribField(); - sal_Bool operator == ( const EditCharAttribField& rAttr ) const; - sal_Bool operator != ( const EditCharAttribField& rAttr ) const + bool operator == ( const EditCharAttribField& rAttr ) const; + bool operator != ( const EditCharAttribField& rAttr ) const { return !(operator == ( rAttr ) ); } virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ); Color*& GetTxtColor() { return pTxtColor; } Color*& GetFldColor() { return pFldColor; } - const XubString& GetFieldValue() const { return aFieldValue; } - XubString& GetFieldValue() { return aFieldValue; } + const rtl::OUString& GetFieldValue() const; + void SetFieldValue(const rtl::OUString& rVal); - void Reset() - { - aFieldValue.Erase(); - delete pTxtColor; pTxtColor = 0; - delete pFldColor; pFldColor = 0; - } + void Reset(); }; // ------------------------------------------------------------------------- diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 3b8244a73c5c..c24e72bb592d 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2146,7 +2146,7 @@ sal_uLong EditDoc::GetTextLen() const const EditCharAttrib& rAttr = rAttrs[--nAttr]; if (rAttr.Which() == EE_FEATURE_FIELD) { - sal_uInt16 nFieldLen = static_cast<const EditCharAttribField&>(rAttr).GetFieldValue().Len(); + sal_Int32 nFieldLen = static_cast<const EditCharAttribField&>(rAttr).GetFieldValue().getLength(); if ( !nFieldLen ) nLen--; else diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 202b8fa56a05..e4ec62078a35 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2999,7 +2999,7 @@ sal_Bool ImpEditEngine::UpdateFields() static_cast<const SvxFieldItem&>(*rField.GetItem()), nPara, rField.GetStart(), rField.GetTxtColor(), rField.GetFldColor()); - rField.GetFieldValue() = aFldValue; + rField.SetFieldValue(aFldValue); if (rField != *pCurrent) { bChanges = true; diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 5ea5d718b4b3..a08a6c7cbf6c 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1003,10 +1003,10 @@ sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY ) aTmpFont.SetPhysFont( GetRefDevice() ); ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); - String aFieldValue = cChar ? String(cChar) : ((EditCharAttribField*)pNextFeature)->GetFieldValue(); + rtl::OUString aFieldValue = cChar ? rtl::OUString(cChar) : ((EditCharAttribField*)pNextFeature)->GetFieldValue(); if ( bCalcCharPositions || !pPortion->HasValidSize() ) { - pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), aFieldValue, 0, aFieldValue.Len(), 0 ); + pPortion->GetSize() = aTmpFont.QuickGetTextSize( GetRefDevice(), aFieldValue, 0, aFieldValue.getLength(), 0 ); // So no scrolling for oversized fields if ( pPortion->GetSize().Width() > nXWidth ) pPortion->GetSize().Width() = nXWidth; |