Kaydet (Commit) 5f8b294b authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

boost::function to std, clenup

Change-Id: Iabd3c08b215780d65136877f8c9a2592ec6e2c63
üst cc5f9db2
...@@ -35,7 +35,7 @@ FocusManager::FocusLocation::FocusLocation (const PanelComponent eComponent, con ...@@ -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(), : mpDeckTitleBar(),
maPanels(), maPanels(),
maButtons(), maButtons(),
...@@ -65,11 +65,9 @@ void FocusManager::Clear() ...@@ -65,11 +65,9 @@ void FocusManager::Clear()
void FocusManager::ClearPanels() void FocusManager::ClearPanels()
{ {
::std::vector<VclPtr<Panel> > aPanels; std::vector<VclPtr<Panel> > aPanels;
aPanels.swap(maPanels); aPanels.swap(maPanels);
for (auto iPanel(aPanels.begin()),iEnd(aPanels.end()); for (auto iPanel(aPanels.begin()),iEnd(aPanels.end()); iPanel != iEnd; ++iPanel)
iPanel!=iEnd;
++iPanel)
{ {
UnregisterWindow(**iPanel); UnregisterWindow(**iPanel);
if ((*iPanel)->GetTitleBar() != NULL) if ((*iPanel)->GetTitleBar() != NULL)
...@@ -84,11 +82,9 @@ void FocusManager::ClearPanels() ...@@ -84,11 +82,9 @@ void FocusManager::ClearPanels()
void FocusManager::ClearButtons() void FocusManager::ClearButtons()
{ {
::std::vector<VclPtr<Button> > aButtons; std::vector<VclPtr<Button> > aButtons;
aButtons.swap(maButtons); aButtons.swap(maButtons);
for (auto iButton(aButtons.begin()),iEnd(aButtons.end()); for (auto iButton = aButtons.begin(); iButton != aButtons.end(); ++iButton)
iButton!=iEnd;
++iButton)
{ {
UnregisterWindow(**iButton); UnregisterWindow(**iButton);
} }
...@@ -113,9 +109,7 @@ void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar) ...@@ -113,9 +109,7 @@ void FocusManager::SetDeckTitle (DeckTitleBar* pDeckTitleBar)
void FocusManager::SetPanels (const SharedPanelContainer& rPanels) void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
{ {
ClearPanels(); ClearPanels();
for(SharedPanelContainer::const_iterator iPanel(rPanels.begin()),iEnd(rPanels.end()); for (auto iPanel = rPanels.begin(); iPanel != rPanels.end(); ++iPanel)
iPanel!=iEnd;
++iPanel)
{ {
RegisterWindow(**iPanel); RegisterWindow(**iPanel);
if ((*iPanel)->GetTitleBar() != NULL) if ((*iPanel)->GetTitleBar() != NULL)
...@@ -134,9 +128,7 @@ void FocusManager::SetPanels (const SharedPanelContainer& rPanels) ...@@ -134,9 +128,7 @@ void FocusManager::SetPanels (const SharedPanelContainer& rPanels)
void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons) void FocusManager::SetButtons (const ::std::vector<Button*>& rButtons)
{ {
ClearButtons(); ClearButtons();
for (::std::vector<Button*>::const_iterator iButton(rButtons.begin()),iEnd(rButtons.end()); for (auto iButton = rButtons.begin(); iButton != rButtons.end(); ++iButton)
iButton!=iEnd;
++iButton)
{ {
RegisterWindow(**iButton); RegisterWindow(**iButton);
maButtons.push_back(*iButton); maButtons.push_back(*iButton);
...@@ -165,7 +157,7 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r ...@@ -165,7 +157,7 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
} }
// Search the panels. // 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) if (maPanels[nIndex] == &rWindow)
return FocusLocation(PC_PanelContent, nIndex); return FocusLocation(PC_PanelContent, nIndex);
...@@ -177,10 +169,11 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r ...@@ -177,10 +169,11 @@ FocusManager::FocusLocation FocusManager::GetFocusLocation (const vcl::Window& r
} }
// Search the buttons. // 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) if (maButtons[nIndex] == &rWindow)
return FocusLocation(PC_TabBar, nIndex); return FocusLocation(PC_TabBar, nIndex);
}
return FocusLocation(PC_None, -1); return FocusLocation(PC_None, -1);
} }
...@@ -558,7 +551,7 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent) ...@@ -558,7 +551,7 @@ IMPL_LINK(FocusManager, ChildEventListener, VclSimpleEvent*, pEvent)
if (pEvent == NULL) if (pEvent == NULL)
return 0; return 0;
if ( ! pEvent->ISA(VclWindowEvent)) if (!pEvent->ISA(VclWindowEvent))
return 0; return 0;
VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent); VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
......
...@@ -50,7 +50,7 @@ class DeckTitleBar; ...@@ -50,7 +50,7 @@ class DeckTitleBar;
class FocusManager class FocusManager
{ {
public: public:
FocusManager (const ::boost::function<void(const Panel&)>& rShowPanelFunctor); FocusManager(const std::function<void(const Panel&)>& rShowPanelFunctor);
~FocusManager(); ~FocusManager();
/** Forget all panels and buttons. Remove all window listeners. /** Forget all panels and buttons. Remove all window listeners.
...@@ -63,15 +63,15 @@ public: ...@@ -63,15 +63,15 @@ public:
*/ */
void GrabFocus(); void GrabFocus();
void SetDeckTitle (DeckTitleBar* pDeckTitleBar); void SetDeckTitle(DeckTitleBar* pDeckTitleBar);
void SetPanels (const SharedPanelContainer& rPanels); void SetPanels(const SharedPanelContainer& rPanels);
void SetButtons (const ::std::vector<Button*>& rButtons); void SetButtons(const ::std::vector<Button*>& rButtons);
private: private:
VclPtr<DeckTitleBar> mpDeckTitleBar; VclPtr<DeckTitleBar> mpDeckTitleBar;
::std::vector<VclPtr<Panel> > maPanels; std::vector<VclPtr<Panel> > maPanels;
::std::vector<VclPtr<Button> > maButtons; std::vector<VclPtr<Button> > maButtons;
const ::boost::function<void(const Panel&)> maShowPanelFunctor; const std::function<void(const Panel&)> maShowPanelFunctor;
bool mbObservingContentControlFocus; bool mbObservingContentControlFocus;
VclPtr<vcl::Window> mpFirstFocusedContentControl; VclPtr<vcl::Window> mpFirstFocusedContentControl;
VclPtr<vcl::Window> mpLastFocusedWindow; VclPtr<vcl::Window> mpLastFocusedWindow;
...@@ -91,7 +91,7 @@ private: ...@@ -91,7 +91,7 @@ private:
public: public:
PanelComponent meComponent; PanelComponent meComponent;
sal_Int32 mnIndex; 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. /** Listen for key events for panels and buttons.
...@@ -105,16 +105,16 @@ private: ...@@ -105,16 +105,16 @@ private:
/** Let the focus manager listen for window events for the given /** Let the focus manager listen for window events for the given
window. window.
*/ */
void RegisterWindow (vcl::Window& rWindow); void RegisterWindow(vcl::Window& rWindow);
void UnregisterWindow (vcl::Window& rWindow); void UnregisterWindow(vcl::Window& rWindow);
/** Remove the window from the panel or the button container. /** Remove the window from the panel or the button container.
*/ */
void RemoveWindow (vcl::Window& rWindow); void RemoveWindow(vcl::Window& rWindow);
void FocusDeckTitle(); void FocusDeckTitle();
bool IsDeckTitleVisible() const; 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 /** Set the focus to the title bar of the panel or, if the
title bar is not visible, directly to the panel. title bar is not visible, directly to the panel.
...@@ -125,25 +125,21 @@ private: ...@@ -125,25 +125,21 @@ private:
bias defines whether to focus the deck (true) or the panel bias defines whether to focus the deck (true) or the panel
content (false) will be focused instead. content (false) will be focused instead.
*/ */
void FocusPanel ( void FocusPanel(const sal_Int32 nPanelIndex,
const sal_Int32 nPanelIndex, const bool bFallbackToDeckTitle);
const bool bFallbackToDeckTitle);
void FocusPanelContent(const sal_Int32 nPanelIndex);
void FocusPanelContent (const sal_Int32 nPanelIndex); void FocusButton(const sal_Int32 nButtonIndex);
void FocusButton (const sal_Int32 nButtonIndex); void ClickButton(const sal_Int32 nButtonIndex);
void ClickButton (const sal_Int32 nButtonIndex); bool MoveFocusInsidePanel(const FocusLocation& rLocation,
bool MoveFocusInsidePanel ( const sal_Int32 nDirection);
const FocusLocation& rLocation, bool MoveFocusInsideDeckTitle(const FocusLocation& rLocation,
const sal_Int32 nDirection); const sal_Int32 nDirection);
bool MoveFocusInsideDeckTitle (
const FocusLocation& rLocation, void HandleKeyEvent(const vcl::KeyCode& rKeyCode,
const sal_Int32 nDirection); const vcl::Window& rWindow);
void HandleKeyEvent ( FocusLocation GetFocusLocation(const vcl::Window& rWindow) const;
const vcl::KeyCode& rKeyCode,
const vcl::Window& rWindow);
FocusLocation GetFocusLocation (const vcl::Window& rWindow) const;
}; };
......
...@@ -46,17 +46,17 @@ namespace sfx2 { namespace sidebar { ...@@ -46,17 +46,17 @@ namespace sfx2 { namespace sidebar {
Panel::Panel(const PanelDescriptor& rPanelDescriptor, Panel::Panel(const PanelDescriptor& rPanelDescriptor,
vcl::Window* pParentWindow, vcl::Window* pParentWindow,
const bool bIsInitiallyExpanded, const bool bIsInitiallyExpanded,
const boost::function<void()>& rDeckLayoutTrigger, const std::function<void()>& rDeckLayoutTrigger,
const boost::function<Context()>& rContextAccess) const std::function<Context()>& rContextAccess)
: Window(pParentWindow), : Window(pParentWindow)
msPanelId(rPanelDescriptor.msId), , msPanelId(rPanelDescriptor.msId)
mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this)), , mpTitleBar(VclPtr<PanelTitleBar>::Create(rPanelDescriptor.msTitle, pParentWindow, this))
mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional), , mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional)
mxElement(), , mxElement()
mxPanelComponent(), , mxPanelComponent()
mbIsExpanded(bIsInitiallyExpanded), , mbIsExpanded(bIsInitiallyExpanded)
maDeckLayoutTrigger(rDeckLayoutTrigger), , maDeckLayoutTrigger(rDeckLayoutTrigger)
maContextAccess(rContextAccess) , maContextAccess(rContextAccess)
{ {
SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper());
...@@ -114,14 +114,16 @@ void Panel::SetExpanded (const bool bIsExpanded) ...@@ -114,14 +114,16 @@ void Panel::SetExpanded (const bool bIsExpanded)
maDeckLayoutTrigger(); maDeckLayoutTrigger();
if (maContextAccess) if (maContextAccess)
{
ResourceManager::Instance().StorePanelExpansionState( ResourceManager::Instance().StorePanelExpansionState(
msPanelId, msPanelId,
bIsExpanded, bIsExpanded,
maContextAccess()); maContextAccess());
}
} }
} }
bool Panel::HasIdPredicate (const ::rtl::OUString& rsId) const bool Panel::HasIdPredicate (const OUString& rsId) const
{ {
return msPanelId.equals(rsId); return msPanelId.equals(rsId);
} }
...@@ -140,8 +142,8 @@ void Panel::Resize() ...@@ -140,8 +142,8 @@ void Panel::Resize()
if(xElementWindow.is()) if(xElementWindow.is())
{ {
const Size aSize(GetSizePixel()); const Size aSize(GetSizePixel());
xElementWindow->setPosSize( xElementWindow->setPosSize(0, 0, aSize.Width(), aSize.Height(),
0, 0, aSize.Width(), aSize.Height(), awt::PosSize::POSSIZE); awt::PosSize::POSSIZE);
} }
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/ui/XUIElement.hpp>
#include <com/sun/star/ui/XSidebarPanel.hpp> #include <com/sun/star/ui/XSidebarPanel.hpp>
#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <vector> #include <vector>
...@@ -36,16 +35,12 @@ class PanelDescriptor; ...@@ -36,16 +35,12 @@ class PanelDescriptor;
class TitleBar; class TitleBar;
class PanelTitleBar; class PanelTitleBar;
class Panel class Panel : public vcl::Window
: public vcl::Window
{ {
public: public:
Panel ( Panel(const PanelDescriptor& rPanelDescriptor, vcl::Window* pParentWindow,
const PanelDescriptor& rPanelDescriptor, const bool bIsInitiallyExpanded, const std::function<void()>& rDeckLayoutTrigger,
vcl::Window* pParentWindow, const std::function<Context()>& rContextAccess);
const bool bIsInitiallyExpanded,
const ::boost::function<void()>& rDeckLayoutTrigger,
const ::boost::function<Context()>& rContextAccess);
virtual ~Panel(); virtual ~Panel();
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
...@@ -56,8 +51,8 @@ public: ...@@ -56,8 +51,8 @@ public:
css::uno::Reference<css::awt::XWindow> GetElementWindow(); css::uno::Reference<css::awt::XWindow> GetElementWindow();
void SetExpanded (const bool bIsExpanded); void SetExpanded (const bool bIsExpanded);
bool IsExpanded() const { return mbIsExpanded;} bool IsExpanded() const { return mbIsExpanded;}
bool HasIdPredicate (const ::rtl::OUString& rsId) const; bool HasIdPredicate (const OUString& rsId) const;
const ::rtl::OUString& GetId() const { return msPanelId;} const OUString& GetId() const { return msPanelId;}
virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE; virtual void Paint (vcl::RenderContext& rRenderContext, const Rectangle& rUpdateArea) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
...@@ -65,16 +60,16 @@ public: ...@@ -65,16 +60,16 @@ public:
virtual void Activate() SAL_OVERRIDE; virtual void Activate() SAL_OVERRIDE;
private: private:
const ::rtl::OUString msPanelId; const OUString msPanelId;
VclPtr<PanelTitleBar> mpTitleBar; VclPtr<PanelTitleBar> mpTitleBar;
const bool mbIsTitleBarOptional; const bool mbIsTitleBarOptional;
css::uno::Reference<css::ui::XUIElement> mxElement; css::uno::Reference<css::ui::XUIElement> mxElement;
css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent; css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent;
bool mbIsExpanded; bool mbIsExpanded;
const ::boost::function<void()> maDeckLayoutTrigger; const std::function<void()> maDeckLayoutTrigger;
const ::boost::function<Context()> maContextAccess; const std::function<Context()> maContextAccess;
}; };
typedef ::std::vector< VclPtr< Panel > > SharedPanelContainer; typedef std::vector<VclPtr<Panel> > SharedPanelContainer;
} } // end of namespace sfx2::sidebar } } // end of namespace sfx2::sidebar
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment