[Libreoffice-commits] .: 35 commits - sw/inc sw/Library_sw.mk sw/source
Michael Stahl
mstahl at redhat.com
Sat Feb 2 17:18:06 PST 2013
sw/Library_sw.mk | 2
sw/inc/RefreshListenerContainer.hxx | 32 --
sw/inc/unoatxt.hxx | 290 --------------------
sw/inc/unobookmark.hxx | 278 -------------------
sw/inc/unocrsrhelper.hxx | 26 +
sw/inc/unoevent.hxx | 112 -------
sw/inc/unoevtlstnr.hxx | 52 ---
sw/inc/unofield.hxx | 307 ---------------------
sw/inc/unofieldcoll.hxx | 138 +++++++++
sw/inc/unoflatpara.hxx | 138 ---------
sw/inc/unofootnote.hxx | 218 ---------------
sw/inc/unoframe.hxx | 10
sw/inc/unoidx.hxx | 372 --------------------------
sw/inc/unoidxcoll.hxx | 76 +++++
sw/inc/unomailmerge.hxx | 196 -------------
sw/inc/unomod.hxx | 164 -----------
sw/inc/unoparaframeenum.hxx | 115 --------
sw/inc/unoport.hxx | 309 ---------------------
sw/inc/unoredline.hxx | 31 --
sw/inc/unorefmark.hxx | 163 -----------
sw/inc/unosection.hxx | 244 -----------------
sw/inc/unotbl.hxx | 19 -
sw/inc/unotextmarkup.hxx | 102 -------
sw/inc/unotxdoc.hxx | 13
sw/source/core/inc/unobookmark.hxx | 278 +++++++++++++++++++
sw/source/core/inc/unoevent.hxx | 112 +++++++
sw/source/core/inc/unofield.hxx | 245 +++++++++++++++++
sw/source/core/inc/unoflatpara.hxx | 138 +++++++++
sw/source/core/inc/unofootnote.hxx | 218 +++++++++++++++
sw/source/core/inc/unoidx.hxx | 324 ++++++++++++++++++++++
sw/source/core/inc/unoparaframeenum.hxx | 115 ++++++++
sw/source/core/inc/unoport.hxx | 350 ++++++++++++++++++++++++
sw/source/core/inc/unorefmark.hxx | 163 +++++++++++
sw/source/core/inc/unosection.hxx | 244 +++++++++++++++++
sw/source/core/inc/unotextmarkup.hxx | 102 +++++++
sw/source/core/unocore/unobkm.cxx | 33 --
sw/source/core/unocore/unocrsrhelper.cxx | 189 ++++++++++++-
sw/source/core/unocore/unoevtlstnr.cxx | 92 ------
sw/source/core/unocore/unofield.cxx | 161 +++++++----
sw/source/core/unocore/unoflatpara.cxx | 11
sw/source/core/unocore/unoframe.cxx | 45 ++-
sw/source/core/unocore/unoftn.cxx | 29 --
sw/source/core/unocore/unoidx.cxx | 86 ++----
sw/source/core/unocore/unoobj.cxx | 15 -
sw/source/core/unocore/unoobj2.cxx | 2
sw/source/core/unocore/unoparagraph.cxx | 33 +-
sw/source/core/unocore/unoport.cxx | 42 +-
sw/source/core/unocore/unoportenum.cxx | 3
sw/source/core/unocore/unoredline.cxx | 20 -
sw/source/core/unocore/unorefmk.cxx | 62 +---
sw/source/core/unocore/unosect.cxx | 34 --
sw/source/core/unocore/unotbl.cxx | 182 +++++++-----
sw/source/core/unocore/unotext.cxx | 1
sw/source/ui/inc/unoatxt.hxx | 290 ++++++++++++++++++++
sw/source/ui/inc/unomailmerge.hxx | 196 +++++++++++++
sw/source/ui/inc/unomod.hxx | 164 +++++++++++
sw/source/ui/shells/basesh.cxx | 2
sw/source/ui/uno/RefreshListenerContainer.cxx | 48 ---
sw/source/ui/uno/unotxdoc.cxx | 65 +++-
sw/source/ui/uno/unotxvw.cxx | 279 ++++---------------
60 files changed, 3907 insertions(+), 3873 deletions(-)
New commits:
commit 81a915f98167062707d8c250cabc0483ff67cea9
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 02:00:11 2013 +0100
sw: remove class SwEventListenerContainer
Change-Id: I576f5a0bdf04224d7032e0f592d2ad5cd9e77908
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index d739c72..71d1044 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -431,7 +431,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/unocore/unocrsrhelper \
sw/source/core/unocore/unodraw \
sw/source/core/unocore/unoevent \
- sw/source/core/unocore/unoevtlstnr \
sw/source/core/unocore/unofield \
sw/source/core/unocore/unoflatpara \
sw/source/core/unocore/unoframe \
diff --git a/sw/inc/unoevtlstnr.hxx b/sw/inc/unoevtlstnr.hxx
deleted file mode 100644
index a0e9d90..0000000
--- a/sw/inc/unoevtlstnr.hxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- 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 _UNOEVTLSTNR_HXX
-#define _UNOEVTLSTNR_HXX
-
-#include <com/sun/star/uno/Reference.h>
-#include <vector>
-
-namespace com{namespace sun{namespace star{
- namespace lang
- {
- class XEventListener;
- }
-}}}
-
-// Managing the EventListeners.
-
-typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * XEventListenerPtr;
-typedef std::vector<XEventListenerPtr> SwEvtLstnrArray;
-
-class SwEventListenerContainer
-{
- protected:
- SwEvtLstnrArray* pListenerArr;
- ::com::sun::star::uno::XInterface* pxParent;
- public:
- SwEventListenerContainer( ::com::sun::star::uno::XInterface* pxParent);
- ~SwEventListenerContainer();
-
- void AddListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & rxListener);
- sal_Bool RemoveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & rxListener);
- void Disposing();
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unoevtlstnr.cxx b/sw/source/core/unocore/unoevtlstnr.cxx
deleted file mode 100644
index 4d7d017..0000000
--- a/sw/source/core/unocore/unoevtlstnr.cxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- 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 .
- */
-
-#include <unoevtlstnr.hxx>
-#include <com/sun/star/lang/EventObject.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-
-SwEventListenerContainer::SwEventListenerContainer( uno::XInterface* _pxParent) :
- pListenerArr(0),
- pxParent(_pxParent)
-{
-}
-
-SwEventListenerContainer::~SwEventListenerContainer()
-{
- if(pListenerArr && !pListenerArr->empty())
- {
- for(SwEvtLstnrArray::iterator it = pListenerArr->begin(); it != pListenerArr->end(); ++it)
- delete *it;
- pListenerArr->clear();
- }
- delete pListenerArr;
-}
-
-void SwEventListenerContainer::AddListener(const uno::Reference< lang::XEventListener > & rxListener)
-{
- if(!pListenerArr)
- pListenerArr = new SwEvtLstnrArray;
- uno::Reference< lang::XEventListener > * pInsert = new uno::Reference< lang::XEventListener > ;
- *pInsert = rxListener;
- pListenerArr->push_back(pInsert);
-}
-
-sal_Bool SwEventListenerContainer::RemoveListener(const uno::Reference< lang::XEventListener > & rxListener)
-{
- if(!pListenerArr)
- return sal_False;
- else
- {
- lang::XEventListener* pLeft = rxListener.get();
- for(sal_uInt16 i = 0; i < pListenerArr->size(); i++)
- {
- XEventListenerPtr pElem = (*pListenerArr)[i];
- lang::XEventListener* pRight = pElem->get();
- if(pLeft == pRight)
- {
- pListenerArr->erase(pListenerArr->begin() + i);
- delete pElem;
- return sal_True;
- }
- }
- }
- return sal_False;
-}
-
-void SwEventListenerContainer::Disposing()
-{
- if(!pListenerArr)
- return;
-
- lang::EventObject aObj(pxParent);
- for(sal_uInt16 i = 0; i < pListenerArr->size(); i++)
- {
- XEventListenerPtr pElem = (*pListenerArr)[i];
- (*pElem)->disposing(aObj);
- delete pElem;
- }
- pListenerArr->clear();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4b43155ff8942d6c092e3fd1131ca708a813a05a
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 01:58:15 2013 +0100
sw: remove SwEventListenerContainer in SwXTextCursor
was totally pointless since this one doesn't even implement XComponent
Change-Id: I0b8d9b0299f6fd06f2bfe5f75be4cbef5fd672b3
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index bce3278..ae80ae3 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -73,7 +73,6 @@
#include <unomap.hxx>
#include <unosett.hxx>
#include <unoprnms.hxx>
-#include <unoevtlstnr.hxx>
#include <unodraw.hxx>
#include <unocoll.hxx>
#include <unostyle.hxx>
@@ -707,15 +706,12 @@ class SwXTextCursor::Impl
{
public:
-
const SfxItemPropertySet & m_rPropSet;
const enum CursorType m_eType;
const uno::Reference< text::XText > m_xParentText;
- SwEventListenerContainer m_ListenerContainer;
bool m_bIsDisposed;
- Impl( SwXTextCursor & rThis,
- SwDoc & rDoc,
+ Impl( SwDoc & rDoc,
const enum CursorType eType,
uno::Reference<text::XText> xParent,
SwPosition const& rPoint, SwPosition const*const pMark)
@@ -723,7 +719,6 @@ public:
, m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
, m_eType(eType)
, m_xParentText(xParent)
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
, m_bIsDisposed(false)
{
if (pMark)
@@ -754,7 +749,6 @@ public:
void Invalidate() {
m_bIsDisposed = true;
- m_ListenerContainer.Disposing();
}
protected:
// SwClient
@@ -810,14 +804,13 @@ SwXTextCursor::SwXTextCursor(
const enum CursorType eType,
const SwPosition& rPos,
SwPosition const*const pMark)
- : m_pImpl( new SwXTextCursor::Impl(*this, rDoc, eType, xParent,
- rPos, pMark ) )
+ : m_pImpl( new Impl(rDoc, eType, xParent, rPos, pMark) )
{
}
SwXTextCursor::SwXTextCursor(uno::Reference< text::XText > const& xParent,
SwPaM const& rSourceCursor, const enum CursorType eType)
- : m_pImpl( new SwXTextCursor::Impl(*this, *rSourceCursor.GetDoc(), eType,
+ : m_pImpl( new Impl(*rSourceCursor.GetDoc(), eType,
xParent, *rSourceCursor.GetPoint(),
rSourceCursor.HasMark() ? rSourceCursor.GetMark() : 0) )
{
commit e31813b0478e43d9fa16ad09c9c9d1d0ade71ec9
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 01:51:00 2013 +0100
sw: replace SwEventListenerContainer in SwXParagraph
Change-Id: Icda5087a4d80309701799df85b1dc9412e8c876a
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 5b3b12a..1331438 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -18,13 +18,15 @@
*/
#include <unoparagraph.hxx>
+
+#include <cppuhelper/interfacecontainer.h>
+
#include <cmdid.h>
#include <unomid.h>
#include <unoparaframeenum.hxx>
#include <unotext.hxx>
#include <unotextrange.hxx>
#include <unoport.hxx>
-#include <unoevtlstnr.hxx>
#include <unomap.hxx>
#include <unocrsr.hxx>
#include <unoprnms.hxx>
@@ -101,10 +103,12 @@ static beans::PropertyState lcl_SwXParagraph_getPropertyState(
class SwXParagraph::Impl
: public SwClient
{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
public:
SwXParagraph & m_rThis;
- SwEventListenerContainer m_ListenerContainer;
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
SfxItemPropertySet const& m_rPropSet;
bool m_bIsDescriptor;
sal_Int32 m_nSelectionStartPos;
@@ -118,7 +122,7 @@ public:
const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = -1)
: SwClient(pTxtNode)
, m_rThis(rThis)
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_EventListeners(m_Mutex)
, m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH))
// #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
, m_bIsDescriptor((0 == pTxtNode) ? true : false)
@@ -175,7 +179,8 @@ void SwXParagraph::Impl::Modify( const SfxPoolItem *pOld, const SfxPoolItem *pNe
ClientModify(this, pOld, pNew);
if (!GetRegisteredIn())
{
- m_ListenerContainer.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
+ m_EventListeners.disposeAndClear(ev);
}
}
@@ -1116,7 +1121,8 @@ void SAL_CALL SwXParagraph::dispose() throw (uno::RuntimeException)
SwParaSelection aParaSel( aCursor );
pTxtNode->GetDoc()->DelFullPara(aCursor);
}
- m_pImpl->m_ListenerContainer.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_pImpl->m_EventListeners.disposeAndClear(ev);
}
}
@@ -1124,26 +1130,16 @@ void SAL_CALL SwXParagraph::addEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetTxtNode())
- {
- throw uno::RuntimeException();
- }
- m_pImpl->m_ListenerContainer.AddListener(xListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
void SAL_CALL SwXParagraph::removeEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetTxtNode() ||
- !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
- {
- throw uno::RuntimeException();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
uno::Reference< container::XEnumeration > SAL_CALL
commit fb24b72209b815a897f3e5f841785d84ef2d6f7f
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 01:47:35 2013 +0100
sw: replace SwEventListenerContainer in SwXTextSection
Change-Id: Ic7e42f42d40593334c85afd5ec264e6fb2dcfbb1
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 920d525..2f0a7cc 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -17,10 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <unosection.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/text/SectionFileLink.hpp>
+#include <cppuhelper/interfacecontainer.h>
+
#include <cmdid.h>
#include <hintids.hxx>
#include <svl/urihelper.hxx>
@@ -32,9 +35,7 @@
#include <vcl/svapp.hxx>
#include <fmtclds.hxx>
#include <unotextrange.hxx>
-#include <unosection.hxx>
#include <TextCursorHelper.hxx>
-#include <unoevtlstnr.hxx>
#include <unoport.hxx>
#include <redline.hxx>
#include <unomap.hxx>
@@ -103,12 +104,13 @@ struct SwTextSectionProperties_Impl
class SwXTextSection::Impl
: public SwClient
{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
public:
-
SwXTextSection & m_rThis;
const SfxItemPropertySet & m_rPropSet;
- SwEventListenerContainer m_ListenerContainer;
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
const bool m_bIndexHeader;
bool m_bIsDescriptor;
::rtl::OUString m_sName;
@@ -121,7 +123,7 @@ public:
: SwClient(pFmt)
, m_rThis(rThis)
, m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_SECTION))
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_EventListeners(m_Mutex)
, m_bIndexHeader(bIndexHeader)
// #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
, m_bIsDescriptor((0 == pFmt) ? true : false)
@@ -166,7 +168,8 @@ void SwXTextSection::Impl::Modify( const SfxPoolItem *pOld, const SfxPoolItem *p
ClientModify(this, pOld, pNew);
if (!GetRegisteredIn())
{
- m_ListenerContainer.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
+ m_EventListeners.disposeAndClear(ev);
}
}
@@ -470,26 +473,16 @@ void SAL_CALL SwXTextSection::addEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetSectionFmt())
- {
- throw uno::RuntimeException();
- }
- m_pImpl->m_ListenerContainer.AddListener(xListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
void SAL_CALL SwXTextSection::removeEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetSectionFmt() ||
- !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
- {
- throw uno::RuntimeException();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
uno::Reference< beans::XPropertySetInfo > SAL_CALL
commit 99990c997f3329648296bc62f11830647f121b00
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 01:38:29 2013 +0100
sw: replace SwEventListenerContainer in SwXReferenceMark,SwXMeta
Change-Id: Iba34cbc9afcd372426a90f3fd5e2d5fa997d7c5e
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 84d0ca3..e606b1c 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -19,6 +19,7 @@
#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
#include <vcl/svapp.hxx>
#include <unomid.h>
@@ -27,7 +28,6 @@
#include <unotextcursor.hxx>
#include <unomap.hxx>
#include <unocrsr.hxx>
-#include <unoevtlstnr.hxx>
#include <unocrsrhelper.hxx>
#include <doc.hxx>
#include <ndtxt.hxx>
@@ -46,9 +46,12 @@ using ::rtl::OUString;
class SwXReferenceMark::Impl
: public SwClient
{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+ SwXReferenceMark & m_rThis;
public:
- SwEventListenerContainer m_ListenerContainer;
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
bool m_bIsDescriptor;
SwDoc * m_pDoc;
const SwFmtRefMark * m_pMarkFmt;
@@ -57,7 +60,8 @@ public:
Impl( SwXReferenceMark & rThis,
SwDoc *const pDoc, SwFmtRefMark const*const pRefMark)
: SwClient((pDoc) ? pDoc->GetUnoCallBack() : 0)
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_rThis(rThis)
+ , m_EventListeners(m_Mutex)
// #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
, m_bIsDescriptor((0 == pRefMark) ? true : false)
, m_pDoc(pDoc)
@@ -84,9 +88,10 @@ void SwXReferenceMark::Impl::Invalidate()
{
const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
}
- m_ListenerContainer.Disposing();
m_pDoc = 0;
m_pMarkFmt = 0;
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
+ m_EventListeners.disposeAndClear(ev);
}
void SwXReferenceMark::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
@@ -374,26 +379,16 @@ void SAL_CALL SwXReferenceMark::addEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->IsValid())
- {
- throw uno::RuntimeException();
- }
- m_pImpl->m_ListenerContainer.AddListener(xListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
void SAL_CALL SwXReferenceMark::removeEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->IsValid() ||
- !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
- {
- throw uno::RuntimeException();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
OUString SAL_CALL SwXReferenceMark::getName()
@@ -662,10 +657,11 @@ SwXMetaText::createTextCursorByRange(
class SwXMeta::Impl
: public SwClient
{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
public:
-
- SwEventListenerContainer m_ListenerContainer;
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr<const TextRangeList_t> m_pTextPortions;
SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -680,7 +676,7 @@ public:
uno::Reference<text::XText> const& xParentText,
TextRangeList_t const * const pPortions)
: SwClient(pMeta)
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_EventListeners(m_Mutex)
, m_pTextPortions( pPortions )
, m_bIsDisposed( false )
// #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
@@ -713,8 +709,10 @@ void SwXMeta::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
if (!GetRegisteredIn()) // removed => dispose
{
- m_ListenerContainer.Disposing();
m_bIsDisposed = true;
+ lang::EventObject const ev(
+ static_cast< ::cppu::OWeakObject&>(m_Text.GetXMeta()));
+ m_EventListeners.disposeAndClear(ev);
m_Text.Invalidate();
}
}
@@ -936,13 +934,8 @@ SwXMeta::addEventListener(
uno::Reference< lang::XEventListener> const & xListener )
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- m_pImpl->m_ListenerContainer.AddListener(xListener);
- if (m_pImpl->m_bIsDisposed)
- {
- m_pImpl->m_ListenerContainer.Disposing();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
void SAL_CALL
@@ -950,12 +943,8 @@ SwXMeta::removeEventListener(
uno::Reference< lang::XEventListener> const & xListener )
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->m_bIsDisposed)
- {
- m_pImpl->m_ListenerContainer.RemoveListener(xListener);
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
void SAL_CALL
@@ -966,7 +955,8 @@ SwXMeta::dispose() throw (uno::RuntimeException)
if (m_pImpl->m_bIsDescriptor)
{
m_pImpl->m_pTextPortions.reset();
- m_pImpl->m_ListenerContainer.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_pImpl->m_EventListeners.disposeAndClear(ev);
m_pImpl->m_bIsDisposed = true;
m_pImpl->m_Text.Invalidate();
}
commit 9f0f289c51765c671cbc8ef317c81e6fa42c6718
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 01:24:54 2013 +0100
sw: replace SwEventListenerContainer in SwXDocumentIndex(,Mark}
Change-Id: I52b826ca071f71597f7d10f0ee44bf6c2d2468c1
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 6a3964d..b38c7d8 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -55,7 +55,6 @@
#include <docsh.hxx>
#include <chpfld.hxx>
#include <SwStyleNameMapper.hxx>
-#include <unoevtlstnr.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/string.hxx>
@@ -319,15 +318,14 @@ lcl_TypeToPropertyMap_Index(const TOXTypes eType)
class SwXDocumentIndex::Impl
: public SwClient
{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
public:
-
SwXDocumentIndex & m_rThis;
+ ::cppu::OMultiTypeInterfaceContainerHelper m_Listeners;
SfxItemPropertySet const& m_rPropSet;
const TOXTypes m_eTOXType;
- SwEventListenerContainer m_ListenerContainer;
- osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
- ::cppu::OInterfaceContainerHelper m_RefreshListeners;
bool m_bIsDescriptor;
SwDoc * m_pDoc;
::std::auto_ptr<SwDocIndexDescriptorProperties_Impl> m_pProps;
@@ -340,11 +338,10 @@ public:
SwTOXBaseSection const*const pBaseSection)
: SwClient((pBaseSection) ? pBaseSection->GetFmt() : 0)
, m_rThis(rThis)
+ , m_Listeners(m_Mutex)
, m_rPropSet(
*aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Index(eType)))
, m_eTOXType(eType)
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
- , m_RefreshListeners(m_Mutex)
// #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
, m_bIsDescriptor((0 == pBaseSection) ? true : false)
, m_pDoc(&rDoc)
@@ -394,9 +391,8 @@ void SwXDocumentIndex::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *
if (!GetRegisteredIn())
{
- m_ListenerContainer.Disposing();
lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
- m_RefreshListeners.disposeAndClear(ev);
+ m_Listeners.disposeAndClear(ev);
}
}
@@ -1263,9 +1259,14 @@ void SAL_CALL SwXDocumentIndex::refresh() throw (uno::RuntimeException)
pTOXBase->UpdatePageNum();
}
- lang::EventObject const event(static_cast< ::cppu::OWeakObject*>(this));
- m_pImpl->m_RefreshListeners.notifyEach(
- & util::XRefreshListener::refreshed, event);
+ ::cppu::OInterfaceContainerHelper *const pContainer(
+ m_pImpl->m_Listeners.getContainer(
+ util::XRefreshListener::static_type()));
+ if (pContainer)
+ {
+ lang::EventObject const event(static_cast< ::cppu::OWeakObject*>(this));
+ pContainer->notifyEach(& util::XRefreshListener::refreshed, event);
+ }
}
void SAL_CALL SwXDocumentIndex::addRefreshListener(
@@ -1273,7 +1274,8 @@ void SAL_CALL SwXDocumentIndex::addRefreshListener(
throw (uno::RuntimeException)
{
// no need to lock here as m_pImpl is const and container threadsafe
- m_pImpl->m_RefreshListeners.addInterface(xListener);
+ m_pImpl->m_Listeners.addInterface(
+ util::XRefreshListener::static_type(), xListener);
}
void SAL_CALL SwXDocumentIndex::removeRefreshListener(
@@ -1281,7 +1283,8 @@ void SAL_CALL SwXDocumentIndex::removeRefreshListener(
throw (uno::RuntimeException)
{
// no need to lock here as m_pImpl is const and container threadsafe
- m_pImpl->m_RefreshListeners.removeInterface(xListener);
+ m_pImpl->m_Listeners.removeInterface(
+ util::XRefreshListener::static_type(), xListener);
}
void SAL_CALL
@@ -1390,13 +1393,9 @@ SwXDocumentIndex::addEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetRegisteredIn())
- {
- throw uno::RuntimeException();
- }
- m_pImpl->m_ListenerContainer.AddListener(xListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_Listeners.addInterface(
+ lang::XEventListener::static_type(), xListener);
}
void SAL_CALL
@@ -1404,13 +1403,9 @@ SwXDocumentIndex::removeEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetRegisteredIn() ||
- !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
- {
- throw uno::RuntimeException();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_Listeners.removeInterface(
+ lang::XEventListener::static_type(), xListener);
}
OUString SAL_CALL SwXDocumentIndex::getName() throw (uno::RuntimeException)
@@ -1503,13 +1498,15 @@ class SwXDocumentIndexMark::Impl
: public SwClient
{
private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+ SwXDocumentIndexMark & m_rThis;
bool m_bInReplaceMark;
public:
SfxItemPropertySet const& m_rPropSet;
const TOXTypes m_eTOXType;
- SwEventListenerContainer m_ListenerContainer;
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
bool m_bIsDescriptor;
SwDepend m_TypeDepend;
const SwTOXMark * m_pTOXMark;
@@ -1530,11 +1527,12 @@ public:
const enum TOXTypes eType,
SwTOXType *const pType, SwTOXMark const*const pMark)
: SwClient(const_cast<SwTOXMark*>(pMark))
+ , m_rThis(rThis)
, m_bInReplaceMark(false)
, m_rPropSet(
*aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Mark(eType)))
, m_eTOXType(eType)
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_EventListeners(m_Mutex)
// #i112513#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this
// , m_bIsDescriptor(0 == pMark)
, m_bIsDescriptor((0 == pMark) ? true : false)
@@ -1569,7 +1567,9 @@ public:
InsertTOXMark(rTOXType, rMark, rPam, 0);
} catch (...) {
OSL_FAIL("ReplaceTOXMark() failed!");
- m_ListenerContainer.Disposing();
+ lang::EventObject const ev(
+ static_cast< ::cppu::OWeakObject&>(m_rThis));
+ m_EventListeners.disposeAndClear(ev);
throw;
}
}
@@ -1593,7 +1593,8 @@ void SwXDocumentIndexMark::Impl::Invalidate()
}
if (!m_bInReplaceMark) // #i109983# only dispose on delete, not on replace!
{
- m_ListenerContainer.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
+ m_EventListeners.disposeAndClear(ev);
}
m_pDoc = 0;
m_pTOXMark = 0;
@@ -2036,13 +2037,8 @@ SwXDocumentIndexMark::addEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetRegisteredIn())
- {
- throw uno::RuntimeException();
- }
- m_pImpl->m_ListenerContainer.AddListener(xListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
void SAL_CALL
@@ -2050,13 +2046,8 @@ SwXDocumentIndexMark::removeEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetRegisteredIn() ||
- !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
- {
- throw uno::RuntimeException();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
uno::Reference< beans::XPropertySetInfo > SAL_CALL
commit 44df3bdc29445fd7a6307eee1d5f26df30f30a48
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 01:07:48 2013 +0100
sw: replace SwEventListenerContainer in SwXFootnote
Change-Id: I03c1b3ad6a774f00993279c0830029708ee966ba
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 5252202..148062b 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -19,6 +19,7 @@
#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
#include <vcl/svapp.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
@@ -30,7 +31,6 @@
#include <unoparagraph.hxx>
#include <unomap.hxx>
#include <unoprnms.hxx>
-#include <unoevtlstnr.hxx>
#include <doc.hxx>
#include <ftnidx.hxx>
#include <fmtftn.hxx>
@@ -49,12 +49,14 @@ using ::rtl::OUString;
class SwXFootnote::Impl
: public SwClient
{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
public:
SwXFootnote & m_rThis;
const bool m_bIsEndnote;
- SwEventListenerContainer m_ListenerContainer;
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
bool m_bIsDescriptor;
const SwFmtFtn * m_pFmtFtn;
::rtl::OUString m_sLabel;
@@ -65,7 +67,7 @@ public:
: SwClient((pDoc) ? pDoc->GetUnoCallBack() : 0)
, m_rThis(rThis)
, m_bIsEndnote(bIsEndnote)
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_EventListeners(m_Mutex)
// #i111177#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this
// , m_bIsDescriptor(0 == pFootnote)
, m_bIsDescriptor((0 == pFootnote) ? true : false)
@@ -99,9 +101,10 @@ void SwXFootnote::Impl::Invalidate()
{
const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
}
- m_ListenerContainer.Disposing();
m_pFmtFtn = 0;
m_rThis.SetDoc(0);
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
+ m_EventListeners.disposeAndClear(ev);
}
void SwXFootnote::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
@@ -399,13 +402,8 @@ SwXFootnote::addEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetFootnoteFormat())
- {
- throw uno::RuntimeException();
- }
- m_pImpl->m_ListenerContainer.AddListener(xListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
void SAL_CALL
@@ -413,13 +411,8 @@ SwXFootnote::removeEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->GetFootnoteFormat() ||
- !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
- {
- throw uno::RuntimeException();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
const SwStartNode *SwXFootnote::GetStartNode() const
commit 9652b5b7ad7364a4dc111eac387ca05cbd1ebaa6
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 01:01:37 2013 +0100
sw: replace SwEventListenerContainer in SwXBookmark
Change-Id: Ic3df366ffac317e0ebbda140a521fc95623ddafa
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 26a7db4..ccec957 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -20,13 +20,13 @@
#include <unobookmark.hxx>
#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
#include <vcl/svapp.hxx>
#include <TextCursorHelper.hxx>
#include <unotextrange.hxx>
#include <unomap.hxx>
#include <unoprnms.hxx>
-#include <unoevtlstnr.hxx>
#include <IMark.hxx>
#include <crossrefbookmark.hxx>
#include <doc.hxx>
@@ -62,9 +62,12 @@ namespace
class SwXBookmark::Impl
: public SwClient
{
+private:
+ SwXBookmark & m_rThis;
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
public:
- SwEventListenerContainer m_ListenerContainer;
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
SwDoc * m_pDoc;
::sw::mark::IMark * m_pRegisteredBookmark;
::rtl::OUString m_sMarkName;
@@ -73,11 +76,12 @@ public:
Impl( SwXBookmark & rThis,
SwDoc *const pDoc, ::sw::mark::IMark *const /*pBookmark*/)
: SwClient()
- , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
+ , m_rThis(rThis)
+ , m_EventListeners(m_Mutex)
, m_pDoc(pDoc)
, m_pRegisteredBookmark(0)
{
- // DO NOT regiserInMark here! (because SetXBookmark would delete rThis)
+ // DO NOT registerInMark here! (because SetXBookmark would delete rThis)
}
void registerInMark(SwXBookmark & rThis, ::sw::mark::IMark *const pBkmk);
@@ -94,7 +98,8 @@ void SwXBookmark::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
{
m_pRegisteredBookmark = NULL;
m_pDoc = NULL;
- m_ListenerContainer.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(m_rThis));
+ m_EventListeners.disposeAndClear(ev);
}
}
@@ -309,26 +314,16 @@ void SAL_CALL SwXBookmark::addEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->m_pRegisteredBookmark)
- {
- throw uno::RuntimeException();
- }
- m_pImpl->m_ListenerContainer.AddListener(xListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
void SAL_CALL SwXBookmark::removeEventListener(
const uno::Reference< lang::XEventListener > & xListener)
throw (uno::RuntimeException)
{
- SolarMutexGuard g;
-
- if (!m_pImpl->m_pRegisteredBookmark ||
- !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
- {
- throw uno::RuntimeException();
- }
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
OUString SAL_CALL SwXBookmark::getName()
commit f062c89e49d5028efe76a2a3f33294da0d2b32cf
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 00:54:40 2013 +0100
sw: replace SwEventListenerContainer in SwXTextPortion
Change-Id: Iac39d68388daa1a6d8e8a41e9ff59d290d5d050b
diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx
index 27230e5..0eacbb0 100644
--- a/sw/source/core/inc/unoport.hxx
+++ b/sw/source/core/inc/unoport.hxx
@@ -19,9 +19,8 @@
#ifndef SW_UNOPORT_HXX
#define SW_UNOPORT_HXX
-#include <unocrsr.hxx>
-#include <unoevtlstnr.hxx>
-#include <calbck.hxx>
+#include <memory>
+#include <deque>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/XTextRange.hpp>
@@ -35,12 +34,15 @@
#include <com/sun/star/text/XFootnote.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
+
#include <cppuhelper/implbase8.hxx>
#include <cppuhelper/implbase3.hxx>
+
#include <svl/itemprop.hxx>
-#include <memory>
-#include <deque>
+#include <unocrsr.hxx>
+#include <calbck.hxx>
+#include <unobaseclass.hxx>
class SwFmtFld;
@@ -92,7 +94,9 @@ class SwXTextPortion : public cppu::WeakImplHelper8
{
private:
- SwEventListenerContainer m_ListenerContainer;
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
const SfxItemPropertySet * m_pPropSet;
const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
m_xParentText;
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 5ca68f9..5b3b12a 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -24,6 +24,7 @@
#include <unotext.hxx>
#include <unotextrange.hxx>
#include <unoport.hxx>
+#include <unoevtlstnr.hxx>
#include <unomap.hxx>
#include <unocrsr.hxx>
#include <unoprnms.hxx>
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 56dfe2f..831ef29 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -17,13 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <unoport.hxx>
+
#include <cmdid.h>
#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
#include <vcl/svapp.hxx>
#include <svl/itemprop.hxx>
#include <unocrsrhelper.hxx>
-#include <unoport.hxx>
#include <unoparaframeenum.hxx>
#include <unotextrange.hxx>
#include <unomap.hxx>
@@ -50,6 +52,18 @@ using namespace ::com::sun::star;
/******************************************************************
* SwXTextPortion
******************************************************************/
+
+class SwXTextPortion::Impl
+{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+
+public:
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
+
+ Impl() : m_EventListeners(m_Mutex) { }
+};
+
void SwXTextPortion::init(const SwUnoCrsr* pPortionCursor)
{
SwUnoCrsr* pUnoCursor =
@@ -65,7 +79,7 @@ void SwXTextPortion::init(const SwUnoCrsr* pPortionCursor)
SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
uno::Reference< text::XText > const& rParent,
SwTextPortionType eType)
- : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ : m_pImpl(new Impl)
, m_pPropSet(aSwMapProvider.GetPropertySet(
(PORTION_REDLINE_START == eType ||
PORTION_REDLINE_END == eType)
@@ -87,7 +101,7 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
uno::Reference< text::XText > const& rParent,
SwFrmFmt& rFmt )
- : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ : m_pImpl(new Impl)
, m_pPropSet(aSwMapProvider.GetPropertySet(
PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
, m_xParentText(rParent)
@@ -107,7 +121,7 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
SwTxtRuby const& rAttr,
uno::Reference< text::XText > const& xParent,
sal_Bool bIsEnd )
- : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
+ : m_pImpl(new Impl)
, m_pPropSet(aSwMapProvider.GetPropertySet(
PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
, m_xParentText(xParent)
@@ -847,20 +861,20 @@ throw( uno::RuntimeException )
pUnoCrsr->Remove(this);
}
-void SwXTextPortion::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXTextPortion::addEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
- if(!GetRegisteredIn())
- throw uno::RuntimeException();
-
- m_ListenerContainer.AddListener(aListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
-void SwXTextPortion::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXTextPortion::removeEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
- if (!GetRegisteredIn() || !m_ListenerContainer.RemoveListener(aListener))
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
uno::Reference< container::XEnumeration > SwXTextPortion::createContentEnumeration(const OUString& /*aServiceName*/)
commit c6fae31ebabf9067428d424ed5c0fc59f7c998b2
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 00:32:38 2013 +0100
sw: replace SwEventListenerContainer in SwXTextField,SwXFieldMaster
Change-Id: I554ca3455ebddf6a4595175e8d71ae38b8b43e59
diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index 0039791..63ebb68 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -33,7 +33,7 @@
#include <tools/string.hxx>
#include <calbck.hxx>
-#include <unoevtlstnr.hxx>
+#include <unobaseclass.hxx>
class SwFieldType;
@@ -52,7 +52,11 @@ class SwXFieldMaster : public cppu::WeakImplHelper4
>,
public SwClient
{
- SwEventListenerContainer aLstnrCntnr;
+
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
sal_uInt16 nResTypeId;
SwDoc* m_pDoc;
@@ -126,7 +130,11 @@ class SwXTextField : public cppu::WeakImplHelper5
>,
public SwClient
{
- SwEventListenerContainer aLstnrCntnr;
+
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
const SwFmtFld* pFmtFld;
SwDoc* m_pDoc;
SwTextAPIObject* m_pTextObject;
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 21ddff3..0553e9c 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -386,6 +386,18 @@ static sal_uInt16 lcl_GetPropertyMapOfService( sal_uInt16 nServiceId )
/******************************************************************
* SwXFieldMaster
******************************************************************/
+
+class SwXFieldMaster::Impl
+{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+
+public:
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
+
+ Impl() : m_EventListeners(m_Mutex) { }
+};
+
TYPEINIT1(SwXFieldMaster, SwClient);
namespace
@@ -469,8 +481,9 @@ uno::Sequence< OUString > SwXFieldMaster::getSupportedServiceNames(void) throw(
return aRet;
}
-SwXFieldMaster::SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId) :
- aLstnrCntnr( (XPropertySet*)this),
+SwXFieldMaster::SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId)
+ : m_pImpl(new Impl)
+ ,
nResTypeId(nResId),
m_pDoc(pDoc),
m_bIsDescriptor(sal_True),
@@ -482,9 +495,10 @@ SwXFieldMaster::SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId) :
pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
}
-SwXFieldMaster::SwXFieldMaster(SwFieldType& rType, SwDoc* pDoc) :
- SwClient(&rType),
- aLstnrCntnr( (XPropertySet*)this),
+SwXFieldMaster::SwXFieldMaster(SwFieldType& rType, SwDoc* pDoc)
+ : SwClient(&rType)
+ , m_pImpl(new Impl)
+ ,
nResTypeId(rType.Which()),
m_pDoc(pDoc),
m_bIsDescriptor(sal_False),
@@ -932,19 +946,20 @@ void SwXFieldMaster::dispose(void) throw( uno::RuntimeException )
throw uno::RuntimeException();
}
-void SwXFieldMaster::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
- throw( uno::RuntimeException )
+void SAL_CALL SwXFieldMaster::addEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn())
- throw uno::RuntimeException();
- aLstnrCntnr.AddListener(aListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
-void SwXFieldMaster::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
- throw( uno::RuntimeException )
+void SAL_CALL SwXFieldMaster::removeEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
void SwXFieldMaster::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
@@ -952,8 +967,9 @@ void SwXFieldMaster::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
ClientModify(this, pOld, pNew);
if(!GetRegisteredIn())
{
- aLstnrCntnr.Disposing();
m_pDoc = 0;
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_pImpl->m_EventListeners.disposeAndClear(ev);
}
}
OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc)
@@ -1064,6 +1080,17 @@ struct SwFieldProperties_Impl
};
+class SwXTextField::Impl
+{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+
+public:
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
+
+ Impl() : m_EventListeners(m_Mutex) { }
+};
+
TYPEINIT1(SwXTextField, SwClient);
namespace
@@ -1088,8 +1115,9 @@ sal_Int64 SAL_CALL SwXTextField::getSomething( const uno::Sequence< sal_Int8 >&
return 0;
}
-SwXTextField::SwXTextField(sal_uInt16 nServiceId, SwDoc* pDoc) :
- aLstnrCntnr( (XTextContent*)this),
+SwXTextField::SwXTextField(sal_uInt16 nServiceId, SwDoc* pDoc)
+ : m_pImpl(new Impl)
+ ,
pFmtFld(0),
m_pDoc(pDoc),
m_pTextObject(0),
@@ -1111,8 +1139,9 @@ SwXTextField::SwXTextField(sal_uInt16 nServiceId, SwDoc* pDoc) :
}
-SwXTextField::SwXTextField(const SwFmtFld& rFmt, SwDoc* pDc) :
- aLstnrCntnr( (XTextContent*)this),
+SwXTextField::SwXTextField(const SwFmtFld& rFmt, SwDoc* pDc)
+ : m_pImpl(new Impl)
+ ,
pFmtFld(&rFmt),
m_pDoc(pDc),
m_pTextObject(0),
@@ -1843,17 +1872,20 @@ void SwXTextField::dispose(void) throw( uno::RuntimeException )
}
}
-void SwXTextField::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXTextField::addEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn())
- throw uno::RuntimeException();
- aLstnrCntnr.AddListener(aListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
-void SwXTextField::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXTextField::removeEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
uno::Reference< beans::XPropertySetInfo > SwXTextField::getPropertySetInfo(void)
@@ -2351,9 +2383,10 @@ void SwXTextField::Invalidate()
if (GetRegisteredIn())
{
((SwModify*)GetRegisteredIn())->Remove(this);
- aLstnrCntnr.Disposing();
pFmtFld = 0;
m_pDoc = 0;
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_pImpl->m_EventListeners.disposeAndClear(ev);
}
}
commit 080dc03a1ee42ca299a7fe10c1887c819ad8926b
Author: Michael Stahl <mstahl at redhat.com>
Date: Sun Feb 3 00:05:59 2013 +0100
sw: replace SwEventListenerContainer in SwXTextTable
OMultiTypeInterfaceContainerHelper appears to be a bit verbose to use...
it needs a notifyEach method at least. But hopefully it will at least
use less memory in case there are no listeners.
Change-Id: I9f72ee8e4ad61f657f565b99cc37126d78b0c5cc
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 88f4bf3..9ba6414 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -44,7 +44,6 @@
#include <calbck.hxx>
#include <TextCursorHelper.hxx>
-#include <unoevtlstnr.hxx>
#include <unotext.hxx>
@@ -289,9 +288,10 @@ class SwXTextTable : public cppu::WeakImplHelper10
>,
public SwClient
{
- ::osl::Mutex m_Mutex;
- ::cppu::OInterfaceContainerHelper m_ChartListeners;
- SwEventListenerContainer aLstnrCntnr;
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
const SfxItemPropertySet* m_pPropSet;
// Descriptor-interface
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 91b7747..bce3278 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -73,7 +73,7 @@
#include <unomap.hxx>
#include <unosett.hxx>
#include <unoprnms.hxx>
-#include <unotbl.hxx>
+#include <unoevtlstnr.hxx>
#include <unodraw.hxx>
#include <unocoll.hxx>
#include <unostyle.hxx>
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 166c2e2..851a807 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -122,6 +122,18 @@ lcl_SendChartEvent(::cppu::OWeakObject & rSource,
& chart::XChartDataChangeEventListener::chartDataChanged, event);
}
+static void
+lcl_SendChartEvent(::cppu::OWeakObject & rSource,
+ ::cppu::OMultiTypeInterfaceContainerHelper & rListeners)
+{
+ ::cppu::OInterfaceContainerHelper *const pContainer(rListeners.getContainer(
+ chart::XChartDataChangeEventListener::static_type()));
+ if (pContainer)
+ {
+ lcl_SendChartEvent(rSource, *pContainer);
+ }
+}
+
static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine)
{
rSvxLine.SetColor(Color(rLine.Color));
@@ -1893,9 +1905,18 @@ void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNe
/******************************************************************
* SwXTextTable
******************************************************************/
-/****************************************************************************
- Tabellenbeschreibung
-****************************************************************************/
+
+class SwXTextTable::Impl
+{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+
+public:
+ ::cppu::OMultiTypeInterfaceContainerHelper m_Listeners;
+
+ Impl() : m_Listeners(m_Mutex) { }
+};
+
class SwTableProperties_Impl
{
SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
@@ -2129,9 +2150,8 @@ sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >&
TYPEINIT1(SwXTextTable, SwClient)
SwXTextTable::SwXTextTable()
- : m_ChartListeners(m_Mutex)
+ : m_pImpl(new Impl)
,
- aLstnrCntnr( (text::XTextTable*)this),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
pTableProps(new SwTableProperties_Impl),
bIsDescriptor(sal_True),
@@ -2144,9 +2164,8 @@ SwXTextTable::SwXTextTable()
SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt)
: SwClient( &rFrmFmt )
- , m_ChartListeners(m_Mutex)
+ , m_pImpl(new Impl)
,
- aLstnrCntnr( (text::XTextTable*)this),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
pTableProps(0),
bIsDescriptor(sal_False),
@@ -2386,17 +2405,22 @@ void SwXTextTable::dispose(void) throw( uno::RuntimeException )
throw uno::RuntimeException();
}
-void SwXTextTable::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXTextTable::addEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn())
- throw uno::RuntimeException();
- aLstnrCntnr.AddListener(aListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_Listeners.addInterface(
+ lang::XEventListener::static_type(), xListener);
}
-void SwXTextTable::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXTextTable::removeEventListener(
+ const uno::Reference< lang::XEventListener > & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_Listeners.removeInterface(
+ lang::XEventListener::static_type(), xListener);
}
uno::Reference< table::XCell > SwXTextTable::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
@@ -2738,7 +2762,7 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData
}
if ( bChanged )
{
- lcl_SendChartEvent(*this, m_ChartListeners);
+ lcl_SendChartEvent(*this, m_pImpl->m_Listeners);
}
}
}
@@ -2901,7 +2925,8 @@ void SAL_CALL SwXTextTable::addChartDataChangeEventListener(
throw (uno::RuntimeException)
{
// no need to lock here as m_pImpl is const and container threadsafe
- m_ChartListeners.addInterface(xListener);
+ m_pImpl->m_Listeners.addInterface(
+ chart::XChartDataChangeEventListener::static_type(), xListener);
}
void SAL_CALL SwXTextTable::removeChartDataChangeEventListener(
@@ -2909,7 +2934,8 @@ void SAL_CALL SwXTextTable::removeChartDataChangeEventListener(
throw (uno::RuntimeException)
{
// no need to lock here as m_pImpl is const and container threadsafe
- m_ChartListeners.removeInterface(xListener);
+ m_pImpl->m_Listeners.removeInterface(
+ chart::XChartDataChangeEventListener::static_type(), xListener);
}
sal_Bool SwXTextTable::isNotANumber(double nNumber) throw( uno::RuntimeException )
@@ -3033,7 +3059,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
if(bFirstRowAsLabel != bTmp)
{
- lcl_SendChartEvent(*this, m_ChartListeners);
+ lcl_SendChartEvent(*this, m_pImpl->m_Listeners);
bFirstRowAsLabel = bTmp;
}
}
@@ -3043,7 +3069,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
if(bFirstColumnAsLabel != bTmp)
{
- lcl_SendChartEvent(*this, m_ChartListeners);
+ lcl_SendChartEvent(*this, m_pImpl->m_Listeners);
bFirstColumnAsLabel = bTmp;
}
}
@@ -3617,13 +3643,12 @@ void SwXTextTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
ClientModify(this, pOld, pNew);
if(!GetRegisteredIn())
{
- aLstnrCntnr.Disposing();
lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
- m_ChartListeners.disposeAndClear(ev);
+ m_pImpl->m_Listeners.disposeAndClear(ev);
}
else
{
- lcl_SendChartEvent(*this, m_ChartListeners);
+ lcl_SendChartEvent(*this, m_pImpl->m_Listeners);
}
}
commit 54c08983cb615fe0474238aacd18284acbc5ec43
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Feb 2 22:56:20 2013 +0100
sw: replace SwEventListenerContainer in SwXFrame
Change-Id: I9136d14364196810f0f64b086b9b06e5b558286d
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index 1cbae7e..36309b8 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -16,8 +16,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef _UNOFRAME_HXX
-#define _UNOFRAME_HXX
+#ifndef SW_UNOFRAME_HXX
+#define SW_UNOFRAME_HXX
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/container/XNamed.hpp>
@@ -37,7 +37,6 @@
#include <flyenum.hxx>
#include <frmfmt.hxx>
-#include <unoevtlstnr.hxx>
#include <unotext.hxx>
class SdrObject;
@@ -57,7 +56,10 @@ class SwXFrame : public cppu::WeakImplHelper6
>,
public SwClient
{
- SwEventListenerContainer aLstnrCntnr;
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
const SfxItemPropertySet* m_pPropSet;
SwDoc* m_pDoc;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 2e02d0b..5ca640a 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -754,6 +754,19 @@ bool SwOLEProperties_Impl::AnyToItemSet(
return sal_True;
}
+
+class SwXFrame::Impl
+{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+
+public:
+ ::cppu::OInterfaceContainerHelper m_EventListeners;
+
+ Impl() : m_EventListeners(m_Mutex) { }
+};
+
+
namespace
{
class theSwXFrameUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXFrameUnoTunnelId > {};
@@ -800,8 +813,9 @@ uno::Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( uno::R
return aRet;
}
-SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pDoc) :
- aLstnrCntnr( (container::XNamed*)this),
+SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pDoc)
+ : m_pImpl(new Impl)
+ ,
m_pPropSet(pSet),
m_pDoc ( pDoc ),
eType(eSet),
@@ -851,9 +865,10 @@ SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pD
}
}
-SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const :: SfxItemPropertySet* pSet) :
- SwClient( &rFrmFmt ),
- aLstnrCntnr( (container::XNamed*)this),
+SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const :: SfxItemPropertySet* pSet)
+ : SwClient( &rFrmFmt )
+ , m_pImpl(new Impl)
+ ,
m_pPropSet(pSet),
m_pDoc( 0 ),
eType(eSet),
@@ -1989,17 +2004,20 @@ uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
return aRet;
}
-void SwXFrame::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXFrame::addEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn())
- throw uno::RuntimeException();
- aLstnrCntnr.AddListener(aListener);
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.addInterface(xListener);
}
-void SwXFrame::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXFrame::removeEventListener(
+ const uno::Reference<lang::XEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_EventListeners.removeInterface(xListener);
}
void SwXFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
@@ -2010,7 +2028,8 @@ void SwXFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
mxStyleData.clear();
mxStyleFamily.clear();
m_pDoc = 0;
- aLstnrCntnr.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_pImpl->m_EventListeners.disposeAndClear(ev);
}
}
commit 3c177e98c01bfabbeba90a0e571734b7055afd57
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Feb 2 22:35:55 2013 +0100
sw: remove class SwRefreshListenerContainer
Change-Id: Ieaec254358a70167deba1f604d766cceb8e3c5a7
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 264e35a..d739c72 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -667,7 +667,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/ui/uiview/viewsrch \
sw/source/ui/uiview/viewstat \
sw/source/ui/uiview/viewtab \
- sw/source/ui/uno/RefreshListenerContainer \
sw/source/ui/uno/SwXDocumentSettings \
sw/source/ui/uno/SwXFilterOptions \
sw/source/ui/uno/dlelstnr \
diff --git a/sw/inc/RefreshListenerContainer.hxx b/sw/inc/RefreshListenerContainer.hxx
deleted file mode 100644
index d06dfba..0000000
--- a/sw/inc/RefreshListenerContainer.hxx
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- 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 _REFRESH_LISTENER_CONTAINER_HXX_
-#define _REFRESH_LISTENER_CONTAINER_HXX_
-
-#include <unoevtlstnr.hxx>
-
-class SwRefreshListenerContainer : public SwEventListenerContainer
-{
-public:
- SwRefreshListenerContainer( ::com::sun::star::uno::XInterface* pxParent);
- void Refreshed();
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx
index 2636e71..0039791 100644
--- a/sw/source/core/inc/unofield.hxx
+++ b/sw/source/core/inc/unofield.hxx
@@ -33,7 +33,7 @@
#include <tools/string.hxx>
#include <calbck.hxx>
-#include <RefreshListenerContainer.hxx>
+#include <unoevtlstnr.hxx>
class SwFieldType;
diff --git a/sw/source/ui/uno/RefreshListenerContainer.cxx b/sw/source/ui/uno/RefreshListenerContainer.cxx
deleted file mode 100644
index 8ebae75..0000000
--- a/sw/source/ui/uno/RefreshListenerContainer.cxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- 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 .
- */
-
-#include <RefreshListenerContainer.hxx>
-#include <com/sun/star/lang/EventObject.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/util/XRefreshListener.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
-
-SwRefreshListenerContainer::SwRefreshListenerContainer( uno::XInterface* pxParent2 )
-: SwEventListenerContainer ( pxParent2 )
-{
-}
-
-void SwRefreshListenerContainer::Refreshed ()
-{
- if(!pListenerArr)
- return;
-
- lang::EventObject aObj(pxParent);
- for(sal_uInt16 i = 0, nEnd = pListenerArr->size(); i < nEnd ; i++)
- {
- Reference < XRefreshListener > xRefreshListener = Reference < XRefreshListener > ( *(*pListenerArr)[i], UNO_QUERY );
- xRefreshListener->refreshed(aObj);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9123b493e5e63fcb298a0afac2c50e6a0b5bb955
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Feb 2 22:31:48 2013 +0100
sw: replace SwRefreshListenerContainer in SwXTextDocument
Change-Id: I67ddeacc80b833cee26ad0d34c80b9ce52c4db95
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index d8f3fba..dea4ea7 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -16,8 +16,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef _UNOTXDOC_HXX
-#define _UNOTXDOC_HXX
+#ifndef SW_UNOTXDOC_HXX
+#define SW_UNOTXDOC_HXX
#include "swdllapi.h"
#include <sfx2/sfxbasemodel.hxx>
@@ -67,8 +67,8 @@
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase2.hxx> // helper for implementations
#include <cppuhelper/implbase4.hxx> // helper for implementations
-#include <RefreshListenerContainer.hxx>
+#include <unobaseclass.hxx>
#include <viewopt.hxx>
#define __IFC32 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10, Ifc11, Ifc12, Ifc13, Ifc14, Ifc15, Ifc16, \
@@ -163,8 +163,11 @@ class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
public SvxFmMSFactory,
public SfxBaseModel
{
+private:
+ class Impl;
+ ::sw::UnoImplPtr<Impl> m_pImpl;
+
ActionContextArr aActionArr;
- SwRefreshListenerContainer aRefreshCont;
const SfxItemPropertySet* pPropSet;
@@ -234,7 +237,7 @@ protected:
public:
SwXTextDocument(SwDocShell* pShell);
- inline void notifyRefreshListeners() { aRefreshCont.Refreshed(); }
+ void NotifyRefreshListeners();
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException);
virtual void SAL_CALL acquire( ) throw();
virtual void SAL_CALL release( ) throw();
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index a443ea8..27c9901 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -586,7 +586,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY );
SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) );
- pDoc->notifyRefreshListeners();
+ pDoc->NotifyRefreshListeners();
rSh.CalcLayout();
}
break;
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 9c8772e..12504c3 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -221,6 +221,18 @@ static void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell )
}
}
+class SwXTextDocument::Impl
+{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+
+public:
+ ::cppu::OInterfaceContainerHelper m_RefreshListeners;
+
+ Impl() : m_RefreshListeners(m_Mutex) { }
+
+};
+
namespace
{
class theSwXTextDocumentUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXTextDocumentUnoTunnelId > {};
@@ -341,11 +353,10 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio
return aBaseTypes;
}
-SwXTextDocument::SwXTextDocument(SwDocShell* pShell) :
- SfxBaseModel(pShell),
-
- aRefreshCont ( static_cast < XTextDocument* > ( this ) ),
-
+SwXTextDocument::SwXTextDocument(SwDocShell* pShell)
+ : SfxBaseModel(pShell)
+ , m_pImpl(new Impl)
+ ,
pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_DOCUMENT)),
pDocShell(pShell),
@@ -1404,7 +1415,8 @@ void SwXTextDocument::Invalidate()
}
InitNewDoc();
pDocShell = 0;
- aRefreshCont.Disposing();
+ lang::EventObject const ev(static_cast<SwXTextDocumentBaseClass &>(*this));
+ m_pImpl->m_RefreshListeners.disposeAndClear(ev);
}
void SwXTextDocument::Reactivate(SwDocShell* pNewDocShell)
@@ -2196,32 +2208,40 @@ Reference< XEnumerationAccess > SwXTextDocument::getRedlines( ) throw(RuntimeEx
return *pxXRedlines;
}
+void SwXTextDocument::NotifyRefreshListeners()
+{
+ // why does SwBaseShell not just call refresh? maybe because it's rSh is
+ // (sometimes) a different shell than GetWrtShell()?
+ lang::EventObject const ev(static_cast<SwXTextDocumentBaseClass &>(*this));
+ m_pImpl->m_RefreshListeners.notifyEach(
+ & util::XRefreshListener::refreshed, ev);
+}
+
void SwXTextDocument::refresh(void) throw( RuntimeException )
{
SolarMutexGuard aGuard;
if(!IsValid())
throw RuntimeException();
ViewShell *pViewShell = pDocShell->GetWrtShell();
- notifyRefreshListeners();
+ NotifyRefreshListeners();
if(pViewShell)
pViewShell->CalcLayout();
}
-void SwXTextDocument::addRefreshListener(const Reference< util::XRefreshListener > & l)
- throw( RuntimeException )
+void SAL_CALL SwXTextDocument::addRefreshListener(
+ const Reference<util::XRefreshListener> & xListener)
+throw (RuntimeException)
{
- SolarMutexGuard aGuard;
- if ( !IsValid() )
- throw RuntimeException();
- aRefreshCont.AddListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l ));
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_RefreshListeners.addInterface(xListener);
}
-void SwXTextDocument::removeRefreshListener(const Reference< util::XRefreshListener > & l)
- throw( RuntimeException )
+void SAL_CALL SwXTextDocument::removeRefreshListener(
+ const Reference<util::XRefreshListener> & xListener)
+throw (RuntimeException)
{
- SolarMutexGuard aGuard;
- if ( !IsValid() || !aRefreshCont.RemoveListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l ) ) )
- throw RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_RefreshListeners.removeInterface(xListener);
}
void SwXTextDocument::updateLinks( ) throw(RuntimeException)
commit c31f340083206081e546bd06358b4231fa40c133
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Feb 2 21:37:23 2013 +0100
sw: replace SwRefreshListenerContainer in SwXTextFieldTypes
... and add a pImpl while at it.
Change-Id: If91ccc330f20c691cb9f6c5b1624278d1d9d7af9
diff --git a/sw/inc/unofieldcoll.hxx b/sw/inc/unofieldcoll.hxx
index de024fe..fa089e2 100644
--- a/sw/inc/unofieldcoll.hxx
+++ b/sw/inc/unofieldcoll.hxx
@@ -20,10 +20,11 @@
#ifndef SW_UNOFIELDCOLL_HXX
#define SW_UNOFIELDCOLL_HXX
+#include <boost/scoped_ptr.hpp>
+
#include <com/sun/star/util/XRefreshable.hpp>
#include <unocoll.hxx>
-#include <RefreshListenerContainer.hxx>
class SwFieldType;
@@ -84,7 +85,8 @@ class SwXTextFieldTypes
, public SwUnoCollection
{
private:
- SwRefreshListenerContainer aRefreshCont;
+ class Impl;
+ ::boost::scoped_ptr<Impl> m_pImpl; // currently does not need UnoImplPtr
protected:
virtual ~SwXTextFieldTypes();
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 25993b3..21ddff3 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2609,6 +2609,21 @@ sal_Bool SwXTextFieldMasters::hasElements(void) throw( uno::RuntimeException )
return sal_True;
}
+/******************************************************************
+ * SwXFieldTypes
+ ******************************************************************/
+
+class SwXTextFieldTypes::Impl
+{
+private:
+ ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper
+
+public:
+ ::cppu::OInterfaceContainerHelper m_RefreshListeners;
+
+ Impl() : m_RefreshListeners(m_Mutex) { }
+};
+
OUString SwXTextFieldTypes::getImplementationName(void) throw( uno::RuntimeException )
{
return OUString("SwXTextFieldTypes");
@@ -2627,9 +2642,9 @@ uno::Sequence< OUString > SwXTextFieldTypes::getSupportedServiceNames(void) thro
return aRet;
}
-SwXTextFieldTypes::SwXTextFieldTypes(SwDoc* _pDoc) :
- SwUnoCollection (_pDoc),
- aRefreshCont ( static_cast< XEnumerationAccess * >(this) )
+SwXTextFieldTypes::SwXTextFieldTypes(SwDoc* _pDoc)
+ : SwUnoCollection (_pDoc)
+ , m_pImpl(new Impl)
{
}
@@ -2640,7 +2655,8 @@ SwXTextFieldTypes::~SwXTextFieldTypes()
void SwXTextFieldTypes::Invalidate()
{
SwUnoCollection::Invalidate();
- aRefreshCont.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_pImpl->m_RefreshListeners.disposeAndClear(ev);
}
uno::Reference< container::XEnumeration > SwXTextFieldTypes::createEnumeration(void)
@@ -2662,38 +2678,39 @@ sal_Bool SwXTextFieldTypes::hasElements(void) throw( uno::RuntimeException )
SolarMutexGuard aGuard;
if(!IsValid())
throw uno::RuntimeException();
- //es gibt sie immer
- return sal_True;
+ return sal_True; // they always exist
}
-void SwXTextFieldTypes::refresh(void) throw( uno::RuntimeException )
+void SAL_CALL SwXTextFieldTypes::refresh() throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
- if(!IsValid())
- throw uno::RuntimeException();
- UnoActionContext aContext(GetDoc());
- GetDoc()->UpdateDocStat();
- GetDoc()->UpdateFlds(0, sal_False);
-
- // call refresh listeners
- aRefreshCont.Refreshed();
+ {
+ SolarMutexGuard aGuard;
+ if (!IsValid())
+ throw uno::RuntimeException();
+ UnoActionContext aContext(GetDoc());
+ GetDoc()->UpdateDocStat();
+ GetDoc()->UpdateFlds(0, sal_False);
+ }
+ // call refresh listeners (without SolarMutex locked)
+ lang::EventObject const event(static_cast< ::cppu::OWeakObject*>(this));
+ m_pImpl->m_RefreshListeners.notifyEach(
+ & util::XRefreshListener::refreshed, event);
}
-void SwXTextFieldTypes::addRefreshListener(const uno::Reference< util::XRefreshListener > & l)
- throw( uno::RuntimeException )
+void SAL_CALL SwXTextFieldTypes::addRefreshListener(
+ const uno::Reference<util::XRefreshListener> & xListener)
+throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
- if ( !IsValid() )
- throw uno::RuntimeException();
- aRefreshCont.AddListener ( reinterpret_cast < const uno::Reference < lang::XEventListener > &> ( l ));
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_RefreshListeners.addInterface(xListener);
}
-void SwXTextFieldTypes::removeRefreshListener(const uno::Reference< util::XRefreshListener > & l)
- throw( uno::RuntimeException )
+void SAL_CALL SwXTextFieldTypes::removeRefreshListener(
+ const uno::Reference<util::XRefreshListener> & xListener)
+throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
- if ( !IsValid() || !aRefreshCont.RemoveListener ( reinterpret_cast < const uno::Reference < lang::XEventListener > &> ( l ) ) )
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_pImpl->m_RefreshListeners.removeInterface(xListener);
}
/******************************************************************
commit 503b636654ca15960c426fb77a657c243c7b8cc9
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Feb 2 21:15:45 2013 +0100
sw: remove class SwChartEventListenerContainer
Change-Id: Ieb1efc28c65e7f191d61beb7f8541564f4fd3e43
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index b9cc52c..88f4bf3 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -37,6 +37,7 @@
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/implbase7.hxx>
#include <cppuhelper/implbase10.hxx>
+#include <cppuhelper/interfacecontainer.h>
#include <comphelper/uno3.hxx>
#include <tools/string.hxx>
@@ -57,14 +58,6 @@ class SwChartDataProvider;
class SwFrmFmt;
-class SwChartEventListenerContainer : public SwEventListenerContainer
-{
- public:
- SwChartEventListenerContainer( ::com::sun::star::uno::XInterface* pxParentL) :
- SwEventListenerContainer(pxParentL){}
- void ChartDataChanged();
-};
-
typedef
cppu::WeakImplHelper4
<
@@ -296,8 +289,9 @@ class SwXTextTable : public cppu::WeakImplHelper10
>,
public SwClient
{
+ ::osl::Mutex m_Mutex;
+ ::cppu::OInterfaceContainerHelper m_ChartListeners;
SwEventListenerContainer aLstnrCntnr;
- SwChartEventListenerContainer aChartLstnrCntnr;
const SfxItemPropertySet* m_pPropSet;
// Descriptor-interface
@@ -416,7 +410,8 @@ class SwXCellRange : public cppu::WeakImplHelper7
public SwClient
{
SwDepend aCursorDepend; //the cursor is removed after the doc has been removed
- SwChartEventListenerContainer aChartLstnrCntnr;
+ ::osl::Mutex m_Mutex;
+ ::cppu::OInterfaceContainerHelper m_ChartListeners;
SwRangeDescriptor aRgDesc;
const SfxItemPropertySet* m_pPropSet;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 081e6e4..166c2e2 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -106,6 +106,22 @@ extern void sw_GetTblBoxColStr( sal_uInt16 nCol, String& rNm );
#define UNO_TABLE_COLUMN_SUM 10000
+static void
+lcl_SendChartEvent(::cppu::OWeakObject & rSource,
+ ::cppu::OInterfaceContainerHelper & rListeners)
+{
+ //TODO: find appropriate settings of the Event
+ chart::ChartDataChangeEvent event;
+ event.Source = & rSource;
+ event.Type = chart::ChartDataChangeType_ALL;
+ event.StartColumn = 0;
+ event.EndColumn = 1;
+ event.StartRow = 0;
+ event.EndRow = 1;
+ rListeners.notifyEach(
+ & chart::XChartDataChangeEventListener::chartDataChanged, event);
+}
+
static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine)
{
rSvxLine.SetColor(Color(rLine.Color));
@@ -2112,9 +2128,10 @@ sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >&
TYPEINIT1(SwXTextTable, SwClient)
-SwXTextTable::SwXTextTable() :
+SwXTextTable::SwXTextTable()
+ : m_ChartListeners(m_Mutex)
+ ,
aLstnrCntnr( (text::XTextTable*)this),
- aChartLstnrCntnr( (text::XTextTable*)this),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
pTableProps(new SwTableProperties_Impl),
bIsDescriptor(sal_True),
@@ -2125,10 +2142,11 @@ SwXTextTable::SwXTextTable() :
{
}
-SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt) :
- SwClient( &rFrmFmt ),
+SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt)
+ : SwClient( &rFrmFmt )
+ , m_ChartListeners(m_Mutex)
+ ,
aLstnrCntnr( (text::XTextTable*)this),
- aChartLstnrCntnr( (text::XTextTable*)this),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE)),
pTableProps(0),
bIsDescriptor(sal_False),
@@ -2719,7 +2737,9 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData
}
}
if ( bChanged )
- aChartLstnrCntnr.ChartDataChanged();
+ {
+ lcl_SendChartEvent(*this, m_ChartListeners);
+ }
}
}
@@ -2876,21 +2896,20 @@ void SwXTextTable::setColumnDescriptions(const uno::Sequence< OUString >& rColum
throw uno::RuntimeException();
}
-void SwXTextTable::addChartDataChangeEventListener(
- const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
- throw( uno::RuntimeException )
+void SAL_CALL SwXTextTable::addChartDataChangeEventListener(
+ const uno::Reference<chart::XChartDataChangeEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn())
- throw uno::RuntimeException();
- aChartLstnrCntnr.AddListener(aListener.get());
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_ChartListeners.addInterface(xListener);
}
-void SwXTextTable::removeChartDataChangeEventListener(
- const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
- throw( uno::RuntimeException )
+void SAL_CALL SwXTextTable::removeChartDataChangeEventListener(
+ const uno::Reference<chart::XChartDataChangeEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_ChartListeners.removeInterface(xListener);
}
sal_Bool SwXTextTable::isNotANumber(double nNumber) throw( uno::RuntimeException )
@@ -3014,7 +3033,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
if(bFirstRowAsLabel != bTmp)
{
- aChartLstnrCntnr.ChartDataChanged();
+ lcl_SendChartEvent(*this, m_ChartListeners);
bFirstRowAsLabel = bTmp;
}
}
@@ -3024,7 +3043,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
if(bFirstColumnAsLabel != bTmp)
{
- aChartLstnrCntnr.ChartDataChanged();
+ lcl_SendChartEvent(*this, m_ChartListeners);
bFirstColumnAsLabel = bTmp;
}
}
@@ -3599,10 +3618,13 @@ void SwXTextTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
if(!GetRegisteredIn())
{
aLstnrCntnr.Disposing();
- aChartLstnrCntnr.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_ChartListeners.disposeAndClear(ev);
}
else
- aChartLstnrCntnr.ChartDataChanged();
+ {
+ lcl_SendChartEvent(*this, m_ChartListeners);
+ }
}
OUString SAL_CALL SwXTextTable::getImplementationName(void) throw( uno::RuntimeException )
@@ -3676,10 +3698,10 @@ uno::Sequence< OUString > SwXCellRange::getSupportedServiceNames(void) throw( un
SwXCellRange::SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt,
SwRangeDescriptor& rDesc)
- :
- SwClient(&rFrmFmt),
- aCursorDepend(this, pCrsr),
- aChartLstnrCntnr((cppu::OWeakObject*)this),
+ : SwClient(&rFrmFmt)
+ , aCursorDepend(this, pCrsr)
+ , m_ChartListeners(m_Mutex)
+ ,
aRgDesc(rDesc),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_RANGE)),
pTblCrsr(pCrsr),
@@ -3880,7 +3902,7 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
if(bFirstRowAsLabel != bTmp)
{
- aChartLstnrCntnr.ChartDataChanged();
+ lcl_SendChartEvent(*this, m_ChartListeners);
bFirstRowAsLabel = bTmp;
}
}
@@ -3890,7 +3912,7 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
if(bFirstColumnAsLabel != bTmp)
{
- aChartLstnrCntnr.ChartDataChanged();
+ lcl_SendChartEvent(*this, m_ChartListeners);
bFirstColumnAsLabel = bTmp;
}
}
@@ -4517,17 +4539,20 @@ void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& Column
}
}
-void SwXCellRange::addChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXCellRange::addChartDataChangeEventListener(
+ const uno::Reference<chart::XChartDataChangeEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn())
- throw uno::RuntimeException();
- aChartLstnrCntnr.AddListener(aListener.get());
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_ChartListeners.addInterface(xListener);
}
-void SwXCellRange::removeChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
+void SAL_CALL SwXCellRange::removeChartDataChangeEventListener(
+ const uno::Reference<chart::XChartDataChangeEventListener> & xListener)
+throw (uno::RuntimeException)
{
- if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
- throw uno::RuntimeException();
+ // no need to lock here as m_pImpl is const and container threadsafe
+ m_ChartListeners.removeInterface(xListener);
}
sal_Bool SwXCellRange::isNotANumber(double /*fNumber*/) throw( uno::RuntimeException )
@@ -4597,10 +4622,13 @@ void SwXCellRange::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
delete pTblCrsr;
*/
pTblCrsr = 0;
- aChartLstnrCntnr.Disposing();
+ lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ m_ChartListeners.disposeAndClear(ev);
}
else
- aChartLstnrCntnr.ChartDataChanged();
+ {
+ lcl_SendChartEvent(*this, m_ChartListeners);
+ }
}
/******************************************************************
@@ -5028,33 +5056,4 @@ void SwXTableColumns::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
ClientModify(this, pOld, pNew);
}
-void SwChartEventListenerContainer::ChartDataChanged()
-{
- if(pListenerArr)
- {
- //TODO: find appropriate settings of the Event
- lang::EventObject aObj(pxParent);
- chart::ChartDataChangeEvent aEvent;
- aEvent.Type = chart::ChartDataChangeType_ALL;
- aEvent.StartColumn = 0;
- aEvent.EndColumn = 1;
- aEvent.StartRow = 0;
- aEvent.EndRow = 1;
-
- for(sal_uInt16 i = 0; i < pListenerArr->size(); i++)
- {
- try
- {
- XEventListenerPtr pElem = (*pListenerArr)[i];
- uno::Reference<lang::XEventListener> xEventListener = *pElem;
- uno::Reference<chart::XChartDataChangeEventListener> xChartEventListener = (chart::XChartDataChangeEventListener*)(*pElem).get();
- xChartEventListener->chartDataChanged( aEvent );
- }
- catch(uno::Exception const &)
- {
- }
- }
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 750a14f2b07d292797a2d7e9716c60356a77eae8
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Feb 2 19:33:08 2013 +0100
sw: move unosection.hxx to source/core/inc
Change-Id: I5890de1b8414898e80a16268fa63cc0f1fd2b97b
diff --git a/sw/inc/unosection.hxx b/sw/inc/unosection.hxx
deleted file mode 100644
index 26ea51c..0000000
--- a/sw/inc/unosection.hxx
+++ /dev/null
@@ -1,244 +0,0 @@
-/* -*- 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 SW_UNOSECTION_HXX
-#define SW_UNOSECTION_HXX
-
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertyState.hpp>
-#include <com/sun/star/beans/XMultiPropertySet.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/text/XTextContent.hpp>
-#include <com/sun/star/text/XTextSection.hpp>
-
-#include <cppuhelper/implbase7.hxx>
-
-#include <sfx2/Metadatable.hxx>
-
-#include <unobaseclass.hxx>
-
-
-class SwSectionFmt;
-
-
-
-struct SwTextSectionProperties_Impl;
-
-typedef ::cppu::ImplInheritanceHelper7
-< ::sfx2::MetadatableMixin
-, ::com::sun::star::lang::XUnoTunnel
-, ::com::sun::star::lang::XServiceInfo
-, ::com::sun::star::beans::XPropertySet
-, ::com::sun::star::beans::XPropertyState
-, ::com::sun::star::beans::XMultiPropertySet
-, ::com::sun::star::container::XNamed
-, ::com::sun::star::text::XTextSection
-> SwXTextSection_Base;
-
-class SwXTextSection
- : public SwXTextSection_Base
-{
-
-private:
-
- class Impl;
- ::sw::UnoImplPtr<Impl> m_pImpl;
-
- SwXTextSection(SwSectionFmt *const pFmt, const bool bIndexHeader = false);
-
- virtual ~SwXTextSection();
-
-public:
-
- SwSectionFmt* GetFmt() const;
-
- static ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextSection >
- CreateXTextSection(SwSectionFmt *const pFmt = 0,
- const bool bIndexHeader = false);
-
- // MetadatableMixin
- virtual ::sfx2::Metadatable* GetCoreObject();
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
- GetModel();
-
- static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-
- // XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething(
- const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
- throw (::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService(
- const ::rtl::OUString& rServiceName)
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames()
- throw (::com::sun::star::uno::RuntimeException);
-
- // XComponent
- virtual void SAL_CALL dispose()
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener > & xListener)
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XEventListener > & xListener)
- throw (::com::sun::star::uno::RuntimeException);
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo()
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValue(
- const ::rtl::OUString& rPropertyName,
- const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
- const ::rtl::OUString& rPropertyName)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener(
- const ::rtl::OUString& rPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& xListener)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener(
- const ::rtl::OUString& rPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& xListener)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addVetoableChangeListener(
- const ::rtl::OUString& rPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& xListener)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeVetoableChangeListener(
- const ::rtl::OUString& rPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& xListener)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- // XPropertyState
- virtual ::com::sun::star::beans::PropertyState SAL_CALL
- getPropertyState(const ::rtl::OUString& rPropertyName)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::PropertyState > SAL_CALL
- getPropertyStates(
- const ::com::sun::star::uno::Sequence<
- ::rtl::OUString >& rPropertyNames)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyToDefault(
- const ::rtl::OUString& rPropertyName)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(
- const ::rtl::OUString& rPropertyName)
- throw (::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- // XMultiPropertySet
- virtual void SAL_CALL setPropertyValues(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
- rPropertyNames,
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& rValues)
- throw (::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
- SAL_CALL getPropertyValues(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
- rPropertyNames)
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertiesChangeListener(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
- rPropertyNames,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertiesChangeListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL firePropertiesChangeEvent(
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >&
- rPropertyNames,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertiesChangeListener >& xListener)
- throw (::com::sun::star::uno::RuntimeException);
-
- // XNamed
- virtual ::rtl::OUString SAL_CALL getName()
- throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setName(const ::rtl::OUString& rName)
- throw (::com::sun::star::uno::RuntimeException);
-
- // XTextContent
- virtual void SAL_CALL attach(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange > & xTextRange)
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
- throw (::com::sun::star::uno::RuntimeException);
-
- // XTextSection
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextSection > SAL_CALL
- getParentSection()
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::text::XTextSection > > SAL_CALL
- getChildSections()
- throw (::com::sun::star::uno::RuntimeException);
-
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list