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