summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-04-22 10:03:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-04-22 10:03:48 +0200
commitb2e6ac535eb923336a99f9ebfcd4b50fce1790a0 (patch)
treea49eff019e13e16820eaa0d7f90652ad9083293f
parentd83dfeb5e59c8f3de12d673b001a44001f644e7d (diff)
Do not unconditionally throw NoSuchElementException
...this fixes 1a9463277006e8e5a8c0b82bbf5d5ab2d5ea15ac "coverity#704274 Logically dead code" and JunitTest_sc_unoapi. Change-Id: I20fc5262d6198fca1c7dfc970a7f8664c325aa91
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx12
1 files changed, 4 insertions, 8 deletions
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 4aebc8a0ebac..567439f7549a 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -3230,27 +3230,23 @@ Any SAL_CALL ScDataPilotItemsObj::getByName( const OUString& aName )
{
SolarMutexGuard aGuard;
Reference<XNameAccess> xMembers = GetMembers();
- Any aRet;
if (xMembers.is())
{
Reference<XIndexAccess> xMembersIndex(new ScNameToIndexAccess( xMembers ));
sal_Int32 nCount = xMembersIndex->getCount();
- sal_Bool bFound(false);
sal_Int32 nItem = 0;
- while (nItem < nCount && !bFound )
+ while (nItem < nCount)
{
Reference<XNamed> xMember(xMembersIndex->getByIndex(nItem), UNO_QUERY);
if (xMember.is() && (aName == xMember->getName()))
{
- aRet = Any( Reference< XPropertySet >( GetObjectByIndex_Impl( nItem ) ) );
- break;
+ return Any( Reference< XPropertySet >( GetObjectByIndex_Impl( nItem ) ) );
}
++nItem;
}
- if (!bFound)
- throw NoSuchElementException();
+ throw NoSuchElementException();
}
- return aRet;
+ return Any();
}
Sequence<OUString> SAL_CALL ScDataPilotItemsObj::getElementNames()
: https://gerrit.libreoffice.org/64389 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-12-28tdf#104870 - Impress crashes switching views in read-only modeTamás Zolnai We need to check read only mode similar to SidebarController::CreatePanels() method. Otherwise SfxUnoPanels::getByName() creates an invalid panel. Change-Id: Ib7801b81c95f3f505a06c00f749ba4ed5809bfe0 Reviewed-on: https://gerrit.libreoffice.org/47116 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> 2017-09-23loplugin:flatten in sdext..stocNoel Grandin Change-Id: I460e813e20a691c53738373376d3363f553bbab2 Reviewed-on: https://gerrit.libreoffice.org/42636 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-02-06Add missing #includesStephan Bergmann ...and remove some unncessary using directives/declarations, in preparation of removing now-unnecessary #includes from cppumaker-generated files, post e57ca02849c3d87142ff5ff9099a212e72b8139c "Remove dynamic exception specifications". Change-Id: Iaf1f268871e2ee1d1c76cf90f03557527ebc9067 2017-01-26Remove dynamic exception specificationsStephan Bergmann ...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> 2015-10-29com::sun::star->css in sfx2Noel Grandin Change-Id: I20d9b45e4b28c2a4a511774d3154aceb0471d197 Reviewed-on: https://gerrit.libreoffice.org/19643 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> 2015-07-12use XController instead of XFrame where it makes senseMarkus Mohrhard Change-Id: I22990c861c0dd9d9dab3fbdbc35fdb2b51e82005 2015-06-22new uno sidebar api tdf#91806Laurent Godard the entry point is SfxBaseController::getSidebar() the Decks and panels are now per SidebarController and not global anymore ' macro example Sub testSidebarApi controller = thisComponent.currentcontroller frameIni = thisComponent.currentcontroller.frame sidebar = thisComponent.currentcontroller.getSidebar() sidebar.setVisible(true) frame = sidebar.getFrame() decks = sidebar.getdecks() c = decks.count h = decks.hasElements() e = decks.getElementNames() a = decks.hasByName("MyDeck") deck = decks.getByName("MyDeck") deck.activate(true) t = deck.getTitle() deck.setTitle("new deck title") deck.moveFirst() deck.moveLast() deck.moveUp() deck.moveDown() index = deck.getOrderIndex() panels = deck.getPanels() ep = panels.getElementnames() ap = panels.hasByName("aPanelName") panel = panels.getByName("aPanelName") panel.setTitle("new panel title") panel.collapse() panel.expand(true) ' expand and collapse other index = panel.getOrderIndex() panel.moveLast() panel.moveFirst() panel.moveDown() panel.moveUp() End Sub Change-Id: I7a4b953f2277dea483bb296ba6ead35de7205ace Reviewed-on: https://gerrit.libreoffice.org/15856 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>