This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new dfd77cb95f Add more official pre-commit hooks (#255) dfd77cb95f is described below commit dfd77cb95f39681a7bd112fc8597a2a1b4c9a1bb Author: John Bampton <jbamp...@users.noreply.github.com> AuthorDate: Wed Jan 29 00:10:13 2025 +1000 Add more official pre-commit hooks (#255) * Add 4 more official pre-commit hooks https://github.com/pre-commit/pre-commit-hooks * Fix mixed line endings in `cxx` and `hxx` in `main` (cherry picked from commit 36d8fc780c594694be440b5c1ccd5fd5b2911cce) --- main/basegfx/source/polygon/b2dlinegeometry.cxx | 2 +- main/cui/source/uno/services/services.cxx | 70 +- .../primitive2d/graphicprimitivehelper2d.cxx | 10 +- main/filter/source/msfilter/eschesdo.cxx | 2 +- main/sc/source/ui/view/cellsh4.cxx | 2 +- main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx | 82 +- main/sfx2/source/sidebar/PopupContainer.cxx | 108 +- main/svx/inc/svx/sidebar/Popup.hxx | 214 ++-- main/svx/source/sidebar/line/LineWidthPopup.hxx | 106 +- main/sw/source/ui/inc/textsh.hxx | 2 +- main/tools/inc/tools/color.hxx | 16 +- main/tools/source/generic/svlibrary.cxx | 208 ++-- .../inc/AccComponentEventListener.hxx | 4 +- .../inc/AccContainerEventListener.hxx | 4 +- .../inc/AccDescendantManagerEventListener.hxx | 4 +- .../inc/AccDialogEventListener.hxx | 4 +- main/winaccessibility/inc/AccEventListener.hxx | 4 +- .../winaccessibility/inc/AccFrameEventListener.hxx | 4 +- main/winaccessibility/inc/AccListEventListener.hxx | 4 +- main/winaccessibility/inc/AccMenuEventListener.hxx | 4 +- .../inc/AccObjectContainerEventListener.hxx | 4 +- .../winaccessibility/inc/AccObjectManagerAgent.hxx | 4 +- .../inc/AccParagraphEventListener.hxx | 4 +- main/winaccessibility/inc/AccResource.hxx | 4 +- .../inc/AccTextComponentEventListener.hxx | 4 +- main/winaccessibility/inc/AccTopWindowListener.hxx | 6 +- main/winaccessibility/inc/AccTreeEventListener.hxx | 4 +- .../inc/AccWindowEventListener.hxx | 4 +- main/winaccessibility/inc/ResIDGenerator.hxx | 6 +- main/winaccessibility/inc/accHelper.hxx | 30 +- main/winaccessibility/inc/act.hxx | 80 +- main/winaccessibility/inc/g_msacc.hxx | 4 +- main/winaccessibility/inc/unomsaaevent.hxx | 4 +- .../source/service/AccComponentEventListener.cxx | 12 +- .../source/service/AccContainerEventListener.cxx | 1104 ++++++++++---------- .../service/AccDescendantManagerEventListener.cxx | 12 +- .../source/service/AccDialogEventListener.cxx | 6 +- .../source/service/AccEventListener.cxx | 4 +- .../source/service/AccFrameEventListener.cxx | 16 +- .../source/service/AccListEventListener.cxx | 10 +- .../source/service/AccMenuEventListener.cxx | 6 +- .../service/AccObjectContainerEventListener.cxx | 8 +- .../source/service/AccObjectManagerAgent.cxx | 2 +- .../source/service/AccParagraphEventListener.cxx | 6 +- .../source/service/AccResource.cxx | 4 +- .../source/service/AccTableEventListener.cxx | 38 +- .../service/AccTextComponentEventListener.cxx | 6 +- .../source/service/AccTopWindowListener.cxx | 604 +++++------ .../source/service/AccTreeEventListener.cxx | 6 +- .../source/service/AccWindowEventListener.cxx | 6 +- .../source/service/ResIDGenerator.cxx | 4 +- .../source/service/msaaservice_impl.cxx | 14 +- 52 files changed, 1440 insertions(+), 1440 deletions(-) diff --git a/main/basegfx/source/polygon/b2dlinegeometry.cxx b/main/basegfx/source/polygon/b2dlinegeometry.cxx index 4b91f6439d..ead888c928 100644 --- a/main/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/main/basegfx/source/polygon/b2dlinegeometry.cxx @@ -34,7 +34,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/curve/b2dcubicbezier.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <com/sun/star/drawing/LineCap.hpp> +#include <com/sun/star/drawing/LineCap.hpp> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> ////////////////////////////////////////////////////////////////////////////// diff --git a/main/cui/source/uno/services/services.cxx b/main/cui/source/uno/services/services.cxx index 3179d2ad22..6d9fa2f7a5 100644 --- a/main/cui/source/uno/services/services.cxx +++ b/main/cui/source/uno/services/services.cxx @@ -22,38 +22,38 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cui.hxx" -#include <com/sun/star/registry/XRegistryKey.hpp> -#include "sal/types.h" -#include "cppuhelper/factory.hxx" -#include <cppuhelper/implementationentry.hxx> - -using rtl::OUString; -using namespace com::sun::star; - -namespace cui { -extern rtl::OUString SAL_CALL ColorPicker_getImplementationName(); -extern uno::Reference< uno::XInterface > SAL_CALL ColorPicker_createInstance( uno::Reference< uno::XComponentContext > const & ) SAL_THROW( (uno::Exception) ); -extern uno::Sequence< rtl::OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( uno::RuntimeException ); -} - -namespace -{ - - cppu::ImplementationEntry entries[] = { - { &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } - }; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( char const * implName, void * serviceManager, void * registryKey) -{ - return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries); -} - - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -// eof +#include <com/sun/star/registry/XRegistryKey.hpp> +#include "sal/types.h" +#include "cppuhelper/factory.hxx" +#include <cppuhelper/implementationentry.hxx> + +using rtl::OUString; +using namespace com::sun::star; + +namespace cui { +extern rtl::OUString SAL_CALL ColorPicker_getImplementationName(); +extern uno::Reference< uno::XInterface > SAL_CALL ColorPicker_createInstance( uno::Reference< uno::XComponentContext > const & ) SAL_THROW( (uno::Exception) ); +extern uno::Sequence< rtl::OUString > SAL_CALL ColorPicker_getSupportedServiceNames() throw( uno::RuntimeException ); +} + +namespace +{ + + cppu::ImplementationEntry entries[] = { + { &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } + }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( char const * implName, void * serviceManager, void * registryKey) +{ + return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries); +} + + +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +// eof diff --git a/main/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/main/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 3b47d8df86..b71b76b7e9 100644 --- a/main/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/main/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -830,11 +830,11 @@ namespace drawinglayer // this is solved by applying fixed values additionally to luminance // and contrast, do it here and reset DrawMode to GRAPHICDRAWMODE_STANDARD // original in svtools uses: - // #define WATERMARK_LUM_OFFSET 50 - // #define WATERMARK_CON_OFFSET -70 - fLuminance = basegfx::clamp(fLuminance + 0.5, -1.0, 1.0); - fContrast = basegfx::clamp(fContrast - 0.7, -1.0, 1.0); - aGraphicDrawMode = GRAPHICDRAWMODE_STANDARD; + // #define WATERMARK_LUM_OFFSET 50 + // #define WATERMARK_CON_OFFSET -70 + fLuminance = basegfx::clamp(fLuminance + 0.5, -1.0, 1.0); + fContrast = basegfx::clamp(fContrast - 0.7, -1.0, 1.0); + aGraphicDrawMode = GRAPHICDRAWMODE_STANDARD; } // DrawMode (GRAPHICDRAWMODE_WATERMARK already handled) diff --git a/main/filter/source/msfilter/eschesdo.cxx b/main/filter/source/msfilter/eschesdo.cxx index df1186597a..bd2a5eb8be 100644 --- a/main/filter/source/msfilter/eschesdo.cxx +++ b/main/filter/source/msfilter/eschesdo.cxx @@ -1195,7 +1195,7 @@ basegfx::B2DRange getUnrotatedGroupBoundRange(const Reference< XShape >& rxShape if(mXPropSet.is()) { - const Any aAny = mXPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation"))); + const Any aAny = mXPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation"))); if(aAny.hasValue()) { diff --git a/main/sc/source/ui/view/cellsh4.cxx b/main/sc/source/ui/view/cellsh4.cxx index 9189c0e426..6a5b575be6 100644 --- a/main/sc/source/ui/view/cellsh4.cxx +++ b/main/sc/source/ui/view/cellsh4.cxx @@ -96,7 +96,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq ) pTabViewShell->HideAllCursors(); // i123629 - if( pTabViewShell->GetCurObjectSelectionType() == OST_Editing ) + if( pTabViewShell->GetCurObjectSelectionType() == OST_Editing ) pTabViewShell->SetForceFocusOnCurCell(sal_True); else pTabViewShell->SetForceFocusOnCurCell(sal_False); diff --git a/main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx b/main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx index 20894b5f4b..fc7af3efac 100644 --- a/main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx +++ b/main/sfx2/inc/sfx2/sidebar/PopupContainer.hxx @@ -1,41 +1,41 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -#ifndef SFX_SIDEBAR_POPUP_CONTAINER_HXX -#define SFX_SIDEBAR_POPUP_CONTAINER_HXX - -#include "sfx2/dllapi.h" -#include <vcl/floatwin.hxx> - -namespace sfx2 { namespace sidebar { - -class SFX2_DLLPUBLIC PopupContainer : public FloatingWindow -{ -public: - PopupContainer (Window* pParent); - virtual ~PopupContainer (void); - - virtual long Notify (NotifyEvent& rNEvt); -}; - -} } // end of namespace sfx2::sidebar - -#endif +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef SFX_SIDEBAR_POPUP_CONTAINER_HXX +#define SFX_SIDEBAR_POPUP_CONTAINER_HXX + +#include "sfx2/dllapi.h" +#include <vcl/floatwin.hxx> + +namespace sfx2 { namespace sidebar { + +class SFX2_DLLPUBLIC PopupContainer : public FloatingWindow +{ +public: + PopupContainer (Window* pParent); + virtual ~PopupContainer (void); + + virtual long Notify (NotifyEvent& rNEvt); +}; + +} } // end of namespace sfx2::sidebar + +#endif diff --git a/main/sfx2/source/sidebar/PopupContainer.cxx b/main/sfx2/source/sidebar/PopupContainer.cxx index 9415eb8935..a31bc5366a 100644 --- a/main/sfx2/source/sidebar/PopupContainer.cxx +++ b/main/sfx2/source/sidebar/PopupContainer.cxx @@ -1,54 +1,54 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -#include "precompiled_sfx2.hxx" - -#include "sfx2/sidebar/PopupContainer.hxx" - -namespace sfx2 { namespace sidebar { - -PopupContainer::PopupContainer (Window* pParent) - : FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK) -{ -} - - - - -PopupContainer::~PopupContainer (void) -{ -} - - - - -long PopupContainer::Notify (NotifyEvent& rEvent) -{ - if (rEvent.GetType() == EVENT_LOSEFOCUS) - { - if( ! HasChildPathFocus(sal_True)) - EndPopupMode(); - } - return FloatingWindow::Notify(rEvent); -} - - -} } // end of namespace sfx2::sidebar +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#include "precompiled_sfx2.hxx" + +#include "sfx2/sidebar/PopupContainer.hxx" + +namespace sfx2 { namespace sidebar { + +PopupContainer::PopupContainer (Window* pParent) + : FloatingWindow(pParent, WB_SYSTEMWINDOW | WB_3DLOOK) +{ +} + + + + +PopupContainer::~PopupContainer (void) +{ +} + + + + +long PopupContainer::Notify (NotifyEvent& rEvent) +{ + if (rEvent.GetType() == EVENT_LOSEFOCUS) + { + if( ! HasChildPathFocus(sal_True)) + EndPopupMode(); + } + return FloatingWindow::Notify(rEvent); +} + + +} } // end of namespace sfx2::sidebar diff --git a/main/svx/inc/svx/sidebar/Popup.hxx b/main/svx/inc/svx/sidebar/Popup.hxx index 47c938e7b5..7fb1674b1c 100644 --- a/main/svx/inc/svx/sidebar/Popup.hxx +++ b/main/svx/inc/svx/sidebar/Popup.hxx @@ -1,107 +1,107 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -#ifndef _SVX_SIDEBAR_POPUP_HXX_ -#define _SVX_SIDEBAR_POPUP_HXX_ - -#include "svx/svxdllapi.h" -#include <rtl/ustring.hxx> -#include <tools/link.hxx> - -#include <boost/function.hpp> -#include <boost/scoped_ptr.hpp> - -class Window; -class ToolBox; - -namespace svx { namespace sidebar { - -class PopupContainer; -class PopupControl; - -/** A wrapper around a PopupContainer and a PopupControl object. - Usually used as drop down for a toolbox. Use Show() to start - drop down mode and Hide() to end it. -*/ -class SVX_DLLPUBLIC Popup -{ -public : - /** Create a Popup wrapper object. - @param pParent - Parent window of the PopupContainer, which in turn is the - parent of the PopupControl. - @param rControlCreator - A functor that is called to create the PopupControl object - (usually an instance of a class derived from - PopupControl). - */ - Popup ( - Window* pParent, - const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator, - const ::rtl::OUString& rsAccessibleName); - virtual ~Popup (void); - - /** Show the popup. - @rToolBox - The tool box is used to determine the position at which - the popup is displayed. - */ - void Show (ToolBox& rToolBox); - - /** Hide the popup. - This method is called automatically when eg. the user clicks - outside the popup or when the ESC-key is pressed. The - application can call Hide() when the popup should be closed - for other, non-standard reasons. - */ - void Hide (void); - - /** If you want to be informed when the popup closes then add a - callback that is called after that. - */ - void SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback); - -protected: - ::boost::scoped_ptr<PopupControl> mpControl; - - /** Make sure that both PopupContainer and PopupControl objects - exist. Calls the maControlCreator functor if necessary. - */ - void ProvideContainerAndControl (void); - - /** A derived specialisation class can override this method to do - additional work. - */ - virtual void CreateContainerAndControl (void); - -private: - Window* mpParent; - ::boost::function<PopupControl*(PopupContainer*)> maControlCreator; - ::boost::function<void(void)> maPopupModeEndCallback; - const ::rtl::OUString msAccessibleName; - ::boost::scoped_ptr<PopupContainer> mpContainer; - - DECL_LINK(PopupModeEndHandler, void*); -}; - -} } // end of namespace svx::sidebar - -#endif +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_POPUP_HXX_ +#define _SVX_SIDEBAR_POPUP_HXX_ + +#include "svx/svxdllapi.h" +#include <rtl/ustring.hxx> +#include <tools/link.hxx> + +#include <boost/function.hpp> +#include <boost/scoped_ptr.hpp> + +class Window; +class ToolBox; + +namespace svx { namespace sidebar { + +class PopupContainer; +class PopupControl; + +/** A wrapper around a PopupContainer and a PopupControl object. + Usually used as drop down for a toolbox. Use Show() to start + drop down mode and Hide() to end it. +*/ +class SVX_DLLPUBLIC Popup +{ +public : + /** Create a Popup wrapper object. + @param pParent + Parent window of the PopupContainer, which in turn is the + parent of the PopupControl. + @param rControlCreator + A functor that is called to create the PopupControl object + (usually an instance of a class derived from + PopupControl). + */ + Popup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator, + const ::rtl::OUString& rsAccessibleName); + virtual ~Popup (void); + + /** Show the popup. + @rToolBox + The tool box is used to determine the position at which + the popup is displayed. + */ + void Show (ToolBox& rToolBox); + + /** Hide the popup. + This method is called automatically when eg. the user clicks + outside the popup or when the ESC-key is pressed. The + application can call Hide() when the popup should be closed + for other, non-standard reasons. + */ + void Hide (void); + + /** If you want to be informed when the popup closes then add a + callback that is called after that. + */ + void SetPopupModeEndHandler (const ::boost::function<void(void)>& rCallback); + +protected: + ::boost::scoped_ptr<PopupControl> mpControl; + + /** Make sure that both PopupContainer and PopupControl objects + exist. Calls the maControlCreator functor if necessary. + */ + void ProvideContainerAndControl (void); + + /** A derived specialisation class can override this method to do + additional work. + */ + virtual void CreateContainerAndControl (void); + +private: + Window* mpParent; + ::boost::function<PopupControl*(PopupContainer*)> maControlCreator; + ::boost::function<void(void)> maPopupModeEndCallback; + const ::rtl::OUString msAccessibleName; + ::boost::scoped_ptr<PopupContainer> mpContainer; + + DECL_LINK(PopupModeEndHandler, void*); +}; + +} } // end of namespace svx::sidebar + +#endif diff --git a/main/svx/source/sidebar/line/LineWidthPopup.hxx b/main/svx/source/sidebar/line/LineWidthPopup.hxx index c20d119d02..a3035661eb 100644 --- a/main/svx/source/sidebar/line/LineWidthPopup.hxx +++ b/main/svx/source/sidebar/line/LineWidthPopup.hxx @@ -1,53 +1,53 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -#ifndef _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ -#define _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ - -#include "svx/sidebar/Popup.hxx" - -#include <svl/poolitem.hxx> - -#include <boost/function.hpp> - - -namespace svx { namespace sidebar { - -class LineWidthPopup - : public Popup -{ -public : - LineWidthPopup ( - Window* pParent, - const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); - virtual ~LineWidthPopup (void); - - void SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit); - -private: - void PopupModeEndCallback (void); -}; - -} } // end of namespace svx::sidebar - -#endif - -// eof +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + +#ifndef _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ +#define _SVX_SIDEBAR_LINE_WIDTH_POPUP_HXX_ + +#include "svx/sidebar/Popup.hxx" + +#include <svl/poolitem.hxx> + +#include <boost/function.hpp> + + +namespace svx { namespace sidebar { + +class LineWidthPopup + : public Popup +{ +public : + LineWidthPopup ( + Window* pParent, + const ::boost::function<PopupControl*(PopupContainer*)>& rControlCreator); + virtual ~LineWidthPopup (void); + + void SetWidthSelect (long lValue, bool bValuable, SfxMapUnit eMapUnit); + +private: + void PopupModeEndCallback (void); +}; + +} } // end of namespace svx::sidebar + +#endif + +// eof diff --git a/main/sw/source/ui/inc/textsh.hxx b/main/sw/source/ui/inc/textsh.hxx index e862ecd449..d83196b010 100644 --- a/main/sw/source/ui/inc/textsh.hxx +++ b/main/sw/source/ui/inc/textsh.hxx @@ -44,7 +44,7 @@ class SwTextShell: public SwBaseShell sal_Bool bShowWarning ); public: - + SFX_DECL_INTERFACE(SW_TEXTSHELL) TYPEINFO(); diff --git a/main/tools/inc/tools/color.hxx b/main/tools/inc/tools/color.hxx index 74de6444af..32fa82d230 100644 --- a/main/tools/inc/tools/color.hxx +++ b/main/tools/inc/tools/color.hxx @@ -174,14 +174,14 @@ public: static ColorData HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ); void RGBtoHSB( sal_uInt16& nHue, sal_uInt16& nSat, sal_uInt16& nBri ) const; - // the range for cymk is 0 to 1.0 - static ColorData CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey ); - void RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey ); - - sal_Bool operator==( const Color& rColor ) const - { return (mnColor == rColor.mnColor); } - sal_Bool operator!=( const Color& rColor ) const - { return !(Color::operator==( rColor )); } + // the range for cymk is 0 to 1.0 + static ColorData CMYKtoRGB( double fCyan, double fMagenta, double fYellow, double fKey ); + void RGBtoCMYK( double& fCyan, double& fMagenta, double& fYellow, double& fKey ); + + sal_Bool operator==( const Color& rColor ) const + { return (mnColor == rColor.mnColor); } + sal_Bool operator!=( const Color& rColor ) const + { return !(Color::operator==( rColor )); } SvStream& Read( SvStream& rIStm, sal_Bool bNewFormat = sal_True ); SvStream& Write( SvStream& rOStm, sal_Bool bNewFormat = sal_True ); diff --git a/main/tools/source/generic/svlibrary.cxx b/main/tools/source/generic/svlibrary.cxx index 7ccbe107ba..e6a943cc7a 100644 --- a/main/tools/source/generic/svlibrary.cxx +++ b/main/tools/source/generic/svlibrary.cxx @@ -19,107 +19,107 @@ * *************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#include <tools/svlibrary.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/util/XMacroExpander.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <comphelper/processfactory.hxx> -#include <tools/string.hxx> -#include <rtl/uri.hxx> - -using namespace com::sun::star; - -static uno::Sequence< rtl::OUString > GetMultiPaths_Impl() -{ - uno::Sequence< rtl::OUString > aRes; - uno::Sequence< rtl::OUString > aInternalPaths; - uno::Sequence< rtl::OUString > aUserPaths; - - bool bSuccess = true; - uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); - if (xMgr.is()) - { - try - { - String aInternal; - aInternal.AppendAscii("Libraries"); - String aUser; - aUser.AppendAscii("Libraries"); - aInternal .AppendAscii( "_internal" ); - aUser .AppendAscii( "_user" ); - - uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance( - rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW ); - xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths; - xPathSettings->getPropertyValue( aUser ) >>= aUserPaths; - } - catch (uno::Exception &) - { - bSuccess = false; - } - } - if (bSuccess) - { - sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength(); - aRes.realloc( nMaxEntries ); - rtl::OUString *pRes = aRes.getArray(); - sal_Int32 nCount = 0; // number of actually added entries - for (int i = 0; i < 2; ++i) - { - const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths; - const rtl::OUString *pPathSeq = rPathSeq.getConstArray(); - for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k) - { - const bool bAddUser = (&rPathSeq == &aUserPaths); - const bool bAddInternal = (&rPathSeq == &aInternalPaths); - if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0) - pRes[ nCount++ ] = pPathSeq[k]; - } - } - aRes.realloc( nCount ); - } - - return aRes; -} - -bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode ) -{ - static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl(); - bool bLoaded = false; - - for (sal_Int32 n=0; n<aPaths.getLength(); n++) - { - rtl::OUString aMod = aPaths[n]; - if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0) - { - uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext(); - uno::Reference< util::XMacroExpander > xMacroExpander; - xComponentContext->getValueByName( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) ) - >>= xMacroExpander; - - aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 ); - aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - aMod = xMacroExpander->expandMacros( aMod ); - } - - aMod += ::rtl::OUString( sal_Unicode('/') ); - aMod += rLibName; - bLoaded = rModule.load( aMod, mode ); - if ( bLoaded ) - break; - } - - if (!bLoaded ) - bLoaded = rModule.loadRelative( baseModule, rLibName, mode ); - - return bLoaded; -} + + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_tools.hxx" + +#include <tools/svlibrary.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/XMacroExpander.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <comphelper/processfactory.hxx> +#include <tools/string.hxx> +#include <rtl/uri.hxx> + +using namespace com::sun::star; + +static uno::Sequence< rtl::OUString > GetMultiPaths_Impl() +{ + uno::Sequence< rtl::OUString > aRes; + uno::Sequence< rtl::OUString > aInternalPaths; + uno::Sequence< rtl::OUString > aUserPaths; + + bool bSuccess = true; + uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() ); + if (xMgr.is()) + { + try + { + String aInternal; + aInternal.AppendAscii("Libraries"); + String aUser; + aUser.AppendAscii("Libraries"); + aInternal .AppendAscii( "_internal" ); + aUser .AppendAscii( "_user" ); + + uno::Reference< beans::XPropertySet > xPathSettings( xMgr->createInstance( + rtl::OUString::createFromAscii( "com.sun.star.util.PathSettings" ) ), uno::UNO_QUERY_THROW ); + xPathSettings->getPropertyValue( aInternal ) >>= aInternalPaths; + xPathSettings->getPropertyValue( aUser ) >>= aUserPaths; + } + catch (uno::Exception &) + { + bSuccess = false; + } + } + if (bSuccess) + { + sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength(); + aRes.realloc( nMaxEntries ); + rtl::OUString *pRes = aRes.getArray(); + sal_Int32 nCount = 0; // number of actually added entries + for (int i = 0; i < 2; ++i) + { + const uno::Sequence< rtl::OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths; + const rtl::OUString *pPathSeq = rPathSeq.getConstArray(); + for (sal_Int32 k = 0; k < rPathSeq.getLength(); ++k) + { + const bool bAddUser = (&rPathSeq == &aUserPaths); + const bool bAddInternal = (&rPathSeq == &aInternalPaths); + if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0) + pRes[ nCount++ ] = pPathSeq[k]; + } + } + aRes.realloc( nCount ); + } + + return aRes; +} + +bool SvLibrary::LoadModule( osl::Module& rModule, const rtl::OUString& rLibName, ::oslGenericFunction baseModule, ::sal_Int32 mode ) +{ + static uno::Sequence < rtl::OUString > aPaths = GetMultiPaths_Impl(); + bool bLoaded = false; + + for (sal_Int32 n=0; n<aPaths.getLength(); n++) + { + rtl::OUString aMod = aPaths[n]; + if ( aPaths[n].indexOfAsciiL("vnd.sun.star.expand",19) == 0) + { + uno::Reference< uno::XComponentContext > xComponentContext = comphelper::getProcessComponentContext(); + uno::Reference< util::XMacroExpander > xMacroExpander; + xComponentContext->getValueByName( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander") ) ) + >>= xMacroExpander; + + aMod = aMod.copy( sizeof("vnd.sun.star.expand:") -1 ); + aMod = ::rtl::Uri::decode( aMod, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aMod = xMacroExpander->expandMacros( aMod ); + } + + aMod += ::rtl::OUString( sal_Unicode('/') ); + aMod += rLibName; + bLoaded = rModule.load( aMod, mode ); + if ( bLoaded ) + break; + } + + if (!bLoaded ) + bLoaded = rModule.loadRelative( baseModule, rLibName, mode ); + + return bLoaded; +} diff --git a/main/winaccessibility/inc/AccComponentEventListener.hxx b/main/winaccessibility/inc/AccComponentEventListener.hxx index 6eb81d79e0..9a60a0ff4a 100644 --- a/main/winaccessibility/inc/AccComponentEventListener.hxx +++ b/main/winaccessibility/inc/AccComponentEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCCOMPONENTEVENTLISTENER_HXX #define __ACCCOMPONENTEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccContainerEventListener.hxx b/main/winaccessibility/inc/AccContainerEventListener.hxx index 12de41bc9b..379240b86f 100644 --- a/main/winaccessibility/inc/AccContainerEventListener.hxx +++ b/main/winaccessibility/inc/AccContainerEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCCONTAINEREVENTLISTENERHXX #define __ACCCONTAINEREVENTLISTENERHXX diff --git a/main/winaccessibility/inc/AccDescendantManagerEventListener.hxx b/main/winaccessibility/inc/AccDescendantManagerEventListener.hxx index eb1e393151..b486481c9f 100644 --- a/main/winaccessibility/inc/AccDescendantManagerEventListener.hxx +++ b/main/winaccessibility/inc/AccDescendantManagerEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCDESCENDANTMANAGEREVENTLISTENER_HXX #define __ACCDESCENDANTMANAGEREVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccDialogEventListener.hxx b/main/winaccessibility/inc/AccDialogEventListener.hxx index 4d59552db8..0bba0872ff 100644 --- a/main/winaccessibility/inc/AccDialogEventListener.hxx +++ b/main/winaccessibility/inc/AccDialogEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCDIALOGEVENTLISTENER_HXX #define __ACCDIALOGEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccEventListener.hxx b/main/winaccessibility/inc/AccEventListener.hxx index 3ceb62e42a..22c1cf8fe4 100644 --- a/main/winaccessibility/inc/AccEventListener.hxx +++ b/main/winaccessibility/inc/AccEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCEVENTLISTENER_HXX #define __ACCEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccFrameEventListener.hxx b/main/winaccessibility/inc/AccFrameEventListener.hxx index 72aac978a1..df729e54de 100644 --- a/main/winaccessibility/inc/AccFrameEventListener.hxx +++ b/main/winaccessibility/inc/AccFrameEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCFRAMEEVENTLISTENER_HXX #define __ACCFRAMEEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccListEventListener.hxx b/main/winaccessibility/inc/AccListEventListener.hxx index fe73b64465..8559060501 100644 --- a/main/winaccessibility/inc/AccListEventListener.hxx +++ b/main/winaccessibility/inc/AccListEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCLISTEVENTLISTENER_HXX #define __ACCLISTEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccMenuEventListener.hxx b/main/winaccessibility/inc/AccMenuEventListener.hxx index ca91857383..9d43845107 100644 --- a/main/winaccessibility/inc/AccMenuEventListener.hxx +++ b/main/winaccessibility/inc/AccMenuEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCMENUEVENTLISTENER_HXX #define __ACCMENUEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccObjectContainerEventListener.hxx b/main/winaccessibility/inc/AccObjectContainerEventListener.hxx index 4b9565a0ec..5ddde19bf3 100644 --- a/main/winaccessibility/inc/AccObjectContainerEventListener.hxx +++ b/main/winaccessibility/inc/AccObjectContainerEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef _ACCOBJECTCONTAINEREVENTLISTENER_HXX #define _ACCOBJECTCONTAINEREVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccObjectManagerAgent.hxx b/main/winaccessibility/inc/AccObjectManagerAgent.hxx index 0a9741e8c5..812ce0b9de 100644 --- a/main/winaccessibility/inc/AccObjectManagerAgent.hxx +++ b/main/winaccessibility/inc/AccObjectManagerAgent.hxx @@ -17,10 +17,10 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ + *************************************************************/ #ifndef __ACCOBJECTMANAGERAGENT_HXX -#define __ACCOBJECTMANAGERAGENT_HXX +#define __ACCOBJECTMANAGERAGENT_HXX #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_ #include <com/sun/star/accessibility/XAccessible.hpp> diff --git a/main/winaccessibility/inc/AccParagraphEventListener.hxx b/main/winaccessibility/inc/AccParagraphEventListener.hxx index 35158e6641..019b439f39 100644 --- a/main/winaccessibility/inc/AccParagraphEventListener.hxx +++ b/main/winaccessibility/inc/AccParagraphEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCPARAGRAPHEVENTLISTENER_HXX #define __ACCPARAGRAPHEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccResource.hxx b/main/winaccessibility/inc/AccResource.hxx index eff064fa85..8d8e286b57 100644 --- a/main/winaccessibility/inc/AccResource.hxx +++ b/main/winaccessibility/inc/AccResource.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef _ACCRESOURCE_HXX #define _ACCRESOURCE_HXX diff --git a/main/winaccessibility/inc/AccTextComponentEventListener.hxx b/main/winaccessibility/inc/AccTextComponentEventListener.hxx index 2415755dc8..6af4387eeb 100644 --- a/main/winaccessibility/inc/AccTextComponentEventListener.hxx +++ b/main/winaccessibility/inc/AccTextComponentEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCTEXTCOMPONENTEVENTLISTENER_HXX #define __ACCTEXTCOMPONENTEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccTopWindowListener.hxx b/main/winaccessibility/inc/AccTopWindowListener.hxx index 1da853754a..78c8a2eea8 100644 --- a/main/winaccessibility/inc/AccTopWindowListener.hxx +++ b/main/winaccessibility/inc/AccTopWindowListener.hxx @@ -17,10 +17,10 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ + *************************************************************/ #ifndef __ACCTOPWINDOWLISTENER_HXX -#define __ACCTOPWINDOWLISTENER_HXX +#define __ACCTOPWINDOWLISTENER_HXX #include <com/sun/star/awt/XTopWindowListener.hpp> #include <com/sun/star/awt/XExtendedToolkit.hpp> @@ -28,7 +28,7 @@ #include <cppuhelper/weak.hxx> #include "AccObjectManagerAgent.hxx" - + /** * AccEventListener is the general event listener for all top windows. The top windows defined * in UNO are: FRAME, WINDOW, DIALOG, MENU, TOOLTIP. diff --git a/main/winaccessibility/inc/AccTreeEventListener.hxx b/main/winaccessibility/inc/AccTreeEventListener.hxx index d58887e1c6..5962ce0ce0 100644 --- a/main/winaccessibility/inc/AccTreeEventListener.hxx +++ b/main/winaccessibility/inc/AccTreeEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCTREEEVENTLISTENER_HXX #define __ACCTREEEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/AccWindowEventListener.hxx b/main/winaccessibility/inc/AccWindowEventListener.hxx index e11a3c11b5..ad843a8d8b 100644 --- a/main/winaccessibility/inc/AccWindowEventListener.hxx +++ b/main/winaccessibility/inc/AccWindowEventListener.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCWINDOWEVENTLISTENER_HXX #define __ACCWINDOWEVENTLISTENER_HXX diff --git a/main/winaccessibility/inc/ResIDGenerator.hxx b/main/winaccessibility/inc/ResIDGenerator.hxx index c10281eb4f..e97f2f2fe9 100644 --- a/main/winaccessibility/inc/ResIDGenerator.hxx +++ b/main/winaccessibility/inc/ResIDGenerator.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __RESIDGENERATOR_HXX #define __RESIDGENERATOR_HXX @@ -52,5 +52,5 @@ inline ResIDGenerator::ResIDGenerator( long minNum ,long maxNum ) min = minNum; max = maxNum; } - + #endif diff --git a/main/winaccessibility/inc/accHelper.hxx b/main/winaccessibility/inc/accHelper.hxx index 939ffb9406..caaf1e6336 100644 --- a/main/winaccessibility/inc/accHelper.hxx +++ b/main/winaccessibility/inc/accHelper.hxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCHELPER_HXX #define __ACCHELPER_HXX #include <com/sun/star/accessibility/XAccessibleText.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include "UAccCOM2.h" @@ -118,19 +118,19 @@ const short ROLE_TABLE[][2] = {TOOL_TIP, ROLE_SYSTEM_TOOLTIP}, {TREE , ROLE_SYSTEM_OUTLINE}, {VIEW_PORT , IA2_ROLE_VIEW_PORT}, - {WINDOW, ROLE_SYSTEM_WINDOW}, - {BUTTON_DROPDOWN, ROLE_SYSTEM_BUTTONDROPDOWN}, - {BUTTON_MENU, ROLE_SYSTEM_BUTTONMENU}, - {CAPTION, IA2_ROLE_CAPTION}, - {CHART, IA2_ROLE_SHAPE}, - {EDIT_BAR, IA2_ROLE_EDITBAR}, - {FORM, IA2_ROLE_FORM}, - {IMAGE_MAP , IA2_ROLE_IMAGE_MAP}, - {NOTE, IA2_ROLE_NOTE}, - {PAGE, IA2_ROLE_PAGE}, - {RULER , IA2_ROLE_RULER}, + {WINDOW, ROLE_SYSTEM_WINDOW}, + {BUTTON_DROPDOWN, ROLE_SYSTEM_BUTTONDROPDOWN}, + {BUTTON_MENU, ROLE_SYSTEM_BUTTONMENU}, + {CAPTION, IA2_ROLE_CAPTION}, + {CHART, IA2_ROLE_SHAPE}, + {EDIT_BAR, IA2_ROLE_EDITBAR}, + {FORM, IA2_ROLE_FORM}, + {IMAGE_MAP , IA2_ROLE_IMAGE_MAP}, + {NOTE, IA2_ROLE_NOTE}, + {PAGE, IA2_ROLE_PAGE}, + {RULER , IA2_ROLE_RULER}, {SECTION, IA2_ROLE_SECTION}, - {TREE_ITEM , ROLE_SYSTEM_OUTLINEITEM}, + {TREE_ITEM , ROLE_SYSTEM_OUTLINEITEM}, {TREE_TABLE, ROLE_SYSTEM_OUTLINE} }; diff --git a/main/winaccessibility/inc/act.hxx b/main/winaccessibility/inc/act.hxx index bc6413d75e..e2721eb2b2 100644 --- a/main/winaccessibility/inc/act.hxx +++ b/main/winaccessibility/inc/act.hxx @@ -17,58 +17,58 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __ACCACT_HXX #define __ACCACT_HXX #include <windows.h> #include <tchar.h> - - -static bool IsXPOrLater() -{ - OSVERSIONINFO osvi; - - ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); - - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - GetVersionEx(&osvi); - return ((osvi.dwMajorVersion > 5) || - ((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1))); + + +static bool IsXPOrLater() +{ + OSVERSIONINFO osvi; + + ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + + GetVersionEx(&osvi); + return ((osvi.dwMajorVersion > 5) || + ((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1))); } - -static HANDLE pActCtx = INVALID_HANDLE_VALUE; -static ULONG_PTR lpCookie; + +static HANDLE pActCtx = INVALID_HANDLE_VALUE; +static ULONG_PTR lpCookie; static bool ActivateActContext() { if(!IsXPOrLater()) return false; - ACTCTX actctx; - - ZeroMemory(&actctx, sizeof(actctx)); - - actctx.cbSize = sizeof(actctx); - - TCHAR szDllDirPath[1024]; - ::GetCurrentDirectory(1024,szDllDirPath); - LPTSTR szDllPath = szDllDirPath; - lstrcat(szDllPath, _T("\\UAccCOM.dll")); - - actctx.lpSource = szDllPath; - actctx.lpResourceName = MAKEINTRESOURCE(97); - actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; - - HANDLE pActCtx = CreateActCtx(&actctx); - - if(pActCtx != INVALID_HANDLE_VALUE) - { - if(ActivateActCtx(pActCtx, &lpCookie)) - { - return true; + ACTCTX actctx; + + ZeroMemory(&actctx, sizeof(actctx)); + + actctx.cbSize = sizeof(actctx); + + TCHAR szDllDirPath[1024]; + ::GetCurrentDirectory(1024,szDllDirPath); + LPTSTR szDllPath = szDllDirPath; + lstrcat(szDllPath, _T("\\UAccCOM.dll")); + + actctx.lpSource = szDllPath; + actctx.lpResourceName = MAKEINTRESOURCE(97); + actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; + + HANDLE pActCtx = CreateActCtx(&actctx); + + if(pActCtx != INVALID_HANDLE_VALUE) + { + if(ActivateActCtx(pActCtx, &lpCookie)) + { + return true; } } pActCtx = INVALID_HANDLE_VALUE; diff --git a/main/winaccessibility/inc/g_msacc.hxx b/main/winaccessibility/inc/g_msacc.hxx index 11b69b366d..a49bd59174 100644 --- a/main/winaccessibility/inc/g_msacc.hxx +++ b/main/winaccessibility/inc/g_msacc.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __G_MSACC_HXX #define __G_MSACC_HXX diff --git a/main/winaccessibility/inc/unomsaaevent.hxx b/main/winaccessibility/inc/unomsaaevent.hxx index 68b5afd690..2fd46def57 100644 --- a/main/winaccessibility/inc/unomsaaevent.hxx +++ b/main/winaccessibility/inc/unomsaaevent.hxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #ifndef __UNOMSAAEVENT_HXX #define __UNOMSAAEVENT_HXX diff --git a/main/winaccessibility/source/service/AccComponentEventListener.cxx b/main/winaccessibility/source/service/AccComponentEventListener.cxx index 75e5ea210f..d7f67b5a0d 100644 --- a/main/winaccessibility/source/service/AccComponentEventListener.cxx +++ b/main/winaccessibility/source/service/AccComponentEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccComponentEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" @@ -35,10 +35,10 @@ using namespace com::sun::star::accessibility; AccComponentEventListener::AccComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent) :AccEventListener(pAcc, Agent) { -} - +} + AccComponentEventListener::~AccComponentEventListener() -{ +{ } /** diff --git a/main/winaccessibility/source/service/AccContainerEventListener.cxx b/main/winaccessibility/source/service/AccContainerEventListener.cxx index 46efb58060..6444d6c259 100644 --- a/main/winaccessibility/source/service/AccContainerEventListener.cxx +++ b/main/winaccessibility/source/service/AccContainerEventListener.cxx @@ -17,555 +17,555 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - -#include <com/sun/star/accessibility/XAccessible.hpp> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/accessibility/AccessibleEventId.hpp> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - -#include "AccContainerEventListener.hxx" -#include "AccObjectManagerAgent.hxx" -#include "unomsaaevent.hxx" - -using namespace com::sun::star::uno; -using namespace com::sun::star::accessibility; - -AccContainerEventListener::AccContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent) - :AccEventListener(pAcc, Agent) -{ -} - -AccContainerEventListener::~AccContainerEventListener() -{ -} - -/** - * Uno's event notifier when event is captured - * - * @param AccessibleEventObject the event object which contains information about event - */ -void AccContainerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) -throw (::com::sun::star::uno::RuntimeException) -{ - short role = getRole(); - switch (aEvent.EventId) - { - case AccessibleEventId::CHILD: - handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::SELECTION_CHANGED: - handleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::INVALIDATE_ALL_CHILDREN: - handleAllChildrenChangedEvent(); - break; - case AccessibleEventId::TEXT_CHANGED: - handleTextChangedEvent(aEvent.OldValue, aEvent.NewValue); - case AccessibleEventId::VISIBLE_DATA_CHANGED: - handleVisibleDataChangedEvent(); - break; - case AccessibleEventId::BOUNDRECT_CHANGED: - handleBoundrectChangedEvent(); - break; - case AccessibleEventId::STATE_CHANGED: - handleStateChangedEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::VALUE_CHANGED: - handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::SELECTION_CHANGED_ADD: - handleSelectionChangedAddEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::SELECTION_CHANGED_REMOVE: - handleSelectionChangedRemoveEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::SELECTION_CHANGED_WITHIN: - handleSelectionChangedWithinEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::PAGE_CHANGED: - handlePageChangedEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::SECTION_CHANGED: - handleSectionChangedEvent(aEvent.OldValue, aEvent.NewValue); - break; - case AccessibleEventId::COLUMN_CHANGED: - handleColumnChangedEvent(aEvent.OldValue, aEvent.NewValue); - break; - default: - AccEventListener::notifyEvent(aEvent); - break; - } -} - -/** - * handle the VISIBLE_DATA_CHANGED event - */ -void AccContainerEventListener::handleVisibleDataChangedEvent() -{ - AccEventListener::handleVisibleDataChangedEvent(); -} - -/** - * handle the BOUNDRECT_CHANGED event - */ -void AccContainerEventListener::handleBoundrectChangedEvent() -{ - AccEventListener::handleBoundrectChangedEvent(); -} - -void AccContainerEventListener::handleStateChangedEvent(Any oldValue, Any newValue) -{ - short State; - if( newValue >>= State) - { - setComponentState( State,true); - } - else if (oldValue >>= State) - { - setComponentState( State,false); - } - -} - -/** - * handle the CHILD event - * @param oldValue the child to be deleted - * @param newValue the child to be added - */ -void AccContainerEventListener::handleChildChangedEvent(Any oldValue, Any newValue) -{ - Reference< XAccessible > xChild; - if( newValue >>= xChild) - { - //create a new child - if(xChild.is()) - { - XAccessible* pAcc = xChild.get(); - //add this child - - if(pAgent->InsertAccObj( pAcc,pAccessible)) - { - //add all oldValue's existing children - pAgent->InsertChildrenAccObj(pAcc); - pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc); - } - } - else - {} - } - else if (oldValue >>= xChild) - { - //delete a existing child - if(xChild.is()) - { - XAccessible* pAcc = xChild.get(); - pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc); - //delete all oldValue's existing children - pAgent->DeleteChildrenAccObj( pAcc ); - //delete this child - pAgent->DeleteAccObj( pAcc ); - - } - else - {} - } - -} - -/** - * handle the SELECTION_CHANGED event - * @param oldValue the old value of the source of event - * @param newValue the new value of the source of event - */ -void AccContainerEventListener::handleSelectionChangedEvent(const Any& /*oldValue*/, const Any& newValue) -{ - if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED,newValue)) - { - return ; - } - - //menu bar does not process selection change event,just same as word behavior - if(getRole()!=AccessibleRole::MENU_BAR) - pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible); -} - -/** - * handle the INVALIDATE_ALL_CHILDREN event - */ -void AccContainerEventListener::handleAllChildrenChangedEvent() -{ - //TODO: update all the children - if( pAccessible ) - { - //delete all oldValue's existing children - pAgent->DeleteChildrenAccObj( pAccessible ); - //add all oldValue's existing children - pAgent->InsertChildrenAccObj( pAccessible ); - pAgent->NotifyAccEvent(UM_EVENT_OBJECT_REORDER , pAccessible); - } -} - -/** - * handle the TEXT_CHANGED event - */ -void AccContainerEventListener::handleTextChangedEvent(Any oldValue, Any newValue) -{ - pAgent->UpdateValue(pAccessible, newValue); - pAgent->NotifyAccEvent(UM_EVENT_OBJECT_TEXTCHANGE, pAccessible); -} - -/** - * set the new state and fire the MSAA event - * @param state new state id - * @param enable true if state is set, false if state is unset - */ -void AccContainerEventListener::setComponentState(short state, bool enable ) -{ - // only the following state can be fired state event. - - switch (state) - { - case AccessibleStateType::SELECTED: - case AccessibleStateType::BUSY: - case AccessibleStateType::INDETERMINATE: - case AccessibleStateType::OFFSCREEN: - case AccessibleStateType::FOCUSABLE: - case AccessibleStateType::SHOWING: - case AccessibleStateType::VISIBLE: - fireStatePropertyChange(state, enable); - break; - case AccessibleStateType::FOCUSED: - fireStateFocusdChange(enable); - break; - case AccessibleStateType::ENABLED: - if(enable) - { - pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC); - pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE); - pAgent->UpdateState(pAccessible); - - UpdateAllChildrenState(pAccessible); - } - else - { - pAgent->IncreaseState( pAccessible, AccessibleStateType::DEFUNC); - pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE); - pAgent->UpdateState(pAccessible); - - UpdateAllChildrenState(pAccessible); - } - break; - case AccessibleStateType::ACTIVE: - // Only frames should be active - // no msaa state mapping - //for PAGE_TAB_LIST, there will be ACTIVE state, then it should be converted to FOCUSED event. - if(getRole() == AccessibleRole::PAGE_TAB_LIST) - { - if (!enable) /* get the active state */ - { - pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED); - } - - else /* lose the active state */ - { - pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED); - } - } - break; - - case AccessibleStateType::EXPANDED: - case AccessibleStateType::COLLAPSE: - case AccessibleStateType::CHECKED: - { - pAgent->UpdateState(pAccessible); - pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible); - break; - } - - default: - break; - } -} - -/** - * fire the MSAA state changed event - * @param state the state id - * @param set true if state is set, false if state is unset - */ -void AccContainerEventListener::fireStatePropertyChange(short state, bool set) -{ - if( set ) - { - // new value - switch(state) - { - case AccessibleStateType::SELECTED: - pAgent->IncreaseState( pAccessible, state); - break; - case AccessibleStateType::INDETERMINATE: - case AccessibleStateType::BUSY: - case AccessibleStateType::FOCUSABLE: - case AccessibleStateType::OFFSCREEN: - pAgent->IncreaseState( pAccessible, state); - pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible); - break; - case AccessibleStateType::SHOWING: - // UNO !SHOWING == MSAA OFFSCREEN - pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING ); - break; - case AccessibleStateType::VISIBLE: - // UNO !VISIBLE == MSAA INVISIBLE - pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE ); - break; - default: - break; - } - } - else - { - // old value - switch(state) - { - case AccessibleStateType::SELECTED: - pAgent->DecreaseState( pAccessible, state ); - break; - case AccessibleStateType::BUSY: - case AccessibleStateType::INDETERMINATE: - case AccessibleStateType::FOCUSABLE: - case AccessibleStateType::OFFSCREEN: - pAgent->DecreaseState( pAccessible, state); - pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible); - break; - case AccessibleStateType::SHOWING: - // UNO !SHOWING == MSAA OFFSCREEN - pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING ); - break; - case AccessibleStateType::VISIBLE: - // UNO !VISIBLE == MSAA INVISIBLE - pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE ); - break; - default: - break; - } - } -} - -/** - * handle the focused event - * @param enable true if get focus, false if lose focus - */ -void AccContainerEventListener::fireStateFocusdChange(bool enable) -{ - if(enable) - { - pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED); - //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_START event should be sent - //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPSTART event should be sent - short role = getRole(); - if(role == AccessibleRole::MENU_BAR) - { - pAgent->NotifyAccEvent(UM_EVENT_MENU_START, pAccessible); - } - else if (role == AccessibleRole::POPUP_MENU) - pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible); - //Disable the focused event on option_pane and Panel. - //only disable option_pane for toolbar has panel to get focus - else if (role == AccessibleRole::PANEL || role == AccessibleRole::OPTION_PANE ) - { - //don't send focused event on PANEL & OPTION_PANE if the parent is not toolbar - short parentRole = getParentRole(); - if (parentRole == AccessibleRole::TOOL_BAR - || parentRole == AccessibleRole::SCROLL_PANE // sidebar - || parentRole == AccessibleRole::PANEL) // sidebar - pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible); - } - //to update ComboBox's description - else if (role == AccessibleRole::COMBO_BOX ) - { - pAgent->UpdateDescription(pAccessible); - //for editable combobox, send focus event on only edit control, - bool bSendFocusOnCombobox = true; - //send focused event to the first text child - Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY); - if(mxContext.is()) - { - Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0); - if(mxChild.is()) - { - Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY); - short childrole = mxChildContext->getAccessibleRole(); - if (childrole == AccessibleRole::TEXT) - { - if (IsEditable(mxChildContext)) - { - pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED); - pAgent->IncreaseState( mxChild.get(), AccessibleStateType::FOCUSED); - pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, mxChild.get()); - bSendFocusOnCombobox = false; - } - } - } - } - if (bSendFocusOnCombobox) - pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible); - } - else - pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible); - } - else - { - pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED); - //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_END event should be sent - //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPEND event should be sent - if(getRole() == AccessibleRole::MENU_BAR) - { - pAgent->NotifyAccEvent(UM_EVENT_MENU_END, pAccessible); - } - else if (getRole() == AccessibleRole::POPUP_MENU) - { - pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible); - } - } -} - -/** - * handle the VALUE_CHANGED event - * - * @param oldValue the old value of the source of event - * @param newValue the new value of the source of event - */ -void AccContainerEventListener::handleValueChangedEvent(Any oldValue, Any newValue) -{ - pAgent->UpdateValue(pAccessible); - pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible); -} - -bool AccContainerEventListener::IsEditable(Reference<XAccessibleContext> xContext) -{ - bool ret = false; - Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet(); - if( !pRState.is() ) - return false; - - Sequence<short> pStates = pRState->getStates(); - int count = pStates.getLength(); - for( int iIndex = 0;iIndex < count;iIndex++ ) - { - if(pStates[iIndex] == AccessibleStateType::EDITABLE) - return true; - } - return ret; -} - -bool AccContainerEventListener::NotifyChildEvent(short nWinEvent,const Any &Value) -{ - Reference< XAccessible > xChild; - if(Value >>= xChild ) - { - if(xChild.is()) - { - XAccessible* pAcc = xChild.get(); - pAgent->NotifyAccEvent(nWinEvent, pAcc); - return true; - } - } - return false; -} - -void AccContainerEventListener::handleSelectionChangedAddEvent(const Any& /*oldValue*/, const Any& newValue) -{ - if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_ADD,newValue)) - { - return ; - } - pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_ADD,pAccessible); -} -void AccContainerEventListener::handleSelectionChangedRemoveEvent(const Any& /*oldValue*/, const Any& newValue) -{ - if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,newValue)) - { - return ; - } - pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,pAccessible); -} -void AccContainerEventListener::handleSelectionChangedWithinEvent(const Any& /*oldValue*/, const Any& newValue) -{ - if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,newValue)) - { - return ; - } - pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,pAccessible); -} - -void SAL_CALL AccContainerEventListener::UpdateAllChildrenState( com::sun::star::accessibility::XAccessible* pXAccessible ) -{ - Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pXAccessible->getAccessibleContext(),UNO_QUERY); - if(!xContext.is()) - { - return; - } - com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); - if(pAccessibleContext == NULL) - { - return; - } - - if (pAgent && pAgent->IsStateManageDescendant(pXAccessible)) - { - return; - } - - int count = pAccessibleContext->getAccessibleChildCount(); - for (int i=0;i<count;i++) - { - Reference<com::sun::star::accessibility::XAccessible> mxAccessible - = pAccessibleContext->getAccessibleChild(i); - - com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get(); - if(mpAccessible != NULL) - { - pAgent->UpdateState(mpAccessible); - UpdateAllChildrenState(mpAccessible); - } - } -} - - -void AccContainerEventListener::handlePageChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/) -{ - pAgent->NotifyAccEvent(UM_EVENT_OBJECT_PAGECHANGED, pAccessible); -} - -void AccContainerEventListener::handleSectionChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/ ) -{ - pAgent->NotifyAccEvent(UM_EVENT_SECTION_CHANGED, pAccessible); -} - -void AccContainerEventListener::handleColumnChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/) -{ - pAgent->NotifyAccEvent(UM_EVENT_COLUMN_CHANGED, pAccessible); -} - -void AccContainerEventListener::handleNameChangedEvent( Any name ) -{ - if (getRole() == AccessibleRole::COMBO_BOX) - { - Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY); - if(mxContext.is()) - { - Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0); - if(mxChild.is()) - { - Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY); - short childrole = mxChildContext->getAccessibleRole(); - if (childrole == AccessibleRole::TEXT) - { - pAgent->UpdateAccName(mxChild.get(), name); - } - } - } - } - AccEventListener::handleNameChangedEvent(name); -} + *************************************************************/ + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> + +#include "AccContainerEventListener.hxx" +#include "AccObjectManagerAgent.hxx" +#include "unomsaaevent.hxx" + +using namespace com::sun::star::uno; +using namespace com::sun::star::accessibility; + +AccContainerEventListener::AccContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent) + :AccEventListener(pAcc, Agent) +{ +} + +AccContainerEventListener::~AccContainerEventListener() +{ +} + +/** + * Uno's event notifier when event is captured + * + * @param AccessibleEventObject the event object which contains information about event + */ +void AccContainerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) +throw (::com::sun::star::uno::RuntimeException) +{ + short role = getRole(); + switch (aEvent.EventId) + { + case AccessibleEventId::CHILD: + handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::SELECTION_CHANGED: + handleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::INVALIDATE_ALL_CHILDREN: + handleAllChildrenChangedEvent(); + break; + case AccessibleEventId::TEXT_CHANGED: + handleTextChangedEvent(aEvent.OldValue, aEvent.NewValue); + case AccessibleEventId::VISIBLE_DATA_CHANGED: + handleVisibleDataChangedEvent(); + break; + case AccessibleEventId::BOUNDRECT_CHANGED: + handleBoundrectChangedEvent(); + break; + case AccessibleEventId::STATE_CHANGED: + handleStateChangedEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::VALUE_CHANGED: + handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::SELECTION_CHANGED_ADD: + handleSelectionChangedAddEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::SELECTION_CHANGED_REMOVE: + handleSelectionChangedRemoveEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::SELECTION_CHANGED_WITHIN: + handleSelectionChangedWithinEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::PAGE_CHANGED: + handlePageChangedEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::SECTION_CHANGED: + handleSectionChangedEvent(aEvent.OldValue, aEvent.NewValue); + break; + case AccessibleEventId::COLUMN_CHANGED: + handleColumnChangedEvent(aEvent.OldValue, aEvent.NewValue); + break; + default: + AccEventListener::notifyEvent(aEvent); + break; + } +} + +/** + * handle the VISIBLE_DATA_CHANGED event + */ +void AccContainerEventListener::handleVisibleDataChangedEvent() +{ + AccEventListener::handleVisibleDataChangedEvent(); +} + +/** + * handle the BOUNDRECT_CHANGED event + */ +void AccContainerEventListener::handleBoundrectChangedEvent() +{ + AccEventListener::handleBoundrectChangedEvent(); +} + +void AccContainerEventListener::handleStateChangedEvent(Any oldValue, Any newValue) +{ + short State; + if( newValue >>= State) + { + setComponentState( State,true); + } + else if (oldValue >>= State) + { + setComponentState( State,false); + } + +} + +/** + * handle the CHILD event + * @param oldValue the child to be deleted + * @param newValue the child to be added + */ +void AccContainerEventListener::handleChildChangedEvent(Any oldValue, Any newValue) +{ + Reference< XAccessible > xChild; + if( newValue >>= xChild) + { + //create a new child + if(xChild.is()) + { + XAccessible* pAcc = xChild.get(); + //add this child + + if(pAgent->InsertAccObj( pAcc,pAccessible)) + { + //add all oldValue's existing children + pAgent->InsertChildrenAccObj(pAcc); + pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc); + } + } + else + {} + } + else if (oldValue >>= xChild) + { + //delete a existing child + if(xChild.is()) + { + XAccessible* pAcc = xChild.get(); + pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc); + //delete all oldValue's existing children + pAgent->DeleteChildrenAccObj( pAcc ); + //delete this child + pAgent->DeleteAccObj( pAcc ); + + } + else + {} + } + +} + +/** + * handle the SELECTION_CHANGED event + * @param oldValue the old value of the source of event + * @param newValue the new value of the source of event + */ +void AccContainerEventListener::handleSelectionChangedEvent(const Any& /*oldValue*/, const Any& newValue) +{ + if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED,newValue)) + { + return ; + } + + //menu bar does not process selection change event,just same as word behavior + if(getRole()!=AccessibleRole::MENU_BAR) + pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible); +} + +/** + * handle the INVALIDATE_ALL_CHILDREN event + */ +void AccContainerEventListener::handleAllChildrenChangedEvent() +{ + //TODO: update all the children + if( pAccessible ) + { + //delete all oldValue's existing children + pAgent->DeleteChildrenAccObj( pAccessible ); + //add all oldValue's existing children + pAgent->InsertChildrenAccObj( pAccessible ); + pAgent->NotifyAccEvent(UM_EVENT_OBJECT_REORDER , pAccessible); + } +} + +/** + * handle the TEXT_CHANGED event + */ +void AccContainerEventListener::handleTextChangedEvent(Any oldValue, Any newValue) +{ + pAgent->UpdateValue(pAccessible, newValue); + pAgent->NotifyAccEvent(UM_EVENT_OBJECT_TEXTCHANGE, pAccessible); +} + +/** + * set the new state and fire the MSAA event + * @param state new state id + * @param enable true if state is set, false if state is unset + */ +void AccContainerEventListener::setComponentState(short state, bool enable ) +{ + // only the following state can be fired state event. + + switch (state) + { + case AccessibleStateType::SELECTED: + case AccessibleStateType::BUSY: + case AccessibleStateType::INDETERMINATE: + case AccessibleStateType::OFFSCREEN: + case AccessibleStateType::FOCUSABLE: + case AccessibleStateType::SHOWING: + case AccessibleStateType::VISIBLE: + fireStatePropertyChange(state, enable); + break; + case AccessibleStateType::FOCUSED: + fireStateFocusdChange(enable); + break; + case AccessibleStateType::ENABLED: + if(enable) + { + pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC); + pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE); + pAgent->UpdateState(pAccessible); + + UpdateAllChildrenState(pAccessible); + } + else + { + pAgent->IncreaseState( pAccessible, AccessibleStateType::DEFUNC); + pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE); + pAgent->UpdateState(pAccessible); + + UpdateAllChildrenState(pAccessible); + } + break; + case AccessibleStateType::ACTIVE: + // Only frames should be active + // no msaa state mapping + //for PAGE_TAB_LIST, there will be ACTIVE state, then it should be converted to FOCUSED event. + if(getRole() == AccessibleRole::PAGE_TAB_LIST) + { + if (!enable) /* get the active state */ + { + pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED); + } + + else /* lose the active state */ + { + pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED); + } + } + break; + + case AccessibleStateType::EXPANDED: + case AccessibleStateType::COLLAPSE: + case AccessibleStateType::CHECKED: + { + pAgent->UpdateState(pAccessible); + pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible); + break; + } + + default: + break; + } +} + +/** + * fire the MSAA state changed event + * @param state the state id + * @param set true if state is set, false if state is unset + */ +void AccContainerEventListener::fireStatePropertyChange(short state, bool set) +{ + if( set ) + { + // new value + switch(state) + { + case AccessibleStateType::SELECTED: + pAgent->IncreaseState( pAccessible, state); + break; + case AccessibleStateType::INDETERMINATE: + case AccessibleStateType::BUSY: + case AccessibleStateType::FOCUSABLE: + case AccessibleStateType::OFFSCREEN: + pAgent->IncreaseState( pAccessible, state); + pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible); + break; + case AccessibleStateType::SHOWING: + // UNO !SHOWING == MSAA OFFSCREEN + pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING ); + break; + case AccessibleStateType::VISIBLE: + // UNO !VISIBLE == MSAA INVISIBLE + pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE ); + break; + default: + break; + } + } + else + { + // old value + switch(state) + { + case AccessibleStateType::SELECTED: + pAgent->DecreaseState( pAccessible, state ); + break; + case AccessibleStateType::BUSY: + case AccessibleStateType::INDETERMINATE: + case AccessibleStateType::FOCUSABLE: + case AccessibleStateType::OFFSCREEN: + pAgent->DecreaseState( pAccessible, state); + pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible); + break; + case AccessibleStateType::SHOWING: + // UNO !SHOWING == MSAA OFFSCREEN + pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING ); + break; + case AccessibleStateType::VISIBLE: + // UNO !VISIBLE == MSAA INVISIBLE + pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE ); + break; + default: + break; + } + } +} + +/** + * handle the focused event + * @param enable true if get focus, false if lose focus + */ +void AccContainerEventListener::fireStateFocusdChange(bool enable) +{ + if(enable) + { + pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED); + //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_START event should be sent + //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPSTART event should be sent + short role = getRole(); + if(role == AccessibleRole::MENU_BAR) + { + pAgent->NotifyAccEvent(UM_EVENT_MENU_START, pAccessible); + } + else if (role == AccessibleRole::POPUP_MENU) + pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible); + //Disable the focused event on option_pane and Panel. + //only disable option_pane for toolbar has panel to get focus + else if (role == AccessibleRole::PANEL || role == AccessibleRole::OPTION_PANE ) + { + //don't send focused event on PANEL & OPTION_PANE if the parent is not toolbar + short parentRole = getParentRole(); + if (parentRole == AccessibleRole::TOOL_BAR + || parentRole == AccessibleRole::SCROLL_PANE // sidebar + || parentRole == AccessibleRole::PANEL) // sidebar + pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible); + } + //to update ComboBox's description + else if (role == AccessibleRole::COMBO_BOX ) + { + pAgent->UpdateDescription(pAccessible); + //for editable combobox, send focus event on only edit control, + bool bSendFocusOnCombobox = true; + //send focused event to the first text child + Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY); + if(mxContext.is()) + { + Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0); + if(mxChild.is()) + { + Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY); + short childrole = mxChildContext->getAccessibleRole(); + if (childrole == AccessibleRole::TEXT) + { + if (IsEditable(mxChildContext)) + { + pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED); + pAgent->IncreaseState( mxChild.get(), AccessibleStateType::FOCUSED); + pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, mxChild.get()); + bSendFocusOnCombobox = false; + } + } + } + } + if (bSendFocusOnCombobox) + pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible); + } + else + pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible); + } + else + { + pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED); + //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_END event should be sent + //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPEND event should be sent + if(getRole() == AccessibleRole::MENU_BAR) + { + pAgent->NotifyAccEvent(UM_EVENT_MENU_END, pAccessible); + } + else if (getRole() == AccessibleRole::POPUP_MENU) + { + pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible); + } + } +} + +/** + * handle the VALUE_CHANGED event + * + * @param oldValue the old value of the source of event + * @param newValue the new value of the source of event + */ +void AccContainerEventListener::handleValueChangedEvent(Any oldValue, Any newValue) +{ + pAgent->UpdateValue(pAccessible); + pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible); +} + +bool AccContainerEventListener::IsEditable(Reference<XAccessibleContext> xContext) +{ + bool ret = false; + Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet(); + if( !pRState.is() ) + return false; + + Sequence<short> pStates = pRState->getStates(); + int count = pStates.getLength(); + for( int iIndex = 0;iIndex < count;iIndex++ ) + { + if(pStates[iIndex] == AccessibleStateType::EDITABLE) + return true; + } + return ret; +} + +bool AccContainerEventListener::NotifyChildEvent(short nWinEvent,const Any &Value) +{ + Reference< XAccessible > xChild; + if(Value >>= xChild ) + { + if(xChild.is()) + { + XAccessible* pAcc = xChild.get(); + pAgent->NotifyAccEvent(nWinEvent, pAcc); + return true; + } + } + return false; +} + +void AccContainerEventListener::handleSelectionChangedAddEvent(const Any& /*oldValue*/, const Any& newValue) +{ + if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_ADD,newValue)) + { + return ; + } + pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_ADD,pAccessible); +} +void AccContainerEventListener::handleSelectionChangedRemoveEvent(const Any& /*oldValue*/, const Any& newValue) +{ + if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,newValue)) + { + return ; + } + pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,pAccessible); +} +void AccContainerEventListener::handleSelectionChangedWithinEvent(const Any& /*oldValue*/, const Any& newValue) +{ + if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,newValue)) + { + return ; + } + pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,pAccessible); +} + +void SAL_CALL AccContainerEventListener::UpdateAllChildrenState( com::sun::star::accessibility::XAccessible* pXAccessible ) +{ + Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pXAccessible->getAccessibleContext(),UNO_QUERY); + if(!xContext.is()) + { + return; + } + com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); + if(pAccessibleContext == NULL) + { + return; + } + + if (pAgent && pAgent->IsStateManageDescendant(pXAccessible)) + { + return; + } + + int count = pAccessibleContext->getAccessibleChildCount(); + for (int i=0;i<count;i++) + { + Reference<com::sun::star::accessibility::XAccessible> mxAccessible + = pAccessibleContext->getAccessibleChild(i); + + com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get(); + if(mpAccessible != NULL) + { + pAgent->UpdateState(mpAccessible); + UpdateAllChildrenState(mpAccessible); + } + } +} + + +void AccContainerEventListener::handlePageChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/) +{ + pAgent->NotifyAccEvent(UM_EVENT_OBJECT_PAGECHANGED, pAccessible); +} + +void AccContainerEventListener::handleSectionChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/ ) +{ + pAgent->NotifyAccEvent(UM_EVENT_SECTION_CHANGED, pAccessible); +} + +void AccContainerEventListener::handleColumnChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/) +{ + pAgent->NotifyAccEvent(UM_EVENT_COLUMN_CHANGED, pAccessible); +} + +void AccContainerEventListener::handleNameChangedEvent( Any name ) +{ + if (getRole() == AccessibleRole::COMBO_BOX) + { + Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY); + if(mxContext.is()) + { + Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0); + if(mxChild.is()) + { + Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY); + short childrole = mxChildContext->getAccessibleRole(); + if (childrole == AccessibleRole::TEXT) + { + pAgent->UpdateAccName(mxChild.get(), name); + } + } + } + } + AccEventListener::handleNameChangedEvent(name); +} diff --git a/main/winaccessibility/source/service/AccDescendantManagerEventListener.cxx b/main/winaccessibility/source/service/AccDescendantManagerEventListener.cxx index 4aa91532c4..e1e1f3900a 100644 --- a/main/winaccessibility/source/service/AccDescendantManagerEventListener.cxx +++ b/main/winaccessibility/source/service/AccDescendantManagerEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccDescendantManagerEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" @@ -36,8 +36,8 @@ AccDescendantManagerEventListener::AccDescendantManagerEventListener(com::sun::s :AccComponentEventListener(pAcc, Agent), pActiveDescendant(NULL) { -} - +} + AccDescendantManagerEventListener::~AccDescendantManagerEventListener() { } @@ -214,7 +214,7 @@ void AccDescendantManagerEventListener::handleSelectionChangedRemoveEvent(const } pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,pAccessible); } - + void AccDescendantManagerEventListener::handleSelectionChangedWithinEvent(const Any& /*oldValue*/, const Any &newValue) { if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,newValue)) diff --git a/main/winaccessibility/source/service/AccDialogEventListener.cxx b/main/winaccessibility/source/service/AccDialogEventListener.cxx index df1f816efb..5b582bc5db 100644 --- a/main/winaccessibility/source/service/AccDialogEventListener.cxx +++ b/main/winaccessibility/source/service/AccDialogEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccDialogEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" diff --git a/main/winaccessibility/source/service/AccEventListener.cxx b/main/winaccessibility/source/service/AccEventListener.cxx index e348c56c1b..951ae192fe 100644 --- a/main/winaccessibility/source/service/AccEventListener.cxx +++ b/main/winaccessibility/source/service/AccEventListener.cxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <cppuhelper/bootstrap.hxx> #include <com/sun/star/bridge/XUnoUrlResolver.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> diff --git a/main/winaccessibility/source/service/AccFrameEventListener.cxx b/main/winaccessibility/source/service/AccFrameEventListener.cxx index a978874d0a..28751695b1 100644 --- a/main/winaccessibility/source/service/AccFrameEventListener.cxx +++ b/main/winaccessibility/source/service/AccFrameEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccFrameEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" @@ -40,9 +40,9 @@ using namespace com::sun::star::accessibility; typedef sal_Int32 HWND; typedef sal_Int32 HMENU; typedef sal_Int32 HDC; -typedef void *PVOID; -typedef PVOID HANDLE; -typedef HANDLE HFONT; +typedef void *PVOID; +typedef PVOID HANDLE; +typedef HANDLE HFONT; #endif #include <vcl/sysdata.hxx> #endif @@ -51,8 +51,8 @@ typedef HANDLE HFONT; AccFrameEventListener::AccFrameEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent) :AccEventListener(pAcc, Agent) { -} - +} + AccFrameEventListener::~AccFrameEventListener() { } diff --git a/main/winaccessibility/source/service/AccListEventListener.cxx b/main/winaccessibility/source/service/AccListEventListener.cxx index ef864e0ae6..63947dca01 100644 --- a/main/winaccessibility/source/service/AccListEventListener.cxx +++ b/main/winaccessibility/source/service/AccListEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccListEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" @@ -36,8 +36,8 @@ AccListEventListener::AccListEventListener(com::sun::star::accessibility::XAcces :AccDescendantManagerEventListener(pAcc, Agent), shouldDeleteChild(true) { -} - +} + AccListEventListener::~AccListEventListener() { } diff --git a/main/winaccessibility/source/service/AccMenuEventListener.cxx b/main/winaccessibility/source/service/AccMenuEventListener.cxx index 5e5821555d..36e0f15370 100644 --- a/main/winaccessibility/source/service/AccMenuEventListener.cxx +++ b/main/winaccessibility/source/service/AccMenuEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccMenuEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" diff --git a/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx b/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx index e5ed271adf..7fa9f70c89 100644 --- a/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx +++ b/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx @@ -17,18 +17,18 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + // AccObjectContainerEventListener.cpp: implementation of the AccContainerEventListener class. // ////////////////////////////////////////////////////////////////////// - + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccObjectContainerEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" diff --git a/main/winaccessibility/source/service/AccObjectManagerAgent.cxx b/main/winaccessibility/source/service/AccObjectManagerAgent.cxx index 2a395f5eca..9f7a04b922 100644 --- a/main/winaccessibility/source/service/AccObjectManagerAgent.cxx +++ b/main/winaccessibility/source/service/AccObjectManagerAgent.cxx @@ -17,7 +17,7 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ + *************************************************************/ #include "AccObjectManagerAgent.hxx" #include "AccObjectWinManager.hxx" diff --git a/main/winaccessibility/source/service/AccParagraphEventListener.cxx b/main/winaccessibility/source/service/AccParagraphEventListener.cxx index 88ced352db..932af8df9f 100644 --- a/main/winaccessibility/source/service/AccParagraphEventListener.cxx +++ b/main/winaccessibility/source/service/AccParagraphEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccParagraphEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" diff --git a/main/winaccessibility/source/service/AccResource.cxx b/main/winaccessibility/source/service/AccResource.cxx index 50c6a5c359..4f3a5c26f8 100644 --- a/main/winaccessibility/source/service/AccResource.cxx +++ b/main/winaccessibility/source/service/AccResource.cxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include "AccResource.hxx" #include <tools/simplerm.hxx> diff --git a/main/winaccessibility/source/service/AccTableEventListener.cxx b/main/winaccessibility/source/service/AccTableEventListener.cxx index 998dac72dd..9639fe0784 100644 --- a/main/winaccessibility/source/service/AccTableEventListener.cxx +++ b/main/winaccessibility/source/service/AccTableEventListener.cxx @@ -17,15 +17,15 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> -#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp> - +#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp> + #include "AccTableEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" @@ -129,18 +129,18 @@ void AccTableEventListener::handleActiveDescendantChangedEvent(Any oldValue, Any } } -void AccTableEventListener::handleTableModelChangeEvent(Any newValue) -{ - AccessibleTableModelChange aModelChange; - if (newValue >>= aModelChange) - { - if( pAccessible ) - { - //delete all oldValue's existing children - pAgent->DeleteChildrenAccObj( pAccessible ); - //add all oldValue's existing children - pAgent->InsertChildrenAccObj( pAccessible ); - } - pAgent->NotifyAccEvent(UM_EVENT_TABLE_MODEL_CHANGED, pAccessible); - } -} +void AccTableEventListener::handleTableModelChangeEvent(Any newValue) +{ + AccessibleTableModelChange aModelChange; + if (newValue >>= aModelChange) + { + if( pAccessible ) + { + //delete all oldValue's existing children + pAgent->DeleteChildrenAccObj( pAccessible ); + //add all oldValue's existing children + pAgent->InsertChildrenAccObj( pAccessible ); + } + pAgent->NotifyAccEvent(UM_EVENT_TABLE_MODEL_CHANGED, pAccessible); + } +} diff --git a/main/winaccessibility/source/service/AccTextComponentEventListener.cxx b/main/winaccessibility/source/service/AccTextComponentEventListener.cxx index c1697c0a2a..ae1393cd73 100644 --- a/main/winaccessibility/source/service/AccTextComponentEventListener.cxx +++ b/main/winaccessibility/source/service/AccTextComponentEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccTextComponentEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" diff --git a/main/winaccessibility/source/service/AccTopWindowListener.cxx b/main/winaccessibility/source/service/AccTopWindowListener.cxx index 2d47a2d48c..3cd714ff63 100644 --- a/main/winaccessibility/source/service/AccTopWindowListener.cxx +++ b/main/winaccessibility/source/service/AccTopWindowListener.cxx @@ -17,305 +17,305 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - -#include <cppuhelper/bootstrap.hxx> -#include <com/sun/star/bridge/XUnoUrlResolver.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <vcl/window.hxx> -#include <toolkit/awt/Vclxwindow.hxx> - -#ifndef _SV_SYSDATA_HXX -#if defined( WIN ) || defined( WNT ) || defined( OS2 ) -typedef sal_Int32 HWND; -typedef sal_Int32 HMENU; -typedef sal_Int32 HDC; -typedef void *PVOID; -typedef PVOID HANDLE; -typedef HANDLE HFONT; -#endif -#include <vcl/sysdata.hxx> -#endif - -#include "AccTopWindowListener.hxx" -#include "unomsaaevent.hxx" - -#include <com/sun/star/awt/XExtendedToolkit.hpp> -#include <com/sun/star/uno/XInterface.hpp> -#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> -#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> -#include <com/sun/star/accessibility/XAccessibleComponent.hpp> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::bridge; -using namespace com::sun::star::awt; -using namespace rtl; -using namespace cppu; -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -AccTopWindowListener* g_pTop = NULL; -//when proccess exit, call FreeTopWindowListener() in svmain -void FreeTopWindowListener() -{ - if( g_pTop ) - { - g_pTop->release(); - g_pTop = NULL; - } -} - -/** - * As a global method to invoke the handleWindowOpened() method - */ -void handleWindowOpened_impl(long pAcc) -{ - if( g_pTop && pAcc != NULL ) - g_pTop->handleWindowOpened( (com::sun::star::accessibility::XAccessible*)((void*)pAcc) ); -} - -/** - * For the new opened window, generate all the UNO accessible's object, COM object and add - * accessible listener to monitor all these objects. - * @param pAccessible the accessible of the new opened window - */ -void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible ) -{ - //get SystemData from window - VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible; - Window* window = pvclwindow->GetWindow(); - // The SalFrame of window may be destructed at this time - const SystemEnvData* systemdata = NULL; - try - { - systemdata = window->GetSystemData(); - } - catch(...) - { - systemdata = NULL; - } - Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY); - if(!xContext.is()) - { - return; - } - com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); - //Only AccessibleContext exist, add all listeners - if(pAccessibleContext != NULL && systemdata != NULL) - { - accManagerAgent.SaveTopWindowHandle((HWND)systemdata->hWnd, pAccessible); - - AddAllListeners(pAccessible,NULL,(HWND)systemdata->hWnd); - - if( window->GetStyle() & WB_MOVEABLE ) - accManagerAgent.IncreaseState( pAccessible, -1 /* U_MOVEBLE */ ); - - short role = pAccessibleContext->getAccessibleRole(); - - - if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU || - role == com::sun::star::accessibility::AccessibleRole::MENU ) - { - accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible); - } - - if (role == com::sun::star::accessibility::AccessibleRole::FRAME || - role == com::sun::star::accessibility::AccessibleRole::DIALOG || - role == com::sun::star::accessibility::AccessibleRole::WINDOW || - role == com::sun::star::accessibility::AccessibleRole::ALERT) - { - accManagerAgent.NotifyAccEvent(UM_EVENT_SHOW, pAccessible); - } - } -} - -AccTopWindowListener::AccTopWindowListener(): - accManagerAgent(), - m_refcount(1) -{ -} - -AccTopWindowListener::~AccTopWindowListener() -{ -} - -/** - * It is invoked when a new window is opened, the source of this EventObject is the window - */ -void AccTopWindowListener::windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException) -{ - if ( !e.Source.is()) - { - return; - } - - Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY ); - com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get(); - if ( pAccessible == NULL) - { - return; - } - - handleWindowOpened(pAccessible); - -} - -/** - * Add the accessible event listener to object and all its children objects. - * @param pAccessible the accessible object - * @param pParentXAcc the parent of current accessible object - * @param pWND the handle of top window which current object resides - */ -void AccTopWindowListener::AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible, com::sun::star::accessibility::XAccessible* pParentXAcc, HWND pWND) -{ - Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY); - if(!xContext.is()) - { - return; - } - com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); - if(pAccessibleContext == NULL) - { - return; - } - - accManagerAgent.InsertAccObj( pAccessible, pParentXAcc,pWND ); - - if (!accManagerAgent.IsContainer(pAccessible)) - { - return; - } - - - short role = pAccessibleContext->getAccessibleRole(); - if(com::sun::star::accessibility::AccessibleRole::DOCUMENT == role ) - { - if(accManagerAgent.IsStateManageDescendant(pAccessible)) - { - return ; - } - } - - - int count = pAccessibleContext->getAccessibleChildCount(); - for (int i=0;i<count;i++) - { - Reference<com::sun::star::accessibility::XAccessible> mxAccessible - = pAccessibleContext->getAccessibleChild(i); - - com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get(); - if(mpAccessible != NULL) - { - Reference<com::sun::star::accessibility::XAccessibleContext> mxAccessibleContext - = mpAccessible->getAccessibleContext(); - com::sun::star::accessibility::XAccessibleContext* mpContext = mxAccessibleContext.get(); - if(mpContext != NULL) - { - //fprintf(output, "go on add child's children event listener\n"); - AddAllListeners(mpAccessible,pAccessible,pWND); - } - } - } -} - -void AccTopWindowListener::windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -/** - * Invoke this method when the top window is closed, remove all the objects and its children - * from current manager's cache, and remove the COM object and the accessible event listener - * assigned to the accessible objects. - */ -void AccTopWindowListener::windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException) -{ - if ( !e.Source.is()) - { - return; - } - Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY ); - com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get(); - if ( pAccessible == NULL) - { - return; - } - - - VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible; - Window* window = pvclwindow->GetWindow(); - const SystemEnvData* systemdata=window->GetSystemData(); - - Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY); - if(!xContext.is()) - { - return; - } - com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); - - short role = -1; - if(pAccessibleContext != NULL) - { - role = pAccessibleContext->getAccessibleRole(); - - if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU || - role == com::sun::star::accessibility::AccessibleRole::MENU) - { - accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible); - } - } - - - accManagerAgent.DeleteChildrenAccObj( pAccessible ); - if( role != com::sun::star::accessibility::AccessibleRole::POPUP_MENU ) - accManagerAgent.DeleteAccObj( pAccessible ); - -} - -void AccTopWindowListener::windowMinimized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -void AccTopWindowListener::windowNormalized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -void AccTopWindowListener::windowActivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -void AccTopWindowListener::windowDeactivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -//need to investigate further -::com::sun::star::uno::Any SAL_CALL AccTopWindowListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException) -{ - if (aType.equals( ::getCppuType( (Reference< com::sun::star::awt::XTopWindowListener> const *)0 ) )) - { - Reference< com::sun::star::awt::XTopWindowListener> xTopListener( static_cast< com::sun::star::awt::XTopWindowListener* >(this)); - return makeAny(xTopListener); - } - return Any(); -} - -void AccTopWindowListener::acquire( ) throw () -{ - ::osl_incrementInterlockedCount( &m_refcount ); -} - -void AccTopWindowListener::release() throw () -{ - // thread-safe decrementation of reference count - if (0 == ::osl_decrementInterlockedCount( &m_refcount )) - { - delete this; // shutdown this object - } -} + *************************************************************/ + +#include <cppuhelper/bootstrap.hxx> +#include <com/sun/star/bridge/XUnoUrlResolver.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <vcl/window.hxx> +#include <toolkit/awt/Vclxwindow.hxx> + +#ifndef _SV_SYSDATA_HXX +#if defined( WIN ) || defined( WNT ) || defined( OS2 ) +typedef sal_Int32 HWND; +typedef sal_Int32 HMENU; +typedef sal_Int32 HDC; +typedef void *PVOID; +typedef PVOID HANDLE; +typedef HANDLE HFONT; +#endif +#include <vcl/sysdata.hxx> +#endif + +#include "AccTopWindowListener.hxx" +#include "unomsaaevent.hxx" + +#include <com/sun/star/awt/XExtendedToolkit.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> + +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::bridge; +using namespace com::sun::star::awt; +using namespace rtl; +using namespace cppu; +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +AccTopWindowListener* g_pTop = NULL; +//when proccess exit, call FreeTopWindowListener() in svmain +void FreeTopWindowListener() +{ + if( g_pTop ) + { + g_pTop->release(); + g_pTop = NULL; + } +} + +/** + * As a global method to invoke the handleWindowOpened() method + */ +void handleWindowOpened_impl(long pAcc) +{ + if( g_pTop && pAcc != NULL ) + g_pTop->handleWindowOpened( (com::sun::star::accessibility::XAccessible*)((void*)pAcc) ); +} + +/** + * For the new opened window, generate all the UNO accessible's object, COM object and add + * accessible listener to monitor all these objects. + * @param pAccessible the accessible of the new opened window + */ +void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible ) +{ + //get SystemData from window + VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible; + Window* window = pvclwindow->GetWindow(); + // The SalFrame of window may be destructed at this time + const SystemEnvData* systemdata = NULL; + try + { + systemdata = window->GetSystemData(); + } + catch(...) + { + systemdata = NULL; + } + Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY); + if(!xContext.is()) + { + return; + } + com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); + //Only AccessibleContext exist, add all listeners + if(pAccessibleContext != NULL && systemdata != NULL) + { + accManagerAgent.SaveTopWindowHandle((HWND)systemdata->hWnd, pAccessible); + + AddAllListeners(pAccessible,NULL,(HWND)systemdata->hWnd); + + if( window->GetStyle() & WB_MOVEABLE ) + accManagerAgent.IncreaseState( pAccessible, -1 /* U_MOVEBLE */ ); + + short role = pAccessibleContext->getAccessibleRole(); + + + if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU || + role == com::sun::star::accessibility::AccessibleRole::MENU ) + { + accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible); + } + + if (role == com::sun::star::accessibility::AccessibleRole::FRAME || + role == com::sun::star::accessibility::AccessibleRole::DIALOG || + role == com::sun::star::accessibility::AccessibleRole::WINDOW || + role == com::sun::star::accessibility::AccessibleRole::ALERT) + { + accManagerAgent.NotifyAccEvent(UM_EVENT_SHOW, pAccessible); + } + } +} + +AccTopWindowListener::AccTopWindowListener(): + accManagerAgent(), + m_refcount(1) +{ +} + +AccTopWindowListener::~AccTopWindowListener() +{ +} + +/** + * It is invoked when a new window is opened, the source of this EventObject is the window + */ +void AccTopWindowListener::windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException) +{ + if ( !e.Source.is()) + { + return; + } + + Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY ); + com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get(); + if ( pAccessible == NULL) + { + return; + } + + handleWindowOpened(pAccessible); + +} + +/** + * Add the accessible event listener to object and all its children objects. + * @param pAccessible the accessible object + * @param pParentXAcc the parent of current accessible object + * @param pWND the handle of top window which current object resides + */ +void AccTopWindowListener::AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible, com::sun::star::accessibility::XAccessible* pParentXAcc, HWND pWND) +{ + Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY); + if(!xContext.is()) + { + return; + } + com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); + if(pAccessibleContext == NULL) + { + return; + } + + accManagerAgent.InsertAccObj( pAccessible, pParentXAcc,pWND ); + + if (!accManagerAgent.IsContainer(pAccessible)) + { + return; + } + + + short role = pAccessibleContext->getAccessibleRole(); + if(com::sun::star::accessibility::AccessibleRole::DOCUMENT == role ) + { + if(accManagerAgent.IsStateManageDescendant(pAccessible)) + { + return ; + } + } + + + int count = pAccessibleContext->getAccessibleChildCount(); + for (int i=0;i<count;i++) + { + Reference<com::sun::star::accessibility::XAccessible> mxAccessible + = pAccessibleContext->getAccessibleChild(i); + + com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get(); + if(mpAccessible != NULL) + { + Reference<com::sun::star::accessibility::XAccessibleContext> mxAccessibleContext + = mpAccessible->getAccessibleContext(); + com::sun::star::accessibility::XAccessibleContext* mpContext = mxAccessibleContext.get(); + if(mpContext != NULL) + { + //fprintf(output, "go on add child's children event listener\n"); + AddAllListeners(mpAccessible,pAccessible,pWND); + } + } + } +} + +void AccTopWindowListener::windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException) +{ +} + +/** + * Invoke this method when the top window is closed, remove all the objects and its children + * from current manager's cache, and remove the COM object and the accessible event listener + * assigned to the accessible objects. + */ +void AccTopWindowListener::windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException) +{ + if ( !e.Source.is()) + { + return; + } + Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY ); + com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get(); + if ( pAccessible == NULL) + { + return; + } + + + VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible; + Window* window = pvclwindow->GetWindow(); + const SystemEnvData* systemdata=window->GetSystemData(); + + Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY); + if(!xContext.is()) + { + return; + } + com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); + + short role = -1; + if(pAccessibleContext != NULL) + { + role = pAccessibleContext->getAccessibleRole(); + + if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU || + role == com::sun::star::accessibility::AccessibleRole::MENU) + { + accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible); + } + } + + + accManagerAgent.DeleteChildrenAccObj( pAccessible ); + if( role != com::sun::star::accessibility::AccessibleRole::POPUP_MENU ) + accManagerAgent.DeleteAccObj( pAccessible ); + +} + +void AccTopWindowListener::windowMinimized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) +{ +} + +void AccTopWindowListener::windowNormalized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) +{ +} + +void AccTopWindowListener::windowActivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) +{ +} + +void AccTopWindowListener::windowDeactivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) +{ +} + +void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) +{ +} + +//need to investigate further +::com::sun::star::uno::Any SAL_CALL AccTopWindowListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException) +{ + if (aType.equals( ::getCppuType( (Reference< com::sun::star::awt::XTopWindowListener> const *)0 ) )) + { + Reference< com::sun::star::awt::XTopWindowListener> xTopListener( static_cast< com::sun::star::awt::XTopWindowListener* >(this)); + return makeAny(xTopListener); + } + return Any(); +} + +void AccTopWindowListener::acquire( ) throw () +{ + ::osl_incrementInterlockedCount( &m_refcount ); +} + +void AccTopWindowListener::release() throw () +{ + // thread-safe decrementation of reference count + if (0 == ::osl_decrementInterlockedCount( &m_refcount )) + { + delete this; // shutdown this object + } +} diff --git a/main/winaccessibility/source/service/AccTreeEventListener.cxx b/main/winaccessibility/source/service/AccTreeEventListener.cxx index 865cc85fbe..d99e33b77c 100644 --- a/main/winaccessibility/source/service/AccTreeEventListener.cxx +++ b/main/winaccessibility/source/service/AccTreeEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccTreeEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" diff --git a/main/winaccessibility/source/service/AccWindowEventListener.cxx b/main/winaccessibility/source/service/AccWindowEventListener.cxx index f563c1070d..61d85905d2 100644 --- a/main/winaccessibility/source/service/AccWindowEventListener.cxx +++ b/main/winaccessibility/source/service/AccWindowEventListener.cxx @@ -17,14 +17,14 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> - + #include "AccWindowEventListener.hxx" #include "AccObjectManagerAgent.hxx" #include "unomsaaevent.hxx" diff --git a/main/winaccessibility/source/service/ResIDGenerator.cxx b/main/winaccessibility/source/service/ResIDGenerator.cxx index 4ea0d67395..da02633d42 100644 --- a/main/winaccessibility/source/service/ResIDGenerator.cxx +++ b/main/winaccessibility/source/service/ResIDGenerator.cxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include "ResIDGenerator.hxx" /** diff --git a/main/winaccessibility/source/service/msaaservice_impl.cxx b/main/winaccessibility/source/service/msaaservice_impl.cxx index ca6c04500e..e7e5abcb2b 100644 --- a/main/winaccessibility/source/service/msaaservice_impl.cxx +++ b/main/winaccessibility/source/service/msaaservice_impl.cxx @@ -17,8 +17,8 @@ * specific language governing permissions and limitations * under the License. * - *************************************************************/ - + *************************************************************/ + #include <cppuhelper/implbase3.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/implementationentry.hxx> @@ -30,18 +30,18 @@ #include <com/sun/star/awt/XExtendedToolkit.hpp> #include <vcl/svapp.hxx> - + using namespace ::rtl; // for OUString using namespace ::com::sun::star; // for odk interfaces using namespace ::com::sun::star::uno; // for basic types using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::awt; - -typedef sal_Int32 HWND; + +typedef sal_Int32 HWND; #include "AccTopWindowListener.hxx" -#include "g_msacc.hxx" +#include "g_msacc.hxx" extern void FreeTopWindowListener(); extern long GetMSComPtr(long hWnd, long lParam, long wParam); @@ -278,7 +278,7 @@ extern "C" sal_Char const ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } + } void * SAL_CALL component_getFactory( sal_Char const * implName, lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry )