[Libreoffice-commits] core.git: 2 commits - reportdesign/inc reportdesign/source

Michael Stahl mstahl at redhat.com
Thu May 12 12:40:58 UTC 2016


 reportdesign/inc/pch/precompiled_rpt.hxx              |    1 
 reportdesign/inc/pch/precompiled_rptui.hxx            |    1 
 reportdesign/inc/pch/precompiled_rptxml.hxx           |    1 
 reportdesign/source/core/api/ReportDefinition.cxx     |   23 +++++---
 reportdesign/source/filter/xml/xmlExport.cxx          |    8 +--
 reportdesign/source/ui/inspection/GeometryHandler.cxx |   48 ++++++++++--------
 reportdesign/source/ui/report/ReportController.cxx    |   19 ++-----
 reportdesign/source/ui/report/ViewsWindow.cxx         |    4 -
 8 files changed, 54 insertions(+), 51 deletions(-)

New commits:
commit 2f353af253ff437ad0cb34a2000c30da0f4ecf79
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 12 14:03:53 2016 +0200

    reportdesign: replace rest of boost::ref usage with C++11 lambdas
    
    Change-Id: Ib530bbecbbb19fa09b24d3837d8f8f023d4ed359

diff --git a/reportdesign/inc/pch/precompiled_rpt.hxx b/reportdesign/inc/pch/precompiled_rpt.hxx
index 37c0ec2..e5cb5aa 100644
--- a/reportdesign/inc/pch/precompiled_rpt.hxx
+++ b/reportdesign/inc/pch/precompiled_rpt.hxx
@@ -53,7 +53,6 @@
 #include <unordered_map>
 #include <utility>
 #include <vector>
-#include <boost/bind.hpp>
 #include <boost/intrusive_ptr.hpp>
 #include <boost/optional.hpp>
 #include <osl/conditn.hxx>
diff --git a/reportdesign/inc/pch/precompiled_rptui.hxx b/reportdesign/inc/pch/precompiled_rptui.hxx
index 2769eb1..7b366c8 100644
--- a/reportdesign/inc/pch/precompiled_rptui.hxx
+++ b/reportdesign/inc/pch/precompiled_rptui.hxx
@@ -57,7 +57,6 @@
 #include <unordered_set>
 #include <utility>
 #include <vector>
-#include <boost/bind.hpp>
 #include <boost/intrusive_ptr.hpp>
 #include <osl/conditn.h>
 #include <osl/conditn.hxx>
diff --git a/reportdesign/inc/pch/precompiled_rptxml.hxx b/reportdesign/inc/pch/precompiled_rptxml.hxx
index 19d2998..ccd7c37 100644
--- a/reportdesign/inc/pch/precompiled_rptxml.hxx
+++ b/reportdesign/inc/pch/precompiled_rptxml.hxx
@@ -26,7 +26,6 @@
 #include <string.h>
 #include <unordered_set>
 #include <vector>
-#include <boost/bind.hpp>
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
 #include <rtl/math.hxx>
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 186428b..9ed84a2 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -79,7 +79,6 @@
 #include <connectivity/dbconversion.hxx>
 #include <connectivity/dbtools.hxx>
 
-#include <boost/bind.hpp>
 #include "metadata.hxx"
 #include <svl/itempool.hxx>
 #include <svl/itemset.hxx>
@@ -120,15 +119,6 @@ namespace rptui
 using namespace ::com::sun::star;
 
 namespace{
-// comparing two property instances
-struct PropertyCompare : public ::std::binary_function< beans::Property, OUString , bool >
-{
-    bool operator() (const beans::Property& x, const OUString& y) const
-    {
-        return x.Name.equals(y);
-    }
-};
-
 
 OUString lcl_getQuotedFunctionName(const OUString& _sFunction)
 {
@@ -932,7 +922,10 @@ beans::Property GeometryHandler::getProperty(const OUString & PropertyName)
     uno::Sequence< beans::Property > aProps = getSupportedProperties();
     const beans::Property* pIter = aProps.getConstArray();
     const beans::Property* pEnd  = pIter + aProps.getLength();
-    const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(PropertyName)));
+    const beans::Property* pFind = ::std::find_if(pIter, pEnd,
+            [&PropertyName] (const beans::Property& x) -> bool {
+                return x.Name.equals(PropertyName);
+            });
     if ( pFind == pEnd )
         return beans::Property();
     return *pFind;
