Re-work sidebar factory to use VclPtr.
Change-Id: Iccbf4166419eee9f78f036d1abe07bba028d09e6
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx
index e4db4f0..82790a4 100644
--- a/include/svx/sidebar/PanelLayout.hxx
+++ b/include/svx/sidebar/PanelLayout.hxx
@@ -16,6 +16,7 @@
#include <vcl/ctrl.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/vclptr.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XFrame.hpp>
diff --git a/include/svx/sidebar/Popup.hxx b/include/svx/sidebar/Popup.hxx
index bcd0bde..67d4c1c 100644
--- a/include/svx/sidebar/Popup.hxx
+++ b/include/svx/sidebar/Popup.hxx
@@ -91,7 +91,7 @@ protected:
private:
VclPtr<vcl::Window> mpParent;
::boost::function<PopupControl*(PopupContainer*)> maControlCreator;
::boost::function<VclPtr<PopupControl>(PopupContainer*)> maControlCreator;
::boost::function<void(void)> maPopupModeEndCallback;
const ::rtl::OUString msAccessibleName;
VclPtr<PopupContainer> mxContainer;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 9dcccbc..a44217c 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -90,11 +90,11 @@ void Deck::dispose()
aPanels[i].disposeAndClear();
maPanels.clear();
mpTitleBar.disposeAndClear();
mpFiller.disposeAndClear();
mpVerticalScrollBar.disposeAndClear();
mpScrollContainer.disposeAndClear();
mpScrollClipWindow.disposeAndClear();
mpTitleBar.disposeAndClear();
vcl::Window::dispose();
}
diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx
index e5a0cad..9e80936 100644
--- a/svx/source/sidebar/PanelFactory.cxx
+++ b/svx/source/sidebar/PanelFactory.cxx
@@ -137,7 +137,7 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
"PanelFactory::createUIElement called without SfxBindings",
NULL);
vcl::Window* pControl = NULL;
VclPtr<vcl::Window> pControl;
ui::LayoutSize aLayoutSize (-1,-1,-1);
if (rsResourceURL.endsWith("/TextPropertyPanel"))
@@ -166,25 +166,25 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement (
}
else if (rsResourceURL.endsWith("/InsertPropertyPanel"))
{
pControl = new InsertPropertyPanel(pParentWindow, xFrame);
pControl.reset(VclPtr<InsertPropertyPanel>::Create(pParentWindow, xFrame));
}
else if (rsResourceURL.endsWith("/GalleryPanel"))
{
pControl = new GalleryControl(pBindings, pParentWindow);
pControl.reset(VclPtr<GalleryControl>::Create(pBindings, pParentWindow));
aLayoutSize = ui::LayoutSize(300,-1,400);
}
else if (rsResourceURL.endsWith("/StyleListPanel"))
{
pControl = new SfxTemplatePanelControl(pBindings, pParentWindow);
pControl.reset(VclPtr<SfxTemplatePanelControl>::Create(pBindings, pParentWindow));
aLayoutSize = ui::LayoutSize(0,-1,-1);
}
else if (rsResourceURL.endsWith("/EmptyPanel"))
{
pControl = new EmptyPanel(pParentWindow);
pControl.reset(VclPtr<EmptyPanel>::Create(pParentWindow));
aLayoutSize = ui::LayoutSize(20,-1, 50);
}
if (pControl != NULL)
if (pControl)
{
return sfx2::sidebar::SidebarPanelBase::Create(
rsResourceURL,
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.cxx b/svx/source/sidebar/area/AreaPropertyPanel.cxx
index 0063d05..bc731f9 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.cxx
@@ -493,9 +493,9 @@ IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox )
}
PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent)
VclPtr<PopupControl> AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent)
{
return new AreaTransparencyGradientControl(pParent, *this);
return VclPtrInstance<AreaTransparencyGradientControl>(pParent, *this);
}
@@ -515,7 +515,7 @@ void AreaPropertyPanel::SetupIcons(void)
AreaPropertyPanel* AreaPropertyPanel::Create (
VclPtr<vcl::Window> AreaPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
@@ -527,10 +527,12 @@ AreaPropertyPanel* AreaPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to AreaPropertyPanel::Create", NULL, 2);
return new AreaPropertyPanel(
pParent,
rxFrame,
pBindings);
return VclPtr<vcl::Window>(
new AreaPropertyPanel(
pParent,
rxFrame,
pBindings),
SAL_NO_ACQUIRE);
}
diff --git a/svx/source/sidebar/area/AreaPropertyPanel.hxx b/svx/source/sidebar/area/AreaPropertyPanel.hxx
index 12243fd..76c5baf 100644
--- a/svx/source/sidebar/area/AreaPropertyPanel.hxx
+++ b/svx/source/sidebar/area/AreaPropertyPanel.hxx
@@ -57,7 +57,7 @@ public:
virtual ~AreaPropertyPanel();
virtual void dispose() SAL_OVERRIDE;
static AreaPropertyPanel* Create(
static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
@@ -147,7 +147,7 @@ private:
DECL_LINK(ModifyTransparentHdl_Impl, void*);
// for transparency gradient
PopupControl* CreateTransparencyGradientControl (PopupContainer* pParent);
VclPtr<PopupControl> CreateTransparencyGradientControl (PopupContainer* pParent);
DECL_LINK( ClickTrGrHdl_Impl, ToolBox* );
// constructor/destuctor
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
index 8ac484d8..933b5f3 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
@@ -232,7 +232,7 @@ void GraphicPropertyPanel::SetupIcons(void)
GraphicPropertyPanel* GraphicPropertyPanel::Create (
VclPtr<vcl::Window> GraphicPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings)
@@ -244,10 +244,12 @@ GraphicPropertyPanel* GraphicPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to GraphicPropertyPanel::Create", NULL, 2);
return new GraphicPropertyPanel(
pParent,
rxFrame,
pBindings);
return VclPtr<vcl::Window>(
new GraphicPropertyPanel(
pParent,
rxFrame,
pBindings),
SAL_NO_ACQUIRE);
}
diff --git a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
index 691d45f..85b1d39 100644
--- a/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
+++ b/svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
@@ -42,7 +42,7 @@ public:
virtual ~GraphicPropertyPanel();
virtual void dispose() SAL_OVERRIDE;
static GraphicPropertyPanel* Create(
static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx
index 5ff67de..12b0f33 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.cxx
@@ -286,7 +286,7 @@ void LinePropertyPanel::SetupIcons(void)
}
}
LinePropertyPanel* LinePropertyPanel::Create (
VclPtr<vcl::Window> LinePropertyPanel::Create (
vcl::Window* pParent,
const uno::Reference<frame::XFrame>& rxFrame,
SfxBindings* pBindings)
@@ -298,7 +298,9 @@ LinePropertyPanel* LinePropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to LinePropertyPanel::Create", NULL, 2);
return new LinePropertyPanel(pParent, rxFrame, pBindings);
return VclPtr<vcl::Window>(
new LinePropertyPanel(pParent, rxFrame, pBindings),
SAL_NO_ACQUIRE);
}
void LinePropertyPanel::DataChanged(const DataChangedEvent& /*rEvent*/)
@@ -769,9 +771,9 @@ IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG )
return 0L;
}
PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
VclPtr<PopupControl> LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
{
return new LineWidthControl(pParent, *this);
return VclPtrInstance<LineWidthControl>(pParent, *this);
}
void LinePropertyPanel::EndLineWidthPopupMode (void)
diff --git a/svx/source/sidebar/line/LinePropertyPanel.hxx b/svx/source/sidebar/line/LinePropertyPanel.hxx
index 2567a5e..626e2ac 100644
--- a/svx/source/sidebar/line/LinePropertyPanel.hxx
+++ b/svx/source/sidebar/line/LinePropertyPanel.hxx
@@ -63,7 +63,7 @@ public:
virtual ~LinePropertyPanel();
virtual void dispose() SAL_OVERRIDE;
static LinePropertyPanel* Create(
static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
@@ -161,7 +161,7 @@ private:
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
PopupControl* CreateLineWidthPopupControl (PopupContainer* pParent);
VclPtr<PopupControl> CreateLineWidthPopupControl (PopupContainer* pParent);
};
} } // end of namespace svx::sidebar
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index b84a068..8ba3f99 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -55,7 +55,7 @@ namespace svx {namespace sidebar {
#define MAX_SC_SD 116220200
#define NEGA_MAXVALUE -10000000
ParaPropertyPanel* ParaPropertyPanel::Create (
VclPtr<vcl::Window> ParaPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -68,11 +68,13 @@ ParaPropertyPanel* ParaPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to ParaPropertyPanel::Create", NULL, 2);
return new ParaPropertyPanel(
pParent,
rxFrame,
pBindings,
rxSidebar);
return VclPtr<vcl::Window>(
new ParaPropertyPanel(
pParent,
rxFrame,
pBindings,
rxSidebar),
SAL_NO_ACQUIRE);
}
void ParaPropertyPanel::HandleContextChange (
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
index 2b4d877..9eddf1f 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
@@ -46,7 +46,7 @@ public:
virtual ~ParaPropertyPanel();
virtual void dispose() SAL_OVERRIDE;
static ParaPropertyPanel* Create (
static VclPtr<vcl::Window> Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index cfb5939d..b352332 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -232,7 +232,7 @@ void PosSizePropertyPanel::SetupIcons(void)
PosSizePropertyPanel* PosSizePropertyPanel::Create (
VclPtr<vcl::Window> PosSizePropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -245,11 +245,13 @@ PosSizePropertyPanel* PosSizePropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to PosSizePropertyPanel::Create", NULL, 2);
return new PosSizePropertyPanel(
pParent,
rxFrame,
pBindings,
rxSidebar);
return VclPtr<vcl::Window>(
new PosSizePropertyPanel(
pParent,
rxFrame,
pBindings,
rxSidebar),
SAL_NO_ACQUIRE);
}
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index d8a2685..a5148b6 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -53,7 +53,7 @@ public:
virtual ~PosSizePropertyPanel();
virtual void dispose() SAL_OVERRIDE;
static PosSizePropertyPanel* Create(
static VclPtr<vcl::Window> Create(
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
index 57ea21a..cc62343 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
@@ -25,7 +25,7 @@ namespace svx { namespace sidebar {
TextCharacterSpacingPopup::TextCharacterSpacingPopup (
vcl::Window* pParent,
const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator)
const ::boost::function<VclPtr<PopupControl>(PopupContainer*)>& rControlCreator)
: Popup(
pParent,
rControlCreator,
diff --git a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
index 17ad29c..0c4331f 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
@@ -31,7 +31,7 @@ class TextCharacterSpacingPopup
public :
TextCharacterSpacingPopup (
vcl::Window* pParent,
const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator);
const ::boost::function<VclPtr<PopupControl>(PopupContainer*)>& rControlCreator);
virtual ~TextCharacterSpacingPopup (void);
void Rearrange (bool bLBAvailable,bool bAvailable, long nKerning);
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index b9b8c26..57ebb7d 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -43,14 +43,14 @@ const char UNO_UNDERLINE[] = ".uno:Underline";
namespace svx { namespace sidebar {
PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
VclPtr<PopupControl> TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
{
return new TextCharacterSpacingControl(pParent, *this, mpBindings);
return VclPtrInstance<TextCharacterSpacingControl>(pParent, *this, mpBindings);
}
PopupControl* TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
VclPtr<PopupControl> TextPropertyPanel::CreateUnderlinePopupControl (PopupContainer* pParent)
{
return new TextUnderlineControl(pParent, *this, mpBindings);
return VclPtrInstance<TextUnderlineControl>(pParent, *this, mpBindings);
}
long TextPropertyPanel::GetSelFontSize()
@@ -62,7 +62,7 @@ long TextPropertyPanel::GetSelFontSize()
return nH;
}
TextPropertyPanel* TextPropertyPanel::Create (
VclPtr<vcl::Window> TextPropertyPanel::Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -75,11 +75,13 @@ TextPropertyPanel* TextPropertyPanel::Create (
if (pBindings == NULL)
throw lang::IllegalArgumentException("no SfxBindings given to TextPropertyPanel::Create", NULL, 2);
return new TextPropertyPanel(
pParent,
rxFrame,
pBindings,
rContext);
return VclPtr< vcl::Window >(
new TextPropertyPanel(
pParent,
rxFrame,
pBindings,
rContext),
SAL_NO_ACQUIRE);
}
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index a5f295f..ee0abaa 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -49,7 +49,7 @@ public:
virtual ~TextPropertyPanel();
virtual void dispose() SAL_OVERRIDE;
static TextPropertyPanel* Create (
static VclPtr<vcl::Window> Create (
vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
@@ -107,8 +107,8 @@ private:
const ::sfx2::sidebar::EnumContext& rContext);
PopupControl* CreateCharacterSpacingControl (PopupContainer* pParent);
PopupControl* CreateUnderlinePopupControl (PopupContainer* pParent);
VclPtr<PopupControl> CreateCharacterSpacingControl (PopupContainer* pParent);
VclPtr<PopupControl> CreateUnderlinePopupControl (PopupContainer* pParent);
DECL_LINK(SpacingClickHdl, ToolBox*);
DECL_LINK(UnderlineClickHdl, ToolBox* );