summaryrefslogtreecommitdiff
path: root/slideshow/source/engine/shapes
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-01-29 14:38:09 +0100
committerIvo Hinkelmann <ihi@openoffice.org>2010-01-29 14:38:09 +0100
commit7db24fbf87af39d77fe8c8c57d719cdbad153aac (patch)
treefadca73ca38cc6f3d4b61ef1c072db70e66da529 /slideshow/source/engine/shapes
parentbdf06223c6c64e9baff7c835f75134a97073ade3 (diff)
parent84ed0f699225aa8271057920a62f4faa597a6654 (diff)
CWS-TOOLING: integrate CWS eraser01
Diffstat (limited to 'slideshow/source/engine/shapes')
-rw-r--r--slideshow/source/engine/shapes/shapeimporter.cxx120
1 files changed, 112 insertions, 8 deletions
diff --git a/slideshow/source/engine/shapes/shapeimporter.cxx b/slideshow/source/engine/shapes/shapeimporter.cxx
index 61f4d30fe2fc..a524aa697935 100644
--- a/slideshow/source/engine/shapes/shapeimporter.cxx
+++ b/slideshow/source/engine/shapes/shapeimporter.cxx
@@ -39,9 +39,22 @@
#include <goodies/grfmgr.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/streamwrap.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <cppcanvas/basegfxfactory.hxx>
+#include <cppcanvas/polypolygon.hxx>
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/drawing/ColorMode.hpp>
#include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/drawing/XLayerSupplier.hpp>
+#include <com/sun/star/drawing/XLayerManager.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include "drawshapesubsetting.hxx"
#include "drawshape.hxx"
@@ -52,11 +65,13 @@
#include "slideshowexceptions.hxx"
#include "gdimtftools.hxx"
#include "tools.hxx"
+#include "slideshowcontext.hxx"
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
using namespace com::sun::star;
+using namespace ::comphelper;
namespace slideshow {
namespace internal {
@@ -436,7 +451,8 @@ ShapeSharedPtr ShapeImporter::createShape(
bool ShapeImporter::isSkip(
uno::Reference<beans::XPropertySet> const& xPropSet,
- rtl::OUString const& shapeType ) const
+ rtl::OUString const& shapeType,
+ uno::Reference< drawing::XLayer> const& xLayer )
{
// skip empty presentation objects:
bool bEmpty = false;
@@ -448,6 +464,26 @@ bool ShapeImporter::isSkip(
return true;
}
+ //skip shapes which corresponds to annotations
+ if(xLayer.is())
+ {
+ rtl::OUString layerName;
+ uno::Reference<beans::XPropertySet> xPropLayerSet(
+ xLayer, uno::UNO_QUERY );
+ const uno::Any& a(xPropLayerSet->getPropertyValue(rtl::OUString::createFromAscii("Name")) );
+ bool const bRet = (a >>= layerName);
+ if(bRet)
+ {
+ if( layerName.equals(rtl::OUString::createFromAscii("DrawnInSlideshow")))
+ {
+ //Transform shapes into PolyPolygons
+ importPolygons(xPropSet);
+
+ return true;
+ }
+ }
+ }
+
// don't export presentation placeholders on masterpage
// they can be non empty when user edits the default texts
if(mbConvertingMasterPage)
@@ -465,6 +501,46 @@ bool ShapeImporter::isSkip(
return false;
}
+
+void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xPropSet) {
+
+ drawing::PointSequenceSequence aRetval;
+ sal_Int32 nLineColor=0;
+ double fLineWidth;
+ getPropertyValue( aRetval, xPropSet, OUSTR("PolyPolygon") );
+ getPropertyValue( nLineColor, xPropSet, OUSTR("LineColor") );
+ getPropertyValue( fLineWidth, xPropSet, OUSTR("LineWidth") );
+
+ drawing::PointSequence* pOuterSequence = aRetval.getArray();
+ awt::Point* pInnerSequence = pOuterSequence->getArray();
+
+ ::basegfx::B2DPolygon aPoly;
+ basegfx::B2DPoint aPoint;
+ for( sal_Int32 nCurrPoly=0; nCurrPoly<pOuterSequence->getLength(); ++nCurrPoly )
+ {
+ aPoint.setX((*pInnerSequence).X);
+ aPoint.setY((*pInnerSequence).Y);
+ aPoly.append( aPoint );
+ *pInnerSequence++;
+ }
+ UnoViewVector::const_iterator aIter=(mrContext.mrViewContainer).begin();
+ UnoViewVector::const_iterator aEnd=(mrContext.mrViewContainer).end();
+ while(aIter != aEnd)
+ {
+ ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
+ ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( (*aIter)->getCanvas(),
+ aPoly ) );
+ if( pPolyPoly )
+ {
+ pPolyPoly->setRGBALineColor( unoColor2RGBColor( nLineColor ).getIntegerColor() );
+ pPolyPoly->setStrokeWidth(fLineWidth);
+ pPolyPoly->draw();
+ maPolygons.push_back(pPolyPoly);
+ }
+ aIter++;
+ }
+}
+
ShapeSharedPtr ShapeImporter::importBackgroundShape() // throw (ShapeLoadFailedException)
{
if( maShapesStack.empty() )
@@ -506,10 +582,23 @@ ShapeSharedPtr ShapeImporter::importShape() // throw (ShapeLoadFailedException)
throw ShapeLoadFailedException();
}
- rtl::OUString const shapeType( xCurrShape->getShapeType() );
+ //Retrieve the layer for the current shape
+ uno::Reference< drawing::XLayer > xDrawnInSlideshow;
+
+ uno::Reference< drawing::XLayerSupplier > xLayerSupplier(mxPagesSupplier, uno::UNO_QUERY);
+ if(xLayerSupplier.is())
+ {
+ uno::Reference< container::XNameAccess > xNameAccess = xLayerSupplier->getLayerManager();
+
+ uno::Reference< drawing::XLayerManager > xLayerManager(xNameAccess, uno::UNO_QUERY);
+
+ xDrawnInSlideshow = xLayerManager->getLayerForShape(xCurrShape);
+ }
+
+ rtl::OUString const shapeType( xCurrShape->getShapeType());
// is this shape presentation-invisible?
- if( !isSkip(xPropSet, shapeType) )
+ if( !isSkip(xPropSet, shapeType, xDrawnInSlideshow) )
{
bIsGroupShape = shapeType.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM(
@@ -549,17 +638,32 @@ bool ShapeImporter::isImportDone() const
return maShapesStack.empty();
}
-ShapeImporter::ShapeImporter( uno::Reference<drawing::XDrawPage> const& xPage,
- uno::Reference<drawing::XDrawPage> const& xActualPage,
- const SlideShowContext& rContext,
- sal_Int32 nOrdNumStart,
- bool bConvertingMasterPage ) :
+PolyPolygonVector ShapeImporter::getPolygons()
+{
+ return maPolygons;
+}
+
+ShapeImporter::ShapeImporter( uno::Reference<drawing::XDrawPage> const& xPage,
+ uno::Reference<drawing::XDrawPage> const& xActualPage,
+ uno::Reference<drawing::XDrawPagesSupplier> const& xPagesSupplier,
+ const SlideShowContext& rContext,
+ sal_Int32 nOrdNumStart,
+ bool bConvertingMasterPage ) :
mxPage( xActualPage ),
+#ifdef ENABLE_PRESENTER_EXTRA_UI
+ mxPagesSupplier( xPagesSupplier ),
+#else
+ mxPagesSupplier( NULL ),
+#endif
mrContext( rContext ),
+ maPolygons(),
maShapesStack(),
mnAscendingPrio( nOrdNumStart ),
mbConvertingMasterPage( bConvertingMasterPage )
{
+#ifndef ENABLE_PRESENTER_EXTRA_UI
+ (void)xPagesSupplier;
+#endif
uno::Reference<drawing::XShapes> const xShapes(
xPage, uno::UNO_QUERY_THROW );
maShapesStack.push( XShapesEntry(xShapes) );