Kaydet (Commit) 1a284d1f authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:constantparam in c*

Change-Id: I10c7b62e6458062324367b94b207f776af79f598
Reviewed-on: https://gerrit.libreoffice.org/44129Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 8c9b5a90
...@@ -52,7 +52,7 @@ static void initContext() ...@@ -52,7 +52,7 @@ static void initContext()
glShadeModel(GL_FLAT); glShadeModel(GL_FLAT);
} }
static void initTransformation(const ::Size& rSize, bool bMirror) static void initTransformation(const ::Size& rSize)
{ {
// use whole window // use whole window
glViewport( 0,0, glViewport( 0,0,
...@@ -62,9 +62,9 @@ static void initTransformation(const ::Size& rSize, bool bMirror) ...@@ -62,9 +62,9 @@ static void initTransformation(const ::Size& rSize, bool bMirror)
// model coordinate system is already in device pixel // model coordinate system is already in device pixel
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
glTranslated(-1.0, (bMirror ? -1.0 : 1.0), 0.0); glTranslated(-1.0, 1.0, 0.0);
glScaled( 2.0 / rSize.Width(), glScaled( 2.0 / rSize.Width(),
(bMirror ? 2.0 : -2.0) / rSize.Height(), -2.0 / rSize.Height(),
1.0 ); 1.0 );
// clear to black // clear to black
...@@ -281,7 +281,7 @@ namespace oglcanvas ...@@ -281,7 +281,7 @@ namespace oglcanvas
SystemChildWindow* pChildWindow = mxContext->getChildWindow(); SystemChildWindow* pChildWindow = mxContext->getChildWindow();
const ::Size& rOutputSize = pChildWindow->GetSizePixel(); const ::Size& rOutputSize = pChildWindow->GetSizePixel();
initTransformation(rOutputSize, false); initTransformation(rOutputSize);
// render the actual spritecanvas content // render the actual spritecanvas content
mpSpriteCanvas->renderRecordedActions(); mpSpriteCanvas->renderRecordedActions();
......
...@@ -488,9 +488,8 @@ namespace vclcanvas ...@@ -488,9 +488,8 @@ namespace vclcanvas
const ::canvas::ParametricPolyPolygon::Values& rValues, const ::canvas::ParametricPolyPolygon::Values& rValues,
const std::vector< ::Color >& rColors, const std::vector< ::Color >& rColors,
const ::basegfx::B2DHomMatrix& rTextureTransform, const ::basegfx::B2DHomMatrix& rTextureTransform,
const ::tools::Rectangle& rBounds, const ::tools::Rectangle& rBounds,
unsigned int nStepCount, unsigned int nStepCount )
bool bFillNonOverlapping )
{ {
switch( rValues.meType ) switch( rValues.meType )
{ {
...@@ -510,7 +509,7 @@ namespace vclcanvas ...@@ -510,7 +509,7 @@ namespace vclcanvas
rTextureTransform, rTextureTransform,
rBounds, rBounds,
nStepCount, nStepCount,
bFillNonOverlapping, false/*bFillNonOverlapping*/,
rValues, rValues,
rColors ); rColors );
break; break;
...@@ -585,8 +584,7 @@ namespace vclcanvas ...@@ -585,8 +584,7 @@ namespace vclcanvas
rColors, rColors,
aTotalTransform, aTotalTransform,
aPolygonDeviceRectOrig, aPolygonDeviceRectOrig,
nStepCount, nStepCount );
false );
rOutDev.Pop(); rOutDev.Pop();
if( p2ndOutDev && nTransparency < 253 ) if( p2ndOutDev && nTransparency < 253 )
...@@ -611,8 +609,7 @@ namespace vclcanvas ...@@ -611,8 +609,7 @@ namespace vclcanvas
rColors, rColors,
aTotalTransform, aTotalTransform,
aPolygonDeviceRectOrig, aPolygonDeviceRectOrig,
nStepCount, nStepCount );
false );
rOutDev.Pop(); rOutDev.Pop();
if( p2ndOutDev && nTransparency < 253 ) if( p2ndOutDev && nTransparency < 253 )
......
...@@ -67,7 +67,7 @@ struct lcl_ChartTypeToSeriesCnt ...@@ -67,7 +67,7 @@ struct lcl_ChartTypeToSeriesCnt
} }
}; };
OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI ) OUString lcl_ConvertRole( const OUString & rRoleString )
{ {
OUString aResult( rRoleString ); OUString aResult( rRoleString );
...@@ -95,27 +95,11 @@ OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI ) ...@@ -95,27 +95,11 @@ OUString lcl_ConvertRole( const OUString & rRoleString, bool bFromInternalToUI )
aTranslationMap[ "BorderColor" ] = ::chart::SchResId( STR_PROPERTY_ROLE_BORDERCOLOR ); aTranslationMap[ "BorderColor" ] = ::chart::SchResId( STR_PROPERTY_ROLE_BORDERCOLOR );
} }
if( bFromInternalToUI ) tTranslationMap::const_iterator aIt( aTranslationMap.find( rRoleString ));
if( aIt != aTranslationMap.end())
{ {
tTranslationMap::const_iterator aIt( aTranslationMap.find( rRoleString )); aResult = (*aIt).second;
if( aIt != aTranslationMap.end())
{
aResult = (*aIt).second;
}
}
else
{
tTranslationMap::const_iterator aIt(
std::find_if( aTranslationMap.begin(), aTranslationMap.end(),
[&rRoleString]
( const tTranslationMap::value_type& cp )
{ return rRoleString == cp.second; } )
);
if( aIt != aTranslationMap.end())
aResult = (*aIt).first;
} }
return aResult; return aResult;
} }
...@@ -750,7 +734,7 @@ void DialogModel::setTimeBasedRange( bool bTimeBased, sal_Int32 nStart, sal_Int3 ...@@ -750,7 +734,7 @@ void DialogModel::setTimeBasedRange( bool bTimeBased, sal_Int32 nStart, sal_Int3
OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString ) OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString )
{ {
return lcl_ConvertRole( rRoleString, true ); return lcl_ConvertRole( rRoleString );
} }
OUString DialogModel::GetRoleDataLabel() OUString DialogModel::GetRoleDataLabel()
......
...@@ -589,7 +589,7 @@ void ChartElementsPanel::setTitleVisible(TitleHelper::eTitleType eTitle, bool bV ...@@ -589,7 +589,7 @@ void ChartElementsPanel::setTitleVisible(TitleHelper::eTitleType eTitle, bool bV
if (bVisible) if (bVisible)
{ {
OUString aText = eTitle == TitleHelper::SUB_TITLE ? maTextSubTitle : maTextTitle; OUString aText = eTitle == TitleHelper::SUB_TITLE ? maTextSubTitle : maTextTitle;
TitleHelper::createOrShowTitle(eTitle, aText, mxModel, comphelper::getProcessComponentContext(), nullptr); TitleHelper::createOrShowTitle(eTitle, aText, mxModel, comphelper::getProcessComponentContext());
} }
else else
{ {
......
...@@ -71,8 +71,7 @@ public: ...@@ -71,8 +71,7 @@ public:
createOrShowTitle( eTitleType nTitleIndex createOrShowTitle( eTitleType nTitleIndex
, const OUString& rTitleText , const OUString& rTitleText
, const css::uno::Reference< css::frame::XModel >& xModel , const css::uno::Reference< css::frame::XModel >& xModel
, const css::uno::Reference< css::uno::XComponentContext > & xContext , const css::uno::Reference< css::uno::XComponentContext > & xContex );
, ReferenceSizeProvider * pRefSizeProvider );
static void removeTitle( eTitleType nTitleIndex static void removeTitle( eTitleType nTitleIndex
, const css::uno::Reference< css::frame::XModel >& xModel ); , const css::uno::Reference< css::frame::XModel >& xModel );
......
...@@ -39,8 +39,7 @@ using namespace ::com::sun::star; ...@@ -39,8 +39,7 @@ using namespace ::com::sun::star;
namespace namespace
{ {
double lcl_getVariance( const Sequence< double > & rData, sal_Int32 & rOutValidCount, double lcl_getVariance( const Sequence< double > & rData, sal_Int32 & rOutValidCount )
bool bUnbiasedEstimator )
{ {
const sal_Int32 nCount = rData.getLength(); const sal_Int32 nCount = rData.getLength();
rOutValidCount = nCount; rOutValidCount = nCount;
...@@ -66,10 +65,7 @@ double lcl_getVariance( const Sequence< double > & rData, sal_Int32 & rOutValidC ...@@ -66,10 +65,7 @@ double lcl_getVariance( const Sequence< double > & rData, sal_Int32 & rOutValidC
else else
{ {
const double fN = static_cast< double >( rOutValidCount ); const double fN = static_cast< double >( rOutValidCount );
if( bUnbiasedEstimator ) fResult = (fQuadSum - fSum*fSum/fN) / fN;
fResult = (fQuadSum - fSum*fSum/fN) / (fN - 1);
else
fResult = (fQuadSum - fSum*fSum/fN) / fN;
} }
return fResult; return fResult;
...@@ -170,7 +166,7 @@ double StatisticsHelper::getVariance( ...@@ -170,7 +166,7 @@ double StatisticsHelper::getVariance(
const Sequence< double > & rData ) const Sequence< double > & rData )
{ {
sal_Int32 nValCount; sal_Int32 nValCount;
return lcl_getVariance( rData, nValCount, false/*bUnbiasedEstimator*/ ); return lcl_getVariance( rData, nValCount );
} }
double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData ) double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData )
...@@ -185,7 +181,7 @@ double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData ...@@ -185,7 +181,7 @@ double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData
double StatisticsHelper::getStandardError( const Sequence< double > & rData ) double StatisticsHelper::getStandardError( const Sequence< double > & rData )
{ {
sal_Int32 nValCount; sal_Int32 nValCount;
double fVar = lcl_getVariance( rData, nValCount, false ); double fVar = lcl_getVariance( rData, nValCount );
double fResult; double fResult;
if( nValCount == 0 || if( nValCount == 0 ||
......
...@@ -174,8 +174,7 @@ uno::Reference< XTitle > TitleHelper::createOrShowTitle( ...@@ -174,8 +174,7 @@ uno::Reference< XTitle > TitleHelper::createOrShowTitle(
TitleHelper::eTitleType eTitleType TitleHelper::eTitleType eTitleType
, const OUString& rTitleText , const OUString& rTitleText
, const uno::Reference< frame::XModel >& xModel , const uno::Reference< frame::XModel >& xModel
, const uno::Reference< uno::XComponentContext > & xContext , const uno::Reference< uno::XComponentContext > & xContext )
, ReferenceSizeProvider * pRefSizeProvider )
{ {
uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( eTitleType, xModel ) ); uno::Reference< chart2::XTitle > xTitled( TitleHelper::getTitle( eTitleType, xModel ) );
if( xTitled.is()) if( xTitled.is())
...@@ -186,7 +185,7 @@ uno::Reference< XTitle > TitleHelper::createOrShowTitle( ...@@ -186,7 +185,7 @@ uno::Reference< XTitle > TitleHelper::createOrShowTitle(
} }
else else
{ {
return createTitle(eTitleType, rTitleText, xModel, xContext, pRefSizeProvider); return createTitle(eTitleType, rTitleText, xModel, xContext, nullptr/*pRefSizeProvider*/);
} }
} }
......
...@@ -844,13 +844,12 @@ void lcl_AddErrorBottomLine( const drawing::Position3D& rPosition, ::basegfx::B2 ...@@ -844,13 +844,12 @@ void lcl_AddErrorBottomLine( const drawing::Position3D& rPosition, ::basegfx::B2
} }
drawing::Position3D lcl_transformMixedToScene( PlottingPositionHelper const * pPosHelper drawing::Position3D lcl_transformMixedToScene( PlottingPositionHelper const * pPosHelper
, double fX /*scaled*/, double fY /*unscaled*/, double fZ /*unscaled*/, bool bClip ) , double fX /*scaled*/, double fY /*unscaled*/, double fZ /*unscaled*/ )
{ {
if(!pPosHelper) if(!pPosHelper)
return drawing::Position3D(0,0,0); return drawing::Position3D(0,0,0);
pPosHelper->doLogicScaling( nullptr,&fY,&fZ ); pPosHelper->doLogicScaling( nullptr,&fY,&fZ );
if(bClip) pPosHelper->clipScaledLogicValues( &fX,&fY,&fZ );
pPosHelper->clipScaledLogicValues( &fX,&fY,&fZ );
return pPosHelper->transformScaledLogicToScene( fX, fY, fZ, false ); return pPosHelper->transformScaledLogicToScene( fX, fY, fZ, false );
} }
...@@ -912,7 +911,7 @@ void VSeriesPlotter::createErrorBar( ...@@ -912,7 +911,7 @@ void VSeriesPlotter::createErrorBar(
else else
m_pPosHelper->doLogicScaling( &fScaledX, nullptr, nullptr ); m_pPosHelper->doLogicScaling( &fScaledX, nullptr, nullptr );
aMiddle = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fY, fZ, true ); aMiddle = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fY, fZ );
drawing::Position3D aNegative(aMiddle); drawing::Position3D aNegative(aMiddle);
drawing::Position3D aPositive(aMiddle); drawing::Position3D aPositive(aMiddle);
...@@ -929,7 +928,7 @@ void VSeriesPlotter::createErrorBar( ...@@ -929,7 +928,7 @@ void VSeriesPlotter::createErrorBar(
if( bYError ) if( bYError )
{ {
fLocalY+=fLength; fLocalY+=fLength;
aPositive = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fLocalY, fZ, true ); aPositive = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fLocalY, fZ );
} }
else else
{ {
...@@ -952,7 +951,7 @@ void VSeriesPlotter::createErrorBar( ...@@ -952,7 +951,7 @@ void VSeriesPlotter::createErrorBar(
if( bYError ) if( bYError )
{ {
fLocalY-=fLength; fLocalY-=fLength;
aNegative = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fLocalY, fZ, true ); aNegative = lcl_transformMixedToScene( m_pPosHelper, fScaledX, fLocalY, fZ );
} }
else else
{ {
......
...@@ -62,16 +62,10 @@ OString getTempDir(const OString& sFileName) ...@@ -62,16 +62,10 @@ OString getTempDir(const OString& sFileName)
OString createFileNameFromType( const OString& destination, OString createFileNameFromType( const OString& destination,
const OString& typeName, const OString& typeName,
const OString& postfix, const OString& postfix )
bool bLowerCase )
{ {
OString type(typeName.replace('.', '/')); OString type(typeName.replace('.', '/'));
if (bLowerCase)
{
type = typeName.toAsciiLowerCase();
}
sal_uInt32 length = destination.getLength(); sal_uInt32 length = destination.getLength();
bool bWithPoint = false; bool bWithPoint = false;
......
...@@ -73,8 +73,7 @@ private: ...@@ -73,8 +73,7 @@ private:
::rtl::OString createFileNameFromType(const ::rtl::OString& destination, ::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
const ::rtl::OString& type, const ::rtl::OString& type,
const ::rtl::OString& postfix, const ::rtl::OString& postfix);
bool bLowerCase=false);
bool fileExists(const ::rtl::OString& fileName); bool fileExists(const ::rtl::OString& fileName);
bool makeValidTypeFile(const ::rtl::OString& targetFileName, bool makeValidTypeFile(const ::rtl::OString& targetFileName,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment