Kaydet (Commit) 2dbd02b5 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:redundantfcast improvements

check for calls to constructors, and extend the list of types we check
for unnecessary temporary creation

Change-Id: Ia2c1f202b41ed6866779fff5343c821128033eec
Reviewed-on: https://gerrit.libreoffice.org/63472
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 48314f25
......@@ -32,7 +32,7 @@ BreakPointList::BreakPointList()
BreakPointList::BreakPointList(BreakPointList const & rList)
{
for (size_t i = 0; i < rList.size(); ++i)
maBreakPoints.push_back( BreakPoint(rList.at( i )) );
maBreakPoints.push_back( rList.at( i ) );
}
BreakPointList::~BreakPointList()
......
......@@ -907,7 +907,7 @@ namespace vclcanvas
beFast ? BmpScaleFlag::Default : BmpScaleFlag::BestQuality );
return uno::Reference< rendering::XBitmap >(
new CanvasBitmap( BitmapEx(aBitmap), *mpDevice, mpOutDevProvider ) );
new CanvasBitmap( aBitmap, *mpDevice, mpOutDevProvider ) );
}
uno::Sequence< sal_Int8 > CanvasHelper::getData( rendering::IntegerBitmapLayout& rLayout,
......
......@@ -141,7 +141,7 @@ namespace vclcanvas
// opaque. Note: since we retrieved aBmp directly
// from an OutDev, it's already a 'display bitmap'
// on windows.
maContent = BitmapEx( aBmp );
maContent = aBmp;
}
else
{
......
......@@ -1858,7 +1858,7 @@ void Chart2ExportTest::testCustomDataLabelMultipleSeries()
CPPUNIT_ASSERT_EQUAL(OUString("Bars"), aFields[2]->getString());
// Second series
xDataSeries = uno::Reference<chart2::XDataSeries>(getDataSeriesFromDoc(xChartDoc, 0, 1));
xDataSeries = getDataSeriesFromDoc(xChartDoc, 0, 1);
CPPUNIT_ASSERT(xDataSeries.is());
xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_QUERY_THROW);
......
......@@ -1527,7 +1527,7 @@ void Chart2ImportTest::testTdf115107_2()
CPPUNIT_ASSERT_EQUAL(OUString("Bars"), aFields[2]->getString());
// Second series
xDataSeries = uno::Reference<chart2::XDataSeries>(getDataSeriesFromDoc(xChartDoc, 0, 1));
xDataSeries = getDataSeriesFromDoc(xChartDoc, 0, 1);
CPPUNIT_ASSERT(xDataSeries.is());
xPropertySet.set(xDataSeries->getDataPointByIndex(0), uno::UNO_QUERY_THROW);
......
......@@ -69,7 +69,7 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType
}
else if(eObjectType==OBJECTTYPE_LEGEND)
{
xObjectProp->setPropertyValue( "AnchorPosition", uno::Any(LegendPosition(LegendPosition_CUSTOM)));
xObjectProp->setPropertyValue( "AnchorPosition", uno::Any(LegendPosition_CUSTOM));
xObjectProp->setPropertyValue( "Expansion", uno::Any(css::chart::ChartLegendExpansion_CUSTOM));
chart2::RelativePosition aRelativePosition;
chart2::RelativeSize aRelativeSize;
......
......@@ -930,8 +930,8 @@ void AreaChart::createShapes()
{
if(eAlignment==LABEL_ALIGN_CENTER || m_nDimension == 3 )
nOffset = 0;
aScreenPosition2D = awt::Point( LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
.transformSceneToScreenPosition( aScenePosition3D ) );
aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
.transformSceneToScreenPosition( aScenePosition3D );
}
createDataLabel( m_xTextTarget, *pSeries, nIndex
......
......@@ -619,16 +619,16 @@ void NetChart::createShapes()
if( pPolarPosHelper )
{
PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
eAlignment, fLogicX, fLogicY, fLogicZ, nOffset ));
aScreenPosition2D = aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
eAlignment, fLogicX, fLogicY, fLogicZ, nOffset );
}
}
else
{
if(eAlignment==LABEL_ALIGN_CENTER )
nOffset = 0;
aScreenPosition2D = awt::Point( LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
.transformSceneToScreenPosition( aScenePosition3D ) );
aScreenPosition2D = LabelPositionHelper(m_nDimension,m_xLogicTarget,m_pShapeFactory)
.transformSceneToScreenPosition( aScenePosition3D );
}
createDataLabel( m_xTextTarget, *pSeries, nIndex
......
......@@ -126,11 +126,11 @@ void VDiagram::createShapes( const awt::Point& rPos, const awt::Size& rSize )
//do not change aspect ratio
awt::Size aAspectRatio( static_cast<sal_Int32>(m_aPreferredAspectRatio.DirectionX*FIXED_SIZE_FOR_3D_CHART_VOLUME),
static_cast<sal_Int32>(m_aPreferredAspectRatio.DirectionY*FIXED_SIZE_FOR_3D_CHART_VOLUME ));
m_aCurrentSizeWithoutAxes = awt::Size( ShapeFactory::calculateNewSizeRespectingAspectRatio(
rAvailableSize, aAspectRatio ) );
m_aCurrentSizeWithoutAxes = ShapeFactory::calculateNewSizeRespectingAspectRatio(
rAvailableSize, aAspectRatio );
//center diagram position
m_aCurrentPosWithoutAxes = awt::Point( ShapeFactory::calculateTopLeftPositionToCenterObject(
rPos, rAvailableSize, m_aCurrentSizeWithoutAxes ) );
m_aCurrentPosWithoutAxes = ShapeFactory::calculateTopLeftPositionToCenterObject(
rPos, rAvailableSize, m_aCurrentSizeWithoutAxes );
}
......
......@@ -1621,7 +1621,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
{
m_bPointsWereSkipped = false;
aConsumedOuterRect = ::basegfx::B2IRectangle( ShapeFactory::getRectangleOfShape(xBoundingShape) );
aConsumedOuterRect = ShapeFactory::getRectangleOfShape(xBoundingShape);
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
if (!rParam.mbUseFixedInnerSize)
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
......
......@@ -98,15 +98,15 @@ void Base64Test::testBase64EncodeForOStringBuffer()
inputSequence = { 0, 0, 0, 0, 0, 1, 2, 3 };
comphelper::Base64::encode(aBuffer, inputSequence);
CPPUNIT_ASSERT_EQUAL(OString("AAAAAAABAgM="), OString(aBuffer.makeStringAndClear()));
CPPUNIT_ASSERT_EQUAL(OString("AAAAAAABAgM="), aBuffer.makeStringAndClear());
inputSequence = { 5, 2, 3, 0, 0, 1, 2, 3 };
comphelper::Base64::encode(aBuffer, inputSequence);
CPPUNIT_ASSERT_EQUAL(OString("BQIDAAABAgM="), OString(aBuffer.makeStringAndClear()));
CPPUNIT_ASSERT_EQUAL(OString("BQIDAAABAgM="), aBuffer.makeStringAndClear());
inputSequence = { sal_Int8(sal_uInt8(200)), 31, 77, 111, 0, 1, 2, 3 };
comphelper::Base64::encode(aBuffer, inputSequence);
CPPUNIT_ASSERT_EQUAL(OString("yB9NbwABAgM="), OString(aBuffer.makeStringAndClear()));
CPPUNIT_ASSERT_EQUAL(OString("yB9NbwABAgM="), aBuffer.makeStringAndClear());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Base64Test);
......
......@@ -10,6 +10,8 @@
#include "check.hxx"
#include "compat.hxx"
#include "plugin.hxx"
#include <iostream>
#include <fstream>
namespace
{
......@@ -118,35 +120,106 @@ public:
return true;
}
/* Check for the creation of unnecessary temporaries when calling a constructor that takes a param by const & */
bool VisitCXXConstructExpr(CXXConstructExpr const* callExpr)
{
if (ignoreLocation(callExpr))
return true;
const CXXConstructorDecl* functionDecl = callExpr->getConstructor();
unsigned len = std::min(callExpr->getNumArgs(), functionDecl->getNumParams());
for (unsigned i = 0; i < len; ++i)
{
// check if param is const&
auto param = functionDecl->getParamDecl(i);
auto lvalueType = param->getType()->getAs<LValueReferenceType>();
if (!lvalueType)
continue;
if (!lvalueType->getPointeeType().isConstQualified())
continue;
auto paramClassOrStructType = lvalueType->getPointeeType()->getAs<RecordType>();
if (!paramClassOrStructType)
continue;
// check for temporary and functional cast in argument expression
auto arg = callExpr->getArg(i)->IgnoreImplicit();
auto functionalCast = dyn_cast<CXXFunctionalCastExpr>(arg);
if (!functionalCast)
continue;
auto const t1 = functionalCast->getTypeAsWritten();
auto const t2 = compat::getSubExprAsWritten(functionalCast)->getType();
if (t1.getCanonicalType().getTypePtr() != t2.getCanonicalType().getTypePtr())
continue;
// Check that the underlying expression is of the same class/struct type as the param i.e. that we are not instantiating
// something useful
if (t1.getCanonicalType().getTypePtr() != paramClassOrStructType)
continue;
report(DiagnosticsEngine::Warning, "redundant functional cast from %0 to %1",
arg->getExprLoc())
<< t2 << t1 << arg->getSourceRange();
report(DiagnosticsEngine::Note, "in call to method here", param->getLocation())
<< param->getSourceRange();
}
return true;
}
bool VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const* expr)
{
if (ignoreLocation(expr))
return true;
// specifying the name for an init-list is necessary sometimes
if (isa<InitListExpr>(expr->getSubExpr()->IgnoreImplicit()))
return true;
if (isa<CXXStdInitializerListExpr>(expr->getSubExpr()->IgnoreImplicit()))
return true;
auto const t1 = expr->getTypeAsWritten();
auto const t2 = compat::getSubExprAsWritten(expr)->getType();
if (t1.getCanonicalType().getTypePtr() != t2.getCanonicalType().getTypePtr())
{
return true;
}
auto tc = loplugin::TypeCheck(t1);
if (!(tc.Class("OUString").Namespace("rtl").GlobalNamespace()
|| tc.Class("Color").GlobalNamespace() || tc.Class("unique_ptr").StdNamespace()))
// (a) we do a lot of int/sal_Int32 kind of casts which might be platform necessary?
// (b) we do bool/bool casts in unit tests to avoid one of the other plugins
// so just ignore this kind of thing for now
if (const auto* BT = dyn_cast<BuiltinType>(t1->getUnqualifiedDesugaredType()))
{
return true;
auto k = BT->getKind();
if (k == BuiltinType::Double || k == BuiltinType::Float
|| (k >= BuiltinType::Bool && k <= BuiltinType::Int128))
return true;
}
if (const auto* BT = dyn_cast<BuiltinType>(t2->getUnqualifiedDesugaredType()))
{
auto k = BT->getKind();
if (k == BuiltinType::Double || k == BuiltinType::Float
|| (k >= BuiltinType::Bool && k <= BuiltinType::Int128))
return true;
}
auto tc = loplugin::TypeCheck(t1);
if (tc.Typedef("sal_Int32").GlobalNamespace())
return true;
report(DiagnosticsEngine::Warning, "redundant functional cast from %0 to %1",
expr->getExprLoc())
<< t2 << t1 << expr->getSourceRange();
//getParentStmt(expr)->dump();
return true;
}
private:
void run() override
{
if (compiler.getLangOpts().CPlusPlus)
{
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
if (!compiler.getLangOpts().CPlusPlus)
return;
std::string fn = handler.getMainFileName();
loplugin::normalizeDotDotInFilePath(fn);
// necessary on some other platforms
if (fn == SRCDIR "/sal/osl/unx/socket.cxx")
return;
// compile-time check of constant
if (fn == SRCDIR "/bridges/source/jni_uno/jni_bridge.cxx")
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
}
FunctionDecl const* m_CurrentFunctionDecl;
};
......
......@@ -23,6 +23,21 @@ struct Foo
void func1(Foo const& f); // expected-note {{in call to method here [loplugin:redundantfcast]}}
namespace tools
{
struct Polygon
{
Polygon() = default;
};
struct PolyPolygon
{
PolyPolygon(
Polygon const&); // expected-note {{in call to method here [loplugin:redundantfcast]}}
};
}
void ImplWritePolyPolygonRecord(const tools::PolyPolygon& rPolyPoly);
int main()
{
OUString s;
......@@ -53,7 +68,11 @@ int main()
Foo foo(1);
func1(Foo(
foo)); // expected-error@-1 {{redundant functional cast from 'Foo' to 'Foo' [loplugin:redundantfcast]}}
foo)); // expected-error@-1 {{redundant functional cast from 'Foo' to 'Foo' [loplugin:redundantfcast]}} expected-error@-1 {{redundant functional cast from 'Foo' to 'Foo' [loplugin:redundantfcast]}}
const tools::Polygon aPolygon;
ImplWritePolyPolygonRecord(tools::PolyPolygon(tools::Polygon(
aPolygon))); // expected-error@-1 {{redundant functional cast from 'const tools::Polygon' to 'tools::Polygon' [loplugin:redundantfcast]}} expected-error@-1 {{redundant functional cast from 'const tools::Polygon' to 'tools::Polygon' [loplugin:redundantfcast]}}
}
class Class1
......@@ -62,7 +81,7 @@ class Class1
Foo func2()
{
return Foo(
foo); // expected-error@-1 {{redundant functional cast from 'Foo' to 'Foo' [loplugin:redundantfcast]}}
foo); // expected-error@-1 {{redundant functional cast from 'Foo' to 'Foo' [loplugin:redundantfcast]}} expected-error@-1 {{redundant functional cast from 'Foo' to 'Foo' [loplugin:redundantfcast]}}
}
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -1019,7 +1019,7 @@ namespace cppcanvas
B2DPoint mappedCenter (Map (dx + dw/2, dy + dh/2));
B2DSize mappedSize( MapSize (dw/2, dh/2));
::basegfx::B2DPolyPolygon polyPolygon( ::basegfx::B2DPolygon( ::basegfx::utils::createPolygonFromEllipse( mappedCenter, mappedSize.getX (), mappedSize.getY () ) ) );
::basegfx::B2DPolyPolygon polyPolygon( ::basegfx::utils::createPolygonFromEllipse( mappedCenter, mappedSize.getX (), mappedSize.getY () ) );
if ( type == EmfPlusRecordTypeFillEllipse )
EMFPPlusFillPolygon( polyPolygon,
......@@ -1516,9 +1516,9 @@ namespace cppcanvas
B2DPoint mappedPoint (Map (dx, dy));
B2DSize mappedSize( MapSize (dw, dh));
::basegfx::B2DPolyPolygon polyPolygon( ::basegfx::B2DPolygon( ::basegfx::utils::createPolygonFromRect( ::basegfx::B2DRectangle( mappedPoint.getX(), mappedPoint.getY(),
::basegfx::B2DPolyPolygon polyPolygon( ::basegfx::utils::createPolygonFromRect( ::basegfx::B2DRectangle( mappedPoint.getX(), mappedPoint.getY(),
mappedPoint.getX() + mappedSize.getX(),
mappedPoint.getY() + mappedSize.getY() ) ) ) );
mappedPoint.getY() + mappedSize.getY() ) ) );
polyPolygon.transform(rState.mapModeTransform);
updateClipping (polyPolygon, rFactoryParms, combineMode == 1);
......
......@@ -1218,7 +1218,7 @@ void SvxShowText::SetFont( const vcl::Font& rFont )
{
long nWinHeight = GetOutputSizePixel().Height();
m_aFont = vcl::Font(rFont);
m_aFont = rFont;
m_aFont.SetWeight(WEIGHT_NORMAL);
m_aFont.SetAlignment(ALIGN_TOP);
m_aFont.SetFontSize(m_xVirDev->PixelToLogic(Size(0, nWinHeight / 2)));
......
......@@ -119,7 +119,7 @@ namespace sdbtools
Reference< XInterface > ConnectionTools::Create(const Reference< XComponentContext >& _rxContext )
{
return *( new ConnectionTools( Reference<XComponentContext>( _rxContext ) ) );
return *( new ConnectionTools( _rxContext ) );
}
void SAL_CALL ConnectionTools::initialize(const Sequence< Any > & _rArguments)
......
......@@ -207,7 +207,7 @@ namespace drawinglayer
aBitmapSizeLogic.getX(), aBitmapSizeLogic.getY(), aTranslate.getX(), aTranslate.getY()));
// create primitive
xRetval = new BitmapPrimitive2D(BitmapEx(aContent), aBitmapTransform);
xRetval = new BitmapPrimitive2D(aContent, aBitmapTransform);
}
catch( const uno::Exception& )
{
......
......@@ -1056,8 +1056,7 @@ namespace emfplushelper
::basegfx::B2DPoint mappedCenter(Map(dx + dw / 2, dy + dh / 2));
::basegfx::B2DSize mappedSize(MapSize(dw / 2, dh / 2));
::basegfx::B2DPolyPolygon polyPolygon(
::basegfx::B2DPolygon(
::basegfx::utils::createPolygonFromEllipse(mappedCenter, mappedSize.getX(), mappedSize.getY())));
::basegfx::utils::createPolygonFromEllipse(mappedCenter, mappedSize.getX(), mappedSize.getY()));
if (type == EmfPlusRecordTypeFillEllipse)
EMFPPlusFillPolygon(polyPolygon, flags & 0x8000, brushIndexOrColor);
......@@ -1663,13 +1662,12 @@ namespace emfplushelper
::basegfx::B2DSize mappedSize(MapSize(dw, dh));
::basegfx::B2DPolyPolygon polyPolygon(
::basegfx::B2DPolygon(
::basegfx::utils::createPolygonFromRect(
::basegfx::B2DRectangle(
mappedPoint.getX(),
mappedPoint.getY(),
mappedPoint.getX() + mappedSize.getX(),
mappedPoint.getY() + mappedSize.getY()))));
mappedPoint.getY() + mappedSize.getY())));
HandleNewClipRegion(combineClip(mrPropertyHolders.Current().getClipPolyPolygon(), combineMode, polyPolygon), mrTargetHolders, mrPropertyHolders);
break;
......
......@@ -74,13 +74,12 @@ namespace emfplushelper
::basegfx::B2DSize mappedSize(rR.MapSize(dw, dh));
::basegfx::B2DPolyPolygon polyPolygon(
::basegfx::B2DPolygon(
::basegfx::utils::createPolygonFromRect(
::basegfx::B2DRectangle(
mappedPoint.getX(),
mappedPoint.getY(),
mappedPoint.getX() + mappedSize.getX(),
mappedPoint.getY() + mappedSize.getY()))));
mappedPoint.getY() + mappedSize.getY())));
polygon = polyPolygon;
break;
}
......
......@@ -1063,12 +1063,11 @@ namespace wmfemfhelper
const vcl::Font& rFont = rProperty.getFont();
basegfx::B2DVector aFontScaling;
rFontAttribute = drawinglayer::attribute::FontAttribute(
drawinglayer::primitive2d::getFontAttributeFromVclFont(
aFontScaling,
rFont,
bool(rProperty.getLayoutMode() & ComplexTextLayoutFlags::BiDiRtl),
bool(rProperty.getLayoutMode() & ComplexTextLayoutFlags::BiDiStrong)));
rFontAttribute = drawinglayer::primitive2d::getFontAttributeFromVclFont(
aFontScaling,
rFont,
bool(rProperty.getLayoutMode() & ComplexTextLayoutFlags::BiDiRtl),
bool(rProperty.getLayoutMode() & ComplexTextLayoutFlags::BiDiStrong));
// add FontScaling
rTextTransform.scale(aFontScaling.getX(), aFontScaling.getY());
......
......@@ -322,7 +322,7 @@ public:
sal_Int32 GetIndex() const { return nIndex; }
void SetIndex( sal_Int32 n ) { nIndex = n; }
bool DbgIsBuggy( EditDoc const & rDoc );
bool DbgIsBuggy( EditDoc const & rDoc ) const;
friend bool operator == ( const EditPaM& r1, const EditPaM& r2 );
friend bool operator != ( const EditPaM& r1, const EditPaM& r2 );
......@@ -697,7 +697,7 @@ public:
bool HasRange() const { return aStartPaM != aEndPaM; }
bool IsInvalid() const { return !aStartPaM || !aEndPaM; }
bool DbgIsBuggy( EditDoc const & rDoc );
bool DbgIsBuggy( EditDoc const & rDoc ) const;
void Adjust( const EditDoc& rNodes );
......
......@@ -1113,14 +1113,14 @@ void EditPaM::SetNode(ContentNode* p)
pNode = p;
}
bool EditPaM::DbgIsBuggy( EditDoc const & rDoc )
bool EditPaM::DbgIsBuggy( EditDoc const & rDoc ) const
{
return !pNode ||
rDoc.GetPos( pNode ) >= rDoc.Count() ||
nIndex > pNode->Len();
}
bool EditSelection::DbgIsBuggy( EditDoc const & rDoc )
bool EditSelection::DbgIsBuggy( EditDoc const & rDoc ) const
{
return aStartPaM.DbgIsBuggy( rDoc ) || aEndPaM.DbgIsBuggy( rDoc );
}
......
......@@ -2304,7 +2304,7 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* pLeft, ContentNode* pR
EditPaM ImpEditEngine::DeleteLeftOrRight( const EditSelection& rSel, sal_uInt8 nMode, DeleteMode nDelMode )
{
OSL_ENSURE( !EditSelection( rSel ).DbgIsBuggy( aEditDoc ), "Index out of range in DeleteLeftOrRight" );
OSL_ENSURE( !rSel.DbgIsBuggy( aEditDoc ), "Index out of range in DeleteLeftOrRight" );
if ( rSel.HasRange() ) // only then Delete Selection
return ImpDeleteSelection( rSel );
......
......@@ -184,7 +184,7 @@ namespace logging
void CsvFormatter::setColumnnames(const Sequence< OUString >& columnnames)
{
m_Columnnames = Sequence< OUString>(columnnames);
m_Columnnames = columnnames;
m_MultiColumn = (m_Columnnames.getLength()>1);
}
......
......@@ -559,7 +559,7 @@ namespace pcr
SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
if (rId == "font")
{
aSet.Put (SvxFontListItem(static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))));
aSet.Put (static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST)));
aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE));
rPage.PageCreated(aSet);
}
......
......@@ -593,7 +593,7 @@ void Writer::Impl_writeText( const Point& rPos, const OUString& rText, const lon
}
basegfx::B2DHomMatrix m(basegfx::utils::createRotateB2DHomMatrix(static_cast<double>(nOrientation) * F_PI1800));
m.translate( double(aPt.X() / scale), double(aPt.Y()) );
m.translate( aPt.X() / scale, double(aPt.Y()) );
m.scale( scale, scale );
sal_Int16 nHeight = Int16_( map( Size( 0, aFont.GetFontHeight() ) ).Height() );
......@@ -1266,7 +1266,7 @@ void Writer::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegf
for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
{
const tools::Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
Impl_writePolyPolygon(tools::PolyPolygon(tools::Polygon(aPolygon)), true );
Impl_writePolyPolygon(tools::PolyPolygon(aPolygon), true );
}
mpVDev->SetLineColor(aOldLineColor);
......
......@@ -1676,7 +1676,7 @@ void PSWriter::ImplBmp( Bitmap const * pBitmap, Bitmap const * pMaskBitmap, cons
if ( mnLevel == 1 && nHeight > 10 )
nHeight = 8;
aRect = tools::Rectangle( Point( 0, nHeightOrg - nHeightLeft ), Size( nWidth, nHeight ) );
aRegion = vcl::Region( pMaskBitmap->CreateRegion( COL_BLACK, aRect ) );
aRegion = pMaskBitmap->CreateRegion( COL_BLACK, aRect );
if( mnLevel == 1 )
{
......
......@@ -4538,7 +4538,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
aP.setY( nY );
aXP[ static_cast<sal_uInt16>(nPtNum) ] = aP;
}
aPolyBoundRect = tools::Rectangle( aXP.GetBoundRect() );
aPolyBoundRect = aXP.GetBoundRect();
if ( nNumElemVert >= 3 )
{ // arc first command is always wr -- clockwise arc
// the parameters are : (left,top),(right,bottom),start(x,y),end(x,y)
......@@ -6351,7 +6351,7 @@ bool SvxMSDffManager::GetBLIP( sal_uLong nIdx_, Graphic& rGraphic, tools::Rectan
if (iter != aEscherBlipCache.end())
{
/* if this entry is available */
rGraphic = Graphic(iter->second);
rGraphic = iter->second;
if (rGraphic.GetType() != GraphicType::NONE)
bOk = true;
else
......
......@@ -345,7 +345,7 @@ void Model::loadInstance( sal_Int32 nInstance )
try
{
Reference<XInputStream> xInput =
Reference<XSimpleFileAccess3>( SimpleFileAccess::create( ::comphelper::getProcessComponentContext() ) )->openFileRead( sURL );
SimpleFileAccess::create( ::comphelper::getProcessComponentContext() )->openFileRead( sURL );
if( xInput.is() )
{
Reference<XDocument> xInstance =
......
......@@ -2468,7 +2468,7 @@ void SvtFileDialog::AddControls_Impl( )
_pPrevWin->SetOutputSizePixel(Size(200, 300));
_pPrevWin->Show();
_pPrevBmp = VclPtr<FixedBitmap>::Create( _pPrevWin, WinBits( WB_BORDER ) );
_pPrevBmp = VclPtr<FixedBitmap>::Create( _pPrevWin, WB_BORDER );
_pPrevBmp->SetBackground( Wallpaper( COL_WHITE ) );
_pPrevBmp->SetSizePixel(_pPrevWin->GetSizePixel());
_pPrevBmp->Show();
......
......@@ -89,7 +89,7 @@ DiagramLayoutFragmentHandler::onCreateContext( ::sal_Int32 aElement,
switch( aElement )
{
case DGM_TOKEN( layoutDef ):
return new DiagramDefinitionContext( *this, AttributeList( rAttribs ), mpDataPtr );
return new DiagramDefinitionContext( *this, rAttribs, mpDataPtr );
default:
break;
}
......
......@@ -486,7 +486,7 @@ bool DataProviderHandler::impl_dialogLinkedFields_nothrow( ::osl::ClearableMutex
{
uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence(
{
{"ParentWindow", uno::Any(m_xContext->getValueByName("DialogParentWindow"))},
{"ParentWindow", m_xContext->getValueByName("DialogParentWindow")},
{"Detail", uno::Any(m_xDataProvider)},
{"Master", uno::Any(m_xReportComponent->getSection()->getReportDefinition())},
{"Explanation", uno::Any(RptResId(RID_STR_EXPLANATION))},
......@@ -507,7 +507,7 @@ bool DataProviderHandler::impl_dialogChartType_nothrow( ::osl::ClearableMutexGua
{
uno::Sequence<uno::Any> aSeq(comphelper::InitAnyPropertySequence(
{
{"ParentWindow", uno::Any(m_xContext->getValueByName("DialogParentWindow"))},
{"ParentWindow", m_xContext->getValueByName("DialogParentWindow")},
{"ChartModel", uno::Any(m_xChartModel)}
}));
......
......@@ -73,9 +73,8 @@ ScTpFormulaOptions::ScTpFormulaOptions(vcl::Window* pParent, const SfxItemSet& r
OUString aSep = ScGlobal::GetpLocaleData()->getNumDecimalSep();
mnDecSep = aSep.isEmpty() ? u'.' : aSep[0];
maSavedDocOptions = ScDocOptions(
static_cast<const ScTpCalcItem&>(rCoreAttrs.Get(
GetWhich(SID_SCDOCOPTIONS))).GetDocOptions());
maSavedDocOptions = static_cast<const ScTpCalcItem&>(rCoreAttrs.Get(
GetWhich(SID_SCDOCOPTIONS))).GetDocOptions();
}
ScTpFormulaOptions::~ScTpFormulaOptions()
......
......@@ -113,7 +113,7 @@ void ScStyleDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
OSL_ENSURE( pInfoItem, "NumberInfoItem not found!" );
aSet.Put (SvxNumberInfoItem( static_cast<const SvxNumberInfoItem&>(*pInfoItem) ) );
aSet.Put ( static_cast<const SvxNumberInfoItem&>(*pInfoItem) );
rTabPage.PageCreated(aSet);
}
else if (rPageId == "font")
......
......@@ -3038,7 +3038,7 @@ bool PrintPageRanges::checkIfAlreadyCalculatedAndSet(
m_aInput.m_nStartCol = nStartCol;
m_aInput.m_nEndCol = nEndCol;
m_aInput.m_nPrintTab = nPrintTab;
m_aInput.m_aDocSize = Size(rDocSize);
m_aInput.m_aDocSize = rDocSize;
return false;
}
......
......@@ -666,9 +666,9 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
if( pReqArgs && pReqArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET )
bFormulaMode = static_cast<const SfxBoolItem *>(pItem)->GetValue();
ScViewOptions rSetOpts = ScViewOptions( rOpts );
rSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode );
rViewData.SetOptions( rSetOpts );
ScViewOptions aSetOpts = rOpts;
aSetOpts.SetOption( VOPT_FORMULAS, bFormulaMode );
rViewData.SetOptions( aSetOpts );
rViewData.GetDocShell()->PostPaintGridAll();
......
......@@ -162,7 +162,7 @@ public:
std::shared_ptr<BitmapReplacement> PngCompression::Compress (const BitmapEx& rBitmap) const
{
vcl::PNGWriter aWriter ((BitmapEx(rBitmap)));
vcl::PNGWriter aWriter(rBitmap);
SvMemoryStream aStream (32768, 32768);
aWriter.Write(aStream);
......
......@@ -1018,10 +1018,10 @@ Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
aAny <<= static_cast<sal_Int32>( GetPage()->GetSize().getHeight() );
break;
case WID_PAGE_ORIENT:
aAny <<= view::PaperOrientation(
aAny <<=
GetPage()->GetOrientation() == Orientation::Portrait
? view::PaperOrientation_PORTRAIT
: view::PaperOrientation_LANDSCAPE);
: view::PaperOrientation_LANDSCAPE;
break;