Files
libreoffice/vcl/source/window/floatwin.cxx

876 lines
29 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-09-18 16:07:07 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-09-18 16:07:07 +00:00
*
************************************************************************/
#include <svdata.hxx>
#include <brdwin.hxx>
#include <window.h>
#include <salframe.hxx>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/event.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/floatwin.hxx>
#include <tools/rc.h>
#include <tools/debug.hxx>
2000-09-18 16:07:07 +00:00
// =======================================================================
class FloatingWindow::ImplData
{
public:
ImplData();
~ImplData();
ToolBox* mpBox;
Rectangle maItemEdgeClipRect; // used to clip the common edge between a toolbar item and the border of this window
};
FloatingWindow::ImplData::ImplData()
{
mpBox = NULL;
}
FloatingWindow::ImplData::~ImplData()
{
}
Rectangle& FloatingWindow::ImplGetItemEdgeClipRect()
{
return mpImplData->maItemEdgeClipRect;
}
2000-09-18 16:07:07 +00:00
// =======================================================================
void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle )
{
mpImplData = new ImplData;
mpWindowImpl->mbFloatWin = sal_True;
mbInCleanUp = sal_False;
mbGrabFocus = sal_False;
2000-09-18 16:07:07 +00:00
DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL!" );
2000-09-18 16:07:07 +00:00
if ( !pParent )
pParent = ImplGetSVData()->maWinData.mpAppWin;
2000-09-18 16:07:07 +00:00
DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists" );
// no Border, then we dont need a border window
if ( !nStyle )
2000-09-18 16:07:07 +00:00
{
mpWindowImpl->mbOverlapWin = sal_True;
nStyle |= WB_DIALOGCONTROL;
2000-09-18 16:07:07 +00:00
SystemWindow::ImplInit( pParent, nStyle, NULL );
}
else
{
if ( !(nStyle & WB_NODIALOGCONTROL) )
nStyle |= WB_DIALOGCONTROL;
if( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_CLOSEABLE | WB_STANDALONE)
&& !(nStyle & WB_OWNERDRAWDECORATION) )
{
WinBits nFloatWinStyle = nStyle;
// #99154# floaters are not closeable by default anymore, eg fullscreen floater
// nFloatWinStyle |= WB_CLOSEABLE;
mpWindowImpl->mbFrame = sal_True;
mpWindowImpl->mbOverlapWin = sal_True;
SystemWindow::ImplInit( pParent, nFloatWinStyle & ~WB_BORDER, NULL );
}
else
{
ImplBorderWindow* pBorderWin;
sal_uInt16 nBorderStyle = BORDERWINDOW_STYLE_BORDER | BORDERWINDOW_STYLE_FLOAT;
if( nStyle & WB_OWNERDRAWDECORATION ) nBorderStyle |= BORDERWINDOW_STYLE_FRAME;
else nBorderStyle |= BORDERWINDOW_STYLE_OVERLAP;
if ( (nStyle & WB_SYSTEMWINDOW) && !(nStyle & (WB_MOVEABLE | WB_SIZEABLE)) )
{
nBorderStyle |= BORDERWINDOW_STYLE_FRAME;
nStyle |= WB_CLOSEABLE; // make undecorated floaters closeable
}
pBorderWin = new ImplBorderWindow( pParent, nStyle, nBorderStyle );
SystemWindow::ImplInit( pBorderWin, nStyle & ~WB_BORDER, NULL );
pBorderWin->mpWindowImpl->mpClientWindow = this;
pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
pBorderWin->SetDisplayActive( sal_True );
mpWindowImpl->mpBorderWindow = pBorderWin;
mpWindowImpl->mpRealParent = pParent;
}
2000-09-18 16:07:07 +00:00
}
SetActivateMode( 0 );
mpNextFloat = NULL;
mpFirstPopupModeWin = NULL;
mnPostId = 0;
mnTitle = (nStyle & (WB_MOVEABLE | WB_POPUP)) ? FLOATWIN_TITLE_NORMAL : FLOATWIN_TITLE_NONE;
2000-09-18 16:07:07 +00:00
mnOldTitle = mnTitle;
mnPopupModeFlags = 0;
mbInPopupMode = sal_False;
mbPopupMode = sal_False;
mbPopupModeCanceled = sal_False;
mbPopupModeTearOff = sal_False;
mbMouseDown = sal_False;
2000-09-18 16:07:07 +00:00
ImplInitSettings();
}
// -----------------------------------------------------------------------
void FloatingWindow::ImplInitSettings()
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Color aColor;
if ( IsControlBackground() )
aColor = GetControlBackground();
else if ( Window::GetStyle() & WB_3DLOOK )
aColor = rStyleSettings.GetFaceColor();
else
aColor = rStyleSettings.GetWindowColor();
SetBackground( aColor );
}
// =======================================================================
FloatingWindow::FloatingWindow( Window* pParent, WinBits nStyle ) :
SystemWindow( WINDOW_FLOATINGWINDOW )
{
ImplInit( pParent, nStyle );
}
// -----------------------------------------------------------------------
FloatingWindow::FloatingWindow( Window* pParent, const ResId& rResId ) :
SystemWindow( WINDOW_FLOATINGWINDOW )
{
rResId.SetRT( RSC_FLOATINGWINDOW );
WinBits nStyle = ImplInitRes( rResId );
ImplInit( pParent, nStyle );
ImplLoadRes( rResId );
if ( !(nStyle & WB_HIDE) )
Show();
}
// -----------------------------------------------------------------------
void FloatingWindow::ImplLoadRes( const ResId& rResId )
{
SystemWindow::ImplLoadRes( rResId );
sal_uLong nObjMask = ReadLongRes();
2000-09-18 16:07:07 +00:00
if ( (RSC_FLOATINGWINDOW_WHMAPMODE | RSC_FLOATINGWINDOW_WIDTH |
RSC_FLOATINGWINDOW_HEIGHT) & nObjMask )
{
// Groessenangabe aus der Resource verwenden
Size aSize;
MapUnit eSizeMap = MAP_PIXEL;
if ( RSC_FLOATINGWINDOW_WHMAPMODE & nObjMask )
eSizeMap = (MapUnit) ReadShortRes();
if ( RSC_FLOATINGWINDOW_WIDTH & nObjMask )
aSize.Width() = ReadShortRes();
if ( RSC_FLOATINGWINDOW_HEIGHT & nObjMask )
aSize.Height() = ReadShortRes();
SetRollUpOutputSizePixel( LogicToPixel( aSize, eSizeMap ) );
}
if (nObjMask & RSC_FLOATINGWINDOW_ZOOMIN )
{
if ( ReadShortRes() )
RollUp();
}
}
// -----------------------------------------------------------------------
FloatingWindow::~FloatingWindow()
{
if( mbPopupModeCanceled )
// indicates that ESC key was pressed
// will be handled in Window::ImplGrabFocus()
SetDialogControlFlags( GetDialogControlFlags() | WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL );
2000-09-18 16:07:07 +00:00
if ( IsInPopupMode() )
EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL | FLOATWIN_POPUPMODEEND_DONTCALLHDL );
if ( mnPostId )
Application::RemoveUserEvent( mnPostId );
delete mpImplData;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
Point FloatingWindow::CalcFloatingPosition( Window* pWindow, const Rectangle& rRect, sal_uLong nFlags, sal_uInt16& rArrangeIndex )
CWS-TOOLING: integrate CWS impressnotes01 2009-09-11 13:52:41 +0200 cl r276061 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@276043 (milestone: DEV300:m58) 2009-09-10 15:44:57 +0200 cl r276039 : #i103139# continued work on the impress annotation feature 2009-09-10 14:52:31 +0200 cl r276032 : #i103139# continued work on the impress annotation feature 2009-09-10 14:50:32 +0200 cl r276031 : #i103139# continued work on the impress annotation feature 2009-09-10 14:48:29 +0200 cl r276030 : #i103139# continued work on the impress annotation feature 2009-09-10 11:36:11 +0200 cl r276027 : #i103139# continued work on the impress annotation feature 2009-09-09 20:22:41 +0200 cl r276018 : #i103139# continued work on the impress annotation feature 2009-09-09 20:21:45 +0200 cl r276017 : #i103139# continued work on the impress annotation feature 2009-09-09 19:32:29 +0200 sj r276015 : #i103139# added import of comments (ppt binary) 2009-09-09 19:31:07 +0200 sj r276014 : #i103139# added import of comments (ppt binary) 2009-09-09 19:16:41 +0200 cl r276011 : #i103139# continued work on the impress annotation feature 2009-09-09 19:15:19 +0200 cl r276010 : #i103139# continued work on the impress annotation feature 2009-09-09 16:27:19 +0200 cl r276001 : #i104579# fixed isEmptyPresObj() 2009-09-09 15:12:02 +0200 cl r275997 : #i103139# continued work on the impress annotation feature 2009-09-09 15:06:29 +0200 sj r275996 : #i103139# added import of comments (ppt binary) 2009-09-09 14:53:01 +0200 cl r275995 : #i103139# continued work on the impress annotation feature 2009-09-09 14:51:32 +0200 cl r275994 : #i103139# continued work on the impress annotation feature 2009-09-09 12:11:17 +0200 cl r275982 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:55 +0200 cl r275981 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:23 +0200 cl r275980 : #i103139# continued work on the impress annotation feature 2009-09-09 11:44:47 +0200 cl r275978 : #i104315# added missing tab pages 2009-09-08 16:04:44 +0200 cl r275936 : #i103139# continued work on the impress annotation feature 2009-09-08 16:03:28 +0200 cl r275935 : #i103139# continued work on the impress annotation feature 2009-09-08 11:45:47 +0200 cl r275920 : #i103139# continued work on the impress annotation feature 2009-09-08 11:41:51 +0200 cl r275919 : #i103139# continued work on the impress annotation feature 2009-09-07 18:30:55 +0200 cl r275910 : #i103139# continued work on the impress annotation feature 2009-09-07 18:29:37 +0200 cl r275909 : #i103139# continued work on the impress annotation feature 2009-09-07 17:25:43 +0200 cl r275905 : #i103139# continued work on the impress annotation feature 2009-09-07 12:00:28 +0200 cl r275884 : #i103139# continued work on the impress annotation feature 2009-09-06 14:14:00 +0200 cl r275859 : #i103139# continued work on the impress annotation feature 2009-09-05 20:57:24 +0200 cl r275854 : #i103139# continued work on the impress annotation feature 2009-09-05 20:56:29 +0200 cl r275853 : #i103139# continued work on the impress annotation feature 2009-09-05 20:55:27 +0200 cl r275852 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:42 +0200 cl r275851 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:09 +0200 cl r275850 : #i103139# continued work on the impress annotation feature 2009-09-05 17:43:33 +0200 cl r275845 : #i103139# continued work on the impress annotation feature 2009-09-05 17:04:41 +0200 cl r275843 : #i103139# continued work on the impress annotation feature 2009-09-05 17:03:26 +0200 cl r275842 : #i103139# continued work on the impress annotation feature 2009-09-05 17:02:53 +0200 cl r275841 : #i103139# continued work on the impress annotation feature 2009-09-05 13:15:04 +0200 pl r275839 : #i104823# WB_NEEDSFOCUS 2009-09-05 13:14:41 +0200 pl r275838 : #i104823# WB_NEEDSFOCUS 2009-09-04 17:48:21 +0200 cl r275826 : #i103139# continued work on the impress annotation feature 2009-09-04 17:35:03 +0200 cl r275825 : #i103139# continued work on the impress annotation feature 2009-09-04 17:15:46 +0200 cl r275824 : #i103139# continued work on the impress annotation feature 2009-09-04 17:12:54 +0200 cl r275823 : #i103139# continued work on the impress annotation feature 2009-09-04 17:05:23 +0200 cl r275822 : #i103139# continued work on the impress annotation feature 2009-09-04 16:48:28 +0200 cl r275820 : #i103139# continued work on the impress annotation feature 2009-09-04 16:44:02 +0200 cl r275818 : #i103139# continued work on the impress annotation feature 2009-09-04 16:43:23 +0200 cl r275817 : #i103139# continued work on the impress annotation feature 2009-09-04 16:06:04 +0200 cl r275812 : #i103139# continued work on the impress annotation feature 2009-09-04 16:05:45 +0200 cl r275811 : #i103139# continued work on the impress annotation feature 2009-09-04 15:04:33 +0200 cl r275806 : #i103139# continued work on the impress annotation feature 2009-09-04 11:43:14 +0200 cl r275795 : #i103139# continued work on the impress annotation feature 2009-09-04 11:27:10 +0200 cl r275793 : #i103139# continued work on the impress annotation feature 2009-09-04 11:10:02 +0200 cl r275792 : #i103139# continued work on the impress annotation feature 2009-09-04 11:07:05 +0200 cl r275790 : #i103139# continued work on the impress annotation feature 2009-09-04 11:05:01 +0200 cl r275789 : #i103139# continued work on the impress annotation feature 2009-09-04 10:55:51 +0200 cl r275785 : #i103139# renamed notes to comments 2009-09-04 10:54:57 +0200 cl r275784 : #i103139# renamed notes to comments 2009-09-03 20:37:35 +0200 cl r275772 : #i103139# continued work on the impress annotation feature 2009-09-03 20:35:31 +0200 cl r275771 : #i103139# continued work on the impress annotation feature 2009-09-01 18:17:55 +0200 cl r275680 : #i103139# continued work on the impress annotation feature 2009-09-01 18:15:08 +0200 cl r275678 : #i103139# continued work on the impress annotation feature 2009-09-01 18:13:38 +0200 cl r275677 : #i103139# continued work on the impress annotation feature 2009-08-18 12:35:42 +0200 cl r275089 : fixed merge error 2009-08-18 11:39:58 +0200 cl r275086 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@275001 (milestone: DEV300:m55) 2009-07-30 13:45:10 +0200 cl r274481 : fixed merge errrors 2009-07-30 13:41:21 +0200 cl r274480 : fixed merge errrors 2009-07-30 13:39:40 +0200 cl r274478 : fixed merge errrors 2009-07-22 18:07:30 +0200 cl r274256 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@273858 (milestone: DEV300:m52) 2009-07-21 17:21:31 +0200 cl r274208 : merging 2009-07-20 14:28:34 +0200 cl r274137 : #i103139# annotation support for impress 2009-07-20 14:28:04 +0200 cl r274136 : #i103139# annotation support for impress 2009-07-20 14:27:20 +0200 cl r274135 : #i103139# annotation support for impress 2009-07-20 14:21:17 +0200 cl r274134 : #i103139# annotation support for impress 2009-07-20 14:20:56 +0200 cl r274133 : #i103139# annotation support for impress 2009-07-20 14:20:09 +0200 cl r274132 : #i103139# annotation support for impress 2009-07-20 14:19:00 +0200 cl r274131 : #i103139# annotation support for impress 2009-07-20 14:17:50 +0200 cl r274130 : #i103139# annotation support for impress 2009-07-20 14:12:24 +0200 cl r274129 : #i103139# annotation support for impress 2009-07-20 13:52:03 +0200 cl r274128 : #i103139# annotation support for impress 2009-07-20 13:51:11 +0200 cl r274127 : #i103139# annotation support for impress 2009-07-20 13:48:59 +0200 cl r274126 : #i103139# annotation support for impress 2009-07-20 13:43:56 +0200 cl r274125 : #i103139# annotation support for impress 2009-07-20 13:31:55 +0200 cl r274123 : #i103139# annotation support for impress 2009-07-20 13:30:45 +0200 cl r274122 : #i103139# annotation support for impress
2009-09-16 13:55:36 +00:00
{
return ImplCalcPos( pWindow, rRect, nFlags, rArrangeIndex );
}
// -----------------------------------------------------------------------
2000-09-18 16:07:07 +00:00
Point FloatingWindow::ImplCalcPos( Window* pWindow,
const Rectangle& rRect, sal_uLong nFlags,
sal_uInt16& rArrangeIndex )
2000-09-18 16:07:07 +00:00
{
// Fenster-Position ermitteln
Point aPos;
Size aSize = pWindow->GetSizePixel();
Rectangle aScreenRect = pWindow->ImplGetFrameWindow()->GetDesktopRectPixel();
FloatingWindow *pFloatingWindow = dynamic_cast<FloatingWindow*>( pWindow );
2001-10-24 07:57:18 +00:00
// convert....
Window* pW = pWindow;
if ( pW->mpWindowImpl->mpRealParent )
pW = pW->mpWindowImpl->mpRealParent;
2001-10-24 07:57:18 +00:00
Rectangle normRect( rRect ); // rRect is already relative to top-level window
normRect.SetPos( pW->ScreenToOutputPixel( normRect.TopLeft() ) );
sal_Bool bRTL = Application::GetSettings().GetLayoutRTL();
2001-10-24 07:57:18 +00:00
Rectangle devRect( pW->OutputToAbsoluteScreenPixel( normRect.TopLeft() ),
pW->OutputToAbsoluteScreenPixel( normRect.BottomRight() ) );
Rectangle devRectRTL( devRect );
if( bRTL )
// create a rect that can be compared to desktop coordinates
devRectRTL = pW->ImplOutputToUnmirroredAbsoluteScreenPixel( normRect );
if( Application::GetScreenCount() > 1 && Application::IsUnifiedDisplay() )
aScreenRect = Application::GetScreenPosSizePixel(
Application::GetBestScreen( bRTL ? devRectRTL : devRect ) );
sal_uInt16 nArrangeAry[5];
sal_uInt16 nArrangeIndex;
sal_Bool bBreak;
Point e1,e2; // the common edge between the item rect and the floating window
2000-09-18 16:07:07 +00:00
if ( nFlags & FLOATWIN_POPUPMODE_LEFT )
{
nArrangeAry[0] = FLOATWIN_POPUPMODE_LEFT;
nArrangeAry[1] = FLOATWIN_POPUPMODE_RIGHT;
nArrangeAry[2] = FLOATWIN_POPUPMODE_UP;
nArrangeAry[3] = FLOATWIN_POPUPMODE_DOWN;
nArrangeAry[4] = FLOATWIN_POPUPMODE_LEFT;
}
else if ( nFlags & FLOATWIN_POPUPMODE_RIGHT )
{
nArrangeAry[0] = FLOATWIN_POPUPMODE_RIGHT;
nArrangeAry[1] = FLOATWIN_POPUPMODE_LEFT;
nArrangeAry[2] = FLOATWIN_POPUPMODE_UP;
nArrangeAry[3] = FLOATWIN_POPUPMODE_DOWN;
nArrangeAry[4] = FLOATWIN_POPUPMODE_RIGHT;
}
else if ( nFlags & FLOATWIN_POPUPMODE_UP )
{
nArrangeAry[0] = FLOATWIN_POPUPMODE_UP;
nArrangeAry[1] = FLOATWIN_POPUPMODE_DOWN;
nArrangeAry[2] = FLOATWIN_POPUPMODE_RIGHT;
nArrangeAry[3] = FLOATWIN_POPUPMODE_LEFT;
nArrangeAry[4] = FLOATWIN_POPUPMODE_UP;
}
else
{
nArrangeAry[0] = FLOATWIN_POPUPMODE_DOWN;
nArrangeAry[1] = FLOATWIN_POPUPMODE_UP;
nArrangeAry[2] = FLOATWIN_POPUPMODE_RIGHT;
nArrangeAry[3] = FLOATWIN_POPUPMODE_LEFT;
nArrangeAry[4] = FLOATWIN_POPUPMODE_DOWN;
}
if ( nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE )
nArrangeIndex = 4;
else
nArrangeIndex = 0;
2002-07-11 06:31:51 +00:00
2000-09-18 16:07:07 +00:00
for ( ; nArrangeIndex < 5; nArrangeIndex++ )
{
bBreak = sal_True;
2000-09-18 16:07:07 +00:00
switch ( nArrangeAry[nArrangeIndex] )
{
2002-07-11 06:31:51 +00:00
2000-09-18 16:07:07 +00:00
case FLOATWIN_POPUPMODE_LEFT:
aPos.X() = devRect.Left()-aSize.Width()+1;
2001-10-24 07:57:18 +00:00
aPos.Y() = devRect.Top();
aPos.Y() -= pWindow->mpWindowImpl->mnTopBorder;
2002-07-11 06:31:51 +00:00
if( bRTL ) // --- RTL --- we're comparing screen coordinates here
{
if( (devRectRTL.Right()+aSize.Width()) > aScreenRect.Right() )
bBreak = sal_False;
2002-07-11 06:31:51 +00:00
}
else
{
if ( aPos.X() < aScreenRect.Left() )
bBreak = sal_False;
2002-07-11 06:31:51 +00:00
}
if( bBreak )
{
e1 = devRect.TopLeft();
e2 = devRect.BottomLeft();
// set non-zero width
e2.X()++;
// don't clip corners
e1.Y()++;
e2.Y()--;
}
2000-09-18 16:07:07 +00:00
break;
case FLOATWIN_POPUPMODE_RIGHT:
2001-10-24 07:57:18 +00:00
aPos = devRect.TopRight();
aPos.Y() -= pWindow->mpWindowImpl->mnTopBorder;
2002-07-11 06:31:51 +00:00
if( bRTL ) // --- RTL --- we're comparing screen coordinates here
{
if( (devRectRTL.Left() - aSize.Width()) < aScreenRect.Left() )
bBreak = sal_False;
2002-07-11 06:31:51 +00:00
}
else
{
if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
bBreak = sal_False;
2002-07-11 06:31:51 +00:00
}
if( bBreak )
{
e1 = devRect.TopRight();
e2 = devRect.BottomRight();
// set non-zero width
e2.X()++;
// don't clip corners
e1.Y()++;
e2.Y()--;
}
2000-09-18 16:07:07 +00:00
break;
case FLOATWIN_POPUPMODE_UP:
2001-10-24 07:57:18 +00:00
aPos.X() = devRect.Left();
aPos.Y() = devRect.Top()-aSize.Height()+1;
2000-09-18 16:07:07 +00:00
if ( aPos.Y() < aScreenRect.Top() )
bBreak = sal_False;
if( bBreak )
{
e1 = devRect.TopLeft();
e2 = devRect.TopRight();
// set non-zero height
e2.Y()++;
// don't clip corners
e1.X()++;
e2.X()--;
}
2000-09-18 16:07:07 +00:00
break;
case FLOATWIN_POPUPMODE_DOWN:
2001-10-24 07:57:18 +00:00
aPos = devRect.BottomLeft();
2000-09-18 16:07:07 +00:00
if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
bBreak = sal_False;
if( bBreak )
{
e1 = devRect.BottomLeft();
e2 = devRect.BottomRight();
// set non-zero height
e2.Y()++;
// don't clip corners
e1.X()++;
e2.X()--;
}
2000-09-18 16:07:07 +00:00
break;
}
// Evt. noch anpassen
if ( bBreak && !(nFlags & FLOATWIN_POPUPMODE_NOAUTOARRANGE) )
{
if ( (nArrangeAry[nArrangeIndex] == FLOATWIN_POPUPMODE_LEFT) ||
(nArrangeAry[nArrangeIndex] == FLOATWIN_POPUPMODE_RIGHT) )
{
if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
{
aPos.Y() = devRect.Bottom()-aSize.Height()+1;
2000-09-18 16:07:07 +00:00
if ( aPos.Y() < aScreenRect.Top() )
aPos.Y() = aScreenRect.Top();
}
}
else
{
if( bRTL ) // --- RTL --- we're comparing screen coordinates here
{
if( devRectRTL.Right()-aSize.Width()+1 < aScreenRect.Left() )
aPos.X() -= aScreenRect.Left() - devRectRTL.Right() + aSize.Width() - 1;
}
else if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
{
aPos.X() = devRect.Right()-aSize.Width()+1;
2000-09-18 16:07:07 +00:00
if ( aPos.X() < aScreenRect.Left() )
aPos.X() = aScreenRect.Left();
}
2000-09-18 16:07:07 +00:00
}
}
if ( bBreak )
break;
}
if ( nArrangeIndex > 4 )
nArrangeIndex = 4;
rArrangeIndex = nArrangeIndex;
2001-10-24 07:57:18 +00:00
aPos = pW->AbsoluteScreenToOutputPixel( aPos );
// store a cliprect that can be used to clip the common edge of the itemrect and the floating window
if( pFloatingWindow )
{
pFloatingWindow->mpImplData->maItemEdgeClipRect =
Rectangle( e1, e2 );
}
2001-10-24 07:57:18 +00:00
// caller expects cordinates relative to top-level win
return pW->OutputToScreenPixel( aPos );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
FloatingWindow* FloatingWindow::ImplFloatHitTest( Window* pReference, const Point& rPos, sal_uInt16& rHitTest )
2000-09-18 16:07:07 +00:00
{
FloatingWindow* pWin = this;
Point aAbsolute( rPos );
// compare coordinates in absolute screen coordinates
if( pReference->ImplHasMirroredGraphics() )
{
if(!pReference->IsRTLEnabled() )
// --- RTL --- re-mirror back to get device coordiantes
pReference->ImplReMirror( aAbsolute );
Rectangle aRect( pReference->ScreenToOutputPixel(aAbsolute), Size(1,1) ) ;
aRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel( aRect );
aAbsolute = aRect.TopLeft();
}
else
aAbsolute = Point( pReference->OutputToAbsoluteScreenPixel(
pReference->ScreenToOutputPixel(rPos) ) );
2000-09-18 16:07:07 +00:00
do
{
// compute the floating window's size in absolute screen coordinates
// use the border window to have the exact position
Window *pBorderWin = pWin->GetWindow( WINDOW_BORDER );
Point aPt; // the top-left corner in output coordinates ie (0,0)
Rectangle devRect( pBorderWin->ImplOutputToUnmirroredAbsoluteScreenPixel( Rectangle( aPt, pBorderWin->GetSizePixel()) ) ) ;
if ( devRect.IsInside( aAbsolute ) )
2000-09-18 16:07:07 +00:00
{
rHitTest = IMPL_FLOATWIN_HITTEST_WINDOW;
return pWin;
}
// test, if mouse is in rectangle, (this is typically the rect of the active
// toolbox item or similar)
// note: maFloatRect is set in FloatingWindow::StartPopupMode() and
// is already in absolute device coordinates
if ( pWin->maFloatRect.IsInside( aAbsolute ) )
2000-09-18 16:07:07 +00:00
{
rHitTest = IMPL_FLOATWIN_HITTEST_RECT;
return pWin;
}
pWin = pWin->mpNextFloat;
}
while ( pWin );
rHitTest = IMPL_FLOATWIN_HITTEST_OUTSIDE;
return NULL;
}
// -----------------------------------------------------------------------
FloatingWindow* FloatingWindow::ImplFindLastLevelFloat()
{
FloatingWindow* pWin = this;
FloatingWindow* pLastFoundWin = pWin;
do
{
if ( pWin->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NEWLEVEL )
pLastFoundWin = pWin;
pWin = pWin->mpNextFloat;
}
while ( pWin );
return pLastFoundWin;
}
// -----------------------------------------------------------------------
sal_Bool FloatingWindow::ImplIsFloatPopupModeWindow( const Window* pWindow )
2000-09-18 16:07:07 +00:00
{
FloatingWindow* pWin = this;
do
{
if ( pWin->mpFirstPopupModeWin == pWindow )
return sal_True;
2000-09-18 16:07:07 +00:00
pWin = pWin->mpNextFloat;
}
while ( pWin );
return sal_False;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
IMPL_LINK_NOARG(FloatingWindow, ImplEndPopupModeHdl)
2000-09-18 16:07:07 +00:00
{
mnPostId = 0;
mnPopupModeFlags = 0;
mbPopupMode = sal_False;
2000-09-18 16:07:07 +00:00
PopupModeEnd();
return 0;
}
// -----------------------------------------------------------------------
long FloatingWindow::Notify( NotifyEvent& rNEvt )
{
// Zuerst Basisklasse rufen wegen TabSteuerung
long nRet = SystemWindow::Notify( rNEvt );
if ( !nRet )
{
if ( rNEvt.GetType() == EVENT_KEYINPUT )
{
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
KeyCode aKeyCode = pKEvt->GetKeyCode();
sal_uInt16 nKeyCode = aKeyCode.GetCode();
2000-09-18 16:07:07 +00:00
if ( (nKeyCode == KEY_ESCAPE) && (GetStyle() & WB_CLOSEABLE) )
{
Close();
return sal_True;
2000-09-18 16:07:07 +00:00
}
}
}
return nRet;
}
// -----------------------------------------------------------------------
void FloatingWindow::StateChanged( StateChangedType nType )
{
SystemWindow::StateChanged( nType );
if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
{
ImplInitSettings();
Invalidate();
}
}
// -----------------------------------------------------------------------
void FloatingWindow::DataChanged( const DataChangedEvent& rDCEvt )
{
SystemWindow::DataChanged( rDCEvt );
if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
{
ImplInitSettings();
Invalidate();
}
}
// -----------------------------------------------------------------------
void FloatingWindow::ImplCallPopupModeEnd()
{
// PopupMode wurde beendet
mbInPopupMode = sal_False;
2000-09-18 16:07:07 +00:00
// Handler asyncron rufen
if ( !mnPostId )
Application::PostUserEvent( mnPostId, LINK( this, FloatingWindow, ImplEndPopupModeHdl ) );
}
// -----------------------------------------------------------------------
void FloatingWindow::PopupModeEnd()
{
maPopupModeEndHdl.Call( this );
}
// -----------------------------------------------------------------------
void FloatingWindow::SetTitleType( sal_uInt16 nTitle )
2000-09-18 16:07:07 +00:00
{
if ( (mnTitle != nTitle) && mpWindowImpl->mpBorderWindow )
2000-09-18 16:07:07 +00:00
{
mnTitle = nTitle;
Size aOutSize = GetOutputSizePixel();
sal_uInt16 nTitleStyle;
2000-09-18 16:07:07 +00:00
if ( nTitle == FLOATWIN_TITLE_NORMAL )
nTitleStyle = BORDERWINDOW_TITLE_SMALL;
else if ( nTitle == FLOATWIN_TITLE_TEAROFF )
nTitleStyle = BORDERWINDOW_TITLE_TEAROFF;
else if ( nTitle == FLOATWIN_TITLE_POPUP )
nTitleStyle = BORDERWINDOW_TITLE_POPUP;
2000-09-18 16:07:07 +00:00
else // nTitle == FLOATWIN_TITLE_NONE
nTitleStyle = BORDERWINDOW_TITLE_NONE;
((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetTitleType( nTitleStyle, aOutSize );
((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
2000-09-18 16:07:07 +00:00
}
}
// -----------------------------------------------------------------------
void FloatingWindow::StartPopupMode( const Rectangle& rRect, sal_uLong nFlags )
2000-09-18 16:07:07 +00:00
{
// avoid flickering
2000-09-18 16:07:07 +00:00
if ( IsVisible() )
Show( sal_False, SHOW_NOFOCUSCHANGE );
2000-09-18 16:07:07 +00:00
if ( IsRollUp() )
RollDown();
// remove title
2000-09-18 16:07:07 +00:00
mnOldTitle = mnTitle;
if ( ( mpWindowImpl->mnStyle & WB_POPUP ) && GetText().Len() )
SetTitleType( FLOATWIN_TITLE_POPUP );
else if ( nFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF )
2000-09-18 16:07:07 +00:00
SetTitleType( FLOATWIN_TITLE_TEAROFF );
else
SetTitleType( FLOATWIN_TITLE_NONE );
// avoid close on focus change for decorated floating windows only
if( mpWindowImpl->mbFrame && (GetStyle() & WB_MOVEABLE) )
nFlags |= FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE;
// #102010# For debugging Accessibility
static const char* pEnv = getenv("SAL_FLOATWIN_NOAPPFOCUSCLOSE" );
if( pEnv && *pEnv )
nFlags |= FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE;
// compute window position according to flags and arrangement
sal_uInt16 nArrangeIndex;
Point aPos = ImplCalcPos( this, rRect, nFlags, nArrangeIndex );
SetPosPixel( aPos );
2000-09-18 16:07:07 +00:00
// set data and display window
// convert maFloatRect to absolute device coordinates
// so they can be compared across different frames
// !!! rRect is expected to be in screen coordinates of the parent frame window !!!
2000-09-18 16:07:07 +00:00
maFloatRect = rRect;
Window *pReference = GetParent();
// compare coordinates in absolute screen coordinates
// Keep in sync with FloatingWindow::ImplFloatHitTest, e.g. fdo#33509
if( pReference->ImplHasMirroredGraphics() )
{
if(!pReference->IsRTLEnabled() )
// --- RTL --- re-mirror back to get device coordiantes
pReference->ImplReMirror(maFloatRect);
maFloatRect.SetPos(pReference->ScreenToOutputPixel(maFloatRect.TopLeft()));
maFloatRect = pReference->ImplOutputToUnmirroredAbsoluteScreenPixel(maFloatRect);
}
else
maFloatRect.SetPos(pReference->OutputToAbsoluteScreenPixel(pReference->ScreenToOutputPixel(rRect.TopLeft())));
2000-09-18 16:07:07 +00:00
maFloatRect.Left() -= 2;
maFloatRect.Top() -= 2;
maFloatRect.Right() += 2;
maFloatRect.Bottom() += 2;
mnPopupModeFlags = nFlags;
mbInPopupMode = sal_True;
mbPopupMode = sal_True;
mbPopupModeCanceled = sal_False;
mbPopupModeTearOff = sal_False;
mbMouseDown = sal_False;
2000-09-18 16:07:07 +00:00
mbOldSaveBackMode = IsSaveBackgroundEnabled();
EnableSaveBackground();
// add FloatingWindow to list of windows that are in popup mode
2000-09-18 16:07:07 +00:00
ImplSVData* pSVData = ImplGetSVData();
mpNextFloat = pSVData->maWinData.mpFirstFloat;
pSVData->maWinData.mpFirstFloat = this;
2001-10-31 18:34:56 +00:00
if( nFlags & FLOATWIN_POPUPMODE_GRABFOCUS )
{
2011-12-06 23:04:19 -08:00
// force key input even without focus (useful for menus)
mbGrabFocus = sal_True;
}
Show( sal_True, SHOW_NOACTIVATE );
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void FloatingWindow::StartPopupMode( ToolBox* pBox, sal_uLong nFlags )
2000-09-18 16:07:07 +00:00
{
// get selected button
sal_uInt16 nItemId = pBox->GetDownItemId();
2000-09-18 16:07:07 +00:00
if ( !nItemId )
return;
mpImplData->mpBox = pBox;
pBox->ImplFloatControl( sal_True, this );
2000-09-18 16:07:07 +00:00
// retrieve some data from the ToolBox
2000-09-18 16:07:07 +00:00
Rectangle aRect = pBox->GetItemRect( nItemId );
Point aPos;
// convert to parent's screen coordinates
aPos = GetParent()->OutputToScreenPixel( GetParent()->AbsoluteScreenToOutputPixel( pBox->OutputToAbsoluteScreenPixel( aRect.TopLeft() ) ) );
2000-09-18 16:07:07 +00:00
aRect.SetPos( aPos );
nFlags |=
FLOATWIN_POPUPMODE_NOFOCUSCLOSE |
// FLOATWIN_POPUPMODE_NOMOUSECLOSE |
FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE |
// FLOATWIN_POPUPMODE_NOMOUSERECTCLOSE | // #105968# floating toolboxes should close when clicked in (parent's) float rect
CWS-TOOLING: integrate CWS impressnotes01 2009-09-11 13:52:41 +0200 cl r276061 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@276043 (milestone: DEV300:m58) 2009-09-10 15:44:57 +0200 cl r276039 : #i103139# continued work on the impress annotation feature 2009-09-10 14:52:31 +0200 cl r276032 : #i103139# continued work on the impress annotation feature 2009-09-10 14:50:32 +0200 cl r276031 : #i103139# continued work on the impress annotation feature 2009-09-10 14:48:29 +0200 cl r276030 : #i103139# continued work on the impress annotation feature 2009-09-10 11:36:11 +0200 cl r276027 : #i103139# continued work on the impress annotation feature 2009-09-09 20:22:41 +0200 cl r276018 : #i103139# continued work on the impress annotation feature 2009-09-09 20:21:45 +0200 cl r276017 : #i103139# continued work on the impress annotation feature 2009-09-09 19:32:29 +0200 sj r276015 : #i103139# added import of comments (ppt binary) 2009-09-09 19:31:07 +0200 sj r276014 : #i103139# added import of comments (ppt binary) 2009-09-09 19:16:41 +0200 cl r276011 : #i103139# continued work on the impress annotation feature 2009-09-09 19:15:19 +0200 cl r276010 : #i103139# continued work on the impress annotation feature 2009-09-09 16:27:19 +0200 cl r276001 : #i104579# fixed isEmptyPresObj() 2009-09-09 15:12:02 +0200 cl r275997 : #i103139# continued work on the impress annotation feature 2009-09-09 15:06:29 +0200 sj r275996 : #i103139# added import of comments (ppt binary) 2009-09-09 14:53:01 +0200 cl r275995 : #i103139# continued work on the impress annotation feature 2009-09-09 14:51:32 +0200 cl r275994 : #i103139# continued work on the impress annotation feature 2009-09-09 12:11:17 +0200 cl r275982 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:55 +0200 cl r275981 : #i103139# continued work on the impress annotation feature 2009-09-09 11:47:23 +0200 cl r275980 : #i103139# continued work on the impress annotation feature 2009-09-09 11:44:47 +0200 cl r275978 : #i104315# added missing tab pages 2009-09-08 16:04:44 +0200 cl r275936 : #i103139# continued work on the impress annotation feature 2009-09-08 16:03:28 +0200 cl r275935 : #i103139# continued work on the impress annotation feature 2009-09-08 11:45:47 +0200 cl r275920 : #i103139# continued work on the impress annotation feature 2009-09-08 11:41:51 +0200 cl r275919 : #i103139# continued work on the impress annotation feature 2009-09-07 18:30:55 +0200 cl r275910 : #i103139# continued work on the impress annotation feature 2009-09-07 18:29:37 +0200 cl r275909 : #i103139# continued work on the impress annotation feature 2009-09-07 17:25:43 +0200 cl r275905 : #i103139# continued work on the impress annotation feature 2009-09-07 12:00:28 +0200 cl r275884 : #i103139# continued work on the impress annotation feature 2009-09-06 14:14:00 +0200 cl r275859 : #i103139# continued work on the impress annotation feature 2009-09-05 20:57:24 +0200 cl r275854 : #i103139# continued work on the impress annotation feature 2009-09-05 20:56:29 +0200 cl r275853 : #i103139# continued work on the impress annotation feature 2009-09-05 20:55:27 +0200 cl r275852 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:42 +0200 cl r275851 : #i103139# continued work on the impress annotation feature 2009-09-05 20:11:09 +0200 cl r275850 : #i103139# continued work on the impress annotation feature 2009-09-05 17:43:33 +0200 cl r275845 : #i103139# continued work on the impress annotation feature 2009-09-05 17:04:41 +0200 cl r275843 : #i103139# continued work on the impress annotation feature 2009-09-05 17:03:26 +0200 cl r275842 : #i103139# continued work on the impress annotation feature 2009-09-05 17:02:53 +0200 cl r275841 : #i103139# continued work on the impress annotation feature 2009-09-05 13:15:04 +0200 pl r275839 : #i104823# WB_NEEDSFOCUS 2009-09-05 13:14:41 +0200 pl r275838 : #i104823# WB_NEEDSFOCUS 2009-09-04 17:48:21 +0200 cl r275826 : #i103139# continued work on the impress annotation feature 2009-09-04 17:35:03 +0200 cl r275825 : #i103139# continued work on the impress annotation feature 2009-09-04 17:15:46 +0200 cl r275824 : #i103139# continued work on the impress annotation feature 2009-09-04 17:12:54 +0200 cl r275823 : #i103139# continued work on the impress annotation feature 2009-09-04 17:05:23 +0200 cl r275822 : #i103139# continued work on the impress annotation feature 2009-09-04 16:48:28 +0200 cl r275820 : #i103139# continued work on the impress annotation feature 2009-09-04 16:44:02 +0200 cl r275818 : #i103139# continued work on the impress annotation feature 2009-09-04 16:43:23 +0200 cl r275817 : #i103139# continued work on the impress annotation feature 2009-09-04 16:06:04 +0200 cl r275812 : #i103139# continued work on the impress annotation feature 2009-09-04 16:05:45 +0200 cl r275811 : #i103139# continued work on the impress annotation feature 2009-09-04 15:04:33 +0200 cl r275806 : #i103139# continued work on the impress annotation feature 2009-09-04 11:43:14 +0200 cl r275795 : #i103139# continued work on the impress annotation feature 2009-09-04 11:27:10 +0200 cl r275793 : #i103139# continued work on the impress annotation feature 2009-09-04 11:10:02 +0200 cl r275792 : #i103139# continued work on the impress annotation feature 2009-09-04 11:07:05 +0200 cl r275790 : #i103139# continued work on the impress annotation feature 2009-09-04 11:05:01 +0200 cl r275789 : #i103139# continued work on the impress annotation feature 2009-09-04 10:55:51 +0200 cl r275785 : #i103139# renamed notes to comments 2009-09-04 10:54:57 +0200 cl r275784 : #i103139# renamed notes to comments 2009-09-03 20:37:35 +0200 cl r275772 : #i103139# continued work on the impress annotation feature 2009-09-03 20:35:31 +0200 cl r275771 : #i103139# continued work on the impress annotation feature 2009-09-01 18:17:55 +0200 cl r275680 : #i103139# continued work on the impress annotation feature 2009-09-01 18:15:08 +0200 cl r275678 : #i103139# continued work on the impress annotation feature 2009-09-01 18:13:38 +0200 cl r275677 : #i103139# continued work on the impress annotation feature 2009-08-18 12:35:42 +0200 cl r275089 : fixed merge error 2009-08-18 11:39:58 +0200 cl r275086 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@275001 (milestone: DEV300:m55) 2009-07-30 13:45:10 +0200 cl r274481 : fixed merge errrors 2009-07-30 13:41:21 +0200 cl r274480 : fixed merge errrors 2009-07-30 13:39:40 +0200 cl r274478 : fixed merge errrors 2009-07-22 18:07:30 +0200 cl r274256 : CWS-TOOLING: rebase CWS impressnotes01 to trunk@273858 (milestone: DEV300:m52) 2009-07-21 17:21:31 +0200 cl r274208 : merging 2009-07-20 14:28:34 +0200 cl r274137 : #i103139# annotation support for impress 2009-07-20 14:28:04 +0200 cl r274136 : #i103139# annotation support for impress 2009-07-20 14:27:20 +0200 cl r274135 : #i103139# annotation support for impress 2009-07-20 14:21:17 +0200 cl r274134 : #i103139# annotation support for impress 2009-07-20 14:20:56 +0200 cl r274133 : #i103139# annotation support for impress 2009-07-20 14:20:09 +0200 cl r274132 : #i103139# annotation support for impress 2009-07-20 14:19:00 +0200 cl r274131 : #i103139# annotation support for impress 2009-07-20 14:17:50 +0200 cl r274130 : #i103139# annotation support for impress 2009-07-20 14:12:24 +0200 cl r274129 : #i103139# annotation support for impress 2009-07-20 13:52:03 +0200 cl r274128 : #i103139# annotation support for impress 2009-07-20 13:51:11 +0200 cl r274127 : #i103139# annotation support for impress 2009-07-20 13:48:59 +0200 cl r274126 : #i103139# annotation support for impress 2009-07-20 13:43:56 +0200 cl r274125 : #i103139# annotation support for impress 2009-07-20 13:31:55 +0200 cl r274123 : #i103139# annotation support for impress 2009-07-20 13:30:45 +0200 cl r274122 : #i103139# annotation support for impress
2009-09-16 13:55:36 +00:00
FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE;
// | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE;
/*
* FLOATWIN_POPUPMODE_NOKEYCLOSE |
* don't set since it disables closing floaters with escape
*/
2000-09-18 16:07:07 +00:00
// Flags fuer Positionierung bestimmen
if ( !(nFlags & (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_UP |
FLOATWIN_POPUPMODE_LEFT | FLOATWIN_POPUPMODE_RIGHT |
FLOATWIN_POPUPMODE_NOAUTOARRANGE)) )
{
if ( pBox->IsHorizontal() )
nFlags |= FLOATWIN_POPUPMODE_DOWN;
2000-09-18 16:07:07 +00:00
else
nFlags |= FLOATWIN_POPUPMODE_RIGHT;
2000-09-18 16:07:07 +00:00
}
// FloatingModus starten
StartPopupMode( aRect, nFlags );
}
// -----------------------------------------------------------------------
void FloatingWindow::ImplEndPopupMode( sal_uInt16 nFlags, sal_uLong nFocusId )
2000-09-18 16:07:07 +00:00
{
if ( !mbInPopupMode )
return;
ImplSVData* pSVData = ImplGetSVData();
mbInCleanUp = sal_True; // prevent killing this window due to focus change while working with it
2001-10-24 07:57:18 +00:00
2000-09-18 16:07:07 +00:00
// Bei allen nachfolgenden PopupMode-Fenster den Modus auch beenden
2001-10-24 07:57:18 +00:00
while ( pSVData->maWinData.mpFirstFloat && pSVData->maWinData.mpFirstFloat != this )
2000-09-18 16:07:07 +00:00
pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
2001-10-24 07:57:18 +00:00
2000-09-18 16:07:07 +00:00
// Fenster aus der Liste austragen
pSVData->maWinData.mpFirstFloat = mpNextFloat;
mpNextFloat = NULL;
sal_uLong nPopupModeFlags = mnPopupModeFlags;
2000-09-18 16:07:07 +00:00
// Wenn nicht abgerissen wurde, dann Fenster wieder Hiden
if ( !(nFlags & FLOATWIN_POPUPMODEEND_TEAROFF) ||
!(nPopupModeFlags & FLOATWIN_POPUPMODE_ALLOWTEAROFF) )
{
Show( sal_False, SHOW_NOFOCUSCHANGE );
2000-09-18 16:07:07 +00:00
// Focus evt. auf ein entsprechendes FloatingWindow weiterschalten
if ( nFocusId )
Window::EndSaveFocus( nFocusId );
else if ( pSVData->maWinData.mpFocusWin && pSVData->maWinData.mpFirstFloat &&
ImplIsWindowOrChild( pSVData->maWinData.mpFocusWin ) )
pSVData->maWinData.mpFirstFloat->GrabFocus();
mbPopupModeTearOff = sal_False;
2000-09-18 16:07:07 +00:00
}
else
{
mbPopupModeTearOff = sal_True;
2000-09-18 16:07:07 +00:00
if ( nFocusId )
Window::EndSaveFocus( nFocusId, sal_False );
2000-09-18 16:07:07 +00:00
}
EnableSaveBackground( mbOldSaveBackMode );
mbPopupModeCanceled = (nFlags & FLOATWIN_POPUPMODEEND_CANCEL) != 0;
// Gegebenenfalls den Title wieder herstellen
SetTitleType( mnOldTitle );
// ToolBox wieder auf normal schalten
if ( mpImplData->mpBox )
2000-09-18 16:07:07 +00:00
{
mpImplData->mpBox->ImplFloatControl( sal_False, this );
mpImplData->mpBox = NULL;
2000-09-18 16:07:07 +00:00
}
// Je nach Parameter den PopupModeEnd-Handler rufen
if ( !(nFlags & FLOATWIN_POPUPMODEEND_DONTCALLHDL) )
ImplCallPopupModeEnd();
// Je nach Parameter die restlichen Fenster auch noch schliessen
if ( nFlags & FLOATWIN_POPUPMODEEND_CLOSEALL )
{
if ( !(nPopupModeFlags & FLOATWIN_POPUPMODE_NEWLEVEL) )
{
if ( pSVData->maWinData.mpFirstFloat )
{
FloatingWindow* pLastLevelFloat = pSVData->maWinData.mpFirstFloat->ImplFindLastLevelFloat();
pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
}
}
}
2001-10-24 07:57:18 +00:00
mbInCleanUp = sal_False;
2000-09-18 16:07:07 +00:00
}
// -----------------------------------------------------------------------
void FloatingWindow::EndPopupMode( sal_uInt16 nFlags )
2000-09-18 16:07:07 +00:00
{
ImplEndPopupMode( nFlags );
}
// -----------------------------------------------------------------------
void FloatingWindow::AddPopupModeWindow( Window* pWindow )
{
// !!! bisher erst 1 Fenster und noch keine Liste
mpFirstPopupModeWin = pWindow;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */