[Libreoffice-commits] core.git: 2 commits - avmedia/source include/avmedia svx/source
Stephan Bergmann
sbergman at redhat.com
Mon Nov 18 09:05:14 PST 2013
avmedia/source/framework/mediacontrol.cxx | 2
avmedia/source/framework/mediaitem.cxx | 9 --
avmedia/source/viewer/mediawindow_impl.cxx | 119 +++++++++--------------------
avmedia/source/viewer/mediawindow_impl.hxx | 7 -
include/avmedia/mediaitem.hxx | 2
svx/source/svdraw/svdomedia.cxx | 10 +-
svx/source/unodraw/unoshap4.cxx | 2
7 files changed, 50 insertions(+), 101 deletions(-)
New commits:
commit 4e593d690d4363b1065bc7638953b1156563a157
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 18 18:04:37 2013 +0100
Elide some trivial avmedia::MediaWindowImpl private member functions
Change-Id: I272acbfc9ea158af1d6d6d117451a444c1585e19
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index ede40a3..4157f7a 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -176,21 +176,19 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo
MediaWindowImpl::~MediaWindowImpl()
{
- uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
-
mpEvents->cleanUp();
- if( xPlayerWindow.is() )
+ if( mxPlayerWindow.is() )
{
- xPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
- xPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
- xPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
+ mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEventsIf, uno::UNO_QUERY ) );
+ mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEventsIf, uno::UNO_QUERY ) );
+ mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEventsIf, uno::UNO_QUERY ) );
- uno::Reference< lang::XComponent > xComponent( xPlayerWindow, uno::UNO_QUERY );
+ uno::Reference< lang::XComponent > xComponent( mxPlayerWindow, uno::UNO_QUERY );
if( xComponent.is() )
xComponent->dispose();
- setPlayerWindow( NULL );
+ mxPlayerWindow.clear();
}
uno::Reference< lang::XComponent > xComponent( mxPlayer, uno::UNO_QUERY );
@@ -292,7 +290,7 @@ const OUString& MediaWindowImpl::getURL() const
bool MediaWindowImpl::isValid() const
{
- return( getPlayer().is() );
+ return( mxPlayer.is() );
}
Size MediaWindowImpl::getPreferredSize() const
@@ -473,29 +471,9 @@ void MediaWindowImpl::stopPlayingInternal( bool bStop )
}
}
-MediaWindow* MediaWindowImpl::getMediaWindow() const
-{
- return mpMediaWindow;
-}
-
-uno::Reference< media::XPlayer > MediaWindowImpl::getPlayer() const
-{
- return mxPlayer;
-}
-
-void MediaWindowImpl::setPlayerWindow( const uno::Reference< media::XPlayerWindow >& rxPlayerWindow )
-{
- mxPlayerWindow = rxPlayerWindow;
-}
-
-uno::Reference< media::XPlayerWindow > MediaWindowImpl::getPlayerWindow() const
-{
- return mxPlayerWindow;
-}
-
void MediaWindowImpl::onURLChanged()
{
- if( getPlayer().is() )
+ if( mxPlayer.is() )
{
uno::Sequence< uno::Any > aArgs( 3 );
uno::Reference< media::XPlayerWindow > xPlayerWindow;
@@ -509,14 +487,14 @@ void MediaWindowImpl::onURLChanged()
try
{
- xPlayerWindow = getPlayer()->createPlayerWindow( aArgs );
+ xPlayerWindow = mxPlayer->createPlayerWindow( aArgs );
}
catch( uno::RuntimeException )
{
// happens eg, on MacOSX where Java frames cannot be created from X11 window handles
}
- setPlayerWindow( xPlayerWindow );
+ mxPlayerWindow = xPlayerWindow;
if( xPlayerWindow.is() )
{
@@ -527,9 +505,9 @@ void MediaWindowImpl::onURLChanged()
}
}
else
- setPlayerWindow( NULL );
+ mxPlayerWindow.clear();
- if( getPlayerWindow().is() )
+ if( mxPlayerWindow.is() )
maChildWindow.Show();
else
maChildWindow.Hide();
@@ -554,12 +532,10 @@ void MediaWindowImpl::setPosSize( const Rectangle& rRect )
void MediaWindowImpl::setPointer( const Pointer& rPointer )
{
- uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
-
SetPointer( rPointer );
maChildWindow.SetPointer( rPointer );
- if( xPlayerWindow.is() )
+ if( mxPlayerWindow.is() )
{
long nPointer;
@@ -573,7 +549,7 @@ void MediaWindowImpl::setPointer( const Pointer& rPointer )
default: nPointer = awt::SystemPointer::ARROW; break;
}
- xPlayerWindow->setPointerType( nPointer );
+ mxPlayerWindow->setPointerType( nPointer );
}
}
@@ -581,7 +557,6 @@ void MediaWindowImpl::setPointer( const Pointer& rPointer )
void MediaWindowImpl::Resize()
{
- uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
const Size aCurSize( GetOutputSizePixel() );
const sal_Int32 nOffset( mpMediaWindowControl ? AVMEDIA_CONTROLOFFSET : 0 );
Size aPlayerWindowSize( aCurSize.Width() - ( nOffset << 1 ),
@@ -596,8 +571,8 @@ void MediaWindowImpl::Resize()
mpMediaWindowControl->SetPosSizePixel( Point( nOffset, nControlY ), Size( aCurSize.Width() - ( nOffset << 1 ), nControlHeight ) );
}
- if( xPlayerWindow.is() )
- xPlayerWindow->setPosSize( 0, 0, aPlayerWindowSize.Width(), aPlayerWindowSize.Height(), 0 );
+ if( mxPlayerWindow.is() )
+ mxPlayerWindow->setPosSize( 0, 0, aPlayerWindowSize.Width(), aPlayerWindowSize.Height(), 0 );
maChildWindow.SetPosSizePixel( Point( 0, 0 ), aPlayerWindowSize );
}
@@ -606,9 +581,7 @@ void MediaWindowImpl::Resize()
void MediaWindowImpl::StateChanged( StateChangedType eType )
{
- uno::Reference< media::XPlayerWindow > xPlayerWindow( getPlayerWindow() );
-
- if( xPlayerWindow.is() )
+ if( mxPlayerWindow.is() )
{
// stop playing when going disabled or hidden
switch( eType )
@@ -616,14 +589,14 @@ void MediaWindowImpl::StateChanged( StateChangedType eType )
case STATE_CHANGE_VISIBLE:
{
stopPlayingInternal( !IsVisible() );
- xPlayerWindow->setVisible( IsVisible() );
+ mxPlayerWindow->setVisible( IsVisible() );
}
break;
case STATE_CHANGE_ENABLE:
{
stopPlayingInternal( !IsEnabled() );
- xPlayerWindow->setEnable( IsEnabled() );
+ mxPlayerWindow->setEnable( IsEnabled() );
}
break;
@@ -639,14 +612,14 @@ void MediaWindowImpl::Paint( const Rectangle& )
{
BitmapEx* pLogo = NULL;
- if( !getPlayer().is() )
+ if( !mxPlayer.is() )
{
if( !mpEmptyBmpEx )
mpEmptyBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_EMPTYLOGO ) );
pLogo = mpEmptyBmpEx;
}
- else if( !getPlayerWindow().is() )
+ else if( !mxPlayerWindow.is() )
{
if( !mpAudioBmpEx )
mpAudioBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) );
@@ -699,86 +672,70 @@ void MediaWindowImpl::GetFocus()
void MediaWindowImpl::MouseMove( const MouseEvent& rMEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
-
- if( pMediaWindow )
- pMediaWindow->MouseMove( rMEvt );
+ if( mpMediaWindow )
+ mpMediaWindow->MouseMove( rMEvt );
}
// ---------------------------------------------------------------------
void MediaWindowImpl::MouseButtonDown( const MouseEvent& rMEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
-
- if( pMediaWindow )
- pMediaWindow->MouseButtonDown( rMEvt );
+ if( mpMediaWindow )
+ mpMediaWindow->MouseButtonDown( rMEvt );
}
// ---------------------------------------------------------------------
void MediaWindowImpl::MouseButtonUp( const MouseEvent& rMEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
-
- if( pMediaWindow )
- pMediaWindow->MouseButtonUp( rMEvt );
+ if( mpMediaWindow )
+ mpMediaWindow->MouseButtonUp( rMEvt );
}
// ---------------------------------------------------------------------
void MediaWindowImpl::KeyInput( const KeyEvent& rKEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
-
- if( pMediaWindow )
- pMediaWindow->KeyInput( rKEvt );
+ if( mpMediaWindow )
+ mpMediaWindow->KeyInput( rKEvt );
}
// ---------------------------------------------------------------------
void MediaWindowImpl::KeyUp( const KeyEvent& rKEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
-
- if( pMediaWindow )
- pMediaWindow->KeyUp( rKEvt );
+ if( mpMediaWindow )
+ mpMediaWindow->KeyUp( rKEvt );
}
// ---------------------------------------------------------------------
void MediaWindowImpl::Command( const CommandEvent& rCEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
-
- if( pMediaWindow )
- pMediaWindow->Command( rCEvt );
+ if( mpMediaWindow )
+ mpMediaWindow->Command( rCEvt );
}
// ---------------------------------------------------------------------
sal_Int8 MediaWindowImpl::AcceptDrop( const AcceptDropEvent& rEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
- return( pMediaWindow ? pMediaWindow->AcceptDrop( rEvt ) : 0 );
+ return( mpMediaWindow ? mpMediaWindow->AcceptDrop( rEvt ) : 0 );
}
// ---------------------------------------------------------------------
sal_Int8 MediaWindowImpl::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
- MediaWindow* pMediaWindow = getMediaWindow();
- return( pMediaWindow ? pMediaWindow->ExecuteDrop( rEvt ) : 0 );
+ return( mpMediaWindow ? mpMediaWindow->ExecuteDrop( rEvt ) : 0 );
}
// ---------------------------------------------------------------------
void MediaWindowImpl::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
{
- MediaWindow* pMediaWindow = getMediaWindow();
-
- if( pMediaWindow )
- pMediaWindow->StartDrag( nAction, rPosPixel );
+ if( mpMediaWindow )
+ mpMediaWindow->StartDrag( nAction, rPosPixel );
}
} // namespace priv
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index f26cd87..340ab12 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -156,13 +156,6 @@ namespace avmedia
void stopPlayingInternal( bool );
- MediaWindow* getMediaWindow() const;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > getPlayer() const;
-
- void setPlayerWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow >& rxPlayerWindow );
- ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > getPlayerWindow() const;
-
void onURLChanged();
OUString maFileURL;
commit a063da487e6956eff19efd2619633caf333c39eb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Nov 18 17:57:39 2013 +0100
Simplify avmedia::MediaItem::setURL
Change-Id: I9835b96813c6bf3d8690cdaa5de66ca07afdc801
diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx
index 5d6497c..fc67309 100644
--- a/avmedia/source/framework/mediacontrol.cxx
+++ b/avmedia/source/framework/mediacontrol.cxx
@@ -498,7 +498,7 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p )
::avmedia::MediaWindow::executeFormatErrorBox( this );
else
{
- aExecItem.setURL( aURL, 0 );
+ aExecItem.setURL( aURL, "" );
aExecItem.setState( MEDIASTATE_PLAY );
}
}
diff --git a/avmedia/source/framework/mediaitem.cxx b/avmedia/source/framework/mediaitem.cxx
index 4ef8b4e..98359b1 100644
--- a/avmedia/source/framework/mediaitem.cxx
+++ b/avmedia/source/framework/mediaitem.cxx
@@ -202,7 +202,7 @@ void MediaItem::merge( const MediaItem& rMediaItem )
const sal_uInt32 nMaskSet = rMediaItem.getMaskSet();
if( AVMEDIA_SETMASK_URL & nMaskSet )
- setURL( rMediaItem.getURL(), &rMediaItem.getTempURL() );
+ setURL( rMediaItem.getURL(), rMediaItem.getTempURL() );
if( AVMEDIA_SETMASK_STATE & nMaskSet )
setState( rMediaItem.getState() );
@@ -235,12 +235,11 @@ sal_uInt32 MediaItem::getMaskSet() const
//------------------------------------------------------------------------
-void MediaItem::setURL( const OUString& rURL,
- OUString const*const pTempURL)
+void MediaItem::setURL( const OUString& rURL, const OUString& rTempURL )
{
- m_pImpl->m_URL = rURL;
m_pImpl->m_nMaskSet |= AVMEDIA_SETMASK_URL;
- m_pImpl->m_TempFileURL = (pTempURL) ? *pTempURL : OUString();
+ m_pImpl->m_URL = rURL;
+ m_pImpl->m_TempFileURL = rTempURL;
}
//------------------------------------------------------------------------
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 711eb48..ede40a3 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -328,7 +328,7 @@ void MediaWindowImpl::updateMediaItem( MediaItem& rItem ) const
rItem.setMute( isMute() );
rItem.setVolumeDB( getVolumeDB() );
rItem.setZoom( getZoom() );
- rItem.setURL( getURL(), &mTempFileURL );
+ rItem.setURL( getURL(), mTempFileURL );
}
void MediaWindowImpl::executeMediaItem( const MediaItem& rItem )
diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx
index 2baf0ba..0e39e31 100644
--- a/include/avmedia/mediaitem.hxx
+++ b/include/avmedia/mediaitem.hxx
@@ -106,7 +106,7 @@ public:
::com::sun::star::media::ZoomLevel getZoom() const;
void setURL( const OUString& rURL,
- OUString const*const pTempURL);
+ const OUString& rTempURL);
const OUString& getURL() const;
const OUString& getTempURL() const;
diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx
index 94b4aa9..f9d838b 100644
--- a/svx/source/svdraw/svdomedia.cxx
+++ b/svx/source/svdraw/svdomedia.cxx
@@ -246,7 +246,7 @@ void SdrMediaObj::setURL( const OUString& rURL)
{
::avmedia::MediaItem aURLItem;
- aURLItem.setURL( rURL, 0 );
+ aURLItem.setURL( rURL, "" );
setMediaProperties( aURLItem );
}
@@ -378,24 +378,24 @@ void SdrMediaObj::mediaPropertiesChanged( const ::avmedia::MediaItem& rNewProper
if (bSuccess)
{
m_pImpl->m_pTempFile.reset(new MediaTempFile(tempFileURL));
- m_pImpl->m_MediaProperties.setURL(url, & tempFileURL);
+ m_pImpl->m_MediaProperties.setURL(url, tempFileURL);
}
else // this case is for Clone via operator=
{
m_pImpl->m_pTempFile.reset();
- m_pImpl->m_MediaProperties.setURL(OUString(), 0);
+ m_pImpl->m_MediaProperties.setURL("", "");
}
}
else
{
m_pImpl->m_MediaProperties.setURL(url,
- &rNewProperties.getTempURL());
+ rNewProperties.getTempURL());
}
}
else
{
m_pImpl->m_pTempFile.reset();
- m_pImpl->m_MediaProperties.setURL(url, 0);
+ m_pImpl->m_MediaProperties.setURL(url, "");
}
bBroadcastChanged = true;
}
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 46981b5..53b0204 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -818,7 +818,7 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr
if( rValue >>= aURL )
{
bOk = true;
- aItem.setURL( aURL, 0 );
+ aItem.setURL( aURL, "" );
}
}
break;
More information about the Libreoffice-commits
mailing list