xref: /trunk/main/sot/inc/sot/sotref.hxx (revision bbfc4cc7)
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 
24 #ifndef _SOT_SOTREF_HXX
25 #define _SOT_SOTREF_HXX
26 
27 #ifndef _TOOLS_REF_HXX
28 #include <tools/ref.hxx>
29 #endif
30 
31 //========================================================================
32 #ifndef SVT_DECL_SOTOBJECT_DEFINED
33 #define SVT_DECL_SOTOBJECT_DEFINED
34 class SotObject;
35 class SotObjectRef
36 {
37     PRV_SV_DECL_REF(SotObject)
38 };
39 #endif
40 
41 //========================================================================
42 #define SO2_DECL_REF(ClassName)                                           \
43 class ClassName;                                                          \
44 class ClassName##Ref                                                      \
45 {                                                                         \
46     PRV_SV_DECL_REF(ClassName)                                            \
47     inline          ClassName##Ref( const SotObjectRef & );               \
48     inline          ClassName##Ref( SotObject * pObjP );                  \
49 };
50 
51 #define SO2_IMPL_REF(ClassName)                                           \
52 SV_IMPL_REF(ClassName)                                                    \
53 inline ClassName##Ref::ClassName##Ref( const SotObjectRef & r )           \
54 {                                                                         \
55     pObj = (ClassName *)ClassName::ClassFactory()->CastAndAddRef( &r );	  \
56 }                                                                         \
57 inline ClassName##Ref::ClassName##Ref( SotObject * pObjP )                \
58 {                                                                         \
59     pObj = (ClassName *)ClassName::ClassFactory()->CastAndAddRef( pObjP );\
60 }
61 
62 
63 #define SO2_DECL_IMPL_REF(ClassName)                                      \
64     SO2_DECL_REF(ClassName)                                               \
65     SO2_IMPL_REF(ClassName)
66 
67 #endif // _SO2REF_HXX
68