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

Generated by: LCOV version 1.10