LCOV - code coverage report
Current view: top level - sw/inc - swmodule.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 11 100.0 %
Date: 2015-06-13 12:38:46 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 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             :     bool                bAuthorInitialised : 1;
     108             :     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&, bool bLabel);
     119             : 
     120             : public:
     121             :     // public Data - used for internal Clipboard / Drag & Drop / XSelection
     122             :     SwTransferable  *pDragDrop, *pXSelection;
     123             : 
     124             :     TYPEINFO_OVERRIDE();
     125          59 :     SFX_DECL_INTERFACE(SW_INTERFACE_MODULE)
     126             : 
     127             : private:
     128             :     /// SfxInterface initializer.
     129             :     static void InitInterface_Impl();
     130             : 
     131             : public:
     132             :     // This Ctor only for SW-Dll.
     133             :     SwModule( SfxObjectFactory* pFact,
     134             :                 SfxObjectFactory* pWebFact,
     135             :                     SfxObjectFactory* pGlobalFact );
     136             : 
     137             :     virtual ~SwModule();
     138             : 
     139             :     // Set view for internal use only. It is public only for technical reasons.
     140        8166 :     inline  void        SetView(SwView* pVw) { pView = pVw; }
     141        2757 :     inline  SwView*     GetView() { return pView; }
     142             : 
     143             :     // Handler for slots.
     144             :     void                StateOther(SfxItemSet &);
     145             : 
     146             :     void                ExecOther(SfxRequest &);    // Fields, formula...
     147             : 
     148             :     // Modify user settings.
     149             :     const SwMasterUsrPref *GetUsrPref(bool bWeb) const;
     150             :     const SwViewOption* GetViewOption(bool bWeb);
     151             :     void                ApplyUsrPref(const SwViewOption &, SwView*,
     152             :                                      sal_uInt16 nDest = VIEWOPT_DEST_VIEW );
     153             :     void ApplyUserMetric( FieldUnit eMetric, bool bWeb );
     154             :     void ApplyRulerMetric( FieldUnit eMetric, bool bHorizontal, bool bWeb );
     155             :     void ApplyFieldUpdateFlags(SwFieldUpdateFlags eFieldFlags);
     156             :     void ApplyLinkMode(sal_Int32 nNewLinkMode);
     157             : 
     158             :     // Default page mode for text grid.
     159             :     void ApplyDefaultPageMode(bool bIsSquaredPageMode);
     160             : 
     161             :     void ApplyUserCharUnit(bool bApplyChar, bool bWeb);  // apply_char_unit
     162             : 
     163             :     // Create ConfigItems.
     164        3724 :     SwModuleOptions*    GetModuleConfig()       { return pModuleConfig;}
     165             :     SwPrintOptions*     GetPrtOptions(bool bWeb);
     166             :     SwChapterNumRules*  GetChapterNumRules();
     167        2667 :     SwStdFontConfig*    GetStdFontConfig()      { return pStdFontConfig; }
     168             :     SwNavigationConfig* GetNavigationConfig();
     169        2776 :     SwToolbarConfigItem*GetToolbarConfig()      { return pToolbarConfig;    }
     170           2 :     SwToolbarConfigItem*GetWebToolbarConfig()   { return pWebToolbarConfig; }
     171             :     SwDBConfig*         GetDBConfig();
     172             :     svtools::ColorConfig&   GetColorConfig();
     173             :     SvtAccessibilityOptions&    GetAccessibilityOptions();
     174             :     SvtCTLOptions&      GetCTLOptions();
     175             :     SvtUserOptions&     GetUserOptions();
     176             : 
     177             :     // Iterate over views.
     178             :     static SwView*      GetFirstView();
     179             :     static SwView*      GetNextView(SwView*);
     180             : 
     181       80628 :     bool IsEmbeddedLoadSave() const         { return bEmbeddedLoadSave; }
     182         828 :     void SetEmbeddedLoadSave( bool bFlag )  { bEmbeddedLoadSave = bFlag; }
     183             : 
     184             :     static void ShowDBObj( SwView& rView, const SwDBData& rData, bool bOnlyIfAvailable = false);
     185             : 
     186             :     // Table modi.
     187             :     bool            IsInsTableFormatNum(bool bHTML) const;
     188             :     bool            IsInsTableChangeNumFormat(bool bHTML) const;
     189             :     bool            IsInsTableAlignNum(bool bHTML) const;
     190             : 
     191             :     // Redlining.
     192             :     sal_uInt16          GetRedlineAuthor();
     193             :     OUString            GetRedlineAuthor(sal_uInt16 nPos);
     194             :     sal_uInt16          InsertRedlineAuthor(const OUString& rAuthor);
     195             :     void                SetRedlineAuthor(const OUString& rAuthor); // for unit tests
     196             : 
     197             :     void                GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
     198             :     void                GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
     199             :     void                GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
     200             : 
     201             :     sal_uInt16              GetRedlineMarkPos();
     202             :     const Color&            GetRedlineMarkColor();
     203             : 
     204             :     SvxCompareMode      GetCompareMode() const;
     205             :     bool            IsUseRsid() const;
     206             :     bool            IsIgnorePieces() const;
     207             :     sal_uInt16          GetPieceLen() const;
     208             : 
     209             :     // Return defined DocStat - WordDelimiter.
     210             :     OUString            GetDocStatWordDelim() const;
     211             : 
     212             :     // Pass metric of ModuleConfig (for HTML-export).
     213             :     FieldUnit GetMetric( bool bWeb ) const;
     214             : 
     215             :     // Pass update-statuses.
     216             :     sal_uInt16 GetLinkUpdMode( bool bWeb ) const;
     217             :     SwFieldUpdateFlags GetFieldUpdateFlags( bool bWeb ) const;
     218             : 
     219             :     // Virtual methods for options dialog.
     220             :     virtual SfxItemSet*  CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
     221             :     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
     222             :     virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
     223             : 
     224             :     // Pool is created here and set at SfxShell.
     225             :     void    InitAttrPool();
     226             :     // Delete pool before it is too late.
     227             :     void    RemoveAttrPool();
     228             : 
     229             :     // Invalidates online spell-wrong-lists if necessary.
     230             :     static void  CheckSpellChanges( bool bOnlineSpelling,
     231             :                     bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags );
     232             : 
     233             :     inline ::com::sun::star::uno::Reference<
     234             :         ::com::sun::star::linguistic2::XLinguServiceEventListener >
     235             :             GetLngSvcEvtListener();
     236             :     inline void SetLngSvcEvtListener( ::com::sun::star::uno::Reference<
     237             :         ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr);
     238             :     void    CreateLngSvcEvtListener();
     239             : 
     240             :     ::com::sun::star::uno::Reference<
     241             :         ::com::sun::star::scanner::XScannerManager2 >
     242             :             GetScannerManager();
     243             : 
     244             :     ::com::sun::star::uno::Reference<
     245             :         ::com::sun::star::linguistic2::XLanguageGuessing >
     246             :             GetLanguageGuesser();
     247             : };
     248             : 
     249             : inline ::com::sun::star::uno::Reference<
     250             :     ::com::sun::star::linguistic2::XLinguServiceEventListener >
     251    48550482 :         SwModule::GetLngSvcEvtListener()
     252             : {
     253    48550482 :     return xLngSvcEvtListener;
     254             : }
     255             : 
     256             : inline void SwModule::SetLngSvcEvtListener(
     257             :     ::com::sun::star::uno::Reference<
     258             :        ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr)
     259             : {
     260             :     xLngSvcEvtListener = xLstnr;
     261             : }
     262             : 
     263             : //    Access to SwModule, the View and the shell.
     264             : 
     265             : #define SW_MOD() ( *reinterpret_cast<SwModule**>(GetAppData(SHL_WRITER)))
     266             : 
     267             : SW_DLLPUBLIC SwView*    GetActiveView();
     268             : SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
     269             : 
     270             : #endif
     271             : 
     272             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11