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
{
}
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);
......
......@@ -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;
};
......
......@@ -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);
}
}
......
......@@ -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
......
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