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 :
20 : #include <sot/object.hxx>
21 : #include <sot/factory.hxx>
22 :
23 : /************** class SotObject ******************************************/
24 0 : class SotObjectFactory : public SotFactory
25 : {
26 : public:
27 : TYPEINFO_OVERRIDE();
28 0 : SotObjectFactory( const SvGlobalName & rName,
29 : const OUString & rClassName,
30 : CreateInstanceType pCreateFuncP )
31 0 : : SotFactory( rName, rClassName, pCreateFuncP )
32 0 : {}
33 : };
34 0 : TYPEINIT1(SotObjectFactory,SotFactory);
35 :
36 :
37 0 : SO2_IMPL_BASIC_CLASS_DLL(SotObject,SotObjectFactory,
38 : SvGlobalName( 0xf44b7830, 0xf83c, 0x11d0,
39 : 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
40 :
41 : /*************************************************************************
42 : |* SotObject::SotObject()
43 : |*
44 : |* Beschreibung
45 : *************************************************************************/
46 0 : SotObject::SotObject()
47 : : nOwnerLockCount( 0 )
48 : , bOwner ( true )
49 : , bSVObject ( false )
50 0 : , bInClose ( false )
51 : {
52 0 : SotFactory::IncSvObjectCount( this );
53 0 : }
54 :
55 : /*************************************************************************
56 : |*
57 : |* SotObject::~SotObject()
58 : |*
59 : *************************************************************************/
60 0 : SotObject::~SotObject()
61 : {
62 0 : SotFactory::DecSvObjectCount( this );
63 0 : }
64 :
65 : /*************************************************************************
66 : |* SotObject::GetInterface()
67 : |*
68 : |* Beschreibung: Um so3 zu helfen
69 : *************************************************************************/
70 0 : IUnknown * SotObject::GetInterface( const SvGlobalName & )
71 : {
72 0 : return NULL;
73 : }
74 :
75 :
76 0 : void SotObject::OwnerLock
77 : (
78 : bool bLock /* true, lock. false, unlock. */
79 : )
80 : /* [Beschreibung]
81 :
82 : Wenn der OwnerLock auf Null dekrementiert, dann wird die Methode
83 : DoClose gerufen. Dies geschieht unabh"angig vom Lock. bzw. RefCount.
84 : Ist der OwnerLock-Z"ahler != Null, dann wird kein DoClose durch
85 : <SotObject::FuzzyLock> gerufen.
86 : */
87 : {
88 0 : if( bLock )
89 : {
90 0 : nOwnerLockCount++;
91 0 : AddRef();
92 : }
93 0 : else if ( nOwnerLockCount )
94 : {
95 0 : if( 0 == --nOwnerLockCount )
96 0 : DoClose();
97 0 : ReleaseRef();
98 : }
99 0 : }
100 :
101 :
102 0 : bool SotObject::DoClose()
103 : {
104 0 : bool bRet = false;
105 0 : if( !bInClose )
106 : {
107 0 : SotObjectRef xHoldAlive( this );
108 0 : bInClose = true;
109 0 : bRet = Close();
110 0 : bInClose = false;
111 : }
112 0 : return bRet;
113 : }
114 :
115 :
116 0 : bool SotObject::Close()
117 : {
118 0 : return true;
119 : }
120 :
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|