bump product version to 4.2.0.1
[LibreOffice.git] / sot / source / base / object.cxx
blobcd14c740d6a7fd4551caf3eabd1732d81ca5d61b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sot/object.hxx>
21 #include <sot/factory.hxx>
23 /************** class SotObject ******************************************/
24 class SotObjectFactory : public SotFactory
26 public:
27 TYPEINFO();
28 SotObjectFactory( const SvGlobalName & rName,
29 const OUString & rClassName,
30 CreateInstanceType pCreateFuncP )
31 : SotFactory( rName, rClassName, pCreateFuncP )
34 TYPEINIT1(SotObjectFactory,SotFactory);
37 SO2_IMPL_BASIC_CLASS_DLL(SotObject,SotObjectFactory,
38 SvGlobalName( 0xf44b7830, 0xf83c, 0x11d0,
39 0xaa, 0xa1, 0x0, 0xa0, 0x24, 0x9d, 0x55, 0x90 ) )
41 /*************************************************************************
42 |* SotObject::SotObject()
44 |* Beschreibung
45 *************************************************************************/
46 SotObject::SotObject()
47 : nOwnerLockCount( 0 )
48 , bOwner ( true )
49 , bSVObject ( false )
50 , bInClose ( false )
52 SotFactory::IncSvObjectCount( this );
55 /*************************************************************************
57 |* SotObject::~SotObject()
59 *************************************************************************/
60 SotObject::~SotObject()
62 SotFactory::DecSvObjectCount( this );
65 /*************************************************************************
66 |* SotObject::GetInterface()
68 |* Beschreibung: Um so3 zu helfen
69 *************************************************************************/
70 IUnknown * SotObject::GetInterface( const SvGlobalName & )
72 return NULL;
75 //=========================================================================
76 void SotObject::OwnerLock
78 bool bLock /* true, lock. false, unlock. */
80 /* [Beschreibung]
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.
88 if( bLock )
90 nOwnerLockCount++;
91 AddRef();
93 else if ( nOwnerLockCount )
95 if( 0 == --nOwnerLockCount )
96 DoClose();
97 ReleaseRef();
101 //=========================================================================
102 bool SotObject::DoClose()
104 bool bRet = false;
105 if( !bInClose )
107 SotObjectRef xHoldAlive( this );
108 bInClose = true;
109 bRet = Close();
110 bInClose = false;
112 return bRet;
115 //=========================================================================
116 bool SotObject::Close()
118 return true;
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */