Do not use SvxShapeCollection directly.

Change-Id: I1dd51df0e78a3cc89cdfcaec91ffd9a753393e2e
This commit is contained in:
Matúš Kukan
2014-01-08 10:34:47 +01:00
parent 31911b3cdc
commit f7936b021f
12 changed files with 29 additions and 33 deletions

View File

@@ -273,7 +273,6 @@
#include <svx/unopage.hxx> #include <svx/unopage.hxx>
#include <svx/unoprov.hxx> #include <svx/unoprov.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/unoshcol.hxx>
#include <svx/unoshtxt.hxx> #include <svx/unoshtxt.hxx>
#include <svx/xbtmpit.hxx> #include <svx/xbtmpit.hxx>
#include <svx/xflbmtit.hxx> #include <svx/xflbmtit.hxx>

View File

@@ -51,10 +51,10 @@
#include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp>
#include <comphelper/InlineContainer.hxx> #include <comphelper/InlineContainer.hxx>
// header for function SvxShapeCollection_NewInstance #include <comphelper/processfactory.hxx>
#include <svx/unoshcol.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/DisposedException.hpp>
@@ -1100,7 +1100,8 @@ Reference< drawing::XShapes > ChartDocumentWrapper::getAdditionalShapes() const
if( !aShapeVector.empty() ) if( !aShapeVector.empty() )
{ {
// create a shape collection // create a shape collection
xFoundShapes = uno::Reference< drawing::XShapes >( SvxShapeCollection_NewInstance(), uno::UNO_QUERY ); xFoundShapes = uno::Reference< drawing::XShapes >( drawing::ShapeCollection::create(
comphelper::getProcessComponentContext()), uno::UNO_QUERY );
OSL_ENSURE( xFoundShapes.is(), "Couldn't create a shape collection!" ); OSL_ENSURE( xFoundShapes.is(), "Couldn't create a shape collection!" );
if( xFoundShapes.is()) if( xFoundShapes.is())

View File

@@ -34,8 +34,6 @@ public:
::osl::Mutex maMutex; ::osl::Mutex maMutex;
}; };
SVX_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SvxShapeCollection_NewInstance() throw();
/*********************************************************************** /***********************************************************************
* * * *
***********************************************************************/ ***********************************************************************/

View File

@@ -876,7 +876,6 @@
#include <svx/unomod.hxx> #include <svx/unomod.hxx>
#include <svx/unomodel.hxx> #include <svx/unomodel.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/unoshcol.hxx>
#include <svx/verttexttbxctrl.hxx> #include <svx/verttexttbxctrl.hxx>
#include <svx/xbtmpit.hxx> #include <svx/xbtmpit.hxx>
#include <svx/xdef.hxx> #include <svx/xdef.hxx>

View File

@@ -55,6 +55,7 @@
#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp> #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/drawing/XShapes.hpp>
@@ -70,7 +71,6 @@
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <sfx2/docfile.hxx> #include <sfx2/docfile.hxx>
#include <svx/unoshcol.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <unotools/accessiblerelationsethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx>
#include <toolkit/helper/convert.hxx> #include <toolkit/helper/convert.hxx>
@@ -710,7 +710,8 @@ void ScChildrenShapes::Select(sal_Int32 nIndex)
xSelectionSupplier->getSelection() >>= xShapes; xSelectionSupplier->getSelection() >>= xShapes;
if (!xShapes.is()) if (!xShapes.is())
xShapes = new SvxShapeCollection(); xShapes = drawing::ShapeCollection::create(
comphelper::getProcessComponentContext());
xShapes->add(maZOrderedShapes[nIndex]->xShape); xShapes->add(maZOrderedShapes[nIndex]->xShape);
@@ -757,8 +758,8 @@ void ScChildrenShapes::SelectAll()
if (maZOrderedShapes.size() > 1) if (maZOrderedShapes.size() > 1)
{ {
uno::Reference<drawing::XShapes> xShapes; uno::Reference<drawing::XShapes> xShapes = drawing::ShapeCollection::create(
xShapes = new SvxShapeCollection(); comphelper::getProcessComponentContext());
try try
{ {

View File

@@ -19,6 +19,7 @@
#include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/awt/MouseButton.hpp>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/script/vba/VBAEventId.hpp> #include <com/sun/star/script/vba/VBAEventId.hpp>
#include <com/sun/star/script/vba/XVBAEventProcessor.hpp> #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
#include <com/sun/star/view/DocumentZoomType.hpp> #include <com/sun/star/view/DocumentZoomType.hpp>
@@ -32,7 +33,6 @@
#include <svx/svdpagv.hxx> #include <svx/svdpagv.hxx>
#include <svx/svdview.hxx> #include <svx/svdview.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/unoshcol.hxx>
#include <svx/fmshell.hxx> #include <svx/fmshell.hxx>
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
@@ -897,8 +897,10 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() throw(uno::RuntimeException)
// ShapeCollection erzeugen (wie in SdXImpressView::getSelection im Draw) // ShapeCollection erzeugen (wie in SdXImpressView::getSelection im Draw)
// Zurueckgegeben wird XInterfaceRef, das muss das UsrObject-XInterface sein // Zurueckgegeben wird XInterfaceRef, das muss das UsrObject-XInterface sein
SvxShapeCollection* pShapes = new SvxShapeCollection(); uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create(
uno::Reference<uno::XInterface> xRet(static_cast<cppu::OWeakObject*>(pShapes)); comphelper::getProcessComponentContext());
uno::Reference<uno::XInterface> xRet(xShapes);
for (sal_uLong i=0; i<nMarkCount; i++) for (sal_uLong i=0; i<nMarkCount; i++)
{ {
@@ -907,7 +909,7 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() throw(uno::RuntimeException)
{ {
uno::Reference<drawing::XShape> xShape( pDrawObj->getUnoShape(), uno::UNO_QUERY ); uno::Reference<drawing::XShape> xShape( pDrawObj->getUnoShape(), uno::UNO_QUERY );
if (xShape.is()) if (xShape.is())
pShapes->add(xShape); xShapes->add(xShape);
} }
} }
return uno::makeAny(xRet); return uno::makeAny(xRet);

View File

@@ -752,7 +752,6 @@
#include <svx/unopool.hxx> #include <svx/unopool.hxx>
#include <svx/unoprov.hxx> #include <svx/unoprov.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/unoshcol.hxx>
#include <svx/unoshprp.hxx> #include <svx/unoshprp.hxx>
#include <svx/verttexttbxctrl.hxx> #include <svx/verttexttbxctrl.hxx>
#include <svx/view3d.hxx> #include <svx/view3d.hxx>

View File

@@ -18,6 +18,7 @@
*/ */
#include "AccessibleDrawDocumentView.hxx" #include "AccessibleDrawDocumentView.hxx"
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
@@ -30,6 +31,7 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <rtl/ustring.h> #include <rtl/ustring.h>
#include<sfx2/viewfrm.hxx> #include<sfx2/viewfrm.hxx>
@@ -38,7 +40,6 @@
#include <svx/svdobj.hxx> #include <svx/svdobj.hxx>
#include <svx/svdmodel.hxx> #include <svx/svdmodel.hxx>
#include <svx/unoapi.hxx> #include <svx/unoapi.hxx>
#include <svx/unoshcol.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include "Window.hxx" #include "Window.hxx"
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
@@ -751,7 +752,8 @@ void
xSel->select( aAny ); xSel->select( aAny );
else else
{ {
uno::Reference< drawing::XShapes > xShapes( new SvxShapeCollection() ); uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create(
comphelper::getProcessComponentContext());
for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
{ {
@@ -800,7 +802,8 @@ void
} }
else else
// Create an empty selection to add the shape to. // Create an empty selection to add the shape to.
xShapes = new SvxShapeCollection(); xShapes = drawing::ShapeCollection::create(
comphelper::getProcessComponentContext());
// Update the selection. // Update the selection.
if( !bFound && bSelect ) if( !bFound && bSelect )

View File

@@ -30,15 +30,16 @@
#include "Window.hxx" #include "Window.hxx"
#include "pres.hxx" #include "pres.hxx"
#include <comphelper/processfactory.hxx>
#include <cppuhelper/proptypehlp.hxx> #include <cppuhelper/proptypehlp.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
#include <svx/svdpagv.hxx> #include <svx/svdpagv.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/unoshcol.hxx>
#include <sfx2/zoomitem.hxx> #include <sfx2/zoomitem.hxx>
#include <com/sun/star/drawing/DrawViewMode.hpp> #include <com/sun/star/drawing/DrawViewMode.hpp>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <com/sun/star/drawing/XLayerManager.hpp> #include <com/sun/star/drawing/XLayerManager.hpp>
#include <com/sun/star/view/DocumentZoomType.hpp> #include <com/sun/star/view/DocumentZoomType.hpp>
@@ -287,7 +288,8 @@ Any SAL_CALL SdUnoDrawView::getSelection()
sal_uInt32 nCount = rMarkList.GetMarkCount(); sal_uInt32 nCount = rMarkList.GetMarkCount();
if( nCount ) if( nCount )
{ {
Reference< drawing::XShapes > xShapes( SvxShapeCollection_NewInstance(), UNO_QUERY ); Reference< drawing::XShapes > xShapes( drawing::ShapeCollection::create(
comphelper::getProcessComponentContext()), UNO_QUERY );
for( sal_uInt32 nNum = 0; nNum < nCount; nNum++) for( sal_uInt32 nNum = 0; nNum < nCount; nNum++)
{ {
SdrMark *pMark = rMarkList.GetMark(nNum); SdrMark *pMark = rMarkList.GetMark(nNum);

View File

@@ -44,15 +44,6 @@ SvxShapeCollection::~SvxShapeCollection() throw()
{ {
} }
//----------------------------------------------------------------------
Reference< uno::XInterface > SvxShapeCollection_NewInstance() throw()
{
Reference< drawing::XShapes > xShapes( new SvxShapeCollection() );
Reference< uno::XInterface > xRef( xShapes, UNO_QUERY );
return xRef;
}
// XInterface // XInterface
void SvxShapeCollection::release() throw() void SvxShapeCollection::release() throw()
{ {

View File

@@ -930,7 +930,6 @@
#include <svx/unomodel.hxx> #include <svx/unomodel.hxx>
#include <svx/unoprov.hxx> #include <svx/unoprov.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/unoshcol.hxx>
#include <svx/verttexttbxctrl.hxx> #include <svx/verttexttbxctrl.hxx>
#include <svx/viewlayoutitem.hxx> #include <svx/viewlayoutitem.hxx>
#include <svx/xbtmpit.hxx> #include <svx/xbtmpit.hxx>

View File

@@ -54,7 +54,6 @@
#include <IMark.hxx> #include <IMark.hxx>
#include <unotxdoc.hxx> #include <unotxdoc.hxx>
#include <unodraw.hxx> #include <unodraw.hxx>
#include <svx/unoshcol.hxx>
#include <svx/unoshape.hxx> #include <svx/unoshape.hxx>
#include <svx/svdpagv.hxx> #include <svx/svdpagv.hxx>
#include <swerror.h> #include <swerror.h>
@@ -63,6 +62,7 @@
#include <SwStyleNameMapper.hxx> #include <SwStyleNameMapper.hxx>
#include <crsskip.hxx> #include <crsskip.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/drawing/ShapeCollection.hpp>
#include <editeng/outliner.hxx> #include <editeng/outliner.hxx>
#include <editeng/editview.hxx> #include <editeng/editview.hxx>
#include <unoparagraph.hxx> #include <unoparagraph.hxx>
@@ -72,6 +72,7 @@
#include <switerator.hxx> #include <switerator.hxx>
#include "swdtflvr.hxx" #include "swdtflvr.hxx"
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
@@ -405,7 +406,8 @@ uno::Any SwXTextView::getSelection(void) throw( uno::RuntimeException )
getSomething(SwXTextDocument::getUnoTunnelId())); getSomething(SwXTextDocument::getUnoTunnelId()));
SwFmDrawPage* pSvxDrawPage = pTextDoc->GetDrawPage()->GetSvxPage(); SwFmDrawPage* pSvxDrawPage = pTextDoc->GetDrawPage()->GetSvxPage();
uno::Reference< drawing::XShapes > xShCol = new SvxShapeCollection(); uno::Reference< drawing::XShapes > xShCol = drawing::ShapeCollection::create(
comphelper::getProcessComponentContext());
const SdrMarkList& rMarkList = rSh.GetDrawView()->GetMarkedObjectList(); const SdrMarkList& rMarkList = rSh.GetDrawView()->GetMarkedObjectList();
for(sal_uInt16 i = 0; i < rMarkList.GetMarkCount(); i++) for(sal_uInt16 i = 0; i < rMarkList.GetMarkCount(); i++)