LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/starmath/inc - smmod.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 13 19 68.4 %
Date: 2013-07-09 Functions: 7 10 70.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 _SMMOD_HXX
      21             : #define _SMMOD_HXX
      22             : 
      23             : #include <tools/resary.hxx>
      24             : #include <svl/lstner.hxx>
      25             : #include <svtools/colorcfg.hxx>
      26             : 
      27             : #include <tools/shl.hxx>
      28             : #include <sfx2/module.hxx>
      29             : 
      30             : #include "starmath.hrc"
      31             : 
      32             : #include <unotools/options.hxx>
      33             : 
      34             : class SfxObjectFactory;
      35             : class SmConfig;
      36             : class SmModule;
      37             : class SmSymbolManager;
      38             : 
      39             : /*************************************************************************
      40             : |*
      41             : |* This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
      42             : |* linked to the DLL. One instance of this class exists while the DLL is
      43             : |* loaded.
      44             : |*
      45             : |* SdModule is like to be compared with the <SfxApplication>-subclass.
      46             : |*
      47             : |* Remember: Don`t export this class! It uses DLL-internal symbols.
      48             : |*
      49             : \************************************************************************/
      50             : 
      51             : class SvtSysLocale;
      52             : class VirtualDevice;
      53             : 
      54             : /////////////////////////////////////////////////////////////////
      55             : 
      56             : class SmResId : public ResId
      57             : {
      58             : public:
      59             :     SmResId(sal_uInt16 nId);
      60             : };
      61             : 
      62             : #define SM_RESSTR(x) SmResId(x).toString()
      63             : 
      64           0 : class SmNamesArray : public Resource
      65             : {
      66             :     ResStringArray      aNamesAry;
      67             :     LanguageType        nLanguage;
      68             : 
      69             : public:
      70           0 :     SmNamesArray( LanguageType nLang, int nRID ) :
      71             :         Resource( SmResId(RID_LOCALIZED_NAMES) ),
      72             :         aNamesAry   (SmResId( static_cast < sal_uInt16 > ( nRID ))),
      73           0 :         nLanguage   (nLang)
      74             :     {
      75           0 :         FreeResource();
      76           0 :     }
      77             : 
      78             :     LanguageType            GetLanguage() const     { return nLanguage; }
      79           0 :     const ResStringArray&   GetNamesArray() const   { return aNamesAry; }
      80             : };
      81             : 
      82             : /////////////////////////////////////////////////////////////////
      83             : 
      84             : class SmLocalizedSymbolData : public Resource
      85             : {
      86             :     ResStringArray      aUiSymbolNamesAry;
      87             :     ResStringArray      aExportSymbolNamesAry;
      88             :     ResStringArray      aUiSymbolSetNamesAry;
      89             :     ResStringArray      aExportSymbolSetNamesAry;
      90             :     SmNamesArray       *p50NamesAry;
      91             :     SmNamesArray       *p60NamesAry;
      92             :     LanguageType        n50NamesLang;
      93             :     LanguageType        n60NamesLang;
      94             : 
      95             : public:
      96             :     SmLocalizedSymbolData();
      97             :     ~SmLocalizedSymbolData();
      98             : 
      99         330 :     const ResStringArray& GetUiSymbolNamesArray() const     { return aUiSymbolNamesAry; }
     100         330 :     const ResStringArray& GetExportSymbolNamesArray() const { return aExportSymbolNamesAry; }
     101             :     const String          GetUiSymbolName( const String &rExportName ) const;
     102             :     const String          GetExportSymbolName( const String &rUiName ) const;
     103             : 
     104         465 :     const ResStringArray& GetUiSymbolSetNamesArray() const     { return aUiSymbolSetNamesAry; }
     105         465 :     const ResStringArray& GetExportSymbolSetNamesArray() const { return aExportSymbolSetNamesAry; }
     106             :     const String          GetUiSymbolSetName( const String &rExportName ) const;
     107             :     const String          GetExportSymbolSetName( const String &rUiName ) const;
     108             : 
     109             :     const ResStringArray* Get50NamesArray( LanguageType nLang );
     110             :     const ResStringArray* Get60NamesArray( LanguageType nLang );
     111             : };
     112             : 
     113             : /////////////////////////////////////////////////////////////////
     114             : 
     115             : class SmModule : public SfxModule, utl::ConfigurationListener
     116             : {
     117             :     svtools::ColorConfig        *pColorConfig;
     118             :     SmConfig                *pConfig;
     119             :     SmLocalizedSymbolData   *pLocSymbolData;
     120             :     SvtSysLocale            *pSysLocale;
     121             :     VirtualDevice           *pVirtualDev;
     122             : 
     123             :     void _CreateSysLocale() const;
     124             :     void _CreateVirtualDev() const;
     125             : 
     126             :     void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
     127             : 
     128             : public:
     129             :     TYPEINFO();
     130           7 :     SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0)
     131             : 
     132             :     SmModule(SfxObjectFactory* pObjFact);
     133             :     virtual ~SmModule();
     134             : 
     135             :     virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
     136             : 
     137             :     svtools::ColorConfig &  GetColorConfig();
     138             : 
     139             :     SmConfig *              GetConfig();
     140             :     SmSymbolManager &       GetSymbolManager();
     141             : 
     142             :     SmLocalizedSymbolData &   GetLocSymbolData() const;
     143             : 
     144             :     void GetState(SfxItemSet&);
     145             : 
     146       12798 :     const SvtSysLocale& GetSysLocale() const
     147             :     {
     148       12798 :         if( !pSysLocale )
     149           7 :             _CreateSysLocale();
     150       12798 :         return *pSysLocale;
     151             :     }
     152             : 
     153         268 :     VirtualDevice &     GetDefaultVirtualDev()
     154             :     {
     155         268 :         if (!pVirtualDev)
     156           7 :             _CreateVirtualDev();
     157         268 :         return *pVirtualDev;
     158             :     }
     159             : 
     160             :     //virtual methods for options dialog
     161             :     virtual SfxItemSet*  CreateItemSet( sal_uInt16 nId );
     162             :     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
     163             :     virtual SfxTabPage*  CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
     164             : };
     165             : 
     166             : #define SM_MOD() ( *(SmModule**) GetAppData(SHL_SM) )
     167             : 
     168             : #endif                                 // _SDMOD_HXX
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10