diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-08-27 17:08:40 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-08-27 17:09:26 -0400 |
commit | 7c3efe8b1ec847d36ef3bf3b4f98833b30a4655e (patch) | |
tree | cf7f3da52655d6bdaf7daa7d04765d7bf64d750e /sc/source/ui/view/output2.cxx | |
parent | e5386d695cfafa83c7de608efcd894ec565a98b4 (diff) |
Extracted a common code block.
Diffstat (limited to 'sc/source/ui/view/output2.cxx')
-rw-r--r-- | sc/source/ui/view/output2.cxx | 82 |
1 files changed, 34 insertions, 48 deletions
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 6dcfd0050a2c..b0dba17f4507 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -4440,6 +4440,38 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) rParam.adjustForHyperlinkInPDF(aURLStart, pDev); } +namespace { + +void initEditEngine( + ScFieldEditEngine*& pEngine, ScDocument* pDoc, SCTAB nTab, OutputDevice* pFmtDevice, + ScOutputType eType, bool bShowSpellErrors, bool bUseStyleColor) +{ + 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( 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 ) ); + } + else + lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) +} + +} + void ScOutputData::DrawEdit(sal_Bool bPixelToLogic) { ScFieldEditEngine* pEngine = NULL; @@ -4545,32 +4577,7 @@ void ScOutputData::DrawEdit(sal_Bool bPixelToLogic) } if (bDoCell) { - // - // Create EditEngine - // - - 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( 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 ) ); - } - else - lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) + initEditEngine(pEngine, pDoc, nTab, pFmtDevice, eType, bShowSpellErrors, bUseStyleColor); DrawEditParam aParam(pPattern, pCondSet, lcl_SafeIsValue(pCell)); aParam.mbPixelToLogic = bPixelToLogic; @@ -4685,28 +4692,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( 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 ) ); - } - else - lcl_ClearEdit( *pEngine ); // also calls SetUpdateMode(sal_False) + initEditEngine(pEngine, pDoc, nTab, pFmtDevice, eType, bShowSpellErrors, bUseStyleColor); long nPosY = nRowPosY; sal_Bool bVisChanged = false; |