diff options
author | Johann Messner <johann.messner@jku.at> | 2012-08-28 10:51:15 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2012-08-28 11:12:44 +0100 |
commit | f727644ad18838a78525256623a33f864fe13fb2 (patch) | |
tree | 93523dc27d562b757a8ce81c9fea1c7a9fa65f9a /cui | |
parent | 1efa576ef88141c4deb5da9818537e053dc6517b (diff) |
tweaking the "fill in character" support in Calc Number Format Strings
a) changed ordering of repeat code marker ( 0x1b ) and repeat code to more
sensible ( and correct imo ) order
b) prevent some possible div/0 errors
c) added some missing formatter 'GetOutputString' calls
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/tabpages/numfmt.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index c603726d5e31..855cc90e7d16 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -132,8 +132,7 @@ void SvxNumberPreviewImpl::NotifyChange( const String& rPrevStr, mnPos = aPrevStr.Search( 0x1B ); if ( mnPos != STRING_NOTFOUND ) { - --mnPos; - mnChar = aPrevStr.GetChar( mnPos ); + mnChar = aPrevStr.GetChar( mnPos + 1 ); // delete placeholder and char to repeat aPrevStr.Erase( mnPos, 2 ); } @@ -168,9 +167,11 @@ void SvxNumberPreviewImpl::Paint( const Rectangle& ) if ( mnPos != STRING_NOTFOUND ) { long nCharWidth = GetTextWidth( rtl::OUString::valueOf( mnChar ) ); - int nNumCharsToInsert = nLeadSpace / nCharWidth; - if ( nNumCharsToInsert ) + int nNumCharsToInsert = 0; + if (nCharWidth > 0) nNumCharsToInsert = nLeadSpace / nCharWidth; + + if ( nNumCharsToInsert > 0) { for ( int i = 0; i < nNumCharsToInsert; ++i ) aTmpStr.Insert( mnChar, mnPos ); |