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