summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 10:53:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 13:06:24 +0200
commitb9de047454c2603e2f5a5108254cd3f967e8a88b (patch)
tree589c20e48bfed9c3cfe6696c24c67d49f568c6bd /sd
parent448e9da1b440561441602e3a0956218b2702767e (diff)
loplugin:flatten in scaddins..sd
Change-Id: I190323ce910224f883c4370b2c752644a5a35edd Reviewed-on: https://gerrit.libreoffice.org/42626 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/stlfamily.cxx22
-rw-r--r--sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx8
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterView.cxx20
-rw-r--r--sd/source/ui/framework/factories/BasicPaneFactory.cxx128
-rw-r--r--sd/source/ui/framework/factories/BasicToolBarFactory.cxx9
-rw-r--r--sd/source/ui/framework/factories/BasicViewFactory.cxx54
-rw-r--r--sd/source/ui/framework/factories/FullScreenPane.cxx36
-rw-r--r--sd/source/ui/presenter/PresenterHelper.cxx42
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterService.cxx73
-rw-r--r--sd/source/ui/tools/PropertySet.cxx9
-rw-r--r--sd/source/ui/unoidl/unocpres.cxx18
11 files changed, 197 insertions, 222 deletions
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 3f06b27627d7..6bc9a7024f65 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -485,22 +485,20 @@ void SdStyleFamily::setPropertyValue( const OUString& , const Any& )
Any SdStyleFamily::getPropertyValue( const OUString& PropertyName )
{
- if ( PropertyName == "DisplayName" )
+ if ( PropertyName != "DisplayName" )
{
- SolarMutexGuard aGuard;
- OUString sDisplayName;
- switch( mnFamily )
- {
- case SD_STYLE_FAMILY_MASTERPAGE: sDisplayName = getName(); break;
- case SD_STYLE_FAMILY_CELL: sDisplayName = SdResId(STR_CELL_STYLE_FAMILY); break;
- default: sDisplayName = SdResId(STR_GRAPHICS_STYLE_FAMILY); break;
- }
- return Any( sDisplayName );
+ throw UnknownPropertyException( "unknown property: " + PropertyName, static_cast<OWeakObject *>(this) );
}
- else
+
+ SolarMutexGuard aGuard;
+ OUString sDisplayName;
+ switch( mnFamily )
{
- throw UnknownPropertyException( "unknown property: " + PropertyName, static_cast<OWeakObject *>(this) );
+ case SD_STYLE_FAMILY_MASTERPAGE: sDisplayName = getName(); break;
+ case SD_STYLE_FAMILY_CELL: sDisplayName = SdResId(STR_CELL_STYLE_FAMILY); break;
+ default: sDisplayName = SdResId(STR_GRAPHICS_STYLE_FAMILY); break;
}
+ return Any( sDisplayName );
}
void SdStyleFamily::addPropertyChangeListener( const OUString& , const Reference<XPropertyChangeListener>& )
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index 48d8bdc45081..4298e8144af7 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -219,14 +219,12 @@ uno::Reference<XAccessible> SAL_CALL
aGuard.clear();
// Forward request to children manager.
- if (pChildrenManager != nullptr)
- {
- return pChildrenManager->GetChild (nIndex);
- }
- else
+ if (pChildrenManager == nullptr)
throw lang::IndexOutOfBoundsException (
"no accessible child with index " + OUString::number(nIndex),
static_cast<uno::XWeak*>(this));
+
+ return pChildrenManager->GetChild (nIndex);
}
OUString SAL_CALL
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 8268c5506643..59246f036468 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -499,10 +499,10 @@ void SAL_CALL AccessibleSlideSorterView::selectAccessibleChild (sal_Int32 nChild
const SolarMutexGuard aSolarGuard;
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
- if (pChild != nullptr)
- mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
- else
+ if (pChild == nullptr)
throw lang::IndexOutOfBoundsException();
+
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(pChild->GetPageNumber());
}
sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int32 nChildIndex)
@@ -512,12 +512,12 @@ sal_Bool SAL_CALL AccessibleSlideSorterView::isAccessibleChildSelected (sal_Int3
const SolarMutexGuard aSolarGuard;
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
- if (pChild != nullptr)
- bIsSelected = mrSlideSorter.GetController().GetPageSelector().IsPageSelected(
- pChild->GetPageNumber());
- else
+ if (pChild == nullptr)
throw lang::IndexOutOfBoundsException();
+ bIsSelected = mrSlideSorter.GetController().GetPageSelector().IsPageSelected(
+ pChild->GetPageNumber());
+
return bIsSelected;
}
@@ -578,10 +578,10 @@ void SAL_CALL AccessibleSlideSorterView::deselectAccessibleChild (sal_Int32 nChi
const SolarMutexGuard aSolarGuard;
AccessibleSlideSorterObject* pChild = mpImpl->GetAccessibleChild(nChildIndex);
- if (pChild != nullptr)
- mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
- else
+ if (pChild == nullptr)
throw lang::IndexOutOfBoundsException();
+
+ mrSlideSorter.GetController().GetPageSelector().DeselectPage(pChild->GetPageNumber());
}
// XServiceInfo
diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
index 0660bdabd107..8f0cc742bc61 100644
--- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx
@@ -220,44 +220,7 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
return rPane.CompareURL(rxPaneId->getResourceURL());
} ));
- if (iDescriptor != mpPaneContainer->end())
- {
- if (iDescriptor->mxPane.is())
- {
- // The pane has already been created and is still active (has
- // not yet been released). This should not happen.
- xPane = iDescriptor->mxPane;
- }
- else
- {
- // Create a new pane.
- switch (iDescriptor->mePaneId)
- {
- case CenterPaneId:
- xPane = CreateFrameWindowPane(rxPaneId);
- break;
-
- case FullScreenPaneId:
- xPane = CreateFullScreenPane(mxComponentContext, rxPaneId);
- break;
-
- case LeftImpressPaneId:
- case LeftDrawPaneId:
- xPane = CreateChildWindowPane(
- rxPaneId,
- *iDescriptor);
- break;
- }
- iDescriptor->mxPane = xPane;
-
- // Listen for the pane being disposed.
- Reference<lang::XComponent> xComponent (xPane, UNO_QUERY);
- if (xComponent.is())
- xComponent->addEventListener(this);
- }
- iDescriptor->mbIsReleased = false;
- }
- else
+ if (iDescriptor == mpPaneContainer->end())
{
// The requested pane can not be created by any of the factories
// managed by the called BasicPaneFactory object.
@@ -266,6 +229,42 @@ Reference<XResource> SAL_CALL BasicPaneFactory::createResource (
0);
}
+ if (iDescriptor->mxPane.is())
+ {
+ // The pane has already been created and is still active (has
+ // not yet been released). This should not happen.
+ xPane = iDescriptor->mxPane;
+ }
+ else
+ {
+ // Create a new pane.
+ switch (iDescriptor->mePaneId)
+ {
+ case CenterPaneId:
+ xPane = CreateFrameWindowPane(rxPaneId);
+ break;
+
+ case FullScreenPaneId:
+ xPane = CreateFullScreenPane(mxComponentContext, rxPaneId);
+ break;
+
+ case LeftImpressPaneId:
+ case LeftDrawPaneId:
+ xPane = CreateChildWindowPane(
+ rxPaneId,
+ *iDescriptor);
+ break;
+ }
+ iDescriptor->mxPane = xPane;
+
+ // Listen for the pane being disposed.
+ Reference<lang::XComponent> xComponent (xPane, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->addEventListener(this);
+ }
+ iDescriptor->mbIsReleased = false;
+
+
return xPane;
}
@@ -282,33 +281,7 @@ void SAL_CALL BasicPaneFactory::releaseResource (
mpPaneContainer->end(),
[&] (PaneDescriptor const& rPane) { return rPane.ComparePane(rxPane); } ));
- if (iDescriptor != mpPaneContainer->end())
- {
- // The given pane was created by one of the factories. Child
- // windows are just hidden and will be reused when requested later.
- // Other windows are disposed and their reference is reset so that
- // on the next createPane() call for the same pane type the pane is
- // created anew.
- ChildWindowPane* pChildWindowPane = dynamic_cast<ChildWindowPane*>(rxPane.get());
- if (pChildWindowPane != nullptr)
- {
- iDescriptor->mbIsReleased = true;
- pChildWindowPane->Hide();
- }
- else
- {
- iDescriptor->mxPane = nullptr;
- Reference<XComponent> xComponent (rxPane, UNO_QUERY);
- if (xComponent.is())
- {
- // We are disposing the pane and do not have to be informed of
- // that.
- xComponent->removeEventListener(this);
- xComponent->dispose();
- }
- }
- }
- else
+ if (iDescriptor == mpPaneContainer->end())
{
// The given XPane reference is either empty or the pane was not
// created by any of the factories managed by the called
@@ -317,6 +290,31 @@ void SAL_CALL BasicPaneFactory::releaseResource (
nullptr,
0);
}
+
+ // The given pane was created by one of the factories. Child
+ // windows are just hidden and will be reused when requested later.
+ // Other windows are disposed and their reference is reset so that
+ // on the next createPane() call for the same pane type the pane is
+ // created anew.
+ ChildWindowPane* pChildWindowPane = dynamic_cast<ChildWindowPane*>(rxPane.get());
+ if (pChildWindowPane != nullptr)
+ {
+ iDescriptor->mbIsReleased = true;
+ pChildWindowPane->Hide();
+ }
+ else
+ {
+ iDescriptor->mxPane = nullptr;
+ Reference<XComponent> xComponent (rxPane, UNO_QUERY);
+ if (xComponent.is())
+ {
+ // We are disposing the pane and do not have to be informed of
+ // that.
+ xComponent->removeEventListener(this);
+ xComponent->dispose();
+ }
+ }
+
}
//===== XConfigurationChangeListener ==========================================
diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
index 8967d4b4eb72..dab3ba76d491 100644
--- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx
@@ -124,15 +124,10 @@ Reference<XResource> SAL_CALL BasicToolBarFactory::createResource (
{
ThrowIfDisposed();
- Reference<XResource> xToolBar;
-
- if (rxToolBarId->getResourceURL() == FrameworkHelper::msViewTabBarURL)
- {
- xToolBar = new ViewTabBar(rxToolBarId, mxController);
- }
- else
+ if (rxToolBarId->getResourceURL() != FrameworkHelper::msViewTabBarURL)
throw lang::IllegalArgumentException();
+ Reference<XResource> xToolBar = new ViewTabBar(rxToolBarId, mxController);;
return xToolBar;
}
diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx
index 4c8cb0203a16..f1ed3d6e8d40 100644
--- a/sd/source/ui/framework/factories/BasicViewFactory.cxx
+++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx
@@ -195,41 +195,39 @@ void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxV
[&] (std::shared_ptr<ViewDescriptor> const& pVD) {
return ViewDescriptor::CompareView(pVD, rxView);
} ));
- if (iViewShell != mpViewShellContainer->end())
+ if (iViewShell == mpViewShellContainer->end())
{
- std::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
+ throw lang::IllegalArgumentException();
+ }
+
+ std::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
- if ((*iViewShell)->mxViewId->isBoundToURL(
- FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ if ((*iViewShell)->mxViewId->isBoundToURL(
+ FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
+ {
+ // Obtain a pointer to and connect to the frame view of the
+ // view. The next view, that is created, will be
+ // initialized with this frame view.
+ if (mpFrameView == nullptr)
{
- // Obtain a pointer to and connect to the frame view of the
- // view. The next view, that is created, will be
- // initialized with this frame view.
- if (mpFrameView == nullptr)
- {
- mpFrameView = pViewShell->GetFrameView();
- if (mpFrameView)
- mpFrameView->Connect();
- }
-
- // With the view in the center pane the sub controller is
- // released, too.
- mpBase->GetDrawController().SetSubController(
- Reference<drawing::XDrawSubController>());
-
- SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
- if (pSfxViewShell != nullptr)
- pSfxViewShell->DisconnectAllClients();
+ mpFrameView = pViewShell->GetFrameView();
+ if (mpFrameView)
+ mpFrameView->Connect();
}
- ReleaseView(*iViewShell, false);
+ // With the view in the center pane the sub controller is
+ // released, too.
+ mpBase->GetDrawController().SetSubController(
+ Reference<drawing::XDrawSubController>());
- mpViewShellContainer->erase(iViewShell);
- }
- else
- {
- throw lang::IllegalArgumentException();
+ SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
+ if (pSfxViewShell != nullptr)
+ pSfxViewShell->DisconnectAllClients();
}
+
+ ReleaseView(*iViewShell, false);
+
+ mpViewShellContainer->erase(iViewShell);
}
}
diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx
index ca992a26ca66..ba2bc482b0ed 100644
--- a/sd/source/ui/framework/factories/FullScreenPane.cxx
+++ b/sd/source/ui/framework/factories/FullScreenPane.cxx
@@ -190,26 +190,24 @@ IMPL_LINK(FullScreenPane, WindowEventHandler, VclWindowEvent&, rEvent, void)
Reference<rendering::XCanvas> FullScreenPane::CreateCanvas()
{
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(mxWindow);
- if (pWindow)
- {
- Sequence<Any> aArg (5);
-
- // common: first any is VCL pointer to window (for VCL canvas)
- aArg[0] <<= reinterpret_cast<sal_Int64>(pWindow.get());
- aArg[1] = Any();
- aArg[2] <<= css::awt::Rectangle();
- aArg[3] <<= false;
- aArg[4] <<= mxWindow;
-
- Reference<lang::XMultiServiceFactory> xFactory (
- mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
- return Reference<rendering::XCanvas>(
- xFactory->createInstanceWithArguments("com.sun.star.rendering.SpriteCanvas.VCL",
- aArg),
- UNO_QUERY);
- }
- else
+ if (!pWindow)
throw RuntimeException();
+
+ Sequence<Any> aArg (5);
+
+ // common: first any is VCL pointer to window (for VCL canvas)
+ aArg[0] <<= reinterpret_cast<sal_Int64>(pWindow.get());
+ aArg[1] = Any();
+ aArg[2] <<= css::awt::Rectangle();
+ aArg[3] <<= false;
+ aArg[4] <<= mxWindow;
+
+ Reference<lang::XMultiServiceFactory> xFactory (
+ mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
+ return Reference<rendering::XCanvas>(
+ xFactory->createInstanceWithArguments("com.sun.star.rendering.SpriteCanvas.VCL",
+ aArg),
+ UNO_QUERY);
}
void FullScreenPane::ExtractArguments (
diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx
index 81222e4e71da..1ddc4296f9e1 100644
--- a/sd/source/ui/presenter/PresenterHelper.cxx
+++ b/sd/source/ui/presenter/PresenterHelper.cxx
@@ -142,29 +142,27 @@ Reference<rendering::XCanvas> SAL_CALL PresenterHelper::createCanvas (
// No shared window is given or an explicit canvas service name is
// specified. Create a new canvas.
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(rxWindow);
- if (pWindow)
- {
- Sequence<Any> aArg (5);
-
- // common: first any is VCL pointer to window (for VCL canvas)
- aArg[0] <<= reinterpret_cast<sal_Int64>(pWindow.get());
- aArg[1] = Any();
- aArg[2] <<= css::awt::Rectangle();
- aArg[3] <<= false;
- aArg[4] <<= rxWindow;
-
- Reference<lang::XMultiServiceFactory> xFactory (
- mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
- return Reference<rendering::XCanvas>(
- xFactory->createInstanceWithArguments(
- !rsOptionalCanvasServiceName.isEmpty()
- ? rsOptionalCanvasServiceName
- : OUString("com.sun.star.rendering.Canvas.VCL"),
- aArg),
- UNO_QUERY);
- }
- else
+ if (!pWindow)
throw RuntimeException();
+
+ Sequence<Any> aArg (5);
+
+ // common: first any is VCL pointer to window (for VCL canvas)
+ aArg[0] <<= reinterpret_cast<sal_Int64>(pWindow.get());
+ aArg[1] = Any();
+ aArg[2] <<= css::awt::Rectangle();
+ aArg[3] <<= false;
+ aArg[4] <<= rxWindow;
+
+ Reference<lang::XMultiServiceFactory> xFactory (
+ mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
+ return Reference<rendering::XCanvas>(
+ xFactory->createInstanceWithArguments(
+ !rsOptionalCanvasServiceName.isEmpty()
+ ? rsOptionalCanvasServiceName
+ : OUString("com.sun.star.rendering.Canvas.VCL"),
+ aArg),
+ UNO_QUERY);
}
void SAL_CALL PresenterHelper::toTop (
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
index 78517c6086f0..b6ce91cc7ba2 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterService.cxx
@@ -68,47 +68,46 @@ void SAL_CALL SlideSorterService::initialize (const Sequence<Any>& rArguments)
{
ThrowIfDisposed();
- if (rArguments.getLength() == 3)
- {
- try
- {
- mxViewId.set(rArguments[0], UNO_QUERY_THROW);
-
- // Get the XController.
- Reference<frame::XController> xController (rArguments[1], UNO_QUERY_THROW);
-
- // Tunnel through the controller to obtain a ViewShellBase.
- ViewShellBase* pBase = nullptr;
- Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
- ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
- xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
- if (pController != nullptr)
- pBase = pController->GetViewShellBase();
-
- // Get the parent window.
- mxParentWindow.set(rArguments[2], UNO_QUERY_THROW);
- VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(mxParentWindow);
-
- mxParentWindow->addWindowListener(this);
-
- if (pBase != nullptr && pParentWindow)
- mpSlideSorter = SlideSorter::CreateSlideSorter(
- *pBase,
- nullptr,
- *pParentWindow);
-
- Resize();
- }
- catch (RuntimeException&)
- {
- throw;
- }
- }
- else
+ if (rArguments.getLength() != 3)
{
throw RuntimeException("SlideSorterService: invalid number of arguments",
static_cast<drawing::XDrawView*>(this));
}
+
+ try
+ {
+ mxViewId.set(rArguments[0], UNO_QUERY_THROW);
+
+ // Get the XController.
+ Reference<frame::XController> xController (rArguments[1], UNO_QUERY_THROW);
+
+ // Tunnel through the controller to obtain a ViewShellBase.
+ ViewShellBase* pBase = nullptr;
+ Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
+ ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
+ xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
+ if (pController != nullptr)
+ pBase = pController->GetViewShellBase();
+
+ // Get the parent window.
+ mxParentWindow.set(rArguments[2], UNO_QUERY_THROW);
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(mxParentWindow);
+
+ mxParentWindow->addWindowListener(this);
+
+ if (pBase != nullptr && pParentWindow)
+ mpSlideSorter = SlideSorter::CreateSlideSorter(
+ *pBase,
+ nullptr,
+ *pParentWindow);
+
+ Resize();
+ }
+ catch (RuntimeException&)
+ {
+ throw;
+ }
+
}
//----- XView -----------------------------------------------------------------
diff --git a/sd/source/ui/tools/PropertySet.cxx b/sd/source/ui/tools/PropertySet.cxx
index d4aa8bd223e1..e7c4c32739b5 100644
--- a/sd/source/ui/tools/PropertySet.cxx
+++ b/sd/source/ui/tools/PropertySet.cxx
@@ -104,14 +104,13 @@ void SAL_CALL PropertySet::removePropertyChangeListener (
return listener.second == rxListener;
}));
- if (iListener != mpChangeListeners->end())
- {
- mpChangeListeners->erase(iListener);
- }
- else
+ if (iListener == mpChangeListeners->end())
{
throw lang::IllegalArgumentException();
}
+
+ mpChangeListeners->erase(iListener);
+
}
void SAL_CALL PropertySet::addVetoableChangeListener (
diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
index b27a8a99db77..a2690534a21f 100644
--- a/sd/source/ui/unoidl/unocpres.cxx
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -363,11 +363,11 @@ void SAL_CALL SdXCustomPresentationAccess::removeByName( const OUString& Name )
SdCustomShow* pShow = getSdCustomShow(Name);
SdCustomShowList* pList = GetCustomShowList();
- if(pList && pShow)
- delete pList->Remove( pShow );
- else
+ if(!pList || !pShow)
throw container::NoSuchElementException();
+ delete pList->Remove( pShow );
+
mrModel.SetModified();
}
@@ -383,20 +383,14 @@ uno::Any SAL_CALL SdXCustomPresentationAccess::getByName( const OUString& aName
{
SolarMutexGuard aGuard;
- uno::Any aAny;
-
SdCustomShow* pShow = getSdCustomShow(aName);
- if(pShow)
- {
- uno::Reference< container::XIndexContainer > xRef( pShow->getUnoCustomShow(), uno::UNO_QUERY );
- aAny <<= xRef;
- }
- else
+ if(!pShow)
{
throw container::NoSuchElementException();
}
- return aAny;
+ uno::Reference< container::XIndexContainer > xRef( pShow->getUnoCustomShow(), uno::UNO_QUERY );
+ return uno::Any(xRef);
}
uno::Sequence< OUString > SAL_CALL SdXCustomPresentationAccess::getElementNames()