summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-20 13:08:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-23 07:56:34 +0200
commit45e591e237ef294ffd1a0f4a51122a748fd1460a (patch)
tree67223d0431f448fe37ee989d77b67f8b10fc7e95 /fpicker
parentf6c0e851eff8c22c0ab427245c5eb78e9f396b62 (diff)
use rtl:Reference in SmartContent
instead of storing both a raw pointer and an uno::Reference Change-Id: Ia7a177ed9adcd9d413c86490b57036b0bd80f76d
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/fpsmartcontent.cxx20
-rw-r--r--fpicker/source/office/fpsmartcontent.hxx4
2 files changed, 6 insertions, 18 deletions
diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx
index 7e068be975ac..c8777e7e239c 100644
--- a/fpicker/source/office/fpsmartcontent.cxx
+++ b/fpicker/source/office/fpsmartcontent.cxx
@@ -49,7 +49,6 @@ namespace svt
SmartContent::SmartContent()
:m_pContent( nullptr )
,m_eState( NOT_BOUND )
- ,m_pOwnInteraction( nullptr )
{
}
@@ -57,7 +56,6 @@ namespace svt
SmartContent::SmartContent( const OUString& _rInitialURL )
:m_pContent( nullptr )
,m_eState( NOT_BOUND )
- ,m_pOwnInteraction( nullptr )
{
bindTo( _rInitialURL );
}
@@ -85,19 +83,15 @@ namespace svt
Reference< XInteractionHandler > xGlobalInteractionHandler(
InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY_THROW );
- m_pOwnInteraction = new ::svt::OFilePickerInteractionHandler(xGlobalInteractionHandler);
- m_pOwnInteraction->enableInterceptions(eInterceptions);
- m_xOwnInteraction = m_pOwnInteraction;
+ m_xOwnInteraction = new ::svt::OFilePickerInteractionHandler(xGlobalInteractionHandler);
+ m_xOwnInteraction->enableInterceptions(eInterceptions);
- m_xCmdEnv = new ::ucbhelper::CommandEnvironment( m_xOwnInteraction, Reference< XProgressHandler >() );
+ m_xCmdEnv = new ::ucbhelper::CommandEnvironment( m_xOwnInteraction.get(), Reference< XProgressHandler >() );
}
void SmartContent::enableDefaultInteractionHandler()
{
- // Don't free the memory here! It will be done by the next
- // call automatically - releasing of the uno reference ...
- m_pOwnInteraction = nullptr;
m_xOwnInteraction.clear();
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
@@ -109,9 +103,7 @@ namespace svt
::svt::OFilePickerInteractionHandler* SmartContent::getOwnInteractionHandler() const
{
- if (!m_xOwnInteraction.is())
- return nullptr;
- return m_pOwnInteraction;
+ return m_xOwnInteraction.get();
}
@@ -129,11 +121,7 @@ namespace svt
void SmartContent::disableInteractionHandler()
{
- // Don't free the memory here! It will be done by the next
- // call automatically - releasing of the uno reference ...
- m_pOwnInteraction = nullptr;
m_xOwnInteraction.clear();
-
m_xCmdEnv.clear();
}
diff --git a/fpicker/source/office/fpsmartcontent.hxx b/fpicker/source/office/fpsmartcontent.hxx
index 9606e1166f3c..bdd2e43e48d0 100644
--- a/fpicker/source/office/fpsmartcontent.hxx
+++ b/fpicker/source/office/fpsmartcontent.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
#include <ucbhelper/content.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -53,8 +54,7 @@ namespace svt
std::unique_ptr<::ucbhelper::Content> m_pContent;
State m_eState;
css::uno::Reference < css::ucb::XCommandEnvironment > m_xCmdEnv;
- css::uno::Reference < css::task::XInteractionHandler > m_xOwnInteraction;
- ::svt::OFilePickerInteractionHandler* m_pOwnInteraction;
+ rtl::Reference<::svt::OFilePickerInteractionHandler> m_xOwnInteraction;
private:
enum Type { Folder, Document };