LCOV - code coverage report
Current view: top level - libreoffice/sfx2/inc/sfx2 - docfac.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 3 66.7 %
Date: 2012-12-27 Functions: 2 3 66.7 %
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             : #ifndef _SFX_OBJFAC_HXX
      20             : #define _SFX_OBJFAC_HXX
      21             : 
      22             : #include "sal/config.h"
      23             : #include "sfx2/dllapi.h"
      24             : #include <sal/types.h>
      25             : #include <tools/solar.h>
      26             : #include <tools/rtti.hxx>
      27             : 
      28             : // SFX_IMPL_MODULE_LIB
      29             : #include <osl/module.hxx>
      30             : #include <rtl/ustring.hxx>
      31             : 
      32             : #include <sfx2/objsh.hxx>
      33             : #include <sfx2/sfxdefs.hxx>
      34             : 
      35             : class SfxMedium;
      36             : class SfxFilter;
      37             : class SfxViewFactory;
      38             : struct SfxObjectFactory_Impl;
      39             : class SfxFilterContainer;
      40             : class SfxBindings;
      41             : 
      42             : //====================================================================
      43             : 
      44             : typedef void (*SfxVoidFunc)();
      45             : 
      46             : #define SDT_SDT_DOCFACTPRIO     10      // Explorer
      47             : #define SDT_SW_DOCFACTPRIO      20      // Text Document
      48             : #define SDT_SWW_DOCFACTPRIO     21      // Web Document
      49             : #define SDT_SC_DOCFACTPRIO      30      // Table Document
      50             : #define SDT_SI_DOCFACTPRIO      40      // Impress Document
      51             : #define SDT_SD_DOCFACTPRIO      41      // Draw Document
      52             : #define SDT_SCH_DOCFACTPRIO     50      // Chart Document
      53             : #define SDT_SMA_DOCFACTPRIO     60      // Math Document
      54             : #define SDT_SIM_DOCFACTPRIO     70      // Image Document
      55             : #define SDT_FRM_DOCFACTPRIO    100      // Frame Document
      56             : #define SDT_MSG_DOCFACTPRIO    110      // Message Document
      57             : #define SDT_SDB_DOCFACTPRIO    200      // Database Document
      58             : 
      59             : //====================================================================
      60             : 
      61             : class SFX2_DLLPUBLIC SfxObjectFactory
      62             : {
      63             : private:
      64             :     const char*             pShortName;
      65             :     SfxObjectFactory_Impl*  pImpl;      // Additional Data
      66             :     SfxObjectShellFlags     nFlags;
      67             :     SAL_DLLPRIVATE void Construct();
      68             : 
      69             : public:
      70             :     SfxObjectFactory( const SvGlobalName &rName, SfxObjectShellFlags nFlags, const char* pShortName );
      71             :     ~SfxObjectFactory();
      72             : 
      73             :     const SvGlobalName& GetClassId() const;
      74         505 :     SfxObjectShellFlags GetFlags() { return nFlags; }
      75         798 :     const char*     GetShortName() const { return pShortName; }
      76             :     String          GetFactoryURL() const;  // shortcut for "private:factory/GetShortName()"
      77           0 :     String          GetFactoryName() const { return rtl::OUString::createFromAscii(pShortName); }
      78             :     String          GetModuleName() const;
      79             :     SfxFilterContainer *GetFilterContainer( sal_Bool bForceLoad = sal_True) const;
      80             : 
      81             :     // Views
      82             :     void            RegisterViewFactory(SfxViewFactory &rFactory);
      83             :     sal_uInt16          GetViewFactoryCount() const;
      84             :     SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const;
      85             : 
      86             :     /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name
      87             :     SfxViewFactory* GetViewFactoryByViewName( const String& i_rViewName ) const;
      88             : 
      89             :     // Filter
      90             :     const SfxFilter* GetTemplateFilter() const;
      91             :     static String   GetStandardTemplate( const String& rServiceName );
      92             :     static void     SetStandardTemplate( const String& rServiceName, const String& rTemplateName );
      93             :     static void     SetSystemTemplate( const String& rServiceName, const String& rTemplateName );
      94             : 
      95             :     void            SetDocumentServiceName( const rtl::OUString& rServiceName );
      96             :     const rtl::OUString&    GetDocumentServiceName() const;
      97             : 
      98             :     SfxModule*      GetModule() const;
      99             : 
     100             :     SAL_DLLPRIVATE void SetModule_Impl( SfxModule* );
     101             :     SAL_DLLPRIVATE static void UpdateFilterContainers_Impl();
     102             :     SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const;
     103             : 
     104             : private:
     105             :     // Kopieren verboten
     106             :     SAL_DLLPRIVATE SfxObjectFactory(const SfxObjectFactory&);
     107             :     SAL_DLLPRIVATE const SfxObjectFactory& operator=(const SfxObjectFactory &);
     108             : };
     109             : 
     110             : //=========================================================================
     111             : 
     112             : #define SFX_DECL_OBJECTFACTORY()                                            \
     113             : public:                                                                     \
     114             :     static SfxObjectFactory&    Factory();                                  \
     115             :     virtual SfxObjectFactory&   GetFactory() const { return Factory(); }
     116             : 
     117             : #define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName)          \
     118             :     SfxObjectFactory& ClassName::Factory()                                  \
     119             :     {                                                                       \
     120             :         static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \
     121             :         return aObjectFactory;                                              \
     122             :     }
     123             : #endif // #ifndef _SFX_OBJFAC_HXX
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10