diff options
Diffstat (limited to 'accessibility/inc/accessibility/helper')
6 files changed, 510 insertions, 0 deletions
diff --git a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx new file mode 100644 index 000000000000..561b2122a00a --- /dev/null +++ b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX +#define ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX + +#include <tools/gen.hxx> +#include <tools/string.hxx> +#include <vcl/wintypes.hxx> +#include <tools/gen.hxx> + +namespace com { namespace sun { namespace star { namespace datatransfer { namespace clipboard { + class XClipboard; +} } } } } + +class Window; +namespace accessibility +{ + class SAL_NO_VTABLE IComboListBoxHelper + { + public: + virtual String GetEntry( USHORT nPos ) const = 0; + virtual Rectangle GetDropDownPosSizePixel( ) const = 0; + virtual Rectangle GetBoundingRectangle( USHORT nItem ) const = 0; + virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) = 0; + virtual BOOL IsActive() const = 0; + virtual BOOL IsEntryVisible( USHORT nPos ) const = 0; + virtual USHORT GetDisplayLineCount() const = 0; + virtual void GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const = 0; + virtual WinBits GetStyle() const = 0; + virtual BOOL IsMultiSelectionEnabled() const = 0; + virtual USHORT GetTopEntry() const = 0; + virtual BOOL IsEntryPosSelected( USHORT nPos ) const = 0; + virtual USHORT GetEntryCount() const = 0; + virtual void Select() = 0; + virtual void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE ) = 0; + virtual USHORT GetSelectEntryCount() const = 0; + virtual void SetNoSelection() = 0; + virtual USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const = 0; + virtual BOOL IsInDropDown() const = 0; + virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const = 0; + virtual long GetIndexForPoint( const Point& rPoint, USHORT& nPos ) const = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > + GetClipboard() = 0; + }; +} +#endif // ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/acc_factory.hxx b/accessibility/inc/accessibility/helper/acc_factory.hxx new file mode 100644 index 000000000000..b0b0778a011b --- /dev/null +++ b/accessibility/inc/accessibility/helper/acc_factory.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_FACTORY_HXX +#define ACCESSIBILITY_HELPER_FACTORY_HXX + +#include <toolkit/helper/accessiblefactory.hxx> +#include <svtools/accessiblefactory.hxx> + +/** this is the entry point to retrieve a factory for the toolkit-level Accessible/Contexts supplied + by this library + + This function implements the factory function needed in toolkit + (of type GetStandardAccComponentFactory). +*/ +extern "C" void* SAL_CALL getStandardAccessibleFactory(); + +/** this is the entry point to retrieve a factory for the svtools-level Accessible/Contexts supplied + by this library + + This function implements the factory function needed in svtools + (of type GetSvtAccessibilityComponentFactory). +*/ +extern "C" void* SAL_CALL getSvtAccessibilityComponentFactory(); + +#endif // ACCESSIBILITY_HELPER_FACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/accessiblestrings.hrc b/accessibility/inc/accessibility/helper/accessiblestrings.hrc new file mode 100644 index 000000000000..8040f3588261 --- /dev/null +++ b/accessibility/inc/accessibility/helper/accessiblestrings.hrc @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ +#define ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ + + +//------------------------------------------------------------------------------ + +#define RID_TK_ACC_START 1000 + + +// Accessible Action Id's ------------------------------------------------------ + +#define RID_STR_ACC_ACTION_CLICK ( RID_TK_ACC_START + 0 ) +#define RID_STR_ACC_ACTION_TOGGLEPOPUP ( RID_TK_ACC_START + 1 ) +#define RID_STR_ACC_ACTION_SELECT ( RID_TK_ACC_START + 2 ) +#define RID_STR_ACC_ACTION_INCLINE ( RID_TK_ACC_START + 3 ) +#define RID_STR_ACC_ACTION_DECLINE ( RID_TK_ACC_START + 4 ) +#define RID_STR_ACC_ACTION_INCBLOCK ( RID_TK_ACC_START + 5 ) +#define RID_STR_ACC_ACTION_DECBLOCK ( RID_TK_ACC_START + 6 ) + + +#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 100 ) +#define RID_STR_ACC_DESC_PANELDECL_TABBAR ( RID_TK_ACC_START + 101 ) + +// ----------------------------------------------------------------------------- + +#endif // ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ diff --git a/accessibility/inc/accessibility/helper/accresmgr.hxx b/accessibility/inc/accessibility/helper/accresmgr.hxx new file mode 100644 index 000000000000..079ae6c83c7b --- /dev/null +++ b/accessibility/inc/accessibility/helper/accresmgr.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_TKARESMGR_HXX +#define ACCESSIBILITY_HELPER_TKARESMGR_HXX + +#include <rtl/ustring.hxx> + +class SimpleResMgr; + +#define TK_RES_STRING(id) TkResMgr::loadString(id) + +// ----------------------------------------------------------------------------- +// TkResMgr +// ----------------------------------------------------------------------------- + +class TkResMgr +{ + static SimpleResMgr* m_pImpl; + +private: + // no instantiation allowed + TkResMgr() { } + ~TkResMgr() { } + + // we'll instantiate one static member of the following class, + // which in it's dtor ensures that m_pImpl will be deleted + class EnsureDelete + { + public: + EnsureDelete() { } + ~EnsureDelete(); + }; + friend class EnsureDelete; + +protected: + static void ensureImplExists(); + +public: + // loads the string with the specified resource id + static ::rtl::OUString loadString( sal_uInt16 nResId ); +}; + + +#endif // ACCESSIBILITY_HELPER_TKARESMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/characterattributeshelper.hxx b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx new file mode 100644 index 000000000000..4e5cb90dc5cf --- /dev/null +++ b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX +#define ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <vcl/font.hxx> + +#include <map> + +// ----------------------------------------------------------------------------- +// class CharacterAttributesHelper +// ----------------------------------------------------------------------------- + +class CharacterAttributesHelper +{ +private: + + typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any, ::std::less< ::rtl::OUString > > AttributeMap; + + AttributeMap m_aAttributeMap; + +public: + + CharacterAttributesHelper( const Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor ); + ~CharacterAttributesHelper(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes(); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ); +}; + +#endif // ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/listboxhelper.hxx b/accessibility/inc/accessibility/helper/listboxhelper.hxx new file mode 100644 index 000000000000..ed7e65ab5225 --- /dev/null +++ b/accessibility/inc/accessibility/helper/listboxhelper.hxx @@ -0,0 +1,198 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * 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. + * + * 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). + * + * 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. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX +#define ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX + +#include <accessibility/helper/IComboListBoxHelper.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> + +// ----------------------------------------------------------------------------- +// globals +// ----------------------------------------------------------------------------- + +const sal_Int32 DEFAULT_INDEX_IN_PARENT = -1; + +// ----------------------------------------------------------------------------- +// class VCLListBoxHelper +// ----------------------------------------------------------------------------- + +template< class T > class VCLListBoxHelper : public ::accessibility::IComboListBoxHelper +{ +private: + T& m_aComboListBox; + +public: + inline + VCLListBoxHelper( T& _pListBox ) : + m_aComboListBox( _pListBox ){} + + // ----------------------------------------------------------------------------- + virtual String GetEntry( USHORT nPos ) const + { + return m_aComboListBox.GetEntry( nPos ); + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetDropDownPosSizePixel() const + { + Rectangle aTemp = m_aComboListBox.GetWindowExtentsRelative(NULL); + Rectangle aRet = m_aComboListBox.GetDropDownPosSizePixel(); + aRet.Move(aTemp.TopLeft().X(),aTemp.TopLeft().Y()); + return aRet; + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetBoundingRectangle( USHORT nItem ) const + { + Rectangle aRect; + if ( m_aComboListBox.IsInDropDown() && IsEntryVisible( nItem ) ) + { + Rectangle aTemp = m_aComboListBox.GetDropDownPosSizePixel(); + Size aSize = aTemp.GetSize(); + aSize.Height() /= m_aComboListBox.GetDisplayLineCount(); + Point aTopLeft = aTemp.TopLeft(); + aTopLeft.Y() += aSize.Height() * ( nItem - m_aComboListBox.GetTopEntry() ); + aRect = Rectangle( aTopLeft, aSize ); + } + else + aRect = m_aComboListBox.GetBoundingRectangle( nItem ); + return aRect; + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) + { + return m_aComboListBox.GetWindowExtentsRelative( pRelativeWindow ); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsActive() const + { + return m_aComboListBox.IsActive(); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsEntryVisible( USHORT nPos ) const + { + USHORT nTopEntry = m_aComboListBox.GetTopEntry(); + USHORT nLines = m_aComboListBox.GetDisplayLineCount(); + return ( nPos >= nTopEntry && nPos < ( nTopEntry + nLines ) ); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetDisplayLineCount() const + { + return m_aComboListBox.GetDisplayLineCount(); + } + // ----------------------------------------------------------------------------- + virtual void GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const + { + m_aComboListBox.GetMaxVisColumnsAndLines(rnCols,rnLines); + } + // ----------------------------------------------------------------------------- + virtual WinBits GetStyle() const + { + return m_aComboListBox.GetStyle(); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsMultiSelectionEnabled() const + { + return m_aComboListBox.IsMultiSelectionEnabled(); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetTopEntry() const + { + return m_aComboListBox.GetTopEntry(); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsEntryPosSelected( USHORT nPos ) const + { + return m_aComboListBox.IsEntryPosSelected(nPos); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetEntryCount() const + { + return m_aComboListBox.GetEntryCount(); + } + // ----------------------------------------------------------------------------- + virtual void Select() + { + m_aComboListBox.Select(); + } + // ----------------------------------------------------------------------------- + virtual void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE ) + { + m_aComboListBox.SelectEntryPos(nPos,bSelect); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetSelectEntryCount() const + { + return m_aComboListBox.GetSelectEntryCount(); + } + // ----------------------------------------------------------------------------- + virtual void SetNoSelection() + { + m_aComboListBox.SetNoSelection(); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const + { + return m_aComboListBox.GetSelectEntryPos(nSelIndex); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsInDropDown() const + { + return m_aComboListBox.IsInDropDown(); + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const + { + Rectangle aRect; + + Pair aEntryCharacterRange = m_aComboListBox.GetLineStartEnd( _nEntryPos ); + if ( aEntryCharacterRange.A() + _nCharacterIndex <= aEntryCharacterRange.B() ) + { + long nIndex = aEntryCharacterRange.A() + _nCharacterIndex; + aRect = m_aComboListBox.GetCharacterBounds( nIndex ); + } + return aRect; + } + // ----------------------------------------------------------------------------- + long GetIndexForPoint( const Point& rPoint, USHORT& nPos ) const + { + return m_aComboListBox.GetIndexForPoint( rPoint, nPos ); + } + // ----------------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > + GetClipboard() + { + return m_aComboListBox.GetClipboard(); + } + // ----------------------------------------------------------------------------- +}; + +#endif // ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |