summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-04-25 19:56:36 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-04-25 20:03:48 +0200
commit3b2ec44912ca2e0548d8078d2edf17fa10856553 (patch)
treed90a1f26a3a85799a9cfeef3167a98e7b3afa819
parent12ace5060dbef6add5521fb932d78e7807c793be (diff)
the chart root shape has to be at the bottom, fdo#74333, cp#1000057
Change-Id: Ic99fec987f290e94e4b45f4d193406daa2de4740
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx13
-rw-r--r--include/svx/unopage.hxx12
-rw-r--r--svx/source/unodraw/unopage.cxx53
3 files changed, 69 insertions, 9 deletions
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index b51f1970a849..892c4b3d155f 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -66,10 +66,15 @@ uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape(
uno::Reference< drawing::XShapes > xRet( ShapeFactory::getChartRootShape( xDrawPage ) );
if( !xRet.is() )
{
- //create the root shape
- xRet = this->createGroup2D(
- uno::Reference<drawing::XShapes>( xDrawPage, uno::UNO_QUERY )
- , "com.sun.star.chart2.shapes" );
+ uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
+ "com.sun.star.drawing.GroupShape" ), uno::UNO_QUERY );
+ uno::Reference< drawing::XShapes2 > xShapes2(xDrawPage, uno::UNO_QUERY_THROW);
+ xShapes2->addBottom(xShape);
+
+ setShapeName( xShape, "com.sun.star.chart2.shapes" );
+ xShape->setSize(awt::Size(0,0));
+
+ xRet = uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
}
return xRet;
}
diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx
index a5a37d565bb6..515074c0ef81 100644
--- a/include/svx/unopage.hxx
+++ b/include/svx/unopage.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShapes2.hpp>
#include <com/sun/star/drawing/XShapeGrouper.hpp>
#include <com/sun/star/drawing/XShapeCombiner.hpp>
#include <com/sun/star/drawing/XShapeBinder.hpp>
@@ -35,7 +36,7 @@
#include <editeng/mutxhelp.hxx>
#include <svx/svxdllapi.h>
-#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase6.hxx>
#include <comphelper/servicehelper.hxx>
#include <svx/unoprov.hxx>
@@ -55,8 +56,9 @@ class SvxShapeConnector;
#define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
#define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
-class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
+class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper6< ::com::sun::star::drawing::XDrawPage,
::com::sun::star::drawing::XShapeGrouper,
+ ::com::sun::star::drawing::XShapes2,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XUnoTunnel,
::com::sun::star::lang::XComponent>,
@@ -84,7 +86,7 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun:
void ChangeModel( SdrModel* pNewModel );
// Creation of a SdrObject and insertion into the SdrPage
- SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
+ SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, bool bBeginning = false ) throw();
// Determine Type and Inventor
void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) const throw();
@@ -115,6 +117,10 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun:
throw (::com::sun::star::uno::RuntimeException,
std::exception) SAL_OVERRIDE;
+ // XShapes2
+ virtual void SAL_CALL addTop( const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+ virtual void SAL_CALL addBottom( const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
// XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index cf8b8242dc2d..d8466abf0f04 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -231,6 +231,50 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
mpModel->SetChanged();
}
+void SAL_CALL SvxDrawPage::addTop( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException, std::exception )
+{
+ add(xShape);
+}
+
+void SAL_CALL SvxDrawPage::addBottom( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException, std::exception )
+{
+ SolarMutexGuard aGuard;
+
+ if ( ( mpModel == NULL ) || ( mpPage == NULL ) )
+ throw lang::DisposedException();
+
+ SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+ if( NULL == pShape )
+ return;
+
+ SdrObject *pObj = pShape->GetSdrObject();
+
+ if(!pObj)
+ {
+ pObj = CreateSdrObject( xShape, true );
+ ENSURE_OR_RETURN_VOID( pObj != NULL, "SvxDrawPage::add: no SdrObject was created!" );
+ }
+ else if ( !pObj->IsInserted() )
+ {
+ pObj->SetModel(mpModel);
+ mpPage->InsertObject( pObj, 0 );
+ }
+
+ pShape->Create( pObj, this );
+ OSL_ENSURE( pShape->GetSdrObject() == pObj, "SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
+
+ if ( !pObj->IsInserted() )
+ {
+ pObj->SetModel(mpModel);
+ mpPage->InsertObject( pObj, 0 );
+ }
+
+ mpModel->SetChanged();
+}
+
void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
throw (uno::RuntimeException, std::exception)
{
@@ -802,14 +846,19 @@ Reference< drawing::XShape > SvxDrawPage::_CreateShape( SdrObject *pObj ) const
return xShape;
}
-SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
+SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape, bool bBeginning ) throw()
{
SdrObject* pObj = _CreateSdrObject( xShape );
if( pObj)
{
pObj->SetModel(mpModel);
if ( !pObj->IsInserted() && !pObj->IsDoNotInsertIntoPageAutomatically() )
- mpPage->InsertObject( pObj );
+ {
+ if(bBeginning)
+ mpPage->InsertObject( pObj, 0 );
+ else
+ mpPage->InsertObject( pObj );
+ }
}
return pObj;