summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-01-10 11:30:59 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-01-10 11:42:11 -0500
commit10840ad753b60886ea5175060cb0ec2a77e1579a (patch)
tree9e3d75d9f1d13423e5e30d8cc4f539be449abeb7
parentfe23abd3812e08015facbbb2eb725dd990d63fa0 (diff)
fdo#72005: Insert the border rectangle to the bottom of the stack.
This will make the border and fill shape to be drawn first, then everything else drawn on top. This commit may look large, but it's actually a very trivial change. The important part is in SvxShapeGroup where new methods have been added to allow different insertion positions for the new shapes being inserted, and have the chart2 code make use of it to insert the fill rectangle to the bottom rather than to the top. Change-Id: I999160daf6fc9ce3d7e641f57b1998543df1cc4e
-rw-r--r--chart2/source/view/inc/AbstractShapeFactory.hxx17
-rw-r--r--chart2/source/view/inc/OpenglShapeFactory.hxx13
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx13
-rw-r--r--chart2/source/view/main/OpenglShapeFactory.cxx12
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx21
-rw-r--r--chart2/source/view/main/VLegend.cxx2
-rw-r--r--include/svx/unoshape.hxx14
-rwxr-xr-xoffapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/drawing/XShapes2.idl38
-rw-r--r--svx/source/unodraw/unoshap2.cxx39
10 files changed, 127 insertions, 43 deletions
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index 36b255457baa..73fbf6989736 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -23,7 +23,7 @@
#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
#include <com/sun/star/drawing/Position3D.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShapes2.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -60,6 +60,8 @@ class AbstractShapeFactory
{
public:
+ enum StackPosition { Top, Bottom };
+
static AbstractShapeFactory* getOrCreateShapeFactory(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory);
virtual ~AbstractShapeFactory() {};
@@ -211,12 +213,13 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createRectangle(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShapes >& xTarget
- , const ::com::sun::star::awt::Size& rSize
- , const ::com::sun::star::awt::Point& rPosition
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues ) = 0;
+ const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShapes >& xTarget,
+ const com::sun::star::awt::Size& rSize,
+ const com::sun::star::awt::Point& rPosition,
+ const tNameSequence& rPropNames,
+ const tAnySequence& rPropValues,
+ StackPosition ePos = Top ) = 0;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createRectangle(
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index 7d8ebdc2b083..164ba93bc400 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -162,12 +162,13 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createRectangle(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShapes >& xTarget
- , const ::com::sun::star::awt::Size& rSize
- , const ::com::sun::star::awt::Point& rPosition
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues );
+ const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShapes >& xTarget,
+ const com::sun::star::awt::Size& rSize,
+ const com::sun::star::awt::Point& rPosition,
+ const tNameSequence& rPropNames,
+ const tAnySequence& rPropValues,
+ StackPosition ePos = Top );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createRectangle(
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 5afb686c2d63..ed592d2a277b 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -177,12 +177,13 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createRectangle(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShapes >& xTarget
- , const ::com::sun::star::awt::Size& rSize
- , const ::com::sun::star::awt::Point& rPosition
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues );
+ const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShapes >& xTarget,
+ const com::sun::star::awt::Size& rSize,
+ const com::sun::star::awt::Point& rPosition,
+ const tNameSequence& rPropNames,
+ const tAnySequence& rPropValues,
+ StackPosition ePos = Top );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createRectangle(
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 2f4b6cfd625b..126707b3e474 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -364,15 +364,17 @@ uno::Reference< drawing::XShape > OpenglShapeFactory::createInvisibleRectangle(
}
uno::Reference< drawing::XShape > OpenglShapeFactory::createRectangle(
- const uno::Reference< drawing::XShapes >& xTarget
- , const awt::Size& rSize
- , const awt::Point& rPosition
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues )
+ const uno::Reference< drawing::XShapes >& xTarget,
+ const awt::Size& rSize,
+ const awt::Point& rPosition,
+ const tNameSequence& rPropNames,
+ const tAnySequence& rPropValues,
+ StackPosition /*ePos*/ )
{
dummy::DummyRectangle* pRectangle = new dummy::DummyRectangle(rSize, rPosition,
rPropNames, rPropValues);
+ // TODO : Honor stack position.
xTarget->add(pRectangle);
return pRectangle;
}
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 17a89cb9cef5..30c1bff03a24 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2047,17 +2047,26 @@ uno::Reference< drawing::XShape > ShapeFactory::createInvisibleRectangle(
}
uno::Reference< drawing::XShape > ShapeFactory::createRectangle(
- const uno::Reference< drawing::XShapes >& xTarget
- , const awt::Size& rSize
- , const awt::Point& rPosition
- , const tNameSequence& rPropNames
- , const tAnySequence& rPropValues )
+ const uno::Reference< drawing::XShapes >& xTarget,
+ const awt::Size& rSize,
+ const awt::Point& rPosition,
+ const tNameSequence& rPropNames,
+ const tAnySequence& rPropValues,
+ StackPosition ePos )
{
uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
"com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY );
if( xShape.is())
{
- xTarget->add( xShape );
+ if (ePos == Bottom)
+ {
+ uno::Reference<drawing::XShapes2> xTarget2(xTarget, uno::UNO_QUERY);
+ if (xTarget2.is())
+ xTarget2->addBottom(xShape);
+ }
+ else
+ xTarget->add(xShape);
+
xShape->setSize( rSize );
xShape->setPosition( rPosition );
uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY_THROW );
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 3cdc50514c95..1f7b46e3c793 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -913,7 +913,7 @@ void VLegend::createShapes(
aLegendSize,
awt::Point(0,0),
aLineFillProperties.first,
- aLineFillProperties.second );
+ aLineFillProperties.second, AbstractShapeFactory::Bottom );
//because of this name this border will be used for marking the legend
AbstractShapeFactory::setShapeName( xBorder, "MarkHandles" );
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index c27f8b7c6bf1..538bc130639f 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -33,6 +33,9 @@
#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/XShapes2.hpp>
+#include <com/sun/star/drawing/XShapeGroup.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
@@ -374,20 +377,19 @@ public:
// XServiceInfo
virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
};
-#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/drawing/XShapeGroup.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
/***********************************************************************
* *
***********************************************************************/
class SvxShapeGroup : public SvxShape,
public ::com::sun::star::drawing::XShapeGroup,
- public ::com::sun::star::drawing::XShapes
+ public ::com::sun::star::drawing::XShapes2
{
private:
rtl::Reference< SvxDrawPage> mxPage;
+ void addUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_uIntPtr nPos );
+
public:
SvxShapeGroup( SdrObject* pObj,SvxDrawPage* pDrawPage ) throw ();
virtual ~SvxShapeGroup() throw ();
@@ -404,6 +406,10 @@ public:
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);
+ virtual void SAL_CALL addBottom( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
// 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/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 0ad045111ad7..66d1b6e5b435 100755
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -2342,6 +2342,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/drawing,\
XShapeGrouper \
XShapeMirror \
XShapes \
+ XShapes2 \
XSlidePreviewCache \
XSlidePreviewCacheListener \
XSlideRenderer \
diff --git a/offapi/com/sun/star/drawing/XShapes2.idl b/offapi/com/sun/star/drawing/XShapes2.idl
new file mode 100644
index 000000000000..c63981cdcf64
--- /dev/null
+++ b/offapi/com/sun/star/drawing/XShapes2.idl
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __com_sun_star_drawing_XShapes2_idl__
+#define __com_sun_star_drawing_XShapes2_idl__
+
+#include <com/sun/star/drawing/XShapes.idl>
+
+module com { module sun { module star { module drawing {
+
+interface XShapes2 : com::sun::star::drawing::XShapes
+{
+ /**
+ * Insert a new shape to the top of the stack.
+ *
+ * @param xShape shape to be inserted.
+ */
+ void addTop( [in] com::sun::star::drawing::XShape xShape );
+
+ /**
+ * Insert a new shape to the bottom of the stack.
+ *
+ * @param xShape shape to be inserted.
+ */
+ void addBottom( [in] com::sun::star::drawing::XShape xShape );
+};
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index ec959efbc193..a3c42bdebca3 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -106,6 +106,7 @@ uno::Any SAL_CALL SvxShapeGroup::queryAggregation( const uno::Type & rType ) thr
QUERYINT( drawing::XShapeGroup );
else QUERYINT( drawing::XShapes );
+ else QUERYINT( drawing::XShapes2 );
else QUERYINT( container::XIndexAccess );
else QUERYINT( container::XElementAccess );
else
@@ -192,14 +193,8 @@ void SAL_CALL SvxShapeGroup::leaveGroup( ) throw(uno::RuntimeException)
// pDrView->LeaveOneGroup();
}
-//----------------------------------------------------------------------
-
-// XShapes
-void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShape )
- throw( uno::RuntimeException )
+void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape, sal_uIntPtr nPos )
{
- ::SolarMutexGuard aGuard;
-
SvxShape* pShape = SvxShape::getImplementation( xShape );
if( mpObj.is()&& mxPage.is() && pShape )
@@ -211,7 +206,7 @@ void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShap
if( pSdrShape->IsInserted() )
pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() );
- mpObj->GetSubList()->InsertObject( pSdrShape );
+ mpObj->GetSubList()->InsertObject(pSdrShape, nPos);
pSdrShape->SetModel(mpObj->GetModel());
// #85922# It makes no sense to set the layer asked
@@ -236,6 +231,16 @@ void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShap
}
}
+// XShapes
+void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ ::SolarMutexGuard aGuard;
+
+ // Add to the top of the stack (i.e. bottom of the list) by default.
+ addUnoShape(xShape, 0xFFFF);
+}
+
//----------------------------------------------------------------------
void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xShape )
throw( uno::RuntimeException )
@@ -289,6 +294,24 @@ void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xS
mpModel->SetChanged();
}
+void SAL_CALL SvxShapeGroup::addTop( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ // Add to the top of the stack (i.e. bottom of the list).
+ addUnoShape(xShape, 0xFFFF);
+}
+
+void SAL_CALL SvxShapeGroup::addBottom( const uno::Reference< drawing::XShape >& xShape )
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ // Add to the bottom of the stack (i.e. top of the list).
+ addUnoShape(xShape, 0);
+}
+
// XIndexAccess
//----------------------------------------------------------------------