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_vcl.hxx" 26 27 #include <svids.hrc> 28 #include <svdata.hxx> 29 #include <brdwin.hxx> 30 #include <window.h> 31 32 #include <vcl/event.hxx> 33 #include <vcl/decoview.hxx> 34 #include <vcl/syswin.hxx> 35 #include <vcl/dockwin.hxx> 36 #include <vcl/floatwin.hxx> 37 #include <vcl/bitmap.hxx> 38 #include <vcl/gradient.hxx> 39 #include <vcl/image.hxx> 40 #include <vcl/virdev.hxx> 41 #include <vcl/help.hxx> 42 #include <vcl/edit.hxx> 43 #include <vcl/metric.hxx> 44 45 #include <tools/debug.hxx> 46 47 using namespace ::com::sun::star::uno; 48 49 // useful caption height for title bar buttons 50 #define MIN_CAPTION_HEIGHT 18 51 52 // ======================================================================= 53 54 static void ImplGetPinImage( sal_uInt16 nStyle, sal_Bool bPinIn, Image& rImage ) 55 { 56 // ImageListe laden, wenn noch nicht vorhanden 57 ImplSVData* pSVData = ImplGetSVData(); 58 if ( !pSVData->maCtrlData.mpPinImgList ) 59 { 60 ResMgr* pResMgr = ImplGetResMgr(); 61 pSVData->maCtrlData.mpPinImgList = new ImageList(); 62 if( pResMgr ) 63 { 64 Color aMaskColor( 0x00, 0x00, 0xFF ); 65 pSVData->maCtrlData.mpPinImgList->InsertFromHorizontalBitmap 66 ( ResId( SV_RESID_BITMAP_PIN, *pResMgr ), 4, 67 &aMaskColor, NULL, NULL, 0); 68 } 69 } 70 71 // Image ermitteln und zurueckgeben 72 sal_uInt16 nId; 73 if ( nStyle & BUTTON_DRAW_PRESSED ) 74 { 75 if ( bPinIn ) 76 nId = 4; 77 else 78 nId = 3; 79 } 80 else 81 { 82 if ( bPinIn ) 83 nId = 2; 84 else 85 nId = 1; 86 } 87 rImage = pSVData->maCtrlData.mpPinImgList->GetImage( nId ); 88 } 89 90 // ----------------------------------------------------------------------- 91 92 void Window::ImplCalcSymbolRect( Rectangle& rRect ) 93 { 94 // Den Rand den der Button in der nicht Default-Darstellung freilaesst, 95 // dazuaddieren, da wir diesen bei kleinen Buttons mit ausnutzen wollen 96 rRect.Left()--; 97 rRect.Top()--; 98 rRect.Right()++; 99 rRect.Bottom()++; 100 101 // Zwischen dem Symbol und dem Button-Rand lassen wir 5% Platz 102 long nExtraWidth = ((rRect.GetWidth()*50)+500)/1000; 103 long nExtraHeight = ((rRect.GetHeight()*50)+500)/1000; 104 rRect.Left() += nExtraWidth; 105 rRect.Right() -= nExtraWidth; 106 rRect.Top() += nExtraHeight; 107 rRect.Bottom() -= nExtraHeight; 108 } 109 110 // ----------------------------------------------------------------------- 111 112 static void ImplDrawBrdWinSymbol( OutputDevice* pDev, 113 const Rectangle& rRect, SymbolType eSymbol ) 114 { 115 // Zwischen dem Symbol und dem Button lassen wir 5% Platz 116 DecorationView aDecoView( pDev ); 117 Rectangle aTempRect = rRect; 118 Window::ImplCalcSymbolRect( aTempRect ); 119 aDecoView.DrawSymbol( aTempRect, eSymbol, 120 pDev->GetSettings().GetStyleSettings().GetButtonTextColor(), 0 ); 121 } 122 123 // ----------------------------------------------------------------------- 124 125 static void ImplDrawBrdWinSymbolButton( OutputDevice* pDev, 126 const Rectangle& rRect, 127 SymbolType eSymbol, sal_uInt16 nState ) 128 { 129 sal_Bool bMouseOver = (nState & BUTTON_DRAW_HIGHLIGHT) != 0; 130 nState &= ~BUTTON_DRAW_HIGHLIGHT; 131 132 Rectangle aTempRect; 133 Window *pWin = dynamic_cast< Window* >(pDev); 134 if( pWin ) 135 { 136 if( bMouseOver ) 137 { 138 // provide a bright background for selection effect 139 pWin->SetFillColor( pDev->GetSettings().GetStyleSettings().GetWindowColor() ); 140 pWin->SetLineColor(); 141 pWin->DrawRect( rRect ); 142 pWin->DrawSelectionBackground( rRect, 2, (nState & BUTTON_DRAW_PRESSED) ? sal_True : sal_False, 143 sal_True, sal_False ); 144 } 145 aTempRect = rRect; 146 aTempRect.nLeft+=3; 147 aTempRect.nRight-=4; 148 aTempRect.nTop+=3; 149 aTempRect.nBottom-=4; 150 } 151 else 152 { 153 DecorationView aDecoView( pDev ); 154 aTempRect = aDecoView.DrawButton( rRect, nState|BUTTON_DRAW_FLAT ); 155 } 156 ImplDrawBrdWinSymbol( pDev, aTempRect, eSymbol ); 157 } 158 159 160 // ======================================================================= 161 162 // ------------------------ 163 // - ImplBorderWindowView - 164 // ------------------------ 165 166 ImplBorderWindowView::~ImplBorderWindowView() 167 { 168 } 169 170 // ----------------------------------------------------------------------- 171 172 sal_Bool ImplBorderWindowView::MouseMove( const MouseEvent& ) 173 { 174 return sal_False; 175 } 176 177 // ----------------------------------------------------------------------- 178 179 sal_Bool ImplBorderWindowView::MouseButtonDown( const MouseEvent& ) 180 { 181 return sal_False; 182 } 183 184 // ----------------------------------------------------------------------- 185 186 sal_Bool ImplBorderWindowView::Tracking( const TrackingEvent& ) 187 { 188 return sal_False; 189 } 190 191 // ----------------------------------------------------------------------- 192 193 String ImplBorderWindowView::RequestHelp( const Point&, Rectangle& ) 194 { 195 return String(); 196 } 197 198 // ----------------------------------------------------------------------- 199 200 Rectangle ImplBorderWindowView::GetMenuRect() const 201 { 202 return Rectangle(); 203 } 204 205 // ----------------------------------------------------------------------- 206 207 void ImplBorderWindowView::ImplInitTitle( ImplBorderFrameData* pData ) 208 { 209 ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; 210 211 if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || 212 (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) ) 213 { 214 pData->mnTitleType = BORDERWINDOW_TITLE_NONE; 215 pData->mnTitleHeight = 0; 216 } 217 else 218 { 219 const StyleSettings& rStyleSettings = pData->mpOutDev->GetSettings().GetStyleSettings(); 220 if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF ) 221 pData->mnTitleHeight = rStyleSettings.GetTearOffTitleHeight(); 222 else 223 { 224 if ( pData->mnTitleType == BORDERWINDOW_TITLE_SMALL ) 225 { 226 pBorderWindow->SetPointFont( rStyleSettings.GetFloatTitleFont() ); 227 pData->mnTitleHeight = rStyleSettings.GetFloatTitleHeight(); 228 } 229 else // pData->mnTitleType == BORDERWINDOW_TITLE_NORMAL 230 { 231 pBorderWindow->SetPointFont( rStyleSettings.GetTitleFont() ); 232 pData->mnTitleHeight = rStyleSettings.GetTitleHeight(); 233 } 234 long nTextHeight = pBorderWindow->GetTextHeight(); 235 if ( nTextHeight > pData->mnTitleHeight ) 236 pData->mnTitleHeight = nTextHeight; 237 } 238 } 239 } 240 241 // ----------------------------------------------------------------------- 242 243 sal_uInt16 ImplBorderWindowView::ImplHitTest( ImplBorderFrameData* pData, const Point& rPos ) 244 { 245 ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; 246 247 if ( pData->maTitleRect.IsInside( rPos ) ) 248 { 249 if ( pData->maCloseRect.IsInside( rPos ) ) 250 return BORDERWINDOW_HITTEST_CLOSE; 251 else if ( pData->maRollRect.IsInside( rPos ) ) 252 return BORDERWINDOW_HITTEST_ROLL; 253 else if ( pData->maMenuRect.IsInside( rPos ) ) 254 return BORDERWINDOW_HITTEST_MENU; 255 else if ( pData->maDockRect.IsInside( rPos ) ) 256 return BORDERWINDOW_HITTEST_DOCK; 257 else if ( pData->maHideRect.IsInside( rPos ) ) 258 return BORDERWINDOW_HITTEST_HIDE; 259 else if ( pData->maHelpRect.IsInside( rPos ) ) 260 return BORDERWINDOW_HITTEST_HELP; 261 else if ( pData->maPinRect.IsInside( rPos ) ) 262 return BORDERWINDOW_HITTEST_PIN; 263 else 264 return BORDERWINDOW_HITTEST_TITLE; 265 } 266 267 if ( (pBorderWindow->GetStyle() & WB_SIZEABLE) && 268 !pBorderWindow->mbRollUp ) 269 { 270 long nSizeWidth = pData->mnNoTitleTop+pData->mnTitleHeight; 271 if ( nSizeWidth < 16 ) 272 nSizeWidth = 16; 273 274 // no corner resize for floating toolbars, which would lead to jumps while formatting 275 // setting nSizeWidth = 0 will only return pure left,top,right,bottom 276 if( pBorderWindow->GetStyle() & WB_OWNERDRAWDECORATION ) 277 nSizeWidth = 0; 278 279 if ( rPos.X() < pData->mnLeftBorder ) 280 { 281 if ( rPos.Y() < nSizeWidth ) 282 return BORDERWINDOW_HITTEST_TOPLEFT; 283 else if ( rPos.Y() >= pData->mnHeight-nSizeWidth ) 284 return BORDERWINDOW_HITTEST_BOTTOMLEFT; 285 else 286 return BORDERWINDOW_HITTEST_LEFT; 287 } 288 else if ( rPos.X() >= pData->mnWidth-pData->mnRightBorder ) 289 { 290 if ( rPos.Y() < nSizeWidth ) 291 return BORDERWINDOW_HITTEST_TOPRIGHT; 292 else if ( rPos.Y() >= pData->mnHeight-nSizeWidth ) 293 return BORDERWINDOW_HITTEST_BOTTOMRIGHT; 294 else 295 return BORDERWINDOW_HITTEST_RIGHT; 296 } 297 else if ( rPos.Y() < pData->mnNoTitleTop ) 298 { 299 if ( rPos.X() < nSizeWidth ) 300 return BORDERWINDOW_HITTEST_TOPLEFT; 301 else if ( rPos.X() >= pData->mnWidth-nSizeWidth ) 302 return BORDERWINDOW_HITTEST_TOPRIGHT; 303 else 304 return BORDERWINDOW_HITTEST_TOP; 305 } 306 else if ( rPos.Y() >= pData->mnHeight-pData->mnBottomBorder ) 307 { 308 if ( rPos.X() < nSizeWidth ) 309 return BORDERWINDOW_HITTEST_BOTTOMLEFT; 310 else if ( rPos.X() >= pData->mnWidth-nSizeWidth ) 311 return BORDERWINDOW_HITTEST_BOTTOMRIGHT; 312 else 313 return BORDERWINDOW_HITTEST_BOTTOM; 314 } 315 } 316 317 return 0; 318 } 319 320 // ----------------------------------------------------------------------- 321 322 sal_Bool ImplBorderWindowView::ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt ) 323 { 324 sal_uInt16 oldCloseState = pData->mnCloseState; 325 sal_uInt16 oldMenuState = pData->mnMenuState; 326 pData->mnCloseState &= ~BUTTON_DRAW_HIGHLIGHT; 327 pData->mnMenuState &= ~BUTTON_DRAW_HIGHLIGHT; 328 329 Point aMousePos = rMEvt.GetPosPixel(); 330 sal_uInt16 nHitTest = ImplHitTest( pData, aMousePos ); 331 PointerStyle ePtrStyle = POINTER_ARROW; 332 if ( nHitTest & BORDERWINDOW_HITTEST_LEFT ) 333 ePtrStyle = POINTER_WINDOW_WSIZE; 334 else if ( nHitTest & BORDERWINDOW_HITTEST_RIGHT ) 335 ePtrStyle = POINTER_WINDOW_ESIZE; 336 else if ( nHitTest & BORDERWINDOW_HITTEST_TOP ) 337 ePtrStyle = POINTER_WINDOW_NSIZE; 338 else if ( nHitTest & BORDERWINDOW_HITTEST_BOTTOM ) 339 ePtrStyle = POINTER_WINDOW_SSIZE; 340 else if ( nHitTest & BORDERWINDOW_HITTEST_TOPLEFT ) 341 ePtrStyle = POINTER_WINDOW_NWSIZE; 342 else if ( nHitTest & BORDERWINDOW_HITTEST_BOTTOMRIGHT ) 343 ePtrStyle = POINTER_WINDOW_SESIZE; 344 else if ( nHitTest & BORDERWINDOW_HITTEST_TOPRIGHT ) 345 ePtrStyle = POINTER_WINDOW_NESIZE; 346 else if ( nHitTest & BORDERWINDOW_HITTEST_BOTTOMLEFT ) 347 ePtrStyle = POINTER_WINDOW_SWSIZE; 348 else if ( nHitTest & BORDERWINDOW_HITTEST_CLOSE ) 349 pData->mnCloseState |= BUTTON_DRAW_HIGHLIGHT; 350 else if ( nHitTest & BORDERWINDOW_HITTEST_MENU ) 351 pData->mnMenuState |= BUTTON_DRAW_HIGHLIGHT; 352 pData->mpBorderWindow->SetPointer( Pointer( ePtrStyle ) ); 353 354 if( pData->mnCloseState != oldCloseState ) 355 pData->mpBorderWindow->Invalidate( pData->maCloseRect ); 356 if( pData->mnMenuState != oldMenuState ) 357 pData->mpBorderWindow->Invalidate( pData->maMenuRect ); 358 359 return sal_True; 360 } 361 362 // ----------------------------------------------------------------------- 363 364 sal_Bool ImplBorderWindowView::ImplMouseButtonDown( ImplBorderFrameData* pData, const MouseEvent& rMEvt ) 365 { 366 ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; 367 368 if ( rMEvt.IsLeft() || rMEvt.IsRight() ) 369 { 370 pData->maMouseOff = rMEvt.GetPosPixel(); 371 pData->mnHitTest = ImplHitTest( pData, pData->maMouseOff ); 372 sal_uInt16 nDragFullTest = 0; 373 if ( pData->mnHitTest ) 374 { 375 sal_Bool bTracking = sal_True; 376 sal_Bool bHitTest = sal_True; 377 378 if ( pData->mnHitTest & BORDERWINDOW_HITTEST_CLOSE ) 379 { 380 pData->mnCloseState |= BUTTON_DRAW_PRESSED; 381 DrawWindow( BORDERWINDOW_DRAW_CLOSE ); 382 } 383 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_ROLL ) 384 { 385 pData->mnRollState |= BUTTON_DRAW_PRESSED; 386 DrawWindow( BORDERWINDOW_DRAW_ROLL ); 387 } 388 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_DOCK ) 389 { 390 pData->mnDockState |= BUTTON_DRAW_PRESSED; 391 DrawWindow( BORDERWINDOW_DRAW_DOCK ); 392 } 393 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_MENU ) 394 { 395 pData->mnMenuState |= BUTTON_DRAW_PRESSED; 396 DrawWindow( BORDERWINDOW_DRAW_MENU ); 397 398 // call handler already on mouse down 399 if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) 400 { 401 SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow()); 402 pClientWindow->TitleButtonClick( TITLE_BUTTON_MENU ); 403 } 404 } 405 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HIDE ) 406 { 407 pData->mnHideState |= BUTTON_DRAW_PRESSED; 408 DrawWindow( BORDERWINDOW_DRAW_HIDE ); 409 } 410 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HELP ) 411 { 412 pData->mnHelpState |= BUTTON_DRAW_PRESSED; 413 DrawWindow( BORDERWINDOW_DRAW_HELP ); 414 } 415 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_PIN ) 416 { 417 pData->mnPinState |= BUTTON_DRAW_PRESSED; 418 DrawWindow( BORDERWINDOW_DRAW_PIN ); 419 } 420 else 421 { 422 if ( rMEvt.GetClicks() == 1 ) 423 { 424 if ( bTracking ) 425 { 426 Point aPos = pBorderWindow->GetPosPixel(); 427 Size aSize = pBorderWindow->GetOutputSizePixel(); 428 pData->mnTrackX = aPos.X(); 429 pData->mnTrackY = aPos.Y(); 430 pData->mnTrackWidth = aSize.Width(); 431 pData->mnTrackHeight = aSize.Height(); 432 433 if ( pData->mnHitTest & BORDERWINDOW_HITTEST_TITLE ) 434 nDragFullTest = DRAGFULL_OPTION_WINDOWMOVE; 435 else 436 nDragFullTest = DRAGFULL_OPTION_WINDOWSIZE; 437 } 438 } 439 else 440 { 441 bTracking = sal_False; 442 443 if ( (pData->mnHitTest & BORDERWINDOW_DRAW_TITLE) && 444 ((rMEvt.GetClicks() % 2) == 0) ) 445 { 446 pData->mnHitTest = 0; 447 bHitTest = sal_False; 448 449 if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) 450 { 451 SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow()); 452 if ( sal_True /*pBorderWindow->mbDockBtn*/ ) // always perform docking on double click, no button required 453 pClientWindow->TitleButtonClick( TITLE_BUTTON_DOCKING ); 454 else if ( pBorderWindow->GetStyle() & WB_ROLLABLE ) 455 { 456 if ( pClientWindow->IsRollUp() ) 457 pClientWindow->RollDown(); 458 else 459 pClientWindow->RollUp(); 460 pClientWindow->Roll(); 461 } 462 } 463 } 464 } 465 } 466 467 if ( bTracking ) 468 { 469 pData->mbDragFull = sal_False; 470 if ( nDragFullTest ) 471 pData->mbDragFull = sal_True; // always fulldrag for proper docking, ignore system settings 472 pBorderWindow->StartTracking(); 473 } 474 else if ( bHitTest ) 475 pData->mnHitTest = 0; 476 } 477 } 478 479 return sal_True; 480 } 481 482 // ----------------------------------------------------------------------- 483 484 sal_Bool ImplBorderWindowView::ImplTracking( ImplBorderFrameData* pData, const TrackingEvent& rTEvt ) 485 { 486 ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; 487 488 if ( rTEvt.IsTrackingEnded() ) 489 { 490 sal_uInt16 nHitTest = pData->mnHitTest; 491 pData->mnHitTest = 0; 492 493 if ( nHitTest & BORDERWINDOW_HITTEST_CLOSE ) 494 { 495 if ( pData->mnCloseState & BUTTON_DRAW_PRESSED ) 496 { 497 pData->mnCloseState &= ~BUTTON_DRAW_PRESSED; 498 DrawWindow( BORDERWINDOW_DRAW_CLOSE ); 499 500 // Bei Abbruch kein Click-Handler rufen 501 if ( !rTEvt.IsTrackingCanceled() ) 502 { 503 // dispatch to correct window type (why is Close() not virtual ??? ) 504 // TODO: make Close() virtual 505 Window *pWin = pBorderWindow->ImplGetClientWindow()->ImplGetWindow(); 506 SystemWindow *pSysWin = dynamic_cast<SystemWindow* >(pWin); 507 DockingWindow *pDockWin = dynamic_cast<DockingWindow*>(pWin); 508 if ( pSysWin ) 509 pSysWin->Close(); 510 else if ( pDockWin ) 511 pDockWin->Close(); 512 } 513 } 514 } 515 else if ( nHitTest & BORDERWINDOW_HITTEST_ROLL ) 516 { 517 if ( pData->mnRollState & BUTTON_DRAW_PRESSED ) 518 { 519 pData->mnRollState &= ~BUTTON_DRAW_PRESSED; 520 DrawWindow( BORDERWINDOW_DRAW_ROLL ); 521 522 // Bei Abbruch kein Click-Handler rufen 523 if ( !rTEvt.IsTrackingCanceled() ) 524 { 525 if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) 526 { 527 SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow()); 528 if ( pClientWindow->IsRollUp() ) 529 pClientWindow->RollDown(); 530 else 531 pClientWindow->RollUp(); 532 pClientWindow->Roll(); 533 } 534 } 535 } 536 } 537 else if ( nHitTest & BORDERWINDOW_HITTEST_DOCK ) 538 { 539 if ( pData->mnDockState & BUTTON_DRAW_PRESSED ) 540 { 541 pData->mnDockState &= ~BUTTON_DRAW_PRESSED; 542 DrawWindow( BORDERWINDOW_DRAW_DOCK ); 543 544 // Bei Abbruch kein Click-Handler rufen 545 if ( !rTEvt.IsTrackingCanceled() ) 546 { 547 if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) 548 { 549 SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow()); 550 pClientWindow->TitleButtonClick( TITLE_BUTTON_DOCKING ); 551 } 552 } 553 } 554 } 555 else if ( nHitTest & BORDERWINDOW_HITTEST_MENU ) 556 { 557 if ( pData->mnMenuState & BUTTON_DRAW_PRESSED ) 558 { 559 pData->mnMenuState &= ~BUTTON_DRAW_PRESSED; 560 DrawWindow( BORDERWINDOW_DRAW_MENU ); 561 562 // handler already called on mouse down 563 } 564 } 565 else if ( nHitTest & BORDERWINDOW_HITTEST_HIDE ) 566 { 567 if ( pData->mnHideState & BUTTON_DRAW_PRESSED ) 568 { 569 pData->mnHideState &= ~BUTTON_DRAW_PRESSED; 570 DrawWindow( BORDERWINDOW_DRAW_HIDE ); 571 572 // Bei Abbruch kein Click-Handler rufen 573 if ( !rTEvt.IsTrackingCanceled() ) 574 { 575 if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) 576 { 577 SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow()); 578 pClientWindow->TitleButtonClick( TITLE_BUTTON_HIDE ); 579 } 580 } 581 } 582 } 583 else if ( nHitTest & BORDERWINDOW_HITTEST_HELP ) 584 { 585 if ( pData->mnHelpState & BUTTON_DRAW_PRESSED ) 586 { 587 pData->mnHelpState &= ~BUTTON_DRAW_PRESSED; 588 DrawWindow( BORDERWINDOW_DRAW_HELP ); 589 590 // Bei Abbruch kein Click-Handler rufen 591 if ( !rTEvt.IsTrackingCanceled() ) 592 { 593 } 594 } 595 } 596 else if ( nHitTest & BORDERWINDOW_HITTEST_PIN ) 597 { 598 if ( pData->mnPinState & BUTTON_DRAW_PRESSED ) 599 { 600 pData->mnPinState &= ~BUTTON_DRAW_PRESSED; 601 DrawWindow( BORDERWINDOW_DRAW_PIN ); 602 603 // Bei Abbruch kein Click-Handler rufen 604 if ( !rTEvt.IsTrackingCanceled() ) 605 { 606 if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) 607 { 608 SystemWindow* pClientWindow = (SystemWindow*)(pBorderWindow->ImplGetClientWindow()); 609 pClientWindow->SetPin( !pClientWindow->IsPined() ); 610 pClientWindow->Pin(); 611 } 612 } 613 } 614 } 615 else 616 { 617 if ( pData->mbDragFull ) 618 { 619 // Bei Abbruch alten Zustand wieder herstellen 620 if ( rTEvt.IsTrackingCanceled() ) 621 pBorderWindow->SetPosSizePixel( Point( pData->mnTrackX, pData->mnTrackY ), Size( pData->mnTrackWidth, pData->mnTrackHeight ) ); 622 } 623 else 624 { 625 pBorderWindow->HideTracking(); 626 if ( !rTEvt.IsTrackingCanceled() ) 627 pBorderWindow->SetPosSizePixel( Point( pData->mnTrackX, pData->mnTrackY ), Size( pData->mnTrackWidth, pData->mnTrackHeight ) ); 628 } 629 630 if ( !rTEvt.IsTrackingCanceled() ) 631 { 632 if ( pBorderWindow->ImplGetClientWindow()->ImplIsFloatingWindow() ) 633 { 634 if ( ((FloatingWindow*)pBorderWindow->ImplGetClientWindow())->IsInPopupMode() ) 635 ((FloatingWindow*)pBorderWindow->ImplGetClientWindow())->EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF ); 636 } 637 } 638 } 639 } 640 else if ( !rTEvt.GetMouseEvent().IsSynthetic() ) 641 { 642 Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel(); 643 644 if ( pData->mnHitTest & BORDERWINDOW_HITTEST_CLOSE ) 645 { 646 if ( pData->maCloseRect.IsInside( aMousePos ) ) 647 { 648 if ( !(pData->mnCloseState & BUTTON_DRAW_PRESSED) ) 649 { 650 pData->mnCloseState |= BUTTON_DRAW_PRESSED; 651 DrawWindow( BORDERWINDOW_DRAW_CLOSE ); 652 } 653 } 654 else 655 { 656 if ( pData->mnCloseState & BUTTON_DRAW_PRESSED ) 657 { 658 pData->mnCloseState &= ~BUTTON_DRAW_PRESSED; 659 DrawWindow( BORDERWINDOW_DRAW_CLOSE ); 660 } 661 } 662 } 663 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_ROLL ) 664 { 665 if ( pData->maRollRect.IsInside( aMousePos ) ) 666 { 667 if ( !(pData->mnRollState & BUTTON_DRAW_PRESSED) ) 668 { 669 pData->mnRollState |= BUTTON_DRAW_PRESSED; 670 DrawWindow( BORDERWINDOW_DRAW_ROLL ); 671 } 672 } 673 else 674 { 675 if ( pData->mnRollState & BUTTON_DRAW_PRESSED ) 676 { 677 pData->mnRollState &= ~BUTTON_DRAW_PRESSED; 678 DrawWindow( BORDERWINDOW_DRAW_ROLL ); 679 } 680 } 681 } 682 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_DOCK ) 683 { 684 if ( pData->maDockRect.IsInside( aMousePos ) ) 685 { 686 if ( !(pData->mnDockState & BUTTON_DRAW_PRESSED) ) 687 { 688 pData->mnDockState |= BUTTON_DRAW_PRESSED; 689 DrawWindow( BORDERWINDOW_DRAW_DOCK ); 690 } 691 } 692 else 693 { 694 if ( pData->mnDockState & BUTTON_DRAW_PRESSED ) 695 { 696 pData->mnDockState &= ~BUTTON_DRAW_PRESSED; 697 DrawWindow( BORDERWINDOW_DRAW_DOCK ); 698 } 699 } 700 } 701 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_MENU ) 702 { 703 if ( pData->maMenuRect.IsInside( aMousePos ) ) 704 { 705 if ( !(pData->mnMenuState & BUTTON_DRAW_PRESSED) ) 706 { 707 pData->mnMenuState |= BUTTON_DRAW_PRESSED; 708 DrawWindow( BORDERWINDOW_DRAW_MENU ); 709 710 } 711 } 712 else 713 { 714 if ( pData->mnMenuState & BUTTON_DRAW_PRESSED ) 715 { 716 pData->mnMenuState &= ~BUTTON_DRAW_PRESSED; 717 DrawWindow( BORDERWINDOW_DRAW_MENU ); 718 } 719 } 720 } 721 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HIDE ) 722 { 723 if ( pData->maHideRect.IsInside( aMousePos ) ) 724 { 725 if ( !(pData->mnHideState & BUTTON_DRAW_PRESSED) ) 726 { 727 pData->mnHideState |= BUTTON_DRAW_PRESSED; 728 DrawWindow( BORDERWINDOW_DRAW_HIDE ); 729 } 730 } 731 else 732 { 733 if ( pData->mnHideState & BUTTON_DRAW_PRESSED ) 734 { 735 pData->mnHideState &= ~BUTTON_DRAW_PRESSED; 736 DrawWindow( BORDERWINDOW_DRAW_HIDE ); 737 } 738 } 739 } 740 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_HELP ) 741 { 742 if ( pData->maHelpRect.IsInside( aMousePos ) ) 743 { 744 if ( !(pData->mnHelpState & BUTTON_DRAW_PRESSED) ) 745 { 746 pData->mnHelpState |= BUTTON_DRAW_PRESSED; 747 DrawWindow( BORDERWINDOW_DRAW_HELP ); 748 } 749 } 750 else 751 { 752 if ( pData->mnHelpState & BUTTON_DRAW_PRESSED ) 753 { 754 pData->mnHelpState &= ~BUTTON_DRAW_PRESSED; 755 DrawWindow( BORDERWINDOW_DRAW_HELP ); 756 } 757 } 758 } 759 else if ( pData->mnHitTest & BORDERWINDOW_HITTEST_PIN ) 760 { 761 if ( pData->maPinRect.IsInside( aMousePos ) ) 762 { 763 if ( !(pData->mnPinState & BUTTON_DRAW_PRESSED) ) 764 { 765 pData->mnPinState |= BUTTON_DRAW_PRESSED; 766 DrawWindow( BORDERWINDOW_DRAW_PIN ); 767 } 768 } 769 else 770 { 771 if ( pData->mnPinState & BUTTON_DRAW_PRESSED ) 772 { 773 pData->mnPinState &= ~BUTTON_DRAW_PRESSED; 774 DrawWindow( BORDERWINDOW_DRAW_PIN ); 775 } 776 } 777 } 778 else 779 { 780 /* 781 // adjusting mousepos not required, we allow the whole screen (no desktop anymore...) 782 Point aFrameMousePos = pBorderWindow->ImplOutputToFrame( aMousePos ); 783 Size aFrameSize = pBorderWindow->ImplGetFrameWindow()->GetOutputSizePixel(); 784 if ( aFrameMousePos.X() < 0 ) 785 aFrameMousePos.X() = 0; 786 if ( aFrameMousePos.Y() < 0 ) 787 aFrameMousePos.Y() = 0; 788 if ( aFrameMousePos.X() > aFrameSize.Width()-1 ) 789 aFrameMousePos.X() = aFrameSize.Width()-1; 790 if ( aFrameMousePos.Y() > aFrameSize.Height()-1 ) 791 aFrameMousePos.Y() = aFrameSize.Height()-1; 792 aMousePos = pBorderWindow->ImplFrameToOutput( aFrameMousePos ); 793 */ 794 795 aMousePos.X() -= pData->maMouseOff.X(); 796 aMousePos.Y() -= pData->maMouseOff.Y(); 797 798 if ( pData->mnHitTest & BORDERWINDOW_HITTEST_TITLE ) 799 { 800 pData->mpBorderWindow->SetPointer( Pointer( POINTER_MOVE ) ); 801 802 Point aPos = pBorderWindow->GetPosPixel(); 803 aPos.X() += aMousePos.X(); 804 aPos.Y() += aMousePos.Y(); 805 if ( pData->mbDragFull ) 806 { 807 pBorderWindow->SetPosPixel( aPos ); 808 pBorderWindow->ImplUpdateAll(); 809 pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll(); 810 } 811 else 812 { 813 pData->mnTrackX = aPos.X(); 814 pData->mnTrackY = aPos.Y(); 815 pBorderWindow->ShowTracking( Rectangle( pBorderWindow->ScreenToOutputPixel( aPos ), pBorderWindow->GetOutputSizePixel() ), SHOWTRACK_BIG ); 816 } 817 } 818 else 819 { 820 Point aOldPos = pBorderWindow->GetPosPixel(); 821 Size aSize = pBorderWindow->GetSizePixel(); 822 Rectangle aNewRect( aOldPos, aSize ); 823 long nOldWidth = aSize.Width(); 824 long nOldHeight = aSize.Height(); 825 long nBorderWidth = pData->mnLeftBorder+pData->mnRightBorder; 826 long nBorderHeight = pData->mnTopBorder+pData->mnBottomBorder; 827 long nMinWidth = pBorderWindow->mnMinWidth+nBorderWidth; 828 long nMinHeight = pBorderWindow->mnMinHeight+nBorderHeight; 829 long nMinWidth2 = nBorderWidth; 830 long nMaxWidth = pBorderWindow->mnMaxWidth+nBorderWidth; 831 long nMaxHeight = pBorderWindow->mnMaxHeight+nBorderHeight; 832 833 if ( pData->mnTitleHeight ) 834 { 835 nMinWidth2 += 4; 836 837 if ( pBorderWindow->GetStyle() & WB_CLOSEABLE ) 838 nMinWidth2 += pData->maCloseRect.GetWidth(); 839 } 840 if ( nMinWidth2 > nMinWidth ) 841 nMinWidth = nMinWidth2; 842 if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_LEFT | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_BOTTOMLEFT) ) 843 { 844 aNewRect.Left() += aMousePos.X(); 845 if ( aNewRect.GetWidth() < nMinWidth ) 846 aNewRect.Left() = aNewRect.Right()-nMinWidth+1; 847 else if ( aNewRect.GetWidth() > nMaxWidth ) 848 aNewRect.Left() = aNewRect.Right()-nMaxWidth+1; 849 } 850 else if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_RIGHT | BORDERWINDOW_HITTEST_TOPRIGHT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) ) 851 { 852 aNewRect.Right() += aMousePos.X(); 853 if ( aNewRect.GetWidth() < nMinWidth ) 854 aNewRect.Right() = aNewRect.Left()+nMinWidth+1; 855 else if ( aNewRect.GetWidth() > nMaxWidth ) 856 aNewRect.Right() = aNewRect.Left()+nMaxWidth+1; 857 } 858 if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_TOP | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_TOPRIGHT) ) 859 { 860 aNewRect.Top() += aMousePos.Y(); 861 if ( aNewRect.GetHeight() < nMinHeight ) 862 aNewRect.Top() = aNewRect.Bottom()-nMinHeight+1; 863 else if ( aNewRect.GetHeight() > nMaxHeight ) 864 aNewRect.Top() = aNewRect.Bottom()-nMaxHeight+1; 865 } 866 else if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_BOTTOM | BORDERWINDOW_HITTEST_BOTTOMLEFT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) ) 867 { 868 aNewRect.Bottom() += aMousePos.Y(); 869 if ( aNewRect.GetHeight() < nMinHeight ) 870 aNewRect.Bottom() = aNewRect.Top()+nMinHeight+1; 871 else if ( aNewRect.GetHeight() > nMaxHeight ) 872 aNewRect.Bottom() = aNewRect.Top()+nMaxHeight+1; 873 } 874 875 // call Resizing-Handler for SystemWindows 876 if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() ) 877 { 878 // adjust size for Resizing-call 879 aSize = aNewRect.GetSize(); 880 aSize.Width() -= nBorderWidth; 881 aSize.Height() -= nBorderHeight; 882 ((SystemWindow*)pBorderWindow->ImplGetClientWindow())->Resizing( aSize ); 883 aSize.Width() += nBorderWidth; 884 aSize.Height() += nBorderHeight; 885 if ( aSize.Width() < nMinWidth ) 886 aSize.Width() = nMinWidth; 887 if ( aSize.Height() < nMinHeight ) 888 aSize.Height() = nMinHeight; 889 if ( aSize.Width() > nMaxWidth ) 890 aSize.Width() = nMaxWidth; 891 if ( aSize.Height() > nMaxHeight ) 892 aSize.Height() = nMaxHeight; 893 if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_LEFT | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_BOTTOMLEFT) ) 894 aNewRect.Left() = aNewRect.Right()-aSize.Width()+1; 895 else 896 aNewRect.Right() = aNewRect.Left()+aSize.Width()-1; 897 if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_TOP | BORDERWINDOW_HITTEST_TOPLEFT | BORDERWINDOW_HITTEST_TOPRIGHT) ) 898 aNewRect.Top() = aNewRect.Bottom()-aSize.Height()+1; 899 else 900 aNewRect.Bottom() = aNewRect.Top()+aSize.Height()-1; 901 } 902 903 if ( pData->mbDragFull ) 904 { 905 // no move (only resize) if position did not change 906 if( aOldPos != aNewRect.TopLeft() ) 907 pBorderWindow->SetPosSizePixel( aNewRect.Left(), aNewRect.Top(), 908 aNewRect.GetWidth(), aNewRect.GetHeight(), WINDOW_POSSIZE_POSSIZE ); 909 else 910 pBorderWindow->SetPosSizePixel( aNewRect.Left(), aNewRect.Top(), 911 aNewRect.GetWidth(), aNewRect.GetHeight(), WINDOW_POSSIZE_SIZE ); 912 913 pBorderWindow->ImplUpdateAll(); 914 pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll(); 915 if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_RIGHT | BORDERWINDOW_HITTEST_TOPRIGHT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) ) 916 pData->maMouseOff.X() += aNewRect.GetWidth()-nOldWidth; 917 if ( pData->mnHitTest & (BORDERWINDOW_HITTEST_BOTTOM | BORDERWINDOW_HITTEST_BOTTOMLEFT | BORDERWINDOW_HITTEST_BOTTOMRIGHT) ) 918 pData->maMouseOff.Y() += aNewRect.GetHeight()-nOldHeight; 919 } 920 else 921 { 922 pData->mnTrackX = aNewRect.Left(); 923 pData->mnTrackY = aNewRect.Top(); 924 pData->mnTrackWidth = aNewRect.GetWidth(); 925 pData->mnTrackHeight = aNewRect.GetHeight(); 926 pBorderWindow->ShowTracking( Rectangle( pBorderWindow->ScreenToOutputPixel( aNewRect.TopLeft() ), aNewRect.GetSize() ), SHOWTRACK_BIG ); 927 } 928 } 929 } 930 } 931 932 return sal_True; 933 } 934 935 // ----------------------------------------------------------------------- 936 937 String ImplBorderWindowView::ImplRequestHelp( ImplBorderFrameData* pData, 938 const Point& rPos, 939 Rectangle& rHelpRect ) 940 { 941 sal_uInt16 nHelpId = 0; 942 String aHelpStr; 943 sal_uInt16 nHitTest = ImplHitTest( pData, rPos ); 944 if ( nHitTest ) 945 { 946 if ( nHitTest & BORDERWINDOW_HITTEST_CLOSE ) 947 { 948 nHelpId = SV_HELPTEXT_CLOSE; 949 rHelpRect = pData->maCloseRect; 950 } 951 else if ( nHitTest & BORDERWINDOW_HITTEST_ROLL ) 952 { 953 if ( pData->mpBorderWindow->mbRollUp ) 954 nHelpId = SV_HELPTEXT_ROLLDOWN; 955 else 956 nHelpId = SV_HELPTEXT_ROLLUP; 957 rHelpRect = pData->maRollRect; 958 } 959 else if ( nHitTest & BORDERWINDOW_HITTEST_DOCK ) 960 { 961 nHelpId = SV_HELPTEXT_MAXIMIZE; 962 rHelpRect = pData->maDockRect; 963 } 964 /* no help string available 965 else if ( nHitTest & BORDERWINDOW_HITTEST_MENU ) 966 { 967 nHelpId = SV_HELPTEXT_MENU; 968 rHelpRect = pData->maMenuRect; 969 }*/ 970 else if ( nHitTest & BORDERWINDOW_HITTEST_HIDE ) 971 { 972 nHelpId = SV_HELPTEXT_MINIMIZE; 973 rHelpRect = pData->maHideRect; 974 } 975 else if ( nHitTest & BORDERWINDOW_HITTEST_HELP ) 976 { 977 nHelpId = SV_HELPTEXT_HELP; 978 rHelpRect = pData->maHelpRect; 979 } 980 else if ( nHitTest & BORDERWINDOW_HITTEST_PIN ) 981 { 982 nHelpId = SV_HELPTEXT_ALWAYSVISIBLE; 983 rHelpRect = pData->maPinRect; 984 } 985 else if ( nHitTest & BORDERWINDOW_HITTEST_TITLE ) 986 { 987 if( !pData->maTitleRect.IsEmpty() ) 988 { 989 // tooltip only if title truncated 990 if( pData->mbTitleClipped ) 991 { 992 rHelpRect = pData->maTitleRect; 993 // no help id, use window title as help string 994 aHelpStr = pData->mpBorderWindow->GetText(); 995 } 996 } 997 } 998 } 999 1000 if( nHelpId && ImplGetResMgr() ) 1001 aHelpStr = String( ResId( nHelpId, *ImplGetResMgr() ) ); 1002 1003 return aHelpStr; 1004 } 1005 1006 // ----------------------------------------------------------------------- 1007 1008 long ImplBorderWindowView::ImplCalcTitleWidth( const ImplBorderFrameData* pData ) const 1009 { 1010 // kein sichtbarer Title, dann auch keine Breite 1011 if ( !pData->mnTitleHeight ) 1012 return 0; 1013 1014 ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; 1015 long nTitleWidth = pBorderWindow->GetTextWidth( pBorderWindow->GetText() )+6; 1016 nTitleWidth += pData->maPinRect.GetWidth(); 1017 nTitleWidth += pData->maCloseRect.GetWidth(); 1018 nTitleWidth += pData->maRollRect.GetWidth(); 1019 nTitleWidth += pData->maDockRect.GetWidth(); 1020 nTitleWidth += pData->maMenuRect.GetWidth(); 1021 nTitleWidth += pData->maHideRect.GetWidth(); 1022 nTitleWidth += pData->maHelpRect.GetWidth(); 1023 nTitleWidth += pData->mnLeftBorder+pData->mnRightBorder; 1024 return nTitleWidth; 1025 } 1026 1027 // ======================================================================= 1028 1029 // -------------------------- 1030 // - ImplNoBorderWindowView - 1031 // -------------------------- 1032 1033 ImplNoBorderWindowView::ImplNoBorderWindowView( ImplBorderWindow* ) 1034 { 1035 } 1036 1037 // ----------------------------------------------------------------------- 1038 1039 void ImplNoBorderWindowView::Init( OutputDevice*, long, long ) 1040 { 1041 } 1042 1043 // ----------------------------------------------------------------------- 1044 1045 void ImplNoBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, 1046 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const 1047 { 1048 rLeftBorder = 0; 1049 rTopBorder = 0; 1050 rRightBorder = 0; 1051 rBottomBorder = 0; 1052 } 1053 1054 // ----------------------------------------------------------------------- 1055 1056 long ImplNoBorderWindowView::CalcTitleWidth() const 1057 { 1058 return 0; 1059 } 1060 1061 // ----------------------------------------------------------------------- 1062 1063 void ImplNoBorderWindowView::DrawWindow( sal_uInt16, OutputDevice*, const Point* ) 1064 { 1065 } 1066 1067 // ======================================================================= 1068 1069 // ----------------------------- 1070 // - ImplSmallBorderWindowView - 1071 // ----------------------------- 1072 1073 // ======================================================================= 1074 1075 ImplSmallBorderWindowView::ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow ) 1076 { 1077 mpBorderWindow = pBorderWindow; 1078 } 1079 1080 // ----------------------------------------------------------------------- 1081 1082 void ImplSmallBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight ) 1083 { 1084 mpOutDev = pDev; 1085 mnWidth = nWidth; 1086 mnHeight = nHeight; 1087 mbNWFBorder = false; 1088 1089 sal_uInt16 nBorderStyle = mpBorderWindow->GetBorderStyle(); 1090 if ( nBorderStyle & WINDOW_BORDER_NOBORDER ) 1091 { 1092 mnLeftBorder = 0; 1093 mnTopBorder = 0; 1094 mnRightBorder = 0; 1095 mnBottomBorder = 0; 1096 } 1097 else 1098 { 1099 // FIXME: this is currently only on aqua, check with other 1100 // platforms 1101 if( ImplGetSVData()->maNWFData.mbNoFocusRects ) 1102 { 1103 // for native widget drawing we must find out what 1104 // control this border belongs to 1105 Window *pWin = NULL, *pCtrl = NULL; 1106 if( mpOutDev->GetOutDevType() == OUTDEV_WINDOW ) 1107 pWin = (Window*) mpOutDev; 1108 1109 ControlType aCtrlType = 0; 1110 if( pWin && (pCtrl = mpBorderWindow->GetWindow( WINDOW_CLIENT )) != NULL ) 1111 { 1112 switch( pCtrl->GetType() ) 1113 { 1114 case WINDOW_LISTBOX: 1115 if( pCtrl->GetStyle() & WB_DROPDOWN ) 1116 { 1117 aCtrlType = CTRL_LISTBOX; 1118 mbNWFBorder = true; 1119 } 1120 break; 1121 case WINDOW_COMBOBOX: 1122 if( pCtrl->GetStyle() & WB_DROPDOWN ) 1123 { 1124 aCtrlType = CTRL_COMBOBOX; 1125 mbNWFBorder = true; 1126 } 1127 break; 1128 case WINDOW_MULTILINEEDIT: 1129 aCtrlType = CTRL_MULTILINE_EDITBOX; 1130 mbNWFBorder = true; 1131 break; 1132 case WINDOW_EDIT: 1133 case WINDOW_PATTERNFIELD: 1134 case WINDOW_METRICFIELD: 1135 case WINDOW_CURRENCYFIELD: 1136 case WINDOW_DATEFIELD: 1137 case WINDOW_TIMEFIELD: 1138 case WINDOW_LONGCURRENCYFIELD: 1139 case WINDOW_NUMERICFIELD: 1140 case WINDOW_SPINFIELD: 1141 mbNWFBorder = true; 1142 aCtrlType = (pCtrl->GetStyle() & WB_SPIN) ? CTRL_SPINBOX : CTRL_EDITBOX; 1143 break; 1144 default: 1145 break; 1146 } 1147 } 1148 if( mbNWFBorder ) 1149 { 1150 ImplControlValue aControlValue; 1151 Rectangle aCtrlRegion( (const Point&)Point(), Size( mnWidth < 10 ? 10 : mnWidth, mnHeight < 10 ? 10 : mnHeight ) ); 1152 Rectangle aBounds( aCtrlRegion ); 1153 Rectangle aContent( aCtrlRegion ); 1154 if( pWin->GetNativeControlRegion( aCtrlType, PART_ENTIRE_CONTROL, aCtrlRegion, 1155 CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), 1156 aBounds, aContent ) ) 1157 { 1158 mnLeftBorder = aContent.Left() - aBounds.Left(); 1159 mnRightBorder = aBounds.Right() - aContent.Right(); 1160 mnTopBorder = aContent.Top() - aBounds.Top(); 1161 mnBottomBorder = aBounds.Bottom() - aContent.Bottom(); 1162 if( mnWidth && mnHeight ) 1163 { 1164 1165 mpBorderWindow->SetPaintTransparent( sal_True ); 1166 mpBorderWindow->SetBackground(); 1167 pCtrl->SetPaintTransparent( sal_True ); 1168 1169 Window* pCompoundParent = NULL; 1170 if( pWin->GetParent() && pWin->GetParent()->IsCompoundControl() ) 1171 pCompoundParent = pWin->GetParent(); 1172 1173 if( pCompoundParent ) 1174 pCompoundParent->SetPaintTransparent( sal_True ); 1175 1176 if( mnWidth < aBounds.GetWidth() || mnHeight < aBounds.GetHeight() ) 1177 { 1178 if( ! pCompoundParent ) // compound controls have to fix themselves 1179 { 1180 Point aPos( mpBorderWindow->GetPosPixel() ); 1181 if( mnWidth < aBounds.GetWidth() ) 1182 aPos.X() -= (aBounds.GetWidth() - mnWidth) / 2; 1183 if( mnHeight < aBounds.GetHeight() ) 1184 aPos.Y() -= (aBounds.GetHeight() - mnHeight) / 2; 1185 mpBorderWindow->SetPosSizePixel( aPos, aBounds.GetSize() ); 1186 } 1187 } 1188 } 1189 } 1190 else 1191 mbNWFBorder = false; 1192 } 1193 } 1194 1195 if( ! mbNWFBorder ) 1196 { 1197 sal_uInt16 nStyle = FRAME_DRAW_NODRAW; 1198 // Wenn Border umgesetzt wurde oder BorderWindow ein Frame-Fenster 1199 // ist, dann Border nach aussen 1200 if ( (nBorderStyle & WINDOW_BORDER_DOUBLEOUT) || mpBorderWindow->mbSmallOutBorder ) 1201 nStyle |= FRAME_DRAW_DOUBLEOUT; 1202 else 1203 nStyle |= FRAME_DRAW_DOUBLEIN; 1204 if ( nBorderStyle & WINDOW_BORDER_MONO ) 1205 nStyle |= FRAME_DRAW_MONO; 1206 1207 DecorationView aDecoView( mpOutDev ); 1208 Rectangle aRect( 0, 0, 10, 10 ); 1209 Rectangle aCalcRect = aDecoView.DrawFrame( aRect, nStyle ); 1210 mnLeftBorder = aCalcRect.Left(); 1211 mnTopBorder = aCalcRect.Top(); 1212 mnRightBorder = aRect.Right()-aCalcRect.Right(); 1213 mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom(); 1214 } 1215 } 1216 } 1217 1218 // ----------------------------------------------------------------------- 1219 1220 void ImplSmallBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, 1221 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const 1222 { 1223 rLeftBorder = mnLeftBorder; 1224 rTopBorder = mnTopBorder; 1225 rRightBorder = mnRightBorder; 1226 rBottomBorder = mnBottomBorder; 1227 } 1228 1229 // ----------------------------------------------------------------------- 1230 1231 long ImplSmallBorderWindowView::CalcTitleWidth() const 1232 { 1233 return 0; 1234 } 1235 1236 // ----------------------------------------------------------------------- 1237 1238 void ImplSmallBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice*, const Point* ) 1239 { 1240 sal_uInt16 nBorderStyle = mpBorderWindow->GetBorderStyle(); 1241 if ( nBorderStyle & WINDOW_BORDER_NOBORDER ) 1242 return; 1243 1244 sal_Bool bNativeOK = sal_False; 1245 // for native widget drawing we must find out what 1246 // control this border belongs to 1247 Window *pWin = NULL, *pCtrl = NULL; 1248 if( mpOutDev->GetOutDevType() == OUTDEV_WINDOW ) 1249 pWin = (Window*) mpOutDev; 1250 1251 ControlType aCtrlType = 0; 1252 ControlPart aCtrlPart = PART_ENTIRE_CONTROL; 1253 1254 if( pWin && (pCtrl = mpBorderWindow->GetWindow( WINDOW_CLIENT )) != NULL ) 1255 { 1256 switch( pCtrl->GetType() ) 1257 { 1258 case WINDOW_MULTILINEEDIT: 1259 aCtrlType = CTRL_MULTILINE_EDITBOX; 1260 break; 1261 case WINDOW_EDIT: 1262 case WINDOW_PATTERNFIELD: 1263 case WINDOW_METRICFIELD: 1264 case WINDOW_CURRENCYFIELD: 1265 case WINDOW_DATEFIELD: 1266 case WINDOW_TIMEFIELD: 1267 case WINDOW_LONGCURRENCYFIELD: 1268 case WINDOW_NUMERICFIELD: 1269 case WINDOW_SPINFIELD: 1270 if( pCtrl->GetStyle() & WB_SPIN ) 1271 aCtrlType = CTRL_SPINBOX; 1272 else 1273 aCtrlType = CTRL_EDITBOX; 1274 break; 1275 1276 case WINDOW_LISTBOX: 1277 case WINDOW_MULTILISTBOX: 1278 case WINDOW_TREELISTBOX: 1279 aCtrlType = CTRL_LISTBOX; 1280 if( pCtrl->GetStyle() & WB_DROPDOWN ) 1281 aCtrlPart = PART_ENTIRE_CONTROL; 1282 else 1283 aCtrlPart = PART_WINDOW; 1284 break; 1285 1286 case WINDOW_LISTBOXWINDOW: 1287 aCtrlType = CTRL_LISTBOX; 1288 aCtrlPart = PART_WINDOW; 1289 break; 1290 1291 case WINDOW_COMBOBOX: 1292 case WINDOW_PATTERNBOX: 1293 case WINDOW_NUMERICBOX: 1294 case WINDOW_METRICBOX: 1295 case WINDOW_CURRENCYBOX: 1296 case WINDOW_DATEBOX: 1297 case WINDOW_TIMEBOX: 1298 case WINDOW_LONGCURRENCYBOX: 1299 if( pCtrl->GetStyle() & WB_DROPDOWN ) 1300 { 1301 aCtrlType = CTRL_COMBOBOX; 1302 aCtrlPart = PART_ENTIRE_CONTROL; 1303 } 1304 else 1305 { 1306 aCtrlType = CTRL_LISTBOX; 1307 aCtrlPart = PART_WINDOW; 1308 } 1309 break; 1310 1311 default: 1312 break; 1313 } 1314 } 1315 1316 if ( aCtrlType && pCtrl->IsNativeControlSupported(aCtrlType, aCtrlPart) ) 1317 { 1318 ImplControlValue aControlValue; 1319 ControlState nState = CTRL_STATE_ENABLED; 1320 1321 if ( !pWin->IsEnabled() ) 1322 nState &= ~CTRL_STATE_ENABLED; 1323 if ( pWin->HasFocus() ) 1324 nState |= CTRL_STATE_FOCUSED; 1325 else if( mbNWFBorder ) 1326 { 1327 // FIXME: this is currently only on aqua, see if other platforms can profit 1328 1329 // FIXME: for aqua focus rings all controls need to support GetNativeControlRegion 1330 // for the dropdown style 1331 if( pCtrl->HasFocus() || pCtrl->HasChildPathFocus() ) 1332 nState |= CTRL_STATE_FOCUSED; 1333 } 1334 1335 sal_Bool bMouseOver = sal_False; 1336 Window *pCtrlChild = pCtrl->GetWindow( WINDOW_FIRSTCHILD ); 1337 while( pCtrlChild && (bMouseOver = pCtrlChild->IsMouseOver()) == sal_False ) 1338 pCtrlChild = pCtrlChild->GetWindow( WINDOW_NEXT ); 1339 1340 if( bMouseOver ) 1341 nState |= CTRL_STATE_ROLLOVER; 1342 1343 Point aPoint; 1344 Rectangle aCtrlRegion( aPoint, Size( mnWidth, mnHeight ) ); 1345 1346 Rectangle aBoundingRgn( aPoint, Size( mnWidth, mnHeight ) ); 1347 Rectangle aContentRgn( aCtrlRegion ); 1348 if( ! ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize && 1349 pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion, 1350 nState, aControlValue, rtl::OUString(), 1351 aBoundingRgn, aContentRgn )) 1352 { 1353 aCtrlRegion=aContentRgn; 1354 } 1355 1356 bNativeOK = pWin->DrawNativeControl( aCtrlType, aCtrlPart, aCtrlRegion, nState, 1357 aControlValue, rtl::OUString() ); 1358 1359 // if the native theme draws the spinbuttons in one call, make sure the proper settings 1360 // are passed, this might force a redraw though.... (TODO: improve) 1361 if ( (aCtrlType == CTRL_SPINBOX) && !pCtrl->IsNativeControlSupported( CTRL_SPINBOX, PART_BUTTON_UP ) ) 1362 { 1363 Edit *pEdit = ((Edit*) pCtrl)->GetSubEdit(); 1364 if ( pEdit ) 1365 pCtrl->Paint( Rectangle() ); // make sure the buttons are also drawn as they might overwrite the border 1366 } 1367 } 1368 1369 if( bNativeOK ) 1370 return; 1371 1372 if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME ) 1373 { 1374 if ( nBorderStyle & WINDOW_BORDER_ACTIVE ) 1375 { 1376 Color aColor = mpOutDev->GetSettings().GetStyleSettings().GetHighlightColor(); 1377 mpOutDev->SetLineColor(); 1378 mpOutDev->SetFillColor( aColor ); 1379 mpOutDev->DrawRect( Rectangle( 0, 0, mnWidth-1, mnTopBorder ) ); 1380 mpOutDev->DrawRect( Rectangle( 0, mnHeight-mnBottomBorder, mnWidth-1, mnHeight-1 ) ); 1381 mpOutDev->DrawRect( Rectangle( 0, 0, mnLeftBorder, mnHeight-1 ) ); 1382 mpOutDev->DrawRect( Rectangle( mnWidth-mnRightBorder, 0, mnWidth-1, mnHeight-1 ) ); 1383 } 1384 else 1385 { 1386 sal_uInt16 nStyle = 0; 1387 // Wenn Border umgesetzt wurde oder BorderWindow ein Frame-Fenster 1388 // ist, dann Border nach aussen 1389 if ( (nBorderStyle & WINDOW_BORDER_DOUBLEOUT) || mpBorderWindow->mbSmallOutBorder ) 1390 nStyle |= FRAME_DRAW_DOUBLEOUT; 1391 else 1392 nStyle |= FRAME_DRAW_DOUBLEIN; 1393 if ( nBorderStyle & WINDOW_BORDER_MONO ) 1394 nStyle |= FRAME_DRAW_MONO; 1395 if ( nBorderStyle & WINDOW_BORDER_MENU ) 1396 nStyle |= FRAME_DRAW_MENU; 1397 // tell DrawFrame that we're drawing a window border of a frame window to avoid round corners 1398 if( pWin && pWin == pWin->ImplGetFrameWindow() ) 1399 nStyle |= FRAME_DRAW_WINDOWBORDER; 1400 1401 DecorationView aDecoView( mpOutDev ); 1402 Point aTmpPoint; 1403 Rectangle aInRect( aTmpPoint, Size( mnWidth, mnHeight ) ); 1404 aDecoView.DrawFrame( aInRect, nStyle ); 1405 } 1406 } 1407 } 1408 1409 // ======================================================================= 1410 1411 // --------------------------- 1412 // - ImplStdBorderWindowView - 1413 // --------------------------- 1414 1415 ImplStdBorderWindowView::ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow ) 1416 { 1417 maFrameData.mpBorderWindow = pBorderWindow; 1418 maFrameData.mbDragFull = sal_False; 1419 maFrameData.mnHitTest = 0; 1420 maFrameData.mnPinState = 0; 1421 maFrameData.mnCloseState = 0; 1422 maFrameData.mnRollState = 0; 1423 maFrameData.mnDockState = 0; 1424 maFrameData.mnMenuState = 0; 1425 maFrameData.mnHideState = 0; 1426 maFrameData.mnHelpState = 0; 1427 maFrameData.mbTitleClipped = 0; 1428 1429 mpATitleVirDev = NULL; 1430 mpDTitleVirDev = NULL; 1431 } 1432 1433 // ----------------------------------------------------------------------- 1434 1435 ImplStdBorderWindowView::~ImplStdBorderWindowView() 1436 { 1437 if ( mpATitleVirDev ) 1438 delete mpATitleVirDev; 1439 if ( mpDTitleVirDev ) 1440 delete mpDTitleVirDev; 1441 } 1442 1443 // ----------------------------------------------------------------------- 1444 1445 sal_Bool ImplStdBorderWindowView::MouseMove( const MouseEvent& rMEvt ) 1446 { 1447 return ImplMouseMove( &maFrameData, rMEvt ); 1448 } 1449 1450 // ----------------------------------------------------------------------- 1451 1452 sal_Bool ImplStdBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt ) 1453 { 1454 return ImplMouseButtonDown( &maFrameData, rMEvt ); 1455 } 1456 1457 // ----------------------------------------------------------------------- 1458 1459 sal_Bool ImplStdBorderWindowView::Tracking( const TrackingEvent& rTEvt ) 1460 { 1461 return ImplTracking( &maFrameData, rTEvt ); 1462 } 1463 1464 // ----------------------------------------------------------------------- 1465 1466 String ImplStdBorderWindowView::RequestHelp( const Point& rPos, Rectangle& rHelpRect ) 1467 { 1468 return ImplRequestHelp( &maFrameData, rPos, rHelpRect ); 1469 } 1470 1471 // ----------------------------------------------------------------------- 1472 1473 Rectangle ImplStdBorderWindowView::GetMenuRect() const 1474 { 1475 return maFrameData.maMenuRect; 1476 } 1477 1478 // ----------------------------------------------------------------------- 1479 1480 void ImplStdBorderWindowView::Init( OutputDevice* pDev, long nWidth, long nHeight ) 1481 { 1482 ImplBorderFrameData* pData = &maFrameData; 1483 ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow; 1484 const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings(); 1485 DecorationView aDecoView( pDev ); 1486 Rectangle aRect( 0, 0, 10, 10 ); 1487 Rectangle aCalcRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW ); 1488 1489 pData->mpOutDev = pDev; 1490 pData->mnWidth = nWidth; 1491 pData->mnHeight = nHeight; 1492 1493 pData->mnTitleType = pBorderWindow->mnTitleType; 1494 pData->mbFloatWindow = pBorderWindow->mbFloatWindow; 1495 1496 if ( !(pBorderWindow->GetStyle() & WB_MOVEABLE) || (pData->mnTitleType == BORDERWINDOW_TITLE_NONE) ) 1497 pData->mnBorderSize = 0; 1498 else if ( pData->mnTitleType == BORDERWINDOW_TITLE_TEAROFF ) 1499 pData->mnBorderSize = 0; 1500 else 1501 pData->mnBorderSize = rStyleSettings.GetBorderSize(); 1502 pData->mnLeftBorder = aCalcRect.Left(); 1503 pData->mnTopBorder = aCalcRect.Top(); 1504 pData->mnRightBorder = aRect.Right()-aCalcRect.Right(); 1505 pData->mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom(); 1506 pData->mnLeftBorder += pData->mnBorderSize; 1507 pData->mnTopBorder += pData->mnBorderSize; 1508 pData->mnRightBorder += pData->mnBorderSize; 1509 pData->mnBottomBorder += pData->mnBorderSize; 1510 pData->mnNoTitleTop = pData->mnTopBorder; 1511 1512 ImplInitTitle( &maFrameData ); 1513 if ( pData->mnTitleHeight ) 1514 { 1515 // to improve symbol display force a minum title height 1516 if( pData->mnTitleHeight < MIN_CAPTION_HEIGHT ) 1517 pData->mnTitleHeight = MIN_CAPTION_HEIGHT; 1518 1519 // set a proper background for drawing 1520 // highlighted buttons in the title 1521 pBorderWindow->SetBackground( rStyleSettings.GetWindowColor() ); 1522 1523 pData->maTitleRect.Left() = pData->mnLeftBorder; 1524 pData->maTitleRect.Right() = nWidth-pData->mnRightBorder-1; 1525 pData->maTitleRect.Top() = pData->mnTopBorder; 1526 pData->maTitleRect.Bottom() = pData->maTitleRect.Top()+pData->mnTitleHeight-1; 1527 1528 if ( pData->mnTitleType & (BORDERWINDOW_TITLE_NORMAL | BORDERWINDOW_TITLE_SMALL) ) 1529 { 1530 long nLeft = pData->maTitleRect.Left(); 1531 long nRight = pData->maTitleRect.Right(); 1532 long nItemTop = pData->maTitleRect.Top(); 1533 long nItemBottom = pData->maTitleRect.Bottom(); 1534 nLeft += 1; 1535 nRight -= 3; 1536 nItemTop += 2; 1537 nItemBottom -= 2; 1538 1539 if ( pBorderWindow->GetStyle() & WB_PINABLE ) 1540 { 1541 Image aImage; 1542 ImplGetPinImage( 0, 0, aImage ); 1543 pData->maPinRect.Top() = nItemTop; 1544 pData->maPinRect.Bottom() = nItemBottom; 1545 pData->maPinRect.Left() = nLeft; 1546 pData->maPinRect.Right() = pData->maPinRect.Left()+aImage.GetSizePixel().Width(); 1547 nLeft += pData->maPinRect.GetWidth()+3; 1548 } 1549 1550 if ( pBorderWindow->GetStyle() & WB_CLOSEABLE ) 1551 { 1552 pData->maCloseRect.Top() = nItemTop; 1553 pData->maCloseRect.Bottom() = nItemBottom; 1554 pData->maCloseRect.Right() = nRight; 1555 pData->maCloseRect.Left() = pData->maCloseRect.Right()-pData->maCloseRect.GetHeight()+1; 1556 nRight -= pData->maCloseRect.GetWidth()+3; 1557 } 1558 1559 if ( pBorderWindow->mbMenuBtn ) 1560 { 1561 pData->maMenuRect.Top() = nItemTop; 1562 pData->maMenuRect.Bottom() = nItemBottom; 1563 pData->maMenuRect.Right() = nRight; 1564 pData->maMenuRect.Left() = pData->maMenuRect.Right()-pData->maMenuRect.GetHeight()+1; 1565 nRight -= pData->maMenuRect.GetWidth(); 1566 } 1567 1568 if ( pBorderWindow->mbDockBtn ) 1569 { 1570 pData->maDockRect.Top() = nItemTop; 1571 pData->maDockRect.Bottom() = nItemBottom; 1572 pData->maDockRect.Right() = nRight; 1573 pData->maDockRect.Left() = pData->maDockRect.Right()-pData->maDockRect.GetHeight()+1; 1574 nRight -= pData->maDockRect.GetWidth(); 1575 if ( !pBorderWindow->mbHideBtn && 1576 !(pBorderWindow->GetStyle() & WB_ROLLABLE) ) 1577 nRight -= 3; 1578 } 1579 1580 if ( pBorderWindow->mbHideBtn ) 1581 { 1582 pData->maHideRect.Top() = nItemTop; 1583 pData->maHideRect.Bottom() = nItemBottom; 1584 pData->maHideRect.Right() = nRight; 1585 pData->maHideRect.Left() = pData->maHideRect.Right()-pData->maHideRect.GetHeight()+1; 1586 nRight -= pData->maHideRect.GetWidth(); 1587 if ( !(pBorderWindow->GetStyle() & WB_ROLLABLE) ) 1588 nRight -= 3; 1589 } 1590 1591 if ( pBorderWindow->GetStyle() & WB_ROLLABLE ) 1592 { 1593 pData->maRollRect.Top() = nItemTop; 1594 pData->maRollRect.Bottom() = nItemBottom; 1595 pData->maRollRect.Right() = nRight; 1596 pData->maRollRect.Left() = pData->maRollRect.Right()-pData->maRollRect.GetHeight()+1; 1597 nRight -= pData->maRollRect.GetWidth(); 1598 } 1599 1600 if ( pBorderWindow->mbHelpBtn ) 1601 { 1602 pData->maHelpRect.Top() = nItemTop; 1603 pData->maHelpRect.Bottom() = nItemBottom; 1604 pData->maHelpRect.Right() = nRight; 1605 pData->maHelpRect.Left() = pData->maHelpRect.Right()-pData->maHelpRect.GetHeight()+1; 1606 nRight -= pData->maHelpRect.GetWidth()+3; 1607 } 1608 } 1609 else 1610 { 1611 pData->maPinRect.SetEmpty(); 1612 pData->maCloseRect.SetEmpty(); 1613 pData->maDockRect.SetEmpty(); 1614 pData->maMenuRect.SetEmpty(); 1615 pData->maHideRect.SetEmpty(); 1616 pData->maRollRect.SetEmpty(); 1617 pData->maHelpRect.SetEmpty(); 1618 } 1619 1620 pData->mnTopBorder += pData->mnTitleHeight; 1621 } 1622 else 1623 { 1624 pData->maTitleRect.SetEmpty(); 1625 pData->maPinRect.SetEmpty(); 1626 pData->maCloseRect.SetEmpty(); 1627 pData->maDockRect.SetEmpty(); 1628 pData->maMenuRect.SetEmpty(); 1629 pData->maHideRect.SetEmpty(); 1630 pData->maRollRect.SetEmpty(); 1631 pData->maHelpRect.SetEmpty(); 1632 } 1633 } 1634 1635 // ----------------------------------------------------------------------- 1636 1637 void ImplStdBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, 1638 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const 1639 { 1640 rLeftBorder = maFrameData.mnLeftBorder; 1641 rTopBorder = maFrameData.mnTopBorder; 1642 rRightBorder = maFrameData.mnRightBorder; 1643 rBottomBorder = maFrameData.mnBottomBorder; 1644 } 1645 1646 // ----------------------------------------------------------------------- 1647 1648 long ImplStdBorderWindowView::CalcTitleWidth() const 1649 { 1650 return ImplCalcTitleWidth( &maFrameData ); 1651 } 1652 1653 // ----------------------------------------------------------------------- 1654 1655 void ImplStdBorderWindowView::DrawWindow( sal_uInt16 nDrawFlags, OutputDevice* pOutDev, const Point* pOffset ) 1656 { 1657 ImplBorderFrameData* pData = &maFrameData; 1658 OutputDevice* pDev = pOutDev ? pOutDev : pData->mpOutDev; 1659 ImplBorderWindow* pBorderWindow = pData->mpBorderWindow; 1660 Point aTmpPoint = pOffset ? Point(*pOffset) : Point(); 1661 Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) ); 1662 const StyleSettings& rStyleSettings = pData->mpOutDev->GetSettings().GetStyleSettings(); 1663 DecorationView aDecoView( pDev ); 1664 Color aFrameColor( rStyleSettings.GetFaceColor() ); 1665 1666 aFrameColor.DecreaseContrast( (sal_uInt8) (0.50 * 255)); 1667 1668 // Draw Frame 1669 if ( nDrawFlags & BORDERWINDOW_DRAW_FRAME ) 1670 { 1671 // single line frame 1672 pDev->SetLineColor( aFrameColor ); 1673 pDev->SetFillColor(); 1674 pDev->DrawRect( aInRect ); 1675 aInRect.nLeft++; aInRect.nRight--; 1676 aInRect.nTop++; aInRect.nBottom--; 1677 } 1678 else 1679 aInRect = aDecoView.DrawFrame( aInRect, FRAME_DRAW_DOUBLEOUT | FRAME_DRAW_NODRAW); 1680 1681 // Draw Border 1682 pDev->SetLineColor(); 1683 long nBorderSize = pData->mnBorderSize; 1684 if ( (nDrawFlags & BORDERWINDOW_DRAW_BORDER) && nBorderSize ) 1685 { 1686 pDev->SetFillColor( rStyleSettings.GetFaceColor() ); 1687 pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top() ), 1688 Size( aInRect.GetWidth(), nBorderSize ) ) ); 1689 pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Top()+nBorderSize ), 1690 Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) ); 1691 pDev->DrawRect( Rectangle( Point( aInRect.Left(), aInRect.Bottom()-nBorderSize+1 ), 1692 Size( aInRect.GetWidth(), nBorderSize ) ) ); 1693 pDev->DrawRect( Rectangle( Point( aInRect.Right()-nBorderSize+1, aInRect.Top()+nBorderSize ), 1694 Size( nBorderSize, aInRect.GetHeight()-nBorderSize ) ) ); 1695 } 1696 1697 // Draw Title 1698 if ( (nDrawFlags & BORDERWINDOW_DRAW_TITLE) && !pData->maTitleRect.IsEmpty() ) 1699 { 1700 aInRect = pData->maTitleRect; 1701 1702 // use no gradient anymore, just a static titlecolor 1703 pDev->SetFillColor( aFrameColor ); 1704 pDev->SetTextColor( rStyleSettings.GetButtonTextColor() ); 1705 Rectangle aTitleRect( pData->maTitleRect ); 1706 if( pOffset ) 1707 aTitleRect.Move( pOffset->X(), pOffset->Y() ); 1708 pDev->DrawRect( aTitleRect ); 1709 1710 1711 if ( pData->mnTitleType != BORDERWINDOW_TITLE_TEAROFF ) 1712 { 1713 aInRect.Left() += 2; 1714 aInRect.Right() -= 2; 1715 1716 if ( !pData->maPinRect.IsEmpty() ) 1717 aInRect.Left() = pData->maPinRect.Right()+2; 1718 1719 if ( !pData->maHelpRect.IsEmpty() ) 1720 aInRect.Right() = pData->maHelpRect.Left()-2; 1721 else if ( !pData->maRollRect.IsEmpty() ) 1722 aInRect.Right() = pData->maRollRect.Left()-2; 1723 else if ( !pData->maHideRect.IsEmpty() ) 1724 aInRect.Right() = pData->maHideRect.Left()-2; 1725 else if ( !pData->maDockRect.IsEmpty() ) 1726 aInRect.Right() = pData->maDockRect.Left()-2; 1727 else if ( !pData->maMenuRect.IsEmpty() ) 1728 aInRect.Right() = pData->maMenuRect.Left()-2; 1729 else if ( !pData->maCloseRect.IsEmpty() ) 1730 aInRect.Right() = pData->maCloseRect.Left()-2; 1731 1732 if ( pOffset ) 1733 aInRect.Move( pOffset->X(), pOffset->Y() ); 1734 1735 sal_uInt16 nTextStyle = TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS | TEXT_DRAW_CLIP; 1736 1737 // must show tooltip ? 1738 TextRectInfo aInfo; 1739 pDev->GetTextRect( aInRect, pBorderWindow->GetText(), nTextStyle, &aInfo ); 1740 pData->mbTitleClipped = aInfo.IsEllipses(); 1741 1742 pDev->DrawText( aInRect, pBorderWindow->GetText(), nTextStyle ); 1743 } 1744 } 1745 1746 if ( ((nDrawFlags & BORDERWINDOW_DRAW_CLOSE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) && 1747 !pData->maCloseRect.IsEmpty() ) 1748 { 1749 Rectangle aSymbolRect( pData->maCloseRect ); 1750 if ( pOffset ) 1751 aSymbolRect.Move( pOffset->X(), pOffset->Y() ); 1752 ImplDrawBrdWinSymbolButton( pDev, aSymbolRect, SYMBOL_CLOSE, pData->mnCloseState ); 1753 } 1754 if ( ((nDrawFlags & BORDERWINDOW_DRAW_DOCK) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) && 1755 !pData->maDockRect.IsEmpty() ) 1756 { 1757 Rectangle aSymbolRect( pData->maDockRect ); 1758 if ( pOffset ) 1759 aSymbolRect.Move( pOffset->X(), pOffset->Y() ); 1760 ImplDrawBrdWinSymbolButton( pDev, aSymbolRect, SYMBOL_DOCK, pData->mnDockState ); 1761 } 1762 if ( ((nDrawFlags & BORDERWINDOW_DRAW_MENU) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) && 1763 !pData->maMenuRect.IsEmpty() ) 1764 { 1765 Rectangle aSymbolRect( pData->maMenuRect ); 1766 if ( pOffset ) 1767 aSymbolRect.Move( pOffset->X(), pOffset->Y() ); 1768 ImplDrawBrdWinSymbolButton( pDev, aSymbolRect, SYMBOL_MENU, pData->mnMenuState ); 1769 } 1770 if ( ((nDrawFlags & BORDERWINDOW_DRAW_HIDE) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) && 1771 !pData->maHideRect.IsEmpty() ) 1772 { 1773 Rectangle aSymbolRect( pData->maHideRect ); 1774 if ( pOffset ) 1775 aSymbolRect.Move( pOffset->X(), pOffset->Y() ); 1776 ImplDrawBrdWinSymbolButton( pDev, aSymbolRect, SYMBOL_HIDE, pData->mnHideState ); 1777 } 1778 if ( ((nDrawFlags & BORDERWINDOW_DRAW_ROLL) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) && 1779 !pData->maRollRect.IsEmpty() ) 1780 { 1781 SymbolType eType; 1782 if ( pBorderWindow->mbRollUp ) 1783 eType = SYMBOL_ROLLDOWN; 1784 else 1785 eType = SYMBOL_ROLLUP; 1786 Rectangle aSymbolRect( pData->maRollRect ); 1787 if ( pOffset ) 1788 aSymbolRect.Move( pOffset->X(), pOffset->Y() ); 1789 ImplDrawBrdWinSymbolButton( pDev, aSymbolRect, eType, pData->mnRollState ); 1790 } 1791 1792 if ( ((nDrawFlags & BORDERWINDOW_DRAW_HELP) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) && 1793 !pData->maHelpRect.IsEmpty() ) 1794 { 1795 Rectangle aSymbolRect( pData->maHelpRect ); 1796 if ( pOffset ) 1797 aSymbolRect.Move( pOffset->X(), pOffset->Y() ); 1798 ImplDrawBrdWinSymbolButton( pDev, aSymbolRect, SYMBOL_HELP, pData->mnHelpState ); 1799 } 1800 if ( ((nDrawFlags & BORDERWINDOW_DRAW_PIN) || (nDrawFlags & BORDERWINDOW_DRAW_TITLE)) && 1801 !pData->maPinRect.IsEmpty() ) 1802 { 1803 Image aImage; 1804 ImplGetPinImage( pData->mnPinState, pBorderWindow->mbPined, aImage ); 1805 Size aImageSize = aImage.GetSizePixel(); 1806 long nRectHeight = pData->maPinRect.GetHeight(); 1807 Point aPos( pData->maPinRect.TopLeft() ); 1808 if ( pOffset ) 1809 aPos.Move( pOffset->X(), pOffset->Y() ); 1810 if ( nRectHeight < aImageSize.Height() ) 1811 { 1812 pDev->DrawImage( aPos, Size( aImageSize.Width(), nRectHeight ), aImage ); 1813 } 1814 else 1815 { 1816 aPos.Y() += (nRectHeight-aImageSize.Height())/2; 1817 pDev->DrawImage( aPos, aImage ); 1818 } 1819 } 1820 } 1821 1822 1823 // ======================================================================= 1824 void ImplBorderWindow::ImplInit( Window* pParent, 1825 WinBits nStyle, sal_uInt16 nTypeStyle, 1826 const ::com::sun::star::uno::Any& ) 1827 { 1828 ImplInit( pParent, nStyle, nTypeStyle, NULL ); 1829 } 1830 1831 void ImplBorderWindow::ImplInit( Window* pParent, 1832 WinBits nStyle, sal_uInt16 nTypeStyle, 1833 SystemParentData* pSystemParentData 1834 ) 1835 { 1836 // Alle WindowBits entfernen, die wir nicht haben wollen 1837 WinBits nOrgStyle = nStyle; 1838 WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_PINABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW | WB_NEEDSFOCUS); 1839 if ( nTypeStyle & BORDERWINDOW_STYLE_APP ) 1840 nTestStyle |= WB_APP; 1841 nStyle &= nTestStyle; 1842 1843 mpWindowImpl->mbBorderWin = sal_True; 1844 mbSmallOutBorder = sal_False; 1845 if ( nTypeStyle & BORDERWINDOW_STYLE_FRAME ) 1846 { 1847 if( (nStyle & WB_SYSTEMCHILDWINDOW) ) 1848 { 1849 mpWindowImpl->mbOverlapWin = sal_True; 1850 mpWindowImpl->mbFrame = sal_True; 1851 mbFrameBorder = sal_False; 1852 } 1853 else if( (nStyle & WB_OWNERDRAWDECORATION) ) 1854 { 1855 mpWindowImpl->mbOverlapWin = sal_True; 1856 mpWindowImpl->mbFrame = sal_True; 1857 mbFrameBorder = (nOrgStyle & WB_NOBORDER) ? sal_False : sal_True; 1858 } 1859 else 1860 { 1861 mpWindowImpl->mbOverlapWin = sal_True; 1862 mpWindowImpl->mbFrame = sal_True; 1863 mbFrameBorder = sal_False; 1864 // closeable windows may have a border as well, eg. system floating windows without caption 1865 if ( (nOrgStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE/* | WB_CLOSEABLE*/)) == WB_BORDER ) 1866 mbSmallOutBorder = sal_True; 1867 } 1868 } 1869 else if ( nTypeStyle & BORDERWINDOW_STYLE_OVERLAP ) 1870 { 1871 mpWindowImpl->mbOverlapWin = sal_True; 1872 mbFrameBorder = sal_True; 1873 } 1874 else 1875 mbFrameBorder = sal_False; 1876 1877 if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) 1878 mbFloatWindow = sal_True; 1879 else 1880 mbFloatWindow = sal_False; 1881 1882 Window::ImplInit( pParent, nStyle, pSystemParentData ); 1883 SetBackground(); 1884 SetTextFillColor(); 1885 1886 mpMenuBarWindow = NULL; 1887 mnMinWidth = 0; 1888 mnMinHeight = 0; 1889 mnMaxWidth = SHRT_MAX; 1890 mnMaxHeight = SHRT_MAX; 1891 mnRollHeight = 0; 1892 mnOrgMenuHeight = 0; 1893 mbPined = sal_False; 1894 mbRollUp = sal_False; 1895 mbMenuHide = sal_False; 1896 mbDockBtn = sal_False; 1897 mbMenuBtn = sal_False; 1898 mbHideBtn = sal_False; 1899 mbHelpBtn = sal_False; 1900 mbDisplayActive = IsActive(); 1901 1902 if ( nTypeStyle & BORDERWINDOW_STYLE_FLOAT ) 1903 mnTitleType = BORDERWINDOW_TITLE_SMALL; 1904 else 1905 mnTitleType = BORDERWINDOW_TITLE_NORMAL; 1906 mnBorderStyle = WINDOW_BORDER_NORMAL; 1907 InitView(); 1908 } 1909 1910 // ======================================================================= 1911 1912 ImplBorderWindow::ImplBorderWindow( Window* pParent, 1913 SystemParentData* pSystemParentData, 1914 WinBits nStyle, sal_uInt16 nTypeStyle 1915 ) : Window( WINDOW_BORDERWINDOW ) 1916 { 1917 ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData ); 1918 } 1919 1920 // ----------------------------------------------------------------------- 1921 1922 ImplBorderWindow::ImplBorderWindow( Window* pParent, WinBits nStyle , 1923 sal_uInt16 nTypeStyle ) : 1924 Window( WINDOW_BORDERWINDOW ) 1925 { 1926 ImplInit( pParent, nStyle, nTypeStyle, ::com::sun::star::uno::Any() ); 1927 } 1928 1929 ImplBorderWindow::ImplBorderWindow( Window* pParent, 1930 WinBits nStyle, sal_uInt16 nTypeStyle, 1931 const ::com::sun::star::uno::Any& aSystemToken ) : 1932 Window( WINDOW_BORDERWINDOW ) 1933 { 1934 ImplInit( pParent, nStyle, nTypeStyle, aSystemToken ); 1935 } 1936 1937 // ----------------------------------------------------------------------- 1938 1939 ImplBorderWindow::~ImplBorderWindow() 1940 { 1941 delete mpBorderView; 1942 } 1943 1944 // ----------------------------------------------------------------------- 1945 1946 void ImplBorderWindow::MouseMove( const MouseEvent& rMEvt ) 1947 { 1948 mpBorderView->MouseMove( rMEvt ); 1949 } 1950 1951 // ----------------------------------------------------------------------- 1952 1953 void ImplBorderWindow::MouseButtonDown( const MouseEvent& rMEvt ) 1954 { 1955 mpBorderView->MouseButtonDown( rMEvt ); 1956 } 1957 1958 // ----------------------------------------------------------------------- 1959 1960 void ImplBorderWindow::Tracking( const TrackingEvent& rTEvt ) 1961 { 1962 mpBorderView->Tracking( rTEvt ); 1963 } 1964 1965 // ----------------------------------------------------------------------- 1966 1967 void ImplBorderWindow::Paint( const Rectangle& ) 1968 { 1969 mpBorderView->DrawWindow( BORDERWINDOW_DRAW_ALL ); 1970 } 1971 1972 void ImplBorderWindow::Draw( const Rectangle&, OutputDevice* pOutDev, const Point& rPos ) 1973 { 1974 mpBorderView->DrawWindow( BORDERWINDOW_DRAW_ALL, pOutDev, &rPos ); 1975 } 1976 1977 // ----------------------------------------------------------------------- 1978 1979 void ImplBorderWindow::Activate() 1980 { 1981 SetDisplayActive( sal_True ); 1982 Window::Activate(); 1983 } 1984 1985 // ----------------------------------------------------------------------- 1986 1987 void ImplBorderWindow::Deactivate() 1988 { 1989 // Fenster die immer Active sind, nehmen wir von dieser Regel aus, 1990 // genauso, wenn ein Menu aktiv wird, ignorieren wir das Deactivate 1991 if ( GetActivateMode() && !ImplGetSVData()->maWinData.mbNoDeactivate ) 1992 SetDisplayActive( sal_False ); 1993 Window::Deactivate(); 1994 } 1995 1996 // ----------------------------------------------------------------------- 1997 1998 void ImplBorderWindow::RequestHelp( const HelpEvent& rHEvt ) 1999 { 2000 // no keyboard help for border win 2001 if ( rHEvt.GetMode() & (HELPMODE_BALLOON | HELPMODE_QUICK) && !rHEvt.KeyboardActivated() ) 2002 { 2003 Point aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() ); 2004 Rectangle aHelpRect; 2005 String aHelpStr( mpBorderView->RequestHelp( aMousePosPixel, aHelpRect ) ); 2006 2007 // Rechteck ermitteln 2008 if ( aHelpStr.Len() ) 2009 { 2010 aHelpRect.SetPos( OutputToScreenPixel( aHelpRect.TopLeft() ) ); 2011 if ( rHEvt.GetMode() & HELPMODE_BALLOON ) 2012 Help::ShowBalloon( this, aHelpRect.Center(), aHelpRect, aHelpStr ); 2013 else 2014 Help::ShowQuickHelp( this, aHelpRect, aHelpStr ); 2015 return; 2016 } 2017 } 2018 2019 Window::RequestHelp( rHEvt ); 2020 } 2021 2022 // ----------------------------------------------------------------------- 2023 2024 void ImplBorderWindow::Resize() 2025 { 2026 Size aSize = GetOutputSizePixel(); 2027 2028 if ( !mbRollUp ) 2029 { 2030 Window* pClientWindow = ImplGetClientWindow(); 2031 2032 if ( mpMenuBarWindow ) 2033 { 2034 sal_Int32 nLeftBorder; 2035 sal_Int32 nTopBorder; 2036 sal_Int32 nRightBorder; 2037 sal_Int32 nBottomBorder; 2038 long nMenuHeight = mpMenuBarWindow->GetSizePixel().Height(); 2039 if ( mbMenuHide ) 2040 { 2041 if ( nMenuHeight ) 2042 mnOrgMenuHeight = nMenuHeight; 2043 nMenuHeight = 0; 2044 } 2045 else 2046 { 2047 if ( !nMenuHeight ) 2048 nMenuHeight = mnOrgMenuHeight; 2049 } 2050 mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); 2051 mpMenuBarWindow->SetPosSizePixel( nLeftBorder, 2052 nTopBorder, 2053 aSize.Width()-nLeftBorder-nRightBorder, 2054 nMenuHeight, 2055 WINDOW_POSSIZE_POS | 2056 WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT ); 2057 } 2058 2059 GetBorder( pClientWindow->mpWindowImpl->mnLeftBorder, pClientWindow->mpWindowImpl->mnTopBorder, 2060 pClientWindow->mpWindowImpl->mnRightBorder, pClientWindow->mpWindowImpl->mnBottomBorder ); 2061 pClientWindow->ImplPosSizeWindow( pClientWindow->mpWindowImpl->mnLeftBorder, 2062 pClientWindow->mpWindowImpl->mnTopBorder, 2063 aSize.Width()-pClientWindow->mpWindowImpl->mnLeftBorder-pClientWindow->mpWindowImpl->mnRightBorder, 2064 aSize.Height()-pClientWindow->mpWindowImpl->mnTopBorder-pClientWindow->mpWindowImpl->mnBottomBorder, 2065 WINDOW_POSSIZE_X | WINDOW_POSSIZE_Y | 2066 WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT ); 2067 } 2068 2069 // UpdateView 2070 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2071 InvalidateBorder(); 2072 2073 Window::Resize(); 2074 } 2075 2076 // ----------------------------------------------------------------------- 2077 2078 void ImplBorderWindow::StateChanged( StateChangedType nType ) 2079 { 2080 if ( (nType == STATE_CHANGE_TEXT) || 2081 (nType == STATE_CHANGE_IMAGE) || 2082 (nType == STATE_CHANGE_DATA) ) 2083 { 2084 if ( IsReallyVisible() && mbFrameBorder ) 2085 { 2086 if ( HasPaintEvent() ) 2087 InvalidateBorder(); 2088 else 2089 mpBorderView->DrawWindow( BORDERWINDOW_DRAW_TITLE ); 2090 } 2091 } 2092 2093 Window::StateChanged( nType ); 2094 } 2095 2096 // ----------------------------------------------------------------------- 2097 2098 void ImplBorderWindow::DataChanged( const DataChangedEvent& rDCEvt ) 2099 { 2100 if ( (rDCEvt.GetType() == DATACHANGED_FONTS) || 2101 (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) || 2102 ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && 2103 (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) 2104 { 2105 if ( !mpWindowImpl->mbFrame || (GetStyle() & WB_OWNERDRAWDECORATION) ) 2106 UpdateView( sal_True, ImplGetWindow()->GetOutputSizePixel() ); 2107 } 2108 2109 Window::DataChanged( rDCEvt ); 2110 } 2111 2112 // ----------------------------------------------------------------------- 2113 2114 void ImplBorderWindow::InitView() 2115 { 2116 if ( mbSmallOutBorder ) 2117 mpBorderView = new ImplSmallBorderWindowView( this ); 2118 else if ( mpWindowImpl->mbFrame ) 2119 { 2120 if( mbFrameBorder ) 2121 mpBorderView = new ImplStdBorderWindowView( this ); 2122 else 2123 mpBorderView = new ImplNoBorderWindowView( this ); 2124 } 2125 else if ( !mbFrameBorder ) 2126 mpBorderView = new ImplSmallBorderWindowView( this ); 2127 else 2128 mpBorderView = new ImplStdBorderWindowView( this ); 2129 Size aSize = GetOutputSizePixel(); 2130 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2131 } 2132 2133 // ----------------------------------------------------------------------- 2134 2135 void ImplBorderWindow::UpdateView( sal_Bool bNewView, const Size& rNewOutSize ) 2136 { 2137 sal_Int32 nLeftBorder; 2138 sal_Int32 nTopBorder; 2139 sal_Int32 nRightBorder; 2140 sal_Int32 nBottomBorder; 2141 Size aOldSize = GetSizePixel(); 2142 Size aOutputSize = rNewOutSize; 2143 2144 if ( bNewView ) 2145 { 2146 delete mpBorderView; 2147 InitView(); 2148 } 2149 else 2150 { 2151 Size aSize = aOutputSize; 2152 mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); 2153 aSize.Width() += nLeftBorder+nRightBorder; 2154 aSize.Height() += nTopBorder+nBottomBorder; 2155 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2156 } 2157 2158 Window* pClientWindow = ImplGetClientWindow(); 2159 if ( pClientWindow ) 2160 { 2161 GetBorder( pClientWindow->mpWindowImpl->mnLeftBorder, pClientWindow->mpWindowImpl->mnTopBorder, 2162 pClientWindow->mpWindowImpl->mnRightBorder, pClientWindow->mpWindowImpl->mnBottomBorder ); 2163 } 2164 GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); 2165 if ( aOldSize.Width() || aOldSize.Height() ) 2166 { 2167 aOutputSize.Width() += nLeftBorder+nRightBorder; 2168 aOutputSize.Height() += nTopBorder+nBottomBorder; 2169 if ( aOutputSize == GetSizePixel() ) 2170 InvalidateBorder(); 2171 else 2172 SetSizePixel( aOutputSize ); 2173 } 2174 } 2175 2176 // ----------------------------------------------------------------------- 2177 2178 void ImplBorderWindow::InvalidateBorder() 2179 { 2180 if ( IsReallyVisible() ) 2181 { 2182 // Nur wenn wir einen Border haben, muessen wir auch invalidieren 2183 sal_Int32 nLeftBorder; 2184 sal_Int32 nTopBorder; 2185 sal_Int32 nRightBorder; 2186 sal_Int32 nBottomBorder; 2187 mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder ); 2188 if ( nLeftBorder || nTopBorder || nRightBorder || nBottomBorder ) 2189 { 2190 Rectangle aWinRect( Point( 0, 0 ), GetOutputSizePixel() ); 2191 Region aRegion( aWinRect ); 2192 aWinRect.Left() += nLeftBorder; 2193 aWinRect.Top() += nTopBorder; 2194 aWinRect.Right() -= nRightBorder; 2195 aWinRect.Bottom() -= nBottomBorder; 2196 // kein Output-Bereich mehr, dann alles invalidieren 2197 if ( (aWinRect.Right() < aWinRect.Left()) || 2198 (aWinRect.Bottom() < aWinRect.Top()) ) 2199 Invalidate( INVALIDATE_NOCHILDREN ); 2200 else 2201 { 2202 aRegion.Exclude( aWinRect ); 2203 Invalidate( aRegion, INVALIDATE_NOCHILDREN ); 2204 } 2205 } 2206 } 2207 } 2208 2209 // ----------------------------------------------------------------------- 2210 2211 void ImplBorderWindow::SetDisplayActive( sal_Bool bActive ) 2212 { 2213 if ( mbDisplayActive != bActive ) 2214 { 2215 mbDisplayActive = bActive; 2216 if ( mbFrameBorder ) 2217 InvalidateBorder(); 2218 } 2219 } 2220 2221 // ----------------------------------------------------------------------- 2222 2223 void ImplBorderWindow::SetTitleType( sal_uInt16 nTitleType, const Size& rSize ) 2224 { 2225 mnTitleType = nTitleType; 2226 UpdateView( sal_False, rSize ); 2227 } 2228 2229 // ----------------------------------------------------------------------- 2230 2231 void ImplBorderWindow::SetBorderStyle( sal_uInt16 nStyle ) 2232 { 2233 if ( !mbFrameBorder && (mnBorderStyle != nStyle) ) 2234 { 2235 mnBorderStyle = nStyle; 2236 UpdateView( sal_False, ImplGetWindow()->GetOutputSizePixel() ); 2237 } 2238 } 2239 2240 // ----------------------------------------------------------------------- 2241 2242 void ImplBorderWindow::SetPin( sal_Bool bPin ) 2243 { 2244 mbPined = bPin; 2245 InvalidateBorder(); 2246 } 2247 2248 // ----------------------------------------------------------------------- 2249 2250 void ImplBorderWindow::SetRollUp( sal_Bool bRollUp, const Size& rSize ) 2251 { 2252 mbRollUp = bRollUp; 2253 mnRollHeight = rSize.Height(); 2254 UpdateView( sal_False, rSize ); 2255 } 2256 2257 // ----------------------------------------------------------------------- 2258 2259 void ImplBorderWindow::SetCloser() 2260 { 2261 SetStyle( GetStyle() | WB_CLOSEABLE ); 2262 Size aSize = GetOutputSizePixel(); 2263 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2264 InvalidateBorder(); 2265 } 2266 2267 // ----------------------------------------------------------------------- 2268 2269 void ImplBorderWindow::SetDockButton( sal_Bool bDockButton ) 2270 { 2271 mbDockBtn = bDockButton; 2272 Size aSize = GetOutputSizePixel(); 2273 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2274 InvalidateBorder(); 2275 } 2276 2277 // ----------------------------------------------------------------------- 2278 2279 void ImplBorderWindow::SetHideButton( sal_Bool bHideButton ) 2280 { 2281 mbHideBtn = bHideButton; 2282 Size aSize = GetOutputSizePixel(); 2283 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2284 InvalidateBorder(); 2285 } 2286 2287 // ----------------------------------------------------------------------- 2288 2289 void ImplBorderWindow::SetHelpButton( sal_Bool bHelpButton ) 2290 { 2291 mbHelpBtn = bHelpButton; 2292 Size aSize = GetOutputSizePixel(); 2293 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2294 InvalidateBorder(); 2295 } 2296 2297 // ----------------------------------------------------------------------- 2298 2299 void ImplBorderWindow::SetMenuButton( sal_Bool bMenuButton ) 2300 { 2301 mbMenuBtn = bMenuButton; 2302 Size aSize = GetOutputSizePixel(); 2303 mpBorderView->Init( this, aSize.Width(), aSize.Height() ); 2304 InvalidateBorder(); 2305 } 2306 2307 // ----------------------------------------------------------------------- 2308 2309 void ImplBorderWindow::UpdateMenuHeight() 2310 { 2311 Resize(); 2312 } 2313 2314 // ----------------------------------------------------------------------- 2315 2316 void ImplBorderWindow::SetMenuBarWindow( Window* pWindow ) 2317 { 2318 mpMenuBarWindow = pWindow; 2319 UpdateMenuHeight(); 2320 if ( pWindow ) 2321 pWindow->Show(); 2322 } 2323 2324 // ----------------------------------------------------------------------- 2325 2326 void ImplBorderWindow::SetMenuBarMode( sal_Bool bHide ) 2327 { 2328 mbMenuHide = bHide; 2329 UpdateMenuHeight(); 2330 } 2331 2332 // ----------------------------------------------------------------------- 2333 2334 void ImplBorderWindow::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, 2335 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const 2336 { 2337 mpBorderView->GetBorder( rLeftBorder, rTopBorder, rRightBorder, rBottomBorder ); 2338 if ( mpMenuBarWindow && !mbMenuHide ) 2339 rTopBorder += mpMenuBarWindow->GetSizePixel().Height(); 2340 } 2341 2342 // ----------------------------------------------------------------------- 2343 2344 long ImplBorderWindow::CalcTitleWidth() const 2345 { 2346 return mpBorderView->CalcTitleWidth(); 2347 } 2348 2349 Rectangle ImplBorderWindow::GetMenuRect() const 2350 { 2351 return mpBorderView->GetMenuRect(); 2352 } 2353