Re-work app side-bar code to manage objects correctly.

Change-Id: Ie0eb8fe41a9fd4f996f724c47d20d6edecba3672
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index 7bd1fbf..75d054c 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -218,7 +218,7 @@ IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG)
    return 0;
}

AlignmentPropertyPanel* AlignmentPropertyPanel::Create (
VclPtr<vcl::Window> AlignmentPropertyPanel::Create (
    vcl::Window* pParent,
    const css::uno::Reference<css::frame::XFrame>& rxFrame,
    SfxBindings* pBindings)
@@ -230,10 +230,10 @@ AlignmentPropertyPanel* AlignmentPropertyPanel::Create (
    if (pBindings == NULL)
        throw lang::IllegalArgumentException("no SfxBindings given to AlignmentPropertyPanel::Create", NULL, 2);

    return new AlignmentPropertyPanel(
        pParent,
        rxFrame,
        pBindings);
    return VclPtr<vcl::Window>(
                new AlignmentPropertyPanel(
                        pParent, rxFrame, pBindings),
                SAL_NO_ACQUIRE);
}

void AlignmentPropertyPanel::DataChanged(
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index e41aab3..207b110 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -39,7 +39,7 @@ class AlignmentPropertyPanel
    public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{
public:
    static AlignmentPropertyPanel* Create(
    static VclPtr<vcl::Window> Create(
        vcl::Window* pParent,
        const css::uno::Reference<css::frame::XFrame>& rxFrame,
        SfxBindings* pBindings);
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
index 2ca87de..4410c79 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx
@@ -235,7 +235,7 @@ IMPL_LINK(CellAppearancePropertyPanel, CBOXGridShowClkHdl, void*, EMPTYARG)
    return 0;
}

CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create (
VclPtr<vcl::Window> CellAppearancePropertyPanel::Create (
    vcl::Window* pParent,
    const css::uno::Reference<css::frame::XFrame>& rxFrame,
    SfxBindings* pBindings)
@@ -247,10 +247,10 @@ CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create (
    if (pBindings == NULL)
        throw lang::IllegalArgumentException("no SfxBindings given to CellAppearancePropertyPanel::Create", NULL, 2);

    return new CellAppearancePropertyPanel(
        pParent,
        rxFrame,
        pBindings);
    return VclPtr<vcl::Window>(
                new CellAppearancePropertyPanel(
                        pParent, rxFrame, pBindings),
                SAL_NO_ACQUIRE);
}

void CellAppearancePropertyPanel::DataChanged(
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
index d31b0e2..8bdf1b4 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx
@@ -50,7 +50,7 @@ private:
    friend class CellBorderStyleControl;

public:
    static CellAppearancePropertyPanel* Create(
    static VclPtr<vcl::Window> Create(
        vcl::Window* pParent,
        const css::uno::Reference<css::frame::XFrame>& rxFrame,
        SfxBindings* pBindings);
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index fb70ac6..6efc79d 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -178,7 +178,7 @@ IMPL_LINK( NumberFormatPropertyPanel, NumFormatValueHdl, void*, EMPTYARG )
    return 0L;
}

NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create (
VclPtr<vcl::Window> NumberFormatPropertyPanel::Create (
    vcl::Window* pParent,
    const css::uno::Reference<css::frame::XFrame>& rxFrame,
    SfxBindings* pBindings)
@@ -190,10 +190,10 @@ NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create (
    if (pBindings == NULL)
        throw lang::IllegalArgumentException("no SfxBindings given to NumberFormatPropertyPanel::Create", NULL, 2);

    return new NumberFormatPropertyPanel(
        pParent,
        rxFrame,
        pBindings);
    return VclPtr<vcl::Window>(
                new NumberFormatPropertyPanel(
                        pParent, rxFrame, pBindings),
                SAL_NO_ACQUIRE);
}

void NumberFormatPropertyPanel::DataChanged(
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
index 8747f2d..ded7589 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -37,7 +37,7 @@ class NumberFormatPropertyPanel
{
public:
public:
    static NumberFormatPropertyPanel* Create(
    static VclPtr<vcl::Window> Create(
        vcl::Window* pParent,
        const css::uno::Reference<css::frame::XFrame>& rxFrame,
        SfxBindings* pBindings);
diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx
index b0d4c8f..119eb66 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -108,51 +108,31 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
                "PanelFactory::createUIElement called without SfxBindings",
                NULL);

        sal_Int32 nMinimumSize = -1;
        VclPtr<vcl::Window> pPanel;
        if (rsResourceURL.endsWith("/AlignmentPropertyPanel"))
        {
            AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
            xElement = sfx2::sidebar::SidebarPanelBase::Create(
                rsResourceURL,
                xFrame,
                pPanel,
                ui::LayoutSize(-1,-1,-1));
        }
            pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
        else if (rsResourceURL.endsWith("/CellAppearancePropertyPanel"))
        {
            CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
            xElement = sfx2::sidebar::SidebarPanelBase::Create(
                rsResourceURL,
                xFrame,
                pPanel,
                ui::LayoutSize(-1,-1,-1));
        }
            pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
        else if (rsResourceURL.endsWith("/NumberFormatPropertyPanel"))
        {
            NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
            xElement = sfx2::sidebar::SidebarPanelBase::Create(
                rsResourceURL,
                xFrame,
                pPanel,
                ui::LayoutSize(-1,-1,-1));
        }
            pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
        else if (rsResourceURL.endsWith("/NavigatorPanel"))
        {
            vcl::Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false);
            xElement = sfx2::sidebar::SidebarPanelBase::Create(
                rsResourceURL,
                xFrame,
                pPanel,
                ui::LayoutSize(0,-1,-1));
            pPanel = VclPtr<vcl::Window>(new ScNavigatorDlg(pBindings, NULL, pParentWindow, false), SAL_NO_ACQUIRE);
            nMinimumSize = 0;
        }
        else if (rsResourceURL.endsWith("/FunctionsPanel"))
        {
            vcl::Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX));
            pPanel = VclPtr<vcl::Window>(new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)), SAL_NO_ACQUIRE);;
            nMinimumSize = 0;
        }

        if (pPanel)
            xElement = sfx2::sidebar::SidebarPanelBase::Create(
                rsResourceURL,
                xFrame,
                pPanel,
                ui::LayoutSize(0,-1,-1));
        }
                ui::LayoutSize(nMinimumSize,-1,-1));
    }
    catch (const uno::RuntimeException &)
    {
diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
index d633cfe..fc30395 100644
--- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx
@@ -77,7 +77,7 @@ public:
    SortedMasterPageDescriptorList (void) {}
};

