/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #include #include #include #include #include #include #include #include #include #include #include #include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::accessibility; using namespace ::comphelper; // VCLXAccessibleCheckBox VCLXAccessibleCheckBox::VCLXAccessibleCheckBox( VCLXWindow* pVCLWindow ) :VCLXAccessibleTextComponent( pVCLWindow ) { m_bChecked = IsChecked(); m_bIndeterminate = IsIndeterminate(); } VCLXAccessibleCheckBox::~VCLXAccessibleCheckBox() { } bool VCLXAccessibleCheckBox::IsChecked() { bool bChecked = false; VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 1 ) bChecked = true; return bChecked; } bool VCLXAccessibleCheckBox::IsIndeterminate() { bool bIndeterminate = false; VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 2 ) bIndeterminate = true; return bIndeterminate; } void VCLXAccessibleCheckBox::SetChecked( bool bChecked ) { if ( m_bChecked != bChecked ) { Any aOldValue, aNewValue; if ( m_bChecked ) aOldValue <<= AccessibleStateType::CHECKED; else aNewValue <<= AccessibleStateType::CHECKED; m_bChecked = bChecked; NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); } } void VCLXAccessibleCheckBox::SetIndeterminate( bool bIndeterminate ) { if ( m_bIndeterminate != bIndeterminate ) { Any aOldValue, aNewValue; if ( m_bIndeterminate ) aOldValue <<= AccessibleStateType::INDETERMINATE; else aNewValue <<= AccessibleStateType::INDETERMINATE; m_bIndeterminate = bIndeterminate; NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); } } void VCLXAccessibleCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { switch ( rVclWindowEvent.GetId() ) { case VCLEVENT_CHECKBOX_TOGGLE: { SetChecked( IsChecked() ); SetIndeterminate( IsIndeterminate() ); } break; default: VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); } } void VCLXAccessibleCheckBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) { VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); rStateSet.AddState( AccessibleStateType::FOCUSABLE ); if ( IsChecked() ) rStateSet.AddState( AccessibleStateType::CHECKED ); if ( IsIndeterminate() ) rStateSet.AddState( AccessibleStateType::INDETERMINATE ); } // XInterface IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE ) // XTypeProvider IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE ) // XServiceInfo OUString VCLXAccessibleCheckBox::getImplementationName() throw (RuntimeException, std::exception) { return OUString( "com.sun.star.comp.toolkit.AccessibleCheckBox" ); } Sequence< OUString > VCLXAccessibleCheckBox::getSupportedServiceNames() throw (RuntimeException, std::exception) { Sequence< OUString > aNames(1); aNames[0] = "com.sun.star.awt.AccessibleCheckBox"; return aNames; } // XAccessibleAction sal_Int32 VCLXAccessibleCheckBox::getAccessibleActionCount( ) throw (RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); return 1; } sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); CheckBox* pCheckBox = static_cast(GetWindow()); VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); if ( pCheckBox && pVCLXCheckBox ) { sal_Int32 nValueMin = (sal_Int32) 0; sal_Int32 nValueMax = (sal_Int32) 1; if ( pCheckBox->IsTriStateEnabled() ) nValueMax = (sal_Int32) 2; sal_Int32 nValue = (sal_Int32) pVCLXCheckBox->getState(); ++nValue; if ( nValue > nValueMax ) nValue = nValueMin; pVCLXCheckBox->setState( (sal_Int16) nValue ); } return true; } OUString VCLXAccessibleCheckBox::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); if(IsChecked()) return TK_RES_STRING( RID_STR_ACC_ACTION_UNCHECK ); else return TK_RES_STRING( RID_STR_ACC_ACTION_CHECK ); } Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; vcl::Window* pWindow = GetWindow(); if ( pWindow ) { KeyEvent aKeyEvent = pWindow->GetActivationKey(); vcl::KeyCode aKeyCode = aKeyEvent.GetKeyCode(); if ( aKeyCode.GetCode() != 0 ) { awt::KeyStroke aKeyStroke; aKeyStroke.Modifiers = 0; if ( aKeyCode.IsShift() ) aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT; if ( aKeyCode.IsMod1() ) aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; if ( aKeyCode.IsMod2() ) aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; if ( aKeyCode.IsMod3() ) aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; aKeyStroke.KeyCode = aKeyCode.GetCode(); aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); pKeyBindingHelper->AddKeyBinding( aKeyStroke ); } } return xKeyBinding; } // XAccessibleValue Any VCLXAccessibleCheckBox::getCurrentValue( ) throw (RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); Any aValue; VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); if ( pVCLXCheckBox ) aValue <<= (sal_Int32) pVCLXCheckBox->getState(); return aValue; } sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber ) throw (RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); bool bReturn = false; VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); if ( pVCLXCheckBox ) { sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0; OSL_VERIFY( aNumber >>= nValue ); OSL_VERIFY( getMinimumValue() >>= nValueMin ); OSL_VERIFY( getMaximumValue() >>= nValueMax ); if ( nValue < nValueMin ) nValue = nValueMin; else if ( nValue > nValueMax ) nValue = nValueMax; pVCLXCheckBox->setState( (sal_Int16) nValue ); bReturn = true; } return bReturn; } Any VCLXAccessibleCheckBox::getMaximumValue( ) throw (RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); Any aValue; CheckBox* pCheckBox = static_cast(GetWindow()); if ( pCheckBox && pCheckBox->IsTriStateEnabled() ) aValue <<= (sal_Int32) 2; else aValue <<= (sal_Int32) 1; return aValue; } Any VCLXAccessibleCheckBox::getMinimumValue( ) throw (RuntimeException, std::exception) { OExternalLockGuard aGuard( this ); Any aValue; aValue <<= (sal_Int32) 0; return aValue; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ue='feature/allo_contract34185'>feature/allo_contract34185 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-01-26gbuild: do not copy boost headers aroundMichael Stahl
- do not use gb_UnpackedTarball_copy_header_files for boost - adapt the optimization in concat-deps.c for new path - use boost_headers in all LinkTargets that require it - add explicit include paths to mysqlc, mysqlcppconn, libvisio, liborcus Change-Id: I0c43e73ed43cc9d2e6bce8faf55e992d655a0bb9
2012-12-25Get rid of (most uses of) GUITor Lillqvist
GUI only takes values UNX or WNT, so it is fairly pointless. One can check whether OS is WNT or not instead. Change-Id: I78ae32c03536a496a563e5deeb0fca78aebf9c34 Reviewed-on: https://gerrit.libreoffice.org/1304 Reviewed-by: Peter Foley <pefoley2@verizon.net> Tested-by: Peter Foley <pefoley2@verizon.net>
2012-12-18Replace GUIBASE checks with equivalent OS checksTor Lillqvist
The idea is to get rid of GUIBASE and GUI checks as much as possible. GUIBASE=aqua <=> OS=MACOSX GUIBASE=WIN <=> OS=WNT GUIBASE=cocoatouch <=> OS=IOS GUIBASE=android <=> OS=ANDROID Don't set GUIBASE to these values any more in configure.ac either. GUIBASE_FOR_BUILD is not used anywhere. Conflicts: configure.ac postprocess/packcomponents/makefile.mk postprocess/packregistry/makefile.mk Change-Id: Ie0526b40e1073f2328ba6c333e28752104b0fed3
2012-11-21Clean up remains of NativeActivity-based Android app supportTor Lillqvist
We haven't been able to build NativeActivity-based apps (like the android/qa/sc and anroid/qa/desktop thingies) since we switched to DISABLE_DYNLOADING and a single DSO liblo-native-code.so anyway. No lo_main() any more. <sal/main.h> should not be included ever when compiling for Android of iOS now. Lots of stuff binned from vcl's androidinst.cxx, in the (vain?) hope that it will reduce the amount of never invoked GUI code that gets linked in. Change-Id: I25f584864c40110774c728a23151e089620442d9
2012-09-28gbuild: invert handling of standard system libraries:Michael Stahl
Always link in gb_STDLIBS, except when the library explicitly opts out with gb_LinkTarget_disable_standard_system_libs. Change-Id: I489a99114fbfa46d0421a27cf6c7b899dc268a4a
2012-09-28gbuild: replace direct gb_STDLIBS use with ...Michael Stahl
... new gb_LinkTarget_add_standard_system_libs Change-Id: Ib2bc843098db3d8c6822b45a3d21724e67f57d69
2012-09-28gbuild: split uwinapi out of gb_STDLIBSMichael Stahl
Change-Id: I53316e0b9369d806197bccb42cf22d3497af43e7
2012-09-27tubes: fix glibc detected memory corruption in ScDocShellMatúš Kukan
ENABLE_TELEPATHY was used in docsh.hxx but not defined consistently. Add global define to gbuild. Change-Id: I9746297a0be0e01573e336d4ee237bcc14d2d47d
2012-07-24tubes: init TeleManager in desktopMatúš Kukan
- register clients when we run --invisible - create ScDocFuncSend only if we are going to use it Change-Id: I7e33cd5a2e42e34a055146dc6c2bdac3657d6529
2012-07-02targetted improvement of UNO API includes / usageMichael Meeks
2012-05-22android: re-add main to libsofficeapp for androidMichael Meeks
2012-04-08gbuild: "use" vs. "add":Michael Stahl
Naming convention for gbuild methods: - "add" is used for stuff that is logically a part of the target (i.e. not registered at the Module, but defined in the target's makefile) - "use" is used for stuff that is logically a different target (i.e. it is registered at the Module, has it's own makefile, may be in a different module than the target)
2012-03-12desktop: move lockfile.cxx to libdeploymentmiscMichael Stahl
2012-03-12desktop: libsofficeapp shouln't need a main()Michael Stahl