diff options
22 files changed, 0 insertions, 3816 deletions
diff --git a/basebmp/test/bmpdemo.cxx b/basebmp/test/bmpdemo.cxx index f300a023c447..6b949218b451 100644 --- a/basebmp/test/bmpdemo.cxx +++ b/basebmp/test/bmpdemo.cxx @@ -51,7 +51,6 @@ #include <basegfx/polygon/b2dlinegeometry.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> -#include <basegfx/polygon/b2dpolypolygonrasterconverter.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/numeric/ftools.hxx> diff --git a/basegfx/Library_basegfx.mk b/basegfx/Library_basegfx.mk index af629188b050..fa0607bff256 100644 --- a/basegfx/Library_basegfx.mk +++ b/basegfx/Library_basegfx.mk @@ -97,7 +97,6 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\ basegfx/source/polygon/b3dpolygonclipper \ basegfx/source/polygon/b2dpolygonclipper \ basegfx/source/polygon/b2dpolypolygoncutter \ - basegfx/source/polygon/b2dpolypolygonrasterconverter \ basegfx/source/polygon/b2dpolygon \ basegfx/source/polygon/b2dpolygontriangulator \ basegfx/source/polygon/b2dpolypolygon \ @@ -117,7 +116,6 @@ $(eval $(call gb_Library_add_exception_objects,basegfx,\ basegfx/source/point/b2ipoint \ basegfx/source/curve/b2dbeziertools \ basegfx/source/curve/b2dcubicbezier \ - basegfx/source/curve/b2dquadraticbezier \ basegfx/source/color/bcolormodifier \ basegfx/source/color/bcolortools \ basegfx/source/raster/rasterconvert3d \ diff --git a/basegfx/Package_inc.mk b/basegfx/Package_inc.mk index 6d1a4e745504..5767a8f8a954 100644 --- a/basegfx/Package_inc.mk +++ b/basegfx/Package_inc.mk @@ -80,7 +80,6 @@ $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/polygon/b3dpolypolygon $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/polygon/b2dpolygoncutandtouch.hxx,basegfx/polygon/b2dpolygoncutandtouch.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/polygon/b2dlinegeometry.hxx,basegfx/polygon/b2dlinegeometry.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/polygon/b3dpolypolygontools.hxx,basegfx/polygon/b3dpolypolygontools.hxx)) -$(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/polygon/b2dpolypolygonrasterconverter.hxx,basegfx/polygon/b2dpolypolygonrasterconverter.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/polygon/b3dpolygon.hxx,basegfx/polygon/b3dpolygon.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/polygon/b3dpolygonclipper.hxx,basegfx/polygon/b3dpolygonclipper.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/pixel/bpixel.hxx,basegfx/pixel/bpixel.hxx)) @@ -93,7 +92,6 @@ $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/point/b2dpoint.hxx,bas $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/point/b2dhompoint.hxx,basegfx/point/b2dhompoint.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/point/b2ipoint.hxx,basegfx/point/b2ipoint.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/curve/b2dcubicbezier.hxx,basegfx/curve/b2dcubicbezier.hxx)) -$(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/curve/b2dquadraticbezier.hxx,basegfx/curve/b2dquadraticbezier.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/curve/b2dbeziertools.hxx,basegfx/curve/b2dbeziertools.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/color/bcolor.hxx,basegfx/color/bcolor.hxx)) $(eval $(call gb_Package_add_file,basegfx_inc,inc/basegfx/color/bcolortools.hxx,basegfx/color/bcolortools.hxx)) diff --git a/basegfx/StaticLibrary_basegfx_s.mk b/basegfx/StaticLibrary_basegfx_s.mk index 891e23233be3..79d6ed9373db 100644 --- a/basegfx/StaticLibrary_basegfx_s.mk +++ b/basegfx/StaticLibrary_basegfx_s.mk @@ -102,7 +102,6 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,basegfx_s,\ CustomTarget/basegfx/source/polygon/b3dpolygonclipper \ CustomTarget/basegfx/source/polygon/b2dpolygonclipper \ CustomTarget/basegfx/source/polygon/b2dpolypolygoncutter \ - CustomTarget/basegfx/source/polygon/b2dpolypolygonrasterconverter \ CustomTarget/basegfx/source/polygon/b2dpolygon \ CustomTarget/basegfx/source/polygon/b2dpolygontriangulator \ CustomTarget/basegfx/source/polygon/b2dpolypolygon \ @@ -122,7 +121,6 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,basegfx_s,\ CustomTarget/basegfx/source/point/b2ipoint \ CustomTarget/basegfx/source/curve/b2dbeziertools \ CustomTarget/basegfx/source/curve/b2dcubicbezier \ - CustomTarget/basegfx/source/curve/b2dquadraticbezier \ CustomTarget/basegfx/source/color/bcolormodifier \ CustomTarget/basegfx/source/color/bcolortools \ CustomTarget/basegfx/source/raster/rasterconvert3d \ diff --git a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx b/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx deleted file mode 100644 index 10f57670ecb4..000000000000 --- a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BGFX_CURVE_B2DQUADRATICBEZIER_HXX -#define _BGFX_CURVE_B2DQUADRATICBEZIER_HXX - -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/basegfxdllapi.h> - -////////////////////////////////////////////////////////////////////////////// - -namespace basegfx -{ - class BASEGFX_DLLPUBLIC B2DQuadraticBezier - { - ::basegfx::B2DPoint maStartPoint; - ::basegfx::B2DPoint maEndPoint; - ::basegfx::B2DPoint maControlPoint; - - public: - B2DQuadraticBezier(); - B2DQuadraticBezier(const B2DQuadraticBezier& rBezier); - B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rEnd); - B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, - const ::basegfx::B2DPoint& rControlPoint, const ::basegfx::B2DPoint& rEnd); - ~B2DQuadraticBezier(); - - // assignment operator - B2DQuadraticBezier& operator=(const B2DQuadraticBezier& rBezier); - - // compare operators - bool operator==(const B2DQuadraticBezier& rBezier) const; - bool operator!=(const B2DQuadraticBezier& rBezier) const; - - // test if control point is placed on the edge - bool isBezier() const; - - // data interface - ::basegfx::B2DPoint getStartPoint() const { return maStartPoint; } - void setStartPoint(const ::basegfx::B2DPoint& rValue) { maStartPoint = rValue; } - - ::basegfx::B2DPoint getEndPoint() const { return maEndPoint; } - void setEndPoint(const ::basegfx::B2DPoint& rValue) { maEndPoint = rValue; } - - ::basegfx::B2DPoint getControlPoint() const { return maControlPoint; } - void setControlPoint(const ::basegfx::B2DPoint& rValue) { maControlPoint = rValue; } - }; -} // end of namespace basegfx - -#endif /* _BGFX_CURVE_B2DQUADRATICBEZIER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygonrasterconverter.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygonrasterconverter.hxx deleted file mode 100644 index 36a4793f4c56..000000000000 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygonrasterconverter.hxx +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _BGFX_POLYGON_B2DPOLYPOLYGONRASTERCONVERTER_HXX -#define _BGFX_POLYGON_B2DPOLYPOLYGONRASTERCONVERTER_HXX - -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/range/b2drectangle.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/polygon/b2dpolypolygonfillrule.hxx> -#include <vector> -#include <utility> -#include <basegfx/basegfxdllapi.h> - -////////////////////////////////////////////////////////////////////////////// - -namespace basegfx -{ - /** Raster-convert a poly-polygon. - - This class can raster-convert a given poly-polygon. Simply - derive from this, and override the span() method, which will - get called for every scanline span of the poly-polygon. - - @derive - Overwrite span() with the render output method of your choice. - */ - class BASEGFX_DLLPUBLIC B2DPolyPolygonRasterConverter - { - public: - /** Create raster-converter for given poly-polygon - */ - B2DPolyPolygonRasterConverter(const B2DPolyPolygon& rPolyPolyRaster); - - /** Create raster-converter for given poly-polygon and raster - area. - - @param rPolyPolyRaster - Poly-Polygon to raster convert - - @param rMinUpdateArea - Minimal area to touch when raster-converting. The - rectangle given here is guaranteed to be iterated through - scanline by scanline (but the raster converter might - actually use more scanlines, e.g. if the poly-polygon's - bound rect is larger). One of the cases where this - parameter comes in handy is when rendering in the 'off' - spans, and a certain area must be filled. <em>Do not</em> - use this for clipping, as described above, the touched - area might also be larger. - */ - B2DPolyPolygonRasterConverter(const B2DPolyPolygon& rPolyPolyRaster, - const B2DRectangle& rRasterArea ); - - virtual ~B2DPolyPolygonRasterConverter(); - - /** Raster-convert the contained poly-polygon - - @param eFillRule - Fill rule to use for span filling - */ - void rasterConvert( FillRule eFillRule); - - /** Override this method, to be called for every scanline span - of the poly-polygon - - @param rfXLeft - The left end of the current horizontal span - - @param rfXRight - The right end of the current horizontal span - - @param nY - The y position of the current horizontal span - - @param bOn - Denotes whether this span is on or off, according to the - active fill rule. - */ - virtual void span(const double& rfXLeft, - const double& rfXRight, - sal_Int32 nY, - bool bOn ) = 0; - - /// @internal - struct Vertex - { - inline Vertex(); - inline Vertex( const B2DPoint&, const B2DPoint&, bool ); - - B2DPoint aP1; - B2DPoint aP2; - bool bDownwards; - }; - - private: - // default: disabled copy/assignment - B2DPolyPolygonRasterConverter(const B2DPolyPolygonRasterConverter&); - B2DPolyPolygonRasterConverter& operator=( const B2DPolyPolygonRasterConverter& ); - - void init(); - - typedef ::std::vector<Vertex> VectorOfVertices; - typedef ::std::vector<VectorOfVertices> VectorOfVertexVectors; - - /// The poly-polygon to raster-convert - B2DPolyPolygon maPolyPolygon; - /// Total bound rect of the poly-polygon - const B2DRectangle maPolyPolyRectangle; - - /** Vector containing for each scanline a vector which in turn - contains all vertices that start on the specific scanline - */ - VectorOfVertexVectors maScanlines; - }; -} - -#endif /* _BGFX_POLYGON_B2DPOLYPOLYGONRASTERCONVERTER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/source/curve/b2dquadraticbezier.cxx b/basegfx/source/curve/b2dquadraticbezier.cxx deleted file mode 100644 index 4664f92a1ccf..000000000000 --- a/basegfx/source/curve/b2dquadraticbezier.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <basegfx/curve/b2dquadraticbezier.hxx> -#include <basegfx/numeric/ftools.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace basegfx -{ - B2DQuadraticBezier::B2DQuadraticBezier(const B2DQuadraticBezier& rBezier) - : maStartPoint(rBezier.maStartPoint), - maEndPoint(rBezier.maEndPoint), - maControlPoint(rBezier.maControlPoint) - { - } - - B2DQuadraticBezier::B2DQuadraticBezier() - { - } - - B2DQuadraticBezier::B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rEnd) - : maStartPoint(rStart), - maEndPoint(rEnd) - { - } - - B2DQuadraticBezier::B2DQuadraticBezier(const ::basegfx::B2DPoint& rStart, const ::basegfx::B2DPoint& rControl, const ::basegfx::B2DPoint& rEnd) - : maStartPoint(rStart), - maEndPoint(rEnd), - maControlPoint(rControl) - { - } - - B2DQuadraticBezier::~B2DQuadraticBezier() - { - } - - // assignment operator - B2DQuadraticBezier& B2DQuadraticBezier::operator=(const B2DQuadraticBezier& rBezier) - { - maStartPoint = rBezier.maStartPoint; - maEndPoint = rBezier.maEndPoint; - maControlPoint = rBezier.maControlPoint; - - return *this; - } - - // compare operators - bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier& rBezier) const - { - return ( - maStartPoint == rBezier.maStartPoint - && maEndPoint == rBezier.maEndPoint - && maControlPoint == rBezier.maControlPoint - ); - } - - bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier& rBezier) const - { - return ( - maStartPoint != rBezier.maStartPoint - || maEndPoint != rBezier.maEndPoint - || maControlPoint != rBezier.maControlPoint - ); - } - - // test if control vector is used - bool B2DQuadraticBezier::isBezier() const - { - // if control vector is empty, bezier is not used - if(maControlPoint == maStartPoint || maControlPoint == maEndPoint) - return false; - - return true; - } -} // end of namespace basegfx - -// eof - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx b/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx deleted file mode 100644 index e0a4b5837461..000000000000 --- a/basegfx/source/polygon/b2dpolypolygonrasterconverter.cxx +++ /dev/null @@ -1,701 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <basegfx/polygon/b2dpolypolygonrasterconverter.hxx> - -#include <basegfx/numeric/ftools.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolypolygontools.hxx> - -#include <boost/mem_fn.hpp> - -#include <algorithm> - -namespace basegfx -{ - class radixSort { - - //! public interface - public: - - //! default constructor - radixSort( void ); - - //! destructor - ~radixSort( void ); - - bool sort( const float *pInput, sal_uInt32 nNumElements, sal_uInt32 dwStride ); - - inline sal_uInt32 *indices( void ) const { return m_indices1; } - - //! private attributes - private: - - // current size of index list - sal_uInt32 m_current_size; - - // last known size of index list - sal_uInt32 m_previous_size; - - // index lists - sal_uInt32 *m_indices1; - sal_uInt32 *m_indices2; - - sal_uInt32 m_counter[256*4]; - sal_uInt32 m_offset[256]; - - //! private methods - private: - - bool resize( sal_uInt32 nNumElements ); - inline void reset_indices( void ); - bool prepareCounters( const float *pInput, sal_uInt32 nNumElements, sal_uInt32 dwStride ); - }; - - inline radixSort::radixSort( void ) { - - m_indices1 = NULL; - m_indices2 = NULL; - m_current_size = 0; - m_previous_size = 0; - - reset_indices(); - } - - inline radixSort::~radixSort( void ) { - - delete [] m_indices2; - delete [] m_indices1; - } - - bool radixSort::resize( sal_uInt32 nNumElements ) { - - if(nNumElements==m_previous_size) - return true; - - if(nNumElements > m_current_size) { - - // release index lists - if(m_indices2) - delete [] m_indices2; - if(m_indices1) - delete [] m_indices1; - - // allocate new index lists - m_indices1 = new sal_uInt32[nNumElements]; - m_indices2 = new sal_uInt32[nNumElements]; - - // check for out of memory situation - if(!m_indices1 || !m_indices2) { - delete [] m_indices1; - delete [] m_indices2; - m_indices1 = NULL; - m_indices2 = NULL; - m_current_size = 0; - return false; - } - - m_current_size = nNumElements; - } - - m_previous_size = nNumElements; - - // initialize indices - reset_indices(); - - return true; - } - - inline void radixSort::reset_indices( void ) { - - for(sal_uInt32 i=0;i<m_current_size;i++) - m_indices1[i] = i; - } - - bool radixSort::prepareCounters( const float *pInput, sal_uInt32 nNumElements, sal_uInt32 dwStride ) { - - // clear counters - sal_uInt32 *ptr = m_counter; - for(int i=0; i<64; ++i) - { - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - *ptr++ = 0; - } - - // prepare pointers to relevant memory addresses - sal_uInt8 *p = (sal_uInt8*)pInput; - sal_uInt8 *pe = p+(nNumElements*dwStride); - sal_uInt32 *h0= &m_counter[0]; - sal_uInt32 *h1= &m_counter[256]; - sal_uInt32 *h2= &m_counter[512]; - sal_uInt32 *h3= &m_counter[768]; - - sal_uInt32 *Indices = m_indices1; - float previous_value = *(float *)(((sal_uInt8 *)pInput)+(m_indices1[0]*dwStride)); - bool bSorted = true; - while(p!=pe) { - float value = *(float *)(((sal_uInt8 *)pInput)+((*Indices++)*dwStride)); - if(value<previous_value) { - bSorted = false; - break; - } - previous_value = value; - h0[*p++]++; - h1[*p++]++; - h2[*p++]++; - h3[*p++]++; - p += dwStride-4; - } - if(bSorted) - return true; - while(p!=pe) { - h0[*p++]++; - h1[*p++]++; - h2[*p++]++; - h3[*p++]++; - p += dwStride-4; - } - return false; - } - - bool radixSort::sort( const float *pInput, sal_uInt32 nNumElements, sal_uInt32 dwStride ) { - - if(!(pInput)) - return false; - if(!(nNumElements)) - return false; - if(!(resize(nNumElements))) - return false; - - // prepare radix counters, return if already sorted - if(prepareCounters(pInput,nNumElements,dwStride)) - return true; - - // count number of negative values - sal_uInt32 num_negatives = 0; - sal_uInt32 *h3= &m_counter[768]; - for(sal_uInt32 i=128;i<256;i++) - num_negatives += h3[i]; - - // perform passes, one for each byte - for(sal_uInt32 j=0;j<4;j++) { - - // ignore this pass if all values have the same byte - bool bRun = true; - sal_uInt32 *current_counter = &m_counter[j<<8]; - sal_uInt8 unique_value = *(((sal_uInt8*)pInput)+j); - if(current_counter[unique_value]==nNumElements) - bRun=false; - - // does the incoming byte contain the sign bit? - sal_uInt32 i; - if(j!=3) { - if(bRun) { - m_offset[0] = 0; - for(i=1;i<256;i++) - m_offset[i] = m_offset[i-1] + current_counter[i-1]; - sal_uInt8 *InputBytes = (sal_uInt8 *)pInput; - sal_uInt32 *Indices = m_indices1; - sal_uInt32 *IndicesEnd = &m_indices1[nNumElements]; - InputBytes += j; - while(Indices!=IndicesEnd) { - sal_uInt32 id = *Indices++; - m_indices2[m_offset[InputBytes[id*dwStride]]++] = id; - } - sal_uInt32 *Tmp = m_indices1; - m_indices1 = m_indices2; - m_indices2 = Tmp; - } - } - else { - if(bRun) { - m_offset[0] = num_negatives; - for(i=1;i<128;i++) - m_offset[i] = m_offset[i-1] + current_counter[i-1]; - m_offset[255] = 0; - for(i=0;i<127;i++) - m_offset[254-i] = m_offset[255-i] + current_counter[255-i]; - for(i=128;i<256;i++) - m_offset[i] += current_counter[i]; - for(i=0;i<nNumElements;i++) { - sal_uInt32 Radix = (*(sal_uInt32 *)(((sal_uInt8 *)pInput)+(m_indices1[i]*dwStride)))>>24; - if(Radix<128) m_indices2[m_offset[Radix]++] = m_indices1[i]; - else m_indices2[--m_offset[Radix]] = m_indices1[i]; - } - sal_uInt32 *Tmp = m_indices1; - m_indices1 = m_indices2; - m_indices2 = Tmp; - } - else { - if(unique_value>=128) { - for(i=0;i<nNumElements;i++) - m_indices2[i] = m_indices1[nNumElements-i-1]; - sal_uInt32 *Tmp = m_indices1; - m_indices1 = m_indices2; - m_indices2 = Tmp; - } - } - } - } - - return true; - } - - //************************************************************ - // Internal vertex storage of B2DPolyPolygonRasterConverter - //************************************************************ - - inline B2DPolyPolygonRasterConverter::Vertex::Vertex() : - aP1(), - aP2(), - bDownwards( true ) - { - } - - inline B2DPolyPolygonRasterConverter::Vertex::Vertex( const B2DPoint& rP1, const B2DPoint& rP2, bool bDown ) : - aP1( rP1 ), - aP2( rP2 ), - bDownwards( bDown ) - { - } - - - //************************************************************ - // Helper class for holding horizontal line segments during raster - // conversion - //************************************************************ - - namespace - { - class ImplLineNode - { - public: - sal_Int32 mnYCounter; - float mfXPos; - float mfXDelta; - bool mbDownwards; - - public: - /**rP1 and rP2 must not have equal y values, when rounded - to integer! - */ - ImplLineNode(const B2DPoint& rP1, const B2DPoint& rP2, bool bDown) : - mnYCounter( fround(rP2.getY()) - fround(rP1.getY()) ), - mfXPos( (float)(rP1.getX()) ), - mfXDelta((float) ((rP2.getX() - rP1.getX()) / mnYCounter) ), - mbDownwards( bDown ) - { - } - - /// get current x position - const float& getXPos() const - { - return mfXPos; - } - - /// returns true, if line ends on this Y value - float nextLine() - { - if(mnYCounter>=0) - { - // go one step in Y - mfXPos += mfXDelta; - --mnYCounter; - return mfXDelta; - } - - return 0.0f; - } - - bool isEnded() const - { - return mnYCounter<=0; - } - - bool isDownwards() const - { - return mbDownwards; - } - }; - } - - typedef ::std::vector<ImplLineNode> VectorOfLineNodes; - - - //************************************************************ - // Base2D PolyPolygon Raster Converter (Rasterizer) - //************************************************************ - - namespace - { - struct VertexComparator - { - bool operator()( const B2DPolyPolygonRasterConverter::Vertex& rLHS, - const B2DPolyPolygonRasterConverter::Vertex& rRHS ) - { - return rLHS.aP1.getX() < rRHS.aP1.getX(); - } - }; - } - - void B2DPolyPolygonRasterConverter::init() - { - if(!maPolyPolyRectangle.isEmpty()) - { - const sal_Int32 nMinY( fround(maPolyPolyRectangle.getMinY()) ); - const sal_Int32 nScanlines(fround(maPolyPolyRectangle.getMaxY()) - nMinY); - - maScanlines.resize( nScanlines+1 ); - - // add all polygons - for( sal_uInt32 i(0), nCount(maPolyPolygon.count()); - i < nCount; - ++i ) - { - // add all vertices - const B2DPolygon& rPoly( maPolyPolygon.getB2DPolygon(i) ); - for( sal_uInt32 k(0), nVertices(rPoly.count()); - k<nVertices; - ++k ) - { - const B2DPoint& rP1( rPoly.getB2DPoint(k) ); - const B2DPoint& rP2( rPoly.getB2DPoint( (k + 1) % nVertices ) ); - - const sal_Int32 nVertexYP1( fround(rP1.getY()) ); - const sal_Int32 nVertexYP2( fround(rP2.getY()) ); - - // insert only vertices which are not strictly - // horizontal. Note that the ImplLineNode relies on - // this. - if(nVertexYP1 != nVertexYP2) - { - if( nVertexYP2 < nVertexYP1 ) - { - const sal_Int32 nStartScanline(nVertexYP2 - nMinY); - - // swap edges - maScanlines[ nStartScanline ].push_back( Vertex(rP2, rP1, false) ); - } - else - { - const sal_Int32 nStartScanline(nVertexYP1 - nMinY); - - maScanlines[ nStartScanline ].push_back( Vertex(rP1, rP2, true) ); - } - } - } - } - - // now sort all scanlines, with increasing x coordinates - VectorOfVertexVectors::iterator aIter( maScanlines.begin() ); - VectorOfVertexVectors::iterator aEnd( maScanlines.end() ); - while( aIter != aEnd ) - { - ::std::sort( aIter->begin(), - aIter->end(), - VertexComparator() ); - ++aIter; - } - } - } - - B2DPolyPolygonRasterConverter::B2DPolyPolygonRasterConverter( const B2DPolyPolygon& rPolyPoly ) : - maPolyPolygon( rPolyPoly ), - maPolyPolyRectangle( tools::getRange( rPolyPoly ) ), - maScanlines() - { - init(); - } - - namespace - { - B2DRectangle getCombinedBounds( const B2DPolyPolygon& rPolyPolyRaster, - const B2DRectangle& rRasterArea ) - { - B2DRectangle aRect( tools::getRange( rPolyPolyRaster ) ); - aRect.expand( rRasterArea ); - - return aRect; - } - } - - B2DPolyPolygonRasterConverter::B2DPolyPolygonRasterConverter( const B2DPolyPolygon& rPolyPolyRaster, - const B2DRectangle& rRasterArea ) : - maPolyPolygon( rPolyPolyRaster ), - maPolyPolyRectangle( - getCombinedBounds( rPolyPolyRaster, - rRasterArea ) ), - maScanlines() - { - init(); - } - - B2DPolyPolygonRasterConverter::~B2DPolyPolygonRasterConverter() - { - } - - namespace - { - class LineNodeGenerator - { - public: - LineNodeGenerator( VectorOfLineNodes& rActiveVertices ) : - mrActiveVertices( rActiveVertices ) - { - } - - void operator()( const B2DPolyPolygonRasterConverter::Vertex& rVertex ) - { - mrActiveVertices.push_back( ImplLineNode(rVertex.aP1, - rVertex.aP2, - rVertex.bDownwards) ); - } - - private: - VectorOfLineNodes& mrActiveVertices; - }; - - struct LineNodeComparator - { - bool operator()( const ImplLineNode& rLHS, const ImplLineNode& rRHS ) - { - return rLHS.getXPos() < rRHS.getXPos(); - } - }; - } - - void B2DPolyPolygonRasterConverter::rasterConvert( FillRule eFillRule ) - { - if( maScanlines.empty() ) - return; // no scanlines at all -> bail out - - const sal_Int32 nMinY( fround(maPolyPolyRectangle.getMinY()) ); - const sal_Int32 nScanlines(fround(maPolyPolyRectangle.getMaxY()) - nMinY); - - // Vector of currently active vertices. A vertex is active, if - // it crosses or touches the current scanline. - VectorOfLineNodes aActiveVertices; - - // mickey's optimized version... - radixSort rs; - std::size_t nb(0); - std::size_t nb_previous(0); - bool bSort(false); - - // process each scanline - for( sal_Int32 y(0); y <= nScanlines; ++y ) - { - // add vertices which start at current scanline into - // active vertex vector - ::std::for_each( maScanlines[y].begin(), - maScanlines[y].end(), - LineNodeGenerator( aActiveVertices ) ); - nb = aActiveVertices.size(); - if(nb != nb_previous) - { - nb_previous = nb; - bSort = true; - } - - // sort with increasing X - if(bSort) - { - bSort = false; - - if( nb ) - { - rs.sort(&aActiveVertices[0].mfXPos, - nb, - sizeof(ImplLineNode)); - } - } - - const std::size_t nLen( nb ); - if( !nLen ) - { - // empty scanline - call derived with an 'off' span - // for the full width - span( maPolyPolyRectangle.getMinX(), - maPolyPolyRectangle.getMaxX(), - nMinY + y, - false ); - } - else - { - const sal_Int32 nCurrY( nMinY + y ); - - // scanline not empty - forward all scans to derived, - // according to selected fill rule - - // TODO(P1): Maybe allow these 'off' span calls to be - // switched off (or all 'on' span calls, depending on - // use case scenario) - - // sorting didn't change the order of the elements - // in memory but prepared a list of indices in sorted order. - // thus we now process the nodes with an additional indirection. - sal_uInt32 *sorted = rs.indices(); - - // call derived with 'off' span for everything left of first active span - if( aActiveVertices[sorted[0]].getXPos() > maPolyPolyRectangle.getMinX() ) - { - span( maPolyPolyRectangle.getMinX(), - aActiveVertices[sorted[0]].getXPos(), - nCurrY, - false ); - } - - switch( eFillRule ) - { - default: - OSL_FAIL("B2DPolyPolygonRasterConverter::rasterConvert(): Unexpected fill rule"); - return; - - case FillRule_EVEN_ODD: - // process each span in current scanline, with - // even-odd fill rule - for( ::std::size_t i(0), nLength(aActiveVertices.size()); - i+1 < nLength; - ++i ) - { - sal_uInt32 nIndex = sorted[i]; - sal_uInt32 nNextIndex = sorted[i+1]; - span( aActiveVertices[nIndex].getXPos(), - aActiveVertices[nNextIndex].getXPos(), - nCurrY, - i % 2 == 0 ); - - float delta = aActiveVertices[nIndex].nextLine(); - if(delta > 0.0f) - { - if(aActiveVertices[nIndex].getXPos() > aActiveVertices[nNextIndex].getXPos()) - bSort = true; - } - else if(delta < 0.0f) - { - if(i) - { - sal_uInt32 nPrevIndex = sorted[i-1]; - if(aActiveVertices[nIndex].getXPos() < aActiveVertices[nPrevIndex].getXPos()) - bSort = true; - } - } - } - break; - - case FillRule_NONZERO_WINDING_NUMBER: - // process each span in current scanline, with - // non-zero winding numbe fill rule - sal_Int32 nWindingNumber(0); - for( ::std::size_t i(0), nLength(aActiveVertices.size()); - i+1 < nLength; - ++i ) - { - sal_uInt32 nIndex = sorted[i]; - sal_uInt32 nNextIndex = sorted[i+1]; - nWindingNumber += -1 + 2*aActiveVertices[nIndex].isDownwards(); - - span( aActiveVertices[nIndex].getXPos(), - aActiveVertices[nNextIndex].getXPos(), - nCurrY, - nWindingNumber != 0 ); - - float delta = aActiveVertices[nIndex].nextLine(); - if(delta > 0.0f) - { - if(aActiveVertices[nIndex].getXPos() > aActiveVertices[nNextIndex].getXPos()) - bSort = true; - } - else if(delta < 0.0f) - { - if(i) - { - sal_uInt32 nPrevIndex = sorted[i-1]; - if(aActiveVertices[nIndex].getXPos() < aActiveVertices[nPrevIndex].getXPos()) - bSort = true; - } - } - } - break; - } - - // call derived with 'off' span for everything right of last active span - if( aActiveVertices[sorted[nb-1]].getXPos()+1.0 < maPolyPolyRectangle.getMaxX() ) - { - span( aActiveVertices[sorted[nb-1]].getXPos()+1.0, - maPolyPolyRectangle.getMaxX(), - nCurrY, - false ); - } - - // also call nextLine on very last line node - sal_uInt32 nIndex = sorted[nb-1]; - float delta = aActiveVertices[nIndex].nextLine(); - if(delta < 0.0f) - { - if(nb) - { - sal_uInt32 nPrevIndex = sorted[nb-2]; - if(aActiveVertices[nIndex].getXPos() < aActiveVertices[nPrevIndex].getXPos()) - bSort = true; - } - } - } - - // remove line nodes which have ended on the current scanline - aActiveVertices.erase( ::std::remove_if( aActiveVertices.begin(), - aActiveVertices.end(), - ::boost::mem_fn( &ImplLineNode::isEnded ) ), - aActiveVertices.end() ); - nb = aActiveVertices.size(); - if(nb != nb_previous) - { - nb_previous = nb; - bSort = true; - } - } - } -} -// eof - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx index 660f4396434a..1deede8fc967 100644 --- a/basegfx/source/range/b2drangeclipper.cxx +++ b/basegfx/source/range/b2drangeclipper.cxx @@ -620,9 +620,6 @@ namespace basegfx // right event come last. This is advantageous for the // clip algorithm below, see handleRightEdgeCrossing(). - // TODO(P3): Use radix sort (from - // b2dpolypolygonrasterconverter, or have your own - // templatized version). std::stable_sort( o_rEventVector.begin(), o_rEventVector.end() ); } diff --git a/canvas/source/cairo/cairo_spritehelper.cxx b/canvas/source/cairo/cairo_spritehelper.cxx index 8be1eebcb742..fa09c8772dbb 100644 --- a/canvas/source/cairo/cairo_spritehelper.cxx +++ b/canvas/source/cairo/cairo_spritehelper.cxx @@ -42,7 +42,6 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolypolygonrasterconverter.hxx> #include <basegfx/polygon/b2dpolygontriangulator.hxx> #include <basegfx/polygon/b2dpolygoncutandtouch.hxx> diff --git a/canvas/source/directx/dx_spritehelper.cxx b/canvas/source/directx/dx_spritehelper.cxx index b773cb217802..972fb685d48c 100644 --- a/canvas/source/directx/dx_spritehelper.cxx +++ b/canvas/source/directx/dx_spritehelper.cxx @@ -43,7 +43,6 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolypolygonrasterconverter.hxx> #include <basegfx/polygon/b2dpolygontriangulator.hxx> #include <basegfx/polygon/b2dpolygoncutandtouch.hxx> diff --git a/canvas/source/null/null_spritehelper.cxx b/canvas/source/null/null_spritehelper.cxx index e2eb5fd1427d..be097ace13c3 100644 --- a/canvas/source/null/null_spritehelper.cxx +++ b/canvas/source/null/null_spritehelper.cxx @@ -42,7 +42,6 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolypolygonrasterconverter.hxx> #include <basegfx/polygon/b2dpolygontriangulator.hxx> #include <basegfx/polygon/b2dpolygoncutandtouch.hxx> diff --git a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx index d2fa7c775982..23f98ac513b5 100644 --- a/sd/source/ui/slidesorter/view/SlsButtonBar.cxx +++ b/sd/source/ui/slidesorter/view/SlsButtonBar.cxx @@ -100,26 +100,6 @@ private: namespace { - /** Rectangular button bar that covers the whole width of the preview. - */ - class RectangleBackgroundTheme : public ButtonBar::BackgroundTheme - { - public: - RectangleBackgroundTheme( - const ::boost::shared_ptr<Theme>& rpTheme, - const ::std::vector<SharedButton>& rButtons); - virtual ~RectangleBackgroundTheme() { } - virtual BitmapEx CreateBackground ( - const OutputDevice& rTemplateDevice, - const bool bIsButtonDown) const; - virtual Point GetBackgroundLocation (void); - virtual Rectangle GetButtonArea (void); - protected: - virtual void Layout (void); - private: - sal_Int32 mnBarHeight; - }; - /** Button bar is composed of three images, the left and right end of the bar and the center image. Buttons are only placed over the center image. The center image is painted as is, it is not scaled. @@ -826,123 +806,6 @@ Button::IconSize ButtonBar::BackgroundTheme::GetIconSize (void) const - -//===== RectangleBackgroundTheme ============================================ - -RectangleBackgroundTheme::RectangleBackgroundTheme ( - const ::boost::shared_ptr<Theme>& rpTheme, - const ::std::vector<SharedButton>& rButtons) - : BackgroundTheme(rpTheme, rButtons), - mnBarHeight(0) -{ -} - - - - -BitmapEx RectangleBackgroundTheme::CreateBackground ( - const OutputDevice& rTemplateDevice, - const bool bIsButtonDown) const -{ - OSL_ASSERT(mpTheme); - - // Setup background color. - Color aTopFillColor (mpTheme->GetGradientColor( - Theme::Gradient_ButtonBackground, - Theme::Fill1)); - Color aTopBorderColor (mpTheme->GetGradientColor( - Theme::Gradient_ButtonBackground, - Theme::Border1)); - Color aBottomFillColor (mpTheme->GetGradientColor( - Theme::Gradient_ButtonBackground, - Theme::Fill2)); - Color aBottomBorderColor (mpTheme->GetGradientColor( - Theme::Gradient_ButtonBackground, - Theme::Border2)); - if (bIsButtonDown) - { - aTopFillColor.DecreaseLuminance(50); - aTopBorderColor.DecreaseLuminance(50); - aBottomFillColor.DecreaseLuminance(50); - aBottomBorderColor.DecreaseLuminance(50); - } - - const int nWidth (maPreviewBoundingBox.GetWidth()+2); - const int nHeight (mnBarHeight); - const int nCenter (nHeight / 2); - - VirtualDevice aDevice (rTemplateDevice, 0, 8); - aDevice.SetOutputSizePixel(Size(nWidth,nHeight)); - - // Fill upper and lower half. - aDevice.SetLineColor(); - aDevice.SetFillColor(aTopFillColor); - aDevice.DrawRect(Rectangle(0,0,nWidth-1,nCenter)); - aDevice.SetFillColor(aBottomFillColor); - aDevice.DrawRect(Rectangle(0,nCenter,nWidth-1,nHeight-1)); - - // Draw border. - aDevice.SetFillColor(); - aDevice.SetLineColor(aTopBorderColor); - aDevice.DrawLine(Point(0,nCenter),Point(0,0)); - aDevice.DrawLine(Point(0,0), Point(nWidth-1,0)); - aDevice.DrawLine(Point(nWidth-1,0),Point(nWidth-1,nCenter)); - aDevice.SetLineColor(aBottomBorderColor); - aDevice.DrawLine(Point(0,nCenter),Point(0,nHeight-1)); - aDevice.DrawLine(Point(0,nHeight-1), Point(nWidth-1,nHeight-1)); - aDevice.DrawLine(Point(nWidth-1,nHeight-1),Point(nWidth-1,nCenter)); - - return aDevice.GetBitmapEx(Point(0,0), Size(nWidth,nHeight)); -} - - - - -Point RectangleBackgroundTheme::GetBackgroundLocation (void) -{ - return Point( - maPreviewBoundingBox.Left()-1, - maPreviewBoundingBox.Bottom() - mnBarHeight + 2); -} - - - - -Rectangle RectangleBackgroundTheme::GetButtonArea (void) -{ - return Rectangle( - maPreviewBoundingBox.Left(), - maPreviewBoundingBox.Bottom() - mnBarHeight + 2, - maPreviewBoundingBox.Right(), - maPreviewBoundingBox.Bottom()); -} - - - - -void RectangleBackgroundTheme::Layout (void) -{ - if (maPreviewBoundingBox.GetWidth() < maMinimumLargeButtonAreaSize.Width()) - if (maPreviewBoundingBox.GetWidth() < maMinimumMediumButtonAreaSize.Width()) - { - meIconSize = Button::IconSize_Small; - mnBarHeight = maMinimumSmallButtonAreaSize.Height(); - } - else - { - meIconSize = Button::IconSize_Medium; - mnBarHeight = maMinimumMediumButtonAreaSize.Height(); - } - else - { - meIconSize = Button::IconSize_Large; - mnBarHeight = maMinimumLargeButtonAreaSize.Height(); - } -} - - - - //===== BitmapBackgroundTheme ================================================= BitmapBackgroundTheme::BitmapBackgroundTheme ( diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx index d6a50f596f89..3a4b5f6b3b77 100644 --- a/sdext/source/presenter/PresenterController.cxx +++ b/sdext/source/presenter/PresenterController.cxx @@ -38,7 +38,6 @@ #include "PresenterScreen.hxx" #include "PresenterNotesView.hxx" #include "PresenterPaintManager.hxx" -#include "PresenterPaneAnimator.hxx" #include "PresenterPaneBase.hxx" #include "PresenterPaneContainer.hxx" #include "PresenterPaneBorderPainter.hxx" @@ -121,7 +120,6 @@ PresenterController::PresenterController ( mxCurrentSlide(), mxNextSlide(), mpWindowManager(new PresenterWindowManager(rxContext,mpPaneContainer,this)), - mpCurrentPaneAnimation(), mnWindowBackgroundColor(0x00ffffff), mpTheme(), mxMainWindow(), @@ -260,7 +258,6 @@ void PresenterController::disposing (void) mnCurrentSlideIndex = -1; mxCurrentSlide = NULL; mxNextSlide = NULL; - mpCurrentPaneAnimation.reset(); mpTheme.reset(); { Reference<lang::XComponent> xComponent ( @@ -576,19 +573,6 @@ Reference<drawing::XPresenterHelper> PresenterController::GetPresenterHelper (vo - -void PresenterController::HideSlideSorter (void) -{ - if (mpCurrentPaneAnimation.get() != NULL) - { - mpCurrentPaneAnimation->HidePane(); - mpCurrentPaneAnimation.reset(); - } -} - - - - void PresenterController::ShowView (const OUString& rsViewURL) { PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( diff --git a/sdext/source/presenter/PresenterPaneAnimator.cxx b/sdext/source/presenter/PresenterPaneAnimator.cxx deleted file mode 100644 index e42923cd3473..000000000000 --- a/sdext/source/presenter/PresenterPaneAnimator.cxx +++ /dev/null @@ -1,1376 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "PresenterPaneAnimator.hxx" - -#include "PresenterAnimation.hxx" -#include "PresenterAnimator.hxx" -#include "PresenterCanvasHelper.hxx" -#include "PresenterController.hxx" -#include "PresenterGeometryHelper.hxx" -#include "PresenterPaintManager.hxx" -#include "PresenterPaneContainer.hxx" -#include "PresenterPaneFactory.hxx" -#include "PresenterSprite.hxx" -#include "PresenterSpritePane.hxx" -#include "PresenterWindowManager.hxx" - -#include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/awt/XWindowPeer.hpp> -#include <com/sun/star/rendering/CompositeOperation.hpp> -#include <boost/bind.hpp> -#include <boost/bind/protect.hpp> -#include <boost/enable_shared_from_this.hpp> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::drawing::framework; -using ::rtl::OUString; -using ::std::vector; - -namespace sdext { namespace presenter { - -namespace { - - class PaneGroup; - - class PresenterPaneAnimatorBase - : public ::boost::enable_shared_from_this<PresenterPaneAnimatorBase>, - public PresenterPaneAnimator - { - public: - PresenterPaneAnimatorBase ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rEndEndActions); - virtual ~PresenterPaneAnimatorBase (void); - - typedef ::std::vector< ::boost::function<void()> > EndOperators; - - void ActivatePanes (void); - void ActivatePane ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId); - void RestoreFrozenWindows (void); - void FreezePanes (const Reference<rendering::XSpriteCanvas>& rxCanvas); - - protected: - ::rtl::Reference<PresenterController> mpPresenterController; - ::rtl::Reference<PresenterPaneContainer> mpPaneContainer; - ::rtl::Reference<PresenterWindowManager> mpWindowManager; - ::std::vector< ::boost::shared_ptr<PaneGroup> > maPaneGroups; - css::uno::Reference<css::drawing::framework::XResourceId> mxCenterPaneId; - bool mbDoAnimation; - EndActions maShowEndActions; - EndActions maHideEndActions; - - void DeactivatePanes (void); - void ResizePane ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const geometry::RealRectangle2D& rBox); - void DeactivatePane ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId); - }; - - - class UnfoldInCenterAnimator : public PresenterPaneAnimatorBase - { - public: - UnfoldInCenterAnimator ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rEndEndActions); - - virtual ~UnfoldInCenterAnimator (void); - - virtual void ShowPane (void); - - virtual void HidePane (void); - - private: - geometry::RealRectangle2D maCenterPaneBox; - - void SetupPaneGroups (void); - geometry::RealRectangle2D MovePanesAway ( - const css::geometry::RealRectangle2D& rFreeCenterArea); - }; - - - class MoveInFromBottomAnimator : public PresenterPaneAnimatorBase - { - public: - MoveInFromBottomAnimator( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rEndEndActions); - virtual ~MoveInFromBottomAnimator (void); - - virtual void ShowPane (void); - virtual void HidePane (void); - - private: - ::boost::shared_ptr<PresenterSprite> maNewPaneSprite; - geometry::RealRectangle2D maCenterPaneBox; - - void CreateShowAnimation ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const EndOperators& rpEndOperators, - const css::uno::Reference<css::rendering::XSpriteCanvas>& rxSpriteCanvas, - const bool bAnimate, - const css::geometry::RealPoint2D& rStartLocation, - const css::geometry::RealPoint2D& rEndLocation); - }; - - - class TransparentOverlayAnimator : public PresenterPaneAnimatorBase - { - public: - TransparentOverlayAnimator( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rEndEndActions); - virtual ~TransparentOverlayAnimator (void); - - virtual void ShowPane (void); - virtual void HidePane (void); - - private: - PresenterSprite maBackgroundSprite; - void CreateBackgroundSprite (void); - }; - - - class PaneDescriptor - { - public: - PresenterPaneContainer::SharedPaneDescriptor mpPaneDescriptor; - - PaneDescriptor (const PresenterPaneContainer::SharedPaneDescriptor& rpDescriptor); - void Restore (void) const; - private: - double mnLeft; - double mnTop; - double mnRight; - double mnBottom; - }; - - class MultiAnimation : public PresenterAnimation - { - public: - typedef ::boost::function<void(double)> Animation; - MultiAnimation (const sal_uInt32 nDuration); - void AddAnimation (const Animation& rAnimation); - virtual void Run (const double nProgress, const sal_uInt64 nCurrentTime); - private: - vector<Animation> maAnimations; - }; - - - class PaneGroup - { - public: - PaneGroup (void); - ~PaneGroup (void); - void AddPane (const PresenterPaneContainer::SharedPaneDescriptor& rpPane); - void CreateSubstitution (const Reference<rendering::XSpriteCanvas>& rxCanvas); - void ThawPanes (void); - void Restore (void); - ::boost::shared_ptr<PresenterSprite> GetSubstitution (void) const; - css::geometry::RealRectangle2D GetOriginalBoundingBox (void) const; - css::geometry::RealRectangle2D GetCurrentBoundingBox (void) const; - void MovePanes ( - const double nXOffset, - const double nYOffset, - const ::rtl::Reference<PresenterWindowManager>& rpWindowManager); - void ActivatePanes (void); - void DeactivatePanes (void); - void HidePanes (void); - void ShowPanes (void); - - private: - vector<PaneDescriptor> maPanes; - awt::Rectangle maOriginalBoundingBox; - css::geometry::RealRectangle2D maCurrentBoundingBox; - ::boost::shared_ptr<PresenterSprite> mpSubstitution; - - }; - typedef ::boost::shared_ptr<PaneGroup> SharedPaneGroup; - - void InterpolatePosition ( - const ::boost::function<void(geometry::RealPoint2D)>& rSetter, - double nP, - const geometry::RealPoint2D rInitialBox, - const geometry::RealPoint2D rFinalBox); - - template<typename T> - void InterpolateValue ( - const ::boost::function<void(T)>& rSetter, - double nP, - const T aInitialValue, - const T aFinalValue); - - void SpriteTransform( - const rtl::Reference<PresenterPaneContainer>& rpPaneContainer, - const Reference<XResourceId>& rxPaneId, - const Reference<awt::XWindow>& rxSpriteOwnerWindow, - const ::boost::shared_ptr<PresenterPaintManager>& rpPaintManager, - const bool bAppear, - const double nX, - const double nInitialTop, - const double nFinalTop, - const double nP); - - void SpritePaneMove ( - const rtl::Reference<PresenterPaneContainer>& rpPaneContainer, - const Reference<XResourceId>& rxPaneId, - const geometry::RealPoint2D& rLocation); - - geometry::RealPoint2D GetLocation (const geometry::RealRectangle2D& rBox); - geometry::RealSize2D GetSize (const geometry::RealRectangle2D& rBox); - - -} // end of anonymous namespace - - - - -//===== PresenterPaneAnimator ================================================= - -namespace { - -PresenterPaneAnimatorBase::PresenterPaneAnimatorBase ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rHideEndActions) - : mpPresenterController(rpPresenterController), - mpPaneContainer(rpPresenterController->GetPaneContainer()), - mpWindowManager(rpPresenterController->GetWindowManager()), - maPaneGroups(), - mxCenterPaneId(rxPaneId), - mbDoAnimation(bAnimate), - maShowEndActions(rShowEndActions), - maHideEndActions(rHideEndActions) -{ -} - - - - -PresenterPaneAnimatorBase::~PresenterPaneAnimatorBase (void) -{ -} - - - - -void PresenterPaneAnimatorBase::FreezePanes (const Reference<rendering::XSpriteCanvas>& rxCanvas) -{ - ::std::vector<SharedPaneGroup>::const_iterator iGroup; - for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup) - { - (*iGroup)->CreateSubstitution(rxCanvas); - (*iGroup)->GetSubstitution()->MoveTo(GetLocation((*iGroup)->GetOriginalBoundingBox())); - } -} - - - - -void PresenterPaneAnimatorBase::ActivatePanes (void) -{ - ActivatePane(mxCenterPaneId); - - ::std::vector<SharedPaneGroup>::const_iterator iGroup; - for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup) - { - (*iGroup)->ShowPanes(); - (*iGroup)->ActivatePanes(); - (*iGroup)->GetSubstitution()->Hide(); - } - - mpWindowManager->Update(); -} - - - - -void PresenterPaneAnimatorBase::DeactivatePanes (void) -{ - ::std::vector<SharedPaneGroup>::const_iterator iGroup; - for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup) - { - (*iGroup)->GetSubstitution()->Show(); - (*iGroup)->DeactivatePanes(); - (*iGroup)->HidePanes(); - } - - mpWindowManager->Update(); -} - - - - -void PresenterPaneAnimatorBase::ResizePane ( - const Reference<drawing::framework::XResourceId>& rxPaneId, - const geometry::RealRectangle2D& rBox) -{ - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - mpPaneContainer->FindPaneId(rxPaneId)); - if (pDescriptor.get() != NULL) - { - mpWindowManager->SetPanePosSizeAbsolute ( - rxPaneId->getResourceURL(), - rBox.X1, - rBox.Y1, - rBox.X2-rBox.X1, - rBox.Y2-rBox.Y1); - mpWindowManager->Layout(); - if ( ! pDescriptor->maSpriteProvider.empty()) - { - pDescriptor->maSpriteProvider()->Resize(GetSize(rBox)); - } - } -} - - - - -void PresenterPaneAnimatorBase::RestoreFrozenWindows (void) -{ - ::std::vector<SharedPaneGroup>::const_iterator iGroup; - for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup) - { - (*iGroup)->Restore(); - (*iGroup)->ShowPanes(); - (*iGroup)->ActivatePanes(); - (*iGroup)->GetSubstitution()->Hide(); - } - maPaneGroups.clear(); - - ActivatePane(mxCenterPaneId); - - mpWindowManager->Update(); -} - - - - -void PresenterPaneAnimatorBase::ActivatePane ( - const Reference<drawing::framework::XResourceId>& rxPaneId) -{ - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - mpPaneContainer->FindPaneId(rxPaneId)); - if (pDescriptor.get() != NULL) - pDescriptor->SetActivationState(true); -} - - - - -void PresenterPaneAnimatorBase::DeactivatePane ( - const Reference<drawing::framework::XResourceId>& rxPaneId) -{ - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - mpPaneContainer->FindPaneId(rxPaneId)); - if (pDescriptor.get() != NULL) - pDescriptor->SetActivationState(false); -} - - - - -//===== UnfoldInCenterAnimator ================================================ - -UnfoldInCenterAnimator::UnfoldInCenterAnimator ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rEndEndActions) - : PresenterPaneAnimatorBase(rxPaneId, rpPresenterController, bAnimate, - rShowEndActions, rEndEndActions) -{ -} - - - - -UnfoldInCenterAnimator::~UnfoldInCenterAnimator (void) -{ -} - - - - -void UnfoldInCenterAnimator::ShowPane (void) -{ - OSL_ASSERT(mpWindowManager.get()!=NULL); - - Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY); - if ( ! xParentWindow.is()) - return; - - Reference<rendering::XSpriteCanvas> xCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY); - if ( ! xCanvas.is()) - return; - - Reference<rendering::XBitmap> xParentBitmap (xCanvas, UNO_QUERY); - if ( ! xParentBitmap.is()) - return; - - Reference<rendering::XGraphicDevice> xDevice(xCanvas->getDevice()); - if ( ! xDevice.is()) - return; - - awt::Rectangle aWindowBox (xParentWindow->getPosSize()); - - // Create two pane groups that will be moved together. One contains the - // notes view, the other group contains all other panes. - SetupPaneGroups(); - - // Setup the places where the two pane groups are moved to. - maCenterPaneBox - = MovePanesAway(geometry::RealRectangle2D(0,200,aWindowBox.Width, aWindowBox.Height-200)); - - // Setup the final size of the new pane so that it fits into the space - // between the two pane groups. - ResizePane(mxCenterPaneId, maCenterPaneBox); - - // Avoid that the center pane updates its previews while being animated. - DeactivatePane(mxCenterPaneId); - - // Replace the pane groups with sprites that look like the panes but can - // be moved around much faster. - FreezePanes(xCanvas); - - // The vertical center of the new pane. - const double nY0 ((maPaneGroups[0]->GetOriginalBoundingBox().Y2 - + maPaneGroups[1]->GetOriginalBoundingBox().Y1) / 2); - - // Make sure that the new pane is painted once before the animation starts. - SpriteTransform( - mpPaneContainer, - mxCenterPaneId, - xParentWindow, - mpPresenterController->GetPaintManager(), - true, - maCenterPaneBox.X1, - nY0, - maCenterPaneBox.Y1, - 0); - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - mpPaneContainer->FindPaneId(mxCenterPaneId)); - if (pDescriptor.get() != NULL) - { - mpPresenterController->GetPaintManager()->Invalidate( - pDescriptor->mxBorderWindow, - true); - } - - // Animate the upper and lower window bitmaps. - ::boost::shared_ptr<MultiAnimation> pMultiAnimation ( - new MultiAnimation(mbDoAnimation ? 500 : 0)); - - // Animate the pane group sprites to be moved up or down. - vector<SharedPaneGroup>::const_iterator iGroup; - for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup) - { - pMultiAnimation->AddAnimation( - ::boost::bind( - InterpolatePosition, - ::boost::protect(::boost::bind( - &PresenterSprite::MoveTo, (*iGroup)->GetSubstitution(), _1)), - _1, - GetLocation((*iGroup)->GetOriginalBoundingBox()), - GetLocation((*iGroup)->GetCurrentBoundingBox()))); - } - - // Animate the new center pane to expand. - pMultiAnimation->AddAnimation( - ::boost::bind( - SpriteTransform, - mpPaneContainer, - mxCenterPaneId, - xParentWindow, - mpPresenterController->GetPaintManager(), - true, - maCenterPaneBox.X1, - nY0, - maCenterPaneBox.Y1, - _1)); - - // Call updateScreen after each animation step. - if (xCanvas.is()) - pMultiAnimation->AddAnimation( - ::boost::bind(&rendering::XSpriteCanvas::updateScreen, xCanvas, sal_False)); - - // Activate the panes when the animation is over. - pMultiAnimation->AddEndCallback( - ::boost::bind(&PresenterPaneAnimatorBase::ActivatePanes, shared_from_this())); - EndActions::const_iterator iAction; - for (iAction=maShowEndActions.begin(); iAction!=maShowEndActions.end(); ++iAction) - pMultiAnimation->AddEndCallback(*iAction); - - // Start the animation. - ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator()); - OSL_ASSERT(pAnimator.get()!=NULL); - pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation)); - - mpWindowManager->Update(); -} - - - - -void UnfoldInCenterAnimator::HidePane (void) -{ - OSL_ASSERT(mpWindowManager.get()!=NULL); - - Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY); - if ( ! xParentWindow.is()) - return; - - DeactivatePanes(); - DeactivatePane(mxCenterPaneId); - - ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator()); - const awt::Rectangle aWindowBox (xParentWindow->getPosSize()); - const rendering::ViewState aViewState ( - geometry::AffineMatrix2D(1,0,0, 0,1,0), - NULL); - const rendering::RenderState aRenderState ( - geometry::AffineMatrix2D(1,0,0, 0,1,0), - NULL, - Sequence<double>(4), - rendering::CompositeOperation::SOURCE); - - // Animate the uppder and lower window bitmaps. - Reference<rendering::XSpriteCanvas> xSpriteCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY); - ::boost::shared_ptr<MultiAnimation> pMultiAnimation (new MultiAnimation(mbDoAnimation ? 500 : 1)); - - vector<SharedPaneGroup>::const_iterator iGroup; - for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup) - { - pMultiAnimation->AddAnimation( - ::boost::bind( - InterpolatePosition, - ::boost::protect(::boost::bind( - &PresenterSprite::MoveTo, (*iGroup)->GetSubstitution(), _1)), - _1, - GetLocation((*iGroup)->GetCurrentBoundingBox()), - GetLocation((*iGroup)->GetOriginalBoundingBox()))); - } - - // Animate the new center pane to collapse. - const double nY0 ((maPaneGroups[0]->GetOriginalBoundingBox().Y2 - + maPaneGroups[1]->GetOriginalBoundingBox().Y1) / 2); - pMultiAnimation->AddAnimation( - ::boost::bind( - SpriteTransform, - mpPaneContainer, - mxCenterPaneId, - xParentWindow, - mpPresenterController->GetPaintManager(), - false, - maCenterPaneBox.X1, - nY0, - maCenterPaneBox.Y1, - _1)); - - if (mbDoAnimation) - { - pMultiAnimation->AddAnimation( - ::boost::bind(&rendering::XSpriteCanvas::updateScreen, xSpriteCanvas, sal_False)); - } - pMultiAnimation->AddEndCallback( - ::boost::bind(&PresenterPaneAnimatorBase::RestoreFrozenWindows, shared_from_this())); - EndActions::const_iterator iAction; - for (iAction=maHideEndActions.begin(); iAction!=maHideEndActions.end(); ++iAction) - pMultiAnimation->AddEndCallback(*iAction); - - pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation)); -} - - - - -void UnfoldInCenterAnimator::SetupPaneGroups (void) -{ - maPaneGroups.clear(); - - // Setup the upper pane group. - SharedPaneGroup pUpperPanes (new PaneGroup()); - pUpperPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); - pUpperPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msNextSlidePreviewPaneURL)); - pUpperPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msToolBarPaneURL)); - pUpperPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msHelpPaneURL)); - maPaneGroups.push_back(pUpperPanes); - - // Setup the lower pane group. - SharedPaneGroup pLowerPanes (new PaneGroup()); - pLowerPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msNotesPaneURL)); - maPaneGroups.push_back(pLowerPanes); -} - - - - -geometry::RealRectangle2D UnfoldInCenterAnimator::MovePanesAway ( - const geometry::RealRectangle2D& rFreeCenterArea) -{ - SharedPaneGroup aUpperPanes = maPaneGroups[0]; - SharedPaneGroup aLowerPanes = maPaneGroups[1]; - - // Move upper pane group out of the way. - const double nTop (rFreeCenterArea.Y1); - const double nUpperVerticalOffset (nTop - aUpperPanes->GetOriginalBoundingBox().Y2); - aUpperPanes->MovePanes(0, nUpperVerticalOffset, mpWindowManager); - - // Move lower pane group out of the way. - const double nBottom (rFreeCenterArea.Y2); - const double nLowerVerticalOffset (nBottom - aLowerPanes->GetOriginalBoundingBox().Y1); - aLowerPanes->MovePanes(0, nLowerVerticalOffset, mpWindowManager); - - return geometry::RealRectangle2D( - ::std::min( - aUpperPanes->GetOriginalBoundingBox().X1, - aLowerPanes->GetOriginalBoundingBox().X1), - nTop+20, - ::std::max( - aUpperPanes->GetOriginalBoundingBox().X2, - aLowerPanes->GetOriginalBoundingBox().X2), - nBottom-20); -} - - - - -//===== MoveInFromBottomAnimator ============================================== - -MoveInFromBottomAnimator::MoveInFromBottomAnimator ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rEndEndActions) - : PresenterPaneAnimatorBase(rxPaneId, rpPresenterController, bAnimate, - rShowEndActions, rEndEndActions), - maNewPaneSprite() -{ -} - - - - -MoveInFromBottomAnimator::~MoveInFromBottomAnimator (void) -{ -} - - - - -void MoveInFromBottomAnimator::ShowPane (void) -{ - OSL_ASSERT(mpWindowManager.get()!=NULL); - - Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY); - if ( ! xParentWindow.is()) - return; - - Reference<rendering::XSpriteCanvas> xCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY); - if ( ! xCanvas.is()) - return; - - Reference<rendering::XBitmap> xParentBitmap (xCanvas, UNO_QUERY); - if ( ! xParentBitmap.is()) - return; - - Reference<rendering::XGraphicDevice> xDevice(xCanvas->getDevice()); - if ( ! xDevice.is()) - return; - - awt::Rectangle aWindowBox (xParentWindow->getPosSize()); - - // Create a pane group that just contains the notes view. - SharedPaneGroup pLowerPanes (new PaneGroup()); - pLowerPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msNotesPaneURL)); - maPaneGroups.push_back(pLowerPanes); - - // Deactivate the panes that will take place in the animation. - pLowerPanes->DeactivatePanes(); - DeactivatePane(mxCenterPaneId); - - // Set the size of the new pane. - maCenterPaneBox = pLowerPanes->GetOriginalBoundingBox(); - ResizePane(mxCenterPaneId, maCenterPaneBox); - - geometry::RealPoint2D aStartLocation (maCenterPaneBox.X1, aWindowBox.Height); - geometry::RealPoint2D aEndLocation (maCenterPaneBox.X1, maCenterPaneBox.Y1); - - // Get the sprite of the new pane, make it visible and move it to the - // start location. - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - mpPaneContainer->FindPaneId(mxCenterPaneId)); - if (pDescriptor.get() != NULL) - { - if (pDescriptor->mxBorderWindow.is()) - pDescriptor->mxBorderWindow->setVisible(sal_True); - - maNewPaneSprite = pDescriptor->maSpriteProvider(); - if (maNewPaneSprite.get() != NULL) - { - maNewPaneSprite->MoveTo(aStartLocation); - maNewPaneSprite->Show(); - } - xCanvas->updateScreen(sal_False); - } - - CreateShowAnimation( - mxCenterPaneId, - maShowEndActions, - xCanvas, - mbDoAnimation, - aStartLocation, - aEndLocation); - - mpWindowManager->Update(); -} - - - - -void MoveInFromBottomAnimator::HidePane (void) -{ - OSL_ASSERT(mpWindowManager.get()!=NULL); - - Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY); - if ( ! xParentWindow.is()) - return; - - Reference<rendering::XSpriteCanvas> xCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY); - if ( ! xCanvas.is()) - return; - - DeactivatePanes(); - DeactivatePane(mxCenterPaneId); - - SharedPaneGroup aPanes (maPaneGroups[0]); - - aPanes->ShowPanes(); - - ::boost::shared_ptr<MultiAnimation> pMultiAnimation ( - new MultiAnimation(mbDoAnimation ? 500 : 0)); - awt::Rectangle aWindowBox (xParentWindow->getPosSize()); - - // Animate the new center pane to collapse. - pMultiAnimation->AddAnimation( - ::boost::bind( - InterpolatePosition, - ::boost::protect(::boost::bind(&SpritePaneMove, mpPaneContainer, mxCenterPaneId, _1)), - _1, - geometry::RealPoint2D(maCenterPaneBox.X1, maCenterPaneBox.Y1), - geometry::RealPoint2D(maCenterPaneBox.X1, aWindowBox.Height))); - - if (mbDoAnimation) - { - pMultiAnimation->AddAnimation( - ::boost::bind(&rendering::XSpriteCanvas::updateScreen, xCanvas, sal_False)); - } - pMultiAnimation->AddEndCallback( - ::boost::bind(&PresenterPaneAnimatorBase::RestoreFrozenWindows, shared_from_this())); - EndActions::const_iterator iAction; - for (iAction=maHideEndActions.begin(); iAction!=maHideEndActions.end(); ++iAction) - pMultiAnimation->AddEndCallback(*iAction); - - ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator()); - pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation)); -} - - - - -void MoveInFromBottomAnimator::CreateShowAnimation ( - const Reference<drawing::framework::XResourceId>& rxPaneId, - const EndOperators& rEndOperators, - const Reference<rendering::XSpriteCanvas>& rxSpriteCanvas, - const bool bAnimate, - const geometry::RealPoint2D& rStartLocation, - const geometry::RealPoint2D& rEndLocation) -{ - // Animate the uppder and lower window bitmaps. - ::boost::shared_ptr<MultiAnimation> pMultiAnimation (new MultiAnimation(bAnimate ? 500 : 0)); - - // Animate new pane to move in from the buttom. - pMultiAnimation->AddAnimation( - ::boost::bind( - InterpolatePosition, - ::boost::protect(::boost::bind(&SpritePaneMove, mpPaneContainer, rxPaneId, _1)), - _1, - rStartLocation, - rEndLocation)); - - // Call updateScreen after each animation step. - if (rxSpriteCanvas.is()) - pMultiAnimation->AddAnimation( - ::boost::bind(&rendering::XSpriteCanvas::updateScreen, rxSpriteCanvas, sal_False)); - - // Activate the panes when the animation is over. - pMultiAnimation->AddEndCallback( - ::boost::bind(&PaneGroup::HidePanes, maPaneGroups[0])); - pMultiAnimation->AddEndCallback( - ::boost::bind(&PresenterPaneAnimatorBase::ActivatePane, shared_from_this(), mxCenterPaneId)); - EndActions::const_iterator iAction; - for (iAction=rEndOperators.begin(); iAction!=rEndOperators.end(); ++iAction) - pMultiAnimation->AddEndCallback(*iAction); - - // Start the animation. - ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator()); - OSL_ASSERT(pAnimator.get()!=NULL); - pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation)); -} - - - - - -//===== TransparentOverlayAnimator ============================================ - -TransparentOverlayAnimator::TransparentOverlayAnimator ( - const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const ::rtl::Reference<PresenterController>& rpPresenterController, - const bool bAnimate, - const EndActions& rShowEndActions, - const EndActions& rEndEndActions) - : PresenterPaneAnimatorBase( - rxPaneId, - rpPresenterController, - bAnimate, - rShowEndActions, - rEndEndActions), - maBackgroundSprite() -{ -} - - - - -TransparentOverlayAnimator::~TransparentOverlayAnimator (void) -{ -} - - - - -void TransparentOverlayAnimator::ShowPane (void) -{ - EndActions::const_iterator iAction; - for (iAction=maShowEndActions.begin(); iAction!=maShowEndActions.end(); ++iAction) - (*iAction)(); - - CreateBackgroundSprite(); - - Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY); - if (xParentWindow.is()) - { - const awt::Rectangle aWindowBox (xParentWindow->getPosSize()); - SharedPaneGroup pAllPanes (new PaneGroup()); - pAllPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); - pAllPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msNextSlidePreviewPaneURL)); - pAllPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msToolBarPaneURL)); - pAllPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msHelpPaneURL)); - pAllPanes->AddPane(mpPaneContainer->FindPaneURL( - PresenterPaneFactory::msNotesPaneURL)); - maPaneGroups.push_back(pAllPanes); - pAllPanes->DeactivatePanes(); - mpWindowManager->Update(); - } - - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - mpPaneContainer->FindPaneId(mxCenterPaneId)); - if (pDescriptor.get() != NULL) - { - PresenterSpritePane* pPane = dynamic_cast<PresenterSpritePane*>( - pDescriptor->mxPane.get()); - if (pPane != NULL) - pPane->ShowTransparentBorder(); - - pDescriptor->SetActivationState(true); - if (pDescriptor->mxBorderWindow.is()) - pDescriptor->mxBorderWindow->setVisible(sal_True); - } -} - - - - -void TransparentOverlayAnimator::HidePane (void) -{ - maPaneGroups[0]->ActivatePanes(); - EndActions::const_iterator iAction; - for (iAction=maHideEndActions.begin(); iAction!=maHideEndActions.end(); ++iAction) - (*iAction)(); - mpWindowManager->Update(); -} - - - - -void TransparentOverlayAnimator::CreateBackgroundSprite (void) -{ - Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY); - Reference<rendering::XSpriteCanvas> xParentCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY); - if (xParentWindow.is() && xParentCanvas.is()) - { - const awt::Rectangle aWindowBox (xParentWindow->getPosSize()); - maBackgroundSprite.SetFactory(xParentCanvas); - maBackgroundSprite.Resize( - geometry::RealSize2D(aWindowBox.Width, aWindowBox.Height)); - maBackgroundSprite.MoveTo( - geometry::RealPoint2D(aWindowBox.X, aWindowBox.Y)); - maBackgroundSprite.SetAlpha(0.5); - maBackgroundSprite.Show(); - - Reference<rendering::XCanvas> xCanvas (maBackgroundSprite.GetCanvas()); - - if (xCanvas.is()) - { - rendering::ViewState aViewState( - geometry::AffineMatrix2D(1,0,0, 0,1,0), - NULL); - - rendering::RenderState aRenderState( - geometry::AffineMatrix2D(1,0,0, 0,1,0), - NULL, - Sequence<double>(4), - rendering::CompositeOperation::SOURCE); - PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x80808080)); - - Reference<rendering::XPolyPolygon2D> xPolygon ( - PresenterGeometryHelper::CreatePolygon(aWindowBox, xCanvas->getDevice())); - if (xPolygon.is()) - xCanvas->fillPolyPolygon( - xPolygon, - aViewState, - aRenderState); - } - } -} - - - - -//===== PaneGroup ============================================================= - -PaneGroup::PaneGroup (void) - : maPanes(), - maOriginalBoundingBox(), - maCurrentBoundingBox(), - mpSubstitution(new PresenterSprite()) -{ -} - - - - -PaneGroup::~PaneGroup (void) -{ - mpSubstitution.reset(); -} - - - - -void PaneGroup::AddPane (const PresenterPaneContainer::SharedPaneDescriptor& rpPane) -{ - OSL_ASSERT(rpPane.get() != NULL); - - if (rpPane->mxBorderWindow.is()) - { - PaneDescriptor aDescriptor (rpPane); - maPanes.push_back(aDescriptor); - maOriginalBoundingBox = PresenterGeometryHelper::Union( - maOriginalBoundingBox, - rpPane->mxBorderWindow->getPosSize()); - } -} - - - - -void PaneGroup::CreateSubstitution (const Reference<rendering::XSpriteCanvas>& rxCanvas) -{ - // Get the bitmap of the background. - Reference<rendering::XBitmap> xBackgroundBitmap (rxCanvas, UNO_QUERY); - if ( ! xBackgroundBitmap.is()) - return; - - // Create the sprite. - mpSubstitution->SetFactory(rxCanvas); - mpSubstitution->Resize( - geometry::RealSize2D(maOriginalBoundingBox.Width, maOriginalBoundingBox.Height)); - - // Fill it with the background inside the bounding box. - const rendering::ViewState aViewState ( - geometry::AffineMatrix2D(1,0,0, 0,1,0), - NULL); - const rendering::RenderState aRenderState ( - geometry::AffineMatrix2D(1,0,-maOriginalBoundingBox.X, 0,1,-maOriginalBoundingBox.Y), - NULL, - Sequence<double>(4), - rendering::CompositeOperation::SOURCE); - - Reference<rendering::XCanvas> xSpriteCanvas (mpSubstitution->GetCanvas()); - if (xSpriteCanvas.is()) - xSpriteCanvas->drawBitmap(xBackgroundBitmap, aViewState, aRenderState); -} - - - - -void PaneGroup::Restore (void) -{ - vector<PaneDescriptor>::iterator iPane; - for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane) - { - iPane->Restore(); - } -} - - - -::boost::shared_ptr<PresenterSprite> PaneGroup::GetSubstitution (void) const -{ - return mpSubstitution; -} - - - - -geometry::RealRectangle2D PaneGroup::GetOriginalBoundingBox (void) const -{ - return geometry::RealRectangle2D( - maOriginalBoundingBox.X, - maOriginalBoundingBox.Y, - maOriginalBoundingBox.X + maOriginalBoundingBox.Width, - maOriginalBoundingBox.Y + maOriginalBoundingBox.Height); -} - - - - -geometry::RealRectangle2D PaneGroup::GetCurrentBoundingBox (void) const -{ - return maCurrentBoundingBox; -} - - - - -void PaneGroup::MovePanes ( - const double nXOffset, - const double nYOffset, - const ::rtl::Reference<PresenterWindowManager>& rpWindowManager - ) -{ - awt::Rectangle aBBox; - vector<PaneDescriptor>::iterator iPane; - for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane) - { - awt::Rectangle aBox (iPane->mpPaneDescriptor->mxBorderWindow->getPosSize()); - aBox.X += sal_Int32(nXOffset); - aBox.Y += sal_Int32(nYOffset); - rpWindowManager->SetPanePosSizeAbsolute( - iPane->mpPaneDescriptor->mxPaneId->getResourceURL(), - aBox.X, - aBox.Y, - aBox.Width, - aBox.Height); - aBBox = PresenterGeometryHelper::Union(aBBox, aBox); - } - maCurrentBoundingBox = geometry::RealRectangle2D( - aBBox.X, aBBox.Y, aBBox.X+aBBox.Width, aBBox.Y+aBBox.Height); -} - - - - -void PaneGroup::ActivatePanes (void) -{ - vector<PaneDescriptor>::iterator iPane; - for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane) - { - iPane->mpPaneDescriptor->SetActivationState(true); - } -} - - - - -void PaneGroup::DeactivatePanes (void) -{ - vector<PaneDescriptor>::iterator iPane; - for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane) - { - iPane->mpPaneDescriptor->SetActivationState(false); - } -} - - - - -void PaneGroup::ShowPanes (void) -{ - vector<PaneDescriptor>::iterator iPane; - for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane) - { - iPane->mpPaneDescriptor->mxBorderWindow->setVisible(sal_True); - iPane->mpPaneDescriptor->mxContentWindow->setVisible(sal_True); - } -} - - - - -void PaneGroup::HidePanes (void) -{ - vector<PaneDescriptor>::iterator iPane; - for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane) - { - iPane->mpPaneDescriptor->mxBorderWindow->setVisible(sal_False); - iPane->mpPaneDescriptor->mxContentWindow->setVisible(sal_False); - } -} - - - - -//===== PaneDescriptor ======================================================== - -PaneDescriptor::PaneDescriptor (const PresenterPaneContainer::SharedPaneDescriptor& rpDescriptor) - : mpPaneDescriptor(rpDescriptor), - mnLeft(rpDescriptor->mnLeft), - mnTop(rpDescriptor->mnTop), - mnRight(rpDescriptor->mnRight), - mnBottom(rpDescriptor->mnBottom) -{ -} - - - - -void PaneDescriptor::Restore (void) const -{ - mpPaneDescriptor->mnLeft = mnLeft; - mpPaneDescriptor->mnTop = mnTop; - mpPaneDescriptor->mnRight = mnRight; - mpPaneDescriptor->mnBottom = mnBottom; -} - - - - -//===== MultiAnimation ======================================================== - -MultiAnimation::MultiAnimation (const sal_uInt32 nDuration) - : PresenterAnimation(0, nDuration, 1000/50), - maAnimations() -{ -} - - - - -void MultiAnimation::AddAnimation (const Animation& rAnimation) -{ - maAnimations.push_back(rAnimation); -} - - - - -void MultiAnimation::Run (const double nProgress, const sal_uInt64 nCurrentTime) -{ - (void)nCurrentTime; - vector<Animation>::const_iterator iAnimation (maAnimations.begin()); - vector<Animation>::const_iterator iEnd (maAnimations.end()); - for ( ; iAnimation!=iEnd; ++iAnimation) - (*iAnimation)(nProgress); -} - - - - -//===== functors ============================================================== - -void InterpolatePosition ( - const ::boost::function<void(geometry::RealPoint2D)>& rSetter, - double nP, - const geometry::RealPoint2D rInitialBox, - const geometry::RealPoint2D rFinalBox) -{ - const double nQ (1 - nP); - - OSL_TRACE("InterpolatePosition %f", nP); - rSetter( - geometry::RealPoint2D( - nQ * rInitialBox.X + nP * rFinalBox.X, - nQ * rInitialBox.Y + nP * rFinalBox.Y)); -} - - - - -template<typename T> - void InterpolateValue ( - const ::boost::function<void(T)>& rSetter, - double nP, - const T aInitialValue, - const T aFinalValue) -{ - const double nQ (1 - nP); - - rSetter(T(nQ * aInitialValue + nP * aFinalValue)); -} - - - - -void SpriteTransform( - const rtl::Reference<PresenterPaneContainer>& rpPaneContainer, - const Reference<XResourceId>& rxPaneId, - const Reference<awt::XWindow>& rxSpriteOwnerWindow, - const ::boost::shared_ptr<PresenterPaintManager>& rpPaintManager, - const bool bAppear, - const double nX, - const double nInitialTop, - const double nFinalTop, - const double nP) -{ - OSL_ASSERT(rpPaintManager.get()!=NULL); - - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - rpPaneContainer->FindPaneId(rxPaneId)); - if (pDescriptor.get() != NULL - && ! pDescriptor->maSpriteProvider.empty() - && pDescriptor->mxBorderWindow.is()) - { - ::boost::shared_ptr<PresenterSprite> pSprite (pDescriptor->maSpriteProvider()); - if (pSprite.get()) - { - // There seems to be a problem with sprites not correctly - // invalidating the background when being transformed. As a - // workaround invalidate the background in the bounding box of - // the sprite before the transformation. - rpPaintManager->Invalidate( - rxSpriteOwnerWindow, - awt::Rectangle( - sal::static_int_cast<sal_Int32>(pSprite->GetLocation().X), - sal::static_int_cast<sal_Int32>(pSprite->GetLocation().Y), - sal::static_int_cast<sal_Int32>(pSprite->GetSize().Width), - sal::static_int_cast<sal_Int32>(pSprite->GetSize().Height))); - - const double nYScale (bAppear ? nP : 1-nP); - pSprite->Transform(geometry::AffineMatrix2D( - 1, 0, 0, - 0, nYScale, 0)); - pSprite->MoveTo( - geometry::RealPoint2D(nX, nYScale*nFinalTop + (1-nYScale)*nInitialTop)); - pSprite->Show(); - - pDescriptor->mxBorderWindow->setVisible(sal_True); - } - } -} - - - - -void SpritePaneMove ( - const rtl::Reference<PresenterPaneContainer>& rpPaneContainer, - const Reference<XResourceId>& rxPaneId, - const geometry::RealPoint2D& rLocation) -{ - PresenterPaneContainer::SharedPaneDescriptor pDescriptor ( - rpPaneContainer->FindPaneId(rxPaneId)); - if (pDescriptor.get() != NULL - && ! pDescriptor->maSpriteProvider.empty() - && pDescriptor->mxBorderWindow.is()) - { - ::boost::shared_ptr<PresenterSprite> pSprite (pDescriptor->maSpriteProvider()); - if (pSprite.get() != NULL) - { - pDescriptor->mxBorderWindow->setVisible(sal_True); - pSprite->MoveTo(rLocation); - } - } -} - - - - -geometry::RealPoint2D GetLocation (const geometry::RealRectangle2D& rBox) -{ - return geometry::RealPoint2D(rBox.X1, rBox.Y1); -} - - - - -geometry::RealSize2D GetSize (const geometry::RealRectangle2D& rBox) -{ - return geometry::RealSize2D(rBox.X2-rBox.X1, rBox.Y2-rBox.Y1); -} - -} // end of anonymous namespace - - - - -} } // end of namespace ::sdext::presenter - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/presenter/PresenterPaneAnimator.hxx b/sdext/source/presenter/PresenterPaneAnimator.hxx deleted file mode 100644 index 6d3ab9ea44ee..000000000000 --- a/sdext/source/presenter/PresenterPaneAnimator.hxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SDEXT_PRESENTER_PRESENTER_PANE_ANIMATOR_HXXs -#define SDEXT_PRESENTER_PRESENTER_PANE_ANIMATOR_HXX - -#include <com/sun/star/awt/Point.hpp> -#include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/drawing/framework/XResourceId.hpp> -#include <com/sun/star/geometry/RealPoint2D.hpp> -#include <com/sun/star/rendering/XBitmap.hpp> -#include <com/sun/star/rendering/XSprite.hpp> -#include <com/sun/star/rendering/XSpriteCanvas.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <rtl/ref.hxx> -#include <vector> -#include <boost/function.hpp> -#include <boost/noncopyable.hpp> -#include <boost/shared_ptr.hpp> - -namespace css = ::com::sun::star; - -namespace sdext { namespace presenter { - -class PresenterController; -class PresenterPaneContainer; -class PresenterWindowManager; - -/** Base class for different types of pane animations. Each of these - animations either shows or hides a single pane. -*/ -class PresenterPaneAnimator - : private ::boost::noncopyable -{ -public: - virtual void ShowPane (void) = 0; - virtual void HidePane (void) = 0; - -protected: - virtual ~PresenterPaneAnimator (void) {}; -}; - - -typedef ::std::vector< ::boost::function<void()> > EndActions; - -} } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx index 05f84d24f738..038b3830d1f4 100644 --- a/sdext/source/presenter/PresenterSlideSorter.cxx +++ b/sdext/source/presenter/PresenterSlideSorter.cxx @@ -1201,7 +1201,6 @@ void PresenterSlideSorter::SetVerticalOffset (const double nYOffset) void PresenterSlideSorter::GotoSlide (const sal_Int32 nSlideIndex) { mxSlideShowController->gotoSlideIndex(nSlideIndex); - mpPresenterController->HideSlideSorter(); } diff --git a/sdext/source/presenter/makefile.mk b/sdext/source/presenter/makefile.mk index 7d74d96420a8..39ef9063bc22 100644 --- a/sdext/source/presenter/makefile.mk +++ b/sdext/source/presenter/makefile.mk @@ -72,7 +72,6 @@ SLOFILES= \ $(SLO)$/PresenterNotesView.obj \ $(SLO)$/PresenterPaintManager.obj \ $(SLO)$/PresenterPane.obj \ - $(SLO)$/PresenterPaneAnimator.obj \ $(SLO)$/PresenterPaneBase.obj \ $(SLO)$/PresenterPaneBorderManager.obj \ $(SLO)$/PresenterPaneBorderPainter.obj \ diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 9165c9ef0dcf..2057d953b688 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -186,7 +186,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/smarttags/SmartTagMgr \ svx/source/table/accessiblecell \ svx/source/table/accessibletableshape \ - svx/source/table/celleditsource \ svx/source/table/tabledesign \ svx/source/table/tablertfexporter \ svx/source/table/tablertfimporter \ diff --git a/svx/source/table/celleditsource.cxx b/svx/source/table/celleditsource.cxx deleted file mode 100644 index d2601b51975e..000000000000 --- a/svx/source/table/celleditsource.cxx +++ /dev/null @@ -1,1056 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> - -#include <rtl/ref.hxx> -#include <osl/mutex.hxx> -#include <osl/mutex.hxx> -#include <vcl/svapp.hxx> -#include <comphelper/processfactory.hxx> -#include <svl/lstner.hxx> -#include <svl/hint.hxx> -#include <svl/style.hxx> - -#include "celleditsource.hxx" -#include "cell.hxx" -#include "svx/svdmodel.hxx" -#include "svx/svdoutl.hxx" -#include "svx/svdobj.hxx" -#include "editeng/unoedhlp.hxx" -#include "svx/svdview.hxx" -#include "svx/svdetc.hxx" -#include "editeng/outliner.hxx" -#include "editeng/unoforou.hxx" -#include "editeng/unoviwou.hxx" -#include "editeng/outlobj.hxx" -#include "svx/svdotext.hxx" -#include "svx/svdpage.hxx" -#include "editeng/editeng.hxx" -#include "editeng/unotext.hxx" -#include "svx/sdrpaintwindow.hxx" - -//------------------------------------------------------------------------ - -using ::rtl::OUString; -using namespace ::osl; - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::linguistic2; -using namespace ::com::sun::star::lang; - -//------------------------------------------------------------------------ - -namespace sdr { namespace table { - -//------------------------------------------------------------------------ -// CellEditSourceImpl -//------------------------------------------------------------------------ - -/** @descr - <p>This class essentially provides the text and view forwarders. If - no SdrView is given, this class handles the UNO objects, which are - currently not concerned with view issues. In this case, - GetViewForwarder() always returns NULL and the underlying - EditEngine of the SvxTextForwarder is a background one (i.e. not - the official DrawOutliner, but one created exclusively for this - object, with no relation to a view). - </p> - - <p>If a SdrView is given at construction time, the caller is - responsible for destroying this object when the view becomes - invalid (the views cannot notify). If GetViewForwarder(sal_True) - is called, the underlying shape is put into edit mode, the view - forwarder returned encapsulates the OutlinerView and the next call - to GetTextForwarder() yields a forwarder encapsulating the actual - DrawOutliner. Thus, changes on that Outliner are immediately - reflected on the screen. If the object leaves edit mode, the old - behaviour is restored.</p> - */ -class CellEditSourceImpl : public SfxListener, public SfxBroadcaster -{ -private: - oslInterlockedCount maRefCount; - - SdrView* mpView; - const Window* mpWindow; - SdrModel* mpModel; - SdrOutliner* mpOutliner; - SvxOutlinerForwarder* mpTextForwarder; - SvxDrawOutlinerViewForwarder* mpViewForwarder; - Reference< ::com::sun::star::linguistic2::XLinguServiceManager > mxLinguServiceManager; - Point maTextOffset; - bool mbDataValid; - bool mbDisposed; - bool mbIsLocked; - bool mbNeedsUpdate; - bool mbOldUndoMode; - bool mbForwarderIsEditMode; // have to reflect that, since ENDEDIT can happen more often - bool mbShapeIsEditMode; // #104157# only true, if HINT_BEGEDIT was received - bool mbNotificationsDisabled; // prevent EditEngine/Outliner notifications (e.g. when setting up forwarder) - - CellRef mxCell; - SvxUnoTextRangeBaseList maTextRanges; - - SvxTextForwarder* GetBackgroundTextForwarder(); - SvxTextForwarder* GetEditModeTextForwarder(); - SvxDrawOutlinerViewForwarder* CreateViewForwarder(); - - void SetupOutliner(); - void UpdateOutliner(); - - bool HasView() const { return mpView != 0; } - bool IsEditMode() const { return mxCell->IsTextEditActive(); }; - void dispose(); - -public: - CellEditSourceImpl( const CellRef& xCell ); - CellEditSourceImpl( const CellRef& xCell, SdrView& rView, const Window& rWindow ); - ~CellEditSourceImpl(); - - void SAL_CALL acquire(); - void SAL_CALL release(); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - - SvxEditSource* Clone() const; - SvxTextForwarder* GetTextForwarder(); - SvxEditViewForwarder* GetEditViewForwarder( sal_Bool ); - void UpdateData(); - - void addRange( SvxUnoTextRangeBase* pNewRange ); - void removeRange( SvxUnoTextRangeBase* pOldRange ); - const SvxUnoTextRangeBaseList& getRanges() const; - - void lock(); - void unlock(); - - sal_Bool IsValid() const; - - Rectangle GetVisArea(); - Point LogicToPixel( const Point&, const MapMode& rMapMode ); - Point PixelToLogic( const Point&, const MapMode& rMapMode ); - - DECL_LINK( NotifyHdl, EENotify* ); - - void ChangeModel( SdrModel* pNewModel ); -}; - -//------------------------------------------------------------------------ - -CellEditSourceImpl::CellEditSourceImpl( const CellRef& xCell ) - : maRefCount ( 0 ), - mpView ( NULL ), - mpWindow ( NULL ), - mpModel ( NULL ), - mpOutliner ( NULL ), - mpTextForwarder ( NULL ), - mpViewForwarder ( NULL ), - mbDataValid ( false ), - mbDisposed ( false ), - mbIsLocked ( false ), - mbNeedsUpdate ( false ), - mbOldUndoMode ( false ), - mbForwarderIsEditMode ( false ), - mbShapeIsEditMode ( false ), - mbNotificationsDisabled ( false ), - mxCell( xCell ) -{ -} - -//------------------------------------------------------------------------ - -CellEditSourceImpl::CellEditSourceImpl( const CellRef& xCell, SdrView& rView, const Window& rWindow ) - : maRefCount ( 0 ), - mpView ( &rView ), - mpWindow ( &rWindow ), - mpModel ( NULL ), - mpOutliner ( NULL ), - mpTextForwarder ( NULL ), - mpViewForwarder ( NULL ), - mbDataValid ( false ), - mbDisposed ( false ), - mbIsLocked ( false ), - mbNeedsUpdate ( false ), - mbOldUndoMode ( false ), - mbForwarderIsEditMode ( false ), - mbShapeIsEditMode ( true ), - mbNotificationsDisabled ( false ), - mxCell( xCell ) -{ - if( mpView ) - StartListening( *mpView ); - - // #104157# Init edit mode state from shape info (IsTextEditActive()) - mbShapeIsEditMode = IsEditMode(); -} - -//------------------------------------------------------------------------ - -CellEditSourceImpl::~CellEditSourceImpl() -{ - DBG_ASSERT( mbIsLocked == sal_False, "CellEditSourceImpl::~CellEditSourceImpl(), was not unlocked before dispose!" ); - dispose(); -} - -//------------------------------------------------------------------------ - -void CellEditSourceImpl::addRange( SvxUnoTextRangeBase* pNewRange ) -{ - if( pNewRange ) - if( std::find( maTextRanges.begin(), maTextRanges.end(), pNewRange ) == maTextRanges.end() ) - maTextRanges.push_back( pNewRange ); -} - -//------------------------------------------------------------------------ - -void CellEditSourceImpl::removeRange( SvxUnoTextRangeBase* pOldRange ) -{ - if( pOldRange ) - maTextRanges.remove( pOldRange ); -} - -//------------------------------------------------------------------------ - -const SvxUnoTextRangeBaseList& CellEditSourceImpl::getRanges() const -{ - return maTextRanges; -} - -//------------------------------------------------------------------------ - -void SAL_CALL CellEditSourceImpl::acquire() -{ - osl_incrementInterlockedCount( &maRefCount ); -} - -//------------------------------------------------------------------------ - -void SAL_CALL CellEditSourceImpl::release() -{ - if( ! osl_decrementInterlockedCount( &maRefCount ) ) - delete this; -} - -void CellEditSourceImpl::ChangeModel( SdrModel* pNewModel ) -{ - if( mpModel != pNewModel ) - { - if( mpOutliner ) - { - if( mpModel ) - mpModel->disposeOutliner( mpOutliner ); - else - delete mpOutliner; - mpOutliner = 0; - } - - if( mpView ) - { - EndListening( *mpView ); - mpView = 0; - } - - mpWindow = 0; - mxLinguServiceManager.clear(); - - mpModel = pNewModel; - - if( mpTextForwarder ) - { - delete mpTextForwarder; - mpTextForwarder = 0; - } - - if( mpViewForwarder ) - { - delete mpViewForwarder; - mpViewForwarder = 0; - } - } -} - -//------------------------------------------------------------------------ - -void CellEditSourceImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); - const SvxViewHint* pViewHint = PTR_CAST( SvxViewHint, &rHint ); - - if( pViewHint ) - { - switch( pViewHint->GetHintType() ) - { - case SvxViewHint::SVX_HINT_VIEWCHANGED: - Broadcast( *pViewHint ); - break; - } - } - else if( pSdrHint ) - { - switch( pSdrHint->GetKind() ) - { - case HINT_OBJCHG: - { - mbDataValid = sal_False; // Text muss neu geholt werden - - if( HasView() ) - { - // #104157# Update maTextOffset, object has changed - // #105196#, #105203#: Cannot call that // here, - // since TakeTextRect() (called from there) // - // changes outliner content. - // UpdateOutliner(); - - // #101029# Broadcast object changes, as they might change visible attributes - SvxViewHint aHint(SvxViewHint::SVX_HINT_VIEWCHANGED); - Broadcast( aHint ); - } - break; - } - - case HINT_BEGEDIT: -/* todo - if( mpObject == pSdrHint->GetObject() ) - { - // invalidate old forwarder - if( !mbForwarderIsEditMode ) - { - delete mpTextForwarder; - mpTextForwarder = NULL; - } - - // register as listener - need to broadcast state change messages - if( mpView && mpView->GetTextEditOutliner() ) - mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, CellEditSourceImpl, NotifyHdl) ); - - // #104157# Only now we're really in edit mode - mbShapeIsEditMode = sal_True; - - Broadcast( *pSdrHint ); - } -*/ - break; - - case HINT_ENDEDIT: -/* todo - if( mpObject == pSdrHint->GetObject() ) - { - Broadcast( *pSdrHint ); - - // #104157# We're no longer in edit mode - mbShapeIsEditMode = sal_False; - - // remove as listener - outliner might outlive ourselves - if( mpView && mpView->GetTextEditOutliner() ) - mpView->GetTextEditOutliner()->SetNotifyHdl( Link() ); - - // destroy view forwarder, OutlinerView no longer - // valid (no need for UpdateData(), it's been - // synched on SdrEndTextEdit) - delete mpViewForwarder; - mpViewForwarder = NULL; - - // #100424# Invalidate text forwarder, we might - // not be called again before entering edit mode a - // second time! Then, the old outliner might be - // invalid. - if( mbForwarderIsEditMode ) - { - mbForwarderIsEditMode = sal_False; - delete mpTextForwarder; - mpTextForwarder = NULL; - } - } -*/ - break; - - case HINT_MODELCLEARED: - dispose(); - break; - default: - break; - } - } -} - -/* unregister at all objects and set all references to 0 */ -void CellEditSourceImpl::dispose() -{ - if( mpTextForwarder ) - { - delete mpTextForwarder; - mpTextForwarder = 0; - } - - if( mpViewForwarder ) - { - delete mpViewForwarder; - mpViewForwarder = 0; - } - - if( mpOutliner ) - { - if( mpModel ) - { - mpModel->disposeOutliner( mpOutliner ); - } - else - { - delete mpOutliner; - } - mpOutliner = 0; - } - - if( mpView ) - { - EndListening( *mpView ); - mpView = 0; - } - - mpModel = 0; - mpWindow = 0; -} - -//------------------------------------------------------------------------ - -void CellEditSourceImpl::SetupOutliner() -{ - // #101029# - // only for UAA edit source: setup outliner equivalently as in - // SdrTextObj::Paint(), such that formatting equals screen - // layout -/* todo - if( mpObject && mpOutliner ) - { - SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject ); - Rectangle aPaintRect; - if( pTextObj ) - { - Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() ); - pTextObj->SetupOutlinerFormatting( *mpOutliner, aPaintRect ); - - // #101029# calc text offset from shape anchor - maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft(); - } - } -*/ -} - -//------------------------------------------------------------------------ - -void CellEditSourceImpl::UpdateOutliner() -{ - // #104157# - // only for UAA edit source: update outliner equivalently as in - // SdrTextObj::Paint(), such that formatting equals screen - // layout -/* todo - if( mpObject && mpOutliner ) - { - SdrTextObj* pTextObj = PTR_CAST( SdrTextObj, mpObject ); - Rectangle aPaintRect; - if( pTextObj ) - { - Rectangle aBoundRect( pTextObj->GetCurrentBoundRect() ); - pTextObj->UpdateOutlinerFormatting( *mpOutliner, aPaintRect ); - - // #101029# calc text offset from shape anchor - maTextOffset = aPaintRect.TopLeft() - aBoundRect.TopLeft(); - } - } -*/ -} - -//------------------------------------------------------------------------ - - -SvxTextForwarder* CellEditSourceImpl::GetBackgroundTextForwarder() -{ - sal_Bool bCreated = sal_False; - - // #99840#: prevent EE/Outliner notifications during setup - mbNotificationsDisabled = true; - - if (!mpTextForwarder) - { - if( mpOutliner == NULL ) - { - mpOutliner = mpModel->createOutliner( OUTLINERMODE_TEXTOBJECT ); - - // #109151# Do the setup after outliner creation, would be useless otherwise - if( HasView() ) - { - // #101029#, #104157# Setup outliner _before_ filling it - SetupOutliner(); - } - -// todo? mpOutliner->SetTextObjNoInit( pTextObj ); - - if( mbIsLocked ) - { - ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False ); - mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled(); - ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False ); - } - - if ( !mxLinguServiceManager.is() ) - { - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - mxLinguServiceManager = Reference< XLinguServiceManager >( - xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.linguistic2.LinguServiceManager" ))), UNO_QUERY ); - } - - if ( mxLinguServiceManager.is() ) - { - Reference< XHyphenator > xHyphenator( mxLinguServiceManager->getHyphenator(), UNO_QUERY ); - if( xHyphenator.is() ) - mpOutliner->SetHyphenator( xHyphenator ); - } - } - - mpTextForwarder = new SvxOutlinerForwarder( *mpOutliner ); - - // delay listener subscription and UAA initialization until Outliner is fully setup - bCreated = true; - mbForwarderIsEditMode = false; - } - - if( !mbDataValid ) - { - mpTextForwarder->flushCache(); - - OutlinerParaObject* pOutlinerParaObject = NULL; - bool bTextEditActive = false; - - pOutlinerParaObject = mxCell->GetEditOutlinerParaObject(); // Get the OutlinerParaObject if text edit is active - - if( pOutlinerParaObject ) - bTextEditActive = true; // text edit active - else - pOutlinerParaObject = mxCell->GetOutlinerParaObject(); - - if( pOutlinerParaObject ) - { - mpOutliner->SetText( *pOutlinerParaObject ); - } - else - { - bool bVertical = false; // todo? - - // set objects style sheet on empty outliner - SfxStyleSheetPool* pPool = mxCell->GetStyleSheetPool(); - if( pPool ) - mpOutliner->SetStyleSheetPool( pPool ); - - SfxStyleSheet* pStyleSheet = mxCell->GetStyleSheet(); - if( pStyleSheet ) - mpOutliner->SetStyleSheet( 0, pStyleSheet ); - - if( bVertical ) - mpOutliner->SetVertical( sal_True ); - } - - // evtually we have to set the border attributes - if (mpOutliner->GetParagraphCount()==1) - { - // if we only have one paragraph we check if it is empty - XubString aStr( mpOutliner->GetText( mpOutliner->GetParagraph( 0 ) ) ); - - if(!aStr.Len()) - { - // its empty, so we have to force the outliner to initialise itself - mpOutliner->SetText( String(), mpOutliner->GetParagraph( 0 ) ); - - if(mxCell->GetStyleSheet()) - mpOutliner->SetStyleSheet( 0, mxCell->GetStyleSheet()); - } - } - - if( bTextEditActive ) - delete pOutlinerParaObject; - - mbDataValid = true; - } - - if( bCreated && mpOutliner && HasView() ) - { - // register as listener - need to broadcast state change messages - // registration delayed until outliner is completely set up - mpOutliner->SetNotifyHdl( LINK(this, CellEditSourceImpl, NotifyHdl) ); - } - - // #99840#: prevent EE/Outliner notifications during setup - mbNotificationsDisabled = false; - - return mpTextForwarder; -} - -//------------------------------------------------------------------------ - -SvxTextForwarder* CellEditSourceImpl::GetEditModeTextForwarder() -{ - if( !mpTextForwarder && HasView() ) - { - SdrOutliner* pEditOutliner = mpView->GetTextEditOutliner(); - - if( pEditOutliner ) - { - mpTextForwarder = new SvxOutlinerForwarder( *pEditOutliner ); - mbForwarderIsEditMode = true; - } - } - - return mpTextForwarder; -} - -//------------------------------------------------------------------------ - -SvxTextForwarder* CellEditSourceImpl::GetTextForwarder() -{ - if( mbDisposed ) - return NULL; - - if( mpModel == NULL ) - return NULL; - - // distinguish the cases - // a) connected to view, maybe edit mode is active, can work directly on the EditOutliner - // b) background Outliner, reflect changes into ParaOutlinerObject (this is exactly the old UNO code) - if( HasView() ) - { - if( IsEditMode() != mbForwarderIsEditMode ) - { - // forwarder mismatch - create new - delete mpTextForwarder; - mpTextForwarder = NULL; - } - - if( IsEditMode() ) - return GetEditModeTextForwarder(); - else - return GetBackgroundTextForwarder(); - } - else - return GetBackgroundTextForwarder(); -} - -//------------------------------------------------------------------------ - -SvxDrawOutlinerViewForwarder* CellEditSourceImpl::CreateViewForwarder() -{ - if( mpView->GetTextEditOutlinerView() ) - { - // register as listener - need to broadcast state change messages - mpView->GetTextEditOutliner()->SetNotifyHdl( LINK(this, CellEditSourceImpl, NotifyHdl) ); - - Rectangle aBoundRect( mxCell->GetCurrentBoundRect() ); - OutlinerView& rOutlView = *mpView->GetTextEditOutlinerView(); - - return new SvxDrawOutlinerViewForwarder( rOutlView, aBoundRect.TopLeft() ); - } - - return NULL; -} - -SvxEditViewForwarder* CellEditSourceImpl::GetEditViewForwarder( sal_Bool bCreate ) -{ - if( mbDisposed ) - return NULL; - - if( mpModel == NULL ) - return NULL; - - // shall we delete? - if( mpViewForwarder ) - { - if( !IsEditMode() ) - { - // destroy all forwarders (no need for UpdateData(), - // it's been synched on SdrEndTextEdit) - delete mpViewForwarder; - mpViewForwarder = NULL; - } - } - // which to create? Directly in edit mode, create new, or none? - else if( mpView ) - { - if( IsEditMode() ) - { - // create new view forwarder - mpViewForwarder = CreateViewForwarder(); - } - else if( bCreate ) - { - // dispose old text forwarder - UpdateData(); - - delete mpTextForwarder; - mpTextForwarder = NULL; - - // enter edit mode - mpView->SdrEndTextEdit(); - -/* todo - if(mpView->SdrBeginTextEdit(mpObject, 0L, 0L, sal_False, (SdrOutliner*)0L, 0L, sal_False, sal_False)) - { - if( mxCell->IsTextEditActive() ) - { - // create new view forwarder - mpViewForwarder = CreateViewForwarder(); - } - else - { - // failure. Somehow, SdrBeginTextEdit did not set - // our SdrTextObj into edit mode - mpView->SdrEndTextEdit(); - } - } -*/ - } - } - - return mpViewForwarder; -} - -//------------------------------------------------------------------------ - -void CellEditSourceImpl::UpdateData() -{ - // if we have a view and in edit mode, we're working with the - // DrawOutliner. Thus, all changes made on the text forwarder are - // reflected on the view and committed to the model on - // SdrEndTextEdit(). Thus, no need for explicit updates here. - if( !HasView() || !IsEditMode() ) - { - if( mbIsLocked ) - { - mbNeedsUpdate = true; - } - else - { - if( mpOutliner && !mbDisposed ) - { - if( mpOutliner->GetParagraphCount() != 1 || mpOutliner->GetEditEngine().GetTextLen( 0 ) ) - { - mxCell->SetOutlinerParaObject( mpOutliner->CreateParaObject() ); - } - else - { - mxCell->SetOutlinerParaObject( NULL ); - } - } - } - } -} - -void CellEditSourceImpl::lock() -{ - mbIsLocked = true; - if( mpOutliner ) - { - ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_False ); - mbOldUndoMode = ((EditEngine*)&(mpOutliner->GetEditEngine()))->IsUndoEnabled(); - ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( sal_False ); - } -} - -void CellEditSourceImpl::unlock() -{ - mbIsLocked = false; - - if( mbNeedsUpdate ) - { - UpdateData(); - mbNeedsUpdate = false; - } - - if( mpOutliner ) - { - ((EditEngine*)&(mpOutliner->GetEditEngine()))->SetUpdateMode( sal_True ); - ((EditEngine*)&(mpOutliner->GetEditEngine()))->EnableUndo( mbOldUndoMode ); - } -} - -sal_Bool CellEditSourceImpl::IsValid() const -{ - return mpView && mpWindow ? sal_True : sal_False; -} - -Rectangle CellEditSourceImpl::GetVisArea() -{ - if( IsValid() ) - { - SdrPaintWindow* pPaintWindow = mpView->FindPaintWindow(*mpWindow); - Rectangle aVisArea; - - if(pPaintWindow) - { - aVisArea = pPaintWindow->GetVisibleArea(); - } - - // offset vis area by edit engine left-top position - Rectangle aAnchorRect; - mxCell->TakeTextAnchorRect( aAnchorRect ); - aVisArea.Move( -aAnchorRect.Left(), -aAnchorRect.Top() ); - - MapMode aMapMode(mpWindow->GetMapMode()); - aMapMode.SetOrigin(Point()); - return mpWindow->LogicToPixel( aVisArea, aMapMode ); - } - - return Rectangle(); -} - -Point CellEditSourceImpl::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) -{ - // #101029#: The responsibilities of ViewForwarder happen to be - // somewhat mixed in this case. On the one hand, we need the - // different interface queries on the SvxEditSource interface, - // since we need both VisAreas. On the other hand, if an - // EditViewForwarder exists, maTextOffset does not remain static, - // but may change with every key press. - if( IsEditMode() ) - { - SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False); - - if( pForwarder ) - return pForwarder->LogicToPixel( rPoint, rMapMode ); - } - else if( IsValid() && mpModel ) - { - // #101029# - Point aPoint1( rPoint ); - aPoint1.X() += maTextOffset.X(); - aPoint1.Y() += maTextOffset.Y(); - - Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode, - MapMode(mpModel->GetScaleUnit()) ) ); - MapMode aMapMode(mpWindow->GetMapMode()); - aMapMode.SetOrigin(Point()); - return mpWindow->LogicToPixel( aPoint2, aMapMode ); - } - - return Point(); -} - -Point CellEditSourceImpl::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) -{ - // #101029#: The responsibilities of ViewForwarder happen to be - // somewhat mixed in this case. On the one hand, we need the - // different interface queries on the SvxEditSource interface, - // since we need both VisAreas. On the other hand, if an - // EditViewForwarder exists, maTextOffset does not remain static, - // but may change with every key press. - if( IsEditMode() ) - { - SvxEditViewForwarder* pForwarder = GetEditViewForwarder(sal_False); - - if( pForwarder ) - return pForwarder->PixelToLogic( rPoint, rMapMode ); - } - else if( IsValid() && mpModel ) - { - MapMode aMapMode(mpWindow->GetMapMode()); - aMapMode.SetOrigin(Point()); - Point aPoint1( mpWindow->PixelToLogic( rPoint, aMapMode ) ); - Point aPoint2( OutputDevice::LogicToLogic( aPoint1, - MapMode(mpModel->GetScaleUnit()), - rMapMode ) ); - // #101029# - aPoint2.X() -= maTextOffset.X(); - aPoint2.Y() -= maTextOffset.Y(); - - return aPoint2; - } - - return Point(); -} - -IMPL_LINK(CellEditSourceImpl, NotifyHdl, EENotify*, aNotify) -{ - if( aNotify && !mbNotificationsDisabled ) - { - ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( aNotify) ); - - if( aHint.get() ) - Broadcast( *aHint.get() ); - } - - return 0; -} - -//------------------------------------------------------------------------ - -// -------------------------------------------------------------------- -// CellEditSource -// -------------------------------------------------------------------- - -CellEditSource::CellEditSource( const CellRef& xCell ) -{ - mpImpl = new CellEditSourceImpl( xCell ); - mpImpl->acquire(); -} - -// -------------------------------------------------------------------- -CellEditSource::CellEditSource( const CellRef& xCell, SdrView& rView, const Window& rWindow ) -{ - mpImpl = new CellEditSourceImpl( xCell, rView, rWindow ); - mpImpl->acquire(); -} - -// -------------------------------------------------------------------- - -CellEditSource::CellEditSource( CellEditSourceImpl* pImpl ) -{ - mpImpl = pImpl; - mpImpl->acquire(); -} - -//------------------------------------------------------------------------ -CellEditSource::~CellEditSource() -{ - ::SolarMutexGuard aGuard; - mpImpl->release(); -} - -//------------------------------------------------------------------------ -SvxEditSource* CellEditSource::Clone() const -{ - return new CellEditSource( mpImpl ); -} - -//------------------------------------------------------------------------ -SvxTextForwarder* CellEditSource::GetTextForwarder() -{ - return mpImpl->GetTextForwarder(); -} - -//------------------------------------------------------------------------ -SvxEditViewForwarder* CellEditSource::GetEditViewForwarder( sal_Bool bCreate ) -{ - return mpImpl->GetEditViewForwarder( bCreate ); -} - -//------------------------------------------------------------------------ - -SvxViewForwarder* CellEditSource::GetViewForwarder() -{ - return this; -} - -//------------------------------------------------------------------------ - -void CellEditSource::UpdateData() -{ - mpImpl->UpdateData(); -} - -//------------------------------------------------------------------------ - -SfxBroadcaster& CellEditSource::GetBroadcaster() const -{ - return *mpImpl; -} - -//------------------------------------------------------------------------ - -void CellEditSource::lock() -{ - mpImpl->lock(); -} - -//------------------------------------------------------------------------ - -void CellEditSource::unlock() -{ - mpImpl->unlock(); -} - -//------------------------------------------------------------------------ - -sal_Bool CellEditSource::IsValid() const -{ - return mpImpl->IsValid(); -} - -//------------------------------------------------------------------------ - -Rectangle CellEditSource::GetVisArea() const -{ - return mpImpl->GetVisArea(); -} - -//------------------------------------------------------------------------ - -Point CellEditSource::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const -{ - return mpImpl->LogicToPixel( rPoint, rMapMode ); -} - -//------------------------------------------------------------------------ - -Point CellEditSource::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const -{ - return mpImpl->PixelToLogic( rPoint, rMapMode ); -} - -//------------------------------------------------------------------------ - -void CellEditSource::addRange( SvxUnoTextRangeBase* pNewRange ) -{ - mpImpl->addRange( pNewRange ); -} - -//------------------------------------------------------------------------ - -void CellEditSource::removeRange( SvxUnoTextRangeBase* pOldRange ) -{ - mpImpl->removeRange( pOldRange ); -} - -//------------------------------------------------------------------------ - -const SvxUnoTextRangeBaseList& CellEditSource::getRanges() const -{ - return mpImpl->getRanges(); -} - -//------------------------------------------------------------------------ - -void CellEditSource::ChangeModel( SdrModel* pNewModel ) -{ - mpImpl->ChangeModel( pNewModel ); -} - -//------------------------------------------------------------------------ - -} } - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/table/celleditsource.hxx b/svx/source/table/celleditsource.hxx deleted file mode 100644 index 014180a3e4c0..000000000000 --- a/svx/source/table/celleditsource.hxx +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef SVX_TABLE_CELLEDITSOURCE_HXX -#define SVX_TABLE_CELLEDITSOURCE_HXX - -#include "cell.hxx" -#include "celltypes.hxx" -#include "editeng/unoedsrc.hxx" - -class SvxTextForwarder; -class SdrObject; -class SdrModel; -class SdrView; -class Window; - -namespace sdr { namespace table { - -class CellEditSourceImpl; - -class CellEditSource : public SvxEditSource, public SvxViewForwarder -{ -public: - CellEditSource( const CellRef& xCell ); - - /** Since the views don't broadcast their dying, make sure that - this object gets destroyed if the view becomes invalid - - The window is necessary, since our views can display on multiple windows - */ - CellEditSource( const CellRef& xCell, SdrView& rView, const Window& rViewWindow ); - virtual ~CellEditSource(); - - virtual SvxEditSource* Clone() const; - virtual SvxTextForwarder* GetTextForwarder(); - virtual SvxViewForwarder* GetViewForwarder(); - virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False ); - virtual void UpdateData(); - - virtual void addRange( SvxUnoTextRangeBase* pNewRange ); - virtual void removeRange( SvxUnoTextRangeBase* pOldRange ); - virtual const SvxUnoTextRangeBaseList& getRanges() const; - - virtual SfxBroadcaster& GetBroadcaster() const; - - void lock(); - void unlock(); - - // the SvxViewForwarder interface - virtual sal_Bool IsValid() const; - virtual Rectangle GetVisArea() const; - virtual Point LogicToPixel( const Point&, const MapMode& ) const; - virtual Point PixelToLogic( const Point&, const MapMode& ) const; - - void ChangeModel( SdrModel* pNewModel ); - -private: - CellEditSource( CellEditSourceImpl* pImpl ); - - CellEditSourceImpl* mpImpl; -}; - -} } - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unusedcode.easy b/unusedcode.easy index 4ee171013f38..40865c72104e 100644 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -1101,9 +1101,6 @@ basegfx::B2DHomMatrix::transpose() basegfx::B2DHomPoint::getB2DPoint() const basegfx::B2DHomPoint::setX(double) basegfx::B2DHomPoint::setY(double) -basegfx::B2DPolyPolygonRasterConverter::B2DPolyPolygonRasterConverter(basegfx::B2DPolyPolygon const&) -basegfx::B2DPolyPolygonRasterConverter::B2DPolyPolygonRasterConverter(basegfx::B2DPolyPolygon const&, basegfx::B2DRange const&) -basegfx::B2DPolyPolygonRasterConverter::rasterConvert(basegfx::FillRule) basegfx::B2DPolyRange::B2DPolyRange(basegfx::B2DRange const&, basegfx::B2VectorOrientation) basegfx::B2DPolyRange::B2DPolyRange(boost::tuples::tuple<basegfx::B2DRange, basegfx::B2VectorOrientation, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> const&) basegfx::B2DPolyRange::appendElement(boost::tuples::tuple<basegfx::B2DRange, basegfx::B2VectorOrientation, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> const&, unsigned int) @@ -1125,11 +1122,6 @@ basegfx::B2DPolyRange::setElement(unsigned int, boost::tuples::tuple<basegfx::B2 basegfx::B2DPolygon::insert(unsigned int, basegfx::B2DPolygon const&, unsigned int, unsigned int) basegfx::B2DPolygon::isBezierSegment(unsigned int) const basegfx::B2DPolygon::resetControlPoints(unsigned int) -basegfx::B2DQuadraticBezier::B2DQuadraticBezier() -basegfx::B2DQuadraticBezier::B2DQuadraticBezier(basegfx::B2DPoint const&, basegfx::B2DPoint const&) -basegfx::B2DQuadraticBezier::B2DQuadraticBezier(basegfx::B2DPoint const&, basegfx::B2DPoint const&, basegfx::B2DPoint const&) -basegfx::B2DQuadraticBezier::isBezier() const -basegfx::B2DQuadraticBezier::~B2DQuadraticBezier() basegfx::B2DTuple::correctValues(double) basegfx::B2DVector::isNormalized() const basegfx::B2I64Tuple::getEmptyTuple() @@ -1978,11 +1970,7 @@ sd::slidesorter::model::VisualState::SetVisualStateBlend(double) sd::slidesorter::view::(anonymous namespace)::Blend(unsigned char, unsigned char, double) sd::slidesorter::view::(anonymous namespace)::CalculateColorChannel(double, double, double, double, double) sd::slidesorter::view::(anonymous namespace)::PageObjectRun::GetInnerBoundingBox(sd::slidesorter::view::Layouter const&, int) const -sd::slidesorter::view::(anonymous namespace)::RectangleBackgroundTheme::RectangleBackgroundTheme(boost::shared_ptr<sd::slidesorter::view::Theme> const&, std::__debug::vector<boost::shared_ptr<sd::slidesorter::view::Button>, std::allocator<boost::shared_ptr<sd::slidesorter::view::Button> > > const&) sd::slidesorter::view::FontProvider::GetFont(OutputDevice const&) -sdext::presenter::(anonymous namespace)::MoveInFromBottomAnimator::MoveInFromBottomAnimator(com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> const&, rtl::Reference<sdext::presenter::PresenterController> const&, bool, std::__debug::vector<boost::function<void ()>, std::allocator<boost::function<void ()> > > const&, std::__debug::vector<boost::function<void ()>, std::allocator<boost::function<void ()> > > const&) -sdext::presenter::(anonymous namespace)::TransparentOverlayAnimator::TransparentOverlayAnimator(com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> const&, rtl::Reference<sdext::presenter::PresenterController> const&, bool, std::__debug::vector<boost::function<void ()>, std::allocator<boost::function<void ()> > > const&, std::__debug::vector<boost::function<void ()>, std::allocator<boost::function<void ()> > > const&) -sdext::presenter::(anonymous namespace)::UnfoldInCenterAnimator::UnfoldInCenterAnimator(com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResourceId> const&, rtl::Reference<sdext::presenter::PresenterController> const&, bool, std::__debug::vector<boost::function<void ()>, std::allocator<boost::function<void ()> > > const&, std::__debug::vector<boost::function<void ()>, std::allocator<boost::function<void ()> > > const&) sdext::presenter::PresenterHorizontalScrollBar::PresenterHorizontalScrollBar(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, boost::shared_ptr<sdext::presenter::PresenterPaintManager> const&, boost::function<void (double)> const&) sdr::animation::Scheduler::Reset(unsigned int) sdr::contact::ViewContactOfPageObj::GetReferencedPage() const @@ -1999,12 +1987,6 @@ sdr::overlay::OverlayRollingRectangleStriped::setExtendedLines(bool) sdr::overlay::OverlayRollingRectangleStriped::setShowBounds(bool) sdr::overlay::OverlayTriangle::setSecondPosition(basegfx::B2DPoint const&) sdr::overlay::OverlayTriangle::setThirdPosition(basegfx::B2DPoint const&) -sdr::table::CellEditSource::CellEditSource(rtl::Reference<sdr::table::Cell> const&) -sdr::table::CellEditSource::CellEditSource(rtl::Reference<sdr::table::Cell> const&, SdrView&, Window const&) -sdr::table::CellEditSource::ChangeModel(SdrModel*) -sdr::table::CellEditSource::lock() -sdr::table::CellEditSource::unlock() -sdr::table::CellEditSourceImpl::UpdateOutliner() sdr::table::SdrTableObj::DeleteColumns(int, int) sdr::table::SdrTableObj::DeleteRows(int, int) sdr::table::SdrTableObj::FitFrameToTextSize() |