summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-16 12:17:44 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 11:20:46 +0100
commitc72fac269626cd4c2c3f62a6eed69e47b59256a4 (patch)
treed36dd1a09731cb07254ae4a09036b2d64a59de44 /sfx2
parentde6b9148eb64dfa4b31c87c1ac46fda0821645e3 (diff)
vclwidget: convert lots more sites to use VclPtr
seems there was a lot of shared_ptr usage floating around... Change-Id: Icd05243170eb8493709275fc36bf986fc194b781
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/Deck.cxx6
-rw-r--r--sfx2/source/sidebar/Deck.hxx10
-rw-r--r--sfx2/source/sidebar/DeckLayouter.cxx4
-rw-r--r--sfx2/source/sidebar/Panel.cxx1
-rw-r--r--sfx2/source/sidebar/Panel.hxx5
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx24
-rw-r--r--sfx2/source/sidebar/SidebarController.hxx8
-rw-r--r--sfx2/source/sidebar/TabBar.cxx3
-rw-r--r--sfx2/source/sidebar/TabBar.hxx4
9 files changed, 36 insertions, 29 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 28e78f7f4fa3..b1e29174434b 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -89,6 +89,11 @@ void Deck::dispose()
maPanels[i]->dispose();
maPanels.clear();
+ mpTitleBar.disposeAndClear();
+ mpScrollClipWindow.disposeAndClear();
+ mpScrollContainer.disposeAndClear();
+ mpFiller.disposeAndClear();
+ mpVerticalScrollBar.disposeAndClear();
vcl::Window::dispose();
}
@@ -105,7 +110,6 @@ void Deck::Dispose (void)
if (*iPanel)
{
(*iPanel)->Dispose();
- OSL_ASSERT(iPanel->unique());
iPanel->reset();
}
}
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index 93623fca6cf5..6aaeabe69ed6 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -89,11 +89,11 @@ private:
Image maIcon;
sal_Int32 mnMinimalWidth;
SharedPanelContainer maPanels;
- ::boost::scoped_ptr<DeckTitleBar> mpTitleBar;
- ::boost::scoped_ptr<vcl::Window> mpScrollClipWindow;
- ::boost::scoped_ptr<ScrollContainerWindow> mpScrollContainer;
- ::boost::scoped_ptr<vcl::Window> mpFiller;
- ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
+ VclPtr<DeckTitleBar> mpTitleBar;
+ VclPtr<vcl::Window> mpScrollClipWindow;
+ VclPtr<ScrollContainerWindow> mpScrollContainer;
+ VclPtr<vcl::Window> mpFiller;
+ VclPtr<ScrollBar> mpVerticalScrollBar;
DECL_LINK(HandleVerticalScrollBarChange,void*);
bool ProcessWheelEvent(CommandEvent* pCommandEvent);
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 984b61bedd2e..5146170009f0 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -43,7 +43,7 @@ namespace {
class LayoutItem
{
public:
- SharedPanel mpPanel;
+ VclPtr<Panel> mpPanel;
css::ui::LayoutSize maLayoutSize;
sal_Int32 mnDistributedHeight;
sal_Int32 mnWeight;
@@ -348,7 +348,7 @@ void GetRequestedSizes (
IterateLayoutItems(iItem,rLayoutItems)
{
ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0));
- if (iItem->mpPanel != 0)
+ if (iItem->mpPanel != nullptr)
{
if (rLayoutItems.size() == 1
&& iItem->mpPanel->IsTitleBarOptional())
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 7d762eac842e..086999ee9289 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -77,6 +77,7 @@ Panel::~Panel()
void Panel::dispose()
{
Dispose();
+ mpTitleBar.disposeAndClear();
vcl::Window::dispose();
}
diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx
index dd06ddfceadf..edacf7e93099 100644
--- a/sfx2/source/sidebar/Panel.hxx
+++ b/sfx2/source/sidebar/Panel.hxx
@@ -68,7 +68,7 @@ public:
private:
const ::rtl::OUString msPanelId;
- ::boost::scoped_ptr<PanelTitleBar> mpTitleBar;
+ VclPtr<PanelTitleBar> mpTitleBar;
const bool mbIsTitleBarOptional;
css::uno::Reference<css::ui::XUIElement> mxElement;
css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
@@ -76,8 +76,7 @@ private:
const ::boost::function<void(void)> maDeckLayoutTrigger;
const ::boost::function<Context(void)> maContextAccess;
};
-typedef ::boost::shared_ptr<Panel> SharedPanel;
-typedef ::std::vector<SharedPanel> SharedPanelContainer;
+typedef ::std::vector< VclPtr< Panel > > SharedPanelContainer;
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 807403248053..9f78d5896f1a 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -292,7 +292,7 @@ void SidebarController::NotifyResize (void)
{
if (mpTabBar == 0)
{
- OSL_ASSERT(mpTabBar!=0);
+ OSL_ASSERT(mpTabBar!=nullptr);
return;
}
@@ -621,10 +621,12 @@ void SidebarController::SwitchToDeck (
}
else
{
- iPanel = ::std::find_if(
- rCurrentPanels.begin(),
- rCurrentPanels.end(),
- ::boost::bind(&Panel::HasIdPredicate, _1, ::boost::cref(rPanelContexDescriptor.msId)));
+ for (auto a = rCurrentPanels.begin(); a != rCurrentPanels.end(); ++a)
+ {
+ iPanel = a;
+ if ((*iPanel)->HasIdPredicate(rPanelContexDescriptor.msId))
+ break;
+ }
}
if (iPanel != rCurrentPanels.end())
{
@@ -643,7 +645,7 @@ void SidebarController::SwitchToDeck (
rContext);
bHasPanelSetChanged = true;
}
- if (aNewPanels[nWriteIndex] != 0)
+ if (aNewPanels[nWriteIndex] != nullptr)
{
// Depending on the context we have to change the command
// for the "more options" dialog.
@@ -684,7 +686,7 @@ void SidebarController::SwitchToDeck (
UpdateTitleBarIcons();
}
-SharedPanel SidebarController::CreatePanel (
+Panel* SidebarController::CreatePanel (
const OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
@@ -692,15 +694,15 @@ SharedPanel SidebarController::CreatePanel (
{
const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
if (pPanelDescriptor == NULL)
- return SharedPanel();
+ return NULL;
// Create the panel which is the parent window of the UIElement.
- SharedPanel pPanel (new Panel(
+ Panel *pPanel = new Panel(
*pPanelDescriptor,
pParentWindow,
bIsInitiallyExpanded,
::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
- ::boost::bind(&SidebarController::GetCurrentContext, this)));
+ ::boost::bind(&SidebarController::GetCurrentContext, this));
// Create the XUIElement.
Reference<ui::XUIElement> xUIElement (CreateUIElement(
@@ -715,7 +717,7 @@ SharedPanel SidebarController::CreatePanel (
}
else
{
- pPanel.reset();
+ pPanel = NULL;
}
return pPanel;
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 340aba5c32eb..68f634d86b98 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -144,9 +144,9 @@ private:
> SidebarControllerContainer;
static SidebarControllerContainer maSidebarControllerContainer;
- ::boost::scoped_ptr<Deck> mpCurrentDeck;
+ VclPtr<Deck> mpCurrentDeck;
VclPtr<SidebarDockingWindow> mpParentWindow;
- ::boost::scoped_ptr<TabBar> mpTabBar;
+ VclPtr<TabBar> mpTabBar;
css::uno::Reference<css::frame::XFrame> mxFrame;
Context maCurrentContext;
Context maRequestedContext;
@@ -186,7 +186,7 @@ private:
to indicate that when the current mouse drag operation ends, the
sidebar will only show the tab bar.
*/
- ::boost::scoped_ptr<vcl::Window> mpCloseIndicator;
+ VclPtr<vcl::Window> mpCloseIndicator;
DECL_LINK(WindowEventHandler, VclWindowEvent*);
/** Make maRequestedContext the current context.
@@ -198,7 +198,7 @@ private:
const ::rtl::OUString& rsImplementationURL,
const bool bWantsCanvas,
const Context& rContext);
- SharedPanel CreatePanel (
+ Panel* CreatePanel (
const ::rtl::OUString& rsPanelId,
vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded,
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index f765972a88f7..795b91655049 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -71,6 +71,7 @@ void TabBar::dispose()
{
maItems.clear();
mpMenuButton.reset();
+ mpMenuButton.disposeAndClear();
vcl::Window::dispose();
}
@@ -184,7 +185,7 @@ void TabBar::Layout (void)
Theme::GetInteger(Theme::Int_TabItemHeight) * GetDPIScaleFactor());
// Place the menu button and the separator.
- if (mpMenuButton != 0)
+ if (mpMenuButton != nullptr)
{
mpMenuButton->SetPosSizePixel(
Point(nX,nY),
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index 47436dc93d64..31778a5d180d 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -94,12 +94,12 @@ public:
private:
css::uno::Reference<css::frame::XFrame> mxFrame;
- ::boost::scoped_ptr<CheckBox> mpMenuButton;
+ VclPtr<CheckBox> mpMenuButton;
class Item
{
public:
DECL_LINK(HandleClick, Button*);
- ::boost::shared_ptr<RadioButton> mpButton;
+ VclPtr<RadioButton> mpButton;
::rtl::OUString msDeckId;
::boost::function<void(const ::rtl::OUString&rsDeckId)> maDeckActivationFunctor;
bool mbIsHidden;