summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-05-08 15:35:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-05-09 09:28:53 +0200
commit53082fcd1b1cccf7ef0c3cb1bef8e747c4e88a61 (patch)
tree1609f55c0b3be2eb1de288be68c1489fe32f860b /sfx2
parent10b03e6ea8d93c5f47c68177fd73269a628e630d (diff)
gnome-documents: rework SfxPickList as pimpl
and call impl dtor with SolarMutex held Change-Id: I06931ca9ab4384a5e3c255847cf3533ed03b77dc Reviewed-on: https://gerrit.libreoffice.org/37395 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/sfxpicklist.cxx40
-rw-r--r--sfx2/source/inc/sfxpicklist.hxx27
2 files changed, 41 insertions, 26 deletions
diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx
index 9e9bf33adc4f..90ee46f4e480 100644
--- a/sfx2/source/appl/sfxpicklist.cxx
+++ b/sfx2/source/appl/sfxpicklist.cxx
@@ -81,7 +81,25 @@ namespace
: public rtl::Static<osl::Mutex, thePickListMutex> {};
}
-void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh )
+class SfxPickListImpl : public SfxListener
+{
+private:
+ sal_uInt32 m_nAllowedMenuSize;
+ css::uno::Reference< css::util::XStringWidth > m_xStringLength;
+
+ /**
+ * Adds the given document to the pick list (recent documents) if it satisfies
+ certain requirements, e.g. being writable. Check implementation for requirement
+ details.
+ */
+ static void AddDocumentToPickList( SfxObjectShell* pDocShell );
+
+public:
+ SfxPickListImpl(sal_uInt32 nMenuSize);
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+};
+
+void SfxPickListImpl::AddDocumentToPickList( SfxObjectShell* pDocSh )
{
if (pDocSh->IsAvoidRecentDocs() || comphelper::LibreOfficeKit::isActive())
return;
@@ -165,12 +183,23 @@ void SfxPickList::AddDocumentToPickList( SfxObjectShell* pDocSh )
(pFilter) ? pFilter->GetServiceName() : OUString() );
}
+SfxPickList::SfxPickList(sal_uInt32 nAllowedMenuSize)
+ : mxImpl(new SfxPickListImpl(nAllowedMenuSize))
+{
+}
+
+SfxPickList::~SfxPickList()
+{
+ std::unique_ptr<SolarMutexGuard> xGuard(comphelper::SolarMutex::get() ? new SolarMutexGuard : nullptr);
+ mxImpl.reset();
+}
+
void SfxPickList::ensure()
{
static SfxPickList aUniqueInstance(SvtHistoryOptions().GetSize(ePICKLIST));
}
-SfxPickList::SfxPickList( sal_uInt32 nAllowedMenuSize ) :
+SfxPickListImpl::SfxPickListImpl( sal_uInt32 nAllowedMenuSize ) :
m_nAllowedMenuSize( nAllowedMenuSize )
{
m_xStringLength = new StringLength;
@@ -178,12 +207,7 @@ SfxPickList::SfxPickList( sal_uInt32 nAllowedMenuSize ) :
StartListening( *SfxGetpApp() );
}
-SfxPickList::~SfxPickList()
-{
-}
-
-
-void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint )
+void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
const SfxOpenUrlHint* pOpenUrlHint = dynamic_cast<const SfxOpenUrlHint*>(&rHint);
if ( pOpenUrlHint )
diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx
index b1e86b084f75..cf257d9b4ccf 100644
--- a/sfx2/source/inc/sfxpicklist.hxx
+++ b/sfx2/source/inc/sfxpicklist.hxx
@@ -29,25 +29,16 @@
#define PICKLIST_MAXSIZE 100
-class SfxPickList : public SfxListener
-{
- sal_uInt32 m_nAllowedMenuSize;
- css::uno::Reference< css::util::XStringWidth > m_xStringLength;
-
- SfxPickList( sal_uInt32 nMenuSize );
- virtual ~SfxPickList() override;
-
- /**
- * Adds the given document to the pick list (recent documents) if it satisfies
- certain requirements, e.g. being writable. Check implementation for requirement
- details.
- */
- static void AddDocumentToPickList( SfxObjectShell* pDocShell );
+class SfxPickListImpl;
- public:
- static void ensure();
-
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
+class SfxPickList
+{
+private:
+ std::unique_ptr<SfxPickListImpl> mxImpl;
+public:
+ SfxPickList(sal_uInt32 nAllowedMenuSize);
+ static void ensure();
+ ~SfxPickList();
};
#endif // INCLUDED_SFX2_SOURCE_INC_SFXPICKLIST_HXX