diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-31 16:28:51 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-31 22:34:12 -0400 |
commit | 7312939f953e00237b524da17351cf4a38a1ba2b (patch) | |
tree | 6e0afa2a730df80a2230e4419ad2048fad992952 | |
parent | 6af23840bbf5be90b617f7e63deb074359e3e8a6 (diff) |
Removed unnecessary scoping.
The if condition is true, the method simply returns. There is no
need to have this else scope which would increase the indent level
for no good reason.
-rw-r--r-- | sc/source/core/data/documen5.cxx | 128 |
1 files changed, 63 insertions, 65 deletions
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index b9519fbd1965..f9a0db271518 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -695,87 +695,85 @@ void ScDocument::UpdateChartListenerCollection() bChartListenerCollectionNeedsUpdate = false; if (!pDrawLayer) return; - else + + ScRange aRange; + // Range for searching is not important + ScChartListener aCLSearcher( EMPTY_STRING, this, aRange ); + for (SCTAB nTab=0; nTab< static_cast<SCTAB>(maTabs.size()); nTab++) { - ScRange aRange; - // Range for searching is not important - ScChartListener aCLSearcher( EMPTY_STRING, this, aRange ); - for (SCTAB nTab=0; nTab< static_cast<SCTAB>(maTabs.size()); nTab++) + if (maTabs[nTab]) { - if (maTabs[nTab]) - { - SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); - OSL_ENSURE(pPage,"Page ?"); + SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); + OSL_ENSURE(pPage,"Page ?"); - if (!pPage) - continue; + if (!pPage) + continue; - SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); - SdrObject* pObject = aIter.Next(); - while (pObject) + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + SdrObject* pObject = aIter.Next(); + while (pObject) + { + if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) { - if ( pObject->GetObjIdentifier() == OBJ_OLE2 ) + String aObjName = ((SdrOle2Obj*)pObject)->GetPersistName(); + aCLSearcher.SetString( aObjName ); + sal_uInt16 nIndex; + if ( pChartListenerCollection->Search( &aCLSearcher, nIndex ) ) { - String aObjName = ((SdrOle2Obj*)pObject)->GetPersistName(); - aCLSearcher.SetString( aObjName ); - sal_uInt16 nIndex; - if ( pChartListenerCollection->Search( &aCLSearcher, nIndex ) ) - { - ((ScChartListener*) (pChartListenerCollection-> - At( nIndex )))->SetUsed( sal_True ); - } - else if ( lcl_StringInCollection( pOtherObjects, aObjName ) ) - { - // non-chart OLE object -> don't touch - } - else + ((ScChartListener*) (pChartListenerCollection-> + At( nIndex )))->SetUsed( sal_True ); + } + else if ( lcl_StringInCollection( pOtherObjects, aObjName ) ) + { + // non-chart OLE object -> don't touch + } + else + { + bool bIsChart = false; + + uno::Reference< embed::XEmbeddedObject > xIPObj = ((SdrOle2Obj*)pObject)->GetObjRef(); + OSL_ENSURE( xIPObj.is(), "No embedded object is given!"); + uno::Reference< ::com::sun::star::chart2::data::XDataReceiver > xReceiver; + uno::Reference< embed::XComponentSupplier > xCompSupp( xIPObj, uno::UNO_QUERY ); + if( xCompSupp.is()) + xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); + + // if the object is a chart2::XDataReceiver, we must attach as XDataProvider + if( xReceiver.is() && + !PastingDrawFromOtherDoc()) { - bool bIsChart = false; - - uno::Reference< embed::XEmbeddedObject > xIPObj = ((SdrOle2Obj*)pObject)->GetObjRef(); - OSL_ENSURE( xIPObj.is(), "No embedded object is given!"); - uno::Reference< ::com::sun::star::chart2::data::XDataReceiver > xReceiver; - uno::Reference< embed::XComponentSupplier > xCompSupp( xIPObj, uno::UNO_QUERY ); - if( xCompSupp.is()) - xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); - - // if the object is a chart2::XDataReceiver, we must attach as XDataProvider - if( xReceiver.is() && - !PastingDrawFromOtherDoc()) - { - // NOTE: this currently does not work as we are - // unable to set the data. So a chart from the - // same document is treated like a chart with - // own data for the time being. + // NOTE: this currently does not work as we are + // unable to set the data. So a chart from the + // same document is treated like a chart with + // own data for the time being. - // data provider - // number formats supplier + // data provider + // number formats supplier - // data ? - // how to set?? Defined in XML-file, which is already loaded!!! - // => we have to do this stuff here, BEFORE the chart is actually loaded - } + // data ? + // how to set?? Defined in XML-file, which is already loaded!!! + // => we have to do this stuff here, BEFORE the chart is actually loaded + } - if (!bIsChart) - { - // put into list of other ole objects, so the object doesn't have to - // be swapped in the next time UpdateChartListenerCollection is called - //! remove names when objects are no longer there? - // (object names aren't used again before reloading the document) - - if (!pOtherObjects) - pOtherObjects = new ScStrCollection; - pOtherObjects->Insert( new StrData( aObjName ) ); - } + if (!bIsChart) + { + // put into list of other ole objects, so the object doesn't have to + // be swapped in the next time UpdateChartListenerCollection is called + //! remove names when objects are no longer there? + // (object names aren't used again before reloading the document) + + if (!pOtherObjects) + pOtherObjects = new ScStrCollection; + pOtherObjects->Insert( new StrData( aObjName ) ); } } - pObject = aIter.Next(); } + pObject = aIter.Next(); } } - // alle nicht auf SetUsed gesetzten loeschen - pChartListenerCollection->FreeUnused(); } + // alle nicht auf SetUsed gesetzten loeschen + pChartListenerCollection->FreeUnused(); } void ScDocument::AddOLEObjectToCollection(const String& rName) |