LCOV - code coverage report
Current view: top level - libreoffice/vcl/source/window - brdwin.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 228 1242 18.4 %
Date: 2012-12-27 Functions: 30 76 39.5 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10