Tag: cws_src680_dba23b
User: fs      
Date: 2007-07-07 20:22:47+0000
Modified:
   dba/dbaccess/source/core/misc/propertybag.cxx
   dba/dbaccess/source/core/misc/propertybag.hxx

Log:
 #i78593# overload getPropertyStateByHandle, to respect the MAYBEDEFAULT 
attribute (especially when it's *not* set)

File Changes:

Directory: /dba/dbaccess/source/core/misc/
==========================================

File [changed]: propertybag.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/misc/propertybag.cxx?r1=1.6.14.1&r2=1.6.14.2
Delta lines:  +26 -6
--------------------
--- propertybag.cxx     2007-07-07 19:20:32+0000        1.6.14.1
+++ propertybag.cxx     2007-07-07 20:22:44+0000        1.6.14.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: propertybag.cxx,v $
  *
- *  $Revision: 1.6.14.1 $
+ *  $Revision: 1.6.14.2 $
  *
- *  last change: $Author: fs $ $Date: 2007/07/07 19:20:32 $
+ *  last change: $Author: fs $ $Date: 2007/07/07 20:22:44 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -80,7 +80,7 @@
        //====================================================================
     //--------------------------------------------------------------------
     OPropertyBag::OPropertyBag( const Reference< XMultiServiceFactory >& 
_rxORB )
-        :OPropertyBag_CBase( GetBroadcastHelper() )
+        :OPropertyBag_PBase( GetBroadcastHelper() )
         ,m_xORB( _rxORB )
         ,m_bAutoAddProperties( false )
     {
@@ -92,8 +92,8 @@
     }
 
     //--------------------------------------------------------------------
-    IMPLEMENT_FORWARD_XINTERFACE2( OPropertyBag, OPropertyBag_Base, 
OPropertyBag_CBase )
-    IMPLEMENT_FORWARD_XTYPEPROVIDER2( OPropertyBag, OPropertyBag_Base, 
OPropertyBag_CBase )
+    IMPLEMENT_FORWARD_XINTERFACE2( OPropertyBag, OPropertyBag_Base, 
OPropertyBag_PBase )
+    IMPLEMENT_FORWARD_XTYPEPROVIDER2( OPropertyBag, OPropertyBag_Base, 
OPropertyBag_PBase )
 
     //--------------------------------------------------------------------
        Sequence< ::rtl::OUString > 
OPropertyBag::getSupportedServiceNames_Static() throw( RuntimeException )
@@ -293,7 +293,7 @@
         Sequence< Any > aValues;
         try
         {
-            aValues = OPropertyBag_CBase::getPropertyValues( aNames );
+            aValues = OPropertyBag_PBase::getPropertyValues( aNames );
             if ( aValues.getLength() != aNames.getLength() )
                 throw RuntimeException();
         }
@@ -416,6 +416,26 @@
     }
 
     //--------------------------------------------------------------------
+       PropertyState OPropertyBag::getPropertyStateByHandle( sal_Int32 
_nHandle )
+    {
+        // for properties which do not support the MAYBEDEFAULT attribute, 
don't rely on the base class, but
+        // assume they're always in DIRECT state.
+        // (Note that this probably would belong into the base class. However, 
this would mean we would need
+        // to check all existent usages of the base class, where MAYBEDEFAULT 
is *not* set, but
+        // a default is nonetheless supplied/used. This is hard to accomplish 
reliably, in the
+        // current phase.
+        // #i78593# / 2007-07-07 / [EMAIL PROTECTED]
+
+        ::cppu::IPropertyArrayHelper& rPropInfo = getInfoHelper();
+        sal_Int16 nAttributes(0);
+        OSL_VERIFY( rPropInfo.fillPropertyMembersByHandle( NULL, &nAttributes, 
_nHandle ) );
+        if ( ( nAttributes & PropertyAttribute::MAYBEDEFAULT ) == 0 )
+            return PropertyState_DIRECT_VALUE;
+
+        return OPropertyBag_PBase::getPropertyStateByHandle( _nHandle );
+    }
+
+    //--------------------------------------------------------------------
     Any OPropertyBag::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
     {
         Any aDefault;

File [changed]: propertybag.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/misc/propertybag.hxx?r1=1.4.88.1&r2=1.4.88.2
Delta lines:  +8 -7
-------------------
--- propertybag.hxx     2007-07-07 19:20:32+0000        1.4.88.1
+++ propertybag.hxx     2007-07-07 20:22:45+0000        1.4.88.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: propertybag.hxx,v $
  *
- *  $Revision: 1.4.88.1 $
+ *  $Revision: 1.4.88.2 $
  *
- *  last change: $Author: fs $ $Date: 2007/07/07 19:20:32 $
+ *  last change: $Author: fs $ $Date: 2007/07/07 20:22:45 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -92,17 +92,15 @@
     //====================================================================
        //= OPropertyBag
        //====================================================================
-
-    typedef ::comphelper::OMutexAndBroadcastHelper  OPropertyBag_BBase;
     typedef ::cppu::WeakAggImplHelper4  <   
::com::sun::star::beans::XPropertyContainer
                                         ,   
::com::sun::star::beans::XPropertyAccess
                                         ,   
::com::sun::star::lang::XServiceInfo
                                         ,   
::com::sun::star::lang::XInitialization
                                         >   OPropertyBag_Base;
-    typedef ::comphelper::OPropertyStateHelper  OPropertyBag_CBase;
+    typedef ::comphelper::OPropertyStateHelper  OPropertyBag_PBase;
 
-    class OPropertyBag  :public OPropertyBag_BBase  // must be before 
OPropertyBag_CBase
-                        ,public OPropertyBag_CBase
+    class OPropertyBag  :public ::comphelper::OMutexAndBroadcastHelper  // 
must be before OPropertyBag_PBase
+                        ,public OPropertyBag_PBase
                         ,public OPropertyBag_Base
        {
     private:
@@ -157,6 +155,9 @@
         // XPropertyState
            virtual ::com::sun::star::uno::Any  getPropertyDefaultByHandle( 
sal_Int32 _nHandle ) const;
 
+        // OPropertyStateHelper
+        virtual ::com::sun::star::beans::PropertyState  
getPropertyStateByHandle( sal_Int32 _nHandle );
+
         // OPropertySetHelper
            virtual void SAL_CALL getFastPropertyValue( 
::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
         virtual sal_Bool SAL_CALL convertFastPropertyValue( 
::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & 
rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw 
(::com::sun::star::lang::IllegalArgumentException);




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to