summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-11-18 17:01:35 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-11-18 17:02:17 +0100
commit929baba5f08a59aeaf460d7c6b76238aca6c5d67 (patch)
treeaeeebd2ae8f30b6687c388a449d16bf1133172e1
parent110bbaf0443acb9a4bfbbb7c8019442a99618347 (diff)
Simplify MediaWindow::mpImpl
Change-Id: Ia466a08a8135a7f2e43278354c767be3a063550a
-rw-r--r--avmedia/source/viewer/mediawindow.cxx36
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx13
-rw-r--r--avmedia/source/viewer/mediawindow_impl.hxx2
-rw-r--r--include/avmedia/mediawindow.hxx3
4 files changed, 17 insertions, 37 deletions
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index 183a9554e129..45c9901035c7 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -52,19 +52,13 @@ MediaWindow::MediaWindow( Window* parent, bool bInternalMediaControl ) :
// -------------------------------------------------------------------------
-MediaWindow::~MediaWindow()
-{
- mpImpl->cleanUp();
- delete mpImpl;
- mpImpl = NULL;
-}
+MediaWindow::~MediaWindow() {}
// -------------------------------------------------------------------------
void MediaWindow::setURL( const OUString& rURL )
{
- if( mpImpl )
- mpImpl->setURL( rURL, OUString() );
+ mpImpl->setURL( rURL, OUString() );
}
// -------------------------------------------------------------------------
@@ -78,7 +72,7 @@ const OUString& MediaWindow::getURL() const
bool MediaWindow::isValid() const
{
- return( mpImpl != NULL && mpImpl->isValid() );
+ return mpImpl->isValid();
}
// -------------------------------------------------------------------------
@@ -148,64 +142,56 @@ Size MediaWindow::getPreferredSize() const
void MediaWindow::setPosSize( const Rectangle& rNewRect )
{
- if( mpImpl )
- {
- mpImpl->setPosSize( rNewRect );
- }
+ mpImpl->setPosSize( rNewRect );
}
// -------------------------------------------------------------------------
void MediaWindow::setPointer( const Pointer& rPointer )
{
- if( mpImpl )
- mpImpl->setPointer( rPointer );
+ mpImpl->setPointer( rPointer );
}
// -------------------------------------------------------------------------
bool MediaWindow::start()
{
- return( mpImpl != NULL && mpImpl->start() );
+ return mpImpl->start();
}
// -------------------------------------------------------------------------
void MediaWindow::updateMediaItem( MediaItem& rItem ) const
{
- if( mpImpl )
- mpImpl->updateMediaItem( rItem );
+ mpImpl->updateMediaItem( rItem );
}
// -------------------------------------------------------------------------
void MediaWindow::executeMediaItem( const MediaItem& rItem )
{
- if( mpImpl )
- mpImpl->executeMediaItem( rItem );
+ mpImpl->executeMediaItem( rItem );
}
// -------------------------------------------------------------------------
void MediaWindow::show()
{
- if( mpImpl )
- mpImpl->Show();
+ mpImpl->Show();
}
// -------------------------------------------------------------------------
void MediaWindow::hide()
{
- if( mpImpl )
- mpImpl->Hide();
+ mpImpl->Hide();
}
// -------------------------------------------------------------------------
Window* MediaWindow::getWindow() const
{
- return mpImpl;
+ return mpImpl.get();
}
// -------------------------------------------------------------------------
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index aa402b3dee86..cb513dca3431 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -176,15 +176,6 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo
MediaWindowImpl::~MediaWindowImpl()
{
- delete mpEmptyBmpEx;
- delete mpAudioBmpEx;
- delete mpMediaWindowControl;
-}
-
-// ---------------------------------------------------------------------
-
-void MediaWindowImpl::cleanUp()
-{
uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
mpEvents->cleanUp();
@@ -209,6 +200,10 @@ void MediaWindowImpl::cleanUp()
mxPlayer.clear();
mpMediaWindow = NULL;
+
+ delete mpEmptyBmpEx;
+ delete mpAudioBmpEx;
+ delete mpMediaWindowControl;
}
uno::Reference< media::XPlayer > MediaWindowImpl::createPlayer( const OUString& rURL )
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index 9c9d8142fcdf..f26cd8744183 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -91,8 +91,6 @@ namespace avmedia
MediaWindowImpl( Window* parent, MediaWindow* pMediaWindow, bool bInternalMediaControl );
virtual ~MediaWindowImpl();
- void cleanUp();
-
static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL );
void setURL( const OUString& rURL, OUString const& rTempURL );
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
index 92bd696b1833..74ef95da9f75 100644
--- a/include/avmedia/mediawindow.hxx
+++ b/include/avmedia/mediawindow.hxx
@@ -22,6 +22,7 @@
#include <memory>
#include <vector>
+#include <boost/scoped_ptr.hpp>
#include <tools/gen.hxx>
#include <com/sun/star/media/ZoomLevel.hpp>
#include <com/sun/star/media/XPlayer.hpp>
@@ -118,7 +119,7 @@ namespace avmedia
AVMEDIA_DLLPRIVATE MediaWindow& operator =( const MediaWindow& );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxIFace;
- priv::MediaWindowImpl* mpImpl;
+ boost::scoped_ptr<priv::MediaWindowImpl> mpImpl;
};
}