summaryrefslogtreecommitdiff
path: root/sc/source/ui/sidebar
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-02-21 14:33:40 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-21 15:30:26 +0000
commitc1587b74c15d35fd85069d3a0f1ebe4770549021 (patch)
tree0af456d2b0ee55f7d7334e76a0c50b8998f97496 /sc/source/ui/sidebar
parentb9cb27effd2f0d137af8e5fe59f6aaf489c10418 (diff)
coverity#1158357 Uncaught exception
Change-Id: I7d93f1c1a4e9c4b91c385d6f9e1aaab2fe635327
Diffstat (limited to 'sc/source/ui/sidebar')
-rw-r--r--sc/source/ui/sidebar/ScPanelFactory.cxx136
1 files changed, 75 insertions, 61 deletions
diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx
index 4366c2f06902..457071b008a9 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -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;
}