1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR
28cdf0e10cSrcweir #include <svl/svstdarr.hxx>
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp>
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <hintids.hxx>
33cdf0e10cSrcweir #include <cmdid.h> // Funktion-Ids
34cdf0e10cSrcweir #include <vcl/msgbox.hxx>
35cdf0e10cSrcweir #include <svl/eitem.hxx>
36cdf0e10cSrcweir #include <sfx2/request.hxx>
37cdf0e10cSrcweir #include <sfx2/app.hxx>
38cdf0e10cSrcweir #include <sfx2/printer.hxx>
39cdf0e10cSrcweir #include <svx/htmlmode.hxx>
40cdf0e10cSrcweir #include <sfx2/bindings.hxx>
41cdf0e10cSrcweir #include <editeng/brshitem.hxx>
42cdf0e10cSrcweir #include <editeng/tstpitem.hxx>
43cdf0e10cSrcweir #include <svx/optgrid.hxx>
44cdf0e10cSrcweir #include <svx/svxdlg.hxx>
45cdf0e10cSrcweir #include <svx/dialogs.hrc>
46cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
47cdf0e10cSrcweir #include <fontcfg.hxx>
48cdf0e10cSrcweir #include <optload.hxx>
49cdf0e10cSrcweir #include <optcomp.hxx>
50cdf0e10cSrcweir #include <edtwin.hxx>
51cdf0e10cSrcweir #include <swmodule.hxx>
52cdf0e10cSrcweir #include <view.hxx>
53cdf0e10cSrcweir #include <doc.hxx>
54cdf0e10cSrcweir #include <wrtsh.hxx>
55cdf0e10cSrcweir #include <IDocumentDeviceAccess.hxx>
56cdf0e10cSrcweir #include <uitool.hxx>
57cdf0e10cSrcweir #include <initui.hxx> // fuer ::GetGlossaries()
58cdf0e10cSrcweir #include <fldbas.hxx> //fuer UpdateFields
59cdf0e10cSrcweir #include <wview.hxx>
60cdf0e10cSrcweir #include <cfgitems.hxx>
61cdf0e10cSrcweir #include <prtopt.hxx>
62cdf0e10cSrcweir #include <pview.hxx>
63cdf0e10cSrcweir #include <usrpref.hxx>
64cdf0e10cSrcweir #include <modcfg.hxx>
65cdf0e10cSrcweir #include <glosdoc.hxx>
66cdf0e10cSrcweir #include <uiitems.hxx>
67cdf0e10cSrcweir #include <editeng/langitem.hxx>
68cdf0e10cSrcweir #include <unotools/lingucfg.hxx>
69cdf0e10cSrcweir #include <editeng/unolingu.hxx>
70cdf0e10cSrcweir #include <globals.hrc>
71cdf0e10cSrcweir #include <globals.h> // globale Konstanten z.B.
72cdf0e10cSrcweir #include <svl/slstitm.hxx>
73cdf0e10cSrcweir #include "swabstdlg.hxx"
74cdf0e10cSrcweir #include <swwrtshitem.hxx>
75cdf0e10cSrcweir
76cdf0e10cSrcweir #include <unomid.h>
77cdf0e10cSrcweir
78cdf0e10cSrcweir using namespace ::com::sun::star::uno;
79cdf0e10cSrcweir using namespace ::com::sun::star::lang;
80cdf0e10cSrcweir
81cdf0e10cSrcweir /* -----------------12.02.99 12:28-------------------
82cdf0e10cSrcweir *
83cdf0e10cSrcweir * --------------------------------------------------*/
84cdf0e10cSrcweir
CreateItemSet(sal_uInt16 nId)85cdf0e10cSrcweir SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir sal_Bool bTextDialog = (nId == SID_SW_EDITOPTIONS) ? sal_True : sal_False;
88cdf0e10cSrcweir
89cdf0e10cSrcweir // hier werden die Optionen fuer die Web- und den Textdialog zusmmengesetzt
90cdf0e10cSrcweir SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
91cdf0e10cSrcweir SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
92cdf0e10cSrcweir //kein MakeUsrPref, da hier nur die Optionen von Textdoks genommen werden duerfen
93cdf0e10cSrcweir SwView* pAppView = GetView();
94cdf0e10cSrcweir if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
95cdf0e10cSrcweir pAppView = 0;
96cdf0e10cSrcweir if(pAppView)
97cdf0e10cSrcweir {
98cdf0e10cSrcweir // wenn Text dann nicht WebView und umgekehrt
99cdf0e10cSrcweir sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
100cdf0e10cSrcweir if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog))
101cdf0e10cSrcweir {
102cdf0e10cSrcweir aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
103cdf0e10cSrcweir }
104cdf0e10cSrcweir else
105cdf0e10cSrcweir pAppView = 0; // mit View kann hier nichts gewonnen werden
106cdf0e10cSrcweir }
107cdf0e10cSrcweir
108cdf0e10cSrcweir /********************************************************************/
109cdf0e10cSrcweir /* */
110cdf0e10cSrcweir /* Optionen/Bearbeiten */
111cdf0e10cSrcweir /* */
112cdf0e10cSrcweir /********************************************************************/
113cdf0e10cSrcweir SfxItemSet* pRet = new SfxItemSet (GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM,
114cdf0e10cSrcweir SID_PRINTPREVIEW, SID_PRINTPREVIEW,
115cdf0e10cSrcweir SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
116cdf0e10cSrcweir FN_PARAM_PRINTER, FN_PARAM_STDFONTS,
117cdf0e10cSrcweir FN_PARAM_WRTSHELL, FN_PARAM_WRTSHELL,
118cdf0e10cSrcweir FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
119cdf0e10cSrcweir SID_ATTR_METRIC, SID_ATTR_METRIC,
120cdf0e10cSrcweir SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
121cdf0e10cSrcweir RES_BACKGROUND, RES_BACKGROUND,
122cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE,
123cdf0e10cSrcweir FN_PARAM_SHADOWCURSOR, FN_PARAM_SHADOWCURSOR,
124cdf0e10cSrcweir FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED,
125cdf0e10cSrcweir FN_HSCROLL_METRIC, FN_VSCROLL_METRIC,
126cdf0e10cSrcweir SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
127cdf0e10cSrcweir SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
128cdf0e10cSrcweir SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
129cdf0e10cSrcweir #ifdef DBG_UTIL
130cdf0e10cSrcweir FN_PARAM_SWTEST, FN_PARAM_SWTEST,
131cdf0e10cSrcweir #endif
132cdf0e10cSrcweir 0);
133cdf0e10cSrcweir
134cdf0e10cSrcweir pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
135cdf0e10cSrcweir pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
136cdf0e10cSrcweir if( bTextDialog )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
139cdf0e10cSrcweir pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
140cdf0e10cSrcweir }
141cdf0e10cSrcweir
142cdf0e10cSrcweir if( pAppView )
143cdf0e10cSrcweir {
144cdf0e10cSrcweir SwWrtShell& rWrtShell = pAppView->GetWrtShell();
145cdf0e10cSrcweir
146cdf0e10cSrcweir SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
147cdf0e10cSrcweir if( pPrt )
148cdf0e10cSrcweir pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
149cdf0e10cSrcweir pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
150cdf0e10cSrcweir
151cdf0e10cSrcweir pRet->Put((const SvxLanguageItem&)
152cdf0e10cSrcweir rWrtShell.GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
153cdf0e10cSrcweir
154cdf0e10cSrcweir pRet->Put((const SvxLanguageItem&)
155cdf0e10cSrcweir rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE);
156cdf0e10cSrcweir
157cdf0e10cSrcweir pRet->Put((const SvxLanguageItem&)
158cdf0e10cSrcweir rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE);
159cdf0e10cSrcweir }
160cdf0e10cSrcweir else
161cdf0e10cSrcweir {
162cdf0e10cSrcweir /* Der Drucker wird jetzt von der TabPage erzeugt und auch geloescht
163cdf0e10cSrcweir * SfxItemSet* pSet = new SfxItemSet( SFX_APP()->GetPool(),
164cdf0e10cSrcweir SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
165cdf0e10cSrcweir SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
166cdf0e10cSrcweir 0 );
167cdf0e10cSrcweir
168cdf0e10cSrcweir pPrt = new SfxPrinter(pSet);
169cdf0e10cSrcweir pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/
170cdf0e10cSrcweir
171cdf0e10cSrcweir SvtLinguConfig aLinguCfg;
172cdf0e10cSrcweir Locale aLocale;
173cdf0e10cSrcweir LanguageType nLang;
174cdf0e10cSrcweir
175cdf0e10cSrcweir using namespace ::com::sun::star::i18n::ScriptType;
176cdf0e10cSrcweir
177cdf0e10cSrcweir Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale"));
178cdf0e10cSrcweir aLang >>= aLocale;
179cdf0e10cSrcweir nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), LATIN);
180cdf0e10cSrcweir pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
181cdf0e10cSrcweir
182cdf0e10cSrcweir aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CJK"));
183cdf0e10cSrcweir aLang >>= aLocale;
184cdf0e10cSrcweir nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), ASIAN);
185cdf0e10cSrcweir pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
186cdf0e10cSrcweir
187cdf0e10cSrcweir aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
188cdf0e10cSrcweir aLang >>= aLocale;
189cdf0e10cSrcweir nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), COMPLEX);
190cdf0e10cSrcweir pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
191cdf0e10cSrcweir }
192cdf0e10cSrcweir if(bTextDialog)
193cdf0e10cSrcweir pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
194cdf0e10cSrcweir if( PTR_CAST( SwPagePreView, SfxViewShell::Current())!=0)
195cdf0e10cSrcweir {
196cdf0e10cSrcweir SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, sal_True));
197cdf0e10cSrcweir pRet->Put(aBool);
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
200cdf0e10cSrcweir FieldUnit eUnit = pPref->GetHScrollMetric();
201cdf0e10cSrcweir if(pAppView)
202cdf0e10cSrcweir pAppView->GetHLinealMetric(eUnit);
203cdf0e10cSrcweir pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit)));
204cdf0e10cSrcweir
205cdf0e10cSrcweir eUnit = pPref->GetVScrollMetric();
206cdf0e10cSrcweir if(pAppView)
207cdf0e10cSrcweir pAppView->GetVLinealMetric(eUnit);
208cdf0e10cSrcweir pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< sal_uInt16 >(eUnit) ));
209cdf0e10cSrcweir pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< sal_uInt16 >(pPref->GetMetric()) ));
210cdf0e10cSrcweir if(bTextDialog)
211cdf0e10cSrcweir {
212cdf0e10cSrcweir if(pAppView)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir const SvxTabStopItem& rDefTabs =
215cdf0e10cSrcweir (const SvxTabStopItem&)pAppView->GetWrtShell().
216cdf0e10cSrcweir GetDefault(RES_PARATR_TABSTOP);
217cdf0e10cSrcweir pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)::GetTabDist(rDefTabs)));
218cdf0e10cSrcweir }
219cdf0e10cSrcweir else
220cdf0e10cSrcweir pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (sal_uInt16)pPref->GetDefTab()));
221cdf0e10cSrcweir }
222cdf0e10cSrcweir
223cdf0e10cSrcweir /*-----------------01.02.97 11.13-------------------
224cdf0e10cSrcweir Optionen fuer GridTabPage
225cdf0e10cSrcweir --------------------------------------------------*/
226cdf0e10cSrcweir
227cdf0e10cSrcweir SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
228cdf0e10cSrcweir
229cdf0e10cSrcweir aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
230cdf0e10cSrcweir aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
231cdf0e10cSrcweir aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
232cdf0e10cSrcweir
233cdf0e10cSrcweir const Size& rSnapSize = aViewOpt.GetSnapSize();
234cdf0e10cSrcweir aGridItem.SetFldDrawX( (sal_uInt16) (rSnapSize.Width() ));
235cdf0e10cSrcweir aGridItem.SetFldDrawY( (sal_uInt16) (rSnapSize.Height()));
236cdf0e10cSrcweir
237cdf0e10cSrcweir aGridItem.SetFldDivisionX( aViewOpt.GetDivisionX());
238cdf0e10cSrcweir aGridItem.SetFldDivisionY( aViewOpt.GetDivisionY());
239cdf0e10cSrcweir
240cdf0e10cSrcweir pRet->Put(aGridItem);
241cdf0e10cSrcweir
242cdf0e10cSrcweir /*-----------------01.02.97 13.02-------------------
243cdf0e10cSrcweir Optionen fuer PrintTabPage
244cdf0e10cSrcweir --------------------------------------------------*/
245cdf0e10cSrcweir const SwPrintData* pOpt = pAppView ?
246cdf0e10cSrcweir &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
247cdf0e10cSrcweir 0;
248cdf0e10cSrcweir
249cdf0e10cSrcweir if(!pOpt)
250cdf0e10cSrcweir pOpt = GetPrtOptions(!bTextDialog);
251cdf0e10cSrcweir
252cdf0e10cSrcweir SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
253cdf0e10cSrcweir pRet->Put(aAddPrinterItem);
254cdf0e10cSrcweir
255cdf0e10cSrcweir /*-----------------01.02.97 13.12-------------------
256cdf0e10cSrcweir Optionen fuer Web-Hintergrund
257cdf0e10cSrcweir --------------------------------------------------*/
258cdf0e10cSrcweir if(!bTextDialog)
259cdf0e10cSrcweir {
260cdf0e10cSrcweir pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
261cdf0e10cSrcweir }
262cdf0e10cSrcweir
263cdf0e10cSrcweir #ifdef DBG_UTIL
264cdf0e10cSrcweir /*-----------------01.02.97 13.02-------------------
265cdf0e10cSrcweir Test-Optionen
266cdf0e10cSrcweir --------------------------------------------------*/
267cdf0e10cSrcweir SwTestItem aTestItem(FN_PARAM_SWTEST);
268cdf0e10cSrcweir aTestItem.bTest1 = aViewOpt.IsTest1();
269cdf0e10cSrcweir aTestItem.bTest2 = aViewOpt.IsTest2();
270cdf0e10cSrcweir aTestItem.bTest3 = aViewOpt.IsTest3();
271cdf0e10cSrcweir aTestItem.bTest4 = aViewOpt.IsTest4();
272cdf0e10cSrcweir aTestItem.bTest5 = aViewOpt.IsTest5();
273cdf0e10cSrcweir aTestItem.bTest6 = aViewOpt.IsTest6();
274cdf0e10cSrcweir aTestItem.bTest7 = aViewOpt.IsTest7();
275cdf0e10cSrcweir aTestItem.bTest8 = aViewOpt.IsTest8();
276cdf0e10cSrcweir aTestItem.bTest9 = SwViewOption::IsTest9();
277cdf0e10cSrcweir aTestItem.bTest10 = aViewOpt.IsTest10();
278cdf0e10cSrcweir pRet->Put(aTestItem);
279cdf0e10cSrcweir #endif
280cdf0e10cSrcweir /*-----------------01.02.97 13.04-------------------
281cdf0e10cSrcweir
282cdf0e10cSrcweir --------------------------------------------------*/
283cdf0e10cSrcweir if(!bTextDialog)
284cdf0e10cSrcweir pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
285cdf0e10cSrcweir // delete pPrt;
286cdf0e10cSrcweir return pRet;
287cdf0e10cSrcweir }
288cdf0e10cSrcweir /* -----------------12.02.99 12:28-------------------
289cdf0e10cSrcweir *
290cdf0e10cSrcweir * --------------------------------------------------*/
ApplyItemSet(sal_uInt16 nId,const SfxItemSet & rSet)291cdf0e10cSrcweir void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir sal_Bool bTextDialog = nId == SID_SW_EDITOPTIONS;
294cdf0e10cSrcweir SwView* pAppView = GetView();
295cdf0e10cSrcweir if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
296cdf0e10cSrcweir pAppView = 0;
297cdf0e10cSrcweir if(pAppView)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir // the text dialog mustn't apply data to the web view and vice versa
300cdf0e10cSrcweir sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pAppView);
301*a9ab3c7bSHerbert Dürr if( bWebView == bTextDialog)
302cdf0e10cSrcweir pAppView = 0; //
303cdf0e10cSrcweir }
304cdf0e10cSrcweir
305cdf0e10cSrcweir SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
306cdf0e10cSrcweir SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
307cdf0e10cSrcweir
308cdf0e10cSrcweir const SfxPoolItem* pItem;
309cdf0e10cSrcweir SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
310cdf0e10cSrcweir : NULL;
311cdf0e10cSrcweir
312cdf0e10cSrcweir /*---------------------------------------------------------------------
313cdf0e10cSrcweir Seite Dokumentansicht auswerten
314cdf0e10cSrcweir -----------------------------------------------------------------------*/
315cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, &pItem ))
316cdf0e10cSrcweir {
317cdf0e10cSrcweir const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem;
318cdf0e10cSrcweir
319cdf0e10cSrcweir if(!aViewOpt.IsViewMetaChars())
320cdf0e10cSrcweir {
321cdf0e10cSrcweir if( (!aViewOpt.IsTab( sal_True ) && pDocDispItem->bTab) ||
322cdf0e10cSrcweir (!aViewOpt.IsBlank( sal_True ) && pDocDispItem->bSpace) ||
323cdf0e10cSrcweir (!aViewOpt.IsParagraph( sal_True ) && pDocDispItem->bParagraphEnd) ||
324cdf0e10cSrcweir (!aViewOpt.IsLineBreak( sal_True ) && pDocDispItem->bManualBreak) )
325cdf0e10cSrcweir {
326cdf0e10cSrcweir aViewOpt.SetViewMetaChars(sal_True);
327cdf0e10cSrcweir if(pBindings)
328cdf0e10cSrcweir pBindings->Invalidate(FN_VIEW_META_CHARS);
329cdf0e10cSrcweir }
330cdf0e10cSrcweir
331cdf0e10cSrcweir }
332cdf0e10cSrcweir pDocDispItem->FillViewOptions( aViewOpt );
333cdf0e10cSrcweir if(pBindings)
334cdf0e10cSrcweir {
335cdf0e10cSrcweir pBindings->Invalidate(FN_VIEW_GRAPHIC);
336cdf0e10cSrcweir pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
337cdf0e10cSrcweir }
338cdf0e10cSrcweir }
339cdf0e10cSrcweir
340cdf0e10cSrcweir /*---------------------------------------------------------------------
341cdf0e10cSrcweir Elemente - Item auswerten
342cdf0e10cSrcweir -----------------------------------------------------------------------*/
343cdf0e10cSrcweir
344cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ELEM, sal_False, &pItem ) )
345cdf0e10cSrcweir {
346cdf0e10cSrcweir const SwElemItem* pElemItem = (const SwElemItem*)pItem;
347cdf0e10cSrcweir pElemItem->FillViewOptions( aViewOpt );
348cdf0e10cSrcweir
349cdf0e10cSrcweir }
350cdf0e10cSrcweir
351cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, sal_False, &pItem ) )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir SFX_APP()->SetOptions(rSet);
354cdf0e10cSrcweir const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
355cdf0e10cSrcweir ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
356cdf0e10cSrcweir }
357cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, sal_False, &pItem ) )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
360cdf0e10cSrcweir FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
361cdf0e10cSrcweir pPref->SetHScrollMetric(eUnit);
362cdf0e10cSrcweir if(pAppView)
363cdf0e10cSrcweir pAppView->ChangeTabMetric(eUnit);
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
366cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, sal_False, &pItem ) )
367cdf0e10cSrcweir {
368cdf0e10cSrcweir const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
369cdf0e10cSrcweir FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
370cdf0e10cSrcweir pPref->SetVScrollMetric(eUnit);
371cdf0e10cSrcweir if(pAppView)
372cdf0e10cSrcweir pAppView->ChangeVLinealMetric(eUnit);
373cdf0e10cSrcweir }
374cdf0e10cSrcweir
375cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, sal_False, &pItem ) )
376cdf0e10cSrcweir {
377cdf0e10cSrcweir sal_uInt16 nTabDist = ((const SfxUInt16Item*)pItem)->GetValue();
378cdf0e10cSrcweir pPref->SetDefTab(nTabDist);
379cdf0e10cSrcweir if(pAppView)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
382cdf0e10cSrcweir MakeDefTabs( nTabDist, aDefTabs );
383cdf0e10cSrcweir pAppView->GetWrtShell().SetDefault( aDefTabs );
384cdf0e10cSrcweir }
385cdf0e10cSrcweir }
386cdf0e10cSrcweir
387cdf0e10cSrcweir
388cdf0e10cSrcweir /*-----------------01.02.97 11.36-------------------
389cdf0e10cSrcweir Hintergrund nur im WebDialog
390cdf0e10cSrcweir --------------------------------------------------*/
391cdf0e10cSrcweir if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND))
392cdf0e10cSrcweir {
393cdf0e10cSrcweir const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSet.Get(
394cdf0e10cSrcweir RES_BACKGROUND);
395cdf0e10cSrcweir aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
396cdf0e10cSrcweir }
397cdf0e10cSrcweir
398cdf0e10cSrcweir /*--------------------------------------------------------------------
399cdf0e10cSrcweir Seite Rastereinstellungen auswerten
400cdf0e10cSrcweir ----------------------------------------------------------------------*/
401cdf0e10cSrcweir
402cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, sal_False, &pItem ))
403cdf0e10cSrcweir {
404cdf0e10cSrcweir const SvxGridItem* pGridItem = (const SvxGridItem*)pItem;
405cdf0e10cSrcweir
406cdf0e10cSrcweir aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
407cdf0e10cSrcweir aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
408cdf0e10cSrcweir if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
409cdf0e10cSrcweir aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
410cdf0e10cSrcweir Size aSize = Size( pGridItem->GetFldDrawX() ,
411cdf0e10cSrcweir pGridItem->GetFldDrawY() );
412cdf0e10cSrcweir if( aViewOpt.GetSnapSize() != aSize )
413cdf0e10cSrcweir aViewOpt.SetSnapSize( aSize );
414cdf0e10cSrcweir short nDiv = (short)pGridItem->GetFldDivisionX() ;
415cdf0e10cSrcweir if( aViewOpt.GetDivisionX() != nDiv )
416cdf0e10cSrcweir aViewOpt.SetDivisionX( nDiv );
417cdf0e10cSrcweir nDiv = (short)pGridItem->GetFldDivisionY();
418cdf0e10cSrcweir if( aViewOpt.GetDivisionY() != nDiv )
419cdf0e10cSrcweir aViewOpt.SetDivisionY( nDiv );
420cdf0e10cSrcweir
421cdf0e10cSrcweir if(pBindings)
422cdf0e10cSrcweir {
423cdf0e10cSrcweir pBindings->Invalidate(SID_GRID_VISIBLE);
424cdf0e10cSrcweir pBindings->Invalidate(SID_GRID_USE);
425cdf0e10cSrcweir }
426cdf0e10cSrcweir }
427cdf0e10cSrcweir
428cdf0e10cSrcweir //--------------------------------------------------------------------------
429cdf0e10cSrcweir // Writer Drucker Zusatzeinstellungen auswerten
430cdf0e10cSrcweir //----------------------------------------------------------------------------
431cdf0e10cSrcweir
432cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, sal_False, &pItem ))
433cdf0e10cSrcweir {
434cdf0e10cSrcweir SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
435cdf0e10cSrcweir if (pOpt)
436cdf0e10cSrcweir {
437cdf0e10cSrcweir const SwAddPrinterItem* pAddPrinterAttr = (const SwAddPrinterItem*)pItem;
438cdf0e10cSrcweir *pOpt = *pAddPrinterAttr;
439cdf0e10cSrcweir
440cdf0e10cSrcweir if(pAppView)
441cdf0e10cSrcweir pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
442cdf0e10cSrcweir }
443cdf0e10cSrcweir
444cdf0e10cSrcweir }
445cdf0e10cSrcweir
446cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
447cdf0e10cSrcweir {
448cdf0e10cSrcweir ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
449cdf0e10cSrcweir if(pBindings)
450cdf0e10cSrcweir pBindings->Invalidate(FN_SHADOWCURSOR);
451cdf0e10cSrcweir }
452cdf0e10cSrcweir
453cdf0e10cSrcweir if( pAppView )
454cdf0e10cSrcweir {
455cdf0e10cSrcweir SwWrtShell &rWrtSh = pAppView->GetWrtShell();
456cdf0e10cSrcweir const bool bAlignFormulas = rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
457cdf0e10cSrcweir pPref->SetAlignMathObjectsToBaseline( bAlignFormulas );
458cdf0e10cSrcweir
459cdf0e10cSrcweir // don't align formulas in documents that are currently loading
460cdf0e10cSrcweir if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading())
461cdf0e10cSrcweir rWrtSh.AlignAllFormulasToBaseline();
462cdf0e10cSrcweir }
463cdf0e10cSrcweir
464cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
465cdf0e10cSrcweir {
466cdf0e10cSrcweir aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue());
467cdf0e10cSrcweir }
468cdf0e10cSrcweir
469cdf0e10cSrcweir
470cdf0e10cSrcweir #ifdef DBG_UTIL
471cdf0e10cSrcweir /*--------------------------------------------------------------------------
472cdf0e10cSrcweir Writer Testseite auswerten
473cdf0e10cSrcweir ----------------------------------------------------------------------------*/
474cdf0e10cSrcweir
475cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState(
476cdf0e10cSrcweir FN_PARAM_SWTEST, sal_False, &pItem ))
477cdf0e10cSrcweir {
478cdf0e10cSrcweir const SwTestItem* pTestItem = (const SwTestItem*)pItem;
479cdf0e10cSrcweir aViewOpt.SetTest1((sal_Bool)pTestItem->bTest1);
480cdf0e10cSrcweir aViewOpt.SetTest2((sal_Bool)pTestItem->bTest2);
481cdf0e10cSrcweir aViewOpt.SetTest3((sal_Bool)pTestItem->bTest3);
482cdf0e10cSrcweir aViewOpt.SetTest4((sal_Bool)pTestItem->bTest4);
483cdf0e10cSrcweir aViewOpt.SetTest5((sal_Bool)pTestItem->bTest5);
484cdf0e10cSrcweir aViewOpt.SetTest6((sal_Bool)pTestItem->bTest6);
485cdf0e10cSrcweir aViewOpt.SetTest7((sal_Bool)pTestItem->bTest7);
486cdf0e10cSrcweir aViewOpt.SetTest8((sal_Bool)pTestItem->bTest8);
487cdf0e10cSrcweir SwViewOption::SetTest9((sal_Bool)pTestItem->bTest9);
488cdf0e10cSrcweir aViewOpt.SetTest10((sal_Bool)pTestItem->bTest10);
489cdf0e10cSrcweir }
490cdf0e10cSrcweir #endif
491cdf0e10cSrcweir // dann an der akt. View und Shell die entsp. Elemente setzen
492cdf0e10cSrcweir ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
493cdf0e10cSrcweir }
494cdf0e10cSrcweir /* -----------------12.02.99 12:28-------------------
495cdf0e10cSrcweir *
496cdf0e10cSrcweir * --------------------------------------------------*/
CreateTabPage(sal_uInt16 nId,Window * pParent,const SfxItemSet & rSet)497cdf0e10cSrcweir SfxTabPage* SwModule::CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet )
498cdf0e10cSrcweir {
499cdf0e10cSrcweir SfxTabPage* pRet = NULL;
500cdf0e10cSrcweir SfxAllItemSet aSet(*(rSet.GetPool()));
501cdf0e10cSrcweir switch( nId )
502cdf0e10cSrcweir {
503cdf0e10cSrcweir case RID_SW_TP_CONTENT_OPT:
504cdf0e10cSrcweir case RID_SW_TP_HTML_CONTENT_OPT:
505cdf0e10cSrcweir {
506cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
507cdf0e10cSrcweir if ( pFact )
508cdf0e10cSrcweir {
509cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
510cdf0e10cSrcweir if ( fnCreatePage )
511cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
512cdf0e10cSrcweir }
513cdf0e10cSrcweir break;
514cdf0e10cSrcweir }
515cdf0e10cSrcweir case RID_SW_TP_HTML_OPTGRID_PAGE:
516cdf0e10cSrcweir case RID_SVXPAGE_GRID:
517cdf0e10cSrcweir pRet = SvxGridTabPage::Create(pParent, rSet);
518cdf0e10cSrcweir break;
519cdf0e10cSrcweir
520cdf0e10cSrcweir case RID_SW_TP_STD_FONT:
521cdf0e10cSrcweir case RID_SW_TP_STD_FONT_CJK:
522cdf0e10cSrcweir case RID_SW_TP_STD_FONT_CTL:
523cdf0e10cSrcweir {
524cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
525cdf0e10cSrcweir if ( pFact )
526cdf0e10cSrcweir {
527cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
528cdf0e10cSrcweir if ( fnCreatePage )
529cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
530cdf0e10cSrcweir }
531cdf0e10cSrcweir if(RID_SW_TP_STD_FONT != nId)
532cdf0e10cSrcweir {
533cdf0e10cSrcweir aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
534cdf0e10cSrcweir pRet->PageCreated(aSet);
535cdf0e10cSrcweir }
536cdf0e10cSrcweir }
537cdf0e10cSrcweir break;
538cdf0e10cSrcweir case RID_SW_TP_HTML_OPTPRINT_PAGE:
539cdf0e10cSrcweir case RID_SW_TP_OPTPRINT_PAGE:
540cdf0e10cSrcweir {
541cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
542cdf0e10cSrcweir if ( pFact )
543cdf0e10cSrcweir {
544cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
545cdf0e10cSrcweir if ( fnCreatePage )
546cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
547cdf0e10cSrcweir }
548cdf0e10cSrcweir aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
549cdf0e10cSrcweir pRet->PageCreated(aSet);
550cdf0e10cSrcweir }
551cdf0e10cSrcweir break;
552cdf0e10cSrcweir case RID_SW_TP_HTML_OPTTABLE_PAGE:
553cdf0e10cSrcweir case RID_SW_TP_OPTTABLE_PAGE:
554cdf0e10cSrcweir {
555cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
556cdf0e10cSrcweir if ( pFact )
557cdf0e10cSrcweir {
558cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
559cdf0e10cSrcweir if ( fnCreatePage )
560cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
561cdf0e10cSrcweir }
562cdf0e10cSrcweir SwView* pCurrView = GetView();
563cdf0e10cSrcweir if(pCurrView)
564cdf0e10cSrcweir {
565cdf0e10cSrcweir // wenn Text dann nicht WebView und umgekehrt
566cdf0e10cSrcweir sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
567cdf0e10cSrcweir if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
568cdf0e10cSrcweir (!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
569cdf0e10cSrcweir {
570cdf0e10cSrcweir aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
571cdf0e10cSrcweir pRet->PageCreated(aSet);
572cdf0e10cSrcweir }
573cdf0e10cSrcweir }
574cdf0e10cSrcweir }
575cdf0e10cSrcweir break;
576cdf0e10cSrcweir case RID_SW_TP_OPTSHDWCRSR:
577cdf0e10cSrcweir case RID_SW_TP_HTML_OPTSHDWCRSR:
578cdf0e10cSrcweir case RID_SW_TP_REDLINE_OPT:
579cdf0e10cSrcweir case RID_SW_TP_OPTLOAD_PAGE:
580cdf0e10cSrcweir case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
581cdf0e10cSrcweir case RID_SW_TP_MAILCONFIG:
582cdf0e10cSrcweir {
583cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
584cdf0e10cSrcweir if ( pFact )
585cdf0e10cSrcweir {
586cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
587cdf0e10cSrcweir if ( fnCreatePage )
588cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
589cdf0e10cSrcweir }
590cdf0e10cSrcweir if (pRet && (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR))
591cdf0e10cSrcweir {
592cdf0e10cSrcweir SwView* pCurrView = GetView();
593cdf0e10cSrcweir if(pCurrView)
594cdf0e10cSrcweir {
595cdf0e10cSrcweir aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) );
596cdf0e10cSrcweir pRet->PageCreated(aSet);
597cdf0e10cSrcweir }
598cdf0e10cSrcweir }
599cdf0e10cSrcweir }
600cdf0e10cSrcweir break;
601cdf0e10cSrcweir #ifdef DBG_UTIL
602cdf0e10cSrcweir case RID_SW_TP_OPTTEST_PAGE:
603cdf0e10cSrcweir {
604cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
605cdf0e10cSrcweir if ( pFact )
606cdf0e10cSrcweir {
607cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
608cdf0e10cSrcweir if ( fnCreatePage )
609cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
610cdf0e10cSrcweir }
611cdf0e10cSrcweir break;
612cdf0e10cSrcweir }
613cdf0e10cSrcweir #endif
614cdf0e10cSrcweir case RID_SW_TP_BACKGROUND:
615cdf0e10cSrcweir {
616cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
617cdf0e10cSrcweir if ( pFact )
618cdf0e10cSrcweir {
619cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
620cdf0e10cSrcweir if ( fnCreatePage )
621cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
622cdf0e10cSrcweir }
623cdf0e10cSrcweir break;
624cdf0e10cSrcweir }
625cdf0e10cSrcweir case TP_OPTCAPTION_PAGE:
626cdf0e10cSrcweir case RID_SW_TP_OPTCAPTION_PAGE:
627cdf0e10cSrcweir {
628cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
629cdf0e10cSrcweir if ( pFact )
630cdf0e10cSrcweir {
631cdf0e10cSrcweir ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
632cdf0e10cSrcweir if ( fnCreatePage )
633cdf0e10cSrcweir pRet = (*fnCreatePage)( pParent, rSet );
634cdf0e10cSrcweir }
635cdf0e10cSrcweir }
636cdf0e10cSrcweir break;
637cdf0e10cSrcweir }
638cdf0e10cSrcweir
639cdf0e10cSrcweir DBG_ASSERT( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
640cdf0e10cSrcweir return pRet;
641cdf0e10cSrcweir }
642cdf0e10cSrcweir
643