summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorPascal Junck <pjunck@openoffice.org>2004-10-22 11:14:28 +0000
committerPascal Junck <pjunck@openoffice.org>2004-10-22 11:14:28 +0000
commit99f9b27adb7bf2e4285eb10cf033818e9f87e33b (patch)
treeaab4d60aee9657f916b963c339e236a77e41310a /vcl
parent2c5ca4892a93453c628576b0e2d4f992e5d58e9a (diff)
INTEGRATION: CWS dba17 (1.15.200); FILE MERGED
2004/09/27 11:55:40 fs 1.15.200.1: AddWindow: ensure that if two windows have an parent/child relation, the child is inserted *before* the parent. Done during #i33573#, but in real the fix for #98916#, whose original fix indirectly caused #i33573#
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/taskpanelist.cxx44
1 files changed, 37 insertions, 7 deletions
diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index 5e920d8f401a..31ea1a502cc2 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: taskpanelist.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: vg $ $Date: 2004-01-06 14:19:09 $
+ * last change: $Author: pjunck $ $Date: 2004-10-22 12:14:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -144,13 +144,16 @@ TaskPaneList::~TaskPaneList()
void TaskPaneList::AddWindow( Window *pWindow )
{
+#if OSL_DEBUG_LEVEL > 0
bool bDockingWindow=false;
bool bToolbox=false;
bool bDialog=false;
bool bUnknown=false;
+#endif
if( pWindow )
{
+#if OSL_DEBUG_LEVEL > 0
if( pWindow->GetType() == RSC_DOCKINGWINDOW )
bDockingWindow = true;
else if( pWindow->GetType() == RSC_TOOLBOX )
@@ -159,13 +162,40 @@ void TaskPaneList::AddWindow( Window *pWindow )
bDialog = true;
else
bUnknown = true;
+#endif
- ::std::vector< Window* >::iterator p;
- p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), pWindow );
+ ::std::vector< Window* >::iterator insertionPos = mTaskPanes.end();
+ for ( ::std::vector< Window* >::iterator p = mTaskPanes.begin();
+ p != mTaskPanes.end();
+ ++p
+ )
+ {
+ if ( *p == pWindow )
+ // avoid duplicates
+ return;
+
+ // If the new window is the child of an existing pane window, or vice versa,
+ // ensure that in our pane list, *first* the child window appears, *then*
+ // the ancestor window.
+ // This is necessary for HandleKeyEvent: There, the list is traveled from the
+ // beginning, until the first window is found which has the ChildPathFocus. Now
+ // if this would be the ancestor window of another pane window, this would fudge
+ // the result
+ // 2004-09-27 - fs@openoffice.org, while fixing #i33573#, which included replacing
+ // the original fix for #98916# with this one here.
+ if ( pWindow->IsWindowOrChild( *p ) )
+ {
+ insertionPos = p + 1;
+ break;
+ }
+ if ( (*p)->IsWindowOrChild( pWindow ) )
+ {
+ insertionPos = p;
+ break;
+ }
+ }
- // avoid duplicates
- if( p == mTaskPanes.end() ) // not found
- mTaskPanes.push_back( pWindow );
+ mTaskPanes.insert( insertionPos, pWindow );
}
}