diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-20 00:46:19 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-05-03 20:28:15 -0400 |
commit | 4aeb8aff9e418aef1fde4b2b60333216cc527f13 (patch) | |
tree | 95423fbf41b16708f4d8d91ac50d96981d9ebf0c /sc | |
parent | 9b99bf09a25d9c9016a1c6b730fa0ef1cc5bc04a (diff) |
New menu now inserts current time into cell.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/editutil.hxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/documen8.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/editutil.cxx | 50 | ||||
-rw-r--r-- | sc/source/filter/rtf/expbase.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleText.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh8.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/textuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 2 |
14 files changed, 67 insertions, 54 deletions
diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx index 35bb41b36e2d..0a245051ee66 100644 --- a/sc/inc/editutil.hxx +++ b/sc/inc/editutil.hxx @@ -204,14 +204,15 @@ struct ScHeaderFieldData class SC_DLLPUBLIC ScFieldEditEngine : public ScEditEngineDefaulter { private: - sal_Bool bExecuteURL; + ScDocument* mpDoc; + bool bExecuteURL; public: - ScFieldEditEngine( SfxItemPool* pEnginePool, - SfxItemPool* pTextObjectPool = NULL, - sal_Bool bDeleteEnginePool = false ); + ScFieldEditEngine( + ScDocument* pDoc, SfxItemPool* pEnginePool, SfxItemPool* pTextObjectPool = NULL, + bool bDeleteEnginePool = false); - void SetExecuteURL(sal_Bool bSet) { bExecuteURL = bSet; } + void SetExecuteURL(bool bSet) { bExecuteURL = bSet; } virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16, sal_uInt16 ); virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rTxtColor, Color*& rFldColor ); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 393e18e7d1fd..c28249a6d827 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -962,8 +962,7 @@ void ScColumn::RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow ) // auf Attribute testen if ( !pEngine ) { - //pEngine = new ScTabEditEngine(pDocument); - pEngine = new ScFieldEditEngine( pDocument->GetEditPool() ); + pEngine = new ScFieldEditEngine(pDocument, pDocument->GetEditPool()); // EE_CNTRL_ONLINESPELLING falls schon Fehler drin sind pEngine->SetControlWord( pEngine->GetControlWord() | EE_CNTRL_ONLINESPELLING ); pDocument->ApplyAsianEditSettings( *pEngine ); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index c22d9778d3f9..8df10964205e 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -515,7 +515,7 @@ ScFieldEditEngine& ScDocument::GetEditEngine() { if ( !pEditEngine ) { - pEditEngine = new ScFieldEditEngine( GetEnginePool(), GetEditPool() ); + pEditEngine = new ScFieldEditEngine(this, GetEnginePool(), GetEditPool()); pEditEngine->SetUpdateMode( false ); pEditEngine->EnableUndo( false ); pEditEngine->SetRefMapMode( MAP_100TH_MM ); @@ -1092,8 +1092,8 @@ ScFieldEditEngine* ScDocument::CreateFieldEditEngine() ScFieldEditEngine* pNewEditEngine = NULL; if (!pCacheFieldEditEngine) { - pNewEditEngine = new ScFieldEditEngine( GetEnginePool(), - GetEditPool(), false ); + pNewEditEngine = new ScFieldEditEngine( + this, GetEnginePool(), GetEditPool(), false); } else { diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 9e207c7c93db..1d1407803cf7 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -1545,7 +1545,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp nType == com::sun::star::i18n::TransliterationModulesExtra::TITLE_CASE ) ) ) { if (!pEngine) - pEngine = new ScFieldEditEngine( GetEnginePool(), GetEditPool() ); + pEngine = new ScFieldEditEngine(this, GetEnginePool(), GetEditPool()); // defaults from cell attributes must be set so right language is used const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab ); diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index b513cb26a14c..af953e56f87b 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -696,11 +696,11 @@ String ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField, // //------------------------------------------------------------------------ -ScFieldEditEngine::ScFieldEditEngine( SfxItemPool* pEnginePoolP, - SfxItemPool* pTextObjectPool, sal_Bool bDeleteEnginePoolP ) - : +ScFieldEditEngine::ScFieldEditEngine( + ScDocument* pDoc, SfxItemPool* pEnginePoolP, + SfxItemPool* pTextObjectPool, bool bDeleteEnginePoolP) : ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ), - bExecuteURL( sal_True ) + mpDoc(pDoc), bExecuteURL(true) { if ( pTextObjectPool ) SetEditTextObjectPool( pTextObjectPool ); @@ -713,41 +713,51 @@ String ScFieldEditEngine::CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 /* nPara */, sal_uInt16 /* nPos */, Color*& rTxtColor, Color*& /* rFldColor */ ) { - String aRet; + rtl::OUString aRet; const SvxFieldData* pFieldData = rField.GetField(); - if ( pFieldData ) - { - TypeId aType = pFieldData->Type(); + if (!pFieldData) + return rtl::OUString(" "); - if (aType == TYPE(SvxURLField)) + sal_uInt16 nClsId = pFieldData->GetClassId(); + switch (nClsId) + { + case SVX_URLFIELD: { - String aURL = ((const SvxURLField*)pFieldData)->GetURL(); + const SvxURLField* pField = static_cast<const SvxURLField*>(pFieldData); + rtl::OUString aURL = pField->GetURL(); - switch ( ((const SvxURLField*)pFieldData)->GetFormat() ) + switch (pField->GetFormat()) { case SVXURLFORMAT_APPDEFAULT: //!!! einstellbar an App??? case SVXURLFORMAT_REPR: - aRet = ((const SvxURLField*)pFieldData)->GetRepresentation(); - break; - + aRet = pField->GetRepresentation(); + break; case SVXURLFORMAT_URL: aRet = aURL; - break; + break; + default: + ; } svtools::ColorConfigEntry eEntry = - INetURLHistory::GetOrCreate()->QueryUrl( aURL ) ? svtools::LINKSVISITED : svtools::LINKS; + INetURLHistory::GetOrCreate()->QueryUrl(String(aURL)) ? svtools::LINKSVISITED : svtools::LINKS; rTxtColor = new Color( SC_MOD()->GetColorConfig().GetColorValue(eEntry).nColor ); } - else + break; + case SVX_EXT_TIMEFIELD: { - aRet = '?'; + const SvxExtTimeField* pField = static_cast<const SvxExtTimeField*>(pFieldData); + if (mpDoc) + aRet = pField->GetFormatted(*mpDoc->GetFormatTable(), ScGlobal::eLnge); } + break; + default: + aRet = "?"; } - if (!aRet.Len()) // leer ist baeh - aRet = ' '; // Space ist Default der Editengine + if (aRet.isEmpty()) // leer ist baeh + aRet = " "; // Space ist Default der Editengine return aRet; } diff --git a/sc/source/filter/rtf/expbase.cxx b/sc/source/filter/rtf/expbase.cxx index 0cef3029017f..e19e72961a87 100644 --- a/sc/source/filter/rtf/expbase.cxx +++ b/sc/source/filter/rtf/expbase.cxx @@ -98,7 +98,7 @@ sal_Bool ScExportBase::IsEmptyTable( SCTAB nTab ) const ScFieldEditEngine& ScExportBase::GetEditEngine() const { if ( !pEditEngine ) - ((ScExportBase*)this)->pEditEngine = new ScFieldEditEngine( pDoc->GetEditPool() ); + ((ScExportBase*)this)->pEditEngine = new ScFieldEditEngine(pDoc, pDoc->GetEditPool()); return *pEditEngine; } diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index d9a4486425fa..9d55c9772803 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1166,7 +1166,7 @@ SvxTextForwarder* ScAccessibleEditLineTextData::GetTextForwarder() { SfxItemPool* pEnginePool = EditEngine::CreatePool(); pEnginePool->FreezeIdRanges(); - mpEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); + mpEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true); mbEditEngineCreated = sal_True; mpEditEngine->EnableUndo( false ); mpEditEngine->SetRefMapMode( MAP_100TH_MM ); @@ -1386,7 +1386,7 @@ SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder() { SfxItemPool* pEnginePool = EditEngine::CreatePool(); pEnginePool->FreezeIdRanges(); - pEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); + pEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true); } pEditEngine->EnableUndo( false ); if (pDocShell) @@ -1619,7 +1619,7 @@ SvxTextForwarder* ScAccessibleNoteTextData::GetTextForwarder() { SfxItemPool* pEnginePool = EditEngine::CreatePool(); pEnginePool->FreezeIdRanges(); - mpEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); + mpEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true); } mpEditEngine->EnableUndo( false ); if (mpDocSh) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index f879e78e0379..62bbe1a6d8c4 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -620,11 +620,11 @@ void ScInputHandler::ImplCreateEditEngine() { if ( pActiveViewSh ) { - const ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument(); - pEngine = new ScFieldEditEngine( pDoc->GetEnginePool(), pDoc->GetEditPool() ); + ScDocument* pDoc = pActiveViewSh->GetViewData()->GetDocShell()->GetDocument(); + pEngine = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool()); } else - pEngine = new ScFieldEditEngine( EditEngine::CreatePool(), NULL, true ); + pEngine = new ScFieldEditEngine(NULL, EditEngine::CreatePool(), NULL, true); pEngine->SetWordDelimiters( ScEditUtil::ModifyDelimiters( pEngine->GetWordDelimiters() ) ); UpdateRefDevice(); // also sets MapMode pEngine->SetPaperSize( Size( 1000000, 1000000 ) ); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 7fa55dfc323e..6f7caa645af2 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1331,11 +1331,11 @@ void ScMultiTextWnd::InitEditEngine() if ( pViewSh ) { pDocSh = pViewSh->GetViewData()->GetDocShell(); - const ScDocument* pDoc = pViewSh->GetViewData()->GetDocument(); - pNew = new ScFieldEditEngine( pDoc->GetEnginePool(), pDoc->GetEditPool() ); + ScDocument* pDoc = pViewSh->GetViewData()->GetDocument(); + pNew = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool()); } else - pNew = new ScFieldEditEngine( EditEngine::CreatePool(), NULL, sal_True ); + pNew = new ScFieldEditEngine(NULL, EditEngine::CreatePool(), NULL, true); pNew->SetExecuteURL( false ); pEditEngine = pNew; @@ -1716,11 +1716,11 @@ void ScTextWnd::StartEditEngine() ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); if ( pViewSh ) { - const ScDocument* pDoc = pViewSh->GetViewData()->GetDocument(); - pNew = new ScFieldEditEngine( pDoc->GetEnginePool(), pDoc->GetEditPool() ); + ScDocument* pDoc = pViewSh->GetViewData()->GetDocument(); + pNew = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool()); } else - pNew = new ScFieldEditEngine( EditEngine::CreatePool(), NULL, sal_True ); + pNew = new ScFieldEditEngine(NULL, EditEngine::CreatePool(), NULL, true); pNew->SetExecuteURL( false ); pEditEngine = pNew; @@ -1947,11 +1947,11 @@ void ScTextWnd::MakeDialogEditView() ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); if ( pViewSh ) { - const ScDocument* pDoc = pViewSh->GetViewData()->GetDocument(); - pNew = new ScFieldEditEngine( pDoc->GetEnginePool(), pDoc->GetEditPool() ); + ScDocument* pDoc = pViewSh->GetViewData()->GetDocument(); + pNew = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool()); } else - pNew = new ScFieldEditEngine( EditEngine::CreatePool(), NULL, sal_True ); + pNew = new ScFieldEditEngine(NULL, EditEngine::CreatePool(), NULL, true); pNew->SetExecuteURL( false ); pEditEngine = pNew; diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index af910768d143..ba1c7839f6da 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -823,7 +823,7 @@ sal_uLong ScDocShell::DBaseExport( const rtl::OUString& rFullFileName, CharSet e bHasMemo, eCharSet ); // also needed for exception catch SCROW nDocRow = 0; - ScFieldEditEngine aEditEngine( aDocument.GetEditPool() ); + ScFieldEditEngine aEditEngine(&aDocument, aDocument.GetEditPool()); rtl::OUString aString; String aTabName; diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index b6fd42965e71..afaa7a595e74 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -885,7 +885,7 @@ ScSimpleEditSourceHelper::ScSimpleEditSourceHelper() pEnginePool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM ); pEnginePool->FreezeIdRanges(); - pEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); // TRUE: become owner of pool + pEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true); // TRUE: become owner of pool pForwarder = new SvxEditEngineForwarder( *pEditEngine ); pOriginalSource = new ScSimpleEditSource( pForwarder ); } @@ -985,7 +985,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder() { SfxItemPool* pEnginePool = EditEngine::CreatePool(); pEnginePool->FreezeIdRanges(); - pEditEngine = new ScFieldEditEngine( pEnginePool, NULL, sal_True ); + pEditEngine = new ScFieldEditEngine(NULL, pEnginePool, NULL, true); } // currently, GetPortions doesn't work if UpdateMode is sal_False, // this will be fixed (in EditEngine) by src600 diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 8b05f33ce43b..197b0041d4ac 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -615,7 +615,11 @@ void ScEditShell::Execute( SfxRequest& rReq ) lclInsertCharacter( pTableView, pTopView, CHAR_ZWNBSP ); break; case SID_INSERT_FIELD_TEST: - fprintf(stdout, "ScEditShell::Execute: SID_INSERT_FIELD_TEST\n"); + { + SvxExtTimeField aField; + SvxFieldItem aItem(aField, EE_FEATURE_FIELD); + pTableView->InsertField(aItem); + } break; } @@ -718,7 +722,6 @@ void ScEditShell::GetState( SfxItemSet& rSet ) } break; case SID_INSERT_FIELD_TEST: - fprintf(stdout, "ScEditShell::GetState: SID_INSERT_FIELD_TEST\n"); break; } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 8b243dfc1319..c0f0a385ff6e 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5085,7 +5085,7 @@ bool ScGridWindow::GetEditUrlOrError( bool bSpellErr, const Point& rPos, // EditEngine - ScFieldEditEngine aEngine( pDoc->GetEditPool() ); + ScFieldEditEngine aEngine(pDoc, pDoc->GetEditPool()); ScSizeDeviceProvider aProv(pDocSh); aEngine.SetRefDevice( aProv.GetDevice() ); aEngine.SetRefMapMode( MAP_100TH_MM ); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index bca73f5ca7a4..a91a7fe86526 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -2001,7 +2001,7 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic ) ScFieldEditEngine* ScOutputData::CreateOutputEditEngine() { - ScFieldEditEngine* pEngine = new ScFieldEditEngine( pDoc->GetEnginePool() ); + ScFieldEditEngine* pEngine = new ScFieldEditEngine(pDoc, pDoc->GetEnginePool()); pEngine->SetUpdateMode( false ); // a RefDevice always has to be set, otherwise EditEngine would create a VirtualDevice pEngine->SetRefDevice( pFmtDevice ); |