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