xref: /AOO41X/main/sw/source/ui/config/optpage.cxx (revision ff0525f24f03981d56b7579b645949f111420994)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 #ifdef SW_DLLIMPLEMENTATION
28 #undef SW_DLLIMPLEMENTATION
29 #endif
30 
31 #ifndef _SVSTDARR_HXX
32 #define _SVSTDARR_STRINGSDTOR
33 #include <svl/svstdarr.hxx>
34 #endif
35 
36 #include <optpage.hxx>
37 #include <doc.hxx>
38 #include <hintids.hxx>
39 #include <cmdid.h>
40 #include <fmtcol.hxx>
41 #include <charatr.hxx>
42 #include <swtypes.hxx>
43 #include <view.hxx>
44 #include <docsh.hxx>
45 #include <IDocumentDeviceAccess.hxx>
46 #include <swmodule.hxx>
47 #include <wrtsh.hxx>
48 #include <uitool.hxx>
49 #include <cfgitems.hxx>
50 #include <poolfmt.hxx>
51 #include <uiitems.hxx>
52 #include <initui.hxx>
53 #include <printdata.hxx>
54 #include <modcfg.hxx>
55 #include <srcview.hxx>
56 #include <crstate.hxx>
57 #include <viewopt.hxx>
58 #include <globals.hrc>
59 #include <config.hrc>
60 #include <redlopt.hrc>
61 #include <optdlg.hrc>
62 #include <swwrtshitem.hxx>
63 #include <unomid.h>
64 
65 #include <editeng/fhgtitem.hxx>
66 #include <editeng/fontitem.hxx>
67 #include <editeng/langitem.hxx>
68 #include <sfx2/request.hxx>
69 #include <sfx2/printer.hxx>
70 #include <sfx2/bindings.hxx>
71 #include <svl/slstitm.hxx>
72 #include <svl/ctloptions.hxx>
73 #include <svl/eitem.hxx>
74 #include <svl/cjkoptions.hxx>
75 #include <svtools/ctrltool.hxx>
76 #include <svx/htmlmode.hxx>
77 #include <svx/xtable.hxx>
78 #include <svx/dlgutil.hxx>
79 #include <svx/strarray.hxx>
80 #include <vcl/svapp.hxx>
81 
82 
83 
84 using namespace ::com::sun::star;
85 
86 
87 /*******************************************************
88  ******************************************************/
89 
90 /*-----------------31.08.96 10.16-------------------
91     TabPage Anzeige/Inhalt
92 --------------------------------------------------*/
93 
94 SwContentOptPage::SwContentOptPage( Window* pParent,
95                                       const SfxItemSet& rCoreSet ) :
96     SfxTabPage( pParent, SW_RES( TP_CONTENT_OPT ), rCoreSet ),
97     aLineFL       ( this,   SW_RES( FL_LINE     ) ),
98     aCrossCB      ( this,   SW_RES( CB_CROSS     ) ),
99     aSolidHandleCB( this,   SW_RES( CB_HANDLE   ) ),
100     aBigHandleCB  ( this,   SW_RES( CB_BIGHANDLE) ),
101 
102     aWindowFL     ( this,   SW_RES( FL_WINDOW   ) ),
103     aHScrollBox   ( this,   SW_RES( CB_HSCROLL   ) ),
104     aVScrollBox   ( this,   SW_RES( CB_VSCROLL   ) ),
105     aAnyRulerCB   ( this,   SW_RES( CB_ANY_RULER ) ),
106     aHRulerCBox   ( this,   SW_RES( CB_HRULER   ) ),
107     aHMetric      ( this,   SW_RES( LB_HMETRIC    ) ),
108     aVRulerCBox   ( this,   SW_RES( CB_VRULER    ) ),
109     aVRulerRightCBox( this, SW_RES( CB_VRULER_RIGHT    ) ),
110     aVMetric      ( this,   SW_RES( LB_VMETRIC    ) ),
111     aSmoothCBox   ( this,   SW_RES( CB_SMOOTH_SCROLL    ) ),
112 
113     aDispFL      ( this,   SW_RES( FL_DISP     ) ),
114     aGrfCB        ( this,   SW_RES( CB_GRF          ) ),
115     aTblCB        ( this,   SW_RES( CB_TBL      ) ),
116     aDrwCB        ( this,   SW_RES( CB_DRWFAST   ) ),
117     aFldNameCB    ( this,   SW_RES( CB_FIELD    ) ),
118     aPostItCB     ( this,   SW_RES( CB_POSTIT   ) ),
119 
120     aSettingsFL   ( this,   SW_RES( FL_SETTINGS   ) ),
121     aMetricFT     ( this,   SW_RES( FT_METRIC   ) ),
122     aMetricLB     ( this,   SW_RES( LB_METRIC   ) )
123 {
124     FreeResource();
125     const SfxPoolItem* pItem;
126     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, sal_False, &pItem )
127         && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
128     {
129         aMetricLB.Show();
130         aSettingsFL.Show();
131         aMetricFT.Show();
132     }
133     SvtCJKOptions aCJKOptions;
134     if(aCJKOptions.IsVerticalTextEnabled() )
135     {
136         Point aSmoothPos(aSmoothCBox.GetPosPixel());
137         aSmoothPos.Y() += aSmoothPos.Y() - aVRulerCBox.GetPosPixel().Y();
138         aSmoothCBox.SetPosPixel(aSmoothPos);
139     }
140     else
141         aVRulerRightCBox.Hide();
142     aVRulerCBox.SetClickHdl(LINK(this, SwContentOptPage, VertRulerHdl ));
143     aAnyRulerCB.SetClickHdl(LINK(this, SwContentOptPage, AnyRulerHdl));
144 
145     SvxStringArray aMetricArr( SW_RES( STR_ARR_METRIC ) );
146     for ( sal_uInt16 i = 0; i < aMetricArr.Count(); ++i )
147     {
148         String sMetric = aMetricArr.GetStringByPos( i );
149         FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i );
150 
151         switch ( eFUnit )
152         {
153             case FUNIT_MM:
154             case FUNIT_CM:
155             case FUNIT_POINT:
156             case FUNIT_PICA:
157             case FUNIT_INCH:
158             {
159                 // nur diese Metriken benutzen
160                 sal_uInt16 nPos = aMetricLB.InsertEntry( sMetric );
161                 aMetricLB.SetEntryData( nPos, (void*)(long)eFUnit );
162                 aVMetric.InsertEntry( sMetric );
163                 aVMetric.SetEntryData( nPos, (void*)(long)eFUnit );
164                 aHMetric.InsertEntry( sMetric );
165                 aHMetric.SetEntryData( nPos, (void*)(long)eFUnit );
166             }
167             default:;//prevent warning
168         }
169     }
170 }
171 
172 /*-----------------31.08.96 13.58-------------------
173 
174 --------------------------------------------------*/
175 SwContentOptPage::~SwContentOptPage()
176 {
177 }
178 
179 /*-----------------31.08.96 13.58-------------------
180 
181 --------------------------------------------------*/
182 SfxTabPage* SwContentOptPage::Create( Window* pParent,
183                                 const SfxItemSet& rAttrSet)
184 {
185     return new SwContentOptPage(pParent, rAttrSet);
186 }
187 /* -----------------------------07.04.01 16:57--------------------------------
188 
189  ---------------------------------------------------------------------------*/
190 static void lcl_SelectMetricLB(ListBox& rMetric, sal_uInt16 nSID, const SfxItemSet& rSet)
191 {
192     const SfxPoolItem* pItem;
193     if( rSet.GetItemState( nSID, sal_False, &pItem ) >= SFX_ITEM_AVAILABLE )
194     {
195         FieldUnit eFieldUnit = (FieldUnit)((SfxUInt16Item*)pItem)->GetValue();
196         for ( sal_uInt16 i = 0; i < rMetric.GetEntryCount(); ++i )
197         {
198             if ( (int)(sal_IntPtr)rMetric.GetEntryData( i ) == (int)eFieldUnit )
199             {
200                 rMetric.SelectEntryPos( i );
201                 break;
202             }
203         }
204     }
205     rMetric.SaveValue();
206 }
207 /*-----------------31.08.96 13.58-------------------
208 
209 --------------------------------------------------*/
210 void SwContentOptPage::Reset(const SfxItemSet& rSet)
211 {
212     const SwElemItem* pElemAttr = 0;
213 
214     rSet.GetItemState( FN_PARAM_ELEM , sal_False,
215                                     (const SfxPoolItem**)&pElemAttr );
216     if(pElemAttr)
217     {
218         aTblCB      .Check  (pElemAttr->bTable                );
219         aGrfCB      .Check  (pElemAttr->bGraphic              );
220         aDrwCB      .Check  (pElemAttr->bDrawing              );
221         aFldNameCB  .Check  (pElemAttr->bFieldName            );
222         aPostItCB   .Check  (pElemAttr->bNotes                );
223         aCrossCB   .Check( pElemAttr->bCrosshair        );
224         aSolidHandleCB.Check( !pElemAttr->bHandles          );
225         aBigHandleCB.Check(pElemAttr->bBigHandles       );
226         aHScrollBox.Check( pElemAttr->bHorzScrollbar     );
227         aVScrollBox.Check( pElemAttr->bVertScrollbar     );
228         aAnyRulerCB.Check( pElemAttr->bAnyRuler );
229         aHRulerCBox.Check( pElemAttr->bHorzRuler         );
230         aVRulerCBox.Check( pElemAttr->bVertRuler         );
231         aVRulerRightCBox.Check(pElemAttr->bVertRulerRight);
232         aSmoothCBox.Check( pElemAttr->bSmoothScroll      );
233     }
234     aMetricLB.SetNoSelection();
235     lcl_SelectMetricLB(aMetricLB, SID_ATTR_METRIC, rSet);
236     lcl_SelectMetricLB(aHMetric, FN_HSCROLL_METRIC, rSet);
237     lcl_SelectMetricLB(aVMetric, FN_VSCROLL_METRIC, rSet);
238     AnyRulerHdl(&aAnyRulerCB);
239 }
240 
241 /*-----------------31.08.96 13.58-------------------
242 
243 --------------------------------------------------*/
244 sal_Bool SwContentOptPage::FillItemSet(SfxItemSet& rSet)
245 {
246     const SwElemItem*   pOldAttr = (const SwElemItem*)
247                         GetOldItem(GetItemSet(), FN_PARAM_ELEM);
248 
249     SwElemItem aElem;
250     if(pOldAttr)
251         aElem = *pOldAttr;
252     aElem.bTable                = aTblCB        .IsChecked();
253     aElem.bGraphic              = aGrfCB        .IsChecked();
254     aElem.bDrawing              = aDrwCB        .IsChecked();
255     aElem.bFieldName            = aFldNameCB    .IsChecked();
256     aElem.bNotes                = aPostItCB     .IsChecked();
257     aElem.bCrosshair     = aCrossCB   .IsChecked();
258     aElem.bHandles       = !aSolidHandleCB.IsChecked();
259     aElem.bBigHandles    = aBigHandleCB.IsChecked();
260     aElem.bHorzScrollbar = aHScrollBox.IsChecked();
261     aElem.bVertScrollbar = aVScrollBox.IsChecked();
262     aElem.bAnyRuler = aAnyRulerCB.IsChecked();
263     aElem.bHorzRuler     = aHRulerCBox.IsChecked();
264     aElem.bVertRuler     = aVRulerCBox.IsChecked();
265     aElem.bVertRulerRight= aVRulerRightCBox.IsChecked();
266     aElem.bSmoothScroll  = aSmoothCBox.IsChecked();
267 
268 
269     sal_Bool bRet = !pOldAttr || aElem != *pOldAttr;
270     if(bRet)
271         bRet = 0 != rSet.Put(aElem);
272     sal_uInt16 nMPos = aMetricLB.GetSelectEntryPos();
273     sal_uInt16 nGlobalMetricPos = nMPos;
274     if ( nMPos != aMetricLB.GetSavedValue() )
275     {
276         // Doppel-Cast fuer VA3.0
277         sal_uInt16 nFieldUnit = (sal_uInt16)(long)aMetricLB.GetEntryData( nMPos );
278         rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)nFieldUnit ) );
279         bRet = sal_True;
280     }
281 
282     nMPos = aHMetric.GetSelectEntryPos();
283     if ( nMPos != aHMetric.GetSavedValue() || nMPos != nGlobalMetricPos )
284     {
285         // Doppel-Cast fuer VA3.0
286         sal_uInt16 nFieldUnit = (sal_uInt16)(long)aHMetric.GetEntryData( nMPos );
287         rSet.Put( SfxUInt16Item( FN_HSCROLL_METRIC, (sal_uInt16)nFieldUnit ) );
288         bRet = sal_True;
289     }
290     nMPos = aVMetric.GetSelectEntryPos();
291     if ( nMPos != aVMetric.GetSavedValue() || nMPos != nGlobalMetricPos )
292     {
293         // Doppel-Cast fuer VA3.0
294         sal_uInt16 nFieldUnit = (sal_uInt16)(long)aVMetric.GetEntryData( nMPos );
295         rSet.Put( SfxUInt16Item( FN_VSCROLL_METRIC, (sal_uInt16)nFieldUnit ) );
296         bRet = sal_True;
297     }
298     return bRet;
299 }
300 /* -----------------------------05.03.2002 15:07------------------------------
301 
302  ---------------------------------------------------------------------------*/
303 IMPL_LINK(SwContentOptPage, VertRulerHdl, CheckBox*, pBox)
304 {
305     aVRulerRightCBox.Enable(pBox->IsEnabled() && pBox->IsChecked());
306     return 0;
307 }
308 /* -----------------20.09.2002 11:30-----------------
309  *
310  * --------------------------------------------------*/
311 IMPL_LINK( SwContentOptPage, AnyRulerHdl, CheckBox*, pBox)
312 {
313     sal_Bool bChecked = pBox->IsChecked();
314     aHRulerCBox      .Enable(bChecked);
315     aHMetric         .Enable(bChecked);
316     aVRulerCBox      .Enable(bChecked);
317     aVMetric         .Enable(bChecked);
318     VertRulerHdl(&aVRulerCBox);
319     return 0;
320 }
321 /*----------------- OS 27.01.95  -----------------------
322  TabPage Drucker Zusatzeinstellungen
323 -------------------------------------------------------*/
324 SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent,
325                                       const SfxItemSet& rCoreSet) :
326     SfxTabPage( pParent, SW_RES( TP_OPTPRINT_PAGE ), rCoreSet),
327     aFL1          (this, SW_RES(FL_1)),
328     aGrfCB           (this, SW_RES(CB_PGRF)),
329 //  aTabCB           (this, SW_RES(CB_PTAB)),
330 //  aDrawCB          (this, SW_RES(CB_PDRAW)),
331     aCtrlFldCB       (this, SW_RES(CB_CTRLFLD)),
332     aBackgroundCB    (this, SW_RES(CB_BACKGROUND)),
333     aBlackFontCB     (this, SW_RES(CB_BLACK_FONT)),
334     aPrintHiddenTextCB(this, SW_RES(CB_HIDDEN_TEXT)),
335     aPrintTextPlaceholderCB(this, SW_RES(CB_TEXT_PLACEHOLDER)),
336     aSeparatorLFL    (this, SW_RES(FL_SEP_PRT_LEFT )),
337     aFL2          (this, SW_RES(FL_2)),
338     aLeftPageCB      (this, SW_RES(CB_LEFTP)),
339     aRightPageCB     (this, SW_RES(CB_RIGHTP)),
340 //    aReverseCB       (this, SW_RES(CB_REVERSE)),
341     aProspectCB      (this, SW_RES(CB_PROSPECT)),
342     aProspectCB_RTL      (this, SW_RES(CB_PROSPECT_RTL)),
343     aSeparatorRFL    (this, SW_RES(FL_SEP_PRT_RIGHT)),
344     aFL3          (this, SW_RES(FL_3)),
345     aNoRB            (this, SW_RES(RB_NO)),
346     aOnlyRB          (this, SW_RES(RB_ONLY)),
347     aEndRB           (this, SW_RES(RB_END)),
348     aEndPageRB       (this, SW_RES(RB_PAGEEND)),
349     aFL4          (this, SW_RES(FL_4)),
350     aPrintEmptyPagesCB(this, SW_RES(CB_PRINTEMPTYPAGES)),
351 //    aSingleJobsCB    (this, SW_RES(CB_SINGLEJOBS)),
352     aPaperFromSetupCB(this, SW_RES(CB_PAPERFROMSETUP)),
353     aFaxFT           (this, SW_RES(FT_FAX)),
354     aFaxLB           (this, SW_RES(LB_FAX)),
355     sNone(SW_RES(ST_NONE)),
356     bAttrModified( sal_False ),
357     bPreview  ( sal_False )
358 {
359     Init();
360     FreeResource();
361     Link aLk = LINK( this, SwAddPrinterTabPage, AutoClickHdl);
362     aGrfCB.SetClickHdl( aLk );
363     aRightPageCB.SetClickHdl( aLk );
364     aLeftPageCB.SetClickHdl( aLk );
365 //  aTabCB.SetClickHdl( aLk );
366 //  aDrawCB.SetClickHdl( aLk );
367     aCtrlFldCB.SetClickHdl( aLk );
368     aBackgroundCB.SetClickHdl( aLk );
369     aBlackFontCB.SetClickHdl( aLk );
370     aPrintHiddenTextCB.SetClickHdl( aLk );
371     aPrintTextPlaceholderCB.SetClickHdl( aLk );
372 //  aReverseCB.SetClickHdl( aLk );
373     aProspectCB.SetClickHdl( aLk );
374     aProspectCB_RTL.SetClickHdl( aLk );
375     aPaperFromSetupCB.SetClickHdl( aLk );
376     aPrintEmptyPagesCB.SetClickHdl( aLk );
377     aEndPageRB.SetClickHdl( aLk );
378     aEndRB.SetClickHdl( aLk );
379     aOnlyRB.SetClickHdl( aLk );
380     aNoRB.SetClickHdl( aLk );
381 //  aSingleJobsCB.SetClickHdl( aLk );
382     aFaxLB.SetSelectHdl( LINK( this, SwAddPrinterTabPage, SelectHdl ) );
383 
384     const SfxPoolItem* pItem;
385     if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, sal_False, &pItem )
386         && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
387     {
388 //      aDrawCB      .Hide();
389         aLeftPageCB  .Hide();
390         aRightPageCB .Hide();
391         aPrintHiddenTextCB.Hide();
392         aPrintTextPlaceholderCB.Hide();
393 //      aReverseCB.SetPosPixel(aLeftPageCB.GetPosPixel());
394         aProspectCB.SetPosPixel(aLeftPageCB.GetPosPixel());
395         Point aPt( aRightPageCB.GetPosPixel() );
396         aPt.setX(aPt.getX() + 15); // indent
397         aProspectCB_RTL.SetPosPixel(aPt);
398 //      aBlackFontCB.SetPosPixel(aBackgroundCB.GetPosPixel());
399 //        aPrintHiddenTextCB.SetPosPixel(aBlackFontCB.GetPosPixel());
400 //      aBackgroundCB.SetPosPixel(aCtrlFldCB.GetPosPixel());
401 //      aCtrlFldCB.SetPosPixel(aDrawCB.GetPosPixel());
402 
403         // hide aPrintEmptyPagesCB and move everything below up accordingly
404         long nDeltaY = aPaperFromSetupCB.GetPosPixel().getY() - aPrintEmptyPagesCB.GetPosPixel().getY();
405         aPrintEmptyPagesCB.Hide();
406         aPt = aPaperFromSetupCB.GetPosPixel();
407         aPt.setY( aPt.getY() - nDeltaY );
408         aPaperFromSetupCB.SetPosPixel( aPt );
409         aPt = aFaxFT.GetPosPixel();
410         aPt.setY( aPt.getY() - nDeltaY );
411         aFaxFT.SetPosPixel( aPt );
412         aPt = aFaxLB.GetPosPixel();
413         aPt.setY( aPt.getY() - nDeltaY );
414         aFaxLB.SetPosPixel( aPt );
415     }
416     aProspectCB_RTL.Disable();
417     SvtCTLOptions aCTLOptions;
418     aProspectCB_RTL.Show(aCTLOptions.IsCTLFontEnabled());
419 }
420 
421 //------------------------------------------------------------------------
422 
423 void SwAddPrinterTabPage::SetPreview(sal_Bool bPrev)
424 {
425     bPreview = bPrev;
426 
427     if (bPreview)
428     {
429         aLeftPageCB.Disable();
430         aRightPageCB.Disable();
431         aProspectCB.Disable();
432         aProspectCB_RTL.Disable();
433         aFL3.Disable();
434         aNoRB.Disable();
435         aOnlyRB.Disable();
436         aEndRB.Disable();
437         aEndPageRB.Disable();
438     }
439 }
440 
441 //------------------------------------------------------------------------
442 
443 SfxTabPage* SwAddPrinterTabPage::Create( Window* pParent,
444                                        const SfxItemSet& rAttrSet )
445 {
446     return ( new SwAddPrinterTabPage( pParent, rAttrSet ) );
447 }
448 //------------------------------------------------------------------------
449 
450 
451 sal_Bool    SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet )
452 {
453     if ( bAttrModified )
454     {
455         SwAddPrinterItem aAddPrinterAttr (FN_PARAM_ADDPRINTER);
456         aAddPrinterAttr.bPrintGraphic   = aGrfCB.IsChecked();
457         aAddPrinterAttr.bPrintTable     = sal_True; // always enabled since CWS printerpullgpages /*aTabCB.IsChecked();*/
458         aAddPrinterAttr.bPrintDraw      = aGrfCB.IsChecked(); // UI merged with aGrfCB in CWS printerpullgpages /*aDrawCB.IsChecked()*/;
459         aAddPrinterAttr.bPrintControl   = aCtrlFldCB.IsChecked();
460         aAddPrinterAttr.bPrintPageBackground = aBackgroundCB.IsChecked();
461         aAddPrinterAttr.bPrintBlackFont = aBlackFontCB.IsChecked();
462         aAddPrinterAttr.bPrintHiddenText = aPrintHiddenTextCB.IsChecked();
463         aAddPrinterAttr.bPrintTextPlaceholder = aPrintTextPlaceholderCB.IsChecked();
464 
465         aAddPrinterAttr.bPrintLeftPages     = aLeftPageCB.IsChecked();
466         aAddPrinterAttr.bPrintRightPages    = aRightPageCB.IsChecked();
467         aAddPrinterAttr.bPrintReverse       = sal_False; // handled by vcl itself since CWS printerpullpages /*aReverseCB.IsChecked()*/;
468         aAddPrinterAttr.bPrintProspect      = aProspectCB.IsChecked();
469         aAddPrinterAttr.bPrintProspectRTL   = aProspectCB_RTL.IsChecked();
470         aAddPrinterAttr.bPaperFromSetup     = aPaperFromSetupCB.IsChecked();
471         aAddPrinterAttr.bPrintEmptyPages    = aPrintEmptyPagesCB.IsChecked();
472         aAddPrinterAttr.bPrintSingleJobs    = sal_True; // handled by vcl in new print dialog since CWS printerpullpages /*aSingleJobsCB.IsChecked()*/;
473 
474         if (aNoRB.IsChecked())  aAddPrinterAttr.nPrintPostIts =
475                                                         POSTITS_NONE;
476         if (aOnlyRB.IsChecked()) aAddPrinterAttr.nPrintPostIts =
477                                                         POSTITS_ONLY;
478         if (aEndRB.IsChecked()) aAddPrinterAttr.nPrintPostIts =
479                                                         POSTITS_ENDDOC;
480         if (aEndPageRB.IsChecked()) aAddPrinterAttr.nPrintPostIts =
481                                                         POSTITS_ENDPAGE;
482 
483         String sFax = aFaxLB.GetSelectEntry();
484         aAddPrinterAttr.sFaxName = sNone == sFax ? aEmptyStr : sFax;
485         rCoreSet.Put(aAddPrinterAttr);
486     }
487     return bAttrModified;
488 }
489 //------------------------------------------------------------------------
490 
491 
492 void    SwAddPrinterTabPage::Reset( const SfxItemSet&  )
493 {
494     const   SfxItemSet&         rSet = GetItemSet();
495     const   SwAddPrinterItem*   pAddPrinterAttr = 0;
496 
497     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER , sal_False,
498                                     (const SfxPoolItem**)&pAddPrinterAttr ))
499     {
500         aGrfCB.Check(           pAddPrinterAttr->bPrintGraphic || pAddPrinterAttr->bPrintDraw );
501 //      aTabCB.Check(           pAddPrinterAttr->bPrintTable);
502 //        aDrawCB.Check(          pAddPrinterAttr->bPrintDraw);
503         aCtrlFldCB.Check(       pAddPrinterAttr->bPrintControl);
504         aBackgroundCB.Check(    pAddPrinterAttr->bPrintPageBackground);
505         aBlackFontCB.Check(     pAddPrinterAttr->bPrintBlackFont);
506         aPrintHiddenTextCB.Check( pAddPrinterAttr->bPrintHiddenText);
507         aPrintTextPlaceholderCB.Check(pAddPrinterAttr->bPrintTextPlaceholder);
508         aLeftPageCB.Check(      pAddPrinterAttr->bPrintLeftPages);
509         aRightPageCB.Check(     pAddPrinterAttr->bPrintRightPages);
510 //      aReverseCB.Check(       pAddPrinterAttr->bPrintReverse);
511         aPaperFromSetupCB.Check(pAddPrinterAttr->bPaperFromSetup);
512         aPrintEmptyPagesCB.Check(pAddPrinterAttr->bPrintEmptyPages);
513         aProspectCB.Check(      pAddPrinterAttr->bPrintProspect);
514         aProspectCB_RTL.Check(      pAddPrinterAttr->bPrintProspectRTL);
515 //      aSingleJobsCB.Check(    pAddPrinterAttr->bPrintSingleJobs);
516 
517         aNoRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_NONE ) ;
518         aOnlyRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ;
519         aEndRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDDOC ) ;
520         aEndPageRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDPAGE ) ;
521         aFaxLB.SelectEntry( pAddPrinterAttr->sFaxName );
522     }
523     if (aProspectCB.IsChecked())
524     {
525         aProspectCB_RTL.Enable(sal_True);
526         aNoRB.Enable( sal_False );
527         aOnlyRB.Enable( sal_False );
528         aEndRB.Enable( sal_False );
529         aEndPageRB.Enable( sal_False );
530     }
531     else
532         aProspectCB_RTL.Enable( sal_False );
533 }
534 //-----------------------------------------------------------------------
535 
536 
537 void    SwAddPrinterTabPage::Init()
538 {
539 
540 }
541 //------------------------------------------------------------------------
542 
543 
544 IMPL_LINK_INLINE_START( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
545 {
546     bAttrModified = sal_True;
547     bool bIsProspect = aProspectCB.IsChecked();
548     if (!bIsProspect)
549         aProspectCB_RTL.Check( sal_False );
550     aProspectCB_RTL.Enable( bIsProspect );
551     aNoRB.Enable( !bIsProspect );
552     aOnlyRB.Enable( !bIsProspect );
553     aEndRB.Enable( !bIsProspect );
554     aEndPageRB.Enable( !bIsProspect );
555     return 0;
556 }
557 IMPL_LINK_INLINE_END( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
558 
559 //------------------------------------------------------------------------
560 
561 
562 void  SwAddPrinterTabPage::SetFax( const SvStringsDtor& rFaxLst )
563 {
564     aFaxLB.InsertEntry(sNone);
565     for ( sal_uInt16 i = 0; i < rFaxLst.Count(); ++i )
566         aFaxLB.InsertEntry( *rFaxLst.GetObject(i) );
567     aFaxLB.SelectEntryPos(0);
568 }
569 
570 //------------------------------------------------------------------------
571 
572 
573 IMPL_LINK_INLINE_START( SwAddPrinterTabPage, SelectHdl, ListBox *, EMPTYARG )
574 {
575     bAttrModified=sal_True;
576     return 0;
577 }
578 IMPL_LINK_INLINE_END( SwAddPrinterTabPage, SelectHdl, ListBox *, EMPTYARG )
579 
580 void SwAddPrinterTabPage::PageCreated (SfxAllItemSet aSet)
581 {
582     //SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_FAX_LIST,sal_False);
583     SFX_ITEMSET_ARG (&aSet,pListItem,SfxBoolItem,SID_FAX_LIST,sal_False);
584     SFX_ITEMSET_ARG (&aSet,pPreviewItem,SfxBoolItem,SID_PREVIEWFLAG_TYPE,sal_False);
585     if (pPreviewItem)
586     {
587         SetPreview(pPreviewItem->GetValue());
588         Reset(aSet);
589     }
590     if (pListItem && pListItem->GetValue())
591     {
592         SvStringsDtor aFaxList;
593         const std::vector<rtl::OUString>& rPrinters = Printer::GetPrinterQueues();
594         for (unsigned int i = 0; i < rPrinters.size(); ++i)
595         {
596             String* pString = new String( rPrinters[i] );
597             String* &rpString = pString;
598             aFaxList.Insert(rpString, 0);
599         }
600         SetFax( aFaxList );
601 /*      SvStringsDtor aFaxList;
602         const List *pList = (pListItem)->GetList();
603         sal_uInt32 nCount = pList->Count();
604         for(sal_uInt32 i = 0; i < nCount ; i++)
605         {
606             String* pString = (String*)(pList->GetObject(i));
607             String* &rpString = pString;
608             aFaxList.Insert(rpString, 0 );
609         }
610         SetFax(aFaxList);
611 */
612     }
613 }
614 /*-----------------03.09.96 11.53-------------------
615     Tabpage Standardfonts
616 --------------------------------------------------*/
617 
618 
619 SwStdFontTabPage::SwStdFontTabPage( Window* pParent,
620                                        const SfxItemSet& rSet ) :
621     SfxTabPage( pParent, SW_RES( TP_STD_FONT ), rSet),
622     aStdChrFL  (this, SW_RES(FL_STDCHR  )),
623     aTypeFT(        this, SW_RES( FT_TYPE          )),
624 
625     aStandardLbl(this, SW_RES(FT_STANDARD)),
626     aStandardBox(this, SW_RES(LB_STANDARD)),
627 
628     aHeightFT(        this, SW_RES( FT_SIZE          )),
629     aStandardHeightLB(this, SW_RES( LB_STANDARD_SIZE )),
630 
631     aTitleLbl   (this, SW_RES(FT_TITLE   )),
632     aTitleBox   (this, SW_RES(LB_TITLE   )),
633     aTitleHeightLB(   this, SW_RES( LB_TITLE_SIZE    )),
634 
635     aListLbl    (this, SW_RES(FT_LIST    )),
636     aListBox    (this, SW_RES(LB_LIST    )),
637     aListHeightLB(    this, SW_RES( LB_LIST_SIZE     )),
638 
639     aLabelLbl   (this, SW_RES(FT_LABEL   )),
640     aLabelBox   (this, SW_RES(LB_LABEL   )),
641     aLabelHeightLB(   this, SW_RES( LB_LABEL_SIZE    )),
642 
643     aIdxLbl     (this, SW_RES(FT_IDX     )),
644     aIdxBox     (this, SW_RES(LB_IDX     )),
645     aIndexHeightLB(   this, SW_RES( LB_INDEX_SIZE    )),
646 
647     aDocOnlyCB  (this, SW_RES(CB_DOCONLY )),
648     aStandardPB (this, SW_RES(PB_STANDARD)),
649     pPrt(0),
650     pFontList(0),
651     pFontConfig(0),
652     pWrtShell(0),
653     eLanguage( GetAppLanguage() ),
654 
655     bListDefault(sal_False),
656     bSetListDefault(sal_True),
657     bLabelDefault(sal_False),
658     bSetLabelDefault(sal_True),
659     bIdxDefault(sal_False),
660     bSetIdxDefault(sal_True),
661     bDeletePrinter(sal_False),
662 
663     bListHeightDefault    (sal_False),
664     bSetListHeightDefault (sal_False),
665     bLabelHeightDefault   (sal_False),
666     bSetLabelHeightDefault(sal_False),
667     bIndexHeightDefault     (sal_False),
668     bSetIndexHeightDefault  (sal_False),
669 
670     nFontGroup(FONT_GROUP_DEFAULT),
671 
672     sScriptWestern(SW_RES(ST_SCRIPT_WESTERN)),
673     sScriptAsian(SW_RES(ST_SCRIPT_ASIAN)),
674     sScriptComplex(SW_RES(ST_SCRIPT_CTL))
675 {
676     FreeResource();
677     aStandardPB.SetClickHdl(LINK(this, SwStdFontTabPage, StandardHdl));
678     aStandardBox.SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
679     aListBox    .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
680     aLabelBox   .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
681     aIdxBox     .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
682     Link aFocusLink = LINK( this, SwStdFontTabPage, LoseFocusHdl);
683     aStandardBox.SetLoseFocusHdl( aFocusLink );
684     aTitleBox   .SetLoseFocusHdl( aFocusLink );
685     aListBox    .SetLoseFocusHdl( aFocusLink );
686     aLabelBox   .SetLoseFocusHdl( aFocusLink );
687     aIdxBox     .SetLoseFocusHdl( aFocusLink );
688 
689     Link aModifyHeightLink( LINK( this, SwStdFontTabPage, ModifyHeightHdl));
690     aStandardHeightLB.SetModifyHdl( aModifyHeightLink );
691     aTitleHeightLB.   SetModifyHdl( aModifyHeightLink );
692     aListHeightLB.    SetModifyHdl( aModifyHeightLink );
693     aLabelHeightLB.   SetModifyHdl( aModifyHeightLink );
694     aIndexHeightLB.   SetModifyHdl( aModifyHeightLink );
695 
696     aDocOnlyCB.Check(SW_MOD()->GetModuleConfig()->IsDefaultFontInCurrDocOnly());
697 }
698 
699 /*-----------------03.09.96 11.53-------------------
700 
701 --------------------------------------------------*/
702 
703 SwStdFontTabPage::~SwStdFontTabPage()
704 {
705     if(bDeletePrinter)
706         delete pPrt;
707 }
708 
709 /*-----------------03.09.96 11.53-------------------
710 
711 --------------------------------------------------*/
712 SfxTabPage* SwStdFontTabPage::Create( Window* pParent,
713                                 const SfxItemSet& rAttrSet )
714 {
715     return new SwStdFontTabPage(pParent, rAttrSet);
716 }
717 
718 /*-----------------03.09.96 11.53-------------------
719 
720 --------------------------------------------------*/
721 void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
722                     SfxPrinter* pPrt, const String& rStyle,
723                     sal_uInt16 nFontWhich)
724 {
725     Font aFont( rStyle, Size( 0, 10 ) );
726     if( pPrt )
727         aFont = pPrt->GetFontMetric( aFont );
728     SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType);
729     pColl->SetFmtAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
730                 aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
731 }
732 /*-- 11.10.2005 15:47:52---------------------------------------------------
733 
734   -----------------------------------------------------------------------*/
735 void lcl_SetColl(SwWrtShell* pWrtShell, sal_uInt16 nType,
736                     sal_Int32 nHeight, sal_uInt16 nFontHeightWhich)
737 {
738     float fSize = (float)nHeight / 10;
739     nHeight = CalcToUnit( fSize, SFX_MAPUNIT_TWIP );
740     SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType);
741     pColl->SetFmtAttr(SvxFontHeightItem(nHeight, 100, nFontHeightWhich));
742 }
743 /*-----------------03.09.96 11.53-------------------
744 
745 --------------------------------------------------*/
746 sal_Bool SwStdFontTabPage::FillItemSet( SfxItemSet& )
747 {
748     sal_Bool bNotDocOnly = !aDocOnlyCB.IsChecked();
749     SW_MOD()->GetModuleConfig()->SetDefaultFontInCurrDocOnly(!bNotDocOnly);
750 
751     String sStandard    = aStandardBox.GetText();
752     String sTitle       =  aTitleBox   .GetText();
753     String sList        =  aListBox    .GetText();
754     String sLabel       =  aLabelBox   .GetText();
755     String sIdx         =  aIdxBox     .GetText();
756     String sStandardBak = aStandardBox.GetSavedValue();
757     String sTitleBak    = aTitleBox   .GetSavedValue();
758     String sListBak     = aListBox    .GetSavedValue();
759     String sLabelBak    = aLabelBox   .GetSavedValue();
760     String sIdxBak      = aIdxBox     .GetSavedValue();
761 
762     bool bStandardHeightChanged = aStandardHeightLB.GetSavedValue() != aStandardHeightLB.GetText();
763     bool bTitleHeightChanged = aTitleHeightLB.GetSavedValue() != aTitleHeightLB.GetText();
764     bool bListHeightChanged = aListHeightLB.GetSavedValue() != aListHeightLB.GetText() && (!bListHeightDefault || !bSetListHeightDefault );
765     bool bLabelHeightChanged = aLabelHeightLB.GetSavedValue() != aLabelHeightLB.GetText() && (!bLabelHeightDefault || !bSetLabelHeightDefault );
766     bool bIndexHeightChanged = aIndexHeightLB.GetSavedValue() != aIndexHeightLB.GetText() && (!bIndexHeightDefault || !bSetIndexHeightDefault );
767     if(bNotDocOnly)
768     {
769         pFontConfig->SetFontStandard(sStandard, nFontGroup);
770         pFontConfig->SetFontOutline(sTitle, nFontGroup);
771         pFontConfig->SetFontList(sList, nFontGroup);
772         pFontConfig->SetFontCaption(sLabel, nFontGroup);
773         pFontConfig->SetFontIndex(sIdx, nFontGroup);
774         if(bStandardHeightChanged)
775         {
776             float fSize = (float)aStandardHeightLB.GetValue() / 10;
777             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_STANDARD, nFontGroup );
778         }
779         if(bTitleHeightChanged)
780         {
781             float fSize = (float)aTitleHeightLB.GetValue() / 10;
782             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_OUTLINE, nFontGroup );
783         }
784         if(bListHeightChanged)
785         {
786             float fSize = (float)aListHeightLB.GetValue() / 10;
787             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_LIST, nFontGroup );
788         }
789         if(bLabelHeightChanged)
790         {
791             float fSize = (float)aLabelHeightLB.GetValue() / 10;
792             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_CAPTION, nFontGroup );
793         }
794         if(bIndexHeightChanged)
795         {
796             float fSize = (float)aIndexHeightLB.GetValue() / 10;
797             pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_INDEX, nFontGroup );
798         }
799     }
800     if(pWrtShell)
801     {
802         pWrtShell->StartAllAction();
803         SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess()->getPrinter( false );
804         sal_Bool bMod = sal_False;
805         sal_uInt16 nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
806             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONT :
807             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT);
808         sal_uInt16 nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
809             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONTSIZE :
810             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE);
811         if(sStandard != sShellStd)
812         {
813             Font aFont( sStandard, Size( 0, 10 ) );
814             if( pPrinter )
815                 aFont = pPrinter->GetFontMetric( aFont );
816             pWrtShell->SetDefault(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
817                                   aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
818             SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
819             pColl->ResetFmtAttr(nFontWhich);
820 //          lcl_SetColl(pWrtShell, RES_POOLCOLL_STANDARD, pPrinter, sStandard);
821             bMod = sal_True;
822         }
823         if(bStandardHeightChanged)
824         {
825             float fSize = (float)aStandardHeightLB.GetValue() / 10;
826             pWrtShell->SetDefault(SvxFontHeightItem( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), 100, nFontHeightWhich ) );
827             SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
828             pColl->ResetFmtAttr(nFontHeightWhich);
829             bMod = sal_True;
830         }
831 
832         if(sTitle != sShellTitle )
833         {
834             lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE, pPrinter, sTitle, nFontWhich);
835             bMod = sal_True;
836         }
837         if(bTitleHeightChanged)
838         {
839             lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE,
840                 sal::static_int_cast< sal_uInt16, sal_Int64 >(aTitleHeightLB.GetValue()), nFontHeightWhich);
841             bMod = sal_True;
842         }
843         if(sList != sShellList && (!bListDefault || !bSetListDefault ))
844         {
845             lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE, pPrinter, sList, nFontWhich);
846             bMod = sal_True;
847         }
848         if(bListHeightChanged)
849         {
850             lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE,
851                 sal::static_int_cast< sal_uInt16, sal_Int64 >(aListHeightLB.GetValue()), nFontHeightWhich);
852             bMod = sal_True;
853         }
854         if(sLabel != sShellLabel && (!bLabelDefault || !bSetLabelDefault))
855         {
856             lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL, pPrinter, sLabel, nFontWhich);
857             bMod = sal_True;
858         }
859         if(bLabelHeightChanged)
860         {
861             lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL,
862                 sal::static_int_cast< sal_uInt16, sal_Int64 >(aLabelHeightLB.GetValue()), nFontHeightWhich);
863             bMod = sal_True;
864         }
865         if(sIdx != sShellIndex && (!bIdxDefault || !bSetIdxDefault))
866         {
867             lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE, pPrinter, sIdx, nFontWhich);
868             bMod = sal_True;
869         }
870         if(bIndexHeightChanged)
871         {
872             lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE,
873                 sal::static_int_cast< sal_uInt16, sal_Int64 >(aIndexHeightLB.GetValue()), nFontHeightWhich);
874             bMod = sal_True;
875         }
876         if ( bMod )
877             pWrtShell->SetModified();
878         pWrtShell->EndAllAction();
879     }
880 
881     return sal_False;
882 }
883 
884 /*-----------------03.09.96 11.53-------------------
885 
886 --------------------------------------------------*/
887 void SwStdFontTabPage::Reset( const SfxItemSet& rSet)
888 {
889     const SfxPoolItem* pLang;
890     sal_uInt16 nLangSlot = nFontGroup == FONT_GROUP_DEFAULT  ? SID_ATTR_LANGUAGE :
891         FONT_GROUP_CJK == nFontGroup ? SID_ATTR_CHAR_CJK_LANGUAGE : SID_ATTR_CHAR_CTL_LANGUAGE;
892 
893 
894     if( SFX_ITEM_SET == rSet.GetItemState(nLangSlot, sal_False, &pLang))
895         eLanguage = ((const SvxLanguageItem*)pLang)->GetValue();
896 
897     String sTmp(aStdChrFL.GetText());
898     String sToReplace = sScriptWestern;
899     if(FONT_GROUP_CJK == nFontGroup )
900         sToReplace = sScriptAsian;
901     else if(FONT_GROUP_CTL == nFontGroup )
902         sToReplace = sScriptComplex;
903 
904     sTmp.SearchAndReplaceAscii("%1", sToReplace);
905     aStdChrFL.SetText(sTmp);
906     const SfxPoolItem* pItem;
907 
908     if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_PRINTER, sal_False, &pItem))
909     {
910         pPrt = (SfxPrinter*)((const SwPtrItem*)pItem)->GetValue();
911     }
912     else
913     {
914         SfxItemSet* pPrinterSet = new SfxItemSet( *rSet.GetPool(),
915                     SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
916                     SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
917                     0 );
918         pPrt = new SfxPrinter(pPrinterSet);
919         bDeletePrinter = sal_True;
920     }
921     pFontList = new FontList( pPrt );
922     // #i94536# prevent duplication of font entries when 'reset' button is pressed
923     if( !aStandardBox.GetEntryCount() )
924     {
925         // get the set of disctinct available family names
926         std::set< String > aFontNames;
927         int nFontNames = pPrt->GetDevFontCount();
928         for( int i = 0; i < nFontNames; i++ )
929         {
930             FontInfo aInf( pPrt->GetDevFont( i ) );
931             aFontNames.insert( aInf.GetName() );
932         }
933 
934         // insert to listboxes
935         for( std::set< String >::const_iterator it = aFontNames.begin();
936              it != aFontNames.end(); ++it )
937         {
938             aStandardBox.InsertEntry( *it );
939             aTitleBox   .InsertEntry( *it );
940             aListBox    .InsertEntry( *it );
941             aLabelBox   .InsertEntry( *it );
942             aIdxBox     .InsertEntry( *it );
943         }
944     }
945     if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_STDFONTS, sal_False, &pItem))
946     {
947          pFontConfig = (SwStdFontConfig*)((const SwPtrItem*)pItem)->GetValue();
948     }
949 
950     if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_WRTSHELL, sal_False, &pItem))
951     {
952         pWrtShell = (SwWrtShell*)((const SwPtrItem*)pItem)->GetValue();
953     }
954     String sStdBackup;
955     String sOutBackup;
956     String sListBackup;
957     String sCapBackup;
958     String sIdxBackup;
959     sal_Int32 nStandardHeight = -1;
960     sal_Int32 nTitleHeight = -1;
961     sal_Int32 nListHeight = -1;
962     sal_Int32 nLabelHeight = -1;
963     sal_Int32 nIndexHeight = -1;
964 
965     if(!pWrtShell)
966     {
967         sStdBackup = pFontConfig->GetFontStandard(nFontGroup);
968         sOutBackup = pFontConfig->GetFontOutline(nFontGroup);
969         sListBackup= pFontConfig->GetFontList(nFontGroup);
970         sCapBackup = pFontConfig->GetFontCaption(nFontGroup);
971         sIdxBackup = pFontConfig->GetFontIndex(nFontGroup);
972         nStandardHeight = pFontConfig->GetFontHeight( FONT_STANDARD, nFontGroup, eLanguage );
973         nTitleHeight =    pFontConfig->GetFontHeight( FONT_OUTLINE , nFontGroup, eLanguage );
974         nListHeight =     pFontConfig->GetFontHeight( FONT_LIST    , nFontGroup, eLanguage );
975         nLabelHeight =    pFontConfig->GetFontHeight( FONT_CAPTION , nFontGroup, eLanguage );
976         nIndexHeight =    pFontConfig->GetFontHeight( FONT_INDEX   , nFontGroup, eLanguage );
977         if( nStandardHeight <= 0)
978             nStandardHeight = pFontConfig->GetDefaultHeightFor( FONT_STANDARD + nFontGroup * FONT_PER_GROUP, eLanguage);
979         if( nTitleHeight <= 0)
980             nTitleHeight = pFontConfig->GetDefaultHeightFor( FONT_OUTLINE + nFontGroup * FONT_PER_GROUP, eLanguage);
981         if( nListHeight <= 0)
982             nListHeight = pFontConfig->GetDefaultHeightFor( FONT_LIST + nFontGroup * FONT_PER_GROUP, eLanguage);
983         if( nLabelHeight <= 0)
984             nLabelHeight = pFontConfig->GetDefaultHeightFor( FONT_CAPTION + nFontGroup * FONT_PER_GROUP, eLanguage);
985         if( nIndexHeight <= 0)
986             nIndexHeight = pFontConfig->GetDefaultHeightFor( FONT_INDEX + nFontGroup * FONT_PER_GROUP, eLanguage);
987 
988        aDocOnlyCB.Enable(sal_False);
989     }
990     else
991     {
992         SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
993         const SvxFontItem& rFont = !nFontGroup ? pColl->GetFont() :
994                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
995         sShellStd = sStdBackup =  rFont.GetFamilyName();
996 
997         sal_uInt16 nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
998             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONTSIZE :
999             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE );
1000         const SvxFontHeightItem& rFontHeightStandard = (const SvxFontHeightItem& )pColl->GetFmtAttr(nFontHeightWhich);
1001         nStandardHeight = (sal_Int32)rFontHeightStandard.GetHeight();
1002 
1003         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_HEADLINE_BASE);
1004         const SvxFontItem& rFontHL = !nFontGroup ? pColl->GetFont() :
1005                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
1006         sShellTitle = sOutBackup = rFontHL.GetFamilyName();
1007 
1008         const SvxFontHeightItem& rFontHeightTitle = (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, sal_True );
1009         nTitleHeight = (sal_Int32)rFontHeightTitle.GetHeight();
1010 
1011         sal_uInt16 nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
1012             nFontGroup == FONT_GROUP_DEFAULT  ? RES_CHRATR_FONT :
1013             FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT);
1014         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_NUMBUL_BASE);
1015         const SvxFontItem& rFontLS = !nFontGroup ? pColl->GetFont() :
1016                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
1017         bListDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, sal_False);
1018         sShellList = sListBackup = rFontLS.GetFamilyName();
1019 
1020         const SvxFontHeightItem& rFontHeightList = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
1021         nListHeight = (sal_Int32)rFontHeightList.GetHeight();
1022         bListHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, sal_False);
1023 
1024 
1025         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_LABEL);
1026         bLabelDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, sal_False);
1027         const SvxFontItem& rFontCP = !nFontGroup ? pColl->GetFont() :
1028                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
1029         sShellLabel = sCapBackup = rFontCP.GetFamilyName();
1030         const SvxFontHeightItem& rFontHeightLabel = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
1031         nLabelHeight = (sal_Int32)rFontHeightLabel.GetHeight();
1032         bLabelHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, sal_False);
1033 
1034         pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_REGISTER_BASE);
1035         bIdxDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, sal_False);
1036         const SvxFontItem& rFontIDX = !nFontGroup ? pColl->GetFont() :
1037                 FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
1038         sShellIndex = sIdxBackup = rFontIDX.GetFamilyName();
1039         const SvxFontHeightItem& rFontHeightIndex = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
1040         nIndexHeight = (sal_Int32)rFontHeightIndex.GetHeight();
1041         bIndexHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, sal_False);
1042     }
1043     aStandardBox.SetText(sStdBackup );
1044     aTitleBox   .SetText(sOutBackup );
1045     aListBox    .SetText(sListBackup);
1046     aLabelBox   .SetText(sCapBackup );
1047     aIdxBox     .SetText(sIdxBackup );
1048 
1049     FontInfo aFontInfo( pFontList->Get(sStdBackup, sStdBackup) );
1050     aStandardHeightLB.Fill( &aFontInfo, pFontList );
1051     aFontInfo = pFontList->Get(sOutBackup, sOutBackup );
1052     aTitleHeightLB.Fill( &aFontInfo, pFontList );
1053     aFontInfo = pFontList->Get(sListBackup,sListBackup);
1054     aListHeightLB.Fill( &aFontInfo, pFontList );
1055     aFontInfo = pFontList->Get(sCapBackup, sCapBackup );
1056     aLabelHeightLB.Fill( &aFontInfo, pFontList );
1057     aFontInfo = pFontList->Get(sIdxBackup, sIdxBackup );
1058     aIndexHeightLB.Fill( &aFontInfo, pFontList );
1059 
1060     aStandardHeightLB.SetValue( CalcToPoint( nStandardHeight, SFX_MAPUNIT_TWIP, 10 ) );
1061     aTitleHeightLB.   SetValue( CalcToPoint( nTitleHeight   , SFX_MAPUNIT_TWIP, 10 ) );
1062     aListHeightLB.    SetValue( CalcToPoint( nListHeight    , SFX_MAPUNIT_TWIP, 10 ) );
1063     aLabelHeightLB.   SetValue( CalcToPoint( nLabelHeight   , SFX_MAPUNIT_TWIP, 10 ));
1064     aIndexHeightLB.   SetValue( CalcToPoint( nIndexHeight   , SFX_MAPUNIT_TWIP, 10 ));
1065 
1066     aStandardBox.SaveValue();
1067     aTitleBox   .SaveValue();
1068     aListBox    .SaveValue();
1069     aLabelBox   .SaveValue();
1070     aIdxBox     .SaveValue();
1071 
1072     aStandardHeightLB.SaveValue();
1073     aTitleHeightLB.   SaveValue();
1074     aListHeightLB.    SaveValue();
1075     aLabelHeightLB.   SaveValue();
1076     aIndexHeightLB.   SaveValue();
1077 }
1078 
1079 /*-----------------07.09.96 12.28-------------------
1080 
1081 --------------------------------------------------*/
1082 
1083 
1084 IMPL_LINK( SwStdFontTabPage, StandardHdl, PushButton *, EMPTYARG )
1085 {
1086     sal_uInt8 nFontOffset = nFontGroup * FONT_PER_GROUP;
1087     aStandardBox.SetText(SwStdFontConfig::GetDefaultFor(FONT_STANDARD + nFontOffset, eLanguage));
1088     aTitleBox   .SetText(SwStdFontConfig::GetDefaultFor(FONT_OUTLINE  + nFontOffset, eLanguage));
1089     aListBox    .SetText(SwStdFontConfig::GetDefaultFor(FONT_LIST     + nFontOffset, eLanguage));
1090     aLabelBox   .SetText(SwStdFontConfig::GetDefaultFor(FONT_CAPTION  + nFontOffset, eLanguage));
1091     aIdxBox     .SetText(SwStdFontConfig::GetDefaultFor(FONT_INDEX    + nFontOffset, eLanguage));
1092 
1093     aStandardBox.SaveValue();
1094     aTitleBox   .SaveValue();
1095     aListBox    .SaveValue();
1096     aLabelBox   .SaveValue();
1097     aIdxBox     .SaveValue();
1098 
1099     aStandardHeightLB.SetValue( CalcToPoint(
1100         SwStdFontConfig::GetDefaultHeightFor(FONT_STANDARD + nFontOffset, eLanguage),
1101             SFX_MAPUNIT_TWIP, 10 ) );
1102     aTitleHeightLB   .SetValue(CalcToPoint(
1103         SwStdFontConfig::GetDefaultHeightFor(FONT_OUTLINE  +
1104             nFontOffset, eLanguage), SFX_MAPUNIT_TWIP, 10 ));
1105     aListHeightLB    .SetValue(CalcToPoint(
1106         SwStdFontConfig::GetDefaultHeightFor(FONT_LIST + nFontOffset, eLanguage),
1107             SFX_MAPUNIT_TWIP, 10 ));
1108     aLabelHeightLB   .SetValue(CalcToPoint(
1109         SwStdFontConfig::GetDefaultHeightFor(FONT_CAPTION  + nFontOffset, eLanguage),
1110             SFX_MAPUNIT_TWIP, 10 ));
1111     aIndexHeightLB   .SetValue(CalcToPoint(
1112         SwStdFontConfig::GetDefaultHeightFor(FONT_INDEX    + nFontOffset, eLanguage),
1113             SFX_MAPUNIT_TWIP, 10 ));
1114 
1115     return 0;
1116 }
1117 /*-----------------17.01.97 15.43-------------------
1118 
1119 --------------------------------------------------*/
1120 
1121 IMPL_LINK( SwStdFontTabPage, ModifyHdl, ComboBox*, pBox )
1122 {
1123     if(pBox == &aStandardBox)
1124     {
1125         String sEntry = pBox->GetText();
1126         if(bSetListDefault && bListDefault)
1127             aListBox.SetText(sEntry);
1128         if(bSetLabelDefault && bLabelDefault)
1129             aLabelBox.SetText(sEntry);
1130         if(bSetIdxDefault && bIdxDefault)
1131             aIdxBox.SetText(sEntry);
1132     }
1133     else if(pBox == &aListBox)
1134     {
1135         bSetListDefault = sal_False;
1136     }
1137     else if(pBox == &aLabelBox)
1138     {
1139         bSetLabelDefault = sal_False;
1140     }
1141     else if(pBox == &aIdxBox)
1142     {
1143         bSetIdxDefault = sal_False;
1144     }
1145     return 0;
1146 }
1147 
1148 /*-- 11.10.2005 15:11:23---------------------------------------------------
1149 
1150   -----------------------------------------------------------------------*/
1151 IMPL_LINK( SwStdFontTabPage, ModifyHeightHdl, FontSizeBox*, pBox )
1152 {
1153     if(pBox == &aStandardHeightLB)
1154     {
1155         sal_Int64 nValue = pBox->GetValue(FUNIT_TWIP);
1156         if(bSetListHeightDefault && bListHeightDefault)
1157             aListHeightLB.SetValue(nValue, FUNIT_TWIP);
1158         if(bSetLabelHeightDefault && bLabelHeightDefault)
1159             aLabelHeightLB.SetValue(nValue, FUNIT_TWIP);
1160         if(bSetIndexHeightDefault && bIndexHeightDefault)
1161             aIndexHeightLB.SetValue(nValue, FUNIT_TWIP);
1162     }
1163     else if(pBox == &aListHeightLB)
1164     {
1165         bSetListHeightDefault = sal_False;
1166     }
1167     else if(pBox == &aLabelHeightLB)
1168     {
1169         bSetLabelHeightDefault = sal_False;
1170     }
1171     else if(pBox == &aIndexHeightLB)
1172     {
1173         bSetIndexHeightDefault = sal_False;
1174     }
1175     return 0;
1176 }
1177 
1178 /*-- 28.09.2005 13:22:36---------------------------------------------------
1179 
1180   -----------------------------------------------------------------------*/
1181 IMPL_LINK( SwStdFontTabPage, LoseFocusHdl, ComboBox*, pBox )
1182 {
1183     FontSizeBox* pHeightLB = 0;
1184     String sEntry = pBox->GetText();
1185     if(pBox == &aStandardBox)
1186     {
1187         pHeightLB = &aStandardHeightLB;
1188     }
1189     else if(pBox == &aTitleBox)
1190     {
1191         pHeightLB = &aTitleHeightLB;
1192     }
1193     else if(pBox == &aListBox)
1194     {
1195         pHeightLB = &aListHeightLB;
1196     }
1197     else if(pBox == &aLabelBox)
1198     {
1199         pHeightLB = &aLabelHeightLB;
1200     }
1201     else /*if(pBox == &aIdxBox)*/
1202     {
1203         pHeightLB = &aIndexHeightLB;
1204     }
1205     FontInfo aFontInfo( pFontList->Get(sEntry, sEntry) );
1206     pHeightLB->Fill( &aFontInfo, pFontList );
1207 
1208     return 0;
1209 }
1210 
1211 
1212 void SwStdFontTabPage::PageCreated (SfxAllItemSet aSet)
1213 {
1214     SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt16Item, SID_FONTMODE_TYPE, sal_False);
1215     if (pFlagItem)
1216         SetFontMode(sal::static_int_cast< sal_uInt8, sal_uInt16>( pFlagItem->GetValue()));
1217 }
1218 /*-----------------18.01.97 12.14-------------------
1219     Optionen Tabelle
1220 --------------------------------------------------*/
1221 
1222 SwTableOptionsTabPage::SwTableOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) :
1223     SfxTabPage(pParent, SW_RES(TP_OPTTABLE_PAGE), rSet),
1224     aTableFL        (this, SW_RES(FL_TABLE           )),
1225     aHeaderCB       (this, SW_RES(CB_HEADER          )),
1226     aRepeatHeaderCB (this, SW_RES(CB_REPEAT_HEADER    )),
1227     aDontSplitCB    (this, SW_RES(CB_DONT_SPLIT       )),
1228     aBorderCB       (this, SW_RES(CB_BORDER           )),
1229 
1230     aSeparatorFL     (this, SW_RES(FL_TABLE_SEPARATOR)),
1231 
1232     aTableInsertFL  (this, SW_RES(FL_TABLE_INSERT    )),
1233     aNumFormattingCB(this, SW_RES(CB_NUMFORMATTING   )),
1234     aNumFmtFormattingCB(this, SW_RES(CB_NUMFMT_FORMATTING )),
1235     aNumAlignmentCB (this, SW_RES(CB_NUMALIGNMENT )),
1236 
1237     aMoveFL(        this, SW_RES(FL_MOVE     )),
1238     aMoveFT(        this, SW_RES(FT_MOVE     )),
1239     aRowMoveFT(     this, SW_RES(FT_ROWMOVE  )),
1240     aRowMoveMF(     this, SW_RES(MF_ROWMOVE   )),
1241     aColMoveFT(     this, SW_RES(FT_COLMOVE   )),
1242     aColMoveMF(     this, SW_RES(MF_COLMOVE   )),
1243 
1244     aInsertFT(      this, SW_RES(FT_INSERT   )),
1245     aRowInsertFT(   this, SW_RES(FT_ROWINSERT)),
1246     aRowInsertMF(   this, SW_RES(MF_ROWINSERT)),
1247     aColInsertFT(   this, SW_RES(FT_COLINSERT)),
1248     aColInsertMF(   this, SW_RES(MF_COLINSERT)),
1249 
1250     aHandlingFT(    this, SW_RES(FT_HANDLING )),
1251     aFixRB(         this, SW_RES(RB_FIX       )),
1252     aFixPropRB(     this, SW_RES(RB_FIXPROP  )),
1253     aVarRB(         this, SW_RES(RB_VAR      )),
1254     aFixFT(         this, SW_RES(FT_FIX      )),
1255     aFixPropFT(     this, SW_RES(FT_FIXPROP   )),
1256     aVarFT(         this, SW_RES(FT_VAR       )),
1257     pWrtShell(0),
1258     bHTMLMode(sal_False)
1259 {
1260     FreeResource();
1261 
1262     Link aLnk(LINK(this, SwTableOptionsTabPage, CheckBoxHdl));
1263     aNumFormattingCB.SetClickHdl(aLnk);
1264     aNumFmtFormattingCB.SetClickHdl(aLnk);
1265     aHeaderCB.SetClickHdl(aLnk);
1266 }
1267 
1268 /*-----------------18.01.97 12.43-------------------
1269 
1270 --------------------------------------------------*/
1271 
1272 SwTableOptionsTabPage::~SwTableOptionsTabPage()
1273 {
1274 }
1275 
1276 /*-----------------18.01.97 12.43-------------------
1277 
1278 --------------------------------------------------*/
1279 
1280 SfxTabPage* SwTableOptionsTabPage::Create( Window* pParent,
1281                                 const SfxItemSet& rAttrSet )
1282 {
1283     return new SwTableOptionsTabPage(pParent, rAttrSet );
1284 }
1285 
1286 /*-----------------18.01.97 12.42-------------------
1287 
1288 --------------------------------------------------*/
1289 
1290 sal_Bool SwTableOptionsTabPage::FillItemSet( SfxItemSet& )
1291 {
1292     sal_Bool bRet = sal_False;
1293     SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
1294 
1295     if(aRowMoveMF.IsModified())
1296         pModOpt->SetTblHMove( (sal_uInt16)aRowMoveMF.Denormalize( aRowMoveMF.GetValue(FUNIT_TWIP)));
1297 
1298     if(aColMoveMF.IsModified())
1299         pModOpt->SetTblVMove( (sal_uInt16)aColMoveMF.Denormalize( aColMoveMF.GetValue(FUNIT_TWIP)));
1300 
1301     if(aRowInsertMF.IsModified())
1302         pModOpt->SetTblHInsert((sal_uInt16)aRowInsertMF.Denormalize( aRowInsertMF.GetValue(FUNIT_TWIP)));
1303 
1304     if(aColInsertMF.IsModified())
1305         pModOpt->SetTblVInsert((sal_uInt16)aColInsertMF.Denormalize( aColInsertMF.GetValue(FUNIT_TWIP)));
1306 
1307     TblChgMode eMode;
1308     if(aFixRB.IsChecked())
1309         eMode = TBLFIX_CHGABS;
1310     else if(aFixPropRB.IsChecked())
1311         eMode = TBLFIX_CHGPROP;
1312     else
1313         eMode = TBLVAR_CHGABS;
1314     if(eMode != pModOpt->GetTblMode())
1315     {
1316         pModOpt->SetTblMode(eMode);
1317         // der Tabellen-Tastatur-Modus hat sich geaendert, das soll
1318         // jetzt auch die aktuelle Tabelle erfahren
1319         if(pWrtShell && nsSelectionType::SEL_TBL & pWrtShell->GetSelectionType())
1320         {
1321             pWrtShell->SetTblChgMode(eMode);
1322             static sal_uInt16 __READONLY_DATA aInva[] =
1323                                 {   FN_TABLE_MODE_FIX,
1324                                     FN_TABLE_MODE_FIX_PROP,
1325                                     FN_TABLE_MODE_VARIABLE,
1326                                     0
1327                                 };
1328             pWrtShell->GetView().GetViewFrame()->GetBindings().Invalidate( aInva );
1329         }
1330 
1331         bRet = sal_True;
1332     }
1333 
1334     SwInsertTableOptions aInsOpts( 0, 0 );
1335 
1336     if (aHeaderCB.IsChecked())
1337         aInsOpts.mnInsMode |= tabopts::HEADLINE;
1338 
1339     if (aRepeatHeaderCB.IsEnabled() )
1340         aInsOpts.mnRowsToRepeat = aRepeatHeaderCB.IsChecked()? 1 : 0;
1341 
1342     if (!aDontSplitCB.IsChecked())
1343         aInsOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
1344 
1345     if (aBorderCB.IsChecked())
1346         aInsOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
1347 
1348     if (aHeaderCB.GetSavedValue() != aHeaderCB.GetState() ||
1349         aRepeatHeaderCB.GetSavedValue() != aRepeatHeaderCB.GetState() ||
1350         aDontSplitCB.GetSavedValue() != aDontSplitCB.GetState() ||
1351         aBorderCB.GetSavedValue() != aBorderCB.GetState())
1352     {
1353         pModOpt->SetInsTblFlags(bHTMLMode, aInsOpts);
1354     }
1355 
1356     if (aNumFormattingCB.GetSavedValue() != aNumFormattingCB.GetState())
1357     {
1358         pModOpt->SetInsTblFormatNum(bHTMLMode, aNumFormattingCB.IsChecked());
1359         bRet = sal_True;
1360     }
1361 
1362     if (aNumFmtFormattingCB.GetSavedValue() != aNumFmtFormattingCB.GetState())
1363     {
1364         pModOpt->SetInsTblChangeNumFormat(bHTMLMode, aNumFmtFormattingCB.IsChecked());
1365         bRet = sal_True;
1366     }
1367 
1368     if (aNumAlignmentCB.GetSavedValue() != aNumAlignmentCB.GetState())
1369     {
1370         pModOpt->SetInsTblAlignNum(bHTMLMode, aNumAlignmentCB.IsChecked());
1371         bRet = sal_True;
1372     }
1373 
1374     return bRet;
1375 }
1376 /*-----------------18.01.97 12.42-------------------
1377 
1378 --------------------------------------------------*/
1379 void SwTableOptionsTabPage::Reset( const SfxItemSet& rSet)
1380 {
1381     const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
1382     if ( rSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE )
1383     {
1384         const SfxUInt16Item& rItem = (SfxUInt16Item&)rSet.Get( SID_ATTR_METRIC );
1385         FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue();
1386         ::SetFieldUnit( aRowMoveMF, eFieldUnit );
1387         ::SetFieldUnit( aColMoveMF, eFieldUnit );
1388         ::SetFieldUnit( aRowInsertMF, eFieldUnit );
1389         ::SetFieldUnit( aColInsertMF, eFieldUnit );
1390     }
1391 
1392     aRowMoveMF  .SetValue(aRowMoveMF.Normalize(pModOpt->GetTblHMove()), FUNIT_TWIP);
1393     aColMoveMF  .SetValue(aColMoveMF.Normalize(pModOpt->GetTblVMove()), FUNIT_TWIP);
1394     aRowInsertMF.SetValue(aRowInsertMF.Normalize(pModOpt->GetTblHInsert()), FUNIT_TWIP);
1395     aColInsertMF.SetValue(aColInsertMF.Normalize(pModOpt->GetTblVInsert()), FUNIT_TWIP);
1396 
1397     switch(pModOpt->GetTblMode())
1398     {
1399         case TBLFIX_CHGABS:     aFixRB.Check();     break;
1400         case TBLFIX_CHGPROP:    aFixPropRB.Check(); break;
1401         case TBLVAR_CHGABS:     aVarRB.Check(); break;
1402     }
1403     const SfxPoolItem* pItem;
1404     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem))
1405     {
1406         bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
1407     }
1408 
1409     //bestimmte Controls fuer HTML verstecken
1410     if(bHTMLMode)
1411     {
1412 /*        Point aPos(aCaptionFL.GetPosPixel());
1413         long nYDiff = aTableFL.GetPosPixel().Y() - aPos.Y();
1414         aTableFL.SetPosPixel(aPos);
1415 
1416         aPos = aHeaderCB.GetPosPixel();
1417         aPos.Y() -= nYDiff;
1418         aHeaderCB.SetPosPixel(aPos);
1419 
1420         aPos = aRepeatHeaderCB.GetPosPixel();
1421         aPos.Y() -= nYDiff;
1422         aRepeatHeaderCB.SetPosPixel(aPos);
1423 
1424         aPos = aDontSplitCB.GetPosPixel(); // hier muss eine Luecke geschlossen werden
1425         aPos.Y() -= nYDiff;
1426         aBorderCB.SetPosPixel(aPos);
1427 
1428         aPos = aTableInsertFL.GetPosPixel();
1429         aPos.Y() -= nYDiff;
1430         aTableInsertFL.SetPosPixel(aPos);
1431 
1432         aPos = aNumFormattingCB.GetPosPixel();
1433         aPos.Y() -= nYDiff;
1434         aNumFormattingCB.SetPosPixel(aPos);
1435 
1436         aPos = aNumFmtFormattingCB.GetPosPixel();
1437         aPos.Y() -= nYDiff;
1438         aNumFmtFormattingCB.SetPosPixel(aPos);
1439 
1440         aPos = aNumAlignmentCB.GetPosPixel();
1441         aPos.Y() -= nYDiff;
1442         aNumAlignmentCB.SetPosPixel(aPos);
1443 
1444         aCaptionFL.Hide();
1445         aCaptionCB.Hide();
1446         aCaptionFT.Hide();
1447         aCaptionPB.Hide();
1448 */
1449         aDontSplitCB.Hide();
1450     }
1451 
1452     SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode);
1453     sal_uInt16 nInsTblFlags = aInsOpts.mnInsMode;
1454 
1455     aHeaderCB.Check(0 != (nInsTblFlags & tabopts::HEADLINE));
1456     aRepeatHeaderCB.Check(aInsOpts.mnRowsToRepeat > 0);
1457     aDontSplitCB.Check(!(nInsTblFlags & tabopts::SPLIT_LAYOUT));
1458     aBorderCB.Check(0 != (nInsTblFlags & tabopts::DEFAULT_BORDER));
1459 
1460     aNumFormattingCB.Check(pModOpt->IsInsTblFormatNum(bHTMLMode));
1461     aNumFmtFormattingCB.Check(pModOpt->IsInsTblChangeNumFormat(bHTMLMode));
1462     aNumAlignmentCB.Check(pModOpt->IsInsTblAlignNum(bHTMLMode));
1463 
1464     aHeaderCB.SaveValue();
1465     aRepeatHeaderCB.SaveValue();
1466     aDontSplitCB.SaveValue();
1467     aBorderCB.SaveValue();
1468     aNumFormattingCB.SaveValue();
1469     aNumFmtFormattingCB.SaveValue();
1470     aNumAlignmentCB.SaveValue();
1471 
1472     CheckBoxHdl(0);
1473 }
1474 /*-----------------18.01.97 12.42-------------------
1475 
1476 --------------------------------------------------*/
1477 IMPL_LINK(SwTableOptionsTabPage, CheckBoxHdl, CheckBox*, EMPTYARG)
1478 {
1479     aNumFmtFormattingCB.Enable(aNumFormattingCB.IsChecked());
1480     aNumAlignmentCB.Enable(aNumFormattingCB.IsChecked());
1481     aRepeatHeaderCB.Enable(aHeaderCB.IsChecked());
1482     return 0;
1483 }
1484 
1485 void SwTableOptionsTabPage::PageCreated (SfxAllItemSet aSet)
1486 {
1487     SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False);
1488     if (pWrtSh)
1489         SetWrtShell(pWrtSh->GetValue());
1490 }
1491 /*  */
1492 
1493 /*-----------------31.10.97 17:55-------------------
1494  TabPage fuer ShadowCrsr
1495 --------------------------------------------------*/
1496 
1497 SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( Window* pParent,
1498                                                     const SfxItemSet& rSet )
1499     : SfxTabPage(pParent, SW_RES(TP_OPTSHDWCRSR), rSet),
1500     aUnprintFL   ( this,   SW_RES( FL_NOPRINT  ) ),
1501     aParaCB       ( this,   SW_RES( CB_PARA      ) ),
1502     aSHyphCB      ( this,   SW_RES( CB_SHYPH        ) ),
1503     aSpacesCB     ( this,   SW_RES( CB_SPACE    ) ),
1504     aHSpacesCB    ( this,   SW_RES( CB_HSPACE   ) ),
1505     aTabCB        ( this,   SW_RES( CB_TAB      ) ),
1506     aBreakCB      ( this,   SW_RES( CB_BREAK        ) ),
1507     aCharHiddenCB     ( this,   SW_RES( CB_CHAR_HIDDEN   ) ),
1508     aFldHiddenCB     ( this,   SW_RES( CB_FLD_HIDDEN   ) ),
1509     aFldHiddenParaCB ( this,   SW_RES( CB_FLD_HIDDEN_PARA ) ),
1510 
1511     aSeparatorFL(   this, SW_RES( FL_SEPARATOR_SHDW)),
1512 
1513     aFlagFL( this, SW_RES( FL_SHDWCRSFLAG )),
1514     aOnOffCB( this, SW_RES( CB_SHDWCRSONOFF )),
1515 
1516     aFillModeFT( this, SW_RES( FT_SHDWCRSFILLMODE )),
1517     aFillMarginRB( this, SW_RES( RB_SHDWCRSFILLMARGIN )),
1518     aFillIndentRB( this, SW_RES( RB_SHDWCRSFILLINDENT )),
1519     aFillTabRB( this, SW_RES( RB_SHDWCRSFILLTAB )),
1520     aFillSpaceRB( this, SW_RES( RB_SHDWCRSFILLSPACE )),
1521     aCrsrOptFL   ( this, SW_RES( FL_CRSR_OPT)),
1522     aCrsrInProtCB( this, SW_RES( CB_ALLOW_IN_PROT )),
1523     m_aLayoutOptionsFL( this, SW_RES( FL_LAYOUT_OPTIONS ) ),
1524     m_aMathBaselineAlignmentCB( this, SW_RES( CB_MATH_BASELINE_ALIGNMENT ) ),
1525     m_pWrtShell( NULL )
1526 {
1527     FreeResource();
1528     const SfxPoolItem* pItem = 0;
1529 
1530     SwShadowCursorItem aOpt;
1531     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
1532         aOpt = *(SwShadowCursorItem*)pItem;
1533     aOnOffCB.Check( aOpt.IsOn() );
1534 
1535     sal_uInt8 eMode = aOpt.GetMode();
1536     aFillIndentRB.Check( FILL_INDENT == eMode );
1537     aFillMarginRB.Check( FILL_MARGIN == eMode );
1538     aFillTabRB.Check( FILL_TAB == eMode );
1539     aFillSpaceRB.Check( FILL_SPACE == eMode );
1540 
1541     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem )
1542         && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
1543     {
1544         aTabCB      .Hide();
1545         aCharHiddenCB.Hide();
1546         aFldHiddenCB    .Hide();
1547         aFldHiddenParaCB.Hide();
1548         aBreakCB.SetPosPixel(aTabCB.GetPosPixel());
1549         aFlagFL         .Hide();
1550         aOnOffCB        .Hide();
1551         aFillModeFT     .Hide();
1552         aFillMarginRB   .Hide();
1553         aFillIndentRB   .Hide();
1554         aFillTabRB      .Hide();
1555         aFillSpaceRB    .Hide();
1556         aCrsrOptFL      .Hide();
1557         aCrsrInProtCB   .Hide();
1558         aSeparatorFL.Hide();
1559         long nWidth = aFlagFL.GetSizePixel().Width() + aFlagFL.GetPosPixel().X()
1560                                                         - aUnprintFL.GetPosPixel().X();
1561         Size aSize(aUnprintFL.GetSizePixel());
1562         aSize.Width() = nWidth;
1563         aUnprintFL.SetSizePixel(aSize);
1564     }
1565 }
1566 
1567 SwShdwCrsrOptionsTabPage::~SwShdwCrsrOptionsTabPage()
1568 {
1569 }
1570 
1571 
1572 SfxTabPage* SwShdwCrsrOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet )
1573 {
1574     return new SwShdwCrsrOptionsTabPage( pParent, rSet );
1575 }
1576 
1577 
1578 void SwShdwCrsrOptionsTabPage::PageCreated( SfxAllItemSet aSet )
1579 {
1580     SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False);
1581     if (pWrtSh)
1582         SetWrtShell(pWrtSh->GetValue());
1583 }
1584 
1585 
1586 sal_Bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet )
1587 {
1588     SwShadowCursorItem aOpt;
1589     aOpt.SetOn( aOnOffCB.IsChecked() );
1590 
1591     sal_uInt8 eMode;
1592     if( aFillIndentRB.IsChecked() )
1593         eMode= FILL_INDENT;
1594     else if( aFillMarginRB.IsChecked() )
1595         eMode = FILL_MARGIN;
1596     else if( aFillTabRB.IsChecked() )
1597         eMode = FILL_TAB;
1598     else
1599         eMode = FILL_SPACE;
1600     aOpt.SetMode( eMode );
1601 
1602     sal_Bool bRet = sal_False;
1603     const SfxPoolItem* pItem = 0;
1604     if( SFX_ITEM_SET != rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem )
1605         ||  ((SwShadowCursorItem&)*pItem) != aOpt )
1606     {
1607         rSet.Put( aOpt );
1608         bRet = sal_True;
1609     }
1610 
1611     m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
1612             m_aMathBaselineAlignmentCB.IsChecked() );
1613     bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue();
1614 
1615     if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue())
1616     {
1617         rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aCrsrInProtCB.IsChecked()));
1618         bRet |= sal_True;
1619     }
1620 
1621     const SwDocDisplayItem* pOldAttr = (const SwDocDisplayItem*)
1622                         GetOldItem(GetItemSet(), FN_PARAM_DOCDISP);
1623 
1624     SwDocDisplayItem aDisp;
1625     if(pOldAttr)
1626         aDisp = *pOldAttr;
1627     //
1628     aDisp.bParagraphEnd         = aParaCB       .IsChecked();
1629     aDisp.bTab                  = aTabCB        .IsChecked();
1630     aDisp.bSpace                = aSpacesCB     .IsChecked();
1631     aDisp.bNonbreakingSpace     = aHSpacesCB    .IsChecked();
1632     aDisp.bSoftHyphen           = aSHyphCB      .IsChecked();
1633     aDisp.bFldHiddenText        = aFldHiddenCB     .IsChecked();
1634     aDisp.bCharHiddenText       = aCharHiddenCB.IsChecked();
1635     aDisp.bShowHiddenPara       = aFldHiddenParaCB .IsChecked();
1636     aDisp.bManualBreak          = aBreakCB      .IsChecked();
1637 
1638     bRet |= (!pOldAttr || aDisp != *pOldAttr);
1639     if(bRet)
1640         bRet = 0 != rSet.Put(aDisp);
1641 
1642     return bRet;
1643 }
1644 
1645 void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet )
1646 {
1647     const SfxPoolItem* pItem = 0;
1648 
1649     SwShadowCursorItem aOpt;
1650     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
1651         aOpt = *(SwShadowCursorItem*)pItem;
1652     aOnOffCB.Check( aOpt.IsOn() );
1653 
1654     sal_uInt8 eMode = aOpt.GetMode();
1655     aFillIndentRB.Check( FILL_INDENT == eMode );
1656     aFillMarginRB.Check( FILL_MARGIN == eMode );
1657     aFillTabRB.Check( FILL_TAB == eMode );
1658     aFillSpaceRB.Check( FILL_SPACE == eMode );
1659 
1660     m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) );
1661     m_aMathBaselineAlignmentCB.SaveValue();
1662 
1663     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
1664         aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
1665     aCrsrInProtCB.SaveValue();
1666 
1667     const SwDocDisplayItem* pDocDisplayAttr = 0;
1668 
1669     rSet.GetItemState( FN_PARAM_DOCDISP, sal_False,
1670                                     (const SfxPoolItem**)&pDocDisplayAttr );
1671     if(pDocDisplayAttr)
1672     {
1673         aParaCB     .Check  (pDocDisplayAttr->bParagraphEnd         );
1674         aTabCB      .Check  (pDocDisplayAttr->bTab                  );
1675         aSpacesCB   .Check  (pDocDisplayAttr->bSpace                );
1676         aHSpacesCB  .Check  (pDocDisplayAttr->bNonbreakingSpace     );
1677         aSHyphCB    .Check  (pDocDisplayAttr->bSoftHyphen           );
1678         aCharHiddenCB.Check (pDocDisplayAttr->bCharHiddenText );
1679         aFldHiddenCB   .Check  (pDocDisplayAttr->bFldHiddenText );
1680         aFldHiddenParaCB.Check (pDocDisplayAttr->bShowHiddenPara       );
1681         aBreakCB    .Check  (pDocDisplayAttr->bManualBreak          );
1682     }
1683 }
1684 
1685 /*-----------------31.10.97 17:55-------------------
1686  TabPage fuer Redlining
1687 --------------------------------------------------*/
1688 
1689 struct CharAttr
1690 {
1691     sal_uInt16 nItemId;
1692     sal_uInt16 nAttr;
1693 };
1694 
1695 // Editieren entspricht Einfuegen-Attributen
1696 static CharAttr __FAR_DATA aRedlineAttr[] =
1697 {
1698     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_NOT_MAPPED },
1699     { SID_ATTR_CHAR_WEIGHT,         WEIGHT_BOLD },
1700     { SID_ATTR_CHAR_POSTURE,        ITALIC_NORMAL },
1701     { SID_ATTR_CHAR_UNDERLINE,      UNDERLINE_SINGLE },
1702     { SID_ATTR_CHAR_UNDERLINE,      UNDERLINE_DOUBLE },
1703     { SID_ATTR_CHAR_STRIKEOUT,      STRIKEOUT_SINGLE },
1704     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_VERSALIEN },
1705     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_GEMEINE },
1706     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_KAPITAELCHEN },
1707     { SID_ATTR_CHAR_CASEMAP,        SVX_CASEMAP_TITEL },
1708     { SID_ATTR_BRUSH,               0 }
1709 };
1710 // Items from aRedlineAttr relevant for InsertAttr: strikethrough is
1711 // not used
1712 static sal_uInt16 aInsertAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
1713 
1714 // Items from aRedlineAttr relevant for DeleteAttr: underline and
1715 // double underline is not used
1716 static sal_uInt16 aDeletedAttrMap[] = { 0, 1, 2, 5, 6, 7, 8, 9, 10 };
1717 
1718 // Items from aRedlineAttr relevant for ChangeAttr: strikethrough is
1719 // not used
1720 static sal_uInt16 aChangedAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
1721 
1722 /*-----------------------------------------------------------------------
1723     Beschreibung: Markierungsvorschau
1724  -----------------------------------------------------------------------*/
1725 
1726 SwMarkPreview::SwMarkPreview( Window *pParent, const ResId& rResID ) :
1727 
1728     Window(pParent, rResID),
1729     m_aTransCol( COL_TRANSPARENT ),
1730     m_aMarkCol( COL_LIGHTRED ),
1731     nMarkPos(0)
1732 
1733 {
1734     InitColors();
1735     SetMapMode(MAP_PIXEL);
1736 
1737     const Size aSz(GetOutputSizePixel());
1738 
1739     // Seite
1740     aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3));
1741 
1742     sal_uLong nOutWPix = aPage.GetWidth();
1743     sal_uLong nOutHPix = aPage.GetHeight();
1744 
1745     // PrintArea
1746     sal_uLong nLBorder = 8;
1747     sal_uLong nRBorder = 8;
1748     sal_uLong nTBorder = 4;
1749     sal_uLong nBBorder = 4;
1750 
1751     aLeftPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder));
1752     sal_uInt16 nWidth = (sal_uInt16)aLeftPagePrtArea.GetWidth();
1753     sal_uInt16 nKorr = (nWidth & 1) != 0 ? 0 : 1;
1754     aLeftPagePrtArea.SetSize(Size(nWidth / 2 - (nLBorder + nRBorder) / 2 + nKorr, aLeftPagePrtArea.GetHeight()));
1755 
1756     aRightPagePrtArea = aLeftPagePrtArea;
1757     aRightPagePrtArea.Move(aLeftPagePrtArea.GetWidth() + nLBorder + nRBorder + 1, 0);
1758 }
1759 
1760 SwMarkPreview::~SwMarkPreview()
1761 {
1762 }
1763 
1764 void SwMarkPreview::InitColors( void )
1765 {
1766     // m_aTransCol and m_aMarkCol are _not_ changed because they are set from outside!
1767 
1768     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
1769     m_aBgCol = Color( rSettings.GetWindowColor() );
1770 
1771     sal_Bool bHC = rSettings.GetHighContrastMode();
1772     m_aLineCol = bHC? SwViewOption::GetFontColor() : Color( COL_BLACK );
1773     m_aShadowCol = bHC? m_aBgCol : rSettings.GetShadowColor();
1774     m_aTxtCol = bHC? SwViewOption::GetFontColor() : Color( COL_GRAY );
1775     m_aPrintAreaCol = m_aTxtCol;
1776 }
1777 
1778 void SwMarkPreview::DataChanged( const DataChangedEvent& rDCEvt )
1779 {
1780     Window::DataChanged( rDCEvt );
1781 
1782     if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
1783         InitColors();
1784 }
1785 
1786 void SwMarkPreview::Paint(const Rectangle &/*rRect*/)
1787 {
1788     // Schatten zeichnen
1789     Rectangle aShadow(aPage);
1790     aShadow += Point(3, 3);
1791     DrawRect( aShadow, m_aShadowCol, m_aTransCol );
1792 
1793     // Seite zeichnen
1794     DrawRect( aPage, m_aBgCol, m_aLineCol );
1795 
1796     // Separator zeichnen
1797     Rectangle aPageSeparator(aPage);
1798     aPageSeparator.SetSize(Size(2, aPageSeparator.GetHeight()));
1799     aPageSeparator.Move(aPage.GetWidth() / 2 - 1, 0);
1800     DrawRect( aPageSeparator, m_aLineCol, m_aTransCol );
1801 
1802     PaintPage(aLeftPagePrtArea);
1803     PaintPage(aRightPagePrtArea);
1804 
1805     Rectangle aLeftMark(Point(aPage.Left() + 2, aLeftPagePrtArea.Top() + 4), Size(aLeftPagePrtArea.Left() - 4, 2));
1806     Rectangle aRightMark(Point(aRightPagePrtArea.Right() + 2, aRightPagePrtArea.Bottom() - 6), Size(aLeftPagePrtArea.Left() - 4, 2));
1807 
1808     switch (nMarkPos)
1809     {
1810         case 1:     // Links
1811             aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top()));
1812             break;
1813 
1814         case 2:     // Rechts
1815             aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top()));
1816             break;
1817 
1818         case 3:     // Aussen
1819             break;
1820 
1821         case 4:     // Innen
1822             aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top()));
1823             aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top()));
1824             break;
1825 
1826         case 0:     // Keine
1827         default:
1828             return;
1829     }
1830     DrawRect( aLeftMark, m_aMarkCol, m_aTransCol );
1831     DrawRect( aRightMark, m_aMarkCol, m_aTransCol );
1832 }
1833 
1834 void SwMarkPreview::PaintPage(const Rectangle &rRect)
1835 {
1836     // PrintArea zeichnen
1837     DrawRect(rRect, m_aTransCol, m_aPrintAreaCol );
1838 
1839     // Testabsatz zeichnen
1840     sal_uLong nLTxtBorder = 4;
1841     sal_uLong nRTxtBorder = 4;
1842     sal_uLong nTTxtBorder = 4;
1843 
1844     Rectangle aTextLine = rRect;
1845     aTextLine.SetSize(Size(aTextLine.GetWidth(), 2));
1846     aTextLine.Left()    += nLTxtBorder;
1847     aTextLine.Right()   -= nRTxtBorder;
1848     aTextLine.Move(0, nTTxtBorder);
1849 
1850     sal_Int32 nStep;
1851     sal_uInt16 nLines;
1852 
1853     nStep = aTextLine.GetHeight() + 2;
1854     nLines = (sal_uInt16)(rRect.GetHeight() / (aTextLine.GetHeight() + 2)) - 1;
1855 
1856     // Text simulieren
1857     //
1858     for (sal_uInt16 i = 0; i < nLines; ++i)
1859     {
1860         if (i == (nLines - 1))
1861             aTextLine.SetSize(Size(aTextLine.GetWidth() / 2, aTextLine.GetHeight()));
1862 
1863         if (aPage.IsInside(aTextLine))
1864             DrawRect(aTextLine, m_aTxtCol, m_aTransCol );
1865 
1866         aTextLine.Move(0, nStep);
1867     }
1868     aTextLine.Move(0, -nStep);
1869 }
1870 
1871 void SwMarkPreview::DrawRect(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor)
1872 {
1873     SetFillColor(rFillColor);
1874     SetLineColor(rLineColor);
1875     Window::DrawRect(rRect);
1876 }
1877 
1878 namespace
1879 {
1880     void lcl_FillRedlineAttrListBox(
1881             ListBox& rLB, const AuthorCharAttr& rAttrToSelect,
1882             const sal_uInt16* pAttrMap, const sal_uInt16 nAttrMapSize)
1883     {
1884         for (sal_uInt16 i = 0; i != nAttrMapSize; ++i)
1885         {
1886             CharAttr& rAttr(aRedlineAttr[pAttrMap[i]]);
1887             rLB.SetEntryData(i, &rAttr);
1888             if (rAttr.nItemId == rAttrToSelect.nItemId &&
1889                 rAttr.nAttr == rAttrToSelect.nAttr)
1890                 rLB.SelectEntryPos(i);
1891         }
1892     }
1893 }
1894 
1895 SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent,
1896                                                     const SfxItemSet& rSet )
1897     : SfxTabPage(pParent, SW_RES(TP_REDLINE_OPT), rSet),
1898 
1899     aInsertFL(          this, SW_RES( FL_TE )),
1900 
1901     aInsertFT(          this, SW_RES( FT_CHG_INSERT     )),
1902     aInsertAttrFT(          this, SW_RES( FT_INS_ATTR     )),
1903     aInsertLB(          this, SW_RES( LB_INS_ATTR     )),
1904     aInsertColorFT(     this, SW_RES( FT_INS_COL      )),
1905     aInsertColorLB(     this, SW_RES( LB_INS_COL      )),
1906     aInsertedPreviewWN( this, SW_RES( WIN_INS         )),
1907 
1908     aDeletedFT(         this, SW_RES( FT_CHG_DELETE     )),
1909     aDeletedAttrFT(         this, SW_RES( FT_DEL_ATTR     )),
1910     aDeletedLB(         this, SW_RES( LB_DEL_ATTR     )),
1911     aDeletedColorFT(    this, SW_RES( FT_DEL_COL      )),
1912     aDeletedColorLB(    this, SW_RES( LB_DEL_COL      )),
1913     aDeletedPreviewWN(  this, SW_RES( WIN_DEL         )),
1914 
1915     aChangedFT(         this, SW_RES( FT_CHG_CHANGE     )),
1916     aChangedAttrFT(         this, SW_RES( FT_CHG_ATTR     )),
1917     aChangedLB(         this, SW_RES( LB_CHG_ATTR     )),
1918     aChangedColorFT(    this, SW_RES( FT_CHG_COL      )),
1919     aChangedColorLB(    this, SW_RES( LB_CHG_COL      )),
1920     aChangedPreviewWN(  this, SW_RES( WIN_CHG         )),
1921 
1922     aChangedFL          ( this, SW_RES( FL_LC )),
1923 
1924     aMarkPosFT          ( this, SW_RES( FT_MARKPOS )),
1925     aMarkPosLB          ( this, SW_RES( LB_MARKPOS )),
1926     aMarkColorFT        ( this, SW_RES( FT_LC_COL )),
1927     aMarkColorLB        ( this, SW_RES( LB_LC_COL )),
1928     aMarkPreviewWN      ( this, SW_RES( WIN_MARK )),
1929 
1930     sAuthor             ( SW_RES( STR_AUTHOR )),
1931     sNone               ( SW_RES( STR_NOTHING ))
1932 
1933 {
1934     FreeResource();
1935 
1936     for(sal_uInt16 i = 0; i < aInsertLB.GetEntryCount(); i++)
1937     {
1938         String sEntry(aInsertLB.GetEntry(i));
1939         aDeletedLB.InsertEntry(sEntry);
1940         aChangedLB.InsertEntry(sEntry);
1941     };
1942 
1943     // remove strikethrough from insert and change and underline + double
1944     // underline from delete
1945     aInsertLB.RemoveEntry(5);
1946     aChangedLB.RemoveEntry(5);
1947     aDeletedLB.RemoveEntry(4);
1948     aDeletedLB.RemoveEntry(3);
1949 
1950     Link aLk = LINK(this, SwRedlineOptionsTabPage, AttribHdl);
1951     aInsertLB.SetSelectHdl( aLk );
1952     aDeletedLB.SetSelectHdl( aLk );
1953     aChangedLB.SetSelectHdl( aLk );
1954 
1955     aLk = LINK(this, SwRedlineOptionsTabPage, ColorHdl);
1956     aInsertColorLB.SetSelectHdl( aLk );
1957     aDeletedColorLB.SetSelectHdl( aLk );
1958     aChangedColorLB.SetSelectHdl( aLk );
1959 
1960     aLk = LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl);
1961     aMarkPosLB.SetSelectHdl( aLk );
1962     aMarkColorLB.SetSelectHdl( aLk );
1963 //IAccessibility2 Impplementaton 2009-----
1964     //solution: set different accessible name of four color box
1965     aInsertColorLB.SetAccessibleName(::rtl::OUString( aInsertFT.GetDisplayText()) + ::rtl::OUString(aInsertColorFT.GetDisplayText()));
1966     aDeletedColorLB.SetAccessibleName(::rtl::OUString( aDeletedFT.GetDisplayText()) + ::rtl::OUString( aDeletedColorFT.GetDisplayText()));
1967     aChangedColorLB.SetAccessibleName(::rtl::OUString( aChangedFT.GetDisplayText()) + ::rtl::OUString( aChangedColorFT.GetDisplayText()));
1968     aMarkColorLB.SetAccessibleName(::rtl::OUString( aMarkPosFT.GetDisplayText()) + ::rtl::OUString( aMarkColorFT.GetDisplayText()));
1969 //-----IAccessibility2 Impplementaton 2009
1970 }
1971 
1972 SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage()
1973 {
1974 }
1975 
1976 SfxTabPage* SwRedlineOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet)
1977 {
1978     return new SwRedlineOptionsTabPage( pParent, rSet );
1979 }
1980 
1981 sal_Bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet& )
1982 {
1983     CharAttr *pAttr;
1984     SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
1985 
1986     AuthorCharAttr aInsertedAttr;
1987     AuthorCharAttr aDeletedAttr;
1988     AuthorCharAttr aChangedAttr;
1989 
1990     AuthorCharAttr aOldInsertAttr(pOpt->GetInsertAuthorAttr());
1991     AuthorCharAttr aOldDeletedAttr(pOpt->GetDeletedAuthorAttr());
1992     AuthorCharAttr aOldChangedAttr(pOpt->GetFormatAuthorAttr());
1993 
1994     ColorData nOldMarkColor = pOpt->GetMarkAlignColor().GetColor();
1995     sal_uInt16 nOldMarkMode = pOpt->GetMarkAlignMode();
1996 
1997     sal_uInt16 nPos = aInsertLB.GetSelectEntryPos();
1998     if (nPos != LISTBOX_ENTRY_NOTFOUND)
1999     {
2000         pAttr = (CharAttr *)aInsertLB.GetEntryData(nPos);
2001         aInsertedAttr.nItemId = pAttr->nItemId;
2002         aInsertedAttr.nAttr = pAttr->nAttr;
2003 
2004         nPos = aInsertColorLB.GetSelectEntryPos();
2005 
2006         switch (nPos)
2007         {
2008             case 0:
2009                 aInsertedAttr.nColor = COL_NONE;
2010                 break;
2011             case 1:
2012             case LISTBOX_ENTRY_NOTFOUND:
2013                 aInsertedAttr.nColor = COL_TRANSPARENT;
2014                 break;
2015             default:
2016                 aInsertedAttr.nColor = aInsertColorLB.GetEntryColor(nPos).GetColor();
2017                 break;
2018         }
2019 
2020         pOpt->SetInsertAuthorAttr(aInsertedAttr);
2021     }
2022 
2023     nPos = aDeletedLB.GetSelectEntryPos();
2024     if (nPos != LISTBOX_ENTRY_NOTFOUND)
2025     {
2026         pAttr = (CharAttr *)aDeletedLB.GetEntryData(nPos);
2027         aDeletedAttr.nItemId = pAttr->nItemId;
2028         aDeletedAttr.nAttr = pAttr->nAttr;
2029 
2030         nPos = aDeletedColorLB.GetSelectEntryPos();
2031 
2032         switch (nPos)
2033         {
2034             case 0:
2035                 aDeletedAttr.nColor = COL_NONE;
2036                 break;
2037             case 1:
2038             case LISTBOX_ENTRY_NOTFOUND:
2039                 aDeletedAttr.nColor = COL_TRANSPARENT;
2040                 break;
2041             default:
2042                 aDeletedAttr.nColor = aDeletedColorLB.GetEntryColor(nPos).GetColor();
2043                 break;
2044         }
2045 
2046         pOpt->SetDeletedAuthorAttr(aDeletedAttr);
2047     }
2048 
2049     nPos = aChangedLB.GetSelectEntryPos();
2050     if (nPos != LISTBOX_ENTRY_NOTFOUND)
2051     {
2052         pAttr = (CharAttr *)aChangedLB.GetEntryData(nPos);
2053         aChangedAttr.nItemId = pAttr->nItemId;
2054         aChangedAttr.nAttr = pAttr->nAttr;
2055 
2056         nPos = aChangedColorLB.GetSelectEntryPos();
2057 
2058         switch (nPos)
2059         {
2060             case 0:
2061                 aChangedAttr.nColor = COL_NONE;
2062                 break;
2063             case 1:
2064             case LISTBOX_ENTRY_NOTFOUND:
2065                 aChangedAttr.nColor = COL_TRANSPARENT;
2066                 break;
2067             default:
2068                 aChangedAttr.nColor = aChangedColorLB.GetEntryColor(nPos).GetColor();
2069                 break;
2070         }
2071 
2072         pOpt->SetFormatAuthorAttr(aChangedAttr);
2073     }
2074 
2075     nPos = 0;
2076     switch (aMarkPosLB.GetSelectEntryPos())
2077     {
2078         case 0: nPos = text::HoriOrientation::NONE;       break;
2079         case 1: nPos = text::HoriOrientation::LEFT;       break;
2080         case 2: nPos = text::HoriOrientation::RIGHT;      break;
2081         case 3: nPos = text::HoriOrientation::OUTSIDE;    break;
2082         case 4: nPos = text::HoriOrientation::INSIDE;     break;
2083     }
2084     pOpt->SetMarkAlignMode(nPos);
2085 
2086     pOpt->SetMarkAlignColor(aMarkColorLB.GetSelectEntryColor());
2087 
2088     if (!(aInsertedAttr == aOldInsertAttr) ||
2089         !(aDeletedAttr == aOldDeletedAttr) ||
2090         !(aChangedAttr == aOldChangedAttr) ||
2091        nOldMarkColor != pOpt->GetMarkAlignColor().GetColor() ||
2092        nOldMarkMode != pOpt->GetMarkAlignMode())
2093     {
2094         // Alle Dokumente aktualisieren
2095         TypeId aType(TYPE(SwDocShell));
2096         SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
2097 
2098         while( pDocShell )
2099         {
2100             pDocShell->GetWrtShell()->UpdateRedlineAttr();
2101             pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType);
2102         }
2103     }
2104 
2105     return sal_False;
2106 }
2107 
2108 void SwRedlineOptionsTabPage::Reset( const SfxItemSet&  )
2109 {
2110     const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
2111 
2112     const AuthorCharAttr &rInsertAttr = pOpt->GetInsertAuthorAttr();
2113     const AuthorCharAttr &rDeletedAttr = pOpt->GetDeletedAuthorAttr();
2114     const AuthorCharAttr &rChangedAttr = pOpt->GetFormatAuthorAttr();
2115 
2116     // Preview initialisieren
2117     InitFontStyle(aInsertedPreviewWN);
2118     InitFontStyle(aDeletedPreviewWN);
2119     InitFontStyle(aChangedPreviewWN);
2120 
2121     // Farblistboxen initialisieren
2122     String sColor;
2123     aInsertColorLB.SetUpdateMode(sal_False);
2124     aDeletedColorLB.SetUpdateMode(sal_False);
2125     aChangedColorLB.SetUpdateMode(sal_False);
2126     aMarkColorLB.SetUpdateMode(sal_False);
2127 
2128     aInsertColorLB.InsertEntry(sNone);
2129     aDeletedColorLB.InsertEntry(sNone);
2130     aChangedColorLB.InsertEntry(sNone);
2131 
2132     aInsertColorLB.InsertEntry(sAuthor);
2133     aDeletedColorLB.InsertEntry(sAuthor);
2134     aChangedColorLB.InsertEntry(sAuthor);
2135 
2136     XColorTable* pColorTbl = XColorTable::GetStdColorTable();
2137     sal_uInt16 i;
2138     for( i = 0; i < pColorTbl->Count(); ++i )
2139     {
2140         XColorEntry* pEntry = pColorTbl->GetColor( i );
2141         Color aColor = pEntry->GetColor();
2142         String sName = pEntry->GetName();
2143 
2144         aInsertColorLB.InsertEntry( aColor, sName );
2145         aDeletedColorLB.InsertEntry( aColor, sName );
2146         aChangedColorLB.InsertEntry( aColor, sName );
2147         aMarkColorLB.InsertEntry( aColor, sName );
2148     }
2149     aInsertColorLB.SetUpdateMode( sal_True );
2150     aDeletedColorLB.SetUpdateMode( sal_True );
2151     aChangedColorLB.SetUpdateMode( sal_True );
2152     aMarkColorLB.SetUpdateMode( sal_True );
2153 
2154     ColorData nColor = rInsertAttr.nColor;
2155 
2156     switch (nColor)
2157     {
2158         case COL_TRANSPARENT:
2159             aInsertColorLB.SelectEntryPos(1);
2160             break;
2161         case COL_NONE:
2162             aInsertColorLB.SelectEntryPos(0);
2163             break;
2164         default:
2165             aInsertColorLB.SelectEntry(Color(nColor));
2166     }
2167 
2168     nColor = rDeletedAttr.nColor;
2169 
2170     switch (nColor)
2171     {
2172         case COL_TRANSPARENT:
2173             aDeletedColorLB.SelectEntryPos(1);
2174             break;
2175         case COL_NONE:
2176             aDeletedColorLB.SelectEntryPos(0);
2177             break;
2178         default:
2179             aDeletedColorLB.SelectEntry(Color(nColor));
2180     }
2181 
2182     nColor = rChangedAttr.nColor;
2183 
2184     switch (nColor)
2185     {
2186         case COL_TRANSPARENT:
2187             aChangedColorLB.SelectEntryPos(1);
2188             break;
2189         case COL_NONE:
2190             aChangedColorLB.SelectEntryPos(0);
2191             break;
2192         default:
2193             aChangedColorLB.SelectEntry(Color(nColor));
2194     }
2195 
2196     aMarkColorLB.SelectEntry(pOpt->GetMarkAlignColor());
2197 
2198     aInsertLB.SelectEntryPos(0);
2199     aDeletedLB.SelectEntryPos(0);
2200     aChangedLB.SelectEntryPos(0);
2201 
2202     lcl_FillRedlineAttrListBox(aInsertLB, rInsertAttr, aInsertAttrMap,
2203             sizeof(aInsertAttrMap) / sizeof(sal_uInt16));
2204     lcl_FillRedlineAttrListBox(aDeletedLB, rDeletedAttr, aDeletedAttrMap,
2205             sizeof(aDeletedAttrMap) / sizeof(sal_uInt16));
2206     lcl_FillRedlineAttrListBox(aChangedLB, rChangedAttr, aChangedAttrMap,
2207             sizeof(aChangedAttrMap) / sizeof(sal_uInt16));
2208 
2209     sal_uInt16 nPos = 0;
2210     switch (pOpt->GetMarkAlignMode())
2211     {
2212         case text::HoriOrientation::NONE:     nPos = 0;   break;
2213         case text::HoriOrientation::LEFT:     nPos = 1;   break;
2214         case text::HoriOrientation::RIGHT:    nPos = 2;   break;
2215         case text::HoriOrientation::OUTSIDE:  nPos = 3;   break;
2216         case text::HoriOrientation::INSIDE:   nPos = 4;   break;
2217     }
2218     aMarkPosLB.SelectEntryPos(nPos);
2219 
2220     // Einstellungen in Preview anzeigen
2221     AttribHdl(&aInsertLB);
2222     ColorHdl(&aInsertColorLB);
2223     AttribHdl(&aDeletedLB);
2224     ColorHdl(&aInsertColorLB);
2225     AttribHdl(&aChangedLB);
2226     ColorHdl(&aChangedColorLB);
2227 
2228     ChangedMaskPrevHdl();
2229 }
2230 
2231 IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox *, pLB )
2232 {
2233     SvxFontPrevWindow *pPrev = 0;
2234     ColorListBox *pColorLB;
2235 
2236     if (pLB == &aInsertLB)
2237     {
2238         pColorLB = &aInsertColorLB;
2239         pPrev = &aInsertedPreviewWN;
2240     }
2241     else if (pLB == &aDeletedLB)
2242     {
2243         pColorLB = &aDeletedColorLB;
2244         pPrev = &aDeletedPreviewWN;
2245     }
2246     else
2247     {
2248         pColorLB = &aChangedColorLB;
2249         pPrev = &aChangedPreviewWN;
2250     }
2251 
2252     SvxFont&    rFont = pPrev->GetFont();
2253     SvxFont&    rCJKFont = pPrev->GetCJKFont();
2254 
2255     rFont.SetWeight(WEIGHT_NORMAL);
2256     rCJKFont.SetWeight(WEIGHT_NORMAL);
2257     rFont.SetItalic(ITALIC_NONE);
2258     rCJKFont.SetItalic(ITALIC_NONE);
2259     rFont.SetUnderline(UNDERLINE_NONE);
2260     rCJKFont.SetUnderline(UNDERLINE_NONE);
2261     rFont.SetStrikeout(STRIKEOUT_NONE);
2262     rCJKFont.SetStrikeout(STRIKEOUT_NONE);
2263     rFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED);
2264     rCJKFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED);
2265 
2266     sal_uInt16      nPos = pColorLB->GetSelectEntryPos();
2267 
2268     switch( nPos )
2269     {
2270         case 0:
2271             rFont.SetColor( Color( COL_BLACK ) );
2272             rCJKFont.SetColor( Color( COL_BLACK ) );
2273             break;
2274         case 1:
2275         case LISTBOX_ENTRY_NOTFOUND:
2276             rFont.SetColor( Color( COL_RED ) );
2277             rCJKFont.SetColor( Color( COL_RED ) );
2278             break;
2279         default:
2280             rFont.SetColor( pColorLB->GetEntryColor( nPos ) );
2281             rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) );
2282             break;
2283     }
2284 
2285     nPos = pLB->GetSelectEntryPos();
2286     if( nPos == LISTBOX_ENTRY_NOTFOUND )
2287         nPos = 0;
2288 
2289     CharAttr*   pAttr = ( CharAttr* ) pLB->GetEntryData( nPos );
2290     //switch off preview background color
2291     pPrev->ResetColor();
2292     switch (pAttr->nItemId)
2293     {
2294         case SID_ATTR_CHAR_WEIGHT:
2295             rFont.SetWeight( ( FontWeight ) pAttr->nAttr );
2296             rCJKFont.SetWeight( ( FontWeight ) pAttr->nAttr );
2297             break;
2298 
2299         case SID_ATTR_CHAR_POSTURE:
2300             rFont.SetItalic( ( FontItalic ) pAttr->nAttr );
2301             rCJKFont.SetItalic( ( FontItalic ) pAttr->nAttr );
2302             break;
2303 
2304         case SID_ATTR_CHAR_UNDERLINE:
2305             rFont.SetUnderline( ( FontUnderline ) pAttr->nAttr );
2306             rCJKFont.SetUnderline( ( FontUnderline ) pAttr->nAttr );
2307             break;
2308 
2309         case SID_ATTR_CHAR_STRIKEOUT:
2310             rFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr );
2311             rCJKFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr );
2312             break;
2313 
2314         case SID_ATTR_CHAR_CASEMAP:
2315             rFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr );
2316             rCJKFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr );
2317             break;
2318 
2319         case SID_ATTR_BRUSH:
2320         {
2321             nPos = pColorLB->GetSelectEntryPos();
2322             if( nPos )
2323                 pPrev->SetColor( pColorLB->GetSelectEntryColor() );
2324             else
2325                 pPrev->SetColor( Color( COL_LIGHTGRAY ) );
2326 
2327             rFont.SetColor( Color( COL_BLACK ) );
2328             rCJKFont.SetColor( Color( COL_BLACK ) );
2329         }
2330         break;
2331     }
2332 
2333     pPrev->Invalidate();
2334 
2335     return 0;
2336 }
2337 
2338 IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, ColorListBox *, pColorLB )
2339 {
2340     SvxFontPrevWindow *pPrev = 0;
2341     ListBox* pLB;
2342 
2343     if (pColorLB == &aInsertColorLB)
2344     {
2345         pLB = &aInsertLB;
2346         pPrev = &aInsertedPreviewWN;
2347     }
2348     else if (pColorLB == &aDeletedColorLB)
2349     {
2350         pLB = &aDeletedLB;
2351         pPrev = &aDeletedPreviewWN;
2352     }
2353     else
2354     {
2355         pLB = &aChangedLB;
2356         pPrev = &aChangedPreviewWN;
2357     }
2358 
2359     SvxFont&    rFont = pPrev->GetFont();
2360     SvxFont&    rCJKFont = pPrev->GetCJKFont();
2361     sal_uInt16      nPos = pLB->GetSelectEntryPos();
2362     if( nPos == LISTBOX_ENTRY_NOTFOUND )
2363         nPos = 0;
2364 
2365     CharAttr*   pAttr = ( CharAttr* ) pLB->GetEntryData( nPos );
2366 
2367     if( pAttr->nItemId == SID_ATTR_BRUSH )
2368     {
2369         rFont.SetColor( Color( COL_BLACK ) );
2370         rCJKFont.SetColor( Color( COL_BLACK ) );
2371         nPos = pColorLB->GetSelectEntryPos();
2372         if( nPos && nPos != LISTBOX_ENTRY_NOTFOUND )
2373             pPrev->SetColor( pColorLB->GetSelectEntryColor() );
2374         else
2375             pPrev->SetColor( Color( COL_LIGHTGRAY ) );
2376     }
2377     else
2378     {
2379         nPos = pColorLB->GetSelectEntryPos();
2380 
2381         switch( nPos )
2382         {
2383             case 0:
2384                 rFont.SetColor( Color( COL_BLACK ) );
2385                 rCJKFont.SetColor( Color( COL_BLACK ) );
2386                 break;
2387             case 1:
2388             case LISTBOX_ENTRY_NOTFOUND:
2389                 rFont.SetColor( Color( COL_RED ) );
2390                 rCJKFont.SetColor( Color( COL_RED ) );
2391                 break;
2392             default:
2393                 rFont.SetColor( pColorLB->GetEntryColor( nPos ) );
2394                 rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) );
2395                 break;
2396         }
2397     }
2398 
2399     pPrev->Invalidate();
2400 
2401     return 0;
2402 }
2403 
2404 IMPL_LINK( SwRedlineOptionsTabPage, ChangedMaskPrevHdl, ListBox *, EMPTYARG )
2405 {
2406     aMarkPreviewWN.SetMarkPos(aMarkPosLB.GetSelectEntryPos());
2407     aMarkPreviewWN.SetColor(aMarkColorLB.GetSelectEntryColor().GetColor());
2408 
2409     aMarkPreviewWN.Invalidate();
2410 
2411     return 0;
2412 }
2413 
2414 void SwRedlineOptionsTabPage::InitFontStyle(SvxFontPrevWindow& rExampleWin)
2415 {
2416     const AllSettings&  rAllSettings = Application::GetSettings();
2417     LanguageType        eLangType = rAllSettings.GetUILanguage();
2418     Color               aBackCol( rAllSettings.GetStyleSettings().GetWindowColor() );
2419     SvxFont&            rFont = rExampleWin.GetFont();
2420     SvxFont&            rCJKFont = rExampleWin.GetCJKFont();
2421     SvxFont&            rCTLFont = rExampleWin.GetCTLFont();
2422 
2423     Font                aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, eLangType,
2424                                                         DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
2425     Font                aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT, eLangType,
2426                                                         DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
2427     Font                aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_TEXT, eLangType,
2428                                                         DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
2429     const Size          aDefSize( 0, 12 );
2430     aFont.SetSize( aDefSize );
2431     aCJKFont.SetSize( aDefSize );
2432     aCTLFont.SetSize( aDefSize );
2433 
2434     aFont.SetFillColor( aBackCol );
2435     aCJKFont.SetFillColor( aBackCol );
2436     aCTLFont.SetFillColor( aBackCol );
2437 
2438     aFont.SetWeight( WEIGHT_NORMAL );
2439     aCJKFont.SetWeight( WEIGHT_NORMAL );
2440     aCTLFont.SetWeight( WEIGHT_NORMAL );
2441 
2442     rFont = aFont;
2443     rCJKFont = aCJKFont;
2444     rCTLFont = aCTLFont;
2445 
2446     const Size          aNewSize( 0, rExampleWin.GetOutputSize().Height() * 2 / 3 );
2447     rFont.SetSize( aNewSize );
2448     rCJKFont.SetSize( aNewSize );
2449 
2450     rExampleWin.SetFont( rFont, rCJKFont,rCTLFont );
2451 
2452     rExampleWin.UseResourceText();
2453 
2454     Wallpaper           aWall( aBackCol );
2455     rExampleWin.SetBackground( aWall );
2456     rExampleWin.Invalidate();
2457 }
2458 
2459 
2460 #ifdef DBG_UTIL
2461 /*******************************************************
2462  ******************************************************/
2463 /*----------------- OS 11.01.95  -----------------------
2464  TabPage Testeinstellungen
2465 -------------------------------------------------------*/
2466 
2467 void lcl_SetPosSize(Window& rWin, Point aPos, Size aSize)
2468 {
2469     aPos = rWin.LogicToPixel(aPos, MAP_APPFONT);
2470     aSize = rWin.OutputDevice::LogicToPixel(aSize, MAP_APPFONT);
2471     rWin.SetPosSizePixel(aPos, aSize);
2472 }
2473 
2474 SwTestTabPage::SwTestTabPage( Window* pParent,
2475                                       const SfxItemSet& rCoreSet) :
2476     SfxTabPage( pParent, WB_HIDE, rCoreSet),
2477     aTestFL        ( this, WB_GROUP ),
2478     aTest1CBox      ( this, 0 ),
2479     aTest2CBox      ( this, 0 ),
2480     aTest3CBox      ( this, 0 ),
2481     aTest4CBox      ( this, 0 ),
2482     aTest5CBox      ( this, 0 ),
2483     aTest6CBox      ( this, 0 ),
2484     aTest7CBox      ( this, 0 ),
2485     aTest8CBox      ( this, 0 ),
2486     aTest9CBox      ( this, 0 ),
2487     aTest10CBox     ( this, 0 ),
2488     bAttrModified( sal_False )
2489 {
2490     lcl_SetPosSize(*this,       Point(0,0), Size(260 , 135));
2491     lcl_SetPosSize(aTestFL,   Point(6,2), Size(209,8));
2492     lcl_SetPosSize(aTest1CBox  ,    Point(12 , 14), Size(74 , 10));
2493     lcl_SetPosSize(aTest2CBox  ,    Point(12 , 27), Size(74 , 10));
2494     lcl_SetPosSize(aTest3CBox  ,    Point(12 , 40), Size(74 , 10));
2495     lcl_SetPosSize(aTest4CBox  ,    Point(12 , 53), Size(74 , 10));
2496     lcl_SetPosSize(aTest5CBox  ,    Point(12 , 66), Size(74 , 10));
2497     lcl_SetPosSize(aTest6CBox  ,    Point(116, 14), Size(74 , 10));
2498     lcl_SetPosSize(aTest7CBox  ,    Point(116, 27), Size(74 , 10));
2499     lcl_SetPosSize(aTest8CBox  ,    Point(116, 40), Size(74 , 10));
2500     lcl_SetPosSize(aTest9CBox  ,    Point(116, 53), Size(74 , 10));
2501     lcl_SetPosSize(aTest10CBox  ,   Point(116, 66), Size(74 , 10));
2502 
2503     aTestFL.SetText( String(ByteString("Einstellungen nur f\xFCr Testzwecke" ), RTL_TEXTENCODING_MS_1252));
2504     aTest1CBox .SetText( C2S("unused"));
2505     aTest2CBox .SetText( C2S("dynamic"));
2506     aTest3CBox .SetText( C2S("No calm"               ));
2507     aTest4CBox .SetText( C2S("WYSIWYG debug"         ));
2508     aTest5CBox .SetText( C2S("No idle format"        ));
2509     aTest6CBox .SetText( C2S("No screen adj"         ));
2510     aTest7CBox .SetText( C2S("win format"            ));
2511     aTest8CBox .SetText( C2S("No Scroll"             ));
2512     aTest9CBox .SetText( C2S("DrawingLayerNotLoading"));
2513     aTest10CBox.SetText( C2S("AutoFormat by Input"   ));
2514     aTestFL.Show();
2515     aTest1CBox .Show();
2516     aTest2CBox .Show();
2517     aTest3CBox .Show();
2518     aTest4CBox .Show();
2519     aTest5CBox .Show();
2520     aTest6CBox .Show();
2521     aTest7CBox .Show();
2522     aTest8CBox .Show();
2523     aTest9CBox .Show();
2524     aTest10CBox.Show();
2525     Init();
2526 
2527 }
2528 
2529 
2530 //------------------------------------------------------------------------
2531 
2532 
2533 SfxTabPage* SwTestTabPage::Create( Window* pParent,
2534                                        const SfxItemSet& rAttrSet )
2535 {
2536     return ( new SwTestTabPage( pParent, rAttrSet ) );
2537 }
2538 //------------------------------------------------------------------------
2539 
2540 
2541 sal_Bool    SwTestTabPage::FillItemSet( SfxItemSet& rCoreSet )
2542 {
2543 
2544     if ( bAttrModified )
2545     {
2546         SwTestItem aTestItem(FN_PARAM_SWTEST);
2547             aTestItem.bTest1=aTest1CBox.IsChecked();
2548             aTestItem.bTest2=aTest2CBox.IsChecked();
2549             aTestItem.bTest3=aTest3CBox.IsChecked();
2550             aTestItem.bTest4=aTest4CBox.IsChecked();
2551             aTestItem.bTest5=aTest5CBox.IsChecked();
2552             aTestItem.bTest6=aTest6CBox.IsChecked();
2553             aTestItem.bTest7=aTest7CBox.IsChecked();
2554             aTestItem.bTest8=aTest8CBox.IsChecked();
2555             aTestItem.bTest9=aTest9CBox.IsChecked();
2556             aTestItem.bTest10=aTest10CBox.IsChecked();
2557         rCoreSet.Put(aTestItem);
2558     }
2559     return bAttrModified;
2560 }
2561 //------------------------------------------------------------------------
2562 
2563 
2564 void SwTestTabPage::Reset( const SfxItemSet& )
2565 {
2566     const SfxItemSet& rSet = GetItemSet();
2567     const SwTestItem* pTestAttr = 0;
2568 
2569     if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SWTEST , sal_False,
2570                                     (const SfxPoolItem**)&pTestAttr ))
2571     {
2572         aTest1CBox.Check(pTestAttr->bTest1);
2573         aTest2CBox.Check(pTestAttr->bTest2);
2574         aTest3CBox.Check(pTestAttr->bTest3);
2575         aTest4CBox.Check(pTestAttr->bTest4);
2576         aTest5CBox.Check(pTestAttr->bTest5);
2577         aTest6CBox.Check(pTestAttr->bTest6);
2578         aTest7CBox.Check(pTestAttr->bTest7);
2579         aTest8CBox.Check(pTestAttr->bTest8);
2580         aTest9CBox.Check(pTestAttr->bTest9);
2581         aTest10CBox.Check(pTestAttr->bTest10);
2582     }
2583 }
2584 //------------------------------------------------------------------------
2585 
2586 
2587 void SwTestTabPage::Init()
2588 {
2589     // handler
2590     Link aLk = LINK( this, SwTestTabPage, AutoClickHdl );
2591     aTest1CBox.SetClickHdl( aLk );
2592     aTest2CBox.SetClickHdl( aLk );
2593     aTest3CBox.SetClickHdl( aLk );
2594     aTest4CBox.SetClickHdl( aLk );
2595     aTest5CBox.SetClickHdl( aLk );
2596     aTest6CBox.SetClickHdl( aLk );
2597     aTest7CBox.SetClickHdl( aLk );
2598     aTest8CBox.SetClickHdl( aLk );
2599     aTest9CBox.SetClickHdl( aLk );
2600     aTest10CBox.SetClickHdl( aLk );
2601 }
2602 //------------------------------------------------------------------------
2603 
2604 
2605 IMPL_LINK_INLINE_START( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
2606 {
2607     bAttrModified = sal_True;
2608     return 0;
2609 }
2610 IMPL_LINK_INLINE_END( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
2611 #endif
2612 
2613 
2614