[Libreoffice-commits] core.git: Branch 'feature/vclref' - sd/source sw/source

Michael Meeks michael.meeks at collabora.com
Mon Mar 16 14:28:36 PDT 2015


 sd/source/ui/slideshow/slideshowimpl.cxx |    3 ++-
 sd/source/ui/unoidl/unomodel.cxx         |    4 ++--
 sw/source/core/view/printdata.cxx        |    5 +++--
 sw/source/uibase/uno/unotxdoc.cxx        |   16 ++++++++--------
 4 files changed, 15 insertions(+), 13 deletions(-)

New commits:
commit bd63515a092e948894d65f8cc27568e7596f7bfe
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Mon Mar 16 21:32:18 2015 +0000

    sw, sd: more toolkit API cleanup.
    
    Change-Id: I2015f517695682f17fe5c03a8df0171a427717bf

diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 40ebdd6..ab11f01 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -3363,7 +3363,8 @@ void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const
         Reference< XWindow > xWindow;
         if( rValue >>= xWindow )
         {
-            mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : 0;
+            mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow )
+                                          : VclPtr<vcl::Window>();
             return;
         }
     }
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b461f87..537f477 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1875,8 +1875,8 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
 
         if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) )
         {
-            VCLXDevice*     pDevice = VCLXDevice::GetImplementation( xRenderDevice );
-            OutputDevice*   pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+            VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+            VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >();
 
             if( pOut )
             {
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index ae395f7..bb1a4996 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -480,11 +480,12 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< bea
     uno::Any aVal( getValue( "RenderDevice" ) );
     aVal >>= xRenderDevice;
 
-    OutputDevice* pOut = 0;
+    VclPtr< OutputDevice > pOut;
     if (xRenderDevice.is())
     {
         VCLXDevice*     pDevice = VCLXDevice::GetImplementation( xRenderDevice );
-        pOut = pDevice ? pDevice->GetOutputDevice() : 0;
+        if (pDevice)
+            pOut = pDevice->GetOutputDevice();
     }
     bChanged = bChanged || (pOut != m_pLast);
     if( pOut )
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index ea3683f..311335d 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2316,9 +2316,9 @@ Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName
     return aAny;
 }
 
-static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions )
+static VclPtr< OutputDevice > lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions )
 {
-    OutputDevice *pOut = 0;
+    VclPtr< OutputDevice > pOut;
 
     uno::Any aAny( rPrintUIOptions.getValue( "RenderDevice" ));
     uno::Reference< awt::XDevice >  xRenderDevice;
@@ -2326,7 +2326,7 @@ static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptio
     if (xRenderDevice.is())
     {
         VCLXDevice*     pDevice = VCLXDevice::GetImplementation( xRenderDevice );
-        pOut = pDevice ? pDevice->GetOutputDevice() : 0;
+        pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >();
     }
 
     return pOut;
@@ -2515,7 +2515,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
     if (bIsSwSrcView)
     {
         SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView);
-        OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+        VclPtr< OutputDevice> pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
         nRet = rSwSrcView.PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ );
     }
     else
@@ -2630,7 +2630,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
             const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 );
             if (nPostItMode != POSTITS_NONE)
             {
-                OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+                VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
                 m_pRenderData->CreatePostItData( pDoc, pViewShell->GetViewOptions(), pOutDev );
             }
 
@@ -2754,7 +2754,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
             // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this
             // case we won't get an OutputDevice here, but then the caller also has no need
             // for the correct PageSisze right now...
-            Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ));
+            VclPtr< Printer > pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ).get());
             if (pPrinter)
             {
                 // HTML source view and prospect adapt to the printer's paper size
@@ -2972,7 +2972,7 @@ void SAL_CALL SwXTextDocument::render(
             if (bIsSwSrcView)
             {
                 SwSrcView& rSwSrcView = dynamic_cast<SwSrcView&>(*pView);
-                OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+                VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
                 rSwSrcView.PrintSource(pOutDev, nRenderer + 1, false);
             }
             else
@@ -2994,7 +2994,7 @@ void SAL_CALL SwXTextDocument::render(
                 }
 
                 // get output device to use
-                OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
+                VclPtr< OutputDevice > pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
 
                 if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions())
                 {


More information about the Libreoffice-commits mailing list