xref: /aoo41x/main/sw/inc/swmodule.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SWMODULE_HXX
24cdf0e10cSrcweir #define _SWMODULE_HXX
25cdf0e10cSrcweir #include <tools/link.hxx>
26cdf0e10cSrcweir #include <tools/string.hxx>
27cdf0e10cSrcweir #include <tools/fldunit.hxx>
28cdf0e10cSrcweir #include <svl/lstner.hxx>
29cdf0e10cSrcweir #include <unotools/options.hxx>
30cdf0e10cSrcweir #include <sfx2/module.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <tools/shl.hxx>
33cdf0e10cSrcweir #include <svl/lstner.hxx>
34cdf0e10cSrcweir #include "swdllapi.h"
35cdf0e10cSrcweir #include "shellid.hxx"
36cdf0e10cSrcweir #include <fldupde.hxx>
37cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
38cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class SvStringsDtor;
41cdf0e10cSrcweir class Color;
42cdf0e10cSrcweir class SfxItemSet;
43cdf0e10cSrcweir class SfxRequest;
44cdf0e10cSrcweir class SfxErrorHandler;
45cdf0e10cSrcweir class SwDBConfig;
46cdf0e10cSrcweir class SwModuleOptions;
47cdf0e10cSrcweir class SwMasterUsrPref;
48cdf0e10cSrcweir class SwViewOption;
49cdf0e10cSrcweir class SwView;
50cdf0e10cSrcweir class SwWrtShell;
51cdf0e10cSrcweir class SwPrintOptions;
52cdf0e10cSrcweir class SwChapterNumRules;
53cdf0e10cSrcweir class SwStdFontConfig;
54cdf0e10cSrcweir class SwNavigationConfig;
55cdf0e10cSrcweir class SwTransferable;
56cdf0e10cSrcweir class SwToolbarConfigItem;
57cdf0e10cSrcweir class SwAttrPool;
58cdf0e10cSrcweir namespace svtools{ class ColorConfig;}
59cdf0e10cSrcweir class SvtAccessibilityOptions;
60cdf0e10cSrcweir class SvtCTLOptions;
61cdf0e10cSrcweir class SvtUserOptions;
62cdf0e10cSrcweir class SvtUndoOptions;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir struct SwDBData;
65cdf0e10cSrcweir #define VIEWOPT_DEST_VIEW 		0
66cdf0e10cSrcweir #define VIEWOPT_DEST_TEXT		1
67cdf0e10cSrcweir #define VIEWOPT_DEST_WEB    	2
68cdf0e10cSrcweir #define VIEWOPT_DEST_VIEW_ONLY 	3 //ViewOptions werden nur an der ::com::sun::star::sdbcx::View, nicht an der Appl. gesetzt
69cdf0e10cSrcweir 
70cdf0e10cSrcweir namespace com{ namespace sun{ namespace star{ namespace scanner{
71cdf0e10cSrcweir 	class XScannerManager;
72cdf0e10cSrcweir }}}}
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	String				sActAuthor;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	// ConfigItems
79cdf0e10cSrcweir 	SwModuleOptions*    pModuleConfig;
80cdf0e10cSrcweir 	SwMasterUsrPref*	pUsrPref;
81cdf0e10cSrcweir 	SwMasterUsrPref*	pWebUsrPref;
82cdf0e10cSrcweir 	SwPrintOptions* 	pPrtOpt;
83cdf0e10cSrcweir 	SwPrintOptions* 	pWebPrtOpt;
84cdf0e10cSrcweir 	SwChapterNumRules*	pChapterNumRules;
85cdf0e10cSrcweir 	SwStdFontConfig*	pStdFontConfig;
86cdf0e10cSrcweir 	SwNavigationConfig*	pNavigationConfig;
87cdf0e10cSrcweir 	SwToolbarConfigItem*pToolbarConfig;		//fuer gestackte Toolbars, welche
88cdf0e10cSrcweir 	SwToolbarConfigItem*pWebToolbarConfig;	//war sichtbar?
89cdf0e10cSrcweir 	SwDBConfig*			pDBConfig;
90cdf0e10cSrcweir     svtools::ColorConfig*   pColorConfig;
91cdf0e10cSrcweir     SvtAccessibilityOptions* pAccessibilityOptions;
92cdf0e10cSrcweir     SvtCTLOptions*      pCTLOptions;
93cdf0e10cSrcweir     SvtUserOptions*     pUserOptions;
94cdf0e10cSrcweir     SvtUndoOptions*     pUndoOptions;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	SfxErrorHandler* 	pErrorHdl;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	SwAttrPool			*pAttrPool;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	// Die aktuelle View wird hier gehalten um nicht ueber
101cdf0e10cSrcweir 	// GetActiveView arbeiten zu muessen
102cdf0e10cSrcweir 	// Die View ist solange gueltig bis Sie im Activate
103cdf0e10cSrcweir 	// zerstoert oder ausgetauscht wird
104cdf0e10cSrcweir 	SwView* 			pView;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	// Liste aller Redline-Autoren
107cdf0e10cSrcweir 	SvStringsDtor*		pAuthorNames;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	// DictionaryList listener to trigger spellchecking or hyphenation
110cdf0e10cSrcweir 	::com::sun::star::uno::Reference<
111cdf0e10cSrcweir 		::com::sun::star::linguistic2::XLinguServiceEventListener > xLngSvcEvtListener;
112cdf0e10cSrcweir 	::com::sun::star::uno::Reference<
113cdf0e10cSrcweir 		::com::sun::star::scanner::XScannerManager >	m_xScannerManager;
114cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
115cdf0e10cSrcweir         ::com::sun::star::linguistic2::XLanguageGuessing >  m_xLanguageGuesser;
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	sal_Bool				bAuthorInitialised : 1;
118cdf0e10cSrcweir 	sal_Bool				bEmbeddedLoadSave : 1;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	// Hint abfangen fuer DocInfo
121cdf0e10cSrcweir 	virtual void		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     virtual void        ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir protected:
126cdf0e10cSrcweir 	// Briefumschlaege, Etiketten
127cdf0e10cSrcweir     void                InsertEnv(SfxRequest&);
128cdf0e10cSrcweir 	void				InsertLab(SfxRequest&, sal_Bool bLabel);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir public:
131cdf0e10cSrcweir     // public Data - used for internal Clipboard / Drag & Drop / XSelection
132cdf0e10cSrcweir     SwTransferable  *pDragDrop, *pXSelection;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	TYPEINFO();
135cdf0e10cSrcweir 	SFX_DECL_INTERFACE(SW_INTERFACE_MODULE)
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	// dieser Ctor nur fuer SW-Dll
138cdf0e10cSrcweir 	SwModule( SfxObjectFactory* pFact,
139cdf0e10cSrcweir 				SfxObjectFactory* pWebFact,
140cdf0e10cSrcweir 					SfxObjectFactory* pGlobalFact );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	~SwModule();
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	// View setzen nur fuer internen Gebrauch,
145cdf0e10cSrcweir 	// aus techn. Gruenden public
146cdf0e10cSrcweir 	//
SetView(SwView * pVw)147cdf0e10cSrcweir 	inline	void		SetView(SwView* pVw) { pView = pVw; }
GetView()148cdf0e10cSrcweir 	inline	SwView*		GetView() { return pView; }
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	//Die Handler fuer die Slots
151cdf0e10cSrcweir 	void				StateOther(SfxItemSet &);	// andere
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     void                ExecOther(SfxRequest &);    // Felder, Formel ..
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	// Benutzereinstellungen modifizieren
156cdf0e10cSrcweir 	const SwMasterUsrPref *GetUsrPref(sal_Bool bWeb) const;
157cdf0e10cSrcweir 	const SwViewOption*	GetViewOption(sal_Bool bWeb);
158cdf0e10cSrcweir 	void				ApplyUsrPref(const SwViewOption &, SwView*,
159cdf0e10cSrcweir 									 sal_uInt16 nDest = VIEWOPT_DEST_VIEW );
160cdf0e10cSrcweir     void ApplyUserMetric( FieldUnit eMetric, sal_Bool bWeb );
161cdf0e10cSrcweir     void ApplyRulerMetric( FieldUnit eMetric, sal_Bool bHorizontal, sal_Bool bWeb );
162cdf0e10cSrcweir     void ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags);
163cdf0e10cSrcweir 	void ApplyLinkMode(sal_Int32 nNewLinkMode);
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     //default page mode for text grid
166cdf0e10cSrcweir     void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	// ConfigItems erzeugen
GetModuleConfig()169cdf0e10cSrcweir 	SwModuleOptions*    GetModuleConfig()		{ return pModuleConfig;}
170cdf0e10cSrcweir 	SwPrintOptions* 	GetPrtOptions(sal_Bool bWeb);
171cdf0e10cSrcweir 	SwChapterNumRules*	GetChapterNumRules();
GetStdFontConfig()172cdf0e10cSrcweir 	SwStdFontConfig*	GetStdFontConfig()		{ return pStdFontConfig; }
173cdf0e10cSrcweir 	SwNavigationConfig* GetNavigationConfig();
GetToolbarConfig()174cdf0e10cSrcweir 	SwToolbarConfigItem*GetToolbarConfig()		{ return pToolbarConfig;	}
GetWebToolbarConfig()175cdf0e10cSrcweir 	SwToolbarConfigItem*GetWebToolbarConfig()   { return pWebToolbarConfig; }
176cdf0e10cSrcweir 	SwDBConfig*			GetDBConfig();
177cdf0e10cSrcweir     svtools::ColorConfig&   GetColorConfig();
178cdf0e10cSrcweir     SvtAccessibilityOptions&    GetAccessibilityOptions();
179cdf0e10cSrcweir     SvtCTLOptions&      GetCTLOptions();
180cdf0e10cSrcweir     SvtUserOptions&     GetUserOptions();
181cdf0e10cSrcweir     SvtUndoOptions&     GetUndoOptions();
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	// Ueber Sichten iterieren
184cdf0e10cSrcweir 	static SwView* 		GetFirstView();
185cdf0e10cSrcweir 	static SwView* 		GetNextView(SwView*);
186cdf0e10cSrcweir 
IsEmbeddedLoadSave() const187cdf0e10cSrcweir 	sal_Bool IsEmbeddedLoadSave() const 		{ return bEmbeddedLoadSave; }
SetEmbeddedLoadSave(sal_Bool bFlag)188cdf0e10cSrcweir 	void SetEmbeddedLoadSave( sal_Bool bFlag )	{ bEmbeddedLoadSave = bFlag; }
189cdf0e10cSrcweir 
190cdf0e10cSrcweir     void ShowDBObj( SwView& rView, const SwDBData& rData, sal_Bool bOnlyIfAvailable = sal_False);
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	// Tabellenmodi
193cdf0e10cSrcweir 	sal_Bool			IsInsTblFormatNum(sal_Bool bHTML) const;
194cdf0e10cSrcweir 	sal_Bool 			IsInsTblChangeNumFormat(sal_Bool bHTML) const;
195cdf0e10cSrcweir 	sal_Bool			IsInsTblAlignNum(sal_Bool bHTML) const;
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	// Redlining
198cdf0e10cSrcweir 	sal_uInt16			GetRedlineAuthor();
199cdf0e10cSrcweir 	const String&		GetRedlineAuthor(sal_uInt16 nPos);
200cdf0e10cSrcweir 	sal_uInt16			InsertRedlineAuthor(const String& rAuthor);
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 	void				GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
203cdf0e10cSrcweir 	void				GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
204cdf0e10cSrcweir 	void				GetFormatAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 	sal_uInt16				GetRedlineMarkPos();
207cdf0e10cSrcweir 	const Color&			GetRedlineMarkColor();
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 	// returne den definierten DocStat - WordDelimiter
210cdf0e10cSrcweir 	const String&		GetDocStatWordDelim() const;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 	// Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
213cdf0e10cSrcweir 	sal_uInt16 GetMetric( sal_Bool bWeb ) const;
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	// Update-Stati durchreichen
216cdf0e10cSrcweir 	sal_uInt16 GetLinkUpdMode( sal_Bool bWeb ) const;
217cdf0e10cSrcweir     SwFldUpdateFlags GetFldUpdateFlags( sal_Bool bWeb ) const;
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 	//virtuelle Methoden fuer den Optionendialog
220cdf0e10cSrcweir 	virtual SfxItemSet*	 CreateItemSet( sal_uInt16 nId );
221cdf0e10cSrcweir 	virtual void		 ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
222cdf0e10cSrcweir 	virtual	SfxTabPage*	 CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	//hier wird der Pool angelegt und an der SfxShell gesetzt
225cdf0e10cSrcweir 	void	InitAttrPool();
226cdf0e10cSrcweir 	//Pool loeschen bevor es zu spaet ist
227cdf0e10cSrcweir 	void	RemoveAttrPool();
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 	// Invalidiert ggf. OnlineSpell-WrongListen
230cdf0e10cSrcweir 	void	CheckSpellChanges( sal_Bool bOnlineSpelling,
231cdf0e10cSrcweir 					sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags );
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	inline ::com::sun::star::uno::Reference<
234cdf0e10cSrcweir 		::com::sun::star::linguistic2::XLinguServiceEventListener >
235cdf0e10cSrcweir 			GetLngSvcEvtListener();
236cdf0e10cSrcweir     inline void SetLngSvcEvtListener( ::com::sun::star::uno::Reference<
237cdf0e10cSrcweir         ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr);
238cdf0e10cSrcweir     void    CreateLngSvcEvtListener();
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	::com::sun::star::uno::Reference<
241cdf0e10cSrcweir 		::com::sun::star::scanner::XScannerManager >
242cdf0e10cSrcweir 			GetScannerManager();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
245cdf0e10cSrcweir         ::com::sun::star::linguistic2::XLanguageGuessing >
246cdf0e10cSrcweir             GetLanguageGuesser();
247cdf0e10cSrcweir };
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 
250cdf0e10cSrcweir inline ::com::sun::star::uno::Reference<
251cdf0e10cSrcweir 	::com::sun::star::linguistic2::XLinguServiceEventListener >
GetLngSvcEvtListener()252cdf0e10cSrcweir 		SwModule::GetLngSvcEvtListener()
253cdf0e10cSrcweir {
254cdf0e10cSrcweir 	return xLngSvcEvtListener;
255cdf0e10cSrcweir }
256cdf0e10cSrcweir 
SetLngSvcEvtListener(::com::sun::star::uno::Reference<::com::sun::star::linguistic2::XLinguServiceEventListener> & xLstnr)257cdf0e10cSrcweir inline void SwModule::SetLngSvcEvtListener(
258cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
259cdf0e10cSrcweir        ::com::sun::star::linguistic2::XLinguServiceEventListener > & xLstnr)
260cdf0e10cSrcweir {
261cdf0e10cSrcweir     xLngSvcEvtListener = xLstnr;
262cdf0e10cSrcweir }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 
265cdf0e10cSrcweir /*-----------------08.07.97 10.33-------------------
266cdf0e10cSrcweir 	Zugriff auf das SwModule, die ::com::sun::star::sdbcx::View und die Shell
267cdf0e10cSrcweir --------------------------------------------------*/
268cdf0e10cSrcweir 
269cdf0e10cSrcweir #define SW_MOD() ( *(SwModule**) GetAppData(SHL_WRITER))
270cdf0e10cSrcweir 
271cdf0e10cSrcweir SW_DLLPUBLIC SwView* 	GetActiveView();
272cdf0e10cSrcweir SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
273cdf0e10cSrcweir 
274cdf0e10cSrcweir #endif
275