[Libreoffice-commits] core.git: Branch 'feature/vclref' - include/toolkit toolkit/source

Michael Meeks michael.meeks at collabora.com
Sat Mar 14 16:24:36 PDT 2015


 include/toolkit/controls/accessiblecontrolcontext.hxx |    3 
 include/toolkit/helper/vclunohelper.hxx               |    9 -
 toolkit/source/awt/vclxwindows.cxx                    |  103 ++++++++----------
 toolkit/source/controls/accessiblecontrolcontext.cxx  |   11 +
 toolkit/source/helper/vclunohelper.cxx                |   12 +-
 5 files changed, 69 insertions(+), 69 deletions(-)

New commits:
commit 9647d0c3b3d89ed35b6d7e9801c0638f2c6b688e
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Sat Mar 14 23:15:17 2015 +0000

    toolkit: more VclPtr pieces.
    
    Change-Id: I0393d906657b94cc547986a2165960a85d36cf48

diff --git a/include/toolkit/controls/accessiblecontrolcontext.hxx b/include/toolkit/controls/accessiblecontrolcontext.hxx
index 928c37b..105e2cd 100644
--- a/include/toolkit/controls/accessiblecontrolcontext.hxx
+++ b/include/toolkit/controls/accessiblecontrolcontext.hxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/awt/XWindow.hpp>
+#include <vcl/vclptr.hxx>
 
 namespace vcl { class Window; }
 
@@ -117,7 +118,7 @@ namespace toolkit
         // stops listening at the control model
         void stopModelListening( );
 
-        vcl::Window* implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const;
+        VclPtr< vcl::Window > implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const;
     };
 
 
diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx
index e8a6c9b..5cc1d38 100644
--- a/include/toolkit/helper/vclunohelper.hxx
+++ b/include/toolkit/helper/vclunohelper.hxx
@@ -56,11 +56,12 @@ namespace com { namespace sun { namespace star { namespace awt {
 #include <vcl/bitmapex.hxx>
 #include <vcl/region.hxx>
 #include <vcl/metric.hxx>
+#include <vcl/vclptr.hxx>
+#include <vcl/window.hxx>
 #include <tools/mapunit.hxx>
 #include <tools/fldunit.hxx>
 #include <tools/poly.hxx>
 
-namespace vcl { class Window; }
 class OutputDevice;
 class MouseEvent;
 class KeyEvent;
@@ -79,9 +80,9 @@ public:
     static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>    CreateBitmap( const BitmapEx& rBitmap );
 
     // Window
-    static vcl::Window*                                                          GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
-    static vcl::Window*                                                          GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 );
-    static vcl::Window*                                                          GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
+    static VclPtr< vcl::Window >                                                          GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
+    static VclPtr< vcl::Window >                                                          GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 );
+    static VclPtr< vcl::Window >                                                          GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
     static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>    GetInterface( vcl::Window* pWindow );
 
     // OutputDevice
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 51f49da..c8e320f 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -5154,7 +5154,7 @@ void VCLXTimeField::setTime( const util::Time& aTime ) throw(::com::sun::star::u
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
     {
         pTimeField->SetTime( aTime );
@@ -5171,7 +5171,7 @@ util::Time VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeExceptio
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         return pTimeField->GetTime().GetUNOTime();
     else
@@ -5182,7 +5182,7 @@ void VCLXTimeField::setMin( const util::Time& aTime ) throw(::com::sun::star::un
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         pTimeField->SetMin( aTime );
 }
@@ -5191,7 +5191,7 @@ util::Time VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         return pTimeField->GetMin().GetUNOTime();
     else
@@ -5202,7 +5202,7 @@ void VCLXTimeField::setMax( const util::Time& aTime ) throw(::com::sun::star::un
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         pTimeField->SetMax( aTime );
 }
@@ -5211,7 +5211,7 @@ util::Time VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         return pTimeField->GetMax().GetUNOTime();
     else
@@ -5222,7 +5222,7 @@ void VCLXTimeField::setFirst( const util::Time& aTime ) throw(::com::sun::star::
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         pTimeField->SetFirst( aTime );
 }
@@ -5231,7 +5231,7 @@ util::Time VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         return pTimeField->GetFirst().GetUNOTime();
     else
@@ -5242,7 +5242,7 @@ void VCLXTimeField::setLast( const util::Time& aTime ) throw(::com::sun::star::u
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         pTimeField->SetLast( aTime );
 }
@@ -5251,7 +5251,7 @@ util::Time VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         return pTimeField->GetLast().GetUNOTime();
     else
@@ -5262,7 +5262,7 @@ void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException, st
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     if ( pTimeField )
         pTimeField->SetEmptyTime();
 }
@@ -5271,7 +5271,7 @@ sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException,
 {
     SolarMutexGuard aGuard;
 
-    TimeField* pTimeField = static_cast<TimeField*>(GetWindow());
+    VclPtr< TimeField > pTimeField = GetAs< TimeField >();
     return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
 }
 
@@ -5301,8 +5301,8 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
             {
                 if ( bVoid )
                 {
-                    static_cast<TimeField*>(GetWindow())->EnableEmptyFieldValue( true );
-                    static_cast<TimeField*>(GetWindow())->SetEmptyFieldValue();
+                    GetAs< TimeField >()->EnableEmptyFieldValue( true );
+                    GetAs< TimeField >()->SetEmptyFieldValue();
                 }
                 else
                 {
@@ -5330,14 +5330,14 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
             {
                 sal_Int16 n = sal_Int16();
                 if ( Value >>= n )
-                    static_cast<TimeField*>(GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
+                    GetAs< TimeField >()->SetExtFormat( (ExtTimeFieldFormat) n );
             }
             break;
             case BASEPROPERTY_ENFORCE_FORMAT:
             {
                 bool bEnforce( true );
                 OSL_VERIFY( Value >>= bEnforce );
-                static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce );
+                GetAs< TimeField >()->EnforceValidValue( bEnforce );
             }
             break;
             default:
@@ -5375,7 +5375,7 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const ::com::sun:
             break;
             case BASEPROPERTY_ENFORCE_FORMAT:
             {
-                aProp <<= static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( );
+                aProp <<= GetAs< TimeField >()->IsEnforceValidValue( );
             }
             break;
             default:
@@ -5528,7 +5528,7 @@ void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::Run
 {
     SolarMutexGuard aGuard;
 
-    NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+    VclPtr< NumericField > pNumericField = GetAs< NumericField >();
     if ( pNumericField )
         pNumericField->SetFirst(
             (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5538,7 +5538,7 @@ double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeExceptio
 {
     SolarMutexGuard aGuard;
 
-    NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+    VclPtr< NumericField > pNumericField = GetAs< NumericField >();
     return pNumericField
         ? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
         : 0;
@@ -5548,7 +5548,7 @@ void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::Runt
 {
     SolarMutexGuard aGuard;
 
-    NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+    VclPtr< NumericField > pNumericField = GetAs< NumericField >();
     if ( pNumericField )
         pNumericField->SetLast(
             (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5558,7 +5558,7 @@ double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException
 {
     SolarMutexGuard aGuard;
 
-    NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+    VclPtr< NumericField > pNumericField = GetAs< NumericField >();
     return pNumericField
         ? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
         : 0;
@@ -5579,7 +5579,7 @@ void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::
 {
     SolarMutexGuard aGuard;
 
-    NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+    VclPtr< NumericField > pNumericField = GetAs< NumericField >();
     if ( pNumericField )
         pNumericField->SetSpinSize(
             (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
@@ -5589,7 +5589,7 @@ double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeExcep
 {
     SolarMutexGuard aGuard;
 
-    NumericField* pNumericField = static_cast<NumericField*>(GetWindow());
+    VclPtr< NumericField > pNumericField = GetAs< NumericField >();
     return pNumericField
         ? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
         : 0;
@@ -5631,8 +5631,8 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
             {
                 if ( bVoid )
                 {
-                    static_cast<NumericField*>(GetWindow())->EnableEmptyFieldValue( true );
-                    static_cast<NumericField*>(GetWindow())->SetEmptyFieldValue();
+                    GetAs< NumericField >()->EnableEmptyFieldValue( true );
+                    GetAs< NumericField >()->SetEmptyFieldValue();
                 }
                 else
                 {
@@ -5674,7 +5674,7 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
             {
                 bool b = bool();
                 if ( Value >>= b )
-                     static_cast<NumericField*>(GetWindow())->SetUseThousandSep( b );
+                     GetAs< NumericField >()->SetUseThousandSep( b );
             }
             break;
             default:
@@ -5718,7 +5718,7 @@ void VCLXNumericField::setProperty( const OUString& PropertyName, const ::com::s
             break;
             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
             {
-                aProp <<= static_cast<NumericField*>(GetWindow())->IsUseThousandSep();
+                aProp <<= GetAs< NumericField >()->IsUseThousandSep();
             }
             break;
             default:
@@ -5786,7 +5786,7 @@ MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::u
 
 MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException)
 {
-    MetricField *pField = static_cast<MetricField *>(GetWindow());
+    VclPtr< MetricField > pField = GetAs< MetricField >();
     if (!pField)
         throw ::com::sun::star::uno::RuntimeException();
     return pField;
@@ -5924,21 +5924,21 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const ::com::su
             {
                 bool b = false;
                 if ( Value >>= b )
-                     static_cast<NumericField*>(GetWindow())->SetUseThousandSep( b );
+                     GetAs< NumericField >()->SetUseThousandSep( b );
             }
             break;
             case BASEPROPERTY_UNIT:
             {
                 sal_uInt16 nVal = 0;
                 if ( Value >>= nVal )
-                    static_cast<MetricField*>(GetWindow())->SetUnit( (FieldUnit) nVal );
+                    GetAs< MetricField >()->SetUnit( (FieldUnit) nVal );
                 break;
             }
             case BASEPROPERTY_CUSTOMUNITTEXT:
             {
                 OUString aStr;
                 if ( Value >>= aStr )
-                    static_cast<MetricField*>(GetWindow())->SetCustomUnitText( aStr );
+                    GetAs< MetricField >()->SetCustomUnitText( aStr );
                 break;
             }
             default:
@@ -5962,13 +5962,13 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const ::com::su
         switch ( nPropType )
         {
             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
-                aProp <<= static_cast<NumericField*>(GetWindow())->IsUseThousandSep();
+                aProp <<= GetAs< NumericField >()->IsUseThousandSep();
                 break;
             case BASEPROPERTY_UNIT:
-                aProp <<= (sal_uInt16) (static_cast<MetricField*>(GetWindow())->GetUnit());
+                aProp <<= (sal_uInt16) (GetAs< MetricField >()->GetUnit());
                 break;
             case BASEPROPERTY_CUSTOMUNITTEXT:
-                aProp <<= OUString( static_cast<MetricField*>(GetWindow())->GetCustomUnitText() );
+                aProp <<= OUString( GetAs< MetricField >()->GetCustomUnitText() );
                 break;
             default:
             {
@@ -6124,7 +6124,7 @@ void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::Ru
 {
     SolarMutexGuard aGuard;
 
-    LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+    VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
     if ( pCurrencyField )
         pCurrencyField->SetFirst(
             ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6134,7 +6134,7 @@ double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeExcepti
 {
     SolarMutexGuard aGuard;
 
-    LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+    VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
     return pCurrencyField
         ? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
         : 0;
@@ -6144,7 +6144,7 @@ void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::Run
 {
     SolarMutexGuard aGuard;
 
-    LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+    VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
     if ( pCurrencyField )
         pCurrencyField->SetLast(
             ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6154,7 +6154,7 @@ double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeExceptio
 {
     SolarMutexGuard aGuard;
 
-    LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+    VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
     return pCurrencyField
         ? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
         : 0;
@@ -6164,7 +6164,7 @@ void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno:
 {
     SolarMutexGuard aGuard;
 
-    LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+    VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
     if ( pCurrencyField )
         pCurrencyField->SetSpinSize(
             ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
@@ -6174,7 +6174,7 @@ double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeExce
 {
     SolarMutexGuard aGuard;
 
-    LongCurrencyField* pCurrencyField = static_cast<LongCurrencyField*>(GetWindow());
+    VclPtr< LongCurrencyField > pCurrencyField = GetAs< LongCurrencyField >();
     return pCurrencyField
         ? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
         : 0;
@@ -6227,8 +6227,8 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
             {
                 if ( bVoid )
                 {
-                    static_cast<LongCurrencyField*>(GetWindow())->EnableEmptyFieldValue( true );
-                    static_cast<LongCurrencyField*>(GetWindow())->SetEmptyFieldValue();
+                    GetAs< LongCurrencyField >()->EnableEmptyFieldValue( true );
+                    GetAs< LongCurrencyField >()->SetEmptyFieldValue();
                 }
                 else
                 {
@@ -6270,14 +6270,14 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
             {
                 OUString aString;
                 if ( Value >>= aString )
-                     static_cast<LongCurrencyField*>(GetWindow())->SetCurrencySymbol( aString );
+                     GetAs< LongCurrencyField >()->SetCurrencySymbol( aString );
             }
             break;
             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
             {
                 bool b = bool();
                 if ( Value >>= b )
-                     static_cast<LongCurrencyField*>(GetWindow())->SetUseThousandSep( b );
+                     GetAs< LongCurrencyField >()->SetUseThousandSep( b );
             }
             break;
             default:
@@ -6321,12 +6321,12 @@ void VCLXCurrencyField::setProperty( const OUString& PropertyName, const ::com::
             break;
             case BASEPROPERTY_CURRENCYSYMBOL:
             {
-                aProp <<= OUString( static_cast<LongCurrencyField*>(GetWindow())->GetCurrencySymbol() );
+                aProp <<= OUString( GetAs< LongCurrencyField >()->GetCurrencySymbol() );
             }
             break;
             case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
             {
-                aProp <<= static_cast<LongCurrencyField*>(GetWindow())->IsUseThousandSep();
+                aProp <<= GetAs< LongCurrencyField >()->IsUseThousandSep();
             }
             break;
             default:
@@ -6398,7 +6398,7 @@ void VCLXPatternField::setMasks( const OUString& EditMask, const OUString& Liter
 {
     SolarMutexGuard aGuard;
 
-    PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+    VclPtr< PatternField > pPatternField = GetAs< PatternField >();
     if ( pPatternField )
     {
         pPatternField->SetMask( OUStringToOString(EditMask, RTL_TEXTENCODING_ASCII_US), LiteralMask );
@@ -6409,7 +6409,7 @@ void VCLXPatternField::getMasks( OUString& EditMask, OUString& LiteralMask ) thr
 {
     SolarMutexGuard aGuard;
 
-    PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+    VclPtr< PatternField > pPatternField = GetAs< PatternField >();
     if ( pPatternField )
     {
         EditMask = OStringToOUString(pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US);
@@ -6420,12 +6420,9 @@ void VCLXPatternField::getMasks( OUString& EditMask, OUString& LiteralMask ) thr
 void VCLXPatternField::setString( const OUString& Str ) throw(::com::sun::star::uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-
-    PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+    VclPtr< PatternField > pPatternField = GetAs< PatternField >();
     if ( pPatternField )
-    {
         pPatternField->SetString( Str );
-    }
 }
 
 OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException, std::exception)
@@ -6433,7 +6430,7 @@ OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeExcep
     SolarMutexGuard aGuard;
 
     OUString aString;
-    PatternField* pPatternField = static_cast<PatternField*>(GetWindow());
+    VclPtr< PatternField > pPatternField = GetAs< PatternField >();
     if ( pPatternField )
         aString = pPatternField->GetString();
     return aString;
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx
index b384af3..e850116 100644
--- a/toolkit/source/controls/accessiblecontrolcontext.cxx
+++ b/toolkit/source/controls/accessiblecontrolcontext.cxx
@@ -225,17 +225,18 @@ namespace toolkit
     }
 
 
-    vcl::Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
+    VclPtr< vcl::Window > OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
     {
         Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY );
         Reference< awt::XWindow > xWindow;
         if ( xControl.is() )
             xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY);
 
-        vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : NULL;
+        VclPtr< vcl::Window > pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : VclPtr< vcl::Window >();
 
         if ( _pxUNOWindow )
             *_pxUNOWindow = xWindow;
+
         return pWindow;
     }
 
@@ -259,7 +260,7 @@ namespace toolkit
 
         // our control
         Reference< awt::XWindow > xWindow;
-        vcl::Window* pVCLWindow = implGetWindow( &xWindow );
+        VclPtr< vcl::Window > pVCLWindow = implGetWindow( &xWindow );
 
         awt::Rectangle aBounds( 0, 0, 0, 0 );
         if ( xWindow.is() )
@@ -326,7 +327,7 @@ namespace toolkit
             // want to do some VCL stuff here ...
         OContextEntryGuard aGuard( this );
 
-        vcl::Window* pWindow = implGetWindow( );
+        VclPtr< vcl::Window > pWindow = implGetWindow();
         sal_Int32 nColor = 0;
         if ( pWindow )
         {
@@ -352,7 +353,7 @@ namespace toolkit
             // want to do some VCL stuff here ...
         OContextEntryGuard aGuard( this );
 
-        vcl::Window* pWindow = implGetWindow( );
+        VclPtr< vcl::Window > pWindow = implGetWindow();
         sal_Int32 nColor = 0;
         if ( pWindow )
         {
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
index f8ab1e1..c7c265a 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -108,22 +108,22 @@ BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com:
     return xBmp;
 }
 
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
 {
     VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
-    return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+    return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
 }
 
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
 {
     VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
-    return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+    return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
 }
 
-vcl::Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
+VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
 {
     VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
-    return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+    return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >();
 }
 
 vcl::Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )


More information about the Libreoffice-commits mailing list