[Libreoffice-commits] core.git: vcl/unx

2017-11-09 Thread Mark Page
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 37a4c09145604a056f48f7484fe87e7d247a7af9
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Nov 8 15:23:35 2017 +

Prevent GTK assertion with FilePicker dialog

If "use-header-bar" property of the dialog is set to TRUE,
it uses a GtkHeaderBar for action buttons instead of the
action area.

Change-Id: I9cebbce76d81ca50538e7d24133aa45e628d29b8
Reviewed-on: https://gerrit.libreoffice.org/44490
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Mark Page <aptit...@btconnect.com>

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx 
b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 27841edde9c9..75e87e2eb5c7 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -416,8 +416,11 @@ shrinkFilterName( const OUString , bool 
bAllowNoStar = false )
 static void
 dialog_remove_buttons(GtkWidget *pActionArea)
 {
-GList *pChildren =
-gtk_container_get_children( GTK_CONTAINER( pActionArea ) );
+GtkContainer *pContainer = GTK_CONTAINER( pActionArea );
+
+g_return_if_fail( pContainer != nullptr );
+
+GList *pChildren = gtk_container_get_children( pContainer );
 
 for( GList *p = pChildren; p; p = p->next )
 {
@@ -436,7 +439,11 @@ dialog_remove_buttons( GtkDialog *pDialog )
 
 #if GTK_CHECK_VERSION(3,0,0)
 #if GTK_CHECK_VERSION(3,12,0)
-dialog_remove_buttons(gtk_dialog_get_header_bar(pDialog));
+GtkWidget *pHeaderBar = gtk_dialog_get_header_bar(pDialog);
+if( pHeaderBar != nullptr )
+dialog_remove_buttons( pHeaderBar );
+else
+dialog_remove_buttons(gtk_dialog_get_action_area(pDialog));
 #endif
 dialog_remove_buttons(gtk_dialog_get_action_area(pDialog));
 #else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: cppcanvas/Library_cppcanvas.mk cppcanvas/source

2017-01-23 Thread Mark Page
 cppcanvas/Library_cppcanvas.mk |7 
 cppcanvas/source/mtfrenderer/emfpbrush.cxx |  313 ++
 cppcanvas/source/mtfrenderer/emfpbrush.hxx |  122 ++
 cppcanvas/source/mtfrenderer/emfpcustomlinecap.cxx |  163 +++
 cppcanvas/source/mtfrenderer/emfpcustomlinecap.hxx |   47 
 cppcanvas/source/mtfrenderer/emfpfont.cxx  |   74 +
 cppcanvas/source/mtfrenderer/emfpfont.hxx  |   42 
 cppcanvas/source/mtfrenderer/emfpimage.cxx |  100 ++
 cppcanvas/source/mtfrenderer/emfpimage.hxx |   44 
 cppcanvas/source/mtfrenderer/emfplus.cxx   | 1047 -
 cppcanvas/source/mtfrenderer/emfppath.cxx  |  189 +++
 cppcanvas/source/mtfrenderer/emfppath.hxx  |   48 
 cppcanvas/source/mtfrenderer/emfppen.cxx   |  284 +
 cppcanvas/source/mtfrenderer/emfppen.hxx   |   80 +
 cppcanvas/source/mtfrenderer/emfpregion.cxx|   94 +
 cppcanvas/source/mtfrenderer/emfpregion.hxx|   43 
 16 files changed, 1664 insertions(+), 1033 deletions(-)

New commits:
commit f671121525b854b6776d7e0ae1ad04d50d7373dc
Author: Mark Page <aptit...@btconnect.com>
Date:   Thu Nov 24 11:33:23 2016 +

Split emfplus.cxx into multiple files

This helps make emfplus.cxx more readable.
No source code was changed, only moved except these
renamed to avoid inheritance warnings::
EMFPBrush::transformation renamed to brush_transformation
EMFPPen::transformation renamed to pen_transformation
Change-Id: I6952d6300c9c459833c2dda2b715d851b9e80de7
Reviewed-on: https://gerrit.libreoffice.org/31165
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: jan iversen <j...@documentfoundation.org>

diff --git a/cppcanvas/Library_cppcanvas.mk b/cppcanvas/Library_cppcanvas.mk
index 893918d..13841d2 100644
--- a/cppcanvas/Library_cppcanvas.mk
+++ b/cppcanvas/Library_cppcanvas.mk
@@ -50,7 +50,14 @@ $(eval $(call gb_Library_use_libraries,cppcanvas,\
 $(eval $(call gb_Library_add_exception_objects,cppcanvas,\
cppcanvas/source/mtfrenderer/bitmapaction \
cppcanvas/source/mtfrenderer/cachedprimitivebase \
+   cppcanvas/source/mtfrenderer/emfpbrush \
+   cppcanvas/source/mtfrenderer/emfpcustomlinecap \
+   cppcanvas/source/mtfrenderer/emfpfont \
+   cppcanvas/source/mtfrenderer/emfpimage \
cppcanvas/source/mtfrenderer/emfplus \
+   cppcanvas/source/mtfrenderer/emfppen \
+   cppcanvas/source/mtfrenderer/emfppath \
+   cppcanvas/source/mtfrenderer/emfpregion \
cppcanvas/source/mtfrenderer/implrenderer \
cppcanvas/source/mtfrenderer/lineaction \
cppcanvas/source/mtfrenderer/mtftools \
diff --git a/cppcanvas/source/mtfrenderer/emfpbrush.cxx 
b/cppcanvas/source/mtfrenderer/emfpbrush.cxx
new file mode 100755
index 000..9de0f4c
--- /dev/null
+++ b/cppcanvas/source/mtfrenderer/emfpbrush.cxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace cppcanvas
+{
+namespace internal
+{
+EMFPBrush::EMFPBrush()
+: type(0)
+, additionalFlags(0)
+, wrapMode(0)
+, areaX(0.0)
+, areaY(0.0)
+, areaWidth(0.0)
+, areaHeight(0.0)
+, hasTransformation(false)
+, blendPoints(0)
+, blendPositions(nullptr)
+, blendFactors(nullptr)
+, colorblendPoints(0)
+, colorblendPositions(nullptr)
+, colorblendColors(nullptr)
+, surroundColorsNumber(0)
+, surroundColors(nullptr)
+, path(nullptr)
+, hatchStyle(HatchStyleHorizontal)
+{
+}
+
+EMFPBrush::~EMFPBrush()
+{
+if (blendPositions != nullptr) {
+delete[] blendPositions;
+

[Libreoffice-commits] core.git: vcl/source

2016-12-20 Thread Mark Page
 vcl/source/filter/igif/gifread.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 5a20df55ff829978c880b22e0a1f32c35d0ba30f
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Nov 30 12:06:55 2016 +

tdf#104121 Set default animation playback speed to match browsers

Change-Id: Id4814c4fa965ea5c4f73931be171294bed258909
Reviewed-on: https://gerrit.libreoffice.org/31416
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Caolán McNamara <caol...@redhat.com>
Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index 3c98628..4cd2994 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -630,6 +630,11 @@ void GIFReader::CreateNewBitmaps()
 aAnimBmp.nWait = ( nTimer != 65535 ) ? nTimer : ANIMATION_TIMEOUT_ON_CLICK;
 aAnimBmp.bUserInput = false;
 
+// tdf#104121 . Internet Explorer, Firefox, Chrome and Safari all set a 
minimum default playback speed.
+// IE10 Consumer Preview sets default of 100ms for rates less that 20ms. 
We do the same
+if (aAnimBmp.nWait < 2) // 20ms, specified in 100's of a second
+aAnimBmp.nWait = 10;
+
 if( nGCDisposalMethod == 2 )
 aAnimBmp.eDisposal = Disposal::Back;
 else if( nGCDisposalMethod == 3 )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/vcl svtools/source vcl/inc vcl/source

2016-12-07 Thread Mark Page
 include/vcl/wall.hxx |1 
 svtools/source/contnr/ivctrl.cxx |7 +-
 vcl/inc/wall2.hxx|   12 +--
 vcl/source/gdi/wall.cxx  |  121 +++
 4 files changed, 49 insertions(+), 92 deletions(-)

New commits:
commit c54eb45230ef54c10e7a86d1c249ea42b07881fe
Author: Mark Page <aptit...@btconnect.com>
Date:   Tue Dec 6 07:55:14 2016 +

ImplWallpaper to use std::unique_ptr

Also remove ImplWallpaper::operator==, that does not
make sense since members are unique

Change-Id: I69d32d91ba33691eb1f86e70ce3c53fa2761e34b
Reviewed-on: https://gerrit.libreoffice.org/31666
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/wall.hxx b/include/vcl/wall.hxx
index ac1d3d2..bd9fa29 100644
--- a/include/vcl/wall.hxx
+++ b/include/vcl/wall.hxx
@@ -93,6 +93,7 @@ public:
 
 Wallpaper&  operator=( const Wallpaper& rWallpaper );
 Wallpaper&  operator=( Wallpaper&& rWallpaper );
+
 booloperator==( const Wallpaper& rWallpaper ) const;
 booloperator!=( const Wallpaper& rWallpaper ) const
 { return !(Wallpaper::operator==( rWallpaper )); }
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index 41f2296..1981845 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -338,9 +338,12 @@ void SvtIconChoiceCtrl::SetBackground( const Wallpaper& 
rPaper )
 if( rPaper != GetBackground() )
 {
 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-Wallpaper aEmpty;
-if( rPaper == aEmpty )
+// if it is the default (empty) wallpaper
+if( rPaper.GetStyle() == WallpaperStyle::NONE && rPaper.GetColor() == 
COL_TRANSPARENT &&
+!rPaper.IsBitmap() && !rPaper.IsGradient() && !rPaper.IsRect())
+{
 Control::SetBackground( rStyleSettings.GetFieldColor() );
+}
 else
 {
 Wallpaper aBackground( rPaper );
diff --git a/vcl/inc/wall2.hxx b/vcl/inc/wall2.hxx
index 59f2ebb..52393dd 100644
--- a/vcl/inc/wall2.hxx
+++ b/vcl/inc/wall2.hxx
@@ -25,19 +25,19 @@ class ImplWallpaper
 friend class Wallpaper;
 
 private:
-Color   maColor;
-BitmapEx*   mpBitmap;
-Gradient*   mpGradient;
-Rectangle*  mpRect;
+Color   maColor;
+std::unique_ptr   mpBitmap;
+std::unique_ptr   mpGradient;
+std::unique_ptr  mpRect;
 WallpaperStyle  meStyle;
-BitmapEx*   mpCache;
+std::unique_ptr   mpCache;
 
 public:
 ImplWallpaper();
 ImplWallpaper( const ImplWallpaper& rImplWallpaper );
 ~ImplWallpaper();
 
-bool operator==( const ImplWallpaper& rImplWallpaper ) const;
+bool operator==( const ImplWallpaper& rImplWallpaper ) const = delete;
 
 friend SvStream& ReadImplWallpaper( SvStream& rIStm, ImplWallpaper& 
rImplWallpaper );
 friend SvStream& WriteImplWallpaper( SvStream& rOStm, const ImplWallpaper& 
rImplWallpaper );
diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
index 30cba89..b3f6fa2 100644
--- a/vcl/source/gdi/wall.cxx
+++ b/vcl/source/gdi/wall.cxx
@@ -27,57 +27,32 @@
 #include 
 #include 
 #include 
+#include 
 
 ImplWallpaper::ImplWallpaper() :
-maColor( COL_TRANSPARENT )
+maColor( COL_TRANSPARENT ), meStyle( WallpaperStyle::NONE )
 {
-mpBitmap= nullptr;
-mpCache = nullptr;
-mpGradient  = nullptr;
-mpRect  = nullptr;
-meStyle = WallpaperStyle::NONE;
 }
 
 ImplWallpaper::ImplWallpaper( const ImplWallpaper& rImplWallpaper ) :
-maColor( rImplWallpaper.maColor )
+maColor( rImplWallpaper.maColor ), meStyle(rImplWallpaper.meStyle)
 {
-meStyle = rImplWallpaper.meStyle;
-
 if ( rImplWallpaper.mpBitmap )
-mpBitmap = new BitmapEx( *rImplWallpaper.mpBitmap );
-else
-mpBitmap = nullptr;
+mpBitmap = o3tl::make_unique( *rImplWallpaper.mpBitmap );
+
 if( rImplWallpaper.mpCache )
-mpCache = new BitmapEx( *rImplWallpaper.mpCache );
-else
-mpCache = nullptr;
+mpCache = o3tl::make_unique( *rImplWallpaper.mpCache );
+
 if ( rImplWallpaper.mpGradient )
-mpGradient = new Gradient( *rImplWallpaper.mpGradient );
-else
-mpGradient = nullptr;
+mpGradient = o3tl::make_unique( *rImplWallpaper.mpGradient );
+
 if ( rImplWallpaper.mpRect )
-mpRect = new Rectangle( *rImplWallpaper.mpRect );
-else
-mpRect = nullptr;
-}
+mpRect = o3tl::make_unique( *rImplWallpaper.mpRect );
 
-ImplWallpaper::~ImplWallpaper()
-{
-delete mpBitmap;
-delete mpCache;
-delete mpGradient;
-delete mpRect;
 }
 
-boo

[Libreoffice-commits] core.git: vcl/source

2016-12-06 Thread Mark Page
 vcl/source/gdi/region.cxx |   76 --
 1 file changed, 34 insertions(+), 42 deletions(-)

New commits:
commit ed80d28d9f019a1afa2edd66e115eae26ea19963
Author: Mark Page <aptit...@btconnect.com>
Date:   Tue Dec 6 08:29:50 2016 +

Convert region to use std::unique_ptr

Change-Id: I1bcc6c62e2caa16f4f3fbc0bef60934e72a3e9a3
Reviewed-on: https://gerrit.libreoffice.org/31669
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index e9f5c42..51fe138 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -84,12 +85,12 @@ namespace
 A new RegionBand object is returned that contains the bands that
 represent the given poly-polygon.
 */
-RegionBand* ImplRectilinearPolygonToBands(const tools::PolyPolygon& 
rPolyPoly)
+std::unique_ptr ImplRectilinearPolygonToBands(const 
tools::PolyPolygon& rPolyPoly)
 {
 OSL_ASSERT(ImplIsPolygonRectilinear (rPolyPoly));
 
 // Create a new RegionBand object as container of the bands.
-RegionBand* pRegionBand = new RegionBand();
+std::unique_ptr pRegionBand( 
o3tl::make_unique() );
 long nLineId = 0;
 
 // Iterate over all polygons.
@@ -182,12 +183,12 @@ namespace
 /** Convert a general polygon (one for which ImplIsPolygonRectilinear()
 returns ) to bands.
 */
-RegionBand* ImplGeneralPolygonToBands(const tools::PolyPolygon& rPolyPoly, 
const Rectangle& rPolygonBoundingBox)
+std::unique_ptr ImplGeneralPolygonToBands(const 
tools::PolyPolygon& rPolyPoly, const Rectangle& rPolygonBoundingBox)
 {
 long nLineID = 0;
 
 // initialisation and creation of Bands
-RegionBand* pRegionBand = new RegionBand();
+std::unique_ptr pRegionBand( 
o3tl::make_unique() );
 pRegionBand->CreateBandRange(rPolygonBoundingBox.Top(), 
rPolygonBoundingBox.Bottom());
 
 // insert polygons
@@ -231,9 +232,9 @@ bool vcl::Region::IsEmpty() const
 }
 
 
-RegionBand* ImplCreateRegionBandFromPolyPolygon(const tools::PolyPolygon& 
rPolyPolygon)
+std::unique_ptr ImplCreateRegionBandFromPolyPolygon(const 
tools::PolyPolygon& rPolyPolygon)
 {
-RegionBand* pRetval = nullptr;
+std::unique_ptr pRetval;
 
 if(rPolyPolygon.Count())
 {
@@ -268,8 +269,7 @@ RegionBand* ImplCreateRegionBandFromPolyPolygon(const 
tools::PolyPolygon& rPolyP
 // of seps are joined.
 if(!pRetval->OptimizeBandList())
 {
-delete pRetval;
-pRetval = nullptr;
+pRetval.reset();
 }
 }
 }
@@ -571,7 +571,7 @@ bool vcl::Region::Union( const Rectangle& rRect )
 return true;
 }
 
-RegionBand* pNew = new RegionBand(*pCurrent);
+std::unique_ptr pNew( 
o3tl::make_unique(*pCurrent));
 
 // get justified rectangle
 const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -588,11 +588,10 @@ bool vcl::Region::Union( const Rectangle& rRect )
 // cleanup
 if(!pNew->OptimizeBandList())
 {
-delete pNew;
-pNew = nullptr;
+pNew.reset();
 }
 
-mpRegionBand.reset(pNew);
+mpRegionBand = std::move(pNew);
 return true;
 }
 
@@ -664,7 +663,7 @@ bool vcl::Region::Intersect( const Rectangle& rRect )
 return true;
 }
 
-RegionBand* pNew = new RegionBand(*pCurrent);
+std::unique_ptr pNew( 
o3tl::make_unique(*pCurrent));
 
 // get justified rectangle
 const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -681,11 +680,10 @@ bool vcl::Region::Intersect( const Rectangle& rRect )
 // cleanup
 if(!pNew->OptimizeBandList())
 {
-delete pNew;
-pNew = nullptr;
+pNew.reset();
 }
 
-mpRegionBand.reset(pNew);
+mpRegionBand = std::move(pNew);
 return true;
 }
 
@@ -745,7 +743,7 @@ bool vcl::Region::Exclude( const Rectangle& rRect )
 return true;
 }
 
-RegionBand* pNew = new RegionBand(*pCurrent);
+std::unique_ptr pNew( 
o3tl::make_unique(*pCurrent));
 
 // get justified rectangle
 const long nLeft(std::min(rRect.Left(), rRect.Right()));
@@ -762,11 +760,10 @@ bool vcl::Region::Exclude( const Rectangle& rRect )
 // cleanup
 if(!pNew->OptimizeBandList())
 {
-delete pNew;
-pNew = nullptr;
+pNew.reset();
 }
 
-mpRegionBand.reset(pNew);
+mpRegionBand = std::move(pNew);
 return true;
 }
 
@@ -830,7 +827,7 @@ bool vcl::Region::XOr( const Rectangle& rRect )
 }
 
 // only region band mode possibility left here or null/empty
-R

[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/source

2016-12-06 Thread Mark Page
 include/vcl/texteng.hxx   |2 -
 sfx2/source/control/thumbnailviewitem.cxx |1 
 vcl/source/edit/texteng.cxx   |3 -
 vcl/source/edit/textview.cxx  |   50 +-
 4 files changed, 26 insertions(+), 30 deletions(-)

New commits:
commit e67857cb18f6565959122a36d81ec722ac052a11
Author: Mark Page <aptit...@btconnect.com>
Date:   Tue Dec 6 09:58:41 2016 +

Convert TextView to unique_ptr

The destructor contains reset to the unique_ptr's because
it is not clear of the importance of the destruction order

Change-Id: Ifbbb4fe8352cb3b50f18cebd60cf00af010c086a
Reviewed-on: https://gerrit.libreoffice.org/31673
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 96ac426..4746a7b 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -100,7 +100,7 @@ private:
 
 IdleFormatter*  mpIdleFormatter;
 
-TEIMEInfos* mpIMEInfos;
+std::unique_ptr mpIMEInfos;
 
 css::lang::Locale   maLocale;
 css::uno::Reference< css::i18n::XBreakIterator > mxBreakIterator;
diff --git a/sfx2/source/control/thumbnailviewitem.cxx 
b/sfx2/source/control/thumbnailviewitem.cxx
index 33a5b2d..249e1c4 100644
--- a/sfx2/source/control/thumbnailviewitem.cxx
+++ b/sfx2/source/control/thumbnailviewitem.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace basegfx;
 using namespace basegfx::tools;
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index f91e69d..4ba1f23 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -69,7 +69,6 @@ TextEngine::TextEngine()
 , mpActiveView {nullptr}
 , mpUndoManager {nullptr}
 , mpIdleFormatter {nullptr}
-, mpIMEInfos {nullptr}
 , mpLocaleDataWrapper {nullptr}
 , maTextColor {COL_BLACK}
 , mnMaxTextLen {0}
@@ -118,7 +117,7 @@ TextEngine::~TextEngine()
 delete mpViews; // only the list, not the Views
 mpRefDev.disposeAndClear();
 delete mpUndoManager;
-delete mpIMEInfos;
+mpIMEInfos.reset();
 delete mpLocaleDataWrapper;
 }
 
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 77a7c5a..42c2201 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -57,6 +57,7 @@
 #include 
 
 #include 
+#include 
 
 class TETextDataObject :public css::datatransfer::XTransferable,
 public ::cppu::OWeakObject
@@ -147,14 +148,14 @@ struct ImpTextView
 Point   maStartDocPos;
 //TextPaM maMBDownPaM;
 
-vcl::Cursor*mpCursor;
+std::unique_ptr mpCursor;
 
-TextDDInfo* mpDDInfo;
+std::unique_ptr mpDDInfo;
 
 VclPtr  mpVirtDev;
 
-SelectionEngine*mpSelEngine;
-TextSelFunctionSet* mpSelFuncSet;
+std::unique_ptr mpSelEngine;
+std::unique_ptr mpSelFuncSet;
 
 css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > 
mxDnDListener;
 
@@ -195,14 +196,14 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* 
pWindow ) :
 
 mpImpl->mnTravelXPos = TRAVEL_X_DONTKNOW;
 
-mpImpl->mpSelFuncSet = new TextSelFunctionSet( this );
-mpImpl->mpSelEngine = new SelectionEngine( mpImpl->mpWindow, 
mpImpl->mpSelFuncSet );
+mpImpl->mpSelFuncSet = o3tl::make_unique( this );
+mpImpl->mpSelEngine = o3tl::make_unique( 
mpImpl->mpWindow, mpImpl->mpSelFuncSet.get() );
 mpImpl->mpSelEngine->SetSelectionMode( SelectionMode::Range );
 mpImpl->mpSelEngine->EnableDrag( true );
 
-mpImpl->mpCursor = new vcl::Cursor;
+mpImpl->mpCursor = o3tl::make_unique();
 mpImpl->mpCursor->Show();
-pWindow->SetCursor( mpImpl->mpCursor );
+pWindow->SetCursor( mpImpl->mpCursor.get() );
 pWindow->SetInputContext( InputContext( pEng->GetFont(), 
InputContextFlags::Text|InputContextFlags::ExtText ) );
 
 if ( pWindow->GetSettings().GetStyleSettings().GetSelectionOptions() & 
SelectionOptions::Invert )
@@ -210,8 +211,6 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* 
pWindow ) :
 
 pWindow->SetLineColor();
 
-mpImpl->mpDDInfo = nullptr;
-
 if ( pWindow->GetDragGestureRecognizer().is() )
 {
 vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new 
vcl::unohelper::DragAndDropWrapper( this );
@@ -228,14 +227,16 @@ TextView::TextView( ExtTextEngine* pEng, vcl::Window* 
pWindow ) :
 
 TextView::~TextView()
 {
-delete mpImpl->mpSelEngine;
-delete mpImpl->mpSelFuncSet;
+mpImpl->mpSelEngine.reset();
+mpImpl->mpSelFuncSet.reset();
+
 mpImpl->mpVirtDev.disposeAndClear();
 
-if ( mpImpl->mpWindow->GetCursor() == mpImpl->mpCursor )
+if ( mpImpl->mpWindow->Ge

[Libreoffice-commits] core.git: cui/source drawinglayer/source filter/source include/drawinglayer sc/source sd/qa sd/source svx/source sw/qa

2016-12-06 Thread Mark Page
 cui/source/dialogs/colorpicker.cxx   |4 +---
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx |8 
 drawinglayer/source/texture/texture3d.cxx|9 +++--
 filter/source/flash/swfwriter1.cxx   |   10 +++---
 filter/source/msfilter/svdfppt.cxx   |4 ++--
 include/drawinglayer/texture/texture3d.hxx   |5 +++--
 sc/source/filter/excel/xeescher.cxx  |4 ++--
 sd/qa/unit/import-tests.cxx  |2 +-
 sd/source/ui/dlg/vectdlg.cxx |   14 +++---
 sd/source/ui/slidesorter/view/SlsFramePainter.cxx|7 ---
 sd/source/ui/table/TableDesignPane.cxx   |4 ++--
 svx/source/dialog/dlgctrl.cxx|4 +---
 svx/source/svdraw/svdetc.cxx |8 +---
 svx/source/svdraw/svdfmtf.cxx|8 
 svx/source/svdraw/svdoashp.cxx   |8 
 svx/source/xoutdev/_xoutbmp.cxx  |8 
 svx/source/xoutdev/xattrbmp.cxx  |4 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|6 ++
 18 files changed, 50 insertions(+), 67 deletions(-)

New commits:
commit d08db164dcac8f6aa88158b2848abb5ad66a4052
Author: Mark Page <aptit...@btconnect.com>
Date:   Mon Dec 5 14:03:12 2016 +

Change Read/Write access to Scoped Read/Write access

Change-Id: Idbe8e393b64f2a151e20c1851d7c14fa161acf97
Reviewed-on: https://gerrit.libreoffice.org/31635
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/cui/source/dialogs/colorpicker.cxx 
b/cui/source/dialogs/colorpicker.cxx
index 5299989..476dffe 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -316,7 +316,7 @@ void ColorFieldControl::UpdateBitmap()
 sal_uInt8* pRGB_Vert = maRGB_Vert.data();
 sal_uInt16* pPercent_Vert = maPercent_Vert.data();
 
-BitmapWriteAccess* pWriteAccess = mpBitmap->AcquireWriteAccess();
+Bitmap::ScopedWriteAccess pWriteAccess(*mpBitmap);
 if (pWriteAccess)
 {
 BitmapColor aBitmapColor(maColor);
@@ -403,8 +403,6 @@ void ColorFieldControl::UpdateBitmap()
 }
 break;
 }
-
-Bitmap::ReleaseAccess(pWriteAccess);
 }
 }
 
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx 
b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index 6470f63..73fd8cb 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -52,8 +52,8 @@ namespace
 sal_uInt8 nInitAlpha(255);
 Bitmap aContent(aDestSize, 24);
 AlphaMask aAlpha(aDestSize, );
-BitmapWriteAccess* pContent = aContent.AcquireWriteAccess();
-BitmapWriteAccess* pAlpha = aAlpha.AcquireWriteAccess();
+Bitmap::ScopedWriteAccess pContent(aContent);
+AlphaMask::ScopedWriteAccess pAlpha(aAlpha);
 
 if (pContent && pAlpha)
 {
@@ -118,8 +118,8 @@ namespace
 }
 }
 
-aAlpha.ReleaseAccess(pAlpha);
-Bitmap::ReleaseAccess(pContent);
+pAlpha.reset();
+pContent.reset();
 
 aRetval = BitmapEx(aContent, aAlpha);
 
diff --git a/drawinglayer/source/texture/texture3d.cxx 
b/drawinglayer/source/texture/texture3d.cxx
index 4e4d19b..a1ba4cb 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -64,9 +64,7 @@ namespace drawinglayer
 const BitmapEx& rBitmapEx,
 const basegfx::B2DRange& rRange)
 :   maBitmapEx(rBitmapEx),
-mpReadBitmap(nullptr),
 maTransparence(),
-mpReadTransparence(nullptr),
 maTopLeft(rRange.getMinimum()),
 maSize(rRange.getRange()),
 mfMulX(0.0),
@@ -75,7 +73,8 @@ namespace drawinglayer
 mbIsTransparent(maBitmapEx.IsTransparent())
 {
 // #121194# Todo: use alpha channel, too (for 3d)
-mpReadBitmap = maBitmapEx.GetBitmap().AcquireReadAccess();
+maBitmap = maBitmapEx.GetBitmap();
+mpReadBitmap = Bitmap::ScopedReadAccess(maBitmap);
 OSL_ENSURE(mpReadBitmap, "GeoTexSvxBitmapEx: Got no read access to 
Bitmap (!)");
 
 if(mbIsTransparent)
@@ -90,7 +89,7 @@ namespace drawinglayer
 maTransparence = rBitmapEx.GetMask();
 }
 
-mpReadTransparence = maTransparence.AcquireReadAccess();
+mpReadTransparence = Bitmap::ScopedReadAccess(maTransparence);
 }
 
 mfMulX = (double)mpReadBitmap->Width() / maSize.getX();
@@ -109,8 +108,6 @@ namespace drawinglaye

[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer

2016-12-06 Thread Mark Page
 drawinglayer/source/animation/animationtiming.cxx|   30 ++-
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx  |6 ---
 include/drawinglayer/animation/animationtiming.hxx   |   13 +++---
 include/drawinglayer/primitive2d/animatedprimitive2d.hxx |4 +-
 4 files changed, 22 insertions(+), 31 deletions(-)

New commits:
commit 13e77648265a91ec2b7d649d30a108e4e1eff3c8
Author: Mark Page <aptit...@btconnect.com>
Date:   Mon Dec 5 12:25:30 2016 +

Use std::unique_ptr for AnimationEntry

Change-Id: Ia089be3677adadb4250003b78b7c6bc15ab8bc42
Reviewed-on: https://gerrit.libreoffice.org/31631
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/drawinglayer/source/animation/animationtiming.cxx 
b/drawinglayer/source/animation/animationtiming.cxx
index 72400c1..683c5f5 100644
--- a/drawinglayer/source/animation/animationtiming.cxx
+++ b/drawinglayer/source/animation/animationtiming.cxx
@@ -19,7 +19,7 @@
 
 #include 
 #include 
-
+#include 
 
 namespace drawinglayer
 {
@@ -46,9 +46,9 @@ namespace drawinglayer
 {
 }
 
-AnimationEntry* AnimationEntryFixed::clone() const
+std::unique_ptr AnimationEntryFixed::clone() const
 {
-return new AnimationEntryFixed(mfDuration, mfState);
+return o3tl::make_unique(mfDuration, mfState);
 }
 
 bool AnimationEntryFixed::operator==(const AnimationEntry& rCandidate) 
const
@@ -95,9 +95,9 @@ namespace drawinglayer
 {
 }
 
-AnimationEntry* AnimationEntryLinear::clone() const
+std::unique_ptr AnimationEntryLinear::clone() const
 {
-return new AnimationEntryLinear(mfDuration, mfFrequency, mfStart, 
mfStop);
+return o3tl::make_unique(mfDuration, 
mfFrequency, mfStart, mfStop);
 }
 
 bool AnimationEntryLinear::operator==(const AnimationEntry& 
rCandidate) const
@@ -178,22 +178,18 @@ namespace drawinglayer
 
 AnimationEntryList::~AnimationEntryList()
 {
-for(AnimationEntry* i : maEntries)
-{
-delete i;
-}
 }
 
-AnimationEntry* AnimationEntryList::clone() const
+std::unique_ptr AnimationEntryList::clone() const
 {
-AnimationEntryList* pNew = new AnimationEntryList();
+std::unique_ptr 
pNew(o3tl::make_unique());
 
-for(AnimationEntry* i : maEntries)
+for(const auto  : maEntries)
 {
 pNew->append(*i);
 }
 
-return pNew;
+return std::move(pNew);
 }
 
 bool AnimationEntryList::operator==(const AnimationEntry& rCandidate) 
const
@@ -277,16 +273,16 @@ namespace drawinglayer
 {
 }
 
-AnimationEntry* AnimationEntryLoop::clone() const
+std::unique_ptr AnimationEntryLoop::clone() const
 {
-AnimationEntryLoop* pNew = new AnimationEntryLoop(mnRepeat);
+std::unique_ptr 
pNew(o3tl::make_unique(mnRepeat));
 
-for(AnimationEntry* i : maEntries)
+for(const auto  : maEntries)
 {
 pNew->append(*i);
 }
 
-return pNew;
+return std::move(pNew);
 }
 
 bool AnimationEntryLoop::operator==(const AnimationEntry& rCandidate) 
const
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 713c4bd..13564af 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -33,9 +33,6 @@ namespace drawinglayer
 {
 void AnimatedSwitchPrimitive2D::setAnimationEntry(const 
animation::AnimationEntry& rNew)
 {
-// delete cloned animation description
-delete mpAnimationEntry;
-
 // clone given animation description
 mpAnimationEntry = rNew.clone();
 }
@@ -45,7 +42,6 @@ namespace drawinglayer
 const Primitive2DContainer& rChildren,
 bool bIsTextAnimation)
 :   GroupPrimitive2D(rChildren),
-mpAnimationEntry(nullptr),
 mbIsTextAnimation(bIsTextAnimation)
 {
 // clone given animation description
@@ -54,8 +50,6 @@ namespace drawinglayer
 
 AnimatedSwitchPrimitive2D::~AnimatedSwitchPrimitive2D()
 {
-// delete cloned animation description
-delete mpAnimationEntry;
 }
 
 bool AnimatedSwitchPrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
diff --git a/include/drawinglayer/animation/animationtiming.hxx 
b/include/drawinglayer/animation/animationtiming.hxx
index 4514349..67d13ee 100644
--- a/include/drawinglayer/animation/animationtiming.hxx
+++ 

[Libreoffice-commits] core.git: vcl/source

2016-12-05 Thread Mark Page
 vcl/source/filter/wmf/winmtf.cxx |8 +-
 vcl/source/gdi/bitmap.cxx|  137 +--
 vcl/source/gdi/bitmap3.cxx   |  116 +++--
 vcl/source/gdi/bitmap4.cxx   |   81 +++
 vcl/source/gdi/bitmapex.cxx  |   35 ++---
 vcl/source/gdi/dibtools.cxx  |   30 +++-
 vcl/source/gdi/impvect.cxx   |   13 +--
 vcl/source/gdi/print2.cxx|4 -
 8 files changed, 193 insertions(+), 231 deletions(-)

New commits:
commit 7006568138b5b2d2c11dd558049cd4085c449c9e
Author: Mark Page <aptit...@btconnect.com>
Date:   Mon Dec 5 09:59:25 2016 +

Change Read/Write access to Scoped Read/Write access

Change-Id: I2259af0d169f850ceb39f22424197912dfd20171
Reviewed-on: https://gerrit.libreoffice.org/31624
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 1c66a1b..43f23ec 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -1552,8 +1552,8 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, 
const Size& rSize, const B
 // need to blend in AlphaMask quality (8Bit)
 AlphaMask fromVDev(aVDevMask);
 AlphaMask fromBmpEx(aBmpEx.GetAlpha());
-BitmapReadAccess* pR = fromVDev.AcquireReadAccess();
-BitmapWriteAccess* pW = fromBmpEx.AcquireWriteAccess();
+AlphaMask::ScopedReadAccess pR(fromVDev);
+AlphaMask::ScopedWriteAccess pW(fromBmpEx);
 
 if(pR && pW)
 {
@@ -1574,8 +1574,8 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, 
const Size& rSize, const B
 }
 }
 
-fromVDev.ReleaseAccess(pR);
-fromBmpEx.ReleaseAccess(pW);
+pR.reset();
+pW.reset();
 aBmpEx = BitmapEx(aBmpEx.GetBitmap(), fromBmpEx);
 }
 else
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index f5ce798..ec382f2 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -267,12 +267,11 @@ bool Bitmap::HasGreyPalette() const
 const sal_uInt16nBitCount = GetBitCount();
 boolbRet = nBitCount == 1;
 
-BitmapInfoAccess* pIAcc = const_cast<Bitmap*>(this)->AcquireInfoAccess();
+ScopedInfoAccess pIAcc(const_cast<Bitmap&>(*this));
 
 if( pIAcc )
 {
 bRet = pIAcc->HasPalette() && pIAcc->GetPalette().IsGreyPalette();
-ReleaseAccess( pIAcc );
 }
 
 return bRet;
@@ -452,7 +451,7 @@ bool Bitmap::Erase(const Color& rFillColor)
 
 bool Bitmap::Invert()
 {
-BitmapWriteAccess*  pAcc = AcquireWriteAccess();
+ScopedWriteAccess   pAcc(*this);
 boolbRet = false;
 
 if( pAcc )
@@ -478,7 +477,7 @@ bool Bitmap::Invert()
 }
 
 mxImpBmp->ImplInvalidateChecksum();
-ReleaseAccess( pAcc );
+pAcc.reset();
 bRet = true;
 }
 
@@ -493,7 +492,7 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
 
 if( bHorz && !bVert )
 {
-BitmapWriteAccess*  pAcc = AcquireWriteAccess();
+ScopedWriteAccess   pAcc(*this);
 
 if( pAcc )
 {
@@ -513,13 +512,13 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
 }
 }
 
-ReleaseAccess( pAcc );
+pAcc.reset();
 bRet = true;
 }
 }
 else if( bVert && !bHorz )
 {
-BitmapWriteAccess*  pAcc = AcquireWriteAccess();
+ScopedWriteAccess   pAcc(*this);
 
 if( pAcc )
 {
@@ -536,13 +535,13 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
 memcpy( pAcc->GetScanline( nOther ), pBuffer.get(), nScanSize 
);
 }
 
-ReleaseAccess( pAcc );
+pAcc.reset();
 bRet = true;
 }
 }
 else if( bHorz && bVert )
 {
-BitmapWriteAccess*  pAcc = AcquireWriteAccess();
+ScopedWriteAccess   pAcc(*this);
 
 if( pAcc )
 {
@@ -573,7 +572,7 @@ bool Bitmap::Mirror( BmpMirrorFlags nMirrorFlags )
 }
 }
 
-ReleaseAccess( pAcc );
+pAcc.reset();
 bRet = true;
 }
 }
@@ -596,7 +595,7 @@ bool Bitmap::Rotate( long nAngle10, const Color& rFillColor 
)
 bRet = Mirror( BmpMirrorFlags::Horizontal | BmpMirrorFlags::Vertical );
 else
 {
-BitmapReadAccess*   pReadAcc = AcquireReadAccess();
+ScopedReadAccesspReadAcc(*this);
 Bitmap  aRotatedBmp;
 
 if( pReadAcc )
@@ -607,7 +606,7 @@ bool Bitmap::Rotate( long nAngle10, const Color&a

[Libreoffice-commits] core.git: vcl/source

2016-12-04 Thread Mark Page
 vcl/source/filter/igif/gifread.cxx|   30 
 vcl/source/filter/ixbm/xbmread.cxx|   11 ++--
 vcl/source/filter/ixpm/xpmread.cxx|   42 +++---
 vcl/source/filter/jpeg/JpegWriter.cxx |6 +---
 vcl/source/filter/jpeg/JpegWriter.hxx |2 -
 vcl/source/filter/wmf/winwmf.cxx  |   10 +++-
 vcl/source/gdi/alpha.cxx  |   13 ++
 vcl/source/gdi/pdfwriter_impl.cxx |8 +++---
 vcl/source/gdi/pngwrite.cxx   |   18 +-
 9 files changed, 48 insertions(+), 92 deletions(-)

New commits:
commit a8b986572c288860f2076a50cdeadb1ee4aecd6d
Author: Mark Page <aptit...@btconnect.com>
Date:   Fri Dec 2 12:53:47 2016 +

Change Read/Write access to Scoped Read/Write access

Change-Id: I4834d057e1997710f5ac9691d6c3eecb24e26881
Reviewed-on: https://gerrit.libreoffice.org/31550
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index 1bfae2f..3c98628 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -58,8 +58,8 @@ class GIFReader : public GraphicReader
 SvStream&   rIStm;
 std::vector aSrcBuf;
 std::unique_ptr pDecomp;
-BitmapWriteAccess*  pAcc8;
-BitmapWriteAccess*  pAcc1;
+Bitmap::ScopedWriteAccess pAcc8;
+Bitmap::ScopedWriteAccess pAcc1;
 longnYAcc;
 longnLastPos;
 sal_uInt32  nLogWidth100;
@@ -113,8 +113,6 @@ GIFReader::GIFReader( SvStream& rStm )
 : aGPalette ( 256 )
 , aLPalette ( 256 )
 , rIStm ( rStm )
-, pAcc8 ( nullptr )
-, pAcc1 ( nullptr )
 , nYAcc ( 0 )
 , nLastPos ( rStm.Tell() )
 , nLogWidth100 ( 0UL )
@@ -150,12 +148,6 @@ GIFReader::GIFReader( SvStream& rStm )
 GIFReader::~GIFReader()
 {
 aImGraphic.SetContext( nullptr );
-
-if( pAcc1 )
-Bitmap::ReleaseAccess( pAcc1 );
-
-if( pAcc8 )
-Bitmap::ReleaseAccess( pAcc8 );
 }
 
 void GIFReader::ClearImageExtensions()
@@ -193,7 +185,7 @@ void GIFReader::CreateBitmaps( long nWidth, long nHeight, 
BitmapPalette* pPal,
 if( !aAnimation.Count() )
 aBmp1.Erase( aWhite );
 
-pAcc1 = aBmp1.AcquireWriteAccess();
+pAcc1 = Bitmap::ScopedWriteAccess(aBmp1);
 
 if( pAcc1 )
 {
@@ -213,7 +205,7 @@ void GIFReader::CreateBitmaps( long nWidth, long nHeight, 
BitmapPalette* pPal,
 else
   aBmp8.Erase( Color( COL_WHITE ) );
 
-pAcc8 = aBmp8.AcquireWriteAccess();
+pAcc8 = Bitmap::ScopedWriteAccess(aBmp8);
 bStatus = ( pAcc8 != nullptr );
 }
 }
@@ -623,13 +615,11 @@ void GIFReader::CreateNewBitmaps()
 {
 AnimationBitmap aAnimBmp;
 
-Bitmap::ReleaseAccess( pAcc8 );
-pAcc8 = nullptr;
+pAcc8.reset();
 
 if( bGCTransparent )
 {
-Bitmap::ReleaseAccess( pAcc1 );
-pAcc1 = nullptr;
+pAcc1.reset();
 aAnimBmp.aBmpEx = BitmapEx( aBmp8, aBmp1 );
 }
 else
@@ -664,20 +654,20 @@ const Graphic& GIFReader::GetIntermediateGraphic()
 {
 Bitmap  aBmp;
 
-Bitmap::ReleaseAccess( pAcc8 );
+pAcc8.reset();
 
 if ( bGCTransparent )
 {
-Bitmap::ReleaseAccess( pAcc1 );
+pAcc1.reset();
 aImGraphic = BitmapEx( aBmp8, aBmp1 );
 
-pAcc1 = aBmp1.AcquireWriteAccess();
+pAcc1 = Bitmap::ScopedWriteAccess(aBmp1);
 bStatus = bStatus && ( pAcc1 != nullptr );
 }
 else
 aImGraphic = aBmp8;
 
-pAcc8 = aBmp8.AcquireWriteAccess();
+pAcc8 = Bitmap::ScopedWriteAccess(aBmp8);
 bStatus = bStatus && ( pAcc8 != nullptr );
 }
 
diff --git a/vcl/source/filter/ixbm/xbmread.cxx 
b/vcl/source/filter/ixbm/xbmread.cxx
index 5b0741f..1c29a1f 100644
--- a/vcl/source/filter/ixbm/xbmread.cxx
+++ b/vcl/source/filter/ixbm/xbmread.cxx
@@ -38,7 +38,7 @@ class XBMReader : public GraphicReader
 {
 SvStream&   rIStm;
 Bitmap  aBmp1;
-BitmapWriteAccess*  pAcc1;
+Bitmap::ScopedWriteAccess pAcc1;
 short*  pHexTable;
 BitmapColor aWhite;
 BitmapColor aBlack;
@@ -62,7 +62,6 @@ public:
 
 XBMReader::XBMReader( SvStream& rStm ) :
 rIStm   ( rStm ),
-pAcc1   ( nullptr ),
 nLastPos( rStm.Tell() ),
 nWidth  ( 0 ),
 nHeight ( 0 ),
@@ -76,9 +75,6 @@ XBMReader::XBMReader( SvStream& rStm ) :
 XBMReader::~XBMReader()
 {
 delete[] pHexTable;
-
-if( pAcc1 )
-Bitmap::ReleaseAccess( pAcc1 );
 }
 
 void XBMReader::InitTable()
@@ -332,7 +328,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGr

[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source

2016-12-02 Thread Mark Page
 include/vcl/scopedbitmapaccess.hxx   |   40 +++
 vcl/inc/canvasbitmap.hxx |4 +-
 vcl/source/bitmap/BitmapProcessor.cxx|   25 
 vcl/source/bitmap/BitmapScaleConvolution.cxx |   14 +++--
 vcl/source/helper/canvasbitmap.cxx   |9 +-
 vcl/source/outdev/bitmap.cxx |   34 ++
 vcl/source/outdev/text.cxx   |4 +-
 vcl/source/outdev/transparent.cxx|8 ++---
 8 files changed, 78 insertions(+), 60 deletions(-)

New commits:
commit 677246466c471fbe3522c35be3639afa008a46c0
Author: Mark Page <aptit...@btconnect.com>
Date:   Thu Dec 1 13:53:30 2016 +

Extend ScopedBitmapAccess and modify various classes to use it

Exception safety, ensure the Access classes are always destroyed.

Change-Id: I4889358476267853ffbd7fafc24950d84b4e9331
Reviewed-on: https://gerrit.libreoffice.org/31494
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/scopedbitmapaccess.hxx 
b/include/vcl/scopedbitmapaccess.hxx
index bb5c8bf..2994136 100644
--- a/include/vcl/scopedbitmapaccess.hxx
+++ b/include/vcl/scopedbitmapaccess.hxx
@@ -51,20 +51,50 @@ template < class Access, class Bitmap, Access* (Bitmap::* 
Acquire)() > class Sco
 public:
 explicit ScopedBitmapAccess( Bitmap& rBitmap ) :
 mpAccess( nullptr ),
-mrBitmap( rBitmap )
+mpBitmap(  )
 {
-mpAccess = (mrBitmap.*Acquire)();
+mpAccess = (mpBitmap->*Acquire)();
 }
 
 ScopedBitmapAccess( Access* pAccess, Bitmap& rBitmap ) :
 mpAccess( pAccess ),
-mrBitmap( rBitmap )
+mpBitmap(  )
 {
 }
 
+ScopedBitmapAccess( ) :
+mpAccess( nullptr ),
+mpBitmap( nullptr )
+{
+}
+
+// Move semantics
+ScopedBitmapAccess =(ScopedBitmapAccess&)
+{
+mpAccess=other.mpAccess;
+mpBitmap=other.mpBitmap;
+other.mpAccess = nullptr;
+other.mpBitmap = nullptr;
+return *this;
+ }
+
+// Disable copy from lvalue.
+ScopedBitmapAccess(const ScopedBitmapAccess&) = delete;
+ScopedBitmapAccess =(const ScopedBitmapAccess&) = delete;
+
 ~ScopedBitmapAccess()
 {
-mrBitmap.ReleaseAccess( mpAccess );
+if (mpAccess)
+   mpBitmap->ReleaseAccess( mpAccess );
+}
+
+void reset()
+{
+if (mpAccess)
+{
+   mpBitmap->ReleaseAccess( mpAccess );
+   mpAccess = nullptr;
+}
 }
 
 bool operator!() const { return !mpAccess; }
@@ -84,7 +114,7 @@ public:
 
 private:
 Access* mpAccess;
-Bitmap& mrBitmap;
+Bitmap* mpBitmap;
 };
 
 }
diff --git a/vcl/inc/canvasbitmap.hxx b/vcl/inc/canvasbitmap.hxx
index 292c432..0b5dba9 100644
--- a/vcl/inc/canvasbitmap.hxx
+++ b/vcl/inc/canvasbitmap.hxx
@@ -42,8 +42,8 @@ namespace unotools
 BitmapEx   m_aBmpEx;
 ::Bitmap   m_aBitmap;
 ::Bitmap   m_aAlpha;
-BitmapReadAccess*  m_pBmpAcc;
-BitmapReadAccess*  m_pAlphaAcc;
+Bitmap::ScopedReadAccess   m_pBmpAcc;
+Bitmap::ScopedReadAccess   m_pAlphaAcc;
 css::uno::Sequence   m_aComponentTags;
 css::uno::Sequence  m_aComponentBitCounts;
 css::rendering::IntegerBitmapLayoutm_aLayout;
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx 
b/vcl/source/bitmap/BitmapProcessor.cxx
index 91b46bc..b3cdf86 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -19,8 +19,8 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& 
rBitmapEx)
 Bitmap aBitmap(rBitmapEx.GetBitmap());
 Bitmap aDarkBitmap(aSize, 24);
 
-BitmapReadAccess* pRead(aBitmap.AcquireReadAccess());
-BitmapWriteAccess* pWrite(aDarkBitmap.AcquireWriteAccess());
+Bitmap::ScopedReadAccess pRead(aBitmap);
+Bitmap::ScopedWriteAccess pWrite(aDarkBitmap);
 
 if (pRead && pWrite)
 {
@@ -49,8 +49,8 @@ BitmapEx BitmapProcessor::createLightImage(const BitmapEx& 
rBitmapEx)
 }
 }
 }
-Bitmap::ReleaseAccess(pWrite);
-Bitmap::ReleaseAccess(pRead);
+pWrite.reset();
+pRead.reset();
 
 return BitmapEx(aDarkBitmap, rBitmapEx.GetAlpha());
 }
