floatwin.cxx (9f62ea84) floatwin.cxx (dd7ece3a)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_vcl.hxx"
26
27#include <svdata.hxx>

--- 49 unchanged lines hidden (view full) ---

77
78 DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL!" );
79
80 if ( !pParent )
81 pParent = ImplGetSVData()->maWinData.mpAppWin;
82
83 DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists" );
84
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_vcl.hxx"
26
27#include <svdata.hxx>

--- 49 unchanged lines hidden (view full) ---

77
78 DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL!" );
79
80 if ( !pParent )
81 pParent = ImplGetSVData()->maWinData.mpAppWin;
82
83 DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists" );
84
85 // no Border, then we dont need a border window
85 // no Border, then we don't need a border window
86 if ( !nStyle )
87 {
88 mpWindowImpl->mbOverlapWin = sal_True;
89 nStyle |= WB_DIALOGCONTROL;
90 SystemWindow::ImplInit( pParent, nStyle, NULL );
91 }
92 else
93 {
94 if ( !(nStyle & WB_NODIALOGCONTROL) )
95 nStyle |= WB_DIALOGCONTROL;
96
97 if( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)
98 && !(nStyle & WB_OWNERDRAWDECORATION) )
99 {
100 WinBits nFloatWinStyle = nStyle;
86 if ( !nStyle )
87 {
88 mpWindowImpl->mbOverlapWin = sal_True;
89 nStyle |= WB_DIALOGCONTROL;
90 SystemWindow::ImplInit( pParent, nStyle, NULL );
91 }
92 else
93 {
94 if ( !(nStyle & WB_NODIALOGCONTROL) )
95 nStyle |= WB_DIALOGCONTROL;
96
97 if( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)
98 && !(nStyle & WB_OWNERDRAWDECORATION) )
99 {
100 WinBits nFloatWinStyle = nStyle;
101 // #99154# floaters are not closeable by default anymore, eg fullscreen floater
101 // #99154# floaters are not closeable by default anymore, e.g. fullscreen floater
102 // nFloatWinStyle |= WB_CLOSEABLE;
103 mpWindowImpl->mbFrame = sal_True;
104 mpWindowImpl->mbOverlapWin = sal_True;
105 SystemWindow::ImplInit( pParent, nFloatWinStyle & ~WB_BORDER, NULL );
106 }
107 else
108 {
109 ImplBorderWindow* pBorderWin;

--- 135 unchanged lines hidden (view full) ---

245 sal_uInt16& rArrangeIndex )
246{
247 // Fenster-Position ermitteln
248 Point aPos;
249 Size aSize = pWindow->GetSizePixel();
250 Rectangle aScreenRect = pWindow->ImplGetFrameWindow()->GetDesktopRectPixel();
251 FloatingWindow *pFloatingWindow = dynamic_cast<FloatingWindow*>( pWindow );
252
102 // nFloatWinStyle |= WB_CLOSEABLE;
103 mpWindowImpl->mbFrame = sal_True;
104 mpWindowImpl->mbOverlapWin = sal_True;
105 SystemWindow::ImplInit( pParent, nFloatWinStyle & ~WB_BORDER, NULL );
106 }
107 else
108 {
109 ImplBorderWindow* pBorderWin;

--- 135 unchanged lines hidden (view full) ---

245 sal_uInt16& rArrangeIndex )
246{
247 // Fenster-Position ermitteln
248 Point aPos;
249 Size aSize = pWindow->GetSizePixel();
250 Rectangle aScreenRect = pWindow->ImplGetFrameWindow()->GetDesktopRectPixel();
251 FloatingWindow *pFloatingWindow = dynamic_cast<FloatingWindow*>( pWindow );
252
253 // convert....
253 // convert...
254 Window* pW = pWindow;
255 if ( pW->mpWindowImpl->mpRealParent )
256 pW = pW->mpWindowImpl->mpRealParent;
257
258 Rectangle normRect( rRect ); // rRect is already relative to top-level window
259 normRect.SetPos( pW->ScreenToOutputPixel( normRect.TopLeft() ) );
260
261 sal_Bool bRTL = Application::GetSettings().GetLayoutRTL();
262
254 Window* pW = pWindow;
255 if ( pW->mpWindowImpl->mpRealParent )
256 pW = pW->mpWindowImpl->mpRealParent;
257
258 Rectangle normRect( rRect ); // rRect is already relative to top-level window
259 normRect.SetPos( pW->ScreenToOutputPixel( normRect.TopLeft() ) );
260
261 sal_Bool bRTL = Application::GetSettings().GetLayoutRTL();
262
263 Rectangle devRect( pW->OutputToAbsoluteScreenPixel( normRect.TopLeft() ),
263 Rectangle devRect( pW->OutputToAbsoluteScreenPixel( normRect.TopLeft() ),
264 pW->OutputToAbsoluteScreenPixel( normRect.BottomRight() ) );
265
266 Rectangle devRectRTL( devRect );
267 if( bRTL )
268 // create a rect that can be compared to desktop coordinates
269 devRectRTL = pW->ImplOutputToUnmirroredAbsoluteScreenPixel( normRect );
270 if( Application::GetScreenCount() > 1 && ! Application::IsMultiDisplay() )
271 aScreenRect = Application::GetScreenPosSizePixel(

--- 58 unchanged lines hidden (view full) ---

330 bBreak = sal_False;
331 }
332 else
333 {
334 if ( aPos.X() < aScreenRect.Left() )
335 bBreak = sal_False;
336 }
337 if( bBreak )
264 pW->OutputToAbsoluteScreenPixel( normRect.BottomRight() ) );
265
266 Rectangle devRectRTL( devRect );
267 if( bRTL )
268 // create a rect that can be compared to desktop coordinates
269 devRectRTL = pW->ImplOutputToUnmirroredAbsoluteScreenPixel( normRect );
270 if( Application::GetScreenCount() > 1 && ! Application::IsMultiDisplay() )
271 aScreenRect = Application::GetScreenPosSizePixel(

--- 58 unchanged lines hidden (view full) ---

330 bBreak = sal_False;
331 }
332 else
333 {
334 if ( aPos.X() < aScreenRect.Left() )
335 bBreak = sal_False;
336 }
337 if( bBreak )
338 {
338 {
339 e1 = devRect.TopLeft();
340 e2 = devRect.BottomLeft();
341 // set non-zero width
342 e2.X()++;
343 // don't clip corners
339 e1 = devRect.TopLeft();
340 e2 = devRect.BottomLeft();
341 // set non-zero width
342 e2.X()++;
343 // don't clip corners
344 e1.Y()++;
344 e1.Y()++;
345 e2.Y()--;
346 }
347 break;
348 case FLOATWIN_POPUPMODE_RIGHT:
349 aPos = devRect.TopRight();
350 aPos.Y() -= pWindow->mpWindowImpl->mnTopBorder;
351 if( bRTL ) // --- RTL --- we're comparing screen coordinates here
352 {
353 if( (devRectRTL.Left() - aSize.Width()) < aScreenRect.Left() )
354 bBreak = sal_False;
355 }
356 else
357 {
358 if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
359 bBreak = sal_False;
360 }
361 if( bBreak )
345 e2.Y()--;
346 }
347 break;
348 case FLOATWIN_POPUPMODE_RIGHT:
349 aPos = devRect.TopRight();
350 aPos.Y() -= pWindow->mpWindowImpl->mnTopBorder;
351 if( bRTL ) // --- RTL --- we're comparing screen coordinates here
352 {
353 if( (devRectRTL.Left() - aSize.Width()) < aScreenRect.Left() )
354 bBreak = sal_False;
355 }
356 else
357 {
358 if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
359 bBreak = sal_False;
360 }
361 if( bBreak )
362 {
362 {
363 e1 = devRect.TopRight();
364 e2 = devRect.BottomRight();
365 // set non-zero width
366 e2.X()++;
367 // don't clip corners
363 e1 = devRect.TopRight();
364 e2 = devRect.BottomRight();
365 // set non-zero width
366 e2.X()++;
367 // don't clip corners
368 e1.Y()++;
368 e1.Y()++;
369 e2.Y()--;
370 }
371 break;
372 case FLOATWIN_POPUPMODE_UP:
373 aPos.X() = devRect.Left();
374 aPos.Y() = devRect.Top()-aSize.Height()+1;
375 if ( aPos.Y() < aScreenRect.Top() )
376 bBreak = sal_False;
377 if( bBreak )
369 e2.Y()--;
370 }
371 break;
372 case FLOATWIN_POPUPMODE_UP:
373 aPos.X() = devRect.Left();
374 aPos.Y() = devRect.Top()-aSize.Height()+1;
375 if ( aPos.Y() < aScreenRect.Top() )
376 bBreak = sal_False;
377 if( bBreak )
378 {
378 {
379 e1 = devRect.TopLeft();
380 e2 = devRect.TopRight();
381 // set non-zero height
382 e2.Y()++;
383 // don't clip corners
379 e1 = devRect.TopLeft();
380 e2 = devRect.TopRight();
381 // set non-zero height
382 e2.Y()++;
383 // don't clip corners
384 e1.X()++;
384 e1.X()++;
385 e2.X()--;
386 }
387 break;
388 case FLOATWIN_POPUPMODE_DOWN:
389 aPos = devRect.BottomLeft();
390 if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
391 bBreak = sal_False;
392 if( bBreak )
385 e2.X()--;
386 }
387 break;
388 case FLOATWIN_POPUPMODE_DOWN:
389 aPos = devRect.BottomLeft();
390 if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
391 bBreak = sal_False;
392 if( bBreak )
393 {
393 {
394 e1 = devRect.BottomLeft();
395 e2 = devRect.BottomRight();
396 // set non-zero height
397 e2.Y()++;
398 // don't clip corners
394 e1 = devRect.BottomLeft();
395 e2 = devRect.BottomRight();
396 // set non-zero height
397 e2.Y()++;
398 // don't clip corners
399 e1.X()++;
399 e1.X()++;
400 e2.X()--;
401 }
402 break;
403 }
404
405 // Evt. noch anpassen
406 if ( bBreak && !(nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE) )
407 {

--- 40 unchanged lines hidden (view full) ---

448
449 // store a cliprect that can be used to clip the common edge of the itemrect and the floating window
450 if( pFloatingWindow )
451 {
452 pFloatingWindow->mpImplData->maItemEdgeClipRect =
453 Rectangle( e1, e2 );
454 }
455
400 e2.X()--;
401 }
402 break;
403 }
404
405 // Evt. noch anpassen
406 if ( bBreak && !(nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE) )
407 {

--- 40 unchanged lines hidden (view full) ---

448
449 // store a cliprect that can be used to clip the common edge of the itemrect and the floating window
450 if( pFloatingWindow )
451 {
452 pFloatingWindow->mpImplData->maItemEdgeClipRect =
453 Rectangle( e1, e2 );
454 }
455
456 // caller expects cordinates relative to top-level win
456 // caller expects coordinates relative to top-level win
457 return pW->OutputToScreenPixel( aPos );
458}
459
460// -----------------------------------------------------------------------
461
462FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest )
463{
464 FloatingWindow* pWin = this;
465
466 Point aAbsolute( rPos );
467
468 // compare coordinates in absolute screen coordinates
469 if( pReference->ImplHasMirroredGraphics() )
470 {
471 if(!pReference->IsRTLEnabled() )
457 return pW->OutputToScreenPixel( aPos );
458}
459
460// -----------------------------------------------------------------------
461
462FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest )
463{
464 FloatingWindow* pWin = this;
465
466 Point aAbsolute( rPos );
467
468 // compare coordinates in absolute screen coordinates
469 if( pReference->ImplHasMirroredGraphics() )
470 {
471 if(!pReference->IsRTLEnabled() )
472 // --- RTL --- re-mirror back to get device coordiantes
472 // --- RTL --- re-mirror back to get device coordinates
473 pReference->ImplReMirror( aAbsolute );
474
475 Rectangle aRect( pReference->ScreenToOutputPixel(aAbsolute), Size(1,1) ) ;
476 aRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel( aRect );
477 aAbsolute = aRect.TopLeft();
478 }
479 else
480 aAbsolute = Point( pReference->OutputToAbsoluteScreenPixel(
481 pReference->ScreenToOutputPixel(rPos) ) );
473 pReference->ImplReMirror( aAbsolute );
474
475 Rectangle aRect( pReference->ScreenToOutputPixel(aAbsolute), Size(1,1) ) ;
476 aRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel( aRect );
477 aAbsolute = aRect.TopLeft();
478 }
479 else
480 aAbsolute = Point( pReference->OutputToAbsoluteScreenPixel(
481 pReference->ScreenToOutputPixel(rPos) ) );
482
482
483 do
484 {
485 // compute the floating window's size in absolute screen coordinates
486
487 // use the border window to have the exact position
488 Window *pBorderWin = pWin->GetWindow( WINDOW_BORDER );
489
483 do
484 {
485 // compute the floating window's size in absolute screen coordinates
486
487 // use the border window to have the exact position
488 Window *pBorderWin = pWin->GetWindow( WINDOW_BORDER );
489
490 Point aPt; // the top-left corner in output coordinates ie (0,0)
490 Point aPt; // the top-left corner in output coordinates i.e. (0,0)
491 Rectangle devRect( pBorderWin->ImplOutputToUnmirroredAbsoluteScreenPixel( Rectangle( aPt, pBorderWin->GetSizePixel()) ) ) ;
492 if ( devRect.IsInside( aAbsolute ) )
493 {
494 rHitTest = IMPL_FLOATWIN_HITTEST_WINDOW;
495 return pWin;
496 }
497
491 Rectangle devRect( pBorderWin->ImplOutputToUnmirroredAbsoluteScreenPixel( Rectangle( aPt, pBorderWin->GetSizePixel()) ) ) ;
492 if ( devRect.IsInside( aAbsolute ) )
493 {
494 rHitTest = IMPL_FLOATWIN_HITTEST_WINDOW;
495 return pWin;
496 }
497
498 // test, if mouse is in rectangle, (this is typically the rect of the active
499 // toolbox item or similar)
498 // test, if mouse is in rectangle, (this is typically the rect of the active
499 // toolbox item or similar)
500 // note: maFloatRect is set in FloatingWindow::StartPopupMode() and
501 // is already in absolute device coordinates
502 if ( pWin->maFloatRect.IsInside( aAbsolute ) )
503 {
504 rHitTest = IMPL_FLOATWIN_HITTEST_RECT;
505 return pWin;
506 }
507

--- 150 unchanged lines hidden (view full) ---

658{
659 // avoid flickering
660 if ( IsVisible() )
661 Show( sal_False, SHOW_NOFOCUSCHANGE );
662
663 if ( IsRollUp() )
664 RollDown();
665
500 // note: maFloatRect is set in FloatingWindow::StartPopupMode() and
501 // is already in absolute device coordinates
502 if ( pWin->maFloatRect.IsInside( aAbsolute ) )
503 {
504 rHitTest = IMPL_FLOATWIN_HITTEST_RECT;
505 return pWin;
506 }
507

--- 150 unchanged lines hidden (view full) ---

658{
659 // avoid flickering
660 if ( IsVisible() )
661 Show( sal_False, SHOW_NOFOCUSCHANGE );
662
663 if ( IsRollUp() )
664 RollDown();
665
666 // remove title
666 // remove title
667 mnOldTitle = mnTitle;
668 if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF )
669 SetTitleType( FLOATWIN_TITLE_TEAROFF );
670 else
671 SetTitleType( FLOATWIN_TITLE_NONE );
672
673 // avoid close on focus change for decorated floating windows only
674 if( mpWindowImpl->mbFrame && (GetStyle() & WB_MOVEABLE) )

--- 36 unchanged lines hidden (view full) ---

711 EnableSaveBackground();
712
713 // add FloatingWindow to list of windows that are in popup mode
714 ImplSVData* pSVData = ImplGetSVData();
715 mpNextFloat = pSVData->maWinData.mpFirstFloat;
716 pSVData->maWinData.mpFirstFloat = this;
717 if( nFlags & FLOATWIN_POPUPMODE_GRABFOCUS )
718 {
667 mnOldTitle = mnTitle;
668 if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF )
669 SetTitleType( FLOATWIN_TITLE_TEAROFF );
670 else
671 SetTitleType( FLOATWIN_TITLE_NONE );
672
673 // avoid close on focus change for decorated floating windows only
674 if( mpWindowImpl->mbFrame && (GetStyle() & WB_MOVEABLE) )

--- 36 unchanged lines hidden (view full) ---

711 EnableSaveBackground();
712
713 // add FloatingWindow to list of windows that are in popup mode
714 ImplSVData* pSVData = ImplGetSVData();
715 mpNextFloat = pSVData->maWinData.mpFirstFloat;
716 pSVData->maWinData.mpFirstFloat = this;
717 if( nFlags & FLOATWIN_POPUPMODE_GRABFOCUS )
718 {
719 // force key input even without focus (useful for menues)
719 // force key input even without focus (useful for menus)
720 mbGrabFocus = sal_True;
721 }
722 Show( sal_True, SHOW_NOACTIVATE );
723}
724
725// -----------------------------------------------------------------------
726
727void FloatingWindow::StartPopupMode( ToolBox* pBox, sal_uLong nFlags )

--- 51 unchanged lines hidden (view full) ---

779 ImplSVData* pSVData = ImplGetSVData();
780
781 mbInCleanUp = sal_True; // prevent killing this window due to focus change while working with it
782
783 // Bei allen nachfolgenden PopupMode-Fenster den Modus auch beenden
784 while ( pSVData->maWinData.mpFirstFloat && pSVData->maWinData.mpFirstFloat != this )
785 pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
786
720 mbGrabFocus = sal_True;
721 }
722 Show( sal_True, SHOW_NOACTIVATE );
723}
724
725// -----------------------------------------------------------------------
726
727void FloatingWindow::StartPopupMode( ToolBox* pBox, sal_uLong nFlags )

--- 51 unchanged lines hidden (view full) ---

779 ImplSVData* pSVData = ImplGetSVData();
780
781 mbInCleanUp = sal_True; // prevent killing this window due to focus change while working with it
782
783 // Bei allen nachfolgenden PopupMode-Fenster den Modus auch beenden
784 while ( pSVData->maWinData.mpFirstFloat && pSVData->maWinData.mpFirstFloat != this )
785 pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
786
787
787
788 // Fenster aus der Liste austragen
789 pSVData->maWinData.mpFirstFloat = mpNextFloat;
790 mpNextFloat = NULL;
791
792 sal_uLong nPopupModeFlags = mnPopupModeFlags;
793
794 // Wenn nicht abgerissen wurde, dann Fenster wieder Hiden
795 if ( !(nFlags & FLOATWIN_POPUPMODEEND_TEAROFF) ||

--- 67 unchanged lines hidden (view full) ---

863// -----------------------------------------------------------------------
864
865void FloatingWindow::RemovePopupModeWindow( Window* pWindow )
866{
867 // !!! bisher erst 1 Fenster und noch keine Liste
868 if ( mpFirstPopupModeWin == pWindow )
869 mpFirstPopupModeWin = NULL;
870}
788 // Fenster aus der Liste austragen
789 pSVData->maWinData.mpFirstFloat = mpNextFloat;
790 mpNextFloat = NULL;
791
792 sal_uLong nPopupModeFlags = mnPopupModeFlags;
793
794 // Wenn nicht abgerissen wurde, dann Fenster wieder Hiden
795 if ( !(nFlags & FLOATWIN_POPUPMODEEND_TEAROFF) ||

--- 67 unchanged lines hidden (view full) ---

863// -----------------------------------------------------------------------
864
865void FloatingWindow::RemovePopupModeWindow( Window* pWindow )
866{
867 // !!! bisher erst 1 Fenster und noch keine Liste
868 if ( mpFirstPopupModeWin == pWindow )
869 mpFirstPopupModeWin = NULL;
870}
871