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