Kaydet (Commit) f0a51299 authored tarafından Ivo Hinkelmann's avatar Ivo Hinkelmann

INTEGRATION: CWS dba205b (1.2.146); FILE MERGED

2006/08/09 19:52:36 fs 1.2.146.1: refactored the OColumnAlias class, in preparation of fixing #b6248060#
üst a6f625cf
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: MColumnAlias.hxx,v $ * $RCSfile: MColumnAlias.hxx,v $
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* *
* last change: $Author: rt $ $Date: 2005-09-08 06:16:17 $ * last change: $Author: ihi $ $Date: 2006-10-18 13:07:34 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -49,78 +49,93 @@ namespace connectivity ...@@ -49,78 +49,93 @@ namespace connectivity
{ {
namespace mozab namespace mozab
{ {
typedef enum {
FIRSTNAME = 0,
LASTNAME,
DISPLAYNAME,
NICKNAME,
PRIMARYEMAIL,
SECONDEMAIL,
PREFERMAILFORMAT,
WORKPHONE,
HOMEPHONE,
FAXNUMBER,
PAGERNUMBER,
CELLULARNUMBER,
HOMEADDRESS,
HOMEADDRESS2,
HOMECITY,
HOMESTATE,
HOMEZIPCODE,
HOMECOUNTRY,
WORKADDRESS,
WORKADDRESS2,
WORKCITY,
WORKSTATE,
WORKZIPCODE,
WORKCOUNTRY,
JOBTITLE,
DEPARTMENT,
COMPANY,
WEBPAGE1,
WEBPAGE2,
BIRTHYEAR,
BIRTHMONTH,
BIRTHDAY,
CUSTOM1,
CUSTOM2,
CUSTOM3,
CUSTOM4,
NOTES,
END
} ProgrammaticName;
class OColumnAlias class OColumnAlias
{ {
/** public:
* m_Alias holds aliases for the mozilla addressbook typedef enum {
* column names. This member gets initialised during BEGIN = 0,
* creation of the connection to the driver.
* m_aAlias initialises m_aAliasMap which then can be FIRSTNAME = BEGIN,
* used to find the corresponding programmatic name LASTNAME,
* when an alias is used as a query attribute. Mozilla DISPLAYNAME,
* expects programmatic names from its clients. NICKNAME,
* PRIMARYEMAIL,
* m_aAlias: vector of aliases used to initialise m_aAliasMap. SECONDEMAIL,
* m_AliasMap: map of {alias, programmaticname} pairs. PREFERMAILFORMAT,
* WORKPHONE,
*/ HOMEPHONE,
private: FAXNUMBER,
::std::vector< ::rtl::OUString> m_aAlias; PAGERNUMBER,
::std::map< ::rtl::OUString, ::rtl::OUString> m_aAliasMap; CELLULARNUMBER,
protected: HOMEADDRESS,
::osl::Mutex m_aMutex; HOMEADDRESS2,
public: HOMECITY,
void initialise(void); HOMESTATE,
const ::std::vector< ::rtl::OUString> & getAlias(void) const; HOMEZIPCODE,
const ::std::map< ::rtl::OUString, ::rtl::OUString> & getAliasMap(void) const; HOMECOUNTRY,
void setAlias(const ::com::sun::star::uno::Reference< WORKADDRESS,
::com::sun::star::lang::XMultiServiceFactory > &); WORKADDRESS2,
private: WORKCITY,
void setAliasMap(void); WORKSTATE,
public: WORKZIPCODE,
OColumnAlias(void); WORKCOUNTRY,
~OColumnAlias(void); JOBTITLE,
DEPARTMENT,
COMPANY,
WEBPAGE1,
WEBPAGE2,
BIRTHYEAR,
BIRTHMONTH,
BIRTHDAY,
CUSTOM1,
CUSTOM2,
CUSTOM3,
CUSTOM4,
NOTES,
END
} ProgrammaticName;
struct AliasDescription
{
::rtl::OUString sProgrammaticName;
ProgrammaticName eProgrammaticNameIndex;
AliasDescription()
:eProgrammaticNameIndex( END )
{
}
AliasDescription( const ::rtl::OUString& _rName, ProgrammaticName _eIndex )
:sProgrammaticName( _rName ), eProgrammaticNameIndex( _eIndex )
{
}
};
typedef ::std::map< ::rtl::OUString, AliasDescription > AliasMap;
private:
AliasMap m_aAliasMap;
protected:
::osl::Mutex m_aMutex;
public:
OColumnAlias(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
ProgrammaticName getProgrammaticNameIndex( const ::rtl::OUString& _rAliasName ) const;
inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
{
return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
}
::rtl::OUString getProgrammaticNameOrFallbackToAlias( const ::rtl::OUString& _rAlias ) const;
inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
private:
void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
}; };
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment