Related: #i121420# Provide sidebar panels with XCanvas objects.

(cherry picked from commit d179a612f5f9c01776ea52bfdcf27f1cb864f249)

Conflicts:
	sfx2/source/sidebar/SidebarController.cxx

Change-Id: I755d55ac0f5a97fdd11476ce11631afb362e83d8
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 08e1e6d..55a384e 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -35,6 +35,7 @@
#include "splitwin.hxx"
#include <svl/smplhint.hxx>
#include <tools/link.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <comphelper/namedvaluecollection.hxx>
@@ -46,6 +47,7 @@
#include <com/sun/star/ui/XUIElementFactory.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp>

#include <boost/bind.hpp>
#include <boost/function.hpp>
@@ -491,6 +493,7 @@ bool SidebarController::ArePanelSetsEqual (
    const SharedPanelContainer& rCurrentPanels,
    const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels)
{
#ifdef DEBUG
    OSL_TRACE("current panel list:");
    for (SharedPanelContainer::const_iterator
             iPanel(rCurrentPanels.begin()),
@@ -510,6 +513,7 @@ bool SidebarController::ArePanelSetsEqual (
    {
        OSL_TRACE("    panel %s", S2A(iId->msId));
    }
#endif

    if (rCurrentPanels.size() != rRequestedPanels.size())
        return false;
@@ -553,7 +557,8 @@ SharedPanel SidebarController::CreatePanel (
    // Create the XUIElement.
    Reference<ui::XUIElement> xUIElement (CreateUIElement(
            pPanel->GetComponentInterface(),
            pPanelDescriptor->msImplementationURL));
            pPanelDescriptor->msImplementationURL,
            pPanelDescriptor->mbWantsCanvas));
    if (xUIElement.is())
    {
        // Initialize the panel and add it to the active deck.
@@ -572,7 +577,8 @@ SharedPanel SidebarController::CreatePanel (

Reference<ui::XUIElement> SidebarController::CreateUIElement (
    const Reference<awt::XWindowPeer>& rxWindow,
    const ::rtl::OUString& rsImplementationURL)
    const ::rtl::OUString& rsImplementationURL,
    const bool bWantsCanvas)
{
    try
    {
@@ -590,6 +596,11 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement (
            aCreationArguments.put("SfxBindings", makeAny(sal_uInt64(&pSfxDockingWindow->GetBindings())));
        aCreationArguments.put("Theme", Theme::GetPropertySet());
        aCreationArguments.put("Sidebar", makeAny(Reference<ui::XSidebar>(static_cast<ui::XSidebar*>(this))));
        if (bWantsCanvas)
        {
            Reference<rendering::XSpriteCanvas> xCanvas (VCLUnoHelper::GetWindow(rxWindow)->GetSpriteCanvas());
            aCreationArguments.put("Canvas", makeAny(xCanvas));
        }

        Reference<ui::XUIElement> xUIElement(
            xUIElementFactory->createUIElement(
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 8902a73..38ce50b 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -124,7 +124,8 @@ private:
        const ResourceManager::PanelContextDescriptorContainer& rRequestedPanels);
    cssu::Reference<css::ui::XUIElement> CreateUIElement (
        const cssu::Reference<css::awt::XWindowPeer>& rxWindow,
        const ::rtl::OUString& rsImplementationURL);
        const ::rtl::OUString& rsImplementationURL,
        const bool bWantsCanvas);
    SharedPanel CreatePanel (
        const ::rtl::OUString& rsPanelId,
        ::Window* pParentWindow,