diff options
author | Steve Yin <steve_y@apache.org> | 2013-11-25 16:15:58 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-11-25 16:52:36 +0000 |
commit | b755fb8c0f6b1282f62c12f378c0a5ecac64d490 (patch) | |
tree | 4e6df42c862fe4eafef3f52267797e811bac59e0 | |
parent | 74bf915fb48c660bd1e3a04bec6c3a20c754b6af (diff) |
Integrate branch of IAccessible2
Change-Id: I3b5936bb92bb258f9e9e76402dd2b55f29aa686a
33 files changed, 1918 insertions, 22 deletions
diff --git a/include/svtools/accessibleruler.hxx b/include/svtools/accessibleruler.hxx new file mode 100644 index 000000000000..0f989819a22c --- /dev/null +++ b/include/svtools/accessibleruler.hxx @@ -0,0 +1,247 @@ +/* + * 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 . + */ +#ifndef _SVTRULERACCESSIBLE_HXX +#define _SVTRULERACCESSIBLE_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp> + +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <cppuhelper/weak.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/compbase5.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <cppuhelper/implbase5.hxx> +#include <comphelper/servicehelper.hxx> + +namespace com { namespace sun { namespace star { namespace awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} } } } + +class Rectangle; +class Ruler; +class Window; + + +typedef ::cppu::WeakAggComponentImplHelper5< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::lang::XServiceInfo > + SvtRulerAccessible_Base; + +class SvtRulerAccessible : public ::comphelper::OBaseMutex, public SvtRulerAccessible_Base +{ +public: + //===== internal ======================================================== + SvtRulerAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, Ruler& rRepresentation, const ::rtl::OUString& rName ); +protected: + virtual ~SvtRulerAccessible(); +public: + //===== XAccessible ===================================================== + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException ); + + //===== XAccessibleComponent ============================================ + + virtual sal_Bool SAL_CALL + containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Rectangle SAL_CALL + getBounds() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Point SAL_CALL + getLocation() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Point SAL_CALL + getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::awt::Size SAL_CALL + getSize() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isShowing() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isVisible() throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + addFocusListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeFocusListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + grabFocus() throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Any SAL_CALL + getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL + getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL + getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + //===== XAccessibleContext ============================================== + + virtual sal_Int32 SAL_CALL + getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleChild( sal_Int32 nIndex ) + throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL + getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int16 SAL_CALL + getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::rtl::OUString SAL_CALL + getAccessibleDescription( void ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL + getAccessibleName( void ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::lang::Locale SAL_CALL + getLocale( void ) + throw( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::accessibility::IllegalAccessibleComponentStateException ); + //===== XAccessibleEventBroadcaster ===================================== + + virtual void SAL_CALL + addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )throw( com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException ); + + //===== XServiceInfo ==================================================== + + virtual ::rtl::OUString SAL_CALL + getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL + supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL + getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException ); + + //===== XTypeProvider =================================================== + + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL + getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException ); + + + + +public: + + /// Sets the name + void setName( const ::rtl::OUString& rName ); + + /// Sets the description + void setDescription( const ::rtl::OUString& rDescr ); +private: + static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void ); +protected: + + /// @Return the object's current bounding box relative to the desktop. + virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException ); + + /// @Return the object's current bounding box relative to the parent object. + virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException ); + + + virtual void SAL_CALL disposing(); + + /// @returns true if it's disposed or in disposing + inline sal_Bool IsAlive( void ) const; + + /// @returns true if it's not disposed and no in disposing + inline sal_Bool IsNotAlive( void ) const; + + /// throws the exception DisposedException if it's not alive + void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException ); + +private: + /** Description of this object. This is not a constant because it can + be set from the outside. + */ + ::rtl::OUString msDescription; + + /** Name of this object. + */ + ::rtl::OUString msName; + + /// Reference to the parent object. + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxParent; + + /// pointer to internal representation + Ruler* mpRepr; + + /// client id in the AccessibleEventNotifier queue + sal_uInt32 mnClientId; + + +}; + +inline sal_Bool SvtRulerAccessible::IsAlive( void ) const +{ + return !rBHelper.bDisposed && !rBHelper.bInDispose; +} + +inline sal_Bool SvtRulerAccessible::IsNotAlive( void ) const +{ + return rBHelper.bDisposed || rBHelper.bInDispose; +} + +#endif diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx index a2ad1aa830c0..49763a20c344 100644 --- a/include/svtools/embedhlp.hxx +++ b/include/svtools/embedhlp.hxx @@ -108,6 +108,8 @@ public: bool IsLocked() const; bool IsChart() const; + OUString GetChartType(); + // #i104867# // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally, // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx index 6d85b0e1c1da..76789d08ca82 100644 --- a/include/svtools/headbar.hxx +++ b/include/svtools/headbar.hxx @@ -231,6 +231,8 @@ typedef sal_uInt16 HeaderBarItemBits; // - HeaderBar - // ------------- +class VCLXHeaderBar; + class SVT_DLLPUBLIC HeaderBar : public Window { private: @@ -259,6 +261,9 @@ private: Link maDoubleClickHdl; Link maCreateAccessibleHdl; + VCLXHeaderBar* m_pVCLXHeaderBar; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible; @@ -368,6 +373,8 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); void SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( sal_Bool bCreate ); + }; #endif // INCLUDED_SVTOOLS_HEADBAR_HXX diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index a6ae1e5a19fc..5d53a964adfc 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -28,6 +28,8 @@ #include <boost/scoped_ptr.hpp> +#include <svtools/accessibleruler.hxx> + class MouseEvent; class TrackingEvent; class DataChangedEvent; @@ -658,6 +660,8 @@ private: boost::scoped_ptr<RulerSelection> mpCurrentHitTest; boost::scoped_ptr<RulerSelection> mpPreviousHitTest; + SvtRulerAccessible* pAccContext; + SVT_DLLPRIVATE void ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 ); SVT_DLLPRIVATE void ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 ); SVT_DLLPRIVATE void ImplVDrawText( long nX, long nY, const OUString& rText, long nMin = LONG_MIN, long nMax = LONG_MAX ); @@ -813,6 +817,8 @@ public: void SetLineHeight( long nHeight ) { mnLineHeight = nHeight ; } void DrawTicks(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); }; #endif // _RULER_HXX diff --git a/include/svtools/svlbitm.hxx b/include/svtools/svlbitm.hxx index cdc461375e24..c74b1ec0a945 100644 --- a/include/svtools/svlbitm.hxx +++ b/include/svtools/svlbitm.hxx @@ -101,6 +101,7 @@ public: virtual sal_uInt16 GetType() const; virtual void InitViewData(SvTreeListBox*, SvTreeListEntry*, SvViewDataItem*); OUString GetText() const { return maText; } + virtual OUString GetExtendText() const { return OUString(); } void SetText( const OUString& rText ) { maText = rText; } virtual void Paint( @@ -176,6 +177,7 @@ public: // Check whether this button can be modified via UI bool CheckModification() const; + SvLBoxButtonData* GetButtonData() const{ return pData;} }; inline void SvLBoxButton::SetStateChecked() diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index cceb888ef4f0..301d2f7b955f 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -180,8 +180,9 @@ #define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4) #define STR_SVT_ACC_DESC_FILE (STR_SVT_ACC_BEGIN+5) #define STR_SVT_ACC_EMPTY_FIELD (STR_SVT_ACC_BEGIN+6) -//IAccessible2 implementation -#define STR_SVT_ACC_RULER_HORZ_NAME (STR_SVT_ACC_BEGIN+9) +#define STR_SVT_ACC_LISTENTRY_SELCTED_STATE (STR_SVT_ACC_BEGIN+7) +#define STR_SVT_ACC_RULER_VERT_NAME (STR_SVT_ACC_BEGIN+8) +#define STR_SVT_ACC_RULER_HORZ_NAME (STR_SVT_ACC_BEGIN+9) #define STR_SVT_ACC_END (STR_SVT_ACC_RULER_HORZ_NAME) #define STR_SVT_INDEXENTRY_START (STR_SVT_ACC_END + 1) @@ -313,7 +314,6 @@ #define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30) -// IAccessible2 implementation in 2009 #define STR_PARAGRAPH_START (STR_SVT_PRNDLG_START + 50) #define STR_PARAGRAPH (STR_PARAGRAPH_START + 0) diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index 980f88ce9a53..0d9b768a73f8 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -97,6 +97,10 @@ enum SvButtonState { SV_BUTTON_UNCHECKED, SV_BUTTON_CHECKED, SV_BUTTON_TRISTATE #define TREEFLAG_MANINS 0x0004 #define TREEFLAG_RECALCTABS 0x0008 +#define TREEBOX_ALLITEM_ACCROLE_TYPE_NOTSET 0x00 +#define TREEBOX_ALLITEM_ACCROLE_TYPE_LIST 0x01 +#define TREEBOX_ALLITEM_ACCROLE_TYPE_TREE 0x02 + typedef sal_Int64 ExtendedWinBits; // disable the behavior of automatically selecting a "CurEntry" upon painting the control @@ -106,6 +110,7 @@ typedef sal_Int64 ExtendedWinBits; #define SV_ITEM_ID_LBOXBMP 2 #define SV_ITEM_ID_LBOXBUTTON 3 #define SV_ITEM_ID_LBOXCONTEXTBMP 4 +#define SV_ITEM_ID_EXTENDRLBOXSTRING 5 class SvLBoxTab { @@ -226,6 +231,7 @@ class SVT_DLLPUBLIC SvTreeListBox short nEntryHeightOffs; short nIndent; short nFocusWidth; + short nAllItemAccRoleType; sal_uInt16 nFirstSelTab; sal_uInt16 nLastSelTab; long mnCheckboxItemWidth; @@ -502,6 +508,17 @@ public: /** Enables, that one cell of a tablistbox entry can be focused */ void EnableCellFocus(); + // For overwriting accessible role for all entries - normally 0, so each entry can be different + void SetAllEntriesAccessibleRoleType( short n ) { nAllItemAccRoleType = n; } + short GetAllEntriesAccessibleRoleType() const { return nAllItemAccRoleType; } + + sal_uInt16 GetTreeFlags() const {return nTreeFlags;} + + OUString headString; + OUString SearchEntryTextWithHeadTitle(SvTreeListEntry* pEntry); + virtual OUString GetEntryAltText(SvTreeListEntry* pEntry) const; + virtual OUString GetEntryLongDescription(SvTreeListEntry* pEntry) const; + void set_min_width_in_chars(sal_Int32 nChars); virtual bool set_property(const OString &rKey, const OString &rValue); diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx index f839b2621c33..812fd058b7da 100644 --- a/include/svtools/treelistentry.hxx +++ b/include/svtools/treelistentry.hxx @@ -53,6 +53,7 @@ class SVT_DLLPUBLIC SvTreeListEntry sal_uLong nAbsPos; sal_uLong nListPos; ItemsType maItems; + sal_Bool bIsMarked; void* pUserData; sal_uInt16 nEntryFlags; @@ -97,6 +98,9 @@ public: sal_uInt16 GetFlags() const; void SetFlags( sal_uInt16 nFlags ); + + sal_Bool GetIsMarked() const { return bIsMarked; } + void SetMarked( sal_Bool IsMarked ) { bIsMarked = IsMarked; } }; #endif diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index de237cab5f85..368e092c50df 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -321,6 +321,8 @@ public: size_t nPos = VALUESET_APPEND ); void InsertItem( sal_uInt16 nItemId, size_t nPos = VALUESET_APPEND ); + void InsertItem( sal_uInt16 nItemId, const OUString& rStr, + size_t nPos = VALUESET_APPEND ); void RemoveItem( sal_uInt16 nItemId ); void Clear(); @@ -364,7 +366,7 @@ public: bool IsColor() const { return maColor.GetTransparency() == 0; } void SetExtraSpacing( sal_uInt16 nNewSpacing ); - sal_uInt16 GetExtraSpacing() { return mnSpacing; } + sal_uInt16 GetExtraSpacing() { return mnSpacing; } void Format(); diff --git a/include/svtools/vclxaccessibleheaderbar.hxx b/include/svtools/vclxaccessibleheaderbar.hxx new file mode 100644 index 000000000000..770f1512546e --- /dev/null +++ b/include/svtools/vclxaccessibleheaderbar.hxx @@ -0,0 +1,82 @@ +/* + * 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 . + */ +#ifndef _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_ +#define _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_ + +#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_ +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#endif +#ifndef _HEADBAR_HXX +#include <svtools/headbar.hxx> +#endif +#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_ +#include "toolkit/awt/vclxwindow.hxx" +#endif +class HeaderBar; + +// ---------------------------------------------------- +// class VCLXAccessibleHeaderBar +// ---------------------------------------------------- + +typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > > + ListItems; + +class VCLXAccessibleHeaderBar : public VCLXAccessibleComponent +{ + +public: + HeaderBar* m_pHeadBar; + virtual ~VCLXAccessibleHeaderBar(); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + VCLXAccessibleHeaderBar( VCLXWindow* pVCLXindow ); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + +public: + virtual void SAL_CALL disposing (void); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateChild(sal_Int32 i); + +private: + ListItems m_aAccessibleChildren; + + +}; + +class VCLXHeaderBar : public VCLXWindow +{ +public: + VCLXHeaderBar(Window* pHeaderBar); + virtual ~VCLXHeaderBar(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); + +}; + +#endif // _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_ + diff --git a/include/svtools/vclxaccessibleheaderbaritem.hxx b/include/svtools/vclxaccessibleheaderbaritem.hxx new file mode 100644 index 000000000000..e5c695074b2c --- /dev/null +++ b/include/svtools/vclxaccessibleheaderbaritem.hxx @@ -0,0 +1,115 @@ +/* -*- 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 . + */ +#ifndef _SVTOOLS_VCLACCESSIBLEHEADBARITEM_HXX_ +#define _SVTOOLS_VCLACCESSIBLEHEADBARITEM_HXX_ + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/accessiblecomponenthelper.hxx> +#include <cppuhelper/implbase2.hxx> + +#include <tools/link.hxx> + +#include <vector> + +class HeaderBar; +class VCLExternalSolarLock; +class VclSimpleEvent; +class VclWindowEvent; + +namespace utl { +class AccessibleStateSetHelper; +} + + +// ---------------------------------------------------- +// class VCLXAccessibleHeaderBarItem +// ---------------------------------------------------- + +typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; + +typedef ::cppu::ImplHelper2< +::com::sun::star::accessibility::XAccessible, +::com::sun::star::lang::XServiceInfo > VCLXAccessibleHeaderBarItem_BASE; + +class VCLXAccessibleHeaderBarItem : public AccessibleExtendedComponentHelper_BASE, + public VCLXAccessibleHeaderBarItem_BASE +{ +private: + VCLExternalSolarLock* m_pExternalLock; + HeaderBar* m_pHeadBar; + sal_Int32 m_nIndexInParent; + +protected: + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleHeaderBarItem( HeaderBar* pHeadBar, sal_Int32 _nIndexInParent ); + ~VCLXAccessibleHeaderBarItem(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException){}; + virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // _SVTOOLS_VCLACCESSIBLEHEADBARITEM_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/viewdataentry.hxx b/include/svtools/viewdataentry.hxx index 31681af4dc19..5ddf18bee3e7 100644 --- a/include/svtools/viewdataentry.hxx +++ b/include/svtools/viewdataentry.hxx @@ -47,6 +47,7 @@ class SVT_DLLPUBLIC SvViewDataEntry std::vector<SvViewDataItem> maItems; sal_uLong nVisPos; bool mbSelected:1; + bool mbObjectSelected:1; bool mbHighlighted:1; bool mbExpanded:1; bool mbFocused:1; @@ -69,6 +70,7 @@ public: void SetHighlighted( bool bHighlighted ); void SetExpanded( bool bExpanded ); void SetSelectable( bool bSelectable ); + void SetObjectSelected( bool bSelected ); void Init(size_t nSize); diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx index 767820e62fd8..163d62c4a886 100644 --- a/include/vcl/texteng.hxx +++ b/include/vcl/texteng.hxx @@ -316,6 +316,8 @@ public: static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent ); static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent ); + + Color GetTextColor() const { return maTextColor; } }; #endif // INCLUDED_VCL_TEXTENG_HXX diff --git a/svtools/AllLangResTarget_svt.mk b/svtools/AllLangResTarget_svt.mk index 3e3b7fb7d747..c9fd27cfc77e 100644 --- a/svtools/AllLangResTarget_svt.mk +++ b/svtools/AllLangResTarget_svt.mk @@ -41,6 +41,7 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\ svtools/source/control/ctrlbox.src \ svtools/source/control/ctrltool.src \ svtools/source/control/filectrl.src \ + svtools/source/control/ruler.src \ svtools/source/dialogs/addresstemplate.src \ svtools/source/dialogs/filedlg2.src \ svtools/source/dialogs/formats.src \ diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 11706c60969f..eb1ba8cad406 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -104,6 +104,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/contnr/treelistbox \ svtools/source/contnr/treelistentry \ svtools/source/contnr/viewdataentry \ + svtools/source/control/accessibleruler \ svtools/source/control/asynclink \ svtools/source/control/calendar \ svtools/source/control/collatorres \ @@ -129,6 +130,8 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/control/urlcontrol \ svtools/source/control/valueacc \ svtools/source/control/valueset \ + svtools/source/control/vclxaccessibleheaderbar \ + svtools/source/control/vclxaccessibleheaderbaritem \ svtools/source/dialogs/addresstemplate \ svtools/source/dialogs/colrdlg \ svtools/source/dialogs/insdlg \ diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 064a4b818908..54ec2a248429 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -208,7 +208,7 @@ sal_Bool BrowseBox::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point // Object data and state ------------------------------------------------------ -OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const +OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const { OUString aRetText; switch( eObjType ) @@ -226,7 +226,16 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e aRetText = "ColumnHeaderBar"; break; case ::svt::BBTYPE_TABLECELL: - aRetText = "TableCell"; + if( ColCount() !=0 && GetRowCount()!=0) + { + + sal_Int32 columnId = _nPosition % ColCount() +1; + aRetText = OUString( GetColumnDescription( sal_Int16( columnId ) ) ); + sal_Int32 rowId = _nPosition / GetRowCount() + 1; + aRetText += OUString::number(rowId); + } + else + aRetText = "TableCell"; #if OSL_DEBUG_LEVEL > 1 aRetText += " ["; aRetText += OUString::number(sal_Int32(GetCurRow())); @@ -236,7 +245,10 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e #endif break; case ::svt::BBTYPE_ROWHEADERCELL: - aRetText = "RowHeaderCell"; + { + sal_Int32 rowId = _nPosition + 1; + aRetText = OUString::number( rowId ); + } #if OSL_DEBUG_LEVEL > 1 aRetText += " ["; aRetText += OUString::number(sal_Int32(GetCurRow())); @@ -246,7 +258,7 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e #endif break; case ::svt::BBTYPE_COLUMNHEADERCELL: - aRetText = "ColumnHeaderCell"; + aRetText = OUString( GetColumnDescription( sal_Int16( _nPosition ) ) ); #if OSL_DEBUG_LEVEL > 1 aRetText += " ["; aRetText += OUString::number(sal_Int32(GetCurRow())); diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 51898127f79f..d4dada733050 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -1046,7 +1046,7 @@ namespace svt { commitTableEvent( ACTIVE_DESCENDANT_CHANGED, - makeAny( CreateAccessibleCell( nRow, GetColumnPos( nCol ) ) ), + makeAny( CreateAccessibleCell( nRow, GetColumnPos( nCol -1) ) ), Any() ); } diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 74d7fe5e0e02..1e96c5561523 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -1029,6 +1029,7 @@ void SvxIconChoiceCtrl_Impl::SetCursor_Impl( SvxIconChoiceCtrlEntry* pOldCursor, { SelectEntry( pCursor, sal_True, sal_True, sal_False, bPaintSync ); aCurSelectionRect = GetEntryBoundRect( pCursor ); + CallEventListeners( VCLEVENT_LISTBOX_SELECT, pCursor ); } } } diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 0099dd22a9c0..361868141ff4 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -287,6 +287,8 @@ void SvImpLBox::Clear() aScrBarBox.Hide(); aContextBmpWidthVector.clear(); + + CallEventListeners( VCLEVENT_LISTBOX_ITEMREMOVED, NULL ); } // ********************************************************************* @@ -645,6 +647,7 @@ void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect ) if(!bForceNoSelect && bSimpleTravel && !(nFlags & F_DESEL_ALL) && GetUpdateMode()) { pView->Select( pCursor, true ); + CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor ); } // multiple selection: select in cursor move if we're not in // Add mode (Ctrl-F8) @@ -654,10 +657,15 @@ void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect ) !bForceNoSelect ) { pView->Select( pCursor, true ); + CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor ); } else { ShowCursor( true ); + if (bForceNoSelect && GetUpdateMode()) + { + CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor); + } } if( pAnchor ) @@ -1642,6 +1650,8 @@ void SvImpLBox::EntrySelected( SvTreeListEntry* pEntry, bool bSelect ) void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry ) { + CallEventListeners( VCLEVENT_LISTBOX_ITEMREMOVED , pEntry ); + DestroyAnchor(); if( !pView->IsEntryVisible( pEntry ) ) @@ -2256,7 +2266,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) case KEY_LEFT: { - if ( bIsCellFocusEnabled ) + if ( bIsCellFocusEnabled && pCursor ) { if ( nCurTabPos > FIRST_ENTRY_TAB ) { @@ -2560,7 +2570,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) // is from SvTreeListBox::KeyInput. If we set bKeyUsed to true here, then the key input // is just silenced. However, we want SvLBox::KeyInput to get a chance, to do the QuickSelection // handling. - // (The old code here which intentionally set bKeyUsed to TRUE said this was because of "quick search" + // (The old code here which intentionally set bKeyUsed to sal_True said this was because of "quick search" // handling, but actually there was no quick search handling anymore. We just re-implemented it.) // #i31275# / 2009-06-16 / frank.schoenheit@sun.com bKeyUsed = false; diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 7a091e699ece..de1cd94145ae 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -1123,6 +1123,8 @@ void SvHeaderTabListBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper sal_uInt16 nCurColumn = GetCurrColumn(); if ( IsCellVisible( nCurRow, nCurColumn ) ) _rStateSet.AddState( AccessibleStateType::VISIBLE ); + if ( IsEnabled() ) + _rStateSet.AddState( AccessibleStateType::ENABLED ); _rStateSet.AddState( AccessibleStateType::TRANSIENT ); break; } @@ -1133,6 +1135,8 @@ void SvHeaderTabListBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper _rStateSet.AddState( AccessibleStateType::VISIBLE ); _rStateSet.AddState( AccessibleStateType::FOCUSABLE ); _rStateSet.AddState( AccessibleStateType::TRANSIENT ); + if ( IsEnabled() ) + _rStateSet.AddState( AccessibleStateType::ENABLED ); break; } default: @@ -1157,6 +1161,8 @@ void SvHeaderTabListBox::FillAccessibleStateSetForCell( ::utl::AccessibleStateSe _rStateSet.AddState( AccessibleStateType::ACTIVE ); _rStateSet.AddState( AccessibleStateType::SELECTED ); } + if ( IsEnabled() ) + _rStateSet.AddState( AccessibleStateType::ENABLED ); } // ----------------------------------------------------------------------- void SvHeaderTabListBox::GrabTableFocus() diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index ec2960850fe6..661e109325b4 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1504,6 +1504,7 @@ void SvTreeListBox::InitTreeView() nFirstSelTab = 0; nLastSelTab = 0; nFocusWidth = -1; + nAllItemAccRoleType = 0; mnCheckboxItemWidth = 0; Link* pLink = new Link( LINK(this,SvTreeListBox, DefaultCompare) ); @@ -1527,6 +1528,79 @@ void SvTreeListBox::InitTreeView() SetTabs(); } +OUString SvTreeListBox::GetEntryAltText( SvTreeListEntry* ) const +{ + return OUString(); +} + +OUString SvTreeListBox::GetEntryLongDescription( SvTreeListEntry* ) const +{ + return OUString(); +} + +OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) +{ + DBG_CHKTHIS(SvTreeListBox,0); + DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryText(): no entry" ); + OUString sRet; + + sal_uInt16 nCount = pEntry->ItemCount(); + sal_uInt16 nCur = 0; + sal_uInt16 nHeaderCur = 0; + SvLBoxItem* pItem; + while( nCur < nCount ) + { + // MT: SV_ITEM_ID_EXTENDRLBOXSTRING / GetExtendText() was in use in IA2 cws, but only used in sc: ScSolverOptionsString. Needed? + pItem = pEntry->GetItem( nCur ); + if ( (pItem->GetType() == SV_ITEM_ID_LBOXSTRING ) && + !static_cast<SvLBoxString*>( pItem )->GetText().isEmpty() ) + { + //want the column header + if (!headString.isEmpty()) + { + sal_Int32 nEnd = headString.indexOf('\t'); + if( nEnd == -1 ) + { + if (!sRet.isEmpty()) + { + sRet += ","; + } + if (!headString.isEmpty()) + { + sRet += headString ; + sRet += ":" ; + } + } + else + { + OUString aString=headString.getToken(nHeaderCur, '\t'); + if (!sRet.isEmpty()) + { + sRet += ","; + } + if (!aString.isEmpty()) + { + sRet += aString ; + sRet += ":" ; + } + nHeaderCur++; + } + sRet += static_cast<SvLBoxString*>( pItem )->GetText(); + } + else + { + sRet += static_cast<SvLBoxString*>( pItem )->GetText(); + sRet += ","; + } + //end want to the column header + } + nCur++; + } + + if (!sRet.isEmpty()) + sRet = sRet.copy(0, sRet.getLength() - 1); + return sRet; +} SvTreeListBox::~SvTreeListBox() { @@ -2232,18 +2306,37 @@ void SvTreeListBox::RequestingChildren( SvTreeListEntry* pParent ) void SvTreeListBox::GetFocus() { DBG_CHKTHIS(SvTreeListBox,0); + //If there is no item in the tree, draw focus. + if( !First()) + { + Invalidate(); + } pImp->GetFocus(); Control::GetFocus(); SvTreeListEntry* pEntry = FirstSelected(); + if ( !pEntry ) + { + pEntry = pImp->GetCurrentEntry(); + } + if (pImp->pCursor) + { + if (pEntry != pImp->pCursor) + pEntry = pImp->pCursor; + } if ( pEntry ) - pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry ); + pImp->CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pEntry ); } void SvTreeListBox::LoseFocus() { DBG_CHKTHIS(SvTreeListBox,0); + //If there is no item in the tree, delete visual focus. + if( !First()) + { + Invalidate(); + } pImp->LoseFocus(); Control::LoseFocus(); } @@ -2491,7 +2584,7 @@ sal_Bool SvTreeListBox::Select( SvTreeListEntry* pEntry, sal_Bool bSelect ) if( bSelect ) { SelectHdl(); - pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry ); + CallEventListeners( VCLEVENT_LISTBOX_TREESELECT, pEntry); } else DeselectHdl(); @@ -2628,6 +2721,22 @@ void SvTreeListBox::Paint( const Rectangle& rRect ) if( nTreeFlags & TREEFLAG_RECALCTABS ) SetTabs(); pImp->Paint( rRect ); + //Add visual focus draw + if( !First() ) + { + if( HasFocus() ) + { + long tempHeight = GetTextHeight(); + Rectangle tempRect( + Point(0,0),Size(GetSizePixel().Width(),tempHeight) + ); + ShowFocus(tempRect); + } + + else{ + HideFocus(); + } + } } void SvTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) @@ -3964,6 +4073,19 @@ void SvTreeListBox::FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl: rStateSet.AddState( AccessibleStateType::VISIBLE ); if ( IsSelected( pEntry ) ) rStateSet.AddState( AccessibleStateType::SELECTED ); + if ( IsEnabled() ) + { + rStateSet.AddState( AccessibleStateType::ENABLED ); + rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + rStateSet.AddState( AccessibleStateType::SELECTABLE ); + SvViewDataEntry* pViewDataNewCur = 0; + if( pEntry ) + { + pViewDataNewCur= GetViewDataEntry(pEntry); + if(pViewDataNewCur->HasFocus()) + rStateSet.AddState( AccessibleStateType::FOCUSED ); + } + } } Rectangle SvTreeListBox::GetBoundingRect( SvTreeListEntry* pEntry ) diff --git a/svtools/source/contnr/viewdataentry.cxx b/svtools/source/contnr/viewdataentry.cxx index 06ba46349cf2..8719586e869e 100644 --- a/svtools/source/contnr/viewdataentry.cxx +++ b/svtools/source/contnr/viewdataentry.cxx @@ -26,6 +26,7 @@ DBG_NAME(SvViewDataEntry); SvViewDataEntry::SvViewDataEntry() : nVisPos(0), mbSelected(false), + mbObjectSelected(false), mbHighlighted(false), mbExpanded(false), mbFocused(false), @@ -38,6 +39,7 @@ SvViewDataEntry::SvViewDataEntry() : SvViewDataEntry::SvViewDataEntry( const SvViewDataEntry& rData ) : nVisPos(rData.nVisPos), mbSelected(false), + mbObjectSelected(false), mbHighlighted(false), mbExpanded(rData.mbExpanded), mbFocused(false), @@ -96,6 +98,11 @@ void SvViewDataEntry::SetSelected( bool bSelected ) mbHighlighted = bSelected; } +void SvViewDataEntry::SetObjectSelected( bool bSelected ) +{ + mbObjectSelected = bSelected; +} + void SvViewDataEntry::SetHighlighted( bool bHighlighted ) { mbHighlighted = bHighlighted; diff --git a/svtools/source/control/accessibleruler.cxx b/svtools/source/control/accessibleruler.cxx new file mode 100644 index 000000000000..19e41f7f13d9 --- /dev/null +++ b/svtools/source/control/accessibleruler.cxx @@ -0,0 +1,482 @@ +/* + * 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 <svtools/accessibleruler.hxx> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <unotools/accessiblestatesethelper.hxx> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <comphelper/accessibleeventnotifier.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <vcl/svapp.hxx> +#include <osl/mutex.hxx> +#include <rtl/uuid.h> +#include <tools/debug.hxx> +#include <tools/gen.hxx> + +#include "svtools/ruler.hxx" + +using namespace ::cppu; +using namespace ::osl; +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::accessibility; + +DBG_NAME( SvtRulerAccessible ) + + +//===== internal ============================================================ + +SvtRulerAccessible::SvtRulerAccessible( + const uno::Reference< XAccessible >& rxParent, Ruler& rRepr, const OUString& rName ) : + + SvtRulerAccessible_Base( m_aMutex ), + msName( rName ), + mxParent( rxParent ), + mpRepr( &rRepr ), + mnClientId( 0 ) +{ + DBG_CTOR( SvtRulerAccessible, NULL ); +} + +SvtRulerAccessible::~SvtRulerAccessible() +{ + DBG_DTOR( SvtRulerAccessible, NULL ); + + if( IsAlive() ) + { + osl_incrementInterlockedCount( &m_refCount ); + dispose(); // set mpRepr = NULL & release all childs + } +} + +//===== XAccessible ========================================================= + +uno::Reference< XAccessibleContext > SAL_CALL SvtRulerAccessible::getAccessibleContext( void ) throw( RuntimeException ) +{ + return this; +} + +//===== XAccessibleComponent ================================================ + +sal_Bool SAL_CALL SvtRulerAccessible::containsPoint( const awt::Point& rPoint ) throw( RuntimeException ) +{ + // no guard -> done in getBounds() +// return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); + return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); +} + +uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleAtPoint( const awt::Point& ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + + uno::Reference< XAccessible > xRet; + + + return xRet; +} + +awt::Rectangle SAL_CALL SvtRulerAccessible::getBounds() throw( RuntimeException ) +{ + // no guard -> done in GetBoundingBox() + return AWTRectangle( GetBoundingBox() ); +} + +awt::Point SAL_CALL SvtRulerAccessible::getLocation() throw( RuntimeException ) +{ + // no guard -> done in GetBoundingBox() + return AWTPoint( GetBoundingBox().TopLeft() ); +} + +awt::Point SAL_CALL SvtRulerAccessible::getLocationOnScreen() throw( RuntimeException ) +{ + // no guard -> done in GetBoundingBoxOnScreen() + return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); +} + +awt::Size SAL_CALL SvtRulerAccessible::getSize() throw( RuntimeException ) +{ + // no guard -> done in GetBoundingBox() + return AWTSize( GetBoundingBox().GetSize() ); +} + +sal_Bool SAL_CALL SvtRulerAccessible::isShowing() throw( RuntimeException ) +{ + return sal_True; +} + +sal_Bool SAL_CALL SvtRulerAccessible::isVisible() throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + + return mpRepr->IsVisible(); +} + +sal_Bool SAL_CALL SvtRulerAccessible::isFocusTraversable() throw( RuntimeException ) +{ + return sal_True; +} + +//===== XAccessibleContext ================================================== + +sal_Int32 SAL_CALL SvtRulerAccessible::getAccessibleChildCount( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + + return 0; +} + +uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleChild( sal_Int32 ) + throw( RuntimeException, lang::IndexOutOfBoundsException ) +{ + uno::Reference< XAccessible > xChild ; + + return xChild; +} + +uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleParent( void ) throw( RuntimeException ) +{ + return mxParent; +} + +sal_Int32 SAL_CALL SvtRulerAccessible::getAccessibleIndexInParent( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + // Use a simple but slow solution for now. Optimize later. + + // Iterate over all the parent's children and search for this object. + if( mxParent.is() ) + { + uno::Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); + if( xParentContext.is() ) + { + sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); + for( sal_Int32 i = 0 ; i < nChildCount ; ++i ) + { + uno::Reference< XAccessible > xChild( xParentContext->getAccessibleChild( i ) ); + if( xChild.get() == ( XAccessible* ) this ) + return i; + } + } + } + + // Return -1 to indicate that this object's parent does not know about the + // object. + return -1; +} + +sal_Int16 SAL_CALL SvtRulerAccessible::getAccessibleRole( void ) throw( RuntimeException ) +{ + return AccessibleRole::RULER; +} + +OUString SAL_CALL SvtRulerAccessible::getAccessibleDescription( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return msDescription; +} + +OUString SAL_CALL SvtRulerAccessible::getAccessibleName( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return msName; +} + +/** Return empty uno::Reference to indicate that the relation set is not + supported. +*/ +uno::Reference< XAccessibleRelationSet > SAL_CALL SvtRulerAccessible::getAccessibleRelationSet( void ) throw( RuntimeException ) +{ + return uno::Reference< XAccessibleRelationSet >(); +} + + +uno::Reference< XAccessibleStateSet > SAL_CALL SvtRulerAccessible::getAccessibleStateSet( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; + + if( IsAlive() ) + { + pStateSetHelper->AddState( AccessibleStateType::ENABLED ); + + if( isShowing() ) + pStateSetHelper->AddState( AccessibleStateType::SHOWING ); + + if( isVisible() ) + pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); + + + if ( mpRepr ) + { + if ( mpRepr->GetStyle() & WB_HORZ ) + pStateSetHelper->AddState( AccessibleStateType::HORIZONTAL ); + else + pStateSetHelper->AddState( AccessibleStateType::VERTICAL ); + } + if(pStateSetHelper->contains(AccessibleStateType::FOCUSABLE)) + { + pStateSetHelper->RemoveState( AccessibleStateType::FOCUSABLE ); + } + + } + + + return pStateSetHelper; +} + +lang::Locale SAL_CALL SvtRulerAccessible::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if( mxParent.is() ) + { + uno::Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); + if( xParentContext.is() ) + return xParentContext->getLocale(); + } + + // No parent. Therefore throw exception to indicate this cluelessness. + throw IllegalAccessibleComponentStateException(); +} + +void SAL_CALL SvtRulerAccessible::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) + throw( RuntimeException ) +{ + if (xListener.is()) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (!mnClientId) + mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); + comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); + } +} + +void SAL_CALL SvtRulerAccessible::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) + throw( RuntimeException ) +{ + if (xListener.is()) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); + if ( !nListenerCount ) + { + // no listeners anymore + // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), + // and at least to us not firing any events anymore, in case somebody calls + // NotifyAccessibleEvent, again + comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); + mnClientId = 0; + } + } +} + +void SAL_CALL SvtRulerAccessible::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw( RuntimeException ) +{ + if( xListener.is() ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + + uno::Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( mpRepr ); + if( xWindow.is() ) + xWindow->addFocusListener( xListener ); + } +} + +void SAL_CALL SvtRulerAccessible::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw (RuntimeException) +{ + if( xListener.is() ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + + uno::Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( mpRepr ); + if( xWindow.is() ) + xWindow->removeFocusListener( xListener ); + } +} + +void SAL_CALL SvtRulerAccessible::grabFocus() throw( RuntimeException ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + + mpRepr->GrabFocus(); +} + +Any SAL_CALL SvtRulerAccessible::getAccessibleKeyBinding() throw( RuntimeException ) +{ + // here is no implementation, because here are no KeyBindings for every object + return Any(); +} + +sal_Int32 SvtRulerAccessible::getForeground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + ThrowExceptionIfNotAlive(); + + return mpRepr->GetControlForeground().GetColor(); +} +sal_Int32 SvtRulerAccessible::getBackground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + ThrowExceptionIfNotAlive(); + + return mpRepr->GetControlBackground().GetColor(); +} + +//===== XServiceInfo ======================================================== + +OUString SAL_CALL SvtRulerAccessible::getImplementationName( void ) throw( RuntimeException ) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvtRulerAccessible" ) ); +} + +sal_Bool SAL_CALL SvtRulerAccessible::supportsService( const OUString& sServiceName ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + // Iterate over all supported service names and return true if on of them + // matches the given name. + Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); + int nLength = aSupportedServices.getLength(); + const OUString* pStr = aSupportedServices.getConstArray(); + + for( int i = nLength ; i ; --i, ++pStr ) + { + if( sServiceName == *pStr ) + return sal_True; + } + + return sal_False; +} + +Sequence< OUString > SAL_CALL SvtRulerAccessible::getSupportedServiceNames( void ) throw( RuntimeException ) +{ + const OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) ); + return Sequence< OUString >( &sServiceName, 1 ); +} + +//===== XTypeProvider ======================================================= + +Sequence< sal_Int8 > SAL_CALL SvtRulerAccessible::getImplementationId( void ) throw( RuntimeException ) +{ + return getUniqueId(); +} + + +//===== internals ======================================================== + +void SvtRulerAccessible::setName( const OUString& rName ) +{ + msName = rName; + +} + +void SvtRulerAccessible::setDescription( const OUString& rDescr ) +{ + + msDescription = rDescr; + +} + + + +void SAL_CALL SvtRulerAccessible::disposing() +{ + if( !rBHelper.bDisposed ) + { + { + ::osl::MutexGuard aGuard( m_aMutex ); + mpRepr = NULL; // object dies with representation + + } + + { + ::osl::MutexGuard aGuard( m_aMutex ); + + // Send a disposing to all listeners. + if ( mnClientId ) + { + comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); + mnClientId = 0; + } + mxParent = uno::Reference< XAccessible >(); + } + } +} + +Rectangle SvtRulerAccessible::GetBoundingBoxOnScreen( void ) throw( RuntimeException ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + return Rectangle( mpRepr->GetParent()->OutputToAbsoluteScreenPixel( mpRepr->GetPosPixel() ), mpRepr->GetSizePixel() ); +} + +Rectangle SvtRulerAccessible::GetBoundingBox( void ) throw( RuntimeException ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + + return Rectangle( mpRepr->GetPosPixel(), mpRepr->GetSizePixel() ); +} + +Sequence< sal_Int8 > SvtRulerAccessible::getUniqueId( void ) +{ + static OImplementationId* pId = 0; + if( !pId ) + { + MutexGuard aGuard( Mutex::getGlobalMutex() ); + if( !pId) + { + static OImplementationId aId; + pId = &aId; + } + } + return pId->getImplementationId(); +} + +void SvtRulerAccessible::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) +{ + if( IsNotAlive() ) + throw lang::DisposedException(); +} diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index 2ebec04d7645..cb44b4dd7f24 100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -18,20 +18,20 @@ */ #include <svtools/headbar.hxx> +#include <svtools/vclxaccessibleheaderbar.hxx> #include <tools/debug.hxx> #include <vcl/svapp.hxx> #include <vcl/help.hxx> #include <vcl/image.hxx> #include <vcl/salnativewidgets.hxx> +#include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> -// ======================================================================= - class ImplHeadItem { public: - sal_uInt16 mnId; + sal_uInt16 mnId; HeaderBarItemBits mnBits; long mnSize; OString maHelpId; @@ -76,6 +76,7 @@ void HeaderBar::ImplInit( WinBits nWinStyle ) mbOutDrag = sal_False; mbItemMode = sal_False; + m_pVCLXHeaderBar = NULL; // StyleBits auswerten if ( nWinStyle & WB_DRAG ) mbDragable = sal_True; @@ -1553,4 +1554,20 @@ void HeaderBar::SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::sta mxAccessible = _xAccessible; } +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > HeaderBar::GetComponentInterface( sal_Bool bCreate ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer + (Window::GetComponentInterface(false)); + if ( !xPeer.is() && bCreate ) + { + ::com::sun::star::awt::XWindowPeer* mxPeer = new VCLXHeaderBar(this); + m_pVCLXHeaderBar = (VCLXHeaderBar*)(mxPeer); + SetComponentInterface(mxPeer); + return mxPeer; + } + else + return xPeer; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index f6808a22df1e..6b74fdcde375 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -24,11 +24,18 @@ #include <vcl/i18nhelp.hxx> #include <svtools/ruler.hxx> +#include <svtools/svtresid.hxx> +#include <svtools/svtools.hrc> #include <boost/scoped_array.hpp> #include <vector> using namespace std; +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::accessibility; #define RULER_OFF 3 #define RULER_TEXTOFF 5 @@ -271,6 +278,7 @@ void Ruler::ImplInit( WinBits nWinBits ) aDefSize.Width() = nDefHeight; SetOutputSizePixel( aDefSize ); SetType(WINDOW_RULER); + pAccContext = NULL; } Ruler::Ruler( Window* pParent, WinBits nWinStyle ) : @@ -290,6 +298,8 @@ Ruler::~Ruler() Application::RemoveUserEvent( mnUpdateEvtId ); delete mpSaveData; delete mpDragData; + if( pAccContext ) + pAccContext->release(); } void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 ) @@ -2793,4 +2803,31 @@ void Ruler::DrawTicks() Paint(Rectangle()); } +uno::Reference< XAccessible > Ruler::CreateAccessible() +{ + Window* pParent = GetAccessibleParentWindow(); + OSL_ENSURE( pParent, "-SvxRuler::CreateAccessible(): No Parent!" ); + uno::Reference< XAccessible > xAccParent = pParent->GetAccessible(); + if( xAccParent.is() ) + { + // MT: Fixed compiler issue because the address from a temporary object was used. + // BUT: Shoudl it really be a Pointer, instead of const&??? + OUString aStr; + if ( mnWinStyle & WB_HORZ ) + { + aStr = SvtResId(STR_SVT_ACC_RULER_HORZ_NAME); + } + else + { + aStr = SvtResId(STR_SVT_ACC_RULER_VERT_NAME); + } + pAccContext = new SvtRulerAccessible( xAccParent, *this, aStr ); + pAccContext->acquire(); + this->SetAccessible(pAccContext); + return pAccContext; + } + else + return uno::Reference< XAccessible >(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/ruler.src b/svtools/source/control/ruler.src new file mode 100644 index 000000000000..bcefa3e20115 --- /dev/null +++ b/svtools/source/control/ruler.src @@ -0,0 +1,28 @@ +/* + * 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 "svtools/svtools.hrc" + +String STR_SVT_ACC_RULER_HORZ_NAME +{ + Text[ en-US ] = "Horizontal Ruler"; +}; +String STR_SVT_ACC_RULER_VERT_NAME +{ + Text[ en-US ] = "Vertical Ruler"; +}; + diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 01c60af4cc42..fe91c85d47a8 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -25,6 +25,9 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#include <unotools/accessiblerelationsethelper.hxx> using namespace ::com::sun::star; @@ -290,6 +293,9 @@ OUString SAL_CALL ValueSetAcc::getAccessibleName() Window* pLabel = mpParent->GetAccessibleRelationLabeledBy(); if ( pLabel && pLabel != mpParent ) aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() ); + + if (aRet.isEmpty()) + aRet = mpParent->GetQuickHelpText(); } return aRet; @@ -301,7 +307,30 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::ge throw (uno::RuntimeException) { ThrowIfDisposed(); - return uno::Reference< accessibility::XAccessibleRelationSet >(); + uno::Reference< accessibility::XAccessibleRelationSet > xRelSet; + Window* pWindow = (Window*)mpParent; + if ( pWindow ) + { + utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper; + xRelSet = pRelationSet; + + Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); + if ( pLabeledBy && pLabeledBy != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pLabeledBy->GetAccessible(); + pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); + } + + Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf(); + if ( pMemberOf && pMemberOf != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pMemberOf->GetAccessible(); + pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); + } + } + return xRelSet; } // ----------------------------------------------------------------------------- @@ -719,7 +748,7 @@ ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) const nIndex -= 1; } if (pItem == NULL) - pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex)); + pItem = mpParent->ImplGetItem (static_cast<sal_uInt16>(nIndex)); return pItem; } @@ -886,7 +915,7 @@ sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() // just in case the number of children changes in the mean time. try { - pItem = mpParent->mrParent.ImplGetVisibleItem (i); + pItem = mpParent->mrParent.ImplGetItem(i); } catch (const lang::IndexOutOfBoundsException&) { @@ -903,6 +932,15 @@ sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent() } } + //if this valueset contain a none field(common value is default), then we should increase the real index and set the noitem index value equal 0. + if ( mpParent && ( (mpParent->mrParent.GetStyle() & WB_NONEFIELD) != 0 ) ) + { + ValueSetItem* pFirstItem = mpParent->mrParent.ImplGetItem (VALUESET_ITEM_NONEITEM); + if( pFirstItem && pFirstItem ->GetAccessible(mbIsTransientChildrenDisabled).get() == this ) + nIndexInParent = 0; + else + nIndexInParent++; + } return nIndexInParent; } diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx index 7b98251d31d2..3e2076258a77 100644 --- a/svtools/source/control/valueimp.hxx +++ b/svtools/source/control/valueimp.hxx @@ -55,6 +55,7 @@ struct ValueSetItem Color maColor; OUString maText; void* mpData; + bool mbSelected; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc; ValueSetItem( ValueSet& rParent ); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index dfcad5d4f6e7..a757d2f28e9c 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1907,6 +1907,19 @@ void ValueSet::SetItemWidth( long nNewItemWidth ) } } +//method to set accessible when the style is user draw. +void ValueSet::InsertItem( sal_uInt16 nItemId, const OUString& rText, size_t nPos ) +{ + DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" ); + DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND, + "ValueSet::InsertItem(): ItemId already exists" ); + ValueSetItem* pItem = new ValueSetItem( *this ); + pItem->mnId = nItemId; + pItem->meType = VALUESETITEM_USERDRAW; + pItem->maText = rText; + ImplInsertItem( pItem, nPos ); +} + // ----------------------------------------------------------------------- void ValueSet::SetItemHeight( long nNewItemHeight ) diff --git a/svtools/source/control/vclxaccessibleheaderbar.cxx b/svtools/source/control/vclxaccessibleheaderbar.cxx new file mode 100644 index 000000000000..de2b2778fae9 --- /dev/null +++ b/svtools/source/control/vclxaccessibleheaderbar.cxx @@ -0,0 +1,163 @@ +/* + * 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 <svtools/vclxaccessibleheaderbar.hxx> +#include <svtools/vclxaccessibleheaderbaritem.hxx> + +#include <toolkit/awt/vclxwindows.hxx> +#include <svtools/headbar.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <cppuhelper/typeprovider.hxx> +#include <comphelper/sequence.hxx> +#include <com/sun/star/accessibility/AccessibleRole.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::accessibility; +using namespace ::comphelper; + +VCLXHeaderBar::VCLXHeaderBar(Window* pHeaderBar) +{ + SetWindow(pHeaderBar); +} + +VCLXHeaderBar::~VCLXHeaderBar() +{ +} + +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXHeaderBar::CreateAccessibleContext() +{ + return new VCLXAccessibleHeaderBar(this); +} + + +VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow ) + :VCLXAccessibleComponent( pVCLWindow ) + ,m_pHeadBar(NULL) +{ + m_pHeadBar = static_cast< HeaderBar* >( GetWindow() ); +} + +// ----------------------------------------------------------------------------- + +VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar() +{ +} + +// ----------------------------------------------------------------------------- + +void VCLXAccessibleHeaderBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) +{ + VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); +} + +// ----------------------------------------------------------------------------- + +void VCLXAccessibleHeaderBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) +{ + VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); +} + +// ----------------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------------- + +::rtl::OUString VCLXAccessibleHeaderBar::getImplementationName() throw (RuntimeException) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleHeaderBar" ); +} + +// ----------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > VCLXAccessibleHeaderBar::getSupportedServiceNames() throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aNames(1); + aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleHeaderBar" ); + return aNames; +} + +// =======XAccessibleContext======= + +sal_Int32 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount( ) + throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int32 nCount = 0; + if ( m_pHeadBar ) + nCount = m_pHeadBar->GetItemCount(); + + return nCount; +} +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + VCLXAccessibleHeaderBar::getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + if ( i < 0 || i >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + + Reference< XAccessible > xChild; + // search for the child + if ( static_cast<sal_uInt16>(i) >= m_aAccessibleChildren.size() ) + xChild = CreateChild (i); + else + { + xChild = m_aAccessibleChildren[i]; + if ( !xChild.is() ) + xChild = CreateChild (i); + } + return xChild; +} + +sal_Int16 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException) +{ + return com::sun::star::accessibility::AccessibleRole::LIST; +} + +void SAL_CALL VCLXAccessibleHeaderBar::disposing (void) +{ + ListItems().swap(m_aAccessibleChildren); + VCLXAccessibleComponent::disposing(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > VCLXAccessibleHeaderBar::CreateChild (sal_Int32 i) +{ + Reference<XAccessible> xChild; + + sal_uInt16 nPos = static_cast<sal_uInt16>(i); + if ( nPos >= m_aAccessibleChildren.size() ) + { + m_aAccessibleChildren.resize(nPos + 1); + + // insert into the container + xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i); + m_aAccessibleChildren[nPos] = xChild; + } + else + { + xChild = m_aAccessibleChildren[nPos]; + // check if position is empty and can be used else we have to adjust all entries behind this + if ( !xChild.is() ) + { + xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i); + m_aAccessibleChildren[nPos] = xChild; + } + } + return xChild; +} diff --git a/svtools/source/control/vclxaccessibleheaderbaritem.cxx b/svtools/source/control/vclxaccessibleheaderbaritem.cxx new file mode 100644 index 000000000000..293bba6b79b8 --- /dev/null +++ b/svtools/source/control/vclxaccessibleheaderbaritem.cxx @@ -0,0 +1,370 @@ +/* + * 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 <svtools/vclxaccessibleheaderbaritem.hxx> + +#include <svtools/headbar.hxx> + +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> + +#include <unotools/accessiblestatesethelper.hxx> +#include <unotools/accessiblerelationsethelper.hxx> +#include <vcl/svapp.hxx> +#include <toolkit/awt/vclxfont.hxx> +#include <toolkit/helper/externallock.hxx> +#include <toolkit/helper/convert.hxx> + +#include <vector> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::accessibility; +using namespace ::comphelper; + +DBG_NAME( VCLXAccessibleHeaderBarItem ) + +// ---------------------------------------------------- +// class AccessibleTabBar +// ---------------------------------------------------- + +VCLXAccessibleHeaderBarItem::VCLXAccessibleHeaderBarItem( HeaderBar* pHeadBar, sal_Int32 _nIndexInParent ) + :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ) + ,m_pHeadBar( pHeadBar ) + ,m_nIndexInParent(_nIndexInParent + 1) + +{ + DBG_CTOR( VCLXAccessibleHeaderBarItem, NULL ); + m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() ); +} + +// ----------------------------------------------------------------------------- + +VCLXAccessibleHeaderBarItem::~VCLXAccessibleHeaderBarItem() +{ + delete m_pExternalLock; + m_pExternalLock = NULL; +} + +// ----------------------------------------------------------------------------- + +IMPL_LINK( VCLXAccessibleHeaderBarItem, WindowEventListener, VclSimpleEvent*, pEvent ) +{ + DBG_CHKTHIS( VCLXAccessibleHeaderBarItem, 0 ); + DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "VCLXAccessibleHeaderBarItem::WindowEventListener: unknown window event!" ); + + if ( pEvent && pEvent->ISA( VclWindowEvent ) ) + { + DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "VCLXAccessibleHeaderBarItem::WindowEventListener: no window!" ); + if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) ) + { + ProcessWindowEvent( *(VclWindowEvent*)pEvent ); + } + } + + return 0; +} + +// ----------------------------------------------------------------------------- + +void VCLXAccessibleHeaderBarItem::ProcessWindowEvent( const VclWindowEvent& ) +{ + Any aOldValue, aNewValue; +} + +// ----------------------------------------------------------------------------- + +void VCLXAccessibleHeaderBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) +{ + if ( m_pHeadBar ) + { + if ( m_pHeadBar->IsEnabled() ) + rStateSet.AddState( AccessibleStateType::ENABLED ); + + if ( m_pHeadBar->IsVisible() ) + { + rStateSet.AddState( AccessibleStateType::VISIBLE ); + } + rStateSet.AddState( AccessibleStateType::SELECTABLE ); + rStateSet.AddState( AccessibleStateType::RESIZABLE ); + } +} + +// ----------------------------------------------------------------------------- +// OCommonAccessibleComponent +// ----------------------------------------------------------------------------- + +awt::Rectangle VCLXAccessibleHeaderBarItem::implGetBounds() throw (RuntimeException) +{ + awt::Rectangle aBounds; + OExternalLockGuard aGuard( this ); + + ::com::sun::star::awt::Size aSize; + + if ( m_pHeadBar ) + aBounds = AWTRectangle( m_pHeadBar->GetItemRect( sal_uInt16( m_nIndexInParent ) ) ); + + return aBounds; +} + +// ----------------------------------------------------------------------------- +// XInterface +// ----------------------------------------------------------------------------- + +IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE ) + +// ----------------------------------------------------------------------------- +// XTypeProvider +// ----------------------------------------------------------------------------- + +IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE ) + +// ----------------------------------------------------------------------------- +// XComponent +// ----------------------------------------------------------------------------- + +void VCLXAccessibleHeaderBarItem::disposing() +{ + AccessibleExtendedComponentHelper_BASE::disposing(); +} + +// ----------------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------------- + +OUString VCLXAccessibleHeaderBarItem::getImplementationName() throw (RuntimeException) +{ + return OUString("com.sun.star.comp.svtools.AccessibleHeaderBarItem"); +} + +// ----------------------------------------------------------------------------- + +sal_Bool VCLXAccessibleHeaderBarItem::supportsService( const OUString& rServiceName ) throw (RuntimeException) +{ + Sequence< OUString > aNames( getSupportedServiceNames() ); + const OUString* pNames = aNames.getConstArray(); + const OUString* pEnd = pNames + aNames.getLength(); + for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) + ; + + return pNames != pEnd; +} + +// ----------------------------------------------------------------------------- + +Sequence< OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() throw (RuntimeException) +{ + Sequence< OUString > aNames(1); + aNames[0] = OUString( "com.sun.star.awt.AccessibleHeaderBarItem" ); + return aNames; +} + +// ----------------------------------------------------------------------------- +// XAccessible +// ----------------------------------------------------------------------------- + +Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContext() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + return this; +} + +// ----------------------------------------------------------------------------- +// XAccessibleContext +// ----------------------------------------------------------------------------- + +sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleChildCount() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + return 0; +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + if ( i < 0 || i >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + + return Reference< XAccessible >(); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleParent() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + Reference< XAccessible > xParent; + if ( m_pHeadBar ) + { + xParent = m_pHeadBar->GetAccessible(); + } + + return xParent; +} + +// ----------------------------------------------------------------------------- + +sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + return m_nIndexInParent - 1; +} + +// ----------------------------------------------------------------------------- + +sal_Int16 VCLXAccessibleHeaderBarItem::getAccessibleRole() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + return AccessibleRole::COLUMN_HEADER; +} + +// ----------------------------------------------------------------------------- + +OUString VCLXAccessibleHeaderBarItem::getAccessibleDescription() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + OUString sDescription; + return sDescription; +} + +// ----------------------------------------------------------------------------- + +OUString VCLXAccessibleHeaderBarItem::getAccessibleName() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + OUString sName; + if(m_pHeadBar) + sName = m_pHeadBar->GetItemText( sal_uInt16( m_nIndexInParent ) ); + return sName; +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRelationSet( ) throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; + Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; + return xSet; +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleStateSet( ) throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; + Reference< XAccessibleStateSet > xSet = pStateSetHelper; + + if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) + { + FillAccessibleStateSet( *pStateSetHelper ); + } + else + { + pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); + } + + return xSet; +} + +// ----------------------------------------------------------------------------- + +com::sun::star::lang::Locale VCLXAccessibleHeaderBarItem::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + return Application::GetSettings().GetLanguageTag().getLocale(); +} + +// ----------------------------------------------------------------------------- +// XAccessibleComponent +// ----------------------------------------------------------------------------- + +Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + return Reference< XAccessible >(); +} + +// ----------------------------------------------------------------------------- + +sal_Int32 VCLXAccessibleHeaderBarItem::getForeground() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + sal_Int32 nColor = 0; + return nColor; +} + +// ----------------------------------------------------------------------------- + +sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + sal_Int32 nColor = 0; + return nColor; +} + +// ----------------------------------------------------------------------------- +// XAccessibleExtendedComponent +// ----------------------------------------------------------------------------- + +Reference< awt::XFont > VCLXAccessibleHeaderBarItem::getFont() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + Reference< awt::XFont > xFont; + return xFont; +} + +// ----------------------------------------------------------------------------- + +OUString VCLXAccessibleHeaderBarItem::getTitledBorderText() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + OUString sText; + return sText; +} + +// ----------------------------------------------------------------------------- + +OUString VCLXAccessibleHeaderBarItem::getToolTipText() throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + + OUString sText; + if ( m_pHeadBar ) + sText = m_pHeadBar->GetQuickHelpText(); + + return sText; +} diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index fb5f3f2e1ccc..918b9415ae9f 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -28,7 +28,12 @@ #include <toolkit/helper/vclunohelper.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/streamwrap.hxx> - +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/XChartTypeContainer.hpp> +#include <com/sun/star/chart2/XChartType.hpp> #include <tools/globname.hxx> #include <comphelper/classids.hxx> #include <com/sun/star/util/XModifyListener.hpp> @@ -814,6 +819,100 @@ bool EmbeddedObjectRef::IsChart() const return false; } +// MT: Only used for getting accessible attributes, which are not localized +OUString EmbeddedObjectRef::GetChartType() +{ + OUString Style; + if ( mpImpl->mxObj.is() ) + { + if ( IsChart() ) + { + if ( svt::EmbeddedObjectRef::TryRunningState( mpImpl->mxObj ) ) + { + uno::Reference< chart2::XChartDocument > xChart( mpImpl->mxObj->getComponent(), uno::UNO_QUERY ); + if (xChart.is()) + { + uno::Reference< chart2::XDiagram > xDiagram( xChart->getFirstDiagram()); + if( ! xDiagram.is()) + return OUString(); + uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); + uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); + // IA2 CWS. Unused: int nCoordinateCount = aCooSysSeq.getLength(); + sal_Bool bGetChartType = sal_False; + for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) + { + uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); + uno::Sequence< uno::Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); + int nDimesionCount = aCooSysSeq[nCooSysIdx]->getDimension(); + if( nDimesionCount == 3 ) + Style += "3D "; + else + Style += "2D "; + for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) + { + OUString strChartType = aChartTypes[nCTIdx]->getChartType(); + if (strChartType == "com.sun.star.chart2.AreaChartType") + { + Style += "Areas"; + bGetChartType = sal_True; + } + else if (strChartType == "com.sun.star.chart2.BarChartType") + { + Style += "Bars"; + bGetChartType = sal_True; + } + else if (strChartType == "com.sun.star.chart2.ColumnChartType") + { + uno::Reference< beans::XPropertySet > xProp( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY ); + if( xProp.is()) + { + bool bCurrent = false; + if( xProp->getPropertyValue( OUString("SwapXAndYAxis") ) >>= bCurrent ) + { + if (bCurrent) + Style += "Bars"; + else + Style += "Columns"; + bGetChartType = sal_True; + } + } + } + else if (strChartType == "com.sun.star.chart2.LineChartType") + { + Style += "Lines"; + bGetChartType = sal_True; + } + else if (strChartType == "com.sun.star.chart2.ScatterChartType") + { + Style += "XY Chart"; + bGetChartType = sal_True; + } + else if (strChartType == "com.sun.star.chart2.PieChartType") + { + Style += "Pies"; + bGetChartType = sal_True; + } + else if (strChartType == "com.sun.star.chart2.NetChartType") + { + Style += "Radar"; + bGetChartType = sal_True; + } + else if (strChartType == "com.sun.star.chart2.CandleStickChartType") + { + Style += "Candle Stick Chart"; + bGetChartType = sal_True; + } + if (bGetChartType) + return Style; + } + } + } + } + } + } + return Style; +} + // #i104867# sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const { diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 5970b3c6c2d2..340d8fe218a9 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -901,7 +901,6 @@ void TextWindow::Command( const CommandEvent& rCEvt ) void TextWindow::GetFocus() { - Window::GetFocus(); if ( !mbActivePopup ) { sal_Bool bGotoCursor = !mpExtTextView->IsReadOnly(); @@ -1195,7 +1194,6 @@ void VclMultiLineEdit::GetFocus() if ( !pImpVclMEdit ) // might be called from within the dtor, when pImpVclMEdit == NULL is a valid state return; - Edit::GetFocus(); pImpVclMEdit->GetFocus(); } |