22#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
23#include <com/sun/star/ui/XUIElementFactory.hpp>
24#include <com/sun/star/uno/XComponentContext.hpp>
43 SmPanelFactory() =
default;
45 SmPanelFactory(
const SmPanelFactory&) =
delete;
46 const SmPanelFactory& operator=(
const SmPanelFactory&) =
delete;
49 css::uno::Reference<css::ui::XUIElement> SAL_CALL
50 createUIElement(
const OUString& ResourceURL,
51 const css::uno::Sequence<css::beans::PropertyValue>& Arguments)
override;
59css::uno::Reference<css::ui::XUIElement> SAL_CALL SmPanelFactory::createUIElement(
60 const OUString& ResourceURL,
const css::uno::Sequence<css::beans::PropertyValue>& Arguments)
65 auto xFrame(
aArguments.getOrDefault(
"Frame", css::uno::Reference<css::frame::XFrame>()));
67 aArguments.getOrDefault(
"ParentWindow", css::uno::Reference<css::awt::XWindow>()));
68 const sal_uInt64 nBindingsValue(
aArguments.getOrDefault(
"SfxBindings", sal_uInt64(0)));
73 pParent = pTunnel->getWidget();
76 throw css::uno::RuntimeException(
"SmPanelFactory::createUIElement: no ParentWindow");
78 throw css::uno::RuntimeException(
"SmPanelFactory::createUIElement: no Frame");
80 throw css::uno::RuntimeException(
"SmPanelFactory::createUIElement: no SfxBindings");
82 std::unique_ptr<PanelLayout> pPanel;
83 css::ui::LayoutSize aLayoutSize{ -1, -1, -1 };
84 if (ResourceURL.endsWith(
"/MathPropertiesPanel"))
88 else if (ResourceURL.endsWith(
"/MathElementsPanel"))
91 aLayoutSize = { 300, -1, -1 };
98 catch (
const css::uno::RuntimeException&)
102 catch (
const css::uno::Exception&)
105 throw css::lang::WrappedTargetRuntimeException(
"SmPanelFactory::createUIElement exception",
112OUString SmPanelFactory::getImplementationName()
114 return "org.libreoffice.comp.Math.sidebar.SmPanelFactory";
117sal_Bool SmPanelFactory::supportsService(OUString
const& ServiceName)
122css::uno::Sequence<OUString> SmPanelFactory::getSupportedServiceNames()
124 return {
"com.sun.star.ui.UIElementFactory" };
129extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
131 css::uno::Sequence<css::uno::Any>
const&)
133 return cppu::acquire(
new SmPanelFactory);
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_libreoffice_comp_Math_sidebar_SmPanelFactory(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Sequence< PropertyValue > aArguments
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Any SAL_CALL getCaughtException()
Reference< XFrame > xFrame