fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sw / inc / swmodule.hxx
blobdde838ea90c28929a8fcf080995df96037a64bd8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
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>
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;
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.
63 namespace com{ namespace sun{ namespace star{ namespace scanner{
64 class XScannerManager2;
65 }}}}
67 class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
69 String sActAuthor;
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;
88 SfxErrorHandler* pErrorHdl;
90 SwAttrPool *pAttrPool;
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;
97 // List of all Redline-authors.
98 std::vector<String>* pAuthorNames;
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;
108 sal_Bool bAuthorInitialised : 1;
109 sal_Bool bEmbeddedLoadSave : 1;
111 // Catch hint for DocInfo.
112 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
114 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
116 protected:
117 // Envelopes, labels.
118 void InsertEnv(SfxRequest&);
119 void InsertLab(SfxRequest&, sal_Bool bLabel);
121 public:
122 // public Data - used for internal Clipboard / Drag & Drop / XSelection
123 SwTransferable *pDragDrop, *pXSelection;
125 TYPEINFO();
126 SFX_DECL_INTERFACE(SW_INTERFACE_MODULE)
128 // This Ctor only for SW-Dll.
129 SwModule( SfxObjectFactory* pFact,
130 SfxObjectFactory* pWebFact,
131 SfxObjectFactory* pGlobalFact );
133 ~SwModule();
135 // Set view for internal use only. It is public only for technical reasons.
136 inline void SetView(SwView* pVw) { pView = pVw; }
137 inline SwView* GetView() { return pView; }
139 // Handler for slots.
140 void StateOther(SfxItemSet &);
142 void ExecOther(SfxRequest &); // Fields, formula...
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);
154 // Default page mode for text grid.
155 void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode);
157 void ApplyUserCharUnit(sal_Bool bApplyChar, sal_Bool bWeb); // apply_char_unit
159 // Create ConfigItems.
160 SwModuleOptions* GetModuleConfig() { return pModuleConfig;}
161 SwPrintOptions* GetPrtOptions(sal_Bool bWeb);
162 SwChapterNumRules* GetChapterNumRules();
163 SwStdFontConfig* GetStdFontConfig() { return pStdFontConfig; }
164 SwNavigationConfig* GetNavigationConfig();
165 SwToolbarConfigItem*GetToolbarConfig() { return pToolbarConfig; }
166 SwToolbarConfigItem*GetWebToolbarConfig() { return pWebToolbarConfig; }
167 SwDBConfig* GetDBConfig();
168 svtools::ColorConfig& GetColorConfig();
169 SvtAccessibilityOptions& GetAccessibilityOptions();
170 SvtCTLOptions& GetCTLOptions();
171 SvtUserOptions& GetUserOptions();
173 // Iterate over views.
174 static SwView* GetFirstView();
175 static SwView* GetNextView(SwView*);
177 sal_Bool IsEmbeddedLoadSave() const { return bEmbeddedLoadSave; }
178 void SetEmbeddedLoadSave( sal_Bool bFlag ) { bEmbeddedLoadSave = bFlag; }
180 void ShowDBObj( SwView& rView, const SwDBData& rData, sal_Bool bOnlyIfAvailable = sal_False);
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;
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
193 void GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
194 void GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
195 void GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
197 sal_uInt16 GetRedlineMarkPos();
198 const Color& GetRedlineMarkColor();
200 SvxCompareMode GetCompareMode() const;
201 sal_Bool IsUseRsid() const;
202 sal_Bool IsIgnorePieces() const;
203 sal_uInt16 GetPieceLen() const;
205 // Return defined DocStat - WordDelimiter.
206 const String& GetDocStatWordDelim() const;
208 // Pass metric of ModuleConfig (for HTML-export).
209 sal_uInt16 GetMetric( sal_Bool bWeb ) const;
211 // Pass update-statuses.
212 sal_uInt16 GetLinkUpdMode( sal_Bool bWeb ) const;
213 SwFldUpdateFlags GetFldUpdateFlags( sal_Bool bWeb ) const;
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 );
220 // Pool is created here and set at SfxShell.
221 void InitAttrPool();
222 // Delete pool before it is too late.
223 void RemoveAttrPool();
225 // Invalidates online spell-wrong-lists if necessary.
226 void CheckSpellChanges( bool bOnlineSpelling,
227 bool bIsSpellWrongAgain, bool bIsSpellAllAgain, bool bSmartTags );
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();
236 ::com::sun::star::uno::Reference<
237 ::com::sun::star::scanner::XScannerManager2 >
238 GetScannerManager();
240 ::com::sun::star::uno::Reference<
241 ::com::sun::star::linguistic2::XLanguageGuessing >
242 GetLanguageGuesser();
246 inline ::com::sun::star::uno::Reference<
247 ::com::sun::star::linguistic2::XLinguServiceEventListener >
248 SwModule::GetLngSvcEvtListener()
250 return xLngSvcEvtListener;
253 inline void SwModule::SetLngSvcEvtListener(
254 ::com::sun::star::uno::Reference<
255 ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr)
257 xLngSvcEvtListener = xLstnr;
261 // Access to SwModule, the ::com::sun::star::sdbcx::View and the shell.
263 #define SW_MOD() ( *(SwModule**) GetAppData(SHL_WRITER))
265 SW_DLLPUBLIC SwView* GetActiveView();
266 SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
268 #endif
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */