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