sw/inc/unoframe.hxx | 67 +++----------- sw/source/core/unocore/unoframe.cxx | 169 ++---------------------------------- sw/source/core/unocore/unotext.cxx | 2 3 files changed, 30 insertions(+), 208 deletions(-)
New commits: commit eca55c4b8d8cb119aa1b8ad8744fa68f8fcc0ac7 Author: Michael Stahl <mst...@redhat.com> Date: Tue Jun 21 22:06:37 2016 +0200 sw: replace pointless XComponent and XTextContent overrides ... from SwXTextGraphicObject and SwXTextEmbeddedObject. Change-Id: I22c2937617b84262c124d2504a8f9d889895005b diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 9c5b7a9..5135a9a 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -46,11 +46,12 @@ class BaseFrameProperties_Impl; class SwXFrame : public cppu::WeakImplHelper < css::lang::XServiceInfo, + css::lang::XUnoTunnel, css::beans::XPropertySet, css::beans::XPropertyState, css::drawing::XShape, css::container::XNamed, - css::lang::XUnoTunnel + css::text::XTextContent >, public SwClient { @@ -124,11 +125,13 @@ public: //Base implementation //XComponent - virtual void SAL_CALL dispose( ) throw(css::uno::RuntimeException, std::exception); - virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException, std::exception); - virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw(css::uno::RuntimeException, std::exception); + virtual void SAL_CALL dispose() throw (css::uno::RuntimeException, std::exception) override; + virtual void SAL_CALL addEventListener(const css::uno::Reference<css::lang::XEventListener>& xListener) throw (css::uno::RuntimeException, std::exception) override; + virtual void SAL_CALL removeEventListener(const css::uno::Reference<css::lang::XEventListener>& xListener) throw (css::uno::RuntimeException, std::exception) override; - virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() throw( css::uno::RuntimeException, std::exception ); + // XTextContent + virtual void SAL_CALL attach(const css::uno::Reference<css::text::XTextRange>& xTextRange) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) override; + virtual css::uno::Reference<css::text::XTextRange> SAL_CALL getAnchor() throw (css::uno::RuntimeException, std::exception) override; //XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override; @@ -136,7 +139,6 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( css::uno::RuntimeException, std::exception ) override; void attachToRange(const css::uno::Reference< css::text::XTextRange > & xTextRange)throw(css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception); - void attach( const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw(css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception); const SwFrameFormat* GetFrameFormat() const { @@ -239,7 +241,6 @@ public: typedef cppu::ImplInheritanceHelper < SwXFrame, - css::text::XTextContent, css::document::XEventsSupplier > SwXTextGraphicObjectBaseClass; @@ -258,15 +259,6 @@ public: static css::uno::Reference<css::text::XTextContent> CreateXTextGraphicObject(SwDoc & rDoc, SwFrameFormat * pFrameFormat); - //XTextContent - virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) throw( css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception ) override; - virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() throw( css::uno::RuntimeException, std::exception ) override; - - //XComponent - virtual void SAL_CALL dispose() throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - //XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override; virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( css::uno::RuntimeException, std::exception ) override; @@ -274,6 +266,7 @@ public: // XEventsSupplier virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents( ) throw(css::uno::RuntimeException, std::exception) override; + void * SAL_CALL operator new( size_t ) throw(); void SAL_CALL operator delete( void * ) throw(); }; @@ -281,7 +274,6 @@ public: class SwOLENode; typedef cppu::ImplInheritanceHelper < SwXFrame, - css::text::XTextContent, css::document::XEmbeddedObjectSupplier2, css::document::XEventsSupplier > SwXTextEmbeddedObjectBaseClass; @@ -302,15 +294,6 @@ public: static css::uno::Reference<css::text::XTextContent> CreateXTextEmbeddedObject(SwDoc & rDoc, SwFrameFormat * pFrameFormat); - //XTextContent - virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) throw( css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception ) override; - virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() throw( css::uno::RuntimeException, std::exception ) override; - - //XComponent - virtual void SAL_CALL dispose() throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) throw( css::uno::RuntimeException, std::exception ) override; - //XEmbeddedObjectSupplier2 virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getEmbeddedObject() throw( css::uno::RuntimeException, std::exception ) override; virtual css::uno::Reference< css::embed::XEmbeddedObject > SAL_CALL getExtendedControlOverEmbeddedObject() throw( css::uno::RuntimeException, std::exception ) override; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 8547509..6e037ed 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -3422,35 +3422,6 @@ SwXTextGraphicObject::CreateXTextGraphicObject(SwDoc & rDoc, SwFrameFormat *cons return CreateXFrame<text::XTextContent, SwXTextGraphicObject>(rDoc, pFrameFormat); } -void SwXTextGraphicObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException, std::exception ) -{ - SwXFrame::attach(xTextRange); -} - -uno::Reference< text::XTextRange > SwXTextGraphicObject::getAnchor() throw( uno::RuntimeException, std::exception ) -{ - SolarMutexGuard aGuard; - return SwXFrame::getAnchor(); -} - -void SwXTextGraphicObject::dispose() throw( uno::RuntimeException, std::exception ) -{ - SolarMutexGuard aGuard; - SwXFrame::dispose(); -} - -void SwXTextGraphicObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener) - throw( uno::RuntimeException, std::exception ) -{ - SwXFrame::addEventListener(aListener); -} - -void SwXTextGraphicObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) - throw( uno::RuntimeException, std::exception ) -{ - SwXFrame::removeEventListener(aListener); -} - OUString SwXTextGraphicObject::getImplementationName() throw( uno::RuntimeException, std::exception ) { return OUString("SwXTextGraphicObject"); @@ -3511,33 +3482,6 @@ SwXTextEmbeddedObject::CreateXTextEmbeddedObject(SwDoc & rDoc, SwFrameFormat *co return CreateXFrame<text::XTextContent, SwXTextEmbeddedObject>(rDoc, pFrameFormat); } -void SwXTextEmbeddedObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException, std::exception ) -{ - SwXFrame::attach(xTextRange); -} - -uno::Reference< text::XTextRange > SwXTextEmbeddedObject::getAnchor() throw( uno::RuntimeException, std::exception ) -{ - SolarMutexGuard aGuard; - return SwXFrame::getAnchor(); -} - -void SwXTextEmbeddedObject::dispose() throw( uno::RuntimeException, std::exception ) -{ - SolarMutexGuard aGuard; - SwXFrame::dispose(); -} - -void SwXTextEmbeddedObject::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException, std::exception ) -{ - SwXFrame::addEventListener(aListener); -} - -void SwXTextEmbeddedObject::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException, std::exception ) -{ - SwXFrame::removeEventListener(aListener); -} - uno::Reference< lang::XComponent > SwXTextEmbeddedObject::getEmbeddedObject() throw( uno::RuntimeException, std::exception ) { uno::Reference<embed::XEmbeddedObject> xObj(getExtendedControlOverEmbeddedObject()); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index ddb9d46..43b29b5 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1735,7 +1735,7 @@ SwXText::convertToTextFrame( sMessage = rRuntime.Message; bRuntimeException = true; } - xRet = &rNewFrame; + xRet = xNewFrame; if (bParaBeforeInserted || bParaAfterInserted) { const uno::Reference<text::XTextCursor> xFrameTextCursor = commit 33b9476b047f2815664c01c1f9c124087c779318 Author: Michael Stahl <mst...@redhat.com> Date: Tue Jun 21 21:51:14 2016 +0200 sw: use ImplInheritanceHelper for SwXTextGraphicObject ... and SwXTextEmbeddedObjectBaseClass, and get rid of pointless manual overriding of XInterface and XTypeProvider. Change-Id: I6695d825b5caba08aca9764eb3052eab77ee6fdb diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index b5822dd..9c5b7a9 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -237,14 +237,13 @@ public: void SAL_CALL operator delete( void * ) throw(); }; -typedef cppu::WeakImplHelper -< +typedef cppu::ImplInheritanceHelper +< SwXFrame, css::text::XTextContent, css::document::XEventsSupplier > SwXTextGraphicObjectBaseClass; -class SwXTextGraphicObject : public SwXTextGraphicObjectBaseClass, - public SwXFrame +class SwXTextGraphicObject : public SwXTextGraphicObjectBaseClass { protected: friend class SwXFrame; // just for CreateXFrame @@ -259,14 +258,6 @@ public: static css::uno::Reference<css::text::XTextContent> CreateXTextGraphicObject(SwDoc & rDoc, SwFrameFormat * pFrameFormat); - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL acquire( ) throw() override; - virtual void SAL_CALL release( ) throw() override; - - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException, std::exception) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(css::uno::RuntimeException, std::exception) override; - //XTextContent virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) throw( css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception ) override; virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() throw( css::uno::RuntimeException, std::exception ) override; @@ -288,15 +279,14 @@ public: }; class SwOLENode; -typedef cppu::WeakImplHelper -< +typedef cppu::ImplInheritanceHelper +< SwXFrame, css::text::XTextContent, css::document::XEmbeddedObjectSupplier2, css::document::XEventsSupplier ->SwXTextEmbeddedObjectBaseClass; +> SwXTextEmbeddedObjectBaseClass; -class SwXTextEmbeddedObject : public SwXTextEmbeddedObjectBaseClass, - public SwXFrame +class SwXTextEmbeddedObject : public SwXTextEmbeddedObjectBaseClass { css::uno::Reference<css::util::XModifyListener> m_xOLEListener; protected: @@ -312,14 +302,6 @@ public: static css::uno::Reference<css::text::XTextContent> CreateXTextEmbeddedObject(SwDoc & rDoc, SwFrameFormat * pFrameFormat); - virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException, std::exception) override; - virtual void SAL_CALL acquire( ) throw() override; - virtual void SAL_CALL release( ) throw() override; - - //XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException, std::exception) override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(css::uno::RuntimeException, std::exception) override; - //XTextContent virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > & xTextRange) throw( css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception ) override; virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() throw( css::uno::RuntimeException, std::exception ) override; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 742cbb7..8547509 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -3400,20 +3400,20 @@ sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& return aRet; } -SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) : - SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc) +SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) + : SwXTextGraphicObjectBaseClass(FLYCNTTYPE_GRF, + aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC), pDoc) { } -SwXTextGraphicObject::SwXTextGraphicObject(SwFrameFormat& rFormat) : - SwXFrame(rFormat, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC)) +SwXTextGraphicObject::SwXTextGraphicObject(SwFrameFormat& rFormat) + : SwXTextGraphicObjectBaseClass(rFormat, FLYCNTTYPE_GRF, + aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_GRAPHIC)) { - } SwXTextGraphicObject::~SwXTextGraphicObject() { - } uno::Reference<text::XTextContent> @@ -3422,50 +3422,6 @@ SwXTextGraphicObject::CreateXTextGraphicObject(SwDoc & rDoc, SwFrameFormat *cons return CreateXFrame<text::XTextContent, SwXTextGraphicObject>(rDoc, pFrameFormat); } -void SAL_CALL SwXTextGraphicObject::acquire( )throw() -{ - SwXFrame::acquire(); -} - -void SAL_CALL SwXTextGraphicObject::release( )throw() -{ - SwXFrame::release(); -} - -::uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType ) - throw(uno::RuntimeException, std::exception) -{ - ::uno::Any aRet = SwXFrame::queryInterface(aType); - if(aRet.getValueType() == cppu::UnoType<void>::get()) - aRet = SwXTextGraphicObjectBaseClass::queryInterface(aType); - return aRet; -} - -uno::Sequence< uno::Type > SAL_CALL - SwXTextGraphicObject::getTypes( ) throw(uno::RuntimeException, std::exception) -{ - uno::Sequence< uno::Type > aGraphicTypes = SwXTextGraphicObjectBaseClass::getTypes(); - uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes(); - - long nIndex = aGraphicTypes.getLength(); - aGraphicTypes.realloc( - aGraphicTypes.getLength() + - aFrameTypes.getLength()); - - uno::Type* pGraphicTypes = aGraphicTypes.getArray(); - const uno::Type* pFrameTypes = aFrameTypes.getConstArray(); - long nPos; - for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++) - pGraphicTypes[nIndex++] = pFrameTypes[nPos]; - - return aGraphicTypes; -} - -uno::Sequence< sal_Int8 > SAL_CALL SwXTextGraphicObject::getImplementationId( ) throw(uno::RuntimeException, std::exception) -{ - return css::uno::Sequence<sal_Int8>(); -} - void SwXTextGraphicObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException, std::exception ) { SwXFrame::attach(xTextRange); @@ -3533,19 +3489,20 @@ uno::Reference<container::XNameReplace> SAL_CALL } SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc *pDoc ) - : SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc) + : SwXTextEmbeddedObjectBaseClass(FLYCNTTYPE_OLE, + aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc) , m_xOLEListener(nullptr) -{ } - -SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrameFormat& rFormat) : - SwXFrame(rFormat, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT)) { +} +SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrameFormat& rFormat) + : SwXTextEmbeddedObjectBaseClass(rFormat, FLYCNTTYPE_OLE, + aSwMapProvider.GetPropertySet(PROPERTY_MAP_EMBEDDED_OBJECT)) +{ } SwXTextEmbeddedObject::~SwXTextEmbeddedObject() { - } uno::Reference<text::XTextContent> @@ -3554,50 +3511,6 @@ SwXTextEmbeddedObject::CreateXTextEmbeddedObject(SwDoc & rDoc, SwFrameFormat *co return CreateXFrame<text::XTextContent, SwXTextEmbeddedObject>(rDoc, pFrameFormat); } -void SAL_CALL SwXTextEmbeddedObject::acquire()throw() -{ - SwXFrame::acquire(); -} - -void SAL_CALL SwXTextEmbeddedObject::release()throw() -{ - SwXFrame::release(); -} - -::uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType ) - throw( uno::RuntimeException, std::exception) -{ - ::uno::Any aRet = SwXFrame::queryInterface(aType); - if(aRet.getValueType() == cppu::UnoType<void>::get()) - aRet = SwXTextEmbeddedObjectBaseClass::queryInterface(aType); - return aRet; -} - -uno::Sequence< uno::Type > SAL_CALL SwXTextEmbeddedObject::getTypes( ) throw(uno::RuntimeException, std::exception) -{ - uno::Sequence< uno::Type > aTextEmbeddedTypes = SwXTextEmbeddedObjectBaseClass::getTypes(); - uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes(); - - long nIndex = aTextEmbeddedTypes.getLength(); - aTextEmbeddedTypes.realloc( - aTextEmbeddedTypes.getLength() + - aFrameTypes.getLength()); - - uno::Type* pTextEmbeddedTypes = aTextEmbeddedTypes.getArray(); - - const uno::Type* pFrameTypes = aFrameTypes.getConstArray(); - long nPos; - for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++) - pTextEmbeddedTypes[nIndex++] = pFrameTypes[nPos]; - - return aTextEmbeddedTypes; -} - -uno::Sequence< sal_Int8 > SAL_CALL SwXTextEmbeddedObject::getImplementationId( ) throw(uno::RuntimeException, std::exception) -{ - return css::uno::Sequence<sal_Int8>(); -} - void SwXTextEmbeddedObject::attach(const uno::Reference< text::XTextRange > & xTextRange) throw( lang::IllegalArgumentException, uno::RuntimeException, std::exception ) { SwXFrame::attach(xTextRange); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits