LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - swmodule.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 11 90.9 %
Date: 2012-12-27 Functions: 9 10 90.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             : #ifndef _SWMODULE_HXX
      20             : #define _SWMODULE_HXX
      21             : #include <tools/string.hxx>
      22             : #include <tools/fldunit.hxx>
      23             : #include <svl/lstner.hxx>
      24             : #include <unotools/options.hxx>
      25             : #include <sfx2/module.hxx>
      26             : 
      27             : #include <tools/shl.hxx>
      28             : #include "swdllapi.h"
      29             : #include "shellid.hxx"
      30             : #include <fldupde.hxx>
      31             : #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
      32             : #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
      33             : #include <editeng/svxenum.hxx>
      34             : 
      35             : class Color;
      36             : class SfxItemSet;
      37             : class SfxRequest;
      38             : class SfxErrorHandler;
      39             : class SwDBConfig;
      40             : class SwModuleOptions;
      41             : class SwMasterUsrPref;
      42             : class SwViewOption;
      43             : class SwView;
      44             : class SwWrtShell;
      45             : class SwPrintOptions;
      46             : class SwChapterNumRules;
      47             : class SwStdFontConfig;
      48             : class SwNavigationConfig;
      49             : class SwTransferable;
      50             : class SwToolbarConfigItem;
      51             : class SwAttrPool;
      52             : namespace svtools{ class ColorConfig;}
      53             : class SvtAccessibilityOptions;
      54             : class SvtCTLOptions;
      55             : class SvtUserOptions;
      56             : 
      57             : struct SwDBData;
      58             : #define VIEWOPT_DEST_VIEW       0
      59             : #define VIEWOPT_DEST_TEXT       1
      60             : #define VIEWOPT_DEST_WEB        2
      61             : #define VIEWOPT_DEST_VIEW_ONLY  3 //ViewOptions are set only at ::com::sun::star::sdbcx::View, not at the appl.
      62             : 
      63             : namespace com{ namespace sun{ namespace star{ namespace scanner{
      64             :     class XScannerManager2;
      65             : }}}}
      66             : 
      67             : class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
      68             : {
      69             :     String              sActAuthor;
      70             : 
      71             :     // ConfigItems
      72             :     SwModuleOptions*    pModuleConfig;
      73             :     SwMasterUsrPref*    pUsrPref;
      74             :     SwMasterUsrPref*    pWebUsrPref;
      75             :     SwPrintOptions*     pPrtOpt;
      76             :     SwPrintOptions*     pWebPrtOpt;
      77             :     SwChapterNumRules*  pChapterNumRules;
      78             :     SwStdFontConfig*    pStdFontConfig;
      79             :     SwNavigationConfig* pNavigationConfig;
      80             :     SwToolbarConfigItem*pToolbarConfig;     //For stacked toolbars. Which one was visible?
      81             :     SwToolbarConfigItem*pWebToolbarConfig;
      82             :     SwDBConfig*         pDBConfig;
      83             :     svtools::ColorConfig*   pColorConfig;
      84             :     SvtAccessibilityOptions* pAccessibilityOptions;
      85             :     SvtCTLOptions*      pCTLOptions;
      86             :     SvtUserOptions*     pUserOptions;
      87             : 
      88             :     SfxErrorHandler*    pErrorHdl;
      89             : 
      90             :     SwAttrPool          *pAttrPool;
      91             : 
      92             :     // Current view is held here in order to avoid one's being forced
      93             :     // to work via GetActiveView.
      94             :     // View is valid until destroyed in Activate or exchanged.
      95             :     SwView*             pView;
      96             : 
      97             :     // List of all Redline-authors.
      98             :     std::vector<String>*      pAuthorNames;
      99             : 
     100             :     // DictionaryList listener to trigger spellchecking or hyphenation
     101             :     ::com::sun::star::uno::Reference<
     102             :         ::com::sun::star::linguistic2::XLinguServiceEventListener > xLngSvcEvtListener;
     103             :     ::com::sun::star::uno::Reference<
     104             :         ::com::sun::star::scanner::XScannerManager2 >    m_xScannerManager;
     105             :     ::com::sun::star::uno::Reference<
     106             :         ::com::sun::star::linguistic2::XLanguageGuessing >  m_xLanguageGuesser;
     107             : 
     108             :     sal_Bool                bAuthorInitialised : 1;
     109             :     sal_Bool                bEmbeddedLoadSave : 1;
     110             : 
     111             :     // Catch hint for DocInfo.
     112             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
     113             : 
     114             :     virtual void        ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
     115             : 
     116             : protected:
     117             :     // Envelopes, labels.
     118             :     void                InsertEnv(SfxRequest&);
     119             :     void                InsertLab(SfxRequest&, sal_Bool bLabel);
     120             : 
     121             : public:
     122             :     // public Data - used for internal Clipboard / Drag & Drop / XSelection
     123             :     SwTransferable  *pDragDrop, *pXSelection;
     124             : 
     125             :     TYPEINFO();
     126          10 :     SFX_DECL_INTERFACE(SW_INTERFACE_MODULE)
     127             : 
     128             :     // This Ctor only for SW-Dll.
     129             :     SwModule( SfxObjectFactory* pFact,
     130             :                 SfxObjectFactory* pWebFact,
     131             :                     SfxObjectFactory* pGlobalFact );
     132             : 
     133             :     ~SwModule();
     134             : 
     135             :     // Set view for internal use only. It is public only for technical reasons.
     136         535 :     inline  void        SetView(SwView* pVw) { pView = pVw; }
     137          63 :     inline  SwView*     GetView() { return pView; }
     138             : 
     139             :     // Handler for slots.
     140             :     void                StateOther(SfxItemSet &);
     141             : 
     142             :     void                ExecOther(SfxRequest &);    // Fields, formula...
     143             : 
     144             :     // Modify user settings.
     145             :     const SwMasterUsrPref *GetUsrPref(sal_Bool bWeb) const;
     146             :     const SwViewOption* GetViewOption(sal_Bool bWeb);
     147             :     void                ApplyUsrPref(const SwViewOption &, SwView*,
     148             :                                      sal_uInt16 nDest = VIEWOPT_DEST_VIEW );
     149             :     void ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb );
     150             :     void ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb );
     151             :     void ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags);
     152             :     void ApplyLinkMode(sal_Int32 nNewLinkMode);
     153             : 
     154             :     // Default page mode for text grid.
     155             :     void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode);
     156             : 
     157             :     void ApplyUserCharUnit(sal_Bool bApplyChar, sal_Bool bWeb);  // apply_char_unit
     158             : 
     159             :     // Create ConfigItems.
     160          89 :     SwModuleOptions*    GetModuleConfig()       { return pModuleConfig;}
     161             :     SwPrintOptions*     GetPrtOptions(sal_Bool bWeb);
     162             :     SwChapterNumRules*  GetChapterNumRules();
     163         257 :     SwStdFontConfig*    GetStdFontConfig()      { return pStdFontConfig; }
     164             :     SwNavigationConfig* GetNavigationConfig();
     165         238 :     SwToolbarConfigItem*GetToolbarConfig()      { return pToolbarConfig;    }
     166           0 :     SwToolbarConfigItem*GetWebToolbarConfig()   { return pWebToolbarConfig; }
     167             :     SwDBConfig*         GetDBConfig();
     168             :     svtools::ColorConfig&   GetColorConfig();
     169             :     SvtAccessibilityOptions&    GetAccessibilityOptions();
     170             :     SvtCTLOptions&      GetCTLOptions();
     171             :     SvtUserOptions&     GetUserOptions();
     172             : 
     173             :     // Iterate over views.
     174             :     static SwView*      GetFirstView();
     175             :     static SwView*      GetNextView(SwView*);
     176             : 
     177         329 :     sal_Bool IsEmbeddedLoadSave() const         { return bEmbeddedLoadSave; }
     178         100 :     void SetEmbeddedLoadSave( sal_Bool bFlag )  { bEmbeddedLoadSave = bFlag; }
     179             : 
     180             :     void ShowDBObj( SwView& rView, const SwDBData& rData, sal_Bool bOnlyIfAvailable = sal_False);
     181             : 
     182             :     // Table modi.
     183             :     sal_Bool            IsInsTblFormatNum(sal_Bool bHTML) const;
     184             :     sal_Bool            IsInsTblChangeNumFormat(sal_Bool bHTML) const;
     185             :     sal_Bool            IsInsTblAlignNum(sal_Bool bHTML) const;
     186             : 
     187             :     // Redlining.
     188             :     sal_uInt16          GetRedlineAuthor();
     189             :     const String&       GetRedlineAuthor(sal_uInt16 nPos);
     190             :     sal_uInt16          InsertRedlineAuthor(const String& rAuthor);
     191             :     void                SetRedlineAuthor(const String& rAuthor); // for unit tests
     192             : 
     193             :     void                GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
     194             :     void                GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
     195             :     void                GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
     196             : 
     197             :     sal_uInt16              GetRedlineMarkPos();
     198             :     const Color&            GetRedlineMarkColor();
     199             : 
     200             :     SvxCompareMode      GetCompareMode() const;
     201             :     sal_Bool            IsUseRsid() const;
     202             :     sal_Bool            IsIgnorePieces() const;
     203             :     sal_uInt16          GetPieceLen() const;
     204             : 
     205             :     // Return defined DocStat - WordDelimiter.
     206             :     const String&       GetDocStatWordDelim() const;
     207             : 
     208             :     // Pass metric of ModuleConfig (for HTML-export).
     209             :     sal_uInt16 GetMetric( sal_Bool bWeb ) const;
     210             : 
     211             :     // Pass update-statuses.
     212             :     sal_uInt16 GetLinkUpdMode( sal_Bool bWeb ) const;
     213             :     SwFldUpdateFlags GetFldUpdateFlags( sal_Bool bWeb ) const;
     214             : 
     215             :     // Virtual methods for options dialog.
     216             :     virtual SfxItemSet*  CreateItemSet( sal_uInt16 nId );
     217             :     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
     218             :     virtual SfxTabPage*  CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
     219             : 
     220             :     // Pool is created here and set at SfxShell.
     221             :     void    InitAttrPool();
     222             :     // Delete pool before it is too late.
     223             :     void    RemoveAttrPool();
     224             : 
     225             :     // Invalidates online spell-wrong-lists if necessary.
     226             :     void    CheckSpellChanges( bool bOnlineSpelling,
     227             :                     bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags );
     228             : 
     229             :     inline ::com::sun::star::uno::Reference<
     230             :         ::com::sun::star::linguistic2::XLinguServiceEventListener >
     231             :             GetLngSvcEvtListener();
     232             :     inline void SetLngSvcEvtListener( ::com::sun::star::uno::Reference<
     233             :         ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr);
     234             :     void    CreateLngSvcEvtListener();
     235             : 
     236             :     ::com::sun::star::uno::Reference<
     237             :         ::com::sun::star::scanner::XScannerManager2 >
     238             :             GetScannerManager();
     239             : 
     240             :     ::com::sun::star::uno::Reference<
     241             :         ::com::sun::star::linguistic2::XLanguageGuessing >
     242             :             GetLanguageGuesser();
     243             : };
     244             : 
     245             : 
     246             : inline ::com::sun::star::uno::Reference<
     247             :     ::com::sun::star::linguistic2::XLinguServiceEventListener >
     248         379 :         SwModule::GetLngSvcEvtListener()
     249             : {
     250         379 :     return xLngSvcEvtListener;
     251             : }
     252             : 
     253             : inline void SwModule::SetLngSvcEvtListener(
     254             :     ::com::sun::star::uno::Reference<
     255             :        ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr)
     256             : {
     257             :     xLngSvcEvtListener = xLstnr;
     258             : }
     259             : 
     260             : 
     261             : //    Access to SwModule, the ::com::sun::star::sdbcx::View and the shell.
     262             : 
     263             : #define SW_MOD() ( *(SwModule**) GetAppData(SHL_WRITER))
     264             : 
     265             : SW_DLLPUBLIC SwView*    GetActiveView();
     266             : SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
     267             : 
     268             : #endif
     269             : 
     270             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10