[Libreoffice-commits] .: 3 commits - sd/inc sd/source
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Jun 1 07:41:52 PDT 2011
sd/inc/SdShapeTypes.hxx | 6
sd/source/ui/accessibility/SdShapeTypes.cxx | 130 +++++++--------
sd/source/ui/inc/DrawController.hxx | 2
sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx | 29 ++-
sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx | 1
sd/source/ui/unoidl/DrawController.cxx | 16 -
6 files changed, 87 insertions(+), 97 deletions(-)
New commits:
commit 27c43328736740e98c5397dc2d00659f157b91dc
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 10:32:03 2011 +0100
drop static in favour of member variable
diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx
index 98e7967..4709303 100644
--- a/sd/source/ui/inc/DrawController.hxx
+++ b/sd/source/ui/inc/DrawController.hxx
@@ -295,6 +295,8 @@ protected:
using cppu::OPropertySetHelper::getFastPropertyValue;
private:
+ const ::com::sun::star::uno::Type m_aSelectionTypeIdentifier;
+
/** This pointer to the ViewShellBase can be NULL (after a call to
ReleaseViewShellBase()).
*/
diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx
index 3e58324..43beb53 100644
--- a/sd/source/ui/unoidl/DrawController.cxx
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -66,12 +66,6 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::drawing::framework;
-namespace {
-static const ::com::sun::star::uno::Type saSelectionTypeIdentifier (
- ::getCppuType( (Reference<view::XSelectionChangeListener > *)0 ));
-
-} // end of anonymous namespace
-
namespace sd {
DrawController::DrawController (ViewShellBase& rBase) throw()
@@ -81,6 +75,8 @@ DrawController::DrawController (ViewShellBase& rBase) throw()
OMultiTypeInterfaceContainerHelper,
OMultiTypeInterfaceContainerHelper::keyType>& >(
BroadcastHelperOwner::maBroadcastHelper)),
+ m_aSelectionTypeIdentifier(
+ ::getCppuType( (Reference<view::XSelectionChangeListener > *)0 )),
mpBase(&rBase),
maLastVisArea(),
mpCurrentPage(NULL),
@@ -316,7 +312,7 @@ void SAL_CALL DrawController::addSelectionChangeListener(
if( mbDisposing )
throw lang::DisposedException();
- BroadcastHelperOwner::maBroadcastHelper.addListener (saSelectionTypeIdentifier, xListener);
+ BroadcastHelperOwner::maBroadcastHelper.addListener (m_aSelectionTypeIdentifier, xListener);
}
@@ -329,7 +325,7 @@ void SAL_CALL DrawController::removeSelectionChangeListener(
if (rBHelper.bDisposed)
throw lang::DisposedException();
- BroadcastHelperOwner::maBroadcastHelper.removeListener (saSelectionTypeIdentifier, xListener);
+ BroadcastHelperOwner::maBroadcastHelper.removeListener (m_aSelectionTypeIdentifier, xListener);
}
@@ -448,7 +444,7 @@ void DrawController::FireVisAreaChanged (const Rectangle& rVisArea) throw()
void DrawController::FireSelectionChangeListener() throw()
{
OInterfaceContainerHelper * pLC = BroadcastHelperOwner::maBroadcastHelper.getContainer(
- saSelectionTypeIdentifier);
+ m_aSelectionTypeIdentifier);
if( pLC )
{
Reference< XInterface > xSource( (XWeak*)this );
commit 19de06a9bb6109e25e38d490a2a1356b1558e26d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 10:25:48 2011 +0100
saComponentTypeIdentifier unused
diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx
index 26023d5..3e58324 100644
--- a/sd/source/ui/unoidl/DrawController.cxx
+++ b/sd/source/ui/unoidl/DrawController.cxx
@@ -67,8 +67,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::drawing::framework;
namespace {
-static const ::com::sun::star::uno::Type saComponentTypeIdentifier (
- ::getCppuType( (Reference<lang::XEventListener > *)0 ));
static const ::com::sun::star::uno::Type saSelectionTypeIdentifier (
::getCppuType( (Reference<view::XSelectionChangeListener > *)0 ));
commit 100a1b47bd62be63d4b3b7bcb36db7223942345d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 1 10:23:59 2011 +0100
don't see a reason this needs to be global
diff --git a/sd/inc/SdShapeTypes.hxx b/sd/inc/SdShapeTypes.hxx
index a00a028..19effad 100644
--- a/sd/inc/SdShapeTypes.hxx
+++ b/sd/inc/SdShapeTypes.hxx
@@ -71,12 +71,6 @@ AccessibleShape*
);
-/** List of shape type descriptors corresponding to the
- <type>SdShapeTypes</type> enum.
-*/
-extern ShapeTypeDescriptor aSdShapeTypeList[];
-
-
} // end of namespace accessibility
#endif
diff --git a/sd/source/ui/accessibility/SdShapeTypes.cxx b/sd/source/ui/accessibility/SdShapeTypes.cxx
index ab54a26..a2cfee7 100644
--- a/sd/source/ui/accessibility/SdShapeTypes.cxx
+++ b/sd/source/ui/accessibility/SdShapeTypes.cxx
@@ -70,81 +70,75 @@ AccessibleShape*
}
}
-
-
-
-ShapeTypeDescriptor aSdShapeTypeList[] = {
- ShapeTypeDescriptor (
- PRESENTATION_OUTLINER,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.OutlinerShape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_SUBTITLE,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.SubtitleShape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_GRAPHIC_OBJECT,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.GraphicObjectShape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_PAGE,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.PageShape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_OLE,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.OLE2Shape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_CHART,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.ChartShape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_TABLE,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.TableShape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_NOTES,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.NotesShape"))),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_TITLE,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.TitleTextShape")),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_HANDOUT,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.HandoutShape")),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_HEADER,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.HeaderShape")),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_FOOTER,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.FooterShape")),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_DATETIME,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.DateTimeShape")),
- CreateSdAccessibleShape ),
- ShapeTypeDescriptor (
- PRESENTATION_PAGENUMBER,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.SlideNumberShape")),
- CreateSdAccessibleShape )
-};
-
-
-
-
void RegisterImpressShapeTypes (void)
{
+ /** List of shape type descriptors corresponding to the
+ <type>SdShapeTypes</type> enum.
+ */
+ ShapeTypeDescriptor aSdShapeTypeList[] = {
+ ShapeTypeDescriptor (
+ PRESENTATION_OUTLINER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.OutlinerShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_SUBTITLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.SubtitleShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_GRAPHIC_OBJECT,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.GraphicObjectShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_PAGE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.PageShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_OLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.OLE2Shape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_CHART,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.ChartShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_TABLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.TableShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_NOTES,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ("com.sun.star.presentation.NotesShape"))),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_TITLE,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.TitleTextShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_HANDOUT,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.HandoutShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_HEADER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.HeaderShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_FOOTER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.FooterShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_DATETIME,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.DateTimeShape")),
+ CreateSdAccessibleShape ),
+ ShapeTypeDescriptor (
+ PRESENTATION_PAGENUMBER,
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.presentation.SlideNumberShape")),
+ CreateSdAccessibleShape )
+ };
+
ShapeTypeHandler::Instance().AddShapeTypeList (
PRESENTATION_PAGENUMBER - PRESENTATION_OUTLINER + 1,
aSdShapeTypeList);
}
-
-
-
} // end of namespace accessibility
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
index 8d342cb..89f0b7c 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
@@ -31,6 +31,7 @@
#include "SlsCacheConfiguration.hxx"
#include <osl/mutex.hxx>
+#include <rtl/instance.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx>
@@ -43,33 +44,38 @@ using namespace ::com::sun::star::uno;
namespace sd { namespace slidesorter { namespace cache {
-::boost::shared_ptr<CacheConfiguration> CacheConfiguration::mpInstance;
+namespace
+{
+ typedef ::boost::shared_ptr<CacheConfiguration> CacheConfigSharedPtr;
+ class theInstance :
+ public rtl::Static<CacheConfigSharedPtr, theInstance> {};
+}
+
::boost::weak_ptr<CacheConfiguration> CacheConfiguration::mpWeakInstance;
Timer CacheConfiguration::maReleaseTimer;
-
-
::boost::shared_ptr<CacheConfiguration> CacheConfiguration::Instance (void)
{
SolarMutexGuard aSolarGuard;
- if (mpInstance.get() == NULL)
+ CacheConfigSharedPtr &rInstancePtr = theInstance::get();
+ if (rInstancePtr.get() == NULL)
{
// Maybe somebody else kept a previously created instance alive.
if ( ! mpWeakInstance.expired())
- mpInstance = ::boost::shared_ptr<CacheConfiguration>(mpWeakInstance);
- if (mpInstance.get() == NULL)
+ rInstancePtr = ::boost::shared_ptr<CacheConfiguration>(mpWeakInstance);
+ if (rInstancePtr.get() == NULL)
{
// We have to create a new instance.
- mpInstance.reset(new CacheConfiguration());
- mpWeakInstance = mpInstance;
+ rInstancePtr.reset(new CacheConfiguration());
+ mpWeakInstance = rInstancePtr;
// Prepare to release this instance in the near future.
maReleaseTimer.SetTimeoutHdl(
- LINK(mpInstance.get(),CacheConfiguration,TimerCallback));
+ LINK(rInstancePtr.get(),CacheConfiguration,TimerCallback));
maReleaseTimer.SetTimeout(5000 /* 5s */);
maReleaseTimer.Start();
}
}
- return mpInstance;
+ return rInstancePtr;
}
@@ -167,8 +173,9 @@ Any CacheConfiguration::GetValue (const ::rtl::OUString& rName)
IMPL_LINK(CacheConfiguration,TimerCallback, Timer*,EMPTYARG)
{
+ CacheConfigSharedPtr &rInstancePtr = theInstance::get();
// Release out reference to the instance.
- mpInstance.reset();
+ rInstancePtr.reset();
return 0;
}
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
index 27d7888..6e7174b 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.hxx
@@ -56,7 +56,6 @@ public:
::com::sun::star::uno::Any GetValue (const ::rtl::OUString& rName);
private:
- static ::boost::shared_ptr<CacheConfiguration> mpInstance;
/** When a caller holds a reference after we have released ours we use
this weak pointer to avoid creating a new instance.
*/
More information about the Libreoffice-commits
mailing list