summaryrefslogtreecommitdiff
path: root/chart2/source/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-03-01 20:38:22 +0200
committerNoel Grandin <noel@peralex.com>2016-03-02 07:57:38 +0200
commitf69585c35411ca74e17bb6cd1cf535489472a4c2 (patch)
treeb5a8f3df94dea50d1f6bf498041e8f0bc7cb3fbd /chart2/source/tools
parent33265f52dfa6a4612156288a170a8e41cff2cfd8 (diff)
loplugin:unuseddefaultparams in chart2
Change-Id: I03a3580fdbd1f6cf08af329b07edcfe09ecbb9aa
Diffstat (limited to 'chart2/source/tools')
-rw-r--r--chart2/source/tools/DataSourceHelper.cxx11
-rw-r--r--chart2/source/tools/DiagramHelper.cxx42
-rw-r--r--chart2/source/tools/ImplOPropertySet.cxx9
-rw-r--r--chart2/source/tools/ImplOPropertySet.hxx3
-rw-r--r--chart2/source/tools/RelativePositionHelper.cxx95
-rw-r--r--chart2/source/tools/StatisticsHelper.cxx5
-rw-r--r--chart2/source/tools/ThreeDHelper.cxx21
7 files changed, 70 insertions, 116 deletions
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
index 84cf5f7e4831..6e3773268179 100644
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -226,19 +226,16 @@ void DataSourceHelper::readArguments( const uno::Sequence< beans::PropertyValue
}
uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoRectangularFormat(
- const uno::Reference< chart2::XChartDocument >& xChartDoc, bool bWithCategories )
+ const uno::Reference< chart2::XChartDocument >& xChartDoc )
{
::std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVector;
//categories are always the first sequence
Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram());
- if( bWithCategories )
- {
- Reference< chart2::data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
- if( xCategories.is() )
- aResultVector.push_back( xCategories );
- }
+ Reference< chart2::data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
+ if( xCategories.is() )
+ aResultVector.push_back( xCategories );
::std::vector< Reference< chart2::XDataSeries > > xSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
uno::Reference< chart2::data::XDataSource > xSeriesSource(
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 5f1a074081a9..820209b25170 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -75,8 +75,7 @@ namespace chart
DiagramHelper::tTemplateWithServiceName
DiagramHelper::getTemplateForDiagram(
const Reference< XDiagram > & xDiagram,
- const Reference< lang::XMultiServiceFactory > & xChartTypeManager,
- const OUString & rPreferredTemplateName )
+ const Reference< lang::XMultiServiceFactory > & xChartTypeManager )
{
DiagramHelper::tTemplateWithServiceName aResult;
@@ -86,39 +85,20 @@ DiagramHelper::tTemplateWithServiceName
Sequence< OUString > aServiceNames( xChartTypeManager->getAvailableServiceNames());
const sal_Int32 nLength = aServiceNames.getLength();
- bool bHasPreferredTemplate = !rPreferredTemplateName.isEmpty();
bool bTemplateFound = false;
- if( bHasPreferredTemplate )
- {
- Reference< XChartTypeTemplate > xTempl(
- xChartTypeManager->createInstance( rPreferredTemplateName ), uno::UNO_QUERY );
-
- if( xTempl.is() &&
- xTempl->matchesTemplate( xDiagram, sal_True ))
- {
- aResult.first = xTempl;
- aResult.second = rPreferredTemplateName;
- bTemplateFound = true;
- }
- }
-
for( sal_Int32 i = 0; ! bTemplateFound && i < nLength; ++i )
{
try
{
- if( ! bHasPreferredTemplate ||
- ! rPreferredTemplateName.equals( aServiceNames[ i ] ))
- {
- Reference< XChartTypeTemplate > xTempl(
- xChartTypeManager->createInstance( aServiceNames[ i ] ), uno::UNO_QUERY_THROW );
+ Reference< XChartTypeTemplate > xTempl(
+ xChartTypeManager->createInstance( aServiceNames[ i ] ), uno::UNO_QUERY_THROW );
- if (xTempl.is() && xTempl->matchesTemplate(xDiagram, true))
- {
- aResult.first = xTempl;
- aResult.second = aServiceNames[ i ];
- bTemplateFound = true;
- }
+ if (xTempl.is() && xTempl->matchesTemplate(xDiagram, true))
+ {
+ aResult.first = xTempl;
+ aResult.second = aServiceNames[ i ];
+ bTemplateFound = true;
}
}
catch( const uno::Exception & ex )
@@ -247,8 +227,7 @@ bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDia
void DiagramHelper::setStackMode(
const Reference< XDiagram > & xDiagram,
- StackMode eStackMode,
- bool bOnlyAtFirstChartType /* = true */
+ StackMode eStackMode
)
{
try
@@ -307,8 +286,7 @@ void DiagramHelper::setStackMode(
continue;
uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
sal_Int32 nMax = aChartTypeList.getLength();
- if( bOnlyAtFirstChartType
- && nMax >= 1 )
+ if( nMax >= 1 )
nMax = 1;
for( sal_Int32 nT = 0; nT < nMax; ++nT )
{
diff --git a/chart2/source/tools/ImplOPropertySet.cxx b/chart2/source/tools/ImplOPropertySet.cxx
index 7658d817a671..3fe1e9413c9b 100644
--- a/chart2/source/tools/ImplOPropertySet.cxx
+++ b/chart2/source/tools/ImplOPropertySet.cxx
@@ -160,15 +160,8 @@ bool ImplOPropertySet::GetPropertyValueByHandle(
}
void ImplOPropertySet::SetPropertyValueByHandle(
- sal_Int32 nHandle, const Any & rValue, Any * pOldValue )
+ sal_Int32 nHandle, const Any & rValue )
{
- if( pOldValue != nullptr )
- {
- tPropertyMap::const_iterator aFoundIter( m_aProperties.find( nHandle ) );
- if( m_aProperties.end() != aFoundIter )
- (*pOldValue) = (*aFoundIter).second;
- }
-
m_aProperties[ nHandle ] = rValue;
}
diff --git a/chart2/source/tools/ImplOPropertySet.hxx b/chart2/source/tools/ImplOPropertySet.hxx
index 0da1ca6f9a78..2c3c80e68663 100644
--- a/chart2/source/tools/ImplOPropertySet.hxx
+++ b/chart2/source/tools/ImplOPropertySet.hxx
@@ -62,8 +62,7 @@ public:
sal_Int32 nHandle ) const;
void SetPropertyValueByHandle( sal_Int32 nHandle,
- const ::com::sun::star::uno::Any & rValue,
- ::com::sun::star::uno::Any * pOldValue = nullptr );
+ const ::com::sun::star::uno::Any & rValue );
bool SetStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > & xStyle );
::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
diff --git a/chart2/source/tools/RelativePositionHelper.cxx b/chart2/source/tools/RelativePositionHelper.cxx
index 71df2acf5cad..0d4edec1ab14 100644
--- a/chart2/source/tools/RelativePositionHelper.cxx
+++ b/chart2/source/tools/RelativePositionHelper.cxx
@@ -244,8 +244,7 @@ awt::Point RelativePositionHelper::getCenterOfAnchoredObject(
bool RelativePositionHelper::centerGrow(
chart2::RelativePosition & rInOutPosition,
chart2::RelativeSize & rInOutSize,
- double fAmountX, double fAmountY,
- bool bCheck /* = true */ )
+ double fAmountX, double fAmountY )
{
chart2::RelativePosition aPos( rInOutPosition );
chart2::RelativeSize aSize( rInOutSize );
@@ -312,39 +311,35 @@ bool RelativePositionHelper::centerGrow(
rInOutSize.Secondary == aSize.Secondary )
return false;
- // check
- if( bCheck )
- {
- // Note: this somewhat complicated check allows the output being
- // out-of-bounds if the input was also out-of-bounds, and the change is
- // for "advantage". E.g., you have a chart that laps out on the left
- // side. If you shrink it, this should be possible, also if it still
- // laps out on the left side afterwards. But you shouldn't be able to
- // grow it then.
-
- chart2::RelativePosition aUpperLeft(
- RelativePositionHelper::getReanchoredPosition( aPos, aSize, drawing::Alignment_TOP_LEFT ));
- chart2::RelativePosition aLowerRight(
- RelativePositionHelper::getReanchoredPosition( aPos, aSize, drawing::Alignment_BOTTOM_RIGHT ));
-
- // Do not grow, if this leads to corners being off-screen
- if( fAmountX > 0.0 &&
- ( (aUpperLeft.Primary < fPosCheckThreshold) ||
- (aLowerRight.Primary > (1.0 - fPosCheckThreshold)) ))
- return false;
- if( fAmountY > 0.0 &&
- ( (aUpperLeft.Secondary < fPosCheckThreshold) ||
- (aLowerRight.Secondary > (1.0 - fPosCheckThreshold)) ))
- return false;
-
- // Do not shrink, if this leads to a size too small
- if( fAmountX < 0.0 &&
- ( aSize.Primary < fSizeCheckThreshold ))
- return false;
- if( fAmountY < 0.0 &&
- ( aSize.Secondary < fSizeCheckThreshold ))
- return false;
- }
+ // Note: this somewhat complicated check allows the output being
+ // out-of-bounds if the input was also out-of-bounds, and the change is
+ // for "advantage". E.g., you have a chart that laps out on the left
+ // side. If you shrink it, this should be possible, also if it still
+ // laps out on the left side afterwards. But you shouldn't be able to
+ // grow it then.
+
+ chart2::RelativePosition aUpperLeft(
+ RelativePositionHelper::getReanchoredPosition( aPos, aSize, drawing::Alignment_TOP_LEFT ));
+ chart2::RelativePosition aLowerRight(
+ RelativePositionHelper::getReanchoredPosition( aPos, aSize, drawing::Alignment_BOTTOM_RIGHT ));
+
+ // Do not grow, if this leads to corners being off-screen
+ if( fAmountX > 0.0 &&
+ ( (aUpperLeft.Primary < fPosCheckThreshold) ||
+ (aLowerRight.Primary > (1.0 - fPosCheckThreshold)) ))
+ return false;
+ if( fAmountY > 0.0 &&
+ ( (aUpperLeft.Secondary < fPosCheckThreshold) ||
+ (aLowerRight.Secondary > (1.0 - fPosCheckThreshold)) ))
+ return false;
+
+ // Do not shrink, if this leads to a size too small
+ if( fAmountX < 0.0 &&
+ ( aSize.Primary < fSizeCheckThreshold ))
+ return false;
+ if( fAmountY < 0.0 &&
+ ( aSize.Secondary < fSizeCheckThreshold ))
+ return false;
rInOutPosition = aPos;
rInOutSize = aSize;
@@ -354,29 +349,25 @@ bool RelativePositionHelper::centerGrow(
bool RelativePositionHelper::moveObject(
chart2::RelativePosition & rInOutPosition,
const chart2::RelativeSize & rObjectSize,
- double fAmountX, double fAmountY,
- bool bCheck /* = true */ )
+ double fAmountX, double fAmountY )
{
chart2::RelativePosition aPos( rInOutPosition );
aPos.Primary += fAmountX;
aPos.Secondary += fAmountY;
const double fPosCheckThreshold = 0.02;
- if( bCheck )
- {
- chart2::RelativePosition aUpperLeft(
- RelativePositionHelper::getReanchoredPosition( aPos, rObjectSize, drawing::Alignment_TOP_LEFT ));
- chart2::RelativePosition aLowerRight( aUpperLeft );
- aLowerRight.Primary += rObjectSize.Primary;
- aLowerRight.Secondary += rObjectSize.Secondary;
-
- const double fFarEdgeThreshold = 1.0 - fPosCheckThreshold;
- if( ( fAmountX > 0.0 && (aLowerRight.Primary > fFarEdgeThreshold)) ||
- ( fAmountX < 0.0 && (aUpperLeft.Primary < fPosCheckThreshold)) ||
- ( fAmountY > 0.0 && (aLowerRight.Secondary > fFarEdgeThreshold)) ||
- ( fAmountY < 0.0 && (aUpperLeft.Secondary < fPosCheckThreshold)) )
- return false;
- }
+ chart2::RelativePosition aUpperLeft(
+ RelativePositionHelper::getReanchoredPosition( aPos, rObjectSize, drawing::Alignment_TOP_LEFT ));
+ chart2::RelativePosition aLowerRight( aUpperLeft );
+ aLowerRight.Primary += rObjectSize.Primary;
+ aLowerRight.Secondary += rObjectSize.Secondary;
+
+ const double fFarEdgeThreshold = 1.0 - fPosCheckThreshold;
+ if( ( fAmountX > 0.0 && (aLowerRight.Primary > fFarEdgeThreshold)) ||
+ ( fAmountX < 0.0 && (aUpperLeft.Primary < fPosCheckThreshold)) ||
+ ( fAmountY > 0.0 && (aLowerRight.Secondary > fFarEdgeThreshold)) ||
+ ( fAmountY < 0.0 && (aUpperLeft.Secondary < fPosCheckThreshold)) )
+ return false;
rInOutPosition = aPos;
return true;
diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx
index 0c0064dffe78..b25d16594dc0 100644
--- a/chart2/source/tools/StatisticsHelper.cxx
+++ b/chart2/source/tools/StatisticsHelper.cxx
@@ -167,11 +167,10 @@ namespace chart
{
double StatisticsHelper::getVariance(
- const Sequence< double > & rData,
- bool bUnbiasedEstimator /* = false */ )
+ const Sequence< double > & rData )
{
sal_Int32 nValCount;
- return lcl_getVariance( rData, nValCount, bUnbiasedEstimator );
+ return lcl_getVariance( rData, nValCount, false/*bUnbiasedEstimator*/ );
}
double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData )
diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx
index 38eaa0e036ff..e08c349df1d9 100644
--- a/chart2/source/tools/ThreeDHelper.cxx
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -948,7 +948,7 @@ void ThreeDHelper::getRotationAngleFromDiagram(
}
}
-void ThreeDHelper::switchRightAngledAxes( const Reference< beans::XPropertySet >& xSceneProperties, bool bRightAngledAxes, bool bRotateLights )
+void ThreeDHelper::switchRightAngledAxes( const Reference< beans::XPropertySet >& xSceneProperties, bool bRightAngledAxes )
{
try
{
@@ -959,18 +959,15 @@ void ThreeDHelper::switchRightAngledAxes( const Reference< beans::XPropertySet >
if( bOldRightAngledAxes!=bRightAngledAxes)
{
xSceneProperties->setPropertyValue( "RightAngledAxes", uno::makeAny( bRightAngledAxes ));
- if( bRotateLights )
+ if(bRightAngledAxes)
{
- if(bRightAngledAxes)
- {
- ::basegfx::B3DHomMatrix aInverseRotation( lcl_getInverseRotationMatrix( xSceneProperties ) );
- lcl_rotateLights( aInverseRotation, xSceneProperties );
- }
- else
- {
- ::basegfx::B3DHomMatrix aCompleteRotation( lcl_getCompleteRotationMatrix( xSceneProperties ) );
- lcl_rotateLights( aCompleteRotation, xSceneProperties );
- }
+ ::basegfx::B3DHomMatrix aInverseRotation( lcl_getInverseRotationMatrix( xSceneProperties ) );
+ lcl_rotateLights( aInverseRotation, xSceneProperties );
+ }
+ else
+ {
+ ::basegfx::B3DHomMatrix aCompleteRotation( lcl_getCompleteRotationMatrix( xSceneProperties ) );
+ lcl_rotateLights( aCompleteRotation, xSceneProperties );
}
}
}