Kaydet (Commit) 9738002e authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Stephan Bergmann

fdo#46808, Adapt drawing::ShapeCollection UNO service to new style

No client code is using the XComponent interface, so drop it.

Change-Id: Id8f6da1248da641dcc0a3cb6d0a70e3bf29e5c99
üst af5059d1
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include "optiongrouplayouter.hxx" #include "optiongrouplayouter.hxx"
#include "dbpilots.hrc" #include "dbpilots.hrc"
#include <comphelper/componentcontext.hxx>
#define GBW_STATE_OPTIONLIST 0 #define GBW_STATE_OPTIONLIST 0
#define GBW_STATE_DEFAULTOPTION 1 #define GBW_STATE_DEFAULTOPTION 1
...@@ -168,7 +169,7 @@ namespace dbp ...@@ -168,7 +169,7 @@ namespace dbp
{ {
try try
{ {
OOptionGroupLayouter aLayouter(getServiceFactory()); OOptionGroupLayouter aLayouter(comphelper::ComponentContext(getServiceFactory()).getUNOContext());
aLayouter.doLayout(getContext(), getSettings()); aLayouter.doLayout(getContext(), getSettings());
} }
catch(const Exception&) catch(const Exception&)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/drawing/XShapeGrouper.hpp> #include <com/sun/star/drawing/XShapeGrouper.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp>
...@@ -62,8 +63,8 @@ namespace dbp ...@@ -62,8 +63,8 @@ namespace dbp
//= OOptionGroupLayouter //= OOptionGroupLayouter
//===================================================================== //=====================================================================
//--------------------------------------------------------------------- //---------------------------------------------------------------------
OOptionGroupLayouter::OOptionGroupLayouter(const Reference< XMultiServiceFactory >& _rxORB) OOptionGroupLayouter::OOptionGroupLayouter(const Reference< XComponentContext >& _rxContext)
:m_xORB(_rxORB) :mxContext(_rxContext)
{ {
} }
...@@ -103,9 +104,7 @@ namespace dbp ...@@ -103,9 +104,7 @@ namespace dbp
implAnchorShape(Reference< XPropertySet >(_rContext.xObjectShape, UNO_QUERY)); implAnchorShape(Reference< XPropertySet >(_rContext.xObjectShape, UNO_QUERY));
// shape collection (for grouping the shapes) // shape collection (for grouping the shapes)
Reference< XShapes > xButtonCollection(m_xORB->createInstance( Reference< XShapes > xButtonCollection( ShapeCollection::create(mxContext), UNO_QUERY_THROW );
::rtl::OUString("com.sun.star.drawing.ShapeCollection")),
UNO_QUERY);
// first member : the shape of the control // first member : the shape of the control
xButtonCollection->add(_rContext.xObjectShape.get()); xButtonCollection->add(_rContext.xObjectShape.get());
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XModel.hpp>
#include "dbptypes.hxx" #include "dbptypes.hxx"
...@@ -39,12 +39,12 @@ namespace dbp ...@@ -39,12 +39,12 @@ namespace dbp
//===================================================================== //=====================================================================
class OOptionGroupLayouter class OOptionGroupLayouter
{ {
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
m_xORB; mxContext;
public: public:
OOptionGroupLayouter( OOptionGroupLayouter(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
); );
public: public:
......
...@@ -42,11 +42,13 @@ ...@@ -42,11 +42,13 @@
#include <com/sun/star/drawing/PointSequence.hpp> #include <com/sun/star/drawing/PointSequence.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
#include <com/sun/star/drawing/FlagSequence.hpp> #include <com/sun/star/drawing/FlagSequence.hpp>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/TextAdjust.hpp> #include <com/sun/star/drawing/TextAdjust.hpp>
#include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/style/HorizontalAlignment.hpp> #include <com/sun/star/style/HorizontalAlignment.hpp>
#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
...@@ -448,13 +450,8 @@ void CGMImpressOutAct::EndGroup() ...@@ -448,13 +450,8 @@ void CGMImpressOutAct::EndGroup()
uno::Any aAny( maXDrawPage->queryInterface( ::getCppuType(((const uno::Reference< drawing::XShapeGrouper >*)0) ))); uno::Any aAny( maXDrawPage->queryInterface( ::getCppuType(((const uno::Reference< drawing::XShapeGrouper >*)0) )));
if( aAny >>= aXShapeGrouper ) if( aAny >>= aXShapeGrouper )
{ {
uno::Reference< drawing::XShapes > aXShapes; uno::Reference< drawing::XShapes > aXShapes(
uno::Reference< drawing::XShape > aXShapeCollection( maXServiceManagerSC->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ShapeCollection" )) ), uno::UNO_QUERY ); drawing::ShapeCollection::create(comphelper::ComponentContext(maXServiceManagerSC).getUNOContext()) );
if ( aXShapeCollection.is() )
{
aXShapes = uno::Reference< drawing::XShapes >( aXShapeCollection, uno::UNO_QUERY );
if( aXShapes.is() )
{
for ( sal_uInt32 i = mnFirstIndex; i < mnCurrentCount; i++ ) for ( sal_uInt32 i = mnFirstIndex; i < mnCurrentCount; i++ )
{ {
uno::Reference< drawing::XShape > aXShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( i ).getValue(); uno::Reference< drawing::XShape > aXShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( i ).getValue();
...@@ -463,8 +460,6 @@ void CGMImpressOutAct::EndGroup() ...@@ -463,8 +460,6 @@ void CGMImpressOutAct::EndGroup()
aXShapes->add( aXShape ); aXShapes->add( aXShape );
} }
} }
}
}
uno::Reference< drawing::XShapeGroup > aXShapeGroup = aXShapeGrouper->group( aXShapes ); uno::Reference< drawing::XShapeGroup > aXShapeGroup = aXShapeGrouper->group( aXShapes );
} }
} }
......
...@@ -103,6 +103,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\ ...@@ -103,6 +103,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\
OOXMLDocumentPropertiesImporter \ OOXMLDocumentPropertiesImporter \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\
ShapeCollection \
SlideRenderer \ SlideRenderer \
SlideSorter \ SlideSorter \
)) ))
...@@ -669,7 +670,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/drawing ...@@ -669,7 +670,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/drawing
RotationDescriptor \ RotationDescriptor \
ShadowProperties \ ShadowProperties \
Shape \ Shape \
ShapeCollection \
Shapes \ Shapes \
Text \ Text \
TextProperties \ TextProperties \
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#define __com_sun_star_drawing_ShapeCollection_idl__ #define __com_sun_star_drawing_ShapeCollection_idl__
#include <com/sun/star/drawing/Shapes.idl> #include <com/sun/star/drawing/Shapes.idl>
#include <com/sun/star/lang/XComponent.idl>
module com { module sun { module star { module drawing { module com { module sun { module star { module drawing {
...@@ -32,17 +31,7 @@ module com { module sun { module star { module drawing { ...@@ -32,17 +31,7 @@ module com { module sun { module star { module drawing {
This service is used by the view f.e. to return a collection of This service is used by the view f.e. to return a collection of
<type>Shape</type> that are selected at the ui. <type>Shape</type> that are selected at the ui.
*/ */
published service ShapeCollection published service ShapeCollection : com::sun::star::drawing::XShapes;
{
/** gives access to the shapes
*/
interface com::sun::star::drawing::XShapes;
/** allows controlling or observing the lifetime of this collection
*/
interface com::sun::star::lang::XComponent;
};
}; }; }; }; }; }; }; };
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "vbaheaderfooter.hxx" #include "vbaheaderfooter.hxx"
#include "vbaheaderfooterhelper.hxx" #include "vbaheaderfooterhelper.hxx"
#include <vbahelper/vbashaperange.hxx> #include <vbahelper/vbashaperange.hxx>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include "vbarows.hxx" #include "vbarows.hxx"
...@@ -868,8 +869,7 @@ SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException) ...@@ -868,8 +869,7 @@ SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
if ( !xShapes.is() ) if ( !xShapes.is() )
{ {
uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW ); uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); xShapes.set( drawing::ShapeCollection::create(mxContext), uno::UNO_QUERY_THROW );
xShapes.set( xMSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection")) ), uno::UNO_QUERY_THROW );
xShapes->add( xShape ); xShapes->add( xShape );
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XShapeGrouper.hpp> #include <com/sun/star/drawing/XShapeGrouper.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include<com/sun/star/view/XSelectionSupplier.hpp> #include<com/sun/star/view/XSelectionSupplier.hpp>
...@@ -73,8 +74,7 @@ ScVbaShapeRange::getShapes() throw (uno::RuntimeException) ...@@ -73,8 +74,7 @@ ScVbaShapeRange::getShapes() throw (uno::RuntimeException)
{ {
if ( !m_xShapes.is() ) if ( !m_xShapes.is() )
{ {
uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); m_xShapes.set( drawing::ShapeCollection::create(mxContext), uno::UNO_QUERY_THROW );
m_xShapes.set( xMSF->createInstance( rtl::OUString("com.sun.star.drawing.ShapeCollection") ), uno::UNO_QUERY_THROW );
sal_Int32 nLen = m_xIndexAccess->getCount(); sal_Int32 nLen = m_xIndexAccess->getCount();
for ( sal_Int32 index = 0; index < nLen; ++index ) for ( sal_Int32 index = 0; index < nLen; ++index )
m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) ); m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment