avmedia/README | 5 + avmedia/source/gstreamer/gstwindow.cxx | 101 ++++----------------------------- avmedia/source/gstreamer/gstwindow.hxx | 1 sw/inc/unocrsrhelper.hxx | 13 ++++ sw/source/core/unocore/unoobj.cxx | 87 +++++++++++++++++++++------- sw/source/core/unocore/unotext.cxx | 74 ++++++++++++------------ 6 files changed, 138 insertions(+), 143 deletions(-)
New commits: commit 1c010bd28862788038703ff7fdbbde1764cc7098 Author: Michael Meeks <michael.me...@suse.com> Date: Tue Jan 8 22:07:56 2013 +0000 avmedia: cleanup unused listener logic in gstreamer, and update docs. Change-Id: Ic64a4e0ed1ad194d94f5451b60e926f13ad85578 diff --git a/avmedia/README b/avmedia/README index eaa257d..ad8120b 100644 --- a/avmedia/README +++ b/avmedia/README @@ -3,3 +3,8 @@ Audio/Video media implementation. Provides per-platform implementations of multimedia functionality. Currently no stream API is provided, only a URI based one, so streaming has to be wrapped around it via temp files. + +Also provides (in source/framework/mediacontrol.cxx) an implementation +of the graphical media playback control that appears in the toolbar / +mediaobject bar when media is selected under the .uno:AVMediaToolBox +item. \ No newline at end of file diff --git a/avmedia/source/gstreamer/gstwindow.cxx b/avmedia/source/gstreamer/gstwindow.cxx index a95b42f..f1d4a96 100644 --- a/avmedia/source/gstreamer/gstwindow.cxx +++ b/avmedia/source/gstreamer/gstwindow.cxx @@ -29,10 +29,6 @@ using namespace ::com::sun::star; namespace avmedia { namespace gstreamer { -// ----------- -// - statics - -// ----------- - static ::osl::Mutex& ImplGetOwnStaticMutex() { static ::osl::Mutex* pMutex = NULL; @@ -51,15 +47,11 @@ static ::osl::Mutex& ImplGetOwnStaticMutex() return *pMutex; } -// --------------- -// - Window - -// --------------- - +// Window // ------------------------------------------------------------------------------ Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Player& rPlayer ) : mxMgr( rxMgr ), - maListeners( maMutex ), meZoomLevel( media::ZoomLevel_NOT_AVAILABLE ), mrPlayer( rPlayer ), mnPointerType( awt::SystemPointer::ARROW ) @@ -68,8 +60,6 @@ Window::Window( const uno::Reference< lang::XMultiServiceFactory >& rxMgr, Playe } -// ------------------------------------------------------------------------------ - Window::~Window() { } @@ -82,8 +72,6 @@ void SAL_CALL Window::update( ) { } -// ------------------------------------------------------------------------------ - sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) throw (uno::RuntimeException) { @@ -103,16 +91,12 @@ sal_Bool SAL_CALL Window::setZoomLevel( media::ZoomLevel eZoomLevel ) return bRet; } -// ------------------------------------------------------------------------------ - media::ZoomLevel SAL_CALL Window::getZoomLevel( ) throw (uno::RuntimeException) { return meZoomLevel; } -// ------------------------------------------------------------------------------ - void SAL_CALL Window::setPointerType( sal_Int32 nPointerType ) throw (uno::RuntimeException) { @@ -127,8 +111,6 @@ void SAL_CALL Window::setPosSize( sal_Int32 /*X*/, sal_Int32 /*Y*/, sal_Int32 /* { } -// ------------------------------------------------------------------------------ - awt::Rectangle SAL_CALL Window::getPosSize() throw (uno::RuntimeException) { @@ -141,122 +123,79 @@ awt::Rectangle SAL_CALL Window::getPosSize() return aRet; } -// ------------------------------------------------------------------------------ - void SAL_CALL Window::setVisible( sal_Bool /*bVisible*/ ) throw (uno::RuntimeException) { - } -// ------------------------------------------------------------------------------ - void SAL_CALL Window::setEnable( sal_Bool /*bEnable*/ ) throw (uno::RuntimeException) { } -// ------------------------------------------------------------------------------ - void SAL_CALL Window::setFocus( ) throw (uno::RuntimeException) { } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) +void SAL_CALL Window::addWindowListener( const uno::Reference< awt::XWindowListener >& ) throw (uno::RuntimeException) { - maListeners.addInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& xListener ) +void SAL_CALL Window::removeWindowListener( const uno::Reference< awt::XWindowListener >& ) throw (uno::RuntimeException) { - maListeners.removeInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) +void SAL_CALL Window::addFocusListener( const uno::Reference< awt::XFocusListener >& ) throw (uno::RuntimeException) { - maListeners.addInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener ) +void SAL_CALL Window::removeFocusListener( const uno::Reference< awt::XFocusListener >& ) throw (uno::RuntimeException) { - maListeners.removeInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) +void SAL_CALL Window::addKeyListener( const uno::Reference< awt::XKeyListener >& ) throw (uno::RuntimeException) { - maListeners.addInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& xListener ) +void SAL_CALL Window::removeKeyListener( const uno::Reference< awt::XKeyListener >& ) throw (uno::RuntimeException) { - maListeners.removeInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) +void SAL_CALL Window::addMouseListener( const uno::Reference< awt::XMouseListener >& ) throw (uno::RuntimeException) { - maListeners.addInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& xListener ) +void SAL_CALL Window::removeMouseListener( const uno::Reference< awt::XMouseListener >& ) throw (uno::RuntimeException) { - maListeners.removeInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) +void SAL_CALL Window::addMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) throw (uno::RuntimeException) { - maListeners.addInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& xListener ) +void SAL_CALL Window::removeMouseMotionListener( const uno::Reference< awt::XMouseMotionListener >& ) throw (uno::RuntimeException) { - maListeners.removeInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& xListener ) +void SAL_CALL Window::addPaintListener( const uno::Reference< awt::XPaintListener >& ) throw (uno::RuntimeException) { - maListeners.addInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& xListener ) +void SAL_CALL Window::removePaintListener( const uno::Reference< awt::XPaintListener >& ) throw (uno::RuntimeException) { - maListeners.removeInterface( getCppuType( &xListener ), xListener ); } // XComponent @@ -267,20 +206,14 @@ void SAL_CALL Window::dispose( ) { } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) +void SAL_CALL Window::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) { - maListeners.addInterface( getCppuType( &xListener ), xListener ); } -// ------------------------------------------------------------------------------ - -void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) +void SAL_CALL Window::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) { - maListeners.removeInterface( getCppuType( &xListener ), xListener ); } // XServiceInfo @@ -292,16 +225,12 @@ OUString SAL_CALL Window::getImplementationName( ) return OUString( AVMEDIA_GST_WINDOW_IMPLEMENTATIONNAME ); } -// ------------------------------------------------------------------------------ - sal_Bool SAL_CALL Window::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException) { return ServiceName == AVMEDIA_GST_WINDOW_SERVICENAME; } -// ------------------------------------------------------------------------------ - uno::Sequence< OUString > SAL_CALL Window::getSupportedServiceNames( ) throw (uno::RuntimeException) { diff --git a/avmedia/source/gstreamer/gstwindow.hxx b/avmedia/source/gstreamer/gstwindow.hxx index f4472d5..f8014d7 100644 --- a/avmedia/source/gstreamer/gstwindow.hxx +++ b/avmedia/source/gstreamer/gstwindow.hxx @@ -86,7 +86,6 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMgr; ::osl::Mutex maMutex; - ::cppu::OMultiTypeInterfaceContainerHelper maListeners; ::com::sun::star::media::ZoomLevel meZoomLevel; Player& mrPlayer; int mnPointerType; commit ee0bf5d58bc59052923c4ced928a989956e71456 Author: Michael Meeks <michael.me...@suse.com> Date: Fri Dec 21 15:27:27 2012 +0000 fdo#44736 - set and fetch multiple properties concurrently The domain-mapper calls SwXText::insertTextPortion very extensively accounting for about half of import time for large, lightly formatted text documents. The vast majority of the work is consumed managing char + para properties - so try to batch that, making it 70% faster for my lightly formatted test. Saves around 25% of load time for me. Change-Id: I2582adee1bf35b07b90af810cb0d19dadc1d348f diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx index a5892f6..aa7fd4d 100644 --- a/sw/inc/unocrsrhelper.hxx +++ b/sw/inc/unocrsrhelper.hxx @@ -151,6 +151,19 @@ namespace SwUnoCursorHelper ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + /// @param bTableMode: attributes should be applied to a table selection + void SetPropertyValues( + SwPaM& rPaM, + const SfxItemPropertySet & rPropSet, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > & + rPropertyValues, + const SetAttrMode nAttrMode = nsSetAttrMode::SETATTR_DEFAULT, + const bool bTableMode = false) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Any GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet & rPropSet, diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 01318bb..f5736b8 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1861,34 +1861,81 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { + uno::Sequence< beans::PropertyValue > aValues(1); + aValues[0].Name = rPropertyName; + aValues[0].Value = rValue; + SetPropertyValues(rPaM, rPropSet, aValues, nAttrMode, bTableMode); +} + +void SwUnoCursorHelper::SetPropertyValues( + SwPaM& rPaM, const SfxItemPropertySet& rPropSet, + const uno::Sequence< beans::PropertyValue > &rPropertyValues, + const SetAttrMode nAttrMode, const bool bTableMode) +throw (beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException) +{ + if (!rPropertyValues.getLength()) + return; + SwDoc *const pDoc = rPaM.GetDoc(); - SfxItemPropertySimpleEntry const*const pEntry = - rPropSet.getPropertyMap().getByName(rPropertyName); - if (!pEntry) + rtl::OUString aUnknownExMsg, aPropertyVetoExMsg; + + // Build set of attributes we want to fetch + std::vector<sal_uInt16> aWhichPairs; + std::vector<SfxItemPropertySimpleEntry const*> aEntries; + aEntries.reserve(rPropertyValues.getLength()); + for (sal_Int32 i = 0; i < rPropertyValues.getLength(); ++i) { - throw beans::UnknownPropertyException( - OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) - + rPropertyName, - static_cast<cppu::OWeakObject *>(0)); + const rtl::OUString &rPropertyName = rPropertyValues[i].Name; + + SfxItemPropertySimpleEntry const* pEntry = + rPropSet.getPropertyMap().getByName(rPropertyName); + + // Queue up any exceptions until the end ... + if (!pEntry) + { + aUnknownExMsg += "Unknown property: '" + rPropertyName + "' "; + break; + } + else if (pEntry->nFlags & beans::PropertyAttribute::READONLY) + { + aPropertyVetoExMsg += "Property is read-only: '" + rPropertyName + "' "; + break; + } else { +// FIXME: we should have some nice way of merging ranges surely ? + aWhichPairs.push_back(pEntry->nWID); + aWhichPairs.push_back(pEntry->nWID); + } + aEntries.push_back(pEntry); } - if (pEntry->nFlags & beans::PropertyAttribute::READONLY) + if (!aWhichPairs.empty()) { - throw beans::PropertyVetoException( - OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: ")) - + rPropertyName, - static_cast<cppu::OWeakObject *>(0)); - } + aWhichPairs.push_back(0); // terminate + SfxItemSet aItemSet(pDoc->GetAttrPool(), &aWhichPairs[0]); - SfxItemSet aItemSet( pDoc->GetAttrPool(), pEntry->nWID, pEntry->nWID ); - SwUnoCursorHelper::GetCrsrAttr( rPaM, aItemSet ); + // Fetch, overwrite, and re-set the attributes from the core + SwUnoCursorHelper::GetCrsrAttr( rPaM, aItemSet ); - if (!SwUnoCursorHelper::SetCursorPropertyValue( - *pEntry, rValue, rPaM, aItemSet)) - { - rPropSet.setPropertyValue(*pEntry, rValue, aItemSet ); + for (sal_Int32 i = 0; ( i < rPropertyValues.getLength() && + i < (sal_Int32)aEntries.size() ); ++i) + { + const uno::Any &rValue = rPropertyValues[i].Value; + SfxItemPropertySimpleEntry const*const pEntry = aEntries[i]; + if (!pEntry) + continue; + if (!SwUnoCursorHelper::SetCursorPropertyValue(*pEntry, rValue, rPaM, aItemSet)) + rPropSet.setPropertyValue(*pEntry, rValue, aItemSet); + } + + SwUnoCursorHelper::SetCrsrAttr(rPaM, aItemSet, nAttrMode, bTableMode); } - SwUnoCursorHelper::SetCrsrAttr(rPaM, aItemSet, nAttrMode, bTableMode); + + if (!aUnknownExMsg.isEmpty()) + throw beans::UnknownPropertyException(aUnknownExMsg, static_cast<cppu::OWeakObject *>(0)); + if (!aPropertyVetoExMsg.isEmpty()) + throw beans::PropertyVetoException(aPropertyVetoExMsg, static_cast<cppu::OWeakObject *>(0)); } uno::Sequence< beans::PropertyState > diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index d2e3add..8060a1b 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <stdio.h> #include <stdlib.h> @@ -1309,6 +1310,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) { aPam.Move( fnMoveBackward, fnGoNode ); } +#if 1 if (rProperties.getLength()) { // now set the properties @@ -1345,6 +1347,26 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } } } +#else + try + { + SfxItemPropertySet const*const pParaPropSet = + aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARAGRAPH); + if (!bIllegalException) + SwUnoCursorHelper::SetPropertyValues(aPam, *pParaPropSet, rProperties); + } + catch (const lang::IllegalArgumentException& rIllegal) + { + sMessage = rIllegal.Message; + bIllegalException = true; + } + catch (const uno::RuntimeException& rRuntime) + { + sMessage = rRuntime.Message; + bRuntimeException = true; + } +#endif + m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL); if (bIllegalException || bRuntimeException) { @@ -1415,43 +1437,23 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) pCursor->GetPoint()->nContent = nContentPos; } - if (rCharacterAndParagraphProperties.getLength()) + try { - const SfxItemPropertyMap &rCursorMap = - aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR) - ->getPropertyMap(); - beans::PropertyValue const*const pValues = - rCharacterAndParagraphProperties.getConstArray(); - SfxItemPropertySet const*const pCursorPropSet = - aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR); - const sal_Int32 nLen(rCharacterAndParagraphProperties.getLength()); - for (sal_Int32 nProp = 0; nProp < nLen; ++nProp) - { - if (!rCursorMap.getByName( pValues[nProp].Name )) - { - bIllegalException = true; - break; - } - try - { - SwUnoCursorHelper::SetPropertyValue( - *pCursor, *pCursorPropSet, - pValues[nProp].Name, pValues[nProp].Value, - nsSetAttrMode::SETATTR_NOFORMATATTR); - } - catch (const lang::IllegalArgumentException& rIllegal) - { - sMessage = rIllegal.Message; - bIllegalException = true; - break; - } - catch (const uno::RuntimeException& rRuntime) - { - sMessage = rRuntime.Message; - bRuntimeException = true; - break; - } - } + SfxItemPropertySet const*const pCursorPropSet = + aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR); + SwUnoCursorHelper::SetPropertyValues(*pCursor, *pCursorPropSet, + rCharacterAndParagraphProperties, + nsSetAttrMode::SETATTR_NOFORMATATTR); + } + catch (const lang::IllegalArgumentException& rIllegal) + { + sMessage = rIllegal.Message; + bIllegalException = true; + } + catch (const uno::RuntimeException& rRuntime) + { + sMessage = rRuntime.Message; + bRuntimeException = true; } m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); if (bIllegalException || bRuntimeException) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits