1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _GLOBNAME_HXX 24 #define _GLOBNAME_HXX 25 26 #include "tools/toolsdllapi.h" 27 #include <com/sun/star/uno/Sequence.hxx> 28 #include <tools/string.hxx> 29 #include <tools/list.hxx> 30 31 /************************************************************************* 32 *************************************************************************/ 33 struct ImpSvGlobalName 34 { 35 sal_uInt8 szData[ 16 ]; 36 sal_uInt16 nRefCount; 37 ImpSvGlobalNameImpSvGlobalName38 ImpSvGlobalName() 39 { 40 nRefCount = 0; 41 } 42 ImpSvGlobalName( const ImpSvGlobalName & rObj ); 43 ImpSvGlobalName( int ); 44 45 sal_Bool operator == ( const ImpSvGlobalName & rObj ) const; 46 }; 47 48 #ifdef WNT 49 struct _GUID; 50 typedef struct _GUID GUID; 51 #else 52 struct GUID; 53 #endif 54 typedef GUID CLSID; 55 class SvStream; 56 class SvGlobalNameList; 57 class TOOLS_DLLPUBLIC SvGlobalName 58 { 59 friend class SvGlobalNameList; 60 ImpSvGlobalName * pImp; 61 void NewImp(); 62 public: 63 SvGlobalName(); SvGlobalName(const SvGlobalName & rObj)64 SvGlobalName( const SvGlobalName & rObj ) 65 { 66 pImp = rObj.pImp; 67 pImp->nRefCount++; 68 } SvGlobalName(ImpSvGlobalName * pImpP)69 SvGlobalName( ImpSvGlobalName * pImpP ) 70 { 71 pImp = pImpP; 72 pImp->nRefCount++; 73 } 74 SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, 75 sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, 76 sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 ); 77 78 // create SvGlobalName from a platform independent representation 79 SvGlobalName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeq ); 80 81 SvGlobalName & operator = ( const SvGlobalName & rObj ); 82 ~SvGlobalName(); 83 84 TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & ); 85 TOOLS_DLLPUBLIC friend SvStream & operator << ( SvStream &, const SvGlobalName & ); 86 87 sal_Bool operator < ( const SvGlobalName & rObj ) const; 88 SvGlobalName & operator += ( sal_uInt32 ); operator ++()89 SvGlobalName & operator ++ () { return operator += ( 1 ); } 90 91 sal_Bool operator == ( const SvGlobalName & rObj ) const; operator !=(const SvGlobalName & rObj) const92 sal_Bool operator != ( const SvGlobalName & rObj ) const 93 { return !(*this == rObj); } 94 95 void MakeFromMemory( void * pData ); 96 sal_Bool MakeId( const String & rId ); 97 String GetctorName() const; 98 String GetHexName() const; GetRegDbName() const99 String GetRegDbName() const 100 { 101 String a = '{'; 102 a += GetHexName(); 103 a += '}'; 104 return a; 105 } 106 107 SvGlobalName( const CLSID & rId ); GetCLSID() const108 const CLSID & GetCLSID() const { return *(CLSID *)pImp->szData; } GetBytes() const109 const sal_uInt8* GetBytes() const { return pImp->szData; } 110 111 // platform independent representation of a "GlobalName" 112 // maybe transported remotely 113 com::sun::star::uno::Sequence < sal_Int8 > GetByteSequence() const; 114 }; 115 116 class SvGlobalNameList 117 { 118 List aList; 119 public: 120 SvGlobalNameList(); 121 ~SvGlobalNameList(); 122 123 void Append( const SvGlobalName & ); 124 SvGlobalName GetObject( sal_uLong ); 125 sal_Bool IsEntry( const SvGlobalName & rName ); Count() const126 sal_uInt32 Count() const { return aList.Count(); } 127 private: 128 // nicht erlaubt 129 SvGlobalNameList( const SvGlobalNameList & ); 130 SvGlobalNameList & operator = ( const SvGlobalNameList & ); 131 }; 132 133 #endif // _GLOBNAME_HXX 134 135