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