summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2011-02-12 03:12:11 -0600
committerNorbert Thiebaud <nthiebaud@gmail.com>2011-02-12 03:12:11 -0600
commitc539be7a2eb1ccb9a3739f4a12846b441d6aa193 (patch)
treecf703440ad786877f4b7b5cba41a8df258a21577
parent55ccb6dba6944b469709d17699746827e4ad2a6e (diff)
premerger avmedia and basic
-rw-r--r--avmedia/inc/avmedia/mediaitem.hxx2
-rw-r--r--avmedia/source/framework/makefile.mk15
-rw-r--r--avmedia/source/gstreamer/gstcommon.hxx60
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.cxx288
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.hxx38
-rw-r--r--avmedia/source/gstreamer/gstmanager.cxx64
-rw-r--r--avmedia/source/gstreamer/gstmanager.hxx47
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx1078
-rw-r--r--avmedia/source/gstreamer/gstplayer.hxx248
-rw-r--r--avmedia/source/gstreamer/gstuno.cxx45
-rw-r--r--avmedia/source/gstreamer/gstwindow.cxx568
-rw-r--r--avmedia/source/gstreamer/gstwindow.hxx193
-rw-r--r--avmedia/source/gstreamer/makefile.mk74
-rw-r--r--avmedia/source/inc/mediamisc.hxx1
-rw-r--r--avmedia/source/viewer/makefile.mk14
-rw-r--r--avmedia/source/viewer/mediawindow.cxx5
-rw-r--r--avmedia/source/viewer/mediawindow_impl.cxx97
-rw-r--r--avmedia/source/viewer/mediawindow_impl.hxx40
-rw-r--r--avmedia/source/win/makefile.mk15
-rw-r--r--avmedia/source/win/winuno.cxx2
-rw-r--r--avmedia/util/makefile.mk24
-rw-r--r--basic/inc/basic/mybasic.hxx2
-rw-r--r--basic/inc/basic/process.hxx9
-rw-r--r--basic/inc/basic/sbmod.hxx3
-rw-r--r--basic/inc/basic/sbobjmod.hxx8
-rw-r--r--basic/inc/basic/sbx.hxx1
-rw-r--r--basic/inc/basic/sbxbase.hxx2
-rw-r--r--basic/inc/basic/sbxdef.hxx39
-rw-r--r--basic/inc/basic/sbxvar.hxx42
-rw-r--r--basic/source/app/app.cxx2
-rw-r--r--basic/source/app/app.hxx2
-rw-r--r--basic/source/app/appbased.cxx2
-rw-r--r--basic/source/app/appedit.cxx2
-rw-r--r--basic/source/app/appwin.cxx2
-rw-r--r--basic/source/app/appwin.hxx2
-rw-r--r--basic/source/app/basic.src2
-rw-r--r--basic/source/app/brkpnts.cxx2
-rw-r--r--basic/source/app/brkpnts.hxx2
-rw-r--r--basic/source/app/dialogs.cxx4
-rw-r--r--basic/source/app/dialogs.hxx2
-rw-r--r--basic/source/app/makefile.mk66
-rw-r--r--basic/source/app/msgedit.cxx1
-rw-r--r--basic/source/app/mybasic.cxx2
-rw-r--r--basic/source/app/printer.hxx12
-rw-r--r--basic/source/app/process.cxx59
-rw-r--r--basic/source/app/status.cxx2
-rw-r--r--basic/source/app/textedit.cxx2
-rw-r--r--basic/source/basmgr/basicmanagerrepository.cxx2
-rw-r--r--basic/source/classes/errobject.cxx4
-rw-r--r--basic/source/classes/eventatt.cxx59
-rw-r--r--basic/source/classes/makefile.mk20
-rw-r--r--basic/source/classes/sb.cxx16
-rwxr-xr-xbasic/source/classes/sbunoobj.cxx102
-rwxr-xr-xbasic/source/classes/sbxmod.cxx173
-rw-r--r--basic/source/comp/codegen.cxx2
-rw-r--r--basic/source/comp/dim.cxx26
-rw-r--r--basic/source/comp/exprgen.cxx6
-rw-r--r--basic/source/comp/exprnode.cxx5
-rw-r--r--basic/source/comp/exprtree.cxx96
-rw-r--r--basic/source/comp/makefile.mk21
-rw-r--r--basic/source/inc/errobject.hxx3
-rw-r--r--basic/source/inc/expr.hxx5
-rw-r--r--basic/source/inc/namecont.hxx28
-rw-r--r--basic/source/inc/propacc.hxx1
-rw-r--r--basic/source/inc/runtime.hxx1
-rw-r--r--basic/source/inc/sbunoobj.hxx10
-rw-r--r--basic/source/runtime/makefile.mk30
-rw-r--r--basic/source/runtime/methods.cxx71
-rwxr-xr-xbasic/source/runtime/methods1.cxx14
-rw-r--r--basic/source/runtime/runtime.cxx19
-rw-r--r--basic/source/runtime/stdobj.cxx6
-rw-r--r--basic/source/runtime/step0.cxx17
-rw-r--r--basic/source/runtime/step1.cxx10
-rwxr-xr-xbasic/source/runtime/step2.cxx22
-rw-r--r--basic/source/sbx/makefile.mk52
-rw-r--r--basic/source/sbx/sbxconv.hxx4
-rw-r--r--basic/source/sbx/sbxcurr.cxx83
-rw-r--r--basic/source/sbx/sbxexec.cxx2
-rw-r--r--basic/source/sbx/sbxobj.cxx2
-rw-r--r--basic/source/sbx/sbxscan.cxx4
-rw-r--r--basic/source/sbx/sbxstr.cxx4
-rwxr-xr-xbasic/source/sbx/sbxvalue.cxx26
-rw-r--r--basic/source/sbx/sbxvar.cxx8
-rw-r--r--basic/source/uno/dlgcont.cxx8
-rw-r--r--basic/source/uno/namecont.cxx38
-rw-r--r--basic/util/makefile.mk76
-rw-r--r--basic/workben/makefile.mk35
87 files changed, 1769 insertions, 2534 deletions
diff --git a/avmedia/inc/avmedia/mediaitem.hxx b/avmedia/inc/avmedia/mediaitem.hxx
index a4a10a94af..7b80f5899a 100644
--- a/avmedia/inc/avmedia/mediaitem.hxx
+++ b/avmedia/inc/avmedia/mediaitem.hxx
@@ -30,9 +30,7 @@
#define _AVMEDIA_MEDIAITEM_HXX
#include <tools/rtti.hxx>
-#ifndef _POOLITEM_HXX
#include <svl/poolitem.hxx>
-#endif
#include <com/sun/star/media/ZoomLevel.hpp>
#define AVMEDIA_SETMASK_NONE ((sal_uInt32)(0x00000000))
diff --git a/avmedia/source/framework/makefile.mk b/avmedia/source/framework/makefile.mk
index 528371ca77..8e6d04af3c 100644
--- a/avmedia/source/framework/makefile.mk
+++ b/avmedia/source/framework/makefile.mk
@@ -42,16 +42,15 @@ SRC1FILES =\
# --- Files -------------------------------------
SLOFILES= \
- $(SLO)$/mediaitem.obj \
- $(SLO)$/mediamisc.obj \
- $(SLO)$/mediacontrol.obj \
- $(SLO)$/mediatoolbox.obj \
- $(SLO)$/mediaplayer.obj \
- $(SLO)$/soundhandler.obj
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/mediaitem.obj \
EXCEPTIONSFILES = \
- $(SLO)$/mediatoolbox.obj \
- $(SLO)$/soundhandler.obj
+ $(SLO)$/mediacontrol.obj \
+ $(SLO)$/mediamisc.obj \
+ $(SLO)$/mediaplayer.obj \
+ $(SLO)$/mediatoolbox.obj \
+ $(SLO)$/soundhandler.obj
# --- Targets ----------------------------------
diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx
new file mode 100644
index 0000000000..1d9b5caaff
--- /dev/null
+++ b/avmedia/source/gstreamer/gstcommon.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 Novell, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _GSTCOMMON_HXX
+#define _GSTCOMMON_HXX
+
+#include <gst/gst.h>
+
+#include <osl/mutex.hxx>
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <tools/string.hxx>
+#include <tools/urlobj.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/MouseButton.hpp>
+#include <com/sun/star/media/XManager.hpp>
+
+#define WM_GRAPHNOTIFY (WM_USER + 567)
+
+#endif // _GSTCOMMOM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx
index 13f0c5c4e7..bb3678d2b9 100644
--- a/avmedia/source/gstreamer/gstframegrabber.cxx
+++ b/avmedia/source/gstreamer/gstframegrabber.cxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -25,150 +26,86 @@
*
************************************************************************/
-#include "gstframegrabber.hxx"
-#include "gstplayer.hxx"
+#include <tools/prewin.h>
+#include <windows.h>
+#include <objbase.h>
+#include <strmif.h>
+#include <Amvideo.h>
+#include <Qedit.h>
+#include <uuids.h>
+#include <tools/postwin.h>
+#include "framegrabber.hxx"
+#include "player.hxx"
+
+#include <tools/stream.hxx>
#include <vcl/graph.hxx>
-#include <vcl/bmpacc.hxx>
+#include <unotools/localfilehelper.hxx>
-using namespace ::com::sun::star;
+#define AVMEDIA_GST_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_GStreamer"
+#define AVMEDIA_GST_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_GStreamer"
-namespace avmedia { namespace gst {
+using namespace ::com::sun::star;
-const gulong GRAB_TIMEOUT = 10000000;
+namespace avmedia { namespace gstreamer {
// ----------------
// - FrameGrabber -
// ----------------
-FrameGrabber::FrameGrabber( GString* pURI ) :
- Player( pURI ),
- mpFrameMutex( g_mutex_new() ),
- mpFrameCond( g_cond_new() ),
- mpLastPixbuf( NULL ),
- mbIsInGrabMode( false )
+FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ mxMgr( rxMgr )
{
+ ::CoInitialize( NULL );
}
// ------------------------------------------------------------------------------
FrameGrabber::~FrameGrabber()
{
- if( g_atomic_pointer_get( &mpPlayer ) )
- {
- implQuitThread();
- }
-
- // thread has ended, so that no more synchronization is necessary
- if( mpLastPixbuf )
- {
- g_object_unref( mpLastPixbuf );
- mpLastPixbuf = NULL;
- }
-
- g_cond_free( mpFrameCond );
- g_mutex_free( mpFrameMutex );
+ ::CoUninitialize();
}
// ------------------------------------------------------------------------------
-FrameGrabber* FrameGrabber::create( const GString* pURI )
+IMediaDet* FrameGrabber::implCreateMediaDet( const ::rtl::OUString& rURL ) const
{
- FrameGrabber* pFrameGrabber = NULL;
+ IMediaDet* pDet = NULL;
- if( pURI && pURI->len )
+ if( SUCCEEDED( CoCreateInstance( CLSID_MediaDet, NULL, CLSCTX_INPROC_SERVER, IID_IMediaDet, (void**) &pDet ) ) )
{
- // safely initialize GLib threading framework
- try
- {
- if( !g_thread_supported() )
- {
- g_thread_init( NULL );
- }
- }
- catch( ... )
- {}
+ String aLocalStr;
- if( g_thread_supported() )
+ if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( rURL, aLocalStr ) && aLocalStr.Len() )
{
- pFrameGrabber = new FrameGrabber( g_string_new( pURI->str ) );
-
- // wait until thread signals that it has finished initialization
- if( pFrameGrabber->mpThread )
- {
- g_mutex_lock( pFrameGrabber->mpMutex );
-
- while( !pFrameGrabber->implIsInitialized() )
- {
- g_cond_wait( pFrameGrabber->mpCond, pFrameGrabber->mpMutex );
- }
-
- g_mutex_unlock( pFrameGrabber->mpMutex );
- }
-
- GstElement* pPixbufSink = gst_element_factory_make( "gdkpixbufsink", NULL );
-
- // check if player pipeline and GdkPixbufSink could be initialized
- if( !pFrameGrabber->mpPlayer || !pPixbufSink )
- {
- delete pFrameGrabber;
- pFrameGrabber = NULL;
- }
- else
+ if( !SUCCEEDED( pDet->put_Filename( ::SysAllocString( aLocalStr.GetBuffer() ) ) ) )
{
- g_object_set( pFrameGrabber->mpPlayer, "audio-sink", gst_element_factory_make( "fakesink", NULL ), NULL );
- g_object_set( pFrameGrabber->mpPlayer, "video-sink", pPixbufSink, NULL );
+ pDet->Release();
+ pDet = NULL;
}
}
}
- return( pFrameGrabber );
+ return pDet;
}
// ------------------------------------------------------------------------------
-gboolean FrameGrabber::busCallback( GstBus* pBus, GstMessage* pMsg )
+bool FrameGrabber::create( const ::rtl::OUString& rURL )
{
- bool bDone = false;
+ // just check if a MediaDet interface can be created with the given URL
+ IMediaDet* pDet = implCreateMediaDet( rURL );
- if( pMsg && pMsg->structure )
+ if( pDet )
{
- GstStructure* pStruct = pMsg->structure;
- const gchar* pStructName = gst_structure_get_name( pStruct );
-
- if( ( ::std::string( pStructName ).find( "pixbuf" ) != ::std::string::npos ) &&
- gst_structure_has_field ( pStruct, "pixbuf") )
- {
- bool bFrameGrabbed = false;
-
- g_mutex_lock( mpFrameMutex );
-
- if( mbIsInGrabMode && ( getMediaTime() >= mfGrabTime ) )
- {
- OSL_TRACE( "Grabbing frame at %fs", getMediaTime() );
-
- if( mpLastPixbuf )
- {
- g_object_unref( mpLastPixbuf );
- mpLastPixbuf = NULL;
- }
-
- mpLastPixbuf = GDK_PIXBUF( g_value_dup_object( gst_structure_get_value( pStruct, "pixbuf" ) ) );
- bFrameGrabbed = true;
- }
-
- g_mutex_unlock( mpFrameMutex );
-
- if( bFrameGrabbed )
- {
- g_cond_signal( mpFrameCond );
- }
-
- bDone = true;
- }
+ maURL = rURL;
+ pDet->Release();
+ pDet = NULL;
}
+ else
+ maURL = ::rtl::OUString();
- return( bDone || Player::busCallback( pBus, pMsg ) );
+ return( maURL.getLength() > 0 );
}
// ------------------------------------------------------------------------------
@@ -177,102 +114,95 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
throw (uno::RuntimeException)
{
uno::Reference< graphic::XGraphic > xRet;
+ IMediaDet* pDet = implCreateMediaDet( maURL );
- if( implInitPlayer() )
+ if( pDet )
{
- OSL_TRACE( "Trying to grab frame at %fs", fMediaTime );
-
- GTimeVal aTimeoutTime;
-
- g_get_current_time( &aTimeoutTime );
- g_time_val_add( &aTimeoutTime, GRAB_TIMEOUT );
- setMediaTime( fMediaTime );
- start();
+ double fLength;
+ long nStreamCount;
+ bool bFound = false;
- if( isPlaying() )
+ if( SUCCEEDED( pDet->get_OutputStreams( &nStreamCount ) ) )
{
- g_mutex_lock( mpFrameMutex );
+ for( long n = 0; ( n < nStreamCount ) && !bFound; ++n )
+ {
+ GUID aMajorType;
- mbIsInGrabMode = true;
- mfGrabTime = fMediaTime;
- g_cond_timed_wait( mpFrameCond, mpFrameMutex, &aTimeoutTime );
- mbIsInGrabMode = false;
+ if( SUCCEEDED( pDet->put_CurrentStream( n ) ) &&
+ SUCCEEDED( pDet->get_StreamType( &aMajorType ) ) &&
+ ( aMajorType == MEDIATYPE_Video ) )
+ {
+ bFound = true;
+ }
+ }
+ }
- g_mutex_unlock( mpFrameMutex );
+ if( bFound &&
+ ( S_OK == pDet->get_StreamLength( &fLength ) ) &&
+ ( fLength > 0.0 ) && ( fMediaTime >= 0.0 ) && ( fMediaTime <= fLength ) )
+ {
+ AM_MEDIA_TYPE aMediaType;
+ long nWidth = 0, nHeight = 0, nSize = 0;
- stop();
- }
+ if( SUCCEEDED( pDet->get_StreamMediaType( &aMediaType ) ) )
+ {
+ if( ( aMediaType.formattype == FORMAT_VideoInfo ) &&
+ ( aMediaType.cbFormat >= sizeof( VIDEOINFOHEADER ) ) )
+ {
+ VIDEOINFOHEADER* pVih = reinterpret_cast< VIDEOINFOHEADER* >( aMediaType.pbFormat );
- OSL_ENSURE( g_atomic_pointer_get( &mpLastPixbuf ), "FrameGrabber timed out without receiving a Pixbuf" );
+ nWidth = pVih->bmiHeader.biWidth;
+ nHeight = pVih->bmiHeader.biHeight;
- if( g_atomic_pointer_get( &mpLastPixbuf ) )
- {
- OSL_TRACE( "FrameGrabber received a GdkPixbuf");
+ if( nHeight < 0 )
+ nHeight *= -1;
+ }
- g_mutex_lock( mpFrameMutex );
+ if( aMediaType.cbFormat != 0 )
+ {
+ ::CoTaskMemFree( (PVOID) aMediaType.pbFormat );
+ aMediaType.cbFormat = 0;
+ aMediaType.pbFormat = NULL;
+ }
- const int nWidth = gdk_pixbuf_get_width( mpLastPixbuf );
- const int nHeight = gdk_pixbuf_get_height( mpLastPixbuf );
- const int nChannels = gdk_pixbuf_get_n_channels( mpLastPixbuf );
- const guchar* pBuffer = gdk_pixbuf_get_pixels( mpLastPixbuf );
+ if( aMediaType.pUnk != NULL )
+ {
+ aMediaType.pUnk->Release();
+ aMediaType.pUnk = NULL;
+ }
+ }
- if( pBuffer && ( nWidth > 0 ) && ( nHeight > 0 ) )
+ if( ( nWidth > 0 ) && ( nHeight > 0 ) &&
+ SUCCEEDED( pDet->GetBitmapBits( 0, &nSize, NULL, nWidth, nHeight ) ) &&
+ ( nSize > 0 ) )
{
- Bitmap aFrame( Size( nWidth, nHeight), 24 );
- bool bInit = false;
+ char* pBuffer = new char[ nSize ];
- if( ( gdk_pixbuf_get_colorspace( mpLastPixbuf ) == GDK_COLORSPACE_RGB ) &&
- ( nChannels >= 3 ) && ( nChannels <= 4 ) &&
- ( gdk_pixbuf_get_bits_per_sample( mpLastPixbuf ) == 8 ) )
+ try
{
- BitmapWriteAccess* pAcc = aFrame.AcquireWriteAccess();
-
- if( pAcc )
+ if( SUCCEEDED( pDet->GetBitmapBits( fMediaTime, NULL, pBuffer, nWidth, nHeight ) ) )
{
- BitmapColor aPixel( 0, 0, 0 );
- const int nRowStride = gdk_pixbuf_get_rowstride( mpLastPixbuf );
- const bool bAlpha = ( nChannels == 4 );
+ SvMemoryStream aMemStm( pBuffer, nSize, STREAM_READ | STREAM_WRITE );
+ Bitmap aBmp;
- for( int nRow = 0; nRow < nHeight; ++nRow )
+ if( aBmp.Read( aMemStm, false ) && !aBmp.IsEmpty() )
{
- guchar* pCur = const_cast< guchar* >( pBuffer + nRow * nRowStride );
-
- for( int nCol = 0; nCol < nWidth; ++nCol )
- {
- aPixel.SetRed( *pCur++ );
- aPixel.SetGreen( *pCur++ );
- aPixel.SetBlue( *pCur++ );
-
- // ignore alpha channel
- if( bAlpha )
- {
- ++pCur;
- }
-
- pAcc->SetPixel( nRow, nCol, aPixel );
- }
+ const Graphic aGraphic( aBmp );
+ xRet = aGraphic.GetXGraphic();
}
-
- aFrame.ReleaseAccess( pAcc );
- bInit = true;
}
}
-
- if( !bInit )
+ catch( ... )
{
- aFrame.Erase( Color( COL_BLACK ) );
}
- xRet = Graphic( aFrame ).GetXGraphic();
+ delete [] pBuffer;
}
-
- g_object_unref( mpLastPixbuf );
- mpLastPixbuf = NULL;
-
- g_mutex_unlock( mpFrameMutex );
}
+
+ pDet->Release();
}
-
+
return xRet;
}
@@ -281,7 +211,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( )
throw (uno::RuntimeException)
{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME ) );
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_FRAMEGRABBER_IMPLEMENTATIONNAME ) );
}
// ------------------------------------------------------------------------------
@@ -289,7 +219,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMe
sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) );
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_FRAMEGRABBER_SERVICENAME ) );
}
// ------------------------------------------------------------------------------
@@ -298,10 +228,12 @@ uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames
throw (uno::RuntimeException)
{
uno::Sequence< ::rtl::OUString > aRet(1);
- aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) );
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_FRAMEGRABBER_SERVICENAME ) );
return aRet;
}
-} // namespace win
+} // namespace gstreamer
} // namespace avmedia
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx
index a074cd8be6..fc0795221a 100644
--- a/avmedia/source/gstreamer/gstframegrabber.hxx
+++ b/avmedia/source/gstreamer/gstframegrabber.hxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -28,29 +29,25 @@
#ifndef _FRAMEGRABBER_HXX
#define _FRAMEGRABBER_HXX
-#include "gstplayer.hxx"
-#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "gstcommon.hxx"
-#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_
#include "com/sun/star/media/XFrameGrabber.hdl"
-#endif
-namespace avmedia { namespace gst {
+namespace avmedia { namespace gstreamer {
// ----------------
// - FrameGrabber -
// ----------------
-class FrameGrabber : public Player,
- public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber,
+class FrameGrabber : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XFrameGrabber,
::com::sun::star::lang::XServiceInfo >
{
public:
- // static create method instead of public Ctor
- static FrameGrabber* create( const GString* pUri );
+ FrameGrabber( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+ ~FrameGrabber();
- ~FrameGrabber();
+ bool create( const ::rtl::OUString& rURL );
// XFrameGrabber
virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) throw (::com::sun::star::uno::RuntimeException);
@@ -60,22 +57,15 @@ public:
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-protected: FrameGrabber( GString* pURI = NULL );
+private:
- virtual gboolean busCallback( GstBus* pBus,
- GstMessage* pMsg );
-
-private: FrameGrabber( const FrameGrabber& );
- FrameGrabber& operator=( const FrameGrabber& );
-
- GMutex* mpFrameMutex;
- GCond* mpFrameCond;
- GdkPixbuf* mpLastPixbuf;
- double mfGrabTime;
- bool mbIsInGrabMode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+ ::rtl::OUString maURL;
};
-} // namespace gst
+} // namespace gstreamer
} // namespace avmedia
#endif // _FRAMEGRABBER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx
index 61ee4ce22c..558b949563 100644
--- a/avmedia/source/gstreamer/gstmanager.cxx
+++ b/avmedia/source/gstreamer/gstmanager.cxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -28,58 +29,81 @@
#include "gstmanager.hxx"
#include "gstplayer.hxx"
+#include <tools/urlobj.hxx>
+
+#define AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer"
+#define AVMEDIA_GST_MANAGER_SERVICENAME "com.sun.star.media.Manager"
+
+#if DEBUG
+#define DBG OSL_TRACE
+#else
+#define DBG(...)
+#endif
+
using namespace ::com::sun::star;
-namespace avmedia
-{
-namespace gst
-{
+namespace avmedia { namespace gstreamer {
// ----------------
// - Manager -
// ----------------
Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mxMgr( rxMgr )
-{}
+{
+ DBG( "avmediagst: Manager::Manager" );
+}
// ------------------------------------------------------------------------------
Manager::~Manager()
-{}
+{
+}
// ------------------------------------------------------------------------------
uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
- return( ::avmedia::gst::Player::create( rURL ) );
+ Player* pPlayer( new Player( mxMgr ) );
+ uno::Reference< media::XPlayer > xRet( pPlayer );
+ const INetURLObject aURL( rURL );
+
+ DBG( "avmediagst: Manager::createPlayer" );
+
+ if( !pPlayer->create( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
+ xRet = uno::Reference< media::XPlayer >();
+
+ return xRet;
}
// ------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL Manager::getImplementationName()
- throw( uno::RuntimeException )
+::rtl::OUString SAL_CALL Manager::getImplementationName( )
+ throw (uno::RuntimeException)
{
- return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) ) );
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_MANAGER_IMPLEMENTATIONNAME ) );
}
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
- return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) );
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_MANAGER_SERVICENAME ) );
}
// ------------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames()
- throw( uno::RuntimeException )
+uno::Sequence< ::rtl::OUString > SAL_CALL Manager::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
{
- uno::Sequence< ::rtl::OUString > aRet( 1 );
- aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) );
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_MANAGER_SERVICENAME ) );
- return( aRet );
+ return aRet;
}
-} // namespace gst
+
+} // namespace gstreamer
} // namespace avmedia
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstmanager.hxx b/avmedia/source/gstreamer/gstmanager.hxx
index 9f80e8c1a9..2d83215402 100644
--- a/avmedia/source/gstreamer/gstmanager.hxx
+++ b/avmedia/source/gstreamer/gstmanager.hxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -25,50 +26,42 @@
*
************************************************************************/
-#ifndef _GSTMANAGER_HXX
-#define _GSTMANAGER_HXX
+#ifndef _MANAGER_HXX
+#define _MANAGER_HXX
#include "gstcommon.hxx"
-#ifndef _COM_SUN_STAR_MEDIA_XMANAGER_HDL_
#include "com/sun/star/media/XManager.hdl"
-#endif
// -----------
// - Manager -
// -----------
-namespace avmedia
-{
-namespace gst
-{
-class Manager : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XManager,
- ::com::sun::star::lang::XServiceInfo >
+namespace avmedia { namespace gstreamer {
+
+class Manager : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XManager,
+ ::com::sun::star::lang::XServiceInfo >
{
-public: Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
+public:
+
+ Manager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
~Manager();
// XManager
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer(
- const ::rtl::OUString& aURL )
- throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > SAL_CALL createPlayer( const ::rtl::OUString& aURL ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw( ::com::sun::star::uno::RuntimeException );
-
-
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
};
-} // namespace gst
+
+} // namespace gstreamer
} // namespace avmedia
-#endif // _GSTMANAGER_HXX
+#endif // _MANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
index f082cfc5c5..018cc2e4c2 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -25,914 +26,589 @@
*
************************************************************************/
+#include <math.h>
+
+#ifndef __RTL_USTRING_
+#include <rtl/string.hxx>
+#endif
+
#include "gstplayer.hxx"
-#include "gstwindow.hxx"
#include "gstframegrabber.hxx"
-#include <stdio.h>
-#include <unistd.h>
-#include <math.h>
-#include <string>
-#include <gst/gstelement.h>
+#include "gstwindow.hxx"
+
#include <gst/interfaces/xoverlay.h>
+#define AVMEDIA_GST_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_GStreamer"
+#define AVMEDIA_GST_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer"
-// maximum timeout time in nanoseconds
-#define GST_MAX_TIMEOUT (2500 * GST_MSECOND)
+#if DEBUG
+#define DBG OSL_TRACE
+#else
+#define DBG(...)
+#endif
using namespace ::com::sun::star;
-namespace avmedia
-{
-namespace gst
-{
-const double NANO_TIME_FACTOR = 1000000000.0;
-
-const long VIDEO_DEFAULT_WIDTH = 256;
-const long VIDEO_DEFAULT_HEIGHT = 192;
+namespace avmedia { namespace gstreamer {
// ----------------
-// - GstBusSource -
+// - Player -
// ----------------
-struct GstBusSource : public GSource
+Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ mxMgr( rxMgr ),
+ mpPlaybin( NULL ),
+ mbFakeVideo (sal_False ),
+ mnUnmutedVolume( 0 ),
+ mbPlayPending ( false ),
+ mbMuted( false ),
+ mbLooping( false ),
+ mbInitialized( false ),
+ mnWindowID( 0 ),
+ mpXOverlay( NULL ),
+ mnDuration( 0 ),
+ mnWidth( 0 ),
+ mnHeight( 0 ),
+ maSizeCondition( osl_createCondition() )
{
- GstBus* mpBus;
+ // Initialize GStreamer library
+ int argc = 1;
+ char name[] = "libreoffice";
+ char *arguments[] = { name };
+ char** argv = arguments;
+ GError* pError = NULL;
- GstBusSource() :
- mpBus( NULL )
- {}
+ mbInitialized = gst_init_check( &argc, &argv, &pError );
- ~GstBusSource()
- {}
-};
+ if (pError != NULL)
+ // TODO: thow an exception?
+ g_error_free (pError);
+}
-// ---------------
-// - Player -
-// ---------------
-Player::Player( GString* pURI ) :
- mpMutex( g_mutex_new() ),
- mpCond( g_cond_new() ),
- mpThread( NULL ),
- mpContext( NULL ),
- mpLoop( NULL ),
- mpPlayer( NULL ),
- mpURI( pURI ),
- mpPlayerWindow( NULL ),
- mnIsVideoSource( 0 ),
- mnVideoWidth( 0 ),
- mnVideoHeight( 0 ),
- mnInitialized( 0 ),
- mnVolumeDB( 0 ),
- mnLooping( 0 ),
- mnQuit( 0 ),
- mnVideoWindowSet( 0 ),
- mnInitFail( 0 )
-{
- // initialize GStreamer framework only once
- static bool bGstInitialized = false;
+// ------------------------------------------------------------------------------
- if( !bGstInitialized )
+Player::~Player()
+{
+ // Release the elements and pipeline
+ if( mbInitialized )
{
- gst_init( NULL, NULL );
- bGstInitialized = true;
- }
+ if( mpPlaybin )
+ {
+ gst_element_set_state( mpPlaybin, GST_STATE_NULL );
+ gst_object_unref( GST_OBJECT( mpPlaybin ) );
- if( pURI )
- {
- OSL_TRACE( ">>> --------------------------------" );
- OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str );
+ mpPlaybin = NULL;
+ }
- mpThread = g_thread_create( Player::implThreadFunc, this, true, NULL );
+ if( mpXOverlay ) {
+ g_object_unref( G_OBJECT ( mpXOverlay ) );
+ mpXOverlay = NULL;
+ }
}
}
// ------------------------------------------------------------------------------
-Player::~Player()
+static gboolean gst_pipeline_bus_callback( GstBus *, GstMessage *message, gpointer data )
{
- if( g_atomic_pointer_get( &mpPlayer ) )
- {
- implQuitThread();
- }
+ Player* pPlayer = (Player *) data;
+
+ pPlayer->processMessage( message );
- // cleanup
- g_cond_free( mpCond );
- g_mutex_free( mpMutex );
- g_string_free( mpURI, false );
+ return TRUE;
}
-// ------------------------------------------------------------------------------
-Player* Player::create( const ::rtl::OUString& rURL )
+static GstBusSyncReply gst_pipeline_bus_sync_handler( GstBus *, GstMessage * message, gpointer data )
{
- Player* pPlayer = NULL;
+ Player* pPlayer = (Player *) data;
- if( rURL.getLength() )
- {
- // safely initialize GLib threading framework
- try
- {
- if( !g_thread_supported() )
- {
- g_thread_init( NULL );
- }
- }
- catch( ... )
- {}
+ return pPlayer->processSyncMessage( message );
+}
- if( g_thread_supported() )
- {
- const INetURLObject aURL( rURL );
-
- if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
- {
- GString* pURI = g_string_new( ::rtl::OUStringToOString(
- aURL.GetMainURL( INetURLObject::NO_DECODE ),
- RTL_TEXTENCODING_UTF8 ).getStr() );
-
- if( pURI->len )
- {
- pPlayer = new Player( pURI );
-
- // wait until thread signals that it has finished initialization
- if( pPlayer->mpThread )
- {
- g_mutex_lock( pPlayer->mpMutex );
-
- while( !pPlayer->implIsInitialized() )
- {
- g_cond_wait( pPlayer->mpCond, pPlayer->mpMutex );
- }
+void Player::processMessage( GstMessage *message )
+{
+ switch( GST_MESSAGE_TYPE( message ) ) {
+ case GST_MESSAGE_EOS:
+ gst_element_set_state( mpPlaybin, GST_STATE_READY );
+ mbPlayPending = false;
+ if (mbLooping)
+ start();
+ break;
+ case GST_MESSAGE_STATE_CHANGED:
+ if( message->src == GST_OBJECT( mpPlaybin ) ) {
+ GstState newstate, pendingstate;
- g_mutex_unlock( pPlayer->mpMutex );
- }
+ gst_message_parse_state_changed (message, NULL, &newstate, &pendingstate);
- // check if player pipeline could be initialized
- if( !pPlayer->mpPlayer )
- {
- delete pPlayer;
- pPlayer = NULL;
- }
- }
- else
- {
- g_string_free( pURI, false );
- }
- }
+ if( newstate == GST_STATE_PAUSED &&
+ pendingstate == GST_STATE_VOID_PENDING &&
+ mpXOverlay )
+ gst_x_overlay_expose( mpXOverlay );
+
+ if (mbPlayPending)
+ mbPlayPending = ((newstate == GST_STATE_READY) || (newstate == GST_STATE_PAUSED));
}
+ default:
+ break;
}
-
- return( pPlayer );
}
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::start()
- throw( uno::RuntimeException )
+GstBusSyncReply Player::processSyncMessage( GstMessage *message )
{
- if( implInitPlayer() && !isPlaying() )
- {
- gst_element_set_state( mpPlayer, GST_STATE_PLAYING );
- }
-}
+ DBG( "%p processSyncMessage", this );
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::stop()
- throw( uno::RuntimeException )
-{
- if( implInitPlayer() && isPlaying() )
- {
- gst_element_set_state( mpPlayer, GST_STATE_PAUSED );
+ if (message->structure) {
+ if( !strcmp( gst_structure_get_name( message->structure ), "prepare-xwindow-id" ) && mnWindowID != 0 ) {
+ if( mpXOverlay )
+ g_object_unref( G_OBJECT ( mpXOverlay ) );
+ mpXOverlay = GST_X_OVERLAY( GST_MESSAGE_SRC( message ) );
+ g_object_ref( G_OBJECT ( mpXOverlay ) );
+ gst_x_overlay_set_xwindow_id( mpXOverlay, mnWindowID );
+ return GST_BUS_DROP;
+ }
}
-}
-// ------------------------------------------------------------------------------
-sal_Bool SAL_CALL Player::isPlaying()
- throw( uno::RuntimeException )
-{
- GstState aState = GST_STATE_NULL;
+ if( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_STATE_CHANGED ) {
+ if( message->src == GST_OBJECT( mpPlaybin ) ) {
+ GstState newstate, pendingstate;
- if( mpPlayer )
- {
- gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT );
- }
+ gst_message_parse_state_changed (message, NULL, &newstate, &pendingstate);
- return( GST_STATE_PLAYING == aState );
-}
+ DBG( "%p state change received, new state %d", this, newstate );
+ if( newstate == GST_STATE_PAUSED &&
+ pendingstate == GST_STATE_VOID_PENDING ) {
-// ------------------------------------------------------------------------------
-double SAL_CALL Player::getDuration()
- throw( uno::RuntimeException )
-{
- gint64 nDuration = 0;
+ DBG( "%p change to paused received", this );
- if( implInitPlayer() )
- {
- GstFormat aFormat = GST_FORMAT_TIME;
+ if( mnDuration == 0) {
+ GstFormat format = GST_FORMAT_TIME;
+ gint64 gst_duration = 0L;
- if( !gst_element_query_duration( mpPlayer, &aFormat, &nDuration ) ||
- ( GST_FORMAT_TIME != aFormat ) ||
- ( nDuration < 0 ) )
- {
- nDuration = 0;
- }
- }
+ if( gst_element_query_duration( mpPlaybin, &format, &gst_duration) && format == GST_FORMAT_TIME && gst_duration > 0L )
+ mnDuration = gst_duration;
+ }
- return( static_cast< double >( nDuration ) / NANO_TIME_FACTOR );
-}
+ if( mnWidth == 0 ) {
+ GList *pStreamInfo = NULL;
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::setMediaTime( double fTime )
- throw( uno::RuntimeException )
-{
- if( implInitPlayer() )
- {
- fTime = ::std::min( ::std::max( fTime, 0.0 ), getDuration() );
+ g_object_get( G_OBJECT( mpPlaybin ), "stream-info", &pStreamInfo, NULL );
- gst_element_seek_simple( mpPlayer, GST_FORMAT_TIME,
- (GstSeekFlags) ( GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT ),
- static_cast< gint64 >( fTime * NANO_TIME_FACTOR ) );
- }
-}
+ for ( ; pStreamInfo != NULL; pStreamInfo = pStreamInfo->next) {
+ GObject *pInfo = G_OBJECT( pStreamInfo->data );
-// ------------------------------------------------------------------------------
-double SAL_CALL Player::getMediaTime()
- throw( uno::RuntimeException )
-{
- double fRet = 0.0;
+ if( !pInfo )
+ continue;
- if( implInitPlayer() )
- {
- GstFormat aFormat = GST_FORMAT_TIME;
- gint64 nCurTime = 0;
+ int nType;
+ g_object_get( pInfo, "type", &nType, NULL );
+ GEnumValue *pValue = g_enum_get_value( G_PARAM_SPEC_ENUM( g_object_class_find_property( G_OBJECT_GET_CLASS( pInfo ), "type" ) )->enum_class,
+ nType );
- if( gst_element_query_position( mpPlayer, &aFormat, &nCurTime ) &&
- ( GST_FORMAT_TIME == aFormat ) &&
- ( nCurTime >= 0 ) )
- {
- fRet = static_cast< double >( nCurTime ) / NANO_TIME_FACTOR;
+ if( !g_strcasecmp( pValue->value_nick, "video" ) ) {
+ GstStructure *pStructure;
+ GstPad *pPad;
+
+ g_object_get( pInfo, "object", &pPad, NULL );
+ pStructure = gst_caps_get_structure( GST_PAD_CAPS( pPad ), 0 );
+ if( pStructure ) {
+ gst_structure_get_int( pStructure, "width", &mnWidth );
+ gst_structure_get_int( pStructure, "height", &mnHeight );
+ DBG( "queried size: %d x %d", mnWidth, mnHeight );
+ }
+ }
+ }
+
+#if DEBUG
+ sal_Bool aSuccess =
+#endif
+ osl_setCondition( maSizeCondition );
+ DBG( "%p set condition result: %d", this, aSuccess );
+ }
+ }
+ }
+ } else if( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_ERROR ) {
+ if( mnWidth == 0 ) {
+ // an error occurred, set condition so that OOo thread doesn't wait for us
+#if DEBUG
+ sal_Bool aSuccess =
+#endif
+ osl_setCondition( maSizeCondition );
+ DBG( "%p set condition result: %d", this, aSuccess );
}
}
- return( fRet );
+ return GST_BUS_PASS;
}
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::setStopTime( double /* fTime */ )
- throw( uno::RuntimeException )
+void Player::preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo )
{
- OSL_TRACE( "GStreamer method avmedia::gst::Player::setStopTime needs to be implemented" );
+ GstBus *pBus;
- /* Currently no need for implementation since higher levels of code don't use this method at all
- !!! TODO: needs to be implemented if this functionality is needed at a later point of time
- if( implInitPlayer() )
- {
- }
+ if( mpPlaybin != NULL ) {
+ gst_element_set_state( mpPlaybin, GST_STATE_NULL );
+ mbPlayPending = false;
+ g_object_unref( mpPlaybin );
+ }
- */
-}
+ mpPlaybin = gst_element_factory_make( "playbin", NULL );
-// ------------------------------------------------------------------------------
-double SAL_CALL Player::getStopTime()
- throw( uno::RuntimeException )
-{
- /*
- Currently no need for implementation since higher levels of code don't set a stop time ATM
- !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time
- */
+ if( bFakeVideo )
+ g_object_set( G_OBJECT( mpPlaybin ), "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL );
- return( getDuration() );
-}
+ mbFakeVideo = bFakeVideo;
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::setRate( double /* fRate */ )
- throw( uno::RuntimeException )
-{
- OSL_TRACE( "GStreamer method avmedia::gst::Player::setRate needs to be implemented" );
+ rtl::OString ascURL = OUStringToOString( rURL, RTL_TEXTENCODING_ASCII_US );
+ g_object_set( G_OBJECT( mpPlaybin ), "uri", ascURL.getStr() , NULL );
- /* Currently no need for implementation since higher levels of code don't use this method at all
- !!! TODO: needs to be implemented if this functionality is needed at a later point of time
- */
+ pBus = gst_element_get_bus( mpPlaybin );
+ gst_bus_add_watch( pBus, gst_pipeline_bus_callback, this );
+ DBG( "%p set sync handler", this );
+ gst_bus_set_sync_handler( pBus, gst_pipeline_bus_sync_handler, this );
+ g_object_unref( pBus );
}
-// ------------------------------------------------------------------------------
-double SAL_CALL Player::getRate()
- throw( uno::RuntimeException )
+bool Player::create( const ::rtl::OUString& rURL )
{
- /*
- Currently no need for implementation since higher levels of code don't set a different rate than 1 ATM
- !!! TODO: needs to be fully implemented if this functionality is needed at a later point of time
- */
+ bool bRet = false;
- return( 1.0 );
-}
+ // create all the elements and link them
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet )
- throw( uno::RuntimeException )
-{
- if( bSet && !isPlaybackLoop() )
- g_atomic_int_inc( &mnLooping );
- else if( !bSet && isPlaybackLoop() )
- g_atomic_int_dec_and_test( &mnLooping );
-}
+ if( mbInitialized )
+ {
+ preparePlaybin( rURL, true );
-// ------------------------------------------------------------------------------
-sal_Bool SAL_CALL Player::isPlaybackLoop()
- throw( uno::RuntimeException )
-{
- return( g_atomic_int_get( &mnLooping ) > 0 );
-}
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+ mbPlayPending = false;
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::setMute( sal_Bool bSet )
- throw( uno::RuntimeException )
-{
- if( implInitPlayer() && ( bSet != isMute() ) )
- {
- if( bSet )
- {
- g_object_set( mpPlayer, "volume", 0.0, NULL );
- }
- else
- {
- setVolumeDB( mnVolumeDB );
- }
+ bRet = true;
}
-}
-// ------------------------------------------------------------------------------
-sal_Bool SAL_CALL Player::isMute()
- throw( uno::RuntimeException )
-{
- gdouble fGstVolume = 1.0;
- if( implInitPlayer() )
- {
- g_object_get( mpPlayer, "volume", &fGstVolume, NULL );
- }
+ if( bRet )
+ maURL = rURL;
+ else
+ maURL = ::rtl::OUString();
- return( 0.0 == fGstVolume );
+ return bRet;
}
// ------------------------------------------------------------------------------
-void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB )
- throw( uno::RuntimeException )
+
+void SAL_CALL Player::start( )
+ throw (uno::RuntimeException)
{
- if( implInitPlayer() )
+ // set the pipeline state to READY and run the loop
+ if( mbInitialized && NULL != mpPlaybin )
{
- g_mutex_lock( mpMutex );
- mnVolumeDB = nVolumeDB;
- g_mutex_unlock( mpMutex );
-
- // maximum gain for gstreamer volume is 10
- double fGstVolume = pow( 10.0, static_cast< double >( ::std::min(
- nVolumeDB, static_cast< sal_Int16 >( 20 ) ) / 20.0 ) );
-
- g_object_set( mpPlayer, "volume", fGstVolume, NULL );
+ gst_element_set_state( mpPlaybin, GST_STATE_PLAYING );
+ mbPlayPending = true;
}
}
// ------------------------------------------------------------------------------
-sal_Int16 SAL_CALL Player::getVolumeDB()
- throw( uno::RuntimeException )
+
+void SAL_CALL Player::stop( )
+ throw (uno::RuntimeException)
{
- return( static_cast< sal_Int16 >( g_atomic_int_get( &mnVolumeDB ) ) );
+ // set the pipeline in PAUSED STATE
+ if( mpPlaybin )
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
+
+ mbPlayPending = false;
+ DBG( "stop %p", mpPlaybin );
}
// ------------------------------------------------------------------------------
-awt::Size SAL_CALL Player::getPreferredPlayerWindowSize()
- throw( uno::RuntimeException )
+
+sal_Bool SAL_CALL Player::isPlaying()
+ throw (uno::RuntimeException)
{
- awt::Size aSize( 0, 0 );
+ bool bRet = mbPlayPending;
- if( implInitPlayer() && ( g_atomic_int_get( &mnIsVideoSource ) > 0 ) )
+ // return whether the pipeline is in PLAYING STATE or not
+ if( !mbPlayPending && mbInitialized && mpPlaybin )
{
- aSize.Width = g_atomic_int_get( &mnVideoWidth );
- aSize.Height = g_atomic_int_get( &mnVideoHeight );
-
- // if we have a video source, but no size is given => use default size
- if( ( aSize.Width <= 0 ) || ( aSize.Height <= 0 ) )
- {
- aSize.Width = VIDEO_DEFAULT_WIDTH;
- aSize.Height = VIDEO_DEFAULT_HEIGHT;
- }
+ bRet = GST_STATE_PLAYING == GST_STATE( mpPlaybin );
}
- OSL_TRACE( ">>> Requested preferred video size is: %d x %d pixel", aSize.Width, aSize.Height );
+ DBG( "isPlaying %d", bRet );
- return( aSize );
+ return bRet;
}
// ------------------------------------------------------------------------------
-uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow(
- const uno::Sequence< uno::Any >& rArguments )
- throw( uno::RuntimeException )
-{
- uno::Reference< ::media::XPlayerWindow > xRet;
- awt::Size aSize( getPreferredPlayerWindowSize() );
- OSL_ENSURE( !g_atomic_pointer_get( &mpPlayerWindow ), "::avmedia::gst::Player already has a player window" );
-
- if( ( aSize.Width > 0 ) && ( aSize.Height > 0 ) )
- {
- Window* pPlayerWindow = new Window( *this );
-
- xRet = pPlayerWindow;
+double SAL_CALL Player::getDuration( )
+ throw (uno::RuntimeException)
+{
+ // slideshow checks for non-zero duration, so cheat here
+ double duration = 0.01;
- if( !pPlayerWindow->create( rArguments ) )
- {
- xRet.clear();
- }
- else
- {
- // try to use gconf user configurable video sink first
- GstElement* pVideoSink = gst_element_factory_make( "gconfvideosink", NULL );
-
- if( ( NULL != pVideoSink ) ||
- ( NULL != ( pVideoSink = gst_element_factory_make( "autovideosink", NULL ) ) ) ||
- ( NULL != ( pVideoSink = gst_element_factory_make( "xvimagesink", NULL ) ) ) ||
- ( NULL != ( pVideoSink = gst_element_factory_make( "ximagesink", NULL ) ) ) )
- {
- GstState aOldState = GST_STATE_NULL;
-
- mpPlayerWindow = pPlayerWindow;
- gst_element_get_state( mpPlayer, &aOldState, NULL, GST_MAX_TIMEOUT );
- gst_element_set_state( mpPlayer, GST_STATE_READY );
- g_object_set( mpPlayer, "video-sink", pVideoSink, NULL );
- gst_element_set_state( mpPlayer, aOldState );
- }
- }
+ if( mpPlaybin && mnDuration > 0 ) {
+ duration = mnDuration / 1E9;
}
- return( xRet );
+ return duration;
}
// ------------------------------------------------------------------------------
-uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber()
- throw( ::com::sun::star::uno::RuntimeException )
+
+void SAL_CALL Player::setMediaTime( double fTime )
+ throw (uno::RuntimeException)
{
- FrameGrabber* pFrameGrabber = NULL;
- const awt::Size aPrefSize( getPreferredPlayerWindowSize() );
+ if( mpPlaybin ) {
+ gint64 gst_position = llround (fTime * 1E9);
- if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) )
- {
- pFrameGrabber = FrameGrabber::create( mpURI );
- }
+ gst_element_seek( mpPlaybin, 1.0,
+ GST_FORMAT_TIME,
+ GST_SEEK_FLAG_FLUSH,
+ GST_SEEK_TYPE_SET, gst_position,
+ GST_SEEK_TYPE_NONE, 0 );
+ if( !isPlaying() )
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
- return( pFrameGrabber );
+ DBG( "seek to: %lld ns original: %lf s", gst_position, fTime );
+ }
}
// ------------------------------------------------------------------------------
-void SAL_CALL Player::dispose()
- throw( uno::RuntimeException )
+
+double SAL_CALL Player::getMediaTime( )
+ throw (uno::RuntimeException)
{
- if( mpPlayer )
- {
- stop();
- implQuitThread();
+ double position = 0.0;
+
+ if( mpPlaybin ) {
+ // get current position in the stream
+ GstFormat format = GST_FORMAT_TIME;
+ gint64 gst_position;
+ if( gst_element_query_position( mpPlaybin, &format, &gst_position ) && format == GST_FORMAT_TIME && gst_position > 0L )
+ position = gst_position / 1E9;
}
- OSL_ASSERT( NULL == mpPlayer );
+ return position;
}
// ------------------------------------------------------------------------------
-void SAL_CALL Player::addEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ )
- throw( uno::RuntimeException )
-{}
-// ------------------------------------------------------------------------------
-void SAL_CALL Player::removeEventListener( const uno::Reference< lang::XEventListener >& /*rxListener*/ )
- throw( uno::RuntimeException )
-{}
-
-// ------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL Player::getImplementationName()
- throw( uno::RuntimeException )
+void SAL_CALL Player::setStopTime( double /*fTime*/ )
+ throw (uno::RuntimeException)
{
- return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME ) ) );
+ // TODO implement
}
// ------------------------------------------------------------------------------
-sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName )
- throw( uno::RuntimeException )
-{
- return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) ) );
-}
-// ------------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames()
- throw( uno::RuntimeException )
+double SAL_CALL Player::getStopTime( )
+ throw (uno::RuntimeException)
{
- uno::Sequence< ::rtl::OUString > aRet( 1 );
- aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) );
+ // Get the time at which to stop
- return( aRet );
+ return 0;
}
// ------------------------------------------------------------------------------
-void Player::implQuitThread()
-{
- if( mpThread )
- {
- // set quit flag to 1 so that the main loop will be quit in idle
- // handler the next time it is called from the thread's main loop
- g_atomic_int_inc( &mnQuit );
- // wait until loop and as such the thread has quit
- g_thread_join( mpThread );
- mpThread = NULL;
- }
+void SAL_CALL Player::setRate( double /*fRate*/ )
+ throw (uno::RuntimeException)
+{
+ // TODO set the window rate
}
// ------------------------------------------------------------------------------
-bool Player::implInitPlayer()
+
+double SAL_CALL Player::getRate( )
+ throw (uno::RuntimeException)
{
- bool bRet = false;
+ double rate = 0.0;
- if( mpPlayer && (mnInitFail < 3) )
+ // TODO get the window rate
+ if( mbInitialized )
{
- GstState aState = GST_STATE_NULL;
-
- if( gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS )
- {
- bRet = ( GST_STATE_PAUSED == aState ) || ( GST_STATE_PLAYING == aState );
-
- if( !bRet )
- {
- gst_element_set_state( mpPlayer, GST_STATE_PAUSED );
- bRet = ( gst_element_get_state( mpPlayer, &aState, NULL,
- GST_MAX_TIMEOUT ) == GST_STATE_CHANGE_SUCCESS ) &&
- ( GST_STATE_PAUSED == aState );
- }
- }
- if( ! bRet )
- mnInitFail++;
}
- return( bRet );
+ return rate;
}
// ------------------------------------------------------------------------------
-gboolean Player::implBusPrepare( GSource* pSource,
- gint* pTimeout )
-{
- if( pTimeout )
- {
- *pTimeout = 0;
- }
- return( implBusCheck( pSource ) );
+void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet )
+ throw (uno::RuntimeException)
+{
+ // TODO check how to do with GST
+ mbLooping = bSet;
}
// ------------------------------------------------------------------------------
-gboolean Player::implBusCheck( GSource* pSource )
-{
- GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
- return( pBusSource &&
- GST_IS_BUS( pBusSource->mpBus ) &&
- gst_bus_have_pending( GST_BUS_CAST( pBusSource->mpBus ) ) );
+sal_Bool SAL_CALL Player::isPlaybackLoop( )
+ throw (uno::RuntimeException)
+{
+ // TODO check how to do with GST
+ return mbLooping;
}
// ------------------------------------------------------------------------------
-gboolean Player::implBusDispatch( GSource* pSource,
- GSourceFunc /*aCallback*/,
- gpointer pData )
+
+void SAL_CALL Player::setMute( sal_Bool bSet )
+ throw (uno::RuntimeException)
{
- GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
- gboolean bRet = false;
+ DBG( "set mute: %d muted: %d unmuted volume: %lf", bSet, mbMuted, mnUnmutedVolume );
- if( pData && pBusSource && GST_IS_BUS( pBusSource->mpBus ) )
+ // change the volume to 0 or the unmuted volume
+ if( mpPlaybin && mbMuted != bSet )
{
- GstMessage* pMsg = gst_bus_pop( pBusSource->mpBus );
-
- if( pMsg )
+ double nVolume = mnUnmutedVolume;
+ if( bSet )
{
- bRet = static_cast< Player* >( pData )->busCallback( pBusSource->mpBus, pMsg );
- gst_message_unref( pMsg );
+ nVolume = 0.0;
}
- }
-
- return( bRet );
-}
-// ------------------------------------------------------------------------------
-void Player::implBusFinalize( GSource* pSource )
-{
- GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
+ g_object_set( G_OBJECT( mpPlaybin ), "volume", nVolume, NULL );
- if( pBusSource && pBusSource->mpBus )
- {
- gst_object_unref( pBusSource->mpBus );
- pBusSource->mpBus = NULL;
+ mbMuted = bSet;
}
}
// ------------------------------------------------------------------------------
-gboolean Player::busCallback( GstBus* /*pBus*/,
- GstMessage* pMsg )
-{
- if( pMsg && mpLoop )
- {
- switch( GST_MESSAGE_TYPE( pMsg ) )
- {
- case ( GST_MESSAGE_EOS ):
- {
- if( g_atomic_int_get( &mnLooping ) > 0 )
- {
- setMediaTime( 0.0 );
- start();
- }
- else
- {
- stop();
- }
- }
- break;
-
- case ( GST_MESSAGE_ERROR ):
- {
- gchar* pDebug;
- GError* pErr;
-
- gst_message_parse_error( pMsg, &pErr, &pDebug );
- fprintf( stderr, "Error: %s\n", pErr->message );
-
- g_free( pDebug );
- g_error_free( pErr );
- }
- break;
- default:
- {
- break;
- }
- }
- }
-
- return( true );
-}
-
-// ------------------------------------------------------------------------------
-gboolean Player::implIdleFunc( gpointer pData )
+sal_Bool SAL_CALL Player::isMute( )
+ throw (uno::RuntimeException)
{
- return( pData ? static_cast< Player* >( pData )->idle() : true );
+ return mbMuted;
}
// ------------------------------------------------------------------------------
-gpointer Player::implThreadFunc( gpointer pData )
-{
- return( pData ? static_cast< Player* >( pData )->run() : NULL );
-}
-// ------------------------------------------------------------------------------
-GstBusSyncReply Player::implHandleCreateWindowFunc( GstBus* pBus,
- GstMessage* pMsg,
- gpointer pData )
+void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB )
+ throw (uno::RuntimeException)
{
- return( pData ? static_cast< Player* >( pData )->handleCreateWindow( pBus, pMsg ) : GST_BUS_PASS );
-}
+ mnUnmutedVolume = pow( 10.0, nVolumeDB / 20.0 );
-// ------------------------------------------------------------------------------
-void Player::implHandleNewElementFunc( GstBin* /* pBin */,
- GstElement* pElement,
- gpointer pData )
-{
- if( pElement )
- {
-#ifdef DEBUG
- gchar* pElementName = gst_element_get_name( pElement );
+ DBG( "set volume: %d gst volume: %lf", nVolumeDB, mnUnmutedVolume );
- if( pElementName )
- {
- OSL_TRACE( ">>> Bin has element: %s", pElementName );
- g_free( pElementName );
- }
-#endif
-
- if( GST_IS_BIN( pElement ) )
- {
- // set this handler in case we have a GstBin element
- g_signal_connect( GST_BIN( pElement ), "element-added",
- G_CALLBACK( Player::implHandleNewElementFunc ), pData );
- }
-
- // watch for all pads that are going to be added to this element;
- g_signal_connect( pElement, "pad-added",
- G_CALLBACK( Player::implHandleNewPadFunc ), pData );
- }
+ // change volume
+ if( !mbMuted && mpPlaybin )
+ {
+ g_object_set( G_OBJECT( mpPlaybin ), "volume", (gdouble) mnUnmutedVolume, NULL );
+ }
}
// ------------------------------------------------------------------------------
-void Player::implHandleNewPadFunc( GstElement* pElement,
- GstPad* pPad,
- gpointer pData )
+
+sal_Int16 SAL_CALL Player::getVolumeDB( )
+ throw (uno::RuntimeException)
{
- Player* pPlayer = static_cast< Player* >( pData );
+ sal_Int16 nVolumeDB(0);
- if( pPlayer && pElement && pPad )
- {
-#ifdef DEBUG
- gchar* pElementName = gst_element_get_name( pElement );
- gchar* pPadName = gst_pad_get_name( pPad );
+ if( mpPlaybin ) {
+ double nGstVolume = 0.0;
- OSL_TRACE( ">>> Element %s has pad: %s", pElementName, pPadName );
+ g_object_get( G_OBJECT( mpPlaybin ), "volume", &nGstVolume, NULL );
- g_free( pPadName );
- g_free( pElementName );
-#endif
+ nVolumeDB = (sal_Int16) ( 20.0*log10 ( nGstVolume ) );
+ }
- GstCaps* pCaps = gst_pad_get_caps( pPad );
+ return nVolumeDB;
+}
- // we are interested only in getting video properties
- // width and height or if we have a video source at all
- if( pCaps )
- {
- for( gint i = 0, nSize = gst_caps_get_size( pCaps ); i < nSize; ++i )
- {
- const GstStructure* pStruct = gst_caps_get_structure( pCaps, i );
+// ------------------------------------------------------------------------------
- if( pStruct )
- {
- const gchar* pStructName = gst_structure_get_name( pStruct );
+awt::Size SAL_CALL Player::getPreferredPlayerWindowSize( )
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize( 0, 0 );
-#ifdef DEBUG
- OSL_TRACE( "\t>>> Pad has structure: %s", pStructName );
+ DBG( "%p Player::getPreferredPlayerWindowSize, member %d x %d", this, mnWidth, mnHeight );
- for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n )
- {
- OSL_TRACE( "\t\t>>> Structure has field: %s", gst_structure_nth_field_name( pStruct, n ) );
- }
+ TimeValue aTimeout = { 10, 0 };
+#if DEBUG
+ oslConditionResult aResult =
#endif
+ osl_waitCondition( maSizeCondition, &aTimeout );
- // just look for structures having 'video' in their names
- if( ::std::string( pStructName ).find( "video" ) != ::std::string::npos )
- {
- g_atomic_int_inc( &pPlayer->mnIsVideoSource );
-
- for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n )
- {
- const gchar* pFieldName = gst_structure_nth_field_name( pStruct, n );
- gint nValue;
-
- if( ( ::std::string( pFieldName ).find( "width" ) != ::std::string::npos ) &&
- gst_structure_get_int( pStruct, pFieldName, &nValue ) )
- {
- const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoWidth );
- g_atomic_int_add( &pPlayer->mnVideoWidth, ::std::max( nDiff, 0 ) );
- }
- else if( ( ::std::string( pFieldName ).find( "height" ) != ::std::string::npos ) &&
- gst_structure_get_int( pStruct, pFieldName, &nValue ) )
- {
- const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoHeight );
- g_atomic_int_add( &pPlayer->mnVideoHeight, ::std::max( nDiff, 0 ) );
- }
- }
- }
- }
- }
+ if( mbFakeVideo ) {
+ mbFakeVideo = sal_False;
- gst_caps_unref( pCaps );
- }
+ g_object_set( G_OBJECT( mpPlaybin ), "video-sink", NULL, NULL );
+ gst_element_set_state( mpPlaybin, GST_STATE_READY );
+ gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
}
-}
-// ------------------------------------------------------------------------------
-gboolean Player::idle()
-{
- // test if main loop should quit and set flag mnQuit to 1
- bool bQuit = g_atomic_int_compare_and_exchange( &mnQuit, 1, 1 );
+ DBG( "%p Player::getPreferredPlayerWindowSize after waitCondition %d, member %d x %d", this, aResult, mnWidth, mnHeight );
- if( bQuit )
- {
- // set mnQuit back to 0 to avoid mutiple g_main_loop_quit calls
- // in case Player::idle() is called again later;
- // the flag should have been set only once within Ctor called from
- // the application thread
- g_atomic_int_dec_and_test( &mnQuit );
- g_main_loop_quit( mpLoop );
+ if( mnWidth != 0 && mnHeight != 0 ) {
+ aSize.Width = mnWidth;
+ aSize.Height = mnHeight;
}
- // don't eat up all cpu time
- usleep( 1000 );
-
- return( true );
+ return aSize;
}
// ------------------------------------------------------------------------------
-gpointer Player::run()
+
+uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments )
+ throw (uno::RuntimeException)
{
- static GSourceFuncs aSourceFuncs =
- {
- Player::implBusPrepare,
- Player::implBusCheck,
- Player::implBusDispatch,
- Player::implBusFinalize,
- NULL,
- NULL
- };
-
- if( NULL != ( mpPlayer = gst_element_factory_make( "playbin", NULL ) ) )
- {
- // initialization
- // no mutex necessary since initialization
- // is synchronous until loop is started
- mpContext = g_main_context_new();
- mpLoop = g_main_loop_new( mpContext, false );
-
- // add idle callback
- GSource* pIdleSource = g_idle_source_new();
- g_source_set_callback( pIdleSource, Player::implIdleFunc, this, NULL );
- g_source_attach( pIdleSource, mpContext );
-
- // add bus callback
- GSource* pBusSource = g_source_new( &aSourceFuncs, sizeof( GstBusSource ) );
- static_cast< GstBusSource* >( pBusSource )->mpBus = gst_pipeline_get_bus( GST_PIPELINE( mpPlayer ) );
- g_source_set_callback( pBusSource, NULL, this, NULL );
- g_source_attach( pBusSource, mpContext );
-
- // add bus sync handler to intercept video window creation for setting our own window
- gst_bus_set_sync_handler( static_cast< GstBusSource* >( pBusSource )->mpBus,
- Player::implHandleCreateWindowFunc, this );
-
- // watch for all elements (and pads) that will be added to the playbin,
- // in order to retrieve properties like video width and height
- g_signal_connect( GST_BIN( mpPlayer ), "element-added",
- G_CALLBACK( Player::implHandleNewElementFunc ), this );
-
- // set source URI for player
- g_object_set( mpPlayer, "uri", mpURI->str, NULL );
-
- // set video fake sink first, since we only create a player without window here
- // and don't want to have the gstreamer default window appearing
- g_object_set( mpPlayer, "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL );
-
- // set state of player to READY or destroy object in case of FAILURE
- if( gst_element_set_state( mpPlayer, GST_STATE_READY ) == GST_STATE_CHANGE_FAILURE )
- {
- gst_object_unref( mpPlayer );
- mpPlayer = NULL;
- }
+ uno::Reference< ::media::XPlayerWindow > xRet;
+ awt::Size aSize( getPreferredPlayerWindowSize() );
- g_atomic_int_add( &mnInitialized, 1 );
- g_cond_signal( mpCond );
+ DBG( "Player::createPlayerWindow %d %d length: %d", aSize.Width, aSize.Height, rArguments.getLength() );
- // run the main loop
- g_main_loop_run( mpLoop );
+ if( aSize.Width > 0 && aSize.Height > 0 )
+ {
+ ::avmedia::gstreamer::Window* pWindow = new ::avmedia::gstreamer::Window( mxMgr, *this );
- // clenanup
- // no mutex necessary since other thread joined us (this thread)
- // after setting the quit flag
- if( mpPlayer )
- {
- gst_element_set_state( mpPlayer, GST_STATE_NULL );
- gst_object_unref( mpPlayer );
- mpPlayer = NULL;
- }
+ xRet = pWindow;
- g_main_loop_unref( mpLoop );
- mpLoop = NULL;
+ if( rArguments.getLength() > 2 ) {
+ rArguments[ 2 ] >>= mnWindowID;
+ DBG( "window ID: %ld", mnWindowID );
+ }
+ }
- g_source_destroy( pBusSource );
- g_source_unref( pBusSource );
+ return xRet;
+}
- g_source_destroy( pIdleSource );
- g_source_unref( pIdleSource );
+// ------------------------------------------------------------------------------
- g_main_context_unref( mpContext );
- mpContext = NULL;
- }
- else
- {
- g_atomic_int_add( &mnInitialized, 1 );
- g_cond_signal( mpCond );
- }
+uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber( )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< media::XFrameGrabber > xRet;
- return( NULL );
+ return xRet;
}
// ------------------------------------------------------------------------------
-GstBusSyncReply Player::handleCreateWindow( GstBus* /* pBus */,
- GstMessage* pMsg )
+
+::rtl::OUString SAL_CALL Player::getImplementationName( )
+ throw (uno::RuntimeException)
{
- GstBusSyncReply eRet = GST_BUS_PASS;
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_PLAYER_IMPLEMENTATIONNAME ) );
+}
- if( pMsg &&
- ( GST_MESSAGE_TYPE( pMsg ) == GST_MESSAGE_ELEMENT ) &&
- gst_structure_has_name( pMsg->structure, "prepare-xwindow-id" ) &&
- g_atomic_pointer_get( &mpPlayerWindow ) )
- {
- OSL_TRACE( ">>> Got Request to create XOverlay" );
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL Player::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_PLAYER_SERVICENAME ) );
+}
- gst_x_overlay_set_xwindow_id( GST_X_OVERLAY( GST_MESSAGE_SRC( pMsg ) ),
- static_cast< Window* >( g_atomic_pointer_get(
- &mpPlayerWindow ) )->getXWindowHandle() );
+// ------------------------------------------------------------------------------
- gst_message_unref( pMsg );
- eRet = GST_BUS_DROP;
- }
+uno::Sequence< ::rtl::OUString > SAL_CALL Player::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_PLAYER_SERVICENAME ) );
- return( eRet );
+ return aRet;
}
-} // namespace gst
+
+} // namespace gstreamer
} // namespace avmedia
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx
index 5c80cb4e1d..02839dc9b2 100644
--- a/avmedia/source/gstreamer/gstplayer.hxx
+++ b/avmedia/source/gstreamer/gstplayer.hxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -25,212 +26,89 @@
*
************************************************************************/
-#ifndef _GSTPLAYER_HXX
-#define _GSTPLAYER_HXX
+#ifndef _PLAYER_HXX
+#define _PLAYER_HXX
+#include <osl/conditn.h>
#include "gstcommon.hxx"
-#include <glib.h>
-#include <glib/gatomic.h>
-
-// necessary for mixed environments with GStreamer-0.10 and GLib versions < 2.8
-#ifndef G_GNUC_NULL_TERMINATED
-#if __GNUC__ >= 4
-#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
-#else
-#define G_GNUC_NULL_TERMINATED
-#endif
-#endif
-
-struct _GOptionGroup;
-typedef struct _GOptionGroup GOptionGroup;
-
-#include <gst/gst.h>
+
#include "com/sun/star/media/XPlayer.hdl"
-namespace avmedia
-{
-namespace gst
-{
-class Window;
+typedef struct _GstXOverlay GstXOverlay;
+
+namespace avmedia { namespace gstreamer {
-// ---------------
-// - Player_Impl -
-// ---------------
+// ----------
+// - Player -
+// ----------
-class Player : public ::cppu::WeakImplHelper3< ::com::sun::star::media::XPlayer,
- ::com::sun::star::lang::XComponent,
+class Player : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayer,
::com::sun::star::lang::XServiceInfo >
{
public:
- // static create method instead of public Ctor
- static Player* create( const ::rtl::OUString& rURL );
-
+ Player( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr );
~Player();
- // XPlayer
- virtual void SAL_CALL start()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL stop()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isPlaying()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual double SAL_CALL getDuration()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setMediaTime( double fTime )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual double SAL_CALL getMediaTime()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setStopTime( double fTime )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual double SAL_CALL getStopTime()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setRate( double fRate )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual double SAL_CALL getRate()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isPlaybackLoop()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setMute( sal_Bool bSet )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isMute()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int16 SAL_CALL getVolumeDB()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > SAL_CALL createPlayerWindow(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber()
- throw( ::com::sun::star::uno::RuntimeException );
-
- // XComponent
- virtual void SAL_CALL dispose()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
+ void preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo );
+ bool create( const ::rtl::OUString& rURL );
+ void processMessage( GstMessage *message );
+ GstBusSyncReply processSyncMessage( GstMessage *message );
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
- throw( ::com::sun::star::uno::RuntimeException );
+ // XPlayer
+ virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stop( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isPlaying( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getDuration( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMediaTime( double fTime ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getMediaTime( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setStopTime( double fTime ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getStopTime( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRate( double fRate ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getRate( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isPlaybackLoop( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMute( sal_Bool bSet ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isMute( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getVolumeDB( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getPreferredPlayerWindowSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > SAL_CALL createPlayerWindow( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::media::XFrameGrabber > SAL_CALL createFrameGrabber( ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw( ::com::sun::star::uno::RuntimeException );
-
-
-protected:
-
- Player( GString* pURI = NULL );
-
- virtual gboolean busCallback( GstBus* pBus,
- GstMessage* pMsg );
-
- virtual gboolean idle();
-
- virtual gpointer run();
-
- virtual GstBusSyncReply handleCreateWindow( GstBus* pBus,
- GstMessage* pMsg );
-
- void implQuitThread();
-
- bool implInitPlayer();
-
- bool implIsInitialized() const
- {
- return( g_atomic_int_get( &mnInitialized ) > 0 );
- }
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+private:
-private:
-
- Player( const Player& );
-
- Player& operator=( const Player& );
-
- static gboolean implBusPrepare( GSource* pSource,
- gint* pTimeout );
-
- static gboolean implBusCheck( GSource* pSource );
-
- static gboolean implBusDispatch( GSource* pSource,
- GSourceFunc aCallback,
- gpointer pData );
-
- static void implBusFinalize( GSource* pSource );
-
- static gboolean implIdleFunc( gpointer pData );
-
- static gpointer implThreadFunc( gpointer pData );
-
- static GstBusSyncReply implHandleCreateWindowFunc( GstBus* pBus,
- GstMessage* pMsg,
- gpointer pDData );
-
- static void implHandleNewElementFunc( GstBin* pBin,
- GstElement* pElement,
- gpointer pData );
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
- static void implHandleNewPadFunc( GstElement* pElem,
- GstPad* pPad,
- gpointer pData );
+ ::rtl::OUString maURL;
-protected:
+ // Add elements and pipeline here
+ GstElement* mpPlaybin; // the playbin is also a pipeline
+ sal_Bool mbFakeVideo;
- GMutex* mpMutex;
- GCond* mpCond;
- GThread* mpThread;
- GMainContext* mpContext;
- GMainLoop* mpLoop;
- GstElement* mpPlayer;
- GString* mpURI;
+ gdouble mnUnmutedVolume;
+ sal_Bool mbPlayPending;
+ sal_Bool mbMuted;
+ sal_Bool mbLooping;
+ sal_Bool mbInitialized;
-private:
+ long mnWindowID;
+ GstXOverlay* mpXOverlay;
+ gint64 mnDuration;
+ int mnWidth;
+ int mnHeight;
- ::avmedia::gst::Window* mpPlayerWindow;
- gint mnIsVideoSource;
- gint mnVideoWidth;
- gint mnVideoHeight;
- gint mnInitialized;
- gint mnVolumeDB;
- gint mnLooping;
- gint mnQuit;
- gint mnVideoWindowSet;
- gint mnInitFail;
+ oslCondition maSizeCondition;
};
-} // namespace gst
+
+} // namespace gstreamer
} // namespace avmedia
-#endif // _GSTPLAYER_HXX
+#endif // _PLAYER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx
index 8470d8cb6c..4ce3fdf6d2 100644
--- a/avmedia/source/gstreamer/gstuno.cxx
+++ b/avmedia/source/gstreamer/gstuno.cxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -25,7 +26,6 @@
*
************************************************************************/
-#include "gstcommon.hxx"
#include "gstmanager.hxx"
using namespace ::com::sun::star;
@@ -36,34 +36,61 @@ using namespace ::com::sun::star;
static uno::Reference< uno::XInterface > SAL_CALL create_MediaPlayer( const uno::Reference< lang::XMultiServiceFactory >& rxFact )
{
- return uno::Reference< uno::XInterface >( *new ::avmedia::gst::Manager( rxFact ) );
+ return uno::Reference< uno::XInterface >( *new ::avmedia::gstreamer::Manager( rxFact ) );
}
// ------------------------------------------
// - component_getImplementationEnvironment -
// ------------------------------------------
-extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
{
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
+// -----------------------
+// - component_writeInfo -
+// -----------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ uno::Reference< registry::XRegistryKey > xNewKey1(
+ static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/com.sun.star.comp.media.Manager_GStreamer/UNO/SERVICES/com.sun.star.media.Manager_GStreamer" )) ) );
+
+ bRet = sal_True;
+ }
+ catch( registry::InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
// ------------------------
// - component_getFactory -
// ------------------------
-extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
{
uno::Reference< lang::XSingleServiceFactory > xFactory;
void* pRet = 0;
- if( rtl_str_compare( pImplName, AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) == 0 )
+ if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_GStreamer" ) == 0 )
{
- const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) );
+ const ::rtl::OUString aServiceName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.media.Manager_GStreamer" )) );
xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
- ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.media.Manager_GStreamer" )),
create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
}
@@ -75,3 +102,5 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void*
return pRet;
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx
index 12606ad5e8..4e0f6f3c3d 100644
--- a/avmedia/source/gstreamer/gstwindow.cxx
+++ b/avmedia/source/gstreamer/gstwindow.cxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -25,414 +26,189 @@
*
************************************************************************/
-#include <tools/prex.h>
-#include <tools/postx.h>
-
#include <com/sun/star/awt/SystemPointer.hdl>
#include "gstwindow.hxx"
#include "gstplayer.hxx"
-#include <vcl/syschild.hxx>
-#include <vcl/sysdata.hxx>
-
-using namespace ::com::sun::star;
-
-namespace avmedia
-{
-namespace gst
-{
-// ---------------------
-// - PlayerChildWindow -
-// ---------------------
-
-class PlayerChildWindow : public SystemChildWindow
-{
-public:
-
- PlayerChildWindow( Window* pParent );
- ~PlayerChildWindow();
-
-protected:
-
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseButtonUp( const MouseEvent& rMEvt );
- virtual void KeyInput( const KeyEvent& rKEvt );
- virtual void KeyUp( const KeyEvent& rKEvt );
- virtual void Command( const CommandEvent& rCEvt );
-};
-
-// ---------------------------------------------------------------------
-PlayerChildWindow::PlayerChildWindow( Window* pParent ) :
- SystemChildWindow( pParent, WB_CLIPCHILDREN )
-{
-}
-
-// ---------------------------------------------------------------------
-
-PlayerChildWindow::~PlayerChildWindow()
-{
-}
-
-// ---------------------------------------------------------------------
-
-void PlayerChildWindow::MouseMove( const MouseEvent& rMEvt )
-{
- const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
- rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
- SystemChildWindow::MouseMove( rMEvt );
- GetParent()->MouseMove( aTransformedEvent );
-}
+#define AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer"
+#define AVMEDIA_GST_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer"
-// ---------------------------------------------------------------------
-
-void PlayerChildWindow::MouseButtonDown( const MouseEvent& rMEvt )
-{
- const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
- rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
- SystemChildWindow::MouseButtonDown( rMEvt );
- GetParent()->MouseButtonDown( aTransformedEvent );
-}
-
-// ---------------------------------------------------------------------
-
-void PlayerChildWindow::MouseButtonUp( const MouseEvent& rMEvt )
-{
- const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
- rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
- SystemChildWindow::MouseButtonUp( rMEvt );
- GetParent()->MouseButtonUp( aTransformedEvent );
-}
-
-// ---------------------------------------------------------------------
+using namespace ::com::sun::star;
-void PlayerChildWindow::KeyInput( const KeyEvent& rKEvt )
-{
- SystemChildWindow::KeyInput( rKEvt );
- GetParent()->KeyInput( rKEvt );
-}
+namespace avmedia { namespace gstreamer {
-// ---------------------------------------------------------------------
+// -----------
+// - statics -
+// -----------
-void PlayerChildWindow::KeyUp( const KeyEvent& rKEvt )
+static ::osl::Mutex& ImplGetOwnStaticMutex()
{
- SystemChildWindow::KeyUp( rKEvt );
- GetParent()->KeyUp( rKEvt );
-}
+ static ::osl::Mutex* pMutex = NULL;
-// ---------------------------------------------------------------------
+ if( pMutex == NULL )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-void PlayerChildWindow::Command( const CommandEvent& rCEvt )
-{
- const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
- rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
+ if( pMutex == NULL )
+ {
+ static ::osl::Mutex aMutex;
+ pMutex = &aMutex;
+ }
+ }
- SystemChildWindow::Command( rCEvt );
- GetParent()->Command( aTransformedEvent );
+ return *pMutex;
}
// ---------------
// - Window -
// ---------------
-Window::Window( ::avmedia::gst::Player& rPlayer ) :
+
+// ------------------------------------------------------------------------------
+
+Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) :
+ mxMgr( rxMgr ),
maListeners( maMutex ),
- maWindowRect( 0, 0, 0, 0 ),
- mrPlayer( rPlayer ),
- mpPlayerWindow( NULL ),
meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ),
+ mrPlayer( rPlayer ),
mnPointerType( awt::SystemPointer::ARROW )
-{}
+{
+ ::osl::MutexGuard aGuard( ImplGetOwnStaticMutex() );
+
+}
// ------------------------------------------------------------------------------
Window::~Window()
{
- dispose();
}
+// XPlayerWindow
// ------------------------------------------------------------------------------
-void Window::implLayoutVideoWindow()
+void SAL_CALL Window::update( )
+ throw (uno::RuntimeException)
{
- if( mpPlayerWindow && ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) )
- {
- awt::Size aPrefSize( mrPlayer.getPreferredPlayerWindowSize() );
- awt::Rectangle aRect = getPosSize();
- int nW = aRect.Width, nH = aRect.Height;
- int nVideoW = nW, nVideoH = nH;
- int nX = 0, nY = 0, nWidth = 0, nHeight = 0;
- bool bDone = false, bZoom = false;
-
- if( media::ZoomLevel_ORIGINAL == meZoomLevel )
- {
- bZoom = true;
- }
- else if( media::ZoomLevel_ZOOM_1_TO_4 == meZoomLevel )
- {
- aPrefSize.Width >>= 2;
- aPrefSize.Height >>= 2;
- bZoom = true;
- }
- else if( media::ZoomLevel_ZOOM_1_TO_2 == meZoomLevel )
- {
- aPrefSize.Width >>= 1;
- aPrefSize.Height >>= 1;
- bZoom = true;
- }
- else if( media::ZoomLevel_ZOOM_2_TO_1 == meZoomLevel )
- {
- aPrefSize.Width <<= 1;
- aPrefSize.Height <<= 1;
- bZoom = true;
- }
- else if( media::ZoomLevel_ZOOM_4_TO_1 == meZoomLevel )
- {
- aPrefSize.Width <<= 2;
- aPrefSize.Height <<= 2;
- bZoom = true;
- }
- else if( media::ZoomLevel_FIT_TO_WINDOW == meZoomLevel )
- {
- nWidth = nVideoW;
- nHeight = nVideoH;
- bDone = true;
- }
-
- if( bZoom )
- {
- if( ( aPrefSize.Width <= nVideoW ) && ( aPrefSize.Height <= nVideoH ) )
- {
- nX = ( nVideoW - aPrefSize.Width ) >> 1;
- nY = ( nVideoH - aPrefSize.Height ) >> 1;
- nWidth = aPrefSize.Width;
- nHeight = aPrefSize.Height;
- bDone = true;
- }
- }
-
- if( !bDone )
- {
- if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) && ( nVideoW > 0 ) && ( nVideoH > 0 ) )
- {
- double fPrefWH = (double) aPrefSize.Width / aPrefSize.Height;
-
- if( fPrefWH < ( (double) nVideoW / nVideoH ) )
- {
- nVideoW = (int) ( nVideoH * fPrefWH );
- }
- else
- {
- nVideoH = (int) ( nVideoW / fPrefWH );
- }
-
- nX = ( nW - nVideoW ) >> 1;
- nY = ( nH - nVideoH ) >> 1;
- nWidth = nVideoW;
- nHeight = nVideoH;
- }
- else
- {
- nX = nY = nWidth = nHeight = 0;
- }
- }
-
- mpPlayerWindow->SetPosSizePixel( Point( nX, nY ), Size( nWidth, nHeight ) );
- }
+ //::RedrawWindow( (HWND) mnFrameWnd, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE );
}
// ------------------------------------------------------------------------------
-bool Window::create( const uno::Sequence< uno::Any >& rArguments )
+sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
+ throw (uno::RuntimeException)
{
- OSL_ASSERT( !mpPlayerWindow );
- OSL_ENSURE( rArguments.getLength() > 2,
-"::avmedia::gst::Windiow::create: GStreamer backend needs \
-valid parent SystemChildWindow pointer (sal_IntPtr) as third Any \
-value in sequence of arguments" );
-
- bool bRet = false;
+ sal_Bool bRet = false;
- if( !mpPlayerWindow && ( rArguments.getLength() > 2 ) )
- {
- SystemChildWindow* pParentWindow = NULL;
- sal_IntPtr pIntPtr = 0;
-
- // we are not interested in the first argument, which is a pure X11 window handle;
- // this backend relies on a SystemChildWindow as parent for the PlayerWindow, given
- // as third Sal_IntPtr value within the argument Sequence
- rArguments[ 1 ] >>= maWindowRect;
-
- rArguments[ 2 ] >>= pIntPtr;
- pParentWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
-
- if( pParentWindow )
+ if( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel &&
+ media::ZoomLevel_NOT_AVAILABLE != eZoomLevel )
{
- meZoomLevel = media::ZoomLevel_ORIGINAL;
-
- mpPlayerWindow = new PlayerChildWindow( pParentWindow );
- mpPlayerWindow->SetBackground( Color( COL_BLACK ) );
- mpPlayerWindow->SetPosSizePixel( Point( maWindowRect.X, maWindowRect.Y ),
- Size( maWindowRect.Width, maWindowRect.Height ) );
- mpPlayerWindow->Show();
+ if( eZoomLevel != meZoomLevel )
+ {
+ meZoomLevel = eZoomLevel;
+ //ImplLayoutVideoWindow();
+ }
bRet = true;
}
- }
- return( bRet );
+ return bRet;
}
// ------------------------------------------------------------------------------
-void SAL_CALL Window::update()
- throw( uno::RuntimeException )
+media::ZoomLevel SAL_CALL Window::getZoomLevel( )
+ throw (uno::RuntimeException)
{
- if( mpPlayerWindow )
- {
- mpPlayerWindow->Invalidate( INVALIDATE_UPDATE );
- mpPlayerWindow->Sync();
- }
+ return meZoomLevel;
}
// ------------------------------------------------------------------------------
-sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel )
- throw(uno::RuntimeException)
+void SAL_CALL Window::setPointerType( sal_Int32 nPointerType )
+ throw (uno::RuntimeException)
{
- bool bRet = false;
-
- if( ( media::ZoomLevel_NOT_AVAILABLE != meZoomLevel ) &&
- ( media::ZoomLevel_NOT_AVAILABLE != eZoomLevel ) )
- {
- if( eZoomLevel != meZoomLevel )
- {
- meZoomLevel = eZoomLevel;
- implLayoutVideoWindow();
- }
-
- bRet = true;
- }
-
- return( bRet );
+ mnPointerType = nPointerType;
}
+// XWindow
// ------------------------------------------------------------------------------
-media::ZoomLevel SAL_CALL Window::getZoomLevel()
- throw( uno::RuntimeException )
+void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /*Width*/, sal_Int32 /*Height*/, sal_Int16 /*Flags*/ )
+ throw (uno::RuntimeException)
{
- return( meZoomLevel );
+// if( mnFrameWnd )
+// {
+// ::SetWindowPos( (HWND) mnFrameWnd, HWND_TOP, X, Y, Width, Height, 0 );
+// ImplLayoutVideoWindow();
+// }
}
// ------------------------------------------------------------------------------
-void SAL_CALL Window::setPointerType( sal_Int32 nPointerType )
- throw( uno::RuntimeException )
+awt::Rectangle SAL_CALL Window::getPosSize()
+ throw (uno::RuntimeException)
{
- if( mpPlayerWindow )
- {
- Pointer ePointer = POINTER_ARROW;
+ awt::Rectangle aRet;
- switch( nPointerType )
- {
- case (awt::SystemPointer::CROSS) :
- {
- ePointer = POINTER_CROSS;
- }
- break;
+ aRet.X = aRet.Y = 0;
+ aRet.Width = 320;
+ aRet.Height = 240;
- case (awt::SystemPointer::HAND) :
- {
- ePointer = POINTER_HAND;
- }
- break;
+// if( mnFrameWnd )
+// {
+// ::RECT aWndRect;
+// long nX = 0, nY = 0, nWidth = 0, nHeight = 0;
- case (awt::SystemPointer::MOVE) :
- {
- ePointer = POINTER_MOVE;
- }
- break;
-
- case (awt::SystemPointer::WAIT) :
- {
- ePointer = POINTER_WAIT;
- }
- break;
-
- default:
- break;
- }
+// if( ::GetClientRect( (HWND) mnFrameWnd, &aWndRect ) )
+// {
+// aRet.X = aWndRect.left;
+// aRet.Y = aWndRect.top;
+// aRet.Width = aWndRect.right - aWndRect.left + 1;
+// aRet.Height = aWndRect.bottom - aWndRect.top + 1;
+// }
+// }
- mpPlayerWindow->SetPointer( ePointer );
- }
+ return aRet;
}
// ------------------------------------------------------------------------------
-void SAL_CALL Window::setPosSize( sal_Int32 nX,
- sal_Int32 nY,
- sal_Int32 nWidth,
- sal_Int32 nHeight,
- sal_Int16 /* Flags */ )
- throw( uno::RuntimeException )
+void SAL_CALL Window::setVisible( sal_Bool /*bVisible*/ )
+ throw (uno::RuntimeException)
{
- maWindowRect.X = nX;
- maWindowRect.Y = nY;
- maWindowRect.Width = nWidth;
- maWindowRect.Height = nHeight;
-
- implLayoutVideoWindow();
-}
+// if( mnFrameWnd )
+// {
+// IVideoWindow* pVideoWindow = const_cast< IVideoWindow* >( mrPlayer.getVideoWindow() );
-// ------------------------------------------------------------------------------
+// if( pVideoWindow )
+// pVideoWindow->put_Visible( bVisible ? OATRUE : OAFALSE );
-awt::Rectangle SAL_CALL Window::getPosSize()
- throw( uno::RuntimeException )
-{
- return( maWindowRect );
-}
-
-// ------------------------------------------------------------------------------
-
-void SAL_CALL Window::setVisible( sal_Bool bVisible )
- throw( uno::RuntimeException )
-{
- if( mpPlayerWindow )
- {
- bVisible ? mpPlayerWindow->Show() : mpPlayerWindow->Hide();
- }
+// ::ShowWindow( (HWND) mnFrameWnd, bVisible ? SW_SHOW : SW_HIDE );
+// }
}
// ------------------------------------------------------------------------------
-void SAL_CALL Window::setEnable( sal_Bool bEnable )
- throw( uno::RuntimeException )
+void SAL_CALL Window::setEnable( sal_Bool /*bEnable*/ )
+ throw (uno::RuntimeException)
{
- if( mpPlayerWindow )
- {
- mpPlayerWindow->Enable( bEnable );
- }
+// if( mnFrameWnd )
+// ::EnableWindow( (HWND) mnFrameWnd, bEnable );
}
// ------------------------------------------------------------------------------
-void SAL_CALL Window::setFocus()
- throw( uno::RuntimeException )
+void SAL_CALL Window::setFocus( )
+ throw (uno::RuntimeException)
{
- if( mpPlayerWindow )
- {
- mpPlayerWindow->GrabFocus();
- }
+// if( mnFrameWnd )
+// ::SetFocus( (HWND) mnFrameWnd );
}
// ------------------------------------------------------------------------------
void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.addInterface( getCppuType( &xListener ), xListener );
}
@@ -440,7 +216,7 @@ void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListe
// ------------------------------------------------------------------------------
void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.removeInterface( getCppuType( &xListener ), xListener );
}
@@ -448,7 +224,7 @@ void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowLi
// ------------------------------------------------------------------------------
void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.addInterface( getCppuType( &xListener ), xListener );
}
@@ -456,7 +232,7 @@ void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListene
// ------------------------------------------------------------------------------
void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.removeInterface( getCppuType( &xListener ), xListener );
}
@@ -464,7 +240,7 @@ void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusList
// ------------------------------------------------------------------------------
void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.addInterface( getCppuType( &xListener ), xListener );
}
@@ -472,7 +248,7 @@ void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >&
// ------------------------------------------------------------------------------
void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.removeInterface( getCppuType( &xListener ), xListener );
}
@@ -480,7 +256,7 @@ void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener
// ------------------------------------------------------------------------------
void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.addInterface( getCppuType( &xListener ), xListener );
}
@@ -488,7 +264,7 @@ void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListene
// ------------------------------------------------------------------------------
void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.removeInterface( getCppuType( &xListener ), xListener );
}
@@ -496,7 +272,7 @@ void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseList
// ------------------------------------------------------------------------------
void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.addInterface( getCppuType( &xListener ), xListener );
}
@@ -504,7 +280,7 @@ void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseM
// ------------------------------------------------------------------------------
void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.removeInterface( getCppuType( &xListener ), xListener );
}
@@ -512,7 +288,7 @@ void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMou
// ------------------------------------------------------------------------------
void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.addInterface( getCppuType( &xListener ), xListener );
}
@@ -520,149 +296,65 @@ void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListene
// ------------------------------------------------------------------------------
void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.removeInterface( getCppuType( &xListener ), xListener );
}
+
+// XComponent
// ------------------------------------------------------------------------------
-void SAL_CALL Window::dispose()
- throw( uno::RuntimeException )
+void SAL_CALL Window::dispose( )
+ throw (uno::RuntimeException)
{
- delete mpPlayerWindow;
- mpPlayerWindow = NULL;
}
// ------------------------------------------------------------------------------
void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
maListeners.addInterface( getCppuType( &xListener ), xListener );
}
// ------------------------------------------------------------------------------
-void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >&
- xListener )
- throw( uno::RuntimeException )
+void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
{
maListeners.removeInterface( getCppuType( &xListener ), xListener );
}
+// XServiceInfo
// ------------------------------------------------------------------------------
-void Window::fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt )
-{
- ::cppu::OInterfaceContainerHelper* pContainer =
- maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) );
-
- if( pContainer )
- {
- ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
-
- while( aIter.hasMoreElements() )
- {
- uno::Reference< awt::XMouseListener >( aIter.next(),
- uno::UNO_QUERY )->mousePressed( rEvt );
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void Window::fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt )
-{
- ::cppu::OInterfaceContainerHelper* pContainer =
- maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseListener >* ) 0 ) );
-
- if( pContainer )
- {
- ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
-
- while( aIter.hasMoreElements() )
- {
- uno::Reference< awt::XMouseListener >( aIter.next(),
- uno::UNO_QUERY )->mouseReleased( rEvt );
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void Window::fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt )
-{
- ::cppu::OInterfaceContainerHelper* pContainer =
- maListeners.getContainer( getCppuType( ( uno::Reference< awt::XMouseMotionListener >* )
- 0 ) );
-
- if( pContainer )
- {
- ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
-
- while( aIter.hasMoreElements() )
- {
- uno::Reference< awt::XMouseMotionListener >( aIter.next(),
- uno::UNO_QUERY )->mouseMoved( rEvt );
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void Window::fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt )
-{
- ::cppu::OInterfaceContainerHelper* pContainer =
- maListeners.getContainer( getCppuType( ( uno::Reference< awt::XFocusListener >* ) 0 ) );
-
- if( pContainer )
- {
- ::cppu::OInterfaceIteratorHelper aIter( *pContainer );
-
- while( aIter.hasMoreElements() )
- {
- uno::Reference< awt::XFocusListener >( aIter.next(),
- uno::UNO_QUERY )->focusGained( rEvt );
- }
- }
-}
-
-// ------------------------------------------------------------------------------
-
-long Window::getXWindowHandle() const
+::rtl::OUString SAL_CALL Window::getImplementationName( )
+ throw (uno::RuntimeException)
{
- return( mpPlayerWindow ? mpPlayerWindow->GetSystemData()->aWindow : 0 );
-}
-
-
-// ------------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL Window::getImplementationName()
- throw( uno::RuntimeException )
-{
- return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME ) ) );
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME ) );
}
// ------------------------------------------------------------------------------
sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName )
- throw( uno::RuntimeException )
+ throw (uno::RuntimeException)
{
- return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
- AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) ) );
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) );
}
// ------------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames()
- throw( uno::RuntimeException )
+uno::Sequence< ::rtl::OUString > SAL_CALL Window::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
{
- uno::Sequence< ::rtl::OUString > aRet( 1 );
- aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) );
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_GST_WINDOW_SERVICENAME ) );
- return( aRet );
+ return aRet;
}
-} // namespace gst
+
+} // namespace gstreamer
} // namespace avmedia
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx
index 3a55fca9c8..b63e769e3f 100644
--- a/avmedia/source/gstreamer/gstwindow.hxx
+++ b/avmedia/source/gstreamer/gstwindow.hxx
@@ -1,8 +1,9 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * Copyright 2010 Novell, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -25,22 +26,15 @@
*
************************************************************************/
-#ifndef _GSTWINDOW_HXX
-#define _GSTWINDOW_HXX
+#ifndef _WINDOW_HXX
+#define _WINDOW_HXX
#include "gstcommon.hxx"
#include <cppuhelper/interfacecontainer.h>
-#ifndef _COM_SUN_STAR_MEDIA_XPLAYERWINDOW_HDL_
#include "com/sun/star/media/XPlayerWindow.hdl"
-#endif
-namespace avmedia
-{
-namespace gst
-{
-
-class PlayerChildWindow;
+namespace avmedia { namespace gstreamer {
// ---------------
// - Window -
@@ -48,150 +42,71 @@ class PlayerChildWindow;
class Player;
-class Window : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayerWindow,
- ::com::sun::star::lang::XServiceInfo >
+class Window : public ::cppu::WeakImplHelper2 < ::com::sun::star::media::XPlayerWindow,
+ ::com::sun::star::lang::XServiceInfo >
{
- friend class Player;
+public:
-public: Window( ::avmedia::gst::Player& rPlayer );
- ~Window();
+ Window( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMgr,
+ Player& rPlayer );
+ ~Window();
- bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
+ bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments );
+ void processGraphEvent();
+ void updatePointer();
// XPlayerWindow
- virtual void SAL_CALL update()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel )
- throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setPointerType( sal_Int32 nPointerType )
- throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL update( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setZoomLevel( ::com::sun::star::media::ZoomLevel ZoomLevel ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::media::ZoomLevel SAL_CALL getZoomLevel( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPointerType( sal_Int32 nPointerType ) throw (::com::sun::star::uno::RuntimeException);
// XWindow
- virtual void SAL_CALL setPosSize( sal_Int32 X,
- sal_Int32 Y,
- sal_Int32 Width,
- sal_Int32 Height,
- sal_Int16 Flags )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setVisible( sal_Bool Visible )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setEnable( sal_Bool Enable )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setFocus()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addWindowListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeWindowListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addFocusListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeFocusListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addKeyListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeKeyListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addMouseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeMouseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addMouseMotionListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeMouseMotionListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addPaintListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removePaintListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( sal_Bool Visible ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnable( sal_Bool Enable ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
// XComponent
- virtual void SAL_CALL dispose()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener )
- throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw( ::com::sun::star::uno::RuntimeException );
-
-
-public:
-
- void fireMousePressedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
- void fireMouseReleasedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
-
- void fireMouseMovedEvent( const ::com::sun::star::awt::MouseEvent& rEvt );
-
- void fireKeyPressedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
-
- void fireKeyReleasedEvent( const ::com::sun::star::awt::KeyEvent& rEvt );
-
- void fireSetFocusEvent( const ::com::sun::star::awt::FocusEvent& rEvt );
-
-protected:
-
- long getXWindowHandle() const;
private:
- ::osl::Mutex maMutex;
- ::cppu::OMultiTypeInterfaceContainerHelper maListeners;
- ::com::sun::star::awt::Rectangle maWindowRect;
- Player& mrPlayer;
- PlayerChildWindow* mpPlayerWindow;
- ::com::sun::star::media::ZoomLevel meZoomLevel;
- sal_Int32 mnPointerType;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr;
+
+ ::osl::Mutex maMutex;
+ ::cppu::OMultiTypeInterfaceContainerHelper maListeners;
+ ::com::sun::star::media::ZoomLevel meZoomLevel;
+ Player& mrPlayer;
+ int mnPointerType;
- void implLayoutVideoWindow();
+ void ImplLayoutVideoWindow();
};
-} // namespace gst
+
+} // namespace gstreamer
} // namespace avmedia
-#endif // _GSTWINDOW_HXX
+#endif // _WINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk
index 546bc168db..2f52b9cc47 100644
--- a/avmedia/source/gstreamer/makefile.mk
+++ b/avmedia/source/gstreamer/makefile.mk
@@ -1,64 +1,68 @@
#*************************************************************************
#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
+# Copyright 2010 Novell, Inc.
#
-# OpenOffice.org - a multi-platform office productivity suite
+# OpenOffice.org - a multi-platform office productivity suite
#
-# This file is part of OpenOffice.org.
+# This file is part of OpenOffice.org.
#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
#
#*************************************************************************
PRJ=..$/..
-PRJNAME=avmediagst
+PRJNAME=avmedia
TARGET=avmediagst
# --- Settings ----------------------------------
.INCLUDE : settings.mk
+.IF "$(ENABLE_GSTREAMER)" == "TRUE"
+
.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
CDEFS+= -DVERBOSE
.ENDIF
+PKGCONFIG_MODULES=gstreamer-0.10, gstreamer-plugins-base-0.10
+.INCLUDE: pkg_config.mk
+PKGCONFIG_LIBS+=-lgstinterfaces-0.10
+
# --- Files ----------------------------------
-.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" && "$(ENABLE_GSTREAMER)" != ""
+.IF "$(GUI)" == "UNX" || "$(GUI)" == "WNT"
-PKGCONFIG_MODULES=gtk+-2.0 gstreamer-0.10 gstreamer-interfaces-0.10
-.INCLUDE : pkg_config.mk
+.IF "$(GUI)" == "WNT"
+CDEFS+= -DWINNT
+.ENDIF
SLOFILES= \
- $(SLO)$/gstuno.obj \
- $(SLO)$/gstmanager.obj \
- $(SLO)$/gstwindow.obj \
- $(SLO)$/gstplayer.obj \
- $(SLO)$/gstframegrabber.obj
+ $(SLO)$/gstuno.obj \
+ $(SLO)$/gstmanager.obj \
+ $(SLO)$/gstplayer.obj \
+ $(SLO)$/gstwindow.obj
+
EXCEPTIONSFILES= \
- $(SLO)$/gstuno.obj \
- $(SLO)$/gstplayer.obj \
- $(SLO)$/gstframegrabber.obj
+ $(SLO)$/gstuno.obj \
SHL1TARGET=$(TARGET)
-SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(TOOLSLIB) $(VCLLIB)
-SHL1STDLIBS+=$(PKGCONFIG_LIBS)
+SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(PKGCONFIG_LIBS) $(TOOLSLIB)
SHL1IMPLIB=i$(TARGET)
SHL1LIBS=$(SLB)$/$(TARGET).lib
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
@@ -68,12 +72,6 @@ DEF1EXPORTFILE=exports.dxp
.ENDIF
-.INCLUDE : target.mk
-
-ALLTAR : $(MISC)/avmediagst.component
+.ENDIF
-$(MISC)/avmediagst.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- avmediagst.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt avmediagst.component
+.INCLUDE : target.mk
diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx
index 47c78f3f13..5110fedf72 100644
--- a/avmedia/source/inc/mediamisc.hxx
+++ b/avmedia/source/inc/mediamisc.hxx
@@ -61,6 +61,7 @@ class ResMgr;
#endif
#endif
#endif
+#endif
namespace avmedia
{
diff --git a/avmedia/source/viewer/makefile.mk b/avmedia/source/viewer/makefile.mk
index af24445c02..7eedc584a5 100644
--- a/avmedia/source/viewer/makefile.mk
+++ b/avmedia/source/viewer/makefile.mk
@@ -42,16 +42,14 @@ SRC1FILES =\
# --- Files -------------------------------------
SLOFILES= \
- $(SLO)$/mediaevent_impl.obj \
- $(SLO)$/mediawindowbase_impl.obj \
- $(SLO)$/mediawindow_impl.obj \
- $(SLO)$/mediawindow.obj
+ $(EXCEPTIONSFILES)
EXCEPTIONSFILES= \
- $(SLO)$/mediawindow.obj \
- $(SLO)$/mediawindowbase_impl.obj \
- $(SLO)$/mediawindow_impl.obj
-
+ $(SLO)$/mediaevent_impl.obj \
+ $(SLO)$/mediawindow.obj \
+ $(SLO)$/mediawindow_impl.obj \
+ $(SLO)$/mediawindowbase_impl.obj \
+
# --- Targets ----------------------------------
.INCLUDE : target.mk
diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx
index ba0e53673e..d603c70875 100644
--- a/avmedia/source/viewer/mediawindow.cxx
+++ b/avmedia/source/viewer/mediawindow.cxx
@@ -371,6 +371,7 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector )
"AU Audio", "au",
"AVI", "avi",
"CD Audio", "cda",
+ "FLAC Audio", "flac",
"Matroska Media", "mkv",
"MIDI Audio", "mid;midi",
"MPEG Audio", "mp2;mp3;mpa",
@@ -384,8 +385,8 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector )
for( i = 0; i < ( sizeof( pFilters ) / sizeof( char* ) ); i += 2 )
{
rFilterNameVector.push_back( ::std::make_pair< ::rtl::OUString, ::rtl::OUString >(
- ::rtl::OUString::createFromAscii( pFilters[ i ] ),
- ::rtl::OUString::createFromAscii( pFilters[ i + 1 ] ) ) );
+ ::rtl::OUString::createFromAscii(pFilters[i]),
+ ::rtl::OUString::createFromAscii(pFilters[i+1]) ) );
}
}
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx
index 9ffdc54bca..fe369d98bd 100644
--- a/avmedia/source/viewer/mediawindow_impl.cxx
+++ b/avmedia/source/viewer/mediawindow_impl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -93,7 +94,11 @@ void MediaWindowControl::execute( const MediaItem& rItem )
// --------------------
MediaChildWindow::MediaChildWindow( Window* pParent ) :
+#ifdef GSTREAMER
SystemChildWindow( pParent, WB_CLIPCHILDREN )
+#else
+ JavaChildWindow( pParent, WB_CLIPCHILDREN )
+#endif
{
}
@@ -109,8 +114,12 @@ void MediaChildWindow::MouseMove( const MouseEvent& rMEvt )
{
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
+
+#ifdef GSTREAMER
SystemChildWindow::MouseMove( rMEvt );
+#else
+ JavaChildWindow::MouseMove( rMEvt );
+#endif
GetParent()->MouseMove( aTransformedEvent );
}
@@ -120,8 +129,12 @@ void MediaChildWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
-
+
+#ifdef GSTREAMER
SystemChildWindow::MouseButtonDown( rMEvt );
+#else
+ JavaChildWindow::MouseButtonDown( rMEvt );
+#endif
GetParent()->MouseButtonDown( aTransformedEvent );
}
@@ -132,7 +145,11 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt )
const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ),
rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() );
+#ifdef GSTREAMER
SystemChildWindow::MouseButtonUp( rMEvt );
+#else
+ JavaChildWindow::MouseButtonUp( rMEvt );
+#endif
GetParent()->MouseButtonUp( aTransformedEvent );
}
@@ -140,7 +157,11 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt )
void MediaChildWindow::KeyInput( const KeyEvent& rKEvt )
{
+#ifdef GSTREAMER
SystemChildWindow::KeyInput( rKEvt );
+#else
+ JavaChildWindow::KeyInput( rKEvt );
+#endif
GetParent()->KeyInput( rKEvt );
}
@@ -148,7 +169,11 @@ void MediaChildWindow::KeyInput( const KeyEvent& rKEvt )
void MediaChildWindow::KeyUp( const KeyEvent& rKEvt )
{
+#ifdef GSTREAMER
SystemChildWindow::KeyUp( rKEvt );
+#else
+ JavaChildWindow::KeyUp( rKEvt );
+#endif
GetParent()->KeyUp( rKEvt );
}
@@ -158,8 +183,12 @@ void MediaChildWindow::Command( const CommandEvent& rCEvt )
{
const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ),
rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
-
+
+#ifdef GSTREAMER
SystemChildWindow::Command( rCEvt );
+#else
+ JavaChildWindow::Command( rCEvt );
+#endif
GetParent()->Command( aTransformedEvent );
}
@@ -211,12 +240,12 @@ void MediaWindowImpl::cleanUp()
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 ) );
-
+
uno::Reference< lang::XComponent > xComponent( xPlayerWindow, uno::UNO_QUERY );
-
+
if( xComponent.is() )
xComponent->dispose();
-
+
setPlayerWindow( NULL );
}
@@ -229,30 +258,38 @@ void MediaWindowImpl::onURLChanged()
{
if( getPlayer().is() )
{
+ uno::Sequence< uno::Any > aArgs( 3 );
uno::Reference< media::XPlayerWindow > xPlayerWindow;
+ const Point aPoint;
+ const Size aSize( maChildWindow.GetSizePixel() );
+#ifndef GSTREAMER
+ const sal_IntPtr nWndHandle = static_cast< sal_IntPtr >( maChildWindow.getParentWindowHandleForJava() );
+#else
+ const sal_Int32 nWndHandle = 0;
+#endif
+
+ aArgs[ 0 ] = uno::makeAny( nWndHandle );
+ aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) );
+#ifdef GSTREAMER
+ const SystemEnvData *pSystemData = maChildWindow.GetSystemData();
+ OSL_TRACE( "MediaWindowImpl::onURLChanged xwindow id: %ld", pSystemData->aWindow );
+ aArgs[ 2 ] = uno::makeAny( pSystemData->aWindow );
+#endif
- const Point aPoint;
- const Size aSize( maChildWindow.GetSizePixel() );
- const sal_IntPtr nWndHandle = (sal_IntPtr) maChildWindow.GetParentWindowHandle( isMediaWindowJavaBased() );
-
try
{
+#ifdef GSTREAMER
+ if( pSystemData->aWindow != 0 )
+#else
if( nWndHandle != 0 )
- {
- uno::Sequence< uno::Any > aArgs( 3 );
-
- aArgs[ 0 ] = uno::makeAny( nWndHandle );
- aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) );
- aArgs[ 2 ] = uno::makeAny( reinterpret_cast< sal_IntPtr >( &maChildWindow ) );
-
+#endif
xPlayerWindow = getPlayer()->createPlayerWindow( aArgs );
- }
}
catch( uno::RuntimeException )
{
// happens eg, on MacOSX where Java frames cannot be created from X11 window handles
}
-
+
setPlayerWindow( xPlayerWindow );
if( xPlayerWindow.is() )
@@ -265,19 +302,21 @@ void MediaWindowImpl::onURLChanged()
}
else
setPlayerWindow( NULL );
-
+
if( getPlayerWindow().is() )
maChildWindow.Show();
else
maChildWindow.Hide();
-
+
if( mpMediaWindowControl )
{
MediaItem aItem;
-
+
updateMediaItem( aItem );
mpMediaWindowControl->setState( aItem );
}
+
+ Invalidate();
}
// ---------------------------------------------------------------------
@@ -399,25 +438,25 @@ void MediaWindowImpl::StateChanged( StateChangedType eType )
void MediaWindowImpl::Paint( const Rectangle& )
{
BitmapEx* pLogo = NULL;
-
+
if( !getPlayer().is() )
{
if( !mpEmptyBmpEx )
mpEmptyBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_EMPTYLOGO ) );
-
+
pLogo = mpEmptyBmpEx;
}
- else if( !getPlayerWindow().is() )
+ else if ( !getPlayerWindow().is() )
{
if( !mpAudioBmpEx )
mpAudioBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) );
-
+
pLogo = mpAudioBmpEx;
}
const Point aBasePos( maChildWindow.GetPosPixel() );
- const Rectangle aVideoRect( aBasePos, maChildWindow.GetSizePixel() );
-
+ const Rectangle aVideoRect( aBasePos, maChildWindow.GetSizePixel() );
+
if( pLogo && !pLogo->IsEmpty() && ( aVideoRect.GetWidth() > 0 ) && ( aVideoRect.GetHeight() > 0 ) )
{
Size aLogoSize( pLogo->GetSizePixel() );
@@ -426,7 +465,7 @@ void MediaWindowImpl::Paint( const Rectangle& )
SetLineColor( aBackgroundColor );
SetFillColor( aBackgroundColor );
DrawRect( aVideoRect );
-
+
if( ( aLogoSize.Width() > aVideoRect.GetWidth() || aLogoSize.Height() > aVideoRect.GetHeight() ) &&
( aLogoSize.Height() > 0 ) )
{
diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx
index 30f98cfef7..13a309e4cd 100644
--- a/avmedia/source/viewer/mediawindow_impl.hxx
+++ b/avmedia/source/viewer/mediawindow_impl.hxx
@@ -3,7 +3,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -30,7 +30,11 @@
#define _AVMEDIA_MEDIAWINDOW_IMPL_HXX
#include <svtools/transfer.hxx>
+#ifdef GSTREAMER
#include <vcl/syschild.hxx>
+#else
+#include <vcl/javachild.hxx>
+#endif
#include "mediawindowbase_impl.hxx"
#include "mediacontrol.hxx"
@@ -44,16 +48,16 @@ namespace avmedia
// ----------------------
// - MediaWindowControl -
// ----------------------
-
+
class MediaWindowControl : public MediaControl
{
public:
-
+
MediaWindowControl( Window* pParent );
~MediaWindowControl();
-
+
protected:
-
+
void update();
void execute( const MediaItem& rItem );
};
@@ -61,16 +65,20 @@ namespace avmedia
// --------------------
// - MediaChildWindow -
// --------------------
-
+
+#ifdef GSTREAMER
class MediaChildWindow : public SystemChildWindow
+#else
+ class MediaChildWindow : public JavaChildWindow
+#endif
{
public:
-
+
MediaChildWindow( Window* pParent );
~MediaChildWindow();
-
+
protected:
-
+
virtual void MouseMove( const MouseEvent& rMEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
@@ -78,7 +86,7 @@ namespace avmedia
virtual void KeyUp( const KeyEvent& rKEvt );
virtual void Command( const CommandEvent& rCEvt );
};
-
+
// ------------------.
// - MediaWindowImpl -
// -------------------
@@ -89,7 +97,7 @@ namespace avmedia
public MediaWindowBaseImpl,
public DropTargetHelper,
public DragSourceHelper
-
+
{
public:
@@ -98,18 +106,18 @@ namespace avmedia
virtual void cleanUp();
virtual void onURLChanged();
-
+
public:
-
+
void update();
void setPosSize( const Rectangle& rRect );
-
+
void setPointer( const Pointer& rPointer );
const Pointer& getPointer() const;
-
+
bool hasInternalMediaControl() const;
-
+
protected:
// Window
diff --git a/avmedia/source/win/makefile.mk b/avmedia/source/win/makefile.mk
index edd28f3521..7c6c9e14da 100644
--- a/avmedia/source/win/makefile.mk
+++ b/avmedia/source/win/makefile.mk
@@ -44,16 +44,15 @@ CDEFS+= -DVERBOSE
.IF "$(GUI)" == "WNT"
SLOFILES= \
- $(SLO)$/winuno.obj \
- $(SLO)$/manager.obj \
- $(SLO)$/window.obj \
- $(SLO)$/player.obj \
- $(SLO)$/framegrabber.obj
-
+ $(SLO)$/winuno.obj \
+ $(SLO)$/manager.obj \
+ $(SLO)$/window.obj \
+ $(SLO)$/player.obj \
+ $(SLO)$/framegrabber.obj
EXCEPTIONSFILES= \
- $(SLO)$/winuno.obj \
- $(SLO)$/framegrabber.obj
+ $(SLO)$/winuno.obj \
+ $(SLO)$/framegrabber.obj
SHL1TARGET=$(TARGET)
SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(UNOTOOLSLIB) $(TOOLSLIB) $(VCLLIB)
diff --git a/avmedia/source/win/winuno.cxx b/avmedia/source/win/winuno.cxx
index 0a897841d1..e18a08f1c2 100644
--- a/avmedia/source/win/winuno.cxx
+++ b/avmedia/source/win/winuno.cxx
@@ -64,7 +64,7 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void*
xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
- ::rtl::OUString::createFromAscii( "com.sun.star.comp.avmedia.Manager_DirectX" ),
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.media.Manager_DirectX" )),
create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
}
diff --git a/avmedia/util/makefile.mk b/avmedia/util/makefile.mk
index a26460cb50..6d12706a26 100644
--- a/avmedia/util/makefile.mk
+++ b/avmedia/util/makefile.mk
@@ -40,16 +40,16 @@ GEN_HID_OTHER=TRUE
RESLIB1NAME=$(TARGET)
RESLIB1IMAGES=$(PRJ)$/res
RESLIB1SRSFILES= \
- $(SRS)$/viewer.srs \
- $(SRS)$/framework.srs
+ $(SRS)$/viewer.srs \
+ $(SRS)$/framework.srs
# --- Files -------------------------------------
LIB1TARGET=$(SLB)$/$(TARGET).lib
LIB1FILES=\
- $(SLB)$/viewer.lib \
- $(SLB)$/framework.lib
-
+ $(SLB)$/viewer.lib \
+ $(SLB)$/framework.lib
+
# ==========================================================================
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
@@ -69,13 +69,13 @@ DEFLIB1NAME =$(TARGET)
.IF "$(depend)"==""
$(MISC)$/$(SHL1TARGET).flt: makefile.mk
- @echo ------------------------------
- @echo Making: $@
- @echo _Impl>$@
- @echo WEP>>$@
- @echo LIBMAIN>>$@
- @echo LibMain>>$@
- @echo CT>>$@
+ @echo ------------------------------
+ @echo Making: $@
+ @echo _Impl>$@
+ @echo WEP>>$@
+ @echo LIBMAIN>>$@
+ @echo LibMain>>$@
+ @echo CT>>$@
.ENDIF
ALLTAR : $(MISC)/avmedia.component
diff --git a/basic/inc/basic/mybasic.hxx b/basic/inc/basic/mybasic.hxx
index 371badaee4..fb48d8cb11 100644
--- a/basic/inc/basic/mybasic.hxx
+++ b/basic/inc/basic/mybasic.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/inc/basic/process.hxx b/basic/inc/basic/process.hxx
index 6c35174b63..68f3147ac6 100644
--- a/basic/inc/basic/process.hxx
+++ b/basic/inc/basic/process.hxx
@@ -40,9 +40,12 @@ typedef Environment::value_type EnvironmentVariable;
class Process
{
// Internal members and methods
- vos::OArgumentList *pArgumentList;
- vos::OEnvironment *pEnvList;
- vos::OProcess *pProcess;
+ sal_uInt32 m_nArgumentCount;
+ rtl_uString **m_pArgumentList;
+ sal_uInt32 m_nEnvCount;
+ rtl_uString **m_pEnvList;
+ rtl::OUString m_aProcessName;
+ oslProcess m_pProcess;
BOOL ImplIsRunning();
long ImplGetExitCode();
BOOL bWasGPF;
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index acf674aa59..c65d4c82e6 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -63,6 +63,8 @@ class SbModule : public SbxObject
SbModuleImpl* mpSbModuleImpl; // Impl data
std::vector< String > mModuleVariableNames;
+ SbModule();
+ SbModule(const SbModule&);
void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
@@ -140,6 +142,7 @@ public:
BOOL LoadBinaryData( SvStream& );
BOOL ExceedsLegacyModuleSize();
void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
+ bool HasExeCode();
BOOL IsVBACompat() const;
void SetVBACompat( BOOL bCompat );
INT32 GetModuleType() { return mnType; }
diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx
index 49fefb7930..5d5dc9af69 100644
--- a/basic/inc/basic/sbobjmod.hxx
+++ b/basic/inc/basic/sbobjmod.hxx
@@ -1,13 +1,8 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: sbobjmod.hxx,v $
- *
- * $Revision: 1.4 $
- *
- * last change: $Author: $ $Date: 2007/08/27 16:31:39 $
- *
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
@@ -130,3 +125,4 @@ SV_DECL_IMPL_REF(SbObjModule);
#endif
#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx
index 0b28e0ded1..9b5acf4257 100644
--- a/basic/inc/basic/sbx.hxx
+++ b/basic/inc/basic/sbx.hxx
@@ -33,6 +33,7 @@
#include "svl/svarray.hxx"
#include "svl/smplhint.hxx"
#include "svl/lstner.hxx"
+
#include <basic/sbxdef.hxx>
#include <basic/sbxform.hxx>
#include <basic/sbxobj.hxx>
diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx
index 65554ef7f0..45ed25cd89 100644
--- a/basic/inc/basic/sbxbase.hxx
+++ b/basic/inc/basic/sbxbase.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/inc/basic/sbxdef.hxx b/basic/inc/basic/sbxdef.hxx
index 0c4020d3e2..fc38cbaf99 100644
--- a/basic/inc/basic/sbxdef.hxx
+++ b/basic/inc/basic/sbxdef.hxx
@@ -112,8 +112,9 @@ enum SbxDataType {
};
const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
-const UINT32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
+const UINT32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
+
#endif
@@ -241,24 +242,24 @@ typedef ULONG SbxError; // Preserve old type
// Flag-Bits:
-#define SBX_READ 0x0001 // Read permission
-#define SBX_WRITE 0x0002 // Write permission
-#define SBX_READWRITE 0x0003 // Read/Write permission
-#define SBX_DONTSTORE 0x0004 // Don't store object
-#define SBX_MODIFIED 0x0008 // Object was changed
-#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable)
-#define SBX_CONST 0x0020 // Definition of const value
-#define SBX_OPTIONAL 0x0040 // Parameter is optional
-#define SBX_HIDDEN 0x0080 // Element is invisible
-#define SBX_INVISIBLE 0x0100 // Element is not found by Find()
-#define SBX_EXTSEARCH 0x0200 // Object is searched completely
-#define SBX_EXTFOUND 0x0400 // Variable was found through extended search
-#define SBX_GBLSEARCH 0x0800 // Global search via Parents
-#define SBX_RESERVED 0x1000 // reserved
-#define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED
-#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put
-#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
-#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
+#define SBX_READ 0x0001 // Read permission
+#define SBX_WRITE 0x0002 // Write permission
+#define SBX_READWRITE 0x0003 // Read/Write permission
+#define SBX_DONTSTORE 0x0004 // Don't store object
+#define SBX_MODIFIED 0x0008 // Object was changed
+#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable)
+#define SBX_CONST 0x0020 // Definition of const value
+#define SBX_OPTIONAL 0x0040 // Parameter is optional
+#define SBX_HIDDEN 0x0080 // Element is invisible
+#define SBX_INVISIBLE 0x0100 // Element is not found by Find()
+#define SBX_EXTSEARCH 0x0200 // Object is searched completely
+#define SBX_EXTFOUND 0x0400 // Variable was found through extended search
+#define SBX_GBLSEARCH 0x0800 // Global search via Parents
+#define SBX_RESERVED 0x1000 // reserved
+#define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED
+#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put
+#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
+#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one
// is used for objects, the other for variables only
diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx
index d452b7b8e1..46b8116b10 100644
--- a/basic/inc/basic/sbxvar.hxx
+++ b/basic/inc/basic/sbxvar.hxx
@@ -55,13 +55,8 @@ struct SbxValues
float nSingle;
double nDouble;
- SbxINT64 nLong64;
- SbxUINT64 nULong64;
- sal_Int64 nInt64;
- sal_uInt64 uInt64;
- int nInt;
- unsigned int nUInt;
- ::rtl::OUString* pOUString;
+
+ rtl::OUString* pOUString;
SbxDecimal* pDecimal;
SbxBase* pObj;
@@ -94,6 +89,8 @@ struct SbxValues
SbxValues( ULONG _nULong ): nULong( _nULong ), eType(SbxULONG) {}
SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
+ SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {}
+ SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
SbxValues( const ::rtl::OUString* _pString ): pOUString( (::rtl::OUString*)_pString ), eType(SbxSTRING) {}
SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
@@ -172,25 +169,10 @@ public:
inline SbxValues * data() { return &aData; }
- SbxINT64 GetCurrency() const;
- SbxINT64 GetLong64() const;
- SbxUINT64 GetULong64() const;
- sal_Int64 GetInt64() const;
- sal_uInt64 GetUInt64() const;
- INT16 GetInteger() const;
- INT32 GetLong() const;
- float GetSingle() const;
- double GetDouble() const;
- double GetDate() const;
- BOOL GetBool() const;
- UINT16 GetErr() const;
- const String& GetString() const;
- const String& GetCoreString() const;
- ::rtl::OUString GetOUString() const;
- SbxDecimal* GetDecimal() const;
- SbxBase* GetObject() const;
- BOOL HasObject() const;
- void* GetData() const;
+ UINT16 GetErr() const;
+
+ BOOL GetBool() const;
+ BYTE GetByte() const;
sal_Unicode GetChar() const;
UINT16 GetUShort() const;
UINT32 GetULong() const;
@@ -209,7 +191,7 @@ public:
const String& GetString() const;
const String& GetCoreString() const;
- rtl::OUString GetOUString() const;
+ ::rtl::OUString GetOUString() const;
SbxBase* GetObject() const;
BOOL HasObject() const;
@@ -234,9 +216,9 @@ public:
BOOL PutSingle( float );
BOOL PutDouble( double );
BOOL PutDate( double );
- BOOL PutBool( BOOL );
- BOOL PutErr( USHORT );
- BOOL PutStringExt( const ::rtl::OUString& ); // with extended analysis (International, "TRUE"/"FALSE")
+
+ // with extended analysis (International, "TRUE"/"FALSE")
+ BOOL PutStringExt( const ::rtl::OUString& );
BOOL PutString( const ::rtl::OUString& );
BOOL PutString( const sal_Unicode* ); // Type = SbxSTRING
BOOL PutpChar( const sal_Unicode* ); // Type = SbxLPSTR
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index f50a491a3f..3ff944122d 100644
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
index bd91e122f5..f523b28821 100644
--- a/basic/source/app/app.hxx
+++ b/basic/source/app/app.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/appbased.cxx b/basic/source/app/appbased.cxx
index 1f9467b2ab..66b92b5116 100644
--- a/basic/source/app/appbased.cxx
+++ b/basic/source/app/appbased.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/appedit.cxx b/basic/source/app/appedit.cxx
index bf7503b9bc..aafa4342a7 100644
--- a/basic/source/app/appedit.cxx
+++ b/basic/source/app/appedit.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx
index 2080305895..1f0bf79f85 100644
--- a/basic/source/app/appwin.cxx
+++ b/basic/source/app/appwin.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/appwin.hxx b/basic/source/app/appwin.hxx
index f2927d9a42..efd2dd859a 100644
--- a/basic/source/app/appwin.hxx
+++ b/basic/source/app/appwin.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/basic.src b/basic/source/app/basic.src
index 32226ebbaa..073f8cc7be 100644
--- a/basic/source/app/basic.src
+++ b/basic/source/app/basic.src
@@ -91,7 +91,7 @@ ModalDialog IDD_ABOUT_DIALOG {
FixedText {
Pos = MAP_APPFONT( 40, 60 );
Size = MAP_APPFONT( 110, 10 );
- TEXT = "®1995-2010 Oracle";
+ TEXT = "�1995-2010 Oracle";
CENTER = TRUE;
};
};
diff --git a/basic/source/app/brkpnts.cxx b/basic/source/app/brkpnts.cxx
index ad9d75a6aa..b89f649004 100644
--- a/basic/source/app/brkpnts.cxx
+++ b/basic/source/app/brkpnts.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/brkpnts.hxx b/basic/source/app/brkpnts.hxx
index 0bfa94dff8..99782c06ed 100644
--- a/basic/source/app/brkpnts.hxx
+++ b/basic/source/app/brkpnts.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/dialogs.cxx b/basic/source/app/dialogs.cxx
index 19828f0057..cf459af392 100644
--- a/basic/source/app/dialogs.cxx
+++ b/basic/source/app/dialogs.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -45,9 +45,7 @@
#include <tools/fsys.hxx>
#include <svtools/stringtransfer.hxx>
#include <vcl/splitwin.hxx>
-#ifndef _ZFORLIST_HXX //autogen
#include <svl/zformat.hxx>
-#endif
#include <svtools/ctrltool.hxx>
diff --git a/basic/source/app/dialogs.hxx b/basic/source/app/dialogs.hxx
index c2ecd100b4..48d2d8ccaf 100644
--- a/basic/source/app/dialogs.hxx
+++ b/basic/source/app/dialogs.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/makefile.mk b/basic/source/app/makefile.mk
index 868db15ba2..e62b11c0be 100644
--- a/basic/source/app/makefile.mk
+++ b/basic/source/app/makefile.mk
@@ -38,60 +38,36 @@ LIBTARGET = NO
# --- Common ------------------------------------------------------------
-OBJFILES = \
- $(OBJ)$/ttbasic.obj \
- $(OBJ)$/basicrt.obj \
- $(OBJ)$/processw.obj \
- $(OBJ)$/process.obj \
- $(OBJ)$/brkpnts.obj \
- $(OBJ)$/mybasic.obj \
- $(OBJ)$/status.obj \
- $(OBJ)$/printer.obj \
- $(OBJ)$/appwin.obj \
- $(OBJ)$/appedit.obj \
- $(OBJ)$/appbased.obj \
- $(OBJ)$/apperror.obj \
- $(OBJ)$/textedit.obj \
- $(OBJ)$/msgedit.obj \
- $(OBJ)$/dialogs.obj \
-
EXCEPTIONSFILES = \
- $(OBJ)$/app.obj \
- $(OBJ)$/printer.obj \
- $(OBJ)$/process.obj
-
-.IF "$(GUI)" == "WNT"
-EXCEPTIONSFILES += \
- $(OBJ)$/process.obj
-.ENDIF
+ $(OBJ)$/app.obj \
+ $(OBJ)$/appbased.obj \
+ $(OBJ)$/appedit.obj \
+ $(OBJ)$/apperror.obj \
+ $(OBJ)$/appwin.obj \
+ $(OBJ)$/basicrt.obj \
+ $(OBJ)$/brkpnts.obj \
+ $(OBJ)$/dialogs.obj \
+ $(OBJ)$/msgedit.obj \
+ $(OBJ)$/mybasic.obj \
+ $(OBJ)$/printer.obj \
+ $(OBJ)$/process.obj \
+ $(OBJ)$/status.obj \
+ $(OBJ)$/textedit.obj
SRS1NAME=$(TARGET)
SRC1FILES = \
- basic.src \
- ttmsg.src \
- basmsg.src \
- svtmsg.src \
- testtool.src
+ basic.src \
+ ttmsg.src \
+ basmsg.src \
+ svtmsg.src \
+ testtool.src
LIB1TARGET=$(LB)$/app.lib
LIB1ARCHIV=$(LB)$/libapp.a
LIB1OBJFILES = \
- $(OBJ)$/basicrt.obj \
+ $(EXCEPTIONSFILES) \
$(OBJ)$/processw.obj \
- $(OBJ)$/process.obj \
- $(OBJ)$/brkpnts.obj \
- $(OBJ)$/app.obj \
- $(OBJ)$/mybasic.obj \
- $(OBJ)$/status.obj \
- $(OBJ)$/printer.obj \
- $(OBJ)$/appwin.obj \
- $(OBJ)$/appedit.obj \
- $(OBJ)$/appbased.obj \
- $(OBJ)$/apperror.obj \
- $(OBJ)$/textedit.obj \
- $(OBJ)$/msgedit.obj \
- $(OBJ)$/dialogs.obj \
- $(OBJ)$/sbintern.obj
+ $(OBJ)$/sbintern.obj
# --- Targets ------------------------------------------------------------
diff --git a/basic/source/app/msgedit.cxx b/basic/source/app/msgedit.cxx
index 72ccbc0be3..2832e45a88 100644
--- a/basic/source/app/msgedit.cxx
+++ b/basic/source/app/msgedit.cxx
@@ -43,7 +43,6 @@ Version 3 Changed Charset from CHARSET_IBMPC to RTL_TEXTENCODING_UTF8
#include <tools/fsys.hxx>
#include <svtools/stringtransfer.hxx>
#include <unotools/syslocale.hxx>
-#ifndef _BASIC_TTRESHLP_HXX
#include <basic/ttstrhlp.hxx>
#include "basic.hrc"
#include "msgedit.hxx"
diff --git a/basic/source/app/mybasic.cxx b/basic/source/app/mybasic.cxx
index c7bfd0686d..727a1e18a4 100644
--- a/basic/source/app/mybasic.cxx
+++ b/basic/source/app/mybasic.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/printer.hxx b/basic/source/app/printer.hxx
index 0fe87f5450..c6b8c8e390 100644
--- a/basic/source/app/printer.hxx
+++ b/basic/source/app/printer.hxx
@@ -37,13 +37,13 @@ class BasicPrinter
boost::shared_ptr<Printer> mpPrinter;
boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener;
- short nLine; // aktuelle Zeile
- short nPage; // aktuelle Seite
- short nLines; // Zeilen pro Seite
- short nYoff; // Zeilenabstand in Points
- String aFile; // Dateiname
+ short nLine; // current row
+ short nPage; // current page
+ short nLines; // lines per page
+ short nYoff; // line spacing in points
+ String aFile; // file name
- void Header(); // Seitenkopf drucken
+ void Header(); // print page header
void StartPage();
public:
BasicPrinter();
diff --git a/basic/source/app/process.cxx b/basic/source/app/process.cxx
index a9a2fda227..397eaadbdf 100644
--- a/basic/source/app/process.cxx
+++ b/basic/source/app/process.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -82,9 +82,10 @@ BOOL Process::ImplIsRunning()
{
if ( m_pProcess && bHasBeenStarted )
{
- vos::OProcess::TProcessInfo aProcessInfo;
- pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
- if ( !(aProcessInfo.Fields & vos::OProcess::TData_ExitCode) )
+ oslProcessInfo aProcessInfo;
+ aProcessInfo.Size = sizeof(oslProcessInfo);
+ osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo );
+ if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) )
return TRUE;
else
return FALSE;
@@ -97,9 +98,10 @@ long Process::ImplGetExitCode()
{
if ( m_pProcess )
{
- vos::OProcess::TProcessInfo aProcessInfo;
- pProcess->getInfo( vos::OProcess::TData_ExitCode, &aProcessInfo );
- if ( !(aProcessInfo.Fields & vos::OProcess::TData_ExitCode) )
+ oslProcessInfo aProcessInfo;
+ aProcessInfo.Size = sizeof(oslProcessInfo);
+ osl_getProcessInfo(m_pProcess, osl_Process_EXITCODE, &aProcessInfo );
+ if ( !(aProcessInfo.Fields & osl_Process_EXITCODE) )
SbxBase::SetError( SbxERR_NO_ACTIVE_OBJECT );
return aProcessInfo.Code;
}
@@ -135,8 +137,14 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
nParamCount++;
}
}
- pArgumentList = new vos::OArgumentList( pParamList, nCount );
-
+ m_nArgumentCount = nParamCount;
+ m_pArgumentList = new rtl_uString*[m_nArgumentCount];
+ for ( i = 0 ; i < m_nArgumentCount ; i++ )
+ {
+ m_pArgumentList[i] = NULL;
+ rtl_uString_assign( &(m_pArgumentList[i]), pParamList[i].pData );
+ }
+ delete [] pParamList;
if ( pEnv )
{
@@ -154,12 +162,11 @@ void Process::SetImage( const String &aAppPath, const String &aAppParams, const
++m_nEnvCount;
++aIter;
}
- pEnvList = new vos::OEnvironment( pEnvArray, nEnvCount );
}
::rtl::OUString aNormalizedAppPath;
osl::FileBase::getFileURLFromSystemPath( ::rtl::OUString(aAppPath), aNormalizedAppPath );
- pProcess = new vos::OProcess( aNormalizedAppPath );
+ m_aProcessName = aNormalizedAppPath;;
bHasBeenStarted = FALSE;
}
@@ -176,23 +183,19 @@ BOOL Process::Start()
try
{
#endif
- if ( pEnvList )
- {
- bSuccess = pProcess->execute( (vos::OProcess::TProcessOption)
- ( vos::OProcess::TOption_SearchPath
- /*| vos::OProcess::TOption_Detached*/
- /*| vos::OProcess::TOption_Wait*/ ),
- *pArgumentList,
- *pEnvList ) == vos::OProcess::E_None;
- }
- else
- {
- bSuccess = pProcess->execute( (vos::OProcess::TProcessOption)
- ( vos::OProcess::TOption_SearchPath
- /*| vos::OProcess::TOption_Detached*/
- /*| vos::OProcess::TOption_Wait*/ ),
- *pArgumentList ) == vos::OProcess::E_None;
- }
+ bSuccess = osl_executeProcess(
+ m_aProcessName.pData,
+ m_pArgumentList,
+ m_nArgumentCount,
+ osl_Process_SEARCHPATH
+ /*| osl_Process_DETACHED*/
+ /*| osl_Process_WAIT*/,
+ NULL,
+ NULL,
+ m_pEnvList,
+ m_nEnvCount,
+ &m_pProcess ) == osl_Process_E_None;
+
#ifdef WNT
}
catch( ... )
diff --git a/basic/source/app/status.cxx b/basic/source/app/status.cxx
index ab1d1011f2..f46675c4cf 100644
--- a/basic/source/app/status.cxx
+++ b/basic/source/app/status.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/app/textedit.cxx b/basic/source/app/textedit.cxx
index cd52b08d4d..3d4d9edbad 100644
--- a/basic/source/app/textedit.cxx
+++ b/basic/source/app/textedit.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index f4e49aa72a..7c59177b26 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -490,7 +490,7 @@ namespace basic
// initialize the containers
impl_initDocLibraryContainers_nothrow( xBasicLibs, xDialogLibs );
- // damit auch Dialoge etc. 'qualifiziert' angesprochen werden k"onnen
+ // so that also dialogs etc. could be 'qualified' addressed
_out_rpBasicManager->GetLib(0)->SetParent( pAppBasic );
// global properties in the document's Basic
diff --git a/basic/source/classes/errobject.cxx b/basic/source/classes/errobject.cxx
index 4f661faeaf..3e6784c836 100644
--- a/basic/source/classes/errobject.cxx
+++ b/basic/source/classes/errobject.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -174,7 +175,7 @@ void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const u
throw (uno::RuntimeException)
{
if ( !Number.hasValue() )
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Missing Required Paramater")), uno::Reference< uno::XInterface >() );
Number >>= m_nNumber;
Description >>= m_sDescription;
Source >>= m_sSource;
@@ -223,3 +224,4 @@ void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OU
m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 4650d39878..b41e78ae1b 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -438,11 +438,6 @@ Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, Star
return aDlgLibAny;
}
-static ::rtl::OUString aDecorationPropName =
- ::rtl::OUString::createFromAscii( "Decoration" );
-static ::rtl::OUString aTitlePropName =
- ::rtl::OUString::createFromAscii( "Title" );
-
void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
{
(void)pBasic;
@@ -522,44 +517,44 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
bool bDocDialog = false;
StarBASIC* pFoundBasic = NULL;
OSL_TRACE("About to try get a hold of ThisComponent");
- Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ;
- aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
- // If we found the dialog then it belongs to the Search basic
- if ( !pFoundBasic )
- {
- Reference< frame::XDesktop > xDesktop( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
- UNO_QUERY );
- Reference< container::XEnumeration > xModels;
- if ( xDesktop.is() )
+ Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
+ // If we found the dialog then it belongs to the Search basic
+ if ( !pFoundBasic )
{
- Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
- if ( xComponents.is() )
- xModels.set( xComponents->createEnumeration(), UNO_QUERY );
- if ( xModels.is() )
+ Reference< frame::XDesktop > xDesktop( xMSF->createInstance
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ),
+ UNO_QUERY );
+ Reference< container::XEnumeration > xModels;
+ if ( xDesktop.is() )
+ {
+ Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY );
+ if ( xComponents.is() )
+ xModels.set( xComponents->createEnumeration(), UNO_QUERY );
+ if ( xModels.is() )
+ {
+ while ( xModels->hasMoreElements() )
{
- while ( xModels->hasMoreElements() )
+ Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
+ if ( xNextModel.is() )
{
- Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY );
- if ( xNextModel.is() )
+ BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
+ if ( pMgr )
+ aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
+ if ( aDlgLibAny.hasValue() )
{
- BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel );
- if ( pMgr )
- aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic );
- if ( aDlgLibAny.hasValue() )
- {
- bDocDialog = true;
- xModel = xNextModel;
- break;
- }
+ bDocDialog = true;
+ xModel = xNextModel;
+ break;
}
}
}
}
}
+ }
if ( pFoundBasic )
bDocDialog = pFoundBasic->IsDocBasic();
- Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
+ Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel );
Sequence< Any > aArgs( 4 );
if( bDocDialog )
diff --git a/basic/source/classes/makefile.mk b/basic/source/classes/makefile.mk
index 9f0cc95b0f..e00ed4674c 100644
--- a/basic/source/classes/makefile.mk
+++ b/basic/source/classes/makefile.mk
@@ -51,18 +51,18 @@ $(MISC)$/$(TARGET).slo : $(SLOTARGET)
# --- Allgemein -----------------------------------------------------------
SLOFILES= \
- $(SLO)$/sb.obj \
- $(SLO)$/sbxmod.obj \
- $(SLO)$/image.obj \
- $(SLO)$/sbintern.obj \
- $(SLO)$/sbunoobj.obj \
- $(SLO)$/propacc.obj \
- $(SLO)$/disas.obj \
- $(SLO)$/errobject.obj \
- $(SLO)$/eventatt.obj
+ $(SLO)$/sb.obj \
+ $(SLO)$/sbxmod.obj \
+ $(SLO)$/image.obj \
+ $(SLO)$/sbintern.obj \
+ $(SLO)$/sbunoobj.obj \
+ $(SLO)$/propacc.obj \
+ $(SLO)$/disas.obj \
+ $(SLO)$/errobject.obj \
+ $(SLO)$/eventatt.obj
OBJFILES= \
- $(OBJ)$/sbintern.obj
+ $(OBJ)$/sbintern.obj
SRS1NAME=$(TARGET)
SRC1FILES= sb.src
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 7bab981f9c..19ef3804c5 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -53,7 +53,7 @@
#include "filefmt.hxx"
#include "sb.hrc"
#include <basrid.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include "errobject.hxx"
#include <hash_map>
@@ -62,10 +62,6 @@
#include <com/sun/star/script/ModuleInfo.hpp>
using namespace ::com::sun::star::script;
-#include <com/sun/star/script/ModuleType.hpp>
-#include <com/sun/star/script/ModuleInfo.hpp>
-using namespace ::com::sun::star::script;
-
SV_IMPL_VARARR(SbTextPortions,SbTextPortion)
TYPEINIT1(StarBASIC,SbxObject)
@@ -78,9 +74,6 @@ using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY;
using com::sun::star::lang::XMultiServiceFactory;
-const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
-const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
-
SbxObject* StarBASIC::getVBAGlobals( )
{
if ( !pVBAGlobals )
@@ -89,7 +82,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
if ( GetUNOConstant("ThisComponent", aThisDoc) )
{
Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY );
- if ( xDocFac.is() )
+ if ( xDocFac.is() )
{
try
{
@@ -101,6 +94,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
}
}
}
+ const String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE );
}
return pVBAGlobals;
@@ -109,6 +103,7 @@ SbxObject* StarBASIC::getVBAGlobals( )
// i#i68894#
SbxVariable* StarBASIC::VBAFind( const String& rName, SbxClassType t )
{
+ const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
if( rName == aThisComponent )
return NULL;
// rename to init globals
@@ -577,6 +572,7 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
if( pObj != NULL )
{
String aObjClass = pObj->GetClassName();
+ (void)aObjClass;
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
if( pClassModuleObj != NULL )
@@ -1064,7 +1060,7 @@ void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassMod
// Run Init-Code of all modules (including inserted libraries)
void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{
- ::vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
// Init own modules
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 08646f71a1..308460f131 100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -31,7 +31,6 @@
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <tools/errcode.hxx>
-#endif
#include <svl/hint.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -64,6 +63,7 @@
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
#include <com/sun/star/script/XDirectInvocation.hpp>
+#include <com/sun/star/script/XDefaultMethod.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/reflection/XIdlArray.hpp>
@@ -75,7 +75,7 @@
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
-
+#include <com/sun/star/script/XAutomationInvocation.hpp>
using com::sun::star::uno::Reference;
using namespace com::sun::star::uno;
@@ -160,6 +160,21 @@ SbxVariable* getDefaultProp( SbxVariable* pRef )
}
}
+void SetSbUnoObjectDfltPropName( SbxObject* pObj )
+{
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj);
+ if ( pUnoObj )
+ {
+ String sDfltPropName;
+
+ if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
+ {
+ OSL_TRACE("SetSbUnoObjectDfltPropName setting dflt prop for %s", rtl::OUStringToOString( pObj->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
+ pUnoObj->SetDfltProperty( sDfltPropName );
+ }
+ }
+}
+
Reference< XComponentContext > getComponentContext_Impl( void )
{
static Reference< XComponentContext > xContext;
@@ -578,7 +593,6 @@ SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
}
-// Von Uno nach Sbx wandeln
SbxDataType unoToSbxType( TypeClass eType )
{
SbxDataType eRetType = SbxVOID;
@@ -829,7 +843,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
// instantiate a SbUnoObject
String aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
- //If this is called externally e.g. from the scripting
+ //If this is called externally e.g. from the scripting
//framework then there is no 'active' runtime the default property will not be set up
//only a vba object will have XDefaultProp set anyway so... this
//test seems a bit of overkill
@@ -987,23 +1001,21 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
case SbxBOOL: aRetType = ::getCppuType( (sal_Bool*)0 ); break;
case SbxVARIANT: aRetType = ::getCppuType( (Any*)0 ); break;
//case SbxDATAOBJECT: break;
- case SbxCHAR: aRetType = ::getCppuType( (sal_Unicode*)0 ); break;
- case SbxBYTE: aRetType = ::getCppuType( (sal_Int8*)0 ); break;
- case SbxUSHORT: aRetType = ::getCppuType( (sal_uInt16*)0 ); break;
- case SbxULONG: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
- //case SbxLONG64: break;
- //case SbxULONG64: break;
- // Maschinenabhaengige zur Sicherheit auf Hyper abbilden
- case SbxINT: aRetType = ::getCppuType( (sal_Int32*)0 ); break;
- case SbxUINT: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
- //case SbxVOID: break;
- //case SbxHRESULT: break;
- //case SbxPOINTER: break;
- //case SbxDIMARRAY: break;
- //case SbxCARRAY: break;
- //case SbxUSERDEF: break;
- //case SbxLPSTR: break;
- //case SbxLPWSTR: break;
+ case SbxCHAR: aRetType = ::getCppuType( (sal_Unicode*)0 ); break;
+ case SbxBYTE: aRetType = ::getCppuType( (sal_Int8*)0 ); break;
+ case SbxUSHORT: aRetType = ::getCppuType( (sal_uInt16*)0 ); break;
+ case SbxULONG: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
+ // map machine-dependent ones on hyper for secureness
+ case SbxINT: aRetType = ::getCppuType( (sal_Int32*)0 ); break;
+ case SbxUINT: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
+ //case SbxVOID: break;
+ //case SbxHRESULT: break;
+ //case SbxPOINTER: break;
+ //case SbxDIMARRAY: break;
+ //case SbxCARRAY: break;
+ //case SbxUSERDEF: break;
+ //case SbxLPSTR: break;
+ //case SbxLPWSTR: break;
//case SbxCoreSTRING: break;
default: break;
}
@@ -1338,7 +1350,6 @@ static bool implGetTypeByName( const String& rName, Type& rRetType )
}
-// Konvertierung von Sbx nach Uno mit bekannter Zielklasse
Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty )
{
Any aRetVal;
@@ -1456,13 +1467,11 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
}
break;
- /* folgende Typen lassen wir erstmal weg
- case TypeClass_SERVICE: break;
- case TypeClass_CLASS: break;
- case TypeClass_TYPEDEF: break;
- case TypeClass_UNION: break;
- case TypeClass_ENUM: break;
- case TypeClass_ARRAY: break;
+ case TypeClass_SERVICE: break;
+ case TypeClass_CLASS: break;
+ case TypeClass_TYPEDEF: break;
+ case TypeClass_UNION: break;
+ case TypeClass_ARRAY: break;
*/
case TypeClass_ENUM:
@@ -1603,10 +1612,10 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
aRetVal.setValue( &c , getCharCppuType() );
break;
}
- case TypeClass_STRING: aRetVal <<= pVar->GetOUString(); break;
- case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break;
- case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break;
- //case TypeClass_OCTET: break;
+ case TypeClass_STRING: aRetVal <<= pVar->GetOUString(); break;
+ case TypeClass_FLOAT: aRetVal <<= pVar->GetSingle(); break;
+ case TypeClass_DOUBLE: aRetVal <<= pVar->GetDouble(); break;
+ //case TypeClass_OCTET: break;
case TypeClass_BYTE:
{
@@ -1871,7 +1880,7 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj,
xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sTypeName;
if ( sTypeName.getLength() == 0 || sTypeName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ) ) )
// can't check type, leave it pass
- result = true;
+ result = true;
else
result = sTypeName.equals( aClass );
}
@@ -2965,15 +2974,15 @@ void SbUnoObject::implCreateDbgProperties( void )
{
Property aProp;
- // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen
+ // Id == -1: display the implemented interfaces corresponding the ClassProvider
SbxVariableRef xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_SUPPORTEDINTERFACES)), SbxSTRING, aProp, -1, false );
QuickInsert( (SbxVariable*)xVarRef );
- // Id == -2: Properties ausgeben
+ // Id == -2: output the properties
xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_PROPERTIES)), SbxSTRING, aProp, -2, false );
QuickInsert( (SbxVariable*)xVarRef );
- // Id == -3: Methoden ausgeben
+ // Id == -3: output the Methods
xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_METHODS)), SbxSTRING, aProp, -3, false );
QuickInsert( (SbxVariable*)xVarRef );
}
@@ -4034,7 +4043,7 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
}
-
+
//========================================================================
//========================================================================
//========================================================================
@@ -4082,7 +4091,7 @@ BasicAllListener_Impl::~BasicAllListener_Impl()
void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet )
{
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
if( xSbxObj.Is() )
{
@@ -4147,7 +4156,7 @@ Any BasicAllListener_Impl::approveFiring( const AllEventObject& Event ) throw (
// Methods of XEventListener
void BasicAllListener_Impl ::disposing(const EventObject& ) throw ( RuntimeException )
{
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
xSbxObj.Clear();
}
@@ -4545,7 +4554,7 @@ public:
throw( UnknownPropertyException );
virtual sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& rName ) throw();
virtual sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& rProp ) throw();
-
+
virtual Any SAL_CALL invoke( const ::rtl::OUString& rFunction,
const Sequence< Any >& rParams,
Sequence< sal_Int16 >& rOutParamIndex,
@@ -4576,7 +4585,7 @@ void SAL_CALL ModuleInvocationProxy::setValue( const ::rtl::OUString& rProperty,
if( !m_bProxyIsClassModuleObject )
throw UnknownPropertyException();
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Set ") );
aPropertyFunctionName += m_aPrefix;
@@ -4617,7 +4626,7 @@ Any SAL_CALL ModuleInvocationProxy::getValue( const ::rtl::OUString& rProperty )
if( !m_bProxyIsClassModuleObject )
throw UnknownPropertyException();
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
::rtl::OUString aPropertyFunctionName( RTL_CONSTASCII_USTRINGPARAM( "Property Get ") );
aPropertyFunctionName += m_aPrefix;
@@ -4655,7 +4664,7 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
Sequence< Any >& )
throw( CannotConvertException, InvocationTargetException )
{
- vos::OGuard guard( Application::GetSolarMutex() );
+ SolarMutexGuard guard;
Any aRet;
SbxObjectRef xScopeObj = m_xScopeObj;
@@ -4748,7 +4757,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
Reference< XInterface > xRet;
Reference< XComponentContext > xContext = getComponentContext_Impl();
- Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, xScopeObj );
@@ -4869,7 +4878,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
// TODO: Check if support for multiple interfaces is needed
Reference< XComponentContext > xContext = getComponentContext_Impl();
- Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Reference< XSingleServiceFactory > xComImplementsFactory
(
xServiceMgr->createInstanceWithContext(
@@ -4967,4 +4976,5 @@ bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal )
}
return bSuccess;
}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 1848ffe619..721040b2d2 100755
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -50,12 +50,13 @@
#include <svtools/syntaxhighlight.hxx>
#include <basic/basrdll.hxx>
-#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
#include <basic/sbobjmod.hxx>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+#include <com/sun/star/document/XVbaMethodParameter.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
using namespace com::sun::star;
@@ -84,7 +85,7 @@ using namespace com::sun::star;
#include <map>
#include <com/sun/star/script/XInvocation.hpp>
- using namespace ::com::sun::star;
+ using namespace ::com::sun::star;
using namespace com::sun::star::lang;
using namespace com::sun::star::reflection;
using namespace com::sun::star::beans;
@@ -117,7 +118,7 @@ class DocObjectWrapper : public DocObjectWrapper_BASE
SbPropertyRef getProperty( const rtl::OUString& aName ) throw (RuntimeException);
String mName; // for debugging
-public:
+public:
DocObjectWrapper( SbModule* pMod );
virtual ~DocObjectWrapper();
@@ -139,16 +140,16 @@ public:
virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException);
virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException);
virtual Any SAL_CALL queryInterface( const Type& aType ) throw ( RuntimeException );
-
+
virtual Sequence< Type > SAL_CALL getTypes() throw ( RuntimeException );
};
DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pVar->GetName() )
-{
+{
SbObjModule* pMod = PTR_CAST(SbObjModule,pVar);
if ( pMod )
{
- if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
+ if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
// Use proxy factory service to create aggregatable proxy.
@@ -156,7 +157,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
Reference< XInterface > xIf;
if ( pUnoObj )
{
- Any aObj = pUnoObj->getUnoAny();
+ Any aObj = pUnoObj->getUnoAny();
aObj >>= xIf;
if ( xIf.is() )
{
@@ -181,11 +182,11 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
OSL_ENSURE( false, "DocObjectWrapper::DocObjectWrapper: Caught exception!" );
}
}
-
+
if ( m_xAggProxy.is() )
{
osl_incrementInterlockedCount( &m_refCount );
-
+
/* i35609 - Fix crash on Solaris. The setDelegator call needs
to be in its own block to ensure that all temporary Reference
instances that are acquired during the call are released
@@ -193,7 +194,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
{
m_xAggProxy->setDelegator( static_cast< cppu::OWeakObject * >( this ) );
}
-
+
osl_decrementInterlockedCount( &m_refCount );
}
}
@@ -206,7 +207,7 @@ DocObjectWrapper::acquire() throw ()
osl_incrementInterlockedCount( &m_refCount );
OSL_TRACE("DocObjectWrapper::acquire(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
}
-void SAL_CALL
+void SAL_CALL
DocObjectWrapper::release() throw ()
{
if ( osl_decrementInterlockedCount( &m_refCount ) == 0 )
@@ -226,7 +227,7 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
throw ( RuntimeException )
{
if ( m_Types.getLength() == 0 )
- {
+ {
Sequence< Type > sTypes;
if ( m_xAggregateTypeProv.is() )
sTypes = m_xAggregateTypeProv->getTypes();
@@ -234,7 +235,7 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
Type* pPtr = m_Types.getArray();
for ( int i=0; i<m_Types.getLength(); ++i, ++pPtr )
{
- if ( i == 0 )
+ if ( i == 0 )
*pPtr = XInvocation::static_type( NULL );
else
*pPtr = sTypes[ i - 1 ];
@@ -243,13 +244,13 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
return m_Types;
}
-Reference< XIntrospectionAccess > SAL_CALL
+Reference< XIntrospectionAccess > SAL_CALL
DocObjectWrapper::getIntrospection( ) throw (RuntimeException)
{
return NULL;
}
-Any SAL_CALL
+Any SAL_CALL
DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasMethod( aFunctionName ) )
@@ -299,9 +300,8 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence<
// call method
SbxVariableRef xReturn = new SbxVariable;
- ErrCode nErr = SbxERR_OK;
- nErr = pMethod->Call( xReturn );
+ pMethod->Call( xReturn );
Any aReturn;
// get output parameters
if ( xSbxParams.Is() )
@@ -344,19 +344,19 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence<
return aReturn;
}
-void SAL_CALL
+void SAL_CALL
DocObjectWrapper::setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
return m_xAggInv->setValue( aPropertyName, aValue );
-
+
SbPropertyRef pProperty = getProperty( aPropertyName );
if ( !pProperty.Is() )
throw UnknownPropertyException();
unoToSbxValue( (SbxVariable*) pProperty, aValue );
}
-Any SAL_CALL
+Any SAL_CALL
DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
@@ -374,20 +374,20 @@ DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (Unknow
return aRet;
}
-::sal_Bool SAL_CALL
+::sal_Bool SAL_CALL
DocObjectWrapper::hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasMethod( aName ) )
- return sal_True;
+ return sal_True;
return getMethod( aName ).Is();
}
-::sal_Bool SAL_CALL
+::sal_Bool SAL_CALL
DocObjectWrapper::hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException)
{
sal_Bool bRes = sal_False;
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aName ) )
- bRes = sal_True;
+ bRes = sal_True;
else bRes = getProperty( aName ).Is();
return bRes;
}
@@ -444,6 +444,9 @@ TYPEINIT1(SbUserFormModule,SbObjModule)
typedef std::vector<HighlightPortion> HighlightPortions;
+
+SV_IMPL_VARARR(HighlightPortions, HighlightPortion)
+
bool getDefaultVBAMode( StarBASIC* pb )
{
bool bResult = false;
@@ -454,7 +457,7 @@ bool getDefaultVBAMode( StarBASIC* pb )
{
uno::Reference< beans::XPropertySet > xProp( aDoc, uno::UNO_QUERY );
if ( xProp.is() )
- {
+ {
uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
if ( xVBAMode.is() )
bResult = xVBAMode->getVBACompatibilityMode() == sal_True;
@@ -469,7 +472,7 @@ class AsyncQuitHandler
AsyncQuitHandler() {}
AsyncQuitHandler( const AsyncQuitHandler&);
public:
- static AsyncQuitHandler& instance()
+ static AsyncQuitHandler& instance()
{
static AsyncQuitHandler dInst;
return dInst;
@@ -482,7 +485,7 @@ public:
{
uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ), uno::UNO_QUERY );
if ( xDeskTop.is() )
- xDeskTop->terminate();
+ xDeskTop->terminate();
}
}
DECL_LINK( OnAsyncQuit, void* );
@@ -882,7 +885,7 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
else
{
- // #i92642: Special handling for name property to avoid
+ // #i92642: Special handling for name property to avoid
// side effects when using name as variable implicitely
bool bForwardToSbxObject = true;
@@ -943,7 +946,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
if( eCurTok == COMPATIBLE )
aTok.SetCompatible( true );
else if ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) )
- {
+ {
BOOL bIsVBA = ( aTok.GetDbl()== 1 );
SetVBACompat( bIsVBA );
aTok.SetCompatible( bIsVBA );
@@ -1097,7 +1100,7 @@ void SbModule::SetVBACompat( BOOL bCompat )
{
mbVBACompat = bCompat;
}
-// Ausfuehren eines BASIC-Unterprogramms
+// Run a Basic-subprogram
USHORT SbModule::Run( SbMethod* pMeth )
{
OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat );
@@ -1114,7 +1117,7 @@ USHORT SbModule::Run( SbMethod* pMeth )
#ifdef DBG_TRACE_BASIC
dbg_InitTrace();
#endif
- // #32779: Basic waehrend der Ausfuehrung festhalten
+ // #32779: Hold Basic during the execution
xBasic = (StarBASIC*) GetParent();
pINST = new SbiInstance( (StarBASIC*) GetParent() );
@@ -1191,13 +1194,13 @@ USHORT SbModule::Run( SbMethod* pMeth )
dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl, bLeave );
#endif
- // #63710 Durch ein anderes Thread-Handling bei Events kann es passieren,
- // dass show-Aufruf an einem Dialog zurueckkehrt (durch schliessen des
- // Dialogs per UI), BEVOR ein per Event ausgeloester weitergehender Call,
- // der in Basic weiter oben im Stack steht und auf einen Basic-Breakpoint
- // gelaufen ist, zurueckkehrt. Dann wird unten die Instanz zerstoert und
- // wenn das noch im Call stehende Basic weiterlaeuft, gibt es einen GPF.
- // Daher muss hier gewartet werden, bis andere Call zurueckkehrt.
+ // #63710 It can happen by an another thread handling at events,
+ // that the show call returns to an dialog (by closing the
+ // dialog per UI), before a by an event triggered further call returned,
+ // which stands in Basic more top in the stack and that had been run on
+ // a Basic-Breakpoint. Then would the instance below destroyed. And if the Basic,
+ // that stand still in the call, further runs, there is a GPF.
+ // Thus here had to be wait until the other call comes back.
if( bDelInst )
{
// Compare here with 1 instead of 0, because before nCallLvl--
@@ -1261,7 +1264,10 @@ USHORT SbModule::Run( SbMethod* pMeth )
StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
}
+ // VBA always ensure screenupdating is enabled after completing
StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
+ if ( pBasic && pBasic->IsDocBasic() && !pINST )
+ UnlockControllerHack( pBasic );
if( bDelInst )
{
// #57841 Clear Uno-Objects, which were helt in RTL functions,
@@ -1272,6 +1278,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
pINST = NULL;
}
if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST )
+ bQuit = true;
+ if ( bQuit )
{
Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL );
}
@@ -1325,18 +1333,18 @@ void SbModule::RunInit()
}
}
-// Mit private/dim deklarierte Variablen loeschen
+// Delete with private/dim declared variables
-void SbModule::AddVarName( const String& aName )
-{
+void SbModule::AddVarName( const String& aName )
+{
// see if the name is added allready
std::vector< String >::iterator it_end = mModuleVariableNames.end();
for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
{
if ( aName == *it )
- return;
+ return;
}
- mModuleVariableNames.push_back( aName );
+ mModuleVariableNames.push_back( aName );
}
void SbModule::RemoveVars()
@@ -1344,8 +1352,8 @@ void SbModule::RemoveVars()
std::vector< String >::iterator it_end = mModuleVariableNames.end();
for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
{
- // We don't want a Find being called in a derived class ( e.g.
- // SbUserform because it could trigger say an initialise event
+ // We don't want a Find being called in a derived class ( e.g.
+ // SbUserform because it could trigger say an initialise event
// which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile )
SbxVariableRef p = SbModule::Find( *it, SbxCLASS_PROPERTY );
if( p.Is() )
@@ -1448,15 +1456,15 @@ void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic )
}
}
-// Zunaechst in dieses Modul, um 358-faehig zu bleiben
-// (Branch in sb.cxx vermeiden)
+// At first in this module, to remain 358-capable
+// (Avoid branch in sb.cxx)
void StarBASIC::ClearAllModuleVars( void )
{
// Initialise the own module
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
- // Nur initialisieren, wenn der Startcode schon ausgefuehrt wurde
+ // Initialise only, if the startcode was already executed
if( pModule->pImage && pModule->pImage->bInit && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
pModule->ClearPrivateVars();
}
@@ -1686,7 +1694,7 @@ BOOL SbModule::LoadData( SvStream& rStrm, USHORT nVer )
Clear();
if( !SbxObject::LoadData( rStrm, 1 ) )
return FALSE;
- // Precaution...
+ // As a precaution...
SetFlag( SBX_EXTSEARCH | SBX_GBLSEARCH );
BYTE bImage;
rStrm >> bImage;
@@ -2213,7 +2221,7 @@ SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::Mod
SetModuleType( mInfo.ModuleType );
if ( mInfo.ModuleType == script::ModuleType::FORM )
{
- SetClassName( rtl::OUString::createFromAscii( "Form" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Form" )) );
}
else if ( mInfo.ModuleObject.is() )
SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
@@ -2230,20 +2238,20 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException
if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
return;
pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
-
+
com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
- if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
+ if( xServiceInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Worksheet" )) ) )
{
- SetClassName( rtl::OUString::createFromAscii( "Worksheet" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Worksheet" )) );
}
- else if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Workbook" ) ) )
+ else if( xServiceInfo->supportsService( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Workbook" )) ) )
{
- SetClassName( rtl::OUString::createFromAscii( "Workbook" ) );
+ SetClassName( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Workbook" )) );
}
}
SbxVariable*
-SbObjModule::GetObject()
+SbObjModule::GetObject()
{
return pDocObject;
}
@@ -2339,11 +2347,10 @@ public:
}
}
}
-
- //liuchen 2009-7-21, support Excel VBA Form_QueryClose event
- virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
- {
-#if IN_THE_FUTURE
+
+
+ virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException)
+ {
uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
if ( xDialog.is() )
{
@@ -2352,7 +2359,7 @@ public:
{
uno::Reference< document::XVbaMethodParameter > xVbaMethodParameter( xControl->getPeer(), uno::UNO_QUERY );
if ( xVbaMethodParameter.is() )
- {
+ {
sal_Int8 nCancel = 0;
sal_Int8 nCloseMode = 0;
@@ -2365,16 +2372,15 @@ public:
aParams);
xVbaMethodParameter->setVbaMethodParameter( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cancel")), aParams[0]);
return;
-
- }
- }
+
+ }
+ }
}
mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
-#endif
}
- //liuchen 2009-7-21
-
+
+
virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
mbOpened = sal_False;
@@ -2401,7 +2407,7 @@ public:
}
}
}
-
+
virtual void SAL_CALL windowDeactivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
if ( mpUserForm )
@@ -2468,15 +2474,14 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun )
Sequence< Any > aArguments;
triggerMethod( aMethodToRun, aArguments );
}
-void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& /*aArguments*/)
+void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
{
OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
// Search method
SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
if( pMeth )
- {
-#if IN_THE_FUTURE
- //liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters
+ {
+
if ( aArguments.getLength() > 0 ) // Setup parameters
{
SbxArrayRef xArray = new SbxArray;
@@ -2496,16 +2501,15 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
SbxValues aVals;
pMeth->Get( aVals );
-
+
for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
{
aArguments[i] = sbxToUnoValue( xArray->Get( static_cast< USHORT >(i) + 1) );
- }
+ }
pMeth->SetParameters( NULL );
}
else
-//liuchen 2009-7-21
-#endif
+
{
SbxValues aVals;
pMeth->Get( aVals );
@@ -2591,7 +2595,7 @@ void SbUserFormModule::Load()
InitObject();
}
-//liuchen 2009-7-21 change to accmordate VBA's beheavior
+
void SbUserFormModule::Unload()
{
OSL_TRACE("** Unload() ");
@@ -2607,11 +2611,14 @@ void SbUserFormModule::Unload()
triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams);
aParams[0] >>= nCancel;
- if (nCancel == 1)
+ // basic boolean ( and what the user might use ) can be ambiguous ( e.g. basic true = -1 )
+ // test agains 0 ( false ) and assume anything else is true
+ // ( Note: ) this used to work ( something changes somewhere )
+ if (nCancel != 0)
{
return;
}
-
+
if ( m_xDialog.is() )
{
triggerTerminateEvent();
@@ -2638,7 +2645,6 @@ void SbUserFormModule::Unload()
OSL_TRACE("UnloadObject completed ( we hope )");
}
}
-//liuchen
void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic );
@@ -2646,11 +2652,12 @@ void SbUserFormModule::InitObject()
{
try
{
+
String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
- SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
+ SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
if ( m_xModel.is() && pGlobs )
{
-
+
uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
uno::Sequence< uno::Any > aArgs(1);
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index c8e961af1e..e3f6687c83 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -164,8 +164,6 @@ void SbiCodeGen::Save()
rMod.bIsProxyModule = false;
}
- if( pParser->bText )
- p->SetFlag( SBIMG_COMPARETEXT );
// GlobalCode-Flag
if( pParser->HasGlobalCode() )
p->SetFlag( SBIMG_INITCODE );
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index e591fece78..e3c46093fc 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -1,7 +1,8 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -34,10 +35,13 @@
SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
-// Deklaration einer Variablen
-// Bei Fehlern wird bis zum Komma oder Newline geparst.
-// Returnwert: eine neue Instanz, die eingefuegt und dann geloescht wird.
-// Array-Indexe werden als SbiDimList zurueckgegeben
+
+SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
+
+// Declaration of a variable
+// If there are errors it will be parsed up to the comma or the newline.
+// Return-value: a new instance, which were inserted and then deleted.
+// Array-Indexex were returned as SbiDimList
SbiSymDef* SbiParser::VarDecl( SbiDimList** ppDim, BOOL bStatic, BOOL bConst )
{
@@ -258,7 +262,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
else if( eCurTok == DECLARE )
{
Next();
- DefDeclare( bPrivate );
+ DefDeclare( bPrivate );
return;
}
// #i109049
@@ -509,7 +513,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
// i.e., pPool had to be reset always at the end of the loop.
// also at a break
pPool = pOldPool;
- continue; // MyBreak überspingen
+ continue; // Skip MyBreak
MyBreak:
pPool = pOldPool;
break;
@@ -611,7 +615,7 @@ void SbiParser::DefType( BOOL bPrivate )
SbxProperty *pTypeElem = new SbxProperty( aElemName, eElemType );
if( pDim )
{
- SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
+ SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
if ( pDim->GetSize() )
{
// Dimension the target array
@@ -632,15 +636,15 @@ void SbiParser::DefType( BOOL bPrivate )
}
else if ( !bCompatible )
ub += nBase;
- pArray->AddDim32( lb, ub );
+ pArray->AddDim32( lb, ub );
}
pArray->setHasFixedSize( true );
}
else
pArray->unoAddDim( 0, -1 ); // variant array
USHORT nSavFlags = pTypeElem->GetFlags();
- // need to reset the FIXED flag
- // when calling PutObject ( because the type will not match Object )
+ // need to reset the FIXED flag
+ // when calling PutObject ( because the type will not match Object )
pTypeElem->ResetFlag( SBX_FIXED );
pTypeElem->PutObject( pArray );
pTypeElem->SetFlags( nSavFlags );
diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx
index e38a072808..4113ae72ca 100644
--- a/basic/source/comp/exprgen.cxx
+++ b/basic/source/comp/exprgen.cxx
@@ -207,7 +207,7 @@ void SbiExprList::Gen()
if( pFirst )
{
pParser->aGen.Gen( _ARGC );
- // AB 10.1.96: Typ-Anpassung bei DECLARE
+ // From 1996-01-10: Type adjustment at DECLARE
USHORT nCount = 1 /*, nParAnz = 0*/;
// SbiSymPool* pPool = NULL;
for( SbiExpression* pExpr = pFirst; pExpr; pExpr = pExpr->pNext,nCount++ )
@@ -220,13 +220,13 @@ void SbiExprList::Gen()
pParser->aGen.Gen( _ARGN, nSid );
/* TODO: Check after Declare concept change
- // AB 10.1.96: Typanpassung bei named -> passenden Parameter suchen
+ // From 1996-01-10: Type adjustment at named -> search suitable parameter
if( pProc )
{
// For the present: trigger an error
pParser->Error( SbERR_NO_NAMED_ARGS );
- // Spaeter, wenn Named Args bei DECLARE moeglich
+ // Later, if Named Args at DECLARE is posible
//for( USHORT i = 1 ; i < nParAnz ; i++ )
//{
// SbiSymDef* pDef = pPool->Get( i );
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index 01e7b74eb7..542fdaeba6 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -111,11 +111,6 @@ SbiExprNode::SbiExprNode( SbiParser* p, USHORT nId )
nTypeStrId = nId;
}
- eType = SbxOBJECT;
- eNodeType = SbxNEW;
- nTypeStrId = nId;
-}
-
// From 1995-12-17, auxiliary function for Ctor for the uniform initialisation
void SbiExprNode::BaseInit( SbiParser* p )
{
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 9b45590a60..b492c794e0 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -47,7 +47,7 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
nParenLevel = 0;
eCurExpr = t;
m_eMode = eMode;
- pNext = NULL;
+ pNext = NULL;
pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean();
if( t != SbSYMBOL )
pExpr->Optimize();
@@ -440,7 +440,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
bError |= !pPar->IsValid();
eTok = pParser->Peek();
}
-
+
}
BOOL bObj = BOOL( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() );
if( bObj )
@@ -740,6 +740,7 @@ SbiExprNode* SbiExpression::Comp()
return pNd;
}
+
SbiExprNode* SbiExpression::VBA_Not()
{
SbiExprNode* pNd = NULL;
@@ -757,9 +758,96 @@ SbiExprNode* SbiExpression::VBA_Not()
return pNd;
}
+SbiExprNode* SbiExpression::VBA_And()
+{
+ SbiExprNode* pNd = VBA_Not();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != AND )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Not() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Or()
+{
+ SbiExprNode* pNd = VBA_And();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != OR )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_And() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Xor()
+{
+ SbiExprNode* pNd = VBA_Or();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != XOR )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Or() );
+ }
+ }
+ return pNd;
+
+}
+
+SbiExprNode* SbiExpression::VBA_Eqv()
+{
+ SbiExprNode* pNd = VBA_Xor();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != EQV )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Xor() );
+ }
+ }
+ return pNd;
+}
+
+SbiExprNode* SbiExpression::VBA_Imp()
+{
+ SbiExprNode* pNd = VBA_Eqv();
+ if( m_eMode != EXPRMODE_EMPTY_PAREN )
+ {
+ for( ;; )
+ {
+ SbiToken eTok = pParser->Peek();
+ if( eTok != IMP )
+ break;
+ eTok = pParser->Next();
+ pNd = new SbiExprNode( pParser, pNd, eTok, VBA_Eqv() );
+ }
+ }
+ return pNd;
+
+}
+
SbiExprNode* SbiExpression::Like()
{
- SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp();
+ SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Imp() : Comp();
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
short nCount = 0;
diff --git a/basic/source/comp/makefile.mk b/basic/source/comp/makefile.mk
index a9f8f60fa9..5fe64ceae0 100644
--- a/basic/source/comp/makefile.mk
+++ b/basic/source/comp/makefile.mk
@@ -35,25 +35,22 @@ TARGET=comp
.INCLUDE : settings.mk
SLOFILES= \
- $(SLO)$/buffer.obj \
- $(SLO)$/codegen.obj \
- $(SLO)$/dim.obj \
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/buffer.obj \
$(SLO)$/exprgen.obj \
$(SLO)$/exprnode.obj \
- $(SLO)$/exprtree.obj \
- $(SLO)$/io.obj \
+ $(SLO)$/io.obj \
$(SLO)$/loops.obj \
- $(SLO)$/parser.obj \
- $(SLO)$/sbcomp.obj \
- $(SLO)$/scanner.obj \
+ $(SLO)$/sbcomp.obj \
$(SLO)$/symtbl.obj \
$(SLO)$/token.obj
EXCEPTIONSFILES= \
- $(SLO)$/codegen.obj \
- $(SLO)$/dim.obj \
- $(SLO)$/exprtree.obj \
- $(SLO)$/parser.obj
+ $(SLO)$/codegen.obj \
+ $(SLO)$/dim.obj \
+ $(SLO)$/exprtree.obj \
+ $(SLO)$/parser.obj \
+ $(SLO)$/scanner.obj
# --- Targets --------------------------------------------------------------
diff --git a/basic/source/inc/errobject.hxx b/basic/source/inc/errobject.hxx
index 39e6e319ca..1e94a3927e 100644
--- a/basic/source/inc/errobject.hxx
+++ b/basic/source/inc/errobject.hxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,3 +51,5 @@ public:
throw (com::sun::star::uno::RuntimeException);
};
#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx
index ee886e8df0..7aeab031f0 100644
--- a/basic/source/inc/expr.hxx
+++ b/basic/source/inc/expr.hxx
@@ -190,6 +190,11 @@ protected:
SbiExprNode* Cat();
SbiExprNode* Like();
SbiExprNode* VBA_Not();
+ SbiExprNode* VBA_And();
+ SbiExprNode* VBA_Or();
+ SbiExprNode* VBA_Xor();
+ SbiExprNode* VBA_Eqv();
+ SbiExprNode* VBA_Imp();
SbiExprNode* Comp();
SbiExprNode* Boolean();
public:
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index b9c54465ec..86df4f6390 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -36,6 +36,7 @@
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/XLibraryContainerExport.hpp>
+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
#include <com/sun/star/script/XLibraryContainer3.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -60,6 +61,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/compbase8.hxx>
+#include <cppuhelper/compbase9.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -68,13 +70,14 @@ class BasicManager;
namespace basic
{
-typedef ::cppu::WeakComponentImplHelper8<
+typedef ::cppu::WeakComponentImplHelper9<
::com::sun::star::lang::XInitialization,
::com::sun::star::script::XStorageBasedLibraryContainer,
::com::sun::star::script::XLibraryContainerPassword,
::com::sun::star::script::XLibraryContainerExport,
::com::sun::star::script::XLibraryContainer3,
::com::sun::star::container::XContainer,
+ ::com::sun::star::script::XLibraryQueryExecutable,
::com::sun::star::script::vba::XVBACompatibility,
::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
@@ -222,6 +225,7 @@ class SfxLibraryContainer :public LibraryContainerHelper
,public ::utl::OEventListenerAdapter
{
sal_Bool mbVBACompat;
+ rtl::OUString msProjectName;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
@@ -285,17 +289,17 @@ protected:
virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) = 0;
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
virtual void SAL_CALL writeLibraryElement
- (
+ (
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
- const ::rtl::OUString& aElementName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
+ const ::rtl::OUString& aElementName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
)
throw(::com::sun::star::uno::Exception) = 0;
virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
- (
+ (
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
- const ::rtl::OUString& aElementName,
+ const ::rtl::OUString& aElementName,
const ::rtl::OUString& aFile,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) = 0;
virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0;
@@ -415,9 +419,9 @@ public:
virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
//Methods XLibraryContainer3
- virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainer2 (base of XPersistentLibraryContainer)
@@ -511,6 +515,8 @@ public:
// Methods XVBACompatibility
virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getProjectName() throw (::com::sun::star::uno::RuntimeException) { return msProjectName; }
+ virtual void SAL_CALL setProjectName( const ::rtl::OUString& _projectname ) throw (::com::sun::star::uno::RuntimeException);
};
class LibraryContainerMethodGuard
@@ -560,7 +566,7 @@ private:
::rtl::OUString maStorageURL;
::rtl::OUString maUnexpandedStorageURL;
::rtl::OUString maOrignialStorageURL;
-
+
sal_Bool mbLink;
sal_Bool mbReadOnly;
sal_Bool mbReadOnlyLink;
diff --git a/basic/source/inc/propacc.hxx b/basic/source/inc/propacc.hxx
index 938796ba39..7f88e28f99 100644
--- a/basic/source/inc/propacc.hxx
+++ b/basic/source/inc/propacc.hxx
@@ -29,7 +29,6 @@
#define _SFX_PROPBAG_HXX
#include <svl/svarray.hxx>
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index b6b92017f8..bf25a17421 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -432,6 +432,7 @@ class SbiRuntime
void StepFIND_CM( UINT32, UINT32 );
void StepFIND_STATIC( UINT32, UINT32 );
void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 );
+ void implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 );
public:
void SetVBAEnabled( bool bEnabled );
USHORT GetImageFlag( USHORT n ) const;
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 5b25c4787a..109bb079b1 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -39,8 +39,8 @@
#include <com/sun/star/beans/XIntrospection.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/reflection/XIdlClass.hpp>
-#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
-#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
+#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
+#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
#include <rtl/ustring.hxx>
#include <hash_map>
@@ -114,7 +114,7 @@ class SbUnoMethod : public SbxMethod
public:
TYPEINFO();
- SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
+ SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
bool bInvocation,
bool bDirect = false );
virtual ~SbUnoMethod();
@@ -236,7 +236,7 @@ public:
{ return m_xServiceCtorDesc; }
};
-
+
// Wrapper for UNO Singleton
class SbUnoSingleton : public SbxObject
{
diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk
index a22ff2e884..ec0d297834 100644
--- a/basic/source/runtime/makefile.mk
+++ b/basic/source/runtime/makefile.mk
@@ -40,21 +40,21 @@ ENABLE_EXCEPTIONS = TRUE
# --- Allgemein -----------------------------------------------------------
SLOFILES= \
- $(SLO)$/basrdll.obj \
- $(SLO)$/comenumwrapper.obj \
- $(SLO)$/inputbox.obj \
- $(SLO)$/runtime.obj \
- $(SLO)$/step0.obj \
- $(SLO)$/step1.obj \
- $(SLO)$/step2.obj \
- $(SLO)$/iosys.obj \
- $(SLO)$/stdobj.obj \
- $(SLO)$/stdobj1.obj \
- $(SLO)$/methods.obj \
- $(SLO)$/methods1.obj \
- $(SLO)$/props.obj \
- $(SLO)$/ddectrl.obj \
- $(SLO)$/dllmgr.obj
+ $(SLO)$/basrdll.obj \
+ $(SLO)$/comenumwrapper.obj \
+ $(SLO)$/inputbox.obj\
+ $(SLO)$/runtime.obj \
+ $(SLO)$/step0.obj \
+ $(SLO)$/step1.obj \
+ $(SLO)$/step2.obj \
+ $(SLO)$/iosys.obj \
+ $(SLO)$/stdobj.obj \
+ $(SLO)$/stdobj1.obj \
+ $(SLO)$/methods.obj \
+ $(SLO)$/methods1.obj\
+ $(SLO)$/props.obj \
+ $(SLO)$/ddectrl.obj \
+ $(SLO)$/dllmgr.obj
.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
SLOFILES+= $(SLO)$/wnt.obj
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 8ecf22555e..d314e0f2f3 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -104,7 +104,9 @@ using namespace com::sun::star::script;
#include <stdlib.h>
#include <ctype.h>
+SbxVariable* getDefaultProp( SbxVariable* pRef );
#if defined (WNT) || defined (OS2)
+
#include <direct.h> // _getdcwd get current work directory, _chdrive
#endif
@@ -117,8 +119,8 @@ using namespace com::sun::star::script;
#include <io.h>
#endif
-#include <basic/sbobjmod.hxx>
+#include <basic/sbobjmod.hxx>
static void FilterWhiteSpace( String& rStr )
{
rStr.EraseAllChars( ' ' );
@@ -213,7 +215,7 @@ static com::sun::star::uno::Reference< XSimpleFileAccess3 > getFileAccess( void
if( xSMgr.is() )
{
xSFI = com::sun::star::uno::Reference< XSimpleFileAccess3 >( xSMgr->createInstance
- ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
}
}
return xSFI;
@@ -3448,8 +3450,8 @@ RTLFUNC(Shell)
}
else
{
- USHORT nOptions = vos::OProcess::TOption_SearchPath|
- vos::OProcess::TOption_Detached;
+ oslProcessOption nOptions = osl_Process_SEARCHPATH | osl_Process_DETACHED;
+
String aCmdLine = rPar.Get(1)->GetString();
// Zusaetzliche Parameter anhaengen, es muss eh alles geparsed werden
if( nArgCount >= 4 )
@@ -3526,26 +3528,23 @@ RTLFUNC(Shell)
nWinStyle = rPar.Get(2)->GetInteger();
switch( nWinStyle )
{
- case 2:
- nOptions |= vos::OProcess::TOption_Minimized;
- break;
- case 3:
- nOptions |= vos::OProcess::TOption_Maximized;
- break;
- case 10:
- nOptions |= vos::OProcess::TOption_FullScreen;
- break;
+ case 2:
+ nOptions |= osl_Process_MINIMIZED;
+ break;
+ case 3:
+ nOptions |= osl_Process_MAXIMIZED;
+ break;
+ case 10:
+ nOptions |= osl_Process_FULLSCREEN;
+ break;
}
BOOL bSync = FALSE;
if( nArgCount >= 5 )
bSync = rPar.Get(4)->GetBool();
if( bSync )
- nOptions |= vos::OProcess::TOption_Wait;
+ nOptions |= osl_Process_WAIT;
}
- vos::OProcess::TProcessOption eOptions =
- (vos::OProcess::TProcessOption)nOptions;
-
// #72471 Parameter aufbereiten
std::list<String>::const_iterator iter = aTokenList.begin();
@@ -3570,33 +3569,35 @@ RTLFUNC(Shell)
}
}
- //const char* pParams = aParams.Len() ? aParams.GetStr() : 0;
- vos::OProcess* pApp;
- pApp = new vos::OProcess( aOUStrProgUNC );
- BOOL bSucc;
- if( nParamCount == 0 )
+ oslProcess pApp;
+ BOOL bSucc = osl_executeProcess(
+ aOUStrProgUNC.pData,
+ pParamList,
+ nParamCount,
+ nOptions,
+ NULL,
+ NULL,
+ NULL, 0,
+ &pApp ) == osl_Process_E_None;
+
+ osl_freeProcessHandle( pApp );
+
+ for(int j = 0; i < nParamCount; i++)
{
- bSucc = pApp->execute( eOptions ) == vos::OProcess::E_None;
+ rtl_uString_release(pParamList[j]);
+ pParamList[j] = NULL;
}
long nResult = 0;
// We should return the identifier of the executing process when is running VBA, because method Shell(...) returns it in Excel.
if ( bSucc && SbiRuntime::isVBAEnabled())
{
- vos::OArgumentList aArgList( pArgumentList, nParamCount );
- bSucc = pApp->execute( eOptions, aArgList ) == vos::OProcess::E_None;
+ oslProcessInfo aInfo;
+ aInfo.Size = sizeof(oslProcessInfo);
+ osl_getProcessInfo( pApp, osl_Process_IDENTIFIER, &aInfo );
+ nResult = aInfo.Ident;
}
- /*
- if( nParamCount == 0 )
- pApp = new vos::OProcess( pProg );
- else
- pApp = new vos::OProcess( pProg, pParamList, nParamCount );
- BOOL bSucc = pApp->execute( eOptions ) == vos::OProcess::E_None;
- */
-
- delete pApp;
- delete[] pArgumentList;
if( !bSucc )
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
else
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 645f615ef7..c7a72c3478 100755
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -36,7 +36,6 @@
#include <vcl/timer.hxx>
#include <basic/sbxvar.hxx>
#include <basic/sbx.hxx>
-#endif
#include <svl/zforlist.hxx>
#include <tools/fsys.hxx>
#include <tools/urlobj.hxx>
@@ -644,14 +643,11 @@ RTLFUNC(DoEvents)
(void)pBasic;
(void)bWrite;
(void)rPar;
- // Dummy implementation as the following code leads
- // to performance problems for unknown reasons
- //Timer aTimer;
- //aTimer.SetTimeout( 1 );
- //aTimer.Start();
- //while ( aTimer.IsActive() )
- // Application::Reschedule();
- Application::Reschedule( true );
+// don't undstand what upstream are up to
+// we already process application events etc. in between
+// basic runtime pcode ( on a timed basis )
+ // always return 0
+ rPar.Get(0)->PutInteger( 0 );
}
RTLFUNC(GetGUIVersion)
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index ddce051697..2b05271696 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -48,6 +48,8 @@
#include "sbtrace.hxx"
#include "comenumwrapper.hxx"
+SbxVariable* getDefaultProp( SbxVariable* pRef );
+
using namespace ::com::sun::star;
bool SbiRuntime::isVBAEnabled()
@@ -56,7 +58,7 @@ bool SbiRuntime::isVBAEnabled()
SbiInstance* pInst = pINST;
if ( pInst && pINST->pRun )
result = pInst->pRun->bVBAEnabled;
- return result;
+ return result;
}
// #91147 Global reschedule flag
@@ -77,7 +79,7 @@ void StarBASIC::SetVBAEnabled( BOOL bEnabled )
BOOL StarBASIC::isVBAEnabled()
{
if ( bDocBasic )
- {
+ {
if( SbiRuntime::isVBAEnabled() )
return TRUE;
return bVBAEnabled;
@@ -602,7 +604,14 @@ SbiRuntime::~SbiRuntime()
void SbiRuntime::SetVBAEnabled(bool bEnabled )
{
- bVBAEnabled = bEnabled;
+ bVBAEnabled = bEnabled;
+ if ( bVBAEnabled )
+ {
+ if ( pMeth )
+ mpExtCaller = pMeth->mCaller;
+ }
+ else
+ mpExtCaller = 0;
}
// Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
@@ -933,7 +942,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
DBG_ASSERT( nTmp, "No VB error!" );
#endif
- StarBASIC::MakeErrorText( nError, rMsg );
+ StarBASIC::MakeErrorText( nError, rMsg );
rMsg = StarBASIC::GetErrorText();
if ( !rMsg.Len() ) // no message for err no, need localized resource here
rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 4f9e726df8..11f6b6bd8d 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -266,7 +266,7 @@ static Methods aMethods[] = {
{ "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir),0 },
{ "FileSpec", SbxSTRING, _OPT, NULL,0 },
{ "attrmask", SbxINTEGER, _OPT, NULL,0 },
-{ "DoEvents", SbxEMPTY, _FUNCTION, RTLNAME(DoEvents),0 },
+{ "DoEvents", SbxINTEGER, _FUNCTION, RTLNAME(DoEvents),0 },
{ "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects),0 },
{ "FileSpec", SbxSTRING, 0,NULL,0 },
{ "DumpAll", SbxINTEGER, _OPT, NULL,0 },
@@ -842,7 +842,7 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
return pVar;
}
-// SetModified muß bei der RTL abgklemmt werden
+// SetModified mu� bei der RTL abgklemmt werden
void SbiStdObject::SetModified( BOOL )
{
}
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index d563c91efe..6e456d3782 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -55,6 +55,11 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
+// for a patch forward declaring these methods below makes sense
+// but, #FIXME lets really just move the methods to the top
+void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
+void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
+
SbxVariable* getDefaultProp( SbxVariable* pRef );
void SbiRuntime::StepNOP()
@@ -545,7 +550,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// if it is then use the object not the default property
SbxObject* pObj = NULL;
-
+
pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
// calling GetObject on a SbxEMPTY variable raises
@@ -562,8 +567,8 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
if ( pDflt )
refVal = pDflt;
}
- }
-
+ }
+
// Handle Dim As New
BOOL bDimAsNew = bVBAEnabled && refVar->IsSet( SBX_DIM_AS_NEW );
SbxBaseRef xPrevVarObj;
@@ -661,7 +666,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
- // in this case if there is a default prop involved the value of the
+ // in this case if there is a default prop involved the value of the
// default property may infact be void so the type will also be SbxEMPTY
// in this case we do not want to call checkUnoStructCopy 'cause that will
// cause an error also
@@ -1429,7 +1434,7 @@ void SbiRuntime::StepERROR()
SbxVariableRef refCode = PopVar();
USHORT n = refCode->GetUShort();
SbError error = StarBASIC::GetSfxFromVBError( n );
- if ( bVBAEnabled )
+ if ( bVBAEnabled )
pInst->Error( error );
else
Error( error );
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index 1e8a3a7426..adecfa0410 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -120,8 +120,8 @@ void SbiRuntime::StepARGTYP( UINT32 nOp1 )
SbxDataType t = (SbxDataType) (nOp1 & 0x7FFF);
SbxVariable* pVar = refArgv->Get( refArgv->Count() - 1 ); // letztes Arg
- // BYVAL prüfen
- if( pVar->GetRefCount() > 2 ) // 2 ist normal für BYVAL
+ // BYVAL pr�fen
+ if( pVar->GetRefCount() > 2 ) // 2 ist normal f�r BYVAL
{
// Parameter ist eine Referenz
if( bByVal )
@@ -132,7 +132,7 @@ void SbiRuntime::StepARGTYP( UINT32 nOp1 )
refExprStk->Put( pVar, refArgv->Count() - 1 );
}
else
- pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag für DllMgr
+ pVar->SetFlag( SBX_REFERENCE ); // Ref-Flag f�r DllMgr
}
else
{
@@ -464,7 +464,7 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
return bRet;
}
-bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
+bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
const String& aClass, bool bRaiseErrors, bool bDefault )
{
bool bOk = bDefault;
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index fa055ac9f6..69ecec1dd1 100755
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -266,8 +266,8 @@ SbxVariable* SbiRuntime::FindElement
pElem = pNew;
}
// Index-Access bei UnoObjekten beruecksichtigen
- // definitely we want this for VBA where properties are often
- // collections ( which need index access ), but lets only do
+ // definitely we want this for VBA where properties are often
+ // collections ( which need index access ), but lets only do
// this if we actually have params following
else if( bVBAEnabled && pElem->ISA(SbUnoProperty) && pElem->GetParameters() )
{
@@ -718,7 +718,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
p = new SbxVariable();
if( SbiRuntime::isVBAEnabled() &&
- (t == SbxOBJECT || t == SbxSTRING) )
+ (t == SbxOBJECT || t == SbxSTRING) )
{
if( t == SbxOBJECT )
p->PutObject( NULL );
@@ -886,7 +886,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
// #29955 for-Schleifen-Ebene korrigieren, #67452 NICHT im Error-Handler sonst Chaos
if( !bInError )
{
- // (Bei Sprüngen aus Schleifen tritt hier eine Differenz auf)
+ // (Bei Spr�ngen aus Schleifen tritt hier eine Differenz auf)
USHORT nExspectedForLevel = static_cast<USHORT>( nOp2 / 0x100 );
if( pGosubStk )
nExspectedForLevel = nExspectedForLevel + pGosubStk->nStartForLvl;
@@ -898,7 +898,7 @@ void SbiRuntime::StepSTMNT( UINT32 nOp1, UINT32 nOp2 )
}
// 16.10.96: #31460 Neues Konzept fuer StepInto/Over/Out
- // Erklärung siehe bei _ImplGetBreakCallLevel.
+ // Erkl�rung siehe bei _ImplGetBreakCallLevel.
if( pInst->nCallLvl <= pInst->nBreakCallLvl )
//if( nFlags & SbDEBUG_STEPINTO )
{
@@ -1144,6 +1144,14 @@ void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nO
}
}
+void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 )
+{
+ USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000
+ String aStr;
+ aStr.Fill( nCount, 0 );
+ pStrVar->PutString( aStr );
+}
+
// Einrichten einer lokalen Variablen (+StringID+Typ)
void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
@@ -1213,11 +1221,11 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
- // Store module scope variables at module scope
+ // Store module scope variables at module scope
// in non vba mode these are stored at the library level :/
// not sure if this really should not be enabled for ALL basic
SbxObject* pStorage = &rBasic;
- if ( SbiRuntime::isVBAEnabled() )
+ if ( SbiRuntime::isVBAEnabled() )
{
pStorage = pMod;
pMod->AddVarName( aName );
diff --git a/basic/source/sbx/makefile.mk b/basic/source/sbx/makefile.mk
index 6ad2de5d4c..332c6a0d42 100644
--- a/basic/source/sbx/makefile.mk
+++ b/basic/source/sbx/makefile.mk
@@ -41,34 +41,34 @@ SRS1NAME=$(TARGET)
SRC1FILES= format.src
SLOFILES= \
- $(SLO)$/sbxbase.obj \
- $(SLO)$/sbxres.obj \
- $(SLO)$/sbxvalue.obj \
- $(SLO)$/sbxvals.obj \
- $(SLO)$/sbxvar.obj \
- $(SLO)$/sbxarray.obj \
- $(SLO)$/sbxobj.obj \
- $(SLO)$/sbxcoll.obj \
- $(SLO)$/sbxexec.obj \
- $(SLO)$/sbxint.obj \
- $(SLO)$/sbxlng.obj \
- $(SLO)$/sbxsng.obj \
- $(SLO)$/sbxmstrm.obj \
- $(SLO)$/sbxdbl.obj \
- $(SLO)$/sbxcurr.obj \
- $(SLO)$/sbxdate.obj \
- $(SLO)$/sbxstr.obj \
- $(SLO)$/sbxbool.obj \
- $(SLO)$/sbxchar.obj \
- $(SLO)$/sbxbyte.obj \
- $(SLO)$/sbxuint.obj \
- $(SLO)$/sbxulng.obj \
- $(SLO)$/sbxform.obj \
- $(SLO)$/sbxscan.obj \
- $(SLO)$/sbxdec.obj
+ $(EXCEPTIONSFILES) \
+ $(SLO)$/sbxbase.obj \
+ $(SLO)$/sbxbool.obj \
+ $(SLO)$/sbxbyte.obj \
+ $(SLO)$/sbxchar.obj \
+ $(SLO)$/sbxcoll.obj \
+ $(SLO)$/sbxdec.obj \
+ $(SLO)$/sbxform.obj \
+ $(SLO)$/sbxint.obj \
+ $(SLO)$/sbxlng.obj \
+ $(SLO)$/sbxmstrm.obj \
+ $(SLO)$/sbxobj.obj \
+ $(SLO)$/sbxres.obj \
+ $(SLO)$/sbxsng.obj \
+ $(SLO)$/sbxuint.obj \
+ $(SLO)$/sbxulng.obj \
+ $(SLO)$/sbxvar.obj
-EXCEPTIONSFILES=$(SLO)$/sbxarray.obj
+EXCEPTIONSFILES= \
+ $(SLO)$/sbxarray.obj \
+ $(SLO)$/sbxcurr.obj \
+ $(SLO)$/sbxdate.obj \
+ $(SLO)$/sbxdbl.obj \
+ $(SLO)$/sbxexec.obj \
+ $(SLO)$/sbxscan.obj \
+ $(SLO)$/sbxstr.obj \
+ $(SLO)$/sbxvalue.obj \
# --- Targets -------------------------------------------------------------
diff --git a/basic/source/sbx/sbxconv.hxx b/basic/source/sbx/sbxconv.hxx
index 3d2934e0f4..8f423452ab 100644
--- a/basic/source/sbx/sbxconv.hxx
+++ b/basic/source/sbx/sbxconv.hxx
@@ -39,7 +39,7 @@ extern SbxError ImpScan
( const ::rtl::OUString& rSrc, double& nVal, SbxDataType& rType, USHORT* pLen,
BOOL bAllowIntntl=FALSE, BOOL bOnlyIntntl=FALSE );
-// mit erweiterter Auswertung (International, "TRUE"/"FALSE")
+// with advanced evaluation (International, "TRUE"/"FALSE")
extern BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType );
// SBXINT.CXX
@@ -128,7 +128,7 @@ void ImpPutULong( SbxValues*, UINT32 );
enum SbxBOOL ImpGetBool( const SbxValues* );
void ImpPutBool( SbxValues*, INT16 );
-// ByteArry <--> String
+// ByteArray <--> String
SbxArray* StringToByteArray(const ::rtl::OUString& rStr);
::rtl::OUString ByteArrayToString(SbxArray* pArr);
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 1235a41129..5e89bbb683 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -36,8 +36,6 @@
#include <basic/sbxvar.hxx>
#include "sbxconv.hxx"
-static ::rtl::OUString ImpCurrencyToString( const SbxINT64& );
-static SbxINT64 ImpStringToCurrency( const ::rtl::OUString& );
static rtl::OUString ImpCurrencyToString( const sal_Int64 &rVal )
{
@@ -329,7 +327,7 @@ start:
case SbxSTRING:
case SbxLPSTR:
if( !p->pOUString )
- nRes.SetNull();
+ nRes=0;
else
nRes = ImpStringToCurrency( *p->pOUString );
break;
@@ -549,79 +547,4 @@ start:
}
}
-// Hilfs-Funktionen zur Wandlung
-
-static ::rtl::OUString ImpCurrencyToString( const SbxINT64 &r )
-{
- BigInt a10000 = 10000;
-
- //return GetpApp()->GetAppInternational().GetCurr( BigInt( r ), 4 );
- BigInt aInt( r );
- aInt.Abs();
- BigInt aFrac = aInt;
- aInt /= a10000;
- aFrac %= a10000;
- aFrac += a10000;
-
- ::rtl::OUString aString;
- if( r.nHigh < 0 )
- aString = ::rtl::OUString( (sal_Unicode)'-' );
- aString += aInt.GetString();
- aString += ::rtl::OUString( (sal_Unicode)'.' );
- aString += aFrac.GetString().GetBuffer()+1;
- return aString;
-}
-
-static SbxINT64 ImpStringToCurrency( const ::rtl::OUString &r )
-{
- int nDec = 4;
- String aStr;
- const sal_Unicode* p = r.getStr();
-
- if( *p == '-' )
- aStr += *p++;
-
- while( *p >= '0' && *p <= '9' ) {
- aStr += *p++;
- if( *p == ',' )
- p++;
- }
-
- if( *p == '.' ) {
- p++;
- while( nDec && *p >= '0' && *p <= '9' ) {
- aStr += *p++;
- nDec--;
- }
- }
- while( nDec ) {
- aStr += '0';
- nDec--;
- }
-
- BigInt aBig( aStr );
- SbxINT64 nRes;
- aBig.INT64( &nRes );
- return nRes;
-}
-
-double ImpINT64ToDouble( const SbxINT64 &r )
-{ return (double)r.nHigh*(double)4294967296.0 + (double)r.nLow; }
-
-SbxINT64 ImpDoubleToINT64( double d )
-{
- SbxINT64 nRes;
- nRes.Set( d );
- return nRes;
-}
-
-double ImpUINT64ToDouble( const SbxUINT64 &r )
-{ return (double)r.nHigh*(double)4294967296.0 + (double)r.nLow; }
-
-SbxUINT64 ImpDoubleToUINT64( double d )
-{
- SbxUINT64 nRes;
- nRes.Set( d );
- return nRes;
-}
-
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index 1a84221cc0..0235bc5ce2 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -89,7 +89,7 @@ static const xub_Unicode* Symbol( const xub_Unicode* p, XubString& rSym, const S
else
{
rSym = p;
- // Dann darf es Buchstaben, Zahlen oder Underlines enthalten
+ // The it can contain alphabetic characters, numbers or underlines
while( *p && (rCharClass.isAlphaNumeric( *p ) || *p == '_') )
p++, nLen++;
// BASIC-Standard-Suffixes were ignored
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index 197beeba40..40d426ce63 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 5fb1f8e6e3..f2539136b0 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -427,7 +427,7 @@ BOOL ImpConvStringExt( ::rtl::OUString& rSrc, SbxDataType eTargetType )
BOOL bChanged = FALSE;
::rtl::OUString aNewString;
- // Nur Spezial-Fälle behandeln, als Default tun wir nichts
+ // Nur Spezial-F�lle behandeln, als Default tun wir nichts
switch( eTargetType )
{
// Bei Fliesskomma International beruecksichtigen
diff --git a/basic/source/sbx/sbxstr.cxx b/basic/source/sbx/sbxstr.cxx
index f0cbe7ed0c..513e25f5fe 100644
--- a/basic/source/sbx/sbxstr.cxx
+++ b/basic/source/sbx/sbxstr.cxx
@@ -138,7 +138,7 @@
return aRes;
}
-// AB 10.4.97, neue Funktion fuer SbxValue::GetCoreString()
+// From 1997-04-10, new function for SbxValue::GetCoreString()
::rtl::OUString ImpGetCoreString( const SbxValues* p )
{
// For now only for double
@@ -162,7 +162,7 @@ void ImpPutString( SbxValues* p, const ::rtl::OUString* n )
SbxValues aTmp;
aTmp.eType = SbxSTRING;
::rtl::OUString* pTmp = NULL;
- // Sicherheitshalber, falls ein NULL-Ptr kommt
+ // as a precaution, if a NULL-Ptr appears
if( !n )
n = pTmp = new ::rtl::OUString;
aTmp.pOUString = (::rtl::OUString*)n;
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 70466ffd50..dff27f6947 100755
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -294,7 +294,7 @@ SbxValue* SbxValue::TheRealValue() const
return TheRealValue( TRUE );
}
-// #55226 Zusaetzliche Info transportieren
+// #55226 ship additional information
bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ); // sbunoobj.cxx
SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
@@ -666,16 +666,16 @@ BOOL SbxValue::Put( const SbxValues& rVal )
return bRes;
}
-// AB, 28.3.96:
-// Methode, um bei speziellen Typen eine Vorbehandlung des Strings
-// durchzufuehren. Insbesondere erforderlich fuer BASIC-IDE, damit
-// die Ausgaben im Watch-Fenster mit PutStringExt zurueckgeschrieben
-// werden koennen, wenn Floats mit ',' als Dezimaltrenner oder BOOLs
-// explizit mit "TRUE" oder "FALSE" angegeben werden.
-// Implementierung in ImpConvStringExt (SBXSCAN.CXX)
+// From 1996-03-28:
+// Method to execute a pretreatment of the strings at special types.
+// In particular necessary for BASIC-IDE, so that
+// the output in the Watch-Window can be writen back with PutStringExt,
+// if Float were declared with ',' as the decimal seperator or BOOl
+// explicit with "TRUE" or "FALSE".
+// Implementation in ImpConvStringExt (SBXSCAN.CXX)
BOOL SbxValue::PutStringExt( const ::rtl::OUString& r )
{
- // Kopieren, bei Unicode gleich konvertieren
+ // Copy; if it is Unicode convert it immediately
::rtl::OUString aStr( r );
// Identify the own type (not as in Put() with TheRealValue(),
@@ -1030,12 +1030,12 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
goto Lbl_OpIsEmpty;
Get( aL );
- // #30576: Erstmal testen, ob Wandlung geklappt hat
+ // #30576: To begin with test, if the conversion worked
if( aL.pOUString != NULL && aR.pOUString != NULL )
{
*aL.pOUString += *aR.pOUString;
}
- // Nicht einmal Left OK?
+ // Not even Left OK?
else if( aL.pOUString == NULL )
{
aL.pOUString = new ::rtl::OUString();
@@ -1574,7 +1574,7 @@ BOOL SbxValue::LoadData( SvStream& r, USHORT )
if( aVal.Len() )
aData.pOUString = new ::rtl::OUString( aVal );
else
- aData.pOUString = NULL; // JSM 22.09.1995
+ aData.pOUString = NULL; // JSM 1995-09-22
break;
}
case SbxERROR:
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index cb42234903..8d07850c16 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -73,7 +73,6 @@ class SbxVariableImpl
};
-///////////////////////////// Konstruktoren //////////////////////////////
SbxVariable::SbxVariable() : SbxValue()
{
@@ -426,7 +425,6 @@ void SbxVariable::ClearComListener( void )
}
-////////////////////////////// Laden/Speichern /////////////////////////////
BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
{
@@ -468,7 +466,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
rStrm >> aTmp.nLong; break;
case SbxSINGLE:
{
- // Floats als ASCII
+ // Floats as ASCII
rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
double d;
SbxDataType t;
@@ -483,7 +481,7 @@ BOOL SbxVariable::LoadData( SvStream& rStrm, USHORT nVer )
case SbxDATE:
case SbxDOUBLE:
{
- // Floats als ASCII
+ // Floats as ASCII
rStrm.ReadByteString( aTmpString, RTL_TEXTENCODING_ASCII_US );
SbxDataType t;
if( ImpScan( aTmpString, aTmp.nDouble, t, NULL ) != SbxERR_OK )
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index afb57078c2..105f1803ab 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -182,7 +182,7 @@ bool writeOasis2OOoLibraryElement(
xml::sax::InputSource source;
source.aInputStream = xInput;
- source.sSystemId = OUString::createFromAscii( "virtual file" );
+ source.sSystemId = OUString(RTL_CONSTASCII_USTRINGPARAM("virtual file"));
xParser->parseStream( source );
@@ -339,7 +339,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
( const Reference < XNameContainer >& /*xLib*/,
- const OUString& /*aElementName */, const OUString& aFile,
+ const OUString& /*aElementName */, const OUString& aFile,
const uno::Reference< io::XInputStream >& xElementStream )
{
Any aRetAny;
@@ -403,7 +403,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
try {
// start parsing
- xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
+ xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
xParser->parseStream( source );
}
catch( Exception& )
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 2daedc5a7c..0c3feee1e8 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -69,7 +69,7 @@
#include <comphelper/anytostring.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <basic/sbmod.hxx>
-
+#include <boost/scoped_ptr.hpp>
namespace basic
{
@@ -323,7 +323,7 @@ DBG_NAME( SfxLibraryContainer )
// Ctor
SfxLibraryContainer::SfxLibraryContainer( void )
: LibraryContainerHelper( maMutex )
- , mbVBACompat( sal_False )
+ , mbVBACompat( sal_False )
, maModifiable( *this, maMutex )
, maNameContainer( getCppuType( (Reference< XNameAccess >*) NULL ) )
, mbOldInfoFormat( sal_False )
@@ -1073,10 +1073,10 @@ sal_Bool SfxLibraryContainer::init_Impl(
mxSFI->move( aFolderUserBasic, aPrevFolder );
mxSFI->move( aFolderTmp, aFolderUserBasic );
- OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" );
- OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" );
- OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" );
- OUString aInstSearchStr = OUString::createFromAscii( "$(INST)" );
+ OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"));
+ OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"));
+ OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"));
+ OUString aInstSearchStr(RTL_CONSTASCII_USTRINGPARAM("$(INST)"));
Sequence< OUString > aNames = pPrevCont->getElementNames();
const OUString* pNames = aNames.getConstArray();
@@ -2175,9 +2175,9 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
maNameContainer.insertByName( Name, aElement );
maModifiable.setModified( sal_True );
- OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" );
- OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" );
- OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" );
+ OUString aUserSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"));
+ OUString aSharedSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE"));
+ OUString aBundledSearchStr(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"));
if( StorageURL.indexOf( aUserSearchStr ) != -1 )
{
pNewLib->mbExtension = sal_True;
@@ -2377,7 +2377,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
}
Reference< XNameContainer > xLib( pImplLib );
- Any aAny = importLibraryElement( xLib, aElementName,
+ Any aAny = importLibraryElement( xLib, aElementName,
aFile, xInStream );
if( pImplLib->hasByName( aElementName ) )
{
@@ -2795,7 +2795,7 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
OUString aRetStr = pImplLib->maOrignialStorageURL;
return aRetStr;
}
-
+
// XVBACompatibility
::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatibilityMode() throw (RuntimeException)
@@ -3182,7 +3182,7 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia
}
case BUNDLED_EXTENSIONS:
{
- Reference< deployment::XPackage > xScriptPackage =
+ Reference< deployment::XPackage > xScriptPackage =
implGetNextBundledScriptPackage( rbPureDialogLib );
if( !xScriptPackage.is() )
break;
@@ -3363,7 +3363,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript
Reference< XExtensionManager > xManager =
ExtensionManager::get( m_xContext );
m_aUserPackagesSeq = xManager->getDeployedExtensions
- (rtl::OUString::createFromAscii("user"),
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("user")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
@@ -3415,9 +3415,9 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri
try
{
Reference< XExtensionManager > xSharedManager =
- ExtensionManager::get( m_xContext );
+ ExtensionManager::get( m_xContext );
m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions
- (rtl::OUString::createFromAscii("shared"),
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("shared")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
@@ -3468,9 +3468,9 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
try
{
Reference< XExtensionManager > xManager =
- ExtensionManager::get( m_xContext );
+ ExtensionManager::get( m_xContext );
m_aBundledPackagesSeq = xManager->getDeployedExtensions
- (rtl::OUString::createFromAscii("bundled"),
+ (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bundled")),
Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() );
}
catch( com::sun::star::uno::DeploymentException& )
@@ -3492,7 +3492,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScr
{
const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray();
Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage ];
- VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" );
+ OSL_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" );
m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage );
}
diff --git a/basic/util/makefile.mk b/basic/util/makefile.mk
index 1ee30e2fef..635b293698 100644
--- a/basic/util/makefile.mk
+++ b/basic/util/makefile.mk
@@ -40,42 +40,40 @@ GEN_HID=TRUE
LIB1TARGET=$(SLB)$/sb.lib
LIB1FILES= \
- $(SLB)$/basicmgr.lib \
- $(SLB)$/classes.lib \
- $(SLB)$/comp.lib \
+ $(SLB)$/basicmgr.lib \
+ $(SLB)$/classes.lib \
+ $(SLB)$/comp.lib \
$(SLB)$/uno.lib \
- $(SLB)$/runtime.lib \
- $(SLB)$/sbx.lib
+ $(SLB)$/runtime.lib \
+ $(SLB)$/sbx.lib
SHL1TARGET= sb$(DLLPOSTFIX)
SHL1IMPLIB= basic
SHL1STDLIBS= \
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(TOOLSLIB) \
- $(SVTOOLLIB) \
- $(SVLLIB) \
- $(VCLLIB) \
- $(VOSLIB) \
- $(SALLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(TOOLSLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(VCLLIB) \
+ $(SALLIB) \
$(SALHELPERLIB) \
- $(COMPHELPERLIB) \
- $(UNOTOOLSLIB) \
- $(SOTLIB) \
- $(VOSLIB) \
- $(XMLSCRIPTLIB)
+ $(COMPHELPERLIB) \
+ $(UNOTOOLSLIB) \
+ $(SOTLIB) \
+ $(XMLSCRIPTLIB)
.IF "$(GUI)"=="WNT"
SHL1STDLIBS+= \
- $(UWINAPILIB) \
- $(OLEAUT32LIB)
+ $(UWINAPILIB) \
+ $(OLEAUT32LIB)
.ENDIF # WNT
.IF "$(GUI)" != "UNX"
.IF "$(COM)" != "GCC"
SHL1OBJS= \
- $(SLO)$/sb.obj
+ $(SLO)$/sb.obj
.ENDIF
.ENDIF
@@ -84,7 +82,7 @@ SHL1LIBS= $(SLB)$/sb.lib
DEF1NAME =$(SHL1TARGET)
DEF1DEPN = \
- $(MISC)$/$(SHL1TARGET).flt
+ $(MISC)$/$(SHL1TARGET).flt
DEFLIB1NAME =sb
DEF1DES =StarBasic
@@ -92,8 +90,8 @@ DEF1DES =StarBasic
RES1TARGET=$(PRJNAME)
SRS1FILES= \
- $(SRS)$/classes.srs \
- $(SRS)$/sbx.srs
+ $(SRS)$/classes.srs \
+ $(SRS)$/sbx.srs
# --- TESTTOOL IDE ------------------------------------------------------
# The resources are linked here
@@ -101,13 +99,13 @@ SRS1FILES= \
RESLIB1NAME=stt
RESLIB1IMAGES=$(PRJ)$/res
RESLIB1SRSFILES= \
- $(SRS)$/app.srs
+ $(SRS)$/app.srs
RESLIB2NAME=sb
RESLIB2IMAGES=$(PRJ)$/res
RESLIB2SRSFILES= \
- $(SRS)$/classes.srs \
- $(SRS)$/sbx.srs
+ $(SRS)$/classes.srs \
+ $(SRS)$/sbx.srs
########## remove sbx.srx (and this line) when issue i53795 is fixed
# --- Targets -----------------------------------------------------------
@@ -124,20 +122,20 @@ RESLIB2SRSFILES= \
# --- Basic-Filter-Datei ---
$(MISC)$/$(SHL1TARGET).flt: makefile.mk
- @echo ------------------------------
- @echo Making: $@
- @echo WEP > $@
- @echo LIBMAIN >> $@
- @echo LibMain >> $@
- @echo Sbi >> $@
- @echo SvRTL >> $@
- @echo SbRtl_ >> $@
- @echo exception >> $@
- @echo bad_alloc >> $@
- @echo __CT >> $@
+ @echo ------------------------------
+ @echo Making: $@
+ @echo WEP > $@
+ @echo LIBMAIN >> $@
+ @echo LibMain >> $@
+ @echo Sbi >> $@
+ @echo SvRTL >> $@
+ @echo SbRtl_ >> $@
+ @echo exception >> $@
+ @echo bad_alloc >> $@
+ @echo __CT >> $@
$(SRS)$/basic.srs:
- $(TYPE) $(SRS)$/classes.srs + $(SRS)$/runtime.srs + $(SRS)$/sbx.srs > $@
+ $(TYPE) $(SRS)$/classes.srs + $(SRS)$/runtime.srs + $(SRS)$/sbx.srs > $@
ALLTAR : $(MISC)/sb.component
diff --git a/basic/workben/makefile.mk b/basic/workben/makefile.mk
index 5ecce0917d..7eb5da3d91 100644
--- a/basic/workben/makefile.mk
+++ b/basic/workben/makefile.mk
@@ -39,19 +39,18 @@ TARGETTYPE=GUI
APP1TARGET=$(PRJNAME)app
APP1STDLIBS= \
- $(SALLIB) \
- $(TOOLSLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB) \
$(UNOTOOLSLIB) \
- $(SVTOOLLIB) \
- $(SVLLIB) \
- $(VCLLIB) \
- $(COMPHELPERLIB) \
- $(UCBHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SJLIB) \
- $(SOTLIB) \
- $(VOSLIB)
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(VCLLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SOTLIB) \
+
#.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC"
#APP1STDLIBS+=$(CPPULIB)
@@ -64,14 +63,14 @@ APP1STDLIBS= \
.IF "$(GUI)"!="OS2"
APP1LIBS= \
- $(LB)$/basic.lib
+ $(LB)$/basic.lib
.ENDIF
APP1LIBS+= \
- $(LB)$/app.lib \
- $(LB)$/sample.lib
+ $(LB)$/app.lib \
+ $(LB)$/sample.lib
.IF "$(GUI)"=="UNX" || "$(GUI)"=="OS2"
APP1STDLIBS+= \
- $(BASICLIB)
+ $(BASICLIB)
.ENDIF
@@ -81,8 +80,8 @@ APP1OBJS = $(OBJ)$/ttbasic.obj
.IF "$(GUI)" != "UNX"
APP1OBJS+= \
- $(OBJ)$/app.obj \
- $(SLO)$/sbintern.obj
+ $(OBJ)$/app.obj \
+ $(SLO)$/sbintern.obj
.ENDIF
.INCLUDE : target.mk