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 // MARKER(update_precomp.py): autogen include statement, do not remove 23 #include "precompiled_sw.hxx" 24 25 #include "cmdid.h" 26 #include "hintids.hxx" 27 #include <algorithm> 28 #include <svl/eitem.hxx> 29 #include <editeng/lrspitem.hxx> 30 #include <editeng/ulspitem.hxx> 31 #include <editeng/sizeitem.hxx> 32 #include <svx/pageitem.hxx> 33 #include <editeng/brshitem.hxx> 34 #include <editeng/frmdiritem.hxx> 35 #include <vcl/bitmap.hxx> 36 #include <vcl/graph.hxx> 37 #include <tgrditem.hxx> 38 #include <viewopt.hxx> 39 #include "colex.hxx" 40 #include "colmgr.hxx" 41 42 //UUUU 43 #include <svx/unobrushitemhelper.hxx> 44 45 /*----------------------------------------------------------------------- 46 Beschreibung: Uebernahme der aktualisierten Werte aus dem Set 47 -----------------------------------------------------------------------*/ 48 void SwPageExample::UpdateExample( const SfxItemSet& rSet ) 49 { 50 const SvxPageItem* pPage = 0; 51 SfxItemPool* pPool = rSet.GetPool(); 52 sal_uInt16 nWhich = pPool->GetWhich( SID_ATTR_PAGE ); 53 54 if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) 55 { 56 // Ausrichtung 57 pPage = (const SvxPageItem*)&rSet.Get( nWhich ); 58 59 if ( pPage ) 60 SetUsage( pPage->GetPageUsage() ); 61 } 62 63 nWhich = pPool->GetWhich( SID_ATTR_PAGE_SIZE ); 64 65 if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) 66 { 67 // Orientation und Size aus dem PageItem 68 const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( nWhich ); 69 SetSize( rSize.GetSize() ); 70 } 71 nWhich = RES_LR_SPACE; 72 if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) 73 { 74 // linken und rechten Rand einstellen 75 const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get( nWhich ); 76 77 SetLeft( rLRSpace.GetLeft() ); 78 SetRight( rLRSpace.GetRight() ); 79 } 80 else 81 { 82 SetLeft( 0 ); 83 SetRight( 0 ); 84 } 85 86 nWhich = RES_UL_SPACE; 87 88 if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) 89 { 90 // oberen und unteren Rand einstellen 91 const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get( nWhich ); 92 93 SetTop( rULSpace.GetUpper() ); 94 SetBottom( rULSpace.GetLower() ); 95 } 96 else 97 { 98 SetTop( 0 ); 99 SetBottom( 0 ); 100 } 101 102 103 // Kopfzeilen-Attribute auswerten 104 const SfxPoolItem* pItem; 105 if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_HEADERSET), 106 sal_False, &pItem ) ) 107 { 108 const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet(); 109 const SfxBoolItem& rHeaderOn = 110 (const SfxBoolItem&)rHeaderSet.Get( pPool->GetWhich( SID_ATTR_PAGE_ON ) ); 111 112 if ( rHeaderOn.GetValue() ) 113 { 114 const SvxSizeItem& rSize = 115 (const SvxSizeItem&)rHeaderSet.Get(pPool->GetWhich(SID_ATTR_PAGE_SIZE)); 116 117 const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rHeaderSet.Get( 118 pPool->GetWhich(SID_ATTR_ULSPACE)); 119 const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rHeaderSet.Get( 120 pPool->GetWhich(SID_ATTR_LRSPACE)); 121 122 SetHdHeight( rSize.GetSize().Height() - rUL.GetLower()); 123 SetHdDist( rUL.GetLower() ); 124 SetHdLeft( rLR.GetLeft() ); 125 SetHdRight( rLR.GetRight() ); 126 SetHeader( sal_True ); 127 128 if(SFX_ITEM_SET == rHeaderSet.GetItemState(RES_BACKGROUND)) 129 { 130 //UUUU create FillAttributes from SvxBrushItem //SetHdColor(rItem.GetColor()); 131 const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(RES_BACKGROUND)); 132 SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 133 134 setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 135 setHeaderFillAttributes( 136 drawinglayer::attribute::SdrAllFillAttributesHelperPtr( 137 new drawinglayer::attribute::SdrAllFillAttributesHelper( 138 aTempSet))); 139 } 140 141 if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) 142 { 143 const SvxBoxItem& rItem = 144 (const SvxBoxItem&)rHeaderSet.Get( RES_BOX ); 145 SetHdBorder( rItem ); 146 } 147 } 148 else 149 SetHeader( sal_False ); 150 } 151 152 if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_FOOTERSET), 153 sal_False, &pItem ) ) 154 { 155 const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet(); 156 const SfxBoolItem& rFooterOn = 157 (const SfxBoolItem&)rFooterSet.Get( SID_ATTR_PAGE_ON ); 158 159 if ( rFooterOn.GetValue() ) 160 { 161 const SvxSizeItem& rSize = 162 (const SvxSizeItem&)rFooterSet.Get( pPool->GetWhich( SID_ATTR_PAGE_SIZE ) ); 163 164 const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rFooterSet.Get( 165 pPool->GetWhich( SID_ATTR_ULSPACE ) ); 166 const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rFooterSet.Get( 167 pPool->GetWhich( SID_ATTR_LRSPACE ) ); 168 169 SetFtHeight( rSize.GetSize().Height() - rUL.GetUpper()); 170 SetFtDist( rUL.GetUpper() ); 171 SetFtLeft( rLR.GetLeft() ); 172 SetFtRight( rLR.GetRight() ); 173 SetFooter( sal_True ); 174 175 if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) 176 { 177 //UUUU create FillAttributes from SvxBrushItem //SetFtColor(rItem.GetColor()); 178 const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rFooterSet.Get(RES_BACKGROUND)); 179 SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 180 181 setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 182 setFooterFillAttributes( 183 drawinglayer::attribute::SdrAllFillAttributesHelperPtr( 184 new drawinglayer::attribute::SdrAllFillAttributesHelper( 185 aTempSet))); 186 } 187 188 if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) 189 { 190 const SvxBoxItem& rItem = 191 (const SvxBoxItem&)rFooterSet.Get( RES_BOX ); 192 SetFtBorder( rItem ); 193 } 194 } 195 else 196 SetFooter( sal_False ); 197 } 198 199 if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, sal_False, &pItem)) 200 { 201 //UUUU create FillAttributes from SvxBrushItem 202 const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); 203 SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); 204 205 setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); 206 setPageFillAttributes( 207 drawinglayer::attribute::SdrAllFillAttributesHelperPtr( 208 new drawinglayer::attribute::SdrAllFillAttributesHelper( 209 aTempSet))); 210 } 211 212 Invalidate(); 213 } 214 /*----------------------------------------------------------------------- 215 Beschreibung: 216 -----------------------------------------------------------------------*/ 217 218 219 void SwColExample::DrawPage( const Point& rOrg, 220 const sal_Bool bSecond, 221 const sal_Bool bEnabled ) 222 { 223 SwPageExample::DrawPage( rOrg, bSecond, bEnabled ); 224 sal_uInt16 nColumnCount; 225 if( pColMgr && 0 != (nColumnCount = pColMgr->GetCount())) 226 { 227 long nL = GetLeft(); 228 long nR = GetRight(); 229 230 if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) 231 { 232 // fuer gespiegelt drehen 233 nL = GetRight(); 234 nR = GetLeft(); 235 } 236 237 SetFillColor( Color( COL_LIGHTGRAY ) ); 238 Rectangle aRect; 239 aRect.Right() = rOrg.X() + GetSize().Width() - nR; 240 aRect.Left() = rOrg.X() + nL; 241 aRect.Top() = rOrg.Y() + GetTop() 242 + GetHdHeight() + GetHdDist(); 243 aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() 244 - GetFtHeight() - GetFtDist(); 245 DrawRect(aRect); 246 247 //UUUU 248 const Rectangle aDefineRect(aRect); 249 250 //UUUU 251 const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes(); 252 253 if(!rFillAttributes.get() || !rFillAttributes->isUsed()) 254 { 255 //UUUU If there is no fill, use fallback color 256 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 257 const Color& rFieldColor = rStyleSettings.GetFieldColor(); 258 259 setPageFillAttributes( 260 drawinglayer::attribute::SdrAllFillAttributesHelperPtr( 261 new drawinglayer::attribute::SdrAllFillAttributesHelper( 262 rFieldColor))); 263 } 264 265 // #97495# make sure that the automatic column widht's are always equal 266 sal_Bool bAutoWidth = pColMgr->IsAutoWidth(); 267 sal_Int32 nAutoColWidth = 0; 268 if(bAutoWidth) 269 { 270 sal_Int32 nColumnWidthSum = 0; 271 sal_uInt16 i; 272 for(i = 0; i < nColumnCount; ++i) 273 nColumnWidthSum += pColMgr->GetColWidth( i ); 274 nAutoColWidth = nColumnWidthSum / nColumnCount; 275 } 276 277 sal_uInt16 i; 278 for( i = 0; i < nColumnCount; i++) 279 { 280 if(!bAutoWidth) 281 nAutoColWidth = pColMgr->GetColWidth( i ); 282 aRect.Right() = aRect.Left() + nAutoColWidth; 283 284 //UUUU use primitive draw command 285 drawFillAttributes(getPageFillAttributes(), aRect, aDefineRect); 286 287 if(i < nColumnCount - 1) 288 aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i); 289 } 290 if(pColMgr->HasLine()) 291 { 292 Point aUp( rOrg.X() + nL, rOrg.Y() + GetTop() ); 293 Point aDown( rOrg.X() + nL, rOrg.Y() + GetSize().Height() 294 - GetBottom() - GetFtHeight() - GetFtDist() ); 295 296 if( pColMgr->GetLineHeightPercent() != 100 ) 297 { 298 long nLength = aDown.Y() - aUp.Y(); 299 nLength -= nLength * pColMgr->GetLineHeightPercent() / 100; 300 switch(pColMgr->GetAdjust()) 301 { 302 case COLADJ_BOTTOM: aUp.Y() += nLength; break; 303 case COLADJ_TOP: aDown.Y() -= nLength; break; 304 case COLADJ_CENTER: 305 aUp.Y() += nLength / 2; 306 aDown.Y() -= nLength / 2; 307 break; 308 default:; // prevent warning 309 } 310 } 311 312 int nDist; 313 for( i = 0; i < nColumnCount - 1; i++) 314 { 315 int nGutter = pColMgr->GetGutterWidth(i); 316 nDist = pColMgr->GetColWidth( i ) + nGutter; 317 nDist -= (i == 0) ? 318 nGutter/2 : 319 0; 320 aUp.X() += nDist; 321 aDown.X() += nDist; 322 DrawLine( aUp, aDown ); 323 324 } 325 } 326 } 327 } 328 329 /*-----------------25.10.96 09.15------------------- 330 331 --------------------------------------------------*/ 332 333 334 SwColumnOnlyExample::SwColumnOnlyExample( Window* pParent, const ResId& rResId) : 335 Window(pParent, rResId), 336 m_aFrmSize(1,1) 337 { 338 SetMapMode( MapMode( MAP_TWIP ) ); 339 m_aWinSize = GetOutputSizePixel(); 340 m_aWinSize.Height() -= 4; 341 m_aWinSize.Width() -= 4; 342 343 m_aWinSize = PixelToLogic( m_aWinSize ); 344 345 SetBorderStyle( WINDOW_BORDER_MONO ); 346 347 m_aFrmSize = SvxPaperInfo::GetPaperSize(PAPER_A4);// DIN A4 348 ::FitToActualSize(m_aCols, (sal_uInt16)m_aFrmSize.Width()); 349 350 long nHeight = m_aFrmSize.Height(); 351 Fraction aScale( m_aWinSize.Height(), nHeight ); 352 MapMode aMapMode( GetMapMode() ); 353 aMapMode.SetScaleX( aScale ); 354 aMapMode.SetScaleY( aScale ); 355 SetMapMode( aMapMode ); 356 } 357 358 /*-----------------25.10.96 09.16------------------- 359 360 --------------------------------------------------*/ 361 362 363 void SwColumnOnlyExample::Paint( const Rectangle& /*rRect*/ ) 364 { 365 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); 366 const Color& rFieldColor = rStyleSettings.GetFieldColor(); 367 const Color& rDlgColor = rStyleSettings.GetDialogColor(); 368 const Color& rFieldTextColor = SwViewOption::GetFontColor(); 369 Color aGrayColor(COL_LIGHTGRAY); 370 if(rFieldColor == aGrayColor) 371 aGrayColor.Invert(); 372 373 Size aLogSize(PixelToLogic(GetOutputSizePixel())); 374 Rectangle aCompleteRect(Point(0,0), aLogSize); 375 SetLineColor(rDlgColor); 376 SetFillColor(rDlgColor); 377 DrawRect(aCompleteRect); 378 379 SetLineColor( rFieldTextColor ); 380 Point aTL( (aLogSize.Width() - m_aFrmSize.Width()) / 2, 381 (aLogSize.Height() - m_aFrmSize.Height()) / 2); 382 Rectangle aRect(aTL, m_aFrmSize); 383 384 //draw a shadow rectangle 385 SetFillColor( Color(COL_GRAY) ); 386 Rectangle aShadowRect(aRect); 387 aShadowRect.Move(aTL.Y(), aTL.Y()); 388 DrawRect(aShadowRect); 389 390 SetFillColor( rFieldColor ); 391 DrawRect(aRect); 392 393 SetFillColor( aGrayColor ); 394 395 //Spaltentrenner? 396 long nLength = aLogSize.Height() - 2 * aTL.Y(); 397 Point aUp( aTL ); 398 Point aDown( aTL.X(), nLength ); 399 sal_Bool bLines = sal_False; 400 if(m_aCols.GetLineAdj() != COLADJ_NONE) 401 { 402 bLines = sal_True; 403 404 sal_uInt16 nPercent = m_aCols.GetLineHeight(); 405 if( nPercent != 100 ) 406 { 407 nLength -= nLength * nPercent / 100; 408 switch(m_aCols.GetLineAdj()) 409 { 410 case COLADJ_BOTTOM: aUp.Y() += nLength; break; 411 case COLADJ_TOP: aDown.Y() -= nLength; break; 412 case COLADJ_CENTER: 413 aUp.Y() += nLength / 2; 414 aDown.Y() -= nLength / 2; 415 break; 416 default:; //prevent warning 417 } 418 } 419 420 } 421 const SwColumns& rCols = m_aCols.GetColumns(); 422 sal_uInt16 nColCount = rCols.Count(); 423 if( nColCount ) 424 { 425 DrawRect(aRect); 426 SetFillColor( rFieldColor ); 427 Rectangle aFrmRect(aTL, m_aFrmSize); 428 long nSum = aTL.X(); 429 for(sal_uInt16 i = 0; i < nColCount; i++) 430 { 431 SwColumn* pCol = rCols[i]; 432 aFrmRect.Left() = nSum + pCol->GetLeft();//nSum + pCol->GetLeft() + aTL.X(); 433 nSum += pCol->GetWishWidth(); 434 aFrmRect.Right() = nSum - pCol->GetRight(); 435 DrawRect(aFrmRect); 436 } 437 if(bLines ) 438 { 439 nSum = aTL.X(); 440 for(sal_uInt16 i = 0; i < nColCount - 1; i++) 441 { 442 nSum += rCols[i]->GetWishWidth(); 443 aUp.X() = nSum; 444 aDown.X() = nSum; 445 DrawLine(aUp, aDown); 446 } 447 } 448 } 449 } 450 451 /*-----------------25.10.96 12.05------------------- 452 453 --------------------------------------------------*/ 454 455 456 void SwColumnOnlyExample::SetColumns(const SwFmtCol& rCol) 457 { 458 m_aCols = rCol; 459 sal_uInt16 nWishSum = m_aCols.GetWishWidth(); 460 long nFrmWidth = m_aFrmSize.Width(); 461 SwColumns& rCols = m_aCols.GetColumns(); 462 sal_uInt16 nColCount = rCols.Count(); 463 464 for(sal_uInt16 i = 0; i < nColCount; i++) 465 { 466 SwColumn* pCol = rCols[i]; 467 long nWish = pCol->GetWishWidth(); 468 nWish *= nFrmWidth; 469 nWish /= nWishSum; 470 pCol->SetWishWidth((sal_uInt16)nWish); 471 long nLeft = pCol->GetLeft(); 472 nLeft *= nFrmWidth; 473 nLeft /= nWishSum; 474 pCol->SetLeft((sal_uInt16)nLeft); 475 long nRight = pCol->GetRight(); 476 nRight *= nFrmWidth; 477 nRight /= nWishSum; 478 pCol->SetRight((sal_uInt16)nRight); 479 } 480 // #97495# make sure that the automatic column width's are always equal 481 if(nColCount && m_aCols.IsOrtho()) 482 { 483 sal_Int32 nColumnWidthSum = 0; 484 sal_uInt16 i; 485 for(i = 0; i < nColCount; ++i) 486 { 487 SwColumn* pCol = rCols[i]; 488 nColumnWidthSum += pCol->GetWishWidth(); 489 nColumnWidthSum -= (pCol->GetRight() + pCol->GetLeft()); 490 } 491 nColumnWidthSum /= nColCount; 492 for(i = 0; i < nColCount; ++i) 493 { 494 SwColumn* pCol = rCols[i]; 495 pCol->SetWishWidth( static_cast< sal_uInt16 >(nColumnWidthSum + pCol->GetRight() + pCol->GetLeft())); 496 } 497 } 498 } 499 /* -----------------------------08.02.2002 11:44------------------------------ 500 501 ---------------------------------------------------------------------------*/ 502 SwPageGridExample::~SwPageGridExample() 503 { 504 delete pGridItem; 505 } 506 /* -----------------------------08.02.2002 11:48------------------------------ 507 508 ---------------------------------------------------------------------------*/ 509 #define MAX_ROWS 10 510 #define MAX_LINES 15 511 void SwPageGridExample::DrawPage( const Point& rOrg, 512 const sal_Bool bSecond, 513 const sal_Bool bEnabled ) 514 { 515 SwPageExample::DrawPage(rOrg, bSecond, bEnabled); 516 if(pGridItem && pGridItem->GetGridType()) 517 { 518 //paint the grid now 519 Color aLineColor = pGridItem->GetColor(); 520 if(aLineColor.GetColor() == COL_AUTO) 521 { 522 aLineColor = GetFillColor(); 523 aLineColor.Invert(); 524 } 525 SetLineColor(aLineColor); 526 long nL = GetLeft(); 527 long nR = GetRight(); 528 529 if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) 530 { 531 // fuer gespiegelt drehen 532 nL = GetRight(); 533 nR = GetLeft(); 534 } 535 536 Rectangle aRect; 537 aRect.Right() = rOrg.X() + GetSize().Width() - nR; 538 aRect.Left() = rOrg.X() + nL; 539 aRect.Top() = rOrg.Y() + GetTop() 540 + GetHdHeight() + GetHdDist(); 541 aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() 542 - GetFtHeight() - GetFtDist(); 543 544 //increase the values to get a 'viewable' preview 545 sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3; 546 sal_Int32 nRubyHeight = pGridItem->GetRubyHeight() * 3; 547 548 //detect height of rectangles 549 Rectangle aRubyRect(aRect.TopLeft(), 550 m_bVertical ? 551 Size(nRubyHeight, aRect.GetHeight()) : 552 Size(aRect.GetWidth(), nRubyHeight)); 553 Rectangle aCharRect(aRect.TopLeft(), 554 m_bVertical ? 555 Size(nBaseHeight, aRect.GetHeight()) : 556 Size(aRect.GetWidth(), nBaseHeight)); 557 558 sal_Int32 nLineHeight = nBaseHeight + nRubyHeight; 559 560 //detect count of rectangles 561 sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight; 562 if(nLines > pGridItem->GetLines()) 563 nLines = pGridItem->GetLines(); 564 565 // determine start position 566 if(m_bVertical) 567 { 568 sal_Int16 nXStart = static_cast< sal_Int16 >(aRect.GetWidth() / 2 - nLineHeight * nLines /2); 569 aRubyRect.Move(nXStart, 0); 570 aCharRect.Move(nXStart, 0); 571 } 572 else 573 { 574 sal_Int16 nYStart = static_cast< sal_Int16 >(aRect.GetHeight() / 2 - nLineHeight * nLines /2); 575 aRubyRect.Move(0, nYStart); 576 aCharRect.Move(0, nYStart); 577 } 578 579 if(pGridItem->IsRubyTextBelow()) 580 m_bVertical ? aRubyRect.Move(nBaseHeight, 0) : aRubyRect.Move(0, nBaseHeight); 581 else 582 m_bVertical ? aCharRect.Move(nRubyHeight, 0) : aCharRect.Move(0, nRubyHeight); 583 584 //vertical lines 585 sal_Bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS; 586 SetFillColor( Color( COL_TRANSPARENT ) ); 587 sal_Int32 nXMove = m_bVertical ? nLineHeight : 0; 588 sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight; 589 for(sal_Int32 nLine = 0; nLine < nLines; nLine++) 590 { 591 DrawRect(aRubyRect); 592 DrawRect(aCharRect); 593 if(bBothLines) 594 { 595 Point aStart = aCharRect.TopLeft(); 596 Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft(); 597 while(m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right()) 598 { 599 DrawLine(aStart, aEnd); 600 if(m_bVertical) 601 aStart.Y() = aEnd.Y() += nBaseHeight; 602 else 603 aStart.X() = aEnd.X() += nBaseHeight; 604 } 605 } 606 aRubyRect.Move(nXMove, nYMove); 607 aCharRect.Move(nXMove, nYMove); 608 } 609 } 610 } 611 /* -----------------------------08.02.2002 11:48------------------------------ 612 613 ---------------------------------------------------------------------------*/ 614 void SwPageGridExample::UpdateExample( const SfxItemSet& rSet ) 615 { 616 DELETEZ(pGridItem); 617 //get the grid information 618 if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, sal_True)) 619 pGridItem = (SwTextGridItem*)((const SwTextGridItem&)rSet.Get(RES_TEXTGRID)).Clone(); 620 if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( RES_FRAMEDIR, sal_True )) 621 { 622 const SvxFrameDirectionItem& rDirItem = 623 (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR); 624 m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT|| 625 rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT; 626 } 627 SwPageExample::UpdateExample(rSet); 628 } 629 630