[Libreoffice-commits] core.git: 2 commits - avmedia/source canvas/source slideshow/source
Zolnai Tamás
tamas.zolnai at collabora.com
Thu May 8 09:40:13 PDT 2014
avmedia/source/viewer/mediawindow_impl.cxx | 3
avmedia/source/win/window.cxx | 11 ---
canvas/source/directx/dx_canvas.cxx | 20 ++++-
canvas/source/directx/dx_devicehelper.cxx | 14 ++--
canvas/source/directx/dx_devicehelper.hxx | 5 -
canvas/source/directx/dx_spritedevicehelper.cxx | 3
slideshow/source/engine/shapes/viewmediashape.cxx | 76 ----------------------
slideshow/source/engine/shapes/viewmediashape.hxx | 5 -
8 files changed, 29 insertions(+), 108 deletions(-)
New commits:
commit 22e9b1188c37340941dca2cdbdca4a1d9dd474ca
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 8 18:33:56 2014 +0200
avmedia: fix media embedding problem in edit mode
Some of the media player interfaces don't use the given
SystemChildWindow, but they work with the parent window handle.
e.g. directx (avmedia/source/win) and
quicktime (avmedia/source/quicktime)
Without the parent window handle they create a
separate child window outside impress window.
It affects only editing and not the slideshow.
Change-Id: I80252ce35fcd29ab2cce081299529b85129017ee
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 58c2d49..ab9d351 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -517,9 +517,8 @@ void MediaWindowImpl::onURLChanged()
uno::Reference< media::XPlayerWindow > xPlayerWindow;
const Point aPoint;
const Size aSize( mpChildWindow->GetSizePixel() );
- const sal_Int32 nWndHandle = 0;
- aArgs[ 0 ] = uno::makeAny( nWndHandle );
+ aArgs[ 0 ] = uno::makeAny( mpChildWindow->GetParentWindowHandle() );
aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) );
aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( mpChildWindow.get() ) );
commit 05c141bc3ab264c8e1f4fba57c4a82fa93e91261
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 8 16:39:25 2014 +0200
DX canvas: provide a OutputDevice pointer as a device handler instead of HDC
With it all canvas can be handled on the same way.
avmedia/source/win/window.cxx: always comes a HWND
Change-Id: Id6b8e6d52b8a136143f724daf8feff5c85cf5804
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx
index 3d5a7cc..029ad40 100644
--- a/avmedia/source/win/window.cxx
+++ b/avmedia/source/win/window.cxx
@@ -303,17 +303,6 @@ bool Window::create( const uno::Sequence< uno::Any >& rArguments )
aRect.X, aRect.Y, aRect.Width, aRect.Height,
(HWND) mnParentWnd, NULL, mpWndClass->hInstance, 0 );
- // if the last CreateWindow failed...
- if( mnFrameWnd == 0 )
- {
- // try again and this time assume that mnParent is indeed a dc
- mnParentWnd = reinterpret_cast<int>(::WindowFromDC( (HDC)mnParentWnd ));
- mnFrameWnd = (int) ::CreateWindow( mpWndClass->lpszClassName, NULL,
- WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
- aRect.X, aRect.Y, aRect.Width, aRect.Height,
- (HWND)mnParentWnd , NULL, mpWndClass->hInstance, 0 );
- }
-
if( mnFrameWnd )
{
::SetWindowLong( (HWND) mnFrameWnd, 0, (DWORD) this );
diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx
index 6ad7ee1..2c471ee 100644
--- a/canvas/source/directx/dx_canvas.cxx
+++ b/canvas/source/directx/dx_canvas.cxx
@@ -89,7 +89,7 @@ namespace dxcanvas
// At index 2, we expect the current window bound rect
ENSURE_ARG_OR_THROW( maArguments.getLength() >= 6 &&
maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE,
- "SpriteCanvas::initialize: wrong number of arguments, or wrong types" );
+ "Canvas::initialize: wrong number of arguments, or wrong types" );
uno::Sequence<sal_Int8> aSeq;
maArguments[5] >>= aSeq;
@@ -98,9 +98,13 @@ namespace dxcanvas
if( !pSysData || !pSysData->hDC )
throw lang::NoSupportException("Passed SystemGraphicsData or HDC invalid!", NULL);
+ sal_Int64 nPtr = 0;
+ maArguments[0] >>= nPtr;
+ OutputDevice* pOutDev = reinterpret_cast<OutputDevice*>(nPtr);
+ ENSURE_ARG_OR_THROW( pOutDev != NULL,"Canvas::initialize: invalid OutDev pointer" );
+
// setup helper
- maDeviceHelper.init( pSysData->hDC,
- *this );
+ maDeviceHelper.init( pSysData->hDC, pOutDev, *this );
maCanvasHelper.setDevice( *this );
maCanvasHelper.setTarget(
GraphicsProviderSharedPtr(
@@ -146,7 +150,7 @@ namespace dxcanvas
// At index 2, we expect the current window bound rect
ENSURE_ARG_OR_THROW( maArguments.getLength() >= 6 &&
maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE,
- "SpriteCanvas::initialize: wrong number of arguments, or wrong types" );
+ "Canvas::initialize: wrong number of arguments, or wrong types" );
uno::Sequence<sal_Int8> aSeq;
maArguments[5] >>= aSeq;
@@ -155,9 +159,13 @@ namespace dxcanvas
if( !pSysData || !pSysData->hDC )
throw lang::NoSupportException( "Passed SystemGraphicsData or HDC invalid!", NULL);
+ sal_Int64 nPtr = 0;
+ maArguments[0] >>= nPtr;
+ OutputDevice* pOutDev = reinterpret_cast<OutputDevice*>(nPtr);
+ ENSURE_ARG_OR_THROW( pOutDev != NULL,"Canvas::initialize: invalid OutDev pointer" );
+
// setup helper
- maDeviceHelper.init( pSysData->hDC,
- *this );
+ maDeviceHelper.init( pSysData->hDC, pOutDev, *this );
maCanvasHelper.setDevice( *this );
// check whether we can actually provide a BitmapCanvas
diff --git a/canvas/source/directx/dx_devicehelper.cxx b/canvas/source/directx/dx_devicehelper.cxx
index 673b9f4..cd23399 100644
--- a/canvas/source/directx/dx_devicehelper.cxx
+++ b/canvas/source/directx/dx_devicehelper.cxx
@@ -44,6 +44,7 @@
#include <vcl/sysdata.hxx>
+#include <vcl/outdev.hxx>
using namespace ::com::sun::star;
@@ -51,15 +52,17 @@ namespace dxcanvas
{
DeviceHelper::DeviceHelper() :
mpDevice( NULL ),
- mnHDC(0)
+ mnHDC(0),
+ mpOutDev(0)
{
}
- void DeviceHelper::init( HDC hdc,
+ void DeviceHelper::init( HDC hdc, OutputDevice* pOutDev,
rendering::XGraphicDevice& rDevice )
{
mnHDC = hdc;
mpDevice = &rDevice;
+ mpOutDev = pOutDev;
}
void DeviceHelper::disposing()
@@ -67,6 +70,7 @@ namespace dxcanvas
// release all references
mnHDC = 0;
mpDevice = NULL;
+ mpOutDev = 0;
}
geometry::RealSize2D DeviceHelper::getPhysicalResolution()
@@ -192,11 +196,7 @@ namespace dxcanvas
uno::Any DeviceHelper::getDeviceHandle() const
{
- HDC hdc( getHDC() );
- if( hdc )
- return uno::makeAny( reinterpret_cast< sal_Int64 >(hdc) );
- else
- return uno::Any();
+ return uno::makeAny( reinterpret_cast< sal_Int64 >(mpOutDev) );
}
uno::Any DeviceHelper::getSurfaceHandle() const
diff --git a/canvas/source/directx/dx_devicehelper.hxx b/canvas/source/directx/dx_devicehelper.hxx
index de3237b..bb455c3 100644
--- a/canvas/source/directx/dx_devicehelper.hxx
+++ b/canvas/source/directx/dx_devicehelper.hxx
@@ -31,7 +31,7 @@
#include <boost/utility.hpp>
-
+class OutputDevice;
/* Definition of DeviceHelper class */
namespace dxcanvas
@@ -50,7 +50,7 @@ namespace dxcanvas
@param rDevice
Ref back to owning UNO device
*/
- void init( HDC hdc,
+ void init( HDC hdc, OutputDevice* pOutputDev,
com::sun::star::rendering::XGraphicDevice& rDevice );
/// Dispose all internal references
@@ -105,6 +105,7 @@ namespace dxcanvas
*/
com::sun::star::rendering::XGraphicDevice* mpDevice;
HDC mnHDC;
+ OutputDevice* mpOutDev;
};
typedef ::rtl::Reference< com::sun::star::rendering::XGraphicDevice > DeviceRef;
diff --git a/canvas/source/directx/dx_spritedevicehelper.cxx b/canvas/source/directx/dx_spritedevicehelper.cxx
index a8f1db3..a101cf7 100644
--- a/canvas/source/directx/dx_spritedevicehelper.cxx
+++ b/canvas/source/directx/dx_spritedevicehelper.cxx
@@ -99,8 +99,7 @@ namespace dxcanvas
false));
// Assumes: SystemChildWindow() has CS_OWNDC
- DeviceHelper::init(GetDC(mpRenderModule->getHWND()),
- rSpriteCanvas);
+ DeviceHelper::init(GetDC(mpRenderModule->getHWND()),rWindow.GetOutDev(), rSpriteCanvas);
}
void SpriteDeviceHelper::disposing()
diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index 25226c1..77b6443 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -334,21 +334,7 @@ namespace slideshow
if( ::canvas::tools::getDeviceInfo( xCanvas, aDeviceParams ).getLength() > 1 )
{
- OUString aImplName;
-
- aDeviceParams[ 0 ] >>= aImplName;
-
- if( aImplName.endsWithIgnoreAsciiCase( "VCL" ) ||
- aImplName.endsWithIgnoreAsciiCase( "Cairo" ) ||
- avmedia::IsModel(sMimeType))
- {
- implInitializeVCLBasedPlayerWindow( rBounds, aDeviceParams, sMimeType );
- }
- else if( aImplName.endsWithIgnoreAsciiCase("DX") ||
- aImplName.endsWithIgnoreAsciiCase("DX9") )
- {
- implInitializeDXBasedPlayerWindow( rBounds, aDeviceParams );
- }
+ implInitializePlayerWindow( rBounds, aDeviceParams, sMimeType );
}
// set player properties
@@ -444,7 +430,7 @@ namespace slideshow
- bool ViewMediaShape::implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
+ bool ViewMediaShape::implInitializePlayerWindow( const ::basegfx::B2DRectangle& rBounds,
const uno::Sequence< uno::Any >& rVCLDeviceParams,
const OUString& rMimeType )
{
@@ -536,64 +522,6 @@ namespace slideshow
return mxPlayerWindow.is();
}
-
-
-
- bool ViewMediaShape::implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
- const uno::Sequence< uno::Any >& rDXDeviceParams )
- {
- if( !mxPlayerWindow.is() )
- {
- try
- {
- if( rDXDeviceParams.getLength() == 2 )
- {
- sal_Int64 aWNDVal=0;
-
- rDXDeviceParams[ 1 ] >>= aWNDVal;
-
- if( aWNDVal )
- {
- ::basegfx::B2DRange aTmpRange;
- ::canvas::tools::calcTransformedRectBounds( aTmpRange,
- rBounds,
- mpViewLayer->getTransformation() );
- const ::basegfx::B2IRange& rRangePix(
- ::basegfx::unotools::b2ISurroundingRangeFromB2DRange( aTmpRange ));
-
- if( !rRangePix.isEmpty() )
- {
- uno::Sequence< uno::Any > aArgs( 2 );
- awt::Rectangle aAWTRect( rRangePix.getMinX() + maWindowOffset.X,
- rRangePix.getMinY() + maWindowOffset.Y,
- rRangePix.getMaxX() - rRangePix.getMinX(),
- rRangePix.getMaxY() - rRangePix.getMinY() );
-
- if( mxPlayer.is() )
- {
- aArgs[ 0 ] = uno::makeAny( sal::static_int_cast< sal_Int32 >( aWNDVal) );
- aArgs[ 1 ] = uno::makeAny( aAWTRect );
-
- mxPlayerWindow.set( mxPlayer->createPlayerWindow( aArgs ) );
- }
- }
- }
- }
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- OSL_FAIL( OUStringToOString(
- comphelper::anyToString( cppu::getCaughtException() ),
- RTL_TEXTENCODING_UTF8 ).getStr() );
- }
- }
-
- return mxPlayerWindow.is();
- }
}
}
diff --git a/slideshow/source/engine/shapes/viewmediashape.hxx b/slideshow/source/engine/shapes/viewmediashape.hxx
index 4a37344..609c36e 100644
--- a/slideshow/source/engine/shapes/viewmediashape.hxx
+++ b/slideshow/source/engine/shapes/viewmediashape.hxx
@@ -141,12 +141,9 @@ namespace slideshow
bool implInitialize( const ::basegfx::B2DRectangle& rBounds );
void implSetMediaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rxProps );
void implInitializeMediaPlayer( const OUString& rMediaURL, const OUString& rMimeType );
- bool implInitializeVCLBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
+ bool implInitializePlayerWindow( const ::basegfx::B2DRectangle& rBounds,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rVCLDeviceParams,
const OUString& rMimeType );
- bool implInitializeDXBasedPlayerWindow( const ::basegfx::B2DRectangle& rBounds,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rDXDeviceParams );
-
ViewLayerSharedPtr mpViewLayer;
::std::auto_ptr< SystemChildWindow > mpMediaWindow;
mutable ::com::sun::star::awt::Point maWindowOffset;
More information about the Libreoffice-commits
mailing list