[Libreoffice-commits] core.git: 5 commits - filter/source include/vcl reportdesign/source sc/inc sc/source sw/source vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Sep 29 21:05:10 UTC 2016
filter/source/graphicfilter/etiff/etiff.cxx | 12 -
include/vcl/region.hxx | 2
reportdesign/source/core/misc/conditionupdater.cxx | 7
sc/inc/dptabres.hxx | 2
sc/inc/dptabsrc.hxx | 2
sc/source/core/data/dptabres.cxx | 24 +--
sc/source/core/data/dptabsrc.cxx | 13 -
sw/source/core/bastyp/calc.cxx | 151 +++++++++++----------
vcl/source/gdi/region.cxx | 20 ++
9 files changed, 124 insertions(+), 109 deletions(-)
New commits:
commit 2434e019252cbc8b6a567eafe89ccfdf4749b838
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 29 21:26:16 2016 +0100
reorg FillItemData
Change-Id: Ia70bf1c7fb4bf524b92c3f97103cd74bccf46822
diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx
index 4528c40..a462ade 100644
--- a/sc/inc/dptabres.hxx
+++ b/sc/inc/dptabres.hxx
@@ -368,7 +368,7 @@ public:
OUString GetName() const;
OUString GetDisplayName( bool bLocaleIndependent ) const;
- void FillItemData( ScDPItemData& rData ) const;
+ ScDPItemData FillItemData() const;
bool IsValid() const;
bool IsVisible() const;
long GetSize(long nMeasure) const;
diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx
index 998f774..035aa1b 100644
--- a/sc/inc/dptabsrc.hxx
+++ b/sc/inc/dptabsrc.hxx
@@ -741,7 +741,7 @@ public:
ScDPMember& operator=(const ScDPMember&) = delete;
OUString GetNameStr( bool bLocaleIndependent ) const;
- void FillItemData( ScDPItemData& rData ) const;
+ ScDPItemData FillItemData() const;
const ScDPItemData* GetItemData() const;
SCROW GetItemDataId() const { return mnDataId; }
bool IsNamedItem(SCROW nIndex) const;
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 12a40cc..2d5e72d 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -965,8 +965,7 @@ OUString ScDPResultMember::GetDisplayName( bool bLocaleIndependent ) const
if (!pDPMember)
return OUString();
- ScDPItemData aItem;
- pDPMember->FillItemData(aItem);
+ ScDPItemData aItem(pDPMember->FillItemData());
if (aParentDimData.mpParentDim)
{
long nDim = aParentDimData.mpParentDim->GetDimension();
@@ -976,13 +975,12 @@ OUString ScDPResultMember::GetDisplayName( bool bLocaleIndependent ) const
return aItem.GetString();
}
-void ScDPResultMember::FillItemData( ScDPItemData& rData ) const
+ScDPItemData ScDPResultMember::FillItemData() const
{
- const ScDPMember* pMemberDesc = GetDPMember();
+ const ScDPMember* pMemberDesc = GetDPMember();
if (pMemberDesc)
- pMemberDesc->FillItemData( rData );
- else
- rData.SetString( ScGlobal::GetRscString(STR_PIVOT_TOTAL) ); // root member
+ return pMemberDesc->FillItemData();
+ return ScDPItemData(ScGlobal::GetRscString(STR_PIVOT_TOTAL)); // root member
}
bool ScDPResultMember::IsNamedItem( SCROW nIndex ) const
@@ -1322,8 +1320,7 @@ void ScDPResultMember::FillMemberResults(
}
else
{
- ScDPItemData aItemData;
- FillItemData( aItemData );
+ ScDPItemData aItemData(FillItemData());
if (aParentDimData.mpParentDim)
{
long nDim = aParentDimData.mpParentDim->GetDimension();
@@ -2694,8 +2691,7 @@ bool ScDPGroupCompare::TestIncluded( const ScDPMember& rMember )
{
// need to check all previous groups
//TODO: get array of groups (or indexes) before loop?
- ScDPItemData aMemberData;
- rMember.FillItemData( aMemberData );
+ ScDPItemData aMemberData(rMember.FillItemData());
const std::vector<ScDPInitState::Member>& rMemStates = rInitState.GetMembers();
std::vector<ScDPInitState::Member>::const_iterator it = rMemStates.begin(), itEnd = rMemStates.end();
@@ -2714,8 +2710,7 @@ bool ScDPGroupCompare::TestIncluded( const ScDPMember& rMember )
// -> look for other groups using the same base
//TODO: get array of groups (or indexes) before loop?
- ScDPItemData aMemberData;
- rMember.FillItemData( aMemberData );
+ ScDPItemData aMemberData(rMember.FillItemData());
const std::vector<ScDPInitState::Member>& rMemStates = rInitState.GetMembers();
std::vector<ScDPInitState::Member>::const_iterator it = rMemStates.begin(), itEnd = rMemStates.end();
for (; it != itEnd && bInclude; ++it)
@@ -3510,8 +3505,7 @@ void ScDPResultDimension::FillVisibilityData(ScDPResultVisibilityData& rData) co
ScDPResultMember* pMember = *itr;
if (pMember->IsValid())
{
- ScDPItemData aItem;
- pMember->FillItemData(aItem);
+ ScDPItemData aItem(pMember->FillItemData());
rData.addVisibleMember(GetName(), aItem);
pMember->FillVisibilityData(rData);
}
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 859b0ca..390bc0e 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -463,8 +463,7 @@ Sequence< Sequence<Any> > SAL_CALL ScDPSource::getDrillDownData(const Sequence<s
sal_Int32 nIndex = pMembers->GetIndexFromName( rFilter.MatchValueName );
if ( nIndex >= 0 )
{
- ScDPItemData aItem;
- pMembers->getByIndex(nIndex)->FillItemData( aItem );
+ ScDPItemData aItem(pMembers->getByIndex(nIndex)->FillItemData());
aFilterCriteria.push_back( ScDPFilteredCache::Criterion() );
aFilterCriteria.back().mnFieldIndex = nCol;
aFilterCriteria.back().mpFilter.reset(
@@ -737,8 +736,7 @@ void ScDPSource::FilterCacheByPageDimensions()
ScDPMember* pMem = pMems->getByIndex(j);
if (pMem->isVisible())
{
- ScDPItemData aData;
- pMem->FillItemData(aData);
+ ScDPItemData aData(pMem->FillItemData());
pGrpFilter->addMatchItem(aData);
}
}
@@ -1450,8 +1448,7 @@ const ScDPItemData& ScDPDimension::GetSelectedData()
ScDPMember* pMember = pMembers->getByIndex(i);
if (aSelectedPage.equals(pMember->GetNameStr( false)))
{
- pSelectedData = new ScDPItemData();
- pMember->FillItemData( *pSelectedData );
+ pSelectedData = new ScDPItemData(pMember->FillItemData());
}
}
}
@@ -2582,12 +2579,12 @@ sal_Int32 ScDPMember::Compare( const ScDPMember& rOther ) const
return pSource->GetData()->Compare( pSource->GetSourceDim(nDim),mnDataId,rOther.GetItemDataId());
}
-void ScDPMember::FillItemData( ScDPItemData& rData ) const
+ScDPItemData ScDPMember::FillItemData() const
{
//TODO: handle date hierarchy...
const ScDPItemData* pData = GetItemData();
- rData = (pData ? *pData : ScDPItemData());
+ return (pData ? *pData : ScDPItemData());
}
const OUString* ScDPMember::GetLayoutName() const
commit a15db9dbb306031c9a4903a6875de94473c740da
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 29 21:17:10 2016 +0100
coverity#1371177 avoid Missing move assignment operator
Change-Id: I15517a725e705db0f106b01eb9a013efeca4f47f
diff --git a/reportdesign/source/core/misc/conditionupdater.cxx b/reportdesign/source/core/misc/conditionupdater.cxx
index 131089c..cb3317b 100644
--- a/reportdesign/source/core/misc/conditionupdater.cxx
+++ b/reportdesign/source/core/misc/conditionupdater.cxx
@@ -92,8 +92,7 @@ namespace rptui
for ( sal_Int32 i=0; i<nCount; ++i )
{
xFormatCondition.set( _rxRptControlModel->getByIndex( i ), UNO_QUERY_THROW );
- ReportFormula aFormula( xFormatCondition->getFormula() );
- sFormulaExpression = aFormula.getExpression();
+ sFormulaExpression = ReportFormula(xFormatCondition->getFormula()).getExpression();
for ( ConditionalExpressions::const_iterator loop = m_aConditionalExpressions.begin();
loop != m_aConditionalExpressions.end();
@@ -105,8 +104,8 @@ namespace rptui
// the expression matches -> translate it to the new data source of the report control model
sFormulaExpression = loop->second->assembleExpression( sNewUnprefixed, sLHS, sRHS );
- aFormula = ReportFormula( ReportFormula::Expression, sFormulaExpression );
- xFormatCondition->setFormula( aFormula.getCompleteFormula() );
+ ReportFormula aFormula(ReportFormula(ReportFormula::Expression, sFormulaExpression));
+ xFormatCondition->setFormula(aFormula.getCompleteFormula());
break;
}
}
commit a218467c93cfe4c26414ac00cbb0503156d483ec
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 29 21:12:57 2016 +0100
enforce some form of consistent indent here
Change-Id: Ib26aaa29861e940748a31a3df7f8c5f0408e8c13
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 6633a1c..6d8faa5 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -1040,16 +1040,29 @@ SwSbxValue SwCalc::Prim()
bool bChkTrig = false, bChkPow = false;
- switch( m_eCurrOper )
+ switch (m_eCurrOper)
{
- case CALC_SIN: pFnc = &sin; break;
- case CALC_COS: pFnc = &cos; break;
- case CALC_TAN: pFnc = &tan; break;
- case CALC_ATAN: pFnc = &atan; break;
- case CALC_ASIN: pFnc = &asin; bChkTrig = true; break;
- case CALC_ACOS: pFnc = &acos; bChkTrig = true; break;
-
- case CALC_NOT:
+ case CALC_SIN:
+ pFnc = &sin;
+ break;
+ case CALC_COS:
+ pFnc = &cos;
+ break;
+ case CALC_TAN:
+ pFnc = &tan;
+ break;
+ case CALC_ATAN:
+ pFnc = &atan;
+ break;
+ case CALC_ASIN:
+ pFnc = &asin;
+ bChkTrig = true;
+ break;
+ case CALC_ACOS:
+ pFnc = &acos;
+ bChkTrig = true;
+ break;
+ case CALC_NOT:
{
GetToken();
nErg = Prim();
@@ -1073,55 +1086,56 @@ SwSbxValue SwCalc::Prim()
//!! computes a binary NOT
nErg.Compute( SbxNOT, nErg );
}
+ break;
}
- break;
-
- case CALC_NUMBER:
- if( GetToken() == CALC_PHD )
- {
- double aTmp = m_nNumberValue.GetDouble();
- aTmp *= 0.01;
- nErg.PutDouble( aTmp );
- GetToken();
- }
- else if( m_eCurrOper == CALC_NAME )
+ case CALC_NUMBER:
{
- m_eError = CALC_SYNTAX;
- }
- else
- {
- nErg = m_nNumberValue;
- bChkPow = true;
+ if( GetToken() == CALC_PHD )
+ {
+ double aTmp = m_nNumberValue.GetDouble();
+ aTmp *= 0.01;
+ nErg.PutDouble( aTmp );
+ GetToken();
+ }
+ else if( m_eCurrOper == CALC_NAME )
+ {
+ m_eError = CALC_SYNTAX;
+ }
+ else
+ {
+ nErg = m_nNumberValue;
+ bChkPow = true;
+ }
+ break;
}
- break;
-
- case CALC_NAME:
- switch(SwCalcOper eOper = GetToken())
+ case CALC_NAME:
{
- case CALC_ASSIGN:
+ switch(SwCalcOper eOper = GetToken())
+ {
+ case CALC_ASSIGN:
{
SwCalcExp* n = VarInsert(m_aVarName);
GetToken();
nErg = n->nValue = Expr();
+ break;
}
- break;
- default:
- nErg = VarLook(m_aVarName)->nValue;
- // Explicitly disallow unknown function names (followed by "("),
- // allow unknown variable names (equal to zero)
- if (nErg.IsVoidValue() && (eOper == CALC_LP))
- m_eError = CALC_SYNTAX;
- else
- bChkPow = true;
+ default:
+ nErg = VarLook(m_aVarName)->nValue;
+ // Explicitly disallow unknown function names (followed by "("),
+ // allow unknown variable names (equal to zero)
+ if (nErg.IsVoidValue() && (eOper == CALC_LP))
+ m_eError = CALC_SYNTAX;
+ else
+ bChkPow = true;
+ break;
+ }
+ break;
}
- break;
-
- case CALC_MINUS:
- GetToken();
- nErg.PutDouble( -(Prim().GetDouble()) );
- break;
-
- case CALC_LP:
+ case CALC_MINUS:
+ GetToken();
+ nErg.PutDouble( -(Prim().GetDouble()) );
+ break;
+ case CALC_LP:
{
GetToken();
nErg = Expr();
@@ -1134,10 +1148,9 @@ SwSbxValue SwCalc::Prim()
GetToken();
bChkPow = true; // in order for =(7)^2 to work
}
+ break;
}
- break;
-
- case CALC_MEAN:
+ case CALC_MEAN:
{
m_nListPor = 1;
GetToken();
@@ -1145,10 +1158,9 @@ SwSbxValue SwCalc::Prim()
double aTmp = nErg.GetDouble();
aTmp /= m_nListPor;
nErg.PutDouble( aTmp );
+ break;
}
- break;
-
- case CALC_SQRT:
+ case CALC_SQRT:
{
GetToken();
nErg = Prim();
@@ -1156,24 +1168,21 @@ SwSbxValue SwCalc::Prim()
m_eError = CALC_OVERFLOW;
else
nErg.PutDouble( sqrt( nErg.GetDouble() ));
+ break;
}
- break;
-
- case CALC_SUM:
- case CALC_DATE:
- case CALC_MIN:
- case CALC_MAX:
- GetToken();
- nErg = Expr();
- break;
-
- case CALC_ENDCALC:
- nErg.Clear();
- break;
-
- default:
- m_eError = CALC_SYNTAX;
- break;
+ case CALC_SUM:
+ case CALC_DATE:
+ case CALC_MIN:
+ case CALC_MAX:
+ GetToken();
+ nErg = Expr();
+ break;
+ case CALC_ENDCALC:
+ nErg.Clear();
+ break;
+ default:
+ m_eError = CALC_SYNTAX;
+ break;
}
if( pFnc )
commit ea2b56a72a6d7deb68793d7b8bcdb2fded1fbd68
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 29 21:06:47 2016 +0100
coverity#1371164 Missing move assignment operator
Change-Id: I9817115f3bc0af542ed27605f8d0ca50107dd7d8
diff --git a/include/vcl/region.hxx b/include/vcl/region.hxx
index 45d12a8..1235b3d 100644
--- a/include/vcl/region.hxx
+++ b/include/vcl/region.hxx
@@ -73,6 +73,7 @@ public:
explicit Region(const tools::PolyPolygon& rPolyPoly);
explicit Region(const basegfx::B2DPolyPolygon&);
Region(const vcl::Region& rRegion);
+ Region(vcl::Region&& rRegion);
~Region();
// direct access to contents
@@ -114,6 +115,7 @@ public:
bool IsOver( const Rectangle& rRect ) const;
vcl::Region& operator=( const vcl::Region& rRegion );
+ vcl::Region& operator=( vcl::Region&& rRegion );
vcl::Region& operator=( const Rectangle& rRect );
bool operator==( const vcl::Region& rRegion ) const;
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 0046743..e9f5c42 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -372,6 +372,15 @@ Region::Region(const vcl::Region& rRegion)
{
}
+Region::Region(vcl::Region&& rRegion)
+: mpB2DPolyPolygon(std::move(rRegion.mpB2DPolyPolygon)),
+ mpPolyPolygon(std::move(rRegion.mpPolyPolygon)),
+ mpRegionBand(std::move(rRegion.mpRegionBand)),
+ mbIsNull(rRegion.mbIsNull)
+{
+ rRegion.mbIsNull = true;
+}
+
Region::~Region()
{
}
@@ -1454,6 +1463,17 @@ Region& vcl::Region::operator=( const vcl::Region& rRegion )
return *this;
}
+Region& vcl::Region::operator=( vcl::Region&& rRegion )
+{
+ mpB2DPolyPolygon = std::move(rRegion.mpB2DPolyPolygon);
+ mpPolyPolygon = std::move(rRegion.mpPolyPolygon);
+ mpRegionBand = std::move(rRegion.mpRegionBand);
+ mbIsNull = rRegion.mbIsNull;
+ rRegion.mbIsNull = true;
+
+ return *this;
+}
+
Region& vcl::Region::operator=( const Rectangle& rRect )
{
mpB2DPolyPolygon.reset();
commit 57d80be7fcd35625bd9e8007cb75088491ed5a1c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Sep 29 21:01:26 2016 +0100
coverity#1371147 avoid Missing move assignment operator
Change-Id: Ie9bc91be66ae0fe24bd1920d2ea59b0f5376e7b1
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
index 6af1017..b642150 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -174,15 +174,9 @@ bool TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem* pFilterCo
if( mbStatus )
{
- Animation aAnimation;
-
- if (rGraphic.IsAnimated())
- aAnimation = rGraphic.GetAnimation();
- else
- {
- AnimationBitmap aAnimationBitmap(rGraphic.GetBitmap(), Point(), Size());
- aAnimation.Insert(aAnimationBitmap);
- }
+ Animation aAnimation = rGraphic.IsAnimated() ? rGraphic.GetAnimation() : Animation();
+ if (!rGraphic.IsAnimated())
+ aAnimation.Insert(AnimationBitmap(rGraphic.GetBitmap(), Point(), Size()));
for (size_t i = 0; i < aAnimation.Count(); ++i)
mnSumOfAllPictHeight += aAnimation.Get(i).aBmpEx.GetSizePixel().Height();
More information about the Libreoffice-commits
mailing list