summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-10-15 17:06:31 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-11-19 13:47:38 +0100
commitcf74b7fb77c8c2a77e9f0d8ea9e3b1b5839d7f00 (patch)
treecf30c4e0f17ca649f728ee73cac53f96afd58c92 /chart2
parentd821f5aa04bca7f7d4202fdb72a41964b87e7169 (diff)
make it possible to avoid XShape/XShapes in the backend
Change-Id: I9aa4b71d12bb6720e2197dc1de6f06c61f27d6ee
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/inc/DummyXShape.hxx5
-rw-r--r--chart2/source/view/main/DummyXShape.cxx29
2 files changed, 26 insertions, 8 deletions
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index 9de599dd7158..ef117abd2a3b 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -46,6 +46,7 @@ class DummyXShape : public cppu::WeakImplHelper6<
com::sun::star::lang::XServiceInfo >
{
public:
+ DummyXShape();
// XNamed
virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
@@ -105,6 +106,7 @@ private:
com::sun::star::awt::Size maSize;
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxParent;
+ DummyXShape* mpParent;
};
@@ -141,7 +143,8 @@ public:
virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
private:
- std::vector<com::sun::star::uno::Reference< com::sun::star::drawing::XShape > > maShapes;
+ std::vector<com::sun::star::uno::Reference< com::sun::star::drawing::XShape > > maUNOShapes;
+ std::vector<DummyXShape*> maShapes;
};
}
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 26184f8ebfef..2e208f29bf1c 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -18,6 +18,11 @@ namespace chart {
namespace dummy {
+DummyXShape::DummyXShape():
+ mpParent(NULL)
+{
+}
+
OUString DummyXShape::getName()
throw(uno::RuntimeException)
{
@@ -217,15 +222,25 @@ void DummyXShapes::release()
void DummyXShapes::add( const uno::Reference< drawing::XShape>& xShape )
throw(uno::RuntimeException)
{
- maShapes.push_back(xShape);
+ DummyXShape* pChild = dynamic_cast<DummyXShape*>(xShape.get());
+ assert(pChild);
+ maUNOShapes.push_back(xShape);
+ pChild->setParent(static_cast< ::cppu::OWeakObject* >( this ));
+ maShapes.push_back(pChild);
}
void DummyXShapes::remove( const uno::Reference< drawing::XShape>& xShape )
throw(uno::RuntimeException)
{
- std::vector< uno::Reference<drawing::XShape> >::iterator itr = std::find(maShapes.begin(), maShapes.end(), xShape);
- if(itr != maShapes.end())
- maShapes.erase(itr);
+ std::vector< uno::Reference<drawing::XShape> >::iterator itr = std::find(maUNOShapes.begin(), maUNOShapes.end(), xShape);
+
+ DummyXShape* pChild = dynamic_cast<DummyXShape*>((*itr).get());
+ std::vector< DummyXShape* >::iterator itrShape = std::find(maShapes.begin(), maShapes.end(), pChild);
+ if(itrShape != maShapes.end())
+ maShapes.erase(itrShape);
+
+ if(itr != maUNOShapes.end())
+ maUNOShapes.erase(itr);
}
uno::Type DummyXShapes::getElementType()
@@ -237,13 +252,13 @@ uno::Type DummyXShapes::getElementType()
sal_Bool DummyXShapes::hasElements()
throw(uno::RuntimeException)
{
- return !maShapes.empty();
+ return !maUNOShapes.empty();
}
sal_Int32 DummyXShapes::getCount()
throw(uno::RuntimeException)
{
- return maShapes.size();
+ return maUNOShapes.size();
}
uno::Any DummyXShapes::getByIndex(sal_Int32 nIndex)
@@ -251,7 +266,7 @@ uno::Any DummyXShapes::getByIndex(sal_Int32 nIndex)
uno::RuntimeException)
{
uno::Any aShape;
- aShape <<= maShapes[nIndex];
+ aShape <<= maUNOShapes[nIndex];
return aShape;
}