[Libreoffice-commits] .: 2 commits - svx/source

Ivan Timofeev ivantimofeev at kemper.freedesktop.org
Sun Nov 6 21:19:34 PST 2011


 svx/source/unodraw/UnoGraphicExporter.cxx |   84 ++++++++++++------------------
 1 file changed, 36 insertions(+), 48 deletions(-)

New commits:
commit da5ec5d1e0823cf53f3f70c074cd3d314b89d4e3
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Mon Nov 7 09:01:50 2011 +0400

    use boost::scoped_ptr

diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 0b60214..c0b66a4 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -724,15 +724,14 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
                 Size aNewSize;
 
                 // create a view
-                SdrView*        pView;
-
+                boost::scoped_ptr< SdrView > pView;
                 if( PTR_CAST( FmFormModel, mpDoc ) )
                 {
-                    pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev );
+                    pView.reset(new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev ));
                 }
                 else
                 {
-                    pView = new SdrView( mpDoc, &aVDev );
+                    pView.reset(new SdrView( mpDoc, &aVDev ));
                 }
 
                 pView->SetBordVisible( sal_False );
@@ -773,7 +772,6 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
                 aGraphic = Graphic(aMtf);
 
                 pView->HideSdrPage();
-                delete pView;
 
                 if( rSettings.mbTranslucent )
                 {
commit bc858110c2c8c7292a19ed849fd190b2d4aad0b7
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Mon Nov 7 08:57:49 2011 +0400

    cppcheck: drop redundant check

diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 956773a..0b60214 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -739,51 +739,41 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
                 pView->SetPageVisible( sal_False );
                 pView->ShowSdrPage( pPage );
 
-                if ( pView && pPage )
-                {
-                    pView->SetBordVisible( sal_False );
-                    pView->SetPageVisible( sal_False );
-                    pView->ShowSdrPage( pPage );
-
-                    const Point aNewOrg( pPage->GetLftBorder(), pPage->GetUppBorder() );
-                    aNewSize = Size( aSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder(),
-                                          aSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder() );
-                    const Rectangle aClipRect( aNewOrg, aNewSize );
-                    MapMode         aVMap( aMap );
-
-                    aVDev.Push();
-                    aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
-                    aVDev.SetRelativeMapMode( aVMap );
-                    aVDev.IntersectClipRegion( aClipRect );
-
-                    // Use new StandardCheckVisisbilityRedirector
-                    ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
-
-                    pView->CompleteRedraw(&aVDev, Region(Rectangle(Point(), aNewSize)), &aRedirector);
-
-                    aVDev.Pop();
-
-                    aMtf.Stop();
-                    aMtf.WindStart();
-                    aMtf.SetPrefMapMode( aMap );
-                    aMtf.SetPrefSize( aNewSize );
-
-                    // AW: Here the current version was filtering out the META_CLIPREGION_ACTIONs
-                    // from the metafile. I asked some other developers why this was done, but no
-                    // one knew a direct reason. Since it's in for long time, it may be an old
-                    // piece of code. MetaFiles save and load ClipRegions with polygons with preserving
-                    // the polygons, so a resolution-indepent roundtrip is supported. Removed this
-                    // code since it destroys some MetaFiles where ClipRegions are used. Anyways,
-                    // just filtering them out is a hack, at least the encapsulated content would need
-                    // to be clipped geometrically.
-                    aGraphic = Graphic(aMtf);
-                }
-
-                if ( pView )
-                {
-                    pView->HideSdrPage();
-                    delete pView;
-                }
+                const Point aNewOrg( pPage->GetLftBorder(), pPage->GetUppBorder() );
+                aNewSize = Size( aSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder(),
+                                 aSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder() );
+                const Rectangle aClipRect( aNewOrg, aNewSize );
+                MapMode         aVMap( aMap );
+
+                aVDev.Push();
+                aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
+                aVDev.SetRelativeMapMode( aVMap );
+                aVDev.IntersectClipRegion( aClipRect );
+
+                // Use new StandardCheckVisisbilityRedirector
+                ImplExportCheckVisisbilityRedirector aRedirector( mpCurrentPage );
+
+                pView->CompleteRedraw(&aVDev, Region(Rectangle(Point(), aNewSize)), &aRedirector);
+
+                aVDev.Pop();
+
+                aMtf.Stop();
+                aMtf.WindStart();
+                aMtf.SetPrefMapMode( aMap );
+                aMtf.SetPrefSize( aNewSize );
+
+                // AW: Here the current version was filtering out the META_CLIPREGION_ACTIONs
+                // from the metafile. I asked some other developers why this was done, but no
+                // one knew a direct reason. Since it's in for long time, it may be an old
+                // piece of code. MetaFiles save and load ClipRegions with polygons with preserving
+                // the polygons, so a resolution-indepent roundtrip is supported. Removed this
+                // code since it destroys some MetaFiles where ClipRegions are used. Anyways,
+                // just filtering them out is a hack, at least the encapsulated content would need
+                // to be clipped geometrically.
+                aGraphic = Graphic(aMtf);
+
+                pView->HideSdrPage();
+                delete pView;
 
                 if( rSettings.mbTranslucent )
                 {


More information about the Libreoffice-commits mailing list