LCOV - code coverage report
Current view: top level - include/sot - object.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          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             : #ifndef INCLUDED_SOT_OBJECT_HXX
      21             : #define INCLUDED_SOT_OBJECT_HXX
      22             : 
      23             : #include <sot/sotdata.hxx>
      24             : #include <tools/globname.hxx>
      25             : #include <tools/ref.hxx>
      26             : #include <sot/sotdllapi.h>
      27             : 
      28             : #define SO2_IMPL_BASIC_CLASS_DLL(ClassName,FactoryName,GlobalName)        \
      29             : SotFactory * ClassName::ClassFactory()                                     \
      30             : {                                                                         \
      31             :     SotFactory **ppFactory = GetFactoryAdress();                           \
      32             :     if( !*ppFactory )                                                     \
      33             :     {                                                                     \
      34             :         *ppFactory = new FactoryName( GlobalName,                         \
      35             :             OUString( #ClassName ), ClassName::CreateInstance );     \
      36             :     }                                                                     \
      37             :     return *ppFactory;                                                    \
      38             : }                                                                         \
      39             : void * ClassName::CreateInstance( SotObject ** ppObj )            \
      40             : {                                                                         \
      41             :     ClassName * p = new ClassName();                                      \
      42             :     if( ppObj )                                                           \
      43             :         *ppObj = p;                                                       \
      44             :     return p;                                                             \
      45             : }                                                                         \
      46             : const SotFactory * ClassName::GetSvFactory() const                         \
      47             : {                                                                         \
      48             :     return ClassFactory();                                                \
      49             : }                                                                         \
      50             : void * ClassName::Cast( const SotFactory * pFact )                         \
      51             : {                                                                         \
      52             :     void * pRet = NULL;                                                   \
      53             :     if( !pFact || pFact == ClassFactory() )                               \
      54             :         pRet = this;                                                      \
      55             :     return pRet;                                                          \
      56             : }
      57             : 
      58             : #define SO2_IMPL_BASIC_CLASS1_DLL(ClassName,FactoryName,Super1,GlobalName)\
      59             : SotFactory * ClassName::ClassFactory()                                     \
      60             : {                                                                         \
      61             :     SotFactory **ppFactory = GetFactoryAdress();                           \
      62             :     if( !*ppFactory )                                                     \
      63             :     {                                                                     \
      64             :         *ppFactory = new FactoryName( GlobalName,                         \
      65             :             OUString( #ClassName ), ClassName::CreateInstance );     \
      66             :         (*ppFactory)->PutSuperClass( Super1::ClassFactory() );            \
      67             :     }                                                                     \
      68             :     return *ppFactory;                                                    \
      69             : }                                                                         \
      70             : void * ClassName::CreateInstance( SotObject ** ppObj )            \
      71             : {                                                                         \
      72             :     ClassName * p = new ClassName();                                      \
      73             :     Super1* pSuper1 = p;                                                  \
      74             :     SotObject* pBasicObj = pSuper1;                                        \
      75             :     if( ppObj )                                                           \
      76             :         *ppObj = pBasicObj;                                               \
      77             :     return p;                                                             \
      78             : }                                                                         \
      79             : const SotFactory * ClassName::GetSvFactory() const                \
      80             : {                                                                         \
      81             :     return ClassFactory();                                                \
      82             : }                                                                         \
      83             : void * ClassName::Cast( const SotFactory * pFact )                \
      84             : {                                                                         \
      85             :     void * pRet = NULL;                                                   \
      86             :     if( !pFact || pFact == ClassFactory() )                               \
      87             :         pRet = this;                                                      \
      88             :     if( !pRet )                                                           \
      89             :         pRet = Super1::Cast( pFact );                                     \
      90             :     return pRet;                                                          \
      91             : }
      92             : 
      93             : #ifdef _MSC_VER
      94             : #pragma warning(disable: 4250)
      95             : #endif
      96             : 
      97             : struct IUnknown;
      98             : class SOT_DLLPUBLIC SotObject : virtual public SvRefBase
      99             : {
     100             : friend class SotFactory;
     101             : friend class SvObject;
     102             :     sal_uInt16  nOwnerLockCount;
     103             :     bool        bOwner;
     104             :     bool        bSVObject;        // Ist Proxy, dann TRUE wenn andere Seite SV ist
     105             :     bool        bInClose;         // TRUE, im DoClose
     106             : 
     107             : protected:
     108             :     virtual             ~SotObject();
     109             :     void                SetExtern() { bOwner = false; }
     110             :     virtual bool        Close();
     111             : public:
     112             :                         SotObject();
     113             : 
     114             : private:
     115           0 :     static SotFactory **       GetFactoryAdress()
     116           0 :                               { return &(SOTDATA()->pSotObjectFactory); }
     117             : public:
     118             :     static void *             CreateInstance( SotObject ** = NULL );
     119             :     static SotFactory *        ClassFactory();
     120             :     virtual const SotFactory * GetSvFactory() const;
     121             :     virtual void *            Cast( const SotFactory * );
     122             : 
     123             :                         // Nur damit die Makros in So3 nicht ganz ausufern
     124             :     virtual IUnknown *  GetInterface( const SvGlobalName & );
     125             : 
     126             :     bool                Owner() const { return bOwner; }
     127             : 
     128           0 :     sal_uInt16          GetOwnerLockCount() const { return nOwnerLockCount; }
     129             : 
     130             :     void                OwnerLock( bool bLock );
     131             :     bool                DoClose();
     132           0 :     bool                IsInClose() const { return bInClose; }
     133             : 
     134             : private:
     135             :     // Kopieren und Zuweisen dieses Objekttyps ist nicht erlaubt
     136             :     SOT_DLLPRIVATE SotObject & operator = ( const SotObject & );
     137             :     SOT_DLLPRIVATE SotObject( const SotObject & );
     138             : };
     139             : 
     140             : //==================class SotObjectRef======================================
     141             : typedef tools::SvRef<SotObject> SotObjectRef;
     142             : 
     143             : #endif // _IFACE_HXX
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10