Branch libreoffice-5-0-4
[LibreOffice.git] / include / svtools / toolpanel / drawerlayouter.hxx
blobe35d0dd211c9512336e143f69f52079d73add093
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVTOOLS_TOOLPANEL_DRAWERLAYOUTER_HXX
21 #define INCLUDED_SVTOOLS_TOOLPANEL_DRAWERLAYOUTER_HXX
23 #include <svtools/svtdllapi.h>
24 #include <svtools/toolpanel/toolpaneldeck.hxx>
25 #include <svtools/toolpanel/decklayouter.hxx>
27 #include <memory>
30 namespace svt
32 class ToolPanelViewShell;
33 class ToolPanelDrawer;
35 //= ToolPanelDrawer
37 /** a class which implements a tool panel selector in the form of the classical drawers
39 class SVT_DLLPUBLIC DrawerDeckLayouter :public IDeckLayouter
40 ,public IToolPanelDeckListener
42 public:
43 DrawerDeckLayouter(
44 vcl::Window& i_rParentWindow,
45 IToolPanelDeck& i_rPanels
47 virtual ~DrawerDeckLayouter();
49 // IDeckLayouter
50 virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ) SAL_OVERRIDE;
51 virtual void Destroy() SAL_OVERRIDE;
52 virtual void SetFocusToPanelSelector() SAL_OVERRIDE;
53 virtual size_t GetAccessibleChildCount() const SAL_OVERRIDE;
54 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
55 GetAccessibleChild(
56 const size_t i_nChildIndex,
57 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
58 ) SAL_OVERRIDE;
60 // IToolPanelDeckListener
61 virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) SAL_OVERRIDE;
62 virtual void PanelRemoved( const size_t i_nPosition ) SAL_OVERRIDE;
63 virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) SAL_OVERRIDE;
64 virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) SAL_OVERRIDE;
65 virtual void Dying() SAL_OVERRIDE;
67 private:
68 // triggers a re-arrance of the panel deck elements
69 void impl_triggerRearrange() const;
70 size_t impl_getPanelPositionFromWindow( const vcl::Window* i_pDrawerWindow ) const;
71 void impl_removeDrawer( const size_t i_nPosition );
73 DECL_LINK( OnWindowEvent, VclSimpleEvent* );
75 private:
76 vcl::Window& m_rParentWindow;
77 IToolPanelDeck& m_rPanelDeck;
78 ::std::vector< VclPtr<ToolPanelDrawer> > m_aDrawers;
79 ::boost::optional< size_t > m_aLastKnownActivePanel;
83 } // namespace svt
86 #endif // INCLUDED_SVTOOLS_TOOLPANEL_DRAWERLAYOUTER_HXX
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */