1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: swmodule.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <tools/link.hxx>
33 #include <tools/string.hxx>
34 #include <vcl/fldunit.hxx>
35 #include <svtools/lstner.hxx>
36 #include <sfx2/module.hxx>
38 #include <tools/shl.hxx>
39 #include <svtools/lstner.hxx>
41 #include "shellid.hxx"
42 #include <fldupde.hxx>
43 #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
44 #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
50 class SfxErrorHandler
;
52 class SwModuleOptions
;
53 class SwMasterUsrPref
;
58 class SwChapterNumRules
;
59 class SwStdFontConfig
;
60 class SwNavigationConfig
;
62 class SwToolbarConfigItem
;
64 namespace svtools
{ class ColorConfig
;}
65 class SvtAccessibilityOptions
;
71 #define VIEWOPT_DEST_VIEW 0
72 #define VIEWOPT_DEST_TEXT 1
73 #define VIEWOPT_DEST_WEB 2
74 #define VIEWOPT_DEST_VIEW_ONLY 3 //ViewOptions werden nur an der ::com::sun::star::sdbcx::View, nicht an der Appl. gesetzt
76 namespace com
{ namespace sun
{ namespace star
{ namespace scanner
{
77 class XScannerManager
;
80 class SW_DLLPUBLIC SwModule
: public SfxModule
, public SfxListener
85 SwModuleOptions
* pModuleConfig
;
86 SwMasterUsrPref
* pUsrPref
;
87 SwMasterUsrPref
* pWebUsrPref
;
88 SwPrintOptions
* pPrtOpt
;
89 SwPrintOptions
* pWebPrtOpt
;
90 SwChapterNumRules
* pChapterNumRules
;
91 SwStdFontConfig
* pStdFontConfig
;
92 SwNavigationConfig
* pNavigationConfig
;
93 SwToolbarConfigItem
*pToolbarConfig
; //fuer gestackte Toolbars, welche
94 SwToolbarConfigItem
*pWebToolbarConfig
; //war sichtbar?
95 SwDBConfig
* pDBConfig
;
96 svtools::ColorConfig
* pColorConfig
;
97 SvtAccessibilityOptions
* pAccessibilityOptions
;
98 SvtCTLOptions
* pCTLOptions
;
99 SvtUserOptions
* pUserOptions
;
100 SvtUndoOptions
* pUndoOptions
;
102 SfxErrorHandler
* pErrorHdl
;
104 SwAttrPool
*pAttrPool
;
106 // Die aktuelle View wird hier gehalten um nicht ueber
107 // GetActiveView arbeiten zu muessen
108 // Die View ist solange gueltig bis Sie im Activate
109 // zerstoert oder ausgetauscht wird
112 // Liste aller Redline-Autoren
113 SvStringsDtor
* pAuthorNames
;
115 // DictionaryList listener to trigger spellchecking or hyphenation
116 ::com::sun::star::uno::Reference
<
117 ::com::sun::star::linguistic2::XLinguServiceEventListener
> xLngSvcEvtListener
;
118 ::com::sun::star::uno::Reference
<
119 ::com::sun::star::scanner::XScannerManager
> m_xScannerManager
;
120 ::com::sun::star::uno::Reference
<
121 ::com::sun::star::linguistic2::XLanguageGuessing
> m_xLanguageGuesser
;
123 sal_Bool bAuthorInitialised
: 1;
124 sal_Bool bEmbeddedLoadSave
: 1;
126 // Hint abfangen fuer DocInfo
127 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
130 // Briefumschlaege, Etiketten
131 void InsertEnv(SfxRequest
&);
132 void InsertLab(SfxRequest
&, sal_Bool bLabel
);
135 // public Data - used for internal Clipboard / Drag & Drop / XSelection
136 SwTransferable
*pClipboard
, *pDragDrop
, *pXSelection
;
139 SFX_DECL_INTERFACE(SW_INTERFACE_MODULE
)
141 // dieser Ctor nur fuer SW-Dll
142 SwModule( SfxObjectFactory
* pFact
,
143 SfxObjectFactory
* pWebFact
,
144 SfxObjectFactory
* pGlobalFact
);
148 // View setzen nur fuer internen Gebrauch,
149 // aus techn. Gruenden public
151 inline void SetView(SwView
* pVw
) { pView
= pVw
; }
152 inline SwView
* GetView() { return pView
; }
154 //Die Handler fuer die Slots
155 void StateOther(SfxItemSet
&); // andere
157 void ExecOther(SfxRequest
&); // Felder, Formel ..
159 // Benutzereinstellungen modifizieren
160 const SwMasterUsrPref
*GetUsrPref(sal_Bool bWeb
) const;
161 const SwViewOption
* GetViewOption(sal_Bool bWeb
);
162 void ApplyUsrPref(const SwViewOption
&, SwView
*,
163 sal_uInt16 nDest
= VIEWOPT_DEST_VIEW
);
164 void ApplyUserMetric( FieldUnit eMetric
, BOOL bWeb
);
165 void ApplyRulerMetric( FieldUnit eMetric
, BOOL bHorizontal
, BOOL bWeb
);
166 void ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags
);
167 void ApplyLinkMode(sal_Int32 nNewLinkMode
);
169 //default page mode for text grid
170 void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode
);
172 void ApplyUserCharUnit(BOOL bApplyChar
, BOOL bWeb
); // apply_char_unit
174 // ConfigItems erzeugen
175 SwModuleOptions
* GetModuleConfig() { return pModuleConfig
;}
176 SwPrintOptions
* GetPrtOptions(sal_Bool bWeb
);
177 SwChapterNumRules
* GetChapterNumRules();
178 SwStdFontConfig
* GetStdFontConfig() { return pStdFontConfig
; }
179 SwNavigationConfig
* GetNavigationConfig();
180 SwToolbarConfigItem
*GetToolbarConfig() { return pToolbarConfig
; }
181 SwToolbarConfigItem
*GetWebToolbarConfig() { return pWebToolbarConfig
; }
182 SwDBConfig
* GetDBConfig();
183 svtools::ColorConfig
& GetColorConfig();
184 SvtAccessibilityOptions
& GetAccessibilityOptions();
185 SvtCTLOptions
& GetCTLOptions();
186 SvtUserOptions
& GetUserOptions();
187 SvtUndoOptions
& GetUndoOptions();
189 // Ueber Sichten iterieren
190 static SwView
* GetFirstView();
191 static SwView
* GetNextView(SwView
*);
193 sal_Bool
IsEmbeddedLoadSave() const { return bEmbeddedLoadSave
; }
194 void SetEmbeddedLoadSave( sal_Bool bFlag
) { bEmbeddedLoadSave
= bFlag
; }
196 void ShowDBObj( SwView
& rView
, const SwDBData
& rData
, BOOL bOnlyIfAvailable
= FALSE
);
199 sal_Bool
IsInsTblFormatNum(sal_Bool bHTML
) const;
200 sal_Bool
IsInsTblChangeNumFormat(sal_Bool bHTML
) const;
201 sal_Bool
IsInsTblAlignNum(sal_Bool bHTML
) const;
204 sal_uInt16
GetRedlineAuthor();
205 const String
& GetRedlineAuthor(sal_uInt16 nPos
);
206 sal_uInt16
InsertRedlineAuthor(const String
& rAuthor
);
208 void GetInsertAuthorAttr(sal_uInt16 nAuthor
, SfxItemSet
&rSet
);
209 void GetDeletedAuthorAttr(sal_uInt16 nAuthor
, SfxItemSet
&rSet
);
210 void GetFormatAuthorAttr(sal_uInt16 nAuthor
, SfxItemSet
&rSet
);
212 sal_uInt16
GetRedlineMarkPos();
213 const Color
& GetRedlineMarkColor();
215 // returne den definierten DocStat - WordDelimiter
216 const String
& GetDocStatWordDelim() const;
218 // Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
219 sal_uInt16
GetMetric( sal_Bool bWeb
) const;
221 // Update-Stati durchreichen
222 sal_uInt16
GetLinkUpdMode( sal_Bool bWeb
) const;
223 SwFldUpdateFlags
GetFldUpdateFlags( sal_Bool bWeb
) const;
225 //virtuelle Methoden fuer den Optionendialog
226 virtual SfxItemSet
* CreateItemSet( sal_uInt16 nId
);
227 virtual void ApplyItemSet( sal_uInt16 nId
, const SfxItemSet
& rSet
);
228 virtual SfxTabPage
* CreateTabPage( sal_uInt16 nId
, Window
* pParent
, const SfxItemSet
& rSet
);
230 //hier wird der Pool angelegt und an der SfxShell gesetzt
232 //Pool loeschen bevor es zu spaet ist
233 void RemoveAttrPool();
235 // Invalidiert ggf. OnlineSpell-WrongListen
236 void CheckSpellChanges( sal_Bool bOnlineSpelling
,
237 sal_Bool bIsSpellWrongAgain
, sal_Bool bIsSpellAllAgain
, sal_Bool bSmartTags
);
239 inline ::com::sun::star::uno::Reference
<
240 ::com::sun::star::linguistic2::XLinguServiceEventListener
>
241 GetLngSvcEvtListener();
242 inline void SetLngSvcEvtListener( ::com::sun::star::uno::Reference
<
243 ::com::sun::star::linguistic2::XLinguServiceEventListener
> & xLstnr
);
244 void CreateLngSvcEvtListener();
246 ::com::sun::star::uno::Reference
<
247 ::com::sun::star::scanner::XScannerManager
>
250 ::com::sun::star::uno::Reference
<
251 ::com::sun::star::linguistic2::XLanguageGuessing
>
252 GetLanguageGuesser();
256 inline ::com::sun::star::uno::Reference
<
257 ::com::sun::star::linguistic2::XLinguServiceEventListener
>
258 SwModule::GetLngSvcEvtListener()
260 return xLngSvcEvtListener
;
263 inline void SwModule::SetLngSvcEvtListener(
264 ::com::sun::star::uno::Reference
<
265 ::com::sun::star::linguistic2::XLinguServiceEventListener
> & xLstnr
)
267 xLngSvcEvtListener
= xLstnr
;
271 /*-----------------08.07.97 10.33-------------------
272 Zugriff auf das SwModule, die ::com::sun::star::sdbcx::View und die Shell
273 --------------------------------------------------*/
275 #define SW_MOD() ( *(SwModule**) GetAppData(SHL_WRITER))
277 SW_DLLPUBLIC SwView
* GetActiveView();
278 SW_DLLPUBLIC SwWrtShell
* GetActiveWrtShell();