diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-20 11:01:37 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-05-20 19:44:24 +0900 |
commit | 5f8b294bcc2ed1c518d8a07f257ee772cde37363 (patch) | |
tree | 35e0044f389500b7b8237c55eecf5f4df871adbd | |
parent | cc5f9db22ea7a127507584ab32cf1c2aa1a8979c (diff) |
boost::function to std, clenup
Change-Id: Iabd3c08b215780d65136877f8c9a2592ec6e2c63
-rw-r--r-- | sfx2/source/sidebar/FocusManager.cxx | 31 | ||||
-rw-r--r-- | sfx2/source/sidebar/FocusManager.hxx | 58 | ||||
-rw-r--r-- | sfx2/source/sidebar/Panel.cxx | 30 | ||||
-rw-r--r-- | sfx2/source/sidebar/Panel.hxx | 25 |
4 files changed, 65 insertions, 79 deletions
diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx index 37fa9940c1ea..16452fe3a4da 100644 --- a/sfx2/source/sidebar/FocusManager.cxx +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -35,7 +35,7 @@ FocusManager::FocusLocation::FocusLocation (const PanelComponent eComponent, con { } -FocusManager::FocusManager (const ::boost::function<void(const Panel&)>& rShowPanelFunctor) +FocusManager::FocusManager(const std::function<void(const Panel&)>& rShowPanelFunctor) : mpDeckTitleBar(), maPanels(), maButtons(), @@ -65,11 +65,9 @@ void FocusManager::Clear() void FocusManager::ClearPanels() { - ::std::vector<VclPtr<Panel> > aPanels; + std::vector<VclPtr<Panel> > aPanels; aPanels.swap(maPanels); - for (auto iPanel(aPanels.begin()),iEnd(aPanels.end()); - iPanel!=iEnd; - ++iPanel) + for (auto iPanel(aPanels.begin()),iEnd(aPanels.end()); iPanel != iEnd; ++iPanel) { UnregisterWindow(**iPanel); if ((*iPanel)->GetTitleBar() != NULL) @@ -84,11 +82,9 @@ void FocusManager::ClearPanels() void FocusManager::ClearButtons() { - ::std::vector<VclPtr<Button> > aButtons; + std::vector<VclPtr<Button> > aButtons; aButtons.swap(maButtons); - for (auto iButton(aButtons.begin()),iEnd(aButtons.end()); - iButton!=iEnd; - ++iButton) + for (auto iButton = aButtons.begin(); iButton != aButtons.end(); ++iButton) { UnregisterWindow(**iButton); } @@ -113,9 +109,7 @@ void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar) void FocusManager::SetPanels (const SharedPanelContainer& rPanels) { ClearPanels(); - for(SharedPanelContainer::const_iterator iPanel(rPanels.begin()),iEnd(rPanels.end()); - iPanel!=iEnd; - ++iPanel) + for (auto iPanel = rPanels.begin(); iPanel != rPanels.end(); ++iPanel) { RegisterWindow(**iPanel); if ((*iPanel)->GetTitleBar() != NULL) @@ -134,9 +128,7 @@ void FocusManager::SetPanels (const SharedPanelContainer& rPanels) void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons) { ClearButtons(); - for (::std::vector<Button*>::const_iterator iButton(rButtons.begin()),iEnd(rButtons.end()); - iButton!=iEnd; - ++iButton) + for (auto iButton = rButtons.begin(); iButton != rButtons.end(); ++iButton) { RegisterWindow(**iButton); maButtons.push_back(*iButton); @@ -165,7 +157,7 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r } // Search the panels. - for (sal_Int32 nIndex=0,nCount(maPanels.size()); nIndex<nCount; ++nIndex) + for (size_t nIndex = 0; nIndex < maPanels.size(); ++nIndex) { if (maPanels[nIndex] == &rWindow) return FocusLocation(PC_PanelContent, nIndex); @@ -177,10 +169,11 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r } // Search the buttons. - for (sal_Int32 nIndex=0,nCount(maButtons.size()); nIndex<nCount; ++nIndex) + for (size_t nIndex=0; nIndex < maButtons.size(); ++nIndex) + { if (maButtons[nIndex] == &rWindow) return FocusLocation(PC_TabBar, nIndex); - + } return FocusLocation(PC_None, -1); } @@ -558,7 +551,7 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent) if (pEvent == NULL) return 0; - if ( ! pEvent->ISA(VclWindowEvent)) + if (!pEvent->ISA(VclWindowEvent)) return 0; VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent); diff --git a/sfx2/source/sidebar/FocusManager.hxx b/sfx2/source/sidebar/FocusManager.hxx index 93367bd4ce44..f93f9e82c368 100644 --- a/sfx2/source/sidebar/FocusManager.hxx +++ b/sfx2/source/sidebar/FocusManager.hxx @@ -50,7 +50,7 @@ class DeckTitleBar; class FocusManager { public: - FocusManager (const ::boost::function<void(const Panel&)>& rShowPanelFunctor); + FocusManager(const std::function<void(const Panel&)>& rShowPanelFunctor); ~FocusManager(); /** Forget all panels and buttons. Remove all window listeners. @@ -63,15 +63,15 @@ public: */ void GrabFocus(); - void SetDeckTitle (DeckTitleBar* pDeckTitleBar); - void SetPanels (const SharedPanelContainer& rPanels); - void SetButtons (const ::std::vector<Button*>& rButtons); + void SetDeckTitle(DeckTitleBar* pDeckTitleBar); + void SetPanels(const SharedPanelContainer& rPanels); + void SetButtons(const ::std::vector<Button*>& rButtons); private: VclPtr<DeckTitleBar> mpDeckTitleBar; - ::std::vector<VclPtr<Panel> > maPanels; - ::std::vector<VclPtr<Button> > maButtons; - const ::boost::function<void(const Panel&)> maShowPanelFunctor; + std::vector<VclPtr<Panel> > maPanels; + std::vector<VclPtr<Button> > maButtons; + const std::function<void(const Panel&)> maShowPanelFunctor; bool mbObservingContentControlFocus; VclPtr<vcl::Window> mpFirstFocusedContentControl; VclPtr<vcl::Window> mpLastFocusedWindow; @@ -91,7 +91,7 @@ private: public: PanelComponent meComponent; sal_Int32 mnIndex; - FocusLocation (const PanelComponent eComponent, const sal_Int32 nIndex); + FocusLocation(const PanelComponent eComponent, const sal_Int32 nIndex); }; /** Listen for key events for panels and buttons. @@ -105,16 +105,16 @@ private: /** Let the focus manager listen for window events for the given window. */ - void RegisterWindow (vcl::Window& rWindow); - void UnregisterWindow (vcl::Window& rWindow); + void RegisterWindow(vcl::Window& rWindow); + void UnregisterWindow(vcl::Window& rWindow); /** Remove the window from the panel or the button container. */ - void RemoveWindow (vcl::Window& rWindow); + void RemoveWindow(vcl::Window& rWindow); void FocusDeckTitle(); bool IsDeckTitleVisible() const; - bool IsPanelTitleVisible (const sal_Int32 nPanelIndex) const; + bool IsPanelTitleVisible(const sal_Int32 nPanelIndex) const; /** Set the focus to the title bar of the panel or, if the title bar is not visible, directly to the panel. @@ -125,25 +125,21 @@ private: bias defines whether to focus the deck (true) or the panel content (false) will be focused instead. */ - void FocusPanel ( - const sal_Int32 nPanelIndex, - const bool bFallbackToDeckTitle); - - void FocusPanelContent (const sal_Int32 nPanelIndex); - void FocusButton (const sal_Int32 nButtonIndex); - void ClickButton (const sal_Int32 nButtonIndex); - bool MoveFocusInsidePanel ( - const FocusLocation& rLocation, - const sal_Int32 nDirection); - bool MoveFocusInsideDeckTitle ( - const FocusLocation& rLocation, - const sal_Int32 nDirection); - - void HandleKeyEvent ( - const vcl::KeyCode& rKeyCode, - const vcl::Window& rWindow); - - FocusLocation GetFocusLocation (const vcl::Window& rWindow) const; + void FocusPanel(const sal_Int32 nPanelIndex, + const bool bFallbackToDeckTitle); + + void FocusPanelContent(const sal_Int32 nPanelIndex); + void FocusButton(const sal_Int32 nButtonIndex); + void ClickButton(const sal_Int32 nButtonIndex); + bool MoveFocusInsidePanel(const FocusLocation& rLocation, + const sal_Int32 nDirection); + bool MoveFocusInsideDeckTitle(const FocusLocation& rLocation, + const sal_Int32 nDirection); + + void HandleKeyEvent(const vcl::KeyCode& rKeyCode, + const vcl::Window& rWindow); + + FocusLocation GetFocusLocation(const vcl::Window& rWindow) const; }; diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index 1ce86ff6aa44..07b1790b7eaf 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -46,17 +46,17 @@ namespace sfx2 { namespace sidebar { Panel::Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow, const bool bIsInitiallyExpanded, - const boost::function<void()>& rDeckLayoutTrigger, - const boost::function<Context()>& rContextAccess) - : Window(pParentWindow), - msPanelId(rPanelDescriptor.msId), - mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this)), - mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional), - mxElement(), - mxPanelComponent(), - mbIsExpanded(bIsInitiallyExpanded), - maDeckLayoutTrigger(rDeckLayoutTrigger), - maContextAccess(rContextAccess) + const std::function<void()>& rDeckLayoutTrigger, + const std::function<Context()>& rContextAccess) + : Window(pParentWindow) + , msPanelId(rPanelDescriptor.msId) + , mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this)) + , mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional) + , mxElement() + , mxPanelComponent() + , mbIsExpanded(bIsInitiallyExpanded) + , maDeckLayoutTrigger(rDeckLayoutTrigger) + , maContextAccess(rContextAccess) { SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); @@ -114,14 +114,16 @@ void Panel::SetExpanded (const bool bIsExpanded) maDeckLayoutTrigger(); if (maContextAccess) + { ResourceManager::Instance().StorePanelExpansionState( msPanelId, bIsExpanded, maContextAccess()); + } } } -bool Panel::HasIdPredicate (const ::rtl::OUString& rsId) const +bool Panel::HasIdPredicate (const OUString& rsId) const { return msPanelId.equals(rsId); } @@ -140,8 +142,8 @@ void Panel::Resize() if(xElementWindow.is()) { const Size aSize(GetSizePixel()); - xElementWindow->setPosSize( - 0, 0, aSize.Width(), aSize.Height(), awt::PosSize::POSSIZE); + xElementWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(), + awt::PosSize::POSSIZE); } } diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx index 86a7358c4518..2cfe520484cc 100644 --- a/sfx2/source/sidebar/Panel.hxx +++ b/sfx2/source/sidebar/Panel.hxx @@ -25,7 +25,6 @@ #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/ui/XSidebarPanel.hpp> -#include <boost/function.hpp> #include <boost/scoped_ptr.hpp> #include <boost/shared_ptr.hpp> #include <vector> @@ -36,16 +35,12 @@ class PanelDescriptor; class TitleBar; class PanelTitleBar; -class Panel - : public vcl::Window +class Panel : public vcl::Window { public: - Panel ( - const PanelDescriptor& rPanelDescriptor, - vcl::Window* pParentWindow, - const bool bIsInitiallyExpanded, - const ::boost::function<void()>& rDeckLayoutTrigger, - const ::boost::function<Context()>& rContextAccess); + Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow, + const bool bIsInitiallyExpanded, const std::function<void()>& rDeckLayoutTrigger, + const std::function<Context()>& rContextAccess); virtual ~Panel(); virtual void dispose() SAL_OVERRIDE; @@ -56,8 +51,8 @@ public: css::uno::Reference<css::awt::XWindow> GetElementWindow(); void SetExpanded (const bool bIsExpanded); bool IsExpanded() const { return mbIsExpanded;} - bool HasIdPredicate (const ::rtl::OUString& rsId) const; - const ::rtl::OUString& GetId() const { return msPanelId;} + bool HasIdPredicate (const OUString& rsId) const; + const OUString& GetId() const { return msPanelId;} virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -65,16 +60,16 @@ public: virtual void Activate() SAL_OVERRIDE; private: - const ::rtl::OUString msPanelId; + const OUString msPanelId; VclPtr<PanelTitleBar> mpTitleBar; const bool mbIsTitleBarOptional; css::uno::Reference<css::ui::XUIElement> mxElement; css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent; bool mbIsExpanded; - const ::boost::function<void()> maDeckLayoutTrigger; - const ::boost::function<Context()> maContextAccess; + const std::function<void()> maDeckLayoutTrigger; + const std::function<Context()> maContextAccess; }; -typedef ::std::vector< VclPtr< Panel > > SharedPanelContainer; +typedef std::vector<VclPtr<Panel> > SharedPanelContainer; } } // end of namespace sfx2::sidebar |