summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-15 11:33:53 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-15 11:33:53 +0100
commit9e32fe903cb7b8f26a401f48efdb2001e5001c34 (patch)
treeabeb6235f745182abfaf7299e8b24d1e6c18327c /svtools
parentabee041f8d2bf4f865838df72d388cd84e8da9ef (diff)
slidecopy: misc adjustments
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/toolpanel/refbase.hxx4
-rw-r--r--svtools/inc/svtools/toolpanel/toolpanel.hxx30
-rw-r--r--svtools/prj/d.lst3
-rw-r--r--svtools/source/toolpanel/dummypanel.cxx5
-rw-r--r--svtools/source/toolpanel/dummypanel.hxx1
-rw-r--r--svtools/source/toolpanel/makefile.mk1
-rw-r--r--svtools/source/toolpanel/toolpanel.cxx52
-rw-r--r--svtools/source/toolpanel/toolpaneldeck.cxx7
-rw-r--r--svtools/workben/toolpanel/toolpaneltest.cxx30
9 files changed, 122 insertions, 11 deletions
diff --git a/svtools/inc/svtools/toolpanel/refbase.hxx b/svtools/inc/svtools/toolpanel/refbase.hxx
index 8e61837cc665..16603cb56017 100644
--- a/svtools/inc/svtools/toolpanel/refbase.hxx
+++ b/svtools/inc/svtools/toolpanel/refbase.hxx
@@ -27,7 +27,7 @@
#ifndef SVT_REFBASE_HXX
#define SVT_REFBASE_HXX
-#include <osl/interlck.h>
+#include <rtl/ref.hxx>
//........................................................................
namespace svt
@@ -37,7 +37,7 @@ namespace svt
//====================================================================
//= RefBase
//====================================================================
- class RefBase
+ class RefBase : public ::rtl::IReference
{
protected:
RefBase()
diff --git a/svtools/inc/svtools/toolpanel/toolpanel.hxx b/svtools/inc/svtools/toolpanel/toolpanel.hxx
index 9476a851986f..eae9c504a270 100644
--- a/svtools/inc/svtools/toolpanel/toolpanel.hxx
+++ b/svtools/inc/svtools/toolpanel/toolpanel.hxx
@@ -28,11 +28,12 @@
#define SVT_TOOLPANEL_HXX
#include "svtools/svtdllapi.h"
+#include "svtools/toolpanel/refbase.hxx"
#include <rtl/ustring.hxx>
#include <vcl/image.hxx>
-#include <rtl/ref.hxx>
+#include <boost/noncopyable.hpp>
class Rectangle;
@@ -74,6 +75,12 @@ namespace svt
*/
virtual bool HasFocus() const = 0;
+ /** release any resources associated with the panel.
+
+ In particular, implementations should destroy the VCL window which implements the panel window.
+ */
+ virtual void Dispose() = 0;
+
virtual ~IToolPanel()
{
}
@@ -81,6 +88,27 @@ namespace svt
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
+ ,public RefBase
+ ,public ::boost::noncopyable
+ {
+ protected:
+ ToolPanelBase();
+ ~ToolPanelBase();
+
+ public:
+ DECLARE_IREFERENCE()
+
+ private:
+ oslInterlockedCount m_refCount;
+ };
+
//........................................................................
} // namespace svt
//........................................................................
diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst
index 0a3ccd8a9819..fa3fbb2371dd 100644
--- a/svtools/prj/d.lst
+++ b/svtools/prj/d.lst
@@ -1,6 +1,7 @@
mkdir: %COMMON_DEST%\bin%_EXT%\hid
mkdir: %COMMON_DEST%\res%_EXT%
mkdir: %_DEST%\inc%_EXT%\svtools
+mkdir: %_DEST%\inc%_EXT%\svtools\toolpanel
..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs
@@ -29,6 +30,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools
..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h
..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc
+..\inc\svtools\toolpanel\*.* %_DEST%\inc%_EXT%\svtools\toolpanel\*.hrc
+
dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi"
*.xml %_DEST%\xml%_EXT%\*.xml
diff --git a/svtools/source/toolpanel/dummypanel.cxx b/svtools/source/toolpanel/dummypanel.cxx
index 6bf1fb6ea60e..d199628b004e 100644
--- a/svtools/source/toolpanel/dummypanel.cxx
+++ b/svtools/source/toolpanel/dummypanel.cxx
@@ -87,6 +87,11 @@ namespace svt
return false;
}
+ //--------------------------------------------------------------------
+ void DummyPanel::Dispose()
+ {
+ }
+
//........................................................................
} // namespace svt
//........................................................................
diff --git a/svtools/source/toolpanel/dummypanel.hxx b/svtools/source/toolpanel/dummypanel.hxx
index 41afe1ad51e2..a5af4844e420 100644
--- a/svtools/source/toolpanel/dummypanel.hxx
+++ b/svtools/source/toolpanel/dummypanel.hxx
@@ -54,6 +54,7 @@ namespace svt
virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground );
virtual void GrabFocus();
virtual bool HasFocus() const;
+ virtual void Dispose();
DECLARE_IREFERENCE()
};
diff --git a/svtools/source/toolpanel/makefile.mk b/svtools/source/toolpanel/makefile.mk
index e3dd07fac005..7e79ff4c00d7 100644
--- a/svtools/source/toolpanel/makefile.mk
+++ b/svtools/source/toolpanel/makefile.mk
@@ -50,6 +50,7 @@ SLOFILES=\
$(SLO)$/refbase.obj \
$(SLO)$/tabbargeometry.obj \
$(SLO)$/tablayouter.obj \
+ $(SLO)$/toolpanel.obj \
$(SLO)$/toolpanelcollection.obj \
$(SLO)$/toolpaneldeck.obj \
diff --git a/svtools/source/toolpanel/toolpanel.cxx b/svtools/source/toolpanel/toolpanel.cxx
new file mode 100644
index 000000000000..35446d1ffe2b
--- /dev/null
+++ b/svtools/source/toolpanel/toolpanel.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+************************************************************************/
+
+#include "svtools/toolpanel/toolpanel.hxx"
+
+//........................................................................
+namespace svt
+{
+//........................................................................
+
+ //====================================================================
+ //= ToolPanelBase
+ //====================================================================
+ //--------------------------------------------------------------------
+ ToolPanelBase::ToolPanelBase()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ToolPanelBase::~ToolPanelBase()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_IREFERENCE( ToolPanelBase )
+
+//........................................................................
+} // namespace svt
+//........................................................................
diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx
index c6b48ea0ea2f..93bfc982bc2e 100644
--- a/svtools/source/toolpanel/toolpaneldeck.cxx
+++ b/svtools/source/toolpanel/toolpaneldeck.cxx
@@ -317,6 +317,13 @@ namespace svt
ToolPanelDeck::~ToolPanelDeck()
{
GetLayouter()->Destroy();
+
+ Hide();
+ for ( size_t i=0; i<GetPanelCount(); ++i )
+ {
+ PToolPanel pPanel( GetPanel( i ) );
+ pPanel->Dispose();
+ }
}
//--------------------------------------------------------------------
diff --git a/svtools/workben/toolpanel/toolpaneltest.cxx b/svtools/workben/toolpanel/toolpaneltest.cxx
index 7f600735ea51..3f2c1dc3e291 100644
--- a/svtools/workben/toolpanel/toolpaneltest.cxx
+++ b/svtools/workben/toolpanel/toolpaneltest.cxx
@@ -149,6 +149,7 @@ public:
virtual void SetPosSizePixel( const Rectangle& i_rPanelPlayground );
virtual void GrabFocus();
virtual bool HasFocus() const;
+ virtual void Dispose();
// IReference
virtual oslInterlockedCount SAL_CALL acquire();
@@ -156,7 +157,8 @@ public:
private:
oslInterlockedCount m_refCount;
- ColoredPanelWindow m_aWindow;
+ ::std::auto_ptr< ColoredPanelWindow >
+ m_pWindow;
::rtl::OUString m_aPanelName;
BitmapEx m_aPanelIcon;
};
@@ -167,7 +169,7 @@ private:
//-----------------------------------------------------------------------------
ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_Char* i_pAsciiPanelName )
:m_refCount(0)
- ,m_aWindow( i_rParent, i_rColor, ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) )
+ ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) ) )
,m_aPanelName( ::rtl::OUString::createFromAscii( i_pAsciiPanelName ) )
,m_aPanelIcon()
{
@@ -179,7 +181,7 @@ ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const sal_
//-----------------------------------------------------------------------------
ColoredPanel::ColoredPanel( Window& i_rParent, const Color& i_rColor, const String& i_rPanelName )
:m_refCount(0)
- ,m_aWindow( i_rParent, i_rColor, i_rPanelName )
+ ,m_pWindow( new ColoredPanelWindow( i_rParent, i_rColor, i_rPanelName ) )
,m_aPanelName( i_rPanelName )
,m_aPanelIcon()
{
@@ -211,31 +213,43 @@ oslInterlockedCount SAL_CALL ColoredPanel::release()
//-----------------------------------------------------------------------------
void ColoredPanel::Show()
{
- m_aWindow.Show();
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->Show();
}
//-----------------------------------------------------------------------------
void ColoredPanel::Hide()
{
- m_aWindow.Hide();
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->Hide();
}
//-----------------------------------------------------------------------------
void ColoredPanel::SetPosSizePixel( const Rectangle& i_rPanelPlayground )
{
- m_aWindow.SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() );
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->SetPosSizePixel( i_rPanelPlayground.TopLeft(), i_rPanelPlayground.GetSize() );
}
//-----------------------------------------------------------------------------
void ColoredPanel::GrabFocus()
{
- m_aWindow.GrabFocus();
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow->GrabFocus();
}
//-----------------------------------------------------------------------------
bool ColoredPanel::HasFocus() const
{
- return m_aWindow.HasChildPathFocus();
+ ENSURE_OR_RETURN_FALSE( m_pWindow.get(), "disposed!" );
+ return m_pWindow->HasChildPathFocus();
+}
+
+//-----------------------------------------------------------------------------
+void ColoredPanel::Dispose()
+{
+ ENSURE_OR_RETURN_VOID( m_pWindow.get(), "disposed!" );
+ m_pWindow.reset();
}
//-----------------------------------------------------------------------------