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