MasterPagesSelector* AllMasterPagesSelector::Create (
VclPtr<vcl::Window> AllMasterPagesSelector::Create (
    vcl::Window* pParent,
    ViewShellBase& rViewShellBase,
    const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
@@ -88,13 +88,14 @@ MasterPagesSelector* AllMasterPagesSelector::Create (

    ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());

    MasterPagesSelector* pSelector(
    VclPtr<MasterPagesSelector> pSelector(
        new AllMasterPagesSelector (
            pParent,
            *pDocument,
            rViewShellBase,
            pContainer,
            rxSidebar));
            rxSidebar),
        SAL_NO_ACQUIRE);
    pSelector->LateInit();
    pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_ALL);

diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
index e313587..5e57415 100644
--- a/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/AllMasterPagesSelector.hxx
@@ -37,7 +37,7 @@ class AllMasterPagesSelector
    : public MasterPagesSelector
{
public:
    static MasterPagesSelector* Create (
    static VclPtr<vcl::Window> Create (
        vcl::Window* pParent,
        ViewShellBase& rViewShellBase,
        const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
index c07f096..16081f2 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx
@@ -42,7 +42,7 @@ using namespace ::com::sun::star;

namespace sd { namespace sidebar {

MasterPagesSelector* CurrentMasterPagesSelector::Create (
VclPtr<vcl::Window> CurrentMasterPagesSelector::Create (
    vcl::Window* pParent,
    ViewShellBase& rViewShellBase,
    const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
@@ -53,13 +53,14 @@ MasterPagesSelector* CurrentMasterPagesSelector::Create (

    ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());

    MasterPagesSelector* pSelector(
    VclPtr<MasterPagesSelector> pSelector(
        new CurrentMasterPagesSelector (
            pParent,
            *pDocument,
            rViewShellBase,
            pContainer,
            rxSidebar));
            rxSidebar),
        SAL_NO_ACQUIRE);
    pSelector->LateInit();
    pSelector->SetHelpId( HID_SD_TASK_PANE_PREVIEW_CURRENT );

diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
index e1d2bb2..29d26cb 100644
--- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
@@ -35,7 +35,7 @@ class CurrentMasterPagesSelector
      public SfxListener
{
public:
    static MasterPagesSelector* Create (
    static VclPtr<vcl::Window> Create (
        vcl::Window* pParent,
        ViewShellBase& rViewShellBase,
        const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx
index 03dbdda..20f4525 100644
--- a/sd/source/ui/sidebar/PanelFactory.cxx
+++ b/sd/source/ui/sidebar/PanelFactory.cxx
@@ -120,14 +120,14 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
    SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);

    // Create a framework view.
    vcl::Window* pControl = NULL;
    VclPtr<vcl::Window> pControl;
    css::ui::LayoutSize aLayoutSize (-1,-1,-1);

#define EndsWith(s,t) s.endsWithAsciiL(t,strlen(t))
    if (EndsWith(rsUIElementResourceURL, gsResourceNameCustomAnimations))
        pControl = new CustomAnimationPanel(pParentWindow, *pBase, xFrame);
        pControl = VclPtr<vcl::Window>(new CustomAnimationPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE);
    else if (EndsWith(rsUIElementResourceURL, gsResourceNameLayouts))
        pControl = new LayoutMenu(pParentWindow, *pBase, xSidebar);
        pControl = VclPtr<vcl::Window>(new LayoutMenu(pParentWindow, *pBase, xSidebar), SAL_NO_ACQUIRE);
    else if (EndsWith(rsUIElementResourceURL, gsResourceNameAllMasterPages))
        pControl = AllMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
    else if (EndsWith(rsUIElementResourceURL, gsResourceNameRecentMasterPages))
@@ -135,14 +135,14 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
    else if (EndsWith(rsUIElementResourceURL, gsResourceNameUsedMasterPages))
        pControl = CurrentMasterPagesSelector::Create(pParentWindow, *pBase, xSidebar);
    else if (EndsWith(rsUIElementResourceURL, gsResourceNameSlideTransitions))
        pControl = new SlideTransitionPanel(pParentWindow, *pBase, xFrame);
        pControl = VclPtr<vcl::Window>(new SlideTransitionPanel(pParentWindow, *pBase, xFrame), SAL_NO_ACQUIRE);
    else if (EndsWith(rsUIElementResourceURL, gsResourceNameTableDesign))
        pControl = new TableDesignPanel(pParentWindow, *pBase);
        pControl = VclPtr<vcl::Window>(new TableDesignPanel(pParentWindow, *pBase), SAL_NO_ACQUIRE);
    else if (EndsWith(rsUIElementResourceURL, gsResourceNameNavigator))
        pControl = new NavigatorWrapper(pParentWindow, *pBase, pBindings);
        pControl = VclPtr<vcl::Window>(new NavigatorWrapper(pParentWindow, *pBase, pBindings), SAL_NO_ACQUIRE);
#undef EndsWith

    if (pControl == NULL)
    if (!pControl)
        throw lang::IllegalArgumentException();

    // Create a wrapper around the control that implements the
diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
index e3b7b2a..348088b 100644
--- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
@@ -32,7 +32,7 @@

namespace sd { namespace sidebar {

MasterPagesSelector* RecentMasterPagesSelector::Create (
VclPtr<vcl::Window> RecentMasterPagesSelector::Create (
    vcl::Window* pParent,
    ViewShellBase& rViewShellBase,
    const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
@@ -43,13 +43,14 @@ MasterPagesSelector* RecentMasterPagesSelector::Create (

    ::boost::shared_ptr<MasterPageContainer> pContainer (new MasterPageContainer());

    MasterPagesSelector* pSelector(
    VclPtr<MasterPagesSelector> pSelector(
        new RecentMasterPagesSelector (
            pParent,
            *pDocument,
            rViewShellBase,
            pContainer,
            rxSidebar));
            rxSidebar),
        SAL_NO_ACQUIRE);
    pSelector->LateInit();
    pSelector->SetHelpId(HID_SD_TASK_PANE_PREVIEW_RECENT);

diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
index 8f64a43..f565ec6 100644
--- a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
+++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
@@ -30,7 +30,7 @@ class RecentMasterPagesSelector
    : public MasterPagesSelector
{
public:
    static MasterPagesSelector* Create (
    static VclPtr<vcl::Window> Create (
        vcl::Window* pParent,
        ViewShellBase& rViewShellBase,
        const css::uno::Reference<css::ui::XSidebar>& rxSidebar);
diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.cxx b/sw/source/uibase/sidebar/PagePropertyPanel.cxx
index c04874d..53fd3af 100644
--- a/sw/source/uibase/sidebar/PagePropertyPanel.cxx
+++ b/sw/source/uibase/sidebar/PagePropertyPanel.cxx
@@ -83,7 +83,7 @@ namespace {

namespace sw { namespace sidebar {

PagePropertyPanel* PagePropertyPanel::Create (
VclPtr<vcl::Window> PagePropertyPanel::Create (
    vcl::Window* pParent,
    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
    SfxBindings* pBindings)
@@ -95,10 +95,12 @@ PagePropertyPanel* PagePropertyPanel::Create (
    if (pBindings == NULL)
        throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to PagePropertyPanel::Create", NULL, 2);

    return new PagePropertyPanel(
        pParent,
        rxFrame,
        pBindings);
    return VclPtr<vcl::Window>(
                new PagePropertyPanel(
                        pParent,
                        rxFrame,
                        pBindings),
                SAL_NO_ACQUIRE);
}

PagePropertyPanel::PagePropertyPanel(
diff --git a/sw/source/uibase/sidebar/PagePropertyPanel.hxx b/sw/source/uibase/sidebar/PagePropertyPanel.hxx
index f9dd2c0..d97d27a 100644
--- a/sw/source/uibase/sidebar/PagePropertyPanel.hxx
+++ b/sw/source/uibase/sidebar/PagePropertyPanel.hxx
@@ -55,7 +55,7 @@ namespace sw { namespace sidebar {
          public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
    {
    public:
        static PagePropertyPanel* Create(
        static VclPtr<vcl::Window> Create(
            vcl::Window* pParent,
            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
            SfxBindings* pBindings );
diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx b/sw/source/uibase/sidebar/SwPanelFactory.cxx
index cc79840..361978b 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -119,7 +119,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (

    if (rsResourceURL.endsWith("/PagePropertyPanel"))
    {
        sw::sidebar::PagePropertyPanel* pPanel = sw::sidebar::PagePropertyPanel::Create( pParentWindow, xFrame, pBindings );
        VclPtr<vcl::Window> pPanel = sw::sidebar::PagePropertyPanel::Create( pParentWindow, xFrame, pBindings );
        xElement = sfx2::sidebar::SidebarPanelBase::Create(
            rsResourceURL,
            xFrame,
@@ -128,7 +128,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
    }
    else if (rsResourceURL.endsWith("/WrapPropertyPanel"))
    {
        sw::sidebar::WrapPropertyPanel* pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings );
        VclPtr<vcl::Window> pPanel = sw::sidebar::WrapPropertyPanel::Create( pParentWindow, xFrame, pBindings );
        xElement = sfx2::sidebar::SidebarPanelBase::Create(
            rsResourceURL,
            xFrame,
@@ -137,7 +137,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
    }
    else if (rsResourceURL.endsWith("/NavigatorPanel"))
    {
        vcl::Window* pPanel = new SwNavigationPI(pBindings, NULL, pParentWindow);
        VclPtr<vcl::Window> pPanel( new SwNavigationPI(pBindings, NULL, pParentWindow), SAL_NO_ACQUIRE );
        xElement = sfx2::sidebar::SidebarPanelBase::Create(
            rsResourceURL,
            xFrame,
@@ -146,7 +146,7 @@ Reference<ui::XUIElement> SAL_CALL SwPanelFactory::createUIElement (
    }
    else if (rsResourceURL.endsWith("/ManageChangesPanel"))
    {
        vcl::Window* pPanel = new SwRedlineAcceptPanel(pParentWindow, xFrame);
        VclPtr<vcl::Window> pPanel( new SwRedlineAcceptPanel(pParentWindow, xFrame), SAL_NO_ACQUIRE );
        xElement = sfx2::sidebar::SidebarPanelBase::Create(
            rsResourceURL,
            xFrame,
diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
index 71c873f..39f68c3 100644
--- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
+++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx
@@ -42,7 +42,7 @@ const char UNO_WRAPIDEAL[] = ".uno:WrapIdeal";

namespace sw { namespace sidebar {

WrapPropertyPanel* WrapPropertyPanel::Create (
VclPtr<vcl::Window> WrapPropertyPanel::Create (
    vcl::Window* pParent,
    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
    SfxBindings* pBindings)
@@ -54,10 +54,12 @@ WrapPropertyPanel* WrapPropertyPanel::Create (
    if (pBindings == NULL)
        throw ::com::sun::star::lang::IllegalArgumentException("no SfxBindings given to WrapPropertyPanel::Create", NULL, 2);

    return new WrapPropertyPanel(
        pParent,
        rxFrame,
        pBindings);
    return VclPtr<vcl::Window>(
                new WrapPropertyPanel(
                        pParent,
                        rxFrame,
                        pBindings),
                SAL_NO_ACQUIRE);
}

WrapPropertyPanel::WrapPropertyPanel(
diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx
index c64b133..4c0291b 100644
--- a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx
+++ b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx
@@ -35,7 +35,7 @@ namespace sw { namespace sidebar {
        , public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
    {
    public:
        static WrapPropertyPanel* Create(
        static VclPtr<vcl::Window> Create(
            vcl::Window* pParent,
            const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
            SfxBindings* pBindings );