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