summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-06-27 14:39:28 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-06-27 14:39:28 +0000
commitab85a98facea9597616eac9a0a86bbbb742ab520 (patch)
tree6025552a4e1ad1cd9c7b0386b2d903657e7fa1d9 /accessibility
parente1918cb104aed2ff1a47e59534322bf0f391e615 (diff)
INTEGRATION: CWS a11ysep (1.1.2); FILE ADDED
2007/02/28 07:29:11 fs 1.1.2.4: #i10000# 2007/02/27 12:37:30 fs 1.1.2.3: manual RESYNC: merge MWS-changes which happened from m185 to m204 2005/09/28 11:35:31 fs 1.1.2.2: manual resync (files have been moved herein from another location): licence change 2005/03/07 08:29:05 fs 1.1.2.1: #i44293# moved implementations herein from toolkit module
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/source/standard/vclxaccessiblemenubar.cxx231
1 files changed, 231 insertions, 0 deletions
diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/accessibility/source/standard/vclxaccessiblemenubar.cxx
new file mode 100644
index 000000000000..9f7c0bc10f34
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblemenubar.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: vclxaccessiblemenubar.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2007-06-27 15:39:28 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX
+#include <accessibility/standard/vclxaccessiblemenubar.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_STANDARD_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+#ifndef _SV_MENU_HXX
+#include <vcl/menu.hxx>
+#endif
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class VCLXAccessibleMenuBar
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuBar::VCLXAccessibleMenuBar( Menu* pMenu )
+ :OAccessibleMenuComponent( pMenu )
+{
+ if ( pMenu )
+ {
+ m_pWindow = pMenu->GetWindow();
+
+ if ( m_pWindow )
+ m_pWindow->AddEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuBar::~VCLXAccessibleMenuBar()
+{
+ if ( m_pWindow )
+ m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuBar::IsFocused()
+{
+ sal_Bool bFocused = sal_False;
+
+ if ( m_pWindow && m_pWindow->HasFocus() && !IsChildHighlighted() )
+ bFocused = sal_True;
+
+ return bFocused;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( VCLXAccessibleMenuBar, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "VCLXAccessibleMenuBar::WindowEventListener: unknown window event!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "VCLXAccessibleMenuBar::WindowEventListener: no window!" );
+ if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
+ {
+ ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenuBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ SetFocused( rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS );
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING:
+ {
+ if ( m_pWindow )
+ {
+ m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+ m_pWindow = NULL;
+ }
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenuBar::disposing()
+{
+ OAccessibleMenuComponent::disposing();
+
+ if ( m_pWindow )
+ {
+ m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+ m_pWindow = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuBar::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleMenuBar" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleMenuBar::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleMenuBar" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuBar::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndexInParent = -1;
+
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ {
+ Window* pParent = pWindow->GetAccessibleParentWindow();
+ if ( pParent )
+ {
+ for ( USHORT n = pParent->GetAccessibleChildWindowCount(); n; )
+ {
+ Window* pChild = pParent->GetAccessibleChildWindow( --n );
+ if ( pChild == pWindow )
+ {
+ nIndexInParent = n;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return nIndexInParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleMenuBar::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::MENU_BAR;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuBar::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetStyleSettings().GetMenuBarColor().GetColor();
+}
+
+// -----------------------------------------------------------------------------