Update ooo320-m1
[ooovba.git] / applied_patches / 0007-cws-koheidatapilot03-vcl.diff
blob7e225554e415668cbb41ed30758dae20a29e0ae1
1 diff --git vcl/inc/vcl/popupmenuwindow.hxx vcl/inc/vcl/popupmenuwindow.hxx
2 new file mode 100644
3 index 0000000..ef31da0
4 --- /dev/null
5 +++ vcl/inc/vcl/popupmenuwindow.hxx
6 @@ -0,0 +1,50 @@
7 +/*************************************************************************
8 + *
9 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10 + *
11 + * Copyright 2008 by Sun Microsystems, Inc.
12 + *
13 + * OpenOffice.org - a multi-platform office productivity suite
14 + *
15 + * $RCSfile: floatwin.hxx,v $
16 + * $Revision: 1.3 $
17 + *
18 + * This file is part of OpenOffice.org.
19 + *
20 + * OpenOffice.org is free software: you can redistribute it and/or modify
21 + * it under the terms of the GNU Lesser General Public License version 3
22 + * only, as published by the Free Software Foundation.
23 + *
24 + * OpenOffice.org is distributed in the hope that it will be useful,
25 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 + * GNU Lesser General Public License version 3 for more details
28 + * (a copy is included in the LICENSE file that accompanied this code).
29 + *
30 + * You should have received a copy of the GNU Lesser General Public License
31 + * version 3 along with OpenOffice.org. If not, see
32 + * <http://www.openoffice.org/license.html>
33 + * for a copy of the LGPLv3 License.
34 + *
35 + ************************************************************************/
37 +#ifndef __POPUPMENUWINDOW_HXX__
38 +#define __POPUPMENUWINDOW_HXX__
40 +#include "vcl/floatwin.hxx"
42 +class VCL_DLLPUBLIC PopupMenuFloatingWindow : public FloatingWindow
44 +private:
45 + struct ImplData;
46 + ImplData* mpImplData;
47 +public:
48 + PopupMenuFloatingWindow( Window* pParent, WinBits nStyle = (WB_SYSTEMFLOATWIN|WB_SYSTEMWINDOW|WB_NOBORDER) );
49 + ~PopupMenuFloatingWindow();
51 + sal_uInt16 GetMenuStackLevel() const;
52 + void SetMenuStackLevel( sal_uInt16 nLevel );
53 + bool IsPopupMenu() const;
54 +};
56 +#endif
57 diff --git vcl/inc/vcl/vclevent.hxx vcl/inc/vcl/vclevent.hxx
58 index 8d84666..59163ca 100644
59 --- vcl/inc/vcl/vclevent.hxx
60 +++ vcl/inc/vcl/vclevent.hxx
61 @@ -35,11 +35,19 @@
62 #include <tools/rtti.hxx>
63 #include <vcl/dllapi.h>
65 +#include <com/sun/star/uno/Reference.hxx>
67 #include <list>
69 class Window;
70 class Menu;
72 +namespace com { namespace sun { namespace star {
73 + namespace accessibility {
74 + class XAccessible;
75 + }
76 +}}}
78 #define VCLEVENT_OBJECT_DYING 1
80 // VclWindowEvent:
81 @@ -239,6 +247,16 @@ public:
82 USHORT GetItemPos() const { return mnPos; }
85 +class VCL_DLLPUBLIC VclAccessibleEvent: public VclSimpleEvent
87 +public:
88 + VclAccessibleEvent( ULONG n, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxAccessible );
89 + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetAccessible() const;
91 +private:
92 + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
93 +};
95 class VCL_DLLPUBLIC VclEventListeners : public std::list<Link>
97 public:
98 diff --git vcl/inc/vcl/window.h vcl/inc/vcl/window.h
99 index b81aed8..0e25330 100644
100 --- vcl/inc/vcl/window.h
101 +++ vcl/inc/vcl/window.h
102 @@ -358,7 +358,8 @@ public:
103 mbToolbarFloatingWindow:1,
104 mbCallHandlersDuringInputDisabled:1,
105 mbDisableAccessibleLabelForRelation:1,
106 - mbDisableAccessibleLabeledByRelation:1;
107 + mbDisableAccessibleLabeledByRelation:1,
108 + mbFakeFocusSet:1;
110 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
112 diff --git vcl/inc/vcl/window.hxx vcl/inc/vcl/window.hxx
113 index d927ab0..945f1c5 100644
114 --- vcl/inc/vcl/window.hxx
115 +++ vcl/inc/vcl/window.hxx
116 @@ -582,7 +582,7 @@ protected:
118 void ImplCallEventListeners( ULONG nEvent, void* pData = NULL );
119 void CallEventListeners( ULONG nEvent, void* pData = NULL );
121 + void FireVclEvent( VclSimpleEvent* pEvent );
123 // FIXME: this is a hack to workaround missing layout functionality
124 SAL_DLLPRIVATE void ImplAdjustNWFSizes();
125 @@ -899,6 +899,13 @@ public:
126 USHORT GetGetFocusFlags() const;
127 void GrabFocusToDocument();
129 + /**
130 + * Set this when you need to act as if the window has focus even if it
131 + * doesn't. This is necessary for implementing tab stops inside floating
132 + * windows, but floating windows don't get focus from the system.
133 + */
134 + void SetFakeFocus( bool bFocus );
136 BOOL IsCompoundControl() const;
137 BOOL HasCompoundControlFocus() const;
139 diff --git vcl/prj/d.lst vcl/prj/d.lst
140 index d9c14f4..7ac2c74 100644
141 --- vcl/prj/d.lst
142 +++ vcl/prj/d.lst
143 @@ -84,6 +84,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl\plug\vcl
144 ..\inc\vcl\octree.hxx %_DEST%\inc%_EXT%\vcl\octree.hxx
145 ..\inc\vcl\outdev.hxx %_DEST%\inc%_EXT%\vcl\outdev.hxx
146 ..\inc\vcl\pointr.hxx %_DEST%\inc%_EXT%\vcl\pointr.hxx
147 +..\inc\vcl\popupmenuwindow.hxx %_DEST%\inc%_EXT%\vcl\popupmenuwindow.hxx
148 ..\inc\vcl\print.hxx %_DEST%\inc%_EXT%\vcl\print.hxx
149 ..\inc\vcl\prndlg.hxx %_DEST%\inc%_EXT%\vcl\prndlg.hxx
150 ..\inc\vcl\prntypes.hxx %_DEST%\inc%_EXT%\vcl\prntypes.hxx
151 diff --git vcl/source/app/vclevent.cxx vcl/source/app/vclevent.cxx
152 index 75ef1ea..fef22ff 100644
153 --- vcl/source/app/vclevent.cxx
154 +++ vcl/source/app/vclevent.cxx
155 @@ -34,10 +34,24 @@
156 #include "vcl/vclevent.hxx"
157 #include "vcl/svdata.hxx"
159 +#include <com/sun/star/accessibility/XAccessible.hpp>
161 +using ::com::sun::star::uno::Reference;
162 +using ::com::sun::star::accessibility::XAccessible;
164 TYPEINIT0(VclSimpleEvent);
165 TYPEINIT1(VclWindowEvent, VclSimpleEvent);
166 TYPEINIT1(VclMenuEvent, VclSimpleEvent);
168 +VclAccessibleEvent::VclAccessibleEvent( ULONG n, const Reference<XAccessible>& rxAccessible ) :
169 + VclSimpleEvent(n),
170 + mxAccessible(rxAccessible) {}
172 +Reference<XAccessible> VclAccessibleEvent::GetAccessible() const
174 + return mxAccessible;
177 void VclEventListeners::Call( VclSimpleEvent* pEvent ) const
179 // Copy the list, because this can be destroyed when calling a Link...
180 diff --git vcl/source/window/makefile.mk vcl/source/window/makefile.mk
181 index 169cf44..d17ea6c 100644
182 --- vcl/source/window/makefile.mk
183 +++ vcl/source/window/makefile.mk
184 @@ -69,6 +69,7 @@ SLOFILES= \
185 $(SLO)$/mnemonic.obj \
186 $(SLO)$/mnemonicengine.obj \
187 $(SLO)$/msgbox.obj \
188 + $(SLO)$/popupmenuwindow.obj \
189 $(SLO)$/scrwnd.obj \
190 $(SLO)$/seleng.obj \
191 $(SLO)$/split.obj \
192 diff --git vcl/source/window/popupmenuwindow.cxx vcl/source/window/popupmenuwindow.cxx
193 new file mode 100644
194 index 0000000..869f52b
195 --- /dev/null
196 +++ vcl/source/window/popupmenuwindow.cxx
197 @@ -0,0 +1,82 @@
198 +/*************************************************************************
200 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
201 + *
202 + * Copyright 2008 by Sun Microsystems, Inc.
204 + * OpenOffice.org - a multi-platform office productivity suite
206 + * $RCSfile: floatwin.hxx,v $
207 + * $Revision: 1.3 $
209 + * This file is part of OpenOffice.org.
211 + * OpenOffice.org is free software: you can redistribute it and/or modify
212 + * it under the terms of the GNU Lesser General Public License version 3
213 + * only, as published by the Free Software Foundation.
215 + * OpenOffice.org is distributed in the hope that it will be useful,
216 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
217 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
218 + * GNU Lesser General Public License version 3 for more details
219 + * (a copy is included in the LICENSE file that accompanied this code).
221 + * You should have received a copy of the GNU Lesser General Public License
222 + * version 3 along with OpenOffice.org. If not, see
223 + * <http://www.openoffice.org/license.html>
224 + * for a copy of the LGPLv3 License.
226 + ************************************************************************/
228 +// MARKER(update_precomp.py): autogen include statement, do not remove
229 +#include "precompiled_vcl.hxx"
231 +#include "vcl/popupmenuwindow.hxx"
233 +#include <limits>
235 +struct PopupMenuFloatingWindow::ImplData
237 + sal_uInt16 mnMenuStackLevel; // Store the stack level of a popup menu. 0 = top-level menu.
239 + ImplData();
240 + ~ImplData();
243 +PopupMenuFloatingWindow::ImplData::ImplData() :
244 + mnMenuStackLevel( ::std::numeric_limits<sal_uInt16>::max() )
248 +PopupMenuFloatingWindow::ImplData::~ImplData()
252 +// ============================================================================
254 +PopupMenuFloatingWindow::PopupMenuFloatingWindow( Window* pParent, WinBits nStyle ) :
255 + FloatingWindow(pParent, nStyle),
256 + mpImplData(new ImplData)
260 +PopupMenuFloatingWindow::~PopupMenuFloatingWindow()
262 + delete mpImplData;
265 +sal_uInt16 PopupMenuFloatingWindow::GetMenuStackLevel() const
267 + return mpImplData->mnMenuStackLevel;
270 +void PopupMenuFloatingWindow::SetMenuStackLevel( sal_uInt16 nLevel )
272 + mpImplData->mnMenuStackLevel = nLevel;
275 +bool PopupMenuFloatingWindow::IsPopupMenu() const
277 + return mpImplData->mnMenuStackLevel != ::std::numeric_limits<sal_uInt16>::max();
280 diff --git vcl/source/window/window.cxx vcl/source/window/window.cxx
281 index 2b14764..4ff4999 100644
282 --- vcl/source/window/window.cxx
283 +++ vcl/source/window/window.cxx
284 @@ -690,6 +690,7 @@ void Window::ImplInitWindowData( WindowType nType )
285 mpWindowImpl->mbCallHandlersDuringInputDisabled = FALSE; // TRUE: call event handlers even if input is disabled
286 mpWindowImpl->mbDisableAccessibleLabelForRelation = FALSE; // TRUE: do not set LabelFor relation on accessible objects
287 mpWindowImpl->mbDisableAccessibleLabeledByRelation = FALSE; // TRUE: do not set LabeledBy relation on accessible objects
288 + mpWindowImpl->mbFakeFocusSet = FALSE; // TRUE: pretend as if the window has focus.
290 mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
292 @@ -3901,6 +3902,20 @@ void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow,
296 +static bool IsWindowFocused(const WindowImpl& rWinImpl)
298 + if (rWinImpl.mpSysObj)
299 + return true;
301 + if (rWinImpl.mpFrameData->mbHasFocus)
302 + return true;
304 + if (rWinImpl.mbFakeFocusSet)
305 + return true;
307 + return false;
310 // -----------------------------------------------------------------------
311 void Window::ImplGrabFocus( USHORT nFlags )
313 @@ -3972,9 +3987,7 @@ void Window::ImplGrabFocus( USHORT nFlags )
314 pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
317 - BOOL bHasFocus = TRUE;
318 - if ( !mpWindowImpl->mpSysObj && !mpWindowImpl->mpFrameData->mbHasFocus )
319 - bHasFocus = FALSE;
320 + bool bHasFocus = IsWindowFocused(*mpWindowImpl);
322 BOOL bMustNotGrabFocus = FALSE;
323 // #100242#, check parent hierarchy if some floater prohibits grab focus
324 @@ -5367,6 +5380,11 @@ void Window::CallEventListeners( ULONG nEvent, void* pData )
328 +void Window::FireVclEvent( VclSimpleEvent* pEvent )
330 + ImplGetSVData()->mpApp->ImplCallEventListeners(pEvent);
333 // -----------------------------------------------------------------------
335 void Window::AddEventListener( const Link& rEventListener )
336 @@ -7742,6 +7760,11 @@ void Window::GrabFocusToDocument()
340 +void Window::SetFakeFocus( bool bFocus )
342 + ImplGetWindowImpl()->mbFakeFocusSet = bFocus;
345 // -----------------------------------------------------------------------
347 BOOL Window::HasChildPathFocus( BOOL bSystemWindow ) const
348 diff --git vcl/unx/gtk/a11y/atkutil.cxx vcl/unx/gtk/a11y/atkutil.cxx
349 index 5206c8c..be6f95e 100644
350 --- vcl/unx/gtk/a11y/atkutil.cxx
351 +++ vcl/unx/gtk/a11y/atkutil.cxx
352 @@ -659,7 +659,16 @@ long WindowEventHandler(void *, ::VclSimpleEvent const * pEvent)
353 static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow());
355 case VCLEVENT_MENU_HIGHLIGHT:
356 - handle_menu_highlighted(static_cast< ::VclMenuEvent const * >(pEvent));
357 + if (const VclMenuEvent* pMenuEvent = dynamic_cast<const VclMenuEvent*>(pEvent))
359 + handle_menu_highlighted(pMenuEvent);
361 + else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(pEvent))
363 + uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible();
364 + if (xAccessible.is())
365 + atk_wrapper_focus_tracker_notify_when_idle(xAccessible);
367 break;
369 case VCLEVENT_TOOLBOX_HIGHLIGHT:
370 diff --git vcl/unx/gtk/a11y/atkwindow.cxx vcl/unx/gtk/a11y/atkwindow.cxx
371 index e98a809..23ba24c 100644
372 --- vcl/unx/gtk/a11y/atkwindow.cxx
373 +++ vcl/unx/gtk/a11y/atkwindow.cxx
374 @@ -33,6 +33,7 @@
376 #include <plugins/gtk/gtkframe.hxx>
377 #include <vcl/window.hxx>
378 +#include "vcl/popupmenuwindow.hxx"
380 #include "atkwindow.hxx"
381 #include "atkwrapper.hxx"
382 @@ -108,6 +109,17 @@ init_from_window( AtkObject *accessible, Window *pWindow )
383 pChild->SetAccessibleRole( AccessibleRole::LABEL );
384 accessible->name = g_strdup( rtl::OUStringToOString( pChild->GetText(), RTL_TEXTENCODING_UTF8 ).getStr() );
386 + else if ( pWindow->GetType() == WINDOW_BORDERWINDOW && pChild->GetType() == WINDOW_FLOATINGWINDOW )
388 + PopupMenuFloatingWindow* p = dynamic_cast<PopupMenuFloatingWindow*>(pChild);
389 + if (p && p->IsPopupMenu() && p->GetMenuStackLevel() == 0)
391 + // This is a top-level menu popup. Register it.
392 + role = ATK_ROLE_POPUP_MENU;
393 + pChild->SetAccessibleRole( AccessibleRole::POPUP_MENU );
394 + accessible->name = g_strdup( rtl::OUStringToOString( pChild->GetText(), RTL_TEXTENCODING_UTF8 ).getStr() );
398 break;
400 @@ -136,6 +148,23 @@ ooo_window_wrapper_real_focus_gtk (GtkWidget *, GdkEventFocus *)
402 /*****************************************************************************/
404 +static bool
405 +isChildPopupMenu(Window* pWindow)
407 + Window* pChild = pWindow->GetAccessibleChildWindow(0);
408 + if (!pChild)
409 + return false;
411 + if (WINDOW_FLOATINGWINDOW != pChild->GetType())
412 + return false;
414 + PopupMenuFloatingWindow* p = dynamic_cast<PopupMenuFloatingWindow*>(pChild);
415 + if (!p)
416 + return false;
418 + return p->IsPopupMenu();
421 static void
422 ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data)
424 @@ -157,8 +186,16 @@ ooo_window_wrapper_real_initialize(AtkObject *obj, gpointer data)
426 if( WINDOW_BORDERWINDOW == pWindow->GetType() )
428 - ooo_wrapper_registry_add( xAccessible, obj );
429 - g_object_set_data( G_OBJECT(obj), "ooo:atk-wrapper-key", xAccessible.get() );
430 + if ( isChildPopupMenu(pWindow) )
432 + AtkObject *child = atk_object_wrapper_new( xAccessible, obj );
433 + ooo_wrapper_registry_add( xAccessible, child );
435 + else
437 + ooo_wrapper_registry_add( xAccessible, obj );
438 + g_object_set_data( G_OBJECT(obj), "ooo:atk-wrapper-key", xAccessible.get() );
441 else
443 diff --git vcl/unx/gtk/a11y/atkwrapper.cxx vcl/unx/gtk/a11y/atkwrapper.cxx
444 index 599f283..ac508bd 100644
445 --- vcl/unx/gtk/a11y/atkwrapper.cxx
446 +++ vcl/unx/gtk/a11y/atkwrapper.cxx
447 @@ -514,6 +514,60 @@ wrapper_ref_relation_set( AtkObject *atk_obj )
449 /*****************************************************************************/
451 +#if 0
452 +struct {
453 + sal_Int16 value;
454 + const sal_Char* name;
455 +} aStateTypeTable[] = {
456 + { accessibility::AccessibleStateType::INVALID, "INVALID" },
457 + { accessibility::AccessibleStateType::ACTIVE, "ACTIVE" },
458 + { accessibility::AccessibleStateType::ARMED, "ARMED" },
459 + { accessibility::AccessibleStateType::BUSY, "BUSY" },
460 + { accessibility::AccessibleStateType::CHECKED, "CHECKED" },
461 + { accessibility::AccessibleStateType::DEFUNC, "DEFUNC" },
462 + { accessibility::AccessibleStateType::EDITABLE, "EDITABLE" },
463 + { accessibility::AccessibleStateType::ENABLED, "ENABLED" },
464 + { accessibility::AccessibleStateType::EXPANDABLE, "EXPANDABLE" },
465 + { accessibility::AccessibleStateType::EXPANDED, "EXPANDED" },
466 + { accessibility::AccessibleStateType::FOCUSABLE, "FOCUSABLE" },
467 + { accessibility::AccessibleStateType::FOCUSED, "FOCUSED" },
468 + { accessibility::AccessibleStateType::HORIZONTAL, "HORIZONTAL" },
469 + { accessibility::AccessibleStateType::ICONIFIED, "ICONIFIED" },
470 + { accessibility::AccessibleStateType::INDETERMINATE, "INDETERMINATE" },
471 + { accessibility::AccessibleStateType::MANAGES_DESCENDANTS, "MANAGES_DESCENDANTS" },
472 + { accessibility::AccessibleStateType::MODAL, "MODAL" },
473 + { accessibility::AccessibleStateType::MULTI_LINE, "MULTI_LINE" },
474 + { accessibility::AccessibleStateType::MULTI_SELECTABLE, "MULTI_SELECTABLE" },
475 + { accessibility::AccessibleStateType::OPAQUE, "OPAQUE" },
476 + { accessibility::AccessibleStateType::PRESSED, "PRESSED" },
477 + { accessibility::AccessibleStateType::RESIZABLE, "RESIZABLE" },
478 + { accessibility::AccessibleStateType::SELECTABLE, "SELECTABLE" },
479 + { accessibility::AccessibleStateType::SELECTED, "SELECTED" },
480 + { accessibility::AccessibleStateType::SENSITIVE, "SENSITIVE" },
481 + { accessibility::AccessibleStateType::SHOWING, "SHOWING" },
482 + { accessibility::AccessibleStateType::SINGLE_LINE, "SINGLE_LINE" },
483 + { accessibility::AccessibleStateType::STALE, "STALE" },
484 + { accessibility::AccessibleStateType::TRANSIENT, "TRANSIENT" },
485 + { accessibility::AccessibleStateType::VERTICAL, "VERTICAL" },
486 + { accessibility::AccessibleStateType::VISIBLE, "VISIBLE" }
489 +static void printStates(const uno::Sequence<sal_Int16>& rStates)
491 + sal_Int32 n = rStates.getLength();
492 + size_t nTypes = sizeof(aStateTypeTable)/sizeof(aStateTypeTable[0]);
493 + for (sal_Int32 i = 0; i < n; ++i)
495 + for (size_t j = 0; j < nTypes; ++j)
497 + if (aStateTypeTable[j].value == rStates[i])
498 + printf("%s ", aStateTypeTable[j].name);
501 + printf("\n");
503 +#endif
505 static AtkStateSet *
506 wrapper_ref_state_set( AtkObject *atk_obj )