diff options
author | Caolán McNamara <cmc@openoffice.org> | 2010-08-03 10:25:58 +0100 |
---|---|---|
committer | Caolán McNamara <cmc@openoffice.org> | 2010-08-03 10:25:58 +0100 |
commit | 8508eaf41b74b321f769bdd373e4bf2b98a9644f (patch) | |
tree | 600463cf6a3e735e26e747829bdf60461f01875b | |
parent | 536570325d39dfc9559640b13800f976725ac2c3 (diff) | |
parent | 0e6f37318dd855bd04e3281435d1af751398c98f (diff) |
cmcfixes77: merge with DEV300 m86
115 files changed, 4114 insertions, 878 deletions
diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst index 1ef04ca0f7d5..6651d9d74f8f 100644 --- a/avmedia/prj/build.lst +++ b/avmedia/prj/build.lst @@ -6,6 +6,6 @@ av avmedia\source\viewer nmake - all av_viewer NULL av avmedia\source\framework nmake - all av_framework NULL av avmedia\source\win nmake - all av_win NULL av avmedia\source\java nmake - all av_java NULL -av avmedia\source\xine nmake - all av_xine NULL av avmedia\source\quicktime nmake - all av_quicktime NULL -av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_xine NULL +av avmedia\source\gstreamer nmake - all av_gstreamer NULL +av avmedia\util nmake - all av_util av_viewer av_framework av_win av_java av_quicktime av_gstreamer NULL diff --git a/avmedia/source/framework/mediacontrol.cxx b/avmedia/source/framework/mediacontrol.cxx index a71b5268abd7..2eb18cb164d9 100644 --- a/avmedia/source/framework/mediacontrol.cxx +++ b/avmedia/source/framework/mediacontrol.cxx @@ -91,8 +91,6 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : if( MEDIACONTROLSTYLE_SINGLELINE != meControlStyle ) { - - maPlayToolBox.InsertItem( AVMEDIA_TOOLBOXITEM_OPEN, implGetImage( AVMEDIA_IMG_OPEN ), String( AVMEDIA_RESID( AVMEDIA_STR_OPEN ) ) ); maPlayToolBox.SetHelpId( AVMEDIA_TOOLBOXITEM_OPEN, HID_AVMEDIA_TOOLBOXITEM_OPEN ); @@ -103,8 +101,6 @@ MediaControl::MediaControl( Window* pParent, MediaControlStyle eControlStyle ) : } else { - maTimeSlider.SetBackground(); - maVolumeSlider.SetBackground(); mpZoomListBox->SetBackground(); maZoomToolBox.SetBackground(); diff --git a/avmedia/source/gstreamer/exports.dxp b/avmedia/source/gstreamer/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/avmedia/source/gstreamer/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/avmedia/source/gstreamer/gstcommon.hxx b/avmedia/source/gstreamer/gstcommon.hxx new file mode 100644 index 000000000000..83bb818aefdc --- /dev/null +++ b/avmedia/source/gstreamer/gstcommon.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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 + * + * 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 <osl/mutex.hxx> +#include <rtl/ustring.hxx> +#include <tools/debug.hxx> +#include <tools/stream.hxx> +#include <tools/string.hxx> +#include <tools/urlobj.hxx> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.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> + +#include <memory> + +#define AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Manager_GStreamer" +#define AVMEDIA_GSTREAMER_MANAGER_SERVICENAME "com.sun.star.media.Manager_GStreamer" + +#define AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_GStreamer" +#define AVMEDIA_GSTREAMER_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer" + +#define AVMEDIA_GSTREAMER_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_GStreamer" +#define AVMEDIA_GSTREAMER_WINDOW_SERVICENAME "com.sun.star.media.Window_GStreamer" + +#define AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_GStreamer" +#define AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_GStreamer" + +#endif // _GSTCOMMOM_HXX diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx new file mode 100644 index 000000000000..bd55e11f8afe --- /dev/null +++ b/avmedia/source/gstreamer/gstframegrabber.cxx @@ -0,0 +1,307 @@ +/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#include "gstframegrabber.hxx" +#include "gstplayer.hxx" + +#include <vcl/graph.hxx> +#include <vcl/bmpacc.hxx> + +using namespace ::com::sun::star; + +namespace avmedia { namespace gst { + +const gulong GRAB_TIMEOUT = 10000000; + +// ---------------- +// - FrameGrabber - +// ---------------- + +FrameGrabber::FrameGrabber( GString* pURI ) : + Player( pURI ), + mpFrameMutex( g_mutex_new() ), + mpFrameCond( g_cond_new() ), + mpLastPixbuf( NULL ), + mbIsInGrabMode( false ) +{ +} + +// ------------------------------------------------------------------------------ + +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 ); +} + +// ------------------------------------------------------------------------------ + +FrameGrabber* FrameGrabber::create( const GString* pURI ) +{ + FrameGrabber* pFrameGrabber = NULL; + + if( pURI && pURI->len ) + { + // safely initialize GLib threading framework + try + { + if( !g_thread_supported() ) + { + g_thread_init( NULL ); + } + } + catch( ... ) + {} + + if( g_thread_supported() ) + { + 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 + { + g_object_set( pFrameGrabber->mpPlayer, "audio-sink", gst_element_factory_make( "fakesink", NULL ), NULL ); + g_object_set( pFrameGrabber->mpPlayer, "video-sink", pPixbufSink, NULL ); + } + } + } + + return( pFrameGrabber ); +} + +// ------------------------------------------------------------------------------ + +gboolean FrameGrabber::busCallback( GstBus* pBus, GstMessage* pMsg ) +{ + bool bDone = false; + + if( pMsg && pMsg->structure ) + { + 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; + } + } + + return( bDone || Player::busCallback( pBus, pMsg ) ); +} + +// ------------------------------------------------------------------------------ + +uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime ) + throw (uno::RuntimeException) +{ + uno::Reference< graphic::XGraphic > xRet; + + if( implInitPlayer() ) + { + 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(); + + if( isPlaying() ) + { + g_mutex_lock( mpFrameMutex ); + + mbIsInGrabMode = true; + mfGrabTime = fMediaTime; + g_cond_timed_wait( mpFrameCond, mpFrameMutex, &aTimeoutTime ); + mbIsInGrabMode = false; + + g_mutex_unlock( mpFrameMutex ); + + stop(); + } + + OSL_ENSURE( g_atomic_pointer_get( &mpLastPixbuf ), "FrameGrabber timed out without receiving a Pixbuf" ); + + if( g_atomic_pointer_get( &mpLastPixbuf ) ) + { + OSL_TRACE( "FrameGrabber received a GdkPixbuf"); + + g_mutex_lock( mpFrameMutex ); + + 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( pBuffer && ( nWidth > 0 ) && ( nHeight > 0 ) ) + { + Bitmap aFrame( Size( nWidth, nHeight), 24 ); + bool bInit = false; + + if( ( gdk_pixbuf_get_colorspace( mpLastPixbuf ) == GDK_COLORSPACE_RGB ) && + ( nChannels >= 3 ) && ( nChannels <= 4 ) && + ( gdk_pixbuf_get_bits_per_sample( mpLastPixbuf ) == 8 ) ) + { + BitmapWriteAccess* pAcc = aFrame.AcquireWriteAccess(); + + if( pAcc ) + { + BitmapColor aPixel( 0, 0, 0 ); + const int nRowStride = gdk_pixbuf_get_rowstride( mpLastPixbuf ); + const bool bAlpha = ( nChannels == 4 ); + + for( int nRow = 0; nRow < nHeight; ++nRow ) + { + 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 ); + } + } + + aFrame.ReleaseAccess( pAcc ); + bInit = true; + } + } + + if( !bInit ) + { + aFrame.Erase( Color( COL_BLACK ) ); + } + + xRet = Graphic( aFrame ).GetXGraphic(); + } + + g_object_unref( mpLastPixbuf ); + mpLastPixbuf = NULL; + + g_mutex_unlock( mpFrameMutex ); + } + } + + return xRet; +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( ) + throw (uno::RuntimeException) +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_FRAMEGRABBER_IMPLEMENTATIONNAME ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName ) + throw (uno::RuntimeException) +{ + return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_GSTREAMER_FRAMEGRABBER_SERVICENAME ) ); +} + +// ------------------------------------------------------------------------------ + +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 ) ); + + return aRet; +} + +} // namespace win +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstframegrabber.hxx b/avmedia/source/gstreamer/gstframegrabber.hxx new file mode 100644 index 000000000000..9a7ec1b74102 --- /dev/null +++ b/avmedia/source/gstreamer/gstframegrabber.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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 + * + * 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 _FRAMEGRABBER_HXX +#define _FRAMEGRABBER_HXX + +#include "gstplayer.hxx" +#include <gdk-pixbuf/gdk-pixbuf.h> + +#ifndef _COM_SUN_STAR_MEDIA_XFRAMEGRABBER_HDL_ +#include "com/sun/star/media/XFrameGrabber.hdl" +#endif + +namespace avmedia { namespace gst { + +// ---------------- +// - FrameGrabber - +// ---------------- + +class FrameGrabber : public Player, + 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(); + + // XFrameGrabber + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL grabFrame( double fMediaTime ) 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: FrameGrabber( GString* pURI = NULL ); + + 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; +}; + +} // namespace gst +} // namespace avmedia + +#endif // _FRAMEGRABBER_HXX diff --git a/avmedia/source/gstreamer/gstmanager.cxx b/avmedia/source/gstreamer/gstmanager.cxx new file mode 100644 index 000000000000..61ee4ce22cd8 --- /dev/null +++ b/avmedia/source/gstreamer/gstmanager.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#include "gstmanager.hxx" +#include "gstplayer.hxx" + +using namespace ::com::sun::star; + +namespace avmedia +{ +namespace gst +{ +// ---------------- +// - Manager - +// ---------------- + +Manager::Manager( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : + mxMgr( rxMgr ) +{} + +// ------------------------------------------------------------------------------ + +Manager::~Manager() +{} + +// ------------------------------------------------------------------------------ + +uno::Reference< media::XPlayer > SAL_CALL Manager::createPlayer( const ::rtl::OUString& rURL ) + throw( uno::RuntimeException ) +{ + return( ::avmedia::gst::Player::create( rURL ) ); +} + +// ------------------------------------------------------------------------------ + +::rtl::OUString SAL_CALL Manager::getImplementationName() + throw( uno::RuntimeException ) +{ + return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Manager::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) ); +} + +// ------------------------------------------------------------------------------ + +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 ) ); + + return( aRet ); +} +} // namespace gst +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstmanager.hxx b/avmedia/source/gstreamer/gstmanager.hxx new file mode 100644 index 000000000000..9f80e8c1a901 --- /dev/null +++ b/avmedia/source/gstreamer/gstmanager.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 + * + * 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 _GSTMANAGER_HXX +#define _GSTMANAGER_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 > +{ +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 ); + + // 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 ); + + +private: + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; +}; +} // namespace gst +} // namespace avmedia + +#endif // _GSTMANAGER_HXX diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx new file mode 100644 index 000000000000..f082cfc5c513 --- /dev/null +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -0,0 +1,938 @@ +/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#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 <gst/interfaces/xoverlay.h> + + +// maximum timeout time in nanoseconds +#define GST_MAX_TIMEOUT (2500 * GST_MSECOND) + +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; + +// ---------------- +// - GstBusSource - +// ---------------- + +struct GstBusSource : public GSource +{ + GstBus* mpBus; + + GstBusSource() : + mpBus( NULL ) + {} + + ~GstBusSource() + {} +}; + +// --------------- +// - 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 ) + { + gst_init( NULL, NULL ); + bGstInitialized = true; + } + + if( pURI ) + { + OSL_TRACE( ">>> --------------------------------" ); + OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str ); + + mpThread = g_thread_create( Player::implThreadFunc, this, true, NULL ); + } +} + +// ------------------------------------------------------------------------------ + +Player::~Player() +{ + if( g_atomic_pointer_get( &mpPlayer ) ) + { + implQuitThread(); + } + + // cleanup + g_cond_free( mpCond ); + g_mutex_free( mpMutex ); + g_string_free( mpURI, false ); +} + +// ------------------------------------------------------------------------------ +Player* Player::create( const ::rtl::OUString& rURL ) +{ + Player* pPlayer = NULL; + + if( rURL.getLength() ) + { + // safely initialize GLib threading framework + try + { + if( !g_thread_supported() ) + { + g_thread_init( NULL ); + } + } + catch( ... ) + {} + + 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 ); + } + + g_mutex_unlock( pPlayer->mpMutex ); + } + + // check if player pipeline could be initialized + if( !pPlayer->mpPlayer ) + { + delete pPlayer; + pPlayer = NULL; + } + } + else + { + g_string_free( pURI, false ); + } + } + } + } + + return( pPlayer ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::start() + throw( uno::RuntimeException ) +{ + if( implInitPlayer() && !isPlaying() ) + { + gst_element_set_state( mpPlayer, GST_STATE_PLAYING ); + } +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::stop() + throw( uno::RuntimeException ) +{ + if( implInitPlayer() && isPlaying() ) + { + gst_element_set_state( mpPlayer, GST_STATE_PAUSED ); + } +} + +// ------------------------------------------------------------------------------ +sal_Bool SAL_CALL Player::isPlaying() + throw( uno::RuntimeException ) +{ + GstState aState = GST_STATE_NULL; + + if( mpPlayer ) + { + gst_element_get_state( mpPlayer, &aState, NULL, GST_MAX_TIMEOUT ); + } + + return( GST_STATE_PLAYING == aState ); +} + +// ------------------------------------------------------------------------------ +double SAL_CALL Player::getDuration() + throw( uno::RuntimeException ) +{ + gint64 nDuration = 0; + + if( implInitPlayer() ) + { + GstFormat aFormat = GST_FORMAT_TIME; + + if( !gst_element_query_duration( mpPlayer, &aFormat, &nDuration ) || + ( GST_FORMAT_TIME != aFormat ) || + ( nDuration < 0 ) ) + { + nDuration = 0; + } + } + + return( static_cast< double >( nDuration ) / NANO_TIME_FACTOR ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setMediaTime( double fTime ) + throw( uno::RuntimeException ) +{ + if( implInitPlayer() ) + { + fTime = ::std::min( ::std::max( fTime, 0.0 ), getDuration() ); + + 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 ) ); + } +} + +// ------------------------------------------------------------------------------ +double SAL_CALL Player::getMediaTime() + throw( uno::RuntimeException ) +{ + double fRet = 0.0; + + if( implInitPlayer() ) + { + GstFormat aFormat = GST_FORMAT_TIME; + gint64 nCurTime = 0; + + if( gst_element_query_position( mpPlayer, &aFormat, &nCurTime ) && + ( GST_FORMAT_TIME == aFormat ) && + ( nCurTime >= 0 ) ) + { + fRet = static_cast< double >( nCurTime ) / NANO_TIME_FACTOR; + } + } + + return( fRet ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setStopTime( double /* fTime */ ) + throw( uno::RuntimeException ) +{ + OSL_TRACE( "GStreamer method avmedia::gst::Player::setStopTime needs to be implemented" ); + + /* 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() ) + { + } + + */ +} + +// ------------------------------------------------------------------------------ +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 + */ + + return( getDuration() ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setRate( double /* fRate */ ) + throw( uno::RuntimeException ) +{ + OSL_TRACE( "GStreamer method avmedia::gst::Player::setRate needs to be implemented" ); + + /* 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 + */ +} + +// ------------------------------------------------------------------------------ +double SAL_CALL Player::getRate() + throw( uno::RuntimeException ) +{ + /* + 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 + */ + + return( 1.0 ); +} + +// ------------------------------------------------------------------------------ +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 ); +} + +// ------------------------------------------------------------------------------ +sal_Bool SAL_CALL Player::isPlaybackLoop() + throw( uno::RuntimeException ) +{ + return( g_atomic_int_get( &mnLooping ) > 0 ); +} + +// ------------------------------------------------------------------------------ +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 ); + } + } +} + +// ------------------------------------------------------------------------------ +sal_Bool SAL_CALL Player::isMute() + throw( uno::RuntimeException ) +{ + gdouble fGstVolume = 1.0; + + if( implInitPlayer() ) + { + g_object_get( mpPlayer, "volume", &fGstVolume, NULL ); + } + + return( 0.0 == fGstVolume ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) + throw( uno::RuntimeException ) +{ + if( implInitPlayer() ) + { + 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 ); + } +} + +// ------------------------------------------------------------------------------ +sal_Int16 SAL_CALL Player::getVolumeDB() + throw( uno::RuntimeException ) +{ + return( static_cast< sal_Int16 >( g_atomic_int_get( &mnVolumeDB ) ) ); +} + +// ------------------------------------------------------------------------------ +awt::Size SAL_CALL Player::getPreferredPlayerWindowSize() + throw( uno::RuntimeException ) +{ + awt::Size aSize( 0, 0 ); + + if( implInitPlayer() && ( g_atomic_int_get( &mnIsVideoSource ) > 0 ) ) + { + 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; + } + } + + OSL_TRACE( ">>> Requested preferred video size is: %d x %d pixel", aSize.Width, aSize.Height ); + + return( aSize ); +} + +// ------------------------------------------------------------------------------ +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; + + 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 ); + } + } + } + + return( xRet ); +} + +// ------------------------------------------------------------------------------ +uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() + throw( ::com::sun::star::uno::RuntimeException ) +{ + FrameGrabber* pFrameGrabber = NULL; + const awt::Size aPrefSize( getPreferredPlayerWindowSize() ); + + if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) ) + { + pFrameGrabber = FrameGrabber::create( mpURI ); + } + + return( pFrameGrabber ); +} + +// ------------------------------------------------------------------------------ +void SAL_CALL Player::dispose() + throw( uno::RuntimeException ) +{ + if( mpPlayer ) + { + stop(); + implQuitThread(); + } + + OSL_ASSERT( NULL == mpPlayer ); +} + +// ------------------------------------------------------------------------------ +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 ) +{ + return( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_IMPLEMENTATIONNAME ) ) ); +} + +// ------------------------------------------------------------------------------ +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 ) +{ + uno::Sequence< ::rtl::OUString > aRet( 1 ); + aRet[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_GSTREAMER_PLAYER_SERVICENAME ) ); + + return( aRet ); +} + +// ------------------------------------------------------------------------------ +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; + } +} + +// ------------------------------------------------------------------------------ +bool Player::implInitPlayer() +{ + bool bRet = false; + + if( mpPlayer && (mnInitFail < 3) ) + { + 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 ); +} + +// ------------------------------------------------------------------------------ +gboolean Player::implBusPrepare( GSource* pSource, + gint* pTimeout ) +{ + if( pTimeout ) + { + *pTimeout = 0; + } + + return( implBusCheck( pSource ) ); +} + +// ------------------------------------------------------------------------------ +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 ) ) ); +} + +// ------------------------------------------------------------------------------ +gboolean Player::implBusDispatch( GSource* pSource, + GSourceFunc /*aCallback*/, + gpointer pData ) +{ + GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); + gboolean bRet = false; + + if( pData && pBusSource && GST_IS_BUS( pBusSource->mpBus ) ) + { + GstMessage* pMsg = gst_bus_pop( pBusSource->mpBus ); + + if( pMsg ) + { + bRet = static_cast< Player* >( pData )->busCallback( pBusSource->mpBus, pMsg ); + gst_message_unref( pMsg ); + } + } + + return( bRet ); +} + +// ------------------------------------------------------------------------------ +void Player::implBusFinalize( GSource* pSource ) +{ + GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource ); + + if( pBusSource && pBusSource->mpBus ) + { + gst_object_unref( pBusSource->mpBus ); + pBusSource->mpBus = NULL; + } +} + +// ------------------------------------------------------------------------------ +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 ) +{ + return( pData ? static_cast< Player* >( pData )->idle() : true ); +} + +// ------------------------------------------------------------------------------ +gpointer Player::implThreadFunc( gpointer pData ) +{ + return( pData ? static_cast< Player* >( pData )->run() : NULL ); +} + +// ------------------------------------------------------------------------------ +GstBusSyncReply Player::implHandleCreateWindowFunc( GstBus* pBus, + GstMessage* pMsg, + gpointer pData ) +{ + return( pData ? static_cast< Player* >( pData )->handleCreateWindow( pBus, pMsg ) : GST_BUS_PASS ); +} + +// ------------------------------------------------------------------------------ +void Player::implHandleNewElementFunc( GstBin* /* pBin */, + GstElement* pElement, + gpointer pData ) +{ + if( pElement ) + { +#ifdef DEBUG + gchar* pElementName = gst_element_get_name( pElement ); + + 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 ); + } +} + +// ------------------------------------------------------------------------------ +void Player::implHandleNewPadFunc( GstElement* pElement, + GstPad* pPad, + gpointer pData ) +{ + Player* pPlayer = static_cast< Player* >( pData ); + + if( pPlayer && pElement && pPad ) + { +#ifdef DEBUG + gchar* pElementName = gst_element_get_name( pElement ); + gchar* pPadName = gst_pad_get_name( pPad ); + + OSL_TRACE( ">>> Element %s has pad: %s", pElementName, pPadName ); + + g_free( pPadName ); + g_free( pElementName ); +#endif + + GstCaps* pCaps = gst_pad_get_caps( pPad ); + + // 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 ); + +#ifdef DEBUG + OSL_TRACE( "\t>>> Pad has structure: %s", pStructName ); + + 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 ) ); + } +#endif + + // 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 ) ); + } + } + } + } + } + + gst_caps_unref( pCaps ); + } + } +} + +// ------------------------------------------------------------------------------ +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 ); + + 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 ); + } + + // don't eat up all cpu time + usleep( 1000 ); + + return( true ); +} + +// ------------------------------------------------------------------------------ +gpointer Player::run() +{ + 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; + } + + g_atomic_int_add( &mnInitialized, 1 ); + g_cond_signal( mpCond ); + + // run the main loop + g_main_loop_run( mpLoop ); + + // 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; + } + + g_main_loop_unref( mpLoop ); + mpLoop = NULL; + + g_source_destroy( pBusSource ); + g_source_unref( pBusSource ); + + 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 ); + } + + return( NULL ); +} + +// ------------------------------------------------------------------------------ +GstBusSyncReply Player::handleCreateWindow( GstBus* /* pBus */, + GstMessage* pMsg ) +{ + GstBusSyncReply eRet = GST_BUS_PASS; + + 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" ); + + 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; + } + + return( eRet ); +} +} // namespace gst +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx new file mode 100644 index 000000000000..d751e381258d --- /dev/null +++ b/avmedia/source/gstreamer/gstplayer.hxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * 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 + * + * 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 _GSTPLAYER_HXX +#define _GSTPLAYER_HXX + +#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; + +// --------------- +// - Player_Impl - +// --------------- + +class Player : public ::cppu::WeakImplHelper3< ::com::sun::star::media::XPlayer, + ::com::sun::star::lang::XComponent, + ::com::sun::star::lang::XServiceInfo > +{ +public: + + // static create method instead of public Ctor + static Player* create( const ::rtl::OUString& rURL ); + + ~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 ); + + 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 ); + + +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 ); + } + + +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 ); + + static void implHandleNewPadFunc( GstElement* pElem, + GstPad* pPad, + gpointer pData ); + +protected: + + GMutex* mpMutex; + GCond* mpCond; + GThread* mpThread; + GMainContext* mpContext; + GMainLoop* mpLoop; + GstElement* mpPlayer; + GString* mpURI; + +private: + + ::avmedia::gst::Window* mpPlayerWindow; + gint mnIsVideoSource; + gint mnVideoWidth; + gint mnVideoHeight; + gint mnInitialized; + gint mnVolumeDB; + gint mnLooping; + gint mnQuit; + gint mnVideoWindowSet; + gint mnInitFail; +}; +} // namespace gst +} // namespace avmedia + +#endif // _GSTPLAYER_HXX diff --git a/avmedia/source/gstreamer/gstuno.cxx b/avmedia/source/gstreamer/gstuno.cxx new file mode 100644 index 000000000000..adcda63fcd9c --- /dev/null +++ b/avmedia/source/gstreamer/gstuno.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#include "gstcommon.hxx" +#include "gstmanager.hxx" + +using namespace ::com::sun::star; + +// ------------------- +// - factory methods - +// ------------------- + +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 ) ); +} + +// ------------------------------------------ +// - component_getImplementationEnvironment - +// ------------------------------------------ + +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::createFromAscii( + "/" AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME "/UNO/SERVICES/" + AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ) ); + + 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 */ ) +{ + uno::Reference< lang::XSingleServiceFactory > xFactory; + void* pRet = 0; + + if( rtl_str_compare( pImplName, AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ) == 0 ) + { + const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_SERVICENAME ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + ::rtl::OUString::createFromAscii( AVMEDIA_GSTREAMER_MANAGER_IMPLEMENTATIONNAME ), + create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); + } + + if( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx new file mode 100644 index 000000000000..3b24e9974a3f --- /dev/null +++ b/avmedia/source/gstreamer/gstwindow.cxx @@ -0,0 +1,668 @@ +/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#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 ); +} + +// --------------------------------------------------------------------- + +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 ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::KeyInput( const KeyEvent& rKEvt ) +{ + SystemChildWindow::KeyInput( rKEvt ); + GetParent()->KeyInput( rKEvt ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::KeyUp( const KeyEvent& rKEvt ) +{ + SystemChildWindow::KeyUp( rKEvt ); + GetParent()->KeyUp( rKEvt ); +} + +// --------------------------------------------------------------------- + +void PlayerChildWindow::Command( const CommandEvent& rCEvt ) +{ + const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ), + rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() ); + + SystemChildWindow::Command( rCEvt ); + GetParent()->Command( aTransformedEvent ); +} + +// --------------- +// - Window - +// --------------- +Window::Window( ::avmedia::gst::Player& rPlayer ) : + maListeners( maMutex ), + maWindowRect( 0, 0, 0, 0 ), + mrPlayer( rPlayer ), + mpPlayerWindow( NULL ), + meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), + mnPointerType( awt::SystemPointer::ARROW ) +{} + +// ------------------------------------------------------------------------------ + +Window::~Window() +{ + dispose(); +} + +// ------------------------------------------------------------------------------ + +void Window::implLayoutVideoWindow() +{ + 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 ) ); + } +} + +// ------------------------------------------------------------------------------ + +bool Window::create( const uno::Sequence< uno::Any >& rArguments ) +{ + 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; + + if( !mpPlayerWindow && ( rArguments.getLength() > 2 ) ) + { + SystemChildWindow* pParentWindow = NULL; + sal_IntPtr pIntPtr = NULL; + + // 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 ) + { + 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(); + + bRet = true; + } + } + + return( bRet ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::update() + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + mpPlayerWindow->Invalidate( INVALIDATE_UPDATE ); + mpPlayerWindow->Sync(); + } +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) + 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 ); +} + +// ------------------------------------------------------------------------------ + +media::ZoomLevel SAL_CALL Window::getZoomLevel() + throw( uno::RuntimeException ) +{ + return( meZoomLevel ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setPointerType( sal_Int32 nPointerType ) + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + Pointer ePointer = POINTER_ARROW; + + switch( nPointerType ) + { + case (awt::SystemPointer::CROSS) : + { + ePointer = POINTER_CROSS; + } + break; + + case (awt::SystemPointer::HAND) : + { + ePointer = POINTER_HAND; + } + break; + + case (awt::SystemPointer::MOVE) : + { + ePointer = POINTER_MOVE; + } + break; + + case (awt::SystemPointer::WAIT) : + { + ePointer = POINTER_WAIT; + } + break; + + default: + break; + } + + mpPlayerWindow->SetPointer( ePointer ); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setPosSize( sal_Int32 nX, + sal_Int32 nY, + sal_Int32 nWidth, + sal_Int32 nHeight, + sal_Int16 /* Flags */ ) + throw( uno::RuntimeException ) +{ + maWindowRect.X = nX; + maWindowRect.Y = nY; + maWindowRect.Width = nWidth; + maWindowRect.Height = nHeight; + + implLayoutVideoWindow(); +} + +// ------------------------------------------------------------------------------ + +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(); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setEnable( sal_Bool bEnable ) + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + mpPlayerWindow->Enable( bEnable ); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::setFocus() + throw( uno::RuntimeException ) +{ + if( mpPlayerWindow ) + { + mpPlayerWindow->GrabFocus(); + } +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +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 ) +{ + maListeners.addInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& + xListener ) + throw( uno::RuntimeException ) +{ + maListeners.removeInterface( getCppuType( &xListener ), xListener ); +} + +// ------------------------------------------------------------------------------ + +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 +{ + 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 ) ) ); +} + +// ------------------------------------------------------------------------------ + +sal_Bool SAL_CALL Window::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return( ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( + AVMEDIA_GSTREAMER_WINDOW_SERVICENAME ) ) ); +} + +// ------------------------------------------------------------------------------ + +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 ) ); + + return( aRet ); +} +} // namespace gst +} // namespace avmedia diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx new file mode 100644 index 000000000000..3a55fca9c8bf --- /dev/null +++ b/avmedia/source/gstreamer/gstwindow.hxx @@ -0,0 +1,197 @@ +/************************************************************************* + * + * 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 + * + * 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 _GSTWINDOW_HXX +#define _GSTWINDOW_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; + +// --------------- +// - Window - +// --------------- + +class Player; + +class Window : public ::cppu::WeakImplHelper2< ::com::sun::star::media::XPlayerWindow, + ::com::sun::star::lang::XServiceInfo > +{ + friend class Player; + +public: Window( ::avmedia::gst::Player& rPlayer ); + ~Window(); + + bool create( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ); + + // 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 ); + + // 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 ); + + // 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 ); + + // 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 ); + + 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; + + void implLayoutVideoWindow(); +}; +} // namespace gst +} // namespace avmedia + +#endif // _GSTWINDOW_HXX diff --git a/avmedia/source/gstreamer/makefile.mk b/avmedia/source/gstreamer/makefile.mk new file mode 100644 index 000000000000..2f22c7333778 --- /dev/null +++ b/avmedia/source/gstreamer/makefile.mk @@ -0,0 +1,71 @@ +#************************************************************************* +# +# 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 +# +# 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. +# +#************************************************************************* + +PRJ=..$/.. +PRJNAME=avmediagst +TARGET=avmediagst + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +.IF "$(verbose)"!="" || "$(VERBOSE)"!="" +CDEFS+= -DVERBOSE +.ENDIF + +# --- Files ---------------------------------- + +.IF "$(GUI)" == "UNX" && "$(GUIBASE)"!="aqua" && "$(ENABLE_GSTREAMER)" != "" + +PKGCONFIG_MODULES=gtk+-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 +.INCLUDE : pkg_config.mk + +SLOFILES= \ + $(SLO)$/gstuno.obj \ + $(SLO)$/gstmanager.obj \ + $(SLO)$/gstwindow.obj \ + $(SLO)$/gstplayer.obj \ + $(SLO)$/gstframegrabber.obj + +EXCEPTIONSFILES= \ + $(SLO)$/gstuno.obj \ + $(SLO)$/gstplayer.obj \ + $(SLO)$/gstframegrabber.obj + +SHL1TARGET=$(TARGET) +SHL1STDLIBS= $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(TOOLSLIB) $(VCLLIB) +SHL1STDLIBS+=$(PKGCONFIG_LIBS) +SHL1IMPLIB=i$(TARGET) +SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1DEF=$(MISC)$/$(SHL1TARGET).def + +DEF1NAME=$(SHL1TARGET) +DEF1EXPORTFILE=exports.dxp + +.ENDIF + +.INCLUDE : target.mk diff --git a/avmedia/source/inc/mediamisc.hxx b/avmedia/source/inc/mediamisc.hxx index fd89e9d4abde..f33bd46568c8 100644 --- a/avmedia/source/inc/mediamisc.hxx +++ b/avmedia/source/inc/mediamisc.hxx @@ -30,12 +30,30 @@ class ResMgr; #define AVMEDIA_RESID( nId ) ResId( nId, * ::avmedia::GetResMgr() ) #ifdef WNT -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_DirectX" + +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_DirectX" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False + #else #ifdef QUARTZ -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" + +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_QuickTime" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_False + #else -#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.media.Manager_Java" + +#define AVMEDIA_MANAGER_SERVICE_NAME "com.sun.star.comp.avmedia.Manager_GStreamer" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED sal_False + +#define AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1 "com.sun.star.comp.avmedia.Manager_Java" +#define AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 sal_True + #endif #endif diff --git a/avmedia/source/java/PlayerWindow.java b/avmedia/source/java/PlayerWindow.java index 229c651d9f54..2229e4f1644b 100644 --- a/avmedia/source/java/PlayerWindow.java +++ b/avmedia/source/java/PlayerWindow.java @@ -67,9 +67,7 @@ public class PlayerWindow implements java.awt.event.KeyListener, maFrame = new WindowAdapter( AnyConverter.toInt( aArgs[ 0 ] ) ); maFrame.setPosSize( aBoundRect.X, aBoundRect.Y, aBoundRect.Width, aBoundRect.Height, (short) 0 ); - - if( aArgs.length > 2 ) - mbShowControls = AnyConverter.toBoolean( aArgs[ 2 ] ); + mbShowControls = false; java.awt.Panel aPanel = new java.awt.Panel( new java.awt.BorderLayout() ); diff --git a/avmedia/source/java/avmedia.jar b/avmedia/source/java/avmedia.jar Binary files differindex 55576baa5b34..85a98bbcf33c 100644 --- a/avmedia/source/java/avmedia.jar +++ b/avmedia/source/java/avmedia.jar diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index b2d1e5162cb5..5005446633f4 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -162,7 +162,9 @@ Size MediaWindow::getPreferredSize() const void MediaWindow::setPosSize( const Rectangle& rNewRect ) { if( mpImpl ) + { mpImpl->setPosSize( rNewRect ); + } } // ------------------------------------------------------------------------- @@ -368,6 +370,7 @@ void MediaWindow::getMediaFilters( FilterNameVector& rFilterNameVector ) "AU Audio", "au", "AVI", "avi", "CD Audio", "cda", + "Matroska Media", "mkv", "MIDI Audio", "mid;midi", "MPEG Audio", "mp2;mp3;mpa", "MPEG Video", "mpg;mpeg;mpv;mp4", @@ -464,39 +467,28 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr { if( bDeep || pPreferredSizePixel ) { - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - - if( xFactory.is() ) + try { - try - { - fprintf(stderr, "-->%s uno reference \n\n",AVMEDIA_MANAGER_SERVICE_NAME); + sal_Bool bIsJavaBasedMediaWindow; + uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer( + aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), + bIsJavaBasedMediaWindow ) ); - uno::Reference< ::com::sun::star::media::XManager > xManager( - xFactory->createInstance( ::rtl::OUString::createFromAscii( AVMEDIA_MANAGER_SERVICE_NAME ) ), - uno::UNO_QUERY ); + if( xPlayer.is() ) + { + bRet = true; - if( xManager.is() ) + if( pPreferredSizePixel ) { - uno::Reference< media::XPlayer > xPlayer( xManager->createPlayer( aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ); - - if( xPlayer.is() ) - { - bRet = true; + const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() ); - if( pPreferredSizePixel ) - { - const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() ); - - pPreferredSizePixel->Width() = aAwtSize.Width; - pPreferredSizePixel->Height() = aAwtSize.Height; - } - } + pPreferredSizePixel->Width() = aAwtSize.Width; + pPreferredSizePixel->Height() = aAwtSize.Height; } } - catch( ... ) - { - } + } + catch( ... ) + { } } else @@ -525,7 +517,8 @@ bool MediaWindow::isMediaURL( const ::rtl::OUString& rURL, bool bDeep, Size* pPr uno::Reference< media::XPlayer > MediaWindow::createPlayer( const ::rtl::OUString& rURL ) { - return priv::MediaWindowImpl::createPlayer( rURL ); + sal_Bool bJavaBased = sal_False; + return priv::MediaWindowImpl::createPlayer( rURL, bJavaBased ); } // ------------------------------------------------------------------------- diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index 553eea6196c1..15c830cb97a6 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -1,4 +1,4 @@ -/************************************************************************* +/************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -94,7 +94,7 @@ void MediaWindowControl::execute( const MediaItem& rItem ) // -------------------- MediaChildWindow::MediaChildWindow( Window* pParent ) : - JavaChildWindow( pParent, WB_CLIPCHILDREN ) + SystemChildWindow( pParent, WB_CLIPCHILDREN ) { } @@ -111,7 +111,7 @@ void MediaChildWindow::MouseMove( const MouseEvent& rMEvt ) const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - JavaChildWindow::MouseMove( rMEvt ); + SystemChildWindow::MouseMove( rMEvt ); GetParent()->MouseMove( aTransformedEvent ); } @@ -122,7 +122,7 @@ void MediaChildWindow::MouseButtonDown( const MouseEvent& rMEvt ) const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - JavaChildWindow::MouseButtonDown( rMEvt ); + SystemChildWindow::MouseButtonDown( rMEvt ); GetParent()->MouseButtonDown( aTransformedEvent ); } @@ -133,7 +133,7 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) const MouseEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rMEvt.GetPosPixel() ) ), rMEvt.GetClicks(), rMEvt.GetMode(), rMEvt.GetButtons(), rMEvt.GetModifier() ); - JavaChildWindow::MouseButtonUp( rMEvt ); + SystemChildWindow::MouseButtonUp( rMEvt ); GetParent()->MouseButtonUp( aTransformedEvent ); } @@ -141,7 +141,7 @@ void MediaChildWindow::MouseButtonUp( const MouseEvent& rMEvt ) void MediaChildWindow::KeyInput( const KeyEvent& rKEvt ) { - JavaChildWindow::KeyInput( rKEvt ); + SystemChildWindow::KeyInput( rKEvt ); GetParent()->KeyInput( rKEvt ); } @@ -149,7 +149,7 @@ void MediaChildWindow::KeyInput( const KeyEvent& rKEvt ) void MediaChildWindow::KeyUp( const KeyEvent& rKEvt ) { - JavaChildWindow::KeyUp( rKEvt ); + SystemChildWindow::KeyUp( rKEvt ); GetParent()->KeyUp( rKEvt ); } @@ -160,7 +160,7 @@ void MediaChildWindow::Command( const CommandEvent& rCEvt ) const CommandEvent aTransformedEvent( GetParent()->ScreenToOutputPixel( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) ), rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() ); - JavaChildWindow::Command( rCEvt ); + SystemChildWindow::Command( rCEvt ); GetParent()->Command( aTransformedEvent ); } @@ -179,6 +179,7 @@ MediaWindowImpl::MediaWindowImpl( Window* pParent, MediaWindow* pMediaWindow, bo mpEmptyBmpEx( NULL ), mpAudioBmpEx( NULL ) { + maChildWindow.SetBackground( Color( COL_BLACK ) ); maChildWindow.SetHelpId( HID_AVMEDIA_PLAYERWINDOW ); maChildWindow.Hide(); @@ -229,19 +230,24 @@ void MediaWindowImpl::onURLChanged() { if( getPlayer().is() ) { - uno::Sequence< uno::Any > aArgs( 2 ); uno::Reference< media::XPlayerWindow > xPlayerWindow; - const Point aPoint; - const Size aSize( maChildWindow.GetSizePixel() ); - const sal_IntPtr nWndHandle = static_cast< sal_IntPtr >( maChildWindow.getParentWindowHandleForJava() ); - aArgs[ 0 ] = uno::makeAny( nWndHandle ); - aArgs[ 1 ] = uno::makeAny( awt::Rectangle( aPoint.X(), aPoint.Y(), aSize.Width(), aSize.Height() ) ); + const Point aPoint; + const Size aSize( maChildWindow.GetSizePixel() ); + const sal_IntPtr nWndHandle = (sal_IntPtr) maChildWindow.GetParentWindowHandle( isMediaWindowJavaBased() ); try { 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 ) ); + xPlayerWindow = getPlayer()->createPlayerWindow( aArgs ); + } } catch( uno::RuntimeException ) { @@ -273,8 +279,6 @@ void MediaWindowImpl::onURLChanged() updateMediaItem( aItem ); mpMediaWindowControl->setState( aItem ); } - - Invalidate(); } // --------------------------------------------------------------------- @@ -291,7 +295,7 @@ void MediaWindowImpl::update() void MediaWindowImpl::setPosSize( const Rectangle& rRect ) { - SetPosSizePixel( rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight() ); + SetPosSizePixel( rRect.TopLeft(), rRect.GetSize() ); } // --------------------------------------------------------------------- @@ -305,7 +309,6 @@ void MediaWindowImpl::setPointer( const Pointer& rPointer ) if( xPlayerWindow.is() ) { - long nPointer; switch( rPointer.GetStyle() ) @@ -355,10 +358,10 @@ void MediaWindowImpl::Resize() mpMediaWindowControl->SetPosSizePixel( Point( nOffset, nControlY ), Size( aCurSize.Width() - ( nOffset << 1 ), nControlHeight ) ); } - maChildWindow.SetPosSizePixel( Point( nOffset, nOffset ), aPlayerWindowSize ); - if( xPlayerWindow.is() ) xPlayerWindow->setPosSize( 0, 0, aPlayerWindowSize.Width(), aPlayerWindowSize.Height(), 0 ); + + maChildWindow.SetPosSizePixel( Point( nOffset, nOffset ), aPlayerWindowSize ); } // --------------------------------------------------------------------- @@ -405,7 +408,7 @@ void MediaWindowImpl::Paint( const Rectangle& ) pLogo = mpEmptyBmpEx; } - else if ( !getPlayerWindow().is() ) + else if( !getPlayerWindow().is() ) { if( !mpAudioBmpEx ) mpAudioBmpEx = new BitmapEx( AVMEDIA_RESID( AVMEDIA_BMP_AUDIOLOGO ) ); @@ -446,8 +449,6 @@ void MediaWindowImpl::Paint( const Rectangle& ) aBasePos.Y() + ( ( aVideoRect.GetHeight() - aLogoSize.Height() ) >> 1 ) ), aLogoSize, *pLogo ); } - - update(); } // --------------------------------------------------------------------- diff --git a/avmedia/source/viewer/mediawindow_impl.hxx b/avmedia/source/viewer/mediawindow_impl.hxx index 679b864af6b7..9008e499647d 100644 --- a/avmedia/source/viewer/mediawindow_impl.hxx +++ b/avmedia/source/viewer/mediawindow_impl.hxx @@ -2,10 +2,13 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: mediawindow_impl.hxx,v $ + * $Revision: 1.3 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,7 +32,7 @@ #define _AVMEDIA_MEDIAWINDOW_IMPL_HXX #include <svtools/transfer.hxx> -#include <vcl/javachild.hxx> +#include <vcl/syschild.hxx> #include "mediawindowbase_impl.hxx" #include "mediacontrol.hxx" @@ -61,7 +64,7 @@ namespace avmedia // - MediaChildWindow - // -------------------- - class MediaChildWindow : public JavaChildWindow + class MediaChildWindow : public SystemChildWindow { public: diff --git a/avmedia/source/viewer/mediawindowbase_impl.cxx b/avmedia/source/viewer/mediawindowbase_impl.cxx index ea28121e3609..94a6c36ed064 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.cxx +++ b/avmedia/source/viewer/mediawindowbase_impl.cxx @@ -47,8 +47,18 @@ namespace avmedia { namespace priv { // - MediaWindowBaseImpl - // ----------------------- +struct ServiceManager +{ + const char* pServiceName; + sal_Bool bIsJavaBased; +}; + +// --------------------------------------------------------------------- + + MediaWindowBaseImpl::MediaWindowBaseImpl( MediaWindow* pMediaWindow ) : - mpMediaWindow( pMediaWindow ) + mpMediaWindow( pMediaWindow ), + mbIsMediaWindowJavaBased( sal_False ) { } @@ -61,35 +71,53 @@ MediaWindowBaseImpl::~MediaWindowBaseImpl() // ------------------------------------------------------------------------- -uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL ) +uno::Reference< media::XPlayer > MediaWindowBaseImpl::createPlayer( const ::rtl::OUString& rURL, sal_Bool& rbJavaBased ) { uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference< media::XPlayer > xPlayer; + rbJavaBased = sal_False; + if( xFactory.is() ) { - try + static const ServiceManager aServiceManagers[] = + { + { AVMEDIA_MANAGER_SERVICE_NAME, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED }, + { AVMEDIA_MANAGER_SERVICE_NAME_FALLBACK1, AVMEDIA_MANAGER_SERVICE_IS_JAVABASED_FALLBACK1 } + }; + + for( sal_uInt32 i = 0; !xPlayer.is() && ( i < ( sizeof( aServiceManagers ) / sizeof( ServiceManager ) ) ); ++i ) { + const String aServiceName( aServiceManagers[ i ].pServiceName, RTL_TEXTENCODING_ASCII_US ); + + if( aServiceName.Len() ) + { + OSL_TRACE( "Trying to create media manager service %s", aServiceManagers[ i ].pServiceName ); - uno::Reference< ::com::sun::star::media::XManager > xManager( - xFactory->createInstance( ::rtl::OUString::createFromAscii( AVMEDIA_MANAGER_SERVICE_NAME ) ), - uno::UNO_QUERY ); + try + { + uno::Reference< media::XManager > xManager( xFactory->createInstance( aServiceName ), uno::UNO_QUERY ); + + if( xManager.is() ) + { + xPlayer = uno::Reference< media::XPlayer >( xManager->createPlayer( rURL ), uno::UNO_QUERY ); + } + } + catch( ... ) + { + } + } - if( xManager.is() ) + if( xPlayer.is() ) { - xPlayer = uno::Reference< ::com::sun::star::media::XPlayer >( - xManager->createPlayer( rURL ), uno::UNO_QUERY ); + rbJavaBased = aServiceManagers[ i ].bIsJavaBased; } } - catch( ... ) - { - } } return xPlayer; } - // --------------------------------------------------------------------- void MediaWindowBaseImpl::setURL( const ::rtl::OUString& rURL ) @@ -112,7 +140,7 @@ void MediaWindowBaseImpl::setURL( const ::rtl::OUString& rURL ) if( aURL.GetProtocol() != INET_PROT_NOT_VALID ) maFileURL = aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - mxPlayer = createPlayer( maFileURL ); + mxPlayer = createPlayer( maFileURL, mbIsMediaWindowJavaBased ); onURLChanged(); } } @@ -143,10 +171,7 @@ void MediaWindowBaseImpl::stopPlayingInternal( bool bStop ) { if( isPlaying() ) { - if( bStop ) - mxPlayer->stop(); - else - mxPlayer->start(); + bStop ? mxPlayer->stop() : mxPlayer->start(); } } diff --git a/avmedia/source/viewer/mediawindowbase_impl.hxx b/avmedia/source/viewer/mediawindowbase_impl.hxx index 0b0f160b6e3c..028b7c6ed079 100644 --- a/avmedia/source/viewer/mediawindowbase_impl.hxx +++ b/avmedia/source/viewer/mediawindowbase_impl.hxx @@ -61,7 +61,8 @@ namespace avmedia virtual void cleanUp(); virtual void onURLChanged(); - static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL ); + static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const ::rtl::OUString& rURL, + sal_Bool& rbJavaBased ); public: @@ -112,6 +113,7 @@ namespace avmedia void stopPlayingInternal( bool ); MediaWindow* getMediaWindow() const; + inline sal_Bool isMediaWindowJavaBased() const { return( mbIsMediaWindowJavaBased ); } ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > getPlayer() const; @@ -124,6 +126,7 @@ namespace avmedia ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > mxPlayer; ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayerWindow > mxPlayerWindow; MediaWindow* mpMediaWindow; + sal_Bool mbIsMediaWindowJavaBased; }; } } diff --git a/avmedia/source/win/winuno.cxx b/avmedia/source/win/winuno.cxx index 4b06fd10727f..645871290413 100644 --- a/avmedia/source/win/winuno.cxx +++ b/avmedia/source/win/winuno.cxx @@ -62,7 +62,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void*, void* pRegistryKey ) { uno::Reference< registry::XRegistryKey > xNewKey1( static_cast< registry::XRegistryKey* >( pRegistryKey )->createKey( - ::rtl::OUString::createFromAscii( "/com.sun.star.comp.media.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) ); + ::rtl::OUString::createFromAscii( "/com.sun.star.comp.avmedia.Manager_DirectX/UNO/SERVICES/com.sun.star.media.Manager_DirectX" ) ) ); bRet = sal_True; } @@ -84,13 +84,13 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* uno::Reference< lang::XSingleServiceFactory > xFactory; void* pRet = 0; - if( rtl_str_compare( pImplName, "com.sun.star.comp.media.Manager_DirectX" ) == 0 ) + if( rtl_str_compare( pImplName, "com.sun.star.comp.avmedia.Manager_DirectX" ) == 0 ) { const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( "com.sun.star.media.Manager_DirectX" ) ); xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - ::rtl::OUString::createFromAscii( "com.sun.star.comp.media.Manager_DirectX" ), + ::rtl::OUString::createFromAscii( "com.sun.star.comp.avmedia.Manager_DirectX" ), create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) ); } diff --git a/basic/source/runtime/dllmgr.cxx b/basic/source/runtime/dllmgr.cxx index bc08a8cb64bc..04f1ee0a8acc 100644 --- a/basic/source/runtime/dllmgr.cxx +++ b/basic/source/runtime/dllmgr.cxx @@ -684,7 +684,7 @@ Dll * SbiDllMgr::Impl::getDll(rtl::OUString const & name) { Dlls::iterator i(dlls.find(name)); if (i == dlls.end()) { i = dlls.insert(Dlls::value_type(name, new Dll)).first; - HMODULE h = LoadLibraryW(name); + HMODULE h = LoadLibraryW(reinterpret_cast<LPCWSTR>(name.getStr())); if (h == 0) { dlls.erase(i); return 0; diff --git a/basic/source/runtime/wnt-mingw.s b/basic/source/runtime/wnt-mingw.s index 7868ddd386f0..8c332c1a8ce8 100644 --- a/basic/source/runtime/wnt-mingw.s +++ b/basic/source/runtime/wnt-mingw.s @@ -44,8 +44,8 @@ _DllMgr_callFp: shr ecx, 2 rep movsd $1: call DWORD PTR [ebp+8] - ; for extra safety, do not trust esp after call (in case the Basic Declare - ; signature is wrong): + # for extra safety, do not trust esp after call (in case the Basic Declare + # signature is wrong): mov edi, [ebp-8] mov esi, [ebp-4] mov esp, ebp diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index eda478b18b70..cd1e6e55d085 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -196,6 +196,14 @@ bool XcuParser::startElement( { handleSetNode( reader, dynamic_cast< SetNode * >(state_.top().node.get())); + } else if (ns == XmlReader::NAMESPACE_NONE && + name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) + { + OSL_TRACE( + "configmgr bad set node <prop> member in %s", + rtl::OUStringToOString( + reader.getUrl(), RTL_TEXTENCODING_UTF8).getStr()); + state_.push(State(true)); // ignored } else { throw css::uno::RuntimeException( (rtl::OUString( diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 2884e6179aaa..aca181916b47 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -258,6 +258,7 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType) (*this) = getAny(); break; default: + (*this) = getAny(); OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); } } @@ -344,6 +345,19 @@ void ORowSetValue::free() TRACE_FREE( Any ) m_aValue.m_pValue = NULL; break; + case DataType::BIT: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::BOOLEAN: + break; + default: + if ( m_aValue.m_pValue ) + { + delete (Any*)m_aValue.m_pValue; + TRACE_FREE( Any ) + m_aValue.m_pValue = NULL; + } + break; } m_bNull = sal_True; @@ -849,7 +863,9 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const bRet = false; break; default: + bRet = false; OSL_ENSURE(0,"ORowSetValue::operator==(): UNSPUPPORTED TYPE!"); + break; } return bRet; } @@ -942,6 +958,8 @@ Any ORowSetValue::makeAny() const break; default: OSL_ENSURE(0,"ORowSetValue::makeAny(): UNSPUPPORTED TYPE!"); + rValue = getAny(); + break; } } return rValue; @@ -1032,6 +1050,12 @@ Any ORowSetValue::makeAny() const } } break; + default: + { + Any aValue = getAny(); + aValue >>= aRet; + break; + } } } return aRet; @@ -1104,8 +1128,11 @@ sal_Bool ORowSetValue::getBool() const bRet = m_bSigned ? (m_aValue.m_nInt32 != 0) : (*static_cast<sal_Int64*>(m_aValue.m_pValue) != sal_Int64(0)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= bRet; + break; + } } } return bRet; @@ -1174,8 +1201,11 @@ sal_Int8 ORowSetValue::getInt8() const nRet = static_cast<sal_Int8>(*static_cast<sal_Int64*>(m_aValue.m_pValue)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1244,8 +1274,11 @@ sal_Int16 ORowSetValue::getInt16() const nRet = static_cast<sal_Int16>(*static_cast<sal_Int64*>(m_aValue.m_pValue)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1314,8 +1347,11 @@ sal_Int32 ORowSetValue::getInt32() const nRet = static_cast<sal_Int32>(*static_cast<sal_Int64*>(m_aValue.m_pValue)); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1384,8 +1420,11 @@ sal_Int64 ORowSetValue::getLong() const nRet = *(sal_Int64*)m_aValue.m_pValue; break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1458,8 +1497,11 @@ float ORowSetValue::getFloat() const nRet = float(*(sal_Int64*)m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1534,8 +1576,11 @@ double ORowSetValue::getDouble() const nRet = double(*(sal_Int64*)m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aValue = getAny(); + aValue >>= nRet; + break; + } } } return nRet; @@ -1626,6 +1671,11 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) TRACE_ALLOC( sal_Int64 ) } break; + default: + { + m_aValue.m_pValue = new Any(_rVal); + break; + } } m_eTypeKind = _nDatatype; } @@ -1692,7 +1742,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const aSeq = *static_cast< Sequence<sal_Int8>*>(m_aValue.m_pValue); break; default: - ; + { + Any aValue = getAny(); + aValue >>= aSeq; + break; + } } } return aSeq; @@ -1734,8 +1788,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const } break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aAnyValue = getAny(); + aAnyValue >>= aValue; + break; + } } } return aValue; @@ -1776,8 +1833,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const aValue = *static_cast< ::com::sun::star::util::Time*>(m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aAnyValue = getAny(); + aAnyValue >>= aValue; + break; + } } } return aValue; @@ -1826,8 +1886,11 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const aValue = *static_cast< ::com::sun::star::util::DateTime*>(m_aValue.m_pValue); break; default: - OSL_ENSURE(0,"Illegal conversion!"); - break; + { + Any aAnyValue = getAny(); + aAnyValue >>= aValue; + break; + } } } return aValue; @@ -2094,7 +2157,7 @@ void ORowSetValue::impl_fill( const sal_Int32 _nType, sal_Bool _bNullable, const break; default: OSL_ENSURE( false, "ORowSetValue::fill: unsupported type!" ); - bReadData = false; + (*this) = _rValueSource.getObject(); break; } if ( bReadData && _bNullable && _rValueSource.wasNull() ) diff --git a/connectivity/source/drivers/adabas/BDriver.cxx b/connectivity/source/drivers/adabas/BDriver.cxx index e9a0798761b9..030e84534501 100644 --- a/connectivity/source/drivers/adabas/BDriver.cxx +++ b/connectivity/source/drivers/adabas/BDriver.cxx @@ -464,8 +464,10 @@ void SAL_CALL ODriver::createCatalog( const Sequence< PropertyValue >& info ) th { TDatabaseStruct aDBInfo; fillInfo(info,aDBInfo); - static char envName[] = "DBSERVICE=0"; - putenv( envName ); + + ::rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("DBSERVICE")); + ::rtl::OUString envData(RTL_CONSTASCII_USTRINGPARAM("0")); + osl_setEnvironment(envVar.pData, envData.pData); m_sDbRunDir = m_sDbWorkURL + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/wrk/")) + aDBInfo.sDBName; String sTemp; diff --git a/connectivity/source/drivers/ado/AResultSet.cxx b/connectivity/source/drivers/ado/AResultSet.cxx index c71d620d527c..0c5db12c3355 100644 --- a/connectivity/source/drivers/ado/AResultSet.cxx +++ b/connectivity/source/drivers/ado/AResultSet.cxx @@ -692,6 +692,10 @@ void SAL_CALL OResultSet::cancelRowUpdates( ) throw(SQLException, RuntimeExcept void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeException) { + // ::osl::MutexGuard aGuard( m_aMutex ); + //checkDisposed(OResultSet_BASE::rBHelper.bDisposed); + // if ( getResultSetConcurrency() == ResultSetConcurrency::READ_ONLY ) + // throw SQLException(); } // ------------------------------------------------------------------------- @@ -977,7 +981,7 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& ro sal_Int32 OResultSet::getResultSetConcurrency() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) { - sal_Int32 nValue=0; + sal_Int32 nValue=ResultSetConcurrency::READ_ONLY; LockTypeEnum eRet; if(!SUCCEEDED(m_pRecordSet->get_LockType(&eRet))) { diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 8544e4affda7..157d1f7b68fa 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2607,7 +2607,7 @@ void ODbaseTable::throwInvalidDbaseFormat() // no dbase file const ::rtl::OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( - STR_SQL_NAME_ERROR, + STR_INVALID_DBASE_FILE, "$filename$", getEntry(m_pConnection,m_Name) ) ); ::dbtools::throwGenericSQLException( sError, *this ); diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx index 265084be697f..421225b34935 100644 --- a/connectivity/source/drivers/file/FResultSet.cxx +++ b/connectivity/source/drivers/file/FResultSet.cxx @@ -1200,7 +1200,9 @@ BOOL OResultSet::Move(IResultSetHelper::Movement eCursorPosition, INT32 nOffset, break; } - if (m_nRowPos == 0) + if ( m_nRowPos < 0 ) + goto Error; + else if (m_nRowPos == 0) { // COUNT(*) in Ergebnisrow packen // (muss die erste und einzige Variable in der Row sein) diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index eff2464ce533..70be592405eb 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -159,7 +159,10 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) (m_cStringDelimiter && m_cStringDelimiter == aField.GetChar(0))) { bNumeric = FALSE; - nStartPosFirstLine2 = nStartPosFirstLine; + if ( m_cStringDelimiter != '\0' ) + aFirstLine.GetTokenSpecial(aField,nStartPosFirstLine2,m_cFieldDelimiter,m_cStringDelimiter); + else + nStartPosFirstLine2 = nStartPosFirstLine; } else { diff --git a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx index 1452df992a74..e7fab6acb6c0 100644 --- a/connectivity/source/drivers/hsqldb/HStorageAccess.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageAccess.cxx @@ -234,7 +234,7 @@ jint read_from_storage_stream_into_buffer( JNIEnv * env, jobject /*obj_this*/,js if ( xIn.is() ) { jsize nLen = env->GetArrayLength(buffer); - if ( nLen < len ) + if ( nLen < len || len <= 0 ) { ThrowException( env, "java/io/IOException", @@ -439,21 +439,17 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst if ( xOut.is() ) { jbyte *buf = env->GetByteArrayElements(buffer,NULL); -#ifdef HSQLDB_DBG - OSL_ENSURE(len <= env->GetArrayLength(buffer),"Length is greater than the buffer!"); -#endif - if (JNI_FALSE != env->ExceptionCheck()) { env->ExceptionClear(); OSL_ENSURE(0,"ExceptionClear"); } OSL_ENSURE(buf,"buf is NULL"); - if ( buf ) + if ( buf && len > 0 && len <= env->GetArrayLength(buffer)) { Sequence< ::sal_Int8 > aData(buf + off,len); - xOut->writeBytes(aData); env->ReleaseByteArrayElements(buffer, buf, JNI_ABORT); + xOut->writeBytes(aData); #ifdef HSQLDB_DBG if ( logger ) logger->write( aData.getConstArray(), len ); diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx index afb4d0da2640..57ed88b1dda8 100644 --- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx +++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx @@ -61,14 +61,15 @@ namespace connectivity { try { - m_xStream.clear(); - m_xSeek.clear(); + m_xStream.clear(); + m_xSeek.clear(); if ( m_xInputStream.is() ) { m_xInputStream->closeInput(); - m_xInputStream.clear(); + m_xInputStream.clear(); } - if ( m_xOutputStream.is() ) + // this is done implicity by the closing of the input stream + else if ( m_xOutputStream.is() ) { m_xOutputStream->closeOutput(); try @@ -83,11 +84,12 @@ namespace connectivity OSL_UNUSED( e ); OSL_ENSURE(0,"Could not dispose OutputStream"); } - m_xOutputStream.clear(); + m_xOutputStream.clear(); } } - catch(Exception& ) + catch(Exception& ex) { + OSL_UNUSED( ex ); OSL_ENSURE(0,"Exception catched!"); } } diff --git a/connectivity/source/drivers/jdbc/Boolean.cxx b/connectivity/source/drivers/jdbc/Boolean.cxx index 2df75283a14b..fd52f3092c0e 100644 --- a/connectivity/source/drivers/jdbc/Boolean.cxx +++ b/connectivity/source/drivers/jdbc/Boolean.cxx @@ -49,20 +49,3 @@ jclass java_lang_Boolean::getMyClass() const { return st_getMyClass(); } - -java_lang_Boolean::java_lang_Boolean( sal_Bool _par0 ): java_lang_Object( NULL, (jobject)NULL ) -{ - SDBThreadAttach t; - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren - static const char * cSignature = "(Z)V"; - jobject tempObj; - static jmethodID mID(NULL); - obtainMethodId(t.pEnv, "<init>",cSignature, mID); - tempObj = t.pEnv->NewObject( getMyClass(), mID, _par0 ); - saveRef( t.pEnv, tempObj ); - t.pEnv->DeleteLocalRef( tempObj ); - // und aufraeumen -} - - diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 4866781d23dd..4f5670ace8aa 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -166,14 +166,6 @@ void java_lang_Object::saveRef( JNIEnv * pXEnv, jobject myObj ) } -java_lang_Class * java_lang_Object::getClass() -{ - SDBThreadAttach t; - static jmethodID mID(NULL); - jobject out = callObjectMethod(t.pEnv,"getClass","()Ljava/lang/Class;", mID); - return out ? new java_lang_Class( t.pEnv, out ) : NULL; -} - ::rtl::OUString java_lang_Object::toString() const { static jmethodID mID(NULL); diff --git a/connectivity/source/drivers/jdbc/String.cxx b/connectivity/source/drivers/jdbc/String.cxx index e6102fc3a471..f32b0cce4325 100644 --- a/connectivity/source/drivers/jdbc/String.cxx +++ b/connectivity/source/drivers/jdbc/String.cxx @@ -52,26 +52,6 @@ jclass java_lang_String::st_getMyClass() } //-------------------------------------------------------------------------- -java_lang_String::java_lang_String( const ::rtl::OUString& _par0 ): java_lang_Object( NULL, (jobject)NULL ) -{ - SDBThreadAttach t; - if( !t.pEnv ) - return; - jvalue args[1]; - // Parameter konvertieren - args[0].l = convertwchar_tToJavaString(t.pEnv,_par0); - // Java-Call fuer den Konstruktor absetzen - // temporaere Variable initialisieren - static const char * cSignature = "(Ljava/lang/String;)V"; - jobject tempObj; - static jmethodID mID(NULL); - obtainMethodId(t.pEnv, "<init>",cSignature, mID); - tempObj = t.pEnv->NewObjectA( getMyClass(), mID, args ); - saveRef( t.pEnv, tempObj ); - t.pEnv->DeleteLocalRef( tempObj ); - t.pEnv->DeleteLocalRef((jstring)args[0].l); -} -//-------------------------------------------------------------------------- java_lang_String::operator ::rtl::OUString() { SDBThreadAttach t; diff --git a/connectivity/source/drivers/kab/makefile.mk b/connectivity/source/drivers/kab/makefile.mk index 2a0dc5cd8999..219bdd6cd020 100644 --- a/connectivity/source/drivers/kab/makefile.mk +++ b/connectivity/source/drivers/kab/makefile.mk @@ -46,6 +46,9 @@ CFLAGS+=$(KDE_CFLAGS) .IF "$(KDE_ROOT)"!="" EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib +.IF "$(OS)$(CPU)" == "LINUXX" +EXTRALIBPATHS+=-L$(KDE_ROOT)$/lib64 +.ENDIF .ENDIF # === KAB base library ========================== diff --git a/connectivity/source/inc/java/lang/Boolean.hxx b/connectivity/source/inc/java/lang/Boolean.hxx index f1f8081d9780..35655f8c1934 100644 --- a/connectivity/source/inc/java/lang/Boolean.hxx +++ b/connectivity/source/inc/java/lang/Boolean.hxx @@ -44,7 +44,6 @@ namespace connectivity // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_Boolean( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} - java_lang_Boolean( sal_Bool _par0 ); static jclass st_getMyClass(); }; } diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx index f0bacc2ee840..c00c5e67e06d 100644 --- a/connectivity/source/inc/java/lang/Object.hxx +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -118,8 +118,6 @@ namespace connectivity void clearObject(JNIEnv& rEnv); void clearObject(); - java_lang_Class * getClass(); - virtual ::rtl::OUString toString() const; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xFactory; } diff --git a/connectivity/source/inc/java/lang/String.hxx b/connectivity/source/inc/java/lang/String.hxx index 64584dab5e76..3e4bfd6c1399 100644 --- a/connectivity/source/inc/java/lang/String.hxx +++ b/connectivity/source/inc/java/lang/String.hxx @@ -42,7 +42,6 @@ namespace connectivity // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: java_lang_String( JNIEnv * pEnv, jobject myObj ) : java_lang_Object( pEnv, myObj ){} - java_lang_String( const ::rtl::OUString& _par0 ); operator ::rtl::OUString(); static jclass st_getMyClass(); diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 486d280311d9..8867a940a6ad 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -75,7 +75,8 @@ class Desktop : public Application BE_USERINSTALL_FAILED, BE_LANGUAGE_MISSING, BE_USERINSTALL_NOTENOUGHDISKSPACE, - BE_USERINSTALL_NOWRITEACCESS + BE_USERINSTALL_NOWRITEACCESS, + BE_OFFICECONFIG_BROKEN }; enum BootstrapStatus { diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index 8029b6ecc9f7..dc5d7a99b2d6 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -3,7 +3,7 @@ dt desktop usr1 - all dt_mkout NULL dt desktop\inc nmake - all dt_inc NULL dt desktop\prj get - all dt_prj NULL dt desktop\res get - all dt_res NULL -dt desktop\source\app nmake - all dt_app dt_migr dt_inc NULL +dt desktop\source\app nmake - all dt_app dt_migr dt_inc dt_dp_misc NULL dt desktop\source\migration nmake - all dt_migr dt_inc NULL dt desktop\source\migration\services nmake - all dt_services dt_inc dt_dp_misc NULL dt desktop\source\so_comp nmake - all dt_so_comp dt_inc NULL @@ -35,7 +35,7 @@ dt desktop\source\deployment\registry\configuration nmake - all dt_dp_registry_c dt desktop\source\deployment\registry\help nmake - all dt_dp_registry_help dt_inc NULL dt desktop\source\deployment\registry\executable nmake - all dt_dp_registry_executable dt_inc NULL dt desktop\scripts nmake - u dt_scripts dt_inc NULL -dt desktop\util nmake - all dt_util dt_app dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w NULL +dt desktop\util nmake - all dt_util dt_app dt_pagein.u dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w NULL dt desktop\zipintro nmake - all dt_zipintro NULL dt desktop\registry\data\org\openoffice\Office nmake - all sn_regconfig NULL dt desktop\source\registration\com\sun\star\servicetag\resources get - all sn_svctagres NULL diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index bba615e0ebbc..731ffe85d83b 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -492,7 +492,12 @@ void Desktop::Init() { // prepare language if ( !LanguageSelection::prepareLanguage() ) - SetBootstrapError( BE_LANGUAGE_MISSING ); + { + if ( LanguageSelection::getStatus() == LanguageSelection::LS_STATUS_CANNOT_DETERMINE_LANGUAGE ) + SetBootstrapError( BE_LANGUAGE_MISSING ); + else + SetBootstrapError( BE_OFFICECONFIG_BROKEN ); + } } if ( GetBootstrapError() == BE_OK ) @@ -873,6 +878,17 @@ void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError ) FatalError( aMessage); } + else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN ) + { + OUString aMessage; + OUStringBuffer aDiagnosticMessage( 100 ); + OUString aErrorMsg; + aErrorMsg = GetMsgString( STR_CONFIG_ERR_ACCESS_GENERAL, + OUString( RTL_CONSTASCII_USTRINGPARAM( "A general error occurred while accessing your central configuration." )) ); + aDiagnosticMessage.append( aErrorMsg ); + aMessage = MakeStartupErrorMessage( aDiagnosticMessage.makeStringAndClear() ); + FatalError(aMessage); + } else if ( aBootstrapError == BE_USERINSTALL_FAILED ) { OUString aMessage; diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 5e2145b03729..9df8d82a37ff 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -64,10 +64,12 @@ namespace desktop { static char const SOFFICE_BOOTSTRAP[] = "Bootstrap"; static char const SOFFICE_STARTLANG[] = "STARTLANG"; + sal_Bool LanguageSelection::bFoundLanguage = sal_False; OUString LanguageSelection::aFoundLanguage; -const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US"); +LanguageSelection::LanguageSelectionStatus LanguageSelection::m_eStatus = LS_STATUS_OK; +const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US"); static sal_Bool existsURL( OUString const& sURL ) { @@ -122,6 +124,7 @@ Locale LanguageSelection::IsoStringToLocale(const OUString& str) bool LanguageSelection::prepareLanguage() { + m_eStatus = LS_STATUS_OK; OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"); Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory(); Reference< XLocalizable > theConfigProvider; @@ -131,7 +134,9 @@ bool LanguageSelection::prepareLanguage() } catch(const Exception&) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } + if(!theConfigProvider.is()) return false; @@ -149,6 +154,7 @@ bool LanguageSelection::prepareLanguage() } catch(const Exception&) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } // #i32939# use system locale to set document default locale @@ -162,6 +168,7 @@ bool LanguageSelection::prepareLanguage() } catch (Exception&) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } // get the selected UI language as string @@ -350,8 +357,10 @@ OUString LanguageSelection::getLanguageString() aFoundLanguage = usFallbackLanguage; return aFoundLanguage; } + // fallback didn't work use first installed language aUserLanguage = getFirstInstalledLanguage(); + bFoundLanguage = sal_True; aFoundLanguage = aUserLanguage; return aFoundLanguage; @@ -455,7 +464,7 @@ sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bEx // requested locale starts with the installed locale // (i.e. installed locale has index 0 in requested locale) bInstalled = sal_True; - usLocale = seqLanguages[i]; + usLocale = seqLanguages[i]; break; } } @@ -484,10 +493,12 @@ OUString LanguageSelection::getUserLanguage() } catch ( NoSuchElementException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } catch ( WrappedTargetException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } } @@ -506,10 +517,12 @@ OUString LanguageSelection::getSystemLanguage() } catch ( NoSuchElementException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } catch ( WrappedTargetException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } } @@ -533,9 +546,13 @@ void LanguageSelection::resetUserLanguage() { OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); OSL_ENSURE(sal_False, aMsg.getStr()); + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } - } +LanguageSelection::LanguageSelectionStatus LanguageSelection::getStatus() +{ + return m_eStatus; +} } // namespace desktop diff --git a/desktop/source/app/langselect.hxx b/desktop/source/app/langselect.hxx index 60308164690f..bdf3cd6364de 100644 --- a/desktop/source/app/langselect.hxx +++ b/desktop/source/app/langselect.hxx @@ -40,10 +40,24 @@ namespace desktop class LanguageSelection { +public: + enum LanguageSelectionStatus + { + LS_STATUS_OK, + LS_STATUS_CANNOT_DETERMINE_LANGUAGE, + LS_STATUS_CONFIGURATIONACCESS_BROKEN + }; + + static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str); + static rtl::OUString getLanguageString(); + static bool prepareLanguage(); + static LanguageSelectionStatus getStatus(); + private: static const rtl::OUString usFallbackLanguage; static rtl::OUString aFoundLanguage; static sal_Bool bFoundLanguage; + static LanguageSelectionStatus m_eStatus; static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate=sal_False); @@ -55,11 +69,6 @@ private: static rtl::OUString getSystemLanguage(); static void resetUserLanguage(); static void setDefaultLanguage(const rtl::OUString&); - -public: - static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str); - static rtl::OUString getLanguageString(); - static bool prepareLanguage(); }; } //namespace desktop diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 1a66ff38e4a4..87f70e449b9d 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -1147,13 +1147,13 @@ void ExtMgrDialog::Resize() { ImplControlValue aValue; bool bNativeOK; - Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() ); + Rectangle aNativeControlRegion, aNativeContentRegion; if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) != FALSE ) { - nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + nProgressHeight = aNativeControlRegion.GetHeight(); } } @@ -1590,13 +1590,13 @@ void UpdateRequiredDialog::Resize() { ImplControlValue aValue; bool bNativeOK; - Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() ); + Rectangle aNativeControlRegion, aNativeContentRegion; if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) != FALSE ) { - nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + nProgressHeight = aNativeControlRegion.GetHeight(); } } diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 314537836921..314537836921 100755..100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 381a98ce008f..c6a185b8e54d 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -640,20 +640,18 @@ void SplashScreen::Paint( const Rectangle&) ImplControlValue aValue( _iProgress * _barwidth / _iMax); Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) ); - Region aControlRegion( aDrawRect ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aNativeControlRegion, aNativeContentRegion; - if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion, + if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) { - long nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + long nProgressHeight = aNativeControlRegion.GetHeight(); aDrawRect.Top() -= (nProgressHeight - _barheight)/2; aDrawRect.Bottom() += (nProgressHeight - _barheight)/2; - aControlRegion = Region( aDrawRect ); } - if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion, + if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect, CTRL_STATE_ENABLED, aValue, _sProgressText )) != FALSE ) { return; diff --git a/desktop/test/deployment/boxt/makefile.mk b/desktop/test/deployment/boxt/makefile.mk index 63f123fcc608..11d736448d44 100644 --- a/desktop/test/deployment/boxt/makefile.mk +++ b/desktop/test/deployment/boxt/makefile.mk @@ -33,11 +33,9 @@ ENABLE_EXCEPTIONS = TRUE .INCLUDE: settings.mk .INCLUDE: rtlbootstrap.mk +.INCLUDE: versionlist.mk -#TODO: The underlying OOo base version needed here is currently only available -# as instsetoo_native/util/openoffice.lst OOOBASEVERSION, so hard-coding it here -# for now (see issue 110653): -my_version = 3.3 +my_version = $(OOOBASEVERSIONMAJOR).$(OOOBASEVERSIONMINOR) DLLPRE = diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc index f149ec6474e7..8bc39767f04a 100644 --- a/desktop/util/ooverinfo2.rc +++ b/desktop/util/ooverinfo2.rc @@ -1,7 +1,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 @@ -25,26 +25,26 @@ * *************************************************************************/ -#define VERSION 3 -#define SUBVERSION 2 -//#define VERVARIANT 0 +#define VERSION 3 +#define SUBVERSION 3 +//#define VERVARIANT 0 // .0 + VER_CONCEPT // .100 + VER_ALPHA // .200 + VER_BETA // .300 + VER_GAMMA // .500 + VER_FINAL -//#define VER_CONCEPT 0 -//#define VER_BETA 6 -#define VER_FINAL 0 +//#define VER_CONCEPT 0 +//#define VER_BETA 6 +#define VER_FINAL 0 -#define VER_DAY 1 -#define VER_MONTH 9 -#define VER_YEAR 2009 +#define VER_DAY 1 +#define VER_MONTH 1 +#define VER_YEAR 2010 // ----------------------------------------------------------------------- // ----------------------------------------------------------------------- -// language/character set specification table +// language/character set specification table // ----------------------------------------------------------------------- diff --git a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx index bd8c3be1fbbd..71c4cc6ffe1e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx @@ -56,7 +56,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransformation, const Primitive2DSequence& rChildren); - // get data + /// data read access const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& getChartModel() const { return mxChartModel; } const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 7872ad825496..c60257551c28 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -90,7 +90,7 @@ #define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47) #define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48) #define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49) -#define PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) +#define PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50) #define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51) #define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52) #define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53) diff --git a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx index ce49995c999d..d651af24047d 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/embedded3dprimitive2d.hxx @@ -101,7 +101,7 @@ namespace drawinglayer double fShadowSlant, const basegfx::B3DRange& rScene3DRange); - /// get data + /// data read access const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; } const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; } const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx index 237ae00a4642..e2323765b2e5 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/helplineprimitive2d.hxx @@ -94,8 +94,8 @@ namespace drawinglayer double fDiscreteDashLength); /// data read access - const basegfx::B2DPoint getPosition() const { return maPosition; } - const basegfx::B2DVector getDirection() const { return maDirection; } + const basegfx::B2DPoint& getPosition() const { return maPosition; } + const basegfx::B2DVector& getDirection() const { return maDirection; } HelplineStyle2D getStyle() const { return meStyle; } const basegfx::BColor& getRGBColA() const { return maRGBColA; } const basegfx::BColor& getRGBColB() const { return maRGBColB; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index 80e281ede05c..ee5de781be86 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -189,7 +189,7 @@ namespace drawinglayer const attribute::LineAttribute& rLineAttribute); /// data read access - basegfx::B2DPolygon getB2DPolygon() const { return maPolygon; } + const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 18743937b6bc..4a48ae0d3e59 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -69,7 +69,7 @@ namespace drawinglayer PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor); /// data read access - basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const basegfx::BColor& getBColor() const { return maBColor; } /// compare operator @@ -123,7 +123,7 @@ namespace drawinglayer double fDiscreteDashLength); // data read access - basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } double getDiscreteDashLength() const { return mfDiscreteDashLength; } @@ -182,7 +182,7 @@ namespace drawinglayer const attribute::LineAttribute& rLineAttribute); /// data read access - basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx index 4c95972ca67d..278a1b0bfff2 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/sceneprimitive2d.hxx @@ -136,7 +136,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rObjectTransformation, const geometry::ViewInformation3D& rViewInformation3D); - /// data ead access + /// data read access const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; } const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return maSdrSceneAttribute; } const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return maSdrLightingAttribute; } diff --git a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx index 6ae691cbcff9..5c1093bc333a 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx @@ -129,8 +129,8 @@ namespace drawinglayer TextStrikeout getTextStrikeout() const { return meTextStrikeout; } TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; } TextRelief getTextRelief() const { return meTextRelief; } - basegfx::BColor getOverlineColor() const { return maOverlineColor; } - basegfx::BColor getTextlineColor() const { return maTextlineColor; } + const basegfx::BColor& getOverlineColor() const { return maOverlineColor; } + const basegfx::BColor& getTextlineColor() const { return maTextlineColor; } bool getUnderlineAbove() const { return mbUnderlineAbove; } bool getWordLineMode() const { return mbWordLineMode; } bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; } diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 6fa1cef2d23f..0d57e566ef8a 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -2301,35 +2301,48 @@ namespace { const Gradient& rGradient = pA->GetGradient(); const drawinglayer::attribute::FillGradientAttribute aAttribute(createFillGradientAttribute(rGradient)); + basegfx::B2DPolyPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); if(aAttribute.getStartColor() == aAttribute.getEndColor()) { // not really a gradient. Create filled rectangle - const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange)); - createFillPrimitive(basegfx::B2DPolyPolygon(aOutline), rTargetHolders.Current(), rPropertyHolders.Current()); + createFillPrimitive( + aOutline, + rTargetHolders.Current(), + rPropertyHolders.Current()); } else { // really a gradient aRange.transform(rPropertyHolders.Current().getTransformation()); + drawinglayer::primitive2d::Primitive2DSequence xGradient(1); if(rPropertyHolders.Current().isRasterOpInvert()) { // use a special version of FillGradientPrimitive2D which creates // non-overlapping geometry on decomposition to makethe old XOR // paint 'trick' work. - rTargetHolders.Current().append( + xGradient[0] = drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::NonOverlappingFillGradientPrimitive2D( aRange, aAttribute)); } else { - rTargetHolders.Current().append( + xGradient[0] = drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::FillGradientPrimitive2D( aRange, aAttribute)); } + + // #i112300# clip against polygon representing the rectangle from + // the action. This is implicitely done using a temp Clipping in VCL + // when a MetaGradientAction is executed + aOutline.transform(rPropertyHolders.Current().getTransformation()); + rTargetHolders.Current().append( + new drawinglayer::primitive2d::MaskPrimitive2D( + aOutline, + xGradient)); } } } diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx index 0ead7302ba38..8adcb6a10b82 100644 --- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx @@ -50,7 +50,7 @@ namespace drawinglayer } // provide unique ID - ImplPrimitrive2DIDBlock(StructureTagPrimitive2D, PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D) + ImplPrimitrive2DIDBlock(StructureTagPrimitive2D, PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D) } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 983cc8f58d4f..dc954de7bb2a 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -94,6 +94,147 @@ using namespace com::sun::star; ////////////////////////////////////////////////////////////////////////////// +// #112245# definition for maximum allowed point count due to Metafile target. +// To be on the safe side with the old tools polygon, use slightly less then +// the theoretical maximum (bad experiences with tools polygon) + +#define MAX_POLYGON_POINT_COUNT_METAFILE (0x0000fff0) + +////////////////////////////////////////////////////////////////////////////// + +namespace +{ + // #112245# helper to split line polygon in half + void splitLinePolygon( + const basegfx::B2DPolygon& rBasePolygon, + basegfx::B2DPolygon& o_aLeft, + basegfx::B2DPolygon& o_aRight) + { + const sal_uInt32 nCount(rBasePolygon.count()); + + if(nCount) + { + const sal_uInt32 nHalfCount((nCount - 1) >> 1); + + o_aLeft = basegfx::B2DPolygon(rBasePolygon, 0, nHalfCount + 1); + o_aLeft.setClosed(false); + + o_aRight = basegfx::B2DPolygon(rBasePolygon, nHalfCount, nCount - nHalfCount); + o_aRight.setClosed(false); + + if(rBasePolygon.isClosed()) + { + o_aRight.append(rBasePolygon.getB2DPoint(0)); + + if(rBasePolygon.areControlPointsUsed()) + { + o_aRight.setControlPoints( + o_aRight.count() - 1, + rBasePolygon.getPrevControlPoint(0), + rBasePolygon.getNextControlPoint(0)); + } + } + } + else + { + o_aLeft.clear(); + o_aRight.clear(); + } + } + + // #112245# helper to evtl. split filled polygons to maximum metafile point count + bool fillPolyPolygonNeededToBeSplit(basegfx::B2DPolyPolygon& rPolyPolygon) + { + bool bRetval(false); + const sal_uInt32 nPolyCount(rPolyPolygon.count()); + + if(nPolyCount) + { + basegfx::B2DPolyPolygon aSplitted; + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + const basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aCandidate.count()); + bool bNeedToSplit(false); + + if(aCandidate.areControlPointsUsed()) + { + // compare with the maximum for bezier curved polygons + bNeedToSplit = nPointCount > ((MAX_POLYGON_POINT_COUNT_METAFILE / 3L) - 1L); + } + else + { + // compare with the maximum for simple point polygons + bNeedToSplit = nPointCount > (MAX_POLYGON_POINT_COUNT_METAFILE - 1); + } + + if(bNeedToSplit) + { + // need to split the partial polygon + const basegfx::B2DRange aRange(aCandidate.getB2DRange()); + const basegfx::B2DPoint aCenter(aRange.getCenter()); + + if(aRange.getWidth() > aRange.getHeight()) + { + // clip in left and right + const basegfx::B2DPolyPolygon aLeft( + basegfx::tools::clipPolygonOnParallelAxis( + aCandidate, + false, + true, + aCenter.getX(), + false)); + const basegfx::B2DPolyPolygon aRight( + basegfx::tools::clipPolygonOnParallelAxis( + aCandidate, + false, + false, + aCenter.getX(), + false)); + + aSplitted.append(aLeft); + aSplitted.append(aRight); + } + else + { + // clip in top and bottom + const basegfx::B2DPolyPolygon aTop( + basegfx::tools::clipPolygonOnParallelAxis( + aCandidate, + true, + true, + aCenter.getY(), + false)); + const basegfx::B2DPolyPolygon aBottom( + basegfx::tools::clipPolygonOnParallelAxis( + aCandidate, + true, + false, + aCenter.getY(), + false)); + + aSplitted.append(aTop); + aSplitted.append(aBottom); + } + } + else + { + aSplitted.append(aCandidate); + } + } + + if(aSplitted.count() != nPolyCount) + { + rPolyPolygon = aSplitted; + } + } + + return bRetval; + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// namespace drawinglayer { @@ -982,26 +1123,65 @@ namespace drawinglayer } case PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D : { - // direct draw of hairline; use default processing - // also support SvtGraphicStroke MetaCommentAction const primitive2d::PolygonHairlinePrimitive2D& rHairlinePrimitive = static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate); - const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rHairlinePrimitive.getBColor())); - SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rHairlinePrimitive.getB2DPolygon(), &aLineColor, 0, 0, 0, 0); + const basegfx::B2DPolygon& rBasePolygon = rHairlinePrimitive.getB2DPolygon(); - impStartSvtGraphicStroke(pSvtGraphicStroke); - RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), false); - impEndSvtGraphicStroke(pSvtGraphicStroke); + if(rBasePolygon.count() > (MAX_POLYGON_POINT_COUNT_METAFILE - 1)) + { + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. If there are more, split the polygon in half and call recursively + basegfx::B2DPolygon aLeft, aRight; + splitLinePolygon(rBasePolygon, aLeft, aRight); + const primitive2d::PolygonHairlinePrimitive2D aPLeft(aLeft, rHairlinePrimitive.getBColor()); + const primitive2d::PolygonHairlinePrimitive2D aPRight(aRight, rHairlinePrimitive.getBColor()); + + processBasePrimitive2D(aPLeft); + processBasePrimitive2D(aPRight); + } + else + { + // direct draw of hairline; use default processing + // support SvtGraphicStroke MetaCommentAction + const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rHairlinePrimitive.getBColor())); + SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke( + rHairlinePrimitive.getB2DPolygon(), + &aLineColor, + 0, 0, 0, 0); + + impStartSvtGraphicStroke(pSvtGraphicStroke); + RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), false); + impEndSvtGraphicStroke(pSvtGraphicStroke); + } break; } case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D : { - // support SvtGraphicStroke MetaCommentAction const primitive2d::PolygonStrokePrimitive2D& rStrokePrimitive = static_cast< const primitive2d::PolygonStrokePrimitive2D& >(rCandidate); - SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokePrimitive.getB2DPolygon(), 0, &rStrokePrimitive.getLineAttribute(), - &rStrokePrimitive.getStrokeAttribute(), 0, 0); + const basegfx::B2DPolygon& rBasePolygon = rStrokePrimitive.getB2DPolygon(); - if(true) + if(rBasePolygon.count() > (MAX_POLYGON_POINT_COUNT_METAFILE - 1)) { + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. If there are more, split the polygon in half and call recursively + basegfx::B2DPolygon aLeft, aRight; + splitLinePolygon(rBasePolygon, aLeft, aRight); + const primitive2d::PolygonStrokePrimitive2D aPLeft( + aLeft, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute()); + const primitive2d::PolygonStrokePrimitive2D aPRight( + aRight, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute()); + + processBasePrimitive2D(aPLeft); + processBasePrimitive2D(aPRight); + } + else + { + // support SvtGraphicStroke MetaCommentAction + SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke( + rBasePolygon, 0, + &rStrokePrimitive.getLineAttribute(), + &rStrokePrimitive.getStrokeAttribute(), + 0, 0); + impStartSvtGraphicStroke(pSvtGraphicStroke); const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute(); @@ -1013,12 +1193,12 @@ namespace drawinglayer if(0.0 == rStroke.getFullDotDashLen()) { - aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon()); + aHairLinePolyPolygon.append(rBasePolygon); } else { basegfx::tools::applyLineDashing( - rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(), + rBasePolygon, rStroke.getDotDashArray(), &aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen()); } @@ -1048,93 +1228,52 @@ namespace drawinglayer impEndSvtGraphicStroke(pSvtGraphicStroke); } - else - { - // Adapt OutDev's DrawMode if special ones were used - const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode()); - adaptLineToFillDrawMode(); - - impStartSvtGraphicStroke(pSvtGraphicStroke); - - // #i101491# - // Change default of fat line generation for MetaFiles: Create MetaPolyLineAction - // instead of decomposing all geometries when the polygon has more than given amount of - // points; else the decomposition will get too expensive quiclky. OTOH - // the decomposition provides the better quality e.g. taking edge roundings - // into account which will NOT be taken into account with LineInfo-based actions - const sal_uInt32 nSubPolygonCount(rStrokePrimitive.getB2DPolygon().count()); - bool bDone(0 == nSubPolygonCount); - - if(!bDone && nSubPolygonCount > 1000) - { - // create MetaPolyLineActions, but without LINE_DASH - const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute(); - - if(basegfx::fTools::more(rLine.getWidth(), 0.0)) - { - const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute(); - basegfx::B2DPolyPolygon aHairLinePolyPolygon; - - if(0.0 == rStroke.getFullDotDashLen()) - { - aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon()); - } - else - { - basegfx::tools::applyLineDashing( - rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(), - &aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen()); - } - - const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLine.getColor())); - mpOutputDevice->SetLineColor(Color(aHairlineColor)); - mpOutputDevice->SetFillColor(); - - aHairLinePolyPolygon.transform(maCurrentTransformation); - - const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth())); - - for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++) - { - const basegfx::B2DPolygon aCandidate(aHairLinePolyPolygon.getB2DPolygon(a)); - - if(aCandidate.count() > 1) - { - const Polygon aToolsPolygon(aCandidate); - - mpMetaFile->AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo)); - } - } - - bDone = true; - } - } - - if(!bDone) - { - // use decomposition (creates line geometry as filled polygon - // geometry) - process(rCandidate.get2DDecomposition(getViewInformation2D())); - } - - impEndSvtGraphicStroke(pSvtGraphicStroke); - - // restore DrawMode - mpOutputDevice->SetDrawMode(nOriginalDrawMode); - } break; } case PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D : { - // support SvtGraphicStroke MetaCommentAction const primitive2d::PolygonStrokeArrowPrimitive2D& rStrokeArrowPrimitive = static_cast< const primitive2d::PolygonStrokeArrowPrimitive2D& >(rCandidate); - SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokeArrowPrimitive.getB2DPolygon(), 0, &rStrokeArrowPrimitive.getLineAttribute(), - &rStrokeArrowPrimitive.getStrokeAttribute(), &rStrokeArrowPrimitive.getStart(), &rStrokeArrowPrimitive.getEnd()); + const basegfx::B2DPolygon& rBasePolygon = rStrokeArrowPrimitive.getB2DPolygon(); + + if(rBasePolygon.count() > (MAX_POLYGON_POINT_COUNT_METAFILE - 1)) + { + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. If there are more, split the polygon in half and call recursively + basegfx::B2DPolygon aLeft, aRight; + splitLinePolygon(rBasePolygon, aLeft, aRight); + const attribute::LineStartEndAttribute aEmpty; + const primitive2d::PolygonStrokeArrowPrimitive2D aPLeft( + aLeft, + rStrokeArrowPrimitive.getLineAttribute(), + rStrokeArrowPrimitive.getStrokeAttribute(), + rStrokeArrowPrimitive.getStart(), + aEmpty); + const primitive2d::PolygonStrokeArrowPrimitive2D aPRight( + aRight, + rStrokeArrowPrimitive.getLineAttribute(), + rStrokeArrowPrimitive.getStrokeAttribute(), + aEmpty, + rStrokeArrowPrimitive.getEnd()); + + processBasePrimitive2D(aPLeft); + processBasePrimitive2D(aPRight); + } + else + { + // support SvtGraphicStroke MetaCommentAction + SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke( + rBasePolygon, 0, + &rStrokeArrowPrimitive.getLineAttribute(), + &rStrokeArrowPrimitive.getStrokeAttribute(), + &rStrokeArrowPrimitive.getStart(), + &rStrokeArrowPrimitive.getEnd()); + + impStartSvtGraphicStroke(pSvtGraphicStroke); + process(rCandidate.get2DDecomposition(getViewInformation2D())); + impEndSvtGraphicStroke(pSvtGraphicStroke); + } - impStartSvtGraphicStroke(pSvtGraphicStroke); - process(rCandidate.get2DDecomposition(getViewInformation2D())); - impEndSvtGraphicStroke(pSvtGraphicStroke); break; } case PRIMITIVE2D_ID_BITMAPPRIMITIVE2D : @@ -1146,16 +1285,26 @@ namespace drawinglayer case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D : { // need to handle PolyPolygonBitmapPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END - SvtGraphicFill* pSvtGraphicFill = 0; + const primitive2d::PolyPolygonBitmapPrimitive2D& rBitmapCandidate = static_cast< const primitive2d::PolyPolygonBitmapPrimitive2D& >(rCandidate); + basegfx::B2DPolyPolygon aLocalPolyPolygon(rBitmapCandidate.getB2DPolyPolygon()); + + if(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) + { + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. If there are more use the splitted polygon and call recursively + const primitive2d::PolyPolygonBitmapPrimitive2D aSplitted( + aLocalPolyPolygon, + rBitmapCandidate.getFillBitmap()); - if(!mnSvtGraphicFillCount) + processBasePrimitive2D(aSplitted); + } + else { - const primitive2d::PolyPolygonBitmapPrimitive2D& rBitmapCandidate = static_cast< const primitive2d::PolyPolygonBitmapPrimitive2D& >(rCandidate); - basegfx::B2DPolyPolygon aLocalPolyPolygon(rBitmapCandidate.getB2DPolyPolygon()); - aLocalPolyPolygon.transform(maCurrentTransformation); + SvtGraphicFill* pSvtGraphicFill = 0; - if(aLocalPolyPolygon.count()) + if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) { + aLocalPolyPolygon.transform(maCurrentTransformation); // calculate transformation. Get real object size, all values in FillBitmapAttribute // are relative to the unified object const attribute::FillBitmapAttribute& rFillBitmapAttribute = rBitmapCandidate .getFillBitmap(); @@ -1212,78 +1361,81 @@ namespace drawinglayer 0, aFillGraphic); } - } - // Do use decomposition; encapsulate with SvtGraphicFill - impStartSvtGraphicFill(pSvtGraphicFill); - process(rCandidate.get2DDecomposition(getViewInformation2D())); - impEndSvtGraphicFill(pSvtGraphicFill); + // Do use decomposition; encapsulate with SvtGraphicFill + impStartSvtGraphicFill(pSvtGraphicFill); + process(rCandidate.get2DDecomposition(getViewInformation2D())); + impEndSvtGraphicFill(pSvtGraphicFill); + } break; } case PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D : { // need to handle PolyPolygonHatchPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END - SvtGraphicFill* pSvtGraphicFill = 0; const primitive2d::PolyPolygonHatchPrimitive2D& rHatchCandidate = static_cast< const primitive2d::PolyPolygonHatchPrimitive2D& >(rCandidate); - const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch(); basegfx::B2DPolyPolygon aLocalPolyPolygon(rHatchCandidate.getB2DPolyPolygon()); + + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. Split polygon until there are less than that + while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) + ; + + SvtGraphicFill* pSvtGraphicFill = 0; + const attribute::FillHatchAttribute& rFillHatchAttribute = rHatchCandidate.getFillHatch(); aLocalPolyPolygon.transform(maCurrentTransformation); - if(!mnSvtGraphicFillCount) + if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) { - if(aLocalPolyPolygon.count()) - { - // re-create a VCL hatch as base data - SvtGraphicFill::HatchType eHatch(SvtGraphicFill::hatchSingle); + // re-create a VCL hatch as base data + SvtGraphicFill::HatchType eHatch(SvtGraphicFill::hatchSingle); - switch(rFillHatchAttribute.getStyle()) + switch(rFillHatchAttribute.getStyle()) + { + default: // attribute::HATCHSTYLE_SINGLE : { - default: // attribute::HATCHSTYLE_SINGLE : - { - eHatch = SvtGraphicFill::hatchSingle; - break; - } - case attribute::HATCHSTYLE_DOUBLE : - { - eHatch = SvtGraphicFill::hatchDouble; - break; - } - case attribute::HATCHSTYLE_TRIPLE : - { - eHatch = SvtGraphicFill::hatchTriple; - break; - } + eHatch = SvtGraphicFill::hatchSingle; + break; + } + case attribute::HATCHSTYLE_DOUBLE : + { + eHatch = SvtGraphicFill::hatchDouble; + break; + } + case attribute::HATCHSTYLE_TRIPLE : + { + eHatch = SvtGraphicFill::hatchTriple; + break; } + } - SvtGraphicFill::Transform aTransform; + SvtGraphicFill::Transform aTransform; - // scale - aTransform.matrix[0] *= rFillHatchAttribute.getDistance(); - aTransform.matrix[4] *= rFillHatchAttribute.getDistance(); + // scale + aTransform.matrix[0] *= rFillHatchAttribute.getDistance(); + aTransform.matrix[4] *= rFillHatchAttribute.getDistance(); - // rotate (was never correct in impgrfll anyways, use correct angle now) - aTransform.matrix[0] *= cos(rFillHatchAttribute.getAngle()); - aTransform.matrix[1] *= -sin(rFillHatchAttribute.getAngle()); - aTransform.matrix[3] *= sin(rFillHatchAttribute.getAngle()); - aTransform.matrix[4] *= cos(rFillHatchAttribute.getAngle()); + // rotate (was never correct in impgrfll anyways, use correct angle now) + aTransform.matrix[0] *= cos(rFillHatchAttribute.getAngle()); + aTransform.matrix[1] *= -sin(rFillHatchAttribute.getAngle()); + aTransform.matrix[3] *= sin(rFillHatchAttribute.getAngle()); + aTransform.matrix[4] *= cos(rFillHatchAttribute.getAngle()); - pSvtGraphicFill = new SvtGraphicFill( - PolyPolygon(aLocalPolyPolygon), - Color(), - 0.0, - SvtGraphicFill::fillEvenOdd, - SvtGraphicFill::fillHatch, - aTransform, - false, - eHatch, - Color(rFillHatchAttribute.getColor()), - SvtGraphicFill::gradientLinear, - Color(), - Color(), - 0, - Graphic()); - } + pSvtGraphicFill = new SvtGraphicFill( + PolyPolygon(aLocalPolyPolygon), + Color(), + 0.0, + SvtGraphicFill::fillEvenOdd, + SvtGraphicFill::fillHatch, + aTransform, + false, + eHatch, + Color(rFillHatchAttribute.getColor()), + SvtGraphicFill::gradientLinear, + Color(), + Color(), + 0, + Graphic()); } // Do use decomposition; encapsulate with SvtGraphicFill @@ -1304,18 +1456,24 @@ namespace drawinglayer basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800))); impEndSvtGraphicFill(pSvtGraphicFill); + break; } case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D : { const primitive2d::PolyPolygonGradientPrimitive2D& rGradientCandidate = static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate); + basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon()); + + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. Split polygon until there are less than that + while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) + ; // for support of MetaCommentActions of the form XGRAD_SEQ_BEGIN, XGRAD_SEQ_END // it is safest to use the VCL OutputDevice::DrawGradient method which creates those. // re-create a VCL-gradient from FillGradientPrimitive2D and the needed tools PolyPolygon Gradient aVCLGradient; impConvertFillGradientAttributeToVCLGradient(aVCLGradient, rGradientCandidate.getFillGradient(), false); - basegfx::B2DPolyPolygon aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon()); aLocalPolyPolygon.transform(maCurrentTransformation); // #i82145# ATM VCL printing of gradients using curved shapes does not work, @@ -1373,13 +1531,20 @@ namespace drawinglayer // NO usage of common own gradient randerer, not used ATM for VCL MetaFile, see text above // RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate)); + break; } case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D : { const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate(static_cast< const primitive2d::PolyPolygonColorPrimitive2D& >(rCandidate)); - const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor())); basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon()); + + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. Split polygon until there are less than that + while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) + ; + + const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor())); aLocalPolyPolygon.transform(maCurrentTransformation); // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support @@ -1547,6 +1712,13 @@ namespace drawinglayer // single transparent PolyPolygon identified, use directly const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(pPoPoColor->getBColor())); basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); + + // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points + // per polygon. Split polygon until there are less than that + while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) + ; + + // now transform aLocalPolyPolygon.transform(maCurrentTransformation); // XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support @@ -1796,7 +1968,7 @@ namespace drawinglayer } break; } - case PRIMITIVE2D_ID_STRUCTURETAGRIMITIVE2D : + case PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D : { // structured tag primitive const primitive2d::StructureTagPrimitive2D& rStructureTagCandidate = static_cast< const primitive2d::StructureTagPrimitive2D& >(rCandidate); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 642b5e0d9f17..664512df414e 100755..100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1044,7 +1044,8 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) { PopupMenu aPopupMenu( EditResId( RID_MENU_SPELL ) ); PopupMenu *pAutoMenu = aPopupMenu.GetPopupMenu( MN_AUTOCORR ); - PopupMenu *pInsertMenu = aPopupMenu.GetPopupMenu( MN_INSERT ); + PopupMenu *pInsertMenu = aPopupMenu.GetPopupMenu( MN_INSERT ); // add word to user-dictionaries + pInsertMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); //! necessary to retrieve the correct dictionary names later EditPaM aPaM2( aPaM ); aPaM2.GetIndex()++; @@ -1261,7 +1262,12 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) } else if ( nId >= MN_DICTSTART ) { - Reference< XDictionary > xDic( pDic[nId - MN_DICTSTART], UNO_QUERY ); + String aDicName ( pInsertMenu->GetItemText(nId) ); + + uno::Reference< linguistic2::XDictionary > xDic; + if (xDicList.is()) + xDic = xDicList->getDictionaryByName( aDicName ); + if (xDic.is()) xDic->add( aSelected, sal_False, String() ); // save modified user-dictionary if it is persistent diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 778942730e71..148ca08816ae 100755..100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -4209,18 +4209,8 @@ long ImpEditEngine::GetXPos( ParaPortion* pParaPortion, EditLine* pLine, USHORT DBG_ERROR("svx::ImpEditEngine::GetXPos(), index out of range!"); } -#if 0 + // old code restored see #i112788 (which leaves #i74188 unfixed again) long nPosInPortion = pLine->GetCharPosArray().GetObject( nPos ); -#else - // #i74188# (positioning the cursor after deleting components of combined indic characters) - SvxFont aTmpFont( pParaPortion->GetNode()->GetCharAttribs().GetDefFont() ); - SeekCursor( pParaPortion->GetNode(), nPos+1, aTmpFont ); - aTmpFont.SetPhysFont( GetRefDevice() ); - ImplInitDigitMode( GetRefDevice(), 0, 0, 0, aTmpFont.GetLanguage() ); - String sSegment(*pParaPortion->GetNode(), pLine->GetStart(), nPos+1); - long nPosInPortion = aTmpFont.QuickGetTextSize( GetRefDevice(), - sSegment, 0, nPos+1, NULL ).Width(); -#endif if ( !pPortion->IsRightToLeft() ) { diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index e95ce560023b..ae92fd1a01b8 100644..100755 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -1197,7 +1197,10 @@ uno::Reference< XDictionary > LinguMgr::GetStandard() // add new dictionary to list if (xTmp.is()) + { xTmpDicList->addDictionary( xTmp ); + xTmp->setActive( sal_True ); + } xDic = uno::Reference< XDictionary > ( xTmp, UNO_QUERY ); } #if OSL_DEBUG_LEVEL > 1 diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx index c6b0acd6a33f..fdf4866daf24 100644 --- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx @@ -33,13 +33,13 @@ //------------------------------------------------------------------------ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <cppuhelper/interfacecontainer.h> #include <osl/diagnose.h> +#include <osl/process.h> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/ControlActions.hpp> #include <com/sun/star/uno/Any.hxx> @@ -126,41 +126,8 @@ void SalGtkFilePicker::InitialMapping() gtk_widget_set_size_request (m_pPreview, -1, -1); } -static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) -{ - static bool bSet = false; - if (bSet) - return; - - OUString sUILocale; - try - { - uno::Reference<lang::XMultiServiceFactory> xConfigMgr = - uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), - UNO_QUERY_THROW ); - - Sequence< Any > theArgs(1); - theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General"); - - uno::Reference< container::XNameAccess > xNameAccess = - uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments( - OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ), - UNO_QUERY_THROW ); - - if (xNameAccess.is()) - xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale; - } catch (...) {} - - if (sUILocale.getLength()) - { - sUILocale = rtl::OUString::createFromAscii("LANGUAGE=") + sUILocale.replace('-', '_'); - putenv(strdup(rtl::OUStringToOString(sUILocale, osl_getThreadTextEncoding()).getStr())); - } - bSet = true; -} - SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : + SalGtkPicker(xServiceMgr), cppu::WeakComponentImplHelper10< XFilterManager, XFilterGroupManager, @@ -184,8 +151,6 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFact m_PreviewImageWidth( 256 ), m_PreviewImageHeight( 256 ) { - lcl_setGTKLanguage(xServiceMgr); - int i; for( i = 0; i < TOGGLE_LAST; i++ ) @@ -935,6 +900,9 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw { static const OUString aStarDot = OUString::createFromAscii( "*." ); + ::rtl::OUString aNewFilter; + ::rtl::OUString aOldFilter = getCurrentFilter(); + sal_Bool bChangeFilter = sal_True; for ( FilterList::iterator aListIter = m_pFilterList->begin(); aListIter != m_pFilterList->end(); ++aListIter @@ -942,11 +910,17 @@ uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw { if( aListIter->getFilter().indexOf( aStarDot+sExtension ) >= 0 ) { - setCurrentFilter( aListIter->getTitle() ); + if( !aNewFilter.getLength() ) + aNewFilter = aListIter->getTitle(); + + if( aOldFilter == aListIter->getTitle() ) + bChangeFilter = sal_False; + bExtensionTypedIn = true; - break; } } + if( bChangeFilter ) + setCurrentFilter( aNewFilter ); } } diff --git a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx index f9c78d76639c..dd5d30d203a6 100644 --- a/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkFolderPicker.cxx @@ -84,7 +84,8 @@ namespace // constructor //----------------------------------------------------------------------------------------- SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) : - m_xServiceMgr( xServiceMgr ) + SalGtkPicker(xServiceMgr), + m_xServiceMgr(xServiceMgr) { CResourceProvider aResProvider; diff --git a/fpicker/source/unx/gnome/SalGtkPicker.cxx b/fpicker/source/unx/gnome/SalGtkPicker.cxx index 1a685e0981e6..6fd19b2f7f79 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.cxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> #include <com/sun/star/awt/SystemDependentXWindow.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/container/XNameAccess.hpp> #include <comphelper/processfactory.hxx> #include <cppuhelper/interfacecontainer.h> #include <rtl/process.h> @@ -202,6 +203,46 @@ gint RunDialog::run() return nStatus; } +static void lcl_setGTKLanguage(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) +{ + static bool bSet = false; + if (bSet) + return; + + OUString sUILocale; + try + { + uno::Reference<lang::XMultiServiceFactory> xConfigMgr = + uno::Reference<lang::XMultiServiceFactory>(xServiceMgr->createInstance( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + UNO_QUERY_THROW ); + + Sequence< Any > theArgs(1); + theArgs[ 0 ] <<= OUString::createFromAscii("org.openoffice.Office.Linguistic/General"); + + uno::Reference< container::XNameAccess > xNameAccess = + uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArguments( + OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), theArgs ), + UNO_QUERY_THROW ); + + if (xNameAccess.is()) + xNameAccess->getByName(OUString::createFromAscii("UILocale")) >>= sUILocale; + } catch (...) {} + + if (sUILocale.getLength()) + { + sUILocale = sUILocale.replace('-', '_'); + rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("LANGUAGE")); + osl_setEnvironment(envVar.pData, sUILocale.pData); + } + bSet = true; +} + +SalGtkPicker::SalGtkPicker(const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr) : m_pDialog(0) +{ + lcl_setGTKLanguage(xServiceMgr); +} + SalGtkPicker::~SalGtkPicker() { if (m_pDialog) diff --git a/fpicker/source/unx/gnome/SalGtkPicker.hxx b/fpicker/source/unx/gnome/SalGtkPicker.hxx index 6349d3ed4988..94e7a11de99a 100644 --- a/fpicker/source/unx/gnome/SalGtkPicker.hxx +++ b/fpicker/source/unx/gnome/SalGtkPicker.hxx @@ -53,7 +53,7 @@ class SalGtkPicker { public: - SalGtkPicker() : m_pDialog(0) {} + SalGtkPicker(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceMgr); virtual ~SalGtkPicker(); protected: osl::Mutex m_rbHelperMtx; diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx index a7fa01a5ece6..eadc255f0ec0 100644 --- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx +++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx @@ -46,6 +46,8 @@ #include <vcl/sysdata.hxx> #include <vcl/syswin.hxx> +#include "osl/file.h" + #include "KDE4FilePicker.hxx" #include "FPServiceInfo.hxx" @@ -246,7 +248,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() // kde file picker returns the file and directories for selectedFiles() // when a file is double clicked // make a true list of files - const QString dir = "file://" + KUrl(rawFiles[0]).directory(); + const QString dir = KUrl(rawFiles[0]).directory(); bool singleFile = true; if (rawFiles.size() > 1) @@ -262,7 +264,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() { // if the raw file is not the base directory (see above kde bug) // we add the file to list of avail files - if ((dir + "/") != ("file://" + rawFiles[i])) + if ((dir + "/") != ( rawFiles[i])) { QString filename = KUrl(rawFiles[i]).fileName(); @@ -280,7 +282,11 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() // add all files and leading directory to outgoing OO sequence uno::Sequence< ::rtl::OUString > seq(files.size()); for (int i = 0; i < files.size(); ++i) - seq[i] = toOUString(files[i]); + { + rtl::OUString aFile(toOUString(files[i])), aURL; + osl_getFileURLFromSystemPath(aFile.pData, &aURL.pData ); + seq[i] = aURL; + } return seq; } diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index ebed194fcffc..479827565775 100644..100755 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1463,9 +1463,6 @@ <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Find Text</value> </prop> - <prop oor:name="Properties" oor:type="xs:int"> - <value>1</value> - </prop> </node> <node oor:name=".uno:DownSearch" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> @@ -1487,9 +1484,6 @@ <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Focus to Findbar</value> </prop> - <prop oor:name="Properties" oor:type="xs:int"> - <value>1</value> - </prop> </node> <node oor:name=".uno:ExtendedHelp" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> @@ -2139,9 +2133,6 @@ <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Sentence case</value> </prop> - <prop oor:name="Properties" oor:type="xs:int"> - <value>1</value> - </prop> </node> <node oor:name=".uno:ChangeCaseToLower" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> @@ -2163,17 +2154,11 @@ <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Capitalize Every Word</value> </prop> - <prop oor:name="Properties" oor:type="xs:int"> - <value>1</value> - </prop> </node> <node oor:name=".uno:ChangeCaseToToggleCase" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~tOGGLE cASE</value> </prop> - <prop oor:name="Properties" oor:type="xs:int"> - <value>1</value> - </prop> </node> <node oor:name=".uno:ChangeCaseToHalfWidth" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> diff --git a/readlicense_oo/util/makefile.pmk b/readlicense_oo/util/makefile.pmk index 30e07779457b..0efd9712f11d 100755 --- a/readlicense_oo/util/makefile.pmk +++ b/readlicense_oo/util/makefile.pmk @@ -57,7 +57,7 @@ $(MISC)$/readme_text.xsl : virtual $(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual' @@-$(MKDIRHIER) $(@:d) - $(XSLTPROC) --nonet -o $@ \ + $(XSLTPROC) --nonet --novalid -o $@ \ --stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \ --stringparam cp1 $(CPUNAME) --stringparam type html --stringparam lang1 $* \ ..$/readme.xsl $(MERGEDXRM) @@ -67,7 +67,7 @@ $(MISC)$/$(GUI)$/$(eq,$(GUI),WNT readme README)_%.html : 'virtual' $(MISC)$/$(GUI)$/$(eq,$(GUI),OS2 readme README)_%.html : 'virtual' @@-$(MKDIRHIER) $(@:d) - $(XSLTPROC) --nonet -o $@ \ + $(XSLTPROC) --nonet --novalid -o $@ \ --stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \ --stringparam cp1 $(CPUNAME) --stringparam type html --stringparam lang1 $* \ ..$/readme.xsl $(MERGEDXRM) @@ -75,7 +75,7 @@ $(MISC)$/$(GUI)$/$(eq,$(GUI),OS2 readme README)_%.html : 'virtual' # no percent-rule to avoid ambiguous inference chains for README_<lang>.html $(SYSTEXTDOCS) : $(MISC)$/readme_text.xsl @@-$(MKDIRHIER) $(@:d) - $(XSLTPROC) --nonet -o $@ \ + $(XSLTPROC) --nonet --novalid -o $@ \ --stringparam os1 $(OS) --stringparam gui1 $(GUI) --stringparam com1 $(COM) \ --stringparam cp1 $(CPUNAME) --stringparam type text --stringparam lang1 $(@:b:s/readme_//:s/README_//) \ $< $(MERGEDXRM) diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index aa6c6cfb966a..0fc0778c71d9 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -766,6 +766,31 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs return xDialog; } + Reference < XDialog > DialogProviderImpl::createDialogWithArguments( + const ::rtl::OUString& URL, const Sequence< NamedValue >& Arguments ) + throw (IllegalArgumentException, RuntimeException) + { + ::comphelper::NamedValueCollection aArguments( Arguments ); + + Reference< XWindowPeer > xParentPeer; + if ( aArguments.has( "ParentWindow" ) ) + { + const Any aParentWindow( aArguments.get( "ParentWindow" ) ); + if ( !( aParentWindow >>= xParentPeer ) ) + { + const Reference< XControl > xParentControl( aParentWindow, UNO_QUERY ); + if ( xParentControl.is() ) + xParentPeer = xParentControl->getPeer(); + } + } + + const Reference< XInterface > xHandler( aArguments.get( "EventHandler" ), UNO_QUERY ); + + Reference < XControl > xControl = DialogProviderImpl::createDialogImpl( URL, xHandler, xParentPeer, true ); + Reference< XDialog > xDialog( xControl, UNO_QUERY ); + return xDialog; + } + Reference< XWindow > DialogProviderImpl::createContainerWindow( const ::rtl::OUString& URL, const ::rtl::OUString& WindowType, const Reference< XWindowPeer >& xParent, const Reference< XInterface >& xHandler ) diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx index f55239ff13e8..bc15831d2ff1 100644 --- a/scripting/source/dlgprov/dlgprov.hxx +++ b/scripting/source/dlgprov/dlgprov.hxx @@ -138,6 +138,11 @@ namespace dlgprov const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialogWithArguments( + const ::rtl::OUString& URL, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createContainerWindow( const ::rtl::OUString& URL, const ::rtl::OUString& WindowType, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent, diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index 55c204f87dbf..6592a59d1843 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -153,8 +153,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): if len(textbody): mimeEncoding = re.sub("charset=.*", "charset=UTF-8", flavor.MimeType) - if mimeEncoding.find('charset=UTF-8') == -1: - mimeEncoding = mimeEncoding + "; charset=UTF-8" + if mimeEncoding.find('charset=UTF-8') == -1: + mimeEncoding = mimeEncoding + "; charset=UTF-8" textmsg['Content-Type'] = mimeEncoding textmsg['MIME-Version'] = '1.0' textmsg.set_payload(textbody) diff --git a/sfx2/source/doc/syspathw32.cxx b/sfx2/source/doc/syspathw32.cxx index 73bd84f5249a..c0a163bed39c 100644 --- a/sfx2/source/doc/syspathw32.cxx +++ b/sfx2/source/doc/syspathw32.cxx @@ -74,7 +74,7 @@ typedef unsigned short sal_uInt16; extern "C" bool GetUserTemplateLocation(sal_Unicode* pFolder, int nSize) { #ifdef WNT - return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, pFolder, nSize ); + return _SHGetSpecialFolderW32( CSIDL_TEMPLATES, reinterpret_cast<LPWSTR>(pFolder), nSize ); #else (void)pFolder; (void)nSize; diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index b264a5b47861..bc765b95340c 100755..100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -578,6 +578,7 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra return 0; } + void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFrame, const Point& rPoint, Window* pWindow ) { PopupMenu *pSVMenu = new PopupMenu( rResId ); @@ -622,6 +623,12 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() ); aPop.RemoveDisabledEntries(); aPop.Execute( rPoint, pWindow ); + + // #i112646 avoid crash when context menu is closed. + // the (manually inserted) sub-menu needs to be destroyed before + // aPop gets destroyed. + delete pThesSubMenu; + pThesSubMenu = 0; } delete pThesSubMenu; @@ -631,3 +638,4 @@ Menu* SfxPopupMenuManager::GetSVMenu() { return (Menu*) GetMenu()->GetSVMenu(); } + diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index d99ad8733e03..d43512ac791d 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -280,10 +280,7 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewI aLoadArgs = aArgs.getPropertyValues(); // load the doc into that frame - ::rtl::OUString sLoaderURL( rDoc.GetModel()->getURL() ); - if ( sLoaderURL.getLength() == 0 ) - sLoaderURL = rDoc.GetFactory().GetFactoryURL(); - + ::rtl::OUString sLoaderURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) ); Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW ); xLoader->loadComponentFromURL( sLoaderURL, diff --git a/sfx2/source/view/userinputinterception.cxx b/sfx2/source/view/userinputinterception.cxx index e716e604b649..ad910a944e0f 100644 --- a/sfx2/source/view/userinputinterception.cxx +++ b/sfx2/source/view/userinputinterception.cxx @@ -216,6 +216,13 @@ namespace sfx2 if ( e.Context == xHandler ) aIterator.remove(); } + catch( const RuntimeException& ) + { + throw; + } + catch( const Exception& ) + { + } } } break; @@ -247,6 +254,13 @@ namespace sfx2 if ( e.Context == xHandler ) aIterator.remove(); } + catch( const RuntimeException& ) + { + throw; + } + catch( const Exception& ) + { + } } } break; diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 1c9e219cf180..be20cd2f2a47 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -75,7 +75,7 @@ struct SfxViewShell_Impl ::svt::AcceleratorExecute* pAccExec; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; - vcl::PrinterController* pPrinterController; + ::boost::shared_ptr< vcl::PrinterController > m_pPrinterController; SfxViewShell_Impl(); }; diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index f62ae4c1ddc7..5b317e4b770b 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -332,7 +332,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt mpObjectShell->EnableSetModified( m_bOrigStatus ); if ( mpViewShell ) - mpViewShell->pImp->pPrinterController = 0; + { + mpViewShell->pImp->m_pPrinterController.reset(); + } } } @@ -643,7 +645,7 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro this, rProps ) ); - pImp->pPrinterController = pController.get(); + pImp->m_pPrinterController = pController; SfxObjectShell *pObjShell = GetObjectShell(); pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ), @@ -661,7 +663,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro Printer* SfxViewShell::GetActivePrinter() const { - return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0; + return (pImp->m_pPrinterController) + ? pImp->m_pPrinterController->getPrinter().get() : 0; } void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 612f2ab927ec..3a31c3d11206 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -35,6 +35,7 @@ // predeclarations class SdrObject; class SfxItemSet; +class SdrPageProperties; namespace sdr { @@ -89,6 +90,8 @@ namespace sdr // operators sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; + + const SdrPageProperties* getCorrectSdrPageProperties() const; }; } // end of namespace sdr diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx index fc8d401f94e7..328efedd98f0 100644 --- a/svx/inc/svx/svdmodel.hxx +++ b/svx/inc/svx/svdmodel.hxx @@ -276,7 +276,7 @@ public: SdrOutlinerCache* mpOutlinerCache; SdrModelImpl* mpImpl; UINT16 mnCharCompressType; - UINT16 nReserveUInt5; + UINT16 mnHandoutPageCount; UINT16 nReserveUInt6; UINT16 nReserveUInt7; FASTBOOL mbModelLocked; @@ -298,6 +298,10 @@ public: SvNumberFormatter* mpNumberFormatter; public: const SvNumberFormatter& GetNumberFormatter() const; + + UINT16 getHandoutPageCount() const { return mnHandoutPageCount; } + void setHandoutPageCount( UINT16 nHandoutPageCount ) { mnHandoutPageCount = nHandoutPageCount; } + protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel(); diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index c601fddef181..784598d7d544 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -448,6 +448,7 @@ private: public: SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; } const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; } + const SdrPageProperties* getCorrectSdrPageProperties() const; protected: // new MasterPageDescriptorVector diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index bc8e6ef7c4bd..4120027c3e35 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -241,8 +241,9 @@ void GalApp::Init() #endif rtl::OUString baseBinDir = fileName.copy( 0, lastSlash ); rtl::OUString installPrefix = baseBinDir + rtl::OUString::createFromAscii( "/../.." ); - rtl::OUString assignment = rtl::OUString::createFromAscii( "OOO_INSTALL_PREFIX=" ) + installPrefix; - putenv( strdup( OUSTRING_CSTR( assignment ))); + + rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("OOO_INSTALL_PREFIX")); + osl_setEnvironment(envVar.pData, installPrefix.pData); } OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) ); diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index cbe9c4a9c615..6ca5f1c4d172 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -62,23 +62,7 @@ namespace sdr { drawinglayer::primitive2d::Primitive2DSequence xRetval; drawinglayer::attribute::SdrFillAttribute aFill; - const SdrPage* pCorrectPage = &GetMasterPageDescriptor().GetOwnerPage(); - const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties(); - - if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue()) - { - pCorrectPage = &GetMasterPageDescriptor().GetUsedPage(); - pCorrectProperties = &pCorrectPage->getSdrPageProperties(); - } - - if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet()) - { - // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, - // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all - // MasterPages should have a StyleSheet excactly for this reason, but historically - // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). - pCorrectProperties = 0; - } + const SdrPageProperties* pCorrectProperties = GetMasterPageDescriptor().getCorrectSdrPageProperties(); if(pCorrectProperties) { diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index 5ef26193d4b3..34731f100b5d 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -273,9 +273,16 @@ namespace sdr // init extractor, guarantee existance, set page there mpExtractor->SetStartPage(pPage); + // #i105548# also need to copy the VOCRedirector for sub-content creation + mpExtractor->SetViewObjectContactRedirector(GetObjectContact().GetViewObjectContactRedirector()); + // create page content xPageContent = mpExtractor->createPrimitive2DSequenceForPage(rDisplayInfo); + // #i105548# reset VOCRedirector to not accidentially have a pointer to a + // temporary class, so calls to it are avoided safely + mpExtractor->SetViewObjectContactRedirector(0); + // reset recursion flag bInCreatePrimitive2D = false; } diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 2320944afd03..089f75aa8ade 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -77,8 +77,16 @@ namespace if(pPage && pPage->GetModel()) { - const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount()); - nRetval = ((sal_Int16)nPageCount - 1) / 2; + if( (pPage->GetPageNum() == 0) && !pPage->IsMasterPage() ) + { + // handout page! + return pPage->GetModel()->getHandoutPageCount(); + } + else + { + const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount()); + nRetval = ((sal_Int16)nPageCount - 1) / 2; + } } return nRetval; diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx index 348c319e256e..091656e1f261 100644 --- a/svx/source/sdr/properties/textproperties.cxx +++ b/svx/source/sdr/properties/textproperties.cxx @@ -185,18 +185,21 @@ namespace sdr { SdrText* pText = rObj.getText( nCount ); OutlinerParaObject* pParaObj = pText->GetOutlinerParaObject(); - rOutliner.SetText(*pParaObj); - sal_uInt32 nParaCount(rOutliner.GetParagraphCount()); - - if(nParaCount) + if( pParaObj ) { - ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL); - rOutliner.RemoveAttribs(aSelection, sal_True, 0); + rOutliner.SetText(*pParaObj); + sal_uInt32 nParaCount(rOutliner.GetParagraphCount()); - OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount); - rOutliner.Clear(); + if(nParaCount) + { + ESelection aSelection( 0, 0, EE_PARA_ALL, EE_PARA_ALL); + rOutliner.RemoveAttribs(aSelection, sal_True, 0); - rObj.NbcSetOutlinerParaObjectForText( pTemp, pText ); + OutlinerParaObject* pTemp = rOutliner.CreateParaObject(0, (sal_uInt16)nParaCount); + rOutliner.Clear(); + + rObj.NbcSetOutlinerParaObjectForText( pTemp, pText ); + } } } } diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 67b2de8b693c..eb757a8ee41c 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -113,6 +113,29 @@ namespace sdr || &maUsedPage != &rCandidate.maUsedPage || maVisibleLayers != rCandidate.maVisibleLayers); } + + const SdrPageProperties* MasterPageDescriptor::getCorrectSdrPageProperties() const + { + const SdrPage* pCorrectPage = &GetOwnerPage(); + const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties(); + + if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue()) + { + pCorrectPage = &GetUsedPage(); + pCorrectProperties = &pCorrectPage->getSdrPageProperties(); + } + + if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet()) + { + // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, + // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all + // MasterPages should have a StyleSheet excactly for this reason, but historically + // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + pCorrectProperties = 0; + } + + return pCorrectProperties; + } } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 2fcdfdffbb8a..8ab385fa329c 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -178,6 +178,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe mpOutlinerCache = NULL; mbKernAsianPunctuation = sal_False; mbAddExtLeading = sal_False; + mnHandoutPageCount = 0; SvxAsianConfig aAsian; mnCharCompressType = aAsian.GetCharDistanceCompression(); diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 2b495725c006..9d136ef82eae 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -2927,7 +2927,8 @@ sal_Bool SdrPathObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx:: aScale = aCorrectedRangeNoCurve.getRange(); // define matrix for move polygon to zero point - aMoveToZeroMatrix.translate(-aCorrectedRangeNoCurve.getMinX(), aCorrectedRangeNoCurve.getMinY()); + // #i112280# Added missing minus for Y-Translation + aMoveToZeroMatrix.translate(-aCorrectedRangeNoCurve.getMinX(), -aCorrectedRangeNoCurve.getMinY()); } else { diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 8da0b248f38b..592f41543132 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1979,6 +1979,18 @@ void SdrPage::ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew) } } +const SdrPageProperties* SdrPage::getCorrectSdrPageProperties() const +{ + if(mpMasterPageDescriptor) + { + return mpMasterPageDescriptor->getCorrectSdrPageProperties(); + } + else + { + return &getSdrPageProperties(); + } +} + ////////////////////////////////////////////////////////////////////////////// // use new redirector instead of pPaintProc diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index f4f03170a90f..5dcaf6fd5e72 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -92,7 +92,7 @@ FindTextFieldControl::~FindTextFieldControl() void FindTextFieldControl::InitControls_Impl() { SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); - SetControlForeground(COL_GRAY); + SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor()); EnableAutocomplete(TRUE, TRUE); } @@ -117,7 +117,7 @@ void FindTextFieldControl::Modify() { ComboBox::Modify(); - SetControlForeground( Color( COL_BLACK ) ); + SetControlForeground( GetSettings().GetStyleSettings().GetWindowTextColor() ); } long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) @@ -135,7 +135,10 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) sal_uInt16 nCode = pKeyEvent->GetKeyCode().GetCode(); if ( (bCtrl && bAlt && KEY_F == nCode) || KEY_ESCAPE == nCode ) + { + nRet = 1; GrabFocusToDocument(); + } if ( KEY_RETURN == nCode ) { @@ -154,6 +157,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) lArgs[1].Value <<= sal_False; impl_executeSearch(m_xServiceManager, m_xFrame, lArgs); + nRet = 1; } break; } @@ -171,7 +175,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) if ( GetText().Len() == 0 ) { SetText( String( ::rtl::OUString::createFromAscii("Find") ) ); - SetControlForeground(COL_GRAY); + SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor()); m_bToClearTextField = sal_True; } break; diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index b80be1076b7e..c58e86f77fc3 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -634,10 +634,16 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic, { if( rSettings.mbExportOnlyBackground ) { - pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); - pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet()); - pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); - aShapes.push_back(pTempBackgroundShape); + const SdrPageProperties* pCorrectProperties = pPage->getCorrectSdrPageProperties(); + + if(pCorrectProperties) + { + pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize())); + pTempBackgroundShape->SetMergedItemSet(pCorrectProperties->GetItemSet()); + pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE)); + pTempBackgroundShape->NbcSetStyleSheet(pCorrectProperties->GetStyleSheet(), true); + aShapes.push_back(pTempBackgroundShape); + } } else { diff --git a/sysui/desktop/debian/makefile.mk b/sysui/desktop/debian/makefile.mk index f0f4e4288639..45e0f331f714 100644 --- a/sysui/desktop/debian/makefile.mk +++ b/sysui/desktop/debian/makefile.mk @@ -45,7 +45,7 @@ TARGET=debian .IF "$(PKGFORMAT)"!="$(PKGFORMAT:s/deb//)" -DEBFILES=$(foreach,i,{$(PRODUCTLIST)} $(PKGDIR)$/$i3.3-$(TARGET)-menus_$(PKGVERSION.$i)-$(PKGREV)_all.deb) +DEBFILES=$(foreach,i,{$(PRODUCTLIST)} $(PKGDIR)$/$i3.4-$(TARGET)-menus_$(PKGVERSION.$i)-$(PKGREV)_all.deb) .ENDIF @@ -60,22 +60,22 @@ ALLTAR : $(DEBFILES) %/DEBIAN/control : $$(@:f) @$(MKDIRHIER) $(@:d) $*$/etc $*$/usr/share/applnk/Office $*$/usr/lib/menu - ln -sf /opt/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//)) $*$/etc$/ - /bin/sh -c -x "cd $(COMMONMISC)$/$(*:f:s/-/ /:1:s/3.3//) && DESTDIR=$(shell @cd $*; pwd) ICON_PREFIX=$(ICONPREFIX) KDEMAINDIR=/usr GNOMEDIR=/usr create_tree.sh" - @cat openoffice.org-debian-menus | sed -e 's/%PRODUCTNAME/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.3//)) $(PRODUCTVERSION.$(*:f:s/-/ /:1:s/3.3//))/' -e 's/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/' -e 's/%ICONPREFIX/$(ICONPREFIX.$(*:f:s/-/ /:1:s/3.3//))/' > $*$/usr/lib/menu/$(*:f:s/_/ /:1:s/3.3//) - echo "Package: $(*:f:s/_/ /:1:s/3.3//)" > $@ - cat $(@:f) | tr -d "\015" | sed "s/%productname/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.3//))/" >> $@ - echo "Version: $(PKGVERSION.$(*:f:s/-/ /:1:s/3.3//))-$(PKGREV)" >> $@ + ln -sf /opt/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//)) $*$/etc$/ + /bin/sh -c -x "cd $(COMMONMISC)$/$(*:f:s/-/ /:1:s/3.4//) && DESTDIR=$(shell @cd $*; pwd) ICON_PREFIX=$(ICONPREFIX) KDEMAINDIR=/usr GNOMEDIR=/usr create_tree.sh" + @cat openoffice.org-debian-menus | sed -e 's/%PRODUCTNAME/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.4//)) $(PRODUCTVERSION.$(*:f:s/-/ /:1:s/3.4//))/' -e 's/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/' -e 's/%ICONPREFIX/$(ICONPREFIX.$(*:f:s/-/ /:1:s/3.4//))/' > $*$/usr/lib/menu/$(*:f:s/_/ /:1:s/3.4//) + echo "Package: $(*:f:s/_/ /:1:s/3.4//)" > $@ + cat $(@:f) | tr -d "\015" | sed "s/%productname/$(PRODUCTNAME.$(*:f:s/-/ /:1:s/3.4//))/" >> $@ + echo "Version: $(PKGVERSION.$(*:f:s/-/ /:1:s/3.4//))-$(PKGREV)" >> $@ @du -k -s $* | awk -F ' ' '{ printf "Installed-Size: %s\n", $$1 ; }' >> $@ %/DEBIAN/postinst : $$(@:f) - @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/g" > $@ + @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/g" > $@ %/DEBIAN/postrm : $$(@:f) - @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/g" > $@ + @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/g" > $@ %/DEBIAN/prerm : $$(@:f) - @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.3//))/g" > $@ + @cat $< | tr -d "\015" | sed -e "s/%PREFIX/$(UNIXFILENAME.$(*:f:s/-/ /:1:s/3.4//))/g" > $@ # --- packaging --------------------------------------------------- diff --git a/sysui/desktop/productversion.mk b/sysui/desktop/productversion.mk index 24b1a2db042d..09141b2276bd 100644 --- a/sysui/desktop/productversion.mk +++ b/sysui/desktop/productversion.mk @@ -46,7 +46,7 @@ PKGDIR=$(BIN) PRODUCTLIST = openoffice.org broffice.org # default values to minimize maintainance effort -PRODUCTVERSION = 3.3 +PRODUCTVERSION = 3.4 PRODUCTVERSIONSHORT = 3 PKGVERSION = $(PRODUCTVERSION) # gnome-vfs treats everything behind the last '.' as an icon extension, diff --git a/sysui/desktop/slackware/makefile.mk b/sysui/desktop/slackware/makefile.mk index 6fde1caf6528..eeeb141c6397 100644 --- a/sysui/desktop/slackware/makefile.mk +++ b/sysui/desktop/slackware/makefile.mk @@ -40,7 +40,7 @@ TARGET=slackware # --- Files -------------------------------------------------------- -MENUFILES=$(PKGDIR)$/{$(PRODUCTLIST)}3.3-$(TARGET)-menus-$(PKGVERSION)-noarch-$(PKGREV).tgz +MENUFILES=$(PKGDIR)$/{$(PRODUCTLIST)}3.4-$(TARGET)-menus-$(PKGVERSION)-noarch-$(PKGREV).tgz # --- Targets ------------------------------------------------------- @@ -59,26 +59,26 @@ $(MISC)/$(TARGET)/usr/share/applications/ : # FIXME: removal of *-extension.* only to create identical packages to OOF680 %/usr/share/applications : @$(MKDIRHIER) $@ - /bin/sh -c "cd $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.3//); DESTDIR=$(shell @cd $*; pwd) GNOMEDIR="" ICON_PREFIX=$(ICONPREFIX.$(*:b:s/-/ /:1:s/3.3//)) KDEMAINDIR=/opt/kde .$/create_tree.sh" + /bin/sh -c "cd $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.4//); DESTDIR=$(shell @cd $*; pwd) GNOMEDIR="" ICON_PREFIX=$(ICONPREFIX.$(*:b:s/-/ /:1:s/3.4//)) KDEMAINDIR=/opt/kde .$/create_tree.sh" $(RM) $*$/opt$/kde$/share$/icons$/*$/*$/*$/*-extension.png $(RM) $*$/opt$/kde$/share$/mimelnk$/application$/*-extension.desktop $(RM) $*$/usr$/share$/applications$/*.desktop $(RM) $*$/usr$/bin$/soffice %$/install$/doinst.sh : update-script - @echo "( cd etc ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//)) )" > $@ - @echo "( cd etc ; ln -snf /opt/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//):s/-//) $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//)) )" >> $@ + @echo "( cd etc ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//)) )" > $@ + @echo "( cd etc ; ln -snf /opt/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//):s/-//) $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//)) )" >> $@ @echo "( cd usr/bin ; rm -rf soffice )" >> $@ - @echo "( cd usr/bin ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))/program/soffice soffice )" >> $@ - @echo -e $(foreach,i,$(shell @cat $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.3//)/launcherlist) "\n( cd usr/share/applications ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))-$i )\n( cd usr/share/applications ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))/share/xdg/$i $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))-$i )") >> $@ + @echo "( cd usr/bin ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))/program/soffice soffice )" >> $@ + @echo -e $(foreach,i,$(shell @cat $(COMMONMISC)$/$(*:b:s/-/ /:1:s/3.4//)/launcherlist) "\n( cd usr/share/applications ; rm -rf $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))-$i )\n( cd usr/share/applications ; ln -sf /etc/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))/share/xdg/$i $(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))-$i )") >> $@ @cat $< >> $@ %$/install$/slack-desc : slack-desc @$(MKDIRHIER) $(@:d) - @sed -e "s/PKGNAME/$(*:b:s/-/ /:1:s/3.3//)-$(TARGET)-menus/g" -e "s/PKGVERSION/$(PKGVERSION.$(*:b:s/-/ /:1:s/3.3//))/g" \ - -e "s/LONGPRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.3//)) $(PRODUCTVERSION.$(*:b:s/-/ /:1:s/3.3//))/g" \ - -e "s/PRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.3//))/g" \ - -e "s/UNIXFILENAME/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.3//))/g" $< > $@ + @sed -e "s/PKGNAME/$(*:b:s/-/ /:1:s/3.4//)-$(TARGET)-menus/g" -e "s/PKGVERSION/$(PKGVERSION.$(*:b:s/-/ /:1:s/3.4//))/g" \ + -e "s/LONGPRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.4//)) $(PRODUCTVERSION.$(*:b:s/-/ /:1:s/3.4//))/g" \ + -e "s/PRODUCTNAME/$(PRODUCTNAME.$(*:b:s/-/ /:1:s/3.4//))/g" \ + -e "s/UNIXFILENAME/$(UNIXFILENAME.$(*:b:s/-/ /:1:s/3.4//))/g" $< > $@ # needed to satisfy the slackware package tools - they need # the entries like this diff --git a/ucb/source/core/cmdenv.cxx b/ucb/source/core/cmdenv.cxx index 0f425e814400..5c0136fab063 100644..100755 --- a/ucb/source/core/cmdenv.cxx +++ b/ucb/source/core/cmdenv.cxx @@ -183,7 +183,7 @@ UcbCommandEnvironment::createServiceFactory( const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr ) { return uno::Reference< lang::XSingleServiceFactory >( - cppu::createOneInstanceFactory( + cppu::createSingleFactory( rxServiceMgr, UcbCommandEnvironment::getImplementationName_Static(), UcbCommandEnvironment_CreateInstance, diff --git a/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/ucb/source/ucp/webdav/DAVResourceAccess.cxx index 872d45405735..e4617b7b9ea7 100644 --- a/ucb/source/ucp/webdav/DAVResourceAccess.cxx +++ b/ucb/source/ucp/webdav/DAVResourceAccess.cxx @@ -1201,8 +1201,7 @@ sal_Bool DAVResourceAccess::handleException( DAVException & e, int errorCount ) // if we have a bad connection try again. Up to three times. case DAVException::DAV_HTTP_ERROR: // retry up to three times, if not a client-side error. - if ( e.getStatus() > 0 && - ( e.getStatus() < 400 || e.getStatus() > 499 ) && + if ( ( e.getStatus() < 400 || e.getStatus() >= 500 ) && errorCount < 3 ) { return sal_True; diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 73fa61f31ff4..6d65eb67055e 100755..100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -52,7 +52,6 @@ #include "logindlg.hxx" #include "masterpasscrtdlg.hxx" #include "masterpassworddlg.hxx" -#include "passcrtdlg.hxx" #include "passworddlg.hxx" #include "iahndl.hxx" diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 0879e3574da3..ee233f5ac9de 100755..100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -89,6 +89,7 @@ #include "newerverwarn.hxx" #include "iahndl.hxx" +#include "nameclashdlg.hxx" /** === begin UNO using === **/ using ::com::sun::star::uno::Sequence; @@ -867,8 +868,6 @@ UUIInteractionHelper::handleRequest_impl( if ( handleCertificateValidationRequest( rRequest ) ) return true; -// @@@ Todo #i29340#: activate! -#if 0 ucb::NameClashResolveRequest aNameClashResolveRequest; if (aAnyRequest >>= aNameClashResolveRequest) { @@ -876,7 +875,7 @@ UUIInteractionHelper::handleRequest_impl( rRequest->getContinuations()); return true; } -#endif + if ( handleMasterPasswordRequest( rRequest ) ) return true; @@ -1188,40 +1187,26 @@ executeMessageBox( return aResult; } -// @@@ Todo #i29340#: activate! -#if 0 -enum NameClashResolveDialogResult { ABORT, RENAME, OVERWRITE }; - -NameClashResolveDialogResult -executeNameClashResolveDialog( - Window * /*pParent*/, - rtl::OUString const & /*rTargetFolderURL*/, - rtl::OUString const & /*rClashingName*/, - rtl::OUString & /*rProposedNewName*/) +NameClashResolveDialogResult executeSimpleNameClashResolveDialog( Window *pParent, + rtl::OUString const & rTargetFolderURL, + rtl::OUString const & rClashingName, + rtl::OUString & rProposedNewName, + bool bAllowOverwrite ) { - // @@@ Todo DV: execute overwrite-rename dialog, deliver result - OSL_ENSURE( false, - "executeNameClashResolveDialog not yet implemented!" ); - return ABORT; -} + std::auto_ptr< ResMgr > xManager( ResMgr::CreateResMgr( CREATEVERSIONRESMGR_NAME( uui ) ) ); + if ( !xManager.get() ) + return ABORT; -NameClashResolveDialogResult -executeSimpleNameClashResolveDialog( - Window * /*pParent*/, - rtl::OUString const & /*rTargetFolderURL*/, - rtl::OUString const & /*rClashingName*/, - rtl::OUString & /*rProposedNewName*/) -{ - // @@@ Todo DV: execute rename-only dialog, deliver result - OSL_ENSURE( false, - "executeSimpleNameClashResolveDialog not yet implemented!" ); - return ABORT; + NameClashDialog aDialog( pParent, xManager.get(), rTargetFolderURL, + rClashingName, rProposedNewName, bAllowOverwrite ); + + NameClashResolveDialogResult eResult = (NameClashResolveDialogResult) aDialog.Execute(); + rProposedNewName = aDialog.getNewName(); + return eResult; } -#endif + } // namespace -// @@@ Todo #i29340#: activate! -#if 0 void UUIInteractionHelper::handleNameClashResolveRequest( ucb::NameClashResolveRequest const & rRequest, @@ -1251,18 +1236,12 @@ UUIInteractionHelper::handleNameClashResolveRequest( NameClashResolveDialogResult eResult = ABORT; rtl::OUString aProposedNewName( rRequest.ProposedNewName ); - if ( xReplaceExistingData.is() ) - eResult = executeNameClashResolveDialog( - getParentProperty(), - rRequest.TargetFolderURL, - rRequest.ClashingName, - aProposedNewName); - else - eResult = executeSimpleNameClashResolveDialog( - getParentProperty(), - rRequest.TargetFolderURL, - rRequest.ClashingName, - aProposedNewName); + + eResult = executeSimpleNameClashResolveDialog( getParentProperty(), + rRequest.TargetFolderURL, + rRequest.ClashingName, + aProposedNewName, + xReplaceExistingData.is() ); switch ( eResult ) { @@ -1282,14 +1261,8 @@ UUIInteractionHelper::handleNameClashResolveRequest( "No ReplaceExistingData continuation available!" ); xReplaceExistingData->select(); break; - - default: - OSL_ENSURE( false, "Unknown NameClashResolveDialogResult value. " - "Interaction Request not handled!" ); - break; } } -#endif void UUIInteractionHelper::handleGenericErrorRequest( diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index 581099462845..6402653d3bda 100755..100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -215,8 +215,6 @@ private: com::sun::star::task::XInteractionRequest > const & rRequest) SAL_THROW((com::sun::star::uno::RuntimeException)); -// @@@ Todo #i29340#: activate! -#if 0 void handleNameClashResolveRequest( com::sun::star::ucb::NameClashResolveRequest const & rRequest, @@ -225,7 +223,6 @@ private: com::sun::star::task::XInteractionContinuation > > const & rContinuations) SAL_THROW((com::sun::star::uno::RuntimeException)); -#endif bool handleMasterPasswordRequest( diff --git a/uui/source/ids.hrc b/uui/source/ids.hrc index 796186fd5140..9be81479ef59 100755..100644 --- a/uui/source/ids.hrc +++ b/uui/source/ids.hrc @@ -48,13 +48,14 @@ #define DLG_FILTER_SELECT (RID_UUI_START + 10) // RID_UUI_START + 11 moved to ERRCODE_UUI_WRONGMEDIUM #define DLG_UUI_MASTERPASSWORD (RID_UUI_START + 12) +#define DLG_SIMPLE_NAME_CLASH (RID_UUI_START + 13) #define STR_ERROR_PASSWORDS_NOT_IDENTICAL (RID_UUI_START + 13) #define STR_ERROR_MASTERPASSWORD_WRONG (RID_UUI_START + 14) // RID_UUI_START + 15, 16, 17 are misused by syncaccess/source/ui/resids.hrc + #define RID_UUI_ERRHDL (RID_UUI_START + 20) #define DLG_UUI_MASTERPASSWORD_CRT (RID_UUI_START + 21) #define DLG_UUI_PASSWORD (RID_UUI_START + 22) -#define DLG_UUI_PASSWORD_CRT (RID_UUI_START + 23) #define STR_ERROR_PASSWORD_TO_OPEN_WRONG (RID_UUI_START + 24) #define STR_ERROR_PASSWORD_TO_MODIFY_WRONG (RID_UUI_START + 25) #define DLG_UUI_UNKNOWNAUTH (RID_UUI_START + 26) @@ -89,6 +90,9 @@ #define STR_WARNING_BROKENSIGNATURE_TITLE (RID_UUI_START + 55) #define STR_ENTER_PASSWORD_TO_OPEN (RID_UUI_START + 56) #define STR_ENTER_PASSWORD_TO_MODIFY (RID_UUI_START + 57) +#define STR_RENAME_OR_REPLACE (RID_UUI_START + 58) +#define STR_NAME_CLASH_RENAME_ONLY (RID_UUI_START + 59) +#define STR_SAME_NAME_USED (RID_UUI_START + 60) #define ERRCODE_UUI_IO_ABORT (ERRCODE_AREA_UUI + 0) #define ERRCODE_UUI_IO_ACCESSDENIED (ERRCODE_AREA_UUI + 1) @@ -176,7 +180,6 @@ #define HID_DLG_MASTERPASSWORD_CRT (HID_UUI_START + 3) #define HID_DLG_FILTER_SELECT (HID_UUI_START + 4) #define HID_DLG_PASSWORD_UUI (HID_UUI_START + 5) -#define HID_DLG_PASSWORD_CRT (HID_UUI_START + 6) #define HID_DLG_UNKNOWNAUTH_UUI (HID_UUI_START + 7) #define HID_DLG_SSLWARN_UUI (HID_UUI_START + 8) #define HID_XMLSECDLG_MACROWARN (HID_UUI_START + 9) @@ -189,6 +192,7 @@ #define HID_LOGIN_DLG_ACCOUNT (HID_UUI_START +15) #define HID_LOGIN_DLG_REMEMBER_PASSWORD (HID_UUI_START +16) #define HID_LOGIN_DLG_USE_SYSTEM_CREDENTIALS (HID_UUI_START +17) +#define HID_DLG_SIMPLE_NAME_CLASH (HID_UUI_START +18) // HID_UUI_END (aka HID_CHAOS_NEW_DATABASE) is reserved in // sfx2/util/hidother.src diff --git a/uui/source/loginerr.hxx b/uui/source/loginerr.hxx index ec1317dbd805..39bbfb7d820c 100755..100644 --- a/uui/source/loginerr.hxx +++ b/uui/source/loginerr.hxx @@ -68,7 +68,7 @@ public: const String& GetUserName() const { return m_aUserName; } const String& GetPassword() const { return m_aPassword; } const String& GetPasswordToModify() const { return m_aPasswordToModify; } - const bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; } + bool IsRecommendToOpenReadonly() const { return m_bRecommendToOpenReadonly; } const String& GetPath() const { return m_aPath; } const String& GetErrorText() const { return m_aErrorText; } BOOL GetCanRememberPassword() const { return ( m_nFlags & LOGINERROR_FLAG_CAN_REMEMBER_PASSWORD ); } diff --git a/uui/source/makefile.mk b/uui/source/makefile.mk index 5c20e593046a..e09f5c01e967 100644..100755 --- a/uui/source/makefile.mk +++ b/uui/source/makefile.mk @@ -48,7 +48,6 @@ SLOFILES = \ $(SLO)$/masterpasscrtdlg.obj \ $(SLO)$/openlocked.obj \ $(SLO)$/passworddlg.obj \ - $(SLO)$/passcrtdlg.obj \ $(SLO)$/fltdlg.obj \ $(SLO)$/interactionhandler.obj \ $(SLO)$/requeststringresolver.obj \ @@ -60,6 +59,7 @@ SLOFILES = \ $(SLO)$/lockfailed.obj \ $(SLO)$/trylater.obj \ $(SLO)$/newerverwarn.obj \ + $(SLO)$/nameclashdlg.obj \ $(SLO)$/passwordcontainer.obj SRS1NAME=$(TARGET) @@ -71,7 +71,6 @@ SRC1FILES = \ masterpasscrtdlg.src \ openlocked.src \ passworddlg.src \ - passcrtdlg.src \ passworderrs.src \ fltdlg.src \ unknownauthdlg.src\ @@ -81,6 +80,7 @@ SRC1FILES = \ alreadyopen.src\ lockfailed.src\ trylater.src\ + nameclashdlg.src\ newerverwarn.src .INCLUDE: target.mk diff --git a/uui/source/nameclashdlg.cxx b/uui/source/nameclashdlg.cxx new file mode 100755 index 000000000000..593398d53640 --- /dev/null +++ b/uui/source/nameclashdlg.cxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#include "vcl/msgbox.hxx" +#include "osl/file.hxx" + +#include "ids.hrc" +#include "nameclashdlg.hrc" +#include "nameclashdlg.hxx" + +// NameClashDialog --------------------------------------------------------- + +IMPL_LINK( NameClashDialog, ButtonHdl_Impl, PushButton *, pBtn ) +{ + long nRet = (long) ABORT; + if ( &maBtnRename == pBtn ) + { + nRet = (long) RENAME; + rtl::OUString aNewName = maEDNewName.GetText(); + if ( ( aNewName == maNewName ) || !aNewName.getLength() ) + { + ErrorBox aError( NULL, WB_OK, maSameName ); + aError.Execute(); + return 1; + } + maNewName = aNewName; + } + else if ( &maBtnOverwrite == pBtn ) + nRet = (long) OVERWRITE; + + EndDialog( nRet ); + + return 1; +} + +// ----------------------------------------------------------------------- +NameClashDialog::NameClashDialog( Window* pParent, ResMgr* pResMgr, + rtl::OUString const & rTargetFolderURL, + rtl::OUString const & rClashingName, + rtl::OUString const & rProposedNewName, + bool bAllowOverwrite ) + : ModalDialog( pParent, ResId( DLG_SIMPLE_NAME_CLASH, *pResMgr ) ), + maFTMessage ( this, ResId( FT_FILE_EXISTS_WARNING, *pResMgr ) ), + maEDNewName ( this, ResId( EDIT_NEW_NAME, *pResMgr ) ), + maBtnOverwrite ( this, ResId( BTN_OVERWRITE, *pResMgr ) ), + maBtnRename ( this, ResId( BTN_RENAME, *pResMgr ) ), + maBtnCancel ( this, ResId( BTN_CANCEL, *pResMgr ) ), + maBtnHelp ( this, ResId( BTN_HELP, *pResMgr ) ), + maNewName ( rClashingName ) +{ + FreeResource(); + + Link aLink( LINK( this, NameClashDialog, ButtonHdl_Impl ) ); + maBtnOverwrite.SetClickHdl( aLink ); + maBtnRename.SetClickHdl( aLink ); + maBtnCancel.SetClickHdl( aLink ); + + String aInfo; + if ( bAllowOverwrite ) + { + aInfo = String( ResId( STR_RENAME_OR_REPLACE, *pResMgr ) ); + } + else + { + aInfo = String( ResId( STR_NAME_CLASH_RENAME_ONLY, *pResMgr ) ); + maBtnOverwrite.Hide(); + } + + rtl::OUString aPath; + if ( osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL( rTargetFolderURL, aPath ) ) + aPath = rTargetFolderURL; + + maSameName = String ( ResId( STR_SAME_NAME_USED, *pResMgr ) ); + + aInfo.SearchAndReplaceAscii( "%NAME", rClashingName ); + aInfo.SearchAndReplaceAscii( "%FOLDER", aPath ); + maFTMessage.SetText( aInfo ); + if ( rProposedNewName.getLength() ) + maEDNewName.SetText( rProposedNewName ); + else + maEDNewName.SetText( rClashingName ); +} + diff --git a/uui/source/passcrtdlg.hrc b/uui/source/nameclashdlg.hrc index 5a999aa99209..1bfdc01de5ab 100644..100755 --- a/uui/source/passcrtdlg.hrc +++ b/uui/source/nameclashdlg.hrc @@ -25,19 +25,17 @@ * ************************************************************************/ -#ifndef UUI_PASSCRTDLG_HRC -#define UUI_PASSCRTDLG_HRC +#ifndef UUI_NAMECLASHDLG_HRC +#define UUI_NAMECLASHDLG_HRC -// local identifiers -#define BTN_PASSCRT_CANCEL 1 -#define ED_PASSWORD_CRT 2 -#define FT_PASSWORD_REPEAT 3 -#define FT_PASSWORD_WARNING 4 -#define ED_PASSWORD_REPEAT 5 -#define FL_FIXED_LINE_1 6 -#define BTN_PASSCRT_OK 7 -#define BTN_PASSCRT_HELP 8 -#define FT_PASSWORD_CRT 9 -#define FT_MSPASSWORD_WARNING 10 +//============================================================================ + +#define FT_FILE_EXISTS_WARNING 20 +#define EDIT_NEW_NAME 21 +#define BTN_OVERWRITE 22 +#define BTN_RENAME 23 +#define BTN_CANCEL 24 +#define BTN_HELP 25 + +#endif // UUI_NAMECLASHDLG_HRC -#endif // UUI_PASSCRTDLG_HRC diff --git a/uui/source/passcrtdlg.hxx b/uui/source/nameclashdlg.hxx index 8ad19c59924d..1e234008a229 100644..100755 --- a/uui/source/passcrtdlg.hxx +++ b/uui/source/nameclashdlg.hxx @@ -25,39 +25,39 @@ * ************************************************************************/ -#ifndef UUI_PASSCRTDLG_HXX -#define UUI_PASSCRTDLG_HXX +#ifndef UUI_NAMECLASHDLG_HXX +#define UUI_NAMECLASHDLG_HXX -#include <com/sun/star/task/PasswordRequestMode.hpp> -#include <svtools/stdctrl.hxx> -#include <vcl/dialog.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <vcl/button.hxx> +#include "vcl/button.hxx" +#include "vcl/dialog.hxx" +#include "vcl/fixed.hxx" +#include "vcl/edit.hxx" //============================================================================ -class PasswordCreateDialog : public ModalDialog + +enum NameClashResolveDialogResult { ABORT, RENAME, OVERWRITE }; + +class NameClashDialog : public ModalDialog { - FixedText aFTPasswordCrt; - Edit aEDPasswordCrt; - FixedText aFTPasswordRepeat; - Edit aEDPasswordRepeat; - FixedText aFTWarning; - FixedLine aFixedLine1; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - - ResMgr* pResourceMgr; - sal_uInt16 nMinLen; - - DECL_LINK( OKHdl_Impl, OKButton * ); - DECL_LINK( EditHdl_Impl, Edit * ); + FixedText maFTMessage; + Edit maEDNewName; + PushButton maBtnOverwrite; + PushButton maBtnRename; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + rtl::OUString maSameName; + rtl::OUString maNewName; -public: - PasswordCreateDialog( Window* pParent, ResMgr * pResMgr, bool bMSCryptoMode = false ); + DECL_LINK( ButtonHdl_Impl, PushButton * ); - String GetPassword() const { return aEDPasswordCrt.GetText(); } +public: + NameClashDialog( Window* pParent, ResMgr* pResMgr, + rtl::OUString const & rTargetFolderURL, + rtl::OUString const & rClashingName, + rtl::OUString const & rProposedNewName, + bool bAllowOverwrite ); + rtl::OUString getNewName() const { return maNewName; } }; -#endif // UUI_PASSCRTDLG_HXX +#endif // UUI_COOKIEDG_HXX + diff --git a/uui/source/nameclashdlg.src b/uui/source/nameclashdlg.src new file mode 100755 index 000000000000..de8cdb8e716d --- /dev/null +++ b/uui/source/nameclashdlg.src @@ -0,0 +1,113 @@ +/************************************************************************* + * + * 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 + * + * 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. + * + ************************************************************************/ + +#define __RSC + +#ifndef UUI_IDS_HRC +#include "ids.hrc" +#endif + +#ifndef UUI_NAMECLASHDLG_HRC +#include "nameclashdlg.hrc" +#endif + +#define DLG_WIDTH 250 +#define DLG_HEIGTH 75 +#define BORDER_OFFSET 6 +#define EDIT_HEIGTH 12 +#define BTN_WIDTH 50 +#define BTN_HEIGTH 14 + +ModalDialog DLG_SIMPLE_NAME_CLASH +{ + HelpId = HID_DLG_SIMPLE_NAME_CLASH ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( DLG_WIDTH , DLG_HEIGTH ) ; + Moveable = TRUE ; + Text [ en-US ] = "File Exists" ; + + FixedText FT_FILE_EXISTS_WARNING + { + Pos = MAP_APPFONT ( BORDER_OFFSET, BORDER_OFFSET ) ; + Size = MAP_APPFONT ( DLG_WIDTH - 2*BORDER_OFFSET, DLG_HEIGTH - EDIT_HEIGTH - BTN_HEIGTH - 4*BORDER_OFFSET ) ; + WordBreak = TRUE ; + }; + + Edit EDIT_NEW_NAME + { + Border = TRUE ; + Pos = MAP_APPFONT ( BORDER_OFFSET, DLG_HEIGTH - EDIT_HEIGTH - BTN_HEIGTH - 2*BORDER_OFFSET ) ; + Size = MAP_APPFONT ( DLG_WIDTH - 2*BORDER_OFFSET , EDIT_HEIGTH ) ; + }; + + PushButton BTN_OVERWRITE + { + Pos = MAP_APPFONT ( DLG_WIDTH - 3*(BTN_WIDTH + BORDER_OFFSET) , DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ; + Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ; + TabStop = TRUE ; + Text [ en-US ] = "Replace" ; + }; + + PushButton BTN_RENAME + { + Pos = MAP_APPFONT ( DLG_WIDTH - 2*(BTN_WIDTH + BORDER_OFFSET) , DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ; + Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ; + TabStop = TRUE ; + Text [ en-US ] = "Rename" ; + DefButton = TRUE ; + }; + + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( DLG_WIDTH - BTN_WIDTH - BORDER_OFFSET, DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ; + Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ; + TabStop = TRUE ; + }; + + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( BORDER_OFFSET, DLG_HEIGTH - BTN_HEIGTH - BORDER_OFFSET ) ; + Size = MAP_APPFONT ( BTN_WIDTH, BTN_HEIGTH ) ; + TabStop = TRUE ; + }; +}; + +String STR_RENAME_OR_REPLACE +{ + Text = "A file with the name \"%NAME\" already exists in the location \"%FOLDER\".\nChoose Replace to overwrite the existing file or provide a new name."; +}; + +String STR_NAME_CLASH_RENAME_ONLY +{ + Text = "A file with the name \"%NAME\" already exists in the location \"%FOLDER\".\nPlease enter a new name."; +}; + +String STR_SAME_NAME_USED +{ + Text = "Please provide a different file name!"; +}; diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx deleted file mode 100644 index 1fc6024bcd19..000000000000 --- a/uui/source/passcrtdlg.cxx +++ /dev/null @@ -1,128 +0,0 @@ -/************************************************************************* - * - * 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 - * - * 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. - * - ************************************************************************/ - -#include <svtools/filedlg.hxx> -#include <vcl/msgbox.hxx> - -#ifndef UUI_IDS_HRC -#include <ids.hrc> -#endif -#ifndef UUI_PASSCRTDLG_HRC -#include <passcrtdlg.hrc> -#endif -#include <passcrtdlg.hxx> - -// PasswordCreateDialog--------------------------------------------------- - -// ----------------------------------------------------------------------- - -IMPL_LINK( PasswordCreateDialog, EditHdl_Impl, Edit *, EMPTYARG ) -{ - aOKBtn.Enable( aEDPasswordCrt.GetText().Len() >= nMinLen ); - return 0; -} - -// ----------------------------------------------------------------------- - -IMPL_LINK( PasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG ) -{ - // compare both passwords and show message box if there are not equal!! - if( aEDPasswordCrt.GetText() == aEDPasswordRepeat.GetText() ) - EndDialog( RET_OK ); - else - { - String aErrorMsg( ResId( STR_ERROR_PASSWORDS_NOT_IDENTICAL, *pResourceMgr )); - ErrorBox aErrorBox( this, WB_OK, aErrorMsg ); - aErrorBox.Execute(); - aEDPasswordCrt.SetText( String() ); - aEDPasswordRepeat.SetText( String() ); - aEDPasswordCrt.GrabFocus(); - } - return 1; -} - -// ----------------------------------------------------------------------- - -PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr, bool bMSCryptoMode) - :ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD_CRT, *pResMgr ) ) - ,aFTPasswordCrt ( this, ResId( FT_PASSWORD_CRT, *pResMgr ) ) - ,aEDPasswordCrt ( this, ResId( ED_PASSWORD_CRT, *pResMgr ) ) - ,aFTPasswordRepeat ( this, ResId( FT_PASSWORD_REPEAT, *pResMgr ) ) - ,aEDPasswordRepeat ( this, ResId( ED_PASSWORD_REPEAT, *pResMgr ) ) - ,aFTWarning ( this, ResId( bMSCryptoMode ? FT_MSPASSWORD_WARNING : FT_PASSWORD_WARNING, *pResMgr ) ) - ,aFixedLine1 ( this, ResId( FL_FIXED_LINE_1, *pResMgr ) ) - ,aOKBtn ( this, ResId( BTN_PASSCRT_OK, *pResMgr ) ) - ,aCancelBtn ( this, ResId( BTN_PASSCRT_CANCEL, *pResMgr ) ) - ,aHelpBtn ( this, ResId( BTN_PASSCRT_HELP, *pResMgr ) ) - ,pResourceMgr ( pResMgr ) - ,nMinLen(1) // if it should be changed for ODF, it must stay 1 for bMSCryptoMode -{ - FreeResource(); - - aOKBtn.SetClickHdl( LINK( this, PasswordCreateDialog, OKHdl_Impl ) ); - aEDPasswordCrt.SetModifyHdl( LINK( this, PasswordCreateDialog, EditHdl_Impl ) ); - - aOKBtn.Enable( sal_False ); - - if ( bMSCryptoMode ) - { - aEDPasswordCrt.SetMaxTextLen( 15 ); - aEDPasswordRepeat.SetMaxTextLen( 15 ); - } - - long nLabelWidth = aFTWarning.GetSizePixel().Width(); - long nLabelHeight = aFTWarning.GetSizePixel().Height(); - long nTextWidth = aFTWarning.GetCtrlTextWidth( aFTWarning.GetText() ); - long nTextHeight = aFTWarning.GetTextHeight(); - - Rectangle aLabelRect( aFTWarning.GetPosPixel(), aFTWarning.GetSizePixel() ); - Rectangle aRect = aFTWarning.GetTextRect( aLabelRect, aFTWarning.GetText() ); - - long nNewLabelHeight = 0; - for( nNewLabelHeight = ( nTextWidth / nLabelWidth + 1 ) * nTextHeight; - nNewLabelHeight < aRect.GetHeight(); - nNewLabelHeight += nTextHeight ) {} ; - - long nDelta = nNewLabelHeight - nLabelHeight; - - Size aNewDlgSize = GetSizePixel(); - aNewDlgSize.Height() += nDelta; - SetSizePixel( aNewDlgSize ); - - Size aNewWarningSize = aFTWarning.GetSizePixel(); - aNewWarningSize.Height() = nNewLabelHeight; - aFTWarning.SetPosSizePixel( aFTWarning.GetPosPixel(), aNewWarningSize ); - - Window* pControls[] = { &aFixedLine1, &aOKBtn, &aCancelBtn, &aHelpBtn }; - const sal_Int32 nCCount = sizeof( pControls ) / sizeof( pControls[0] ); - for ( int i = 0; i < nCCount; ++i ) - { - Point aNewPos =(*pControls[i]).GetPosPixel(); - aNewPos.Y() += nDelta; - pControls[i]->SetPosSizePixel( aNewPos, pControls[i]->GetSizePixel() ); - } -} diff --git a/uui/source/passcrtdlg.src b/uui/source/passcrtdlg.src deleted file mode 100644 index a74752ed589e..000000000000 --- a/uui/source/passcrtdlg.src +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************* - * - * 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 - * - * 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. - * - ************************************************************************/ - -#define __RSC - -#ifndef UUI_IDS_HRC -#include <ids.hrc> -#endif -#ifndef UUI_PASSCRTDLG_HRC -#include "passcrtdlg.hrc" -#endif - -ModalDialog DLG_UUI_PASSWORD_CRT -{ - HelpId = HID_DLG_PASSWORD_CRT ; - Border = TRUE ; - Moveable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 145, 129 ); - FixedText FT_PASSWORD_CRT - { - Pos = MAP_APPFONT( 3, 4 ); - Size = MAP_APPFONT( 139, 9 ); - Text [ en-US ] = "Enter password"; - }; - Edit ED_PASSWORD_CRT - { - Border = TRUE ; - Pos = MAP_APPFONT( 3, 17 ); - Size = MAP_APPFONT( 139, 13 ); - PassWord = TRUE ; - }; - Edit ED_PASSWORD_REPEAT - { - Border = TRUE ; - Pos = MAP_APPFONT( 3, 47 ); - Size = MAP_APPFONT( 139, 13 ); - PassWord = TRUE ; - }; - OKButton BTN_PASSCRT_OK - { - Pos = MAP_APPFONT( 27, 110 ); - Size = MAP_APPFONT( 37, 15 ); - DefButton = TRUE ; - }; - CancelButton BTN_PASSCRT_CANCEL - { - Pos = MAP_APPFONT( 66, 110 ); - Size = MAP_APPFONT( 37, 15 ); - }; - HelpButton BTN_PASSCRT_HELP - { - Pos = MAP_APPFONT( 105, 110 ); - Size = MAP_APPFONT( 37, 15 ); - }; - FixedText FT_PASSWORD_REPEAT - { - Pos = MAP_APPFONT( 3, 34 ); - Size = MAP_APPFONT( 139, 9 ); - Text [ en-US ] = "Reenter password"; - }; - FixedText FT_PASSWORD_WARNING - { - Pos = MAP_APPFONT( 4, 64 ); - Size = MAP_APPFONT( 137, 40 ); - Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive."; - WordBreak = TRUE; - }; - FixedText FT_MSPASSWORD_WARNING - { - Pos = MAP_APPFONT( 4, 64 ); - Size = MAP_APPFONT( 137, 40 ); - Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at most fifteen characters long."; - WordBreak = TRUE; - }; - FixedLine FL_FIXED_LINE_1 - { - Pos = MAP_APPFONT( 0, 104 ); - Size = MAP_APPFONT( 145, 6 ); - }; - Text [ en-US ] = "Enter Password"; -}; - diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx index 593e2d1f29e6..f603d21258fd 100644 --- a/xmloff/source/core/RDFaExportHelper.cxx +++ b/xmloff/source/core/RDFaExportHelper.cxx @@ -37,6 +37,8 @@ #include <comphelper/stlunosequence.hxx> #include <comphelper/stl_types.hxx> +#include <com/sun/star/uri/XUriReference.hpp> +#include <com/sun/star/uri/XUriReferenceFactory.hpp> #include <com/sun/star/rdf/Statement.hpp> #include <com/sun/star/rdf/URIs.hpp> #include <com/sun/star/rdf/URI.hpp> @@ -85,6 +87,39 @@ makeCURIE(SvXMLExport * i_pExport, return buf.makeStringAndClear(); } +// #i112473# SvXMLExport::GetRelativeReference() not right for RDF on SaveAs +// because the URIs in the repository are not rewritten on SaveAs, the +// URI of the loaded document has to be used, not the URI of the target doc. +static ::rtl::OUString +getRelativeReference(SvXMLExport const& rExport, ::rtl::OUString const& rURI) +{ + uno::Reference< rdf::XURI > const xModelURI( + rExport.GetModel(), uno::UNO_QUERY_THROW ); + ::rtl::OUString const baseURI( xModelURI->getStringValue() ); + + uno::Reference<uno::XComponentContext> const xContext( + rExport.GetComponentContext()); + uno::Reference<lang::XMultiComponentFactory> const xServiceFactory( + xContext->getServiceManager(), uno::UNO_SET_THROW); + uno::Reference<uri::XUriReferenceFactory> const xUriFactory( + xServiceFactory->createInstanceWithContext( + ::rtl::OUString::createFromAscii( + "com.sun.star.uri.UriReferenceFactory"), xContext), + uno::UNO_QUERY_THROW); + + uno::Reference< uri::XUriReference > const xBaseURI( + xUriFactory->parse(baseURI), uno::UNO_SET_THROW ); + uno::Reference< uri::XUriReference > const xAbsoluteURI( + xUriFactory->parse(rURI), uno::UNO_SET_THROW ); + uno::Reference< uri::XUriReference > const xRelativeURI( + xUriFactory->makeRelative(xBaseURI, xAbsoluteURI, true, true, false), + uno::UNO_SET_THROW ); + ::rtl::OUString const relativeURI(xRelativeURI->getUriReference()); + + return relativeURI; +} + + //////////////////////////////////////////////////////////////////////////// RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport) @@ -145,7 +180,7 @@ RDFaExportHelper::AddRDFa( static const sal_Unicode s_OpenBracket ('['); static const sal_Unicode s_CloseBracket(']'); const ::rtl::OUString about( xSubjectURI.is() - ? m_rExport.GetRelativeReference(xSubjectURI->getStringValue()) + ? getRelativeReference(m_rExport, xSubjectURI->getStringValue()) : ::rtl::OUStringBuffer().append(s_OpenBracket).append( LookupBlankNode(xSubjectBNode)).append(s_CloseBracket) .makeStringAndClear() diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 9d7856348516..98255edf68d0 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -708,6 +708,7 @@ void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest case '8' : case '9' : case '.' : + case '-' : { com::sun::star::drawing::EnhancedCustomShapeParameterPair aPair; if ( GetNextParameter( aPair.First, nIndex, rValue ) && diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index af51f5f56d98..00cdce37f4d5 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -116,6 +116,7 @@ XMLTextMarkImportContext::XMLTextMarkImportContext( const OUString& rLocalName ) : SvXMLImportContext(rImport, nPrefix, rLocalName) , m_rHelper(rHlp) + , m_bHaveAbout(false) { } |