summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-27 11:01:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-27 18:30:58 +0200
commitc275184ae37d145f428a459a07917e127bd67577 (patch)
tree098dcd677a263e26252443ed79a5c4b85ea640ca /vcl
parent129f55097f926661f00919329fb28c6a85ecebbb (diff)
loplugin:makeshared in vcl
Change-Id: I990fafa8b01e94aef58d6cad30bc13de539ea496 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92968 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/settings.cxx3
-rw-r--r--vcl/source/gdi/WidgetDefinition.cxx2
-rw-r--r--vcl/source/gdi/region.cxx28
3 files changed, 17 insertions, 16 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index f54f05814258..8db54992b80f 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -596,7 +596,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
mnUseFlatBorders(rData.mnUseFlatBorders),
mbPreferredUseImagesInMenus(rData.mbPreferredUseImagesInMenus),
mnMinThumbSize(rData.mnMinThumbSize),
- mIconThemeScanner(rData.mIconThemeScanner?new vcl::IconThemeScanner(*rData.mIconThemeScanner):nullptr),
mIconThemeSelector(std::make_shared<vcl::IconThemeSelector>(*rData.mIconThemeSelector)),
mIconTheme(rData.mIconTheme),
mbSkipDisabledInMenus(rData.mbSkipDisabledInMenus),
@@ -618,6 +617,8 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
maPersonaFooterBitmap( rData.maPersonaFooterBitmap ),
maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor )
{
+ if (rData.mIconThemeScanner)
+ mIconThemeScanner = std::make_shared<vcl::IconThemeScanner>(*rData.mIconThemeScanner);
}
void ImplStyleData::SetStandardStyles()
diff --git a/vcl/source/gdi/WidgetDefinition.cxx b/vcl/source/gdi/WidgetDefinition.cxx
index 3db9214c45ce..3c93f1ac5601 100644
--- a/vcl/source/gdi/WidgetDefinition.cxx
+++ b/vcl/source/gdi/WidgetDefinition.cxx
@@ -176,7 +176,7 @@ void WidgetDefinitionState::addDrawImage(OUString const& sSource)
void WidgetDefinitionState::addDrawExternal(OUString const& sSource)
{
- auto pCommand(std::make_unique<WidgetDrawActionExternal>());
+ auto pCommand(std::make_shared<WidgetDrawActionExternal>());
pCommand->msSource = sSource;
mpWidgetDrawActions.push_back(std::move(pCommand));
}
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 42fc0c0b1c4a..460a30d5203a 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -84,12 +84,12 @@ namespace
A new RegionBand object is returned that contains the bands that
represent the given poly-polygon.
*/
- std::unique_ptr<RegionBand> ImplRectilinearPolygonToBands(const tools::PolyPolygon& rPolyPoly)
+ std::shared_ptr<RegionBand> ImplRectilinearPolygonToBands(const tools::PolyPolygon& rPolyPoly)
{
OSL_ASSERT(ImplIsPolygonRectilinear (rPolyPoly));
// Create a new RegionBand object as container of the bands.
- std::unique_ptr<RegionBand> pRegionBand( std::make_unique<RegionBand>() );
+ std::shared_ptr<RegionBand> pRegionBand( std::make_shared<RegionBand>() );
long nLineId = 0;
// Iterate over all polygons.
@@ -182,12 +182,12 @@ namespace
/** Convert a general polygon (one for which ImplIsPolygonRectilinear()
returns <FALSE/>) to bands.
*/
- std::unique_ptr<RegionBand> ImplGeneralPolygonToBands(const tools::PolyPolygon& rPolyPoly, const tools::Rectangle& rPolygonBoundingBox)
+ std::shared_ptr<RegionBand> ImplGeneralPolygonToBands(const tools::PolyPolygon& rPolyPoly, const tools::Rectangle& rPolygonBoundingBox)
{
long nLineID = 0;
// initialisation and creation of Bands
- std::unique_ptr<RegionBand> pRegionBand( std::make_unique<RegionBand>() );
+ std::shared_ptr<RegionBand> pRegionBand( std::make_shared<RegionBand>() );
pRegionBand->CreateBandRange(rPolygonBoundingBox.Top(), rPolygonBoundingBox.Bottom());
// insert polygons
@@ -231,9 +231,9 @@ bool vcl::Region::IsEmpty() const
}
-static std::unique_ptr<RegionBand> ImplCreateRegionBandFromPolyPolygon(const tools::PolyPolygon& rPolyPolygon)
+static std::shared_ptr<RegionBand> ImplCreateRegionBandFromPolyPolygon(const tools::PolyPolygon& rPolyPolygon)
{
- std::unique_ptr<RegionBand> pRetval;
+ std::shared_ptr<RegionBand> pRetval;
if(rPolyPolygon.Count())
{
@@ -558,7 +558,7 @@ void vcl::Region::Union( const tools::Rectangle& rRect )
return;
}
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+ std::shared_ptr<RegionBand> pNew = std::make_shared<RegionBand>(*pCurrent);
// get justified rectangle
const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -649,7 +649,7 @@ void vcl::Region::Intersect( const tools::Rectangle& rRect )
return;
}
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+ std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
// get justified rectangle
const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -728,7 +728,7 @@ void vcl::Region::Exclude( const tools::Rectangle& rRect )
return;
}
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+ std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
// get justified rectangle
const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -811,7 +811,7 @@ void vcl::Region::XOr( const tools::Rectangle& rRect )
}
// only region band mode possibility left here or null/empty
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*getRegionBand()));
+ std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*getRegionBand()));
// get justified rectangle
const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -906,7 +906,7 @@ void vcl::Region::Union( const vcl::Region& rRegion )
}
// prepare source and target
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+ std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
// union with source
pNew->Union(*pSource);
@@ -1024,7 +1024,7 @@ void vcl::Region::Intersect( const vcl::Region& rRegion )
else
{
// prepare new regionBand
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+ std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
// intersect with source
pNew->Intersect(*pSource);
@@ -1108,7 +1108,7 @@ void vcl::Region::Exclude( const vcl::Region& rRegion )
}
// prepare source and target
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+ std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
// union with source
const bool bSuccess(pNew->Exclude(*pSource));
@@ -1195,7 +1195,7 @@ bool vcl::Region::XOr( const vcl::Region& rRegion )
}
// prepare source and target
- std::unique_ptr<RegionBand> pNew( std::make_unique<RegionBand>(*pCurrent));
+ std::shared_ptr<RegionBand> pNew( std::make_shared<RegionBand>(*pCurrent));
// union with source
pNew->XOr(*pSource);