1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _CONNECTIVITY_MACAB_RECORD_HXX_ 29 #define _CONNECTIVITY_MACAB_RECORD_HXX_ 30 31 #include <cppuhelper/compbase3.hxx> 32 33 #include <premac.h> 34 #include <Carbon/Carbon.h> 35 #include <AddressBook/ABAddressBookC.h> 36 #include <postmac.h> 37 38 namespace connectivity 39 { 40 namespace macab 41 { 42 /* a MacabRecord is at root a list of macabfields (which is just 43 * something to hold both a CFTypeRef (a CoreFoundation object) and 44 * its Address Book type. 45 */ 46 struct macabfield 47 { 48 CFTypeRef value; 49 ABPropertyType type; 50 }; 51 52 class MacabRecord{ 53 protected: 54 sal_Int32 size; 55 macabfield **fields; 56 protected: 57 void releaseFields(); 58 public: 59 MacabRecord(); 60 MacabRecord(const sal_Int32 _size); 61 virtual ~MacabRecord(); 62 void insertAtColumn (CFTypeRef _value, ABPropertyType _type, const sal_Int32 _column); 63 sal_Bool contains(const macabfield *_field) const; 64 sal_Bool contains(const CFTypeRef _value) const; 65 sal_Int32 getSize() const; 66 macabfield *copy(const sal_Int32 i) const; 67 macabfield *get(const sal_Int32 i) const; 68 69 static sal_Int32 compareFields(const macabfield *_field1, const macabfield *_field2); 70 static macabfield *createMacabField(const ::rtl::OUString _newFieldString, const ABPropertyType _abtype); 71 static ::rtl::OUString fieldToString(const macabfield *_aField); 72 73 }; 74 } 75 } 76 77 #endif // _CONNECTIVITY_MACAB_RECORD_HXX_ 78