summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-25 15:32:52 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-26 09:58:05 -0400
commit86fd50854cdcf2b738c227f41e31eca92b23d5ee (patch)
treec7a0d6c17d9889c7fc4aff99b658058367ba31c6 /sc
parent17c6fee1f8c08d1fb9d2805295127618fad9a43b (diff)
Early bailout.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx61
1 files changed, 30 insertions, 31 deletions
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index c5860b78c46a..0ce59d67507c 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -488,38 +488,37 @@ ScEditFieldObj* ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) const
ScUnoEditEngine aTempEngine(pEditEngine);
SvxFieldData* pData = aTempEngine.FindByIndex((sal_uInt16)Index, 0);
- if ( pData )
- {
- sal_uInt16 nPar = aTempEngine.GetFieldPar();
- xub_StrLen nPos = aTempEngine.GetFieldPos();
-
- sal_uInt16 nFieldType = 0;
- if ( pData->ISA( SvxPageField ) ) nFieldType = SC_SERVICE_PAGEFIELD;
- else if ( pData->ISA( SvxPagesField ) ) nFieldType = SC_SERVICE_PAGESFIELD;
- else if ( pData->ISA( SvxDateField ) ) nFieldType = SC_SERVICE_DATEFIELD;
- else if ( pData->ISA( SvxTimeField ) ) nFieldType = SC_SERVICE_TIMEFIELD;
- else if ( pData->ISA( SvxFileField ) ) nFieldType = SC_SERVICE_TITLEFIELD;
- else if ( pData->ISA( SvxExtFileField ) ) nFieldType = SC_SERVICE_FILEFIELD;
- else if ( pData->ISA( SvxTableField ) ) nFieldType = SC_SERVICE_SHEETFIELD;
-
- ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Field is 1 character
- uno::Reference<text::XTextRange> xTextRange;
- ScHeaderFooterContentObj& rContentObj = mrData.GetContentObj();
- uno::Reference<text::XText> xText;
- sal_uInt16 nPart = mrData.GetPart();
- if ( nPart == SC_HDFT_LEFT )
- xText = rContentObj.getLeftText();
- else if (nPart == SC_HDFT_CENTER)
- xText = rContentObj.getCenterText();
- else
- xText = rContentObj.getRightText();
+ if (!pData)
+ return NULL;
+
+ sal_uInt16 nPar = aTempEngine.GetFieldPar();
+ xub_StrLen nPos = aTempEngine.GetFieldPos();
+
+ sal_uInt16 nFieldType = 0;
+ if ( pData->ISA( SvxPageField ) ) nFieldType = SC_SERVICE_PAGEFIELD;
+ else if ( pData->ISA( SvxPagesField ) ) nFieldType = SC_SERVICE_PAGESFIELD;
+ else if ( pData->ISA( SvxDateField ) ) nFieldType = SC_SERVICE_DATEFIELD;
+ else if ( pData->ISA( SvxTimeField ) ) nFieldType = SC_SERVICE_TIMEFIELD;
+ else if ( pData->ISA( SvxFileField ) ) nFieldType = SC_SERVICE_TITLEFIELD;
+ else if ( pData->ISA( SvxExtFileField ) ) nFieldType = SC_SERVICE_FILEFIELD;
+ else if ( pData->ISA( SvxTableField ) ) nFieldType = SC_SERVICE_SHEETFIELD;
+
+ ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Field is 1 character
+ uno::Reference<text::XTextRange> xTextRange;
+ ScHeaderFooterContentObj& rContentObj = mrData.GetContentObj();
+ uno::Reference<text::XText> xText;
+ sal_uInt16 nPart = mrData.GetPart();
+ if ( nPart == SC_HDFT_LEFT )
+ xText = rContentObj.getLeftText();
+ else if (nPart == SC_HDFT_CENTER)
+ xText = rContentObj.getCenterText();
+ else
+ xText = rContentObj.getRightText();
- uno::Reference<text::XTextRange> xTemp(xText, uno::UNO_QUERY);
- xTextRange = xTemp;
- ScEditFieldObj::FieldType eRealType = getFieldType(nFieldType);
- return new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection);
- }
- return NULL;
+ uno::Reference<text::XTextRange> xTemp(xText, uno::UNO_QUERY);
+ xTextRange = xTemp;
+ ScEditFieldObj::FieldType eRealType = getFieldType(nFieldType);
+ return new ScEditFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), eRealType, aSelection);
}
sal_Int32 SAL_CALL ScHeaderFieldsObj::getCount() throw(uno::RuntimeException)