summaryrefslogtreecommitdiff
path: root/chart2/source/tools
diff options
context:
space:
mode:
authorBjörn Milcke <bm@openoffice.org>2003-10-06 08:58:36 +0000
committerBjörn Milcke <bm@openoffice.org>2003-10-06 08:58:36 +0000
commitc7623b4823e31f0eff82a64c7a43d8f50c3a5dd4 (patch)
treee2cd53d29a8bcf5120975dcedd170e622f9200d3 /chart2/source/tools
parent039524721a56387ce25a6738acabdea4b6c40c2f (diff)
initial import
Diffstat (limited to 'chart2/source/tools')
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx213
-rw-r--r--chart2/source/tools/CommonConverters.cxx640
-rw-r--r--chart2/source/tools/ContextHelper.cxx92
-rw-r--r--chart2/source/tools/ImplOPropertySet.cxx206
-rw-r--r--chart2/source/tools/ImplOPropertySet.hxx133
-rw-r--r--chart2/source/tools/LegendHelper.cxx78
-rw-r--r--chart2/source/tools/LifeTime.cxx572
-rw-r--r--chart2/source/tools/MediaDescriptorHelper.cxx260
-rw-r--r--chart2/source/tools/MutexContainer.cxx77
-rw-r--r--chart2/source/tools/OEnumeration.cxx95
-rw-r--r--chart2/source/tools/OIndexContainer.cxx214
-rw-r--r--chart2/source/tools/OPropertySet.cxx463
-rw-r--r--chart2/source/tools/OStyle.cxx265
-rw-r--r--chart2/source/tools/Scaling.cxx232
-rw-r--r--chart2/source/tools/TitleHelper.cxx241
-rw-r--r--chart2/source/tools/exports.flt0
-rw-r--r--chart2/source/tools/makefile.mk166
-rw-r--r--chart2/source/tools/tools.map9
18 files changed, 3956 insertions, 0 deletions
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
new file mode 100644
index 000000000..50e560395
--- /dev/null
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * $RCSfile: ChartModelHelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XCHARTDOCUMENT_HPP_
+#include <drafts/com/sun/star/chart2/XChartDocument.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XCHARTTYPEGROUP_HPP_
+#include <drafts/com/sun/star/chart2/XChartTypeGroup.hpp>
+#endif
+
+// header for define DBG_ASSERT
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+
+//static
+uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< frame::XModel >& xModel )
+{
+ uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ if( xChartDoc.is())
+ return xChartDoc->getDiagram();
+ return NULL;
+}
+
+//static
+sal_Int32 ChartModelHelper::getDimensionAndFirstChartType( const uno::Reference< XDiagram >& xDiagram, rtl::OUString& rChartType )
+{
+ sal_Int32 nDimension = 2;
+
+ //@todo maybe get the dimension better from diagram properties ... -> need model change
+ if(!xDiagram.is())
+ return nDimension;
+ uno::Reference< XDataSeriesTreeParent > xTree = xDiagram->getTree();
+ if(!xTree.is())
+ return nDimension;
+ uno::Sequence< uno::Reference< XDataSeriesTreeNode > > aChartTypes( xTree->getChildren() );
+ for( sal_Int32 i = 0; i < aChartTypes.getLength(); ++i )
+ {
+ uno::Reference< XChartTypeGroup > xChartTypeGroup( aChartTypes[i], uno::UNO_QUERY );
+ DBG_ASSERT(xChartTypeGroup.is(),"First node at the diagram tree needs to be a ChartTypeGroup");
+ if( !xChartTypeGroup.is() )
+ continue;
+ uno::Reference< XChartType > xChartType = xChartTypeGroup->getChartType();
+ if( !xChartType.is() )
+ continue;
+ uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY );
+ if( xChartTypeProp.is())
+ {
+ try
+ {
+ if( (xChartTypeProp->getPropertyValue( C2U( "Dimension" )) >>= nDimension) )
+ {
+ rChartType = xChartType->getChartType();
+ return nDimension;
+ }
+ else
+ {
+ DBG_ERROR( "Couldn't get Dimension from ChartTypeGroup" );
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+ }
+ }
+ return nDimension;
+}
+
+namespace
+{
+void lcl_addSeries( uno::Reference< XDataSeriesTreeParent > xParent,
+ ::std::vector< uno::Reference< XDataSeries > > & rOutSeriesVec )
+{
+ if( xParent.is())
+ {
+ uno::Sequence< uno::Reference< XDataSeriesTreeNode > > aChildren( xParent->getChildren());
+ for( sal_Int32 i = 0; i < aChildren.getLength(); ++i )
+ {
+ uno::Reference< XDataSeries > aDataSeries( aChildren[ i ], uno::UNO_QUERY );
+ if( aDataSeries.is())
+ {
+ rOutSeriesVec.push_back( aDataSeries );
+ }
+ else
+ {
+ uno::Reference< XDataSeriesTreeParent > xNewParent( aChildren[ i ], uno::UNO_QUERY );
+ if( xNewParent.is())
+ lcl_addSeries( xNewParent, rOutSeriesVec );
+ }
+ }
+ }
+}
+} // anonymous namespace
+
+// static
+::std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
+ const uno::Reference< frame::XModel > & xModel )
+{
+ ::std::vector< uno::Reference< XDataSeries > > aResult;
+ uno::Reference< XChartDocument > xDocument( xModel, uno::UNO_QUERY );
+ if( xDocument.is())
+ {
+ uno::Reference< XDiagram > xDia( xDocument->getDiagram());
+ if( xDia.is())
+ lcl_addSeries( xDia->getTree(), aResult );
+ }
+
+ return aResult;
+}
+
+//static
+uno::Reference< XDataSeries > ChartModelHelper::getSeriesByIdentifier(
+ const rtl::OUString& rIdentifier
+ , const uno::Reference< frame::XModel > xModel )
+{
+ if(!rIdentifier.getLength())
+ return NULL;
+
+ ::std::vector< uno::Reference< XDataSeries > > aSeriesList(
+ getDataSeries( xModel ));
+ uno::Reference< XDataSeries > xRet;
+ uno::Reference< beans::XPropertySet > xProp;
+ rtl::OUString aIdentifier;
+
+ ::std::vector< uno::Reference< XDataSeries > >::const_iterator aIt;
+ for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
+ {
+ xProp = uno::Reference< beans::XPropertySet >( *aIt, uno::UNO_QUERY );
+ if(!xProp.is())
+ continue;
+ uno::Any aAIdentifier = xProp->getPropertyValue( C2U( "Identifier" ) );
+ aAIdentifier >>= aIdentifier;
+ if(aIdentifier.getLength() && rIdentifier.match(aIdentifier))
+ {
+ xRet = *aIt;
+ break;
+ }
+ }
+ return xRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx
new file mode 100644
index 000000000..53df5d1f1
--- /dev/null
+++ b/chart2/source/tools/CommonConverters.cxx
@@ -0,0 +1,640 @@
+/*************************************************************************
+ *
+ * $RCSfile: CommonConverters.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef __CHART_COMMON_CONVERTERS_HXX
+#include "CommonConverters.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_DRAWING_DOUBLESEQUENCE_HPP_
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_WRITINGMODE2_HPP_
+#include <com/sun/star/text/WritingMode2.hpp>
+#endif
+
+#include <cstdarg>
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// diverse methods for class conversions; e.g. Matrix4D to HomogenMatrix
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+drawing::HomogenMatrix Matrix4DToHomogenMatrix( const Matrix4D& rM4 )
+{
+ drawing::HomogenMatrix aHM;
+ aHM.Line1.Column1 = rM4[0][0];
+ aHM.Line1.Column2 = rM4[0][1];
+ aHM.Line1.Column3 = rM4[0][2];
+ aHM.Line1.Column4 = rM4[0][3];
+ aHM.Line2.Column1 = rM4[1][0];
+ aHM.Line2.Column2 = rM4[1][1];
+ aHM.Line2.Column3 = rM4[1][2];
+ aHM.Line2.Column4 = rM4[1][3];
+ aHM.Line3.Column1 = rM4[2][0];
+ aHM.Line3.Column2 = rM4[2][1];
+ aHM.Line3.Column3 = rM4[2][2];
+ aHM.Line3.Column4 = rM4[2][3];
+ aHM.Line4.Column1 = rM4[3][0];
+ aHM.Line4.Column2 = rM4[3][1];
+ aHM.Line4.Column3 = rM4[3][2];
+ aHM.Line4.Column4 = rM4[3][3];
+ return aHM;
+}
+
+Matrix4D HomogenMatrixToMatrix4D(
+ const drawing::HomogenMatrix& rHM )
+{
+ Matrix4D aM4;
+ aM4[0][0] = rHM.Line1.Column1;
+ aM4[0][1] = rHM.Line1.Column2;
+ aM4[0][2] = rHM.Line1.Column3;
+ aM4[0][3] = rHM.Line1.Column4;
+ aM4[1][0] = rHM.Line2.Column1;
+ aM4[1][1] = rHM.Line2.Column2;
+ aM4[1][2] = rHM.Line2.Column3;
+ aM4[1][3] = rHM.Line2.Column4;
+ aM4[2][0] = rHM.Line3.Column1;
+ aM4[2][1] = rHM.Line3.Column2;
+ aM4[2][2] = rHM.Line3.Column3;
+ aM4[2][3] = rHM.Line3.Column4;
+ aM4[3][0] = rHM.Line4.Column1;
+ aM4[3][1] = rHM.Line4.Column2;
+ aM4[3][2] = rHM.Line4.Column3;
+ aM4[3][3] = rHM.Line4.Column4;
+ return aM4;
+}
+
+Matrix3D IgnoreZ( const Matrix4D& rM4 )
+{
+ Matrix3D aM3;
+ aM3[0][0] = rM4[0][0];
+ aM3[0][1] = rM4[0][1];
+ aM3[0][2] = rM4[0][3];
+ aM3[1][0] = rM4[1][0];
+ aM3[1][1] = rM4[1][1];
+ aM3[1][2] = rM4[1][3];
+ aM3[2][0] = rM4[3][0];
+ aM3[2][1] = rM4[3][1];
+ aM3[2][2] = rM4[3][3];
+ return aM3;
+}
+
+
+drawing::HomogenMatrix3 Matrix3DToHomogenMatrix3( const Matrix3D& rM3 )
+{
+ drawing::HomogenMatrix3 aHM;
+ aHM.Line1.Column1 = rM3[0][0];
+ aHM.Line1.Column2 = rM3[0][1];
+ aHM.Line1.Column3 = rM3[0][2];
+ aHM.Line2.Column1 = rM3[1][0];
+ aHM.Line2.Column2 = rM3[1][1];
+ aHM.Line2.Column3 = rM3[1][2];
+ aHM.Line3.Column1 = rM3[2][0];
+ aHM.Line3.Column2 = rM3[2][1];
+ aHM.Line3.Column3 = rM3[2][2];
+ return aHM;
+}
+
+Matrix3D HomogenMatrix3ToMatrix3D( const drawing::HomogenMatrix3& rHM )
+{
+ Matrix3D aM3;
+ aM3[0][0] = rHM.Line1.Column1;
+ aM3[0][1] = rHM.Line1.Column2;
+ aM3[0][2] = rHM.Line1.Column3;
+ aM3[1][0] = rHM.Line2.Column1;
+ aM3[1][1] = rHM.Line2.Column2;
+ aM3[1][2] = rHM.Line2.Column3;
+ aM3[2][0] = rHM.Line3.Column1;
+ aM3[2][1] = rHM.Line3.Column2;
+ aM3[2][2] = rHM.Line3.Column3;
+ return aM3;
+}
+
+Vector3D Position3DToVector3D( const drawing::Position3D& rPosition )
+{
+ return Vector3D(
+ rPosition.PositionX
+ , rPosition.PositionY
+ , rPosition.PositionZ
+ );
+}
+
+drawing::Direction3D Vector3DToDirection3D( const Vector3D& rVector)
+{
+ return drawing::Direction3D(
+ rVector.X()
+ , rVector.Y()
+ , rVector.Z()
+ );
+}
+
+/*
+drawing::PolyPolygonShape3D XPolygonToPolyPolygonShape3D( const XPolygon& rP )
+{
+ USHORT nPointCount = rP.GetPointCount();
+
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(nPointCount);
+ pOuterSequenceY->realloc(nPointCount);
+ pOuterSequenceZ->realloc(nPointCount);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ for(sal_Int32 nN = 0; nN < nPointCount; nN++)
+ {
+ *pInnerSequenceX++ = (double)rP[nN].X();
+ *pInnerSequenceY++ = (double)rP[nN].Y();
+ *pInnerSequenceZ++ = 0.0;
+ }
+ return aPP;
+}
+*/
+
+drawing::PolyPolygonShape3D MakeLine3D(
+ const drawing::Position3D & rStart,
+ const drawing::Position3D & rEnd )
+{
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ *pInnerSequenceX++ = rStart.PositionX;
+ *pInnerSequenceY++ = rStart.PositionY;
+ *pInnerSequenceZ++ = rStart.PositionZ;
+
+ *pInnerSequenceX++ = rEnd.PositionX;
+ *pInnerSequenceY++ = rEnd.PositionY;
+ *pInnerSequenceZ++ = rEnd.PositionZ;
+
+ return aPP;
+}
+
+void AddPointToPoly( drawing::PolyPolygonShape3D& rPoly, const drawing::Position3D& rPos, sal_Int32 nPolygonIndex )
+{
+ if(nPolygonIndex<0)
+ {
+ OSL_ENSURE( false, "The polygon index needs to be > 0");
+ nPolygonIndex=0;
+ }
+
+ //make sure that we have enough polygons
+ if(nPolygonIndex >= rPoly.SequenceX.getLength() )
+ {
+ rPoly.SequenceX.realloc(nPolygonIndex+1);
+ rPoly.SequenceY.realloc(nPolygonIndex+1);
+ rPoly.SequenceZ.realloc(nPolygonIndex+1);
+ }
+
+ drawing::DoubleSequence* pOuterSequenceX = &rPoly.SequenceX.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceY = &rPoly.SequenceY.getArray()[nPolygonIndex];
+ drawing::DoubleSequence* pOuterSequenceZ = &rPoly.SequenceZ.getArray()[nPolygonIndex];
+
+ sal_Int32 nOldPointCount = pOuterSequenceX->getLength();
+
+ pOuterSequenceX->realloc(nOldPointCount+1);
+ pOuterSequenceY->realloc(nOldPointCount+1);
+ pOuterSequenceZ->realloc(nOldPointCount+1);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ pInnerSequenceX[nOldPointCount] = rPos.PositionX;
+ pInnerSequenceY[nOldPointCount] = rPos.PositionY;
+ pInnerSequenceZ[nOldPointCount] = rPos.PositionZ;
+}
+
+void appendPoly( drawing::PolyPolygonShape3D& rRet, const drawing::PolyPolygonShape3D& rAdd )
+{
+ sal_Int32 nOuterCount = Max( rRet.SequenceX.getLength(), rAdd.SequenceX.getLength() );
+ rRet.SequenceX.realloc(nOuterCount);
+ rRet.SequenceY.realloc(nOuterCount);
+ rRet.SequenceZ.realloc(nOuterCount);
+
+ for( sal_Int32 nOuter=0;nOuter<nOuterCount;nOuter++ )
+ {
+ sal_Int32 nOldPointCount = rRet.SequenceX[nOuter].getLength();
+ sal_Int32 nAddPointCount = 0;
+ if(nOuter<rAdd.SequenceX.getLength())
+ nAddPointCount = rAdd.SequenceX[nOuter].getLength();
+ if(!nAddPointCount)
+ continue;
+
+ sal_Int32 nNewPointCount = nOldPointCount + nAddPointCount;
+
+ rRet.SequenceX[nOuter].realloc(nNewPointCount);
+ rRet.SequenceY[nOuter].realloc(nNewPointCount);
+ rRet.SequenceZ[nOuter].realloc(nNewPointCount);
+
+ sal_Int32 nPointTarget=nOldPointCount;
+ sal_Int32 nPointSource=nAddPointCount;
+ for( ; nPointSource-- ; nPointTarget++ )
+ {
+ rRet.SequenceX[nOuter][nPointTarget] = rAdd.SequenceX[nOuter][nPointSource];
+ rRet.SequenceY[nOuter][nPointTarget] = rAdd.SequenceY[nOuter][nPointSource];
+ rRet.SequenceZ[nOuter][nPointTarget] = rAdd.SequenceZ[nOuter][nPointSource];
+ }
+ }
+}
+
+/*
+drawing::PolyPolygonShape3D operator+(
+ const drawing::PolyPolygonShape3D& rPoly1
+ , const drawing::PolyPolygonShape3D& rPoly2 )
+{
+ drawing::PolyPolygonShape3D aRet;
+
+ sal_Int32 nOuterCount = Max( rPoly1.SequenceX.getLength(), rPoly2.SequenceX.getLength() );
+ aRet.SequenceX.realloc(nOuterCount);
+ aRet.SequenceY.realloc(nOuterCount);
+ aRet.SequenceZ.realloc(nOuterCount);
+
+ for( sal_Int32 nOuter=0;nOuter<nOuterCount;nOuter++ )
+ {
+ sal_Int32 nPointCount_1 = 0;
+ sal_Int32 nPointCount_2 = 0;
+ if(nOuter<rPoly1.SequenceX.getLength())
+ nPointCount_1 = rPoly1.SequenceX[nOuter].getLength();
+ if(nOuter<rPoly2.SequenceX.getLength())
+ nPointCount_2 = rPoly2.SequenceX[nOuter].getLength();
+
+ sal_Int32 nPointCount = nPointCount_1 + nPointCount_2;
+
+ aRet.SequenceX[nOuter].realloc(nPointCount);
+ aRet.SequenceY[nOuter].realloc(nPointCount);
+ aRet.SequenceZ[nOuter].realloc(nPointCount);
+
+ sal_Int32 nPointTarget=0;
+
+ {
+ sal_Int32 nPointSourceCount = nPointCount_1;
+ const drawing::PolyPolygonShape3D* pPoly = &rPoly1;
+ for( sal_Int32 nPointSource=0; nPointSource<nPointSourceCount ; nPointSource++,nPointTarget++ )
+ {
+ aRet.SequenceX[nOuter][nPointTarget] = pPoly->SequenceX[nOuter][nPointSource];
+ aRet.SequenceY[nOuter][nPointTarget] = pPoly->SequenceY[nOuter][nPointSource];
+ aRet.SequenceZ[nOuter][nPointTarget] = pPoly->SequenceZ[nOuter][nPointSource];
+ }
+ }
+ {
+ sal_Int32 nPointSourceCount = nPointCount_2;
+ const drawing::PolyPolygonShape3D* pPoly = &rPoly2;
+ for( sal_Int32 nPointSource=nPointSourceCount; nPointSource-- ; nPointTarget++ )
+ {
+ aRet.SequenceX[nOuter][nPointTarget] = pPoly->SequenceX[nOuter][nPointSource];
+ aRet.SequenceY[nOuter][nPointTarget] = pPoly->SequenceY[nOuter][nPointSource];
+ aRet.SequenceZ[nOuter][nPointTarget] = pPoly->SequenceZ[nOuter][nPointSource];
+ }
+ }
+ }
+ return aRet;
+}
+*/
+/*
+drawing::PolyPolygonShape3D operator+(
+ const drawing::PolyPolygonShape3D& rPoly1
+ , const drawing::PolyPolygonShape3D& rPoly2 )
+{
+ drawing::PolyPolygonShape3D aRet;
+
+ sal_Int32 nOuterCount = rPoly1.SequenceX.getLength()+rPoly2.SequenceX.getLength();
+ aRet.SequenceX.realloc(nOuterCount);
+ aRet.SequenceY.realloc(nOuterCount);
+ aRet.SequenceZ.realloc(nOuterCount);
+
+ drawing::DoubleSequence* pOuterSequenceX = aRet.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aRet.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aRet.SequenceZ.getArray();
+
+ for( sal_Int32 nOuterTarget=0;nOuterTarget<nOuterCount;nOuterTarget++ )
+ {
+ const drawing::PolyPolygonShape3D* pPoly = &rPoly1;
+ sal_Int32 nOuterSource = nOuterTarget;
+ if(nOuterTarget>=rPoly1.SequenceX.getLength())
+ {
+ pPoly = &rPoly2;
+ nOuterSource -= rPoly1.SequenceX.getLength();
+ }
+
+ sal_Int32 nPointCount = pPoly->SequenceX[nOuterSource].getLength();
+
+ pOuterSequenceX->realloc(nPointCount);
+ pOuterSequenceY->realloc(nPointCount);
+ pOuterSequenceZ->realloc(nPointCount);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ for( sal_Int32 nPoint=0;nPoint<nPointCount;nPoint++ )
+ {
+ *pInnerSequenceX = pPoly->SequenceX[nOuterSource][nPoint];
+ *pInnerSequenceY = pPoly->SequenceY[nOuterSource][nPoint];
+ *pInnerSequenceZ = pPoly->SequenceZ[nOuterSource][nPoint];
+
+ pInnerSequenceX++; pInnerSequenceY++; pInnerSequenceZ++;
+ }
+
+ pOuterSequenceX++; pOuterSequenceY++; pOuterSequenceZ++;
+ }
+ return aRet;
+}
+*/
+
+drawing::PointSequenceSequence PolyToPointSequence(
+ const drawing::PolyPolygonShape3D& rPolyPolygon )
+{
+ drawing::PointSequenceSequence aRet;
+ aRet.realloc( rPolyPolygon.SequenceX.getLength() );
+
+ for(sal_Int32 nN = 0; nN < rPolyPolygon.SequenceX.getLength(); nN++)
+ {
+ sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength();
+ aRet[nN].realloc( nInnerLength );
+ for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
+ {
+ aRet[nN][nM].X = static_cast<sal_Int32>(rPolyPolygon.SequenceX[nN][nM]);
+ aRet[nN][nM].Y = static_cast<sal_Int32>(rPolyPolygon.SequenceY[nN][nM]);
+ }
+ }
+ return aRet;
+}
+
+Polygon PolyToToolsPoly( const drawing::PolyPolygonShape3D& rPolyPolygon )
+{
+ sal_Int32 nOuterLength = rPolyPolygon.SequenceX.getLength();
+ if(!nOuterLength)
+ return Polygon();
+
+ sal_Int32 nNewSize = nOuterLength;
+ sal_Int32 nNewIndex = 0;
+ Polygon aRet(static_cast<USHORT>(nNewSize));
+
+ for(sal_Int32 nN = 0; nN < nOuterLength; nN++)
+ {
+ sal_Int32 nInnerLength = rPolyPolygon.SequenceX[nN].getLength();
+ nNewSize += nInnerLength-1,
+ aRet.SetSize(static_cast<USHORT>(nNewSize));
+ for( sal_Int32 nM = 0; nM < nInnerLength; nM++)
+ {
+ aRet.SetPoint( Point( static_cast<long>(rPolyPolygon.SequenceX[nN][nM])
+ , static_cast<long>(rPolyPolygon.SequenceY[nN][nM])
+ )
+ , static_cast<USHORT>(nNewIndex) );
+ nNewIndex++;
+ }
+ }
+ return aRet;
+}
+
+drawing::PolyPolygonShape3D ToolsPolyToPoly( const Polygon& rToolsPoly, double zValue )
+{
+ sal_Int32 nPointCount = rToolsPoly.GetSize();
+
+ drawing::PolyPolygonShape3D aPP;
+
+ aPP.SequenceX.realloc(1);
+ aPP.SequenceY.realloc(1);
+ aPP.SequenceZ.realloc(1);
+
+ drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
+ drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
+ drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
+
+ pOuterSequenceX->realloc(nPointCount);
+ pOuterSequenceY->realloc(nPointCount);
+ pOuterSequenceZ->realloc(nPointCount);
+
+ double* pInnerSequenceX = pOuterSequenceX->getArray();
+ double* pInnerSequenceY = pOuterSequenceY->getArray();
+ double* pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ for( sal_Int32 nN = 0; nN<nPointCount; nN++ )
+ {
+ const Point& rPos = rToolsPoly.GetPoint( static_cast<USHORT>(nN) );
+ *pInnerSequenceX++ = rPos.X();
+ *pInnerSequenceY++ = rPos.Y();
+ *pInnerSequenceZ++ = zValue;
+ }
+
+ return aPP;
+}
+
+drawing::Position3D operator+( const drawing::Position3D& rPos
+ , const drawing::Direction3D& rDirection)
+{
+ return drawing::Position3D(
+ rPos.PositionX + rDirection.DirectionX
+ , rPos.PositionY + rDirection.DirectionY
+ , rPos.PositionZ + rDirection.DirectionZ
+ );
+}
+
+drawing::Position3D operator-( const drawing::Position3D& rPos
+ , const drawing::Direction3D& rDirection)
+{
+ return drawing::Position3D(
+ rPos.PositionX - rDirection.DirectionX
+ , rPos.PositionY - rDirection.DirectionY
+ , rPos.PositionZ - rDirection.DirectionZ
+ );
+}
+
+drawing::Direction3D operator-( const drawing::Position3D& rPos1
+ , const drawing::Position3D& rPos2)
+{
+ return drawing::Direction3D(
+ rPos1.PositionX - rPos2.PositionX
+ , rPos1.PositionY - rPos2.PositionY
+ , rPos1.PositionZ - rPos2.PositionZ
+ );
+}
+
+drawing::Direction3D operator*( const drawing::Direction3D& rDirection
+ , double fFraction)
+{
+ return drawing::Direction3D(
+ fFraction*rDirection.DirectionX
+ , fFraction*rDirection.DirectionY
+ , fFraction*rDirection.DirectionZ
+ );
+}
+
+Vector3D SequenceToVector3D( const uno::Sequence< double >& rSeq )
+{
+ OSL_ENSURE(rSeq.getLength()==3,"The sequence needs to have length 3 for conversion into vector");
+
+ double x=rSeq.getLength()>0?rSeq[0]:0.0;
+ double y=rSeq.getLength()>1?rSeq[1]:0.0;
+ double z=rSeq.getLength()>2?rSeq[2]:0.0;
+
+ Vector3D aRet(x,y,z);
+ return aRet;
+}
+
+uno::Sequence< double > Vector3DToSequence( const Vector3D& rVector )
+{
+ uno::Sequence< double > aRet(3);
+ aRet[0] = rVector.X();
+ aRet[1] = rVector.Y();
+ aRet[2] = rVector.Z();
+ return aRet;
+}
+
+drawing::Position3D SequenceToPosition3D( const uno::Sequence< double >& rSeq )
+{
+ OSL_ENSURE(rSeq.getLength()==3,"The sequence needs to have length 3 for conversion into vector");
+
+ drawing::Position3D aRet;
+ aRet.PositionX = rSeq.getLength()>0?rSeq[0]:0.0;
+ aRet.PositionY = rSeq.getLength()>1?rSeq[1]:0.0;
+ aRet.PositionZ = rSeq.getLength()>2?rSeq[2]:0.0;
+ return aRet;
+}
+
+uno::Sequence< double > Position3DToSequence( const drawing::Position3D& rPosition )
+{
+ uno::Sequence< double > aRet(3);
+ aRet[0] = rPosition.PositionX;
+ aRet[1] = rPosition.PositionY;
+ aRet[2] = rPosition.PositionZ;
+ return aRet;
+}
+
+drawing::Direction3D SequenceToDirection3D( const uno::Sequence< double >& rSeq )
+{
+ drawing::Direction3D aRet;
+ aRet.DirectionX = rSeq.getLength()>0?rSeq[0]:0.0;
+ aRet.DirectionY = rSeq.getLength()>1?rSeq[1]:0.0;
+ aRet.DirectionZ = rSeq.getLength()>2?rSeq[2]:0.0;
+ return aRet;
+}
+
+uno::Sequence< double > Direction3DToSequence( const drawing::Direction3D& rDirection )
+{
+ uno::Sequence< double > aRet(3);
+ aRet[0] = rDirection.DirectionX;
+ aRet[1] = rDirection.DirectionY;
+ aRet[2] = rDirection.DirectionZ;
+ return aRet;
+}
+
+drawing::Direction3D operator/( const drawing::Direction3D& rDirection, double f )
+{
+ OSL_ENSURE(f,"a Direction3D is divided by NULL");
+ return drawing::Direction3D(
+ rDirection.DirectionX/f
+ , rDirection.DirectionY/f
+ , rDirection.DirectionZ/f
+ );
+}
+
+text::WritingMode WritingMode2ToWritingMode1( sal_Int16 nWritingMode2 )
+{
+ switch(nWritingMode2)
+ {
+ case text::WritingMode2::RL_TB:
+ return text::WritingMode_RL_TB;
+ case text::WritingMode2::TB_RL:
+ return text::WritingMode_TB_RL;
+ case text::WritingMode2::LR_TB:
+ return text::WritingMode_LR_TB;
+ default: // TL
+ return text::WritingMode_TB_RL;//there can no correct conversion be done here
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/ContextHelper.cxx b/chart2/source/tools/ContextHelper.cxx
new file mode 100644
index 000000000..abe516566
--- /dev/null
+++ b/chart2/source/tools/ContextHelper.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * $RCSfile: ContextHelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "ContextHelper.hxx"
+#include <cppuhelper/component_context.hxx>
+
+#include <vector>
+
+using namespace ::com::sun::star;
+
+namespace chart
+{
+
+namespace ContextHelper
+{
+
+uno::Reference< uno::XComponentContext >
+ createContext(
+ const tContextEntryMapType & rMap,
+ const uno::Reference< uno::XComponentContext > & rDelegateContext )
+{
+ ::std::vector< ::cppu::ContextEntry_Init > aVec( rMap.size());
+ for( tContextEntryMapType::const_iterator aIt = rMap.begin();
+ aIt != rMap.end();
+ ++aIt )
+ {
+ aVec.push_back( ::cppu::ContextEntry_Init( (*aIt).first, (*aIt).second) );
+ }
+
+ return ::cppu::createComponentContext( & aVec[0], aVec.size(), rDelegateContext );
+}
+
+} // namespace ContextHelper
+
+} // namespace chart
diff --git a/chart2/source/tools/ImplOPropertySet.cxx b/chart2/source/tools/ImplOPropertySet.cxx
new file mode 100644
index 000000000..517d11504
--- /dev/null
+++ b/chart2/source/tools/ImplOPropertySet.cxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * $RCSfile: ImplOPropertySet.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "ImplOPropertySet.hxx"
+
+#include <algorithm>
+#include <functional>
+
+#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#endif
+
+using namespace ::com::sun::star;
+
+namespace
+{
+
+struct lcl_getPropertyStateByHandle :
+ public ::std::unary_function< beans::PropertyState, sal_Int32 >
+{
+ lcl_getPropertyStateByHandle(
+ const ::property::impl::ImplOPropertySet::tPropertyMap & rMap )
+ : m_rMap( rMap )
+ {}
+
+ inline beans::PropertyState operator() ( sal_Int32 nHandle )
+ {
+ if( m_rMap.end() == m_rMap.find( nHandle ))
+ return beans::PropertyState_DEFAULT_VALUE;
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+
+private:
+ const ::property::impl::ImplOPropertySet::tPropertyMap & m_rMap;
+};
+
+template< typename K, typename V >
+struct lcl_eraseMapEntry :
+ public ::std::unary_function< void, K >
+{
+ lcl_eraseMapEntry( ::std::map< K, V > & rMap )
+ : m_rMap( rMap )
+ {}
+
+ inline void operator() ( const K & aKey )
+ {
+ m_rMap.erase( aKey );
+ }
+
+private:
+ ::std::map< K, V > m_rMap;
+};
+
+} // anonymous namespace
+
+namespace property
+{
+namespace impl
+{
+
+ImplOPropertySet::ImplOPropertySet()
+{}
+
+beans::PropertyState ImplOPropertySet::GetPropertyStateByHandle( sal_Int32 nHandle ) const
+{
+ return lcl_getPropertyStateByHandle( m_aProperties ) ( nHandle );
+}
+
+uno::Sequence< beans::PropertyState > ImplOPropertySet::GetPropertyStatesByHandle(
+ const ::std::vector< sal_Int32 > & aHandles ) const
+{
+ uno::Sequence< beans::PropertyState > aResult( aHandles.size());
+
+ ::std::transform( aHandles.begin(), aHandles.end(),
+ aResult.getArray(),
+ lcl_getPropertyStateByHandle( m_aProperties ));
+
+ return aResult;
+}
+
+void ImplOPropertySet::SetPropertyToDefault( sal_Int32 nHandle )
+{
+ tPropertyMap::iterator aFoundIter( m_aProperties.find( nHandle ) );
+
+ if( m_aProperties.end() != aFoundIter )
+ {
+ m_aProperties.erase( aFoundIter );
+ }
+}
+
+void ImplOPropertySet::SetPropertiesToDefault(
+ const ::std::vector< sal_Int32 > & aHandles )
+{
+ ::std::for_each( aHandles.begin(), aHandles.end(),
+ lcl_eraseMapEntry< sal_Int32, uno::Any >( m_aProperties ) );
+}
+
+void ImplOPropertySet::SetAllPropertiesToDefault()
+{
+ m_aProperties.clear();
+}
+
+bool ImplOPropertySet::GetPropertyValueByHandle(
+ uno::Any & rValue,
+ sal_Int32 nHandle ) const
+{
+ bool bResult = false;
+
+ tPropertyMap::const_iterator aFoundIter( m_aProperties.find( nHandle ) );
+
+ if( m_aProperties.end() != aFoundIter )
+ {
+ rValue = (*aFoundIter).second;
+ bResult = true;
+ }
+
+ return bResult;
+}
+
+void ImplOPropertySet::SetPropertyValueByHandle(
+ sal_Int32 nHandle, const uno::Any & rValue, uno::Any * pOldValue )
+{
+ if( pOldValue != NULL )
+ {
+ tPropertyMap::const_iterator aFoundIter( m_aProperties.find( nHandle ) );
+ if( m_aProperties.end() != aFoundIter )
+ (*pOldValue) = (*aFoundIter).second;
+ }
+
+ m_aProperties[ nHandle ] = rValue;
+}
+
+bool ImplOPropertySet::SetStyle( const uno::Reference< style::XStyle > & xStyle )
+{
+ if( ! xStyle.is())
+ return false;
+
+ m_xStyle = xStyle;
+ return true;
+}
+
+uno::Reference< style::XStyle > ImplOPropertySet::GetStyle() const
+{
+ return m_xStyle;
+}
+
+
+} // namespace impl
+} // namespace chart
diff --git a/chart2/source/tools/ImplOPropertySet.hxx b/chart2/source/tools/ImplOPropertySet.hxx
new file mode 100644
index 000000000..e598b4686
--- /dev/null
+++ b/chart2/source/tools/ImplOPropertySet.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * $RCSfile: ImplOPropertySet.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CHART_IMPLOPROPERTYSET_HXX
+#define CHART_IMPLOPROPERTYSET_HXX
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HPP_
+#include <com/sun/star/beans/PropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
+#include <com/sun/star/style/XStyle.hpp>
+#endif
+
+#include <map>
+#include <vector>
+
+namespace property
+{
+namespace impl
+{
+
+class ImplOPropertySet
+{
+public:
+ ImplOPropertySet();
+
+ /** supports states DIRECT_VALUE and DEFAULT_VALUE
+ */
+ ::com::sun::star::beans::PropertyState
+ GetPropertyStateByHandle( sal_Int32 nHandle ) const;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState >
+ GetPropertyStatesByHandle( const ::std::vector< sal_Int32 > & aHandles ) const;
+
+ void SetPropertyToDefault( sal_Int32 nHandle );
+ void SetPropertiesToDefault( const ::std::vector< sal_Int32 > & aHandles );
+ void SetAllPropertiesToDefault();
+
+ /** @param rValue is set to the value for the property given in nHandle. If
+ the property is not set, the style chain is searched for any
+ instance set there. If there was no value found either in the
+ property set itself or any of its styles, rValue remains
+ unchanged and false is returned.
+
+ @return false if the property is default, true otherwise.
+ */
+ bool GetPropertyValueByHandle(
+ ::com::sun::star::uno::Any & rValue,
+ sal_Int32 nHandle ) const;
+
+ void SetPropertyValueByHandle( sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any & rValue,
+ ::com::sun::star::uno::Any * pOldValue = NULL );
+
+ bool SetStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > & xStyle );
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
+ GetStyle() const;
+
+ typedef
+ ::std::map< sal_Int32, ::com::sun::star::uno::Any >
+ tPropertyMap;
+
+private:
+ tPropertyMap m_aProperties;
+ ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >
+ m_xStyle;
+};
+
+} // namespace impl
+} // namespace chart
+
+// CHART_IMPLOPROPERTYSET_HXX
+#endif
diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx
new file mode 100644
index 000000000..b3027f3d5
--- /dev/null
+++ b/chart2/source/tools/LegendHelper.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: LegendHelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "LegendHelper.hxx"
+#include "macros.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+rtl::OUString LegendHelper::getIdentifierForLegend()
+{
+ static rtl::OUString m_aIdentifier( C2U( "@legend" ) );
+ return m_aIdentifier;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx
new file mode 100644
index 000000000..1a45acc66
--- /dev/null
+++ b/chart2/source/tools/LifeTime.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * $RCSfile: LifeTime.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "LifeTime.hxx"
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+/*
+#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
+#include <com/sun/star/lang/XEventListener.hpp>
+#endif
+*/
+
+using namespace ::com::sun::star;
+
+namespace apphelper
+{
+//--------------------------
+
+LifeTimeManager::LifeTimeManager( lang::XComponent* pComponent, sal_Bool bLongLastingCallsCancelable )
+ : m_aListenerContainer( m_aAccessMutex )
+ , m_pComponent(pComponent)
+ , m_bLongLastingCallsCancelable(bLongLastingCallsCancelable)
+{
+ impl_init();
+}
+
+void LifeTimeManager::impl_init()
+{
+ m_bDisposed = sal_False;
+ m_bInDispose = sal_False;
+ m_nAccessCount = 0;
+ m_nLongLastingCallCount = 0;
+ m_aNoAccessCountCondition.set();
+ m_aNoLongLastingCallCountCondition.set();
+}
+
+LifeTimeManager::~LifeTimeManager()
+{
+}
+
+ sal_Bool LifeTimeManager
+::impl_isDisposed()
+{
+ if( m_bDisposed || m_bInDispose )
+ {
+ OSL_ENSURE( sal_False, "This component is already disposed " );
+ return sal_True;
+ }
+ return sal_False;
+}
+ sal_Bool LifeTimeManager
+::impl_canStartApiCall()
+{
+ if( impl_isDisposed() )
+ return sal_False; //behave passive if already disposed
+
+ //mutex is acquired
+ return sal_True;
+}
+
+ void LifeTimeManager
+::impl_registerApiCall(sal_Bool bLongLastingCall)
+{
+ //only allowed if not disposed
+ //do not acquire the mutex here because it will be acquired already
+ m_nAccessCount++;
+ if(m_nAccessCount==1)
+ //@todo? is it ok to wake some threads here while we have acquired the mutex?
+ m_aNoAccessCountCondition.reset();
+
+ if(bLongLastingCall)
+ m_nLongLastingCallCount++;
+ if(m_nLongLastingCallCount==1)
+ m_aNoLongLastingCallCountCondition.reset();
+}
+ void LifeTimeManager
+::impl_unregisterApiCall(sal_Bool bLongLastingCall)
+{
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+
+ OSL_ENSURE( m_nAccessCount>0, "access count mismatch" );
+ m_nAccessCount--;
+ if(bLongLastingCall)
+ m_nLongLastingCallCount--;
+ if( m_nLongLastingCallCount==0 )
+ {
+ m_aNoLongLastingCallCountCondition.set();
+ }
+ if( m_nAccessCount== 0)
+ {
+ m_aNoAccessCountCondition.set();
+ impl_apiCallCountReachedNull();
+
+ }
+}
+
+ sal_Bool LifeTimeManager
+::dispose() throw(uno::RuntimeException)
+{
+ //hold no mutex
+ {
+ osl::Guard< osl::Mutex > aGuard( m_aAccessMutex );
+
+ if( m_bDisposed || m_bInDispose )
+ {
+ OSL_ENSURE( sal_False, "This component is already disposed " );
+ return sal_False; //behave passive if already disposed
+ }
+
+ m_bInDispose = true;
+ //adding any listener is not allowed anymore
+ //new calls will not be accepted
+ //still running calls have the freedom to finish their work without crash
+ }
+ //no mutex is acquired
+
+ //--do the disposing of listeners after calling this method
+ {
+ uno::Reference< lang::XComponent > xComponent =
+ uno::Reference< lang::XComponent >(m_pComponent);;
+ if(xComponent.is())
+ {
+ ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer(
+ ::getCppuType((const uno::Reference< lang::XEventListener >*)0) );
+ if( pIC )
+ {
+ lang::EventObject aEvent( xComponent );
+ pIC->disposeAndClear( aEvent );
+ }
+ }
+ }
+
+ //no mutex is acquired
+ {
+ osl::ClearableGuard< osl::Mutex > aGuard( m_aAccessMutex );
+ OSL_ENSURE( !m_bDisposed, "dispose was called already" );
+ m_bDisposed = sal_True;
+ aGuard.clear();
+ }
+ //no mutex is acquired
+
+ //wait until all still running calls have finished
+ //the accessCount cannot grow anymore, because all calls will return after checking m_bDisposed
+ m_aNoAccessCountCondition.wait();
+
+ //we are the only ones working on our data now
+
+ return sal_True;
+ //--release all resources and references after calling this method successful
+}
+
+//-----------------------------------------------------------------
+
+CloseableLifeTimeManager::CloseableLifeTimeManager( ::com::sun::star::util::XCloseable* pCloseable
+ , ::com::sun::star::lang::XComponent* pComponent
+ , sal_Bool bLongLastingCallsCancelable )
+ : LifeTimeManager( pComponent, bLongLastingCallsCancelable )
+ , m_pCloseable(pCloseable)
+{
+ impl_init();
+}
+
+CloseableLifeTimeManager::~CloseableLifeTimeManager()
+{
+}
+
+ sal_Bool CloseableLifeTimeManager
+::impl_isDisposedOrClosed()
+{
+ if( impl_isDisposed() )
+ return sal_True;
+
+ if( m_bClosed )
+ {
+ OSL_ENSURE( sal_False, "This object is already closed" );
+ return sal_True;
+ }
+ return sal_False;
+}
+
+ sal_Bool CloseableLifeTimeManager
+::g_close_startTryClose(sal_Bool bDeliverOwnership)
+ throw ( uno::Exception )
+{
+ //no mutex is allowed to be acquired
+ {
+ osl::ResettableGuard< osl::Mutex > aGuard( m_aAccessMutex );
+
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ if( !impl_canStartApiCall() )
+ return sal_False;
+ //mutex is acquired
+
+ //not closed already -> we try to close again
+ m_bInTryClose = sal_True;
+ m_aEndTryClosingCondition.reset();
+
+ impl_registerApiCall(sal_False);
+ }
+
+ //------------------------------------------------
+ //no mutex is acquired
+
+ //only remove listener calls will be worked on until end of tryclose
+ //all other new calls will wait till end of try close // @todo? is that really ok
+
+ //?? still running calls have the freedom to finish their work without crash
+
+ try
+ {
+ uno::Reference< util::XCloseable > xCloseable =
+ uno::Reference< util::XCloseable >(m_pCloseable);;
+ if(xCloseable.is())
+ {
+ //--call queryClosing on all registered close listeners
+ ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer(
+ ::getCppuType((const uno::Reference< util::XCloseListener >*)0) );;
+ if( pIC )
+ {
+ //lang::EventObject aEvent( static_cast< util::XCloseable*>(xCloseable) );
+ lang::EventObject aEvent( xCloseable );
+ ::cppu::OInterfaceIteratorHelper aIt( *pIC );
+ while( aIt.hasMoreElements() )
+ (static_cast< util::XCloseListener*>(aIt.next()))->queryClosing( aEvent, bDeliverOwnership );
+ }
+ }
+ }
+ catch( uno::Exception& ex )
+ {
+ //no mutex is acquired
+ g_close_endTryClose(bDeliverOwnership, sal_False, ex);
+ //the exception is thrown in the above method
+ }
+ return sal_True;
+}
+
+ void CloseableLifeTimeManager
+::g_close_endTryClose(sal_Bool bDeliverOwnership, sal_Bool bMyVeto, uno::Exception& ex)
+ throw ( uno::Exception )
+{
+ //this method is called, if the try to close was not successfull
+ osl::Guard< osl::Mutex > aGuard( m_aAccessMutex );
+ impl_setOwnership( bDeliverOwnership, sal_False );
+
+ m_bInTryClose = sal_False;
+ m_aEndTryClosingCondition.set();
+
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ impl_unregisterApiCall(sal_False);
+
+ //this exception must be thrown to the caller
+ throw ex;
+}
+
+ sal_Bool CloseableLifeTimeManager
+::g_close_isNeedToCancelLongLastingCalls( sal_Bool bDeliverOwnership, uno::Exception& ex )
+ throw ( uno::Exception )
+{
+ //this method is called when no closelistener has had a veto during queryclosing
+ //the method returns false, if nothing stands against closing anymore
+ //it returns true, if some longlasting calls are running, which might be cancelled
+ //it throws the given exception, if long calls are running but not cancelable
+
+ osl::Guard< osl::Mutex > aGuard( m_aAccessMutex );
+ //this count cannot grow after try of close has started, because we wait in all those methods for end of try closing
+ if( !m_nLongLastingCallCount )
+ return sal_False;
+
+ if(m_bLongLastingCallsCancelable)
+ return sal_True;
+
+ impl_setOwnership( bDeliverOwnership, sal_True );
+
+ m_bInTryClose = sal_False;
+ m_aEndTryClosingCondition.set();
+
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ impl_unregisterApiCall(sal_False);
+
+ throw ex;
+}
+
+ void CloseableLifeTimeManager
+::g_close_endTryClose_doClose()
+{
+ //this method is called, if the try to close was successfull
+ osl::ResettableGuard< osl::Mutex > aGuard( m_aAccessMutex );
+
+ m_bInTryClose = sal_False;
+ m_aEndTryClosingCondition.set();
+
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ impl_unregisterApiCall(sal_False);
+ impl_doClose();
+}
+
+ void CloseableLifeTimeManager
+::impl_setOwnership( sal_Bool bDeliverOwnership, sal_Bool bMyVeto )
+{
+ m_bOwnership = bDeliverOwnership && bMyVeto;
+ m_bOwnershipIsWellKnown = sal_True;
+}
+ sal_Bool CloseableLifeTimeManager
+::impl_shouldCloseAtNextChance()
+{
+ return m_bOwnership;
+}
+
+ void CloseableLifeTimeManager
+::impl_apiCallCountReachedNull()
+{
+ //Mutex needs to be acquired exactly ones
+ //mutex will be released inbetween in impl_doClose()
+ if( m_pCloseable && impl_shouldCloseAtNextChance() )
+ impl_doClose();
+}
+
+ void CloseableLifeTimeManager
+::impl_doClose()
+{
+ //Mutex needs to be acquired exactly ones before calling impl_doClose()
+
+ if(m_bClosed)
+ return; //behave as passive as possible, if disposed or closed already
+ if( m_bDisposed || m_bInDispose )
+ return; //behave as passive as possible, if disposed or closed already
+
+ //--------
+ m_bClosed = sal_True;
+
+ NegativeGuard< osl::Mutex > aNegativeGuard( m_aAccessMutex );
+ //mutex is not acquired, mutex will be reacquired at the end of this method automatically
+
+ uno::Reference< util::XCloseable > xCloseable=NULL;
+ try
+ {
+ xCloseable = uno::Reference< util::XCloseable >(m_pCloseable);;
+ if(xCloseable.is())
+ {
+ //--call notifyClosing on all registered close listeners
+ ::cppu::OInterfaceContainerHelper* pIC = m_aListenerContainer.getContainer(
+ ::getCppuType((const uno::Reference< util::XCloseListener >*)0) );;
+ if( pIC )
+ {
+ //lang::EventObject aEvent( static_cast< util::XCloseable*>(xCloseable) );
+ lang::EventObject aEvent( xCloseable );
+ ::cppu::OInterfaceIteratorHelper aIt( *pIC );
+ while( aIt.hasMoreElements() )
+ (static_cast< util::XCloseListener*>(aIt.next()))->notifyClosing( aEvent );
+ }
+ }
+ }
+ catch( uno::Exception& ex )
+ {
+ OSL_ENSURE( sal_False, "Exception during notifyClosing of XCloseListener" );
+ }
+
+ if(xCloseable.is())
+ {
+ uno::Reference< lang::XComponent > xComponent =
+ uno::Reference< lang::XComponent >( xCloseable, uno::UNO_QUERY );
+ if(xComponent.is())
+ {
+ OSL_ENSURE( m_bClosed, "a not closed component will be disposed " );
+ xComponent->dispose();
+ }
+ }
+ //mutex will be reacquired in destructor of aNegativeGuard
+}
+
+ sal_Bool CloseableLifeTimeManager
+::g_addCloseListener( const uno::Reference< util::XCloseListener > & xListener )
+ throw(uno::RuntimeException)
+{
+ osl::Guard< osl::Mutex > aGuard( m_aAccessMutex );
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ if( !impl_canStartApiCall() )
+ return sal_False;
+ //mutex is acquired
+
+ m_aListenerContainer.addInterface( ::getCppuType((const uno::Reference< util::XCloseListener >*)0),xListener );
+ m_bOwnership = sal_False;
+ return sal_True;
+}
+
+ sal_Bool CloseableLifeTimeManager
+::impl_canStartApiCall()
+{
+ //Mutex needs to be acquired exactly ones before calling this method
+ //the mutex will be released inbetween and reacquired
+
+ if( impl_isDisposed() )
+ return sal_False; //behave passive if already disposed
+ if( m_bClosed )
+ return sal_False; //behave passive if closing is already done
+
+ //during try-close most calls need to wait for the decision
+ while( m_bInTryClose )
+ {
+ //if someone tries to close this object at the moment
+ //we need to wait for his end because the result of the preceding call
+ //is relevant for our behaviour here
+
+ m_aAccessMutex.release();
+ m_aEndTryClosingCondition.wait(); //@todo??? this may block??? try closing
+ m_aAccessMutex.acquire();
+ if( m_bDisposed || m_bInDispose || m_bClosed )
+ return sal_False; //return if closed already
+ }
+ //mutex is acquired
+ return sal_True;
+}
+
+//--------------------------
+
+ sal_Bool LifeTimeGuard
+::startApiCall(sal_Bool bLongLastingCall)
+{
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ //mutex is requiered due to constructor of LifeTimeGuard
+
+ OSL_ENSURE( !m_bCallRegistered, "this method is only allowed ones" );
+ if(m_bCallRegistered)
+ return sal_False;
+
+ //Mutex needs to be acquired exactly ones; will be released inbetween
+ if( !m_rManager.impl_canStartApiCall() )
+ return sal_False;
+ //mutex is acquired
+
+ m_bCallRegistered = sal_True;
+ m_bLongLastingCallRegistered = bLongLastingCall;
+ m_rManager.impl_registerApiCall(bLongLastingCall);
+ return sal_True;
+}
+
+LifeTimeGuard::~LifeTimeGuard()
+{
+ try
+ {
+ //do acquire the mutex if it was cleared before
+ if(!pT)
+ reset();
+ if(m_bCallRegistered)
+ {
+ //Mutex needs to be acquired exactly ones
+ //mutex may be released inbetween in special case of impl_apiCallCountReachedNull()
+ m_rManager.impl_unregisterApiCall(m_bLongLastingCallRegistered);
+ }
+ }
+ catch( uno::Exception& ex )
+ {
+ //@todo ? allow a uno::RuntimeException from dispose to travel through??
+ }
+}
+
+/*
+the XCloseable::close method has to be implemented in the following way:
+::close
+{
+ //hold no mutex
+
+ if( !m_aLifeTimeManager.g_close_startTryClose( bDeliverOwnership ) )
+ return;
+ //no mutex is acquired
+
+ // At the end of this method may we must dispose ourself ...
+ // and may nobody from outside hold a reference to us ...
+ // then it's a good idea to do that by ourself.
+ uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
+
+ //the listeners have had no veto
+ //check wether we self can close
+ {
+ util::CloseVetoException aVetoException = util::CloseVetoException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "the model itself could not be closed" ) )
+ , static_cast< ::cppu::OWeakObject* >(this));
+
+ if( m_aLifeTimeManager.g_close_isNeedToCancelLongLastingCalls( bDeliverOwnership, aVetoException) )
+ {
+ ////you can empty this block, if you never start longlasting calls or
+ ////if your longlasting calls are per default not cancelable (check how you have constructed your LifeTimeManager)
+
+ sal_Bool bLongLastingCallsAreCanceled = sal_False;
+ try
+ {
+ //try to cancel running longlasting calls
+ //// @todo
+ }
+ catch( uno::Exception& ex )
+ {
+ //// @todo
+ //do not throw anything here!! (without endTryClose)
+ }
+ //if not successful canceled
+ if(!bLongLastingCallsAreCanceled)
+ {
+ m_aLifeTimeManager.g_close_endTryClose(bDeliverOwnership, sal_True, aVetoException);
+ //the exception is thrown in the above method
+ }
+ }
+
+ }
+ m_aLifeTimeManager.g_close_endTryClose_doClose();
+}
+*/
+
+}//end namespace apphelper
diff --git a/chart2/source/tools/MediaDescriptorHelper.cxx b/chart2/source/tools/MediaDescriptorHelper.cxx
new file mode 100644
index 000000000..251eaefef
--- /dev/null
+++ b/chart2/source/tools/MediaDescriptorHelper.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * $RCSfile: MediaDescriptorHelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "MediaDescriptorHelper.hxx"
+
+using namespace ::com::sun::star;
+
+namespace apphelper
+{
+
+
+const short FLAG_DEPRECATED =1;
+const short FLAG_MODEL =2;
+
+#define WRITE_PROPERTY( MediaName, nFlags ) \
+if(rProp.Name.equals(::rtl::OUString::createFromAscii(#MediaName))) \
+{ \
+ if( rProp.Value >>= MediaName ) \
+ ISSET_##MediaName = sal_True; \
+ if(nFlags & FLAG_DEPRECATED) \
+ { \
+ m_aDeprecatedProperties[nDeprecatedCount]=rProp;\
+ nDeprecatedCount++; \
+ } \
+ else \
+ { \
+ m_aRegularProperties[nRegularCount]=rProp; \
+ nRegularCount++; \
+ if( nFlags & FLAG_MODEL) \
+ { \
+ m_aModelProperties[nModelCount]=rProp; \
+ nModelCount++; \
+ } \
+ } \
+}
+
+MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence<
+ beans::PropertyValue > & rMediaDescriptor )
+{
+ impl_init();
+
+ m_aRegularProperties.realloc(0);
+ m_aRegularProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nRegularCount = 0;
+
+ m_aDeprecatedProperties.realloc(0);
+ m_aDeprecatedProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nDeprecatedCount = 0;
+
+ m_aAdditionalProperties.realloc(0);
+ m_aAdditionalProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nAdditionalCount = 0;
+
+ m_aModelProperties.realloc(0);
+ m_aModelProperties.realloc(rMediaDescriptor.getLength());
+ sal_Int32 nModelCount = 0;
+
+
+ //read given rMediaDescriptor and store in internal structures:
+ for( sal_Int32 i= rMediaDescriptor.getLength();i--;)
+ {
+ const beans::PropertyValue& rProp = rMediaDescriptor[i];
+ WRITE_PROPERTY( AsTemplate, FLAG_MODEL )
+ else WRITE_PROPERTY( Author, FLAG_MODEL )
+ else WRITE_PROPERTY( CharacterSet, FLAG_MODEL )
+ else WRITE_PROPERTY( Comment, FLAG_MODEL )
+ else WRITE_PROPERTY( ComponentData, FLAG_MODEL )
+ else WRITE_PROPERTY( FileName, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( FilterData, FLAG_MODEL )
+ else WRITE_PROPERTY( FilterName, FLAG_MODEL )
+ else WRITE_PROPERTY( FilterFlags, FLAG_DEPRECATED)
+ else WRITE_PROPERTY( FilterOptions, FLAG_MODEL )
+ else WRITE_PROPERTY( FrameName, FLAG_MODEL )
+ else WRITE_PROPERTY( Hidden, FLAG_MODEL )
+ else WRITE_PROPERTY( InputStream, 0 )
+ else WRITE_PROPERTY( InteractionHandler, 0 )
+ else WRITE_PROPERTY( JumpMark, 0 )
+ else WRITE_PROPERTY( MediaType, FLAG_MODEL )
+ else WRITE_PROPERTY( OpenFlags, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( OpenNewView, 0 )
+ else WRITE_PROPERTY( Overwrite, FLAG_MODEL )
+ else WRITE_PROPERTY( Password, FLAG_MODEL )
+ else WRITE_PROPERTY( PosSize, 0 )
+ else WRITE_PROPERTY( PostData, 0 )
+ else WRITE_PROPERTY( PostString, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( Preview, FLAG_MODEL )
+ else WRITE_PROPERTY( ReadOnly, 0 )
+ else WRITE_PROPERTY( Referer, FLAG_MODEL )
+ else WRITE_PROPERTY( Silent, 0 )
+ else WRITE_PROPERTY( StatusIndicator, 0 )
+ else WRITE_PROPERTY( TemplateName, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( TemplateRegionName, FLAG_DEPRECATED )
+ else WRITE_PROPERTY( Unpacked, FLAG_MODEL )
+ else WRITE_PROPERTY( URL, FLAG_MODEL )
+ else WRITE_PROPERTY( Version, FLAG_MODEL )
+ else WRITE_PROPERTY( ViewData, FLAG_MODEL )
+ else WRITE_PROPERTY( ViewId, FLAG_MODEL )
+ else
+ {
+ m_aAdditionalProperties[nAdditionalCount]=rProp;
+ nAdditionalCount++;
+ }
+ }
+
+ m_aRegularProperties.realloc(nRegularCount);
+ m_aDeprecatedProperties.realloc(nDeprecatedCount);
+ m_aAdditionalProperties.realloc(nAdditionalCount);
+ m_aModelProperties.realloc(nModelCount);
+}
+
+void MediaDescriptorHelper::impl_init()
+{
+ AsTemplate = sal_False;
+ ISSET_AsTemplate = sal_False;
+
+ ISSET_Author = sal_False;
+ ISSET_CharacterSet = sal_False;
+ ISSET_Comment = sal_False;
+
+// ::com::sun::star::uno::Any ComponentData;
+ ISSET_ComponentData = sal_False;
+ ISSET_FileName = sal_False;
+
+// ::com::sun::star::uno::Any FilterData;
+ ISSET_FilterData = sal_False;
+ ISSET_FilterName = sal_False;
+ ISSET_FilterFlags = sal_False;
+ ISSET_FilterOptions = sal_False;
+ ISSET_FrameName = sal_False;
+
+ Hidden = sal_False;
+ ISSET_Hidden = sal_False;
+ ISSET_InputStream = sal_False;
+ ISSET_InteractionHandler = sal_False;
+ ISSET_JumpMark = sal_False;
+ ISSET_MediaType = sal_False;
+ ISSET_OpenFlags = sal_False;
+ OpenNewView = sal_False;
+ ISSET_OpenNewView = sal_False;
+ Overwrite = sal_False;
+ ISSET_Overwrite = sal_False;
+ ISSET_Password = sal_False;
+
+// ::com::sun::star::awt::Rectangle PosSize;
+ ISSET_PosSize = sal_False;
+
+// ::com::sun::star::uno::Sequence< sal_Int8 > PostData;
+ ISSET_PostData = sal_False;
+ ISSET_PostString = sal_False;
+ Preview = sal_False;
+ ISSET_Preview = sal_False;
+ ReadOnly = sal_False;
+ ISSET_ReadOnly = sal_False;
+ ISSET_Referer = sal_False;
+ ISSET_StatusIndicator = sal_False;
+ Silent = sal_False;
+ ISSET_Silent = sal_False;
+ ISSET_TemplateName = sal_False;
+ ISSET_TemplateRegionName = sal_False;
+ Unpacked = sal_False;
+ ISSET_Unpacked = sal_False;
+ ISSET_URL = sal_False;
+ Version = 0;
+ ISSET_Version = sal_False;
+
+// ::com::sun::star::uno::Any ViewData;
+ ISSET_ViewData = sal_False;
+ ViewId = 0;
+ ISSET_ViewId = sal_False;
+}
+
+MediaDescriptorHelper::~MediaDescriptorHelper()
+{
+
+}
+
+ uno::Sequence< beans::PropertyValue > MediaDescriptorHelper
+::getAll()
+{
+ uno::Sequence< beans::PropertyValue > aAll( m_aRegularProperties );
+ //write properties to aAll
+ if( m_aDeprecatedProperties.getLength() )
+ {
+ sal_Int32 nCount = m_aRegularProperties.getLength();
+ m_aRegularProperties.realloc( nCount + m_aDeprecatedProperties.getLength());
+ for(sal_Int32 i=0;i<m_aDeprecatedProperties.getLength();i++)
+ aAll[nCount+i]=m_aDeprecatedProperties[i];
+ }
+ if( m_aAdditionalProperties.getLength() )
+ {
+ sal_Int32 nCount = m_aRegularProperties.getLength();
+ m_aRegularProperties.realloc(nCount + m_aAdditionalProperties.getLength());
+ for(sal_Int32 i=0;i<m_aAdditionalProperties.getLength();i++)
+ aAll[nCount+i]=m_aAdditionalProperties[i];
+ }
+ return aAll;
+}
+ uno::Sequence< beans::PropertyValue > MediaDescriptorHelper
+::getReducedForModel()
+{
+ return m_aModelProperties;
+}
+}
diff --git a/chart2/source/tools/MutexContainer.cxx b/chart2/source/tools/MutexContainer.cxx
new file mode 100644
index 000000000..9a2f5c5fa
--- /dev/null
+++ b/chart2/source/tools/MutexContainer.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: MutexContainer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "MutexContainer.hxx"
+
+namespace chart
+{
+namespace helper
+{
+
+MutexContainer::~MutexContainer()
+{}
+
+::osl::Mutex & MutexContainer::GetMutex() const
+{
+ return m_aMutex;
+}
+
+} // namespace helper
+} // namespace chart
diff --git a/chart2/source/tools/OEnumeration.cxx b/chart2/source/tools/OEnumeration.cxx
new file mode 100644
index 000000000..918b6a03e
--- /dev/null
+++ b/chart2/source/tools/OEnumeration.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: OEnumeration.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "OEnumeration.hxx"
+
+using namespace ::com::sun::star;
+
+namespace comphelper
+{
+
+OEnumeration::OEnumeration(
+ const ::std::vector< uno::Any > & rContainer ) :
+ m_aContainer( rContainer ),
+ m_aIter( m_aContainer.begin() )
+{}
+
+OEnumeration::~OEnumeration()
+{}
+
+sal_Bool SAL_CALL OEnumeration::hasMoreElements()
+ throw (uno::RuntimeException)
+{
+ return ! m_aContainer.empty();
+}
+
+uno::Any SAL_CALL OEnumeration::nextElement()
+ throw (container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ if( m_aIter == m_aContainer.end())
+ throw container::NoSuchElementException();
+
+ return *m_aIter++;
+}
+
+
+} // namespace comphelper
diff --git a/chart2/source/tools/OIndexContainer.cxx b/chart2/source/tools/OIndexContainer.cxx
new file mode 100644
index 000000000..80973b537
--- /dev/null
+++ b/chart2/source/tools/OIndexContainer.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * $RCSfile: OIndexContainer.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "OIndexContainer.hxx"
+
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+
+using namespace ::com::sun::star;
+using ::osl::MutexGuard;
+
+namespace comphelper
+{
+
+OIndexContainer::OIndexContainer( ::osl::Mutex & rMutex ) :
+ m_rMutex( rMutex )
+{
+}
+
+OIndexContainer::~OIndexContainer()
+{
+}
+
+::osl::Mutex & OIndexContainer::GetMutex()
+{
+ return m_rMutex;
+}
+
+// ____ XInterface ____
+uno::Any SAL_CALL OIndexContainer::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ aType,
+ static_cast< container::XIndexContainer * >( this ),
+ static_cast< container::XIndexReplace * >( this ),
+ static_cast< container::XIndexAccess * >( this ),
+ static_cast< container::XElementAccess * >( this ) );
+}
+
+// ____ XIndexContainer ____
+void SAL_CALL OIndexContainer::insertByIndex( sal_Int32 Index, const uno::Any& Element )
+ throw (lang::IllegalArgumentException,
+ lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // valid range [0..size]
+ size_t nIndex( Index );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ if( nIndex < 0 ||
+ nIndex > m_aContainer.size() )
+ throw lang::IndexOutOfBoundsException();
+
+ if( getElementType().isAssignableFrom( Element.getValueType()) )
+ throw lang::IllegalArgumentException();
+
+ if( nIndex == m_aContainer.size())
+ m_aContainer.push_back( Element );
+ else
+ {
+ m_aContainer.insert( m_aContainer.begin() + nIndex, Element );
+ }
+ // \--
+}
+
+void SAL_CALL OIndexContainer::removeByIndex( sal_Int32 Index )
+ throw (lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // valid range [0..size-1]
+ size_t nIndex( Index );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ if( nIndex < 0 ||
+ nIndex > m_aContainer.size() )
+ throw lang::IndexOutOfBoundsException();
+
+ m_aContainer.erase( m_aContainer.begin() + nIndex );
+ // \--
+}
+
+
+// ____ XIndexReplace ____
+void SAL_CALL OIndexContainer::replaceByIndex( sal_Int32 Index, const uno::Any& Element )
+ throw (lang::IllegalArgumentException,
+ lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // valid range [0..size-1]
+ size_t nIndex( Index );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ if( nIndex < 0 ||
+ nIndex > m_aContainer.size() )
+ throw lang::IndexOutOfBoundsException();
+
+ if( getElementType().isAssignableFrom( Element.getValueType()) )
+ throw lang::IllegalArgumentException();
+
+ m_aContainer[ nIndex ] = Element;
+ // \--
+}
+
+
+// ____ XIndexAccess ____
+sal_Int32 SAL_CALL OIndexContainer::getCount()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ return m_aContainer.size();
+ // \--
+}
+
+uno::Any SAL_CALL OIndexContainer::getByIndex( sal_Int32 Index )
+ throw (lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ // valid range [0..size-1]
+ size_t nIndex( Index );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ if( nIndex < 0 ||
+ nIndex > m_aContainer.size() )
+ throw lang::IndexOutOfBoundsException();
+
+ return m_aContainer.at( nIndex );
+ // \--
+}
+
+sal_Bool SAL_CALL OIndexContainer::hasElements()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ return ! m_aContainer.empty();
+ // \--
+}
+
+
+} // namespace comphelper
diff --git a/chart2/source/tools/OPropertySet.cxx b/chart2/source/tools/OPropertySet.cxx
new file mode 100644
index 000000000..6501d9637
--- /dev/null
+++ b/chart2/source/tools/OPropertySet.cxx
@@ -0,0 +1,463 @@
+/*************************************************************************
+ *
+ * $RCSfile: OPropertySet.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "OPropertySet.hxx"
+#include "ImplOPropertySet.hxx"
+#include "algohelper.hxx"
+
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+
+#include <vector>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+
+using ::drafts::com::sun::star::style::XStyleSupplier;
+// using ::drafts::com::sun::star::beans::XFastPropertyState;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+// needed for MS compiler
+using ::cppu::OBroadcastHelper;
+using ::cppu::OPropertySetHelper;
+using ::cppu::OWeakObject;
+
+namespace property
+{
+
+OPropertySet::OPropertySet( ::osl::Mutex & _rMutex ) :
+ OBroadcastHelper( _rMutex ),
+ // the following causes a warning; there seems to be no way to avoid it
+ OPropertySetHelper( static_cast< OBroadcastHelper & >( *this )),
+ m_rMutex( _rMutex ),
+ m_pImplProperties( new impl::ImplOPropertySet() )
+{
+}
+
+OPropertySet::~OPropertySet()
+{}
+
+Any SAL_CALL OPropertySet::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ return ::cppu::queryInterface(
+ aType,
+// static_cast< uno::XInterface * >(
+// static_cast< uno::XWeak * >( this )),
+// static_cast< uno::XWeak * >( this ),
+// static_cast< lang::XServiceInfo * >( this ),
+ static_cast< lang::XTypeProvider * >( this ),
+ static_cast< beans::XPropertySet * >( this ),
+ static_cast< beans::XMultiPropertySet * >( this ),
+ static_cast< beans::XFastPropertySet * >( this ),
+ static_cast< beans::XPropertyState * >( this ),
+ static_cast< beans::XMultiPropertyStates * >( this ),
+ static_cast< XStyleSupplier * >( this ) );
+// static_cast< XFastPropertyState * >( this ) );
+}
+
+// void SAL_CALL OPropertySet::acquire() throw ()
+// {
+// OWeakObject::acquire();
+// }
+
+// void SAL_CALL OPropertySet::release() throw ()
+// {
+// OWeakObject::release();
+// }
+
+
+// ____ XServiceInfo ____
+// OUString SAL_CALL
+// OPropertySet::getImplementationName()
+// throw (uno::RuntimeException)
+// {
+// return OUString( RTL_CONSTASCII_USTRINGPARAM( "property::OPropertySet" ));
+// }
+
+// sal_Bool SAL_CALL
+// OPropertySet::supportsService( const OUString& ServiceName )
+// throw (uno::RuntimeException)
+// {
+// return ( 0 == ServiceName.reverseCompareToAsciiL(
+// RTL_CONSTASCII_STRINGPARAM( "com.sun.star.beans.PropertySet" )));
+// }
+
+// Sequence< OUString > SAL_CALL
+// OPropertySet::getSupportedServiceNames()
+// throw (uno::RuntimeException)
+// {
+// Sequence< OUString > aServiceNames( 1 );
+// aServiceNames[ 0 ] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.PropertySet" ));
+// return aServiceNames;
+// }
+
+#define LCL_PROP_CPPUTYPE(t) (::getCppuType( reinterpret_cast< const Reference<t> *>(0)))
+
+// // ____ XTypeProvider ____
+Sequence< uno::Type > SAL_CALL
+ OPropertySet::getTypes()
+ throw (uno::RuntimeException)
+{
+ static Sequence< uno::Type > aTypeList;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+ if( aTypeList.getLength() == 0 )
+ {
+ ::std::vector< uno::Type > aTypes;
+
+// aTypes.push_back( LCL_PROP_CPPUTYPE( uno::XWeak ));
+// aTypes.push_back( LCL_PROP_CPPUTYPE( lang::XServiceInfo ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( lang::XTypeProvider ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XPropertySet ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XMultiPropertySet ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XFastPropertySet ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XPropertyState ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( beans::XMultiPropertyStates ));
+ aTypes.push_back( LCL_PROP_CPPUTYPE( XStyleSupplier ));
+// aTypes.push_back( LCL_PROP_CPPUTYPE( XFastPropertyState ));
+
+ aTypeList = ::chart::helper::VectorToSequence( aTypes );
+ }
+
+ return aTypeList;
+ // \--
+}
+
+Sequence< sal_Int8 > SAL_CALL
+ OPropertySet::getImplementationId()
+ throw (uno::RuntimeException)
+{
+ static uno::Sequence< sal_Int8 > aId;
+ if( aId.getLength() == 0 )
+ {
+ aId.realloc( 16 );
+ rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+ }
+ return aId;
+}
+
+
+// ____ XPropertyState ____
+beans::PropertyState SAL_CALL
+ OPropertySet::getPropertyState( const OUString& PropertyName )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ return m_pImplProperties->GetPropertyStateByHandle(
+ rPH.getHandleByName( PropertyName ));
+}
+
+Sequence< beans::PropertyState > SAL_CALL
+ OPropertySet::getPropertyStates( const Sequence< OUString >& aPropertyName )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ sal_Int32 * pHandles = new sal_Int32[ aPropertyName.getLength() ];
+ rPH.fillHandles( pHandles, aPropertyName );
+
+ ::std::vector< sal_Int32 > aHandles( pHandles, pHandles + aPropertyName.getLength());
+ delete[] pHandles;
+
+ return m_pImplProperties->GetPropertyStatesByHandle( aHandles );
+}
+
+void SAL_CALL
+ OPropertySet::setPropertyToDefault( const OUString& PropertyName )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ m_pImplProperties->SetPropertyToDefault( rPH.getHandleByName( PropertyName ));
+}
+
+Any SAL_CALL
+ OPropertySet::getPropertyDefault( const OUString& aPropertyName )
+ throw (beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ return GetDefaultValue( rPH.getHandleByName( aPropertyName ) );
+}
+
+
+// ____ XMultiPropertyStates ____
+
+// Note: getPropertyStates() is already implemented in XPropertyState with the
+// same signature
+
+void SAL_CALL
+ OPropertySet::setAllPropertiesToDefault()
+ throw (uno::RuntimeException)
+{
+ m_pImplProperties->SetAllPropertiesToDefault();
+}
+
+void SAL_CALL
+ OPropertySet::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames )
+ throw (beans::UnknownPropertyException,
+ uno::RuntimeException)
+{
+ cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+
+ sal_Int32 * pHandles = new sal_Int32[ aPropertyNames.getLength() ];
+ rPH.fillHandles( pHandles, aPropertyNames );
+
+ ::std::vector< sal_Int32 > aHandles( pHandles, pHandles + aPropertyNames.getLength());
+ delete[] pHandles;
+
+ m_pImplProperties->SetPropertiesToDefault( aHandles );
+}
+
+Sequence< Any > SAL_CALL
+ OPropertySet::getPropertyDefaults( const Sequence< OUString >& aPropertyNames )
+ throw (beans::UnknownPropertyException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ ::cppu::IPropertyArrayHelper & rPH = getInfoHelper();
+ const sal_Int32 nElements = aPropertyNames.getLength();
+
+ Sequence< Any > aResult( nElements );
+ Any * pResultArray = aResult.getArray();
+ sal_Int32 nI = 0;
+
+ for( ; nI < nElements; ++nI )
+ {
+ pResultArray[ nI ] = GetDefaultValue(
+ rPH.getHandleByName( aPropertyNames[ nI ] ));
+ }
+
+ return aResult;
+}
+
+sal_Bool SAL_CALL OPropertySet::convertFastPropertyValue
+ ( Any & rConvertedValue,
+ Any & rOldValue,
+ sal_Int32 nHandle,
+ const Any& rValue )
+ throw (lang::IllegalArgumentException)
+{
+ getFastPropertyValue( rOldValue, nHandle );
+ rConvertedValue = rValue;
+ return sal_True;
+}
+
+void SAL_CALL OPropertySet::setFastPropertyValue_NoBroadcast
+ ( sal_Int32 nHandle,
+ const Any& rValue )
+ throw (uno::Exception)
+{
+ m_pImplProperties->SetPropertyValueByHandle( nHandle, rValue );
+}
+
+void SAL_CALL OPropertySet::getFastPropertyValue
+ ( Any& rValue,
+ sal_Int32 nHandle ) const
+{
+ if( ! m_pImplProperties->GetPropertyValueByHandle( rValue, nHandle ))
+ {
+// OSL_TRACE( "OPropertySet: asking style for property" );
+ // property was not set -> try style
+ uno::Reference< beans::XFastPropertySet > xStylePropSet( m_pImplProperties->GetStyle(), uno::UNO_QUERY );
+ if( xStylePropSet.is() )
+ {
+#ifndef NDEBUG
+ {
+ // check if the handle of the style points to the same property
+ // name as the handle in this property set
+ uno::Reference< beans::XPropertySet > xPropSet( xStylePropSet, uno::UNO_QUERY );
+ if( xPropSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo(),
+ uno::UNO_QUERY );
+ if( xInfo.is() )
+ {
+ // for some reason the virtual method getInfoHelper() is
+ // not const
+ ::cppu::IPropertyArrayHelper & rPH =
+ const_cast< OPropertySet * >( this )->getInfoHelper();
+
+ // find the Property with Handle nHandle in Style
+ Sequence< beans::Property > aProps( xInfo->getProperties() );
+ sal_Int32 nI = aProps.getLength() - 1;
+ while( ( nI >= 0 ) && nHandle != aProps[ nI ].Handle )
+ --nI;
+
+ if( nI >= 0 ) // => nHandle == aProps[nI].Handle
+ {
+ // check whether the handle in this property set is
+ // the same as the one in the style
+ beans::Property aProp( rPH.getPropertyByName( aProps[ nI ].Name ) );
+ OSL_ENSURE( nHandle == aProp.Handle,
+ "HandleCheck: Handles for same property differ!" );
+
+ if( nHandle == aProp.Handle )
+ {
+ OSL_ENSURE( aProp.Type == aProps[nI].Type,
+ "HandleCheck: Types differ!" );
+ OSL_ENSURE( aProp.Attributes == aProps[nI].Attributes,
+ "HandleCheck: Attributes differ!" );
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "HandleCheck: Handle not found in Style" );
+ }
+ }
+ else
+ OSL_ENSURE( false, "HandleCheck: Invalid XPropertySetInfo returned" );
+ }
+ else
+ OSL_ENSURE( false, "HandleCheck: XPropertySet not supported" );
+ }
+#endif
+ rValue = xStylePropSet->getFastPropertyValue( nHandle );
+ }
+ else
+ {
+// OSL_TRACE( "OPropertySet: no style => getting default for property" );
+ // there is no style (or the style does not support XFastPropertySet)
+ // => take the default value
+ try
+ {
+ rValue = GetDefaultValue( nHandle );
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ rValue.clear();
+ }
+ }
+ }
+}
+
+// ____ XStyleSupplier ____
+Reference< style::XStyle > SAL_CALL OPropertySet::getStyle()
+ throw (uno::RuntimeException)
+{
+ return m_pImplProperties->GetStyle();
+}
+
+void SAL_CALL OPropertySet::setStyle( const Reference< style::XStyle >& xStyle )
+ throw (lang::IllegalArgumentException,
+ uno::RuntimeException)
+{
+ if( ! m_pImplProperties->SetStyle( xStyle ))
+ throw lang::IllegalArgumentException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Empty Style" )),
+ static_cast< beans::XPropertySet * >( this ),
+ 0 );
+}
+
+// ____ XFastPropertyState ____
+// beans::PropertyState OPropertySet::SAL_CALL getFastPropertyState( sal_Int32 nHandle )
+// throw (beans::UnknownPropertyException,
+// uno::RuntimeException)
+// {
+// return m_pImplProperties->GetPropertyStateByHandle( nHandle );
+// }
+
+// uno::Sequence< beans::PropertyState > OPropertySet::SAL_CALL getFastPropertyStates(
+// const uno::Sequence< sal_Int32 >& aHandles )
+// throw (beans::UnknownPropertyException,
+// uno::RuntimeException)
+// {
+// ::std::vector< sal_Int32 > aHandleVec(
+// aHandles.getConstArray(),
+// aHandles.getConstArray() + aHandles.getLength() );
+
+// return m_pImplProperties->GetPropertyStatesByHandle( aHandleVec );
+// }
+
+// void OPropertySet::SAL_CALL setFastPropertyToDefault( sal_Int32 nHandle )
+// throw (beans::UnknownPropertyException,
+// uno::RuntimeException)
+// {
+// m_pImplProperties->SetPropertyToDefault( nHandle );
+// }
+
+// uno::Any OPropertySet::SAL_CALL getFastPropertyDefault( sal_Int32 nHandle )
+// throw (beans::UnknownPropertyException,
+// lang::WrappedTargetException,
+// uno::RuntimeException)
+// {
+// return GetDefaultValue( nHandle );
+// }
+
+
+} // namespace property
diff --git a/chart2/source/tools/OStyle.cxx b/chart2/source/tools/OStyle.cxx
new file mode 100644
index 000000000..e9c2813dd
--- /dev/null
+++ b/chart2/source/tools/OStyle.cxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * $RCSfile: OStyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "OStyle.hxx"
+#include "macros.hxx"
+
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include <cppuhelper/queryinterface.hxx>
+#endif
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::rtl::OUString;
+using ::osl::MutexGuard;
+
+namespace property
+{
+
+OStyle::OStyle( const Reference< container::XNameAccess > & xStyleFamily,
+ ::osl::Mutex & _rMutex ) :
+ OPropertySet( _rMutex ),
+ m_xStyleFamily( xStyleFamily ),
+ m_bUserDefined( false ),
+ m_rMutex( _rMutex )
+{}
+
+OStyle::~OStyle()
+{}
+
+::osl::Mutex & OStyle::GetMutex()
+{
+ return m_rMutex;
+}
+
+// ____ XStyle ____
+sal_Bool SAL_CALL OStyle::isUserDefined()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ return m_bUserDefined;
+ // \--
+}
+
+sal_Bool SAL_CALL OStyle::isInUse()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+
+ // aBoundLC is a member of cppuhelper::OPropertySetHelper
+ // it is assumed that a style is in use whenever some component is
+ // registered here as listener
+ return ( aBoundLC.getContainedTypes().getLength() > 0 );
+ // \--
+}
+
+OUString SAL_CALL OStyle::getParentStyle()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ return m_aParentStyleName;
+ // \--
+}
+
+void SAL_CALL OStyle::setParentStyle( const OUString& aParentStyle )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ m_aParentStyleName = aParentStyle;
+ // \--
+}
+
+// ____ XNamed (base of XStyle) ____
+
+OUString SAL_CALL OStyle::getName()
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ return m_aName;
+ // \--
+}
+
+void SAL_CALL OStyle::setName( const ::rtl::OUString& aName )
+ throw (uno::RuntimeException)
+{
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ OSL_ASSERT( m_xStyleFamily.is() );
+
+ // note: RuntimeException is not very apropriate for this, but I have no
+ // other choice
+ if( m_xStyleFamily->hasByName( aName ))
+ {
+ OSL_ENSURE( false, "Style name already exists!" );
+ throw uno::RuntimeException(
+ C2U( "Style name already exists: " ) + aName,
+ static_cast< style::XStyle * >( this ));
+ }
+ else
+ {
+ // ToDo: Change the name in the container (XStyleFamiliy)
+ m_aName = aName;
+ }
+ // \--
+}
+
+// ____ XInterface ____
+uno::Any SAL_CALL OStyle::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aResult = OPropertySet::queryInterface( aType );
+
+ if( ! aResult.hasValue())
+ {
+ return ::cppu::queryInterface(
+ aType,
+ static_cast< style::XStyle * >( this ));
+ }
+
+ return aResult;
+}
+
+// void SAL_CALL OStyle::acquire() throw ()
+// {
+// OPropertySet::acquire();
+// }
+
+// void SAL_CALL OStyle::release() throw ()
+// {
+// OPropertySet::release();
+// }
+
+
+
+// ____ XServiceInfo ____
+// OUString SAL_CALL
+// OStyle::getImplementationName()
+// throw (uno::RuntimeException)
+// {
+// return OUString( RTL_CONSTASCII_USTRINGPARAM( "property::OStyle" ));
+// }
+
+// sal_Bool SAL_CALL
+// OStyle::supportsService( const OUString& ServiceName )
+// throw (uno::RuntimeException)
+// {
+// Sequence< OUString > aServices( getSupportedServiceNames() );
+
+// sal_Int32 nI = aServices.getLength() - 1;
+// for( ; nI >= 0; --nI )
+// {
+// if( aServices[ nI ].equals( ServiceName ))
+// return sal_True;
+// }
+// return sal_False;
+// }
+
+// Sequence< OUString > SAL_CALL
+// OStyle::getSupportedServiceNames()
+// throw (uno::RuntimeException)
+// {
+// Sequence< OUString > aServiceNames( 2 );
+// // from base OPropertySet
+// aServiceNames[ 0 ] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.PropertySet" ));
+// // new service
+// aServiceNames[ 1 ] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.Style" ));
+// return aServiceNames;
+// }
+
+
+// ____ XTypeProvider ____
+// Sequence< uno::Type > SAL_CALL
+// OStyle::getTypes()
+// throw (uno::RuntimeException)
+// {
+// Sequence< uno::Type > aResult( OPropertySet::getTypes() );
+// aResult.realloc( aResult.getLength() + 1 );
+// aResult[ aResult.getLength() - 1 ] =
+// ::getCppuType( reinterpret_cast< const Reference< style::XStyle > *>(0));
+
+// return aResult;
+// }
+
+// Sequence< sal_Int8 > SAL_CALL
+// OStyle::getImplementationId()
+// throw (uno::RuntimeException)
+// {
+// static uno::Sequence< sal_Int8 > aId;
+// if( aId.getLength() == 0 )
+// {
+// aId.realloc( 16 );
+// rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True );
+// }
+// return aId;
+// }
+
+
+} // namespace property
diff --git a/chart2/source/tools/Scaling.cxx b/chart2/source/tools/Scaling.cxx
new file mode 100644
index 000000000..13215b248
--- /dev/null
+++ b/chart2/source/tools/Scaling.cxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * $RCSfile: Scaling.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _CHART2_SCALING_HXX
+#include "Scaling.hxx"
+#endif
+
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
+#endif
+
+namespace
+{
+
+static const ::rtl::OUString lcl_aServiceName_Logarithmic(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LogarithmicScaling" ));
+static const ::rtl::OUString lcl_aServiceName_Exponential(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ExponentialScaling" ));
+static const ::rtl::OUString lcl_aServiceName_Linear(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LinearScaling" ));
+static const ::rtl::OUString lcl_aServiceName_Power(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.PowerScaling" ));
+}
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+
+LogarithmicScaling::LogarithmicScaling() :
+ m_fBase( 10.0 ),
+ m_fLogOfBase( log( 10.0 ) )
+{
+}
+
+LogarithmicScaling::LogarithmicScaling( double fBase ) :
+ m_fBase( fBase ),
+ m_fLogOfBase( log( fBase ) )
+{
+}
+
+LogarithmicScaling::~LogarithmicScaling()
+{
+}
+
+ double SAL_CALL
+LogarithmicScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ return log( value ) / m_fLogOfBase;
+}
+
+ uno::Reference< XScaling > SAL_CALL
+LogarithmicScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ return new ExponentialScaling( m_fBase );
+}
+
+ ::rtl::OUString SAL_CALL
+LogarithmicScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Logarithmic;
+}
+
+// ----------------------------------------
+
+ExponentialScaling::ExponentialScaling() :
+ m_fBase( 10.0 )
+{
+}
+
+ExponentialScaling::ExponentialScaling( double fBase ) :
+ m_fBase( fBase )
+{
+}
+
+ExponentialScaling::~ExponentialScaling()
+{
+}
+
+ double SAL_CALL
+ExponentialScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ return pow( m_fBase, value );
+}
+
+ uno::Reference< XScaling > SAL_CALL
+ExponentialScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ return new LogarithmicScaling( m_fBase );
+}
+
+ ::rtl::OUString SAL_CALL
+ExponentialScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Exponential;
+}
+
+// ----------------------------------------
+
+LinearScaling::LinearScaling( double fSlope, double fOffset ) :
+ m_fSlope( fSlope ),
+ m_fOffset( fOffset )
+{}
+
+LinearScaling::~LinearScaling()
+{}
+
+double SAL_CALL LinearScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ return m_fOffset + m_fSlope * value;
+}
+
+uno::Reference< XScaling > SAL_CALL
+ LinearScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ // ToDo: ApproxEqual ?
+ if( m_fSlope == 0 )
+ throw uno::RuntimeException();
+
+ return new LinearScaling( 1.0 / m_fSlope, m_fOffset / m_fSlope );
+}
+
+ ::rtl::OUString SAL_CALL
+LinearScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Linear;
+}
+
+// ----------------------------------------
+
+PowerScaling::PowerScaling( double fExponent ) :
+ m_fExponent( fExponent )
+{}
+
+PowerScaling::~PowerScaling()
+{}
+
+double SAL_CALL PowerScaling::doScaling( double value )
+ throw (uno::RuntimeException)
+{
+ return pow( value, m_fExponent );
+}
+
+uno::Reference< XScaling > SAL_CALL
+ PowerScaling::getInverseScaling()
+ throw (uno::RuntimeException)
+{
+ // ToDo: ApproxEqual ?
+ if( m_fExponent == 0 )
+ throw uno::RuntimeException();
+
+ return new PowerScaling( 1.0 / m_fExponent );
+}
+
+ ::rtl::OUString SAL_CALL
+PowerScaling::getServiceName()
+ throw (uno::RuntimeException)
+{
+ return lcl_aServiceName_Power;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
new file mode 100644
index 000000000..2cac24c67
--- /dev/null
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * $RCSfile: TitleHelper.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "TitleHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "macros.hxx"
+#include "ContextHelper.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XCHARTDOCUMENT_HPP_
+#include <drafts/com/sun/star/chart2/XChartDocument.hpp>
+#endif
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star::chart2;
+
+rtl::OUString TitleHelper::getIdentifierForTitle( TitleHelper::eTitleType nTitleIndex )
+{
+ switch( nTitleIndex )
+ {
+ case MAIN_TITLE:
+ {
+ static rtl::OUString m_aIdentifier( C2U( "@main-title" ) );
+ return m_aIdentifier;
+ }
+ case SUB_TITLE:
+ {
+ static rtl::OUString m_aIdentifier( C2U( "@sub-title" ) );
+ return m_aIdentifier;
+ }
+ case X_AXIS_TITLE:
+ {
+ static rtl::OUString m_aIdentifier( C2U( "@xaxis-title" ) );
+ return m_aIdentifier;
+ }
+ case Y_AXIS_TITLE:
+ {
+ static rtl::OUString m_aIdentifier( C2U( "@yaxis-title" ) );
+ return m_aIdentifier;
+ }
+ case Z_AXIS_TITLE:
+ {
+ static rtl::OUString m_aIdentifier( C2U( "@zaxis-title" ) );
+ return m_aIdentifier;
+ }
+ default:
+ OSL_ENSURE( false, "Unsupported Title-Type requested" );
+ return ::rtl::OUString();
+ }
+}
+
+uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex
+ , const uno::Reference< frame::XModel >& xModel )
+{
+ switch( nTitleIndex )
+ {
+ case TitleHelper::MAIN_TITLE:
+ return uno::Reference< XTitled >( xModel, uno::UNO_QUERY );
+ case TitleHelper::SUB_TITLE:
+ {
+ uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+ if( !xChartDoc.is())
+ return NULL;
+ return uno::Reference< XTitled >( xChartDoc->getDiagram(), uno::UNO_QUERY );
+ }
+ case TitleHelper::X_AXIS_TITLE:
+ //@todo
+ break;
+ case TitleHelper::Y_AXIS_TITLE:
+ //@todo
+ break;
+ case TitleHelper::Z_AXIS_TITLE:
+ //@todo
+ break;
+ default:
+ OSL_ENSURE( false, "Unsupported Title-Type requested" );
+ return NULL;
+ }
+}
+
+uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
+ , const uno::Reference< frame::XModel >& xModel )
+{
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) );
+ if( xTitled.is())
+ return xTitled->getTitle();
+ return NULL;
+}
+
+uno::Reference< XTitle > TitleHelper::createTitle(
+ TitleHelper::eTitleType nTitleIndex
+ , const rtl::OUString& rTitleText
+ , const uno::Reference< frame::XModel >& xModel
+ , const uno::Reference< uno::XComponentContext > & xContext )
+{
+ if( !rTitleText.getLength() )
+ return NULL;
+
+ uno::Reference< XTitle > xTitle(NULL);
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) );
+
+ ContextHelper::tContextEntryMapType aContextValues(
+ ContextHelper::MakeContextEntryMap( C2U( "Identifier" )
+ , uno::makeAny( TitleHelper::getIdentifierForTitle(nTitleIndex) )) );
+ uno::Reference< uno::XComponentContext > xNewContext(
+ ContextHelper::createContext( aContextValues, xContext ) );
+
+ if(xNewContext.is() && xTitled.is())
+ {
+ xTitle.set( xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "drafts.com.sun.star.chart2.Title" ),
+ xNewContext ), uno::UNO_QUERY );
+
+ if(xTitle.is())
+ {
+ setCompleteString( rTitleText, xTitle, xNewContext );
+ xTitled->setTitle( xTitle );
+ }
+ }
+ return xTitle;
+}
+
+rtl::OUString TitleHelper::getCompleteString( const uno::Reference< XTitle >& xTitle )
+{
+ rtl::OUString aRet;
+ if(!xTitle.is())
+ return aRet;
+ uno::Sequence< uno::Reference< XFormattedString > > aStringList = xTitle->getText();
+ for( sal_Int32 nN=0; nN<aStringList.getLength();nN++ )
+ aRet += aStringList[nN]->getString();
+ return aRet;
+}
+
+void TitleHelper::setCompleteString( const rtl::OUString& rNewText
+ , const uno::Reference< XTitle >& xTitle
+ , const uno::Reference< uno::XComponentContext > & xContext )
+{
+ //the format of the first old text portion will be maintained if there is any
+ if(!xTitle.is())
+ return;
+
+ uno::Sequence< uno::Reference< XFormattedString > > aNewStringList(1);
+
+ uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText();
+ if( aOldStringList.getLength() )
+ {
+ aNewStringList[0].set( aOldStringList[0] );
+ aNewStringList[0]->setString( rNewText );
+ }
+ else
+ {
+ uno::Reference< uno::XInterface > xI(
+ xContext->getServiceManager()->createInstanceWithContext(
+ C2U( "drafts.com.sun.star.chart2.FormattedString" ), xContext ) );
+ uno::Reference< XFormattedString > xFormattedString( xI, uno::UNO_QUERY );
+
+ if(xFormattedString.is())
+ {
+ xFormattedString->setString( rNewText );
+ aNewStringList[0].set( xFormattedString );
+ }
+ }
+ xTitle->setText( aNewStringList );
+}
+
+void TitleHelper::removeTitle( TitleHelper::eTitleType nTitleIndex
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel )
+{
+ uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xModel ) );
+ if( xTitled.is())
+ {
+ xTitled->setTitle(NULL);
+ }
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
diff --git a/chart2/source/tools/exports.flt b/chart2/source/tools/exports.flt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/chart2/source/tools/exports.flt
diff --git a/chart2/source/tools/makefile.mk b/chart2/source/tools/makefile.mk
new file mode 100644
index 000000000..21392c341
--- /dev/null
+++ b/chart2/source/tools/makefile.mk
@@ -0,0 +1,166 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: bm $ $Date: 2003-10-06 09:58:32 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ= ..$/..
+PRJNAME= chart2
+TARGET= charttools
+
+PRJINC= $(PRJ)$/source
+
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- export library -------------------------------------------------
+
+#You can use several library macros of this form to build libraries that
+#do not consist of all object files in a directory or to merge different libraries.
+#LIB1TARGET= $(SLB)$/_$(TARGET).lib
+
+#Specifies object files to bind into linked libraries.
+SLOFILES= \
+ $(SLO)$/LifeTime.obj \
+ $(SLO)$/MediaDescriptorHelper.obj \
+ $(SLO)$/CommonConverters.obj \
+ $(SLO)$/ContextHelper.obj \
+ $(SLO)$/ImplOPropertySet.obj \
+ $(SLO)$/OChartElementContainerHelper.obj \
+ $(SLO)$/OEnumeration.obj \
+ $(SLO)$/OIndexContainer.obj \
+ $(SLO)$/OPropertySet.obj \
+ $(SLO)$/OStyle.obj \
+ $(SLO)$/Scaling.obj \
+ $(SLO)$/ChartModelHelper.obj \
+ $(SLO)$/MeterHelper.obj \
+ $(SLO)$/MutexContainer.obj \
+ $(SLO)$/TitleHelper.obj \
+ $(SLO)$/LegendHelper.obj
+
+LIB1OBJFILES = $(SLOFILES)
+
+#--------
+
+#Indicates the filename of the shared library.
+SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
+
+#indicates dependencies:
+SHL1DEPN=
+#Specifies an import library to create. For Win32 only.
+SHL1IMPLIB= i$(TARGET)
+
+#Specifies libraries from the same module to put into the shared library.
+#was created above
+SHL1LIBS= $(SLB)$/$(TARGET).lib
+
+#Links import libraries.
+
+SHL1STDLIBS= \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB) \
+ $(TOOLSLIB)
+
+# $(COMPHELPERLIB) \
+# $(GOODIESLIB) \
+# $(SVLIB) \
+# $(SVLLIB) \
+# $(SVTOOLLIB) \
+# $(SVXLIB) \
+# $(TKLIB) \
+# $(VCLLIB) \
+# $(SFXLIB)
+
+#--------exports
+
+#specifies the exported symbols for Windows only:
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+#Specifies the library name to parse for symbols. For Win32 only.
+#DEFLIB1NAME= _$(TARGET)
+
+#A file of symbols to export.
+#DEF1EXPORTFILE= $(PRJ)$/source$/inc$/exports.dxp
+
+#--------definition file
+
+#name of the definition file:
+DEF1NAME= $(SHL1TARGET)
+
+# indicates definition file dependencies
+DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt
+
+#A comment on the definition file.
+DEF1DES= Chart Tools
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+
+# --- Filter -----------------------------------------------------------
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk \
+ exports.flt
+ +$(TYPE) exports.flt > $@
+
diff --git a/chart2/source/tools/tools.map b/chart2/source/tools/tools.map
new file mode 100644
index 000000000..7698cb349
--- /dev/null
+++ b/chart2/source/tools/tools.map
@@ -0,0 +1,9 @@
+CHART_1_0 {
+ global:
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
+ component_getDescriptionFunc;
+ local:
+ *;
+};