diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/svtools/toolpanel/toolpaneldeck.hxx | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/svtools/toolpanel/toolpaneldeck.hxx')
-rw-r--r-- | include/svtools/toolpanel/toolpaneldeck.hxx | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/include/svtools/toolpanel/toolpaneldeck.hxx b/include/svtools/toolpanel/toolpaneldeck.hxx new file mode 100644 index 000000000000..d293aca8d017 --- /dev/null +++ b/include/svtools/toolpanel/toolpaneldeck.hxx @@ -0,0 +1,194 @@ +/* -*- 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 SVT_TOOLPANELDECK_HXX +#define SVT_TOOLPANELDECK_HXX + +#include "svtools/svtdllapi.h" +#include "svtools/toolpanel/toolpanel.hxx" +#include "svtools/toolpanel/decklayouter.hxx" + +#include <vcl/ctrl.hxx> + +#include <boost/optional.hpp> +#include <memory> + +//........................................................................ +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 <em>not</em> invoke <member>IToolPanel::Dispose</member> 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( Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL ); + ~ToolPanelDeck(); + + // 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. + */ + ::Window& GetPanelWindowAnchor(); + const ::Window& GetPanelWindowAnchor() const; + + /** sets the window which should act as parent in the A11Y object hierarchy. + + Calling this method has no effect if CreateAccessible had always been called. + */ + void SetAccessibleParentWindow( ::Window* i_pAccessibleParent ); + ::Window* GetAccessibleParentWindow() const; + + // IToolPanelDeck + virtual size_t GetPanelCount() const; + virtual PToolPanel GetPanel( const size_t i_nPos ) const; + virtual ::boost::optional< size_t > + GetActivePanel() const; + virtual void ActivatePanel( const ::boost::optional< size_t >& i_rPanel ); + virtual size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual PToolPanel RemovePanel( const size_t i_nPosition ); + virtual void AddListener( IToolPanelDeckListener& i_rListener ); + virtual void RemoveListener( IToolPanelDeckListener& i_rListener ); + + protected: + // Window overridables + virtual void Resize(); + virtual long Notify( NotifyEvent& i_rNotifyEvent ); + virtual void GetFocus(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > + GetComponentInterface( sal_Bool i_bCreate ); + + private: + ::std::auto_ptr< ToolPanelDeck_Impl > m_pImpl; + + private: + using Window::GetAccessibleParentWindow; + }; + +//........................................................................ +} // namespace svt +//........................................................................ + +#endif // SVT_TOOLPANELDECK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |