Kaydet (Commit) c1587b74 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1158357 Uncaught exception

Change-Id: I7d93f1c1a4e9c4b91c385d6f9e1aaab2fe635327
üst b9cb27ef
......@@ -31,6 +31,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/window.hxx>
#include <rtl/ref.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <comphelper/namedvaluecollection.hxx>
#include <boost/bind.hpp>
......@@ -92,73 +93,86 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
{
Reference<ui::XUIElement> xElement;
const ::comphelper::NamedValueCollection aArguments (rArguments);
Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==NULL)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
NULL);
if ( ! xFrame.is())
throw RuntimeException(
"PanelFactory::createUIElement called without Frame",
NULL);
if (pBindings == NULL)
throw RuntimeException(
"PanelFactory::createUIElement called without SfxBindings",
NULL);
#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
if (DoesResourceEndWith("/AlignmentPropertyPanel"))
try
{
AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(-1,-1,-1));
}
else if (DoesResourceEndWith("/CellAppearancePropertyPanel"))
{
CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(-1,-1,-1));
}
else if (DoesResourceEndWith("/NumberFormatPropertyPanel"))
{
NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(-1,-1,-1));
const ::comphelper::NamedValueCollection aArguments (rArguments);
Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
if ( ! xParentWindow.is() || pParentWindow==NULL)
throw RuntimeException(
"PanelFactory::createUIElement called without ParentWindow",
NULL);
if ( ! xFrame.is())
throw RuntimeException(
"PanelFactory::createUIElement called without Frame",
NULL);
if (pBindings == NULL)
throw RuntimeException(
"PanelFactory::createUIElement called without SfxBindings",
NULL);
#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
if (DoesResourceEndWith("/AlignmentPropertyPanel"))
{
AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(-1,-1,-1));
}
else if (DoesResourceEndWith("/CellAppearancePropertyPanel"))
{
CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(-1,-1,-1));
}
else if (DoesResourceEndWith("/NumberFormatPropertyPanel"))
{
NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(-1,-1,-1));
}
else if (DoesResourceEndWith("/NavigatorPanel"))
{
Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false);
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(0,-1,-1));
}
else if (DoesResourceEndWith("/FunctionsPanel"))
{
Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX));
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(0,-1,-1));
}
#undef DoesResourceEndWith
}
else if (DoesResourceEndWith("/NavigatorPanel"))
catch (const uno::RuntimeException &)
{
Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false);
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(0,-1,-1));
throw;
}
else if (DoesResourceEndWith("/FunctionsPanel"))
catch (const uno::Exception& e)
{
Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX));
xElement = sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
xFrame,
pPanel,
ui::LayoutSize(0,-1,-1));
throw lang::WrappedTargetRuntimeException(
OUString("ScPanelFactory::createUIElement exception"),
0, uno::makeAny(e));
}
#undef DoesResourceEndWith
return xElement;
}
......
......@@ -34,7 +34,6 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <com/sun/star/ucb/InteractiveAppException.hpp>
#include <com/sun/star/ucb/XContent.hpp>
......
......@@ -28,7 +28,6 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <com/sun/star/ucb/InteractiveAppException.hpp>
#include <com/sun/star/ucb/XContent.hpp>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment