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 @@
#include <vcl/msgbox.hxx>
#include "optiongrouplayouter.hxx"
#include "dbpilots.hrc"
#include <comphelper/componentcontext.hxx>
#define GBW_STATE_OPTIONLIST 0
#define GBW_STATE_DEFAULTOPTION 1
......@@ -168,7 +169,7 @@ namespace dbp
{
try
{
OOptionGroupLayouter aLayouter(getServiceFactory());
OOptionGroupLayouter aLayouter(comphelper::ComponentContext(getServiceFactory()).getUNOContext());
aLayouter.doLayout(getContext(), getSettings());
}
catch(const Exception&)
......
......@@ -31,6 +31,7 @@
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/container/XIndexAccess.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/XShapeGrouper.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
......@@ -62,8 +63,8 @@ namespace dbp
//= OOptionGroupLayouter
//=====================================================================
//---------------------------------------------------------------------
OOptionGroupLayouter::OOptionGroupLayouter(const Reference< XMultiServiceFactory >& _rxORB)
:m_xORB(_rxORB)
OOptionGroupLayouter::OOptionGroupLayouter(const Reference< XComponentContext >& _rxContext)
:mxContext(_rxContext)
{
}
......@@ -103,9 +104,7 @@ namespace dbp
implAnchorShape(Reference< XPropertySet >(_rContext.xObjectShape, UNO_QUERY));
// shape collection (for grouping the shapes)
Reference< XShapes > xButtonCollection(m_xORB->createInstance(
::rtl::OUString("com.sun.star.drawing.ShapeCollection")),
UNO_QUERY);
Reference< XShapes > xButtonCollection( ShapeCollection::create(mxContext), UNO_QUERY_THROW );
// first member : the shape of the control
xButtonCollection->add(_rContext.xObjectShape.get());
......
......@@ -22,7 +22,7 @@
#include <com/sun/star/drawing/XDrawPage.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/frame/XModel.hpp>
#include "dbptypes.hxx"
......@@ -39,12 +39,12 @@ namespace dbp
//=====================================================================
class OOptionGroupLayouter
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
m_xORB;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
mxContext;
public:
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:
......
......@@ -42,11 +42,13 @@
#include <com/sun/star/drawing/PointSequence.hpp>
#include <com/sun/star/drawing/PolyPolygonBezierCoords.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/text/XText.hpp>
#include <com/sun/star/text/XTextRange.hpp>
#include <com/sun/star/style/HorizontalAlignment.hpp>
#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <toolkit/helper/vclunohelper.hxx>
......@@ -448,21 +450,14 @@ void CGMImpressOutAct::EndGroup()
uno::Any aAny( maXDrawPage->queryInterface( ::getCppuType(((const uno::Reference< drawing::XShapeGrouper >*)0) )));
if( aAny >>= aXShapeGrouper )
{
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 );
if ( aXShapeCollection.is() )
uno::Reference< drawing::XShapes > aXShapes(
drawing::ShapeCollection::create(comphelper::ComponentContext(maXServiceManagerSC).getUNOContext()) );
for ( sal_uInt32 i = mnFirstIndex; i < mnCurrentCount; i++ )
{
aXShapes = uno::Reference< drawing::XShapes >( aXShapeCollection, uno::UNO_QUERY );
if( aXShapes.is() )
uno::Reference< drawing::XShape > aXShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( i ).getValue();
if (aXShape.is() )
{
for ( sal_uInt32 i = mnFirstIndex; i < mnCurrentCount; i++ )
{
uno::Reference< drawing::XShape > aXShape = *(uno::Reference< drawing::XShape > *)maXShapes->getByIndex( i ).getValue();
if (aXShape.is() )
{
aXShapes->add( aXShape );
}
}
aXShapes->add( aXShape );
}
}
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,\
OOXMLDocumentPropertiesImporter \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\
ShapeCollection \
SlideRenderer \
SlideSorter \
))
......@@ -669,7 +670,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/drawing
RotationDescriptor \
ShadowProperties \
Shape \
ShapeCollection \
Shapes \
Text \
TextProperties \
......
......@@ -20,7 +20,6 @@
#define __com_sun_star_drawing_ShapeCollection_idl__
#include <com/sun/star/drawing/Shapes.idl>
#include <com/sun/star/lang/XComponent.idl>
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
<type>Shape</type> that are selected at the ui.
*/
published service ShapeCollection
{
/** 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;
};
published service ShapeCollection : com::sun::star::drawing::XShapes;
}; }; }; };
......
......@@ -60,6 +60,7 @@
#include "vbaheaderfooter.hxx"
#include "vbaheaderfooterhelper.hxx"
#include <vbahelper/vbashaperange.hxx>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include "vbarows.hxx"
......@@ -868,8 +869,7 @@ SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
if ( !xShapes.is() )
{
uno::Reference< drawing::XShape > xShape( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
xShapes.set( xMSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection")) ), uno::UNO_QUERY_THROW );
xShapes.set( drawing::ShapeCollection::create(mxContext), uno::UNO_QUERY_THROW );
xShapes->add( xShape );
}
......
......@@ -16,6 +16,7 @@
* except in compliance with the License. You may obtain a copy of
* 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/XDrawPage.hpp>
#include<com/sun/star/view/XSelectionSupplier.hpp>
......@@ -73,8 +74,7 @@ ScVbaShapeRange::getShapes() throw (uno::RuntimeException)
{
if ( !m_xShapes.is() )
{
uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
m_xShapes.set( xMSF->createInstance( rtl::OUString("com.sun.star.drawing.ShapeCollection") ), uno::UNO_QUERY_THROW );
m_xShapes.set( drawing::ShapeCollection::create(mxContext), uno::UNO_QUERY_THROW );
sal_Int32 nLen = m_xIndexAccess->getCount();
for ( sal_Int32 index = 0; index < nLen; ++index )
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