@@ -70,17 +70,17 @@ BitmapEx BitmapProcessor::createDisabledImage(const 
BitmapEx& rBitmapEx)
 AlphaMask aGreyAlpha(aSize);
 
 Bitmap aBitmap(rBitmapEx.GetBitmap());
-BitmapReadAccess* pRead(aBitmap.AcquireReadAccess());
+Bitmap::ScopedReadAccess pRead(aBitmap);
 
-BitmapWrite

[Libreoffice-commits] core.git: vcl/source

2016-11-30 Thread Mark Page
 vcl/source/gdi/pdfwriter_impl.cxx |   13 +
 vcl/source/gdi/pdfwriter_impl.hxx |4 ++--
 vcl/source/gdi/pngread.cxx|   26 +++---
 3 files changed, 18 insertions(+), 25 deletions(-)

New commits:
commit 64e6e7c6e7b881bf240de82ef020b290036e7e0e
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Nov 30 14:10:30 2016 +

Use smart pointers for gdi pdf functions

Change-Id: Ia78adfbd0d07449e12a7e0d02acf8a1a1108437c
Reviewed-on: https://gerrit.libreoffice.org/31421
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Michael Stahl <mst...@redhat.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 919a514..db27d50 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1722,8 +1723,6 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 
nWidth, sal_Int32 nY, sal
 m_aContext(rContext),
 m_aFile(m_aContext.URL),
 m_bOpen(false),
-m_pCodec( nullptr ),
-m_pMemStream(nullptr),
 m_aDocDigest( rtl_digest_createMD5() ),
 m_aCipher( nullptr ),
 m_aDigest( nullptr ),
@@ -2139,8 +2138,8 @@ void PDFWriterImpl::beginCompression()
 {
 if (!g_bDebugDisableCompression)
 {
-m_pCodec = new ZCodec( 0x4000, 0x4000 );
-m_pMemStream = new SvMemoryStream();
+m_pCodec = o3tl::make_unique( 0x4000, 0x4000 );
+m_pMemStream = o3tl::make_unique();
 m_pCodec->BeginCompression();
 }
 }
@@ -2150,13 +2149,11 @@ void PDFWriterImpl::endCompression()
 if (!g_bDebugDisableCompression && m_pCodec)
 {
 m_pCodec->EndCompression();
-delete m_pCodec;
-m_pCodec = nullptr;
+m_pCodec.reset();
 sal_uInt64 nLen = m_pMemStream->Tell();
 m_pMemStream->Seek( 0 );
 writeBuffer( m_pMemStream->GetData(), nLen );
-delete m_pMemStream;
-m_pMemStream = nullptr;
+m_pMemStream.reset();
 }
 }
 
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 9abe5b5..5a30cf2 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -713,8 +713,8 @@ private:
 std::list< GraphicsState >  m_aGraphicsStack;
 GraphicsState   m_aCurrentPDFState;
 
