summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-16 13:36:35 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-16 13:36:35 +0100
commit690f40246d237b8280cc1afc861d702fb344ee4f (patch)
tree7463ed80cb45d0e0e383e11130ed4ff82d964b1a /svtools
parent1412426cc9cf5234c3b60cc2f46153df624f2b15 (diff)
slidecopy: de/activate panels via the drawing framework
Instead of simply letting svtool's ToolPanelDeck decide on panel activation, requests are re-routed through the view's ConfigurationController. So, clicking onto a tab just requests the activation of the respective resource, which in turn - when the requested configuration becomes the active configuration - will activate the ToolPanel.
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/toolpanel/tablayouter.hxx15
-rw-r--r--svtools/inc/svtools/toolpanel/toolpaneldeck.hxx8
-rw-r--r--svtools/source/toolpanel/tablayouter.cxx12
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.cxx15
-rw-r--r--svtools/source/toolpanel/toolpanelcollection.hxx2
-rw-r--r--svtools/source/toolpanel/toolpaneldeck.cxx14
-rw-r--r--svtools/workben/toolpanel/toolpaneltest.cxx4
7 files changed, 41 insertions, 29 deletions
diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx
index 784f8c178527..42e716dad53a 100644
--- a/svtools/inc/svtools/toolpanel/tablayouter.hxx
+++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx
@@ -37,12 +37,14 @@
#include <boost/noncopyable.hpp>
+class Window;
+
//........................................................................
namespace svt
{
//........................................................................
- class ToolPanelDeck;
+ class IToolPanelDeck;
struct TabDeckLayouter_Data;
@@ -55,17 +57,18 @@ namespace svt
{
public:
/** creates a new layouter
- @param i_rPanelDeck
- the panel deck which the layouter is responsible for. Provides access to the panels
- container, and can and should be used as parent for any other windows which the layouter
- needs to create.
+ @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(
- ToolPanelDeck& i_rPanelDeck,
+ Window& i_rParent,
+ IToolPanelDeck& i_rPanels,
const TabAlignment i_eAlignment,
const TabItemContent i_eItemContent
);
diff --git a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
index b7653ef1c38c..7e0827dbc44a 100644
--- a/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
+++ b/svtools/inc/svtools/toolpanel/toolpaneldeck.hxx
@@ -90,8 +90,12 @@ namespace svt
/** 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 size_t i_nPanel ) = 0;
+ 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
@@ -138,7 +142,7 @@ namespace svt
virtual PToolPanel GetPanel( const size_t i_nPos ) const;
virtual ::boost::optional< size_t >
GetActivePanel() const;
- virtual void ActivatePanel( const size_t i_nPanel );
+ 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 );
diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx
index 382b17e8ced7..523e2170eba2 100644
--- a/svtools/source/toolpanel/tablayouter.cxx
+++ b/svtools/source/toolpanel/tablayouter.cxx
@@ -47,10 +47,11 @@ namespace svt
::std::auto_ptr< PanelTabBar >
pTabBar;
- TabDeckLayouter_Data( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
+ TabDeckLayouter_Data( Window& i_rParent, IToolPanelDeck& i_rPanels,
+ const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
:eAlignment( i_eAlignment )
- ,rPanels( i_rPanelDeck )
- ,pTabBar( new PanelTabBar( i_rPanelDeck, i_rPanelDeck, i_eAlignment, i_eItemContent ) )
+ ,rPanels( i_rPanels )
+ ,pTabBar( new PanelTabBar( i_rParent, i_rPanels, i_eAlignment, i_eItemContent ) )
{
pTabBar->Show();
}
@@ -82,8 +83,9 @@ namespace svt
//= TabDeckLayouter
//====================================================================
//--------------------------------------------------------------------
- TabDeckLayouter::TabDeckLayouter( ToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent )
- :m_pData( new TabDeckLayouter_Data( i_rPanelDeck, i_eAlignment, i_eItemContent ) )
+ TabDeckLayouter::TabDeckLayouter( 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 ) )
{
}
diff --git a/svtools/source/toolpanel/toolpanelcollection.cxx b/svtools/source/toolpanel/toolpanelcollection.cxx
index 61bdbe699566..baefbd92400f 100644
--- a/svtools/source/toolpanel/toolpanelcollection.cxx
+++ b/svtools/source/toolpanel/toolpanelcollection.cxx
@@ -76,17 +76,20 @@ namespace svt
}
//--------------------------------------------------------------------
- void ToolPanelCollection::ActivatePanel( const size_t i_nPanel )
+ void ToolPanelCollection::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
{
- OSL_ENSURE( i_nPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" );
- if ( i_nPanel >= GetPanelCount() )
- return;
+ if ( !!i_rPanel )
+ {
+ OSL_ENSURE( *i_rPanel < GetPanelCount(), "ToolPanelCollection::ActivatePanel: illegal panel no.!" );
+ if ( *i_rPanel >= GetPanelCount() )
+ return;
+ }
- if ( m_pData->aActivePanel == i_nPanel )
+ if ( m_pData->aActivePanel == i_rPanel )
return;
const ::boost::optional< size_t > aOldPanel( m_pData->aActivePanel );
- m_pData->aActivePanel = i_nPanel;
+ m_pData->aActivePanel = i_rPanel;
// notify listeners
m_pData->aListeners.ActivePanelChanged( aOldPanel, m_pData->aActivePanel );
diff --git a/svtools/source/toolpanel/toolpanelcollection.hxx b/svtools/source/toolpanel/toolpanelcollection.hxx
index 84389b4d6e01..2bdba38546c9 100644
--- a/svtools/source/toolpanel/toolpanelcollection.hxx
+++ b/svtools/source/toolpanel/toolpanelcollection.hxx
@@ -52,7 +52,7 @@ namespace svt
virtual PToolPanel GetPanel( const size_t i_nPos ) const;
virtual ::boost::optional< size_t >
GetActivePanel() const;
- virtual void ActivatePanel( const size_t i_nPanel );
+ 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 );
diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx
index 5791cd0ed9b1..22d8dc7d57a5 100644
--- a/svtools/source/toolpanel/toolpaneldeck.cxx
+++ b/svtools/source/toolpanel/toolpaneldeck.cxx
@@ -85,7 +85,7 @@ namespace svt
PToolPanel GetPanel( const size_t i_nPos ) const;
::boost::optional< size_t >
GetActivePanel() const;
- void ActivatePanel( const size_t i_nPanel );
+ 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 );
@@ -158,9 +158,9 @@ namespace svt
}
//--------------------------------------------------------------------
- void ToolPanelDeck_Impl::ActivatePanel( const size_t i_nPanel )
+ void ToolPanelDeck_Impl::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
{
- m_aPanels.ActivatePanel( i_nPanel );
+ m_aPanels.ActivatePanel( i_rPanel );
}
//--------------------------------------------------------------------
@@ -249,7 +249,7 @@ namespace svt
if ( !!aActivatePanel )
{
- ActivatePanel( *aActivatePanel );
+ ActivatePanel( aActivatePanel );
}
}
@@ -310,7 +310,7 @@ namespace svt
,m_pImpl( new ToolPanelDeck_Impl( *this ) )
{
// use a default layouter
- SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) );
+ SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) );
}
//--------------------------------------------------------------------
@@ -345,9 +345,9 @@ namespace svt
}
//--------------------------------------------------------------------
- void ToolPanelDeck::ActivatePanel( const size_t i_nPanel )
+ void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
{
- m_pImpl->ActivatePanel( i_nPanel );
+ m_pImpl->ActivatePanel( i_rPanel );
}
//--------------------------------------------------------------------
diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx
index 3f2c1dc3e291..f6b642f905e6 100644
--- a/svtools/workben/toolpanel/toolpaneltest.cxx
+++ b/svtools/workben/toolpanel/toolpaneltest.cxx
@@ -738,7 +738,7 @@ PanelDemoMainWindow::PanelDemoMainWindow()
m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 255, 255, 0 ), "Yellow is ugly" ) ), m_aToolPanelDeck.GetPanelCount() );
m_aToolPanelDeck.InsertPanel( PToolPanel( new ColoredPanel( m_aToolPanelDeck, RGB_COLORDATA( 0, 0, 128 ), "Blue is the Color" ) ), m_aToolPanelDeck.GetPanelCount() );
- m_aToolPanelDeck.ActivatePanel( 0 );
+ m_aToolPanelDeck.ActivatePanel( size_t( 0 ) );
m_aToolPanelDeck.Show();
SetText( String::CreateFromAscii( "ToolPanelDeck Demo Application" ) );
@@ -788,7 +788,7 @@ void PanelDemoMainWindow::AlignTabs( const ::svt::TabAlignment i_eAlignment )
if ( pLayouter )
eCurrentItemContent = pLayouter->GetTabItemContent();
- m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( m_aToolPanelDeck, i_eAlignment, eCurrentItemContent ) ) );
+ m_aToolPanelDeck.SetLayouter( PDeckLayouter( new TabDeckLayouter( m_aToolPanelDeck, m_aToolPanelDeck, i_eAlignment, eCurrentItemContent ) ) );
}
//-----------------------------------------------------------------------------