[ooo-build-commit] Branch 'ooo/master' - 2 commits - connectivity/makefile.pmk connectivity/source connectivity/target.pmk

Jan Holesovsky kendy at kemper.freedesktop.org
Mon Jul 20 18:01:15 PDT 2009


 connectivity/makefile.pmk                                          |    4 
 connectivity/source/drivers/mozab/makefile.mk                      |   30 
 connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx |  453 ++++++++++
 connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx |   78 +
 connectivity/target.pmk                                            |    7 
 5 files changed, 544 insertions(+), 28 deletions(-)

New commits:
commit 415e673a0d0857e528c61e224f24780e12094768
Author: Release Engineers <releng at openoffice.org>
Date:   Fri Jul 17 12:47:25 2009 +0000

    #i10000# #i103467# build fix

diff --git a/connectivity/makefile.pmk b/connectivity/makefile.pmk
index 4a8dbdf..ede06e4 100755
--- a/connectivity/makefile.pmk
+++ b/connectivity/makefile.pmk
@@ -55,8 +55,10 @@ JAVAPREPRO=$(JAVAPREPRO) + " -product"
 PACKAGE=org.openoffice.Office.DataAccess
 .INCLUDE :  settings.mk
 
+COMPONENT_CONFIG_DATA*=$(TARGET).xcu
+
 LOCALIZEDFILES= \
-    $(TARGET).xcu
+    $(COMPONENT_CONFIG_DATA)
 
 XCUFILES= \
     $(LOCALIZEDFILES) \
diff --git a/connectivity/source/drivers/mozab/makefile.mk b/connectivity/source/drivers/mozab/makefile.mk
index d817171..6240ed0 100644
--- a/connectivity/source/drivers/mozab/makefile.mk
+++ b/connectivity/source/drivers/mozab/makefile.mk
@@ -83,6 +83,11 @@ USE_DEFFILE=TRUE
 ENABLE_EXCEPTIONS=TRUE
 VISIBILITY_HIDDEN=TRUE
 
+.IF "$(OS)"!="WNT" 
+COMPONENT_CONFIG_DATA=$(TARGET)2.xcu
+COMPONENT_CONFIG_SCHEMA=$(TARGET)2.xcs
+.ENDIF
+
 # --- Settings ----------------------------------
 
 .IF "$(DBGUTIL_OJ)"!=""
@@ -94,24 +99,10 @@ ENVCFLAGS+=/FR$(SLO)$/
 .INCLUDE :  $(PRJ)$/version.mk
 
 # --- Files -------------------------------------
-# redefine because win and linux differ
-.IF "$(OS)"=="WNT" 
-LOCALIZEDFILES= \
-    $(TARGET).xcu
-.ELSE
-LOCALIZEDFILES= \
-    $(TARGET)2.xcu
-.ENDIF
-
-XCUFILES= \
-    $(LOCALIZEDFILES) \
-
-
 
 SLOFILES=\
         $(SLO)$/MDriver.obj						\
         $(SLO)$/MServices.obj
-
             
 # --- MOZAB BASE Library -----------------------------------
 
@@ -202,17 +193,6 @@ DEF2NAME=	$(SHL2TARGET)
 
 .INCLUDE : $(PRJ)$/target.pmk
 
-.IF "$(GUI)"=="WNT" 
-.ELSE
-ALLTAR: "$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(TARGET)2.xcs" "$(PWD)$/$(MISC)$/registry$/data$/$(PACKAGEDIR)$/$(TARGET).xcu"
-"$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(TARGET)2.xcs" : $(SOLARXMLDIR)$/registry$/schema$/$(PACKAGEDIR)$/Drivers.xcs
-    @@-$(MKDIRHIER) $(@:d)
-    $(COPY) $< $@
-"$(PWD)$/$(MISC)$/registry$/data$/$(PACKAGEDIR)$/$(TARGET).xcu" : "$(PWD)$/$(MISC)$/registry$/data$/$(PACKAGEDIR)$/$(TARGET)2.xcu" 
-    @@-$(MKDIRHIER) $(@:d)
-    $(COPY) $< $@
-.ENDIF
-
 # --- filter file ------------------------------
 
 $(MISC)$/$(SHL1TARGET).flt: makefile.mk
diff --git a/connectivity/target.pmk b/connectivity/target.pmk
index 8d6deda..97ef318 100755
--- a/connectivity/target.pmk
+++ b/connectivity/target.pmk
@@ -31,7 +31,10 @@
 
 .INCLUDE : target.mk
 
-ALLTAR: "$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(TARGET).xcs"
-"$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(TARGET).xcs" : $(SOLARXMLDIR)$/registry$/schema$/$(PACKAGEDIR)$/Drivers.xcs
+COMPONENT_CONFIG_SCHEMA*=$(TARGET).xcs
+
+ALLTAR: "$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(COMPONENT_CONFIG_SCHEMA)"
+"$(PWD)$/$(MISC)$/registry$/schema$/$(PACKAGEDIR)$/$(COMPONENT_CONFIG_SCHEMA)" : $(SOLARXMLDIR)$/registry$/schema$/$(PACKAGEDIR)$/Drivers.xcs
     @@-$(MKDIRHIER) $(@:d)
     $(COPY) $< $@
+
commit 5dc777dd97d14f58d93013d0416a1d30b48d8140
Author: Ivo Hinkelmann <ihi at openoffice.org>
Date:   Thu Jul 16 23:11:42 2009 +0000

    #i10000# missing files added

diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
new file mode 100644
index 0000000..ba6abb3
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+* 
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: code,v $
+*
+* $Revision: 1.3 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org.  If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_connectivity.hxx"
+
+#include <rtl/strbuf.hxx>
+    // keep this include at the beginning. Some of the other includes seems to inject a symbol "l" into the
+    // global namespace, which leads to a compiler warning in strbuf.hxx, about some parameters named "l"
+    // hiding objects "in an outer scope".
+
+#include "MLdapAttributeMap.hxx"
+#include "MTypeConverter.hxx"
+#include "MQueryHelper.hxx"
+
+#include <tools/diagnose_ex.h>
+
+#include <hash_map>
+
+//........................................................................
+namespace connectivity { namespace mozab {
+//........................................................................
+
+    //====================================================================
+    //= helper
+    //====================================================================
+    namespace
+    {
+        typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertyGetter)( PRUnichar** aFirstName );
+        typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertySetter)( const PRUnichar* aFirstName );
+        struct CardPropertyData
+        {
+            const sal_Char*     pLDAPAttributeList;
+            CardPropertyGetter  PropGetter;
+            CardPropertySetter  PropSetter;
+
+            CardPropertyData()
+                :pLDAPAttributeList( NULL )
+                ,PropGetter( NULL )
+                ,PropSetter( NULL )
+            {
+            }
+            CardPropertyData( const sal_Char* _pLDAPAttributeList, CardPropertyGetter _PropGetter, CardPropertySetter _PropSetter )
+                :pLDAPAttributeList( _pLDAPAttributeList )
+                ,PropGetter( _PropGetter )
+                ,PropSetter( _PropSetter )
+            {
+            }
+        };
+
+        typedef ::std::hash_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes;
+
+        #define DEF_CARD_ACCESS( PropertyName ) \
+            &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName
+
+        static const MapPropertiesToAttributes& lcl_getPropertyMap()
+        {
+            static MapPropertiesToAttributes aMap;
+            if ( aMap.empty() )
+            {
+                struct MapEntry
+                {
+                    const sal_Char*     pAsciiPropertyName;
+                    const sal_Char*     pAsciiAttrributeList;
+                    CardPropertyGetter  PropGetter;
+                    CardPropertySetter  PropSetter;
+                };
+                const MapEntry aEntries[] = {
+                    { "FirstName",          "givenname",                                    DEF_CARD_ACCESS( FirstName ) },
+                    { "LastName",           "sn,surnname",                                  DEF_CARD_ACCESS( LastName ) },
+                    { "DisplayName",        "cn,commonname,displayname",                    DEF_CARD_ACCESS( DisplayName ) },
+                    { "NickName",           "xmozillanickname",                             DEF_CARD_ACCESS( NickName ) },
+                    { "PrimaryEmail",       "mail",                                         DEF_CARD_ACCESS( PrimaryEmail ) },
+                    { "SecondEmail",        "xmozillasecondemail",                          DEF_CARD_ACCESS( SecondEmail ) },
+                    { "WorkPhone",          "telephonenumber",                              DEF_CARD_ACCESS( WorkPhone ) },
+                    { "HomePhone",          "homephone",                                    DEF_CARD_ACCESS( HomePhone ) },
+                    { "FaxNumber",          "fax,facsimiletelephonenumber",                 DEF_CARD_ACCESS( FaxNumber ) },
+                    { "PagerNumber",        "pager,pagerphone",                             DEF_CARD_ACCESS( PagerNumber ) },
+                    { "CellularNumber",     "mobile,cellphone,carphone",                    DEF_CARD_ACCESS( CellularNumber ) },
+                    { "HomeAddress",        "homepostaladdress,mozillaHomeStreet",          DEF_CARD_ACCESS( HomeAddress ) },
+                    { "HomeAddress2",       "mozillaHomeStreet2",                           DEF_CARD_ACCESS( HomeAddress2 ) },
+                    { "HomeCity",           "homelocality,mozillaHomeLocalityName",         DEF_CARD_ACCESS( HomeCity ) },
+                    { "HomeState",          "homeregion,mozillaHomeState",                  DEF_CARD_ACCESS( HomeState ) },
+                    { "HomeZipCode",        "homepostalcode,mozillaHomePostalCode",         DEF_CARD_ACCESS( HomeZipCode ) },
+                    { "HomeCountry",        "homecountryname,mozillaHomeCountryName",       DEF_CARD_ACCESS( HomeCountry ) },
+                    { "WorkAddress",        "postofficebox,streetaddress,streetaddress1",   DEF_CARD_ACCESS( WorkAddress ) },
+                    { "WorkAddress2",       "streetaddress2",                               DEF_CARD_ACCESS( WorkAddress2 ) },
+                    { "WorkCity",           "l,locality",                                   DEF_CARD_ACCESS( WorkCity ) },
+                    { "WorkState",          "st,region",                                    DEF_CARD_ACCESS( WorkState ) },
+                    { "WorkZipCode",        "postalcode,zip",                               DEF_CARD_ACCESS( WorkZipCode ) },
+                    { "WorkCountry",        "countryname",                                  DEF_CARD_ACCESS( WorkCountry ) },
+                    { "JobTitle",           "title",                                        DEF_CARD_ACCESS( JobTitle ) },
+                    { "Department",         "ou,orgunit,department,departmentnumber",       DEF_CARD_ACCESS( Department ) },
+                    { "Company",            "o,company",                                    DEF_CARD_ACCESS( Company ) },
+                    { "WebPage1",           "workurl",                                      DEF_CARD_ACCESS( WebPage1 ) },
+                    { "WebPage2",           "homeurl",                                      DEF_CARD_ACCESS( WebPage2 ) },
+                    { "BirthYear",          "birthyear",                                    DEF_CARD_ACCESS( BirthYear ) },
+                    { "BirthMonth",         "birthmonth",                                   DEF_CARD_ACCESS( BirthMonth ) },
+                    { "BirthYear",          "birthday",                                     DEF_CARD_ACCESS( BirthDay ) },
+                    { "Custom1",            "custom1",                                      DEF_CARD_ACCESS( Custom1 ) },
+                    { "Custom2",            "custom2",                                      DEF_CARD_ACCESS( Custom2 ) },
+                    { "Custom3",            "custom3",                                      DEF_CARD_ACCESS( Custom3 ) },
+                    { "Custom4",            "custom4",                                      DEF_CARD_ACCESS( Custom4 ) },
+                    { "Notes",              "notes,description",                            DEF_CARD_ACCESS( Notes ) },
+                    { "PreferMailFormat",   "xmozillausehtmlmail",                          NULL, NULL },
+                    { NULL, NULL, NULL, NULL }
+                };
+                const MapEntry* loop = aEntries;
+                while ( loop->pAsciiPropertyName )
+                {
+                    aMap[ ::rtl::OString( loop->pAsciiPropertyName ) ] =
+                        CardPropertyData( loop->pAsciiAttrributeList, loop->PropGetter, loop->PropSetter );
+                    ++loop;
+                }
+            }
+            return aMap;
+        }
+    }
+
+    //====================================================================
+    //= AttributeMap_Data
+    //====================================================================
+    struct AttributeMap_Data
+    {
+    };
+
+    //====================================================================
+    //= MLdapAttributeMap
+    //====================================================================
+    // -------------------------------------------------------------------
+    MLdapAttributeMap::MLdapAttributeMap()
+        :m_pData( new AttributeMap_Data )
+    {
+    }
+
+    // -------------------------------------------------------------------
+    MLdapAttributeMap::~MLdapAttributeMap()
+    {
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap )
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
+    {
+        ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+        MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+        if ( pos == rPropertyMap.end() )
+        {
+            _retval.SetIsVoid( PR_TRUE );
+        }
+        else
+        {
+            MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
+        }
+
+        return NS_OK;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
+    {
+        OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" );
+        (void)aProperty;
+        (void)aCount;
+        (void)aAttrs;
+        return NS_ERROR_NOT_IMPLEMENTED;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
+    {
+        ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
+
+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+        MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
+
+        if ( pos == rPropertyMap.end() )
+        {
+            _retval.SetIsVoid( PR_TRUE );
+        }
+        else
+        {
+            sal_Int32 tokenPos(0);
+            ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
+            MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
+        }
+
+        return NS_OK;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
+    {
+        OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" );
+        (void)aProperty;
+        (void)aAttributeList;
+        (void)allowInconsistencies;
+        return NS_ERROR_NOT_IMPLEMENTED;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
+    {
+        OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" );
+        (void)aAttribute;
+        (void)_retval;
+        return NS_ERROR_NOT_IMPLEMENTED;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
+    {
+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+
+        ::rtl::OStringBuffer aAllAttributes;
+        for (   MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
+                loop != rPropertyMap.end();
+                ++loop
+            )
+        {
+            aAllAttributes.append( loop->second.pLDAPAttributeList );
+            if ( loop != rPropertyMap.end() )
+                aAllAttributes.append( ',' );
+        }
+
+        MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
+        return NS_OK;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
+    {
+        // we do not allow modifying the map, so we're always in a valid state
+        return NS_OK;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
+    {
+        OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" );
+        (void)aPrefBranchName;
+        return NS_ERROR_NOT_IMPLEMENTED;
+    }
+
+    // -------------------------------------------------------------------
+    NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
+    {
+        NS_ENSURE_ARG_POINTER( aMessage );
+        NS_ENSURE_ARG_POINTER( aCard );
+
+        // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
+        aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+        for (   MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+                prop != rPropertyMap.end();
+                ++prop
+            )
+        {
+            // split the list of attributes for the current property
+            ::rtl::OString sAttributeList( prop->second.pLDAPAttributeList );
+            ::rtl::OString sAttribute;
+
+            sal_Int32 tokenPos = 0;
+            while ( tokenPos != -1 )
+            {
+                sAttribute = sAttributeList.getToken( 0, ',', tokenPos );
+
+                // retrieve the values for the current attribute
+                PRUint32 valueCount = 0;
+                PRUnichar** values = NULL;
+                nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
+                if ( NS_FAILED( rv ) )
+                    // try the next attribute
+                    continue;
+
+                if ( valueCount )
+                {
+                    CardPropertySetter propSetter = prop->second.PropSetter;
+                    OSL_ENSURE( propSetter,
+                        "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
+                        "unexpected: could retrieve an attribute value, but have no setter for it!" );
+                    if ( propSetter )
+                    {
+                        (aCard->*propSetter)( values[0] );
+                    }
+
+                    // we're done with this property - no need to handle the remaining attributes which
+                    // map to it
+                    break;
+                }
+            }
+        }
+        return NS_OK;
+    }
+
+    // -------------------------------------------------------------------
+    namespace
+    {
+        struct PreferMailFormatType
+        {
+            const sal_Char* description;
+            PRUint32        formatType;
+
+            PreferMailFormatType()
+                :description( NULL )
+                ,formatType( nsIAbPreferMailFormat::unknown )
+            {
+            }
+
+            PreferMailFormatType( const sal_Char* _description, PRUint32 _formatType )
+                :description( _description )
+                ,formatType( _formatType )
+            {
+            }
+        };
+
+        static const PreferMailFormatType* lcl_getMailFormatTypes()
+        {
+            static const PreferMailFormatType aMailFormatTypes[] =
+            {
+                PreferMailFormatType( "text/plain", nsIAbPreferMailFormat::plaintext ),
+                PreferMailFormatType( "text/html",  nsIAbPreferMailFormat::html      ),
+                PreferMailFormatType( "unknown",    nsIAbPreferMailFormat::unknown   ),
+                PreferMailFormatType()
+            };
+            return aMailFormatTypes;
+        }
+    }
+
+    // -------------------------------------------------------------------
+    void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result )
+    {
+        _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
+
+        ::rtl::OUString resultValue;
+
+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+        for (   MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+                prop != rPropertyMap.end();
+                ++prop
+            )
+        {
+            resultValue = _result.getValue( prop->first );
+
+            CardPropertySetter propSetter = prop->second.PropSetter;
+            if ( propSetter )
+            {
+        // PRUnichar != sal_Unicode in mingw
+                (_card.*propSetter)( reinterpret_cast_mingw_only<const PRUnichar *>(resultValue.getStr()) );
+            }
+            else
+            {
+                if ( prop->first.equals( "PreferMailFormat" ) )
+                {
+                    unsigned int format = nsIAbPreferMailFormat::unknown;
+                    const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
+                    while ( pMailFormatType->description )
+                    {
+                        if ( resultValue.equalsAscii( pMailFormatType->description ) )
+                        {
+                            format = pMailFormatType->formatType;
+                            break;
+                        }
+                        ++pMailFormatType;
+                    }
+                    _card.SetPreferMailFormat(format);
+                }
+                else
+                    OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
+            }
+        }
+    }
+
+    // -------------------------------------------------------------------
+    void MLdapAttributeMap::fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card )
+    {
+        nsXPIDLString value;
+        ::rtl::OUString resultValue;
+
+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
+        for (   MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
+                prop != rPropertyMap.end();
+                ++prop
+            )
+        {
+            CardPropertyGetter propGetter = prop->second.PropGetter;
+            if ( propGetter )
+            {
+                (_card.*propGetter)( getter_Copies( value ) );
+
+                nsAutoString temp( value );
+                MTypeConverter::nsStringToOUString( temp, resultValue );
+            }
+            else
+            {
+                if ( prop->first.equals( "PreferMailFormat" ) )
+                {
+                    unsigned int format = nsIAbPreferMailFormat::unknown;
+                    _card.GetPreferMailFormat( &format );
+                    const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
+                    while ( pMailFormatType->description )
+                    {
+                        if ( format == pMailFormatType->formatType )
+                        {
+                            resultValue = ::rtl::OUString::createFromAscii( pMailFormatType->description );
+                            break;
+                        }
+                        ++pMailFormatType;
+                    }
+                }
+                else
+                    OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
+            }
+
+            _result.insert( prop->first, resultValue );
+        }
+    }
+
+//........................................................................
+} } // namespace connectivity::mozab
+//........................................................................
diff --git a/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
new file mode 100644
index 0000000..80bd222
--- /dev/null
+++ b/connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+* 
+* Copyright 2008 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* $RCSfile: code,v $
+*
+* $Revision: 1.3 $
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org.  If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
+#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
+
+#include <MNSInclude.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace connectivity { namespace mozab {
+//........................................................................
+
+    struct AttributeMap_Data;
+    class MQueryHelperResultEntry;
+
+    //====================================================================
+    //= class MLdapAttributeMap
+    //====================================================================
+    /** implements the nsIAbLDAPAttributeMap interface
+
+        Somewhere between Mozilla 1.7.5 and SeaMonkey 1.1.12, the LDAP address book
+        implementation was changed to take the attribute mapping (from LDAP attributes
+        to address book properties) not directly from the preferences. Instead, this mapping
+        is now delivered by a dedicated implementation (supporting the nsIAbLDAPAttributeMap
+        interface).
+
+    */
+    class MLdapAttributeMap : public nsIAbLDAPAttributeMap
+    {
+    public:
+        MLdapAttributeMap();
+
+        NS_DECL_ISUPPORTS
+        NS_DECL_NSIABLDAPATTRIBUTEMAP
+
+        static void fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result );
+        static void fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card );
+
+    protected:
+        virtual ~MLdapAttributeMap();
+
+    private:
+        ::std::auto_ptr< AttributeMap_Data >    m_pData;
+    };
+
+//........................................................................
+} } // namespace connectivity::mozab
+//........................................................................
+
+#endif // CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX


More information about the ooo-build-commit mailing list