summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/cellform.hxx4
-rw-r--r--sc/source/core/tool/cellform.cxx5
-rw-r--r--sc/source/ui/view/output2.cxx43
-rw-r--r--svl/inc/svl/zforlist.hxx4
-rw-r--r--svl/source/numbers/zforlist.cxx16
5 files changed, 61 insertions, 11 deletions
diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx
index cdfa09cc6599..3a5418d5a12d 100644
--- a/sc/inc/cellform.hxx
+++ b/sc/inc/cellform.hxx
@@ -53,7 +53,9 @@ public:
Color** ppColor, SvNumberFormatter& rFormatter,
sal_Bool bNullVals = sal_True,
sal_Bool bFormula = false,
- ScForceTextFmt eForceTextFmt = ftDontForce );
+ ScForceTextFmt eForceTextFmt = ftDontForce,
+ bool bUseStarFormat = false );
+
static void GetInputString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OUString& rString,
SvNumberFormatter& rFormatter );
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index f33a48c23363..0da68661d191 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -49,7 +49,8 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OUStrin
Color** ppColor, SvNumberFormatter& rFormatter,
sal_Bool bNullVals,
sal_Bool bFormula,
- ScForceTextFmt eForceTextFmt )
+ ScForceTextFmt eForceTextFmt,
+ bool bUseStarFormat )
{
*ppColor = NULL;
if (&rFormatter==NULL)
@@ -92,7 +93,7 @@ void ScCellFormat::GetString( ScBaseCell* pCell, sal_uLong nFormat, rtl::OUStrin
rFormatter.GetOutputString( aTemp, nFormat, rString, ppColor );
}
else
- rFormatter.GetOutputString( nValue, nFormat, rString, ppColor );
+ rFormatter.GetOutputString( nValue, nFormat, rString, ppColor, bUseStarFormat );
}
}
break;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 2b99bb80c277..6c616eb3a056 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -128,6 +128,8 @@ class ScDrawStringsVars
Color aBackConfigColor; // used for ScPatternAttr::GetFont calls
Color aTextConfigColor;
+ sal_Int32 nPos;
+ sal_Unicode nChar;
public:
ScDrawStringsVars(ScOutputData* pData, sal_Bool bPTL);
@@ -162,6 +164,7 @@ public:
sal_Bool GetLineBreak() const { return bLineBreak; }
sal_Bool IsRepeat() const { return bRepeat; }
sal_Bool IsShrink() const { return bShrink; }
+ void RepeatToFill( long colWidth );
long GetAscent() const { return nAscentPixel; }
sal_Bool IsRotated() const { return bRotated; }
@@ -206,7 +209,9 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, sal_Bool bPTL) :
bLineBreak ( false ),
bRepeat ( false ),
bShrink ( false ),
- bPixelToLogic( bPTL )
+ bPixelToLogic( bPTL ),
+ nPos( STRING_NOTFOUND ),
+ nChar( 0x0 )
{
ScModule* pScMod = SC_MOD();
bCellContrast = pOutput->bUseStyleColor &&
@@ -502,9 +507,19 @@ sal_Bool ScDrawStringsVars::SetText( ScBaseCell* pCell )
*pOutput->pDoc->GetFormatTable(),
pOutput->bShowNullValues,
pOutput->bShowFormulas,
- ftCheck );
+ ftCheck, true );
aString = aOUString;
-
+ if ( nFormat )
+ {
+ nPos = aString.Search( 0x1B );
+ if ( nPos != STRING_NOTFOUND )
+ {
+ nPos = nPos - 1;
+ nChar = aString.GetChar( nPos );
+ // delete placeholder and char to repeat
+ aString.Erase( nPos, 2 );
+ }
+ }
if (aString.Len() > DRAWTEXT_MAX)
aString.Erase(DRAWTEXT_MAX);
@@ -537,6 +552,27 @@ void ScDrawStringsVars::SetHashText()
SetAutoText( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("###")) );
}
+void ScDrawStringsVars::RepeatToFill( long colWidth )
+{
+ if ( nPos == STRING_NOTFOUND || nPos >= aString.Len() )
+ return;
+
+ long charWidth = pOutput->pFmtDevice->GetTextWidth(String(nChar));
+ if (bPixelToLogic)
+ colWidth = pOutput->pRefDevice->PixelToLogic(Size(colWidth,0)).Width();
+ // Are there restrictions on the cell type we should filter out here ?
+ long aSpaceToFill = ( colWidth - aTextSize.Width() );
+
+ if ( aSpaceToFill <= charWidth )
+ return;
+
+ long nCharsToInsert = aSpaceToFill / charWidth;
+ for ( int i = 0; i < nCharsToInsert; ++i )
+ aString.Insert( nChar, nPos );
+
+ TextChanged();
+}
+
void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
{
// #i113045# do the single-character width calculations in logic units
@@ -1618,6 +1654,7 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
bCellIsValue || bRepeat || bShrink, bBreak, false,
aAreaParam );
+ aVars.RepeatToFill( aAreaParam.mnColWidth - nTotalMargin );
if ( bShrink )
{
if ( aVars.GetOrient() != SVX_ORIENTATION_STANDARD )
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx
index 1249250bbe2b..7f2a7ff7c3bd 100644
--- a/svl/inc/svl/zforlist.hxx
+++ b/svl/inc/svl/zforlist.hxx
@@ -483,11 +483,11 @@ public:
/// Format a number according to a format index, return string and color
void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex,
- String& sOutString, Color** ppColor );
+ String& sOutString, Color** ppColor, bool bUseStarFormat = false );
/// Format a number according to a format index, return string and color
void GetOutputString( const double& fOutNumber, sal_uInt32 nFIndex,
- rtl::OUString& sOutString, Color** ppColor );
+ rtl::OUString& sOutString, Color** ppColor, bool bUseStarFormat = false );
/** Format a string according to a format index, return string and color.
Formats only if the format code is of type text or the 4th subcode
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 5a6848c7238e..d897274e002d 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1546,7 +1546,8 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
void SvNumberFormatter::GetOutputString(const double& fOutNumber,
sal_uInt32 nFIndex,
String& sOutString,
- Color** ppColor)
+ Color** ppColor,
+ bool bUseStarFormat )
{
if (bNoZero && fOutNumber == 0.0)
{
@@ -1557,13 +1558,17 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
if (!pFormat)
pFormat = GetFormatEntry(ZF_STANDARD);
ChangeIntl(pFormat->GetLanguage());
+ if ( bUseStarFormat )
+ pFormat->SetStarFormatSupport( true );
pFormat->GetOutputString(fOutNumber, sOutString, ppColor);
+ if ( bUseStarFormat )
+ pFormat->SetStarFormatSupport( false );
}
void SvNumberFormatter::GetOutputString(String& sString,
sal_uInt32 nFIndex,
String& sOutString,
- Color** ppColor)
+ Color** ppColor )
{
SvNumberformat* pFormat = GetFormatEntry( nFIndex );
if (!pFormat)
@@ -1583,7 +1588,8 @@ void SvNumberFormatter::GetOutputString(String& sString,
void SvNumberFormatter::GetOutputString(const double& fOutNumber,
sal_uInt32 nFIndex,
rtl::OUString& sOutString,
- Color** ppColor)
+ Color** ppColor,
+ bool bUseStarFormat )
{
if (bNoZero && fOutNumber == 0.0)
{
@@ -1595,7 +1601,11 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
pFormat = GetFormatEntry(ZF_STANDARD);
ChangeIntl(pFormat->GetLanguage());
String aOutString;
+ if ( bUseStarFormat )
+ pFormat->SetStarFormatSupport( true );
pFormat->GetOutputString(fOutNumber, aOutString, ppColor);
+ if ( bUseStarFormat )
+ pFormat->SetStarFormatSupport( false );
sOutString = aOutString;
}