LCOV - code coverage report
Current view: top level - include/unotools - moduleoptions.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 1 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 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_UNOTOOLS_MODULEOPTIONS_HXX
      21             : #define INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
      22             : 
      23             : #include <unotools/unotoolsdllapi.h>
      24             : #include <salhelper/singletonref.hxx>
      25             : #include <com/sun/star/frame/XModel.hpp>
      26             : #include <com/sun/star/uno/Sequence.hxx>
      27             : #include <rtl/ustring.hxx>
      28             : #include <sal/types.h>
      29             : #include <osl/mutex.hxx>
      30             : #include <unotools/options.hxx>
      31             : 
      32             : /*-************************************************************************************************************
      33             :     @short          forward declaration to our private date container implementation
      34             :     @descr          We use these class as internal member to support small memory requirements.
      35             :                     You can create the container if it is necessary. The class which use these mechanism
      36             :                     is faster and smaller then a complete implementation!
      37             : *//*-*************************************************************************************************************/
      38             : class SvtModuleOptions_Impl;
      39             : 
      40             : /*-************************************************************************************************************
      41             :     @short          collect information about installation state of modules
      42             :     @descr          Use these class to get installation state of different office modules like writer, calc etc
      43             :                     Further you can ask for additional information; e.g. name of standard template file, which
      44             :                     should be used by corresponding module; or short/long name of these module factory.
      45             :     @devstatus      ready to use
      46             :     @threadsafe     yes
      47             : *//*-*************************************************************************************************************/
      48             : class UNOTOOLS_DLLPUBLIC SAL_WARN_UNUSED SvtModuleOptions : public utl::detail::Options
      49             : {
      50             :     public:
      51             : 
      52             :         enum class EModule
      53             :         {
      54             :             WRITER       = 0,
      55             :             CALC         = 1,
      56             :             DRAW         = 2,
      57             :             IMPRESS      = 3,
      58             :             MATH         = 4,
      59             :             CHART        = 5,
      60             :             STARTMODULE  = 6,
      61             :             BASIC        = 7,
      62             :             DATABASE     = 8,
      63             :             WEB          = 9,
      64             :             GLOBAL       = 10
      65             :         };
      66             : 
      67             :         /*ATTENTION:
      68             :             If you change these enum ... don't forget to change reading/writing and order of configuration values too!
      69             :             See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further information.
      70             :          */
      71             :         enum class EFactory
      72             :         {
      73             :             UNKNOWN_FACTORY = -1,
      74             :             WRITER        =  0,
      75             :             WRITERWEB     =  1,
      76             :             WRITERGLOBAL  =  2,
      77             :             CALC          =  3,
      78             :             DRAW          =  4,
      79             :             IMPRESS       =  5,
      80             :             MATH          =  6,
      81             :             CHART         =  7,
      82             :             STARTMODULE   =  8,
      83             :             DATABASE      =  9,
      84             :             BASIC         = 10,
      85             :             LAST = BASIC
      86             :         };
      87             : 
      88             :     public:
      89             : 
      90             :          SvtModuleOptions();
      91             :         virtual ~SvtModuleOptions();
      92             : 
      93             :         bool        IsModuleInstalled         (       EModule          eModule    ) const;
      94             :         OUString GetModuleName             (       EModule          eModule    ) const;
      95             :         OUString GetFactoryName            (       EFactory         eFactory   ) const;
      96             :         OUString GetFactoryStandardTemplate(       EFactory         eFactory   ) const;
      97             :         OUString GetFactoryEmptyDocumentURL(       EFactory         eFactory   ) const;
      98             :         OUString GetFactoryDefaultFilter   (       EFactory         eFactory   ) const;
      99             :         bool        IsDefaultFilterReadonly   (       EFactory         eFactory   ) const;
     100             :         sal_Int32       GetFactoryIcon            (       EFactory         eFactory   ) const;
     101             :         static bool ClassifyFactoryByName     ( const OUString& sName      ,
     102             :                                                           EFactory&        eFactory   );
     103             :         void            SetFactoryStandardTemplate(       EFactory         eFactory   ,
     104             :                                                     const OUString& sTemplate  );
     105             :         void            SetFactoryDefaultFilter   (       EFactory         eFactory   ,
     106             :                                                     const OUString& sFilter    );
     107             : 
     108             :         /** @short  return the corresponding application ID for the given
     109             :                     document service name.
     110             :          */
     111             :         static EFactory ClassifyFactoryByServiceName(const OUString& sName);
     112             : 
     113             :         /** @short  return the corresponding application ID for the given
     114             :                     short name.
     115             :          */
     116             :         static EFactory ClassifyFactoryByShortName(const OUString& sName);
     117             : 
     118             :         /** @short  return the corresponding application ID for the given properties.
     119             : 
     120             :             @descr  Because this search base on filters currently (till we have a better solution)
     121             :                     a result is not guaranteed every time. May a filter does not exists for the specified
     122             :                     content (but a FrameLoader which is not bound to any application!) ... or
     123             :                     the given properties describe a stream (and we make no deep detection inside here!).
     124             : 
     125             :             @attention  The module BASIC can't be detected here. Because it does not
     126             :                         has an own URL schema.
     127             : 
     128             :             @param  sURL
     129             :                     the complete URL!
     130             : 
     131             :             @param  lMediaDescriptor
     132             :                     additional information
     133             : 
     134             :             @return A suitable enum value. See EFactory above.
     135             :          */
     136             :         static EFactory ClassifyFactoryByURL(const OUString&                                                           sURL            ,
     137             :                                              const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lMediaDescriptor);
     138             : 
     139             :         /** @short  return the corresponding application ID for the given properties.
     140             : 
     141             :             @descr  Here we try to use the list of supported service names of the given model
     142             :                     to find out the right application module.
     143             : 
     144             :             @attention  The module BASIC can't be detected here. Because it does not
     145             :                         support any model/ctrl/view paradigm.
     146             : 
     147             :             @param  xModel
     148             :                     the document model
     149             : 
     150             :             @return A suitable enum value. See EFactory above.
     151             :          */
     152             :         static EFactory ClassifyFactoryByModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel);
     153             : 
     154             :         static OUString GetFactoryShortName(EFactory eFactory);
     155             : 
     156             :         OUString GetDefaultModuleName();
     157             : 
     158             :         bool   IsMath     () const;
     159             :         bool   IsChart    () const;
     160             :         bool   IsCalc     () const;
     161             :         bool   IsDraw     () const;
     162             :         bool   IsWriter   () const;
     163             :         bool   IsImpress  () const;
     164           0 :         static bool   IsBasicIDE () { return true; }
     165             :         bool   IsDataBase () const;
     166             : 
     167             :         ::com::sun::star::uno::Sequence < OUString > GetAllServiceNames();
     168             : 
     169             :     private:
     170             :         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex();
     171             : 
     172             :         /*Attention
     173             : 
     174             :             Don't initialize these static members in these headers!
     175             :             a) Double defined symbols will be detected ...
     176             :             b) and unresolved externals exist at linking time.
     177             :             Do it in your source only.
     178             :          */
     179             : 
     180             :         static SvtModuleOptions_Impl*   m_pDataContainer;
     181             :         static sal_Int32                m_nRefCount;
     182             : 
     183             : };      // class SvtModuleOptions
     184             : 
     185             : #endif // INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11