[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 3 commits - chart2/inc chart2/source include/svx offapi/com svx/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Jul 2 18:38:14 PDT 2014
chart2/inc/ChartModel.hxx | 2
chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 33 +++++-
chart2/source/model/main/ChartModel.cxx | 5
chart2/source/view/main/ShapeFactory.cxx | 13 +-
include/svx/unopage.hxx | 12 +-
include/svx/unoshape.hxx | 4
offapi/com/sun/star/drawing/XShapes2.idl | 4
svx/source/unodraw/unopage.cxx | 53 +++++++++-
8 files changed, 108 insertions(+), 18 deletions(-)
New commits:
commit e5dfba48e2a930eb35ac6e72f4ea695f5f048c44
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Apr 25 20:36:26 2014 +0200
quick fix for inheritance problems
Change-Id: I41c5c937d62d6ba0b3df2d4a0101319f272495a7
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 538bc13..f90ca50 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -33,6 +33,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/drawing/XShapes2.hpp>
#include <com/sun/star/drawing/XShapeGroup.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
@@ -383,7 +384,8 @@ public:
***********************************************************************/
class SvxShapeGroup : public SvxShape,
public ::com::sun::star::drawing::XShapeGroup,
- public ::com::sun::star::drawing::XShapes2
+ public ::com::sun::star::drawing::XShapes2,
+ public ::com::sun::star::drawing::XShapes
{
private:
rtl::Reference< SvxDrawPage> mxPage;
diff --git a/offapi/com/sun/star/drawing/XShapes2.idl b/offapi/com/sun/star/drawing/XShapes2.idl
index 80b9936..52909ce 100644
--- a/offapi/com/sun/star/drawing/XShapes2.idl
+++ b/offapi/com/sun/star/drawing/XShapes2.idl
@@ -15,11 +15,11 @@
module com { module sun { module star { module drawing {
/**
- * Extend XShapes to allow insertion of shapes at different positions.
+ * Allows insertion of shapes at different positions.
*
* @since LibreOffice 4.2
*/
-interface XShapes2 : com::sun::star::drawing::XShapes
+interface XShapes2
{
/**
* Insert a new shape to the top of the stack.
commit 76cd42bce3016a39d5ca647dce8318d33f0401f6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Apr 25 19:49:09 2014 +0200
fix missing service factory during import, related fdo#74333, cp#1000057
Conflicts:
chart2/inc/ChartModel.hxx
chart2/source/model/main/ChartModel.cxx
Change-Id: I2cce561587d82b0434ef2d3e65e5d35b7ff99260
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index 028ce0e..6b28b8e 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -585,6 +585,8 @@ public:
// normal methods
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
getNumberFormatsSupplier();
+
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > getChartView();
};
} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index de42006..35ba049 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1143,6 +1143,24 @@ uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() co
return m_spChart2ModelContact->getDrawPage();
}
+namespace {
+
+uno::Reference< lang::XMultiServiceFactory > getShapeFactory(uno::Reference<uno::XInterface> xChartView)
+{
+ Reference< lang::XUnoTunnel> xUnoTunnel(xChartView,uno::UNO_QUERY);
+ if(xUnoTunnel.is())
+ {
+ ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
+ ExplicitValueProvider::getUnoTunnelId() ));
+ if( pProvider )
+ return pProvider->getDrawModelWrapper()->getShapeFactory();
+
+ }
+ return uno::Reference< lang::XMultiServiceFactory >();
+}
+
+}
+
// ____ XMultiServiceFactory ____
uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
const OUString& aServiceSpecifier )
@@ -1372,15 +1390,18 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
if( !m_xShapeFactory.is() && m_xChartView.is() )
{
- Reference< lang::XUnoTunnel> xUnoTunnel(m_xChartView,uno::UNO_QUERY);
- if(xUnoTunnel.is())
+ m_xShapeFactory = getShapeFactory( m_xChartView );
+ }
+ else
+ {
+ ChartModel* pModel = m_spChart2ModelContact->getModel();
+ if(pModel)
{
- ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
- ExplicitValueProvider::getUnoTunnelId() ));
- if( pProvider )
- m_xShapeFactory.set( pProvider->getDrawModelWrapper()->getShapeFactory() );
+ m_xChartView = pModel->getChartView();
+ m_xShapeFactory = getShapeFactory( m_xChartView );
}
}
+
if( m_xShapeFactory.is() )
{
xResult = m_xShapeFactory->createInstance( aServiceSpecifier );
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 170019f..a22fc31 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1352,6 +1352,11 @@ OUString SAL_CALL ChartModel::dump()
return OUString();
}
+uno::Reference< uno::XInterface > ChartModel::getChartView()
+{
+ return xChartView;
+}
+
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1457f59505b42618c9576224d27d9e52402f94a9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Apr 25 19:56:36 2014 +0200
the chart root shape has to be at the bottom, fdo#74333, cp#1000057
Change-Id: Ic99fec987f290e94e4b45f4d193406daa2de4740
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 30c1bff..cbb2e29 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 78bc0b4..03a8b6b 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();
@@ -111,6 +113,10 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun:
virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ // 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);
virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index f23ab2a..d07b0b9 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -232,6 +232,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 )
{
@@ -794,14 +838,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;
More information about the Libreoffice-commits
mailing list