diff options
-rw-r--r-- | cui/source/tabpages/numfmt.cxx | 18 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 14 |
2 files changed, 27 insertions, 5 deletions
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index c235cfa5a5bc..1577c2a8c1e8 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -113,9 +113,21 @@ void SvxNumberPreview::NotifyChange( const OUString& rPrevStr, mnPos = aPrevStr.indexOf( 0x1B ); if ( mnPos != -1 ) { - mnChar = aPrevStr[ mnPos + 1 ]; - // delete placeholder and char to repeat - aPrevStr = aPrevStr.replaceAt( mnPos, 2, "" ); + // Right during user input the star symbol is the very + // last character before the user enters another one. + if (mnPos < aPrevStr.getLength() - 1) + { + mnChar = aPrevStr[ mnPos + 1 ]; + // delete placeholder and char to repeat + aPrevStr = aPrevStr.replaceAt( mnPos, 2, "" ); + } + else + { + // delete placeholder + aPrevStr = aPrevStr.replaceAt( mnPos, 1, "" ); + // do not attempt to draw a 0 fill character + mnPos = -1; + } } svtools::ColorConfig aColorConfig; Color aWindowTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor ); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 5815cac9147d..69e0059b7c19 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2590,8 +2590,18 @@ bool SvNumberformat::GetOutputString(double fNumber, if( bStarFlag ) { sBuff.append((sal_Unicode) 0x1B); - sBuff.append(rInfo.sStrArray[i][1]); - bRes = true; + const OUString& rStr =rInfo.sStrArray[i]; + // Right during user input the star symbol is the very + // last character before the user enters another one. + if (rStr.getLength() > 1) + { + sBuff.append(rStr[1]); + bRes = true; + } + else + { + bRes = false; + } } break; case NF_SYMBOLTYPE_BLANK: |