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