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