diff options
Diffstat (limited to 'sc/source/ui/view/output2.cxx')
-rw-r--r-- | sc/source/ui/view/output2.cxx | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index b1d6787d3ce6..2df47d16e195 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -532,9 +532,9 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) if (eType == CELLTYPE_FORMULA) { ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell); - if (pFCell->GetErrCode() != 0) + if (pFCell->GetErrCode() != 0 || pOutput->bShowFormulas) { - SetHashText(); // If the error string doesn't fit, always use "###" + SetHashText(); // If the error string doesn't fit, always use "###". Also for "display formulas" (#i116691#) return; } // If it's formula, the result must be a value. @@ -1905,6 +1905,26 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic ) // ------------------------------------------------------------------------------- +ScFieldEditEngine* ScOutputData::CreateOutputEditEngine() +{ + ScFieldEditEngine* pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); + pEngine->SetUpdateMode( sal_False ); + // a RefDevice always has to be set, otherwise EditEngine would create a VirtualDevice + pEngine->SetRefDevice( pFmtDevice ); + sal_uInt32 nCtrl = pEngine->GetControlWord(); + if ( bShowSpellErrors ) + nCtrl |= EE_CNTRL_ONLINESPELLING; + if ( eType == OUTTYPE_PRINTER ) + nCtrl &= ~EE_CNTRL_MARKFIELDS; + if ( eType == OUTTYPE_WINDOW && pRefDevice == pFmtDevice ) + nCtrl &= ~EE_CNTRL_FORMAT100; // use the actual MapMode + pEngine->SetControlWord( nCtrl ); + pDoc->ApplyAsianEditSettings( *pEngine ); + pEngine->EnableAutoColor( bUseStyleColor ); + pEngine->SetDefaultHorizontalTextDirection( (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); + return pEngine; +} + void lcl_ClearEdit( EditEngine& rEngine ) // Text und Attribute { rEngine.SetUpdateMode( sal_False ); @@ -2221,29 +2241,10 @@ void ScOutputData::DrawEdit(sal_Bool bPixelToLogic) // if (!pEngine) - { - // Ein RefDevice muss auf jeden Fall gesetzt werden, - // sonst legt sich die EditEngine ein VirtualDevice an! - pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); - pEngine->SetUpdateMode( sal_False ); - pEngine->SetRefDevice( pFmtDevice ); // always set - sal_uLong nCtrl = pEngine->GetControlWord(); - if ( bShowSpellErrors ) - nCtrl |= EE_CNTRL_ONLINESPELLING; - if ( eType == OUTTYPE_PRINTER ) - nCtrl &= ~EE_CNTRL_MARKFIELDS; - pEngine->SetControlWord( nCtrl ); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); - pEngine->EnableAutoColor( bUseStyleColor ); - pEngine->SetDefaultHorizontalTextDirection( - (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); - } + pEngine = CreateOutputEditEngine(); else lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) - sal_Bool bCellIsValue = lcl_SafeIsValue(pCell); SvxCellHorJustify eHorJust = (SvxCellHorJustify)((const SvxHorJustifyItem&) @@ -2285,8 +2286,6 @@ void ScOutputData::DrawEdit(sal_Bool bPixelToLogic) eHorJust = SVX_HOR_JUSTIFY_RIGHT; } - - SvxCellHorJustify eOutHorJust = ( eHorJust != SVX_HOR_JUSTIFY_STANDARD ) ? eHorJust : ( bCellIsValue ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT ); @@ -3054,25 +3053,7 @@ void ScOutputData::DrawRotated(sal_Bool bPixelToLogic) if (!bHidden) { if (!pEngine) - { - // Ein RefDevice muss auf jeden Fall gesetzt werden, - // sonst legt sich die EditEngine ein VirtualDevice an! - pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); - pEngine->SetUpdateMode( sal_False ); - pEngine->SetRefDevice( pFmtDevice ); // always set - sal_uLong nCtrl = pEngine->GetControlWord(); - if ( bShowSpellErrors ) - nCtrl |= EE_CNTRL_ONLINESPELLING; - if ( eType == OUTTYPE_PRINTER ) - nCtrl &= ~EE_CNTRL_MARKFIELDS; - pEngine->SetControlWord( nCtrl ); - pEngine->SetForbiddenCharsTable( pDoc->GetForbiddenCharacters() ); - pEngine->SetAsianCompressionMode( pDoc->GetAsianCompression() ); - pEngine->SetKernAsianPunctuation( pDoc->GetAsianKerning() ); - pEngine->EnableAutoColor( bUseStyleColor ); - pEngine->SetDefaultHorizontalTextDirection( - (EEHorizontalTextDirection)pDoc->GetEditTextDirection( nTab ) ); - } + pEngine = CreateOutputEditEngine(); else lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) |