summaryrefslogtreecommitdiff
path: root/sfx2/workben
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-08 11:14:22 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-04-08 11:14:22 +0200
commit6afa02e3d6e6324b8d3e2ddd91fbb81c583aab83 (patch)
tree0422b12d1ae0a5620fcd87404d4adac819f2e6ba /sfx2/workben
parentec769a41ff0ce34d345eea50d0a779c076f0b227 (diff)
slidecopy: remember the tool panel's visibility states, and restore the next time
Diffstat (limited to 'sfx2/workben')
-rw-r--r--sfx2/workben/custompanel/WriterWindowState.xcu15
-rw-r--r--sfx2/workben/custompanel/ctp_factory.cxx10
-rw-r--r--sfx2/workben/custompanel/ctp_panel.cxx11
-rw-r--r--sfx2/workben/custompanel/ctp_panel.hxx7
4 files changed, 32 insertions, 11 deletions
diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu
index 79f71e8736f8..527a3c89d8ac 100644
--- a/sfx2/workben/custompanel/WriterWindowState.xcu
+++ b/sfx2/workben/custompanel/WriterWindowState.xcu
@@ -2,12 +2,23 @@
<oor:component-data oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI" xmlns:install="http://openoffice.org/2004/installation" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="UIElements">
<node oor:name="States">
- <node oor:name="private:resource/toolpanel/org.openoffice.example.custompanel" oor:op="replace">
+ <node oor:name="private:resource/toolpanel/org.openoffice.example.custompanel/green" oor:op="replace">
<prop oor:name="UIName" oor:type="xs:string">
<value xml:lang="en-US">Soylent Green</value>
</prop>
<prop oor:name="Visible" oor:type="xs:boolean">
- <value>true</value>
+ <value>false</value>
+ </prop>
+ <prop oor:name="ImageURL" oor:type="xs:string">
+ <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
+ </prop>
+ </node>
+ <node oor:name="private:resource/toolpanel/org.openoffice.example.custompanel/red" oor:op="replace">
+ <prop oor:name="UIName" oor:type="xs:string">
+ <value xml:lang="en-US">Soylent Red</value>
+ </prop>
+ <prop oor:name="Visible" oor:type="xs:boolean">
+ <value>false</value>
</prop>
<prop oor:name="ImageURL" oor:type="xs:string">
<value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
diff --git a/sfx2/workben/custompanel/ctp_factory.cxx b/sfx2/workben/custompanel/ctp_factory.cxx
index 462709e7ad2c..1b630a7c1440 100644
--- a/sfx2/workben/custompanel/ctp_factory.cxx
+++ b/sfx2/workben/custompanel/ctp_factory.cxx
@@ -82,7 +82,13 @@ namespace sd { namespace colortoolpanel
{
::osl::MutexGuard aGuard( m_aMutex );
- if ( !i_rResourceURL.equalsAscii( "private:resource/toolpanel/org.openoffice.example.custompanel" ) )
+ if ( !i_rResourceURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:resource/toolpanel/org.openoffice.example.custompanel/" ) ) )
+ throw NoSuchElementException( i_rResourceURL, *this );
+
+ const ::rtl::OUString sColor( i_rResourceURL.copy( i_rResourceURL.lastIndexOf( '/' ) + 1 ) );
+ const bool bRed = sColor.equalsAscii( "red" );
+ const bool bGreen = sColor.equalsAscii( "green" );
+ if ( !bRed && !bGreen )
throw NoSuchElementException( i_rResourceURL, *this );
// retrieve the parent window
@@ -108,7 +114,7 @@ namespace sd { namespace colortoolpanel
}
/// create the panel
- Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL ) );
+ Reference< XUIElement > xUIElement( new PanelUIElement( m_xContext, xParentWindow, i_rResourceURL, bGreen ? 0x80 << 8 : 0x80 << 16 ) );
return xUIElement;
}
diff --git a/sfx2/workben/custompanel/ctp_panel.cxx b/sfx2/workben/custompanel/ctp_panel.cxx
index 7cbd3b0dece4..7f39b671c2b6 100644
--- a/sfx2/workben/custompanel/ctp_panel.cxx
+++ b/sfx2/workben/custompanel/ctp_panel.cxx
@@ -113,9 +113,10 @@ namespace sd { namespace colortoolpanel
//= class SingleColorPanel
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
- SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow )
+ SingleColorPanel::SingleColorPanel( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow, const ::sal_Int32 i_nPanelColor )
:SingleColorPanel_Base( m_aMutex )
,m_xWindow()
+ ,m_nPanelColor( i_nPanelColor )
{
// retrieve the parent window for our to-be-created pane window
Reference< XWindowPeer > xParentPeer( i_rParentWindow, UNO_QUERY );
@@ -169,8 +170,8 @@ namespace sd { namespace colortoolpanel
{
const Reference< XDevice > xDevice( i_rEvent.Source, UNO_QUERY_THROW );
const Reference< XGraphics > xGraphics( xDevice->createGraphics(), UNO_SET_THROW );
- xGraphics->setFillColor( 0x80 << 8 );
- xGraphics->setLineColor( 0x80 << 16 );
+ xGraphics->setFillColor( m_nPanelColor );
+ xGraphics->setLineColor( 0x00FFFFFF );
const Reference< XWindow > xWindow( i_rEvent.Source, UNO_QUERY_THROW );
const Rectangle aWindowRect( xWindow->getPosSize() );
@@ -213,10 +214,10 @@ namespace sd { namespace colortoolpanel
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
PanelUIElement::PanelUIElement( const Reference< XComponentContext >& i_rContext, const Reference< XWindow >& i_rParentWindow,
- const ::rtl::OUString& i_rResourceURL )
+ const ::rtl::OUString& i_rResourceURL, const ::sal_Int32 i_nPanelColor )
:PanelUIElement_Base( m_aMutex )
,m_sResourceURL( i_rResourceURL )
- ,m_xToolPanel( new SingleColorPanel( i_rContext, i_rParentWindow ) )
+ ,m_xToolPanel( new SingleColorPanel( i_rContext, i_rParentWindow, i_nPanelColor ) )
{
}
diff --git a/sfx2/workben/custompanel/ctp_panel.hxx b/sfx2/workben/custompanel/ctp_panel.hxx
index 75283d686250..5975af2badc1 100644
--- a/sfx2/workben/custompanel/ctp_panel.hxx
+++ b/sfx2/workben/custompanel/ctp_panel.hxx
@@ -58,7 +58,8 @@ namespace sd { namespace colortoolpanel
public:
SingleColorPanel(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
+ const ::sal_Int32 i_nPanelColor
);
// XToolPanel
@@ -79,6 +80,7 @@ namespace sd { namespace colortoolpanel
private:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xWindow;
+ const sal_Int32 m_nPanelColor;
};
//==================================================================================================================
@@ -93,7 +95,8 @@ namespace sd { namespace colortoolpanel
PanelUIElement(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& i_rContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& i_rParentWindow,
- const ::rtl::OUString& i_rResourceURL
+ const ::rtl::OUString& i_rResourceURL,
+ const ::sal_Int32 i_nPanelColor
);
// XUIElement