LCOV - code coverage report
Current view: top level - sw/source/core/uibase/app - swdll.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 45 0.0 %
Date: 2014-04-14 Functions: 0 8 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             : #include <config_features.h>
      21             : 
      22             : #include <svx/svdobj.hxx>
      23             : 
      24             : #include "globdoc.hrc"
      25             : 
      26             : #include <swdll.hxx>
      27             : #include <wdocsh.hxx>
      28             : #include <globdoc.hxx>
      29             : #include <initui.hxx>
      30             : #include <swmodule.hxx>
      31             : #include <swtypes.hxx>
      32             : #include <init.hxx>
      33             : #include <dobjfac.hxx>
      34             : #include <cfgid.h>
      35             : 
      36             : #include <com/sun/star/frame/Desktop.hpp>
      37             : #include <unotools/moduleoptions.hxx>
      38             : #include <comphelper/scoped_disposing_ptr.hxx>
      39             : #include <comphelper/processfactory.hxx>
      40             : 
      41             : #include <svx/fmobjfac.hxx>
      42             : #include <svx/svdfield.hxx>
      43             : #include <svx/objfac3d.hxx>
      44             : 
      45             : #include <unomid.h>
      46             : 
      47             : #include "swdllimpl.hxx"
      48             : 
      49             : using namespace com::sun::star;
      50             : 
      51             : namespace
      52             : {
      53             :     //Holds a SwDLL and release it on exit, or dispose of the
      54             :     //default XComponent, whichever comes first
      55           0 :     class SwDLLInstance : public comphelper::scoped_disposing_solar_mutex_reset_ptr<SwDLL>
      56             :     {
      57             :     public:
      58           0 :         SwDLLInstance() : comphelper::scoped_disposing_solar_mutex_reset_ptr<SwDLL>(uno::Reference<lang::XComponent>( frame::Desktop::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW), new SwDLL)
      59             :         {
      60           0 :         }
      61             :     };
      62             : 
      63             :     struct theSwDLLInstance : public rtl::Static<SwDLLInstance, theSwDLLInstance> {};
      64             : }
      65             : 
      66             : namespace SwGlobals
      67             : {
      68           0 :     void ensure()
      69             :     {
      70           0 :         theSwDLLInstance::get();
      71           0 :     }
      72             : 
      73           0 :     sw::Filters & getFilters()
      74             :     {
      75           0 :         return theSwDLLInstance::get().get()->getFilters();
      76             :     }
      77             : }
      78             : 
      79           0 : SwDLL::SwDLL()
      80             : {
      81             :     // the SdModule must be created
      82           0 :     SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
      83           0 :     if ( *ppShlPtr )
      84           0 :         return;
      85             : 
      86           0 :     SvtModuleOptions aOpt;
      87           0 :     SfxObjectFactory* pDocFact = 0;
      88           0 :     SfxObjectFactory* pGlobDocFact = 0;
      89           0 :     if ( aOpt.IsWriter() )
      90             :     {
      91           0 :         pDocFact = &SwDocShell::Factory();
      92           0 :         pGlobDocFact = &SwGlobalDocShell::Factory();
      93             :     }
      94             : 
      95           0 :     SfxObjectFactory* pWDocFact = &SwWebDocShell::Factory();
      96             : 
      97           0 :     SwModule* pModule = new SwModule( pWDocFact, pDocFact, pGlobDocFact );
      98           0 :     *ppShlPtr = pModule;
      99             : 
     100           0 :     pWDocFact->SetDocumentServiceName(OUString("com.sun.star.text.WebDocument"));
     101             : 
     102           0 :     if ( aOpt.IsWriter() )
     103             :     {
     104           0 :         pGlobDocFact->SetDocumentServiceName(OUString("com.sun.star.text.GlobalDocument"));
     105           0 :         pDocFact->SetDocumentServiceName(OUString("com.sun.star.text.TextDocument"));
     106             :     }
     107             : 
     108             :     // register SvDraw-Fields
     109           0 :     SdrRegisterFieldClasses();
     110             : 
     111             :     // register 3D-Objekt-Factory
     112           0 :     E3dObjFactory();
     113             : 
     114             :     // register form::component::Form-Objekt-Factory
     115           0 :     FmFormObjFactory();
     116             : 
     117           0 :     SdrObjFactory::InsertMakeObjectHdl( LINK( &aSwObjectFactory, SwObjectFactory, MakeObject ) );
     118             : 
     119             :     SAL_INFO( "sw.ui", "Init Core/UI/Filter" );
     120             :     // Initialisation of Statics
     121           0 :     ::_InitCore();
     122           0 :     filters_.reset(new sw::Filters);
     123           0 :     ::_InitUI();
     124             : 
     125           0 :     pModule->InitAttrPool();
     126             :     // now SWModule can create its Pool
     127             : 
     128             :     // register your view-factories here
     129           0 :     RegisterFactories();
     130             : 
     131             : #if HAVE_FEATURE_DESKTOP
     132             :     // register your shell-interfaces here
     133           0 :     RegisterInterfaces();
     134             : 
     135             :     // register your controllers here
     136           0 :     RegisterControls();
     137             : #endif
     138             : }
     139             : 
     140           0 : SwDLL::~SwDLL()
     141             : {
     142             :     // Pool has to be deleted before statics are
     143           0 :     SW_MOD()->RemoveAttrPool();
     144             : 
     145           0 :     ::_FinitUI();
     146           0 :     filters_.reset();
     147           0 :     ::_FinitCore();
     148             :     // sign out Objekt-Factory
     149           0 :     SdrObjFactory::RemoveMakeObjectHdl(LINK(&aSwObjectFactory, SwObjectFactory, MakeObject ));
     150             : #if 0
     151             :     // the SwModule must be destroyed
     152             :     SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
     153             :     delete (*ppShlPtr);
     154             :     (*ppShlPtr) = NULL;
     155             : #endif
     156           0 : }
     157             : 
     158           0 : sw::Filters & SwDLL::getFilters()
     159             : {
     160             :     OSL_ASSERT(filters_);
     161           0 :     return *filters_.get();
     162             : }
     163             : 
     164             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10