2014-04-24 04:21:14 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2013-04-10 08:20:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "text/TextPropertyPanel.hxx"
|
2015-06-15 01:54:43 +05:30
|
|
|
#include "styles/StylesPropertyPanel.hxx"
|
2013-04-10 08:20:16 +00:00
|
|
|
#include "paragraph/ParaPropertyPanel.hxx"
|
|
|
|
#include "area/AreaPropertyPanel.hxx"
|
2015-06-19 18:55:43 +05:30
|
|
|
#include "shadow/ShadowPropertyPanel.hxx"
|
2013-04-10 08:20:16 +00:00
|
|
|
#include "graphic/GraphicPropertyPanel.hxx"
|
|
|
|
#include "line/LinePropertyPanel.hxx"
|
|
|
|
#include "possize/PosSizePropertyPanel.hxx"
|
2017-10-16 17:31:23 +02:00
|
|
|
#include "DefaultShapesPanel.hxx"
|
2016-08-14 23:53:31 +04:00
|
|
|
#include "media/MediaPlaybackPanel.hxx"
|
2013-04-10 08:20:16 +00:00
|
|
|
#include "GalleryControl.hxx"
|
|
|
|
#include "EmptyPanel.hxx"
|
|
|
|
#include <sfx2/sidebar/SidebarPanelBase.hxx>
|
2013-09-05 21:58:31 +03:00
|
|
|
#include <sfx2/sidebar/Tools.hxx>
|
2013-04-10 08:20:16 +00:00
|
|
|
#include <sfx2/sfxbasecontroller.hxx>
|
|
|
|
#include <sfx2/templdlg.hxx>
|
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <rtl/ref.hxx>
|
|
|
|
#include <comphelper/namedvaluecollection.hxx>
|
2013-12-30 10:04:05 +01:00
|
|
|
#include <cppuhelper/basemutex.hxx>
|
2015-03-17 12:25:11 +01:00
|
|
|
#include <cppuhelper/compbase.hxx>
|
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
2013-04-10 08:20:16 +00:00
|
|
|
#include <com/sun/star/ui/XSidebar.hpp>
|
2013-12-30 10:04:05 +01:00
|
|
|
#include <com/sun/star/ui/XUIElementFactory.hpp>
|
2013-04-10 08:20:16 +00:00
|
|
|
|
|
|
|
using namespace css;
|
2014-09-05 11:12:25 +00:00
|
|
|
using namespace css::uno;
|
2013-12-30 10:04:05 +01:00
|
|
|
using namespace svx::sidebar;
|
2013-12-20 22:41:38 +01:00
|
|
|
|
|
|
|
|
2013-12-30 10:04:05 +01:00
|
|
|
namespace {
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-12-30 10:04:05 +01:00
|
|
|
/* Why this is not used ? Doesn't it need to inherit from XServiceInfo ?
|
2013-04-10 08:20:16 +00:00
|
|
|
#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.svx.sidebar.PanelFactory"
|
|
|
|
#define SERVICE_NAME "com.sun.star.ui.UIElementFactory"
|
2013-12-30 10:04:05 +01:00
|
|
|
*/
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2015-03-17 12:25:11 +01:00
|
|
|
typedef ::cppu::WeakComponentImplHelper< css::ui::XUIElementFactory, css::lang::XServiceInfo >
|
2013-12-30 10:04:05 +01:00
|
|
|
PanelFactoryInterfaceBase;
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-12-30 10:04:05 +01:00
|
|
|
class PanelFactory
|
2016-04-13 10:11:37 +02:00
|
|
|
: private ::cppu::BaseMutex,
|
2013-12-30 10:04:05 +01:00
|
|
|
public PanelFactoryInterfaceBase
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2013-12-30 10:04:05 +01:00
|
|
|
public:
|
2015-04-14 12:44:47 +02:00
|
|
|
PanelFactory();
|
2016-04-13 10:11:37 +02:00
|
|
|
PanelFactory(const PanelFactory&) = delete;
|
|
|
|
PanelFactory& operator=(const PanelFactory&) = delete;
|
2013-12-30 10:04:05 +01:00
|
|
|
|
|
|
|
// XUIElementFactory
|
2014-09-05 11:12:25 +00:00
|
|
|
css::uno::Reference<css::ui::XUIElement> SAL_CALL createUIElement (
|
2013-12-30 10:04:05 +01:00
|
|
|
const ::rtl::OUString& rsResourceURL,
|
2017-01-26 12:28:58 +01:00
|
|
|
const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments) override;
|
2015-03-17 12:25:11 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL getImplementationName() override
|
2015-03-17 12:25:11 +01:00
|
|
|
{ return OUString("org.apache.openoffice.comp.svx.sidebar.PanelFactory"); }
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override
|
2015-03-17 12:25:11 +01:00
|
|
|
{ return cppu::supportsService(this, ServiceName); }
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
|
2017-03-04 19:42:34 +05:30
|
|
|
{ return {"com.sun.star.ui.UIElementFactory"}; }
|
2013-12-30 10:04:05 +01:00
|
|
|
};
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
PanelFactory::PanelFactory()
|
2013-04-10 08:20:16 +00:00
|
|
|
: PanelFactoryInterfaceBase(m_aMutex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
|
|
|
|
const ::rtl::OUString& rsResourceURL,
|
2014-09-05 11:12:25 +00:00
|
|
|
const ::css::uno::Sequence<css::beans::PropertyValue>& rArguments)
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
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>()));
|
|
|
|
Reference<ui::XSidebar> xSidebar (aArguments.getOrDefault("Sidebar", Reference<ui::XSidebar>()));
|
|
|
|
const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
|
|
|
|
SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
|
2016-06-17 23:54:00 +02:00
|
|
|
vcl::EnumContext aContext (
|
2013-05-14 15:21:57 +00:00
|
|
|
aArguments.getOrDefault("ApplicationName", OUString()),
|
|
|
|
aArguments.getOrDefault("ContextName", OUString()));
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2016-11-10 12:53:02 +02:00
|
|
|
VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
|
2015-11-10 10:25:28 +01:00
|
|
|
if ( ! xParentWindow.is() || pParentWindow==nullptr)
|
2013-04-10 08:20:16 +00:00
|
|
|
throw RuntimeException(
|
2013-11-12 09:33:27 +02:00
|
|
|
"PanelFactory::createUIElement called without ParentWindow",
|
2015-11-10 10:25:28 +01:00
|
|
|
nullptr);
|
2013-04-10 08:20:16 +00:00
|
|
|
if ( ! xFrame.is())
|
|
|
|
throw RuntimeException(
|
2013-11-12 09:33:27 +02:00
|
|
|
"PanelFactory::createUIElement called without Frame",
|
2015-11-10 10:25:28 +01:00
|
|
|
nullptr);
|
|
|
|
if (pBindings == nullptr)
|
2013-04-10 08:20:16 +00:00
|
|
|
throw RuntimeException(
|
2013-11-12 09:33:27 +02:00
|
|
|
"PanelFactory::createUIElement called without SfxBindings",
|
2015-11-10 10:25:28 +01:00
|
|
|
nullptr);
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2015-04-13 22:51:42 +01:00
|
|
|
VclPtr<vcl::Window> pControl;
|
2013-04-10 08:20:16 +00:00
|
|
|
ui::LayoutSize aLayoutSize (-1,-1,-1);
|
|
|
|
|
2014-11-23 23:12:05 +01:00
|
|
|
if (rsResourceURL.endsWith("/TextPropertyPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2017-01-08 01:57:42 +02:00
|
|
|
pControl = TextPropertyPanel::Create(pParentWindow, xFrame);
|
2013-04-10 08:20:16 +00:00
|
|
|
}
|
2015-06-15 01:54:43 +05:30
|
|
|
else if (rsResourceURL.endsWith("/StylesPropertyPanel"))
|
|
|
|
{
|
2015-07-16 11:24:25 +02:00
|
|
|
pControl = StylesPropertyPanel::Create(pParentWindow, xFrame);
|
2015-06-15 01:54:43 +05:30
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/ParaPropertyPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
pControl = ParaPropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar);
|
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/AreaPropertyPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings);
|
|
|
|
}
|
2015-06-19 18:55:43 +05:30
|
|
|
else if (rsResourceURL.endsWith("/ShadowPropertyPanel"))
|
|
|
|
{
|
|
|
|
pControl = ShadowPropertyPanel::Create(pParentWindow, xFrame, pBindings);
|
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/GraphicPropertyPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
pControl = GraphicPropertyPanel::Create(pParentWindow, xFrame, pBindings);
|
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/LinePropertyPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
pControl = LinePropertyPanel::Create(pParentWindow, xFrame, pBindings);
|
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/PosSizePropertyPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
pControl = PosSizePropertyPanel::Create(pParentWindow, xFrame, pBindings, xSidebar);
|
|
|
|
}
|
2016-06-29 19:13:53 +05:30
|
|
|
else if (rsResourceURL.endsWith("/DefaultShapesPanel"))
|
|
|
|
{
|
|
|
|
pControl = DefaultShapesPanel::Create(pParentWindow, xFrame);
|
|
|
|
}
|
2016-08-14 23:53:31 +04:00
|
|
|
else if (rsResourceURL.endsWith("/MediaPlaybackPanel"))
|
|
|
|
{
|
|
|
|
pControl = MediaPlaybackPanel::Create(pParentWindow, xFrame, pBindings);
|
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/GalleryPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2017-05-04 12:21:07 +02:00
|
|
|
pControl.reset(VclPtr<GalleryControl>::Create(pParentWindow));
|
2013-04-10 08:20:16 +00:00
|
|
|
aLayoutSize = ui::LayoutSize(300,-1,400);
|
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/StyleListPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2015-04-13 22:51:42 +01:00
|
|
|
pControl.reset(VclPtr<SfxTemplatePanelControl>::Create(pBindings, pParentWindow));
|
2013-04-10 08:20:16 +00:00
|
|
|
aLayoutSize = ui::LayoutSize(0,-1,-1);
|
|
|
|
}
|
2014-11-23 23:12:05 +01:00
|
|
|
else if (rsResourceURL.endsWith("/EmptyPanel"))
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
2015-04-13 22:51:42 +01:00
|
|
|
pControl.reset(VclPtr<EmptyPanel>::Create(pParentWindow));
|
2013-04-10 08:20:16 +00:00
|
|
|
aLayoutSize = ui::LayoutSize(20,-1, 50);
|
|
|
|
}
|
|
|
|
|
2015-04-13 22:51:42 +01:00
|
|
|
if (pControl)
|
2013-04-10 08:20:16 +00:00
|
|
|
{
|
|
|
|
return sfx2::sidebar::SidebarPanelBase::Create(
|
|
|
|
rsResourceURL,
|
|
|
|
xFrame,
|
|
|
|
pControl,
|
|
|
|
aLayoutSize);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return Reference<ui::XUIElement>();
|
|
|
|
}
|
|
|
|
|
2013-12-30 10:04:05 +01:00
|
|
|
}
|
2013-04-10 08:20:16 +00:00
|
|
|
|
2013-12-30 10:04:05 +01:00
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
|
2014-01-15 15:06:17 +01:00
|
|
|
org_apache_openoffice_comp_svx_sidebar_PanelFactory_get_implementation(
|
2014-01-18 10:51:50 +01:00
|
|
|
css::uno::XComponentContext *,
|
2014-01-22 11:54:19 +01:00
|
|
|
css::uno::Sequence<css::uno::Any> const &)
|
2013-12-30 10:04:05 +01:00
|
|
|
{
|
2014-01-22 11:54:19 +01:00
|
|
|
return cppu::acquire(new PanelFactory);
|
2013-12-30 10:04:05 +01:00
|
|
|
}
|
2014-04-24 04:21:14 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|