@@ -1321,7 +1314,10 @@ uno::Sequence< beans::Property > SAL_CALL GeometryHandler::getSupportedPropertie
     {
         const beans::Property* pIter = aSeq.getConstArray();
         const beans::Property* pEnd  = pIter + aSeq.getLength();
-        const beans::Property* pFind = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyCompare(),boost::cref(rIncludeProp)));
+        const beans::Property* pFind = ::std::find_if(pIter, pEnd,
+            [&rIncludeProp] (const beans::Property& x) -> bool {
+                return x.Name.equals(rIncludeProp);
+            });
         if ( pFind != pEnd )
         {
             // special case for controls which contain a data field
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index afbc800..ef85318 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -140,7 +140,6 @@
 #include "PageNumber.hxx"
 #include "UndoEnv.hxx"
 
-#include <boost/bind.hpp>
 #include <memory>
 
 #include <cppuhelper/exc_hlp.hxx>
@@ -183,15 +182,6 @@ using namespace ::cppu;
 
 namespace
 {
-    // comparing two PropertyValue instances
-    struct PropertyValueCompare : public ::std::binary_function< beans::PropertyValue, OUString , bool >
-    {
-        bool operator() (const beans::PropertyValue& x, const OUString& y) const
-        {
-            return x.Name.equals(y);
-        }
-    };
-
     void lcl_setFontWPU_nothrow(const uno::Reference< report::XReportControlFormat>& _xReportControlFormat,const sal_Int32 _nId)
     {
         if ( _xReportControlFormat.is() )
@@ -3984,7 +3974,10 @@ void OReportController::createDefaultControl(const uno::Sequence< beans::Propert
         const OUString sKeyModifier("KeyModifier");
         const beans::PropertyValue* pIter = _aArgs.getConstArray();
         const beans::PropertyValue* pEnd  = pIter + _aArgs.getLength();
-        const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter,pEnd,::std::bind2nd(PropertyValueCompare(),boost::cref(sKeyModifier)));
+        const beans::PropertyValue* pKeyModifier = ::std::find_if(pIter, pEnd,
+            [&sKeyModifier] (const beans::PropertyValue& x) -> bool {
+                return x.Name.equals(sKeyModifier);
+            });
         sal_Int16 nKeyModifier = 0;
         if ( pKeyModifier == pEnd || ((pKeyModifier->Value >>= nKeyModifier) && nKeyModifier == KEY_MOD1) )
         {
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index b0ebb41..3db7fc4 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -41,8 +41,6 @@
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 
-#include <boost/bind.hpp>
-
 #include "helpids.hrc"
 #include <svx/svdundo.hxx>
 #include <toolkit/helper/convert.hxx>
@@ -394,7 +392,7 @@ void OViewsWindow::Copy()
     uno::Sequence< beans::NamedValue > aAllreadyCopiedObjects;
     ::std::for_each(m_aSections.begin(),m_aSections.end(),
         [&aAllreadyCopiedObjects] (const TSectionsMap::value_type& sectionPtr) {
-            sectionPtr->getReportSection().Copy(boost::ref(aAllreadyCopiedObjects));
+            sectionPtr->getReportSection().Copy(aAllreadyCopiedObjects);
         });
 
     OReportExchange* pCopy = new OReportExchange(aAllreadyCopiedObjects);
commit 3e61eb69ac1cff727072011e228eabfc8bc055c0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu May 12 13:43:03 2016 +0200

    reportdesign: replace boost::bind with C++11 stuff
    
    Change-Id: Idd164e36d6f20a24123886ee1f15202c796eacc6

diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 6addf6d..4349d28 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -124,8 +124,6 @@
 #include <vcl/svapp.hxx>
 #include <vcl/virdev.hxx>
 
-#include <boost/bind.hpp>
-
 //  page styles
 #define SC_UNO_PAGE_LEFTBORDER      "LeftBorder"
 #define SC_UNO_PAGE_RIGHTBORDER     "RightBorder"
@@ -1081,7 +1079,8 @@ void SAL_CALL OReportDefinition::removeCloseListener( const uno::Reference< util
 }
 
 // XCloseable
-void SAL_CALL OReportDefinition::close( sal_Bool _bDeliverOwnership ) throw (util::CloseVetoException, uno::RuntimeException, std::exception)
+void SAL_CALL OReportDefinition::close(sal_Bool bDeliverOwnership)
+throw (util::CloseVetoException, uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aSolarGuard;
 
@@ -1091,7 +1090,9 @@ void SAL_CALL OReportDefinition::close( sal_Bool _bDeliverOwnership ) throw (uti
     lang::EventObject aEvt( static_cast< ::cppu::OWeakObject* >( this ) );
     aGuard.clear();
     m_pImpl->m_aCloseListener.forEach<util::XCloseListener>(
-        ::boost::bind(&util::XCloseListener::queryClosing,_1,boost::cref(aEvt),boost::cref(_bDeliverOwnership)));
+        [&aEvt, &bDeliverOwnership] (uno::Reference<util::XCloseListener> const& xListener) {
+            return xListener->queryClosing(aEvt, bDeliverOwnership);
+        });
     aGuard.reset();
 
 
@@ -1106,7 +1107,7 @@ void SAL_CALL OReportDefinition::close( sal_Bool _bDeliverOwnership ) throw (uti
             {
                 uno::Reference< util::XCloseable> xFrame( (*aIter)->getFrame(), uno::UNO_QUERY );
                 if ( xFrame.is() )
-                    xFrame->close( _bDeliverOwnership );
+                    xFrame->close( bDeliverOwnership );
             }
             catch (const util::CloseVetoException&) { throw; }
             catch (const uno::Exception&)
@@ -1477,20 +1478,24 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
         xStatusIndicator->end();
 }
 
-void SAL_CALL OReportDefinition::switchToStorage( const uno::Reference< embed::XStorage >& _xStorage ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
+void SAL_CALL OReportDefinition::switchToStorage(
+        const uno::Reference< embed::XStorage >& xStorage)
+throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException, std::exception)
 {
-    if ( !_xStorage.is() )
+    if (!xStorage.is())
         throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1);
     {
         ::osl::MutexGuard aGuard(m_aMutex);
         ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
-        m_pImpl->m_xStorage = _xStorage;
+        m_pImpl->m_xStorage = xStorage;
         lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
         m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
     }
     // notify our container listeners
     m_pImpl->m_aStorageChangeListeners.forEach<document::XStorageChangeListener>(
-            ::boost::bind(&document::XStorageChangeListener::notifyStorageChange,_1,static_cast<OWeakObject*>(this),boost::cref(_xStorage)));
+        [this, &xStorage] (uno::Reference<document::XStorageChangeListener> const& xListener) {
+            return xListener->notifyStorageChange(static_cast<OWeakObject*>(this), xStorage);
+        });
 }
 
 uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentStorage(  ) throw (io::IOException, uno::Exception, uno::RuntimeException, std::exception)
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx
index 26a5b21..6ab1e18 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -56,8 +56,6 @@
 #include <osl/mutex.hxx>
 #include <sal/macros.h>
 
-#include <boost/bind.hpp>
-
 #include <iterator>
 
 #define DEFAULT_LINE_WIDTH 2
@@ -1200,8 +1198,10 @@ void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormatted
         aValue.LineStyle = table::BorderLineStyle::NONE;
         uno::Any aEmpty;
         aEmpty <<= aValue;
-        ::std::for_each(aProps.begin(),aProps.end(),
-            ::boost::bind(&beans::XPropertySet::setPropertyValue,xBorderProp,_1,aEmpty));
+        for (auto const& it : aProps)
+        {
+            xBorderProp->setPropertyValue(it, aEmpty);
+        }
 
         ::std::vector< XMLPropertyState > aBorderStates(m_xCellStylesExportPropertySetMapper->Filter(xBorderProp));
         ::std::copy(aBorderStates.begin(),aBorderStates.end(),::std::back_inserter(aPropertyStates));
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index cb7759f..186428b 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -709,7 +709,10 @@ void GeometryHandler::implCreateListLikeControl(
     );
 
     out_Descriptor.Control = xListControl.get();
-    ::std::for_each( _aEntries.begin(), _aEntries.end(),::boost::bind( &inspection::XStringListControl::appendListEntry, xListControl,_1 ));
+    for (auto const& it : _aEntries)
+    {
+        xListControl->appendListEntry(it);
+    }
 }
 
 
@@ -812,10 +815,14 @@ inspection::LineDescriptor SAL_CALL GeometryHandler::describePropertyLine(const
                 }
                 else
                 {
-                    ::std::for_each( m_aFieldNames.getConstArray(), m_aFieldNames.getConstArray() + m_aFieldNames.getLength(),
-                        ::boost::bind( &inspection::XStringListControl::appendListEntry, xListControl, _1 ) );
-                    ::std::for_each( m_aParamNames.getConstArray(), m_aParamNames.getConstArray() + m_aParamNames.getLength(),
-                        ::boost::bind( &inspection::XStringListControl::appendListEntry, xListControl, _1 ) );
+                    for (auto const& it : m_aFieldNames)
+                    {
+                        xListControl->appendListEntry(it);
+                    }
+                    for (auto const& it : m_aParamNames)
+                    {
+                        xListControl->appendListEntry(it);
+                    }
                 }
             }
             break;
@@ -1633,14 +1640,19 @@ void GeometryHandler::checkPosAndSize(  const awt::Point& _aNewPos,
     }
 }
 
-void GeometryHandler::impl_fillFormulaList_nothrow(::std::vector< OUString >& _out_rList) const
+void GeometryHandler::impl_fillFormulaList_nothrow(::std::vector< OUString >& out_rList) const
 {
     if ( m_nDataFieldType == FUNCTION )
-        ::std::transform(m_aDefaultFunctions.begin(),m_aDefaultFunctions.end(),::std::back_inserter(_out_rList),::boost::bind( &DefaultFunction::getName, _1 ));
+    {
+        for (auto const& it : m_aDefaultFunctions)
+        {
+            out_rList.push_back(it.getName());
+        }
+    }
     else if ( m_nDataFieldType == USER_DEF_FUNCTION )
         ::std::transform( m_aFunctionNames.begin(),
                           m_aFunctionNames.end(),
-                          ::std::back_inserter(_out_rList),
+                          ::std::back_inserter(out_rList),
                           ::o3tl::select1st< TFunctions::value_type >() );
 }
 
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 1138d2e..afbc800 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -2604,7 +2604,9 @@ void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & _rHi
         }
         lang::EventObject aEvent(*this);
         m_aSelectionListeners.forEach<view::XSelectionChangeListener>(
-            ::boost::bind(&view::XSelectionChangeListener::selectionChanged,_1,boost::cref(aEvent)));
+            [&aEvent] (uno::Reference<view::XSelectionChangeListener> const& xListener) {
+                return xListener->selectionChanged(aEvent);
+            });
 
     }
 }


More information about the Libreoffice-commits mailing list