diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-05 19:29:07 +0100 |
commit | 871e01af03cebccec8b84cd998cc9525e665a5f9 (patch) | |
tree | c51b04950c734dc378db3e89faed550516608cf6 | |
parent | f8ce8c1eac6e00c00e1bd168ed831c8c0f758522 (diff) | |
parent | 936124154d6dfb50b1342a58ddc3dea5aeed3f03 (diff) |
merge to m67
56 files changed, 5634 insertions, 263 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx new file mode 100755 index 000000000..4cde2ef84 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx @@ -0,0 +1,277 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2009 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControl.hxx,v $ + * $Revision: 1.3 $ + * + * 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_EXT_ACCESSIBLEGRIDCONTROL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX + +#include <accessibility/extended/AccessibleGridControlBase.hxx> +#include <accessibility/extended/AccessibleGridControlTable.hxx> +#include <cppuhelper/weakref.hxx> +#include <svtools/accessibletable.hxx> + + +#include <memory> + +using namespace ::svt::table; + +// ============================================================================ + +namespace accessibility { + + class AccessibleGridControl_Impl; + +// ============================================================================ + +/** This class represents the complete accessible Grid Control object. */ +class AccessibleGridControl : public AccessibleGridControlBase +{ + friend class AccessibleGridControlAccess; + +protected: + AccessibleGridControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator, + ::svt::table::IAccessibleTable& _rTable + ); + + virtual ~AccessibleGridControl(); + + /** sets the XAccessible which created the context + + <p>To be called only once, and only if in the ctor NULL was passed.</p> + */ + void setCreator( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator + ); + + /** Cleans up members. */ + using AccessibleGridControlBase::disposing; + virtual void SAL_CALL disposing(); + +protected: + // XAccessibleContext ----------------------------------------------------- + + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The role of this object (a table). */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return + The accessible child rendered under the given point. + */ + 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 ); + + /** Grabs the focus to the Grid Control. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +public: + // helper functions + /** returns the accessible object for the row or the column header bar + */ + inline ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + getHeaderBar( ::svt::table::AccessibleTableControlObjType _eObjType ) + { + return implGetHeaderBar(_eObjType); + } + + /** returns the accessible object for the table representation + */ + inline ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + getTable( ) + { + return implGetTable(); + } + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + // internal helper methods ------------------------------------------------ + + /** This method creates (once) and returns the accessible data table child. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the data table. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > implGetTable(); + + /** This method creates (once) and returns the specified header bar. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the header bar. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetHeaderBar( ::svt::table::AccessibleTableControlObjType eObjType ); + + /** This method returns one of the children that are always present: + Data table, row and column header bar or corner control. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the specified child. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetFixedChild( sal_Int32 nChildIndex ); + + /** This method creates and returns an accessible table. + @return An AccessibleGridControlTable. */ + virtual AccessibleGridControlTable* createAccessibleTable(); + +private: + // members ---------------------------------------------------------------- + ::std::auto_ptr< AccessibleGridControl_Impl > m_pImpl; +}; + +// ============================================================================ +/** the XAccessible which creates/returns an AccessibleGridControl + + <p>The instance holds it's XAccessibleContext with a hard reference, while + the contxt holds this instance weak.</p> +*/ +typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible + > AccessibleGridControlAccess_Base; + +class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base + ,public ::svt::table::IAccessibleTableControl +{ +private: + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + m_xParent; + ::svt::table::IAccessibleTable& m_rTable; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + m_xContext; + AccessibleGridControl* m_pContext; + // note that this pointer is valid as long as m_xContext is valid! + +public: + AccessibleGridControlAccess( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::table::IAccessibleTable& _rTable + ); + + /// checks whether the accessible context is still alive + bool isContextAlive() const; + + /// returns the AccessibleContext belonging to this Accessible + inline AccessibleGridControl* getContext() { return m_pContext; } + inline const AccessibleGridControl* getContext() const { return m_pContext; } + +protected: + virtual ~AccessibleGridControlAccess(); + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); + + // IAccessibleTable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getMyself() + { + return this; + } + void dispose(); + virtual sal_Bool isAlive() const + { + return isContextAlive(); + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + xAccessible = pContext->getHeaderBar( _eObjType ); + return xAccessible; + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTable() + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + xAccessible = pContext->getTable(); + return xAccessible; + } + virtual void commitEvent( sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) + { + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + pContext->commitEvent( nEventId, rNewValue, rOldValue ); + } + +private: + AccessibleGridControlAccess(); // never implemented + AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented + AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& ); // never implemented +}; + +// ============================================================================ +} // namespace accessibility + +// ============================================================================ + +#endif + diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx new file mode 100755 index 000000000..1c2c39508 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx @@ -0,0 +1,470 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlBase.hxx,v $ + * $Revision: 1.3 $ + * + * 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_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX + +#include <svtools/accessibletable.hxx> +#include <tools/debug.hxx> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <vcl/svapp.hxx> +#include <cppuhelper/compbase4.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <comphelper/accessibleeventnotifier.hxx> +#include <comphelper/uno3.hxx> + +// ============================================================================ + +class Window; + +namespace utl { + class AccessibleStateSetHelper; +} + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +/** Aquire the solar mutex. */ +class TCSolarGuard : public ::vos::OGuard +{ +public: + inline TCSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {} +}; + +// ============================================================================ + +typedef ::cppu::WeakAggComponentImplHelper4< + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::lang::XServiceInfo > + AccessibleGridControlImplHelper; + +/** The GridControl accessible objects inherit from this base class. It + implements basic functionality for various Accessibility interfaces and + the event broadcaster and contains the ::osl::Mutex. */ +class AccessibleGridControlBase : + public ::comphelper::OBaseMutex, + public AccessibleGridControlImplHelper +{ +public: + /** Constructor sets specified name and description. + @param rxParent XAccessible interface of the parent object. + @param rTable The Table control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. */ + AccessibleGridControlBase( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +protected: + virtual ~AccessibleGridControlBase(); + + /** Commits DeFunc event to listeners and cleans up members. */ + virtual void SAL_CALL disposing(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return A reference to the parent accessible object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The description of this object. + */ + virtual ::rtl::OUString SAL_CALL getAccessibleDescription() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The name of this object. + */ + virtual ::rtl::OUString SAL_CALL getAccessibleName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The relation set (the GridControl does not have one). + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The set of current states. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The parent's locale. */ + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() + throw ( ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, + ::com::sun::star::uno::RuntimeException ); + + /** @return + The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported. + */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getAccessibleChildCount, + - getAccessibleChild, + - getAccessibleRole. + Derived classes may overwrite getAccessibleIndexInParent to increase + performance. */ + + // XAccessibleComponent --------------------------------------------------- + + /** @return + <TRUE/>, if the point lies within the bounding box of this object. */ + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The bounding box of this object. */ + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The upper left corner of the bounding box relative to the parent. */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocation() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The upper left corner of the bounding box in screen coordinates. */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The size of the bounding box. */ + virtual ::com::sun::star::awt::Size SAL_CALL getSize() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object is showing. */ + virtual sal_Bool SAL_CALL isShowing() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object is visible. */ + virtual sal_Bool SAL_CALL isVisible() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object can accept the focus. */ + virtual sal_Bool SAL_CALL isFocusTraversable() + 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); + + + /* Derived classes have to implement: + - getAccessibleAt, + - grabFocus, + - getAccessibleKeyBinding. */ + + /** @return + No key bindings supported by default. + */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + /** @return + The accessible child rendered under the given point. + */ + 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 ); + + // XAccessibleEventBroadcaster -------------------------------------------- + + /** Adds a new event listener */ + using cppu::WeakAggComponentImplHelperBase::addEventListener; + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Removes an event listener. */ + using cppu::WeakAggComponentImplHelperBase::removeEventListener; + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider ---------------------------------------------------------- + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return Whether the specified service is supported by this class. */ + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return A list of all supported services. */ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getImplementationName. */ + + // helper methods --------------------------------------------------------- + + /** @return The GridControl object type. */ + inline ::svt::table::AccessibleTableControlObjType getType() const; + + /** Commits an event to all listeners. */ + void commitEvent( + sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + + const ::com::sun::star::uno::Any& rOldValue ); + /** @return <TRUE/>, if the object is not disposed or disposing. */ + sal_Bool isAlive() const; + +protected: + // internal virtual methods ----------------------------------------------- + + /** Determines whether the Grid control is really showing inside of + its parent accessible window. Derived classes may implement different + behaviour. + @attention This method requires locked mutex's and a living object. + @return <TRUE/>, if the object is really showing. */ + virtual sal_Bool implIsShowing(); + + /** Derived classes return the bounding box relative to the parent window. + @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox() = 0; + ///** Derived classes return the bounding box in screen coordinates. + // @attention This method requires locked mutex's and a living object. + // @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen() = 0; + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. This method calls FillStateSet at the GridControl which + fills it with more states depending on the object type. Derived classes + may overwrite this method and add more states. + @attention This method requires locked mutex's. + @return A filled AccessibleStateSetHelper. */ + virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + // internal helper methods ------------------------------------------------ + + /** @throws <type>DisposedException</type> If the object is not alive. */ + void ensureIsAlive() const + throw ( ::com::sun::star::lang::DisposedException ); + + /** @return The ::osl::Mutex member provided by the class OBaseMutex. */ + inline ::osl::Mutex& getOslMutex(); + /** @return Pointer to the global ::osl::Mutex. */ + static inline ::osl::Mutex* getOslGlobalMutex(); + + /** Changes the name of the object (flat assignment, no notify). + @attention This method requires a locked mutex. */ + inline void implSetName( const ::rtl::OUString& rName ); + /** Changes the description of the object (flat assignment, no notify). + @attention This method requires a locked mutex. */ + inline void implSetDescription( const ::rtl::OUString& rDescription ); + + /** Locks all mutex's and calculates the bounding box relative to the + parent window. + @return The bounding box (VCL rect.) relative to the parent object. */ + Rectangle getBoundingBox() + throw ( ::com::sun::star::lang::DisposedException ); + ///** Locks all mutex's and calculates the bounding box in screen + // coordinates. + // @return The bounding box (VCL rect.) in screen coordinates. */ + Rectangle getBoundingBoxOnScreen() + throw ( ::com::sun::star::lang::DisposedException ); + + /** Creates a new UUID, if rId is empty. + @attention This method requires locked global mutex to prevent double + creation of an UUID. */ + static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId ); + + ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } + void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } + +public: + // public versions of internal helper methods, with access control + struct TC_AccessControl { friend class TC_SolarMethodGuard; private: TC_AccessControl() { } }; + + inline ::osl::Mutex& getMutex( const TC_AccessControl& ) { return getOslMutex(); } + inline void ensureIsAlive( const TC_AccessControl& ) { ensureIsAlive(); } + +protected: + // members ---------------------------------------------------------------- + + /** The parent accessible object. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > m_xParent; + /** The SVT Table control. */ + ::svt::table::IAccessibleTable& m_aTable; + /** The type of this object (for names, descriptions, state sets, ...). */ + ::svt::table::AccessibleTableControlObjType m_eObjType; + +private: + /** Localized name. */ + ::rtl::OUString m_aName; + /** Localized description text. */ + ::rtl::OUString m_aDescription; + ::comphelper::AccessibleEventNotifier::TClientId m_aClientId; +}; + +// ============================================================================ +// a version of AccessibleGridControlBase which implements not only the XAccessibleContext, +// but also the XAccessible + +typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible + > GridControlAccessibleElement_Base; + +class GridControlAccessibleElement + :public AccessibleGridControlBase + ,public GridControlAccessibleElement_Base +{ +protected: + /** Constructor sets specified name and description. + + @param rxParent XAccessible interface of the parent object. + @param rTable The Table control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. + */ + GridControlAccessibleElement( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +public: + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + +protected: + virtual ~GridControlAccessibleElement(); + +protected: + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + +private: + GridControlAccessibleElement(); // never implemented + GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented + GridControlAccessibleElement& operator=( const GridControlAccessibleElement& ); // never implemented +}; + +// ============================================================================ +// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex + +typedef ::osl::MutexGuard OslMutexGuard; + +class TC_SolarMethodGuard : public TCSolarGuard, public OslMutexGuard +{ +public: + inline TC_SolarMethodGuard( AccessibleGridControlBase& _rOwner, bool _bEnsureAlive = true ) + :TCSolarGuard( ) + ,OslMutexGuard( _rOwner.getMutex( AccessibleGridControlBase::TC_AccessControl() ) ) + { + if ( _bEnsureAlive ) + _rOwner.ensureIsAlive( AccessibleGridControlBase::TC_AccessControl() ); + } +}; + +// inlines -------------------------------------------------------------------- + +inline ::svt::table::AccessibleTableControlObjType AccessibleGridControlBase::getType() const +{ + return m_eObjType; +} + +inline ::osl::Mutex& AccessibleGridControlBase::getOslMutex() +{ + return m_aMutex; +} + +inline ::osl::Mutex* AccessibleGridControlBase::getOslGlobalMutex() +{ + return ::osl::Mutex::getGlobalMutex(); +} + +inline void AccessibleGridControlBase::implSetName( + const ::rtl::OUString& rName ) +{ + m_aName = rName; +} + +inline void AccessibleGridControlBase::implSetDescription( + const ::rtl::OUString& rDescription ) +{ + m_aDescription = rDescription; +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLBASE_HXX + diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx new file mode 100755 index 000000000..6a7eca447 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx @@ -0,0 +1,227 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlHeader.hxx,v $ + * $Revision: 1.3 $ + * + * 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_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX + + +#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" +#include "accessibility/extended/AccessibleGridControlTableBase.hxx" + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +/** This class represents the accessible object of a header bar of a Grid Control + (row or column header bar). This object supports the + XAccessibleSelection interface. Selecting a child of this object selects + complete rows or columns of the data table. */ +class AccessibleGridControlHeader : public AccessibleGridControlTableBase +{ +public: + /** @param eObjType One of the two allowed types TCTYPE_ROWHEADERBAR or + TCTYPE_COLUMNHEADERBAR. */ + AccessibleGridControlHeader( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +protected: + virtual ~AccessibleGridControlHeader(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return + The XAccessible interface of the specified child. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return The accessible child rendered under the given point. */ + 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 ); + + /** Grabs the focus to (the current cell of) the data table. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleTable ------------------------------------------------------- + + /** @return The description text of the specified row. */ + virtual ::rtl::OUString SAL_CALL + getAccessibleRowDescription( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The description text of the specified column. */ + virtual ::rtl::OUString SAL_CALL + getAccessibleColumnDescription( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessibleTable interface of the row header bar. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL + getAccessibleRowHeaders() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessibleTable interface of the column header bar. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL + getAccessibleColumnHeaders() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An index list of completely selected rows. */ + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL + getSelectedAccessibleRows() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An index list of completely selected columns. */ + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL + getSelectedAccessibleColumns() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified row is completely selected. */ + virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified column is completely selected. */ + virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the cell object at the specified + cell position. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified cell is selected. */ + virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return The name of this class. */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal virtual methods ----------------------------------------------- + /** @attention This method requires locked mutex's and a living object. + @return The absolute child index from the index of selected children. + @throws <type>IndexOutOfBoundsException</type> + If the specified index is invalid. */ + //sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex ) + // throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** Returns the specified row or column. Uses one of the parameters, + depending on object type. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the specified column/row. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetChild( sal_Int32 nRow, sal_uInt32 nColumnPos ); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + /** @attention This method requires locked mutex's and a living object. + @return The count of used rows. */ + virtual sal_Int32 implGetRowCount() const; + /** @attention This method requires locked mutex's and a living object. + @return The count of used columns. */ + virtual sal_Int32 implGetColumnCount() const; + + // internal helper methods ------------------------------------------------ + + /** @return <TRUE/>, if the objects is a header bar for rows. */ + inline sal_Bool isRowBar() const; + /** @return <TRUE/>, if the objects is a header bar for columns. */ + inline sal_Bool isColumnBar() const; + + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified row/column index (depending on type) is invalid. */ + void ensureIsValidHeaderIndex( sal_Int32 nIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); +}; + +// inlines -------------------------------------------------------------------- + +inline sal_Bool AccessibleGridControlHeader::isRowBar() const +{ + return getType() == ::svt::table::TCTYPE_ROWHEADERBAR; +} + +inline sal_Bool AccessibleGridControlHeader::isColumnBar() const +{ + return getType() == ::svt::table::TCTYPE_COLUMNHEADERBAR; +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLHEADER_HXX + diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx new file mode 100755 index 000000000..f709d3a2f --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlHeaderCell.hxx,v $ + * $Revision: 1.3 $ + * + * 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_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX + +#include "accessibility/extended/AccessibleGridControlTableCell.hxx" + +namespace accessibility +{ + class AccessibleGridControlHeaderCell : public AccessibleGridControlCell, public ::com::sun::star::accessibility::XAccessible + { + sal_Int32 m_nColumnRowId; + public: + AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& _rTable, + ::svt::table::AccessibleTableControlObjType _eObjType); + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to the GridControl. */ + virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + //------------------------------------------------------------------------- + inline sal_Bool isRowBarCell() const + { + return getType() == ::svt::table::TCTYPE_ROWHEADERCELL; + } + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. + */ + ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + protected: + virtual Rectangle implGetBoundingBox(); + + virtual Rectangle implGetBoundingBoxOnScreen(); + private: + ::rtl::OUString m_sHeaderName; + }; +} + +#endif // ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX + diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx new file mode 100755 index 000000000..f963e143f --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlTable.hxx,v $ + * $Revision: 1.3 $ + * + * 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_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX + +#include "accessibility/extended/AccessibleGridControlTableBase.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleSelection > + AccessibleGridControlTableImplHelper1; +/** This class represents the accessible object of the data table of a + Grid control. */ +class AccessibleGridControlTable : public AccessibleGridControlTableBase, + public AccessibleGridControlTableImplHelper1 +{ +public: + AccessibleGridControlTable( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType _eType); + +protected: + virtual ~AccessibleGridControlTable(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return The accessible child rendered under the given point. */ + 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 ); + + /** Grabs the focus to (the current cell of) the data table. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleTable ------------------------------------------------------- + + /** @return The description text of the specified row. */ + virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The description text of the specified column. */ + virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessibleTable interface of the row header bar. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL + getAccessibleRowHeaders() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessibleTable interface of the column header bar. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL + getAccessibleColumnHeaders() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An index list of completely selected rows. */ + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL + getSelectedAccessibleRows() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An index list of completely selected columns. */ + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL + getSelectedAccessibleColumns() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified row is completely selected. */ + virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified column is completely selected. */ + virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the cell object at the specified + cell position. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified cell is selected. */ + virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + // XAccessibleSelection --------------------------------------------------- + + /** Selects the specified child (row or column of the table). */ + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified child (row/column) is selected. */ + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** Clears the complete selection. */ + virtual void SAL_CALL clearAccessibleSelection() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Selects all children or first, if multiselection is not supported. */ + virtual void SAL_CALL selectAllAccessibleChildren() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The number of selected rows/columns. */ + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The specified selected row/column. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** Removes the specified row/column from the selection. */ + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + // XServiceInfo ----------------------------------------------------------- + + /** @return The name of this class. */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + ///** @attention This method requires locked mutex's and a living object. + // @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + + //// internal helper methods ------------------------------------------------ + /** Returns the specified row or column. Uses one of the parameters, + depending on object type. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the specified column/row. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetChild( sal_Int32 nRow, sal_uInt16 nColumnPos ); + ///** @attention This method requires a locked mutex. + // @return The XAccessibleTable interface of the specified header bar. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > + implGetHeaderBar( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::uno::RuntimeException ); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLE_HXX + diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx new file mode 100755 index 000000000..85d187502 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlTableBase.hxx,v $ + * $Revision: 1.3 $ + * + * 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_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX + +#include "accessibility/extended/AccessibleGridControlBase.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleTable.hpp> + +// ============================================================================ + +namespace accessibility { + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleTable > + AccessibleGridControlTableImplHelper; + +/** The Grid Control accessible table objects inherit from this base class. It + implements basic functionality for the XAccessibleTable interface. + Grid COntrol table objects are: the data table, the column header bar and the + row header bar. */ +class AccessibleGridControlTableBase : + public GridControlAccessibleElement, + public AccessibleGridControlTableImplHelper +{ +public: + /** Constructor sets specified name and description. + @param rxParent XAccessible interface of the parent object. + @param rTable The Table control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. */ + AccessibleGridControlTableBase( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +protected: + virtual ~AccessibleGridControlTableBase(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The role of this object (a table). */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getAccessibleChild, + - getAccessibleIndexInParent. */ + + // XAccessibleComponent --------------------------------------------------- + + /* Derived classes have to implement: + - getAccessibleAt, + - grabFocus, + - getAccessibleKeyBinding. */ + + // XAccessibleTable ------------------------------------------------------- + + /** @return The number of used rows in the table (0 = empty table). */ + virtual sal_Int32 SAL_CALL getAccessibleRowCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The number of used columns in the table (0 = empty table). */ + virtual sal_Int32 SAL_CALL getAccessibleColumnCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The row extent of the specified cell (always 1). */ + virtual sal_Int32 SAL_CALL + getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The column extent of the specified cell (always 1). */ + virtual sal_Int32 SAL_CALL + getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The caption cell of the table (not supported). */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleCaption() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The summary object of the table (not supported). */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleSummary() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The child index of the specified cell. */ + virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The row index of the specified child cell. */ + virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The column index of the specified child cell. */ + virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getAccessibleRowDescription, + - getAccessibleColumnDescription, + - getAccessibleRowHeaders, + - getAccessibleColumnHeaders, + - getSelectedAccessibleRows, + - getSelectedAccessibleColumns, + - isAccessibleRowSelected, + - isAccessibleColumnSelected, + - getAccessibleCellAt, + - isAccessibleSelected. */ + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + + // XTypeProvider ---------------------------------------------------------- + + /** @return A sequence of possible types (received from base classes). */ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal helper methods ------------------------------------------------ + + /** @attention This method requires locked mutex's and a living object. + @param nColumn + the position of the column in the Accessible world + @return + the position of the column in VCL the Accessible world + */ + sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const; + + /** @attention This method requires locked mutex's and a living object. + @return The number of cells of the table. */ + sal_Int32 implGetChildCount() const; + + /** @attention This method requires locked mutex's and a living object. + @return The row index of the specified cell index. */ + sal_Int32 implGetRow( sal_Int32 nChildIndex ) const; + /** @attention This method requires locked mutex's and a living object. + @return The column index of the specified cell index. */ + sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const; + /** @attention This method requires locked mutex's and a living object. + @return The child index of the specified cell address. */ + sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const; + + /** @attention This method requires locked mutex's and a living object. + @return <TRUE/>, if the specified row is selected. */ + sal_Bool implIsRowSelected( sal_Int32 nRow ) const; + + /** @attention This method requires locked mutex's and a living object. + @return The count of selected rows. */ + sal_Int32 implGetSelectedRowCount() const; + + /** Fills a sequence with sorted indexes of completely selected rows. + @attention This method requires locked mutex's and a living object. + @param rSeq Out-parameter that takes the sorted row index list. */ + void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); + /** Fills a sequence with sorted indexes of completely selected columns. + @attention This method requires locked mutex's and a living object. + @param rSeq Out-parameter that takes the sorted column index list. */ + //void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); + + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified row index is invalid. */ + void ensureIsValidRow( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified column index is invalid. */ + void ensureIsValidColumn( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified cell address is invalid. */ + void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified child index is invalid. */ + void ensureIsValidIndex( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLEBASE_HXX + diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx new file mode 100755 index 000000000..49a592986 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlTableCell.hxx,v $ + * $Revision: 1.4 $ + * + * 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_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX + +#include <comphelper/accessibletexthelper.hxx> +#include <cppuhelper/implbase2.hxx> +#include "accessibility/extended/AccessibleGridControlBase.hxx" +#include <svtools/accessibletable.hxx> + +namespace accessibility +{ + class AccessibleGridControlCell : public AccessibleGridControlBase + { + private: + sal_Int32 m_nRowPos; // the row number of the table cell + sal_Int32 m_nColPos; // the column id of the table cell + + protected: + // attribute access + inline sal_Int32 getRowPos( ) const { return m_nRowPos; } + inline sal_Int32 getColumnPos( ) const { return m_nColPos; } + + // XAccessibleComponent + virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); + + protected: + AccessibleGridControlCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::table::IAccessibleTable& _rTable, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + ::svt::table::AccessibleTableControlObjType _eType + ); + + virtual ~AccessibleGridControlCell(); + + private: + AccessibleGridControlCell(); // never implemented + AccessibleGridControlCell( const AccessibleGridControlCell& ); // never implemented + AccessibleGridControlCell& operator=( const AccessibleGridControlCell& ); // never implemented + }; + + typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessibleText + , ::com::sun::star::accessibility::XAccessible + > AccessibleTextHelper_BASE; + // implementation of a table cell of GridControl + class AccessibleGridControlTableCell :public AccessibleGridControlCell + ,public AccessibleTextHelper_BASE + ,public ::comphelper::OCommonAccessibleText + { + private: + sal_Int32 m_nOffset; + + protected: + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + virtual Rectangle implGetBoundingBox(); + virtual Rectangle implGetBoundingBoxOnScreen(); + + public: + AccessibleGridControlTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::table::IAccessibleTable& _rTable, + sal_Int32 _nRowId, + sal_uInt16 _nColId, + svt::table::AccessibleTableControlObjType eObjType); + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The count of visible children. + */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The XAccessible interface of the specified child. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. + */ + ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX + diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx new file mode 100755 index 000000000..df3223624 --- /dev/null +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -0,0 +1,391 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControl.cxx,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" +#include "accessibility/extended/AccessibleGridControl.hxx" +#include "accessibility/extended/AccessibleGridControlTable.hxx" +#include "accessibility/extended/AccessibleGridControlHeader.hxx" +#include <svtools/accessibletable.hxx> +#include <comphelper/types.hxx> +#include <toolkit/helper/vclunohelper.hxx> +//#include "svtools/table/tablecontrol.hxx" + +// ============================================================================ + +namespace accessibility +{ + +// ============================================================================ + +using ::rtl::OUString; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::accessibility; +using namespace ::svt; +using namespace ::svt::table; + +// ============================================================================ +class AccessibleGridControl_Impl +{ +public: + /// the XAccessible which created the AccessibleGridControl + WeakReference< XAccessible > m_aCreator; + + /** The data table child. */ + Reference< + ::com::sun::star::accessibility::XAccessible > m_xTable; + AccessibleGridControlTable* m_pTable; + + /** The header bar for rows. */ + Reference< + ::com::sun::star::accessibility::XAccessible > m_xRowHeaderBar; + AccessibleGridControlHeader* m_pRowHeaderBar; + + /** The header bar for columns (first row of the table). */ + Reference< + ::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar; + AccessibleGridControlHeader* m_pColumnHeaderBar; +}; + +// Ctor/Dtor/disposing -------------------------------------------------------- + +DBG_NAME( AccessibleGridControl ) + +AccessibleGridControl::AccessibleGridControl( + const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxCreator, + IAccessibleTable& _rTable ) + : AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL ) +{ + DBG_CTOR( AccessibleTableControl, NULL ); + m_pImpl.reset( new AccessibleGridControl_Impl() ); + m_pImpl->m_aCreator = _rxCreator; +} +// ----------------------------------------------------------------------------- +void AccessibleGridControl::setCreator( const Reference< XAccessible >& _rxCreator ) +{ +#if OSL_DEBUG_LEVEL > 0 + Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator; + DBG_ASSERT( !xCreator.is(), "accessibility/extended/AccessibleGridControl::setCreator: creator already set!" ); +#endif + m_pImpl->m_aCreator = _rxCreator; +} + +// ----------------------------------------------------------------------------- +AccessibleGridControl::~AccessibleGridControl() +{ + DBG_DTOR( AccessibleGridControl, NULL ); +} +// ----------------------------------------------------------------------------- + +void SAL_CALL AccessibleGridControl::disposing() +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + + m_pImpl->m_pTable = NULL; + m_pImpl->m_pColumnHeaderBar = NULL; + m_pImpl->m_pRowHeaderBar = NULL; + m_pImpl->m_aCreator = Reference< XAccessible >(); + + Reference< XAccessible > xTable = m_pImpl->m_xTable; + + Reference< XComponent > xComp( m_pImpl->m_xTable, UNO_QUERY ); + if ( xComp.is() ) + { + xComp->dispose(); + } + + AccessibleGridControlBase::disposing(); +} +// ----------------------------------------------------------------------------- + +// XAccessibleContext --------------------------------------------------------- + +sal_Int32 SAL_CALL AccessibleGridControl::getAccessibleChildCount() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return m_aTable.GetAccessibleControlCount(); +} +// ----------------------------------------------------------------------------- + +Reference< XAccessible > SAL_CALL +AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + + if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) + throw IndexOutOfBoundsException(); + + Reference< XAccessible > xChild; + if (isAlive()) + { + if(nChildIndex == 0 && m_aTable.HasColHeader()) + { + if(!m_pImpl->m_xColumnHeaderBar.is()){ + AccessibleGridControlHeader* pColHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR); + m_pImpl->m_xColumnHeaderBar = pColHeaderBar; + } + xChild = m_pImpl->m_xColumnHeaderBar; + } + else if(m_aTable.HasRowHeader() && (nChildIndex == 1 || nChildIndex == 0)) + { + if(!m_pImpl->m_xRowHeaderBar.is()){ + AccessibleGridControlHeader* pRowHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR); + m_pImpl->m_xRowHeaderBar = pRowHeaderBar; + } + xChild = m_pImpl->m_xRowHeaderBar; + } + else + { + AccessibleGridControlTable* pTable = new AccessibleGridControlTable(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_TABLE); + m_pImpl->m_xTable = pTable; + xChild = m_pImpl->m_xTable; + } + } + + return xChild; +} +// ----------------------------------------------------------------------------- + +sal_Int16 SAL_CALL AccessibleGridControl::getAccessibleRole() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return AccessibleRole::PANEL; +} +// ----------------------------------------------------------------------------- + +// XAccessibleComponent ------------------------------------------------------- + +Reference< XAccessible > SAL_CALL +AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + Reference< XAccessible > xChild; + sal_Int32 nIndex = 0; + if( m_aTable.ConvertPointToControlIndex( nIndex, VCLPoint( rPoint ) ) ) + xChild = m_aTable.CreateAccessibleControl( nIndex ); + else + { + // try whether point is in one of the fixed children + // (table, header bars, corner control) + Point aPoint( VCLPoint( rPoint ) ); + for( nIndex = 0; (nIndex < 3) && !xChild.is(); ++nIndex ) + { + Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); + Reference< XAccessibleComponent > + xCurrChildComp( xCurrChild, uno::UNO_QUERY ); + + if( xCurrChildComp.is() && + VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) ) + xChild = xCurrChild; + } + } + return xChild; +} +// ----------------------------------------------------------------------------- + +void SAL_CALL AccessibleGridControl::grabFocus() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + m_aTable.GrabFocus(); +} +// ----------------------------------------------------------------------------- + +Any SAL_CALL AccessibleGridControl::getAccessibleKeyBinding() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return Any(); +} +// ----------------------------------------------------------------------------- + +// XServiceInfo --------------------------------------------------------------- + +OUString SAL_CALL AccessibleGridControl::getImplementationName() + throw ( uno::RuntimeException ) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControl" ) ); +} +// ----------------------------------------------------------------------------- + +// internal virtual methods --------------------------------------------------- + +Rectangle AccessibleGridControl::implGetBoundingBox() +{ + Window* pParent = m_aTable.GetAccessibleParentWindow(); + DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" ); + return m_aTable.GetWindowExtentsRelative( pParent ); +} +// ----------------------------------------------------------------------------- + +Rectangle AccessibleGridControl::implGetBoundingBoxOnScreen() +{ + return m_aTable.GetWindowExtentsRelative( NULL ); +} +// internal helper methods ---------------------------------------------------- + +Reference< XAccessible > AccessibleGridControl::implGetTable() +{ + if( !m_pImpl->m_xTable.is() ) + { + m_pImpl->m_pTable = createAccessibleTable(); + m_pImpl->m_xTable = m_pImpl->m_pTable; + + } + return m_pImpl->m_xTable; +} +// ----------------------------------------------------------------------------- + +Reference< XAccessible > +AccessibleGridControl::implGetHeaderBar( AccessibleTableControlObjType eObjType ) +{ + Reference< XAccessible > xRet; + Reference< XAccessible >* pxMember = NULL; + + if( eObjType == TCTYPE_ROWHEADERBAR ) + pxMember = &m_pImpl->m_xRowHeaderBar; + else if( eObjType == TCTYPE_COLUMNHEADERBAR ) + pxMember = &m_pImpl->m_xColumnHeaderBar; + + if( pxMember ) + { + if( !pxMember->is() ) + { + AccessibleGridControlHeader* pHeaderBar = new AccessibleGridControlHeader( + (Reference< XAccessible >)m_pImpl->m_aCreator, m_aTable, eObjType ); + + if ( TCTYPE_COLUMNHEADERBAR == eObjType) + m_pImpl->m_pColumnHeaderBar = pHeaderBar; + else + m_pImpl->m_pRowHeaderBar = pHeaderBar; + + *pxMember = pHeaderBar; + } + xRet = *pxMember; + } + return xRet; +} +// ----------------------------------------------------------------------------- +Reference< XAccessible > +AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex ) +{ + Reference< XAccessible > xRet; + switch( nChildIndex ) + { + case TCINDEX_COLUMNHEADERBAR: + xRet = implGetHeaderBar( TCTYPE_COLUMNHEADERBAR ); + break; + case TCINDEX_ROWHEADERBAR: + xRet = implGetHeaderBar( TCTYPE_ROWHEADERBAR ); + break; + case TCINDEX_TABLE: + xRet = implGetTable(); + break; + } + return xRet; +} +// ----------------------------------------------------------------------------- +AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable() +{ + Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator; + DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" ); + return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE ); +} +// ============================================================================ +// = AccessibleGridControlAccess +// ============================================================================ +DBG_NAME( AccessibleGridControlAccess ) +// ----------------------------------------------------------------------------- +AccessibleGridControlAccess::AccessibleGridControlAccess( const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable ) + :m_xParent( _rxParent ) + ,m_rTable( _rTable ) + ,m_pContext( NULL ) +{ + DBG_CTOR( AccessibleGridControlAccess, NULL ); +} + +// ----------------------------------------------------------------------------- +AccessibleGridControlAccess::~AccessibleGridControlAccess() +{ + DBG_DTOR( AccessibleGridControlAccess, NULL ); +} + +// ----------------------------------------------------------------------------- +void AccessibleGridControlAccess::dispose() +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + m_pContext = NULL; + ::comphelper::disposeComponent( m_xContext ); +} + +// ----------------------------------------------------------------------------- +Reference< XAccessibleContext > SAL_CALL AccessibleGridControlAccess::getAccessibleContext() throw ( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + DBG_ASSERT( ( m_pContext && m_xContext.is() ) || ( !m_pContext && !m_xContext.is() ), + "accessibility/extended/AccessibleGridControlAccess::getAccessibleContext: inconsistency!" ); + + // if the context died meanwhile (we're no listener, so it won't tell us explicitily when this happens), + // then reset an re-create. + if ( m_pContext && !m_pContext->isAlive() ) + m_xContext = m_pContext = NULL; + + if ( !m_xContext.is() ) + m_xContext = m_pContext = new AccessibleGridControl( m_xParent, this, m_rTable ); + + return m_xContext; +} + +// ----------------------------------------------------------------------------- +bool AccessibleGridControlAccess::isContextAlive() const +{ + return ( NULL != m_pContext ) && m_pContext->isAlive(); +} + +// ============================================================================ + +} // namespace accessibility diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx new file mode 100755 index 000000000..e3bbe79dd --- /dev/null +++ b/accessibility/source/extended/AccessibleGridControlBase.cxx @@ -0,0 +1,551 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlBase.cxx,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" +#include "accessibility/extended/AccessibleGridControlBase.hxx" +#include <svtools/accessibletable.hxx> +#include <rtl/uuid.h> +// +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <unotools/accessiblerelationsethelper.hxx> + +// ============================================================================ + +using ::rtl::OUString; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Any; + +using namespace ::com::sun::star; +using namespace ::com::sun::star::accessibility; +using namespace ::comphelper; +using namespace ::svt; +using namespace ::svt::table; + + +// ============================================================================ + +namespace accessibility { + +using namespace com::sun::star::accessibility::AccessibleStateType; +// ============================================================================ + +// Ctor/Dtor/disposing -------------------------------------------------------- + +DBG_NAME( AccessibleGridControlBase ) + +AccessibleGridControlBase::AccessibleGridControlBase( + const Reference< XAccessible >& rxParent, + svt::table::IAccessibleTable& rTable, + AccessibleTableControlObjType eObjType ) : + AccessibleGridControlImplHelper( m_aMutex ), + m_xParent( rxParent ), + m_aTable( rTable), + m_eObjType( eObjType ), + m_aName( rTable.GetAccessibleObjectName( eObjType, 0, 0 ) ), + m_aDescription( rTable.GetAccessibleObjectDescription( eObjType ) ), + m_aClientId(0) +{ + DBG_CTOR( AccessibleGridControlBase, NULL ); +} + +AccessibleGridControlBase::~AccessibleGridControlBase() +{ + DBG_DTOR( AccessibleGridControlBase, NULL ); + + if( isAlive() ) + { + // increment ref count to prevent double call of Dtor + osl_incrementInterlockedCount( &m_refCount ); + dispose(); + } +} + +void SAL_CALL AccessibleGridControlBase::disposing() +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + m_xParent = NULL; +} + +// XAccessibleContext --------------------------------------------------------- + +Reference< XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return m_xParent; +} + +sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + // -1 for child not found/no parent (according to specification) + sal_Int32 nRet = -1; + + Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY ); + + // iterate over parent's children and search for this object + if( m_xParent.is() ) + { + Reference< XAccessibleContext > + xParentContext( m_xParent->getAccessibleContext() ); + if( xParentContext.is() ) + { + Reference< uno::XInterface > xChild; + + sal_Int32 nChildCount = xParentContext->getAccessibleChildCount(); + for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild ) + { + xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) ); + + if ( xMeMyselfAndI.get() == xChild.get() ) + { + nRet = nChild; + break; + } + } + } + } + return nRet; +} + +OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return m_aDescription; +} + +OUString SAL_CALL AccessibleGridControlBase::getAccessibleName() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return m_aName; +} + +Reference< XAccessibleRelationSet > SAL_CALL +AccessibleGridControlBase::getAccessibleRelationSet() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + // GridControl does not have relations. + return new utl::AccessibleRelationSetHelper; +} + +Reference< XAccessibleStateSet > SAL_CALL +AccessibleGridControlBase::getAccessibleStateSet() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + // don't check whether alive -> StateSet may contain DEFUNC + return implCreateStateSetHelper(); +} + +lang::Locale SAL_CALL AccessibleGridControlBase::getLocale() + throw ( IllegalAccessibleComponentStateException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + if( m_xParent.is() ) + { + Reference< XAccessibleContext > + xParentContext( m_xParent->getAccessibleContext() ); + if( xParentContext.is() ) + return xParentContext->getLocale(); + } + throw IllegalAccessibleComponentStateException(); +} + +// XAccessibleComponent ------------------------------------------------------- + +sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& rPoint ) + throw ( uno::RuntimeException ) +{ + return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); +} + +awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds() + throw ( uno::RuntimeException ) +{ + return AWTRectangle( getBoundingBox() ); +} + +awt::Point SAL_CALL AccessibleGridControlBase::getLocation() + throw ( uno::RuntimeException ) +{ + return AWTPoint( getBoundingBox().TopLeft() ); +} + +awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen() + throw ( uno::RuntimeException ) +{ + return AWTPoint( getBoundingBoxOnScreen().TopLeft() ); +} + +awt::Size SAL_CALL AccessibleGridControlBase::getSize() + throw ( uno::RuntimeException ) +{ + return AWTSize( getBoundingBox().GetSize() ); +} + +sal_Bool SAL_CALL AccessibleGridControlBase::isShowing() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return implIsShowing(); +} + +sal_Bool SAL_CALL AccessibleGridControlBase::isVisible() + throw ( uno::RuntimeException ) +{ + Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet(); + return xStateSet.is() ? + xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False; +} + +sal_Bool SAL_CALL AccessibleGridControlBase::isFocusTraversable() + throw ( uno::RuntimeException ) +{ + Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet(); + return xStateSet.is() ? + xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False; +} +// XAccessibleEventBroadcaster ------------------------------------------------ + +void SAL_CALL AccessibleGridControlBase::addEventListener( + const Reference< XAccessibleEventListener>& _rxListener ) + throw ( uno::RuntimeException ) +{ + if ( _rxListener.is() ) + { + ::osl::MutexGuard aGuard( getOslMutex() ); + if ( !getClientId( ) ) + setClientId( AccessibleEventNotifier::registerClient( ) ); + + AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener ); + } +} + +void SAL_CALL AccessibleGridControlBase::removeEventListener( + const Reference< XAccessibleEventListener>& _rxListener ) + throw ( uno::RuntimeException ) +{ + if( _rxListener.is() && getClientId( ) ) + { + ::osl::MutexGuard aGuard( getOslMutex() ); + sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener ); + 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 + + AccessibleEventNotifier::TClientId nId( getClientId( ) ); + setClientId( 0 ); + AccessibleEventNotifier::revokeClient( nId ); + } + } +} + +// XTypeProvider -------------------------------------------------------------- + +Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslGlobalMutex() ); + static Sequence< sal_Int8 > aId; + implCreateUuid( aId ); + return aId; +} + +// XServiceInfo --------------------------------------------------------------- + +sal_Bool SAL_CALL AccessibleGridControlBase::supportsService( + const OUString& rServiceName ) + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + + Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); + const OUString* pArrBegin = aSupportedServices.getConstArray(); + const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength(); + const OUString* pString = pArrBegin; + + for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString ) + ; + + return pString != pArrEnd; +} + +Sequence< OUString > SAL_CALL AccessibleGridControlBase::getSupportedServiceNames() + throw ( uno::RuntimeException ) +{ + const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) ); + return Sequence< OUString >( &aServiceName, 1 ); +} +// internal virtual methods --------------------------------------------------- + +sal_Bool AccessibleGridControlBase::implIsShowing() +{ + sal_Bool bShowing = sal_False; + if( m_xParent.is() ) + { + Reference< XAccessibleComponent > + xParentComp( m_xParent->getAccessibleContext(), uno::UNO_QUERY ); + if( xParentComp.is() ) + bShowing = implGetBoundingBox().IsOver( + VCLRectangle( xParentComp->getBounds() ) ); + } + return bShowing; +} + +::utl::AccessibleStateSetHelper* AccessibleGridControlBase::implCreateStateSetHelper() +{ + ::utl::AccessibleStateSetHelper* + pStateSetHelper = new ::utl::AccessibleStateSetHelper; + + if( isAlive() ) + { + // SHOWING done with m_xParent + if( implIsShowing() ) + pStateSetHelper->AddState( AccessibleStateType::SHOWING ); + // GridControl fills StateSet with states depending on object type + m_aTable.FillAccessibleStateSet( *pStateSetHelper, getType() ); + } + else + pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); + + return pStateSetHelper; +} + +// internal helper methods ---------------------------------------------------- + +sal_Bool AccessibleGridControlBase::isAlive() const +{ + return !rBHelper.bDisposed && !rBHelper.bInDispose && &m_aTable; +} + +void AccessibleGridControlBase::ensureIsAlive() const + throw ( lang::DisposedException ) +{ + if( !isAlive() ) + throw lang::DisposedException(); +} + +Rectangle AccessibleGridControlBase::getBoundingBox() + throw ( lang::DisposedException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + Rectangle aRect = implGetBoundingBox(); + if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) + { + DBG_ERRORFILE( "rectangle doesn't exist" ); + } + return aRect; +} +// +Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen() + throw ( lang::DisposedException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + Rectangle aRect = implGetBoundingBoxOnScreen(); + if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() ) + { + DBG_ERRORFILE( "rectangle doesn't exist" ); + } + return aRect; +} + +void AccessibleGridControlBase::commitEvent( + sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) +{ + ::osl::ClearableMutexGuard aGuard( getOslMutex() ); + if ( !getClientId( ) ) + // if we don't have a client id for the notifier, then we don't have listeners, then + // we don't need to notify anything + return; + + // build an event object + AccessibleEventObject aEvent; + aEvent.Source = *this; + aEvent.EventId = _nEventId; + aEvent.OldValue = _rOldValue; + aEvent.NewValue = _rNewValue; + + // let the notifier handle this event + + AccessibleEventNotifier::addEvent( getClientId( ), aEvent ); +} +// ----------------------------------------------------------------------------- + +void AccessibleGridControlBase::implCreateUuid( Sequence< sal_Int8 >& rId ) +{ + if( !rId.hasElements() ) + { + rId.realloc( 16 ); + rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True ); + } +} +// ----------------------------------------------------------------------------- +sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + sal_Int16 nRole = AccessibleRole::UNKNOWN; + switch ( m_eObjType ) + { + case TCTYPE_ROWHEADERCELL: + nRole = AccessibleRole::ROW_HEADER; + break; + case TCTYPE_COLUMNHEADERCELL: + nRole = AccessibleRole::COLUMN_HEADER; + break; + case TCTYPE_COLUMNHEADERBAR: + case TCTYPE_ROWHEADERBAR: + case TCTYPE_TABLE: + nRole = AccessibleRole::TABLE; + break; + case TCTYPE_TABLECELL: + nRole = AccessibleRole::TABLE_CELL; + break; + case TCTYPE_GRIDCONTROL: + nRole = AccessibleRole::PANEL; + break; + } + return nRole; +} +// ----------------------------------------------------------------------------- +Any SAL_CALL AccessibleGridControlBase::getAccessibleKeyBinding() + throw ( uno::RuntimeException ) +{ + return Any(); +} +// ----------------------------------------------------------------------------- +Reference<XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& ) + throw ( uno::RuntimeException ) +{ + return NULL; +} +//// ----------------------------------------------------------------------------- +sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::sun::star::uno::RuntimeException) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + sal_Int32 nColor = 0; + Window* pInst = m_aTable.GetWindowInstance(); + if ( pInst ) + { + if ( pInst->IsControlForeground() ) + nColor = pInst->GetControlForeground().GetColor(); + else + { + Font aFont; + if ( pInst->IsControlFont() ) + aFont = pInst->GetControlFont(); + else + aFont = pInst->GetFont(); + nColor = aFont.GetColor().GetColor(); + } + } + + return nColor; +} +// ----------------------------------------------------------------------------- +sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) throw (::com::sun::star::uno::RuntimeException) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + sal_Int32 nColor = 0; + Window* pInst = m_aTable.GetWindowInstance(); + if ( pInst ) + { + if ( pInst->IsControlBackground() ) + nColor = pInst->GetControlBackground().GetColor(); + else + nColor = pInst->GetBackground().GetColor().GetColor(); + } + + return nColor; +} + +//// ============================================================================ +GridControlAccessibleElement::GridControlAccessibleElement( const Reference< XAccessible >& rxParent, + IAccessibleTable& rTable, + AccessibleTableControlObjType eObjType ) + :AccessibleGridControlBase( rxParent, rTable, eObjType ) +{ + DBG_CTOR( GridControlAccessibleElement, NULL ); +} + +// XInterface ----------------------------------------------------------------- +IMPLEMENT_FORWARD_XINTERFACE2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base) + +// XTypeProvider -------------------------------------------------------------- +IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base ) + +// XAccessible ---------------------------------------------------------------- + +Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return this; +} +// ---------------------------------------------------------------------------- +GridControlAccessibleElement::~GridControlAccessibleElement( ) +{ + DBG_DTOR( GridControlAccessibleElement, NULL ); +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx new file mode 100755 index 000000000..c641e5194 --- /dev/null +++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx @@ -0,0 +1,321 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlHeader.cxx,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" + + +#include "accessibility/extended/AccessibleGridControlHeader.hxx" +#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" +#include "accessibility/extended/AccessibleGridControlTableCell.hxx" +#include <svtools/accessibletable.hxx> + + +// ============================================================================ + +using ::rtl::OUString; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Any; + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::accessibility; +using namespace ::svt; +using namespace ::svt::table; + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +// Ctor/Dtor/disposing -------------------------------------------------------- + +DBG_NAME( AccessibleGridControlHeader ) + +AccessibleGridControlHeader::AccessibleGridControlHeader( + const Reference< XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType): + AccessibleGridControlTableBase( rxParent, rTable, eObjType ) +{ + DBG_CTOR( AccessibleGridControlHeaderBar, NULL ); + + DBG_ASSERT( isRowBar() || isColumnBar(), + "accessibility/extended/AccessibleGridControlHeaderBar - invalid object type" ); +} + +AccessibleGridControlHeader::~AccessibleGridControlHeader() +{ + DBG_DTOR( AccessibleGridControlHeader, NULL ); +} + +// XAccessibleContext --------------------------------------------------------- + +Reference< XAccessible > SAL_CALL +AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + + if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount()) + throw IndexOutOfBoundsException(); + ensureIsAlive(); + Reference< XAccessible > xChild; + if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR) + { + AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL); + xChild = pColHeaderCell; + } + else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR) + { + AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL); + xChild = pRowHeaderCell; + } + return xChild; +} + +sal_Int32 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader()) + return 1; + else + return 0; +} + +// XAccessibleComponent ------------------------------------------------------- + +Reference< XAccessible > SAL_CALL +AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint ) + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + sal_Int32 nRow = 0; + sal_Int32 nColumnPos = 0; + sal_Bool bConverted = isRowBar() ? + m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) : + m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ); + + return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >(); +} + +void SAL_CALL AccessibleGridControlHeader::grabFocus() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + // focus on header not supported +} + +Any SAL_CALL AccessibleGridControlHeader::getAccessibleKeyBinding() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return Any(); // no special key bindings for header +} + +// XAccessibleTable ----------------------------------------------------------- + +OUString SAL_CALL AccessibleGridControlHeader::getAccessibleRowDescription( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidRow( nRow ); + return OUString(); // no headers in headers +} + +OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidColumn( nColumn ); + return OUString(); // no headers in headers +} + +Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleRowHeaders() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return NULL; // no headers in headers +} + +Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleColumnHeaders() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return NULL; // no headers in headers +} + +Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + Sequence< sal_Int32 > aSelSeq; + // row of column header bar not selectable + if( isRowBar() ) + implGetSelectedRows( aSelSeq ); + return aSelSeq; +} +//columns aren't selectable +Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns() + throw ( uno::RuntimeException ) +{ + return NULL; +} +//To Do - not yet implemented +sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidRow( nRow ); + //return isRowBar() ? implIsRowSelected( nRow ) : sal_False; + return sal_False; +} +//columns aren't selectable +sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + (void)nColumn; + return sal_False; +} + +Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return implGetChild( nRow, implToVCLColumnPos( nColumn ) ); +} +// TO DO - not implemented yet +sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return FALSE; + // return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn ); +} + +// XServiceInfo --------------------------------------------------------------- + +OUString SAL_CALL AccessibleGridControlHeader::getImplementationName() + throw ( uno::RuntimeException ) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeader" ) ); +} + +Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslGlobalMutex() ); + static Sequence< sal_Int8 > aId; + implCreateUuid( aId ); + return aId; +} + +// internal virtual methods --------------------------------------------------- + +Rectangle AccessibleGridControlHeader::implGetBoundingBox() +{ + return m_aTable.calcHeaderRect(isColumnBar()); +} + +Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen() +{ + return m_aTable.calcHeaderRect(isColumnBar()); +} + +sal_Int32 AccessibleGridControlHeader::implGetRowCount() const +{ + return 1; +} + +sal_Int32 AccessibleGridControlHeader::implGetColumnCount() const +{ + return 1; +} + +// internal helper methods ---------------------------------------------------- + +Reference< XAccessible > AccessibleGridControlHeader::implGetChild( + sal_Int32 nRow, sal_uInt32 nColumnPos ) +{ + Reference< XAccessible > xChild; + if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR) + { + AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL); + xChild = pColHeaderCell; + } + else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR) + { + AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL); + xChild = pRowHeaderCell; + } + return xChild; +} + +void AccessibleGridControlHeader::ensureIsValidHeaderIndex( sal_Int32 nIndex ) + throw ( lang::IndexOutOfBoundsException ) +{ + if( isRowBar() ) + ensureIsValidRow( nIndex ); + else + ensureIsValidColumn( nIndex ); +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx new file mode 100755 index 000000000..ef2b2aca1 --- /dev/null +++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlHeaderCell.cxx,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" + +#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" +#include <svtools/accessibletable.hxx> +#include "accessibility/extended/AccessibleGridControl.hxx" + +namespace accessibility +{ + using namespace ::com::sun::star::accessibility; + using namespace ::com::sun::star::lang; + using namespace ::com::sun::star::uno; + using namespace ::svt; + using namespace ::svt::table; + +AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId, + const Reference< XAccessible >& rxParent, + IAccessibleTable& rTable, + AccessibleTableControlObjType eObjType) +: AccessibleGridControlCell( rxParent, rTable, _nColumnRowId, 0, eObjType) +, m_nColumnRowId(_nColumnRowId) +{ +} +/** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. +*/ +::utl::AccessibleStateSetHelper* AccessibleGridControlHeaderCell::implCreateStateSetHelper() +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ::utl::AccessibleStateSetHelper* + pStateSetHelper = new ::utl::AccessibleStateSetHelper; + + if( isAlive() ) + { + // SHOWING done with mxParent + if( implIsShowing() ) + pStateSetHelper->AddState( AccessibleStateType::SHOWING ); + + TCSolarGuard aSolarGuard; + pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); + pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); + pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); + pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); + + if ( m_aTable.IsRowSelected(m_nColumnRowId) ) + pStateSetHelper->AddState( AccessibleStateType::SELECTED ); + } + else + pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); + + return pStateSetHelper; +} +// ----------------------------------------------------------------------------- +/** @return + The count of visible children. +*/ +sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChildCount() + throw ( RuntimeException ) +{ + return 0; +} +// ----------------------------------------------------------------------------- + +/** @return + The XAccessible interface of the specified child. +*/ +Reference<XAccessible > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChild( sal_Int32 ) + throw ( IndexOutOfBoundsException,RuntimeException ) +{ + throw IndexOutOfBoundsException(); +} +// XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlHeaderCell::queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ) + { + Any aRet = AccessibleGridControlCell::queryInterface(rType); + return aRet; + } + + /** Aquires the object (calls acquire() on base class). */ + void SAL_CALL AccessibleGridControlHeaderCell::acquire() throw () + { + AccessibleGridControlCell::acquire(); + } + + /** Releases the object (calls release() on base class). */ + void SAL_CALL AccessibleGridControlHeaderCell::release() throw () + { + AccessibleGridControlCell::release(); + } + /** @return The XAccessibleContext interface of this object. */ + Reference< com::sun::star::accessibility::XAccessibleContext > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleContext() throw ( RuntimeException ) + { + ensureIsAlive(); + return this; + } + +// ----------------------------------------------------------------------------- + +/** Grabs the focus to the column header. */ +void SAL_CALL AccessibleGridControlHeaderCell::grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ) +{ +} +// ----------------------------------------------------------------------------- +/** @return + The name of this class. +*/ +::rtl::OUString SAL_CALL AccessibleGridControlHeaderCell::getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeaderCell" ) ); +} +// ----------------------------------------------------------------------------- +Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox() +{ + return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle +} +// ----------------------------------------------------------------------------- + +Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen() +{ + return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle +} +// ----------------------------------------------------------------------------- +sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent() + throw ( RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + sal_Int32 nIndex = m_nColumnRowId; + return nIndex; +} +// ----------------------------------------------------------------------------- +} // namespace accessibility +// ----------------------------------------------------------------------------- + + diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx new file mode 100755 index 000000000..f0728ea7b --- /dev/null +++ b/accessibility/source/extended/AccessibleGridControlTable.cxx @@ -0,0 +1,416 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlTable.cxx,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" + + +#include "accessibility/extended/AccessibleGridControlTable.hxx" +#include "accessibility/extended/AccessibleGridControlTableCell.hxx" +#include <svtools/accessibletable.hxx> + +// ============================================================================ + +using ::rtl::OUString; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Any; + +using namespace ::com::sun::star; +using namespace ::com::sun::star::accessibility; +using namespace ::svt; +using namespace ::svt::table; +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +// Ctor/Dtor/disposing -------------------------------------------------------- + +DBG_NAME( AccessibleGridControlTable ) + +AccessibleGridControlTable::AccessibleGridControlTable( + const Reference< XAccessible >& rxParent, + IAccessibleTable& rTable, + AccessibleTableControlObjType _eType) : + AccessibleGridControlTableBase( rxParent, rTable, _eType ) +{ + DBG_CTOR( AccessibleGridControlTable, NULL ); +} + +AccessibleGridControlTable::~AccessibleGridControlTable() +{ + DBG_DTOR( AccessibleGridControlTable, NULL ); +} + +// XAccessibleContext --------------------------------------------------------- + +Reference< XAccessible > SAL_CALL +AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidIndex( nChildIndex ); + return new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL); +} + +sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + if(m_aTable.HasRowHeader() && m_aTable.HasColHeader()) + return 0; + else if((!m_aTable.HasRowHeader() && m_aTable.HasColHeader()) || (m_aTable.HasRowHeader() && !m_aTable.HasColHeader()) ) + return 1; + else + return 2; + +} + +// XAccessibleComponent ------------------------------------------------------- + +Reference< XAccessible > SAL_CALL +AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint ) + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + Reference< XAccessible > xChild; + sal_Int32 nRow = 0; + sal_Int32 nColumnPos = 0; + if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) ) + xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL); + + return xChild; +} + +void SAL_CALL AccessibleGridControlTable::grabFocus() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + m_aTable.GrabFocus(); +} + +Any SAL_CALL AccessibleGridControlTable::getAccessibleKeyBinding() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return Any(); // no special key bindings for data table +} + +// XAccessibleTable ----------------------------------------------------------- + +OUString SAL_CALL AccessibleGridControlTable::getAccessibleRowDescription( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidRow( nRow ); + return m_aTable.GetRowDescription( nRow ); +} + +OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidColumn( nColumn ); + return m_aTable.GetColumnDescription( (sal_uInt16)nColumn ); +} + +Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleRowHeaders() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + if(m_aTable.HasColHeader()) + return implGetHeaderBar( 1 ); + else + return implGetHeaderBar( 0 ); +} + +Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleColumnHeaders() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return implGetHeaderBar( 0 ); +} + +Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleRows() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + Sequence< sal_Int32 > aSelSeq; + implGetSelectedRows( aSelSeq ); + return aSelSeq; +} + +//columns aren't selectable +Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns() + throw ( uno::RuntimeException ) +{ +// TCSolarGuard aSolarGuard; +// ::osl::MutexGuard aGuard( getOslMutex() ); +// ensureIsAlive(); +// +// Sequence< sal_Int32 > aSelSeq; +// implGetSelectedColumns( aSelSeq ); +// return aSelSeq; + return NULL; +} + +//To Do: not implemented yet +sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + //TCSolarGuard aSolarGuard; + //::osl::MutexGuard aGuard( getOslMutex() ); + //ensureIsAlive(); + //ensureIsValidRow( nRow ); + //return implIsRowSelected( nRow ); + (void) nRow; + return sal_False; +} + +//columns aren't selectable +sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleColumnSelected( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + /*TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidColumn( nColumn ); + return implIsColumnSelected( nColumn );*/ + (void) nColumn; + return sal_False; +} + +Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellAt( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL); +} + +sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + /*TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );*/ + (void) nRow; + (void) nColumn; + return sal_False; +} +//To Do: not implemented yet +void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidIndex( nChildIndex ); + //if( isRowBar() ) + // implSelectRow( nChildIndex, sal_True ); + //else + // implSelectColumn( implToVCLColumnPos( nChildIndex ), sal_True ); +} +//To Do - not implemented yet +sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + // using interface methods - no mutex + /*return isRowBar() ? + isAccessibleRowSelected( nChildIndex ) : + isAccessibleColumnSelected( nChildIndex );*/ + (void)nChildIndex; + return FALSE; +} +//To Do - not implemented yet +void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); +} +//To Do - not implemented yet +void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); +} +//To Do - not implemented yet +sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + // return isRowBar() ? implGetSelectedRowCount() : implGetSelectedColumnCount(); + return 0; +} +//To Do - not implemented yet +Reference< XAccessible > SAL_CALL +AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + (void)nSelectedChildIndex; + // method may throw lang::IndexOutOfBoundsException + //sal_Int32 nIndex = implGetChildIndexFromSelectedIndex( nSelectedChildIndex ); + //return implGetChild( nIndex, implToVCLColumnPos( nIndex ) ); + return NULL; +} +//To Do - not implemented yet +void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + (void)nSelectedChildIndex; + // method may throw lang::IndexOutOfBoundsException + //if ( isAccessibleChildSelected(nSelectedChildIndex) ) + //{ + // if( isRowBar() ) + // implSelectRow( nSelectedChildIndex, sal_False ); + // else + // implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), sal_False ); + //} +} +// XInterface ----------------------------------------------------------------- + +Any SAL_CALL AccessibleGridControlTable::queryInterface( const uno::Type& rType ) + throw ( uno::RuntimeException ) +{ + Any aAny( AccessibleGridControlTableBase::queryInterface( rType ) ); + return aAny.hasValue() ? + aAny : AccessibleGridControlTableImplHelper1::queryInterface( rType ); +} + +void SAL_CALL AccessibleGridControlTable::acquire() throw () +{ + AccessibleGridControlTableBase::acquire(); +} + +void SAL_CALL AccessibleGridControlTable::release() throw () +{ + AccessibleGridControlTableBase::release(); +} +// XServiceInfo --------------------------------------------------------------- + +OUString SAL_CALL AccessibleGridControlTable::getImplementationName() + throw ( uno::RuntimeException ) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTable" ) ); +} + +// internal virtual methods --------------------------------------------------- + +Rectangle AccessibleGridControlTable::implGetBoundingBox() +{ + return m_aTable.calcTableRect(); +} + +Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen() +{ + return m_aTable.calcTableRect(); +} +// internal helper methods ---------------------------------------------------- + +Reference< XAccessible > AccessibleGridControlTable::implGetChild( + sal_Int32 nRow, sal_uInt16 nColumnPos ) +{ + (void)nRow; + (void)nColumnPos; + return NULL; +} +//To Do - not implemented yet +//sal_Int32 AccessibleGridControlTable::implGetChildIndexFromSelectedIndex( +// sal_Int32 nSelectedChildIndex ) +// throw ( lang::IndexOutOfBoundsException ) +//{ +// (void)nSelectedChildIndex; +// return 0; +//} +Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar( + sal_Int32 nChildIndex ) + throw ( uno::RuntimeException ) +{ + Reference< XAccessible > xRet; + Reference< XAccessibleContext > xContext( m_xParent, uno::UNO_QUERY ); + if( xContext.is() ) + { + try + { + xRet = xContext->getAccessibleChild( nChildIndex ); + } + catch( lang::IndexOutOfBoundsException& ) + { + DBG_ERROR( "implGetHeaderBar - wrong child index" ); + } + // RuntimeException goes to caller + } + return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY ); +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx new file mode 100755 index 000000000..0c2c7a4a4 --- /dev/null +++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx @@ -0,0 +1,318 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2009 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlTableBase.cxx,v $ + * $Revision: 1.3 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" + + +#include "accessibility/extended/AccessibleGridControlTableBase.hxx" +#include <svtools/accessibletable.hxx> +#include <tools/multisel.hxx> +#include <comphelper/sequence.hxx> + +// ============================================================================ + +using ::rtl::OUString; + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Any; + +using namespace ::com::sun::star; +using namespace ::com::sun::star::accessibility; +using namespace ::svt; +using namespace ::svt::table; + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +// Ctor/Dtor/disposing -------------------------------------------------------- + +DBG_NAME( AccessibleGridControlTableBase ) + +AccessibleGridControlTableBase::AccessibleGridControlTableBase( + const Reference< XAccessible >& rxParent, + IAccessibleTable& rTable, + AccessibleTableControlObjType eObjType ) : + GridControlAccessibleElement( rxParent, rTable, eObjType ) +{ + DBG_CTOR( AccessibleGridControlTableBase, NULL ); +} + +AccessibleGridControlTableBase::~AccessibleGridControlTableBase() +{ + DBG_DTOR( AccessibleGridControlTableBase, NULL ); +} + +// XAccessibleContext --------------------------------------------------------- + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleChildCount() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + sal_Int32 nChildren = 0; + if(m_eObjType == TCTYPE_ROWHEADERBAR) + nChildren = m_aTable.GetRowCount(); + else if(m_eObjType == TCTYPE_TABLE) + nChildren = m_aTable.GetRowCount()*m_aTable.GetColumnCount(); + else if(m_eObjType == TCTYPE_COLUMNHEADERBAR) + nChildren = m_aTable.GetColumnCount(); + return nChildren; +} + +sal_Int16 SAL_CALL AccessibleGridControlTableBase::getAccessibleRole() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return AccessibleRole::TABLE; +} + +// XAccessibleTable ----------------------------------------------------------- + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowCount() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return m_aTable.GetRowCount(); +} + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnCount() + throw ( uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + return m_aTable.GetColumnCount(); +} + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowExtentAt( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return 1; // merged cells not supported +} + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnExtentAt( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return 1; // merged cells not supported +} + +Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleCaption() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return NULL; // not supported +} + +Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleSummary() + throw ( uno::RuntimeException ) +{ + ensureIsAlive(); + return NULL; // not supported +} + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleIndex( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return implGetChildIndex( nRow, nColumn ); +} + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRow( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidIndex( nChildIndex ); + return implGetRow( nChildIndex ); +} + +sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumn( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + ensureIsValidIndex( nChildIndex ); + return implGetColumn( nChildIndex ); +} + +// XInterface ----------------------------------------------------------------- + +Any SAL_CALL AccessibleGridControlTableBase::queryInterface( const uno::Type& rType ) + throw ( uno::RuntimeException ) +{ + Any aAny( GridControlAccessibleElement::queryInterface( rType ) ); + return aAny.hasValue() ? + aAny : AccessibleGridControlTableImplHelper::queryInterface( rType ); +} + +void SAL_CALL AccessibleGridControlTableBase::acquire() throw () +{ + GridControlAccessibleElement::acquire(); +} + +void SAL_CALL AccessibleGridControlTableBase::release() throw () +{ + GridControlAccessibleElement::release(); +} + +// XTypeProvider -------------------------------------------------------------- + +Sequence< uno::Type > SAL_CALL AccessibleGridControlTableBase::getTypes() + throw ( uno::RuntimeException ) +{ + return ::comphelper::concatSequences( + GridControlAccessibleElement::getTypes(), + AccessibleGridControlTableImplHelper::getTypes() ); +} + +Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationId() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( getOslGlobalMutex() ); + static Sequence< sal_Int8 > aId; + implCreateUuid( aId ); + return aId; +} + +// internal helper methods ---------------------------------------------------- + +sal_uInt16 AccessibleGridControlTableBase::implToVCLColumnPos( sal_Int32 nColumn ) const +{ + sal_uInt16 nVCLPos = 0; + if( (0 <= nColumn) && (nColumn < m_aTable.GetColumnCount()) ) + { + // regard "handle column" + if( m_aTable.HasRowHeader() ) + ++nColumn; + nVCLPos = static_cast< sal_uInt16 >( nColumn ); + } + return nVCLPos; +} + +sal_Int32 AccessibleGridControlTableBase::implGetChildCount() const +{ + return m_aTable.GetRowCount()*m_aTable.GetColumnCount(); +} + +sal_Int32 AccessibleGridControlTableBase::implGetRow( sal_Int32 nChildIndex ) const +{ + sal_Int32 nColumns = m_aTable.GetColumnCount(); + return nColumns ? (nChildIndex / nColumns) : 0; +} + +sal_Int32 AccessibleGridControlTableBase::implGetColumn( sal_Int32 nChildIndex ) const +{ + sal_Int32 nColumns = m_aTable.GetColumnCount(); + return nColumns ? (nChildIndex % nColumns) : 0; +} + +sal_Int32 AccessibleGridControlTableBase::implGetChildIndex( + sal_Int32 nRow, sal_Int32 nColumn ) const +{ + return nRow * m_aTable.GetColumnCount() + nColumn; +} + +sal_Bool AccessibleGridControlTableBase::implIsRowSelected( sal_Int32 nRow ) const +{ + return m_aTable.IsRowSelected( nRow ); +} + +sal_Int32 AccessibleGridControlTableBase::implGetSelectedRowCount() const +{ + return m_aTable.GetSelectedRowCount(); +} + +void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq ) +{ + rSeq = comphelper::containerToSequence(m_aTable.GetSelectedRows()); +} + +void AccessibleGridControlTableBase::ensureIsValidRow( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException ) +{ + if( nRow >= m_aTable.GetRowCount() ) + throw lang::IndexOutOfBoundsException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this ); +} + +void AccessibleGridControlTableBase::ensureIsValidColumn( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException ) +{ + if( nColumn >= m_aTable.GetColumnCount() ) + throw lang::IndexOutOfBoundsException( + OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this ); +} + +void AccessibleGridControlTableBase::ensureIsValidAddress( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException ) +{ + ensureIsValidRow( nRow ); + ensureIsValidColumn( nColumn ); +} + +void AccessibleGridControlTableBase::ensureIsValidIndex( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException ) +{ + if( nChildIndex >= implGetChildCount() ) + throw lang::IndexOutOfBoundsException( + OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this ); +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx new file mode 100755 index 000000000..d4489b0e1 --- /dev/null +++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx @@ -0,0 +1,379 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleGridControlTableCell.cxx,v $ + * $Revision: 1.4 $ + * + * 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" + +#include "accessibility/extended/AccessibleGridControlTableCell.hxx" +#include <svtools/accessibletable.hxx> +#include "accessibility/extended/AccessibleGridControl.hxx" +#include <tools/gen.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> + +namespace accessibility +{ + namespace + { + void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException) + { + if ( _nIndex >= _sText.getLength() ) + throw ::com::sun::star::lang::IndexOutOfBoundsException(); + } + + sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) + { + return _nRow * _nColumnCount + _nColumn; + } + } + using namespace ::com::sun::star::lang; + using namespace utl; + using namespace comphelper; + using ::rtl::OUString; + using ::accessibility::AccessibleGridControl; + using namespace ::com::sun::star::uno; + using ::com::sun::star::accessibility::XAccessible; + using namespace ::com::sun::star::accessibility; + using namespace ::svt; + using namespace ::svt::table; + + + // ============================================================================= + // = AccessibleGridControlCell + // ============================================================================= + //DBG_NAME( svt_AccessibleGridControlCell ) + // ----------------------------------------------------------------------------- + AccessibleGridControlCell::AccessibleGridControlCell( + const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable, + sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleTableControlObjType _eType ) + :AccessibleGridControlBase( _rxParent, _rTable, _eType ) + ,m_nRowPos( _nRowPos ) + ,m_nColPos( _nColPos ) + { + DBG_CTOR( svt_AccessibleGridControlCell, NULL ); + // set accessible name here, because for that we need the position of the cell + // and so the base class isn't capable of doing this + ::rtl::OUString aAccName; + if(_eType == TCTYPE_TABLECELL) + aAccName = _rTable.GetAccessibleObjectName( TCTYPE_TABLECELL, _nRowPos, _nColPos ); + else if(_eType == TCTYPE_ROWHEADERCELL) + aAccName = _rTable.GetAccessibleObjectName( TCTYPE_ROWHEADERCELL, _nRowPos, 0 ); + else if(_eType == TCTYPE_COLUMNHEADERCELL) + aAccName = _rTable.GetAccessibleObjectName( TCTYPE_COLUMNHEADERCELL, 0, _nRowPos ); + implSetName( aAccName ); + } + + // ----------------------------------------------------------------------------- + AccessibleGridControlCell::~AccessibleGridControlCell() + { + } + + // ----------------------------------------------------------------------------- + void SAL_CALL AccessibleGridControlCell::grabFocus() throw ( RuntimeException ) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + m_aTable.GoToCell( m_nColPos, m_nRowPos ); + } + //// ----------------------------------------------------------------------------- + // implementation of a table cell + ::rtl::OUString AccessibleGridControlTableCell::implGetText() + { + ensureIsAlive(); + //return mpTable->GetAccessibleCellText( getRowPos(), static_cast< USHORT >( getColumnPos() ) ); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "test" )); + } + + ::com::sun::star::lang::Locale AccessibleGridControlTableCell::implGetLocale() + { + ensureIsAlive(); + return m_aTable.GetAccessible()->getAccessibleContext()->getLocale(); + } + + void AccessibleGridControlTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) + { + nStartIndex = 0; + nEndIndex = 0; + } + + AccessibleGridControlTableCell::AccessibleGridControlTableCell(const Reference<XAccessible >& _rxParent, + IAccessibleTable& _rTable, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + AccessibleTableControlObjType eObjType) + :AccessibleGridControlCell( _rxParent, _rTable, _nRowPos, _nColPos, eObjType ) + { + } + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlTableCell::queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ) + { + Any aRet = AccessibleGridControlCell::queryInterface(rType); + if ( !aRet.hasValue() ) + aRet = AccessibleTextHelper_BASE::queryInterface(rType); + return aRet; + } + + /** Aquires the object (calls acquire() on base class). */ + void SAL_CALL AccessibleGridControlTableCell::acquire() throw () + { + AccessibleGridControlCell::acquire(); + } + + /** Releases the object (calls release() on base class). */ + void SAL_CALL AccessibleGridControlTableCell::release() throw () + { + AccessibleGridControlCell::release(); + } + + ::com::sun::star::awt::Rectangle SAL_CALL AccessibleGridControlTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + + ensureIsAlive(); + if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); + + ::com::sun::star::awt::Rectangle aRect; + + if ( &m_aTable ) + { + aRect = AWTRectangle( m_aTable.GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) ); + } + + return aRect; + } + + sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + return m_aTable.GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) ); + } + + /** @return + The name of this class. + */ + ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTableCell" ) ); + } + + /** @return The count of visible children. */ + sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ) + { + return 0; + } + + /** @return The XAccessible interface of the specified child. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + AccessibleGridControlTableCell::getAccessibleChild( sal_Int32 ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ) + { + throw ::com::sun::star::lang::IndexOutOfBoundsException(); + } + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. + */ + ::utl::AccessibleStateSetHelper* AccessibleGridControlTableCell::implCreateStateSetHelper() + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + + ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper; + + if( isAlive() ) + { + // SHOWING done with mxParent + if( implIsShowing() ) + pStateSetHelper->AddState( AccessibleStateType::SHOWING ); + + m_aTable.FillAccessibleStateSetForCell( *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); + } + else + pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); + + return pStateSetHelper; + } + + + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + Reference< XAccessibleContext > SAL_CALL AccessibleGridControlTableCell::getAccessibleContext() throw ( RuntimeException ) + { + ensureIsAlive(); + return this; + } + + // XAccessibleContext ----------------------------------------------------- + + sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ensureIsAlive(); + + return ( getRowPos() * m_aTable.GetColumnCount() ) + getColumnPos(); + } + + sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException) + { + return -1; + } + sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + + if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); + + return sal_False; + } + sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getCharacter( nIndex ); + } + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleGridControlTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + + ::rtl::OUString sText( implGetText() ); + + if ( !implIsValidIndex( nIndex, sText.getLength() ) ) + throw IndexOutOfBoundsException(); + + return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >(); + } + sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getCharacterCount( ); + } + + ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getSelectedText( ); + } + sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getSelectionStart( ); + } + sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getSelectionEnd( ); + } + sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); + + return sal_False; + } + ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getText( ); + } + ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex ); + } + ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); + } + ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); + } + ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); + } + sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + TCSolarGuard aSolarGuard; + ::osl::MutexGuard aGuard( getOslMutex() ); + ::rtl::OUString sText = implGetText(); + checkIndex_Impl( nStartIndex, sText ); + checkIndex_Impl( nEndIndex, sText ); + + //!!! don't know how to put a string into the clipboard + return sal_False; + } + Rectangle AccessibleGridControlTableCell::implGetBoundingBox() + { + return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle + } + // ----------------------------------------------------------------------------- + + Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen() + { + return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle + } +} diff --git a/accessibility/source/extended/makefile.mk b/accessibility/source/extended/makefile.mk index 701bff8f7..34f9158f1 100644 --- a/accessibility/source/extended/makefile.mk +++ b/accessibility/source/extended/makefile.mk @@ -64,7 +64,14 @@ SLOFILES=\ $(SLO)$/listboxaccessible.obj \ $(SLO)$/accessiblebrowseboxcell.obj \ $(SLO)$/accessibleeditbrowseboxcell.obj \ - $(SLO)$/textwindowaccessibility.obj + $(SLO)$/textwindowaccessibility.obj \ + $(SLO)$/AccessibleGridControlBase.obj \ + $(SLO)$/AccessibleGridControl.obj \ + $(SLO)$/AccessibleGridControlTableBase.obj \ + $(SLO)$/AccessibleGridControlHeader.obj \ + $(SLO)$/AccessibleGridControlTableCell.obj \ + $(SLO)$/AccessibleGridControlHeaderCell.obj \ + $(SLO)$/AccessibleGridControlTable.obj # --- Targets ------------------------------------------------------- diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index aea02be9c..e96d768d9 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -72,6 +72,8 @@ #include <accessibility/extended/accessibleeditbrowseboxcell.hxx> #include <vcl/lstbox.hxx> #include <vcl/combobox.hxx> +#include <accessibility/extended/AccessibleGridControl.hxx> +#include <svtools/accessibletable.hxx> #include <floatingwindowaccessible.hxx> @@ -94,6 +96,7 @@ inline bool hasFloatingChild(Window *pWindow) using namespace ::com::sun::star::awt; using namespace ::com::sun::star::accessibility; using namespace ::svt; + using namespace ::svt::table; //================================================================ //= IAccessibleFactory @@ -150,6 +153,12 @@ inline bool hasFloatingChild(Window *pWindow) IAccessibleTableProvider& _rBrowseBox ) const; + virtual IAccessibleTableControl* + createAccessibleTableControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + IAccessibleTable& _rTable + ) const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, @@ -412,6 +421,13 @@ inline bool hasFloatingChild(Window *pWindow) } //-------------------------------------------------------------------- + IAccessibleTableControl* AccessibleFactory::createAccessibleTableControl( + const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable ) const + { + return new AccessibleGridControlAccess( _rxParent, _rTable ); + } + + //-------------------------------------------------------------------- Reference< XAccessible > AccessibleFactory::createAccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) const { diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx index a638be860..9731e3bd0 100644 --- a/cui/source/dialogs/cuicharmap.cxx +++ b/cui/source/dialogs/cuicharmap.cxx @@ -67,11 +67,11 @@ SvxCharacterMap::SvxCharacterMap( Window* pParent, BOOL bOne, const SfxItemSet* if ( pItem ) bOne = pItem->GetValue(); + mpCharMapData = new SvxCharMapData( this, bOne, &CUI_MGR() ); + SFX_ITEMSET_ARG( pSet, pCharItem, SfxInt32Item, SID_ATTR_CHAR, FALSE ); if ( pCharItem ) - SetChar( pItem->GetValue() ); - - mpCharMapData = new SvxCharMapData( this, bOne, &CUI_MGR() ); + SetChar( pCharItem->GetValue() ); SFX_ITEMSET_ARG( pSet, pDisableItem, SfxBoolItem, FN_PARAM_2, FALSE ); if ( pDisableItem && pDisableItem->GetValue() ) diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 82ec72f4e..c1a4d7690 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -372,12 +372,24 @@ int SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; - - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); - + const SfxPoolItem* pItem; +// nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); if(!pActNum) pActNum = new SvxNumRule(*pSaveNum); @@ -558,12 +570,24 @@ int SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxBulletPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; - - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); - + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); @@ -783,12 +807,24 @@ int SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet) void SvxNumPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; - - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); - + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // nActNumLvl = ((SwNumBulletTabDialog*)GetTabDialog())->GetActNumLevel(); if(!pActNum) @@ -1083,12 +1119,24 @@ BOOL SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet ) void SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; - - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); - + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); if(!pActNum) pActNum = new SvxNumRule(*pSaveNum); @@ -1510,12 +1558,24 @@ BOOL SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet ) --------------------------------------------------*/ void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; - - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); - + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // Ebenen einfuegen if(!aLevelLB.GetEntryCount()) @@ -1559,7 +1619,6 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet ) pPreviewWIN->SetNumRule(pActNum); aSameLevelCB.Check(pActNum->IsContinuousNumbering()); - const SfxPoolItem* pItem = 0; //ColorListBox bei Bedarf fuellen if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) ) { @@ -3403,12 +3462,24 @@ BOOL SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet ) --------------------------------------------------*/ void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet ) { - nNumItemId = rSet.GetPool() ? rSet.GetPool()->GetWhich( SID_ATTR_NUMBERING_RULE ) : SID_ATTR_NUMBERING_RULE; - - const SvxNumBulletItem& rItem = static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); - + const SfxPoolItem* pItem; + //im Draw gibt es das Item als WhichId, im Writer nur als SlotId + SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, FALSE, &pItem); + if(eState != SFX_ITEM_SET) + { + nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE); + eState = rSet.GetItemState(nNumItemId, FALSE, &pItem); + + if( eState != SFX_ITEM_SET ) + { + pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, TRUE ) ); + eState = SFX_ITEM_SET; + } + + } + DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!"); delete pSaveNum; - pSaveNum = new SvxNumRule(*rItem.GetNumRule()); + pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); // Ebenen einfuegen if(!aLevelLB.GetEntryCount()) diff --git a/extensions/prj/d.lst b/extensions/prj/d.lst index 053796a2c..ecfe0ef9a 100644 --- a/extensions/prj/d.lst +++ b/extensions/prj/d.lst @@ -20,6 +20,7 @@ mkdir: %_DEST%\bin%_EXT%\so ..\%__SRC%\bin\nsplugin %_DEST%\bin%_EXT%\nsplugin ..\%__SRC%\bin\npsoplugin.dll %_DEST%\bin%_EXT%\npsoplugin.dll ..\%__SRC%\bin\npsoplugin_so.dll %_DEST%\bin%_EXT%\so\npsoplugin.dll +..\%__SRC%\bin\x64\so_activex.dll %_DEST%\bin%_EXT%\so_activex_x64.dll ..\%__SRC%\bin\mdibundle.zip %_DEST%\bin%_EXT%\mdibundle.zip ..\source\bibliography\uiconfig\sbibliography\menubar\*.xml %_DEST%\xml%_EXT%\uiconfig\modules\sbibliography\menubar\*.xml diff --git a/extensions/source/activex/main/SOActiveX.cpp b/extensions/source/activex/main/SOActiveX.cpp index 1e55ba0b0..feeda33e0 100644 --- a/extensions/source/activex/main/SOActiveX.cpp +++ b/extensions/source/activex/main/SOActiveX.cpp @@ -1025,6 +1025,7 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di ) hr = CreateFrameOldWay( mOffWin, di.prcBounds->right - di.prcBounds->left, di.prcBounds->bottom - di.prcBounds->top ); + if( !SUCCEEDED( hr ) ) { // if the frame can not be opened do not try any more @@ -1038,6 +1039,7 @@ HRESULT CSOActiveX::OnDrawAdvanced( ATL_DRAWINFO& di ) { hr = LoadURLToFrame(); mbLoad = FALSE; + if( !SUCCEEDED( hr ) ) { // if the document can not be opened do not try any more diff --git a/extensions/source/activex/main/SOComWindowPeer.h b/extensions/source/activex/main/SOComWindowPeer.h index 27c6f4037..55be8cafc 100644 --- a/extensions/source/activex/main/SOComWindowPeer.h +++ b/extensions/source/activex/main/SOComWindowPeer.h @@ -55,7 +55,7 @@ DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER) /* [in] */ short /*s*/, /* [retval][out] */ long __RPC_FAR *ret) { - *ret = (long) m_hwnd; + *ret = HandleToLong( m_hwnd ); return S_OK; } diff --git a/extensions/source/activex/main/makefile.mk b/extensions/source/activex/main/makefile.mk index 64dcbe34a..1a702eb9d 100644 --- a/extensions/source/activex/main/makefile.mk +++ b/extensions/source/activex/main/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -49,6 +49,10 @@ LIBTARGET=NO USE_DEFFILE=YES UWINAPILIB= +.IF "$(BUILD_X64)"!="" +USE_DEFFILE_X64=TRUE +.ENDIF + INCPRE+=$(foreach,i,$(ATL_INCLUDE) -I$(i)) \ -I$(MISC) \ @@ -110,9 +114,58 @@ SHL1RES=$(RES)$/$(TARGET).res .ENDIF +.IF "$(BUILD_X64)"!="" +# -------------------- x64 ----------------------- +.IF "$(USE_STLP_DEBUG)"!="" +CDEFS_X64+=-D_DEBUG +.ENDIF # "$(USE_STLP_DEBUG)"!="" + +CDEFS_X64+:=$(foreach,i,$(CDEFS) $(subst,-D_X86_=1, $i)) +LIBTARGET_X64=NO +USE_DEFFILE_X64=YES +UWINAPILIB_X64= + +SLOFILES_X64= \ + $(SLO_X64)$/so_activex.obj \ + $(SLO_X64)$/SOActiveX.obj \ + $(SLO_X64)$/SOComWindowPeer.obj \ + $(SLO_X64)$/SODispatchInterceptor.obj \ + $(SLO_X64)$/SOActionsApproval.obj \ + $(SLO_X64)$/StdAfx2.obj + +SHL1TARGET_X64=$(TARGET) + +SHL1STDLIBS_X64+=\ + $(UUIDLIB_X64) \ + $(ADVAPI32LIB_X64) \ + $(OLE32LIB_X64) \ + $(OLEAUT32LIB_X64) \ + $(GDI32LIB_X64) \ + $(URLMONLIB_X64) \ + $(SHLWAPILIB_X64) \ + $(KERNEL32LIB_X64) \ + $(USER32LIB_X64) \ + $(MSVCRT_X64) \ + $(MSVCPRT_X64) \ + $(OLDNAMESLIB_X64) + +SHL1OBJS_X64=$(SLOFILES_X64) +SHL1DEF_X64=$(TARGET).def + +.IF "$(USE_STLP_DEBUG)" != "" + SHL1STDLIBS_X64+= $(ATL_LIB)$/amd64$/atlsd.lib +.ELSE + SHL1STDLIBS_X64+= $(ATL_LIB)$/amd64$/atls.lib +.ENDIF + +.ENDIF # "$(BUILD_X64)"!="" + # --- Targets ---------------------------------- +.INCLUDE : set_wntx64.mk +VERSIONOBJ_X64= .INCLUDE : target.mk +.INCLUDE : tg_wntx64.mk $(MISC)$/envsettings.h : makefile.mk -$(RM) $@ diff --git a/extensions/source/activex/main/so_activex.cpp b/extensions/source/activex/main/so_activex.cpp index 51a1db142..01f63dd95 100644 --- a/extensions/source/activex/main/so_activex.cpp +++ b/extensions/source/activex/main/so_activex.cpp @@ -24,6 +24,30 @@ BEGIN_OBJECT_MAP(ObjectMap) OBJECT_ENTRY(CLSID_SOActiveX, CSOActiveX) END_OBJECT_MAP() + +#define X64_LIB_NAME "so_activex_x64.dll" +#define X32_LIB_NAME "so_activex.dll" + +// 06.11.2009 tkr: to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY +// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. +// Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and +// extensions\source\activex\main\so_activex.cpp +#ifndef KEY_WOW64_64KEY + #define KEY_WOW64_64KEY (0x0100) +#endif + +const REGSAM n64KeyAccess = KEY_ALL_ACCESS | KEY_WOW64_64KEY; +const REGSAM n32KeyAccess = KEY_ALL_ACCESS; + +#ifdef _AMD64_ +const BOOL bX64 = TRUE; +#else +const BOOL bX64 = FALSE; +#endif + +// 10.11.2009 tkr: MinGW doesn't know anything about RegDeleteKeyExA if WINVER < 0x0502. +WINADVAPI LONG WINAPI RegDeleteKeyExA(HKEY,LPCSTR,REGSAM,DWORD); + ///////////////////////////////////////////////////////////////////////////// // DLL Entry Point @@ -129,22 +153,23 @@ const char* aProxyStubActApprove = "{00020424-0000-0000-C000-000000000046}"; // The following prefix is required for HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER ( not for HKEY_CLASSES_ROOT ) const char* aLocalPrefix = "Software\\Classes\\"; -BOOL createKey( HKEY hkey, - const char* aKeyToCreate, +BOOL createKey( HKEY hkey, + const char* aKeyToCreate, + REGSAM nKeyAccess, const char* aValue = NULL, const char* aChildName = NULL, const char* aChildValue = NULL ) { HKEY hkey1; - return ( ERROR_SUCCESS == RegCreateKey( hkey, aKeyToCreate, &hkey1 ) - && ( !aValue || ERROR_SUCCESS == RegSetValueEx( hkey1, + return ( ERROR_SUCCESS == RegCreateKeyExA( hkey, aKeyToCreate, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && ( !aValue || ERROR_SUCCESS == RegSetValueExA( hkey1, "", 0, REG_SZ, (const BYTE*)aValue, strlen( aValue ) ) ) - && ( !aChildName || ERROR_SUCCESS == RegSetValueEx( hkey1, + && ( !aChildName || ERROR_SUCCESS == RegSetValueExA( hkey1, aChildName, 0, REG_SZ, @@ -154,8 +179,8 @@ BOOL createKey( HKEY hkey, } -STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers ); -STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, const char* pActiveXPath ) +STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ); +STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess, const char* pProgramPath, const char* pLibName ) { BOOL aResult = FALSE; @@ -164,89 +189,86 @@ STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, const char* pActiv HKEY hkey2 = NULL; HKEY hkey3 = NULL; HKEY hkey4 = NULL; - char aSubKey[513]; + char aSubKey[513]; int ind; const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; - char pActiveXPath101[1024]; - char pPrCatalogPath[1019]; + char pActiveXPath[1124]; + char pActiveXPath101[1124]; // In case SO7 is installed for this user he can have local registry entries that will prevent him from // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control. // Unfortunately it can be done only for the user who installs the office. if ( bForAllUsers ) - DllUnregisterServerNative( nMode, sal_False ); + DllUnregisterServerNative( nMode, sal_False, sal_False ); #ifdef MY_DEBUG - MessageBoxA(NULL, pActiveXPath, "Library Path, ( from library )", MB_OK | MB_ICONINFORMATION); + MessageBoxA(NULL, pProgramPath, "Library Path, ( from library )", MB_OK | MB_ICONINFORMATION); #endif - if ( pActiveXPath ) + if ( pProgramPath && strlen( pProgramPath ) < 1024 ) { - sprintf( pActiveXPath101, "%s, 101", pActiveXPath ); + sprintf( pActiveXPath, "%s\\%s", pProgramPath, pLibName ); + sprintf( pActiveXPath101, "%s\\%s, 101", pProgramPath, pLibName ); - int nPrCatLength = strlen( pActiveXPath ) - sizeof( "so_activex.dll" ) + 1; - strncpy( pPrCatalogPath, pActiveXPath, nPrCatLength ); - pPrCatalogPath[ nPrCatLength ] = 0; - { - wsprintf( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); + wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); aResult = - ( ERROR_SUCCESS == RegCreateKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey ) - && ERROR_SUCCESS == RegSetValueEx( hkey, "", 0, REG_SZ, (const BYTE*)"SOActiveX Class", 17 ) - && createKey( hkey, "Control" ) - && createKey( hkey, "EnableFullPage" ) - && createKey( hkey, "InprocServer32", pActiveXPath, "ThreadingModel", "Apartment" ) - && createKey( hkey, "MiscStatus", "0" ) - && createKey( hkey, "MiscStatus\\1", "131473" ) - && createKey( hkey, "ProgID", "so_activex.SOActiveX.1" ) - && createKey( hkey, "Programmable" ) - && createKey( hkey, "ToolboxBitmap32", pActiveXPath101 ) - && createKey( hkey, "TypeLib", aTypeLib ) - && createKey( hkey, "Version", "1.0" ) - && createKey( hkey, "VersionIndependentProgID", "so_activex.SOActiveX" ) + ( ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) + && ERROR_SUCCESS == RegSetValueExA( hkey, "", 0, REG_SZ, (const BYTE*)"SOActiveX Class", 17 ) + && createKey( hkey, "Control", nKeyAccess ) + && createKey( hkey, "EnableFullPage", nKeyAccess ) + && createKey( hkey, "InprocServer32", nKeyAccess, pActiveXPath, "ThreadingModel", "Apartment" ) + && createKey( hkey, "MiscStatus", nKeyAccess, "0" ) + && createKey( hkey, "MiscStatus\\1", nKeyAccess, "131473" ) + && createKey( hkey, "ProgID", nKeyAccess, "so_activex.SOActiveX.1" ) + && createKey( hkey, "Programmable", nKeyAccess ) + && createKey( hkey, "ToolboxBitmap32", nKeyAccess, pActiveXPath101 ) + && createKey( hkey, "TypeLib", nKeyAccess, aTypeLib ) + && createKey( hkey, "Version", nKeyAccess, "1.0" ) + && createKey( hkey, "VersionIndependentProgID", nKeyAccess, "so_activex.SOActiveX" ) && ERROR_SUCCESS == RegCloseKey( hkey ) - && ERROR_SUCCESS == RegCreateKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aPrefix, &hkey ) - && createKey( hkey, "so_activex.SOActiveX", "SOActiveX Class" ) - && ERROR_SUCCESS == RegCreateKey( hkey, "so_activex.SOActiveX", &hkey1 ) - && createKey( hkey1, "CLSID", aClassID ) - && createKey( hkey1, "CurVer", "so_activex.SOActiveX.1" ) + && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aPrefix, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) + && createKey( hkey, "so_activex.SOActiveX", nKeyAccess, "SOActiveX Class" ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && createKey( hkey1, "CLSID", nKeyAccess, aClassID ) + && createKey( hkey1, "CurVer", nKeyAccess, "so_activex.SOActiveX.1" ) && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && createKey( hkey, "so_activex.SOActiveX.1", "SOActiveX Class" ) - && ERROR_SUCCESS == RegCreateKey( hkey, "so_activex.SOActiveX.1", &hkey1 ) - && createKey( hkey1, "CLSID", aClassID ) + && createKey( hkey, "so_activex.SOActiveX.1", nKeyAccess, "SOActiveX Class" ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "so_activex.SOActiveX.1", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && createKey( hkey1, "CLSID", nKeyAccess, aClassID ) && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && ERROR_SUCCESS == RegCreateKey( hkey, "TypeLib", &hkey1 ) - && ERROR_SUCCESS == RegCreateKey( hkey1, aTypeLib, &hkey2 ) - && createKey( hkey2, "1.0", "wrap_activex 1.0 Type Library" ) - && ERROR_SUCCESS == RegCreateKey( hkey2, "1.0", &hkey3 ) - && ERROR_SUCCESS == RegCreateKey( hkey3, "0", &hkey4 ) - && createKey( hkey4, "win32", pActiveXPath ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "TypeLib", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aTypeLib, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && createKey( hkey2, "1.0", nKeyAccess, "wrap_activex 1.0 Type Library" ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey2, "1.0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey3 , NULL ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey3, "0", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey4 , NULL ) + && createKey( hkey4, "win32", nKeyAccess, pActiveXPath ) && ERROR_SUCCESS == RegCloseKey( hkey4 ) - && createKey( hkey3, "FLAGS", "0" ) - && createKey( hkey3, "HELPDIR", pPrCatalogPath ) + && createKey( hkey3, "FLAGS", nKeyAccess, "0" ) + && createKey( hkey3, "HELPDIR", nKeyAccess, pProgramPath ) && ERROR_SUCCESS == RegCloseKey( hkey3 ) && ERROR_SUCCESS == RegCloseKey( hkey2 ) && ERROR_SUCCESS == RegCloseKey( hkey1 ) - && ERROR_SUCCESS == RegCreateKey( hkey, "Interface", &hkey1 ) - && createKey( hkey1, aInterIDWinPeer, "ISOComWindowPeer" ) - && ERROR_SUCCESS == RegCreateKey( hkey1, aInterIDWinPeer, &hkey2 ) - && createKey( hkey2, "ProxyStubClsid", aProxyStubWinPeer ) - && createKey( hkey2, "ProxyStubClsid32", aProxyStubWinPeer ) - && createKey( hkey2, "TypeLib", aTypeLib, "Version", "1.0" ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey, "Interface", 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) + && createKey( hkey1, aInterIDWinPeer, nKeyAccess, "ISOComWindowPeer" ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDWinPeer, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubWinPeer ) + && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubWinPeer ) + && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) && ERROR_SUCCESS == RegCloseKey( hkey2 ) - && createKey( hkey1, aInterIDActApprove, "ISOActionsApproval" ) - && ERROR_SUCCESS == RegCreateKey( hkey1, aInterIDActApprove, &hkey2 ) - && createKey( hkey2, "ProxyStubClsid", aProxyStubActApprove ) - && createKey( hkey2, "ProxyStubClsid32", aProxyStubActApprove ) - && createKey( hkey2, "TypeLib", aTypeLib, "Version", "1.0" ) + && createKey( hkey1, aInterIDActApprove, nKeyAccess, "ISOActionsApproval" ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDActApprove, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubActApprove ) + && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubActApprove ) + && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) && ERROR_SUCCESS == RegCloseKey( hkey2 ) - && createKey( hkey1, aInterIDDispInt, "ISODispatchInterceptor" ) - && ERROR_SUCCESS == RegCreateKey( hkey1, aInterIDDispInt, &hkey2 ) - && createKey( hkey2, "ProxyStubClsid", aProxyStubDispInt ) - && createKey( hkey2, "ProxyStubClsid32", aProxyStubDispInt ) - && createKey( hkey2, "TypeLib", aTypeLib, "Version", "1.0" ) + && createKey( hkey1, aInterIDDispInt, nKeyAccess, "ISODispatchInterceptor" ) + && ERROR_SUCCESS == RegCreateKeyExA( hkey1, aInterIDDispInt, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey2 , NULL ) + && createKey( hkey2, "ProxyStubClsid", nKeyAccess, aProxyStubDispInt ) + && createKey( hkey2, "ProxyStubClsid32", nKeyAccess, aProxyStubDispInt ) + && createKey( hkey2, "TypeLib", nKeyAccess, aTypeLib, "Version", "1.0" ) && ERROR_SUCCESS == RegCloseKey( hkey2 ) && ERROR_SUCCESS == RegCloseKey( hkey1 ) && ERROR_SUCCESS == RegCloseKey( hkey ) ); @@ -259,11 +281,11 @@ STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, const char* pActiv { if( nForModes[ind] & nMode ) { - wsprintf( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) -// || ERROR_SUCCESS != RegSetValueEx(hkey, "Extension", 0, REG_SZ, -// (const BYTE *)aFileExt[ind], strlen( aFileExt[ind] ) ) - || ERROR_SUCCESS != RegSetValueEx(hkey, "CLSID", 0, REG_SZ, + wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) +// || ERROR_SUCCESS != RegSetValueExA(hkey, "Extension", 0, REG_SZ, +// (const BYTE *)aFileExt[ind], strlen( aFileExt[ind] ) ) + || ERROR_SUCCESS != RegSetValueExA(hkey, "CLSID", 0, REG_SZ, (const BYTE *)aClassID, strlen(aClassID)) ) aResult = FALSE; @@ -271,9 +293,9 @@ STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, const char* pActiv RegCloseKey(hkey),hkey= NULL; /* - wsprintf( aSubKey, "%s%s", aPrefix, aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) - || ERROR_SUCCESS != RegSetValueEx(hkey, "Content Type", 0, REG_SZ, + wsprintfA( aSubKey, "%s%s", aPrefix, aFileExt[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) + || ERROR_SUCCESS != RegSetValueExA(hkey, "Content Type", 0, REG_SZ, (const BYTE *)aMimeType[ind], strlen( aMimeType[ind] ) ) ) aResult = FALSE; if( hkey ) @@ -282,13 +304,13 @@ STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, const char* pActiv } } - wsprintf( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - if ( aResult && ERROR_SUCCESS == RegOpenKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) ) + wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); + if ( aResult && ERROR_SUCCESS == RegOpenKeyExA(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, nKeyAccess, &hkey) ) { for( ind = 0; ind < SUPPORTED_EXT_NUM; ind++ ) { - wsprintf( aSubKey, "EnableFullPage\\%s", aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKey( hkey, aSubKey, &hkey1 ) ) + wsprintfA( aSubKey, "EnableFullPage\\%s", aFileExt[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) ) aResult = FALSE; if ( hkey1 ) @@ -304,30 +326,62 @@ STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, const char* pActiv return aResult; } +STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit, const char* pProgramPath ) +{ + HRESULT hr = S_OK; + if ( bFor64Bit ) + hr = DllRegisterServerNative_Impl( nMode, bForAllUsers, n64KeyAccess, pProgramPath, X64_LIB_NAME ); + + if ( SUCCEEDED( hr ) ) + hr = DllRegisterServerNative_Impl( nMode, bForAllUsers, n32KeyAccess, pProgramPath, X32_LIB_NAME ); + + return hr; +} + + ///////////////////////////////////////////////////////////////////////////// // DllUnregisterServer - Removes entries from the system registry +HRESULT DeleteKeyTree( HKEY hkey, const char* pPath, REGSAM nKeyAccess ) +{ + HKEY hkey1 = NULL; + + char pSubKeyName[256]; + // first delete the subkeys + while( ERROR_SUCCESS == RegOpenKeyExA( hkey, pPath, 0, nKeyAccess, &hkey1) + && ERROR_SUCCESS == RegEnumKeyA( hkey1, 0, pSubKeyName, 256 ) + && ERROR_SUCCESS == DeleteKeyTree( hkey1, pSubKeyName, nKeyAccess ) ) + { + RegCloseKey( hkey1 ),hkey1= NULL; + } + + if ( hkey1 ) + RegCloseKey( hkey1 ),hkey1= NULL; + + // delete the key itself + return RegDeleteKeyExA( hkey, pPath, nKeyAccess & ( KEY_WOW64_64KEY | KEY_WOW64_32KEY ), 0 ); +} -STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers ) +STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) { HKEY hkey = NULL; BOOL fErr = FALSE; - char aSubKey[513]; - const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; + char aSubKey[513]; + const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; - for( int ind = 0; ind < SUPPORTED_EXT_NUM; ind++ ) + for( int ind = 0; ind < SUPPORTED_EXT_NUM; ind++ ) { if( nForModes[ind] & nMode ) { DWORD nSubKeys = 0, nValues = 0; - wsprintf( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) ) + wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMimeType[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) fErr = TRUE; else { - if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) ) + if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) ) fErr = TRUE; - if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, + if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, NULL, NULL, NULL, &nSubKeys, NULL, NULL, &nValues, NULL, NULL, NULL, NULL ) ) { @@ -338,12 +392,12 @@ STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers ) { RegCloseKey( hkey ), hkey = NULL; if ( !nSubKeys && !nValues ) - SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ); + DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } } - wsprintf( aSubKey, "%s%s", aPrefix, aFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) ) + wsprintfA( aSubKey, "%s%s", aPrefix, aFileExt[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) fErr = TRUE; else { @@ -358,43 +412,53 @@ STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers ) { RegCloseKey( hkey ), hkey = NULL; if ( !nSubKeys && !nValues ) - SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ); + DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } } } } - wsprintf( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - if( ERROR_SUCCESS != SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ) ) + wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); + if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; - wsprintf( aSubKey, "%sso_activex.SOActiveX", aPrefix ); - if( ERROR_SUCCESS != SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ) ) + wsprintfA( aSubKey, "%sso_activex.SOActiveX", aPrefix ); + if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; - wsprintf( aSubKey, "%sso_activex.SOActiveX.1", aPrefix ); - if( ERROR_SUCCESS != SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ) ) + wsprintfA( aSubKey, "%sso_activex.SOActiveX.1", aPrefix ); + if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; - wsprintf( aSubKey, "%s\\TypeLib\\%s", aPrefix, aTypeLib ); - if( ERROR_SUCCESS != SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ) ) + wsprintfA( aSubKey, "%s\\TypeLib\\%s", aPrefix, aTypeLib ); + if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; - wsprintf( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDWinPeer ); - if( ERROR_SUCCESS != SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ) ) + wsprintfA( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDWinPeer ); + if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; - wsprintf( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDDispInt ); - if( ERROR_SUCCESS != SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ) ) + wsprintfA( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDDispInt ); + if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; - wsprintf( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDActApprove ); - if( ERROR_SUCCESS != SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ) ) + wsprintfA( aSubKey, "%s\\Interface\\%s", aPrefix, aInterIDActApprove ); + if( ERROR_SUCCESS != DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ) ) fErr = TRUE; return !fErr; } +STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) +{ + HRESULT hr = DllUnregisterServerNative_Impl( nMode, bForAllUsers, n32KeyAccess ); + if ( SUCCEEDED( hr ) && bFor64Bit ) + hr = DllUnregisterServerNative_Impl( nMode, bForAllUsers, n64KeyAccess ); + + return hr; +} + + ///////////////////////////////////////////////////////////////////////////// // DllRegisterServerDoc - Adds entries to the system registry @@ -409,41 +473,41 @@ const char* aMSMimeType[] = { "application/msword", "application/mspowerpoint" }; const int nForMSModes[] = { 1, 1, 2, 2, 4, 4, 4 }; -STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers ); -STDAPI DllRegisterServerDoc( int nMode, BOOL bForAllUsers ) +STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ); +STDAPI DllRegisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) { BOOL aResult = TRUE; HKEY hkey = NULL; HKEY hkey1 = NULL; - char aSubKey[513]; + char aSubKey[513]; int ind; - const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; + const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; // In case SO7 is installed for this user he can have local registry entries that will prevent him from // using SO8 ActiveX control. The fix is just to clean up the local entries related to ActiveX control. // Unfortunately it can be done only for the user who installs the office. if ( bForAllUsers ) - DllUnregisterServerDoc( nMode, sal_False ); + DllUnregisterServerDoc( nMode, sal_False, sal_False ); for( ind = 0; ind < SUPPORTED_MSEXT_NUM && aResult; ind++ ) { if( nForMSModes[ind] & nMode ) { - wsprintf( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) - || ERROR_SUCCESS != RegSetValueEx(hkey, "Extension", 0, REG_SZ, + wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) + || ERROR_SUCCESS != RegSetValueExA(hkey, "Extension", 0, REG_SZ, (const BYTE *)aMSFileExt[ind], strlen( aMSFileExt[ind] ) ) - || ERROR_SUCCESS != RegSetValueEx(hkey, "CLSID", 0, REG_SZ, + || ERROR_SUCCESS != RegSetValueExA(hkey, "CLSID", 0, REG_SZ, (const BYTE *)aClassID, strlen(aClassID)) ) aResult = FALSE; if( hkey ) RegCloseKey(hkey),hkey= NULL; - wsprintf( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) - || ERROR_SUCCESS != RegSetValueEx(hkey, "Content Type", 0, REG_SZ, + wsprintfA( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) + || ERROR_SUCCESS != RegSetValueExA(hkey, "Content Type", 0, REG_SZ, (const BYTE *)aMSMimeType[ind], strlen( aMSMimeType[ind] ) ) ) aResult = FALSE; @@ -452,16 +516,16 @@ STDAPI DllRegisterServerDoc( int nMode, BOOL bForAllUsers ) } } - wsprintf( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); - if ( aResult && ERROR_SUCCESS == RegCreateKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey ) - && createKey( hkey, "EnableFullPage" ) ) + wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID ); + if ( aResult && ERROR_SUCCESS == RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey , NULL ) + && createKey( hkey, "EnableFullPage", nKeyAccess ) ) { for( ind = 0; ind < SUPPORTED_MSEXT_NUM; ind++ ) { if( nForMSModes[ind] & nMode ) { - wsprintf( aSubKey, "EnableFullPage\\%s", aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKey( hkey, aSubKey, &hkey1 ) ) + wsprintfA( aSubKey, "EnableFullPage\\%s", aMSFileExt[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( hkey, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey1 , NULL ) ) aResult = FALSE; if ( hkey1 ) @@ -478,17 +542,28 @@ STDAPI DllRegisterServerDoc( int nMode, BOOL bForAllUsers ) return aResult; } +STDAPI DllRegisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) +{ + HRESULT hr = S_OK; + if ( bFor64Bit ) + hr = DllRegisterServerDoc_Impl( nMode, bForAllUsers, n64KeyAccess ); + + if ( SUCCEEDED( hr ) ) + hr = DllRegisterServerDoc_Impl( nMode, bForAllUsers, n32KeyAccess ); + + return hr; +} ///////////////////////////////////////////////////////////////////////////// // DllUnregisterServerDoc - Removes entries from the system registry -STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers ) +STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess ) { HKEY hkey = NULL; BOOL fErr = FALSE; - char aSubKey[513]; - const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; + char aSubKey[513]; + const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix; for( int ind = 0; ind < SUPPORTED_MSEXT_NUM; ind++ ) { @@ -496,8 +571,8 @@ STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers ) { DWORD nSubKeys = 0, nValues = 0; - wsprintf( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) ) + wsprintfA( aSubKey, "%sMIME\\DataBase\\Content Type\\%s", aPrefix, aMSMimeType[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) fErr = TRUE; else { @@ -518,12 +593,12 @@ STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers ) { RegCloseKey( hkey ), hkey = NULL; if ( !nSubKeys && !nValues ) - SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ); + DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } } - wsprintf( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); - if ( ERROR_SUCCESS != RegCreateKey(bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, &hkey) ) + wsprintfA( aSubKey, "%s%s", aPrefix, aMSFileExt[ind] ); + if ( ERROR_SUCCESS != RegCreateKeyExA( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, nKeyAccess, NULL, &hkey, NULL ) ) fErr = TRUE; else { @@ -541,7 +616,7 @@ STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers ) { RegCloseKey( hkey ), hkey = NULL; if ( !nSubKeys && !nValues ) - SHDeleteKey( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey ); + DeleteKeyTree( bForAllUsers ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, aSubKey, nKeyAccess ); } } } @@ -550,33 +625,59 @@ STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers ) return !fErr; } +STDAPI DllUnregisterServerDoc( int nMode, BOOL bForAllUsers, BOOL bFor64Bit ) +{ + HRESULT hr = S_OK; + if ( bFor64Bit ) + hr = DllUnregisterServerDoc_Impl( nMode, bForAllUsers, n64KeyAccess ); + + if ( SUCCEEDED( hr ) ) + hr = DllUnregisterServerDoc_Impl( nMode, bForAllUsers, n32KeyAccess ); + + return hr; +} + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - regsvr32 entry point + STDAPI DllRegisterServer( void ) { - char pActiveXPath[1019]; + char pProgramPath[1024]; HRESULT aResult = E_FAIL; - HMODULE aCurModule = GetModuleHandleA( "so_activex.dll" ); - if( aCurModule && GetModuleFileNameA( aCurModule, pActiveXPath, 1019 ) ) + HMODULE aCurModule = GetModuleHandleA( bX64 ? X64_LIB_NAME : X32_LIB_NAME ); + DWORD nLen = 0; + DWORD nLibNameLen = strlen( bX64 ? X64_LIB_NAME : X32_LIB_NAME ); + + if( aCurModule ) { - aResult = DllRegisterServerNative( 31, TRUE, pActiveXPath ); - if( SUCCEEDED( aResult ) ) - aResult = DllRegisterServerDoc( 31, TRUE ); - else + nLen = GetModuleFileNameA( aCurModule, pProgramPath, 1024 ); + if ( nLen && nLen > nLibNameLen + 1 ) { - aResult = DllRegisterServerNative( 31, FALSE, pActiveXPath ); + pProgramPath[ nLen - nLibNameLen - 1 ] = 0; + aResult = DllRegisterServerNative( 31, TRUE, bX64, pProgramPath ); if( SUCCEEDED( aResult ) ) - aResult = DllRegisterServerDoc( 31, FALSE ); + aResult = DllRegisterServerDoc( 31, TRUE, bX64 ); + else + { + aResult = DllRegisterServerNative( 31, FALSE, bX64, pProgramPath ); + if( SUCCEEDED( aResult ) ) + aResult = DllRegisterServerDoc( 31, FALSE, bX64 ); + } } } return aResult; } +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - regsvr32 entry point + STDAPI DllUnregisterServer( void ) { - DllUnregisterServerDoc( 63, FALSE ); - DllUnregisterServerNative( 63, FALSE ); - DllUnregisterServerDoc( 63, TRUE ); - return DllUnregisterServerNative( 63, TRUE ); + DllUnregisterServerDoc( 63, FALSE, bX64 ); + DllUnregisterServerNative( 63, FALSE, bX64 ); + DllUnregisterServerDoc( 63, TRUE, bX64 ); + return DllUnregisterServerNative( 63, TRUE, bX64 ); } diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index fd9e8cae9..befff85ff 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -264,7 +264,7 @@ protected: virtual void SAL_CALL onTerminated(); /* Wrapper around checkForUpdates */ - bool runCheck(); + bool runCheck( bool & rbExtensionsChecked ); private: @@ -453,7 +453,7 @@ UpdateCheckThread::cancel() //------------------------------------------------------------------------------ bool -UpdateCheckThread::runCheck() +UpdateCheckThread::runCheck( bool & rbExtensionsChecked ) { bool ret = false; UpdateState eUIState = UPDATESTATE_NO_UPDATE_AVAIL; @@ -474,12 +474,14 @@ UpdateCheckThread::runCheck() // and when there was no office update found if ( ( eUIState != UPDATESTATE_UPDATE_AVAIL ) && ( eUIState != UPDATESTATE_UPDATE_NO_DOWNLOAD ) && - !aController->isDialogShowing() ) + !aController->isDialogShowing() && + !rbExtensionsChecked ) { bool bHasExtensionUpdates = checkForExtensionUpdates( m_xContext ); aController->setHasExtensionUpdates( bHasExtensionUpdates ); if ( bHasExtensionUpdates ) aController->setUIState( UPDATESTATE_EXT_UPD_AVAIL ); + rbExtensionsChecked = true; } // joining with this thread is safe again @@ -500,6 +502,11 @@ UpdateCheckThread::onTerminated() void SAL_CALL UpdateCheckThread::run() { + bool bExtensionsChecked = false; + TimeValue systime; + TimeValue nExtCheckTime; + osl_getSystemTime( &nExtCheckTime ); + osl::Condition::Result aResult = osl::Condition::result_timeout; TimeValue tv = { 10, 0 }; @@ -547,7 +554,6 @@ UpdateCheckThread::run() if( ! checkNow ) { - TimeValue systime; osl_getSystemTime(&systime); // Go back to sleep until time has elapsed @@ -563,19 +569,28 @@ UpdateCheckThread::run() static sal_uInt8 n = 0; - if( ! hasInternetConnection() || ! runCheck() ) + if( ! hasInternetConnection() || ! runCheck( bExtensionsChecked ) ) { - // Increase next by 1, 5, 15, 60, .. minutes - static const sal_Int16 nRetryInterval[] = { 60, 300, 900, 3600 }; + // the extension update check should be independent from the office update check + // + osl_getSystemTime( &systime ); + if ( nExtCheckTime.Seconds + offset < systime.Seconds ) + bExtensionsChecked = false; + + // Increase next by 15, 60, .. minutes + static const sal_Int32 nRetryInterval[] = { 900, 3600, 14400, 86400 }; - if( n < sizeof(nRetryInterval) / sizeof(sal_Int16) ) + if( n < sizeof(nRetryInterval) / sizeof(sal_Int32) ) ++n; tv.Seconds = nRetryInterval[n-1]; aResult = m_aCondition.wait(&tv); } else // reset retry counter - n = 0; + { + n = 0; + bExtensionsChecked = false; + } } } @@ -591,8 +606,10 @@ UpdateCheckThread::run() void SAL_CALL ManualUpdateCheckThread::run() { + bool bExtensionsChecked = false; + try { - runCheck(); + runCheck( bExtensionsChecked ); m_aCondition.reset(); } catch(const uno::Exception& e) { @@ -1528,6 +1545,8 @@ void UpdateCheck::showExtensionDialog() rtl::Reference<UpdateHandler> UpdateCheck::getUpdateHandler() { + osl::MutexGuard aGuard(m_aMutex); + if( ! m_aUpdateHandler.is() ) m_aUpdateHandler = new UpdateHandler(m_xContext, this); @@ -1540,12 +1559,12 @@ uno::Reference< task::XInteractionHandler > UpdateCheck::getInteractionHandler() const { osl::MutexGuard aGuard(m_aMutex); - + uno::Reference< task::XInteractionHandler > xHandler; - + if( m_aUpdateHandler.is() && m_aUpdateHandler->isVisible() ) xHandler = m_aUpdateHandler.get(); - + return xHandler; } diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index 26e0e628c..aeb0a529b 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -200,6 +200,10 @@ void UpdateHandler::setVisible( bool bVisible ) if ( !mxUpdDlg.is() ) createDialog(); + // this should never happen, but if it happens we better return here + if ( !mxUpdDlg.is() ) + return; + updateState( meCurState ); uno::Reference< awt::XWindow > xWindow( mxUpdDlg, uno::UNO_QUERY ); @@ -1032,6 +1036,12 @@ void UpdateHandler::showControls( short nControls ) //-------------------------------------------------------------------- void UpdateHandler::createDialog() { + if ( !mxContext.is() ) + { + OSL_ASSERT( false ); + return; + } + uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager() ); if( xServiceManager.is() ) diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index e0182745d..59b971d38 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -114,14 +114,16 @@ public: throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) { sal_Int32 n = m_xStream->readBytes(aData, nBytesToRead); - OSL_TRACE( aData.get()->elements ); + if ( n ) + OSL_TRACE( "Read [%d] bytes: %s\n", n, aData.get()->elements ); return n; }; virtual sal_Int32 SAL_CALL readSomeBytes(uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw (io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException) { sal_Int32 n = m_xStream->readSomeBytes(aData, nMaxBytesToRead); - OSL_TRACE( aData.get()->elements ); + if ( n ) + OSL_TRACE( "Read [%d] bytes: %s\n", n, aData.get()->elements ); return n; }; virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx index 209354498..1ef456532 100644 --- a/forms/source/component/ComboBox.cxx +++ b/forms/source/component/ComboBox.cxx @@ -747,6 +747,13 @@ void SAL_CALL OComboBoxModel::reloaded( const EventObject& aEvent ) throw(Runtim loadData( false ); } +//------------------------------------------------------------------------------ +void OComboBoxModel::resetNoBroadcast() +{ + OBoundControlModel::resetNoBroadcast(); + m_aLastKnownValue.clear(); +} + //----------------------------------------------------------------------------- sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset ) { diff --git a/forms/source/component/ComboBox.hxx b/forms/source/component/ComboBox.hxx index 4177ff297..f78b64e98 100644 --- a/forms/source/component/ComboBox.hxx +++ b/forms/source/component/ComboBox.hxx @@ -145,6 +145,8 @@ protected: virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); + // OEntryListHelper overriables virtual void stringItemListChanged( ControlModelLock& _rInstanceLock ); virtual void connectedExternalListSource( ); diff --git a/forms/source/component/Currency.cxx b/forms/source/component/Currency.cxx index b716e6f9b..1ff384ce6 100644 --- a/forms/source/component/Currency.cxx +++ b/forms/source/component/Currency.cxx @@ -257,6 +257,13 @@ Any OCurrencyModel::getDefaultForReset() const return aValue; } +//------------------------------------------------------------------------------ +void OCurrencyModel::resetNoBroadcast() +{ + OEditBaseModel::resetNoBroadcast(); + m_aSaveValue.clear(); +} + //......................................................................... } // namespace frm //......................................................................... diff --git a/forms/source/component/Currency.hxx b/forms/source/component/Currency.hxx index bac97932d..28148eae8 100644 --- a/forms/source/component/Currency.hxx +++ b/forms/source/component/Currency.hxx @@ -73,6 +73,8 @@ protected: virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); + protected: DECLARE_XCLONEABLE(); diff --git a/forms/source/component/Date.cxx b/forms/source/component/Date.cxx index 72daa5f0b..00c460fc2 100644 --- a/forms/source/component/Date.cxx +++ b/forms/source/component/Date.cxx @@ -348,6 +348,13 @@ Any ODateModel::getDefaultForReset() const } //------------------------------------------------------------------------------ +void ODateModel::resetNoBroadcast() +{ + OEditBaseModel::resetNoBroadcast(); + m_aSaveValue.clear(); +} + +//------------------------------------------------------------------------------ Sequence< Type > ODateModel::getSupportedBindingTypes() { return Sequence< Type >( &::getCppuType( static_cast< util::Date* >( NULL ) ), 1 ); diff --git a/forms/source/component/Date.hxx b/forms/source/component/Date.hxx index 8d7de9d82..94b37b5d4 100644 --- a/forms/source/component/Date.hxx +++ b/forms/source/component/Date.hxx @@ -96,6 +96,8 @@ protected: virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); + virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ); protected: diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx index 4b483f3ef..408bbab49 100644 --- a/forms/source/component/Edit.cxx +++ b/forms/source/component/Edit.cxx @@ -675,6 +675,13 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType ) } //------------------------------------------------------------------------------ +void OEditModel::resetNoBroadcast() +{ + OEditBaseModel::resetNoBroadcast(); + m_aLastKnownValue.clear(); +} + +//------------------------------------------------------------------------------ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ ) { Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) ); diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx index ca6ca4176..fc4f109ac 100644 --- a/forms/source/component/Edit.hxx +++ b/forms/source/component/Edit.hxx @@ -118,6 +118,8 @@ protected: virtual sal_Bool approveDbColumnType( sal_Int32 _nColumnType ); + virtual void resetNoBroadcast(); + protected: virtual sal_uInt16 getPersistenceFlags() const; diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 07696393d..5c68f203f 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -2266,14 +2266,6 @@ void OBoundControlModel::impl_connectDatabaseColumn_noNotify( bool _bFromReload m_bLoaded = sal_True; onConnectedDbColumn( xRowSet ); - // Some derived classes decide to cache the "current" (resp. "last known") control value, so operations like - // commitControlValueToDbColumn can be made a no-op when nothing actually changed. - // Normally, this cache is kept in sync with the column value, but during a reload, this synchronization is - // temporarily disable. To allow the derived classes to update their cache from the current column value, - // we call translateDbColumnToControlValue. - if ( _bFromReload && hasField() ) - translateDbColumnToControlValue(); - // initially transfer the db column value to the control, if we successfully connected to a database column if ( hasField() ) initFromField( xRowSet ); diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index ba5151e60..fb1c64b3b 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -1248,6 +1248,13 @@ Any OFormattedModel::getDefaultForReset() const return m_xAggregateSet->getPropertyValue( PROPERTY_EFFECTIVE_DEFAULT ); } +//------------------------------------------------------------------------------ +void OFormattedModel::resetNoBroadcast() +{ + OEditBaseModel::resetNoBroadcast(); + m_aSaveValue.clear(); +} + //......................................................................... } //......................................................................... diff --git a/forms/source/component/FormattedField.hxx b/forms/source/component/FormattedField.hxx index 43716ca1f..562d3fc85 100644 --- a/forms/source/component/FormattedField.hxx +++ b/forms/source/component/FormattedField.hxx @@ -141,6 +141,7 @@ namespace frm virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ); virtual void onDisconnectedDbColumn(); diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index b7a42093e..0148238a5 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -1037,10 +1037,10 @@ namespace frm Sequence< sal_Int16 > aSelectionIndicies; - // Bei NULL-Eintraegen Selektion aufheben! ORowSetValue aCurrentValue; - aCurrentValue.fill( xBoundField->getPropertyValue( PROPERTY_VALUE ) ); + aCurrentValue.fill( getFieldType(), m_xColumn ); + // reset selection for NULL values if ( aCurrentValue.isNull() ) { if ( m_nNULLPos != -1 ) @@ -1088,6 +1088,13 @@ namespace frm } //-------------------------------------------------------------------- + void OListBoxModel::resetNoBroadcast() + { + OBoundControlModel::resetNoBroadcast(); + m_aSaveValue.setNull(); + } + + //-------------------------------------------------------------------- void SAL_CALL OListBoxModel::disposing( const EventObject& _rSource ) throw ( RuntimeException ) { if ( !OEntryListHelper::handleDisposing( _rSource ) ) diff --git a/forms/source/component/ListBox.hxx b/forms/source/component/ListBox.hxx index 9d1dcb7fe..307ecc591 100644 --- a/forms/source/component/ListBox.hxx +++ b/forms/source/component/ListBox.hxx @@ -157,6 +157,7 @@ protected: virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); virtual ::com::sun::star::uno::Any getCurrentFormComponentValue() const; diff --git a/forms/source/component/Numeric.cxx b/forms/source/component/Numeric.cxx index 0edd1bd50..6032c0b79 100644 --- a/forms/source/component/Numeric.cxx +++ b/forms/source/component/Numeric.cxx @@ -212,6 +212,13 @@ Any ONumericModel::getDefaultForReset() const return aValue; } +//------------------------------------------------------------------------------ +void ONumericModel::resetNoBroadcast() +{ + OEditBaseModel::resetNoBroadcast(); + m_aSaveValue.clear(); +} + //......................................................................... } // namespace frm //......................................................................... diff --git a/forms/source/component/Numeric.hxx b/forms/source/component/Numeric.hxx index 703c9fa73..b857b24ef 100644 --- a/forms/source/component/Numeric.hxx +++ b/forms/source/component/Numeric.hxx @@ -72,6 +72,7 @@ protected: virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); protected: DECLARE_XCLONEABLE(); diff --git a/forms/source/component/Pattern.cxx b/forms/source/component/Pattern.cxx index f7cf04ac3..e0eb9012b 100644 --- a/forms/source/component/Pattern.cxx +++ b/forms/source/component/Pattern.cxx @@ -252,6 +252,13 @@ Any OPatternModel::getDefaultForReset() const return makeAny( m_aDefaultText ); } +//------------------------------------------------------------------------------ +void OPatternModel::resetNoBroadcast() +{ + OEditBaseModel::resetNoBroadcast(); + m_aLastKnownValue.clear(); +} + //......................................................................... } // namespace frm //......................................................................... diff --git a/forms/source/component/Pattern.hxx b/forms/source/component/Pattern.hxx index 7acb25894..90acfdca6 100644 --- a/forms/source/component/Pattern.hxx +++ b/forms/source/component/Pattern.hxx @@ -81,6 +81,7 @@ protected: virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); protected: DECLARE_XCLONEABLE(); diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx index 0d857acef..59125364d 100644 --- a/forms/source/component/Time.cxx +++ b/forms/source/component/Time.cxx @@ -350,6 +350,13 @@ Any OTimeModel::getDefaultForReset() const } //------------------------------------------------------------------------------ +void OTimeModel::resetNoBroadcast() +{ + OEditBaseModel::resetNoBroadcast(); + m_aSaveValue.clear(); +} + +//------------------------------------------------------------------------------ Sequence< Type > OTimeModel::getSupportedBindingTypes() { return Sequence< Type >( &::getCppuType( static_cast< util::Time* >( NULL ) ), 1 ); diff --git a/forms/source/component/Time.hxx b/forms/source/component/Time.hxx index 433f9388e..e108a812d 100644 --- a/forms/source/component/Time.hxx +++ b/forms/source/component/Time.hxx @@ -96,6 +96,7 @@ protected: virtual ::com::sun::star::uno::Any getDefaultForReset() const; + virtual void resetNoBroadcast(); virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm ); diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx index bbf9abdc4..3843c7642 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx @@ -534,7 +534,7 @@ Reference < XHyphenatedWord > SAL_CALL Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const ::rtl::OUString& aWord, const ::com::sun::star::lang::Locale& aLocale, - const ::com::sun::star::beans::PropertyValues& /*aProperties*/ ) + const ::com::sun::star::beans::PropertyValues& aProperties ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) @@ -544,6 +544,10 @@ Reference< XPossibleHyphens > SAL_CALL char *lcword; int k; + PropertyHelper_Hyphen & rHelper = GetPropHelper();
+ rHelper.SetTmpPropVals(aProperties);
+ sal_Int16 minTrail = rHelper.GetMinTrailing();
+ sal_Int16 minLead = rHelper.GetMinLeading();
HyphenDict *dict = NULL; rtl_TextEncoding aEnc = 0; @@ -617,6 +621,9 @@ Reference< XPossibleHyphens > SAL_CALL wordlen = encWord.getLength(); lcword = new char[wordlen+1]; hyphens = new char[wordlen+5]; + char ** rep = NULL; // replacements of discretionary hyphenation
+ int * pos = NULL; // array of [hyphenation point] minus [deletion position]
+ int * cut = NULL; // length of deletions in original word
// copy converted word into simple char buffer strcpy(lcword,encWord.getStr()); @@ -627,10 +634,22 @@ Reference< XPossibleHyphens > SAL_CALL n++; // fprintf(stderr,"hyphenate... %s\n",lcword); fflush(stderr); if (n > 0) { - if (hnj_hyphen_hyphenate(dict, lcword, n, hyphens)) + if (hnj_hyphen_hyphenate3(dict, lcword, n, hyphens, NULL, &rep, &pos, &cut,
+ minLead, minTrail, Max(dict->clhmin, Max(dict->clhmin, 2) + Max(0, minLead - Max(dict->lhmin, 2))),
+ Max(dict->crhmin, Max(dict->crhmin, 2) + Max(0, minTrail - Max(dict->rhmin, 2)))))
{ delete[] hyphens; delete[] lcword; +
+ if (rep) {
+ for(int j = 0; j < n; j++) {
+ if (rep[j]) free(rep[j]);
+ }
+ free(rep);
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
+ return NULL; } } @@ -643,7 +662,7 @@ Reference< XPossibleHyphens > SAL_CALL INT16 i; for ( i = 0; i < encWord.getLength(); i++) - if (hyphens[i]&1) + if (hyphens[i]&1 && (!rep || !rep[i]))
nHyphCount++; Sequence< INT16 > aHyphPos(nHyphCount); @@ -652,15 +671,14 @@ Reference< XPossibleHyphens > SAL_CALL OUString hyphenatedWord; nHyphCount = 0; - for (i = 0; i < encWord.getLength(); i++) - { + for (i = 0; i < nWord.getLength(); i++) {
hyphenatedWordBuffer.append(aWord[i]); - if (hyphens[i]&1) - { - pPos[nHyphCount] = i; - hyphenatedWordBuffer.append(sal_Unicode('=')); - nHyphCount++; - } + // hyphenation position (not alternative)
+ if (hyphens[i]&1 && (!rep || !rep[i])) {
+ pPos[nHyphCount] = i;
+ hyphenatedWordBuffer.append(sal_Unicode('='));
+ nHyphCount++;
+ }
} hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear(); @@ -672,6 +690,16 @@ Reference< XPossibleHyphens > SAL_CALL delete[] hyphens; delete[] lcword; +
+ if (rep) {
+ for(int j = 0; j < n; j++) {
+ if (rep[j]) free(rep[j]);
+ }
+ free(rep);
+ }
+ if (pos) free(pos);
+ if (cut) free(cut);
+ return xRes; } diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 3e1c615d8..874efb711 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1370,6 +1370,16 @@ void SAL_CALL ZipPackage::commitChanges() { uno::Reference< io::XSeekable > xTempSeek( xTempInStream, uno::UNO_QUERY_THROW ); + try + { + xTempSeek->seek( 0 ); + } + catch( uno::Exception& r ) + { + throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Temporary file should be seekable!" ) ), + static_cast < OWeakObject * > ( this ), makeAny ( r ) ); + } + // switch to the new temporary stream only after the transfer PostinitializationGuard aPostInitGuard( xTempInStream, *this ); @@ -1381,8 +1391,6 @@ void SAL_CALL ZipPackage::commitChanges() // preparation for copy step try { - xTempSeek->seek( 0 ); - xOutputStream = m_xStream->getOutputStream(); uno::Reference < XTruncate > xTruncate ( xOutputStream, UNO_QUERY ); if ( !xTruncate.is() ) diff --git a/setup_native/prj/build.lst b/setup_native/prj/build.lst index 05200fdf9..ad7d365c3 100644 --- a/setup_native/prj/build.lst +++ b/setup_native/prj/build.lst @@ -9,6 +9,7 @@ pk setup_native\source\win32\customactions\rebase nmake - w sn_reba pk setup_native\source\win32\customactions\regactivex nmake - w sn_regactivex NULL pk setup_native\source\win32\customactions\regpatchactivex nmake - w sn_regpatchactivex NULL pk setup_native\source\win32\customactions\reg4allmsdoc nmake - w sn_reg4allmsdoc NULL +pk setup_native\source\win32\customactions\reg64 nmake - w sn_reg64 NULL pk setup_native\source\win32\customactions\javafilter nmake - w sn_javafilter NULL pk setup_native\source\win32\customactions\quickstarter nmake - w sn_quickstarter NULL pk setup_native\source\win32\customactions\shellextensions nmake - w sn_shellextensions sn_tools.w NULL diff --git a/setup_native/source/java/javaversion.dat b/setup_native/source/java/javaversion.dat index 87172c3a6..7ff47b499 100755 --- a/setup_native/source/java/javaversion.dat +++ b/setup_native/source/java/javaversion.dat @@ -30,30 +30,30 @@ #************************************************************************* # GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") -JAVAVERSION=Java 6 Update 16 -WINDOWSJAVAVERSION=Java 6 Update 16 +JAVAVERSION=Java 6 Update 17 +WINDOWSJAVAVERSION=Java 6 Update 17 # Windows (scp2 and downloadtemplate.nsi) -WINDOWSJAVAFILENAME=jre-6u16-windows-i586.exe -WINDOWSJAVAREGISTRYENTRY=1.6.0_16 +WINDOWSJAVAFILENAME=jre-6u17-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_17 # Linux (scp2) -LINUXJAVAFILENAME=jre-6u16-linux-i586.rpm +LINUXJAVAFILENAME=jre-6u17-linux-i586.rpm # Linux (rpmUnit.xml, rpm -qp <filename> ) -LINUXJAVANAME=jre-1.6.0_16-fcs +LINUXJAVANAME=jre-1.6.0_17-fcs # Linux-x64 (scp2) -LINUXX64JAVAFILENAME=jre-6u16-linux-amd64.rpm +LINUXX64JAVAFILENAME=jre-6u17-linux-amd64.rpm # Solaris Sparc (scp2) -SOLSJAVARTPACKED=SUNWj6rt_1_6_0_16_sparc.tar.gz -SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_16_sparc.tar.gz -SOLSJAVAMANPACKED=SUNWj6man_1_6_0_16_sparc.tar.gz +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_17_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_17_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_17_sparc.tar.gz # Solaris x86 (scp2) -SOLIJAVARTPACKED=SUNWj6rt_1_6_0_16_x86.tar.gz -SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_16_x86.tar.gz -SOLIJAVAMANPACKED=SUNWj6man_1_6_0_16_x86.tar.gz +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_17_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_17_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_17_x86.tar.gz # Solaris (pkgUnit.xml, needs only to be changed in major changes) SOLARISJAVART=SUNWj6rt diff --git a/setup_native/source/java/javaversion2.dat b/setup_native/source/java/javaversion2.dat index 87172c3a6..7ff47b499 100644 --- a/setup_native/source/java/javaversion2.dat +++ b/setup_native/source/java/javaversion2.dat @@ -30,30 +30,30 @@ #************************************************************************* # GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})") -JAVAVERSION=Java 6 Update 16 -WINDOWSJAVAVERSION=Java 6 Update 16 +JAVAVERSION=Java 6 Update 17 +WINDOWSJAVAVERSION=Java 6 Update 17 # Windows (scp2 and downloadtemplate.nsi) -WINDOWSJAVAFILENAME=jre-6u16-windows-i586.exe -WINDOWSJAVAREGISTRYENTRY=1.6.0_16 +WINDOWSJAVAFILENAME=jre-6u17-windows-i586.exe +WINDOWSJAVAREGISTRYENTRY=1.6.0_17 # Linux (scp2) -LINUXJAVAFILENAME=jre-6u16-linux-i586.rpm +LINUXJAVAFILENAME=jre-6u17-linux-i586.rpm # Linux (rpmUnit.xml, rpm -qp <filename> ) -LINUXJAVANAME=jre-1.6.0_16-fcs +LINUXJAVANAME=jre-1.6.0_17-fcs # Linux-x64 (scp2) -LINUXX64JAVAFILENAME=jre-6u16-linux-amd64.rpm +LINUXX64JAVAFILENAME=jre-6u17-linux-amd64.rpm # Solaris Sparc (scp2) -SOLSJAVARTPACKED=SUNWj6rt_1_6_0_16_sparc.tar.gz -SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_16_sparc.tar.gz -SOLSJAVAMANPACKED=SUNWj6man_1_6_0_16_sparc.tar.gz +SOLSJAVARTPACKED=SUNWj6rt_1_6_0_17_sparc.tar.gz +SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_17_sparc.tar.gz +SOLSJAVAMANPACKED=SUNWj6man_1_6_0_17_sparc.tar.gz # Solaris x86 (scp2) -SOLIJAVARTPACKED=SUNWj6rt_1_6_0_16_x86.tar.gz -SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_16_x86.tar.gz -SOLIJAVAMANPACKED=SUNWj6man_1_6_0_16_x86.tar.gz +SOLIJAVARTPACKED=SUNWj6rt_1_6_0_17_x86.tar.gz +SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_17_x86.tar.gz +SOLIJAVAMANPACKED=SUNWj6man_1_6_0_17_x86.tar.gz # Solaris (pkgUnit.xml, needs only to be changed in major changes) SOLARISJAVART=SUNWj6rt diff --git a/setup_native/source/win32/customactions/reg64/exports.dxp b/setup_native/source/win32/customactions/reg64/exports.dxp new file mode 100755 index 000000000..3282da1ee --- /dev/null +++ b/setup_native/source/win32/customactions/reg64/exports.dxp @@ -0,0 +1,2 @@ +InstallReg64 +DeinstallReg64 diff --git a/setup_native/source/win32/customactions/reg64/makefile.mk b/setup_native/source/win32/customactions/reg64/makefile.mk new file mode 100755 index 000000000..17c56716a --- /dev/null +++ b/setup_native/source/win32/customactions/reg64/makefile.mk @@ -0,0 +1,112 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.20 $ +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/..$/.. +PRJNAME=setup_native +TARGET=reg64msi + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=TRUE +NO_DEFAULT_STL=TRUE +DYNAMIC_CRT= +USE_DEFFILE=TRUE +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +.INCLUDE : settings.mk + +.IF "$(USE_SYSTEM_STL)" != "YES" +CFLAGS+=-D_STLP_USE_STATIC_LIB +.ENDIF + +#Disable precompiled header +CDEFS+=-Dnot_used_define_to_disable_pch + +# --- Files -------------------------------------------------------- + +.IF "$(GUI)"=="WNT" + +UWINAPILIB= + +SLOFILES = \ + $(SLO)$/reg64.obj + +STDSHL += \ + $(KERNEL32LIB)\ + $(USER32LIB)\ + $(ADVAPI32LIB)\ + $(SHELL32LIB)\ + $(MSILIB)\ + $(SHLWAPILIB)\ + +# msvcprt.lib + +SHL1TARGET = $(TARGET) +SHL1IMPLIB = i$(TARGET) + +SHL1OBJS=$(SLOFILES) +SHL1DEF = $(MISC)$/$(SHL1TARGET).def +SHL1DEPN = $(SLB)$/$(TARGET).lib +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + + +# --- mapimailer -------------------------------------------------------- + +#TARGETTYPE=CUI + +#OBJFILES= $(OBJ)$/reg64.obj + +#APP1TARGET=reg64 +#APP1OBJS=$(OBJFILES) +#APP1STDLIBS=$(KERNEL32LIB)\ +# $(ADVAPI32LIB)\ +# $(MSILIB)\ +# $(SHELL32LIB)\ +# msvcprt.lib\ +# $(OLE32LIB)\ +# $(COMCTL32LIB)\ +# $(UUIDLIB) + + +#APP1DEF=$(MISC)$/$(APP1TARGET).def + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk +INCLUDE!:=$(subst,/stl, $(INCLUDE)) +.EXPORT : INCLUDE + +# ------------------------------------------------------------------------- + + diff --git a/setup_native/source/win32/customactions/reg64/reg64.cxx b/setup_native/source/win32/customactions/reg64/reg64.cxx new file mode 100755 index 000000000..c2e316bc6 --- /dev/null +++ b/setup_native/source/win32/customactions/reg64/reg64.cxx @@ -0,0 +1,474 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2008 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: shellextensions.cxx,v $ +* $Revision: 1.7 $ +* +* 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. +* +************************************************************************/ + +/* + +*/ + + +#define UNICODE + +#ifdef _MSC_VER +#pragma warning(push, 1) /* disable warnings within system headers */ +#endif +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#include <malloc.h> +//#include <string> +//#include <map>
+#include <strsafe.h> + +// 10.11.2009 tkr: MinGW doesn't know anything about RegDeleteKeyExW if WINVER < 0x0502. +WINADVAPI LONG WINAPI RegDeleteKeyExW(HKEY,LPCWSTR,REGSAM,DWORD); + +// 06.11.2009 tkr: to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY +// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. +// Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and +// extensions\source\activex\main\so_activex.cpp +#ifndef KEY_WOW64_64KEY + #define KEY_WOW64_64KEY (0x0100) +#endif + + +#define TABLE_NAME L"Reg64" +#define BASISINSTALLLOCATION L"[BASISINSTALLLOCATION]" + +bool isInstall4AllUsers; +wchar_t * sBasisInstallLocation; + + +enum OPERATION { + SET, + REMOVE +}; + +#ifdef DEBUG +inline void OutputDebugStringFormat( const wchar_t* pFormat, ... ) +{ + wchar_t buffer[1024]; + va_list args; + + va_start( args, pFormat ); + StringCchVPrintf( buffer, sizeof(buffer), pFormat, args ); + OutputDebugString( buffer ); +} +#else +static inline void OutputDebugStringFormat( const wchar_t*, ... ) +{ +} +#endif + +bool WriteRegistry( MSIHANDLE & hMSI, OPERATION op, const wchar_t* componentName) +{ + INSTALLSTATE current_state; + INSTALLSTATE comp_state; + UINT ret = MsiGetComponentState( hMSI, componentName, ¤t_state, &comp_state ); + if ( ERROR_SUCCESS == ret ) + { + if (current_state == INSTALLSTATE_ABSENT) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_ABSENT"); + else if (current_state == INSTALLSTATE_DEFAULT) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_DEFAULT"); + else if (current_state == INSTALLSTATE_LOCAL) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_LOCAL"); + else if (current_state == INSTALLSTATE_REMOVED) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_REMOVED"); + else if (current_state == INSTALLSTATE_SOURCE) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_SOURCE"); + else if (current_state == INSTALLSTATE_UNKNOWN) + OutputDebugStringFormat(L"WriteRegistry - current_state: INSTALLSTATE_UNKNOWN"); + + if (comp_state == INSTALLSTATE_ABSENT) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_ABSENT"); + else if (comp_state == INSTALLSTATE_DEFAULT) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_DEFAULT"); + else if (comp_state == INSTALLSTATE_LOCAL) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_LOCAL"); + else if (comp_state == INSTALLSTATE_REMOVED) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_REMOVED"); + else if (comp_state == INSTALLSTATE_SOURCE) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_SOURCE"); + else if (comp_state == INSTALLSTATE_UNKNOWN) + OutputDebugStringFormat(L"WriteRegistry - comp_state: INSTALLSTATE_UNKNOWN"); + + switch (op) + { + case SET : + if ( comp_state == INSTALLSTATE_LOCAL || ( current_state == INSTALLSTATE_LOCAL && comp_state == INSTALLSTATE_UNKNOWN ) ) + { + return true; + } + break; + case REMOVE: + OutputDebugStringFormat(L"WriteRegistry - Remove\n" ); + if ( current_state == INSTALLSTATE_LOCAL && (comp_state == INSTALLSTATE_ABSENT || comp_state == INSTALLSTATE_REMOVED) ) + { + OutputDebugStringFormat(L"WriteRegistry - To be removed\n" ); + return true; + } + } + } else + { + if (ERROR_INVALID_HANDLE == ret) OutputDebugStringFormat(L"WriteRegistry - Invalid handle"); + if (ERROR_UNKNOWN_FEATURE == ret) OutputDebugStringFormat(L"WriteRegistry - Unknown feature"); + } + + return false; +} + +BOOL UnicodeEquals( wchar_t* pStr1, wchar_t* pStr2 ) +{ + if ( pStr1 == NULL && pStr2 == NULL ) + return TRUE; + else if ( pStr1 == NULL || pStr2 == NULL ) + return FALSE; + + while( *pStr1 == *pStr2 && *pStr1 && *pStr2 ) + pStr1++, pStr2++; + + return ( *pStr1 == 0 && *pStr2 == 0 ); +} + +BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) +{ + OutputDebugStringFormat(L"GetMsiProp - START\n" ); + DWORD sz = 0; + UINT ret = MsiGetProperty( hMSI, pPropName, L"", &sz ); + if ( ret == ERROR_MORE_DATA ) + { + sz++; + DWORD nbytes = sz * sizeof( wchar_t ); + wchar_t* buff = reinterpret_cast<wchar_t*>( malloc( nbytes ) ); + ZeroMemory( buff, nbytes ); + MsiGetProperty( hMSI, pPropName, buff, &sz ); + + OutputDebugStringFormat(L"GetMsiProp - Value" ); + OutputDebugStringFormat( buff ); + *ppValue = buff; + + return TRUE; + } else if (ret == ERROR_INVALID_HANDLE) + { + OutputDebugStringFormat(L"GetMsiProp - ERROR_INVALID_HANDLE" ); + } else if (ret == ERROR_INVALID_PARAMETER) + { + OutputDebugStringFormat(L"GetMsiProp - ERROR_INVALID_PARAMETER" ); + } else if (ret == ERROR_SUCCESS) + { + OutputDebugStringFormat(L"GetMsiProp - ERROR_SUCCESS" ); + } + + + OutputDebugStringFormat(L"GetMsiProp - ENDE\n" ); + return FALSE; +} + +bool IsInstallForAllUsers( MSIHANDLE hMSI ) +{ + OutputDebugStringFormat(L"IsInstallForAllUsers - START\n" ); + bool bResult = FALSE; + wchar_t* pVal = NULL; + if ( GetMsiProp( hMSI, L"ALLUSERS", &pVal ) && pVal ) + { + bResult = UnicodeEquals( pVal , L"1" ); + free( pVal ); + } + + OutputDebugStringFormat(L"IsInstallForAllUsers - ENDE\n" ); + return bResult; +} + +wchar_t* GetBasisInstallLocation( MSIHANDLE hMSI ) +{ + OutputDebugStringFormat(L"GetBasisInstallLocation - START\n" ); + bool bResult = FALSE; + wchar_t* pVal = NULL; + GetMsiProp( hMSI, L"BASISINSTALLLOCATION", &pVal); + + OutputDebugStringFormat(L"GetBasisInstallLocation - ENDE\n" ); + return pVal; +} + + +bool QueryReg64Table(MSIHANDLE& rhDatabase, MSIHANDLE& rhView) +{ + OutputDebugStringFormat(L"QueryReg64Table - START\n" ); + int const arraysize = 400; + wchar_t szSelect[arraysize]; + StringCbPrintfW(szSelect, arraysize * sizeof(wchar_t), L"SELECT * FROM %s",TABLE_NAME);
+ OutputDebugStringFormat( szSelect );
+
+ UINT ret = MsiDatabaseOpenView(rhDatabase,szSelect,&rhView);
+ if (ret != ERROR_SUCCESS)
+ {
+ if ( ret == ERROR_BAD_QUERY_SYNTAX)
+ OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_BAD_QUERY_SYNTAX\n" );
+ if ( ret == ERROR_INVALID_HANDLE)
+ OutputDebugStringFormat(L"QueryReg64Table - MsiDatabaseOpenView - FAILED - ERROR_INVALID_HANDLE\n" );
+ return false;
+ }
+ // execute query - not a parameter query so second parameter is NULL.
+ if (MsiViewExecute(rhView,NULL) != ERROR_SUCCESS)
+ {
+ OutputDebugStringFormat(L"QueryReg64Table - MsiViewExecute - FAILED\n" );
+ return false;
+ }
+ + OutputDebugStringFormat(L"QueryReg64Table - ENDE\n" ); + return true; +} + +//--------------------------------------- +bool DeleteRegistryKey(HKEY RootKey, const wchar_t* KeyName) +{ + int rc = RegDeleteKeyExW( + RootKey, KeyName, KEY_WOW64_64KEY, 0); + + return (ERROR_SUCCESS == rc); +} + + + + +//--------------------------------------- +// +//--------------------------------------- + +bool SetRegistryKey(HKEY RootKey, const wchar_t* KeyName, const wchar_t* ValueName, const wchar_t* Value) +{ + HKEY hSubKey; + + // open or create the desired key + int rc = RegCreateKeyEx( + RootKey, KeyName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_WOW64_64KEY, 0, &hSubKey, 0); + + if (ERROR_SUCCESS == rc) + { + OutputDebugStringFormat(L"SetRegistryKey - Created\n" ); + rc = RegSetValueEx( + hSubKey, ValueName, 0, REG_SZ, reinterpret_cast<const BYTE*>(Value), (wcslen(Value) + 1) * sizeof(wchar_t)); + + RegCloseKey(hSubKey); + } else { + OutputDebugStringFormat(L"SetRegistryKey - FAILED\n" ); + } + + + return (ERROR_SUCCESS == rc); +} + +bool DoRegEntries( MSIHANDLE& rhMSI, OPERATION op, MSIHANDLE& rhView) +{ + OutputDebugStringFormat(L"DoRegEntries - START\n" ); + + MSIHANDLE hRecord; + + long lRoot;
+ wchar_t szKey[255];
+ wchar_t szName[255];
+ wchar_t szValue[1024];
+ wchar_t szComponent[255];
+ + /// read records until there are no more records
+ while (MsiViewFetch(rhView,&hRecord) == ERROR_SUCCESS)
+ {
+ DWORD dwKey = 255;
+ DWORD dwName = 255;
+ DWORD dwValue = 1024;
+ DWORD dwComponent = 255;
+
+ szKey[0] = '\0';
+ szName[0] = '\0';
+ szValue[0] = '\0';
+ szComponent[0] = '\0';
+
+ lRoot = MsiRecordGetInteger(hRecord,2);
+ MsiRecordGetString(hRecord,3,szKey,&dwKey);
+
+ if (!MsiRecordIsNull(hRecord, 4))
+ MsiRecordGetString(hRecord,4,szName,&dwName);
+
+ if (!MsiRecordIsNull(hRecord, 5))
+ {
+ MsiRecordGetString(hRecord,5,szValue,&dwValue);
+
+
+
+ wchar_t* nPos = wcsstr(szValue , BASISINSTALLLOCATION);
+ if ( NULL != nPos)
+ {
+
+ DWORD nPrefixSize = nPos - szValue;
+
+ DWORD nPropSize = wcslen(sBasisInstallLocation);
+ DWORD nPostfixSize = dwValue - wcslen( BASISINSTALLLOCATION );
+
+ DWORD nNewValueBytes = (nPropSize + nPostfixSize + 1) * sizeof( wchar_t ); + wchar_t* newValue = reinterpret_cast<wchar_t*>( malloc( nNewValueBytes ) ); + ZeroMemory( newValue, nNewValueBytes );
+
+ // prefix
+ wcsncpy(newValue, szValue, nPrefixSize);
+
+ // basis location
+ wcsncat(newValue, sBasisInstallLocation, nPropSize * sizeof( wchar_t ));
+
+ // postfix
+ wcsncat(newValue, nPos + ( wcslen( BASISINSTALLLOCATION ) ), nPropSize * sizeof( wchar_t ));
+
+ wcsncpy(szValue, newValue, nNewValueBytes <=1024? nNewValueBytes: 1024);
+
+ free(newValue);
+ }
+
+ }
+
+
+ MsiRecordGetString(hRecord,6,szComponent,&dwComponent);
+
+ OutputDebugStringFormat(L"****** DoRegEntries *******" );
+ OutputDebugStringFormat(L"Root:" );
+ HKEY key = HKEY_CURRENT_USER;
+ switch (lRoot)
+ {
+ case(-1):
+ if (isInstall4AllUsers)
+ {
+ key = HKEY_CURRENT_USER;
+ OutputDebugStringFormat(L"HKEY_CURRENT_USER" );
+ }
+ else
+ {
+ key = HKEY_LOCAL_MACHINE;
+ OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" );
+ }
+ break;
+ case(0):
+ key = HKEY_CLASSES_ROOT;
+ OutputDebugStringFormat(L"HKEY_CLASSES_ROOT" );
+ break;
+ case(1):
+ key = HKEY_CURRENT_USER;
+ OutputDebugStringFormat(L"HKEY_CURRENT_USER" );
+ break;
+ case(2):
+ key = HKEY_LOCAL_MACHINE;
+ OutputDebugStringFormat(L"HKEY_LOCAL_MACHINE" );
+ break;
+ case(3):
+ key = HKEY_USERS;
+ OutputDebugStringFormat(L"HKEY_USERS" );
+ break;
+
+ }
+
+ OutputDebugStringFormat(L"Key:");
+ OutputDebugStringFormat( szKey );
+ OutputDebugStringFormat(L"Name:");
+ OutputDebugStringFormat( szName );
+ OutputDebugStringFormat(L"Value:");
+ OutputDebugStringFormat( szValue);
+ OutputDebugStringFormat(L"Component:");
+ OutputDebugStringFormat( szComponent );
+ OutputDebugStringFormat(L"*******************" );
+ switch (op)
+ {
+ case SET:
+
+ if (WriteRegistry(rhMSI, SET, szComponent))
+ {
+ OutputDebugStringFormat(L"DoRegEntries - Write\n" );
+ SetRegistryKey(key, szKey, szName, szValue);
+ }
+ break;
+ case REMOVE:
+ OutputDebugStringFormat(L"DoRegEntries - PreRemove\n" );
+ if (WriteRegistry(rhMSI, REMOVE, szComponent))
+ {
+ OutputDebugStringFormat(L"DoRegEntries - Remove\n" );
+ DeleteRegistryKey(key, szKey);
+ }
+ break;
+ }
+ }
+
+ MsiCloseHandle(rhView);
+ + + OutputDebugStringFormat(L"DoRegEntries - ENDE\n" ); + + return true; +} + + +bool Reg64(MSIHANDLE& rhMSI, OPERATION op) +{ + isInstall4AllUsers = IsInstallForAllUsers(rhMSI); + sBasisInstallLocation = GetBasisInstallLocation(rhMSI);
+
+ if (NULL == sBasisInstallLocation)
+ {
+ OutputDebugStringFormat(L"BASISINSTALLLOCATION is NULL\n" );
+ return false;
+ }
+ + MSIHANDLE hView; + MSIHANDLE hDatabase = MsiGetActiveDatabase(rhMSI); + + QueryReg64Table(hDatabase, hView); + OutputDebugStringFormat(L"Do something\n" ); + DoRegEntries( rhMSI, op, hView); + OutputDebugStringFormat(L"Something done\n" ); + + MsiCloseHandle(hView); + MsiCloseHandle(hDatabase); + free(sBasisInstallLocation); + + return true; +} + +extern "C" UINT __stdcall InstallReg64(MSIHANDLE hMSI) +{ + OutputDebugStringFormat(L"InstallReg64\n" ); + Reg64(hMSI, SET); + return ERROR_SUCCESS; +} + +extern "C" UINT __stdcall DeinstallReg64(MSIHANDLE hMSI) +{ + OutputDebugStringFormat(L"DeinstallReg64\n" ); + Reg64(hMSI, REMOVE); + return ERROR_SUCCESS; +}
\ No newline at end of file diff --git a/setup_native/source/win32/customactions/regactivex/regactivex.cxx b/setup_native/source/win32/customactions/regactivex/regactivex.cxx index 77971738f..f057829be 100644 --- a/setup_native/source/win32/customactions/regactivex/regactivex.cxx +++ b/setup_native/source/win32/customactions/regactivex/regactivex.cxx @@ -51,8 +51,8 @@ // #define OWN_DEBUG_PRINT -typedef int ( __stdcall * DllNativeRegProc ) ( int, BOOL, const char* ); -typedef int ( __stdcall * DllNativeUnregProc ) ( int, BOOL ); +typedef int ( __stdcall * DllNativeRegProc ) ( int, BOOL, BOOL, const char* ); +typedef int ( __stdcall * DllNativeUnregProc ) ( int, BOOL, BOOL ); BOOL UnicodeEquals( wchar_t* pStr1, wchar_t* pStr2 ) { @@ -90,7 +90,7 @@ void WarningMessageInt( wchar_t* pWarning, unsigned int nValue ) #endif //---------------------------------------------------------- -void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser ) +void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit ) { #ifdef OWN_DEBUG_PRINT MessageBoxW(NULL, L"RegisterActiveXNative", L"Information", MB_OK | MB_ICONINFORMATION); @@ -112,7 +112,18 @@ void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallFor #ifdef OWN_DEBUG_PRINT MessageBoxA(NULL, pActiveXPath, "Library Path", MB_OK | MB_ICONINFORMATION); #endif - ( *pNativeProc )( nMode, InstallForAllUser, pActiveXPath ); + int nLen = strlen( pActiveXPath ); + int nRemoveLen = strlen( "\\so_activex.dll" ); + if ( nLen > nRemoveLen ) + { + char* pProgramPath = reinterpret_cast<char*>( malloc( nLen - nRemoveLen + 1 ) ); + strncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen ); + pProgramPath[ nLen - nRemoveLen ] = 0; + + ( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit, pProgramPath ); + + free( pProgramPath ); + } } FreeLibrary( hModule ); @@ -120,7 +131,7 @@ void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallFor } //---------------------------------------------------------- -void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser ) +void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit ) { // For Win98/WinME the values should be written to the local machine OSVERSIONINFO aVerInfo; @@ -133,7 +144,7 @@ void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallF { DllNativeUnregProc pNativeProc = ( DllNativeUnregProc )GetProcAddress( hModule, "DllUnregisterServerNative" ); if( pNativeProc!=NULL ) - ( *pNativeProc )( nMode, InstallForAllUser ); + ( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit ); FreeLibrary( hModule ); } @@ -162,7 +173,7 @@ BOOL GetMsiProp( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue ) BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath ) { wchar_t* pProgPath = NULL; - if ( GetMsiProp( hMSI, L"BASISINSTALLLOCATION", &pProgPath ) && pProgPath ) + if ( GetMsiProp( hMSI, L"OFFICEINSTALLLOCATION", &pProgPath ) && pProgPath ) { char* pCharProgPath = UnicodeToAnsiString( pProgPath ); #ifdef OWN_DEBUG_PRINT @@ -313,6 +324,19 @@ BOOL MakeInstallForAllUsers( MSIHANDLE hMSI ) } //---------------------------------------------------------- +BOOL MakeInstallFor64Bit( MSIHANDLE hMSI ) +{ + BOOL bResult = FALSE; + wchar_t* pVal = NULL; + if ( GetMsiProp( hMSI, L"VersionNT64", &pVal ) && pVal ) + { + bResult = TRUE; + free( pVal ); + } + + return bResult; +} +//---------------------------------------------------------- extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI ) { int nOldInstallMode = 0; @@ -333,6 +357,8 @@ extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI ) #endif BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI ); + BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI ); + char* pActiveXPath = NULL; if ( GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath && GetDelta( hMSI, nOldInstallMode, nInstallMode, nDeinstallMode ) ) @@ -351,10 +377,10 @@ extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI ) // the control is installed in the new selected configuration if ( current_state == INSTALLSTATE_LOCAL && nDeinstallMode ) - UnregisterActiveXNative( pActiveXPath, nDeinstallMode, bInstallForAllUser ); + UnregisterActiveXNative( pActiveXPath, nDeinstallMode, bInstallForAllUser, bInstallFor64Bit ); if ( nInstallMode ) - RegisterActiveXNative( pActiveXPath, nInstallMode, bInstallForAllUser ); + RegisterActiveXNative( pActiveXPath, nInstallMode, bInstallForAllUser, bInstallFor64Bit ); } else if ( current_state == INSTALLSTATE_LOCAL && future_state == INSTALLSTATE_ABSENT ) { @@ -362,7 +388,7 @@ extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI ) MessageBox(NULL, L"InstallActiveXControl, removing", L"Information", MB_OK | MB_ICONINFORMATION); #endif if ( nOldInstallMode ) - UnregisterActiveXNative( pActiveXPath, nOldInstallMode, bInstallForAllUser ); + UnregisterActiveXNative( pActiveXPath, nOldInstallMode, bInstallForAllUser, bInstallFor64Bit ); } } @@ -393,6 +419,7 @@ extern "C" UINT __stdcall DeinstallActiveXControl( MSIHANDLE hMSI ) if ( current_state == INSTALLSTATE_LOCAL && GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath ) { BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI ); + BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI ); { UnregisterActiveXNative( pActiveXPath, @@ -402,7 +429,8 @@ extern "C" UINT __stdcall DeinstallActiveXControl( MSIHANDLE hMSI ) | CALC_COMPONENT | WRITER_COMPONENT | MATH_COMPONENT, - bInstallForAllUser ); + bInstallForAllUser, + bInstallFor64Bit ); } free( pActiveXPath ); diff --git a/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx b/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx index 9c3665f41..396c38d26 100644 --- a/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx +++ b/setup_native/source/win32/customactions/shellextensions/shellextensions.cxx @@ -102,23 +102,96 @@ RegistryEntry InfotipHandler = { TEXT("{087B3AE3-E237-4467-B8DB-5A38AB959AC9}"), RegistryEntry PropHandler = { TEXT("{63542C48-9552-494A-84F7-73AA6A7C99C1}"), TEXT("OpenOffice.org Property Sheet Handler") }; RegistryEntry ThumbViewer = { TEXT("{3B092F0C-7696-40E3-A80F-68D74DA84210}"), TEXT("OpenOffice.org Thumbnail Viewer") }; +BOOL GetMsiProp( MSIHANDLE hMSI, const char* pPropName, char** ppValue ) +{ + DWORD sz = 0; + if ( MsiGetProperty( hMSI, pPropName, 0, &sz ) == ERROR_MORE_DATA ) + { + sz++; + DWORD nbytes = sz * sizeof( char ); + char* buff = reinterpret_cast<char*>( malloc( nbytes ) ); + ZeroMemory( buff, nbytes ); + MsiGetProperty( hMSI, pPropName, buff, &sz ); + *ppValue = buff; + + return TRUE; + } + + return FALSE; +} + +bool IsVersionNT64( MSIHANDLE hMSI ) +{ + char* pVal = NULL; + + if ( GetMsiProp( hMSI, "VersionNT64", &pVal ) && pVal ) + { + free( pVal ); + return true; + } + + return false; +} + + + + /* Called during installation when the module "Windows Explorer Extensions" is selected. */ -extern "C" UINT __stdcall InstallExecSequenceEntry(MSIHANDLE) +extern "C" UINT __stdcall InstallExecSequenceEntry(MSIHANDLE hMSI) { //MessageBox(NULL, TEXT("InstallExecSequenceEntry"), TEXT("Pythonmsi"), MB_OK | MB_ICONINFORMATION); HKEY hKey; - if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"), &hKey) == ERROR_SUCCESS) - { - RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); - RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); - RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); - RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); - - RegCloseKey(hKey); - } + + +// 06.11.2009 tkr: to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY +// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems. +// Also defined in setup_native\source\win32\customactions\reg64\reg64.cxx,source\win32\customactions\shellextensions\shellextensions.cxx and +// extensions\source\activex\main\so_activex.cpp +#ifndef KEY_WOW64_64KEY + #define KEY_WOW64_64KEY (0x0100) +#endif + + if (IsVersionNT64(hMSI)) + { + // Open Windows 64 Bit Registry + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),0, KEY_WRITE | KEY_WOW64_64KEY, &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } + + // Open Windows 32 Bit Registry on Win64 maschine + + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),0, KEY_WRITE, &hKey ) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } + + + } else + { + if (RegOpenKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"), &hKey) == ERROR_SUCCESS) + { + RegSetValueEx(hKey, ColumnHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ColumnHandler.Value), _tcslen(ColumnHandler.Value) + 1); + RegSetValueEx(hKey, InfotipHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(InfotipHandler.Value), _tcslen(InfotipHandler.Value) + 1); + RegSetValueEx(hKey, PropHandler.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(PropHandler.Value), _tcslen(PropHandler.Value) + 1); + RegSetValueEx(hKey, ThumbViewer.Key, 0, REG_SZ, reinterpret_cast<const BYTE*>(ThumbViewer.Value), _tcslen(ThumbViewer.Value) + 1); + + RegCloseKey(hKey); + } + } return ERROR_SUCCESS; } diff --git a/setup_native/source/win32/msi-encodinglist.txt b/setup_native/source/win32/msi-encodinglist.txt index ad3f1fb15..81258d61f 100644 --- a/setup_native/source/win32/msi-encodinglist.txt +++ b/setup_native/source/win32/msi-encodinglist.txt @@ -4,6 +4,8 @@ af 1252 1078 # Afrikaans ar 1256 1025 ar-SA 1256 1025 as-IN 0 1101 # Assamese +as 0 1101 # Assamese +ast 1252 1610 be-BY 1251 1059 # Belarusian bg 1251 1026 # Bulgarian bn 0 2117 # Bengali @@ -12,6 +14,7 @@ bn-IN 0 1093 # Bengali India br 1252 1150 # Breton brx 0 1603 # Bodo (India) bs 0 5146 # bosnian +bo 0 2121 ca 1252 1027 # Catalan cs 1250 1029 # Czech cy 1252 1106 # Welsh @@ -55,12 +58,15 @@ ko 949 1042 kok 0 1111 # Konkani ks 0 1120 # Kashmiri ku 0 1574 +kid 1252 1033 # key id pseudo language +ky 0 2100 lo 0 1108 # Lao lt 1257 1063 # Lithuanian lv 1257 1062 # Latvian mai 0 1605 # Maithili (India) mk 1251 1071 # Macedonian ml-IN 0 1100 +ml 0 1100 mn 0 1104 # Mongolian mni 0 1112 # Manipuri mn-TR 0 2128 # Mongolian Classical/traditional @@ -80,10 +86,13 @@ or 0 1096 # Oriya oc 1252 1154 # Occitan-lengadocian or-IN 0 1096 pa-IN 0 1094 # Punjabi +pap 0 2171 +om 0 2162 pl 1250 1045 pt 1252 2070 pt-BR 1252 1046 pt-PT 1252 2070 +ps 0 2171 rm 0 1047 # Raeto-Romance ro 1250 1048 # Romanian ru 1251 1049 @@ -91,6 +100,7 @@ rw 0 1569 # Kinyarwanda sa-IN 0 1103 # Sanskrit sat 0 1606 # Santali sb 0 1070 # Sorbian +sc 0 3047 sd 0 1113 # Sindhi sh 1250 2074 # Serbian Latin sk 1250 1051 # Slovak @@ -103,9 +113,11 @@ st 0 1072 # Southern Sotho, Sutu sv 1252 1053 sw 1252 1089 # Swahili sw-TZ 1252 1089 # Swahili +si 0 2133 ta 0 1097 # Tamil ta-IN 0 1097 # Tamil te-IN 0 1098 +te 0 1098 tg 0 1064 # Tajik th 874 1054 ti-ER 0 1139 @@ -117,6 +129,7 @@ uk 1251 1058 # Ukrainian ur 1256 1056 # Urdu ur-IN 0 2080 uz 0 1091 # Uzbek (Latin) +ug 0 2200 ve 0 1075 # Venda vi 1258 1066 # Vietnamese xh 0 1076 # Xhosa |