-ZCodec* m_pCodec;
-SvMemoryStream* m_pMemStream;
+std::unique_ptr m_pCodec;
+std::unique_ptr m_pMemStream;
 
 std::vector< PDFAddStream > m_aAdditionalStreams;
 std::set< PDFWriter::ErrorCode >m_aErrors;
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index c26a841..f7ea29e 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace vcl
 {
@@ -74,11 +75,12 @@ private:
 std::vector::iterator maChunkIter;
 std::vector::iterator maDataIter;
 
-Bitmap* mpBmp;
-BitmapWriteAccess*  mpAcc;
-Bitmap* mpMaskBmp;
-AlphaMask*  mpAlphaMask;
-BitmapWriteAccess*  mpMaskAcc;
+std::unique_ptrmpBmp;
+BitmapWriteAccess* mpAcc;
+std::unique_ptrmpMaskBmp;
+std::unique_ptr mpAlphaMask;
+BitmapWriteAccess* mpMaskAcc;
+
 ZCodec  mpZCodec;
 sal_uInt8*  mpInflateInBuf; // as big as the size of a scanline + 
alphachannel + 1
 sal_uInt8*  mpScanPrior;// pointer to the latest scanline
@@ -165,10 +167,7 @@ public:
 
 PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
 :   mrPNGStream( rPNGStream ),
-mpBmp   ( nullptr ),
 mpAcc   ( nullptr ),
-mpMaskBmp   ( nullptr ),
-mpAlphaMask ( nullptr ),
 mpMaskAcc   ( nullptr ),
 mpInflateInBuf  ( nullptr ),
 mpScanPrior ( nullptr ),
@@ -246,9 +245,6 @@ PNGReaderImpl::~PNGReaderImpl()
 if( mpColorTable != mpDefaultColorTable )
 delete[] mpColorTable;
 
-delete mpBmp;
-delete mpAlphaMask;
-delete mpMaskBmp;
 delete[] mpTransTab;
 delete[] mpInflateInBuf;
 delete[] mpScanPrior;
@@ -665,14 +661,14 @@ bool PNGReaderImpl::ImplReadHeader( const Size& 
rPreviewSizeHint )
 if ( !mpInflateInBuf || !mpScanPrior )
 return false;
 
-mpBmp = new Bitmap( maTargetSize, mnTargetDepth );
+mpBmp = o3tl::make_unique( maTargetSize, mnTargetDepth );
 mpAcc = mpBmp->AcquireWriteAccess();
 if( !mpAcc )
 return false;
 
 if ( mbAlphaChannel )
 {
-mpAlphaMask = new AlphaMask( maTargetSize );
+mpAlphaMask = o3tl::make_unique( maTargetSize );
 mpAlphaMask->Erase( 128 );
  

[Libreoffice-commits] core.git: vcl/source

2016-11-30 Thread Mark Page
 vcl/source/filter/igif/gifread.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 0de5101df0a8db41ad067b2575d16fd9b5a9a751
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Nov 30 10:22:47 2016 +

When overreading gif sub blocks, do not read skipped bytes

We do not require to read in gif extension data when it is ignored
This is used to skip the Adobe XMP gif extension

Change-Id: Id64f373a4eae764227c0b7ac6687697666991ec7
Reviewed-on: https://gerrit.libreoffice.org/31410
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Michael Stahl <mst...@redhat.com>

diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index 7588970..1bfae2f 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -307,7 +307,6 @@ bool GIFReader::ReadExtension()
 sal_uInt8 cSize(0);
 // Block length
 rIStm.ReadUChar( cSize );
-
 switch( cFunction )
 {
 // 'Graphic Control Extension'
@@ -412,13 +411,14 @@ bool GIFReader::ReadExtension()
 const sal_uInt64 nMaxPossible = rIStm.remainingSize();
 if (nCount > nMaxPossible)
 nCount = nMaxPossible;
-std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nCount]);
+
+if (nCount)
+rIStm.SeekRel( nCount - 1 );// Skip subblock data
 
 bRet = false;
-std::size_t nRead = rIStm.ReadBytes(pBuffer.get(), nCount);
-if (NO_PENDING(rIStm) && cSize < nRead)
+std::size_t nRead = rIStm.ReadBytes(, 1);
+if (NO_PENDING(rIStm) && nRead == 1)
 {
-cSize = pBuffer[cSize];
 bRet = true;
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/source

2016-11-30 Thread Mark Page
 vcl/source/filter/igif/gifread.cxx |   20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 5de4492eeedc1e23f5f6ac4a775e943c240dced2
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Nov 30 09:27:13 2016 +

Use smart pointers for allocated objects in the gif loader

Change-Id: Ib9d3bc05fbccc882df8913d3ffcb36be6a9f06dd
Reviewed-on: https://gerrit.libreoffice.org/31401
Reviewed-by: Michael Stahl <mst...@redhat.com>
Tested-by: Michael Stahl <mst...@redhat.com>

diff --git a/vcl/source/filter/igif/gifread.cxx 
b/vcl/source/filter/igif/gifread.cxx
index f767f3b..7588970 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -20,6 +20,7 @@
 #include "decode.hxx"
 #include "gifread.hxx"
 #include 
+#include 
 
 #define NO_PENDING( rStm ) ( ( rStm ).GetError() != ERRCODE_IO_PENDING )
 
@@ -55,8 +56,8 @@ class GIFReader : public GraphicReader
 BitmapPalette   aGPalette;
 BitmapPalette   aLPalette;
 SvStream&   rIStm;
-sal_uInt8*  pSrcBuf;
-GIFLZWDecompressor* pDecomp;
+std::vector aSrcBuf;
+std::unique_ptr pDecomp;
 BitmapWriteAccess*  pAcc8;
 BitmapWriteAccess*  pAcc1;
 longnYAcc;
@@ -112,7 +113,6 @@ GIFReader::GIFReader( SvStream& rStm )
 : aGPalette ( 256 )
 , aLPalette ( 256 )
 , rIStm ( rStm )
-, pDecomp ( nullptr )
 , pAcc8 ( nullptr )
 , pAcc1 ( nullptr )
 , nYAcc ( 0 )
@@ -143,7 +143,7 @@ GIFReader::GIFReader( SvStream& rStm )
 , cNonTransIndex1 ( 0 )
 {
 maUpperName = "SVIGIF";
-pSrcBuf = new sal_uInt8[ 256 ];
+aSrcBuf.resize(256);// Memory buffer for ReadNextBlock
 ClearImageExtensions();
 }
 
@@ -156,8 +156,6 @@ GIFReader::~GIFReader()
 
 if( pAcc8 )
 Bitmap::ReleaseAccess( pAcc8 );
-
-delete[] pSrcBuf;
 }
 
 void GIFReader::ClearImageExtensions()
@@ -493,7 +491,7 @@ sal_uLong GIFReader::ReadNextBlock()
 nRet = 2UL;
 else
 {
-rIStm.ReadBytes( pSrcBuf, cBlockSize );
+rIStm.ReadBytes( aSrcBuf.data(), cBlockSize );
 
 if( NO_PENDING( rIStm ) )
 {
@@ -502,7 +500,7 @@ sal_uLong GIFReader::ReadNextBlock()
 else
 {
 bool   bEOI;
-sal_uInt8* pTarget = pDecomp->DecompressBlock( pSrcBuf, 
cBlockSize, nRead, bEOI );
+sal_uInt8* pTarget = pDecomp->DecompressBlock( 
aSrcBuf.data(), cBlockSize, nRead, bEOI );
 
 nRet = ( bEOI ? 3 : 1 );
 
@@ -771,7 +769,7 @@ bool GIFReader::ProcessGIF()
 else if( NO_PENDING( rIStm ) )
 {
 bRead = true;
-pDecomp = new GIFLZWDecompressor( cDataSize );
+pDecomp = o3tl::make_unique( cDataSize );
 eActAction = NEXT_BLOCK_READING;
 bOverreadBlock = false;
 }
@@ -802,7 +800,7 @@ bool GIFReader::ProcessGIF()
 {
 if( nRet == 2UL )
 {
-delete pDecomp;
+pDecomp.reset();
 CreateNewBitmaps();
 eActAction = MARKER_READING;
 ClearImageExtensions();
@@ -814,7 +812,7 @@ bool GIFReader::ProcessGIF()
 }
 else
 {
-delete pDecomp;
+pDecomp.reset();
 CreateNewBitmaps();
 eActAction = ABORT_READING;
 ClearImageExtensions();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: vcl/source

2016-11-25 Thread Mark Page
 vcl/source/filter/graphicfilter.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit ca48cb1dfa212128e0987897a69edc1980ebca90
Author: Mark Page <aptit...@btconnect.com>
Date:   Fri Nov 25 10:50:33 2016 +

Modify pFilterConfigItem to a smart pointer

Change-Id: Ie964f064f4f5d3735878c2a6b4f6d4b801a8e8e9
Reviewed-on: https://gerrit.libreoffice.org/31195
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index 84cd26f..1a77aae 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -1337,7 +1338,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& 
rGraphic, const OUString& rPat
 GfxLinkTypeeLinkType = GfxLinkType::NONE;
 bool   bDummyContext = rGraphic.IsDummyContext();
 const bool bLinkSet = rGraphic.IsLink();
-FilterConfigItem*  pFilterConfigItem = nullptr;
+std::unique_ptr pFilterConfigItem;
 
 SizeaPreviewSizeHint( 0, 0 );
 boolbAllowPartialStreamRead = false;
@@ -1726,13 +1727,13 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& 
rGraphic, const OUString& rPat
 if( nFormat != GRFILTER_FORMAT_DONTKNOW )
 {
 aShortName = GetImportFormatShortName( nFormat 
).toAsciiUpperCase();
-if ( ( pFilterConfigItem == nullptr ) && aShortName == 
"PCD" )
+if ( ( !pFilterConfigItem ) && aShortName == "PCD" )
 {
 OUString aFilterConfigPath( 
"Office.Common/Filter/Graphic/Import/PCD" );
-pFilterConfigItem = new FilterConfigItem( 
aFilterConfigPath );
+pFilterConfigItem = 
o3tl::make_unique( aFilterConfigPath );
 }
 }
-if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem ) )
+if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem.get() ) )
 nStatus = GRFILTER_FORMATERROR;
 else
 {
@@ -1790,7 +1791,6 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& 
rGraphic, const OUString& rPat
 rGraphic.Clear();
 }
 
-delete pFilterConfigItem;
 return nStatus;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/sfx2 sfx2/source

2016-07-13 Thread Mark Page
 include/sfx2/objface.hxx|   10 --
 sfx2/source/control/msgpool.cxx |8 
 2 files changed, 4 insertions(+), 14 deletions(-)

New commits:
commit 9641e51cd71d537313f9b238a0bab73701128b3b
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Jul 13 13:21:03 2016 +0100

Remove SfxInterface::operator[]

This operator can be confusing when reading the SfxSlotPool source
Also this operator could return nullptr that SfxSlotPool doesn't
check or require.

Change-Id: I8d6009ea1b1f18e7022f1e7065c27f31feb02a6a
Reviewed-on: https://gerrit.libreoffice.org/27185
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Caolán McNamara <caol...@redhat.com>
Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/sfx2/objface.hxx b/include/sfx2/objface.hxx
index 0ec0938..babbc9f 100644
--- a/include/sfx2/objface.hxx
+++ b/include/sfx2/objface.hxx
@@ -43,8 +43,6 @@ friend class SfxSlotPool;
 boolbSuperClass;// Whether children inherit its 
toolbars etc
 std::unique_ptr  pImplData;
 
-SfxSlot*operator[]( sal_uInt16 nPos ) const;
-
 public:
 SfxInterface( const char *pClass,
   bool bSuperClass,
@@ -97,14 +95,6 @@ inline sal_uInt16 SfxInterface::Count() const
 return nCount;
 }
 
-
-// returns a function by position in the array
-
-inline SfxSlot* SfxInterface::operator[]( sal_uInt16 nPos ) const
-{
-return nPos < nCount? pSlots+nPos: nullptr;
-}
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx
index ab832d6..1f9dec0 100644
--- a/sfx2/source/control/msgpool.cxx
+++ b/sfx2/source/control/msgpool.cxx
@@ -60,7 +60,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface 
)
 
 // Stop at a (single) Null-slot (for syntactic reasons the interfaces
 // always contain at least one slot)
-if ( rInterface.Count() != 0 && !rInterface[0]->nSlotId )
+if ( rInterface.Count() != 0 && !rInterface.pSlots[0].nSlotId )
 return;
 
 // possibly add Interface-id and group-ids of funcs to the list of groups
@@ -77,7 +77,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface 
)
 
 for ( size_t nFunc = 0; nFunc < rInterface.Count(); ++nFunc )
 {
-SfxSlot *pDef = rInterface[nFunc];
+SfxSlot *pDef = [nFunc];
 if ( pDef->GetGroupId() && /* pDef->GetGroupId() != GID_INTERN && */
  _pGroups->find(pDef->GetGroupId()) == SfxSlotGroupArr_Impl::npos )
 {
@@ -216,7 +216,7 @@ const SfxSlot* SfxSlotPool::SeekSlot( sal_uInt16 
nStartInterface )
   _nCurMsg < pInterface->Count();
   ++_nCurMsg )
 {
-const SfxSlot* pMsg = (*pInterface)[_nCurMsg];
+const SfxSlot* pMsg = >pSlots[_nCurMsg];
 if ( pMsg->GetGroupId() == _pGroups->at(_nCurGroup) )
 return pMsg;
 }
@@ -261,7 +261,7 @@ const SfxSlot* SfxSlotPool::NextSlot()
 SfxInterface* pInterface = (*_pInterfaces)[nInterface];
 while ( ++_nCurMsg < pInterface->Count() )
 {
-SfxSlot* pMsg = (*pInterface)[_nCurMsg];
+SfxSlot* pMsg = >pSlots[_nCurMsg];
 if ( pMsg->GetGroupId() == _pGroups->at(_nCurGroup) )
 return pMsg;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: basctl/source cui/source include/sfx2 include/tools sc/inc sc/source sd/inc sd/qa sd/source sfx2/source starmath/inc starmath/source sw/CppunitTest_sw_htmlexport.mk sw/

2016-07-13 Thread Mark Page
 basctl/source/basicide/basicmod.hxx|3 -
 basctl/source/basicide/iderdll.cxx |   12 +---
 cui/source/options/treeopt.cxx |9 +--
 cui/source/tabpages/autocdlg.cxx   |3 -
 include/sfx2/app.hxx   |   13 
 include/sfx2/module.hxx|2 
 include/tools/shl.hxx  |   87 -
 sc/inc/scmod.hxx   |3 -
 sc/source/ui/app/scdll.cxx |9 +--
 sd/inc/sddll.hxx   |6 +-
 sd/inc/sdmod.hxx   |3 -
 sd/qa/unit/misc-tests.cxx  |1 
 sd/source/core/drawdoc4.cxx|1 
 sd/source/ui/app/sddll.cxx |   31 +++
 sd/source/ui/app/sdmod.cxx |5 -
 sfx2/source/appl/app.cxx   |   17 ++
 sfx2/source/appl/module.cxx|   40 ---
 sfx2/source/inc/appdata.hxx|4 +
 starmath/inc/smmod.hxx |3 -
 starmath/source/smdll.cxx  |   17 ++
 sw/CppunitTest_sw_htmlexport.mk|1 
 sw/inc/swmodule.hxx|3 -
 sw/qa/extras/htmlexport/htmlexport.cxx |1 
 sw/source/uibase/app/swdll.cxx |   11 +---
 tools/Library_tl.mk|1 
 tools/source/misc/toolsdll.cxx |   33 
 26 files changed, 76 insertions(+), 243 deletions(-)

New commits:
commit f7b1cd66167050afecf487e3d89ea12de74200b5
Author: Mark Page <aptit...@btconnect.com>
Date:   Mon Jul 4 17:30:42 2016 +0100

Moved SfxModule owner to SfxApplication

::GetAppData replaced with SfxApplication::GetModule
that now returns SfxModule*

SfxModule no longer registers self for ownership
instead it is now registered using SfxApplication::SetModule

Change-Id: Ifbbe1b2b4c5122da8e643b7926d47878d116c6c8
Reviewed-on: https://gerrit.libreoffice.org/26914
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/basctl/source/basicide/basicmod.hxx 
b/basctl/source/basicide/basicmod.hxx
index 3bed4f2..ffc960c 100644
--- a/basctl/source/basicide/basicmod.hxx
+++ b/basctl/source/basicide/basicmod.hxx
@@ -28,13 +28,10 @@ namespace basctl
 
 class Module : public SfxModule
 {
-static Module* mpModule;
 public:
 Module ( ResMgr *pMgr, SfxObjectFactory *pObjFact) :
 SfxModule( pMgr, {pObjFact} )
 { }
-public:
-static Module*& Get () { return mpModule; }
 };
 
 } // namespace basctl
diff --git a/basctl/source/basicide/iderdll.cxx 
b/basctl/source/basicide/iderdll.cxx
index 19d5961..2ea8a29 100644
--- a/basctl/source/basicide/iderdll.cxx
+++ b/basctl/source/basicide/iderdll.cxx
@@ -32,7 +32,7 @@
 #include 
 #include 
 #include 
-
+#include 
 
 namespace basctl
 {
@@ -40,8 +40,6 @@ namespace basctl
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
-Module* Module::mpModule = nullptr;
-
 namespace
 {
 
@@ -106,7 +104,7 @@ ExtraData* GetExtraData()
 
 
 IDEResId::IDEResId( sal_uInt16 nId ):
-ResId(nId, *Module::Get()->GetResMgr())
+ResId(nId, *SfxApplication::GetModule(SfxToolsModule::Basic)->GetResMgr())
 { }
 
 namespace
@@ -121,12 +119,12 @@ Dll::Dll () :
 ResMgr* pMgr = ResMgr::CreateResMgr(
 "basctl", Application::GetSettings().GetUILanguageTag());
 
-Module::Get() = new Module( pMgr, ::Factory() );
+auto pModule = o3tl::make_unique( pMgr, ::Factory() );
+SfxModule* pMod = pModule.get();
+SfxApplication::SetModule(SfxToolsModule::Basic, std::move(pModule));
 
 GetExtraData(); // to cause GlobalErrorHdl to be set
 
-SfxModule* pMod = Module::Get();
-
 SfxObjectFactory& rFactory = DocShell::Factory();
 rFactory.SetDocumentServiceName( "com.sun.star.script.BasicIDE" );
 
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 3b3e52c..d61a661 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -89,7 +89,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1586,7 +1585,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< 
XFrame >& _xFrame )
 || aFactory == "com.sun.star.text.WebDocument"
 || aFactory == "com.sun.star.text.GlobalDocument" )
 {
-SfxModule* pSwMod = 
*reinterpret_cast<SfxModule**>(GetAppData(SHL_WRITER));
+SfxModule* pSwMod = 
SfxApplication::GetModule(SfxToolsModule::Writer);
 if ( !lcl_isOptionHidden( SID_SW_EDITOPTIONS, aOptionsDlgOpt ) )
 {
 if ( aFactory == "com.sun.star.text.WebDocument" )
@@ -1635,7 +1634,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< 
XFrame >& _xFrame )
 if ( !lcl_isOptionHidden( SID_SC_EDITOPTIONS, aOptionsDlgOpt ) )
 {
 

[Libreoffice-commits] core.git: vcl/inc vcl/source

2016-07-04 Thread Mark Page
 vcl/inc/impgraph.hxx|   26 +-
 vcl/source/gdi/impgraph.cxx |   33 -
 2 files changed, 21 insertions(+), 38 deletions(-)

New commits:
commit e9c3eccdb1ebf77d09dd7ad47b0708e1cb44417d
Author: Mark Page <aptit...@btconnect.com>
Date:   Mon Jul 4 09:48:50 2016 +0100

Modify the ImpGraphic class, mpGfxLink to use an unique pointer

Change-Id: I74eb2347970ef19f7a215b86bfeae9945c07dbea
Reviewed-on: https://gerrit.libreoffice.org/26889
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index e5ba1e9..bb67c66 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -37,20 +37,20 @@ class ImpGraphic
 
 private:
 
-GDIMetaFile maMetaFile;
-BitmapExmaEx;
-ImpSwapInfo maSwapInfo;
-std::unique_ptr mpAnimation;
-GraphicReader*  mpContext;
+GDIMetaFile  maMetaFile;
+BitmapEx maEx;
+ImpSwapInfo  maSwapInfo;
+std::unique_ptr   mpAnimation;
+GraphicReader*   mpContext;
 std::shared_ptr mpSwapFile;
-GfxLink*mpGfxLink;
-GraphicType meType;
-mutable sal_uLong   mnSizeBytes;
-sal_uLong   mnRefCount;
-boolmbSwapOut;
-boolmbSwapUnderway;
-boolmbDummyContext;
-SvgDataPtr  maSvgData;
+std::unique_ptr mpGfxLink;
+GraphicType  meType;
+mutable sal_uLongmnSizeBytes;
+sal_uLongmnRefCount;
+bool mbSwapOut;
+bool mbSwapUnderway;
+bool mbDummyContext;
+SvgDataPtr   maSvgData;
 css::uno::Sequence maPdfData;
 
 private:
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 0f7eb21..5478305 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -96,7 +96,6 @@ Size GraphicReader::GetPreviewSize() const
 
 ImpGraphic::ImpGraphic() :
 mpContext   ( nullptr ),
-mpGfxLink   ( nullptr ),
 meType  ( GraphicType::NONE ),
 mnSizeBytes ( 0UL ),
 mnRefCount  ( 1UL ),
@@ -119,9 +118,7 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) :
 mbDummyContext  ( rImpGraphic.mbDummyContext )
 {
 if( rImpGraphic.mpGfxLink )
-mpGfxLink = new GfxLink( *rImpGraphic.mpGfxLink );
-else
-mpGfxLink = nullptr;
+mpGfxLink = o3tl::make_unique( *rImpGraphic.mpGfxLink );
 
 if( rImpGraphic.mpAnimation )
 {
@@ -136,7 +133,6 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) :
 ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
 maEx( rBitmap ),
 mpContext   ( nullptr ),
-mpGfxLink   ( nullptr ),
 meType  ( !rBitmap.IsEmpty() ? GraphicType::Bitmap : 
GraphicType::NONE ),
 mnSizeBytes ( 0UL ),
 mnRefCount  ( 1UL ),
@@ -149,7 +145,6 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
 ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
 maEx( rBitmapEx ),
 mpContext   ( nullptr ),
-mpGfxLink   ( nullptr ),
 meType  ( !rBitmapEx.IsEmpty() ? GraphicType::Bitmap : 
GraphicType::NONE ),
 mnSizeBytes ( 0UL ),
 mnRefCount  ( 1UL ),
@@ -160,9 +155,7 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
 }
 
 ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr)
-:   mpAnimation( nullptr ),
-mpContext( nullptr ),
-mpGfxLink( nullptr ),
+:   mpContext( nullptr ),
 meType( rSvgDataPtr.get() ? GraphicType::Bitmap : GraphicType::NONE ),
 mnSizeBytes( 0UL ),
 mnRefCount( 1UL ),
@@ -177,7 +170,6 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
 maEx( rAnimation.GetBitmapEx() ),
 mpAnimation ( o3tl::make_unique( rAnimation ) ),
 mpContext   ( nullptr ),
-mpGfxLink   ( nullptr ),
 meType  ( GraphicType::Bitmap ),
 mnSizeBytes ( 0UL ),
 mnRefCount  ( 1UL ),
@@ -190,7 +182,6 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
 ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) :
 maMetaFile  ( rMtf ),
 mpContext   ( nullptr ),
-mpGfxLink   ( nullptr ),
 meType  ( GraphicType::GdiMetafile ),
 mnSizeBytes ( 0UL ),
 mnRefCount  ( 1UL ),
@@ -235,12 +226,10 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& 
rImpGraphic )
 mpSwapFile = rImpGraphic.mpSwapFile;
 }
 
-delete mpGfxLink;
+mpGfxLink.reset();
 
 if( rImpGraphic.mpGfxL

[Libreoffice-commits] core.git: basctl/source include/sfx2 sc/source sd/source sfx2/source starmath/source sw/source

2016-07-04 Thread Mark Page
 basctl/source/basicide/basicmod.hxx |2 +-
 include/sfx2/module.hxx |2 +-
 sc/source/ui/app/scmod.cxx  |2 +-
 sd/source/ui/app/sdmod.cxx  |3 +--
 sfx2/source/appl/module.cxx |   13 ++---
 starmath/source/smmod.cxx   |2 +-
 sw/source/uibase/app/swmodule.cxx   |3 +--
 7 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 66576fc1f6cf34d658993fa5f92020bc29fe3f88
Author: Mark Page <aptit...@btconnect.com>
Date:   Fri Jul 1 12:37:24 2016 +0100

SfxModule to use initializer_list instead of variadic arguments

The compiler can perform type checking with initializer lists

Change-Id: I1d26b56a3a2b67fe719f33d758ca9b0c95ebd4d1
Reviewed-on: https://gerrit.libreoffice.org/26852
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/basctl/source/basicide/basicmod.hxx 
b/basctl/source/basicide/basicmod.hxx
index b52a1c7..3bed4f2 100644
--- a/basctl/source/basicide/basicmod.hxx
+++ b/basctl/source/basicide/basicmod.hxx
@@ -31,7 +31,7 @@ class Module : public SfxModule
 static Module* mpModule;
 public:
 Module ( ResMgr *pMgr, SfxObjectFactory *pObjFact) :
-SfxModule( pMgr, pObjFact, nullptr )
+SfxModule( pMgr, {pObjFact} )
 { }
 public:
 static Module*& Get () { return mpModule; }
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 72f25f5..2761cce 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -69,7 +69,7 @@ private:
 
 public:
 
-SfxModule( ResMgr* pMgrP, SfxObjectFactory* 
pFactoryP, ... );
+SfxModule( ResMgr* pMgrP, 
std::initializer_list<SfxObjectFactory*> pFactoryList);
 virtual ~SfxModule();
 
 ResMgr* GetResMgr();
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c45480f..c1dc616 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -130,7 +130,7 @@ void ScModule::InitInterface_Impl()
 }
 
 ScModule::ScModule( SfxObjectFactory* pFact ) :
-SfxModule( ResMgr::CreateResMgr( "sc" ), pFact, nullptr ),
+SfxModule( ResMgr::CreateResMgr( "sc" ), {pFact} ),
 aIdleTimer("sc ScModule IdleTimer"),
 aSpellIdle("sc ScModule SpellIdle"),
 mpDragData(new ScDragData),
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 9b54068..1f821f0 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -67,8 +67,7 @@ void SdModule::InitInterface_Impl()
 
 // Ctor
 SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
-:   SfxModule( ResMgr::CreateResMgr("sd"),
-  pFact1, pFact2, nullptr ),
+:   SfxModule( ResMgr::CreateResMgr("sd"), {pFact1, pFact2} ),
 pTransferClip(nullptr),
 pTransferDrag(nullptr),
 pTransferSelection(nullptr),
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 3978723..7ea9e34 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -103,16 +103,15 @@ ResMgr* SfxModule::GetResMgr()
 return pResMgr;
 }
 
-SfxModule::SfxModule( ResMgr* pMgrP, SfxObjectFactory* pFactoryP, ... )
+SfxModule::SfxModule( ResMgr* pMgrP, std::initializer_list<SfxObjectFactory*> 
pFactoryList )
 : pResMgr( pMgrP ), pImpl(nullptr)
 {
 Construct_Impl();
-va_list pVarArgs;
-va_start( pVarArgs, pFactoryP );
-for ( SfxObjectFactory *pArg = pFactoryP; pArg;
- pArg = va_arg( pVarArgs, SfxObjectFactory* ) )
-pArg->SetModule_Impl( this );
-va_end(pVarArgs);
+for (auto pFactory : pFactoryList)
+{
+if (pFactory)
+pFactory->SetModule_Impl( this );
+}
 }
 
 void SfxModule::Construct_Impl()
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index e394fe6..e4d5445 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -151,7 +151,7 @@ void SmModule::InitInterface_Impl()
 }
 
 SmModule::SmModule(SfxObjectFactory* pObjFact) :
-SfxModule(ResMgr::CreateResMgr("sm"), pObjFact, nullptr)
+SfxModule(ResMgr::CreateResMgr("sm"), {pObjFact})
 {
 SetName("StarMath");
 
diff --git a/sw/source/uibase/app/swmodule.cxx 
b/sw/source/uibase/app/swmodule.cxx
index c4bfa35..f436e09 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -141,8 +141,7 @@ using namespace ::com::sun::star::uno;
 SwModule::SwModule( SfxObjectFactory* pWebFact,
 SfxObjectFactory* pFact,
 SfxObjectFactory* pGlobalFact )
-: SfxModule( ResMgr::CreateResMgr( "sw" ), pWebFact,
- pFact, pGlobalFact, nullptr ),
+: SfxModule( ResMgr::

[Libreoffice-commits] core.git: vcl/inc vcl/source

2016-07-01 Thread Mark Page
 vcl/inc/impgraph.hxx|2 +-
 vcl/source/gdi/impgraph.cxx |   21 ++---
 2 files changed, 7 insertions(+), 16 deletions(-)

New commits:
commit 663b7aec30703c8479c9dec2f8955bdc28bdca5e
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Jun 29 07:28:22 2016 +0100

Modify the ImpGraphic class, mpAnimation to use a unique pointer

Change-Id: Icb2be06cf5476d4d04752ab2270fe1c58453fe8f
Reviewed-on: https://gerrit.libreoffice.org/26791
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 884b6a6..e5ba1e9 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -40,7 +40,7 @@ private:
 GDIMetaFile maMetaFile;
 BitmapExmaEx;
 ImpSwapInfo maSwapInfo;
-Animation*  mpAnimation;
+std::unique_ptr mpAnimation;
 GraphicReader*  mpContext;
 std::shared_ptr mpSwapFile;
 GfxLink*mpGfxLink;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index ba92a25..0f7eb21 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -95,7 +95,6 @@ Size GraphicReader::GetPreviewSize() const
 }
 
 ImpGraphic::ImpGraphic() :
-mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( GraphicType::NONE ),
@@ -126,11 +125,9 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) :
 
 if( rImpGraphic.mpAnimation )
 {
-mpAnimation = new Animation( *rImpGraphic.mpAnimation );
+mpAnimation = o3tl::make_unique( *rImpGraphic.mpAnimation );
 maEx = mpAnimation->GetBitmapEx();
 }
-else
-mpAnimation = nullptr;
 
 maSvgData = rImpGraphic.maSvgData;
 maPdfData = rImpGraphic.maPdfData;
@@ -138,7 +135,6 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) :
 
 ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
 maEx( rBitmap ),
-mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( !rBitmap.IsEmpty() ? GraphicType::Bitmap : 
GraphicType::NONE ),
@@ -152,7 +148,6 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
 
 ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
 maEx( rBitmapEx ),
-mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( !rBitmapEx.IsEmpty() ? GraphicType::Bitmap : 
GraphicType::NONE ),
@@ -180,7 +175,7 @@ ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr)
 
 ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
 maEx( rAnimation.GetBitmapEx() ),
-mpAnimation ( new Animation( rAnimation ) ),
+mpAnimation ( o3tl::make_unique( rAnimation ) ),
 mpContext   ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( GraphicType::Bitmap ),
@@ -194,7 +189,6 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
 
 ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) :
 maMetaFile  ( rMtf ),
-mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( GraphicType::GdiMetafile ),
@@ -223,16 +217,15 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& 
rImpGraphic )
 meType = rImpGraphic.meType;
 mnSizeBytes = rImpGraphic.mnSizeBytes;
 
-delete mpAnimation;
+mpAnimation.reset();
 
 if ( rImpGraphic.mpAnimation )
 {
-mpAnimation = new Animation( *rImpGraphic.mpAnimation );
+mpAnimation = o3tl::make_unique( 
*rImpGraphic.mpAnimation );
 maEx = mpAnimation->GetBitmapEx();
 }
 else
 {
-mpAnimation = nullptr;
 maEx = rImpGraphic.maEx;
 }
 
@@ -337,8 +330,7 @@ void ImpGraphic::ImplClearGraphics( bool bCreateSwapInfo )
 if( mpAnimation )
 {
 mpAnimation->Clear();
-delete mpAnimation;
-mpAnimation = nullptr;
+mpAnimation.reset();
 }
 
 if( mpGfxLink )
@@ -1469,8 +1461,7 @@ SvStream& ReadImpGraphic( SvStream& rIStm, ImpGraphic& 
rImpGraphic )
 
 if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 
0x494d4931 == nMagic2 ) )
 {
-delete rImpGraphic.mpAnimation;
-rImpGraphic.mpAnimation = new Animation;
+rImpGraphic.mpAnimation = 
o3tl::make_unique();
 ReadAnimation( rIStm, *rImpGraphic.mpAnimation );
 
 // #108077# manually set loaded BmpEx to Animation
___
Libre

[Libreoffice-commits] core.git: vcl/inc vcl/source

2016-06-30 Thread Mark Page
 vcl/inc/impgraph.hxx|2 
 vcl/source/gdi/impgraph.cxx |  104 +++-
 2 files changed, 27 insertions(+), 79 deletions(-)

New commits:
commit f160d8c879b7184b2a41f2310a09c0432c14379a
Author: Mark Page <aptit...@btconnect.com>
Date:   Tue Jun 28 11:55:51 2016 +0100

Modify the ImpGraphic class SwapFile to use a shared pointer

Change-Id: I2cf85f91d9022a4ea10804efe2e986e95a63419f
Reviewed-on: https://gerrit.libreoffice.org/26284
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index a41d684..884b6a6 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -42,7 +42,7 @@ private:
 ImpSwapInfo maSwapInfo;
 Animation*  mpAnimation;
 GraphicReader*  mpContext;
-ImpSwapFile*mpSwapFile;
+std::shared_ptr mpSwapFile;
 GfxLink*mpGfxLink;
 GraphicType meType;
 mutable sal_uLong   mnSizeBytes;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 82e6b74..ba92a25 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define GRAPHIC_MTFTOBMP_MAXEXT 2048
 #define GRAPHIC_STREAMBUFSIZE   8192UL
@@ -58,7 +59,7 @@ using namespace com::sun::star;
 struct ImpSwapFile
 {
 INetURLObject   aSwapURL;
-sal_uLong   nRefCount;
+~ImpSwapFile();
 };
 
 class ReaderData
@@ -96,7 +97,6 @@ Size GraphicReader::GetPreviewSize() const
 ImpGraphic::ImpGraphic() :
 mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
-mpSwapFile  ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( GraphicType::NONE ),
 mnSizeBytes ( 0UL ),
@@ -119,9 +119,6 @@ ImpGraphic::ImpGraphic( const ImpGraphic& rImpGraphic ) :
 mbSwapUnderway  ( false ),
 mbDummyContext  ( rImpGraphic.mbDummyContext )
 {
-if( mpSwapFile )
-mpSwapFile->nRefCount++;
-
 if( rImpGraphic.mpGfxLink )
 mpGfxLink = new GfxLink( *rImpGraphic.mpGfxLink );
 else
@@ -143,7 +140,6 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
 maEx( rBitmap ),
 mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
-mpSwapFile  ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( !rBitmap.IsEmpty() ? GraphicType::Bitmap : 
GraphicType::NONE ),
 mnSizeBytes ( 0UL ),
@@ -158,7 +154,6 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
 maEx( rBitmapEx ),
 mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
-mpSwapFile  ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( !rBitmapEx.IsEmpty() ? GraphicType::Bitmap : 
GraphicType::NONE ),
 mnSizeBytes ( 0UL ),
@@ -172,7 +167,6 @@ ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
 ImpGraphic::ImpGraphic(const SvgDataPtr& rSvgDataPtr)
 :   mpAnimation( nullptr ),
 mpContext( nullptr ),
-mpSwapFile( nullptr ),
 mpGfxLink( nullptr ),
 meType( rSvgDataPtr.get() ? GraphicType::Bitmap : GraphicType::NONE ),
 mnSizeBytes( 0UL ),
@@ -188,7 +182,6 @@ ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
 maEx( rAnimation.GetBitmapEx() ),
 mpAnimation ( new Animation( rAnimation ) ),
 mpContext   ( nullptr ),
-mpSwapFile  ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( GraphicType::Bitmap ),
 mnSizeBytes ( 0UL ),
@@ -203,7 +196,6 @@ ImpGraphic::ImpGraphic( const GDIMetaFile& rMtf ) :
 maMetaFile  ( rMtf ),
 mpAnimation ( nullptr ),
 mpContext   ( nullptr ),
-mpSwapFile  ( nullptr ),
 mpGfxLink   ( nullptr ),
 meType  ( GraphicType::GdiMetafile ),
 mnSizeBytes ( 0UL ),
@@ -248,9 +240,6 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& 
rImpGraphic )
 {
 mbSwapOut = rImpGraphic.mbSwapOut;
 mpSwapFile = rImpGraphic.mpSwapFile;
-
-if( mpSwapFile )
-mpSwapFile->nRefCount++;
 }
 
 delete mpGfxLink;
@@ -362,42 +351,33 @@ void ImpGraphic::ImplClearGraphics( bool bCreateSwapInfo )
 maPdfData = uno::Sequence();
 }
 
-void ImpGraphic::ImplClear()
+ImpSwapFile::~ImpSwapFile()
 {
-if( mpSwapFile )
+try
 {
-if( mpSwapFile->nRefCount > 1 )
-mpSwapFile->nRefCount--;
-else
-{
-try
-{
-::ucbhelper::Content aCnt( mpSwapFile->aSwapURL.GetMainURL( 
INetURLObject::NO_DECODE ),
- css::uno::Reference< 
css::ucb

[Libreoffice-commits] core.git: filter/source

2016-06-17 Thread Mark Page
 filter/source/flash/swfexporter.cxx  |7 +++
 filter/source/flash/swfwriter.cxx|3 +--
 filter/source/flash/swfwriter1.cxx   |   13 ++---
 filter/source/flash/swfwriter2.cxx   |   19 +--
 filter/source/placeware/exporter.cxx |   17 -
 filter/source/svg/svgfilter.hxx  |2 --
 6 files changed, 27 insertions(+), 34 deletions(-)

New commits:
commit 48b7176fc09279d06d12fbab5619770767faad60
Author: Mark Page <aptit...@btconnect.com>
Date:   Thu Jun 16 14:39:57 2016 +0100

Remove the "using namespace std" from filter

Change-Id: Ied355374a0bf662a9be70d83615446cbac9ee0b2
Reviewed-on: https://gerrit.libreoffice.org/26373
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/filter/source/flash/swfexporter.cxx 
b/filter/source/flash/swfexporter.cxx
index 3bdceb8..a79a7ed 100644
--- a/filter/source/flash/swfexporter.cxx
+++ b/filter/source/flash/swfexporter.cxx
@@ -42,7 +42,6 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::drawing;
 using namespace ::com::sun::star::presentation;
 using namespace ::com::sun::star::task;
-using namespace ::std;
 using namespace ::swf;
 
 using com::sun::star::io::XOutputStream;
@@ -63,8 +62,8 @@ PageInfo::PageInfo()
 
 PageInfo::~PageInfo()
 {
-vector<ShapeInfo*>::iterator aIter( maShapesVector.begin() );
-const vector<ShapeInfo*>::iterator aEnd( maShapesVector.end() );
+std::vector<ShapeInfo*>::iterator aIter( maShapesVector.begin() );
+const std::vector<ShapeInfo*>::iterator aEnd( maShapesVector.end() );
 while( aIter != aEnd )
 {
 delete (*aIter++);
@@ -505,7 +504,7 @@ void FlashExporter::exportShapes( const Reference< XShapes 
>& xShapes, bool bStr
 {
 OSL_ENSURE( (xShapes->getCount() <= 0x), "overflow in 
FlashExporter::exportDrawPageContents()" );
 
-sal_uInt16 nShapeCount = (sal_uInt16)min( xShapes->getCount(), 
(sal_Int32)0x );
+sal_uInt16 nShapeCount = (sal_uInt16)std::min( xShapes->getCount(), 
(sal_Int32)0x );
 sal_uInt16 nShape;
 
 Reference< XShape > xShape;
diff --git a/filter/source/flash/swfwriter.cxx 
b/filter/source/flash/swfwriter.cxx
index b91c0f3..22841bf 100644
--- a/filter/source/flash/swfwriter.cxx
+++ b/filter/source/flash/swfwriter.cxx
@@ -23,7 +23,6 @@
 #include 
 
 using namespace ::swf;
-using namespace ::std;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::io;
 
@@ -110,7 +109,7 @@ void ImplCopySvStreamToXOutputStream( SvStream& rIn, 
Reference< XOutputStream >
 sal_uInt32 nSize = rIn.Tell();
 rIn.Seek( STREAM_SEEK_TO_BEGIN );
 
-Sequence< sal_Int8 > aBuffer( min( nBufferSize, nSize ) );
+Sequence< sal_Int8 > aBuffer( std::min( nBufferSize, nSize ) );
 
 while( nSize )
 {
diff --git a/filter/source/flash/swfwriter1.cxx 
b/filter/source/flash/swfwriter1.cxx
index 4bc5557..5d1d057 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -39,7 +39,6 @@
 #include 
 
 using namespace ::swf;
-using namespace ::std;
 using namespace ::com::sun::star::i18n;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -175,7 +174,7 @@ void Writer::Impl_addShapeRecordChange( BitStream& rBits, 
sal_Int16 dx, sal_Int1
 rBits.writeUB( bFilled ? 1 : 0, 1 );// StateFillStyle1
 rBits.writeUB( 1, 1 );  // StateMoveTo
 
-sal_uInt16 nMoveBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) 
);
+sal_uInt16 nMoveBits = std::max( getMaxBitsSigned( dx ), getMaxBitsSigned( 
dy ) );
 
 rBits.writeUB( nMoveBits, 5 );  // Number of bits per value
 // TODO: Optimize horizontal and vertical 
lines
@@ -193,7 +192,7 @@ void Writer::Impl_addStraightEdgeRecord( BitStream& rBits, 
sal_Int16 dx, sal_Int
 rBits.writeUB( 1, 1 );  // TypeFlag
 rBits.writeUB( 1, 1 );  // StraightFlag
 
-sal_uInt16 nBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) );
+sal_uInt16 nBits = std::max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy 
) );
 
 rBits.writeUB( nBits - 2, 4 );  // Number of bits per value
 
@@ -227,10 +226,10 @@ void Writer::Impl_addCurvedEdgeRecord( BitStream& rBits, 
sal_Int16 control_dx, s
 rBits.writeUB( 0, 1 );  // CurvedFlag
 
 sal_uInt8 nBits = static_cast(
-max( getMaxBitsSigned( control_dx ),
-max( getMaxBitsSigned( control_dy ),
-max( getMaxBitsSigned( anchor_dx ),
-max( getMaxBitsSigned( anchor_dy ), (sal_uInt16)3 ) ) ) ) 
);
+std::max( getMaxBitsSigned( control_dx ),
+std::max( getMaxBitsSigned( control_dy ),
+std::max( getMaxBitsSigned( anchor_dx ),
+std::max( getMaxBitsSi

[Libreoffice-commits] core.git: sw/inc sw/source

2016-06-16 Thread Mark Page
/unosett.cxx  |4 
 sw/source/core/unocore/unotext.cxx  |8 -
 sw/source/filter/html/htmlatr.cxx   |2 
 sw/source/filter/html/svxcss1.hxx   |4 
 sw/source/filter/html/swhtml.hxx|2 
 sw/source/filter/writer/writer.cxx  |2 
 sw/source/filter/ww8/WW8FFData.cxx  |2 
 sw/source/filter/ww8/WW8FFData.hxx  |2 
 sw/source/filter/ww8/WW8TableInfo.cxx   |   14 +--
 sw/source/filter/ww8/WW8TableInfo.hxx   |   30 +++---
 sw/source/filter/ww8/docxfootnotes.hxx  |2 
 sw/source/filter/ww8/wrtw8num.cxx   |2 
 sw/source/filter/ww8/wrtw8sty.cxx   |   26 ++---
 sw/source/filter/ww8/wrtww8.cxx |2 
 sw/source/filter/ww8/wrtww8.hxx |   12 +-
 sw/source/filter/ww8/ww8glsy.hxx|4 
 sw/source/filter/ww8/ww8par.cxx |6 -
 sw/source/filter/ww8/ww8par.hxx |8 -
 sw/source/filter/ww8/ww8par3.cxx|2 
 sw/source/filter/ww8/ww8par4.cxx|2 
 sw/source/filter/ww8/ww8par5.cxx|4 
 sw/source/filter/ww8/ww8scan.cxx|2 
 sw/source/filter/ww8/ww8scan.hxx|6 -
 sw/source/filter/xml/XMLRedlineImportHelper.hxx |2 
 sw/source/filter/xml/xmlexp.cxx |2 
 sw/source/filter/xml/xmlexp.hxx |4 
 sw/source/filter/xml/xmlfmte.cxx|6 -
 sw/source/filter/xml/xmltble.cxx|4 
 sw/source/filter/xml/xmltexti.cxx   |6 -
 sw/source/filter/xml/xmltexti.hxx   |2 
 sw/source/ui/dbui/createaddresslistdialog.cxx   |   24 ++---
 sw/source/ui/dbui/createaddresslistdialog.hxx   |4 
 sw/source/ui/dbui/mmaddressblockpage.cxx|   10 +-
 sw/source/ui/dbui/mmaddressblockpage.hxx|4 
 sw/source/ui/dbui/mmoutputtypepage.cxx  |2 
 sw/source/ui/frmdlg/frmpage.cxx |   22 ++--
 sw/source/ui/index/cnttab.cxx   |4 
 sw/source/uibase/app/docstyle.cxx   |2 
 sw/source/uibase/config/StoredChapterNumbering.cxx  |2 
 sw/source/uibase/dbui/dbmgr.cxx |2 
 sw/source/uibase/dbui/mailmergehelper.cxx   |4 
 sw/source/uibase/dbui/mmconfigitem.cxx  |   22 ++--
 sw/source/uibase/dochdl/swdtflvr.cxx|4 
 sw/source/uibase/docvw/AnchorOverlayObject.cxx  |2 
 sw/source/uibase/docvw/frmsidebarwincontainer.cxx   |4 
 sw/source/uibase/inc/glosdoc.hxx|4 
 sw/source/uibase/inc/maildispatcher.hxx |4 
 sw/source/uibase/inc/navmgr.hxx |2 
 sw/source/uibase/inc/regionsw.hxx   |2 
 sw/source/uibase/shells/grfsh.cxx   |2 
 sw/source/uibase/sidebar/PageFormatPanel.hxx|6 -
 sw/source/uibase/sidebar/PagePropertyPanel.hxx  |   10 +-
 sw/source/uibase/sidebar/PageSizeControl.cxx|2 
 sw/source/uibase/sidebar/PageSizeControl.hxx|2 
 sw/source/uibase/uiview/view2.cxx   |2 
 sw/source/uibase/uiview/viewmdi.cxx |2 
 sw/source/uibase/uno/unotxdoc.cxx   |2 
 sw/source/uibase/utlui/bookctrl.cxx |2 
 sw/source/uibase/utlui/navipi.cxx   |4 
 sw/source/uibase/wrtsh/navmgr.cxx   |2 
 135 files changed, 484 insertions(+), 484 deletions(-)

New commits:
commit d2106d8c8c1af64924f5423223388dbbe99af352
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed Jun 15 13:44:28 2016 +0100

Remove the :: prefix in ::std for sw

This patch was created using a script
Variable name textual alignment is preserved to the same level

Change-Id: I6b4858f8059b8cf71fc253e87d6df634362d62e9
Reviewed-on: https://gerrit.libreoffice.org/26306
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sw/inc/IDocumentListItems.hxx b/sw/inc/IDocumentListItems.hxx
index e0e1679..e8573e5 100644
--- a/sw/inc/IDocumentListItems.hxx
+++ b/sw/inc/IDocumentListItems.hxx
@@ -29,7 +29,7 @@ class SwNodeNum;
 class IDocumentListItems
 {
 public:
-typedef ::std::vector< const SwNodeNum* > tSortedNodeNumList;
+typedef std::vector< const SwNodeNum* > tSortedNodeNumList;
 
 virtual void addListItem( const SwNodeNum& rNodeNum ) = 0;
 virtual void removeL

[Libreoffice-commits] core.git: vcl/headless vcl/inc vcl/osx vcl/quartz vcl/source vcl/unx vcl/win

2016-06-10 Thread Mark Page
 vcl/headless/svptext.cxx   |2 
 vcl/inc/headless/svpgdi.hxx|2 
 vcl/inc/image.h|3 
 vcl/inc/opengl/program.hxx |3 
 vcl/inc/osx/salinst.h  |3 
 vcl/inc/outdev.h   |3 
 vcl/inc/quartz/salgdi.h|3 
 vcl/inc/salgdi.hxx |3 
 vcl/inc/sallayout.hxx  |3 
 vcl/inc/textrender.hxx |2 
 vcl/inc/unx/cairotextrender.hxx|2 
 vcl/inc/unx/fontcache.hxx  |3 
 vcl/inc/unx/genpspgraphics.h   |4 -
 vcl/inc/unx/gtk/gtkgdi.hxx |   47 +++
 vcl/inc/unx/salgdi.h   |2 
 vcl/inc/win/salbmp.h   |5 -
 vcl/inc/win/salgdi.h   |5 -
 vcl/osx/salinst.cxx|4 -
 vcl/quartz/salgdi.cxx  |   16 ++---
 vcl/quartz/salgdicommon.cxx|3 
 vcl/source/edit/textdoc.cxx|   12 +--
 vcl/source/edit/textdoc.hxx|3 
 vcl/source/filter/FilterConfigCache.cxx|   20 +++---
 vcl/source/filter/FilterConfigCache.hxx|5 -
 vcl/source/filter/wmf/winmtf.cxx   |6 -
 vcl/source/filter/wmf/winmtf.hxx   |8 --
 vcl/source/font/fontcharmap.cxx|   15 +---
 vcl/source/fontsubset/cff.cxx  |   25 +++-
 vcl/source/fontsubset/gsub.cxx |8 --
 vcl/source/gdi/pdffontcache.hxx|2 
 vcl/source/gdi/pdfwriter_impl.cxx  |4 -
 vcl/source/gdi/pdfwriter_impl.hxx  |3 
 vcl/source/gdi/sallayout.cxx   |   32 +-
 vcl/source/image/ImplImageList.cxx |4 -
 vcl/source/outdev/font.cxx |4 -
 vcl/source/window/debugevent.cxx   |5 -
 vcl/source/window/splitwin.cxx |   31 --
 vcl/unx/generic/fontmanager/fontcache.cxx  |   14 ++--
 vcl/unx/generic/gdi/cairotextrender.cxx|2 
 vcl/unx/generic/gdi/font.cxx   |2 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |8 --
 vcl/unx/generic/print/genpspgraphics.cxx   |4 -
 vcl/unx/gtk/salnativewidgets-gtk.cxx   |   76 -
 vcl/win/gdi/gdiimpl.cxx|6 -
 vcl/win/gdi/salbmp.cxx |2 
 vcl/win/gdi/salfont.cxx|2 
 46 files changed, 197 insertions(+), 224 deletions(-)

New commits:
commit 99200d7cc2a952f92074934c647db076aae5e48b
Author: Mark Page <aptit...@btconnect.com>
Date:   Thu Jun 9 15:53:20 2016 +0100

tdf#96099 Remove various smart pointer typedefs in vcl

Change-Id: I4ac1bb25d3d63f150b42d9e1708efc344bbdb6a7
Reviewed-on: https://gerrit.libreoffice.org/26113
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index e8fd525..ac7d3dc 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -95,7 +95,7 @@ void SvpSalGraphics::FreeEmbedFontData( const void* pData, 
long nLen )
 
 void SvpSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
bool bVertical,
-   Int32Vector& rWidths,
+   std::vector< sal_Int32 >& rWidths,
Ucs2UIntMap& rUnicodeEnc )
 {
 m_aTextRenderImpl.GetGlyphWidths(pFont, bVertical, rWidths, rUnicodeEnc);
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 372be72..bb2e2f5 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -147,7 +147,7 @@ public:
 virtual voidFreeEmbedFontData( const void* pData, long 
nDataLen ) override;
 virtual voidGetGlyphWidths( const PhysicalFontFace*,
 bool bVertical,
-Int32Vector& rWidths,
+std::vector< sal_Int32 >& rWidths,
 Ucs2UIntMap& rUnicodeEnc ) 
override;
 virtual boolGetGlyphBoundRect( sal_GlyphId nIndex, Rectangle& 
) override;
 virtual boolGetGlyphOutline( sal_GlyphId nIndex, 
basegfx::B2DPolyPolygon& ) override;
diff --git a/vcl/inc/image.h b/vcl/inc/image.h
index 9ab275a..f737a14 100644
--- a/vcl/inc/image.h
+++ b/vcl/inc/image.h
@@ -45,11 +45,10 @@ struct ImageAryData
 
 struct ImplImageList
 {
-typedef std::vector ImageAryDataVec;
 typedef std::unordered_map< OUStr

[Libreoffice-commits] core.git: canvas/source include/canvas

2016-06-09 Thread Mark Page
 canvas/source/directx/dx_9rm.cxx  |   12 +--
 canvas/source/directx/dx_canvascustomsprite.cxx   |2 -
 canvas/source/directx/dx_canvascustomsprite.hxx   |2 -
 canvas/source/directx/dx_spritecanvashelper.cxx   |2 -
 canvas/source/directx/dx_spritecanvashelper.hxx   |4 +--
 canvas/source/directx/dx_spritedevicehelper.hxx   |4 +--
 canvas/source/directx/dx_surfacebitmap.cxx|2 -
 canvas/source/directx/dx_surfacebitmap.hxx|6 ++---
 canvas/source/tools/page.cxx  |2 -
 canvas/source/tools/page.hxx  |   16 +++---
 canvas/source/tools/pagemanager.hxx   |6 ++---
 canvas/source/tools/surface.cxx   |8 +++
 canvas/source/tools/surface.hxx   |4 +--
 canvas/source/tools/surfaceproxy.cxx  |2 -
 canvas/source/tools/surfaceproxy.hxx  |4 +--
 canvas/source/tools/surfaceproxymanager.cxx   |8 +++
 include/canvas/rendering/bitmap.hxx   |   24 +++---
 include/canvas/rendering/icachedprimitive.hxx |2 -
 include/canvas/rendering/icolorbuffer.hxx |2 -
 include/canvas/rendering/irendermodule.hxx|6 +
 include/canvas/rendering/isurface.hxx |2 -
 include/canvas/rendering/isurfaceproxymanager.hxx |7 +-
 22 files changed, 58 insertions(+), 69 deletions(-)

New commits:
commit 8561f8bfccb73ce4ac834598c4c32ac5c81774e5
Author: Mark Page <aptit...@btconnect.com>
Date:   Thu Jun 9 10:41:10 2016 +0100

tdf#96099 Remove various smart pointer typedefs in canvas

Change-Id: Ied6ec5f7830c53a339de985d173c1dec711ac8f7
Reviewed-on: https://gerrit.libreoffice.org/26092
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Michael Stahl <mst...@redhat.com>

diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index 6beb183..6e7ba8c 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -184,7 +184,7 @@ namespace dxcanvas
 
 virtual void resize( const ::basegfx::B2IRange& rect );
 virtual ::basegfx::B2IVector getPageSize();
-virtual ::canvas::ISurfaceSharedPtr createSurface( const 
::basegfx::B2IVector& surfaceSize );
+virtual ::std::shared_ptr createSurface( const 
::basegfx::B2IVector& surfaceSize );
 virtual void beginPrimitive( PrimitiveType eType );
 virtual void endPrimitive();
 virtual void pushVertex( const ::canvas::Vertex& vertex );
@@ -213,7 +213,7 @@ namespace dxcanvas
 COMReferencempDirect3D9;
 COMReference   mpSwapChain;
 COMReferencempVertexBuffer;
-::canvas::ISurfaceSharedPtr mpTexture;
+::std::shared_ptr mpTexture;
 VclPtr   mpWindow;
 ::basegfx::B2IVectormaSize;
 typedef std::vector vertexCache_t;
@@ -521,7 +521,7 @@ namespace dxcanvas
 ::basegfx::B2IVector aPageSize(maPageSize);
 while(true)
 {
-mpTexture = ::canvas::ISurfaceSharedPtr(
+mpTexture = ::std::shared_ptr(
 new DXSurface(*this,aPageSize));
 if(mpTexture->isValid())
 break;
@@ -984,13 +984,13 @@ namespace dxcanvas
 // DXRenderModule::createSurface
 
 
-::canvas::ISurfaceSharedPtr DXRenderModule::createSurface( const 
::basegfx::B2IVector& surfaceSize )
+::std::shared_ptr DXRenderModule::createSurface( 
const ::basegfx::B2IVector& surfaceSize )
 {
 // TODO(P2): get rid of those fine-grained locking
 ::osl::MutexGuard aGuard( maMutex );
 
 if(isDisposed())
-return ::canvas::ISurfaceSharedPtr();
+return ::std::shared_ptr();
 
 const ::basegfx::B2IVector& rPageSize( getPageSize() );
 ::basegfx::B2ISize aSize(surfaceSize);
@@ -1002,7 +1002,7 @@ namespace dxcanvas
 if(mpTexture.use_count() == 1)
 return mpTexture;
 
-return ::canvas::ISurfaceSharedPtr( new DXSurface(*this,aSize) );
+return ::std::shared_ptr( new 
DXSurface(*this,aSize) );
 }
 
 
diff --git a/canvas/source/directx/dx_canvascustomsprite.cxx 
b/canvas/source/directx/dx_canvascustomsprite.cxx
index e56237a..026a663 100644
--- a/canvas/source/directx/dx_canvascustomsprite.cxx
+++ b/canvas/source/directx/dx_canvascustomsprite.cxx
@@ -40,7 +40,7 @@ namespace dxcanvas
 CanvasCustomSprite::CanvasCustomSprite( const css::geometry::RealSize2D&   
rSpriteSize,
 const SpriteCanvasRef& 
 rRefDevice,
  

[Libreoffice-commits] core.git: connectivity/source dbaccess/source filter/source include/connectivity include/filter include/oox include/sfx2 include/svtools include/svx include/unotools sc/source sl

2016-06-08 Thread Mark Page
 connectivity/source/commontools/RowFunctionParser.cxx |   28 +--
 connectivity/source/commontools/TDatabaseMetaDataBase.cxx |6 
 connectivity/source/commontools/TKey.cxx  |2 
 connectivity/source/commontools/TTableHelper.cxx  |   10 -
 connectivity/source/inc/RowFunctionParser.hxx |3 
 connectivity/source/sdbcx/VKey.cxx|2 
 dbaccess/source/ui/dlg/admincontrols.cxx  |2 
 filter/source/msfilter/escherex.cxx   |2 
 include/connectivity/TKey.hxx |2 
 include/connectivity/TTableHelper.hxx |6 
 include/connectivity/sdbcx/VKey.hxx   |5 
 include/filter/msfilter/escherex.hxx  |6 
 include/oox/vml/vmldrawing.hxx|6 
 include/oox/vml/vmlshape.hxx  |9 -
 include/sfx2/itemconnect.hxx  |5 
 include/svtools/dialogcontrolling.hxx |4 
 include/svx/EnhancedCustomShapeFunctionParser.hxx |3 
 include/svx/framelinkarray.hxx|4 
 include/svx/shapepropertynotifier.hxx |4 
 include/unotools/sharedunocomponent.hxx   |3 
 sc/source/filter/xcl97/xcl97esc.cxx   |2 
 sc/source/ui/unoobj/shapeuno.cxx  |2 
 slideshow/source/engine/activities/activitiesfactory.cxx  |8 -
 slideshow/source/engine/activities/activityparameters.hxx |2 
 slideshow/source/engine/expressionnodefactory.cxx |   76 +-
 slideshow/source/engine/smilfunctionparser.cxx|   20 +-
 slideshow/source/inc/expressionnode.hxx   |2 
 slideshow/source/inc/expressionnodefactory.hxx|   28 +--
 slideshow/source/inc/smilfunctionparser.hxx   |4 
 svtools/source/misc/dialogcontrolling.cxx |   22 +-
 svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx |   62 
 svx/source/unodraw/shapepropertynotifier.cxx  |4 
 svx/source/unodraw/unoshape.cxx   |4 
 sw/source/core/unocore/unodraw.cxx|2 
 sw/source/filter/ww8/wrtw8esh.cxx |2 
 35 files changed, 165 insertions(+), 187 deletions(-)

New commits:
commit 22fa9289fdc6fd8d82d754adfef39fee3fd3c52f
Author: Mark Page <aptit...@btconnect.com>
Date:   Tue Jun 7 11:59:24 2016 +0100

tdf#96099 Remove various smart pointer typedefs

Change-Id: I76843139e43ca1c158a977e24d210d5af93e4d0f
Reviewed-on: https://gerrit.libreoffice.org/26014
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/connectivity/source/commontools/RowFunctionParser.cxx 
b/connectivity/source/commontools/RowFunctionParser.cxx
index 94c2e4f..b12ba73 100644
--- a/connectivity/source/commontools/RowFunctionParser.cxx
+++ b/connectivity/source/commontools/RowFunctionParser.cxx
@@ -77,12 +77,12 @@ public:
 class BinaryFunctionExpression : public ExpressionNode
 {
 const ExpressionFunct   meFunct;
-ExpressionNodeSharedPtr mpFirstArg;
-ExpressionNodeSharedPtr mpSecondArg;
+std::shared_ptr mpFirstArg;
+std::shared_ptr mpSecondArg;
 
 public:
 
-BinaryFunctionExpression( const ExpressionFunct eFunct, const 
ExpressionNodeSharedPtr& rFirstArg, const ExpressionNodeSharedPtr& rSecondArg ) 
:
+BinaryFunctionExpression( const ExpressionFunct eFunct, const 
std::shared_ptr& rFirstArg, const 
std::shared_ptr& rSecondArg ) :
 meFunct( eFunct ),
 mpFirstArg( rFirstArg ),
 mpSecondArg( rSecondArg )
@@ -128,7 +128,7 @@ typedef const sal_Char* StringIteratorT;
 
 struct ParserContext
 {
-typedef ::std::stack< ExpressionNodeSharedPtr > OperandStack;
+typedef ::std::stack< std::shared_ptr > OperandStack;
 
 // stores a stack of not-yet-evaluated operands. This is used
 // by the operators (i.e. '+', '*', 'sin' etc.) to pop their
@@ -156,7 +156,7 @@ public:
 void operator()( StringIteratorT rFirst,StringIteratorT rSecond) const
 {
 OUString sVal( rFirst, rSecond - rFirst, RTL_TEXTENCODING_UTF8 );
-mpContext->maOperandStack.push( ExpressionNodeSharedPtr( new 
ConstantValueExpression( new ORowSetValueDecorator( sVal ) ) ) );
+mpContext->maOperandStack.push( std::shared_ptr( new 
ConstantValueExpression( new ORowSetValueDecorator( sVal ) ) ) );
 }
 };
 
@@ -173,7 +173,7 @@ public:
 }
 void operator()( sal_Int32 n ) const
 {
-mpContext->maOperandStack.push( ExpressionNodeSharedPtr( new 
ConstantValueExpression( n

[Libreoffice-commits] core.git: filter/source include/vcl vcl/source

2016-06-08 Thread Mark Page
 filter/source/graphicfilter/ieps/ieps.cxx |3 
 include/vcl/gfxlink.hxx   |  100 -
 vcl/source/filter/graphicfilter.cxx   |   23 +--
 vcl/source/gdi/gfxlink.cxx|  229 --
 4 files changed, 108 insertions(+), 247 deletions(-)

New commits:
commit f595e70cfee85a423f592190c607231cb00e3180
Author: Mark Page <aptit...@btconnect.com>
Date:   Tue May 31 12:26:28 2016 +0100

Simplify GfxLink using smart pointers

Uses std::shared_ptr for sharing graphic data

Changed constructor to std::unique_ptr<sal_uInt8[]> to ensure
the delete[] operator is called when GfxLink internals takes
ownership of the data

Change-Id: I4edd4634df8d6ba4d94953260c1a7ac560ccf04a
Reviewed-on: https://gerrit.libreoffice.org/25402
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/filter/source/graphicfilter/ieps/ieps.cxx 
b/filter/source/graphicfilter/ieps/ieps.cxx
index d6ba321..79eaaf1 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -730,8 +730,7 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
 aGraphic);
 }
 
-GfxLink aGfxLink( pBuf.get(), nPSSize, 
GfxLinkType::EpsBuffer ) ;
-pBuf.release();
+GfxLink aGfxLink( std::move(pBuf), nPSSize, 
GfxLinkType::EpsBuffer ) ;
 aMtf.AddAction( static_cast<MetaAction*>( new 
MetaEPSAction( Point(), Size( nWidth, nHeight ),
   
aGfxLink, aGraphic.GetGDIMetaFile() ) ) );
 CreateMtfReplacementAction( aMtf, rStream, nOrigPos, 
nPSSize, nPosWMF, nSizeWMF, nPosTIFF, nSizeTIFF );
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 864d1d6..0fc6e0c 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -25,56 +25,10 @@
 #include 
 #include 
 #include 
+#include 
 
 class SvStream;
 
-
-struct ImpBuffer
-{
-sal_uLong   mnRefCount;
-sal_uInt8*  mpBuffer;
-
-ImpBuffer( sal_uInt8* pBuf ) { mnRefCount = 1UL; mpBuffer = 
pBuf; }
-
-~ImpBuffer() { delete[] mpBuffer; }
-};
-
-
-struct ImpSwap
-{
-OUString   maURL;
-sal_uLong   mnDataSize;
-sal_uLong   mnRefCount;
-
-ImpSwap( sal_uInt8* pData, sal_uLong nDataSize );
-~ImpSwap();
-
-sal_uInt8*  GetData() const;
-
-boolIsSwapped() const { return maURL.getLength() > 0; }
-
-voidWriteTo( SvStream& rOStm ) const;
-};
-
-
-struct ImpGfxLink
-{
-MapMode maPrefMapMode;
-SizemaPrefSize;
-boolmbPrefMapModeValid;
-boolmbPrefSizeValid;
-
-ImpGfxLink() :
-maPrefMapMode(),
-maPrefSize(),
-mbPrefMapModeValid( false ),
-mbPrefSizeValid( false )
-{}
-};
-
-//#endif // __PRIVATE
-
-
 enum class GfxLinkType
 {
 NONE = 0,
@@ -88,56 +42,64 @@ enum class GfxLinkType
 NativePct= 8,// Don't forget to update the following defines
 NativeSvg= 9,// Don't forget to update the following defines
 NativeMov= 10,   // Don't forget to update the following defines
-// #i15508# added BMP type support
 NativeBmp= 11   // Don't forget to update the following defines
 };
 
 #define GFX_LINK_FIRST_NATIVE_IDGfxLinkType::NativeGif
 #define GFX_LINK_LAST_NATIVE_ID GfxLinkType::NativeBmp
 
-
-struct ImpBuffer;
-struct ImpSwap;
-struct ImpGfxLink;
 class Graphic;
 
 class VCL_DLLPUBLIC GfxLink
 {
 private:
 
-GfxLinkType meType;
-ImpBuffer*  mpBuf;
-ImpSwap*mpSwap;
-sal_uInt32  mnBufSize;
-sal_uInt32  mnUserId;
-ImpGfxLink* mpImpData;
+struct SwapOutData
+{
+SwapOutData(const OUString );
+~SwapOutData();
 
-SAL_DLLPRIVATE void ImplCopy( const GfxLink& rGfxLink );
+OUString maURL; // File is removed in the destructor
 
+};
+
+GfxLinkType meType = GfxLinkType::NONE;
+sal_uInt32  mnUserId = 0;
+
+std::shared_ptr mpSwapInData;
+std::shared_ptr mpSwapOutData;
+
+sal_uInt32  mnSwapInDataSize = 0;
+MapMode maPrefMapMode;
+SizemaPrefSize;
+boolmbPrefMapModeValid = false;
+boolmbPrefSizeValid = false;
+
+SAL_DLLPRIVATE std::shared_ptr GetSwapInData() const;
 public:
 GfxLink();
-GfxLink( const GfxLink& );
-GfxLink( sal_uInt8* pBuf, sal_uInt32 nBufSize, 
GfxLinkType nType );
+
+// pBuff = The Graphic data. This class takes 
ow

[Libreoffice-commits] core.git: include/sfx2 sfx2/source

2016-06-08 Thread Mark Page
 include/sfx2/module.hxx |3 +++
 include/sfx2/msgpool.hxx|3 +--
 sfx2/source/appl/module.cxx |4 ++--
 sfx2/source/control/msgpool.cxx |4 ++--
 4 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 5164ac456f3cb51949fe3bec293660fab74d26de
Author: Mark Page <aptit...@btconnect.com>
Date:   Tue Jun 7 09:09:07 2016 +0100

tdf#96099 Remove SfxInterfaceArr_Impl typedef

Added comment in SfxModule with warning about using smart pointers

Change-Id: I1997d41a0a77c7e82e486bcdaee0ea876fdc61ad
Reviewed-on: https://gerrit.libreoffice.org/25999
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 7871675..72f25f5 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -53,6 +53,9 @@ class SFX2_DLLPUBLIC SfxModule : public SfxShell
 {
 private:
 ResMgr* pResMgr;
+
+// Warning this cannot be turned into a unique_ptr.
+// SfxInterface destruction in the SfxSlotPool refers again to pImpl after 
deletion of pImpl has commenced. See tdf#100270
 SfxModule_Impl* pImpl;
 
 SAL_DLLPRIVATE void Construct_Impl();
diff --git a/include/sfx2/msgpool.hxx b/include/sfx2/msgpool.hxx
index b4ff132..d38a73c 100644
--- a/include/sfx2/msgpool.hxx
+++ b/include/sfx2/msgpool.hxx
@@ -31,13 +31,12 @@ class SfxInterface;
 class SfxSlot;
 
 typedef std::basic_string< sal_uInt16 > SfxSlotGroupArr_Impl;
-typedef std::vector<SfxInterface*> SfxInterfaceArr_Impl;
 
 class SFX2_DLLPUBLIC SfxSlotPool
 {
 std::unique_ptr   _pGroups;
 SfxSlotPool*_pParentPool;
-std::unique_ptr   _pInterfaces;
+std::unique_ptr< std::vector<SfxInterface*> >   _pInterfaces;
 sal_uInt16  _nCurGroup;
 sal_uInt16  _nCurInterface;
 sal_uInt16  _nCurMsg;
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index bb1730d..3978723 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -92,7 +92,8 @@ ImageList* SfxModule_Impl::GetImageList( ResMgr* pResMgr, 
bool bBig )
 rpList = new ImageList();
 }
 
-return rpList; }
+return rpList;
+}
 
 
 SFX_IMPL_SUPERCLASS_INTERFACE(SfxModule, SfxShell)
@@ -147,7 +148,6 @@ SfxModule::~SfxModule()
 break;
 }
 }
-
 }
 
 delete pImpl;
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx
index eb38323..ab832d6 100644
--- a/sfx2/source/control/msgpool.cxx
+++ b/sfx2/source/control/msgpool.cxx
@@ -55,7 +55,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface 
)
 {
 // add to the list of SfxObjectInterface instances
 if(!_pInterfaces)
-_pInterfaces.reset(new SfxInterfaceArr_Impl);
+_pInterfaces.reset(new std::vector<SfxInterface*> );
 _pInterfaces->push_back();
 
 // Stop at a (single) Null-slot (for syntactic reasons the interfaces
@@ -106,7 +106,7 @@ void SfxSlotPool::ReleaseInterface( SfxInterface& 
rInterface )
 return ;
 
 // remove from the list of SfxInterface instances
-SfxInterfaceArr_Impl::iterator i = std::find(_pInterfaces->begin(), 
_pInterfaces->end(), );
+auto i = std::find(_pInterfaces->begin(), _pInterfaces->end(), 
);
 if(i != _pInterfaces->end())
 _pInterfaces->erase(i);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: basctl/source include/sfx2 sc/source sd/source sfx2/source starmath/source sw/source

2016-06-06 Thread Mark Page
 basctl/source/basicide/basicmod.hxx |2 
 include/sfx2/module.hxx |7 --
 sc/source/ui/app/scmod.cxx  |2 
 sd/source/ui/app/sdmod.cxx  |2 
 sfx2/source/appl/module.cxx |  105 ++--
 starmath/source/smmod.cxx   |2 
 sw/source/uibase/app/swmodule.cxx   |2 
 7 files changed, 38 insertions(+), 84 deletions(-)

New commits:
commit e319ef1171dab61fff2201f5c1470ca09894c395
Author: Mark Page <aptit...@btconnect.com>
Date:   Fri Jun 3 11:16:49 2016 +0100

Simplify sfx2 removing SfxModuleArr_Impl and dummy SfxModule flag

The SfxModuleArr_Impl is a static container of SfxModule, since
this is private to the SfxModule class it does not require
wrapping.

The bDummy flag is unused, and complicates the class

Change-Id: Ib03b215543a0c37d4edf20b2d0fc141a783e115e
Reviewed-on: https://gerrit.libreoffice.org/25859
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/basctl/source/basicide/basicmod.hxx 
b/basctl/source/basicide/basicmod.hxx
index f462927..b52a1c7 100644
--- a/basctl/source/basicide/basicmod.hxx
+++ b/basctl/source/basicide/basicmod.hxx
@@ -31,7 +31,7 @@ class Module : public SfxModule
 static Module* mpModule;
 public:
 Module ( ResMgr *pMgr, SfxObjectFactory *pObjFact) :
-SfxModule( pMgr, false, pObjFact, nullptr )
+SfxModule( pMgr, pObjFact, nullptr )
 { }
 public:
 static Module*& Get () { return mpModule; }
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 6e10d7c..7871675 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -35,7 +35,6 @@ class SfxObjectFactory;
 class ModalDialog;
 class SfxObjectFactory;
 class SfxModule;
-class SfxModuleArr_Impl;
 class SfxModule_Impl;
 class SfxSlotPool;
 struct SfxChildWinContextFactory;
@@ -54,7 +53,6 @@ class SFX2_DLLPUBLIC SfxModule : public SfxShell
 {
 private:
 ResMgr* pResMgr;
-boolbDummy : 1;
 SfxModule_Impl* pImpl;
 
 SAL_DLLPRIVATE void Construct_Impl();
@@ -68,8 +66,7 @@ private:
 
 public:
 
-SfxModule( ResMgr* pMgrP, bool bDummy,
-SfxObjectFactory* pFactoryP, ... );
+SfxModule( ResMgr* pMgrP, SfxObjectFactory* 
pFactoryP, ... );
 virtual ~SfxModule();
 
 ResMgr* GetResMgr();
@@ -96,7 +93,7 @@ public:
 static FieldUnitGetModuleFieldUnit( css::uno::Reference< 
css::frame::XFrame > const & i_frame );
 FieldUnit   GetFieldUnit() const;
 
-SAL_DLLPRIVATE static SfxModuleArr_Impl& GetModules_Impl();
+SAL_DLLPRIVATE static std::vector<SfxModule*>& GetModules_Impl();
 SAL_DLLPRIVATE static void DestroyModules_Impl();
 SAL_DLLPRIVATE SfxTbxCtrlFactArr_Impl* GetTbxCtrlFactories_Impl() const;
 SAL_DLLPRIVATE SfxStbCtrlFactArr_Impl* GetStbCtrlFactories_Impl() const;
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 359fb23..c45480f 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -130,7 +130,7 @@ void ScModule::InitInterface_Impl()
 }
 
 ScModule::ScModule( SfxObjectFactory* pFact ) :
-SfxModule( ResMgr::CreateResMgr( "sc" ), false, pFact, nullptr ),
+SfxModule( ResMgr::CreateResMgr( "sc" ), pFact, nullptr ),
 aIdleTimer("sc ScModule IdleTimer"),
 aSpellIdle("sc ScModule SpellIdle"),
 mpDragData(new ScDragData),
diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx
index 59f62db..9b54068 100644
--- a/sd/source/ui/app/sdmod.cxx
+++ b/sd/source/ui/app/sdmod.cxx
@@ -67,7 +67,7 @@ void SdModule::InitInterface_Impl()
 
 // Ctor
 SdModule::SdModule(SfxObjectFactory* pFact1, SfxObjectFactory* pFact2 )
-:   SfxModule( ResMgr::CreateResMgr("sd"), false,
+:   SfxModule( ResMgr::CreateResMgr("sd"),
   pFact1, pFact2, nullptr ),
 pTransferClip(nullptr),
 pTransferDrag(nullptr),
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index 2cedda8..bb1730d 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -42,41 +42,7 @@
 #include "childwinimpl.hxx"
 #include 
 
-class SfxModuleArr_Impl
-{
-typedef ::std::vector<SfxModule*> DataType;
-DataType maData;
-public:
-
-typedef DataType::iterator iterator;
-
-iterator begin()
-{
-return maData.begin();
-}
-
-void erase( const iterator& it )
-{
-maData.erase(it);
-}
-
-SfxModule* operator[] ( size_t i )
-{
-return maData[i];
-}
-
-void push_back( SfxModule* p )
-{
-maData.push_back(p);
-}
-
-size_t size() const
-{
-   

[Libreoffice-commits] core.git: editeng/source include/svl sc/source sd/source svl/source sw/inc sw/source

2016-06-04 Thread Mark Page
 editeng/source/editeng/impedit4.cxx   |2 -
 include/svl/style.hxx |5 
 include/svl/stylepool.hxx |8 ++-
 sc/source/core/data/patattr.cxx   |2 -
 sc/source/core/data/stlsheet.cxx  |2 -
 sc/source/filter/xml/xmlfonte.cxx |2 -
 sd/source/core/stlfamily.cxx  |   14 ++---
 sd/source/filter/ppt/pptin.cxx|2 -
 svl/source/items/style.cxx|4 +--
 svl/source/items/stylepool.cxx|   36 +-
 sw/inc/docstyle.hxx   |2 -
 sw/inc/istyleaccess.hxx   |8 +++
 sw/inc/unostyle.hxx   |5 +---
 sw/source/core/doc/swstylemanager.cxx |   30 ++--
 sw/source/core/txtnode/thints.cxx |4 +--
 sw/source/core/unocore/unoobj.cxx |2 -
 sw/source/core/unocore/unostyle.cxx   |   20 +-
 sw/source/uibase/app/docstyle.cxx |4 +--
 sw/source/uibase/uno/unotxdoc.cxx |4 +--
 19 files changed, 75 insertions(+), 81 deletions(-)

New commits:
commit 954f853c7b776719a6dfd5230d2be6ea3e948fcf
Author: Mark Page <aptit...@btconnect.com>
Date:   Fri Jun 3 08:13:31 2016 +0100

tdf#96099 Remove sfx std::shared_ptr typedefs

Removed SfxItemSet_Pointer_t and SfxStyleSheetIteratorPtr

Change-Id: Ibfa6a79809fdbbe2648dacc02625e620ceaf9bf0
Reviewed-on: https://gerrit.libreoffice.org/25851
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index f38fcbf..c8ef314 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -457,7 +457,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
 // StyleSheets...
 if ( GetStyleSheetPool() )
 {
-SfxStyleSheetIteratorPtr aSSSIterator = 
std::make_shared(GetStyleSheetPool(),
+std::shared_ptr aSSSIterator = 
std::make_shared(GetStyleSheetPool(),
 SfxStyleFamily::All);
 // fill aStyleSheetToIdMap
 sal_uInt32 nId = 1;
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index bbd9c88..197c938 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -182,9 +182,6 @@ private:
 friend class SfxStyleSheetBasePool;
 };
 
-typedef std::shared_ptr< SfxStyleSheetIterator > SfxStyleSheetIteratorPtr;
-
-
 class SfxStyleSheetBasePool_Impl;
 
 class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public 
comphelper::OWeakTypeObject
@@ -224,7 +221,7 @@ public:
 SfxItemPool&GetPool() { return rPool;}
 const SfxItemPool&  GetPool() const { return rPool;}
 
-virtual SfxStyleSheetIteratorPtr CreateIterator(SfxStyleFamily, sal_uInt16 
nMask);
+virtual std::shared_ptr 
CreateIterator(SfxStyleFamily, sal_uInt16 nMask);
 sal_uInt16  Count();
 SfxStyleSheetBase*  operator[](sal_uInt16 nIdx);
 
diff --git a/include/svl/stylepool.hxx b/include/svl/stylepool.hxx
index 461ba2f..71b0b57 100644
--- a/include/svl/stylepool.hxx
+++ b/include/svl/stylepool.hxx
@@ -31,8 +31,6 @@ class SVL_DLLPUBLIC StylePool
 private:
 std::unique_ptr pImpl;
 public:
-typedef std::shared_ptr SfxItemSet_Pointer_t;
-
 explicit StylePool( SfxItemSet* pIgnorableItems = nullptr );
 
 /** Insert a SfxItemSet into the style pool.
@@ -44,7 +42,7 @@ public:
 
 @return a shared pointer to the SfxItemSet
 */
-SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet );
+std::shared_ptr insertItemSet( const SfxItemSet& rSet );
 
 /** Create an iterator
 
@@ -69,7 +67,7 @@ public:
 
 virtual ~StylePool();
 
-static OUString nameOf( const SfxItemSet_Pointer_t& pSet );
+static OUString nameOf( const std::shared_ptr& pSet );
 };
 
 class SVL_DLLPUBLIC IStylePoolIteratorAccess
@@ -78,7 +76,7 @@ public:
 /** Delivers a shared pointer to the next SfxItemSet of the pool
 If there is no more SfxItemSet, the delivered share_pointer is empty.
 */
-virtual StylePool::SfxItemSet_Pointer_t getNext() = 0;
+virtual std::shared_ptr getNext() = 0;
 virtual ~IStylePoolIteratorAccess() {};
 };
 #endif
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index ba4476a..002decf 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1252,7 +1252,7 @@ void ScPatternAttr::UpdateStyleSheet(ScDocument* pDoc)
 //  Assumes that "Standard" is always the 1st entry!
 if (!pStyle)
 {
-SfxStyleSheetIteratorPtr pIter = 
pDoc->GetStyleSheetPool()->CreateIterator( SfxStyleFamily::Para, 
SFXSTYLEBIT_ALL );
+std::shared_ptr pIter = 
pDoc->GetStyleSheetPool()->CreateIterator( SfxStyleFamily::Para, 
SFXSTYLEBIT_ALL );

[Libreoffice-commits] core.git: include/vcl vcl/source

2016-05-23 Thread Mark Page
 include/vcl/gfxlink.hxx|   98 ++-
 vcl/source/gdi/gfxlink.cxx |  225 +
 2 files changed, 95 insertions(+), 228 deletions(-)

New commits:
commit d64431ac5a7bede7661c64e0bd6d46805841e704
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed May 18 08:33:33 2016 +0100

Simplify GfxLink using std::shared_ptr to clarify ownership

The functionality has not changed in this class, however the ABI
has changed (this class is DLL Public)

Change-Id: I11005f03e747d56cb59550e071755429390db7a7
Reviewed-on: https://gerrit.libreoffice.org/25081
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 3bdb4b7..aa0e8fe 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -25,56 +25,10 @@
 #include 
 #include 
 #include 
+#include 
 
 class SvStream;
 
-
-struct ImpBuffer
-{
-sal_uLong   mnRefCount;
-sal_uInt8*  mpBuffer;
-
-ImpBuffer( sal_uInt8* pBuf ) { mnRefCount = 1UL; mpBuffer = 
pBuf; }
-
-~ImpBuffer() { delete[] mpBuffer; }
-};
-
-
-struct ImpSwap
-{
-OUString   maURL;
-sal_uLong   mnDataSize;
-sal_uLong   mnRefCount;
-
-ImpSwap( sal_uInt8* pData, sal_uLong nDataSize );
-~ImpSwap();
-
-sal_uInt8*  GetData() const;
-
-boolIsSwapped() const { return maURL.getLength() > 0; }
-
-voidWriteTo( SvStream& rOStm ) const;
-};
-
-
-struct ImpGfxLink
-{
-MapMode maPrefMapMode;
-SizemaPrefSize;
-boolmbPrefMapModeValid;
-boolmbPrefSizeValid;
-
-ImpGfxLink() :
-maPrefMapMode(),
-maPrefSize(),
-mbPrefMapModeValid( false ),
-mbPrefSizeValid( false )
-{}
-};
-
-//#endif // __PRIVATE
-
-
 enum GfxLinkType
 {
 GFX_LINK_TYPE_NONE  = 0,
@@ -88,7 +42,6 @@ enum GfxLinkType
 GFX_LINK_TYPE_NATIVE_PCT= 8,// Don't forget to update the 
following defines
 GFX_LINK_TYPE_NATIVE_SVG= 9,// Don't forget to update the 
following defines
 GFX_LINK_TYPE_NATIVE_MOV= 10,   // Don't forget to update the 
following defines
-// #i15508# added BMP type support
 GFX_LINK_TYPE_NATIVE_BMP= 11,   // Don't forget to update the 
following defines
 GFX_LINK_TYPE_USER  = 0x
 };
@@ -96,49 +49,58 @@ enum GfxLinkType
 #define GFX_LINK_FIRST_NATIVE_IDGFX_LINK_TYPE_NATIVE_GIF
 #define GFX_LINK_LAST_NATIVE_ID GFX_LINK_TYPE_NATIVE_BMP
 
-
-struct ImpBuffer;
-struct ImpSwap;
-struct ImpGfxLink;
 class Graphic;
 
 class VCL_DLLPUBLIC GfxLink
 {
 private:
 
-GfxLinkType meType;
-ImpBuffer*  mpBuf;
-ImpSwap*mpSwap;
-sal_uInt32  mnBufSize;
-sal_uInt32  mnUserId;
-ImpGfxLink* mpImpData;
+struct SwapOutData
+{
+SwapOutData(const OUString );
+~SwapOutData();
 
-SAL_DLLPRIVATE void ImplCopy( const GfxLink& rGfxLink );
+OUString maURL; // File is removed in the destructor
 
+};
+
+GfxLinkType meType = GFX_LINK_TYPE_NONE;
+sal_uInt32  mnUserId = 0;
+
+std::shared_ptr mpSwapInData;
+std::shared_ptr mpSwapOutData;
+
+sal_uInt32  mnSwapInDataSize = 0;
+MapMode maPrefMapMode;
+SizemaPrefSize;
+boolmbPrefMapModeValid = false;
+boolmbPrefSizeValid = false;
+
+SAL_DLLPRIVATE std::shared_ptr GetSwapInData() const;
 public:
 GfxLink();
-GfxLink( const GfxLink& );
+
+// pBuff = The Graphic data. This class takes 
ownership of this
 GfxLink( sal_uInt8* pBuf, sal_uInt32 nBufSize, 
GfxLinkType nType );
 ~GfxLink();
 
-GfxLink&operator=( const GfxLink& );
-boolIsEqual( const GfxLink& ) const;
+boolIsEqual( const GfxLink& ) const;
 
 GfxLinkType GetType() const { return meType;}
 
 voidSetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; }
 sal_uInt32  GetUserId() const { return mnUserId; }
 
-sal_uInt32  GetDataSize() const { return mnBufSize;}
+sal_uInt32  GetDataSize() const { return mnSwapInDataSize;}
 const sal_uInt8*GetData() const;
 
-const Size& GetPrefSize() const { return mpImpData->maPrefSize;}
+const Size& GetPrefSize() const { return maPrefSize;}
 voidSetPrefSize( const Size& rPrefSize );
-boolIsPrefSizeValid() { return mpImpData->mbPrefSizeValid;}
+boolIsPrefSizeValid() { return mbPrefSizeValid;}
 
-const MapMode& 

[Libreoffice-commits] core.git: vcl/source

2016-05-09 Thread Mark Page
 vcl/source/filter/wmf/emfwr.cxx  |   15 ++--
 vcl/source/filter/wmf/emfwr.hxx  |3 
 vcl/source/filter/wmf/enhwmf.cxx |   33 +
 vcl/source/filter/wmf/winmtf.cxx |  132 +++
 vcl/source/filter/wmf/winmtf.hxx |  102 ++
 vcl/source/filter/wmf/winwmf.cxx |   46 +
 6 files changed, 120 insertions(+), 211 deletions(-)

New commits:
commit c91672c1719dd7a981e2d2e87cfebefe4c72a572
Author: Mark Page <aptit...@btconnect.com>
Date:   Wed May 4 10:28:01 2016 +0100

Update the wmf filter to simplify object ownership

Changed the GDI style structures to use inheritance,
 thus object deletion no longer requires a static_cast

Used std::unique_ptr for GDI objects to enforce object ownership

Modified the WMF Writer to use std::vector, instead of a
 raw pointer array when processing handles

Change-Id: Ic635ff9d641427b901eb18468529ea6367859b53
Reviewed-on: https://gerrit.libreoffice.org/24634
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Michael Stahl <mst...@redhat.com>

diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 921d5fd..083bd77 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -293,8 +293,7 @@ bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf)
 maVDev->SetMapMode( rMtf.GetPrefMapMode() );
 // don't work with pixel as destination map mode -> higher resolution 
preferable
 maDestMapMode.SetMapUnit( MAP_100TH_MM );
-mpHandlesUsed = new bool[ MAXHANDLES ];
-memset( mpHandlesUsed, 0, MAXHANDLES * sizeof( bool ) );
+mHandlesUsed = std::vector(MAXHANDLES, false);
 mnHandleCount = mnRecordCount = mnRecordPos = mnRecordPlusPos = 0;
 mbRecordOpen = mbRecordPlusOpen = false;
 mbLineChanged = mbFillChanged = mbTextChanged = false;
@@ -365,7 +364,7 @@ bool EMFWriter::WriteEMF(const GDIMetaFile& rMtf)
 .WriteInt32( aMtfSizeLog.Width() * 10 ).WriteInt32( 
aMtfSizeLog.Height() * 10 ); //use [MS-EMF 2.2.11] HeaderExtension2 Object
 
 m_rStm.Seek( nEndPos );
-delete[] mpHandlesUsed;
+mHandlesUsed.clear();
 
 return( m_rStm.GetError() == ERRCODE_NONE );
 }
@@ -374,11 +373,11 @@ sal_uLong EMFWriter::ImplAcquireHandle()
 {
 sal_uLong nHandle = HANDLE_INVALID;
 
-for( sal_uLong i = 0; i < MAXHANDLES && ( HANDLE_INVALID == nHandle ); i++ 
)
+for( sal_uLong i = 0; i < mHandlesUsed.size() && ( HANDLE_INVALID == 
nHandle ); i++ )
 {
-if( !mpHandlesUsed[ i ] )
+if( !mHandlesUsed[ i ] )
 {
-mpHandlesUsed[ i ] = true;
+mHandlesUsed[ i ] = true;
 
 if( ( nHandle = i ) == mnHandleCount )
 mnHandleCount++;
@@ -391,8 +390,8 @@ sal_uLong EMFWriter::ImplAcquireHandle()
 
 void EMFWriter::ImplReleaseHandle( sal_uLong nHandle )
 {
-DBG_ASSERT( nHandle && ( nHandle < MAXHANDLES ), "Handle out of range" );
-mpHandlesUsed[ nHandle - 1 ] = false;
+DBG_ASSERT( nHandle && ( nHandle < mHandlesUsed.size() ), "Handle out of 
range" );
+mHandlesUsed[ nHandle - 1 ] = false;
 }
 
 void EMFWriter::ImplBeginRecord( sal_uInt32 nType )
diff --git a/vcl/source/filter/wmf/emfwr.hxx b/vcl/source/filter/wmf/emfwr.hxx
index 79491fc..41d2684 100644
--- a/vcl/source/filter/wmf/emfwr.hxx
+++ b/vcl/source/filter/wmf/emfwr.hxx
@@ -36,7 +36,7 @@ private:
 ScopedVclPtr maVDev;
 MapMode maDestMapMode;
 SvStream& m_rStm;
-bool*   mpHandlesUsed;
+std::vector   mHandlesUsed;
 sal_uLong   mnHandleCount;
 sal_uLong   mnRecordCount;
 sal_uLong   mnRecordPos;
@@ -92,7 +92,6 @@ public:
 explicit EMFWriter(SvStream )
 : maVDev( VclPtr::Create() )
 , m_rStm(rStream)
-, mpHandlesUsed(nullptr)
 , mnHandleCount(0)
 , mnRecordCount(0)
 , mnRecordPos(0)
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 1a0e7de..ed02537 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "winmtf.hxx"
 
@@ -401,7 +402,7 @@ bool ImplReadRegion( tools::PolyPolygon& rPolyPoly, 
SvStream& rStream, sal_uInt3
 } // anonymous namespace
 
 EnhWMFReader::EnhWMFReader(SvStream& rStream,GDIMetaFile& 
rGDIMetaFile,FilterConfigItem* pConfigItem)
-: WinMtf(new WinMtfOutput(rGDIMetaFile), rStream , pConfigItem)
+: WinMtf(rGDIMetaFile, rStream , pConfigItem)
 , bRecordPath(false)
 , nRecordCount(0)
 , bEMFPlus(false)
@@ -702,26 +703,26 @@ bool EnhWMFReader::ReadEnhWMF()
 switch( nRecType )
 {
 case EMR_POLYBEZIERTO :
-ReadAndDrawPolygon( [] 

[Libreoffice-commits] core.git: vcl/source

2016-05-03 Thread Mark Page
 vcl/source/filter/wmf/winmtf.cxx |   32 ++--
 vcl/source/filter/wmf/winmtf.hxx |2 +-
 2 files changed, 15 insertions(+), 19 deletions(-)

New commits:
commit e76d458422b0f0f713cc17bf47ca94c33ac570a7
Author: Mark Page <aptit...@btconnect.com>
Date:   Fri Apr 29 08:33:13 2016 +0100

Change vGDIObj pointer to unique_ptr to reduce WinMtfOutput complexity

Change-Id: Ia81d3b30a874c2e722f7b836db9fab0be2d6e27b
Reviewed-on: https://gerrit.libreoffice.org/24488
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 5c22b26..ca8141f 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #if OSL_DEBUG_LEVEL > 1
 #define EMFP_DEBUG(x) x
@@ -531,19 +532,23 @@ tools::PolyPolygon& WinMtfOutput::ImplMap( 
tools::PolyPolygon& rPolyPolygon )
 
 void WinMtfOutput::SelectObject( sal_Int32 nIndex )
 {
-GDIObj* pGDIObj = nullptr;
+std::unique_ptr stock_object;
+GDIObj *pGDIObj = nullptr;
 
 if ( nIndex & ENHMETA_STOCK_OBJECT )
-pGDIObj = new GDIObj();
+{
+stock_object = o3tl::make_unique();
+pGDIObj = stock_object.get();
+}
 else
 {
 nIndex &= 0x;   // safety check: don't allow index to be > 
65535
 
 if ( (sal_uInt32)nIndex < vGDIObj.size() )
-pGDIObj = vGDIObj[ nIndex ];
+pGDIObj = vGDIObj[ nIndex ].get();
 }
 
-if( pGDIObj == nullptr )
+if( !pGDIObj )
 return;
 
 if ( nIndex & ENHMETA_STOCK_OBJECT )
@@ -616,8 +621,6 @@ void WinMtfOutput::SelectObject( sal_Int32 nIndex )
 break;  //  -Wall many options not handled.
 }
 }
-if ( nIndex & ENHMETA_STOCK_OBJECT )
-delete pGDIObj;
 }
 
 
@@ -648,7 +651,7 @@ void WinMtfOutput::SetTextAlign( sal_uInt32 nAlign )
 
 void WinMtfOutput::ImplResizeObjectArry( sal_uInt32 nNewEntrys )
 {
-vGDIObj.resize(nNewEntrys, nullptr);
+vGDIObj.resize(nNewEntrys);
 }
 
 void WinMtfOutput::ImplDrawClippedPolyPolygon( const tools::PolyPolygon& 
rPolyPoly )
@@ -702,13 +705,13 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, 
void* pStyle )
 sal_uInt32 nIndex;
 for ( nIndex = 0; nIndex < vGDIObj.size(); nIndex++ )
 {
-if ( vGDIObj[ nIndex ] == nullptr )
+if ( !vGDIObj[ nIndex ] )
 break;
 }
 if ( nIndex == vGDIObj.size() )
 ImplResizeObjectArry( vGDIObj.size() + 16 );
 
-vGDIObj[ nIndex ] = new GDIObj( eType, pStyle );
+vGDIObj[ nIndex ] = o3tl::make_unique( eType, pStyle );
 }
 
 void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* 
pStyle )
@@ -744,10 +747,7 @@ void WinMtfOutput::CreateObject( sal_Int32 nIndex, 
GDIObjectType eType, void* pS
 if ( (sal_uInt32)nIndex >= vGDIObj.size() )
 ImplResizeObjectArry( nIndex + 16 );
 
-if ( vGDIObj[ nIndex ] != nullptr )
-delete vGDIObj[ nIndex ];
-
-vGDIObj[ nIndex ] = new GDIObj( eType, pStyle );
+vGDIObj[ nIndex ] = o3tl::make_unique( eType, pStyle );
 }
 else
 {
@@ -776,8 +776,7 @@ void WinMtfOutput::DeleteObject( sal_Int32 nIndex )
 {
 if ( (sal_uInt32)nIndex < vGDIObj.size() )
 {
-delete vGDIObj[ nIndex ];
-vGDIObj[ nIndex ] = nullptr;
+vGDIObj[ nIndex ].reset();
 }
 }
 }
@@ -883,9 +882,6 @@ WinMtfOutput::~WinMtfOutput()
 mpGDIMetaFile->SetPrefSize( Size( mnDevWidth, mnDevHeight ) );
 else
 mpGDIMetaFile->SetPrefSize( mrclFrame.GetSize() );
-
-for ( size_t i = 0; i < vGDIObj.size(); i++ )
-delete vGDIObj[ i ];
 }
 
 void WinMtfOutput::UpdateClipRegion()
diff --git a/vcl/source/filter/wmf/winmtf.hxx b/vcl/source/filter/wmf/winmtf.hxx
index 51aba43..db4aa01 100644
--- a/vcl/source/filter/wmf/winmtf.hxx
+++ b/vcl/source/filter/wmf/winmtf.hxx
@@ -551,7 +551,7 @@ class WinMtfOutput
 RasterOpmeLatestRasterOp;
 RasterOpmeRasterOp;
 
-std::vector< GDIObj* > vGDIObj;
+std::vector< std::unique_ptr > vGDIObj;
 
 Point   maActPos;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits