diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-06 13:27:23 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-07 07:56:39 +0100 |
commit | 2e2d736ccbb21daae91603732c87d5375ede1b47 (patch) | |
tree | 6621e351d38dff77dc16c6413767f4baa3c76326 /reportdesign/source | |
parent | 1647bc1309dcd313dff2614f4844b71b1c558dee (diff) |
loplugin:collapseif in framework..sal
Change-Id: I3068b18f5cff024a48a8f8c68d69cadad30fe4d5
Reviewed-on: https://gerrit.libreoffice.org/62953
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign/source')
-rw-r--r-- | reportdesign/source/core/sdr/PropertyForward.cxx | 69 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ViewsWindow.cxx | 7 |
2 files changed, 35 insertions, 41 deletions
diff --git a/reportdesign/source/core/sdr/PropertyForward.cxx b/reportdesign/source/core/sdr/PropertyForward.cxx index a2a94ccd6fff..cca1f9825216 100644 --- a/reportdesign/source/core/sdr/PropertyForward.cxx +++ b/reportdesign/source/core/sdr/PropertyForward.cxx @@ -99,47 +99,44 @@ void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt bool bDest = (evt.Source == m_xDest); Reference<XPropertySet> xProp = bDest ? m_xSource : m_xDest; Reference<XPropertySetInfo> xPropInfo = bDest ? m_xSourceInfo : m_xDestInfo; - if ( xProp.is() ) + if ( xProp.is() && xPropInfo.is() ) { - if ( xPropInfo.is() ) + if ( xPropInfo->hasPropertyByName(evt.PropertyName) ) + xProp->setPropertyValue(evt.PropertyName,evt.NewValue); + else { - if ( xPropInfo->hasPropertyByName(evt.PropertyName) ) - xProp->setPropertyValue(evt.PropertyName,evt.NewValue); + TPropertyNamePair::const_iterator aFind = m_aNameMap.find(evt.PropertyName); + OUString sPropName; + if ( aFind != m_aNameMap.end() ) + sPropName = aFind->second.first; else { - TPropertyNamePair::const_iterator aFind = m_aNameMap.find(evt.PropertyName); - OUString sPropName; + aFind = ::std::find_if( + m_aNameMap.begin(), + m_aNameMap.end(), + [&evt] (const TPropertyNamePair::value_type& namePair) { + return namePair.second.first == evt.PropertyName; + }); if ( aFind != m_aNameMap.end() ) - sPropName = aFind->second.first; - else - { - aFind = ::std::find_if( - m_aNameMap.begin(), - m_aNameMap.end(), - [&evt] (const TPropertyNamePair::value_type& namePair) { - return namePair.second.first == evt.PropertyName; - }); - if ( aFind != m_aNameMap.end() ) - sPropName = aFind->first; - } - if (aFind != m_aNameMap.end() && !sPropName.isEmpty() && xPropInfo->hasPropertyByName(sPropName)) - xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue)); - else if ( evt.PropertyName == PROPERTY_CHARFONTNAME - || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME - || evt.PropertyName == PROPERTY_CHARSTRIKEOUT - || evt.PropertyName == PROPERTY_CHARWORDMODE - || evt.PropertyName == PROPERTY_CHARROTATION - || evt.PropertyName == PROPERTY_CHARSCALEWIDTH - || evt.PropertyName == PROPERTY_CHARFONTFAMILY - || evt.PropertyName == PROPERTY_CHARFONTCHARSET - || evt.PropertyName == PROPERTY_CHARFONTPITCH - || evt.PropertyName == PROPERTY_CHARHEIGHT - || evt.PropertyName == PROPERTY_CHARUNDERLINE - || evt.PropertyName == PROPERTY_CHARWEIGHT - || evt.PropertyName == PROPERTY_CHARPOSTURE) - { - xProp->setPropertyValue(PROPERTY_FONTDESCRIPTOR,m_xSource->getPropertyValue(PROPERTY_FONTDESCRIPTOR)); - } + sPropName = aFind->first; + } + if (aFind != m_aNameMap.end() && !sPropName.isEmpty() && xPropInfo->hasPropertyByName(sPropName)) + xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue)); + else if ( evt.PropertyName == PROPERTY_CHARFONTNAME + || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME + || evt.PropertyName == PROPERTY_CHARSTRIKEOUT + || evt.PropertyName == PROPERTY_CHARWORDMODE + || evt.PropertyName == PROPERTY_CHARROTATION + || evt.PropertyName == PROPERTY_CHARSCALEWIDTH + || evt.PropertyName == PROPERTY_CHARFONTFAMILY + || evt.PropertyName == PROPERTY_CHARFONTCHARSET + || evt.PropertyName == PROPERTY_CHARFONTPITCH + || evt.PropertyName == PROPERTY_CHARHEIGHT + || evt.PropertyName == PROPERTY_CHARUNDERLINE + || evt.PropertyName == PROPERTY_CHARWEIGHT + || evt.PropertyName == PROPERTY_CHARPOSTURE) + { + xProp->setPropertyValue(PROPERTY_FONTDESCRIPTOR,m_xSource->getPropertyValue(PROPERTY_FONTDESCRIPTOR)); } } } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 3a1deb5958d9..9e4bbf84cf69 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1401,11 +1401,8 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, b { OReportSection& rReportSection = (*aIter)->getReportSection(); SdrHdl* pCurrentHdl = rReportSection.getSectionView().GetDragHdl(); - if ( pCurrentHdl ) - { - if ( aRealMousePos.Y() > 0 ) - aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos; - } + if ( pCurrentHdl && aRealMousePos.Y() > 0 ) + aRealMousePos = _aPnt + pCurrentHdl->GetPos() - aHdlPos; rReportSection.getSectionView().MovAction ( aRealMousePos ); const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height(); aRealMousePos.AdjustY( -nSectionHeight ); |