From 7dd77a12713c0557c5826d3541e97ef6120e1d00 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 15 Dec 2015 17:22:39 +0100 Subject: Remove unused ToolPanel (aka TaskPane) Superseded by the Sidebar Change-Id: I54970d71cd9d42de4f47b223e50dd9474b40632a Reviewed-on: https://gerrit.libreoffice.org/20724 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- accessibility/Library_acc.mk | 3 - .../extended/AccessibleToolPanelDeck.hxx | 77 -- .../extended/AccessibleToolPanelDeckTabBar.hxx | 78 -- .../extended/AccessibleToolPanelDeckTabBarItem.hxx | 94 -- .../source/extended/AccessibleToolPanelDeck.cxx | 357 ----- .../extended/AccessibleToolPanelDeckTabBar.cxx | 398 ------ .../extended/AccessibleToolPanelDeckTabBarItem.cxx | 391 ------ accessibility/source/helper/acc_factory.cxx | 27 - .../source/fwe/classes/sfxhelperfunctions.cxx | 21 - framework/source/layoutmanager/layoutmanager.cxx | 7 - include/framework/sfxhelperfunctions.hxx | 9 - include/sfx2/module.hxx | 2 - include/sfx2/sfxsids.hrc | 1 - include/sfx2/taskpane.hxx | 190 --- include/sfx2/viewfrm.hxx | 3 - include/svtools/accessiblefactory.hxx | 14 - include/svtools/svtools.hrc | 6 +- include/svtools/toolpanel/decklayouter.hxx | 100 -- include/svtools/toolpanel/drawerlayouter.hxx | 88 -- include/svtools/toolpanel/paneltabbar.hxx | 97 -- include/svtools/toolpanel/tabalignment.hxx | 42 - include/svtools/toolpanel/tabitemcontent.hxx | 43 - include/svtools/toolpanel/tablayouter.hxx | 94 -- include/svtools/toolpanel/toolpanel.hxx | 134 -- include/svtools/toolpanel/toolpaneldeck.hxx | 185 --- .../org/openoffice/Office/UI/GenericCommands.xcu | 5 - sc/source/ui/app/scdll.cxx | 2 - sd/sdi/ViewShellBase.sdi | 5 - sd/source/ui/inc/PaneChildWindows.hxx | 1 - sd/source/ui/view/GraphicViewShellBase.cxx | 1 - sfx2/AllLangResTarget_sfx2.mk | 1 - sfx2/Library_sfx.mk | 1 - sfx2/inc/pch/precompiled_sfx.hxx | 2 - sfx2/sdi/frmslots.sdi | 5 - sfx2/sdi/sfx.sdi | 26 - sfx2/source/appl/app.cxx | 1 - sfx2/source/appl/appreg.cxx | 1 - sfx2/source/appl/module.cxx | 12 - sfx2/source/appl/workwin.cxx | 45 +- sfx2/source/dialog/dialog.src | 4 - sfx2/source/dialog/taskpane.cxx | 1242 ------------------ sfx2/source/dialog/taskpane.src | 42 - sfx2/source/inc/workwin.hxx | 1 - sfx2/source/view/impviewframe.hxx | 2 - sfx2/source/view/viewfrm.cxx | 65 +- starmath/source/smdll.cxx | 3 - starmath/source/view.cxx | 1 - starmath/uiconfig/smath/menubar/menubar.xml | 2 - svtools/AllLangResTarget_svt.mk | 1 - svtools/Library_svt.mk | 13 - svtools/inc/pch/precompiled_svt.hxx | 1 - svtools/source/misc/svtaccessiblefactory.cxx | 18 - svtools/source/toolpanel/drawerlayouter.cxx | 285 ---- svtools/source/toolpanel/dummypanel.cxx | 98 -- svtools/source/toolpanel/dummypanel.hxx | 62 - svtools/source/toolpanel/paneldecklisteners.cxx | 131 -- svtools/source/toolpanel/paneldecklisteners.hxx | 67 - svtools/source/toolpanel/paneltabbar.cxx | 1371 -------------------- svtools/source/toolpanel/paneltabbarpeer.cxx | 92 -- svtools/source/toolpanel/paneltabbarpeer.hxx | 61 - svtools/source/toolpanel/tabbargeometry.cxx | 322 ----- svtools/source/toolpanel/tabbargeometry.hxx | 128 -- svtools/source/toolpanel/tabitemdescriptor.hxx | 85 -- svtools/source/toolpanel/tablayouter.cxx | 205 --- svtools/source/toolpanel/toolpanel.cxx | 44 - svtools/source/toolpanel/toolpanel.src | 42 - svtools/source/toolpanel/toolpanelcollection.cxx | 187 --- svtools/source/toolpanel/toolpanelcollection.hxx | 64 - svtools/source/toolpanel/toolpaneldeck.cxx | 529 -------- svtools/source/toolpanel/toolpaneldeckpeer.cxx | 90 -- svtools/source/toolpanel/toolpaneldeckpeer.hxx | 61 - svtools/source/toolpanel/toolpaneldrawer.cxx | 352 ----- svtools/source/toolpanel/toolpaneldrawer.hxx | 105 -- svtools/source/toolpanel/toolpaneldrawerpeer.cxx | 134 -- svtools/source/toolpanel/toolpaneldrawerpeer.hxx | 51 - sw/source/uibase/app/swmodule.cxx | 2 - 76 files changed, 16 insertions(+), 8516 deletions(-) delete mode 100644 accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx delete mode 100644 accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx delete mode 100644 accessibility/source/extended/AccessibleToolPanelDeck.cxx delete mode 100644 accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx delete mode 100644 accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx delete mode 100644 include/sfx2/taskpane.hxx delete mode 100644 include/svtools/toolpanel/decklayouter.hxx delete mode 100644 include/svtools/toolpanel/drawerlayouter.hxx delete mode 100644 include/svtools/toolpanel/paneltabbar.hxx delete mode 100644 include/svtools/toolpanel/tabalignment.hxx delete mode 100644 include/svtools/toolpanel/tabitemcontent.hxx delete mode 100644 include/svtools/toolpanel/tablayouter.hxx delete mode 100644 include/svtools/toolpanel/toolpanel.hxx delete mode 100644 include/svtools/toolpanel/toolpaneldeck.hxx delete mode 100644 sfx2/source/dialog/taskpane.cxx delete mode 100644 sfx2/source/dialog/taskpane.src delete mode 100644 svtools/source/toolpanel/drawerlayouter.cxx delete mode 100644 svtools/source/toolpanel/dummypanel.cxx delete mode 100644 svtools/source/toolpanel/dummypanel.hxx delete mode 100644 svtools/source/toolpanel/paneldecklisteners.cxx delete mode 100644 svtools/source/toolpanel/paneldecklisteners.hxx delete mode 100644 svtools/source/toolpanel/paneltabbar.cxx delete mode 100644 svtools/source/toolpanel/paneltabbarpeer.cxx delete mode 100644 svtools/source/toolpanel/paneltabbarpeer.hxx delete mode 100644 svtools/source/toolpanel/tabbargeometry.cxx delete mode 100644 svtools/source/toolpanel/tabbargeometry.hxx delete mode 100644 svtools/source/toolpanel/tabitemdescriptor.hxx delete mode 100644 svtools/source/toolpanel/tablayouter.cxx delete mode 100644 svtools/source/toolpanel/toolpanel.cxx delete mode 100644 svtools/source/toolpanel/toolpanel.src delete mode 100644 svtools/source/toolpanel/toolpanelcollection.cxx delete mode 100644 svtools/source/toolpanel/toolpanelcollection.hxx delete mode 100644 svtools/source/toolpanel/toolpaneldeck.cxx delete mode 100644 svtools/source/toolpanel/toolpaneldeckpeer.cxx delete mode 100644 svtools/source/toolpanel/toolpaneldeckpeer.hxx delete mode 100644 svtools/source/toolpanel/toolpaneldrawer.cxx delete mode 100644 svtools/source/toolpanel/toolpaneldrawer.hxx delete mode 100644 svtools/source/toolpanel/toolpaneldrawerpeer.cxx delete mode 100644 svtools/source/toolpanel/toolpaneldrawerpeer.hxx diff --git a/accessibility/Library_acc.mk b/accessibility/Library_acc.mk index 4b5a10bb9fe1..3d12cb250ade 100644 --- a/accessibility/Library_acc.mk +++ b/accessibility/Library_acc.mk @@ -54,9 +54,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\ accessibility/source/extended/AccessibleGridControlTable \ accessibility/source/extended/AccessibleGridControlTableBase \ accessibility/source/extended/AccessibleGridControlTableCell \ - accessibility/source/extended/AccessibleToolPanelDeck \ - accessibility/source/extended/AccessibleToolPanelDeckTabBar \ - accessibility/source/extended/AccessibleToolPanelDeckTabBarItem \ accessibility/source/extended/accessiblebrowseboxcell \ accessibility/source/extended/accessibleeditbrowseboxcell \ accessibility/source/extended/accessibleiconchoicectrl \ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx deleted file mode 100644 index 529b4fe86086..000000000000 --- a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx +++ /dev/null @@ -1,77 +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_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECK_HXX -#define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECK_HXX - -#include - -#include - -namespace svt -{ - class ToolPanelDeck; -} - -namespace accessibility -{ - - class AccessibleToolPanelDeck_Impl; - - class AccessibleToolPanelDeck: public VCLXAccessibleComponent - { - public: - AccessibleToolPanelDeck( - const css::uno::Reference< css::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck - ); - - using VCLXAccessibleComponent::NotifyAccessibleEvent; - - protected: - virtual ~AccessibleToolPanelDeck(); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (css::uno::RuntimeException, std::exception) override; - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (css::uno::RuntimeException, std::exception) override; - - // XAccessibleComponent - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL grabFocus( ) throw (css::uno::RuntimeException, std::exception) override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // VCLXAccessibleComponent - virtual css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) override; - virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) override; - - private: - std::unique_ptr< AccessibleToolPanelDeck_Impl > m_xImpl; - }; - - -} // namespace accessibility - - -#endif // INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx deleted file mode 100644 index dd38ff50ee32..000000000000 --- a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx +++ /dev/null @@ -1,78 +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_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECKTABBAR_HXX -#define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECKTABBAR_HXX - -#include - -#include - -namespace svt -{ - class IToolPanelDeck; - class PanelTabBar; -} - -namespace accessibility -{ - - class AccessibleToolPanelTabBar_Impl; - - class AccessibleToolPanelTabBar: public VCLXAccessibleComponent - { - public: - AccessibleToolPanelTabBar( - const css::uno::Reference< css::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar - ); - - using VCLXAccessibleComponent::NotifyAccessibleEvent; - - protected: - virtual ~AccessibleToolPanelTabBar(); - - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (css::uno::RuntimeException, std::exception) override; - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (css::uno::RuntimeException, std::exception) override; - - // XAccessibleComponent - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) throw (css::uno::RuntimeException, std::exception) override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // VCLXAccessibleComponent - virtual css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) override; - virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) override; - - private: - std::unique_ptr< AccessibleToolPanelTabBar_Impl > m_xImpl; - }; - - -} // namespace accessibility - - -#endif // INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECKTABBAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx deleted file mode 100644 index 71aa2dd3bd37..000000000000 --- a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx +++ /dev/null @@ -1,94 +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_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX -#define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX - -#include - -#include - -namespace svt -{ - class IToolPanelDeck; - class PanelTabBar; -} - -namespace accessibility -{ - - class AccessibleToolPanelDeckTabBarItem_Impl; - - class AccessibleToolPanelDeckTabBarItem: - public comphelper::OAccessibleExtendedComponentHelper - { - public: - AccessibleToolPanelDeckTabBarItem( - const css::uno::Reference< css::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar, - const size_t i_nItemPos - ); - - using OAccessibleExtendedComponentHelper::NotifyAccessibleEvent; - using OAccessibleExtendedComponentHelper::lateInit; - - protected: - virtual ~AccessibleToolPanelDeckTabBarItem(); - - public: - // XAccessibleContext - virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (css::uno::RuntimeException, std::exception) override; - virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (css::uno::RuntimeException, std::exception) override; - virtual OUString SAL_CALL getAccessibleDescription( ) throw (css::uno::RuntimeException, std::exception) override; - virtual OUString SAL_CALL getAccessibleName( ) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (css::uno::RuntimeException, std::exception) override; - - // XAccessibleComponent - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) throw (css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL grabFocus( ) throw (css::uno::RuntimeException, std::exception) override; - virtual ::sal_Int32 SAL_CALL getForeground( ) throw (css::uno::RuntimeException, std::exception) override; - virtual ::sal_Int32 SAL_CALL getBackground( ) throw (css::uno::RuntimeException, std::exception) override; - - // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) throw (css::uno::RuntimeException, std::exception) override; - virtual OUString SAL_CALL getTitledBorderText( ) throw (css::uno::RuntimeException, std::exception) override; - virtual OUString SAL_CALL getToolTipText( ) throw (css::uno::RuntimeException, std::exception) override; - - protected: - // OCommonAccessibleComponent - virtual css::awt::Rectangle implGetBounds( ) throw (css::uno::RuntimeException) override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - protected: - std::unique_ptr< AccessibleToolPanelDeckTabBarItem_Impl > m_xImpl; - }; - - -} // namespace accessibility - - -#endif // INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleToolPanelDeck.cxx b/accessibility/source/extended/AccessibleToolPanelDeck.cxx deleted file mode 100644 index 863faa4dcaba..000000000000 --- a/accessibility/source/extended/AccessibleToolPanelDeck.cxx +++ /dev/null @@ -1,357 +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 "accessibility/extended/AccessibleToolPanelDeck.hxx" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - - -namespace accessibility -{ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::accessibility::XAccessibleContext; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::IndexOutOfBoundsException; - using ::com::sun::star::lang::Locale; - using ::com::sun::star::accessibility::XAccessibleRelationSet; - using ::com::sun::star::accessibility::XAccessibleStateSet; - using ::com::sun::star::accessibility::IllegalAccessibleComponentStateException; - using ::com::sun::star::awt::XFont; - - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; - namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; - - // AccessibleToolPanelDeck_Impl - declaration - class AccessibleToolPanelDeck_Impl :public ::boost::noncopyable - ,public ::svt::IToolPanelDeckListener - { - public: - AccessibleToolPanelDeck_Impl( - AccessibleToolPanelDeck& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck - ); - - void checkDisposed(); - bool isDisposed() const { return m_pPanelDeck == nullptr; } - void dispose(); - - virtual ~AccessibleToolPanelDeck_Impl(); - - Reference< XAccessible > getOwnAccessible() const; - Reference< XAccessible > getActivePanelAccessible(); - - protected: - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual void PanelRemoved( const size_t i_nPosition ) override; - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) override; - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) override; - virtual void Dying() override; - - public: - AccessibleToolPanelDeck& m_rAntiImpl; - Reference< XAccessible > m_xAccessibleParent; - VclPtr< ::svt::ToolPanelDeck > m_pPanelDeck; - - Reference< XAccessible > m_xActivePanelAccessible; - }; - - // MethodGuard - namespace - { - class MethodGuard - { - public: - explicit MethodGuard( AccessibleToolPanelDeck_Impl& i_rImpl ) - :m_aGuard() - { - i_rImpl.checkDisposed(); - } - ~MethodGuard() - { - } - - private: - SolarMutexGuard m_aGuard; - }; - } - - // AccessibleToolPanelDeck_Impl - implementation - AccessibleToolPanelDeck_Impl::AccessibleToolPanelDeck_Impl( AccessibleToolPanelDeck& i_rAntiImpl, const Reference< XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_xAccessibleParent( i_rAccessibleParent ) - ,m_pPanelDeck( &i_rPanelDeck ) - ,m_xActivePanelAccessible() - { - m_pPanelDeck->AddListener( *this ); - } - - AccessibleToolPanelDeck_Impl::~AccessibleToolPanelDeck_Impl() - { - if ( !isDisposed() ) - dispose(); - } - - void AccessibleToolPanelDeck_Impl::dispose() - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); - m_pPanelDeck->RemoveListener( *this ); - m_pPanelDeck.clear(); - m_xAccessibleParent.clear(); - } - - void AccessibleToolPanelDeck_Impl::checkDisposed() - { - if ( isDisposed() ) - throw DisposedException( OUString(), *&m_rAntiImpl ); - } - - Reference< XAccessible > AccessibleToolPanelDeck_Impl::getOwnAccessible() const - { - Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); - OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), - "AccessibleToolPanelDeck_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); - return xOwnAccessible; - } - - Reference< XAccessible > AccessibleToolPanelDeck_Impl::getActivePanelAccessible() - { - ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: already disposed!", nullptr ); - - if ( !m_xActivePanelAccessible.is() ) - { - ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); - ENSURE_OR_RETURN( !!aActivePanel, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: this should not be called without an active panel!", nullptr ); - ::svt::PToolPanel pActivePanel( m_pPanelDeck->GetPanel( *aActivePanel ) ); - ENSURE_OR_RETURN( pActivePanel.get() != nullptr, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: no active panel!", nullptr ); - m_xActivePanelAccessible = pActivePanel->CreatePanelAccessible( getOwnAccessible() ); - OSL_ENSURE( m_xActivePanelAccessible.is(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: illegal accessible returned by the panel!" ); - } - - return m_xActivePanelAccessible; - } - - void AccessibleToolPanelDeck_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - (void)i_pPanel; - (void)i_nPosition; - } - - void AccessibleToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition ) - { - (void)i_nPosition; - } - - void AccessibleToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( !!i_rOldActive ) - { - if ( !m_xActivePanelAccessible.is() ) - { - // again, this might in theory happen if the XAccessible for the active panel has never before been requested. - // In this case, just say that all our children are invalid, so they all must be re-requested. - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); - } - else - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( m_xActivePanelAccessible ), Any() ); - } - } - - m_xActivePanelAccessible.clear(); - - if ( !!i_rNewActive ) - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getActivePanelAccessible() ) ); - } - } - - void AccessibleToolPanelDeck_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - MethodGuard aGuard( *this ); - - (void)i_rNewLayouter; - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); - } - - void AccessibleToolPanelDeck_Impl::Dying() - { - // the tool panel deck is dying, so dispose ourself - m_rAntiImpl.dispose(); - } - - // AccessibleToolPanelDeck - AccessibleToolPanelDeck::AccessibleToolPanelDeck( const Reference< XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck ) - :VCLXAccessibleComponent( i_rPanelDeck.GetWindowPeer() ) - ,m_xImpl( new AccessibleToolPanelDeck_Impl( *this, i_rAccessibleParent, i_rPanelDeck ) ) - { - } - - AccessibleToolPanelDeck::~AccessibleToolPanelDeck() - { - } - - sal_Int32 SAL_CALL AccessibleToolPanelDeck::getAccessibleChildCount( ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - - sal_Int32 nChildCount( m_xImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); - - ::boost::optional< size_t > aActivePanel( m_xImpl->m_pPanelDeck->GetActivePanel() ); - if ( !!aActivePanel ) - return ++nChildCount; - - return nChildCount; - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - - const sal_Int32 nChildCount( getAccessibleChildCount() ); - if ( ( i_nIndex < 0 ) || ( i_nIndex >= nChildCount ) ) - throw IndexOutOfBoundsException( OUString(), *this ); - - // first "n" children are provided by the layouter - const size_t nLayouterCount( m_xImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); - if ( size_t( i_nIndex ) < nLayouterCount ) - return m_xImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChild( - size_t( i_nIndex ), - m_xImpl->getOwnAccessible() - ); - - // the last child is the XAccessible of the active panel - return m_xImpl->getActivePanelAccessible(); - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleParent( ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - const Reference< XAccessible > xParent = implGetForeignControlledParent(); - if ( xParent.is() ) - return xParent; - return m_xImpl->m_xAccessibleParent; - } - - sal_Int16 SAL_CALL AccessibleToolPanelDeck::getAccessibleRole( ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - return AccessibleRole::PANEL; - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleAtPoint( const css::awt::Point& i_rPoint ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - - const ::Point aRequestedPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); - // check the panel window itself - const vcl::Window& rActivePanelAnchor( m_xImpl->m_pPanelDeck->GetPanelWindowAnchor() ); - const Rectangle aPanelAnchorArea( rActivePanelAnchor.GetPosPixel(), rActivePanelAnchor.GetOutputSizePixel() ); - if ( aPanelAnchorArea.IsInside( aRequestedPoint ) ) - // note that this assumes that the Window which actually implements the concrete panel covers - // the complete area of its "anchor" Window. But this is ensured by the ToolPanelDeck implementation. - return m_xImpl->getActivePanelAccessible(); - - // check the XAccessible instances provided by the layouter - try - { - const ::svt::PDeckLayouter pLayouter( m_xImpl->m_pPanelDeck->GetLayouter() ); - ENSURE_OR_THROW( pLayouter.get() != nullptr, "invalid layouter" ); - - const size_t nLayouterChildren = pLayouter->GetAccessibleChildCount(); - for ( size_t i=0; i xLayoutItemAccessible( pLayouter->GetAccessibleChild( i, m_xImpl->getOwnAccessible() ), UNO_SET_THROW ); - const Reference< XAccessibleComponent > xLayoutItemComponent( xLayoutItemAccessible->getAccessibleContext(), UNO_QUERY_THROW ); - const ::Rectangle aLayoutItemBounds( VCLUnoHelper::ConvertToVCLRect( xLayoutItemComponent->getBounds() ) ); - if ( aLayoutItemBounds.IsInside( aRequestedPoint ) ) - return xLayoutItemAccessible; - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - - return nullptr; - } - - void SAL_CALL AccessibleToolPanelDeck::grabFocus( ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - m_xImpl->m_pPanelDeck->GrabFocus(); - } - - void SAL_CALL AccessibleToolPanelDeck::disposing() - { - VCLXAccessibleComponent::disposing(); - m_xImpl->dispose(); - } - - Reference< XAccessible > AccessibleToolPanelDeck::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) - { - // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those - // A11Y events ourself - (void)i_rVclWindowEvent; - return nullptr; - } - - void AccessibleToolPanelDeck::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) - { - VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet ); - if ( m_xImpl->isDisposed() ) - { - i_rStateSet.AddState( AccessibleStateType::DEFUNC ); - } - else - { - i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - } - } -} // namespace accessibility - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx deleted file mode 100644 index a7a1a3b9b46b..000000000000 --- a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx +++ /dev/null @@ -1,398 +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 "accessibility/extended/AccessibleToolPanelDeckTabBar.hxx" -#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" -#include "accessibility/helper/accresmgr.hxx" -#include "accessibility/helper/accessiblestrings.hrc" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace accessibility -{ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::IndexOutOfBoundsException; - using ::com::sun::star::accessibility::XAccessibleContext; - - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; - namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; - - // AccessibleWrapper - typedef ::cppu::WeakImplHelper< XAccessible > AccessibleWrapper_Base; - class AccessibleWrapper : public AccessibleWrapper_Base - { - public: - explicit AccessibleWrapper( const Reference< XAccessibleContext >& i_rContext ) - :m_xContext( i_rContext ) - { - } - - // XAccessible - virtual Reference< XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (RuntimeException, std::exception) override - { - return m_xContext; - } - - private: - const Reference< XAccessibleContext > m_xContext; - }; - - // AccessibleToolPanelTabBar_Impl - class AccessibleToolPanelTabBar_Impl :public ::boost::noncopyable - ,public ::svt::IToolPanelDeckListener - { - public: - AccessibleToolPanelTabBar_Impl( - AccessibleToolPanelTabBar& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar - ); - virtual ~AccessibleToolPanelTabBar_Impl(); - - void checkDisposed(); - bool isDisposed() const { return m_pPanelDeck == nullptr; } - void dispose(); - - ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } - ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } - const Reference< XAccessible >& getAccessibleParent() const { return m_xAccessibleParent; } - Reference< XAccessible > getAccessiblePanelItem( size_t i_nPosition ); - Reference< XAccessible > getOwnAccessible() const; - - protected: - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual void PanelRemoved( const size_t i_nPosition ) override; - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) override; - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) override; - virtual void Dying() override; - - DECL_LINK_TYPED( OnWindowEvent, VclWindowEvent&, void ); - - private: - AccessibleToolPanelTabBar& m_rAntiImpl; - Reference< XAccessible > m_xAccessibleParent; - ::svt::IToolPanelDeck* m_pPanelDeck; - VclPtr< ::svt::PanelTabBar > m_pTabBar; - ::std::vector< Reference< XAccessible > > m_aChildren; - }; - - AccessibleToolPanelTabBar_Impl::AccessibleToolPanelTabBar_Impl( AccessibleToolPanelTabBar& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_xAccessibleParent( i_rAccessibleParent ) - ,m_pPanelDeck( &i_rPanelDeck ) - ,m_pTabBar( &i_rTabBar ) - ,m_aChildren() - { - m_pPanelDeck->AddListener( *this ); - m_aChildren.resize( m_pPanelDeck->GetPanelCount() ); - - const OUString sAccessibleDescription( TK_RES_STRING( RID_STR_ACC_DESC_PANELDECL_TABBAR ) ); - i_rTabBar.SetAccessibleName( sAccessibleDescription ); - i_rTabBar.SetAccessibleDescription( sAccessibleDescription ); - - i_rTabBar.GetScrollButton( true ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - i_rTabBar.GetScrollButton( false ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - } - - void AccessibleToolPanelTabBar_Impl::checkDisposed() - { - if ( isDisposed() ) - throw DisposedException( OUString(), *&m_rAntiImpl ); - } - - AccessibleToolPanelTabBar_Impl::~AccessibleToolPanelTabBar_Impl() - { - if ( !isDisposed() ) - dispose(); - } - - void AccessibleToolPanelTabBar_Impl::dispose() - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); - m_pPanelDeck->RemoveListener( *this ); - m_pPanelDeck = nullptr; - - m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); - m_pTabBar.clear(); - - m_xAccessibleParent.clear(); - } - - Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem( size_t i_nPosition ) - { - ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: already disposed!", nullptr ); - ENSURE_OR_RETURN( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: invalid index!", nullptr ); - - Reference< XAccessible >& rAccessibleChild( m_aChildren[ i_nPosition ] ); - if ( !rAccessibleChild.is() ) - { - ::rtl::Reference< AccessibleToolPanelDeckTabBarItem > pAccesibleItemContext( new AccessibleToolPanelDeckTabBarItem( - getOwnAccessible(), *m_pPanelDeck, *m_pTabBar, i_nPosition ) ); - rAccessibleChild.set( new AccessibleWrapper( pAccesibleItemContext.get() ) ); - pAccesibleItemContext->lateInit( rAccessibleChild ); - } - return rAccessibleChild; - } - - Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getOwnAccessible() const - { - Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); - OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), - "AccessibleToolPanelTabBar_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); - return xOwnAccessible; - } - - void AccessibleToolPanelTabBar_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - ENSURE_OR_RETURN_VOID( i_nPosition <= m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); - (void)i_pPanel; - m_aChildren.insert( m_aChildren.begin() + i_nPosition, Reference< XAccessible >() ); - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getAccessiblePanelItem( i_nPosition ) ) ); - } - - void AccessibleToolPanelTabBar_Impl::PanelRemoved( const size_t i_nPosition ) - { - ENSURE_OR_RETURN_VOID( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); - - const Reference< XAccessible > xOldChild( getAccessiblePanelItem( i_nPosition ) ); - m_aChildren.erase( m_aChildren.begin() + i_nPosition ); - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xOldChild ), Any() ); - } - - void AccessibleToolPanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - (void)i_rOldActive; - (void)i_rNewActive; - } - - void AccessibleToolPanelTabBar_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - (void)i_rNewLayouter; - m_rAntiImpl.dispose(); - } - - void AccessibleToolPanelTabBar_Impl::Dying() - { - m_rAntiImpl.dispose(); - } - - IMPL_LINK_TYPED( AccessibleToolPanelTabBar_Impl, OnWindowEvent, VclWindowEvent&, rWindowEvent, void ) - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!" ); - - const bool bForwardButton = ( rWindowEvent.GetWindow() == &m_pTabBar->GetScrollButton( true ) ); - const bool bBackwardButton = ( rWindowEvent.GetWindow() == &m_pTabBar->GetScrollButton( false ) ); - ENSURE_OR_RETURN_VOID( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?" ); - - const bool bShow = ( rWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW ); - const bool bHide = ( rWindowEvent.GetId() == VCLEVENT_WINDOW_HIDE ); - if ( !bShow && !bHide ) - // not interested in events other than visibility changes - return; - - const Reference< XAccessible > xButtonAccessible( m_pTabBar->GetScrollButton( bForwardButton ).GetAccessible() ); - const Any aOldChild( bHide ? xButtonAccessible : Reference< XAccessible >() ); - const Any aNewChild( bShow ? xButtonAccessible : Reference< XAccessible >() ); - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldChild, aNewChild ); - } - - // MethodGuard - namespace - { - class MethodGuard - { - public: - explicit MethodGuard( AccessibleToolPanelTabBar_Impl& i_rImpl ) - :m_aGuard() - { - i_rImpl.checkDisposed(); - } - ~MethodGuard() - { - } - - private: - SolarMutexGuard m_aGuard; - }; - } - - // AccessibleToolPanelTabBar - AccessibleToolPanelTabBar::AccessibleToolPanelTabBar( const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) - :VCLXAccessibleComponent( i_rTabBar.GetWindowPeer() ) - ,m_xImpl( new AccessibleToolPanelTabBar_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar ) ) - { - } - - AccessibleToolPanelTabBar::~AccessibleToolPanelTabBar() - { - } - - sal_Int32 SAL_CALL AccessibleToolPanelTabBar::getAccessibleChildCount( ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - - const bool bHasScrollBack = m_xImpl->getTabBar()->GetScrollButton( false ).IsVisible(); - const bool bHasScrollForward = m_xImpl->getTabBar()->GetScrollButton( true ).IsVisible(); - - return m_xImpl->getPanelDeck()->GetPanelCount() - + ( bHasScrollBack ? 1 : 0 ) - + ( bHasScrollForward ? 1 : 0 ); - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - - const bool bHasScrollBack = m_xImpl->getTabBar()->GetScrollButton( false ).IsVisible(); - const bool bHasScrollForward = m_xImpl->getTabBar()->GetScrollButton( true ).IsVisible(); - - const bool bScrollBackRequested = ( bHasScrollBack && ( i_nIndex == 0 ) ); - const bool bScrollForwardRequested = ( bHasScrollForward && ( i_nIndex == getAccessibleChildCount() - 1 ) ); - OSL_ENSURE( !( bScrollBackRequested && bScrollForwardRequested ), "AccessibleToolPanelTabBar::getAccessibleChild: ouch!" ); - - if ( bScrollBackRequested || bScrollForwardRequested ) - { - Reference< XAccessible > xScrollButtonAccessible( m_xImpl->getTabBar()->GetScrollButton( bScrollForwardRequested ).GetAccessible() ); - ENSURE_OR_RETURN( xScrollButtonAccessible.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible!", nullptr ); - #if OSL_DEBUG_LEVEL > 0 - Reference< XAccessibleContext > xScrollButtonContext( xScrollButtonAccessible->getAccessibleContext() ); - ENSURE_OR_RETURN( xScrollButtonContext.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible context!", xScrollButtonAccessible ); - OSL_ENSURE( xScrollButtonContext->getAccessibleParent() == m_xImpl->getOwnAccessible(), - "AccessibleToolPanelTabBar::getAccessibleChild: wrong parent at the button's accessible!" ); - #endif - return xScrollButtonAccessible; - } - - return m_xImpl->getAccessiblePanelItem( i_nIndex - ( bHasScrollBack ? 1 : 0 ) ); - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleParent( ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - return m_xImpl->getAccessibleParent(); - } - - sal_Int16 SAL_CALL AccessibleToolPanelTabBar::getAccessibleRole( ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - return AccessibleRole::PAGE_TAB_LIST; - } - - namespace - { - bool lcl_covers( const vcl::Window& i_rWindow, const ::Point& i_rPoint ) - { - const Rectangle aWindowBounds( i_rWindow.GetWindowExtentsRelative( i_rWindow.GetParent() ) ); - return aWindowBounds.IsInside( i_rPoint ); - } - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleAtPoint( const css::awt::Point& i_rPoint ) throw (RuntimeException, std::exception) - { - MethodGuard aGuard( *m_xImpl ); - - // check the tab items - const css::awt::Point aOwnScreenPos( getLocationOnScreen() ); - const ::Point aRequestedScreenPoint( i_rPoint.X + aOwnScreenPos.X, i_rPoint.Y + aOwnScreenPos.Y ); - - for ( size_t i=0; igetPanelDeck()->GetPanelCount(); ++i ) - { - const ::Rectangle aItemScreenRect( m_xImpl->getTabBar()->GetItemScreenRect(i) ); - if ( aItemScreenRect.IsInside( aRequestedScreenPoint ) ) - return m_xImpl->getAccessiblePanelItem(i); - } - - // check the scroll buttons - const ::Point aRequestedClientPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); - - const bool bHasScrollBack = m_xImpl->getTabBar()->GetScrollButton( false ).IsVisible(); - if ( bHasScrollBack && lcl_covers( m_xImpl->getTabBar()->GetScrollButton( false ), aRequestedClientPoint ) ) - return m_xImpl->getTabBar()->GetScrollButton( false ).GetAccessible(); - - const bool bHasScrollForward = m_xImpl->getTabBar()->GetScrollButton( true ).IsVisible(); - if ( bHasScrollForward && lcl_covers( m_xImpl->getTabBar()->GetScrollButton( true ), aRequestedClientPoint ) ) - return m_xImpl->getTabBar()->GetScrollButton( true ).GetAccessible(); - - // no hit - return nullptr; - } - - void SAL_CALL AccessibleToolPanelTabBar::disposing() - { - VCLXAccessibleComponent::disposing(); - m_xImpl->dispose(); - } - - Reference< XAccessible > AccessibleToolPanelTabBar::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) - { - // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those - // A11Y events ourself - (void)i_rVclWindowEvent; - return nullptr; - } - - void AccessibleToolPanelTabBar::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) - { - VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet ); - i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - ENSURE_OR_RETURN_VOID( !m_xImpl->isDisposed(), "AccessibleToolPanelTabBar::FillAccessibleStateSet: already disposed!" ); - if ( m_xImpl->getTabBar()->IsVertical() ) - i_rStateSet.AddState( AccessibleStateType::VERTICAL ); - else - i_rStateSet.AddState( AccessibleStateType::HORIZONTAL ); - } -} // namespace accessibility - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx deleted file mode 100644 index a64e97d4337e..000000000000 --- a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx +++ /dev/null @@ -1,391 +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 "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace accessibility -{ - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::lang::DisposedException; - using ::com::sun::star::lang::IndexOutOfBoundsException; - using ::com::sun::star::accessibility::XAccessibleRelationSet; - using ::com::sun::star::accessibility::XAccessibleStateSet; - using ::com::sun::star::accessibility::XAccessibleComponent; - using ::com::sun::star::accessibility::XAccessibleExtendedComponent; - using ::com::sun::star::awt::XFont; - - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; - namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; - - // AccessibleToolPanelDeckTabBarItem_Impl - class AccessibleToolPanelDeckTabBarItem_Impl : public ::svt::IToolPanelDeckListener - { - public: - AccessibleToolPanelDeckTabBarItem_Impl( - AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar, - const size_t i_nItemPos - ); - virtual ~AccessibleToolPanelDeckTabBarItem_Impl(); - - ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } - - // IToolPanelDeckListener - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual void PanelRemoved( const size_t i_nPosition ) override; - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) override; - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) override; - virtual void Dying() override; - - public: - bool isDisposed() const { return m_pPanelDeck == nullptr; } - void checkDisposed() const; - void dispose(); - - const Reference< XAccessible >& - getAccessibleParent() const { return m_xAccessibleParent; } - size_t getItemPos() const { return m_nItemPos; } - - Reference< XAccessibleComponent > getParentAccessibleComponent() const; - ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } - OUString getPanelDisplayName(); - - private: - void impl_notifyBoundRectChanges(); - void impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ); - - private: - AccessibleToolPanelDeckTabBarItem& m_rAntiImpl; - Reference< XAccessible > m_xAccessibleParent; - ::svt::IToolPanelDeck* m_pPanelDeck; - VclPtr< ::svt::PanelTabBar > m_pTabBar; - size_t m_nItemPos; - }; - - // AccessibleToolPanelDeckTabBarItem_Impl - AccessibleToolPanelDeckTabBarItem_Impl::AccessibleToolPanelDeckTabBarItem_Impl( AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, - const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, - const size_t i_nItemPos ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_xAccessibleParent( i_rAccessibleParent ) - ,m_pPanelDeck( &i_rPanelDeck ) - ,m_pTabBar( &i_rTabBar ) - ,m_nItemPos( i_nItemPos ) - { - m_pPanelDeck->AddListener( *this ); - } - - AccessibleToolPanelDeckTabBarItem_Impl::~AccessibleToolPanelDeckTabBarItem_Impl() - { - } - - void AccessibleToolPanelDeckTabBarItem_Impl::checkDisposed() const - { - if ( isDisposed() ) - throw DisposedException( OUString(), *&m_rAntiImpl ); - } - - void AccessibleToolPanelDeckTabBarItem_Impl::dispose() - { - ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelDeckTabBarItem_Impl::dispose: disposed twice!" ); - - m_xAccessibleParent.clear(); - m_pPanelDeck->RemoveListener( *this ); - m_pPanelDeck = nullptr; - m_pTabBar.clear(); - } - - Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const - { - Reference< XAccessible > xAccessibleParent( m_rAntiImpl.getAccessibleParent(), UNO_QUERY_THROW ); - return Reference< XAccessibleComponent >( xAccessibleParent->getAccessibleContext(), UNO_QUERY ); - } - - OUString AccessibleToolPanelDeckTabBarItem_Impl::getPanelDisplayName() - { - const ::svt::PToolPanel pPanel( m_pPanelDeck->GetPanel( getItemPos() ) ); - if ( pPanel.get() == nullptr ) - throw DisposedException(); - return pPanel->GetDisplayName(); - } - - void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyBoundRectChanges() - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() ); - } - - void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ) - { - m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, - i_nLostState > -1 ? makeAny( i_nLostState ) : Any(), - i_nGainedState > -1 ? makeAny( i_nGainedState ) : Any() - ); - } - - void AccessibleToolPanelDeckTabBarItem_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - (void)i_pPanel; - if ( i_nPosition <= m_nItemPos ) - ++m_nItemPos; - impl_notifyBoundRectChanges(); - } - - void AccessibleToolPanelDeckTabBarItem_Impl::PanelRemoved( const size_t i_nPosition ) - { - if ( i_nPosition == m_nItemPos ) - { - m_rAntiImpl.dispose(); - } - else if ( i_nPosition < m_nItemPos ) - { - --m_nItemPos; - impl_notifyBoundRectChanges(); - } - } - - void AccessibleToolPanelDeckTabBarItem_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( m_nItemPos == i_rOldActive ) - { - impl_notifyStateChange( AccessibleStateType::ACTIVE, -1 ); - impl_notifyStateChange( AccessibleStateType::SELECTED, -1 ); - } - else if ( m_nItemPos == i_rNewActive ) - { - impl_notifyStateChange( -1, AccessibleStateType::ACTIVE ); - impl_notifyStateChange( -1, AccessibleStateType::SELECTED ); - } - } - - void AccessibleToolPanelDeckTabBarItem_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - (void)i_rNewLayouter; - // if the tool panel deck has a new layouter, then the old layouter, and thus all items it was - // responsible for, died. So do we. - dispose(); - } - - void AccessibleToolPanelDeckTabBarItem_Impl::Dying() - { - // if the tool panel deck is dying, then its layouter dies, so should we. - dispose(); - } - - class ItemMethodGuard - { - public: - explicit ItemMethodGuard( AccessibleToolPanelDeckTabBarItem_Impl& i_rImpl ) - :m_aGuard() - { - i_rImpl.checkDisposed(); - } - ~ItemMethodGuard() - { - } - - private: - SolarMutexGuard m_aGuard; - }; - - AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos ) - : ::comphelper::OAccessibleExtendedComponentHelper( - new VCLExternalSolarLock) - , m_xImpl(new AccessibleToolPanelDeckTabBarItem_Impl(*this, - i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos)) - { - } - - AccessibleToolPanelDeckTabBarItem::~AccessibleToolPanelDeckTabBarItem() - { - } - - sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChildCount( ) throw (RuntimeException, std::exception) - { - return 0; - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException, std::exception) - { - (void)i; - throw IndexOutOfBoundsException( OUString(), *this ); - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleParent( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - return m_xImpl->getAccessibleParent(); - } - - sal_Int16 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRole( ) throw (RuntimeException, std::exception) - { - return AccessibleRole::PAGE_TAB; - } - - OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleDescription( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - return m_xImpl->getPanelDisplayName(); - } - - OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleName( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - return m_xImpl->getPanelDisplayName(); - } - - Reference< XAccessibleRelationSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRelationSet( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - ::utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper; - return pRelationSet; - } - - Reference< XAccessibleStateSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleStateSet( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - - ::utl::AccessibleStateSetHelper* pStateSet( new ::utl::AccessibleStateSetHelper ); - pStateSet->AddState( AccessibleStateType::FOCUSABLE ); - pStateSet->AddState( AccessibleStateType::SELECTABLE ); - pStateSet->AddState( AccessibleStateType::ICONIFIED ); - - if ( m_xImpl->getItemPos() == m_xImpl->getPanelDeck()->GetActivePanel() ) - { - pStateSet->AddState( AccessibleStateType::ACTIVE ); - pStateSet->AddState( AccessibleStateType::SELECTED ); - } - - if ( m_xImpl->getItemPos() == m_xImpl->getTabBar()->GetFocusedPanelItem() ) - pStateSet->AddState( AccessibleStateType::FOCUSED ); - - if ( m_xImpl->getTabBar()->IsEnabled() ) - pStateSet->AddState( AccessibleStateType::ENABLED ); - - if ( m_xImpl->getTabBar()->IsVisible() ) - { - pStateSet->AddState( AccessibleStateType::SHOWING ); - pStateSet->AddState( AccessibleStateType::VISIBLE ); - } - - return pStateSet; - } - - Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleAtPoint( const css::awt::Point& i_rLocation ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - // we do not have children ... - (void)i_rLocation; - return nullptr; - } - - void SAL_CALL AccessibleToolPanelDeckTabBarItem::grabFocus( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - m_xImpl->getTabBar()->FocusPanelItem( m_xImpl->getItemPos() ); - } - - ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getForeground( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - Reference< XAccessibleComponent > xParentComponent( m_xImpl->getParentAccessibleComponent(), UNO_SET_THROW ); - return xParentComponent->getForeground(); - } - - ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getBackground( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - Reference< XAccessibleComponent > xParentComponent( m_xImpl->getParentAccessibleComponent(), UNO_SET_THROW ); - return xParentComponent->getBackground(); - } - - Reference< XFont > SAL_CALL AccessibleToolPanelDeckTabBarItem::getFont( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - Reference< XAccessibleExtendedComponent > xParentComponent( m_xImpl->getParentAccessibleComponent(), UNO_QUERY_THROW ); - // TODO: strictly, this is not correct: The TabBar implementation of the TabLayouter might use - // a different font ... - return xParentComponent->getFont(); - } - - OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getTitledBorderText( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - // no support - return OUString(); - } - - OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getToolTipText( ) throw (RuntimeException, std::exception) - { - ItemMethodGuard aGuard( *m_xImpl ); - return m_xImpl->getPanelDisplayName(); - } - - css::awt::Rectangle AccessibleToolPanelDeckTabBarItem::implGetBounds() throw (RuntimeException) - { - ItemMethodGuard aGuard( *m_xImpl ); - - const ::Rectangle aItemScreenRect( m_xImpl->getTabBar()->GetItemScreenRect( m_xImpl->getItemPos() ) ); - - Reference< XAccessibleComponent > xParentComponent( m_xImpl->getParentAccessibleComponent(), UNO_SET_THROW ); - const css::awt::Point aParentLocation( xParentComponent->getLocationOnScreen() ); - return css::awt::Rectangle( - aItemScreenRect.Left() - aParentLocation.X, - aItemScreenRect.Top() - aParentLocation.Y, - aItemScreenRect.GetWidth(), - aItemScreenRect.GetHeight() - ); - } - - void SAL_CALL AccessibleToolPanelDeckTabBarItem::disposing() - { - ItemMethodGuard aGuard( *m_xImpl ); - m_xImpl->dispose(); - } -} // namespace accessibility - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index 450096a26b4f..45587c9ccae5 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -53,9 +53,6 @@ #include #include #include -#include -#include -#include #include #include #include @@ -203,18 +200,6 @@ public: sal_uInt16 _nColPos ) const override; - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleToolPanelDeck( - const css::uno::Reference< css::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck - ) override; - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleToolPanelTabBar( - const css::uno::Reference< css::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar - ) override; - protected: virtual ~AccessibleFactory(); }; @@ -458,18 +443,6 @@ Reference< XAccessible > AccessibleFactory::createEditBrowseBoxTableCellAccess( _rxFocusWindow, _rBrowseBox, _nRowPos, _nColPos ); } -Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelDeck( - const Reference< XAccessible >& i_rAccessibleParent, ::svt::ToolPanelDeck& i_rPanelDeck ) -{ - return new AccessibleToolPanelDeck( i_rAccessibleParent, i_rPanelDeck ); -} - -Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelTabBar( - const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) -{ - return new AccessibleToolPanelTabBar( i_rAccessibleParent, i_rPanelDeck, i_rTabBar ); -} - } // anonymous namespace #if HAVE_FEATURE_DESKTOP diff --git a/framework/source/fwe/classes/sfxhelperfunctions.cxx b/framework/source/fwe/classes/sfxhelperfunctions.cxx index 6ec7463e8eff..4926874cee64 100644 --- a/framework/source/fwe/classes/sfxhelperfunctions.cxx +++ b/framework/source/fwe/classes/sfxhelperfunctions.cxx @@ -28,7 +28,6 @@ static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = nullptr static pfunc_getRefreshToolbars pRefreshToolbars = nullptr; static pfunc_createDockingWindow pCreateDockingWindow = nullptr; static pfunc_isDockingWindowVisible pIsDockingWindowVisible = nullptr; -static pfunc_activateToolPanel pActivateToolPanel = nullptr; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; @@ -145,26 +144,6 @@ bool SAL_CALL IsDockingWindowVisible( const css::uno::Reference< css::frame::XFr return false; } -pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator ) -{ - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - pfunc_activateToolPanel pOldFunc = pActivateToolPanel; - pActivateToolPanel = i_pActivator; - return pOldFunc; -} - -void SAL_CALL ActivateToolPanel( const css::uno::Reference< css::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL ) -{ - pfunc_activateToolPanel pActivator = nullptr; - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - pActivator = pActivateToolPanel; - } - - ENSURE_OR_RETURN_VOID( pActivator, "framework::ActivateToolPanel: no activator function!" ); - (*pActivator)( i_rFrame, i_rPanelURL ); -} - using namespace ::com::sun::star; uno::Reference GetFirstListenerWith( uno::Reference const& xEventFocus, diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 1c15c9faa55b..36a2d5431460 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -1819,13 +1819,6 @@ throw (RuntimeException, std::exception) impl_setDockingWindowVisibility( xContext, xFrame, aElementName, true ); } - else if ( aElementType.equalsIgnoreAsciiCase("toolpanel")) - { - SolarMutexClearableGuard aReadGuard; - uno::Reference< frame::XFrame > xFrame( m_xFrame ); - aReadGuard.clear(); - ActivateToolPanel( m_xFrame, aName ); - } if ( bMustLayout ) doLayout(); diff --git a/include/framework/sfxhelperfunctions.hxx b/include/framework/sfxhelperfunctions.hxx index e88e1708a05a..5c39b12ebd46 100644 --- a/include/framework/sfxhelperfunctions.hxx +++ b/include/framework/sfxhelperfunctions.hxx @@ -51,10 +51,6 @@ typedef bool ( *pfunc_isDockingWindowVisible)( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL ); -typedef void ( *pfunc_activateToolPanel)( - const css::uno::Reference< css::frame::XFrame >& i_rFrame, - const OUString& i_rPanelURL ); - namespace framework { @@ -85,11 +81,6 @@ FWE_DLLPUBLIC pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( p FWE_DLLPUBLIC bool SAL_CALL IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rResourceURL ); - -FWE_DLLPUBLIC pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator ); -FWE_DLLPUBLIC void SAL_CALL ActivateToolPanel( - const css::uno::Reference< css::frame::XFrame >& i_rFrame, - const OUString& i_rPanelURL ); } #endif // INCLUDED_FRAMEWORK_SFXHELPERFUNCTIONS_HXX diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index 824a9c8624b2..9d8e8a195092 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -87,8 +87,6 @@ public: const SfxItemSet& rSet ); virtual void Invalidate(sal_uInt16 nId = 0) override; - bool IsChildWindowAvailable( const sal_uInt16 i_nId, const SfxViewFrame* i_pViewFrame ) const; - static SfxModule* GetActiveModule( SfxViewFrame* pFrame=nullptr ); static FieldUnit GetCurrentFieldUnit(); /** retrieves the field unit of the module belonging to the document displayed in the given frame diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 081b69c423fc..e288708b3f1c 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -574,7 +574,6 @@ #define SID_HYPERLINK_SETLINK (SID_SVX_START + 362) #define SID_INFOBAR (SID_SVX_START + 365) #define SID_NAVIGATOR (SID_SVX_START + 366) -#define SID_TASKPANE (SID_SVX_START + 370) #define SID_ZOOM_NEXT (SID_SVX_START + 402) #define SID_ZOOM_PREV (SID_SVX_START + 403) #define SID_INET_DLG (SID_SVX_START + 416) diff --git a/include/sfx2/taskpane.hxx b/include/sfx2/taskpane.hxx deleted file mode 100644 index 31b5e6eb0dff..000000000000 --- a/include/sfx2/taskpane.hxx +++ /dev/null @@ -1,190 +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_SFX2_TASKPANE_HXX -#define INCLUDED_SFX2_TASKPANE_HXX - -#include -#include -#include - -#include -#include - -#include - -namespace svt -{ - class ToolPanelDeck; -} - - -namespace sfx2 -{ - - - - //= ITaskPaneToolPanelAccess - - class SAL_NO_VTABLE ITaskPaneToolPanelAccess - { - public: - virtual void ActivateToolPanel( const OUString& i_rPanelURL ) = 0; - - protected: - ~ITaskPaneToolPanelAccess() {} - }; - - - //= TaskPaneWrapper - - class SFX2_DLLPUBLIC TaskPaneWrapper :public SfxChildWindow - ,public ITaskPaneToolPanelAccess - { - public: - TaskPaneWrapper( - vcl::Window* i_pParent, - sal_uInt16 i_nId, - SfxBindings* i_pBindings, - SfxChildWinInfo* i_pInfo - ); - - SFX_DECL_CHILDWINDOW( TaskPaneWrapper ); - - // ITaskPaneToolPanelAccess - virtual void ActivateToolPanel( const OUString& i_rPanelURL ) override; - }; - - - //= ModuleTaskPane - - class ModuleTaskPane_Impl; - /** SFX-less version of a module dependent task pane, filled with tool panels as specified in the respective - module's configuration - */ - class SFX2_DLLPUBLIC ModuleTaskPane : public vcl::Window - { - public: - /** creates a new instance - @param i_rParentWindow - the parent window - @param i_rDocumentFrame - the frame to which the task pane belongs. Will be passed to any custom tool panels created - via an XUIElementFactory. Also, it is used to determine the module which the task pane is - responsible for, thus controlling which tool panels are actually available. - */ - ModuleTaskPane( - vcl::Window& i_rParentWindow, - const css::uno::Reference< css::frame::XFrame >& i_rDocumentFrame - ); - virtual ~ModuleTaskPane(); - - /** determines whether a given module has any registered tool panels - */ - static bool ModuleHasToolPanels( const css::uno::Reference< css::frame::XFrame >& i_rDocumentFrame ); - - /** provides access to the Window aspect of the PanelDeck - - Be careful with this method. For instance, you're not allowed to insert arbitrary IToolPanel implementations - into the deck, as the ModuleTaskPane has certain assumptions about the panel implementations. However, - you're allowed to remove and re-insert panels, which have originally been created by the ModuleTaskPane - itself. - */ - ::svt::ToolPanelDeck& GetPanelDeck(); - const ::svt::ToolPanelDeck& GetPanelDeck() const; - - /** returns the position of the panel with the given resource URL - */ - ::boost::optional< size_t > - GetPanelPos( const OUString& i_rResourceURL ); - - /// sets the "classical" layout of the tool panel deck, using drawers - void SetDrawersLayout(); - /// sets the new layout of the tool panel deck, using tabs - void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); - - protected: - // Window overridables - virtual void Resize() override; - virtual void GetFocus() override; - - private: - std::unique_ptr m_xImpl; - }; - - - //= TaskPaneController - - class TaskPaneController_Impl; - /** is a helper class for connecting a ModuleTaskPane and a TitledDockingWindow, for clients of the ModuleTaskPane - which do not use the TaskPaneDockingWindow - - The controller will add a drop down menu to the docking window which contains one item for each panel in the - panel deck, and allows toggling their visibility. - */ - class SFX2_DLLPUBLIC TaskPaneController - { - public: - TaskPaneController( - ModuleTaskPane& i_rTaskPane, - TitledDockingWindow& i_rDockingWindow - ); - ~TaskPaneController(); - - /// activates the panel with the given URL - void ActivateToolPanel( const OUString& i_rPanelURL ); - - private: - std::unique_ptr m_xImpl; - }; - - - //= TaskPaneDockingWindow - - class TaskPaneDockingWindow :public TitledDockingWindow - ,public ITaskPaneToolPanelAccess - { - public: - TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, - vcl::Window* i_pParent, WinBits i_nBits ); - virtual ~TaskPaneDockingWindow(); - virtual void dispose() override; - - // ITaskPaneToolPanelAccess - virtual void ActivateToolPanel( const OUString& i_rPanelURL ) override; - - protected: - // Window overridables - virtual void GetFocus() override; - - // TitledDockingWindow overridables - virtual void onLayoutDone() override; - - private: - VclPtr m_aTaskPane; - TaskPaneController m_aPaneController; - }; - - -} // namespace sfx2 - - -#endif // INCLUDED_SFX2_TASKPANE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index b2bb8237ff14..5134da26edbc 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -140,8 +140,6 @@ public: void UpdateTitle(); - static void ActivateToolPanel( const css::uno::Reference< css::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL ); - // interne Handler SAL_DLLPRIVATE bool SetBorderPixelImpl( const SfxViewShell *pSh, const SvBorder &rBorder ); SAL_DLLPRIVATE const SvBorder& GetBorderPixelImpl( const SfxViewShell *pSh ) const; @@ -217,7 +215,6 @@ public: SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); SAL_DLLPRIVATE void SetCurViewId_Impl( const sal_uInt16 i_nID ); - SAL_DLLPRIVATE void ActivateToolPanel_Impl( const OUString& i_rPanelURL ); private: SAL_DLLPRIVATE bool SwitchToViewShell_Impl( sal_uInt16 nNo, bool bIsIndex = false ); diff --git a/include/svtools/accessiblefactory.hxx b/include/svtools/accessiblefactory.hxx index 6327c9735c3f..7898426803b7 100644 --- a/include/svtools/accessiblefactory.hxx +++ b/include/svtools/accessiblefactory.hxx @@ -50,8 +50,6 @@ namespace svt { - class ToolPanelDeck; - class IToolPanelDeck; class PanelTabBar; namespace table { @@ -160,18 +158,6 @@ namespace svt sal_uInt16 _nColPos ) const = 0; - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleToolPanelDeck( - const css::uno::Reference< css::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::ToolPanelDeck& i_rPanelDeck - ) = 0; - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleToolPanelTabBar( - const css::uno::Reference< css::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, - ::svt::PanelTabBar& i_rTabBar - ) = 0; - protected: virtual ~IAccessibleFactory() {} }; diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index 570809b61ec3..f04fb3e31ac2 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -161,8 +161,7 @@ // String-Ids for accessibility #define STR_SVT_ACC_BEGIN (STR_SVT_COLLATE_END+1) -#define STR_SVT_TOOL_PANEL_BUTTON_FWD (STR_SVT_ACC_BEGIN+0) -#define STR_SVT_TOOL_PANEL_BUTTON_BACK (STR_SVT_ACC_BEGIN+1) +// free #define STR_SVT_ACC_DESC_TABLISTBOX (STR_SVT_ACC_BEGIN+2) #define STR_SVT_ACC_DESC_FILEVIEW (STR_SVT_ACC_BEGIN+3) #define STR_SVT_ACC_DESC_FOLDER (STR_SVT_ACC_BEGIN+4) @@ -259,9 +258,6 @@ #define RID_IMG_TREENODE_COLLAPSED (RID_SVTOOLS_START + 0) #define RID_IMG_TREENODE_EXPANDED (RID_SVTOOLS_START + 1) -#define IMG_TRIANGLE_RIGHT (RID_SVTOOLS_START + 18) -#define IMG_TRIANGLE_DOWN (RID_SVTOOLS_START + 20) - #define IMG_SVT_FOLDER (RID_SVTOOLS_START + 42) #define IMG_SVT_FOLDER_OPEN (RID_SVTOOLS_START + 43) diff --git a/include/svtools/toolpanel/decklayouter.hxx b/include/svtools/toolpanel/decklayouter.hxx deleted file mode 100644 index 04de02cee180..000000000000 --- a/include/svtools/toolpanel/decklayouter.hxx +++ /dev/null @@ -1,100 +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_TOOLPANEL_DECKLAYOUTER_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_DECKLAYOUTER_HXX - -#include - -#include -#include - -#include - -namespace com { namespace sun { namespace star { namespace accessibility { - class XAccessible; -} } } } -class Rectangle; -class Point; - - -namespace svt -{ - - - - //= IDeckLayouter - - class IDeckLayouter : public salhelper::SimpleReferenceObject - { - public: - /** re-arranges the elements of the tool deck, taking into account the - available space for the complete deck. - - @param i_rDeckPlayground - the playground for the complete tool panel deck - @return - the content area for a single tool panel - */ - virtual ::Rectangle Layout( const ::Rectangle& i_rDeckPlayground ) = 0; - - /** destroys the instance - - Since the layouter is ref-counted, but might keep references to non-ref-counted objects - (in particular, the ToolPanelDeck, which is a VCL-Window, and thus cannot be ref-counted), - Destroy is the definitive way to dispose the instance. Technically, it's still alive afterwards, - but non-functional. - */ - virtual void Destroy() = 0; - - /** assuming that a layouter needs to provide some kind of panel selector control, this method - requests to set the focus to this control. - */ - virtual void SetFocusToPanelSelector() = 0; - - /** returns the number of components in the XAccessible hierarchy which are needed to represent all elements - the layouter is responsible form. - - Note that the implementation must guarantee that the count is fixed over the life time of the layouter. - */ - virtual size_t GetAccessibleChildCount() const = 0; - - /** retrieves the XAccessible implementation for the i_nChildIndex'th child in the XAccessible - hierarchy. - */ - virtual css::uno::Reference< css::accessibility::XAccessible > - GetAccessibleChild( - const size_t i_nChildIndex, - const css::uno::Reference< css::accessibility::XAccessible >& i_rParentAccessible - ) = 0; - - virtual ~IDeckLayouter() - { - } - }; - - typedef ::rtl::Reference< IDeckLayouter > PDeckLayouter; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_DECKLAYOUTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/toolpanel/drawerlayouter.hxx b/include/svtools/toolpanel/drawerlayouter.hxx deleted file mode 100644 index 0e123be0b499..000000000000 --- a/include/svtools/toolpanel/drawerlayouter.hxx +++ /dev/null @@ -1,88 +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_TOOLPANEL_DRAWERLAYOUTER_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_DRAWERLAYOUTER_HXX - -#include -#include -#include - -#include - - -namespace svt -{ - class ToolPanelViewShell; - class ToolPanelDrawer; - - //= ToolPanelDrawer - - /** a class which implements a tool panel selector in the form of the classical drawers - */ - class SVT_DLLPUBLIC DrawerDeckLayouter :public IDeckLayouter - ,public IToolPanelDeckListener - { - public: - DrawerDeckLayouter( - vcl::Window& i_rParentWindow, - IToolPanelDeck& i_rPanels - ); - virtual ~DrawerDeckLayouter(); - - // IDeckLayouter - virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ) override; - virtual void Destroy() override; - virtual void SetFocusToPanelSelector() override; - virtual size_t GetAccessibleChildCount() const override; - virtual css::uno::Reference< css::accessibility::XAccessible > - GetAccessibleChild( - const size_t i_nChildIndex, - const css::uno::Reference< css::accessibility::XAccessible >& i_rParentAccessible - ) override; - - // IToolPanelDeckListener - virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual void PanelRemoved( const size_t i_nPosition ) override; - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) override; - virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) override; - virtual void Dying() override; - - private: - // triggers a re-arrange of the panel deck elements - void impl_triggerRearrange() const; - size_t impl_getPanelPositionFromWindow( const vcl::Window* i_pDrawerWindow ) const; - void impl_removeDrawer( const size_t i_nPosition ); - - DECL_LINK_TYPED( OnWindowEvent, VclWindowEvent&, void ); - -private: - vcl::Window& m_rParentWindow; - IToolPanelDeck& m_rPanelDeck; - ::std::vector< VclPtr > m_aDrawers; - ::boost::optional< size_t > m_aLastKnownActivePanel; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_DRAWERLAYOUTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/toolpanel/paneltabbar.hxx b/include/svtools/toolpanel/paneltabbar.hxx deleted file mode 100644 index 84f8a0cce95d..000000000000 --- a/include/svtools/toolpanel/paneltabbar.hxx +++ /dev/null @@ -1,97 +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_TOOLPANEL_PANELTABBAR_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_PANELTABBAR_HXX - -#include -#include -#include - -#include - -#include -#include - -class PushButton; - - -namespace svt -{ - - - class PanelTabBar_Impl; - class IToolPanelDeck; - - - //= PanelTabBar - - /** a tab bar for selecting panels - - At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal - layout in the future. - */ - class SVT_DLLPUBLIC PanelTabBar : public Control - { - public: - PanelTabBar( vcl::Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); - virtual ~PanelTabBar(); - virtual void dispose() override; - - // attribute access - TabItemContent GetTabItemContent() const; - void SetTabItemContent( const TabItemContent& i_eItemContent ); - - ::boost::optional< size_t > GetFocusedPanelItem() const; - void FocusPanelItem( const size_t i_nItemPos ); - Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; - bool IsVertical() const; - IToolPanelDeck& GetPanelDeck() const; - PushButton& GetScrollButton( const bool i_bForward ); - - // Window overridables - virtual Size GetOptimalSize() const override; - - protected: - // Window overridables - virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& i_rRect ) override; - virtual void Resize() override; - virtual void MouseMove( const MouseEvent& i_rMouseEvent ) override; - virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ) override; - virtual void MouseButtonUp( const MouseEvent& i_rMouseEvent ) override; - virtual void RequestHelp( const HelpEvent& i_rHelpEvent ) override; - virtual void GetFocus() override; - virtual void LoseFocus() override; - virtual void KeyInput( const KeyEvent& i_rKeyEvent ) override; - virtual void DataChanged( const DataChangedEvent& i_rDataChanedEvent ) override; - - virtual css::uno::Reference< css::awt::XWindowPeer > - GetComponentInterface( bool i_bCreate ) override; - - private: - ::std::unique_ptr< PanelTabBar_Impl > m_pImpl; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_PANELTABBAR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/toolpanel/tabalignment.hxx b/include/svtools/toolpanel/tabalignment.hxx deleted file mode 100644 index e75ffb83339f..000000000000 --- a/include/svtools/toolpanel/tabalignment.hxx +++ /dev/null @@ -1,42 +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_TOOLPANEL_TABALIGNMENT_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_TABALIGNMENT_HXX - - -namespace svt -{ - - - enum TabAlignment - { - TABS_LEFT, - TABS_RIGHT, - TABS_TOP, - TABS_BOTTOM - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_TABALIGNMENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/toolpanel/tabitemcontent.hxx b/include/svtools/toolpanel/tabitemcontent.hxx deleted file mode 100644 index 5198cdd349f7..000000000000 --- a/include/svtools/toolpanel/tabitemcontent.hxx +++ /dev/null @@ -1,43 +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_TOOLPANEL_TABITEMCONTENT_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_TABITEMCONTENT_HXX - - -namespace svt -{ - - - enum TabItemContent - { - TABITEM_IMAGE_AND_TEXT, - TABITEM_IMAGE_ONLY, - TABITEM_TEXT_ONLY, - - TABITEM_AUTO - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_TABITEMCONTENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/toolpanel/tablayouter.hxx b/include/svtools/toolpanel/tablayouter.hxx deleted file mode 100644 index 6bcb4a3f3baf..000000000000 --- a/include/svtools/toolpanel/tablayouter.hxx +++ /dev/null @@ -1,94 +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_TOOLPANEL_TABLAYOUTER_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_TABLAYOUTER_HXX - -#include -#include -#include -#include -#include - -#include - -namespace vcl { class Window; } - - -namespace svt -{ - - - class IToolPanelDeck; - - struct TabDeckLayouter_Data; - - - //= TabDeckLayouter - - class SVT_DLLPUBLIC TabDeckLayouter :public IDeckLayouter - { - TabDeckLayouter(const TabDeckLayouter&) = delete; - TabDeckLayouter& operator=( const TabDeckLayouter& ) = delete; - public: - /** creates a new layouter - @param i_rParent - is the parent window for any VCL windows the layouter needs to create. - @param i_rPanels - is the panel deck which the layouter is responsible for. - @param i_eAlignment - specifies the alignment of the panel selector - @param TabItemContent - specifies the content to show on the tab items - */ - TabDeckLayouter( - vcl::Window& i_rParent, - IToolPanelDeck& i_rPanels, - const TabAlignment i_eAlignment, - const TabItemContent i_eItemContent - ); - virtual ~TabDeckLayouter(); - - // attribute access - TabItemContent GetTabItemContent() const; - void SetTabItemContent( const TabItemContent& i_eItemContent ); - TabAlignment GetTabAlignment() const; - - // IDeckLayouter - virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ) override; - virtual void Destroy() override; - virtual void SetFocusToPanelSelector() override; - virtual size_t GetAccessibleChildCount() const override; - virtual css::uno::Reference< css::accessibility::XAccessible > - GetAccessibleChild( - const size_t i_nChildIndex, - const css::uno::Reference< css::accessibility::XAccessible >& i_rParentAccessible - ) override; - - private: - ::std::unique_ptr< TabDeckLayouter_Data > m_pData; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_TABLAYOUTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/toolpanel/toolpanel.hxx b/include/svtools/toolpanel/toolpanel.hxx deleted file mode 100644 index e2c9aef2161a..000000000000 --- a/include/svtools/toolpanel/toolpanel.hxx +++ /dev/null @@ -1,134 +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_TOOLPANEL_TOOLPANEL_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANEL_HXX - -#include -#include - -#include -#include -#include - -class Rectangle; -namespace vcl { class Window; } -namespace com { namespace sun { namespace star { namespace accessibility { - class XAccessible; -} } } } - - -namespace svt -{ - - - - //= IToolPanel - - /** abstract interface for a single tool panel - */ - class SVT_DLLPUBLIC IToolPanel : public salhelper::SimpleReferenceObject - { - public: - /// retrieves the display name of the panel - virtual OUString GetDisplayName() const = 0; - - /// retrieves the image associated with the panel, if any - virtual Image GetImage() const = 0; - - /// retrieves the help ID associated with the panel, if any. - virtual OString GetHelpID() const = 0; - - /** activates the panel - - Usually, this means the panel's Window is created (if not previosly done so) and shown. - - @param i_rParentWindow - the parent window to anchor the panel window at. Subsequent calls to the Activate - method will always get the same parent window. The complete area of this window is - available, and should be used, for the panel window. - */ - virtual void Activate( vcl::Window& i_rParentWindow ) = 0; - - /** deactivates the panel - - There are different ways how an implementation could deactivate a panel. The easiest way - would be to simply hide the associated Window. Alternatively, you could completely destroy it, - or decide to cache it by re-parenting it to another (temporary, invisible) window. - */ - virtual void Deactivate() = 0; - - /** sets a new size for the panel's Window - - The panel window is always expected to be positioned at (0,0), relative to the parent window - which was passed to the Activate member. Resizing the panel window is necessary when the size of - this parent window changes. Effectively, this method is a means of convenience, to relief panel - implementations from reacting on size changes of their parent window themselves. - */ - virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0; - - /// sets the focus to the panel window - virtual void GrabFocus() = 0; - - /** release any resources associated with the panel. - - In particular, implementations should ultimately destroy the VCL window which implements the panel - window. No subsequent calls to any other method will happen after Destroy has been called. - */ - virtual void Dispose() = 0; - - /** creates an XAccessible for the tool panel - - Implementations are allowed to create a new instance each time this method is called, the caller - is responsible for caching the XAccessible implementation, if this is desired. - */ - virtual css::uno::Reference< css::accessibility::XAccessible > - CreatePanelAccessible( - const css::uno::Reference< css::accessibility::XAccessible >& i_rParentAccessible - ) = 0; - - virtual ~IToolPanel() - { - } - }; - - typedef ::rtl::Reference< IToolPanel > PToolPanel; - - - //= ToolPanelBase - - /** base class for tool panel implementations, adding ref count implementation to the IToolPanel interface, - but still being abstract - */ - class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel - { - ToolPanelBase(const ToolPanelBase&) = delete; - ToolPanelBase& operator=( const ToolPanelBase& ) = delete; - protected: - ToolPanelBase(); - virtual ~ToolPanelBase(); - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANEL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/toolpanel/toolpaneldeck.hxx b/include/svtools/toolpanel/toolpaneldeck.hxx deleted file mode 100644 index fb1e9de24ab1..000000000000 --- a/include/svtools/toolpanel/toolpaneldeck.hxx +++ /dev/null @@ -1,185 +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_TOOLPANEL_TOOLPANELDECK_HXX -#define INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANELDECK_HXX - -#include -#include -#include - -#include - -#include -#include - - -namespace svt -{ - - - class ToolPanelCollection; - class ToolPanelDeck_Impl; - - - //= IToolPanelDeckListener - - class SAL_NO_VTABLE IToolPanelDeckListener - { - public: - /** called when a panel has been inserted into the deck - */ - virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; - - /** called when a panel has been removed from the deck - */ - virtual void PanelRemoved( const size_t i_nPosition ) = 0; - - /** called when the active panel of the deck changed - */ - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) = 0; - - /** called when a new layouter has been set at a tool panel deck. - - The method is called after the old layouter has been disposed (i.e. its Destroy method has been - invoked), and after the complete deck has been re-layouter. - */ - virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) = 0; - - /** called when the tool panel deck which the listener registered at is dying. The listener is required to - release all references to the deck then. - */ - virtual void Dying() = 0; - - protected: - ~IToolPanelDeckListener() {} - }; - - - //= IToolPanelDeck - - class SVT_DLLPUBLIC IToolPanelDeck - { - public: - /** returns the number of panels in the container - */ - virtual size_t GetPanelCount() const = 0; - - /** retrieves the panel with the given index. Invalid indexes will be reported via an assertion in the - non-product version, and silently ignored in the product version, with a NULL panel being returned. - */ - virtual PToolPanel GetPanel( const size_t i_nPos ) const = 0; - - /** returns the number of the currently active panel. - */ - virtual ::boost::optional< size_t > - GetActivePanel() const = 0; - - /** activates the panel with the given number. If the given number is larger or equal to the number of panels - in the deck, this will be reported via an assertion in non-product builds, and otherwise ignored. - @param i_rPanel - the number of the panel to activate. If this is not set, the currently active panel is de-activated, - and no new panel is activated at all. Whether or not this makes sense for your application is at - your own discretion. - */ - virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) = 0; - - /** inserts a new panel into the container. NULL panels are not allowed, as are positions greater than the - current panel count. Violations of this will be reported via an assertion in the non-product version, and - silently ignored in the product version. - */ - virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) = 0; - - /** removes a panel specified by its position. - - Note: It is the responsibility of the caller to ensure that the panel is destroyed appropriately. That is, - the tool panel deck will not invoke IToolPanel::Dispose on the removed panel. - The advantage is that the panel might be re-used later, with the disadvantage that the owner of the panel - deck must know whether Dispose must be invoked after removal, or whether the panel will properly - dispose itself when its ref count drops to 0. - */ - virtual PToolPanel RemovePanel( const size_t i_nPosition ) = 0; - - /** adds a new listener to be notified when the container content changes. The caller is responsible - for life time control, i.e. removing the listener before it actually dies. - */ - virtual void AddListener( IToolPanelDeckListener& i_rListener ) = 0; - - /** removes a container listener previously added via addListener. - */ - virtual void RemoveListener( IToolPanelDeckListener& i_rListener ) = 0; - - protected: - ~IToolPanelDeck() {} - }; - - - //= ToolPanelDeck - - class SVT_DLLPUBLIC ToolPanelDeck :public Control - ,public IToolPanelDeck - { - public: - ToolPanelDeck( vcl::Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL ); - virtual ~ToolPanelDeck(); - virtual void dispose() override; - - // attributes - PDeckLayouter GetLayouter() const; - void SetLayouter( const PDeckLayouter& i_pNewLayouter ); - - /** returns the window which acts as anchor for the panel windows. - - This is a single dedicated window, which is passed to the IToolPanel::ActivatePanel method - whenever a panel is activated, to act as parent window for the panel's VCL-Window. - */ - vcl::Window& GetPanelWindowAnchor(); - const vcl::Window& GetPanelWindowAnchor() const; - - // IToolPanelDeck - virtual size_t GetPanelCount() const override; - virtual PToolPanel GetPanel( const size_t i_nPos ) const override; - virtual ::boost::optional< size_t > - GetActivePanel() const override; - virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) override; - virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual PToolPanel RemovePanel( const size_t i_nPosition ) override; - virtual void AddListener( IToolPanelDeckListener& i_rListener ) override; - virtual void RemoveListener( IToolPanelDeckListener& i_rListener ) override; - - protected: - // Window overridables - virtual void Resize() override; - virtual bool Notify( NotifyEvent& i_rNotifyEvent ) override; - virtual void GetFocus() override; - - virtual css::uno::Reference< css::awt::XWindowPeer > - GetComponentInterface( bool i_bCreate ) override; - - private: - ::std::unique_ptr< ToolPanelDeck_Impl > m_pImpl; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANELDECK_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 7ae2dddbdba2..f7e7e8b6893c 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -3882,11 +3882,6 @@ 9 - - - Task Pane - - Sidebar diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 455bacc4fa82..86e21175dd09 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -193,7 +192,6 @@ void ScDLL::Init() ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod ); // Common SFX Controller - ::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod ); ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); // SvxStatusBar Controller diff --git a/sd/sdi/ViewShellBase.sdi b/sd/sdi/ViewShellBase.sdi index 0f1bcb8f4fb2..7996781220f8 100644 --- a/sd/sdi/ViewShellBase.sdi +++ b/sd/sdi/ViewShellBase.sdi @@ -32,11 +32,6 @@ interface ViewShellBaseView ExecMethod = Execute; StateMethod = GetState; ] - SID_TASKPANE - [ - ExecMethod = Execute; - StateMethod = GetState; - ] SID_NOTES_WINDOW [ ExecMethod = Execute; diff --git a/sd/source/ui/inc/PaneChildWindows.hxx b/sd/source/ui/inc/PaneChildWindows.hxx index 09c0e566a36d..6495d93aeb3d 100644 --- a/sd/source/ui/inc/PaneChildWindows.hxx +++ b/sd/source/ui/inc/PaneChildWindows.hxx @@ -21,7 +21,6 @@ #define INCLUDED_SD_SOURCE_UI_INC_PANECHILDWINDOWS_HXX #include -#include namespace sd { diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx index fec98e780c9b..a3926ddf3249 100644 --- a/sd/source/ui/view/GraphicViewShellBase.cxx +++ b/sd/source/ui/view/GraphicViewShellBase.cxx @@ -82,7 +82,6 @@ void GraphicViewShellBase::Execute (SfxRequest& rRequest) rRequest.Cancel(); break; - case SID_TASKPANE: case SID_SWITCH_SHELL: case SID_LEFT_PANE_DRAW: case SID_LEFT_PANE_IMPRESS: diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk index 6513e1cbdc83..8f4185817c64 100644 --- a/sfx2/AllLangResTarget_sfx2.mk +++ b/sfx2/AllLangResTarget_sfx2.mk @@ -45,7 +45,6 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\ sfx2/source/dialog/filedlghelper.src \ sfx2/source/dialog/newstyle.src \ sfx2/source/dialog/recfloat.src \ - sfx2/source/dialog/taskpane.src \ sfx2/source/dialog/templdlg.src \ sfx2/source/dialog/versdlg.src \ sfx2/source/doc/doc.src \ diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 420a3c7cb104..75be117a025f 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -192,7 +192,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/dialog/styfitem \ sfx2/source/dialog/styledlg \ sfx2/source/dialog/tabdlg \ - sfx2/source/dialog/taskpane \ sfx2/source/dialog/templateinfodlg \ sfx2/source/dialog/templdlg \ sfx2/source/dialog/titledockwin \ diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx index 2365943cd652..81edabab29df 100644 --- a/sfx2/inc/pch/precompiled_sfx.hxx +++ b/sfx2/inc/pch/precompiled_sfx.hxx @@ -401,7 +401,6 @@ #include #include #include -#include #include #include #include @@ -527,7 +526,6 @@ #include #include #include -#include #include #include #include diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 2aa874adf32a..f1c4d84cacc7 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -41,11 +41,6 @@ interface Window ExecMethod = ChildWindowExecute ; StateMethod = ChildWindowState ; ] - SID_TASKPANE // status(final|play) - [ - ExecMethod = ChildWindowExecute ; - StateMethod = ChildWindowState ; - ] SID_SIDEBAR // status(final|play) [ ExecMethod = ChildWindowExecute ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 92266bc143eb..8bbf40ea7a11 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3546,32 +3546,6 @@ SfxBoolItem InfoBar SID_INFOBAR GroupId = GID_DOCUMENT; ] -SfxBoolItem TaskPane SID_TASKPANE -[ - /* flags: */ - AutoUpdate = TRUE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Asynchron; - - Readonly = FALSE, - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_VIEW; -] - - SfxBoolItem Sidebar SID_SIDEBAR [ /* flags: */ diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index aaba69dcc98f..555a62f61dac 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -168,7 +168,6 @@ SfxApplication* SfxApplication::GetOrCreate() ::framework::SetStatusBarControllerCreator( SfxStatusBarControllerFactory ); ::framework::SetDockingWindowCreator( SfxDockingWindowFactory ); ::framework::SetIsDockingWindowVisible( IsDockingWindowVisible ); - ::framework::SetActivateToolPanel( &SfxViewFrame::ActivateToolPanel ); #if HAVE_FEATURE_DESKTOP Application::SetHelp( pSfxHelp ); if (!utl::ConfigManager::IsAvoidConfig() && SvtHelpOptions().IsHelpTips()) diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index fb04a9dcfa8e..a77744082c55 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include "partwnd.hxx" diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 9d46fbf4208e..5e2e7ad44c8e 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -363,17 +362,6 @@ void SfxModule::Invalidate( sal_uInt16 nId ) Invalidate_Impl( pFrame->GetBindings(), nId ); } -bool SfxModule::IsChildWindowAvailable( const sal_uInt16 i_nId, const SfxViewFrame* i_pViewFrame ) const -{ - if ( i_nId != SID_TASKPANE ) - // by default, assume it is - return true; - - const SfxViewFrame* pViewFrame = i_pViewFrame ? i_pViewFrame : GetFrame(); - ENSURE_OR_RETURN( pViewFrame, "SfxModule::IsChildWindowAvailable: no frame to ask for the module identifier!", false ); - return ::sfx2::ModuleTaskPane::ModuleHasToolPanels( pViewFrame->GetFrame().GetFrameInterface() ); -} - SfxModule* SfxModule::GetActiveModule( SfxViewFrame* pFrame ) { if ( !pFrame ) diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index e1e7e1cd08fc..eb91b2c62e43 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -1335,16 +1335,6 @@ void SfxWorkWindow::UpdateObjectBars_Impl() } } -bool SfxWorkWindow::AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const -{ - // or checking the availability of child windows, we need access to the module - const SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); - const SfxObjectShell* pShell = pViewFrame ? pViewFrame->GetObjectShell() : nullptr; - const SfxModule* pModule = pShell ? pShell->GetModule() : nullptr; - ENSURE_OR_RETURN( pModule, "SfxWorkWindow::UpdateChildWindows_Impl: did not find an SfxModule to ask for the child win availability!", true ); - return pModule->IsChildWindowAvailable( i_rCW.nId, pViewFrame ); -} - void SfxWorkWindow::UpdateChildWindows_Impl() { // any current or in the context available Childwindows @@ -1378,9 +1368,6 @@ void SfxWorkWindow::UpdateChildWindows_Impl() else bCreate = true; - if ( bCreate ) - bCreate = AllowChildWindowCreation_Impl( *pCW ); - // Currently, no window here, but it is enabled; windows // Create window and if possible theContext if ( bCreate ) @@ -1398,25 +1385,21 @@ void SfxWorkWindow::UpdateChildWindows_Impl() if ( ( !bIsFullScreen || pChildWin->GetAlignment() == SfxChildAlignment::NOALIGNMENT ) && bAllChildrenVisible ) { // Update Mode is compatible; definitely enable it - bCreate = AllowChildWindowCreation_Impl( *pCW ); - if ( bCreate ) + if ( pCW->pCli ) { - if ( pCW->pCli ) - { - // The window is a direct Child - if ( bAllChildrenVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SfxChildAlignment::NOALIGNMENT ) ) - pCW->pCli->nVisible |= SfxChildVisibility::NOT_HIDDEN; - } - else - { - if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed ) - // The window ia within a SplitWindow - static_cast(pChildWin->GetWindow())->Reappear_Impl(); - } - - if ( pCW->nInterfaceId != pChildWin->GetContextId() ) - pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); + // The window is a direct Child + if ( bAllChildrenVisible && ( (IsDockingAllowed() && bInternalDockingAllowed) || pCW->pCli->eAlign == SfxChildAlignment::NOALIGNMENT ) ) + pCW->pCli->nVisible |= SfxChildVisibility::NOT_HIDDEN; } + else + { + if ( pCW->bCreate && IsDockingAllowed() && bInternalDockingAllowed ) + // The window ia within a SplitWindow + static_cast(pChildWin->GetWindow())->Reappear_Impl(); + } + + if ( pCW->nInterfaceId != pChildWin->GetContextId() ) + pChildWin->CreateContext( pCW->nInterfaceId, GetBindings() ); } } } @@ -1961,7 +1944,7 @@ void SfxWorkWindow::ToggleChildWindow_Impl(sal_uInt16 nId, bool bSetFocus) } else { - pCW->bCreate = AllowChildWindowCreation_Impl( *pCW ); + pCW->bCreate = true; if ( pCW->bCreate ) { if ( pChild ) diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index 83e258949adb..a3ed837987c8 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -93,10 +93,6 @@ String SID_NAVIGATOR { Text [ en-US ] = "Navigator"; }; -String SID_TASKPANE -{ - Text [ en-US ] = "Task Pane"; -}; String SID_SIDEBAR { Text [ en-US ] = "Sidebar"; diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx deleted file mode 100644 index 434e986c9274..000000000000 --- a/sfx2/source/dialog/taskpane.cxx +++ /dev/null @@ -1,1242 +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 -#include -#include -#include -#include -#include -#include "sfxlocal.hrc" -#include "helpid.hrc" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace sfx2 -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::frame::ModuleManager; - using ::com::sun::star::frame::XModuleManager2; - using ::com::sun::star::container::XNameAccess; - using ::com::sun::star::ui::XToolPanel; - using ::com::sun::star::ui::XUIElementFactory; - using ::com::sun::star::ui::XUIElementFactoryManager; - using ::com::sun::star::ui::theUIElementFactoryManager; - using ::com::sun::star::ui::XUIElement; - using ::com::sun::star::awt::XWindow; - using ::com::sun::star::frame::XFrame; - using ::com::sun::star::lang::XComponent; - using ::com::sun::star::graphic::XGraphicProvider; - using ::com::sun::star::graphic::XGraphic; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::awt::XControl; - - namespace PosSize = ::com::sun::star::awt::PosSize; - - - //= helpers - - namespace - { - - ::utl::OConfigurationTreeRoot lcl_getModuleUIElementStatesConfig( const OUString& i_rModuleIdentifier, - const OUString& i_rResourceURL = OUString() ) - { - const Reference xContext( ::comphelper::getProcessComponentContext() ); - OUStringBuffer aPathComposer; - try - { - const Reference< XModuleManager2 > xModuleAccess( ModuleManager::create(xContext) ); - const ::comphelper::NamedValueCollection aModuleProps( xModuleAccess->getByName( i_rModuleIdentifier ) ); - - const OUString sWindowStateRef( aModuleProps.getOrDefault( "ooSetupFactoryWindowStateConfigRef", OUString() ) ); - - aPathComposer.append( "org.openoffice.Office.UI." ); - aPathComposer.append( sWindowStateRef ); - aPathComposer.append( "/UIElements/States" ); - if ( !i_rResourceURL.isEmpty() ) - { - aPathComposer.append('/').append( i_rResourceURL ); - } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return ::utl::OConfigurationTreeRoot( xContext, aPathComposer.makeStringAndClear(), false ); - } - - - OUString lcl_identifyModule( const Reference< XFrame >& i_rDocumentFrame ) - { - OUString sModuleName; - try - { - const Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - const Reference< XModuleManager2 > xModuleManager( ModuleManager::create(xContext) ); - sModuleName = xModuleManager->identify( i_rDocumentFrame ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return sModuleName; - } - - - Reference< XFrame > lcl_getFrame( const SfxBindings* i_pBindings ) - { - const SfxViewFrame* pViewFrame = i_pBindings->GetDispatcher()->GetFrame(); - const SfxFrame& rFrame = pViewFrame->GetFrame(); - const Reference< XFrame > xFrame( rFrame.GetFrameInterface() ); - return xFrame; - } - - - OUString lcl_getPanelHelpURL( const ::utl::OConfigurationNode& i_rPanelConfigNode ) - { - const OUString sHelpURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "HelpURL" ) ) ); - return sHelpURL; - } - - - Image lcl_getPanelImage( const Reference< XFrame >& i_rDocFrame, const ::utl::OConfigurationNode& i_rPanelConfigNode ) - { - const OUString sImageURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "ImageURL" ) ) ); - if ( !sImageURL.isEmpty() ) - { - try - { - ::comphelper::NamedValueCollection aMediaProperties; - aMediaProperties.put( "URL", sImageURL ); - - // special handling: if the ImageURL denotes a CommandName, then retrieve the image for that command - static const sal_Char pCommandImagePrefix[] = "private:commandimage/"; - const sal_Int32 nCommandImagePrefixLen = strlen( pCommandImagePrefix ); - if ( sImageURL.startsWith( pCommandImagePrefix ) ) - { - OUStringBuffer aCommandName; - aCommandName.append( ".uno:" ); - aCommandName.append( sImageURL.copy( nCommandImagePrefixLen ) ); - const OUString sCommandName( aCommandName.makeStringAndClear() ); - - const Image aPanelImage( GetImage( i_rDocFrame, sCommandName, false ) ); - return aPanelImage; - } - - // otherwise, delegate to the GraphicProvider - const Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - const Reference< XGraphicProvider > xGraphicProvider( css::graphic::GraphicProvider::create(xContext) ); - - const Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_SET_THROW ); - return Image( xGraphic ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - return Image(); - } - } - - - //= TaskPaneDockingWindow - - - TaskPaneDockingWindow::TaskPaneDockingWindow( SfxBindings* i_pBindings, TaskPaneWrapper& i_rWrapper, vcl::Window* i_pParent, WinBits i_nBits ) - :TitledDockingWindow( i_pBindings, &i_rWrapper, i_pParent, i_nBits ) - ,m_aTaskPane( VclPtr::Create(GetContentWindow(), lcl_getFrame( i_pBindings )) ) - ,m_aPaneController( *m_aTaskPane.get(), *this ) - { - m_aTaskPane->Show(); - SetText( SfxResId( SID_TASKPANE ).toString() ); - } - - TaskPaneDockingWindow::~TaskPaneDockingWindow() - { - disposeOnce(); - } - - void TaskPaneDockingWindow::dispose() - { - m_aTaskPane.disposeAndClear(); - TitledDockingWindow::dispose(); - } - - - void TaskPaneDockingWindow::ActivateToolPanel( const OUString& i_rPanelURL ) - { - m_aPaneController.ActivateToolPanel( i_rPanelURL ); - } - - - void TaskPaneDockingWindow::GetFocus() - { - TitledDockingWindow::GetFocus(); - m_aTaskPane->GrabFocus(); - } - - - void TaskPaneDockingWindow::onLayoutDone() - { - m_aTaskPane->SetPosSizePixel( Point(), GetContentWindow().GetOutputSizePixel() ); - } - - - //= TaskPaneWrapper - - - SFX_IMPL_DOCKINGWINDOW( TaskPaneWrapper, SID_TASKPANE ); - - - TaskPaneWrapper::TaskPaneWrapper( vcl::Window* i_pParent, sal_uInt16 i_nId, SfxBindings* i_pBindings, SfxChildWinInfo* i_pInfo ) - :SfxChildWindow( i_pParent, i_nId ) - { - SetWindow(VclPtr::Create( i_pBindings, *this, i_pParent, - WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE)); - SetAlignment(SfxChildAlignment::RIGHT); - - vcl::Window& rWindow = *GetWindow(); - - rWindow.SetHelpId( HID_TASKPANE_WINDOW ); - rWindow.SetOutputSizePixel( Size( 300, 450 ) ); - - dynamic_cast(rWindow).Initialize(i_pInfo); - SetHideNotDelete( true ); - - rWindow.Show(); - } - - void TaskPaneWrapper::ActivateToolPanel( const OUString& i_rPanelURL ) - { - TaskPaneDockingWindow* pDockingWindow = dynamic_cast< TaskPaneDockingWindow* >( GetWindow() ); - ENSURE_OR_RETURN_VOID( pDockingWindow, "TaskPaneWrapper::ActivateToolPanel: invalid docking window implementation!" ); - pDockingWindow->ActivateToolPanel( i_rPanelURL ); - } - - - //= CustomPanelUIElement - - class CustomPanelUIElement - { - public: - CustomPanelUIElement() - :m_xUIElement() - ,m_xToolPanel() - ,m_xPanelWindow() - { - } - - explicit CustomPanelUIElement( const Reference< XUIElement >& i_rUIElement ) - :m_xUIElement( i_rUIElement ) - ,m_xToolPanel( i_rUIElement->getRealInterface(), UNO_QUERY_THROW ) - ,m_xPanelWindow( m_xToolPanel->getWindow(), UNO_SET_THROW ) - { - } - - bool is() const { return m_xPanelWindow.is(); } - - const Reference< XUIElement >& getUIElement() const { return m_xUIElement; } - const Reference< XToolPanel >& getToolPanel() const { return m_xToolPanel; } - const Reference< XWindow >& getPanelWindow() const { return m_xPanelWindow; } - - private: - Reference< XUIElement > m_xUIElement; - Reference< XToolPanel > m_xToolPanel; - Reference< XWindow > m_xPanelWindow; - }; - - - //= CustomToolPanel - - class CustomToolPanel : public ::svt::ToolPanelBase - { - public: - CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ); - - virtual OUString GetDisplayName() const override; - virtual Image GetImage() const override; - virtual OString GetHelpID() const override; - virtual void Activate( vcl::Window& i_rParentWindow ) override; - virtual void Deactivate() override; - virtual void SetSizePixel( const Size& i_rPanelWindowSize ) override; - virtual void GrabFocus() override; - virtual void Dispose() override; - virtual Reference< XAccessible > - CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) override; - - const OUString& - GetResourceURL() const { return m_sResourceURL; } - - protected: - virtual ~CustomToolPanel(); - - private: - bool impl_ensureToolPanelWindow( vcl::Window& i_rPanelParentWindow ); - void impl_updatePanelConfig( const bool i_bVisible ) const; - - private: - const OUString m_sUIName; - const Image m_aPanelImage; - const OUString m_aPanelHelpURL; - const OUString m_sResourceURL; - const OUString m_sPanelConfigPath; - Reference< XFrame > m_xFrame; - CustomPanelUIElement m_aCustomPanel; - bool m_bAttemptedCreation; - }; - - - CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState, const Reference< XFrame >& i_rFrame ) - :m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) ) - ,m_aPanelImage( lcl_getPanelImage( i_rFrame, i_rPanelWindowState ) ) - ,m_aPanelHelpURL( lcl_getPanelHelpURL( i_rPanelWindowState ) ) - ,m_sResourceURL( i_rPanelWindowState.getLocalName() ) - ,m_sPanelConfigPath( i_rPanelWindowState.getNodePath() ) - ,m_xFrame( i_rFrame ) - ,m_aCustomPanel() - ,m_bAttemptedCreation( false ) - { - } - - - CustomToolPanel::~CustomToolPanel() - { - } - - - bool CustomToolPanel::impl_ensureToolPanelWindow( vcl::Window& i_rPanelParentWindow ) - { - if ( m_bAttemptedCreation ) - return m_aCustomPanel.is(); - - m_bAttemptedCreation = true; - try - { - const Reference< XUIElementFactoryManager > xFactory = theUIElementFactoryManager::get( ::comphelper::getProcessComponentContext() ); - - ::comphelper::NamedValueCollection aCreationArgs; - aCreationArgs.put( "Frame", makeAny( m_xFrame ) ); - aCreationArgs.put( "ParentWindow", makeAny( i_rPanelParentWindow.GetComponentInterface() ) ); - - const Reference< XUIElement > xElement( - xFactory->createUIElement( m_sResourceURL, aCreationArgs.getPropertyValues() ), - UNO_SET_THROW ); - - m_aCustomPanel = CustomPanelUIElement( xElement ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return m_aCustomPanel.is(); - } - - - void CustomToolPanel::impl_updatePanelConfig( const bool i_bVisible ) const - { - ::utl::OConfigurationTreeRoot aConfig( ::comphelper::getProcessComponentContext(), m_sPanelConfigPath, true ); - - aConfig.setNodeValue( "Visible", makeAny( i_bVisible ) ); - aConfig.commit(); - } - - - OUString CustomToolPanel::GetDisplayName() const - { - return m_sUIName; - } - - - Image CustomToolPanel::GetImage() const - { - return m_aPanelImage; - } - - static OString lcl_getHelpId( const OUString& _rHelpURL ) - { - INetURLObject aHID( _rHelpURL ); - if ( aHID.GetProtocol() == INetProtocol::Hid ) - return OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ); - else - return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); - } - - - OString CustomToolPanel::GetHelpID() const - { - return lcl_getHelpId( m_aPanelHelpURL ); - } - - - void CustomToolPanel::Activate( vcl::Window& i_rParentWindow ) - { - ENSURE_OR_RETURN_VOID( impl_ensureToolPanelWindow( i_rParentWindow ), "no panel to activate!" ); - - // TODO: we might need a mechanism to decide whether the panel should be destroyed/re-created, or (as it is - // done now) hidden/shown - m_aCustomPanel.getPanelWindow()->setVisible( sal_True ); - - // update the panel's configuration - impl_updatePanelConfig( true ); - } - - - void CustomToolPanel::Deactivate() - { - ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to deactivate!" ); - - m_aCustomPanel.getPanelWindow()->setVisible( sal_False ); - - // update the panel's configuration - impl_updatePanelConfig( false ); - } - - - void CustomToolPanel::SetSizePixel( const Size& i_rPanelWindowSize ) - { - ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to position!" ); - - try - { - m_aCustomPanel.getPanelWindow()->setPosSize( 0, 0, i_rPanelWindowSize.Width(), i_rPanelWindowSize.Height(), - PosSize::POSSIZE ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - - void CustomToolPanel::GrabFocus() - { - ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel/window to focus!" ); - - m_aCustomPanel.getPanelWindow()->setFocus(); - } - - - void CustomToolPanel::Dispose() - { - if ( !m_bAttemptedCreation ) - // nothing to dispose - return; - - ENSURE_OR_RETURN_VOID( m_aCustomPanel.is(), "no panel to destroy!" ); - try - { - Reference< XComponent > xUIElementComponent( m_aCustomPanel.getUIElement(), UNO_QUERY_THROW ); - xUIElementComponent->dispose(); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - - - Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) - { - ENSURE_OR_RETURN( m_aCustomPanel.is(), "no panel to ask!", nullptr ); - - Reference< XAccessible > xPanelAccessible; - try - { - xPanelAccessible.set( m_aCustomPanel.getToolPanel()->createAccessible( i_rParentAccessible ), UNO_SET_THROW ); - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - return xPanelAccessible; - } - - - //= ModuleTaskPane_Impl - - class ModuleTaskPane_Impl : public ::boost::noncopyable - { - public: - ModuleTaskPane_Impl( ModuleTaskPane& i_rAntiImpl, const Reference< XFrame >& i_rDocumentFrame ) - :m_rAntiImpl( i_rAntiImpl ) - ,m_sModuleIdentifier( lcl_identifyModule( i_rDocumentFrame ) ) - ,m_xFrame( i_rDocumentFrame ) - ,m_aPanelDeck( VclPtr< ::svt::ToolPanelDeck>::Create(i_rAntiImpl) ) - { - m_aPanelDeck->Show(); - OnResize(); - impl_initFromConfiguration(); - } - - ~ModuleTaskPane_Impl() - { - } - - void OnResize(); - void OnGetFocus(); - - static bool ModuleHasToolPanels( const OUString& i_rModuleIdentifier ); - - ::svt::ToolPanelDeck& GetPanelDeck() { return *m_aPanelDeck.get(); } - - ::boost::optional< size_t > - GetPanelPos( const OUString& i_rResourceURL ); - - void SetDrawersLayout(); - void SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ); - - private: - void impl_initFromConfiguration(); - - static bool - impl_isToolPanelResource( const OUString& i_rResourceURL ); - - DECL_LINK_TYPED( OnActivatePanel, void*, void ); - - private: - ModuleTaskPane& m_rAntiImpl; - const OUString m_sModuleIdentifier; - const Reference< XFrame > m_xFrame; - VclPtr< ::svt::ToolPanelDeck> m_aPanelDeck; - }; - - - void ModuleTaskPane_Impl::OnResize() - { - m_aPanelDeck->SetPosSizePixel( Point(), m_rAntiImpl.GetOutputSizePixel() ); - } - - - void ModuleTaskPane_Impl::OnGetFocus() - { - m_aPanelDeck->GrabFocus(); - } - - - IMPL_LINK_TYPED( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg, void ) - { - m_aPanelDeck->ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); - } - - - bool ModuleTaskPane_Impl::impl_isToolPanelResource( const OUString& i_rResourceURL ) - { - return i_rResourceURL.startsWith( "private:resource/toolpanel/" ); - } - - - void ModuleTaskPane_Impl::impl_initFromConfiguration() - { - const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( m_sModuleIdentifier ) ); - if ( !aWindowStateConfig.isValid() ) - return; - - OUString sFirstVisiblePanelResource; - OUString sFirstPanelResource; - - const Sequence< OUString > aUIElements( aWindowStateConfig.getNodeNames() ); - for ( const OUString* resource = aUIElements.getConstArray(); - resource != aUIElements.getConstArray() + aUIElements.getLength(); - ++resource - ) - { - if ( !impl_isToolPanelResource( *resource ) ) - continue; - - sFirstPanelResource = *resource; - - ::utl::OConfigurationNode aResourceNode( aWindowStateConfig.openNode( *resource ) ); - ::svt::PToolPanel pCustomPanel( new CustomToolPanel( aResourceNode, m_xFrame ) ); - - size_t nPanelPos = m_aPanelDeck->GetPanelCount(); - m_aPanelDeck->InsertPanel( pCustomPanel, nPanelPos ); - - if ( ::comphelper::getBOOL( aResourceNode.getNodeValue( "Visible" ) ) ) - sFirstVisiblePanelResource = *resource; - } - - if ( sFirstVisiblePanelResource.isEmpty() ) - sFirstVisiblePanelResource = sFirstPanelResource; - - if ( !sFirstVisiblePanelResource.isEmpty() ) - { - ::boost::optional< size_t > aPanelPos( GetPanelPos( sFirstVisiblePanelResource ) ); - OSL_ENSURE( !!aPanelPos, "ModuleTaskPane_Impl::impl_isToolPanelResource: just inserted it, and it's not there?!" ); - if ( !!aPanelPos ) - m_rAntiImpl.PostUserEvent( LINK( this, ModuleTaskPane_Impl, OnActivatePanel ), reinterpret_cast< void* >( *aPanelPos ) ); - } - } - - - bool ModuleTaskPane_Impl::ModuleHasToolPanels( const OUString& i_rModuleIdentifier ) - { - const ::utl::OConfigurationTreeRoot aWindowStateConfig( lcl_getModuleUIElementStatesConfig( i_rModuleIdentifier ) ); - if ( !aWindowStateConfig.isValid() ) - return false; - - const Sequence< OUString > aUIElements( aWindowStateConfig.getNodeNames() ); - for ( const OUString* resource = aUIElements.getConstArray(); - resource != aUIElements.getConstArray() + aUIElements.getLength(); - ++resource - ) - { - if ( impl_isToolPanelResource( *resource ) ) - return true; - } - return false; - } - - - ::boost::optional< size_t > ModuleTaskPane_Impl::GetPanelPos( const OUString& i_rResourceURL ) - { - ::boost::optional< size_t > aPanelPos; - for ( size_t i = 0; i < m_aPanelDeck->GetPanelCount(); ++i ) - { - const ::svt::PToolPanel pPanel( m_aPanelDeck->GetPanel( i ) ); - const CustomToolPanel* pCustomPanel = dynamic_cast< const CustomToolPanel* >( pPanel.get() ); - if ( !pCustomPanel ) - { - SAL_WARN( "sfx.dialog", "ModuleTaskPane_Impl::GetPanelPos: illegal panel implementation!" ); - continue; - } - - if ( pCustomPanel->GetResourceURL() == i_rResourceURL ) - { - aPanelPos = i; - break; - } - } - return aPanelPos; - } - - void ModuleTaskPane_Impl::SetDrawersLayout() - { - const ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() ); - const ::svt::DrawerDeckLayouter* pDrawerLayouter = dynamic_cast< const ::svt::DrawerDeckLayouter* >( pLayouter.get() ); - if ( pDrawerLayouter != nullptr ) - // already have the proper layout - return; - m_aPanelDeck->SetLayouter( new ::svt::DrawerDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get() ) ); - } - - - void ModuleTaskPane_Impl::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) - { - ::svt::PDeckLayouter pLayouter( m_aPanelDeck->GetLayouter() ); - ::svt::TabDeckLayouter* pTabLayouter = dynamic_cast< ::svt::TabDeckLayouter* >( pLayouter.get() ); - if ( ( pTabLayouter != nullptr ) - && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) - && ( pTabLayouter->GetTabItemContent() == i_eTabContent ) - ) - // already have the requested layout - return; - - if ( pTabLayouter && ( pTabLayouter->GetTabAlignment() == i_eTabAlignment ) ) - { - // changing only the item content does not require a new layouter instance - pTabLayouter->SetTabItemContent( i_eTabContent ); - return; - } - - m_aPanelDeck->SetLayouter( new ::svt::TabDeckLayouter( *m_aPanelDeck.get(), *m_aPanelDeck.get(), i_eTabAlignment, i_eTabContent ) ); - } - - - //= ModuleTaskPane - - - ModuleTaskPane::ModuleTaskPane( vcl::Window& i_rParentWindow, const Reference< XFrame >& i_rDocumentFrame ) - :Window( &i_rParentWindow, WB_DIALOGCONTROL ) - ,m_xImpl( new ModuleTaskPane_Impl( *this, i_rDocumentFrame ) ) - { - } - - ModuleTaskPane::~ModuleTaskPane() - { - disposeOnce(); - } - - bool ModuleTaskPane::ModuleHasToolPanels( const Reference< XFrame >& i_rDocumentFrame ) - { - return ModuleTaskPane_Impl::ModuleHasToolPanels( lcl_identifyModule( i_rDocumentFrame ) ); - } - - - void ModuleTaskPane::Resize() - { - Window::Resize(); - m_xImpl->OnResize(); - } - - - void ModuleTaskPane::GetFocus() - { - Window::GetFocus(); - m_xImpl->OnGetFocus(); - } - - - ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck() - { - return m_xImpl->GetPanelDeck(); - } - - - const ::svt::ToolPanelDeck& ModuleTaskPane::GetPanelDeck() const - { - return m_xImpl->GetPanelDeck(); - } - - - ::boost::optional< size_t > ModuleTaskPane::GetPanelPos( const OUString& i_rResourceURL ) - { - return m_xImpl->GetPanelPos( i_rResourceURL ); - } - - - void ModuleTaskPane::SetDrawersLayout() - { - m_xImpl->SetDrawersLayout(); - } - - - void ModuleTaskPane::SetTabsLayout( const ::svt::TabAlignment i_eTabAlignment, const ::svt::TabItemContent i_eTabContent ) - { - m_xImpl->SetTabsLayout( i_eTabAlignment, i_eTabContent ); - } - - - // = PanelSelectorLayout - - enum PanelSelectorLayout - { - LAYOUT_DRAWERS, - LAYOUT_TABS_RIGHT, - LAYOUT_TABS_LEFT, - LAYOUT_TABS_TOP, - LAYOUT_TABS_BOTTOM - }; - - - //= helper - - namespace - { - PanelSelectorLayout lcl_getTabLayoutFromAlignment( const SfxChildAlignment i_eAlignment ) - { - switch ( i_eAlignment ) - { - case SfxChildAlignment::LEFT: - return LAYOUT_TABS_LEFT; - case SfxChildAlignment::TOP: - return LAYOUT_TABS_TOP; - case SfxChildAlignment::BOTTOM: - return LAYOUT_TABS_BOTTOM; - default: - return LAYOUT_TABS_RIGHT; - } - } - } - - - // = PanelDescriptor - - /** is a helper class for TaskPaneController_Impl, holding the details about a single panel which is not - contained in the IToolPanel implementation itself. - */ - struct PanelDescriptor - { - ::svt::PToolPanel pPanel; - bool bHidden; - - explicit PanelDescriptor( const ::svt::PToolPanel& i_rPanel ) - :pPanel( i_rPanel ) - ,bHidden( false ) - { - } - }; - - - //= TaskPaneController_Impl - - class TaskPaneController_Impl :public ::boost::noncopyable - ,public ::svt::IToolPanelDeckListener - { - public: - TaskPaneController_Impl( - ModuleTaskPane& i_rTaskPane, - TitledDockingWindow& i_rDockingWindow - ); - virtual ~TaskPaneController_Impl(); - - void SetDefaultTitle( const OUString& i_rTitle ); - void ActivateToolPanel( const OUString& i_rPanelURL ); - - protected: - // IToolPanelDeckListener overridables - virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual void PanelRemoved( const size_t i_nPosition ) override; - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) override; - virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) override; - virtual void Dying() override; - - private: - DECL_LINK_TYPED( OnToolboxClicked, ToolBox*, void ); - DECL_LINK_TYPED( OnMenuItemSelected, Menu*, bool ); - DECL_LINK_TYPED( DockingChanged, TitledDockingWindow*, void ); - ::std::unique_ptr< PopupMenu > impl_createPopupMenu() const; - - /// sets the given layout for the panel selector - void impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce = false ); - - /// returns the current layout of the panel selector - PanelSelectorLayout - impl_getLayout() const { return m_eCurrentLayout; } - - void impl_updateDockingWindowTitle(); - void impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex ); - size_t impl_getLogicalPanelIndex( const size_t i_nVisibleIndex ); - - private: - enum MenuId - { - MID_UNLOCK_TASK_PANEL = 1, - MID_LOCK_TASK_PANEL = 2, - MID_LAYOUT_TABS = 3, - MID_LAYOUT_DRAWERS = 4, - MID_FIRST_PANEL = 5 - }; - - private: - typedef ::std::vector< PanelDescriptor > PanelDescriptors; - - ModuleTaskPane& m_rTaskPane; - TitledDockingWindow& m_rDockingWindow; - sal_uInt16 m_nViewMenuID; - PanelSelectorLayout m_eCurrentLayout; - PanelDescriptors m_aPanelRepository; - bool m_bTogglingPanelVisibility; - OUString m_sDefaultTitle; - }; - - - TaskPaneController_Impl::TaskPaneController_Impl( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow ) - :m_rTaskPane( i_rTaskPane ) - ,m_rDockingWindow( i_rDockingWindow ) - ,m_nViewMenuID( 0 ) - ,m_eCurrentLayout( LAYOUT_DRAWERS ) - ,m_aPanelRepository() - ,m_bTogglingPanelVisibility( false ) - ,m_sDefaultTitle() - { - m_rDockingWindow.ResetToolBox(); - m_nViewMenuID = m_rDockingWindow.AddDropDownToolBoxItem( - SfxResId( STR_SFX_TASK_PANE_VIEW ).toString(), - HID_TASKPANE_VIEW_MENU, - LINK( this, TaskPaneController_Impl, OnToolboxClicked ) - ); - m_rDockingWindow.SetEndDockingHdl( LINK( this, TaskPaneController_Impl, DockingChanged ) ); - impl_setLayout(LAYOUT_DRAWERS, true); - - m_rTaskPane.GetPanelDeck().AddListener( *this ); - - // initialize the panel repository - for ( size_t i = 0; i < m_rTaskPane.GetPanelDeck().GetPanelCount(); ++i ) - { - ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( i ) ); - m_aPanelRepository.push_back( PanelDescriptor( pPanel ) ); - } - - SetDefaultTitle( SfxResId( STR_SFX_TASKS ).toString() ); - } - - - TaskPaneController_Impl::~TaskPaneController_Impl() - { - m_rTaskPane.GetPanelDeck().RemoveListener( *this ); - int i = 0; - - // remove the panels which are not under the control of the panel deck currently - for ( PanelDescriptors::iterator panelPos = m_aPanelRepository.begin(); - panelPos != m_aPanelRepository.end(); - ++panelPos, ++i - ) - { - if ( panelPos->bHidden ) - impl_togglePanelVisibility( i ); - } - m_aPanelRepository.clear(); - } - - - void TaskPaneController_Impl::SetDefaultTitle( const OUString& i_rTitle ) - { - m_sDefaultTitle = i_rTitle; - impl_updateDockingWindowTitle(); - } - - - void TaskPaneController_Impl::ActivateToolPanel( const OUString& i_rPanelURL ) - { - ::boost::optional< size_t > aPanelPos( m_rTaskPane.GetPanelPos( i_rPanelURL ) ); - ENSURE_OR_RETURN_VOID( !!aPanelPos, "TaskPaneController_Impl::ActivateToolPanel: no such panel!" ); - - if ( aPanelPos == m_rTaskPane.GetPanelDeck().GetActivePanel() ) - { - ::svt::PToolPanel pPanel( m_rTaskPane.GetPanelDeck().GetPanel( *aPanelPos ) ); - pPanel->GrabFocus(); - } - else - { - m_rTaskPane.GetPanelDeck().ActivatePanel( aPanelPos ); - } - } - - - IMPL_LINK_TYPED( TaskPaneController_Impl, DockingChanged, TitledDockingWindow*, i_pDockingWindow, void ) - { - ENSURE_OR_RETURN_VOID( i_pDockingWindow, "TaskPaneController_Impl::DockingChanged: where does this come from?" ); - - if ( impl_getLayout() == LAYOUT_DRAWERS ) - return; - - impl_setLayout( lcl_getTabLayoutFromAlignment( i_pDockingWindow->GetAlignment() ) ); - } - - - IMPL_LINK_TYPED( TaskPaneController_Impl, OnToolboxClicked, ToolBox*, i_pToolBox, void ) - { - if ( i_pToolBox->GetCurItemId() == m_nViewMenuID ) - { - i_pToolBox->EndSelection(); - - ::std::unique_ptr< PopupMenu > pMenu = impl_createPopupMenu(); - pMenu->SetSelectHdl( LINK( this, TaskPaneController_Impl, OnMenuItemSelected ) ); - - // pass toolbox button rect so the menu can stay open on button up - Rectangle aMenuRect( i_pToolBox->GetItemRect( m_nViewMenuID ) ); - aMenuRect.SetPos( i_pToolBox->GetPosPixel() ); - pMenu->Execute( &m_rDockingWindow, aMenuRect, PopupMenuFlags::ExecuteDown ); - } - } - - - IMPL_LINK_TYPED( TaskPaneController_Impl, OnMenuItemSelected, Menu*, i_pMenu, bool ) - { - ENSURE_OR_RETURN( i_pMenu, "TaskPaneController_Impl::OnMenuItemSelected: illegal menu!", false ); - - i_pMenu->Deactivate(); - switch ( i_pMenu->GetCurItemId() ) - { - case MID_UNLOCK_TASK_PANEL: - m_rDockingWindow.SetFloatingMode( true ); - break; - - case MID_LOCK_TASK_PANEL: - m_rDockingWindow.SetFloatingMode(false); - break; - - case MID_LAYOUT_DRAWERS: - impl_setLayout( LAYOUT_DRAWERS ); - break; - - case MID_LAYOUT_TABS: - impl_setLayout( lcl_getTabLayoutFromAlignment( m_rDockingWindow.GetAlignment() ) ); - break; - - default: - { - size_t nPanelIndex = size_t( i_pMenu->GetCurItemId() - MID_FIRST_PANEL ); - impl_togglePanelVisibility( nPanelIndex ); - } - break; - } - - return true; - } - - - size_t TaskPaneController_Impl::impl_getLogicalPanelIndex( const size_t i_nVisibleIndex ) - { - size_t nLogicalIndex = 0; - size_t nVisibleIndex( i_nVisibleIndex ); - for ( size_t i=0; i < m_aPanelRepository.size(); ++i ) - { - if ( !m_aPanelRepository[i].bHidden ) - { - if ( !nVisibleIndex ) - break; - --nVisibleIndex; - } - ++nLogicalIndex; - } - return nLogicalIndex; - } - - - void TaskPaneController_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) - { - if ( m_bTogglingPanelVisibility ) - return; - - const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) ); - m_aPanelRepository.insert( m_aPanelRepository.begin() + nLogicalIndex, PanelDescriptor( i_pPanel ) ); - } - - - void TaskPaneController_Impl::PanelRemoved( const size_t i_nPosition ) - { - if ( m_bTogglingPanelVisibility ) - return; - - const size_t nLogicalIndex( impl_getLogicalPanelIndex( i_nPosition ) ); - m_aPanelRepository.erase( m_aPanelRepository.begin() + nLogicalIndex ); - } - - - void TaskPaneController_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( impl_getLayout() == LAYOUT_DRAWERS ) - // no adjustment of the title when we use the classical "drawers" layout - return; - - impl_updateDockingWindowTitle( ); - (void)i_rOldActive; - (void)i_rNewActive; - } - - - void TaskPaneController_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) - { - // not interested in - (void)i_rNewLayouter; - } - - - void TaskPaneController_Impl::Dying() - { - OSL_FAIL( "TaskPaneController_Impl::Dying: unexpected call!" ); - // We are expected to live longer than the ToolPanelDeck we work with. Since we remove ourself, in our dtor, - // as listener from the panel deck, this method here should never be called. - } - - - void TaskPaneController_Impl::impl_togglePanelVisibility( const size_t i_nLogicalPanelIndex ) - { - ENSURE_OR_RETURN_VOID( i_nLogicalPanelIndex < m_aPanelRepository.size(), "illegal index" ); - - // get the actual panel index, within the deck - size_t nActualPanelIndex(0); - for ( size_t i=0; i < i_nLogicalPanelIndex; ++i ) - { - if ( !m_aPanelRepository[i].bHidden ) - ++nActualPanelIndex; - } - - ::boost::optional< size_t > aActivatePanel; - - m_bTogglingPanelVisibility = true; - if ( m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden ) - { - OSL_VERIFY( m_rTaskPane.GetPanelDeck().InsertPanel( m_aPanelRepository[ i_nLogicalPanelIndex ].pPanel, nActualPanelIndex ) == nActualPanelIndex ); - // if there has not been an active panel before, activate the newly inserted one - ::boost::optional< size_t > aActivePanel( m_rTaskPane.GetPanelDeck().GetActivePanel() ); - if ( !aActivePanel ) - aActivatePanel = nActualPanelIndex; - } - else - { - OSL_VERIFY( m_rTaskPane.GetPanelDeck().RemovePanel( nActualPanelIndex ).get() == m_aPanelRepository[ i_nLogicalPanelIndex ].pPanel.get() ); - } - m_bTogglingPanelVisibility = false; - m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden = !m_aPanelRepository[ i_nLogicalPanelIndex ].bHidden; - - if ( !!aActivatePanel ) - m_rTaskPane.GetPanelDeck().ActivatePanel( *aActivatePanel ); - } - - - void TaskPaneController_Impl::impl_setLayout( const PanelSelectorLayout i_eLayout, const bool i_bForce ) - { - if ( !i_bForce && ( m_eCurrentLayout == i_eLayout ) ) - return; - - switch ( i_eLayout ) - { - case LAYOUT_DRAWERS: - m_rTaskPane.SetDrawersLayout(); - break; - case LAYOUT_TABS_TOP: - m_rTaskPane.SetTabsLayout( ::svt::TABS_TOP, ::svt::TABITEM_IMAGE_ONLY ); - break; - case LAYOUT_TABS_BOTTOM: - m_rTaskPane.SetTabsLayout( ::svt::TABS_BOTTOM, ::svt::TABITEM_IMAGE_ONLY ); - break; - case LAYOUT_TABS_LEFT: - m_rTaskPane.SetTabsLayout( ::svt::TABS_LEFT, ::svt::TABITEM_IMAGE_ONLY ); - break; - case LAYOUT_TABS_RIGHT: - m_rTaskPane.SetTabsLayout( ::svt::TABS_RIGHT, ::svt::TABITEM_IMAGE_ONLY ); - break; - } - m_eCurrentLayout = i_eLayout; - - impl_updateDockingWindowTitle(); - } - - - void TaskPaneController_Impl::impl_updateDockingWindowTitle() - { - ::boost::optional< size_t > aActivePanel( m_rTaskPane.GetPanelDeck().GetActivePanel() ); - if ( !aActivePanel || ( impl_getLayout() == LAYOUT_DRAWERS ) ) - m_rDockingWindow.SetTitle( m_sDefaultTitle ); - else - { - size_t nNewActive( *aActivePanel ); - for ( size_t i=0; i < m_aPanelRepository.size(); ++i ) - { - if ( m_aPanelRepository[i].bHidden ) - continue; - - if ( !nNewActive ) - { - m_rDockingWindow.SetTitle( m_aPanelRepository[i].pPanel->GetDisplayName() ); - break; - } - --nNewActive; - } - } - } - - - ::std::unique_ptr< PopupMenu > TaskPaneController_Impl::impl_createPopupMenu() const - { - ::std::unique_ptr pMenu( new PopupMenu ); - FloatingWindow* pMenuWindow = static_cast< FloatingWindow* >( pMenu->GetWindow() ); - if ( pMenuWindow != nullptr ) - { - pMenuWindow->SetPopupModeFlags ( pMenuWindow->GetPopupModeFlags() | FloatWinPopupFlags::NoMouseUpClose ); - } - - // Add one entry for every tool panel element to individually make - // them visible or hide them. - sal_uInt16 nIndex = MID_FIRST_PANEL; - for ( size_t i=0; iInsertItem( nIndex, rPanelDesc.pPanel->GetDisplayName(), MenuItemBits::CHECKABLE ); - pMenu->CheckItem( nIndex, !rPanelDesc.bHidden ); - } - pMenu->InsertSeparator(); - -#if OSL_DEBUG_LEVEL > 0 - if (SvtMiscOptions().IsExperimentalMode()) - { - pMenu->InsertItem( MID_LAYOUT_TABS, OUString("Tab-Layout (exp.)"), MenuItemBits::CHECKABLE ); - pMenu->CheckItem( MID_LAYOUT_TABS, impl_getLayout() != LAYOUT_DRAWERS ); - pMenu->InsertItem( MID_LAYOUT_DRAWERS, OUString("Drawer-Layout"), MenuItemBits::CHECKABLE ); - pMenu->CheckItem( MID_LAYOUT_DRAWERS, impl_getLayout() == LAYOUT_DRAWERS ); - - pMenu->InsertSeparator(); - } -#endif - - // Add entry for docking or un-docking the tool panel. - if ( m_rDockingWindow.IsFloatingMode() ) - pMenu->InsertItem( - MID_LOCK_TASK_PANEL, - SfxResId( STR_SFX_DOCK ).toString() - ); - else - pMenu->InsertItem( - MID_UNLOCK_TASK_PANEL, - SfxResId( STR_SFX_UNDOCK ).toString() - ); - - pMenu->RemoveDisabledEntries( false ); - - return pMenu; - } - - //= TaskPaneController - - - TaskPaneController::TaskPaneController( ModuleTaskPane& i_rTaskPane, TitledDockingWindow& i_rDockingWindow ) - :m_xImpl( new TaskPaneController_Impl( i_rTaskPane, i_rDockingWindow ) ) - { - } - - - TaskPaneController::~TaskPaneController() - { - } - - - void TaskPaneController::ActivateToolPanel( const OUString& i_rPanelURL ) - { - m_xImpl->ActivateToolPanel( i_rPanelURL ); - } - - -} // namespace sfx2 - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/taskpane.src b/sfx2/source/dialog/taskpane.src deleted file mode 100644 index 81ff80436897..000000000000 --- a/sfx2/source/dialog/taskpane.src +++ /dev/null @@ -1,42 +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 -#include "sfxlocal.hrc" - -String STR_SFX_DOCK -{ - Text [ en-US ] = "Dock"; -}; - -String STR_SFX_UNDOCK -{ - Text [ en-US ] = "Undock"; -}; - -String STR_SFX_TASK_PANE_VIEW -{ - Text [ en-US ] = "View"; -}; -String STR_SFX_TASKS -{ - Text [ en-US ] = "Tasks"; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index 55334bfa0797..4b711577c04f 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -308,7 +308,6 @@ public: bool IsFloating( sal_uInt16 nId ); void SetActiveChild_Impl( vcl::Window *pChild ); VclPtr GetActiveChild_Impl() const { return pActiveChild; } - bool AllowChildWindowCreation_Impl( const SfxChildWin_Impl& i_rCW ) const; // Methods for StatusBar void ResetStatusBar_Impl(); diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx index fa51683c5dc7..250666309de0 100644 --- a/sfx2/source/view/impviewframe.hxx +++ b/sfx2/source/view/impviewframe.hxx @@ -50,8 +50,6 @@ struct SfxViewFrame_Impl bool bWindowWasEnabled:1; bool bActive; OUString aFactoryName; - ::boost::optional< bool > - aHasToolPanels; explicit SfxViewFrame_Impl(SfxFrame& i_rFrame) : rFrame(i_rFrame) diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1534261dd592..7dbe506431fa 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -102,7 +102,6 @@ using ::com::sun::star::container::XIndexContainer; // Due to ViewFrame::Current #include "appdata.hxx" -#include #include #include #include "openflag.hxx" @@ -154,20 +153,6 @@ void SfxViewFrame::InitInterface_Impl() #endif } - -namespace -{ - bool moduleHasToolPanels( SfxViewFrame_Impl& i_rViewFrameImpl ) - { - if ( !i_rViewFrameImpl.aHasToolPanels ) - { - i_rViewFrameImpl.aHasToolPanels.reset( ::sfx2::ModuleTaskPane::ModuleHasToolPanels( - i_rViewFrameImpl.rFrame.GetFrameInterface() ) ); - } - return *i_rViewFrameImpl.aHasToolPanels; - } -} - static bool AskPasswordToModify_Impl( const uno::Reference< task::XInteractionHandler >& xHandler, const OUString& aPath, const SfxFilter* pFilter, sal_uInt32 nPasswordHash, const uno::Sequence< beans::PropertyValue >& aInfo ) { // TODO/LATER: In future the info should replace the direct hash completely @@ -3116,27 +3101,11 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); } - else if ( nSID == SID_TASKPANE ) - { - if ( !KnowsChildWindow( nSID ) ) - { - OSL_FAIL( "SID_TASKPANE state requested, but no task pane child window exists for this ID!" ); - rState.DisableItem( nSID ); - } - else if ( !moduleHasToolPanels( *pImp ) ) - { - rState.Put( SfxVisibilityItem( nSID, false ) ); - } - else - { - rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) ); - } - } else if ( nSID == SID_SIDEBAR ) { if ( !KnowsChildWindow( nSID ) ) { - OSL_ENSURE( false, "SID_TASKPANE state requested, but no task pane child window exists for this ID!" ); + OSL_ENSURE( false, "SID_SIDEBAR state requested, but no task pane child window exists for this ID!" ); rState.DisableItem( nSID ); } else @@ -3214,38 +3183,6 @@ void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) SfxGetpApp()->SetViewFrame_Impl( pFrame ); } -void SfxViewFrame::ActivateToolPanel( const css::uno::Reference< css::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL ) -{ - SolarMutexGuard aGuard; - - // look up the SfxFrame for the given XFrame - SfxFrame* pFrame = nullptr; - for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) - { - if ( pFrame->GetFrameInterface() == i_rFrame ) - break; - } - SfxViewFrame* pViewFrame = pFrame ? pFrame->GetCurrentViewFrame() : nullptr; - ENSURE_OR_RETURN_VOID( pViewFrame != nullptr, "SfxViewFrame::ActivateToolPanel: did not find an SfxFrame for the given XFrame!" ); - - pViewFrame->ActivateToolPanel_Impl( i_rPanelURL ); -} - -void SfxViewFrame::ActivateToolPanel_Impl( const OUString& i_rPanelURL ) -{ - // ensure the task pane is visible - ENSURE_OR_RETURN_VOID( KnowsChildWindow( SID_TASKPANE ), "SfxViewFrame::ActivateToolPanel: this frame/module does not allow for a task pane!" ); - if ( !HasChildWindow( SID_TASKPANE ) ) - ToggleChildWindow( SID_TASKPANE ); - - SfxChildWindow* pTaskPaneChildWindow = GetChildWindow( SID_TASKPANE ); - ENSURE_OR_RETURN_VOID( pTaskPaneChildWindow, "SfxViewFrame::ActivateToolPanel_Impl: just switched it on, but it is not there!" ); - - ::sfx2::ITaskPaneToolPanelAccess* pPanelAccess = dynamic_cast< ::sfx2::ITaskPaneToolPanelAccess* >( pTaskPaneChildWindow ); - ENSURE_OR_RETURN_VOID( pPanelAccess, "SfxViewFrame::ActivateToolPanel_Impl: task pane child window does not implement a required interface!" ); - pPanelAccess->ActivateToolPanel( i_rPanelURL ); -} - SfxInfoBarWindow* SfxViewFrame::AppendInfoBar( const OUString& sId, const OUString& sMessage ) { const sal_uInt16 nId = SfxInfoBarContainerChild::GetChildWindowId(); diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx index 624b22f1b61e..baa974ddc3ce 100644 --- a/starmath/source/smdll.cxx +++ b/starmath/source/smdll.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -75,8 +74,6 @@ namespace SmCmdBoxWrapper::RegisterChildWindow(true); SmElementsDockingWindowWrapper::RegisterChildWindow(true); - - ::sfx2::TaskPaneWrapper::RegisterChildWindow(false, pModule); } SmDLL::~SmDLL() diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index a4e8c39ebb48..ebcf144ed79e 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -920,7 +920,6 @@ void SmViewShell::InitInterface_Impl() RID_MATH_TOOLBOX); //Dummy-Objectbar, to avoid quiver while activating - GetStaticInterface()->RegisterChildWindow(SID_TASKPANE); GetStaticInterface()->RegisterChildWindow(SmCmdBoxWrapper::GetChildWindowId()); GetStaticInterface()->RegisterChildWindow(SmElementsDockingWindowWrapper::GetChildWindowId()); } diff --git a/starmath/uiconfig/smath/menubar/menubar.xml b/starmath/uiconfig/smath/menubar/menubar.xml index 60c48ff20b4c..e51d861c8fc7 100644 --- a/starmath/uiconfig/smath/menubar/menubar.xml +++ b/starmath/uiconfig/smath/menubar/menubar.xml @@ -82,8 +82,6 @@ - - diff --git a/svtools/AllLangResTarget_svt.mk b/svtools/AllLangResTarget_svt.mk index aa52ba84cc98..780f853fa581 100644 --- a/svtools/AllLangResTarget_svt.mk +++ b/svtools/AllLangResTarget_svt.mk @@ -53,7 +53,6 @@ $(eval $(call gb_SrsTarget_add_files,svt/res,\ svtools/source/misc/langtab.src \ svtools/source/misc/svtools.src \ svtools/source/misc/undo.src \ - svtools/source/toolpanel/toolpanel.src \ )) $(eval $(call gb_SrsTarget_add_nonlocalizable_files,svt/res,\ diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 9e30e77037a6..363af255df14 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -212,19 +212,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/table/mousefunction \ svtools/source/table/cellvalueconversion \ svtools/source/table/tablegeometry \ - svtools/source/toolpanel/drawerlayouter \ - svtools/source/toolpanel/dummypanel \ - svtools/source/toolpanel/paneldecklisteners \ - svtools/source/toolpanel/paneltabbar \ - svtools/source/toolpanel/paneltabbarpeer \ - svtools/source/toolpanel/tabbargeometry \ - svtools/source/toolpanel/tablayouter \ - svtools/source/toolpanel/toolpanel \ - svtools/source/toolpanel/toolpanelcollection \ - svtools/source/toolpanel/toolpaneldeck \ - svtools/source/toolpanel/toolpaneldeckpeer \ - svtools/source/toolpanel/toolpaneldrawer \ - svtools/source/toolpanel/toolpaneldrawerpeer \ svtools/source/uno/addrtempuno \ svtools/source/uno/contextmenuhelper \ svtools/source/uno/fpicker \ diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx index 1d59d0efd2c0..6953074ac0b7 100644 --- a/svtools/inc/pch/precompiled_svt.hxx +++ b/svtools/inc/pch/precompiled_svt.hxx @@ -433,7 +433,6 @@ #include #include #include -#include #include #include #include diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index e5bc5b136b00..97e866c41c38 100644 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -176,24 +176,6 @@ namespace svt { return nullptr; } - - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleToolPanelDeck( - const css::uno::Reference< css::accessibility::XAccessible >& /*i_rAccessibleParent*/, - ::svt::ToolPanelDeck& /*i_rPanelDeck*/ - ) override - { - return nullptr; - } - virtual css::uno::Reference< css::accessibility::XAccessibleContext > - createAccessibleToolPanelTabBar( - const css::uno::Reference< css::accessibility::XAccessible >& /*i_rAccessibleParent*/, - ::svt::IToolPanelDeck& /*i_rPanelDeck*/, - ::svt::PanelTabBar& /*i_rTabBar*/ - ) override - { - return nullptr; - } }; diff --git a/svtools/source/toolpanel/drawerlayouter.cxx b/svtools/source/toolpanel/drawerlayouter.cxx deleted file mode 100644 index 753d53c84079..000000000000 --- a/svtools/source/toolpanel/drawerlayouter.cxx +++ /dev/null @@ -1,285 +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 -#include "toolpaneldrawer.hxx" - -#include - -#include -#include - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::accessibility::XAccessible; - - - //= DrawerDeckLayouter - - - DrawerDeckLayouter::DrawerDeckLayouter( vcl::Window& i_rParentWindow, IToolPanelDeck& i_rPanels ) - :m_rParentWindow( i_rParentWindow ) - ,m_rPanelDeck( i_rPanels ) - ,m_aDrawers() - ,m_aLastKnownActivePanel() - { - m_rPanelDeck.AddListener( *this ); - - // simulate PanelInserted events for the panels which are already there - for ( size_t i=0; i aActivePanel( m_rPanelDeck.GetActivePanel() ); - if ( !aActivePanel ) - aActivePanel = m_aLastKnownActivePanel; - - // arrange the title bars which are *above* the active panel (or *all* if there is no active panel), plus - // the title bar of the active panel itself - Point aUpperDrawerPos( i_rDeckPlayground.TopLeft() ); - const size_t nUpperBound = !!aActivePanel ? *aActivePanel : nPanelCount - 1; - for ( size_t i=0; i<=nUpperBound; ++i ) - { - long const nDrawerHeight = m_aDrawers[i]->GetPreferredHeightPixel(); - m_aDrawers[i]->SetPosSizePixel( - aUpperDrawerPos, Size( nWidth, nDrawerHeight ) ); - aUpperDrawerPos.Move( 0, nDrawerHeight ); - } - - // arrange title bars which are below the active panel (or *none* if there is no active panel) - Point aLowerDrawerPos( i_rDeckPlayground.BottomLeft() ); - for ( size_t j = nPanelCount - 1; j > nUpperBound; --j ) - { - long const nDrawerHeight = m_aDrawers[j]->GetPreferredHeightPixel(); - m_aDrawers[j]->SetPosSizePixel( - Point( aLowerDrawerPos.X(), aLowerDrawerPos.Y() - nDrawerHeight + 1 ), - Size( nWidth, nDrawerHeight ) - ); - aLowerDrawerPos.Move( 0, -nDrawerHeight ); - } - - // finally calculate the rectangle for the active panel - return Rectangle( - aUpperDrawerPos, - Size( nWidth, aLowerDrawerPos.Y() - aUpperDrawerPos.Y() + 1 ) - ); - } - - - void DrawerDeckLayouter::Destroy() - { - while ( !m_aDrawers.empty() ) - impl_removeDrawer( 0 ); - m_rPanelDeck.RemoveListener( *this ); - } - - - void DrawerDeckLayouter::SetFocusToPanelSelector() - { - const size_t nPanelCount( m_rPanelDeck.GetPanelCount() ); - if ( !nPanelCount ) - // nothing to focus - return; - ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() ); - if ( !aActivePanel ) - aActivePanel = 0; - ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "DrawerDeckLayouter::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" ); - m_aDrawers[ *aActivePanel ]->GrabFocus(); - } - - - size_t DrawerDeckLayouter::GetAccessibleChildCount() const - { - return m_aDrawers.size(); - } - - - Reference< XAccessible > DrawerDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) - { - ENSURE_OR_RETURN( i_nChildIndex < m_aDrawers.size(), "illegal index", nullptr ); - - VclPtr pDrawer( m_aDrawers[ i_nChildIndex ] ); - - Reference< XAccessible > xItemAccessible = pDrawer->GetAccessible( false ); - if ( !xItemAccessible.is() ) - { - xItemAccessible = pDrawer->GetAccessible(); - ENSURE_OR_RETURN( xItemAccessible.is(), "illegal accessible provided by the drawer implementation!", nullptr ); - OSL_VERIFY( ::comphelper::OAccessibleImplementationAccess::setAccessibleParent( xItemAccessible->getAccessibleContext(), - i_rParentAccessible ) ); - } - - return xItemAccessible; - } - - - void DrawerDeckLayouter::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) - { - OSL_PRECOND( i_nPosition <= m_aDrawers.size(), "DrawerDeckLayouter::PanelInserted: inconsistency!" ); - - VclPtrInstance pDrawer( m_rParentWindow, i_pPanel->GetDisplayName() ); - pDrawer->SetHelpId( i_pPanel->GetHelpID() ); - // proper Z-Order - if ( i_nPosition == 0 ) - { - pDrawer->SetZOrder( nullptr, ZOrderFlags::First ); - } - else - { - ToolPanelDrawer* pFirstDrawer( m_aDrawers[ i_nPosition - 1 ] ); - pDrawer->SetZOrder( pFirstDrawer, ZOrderFlags::Behind ); - } - - pDrawer->Show(); - pDrawer->AddEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) ); - m_aDrawers.insert( m_aDrawers.begin() + i_nPosition, pDrawer ); - impl_triggerRearrange(); - } - - - void DrawerDeckLayouter::PanelRemoved( const size_t i_nPosition ) - { - impl_removeDrawer( i_nPosition ); - impl_triggerRearrange(); - } - - - void DrawerDeckLayouter::impl_triggerRearrange() const - { - // this is somewhat hacky, it assumes that the parent of our panels is a tool panel deck, which, in its - // Resize implementation, rearrances all elements. - m_rParentWindow.Resize(); - } - - - void DrawerDeckLayouter::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - if ( !!i_rOldActive ) - { - OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal old index!" ); - m_aDrawers[ *i_rOldActive ]->SetExpanded( false ); - } - - if ( !!i_rNewActive ) - { - OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "DrawerDeckLayouter::ActivePanelChanged: illegal new index!" ); - m_aDrawers[ *i_rNewActive ]->SetExpanded( true ); - } - - impl_triggerRearrange(); - } - - - void DrawerDeckLayouter::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) - { - // not interested in - (void)i_rNewLayouter; - } - - - size_t DrawerDeckLayouter::impl_getPanelPositionFromWindow( const vcl::Window* i_pDrawerWindow ) const - { - for ( auto drawerPos = m_aDrawers.begin(); drawerPos != m_aDrawers.end(); ++drawerPos ) - { - if ( drawerPos->get() == i_pDrawerWindow ) - return drawerPos - m_aDrawers.begin(); - } - return m_aDrawers.size(); - } - - - void DrawerDeckLayouter::impl_removeDrawer( const size_t i_nPosition ) - { - OSL_PRECOND( i_nPosition < m_aDrawers.size(), "DrawerDeckLayouter::impl_removeDrawer: invalid panel position!" ); - m_aDrawers[ i_nPosition ]->RemoveEventListener( LINK( this, DrawerDeckLayouter, OnWindowEvent ) ); - m_aDrawers.erase( m_aDrawers.begin() + i_nPosition ); - } - - - IMPL_LINK_TYPED( DrawerDeckLayouter, OnWindowEvent, VclWindowEvent&, rWindowEvent, void ) - { - bool bActivatePanel = false; - switch ( rWindowEvent.GetId() ) - { - case VCLEVENT_WINDOW_MOUSEBUTTONUP: - { - const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( rWindowEvent.GetData() ); - ENSURE_OR_RETURN_VOID( pMouseEvent, "no mouse event with MouseButtonUp" ); - if ( pMouseEvent->GetButtons() == MOUSE_LEFT ) - { - bActivatePanel = true; - } - } - break; - case VCLEVENT_WINDOW_KEYINPUT: - { - const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( rWindowEvent.GetData() ); - ENSURE_OR_RETURN_VOID( pKeyEvent, "no key event with KeyInput" ); - const vcl::KeyCode& rKeyCode( pKeyEvent->GetKeyCode() ); - if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) ) - { - bActivatePanel = true; - } - } - break; - } - if ( bActivatePanel ) - { - const size_t nPanelPos = impl_getPanelPositionFromWindow( rWindowEvent.GetWindow() ); - if ( nPanelPos != m_rPanelDeck.GetActivePanel() ) - { - m_rPanelDeck.ActivatePanel( nPanelPos ); - } - else - { - PToolPanel pPanel( m_rPanelDeck.GetPanel( nPanelPos ) ); - pPanel->GrabFocus(); - } - } - } - - - void DrawerDeckLayouter::Dying() - { - Destroy(); - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx deleted file mode 100644 index 6d29a2ccbf30..000000000000 --- a/svtools/source/toolpanel/dummypanel.cxx +++ /dev/null @@ -1,98 +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 "dummypanel.hxx" - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::accessibility::XAccessible; - - - //= DummyPanel - - - DummyPanel::DummyPanel() - { - } - - - DummyPanel::~DummyPanel() - { - } - - - void DummyPanel::Activate( vcl::Window& ) - { - } - - - void DummyPanel::Deactivate() - { - } - - - void DummyPanel::SetSizePixel( const Size& ) - { - } - - - OUString DummyPanel::GetDisplayName() const - { - return OUString(); - } - - - Image DummyPanel::GetImage() const - { - return Image(); - } - - - OString DummyPanel::GetHelpID() const - { - return OString(); - } - - - void DummyPanel::GrabFocus() - { - } - - - void DummyPanel::Dispose() - { - } - - - Reference< XAccessible > DummyPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) - { - (void)i_rParentAccessible; - return nullptr; - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx deleted file mode 100644 index 1e22b56a3543..000000000000 --- a/svtools/source/toolpanel/dummypanel.hxx +++ /dev/null @@ -1,62 +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_TOOLPANEL_DUMMYPANEL_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_DUMMYPANEL_HXX - -#include -#include - - -namespace svt -{ - - - - //= DummyPanel - - /// is a dummy implementation of the IToolPanel interface - class DummyPanel :public IToolPanel - { - public: - DummyPanel(); - virtual ~DummyPanel(); - - // IToolPanel - virtual OUString GetDisplayName() const override; - virtual Image GetImage() const override; - virtual OString GetHelpID() const override; - virtual void Activate( vcl::Window& i_rParentWindow ) override; - virtual void Deactivate() override; - virtual void SetSizePixel( const Size& i_rPanelWindowSize ) override; - virtual void GrabFocus() override; - virtual void Dispose() override; - virtual css::uno::Reference< css::accessibility::XAccessible > - CreatePanelAccessible( - const css::uno::Reference< css::accessibility::XAccessible >& i_rParentAccessible - ) override; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_DUMMYPANEL_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneldecklisteners.cxx b/svtools/source/toolpanel/paneldecklisteners.cxx deleted file mode 100644 index d2560d9d2284..000000000000 --- a/svtools/source/toolpanel/paneldecklisteners.cxx +++ /dev/null @@ -1,131 +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 "paneldecklisteners.hxx" -#include - - -namespace svt -{ - - - - //= PanelDeckListeners - - - PanelDeckListeners::PanelDeckListeners() - { - } - - - PanelDeckListeners::~PanelDeckListeners() - { - } - - - void PanelDeckListeners::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) - { - ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) - { - (*loop)->PanelInserted( i_pPanel, i_nPosition ); - } - } - - - void PanelDeckListeners::PanelRemoved( const size_t i_nPosition ) - { - ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) - { - (*loop)->PanelRemoved( i_nPosition ); - } - } - - - void PanelDeckListeners::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) - { - (*loop)->ActivePanelChanged( i_rOldActive, i_rNewActive ); - } - } - - - void PanelDeckListeners::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) - { - ::std::vector< IToolPanelDeckListener* > aListeners( m_aListeners ); - for ( ::std::vector< IToolPanelDeckListener* >::const_iterator loop = aListeners.begin(); - loop != aListeners.end(); - ++loop - ) - { - (*loop)->LayouterChanged( i_rNewLayouter ); - } - } - - - void PanelDeckListeners::Dying() - { - while ( !m_aListeners.empty() ) - { - IToolPanelDeckListener* pListener( *m_aListeners.begin() ); - m_aListeners.erase( m_aListeners.begin() ); - pListener->Dying(); - } - } - - - void PanelDeckListeners::AddListener( IToolPanelDeckListener& i_rListener ) - { - m_aListeners.push_back( &i_rListener ); - } - - - void PanelDeckListeners::RemoveListener( IToolPanelDeckListener& i_rListener ) - { - for ( ::std::vector< IToolPanelDeckListener* >::iterator lookup = m_aListeners.begin(); - lookup != m_aListeners.end(); - ++lookup - ) - { - if ( *lookup == &i_rListener ) - { - m_aListeners.erase( lookup ); - return; - } - } - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneldecklisteners.hxx b/svtools/source/toolpanel/paneldecklisteners.hxx deleted file mode 100644 index 81f0d1639387..000000000000 --- a/svtools/source/toolpanel/paneldecklisteners.hxx +++ /dev/null @@ -1,67 +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_TOOLPANEL_PANELDECKLISTENERS_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_PANELDECKLISTENERS_HXX - -#include - -#include -#include - - -namespace svt -{ - - - class IToolPanelDeckListener; - - - //= PanelDeckListeners - - /** implements a container for IToolPanelDeckListeners - */ - class PanelDeckListeners - { - public: - PanelDeckListeners(); - ~PanelDeckListeners(); - - // IToolPanelDeckListener equivalents, forward the events to all registered listeners - void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ); - void PanelRemoved( const size_t i_nPosition ); - void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); - void LayouterChanged( const PDeckLayouter& i_rNewLayouter ); - void Dying(); - - // listener maintenance - void AddListener( IToolPanelDeckListener& i_rListener ); - void RemoveListener( IToolPanelDeckListener& i_rListener ); - - private: - ::std::vector< IToolPanelDeckListener* > m_aListeners; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_PANELDECKLISTENERS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx deleted file mode 100644 index 93a8f04fd233..000000000000 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ /dev/null @@ -1,1371 +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 -#include -#include -#include - -#include "tabitemdescriptor.hxx" -#include "paneltabbarpeer.hxx" -#include "tabbargeometry.hxx" - -#include -#include -#include -#include -#include -#include - -#include -#include - -// space around an item -#define ITEM_OUTER_SPACE 2 * 3 -// spacing before and after an item's text -#define ITEM_TEXT_FLOW_SPACE 5 -// space between item icon and icon text -#define ITEM_ICON_TEXT_DISTANCE 4 - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::awt::XWindowPeer; - - typedef sal_uInt16 ItemFlags; - - #define ITEM_STATE_NORMAL 0x00 - #define ITEM_STATE_ACTIVE 0x01 - #define ITEM_STATE_HOVERED 0x02 - #define ITEM_STATE_FOCUSED 0x04 - #define ITEM_POSITION_FIRST 0x08 - #define ITEM_POSITION_LAST 0x10 - - - //= helper - - namespace - { - ControlState lcl_ItemToControlState( const ItemFlags i_nItemFlags ) - { - ControlState nState = ControlState::ENABLED; - if ( i_nItemFlags & ITEM_STATE_FOCUSED ) nState |= ControlState::FOCUSED | ControlState::PRESSED; - if ( i_nItemFlags & ITEM_STATE_HOVERED ) nState |= ControlState::ROLLOVER; - if ( i_nItemFlags & ITEM_STATE_ACTIVE ) nState |= ControlState::SELECTED; - return nState; - } - } - - - //= ITabBarRenderer - - class SAL_NO_VTABLE ITabBarRenderer - { - public: - /** fills the background of our target device - */ - virtual void renderBackground() const = 0; - virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const = 0; - virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const = 0; - virtual void postRenderItem( vcl::Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const = 0; - - // TODO: postRenderItem takes the "real" window, i.e. effectively the tab bar. This is because - // DrawSelectionBackground needs to be applied after everything else is painted, and is available at the Window - // class, but not at the OutputDevice. This makes the API somewhat weird, as we're now mixing operations on the - // target device, done in a normalized geometry, with operations on the window, done in a transformed geometry. - // So, we should get rid of postRenderItem completely. - - protected: - ~ITabBarRenderer() {} - }; - typedef std::shared_ptr< ITabBarRenderer > PTabBarRenderer; - - - //= VCLItemRenderer - declaration - - class VCLItemRenderer : public ITabBarRenderer - { - public: - explicit VCLItemRenderer( OutputDevice& i_rTargetDevice ) - :m_rTargetDevice( i_rTargetDevice ) - { - } - virtual ~VCLItemRenderer() {} - - // ITabBarRenderer - virtual void renderBackground() const override; - virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const override; - virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const override; - virtual void postRenderItem( vcl::Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const override; - - protected: - OutputDevice& getTargetDevice() const { return m_rTargetDevice; } - - private: - OutputDevice& m_rTargetDevice; - }; - - - //= VCLItemRenderer - implementation - - - void VCLItemRenderer::renderBackground() const - { - getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) ); - } - - - Rectangle VCLItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const - { - (void)i_nItemFlags; - // no decorations at all - return i_rContentArea; - } - - - void VCLItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const - { - (void)i_rContentRect; - (void)i_nItemFlags; - } - - - void VCLItemRenderer::postRenderItem( vcl::Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const - { - const bool bActive = ( ( i_nItemFlags & ITEM_STATE_ACTIVE ) != 0 ); - const bool bHovered = ( ( i_nItemFlags & ITEM_STATE_HOVERED ) != 0 ); - const bool bFocused = ( ( i_nItemFlags & ITEM_STATE_FOCUSED ) != 0 ); - if ( bActive || bHovered || bFocused ) - { - Rectangle aSelectionRect( i_rItemRect ); - aSelectionRect.Left() += ITEM_OUTER_SPACE / 2; - aSelectionRect.Top() += ITEM_OUTER_SPACE / 2; - aSelectionRect.Right() -= ITEM_OUTER_SPACE / 2; - aSelectionRect.Bottom() -= ITEM_OUTER_SPACE / 2; - i_rActualWindow.DrawSelectionBackground( - aSelectionRect, - ( bHovered || bFocused ) ? ( bActive ? 1 : 2 ) : 0 /* highlight */, - bActive /* check */, - true /* border */, - false /* ext border only */, - 0 /* corner radius */, - nullptr, - nullptr - ); - } - } - - - //= NWFToolboxItemRenderer - declaration - - class NWFToolboxItemRenderer : public ITabBarRenderer - { - public: - explicit NWFToolboxItemRenderer( OutputDevice& i_rTargetDevice ) - :m_rTargetDevice( i_rTargetDevice ) - { - } - virtual ~NWFToolboxItemRenderer() {} - - // ITabBarRenderer - virtual void renderBackground() const override; - virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const override; - virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const override; - virtual void postRenderItem( vcl::Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const override; - - protected: - OutputDevice& getTargetDevice() const { return m_rTargetDevice; } - - private: - OutputDevice& m_rTargetDevice; - }; - - - //= NWFToolboxItemRenderer - implementation - - - void NWFToolboxItemRenderer::renderBackground() const - { - getTargetDevice().DrawRect( Rectangle( Point(), getTargetDevice().GetOutputSizePixel() ) ); - } - - - Rectangle NWFToolboxItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const - { - // don't ask GetNativeControlRegion, this will not deliver proper results in all cases. - // Instead, simply assume that both the content and the bounding region are the same. -// const ControlState nState( lcl_ItemToControlState( i_nItemFlags ); -// const ImplControlValue aControlValue; -// bool bNativeOK = m_rTargetWindow.GetNativeControlRegion( -// CTRL_TOOLBAR, PART_BUTTON, -// i_rContentArea, nState, -// aControlValue, OUString(), -// aBoundingRegion, aContentRegion -// ); - (void)i_nItemFlags; - return Rectangle( - Point( i_rContentArea.Left() - 1, i_rContentArea.Top() - 1 ), - Size( i_rContentArea.GetWidth() + 2, i_rContentArea.GetHeight() + 2 ) - ); - } - - - void NWFToolboxItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const - { - const ControlState nState = lcl_ItemToControlState( i_nItemFlags ); - - ImplControlValue aControlValue; - aControlValue.setTristateVal( ( i_nItemFlags & ITEM_STATE_ACTIVE ) ? BUTTONVALUE_ON : BUTTONVALUE_OFF ); - - bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TOOLBAR, PART_BUTTON, i_rContentRect, nState, aControlValue, OUString() ); - (void)bNativeOK; - OSL_ENSURE( bNativeOK, "NWFToolboxItemRenderer::preRenderItem: inconsistent NWF implementation!" ); - // IsNativeControlSupported returned true, previously, otherwise we would not be here ... - } - - - void NWFToolboxItemRenderer::postRenderItem( vcl::Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const - { - (void)i_rActualWindow; - (void)i_rItemRect; - (void)i_nItemFlags; - } - - -#if defined WNT - //= NWFTabItemRenderer - declaration - - class NWFTabItemRenderer : public ITabBarRenderer - { - public: - explicit NWFTabItemRenderer( OutputDevice& i_rTargetDevice ) - :m_rTargetDevice( i_rTargetDevice ) - { - } - - virtual ~NWFTabItemRenderer() {} - - // ITabBarRenderer - virtual void renderBackground() const override; - virtual Rectangle calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const override; - virtual void preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const override; - virtual void postRenderItem( vcl::Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const override; - - protected: - OutputDevice& getTargetDevice() const { return m_rTargetDevice; } - - private: - OutputDevice& m_rTargetDevice; - }; - - - //= NWFTabItemRenderer - implementation - - - void NWFTabItemRenderer::renderBackground() const - { - Rectangle aBackground( Point(), getTargetDevice().GetOutputSizePixel() ); - getTargetDevice().DrawRect( aBackground ); - - aBackground.Top() = aBackground.Bottom(); - getTargetDevice().DrawNativeControl( CTRL_TAB_PANE, PART_ENTIRE_CONTROL, aBackground, - ControlState::ENABLED, ImplControlValue(), OUString() ); - } - - - Rectangle NWFTabItemRenderer::calculateDecorations( const Rectangle& i_rContentArea, const ItemFlags i_nItemFlags ) const - { - const ControlState nState( lcl_ItemToControlState( i_nItemFlags ) ); - - TabitemValue tiValue(Rectangle(i_rContentArea.Left() + TAB_TABOFFSET_X, - i_rContentArea.Right() - TAB_TABOFFSET_X, - i_rContentArea.Top() + TAB_TABOFFSET_Y, - i_rContentArea.Bottom() - TAB_TABOFFSET_Y)); - - Rectangle aBoundingRegion, aContentRegion; - bool bNativeOK = getTargetDevice().GetNativeControlRegion( - CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, - i_rContentArea, nState, - tiValue, OUString(), - aBoundingRegion, aContentRegion - ); - (void)bNativeOK; - OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::calculateDecorations: GetNativeControlRegion not implemented for CTRL_TAB_ITEM?!" ); - - return aBoundingRegion; - } - - - void NWFTabItemRenderer::preRenderItem( const Rectangle& i_rContentRect, const ItemFlags i_nItemFlags ) const - { - const ControlState nState = lcl_ItemToControlState( i_nItemFlags ); - - TabitemValue tiValue(Rectangle(i_rContentRect.Left() + TAB_TABOFFSET_X, - i_rContentRect.Right() - TAB_TABOFFSET_X, - i_rContentRect.Top() + TAB_TABOFFSET_Y, - i_rContentRect.Bottom() - TAB_TABOFFSET_Y)); - - if ( i_nItemFlags & ITEM_POSITION_FIRST ) - tiValue.mnAlignment |= TabitemFlags::FirstInGroup; - if ( i_nItemFlags & ITEM_POSITION_LAST ) - tiValue.mnAlignment |= TabitemFlags::LastInGroup; - - - bool bNativeOK = getTargetDevice().DrawNativeControl( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL, i_rContentRect, nState, tiValue, OUString() ); - (void)bNativeOK; - OSL_ENSURE( bNativeOK, "NWFTabItemRenderer::preRenderItem: inconsistent NWF implementation!" ); - // IsNativeControlSupported returned true, previously, otherwise we would not be here ... - } - - - void NWFTabItemRenderer::postRenderItem( vcl::Window& i_rActualWindow, const Rectangle& i_rItemRect, const ItemFlags i_nItemFlags ) const - { - (void)i_rActualWindow; - (void)i_rItemRect; - (void)i_nItemFlags; - } -#endif - - //= PanelTabBar_Impl - - class PanelTabBar_Impl : public IToolPanelDeckListener - { - public: - PanelTabBar_Impl(PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, - const TabAlignment i_eAlignment, const TabItemContent i_eItemContent); - - virtual ~PanelTabBar_Impl() - { - m_rPanelDeck.RemoveListener(*this); - } - - // IToolPanelDeckListener - virtual void PanelInserted(const PToolPanel& i_pPanel, const size_t i_nPosition) override - { - (void) i_pPanel; - (void) i_nPosition; - m_bItemsDirty = true; - m_rTabBar.Invalidate(); - - Relayout(); - } - - virtual void PanelRemoved( const size_t i_nPosition ) override - { - m_bItemsDirty = true; - m_rTabBar.Invalidate(); - - if ( i_nPosition < m_nScrollPosition ) - --m_nScrollPosition; - - Relayout(); - } - - virtual void ActivePanelChanged(const boost::optional& i_rOldActive, - const boost::optional& i_rNewActive) override; - virtual void LayouterChanged(const PDeckLayouter& i_rNewLayouter) override; - virtual void Dying() override; - - void UpdateScrollButtons() - { - m_aScrollBack->Enable(m_nScrollPosition > 0); - m_aScrollForward->Enable(m_nScrollPosition < m_aItems.size() - 1); - } - - void Relayout(); - void EnsureItemsCache(); - boost::optional FindItemForPoint( const Point& i_rPoint ) const; - void DrawItem(vcl::RenderContext& rRenderContext, const size_t i_nItemIndex, const Rectangle& i_rBoundaries) const; - void InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags = 0 ) const; - void CopyFromRenderDevice(vcl::RenderContext& rRenderContext, const Rectangle& i_rLogicalRect) const; - Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const; - Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; - - void FocusItem( const ::boost::optional< size_t >& i_rItemPos ); - - inline bool IsVertical() const - { - return ( ( m_eTabAlignment == TABS_LEFT ) - || ( m_eTabAlignment == TABS_RIGHT ) - ); - } - - protected: - DECL_LINK_TYPED( OnScroll, Button*, void ); - - void impl_calcItemRects(); - Size impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const; - void impl_renderItemContent(vcl::RenderContext& rRenderContext, const PToolPanel& i_pPanel, - const Rectangle& i_rContentArea, const TabItemContent i_eItemContent) const; - ItemFlags impl_getItemFlags( const size_t i_nItemIndex ) const; - - public: - PanelTabBar& m_rTabBar; - TabBarGeometry m_aGeometry; - NormalizedArea m_aNormalizer; - TabAlignment m_eTabAlignment; - IToolPanelDeck& m_rPanelDeck; - - ScopedVclPtr m_aRenderDevice; - PTabBarRenderer m_pRenderer; - - boost::optional m_aHoveredItem; - boost::optional m_aFocusedItem; - bool m_bMouseButtonDown; - - ItemDescriptors m_aItems; - bool m_bItemsDirty; - - VclPtr m_aScrollBack; - VclPtr m_aScrollForward; - - size_t m_nScrollPosition; - }; - - - //= helper - - namespace - { - - #if OSL_DEBUG_LEVEL > 0 - static void lcl_checkConsistency( const PanelTabBar_Impl& i_rImpl ) - { - if ( !i_rImpl.m_bItemsDirty ) - { - if ( i_rImpl.m_rPanelDeck.GetPanelCount() != i_rImpl.m_aItems.size() ) - { - OSL_FAIL( "lcl_checkConsistency: inconsistent array sizes!" ); - return; - } - for ( size_t i = 0; i < i_rImpl.m_rPanelDeck.GetPanelCount(); ++i ) - { - if ( i_rImpl.m_rPanelDeck.GetPanel( i ).get() != i_rImpl.m_aItems[i].pPanel.get() ) - { - OSL_FAIL( "lcl_checkConsistency: array elements are inconsistent!" ); - return; - } - } - } - } - - #define DBG_CHECK( data ) \ - lcl_checkConsistency( data ); - #else - #define DBG_CHECK( data ) \ - (void)data; - #endif - - - class ClipItemRegion - { - public: - explicit ClipItemRegion( const PanelTabBar_Impl& i_rImpl ) - :m_rDevice( i_rImpl.m_rTabBar ) - { - m_rDevice.Push( PushFlags::CLIPREGION ); - m_rDevice.SetClipRegion(vcl::Region( - i_rImpl.m_aNormalizer.getTransformed( - i_rImpl.m_aGeometry.getItemsRect(), - i_rImpl.m_eTabAlignment ))); - } - - ~ClipItemRegion() - { - m_rDevice.Pop(); - } - - private: - OutputDevice& m_rDevice; - }; - } - - - //= PanelTabBar_Impl - implementation - - - PanelTabBar_Impl::PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :m_rTabBar( i_rTabBar ) - ,m_aGeometry( i_eItemContent ) - ,m_aNormalizer() - ,m_eTabAlignment( i_eAlignment ) - ,m_rPanelDeck( i_rPanelDeck ) - ,m_aRenderDevice( VclPtr::Create(i_rTabBar) ) - ,m_pRenderer() - ,m_aHoveredItem() - ,m_aFocusedItem() - ,m_bMouseButtonDown( false ) - ,m_aItems() - ,m_bItemsDirty( true ) - ,m_aScrollBack( VclPtr::Create(&i_rTabBar, WB_BEVELBUTTON) ) - ,m_aScrollForward( VclPtr::Create(&i_rTabBar, WB_BEVELBUTTON) ) - ,m_nScrollPosition( 0 ) - { -#ifdef WNT - if (m_aRenderDevice->IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL)) - // this mode requires the NWF framework to be able to render those items onto a virtual - // device. For some frameworks (some GTK themes, in particular), this is known to fail. - // So, be on the safe side for the moment. - m_pRenderer.reset(new NWFTabItemRenderer(*m_aRenderDevice.get())); - else -#endif - if (m_aRenderDevice->IsNativeControlSupported(CTRL_TOOLBAR, PART_BUTTON)) - m_pRenderer.reset(new NWFToolboxItemRenderer(*m_aRenderDevice.get())); - else - m_pRenderer.reset(new VCLItemRenderer(*m_aRenderDevice.get())); - - m_aRenderDevice->SetLineColor(); - - m_rPanelDeck.AddListener( *this ); - - m_aScrollBack->SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT ); - m_aScrollBack->Show(); - m_aScrollBack->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollBack->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() ); - m_aScrollBack->SetAccessibleName( m_aScrollBack->GetAccessibleDescription() ); - - m_aScrollForward->SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT ); - m_aScrollForward->Show(); - m_aScrollForward->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollForward->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() ); - m_aScrollForward->SetAccessibleName( m_aScrollForward->GetAccessibleDescription() ); - } - - - void PanelTabBar_Impl::impl_calcItemRects() - { - m_aItems.resize(0); - - Point aCompletePos( m_aGeometry.getFirstItemPosition() ); - Point aIconOnlyPos( aCompletePos ); - Point aTextOnlyPos( aCompletePos ); - - for ( size_t i = 0; - i < m_rPanelDeck.GetPanelCount(); - ++i - ) - { - PToolPanel pPanel( m_rPanelDeck.GetPanel( i ) ); - - ItemDescriptor aItem; - aItem.pPanel = pPanel; - - const Size aCompleteSize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_AND_TEXT ) ); - const Size aIconOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_IMAGE_ONLY ) ); - const Size aTextOnlySize( impl_calculateItemContentSize( pPanel, TABITEM_TEXT_ONLY ) ); - - // TODO: have one method calculating all sizes? - - // remember the three areas - aItem.aCompleteArea = Rectangle( aCompletePos, aCompleteSize ); - aItem.aIconOnlyArea = Rectangle( aIconOnlyPos, aIconOnlySize ); - aItem.aTextOnlyArea = Rectangle( aTextOnlyPos, aTextOnlySize ); - - m_aItems.push_back( aItem ); - - aCompletePos = aItem.aCompleteArea.TopRight(); - aIconOnlyPos = aItem.aIconOnlyArea.TopRight(); - aTextOnlyPos = aItem.aTextOnlyArea.TopRight(); - } - - m_bItemsDirty = false; - } - - - Size PanelTabBar_Impl::impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const - { - // calculate the size needed for the content - OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_calculateItemContentSize: illegal TabItemContent value!" ); - - const Image aImage( i_pPanel->GetImage() ); - const bool bUseImage = !!aImage && ( i_eItemContent != TABITEM_TEXT_ONLY ); - - const OUString sItemText( i_pPanel->GetDisplayName() ); - const bool bUseText = ( !sItemText.isEmpty() ) && ( i_eItemContent != TABITEM_IMAGE_ONLY ); - - Size aItemContentSize; - if ( bUseImage ) - { - aItemContentSize = aImage.GetSizePixel(); - } - - if ( bUseText ) - { - if ( bUseImage ) - aItemContentSize.Width() += ITEM_ICON_TEXT_DISTANCE; - - // add space for text - const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() ); - aItemContentSize.Width() += aTextSize.Width(); - aItemContentSize.Height() = ::std::max( aItemContentSize.Height(), aTextSize.Height() ); - - aItemContentSize.Width() += 2 * ITEM_TEXT_FLOW_SPACE; - } - - if ( !bUseImage && !bUseText ) - { - // have a minimal size - this is pure heuristics, but if it doesn't suit your needs, then give your panels - // a name and or image! :) - aItemContentSize = Size( 16, 16 ); - } - - aItemContentSize.Width() += 2 * ITEM_OUTER_SPACE; - aItemContentSize.Height() += 2 * ITEM_OUTER_SPACE; - - return aItemContentSize; - } - - - void PanelTabBar_Impl::impl_renderItemContent(vcl::RenderContext& rRenderContext, const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent) const - { - OSL_ENSURE(i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_renderItemContent: illegal TabItemContent value!"); - - Rectangle aRenderArea(i_rContentArea); - if (IsVertical()) - { - aRenderArea.Top() += ITEM_OUTER_SPACE; - } - else - { - aRenderArea.Left() += ITEM_OUTER_SPACE; - } - - // draw the image - const Image aItemImage(i_pPanel->GetImage()); - const Size aImageSize(aItemImage.GetSizePixel()); - const bool bUseImage = !!aItemImage && (i_eItemContent != TABITEM_TEXT_ONLY); - - if (bUseImage) - { - Point aImagePos; - if (IsVertical()) - { - aImagePos.X() = aRenderArea.Left() + (aRenderArea.GetWidth() - aImageSize.Width()) / 2; - aImagePos.Y() = aRenderArea.Top(); - } - else - { - aImagePos.X() = aRenderArea.Left(); - aImagePos.Y() = aRenderArea.Top() + (aRenderArea.GetHeight() - aImageSize.Height()) / 2; - } - rRenderContext.DrawImage(aImagePos, aItemImage); - } - - const OUString sItemText(i_pPanel->GetDisplayName()); - const bool bUseText = (!sItemText.isEmpty()) && (i_eItemContent != TABITEM_IMAGE_ONLY); - - if (bUseText) - { - if (IsVertical()) - { - if (bUseImage) - aRenderArea.Top() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE; - aRenderArea.Top() += ITEM_TEXT_FLOW_SPACE; - } - else - { - if (bUseImage) - aRenderArea.Left() += aImageSize.Width() + ITEM_ICON_TEXT_DISTANCE; - aRenderArea.Left() += ITEM_TEXT_FLOW_SPACE; - } - - // draw the text - const Size aTextSize(m_rTabBar.GetCtrlTextWidth(sItemText), rRenderContext.GetTextHeight()); - Point aTextPos(aRenderArea.TopLeft()); - if (IsVertical()) - { - rRenderContext.Push(PushFlags::FONT); - - vcl::Font aFont(rRenderContext.GetFont()); - aFont.SetOrientation(2700); - aFont.SetVertical(true); - rRenderContext.SetFont(aFont); - - aTextPos.X() += aTextSize.Height(); - aTextPos.X() += (aRenderArea.GetWidth() - aTextSize.Height()) / 2; - } - else - { - aTextPos.Y() += (aRenderArea.GetHeight() - aTextSize.Height()) / 2; - } - - rRenderContext.DrawText(aTextPos, sItemText); - - if (IsVertical()) - { - rRenderContext.Pop(); - } - } - } - - void PanelTabBar_Impl::CopyFromRenderDevice(vcl::RenderContext& rRenderContext, const Rectangle& i_rLogicalRect) const - { - BitmapEx aBitmap(m_aRenderDevice->GetBitmapEx(i_rLogicalRect.TopLeft(), - Size(i_rLogicalRect.GetSize().Width(), - i_rLogicalRect.GetSize().Height()))); - if (IsVertical()) - { - aBitmap.Rotate(2700, COL_BLACK); - if (m_eTabAlignment == TABS_LEFT) - aBitmap.Mirror(BmpMirrorFlags::Horizontal); - } - else if (m_eTabAlignment == TABS_BOTTOM) - { - aBitmap.Mirror(BmpMirrorFlags::Vertical); - } - - const Rectangle aActualRect(m_aNormalizer.getTransformed(i_rLogicalRect, m_eTabAlignment)); - rRenderContext.DrawBitmapEx(aActualRect.TopLeft(), aBitmap); - } - - - void PanelTabBar_Impl::InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags ) const - { - const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] ); - const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) | i_nAdditionalItemFlags ); - - const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) ); - const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) ); - - const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment ); - m_rTabBar.Invalidate( aActualBounds ); - } - - - ItemFlags PanelTabBar_Impl::impl_getItemFlags( const size_t i_nItemIndex ) const - { - ItemFlags nItemFlags( ITEM_STATE_NORMAL ); - if ( m_aHoveredItem == i_nItemIndex ) - { - nItemFlags |= ITEM_STATE_HOVERED; - if ( m_bMouseButtonDown ) - nItemFlags |= ITEM_STATE_ACTIVE; - } - - if ( m_rPanelDeck.GetActivePanel() == i_nItemIndex ) - nItemFlags |= ITEM_STATE_ACTIVE; - - if ( m_aFocusedItem == i_nItemIndex ) - nItemFlags |= ITEM_STATE_FOCUSED; - - if ( 0 == i_nItemIndex ) - nItemFlags |= ITEM_POSITION_FIRST; - - if ( m_rPanelDeck.GetPanelCount() - 1 == i_nItemIndex ) - nItemFlags |= ITEM_POSITION_LAST; - - return nItemFlags; - } - - - void PanelTabBar_Impl::DrawItem(vcl::RenderContext& rRenderContext, const size_t i_nItemIndex, const Rectangle& i_rBoundaries) const - { - const ItemDescriptor& rItem(m_aItems[i_nItemIndex]); - const ItemFlags nItemFlags(impl_getItemFlags(i_nItemIndex)); - - // the normalized bounding and content rect - const Rectangle aNormalizedContent(GetActualLogicalItemRect(rItem.GetCurrentRect())); - const Rectangle aNormalizedBounds(m_pRenderer->calculateDecorations(aNormalizedContent, nItemFlags)); - - // check whether the item actually overlaps with the painting area - if (!i_rBoundaries.IsEmpty()) - { - const Rectangle aItemRect(GetActualLogicalItemRect(rItem.GetCurrentRect())); - if (!aItemRect.IsOver(i_rBoundaries)) - return; - } - - m_rTabBar.SetUpdateMode(false); - - // the aligned bounding and content rect - const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment ); - const Rectangle aActualContent = m_aNormalizer.getTransformed( aNormalizedContent, m_eTabAlignment ); - - // render item "background" layer - m_pRenderer->preRenderItem(aNormalizedContent, nItemFlags); - - // copy from the virtual device to ourself - CopyFromRenderDevice(rRenderContext, aNormalizedBounds); - - // render the actual item content - impl_renderItemContent(rRenderContext, rItem.pPanel, aActualContent, rItem.eContent); - - // render item "foreground" layer - m_pRenderer->postRenderItem(m_rTabBar, aActualBounds, nItemFlags); - - m_rTabBar.SetUpdateMode(true); - } - - - void PanelTabBar_Impl::EnsureItemsCache() - { - if ( !m_bItemsDirty ) - { - DBG_CHECK( *this ); - return; - } - impl_calcItemRects(); - SAL_WARN_IF( m_bItemsDirty , "svtools", "PanelTabBar_Impl::EnsureItemsCache: cache still dirty!" ); - DBG_CHECK( *this ); - } - - - void PanelTabBar_Impl::Relayout() - { - EnsureItemsCache(); - - const Size aOutputSize( m_rTabBar.GetOutputSizePixel() ); - m_aNormalizer = NormalizedArea( Rectangle( Point(), aOutputSize ), IsVertical() ); - const Size aLogicalOutputSize( m_aNormalizer.getReferenceSize() ); - - // forward actual output size to our render device - m_aRenderDevice->SetOutputSizePixel( aLogicalOutputSize ); - - // re-calculate the size of the scroll buttons and of the items - m_aGeometry.relayout( aLogicalOutputSize, m_aItems ); - - if ( m_aGeometry.getButtonBackRect().IsEmpty() ) - { - m_aScrollBack->Hide(); - } - else - { - const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) ); - m_aScrollBack->SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); - m_aScrollBack->Show(); - } - - if ( m_aGeometry.getButtonForwardRect().IsEmpty() ) - { - m_aScrollForward->Hide(); - } - else - { - const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) ); - m_aScrollForward->SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); - m_aScrollForward->Show(); - } - - UpdateScrollButtons(); - } - - - ::boost::optional< size_t > PanelTabBar_Impl::FindItemForPoint( const Point& i_rPoint ) const - { - Point aPoint( IsVertical() ? i_rPoint.Y() : i_rPoint.X(), IsVertical() ? i_rPoint.X() : i_rPoint.Y() ); - - if ( !m_aGeometry.getItemsRect().IsInside( aPoint ) ) - return ::boost::optional< size_t >(); - - size_t i=0; - for ( ItemDescriptors::const_iterator item = m_aItems.begin(); - item != m_aItems.end(); - ++item, ++i - ) - { - Rectangle aItemRect( GetActualLogicalItemRect( item->GetCurrentRect() ) ); - if ( aItemRect.IsInside( aPoint ) ) - { - return ::boost::optional< size_t >( i ); - } - } - return ::boost::optional< size_t >(); - } - - - Rectangle PanelTabBar_Impl::GetItemScreenRect( const size_t i_nItemPos ) const - { - ENSURE_OR_RETURN( i_nItemPos < m_aItems.size(), "PanelTabBar_Impl::GetItemScreenRect: invalid item pos!", Rectangle() ); - const ItemDescriptor& rItem( m_aItems[ i_nItemPos ] ); - const Rectangle aItemRect( m_aNormalizer.getTransformed( - GetActualLogicalItemRect( rItem.GetCurrentRect() ), - m_eTabAlignment ) ); - - const Rectangle aTabBarRect( m_rTabBar.GetWindowExtentsRelative( nullptr ) ); - return Rectangle( - Point( aTabBarRect.Left() + aItemRect.Left(), aTabBarRect.Top() + aItemRect.Top() ), - aItemRect.GetSize() - ); - } - - - void PanelTabBar_Impl::FocusItem( const ::boost::optional< size_t >& i_rItemPos ) - { - // reset old focus item - if ( !!m_aFocusedItem ) - InvalidateItem( *m_aFocusedItem ); - m_aFocusedItem.reset(); - - // mark the active icon as focused - if ( !!i_rItemPos ) - { - m_aFocusedItem = i_rItemPos; - InvalidateItem( *m_aFocusedItem ); - } - } - - - IMPL_LINK_TYPED( PanelTabBar_Impl, OnScroll, Button*, pButton, void ) - { - PushButton* i_pButton = static_cast(pButton); - if ( i_pButton == m_aScrollBack.get() ) - { - OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" ); - --m_nScrollPosition; - m_rTabBar.Invalidate(); - } - else if ( i_pButton == m_aScrollForward.get() ) - { - OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" ); - ++m_nScrollPosition; - m_rTabBar.Invalidate(); - } - - UpdateScrollButtons(); - } - - - Rectangle PanelTabBar_Impl::GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const - { - // care for the offset imposed by our geometry, i.e. whether or not we have scroll buttons - Rectangle aItemRect( i_rLogicalItemRect ); - aItemRect.Move( m_aGeometry.getItemsRect().Left() - m_aGeometry.getButtonBackRect().Left(), 0 ); - - // care for the current scroll position - OSL_ENSURE( m_nScrollPosition < m_aItems.size(), "GetActualLogicalItemRect: invalid scroll position!" ); - if ( ( m_nScrollPosition > 0 ) && ( m_nScrollPosition < m_aItems.size() ) ) - { - long nOffsetX = m_aItems[ m_nScrollPosition ].GetCurrentRect().Left() - m_aItems[ 0 ].GetCurrentRect().Left(); - long nOffsetY = m_aItems[ m_nScrollPosition ].GetCurrentRect().Top() - m_aItems[ 0 ].GetCurrentRect().Top(); - aItemRect.Move( -nOffsetX, -nOffsetY ); - } - - return aItemRect; - } - - - //= PanelTabBar_Impl - - - void PanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - EnsureItemsCache(); - - if ( !!i_rOldActive ) - InvalidateItem( *i_rOldActive, ITEM_STATE_ACTIVE ); - if ( !!i_rNewActive ) - InvalidateItem( *i_rNewActive ); - } - - - void PanelTabBar_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) - { - // not interested in - (void)i_rNewLayouter; - } - - - void PanelTabBar_Impl::Dying() - { - // not interested in - the notifier is a member of this instance here, so we're dying ourself at the moment - } - - - //= PanelTabBar - - - PanelTabBar::PanelTabBar( vcl::Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :Control( &i_rParentWindow, 0 ) - ,m_pImpl( new PanelTabBar_Impl( *this, i_rPanelDeck, i_eAlignment, i_eItemContent ) ) - { - DBG_CHECK( *m_pImpl ); - } - - PanelTabBar::~PanelTabBar() - { - disposeOnce(); - } - - void PanelTabBar::dispose() - { - Control::dispose(); - } - - TabItemContent PanelTabBar::GetTabItemContent() const - { - return m_pImpl->m_aGeometry.getItemContent(); - } - - - void PanelTabBar::SetTabItemContent( const TabItemContent& i_eItemContent ) - { - m_pImpl->m_aGeometry.setItemContent( i_eItemContent ); - m_pImpl->Relayout(); - Invalidate(); - } - - - IToolPanelDeck& PanelTabBar::GetPanelDeck() const - { - DBG_CHECK( *m_pImpl ); - return m_pImpl->m_rPanelDeck; - } - - - Size PanelTabBar::GetOptimalSize() const - { - m_pImpl->EnsureItemsCache(); - Size aOptimalSize(m_pImpl->m_aGeometry.getOptimalSize(m_pImpl->m_aItems)); - if ( m_pImpl->IsVertical() ) - ::std::swap( aOptimalSize.Width(), aOptimalSize.Height() ); - return aOptimalSize; - } - - - void PanelTabBar::Resize() - { - Control::Resize(); - m_pImpl->Relayout(); - } - - - void PanelTabBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rRect) - { - m_pImpl->EnsureItemsCache(); - - // background - const Rectangle aNormalizedPaintArea(m_pImpl->m_aNormalizer.getNormalized(i_rRect, m_pImpl->m_eTabAlignment)); - m_pImpl->m_aRenderDevice->Push(PushFlags::CLIPREGION); - m_pImpl->m_aRenderDevice->SetClipRegion(vcl::Region(aNormalizedPaintArea)); - m_pImpl->m_pRenderer->renderBackground(); - m_pImpl->m_aRenderDevice->Pop(); - m_pImpl->CopyFromRenderDevice(rRenderContext, aNormalizedPaintArea); - - // ensure the items really paint into their own playground only - ClipItemRegion aClipItems(*m_pImpl); - - const Rectangle aLogicalPaintRect(m_pImpl->m_aNormalizer.getNormalized(i_rRect, m_pImpl->m_eTabAlignment)); - - const boost::optional aActivePanel(m_pImpl->m_rPanelDeck.GetActivePanel()); - const boost::optional aHoveredPanel(m_pImpl->m_aHoveredItem); - - // items: - // 1. paint all non-active, non-hovered items - size_t i = 0; - ItemDescriptors::const_iterator item; - for (item = m_pImpl->m_aItems.begin(); item != m_pImpl->m_aItems.end(); ++item, ++i) - { - if (i == aActivePanel) - continue; - - if (aHoveredPanel == i) - continue; - - m_pImpl->DrawItem(rRenderContext, i, aLogicalPaintRect); - } - - // 2. paint the item which is hovered, /without/ the mouse button pressed down - if (!!aHoveredPanel && !m_pImpl->m_bMouseButtonDown) - m_pImpl->DrawItem(rRenderContext, *aHoveredPanel, aLogicalPaintRect); - - // 3. paint the active item - if (!!aActivePanel) - m_pImpl->DrawItem(rRenderContext, *aActivePanel, aLogicalPaintRect); - - // 4. paint the item which is hovered, /with/ the mouse button pressed down - if (!!aHoveredPanel && m_pImpl->m_bMouseButtonDown) - m_pImpl->DrawItem(rRenderContext, *aHoveredPanel, aLogicalPaintRect); - } - - - void PanelTabBar::MouseMove( const MouseEvent& i_rMouseEvent ) - { - m_pImpl->EnsureItemsCache(); - - boost::optional< size_t > aOldItem(m_pImpl->m_aHoveredItem); - boost::optional< size_t > aNewItem(m_pImpl->FindItemForPoint(i_rMouseEvent.GetPosPixel())); - - if (i_rMouseEvent.IsLeaveWindow()) - aNewItem = boost::optional(); - - bool const bChanged( - ( !aOldItem && aNewItem ) - || ( aOldItem && !aNewItem ) - || ( aOldItem && aNewItem && aOldItem != aNewItem ) ); - - if (bChanged) - { - if (aOldItem) - m_pImpl->InvalidateItem( *aOldItem ); - - m_pImpl->m_aHoveredItem = aNewItem; - - if (aNewItem) - m_pImpl->InvalidateItem( *aNewItem ); - } - } - - - void PanelTabBar::MouseButtonDown( const MouseEvent& i_rMouseEvent ) - { - Control::MouseButtonDown( i_rMouseEvent ); - - if ( !i_rMouseEvent.IsLeft() ) - return; - - m_pImpl->EnsureItemsCache(); - - ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); - if ( !aHitItem ) - return; - - CaptureMouse(); - m_pImpl->m_bMouseButtonDown = true; - - m_pImpl->InvalidateItem( *aHitItem ); - } - - - void PanelTabBar::MouseButtonUp( const MouseEvent& i_rMouseEvent ) - { - Control::MouseButtonUp( i_rMouseEvent ); - - if ( m_pImpl->m_bMouseButtonDown ) - { - ::boost::optional< size_t > aHitItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) ); - if ( !!aHitItem ) - { - // re-draw that item now that we're not in mouse-down mode anymore - m_pImpl->InvalidateItem( *aHitItem ); - // activate the respective panel - m_pImpl->m_rPanelDeck.ActivatePanel( *aHitItem ); - } - - OSL_ENSURE( IsMouseCaptured(), "PanelTabBar::MouseButtonUp: inconsistency!" ); - if ( IsMouseCaptured() ) - ReleaseMouse(); - m_pImpl->m_bMouseButtonDown = false; - } - } - - - void PanelTabBar::RequestHelp( const HelpEvent& i_rHelpEvent ) - { - m_pImpl->EnsureItemsCache(); - - ::boost::optional< size_t > aHelpItem( m_pImpl->FindItemForPoint( ScreenToOutputPixel( i_rHelpEvent.GetMousePosPixel() ) ) ); - if ( !aHelpItem ) - return; - - const ItemDescriptor& rItem( m_pImpl->m_aItems[ *aHelpItem ] ); - if ( rItem.eContent != TABITEM_IMAGE_ONLY ) - // if the text is displayed for the item, we do not need to show it as tooltip - return; - - const OUString sItemText( rItem.pPanel->GetDisplayName() ); - if ( i_rHelpEvent.GetMode() == HelpEventMode::BALLOON ) - Help::ShowBalloon( this, OutputToScreenPixel( rItem.GetCurrentRect().Center() ), rItem.GetCurrentRect(), sItemText ); - else - Help::ShowQuickHelp( this, rItem.GetCurrentRect(), sItemText ); - } - - - void PanelTabBar::GetFocus() - { - Control::GetFocus(); - if ( !m_pImpl->m_aFocusedItem ) - m_pImpl->FocusItem( m_pImpl->m_rPanelDeck.GetActivePanel() ); - } - - - void PanelTabBar::LoseFocus() - { - Control::LoseFocus(); - - if ( m_pImpl ) - { - if ( !!m_pImpl->m_aFocusedItem ) - m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); - - m_pImpl->m_aFocusedItem.reset(); - } - } - - - class KeyInputHandler - { - public: - KeyInputHandler( Control& i_rControl, const KeyEvent& i_rKeyEvent ) - :m_rControl( i_rControl ) - ,m_rKeyEvent( i_rKeyEvent ) - ,m_bHandled( false ) - { - } - - ~KeyInputHandler() - { - if ( !m_bHandled ) - m_rControl.Control::KeyInput( m_rKeyEvent ); - } - - void setHandled() - { - m_bHandled = true; - } - - private: - Control& m_rControl; - const KeyEvent& m_rKeyEvent; - bool m_bHandled; - }; - - - void PanelTabBar::KeyInput( const KeyEvent& i_rKeyEvent ) - { - KeyInputHandler aKeyInputHandler( *this, i_rKeyEvent ); - - const vcl::KeyCode& rKeyCode( i_rKeyEvent.GetKeyCode() ); - if ( rKeyCode.GetModifier() != 0 ) - // only interested in mere key presses - return; - - // if there are less than 2 panels, we cannot travel them ... - const size_t nPanelCount( m_pImpl->m_rPanelDeck.GetPanelCount() ); - if ( nPanelCount < 2 ) - return; - - OSL_PRECOND( !!m_pImpl->m_aFocusedItem, "PanelTabBar::KeyInput: we should have a focused item here!" ); - // if we get KeyInput events, we should have the focus. In this case, m_aFocusedItem should not be empty, - // except if there are no panels, but then we bail out of this method here earlier ... - - bool bFocusNext = false; - bool bFocusPrev = false; - - switch ( rKeyCode.GetCode() ) - { - case KEY_UP: bFocusPrev = true; break; - case KEY_DOWN: bFocusNext = true; break; - case KEY_LEFT: - if ( IsRTLEnabled() ) - bFocusNext = true; - else - bFocusPrev = true; - break; - case KEY_RIGHT: - if ( IsRTLEnabled() ) - bFocusPrev = true; - else - bFocusNext = true; - break; - case KEY_RETURN: - m_pImpl->m_rPanelDeck.ActivatePanel( *m_pImpl->m_aFocusedItem ); - break; - } - - if ( !bFocusNext && !bFocusPrev ) - return; - - m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); - if ( bFocusNext ) - { - m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + 1 ) % nPanelCount ); - } - else - { - m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount ); - } - m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); - - // don't delegate to base class - aKeyInputHandler.setHandled(); - } - - - void PanelTabBar::DataChanged( const DataChangedEvent& i_rDataChanedEvent ) - { - Control::DataChanged( i_rDataChanedEvent ); - - if ( ( i_rDataChanedEvent.GetType() == DataChangedEventType::SETTINGS ) - && ( i_rDataChanedEvent.GetFlags() & AllSettingsFlags::STYLE ) - ) - { - Invalidate(); - } - } - - - bool PanelTabBar::IsVertical() const - { - return m_pImpl->IsVertical(); - } - - - PushButton& PanelTabBar::GetScrollButton( const bool i_bForward ) - { - return i_bForward ? *m_pImpl->m_aScrollForward.get() : *m_pImpl->m_aScrollBack.get(); - } - - - ::boost::optional< size_t > PanelTabBar::GetFocusedPanelItem() const - { - return m_pImpl->m_aFocusedItem; - } - - - void PanelTabBar::FocusPanelItem( const size_t i_nItemPos ) - { - ENSURE_OR_RETURN_VOID( i_nItemPos < m_pImpl->m_rPanelDeck.GetPanelCount(), "PanelTabBar::FocusPanelItem: illegal item pos!" ); - - if ( !HasChildPathFocus() ) - GrabFocus(); - - m_pImpl->FocusItem( i_nItemPos ); - SAL_WARN_IF( !m_pImpl->m_aFocusedItem, "svtools", "PanelTabBar::FocusPanelItem: have the focus, but no focused item?" ); - if ( !!m_pImpl->m_aFocusedItem ) - m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); - m_pImpl->m_aFocusedItem.reset( i_nItemPos ); - } - - - Rectangle PanelTabBar::GetItemScreenRect( const size_t i_nItemPos ) const - { - return m_pImpl->GetItemScreenRect( i_nItemPos ); - } - - - Reference< XWindowPeer > PanelTabBar::GetComponentInterface( bool i_bCreate ) - { - Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( false ) ); - if ( !xWindowPeer.is() && i_bCreate ) - { - xWindowPeer.set( new PanelTabBarPeer( *this ) ); - SetComponentInterface( xWindowPeer ); - } - return xWindowPeer; - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneltabbarpeer.cxx b/svtools/source/toolpanel/paneltabbarpeer.cxx deleted file mode 100644 index cc375b72b704..000000000000 --- a/svtools/source/toolpanel/paneltabbarpeer.cxx +++ /dev/null @@ -1,92 +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 "paneltabbarpeer.hxx" -#include - -#include - -#include -#include - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessibleContext; - using ::com::sun::star::lang::DisposedException; - - - //= PanelTabBarPeer - - - PanelTabBarPeer::PanelTabBarPeer( PanelTabBar& i_rTabBar ) - :VCLXWindow() - ,m_pTabBar( &i_rTabBar ) - { - } - - - PanelTabBarPeer::~PanelTabBarPeer() - { - } - - - Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext() - { - SolarMutexGuard aSolarGuard; - if ( m_pTabBar == nullptr ) - throw DisposedException( OUString(), *this ); - - - - vcl::Window* pAccessibleParent( m_pTabBar->GetAccessibleParentWindow() ); - ENSURE_OR_RETURN( pAccessibleParent != nullptr, "no accessible parent => no accessible context", nullptr ); - Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW ); - return m_aAccessibleFactory.getFactory().createAccessibleToolPanelTabBar( xAccessibleParent, m_pTabBar->GetPanelDeck(), *m_pTabBar ); - } - - - void SAL_CALL PanelTabBarPeer::dispose() throw(RuntimeException, std::exception) - { - { - SolarMutexGuard aSolarGuard; - m_pTabBar.clear(); - } - VCLXWindow::dispose(); - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/paneltabbarpeer.hxx b/svtools/source/toolpanel/paneltabbarpeer.hxx deleted file mode 100644 index 21d58b48abd9..000000000000 --- a/svtools/source/toolpanel/paneltabbarpeer.hxx +++ /dev/null @@ -1,61 +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_TOOLPANEL_PANELTABBARPEER_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_PANELTABBARPEER_HXX - -#include "svtaccessiblefactory.hxx" - -#include - - -namespace svt -{ - - - class PanelTabBar; - - //= PanelTabBarPeer - - class PanelTabBarPeer : public VCLXWindow - { - public: - explicit PanelTabBarPeer( PanelTabBar& i_rTabBar ); - - protected: - virtual ~PanelTabBarPeer(); - - // VCLXWindow overridables - virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; - - // XComponent - void SAL_CALL dispose() throw(css::uno::RuntimeException, std::exception) override; - - private: - AccessibleFactoryAccess m_aAccessibleFactory; - VclPtr m_pTabBar; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_PANELTABBARPEER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tabbargeometry.cxx b/svtools/source/toolpanel/tabbargeometry.cxx deleted file mode 100644 index da2c80043a23..000000000000 --- a/svtools/source/toolpanel/tabbargeometry.cxx +++ /dev/null @@ -1,322 +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 "tabbargeometry.hxx" - -#include -#include -#include - -#include - -#include - -// the width (or height, depending on alignment) of the scroll buttons -#define BUTTON_FLOW_WIDTH 20 -// the space between the scroll buttons and the items -#define BUTTON_FLOW_SPACE 2 -// outer space to apply between the tab bar borders and any content. Note that those refer to a "normalized" geometry, -// i.e. if the tab bar were aligned at the top -#define OUTER_SPACE_LEFT 2 -#define OUTER_SPACE_TOP 4 -#define OUTER_SPACE_RIGHT 4 -#define OUTER_SPACE_BOTTOM 2 - -// outer space to apply between the area for the items, and the actual items. They refer to a normalized geometry. -#define ITEMS_INSET_LEFT 4 -#define ITEMS_INSET_TOP 3 -#define ITEMS_INSET_RIGHT 4 -#define ITEMS_INSET_BOTTOM 0 - - -namespace svt -{ - - - - //= helper - - namespace - { - - static void lcl_transform( Rectangle& io_rRect, const ::basegfx::B2DHomMatrix& i_rTransformation ) - { - ::basegfx::B2DRange aRect( io_rRect.Left(), io_rRect.Top(), io_rRect.Right(), io_rRect.Bottom() ); - aRect.transform( i_rTransformation ); - io_rRect.Left() = long( aRect.getMinX() ); - io_rRect.Top() = long( aRect.getMinY() ); - io_rRect.Right() = long( aRect.getMaxX() ); - io_rRect.Bottom() = long( aRect.getMaxY() ); - } - - - /** transforms the given, possible rotated playground, - */ - void lcl_rotate( const Rectangle& i_rReference, Rectangle& io_rArea, const bool i_bRight ) - { - // step 1: move the to-be-upper-left corner (left/bottom) of the rectangle to (0,0) - ::basegfx::B2DHomMatrix aTransformation; - aTransformation.translate( - i_bRight ? -i_rReference.Left() : -i_rReference.Right(), - i_bRight ? -i_rReference.Bottom() : -i_rReference.Top() - ); - - // step 2: rotate by -90 degrees - aTransformation.rotate( i_bRight ? +F_PI2 : -F_PI2 ); - // note: - // on the screen, the ordinate goes top-down, while basegfx calculates in a system where the - // ordinate goes bottom-up; thus the "wrong" sign before F_PI2 here - - // step 3: move back to original coordinates - aTransformation.translate( i_rReference.Left(), i_rReference.Top() ); - - // apply transformation - lcl_transform( io_rArea, aTransformation ); - } - } - - - void lcl_mirrorHorizontally( const Rectangle& i_rReferenceArea, Rectangle& io_rArea ) - { - io_rArea.Left() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Left(); - io_rArea.Right() = i_rReferenceArea.Left() + i_rReferenceArea.Right() - io_rArea.Right(); - ::std::swap( io_rArea.Left(), io_rArea.Right() ); - } - - - void lcl_mirrorVertically( const Rectangle& i_rReferenceArea, Rectangle& io_rArea ) - { - io_rArea.Top() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Top(); - io_rArea.Bottom() = i_rReferenceArea.Top() + i_rReferenceArea.Bottom() - io_rArea.Bottom(); - ::std::swap( io_rArea.Top(), io_rArea.Bottom() ); - } - - - //= NormalizedArea - NormalizedArea::NormalizedArea() - :m_aReference() - { - } - - NormalizedArea::NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical ) - : m_aReference(i_rReference) - { - if (i_bIsVertical) - { - const long nRotatedWidth = i_rReference.GetHeight(); - const long nRotatedHeight = i_rReference.GetWidth(); - m_aReference = Rectangle(i_rReference.TopLeft(), Size(nRotatedWidth, nRotatedHeight)); - } - } - - Rectangle NormalizedArea::getTransformed( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const - { - Rectangle aResult( i_rArea ); - - if ( ( i_eTargetAlignment == TABS_RIGHT ) - || ( i_eTargetAlignment == TABS_LEFT ) - ) - { - lcl_rotate( m_aReference, aResult, true ); - - if ( i_eTargetAlignment == TABS_LEFT ) - { - Rectangle aReference( m_aReference ); - aReference.Transpose(); - lcl_mirrorHorizontally( aReference, aResult ); - } - } - else if ( i_eTargetAlignment == TABS_BOTTOM ) - { - lcl_mirrorVertically( m_aReference, aResult ); - } - - return aResult; - } - - - Rectangle NormalizedArea::getNormalized( const Rectangle& i_rArea, const TabAlignment i_eTargetAlignment ) const - { - Rectangle aResult( i_rArea ); - - if ( ( i_eTargetAlignment == TABS_RIGHT ) - || ( i_eTargetAlignment == TABS_LEFT ) - ) - { - Rectangle aReference( m_aReference ); - lcl_rotate( m_aReference, aReference, true ); - - if ( i_eTargetAlignment == TABS_LEFT ) - { - lcl_mirrorHorizontally( aReference, aResult ); - } - - lcl_rotate( aReference, aResult, false ); - } - else if ( i_eTargetAlignment == TABS_BOTTOM ) - { - lcl_mirrorVertically( m_aReference, aResult ); - } - return aResult; - } - - - //= TabBarGeometry - - - TabBarGeometry::TabBarGeometry( const TabItemContent i_eItemContent ) - :m_eTabItemContent( i_eItemContent ) - ,m_aItemsInset() - ,m_aButtonBackRect() - ,m_aItemsRect() - ,m_aButtonForwardRect() - { - m_aItemsInset.Left() = ITEMS_INSET_LEFT; - m_aItemsInset.Top() = ITEMS_INSET_TOP; - m_aItemsInset.Right() = ITEMS_INSET_RIGHT; - m_aItemsInset.Bottom() = ITEMS_INSET_BOTTOM; - } - - - TabBarGeometry::~TabBarGeometry() - { - } - - - bool TabBarGeometry::impl_fitItems( ItemDescriptors& io_rItems ) const - { - if ( io_rItems.empty() ) - // nothing to do, "no items" perfectly fit into any space we have ... - return true; - - // the available size - Size aOutputSize( getItemsRect().GetSize() ); - // shrunk by the outer space - aOutputSize.Width() -= m_aItemsInset.Right(); - aOutputSize.Height() -= m_aItemsInset.Bottom(); - const Rectangle aFitInto( Point( 0, 0 ), aOutputSize ); - - TabItemContent eItemContent( getItemContent() ); - if ( eItemContent == TABITEM_AUTO ) - { - // the "content modes" to try - TabItemContent eTryThis[] = - { - TABITEM_IMAGE_ONLY, // assumed to have the smallest rects - TABITEM_TEXT_ONLY, - TABITEM_IMAGE_AND_TEXT // assumed to have the largest rects - }; - - - // determine which of the different version fits - eItemContent = eTryThis[0]; - size_t nTryIndex = 2; - while ( nTryIndex > 0 ) - { - const Point aBottomRight( io_rItems.rbegin()->GetRect( eTryThis[ nTryIndex ] ).BottomRight() ); - if ( aFitInto.IsInside( aBottomRight ) ) - { - eItemContent = eTryThis[ nTryIndex ]; - break; - } - --nTryIndex; - } - } - - // propagate to the items - for ( ItemDescriptors::iterator item = io_rItems.begin(); - item != io_rItems.end(); - ++item - ) - { - item->eContent = eItemContent; - } - - const ItemDescriptor& rLastItem( *io_rItems.rbegin() ); - const Point aLastItemBottomRight( rLastItem.GetCurrentRect().BottomRight() ); - return aFitInto.Left() <= aLastItemBottomRight.X() - && aFitInto.Right() >= aLastItemBottomRight.X(); - } - - - Size TabBarGeometry::getOptimalSize(ItemDescriptors& io_rItems) const - { - if ( io_rItems.empty() ) - return Size( - m_aItemsInset.Left() + m_aItemsInset.Right(), - m_aItemsInset.Top() + m_aItemsInset.Bottom() - ); - - // the rect of the last item - const Rectangle& rLastItemRect(io_rItems.rbegin()->aCompleteArea); - return Size( - rLastItemRect.Left() + 1 + m_aItemsInset.Right(), - rLastItemRect.Top() + 1 + rLastItemRect.Bottom() + m_aItemsInset.Bottom() - ); - } - - - void TabBarGeometry::relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems ) - { - // assume all items fit - Point aButtonBackPos( OUTER_SPACE_LEFT, OUTER_SPACE_TOP ); - m_aButtonBackRect = Rectangle( aButtonBackPos, Size( 1, 1 ) ); - m_aButtonBackRect.SetEmpty(); - - Point aButtonForwardPos( i_rActualOutputSize.Width(), OUTER_SPACE_TOP ); - m_aButtonForwardRect = Rectangle( aButtonForwardPos, Size( 1, 1 ) ); - m_aButtonForwardRect.SetEmpty(); - - Point aItemsPos( OUTER_SPACE_LEFT, 0 ); - Size aItemsSize( i_rActualOutputSize.Width() - OUTER_SPACE_LEFT - OUTER_SPACE_RIGHT, i_rActualOutputSize.Height() ); - m_aItemsRect = Rectangle( aItemsPos, aItemsSize ); - - if ( !impl_fitItems( io_rItems ) ) - { - // assumption was wrong, the items do not fit => calculate rects for the scroll buttons - const Size aButtonSize( BUTTON_FLOW_WIDTH, i_rActualOutputSize.Height() - OUTER_SPACE_TOP - OUTER_SPACE_BOTTOM ); - - aButtonBackPos = Point( OUTER_SPACE_LEFT, OUTER_SPACE_TOP ); - m_aButtonBackRect = Rectangle( aButtonBackPos, aButtonSize ); - - aButtonForwardPos = Point( i_rActualOutputSize.Width() - BUTTON_FLOW_WIDTH - OUTER_SPACE_RIGHT, OUTER_SPACE_TOP ); - m_aButtonForwardRect = Rectangle( aButtonForwardPos, aButtonSize ); - - aItemsPos.X() = aButtonBackPos.X() + aButtonSize.Width() + BUTTON_FLOW_SPACE; - aItemsSize.Width() = aButtonForwardPos.X() - BUTTON_FLOW_SPACE - aItemsPos.X(); - m_aItemsRect = Rectangle( aItemsPos, aItemsSize ); - - // fit items, again. In the TABITEM_AUTO case, the smaller playground for the items might lead to another - // item content. - impl_fitItems( io_rItems ); - } - } - - - Point TabBarGeometry::getFirstItemPosition() const - { - return Point( m_aItemsInset.Left(), m_aItemsInset.Top() ); - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tabbargeometry.hxx b/svtools/source/toolpanel/tabbargeometry.hxx deleted file mode 100644 index a51465a660dd..000000000000 --- a/svtools/source/toolpanel/tabbargeometry.hxx +++ /dev/null @@ -1,128 +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_TOOLPANEL_TABBARGEOMETRY_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TABBARGEOMETRY_HXX - -#include - -#include "tabitemdescriptor.hxx" - -#include -#include - - -namespace svt -{ - - - - //= NormalizedArea - - /** a rectangle which automatically translates between unrotated and rotated geometry. - - It can be operated as if it were an unrotated area, but is able to provide corrdinates of rotated objects, - relative to its playground. - */ - class NormalizedArea - { - public: - NormalizedArea(); - NormalizedArea( const Rectangle& i_rReference, const bool i_bIsVertical ); - - /** transforms a rectangle, relative to our playground, into a coordinate system defined by the given alignment - @param i_rArea - the area which is to be transformed. - */ - Rectangle getTransformed( - const Rectangle& i_rArea, - const TabAlignment i_eTargetAlignment - ) const; - - /** normalizes an already transformed rectangle - @param i_rArea - the area which is to be normalized. - */ - Rectangle getNormalized( - const Rectangle& i_rArea, - const TabAlignment i_eTargetAlignment - ) const; - - Size getReferenceSize() const { return m_aReference.GetSize(); } - - private: - // the normalized reference area - Rectangle m_aReference; - }; - - - //= TabBarGeometry - - class TabBarGeometry - { - public: - explicit TabBarGeometry( const TabItemContent i_eItemContent ); - ~TabBarGeometry(); - - // retrieves the rectangle to be occupied by the button for scrolling backward through the items - const Rectangle& getButtonBackRect() const { return m_aButtonBackRect; } - // retrieves the rectangle to be occupied by the items - const Rectangle& getItemsRect() const { return m_aItemsRect; } - // retrieves the rectangle to be occupied by the button for scrolling forward through the items - const Rectangle& getButtonForwardRect() const { return m_aButtonForwardRect; } - - inline TabItemContent - getItemContent() const { return m_eTabItemContent; } - inline void setItemContent( const TabItemContent i_eItemContent ) { m_eTabItemContent = i_eItemContent; } - - /** adjusts the sizes of the buttons and the item's playground, plus the sizes of the items - */ - void relayout( const Size& i_rActualOutputSize, ItemDescriptors& io_rItems ); - - /** calculates the optimal size of the tab bar, depending on the item's sizes - */ - Size getOptimalSize(ItemDescriptors& io_rItems) const; - - /** retrieves the position where the first item should start, relative to the item rect - */ - Point getFirstItemPosition() const; - - private: - bool impl_fitItems( ItemDescriptors& io_rItems ) const; - - private: - /// specifies the content to be displayed in the tab items - TabItemContent m_eTabItemContent; - /// specifies the inset to be used in the items area, depends on the actual alignment - SvBorder m_aItemsInset; - // the (logical) rectangle to be used for the "back" button, empty if the button is not needed - Rectangle m_aButtonBackRect; - // the (logical) rectangle to be used for the items - Rectangle m_aItemsRect; - // the (logical) rectangle to be used for the "forward" button, empty if the button is not needed - Rectangle m_aButtonForwardRect; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TABBARGEOMETRY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tabitemdescriptor.hxx b/svtools/source/toolpanel/tabitemdescriptor.hxx deleted file mode 100644 index 614d2eb75b1a..000000000000 --- a/svtools/source/toolpanel/tabitemdescriptor.hxx +++ /dev/null @@ -1,85 +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_TOOLPANEL_TABITEMDESCRIPTOR_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TABITEMDESCRIPTOR_HXX - -#include -#include - -#include -#include - -#include - - -namespace svt -{ - - - - //= ItemDescriptor - - struct ItemDescriptor - { - PToolPanel pPanel; - Rectangle aCompleteArea; // bounding area if the both text and icon are to be rendererd - Rectangle aIconOnlyArea; // bounding area if the icon is to be rendererd - Rectangle aTextOnlyArea; // bounding area if the text is to be rendererd - TabItemContent eContent; - // content to be used for this particular item. Might differ from item content which has been set - // up for the complete control, in case not the complete content fits into the available space. - - ItemDescriptor() - :pPanel() - ,aCompleteArea() - ,aIconOnlyArea() - ,aTextOnlyArea() - ,eContent( TABITEM_IMAGE_AND_TEXT ) - { - } - - const Rectangle& GetRect( const TabItemContent i_eItemContent ) const - { - OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "ItemDescriptor::GetRect: illegal value!" ); - - return ( i_eItemContent == TABITEM_IMAGE_AND_TEXT ) - ? aCompleteArea - : ( ( i_eItemContent == TABITEM_TEXT_ONLY ) - ? aTextOnlyArea - : aIconOnlyArea - ); - } - - const Rectangle& GetCurrentRect() const - { - return GetRect( eContent ); - } - }; - - typedef ::std::vector< ItemDescriptor > ItemDescriptors; - - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TABITEMDESCRIPTOR_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx deleted file mode 100644 index 6a4e4749b23c..000000000000 --- a/svtools/source/toolpanel/tablayouter.cxx +++ /dev/null @@ -1,205 +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 -#include -#include -#include "svtaccessiblefactory.hxx" - -#include -#include - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::accessibility::XAccessible; - - - //= TabDeckLayouter_Data - - struct TabDeckLayouter_Data - { - TabAlignment eAlignment; - VclPtr< PanelTabBar > pTabBar; - AccessibleFactoryAccess aAccessibleFactory; - - TabDeckLayouter_Data( vcl::Window& i_rParent, IToolPanelDeck& i_rPanels, - const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :eAlignment( i_eAlignment ) - ,pTabBar( VclPtr::Create( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) ) - { - pTabBar->Show(); - } - }; - - - //= helper - - namespace - { - static bool lcl_isVerticalTabBar( const TabAlignment i_eAlignment ) - { - return ( i_eAlignment == TABS_RIGHT ) - || ( i_eAlignment == TABS_LEFT ); - } - - static bool lcl_checkDisposed( const TabDeckLayouter_Data& i_rData ) - { - if ( !i_rData.pTabBar.get() ) - { - OSL_FAIL( "lcl_checkDisposed: already disposed!" ); - return true; - } - return false; - } - } - - - //= TabDeckLayouter - - - TabDeckLayouter::TabDeckLayouter( vcl::Window& i_rParent, IToolPanelDeck& i_rPanels, - const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ) - :m_pData( new TabDeckLayouter_Data( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) ) - { - } - - - TabDeckLayouter::~TabDeckLayouter() - { - } - - - TabItemContent TabDeckLayouter::GetTabItemContent() const - { - if ( lcl_checkDisposed( *m_pData ) ) - return TABITEM_IMAGE_AND_TEXT; - return m_pData->pTabBar->GetTabItemContent(); - } - - - void TabDeckLayouter::SetTabItemContent( const TabItemContent& i_eItemContent ) - { - if ( lcl_checkDisposed( *m_pData ) ) - return; - m_pData->pTabBar->SetTabItemContent( i_eItemContent ); - } - - - TabAlignment TabDeckLayouter::GetTabAlignment() const - { - if ( lcl_checkDisposed( *m_pData ) ) - return TABS_RIGHT; - return m_pData->eAlignment; - } - - - Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground ) - { - if ( lcl_checkDisposed( *m_pData ) ) - return i_rDeckPlayground; - - const Size aPreferredSize(m_pData->pTabBar->GetOptimalSize()); - if ( lcl_isVerticalTabBar( m_pData->eAlignment ) ) - { - Size aTabBarSize(aPreferredSize.Width(), i_rDeckPlayground.GetHeight()); - - Rectangle aPanelRect( i_rDeckPlayground ); - if ( m_pData->eAlignment == TABS_RIGHT ) - { - aPanelRect.Right() -= aTabBarSize.Width(); - Point aTabBarTopLeft( aPanelRect.TopRight() ); - aTabBarTopLeft.X() += 1; - m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize ); - } - else - { - m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize ); - aPanelRect.Left() += aTabBarSize.Width(); - } - if ( aPanelRect.Left() >= aPanelRect.Right() ) - aPanelRect = Rectangle(); - - return aPanelRect; - } - - Size aTabBarSize(i_rDeckPlayground.GetWidth(), aPreferredSize.Height()); - - Rectangle aPanelRect( i_rDeckPlayground ); - if ( m_pData->eAlignment == TABS_TOP ) - { - m_pData->pTabBar->SetPosSizePixel( aPanelRect.TopLeft(), aTabBarSize ); - aPanelRect.Top() += aTabBarSize.Height(); - } - else - { - aPanelRect.Bottom() -= aTabBarSize.Height(); - Point aTabBarTopLeft( aPanelRect.BottomLeft() ); - aTabBarTopLeft.Y() -= 1; - m_pData->pTabBar->SetPosSizePixel( aTabBarTopLeft, aTabBarSize ); - } - if ( aPanelRect.Top() >= aPanelRect.Bottom() ) - aPanelRect = Rectangle(); - - return aPanelRect; - } - - - void TabDeckLayouter::Destroy() - { - m_pData->pTabBar.reset(); - } - - - void TabDeckLayouter::SetFocusToPanelSelector() - { - if ( lcl_checkDisposed( *m_pData ) ) - return; - m_pData->pTabBar->GrabFocus(); - } - - - size_t TabDeckLayouter::GetAccessibleChildCount() const - { - if ( lcl_checkDisposed( *m_pData ) ) - return 0; - - return 1; - } - - - Reference< XAccessible > TabDeckLayouter::GetAccessibleChild( const size_t i_nChildIndex, const Reference< XAccessible >& i_rParentAccessible ) - { - (void)i_nChildIndex; - (void)i_rParentAccessible; - if ( lcl_checkDisposed( *m_pData ) ) - return nullptr; - - return m_pData->pTabBar->GetAccessible(); - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx deleted file mode 100644 index 59185651f733..000000000000 --- a/svtools/source/toolpanel/toolpanel.cxx +++ /dev/null @@ -1,44 +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 - - -namespace svt -{ - - - - //= ToolPanelBase - - - ToolPanelBase::ToolPanelBase() - { - } - - - ToolPanelBase::~ToolPanelBase() - { - } - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpanel.src b/svtools/source/toolpanel/toolpanel.src deleted file mode 100644 index 7dbf74a8240b..000000000000 --- a/svtools/source/toolpanel/toolpanel.src +++ /dev/null @@ -1,42 +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/svtools.hrc" - -String STR_SVT_TOOL_PANEL_BUTTON_FWD -{ - Text [ en-US ] = "Tab Panel Scroll Button, backward"; -}; - -String STR_SVT_TOOL_PANEL_BUTTON_BACK -{ - Text [ en-US ] = "Tab Panel Scroll Button, forward"; -}; - -Image IMG_TRIANGLE_RIGHT -{ - ImageBitmap = Bitmap { File = "triangle_right.png"; }; -}; - -Image IMG_TRIANGLE_DOWN -{ - ImageBitmap = Bitmap { File = "triangle_down.png"; }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx deleted file mode 100644 index c6491dc621ff..000000000000 --- a/svtools/source/toolpanel/toolpanelcollection.cxx +++ /dev/null @@ -1,187 +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 "toolpanelcollection.hxx" -#include "paneldecklisteners.hxx" - -#include - -#include - - -namespace svt -{ - - - - //= ToolPanelCollection_Data - - struct ToolPanelCollection_Data - { - ::std::vector< PToolPanel > aPanels; - ::boost::optional< size_t > aActivePanel; - PanelDeckListeners aListeners; - }; - - - //= ToolPanelCollection - - - ToolPanelCollection::ToolPanelCollection() - :m_pData( new ToolPanelCollection_Data ) - { - } - - - ToolPanelCollection::~ToolPanelCollection() - { - m_pData->aListeners.Dying(); - } - - - size_t ToolPanelCollection::GetPanelCount() const - { - return m_pData->aPanels.size(); - } - - - ::boost::optional< size_t > ToolPanelCollection::GetActivePanel() const - { - return m_pData->aActivePanel; - } - - - void ToolPanelCollection::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) - { - if ( !!i_rPanel ) - { - OSL_ENSURE( *i_rPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" ); - if ( *i_rPanel >= GetPanelCount() ) - return; - } - - if ( m_pData->aActivePanel == i_rPanel ) - return; - - const ::boost::optional< size_t > aOldPanel( m_pData->aActivePanel ); - m_pData->aActivePanel = i_rPanel; - - // notify listeners - m_pData->aListeners.ActivePanelChanged( aOldPanel, m_pData->aActivePanel ); - } - - - PToolPanel ToolPanelCollection::GetPanel( const size_t i_nPos ) const - { - OSL_ENSURE( i_nPos < m_pData->aPanels.size(), "ToolPanelCollection::GetPanel: illegal position!" ); - if ( i_nPos >= m_pData->aPanels.size() ) - return PToolPanel(); - return m_pData->aPanels[ i_nPos ]; - } - - - size_t ToolPanelCollection::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) - { - OSL_ENSURE( i_pPanel.get(), "ToolPanelCollection::InsertPanel: illegal panel!" ); - if ( !i_pPanel.get() ) - return 0; - - // insert - const size_t position = i_nPosition < m_pData->aPanels.size() ? i_nPosition : m_pData->aPanels.size(); - m_pData->aPanels.insert( m_pData->aPanels.begin() + position, i_pPanel ); - - // update active panel - if ( !!m_pData->aActivePanel ) - { - if ( i_nPosition <= *m_pData->aActivePanel ) - ++*m_pData->aActivePanel; - } - - // notifications - m_pData->aListeners.PanelInserted( i_pPanel, i_nPosition ); - - return position; - } - - - PToolPanel ToolPanelCollection::RemovePanel( const size_t i_nPosition ) - { - OSL_ENSURE( i_nPosition < m_pData->aPanels.size(), "ToolPanelCollection::RemovePanel: illegal position!" ); - if ( i_nPosition >= m_pData->aPanels.size() ) - return nullptr; - - // if the active panel is going to be removed, activate another one (before the actual removal) - if ( m_pData->aActivePanel == i_nPosition ) - { - const ::boost::optional< size_t > aOldActive( m_pData->aActivePanel ); - - if ( i_nPosition + 1 < GetPanelCount() ) - { - ++*m_pData->aActivePanel; - } - else if ( i_nPosition > 0 ) - { - --*m_pData->aActivePanel; - } - else - { - m_pData->aActivePanel.reset(); - } - - m_pData->aListeners.ActivePanelChanged( aOldActive, m_pData->aActivePanel ); - } - - // remember the removed panel for the aller - PToolPanel pRemovedPanel( m_pData->aPanels[ i_nPosition ] ); - - // actually remove - m_pData->aPanels.erase( m_pData->aPanels.begin() + i_nPosition ); - - if ( !!m_pData->aActivePanel ) - { - if ( i_nPosition < *m_pData->aActivePanel ) - { - --*m_pData->aActivePanel; - } - } - - // notify removed panel - m_pData->aListeners.PanelRemoved( i_nPosition ); - - return pRemovedPanel; - } - - - void ToolPanelCollection::AddListener( IToolPanelDeckListener& i_rListener ) - { - m_pData->aListeners.AddListener( i_rListener ); - } - - - void ToolPanelCollection::RemoveListener( IToolPanelDeckListener& i_rListener ) - { - m_pData->aListeners.RemoveListener( i_rListener ); - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx deleted file mode 100644 index 73ed96085239..000000000000 --- a/svtools/source/toolpanel/toolpanelcollection.hxx +++ /dev/null @@ -1,64 +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_TOOLPANEL_TOOLPANELCOLLECTION_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELCOLLECTION_HXX - -#include - -#include - - -namespace svt -{ - - - struct ToolPanelCollection_Data; - - - //= ToolPanelCollection - - class ToolPanelCollection : public IToolPanelDeck - { - public: - ToolPanelCollection(); - virtual ~ToolPanelCollection(); - - // IToolPanelDeck - virtual size_t GetPanelCount() const override; - virtual PToolPanel GetPanel( const size_t i_nPos ) const override; - virtual ::boost::optional< size_t > - GetActivePanel() const override; - virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) override; - virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual PToolPanel RemovePanel( const size_t i_nPosition ) override; - virtual void AddListener( IToolPanelDeckListener& i_rListener ) override; - virtual void RemoveListener( IToolPanelDeckListener& i_rListener ) override; - - private: - ::std::unique_ptr< ToolPanelCollection_Data > m_pData; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELCOLLECTION_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx deleted file mode 100644 index 71ca2ae78a4d..000000000000 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ /dev/null @@ -1,529 +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 "dummypanel.hxx" -#include "toolpanelcollection.hxx" -#include "paneldecklisteners.hxx" -#include "toolpaneldeckpeer.hxx" -#include -#include -#include - -#include -#include - -#include -#include - -#include - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::accessibility::XAccessible; - using ::com::sun::star::awt::XWindowPeer; - using ::com::sun::star::uno::UNO_SET_THROW; - - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - - enum DeckAction - { - /// activates the first panel - ACTION_ACTIVATE_FIRST, - // activates the panel after the currently active panel - ACTION_ACTIVATE_NEXT, - // activates the panel before the currently active panel - ACTION_ACTIVATE_PREV, - // activates the last panel - ACTION_ACTIVATE_LAST, - - // toggles the focus between the active panel and the panel selector - ACTION_TOGGLE_FOCUS, - }; - - - //= ToolPanelDeck_Impl - - class ToolPanelDeck_Impl : public IToolPanelDeckListener - { - public: - explicit ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) - :m_rDeck( i_rDeck ) - ,m_aPanelAnchor( VclPtr::Create(&i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL) ) - ,m_aPanels() - ,m_pDummyPanel( new DummyPanel ) - ,m_pLayouter() - ,m_bInDtor( false ) - { - m_aPanels.AddListener( *this ); - m_aPanelAnchor->Show(); - m_aPanelAnchor->SetAccessibleRole( AccessibleRole::PANEL ); - } - - virtual ~ToolPanelDeck_Impl() - { - m_bInDtor = true; - } - - PDeckLayouter GetLayouter() const { return m_pLayouter; } - void SetLayouter( const PDeckLayouter& i_pNewLayouter ); - - vcl::Window& GetPanelWindowAnchor() { return *m_aPanelAnchor.get(); } - - bool IsDead() const { return m_bInDtor; } - - /// notifies our listeners that we're going to die. Only to be called from with our anti-impl's destructor - void NotifyDying() - { - m_aPanels.RemoveListener( *this ); - m_aListeners.Dying(); - } - - // IToolPanelDeck equivalents - size_t GetPanelCount() const; - PToolPanel GetPanel( const size_t i_nPos ) const; - ::boost::optional< size_t > - GetActivePanel() const; - void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ); - size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); - PToolPanel RemovePanel( const size_t i_nPosition ); - void AddListener( IToolPanelDeckListener& i_rListener ); - void RemoveListener( IToolPanelDeckListener& i_rListener ); - - /// re-layouts everything - void LayoutAll() { ImplDoLayout(); } - - void DoAction( const DeckAction i_eAction ); - - bool FocusActivePanel(); - - protected: - // IToolPanelDeckListener - virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) override; - virtual void PanelRemoved( const size_t i_nPosition ) override; - virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) override; - virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) override; - virtual void Dying() override; - - private: - void ImplDoLayout(); - PToolPanel GetActiveOrDummyPanel_Impl(); - - private: - ToolPanelDeck& m_rDeck; - VclPtr m_aPanelAnchor; - ToolPanelCollection m_aPanels; - PToolPanel m_pDummyPanel; - PanelDeckListeners m_aListeners; - PDeckLayouter m_pLayouter; - bool m_bInDtor; - }; - - - PToolPanel ToolPanelDeck_Impl::GetActiveOrDummyPanel_Impl() - { - ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() ); - if ( !aActivePanel ) - return m_pDummyPanel; - return m_aPanels.GetPanel( *aActivePanel ); - } - - - void ToolPanelDeck_Impl::SetLayouter( const PDeckLayouter& i_pNewLayouter ) - { - ENSURE_OR_RETURN_VOID( i_pNewLayouter.get(), "invalid layouter" ); - - if ( m_pLayouter.get() ) - m_pLayouter->Destroy(); - - m_pLayouter = i_pNewLayouter; - - ImplDoLayout(); - - m_aListeners.LayouterChanged( m_pLayouter ); - } - - - size_t ToolPanelDeck_Impl::GetPanelCount() const - { - return m_aPanels.GetPanelCount(); - } - - - PToolPanel ToolPanelDeck_Impl::GetPanel( const size_t i_nPos ) const - { - return m_aPanels.GetPanel( i_nPos ); - } - - - ::boost::optional< size_t > ToolPanelDeck_Impl::GetActivePanel() const - { - return m_aPanels.GetActivePanel(); - } - - - void ToolPanelDeck_Impl::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) - { - m_aPanels.ActivatePanel( i_rPanel ); - } - - - size_t ToolPanelDeck_Impl::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) - { - return m_aPanels.InsertPanel( i_pPanel, i_nPosition ); - } - - - PToolPanel ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition ) - { - return m_aPanels.RemovePanel( i_nPosition ); - } - - - void ToolPanelDeck_Impl::ImplDoLayout() - { - const Rectangle aDeckPlayground( Point(), m_rDeck.GetOutputSizePixel() ); - - // ask the layouter what is left for our panel, and position the panel container window appropriately - Rectangle aPlaygroundArea( aDeckPlayground ); - OSL_ENSURE( m_pLayouter.get(), "ToolPanelDeck_Impl::ImplDoLayout: no layouter!" ); - if ( m_pLayouter.get() ) - { - aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground ); - } - m_aPanelAnchor->SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() ); - - // position the active panel - const PToolPanel pActive( GetActiveOrDummyPanel_Impl() ); - pActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() ); - } - - - void ToolPanelDeck_Impl::AddListener( IToolPanelDeckListener& i_rListener ) - { - m_aListeners.AddListener( i_rListener ); - } - - - void ToolPanelDeck_Impl::RemoveListener( IToolPanelDeckListener& i_rListener ) - { - m_aListeners.RemoveListener( i_rListener ); - } - - - void ToolPanelDeck_Impl::DoAction( const DeckAction i_eAction ) - { - const size_t nPanelCount( m_aPanels.GetPanelCount() ); - ::boost::optional< size_t > aActivatePanel; - ::boost::optional< size_t > aCurrentPanel( GetActivePanel() ); - - switch ( i_eAction ) - { - case ACTION_ACTIVATE_FIRST: - if ( nPanelCount > 0 ) - aActivatePanel = 0; - break; - case ACTION_ACTIVATE_PREV: - if ( !aCurrentPanel && ( nPanelCount > 0 ) ) - aActivatePanel = nPanelCount - 1; - else if ( !!aCurrentPanel && ( *aCurrentPanel > 0 ) ) - aActivatePanel = *aCurrentPanel - 1; - break; - case ACTION_ACTIVATE_NEXT: - if ( !aCurrentPanel && ( nPanelCount > 0 ) ) - aActivatePanel = 0; - else if ( !!aCurrentPanel && ( *aCurrentPanel < nPanelCount - 1 ) ) - aActivatePanel = *aCurrentPanel + 1; - break; - case ACTION_ACTIVATE_LAST: - if ( nPanelCount > 0 ) - aActivatePanel = nPanelCount - 1; - break; - case ACTION_TOGGLE_FOCUS: - { - PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() ); - if ( !m_aPanelAnchor->HasChildPathFocus() ) - pActivePanel->GrabFocus(); - else - GetLayouter()->SetFocusToPanelSelector(); - } - break; - } - - if ( !!aActivatePanel ) - { - ActivatePanel( aActivatePanel ); - } - } - - - bool ToolPanelDeck_Impl::FocusActivePanel() - { - ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() ); - if ( !aActivePanel ) - return false; - - PToolPanel pActivePanel( m_aPanels.GetPanel( *aActivePanel ) ); - pActivePanel->GrabFocus(); - return true; - } - - - void ToolPanelDeck_Impl::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) - { - // multiplex to our own listeners - m_aListeners.PanelInserted( i_pPanel, i_nPosition ); - } - - - void ToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition ) - { - // multiplex to our own listeners - m_aListeners.PanelRemoved( i_nPosition ); - } - - - void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) - { - // hide the old panel - if ( !!i_rOldActive ) - { - const PToolPanel pOldActive( m_aPanels.GetPanel( *i_rOldActive ) ); - pOldActive->Deactivate(); - } - - // position and show the new panel - const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) ); - pNewActive->Activate( *m_aPanelAnchor.get() ); - pNewActive->GrabFocus(); - - // resize the panel (cannot guarantee it has ever been resized before - pNewActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() ); - - // multiplex to our own listeners - m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive ); - } - - - void ToolPanelDeck_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter ) - { - // not interested in - (void)i_rNewLayouter; - } - - - void ToolPanelDeck_Impl::Dying() - { - // not interested in. Since the ToolPanelCollection is our member, this just means we ourself - // are dying, and we already sent this notification in our dtor. - } - - - //= ToolPanelDeck - - - ToolPanelDeck::ToolPanelDeck( vcl::Window& i_rParent, const WinBits i_nStyle ) - :Control( &i_rParent, i_nStyle ) - ,m_pImpl( new ToolPanelDeck_Impl( *this ) ) - { - // use a default layouter -// SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) ); - SetLayouter( PDeckLayouter( new DrawerDeckLayouter( *this, *this ) ) ); - } - - - ToolPanelDeck::~ToolPanelDeck() - { - disposeOnce(); - } - - void ToolPanelDeck::dispose() - { - m_pImpl->NotifyDying(); - GetLayouter()->Destroy(); - - Hide(); - for ( size_t i=0; iDispose(); - } - Control::dispose(); - } - - - size_t ToolPanelDeck::GetPanelCount() const - { - return m_pImpl->GetPanelCount(); - } - - - PToolPanel ToolPanelDeck::GetPanel( const size_t i_nPos ) const - { - return m_pImpl->GetPanel( i_nPos ); - } - - - ::boost::optional< size_t > ToolPanelDeck::GetActivePanel() const - { - return m_pImpl->GetActivePanel(); - } - - - void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel ) - { - m_pImpl->ActivatePanel( i_rPanel ); - } - - - size_t ToolPanelDeck::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ) - { - return m_pImpl->InsertPanel( i_pPanel, i_nPosition ); - } - - - PToolPanel ToolPanelDeck::RemovePanel( const size_t i_nPosition ) - { - return m_pImpl->RemovePanel( i_nPosition ); - } - - - PDeckLayouter ToolPanelDeck::GetLayouter() const - { - return m_pImpl->GetLayouter(); - } - - - void ToolPanelDeck::SetLayouter( const PDeckLayouter& i_pNewLayouter ) - { - return m_pImpl->SetLayouter( i_pNewLayouter ); - } - - - void ToolPanelDeck::AddListener( IToolPanelDeckListener& i_rListener ) - { - m_pImpl->AddListener( i_rListener ); - } - - - void ToolPanelDeck::RemoveListener( IToolPanelDeckListener& i_rListener ) - { - m_pImpl->RemoveListener( i_rListener ); - } - - - vcl::Window& ToolPanelDeck::GetPanelWindowAnchor() - { - return m_pImpl->GetPanelWindowAnchor(); - } - - - const vcl::Window& ToolPanelDeck::GetPanelWindowAnchor() const - { - return m_pImpl->GetPanelWindowAnchor(); - } - - - void ToolPanelDeck::Resize() - { - Control::Resize(); - m_pImpl->LayoutAll(); - } - - - bool ToolPanelDeck::Notify( NotifyEvent& i_rNotifyEvent ) - { - bool bHandled = false; - if ( i_rNotifyEvent.GetType() == MouseNotifyEvent::KEYINPUT ) - { - const KeyEvent* pEvent = i_rNotifyEvent.GetKeyEvent(); - const vcl::KeyCode& rKeyCode = pEvent->GetKeyCode(); - if ( rKeyCode.GetModifier() == KEY_MOD1 ) - { - bHandled = true; - switch ( rKeyCode.GetCode() ) - { - case KEY_HOME: - m_pImpl->DoAction( ACTION_ACTIVATE_FIRST ); - break; - case KEY_PAGEUP: - m_pImpl->DoAction( ACTION_ACTIVATE_PREV ); - break; - case KEY_PAGEDOWN: - m_pImpl->DoAction( ACTION_ACTIVATE_NEXT ); - break; - case KEY_END: - m_pImpl->DoAction( ACTION_ACTIVATE_LAST ); - break; - default: - bHandled = false; - break; - } - } - else if ( rKeyCode.GetModifier() == ( KEY_MOD1 | KEY_SHIFT ) ) - { - if ( rKeyCode.GetCode() == KEY_E ) - { - m_pImpl->DoAction( ACTION_TOGGLE_FOCUS ); - bHandled = true; - } - } - } - - if ( bHandled ) - return true; - - return Control::Notify( i_rNotifyEvent ); - } - - - void ToolPanelDeck::GetFocus() - { - Control::GetFocus(); - if ( m_pImpl->IsDead() ) - return; - if ( !m_pImpl->FocusActivePanel() ) - { - PDeckLayouter pLayouter( GetLayouter() ); - ENSURE_OR_RETURN_VOID( pLayouter.get(), "ToolPanelDeck::GetFocus: no layouter?!" ); - pLayouter->SetFocusToPanelSelector(); - } - } - - - Reference< XWindowPeer > ToolPanelDeck::GetComponentInterface( bool i_bCreate ) - { - Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( false ) ); - if ( !xWindowPeer.is() && i_bCreate ) - { - xWindowPeer.set( new ToolPanelDeckPeer( *this ) ); - SetComponentInterface( xWindowPeer ); - } - return xWindowPeer; - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.cxx b/svtools/source/toolpanel/toolpaneldeckpeer.cxx deleted file mode 100644 index 37b79453a335..000000000000 --- a/svtools/source/toolpanel/toolpaneldeckpeer.cxx +++ /dev/null @@ -1,90 +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 "toolpaneldeckpeer.hxx" -#include - -#include - -#include -#include - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessibleContext; - using ::com::sun::star::lang::DisposedException; - - - //= ToolPanelDeckPeer - - - ToolPanelDeckPeer::ToolPanelDeckPeer( ToolPanelDeck& i_rDeck ) - :VCLXWindow() - ,m_pDeck( &i_rDeck ) - { - } - - - ToolPanelDeckPeer::~ToolPanelDeckPeer() - { - } - - - Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext() - { - SolarMutexGuard aSolarGuard; - if ( m_pDeck == nullptr ) - throw DisposedException( OUString(), *this ); - - vcl::Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() ); - ENSURE_OR_RETURN( pAccessibleParent != nullptr, "no accessible parent => no accessible context", nullptr ); - Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW ); - return m_aAccessibleFactory.getFactory().createAccessibleToolPanelDeck( xAccessibleParent, *m_pDeck ); - } - - - void SAL_CALL ToolPanelDeckPeer::dispose() throw(RuntimeException, std::exception) - { - { - SolarMutexGuard aSolarGuard; - m_pDeck.clear(); - } - VCLXWindow::dispose(); - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldeckpeer.hxx b/svtools/source/toolpanel/toolpaneldeckpeer.hxx deleted file mode 100644 index cb44ff7984f3..000000000000 --- a/svtools/source/toolpanel/toolpaneldeckpeer.hxx +++ /dev/null @@ -1,61 +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_TOOLPANEL_TOOLPANELDECKPEER_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDECKPEER_HXX - -#include "svtaccessiblefactory.hxx" - -#include - - -namespace svt -{ - - - class ToolPanelDeck; - - //= ToolPanelDeckPeer - - class ToolPanelDeckPeer : public VCLXWindow - { - public: - explicit ToolPanelDeckPeer( ToolPanelDeck& i_rDeck ); - - protected: - virtual ~ToolPanelDeckPeer(); - - // VCLXWindow overridables - virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; - - // XComponent - void SAL_CALL dispose() throw(css::uno::RuntimeException, std::exception) override; - - private: - AccessibleFactoryAccess m_aAccessibleFactory; - VclPtr m_pDeck; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDECKPEER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx deleted file mode 100644 index bc58461b5d4a..000000000000 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ /dev/null @@ -1,352 +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 "toolpaneldrawer.hxx" -#include "toolpaneldrawerpeer.hxx" -#include -#include - -#include - -#include -#include -#include -#include -#include - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::awt::XWindowPeer; - namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; - - static const int s_nIndentationWidth = 16; - - - //= DrawerVisualization - - - DrawerVisualization::DrawerVisualization( ToolPanelDrawer& i_rParent ) - :Window( &i_rParent ) - ,m_rDrawer( i_rParent ) - { - SetMouseTransparent( true ); - Show(); - SetAccessibleRole( AccessibleRole::LABEL ); - } - - - void DrawerVisualization::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rBoundingBox) - { - Window::Paint(rRenderContext, i_rBoundingBox); - m_rDrawer.Paint(rRenderContext); - } - - - //= ToolPanelDrawer - - - ToolPanelDrawer::ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle ) - :Window( &i_rParent, WB_TABSTOP ) - ,m_pPaintDevice( VclPtr::Create( *this ) ) - ,m_aVisualization( VclPtr::Create(*this) ) - ,m_bFocused( false ) - ,m_bExpanded( false ) - { - EnableMapMode( false ); - SetBackground( Wallpaper() ); - SetPointer( PointerStyle::RefHand ); - - SetAccessibleRole( AccessibleRole::LIST_ITEM ); - - SetText( i_rTitle ); - SetAccessibleName( i_rTitle ); - SetAccessibleDescription( i_rTitle ); - - m_aVisualization->SetAccessibleName( i_rTitle ); - m_aVisualization->SetAccessibleDescription( i_rTitle ); - } - - ToolPanelDrawer::~ToolPanelDrawer() - { - disposeOnce(); - } - - void ToolPanelDrawer::dispose() - { - m_aVisualization.disposeAndClear(); - vcl::Window::dispose(); - } - - long ToolPanelDrawer::GetPreferredHeightPixel() const - { - Rectangle aTitleBarBox( impl_calcTitleBarBox( impl_calcTextBoundingBox() ) ); - return aTitleBarBox.GetHeight(); - } - - - void ToolPanelDrawer::Paint(vcl::RenderContext& rRenderContext) - { - m_pPaintDevice->SetMapMode(rRenderContext.GetMapMode()); - m_pPaintDevice->SetOutputSize(GetOutputSizePixel()); - m_pPaintDevice->SetSettings(rRenderContext.GetSettings()); - m_pPaintDevice->SetDrawMode(rRenderContext.GetDrawMode()); - - const Rectangle aTextBox(impl_calcTextBoundingBox()); - impl_paintBackground(impl_calcTitleBarBox(aTextBox)); - - Rectangle aFocusBox(impl_paintExpansionIndicator(aTextBox)); - - m_pPaintDevice->DrawText(aTextBox, GetText(), impl_getTextStyle()); - - aFocusBox.Union(aTextBox); - aFocusBox.Left() += 2; - impl_paintFocusIndicator(aFocusBox); - - rRenderContext.DrawOutDev(Point(), GetOutputSizePixel(), Point(), GetOutputSizePixel(), *m_pPaintDevice); - } - - - Rectangle ToolPanelDrawer::impl_paintExpansionIndicator( const Rectangle& i_rTextBox ) - { - Rectangle aExpansionIndicatorArea; - - Image aImage( impl_getExpansionIndicator() ); - const int nHeight( aImage.GetSizePixel().Height() ); - if ( nHeight > 0 ) - { - Point aPosition( - 0, - i_rTextBox.Top() + ( GetTextHeight() - nHeight ) / 2 - ); - m_pPaintDevice->DrawImage( aPosition, aImage ); - - aExpansionIndicatorArea = Rectangle( aPosition, aImage.GetSizePixel() ); - } - - return aExpansionIndicatorArea; - } - - - Image ToolPanelDrawer::impl_getExpansionIndicator() const - { - sal_uInt16 nResourceId = 0; - if ( m_bExpanded ) - nResourceId = IMG_TRIANGLE_DOWN; - else - nResourceId = IMG_TRIANGLE_RIGHT; - return Image( SvtResId( nResourceId ) ); - } - - - DrawTextFlags ToolPanelDrawer::impl_getTextStyle() const - { - const DrawTextFlags nBasicStyle = DrawTextFlags::Left - | DrawTextFlags::Top - | DrawTextFlags::WordBreak; - - if ( IsEnabled() ) - return nBasicStyle; - - return nBasicStyle | DrawTextFlags::Disable; - } - - - void ToolPanelDrawer::impl_paintBackground( const Rectangle& i_rTitleBarBox ) - { - m_pPaintDevice->SetFillColor( GetSettings().GetStyleSettings().GetDialogColor() ); - m_pPaintDevice->DrawRect( i_rTitleBarBox ); - - m_pPaintDevice->SetFillColor(); - m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetLightColor() ); - m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.TopRight() ); - m_pPaintDevice->DrawLine( i_rTitleBarBox.TopLeft(), i_rTitleBarBox.BottomLeft() ); - - m_pPaintDevice->SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() ); - m_pPaintDevice->DrawLine( i_rTitleBarBox.BottomLeft(), i_rTitleBarBox.BottomRight() ); - m_pPaintDevice->DrawLine( i_rTitleBarBox.TopRight(), i_rTitleBarBox.BottomRight() ); - } - - - void ToolPanelDrawer::impl_paintFocusIndicator( const Rectangle& i_rTextBox ) - { - if ( m_bFocused ) - { - const Rectangle aTextPixelBox( m_pPaintDevice->LogicToPixel( i_rTextBox ) ); - - m_pPaintDevice->EnableMapMode( false ); - m_pPaintDevice->SetFillColor(); - - Rectangle aBox( i_rTextBox ); - aBox.Top() -= 1; - aBox.Bottom() += 1; - - m_pPaintDevice->DrawRect( aTextPixelBox ); - - LineInfo aDottedStyle( LINE_DASH ); - aDottedStyle.SetDashCount( 0 ); - aDottedStyle.SetDotCount( 1 ); - aDottedStyle.SetDotLen( 1 ); - aDottedStyle.SetDistance( 1 ); - - m_pPaintDevice->SetLineColor( COL_BLACK ); - m_pPaintDevice->DrawPolyLine( tools::Polygon( aTextPixelBox ), aDottedStyle ); - m_pPaintDevice->EnableMapMode( false ); - } - else - HideFocus(); - } - - - void ToolPanelDrawer::GetFocus() - { - m_bFocused = true; - Invalidate(); - } - - - void ToolPanelDrawer::LoseFocus() - { - m_bFocused = false; - Invalidate(); - } - - - void ToolPanelDrawer::Resize() - { - Window::Resize(); - m_aVisualization->SetPosSizePixel( Point(), GetOutputSizePixel() ); - } - - - void ToolPanelDrawer::MouseButtonDown( const MouseEvent& i_rMouseEvent ) - { - // consume this event, and do not forward to the base class - it would sent a NotifyEvent, which in turn, when - // we live in a DockingWindow, would start undocking - (void)i_rMouseEvent; - } - - void ToolPanelDrawer::ApplySettings(vcl::RenderContext& rRenderContext) - { - const StyleSettings& rStyleSettings(rRenderContext.GetSettings().GetStyleSettings()); - ApplyControlFont(rRenderContext, rStyleSettings.GetAppFont()); - ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor()); - rRenderContext.SetTextFillColor(); - } - - void ToolPanelDrawer::DataChanged( const DataChangedEvent& i_rEvent ) - { - Window::DataChanged( i_rEvent ); - - switch ( i_rEvent.GetType() ) - { - case DataChangedEventType::SETTINGS: - if ( !( i_rEvent.GetFlags() & AllSettingsFlags::STYLE ) ) - break; - SetSettings( Application::GetSettings() ); - m_pPaintDevice.disposeAndReset( VclPtr::Create( *this ) ); - - // fall through. - - case DataChangedEventType::FONTS: - case DataChangedEventType::FONTSUBSTITUTION: - { - const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); - ApplyControlFont(*this, rStyleSettings.GetAppFont()); - ApplyControlForeground(*this, rStyleSettings.GetButtonTextColor()); - SetTextFillColor(); - Invalidate(); - } - break; - default: break; - } - } - - - Reference< XWindowPeer > ToolPanelDrawer::GetComponentInterface( bool i_bCreate ) - { - Reference< XWindowPeer > xWindowPeer( Window::GetComponentInterface( false ) ); - if ( !xWindowPeer.is() && i_bCreate ) - { - xWindowPeer.set( new ToolPanelDrawerPeer() ); - SetComponentInterface( xWindowPeer ); - } - return xWindowPeer; - } - - - Rectangle ToolPanelDrawer::impl_calcTextBoundingBox() const - { - vcl::Font aFont( GetFont() ); - if ( m_bExpanded ) - aFont.SetWeight( m_bExpanded ? WEIGHT_BOLD : WEIGHT_NORMAL ); - m_pPaintDevice->SetFont( aFont ); - - int nAvailableWidth = m_pPaintDevice->GetTextWidth( GetText() ); - - Rectangle aTextBox( - Point(), - Size( - nAvailableWidth, - GetSettings().GetStyleSettings().GetTitleHeight() - ) - ); - aTextBox.Top() += ( aTextBox.GetHeight() - GetTextHeight() ) / 2; - aTextBox.Left() += s_nIndentationWidth; - aTextBox.Right() -= 1; - - aTextBox = m_pPaintDevice->GetTextRect( aTextBox, GetText(), impl_getTextStyle() ); - return aTextBox; - } - - - Rectangle ToolPanelDrawer::impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const - { - Rectangle aTitleBarBox( i_rTextBox ); - aTitleBarBox.Bottom() += aTitleBarBox.Top(); - aTitleBarBox.Top() = 0; - aTitleBarBox.Left() = 0; - - const long nWidth = GetOutputSizePixel().Width(); - if ( aTitleBarBox.GetWidth() < nWidth ) - aTitleBarBox.Right() = nWidth - 1; - - return aTitleBarBox; - } - - - void ToolPanelDrawer::SetExpanded( const bool i_bExpanded ) - { - if ( m_bExpanded != i_bExpanded ) - { - m_bExpanded = i_bExpanded; - CallEventListeners( m_bExpanded ? VCLEVENT_ITEM_EXPANDED : VCLEVENT_ITEM_COLLAPSED ); - Invalidate(); - } - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx deleted file mode 100644 index 218e7756b870..000000000000 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ /dev/null @@ -1,105 +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_TOOLPANEL_TOOLPANELDRAWER_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX - -#include -#include -#include - -namespace svt -{ - class ToolPanelDrawer; - - /** serves a single purpose - let ZoomText read the drawers ... - - Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations - of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject" - such a child into the A11Y hierarchy, we use this window here. - - (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With - this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.) - */ - class DrawerVisualization : public vcl::Window - { - public: - explicit DrawerVisualization(ToolPanelDrawer& i_rParent); - - protected: - // Window overridables - virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rBoundingBox) override; - - private: - ToolPanelDrawer& m_rDrawer; - }; - - class ToolPanelDrawer : public vcl::Window - { - public: - ToolPanelDrawer(vcl::Window& i_rParent, const OUString& i_rTitle); - virtual ~ToolPanelDrawer(); - virtual void dispose() override; - - long GetPreferredHeightPixel() const; - void SetExpanded(const bool i_bExpanded); - bool IsExpanded() const - { - return m_bExpanded; - } - - void Paint(vcl::RenderContext& rRenderContext); - - protected: - // Window overridables - virtual void GetFocus() override; - virtual void LoseFocus() override; - virtual void Resize() override; - virtual void DataChanged( const DataChangedEvent& i_rEvent ) override; - virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ) override; - - virtual css::uno::Reference< css::awt::XWindowPeer > - GetComponentInterface( bool i_bCreate ) override; - - virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; - - private: - Rectangle impl_calcTextBoundingBox() const; - Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const; - void impl_paintBackground( const Rectangle& i_rTitleBarBox ); - DrawTextFlags impl_getTextStyle() const; - void impl_paintFocusIndicator( const Rectangle& i_rTextBox ); - Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox ); - Image impl_getExpansionIndicator() const; - - // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change. - using Window::SetText; - using Window::Paint; - - private: - ScopedVclPtr m_pPaintDevice; - VclPtr m_aVisualization; - bool m_bFocused : 1; - bool m_bExpanded : 1; - }; -} // namespace svt - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx b/svtools/source/toolpanel/toolpaneldrawerpeer.cxx deleted file mode 100644 index 77fd13b5ce9b..000000000000 --- a/svtools/source/toolpanel/toolpaneldrawerpeer.cxx +++ /dev/null @@ -1,134 +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 "toolpaneldrawerpeer.hxx" -#include "toolpaneldrawer.hxx" - -#include -#include - -#include -#include -#include -#include -#include - - -namespace svt -{ - - - using ::com::sun::star::uno::Reference; - using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; - using ::com::sun::star::uno::UNO_SET_THROW; - using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; - using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; - using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::Type; - using ::com::sun::star::accessibility::XAccessibleContext; - - namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; - namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; - - - //= ToolPanelDrawerContext - - class ToolPanelDrawerContext : public VCLXAccessibleComponent - { - public: - explicit ToolPanelDrawerContext( VCLXWindow& i_rWindow ) - :VCLXAccessibleComponent( &i_rWindow ) - { - } - - virtual void ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent ) override; - virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) override; - - protected: - virtual ~ToolPanelDrawerContext() - { - } - }; - - - void ToolPanelDrawerContext::ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent ) - { - VCLXAccessibleComponent::ProcessWindowEvent( i_rVclWindowEvent ); - - switch ( i_rVclWindowEvent.GetId() ) - { - case VCLEVENT_ITEM_EXPANDED: - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), makeAny( AccessibleStateType::EXPANDED ) ); - break; - case VCLEVENT_ITEM_COLLAPSED: - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, makeAny( AccessibleStateType::EXPANDED ), Any() ); - break; - } - } - - - void ToolPanelDrawerContext::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) - { - VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet ); - if ( !GetWindow() ) - return; - - i_rStateSet.AddState( AccessibleStateType::EXPANDABLE ); - i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - - VclPtr< ToolPanelDrawer > pDrawer = GetAsDynamic< ToolPanelDrawer > (); - ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" ); - if ( pDrawer->IsExpanded() ) - i_rStateSet.AddState( AccessibleStateType::EXPANDED ); - - if ( pDrawer->HasChildPathFocus() ) - i_rStateSet.AddState( AccessibleStateType::FOCUSED ); - } - - - //= ToolPanelDrawerPeer - - - ToolPanelDrawerPeer::ToolPanelDrawerPeer() - :VCLXWindow() - { - } - - - ToolPanelDrawerPeer::~ToolPanelDrawerPeer() - { - } - - - Reference< XAccessibleContext > ToolPanelDrawerPeer::CreateAccessibleContext() - { - SolarMutexGuard aSolarGuard; - return new ToolPanelDrawerContext( *this ); - } - - -} // namespace svt - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/toolpanel/toolpaneldrawerpeer.hxx b/svtools/source/toolpanel/toolpaneldrawerpeer.hxx deleted file mode 100644 index e796b31d6dc9..000000000000 --- a/svtools/source/toolpanel/toolpaneldrawerpeer.hxx +++ /dev/null @@ -1,51 +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_TOOLPANEL_TOOLPANELDRAWERPEER_HXX -#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWERPEER_HXX - -#include - - -namespace svt -{ - - - - //= ToolPanelDrawerPeer - - class ToolPanelDrawerPeer : public VCLXWindow - { - public: - ToolPanelDrawerPeer(); - - protected: - virtual ~ToolPanelDrawerPeer(); - - // VCLXWindow overridables - virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; - }; - - -} // namespace svt - - -#endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWERPEER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 6977c6f473a1..2e868648ecd2 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -103,7 +103,6 @@ #include #include #include -#include #include #include #include @@ -379,7 +378,6 @@ void SwDLL::RegisterControls() SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod); ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); - ::sfx2::TaskPaneWrapper::RegisterChildWindow(false, pMod); SwJumpToSpecificPageControl::RegisterControl(SID_JUMP_TO_SPECIFIC_PAGE, pMod); } -- cgit