Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_TOOLS_GLOBNAME_HXX
20 : #define INCLUDED_TOOLS_GLOBNAME_HXX
21 :
22 : #include <vector>
23 :
24 : #include <tools/toolsdllapi.h>
25 : #include <com/sun/star/uno/Sequence.hxx>
26 :
27 : struct SvGUID
28 : {
29 : sal_uInt32 Data1;
30 : sal_uInt16 Data2;
31 : sal_uInt16 Data3;
32 : sal_uInt8 Data4[8];
33 : };
34 :
35 : struct ImpSvGlobalName
36 : {
37 : struct SvGUID szData;
38 : sal_uInt16 nRefCount;
39 :
40 : enum Empty { EMPTY };
41 :
42 93792 : ImpSvGlobalName(const SvGUID &rData)
43 : : szData(rData)
44 93792 : , nRefCount(0)
45 : {
46 93792 : }
47 : ImpSvGlobalName(sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
48 : sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
49 : sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15);
50 : ImpSvGlobalName( const ImpSvGlobalName & rObj );
51 : ImpSvGlobalName( Empty );
52 :
53 : bool operator == ( const ImpSvGlobalName & rObj ) const;
54 : };
55 :
56 : class SvStream;
57 :
58 : class TOOLS_DLLPUBLIC SvGlobalName
59 : {
60 : ImpSvGlobalName * pImp;
61 : void NewImp();
62 :
63 : public:
64 : SvGlobalName();
65 12672 : SvGlobalName( const SvGlobalName & rObj )
66 : {
67 12672 : pImp = rObj.pImp;
68 12672 : pImp->nRefCount++;
69 12672 : }
70 : SvGlobalName( ImpSvGlobalName * pImpP )
71 : {
72 : pImp = pImpP;
73 : pImp->nRefCount++;
74 : }
75 : SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
76 : sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
77 : sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
78 :
79 : // create SvGlobalName from a platform independent representation
80 : SvGlobalName( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeq );
81 :
82 : SvGlobalName & operator = ( const SvGlobalName & rObj );
83 : ~SvGlobalName();
84 :
85 : TOOLS_DLLPUBLIC friend SvStream & operator >> ( SvStream &, SvGlobalName & );
86 : TOOLS_DLLPUBLIC friend SvStream & WriteSvGlobalName( SvStream &, const SvGlobalName & );
87 :
88 : bool operator < ( const SvGlobalName & rObj ) const;
89 : SvGlobalName& operator += ( sal_uInt32 );
90 1480 : SvGlobalName& operator ++ () { return operator += ( 1 ); }
91 :
92 : bool operator == ( const SvGlobalName & rObj ) const;
93 0 : bool operator != ( const SvGlobalName & rObj ) const
94 0 : { return !(*this == rObj); }
95 :
96 : void MakeFromMemory( void * pData );
97 : bool MakeId( const OUString & rId );
98 : OUString GetHexName() const;
99 :
100 : SvGlobalName( const SvGUID & rId );
101 106 : const SvGUID& GetCLSID() const { return pImp->szData; }
102 :
103 : // platform independent representation of a "GlobalName"
104 : // maybe transported remotely
105 : com::sun::star::uno::Sequence < sal_Int8 > GetByteSequence() const;
106 : };
107 :
108 : #endif
109 :
110 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|