summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-25 16:05:29 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-26 09:58:05 -0400
commitfb43bca9085d841a1196b168fa7c8c09b97e8b8a (patch)
treeb4c5773b18593a5c446e7c5011825fe27e952d28 /sc
parenta863285a5c4da41ae2b67c0c5b17887aea13b70c (diff)
Make GetObjectByIndex_Impl consistent.
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/fielduno.hxx4
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx28
2 files changed, 18 insertions, 14 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 572019463115..80efb2403ee8 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -146,7 +146,9 @@ private:
/// mutex to lock the InterfaceContainerHelper
osl::Mutex aMutex;
- ScEditFieldObj* GetObjectByIndex_Impl(sal_Int32 Index) const;
+ com::sun::star::uno::Reference<
+ com::sun::star::text::XTextField>
+ GetObjectByIndex_Impl(sal_Int32 Index) const;
public:
ScHeaderFieldsObj(ScHeaderFooterTextData& rData);
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 96acd230a5b3..383e136e0efb 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -293,18 +293,17 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
//! Feld-Funktionen muessen an den Forwarder !!!
ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
ScUnoEditEngine aTempEngine(pEditEngine);
+ SvxFieldData* pData = aTempEngine.FindByIndex(static_cast<sal_uInt16>(Index), 0);
+ if (!pData)
+ return uno::Reference<text::XTextField>();
- if ( aTempEngine.FindByIndex( (sal_uInt16)Index, NULL ) ) // in der Zelle ist der Typ egal
- {
- sal_uInt16 nPar = aTempEngine.GetFieldPar();
- xub_StrLen nPos = aTempEngine.GetFieldPos();
- ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Feld ist 1 Zeichen
- uno::Reference<text::XTextRange> xContent(new ScCellObj(pDocShell, aCellPos));
- uno::Reference<text::XTextField> xRet(
- new ScEditFieldObj(xContent, new ScCellEditSource(pDocShell, aCellPos), ScEditFieldObj::URL, aSelection));
- return xRet;
- }
- return uno::Reference<text::XTextField>();
+ sal_uInt16 nPar = aTempEngine.GetFieldPar();
+ xub_StrLen nPos = aTempEngine.GetFieldPos();
+ ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Feld ist 1 Zeichen
+ uno::Reference<text::XTextRange> xContent(new ScCellObj(pDocShell, aCellPos));
+ uno::Reference<text::XTextField> xRet(
+ new ScEditFieldObj(xContent, new ScCellEditSource(pDocShell, aCellPos), ScEditFieldObj::URL, aSelection));
+ return xRet;
}
sal_Int32 SAL_CALL ScCellFieldsObj::getCount() throw(uno::RuntimeException)
@@ -489,7 +488,7 @@ ScEditFieldObj::FieldType getFieldType(sal_uInt16 nOldType)
}
-ScEditFieldObj* ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
+uno::Reference<text::XTextField> ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
{
//! Feld-Funktionen muessen an den Forwarder !!!
ScEditEngineDefaulter* pEditEngine = mpEditSource->GetEditEngine();
@@ -517,7 +516,10 @@ ScEditFieldObj* ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
uno::Reference<text::XTextRange> xTemp(xText, uno::UNO_QUERY);
xTextRange = xTemp;
ScEditFieldObj::FieldType eRealType = getFieldType(pData->GetClassId());
- return new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection);
+
+ uno::Reference<text::XTextField> xRet(
+ new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection));
+ return xRet;
}
sal_Int32 SAL_CALL ScHeaderFieldsObj::getCount() throw(uno::RuntimeException)