diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-11-17 21:37:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-11-22 09:55:16 +0100 |
commit | 4b7cbb569e52e483a5edda8afe27d423e428edbb (patch) | |
tree | b767f526b821002d1b71d49e0e205d9e3dcab8fa /svtools | |
parent | b9b62d96f6de8908ddf69f5b56eb58fe82013a24 (diff) |
weld SwCondCollPage
and put back original SvTreeListBox a11y factory use
Change-Id: I4ad8ce29d8fed6ec5d44e9a1d641919a89226b79
Reviewed-on: https://gerrit.libreoffice.org/63501
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 47897fdd936d9b6e9ac8cb6110c79352ab080df7)
Reviewed-on: https://gerrit.libreoffice.org/63770
Diffstat (limited to 'svtools')
21 files changed, 97 insertions, 3559 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index a10c57ce21cf..d17c85396e3d 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -97,7 +97,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/contnr/imivctl2 \ svtools/source/contnr/ivctrl \ svtools/source/contnr/simptabl \ - svtools/source/contnr/svtabbx \ svtools/source/contnr/templwin \ svtools/source/control/accessibleruler \ svtools/source/control/asynclink \ @@ -109,7 +108,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/control/ctrltool \ svtools/source/control/filectrl \ svtools/source/control/fileurlbox \ - svtools/source/control/headbar \ svtools/source/control/hyperlabel \ svtools/source/control/indexentryres \ svtools/source/control/inettbc \ @@ -124,8 +122,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/control/urlcontrol \ svtools/source/control/valueacc \ svtools/source/control/valueset \ - svtools/source/control/vclxaccessibleheaderbar \ - svtools/source/control/vclxaccessibleheaderbaritem \ svtools/source/dialogs/addresstemplate \ svtools/source/dialogs/colrdlg \ svtools/source/dialogs/insdlg \ @@ -167,7 +163,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/misc/openfiledroptargetlistener \ svtools/source/misc/sampletext \ svtools/source/misc/stringtransfer \ - svtools/source/misc/svtaccessiblefactory \ svtools/source/misc/svtresid \ svtools/source/misc/templatefoldercache \ svtools/source/misc/unitconv \ diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx index 3d7c3869a9d8..ac1a0349fe51 100644 --- a/svtools/inc/pch/precompiled_svt.hxx +++ b/svtools/inc/pch/precompiled_svt.hxx @@ -413,10 +413,8 @@ #include <unotools/ucbhelper.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/unotoolsdllapi.h> -#include <svtools/AccessibleBrowseBoxObjType.hxx> #include <svtools/brwbox.hxx> #include <svtools/colorcfg.hxx> -#include <svtools/headbar.hxx> #include <svtools/htmlkywd.hxx> #include <svtools/htmltokn.h> #include <svtools/iconview.hxx> @@ -428,6 +426,8 @@ #include <svtools/svtdllapi.h> #include <svtools/svtresid.hxx> #include <svtools/table/tabletypes.hxx> +#include <vcl/AccessibleBrowseBoxObjType.hxx> +#include <vcl/headbar.hxx> #include <vcl/transfer.hxx> #include <vcl/svlbitm.hxx> #include <vcl/imap.hxx> diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx index 00b04baae59d..e57801b6b0a5 100644 --- a/svtools/inc/table/tablecontrol.hxx +++ b/svtools/inc/table/tablecontrol.hxx @@ -22,8 +22,8 @@ #include <svtools/svtdllapi.h> #include <svtools/table/tablemodel.hxx> -#include <svtools/accessibletable.hxx> -#include <svtools/accessiblefactory.hxx> +#include <vcl/accessibletable.hxx> +#include <vcl/accessiblefactory.hxx> #include <vcl/ctrl.hxx> #include <vcl/seleng.hxx> @@ -32,8 +32,6 @@ namespace svt { namespace table { - - class TableControl_Impl; @@ -55,7 +53,7 @@ namespace svt { namespace table cell). The control supports accessibility, this is encapsulated in IAccessibleTable */ - class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable + class SVT_DLLPUBLIC TableControl : public Control, public vcl::table::IAccessibleTable { private: std::shared_ptr<TableControl_Impl> m_pImpl; @@ -118,10 +116,10 @@ namespace svt { namespace table /** Creates and returns the accessible object of the whole GridControl. */ SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; SVT_DLLPRIVATE virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override; - SVT_DLLPRIVATE virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const override; + SVT_DLLPRIVATE virtual OUString GetAccessibleObjectName(vcl::table::AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const override; SVT_DLLPRIVATE virtual void GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ) override; - SVT_DLLPRIVATE virtual OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType) const override; - SVT_DLLPRIVATE virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, AccessibleTableControlObjType eObjType ) const override; + SVT_DLLPRIVATE virtual OUString GetAccessibleObjectDescription(vcl::table::AccessibleTableControlObjType eObjType) const override; + SVT_DLLPRIVATE virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, vcl::table::AccessibleTableControlObjType eObjType ) const override; // temporary methods // Those do not really belong into the public API - they're intended for firing A11Y-related events. However, diff --git a/svtools/inc/vclxaccessibleheaderbar.hxx b/svtools/inc/vclxaccessibleheaderbar.hxx deleted file mode 100644 index e13ef9fb317d..000000000000 --- a/svtools/inc/vclxaccessibleheaderbar.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVTOOLS_INC_VCLXACCESSIBLEHEADERBAR_HXX -#define INCLUDED_SVTOOLS_INC_VCLXACCESSIBLEHEADERBAR_HXX - -#include <svtools/headbar.hxx> -#include <toolkit/awt/vclxaccessiblecomponent.hxx> -#include <toolkit/awt/vclxwindow.hxx> - -class HeaderBar; - - -// class VCLXAccessibleHeaderBar - - -typedef std::vector< css::uno::WeakReference< css::accessibility::XAccessible > > - ListItems; - -class VCLXAccessibleHeaderBar : public VCLXAccessibleComponent -{ - -public: - VclPtr<HeaderBar> m_pHeadBar; - virtual ~VCLXAccessibleHeaderBar() override; - - VCLXAccessibleHeaderBar( VCLXWindow* pVCLXindow ); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; - virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; - - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - -public: - virtual void SAL_CALL disposing() override; - css::uno::Reference< css::accessibility::XAccessible > CreateChild(sal_Int32 i); - -private: - ListItems m_aAccessibleChildren; - - -}; - -class VCLXHeaderBar : public VCLXWindow -{ -public: - VCLXHeaderBar(vcl::Window* pHeaderBar); - virtual ~VCLXHeaderBar() override; - - virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; - -}; - -#endif // INCLUDED_SVTOOLS_INC_VCLXACCESSIBLEHEADERBAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/vclxaccessibleheaderbaritem.hxx b/svtools/inc/vclxaccessibleheaderbaritem.hxx deleted file mode 100644 index e4b09ef3a655..000000000000 --- a/svtools/inc/vclxaccessibleheaderbaritem.hxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVTOOLS_INC_VCLXACCESSIBLEHEADERBARITEM_HXX -#define INCLUDED_SVTOOLS_INC_VCLXACCESSIBLEHEADERBARITEM_HXX - -#include <com/sun/star/accessibility/XAccessible.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <comphelper/accessiblecomponenthelper.hxx> -#include <cppuhelper/implbase2.hxx> - -#include <tools/link.hxx> - -#include <vcl/vclptr.hxx> - -#include <vector> - -class HeaderBar; -class VclSimpleEvent; -class VclWindowEvent; - -namespace utl { -class AccessibleStateSetHelper; -} - - -// ---------------------------------------------------- -// class VCLXAccessibleHeaderBarItem -// ---------------------------------------------------- - -typedef ::cppu::ImplHelper2< - css::accessibility::XAccessible, - css::lang::XServiceInfo > VCLXAccessibleHeaderBarItem_BASE; - -class VCLXAccessibleHeaderBarItem final : public comphelper::OAccessibleExtendedComponentHelper, - public VCLXAccessibleHeaderBarItem_BASE -{ -private: - VclPtr<HeaderBar> m_pHeadBar; - sal_Int32 const m_nIndexInParent; - - void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); - - // OCommonAccessibleComponent - virtual css::awt::Rectangle implGetBounds( ) override; - -public: - VCLXAccessibleHeaderBarItem( HeaderBar* pHeadBar, sal_Int32 _nIndexInParent ); - virtual ~VCLXAccessibleHeaderBarItem() override; - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - // XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; - virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; - virtual OUString SAL_CALL getAccessibleDescription( ) override; - virtual OUString SAL_CALL getAccessibleName( ) override; - virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; - virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; - virtual css::lang::Locale SAL_CALL getLocale( ) override; - - // XAccessibleComponent - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; - virtual void SAL_CALL grabFocus( ) override {}; - virtual sal_Int32 SAL_CALL getForeground() override; - virtual sal_Int32 SAL_CALL getBackground() override; - - // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; - virtual OUString SAL_CALL getTitledBorderText( ) override; - virtual OUString SAL_CALL getToolTipText( ) override; -}; - -#endif // INCLUDED_SVTOOLS_INC_VCLXACCESSIBLEHEADERBARITEM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 561d1dbe1a30..8453aecd2fae 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -742,13 +742,13 @@ void BrowseBox::RemoveColumns() commitBrowseBoxEvent( CHILD, Any(), - makeAny(m_pImpl->getAccessibleHeaderBar(BBTYPE_COLUMNHEADERBAR)) + makeAny(m_pImpl->getAccessibleHeaderBar(vcl::BBTYPE_COLUMNHEADERBAR)) ); // and now append it again commitBrowseBoxEvent( CHILD, - makeAny(m_pImpl->getAccessibleHeaderBar(BBTYPE_COLUMNHEADERBAR)), + makeAny(m_pImpl->getAccessibleHeaderBar(vcl::BBTYPE_COLUMNHEADERBAR)), Any() ); @@ -1076,13 +1076,13 @@ void BrowseBox::Clear() commitBrowseBoxEvent( CHILD, Any(), - makeAny( m_pImpl->getAccessibleHeaderBar( BBTYPE_ROWHEADERBAR ) ) + makeAny( m_pImpl->getAccessibleHeaderBar( vcl::BBTYPE_ROWHEADERBAR ) ) ); // and now append it again commitBrowseBoxEvent( CHILD, - makeAny( m_pImpl->getAccessibleHeaderBar( BBTYPE_ROWHEADERBAR ) ), + makeAny( m_pImpl->getAccessibleHeaderBar( vcl::BBTYPE_ROWHEADERBAR ) ), Any() ); @@ -1319,13 +1319,13 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, bool bDoPaint ) commitBrowseBoxEvent( CHILD, Any(), - makeAny( m_pImpl->getAccessibleHeaderBar( BBTYPE_ROWHEADERBAR ) ) + makeAny( m_pImpl->getAccessibleHeaderBar( vcl::BBTYPE_ROWHEADERBAR ) ) ); // and now append it again commitBrowseBoxEvent( CHILD, - makeAny(m_pImpl->getAccessibleHeaderBar(BBTYPE_ROWHEADERBAR)), + makeAny(m_pImpl->getAccessibleHeaderBar(vcl::BBTYPE_ROWHEADERBAR)), Any() ); commitBrowseBoxEvent( diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 24149788c11f..587ceb42d6ba 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -18,7 +18,7 @@ */ #include <svtools/brwbox.hxx> -#include <svtools/AccessibleBrowseBoxObjType.hxx> +#include <vcl/AccessibleBrowseBoxObjType.hxx> #include <sal/log.hxx> #include <tools/debug.hxx> #include <tools/multisel.hxx> @@ -41,10 +41,10 @@ namespace svt static Reference< XAccessible > getHeaderCell( BrowseBoxImpl::THeaderCellMap& _raHeaderCells, sal_Int32 _nPos, - AccessibleBrowseBoxObjType _eType, + vcl::AccessibleBrowseBoxObjType _eType, const Reference< XAccessible >& _rParent, BrowseBox& _rBrowseBox, - IAccessibleFactory const & rFactory + vcl::IAccessibleFactory const & rFactory ) { Reference< XAccessible > xRet; @@ -66,7 +66,7 @@ namespace svt } - Reference< XAccessible > BrowseBoxImpl::getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType ) + Reference< XAccessible > BrowseBoxImpl::getAccessibleHeaderBar( vcl::AccessibleBrowseBoxObjType _eObjType ) { if ( m_pAccessible && m_pAccessible->isAlive() ) return m_pAccessible->getHeaderBar( _eObjType ); @@ -130,8 +130,8 @@ Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow ) return svt::getHeaderCell( m_pImpl->m_aRowHeaderCellMap, _nRow, - svt::BBTYPE_ROWHEADERCELL, - m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_ROWHEADERBAR), + vcl::BBTYPE_ROWHEADERCELL, + m_pImpl->getAccessibleHeaderBar(vcl::BBTYPE_ROWHEADERBAR), *this, m_pImpl->m_aFactoryAccess.getFactory() ); @@ -143,8 +143,8 @@ Reference< XAccessible > BrowseBox::CreateAccessibleColumnHeader( sal_uInt16 _nC return svt::getHeaderCell( m_pImpl->m_aColHeaderCellMap, _nColumnPos, - svt::BBTYPE_COLUMNHEADERCELL, - m_pImpl->getAccessibleHeaderBar(svt::BBTYPE_COLUMNHEADERBAR), + vcl::BBTYPE_COLUMNHEADERCELL, + m_pImpl->getAccessibleHeaderBar(vcl::BBTYPE_COLUMNHEADERBAR), *this, m_pImpl->m_aFactoryAccess.getFactory() ); @@ -206,24 +206,24 @@ bool BrowseBox::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _r // Object data and state ------------------------------------------------------ -OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const +OUString BrowseBox::GetAccessibleObjectName( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const { OUString aRetText; switch( eObjType ) { - case ::svt::BBTYPE_BROWSEBOX: + case ::vcl::BBTYPE_BROWSEBOX: aRetText = "BrowseBox"; break; - case ::svt::BBTYPE_TABLE: + case ::vcl::BBTYPE_TABLE: aRetText = "Table"; break; - case ::svt::BBTYPE_ROWHEADERBAR: + case ::vcl::BBTYPE_ROWHEADERBAR: aRetText = "RowHeaderBar"; break; - case ::svt::BBTYPE_COLUMNHEADERBAR: + case ::vcl::BBTYPE_COLUMNHEADERBAR: aRetText = "ColumnHeaderBar"; break; - case ::svt::BBTYPE_TABLECELL: + case ::vcl::BBTYPE_TABLECELL: if( ColCount() !=0 && GetRowCount()!=0) { @@ -242,7 +242,7 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e + "]"; #endif break; - case ::svt::BBTYPE_ROWHEADERCELL: + case ::vcl::BBTYPE_ROWHEADERCELL: { sal_Int32 rowId = _nPosition + 1; aRetText = OUString::number( rowId ); @@ -255,7 +255,7 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e + "]"; #endif break; - case ::svt::BBTYPE_COLUMNHEADERCELL: + case ::vcl::BBTYPE_COLUMNHEADERCELL: aRetText = GetColumnDescription( sal_Int16( _nPosition ) ); #if OSL_DEBUG_LEVEL > 0 aRetText += " [" @@ -272,33 +272,33 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e } -OUString BrowseBox::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const +OUString BrowseBox::GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const { OUString aRetText; switch( eObjType ) { - case ::svt::BBTYPE_BROWSEBOX: + case ::vcl::BBTYPE_BROWSEBOX: aRetText = "BrowseBox description"; break; - case ::svt::BBTYPE_TABLE: + case ::vcl::BBTYPE_TABLE: // aRetText = "TABLE description"; break; - case ::svt::BBTYPE_ROWHEADERBAR: + case ::vcl::BBTYPE_ROWHEADERBAR: // aRetText = "ROWHEADERBAR description"; break; - case ::svt::BBTYPE_COLUMNHEADERBAR: + case ::vcl::BBTYPE_COLUMNHEADERBAR: // aRetText = "COLUMNHEADERBAR description"; break; - case ::svt::BBTYPE_TABLECELL: + case ::vcl::BBTYPE_TABLECELL: // aRetText = "TABLECELL description"; break; - case ::svt::BBTYPE_ROWHEADERCELL: + case ::vcl::BBTYPE_ROWHEADERCELL: // aRetText = "ROWHEADERCELL description"; break; - case ::svt::BBTYPE_COLUMNHEADERCELL: + case ::vcl::BBTYPE_COLUMNHEADERCELL: // aRetText = "COLUMNHEADERCELL description"; break; - case ::svt::BBTYPE_CHECKBOXCELL: + case ::vcl::BBTYPE_CHECKBOXCELL: break; } return aRetText; @@ -319,12 +319,12 @@ OUString BrowseBox::GetColumnDescription( sal_uInt16 _nColumn ) const void BrowseBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, - ::svt::AccessibleBrowseBoxObjType eObjType ) const + ::vcl::AccessibleBrowseBoxObjType eObjType ) const { switch( eObjType ) { - case ::svt::BBTYPE_BROWSEBOX: - case ::svt::BBTYPE_TABLE: + case ::vcl::BBTYPE_BROWSEBOX: + case ::vcl::BBTYPE_TABLE: rStateSet.AddState( AccessibleStateType::FOCUSABLE ); if ( HasFocus() ) @@ -340,25 +340,25 @@ void BrowseBox::FillAccessibleStateSet( } if ( IsReallyVisible() ) rStateSet.AddState( AccessibleStateType::VISIBLE ); - if ( eObjType == ::svt::BBTYPE_TABLE ) + if ( eObjType == ::vcl::BBTYPE_TABLE ) rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; - case ::svt::BBTYPE_ROWHEADERBAR: + case ::vcl::BBTYPE_ROWHEADERBAR: rStateSet.AddState( AccessibleStateType::FOCUSABLE ); rStateSet.AddState( AccessibleStateType::VISIBLE ); if ( GetSelectRowCount() ) rStateSet.AddState( AccessibleStateType::FOCUSED ); rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; - case ::svt::BBTYPE_COLUMNHEADERBAR: + case ::vcl::BBTYPE_COLUMNHEADERBAR: rStateSet.AddState( AccessibleStateType::FOCUSABLE ); rStateSet.AddState( AccessibleStateType::VISIBLE ); if ( GetSelectColumnCount() ) rStateSet.AddState( AccessibleStateType::FOCUSED ); rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; - case ::svt::BBTYPE_TABLECELL: + case ::vcl::BBTYPE_TABLECELL: { sal_Int32 nRow = GetCurRow(); sal_uInt16 nColumn = GetCurColumnId(); @@ -369,9 +369,9 @@ void BrowseBox::FillAccessibleStateSet( rStateSet.AddState( AccessibleStateType::TRANSIENT ); } break; - case ::svt::BBTYPE_ROWHEADERCELL: - case ::svt::BBTYPE_COLUMNHEADERCELL: - case ::svt::BBTYPE_CHECKBOXCELL: + case ::vcl::BBTYPE_ROWHEADERCELL: + case ::vcl::BBTYPE_COLUMNHEADERCELL: + case ::vcl::BBTYPE_CHECKBOXCELL: OSL_FAIL("Illegal call here!"); break; } @@ -410,7 +410,6 @@ void BrowseBox::commitHeaderBarEvent(sal_Int16 nEventId, rNewValue, rOldValue, _bColumnHeaderBar ); } - void BrowseBox::commitTableEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { if ( isAccessibleAlive() ) @@ -423,13 +422,11 @@ void BrowseBox::commitBrowseBoxEvent( sal_Int16 _nEventId, const Any& _rNewValue m_pImpl->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); } - -::svt::IAccessibleFactory& BrowseBox::getAccessibleFactory() +::vcl::IAccessibleFactory& BrowseBox::getAccessibleFactory() { return m_pImpl->m_aFactoryAccess.getFactory(); } - bool BrowseBox::isAccessibleAlive( ) const { return ( nullptr != m_pImpl->m_pAccessible ) && m_pImpl->m_pAccessible->isAlive(); diff --git a/svtools/source/brwbox/brwimpl.hxx b/svtools/source/brwbox/brwimpl.hxx index e39c313b4da1..4e8fb8844675 100644 --- a/svtools/source/brwbox/brwimpl.hxx +++ b/svtools/source/brwbox/brwimpl.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_SVTOOLS_SOURCE_BRWBOX_BRWIMPL_HXX #define INCLUDED_SVTOOLS_SOURCE_BRWBOX_BRWIMPL_HXX -#include <svtaccessiblefactory.hxx> +#include <vcl/svtaccessiblefactory.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <osl/diagnose.h> @@ -52,8 +52,8 @@ namespace svt }; public: - AccessibleFactoryAccess m_aFactoryAccess; - IAccessibleBrowseBox* m_pAccessible; + vcl::AccessibleFactoryAccess m_aFactoryAccess; + vcl::IAccessibleBrowseBox* m_pAccessible; THeaderCellMap m_aColHeaderCellMap; THeaderCellMap m_aRowHeaderCellMap; @@ -65,7 +65,7 @@ namespace svt /// @see AccessibleBrowseBox::getHeaderBar css::uno::Reference< css::accessibility::XAccessible > - getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType ); + getAccessibleHeaderBar( vcl::AccessibleBrowseBoxObjType _eObjType ); /// @see AccessibleBrowseBox::getTable css::uno::Reference< css::accessibility::XAccessible > diff --git a/svtools/source/brwbox/editbrowsebox2.cxx b/svtools/source/brwbox/editbrowsebox2.cxx index 5a1fc3f6d765..ece11a380add 100644 --- a/svtools/source/brwbox/editbrowsebox2.cxx +++ b/svtools/source/brwbox/editbrowsebox2.cxx @@ -23,7 +23,7 @@ #include "editbrowseboximpl.hxx" #include <comphelper/types.hxx> #include <toolkit/helper/vclunohelper.hxx> -#include <svtaccessiblefactory.hxx> +#include <vcl/svtaccessiblefactory.hxx> #include <osl/diagnose.h> namespace svt @@ -44,7 +44,7 @@ Reference< XAccessible > EditBrowseBox::CreateAccessibleCheckBoxCell(long _nRow, if ( xAccContext.is() ) { xReturn = getAccessibleFactory().createAccessibleCheckBoxCell( - xAccContext->getAccessibleChild( ::svt::BBINDEX_TABLE ), + xAccContext->getAccessibleChild( ::vcl::BBINDEX_TABLE ), *this, nullptr, _nRow, diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 257296127c21..166302d0860f 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -26,14 +26,14 @@ #include <svtools/fileview.hxx> #include <svtools/svtresid.hxx> #include <svtools/imagemgr.hxx> -#include <svtools/headbar.hxx> -#include <svtools/svtabbx.hxx> +#include <vcl/headbar.hxx> +#include <vcl/svtabbx.hxx> #include <svtools/strings.hrc> #include <bitmaps.hlst> #include <vcl/viewdataentry.hxx> #include <toolkit/helper/vclunohelper.hxx> #include "contentenumeration.hxx" -#include <svtools/AccessibleBrowseBoxObjType.hxx> +#include <vcl/AccessibleBrowseBoxObjType.hxx> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/task/InteractionHandler.hpp> @@ -187,7 +187,7 @@ private: protected: virtual bool DoubleClickHdl() override; - virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override; + virtual OUString GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const override; public: ViewTabListBox_Impl( vcl::Window* pParentWin, SvtFileView_Impl* pParent, FileViewFlags nFlags ); @@ -797,10 +797,10 @@ bool ViewTabListBox_Impl::DoubleClickHdl() // who knows ...) } -OUString ViewTabListBox_Impl::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const +OUString ViewTabListBox_Impl::GetAccessibleObjectDescription( ::vcl::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const { OUString sRet = SvHeaderTabListBox::GetAccessibleObjectDescription( _eType, _nPos ); - if ( ::svt::BBTYPE_TABLECELL == _eType ) + if ( ::vcl::BBTYPE_TABLECELL == _eType ) { sal_Int32 nRow = -1; const sal_uInt16 nColumnCount = GetColumnCount(); diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index b3d9f4361a3b..cb2c4b47b244 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -27,7 +27,7 @@ #include <vcl/vclptr.hxx> #include <vcl/seleng.hxx> #include <tools/debug.hxx> -#include <svtaccessiblefactory.hxx> +#include <vcl/svtaccessiblefactory.hxx> #include <limits.h> @@ -187,7 +187,7 @@ class SvxIconChoiceCtrl_Impl VclPtr<VirtualDevice> pEntryPaintDev; SvxIconChoiceCtrlEntry* pAnchor; // for selection LocalFocus aFocus; // Data for focusrect - ::svt::AccessibleFactoryAccess aAccFactory; + ::vcl::AccessibleFactoryAccess aAccFactory; SvxIconChoiceCtrlEntry* pCurEditedEntry; SvxIconChoiceCtrlTextMode eTextMode; @@ -456,7 +456,7 @@ public: void CallEventListeners( VclEventId nEvent, void* pData ); - ::svt::IAccessibleFactory& GetAccessibleFactory() + ::vcl::IAccessibleFactory& GetAccessibleFactory() { return aAccFactory.getFactory(); } diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx deleted file mode 100644 index 672fe544f9a4..000000000000 --- a/svtools/source/contnr/svtabbx.cxx +++ /dev/null @@ -1,1155 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <memory> -#include <svtools/svtabbx.hxx> -#include <svtools/headbar.hxx> -#include <svtools/svtresid.hxx> -#include <vcl/svlbitm.hxx> -#include <svtools/strings.hrc> -#include <vcl/treelistentry.hxx> -#include <vcl/builderfactory.hxx> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/accessibility/AccessibleEventId.hpp> -#include <svtaccessiblefactory.hxx> -#include <o3tl/make_unique.hxx> -#include <sal/log.hxx> -#include <osl/diagnose.h> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::accessibility; - -static constexpr SvLBoxTabFlags MYTABMASK = - SvLBoxTabFlags::ADJUST_RIGHT | SvLBoxTabFlags::ADJUST_LEFT | SvLBoxTabFlags::ADJUST_CENTER | SvLBoxTabFlags::ADJUST_NUMERIC; - -// SvTreeListBox callback - -void SvTabListBox::SetTabs() -{ - SvTreeListBox::SetTabs(); - if( mvTabList.empty() ) - return; - - DBG_ASSERT(!mvTabList.empty(),"TabList ?"); - - // The tree listbox has now inserted its tabs into the list. Now we - // fluff up the list with additional tabs and adjust the rightmost tab - // of the tree listbox. - - // Picking the rightmost tab. - // HACK for the explorer! If ViewParent != 0, the first tab of the tree - // listbox is calculated by the tre listbox itself! This behavior is - // necessary for ButtonsOnRoot, as the explorer does not know in this - // case, which additional offset it need to add to the tabs in this mode - // -- the tree listbox knows that, though! - /* - if( !pViewParent ) - { - SvLBoxTab* pFirstTab = (SvLBoxTab*)aTabs.GetObject( aTabs.Count()-1 ); - pFirstTab->SetPos( pTabList[0].GetPos() ); - pFirstTab->nFlags &= ~MYTABMASK; - pFirstTab->nFlags |= pTabList[0].nFlags; - } - */ - - // append all other tabs to the list - for( sal_uInt16 nCurTab = 1; nCurTab < sal_uInt16(mvTabList.size()); nCurTab++ ) - { - SvLBoxTab& rTab = mvTabList[nCurTab]; - AddTab( rTab.GetPos(), rTab.nFlags ); - } -} - -void SvTabListBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, - const Image& rColl, const Image& rExp, SvLBoxButtonKind eButtonKind) -{ - SvTreeListBox::InitEntry(pEntry, rStr, rColl, rExp, eButtonKind); - - sal_Int32 nIndex = 0; - // TODO: verify if nTabCount is always >0 here! - const sal_uInt16 nCount = mvTabList.size() - 1; - for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ ) - { - const OUString aToken = GetToken(aCurEntry, nIndex); - pEntry->AddItem(o3tl::make_unique<SvLBoxString>(aToken)); - } -} -SvTabListBox::SvTabListBox( vcl::Window* pParent, WinBits nBits ) - : SvTreeListBox( pParent, nBits ) -{ - SetHighlightRange(); // select full width -} - -VCL_BUILDER_FACTORY_CONSTRUCTOR(SvTabListBox, WB_TABSTOP) - -SvTabListBox::~SvTabListBox() -{ - disposeOnce(); -} - -void SvTabListBox::dispose() -{ - mvTabList.clear(); - SvTreeListBox::dispose(); -} - -void SvTabListBox::SetTabs(sal_uInt16 nTabs, long const pTabPositions[], MapUnit eMapUnit) -{ - mvTabList.resize(nTabs); - - MapMode aMMSource( eMapUnit ); - MapMode aMMDest( MapUnit::MapPixel ); - - for( sal_uInt16 nIdx = 0; nIdx < sal_uInt16(mvTabList.size()); nIdx++, pTabPositions++ ) - { - Size aSize( *pTabPositions, 0 ); - aSize = LogicToLogic( aSize, &aMMSource, &aMMDest ); - long nNewTab = aSize.Width(); - mvTabList[nIdx].SetPos( nNewTab ); - mvTabList[nIdx].nFlags=(SvLBoxTabFlags::ADJUST_LEFT| SvLBoxTabFlags::INV_ALWAYS); - } - SvTreeListBox::nTreeFlags |= SvTreeFlags::RECALCTABS; - if( IsUpdateMode() ) - Invalidate(); -} - -void SvTabListBox::SetTab( sal_uInt16 nTab,long nValue,MapUnit eMapUnit ) -{ - DBG_ASSERT(nTab<mvTabList.size(),"Invalid Tab-Pos"); - if( nTab >= mvTabList.size() ) - return; - - MapMode aMMSource( eMapUnit ); - MapMode aMMDest( MapUnit::MapPixel ); - Size aSize( nValue, 0 ); - aSize = LogicToLogic( aSize, &aMMSource, &aMMDest ); - nValue = aSize.Width(); - mvTabList[ nTab ].SetPos( nValue ); - SvTreeListBox::nTreeFlags |= SvTreeFlags::RECALCTABS; - if( IsUpdateMode() ) - Invalidate(); -} - -SvTreeListEntry* SvTabListBox::InsertEntry( const OUString& rText, SvTreeListEntry* pParent, - bool /*bChildrenOnDemand*/, - sal_uLong nPos, void* pUserData, - SvLBoxButtonKind ) -{ - return InsertEntryToColumn( rText, pParent, nPos, 0xffff, pUserData ); -} - -SvTreeListEntry* SvTabListBox::InsertEntry( const OUString& rText, - const Image& rExpandedEntryBmp, - const Image& rCollapsedEntryBmp, - SvTreeListEntry* pParent, - bool /*bChildrenOnDemand*/, - sal_uLong nPos, void* pUserData, - SvLBoxButtonKind ) -{ - return InsertEntryToColumn( rText, rExpandedEntryBmp, rCollapsedEntryBmp, - pParent, nPos, 0xffff, pUserData ); -} - -SvTreeListEntry* SvTabListBox::InsertEntryToColumn(const OUString& rStr,SvTreeListEntry* pParent,sal_uLong nPos,sal_uInt16 nCol, - void* pUser ) -{ - OUString aStr; - if( nCol != 0xffff ) - { - while( nCol ) - { - aStr += "\t"; - nCol--; - } - } - aStr += rStr; - OUString aFirstStr( aStr ); - sal_Int32 nEnd = aFirstStr.indexOf( '\t' ); - if( nEnd != -1 ) - { - aFirstStr = aFirstStr.copy(0, nEnd); - aCurEntry = aStr.copy(++nEnd); - } - else - aCurEntry.clear(); - return SvTreeListBox::InsertEntry( aFirstStr, pParent, false, nPos, pUser ); -} - -SvTreeListEntry* SvTabListBox::InsertEntryToColumn( const OUString& rStr, - const Image& rExpandedEntryBmp, const Image& rCollapsedEntryBmp, - SvTreeListEntry* pParent,sal_uLong nPos,sal_uInt16 nCol, void* pUser ) -{ - OUString aStr; - if( nCol != 0xffff ) - { - while( nCol ) - { - aStr += "\t"; - nCol--; - } - } - aStr += rStr; - OUString aFirstStr( aStr ); - sal_Int32 nEnd = aFirstStr.indexOf('\t'); - if (nEnd != -1) - { - aFirstStr = aFirstStr.copy(0, nEnd); - aCurEntry = aStr.copy(++nEnd); - } - else - aCurEntry.clear(); - - return SvTreeListBox::InsertEntry( - aFirstStr, - rExpandedEntryBmp, rCollapsedEntryBmp, - pParent, false, nPos, pUser ); -} - -SvTreeListEntry* SvTabListBox::InsertEntryToColumn( const OUString& rStr, sal_uLong nPos, - sal_uInt16 nCol, void* pUser ) -{ - return InsertEntryToColumn( rStr,nullptr,nPos, nCol, pUser ); -} - -OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry ) const -{ - return GetEntryText( pEntry, 0xffff ); -} - -OUString SvTabListBox::GetEntryText( SvTreeListEntry* pEntry, sal_uInt16 nCol ) -{ - DBG_ASSERT(pEntry,"GetEntryText:Invalid Entry"); - OUStringBuffer aResult; - if( pEntry ) - { - sal_uInt16 nCount = pEntry->ItemCount(); - sal_uInt16 nCur = 0; - while( nCur < nCount ) - { - const SvLBoxItem& rStr = pEntry->GetItem( nCur ); - if (rStr.GetType() == SvLBoxItemType::String) - { - if( nCol == 0xffff ) - { - if (!aResult.isEmpty()) - aResult.append("\t"); - aResult.append(static_cast<const SvLBoxString&>(rStr).GetText()); - } - else - { - if( nCol == 0 ) - return static_cast<const SvLBoxString&>(rStr).GetText(); - nCol--; - } - } - nCur++; - } - } - return aResult.makeStringAndClear(); -} - -OUString SvTabListBox::GetEntryText( sal_uLong nPos, sal_uInt16 nCol ) const -{ - SvTreeListEntry* pEntry = GetEntryOnPos( nPos ); - return GetEntryText( pEntry, nCol ); -} - -void SvTabListBox::SetEntryText(const OUString& rStr, sal_uLong nPos, sal_uInt16 nCol) -{ - SvTreeListEntry* pEntry = SvTreeListBox::GetEntry( nPos ); - SetEntryText( rStr, pEntry, nCol ); -} - -void SvTabListBox::SetEntryText(const OUString& rStr, SvTreeListEntry* pEntry, sal_uInt16 nCol) -{ - DBG_ASSERT(pEntry,"SetEntryText:Invalid Entry"); - if( !pEntry ) - return; - - OUString sOldText = GetEntryText(pEntry, nCol); - if (sOldText == rStr) - return; - - sal_Int32 nIndex = 0; - const sal_uInt16 nTextColumn = nCol; - const sal_uInt16 nCount = pEntry->ItemCount(); - for (sal_uInt16 nCur = 0; nCur < nCount; ++nCur) - { - SvLBoxItem& rBoxItem = pEntry->GetItem( nCur ); - if (rBoxItem.GetType() == SvLBoxItemType::String) - { - if (!nCol || nCol==0xFFFF) - { - const OUString aTemp(GetToken(rStr, nIndex)); - static_cast<SvLBoxString&>(rBoxItem).SetText( aTemp ); - if (!nCol && nIndex<0) - break; - } - else - { - --nCol; - } - } - } - GetModel()->InvalidateEntry( pEntry ); - - std::unique_ptr<TabListBoxEventData> pData( new TabListBoxEventData( pEntry, nTextColumn, sOldText ) ); - CallEventListeners( VclEventId::TableCellNameChanged, pData.get() ); -} - -OUString SvTabListBox::GetCellText( sal_uLong nPos, sal_uInt16 nCol ) const -{ - SvTreeListEntry* pEntry = GetEntryOnPos( nPos ); - DBG_ASSERT( pEntry, "SvTabListBox::GetCellText(): Invalid Entry" ); - OUString aResult; - if (pEntry && pEntry->ItemCount() > static_cast<size_t>(nCol+1)) - { - const SvLBoxItem& rStr = pEntry->GetItem( nCol + 1 ); - if (rStr.GetType() == SvLBoxItemType::String) - aResult = static_cast<const SvLBoxString&>(rStr).GetText(); - } - return aResult; -} - -sal_uLong SvTabListBox::GetEntryPos( const OUString& rStr, sal_uInt16 nCol ) -{ - sal_uLong nPos = 0; - SvTreeListEntry* pEntry = First(); - while( pEntry ) - { - OUString aStr( GetEntryText( pEntry, nCol )); - if( aStr == rStr ) - return nPos; - pEntry = Next( pEntry ); - nPos++; - } - return 0xffffffff; -} - -sal_uLong SvTabListBox::GetEntryPos( const SvTreeListEntry* pEntry ) const -{ - sal_uLong nPos = 0; - SvTreeListEntry* pTmpEntry = First(); - while( pTmpEntry ) - { - if ( pTmpEntry == pEntry ) - return nPos; - pTmpEntry = Next( pTmpEntry ); - ++nPos; - } - return 0xffffffff; -} - -// static -OUString SvTabListBox::GetToken( const OUString &sStr, sal_Int32& nIndex ) -{ - return sStr.getToken(0, '\t', nIndex); -} - -OUString SvTabListBox::GetTabEntryText( sal_uLong nPos, sal_uInt16 nCol ) const -{ - SvTreeListEntry* pEntry = SvTreeListBox::GetEntry( nPos ); - DBG_ASSERT( pEntry, "GetTabEntryText(): Invalid entry " ); - OUStringBuffer aResult; - if ( pEntry ) - { - sal_uInt16 nCount = pEntry->ItemCount(); - sal_uInt16 nCur = ( 0 == nCol && IsCellFocusEnabled() ) ? GetCurrentTabPos() : 0; - while( nCur < nCount ) - { - const SvLBoxItem& rBoxItem = pEntry->GetItem( nCur ); - if (rBoxItem.GetType() == SvLBoxItemType::String) - { - if ( nCol == 0xffff ) - { - if (!aResult.isEmpty()) - aResult.append("\t"); - aResult.append(static_cast<const SvLBoxString&>(rBoxItem).GetText()); - } - else - { - if ( nCol == 0 ) - { - OUString sRet = static_cast<const SvLBoxString&>(rBoxItem).GetText(); - if ( sRet.isEmpty() ) - sRet = SvtResId( STR_SVT_ACC_EMPTY_FIELD ); - return sRet; - } - --nCol; - } - } - ++nCur; - } - } - return aResult.makeStringAndClear(); -} - -SvTreeListEntry* SvTabListBox::GetEntryOnPos( sal_uLong _nEntryPos ) const -{ - SvTreeListEntry* pEntry = nullptr; - sal_uLong i, nPos = 0, nCount = GetLevelChildCount( nullptr ); - for ( i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pParent = GetEntry(i); - if ( nPos == _nEntryPos ) - { - pEntry = pParent; - break; - } - else - { - nPos++; - pEntry = GetChildOnPos( pParent, _nEntryPos, nPos ); - if ( pEntry ) - break; - } - } - - return pEntry; -} - -SvTreeListEntry* SvTabListBox::GetChildOnPos( SvTreeListEntry* _pParent, sal_uLong _nEntryPos, sal_uLong& _rPos ) const -{ - sal_uLong i, nCount = GetLevelChildCount( _pParent ); - for ( i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pParent = GetEntry( _pParent, i ); - if ( _rPos == _nEntryPos ) - return pParent; - else - { - _rPos++; - SvTreeListEntry* pEntry = GetChildOnPos( pParent, _nEntryPos, _rPos ); - if ( pEntry ) - return pEntry; - } - } - - return nullptr; -} - -void SvTabListBox::SetTabJustify( sal_uInt16 nTab, SvTabJustify eJustify) -{ - DBG_ASSERT(nTab<mvTabList.size(),"GetTabPos:Invalid Tab"); - if( nTab >= mvTabList.size() ) - return; - SvLBoxTab& rTab = mvTabList[ nTab ]; - SvLBoxTabFlags nFlags = rTab.nFlags; - nFlags &= (~MYTABMASK); - nFlags |= static_cast<SvLBoxTabFlags>(eJustify); - rTab.nFlags = nFlags; - SvTreeListBox::nTreeFlags |= SvTreeFlags::RECALCTABS; - if( IsUpdateMode() ) - Invalidate(); -} - -long SvTabListBox::GetLogicTab( sal_uInt16 nTab ) -{ - if( SvTreeListBox::nTreeFlags & SvTreeFlags::RECALCTABS ) - SetTabs(); - - DBG_ASSERT(nTab<mvTabList.size(),"GetTabPos:Invalid Tab"); - return aTabs[ nTab ]->GetPos(); -} - -namespace svt -{ - struct SvHeaderTabListBoxImpl - { - VclPtr<HeaderBar> m_pHeaderBar; - AccessibleFactoryAccess m_aFactoryAccess; - - SvHeaderTabListBoxImpl() : m_pHeaderBar( nullptr ) { } - }; -} - -SvHeaderTabListBox::SvHeaderTabListBox( vcl::Window* pParent, WinBits nWinStyle ) - : SvTabListBox(pParent, nWinStyle) - , m_bFirstPaint(true) - , m_pImpl(new ::svt::SvHeaderTabListBoxImpl) - , m_pAccessible(nullptr) -{ -} - -SvHeaderTabListBox::~SvHeaderTabListBox() -{ - disposeOnce(); -} - -void SvHeaderTabListBox::dispose() -{ - m_pImpl.reset(); - SvTabListBox::dispose(); -} - -void SvHeaderTabListBox::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) -{ - if (m_bFirstPaint) - { - m_bFirstPaint = false; - } - SvTabListBox::Paint(rRenderContext, rRect); -} - -void SvHeaderTabListBox::InitHeaderBar( HeaderBar* pHeaderBar ) -{ - DBG_ASSERT( !m_pImpl->m_pHeaderBar, "header bar already initialized" ); - DBG_ASSERT( pHeaderBar, "invalid header bar initialization" ); - m_pImpl->m_pHeaderBar = pHeaderBar; - SetScrolledHdl( LINK( this, SvHeaderTabListBox, ScrollHdl_Impl ) ); - m_pImpl->m_pHeaderBar->SetCreateAccessibleHdl( LINK( this, SvHeaderTabListBox, CreateAccessibleHdl_Impl ) ); -} - -bool SvHeaderTabListBox::IsItemChecked( SvTreeListEntry* pEntry, sal_uInt16 nCol ) -{ - SvButtonState eState = SvButtonState::Unchecked; - SvLBoxButton& rItem = static_cast<SvLBoxButton&>( pEntry->GetItem( nCol + 1 ) ); - - if (rItem.GetType() == SvLBoxItemType::Button) - { - SvItemStateFlags nButtonFlags = rItem.GetButtonFlags(); - eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags ); - } - - return ( eState == SvButtonState::Checked ); -} - -SvTreeListEntry* SvHeaderTabListBox::InsertEntryToColumn( - const OUString& rStr, sal_uLong nPos, sal_uInt16 nCol, void* pUserData ) -{ - SvTreeListEntry* pEntry = SvTabListBox::InsertEntryToColumn( rStr, nPos, nCol, pUserData ); - RecalculateAccessibleChildren(); - return pEntry; -} - -SvTreeListEntry* SvHeaderTabListBox::InsertEntryToColumn( - const OUString& rStr, SvTreeListEntry* pParent, sal_uLong nPos, sal_uInt16 nCol, void* pUserData ) -{ - SvTreeListEntry* pEntry = SvTabListBox::InsertEntryToColumn( rStr, pParent, nPos, nCol, pUserData ); - RecalculateAccessibleChildren(); - return pEntry; -} - -SvTreeListEntry* SvHeaderTabListBox::InsertEntryToColumn( - const OUString& rStr, const Image& rExpandedEntryBmp, const Image& rCollapsedEntryBmp, - SvTreeListEntry* pParent, sal_uLong nPos, sal_uInt16 nCol, void* pUserData ) -{ - SvTreeListEntry* pEntry = SvTabListBox::InsertEntryToColumn( - rStr, rExpandedEntryBmp, rCollapsedEntryBmp, pParent, nPos, nCol, pUserData ); - RecalculateAccessibleChildren(); - return pEntry; -} - -sal_uLong SvHeaderTabListBox::Insert( - SvTreeListEntry* pEnt, SvTreeListEntry* pPar, sal_uLong nPos ) -{ - sal_uLong n = SvTabListBox::Insert( pEnt, pPar, nPos ); - RecalculateAccessibleChildren(); - return n; -} - -sal_uLong SvHeaderTabListBox::Insert( SvTreeListEntry* pEntry, sal_uLong nRootPos ) -{ - sal_uLong nPos = SvTabListBox::Insert( pEntry, nRootPos ); - RecalculateAccessibleChildren(); - return nPos; -} - -void SvHeaderTabListBox::RemoveEntry( SvTreeListEntry const * _pEntry ) -{ - GetModel()->Remove( _pEntry ); - m_aAccessibleChildren.clear(); -} - -void SvHeaderTabListBox::Clear() -{ - SvTabListBox::Clear(); - m_aAccessibleChildren.clear(); -} - -IMPL_LINK_NOARG(SvHeaderTabListBox, ScrollHdl_Impl, SvTreeListBox*, void) -{ - m_pImpl->m_pHeaderBar->SetOffset( -GetXOffset() ); -} - -IMPL_LINK_NOARG(SvHeaderTabListBox, CreateAccessibleHdl_Impl, HeaderBar*, void) -{ - vcl::Window* pParent = m_pImpl->m_pHeaderBar->GetAccessibleParentWindow(); - DBG_ASSERT( pParent, "SvHeaderTabListBox..CreateAccessibleHdl_Impl - accessible parent not found" ); - if ( pParent ) - { - css::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible(); - if ( xAccParent.is() ) - { - Reference< XAccessible > xAccessible = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxHeaderBar( - xAccParent, *this, ::svt::BBTYPE_COLUMNHEADERBAR ); - m_pImpl->m_pHeaderBar->SetAccessible( xAccessible ); - } - } -} - -void SvHeaderTabListBox::RecalculateAccessibleChildren() -{ - if ( !m_aAccessibleChildren.empty() ) - { - sal_uInt32 nCount = ( GetRowCount() + 1 ) * GetColumnCount(); - if ( m_aAccessibleChildren.size() < nCount ) - m_aAccessibleChildren.resize( nCount ); - else - { - DBG_ASSERT( m_aAccessibleChildren.size() == nCount, "wrong children count" ); - } - } -} - -bool SvHeaderTabListBox::IsCellCheckBox( long _nRow, sal_uInt16 _nColumn, TriState& _rState ) -{ - bool bRet = false; - SvTreeListEntry* pEntry = GetEntry( _nRow ); - if ( pEntry ) - { - sal_uInt16 nItemCount = pEntry->ItemCount(); - if ( nItemCount > ( _nColumn + 1 ) ) - { - SvLBoxItem& rItem = pEntry->GetItem( _nColumn + 1 ); - if (rItem.GetType() == SvLBoxItemType::Button) - { - bRet = true; - _rState = ( ( static_cast<SvLBoxButton&>(rItem).GetButtonFlags() & SvItemStateFlags::UNCHECKED ) == SvItemStateFlags::NONE ) - ? TRISTATE_TRUE : TRISTATE_FALSE; - } - } - else - { - SAL_WARN( "svtools.contnr", "SvHeaderTabListBox::IsCellCheckBox(): column out of range" ); - } - } - return bRet; -} -long SvHeaderTabListBox::GetRowCount() const -{ - return GetEntryCount(); -} - -sal_uInt16 SvHeaderTabListBox::GetColumnCount() const -{ - return m_pImpl->m_pHeaderBar->GetItemCount(); -} - -sal_Int32 SvHeaderTabListBox::GetCurrRow() const -{ - sal_Int32 nRet = -1; - SvTreeListEntry* pEntry = GetCurEntry(); - if ( pEntry ) - { - sal_uLong nCount = GetEntryCount(); - for ( sal_uLong i = 0; i < nCount; ++i ) - { - if ( pEntry == GetEntry(i) ) - { - nRet = i; - break; - } - } - } - - return nRet; -} - -sal_uInt16 SvHeaderTabListBox::GetCurrColumn() const -{ - sal_uInt16 nPos = GetCurrentTabPos() - 1; - return nPos; -} - -OUString SvHeaderTabListBox::GetRowDescription( sal_Int32 _nRow ) const -{ - return GetEntryText( _nRow ); -} - -OUString SvHeaderTabListBox::GetColumnDescription( sal_uInt16 _nColumn ) const -{ - return m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( _nColumn ) ); -} - -bool SvHeaderTabListBox::HasRowHeader() const -{ - return false; -} - -bool SvHeaderTabListBox::GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumn ) -{ - bool bRet = IsCellFocusEnabled(); - if ( bRet ) - { - // first set cursor to _nRow - SetCursor( GetEntry( _nRow ), true ); - // then set the focus into _nColumn - bRet = SetCurrentTabPos( _nColumn ); - } - return bRet; -} - -void SvHeaderTabListBox::SetNoSelection() -{ - SvTreeListBox::SelectAll(false); -} - -void SvHeaderTabListBox::SelectAll() -{ - SvTreeListBox::SelectAll(true); -} - -void SvHeaderTabListBox::SelectRow( long _nRow, bool _bSelect, bool ) -{ - Select( GetEntry( _nRow ), _bSelect ); -} - -void SvHeaderTabListBox::SelectColumn( sal_uInt16, bool ) -{ -} - -sal_Int32 SvHeaderTabListBox::GetSelectedRowCount() const -{ - return GetSelectionCount(); -} - -sal_Int32 SvHeaderTabListBox::GetSelectedColumnCount() const -{ - return 0; -} - -bool SvHeaderTabListBox::IsRowSelected( long _nRow ) const -{ - SvTreeListEntry* pEntry = GetEntry( _nRow ); - return ( pEntry && IsSelected( pEntry ) ); -} - -bool SvHeaderTabListBox::IsColumnSelected( long ) const -{ - return false; -} - -void SvHeaderTabListBox::GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& ) const -{ -} - -void SvHeaderTabListBox::GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& ) const -{ -} - -bool SvHeaderTabListBox::IsCellVisible( sal_Int32, sal_uInt16 ) const -{ - return true; -} - -OUString SvHeaderTabListBox::GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const -{ - return GetTabEntryText(_nRow, _nColumnPos); -} - -tools::Rectangle SvHeaderTabListBox::calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen ) -{ - tools::Rectangle aRect; - if ( _bIsColumnBar ) - { - vcl::Window* pParent = nullptr; - if ( !_bOnScreen ) - pParent = m_pImpl->m_pHeaderBar->GetAccessibleParentWindow(); - - aRect = m_pImpl->m_pHeaderBar->GetWindowExtentsRelative( pParent ); - } - return aRect; -} - -tools::Rectangle SvHeaderTabListBox::calcTableRect( bool _bOnScreen ) -{ - vcl::Window* pParent = nullptr; - if ( !_bOnScreen ) - pParent = GetAccessibleParentWindow(); - - tools::Rectangle aRect( GetWindowExtentsRelative( pParent ) ); - return aRect; -} - -tools::Rectangle SvHeaderTabListBox::GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumn, bool _bIsHeader, bool _bOnScreen ) -{ - DBG_ASSERT( !_bIsHeader || 0 == _nRow, "invalid parameters" ); - tools::Rectangle aRect; - SvTreeListEntry* pEntry = GetEntry( _nRow ); - if ( pEntry ) - { - aRect = _bIsHeader ? calcHeaderRect( true, false ) : GetBoundingRect( pEntry ); - Point aTopLeft = aRect.TopLeft(); - DBG_ASSERT( m_pImpl->m_pHeaderBar->GetItemCount() > _nColumn, "invalid column" ); - tools::Rectangle aItemRect = m_pImpl->m_pHeaderBar->GetItemRect( m_pImpl->m_pHeaderBar->GetItemId( _nColumn ) ); - aTopLeft.setX( aItemRect.Left() ); - Size aSize = aItemRect.GetSize(); - aRect = tools::Rectangle( aTopLeft, aSize ); - vcl::Window* pParent = nullptr; - if ( !_bOnScreen ) - pParent = GetAccessibleParentWindow(); - aTopLeft = aRect.TopLeft(); - aTopLeft += GetWindowExtentsRelative( pParent ).TopLeft(); - aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); - } - - return aRect; -} - -Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) -{ - OSL_ENSURE( m_pAccessible, "Invalid call: Accessible is null" ); - - Reference< XAccessible > xChild; - sal_Int32 nIndex = -1; - - if ( !AreChildrenTransient() ) - { - const sal_uInt16 nColumnCount = GetColumnCount(); - - // first call? -> initial list - if ( m_aAccessibleChildren.empty() ) - { - sal_Int32 nCount = ( GetRowCount() + 1 ) * nColumnCount; - m_aAccessibleChildren.assign( nCount, Reference< XAccessible >() ); - } - - nIndex = ( _nRow * nColumnCount ) + _nColumnPos + nColumnCount; - xChild = m_aAccessibleChildren[ nIndex ]; - } - - if ( !xChild.is() ) - { - TriState eState = TRISTATE_INDET; - bool bIsCheckBox = IsCellCheckBox( _nRow, _nColumnPos, eState ); - if ( bIsCheckBox ) - xChild = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleCheckBoxCell( - m_pAccessible->getHeaderBar(), *this, nullptr, _nRow, _nColumnPos, eState, false ); - else - xChild = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell( - m_pAccessible->getHeaderBar(), *this, nullptr, _nRow, _nColumnPos, OFFSET_NONE ); - - // insert into list - if ( !AreChildrenTransient() ) - m_aAccessibleChildren[ nIndex ] = xChild; - } - - return xChild; -} - -Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleRowHeader( sal_Int32 ) -{ - Reference< XAccessible > xHeader; - return xHeader; -} - -Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleColumnHeader( sal_uInt16 _nColumn ) -{ - // first call? -> initial list - if ( m_aAccessibleChildren.empty() ) - { - const sal_uInt16 nColumnCount = GetColumnCount(); - sal_Int32 nCount = AreChildrenTransient() ? - nColumnCount : ( GetRowCount() + 1 ) * nColumnCount; - m_aAccessibleChildren.assign( nCount, Reference< XAccessible >() ); - } - - // get header - Reference< XAccessible > xChild = m_aAccessibleChildren[ _nColumn ]; - // already exists? - if ( !xChild.is() && m_pAccessible ) - { - // no -> create new header cell - xChild = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxHeaderCell( - _nColumn, m_pAccessible->getHeaderBar(), - *this, nullptr, ::svt::BBTYPE_COLUMNHEADERCELL - ); - - // insert into list - m_aAccessibleChildren[ _nColumn ] = xChild; - } - - return xChild; -} - -sal_Int32 SvHeaderTabListBox::GetAccessibleControlCount() const -{ - return -1; -} - -Reference< XAccessible > SvHeaderTabListBox::CreateAccessibleControl( sal_Int32 ) -{ - Reference< XAccessible > xControl; - return xControl; -} - -bool SvHeaderTabListBox::ConvertPointToControlIndex( sal_Int32&, const Point& ) -{ - return false; -} - -bool SvHeaderTabListBox::ConvertPointToCellAddress( sal_Int32&, sal_uInt16&, const Point& ) -{ - return false; -} - -bool SvHeaderTabListBox::ConvertPointToRowHeader( sal_Int32&, const Point& ) -{ - return false; -} - -bool SvHeaderTabListBox::ConvertPointToColumnHeader( sal_uInt16&, const Point& ) -{ - return false; -} - -OUString SvHeaderTabListBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const -{ - OUString aRetText; - switch( _eType ) - { - case ::svt::BBTYPE_BROWSEBOX: - case ::svt::BBTYPE_TABLE: - case ::svt::BBTYPE_COLUMNHEADERBAR: - // should be empty now (see #i63983) - aRetText.clear(); - break; - - case ::svt::BBTYPE_TABLECELL: - { - // here we need a valid pos, we can not handle -1 - if ( _nPos >= 0 ) - { - sal_uInt16 nColumnCount = GetColumnCount(); - if (nColumnCount > 0) - { - sal_Int32 nRow = _nPos / nColumnCount; - sal_uInt16 nColumn = static_cast< sal_uInt16 >( _nPos % nColumnCount ); - aRetText = GetCellText( nRow, nColumn ); - } - } - break; - } - case ::svt::BBTYPE_CHECKBOXCELL: - { - break; // checkbox cells have no name - } - case ::svt::BBTYPE_COLUMNHEADERCELL: - { - aRetText = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( static_cast<sal_uInt16>(_nPos) ) ); - break; - } - - case ::svt::BBTYPE_ROWHEADERBAR: - case ::svt::BBTYPE_ROWHEADERCELL: - aRetText = "error"; - break; - - default: - OSL_FAIL("BrowseBox::GetAccessibleName: invalid enum!"); - } - return aRetText; -} - -OUString SvHeaderTabListBox::GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos ) const -{ - OUString aRetText; - - if( _eType == ::svt::BBTYPE_TABLECELL && _nPos != -1 ) - { - const OUString sVar1( "%1" ); - const OUString sVar2( "%2" ); - - sal_uInt16 nColumnCount = GetColumnCount(); - if (nColumnCount > 0) - { - sal_Int32 nRow = _nPos / nColumnCount; - sal_uInt16 nColumn = static_cast< sal_uInt16 >( _nPos % nColumnCount ); - - OUString aText( SvtResId(STR_SVT_ACC_DESC_TABLISTBOX) ); - aText = aText.replaceFirst( sVar1, OUString::number( nRow ) ); - OUString sColHeader = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( nColumn ) ); - if ( sColHeader.isEmpty() ) - sColHeader = OUString::number( nColumn ); - aText = aText.replaceFirst( sVar2, sColHeader ); - aRetText = aText; - } - } - - return aRetText; -} - -void SvHeaderTabListBox::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const -{ - switch( _eType ) - { - case ::svt::BBTYPE_BROWSEBOX: - case ::svt::BBTYPE_TABLE: - { - _rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - if ( HasFocus() ) - _rStateSet.AddState( AccessibleStateType::FOCUSED ); - if ( IsActive() ) - _rStateSet.AddState( AccessibleStateType::ACTIVE ); - if ( IsEnabled() ) - { - _rStateSet.AddState( AccessibleStateType::ENABLED ); - _rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } - if ( IsReallyVisible() ) - _rStateSet.AddState( AccessibleStateType::VISIBLE ); - if ( _eType == ::svt::BBTYPE_TABLE ) - { - - if ( AreChildrenTransient() ) - _rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); - _rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE ); - } - break; - } - - case ::svt::BBTYPE_COLUMNHEADERBAR: - { - sal_Int32 nCurRow = GetCurrRow(); - sal_uInt16 nCurColumn = GetCurrColumn(); - if ( IsCellVisible( nCurRow, nCurColumn ) ) - _rStateSet.AddState( AccessibleStateType::VISIBLE ); - if ( IsEnabled() ) - _rStateSet.AddState( AccessibleStateType::ENABLED ); - _rStateSet.AddState( AccessibleStateType::TRANSIENT ); - break; - } - - case ::svt::BBTYPE_ROWHEADERCELL: - case ::svt::BBTYPE_COLUMNHEADERCELL: - { - _rStateSet.AddState( AccessibleStateType::VISIBLE ); - _rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - _rStateSet.AddState( AccessibleStateType::TRANSIENT ); - if ( IsEnabled() ) - _rStateSet.AddState( AccessibleStateType::ENABLED ); - break; - } - default: - break; - } -} - -void SvHeaderTabListBox::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumn ) const -{ - _rStateSet.AddState( AccessibleStateType::SELECTABLE ); - if ( AreChildrenTransient() ) - _rStateSet.AddState( AccessibleStateType::TRANSIENT ); - - if ( IsCellVisible( _nRow, _nColumn ) ) - { - _rStateSet.AddState( AccessibleStateType::VISIBLE ); - _rStateSet.AddState( AccessibleStateType::ENABLED ); - } - - if ( IsRowSelected( _nRow ) ) - { - _rStateSet.AddState( AccessibleStateType::ACTIVE ); - _rStateSet.AddState( AccessibleStateType::SELECTED ); - } - if ( IsEnabled() ) - _rStateSet.AddState( AccessibleStateType::ENABLED ); -} - -void SvHeaderTabListBox::GrabTableFocus() -{ - GrabFocus(); -} - -bool SvHeaderTabListBox::GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, MetricVector& rVector ) -{ - return Control::GetGlyphBoundRects( rOrigin, rStr, nIndex, nLen, rVector ); -} - -tools::Rectangle SvHeaderTabListBox::GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const -{ - return Control::GetWindowExtentsRelative( pRelativeWindow ); -} - -void SvHeaderTabListBox::GrabFocus() -{ - Control::GrabFocus(); -} - -Reference< XAccessible > SvHeaderTabListBox::GetAccessible() -{ - return Control::GetAccessible(); -} - -vcl::Window* SvHeaderTabListBox::GetAccessibleParentWindow() const -{ - return Control::GetAccessibleParentWindow(); -} - -vcl::Window* SvHeaderTabListBox::GetWindowInstance() -{ - return this; -} - -Reference< XAccessible > SvHeaderTabListBox::CreateAccessible() -{ - vcl::Window* pParent = GetAccessibleParentWindow(); - DBG_ASSERT( pParent, "SvHeaderTabListBox::::CreateAccessible - accessible parent not found" ); - - Reference< XAccessible > xAccessible; - if ( m_pAccessible ) xAccessible = m_pAccessible->getMyself(); - - if( pParent && !m_pAccessible ) - { - Reference< XAccessible > xAccParent = pParent->GetAccessible(); - if ( xAccParent.is() ) - { - m_pAccessible = m_pImpl->m_aFactoryAccess.getFactory().createAccessibleTabListBox( xAccParent, *this ); - if ( m_pAccessible ) - xAccessible = m_pAccessible->getMyself(); - } - } - return xAccessible; -} - -tools::Rectangle SvHeaderTabListBox::GetFieldCharacterBounds(sal_Int32,sal_Int32,sal_Int32) -{ - return tools::Rectangle(); -} - -sal_Int32 SvHeaderTabListBox::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) -{ - OUString sText = GetAccessibleCellText( _nRow, static_cast< sal_uInt16 >( _nColumnPos ) ); - MetricVector aRects; - if ( GetGlyphBoundRects(Point(0,0), sText, 0, sText.getLength(), aRects) ) - { - sal_Int32 nPos = 0; - for (auto const& rectangle : aRects) - { - if( rectangle.IsInside(_rPoint) ) - return nPos; - ++nPos; - } - } - - return -1; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx deleted file mode 100644 index e00a9bdf5645..000000000000 --- a/svtools/source/control/headbar.cxx +++ /dev/null @@ -1,1367 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <svtools/headbar.hxx> -#include <vclxaccessibleheaderbar.hxx> -#include <tools/debug.hxx> - -#include <vcl/svapp.hxx> -#include <vcl/help.hxx> -#include <vcl/image.hxx> -#include <vcl/salnativewidgets.hxx> -#include <vcl/settings.hxx> -#include <vcl/commandevent.hxx> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/XAccessible.hpp> - -class ImplHeadItem -{ -public: - sal_uInt16 mnId; - HeaderBarItemBits mnBits; - long mnSize; - OString const maHelpId; - Image const maImage; - OUString maOutText; - OUString maText; - OUString maHelpText; -}; - -#define HEAD_ARROWSIZE1 4 -#define HEAD_ARROWSIZE2 7 - -#define HEADERBAR_TEXTOFF 2 -#define HEADERBAR_ARROWOFF 5 -#define HEADERBAR_SPLITOFF 3 - -#define HEADERBAR_DRAGOUTOFF 15 - -#define HEAD_HITTEST_ITEM (sal_uInt16(0x0001)) -#define HEAD_HITTEST_DIVIDER (sal_uInt16(0x0002)) - -void HeaderBar::ImplInit( WinBits nWinStyle ) -{ - mnBorderOff1 = 0; - mnBorderOff2 = 0; - mnOffset = 0; - mnDX = 0; - mnDY = 0; - mnDragSize = 0; - mnStartPos = 0; - mnDragPos = 0; - mnMouseOff = 0; - mnCurItemId = 0; - mnItemDragPos = HEADERBAR_ITEM_NOTFOUND; - mbDrag = false; - mbItemDrag = false; - mbOutDrag = false; - mbItemMode = false; - - // evaluate StyleBits - if ( nWinStyle & WB_DRAG ) - mbDragable = true; - else - mbDragable = false; - if ( nWinStyle & WB_BUTTONSTYLE ) - mbButtonStyle = true; - else - mbButtonStyle = false; - if ( nWinStyle & WB_BORDER ) - { - mnBorderOff1 = 1; - mnBorderOff2 = 1; - } - else - { - if ( nWinStyle & WB_BOTTOMBORDER ) - mnBorderOff2 = 1; - } - - ImplInitSettings( true, true, true ); -} - -HeaderBar::HeaderBar( vcl::Window* pParent, WinBits nWinStyle ) : - Window( pParent, nWinStyle & WB_3DLOOK ) -{ - ImplInit( nWinStyle ); - SetSizePixel( CalcWindowSizePixel() ); -} - -HeaderBar::~HeaderBar() = default; - -void HeaderBar::ApplySettings(vcl::RenderContext& rRenderContext) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - ApplyControlFont(rRenderContext, rStyleSettings.GetToolFont()); - - ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor()); - SetTextFillColor(); - - ApplyControlBackground(rRenderContext, rStyleSettings.GetFaceColor()); -} - -void HeaderBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if (bFont) - ApplyControlFont(*this, rStyleSettings.GetToolFont()); - - if (bForeground || bFont) - { - ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); - SetTextFillColor(); - } - - if (bBackground) - ApplyControlBackground(*this, rStyleSettings.GetFaceColor()); -} - -long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const -{ - long nX = -mnOffset; - for ( size_t i = 0; i < nPos; i++ ) - nX += mvItemList[ i ]->mnSize; - return nX; -} - -tools::Rectangle HeaderBar::ImplGetItemRect( sal_uInt16 nPos ) const -{ - tools::Rectangle aRect( ImplGetItemPos( nPos ), 0, 0, mnDY-1 ); - aRect.SetRight( aRect.Left() + mvItemList[ nPos ]->mnSize - 1 ); - // check for overflow on various systems - if ( aRect.Right() > 16000 ) - aRect.SetRight( 16000 ); - return aRect; -} - -sal_uInt16 HeaderBar::ImplHitTest( const Point& rPos, - long& nMouseOff, sal_uInt16& nPos ) const -{ - size_t nCount = static_cast<sal_uInt16>(mvItemList.size()); - bool bLastFixed = true; - long nX = -mnOffset; - - for ( size_t i = 0; i < nCount; i++ ) - { - auto& pItem = mvItemList[ i ]; - - if ( rPos.X() < (nX+pItem->mnSize) ) - { - sal_uInt16 nMode; - - if ( !bLastFixed && (rPos.X() < (nX+HEADERBAR_SPLITOFF)) ) - { - nMode = HEAD_HITTEST_DIVIDER; - nPos = i-1; - nMouseOff = rPos.X()-nX+1; - } - else - { - nPos = i; - - if ( !(pItem->mnBits & HeaderBarItemBits::FIXED) && (rPos.X() >= (nX+pItem->mnSize-HEADERBAR_SPLITOFF)) ) - { - nMode = HEAD_HITTEST_DIVIDER; - nMouseOff = rPos.X()-(nX+pItem->mnSize); - } - else - { - nMode = HEAD_HITTEST_ITEM; - nMouseOff = rPos.X()-nX; - } - } - - return nMode; - } - - bLastFixed = static_cast<bool>(pItem->mnBits & HeaderBarItemBits::FIXED); - - nX += pItem->mnSize; - } - - if ( !bLastFixed ) - { - auto& pItem = mvItemList[ nCount-1 ]; - if ( (pItem->mnSize < 4) && (rPos.X() < (nX+HEADERBAR_SPLITOFF)) ) - { - nPos = nCount-1; - nMouseOff = rPos.X()-nX+1; - return HEAD_HITTEST_DIVIDER; - } - } - - return 0; -} - -void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos ) -{ - tools::Rectangle aRect1 = ImplGetItemRect( nStartPos ); - tools::Rectangle aRect2 = ImplGetItemRect( nEndPos ); - Point aStartPos = aRect1.Center(); - Point aEndPos = aStartPos; - tools::Rectangle aStartRect( aStartPos.X()-2, aStartPos.Y()-2, - aStartPos.X()+2, aStartPos.Y()+2 ); - - if ( nEndPos > nStartPos ) - { - aStartPos.AdjustX(3 ); - aEndPos.setX( aRect2.Right()-6 ); - } - else - { - aStartPos.AdjustX( -3 ); - aEndPos.setX( aRect2.Left()+6 ); - } - - SetRasterOp( RasterOp::Invert ); - DrawRect( aStartRect ); - DrawLine( aStartPos, aEndPos ); - if ( nEndPos > nStartPos ) - { - DrawLine( Point( aEndPos.X()+1, aEndPos.Y()-3 ), - Point( aEndPos.X()+1, aEndPos.Y()+3 ) ); - DrawLine( Point( aEndPos.X()+2, aEndPos.Y()-2 ), - Point( aEndPos.X()+2, aEndPos.Y()+2 ) ); - DrawLine( Point( aEndPos.X()+3, aEndPos.Y()-1 ), - Point( aEndPos.X()+3, aEndPos.Y()+1 ) ); - DrawPixel( Point( aEndPos.X()+4, aEndPos.Y() ) ); - } - else - { - DrawLine( Point( aEndPos.X()-1, aEndPos.Y()-3 ), - Point( aEndPos.X()-1, aEndPos.Y()+3 ) ); - DrawLine( Point( aEndPos.X()-2, aEndPos.Y()-2 ), - Point( aEndPos.X()-2, aEndPos.Y()+2 ) ); - DrawLine( Point( aEndPos.X()-3, aEndPos.Y()-1 ), - Point( aEndPos.X()-3, aEndPos.Y()+1 ) ); - DrawPixel( Point( aEndPos.X()-4, aEndPos.Y() ) ); - } - SetRasterOp( RasterOp::OverPaint ); -} - -void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh, - const tools::Rectangle& rItemRect, const tools::Rectangle* pRect ) -{ - ImplControlValue aControlValue(0); - tools::Rectangle aCtrlRegion; - ControlState nState(ControlState::NONE); - - tools::Rectangle aRect = rItemRect; - - // do not display if there is no space - if (aRect.GetWidth() <= 1) - return; - - // check of rectangle is visible - if (pRect) - { - if (aRect.Right() < pRect->Left()) - return; - else if (aRect.Left() > pRect->Right()) - return; - } - else - { - if (aRect.Right() < 0) - return; - else if (aRect.Left() > mnDX) - return; - } - - auto& pItem = mvItemList[nPos]; - HeaderBarItemBits nBits = pItem->mnBits; - const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - - if (rRenderContext.IsNativeControlSupported(ControlType::WindowBackground, ControlPart::Entire)) - { - aCtrlRegion = aRect; - rRenderContext.DrawNativeControl(ControlType::WindowBackground, ControlPart::Entire, - aCtrlRegion, nState, aControlValue, OUString()); - - } - else - { - // do not draw border - aRect.AdjustTop(mnBorderOff1 ); - aRect.AdjustBottom( -(mnBorderOff2) ); - - // delete background - if ( !pRect ) - { - rRenderContext.DrawWallpaper(aRect, rRenderContext.GetBackground()); - } - } - - Color aSelectionTextColor(COL_TRANSPARENT); - - if (rRenderContext.IsNativeControlSupported(ControlType::ListHeader, ControlPart::Button)) - { - aCtrlRegion = aRect; - aControlValue.setTristateVal(ButtonValue::On); - nState |= ControlState::ENABLED; - if (bHigh) - nState |= ControlState::PRESSED; - rRenderContext.DrawNativeControl(ControlType::ListHeader, ControlPart::Button, - aCtrlRegion, nState, aControlValue, OUString()); - } - else - { - // draw separation line - rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor()); - rRenderContext.DrawLine(Point(aRect.Right(), aRect.Top()), Point(aRect.Right(), aRect.Bottom())); - - // draw ButtonStyle - // avoid 3D borders - if (bHigh) - vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, aRect, 1, true, false, false, &aSelectionTextColor); - else if (!mbButtonStyle || (nBits & HeaderBarItemBits::FLAT)) - vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, aRect, 0, true, false, false, &aSelectionTextColor); - } - - // do not draw if there is no space - if (aRect.GetWidth() < 1) - return; - - // calculate size and position and draw content - pItem->maOutText = pItem->maText; - Size aImageSize = pItem->maImage.GetSizePixel(); - Size aTxtSize(rRenderContext.GetTextWidth(pItem->maOutText), 0); - if (!pItem->maOutText.isEmpty()) - aTxtSize.setHeight( rRenderContext.GetTextHeight() ); - long nArrowWidth = 0; - if (nBits & (HeaderBarItemBits::UPARROW | HeaderBarItemBits::DOWNARROW)) - nArrowWidth = HEAD_ARROWSIZE2 + HEADERBAR_ARROWOFF; - - // do not draw if there is not enough space for the image - long nTestHeight = aImageSize.Height(); - if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE))) - nTestHeight += aTxtSize.Height(); - if ((aImageSize.Width() > aRect.GetWidth()) || (nTestHeight > aRect.GetHeight())) - { - aImageSize.setWidth( 0 ); - aImageSize.setHeight( 0 ); - } - - // cut text to correct length - bool bLeftText = false; - long nMaxTxtWidth = aRect.GetWidth() - (HEADERBAR_TEXTOFF * 2) - nArrowWidth; - if (nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) - nMaxTxtWidth -= aImageSize.Width(); - long nTxtWidth = aTxtSize.Width(); - if (nTxtWidth > nMaxTxtWidth) - { - bLeftText = true; - OUStringBuffer aBuf(pItem->maOutText); - aBuf.append("..."); - do - { - aBuf.remove(aBuf.getLength() - 3 - 1, 1); - nTxtWidth = rRenderContext.GetTextWidth(aBuf.toString()); - } - while ((nTxtWidth > nMaxTxtWidth) && (aBuf.getLength() > 3)); - pItem->maOutText = aBuf.makeStringAndClear(); - if (pItem->maOutText.getLength() == 3) - { - nTxtWidth = 0; - pItem->maOutText.clear(); - } - } - - // calculate text/imageposition - long nTxtPos; - if (!bLeftText && (nBits & HeaderBarItemBits::RIGHT)) - { - nTxtPos = aRect.Right() - nTxtWidth - HEADERBAR_TEXTOFF; - if (nBits & HeaderBarItemBits::RIGHTIMAGE) - nTxtPos -= aImageSize.Width(); - } - else if (!bLeftText && (nBits & HeaderBarItemBits::CENTER)) - { - long nTempWidth = nTxtWidth; - if (nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) - nTempWidth += aImageSize.Width(); - nTxtPos = aRect.Left() + (aRect.GetWidth() - nTempWidth) / 2; - if (nBits & HeaderBarItemBits::LEFTIMAGE) - nTxtPos += aImageSize.Width(); - if (nArrowWidth) - { - if (nTxtPos + nTxtWidth + nArrowWidth >= aRect.Right()) - { - nTxtPos = aRect.Left() + HEADERBAR_TEXTOFF; - if (nBits & HeaderBarItemBits::LEFTIMAGE) - nTxtPos += aImageSize.Width(); - } - } - } - else - { - nTxtPos = aRect.Left() + HEADERBAR_TEXTOFF; - if (nBits & HeaderBarItemBits::LEFTIMAGE) - nTxtPos += aImageSize.Width(); - if (nBits & HeaderBarItemBits::RIGHT) - nTxtPos += nArrowWidth; - } - - // calculate text/imageposition - long nTxtPosY = 0; - if (!pItem->maOutText.isEmpty() || (nArrowWidth && aTxtSize.Height())) - { - if (nBits & HeaderBarItemBits::TOP) - { - nTxtPosY = aRect.Top(); - if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE))) - nTxtPosY += aImageSize.Height(); - } - else if (nBits & HeaderBarItemBits::BOTTOM) - nTxtPosY = aRect.Bottom()-aTxtSize.Height(); - else - { - long nTempHeight = aTxtSize.Height(); - nTempHeight += aImageSize.Height(); - nTxtPosY = aRect.Top()+((aRect.GetHeight()-nTempHeight)/2); - if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE))) - nTxtPosY += aImageSize.Height(); - } - } - - // display text - if (!pItem->maOutText.isEmpty()) - { - if (aSelectionTextColor != COL_TRANSPARENT) - { - rRenderContext.Push(PushFlags::TEXTCOLOR); - rRenderContext.SetTextColor(aSelectionTextColor); - } - if (IsEnabled()) - rRenderContext.DrawText(Point(nTxtPos, nTxtPosY), pItem->maOutText); - else - rRenderContext.DrawCtrlText(Point(nTxtPos, nTxtPosY), pItem->maOutText, 0, pItem->maOutText.getLength(), DrawTextFlags::Disable); - if (aSelectionTextColor != COL_TRANSPARENT) - rRenderContext.Pop(); - } - - // calculate the position and draw image if it is available - long nImagePosY = 0; - if (aImageSize.Width() && aImageSize.Height()) - { - long nImagePos = nTxtPos; - if (nBits & HeaderBarItemBits::LEFTIMAGE) - { - nImagePos -= aImageSize.Width(); - if (nBits & HeaderBarItemBits::RIGHT) - nImagePos -= nArrowWidth; - } - else if (nBits & HeaderBarItemBits::RIGHTIMAGE) - { - nImagePos += nTxtWidth; - if (!(nBits & HeaderBarItemBits::RIGHT)) - nImagePos += nArrowWidth; - } - else - { - if (nBits & HeaderBarItemBits::RIGHT ) - nImagePos = aRect.Right()-aImageSize.Width(); - else if (nBits & HeaderBarItemBits::CENTER) - nImagePos = aRect.Left() + (aRect.GetWidth() - aImageSize.Width()) / 2; - else - nImagePos = aRect.Left() + HEADERBAR_TEXTOFF; - } - - if (nBits & HeaderBarItemBits::TOP) - nImagePosY = aRect.Top(); - else if (nBits & HeaderBarItemBits::BOTTOM) - { - nImagePosY = aRect.Bottom() - aImageSize.Height(); - if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE))) - nImagePosY -= aTxtSize.Height(); - } - else - { - long nTempHeight = aImageSize.Height(); - if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE))) - nTempHeight += aTxtSize.Height(); - nImagePosY = aRect.Top() + ((aRect.GetHeight() - nTempHeight) / 2); - } - if (nImagePos + aImageSize.Width() <= aRect.Right()) - { - DrawImageFlags nStyle = DrawImageFlags::NONE; - if (!IsEnabled()) - nStyle |= DrawImageFlags::Disable; - rRenderContext.DrawImage(Point(nImagePos, nImagePosY), pItem->maImage, nStyle); - } - } - - if (!(nBits & (HeaderBarItemBits::UPARROW | HeaderBarItemBits::DOWNARROW))) - return; - - long nArrowX = nTxtPos; - if (nBits & HeaderBarItemBits::RIGHT) - nArrowX -= nArrowWidth; - else - nArrowX += nTxtWidth + HEADERBAR_ARROWOFF; - if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) && pItem->maText.isEmpty()) - { - if (nBits & HeaderBarItemBits::RIGHT) - nArrowX -= aImageSize.Width(); - else - nArrowX += aImageSize.Width(); - } - - // is there enough space to draw the item? - bool bDraw = true; - if (nArrowX < aRect.Left() + HEADERBAR_TEXTOFF) - bDraw = false; - else if (nArrowX + HEAD_ARROWSIZE2 > aRect.Right()) - bDraw = false; - - if (!bDraw) - return; - - if (rRenderContext.IsNativeControlSupported(ControlType::ListHeader, ControlPart::Arrow)) - { - aCtrlRegion = tools::Rectangle(Point(nArrowX, aRect.Top()), Size(nArrowWidth, aRect.GetHeight())); - // control value passes 1 if arrow points down, 0 otherwise - aControlValue.setNumericVal((nBits & HeaderBarItemBits::DOWNARROW) ? 1 : 0); - nState |= ControlState::ENABLED; - if (bHigh) - nState |= ControlState::PRESSED; - rRenderContext.DrawNativeControl(ControlType::ListHeader, ControlPart::Arrow, aCtrlRegion, - nState, aControlValue, OUString()); - } - else - { - long nArrowY; - if (aTxtSize.Height()) - nArrowY = nTxtPosY + (aTxtSize.Height() / 2); - else if (aImageSize.Width() && aImageSize.Height()) - nArrowY = nImagePosY + (aImageSize.Height() / 2); - else - { - if (nBits & HeaderBarItemBits::TOP) - nArrowY = aRect.Top() + 1; - else if (nBits & HeaderBarItemBits::BOTTOM) - nArrowY = aRect.Bottom() - HEAD_ARROWSIZE2 - 1; - else - nArrowY = aRect.Top() + ((aRect.GetHeight() - HEAD_ARROWSIZE2) / 2); - } - nArrowY -= HEAD_ARROWSIZE1 - 1; - if (nBits & HeaderBarItemBits::DOWNARROW) - { - rRenderContext.SetLineColor(rStyleSettings.GetLightColor()); - rRenderContext.DrawLine(Point(nArrowX, nArrowY), - Point(nArrowX + HEAD_ARROWSIZE2, nArrowY)); - rRenderContext.DrawLine(Point(nArrowX, nArrowY), - Point(nArrowX + HEAD_ARROWSIZE1, nArrowY + HEAD_ARROWSIZE2)); - rRenderContext.SetLineColor(rStyleSettings.GetShadowColor()); - rRenderContext.DrawLine(Point(nArrowX + HEAD_ARROWSIZE1, nArrowY + HEAD_ARROWSIZE2), - Point(nArrowX + HEAD_ARROWSIZE2, nArrowY)); - } - else - { - rRenderContext.SetLineColor(rStyleSettings.GetLightColor()); - rRenderContext.DrawLine(Point(nArrowX, nArrowY + HEAD_ARROWSIZE2), - Point(nArrowX + HEAD_ARROWSIZE1, nArrowY)); - rRenderContext.SetLineColor(rStyleSettings.GetShadowColor()); - rRenderContext.DrawLine(Point(nArrowX, nArrowY + HEAD_ARROWSIZE2), - Point(nArrowX + HEAD_ARROWSIZE2, nArrowY + HEAD_ARROWSIZE2)); - rRenderContext.DrawLine(Point(nArrowX + HEAD_ARROWSIZE2, nArrowY + HEAD_ARROWSIZE2), - Point(nArrowX + HEAD_ARROWSIZE1, nArrowY)); - } - } -} - -void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, - bool bHigh, const tools::Rectangle* pRect ) -{ - tools::Rectangle aRect = ImplGetItemRect(nPos); - ImplDrawItem(rRenderContext, nPos, bHigh, aRect, pRect ); -} - -void HeaderBar::ImplUpdate(sal_uInt16 nPos, bool bEnd) -{ - if (!(IsVisible() && IsUpdateMode())) - return; - - tools::Rectangle aRect; - size_t nItemCount = mvItemList.size(); - if (nPos < nItemCount) - aRect = ImplGetItemRect(nPos); - else - { - aRect.SetBottom( mnDY - 1 ); - if (nItemCount) - aRect.SetLeft( ImplGetItemRect(nItemCount - 1).Right() ); - } - if (bEnd) - aRect.SetRight( mnDX - 1 ); - aRect.AdjustTop(mnBorderOff1 ); - aRect.AdjustBottom( -(mnBorderOff2) ); - Invalidate(aRect); -} - -void HeaderBar::ImplStartDrag( const Point& rMousePos, bool bCommand ) -{ - sal_uInt16 nPos; - sal_uInt16 nHitTest = ImplHitTest( rMousePos, mnMouseOff, nPos ); - if ( !nHitTest ) - return; - - mbDrag = false; - auto& pItem = mvItemList[ nPos ]; - if ( nHitTest & HEAD_HITTEST_DIVIDER ) - mbDrag = true; - else - { - if ( ((pItem->mnBits & HeaderBarItemBits::CLICKABLE) && !(pItem->mnBits & HeaderBarItemBits::FLAT)) || - (mbDragable && !(pItem->mnBits & HeaderBarItemBits::FIXEDPOS)) ) - { - mbItemMode = true; - mbDrag = true; - if ( bCommand ) - { - if ( mbDragable ) - mbItemDrag = true; - else - { - mbItemMode = false; - mbDrag = false; - } - } - } - else - { - if ( !bCommand ) - { - mnCurItemId = pItem->mnId; - Select(); - mnCurItemId = 0; - } - } - } - - if ( mbDrag ) - { - mbOutDrag = false; - mnCurItemId = pItem->mnId; - mnItemDragPos = nPos; - StartTracking(); - mnStartPos = rMousePos.X()-mnMouseOff; - mnDragPos = mnStartPos; - maStartDragHdl.Call( this ); - if (mbItemMode) - Invalidate(); - else - { - tools::Rectangle aSizeRect( mnDragPos, 0, mnDragPos, mnDragSize+mnDY ); - ShowTracking( aSizeRect, ShowTrackFlags::Split ); - } - } - else - mnMouseOff = 0; -} - -void HeaderBar::ImplDrag( const Point& rMousePos ) -{ - sal_uInt16 nPos = GetItemPos( mnCurItemId ); - - mnDragPos = rMousePos.X()-mnMouseOff; - if ( mbItemMode ) - { - bool bNewOutDrag; - - tools::Rectangle aItemRect = ImplGetItemRect( nPos ); - bNewOutDrag = !aItemRect.IsInside( rMousePos ); - - // if needed switch on ItemDrag - if ( bNewOutDrag && mbDragable && !mbItemDrag && - !(mvItemList[ nPos ]->mnBits & HeaderBarItemBits::FIXEDPOS) ) - { - if ( (rMousePos.Y() >= aItemRect.Top()) && (rMousePos.Y() <= aItemRect.Bottom()) ) - { - mbItemDrag = true; - Invalidate(); - } - } - - sal_uInt16 nOldItemDragPos = mnItemDragPos; - if ( mbItemDrag ) - { - bNewOutDrag = (rMousePos.Y() < -HEADERBAR_DRAGOUTOFF) || (rMousePos.Y() > mnDY+HEADERBAR_DRAGOUTOFF); - - if ( bNewOutDrag ) - mnItemDragPos = HEADERBAR_ITEM_NOTFOUND; - else - { - sal_uInt16 nTempId = GetItemId( Point( rMousePos.X(), 2 ) ); - if ( nTempId ) - mnItemDragPos = GetItemPos( nTempId ); - else - { - if ( rMousePos.X() <= 0 ) - mnItemDragPos = 0; - else - mnItemDragPos = GetItemCount()-1; - } - - // do not use non-movable items - if ( mnItemDragPos < nPos ) - { - while ( (mvItemList[ mnItemDragPos ]->mnBits & HeaderBarItemBits::FIXEDPOS) && - (mnItemDragPos < nPos) ) - mnItemDragPos++; - } - else if ( mnItemDragPos > nPos ) - { - while ( (mvItemList[ mnItemDragPos ]->mnBits & HeaderBarItemBits::FIXEDPOS) && - (mnItemDragPos > nPos) ) - mnItemDragPos--; - } - } - - if ( (mnItemDragPos != nOldItemDragPos) && - (nOldItemDragPos != nPos) && - (nOldItemDragPos != HEADERBAR_ITEM_NOTFOUND) ) - { - ImplInvertDrag( nPos, nOldItemDragPos ); - Invalidate(); - } - } - - if ( bNewOutDrag != mbOutDrag ) - Invalidate(); - - if ( mbItemDrag ) - { - if ( (mnItemDragPos != nOldItemDragPos) && - (mnItemDragPos != nPos) && - (mnItemDragPos != HEADERBAR_ITEM_NOTFOUND) ) - { - Invalidate(); - ImplInvertDrag( nPos, mnItemDragPos ); - } - } - - mbOutDrag = bNewOutDrag; - } - else - { - tools::Rectangle aItemRect = ImplGetItemRect( nPos ); - if ( mnDragPos < aItemRect.Left() ) - mnDragPos = aItemRect.Left(); - if ( (mnDragPos < 0) || (mnDragPos > mnDX-1) ) - HideTracking(); - else - { - tools::Rectangle aSizeRect( mnDragPos, 0, mnDragPos, mnDragSize+mnDY ); - ShowTracking( aSizeRect, ShowTrackFlags::Split ); - } - } - - maDragHdl.Call( this ); -} - -void HeaderBar::ImplEndDrag( bool bCancel ) -{ - HideTracking(); - - if ( bCancel || mbOutDrag ) - { - if ( mbItemMode && (!mbOutDrag || mbItemDrag) ) - { - Invalidate(); - } - - mnCurItemId = 0; - } - else - { - sal_uInt16 nPos = GetItemPos( mnCurItemId ); - if ( mbItemMode ) - { - if ( mbItemDrag ) - { - Pointer aPointer( PointerStyle::Arrow ); - SetPointer( aPointer ); - if ( (mnItemDragPos != nPos) && - (mnItemDragPos != HEADERBAR_ITEM_NOTFOUND) ) - { - ImplInvertDrag( nPos, mnItemDragPos ); - MoveItem( mnCurItemId, mnItemDragPos ); - } - else - Invalidate(); - } - else - { - Select(); - ImplUpdate( nPos ); - } - } - else - { - long nDelta = mnDragPos - mnStartPos; - if ( nDelta ) - { - auto& pItem = mvItemList[ nPos ]; - pItem->mnSize += nDelta; - ImplUpdate( nPos, true ); - } - } - } - - mbDrag = false; - EndDrag(); - mnCurItemId = 0; - mnItemDragPos = HEADERBAR_ITEM_NOTFOUND; - mbOutDrag = false; - mbItemMode = false; - mbItemDrag = false; -} - -void HeaderBar::MouseButtonDown( const MouseEvent& rMEvt ) -{ - if ( !rMEvt.IsLeft() ) - return; - - if ( rMEvt.GetClicks() == 2 ) - { - long nTemp; - sal_uInt16 nPos; - sal_uInt16 nHitTest = ImplHitTest( rMEvt.GetPosPixel(), nTemp, nPos ); - if ( nHitTest ) - { - auto& pItem = mvItemList[ nPos ]; - if ( nHitTest & HEAD_HITTEST_DIVIDER ) - mbItemMode = false; - else - mbItemMode = true; - mnCurItemId = pItem->mnId; - DoubleClick(); - mbItemMode = false; - mnCurItemId = 0; - } - } - else - ImplStartDrag( rMEvt.GetPosPixel(), false ); -} - -void HeaderBar::MouseMove( const MouseEvent& rMEvt ) -{ - long nTemp1; - sal_uInt16 nTemp2; - PointerStyle eStyle = PointerStyle::Arrow; - sal_uInt16 nHitTest = ImplHitTest( rMEvt.GetPosPixel(), nTemp1, nTemp2 ); - - if ( nHitTest & HEAD_HITTEST_DIVIDER ) - eStyle = PointerStyle::HSizeBar; - Pointer aPtr( eStyle ); - SetPointer( aPtr ); -} - -void HeaderBar::Tracking( const TrackingEvent& rTEvt ) -{ - Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel(); - - if ( rTEvt.IsTrackingEnded() ) - ImplEndDrag( rTEvt.IsTrackingCanceled() ); - else - ImplDrag( aMousePos ); -} - -void HeaderBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) -{ - if (mnBorderOff1 || mnBorderOff2) - { - rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetDarkShadowColor()); - if (mnBorderOff1) - rRenderContext.DrawLine(Point(0, 0), Point(mnDX - 1, 0)); - if (mnBorderOff2) - rRenderContext.DrawLine(Point(0, mnDY - 1), Point(mnDX - 1, mnDY - 1)); - // #i40393# draw left and right border, if WB_BORDER was set in ImplInit() - if (mnBorderOff1 && mnBorderOff2) - { - rRenderContext.DrawLine(Point(0, 0), Point(0, mnDY - 1)); - rRenderContext.DrawLine(Point(mnDX - 1, 0), Point(mnDX - 1, mnDY - 1)); - } - } - - sal_uInt16 nCurItemPos; - if (mbDrag) - nCurItemPos = GetItemPos(mnCurItemId); - else - nCurItemPos = HEADERBAR_ITEM_NOTFOUND; - sal_uInt16 nItemCount = static_cast<sal_uInt16>(mvItemList.size()); - for (sal_uInt16 i = 0; i < nItemCount; i++) - ImplDrawItem(rRenderContext, i, (i == nCurItemPos), &rRect); -} - -void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, - DrawFlags nFlags ) -{ - Point aPos = pDev->LogicToPixel( rPos ); - Size aSize = pDev->LogicToPixel( rSize ); - tools::Rectangle aRect( aPos, aSize ); - vcl::Font aFont = GetDrawPixelFont( pDev ); - - pDev->Push(); - pDev->SetMapMode(); - pDev->SetFont( aFont ); - if ( nFlags & DrawFlags::Mono ) - pDev->SetTextColor( COL_BLACK ); - else - pDev->SetTextColor( GetTextColor() ); - pDev->SetTextFillColor(); - - if ( !(nFlags & DrawFlags::NoBackground) ) - { - pDev->DrawWallpaper( aRect, GetBackground() ); - if ( mnBorderOff1 || mnBorderOff2 ) - { - pDev->SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() ); - if ( mnBorderOff1 ) - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right(), aRect.Top() ) ); - if ( mnBorderOff2 ) - pDev->DrawLine( Point( aRect.Left(), aRect.Bottom() ), Point( aRect.Right(), aRect.Bottom() ) ); - // #i40393# draw left and right border, if WB_BORDER was set in ImplInit() - if ( mnBorderOff1 && mnBorderOff2 ) - { - pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom() ) ); - pDev->DrawLine( Point( aRect.Right(), aRect.Top() ), Point( aRect.Right(), aRect.Bottom() ) ); - } - } - } - - tools::Rectangle aItemRect( aRect ); - size_t nItemCount = mvItemList.size(); - for ( size_t i = 0; i < nItemCount; i++ ) - { - aItemRect.SetLeft( aRect.Left()+ImplGetItemPos( i ) ); - aItemRect.SetRight( aItemRect.Left() + mvItemList[ i ]->mnSize - 1 ); - // check for overflow on some systems - if ( aItemRect.Right() > 16000 ) - aItemRect.SetRight( 16000 ); - vcl::Region aRegion( aRect ); - pDev->SetClipRegion( aRegion ); - ImplDrawItem(*pDev, i, false, aItemRect, &aRect ); - pDev->SetClipRegion(); - } - - pDev->Pop(); -} - -void HeaderBar::Resize() -{ - Size aSize = GetOutputSizePixel(); - if ( IsVisible() && (mnDY != aSize.Height()) ) - Invalidate(); - mnDX = aSize.Width(); - mnDY = aSize.Height(); -} - -void HeaderBar::Command( const CommandEvent& rCEvt ) -{ - if ( rCEvt.IsMouseEvent() && (rCEvt.GetCommand() == CommandEventId::StartDrag) && !mbDrag ) - { - ImplStartDrag( rCEvt.GetMousePosPixel(), true ); - return; - } - - Window::Command( rCEvt ); -} - -void HeaderBar::RequestHelp( const HelpEvent& rHEvt ) -{ - sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) ); - if ( nItemId ) - { - if ( rHEvt.GetMode() & (HelpEventMode::QUICK | HelpEventMode::BALLOON) ) - { - tools::Rectangle aItemRect = GetItemRect( nItemId ); - Point aPt = OutputToScreenPixel( aItemRect.TopLeft() ); - aItemRect.SetLeft( aPt.X() ); - aItemRect.SetTop( aPt.Y() ); - aPt = OutputToScreenPixel( aItemRect.BottomRight() ); - aItemRect.SetRight( aPt.X() ); - aItemRect.SetBottom( aPt.Y() ); - - OUString aStr = GetHelpText( nItemId ); - if ( aStr.isEmpty() || !(rHEvt.GetMode() & HelpEventMode::BALLOON) ) - { - auto& pItem = mvItemList[ GetItemPos( nItemId ) ]; - // Quick-help is only displayed if the text is not fully visible. - // Otherwise we display Helptext only if the items do not contain text - if ( pItem->maOutText != pItem->maText ) - aStr = pItem->maText; - else if (!pItem->maText.isEmpty()) - aStr.clear(); - } - - if (!aStr.isEmpty()) - { - if ( rHEvt.GetMode() & HelpEventMode::BALLOON ) - Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr ); - else - Help::ShowQuickHelp( this, aItemRect, aStr ); - return; - } - } - else if ( rHEvt.GetMode() & HelpEventMode::EXTENDED ) - { - OUString aHelpId( OStringToOUString( GetHelpId( nItemId ), RTL_TEXTENCODING_UTF8 ) ); - if ( !aHelpId.isEmpty() ) - { - // display it if help is available - Help* pHelp = Application::GetHelp(); - if ( pHelp ) - pHelp->Start( aHelpId, this ); - return; - } - } - } - - Window::RequestHelp( rHEvt ); -} - -void HeaderBar::StateChanged( StateChangedType nType ) -{ - Window::StateChanged( nType ); - - if ( nType == StateChangedType::Enable ) - Invalidate(); - else if ( (nType == StateChangedType::Zoom) || - (nType == StateChangedType::ControlFont) ) - { - ImplInitSettings( true, false, false ); - Invalidate(); - } - else if ( nType == StateChangedType::ControlForeground ) - { - ImplInitSettings( false, true, false ); - Invalidate(); - } - else if ( nType == StateChangedType::ControlBackground ) - { - ImplInitSettings( false, false, true ); - Invalidate(); - } -} - -void HeaderBar::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - - if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) || - (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) || - ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && - (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) - { - ImplInitSettings( true, true, true ); - Invalidate(); - } -} - -void HeaderBar::EndDrag() -{ - maEndDragHdl.Call( this ); -} - -void HeaderBar::Select() -{ - maSelectHdl.Call( this ); -} - -void HeaderBar::DoubleClick() -{ -} - -void HeaderBar::InsertItem( sal_uInt16 nItemId, const OUString& rText, - long nSize, HeaderBarItemBits nBits, sal_uInt16 nPos ) -{ - DBG_ASSERT( nItemId, "HeaderBar::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( nItemId ) == HEADERBAR_ITEM_NOTFOUND, - "HeaderBar::InsertItem(): ItemId already exists" ); - - // create item and insert in the list - std::unique_ptr<ImplHeadItem> pItem(new ImplHeadItem); - pItem->mnId = nItemId; - pItem->mnBits = nBits; - pItem->mnSize = nSize; - pItem->maText = rText; - if ( nPos < mvItemList.size() ) { - auto it = mvItemList.begin(); - it += nPos; - mvItemList.insert( it, std::move(pItem) ); - } else { - mvItemList.push_back( std::move(pItem) ); - } - - // update display - ImplUpdate( nPos, true ); -} - -void HeaderBar::RemoveItem( sal_uInt16 nItemId ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - { - if ( nPos < mvItemList.size() ) { - auto it = mvItemList.begin(); - it += nPos; - mvItemList.erase( it ); - } - } -} - -void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos == HEADERBAR_ITEM_NOTFOUND ) - return; - - if ( nPos == nNewPos ) - return; - - auto it = mvItemList.begin(); - it += nPos; - std::unique_ptr<ImplHeadItem> pItem = std::move(*it); - mvItemList.erase( it ); - if ( nNewPos < nPos ) - nPos = nNewPos; - it = mvItemList.begin(); - it += nNewPos; - mvItemList.insert( it, std::move(pItem) ); - ImplUpdate( nPos, true); -} - -void HeaderBar::Clear() -{ - // delete all items - mvItemList.clear(); - - ImplUpdate( 0, true ); -} - -void HeaderBar::SetOffset( long nNewOffset ) -{ - // move area - tools::Rectangle aRect( 0, mnBorderOff1, mnDX-1, mnDY-mnBorderOff1-mnBorderOff2-1 ); - long nDelta = mnOffset-nNewOffset; - mnOffset = nNewOffset; - Scroll( nDelta, 0, aRect ); -} - -sal_uInt16 HeaderBar::GetItemCount() const -{ - return static_cast<sal_uInt16>(mvItemList.size()); -} - -sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const -{ - for ( size_t i = 0, n = mvItemList.size(); i < n; ++i ) { - auto& pItem = mvItemList[ i ]; - if ( pItem->mnId == nItemId ) - return static_cast<sal_uInt16>(i); - } - return HEADERBAR_ITEM_NOTFOUND; -} - -sal_uInt16 HeaderBar::GetItemId( sal_uInt16 nPos ) const -{ - ImplHeadItem* pItem = (nPos < mvItemList.size() ) ? mvItemList[ nPos ].get() : nullptr; - if ( pItem ) - return pItem->mnId; - else - return 0; -} - -sal_uInt16 HeaderBar::GetItemId( const Point& rPos ) const -{ - for ( size_t i = 0, n = mvItemList.size(); i < n; ++i ) { - if ( ImplGetItemRect( i ).IsInside( rPos ) ) { - return GetItemId( i ); - } - } - return 0; -} - -tools::Rectangle HeaderBar::GetItemRect( sal_uInt16 nItemId ) const -{ - tools::Rectangle aRect; - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - aRect = ImplGetItemRect( nPos ); - return aRect; -} - -void HeaderBar::SetItemSize( sal_uInt16 nItemId, long nNewSize ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - { - auto& pItem = mvItemList[ nPos ]; - if ( pItem->mnSize != nNewSize ) - { - pItem->mnSize = nNewSize; - ImplUpdate( nPos, true ); - } - } -} - -long HeaderBar::GetItemSize( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mvItemList[ nPos ]->mnSize; - else - return 0; -} - -void HeaderBar::SetItemBits( sal_uInt16 nItemId, HeaderBarItemBits nNewBits ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - { - auto& pItem = mvItemList[ nPos ]; - if ( pItem->mnBits != nNewBits ) - { - pItem->mnBits = nNewBits; - ImplUpdate( nPos ); - } - } -} - -HeaderBarItemBits HeaderBar::GetItemBits( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mvItemList[ nPos ]->mnBits; - else - return HeaderBarItemBits::NONE; -} - -void HeaderBar::SetItemText( sal_uInt16 nItemId, const OUString& rText ) -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - { - mvItemList[ nPos ]->maText = rText; - ImplUpdate( nPos ); - } -} - -OUString HeaderBar::GetItemText( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mvItemList[ nPos ]->maText; - return OUString(); -} - -OUString HeaderBar::GetHelpText( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - { - auto& pItem = mvItemList[ nPos ]; - if ( pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty() ) - { - Help* pHelp = Application::GetHelp(); - if ( pHelp ) - pItem->maHelpText = pHelp->GetHelpText( OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this ); - } - - return pItem->maHelpText; - } - - return OUString(); -} - -OString HeaderBar::GetHelpId( sal_uInt16 nItemId ) const -{ - sal_uInt16 nPos = GetItemPos( nItemId ); - if ( nPos != HEADERBAR_ITEM_NOTFOUND ) - return mvItemList[ nPos ]->maHelpId; - return OString(); -} - -Size HeaderBar::CalcWindowSizePixel() const -{ - long nMaxImageSize = 0; - Size aSize( 0, GetTextHeight() ); - - for (auto& pItem : mvItemList) - { - // take image size into account - long nImageHeight = pItem->maImage.GetSizePixel().Height(); - if ( !(pItem->mnBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) && !pItem->maText.isEmpty() ) - nImageHeight += aSize.Height(); - if ( nImageHeight > nMaxImageSize ) - nMaxImageSize = nImageHeight; - - // add width - aSize.AdjustWidth(pItem->mnSize ); - } - - if ( nMaxImageSize > aSize.Height() ) - aSize.setHeight( nMaxImageSize ); - - // add border - if ( mbButtonStyle ) - aSize.AdjustHeight(4 ); - else - aSize.AdjustHeight(2 ); - aSize.AdjustHeight(mnBorderOff1+mnBorderOff2 ); - - return aSize; -} - -css::uno::Reference< css::accessibility::XAccessible > HeaderBar::CreateAccessible() -{ - if ( !mxAccessible.is() ) - { - maCreateAccessibleHdl.Call( this ); - - if ( !mxAccessible.is() ) - mxAccessible = Window::CreateAccessible(); - } - - return mxAccessible; -} - -void HeaderBar::SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& _xAccessible ) -{ - mxAccessible = _xAccessible; -} - -css::uno::Reference< css::awt::XWindowPeer > HeaderBar::GetComponentInterface( bool bCreate ) -{ - css::uno::Reference< css::awt::XWindowPeer > xPeer - (Window::GetComponentInterface(false)); - if ( !xPeer.is() && bCreate ) - { - css::awt::XWindowPeer* pPeer = new VCLXHeaderBar(this); - SetComponentInterface(pPeer); - return pPeer; - } - else - return xPeer; -} -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index f55ad89c87b9..ac7ff9e66955 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -30,7 +30,7 @@ #include <vcl/image.hxx> #include <vcl/settings.hxx> #include <vcl/commandevent.hxx> -#include <svtaccessiblefactory.hxx> +#include <vcl/svtaccessiblefactory.hxx> #include <svtools/svtresid.hxx> #include <svtools/strings.hrc> #include <limits> @@ -495,7 +495,7 @@ struct TabBar_Impl ScopedVclPtr<TabBarEdit> mpEdit; std::vector<std::unique_ptr<ImplTabBarItem>> mpItemList; - svt::AccessibleFactoryAccess maAccessibleFactory; + vcl::AccessibleFactoryAccess maAccessibleFactory; sal_uInt16 getItemSize() { diff --git a/svtools/source/control/vclxaccessibleheaderbar.cxx b/svtools/source/control/vclxaccessibleheaderbar.cxx deleted file mode 100644 index 1c79039eddeb..000000000000 --- a/svtools/source/control/vclxaccessibleheaderbar.cxx +++ /dev/null @@ -1,155 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <vclxaccessibleheaderbar.hxx> -#include <vclxaccessibleheaderbaritem.hxx> - -#include <toolkit/awt/vclxwindows.hxx> -#include <svtools/headbar.hxx> -#include <unotools/accessiblestatesethelper.hxx> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/accessibility/AccessibleEventId.hpp> -#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -#include <cppuhelper/typeprovider.hxx> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <vcl/svapp.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - -VCLXHeaderBar::VCLXHeaderBar(vcl::Window* pHeaderBar) -{ - SetWindow(pHeaderBar); -} - -VCLXHeaderBar::~VCLXHeaderBar() -{ -} - -css::uno::Reference< css::accessibility::XAccessibleContext > VCLXHeaderBar::CreateAccessibleContext() -{ - return new VCLXAccessibleHeaderBar(this); -} - - -VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow ) - :VCLXAccessibleComponent( pVCLWindow ) - ,m_pHeadBar(nullptr) -{ - m_pHeadBar = GetAs< HeaderBar >(); -} - - -VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar() -{ -} - - -// XServiceInfo - - -OUString VCLXAccessibleHeaderBar::getImplementationName() -{ - return OUString( "com.sun.star.comp.toolkit.AccessibleHeaderBar" ); -} - - -Sequence< OUString > VCLXAccessibleHeaderBar::getSupportedServiceNames() -{ - Sequence<OUString> aNames { "com.sun.star.awt.AccessibleHeaderBar" }; - return aNames; -} - -// =======XAccessibleContext======= - -sal_Int32 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount( ) -{ - SolarMutexGuard g; - - sal_Int32 nCount = 0; - if ( m_pHeadBar ) - nCount = m_pHeadBar->GetItemCount(); - - return nCount; -} -css::uno::Reference< css::accessibility::XAccessible > SAL_CALL - VCLXAccessibleHeaderBar::getAccessibleChild( sal_Int32 i ) -{ - SolarMutexGuard g; - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - Reference< XAccessible > xChild; - // search for the child - if ( static_cast<sal_uInt16>(i) >= m_aAccessibleChildren.size() ) - xChild = CreateChild (i); - else - { - xChild = m_aAccessibleChildren[i]; - if ( !xChild.is() ) - xChild = CreateChild (i); - } - return xChild; -} - -sal_Int16 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleRole( ) -{ - return css::accessibility::AccessibleRole::LIST; -} - -void SAL_CALL VCLXAccessibleHeaderBar::disposing() -{ - SolarMutexGuard g; - - ListItems().swap(m_aAccessibleChildren); - VCLXAccessibleComponent::disposing(); -} - -css::uno::Reference< css::accessibility::XAccessible > VCLXAccessibleHeaderBar::CreateChild (sal_Int32 i) -{ - Reference<XAccessible> xChild; - - sal_uInt16 nPos = static_cast<sal_uInt16>(i); - if ( nPos >= m_aAccessibleChildren.size() ) - { - m_aAccessibleChildren.resize(nPos + 1); - - // insert into the container - xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i); - m_aAccessibleChildren[nPos] = xChild; - } - else - { - xChild = m_aAccessibleChildren[nPos]; - // check if position is empty and can be used else we have to adjust all entries behind this - if ( !xChild.is() ) - { - xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i); - m_aAccessibleChildren[nPos] = xChild; - } - } - return xChild; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/control/vclxaccessibleheaderbaritem.cxx b/svtools/source/control/vclxaccessibleheaderbaritem.cxx deleted file mode 100644 index 11b0f7446b4b..000000000000 --- a/svtools/source/control/vclxaccessibleheaderbaritem.cxx +++ /dev/null @@ -1,273 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <vclxaccessibleheaderbaritem.hxx> - -#include <svtools/headbar.hxx> - -#include <com/sun/star/accessibility/AccessibleEventId.hpp> -#include <com/sun/star/accessibility/AccessibleRole.hpp> -#include <com/sun/star/accessibility/AccessibleStateType.hpp> -#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -#include <cppuhelper/supportsservice.hxx> - -#include <unotools/accessiblestatesethelper.hxx> -#include <unotools/accessiblerelationsethelper.hxx> -#include <vcl/svapp.hxx> -#include <vcl/settings.hxx> -#include <toolkit/awt/vclxfont.hxx> -#include <toolkit/helper/convert.hxx> - -#include <vector> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::accessibility; -using namespace ::comphelper; - - -// class AccessibleTabBar - - -VCLXAccessibleHeaderBarItem::VCLXAccessibleHeaderBarItem( HeaderBar* pHeadBar, sal_Int32 _nIndexInParent ) - :m_pHeadBar( pHeadBar ) - ,m_nIndexInParent(_nIndexInParent + 1) - -{ -} - -VCLXAccessibleHeaderBarItem::~VCLXAccessibleHeaderBarItem() -{ -} - -void VCLXAccessibleHeaderBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) -{ - if ( m_pHeadBar ) - { - if ( m_pHeadBar->IsEnabled() ) - rStateSet.AddState( AccessibleStateType::ENABLED ); - - if ( m_pHeadBar->IsVisible() ) - { - rStateSet.AddState( AccessibleStateType::VISIBLE ); - } - rStateSet.AddState( AccessibleStateType::SELECTABLE ); - rStateSet.AddState( AccessibleStateType::RESIZABLE ); - } -} - -// OCommonAccessibleComponent -awt::Rectangle VCLXAccessibleHeaderBarItem::implGetBounds() -{ - awt::Rectangle aBounds; - OExternalLockGuard aGuard( this ); - - if ( m_pHeadBar ) - aBounds = AWTRectangle( m_pHeadBar->GetItemRect( sal_uInt16( m_nIndexInParent ) ) ); - - return aBounds; -} - - -// XInterface - - -IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleHeaderBarItem, OAccessibleExtendedComponentHelper, VCLXAccessibleHeaderBarItem_BASE ) - - -// XTypeProvider - - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleHeaderBarItem, OAccessibleExtendedComponentHelper, VCLXAccessibleHeaderBarItem_BASE ) - - -// XServiceInfo -OUString VCLXAccessibleHeaderBarItem::getImplementationName() -{ - return OUString("com.sun.star.comp.svtools.AccessibleHeaderBarItem"); -} - -sal_Bool VCLXAccessibleHeaderBarItem::supportsService( const OUString& rServiceName ) -{ - return cppu::supportsService( this, rServiceName ); -} - -Sequence< OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() -{ - Sequence< OUString > aNames { "com.sun.star.awt.AccessibleHeaderBarItem" }; - return aNames; -} - -// XAccessible -Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContext() -{ - return this; -} - - -// XAccessibleContext - - -sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleChildCount() -{ - return 0; -} - - -Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleChild( sal_Int32 i ) -{ - OExternalLockGuard aGuard( this ); - - if ( i < 0 || i >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - - return Reference< XAccessible >(); -} - - -Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleParent() -{ - OExternalLockGuard aGuard( this ); - - Reference< XAccessible > xParent; - if ( m_pHeadBar ) - { - xParent = m_pHeadBar->GetAccessible(); - } - - return xParent; -} - - -sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent() -{ - OExternalLockGuard aGuard( this ); - return m_nIndexInParent - 1; -} - - -sal_Int16 VCLXAccessibleHeaderBarItem::getAccessibleRole() -{ - return AccessibleRole::COLUMN_HEADER; -} - - -OUString VCLXAccessibleHeaderBarItem::getAccessibleDescription() -{ - return OUString(); -} - - -OUString VCLXAccessibleHeaderBarItem::getAccessibleName() -{ - OExternalLockGuard aGuard( this ); - - OUString sName; - if(m_pHeadBar) - sName = m_pHeadBar->GetItemText( sal_uInt16( m_nIndexInParent ) ); - return sName; -} - - -Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRelationSet( ) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; -} - - -Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleStateSet( ) -{ - OExternalLockGuard aGuard( this ); - - utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - Reference< XAccessibleStateSet > xSet = pStateSetHelper; - - if ( !rBHelper.bDisposed && !rBHelper.bInDispose ) - { - FillAccessibleStateSet( *pStateSetHelper ); - } - else - { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); - } - - return xSet; -} - - -css::lang::Locale VCLXAccessibleHeaderBarItem::getLocale() -{ - OExternalLockGuard aGuard( this ); - - return Application::GetSettings().GetLanguageTag().getLocale(); -} - - -// XAccessibleComponent - - -Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleAtPoint( const awt::Point& ) -{ - return Reference< XAccessible >(); -} - - -sal_Int32 VCLXAccessibleHeaderBarItem::getForeground() -{ - return 0; -} - - -sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() -{ - return 0; -} - - -// XAccessibleExtendedComponent - - -Reference< awt::XFont > VCLXAccessibleHeaderBarItem::getFont() -{ - return Reference< awt::XFont >(); -} - - -OUString VCLXAccessibleHeaderBarItem::getTitledBorderText() -{ - return OUString(); -} - - -OUString VCLXAccessibleHeaderBarItem::getToolTipText() -{ - OExternalLockGuard aGuard( this ); - - OUString sText; - if ( m_pHeadBar ) - sText = m_pHeadBar->GetQuickHelpText(); - - return sText; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/textwindowpeer.cxx b/svtools/source/edit/textwindowpeer.cxx index 5bfc39dc22d5..4075295ed258 100644 --- a/svtools/source/edit/textwindowpeer.cxx +++ b/svtools/source/edit/textwindowpeer.cxx @@ -19,7 +19,7 @@ #include <sal/config.h> -#include <svtaccessiblefactory.hxx> +#include <vcl/svtaccessiblefactory.hxx> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> @@ -45,7 +45,7 @@ private: TextEngine & m_rEngine; TextView & m_rView; - svt::AccessibleFactoryAccess m_aFactoryAccess; + vcl::AccessibleFactoryAccess m_aFactoryAccess; }; TextWindowPeer::TextWindowPeer(TextView & view): diff --git a/svtools/source/inc/svtaccessiblefactory.hxx b/svtools/source/inc/svtaccessiblefactory.hxx deleted file mode 100644 index 7469d2d1656d..000000000000 --- a/svtools/source/inc/svtaccessiblefactory.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SVTOOLS_SOURCE_INC_SVTACCESSIBLEFACTORY_HXX -#define INCLUDED_SVTOOLS_SOURCE_INC_SVTACCESSIBLEFACTORY_HXX - -#include <svtools/accessiblefactory.hxx> - -namespace svt -{ - /** a client for the accessibility implementations which have been outsourced - from the main svtools library - - All instances of this class share a reference to a common IAccessibleFactory - instance, which is used for creating all kind of Accessibility related - components. - - When the AccessibleFactoryAccess goes away, also this factory goes away, and the respective - library is unloaded. - - This class is not thread-safe. - */ - class AccessibleFactoryAccess - { - private: - bool m_bInitialized; - - public: - AccessibleFactoryAccess(); - - IAccessibleFactory& getFactory(); - - private: - void ensureInitialized(); - }; - - -} // namespace svt - -#endif // INCLUDED_SVTOOLS_SOURCE_INC_SVTACCESSIBLEFACTORY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx deleted file mode 100644 index c8fe74fd8a11..000000000000 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ /dev/null @@ -1,262 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <config_features.h> - -#include <svtaccessiblefactory.hxx> - -#include <tools/svlibrary.h> - -#include <osl/module.h> -#include <osl/diagnose.h> - -namespace svt -{ - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::accessibility; - - namespace - { -#ifndef DISABLE_DYNLOADING - static oslModule s_hAccessibleImplementationModule = nullptr; -#endif -#if HAVE_FEATURE_DESKTOP - static GetSvtAccessibilityComponentFactory s_pAccessibleFactoryFunc = nullptr; -#endif - static ::rtl::Reference< IAccessibleFactory > s_pFactory; - - - //= AccessibleDummyFactory - - class AccessibleDummyFactory: - public IAccessibleFactory - { - public: - AccessibleDummyFactory(); - AccessibleDummyFactory(const AccessibleDummyFactory&) = delete; - AccessibleDummyFactory& operator=(const AccessibleDummyFactory&) = delete; - - protected: - virtual ~AccessibleDummyFactory() override; - - public: - // IAccessibleFactory - virtual IAccessibleTabListBox* - createAccessibleTabListBox( - const css::uno::Reference< css::accessibility::XAccessible >& /*rxParent*/, - SvHeaderTabListBox& /*rBox*/ - ) const override - { - return nullptr; - } - - virtual IAccessibleBrowseBox* - createAccessibleBrowseBox( - const css::uno::Reference< css::accessibility::XAccessible >& /*_rxParent*/, - IAccessibleTableProvider& /*_rBrowseBox*/ - ) const override - { - return nullptr; - } - - virtual table::IAccessibleTableControl* - createAccessibleTableControl( - const css::uno::Reference< css::accessibility::XAccessible >& /*_rxParent*/, - table::IAccessibleTable& /*_rTable*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleIconChoiceCtrl( - SvtIconChoiceCtrl& /*_rIconCtrl*/, - const css::uno::Reference< css::accessibility::XAccessible >& /*_xParent*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleTabBar( - TabBar& /*_rTabBar*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleTextWindowContext( - VCLXWindow* /*pVclXWindow*/, TextEngine& /*rEngine*/, TextView& /*rView*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleBrowseBoxHeaderBar( - const css::uno::Reference< css::accessibility::XAccessible >& /*rxParent*/, - IAccessibleTableProvider& /*_rOwningTable*/, - AccessibleBrowseBoxObjType /*_eObjType*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleBrowseBoxTableCell( - const css::uno::Reference< css::accessibility::XAccessible >& /*_rxParent*/, - IAccessibleTableProvider& /*_rBrowseBox*/, - const css::uno::Reference< css::awt::XWindow >& /*_xFocusWindow*/, - sal_Int32 /*_nRowId*/, - sal_uInt16 /*_nColId*/, - sal_Int32 /*_nOffset*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleBrowseBoxHeaderCell( - sal_Int32 /*_nColumnRowId*/, - const css::uno::Reference< css::accessibility::XAccessible >& /*rxParent*/, - IAccessibleTableProvider& /*_rBrowseBox*/, - const css::uno::Reference< css::awt::XWindow >& /*_xFocusWindow*/, - AccessibleBrowseBoxObjType /*_eObjType*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessibleCheckBoxCell( - const css::uno::Reference< css::accessibility::XAccessible >& /*_rxParent*/, - IAccessibleTableProvider& /*_rBrowseBox*/, - const css::uno::Reference< css::awt::XWindow >& /*_xFocusWindow*/, - sal_Int32 /*_nRowPos*/, - sal_uInt16 /*_nColPos*/, - const TriState& /*_eState*/, - bool /*_bIsTriState*/ - ) const override - { - return nullptr; - } - - virtual css::uno::Reference< css::accessibility::XAccessible > - createEditBrowseBoxTableCellAccess( - const css::uno::Reference< css::accessibility::XAccessible >& /*_rxParent*/, - const css::uno::Reference< css::accessibility::XAccessible >& /*_rxControlAccessible*/, - const css::uno::Reference< css::awt::XWindow >& /*_rxFocusWindow*/, - IAccessibleTableProvider& /*_rBrowseBox*/, - sal_Int32 /*_nRowPos*/, - sal_uInt16 /*_nColPos*/ - ) const override - { - return nullptr; - } - }; - - - AccessibleDummyFactory::AccessibleDummyFactory() - { - } - - - AccessibleDummyFactory::~AccessibleDummyFactory() - { - } - - } - - - //= AccessibleFactoryAccess - - - AccessibleFactoryAccess::AccessibleFactoryAccess() - :m_bInitialized( false ) - { - } - -#if HAVE_FEATURE_DESKTOP -#ifndef DISABLE_DYNLOADING - extern "C" { static void thisModule() {} } -#else - extern "C" void* getSvtAccessibilityComponentFactory(); -#endif -#endif // HAVE_FEATURE_DESKTOP - - void AccessibleFactoryAccess::ensureInitialized() - { - if ( m_bInitialized ) - return; - - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - -#if HAVE_FEATURE_DESKTOP - // load the library implementing the factory - if (!s_pFactory) - { -#ifndef DISABLE_DYNLOADING - const OUString sModuleName( SVLIBRARY( "acc" )); - s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 ); - if ( s_hAccessibleImplementationModule != nullptr ) - { - const OUString sFactoryCreationFunc( "getSvtAccessibilityComponentFactory" ); - s_pAccessibleFactoryFunc = reinterpret_cast<GetSvtAccessibilityComponentFactory>( - osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData )); - - } - OSL_ENSURE( s_pAccessibleFactoryFunc, "ac_registerClient: could not load the library, or not retrieve the needed symbol!" ); -#else - s_pAccessibleFactoryFunc = getSvtAccessibilityComponentFactory; -#endif // DISABLE_DYNLOADING - - // get a factory instance - if ( s_pAccessibleFactoryFunc ) - { - IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() ); - if ( pFactory ) - { - s_pFactory = pFactory; - pFactory->release(); - } - } - } -#endif // HAVE_FEATURE_DESKTOP - - if (!s_pFactory) - // the attempt to load the lib, or to create the factory, failed - // -> fall back to a dummy factory - s_pFactory = new AccessibleDummyFactory; - - m_bInitialized = true; - } - - IAccessibleFactory& AccessibleFactoryAccess::getFactory() - { - ensureInitialized(); - DBG_ASSERT( s_pFactory.is(), "AccessibleFactoryAccess::getFactory: at least a dummy factory should have been created!" ); - return *s_pFactory; - } - - -} // namespace svt - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index b0e66414f5e9..89c02e1075c9 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -295,25 +295,25 @@ namespace svt { namespace table } - OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const + OUString TableControl::GetAccessibleObjectName( vcl::table::AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const { OUString aRetText; //Window* pWin; switch( eObjType ) { - case TCTYPE_GRIDCONTROL: + case vcl::table::TCTYPE_GRIDCONTROL: aRetText = "Grid control"; break; - case TCTYPE_TABLE: + case vcl::table::TCTYPE_TABLE: aRetText = "Grid control"; break; - case TCTYPE_ROWHEADERBAR: + case vcl::table::TCTYPE_ROWHEADERBAR: aRetText = "RowHeaderBar"; break; - case TCTYPE_COLUMNHEADERBAR: + case vcl::table::TCTYPE_COLUMNHEADERBAR: aRetText = "ColumnHeaderBar"; break; - case TCTYPE_TABLECELL: + case vcl::table::TCTYPE_TABLECELL: //the name of the cell consists of column name and row name if defined //if the name is equal to cell content, it'll be read twice if(GetModel()->hasColumnHeaders()) @@ -326,10 +326,10 @@ namespace svt { namespace table } //aRetText = GetAccessibleCellText(_nRow, _nCol); break; - case TCTYPE_ROWHEADERCELL: + case vcl::table::TCTYPE_ROWHEADERCELL: aRetText = GetRowName(_nRow); break; - case TCTYPE_COLUMNHEADERCELL: + case vcl::table::TCTYPE_COLUMNHEADERCELL: aRetText = GetColumnName(_nCol); break; default: @@ -339,24 +339,24 @@ namespace svt { namespace table } - OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType ) const + OUString TableControl::GetAccessibleObjectDescription( vcl::table::AccessibleTableControlObjType eObjType ) const { OUString aRetText; switch( eObjType ) { - case TCTYPE_GRIDCONTROL: + case vcl::table::TCTYPE_GRIDCONTROL: aRetText = "Grid control description"; break; - case TCTYPE_TABLE: + case vcl::table::TCTYPE_TABLE: aRetText = "TABLE description"; break; - case TCTYPE_ROWHEADERBAR: + case vcl::table::TCTYPE_ROWHEADERBAR: aRetText = "ROWHEADERBAR description"; break; - case TCTYPE_COLUMNHEADERBAR: + case vcl::table::TCTYPE_COLUMNHEADERBAR: aRetText = "COLUMNHEADERBAR description"; break; - case TCTYPE_TABLECELL: + case vcl::table::TCTYPE_TABLECELL: // the description of the cell consists of column name and row name if defined // if the name is equal to cell content, it'll be read twice if ( GetModel()->hasColumnHeaders() ) @@ -368,10 +368,10 @@ namespace svt { namespace table aRetText += GetRowName( GetCurrentRow() ); } break; - case TCTYPE_ROWHEADERCELL: + case vcl::table::TCTYPE_ROWHEADERCELL: aRetText = "ROWHEADERCELL description"; break; - case TCTYPE_COLUMNHEADERCELL: + case vcl::table::TCTYPE_COLUMNHEADERCELL: aRetText = "COLUMNHEADERCELL description"; break; } @@ -413,12 +413,12 @@ namespace svt { namespace table void TableControl::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, - AccessibleTableControlObjType eObjType ) const + vcl::table::AccessibleTableControlObjType eObjType ) const { switch( eObjType ) { - case TCTYPE_GRIDCONTROL: - case TCTYPE_TABLE: + case vcl::table::TCTYPE_GRIDCONTROL: + case vcl::table::TCTYPE_TABLE: rStateSet.AddState( AccessibleStateType::FOCUSABLE ); @@ -440,21 +440,21 @@ namespace svt { namespace table if ( IsReallyVisible() ) rStateSet.AddState( AccessibleStateType::VISIBLE ); - if ( eObjType == TCTYPE_TABLE ) + if ( eObjType == vcl::table::TCTYPE_TABLE ) rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; - case TCTYPE_ROWHEADERBAR: + case vcl::table::TCTYPE_ROWHEADERBAR: rStateSet.AddState( AccessibleStateType::VISIBLE ); rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; - case TCTYPE_COLUMNHEADERBAR: + case vcl::table::TCTYPE_COLUMNHEADERBAR: rStateSet.AddState( AccessibleStateType::VISIBLE ); rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); break; - case TCTYPE_TABLECELL: + case vcl::table::TCTYPE_TABLECELL: { rStateSet.AddState( AccessibleStateType::FOCUSABLE ); if ( HasChildPathFocus() ) @@ -470,12 +470,12 @@ namespace svt { namespace table } break; - case TCTYPE_ROWHEADERCELL: + case vcl::table::TCTYPE_ROWHEADERCELL: rStateSet.AddState( AccessibleStateType::VISIBLE ); rStateSet.AddState( AccessibleStateType::TRANSIENT ); break; - case TCTYPE_COLUMNHEADERCELL: + case vcl::table::TCTYPE_COLUMNHEADERCELL: rStateSet.AddState( AccessibleStateType::VISIBLE ); break; } diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 51050748176c..344fe0f9d367 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -23,7 +23,7 @@ #include <svtools/table/tablemodel.hxx> #include <table/tablecontrolinterface.hxx> -#include <svtaccessiblefactory.hxx> +#include <vcl/svtaccessiblefactory.hxx> #include <vcl/seleng.hxx> @@ -130,8 +130,8 @@ namespace svt { namespace table RowPos m_nAnchor; bool m_bUpdatingColWidths; - AccessibleFactoryAccess m_aFactoryAccess; - IAccessibleTableControl* m_pAccessibleTable; + vcl::AccessibleFactoryAccess m_aFactoryAccess; + vcl::table::IAccessibleTableControl* m_pAccessibleTable; public: void setModel( const PTableModel& _pModel ); |