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