[Libreoffice-commits] core.git: 3 commits - sd/source svx/source
Michael Stahl
mstahl at redhat.com
Fri Feb 19 13:57:48 UTC 2016
sd/source/ui/slidesorter/controller/SlsAnimator.cxx | 17 +--
sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx | 6 -
sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx | 7 -
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 12 --
sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx | 7 -
sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx | 44 +++++-----
svx/source/sdr/properties/emptyproperties.cxx | 28 +++---
svx/source/sdr/properties/groupproperties.cxx | 20 ++--
8 files changed, 63 insertions(+), 78 deletions(-)
New commits:
commit 26912eea7521dd2b84bfac56b322cf0f8b142450
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Feb 19 14:34:44 2016 +0100
sd: replace boost::bind with C++11 lambdas and for loops
Change-Id: I4de92df1848a1c00e71d4cdb5638b73c3b76f282
diff --git a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx
index a4c6734..2dd7db8 100644
--- a/sd/source/ui/slidesorter/controller/SlsAnimator.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsAnimator.cxx
@@ -20,7 +20,6 @@
#include "controller/SlsAnimator.hxx"
#include "view/SlideSorterView.hxx"
#include "View.hxx"
-#include <boost/bind.hpp>
namespace sd { namespace slidesorter { namespace controller {
@@ -132,10 +131,8 @@ void Animator::RemoveAnimation (const Animator::AnimationId nId)
const AnimationList::iterator iAnimation (::std::find_if(
maAnimations.begin(),
maAnimations.end(),
- ::boost::bind(
- ::std::equal_to<Animator::AnimationId>(),
- nId,
- ::boost::bind(&Animation::mnAnimationId, _1))));
+ [nId] (std::shared_ptr<Animation> const& pAnim)
+ { return nId == pAnim->mnAnimationId; }));
if (iAnimation != maAnimations.end())
{
OSL_ASSERT((*iAnimation)->mnAnimationId == nId);
@@ -156,12 +153,10 @@ void Animator::RemoveAnimation (const Animator::AnimationId nId)
void Animator::RemoveAllAnimations()
{
- ::std::for_each(
- maAnimations.begin(),
- maAnimations.end(),
- ::boost::bind(
- &Animation::Expire,
- _1));
+ for (auto const& it : maAnimations)
+ {
+ it->Expire();
+ }
maAnimations.clear();
mnNextAnimationId = 0;
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
index e6068f5..49127da 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
@@ -36,7 +36,6 @@
#include "app.hrc"
#include "sdtreelb.hxx"
#include <sfx2/bindings.hxx>
-#include <boost/bind.hpp>
namespace sd { namespace slidesorter { namespace controller {
@@ -95,8 +94,9 @@ void DragAndDropContext::UpdatePosition (
bool bDoAutoScroll = bAllowAutoScroll
&& mpTargetSlideSorter->GetController().GetScrollBarManager().AutoScroll(
rMousePosition,
- ::boost::bind(
- &DragAndDropContext::UpdatePosition, this, rMousePosition, eMode, false));
+ [this, eMode, &rMousePosition] () {
+ return this->UpdatePosition(rMousePosition, eMode, false);
+ });
if (!bDoAutoScroll)
{
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 9758214..6c2396e 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -62,7 +62,6 @@
#include <svx/svdpagv.hxx>
#include <vcl/msgbox.hxx>
#include <svx/svxids.hrc>
-#include <boost/bind.hpp>
#include <boost/optional.hpp>
namespace {
@@ -1386,11 +1385,7 @@ void MultiSelectionModeHandler::UpdatePosition (
bool bDoAutoScroll = bAllowAutoScroll && mrSlideSorter.GetController().GetScrollBarManager().AutoScroll(
rMousePosition,
- ::boost::bind(
- &MultiSelectionModeHandler::UpdatePosition,
- this,
- rMousePosition,
- false));
+ [this, &rMousePosition] () { return this->UpdatePosition(rMousePosition, false); });
if (!bDoAutoScroll)
UpdateModelPosition(aMouseModelPosition);
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 0a2a382..a839bdca 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -87,7 +87,6 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <vcl/svapp.hxx>
-#include <boost/bind.hpp>
#include <memory>
using namespace ::com::sun::star;
@@ -1137,13 +1136,10 @@ void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
// Set the selection to the pages in aPagesToSelect.
PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
rSelector.DeselectAllPages();
- ::std::for_each (
- aPagesToSelect.begin(),
- aPagesToSelect.end(),
- ::boost::bind(
- static_cast<void (PageSelector::*)(const SdPage*)>(&PageSelector::SelectPage),
- ::boost::ref(rSelector),
- _1));
+ for (auto const& it: aPagesToSelect)
+ {
+ rSelector.SelectPage(it);
+ }
}
void SlotManager::ChangeSlideExclusionState (
commit db98187505c4eb95c0f815ee2646334b08445e21
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Feb 19 14:13:01 2016 +0100
sd: replace boost::bind with C++11 lambdas
Change-Id: Ib5837a056ea4131432c7b167b264019d4e32c2c8
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index c5d118635..365b73b 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -27,7 +27,6 @@
#include <memory>
#include <set>
-#include <boost/bind.hpp>
namespace sd { namespace slidesorter { namespace view {
@@ -258,10 +257,8 @@ InsertAnimator::Implementation::RunContainer::const_iterator
return std::find_if(
maRuns.begin(),
maRuns.end(),
- ::boost::bind(
- ::std::equal_to<sal_Int32>(),
- ::boost::bind(&PageObjectRun::mnRunIndex, _1),
- nRunIndex));
+ [nRunIndex] (std::shared_ptr<PageObjectRun> const& rRun)
+ { return rRun->mnRunIndex == nRunIndex; });
}
void InsertAnimator::Implementation::AddRun (const std::shared_ptr<PageObjectRun>& rRun)
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index 030d547..84de2c9 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -25,7 +25,6 @@
#include <tools/gen.hxx>
#include <tools/fract.hxx>
-#include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
#include <functional>
@@ -260,12 +259,13 @@ void LayeredDevice::RemovePainter (
void LayeredDevice::Repaint (const vcl::Region& rRepaintRegion)
{
// Validate the contents of all layers (that have their own devices.)
- ::std::for_each(
- mpLayers->begin(),
- mpLayers->end(),
- ::boost::bind(&Layer::Validate, _1, mpTargetWindow->GetMapMode()));
+ for (auto const& it : *mpLayers)
+ {
+ it->Validate(mpTargetWindow->GetMapMode());
+ }
- ForAllRectangles(rRepaintRegion, ::boost::bind(&LayeredDevice::RepaintRectangle, this, _1));
+ ForAllRectangles(rRepaintRegion,
+ [this] (Rectangle const& r) { this->RepaintRectangle(r); });
}
void LayeredDevice::RepaintRectangle (const Rectangle& rRepaintRectangle)
@@ -283,11 +283,10 @@ void LayeredDevice::RepaintRectangle (const Rectangle& rRepaintRectangle)
// due to synchronous paints) and then copy that into the target
// device.
mpBackBuffer->SetMapMode(mpTargetWindow->GetMapMode());
- ::std::for_each(
- mpLayers->begin(),
- mpLayers->end(),
- ::boost::bind(&Layer::Repaint, _1, ::boost::ref(*mpBackBuffer), rRepaintRectangle));
-
+ for (auto const& it : *mpLayers)
+ {
+ it->Repaint(*mpBackBuffer, rRepaintRectangle);
+ }
DeviceCopy(*mpTargetWindow, *mpBackBuffer, rRepaintRectangle);
}
}
@@ -296,12 +295,18 @@ void LayeredDevice::Resize()
{
const Size aSize (mpTargetWindow->GetSizePixel());
mpBackBuffer->SetOutputSizePixel(aSize);
- ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Resize, _1, aSize));
+ for (auto const& it : *mpLayers)
+ {
+ it->Resize(aSize);
+ }
}
void LayeredDevice::Dispose()
{
- ::std::for_each(mpLayers->begin(), mpLayers->end(), ::boost::bind(&Layer::Dispose, _1));
+ for (auto const& it : *mpLayers)
+ {
+ it->Dispose();
+ }
mpLayers->clear();
}
@@ -414,7 +419,7 @@ void Layer::Validate (const MapMode& rMapMode)
mpLayerDevice->SetMapMode(rMapMode);
ForAllRectangles(
aRegion,
- ::boost::bind(&Layer::ValidateRectangle, this, _1));
+ [this] (Rectangle const& r) { return this->ValidateRectangle(r); });
}
}
@@ -447,13 +452,10 @@ void Layer::Repaint (
}
else
{
- ::std::for_each(
- maPainters.begin(),
- maPainters.end(),
- ::boost::bind(&ILayerPainter::Paint,
- _1,
- ::boost::ref(rTargetDevice),
- rRepaintRectangle));
+ for (auto const& it : maPainters)
+ {
+ it->Paint(rTargetDevice, rRepaintRectangle);
+ }
}
}
commit 9db28f9ac11eba143169773012e87216a419fe84
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Feb 19 13:14:09 2016 +0100
svx: these look like they should be assert()
Change-Id: Icb70e87edd1a864da4ecb3931de9c402a115aaa5
diff --git a/svx/source/sdr/properties/emptyproperties.cxx b/svx/source/sdr/properties/emptyproperties.cxx
index e97d3e49..d44826f 100644
--- a/svx/source/sdr/properties/emptyproperties.cxx
+++ b/svx/source/sdr/properties/emptyproperties.cxx
@@ -34,7 +34,7 @@ namespace sdr
SfxItemSet* EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
{
// Basic implementation; Basic object has NO attributes
- SAL_WARN("svx.sdr", "EmptyProperties::CreateObjectSpecificItemSet() should never be called");
+ assert(!"EmptyProperties::CreateObjectSpecificItemSet() should never be called");
return new SfxItemSet(rPool);
}
@@ -73,66 +73,66 @@ namespace sdr
const_cast<EmptyProperties*>(this)->mpEmptyItemSet = const_cast<EmptyProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool());
}
- SAL_WARN_IF(!mpEmptyItemSet, "svx.sdr", "Could not create an SfxItemSet(!)");
- SAL_WARN("svx.sdr", "EmptyProperties::GetObjectItemSet() should never be called (!)");
+ assert(mpEmptyItemSet);
+ assert(!"EmptyProperties::GetObjectItemSet() should never be called");
return *mpEmptyItemSet;
}
void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::SetObjectItem() should never be called (!)");
+ assert(!"EmptyProperties::SetObjectItem() should never be called");
}
void EmptyProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::SetObjectItemDirect() should never be called (!)");
+ assert(!"EmptyProperties::SetObjectItemDirect() should never be called");
}
void EmptyProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::ClearObjectItem() should never be called (!)");
+ assert(!"EmptyProperties::ClearObjectItem() should never be called");
}
void EmptyProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::ClearObjectItemDirect() should never be called (!)");
+ assert(!"EmptyProperties::ClearObjectItemDirect() should never be called");
}
void EmptyProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::SetObjectItemSet() should never be called (!)");
+ assert(!"EmptyProperties::SetObjectItemSet() should never be called");
}
void EmptyProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::ItemSetChanged() should never be called (!)");
+ assert(!"EmptyProperties::ItemSetChanged() should never be called");
}
bool EmptyProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
{
- SAL_WARN("svx.sdr", "EmptyProperties::AllowItemChange() should never be called (!)");
+ assert(!"EmptyProperties::AllowItemChange() should never be called");
return true;
}
void EmptyProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::ItemChange() should never be called (!)");
+ assert(!"EmptyProperties::ItemChange() should never be called");
}
void EmptyProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::PostItemChange() should never be called (!)");
+ assert(!"EmptyProperties::PostItemChange() should never be called");
}
void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, bool /*bDontRemoveHardAttr*/)
{
- SAL_WARN("svx.sdr", "EmptyProperties::SetStyleSheet() should never be called (!)");
+ assert(!"EmptyProperties::SetStyleSheet() should never be called");
}
SfxStyleSheet* EmptyProperties::GetStyleSheet() const
{
- SAL_WARN("svx.sdr", "EmptyProperties::GetStyleSheet() should never be called (!)");
+ assert(!"EmptyProperties::GetStyleSheet() should never be called");
return nullptr;
}
} // end of namespace properties
diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx
index 0227321..00932e8 100644
--- a/svx/source/sdr/properties/groupproperties.cxx
+++ b/svx/source/sdr/properties/groupproperties.cxx
@@ -61,7 +61,7 @@ namespace sdr
const SfxItemSet& GroupProperties::GetObjectItemSet() const
{
- SAL_WARN("svx.sdr", "GroupProperties::GetObjectItemSet() should never be called (!)");
+ assert(!"GroupProperties::GetObjectItemSet() should never be called");
return DefaultProperties::GetObjectItemSet();
}
@@ -133,22 +133,22 @@ namespace sdr
void GroupProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::SetObjectItem() should never be called (!)");
+ assert(!"GroupProperties::SetObjectItem() should never be called");
}
void GroupProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::SetObjectItemDirect() should never be called (!)");
+ assert(!"GroupProperties::SetObjectItemDirect() should never be called");
}
void GroupProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::ClearObjectItem() should never be called (!)");
+ assert(!"GroupProperties::ClearObjectItem() should never be called");
}
void GroupProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::ClearObjectItemDirect() should never be called (!)");
+ assert(!"GroupProperties::ClearObjectItemDirect() should never be called");
}
void GroupProperties::SetMergedItem(const SfxPoolItem& rItem)
@@ -175,28 +175,28 @@ namespace sdr
void GroupProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::SetObjectItemSet() should never be called (!)");
+ assert(!"GroupProperties::SetObjectItemSet() should never be called");
}
void GroupProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::ItemSetChanged() should never be called (!)");
+ assert(!"GroupProperties::ItemSetChanged() should never be called");
}
bool GroupProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
{
- SAL_WARN("svx.sdr", "GroupProperties::AllowItemChange() should never be called (!)");
+ assert(!"GroupProperties::AllowItemChange() should never be called");
return false;
}
void GroupProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::ItemChange() should never be called (!)");
+ assert(!"GroupProperties::ItemChange() should never be called");
}
void GroupProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
{
- SAL_WARN("svx.sdr", "GroupProperties::PostItemChange() should never be called (!)");
+ assert(!"GroupProperties::PostItemChange() should never be called");
}
SfxStyleSheet* GroupProperties::GetStyleSheet() const
More information about the Libreoffice-commits
mailing list