diff options
Diffstat (limited to 'binfilter/bf_sch')
120 files changed, 46664 insertions, 0 deletions
diff --git a/binfilter/bf_sch/source/core/makefile.mk b/binfilter/bf_sch/source/core/makefile.mk new file mode 100644 index 000000000000..563dd275edab --- /dev/null +++ b/binfilter/bf_sch/source/core/makefile.mk @@ -0,0 +1,100 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/.. +BFPRJ=..$/.. + +PROJECTPCH=sch +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sch_sch + +PRJNAME=binfilter +TARGET=sch_core + +NO_HIDS=TRUE + +# --- Settings ----------------------------------------------------- +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sch +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES = sch_glob.src + +SLOFILES = \ + $(SLO)$/sch_chtscene.obj \ + $(SLO)$/sch_globfunc.obj \ + $(SLO)$/sch_chtmodel.obj \ + $(SLO)$/sch_chtmode1.obj \ + $(SLO)$/sch_chtmode2.obj \ + $(SLO)$/sch_chtmode3.obj \ + $(SLO)$/sch_chtmode4.obj \ + $(SLO)$/sch_chtmode5.obj \ + $(SLO)$/sch_chtmode6.obj \ + $(SLO)$/sch_chtmode7.obj \ + $(SLO)$/sch_chtmode8.obj \ + $(SLO)$/sch_charttyp.obj \ + $(SLO)$/sch_chtmode9.obj \ + $(SLO)$/sch_chartbar.obj \ + $(SLO)$/sch_chtmod2a.obj \ + $(SLO)$/sch_chtmod3d.obj \ + $(SLO)$/sch_chtm3d2.obj \ + $(SLO)$/sch_chartdoc.obj \ + $(SLO)$/sch_stlsheet.obj \ + $(SLO)$/sch_schgroup.obj \ + $(SLO)$/sch_stlpool.obj \ + $(SLO)$/sch_objfac.obj \ + $(SLO)$/sch_axisid.obj \ + $(SLO)$/sch_objid.obj \ + $(SLO)$/sch_objadj.obj \ + $(SLO)$/sch_datarow.obj \ + $(SLO)$/sch_datapoin.obj \ + $(SLO)$/sch_schiocmp.obj \ + $(SLO)$/sch_itempool.obj \ + $(SLO)$/sch_datalog.obj \ + $(SLO)$/sch_memchrt.obj \ + $(SLO)$/sch_chdescr.obj \ + $(SLO)$/sch_chaxis.obj \ + $(SLO)$/sch_calculat.obj \ + $(SLO)$/sch_axisobj.obj \ + $(SLO)$/sch_SchAddInCollection.obj \ + $(SLO)$/sch_ReBuildHint.obj + +.IF "$(GUI)" == "WIN" +NOOPTFILES=\ + $(OBJ)$/sch_chtmode5.obj +.ENDIF + +EXCEPTIONSFILES= \ + $(SLO)$/sch_chtmode4.obj \ + $(SLO)$/sch_chtmodel.obj \ + $(SLO)$/sch_SchAddInCollection.obj + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sch/source/core/sch_ReBuildHint.cxx b/binfilter/bf_sch/source/core/sch_ReBuildHint.cxx new file mode 100644 index 000000000000..e6c239a7cf61 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_ReBuildHint.cxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "ReBuildHint.hxx" +namespace binfilter { + +/*N*/ TYPEINIT0( SchReBuildHint ); + +/*N*/ SchReBuildHint::SchReBuildHint() +/*N*/ {} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx b/binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx new file mode 100644 index 000000000000..2382b5e93b8e --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "SchAddInCollection.hxx" + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <comphelper/processfactory.hxx> +#include<tools/debug.hxx> //STRIP001 +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { +using namespace ::com::sun::star; + +/*N*/ SchAddInCollection::SchAddInCollection() : +/*N*/ mbInitialized( sal_False ) +/*N*/ { +/*N*/ } + +/*N*/ SchAddInCollection::~SchAddInCollection() +/*N*/ {} + +/*N*/ void SchAddInCollection::Initialize() +/*N*/ { +/*N*/ // collect all service names of available AddIns +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ uno::Reference< lang::XMultiServiceFactory > xFactory = ::legacy_binfilters::getLegacyProcessServiceFactory(); +/*N*/ uno::Reference< container::XContentEnumerationAccess > xEnumAcc( xFactory, uno::UNO_QUERY ); +/*N*/ if( xEnumAcc.is()) +/*N*/ { +/*N*/ uno::Reference< container::XEnumeration > xEnum = +/*N*/ xEnumAcc->createContentEnumeration( ::rtl::OUString::createFromAscii( "com.sun.star.chart.Diagram" )); +/*N*/ if( xEnum.is()) +/*N*/ { +/*N*/ // clear possibly existing list +/*N*/ if( mbInitialized ) +/*N*/ maServiceNames.realloc( 0 ); +/*N*/ +/*N*/ while( xEnum->hasMoreElements()) +/*N*/ { +/*N*/ // create Instance to collect the service name of the addin +/*N*/ uno::Any aFactoryAny = xEnum->nextElement(); +/*N*/ uno::Reference< uno::XInterface > xFactoryIntf; +/*N*/ aFactoryAny >>= xFactoryIntf; +/*N*/ if( xFactoryIntf.is()) +/*N*/ { +/*N*/ uno::Reference< lang::XSingleServiceFactory > xAddInFactory( xFactoryIntf, uno::UNO_QUERY ); +/*N*/ if( xAddInFactory.is()) +/*N*/ { +/*N*/ uno::Reference< lang::XServiceName > xServicName( +/*N*/ xAddInFactory->createInstance(), uno::UNO_QUERY ); +/*N*/ if( xServicName.is()) +/*N*/ { +/*N*/ sal_Int32 nIndex = maServiceNames.getLength(); +/*N*/ maServiceNames.realloc( nIndex + 1 ); +/*N*/ maServiceNames[ nIndex ] = xServicName->getServiceName(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ mbInitialized = sal_True; +/*N*/ } +/*N*/ catch( const uno::Exception& aEx ) +/*N*/ { +/*N*/ OSL_ENSURE( false, +/*N*/ ::rtl::OUStringToOString( +/*N*/ ::rtl::OUString( +/*N*/ RTL_CONSTASCII_USTRINGPARAM( +/*N*/ "Couldn't initialize add-in collection: " )) + +/*N*/ aEx.Message, +/*N*/ RTL_TEXTENCODING_ASCII_US ).getStr() ); +/*N*/ } +/*N*/ } + +/*N*/ uno::Reference< util::XRefreshable > SchAddInCollection::GetAddInByName( const ::rtl::OUString& rName ) +/*N*/ { +/*N*/ if( ! mbInitialized ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 Initialize(); +/*N*/ +/*N*/ const sal_Int32 nSize = maServiceNames.getLength(); +/*N*/ for( sal_Int32 i = 0; i < nSize; i++ ) +/*N*/ { +/*N*/ if( rName.equalsIgnoreAsciiCase( maServiceNames[ i ] )) +/*N*/ { +/*N*/ uno::Reference< lang::XMultiServiceFactory > xFactory = ::legacy_binfilters::getLegacyProcessServiceFactory(); +/*N*/ return uno::Reference< util::XRefreshable >( xFactory->createInstance( rName ), uno::UNO_QUERY ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return uno::Reference< util::XRefreshable >(); +/*N*/ } + +/*N*/ uno::Sequence< ::rtl::OUString > SchAddInCollection::GetAddInNames() +/*N*/ { +/*N*/ if( ! mbInitialized ) +/*N*/ Initialize(); +/*N*/ +/*N*/ return maServiceNames; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_axisid.cxx b/binfilter/bf_sch/source/core/sch_axisid.cxx new file mode 100644 index 000000000000..122abec0b0e6 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_axisid.cxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "axisid.hxx" +#include "glob.hxx" +#include <tools/debug.hxx> +namespace binfilter { +/************************************************************************* +|* +|* Objekt-Id ermitteln; +|* Liefert -1, wenn das Objekt keine Id hat +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Objekt mit Id suchen; +|* liefert NULL, wenn kein Objekt gefunden wurde. +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchAxisId::SchAxisId () : +/*N*/ SdrObjUserData (SchInventor, SCH_AXIS_ID, 0), +/*N*/ nAxisId (0) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchAxisId::SchAxisId (long nId) : +/*N*/ SdrObjUserData (SchInventor, SCH_AXIS_ID, 0), +/*N*/ nAxisId (nId) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Kopier-Konstruktor +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Kopie erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjUserData* SchAxisId::Clone(SdrObject *pObj) const +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return new SchAxisId (*this); +/*N*/ } + +/************************************************************************* +|* +|* Daten in Stream schreiben +|* +\************************************************************************/ + +/*N*/ void SchAxisId::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ +/*N*/ rOut << nAxisId; +/*N*/ } + + +/************************************************************************* +|* +|* Daten aus Stream lesen +|* +\************************************************************************/ + +/*N*/ void SchAxisId::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ +/*N*/ rIn >> nAxisId; +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_axisobj.cxx b/binfilter/bf_sch/source/core/sch_axisobj.cxx new file mode 100644 index 000000000000..99d85cd0bf1c --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_axisobj.cxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// header for SdrObjListIter +// header for SdrHdlList + +#include "axisobj.hxx" +namespace binfilter { + +// ==================== SchAxisObj ==================== + +/*N*/ TYPEINIT1( SchAxisObj, SchObjGroup ); + +/*N*/ SchAxisObj::SchAxisObj( ChartModel *pModel ) : +/*N*/ SchObjGroup( pModel ) +/*N*/ { +/*N*/ } + + + + +// ==================== Sch3dAxisObj ==================== + +/*N*/ TYPEINIT1( Sch3dAxisObj, SchE3dObject ); + +/*N*/ Sch3dAxisObj::Sch3dAxisObj() +/*N*/ : SchE3dObject() +/*N*/ { +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_calculat.cxx b/binfilter/bf_sch/source/core/sch_calculat.cxx new file mode 100644 index 000000000000..e4c0dc4f40b5 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_calculat.cxx @@ -0,0 +1,206 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// header for Point, Rectangle +// header for Polygon +// header for DBG_ASSERT +// header for XPolygon, XPolyPolygon +#include <bf_svx/xpoly.hxx> +// header for Line +#include <tools/line.hxx> +// for performance measurement +#include <rtl/logfile.hxx> + +// Note: Enable the following to skip points in the resulting spline +// poly-polygon, if they have equal x-values rather than identical points. +// Unitl now, I think there are situations where the output might differ, if you +// do so, so it's not enabled by default. + +// #define SPLINE_OPTIMIZE_POINTS + +#include "calculat.hxx" + +#include <algorithm> +#include <functional> +namespace binfilter { + +using namespace ::std; + + +/*N*/ void SchCalculationHelper::IntersectPolygonWithRectangle( const XPolygon& rPolygon, const Rectangle& rRectangle, XPolyPolygon& aResult ) +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR( context, "sch", "bm93744", "SchCalculationHelper::IntersectPolygonWithRectangle"); +/*N*/ +/*N*/ aResult.Clear(); +/*N*/ +/*N*/ if( rRectangle.IsInside( rPolygon.GetBoundRect() ) ) +/*N*/ { +/*N*/ aResult.Insert( rPolygon ); +/*N*/ OSL_TRACE( "IntersectPolygonWithRectangle: result has %d polygons", aResult.Count() ); +/*N*/ return; +/*N*/ } +/*N*/ +/*N*/ Point aFrom; +/*N*/ Point aTo; +/*N*/ USHORT nCount = rPolygon.GetPointCount(); +/*N*/ +/*N*/ // set last point to a position outside the rectangle, such that the first +/*N*/ // time clip2d returns true, the comparison to last will always yield false +/*N*/ Point aLast (rRectangle.TopLeft()); +/*N*/ aLast.Move (-1, -1); +/*N*/ XPolygon aCurrentPoly; +/*N*/ USHORT nIdx = 0; +/*N*/ +/*N*/ for (USHORT i=1; i<nCount; i++) +/*N*/ { +/*N*/ aFrom = rPolygon[i-1]; +/*N*/ aTo = rPolygon[i]; +/*N*/ if (clip2d (aFrom, aTo, rRectangle)) +/*N*/ { +/*N*/ // compose an XPolygon of as many consecutive points as possible +/*N*/ if (aFrom == aLast) +/*N*/ { +/*N*/ if (aTo != aFrom) +/*N*/ aCurrentPoly.Insert (nIdx++, aTo, XPOLY_NORMAL); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // create an XPolygon and put it into the XPolyPolygon +/*N*/ if (aCurrentPoly.GetPointCount() > 0) +/*N*/ aResult.Insert (aCurrentPoly, XPOLYPOLY_APPEND); +/*N*/ +/*N*/ // start new sequence +/*N*/ aCurrentPoly.SetPointCount (0); +/*N*/ aCurrentPoly.Insert (0, aFrom, XPOLY_NORMAL); +/*N*/ nIdx = 1; +/*N*/ if (aTo != aFrom) +/*N*/ aCurrentPoly.Insert (nIdx++, aTo, XPOLY_NORMAL); +/*N*/ } +/*N*/ +/*N*/ aLast = aTo; +/*N*/ } +/*N*/ } +/*N*/ if (aCurrentPoly.GetPointCount() > 0) +/*N*/ aResult.Insert (aCurrentPoly, XPOLYPOLY_APPEND); +/*N*/ +/*N*/ OSL_TRACE( "IntersectPolygonWithRectangle: result has %d polygons", aResult.Count() ); +/*N*/ } + + + + + +/*N*/ BOOL SchCalculationHelper::clip2d (Point & rPoint0, +/*N*/ Point & rPoint1, +/*N*/ const Rectangle & rRectangle) +/*N*/ { +/*N*/ // Direction vector of the line. +/*N*/ Point aD = rPoint1 - rPoint0; +/*N*/ +/*N*/ if (aD.X()==0 && aD.Y()==0 && rRectangle.IsInside (rPoint0)) +/*N*/ { +/*N*/ // Degenerate case of a zero length line. +/*N*/ return TRUE; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Values of the line parameter where the line enters resp. leaves the rectangle. +/*N*/ double fTE = 0, +/*N*/ fTL = 1; +/*N*/ +/*N*/ // Test wether at least a part lies in the four half-planes with respect to +/*N*/ // the rectangles four edges. +/*N*/ if (CLIPt (aD.X(), rRectangle.Left() - rPoint0.X(), fTE, fTL)) +/*N*/ if (CLIPt (-aD.X(), rPoint0.X() - rRectangle.Right(), fTE, fTL)) +/*N*/ if (CLIPt (aD.Y(), rRectangle.Top() - rPoint0.Y(), fTE, fTL)) +/*N*/ if (CLIPt (-aD.Y(), rPoint0.Y() - rRectangle.Bottom(), fTE, fTL)) +/*N*/ { +/*N*/ // At least a part is visible. +/*N*/ if (fTL < 1) +/*N*/ { +/*N*/ // ::com::pute the new end point. +/*N*/ rPoint1.X() = (long)(rPoint0.X() + fTL * aD.X() + 0.5); +/*N*/ rPoint1.Y() = (long)(rPoint0.Y() + fTL * aD.Y() + 0.5); +/*N*/ } +/*N*/ if (fTE > 0) +/*N*/ { +/*N*/ // ::com::pute the new starting point. +/*N*/ rPoint0.X() = (long)(rPoint0.X() + fTE * aD.X() + 0.5); +/*N*/ rPoint0.Y() = (long)(rPoint0.Y() + fTE * aD.Y() + 0.5); +/*N*/ } +/*N*/ return TRUE; +/*N*/ } +/*N*/ +/*N*/ // Line is not visible. +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + + + + +/*N*/ BOOL SchCalculationHelper::CLIPt (double fDenom, +/*N*/ double fNum, +/*N*/ double & fTE, +/*N*/ double & fTL) +/*N*/ { +/*N*/ double fT; +/*N*/ +/*N*/ if (fDenom > 0) // Intersection enters: PE +/*N*/ { +/*N*/ fT = fNum / fDenom; // Parametric value at the intersection. +/*N*/ if (fT > fTL) // fTE and fTL crossover +/*N*/ return FALSE; // therefore reject the line. +/*N*/ else if (fT > fTE) // A new fTE has been found. +/*N*/ fTE = fT; +/*N*/ } +/*N*/ else if (fDenom < 0) // Intersection leaves: PL +/*N*/ { +/*N*/ fT = fNum / fDenom; // Parametric Value at the intersection. +/*N*/ if (fT < fTE) // fTE and fTL crossover +/*N*/ return FALSE; // therefore reject the line. +/*N*/ else if (fT < fTL) // A new fTL has been found. +/*N*/ fTL = fT; +/*N*/ } +/*N*/ else if (fNum > 0) +/*N*/ return FALSE; // Line lies on the outside of the edge. +/*N*/ +/*N*/ return TRUE; +/*N*/ } + + +// -------------------------------------------------------------------------------- + +// Calculation of Splines + + +// ---------------------------------------- + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chartbar.cxx b/binfilter/bf_sch/source/core/sch_chartbar.cxx new file mode 100644 index 000000000000..75adf230c6ad --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chartbar.cxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "chtmodel.hxx" +#include "chaxis.hxx" +namespace binfilter { + + +/*N*/ void ChartBarDescriptor::SetGap(long nPercent) +/*N*/ { +/*N*/ nGapPercent=nPercent; +/*N*/ if(mpAxis && mpModel) +/*N*/ { +/*N*/ SfxItemSet aSet(mpModel->GetPool(),SCHATTR_BAR_GAPWIDTH,SCHATTR_BAR_GAPWIDTH); +/*N*/ aSet.Put(SfxInt32Item(SCHATTR_BAR_GAPWIDTH,nPercent)); +/*N*/ mpAxis->GetItemSet()->Put(aSet); +/*N*/ } +/*N*/ } + +/*N*/ void ChartBarDescriptor::SetOverlap(long nPercent) +/*N*/ { +/*N*/ nOverlapPercent=nPercent; +/*N*/ if(mpAxis && mpModel) +/*N*/ { +/*N*/ SfxItemSet aSet(mpModel->GetPool(),SCHATTR_BAR_OVERLAP,SCHATTR_BAR_OVERLAP); +/*N*/ aSet.Put(SfxInt32Item(SCHATTR_BAR_OVERLAP,nPercent)); +/*N*/ mpAxis->GetItemSet()->Put(aSet); +/*N*/ } +/*N*/ } + +/*N*/ long ChartBarDescriptor::GetOverlap() const +/*N*/ { +/*N*/ if(mpAxis) +/*N*/ { +/*N*/ SfxItemSet* pSet=mpAxis->GetItemSet(); +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ if (pSet->GetItemState(SCHATTR_BAR_OVERLAP, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ ((ChartBarDescriptor*)this)->nOverlapPercent=((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ } +/*N*/ return nOverlapPercent; +/*N*/ } + +/*N*/ long ChartBarDescriptor::GetGap() const +/*N*/ { +/*N*/ if(mpAxis) +/*N*/ { +/*N*/ SfxItemSet* pSet=mpAxis->GetItemSet(); +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ if (pSet->GetItemState(SCHATTR_BAR_GAPWIDTH, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ ((ChartBarDescriptor*)this)->nGapPercent=((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ } +/*N*/ return nGapPercent; +/*N*/ } + +/*N*/ void ChartBarDescriptor::Create(const Rectangle& aRect,long nColCnt,long nRowCnt) +/*N*/ { +/*N*/ nPartWidth=0; +/*N*/ nBarWidth=0; +/*N*/ nGap=nOver=nBarWidth=nPartWidth=nLeft=nCurrent=0; +/*N*/ +/*N*/ nOverlapPercent=GetOverlap(); +/*N*/ nGapPercent=GetGap(); +/*N*/ +/*N*/ if(!nColCnt||!nRowCnt) +/*N*/ { +/*?*/ DBG_TRACE("Chart :: Keine Daten!"); +/*?*/ return; +/*N*/ } +/*N*/ +/*N*/ +/*N*/ //gestapelt => alles übereinander, das entspricht im Prinzip dem Fall mit nur +/*N*/ //einer Datenreihe (interpretiere nRowCnt als Anzahl NEBENEINANDERSTEHENDER Balken) +/*N*/ if(mpModel->IsStacked()) +/*N*/ nRowCnt = 1; +/*N*/ +/*N*/ //Dieser Platz steht uns zur Verfügung: +/*N*/ BOOL bVerticalX = mpModel->IsXVertikal(); +/*N*/ nPartWidth = (bVerticalX ? aRect.GetHeight() : aRect.GetWidth()) / nColCnt; +/*N*/ +/*N*/ //Es gilt (bei MS-Excel97, empirisch ermittelt) : +/*N*/ //Barwidth = (Partwidth - Gapwidth) / (Rows - Overlap * (Rows -1) ) +/*N*/ //Gapwidth = Partwidth - GapPercent/100 * Barwidth +/*N*/ // => Barwidth = Partwidth / (Rowfak + GapPercent/100) +/*N*/ +/*N*/ double fGap = (double)nGapPercent/100.0; +/*N*/ double fOverlap = (double)nOverlapPercent/100.0; +/*N*/ +/*N*/ //sicher ist sicher.... sollte aber nie negativ eingegeben werden können +/*N*/ if(fGap<0.0) +/*N*/ fGap=0.0; +/*N*/ +/*N*/ //Datenreihenüberlappfaktor, Range = [1,(2*nRow-1)] +/*N*/ double fRowFak = (double)nRowCnt - fOverlap * (double)(nRowCnt - 1); +/*N*/ +/*N*/ //jetzt kann die Balkendicke ermittelt werden: +/*N*/ nBarWidth = (long) ((double)nPartWidth / (fRowFak + fGap)); +/*N*/ nGap = (long) (fGap * (double)nBarWidth); +/*N*/ +/*N*/ //Position des jeweils folgenden Balkens einer Spalte +/*N*/ nOver=(long)( (double)nBarWidth - fOverlap*(double)nBarWidth ); +/*N*/ +/*N*/ //jetzt nochmal nachsehen, ob die Berechnungen vernünftige Diagramme liefern: +/*N*/ const long nMinBarWidth = 40;//hat mal irgendwer festgelegt, gab auch mal nen Max... +/*N*/ if(nBarWidth < nMinBarWidth) +/*N*/ { +/*?*/ if(nRowCnt>1 && fOverlap < 0.0) +/*?*/ { +/*?*/ //dann erstmal den Überlapp vergrößern auf maximal kein Überlapp ;) +/*?*/ double fMinlap = ( -((double)nPartWidth/(double)nMinBarWidth) + fGap + (double)nRowCnt ) +/*?*/ //-------------------------------------------------------------------------- +/*?*/ / (double)(nRowCnt-1); +/*?*/ if(fMinlap < 0.0) //sollte noch negativ (= Lücke) sein +/*?*/ { +/*?*/ fOverlap=fMinlap; +/*?*/ fRowFak = (double)nRowCnt - fOverlap * (double)(nRowCnt - 1); +/*?*/ nBarWidth = (long) ((double)nPartWidth / (fRowFak + fGap)); +/*?*/ nGap = (long) (fGap * (double)nBarWidth); +/*?*/ nOver=(long)( (double)nBarWidth - fOverlap*(double)nBarWidth ); +/*?*/ } +/*?*/ else //hilft alles nix => erstmal ganz weg mit den Überlapp-Lücken +/*?*/ { //bei negativem Überlapp +/*?*/ nOver=0; +/*?*/ nBarWidth = (long) ((double)nPartWidth / ((double)nRowCnt + fGap)); +/*?*/ nGap = (long) (fGap * (double)nBarWidth); +/*?*/ } +/*?*/ } +/*?*/ if(nBarWidth < nMinBarWidth)//immer noch zu klein, dann reguläre Lücke verkleinern +/*?*/ { +/*?*/ double fMingap = (double)nPartWidth/(double)nMinBarWidth - fRowFak; +/*?*/ if(fMingap > 0.0 ) //noch kleiner sollte es besser nicht werden .... +/*?*/ { +/*?*/ fGap=fMingap; +/*?*/ fRowFak = (double)nRowCnt - fOverlap * (double)(nRowCnt - 1); +/*?*/ nBarWidth = (long) ((double)nPartWidth / (fRowFak + fGap)); +/*?*/ nGap = (long) (fGap * (double)nBarWidth); +/*?*/ nOver=(long)( (double)nBarWidth - fOverlap*(double)nBarWidth ); +/*?*/ } +/*?*/ else +/*?*/ { //mehr geht eh nicht, ausser vielleicht Überlapp -> 1.0 +/*?*/ nGap=0; +/*?*/ nBarWidth=nPartWidth / nRowCnt; +/*?*/ } +/*?*/ } +/*?*/ if( nBarWidth <= 0 ) +/*?*/ DBG_WARNING( "ChartBarDescriptor: cannot create bars with zero width" ); +/*N*/ } +/*N*/ +/*N*/ nLeft = nCurrent = (bVerticalX ? aRect.Top() : aRect.Left()) + nGap/2; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chartdoc.cxx b/binfilter/bf_sch/source/core/sch_chartdoc.cxx new file mode 100644 index 000000000000..d4ccfdca14c3 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chartdoc.cxx @@ -0,0 +1,455 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include <bf_svx/eeitem.hxx> + +#ifndef _ZFORLIST_HXX +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif + + + +#include <bf_sfx2/printer.hxx> + +#include "schattr.hxx" +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + +#include <bf_svtools/eitem.hxx> + +#endif +#include <bf_svx/svxids.hrc> +#include "stlpool.hxx" +#include "schiocmp.hxx" +#include "schresid.hxx" +#include "docshell.hxx" + +#ifdef ITEMID_FONT +#undef ITEMID_FONT +#endif +#define ITEMID_FONT EE_CHAR_FONTINFO + +#ifdef ITEMID_COLOR +#undef ITEMID_COLOR +#endif +#define ITEMID_COLOR EE_CHAR_COLOR + +#ifdef ITEMID_FONTHEIGHT +#undef ITEMID_FONTHEIGHT +#endif +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT + +#include "glob.hrc" +#include "globfunc.hxx" + +#include <bf_svx/fontitem.hxx> +#include <bf_svx/fhgtitem.hxx> + + +#include "chaxis.hxx" + +#include "memchrt.hxx" + +#include <bf_svtools/itempool.hxx> + +namespace binfilter { + +/************************************************************************* +|* +|* Diese Methode erzeugt ein neues Dokument (ChartModel) und gibt einen +|* Zeiger darauf zurueck. Die Drawing Engine benutzt diese Methode um das +|* Dokument oder Teile davon ins Clipboard/DragServer stellen zu koennen. +|* +|* this method works like a copy constructor. So make sure to copy all +|* members inside this method !!! +|* +\************************************************************************/ +/*N*/ SdrModel* ChartModel::AllocModel() const +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return NULL; //STRIP001 +/*N*/ } + +/************************************************************************* +|* +|* Diese Methode erzeugt eine neue Seite (SchPage) und gibt einen Zeiger +|* darauf zurueck. Die Drawing Engine benutzt diese Methode beim Laden +|* zur Erzeugung von Seiten (deren Typ sie ja nicht kennt, da es ABLEITUNGEN +|* der SdrPage sind). +|* +\************************************************************************/ + +/*N*/ SdrPage* ChartModel::AllocPage(FASTBOOL bMasterPage) +/*N*/ { +/*N*/ return new SdrPage(*this, bMasterPage); +/*N*/ } +/************************************************************************* +|* +|* Inserter fuer SvStream zum Speichern +|* +\************************************************************************/ +/*N*/ SvStream& operator << (SvStream& rOut, const ChartModel& rDoc) +/*N*/ { +/*N*/ // die daemlichen blockklammern muessen erhalten bleiben, damit +/*N*/ // im destruktor ~SchIOCompat dei korrekte blockgröße geschrieben +/*N*/ // wird. ansonsten gibt es beim einlesen mit der 304 jede menge +/*N*/ // aerger +/*N*/ { +/*N*/ SchIOCompat aIO(rOut, STREAM_WRITE, 1); +/*N*/ +/*N*/ // AF: Don't write VCItemPool any longer (01/2001) +/*N*/ rOut << (sal_uInt32)0L; +/*N*/ + /************************************************************************** + * Frueher (StarChart Version 3.0, File-Format Version 1) wurde hier das + * JobSetup geschrieben, nun der Printer (binaer-kompatibel, daher wurde + * die Version des File-Formats nicht geaendert) + **************************************************************************/ +/*N*/ if (rDoc.pDocShell) +/*N*/ { +/*N*/ SfxPrinter* pPrinter = +/*N*/ ((SchChartDocShell*)rDoc.pDocShell)->GetPrinter(); +/*N*/ +/*N*/ +/*N*/ if (pPrinter) +/*N*/ { +/*N*/ pPrinter->Store(rOut); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ // Es ist kein Printer vorhanden -> muss erzeugt werden +/*?*/ SfxBoolItem aItem(SID_PRINTER_NOTFOUND_WARN, TRUE); +/*?*/ SfxItemSet* pSet = new SfxItemSet(((ChartModel&) rDoc).GetPool(), +/*?*/ SID_PRINTER_NOTFOUND_WARN, +/*?*/ SID_PRINTER_NOTFOUND_WARN, 0); +/*?*/ pSet->Put(aItem); +/*?*/ SfxPrinter* pPrinter = new SfxPrinter(pSet); +/*?*/ +/*?*/ MapMode aMapMode = pPrinter->GetMapMode(); +/*?*/ aMapMode.SetMapUnit(MAP_100TH_MM); +/*?*/ pPrinter->SetMapMode(aMapMode); +/*?*/ +/*?*/ pPrinter->Store(rOut); +/*?*/ delete pPrinter; +/*?*/ //delete pSet; bloss nicht! Killt der Printer gleich mit! +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ // Keine DocShell, daher wird ein JobSetup geschrieben +/*?*/ JobSetup aJobSetup; +/*?*/ rOut << aJobSetup; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ +/*N*/ rOut << (SdrModel&) rDoc; +/*N*/ +/*N*/ SchIOCompat aIO(rOut, STREAM_WRITE, 0); +/*N*/ +/*N*/ rDoc.StoreAttributes(rOut); +/*N*/ //<- ehemals Basisklasse +/*N*/ +/*N*/ +/*N*/ +/*N*/ return rOut; +/*N*/ } + +/************************************************************************* +|* +|* Extractor fuer SvStream zum Laden +|* +\************************************************************************/ + +/*N*/ SvStream& operator >> (SvStream& rIn, ChartModel& rDoc) +/*N*/ { +/*N*/ // auch hier muessen die blockklammern erhalten bleiben, +/*N*/ // um 304-er dokumente sauber lesen zu koennen. +/*N*/ { +/*N*/ SchIOCompat aIO(rIn, STREAM_READ); +/*N*/ +/*N*/ sal_uInt32 n; +/*N*/ rIn >> n; +/*N*/ // must be 0 or 1. Otherwise we have an error +/*N*/ // most probably a wrong password +/*N*/ if( n == 1L ) +/*N*/ { +/*N*/ // AF: Skip VCItemPool. +/*N*/ rIn.SeekRel (74); +/*N*/ } +/*N*/ else if( n != 0L ) +/*N*/ { +/*?*/ rIn.SetError( ERRCODE_IO_GENERAL ); +/*?*/ return rIn; +/*N*/ } +/*N*/ +/*N*/ if (aIO.GetVersion() >= 1) +/*N*/ { + + /****************************************************************** + * Frueher (StarChart Version 3.0, File-Format Version 1) wurde hier + * das JobSetup eingelesen, nun wird der Printer erzeugt + * (binaer-kompatibel) + *******************************************************************/ + // ItemSet mit speziellem Poolbereich anlegen +/*N*/ SfxItemSet* pSet = +/*N*/ new SfxItemSet(rDoc.GetPool(), +/*N*/ SID_PRINTER_NOTFOUND_WARN, +/*N*/ SID_PRINTER_NOTFOUND_WARN, 0); +/*N*/ pSet->Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, TRUE)); +/*N*/ +/*N*/ SfxPrinter* pPrinter = SfxPrinter::Create(rIn, pSet); +/*N*/ +/*N*/ MapMode aMM(pPrinter->GetMapMode()); +/*N*/ aMM.SetMapUnit(MAP_100TH_MM); +/*N*/ pPrinter->SetMapMode(aMM); +/*N*/ +/*N*/ if (rDoc.pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED) +/*N*/ { +/*N*/ ((SchChartDocShell*)rDoc.pDocShell)->SetPrinter( pPrinter, TRUE ); // will be deleted by DocShell +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ delete pPrinter; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // statt Basisklassenaufruf [ rIn >> (ChartModel&)rDoc;] direkt: +/*N*/ rIn >> (SdrModel&)rDoc; +/*N*/ +/*N*/ if (rIn.GetError() != SVSTREAM_FILEFORMAT_ERROR) +/*N*/ { +/*N*/ SchIOCompat aIO(rIn, STREAM_READ); +/*N*/ +/*N*/ rDoc.LoadAttributes(rIn); +/*N*/ } +/*N*/ // <- Basisaufruf +/*N*/ +/*N*/ rDoc.GetItemPool().LoadCompleted(); +/*N*/ +/*N*/ rDoc.ReadError () = FALSE; +/*N*/ +/*N*/ // alle 3D-Objekte werden bei einem Paint erstmailg sortiert, damit wird auch +/*N*/ // das Dokument als geaendert gekennzeichnet. Diese Variable wird in der +/*N*/ // CHVIEWSH-Paint-Methode abgefragt und bei Bedarf wird der Modified-Status +/*N*/ // des Dokuments zurueckgesetzt. +/*N*/ +/*N*/ // no longer needed +/*N*/ //- rDoc.FreshLoaded () = TRUE; +/*N*/ +/*N*/ return rIn; +/*N*/ } + +/************************************************************************* +|* +|* SetChanged(), das Model wurde geaendert +|* +\************************************************************************/ + +/*N*/ void ChartModel::SetChanged(FASTBOOL bFlag) +/*N*/ { +/*N*/ if (pDocShell) +/*N*/ { +/*N*/ if (bNewOrLoadCompleted && pDocShell->IsEnableSetModified()) +/*N*/ { +/*N*/ // weitergeben an Basisklasse +/*N*/ //ChartModel +/*N*/ SdrModel::SetChanged(bFlag); +/*N*/ +/*N*/ // an ObjectShell weiterleiten +/*N*/ pDocShell->SetModified(bFlag); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ // weitergeben an Basisklasse +/*?*/ //ChartModel +/*?*/ SdrModel::SetChanged(bFlag); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* NewOrLoadCompleted +|* +|* Wird gerufen, wenn das Dokument geladen wurde bzw. feststeht, dass es +|* nicht mehr geladen wird. +|* +\************************************************************************/ + +/*N*/ void ChartModel::NewOrLoadCompleted(USHORT eMode) +/*N*/ { +/*N*/ if (eMode == NEW_DOC) +/*N*/ { +/*N*/ // StyleSheets generieren +/*N*/ Font aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SANS, GetLanguage( EE_CHAR_LANGUAGE ), DEFAULTFONT_FLAGS_ONLYONE ) ); +/*N*/ SvxFontItem aFontItem( aFont.GetFamily(), aFont.GetName(), aFont.GetStyleName(), aFont.GetPitch(), +/*N*/ aFont.GetCharSet(), EE_CHAR_FONTINFO ); +/*N*/ +/*N*/ SfxStyleSheetBase* pSheet = +/*N*/ &pStyleSheetPool->Make(String(SchResId(STR_STLSHEET_TITLE_MAIN)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(493)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_TITLE_SUB)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(423)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_TITLE_X_AXIS)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(352)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_TITLE_Y_AXIS)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(352)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_TITLE_Z_AXIS)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(352)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_DATAROWS)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(282)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_DATACOLS)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(282)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_DATAVALUES)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(282)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_DATADESCR)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ) )); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(282)); +/*N*/ +/*N*/ pSheet = &pStyleSheetPool-> +/*N*/ Make(String(SchResId(STR_STLSHEET_LEGEND)), +/*N*/ SFX_STYLE_FAMILY_PARA); +/*N*/ pSheet->GetItemSet().Put(aFontItem); +/*N*/ pSheet->GetItemSet().Put(SvxColorItem( Color( COL_AUTO ))); +/*N*/ pSheet->GetItemSet().Put(SvxFontHeightItem(282)); +/*N*/ +/*N*/ pAxisAttr->ClearItem( SCHATTR_AXIS_SHOWDESCR ); +/*N*/ } +/*N*/ else if (eMode == DOC_LOADED) +/*N*/ { +/*N*/ // set intersection of all axis attributes used as axis +/*N*/ // 'style' (that is an itemset for the 'all axes' dialog) +/*N*/ GetFullAxisAttr( NULL, true ).ClearInvalidItems(); +/*N*/ pAxisAttr->ClearItem( SCHATTR_AXIS_SHOWDESCR ); +/*N*/ +/*N*/ // set 'all axis' attributes on all axes that are currently +/*N*/ // disabled +/*N*/ if( ! HasAxis( CHOBJID_DIAGRAM_X_AXIS )) +/*?*/ pChartXAxis->SetAttributes( pAxisAttr ); +/*N*/ if( ! HasAxis( CHOBJID_DIAGRAM_Y_AXIS )) +/*?*/ pChartYAxis->SetAttributes( pAxisAttr ); +/*N*/ if( ! HasAxis( CHOBJID_DIAGRAM_Z_AXIS )) +/*N*/ pChartZAxis->SetAttributes( pAxisAttr ); +/*N*/ if( ! HasAxis( CHOBJID_DIAGRAM_A_AXIS )) +/*N*/ pChartAAxis->SetAttributes( pAxisAttr ); +/*N*/ if( ! HasAxis( CHOBJID_DIAGRAM_B_AXIS )) +/*N*/ pChartBAxis->SetAttributes( pAxisAttr ); +/*N*/ // #99528# change auto-font color according to diagram area +/*N*/ PageColorChanged( *pDiagramAreaAttr ); +/*N*/ +/*N*/ // #101591# set precision of own number-formatter to 2 if we reside in a +/*N*/ // calc or writer, which is assumed by checking the cell-range in the +/*N*/ // MemChart. +/*N*/ OSL_ASSERT( pChartData ); +/*N*/ const SchChartRange & rRange = pChartData->GetChartRange(); +/*N*/ if( rRange.maRanges.size() > 0 ) +/*N*/ { +/*?*/ pOwnNumFormatter->ChangeStandardPrec( 2 ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ bNewOrLoadCompleted = TRUE; +/*N*/ #ifdef DBG_UTIL +/*N*/ if(pChartData && GetRowCount() && GetColCount()) +/*N*/ { +/*N*/ CHART_TRACE1( "ChartModel::NewOrLoadCompleted debugging ChartItems Model %s ", +/*N*/ (eMode==DOC_LOADED)? "was loaded": ((eMode==NEW_DOC)? "is new" : "don't know") ); +/*N*/ DBG_ITEMS((SfxItemSet&)GetDataRowAttr(0),this); +/*N*/ DBG_ITEMS((SfxItemSet&)GetDataPointAttr(0,0),this); +/*N*/ } +/*N*/ #endif +/*N*/ } + +/************************************************************************* +|* +|* Setze den Modified-Status zurueck, wenn ein Dokument mit +|* 3D-Objekten geladen und ausgegeben wurde +|* +\************************************************************************/ + +// void ChartModel::ResetFreshLoaded () +// { +// bFreshLoaded = FALSE; +// SetChanged (FALSE); +// } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_charttyp.cxx b/binfilter/bf_sch/source/core/sch_charttyp.cxx new file mode 100644 index 000000000000..70e0bc9269d8 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_charttyp.cxx @@ -0,0 +1,807 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "charttyp.hxx" + +#include "schattr.hxx" +namespace binfilter { + +/*------------------------------------------------------------------------ + + Prioritätenliste: + ----------------- + + + 3D > 2D + > + Symbols,Splines > no Symbols,no Splines + > + Lines > no Lines + > + Percent > Stacked > Normal + + + Kompatiblitätsklassen: + + 1 XY-Chart Hat X-Werte-Spalte + 2 Pie-Chart keine Achse + 3 Line,Area,Bar Achse, Symbol,Linie,Splines, ... (fast alles!) + 4 NetChart ??? + + 3D Line Spline Symbols Stacked Percent Deep3D vertikal Errors +-------------------------------------------------------------------------- + 1 x X X X - (x?) - - x X + 2 X - - - ? F - - - + 3 x X ? x X X x x x + 4 - F - X X X - - -? + + + X = schaltbar,vorhanden + x = schaltbar, nicht (vollst.) vrhanden + F = immer + ? = weiss noch nicht + - = gibts nicht +------------------------------------------------------------------------*/ + +/*N*/ void ChartType::Init() +/*N*/ { +/*N*/ bHasLines = FALSE; +/*N*/ bIsDonut = FALSE; +/*N*/ bIsPercent = FALSE; +/*N*/ bIs3D = FALSE; +/*N*/ bIsDeep3D = FALSE; +/*N*/ bIsVertical = FALSE; +/*N*/ bIsStacked = FALSE; +/*N*/ bHasVolume = FALSE; +/*N*/ bHasUpDown = FALSE; +/*N*/ +/*N*/ nSymbolType = -2; +/*N*/ nShapeType = -1; +/*N*/ +/*N*/ nSplineType = SPLINE_NONE; +/*N*/ nSpecialType = 0; +/*N*/ +/*N*/ nBaseType = CHSTYLE_2D_COLUMN; +/*N*/ } + +/* ************************************************************************ +|* +|* SetType initialisiert die ganze Klasse aus einem SvxChartStyle-enum +|* ( = Konvertierung SvxChartStyle -> ChartType ) +|* +\*********************************************************************** */ +/*N*/ void ChartType::SetType(const ChartModel* pModel) +/*N*/ { +/*N*/ SetType(pModel->ChartStyle()); +/*N*/ } +/*N*/ void ChartType::SetType(const SfxItemSet *pAttr) +/*N*/ { +/*N*/ +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_3D, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bIs3D=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_DEEP, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bIsDeep3D=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_VERTICAL, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bIsVertical=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_LINES, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bHasLines=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_PERCENT, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bIsPercent=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_STACKED, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bIsStacked=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_SPLINES, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ nSplineType=((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_SYMBOL, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ nSymbolType=((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STYLE_SHAPE, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ nShapeType=((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STOCK_VOLUME, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bHasVolume=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (pAttr->GetItemState(SCHATTR_STOCK_UPDOWN, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ bHasUpDown=((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ +/*N*/ // handle special types +/*N*/ // 4 : CHSTYLE_2D_LINE_COLUMN +/*N*/ // 5 : CHSTYLE_2D_LINE_STACKEDCOLUMN +/*N*/ +/*N*/ if( 4 == nSpecialType ) +/*N*/ { +/*N*/ // CHSTYLE_2D_LINE_COLUMN +/*N*/ if( bIsStacked ) +/*N*/ { +/*N*/ // set to CHSTYLE_2D_LINE_STACKEDCOLUMN +/*N*/ nSpecialType = 5; +/*N*/ } +/*N*/ } +/*N*/ else if( 5 == nSpecialType ) +/*N*/ { +/*N*/ // CHSTYLE_2D_LINE_STACKEDCOLUMN +/*N*/ if( ! bIsStacked ) +/*N*/ { +/*N*/ // set to CHSTYLE_2D_LINE_COLUMN +/*N*/ nSpecialType = 4; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //Todo: extend list (?) +/*N*/ } + +/*N*/ void ChartType::GetAttrSet(SfxItemSet *pAttr) +/*N*/ { +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STOCK_VOLUME ,bHasVolume)); +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STOCK_UPDOWN ,bHasUpDown)); +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STYLE_3D ,bIs3D)); +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STYLE_DEEP ,bIsDeep3D)); +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STYLE_VERTICAL ,bIsVertical)); +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STYLE_LINES ,bHasLines)); +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STYLE_PERCENT ,bIsPercent)); +/*N*/ pAttr->Put(SfxBoolItem(SCHATTR_STYLE_STACKED ,bIsStacked)); +/*N*/ pAttr->Put(SfxInt32Item(SCHATTR_STYLE_SPLINES ,nSplineType)); +/*N*/ pAttr->Put(SfxInt32Item(SCHATTR_STYLE_SYMBOL ,nSymbolType)); +/*N*/ if(nShapeType!=-1) +/*N*/ pAttr->Put(SfxInt32Item(SCHATTR_STYLE_SHAPE ,nShapeType)); +/*N*/ //Todo: erweitern! +/*N*/ } +/*N*/ void ChartType::SetType(const SvxChartStyle eStyle) +/*N*/ { +/*N*/ nSymbolType = HasSymbols(eStyle) ? SVX_SYMBOLTYPE_AUTO : SVX_SYMBOLTYPE_NONE; +/*N*/ bIs3D = Is3D(eStyle); +/*N*/ bIsStacked = IsStacked(eStyle); +/*N*/ bIsPercent = IsPercent(eStyle); +/*N*/ nBaseType = GetBaseType(eStyle); +/*N*/ bIsDeep3D = IsDeep3D(eStyle); +/*N*/ bIsVertical = IsVertical(eStyle); +/*N*/ nSplineType = GetSplineType(eStyle); +/*N*/ bIsDonut = IsDonut(eStyle); +/*N*/ bHasLines = HasLines(eStyle); +/*N*/ +/*N*/ +/*N*/ +/*N*/ switch(eStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ nSpecialType=1; +/*N*/ break; +/*N*/ case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ nSpecialType=2; +/*N*/ break; +/*N*/ case CHSTYLE_2D_DONUT2: +/*N*/ nSpecialType=3; +/*N*/ break; +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ nSpecialType=4; +/*N*/ break; +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ nSpecialType=5; +/*N*/ break; +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ bHasVolume=FALSE; +/*N*/ bHasUpDown=FALSE; +/*N*/ break; +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ bHasVolume=FALSE; +/*N*/ bHasUpDown=TRUE; +/*N*/ break; +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ bHasVolume=TRUE; +/*N*/ bHasUpDown=FALSE; +/*N*/ break; +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ bHasVolume=TRUE; +/*N*/ bHasUpDown=TRUE; +/*N*/ break; +/*N*/ default: +/*N*/ nSpecialType=0; +/*N*/ break; +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Konvertierung ChartType -> SvxChartStyle +|* +\************************************************************************/ +/*N*/ SvxChartStyle ChartType::GetChartStyle() const +/*N*/ { +/*N*/ SvxChartStyle aResult = CHSTYLE_2D_COLUMN; // in case of error return default +/*N*/ +/*N*/ switch(nSpecialType) +/*N*/ { +/*N*/ case 1: +/*N*/ return CHSTYLE_2D_PIE_SEGOF1; +/*N*/ case 2: +/*N*/ return CHSTYLE_2D_PIE_SEGOFALL; +/*N*/ case 3: +/*N*/ return CHSTYLE_2D_DONUT2; +/*N*/ case 4: +/*N*/ return CHSTYLE_2D_LINE_COLUMN; +/*N*/ case 5 : +/*N*/ return CHSTYLE_2D_LINE_STACKEDCOLUMN; +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ switch(nBaseType) +/*N*/ { +/*N*/ case CHTYPE_DONUT: +/*N*/ return CHSTYLE_2D_DONUT1; +/*N*/ +/*N*/ case CHTYPE_LINE: +/*N*/ { +/*N*/ +/*N*/ if(bIs3D) +/*N*/ return CHSTYLE_3D_STRIPE; //default 3d +/*N*/ +/*N*/ if (nSymbolType!=SVX_SYMBOLTYPE_NONE) +/*N*/ { +/*N*/ +/*N*/ if(nSplineType==SPLINE_CUBIC) +/*N*/ return CHSTYLE_2D_CUBIC_SPLINE_SYMBOL; +/*N*/ +/*N*/ if(nSplineType==SPLINE_B) +/*N*/ return CHSTYLE_2D_B_SPLINE_SYMBOL; //default spline&symbol&line: +/*N*/ +/*N*/ if(bIsPercent) //MUSS vor stacked, da percent auch stacked +/*N*/ return CHSTYLE_2D_PERCENTLINESYM; +/*N*/ +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_2D_STACKEDLINESYM; +/*N*/ +/*N*/ return CHSTYLE_2D_LINESYMBOLS; //default Line&Symbols +/*N*/ +/*N*/ +/*N*/ } +/*N*/ +/*N*/ if(nSplineType==SPLINE_CUBIC) +/*N*/ return CHSTYLE_2D_CUBIC_SPLINE; +/*N*/ +/*N*/ if(nSplineType==SPLINE_B) +/*N*/ return CHSTYLE_2D_B_SPLINE; +/*N*/ +/*N*/ if(bIsPercent) //MUSS vor stacked, da percent auch stacked +/*N*/ return CHSTYLE_2D_PERCENTLINE; +/*N*/ +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_2D_STACKEDLINE; +/*N*/ +/*N*/ return CHSTYLE_2D_LINE; //default Line +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHTYPE_AREA: +/*N*/ { +/*N*/ if(bIs3D) +/*N*/ { +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_3D_PERCENTAREA; +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_3D_STACKEDAREA; +/*N*/ +/*N*/ return CHSTYLE_3D_AREA; +/*N*/ } +/*N*/ +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_2D_PERCENTAREA; +/*N*/ +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_2D_STACKEDAREA; +/*N*/ +/*N*/ return CHSTYLE_2D_AREA; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHTYPE_CIRCLE: +/*N*/ { +/*N*/ if(bIs3D) +/*N*/ return CHSTYLE_3D_PIE; +/*N*/ +/*N*/ if(bIsDonut || bIsStacked) +/*N*/ return CHSTYLE_2D_DONUT1; +/*N*/ //case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ //case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ //case CHSTYLE_2D_DONUT2: +/*N*/ return CHSTYLE_2D_PIE; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHTYPE_XY: +/*N*/ { +/*N*/ if(nSymbolType!=SVX_SYMBOLTYPE_NONE) +/*N*/ { +/*N*/ if(nSplineType==SPLINE_CUBIC) +/*N*/ return CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY; +/*N*/ +/*N*/ if(nSplineType==SPLINE_B) +/*N*/ return CHSTYLE_2D_B_SPLINE_SYMBOL_XY; +/*N*/ } +/*N*/ +/*N*/ if(nSplineType==SPLINE_CUBIC) +/*N*/ return CHSTYLE_2D_CUBIC_SPLINE_XY; +/*N*/ +/*N*/ if(nSplineType==SPLINE_B) +/*N*/ return CHSTYLE_2D_B_SPLINE_XY; +/*N*/ +/*N*/ if(bHasLines && (nSymbolType!=SVX_SYMBOLTYPE_NONE))//fehlte! XY=Symbol+Line +/*N*/ return CHSTYLE_2D_XY; +/*N*/ +/*N*/ if(bHasLines) +/*N*/ return CHSTYLE_2D_XY_LINE; +/*N*/ +/*N*/ if(nSymbolType!=SVX_SYMBOLTYPE_NONE) +/*N*/ return CHSTYLE_2D_XYSYMBOLS; +/*N*/ +/*N*/ DBG_ERROR( "Unknown chart type" ); +/*N*/ +/*N*/ return CHSTYLE_2D_XY; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHTYPE_NET: +/*N*/ { +/*N*/ if(nSymbolType!=SVX_SYMBOLTYPE_NONE) +/*N*/ { +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_2D_NET_SYMBOLS_PERCENT; +/*N*/ +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_2D_NET_SYMBOLS_STACK; +/*N*/ +/*N*/ return CHSTYLE_2D_NET_SYMBOLS; +/*N*/ } +/*N*/ +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_2D_NET_PERCENT; +/*N*/ +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_2D_NET_STACK; +/*N*/ +/*N*/ return CHSTYLE_2D_NET; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHTYPE_COLUMN: //==BAR +/*N*/ case CHTYPE_BAR: +/*N*/ { +/*N*/ if(bIsVertical) //Bar = vertical Column +/*N*/ { +/*N*/ if(bIs3D) +/*N*/ { +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_3D_PERCENTFLATBAR; +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_3D_STACKEDFLATBAR; +/*N*/ if(bIsDeep3D) +/*N*/ return CHSTYLE_3D_BAR; +/*N*/ return CHSTYLE_3D_FLATBAR; +/*N*/ } +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_2D_PERCENTBAR; +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_2D_STACKEDBAR; +/*N*/ +/*N*/ return CHSTYLE_2D_BAR; +/*N*/ } +/*N*/ if(bIs3D) +/*N*/ { +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_3D_PERCENTFLATCOLUMN; +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_3D_STACKEDFLATCOLUMN; +/*N*/ if(bIsDeep3D) +/*N*/ return CHSTYLE_3D_COLUMN; +/*N*/ return CHSTYLE_3D_FLATCOLUMN; +/*N*/ } +/*N*/ +/*N*/ if(bIsPercent) +/*N*/ return CHSTYLE_2D_PERCENTCOLUMN; +/*N*/ if(bIsStacked) +/*N*/ return CHSTYLE_2D_STACKEDCOLUMN; +/*N*/ +/*N*/ //case CHSTYLE_2D_LINE_COLUMN: +/*N*/ //case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ +/*N*/ return CHSTYLE_2D_COLUMN; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHTYPE_STOCK: +/*N*/ if( bHasVolume ) +/*N*/ aResult = bHasUpDown +/*N*/ ? CHSTYLE_2D_STOCK_4 +/*N*/ : CHSTYLE_2D_STOCK_3; +/*N*/ else +/*N*/ aResult = bHasUpDown +/*N*/ ? CHSTYLE_2D_STOCK_2 +/*N*/ : CHSTYLE_2D_STOCK_1; +/*N*/ break; +/*N*/ +/*N*/ case CHTYPE_ADDIN: +/*N*/ aResult = CHSTYLE_ADDIN; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ DBG_ERROR( "ChartModel::GetBaseType: invalid type!" ); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ return aResult; +/*N*/ } + +/*N*/ BOOL ChartType::HasLines(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ return +/*N*/ ( GetBaseType( eChartStyle ) == CHTYPE_LINE ) || +/*N*/ ( ( GetBaseType( eChartStyle ) == CHTYPE_XY ) && +/*N*/ eChartStyle != CHSTYLE_2D_XYSYMBOLS ); +/*N*/ } +/************************************************************************* +|* +|* Chart-Typ mit Symbolen +|* +\************************************************************************/ +/*N*/ BOOL ChartType::IsDeep3D(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ case CHSTYLE_3D_BAR: +/*?*/ return TRUE; +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } +/************************************************************************* +|* +|* Chart-Typ mit Splines +|* +\************************************************************************/ +/*N*/ long ChartType::GetSplineType(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY : +/*N*/ return SPLINE_CUBIC; +/*N*/ +/*N*/ case CHSTYLE_2D_B_SPLINE : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_2D_B_SPLINE_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY : +/*N*/ return SPLINE_B; +/*N*/ +/*N*/ default : +/*N*/ return SPLINE_NONE; +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Chart-Typ mit Symbolen +|* +\************************************************************************/ +/*N*/ BOOL ChartType::HasSymbols(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_LINESYMBOLS: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_2D_XYSYMBOLS: +/*N*/ case CHSTYLE_2D_XY://fehlte! XY=Symbol+Line +/*N*/ case CHSTYLE_3D_XYZSYMBOLS: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY: +/*N*/ +/*N*/ return TRUE; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } +/************************************************************************* +|* +|* 3D-Chart-Typ +|* +\************************************************************************/ +/*N*/ BOOL ChartType::Is3D(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_3D_STRIPE: +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_FLATCOLUMN: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ case CHSTYLE_3D_AREA: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_SURFACE: +/*N*/ case CHSTYLE_3D_PIE: +/*N*/ //neu (aber bisher (380 Build 1502) nicht benutzt): +/*N*/ case CHSTYLE_3D_XYZ: +/*N*/ case CHSTYLE_3D_XYZSYMBOLS: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Stacked-Chart-Typ (vollstaendig, d.h. percent => stacked +|* +\************************************************************************/ +/*N*/ BOOL ChartType::IsStacked(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ if(IsPercent(eChartStyle)) //Percent ist immer Stacked!!! +/*N*/ return TRUE; +/*N*/ +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ //neu, (siehe auch IsPercent()): +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_NET_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ +/*N*/ return TRUE; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } +/************************************************************************* +|* +|* Percent-Chart-Typ +|* +\************************************************************************/ +/*N*/ BOOL ChartType::IsPercent(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ // Neu: +/*N*/ case CHSTYLE_2D_NET_PERCENT: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ +/*N*/ return TRUE; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +/************************************************************************* +|* +|* Basistyp ermitteln +|* +\************************************************************************/ + +/*N*/ long ChartType::GetBaseType(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ long nResult = CHTYPE_INVALID; +/*N*/ +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_B_SPLINE: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_LINE: +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_LINESYMBOLS: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_3D_STRIPE: +/*N*/ nResult = CHTYPE_LINE; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_AREA: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_AREA: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ nResult = CHTYPE_AREA; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_PIE: +/*N*/ case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ case CHSTYLE_2D_DONUT1: +/*N*/ case CHSTYLE_2D_DONUT2: +/*N*/ case CHSTYLE_3D_PIE: +/*N*/ nResult = CHTYPE_CIRCLE; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_B_SPLINE_XY: +/*N*/ case CHSTYLE_2D_XY_LINE: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_XYSYMBOLS: +/*N*/ case CHSTYLE_2D_XY: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY: +/*N*/ nResult = CHTYPE_XY; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_NET: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS: +/*N*/ case CHSTYLE_2D_NET_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_NET_PERCENT: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ nResult = CHTYPE_NET; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_COLUMN: +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ case CHSTYLE_3D_FLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ nResult = CHTYPE_COLUMN; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_BAR: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ nResult = CHTYPE_BAR; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ nResult = CHTYPE_STOCK; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_ADDIN: +/*N*/ nResult = CHTYPE_ADDIN; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ DBG_ERROR( "Invalid chart style given!" ); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ return nResult; +/*N*/ } + +/************************************************************************* +|* +|* Vertikales Chart +|* +\************************************************************************/ + +/*N*/ BOOL ChartType::IsVertical(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_BAR: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ +/*N*/ return TRUE; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + + + + +/*N*/ BOOL ChartType::IsDonut(const SvxChartStyle eChartStyle) const +/*N*/ { +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_DONUT1: +/*N*/ case CHSTYLE_2D_DONUT2: +/*N*/ +/*N*/ return TRUE; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } +/************************************************************************* +|* +|* CleanUp sorgt nach dem Setzen bestimmter Eigenschaften dafuer, das +|* alle übrigen Eigenschaften, die jetzt nicht mehr verfügbar sind, +|* passend gesetzt werden. Beispiel: +|* Type = Percent, stacked oder Typ = Column +|* Percent wird auf FALSE gesetzt Typ auf Pie +|* nach CleanUp ist auch Stacked = FALSE; Typ = Pie,Percent,Stacked +|* Typ auf Column +|* Type = Column,Percent,Stacked +\************************************************************************/ + +//Wie SetBaseType, jedoch werden alle Properties auf defaults gesetz +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chaxis.cxx b/binfilter/bf_sch/source/core/sch_chaxis.cxx new file mode 100644 index 000000000000..1ec99a696166 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chaxis.cxx @@ -0,0 +1,2629 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + + +#include <bf_svx/svdopath.hxx> + + + + +#include <bf_svx/eeitem.hxx> +#ifndef _ZFORLIST_HXX //autogen +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif +#include <rtl/math.hxx> +#include <bf_svx/xlnclit.hxx> + +#include <bf_svx/xlnwtit.hxx> +#include "schattr.hxx" + +#ifndef _SVX_CHRTITEM_HXX //autogen + + +#endif + +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT + +#include <bf_svx/fontitem.hxx> +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/svxids.hrc> + +#include "float.h" +#include "chaxis.hxx" +#include "pairs.hxx" +#include "glob.hrc" +#include "axisobj.hxx" +#include "globfunc.hxx" +#include <algorithm> +#include <limits> +namespace binfilter { + +/*N*/ void ChartAxis::SetDefaults() +/*N*/ { +/*N*/ Font aLatinFont( OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, mpModel->GetLanguage( EE_CHAR_LANGUAGE ), DEFAULTFONT_FLAGS_ONLYONE ) ); +/*N*/ SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(), +/*N*/ aLatinFont.GetCharSet(), EE_CHAR_FONTINFO ); +/*N*/ +/*N*/ Font aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, mpModel->GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE ) ); +/*N*/ SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(), +/*N*/ aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK ); +/*N*/ +/*N*/ Font aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, mpModel->GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) ); +/*N*/ SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(), +/*N*/ aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL ); +/*N*/ +/*N*/ // Attention! If the size of the three fonts below is changed from 7pt to +/*N*/ // some other value, change also the font scaling in globfunc.cxx:ItemsToFont. +/*N*/ mpAxisAttr->Put(aSvxFontItem); +/*N*/ mpAxisAttr->Put(SvxFontHeightItem( 247, 100, EE_CHAR_FONTHEIGHT )); // 7pt +/*N*/ mpAxisAttr->Put(aSvxFontItemCJK); +/*N*/ mpAxisAttr->Put(SvxFontHeightItem( 247, 100, EE_CHAR_FONTHEIGHT_CJK )); // 7pt +/*N*/ mpAxisAttr->Put(aSvxFontItemCTL); +/*N*/ mpAxisAttr->Put(SvxFontHeightItem( 247, 100, EE_CHAR_FONTHEIGHT_CTL )); // 7pt +/*N*/ +/*N*/ // the font color has 'automatic' as default that should not be overwritten +/*N*/ // mpAxisAttr->Put(SvxColorItem(RGBColor(COL_BLACK))); +/*N*/ mpAxisAttr->ClearItem( ITEMID_COLOR ); +/*N*/ mpAxisAttr->Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ mpAxisAttr->Put(XLineWidthItem(0)); +/*N*/ mpAxisAttr->Put(XLineColorItem( String(), RGBColor(COL_BLACK))); +/*N*/ mpAxisAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_TEXT_OVERLAP,FALSE)); +/*N*/ +/*N*/ mpAxisAttr->Put(SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE)); +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN, TRUE)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(0.0, SCHATTR_AXIS_MIN)); +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX, TRUE)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(0.0, SCHATTR_AXIS_MAX)); +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN, TRUE)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN)); +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP, TRUE)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_HELP)); +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM, FALSE)); +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN, (mnId==CHART_AXIS_Y)?FALSE:TRUE)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN)); +/*N*/ mpAxisAttr->Put(SfxInt32Item(SCHATTR_AXISTYPE, mnId)); +/*N*/ mpAxisAttr->Put(SfxInt32Item(SCHATTR_AXIS_TICKS, CHAXIS_MARK_OUTER)); +/*N*/ ShowAxis(TRUE); +/*N*/ ShowDescr(TRUE); +/*N*/ +/*N*/ } +/*N*/ void ChartAxis::SetAttributes(const SfxItemSet &rAttr) +/*N*/ { +/*N*/ mpAxisAttr->Put(rAttr); +/*N*/ +/*N*/ //Erst immer Auto-attr holen, damit evtl. berechnete Werte nicht überschrieben werden. +/*N*/ ReadAutoAttr(); +/*N*/ ReadAttr(); +/*N*/ }; +/*N*/ void ChartAxis::SetAttributes(SfxItemSet *pSet) +/*N*/ { +/*N*/ if(pSet) +/*N*/ SetAttributes(*pSet); +/*N*/ }; +/*N*/ ChartAxis::~ChartAxis() +/*N*/ { +/*N*/ if(mpTotal) +/*N*/ delete [] mpTotal; +/*N*/ +/*N*/ if(mpColStack) +/*N*/ delete [] mpColStack; +/*N*/ +/*N*/ delete mpAxisAttr; +/*N*/ mpAxisAttr=NULL; +/*N*/ mpModel=NULL; +/*N*/ if(mpTextAttr) +/*N*/ delete mpTextAttr; +/*N*/ } + +/*N*/ ChartAxis::ChartAxis(ChartModel* pModel,long nId,long nUId) : +/*N*/ mnInnerPos(-1), +/*N*/ mbInnerPos(FALSE), +/*N*/ mbCenterText(FALSE), +/*N*/ mbColText(FALSE), +/*N*/ mnUId(nUId), +/*N*/ mbAlternativIdUsed(FALSE), +/*N*/ mnAlternateId(0), +/*N*/ mnTickLen(150), +/*N*/ mnHelpTickLen(100), +/*N*/ mpAxisList(NULL), +/*N*/ mpAxisObj(NULL), +/*N*/ mbSecondary(FALSE), +/*N*/ mpGridAttr(NULL), +/*N*/ mpTextAttr(NULL), +/*N*/ mpNumFormatter(NULL), +/*N*/ mpModel(pModel), +/*N*/ mbPercent(FALSE), +/*N*/ mbRadial(FALSE), +/*N*/ mpAxisAttr(NULL), +/*N*/ mnId(nId), +/*N*/ mbFlippedXY(FALSE), +/*N*/ mnPosition(0), +/*N*/ maArea(0,0,0,0), +/*N*/ mfMin(0.0), +/*N*/ mfMax(0.0), +/*N*/ mfStep(0.0), +/*N*/ mfStepHelp(0.0), +/*N*/ mfOrigin(0.0), +/*N*/ mbAutoMin(FALSE), +/*N*/ mbAutoMax(FALSE), +/*N*/ mbAutoOrigin(FALSE), +/*N*/ mbAutoStep(FALSE), +/*N*/ mbAutoStepHelp(FALSE), +/*N*/ mbLogarithm(FALSE), +/*N*/ meTextOrient( CHTXTORIENT_AUTOMATIC ), +/*N*/ mnTotalSize(0), +/*N*/ mpTotal(NULL), +/*N*/ mbTotalActual(FALSE), +/*N*/ mbTotalAlloc(FALSE), +/*N*/ mbColStackOK(FALSE), +/*N*/ mpColStack(NULL), +/*N*/ mbShowDescr(FALSE), +/*N*/ mnTicks(CHAXIS_MARK_OUTER), +/*N*/ mnHelpTicks(0), +/*N*/ mbPercentCol(TRUE), +/*N*/ mnMaxTextWidth(-1) +/*N*/ { +/*N*/ mpAxisAttr=new SfxItemSet(mpModel->GetPool(),nAxisWhichPairs); +/*N*/ SetDefaults(); //attribute fuellen +/*N*/ ReadAutoAttr(); //automatik? aus ItemSet holen +/*N*/ ReadAttr(); //evtl. defaults aus Itemset uebernehmen (etwas Overhead, aber sicher) +/*N*/ } + +/*N*/ long ChartAxis::GetUpper(double fData,BOOL bConstrained) +/*N*/ { +/*N*/ long nData; +/*N*/ if(fData < mfOrigin) +/*?*/ nData = GetPos(mfOrigin); +/*N*/ else +/*N*/ nData = GetPos(fData); +/*N*/ +/*N*/ if(!bConstrained) +/*?*/ return nData; +/*N*/ +/*N*/ if(IsVertical()) +/*N*/ return Max(maRefArea.Top(),nData); +/*N*/ else +/*N*/ return Min(maRefArea.Right(),nData); +/*N*/ } +/*N*/ long ChartAxis::GetLower(double fData,BOOL bConstrained) +/*N*/ { +/*N*/ long nData; +/*N*/ +/*N*/ if(fData > mfOrigin) +/*N*/ nData = GetPos(mfOrigin); +/*N*/ else +/*N*/ nData = GetPos(fData); +/*N*/ +/*N*/ if(!bConstrained) +/*?*/ return nData; +/*N*/ +/*N*/ if(IsVertical()) +/*N*/ return Min(maRefArea.Bottom(),nData); +/*N*/ else +/*N*/ return Max(maRefArea.Left(),nData); +/*N*/ } +/*N*/ Pair ChartAxis::Stack(double fData,BOOL bConstrained) +/*N*/ { +/*N*/ double fTop,fBottom; +/*N*/ +/*N*/ if (fData < 0.0)//mfOrigin +/*N*/ { +/*?*/ fTop = mfDataBottom; +/*?*/ mfDataBottom += fData; +/*?*/ fBottom = mfDataBottom; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if( fData == DBL_MIN ) +/*N*/ fData = 0; +/*N*/ fBottom = mfDataTop; +/*N*/ mfDataTop += fData; +/*N*/ fTop = mfDataTop; +/*N*/ } +/*N*/ +/*N*/ if(bConstrained) +/*N*/ { +/*N*/ if(IsVertical()) +/*N*/ return Pair(Max(maRefArea.Top(),GetPos(fTop)) +/*N*/ , Min(maRefArea.Bottom(),GetPos(fBottom)) ); +/*N*/ else +/*N*/ return Pair(Max(maRefArea.Left(),GetPos(fBottom)) +/*N*/ ,Min(maRefArea.Right(),GetPos(fTop)) ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ return Pair(GetPos(fTop),GetPos(fBottom)); +/*N*/ } +/*N*/ } +/*N*/ BOOL ChartAxis::IsVertical() +/*N*/ { +/*N*/ return( (mnId==CHART_AXIS_Y && !mbFlippedXY) +/*N*/ ||(mnId==CHART_AXIS_X && mbFlippedXY)); +/*N*/ } + + +/*N*/ void ChartAxis::ResizeTotal(long nSize) +/*N*/ { +/*N*/ if(nSize && !mbTotalAlloc) +/*N*/ { +/*N*/ if(nSize!=mnTotalSize) +/*N*/ { +/*N*/ if(mpTotal) +/*N*/ delete [] mpTotal; +/*N*/ mnTotalSize = nSize; +/*N*/ mpTotal = new double[mnTotalSize]; +/*N*/ } +/*N*/ +/*N*/ while(nSize--) +/*N*/ mpTotal[nSize]=0.0; +/*N*/ } +/*N*/ mbTotalAlloc=TRUE; +/*N*/ }; +/*N*/ double ChartAxis::Data2Percent(double fData,long nCol,long nRow) +/*N*/ { +/*N*/ double fTotal=GetTotal( mbPercentCol ? nCol : nRow); +/*N*/ +/*N*/ return fTotal ? ( (fabs(fData) / fTotal) * 100.0 ) : DBL_MIN; +/*N*/ } +/*N*/ double ChartAxis::GetTotal(long n) +/*N*/ { +/*N*/ if(!mbTotalActual) +/*N*/ CreateTotal(); +/*N*/ +/*N*/ return mpTotal[n]; +/*N*/ } +/*N*/ void ChartAxis::CreateTotal() +/*N*/ { +/*N*/ if(mbTotalActual) +/*?*/ return ; +/*N*/ +/*N*/ double fData; +/*N*/ +/*N*/ long nColCnt=mpModel->GetColCount(); +/*N*/ long nRowCnt=mpModel->GetRowCount(); +/*N*/ +/*N*/ +/*N*/ if(mbPercentCol) //Prozent auf Datenreihe beziehen! +/*N*/ { +/*N*/ ResizeTotal(nColCnt); //Array anlegen und auf 0.0 setzen +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ ResizeTotal(nRowCnt); //Array anlegen und auf 0.0 setzen +/*N*/ } +/*N*/ +/*N*/ +/*N*/ long nId,nCol; +/*N*/ for(long nRow=0;nRow<nRowCnt;nRow++) +/*N*/ { +/*N*/ nId=((const SfxInt32Item &)(mpModel->GetDataRowAttr(nRow).Get(SCHATTR_AXIS))).GetValue(); +/*N*/ if(nId==mnUId) +/*N*/ { +/*N*/ for(nCol=0;nCol<nColCnt;nCol++) +/*N*/ { +/*N*/ fData=mpModel->GetData(nCol,nRow); +/*N*/ mpTotal[ mbPercentCol ? nCol : nRow] += fabs(fData); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ mbTotalActual=TRUE; //einmal und nie wieder (während eines BuildChart zumindest) +/*N*/ }; + +/*N*/ BOOL ChartAxis::IsOriginInRange() const +/*N*/ { +/*N*/ return ((mfMin <= mfOrigin) && (mfOrigin <= mfMax)); +/*N*/ } + +// Stapeln der Werte je Col (für Liniencharts) +/*N*/ void ChartAxis::InitColStacking(long nColCnt) +/*N*/ { +/*N*/ +/*N*/ +/*N*/ if(mpColStack) +/*N*/ delete [] mpColStack; +/*N*/ mpColStack=new double[nColCnt]; +/*N*/ while(nColCnt--) +/*N*/ mpColStack[nColCnt]=0.0;//mfOrigin ????; +/*N*/ } +//Stapeln der Werte je Column (Stapeln bei LinienCharts) +/*N*/ double ChartAxis::StackColData(double fData,long nCol,long nColCnt) +/*N*/ { +/*N*/ if(!mbColStackOK) +/*N*/ InitColStacking(nColCnt);//falls noch nicht geschehen +/*N*/ mbColStackOK=TRUE;//wird bei Initialise auf FALSE gesetzt +/*N*/ +/*N*/ mpColStack[nCol]+=fData; +/*N*/ return mpColStack[nCol]; +/*N*/ } +//Dies Funktion wird u.A. von Initialise gerufen (sehr früh im Buildvorgang) +//Attribute innerer Schleifen (CretaeMarks, etc.) können hier in Variablen +//gewandelt werden +/*N*/ void ChartAxis::ReadAttr() +/*N*/ { +/*N*/ +/*N*/ //Art der Markierungen (innen/aussen) +/*N*/ mnTicks = ((const SfxInt32Item&)mpAxisAttr->Get(SCHATTR_AXIS_TICKS)).GetValue(); +/*N*/ mnHelpTicks = ((const SfxInt32Item&)mpAxisAttr->Get(SCHATTR_AXIS_HELPTICKS)).GetValue(); +/*N*/ +/*N*/ long nFak = IsVertical() ? -1 : 1; +/*N*/ if(mbSecondary) +/*N*/ nFak*=-1; +/*N*/ +/*N*/ long nHelpFak=nFak; +/*N*/ +/*N*/ mnTickLen=nFak*150; +/*N*/ mnHelpTickLen=nHelpFak*100; +/*N*/ +/*N*/ // WICHTIG! Diese Methode darf keine Member, die Automatisch sind, ueberschreiben! +/*N*/ if (!mbAutoMin) +/*?*/ if ((mbLogarithm && (((const SvxDoubleItem&) mpAxisAttr->Get(SCHATTR_AXIS_MIN)).GetValue() != 0.0)) || !mbLogarithm) +/*?*/ mfMin =((const SvxDoubleItem&) mpAxisAttr->Get(SCHATTR_AXIS_MIN)).GetValue(); +/*N*/ if (!mbAutoMax) +/*?*/ mfMax =((const SvxDoubleItem&) mpAxisAttr->Get(SCHATTR_AXIS_MAX)).GetValue(); +/*N*/ if (!mbAutoOrigin) +/*N*/ mfOrigin=((const SvxDoubleItem&) mpAxisAttr->Get(SCHATTR_AXIS_ORIGIN)).GetValue(); +/*N*/ if(!mbAutoStep) +/*?*/ mfStep =((const SvxDoubleItem&) mpAxisAttr->Get(SCHATTR_AXIS_STEP_MAIN)).GetValue(); +/*N*/ if(!mbAutoStepHelp) +/*?*/ mfStepHelp=((const SvxDoubleItem&) mpAxisAttr->Get(SCHATTR_AXIS_STEP_HELP)).GetValue(); +/*N*/ +/*N*/ } + +/*N*/ void ChartAxis::ReadAutoAttr() //OK +/*N*/ { +/*N*/ mbLogarithm = ((const SfxBoolItem&) mpAxisAttr->Get(SCHATTR_AXIS_LOGARITHM)).GetValue(); +/*N*/ mbAutoStep = ((const SfxBoolItem&) mpAxisAttr->Get(SCHATTR_AXIS_AUTO_STEP_MAIN)).GetValue(); +/*N*/ mbAutoStepHelp = ((const SfxBoolItem&) mpAxisAttr->Get(SCHATTR_AXIS_AUTO_STEP_HELP)).GetValue(); +/*N*/ mbAutoMin = ((const SfxBoolItem&) mpAxisAttr->Get(SCHATTR_AXIS_AUTO_MIN)).GetValue(); +/*N*/ mbAutoMax = ((const SfxBoolItem&) mpAxisAttr->Get(SCHATTR_AXIS_AUTO_MAX)).GetValue(); +/*N*/ mbAutoOrigin = ((const SfxBoolItem&) mpAxisAttr->Get(SCHATTR_AXIS_AUTO_ORIGIN)).GetValue(); +/*N*/ } + +//ToDo: dies Fkt. ueberfluessig machen + +/* ************************************************************************ +|* +|* Minimum und Maximum berechnen, Wertebereich +|* +|* ToDo: Dies Methode muss komplett auf Verbundcharts umgestellt werden, + Damit faellt meStackMode weg, es muss fuer jede Reihe geprueft werden, + wie diese gezeichnet werden soll! +\*********************************************************************** */ +/*N*/ inline double ChartAxis::GetRowError(long nRow) +/*N*/ { +/*N*/ switch((SvxChartKindError)((const SfxInt32Item &)mpModel->GetDataRowAttr(nRow).Get(SCHATTR_STAT_KIND_ERROR)).GetValue()) +/*N*/ { +/*N*/ case CHERROR_VARIANT : +/*N*/ return mpModel->GetVariantY(nRow); +/*N*/ break; +/*N*/ +/*N*/ case CHERROR_SIGMA : +/*N*/ return mpModel->GetSigmaY(nRow); +/*N*/ break; +/*N*/ +/*N*/ case CHERROR_BIGERROR : +/*N*/ return mpModel->GetBigErrorY(nRow, +/*N*/ ((const SvxDoubleItem &)mpModel->GetDataRowAttr(nRow).Get(SCHATTR_STAT_BIGERROR)).GetValue()); +/*N*/ break; +/*N*/ +/*N*/ default : +/*N*/ break; +/*N*/ } +/*N*/ return 0.0; +/*N*/ } +/*N*/ inline BOOL ChartAxis::IsDataOnAxis(long nRow) +/*N*/ { +/*N*/ return(mnUId == ((const SfxInt32Item &)mpModel->GetDataRowAttr(nRow) +/*N*/ .Get(SCHATTR_AXIS)).GetValue()) ; +/*N*/ } + +/*N*/ BOOL ChartAxis::GetMinMaxFromData() +/*N*/ { +/*N*/ BOOL bOK=FALSE; +/*N*/ +/*N*/ long nColCnt = mpModel->GetColCount(); +/*N*/ long nRowCnt = mpModel->GetRowCount(); +/*N*/ long nCol,nRow; +/*N*/ +/*N*/ BOOL bInitialise=TRUE; //statt dem nCol=0&&nRow=0-Unsinn, damit ungültige Daten berücksichtigt werden +/*N*/ +/*N*/ double fMin = 0.0; +/*N*/ double fMax = 0.0; +/*N*/ +/*N*/ //Verbundchart Typ 2, letzte Reihe ist Linie, nach switch(meStackMode) +/*N*/ //folgt dann die beruecksichtigung dieser Linie +/*N*/ long nLines = Min((long)mpModel->GetNumLinesColChart(),(long)(nRowCnt-1));;//#50212# +/*N*/ +/*N*/ if(mpModel->ChartStyle() == CHSTYLE_2D_LINE_STACKEDCOLUMN) +/*N*/ nRowCnt-=nLines; +/*N*/ else +/*N*/ nLines=0; +/*N*/ +/*N*/ switch (meStackMode) +/*N*/ { +/*N*/ //Min = Min(0,Summe aller negativen Daten) +/*N*/ //Max = Max(0,Summe aller positiven Daten) +/*N*/ case CHSTACK_MINMAX: +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fMinTotal = 0.0; +/*N*/ double fMaxTotal = 0.0; +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ +/*N*/ if(IsDataOnAxis(nRow)) +/*N*/ { +/*N*/ bOK=TRUE; +/*N*/ +/*N*/ double fData = GetData(nCol, nRow);//mpModel->GetData(nCol, nRow, mbPercent); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ if (fData < 0.0) +/*N*/ fMinTotal += fData; +/*N*/ else if (fData > 0.0) +/*N*/ fMaxTotal += fData; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (nCol == 0) //nicht gut, aber hier kann man sowas machen, irgendne Reihe hat Daten! +/*N*/ { +/*N*/ fMin = fMinTotal; +/*N*/ fMax = fMaxTotal; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (fMin > fMinTotal) +/*N*/ fMin = fMinTotal; +/*N*/ if (fMax < fMaxTotal) +/*N*/ fMax = fMaxTotal; +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ //Min = Min(0,Min(Daten)) +/*N*/ //Max = Max(0,Summe aller Daten) +/*N*/ case CHSTACK_OVERLAP: +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fTotal = 0.0; +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ if(IsDataOnAxis(nRow)) +/*N*/ { +/*N*/ bOK=TRUE; +/*N*/ +/*N*/ double rTemp = GetData(nCol, nRow);//mpModel->GetData(nCol, nRow, mbPercent); +/*N*/ +/*N*/ if (rTemp != DBL_MIN) +/*N*/ { +/*N*/ if(fMin > rTemp) +/*N*/ fMin = rTemp; +/*N*/ fTotal += rTemp; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(fMax < fTotal) +/*N*/ fMax = fTotal; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ if (mpModel->IsXYChart ()) +/*N*/ { +/*N*/ if(mnId == CHART_AXIS_X) +/*N*/ { +/*N*/ // here: x axis values are in row 0, so just iterate over col +/*N*/ for( nCol = 0; nCol < nColCnt; nCol++ ) +/*N*/ { +/*N*/ double fData = GetData( nCol, 0 ); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ if (nCol == 0) //naja, so eigentlich nicht.... aber die X-Achse sollte eh vollständig sein +/*N*/ { +/*N*/ fMin = fData; +/*N*/ fMax = fData; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ //if ((fMin > fData) && !mbLogarithm || (fData > 0.0) && mbLogarithm) +/*N*/ if( (fMin > fData) +/*N*/ && (!mbLogarithm || fData > 0.0) ) +/*N*/ fMin = fData; +/*N*/ +/*N*/ if (fMax < fData) +/*N*/ fMax = fData; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else // y axis +/*N*/ { +/*N*/ // #69912# use x axis range for determining the auto values for y axis +/*N*/ ChartAxis* pXAxis = mpModel->GetAxisByUID( CHART_AXIS_PRIMARY_X ); +/*N*/ double fXMin = pXAxis->GetMin(); +/*N*/ double fXMax = pXAxis->GetMax(); +/*N*/ +/*N*/ // set min and max to 0/1 resp. in case the x range is empty +/*N*/ fMin = 0.0; +/*N*/ fMax = 1.0; +/*N*/ +/*N*/ for (nRow = 1; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ //if(IsDataOnAxis(nRow)) //#63904#: 2,77% +/*N*/ const SfxItemSet& rDataRowAttr = mpModel->GetDataRowAttr(nRow); +/*N*/ if(mnUId == ((const SfxInt32Item &)rDataRowAttr.Get(SCHATTR_AXIS)).GetValue()) +/*N*/ { +/*N*/ bOK=TRUE; +/*N*/ +/*N*/ double fDiffUp = 0.0; +/*N*/ double fDiffDown = 0.0; +/*N*/ fDiffUp=fDiffDown=GetRowError(nRow); // rm1 +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ // #69912# +/*N*/ double xVal = GetData( nCol, 0 ); +/*N*/ if( fXMin <= xVal && xVal <= fXMax ) +/*N*/ { +/*N*/ double fData = GetData( nCol, nRow ); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ double fDataMin = fData; +/*N*/ double fDataMax = fData; +/*N*/ +/*N*/ //#63904#neu: (18.8 ms -> 7.28 ms ) +/*N*/ // SfxItemSet aDataPointAttr(rDataRowAttr); +/*N*/ // mpModel->MergeDataPointAttr(aDataPointAttr,nCol, nRow); +/*N*/ // SfxItemSet aDataPointAttr(mpModel->GetFullDataPointAttr(nCol, nRow));//#63904#71% 69,66% +/*N*/ const SfxItemSet * pDataPointItemSet = mpModel->GetRawDataPointAttr (nCol,nRow); +/*N*/ BOOL bDataPointItemSetValid = (pDataPointItemSet!=NULL); +/*N*/ +/*N*/ const SfxPoolItem * pItem = sch::GetItem( +/*N*/ SCHATTR_STAT_KIND_ERROR, +/*N*/ rDataRowAttr, +/*N*/ *pDataPointItemSet, bDataPointItemSetValid ); +/*N*/ +/*N*/ DBG_ASSERT( pItem != NULL, "Invalid Itemset" ); +/*N*/ if( pItem != NULL ) +/*N*/ { +/*N*/ switch (static_cast<SvxChartKindError>( +/*N*/ static_cast<const SfxInt32Item&>( *pItem ).GetValue ())) +/*N*/ { +/*?*/ case CHERROR_PERCENT : +/*?*/ fDiffUp = +/*?*/ fDiffDown = fData * static_cast<const SvxDoubleItem&>(*sch::GetItem( +/*?*/ SCHATTR_STAT_PERCENT, +/*?*/ rDataRowAttr, +/*?*/ *pDataPointItemSet, bDataPointItemSetValid)).GetValue () +/*?*/ / 100.0; +/*?*/ break; +/*?*/ +/*?*/ case CHERROR_CONST : +/*?*/ fDiffUp = fData + static_cast<const SvxDoubleItem&>(*sch::GetItem( +/*?*/ SCHATTR_STAT_CONSTPLUS, +/*?*/ rDataRowAttr, +/*?*/ *pDataPointItemSet, bDataPointItemSetValid)).GetValue (); +/*?*/ fDiffDown = fData + static_cast<const SvxDoubleItem&>(*sch::GetItem( +/*?*/ SCHATTR_STAT_CONSTMINUS, +/*?*/ rDataRowAttr, +/*?*/ *pDataPointItemSet, bDataPointItemSetValid)).GetValue (); +/*N*/ break; +/*N*/ +/*N*/ default : +/*N*/ ; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pItem = sch::GetItem( +/*N*/ SCHATTR_STAT_INDICATE, +/*N*/ rDataRowAttr, +/*N*/ *pDataPointItemSet, bDataPointItemSetValid ); +/*N*/ +/*N*/ DBG_ASSERT( pItem != NULL, "Invalid Itemset" ); +/*N*/ if( pItem != NULL ) +/*N*/ { +/*N*/ switch (static_cast<SvxChartIndicate>( +/*N*/ static_cast<const SfxInt32Item&>( *pItem ).GetValue ())) +/*N*/ { +/*N*/ case CHINDICATE_BOTH : +/*?*/ fDataMin -= fDiffDown; +/*?*/ fDataMax += fDiffUp; +/*?*/ break; +/*?*/ +/*?*/ case CHINDICATE_UP : +/*?*/ fDataMax += fDiffUp; +/*?*/ break; +/*?*/ +/*?*/ case CHINDICATE_DOWN : +/*?*/ fDataMin -= fDiffDown; +/*?*/ break; +/*N*/ +/*N*/ case CHINDICATE_NONE : +/*N*/ default : +/*N*/ ; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //if ((nCol == 0) && (nRow == 1)) //und wenn hier mal DBL_MIN steht???? +/*N*/ if(bInitialise) +/*N*/ { +/*N*/ bInitialise=FALSE; +/*N*/ fMin = fDataMin; +/*N*/ fMax = fDataMax; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if ( (fMin > fDataMin) +/*N*/ && (!mbLogarithm || fDataMin > 0.0) ) +/*N*/ fMin = fDataMin; +/*N*/ +/*N*/ if (fMax < fDataMax) +/*N*/ fMax = fDataMax; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else // ! XY-Chart ... Hier landen auch die StockCharts +/*N*/ { +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ //if(IsDataOnAxis(nRow)) //#63904#neu: +/*N*/ const SfxItemSet& rDataRowAttr = mpModel->GetDataRowAttr(nRow); +/*N*/ if(mnUId == ((const SfxInt32Item &)rDataRowAttr.Get(SCHATTR_AXIS)).GetValue()) +/*N*/ { +/*N*/ bOK=TRUE; +/*N*/ +/*N*/ double fDiffUp = 0.0; +/*N*/ double fDiffDown = 0.0; +/*N*/ +/*N*/ fDiffUp=fDiffDown=GetRowError(nRow);//rm3 +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fData = GetData(nCol, nRow); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ double fDataMin = fData; +/*N*/ double fDataMax = fData; +/*N*/ +/*N*/ //#63904# +/*N*/ // SfxItemSet aDataPointAttr(rDataRowAttr); +/*N*/ // mpModel->MergeDataPointAttr(aDataPointAttr,nCol, nRow); +/*N*/ //SfxItemSet aDataPointAttr(mpModel->GetFullDataPointAttr(nCol, nRow)); +/*N*/ const SfxItemSet * pDataPointItemSet = mpModel->GetRawDataPointAttr (nCol,nRow); +/*N*/ BOOL bDataPointItemSetValid = (pDataPointItemSet!=NULL); +/*N*/ +/*N*/ const SfxPoolItem * pItem = sch::GetItem( +/*N*/ SCHATTR_STAT_KIND_ERROR, +/*N*/ rDataRowAttr, +/*N*/ *pDataPointItemSet, bDataPointItemSetValid); +/*N*/ +/*N*/ DBG_ASSERT( pItem != NULL, "Invalid Itemset" ); +/*N*/ if( pItem != NULL ) +/*N*/ { +/*N*/ switch (static_cast<SvxChartKindError>( +/*N*/ static_cast<const SfxInt32Item&>( *pItem ).GetValue ())) +/*N*/ { +/*?*/ case CHERROR_PERCENT : +/*?*/ fDiffUp = +/*?*/ fDiffDown = fData * static_cast<const SvxDoubleItem&>(*sch::GetItem( +/*?*/ SCHATTR_STAT_PERCENT, +/*?*/ rDataRowAttr, +/*?*/ *pDataPointItemSet, bDataPointItemSetValid)).GetValue () +/*?*/ / 100.0; +/*?*/ break; +/*?*/ +/*?*/ case CHERROR_CONST : +/*?*/ fDiffUp = fData + static_cast<const SvxDoubleItem&>(*sch::GetItem( +/*?*/ SCHATTR_STAT_CONSTPLUS, +/*?*/ rDataRowAttr, +/*?*/ *pDataPointItemSet, bDataPointItemSetValid)).GetValue (); +/*?*/ fDiffDown = fData + static_cast<const SvxDoubleItem&>(*sch::GetItem( +/*?*/ SCHATTR_STAT_CONSTMINUS, +/*?*/ rDataRowAttr, +/*?*/ *pDataPointItemSet, bDataPointItemSetValid)).GetValue (); +/*?*/ break; +/*N*/ +/*N*/ default : +/*N*/ ; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ DBG_ASSERT( pItem != NULL, "Invalid Itemset" ); +/*N*/ pItem = sch::GetItem( +/*N*/ SCHATTR_STAT_INDICATE, +/*N*/ rDataRowAttr, +/*N*/ *pDataPointItemSet, bDataPointItemSetValid ); +/*N*/ +/*N*/ if( pItem != NULL ) +/*N*/ { +/*N*/ switch (static_cast<SvxChartIndicate>( +/*N*/ static_cast<const SfxInt32Item&>( *pItem ).GetValue ())) +/*N*/ { +/*?*/ case CHINDICATE_BOTH : +/*?*/ fDataMin -= fDiffDown; +/*?*/ fDataMax += fDiffUp; +/*?*/ break; +/*?*/ +/*?*/ case CHINDICATE_UP : +/*?*/ fDataMax += fDiffUp; +/*?*/ break; +/*?*/ +/*?*/ case CHINDICATE_DOWN : +/*?*/ fDataMin -= fDiffDown; +/*?*/ break; +/*N*/ +/*N*/ case CHINDICATE_NONE : +/*N*/ default : +/*N*/ ; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //if ((nCol == 0) && (nRow == 0))//und wenn hier mal DBL_MIN steht???? +/*N*/ if(bInitialise) +/*N*/ { +/*N*/ bInitialise=FALSE; +/*N*/ fMin = fDataMin; +/*N*/ fMax = fDataMax; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if ((fMin > fDataMin) +/*N*/ && (!mbLogarithm ||(fDataMin > 0.0))) +/*N*/ fMin = fDataMin; +/*N*/ if (fMax < fDataMax) +/*N*/ fMax = fDataMax; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ break; +/*N*/ }//switch meStackMode +/*N*/ +/*N*/ +/*N*/ // bei CHSTYLE_2D_LINE_STACKEDCOLUMN muessen die Linien nochmal extra berechnet +/*N*/ // werden Letzte Linie = nRowCnt, da oben nRowCnt-=n #50212# +/*N*/ long nIndex=nRowCnt;//ab hier liegen evtl. linien vor +/*N*/ while(nLines) //nLines ist 0 wenn kein CHSTYLE_2D_LINE_STACKEDCOLUMN +/*N*/ { +/*?*/ if( IsDataOnAxis( nIndex )) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");}//STRIP001 UpdateRowMinMax( nIndex, nColCnt, mbPercent, fMin, fMax ); +/*?*/ nLines--; +/*?*/ nIndex++; +/*N*/ } +/*N*/ if (mbPercent) +/*N*/ { +/*N*/ fMin = 0.0; +/*N*/ if (fMax > 100.0) +/*N*/ fMax = 100.0; +/*N*/ } +/*N*/ +/*N*/ if( mbAutoMin ) +/*N*/ mfMin = fMin; +/*N*/ +/*N*/ if( mbAutoMax ) +/*N*/ mfMax = fMax; +/*N*/ +/*N*/ return bOK; +/*N*/ } + +//Ab jetzt wird die Achse gebaut, die meisten Werte können nicht mehr geändert werden, +//da wir uns im BuildChart (genauer: zumeist in Create<n>DBackplanes) befinden. +//allerdings wird die Area noch verändert. Davn unabhängige Werte, z.B. Items können +//in Variablen gebuffert werden +/*N*/ void ChartAxis::Initialise(const Rectangle &rRect,BOOL bFlippedXY +/*N*/ ,long eStackmode,BOOL bPercent +/*N*/ ,BOOL bRadial,BOOL bPercentCol) +/*N*/ +/*N*/ { +/*N*/ mnMaxTextWidth=-1; +/*N*/ mbInnerPos=FALSE; +/*N*/ mbAlternativIdUsed=FALSE; +/*N*/ mbTextOverlap= ((const SfxBoolItem&)mpAxisAttr->Get(SCHATTR_TEXT_OVERLAP)).GetValue(); +/*N*/ mbPercentCol=bPercentCol; +/*N*/ mbPercent=bPercent; +/*N*/ maArea=rRect; +/*N*/ mbFlippedXY=bFlippedXY; +/*N*/ meStackMode=eStackmode; +/*N*/ mbRadial=bRadial; +/*N*/ mbShowDescr=HasDescription(); +/*N*/ +/*N*/ mbColStackOK=FALSE; //noch nix gestapelt, noch nicht initialisiert +/*N*/ mbTotalActual=FALSE; //anzahl cols/daten könnten verändert sein! +/*N*/ mbTotalAlloc =FALSE; //anzahl cols/daten könnten verändert sein! +/*N*/ +/*N*/ mpMainGridList=NULL; +/*N*/ mpHelpGridList=NULL; +/*N*/ mpAxisList=NULL; +/*N*/ +/*N*/ //Atribute auslesen, etwas Overhead, ToDo: optimieren +/*N*/ ReadAutoAttr(); +/*N*/ ReadAttr(); +/*N*/ // #84601# set Min/Max etc. at the local item set! +/*N*/ if( mpAxisAttr ) +/*N*/ GetMembersAsAttr( *mpAxisAttr ); +/*N*/ }; + +/*N*/ void ChartAxis::GetMembersAsAttr(SfxItemSet& rSet) const +/*N*/ { +/*N*/ rSet.Put(SfxUInt32Item(SID_ATTR_NUMBERFORMAT_VALUE,((ChartAxis*)this)->GetNumFormat())); +/*N*/ rSet.Put(SvxDoubleItem(mfMin , SCHATTR_AXIS_MIN)); +/*N*/ rSet.Put(SvxDoubleItem(mfMax , SCHATTR_AXIS_MAX)); +/*N*/ rSet.Put(SvxDoubleItem(mfStep , SCHATTR_AXIS_STEP_MAIN)); +/*N*/ rSet.Put(SvxDoubleItem(mfStepHelp , SCHATTR_AXIS_STEP_HELP)); +/*N*/ rSet.Put(SvxDoubleItem(mfOrigin , SCHATTR_AXIS_ORIGIN)); +/*N*/ } + +/*N*/ void ChartAxis::CalcMinMaxValue() +/*N*/ { +/*N*/ +/*N*/ if (mbAutoMin || mbAutoMax) //Dann alle Werte generieren +/*N*/ { +/*N*/ if(!GetMinMaxFromData() && mnAlternateId && /*#63904#:*/(IsVisible()||HasDescription())) +/*N*/ { +/*?*/ long tmp=mnUId; +/*?*/ mnUId=mnAlternateId; +/*?*/ GetMinMaxFromData(); +/*?*/ mbAlternativIdUsed=TRUE; +/*?*/ mnUId=tmp; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (mfMin > mfMax) //ToDo: Korrektur, sollte aber ueberfluessig sein +/*N*/ { +/*?*/ double fTemp = mfMin; +/*?*/ mfMin=mfMax; +/*?*/ mfMax=fTemp; +/*N*/ } +/*N*/ +/*N*/ ReadAttr(); //Alle nicht-automatischen Wertze werden jetzt geholt +/*N*/ +/*N*/ if ((mfMin != DBL_MIN) || (mfMax != DBL_MIN)) +/*N*/ { +/*N*/ if (mfMin > mfMax) //noch ne Korrektur, diese ist aber noetig! +/*N*/ { +/*?*/ if( mbAutoMax ) +/*?*/ mfMax = mfMin; +/*?*/ else if( mbAutoMin ) +/*?*/ mfMin = mfMax; +/*?*/ else +/*?*/ { +/*?*/ DBG_ERROR( "Minimum is greater than Maximum" ); +/*?*/ double fTemp = mfMin; +/*?*/ +/*?*/ mfMin = mfMax; +/*?*/ mfMax = fTemp; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ if (mbLogarithm) +/*N*/ { +/*?*/ if (mbAutoMin) +/*?*/ { +/*?*/ if (mfMin > 1.0) +/*?*/ { +/*?*/ double fVal = 1.0; +/*?*/ +/*?*/ while (fVal < mfMin) +/*?*/ fVal *= 10.0; +/*?*/ +/*?*/ if (fVal > mfMin) fVal /= 10.0; +/*?*/ mfMin = fVal; +/*?*/ } +/*?*/ else if (mfMin > 0.0) +/*?*/ { +/*?*/ double fVal = 1.0; +/*?*/ +/*?*/ while (fVal > mfMin) +/*?*/ fVal /= 10.0; +/*?*/ +/*?*/ mfMin = fVal; +/*?*/ } +/*?*/ else mfMin = 1.0; +/*?*/ } +/*?*/ +/*?*/ if (mbAutoMax) +/*?*/ { +/*?*/ if (mfMax > 1.0) +/*?*/ { +/*?*/ double fVal = 1.0; +/*?*/ +/*?*/ while (fVal < mfMax) +/*?*/ fVal *= 10.0; +/*?*/ +/*?*/ mfMax = fVal; +/*?*/ } +/*?*/ else if (mfMax > 0.0) +/*?*/ { +/*?*/ double fVal = 1.0; +/*?*/ +/*?*/ while (fVal > mfMax) +/*?*/ fVal /= 10.0; +/*?*/ +/*?*/ if (fVal < mfMax) fVal *= 10.0; +/*?*/ mfMax = fVal; +/*?*/ } +/*?*/ else mfMax = 1.0; +/*?*/ } +/*?*/ +/*?*/ if (mfMax - mfMin == 0.0) mfMax = mfMin * 10.0; +/*?*/ if (mfOrigin != mfMin) mfOrigin = mfMin; +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ if (!mpModel->IsNegativeChart() && (mfMin < 0.0) || +/*N*/ mbAutoMin && (mfMin > 0.0)) mfMin = SizeBounds (mfMin, mfMax, FALSE); +/*N*/ if (mbAutoMax && (mfMax < 0.0)) mfMax = SizeBounds (mfMin, mfMax, TRUE); +/*N*/ +/*N*/ if (mfMax - mfMin == 0.0) mfMax = mfMin + 1.0; +/*N*/ +/*N*/ if (mbAutoOrigin) +/*N*/ { +/*N*/ mfOrigin = 0.0; +/*N*/ if (mfOrigin < mfMin) mfOrigin = mfMin; +/*N*/ else if (mfOrigin > mfMax) mfOrigin = mfMax; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (mfOrigin < mfMin) mfMin = mfOrigin; +/*N*/ if (mfOrigin > mfMax) mfMax = mfOrigin; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/* ************************************************************************ +|* +|* Faktor fuer Koordinaten-Multiplikation berechnen +|* abart der globalen Funktion mit den ChartAxis-Membervariablen +|* +\*********************************************************************** */ +/*N*/ void ChartAxis::LoadMemberCompat(SvStream& rIn) +/*N*/ { +/*N*/ rIn >> mfMin; +/*N*/ rIn >> mfMax; +/*N*/ rIn >> mfStep; +/*N*/ rIn >> mfStepHelp; +/*N*/ rIn >> mfOrigin; +/*N*/ +/*N*/ +/*N*/ mpAxisAttr->Put(SvxDoubleItem(mfMin , SCHATTR_AXIS_MIN)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(mfMax , SCHATTR_AXIS_MAX)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(mfStep , SCHATTR_AXIS_STEP_MAIN)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(mfStepHelp , SCHATTR_AXIS_STEP_HELP)); +/*N*/ mpAxisAttr->Put(SvxDoubleItem(mfOrigin , SCHATTR_AXIS_ORIGIN)); +/*N*/ +/*N*/ CHART_TRACE2( "ChartAxis::LoadMemberCompat min=%lf, max=%lf", mfMin, mfMax ); +/*N*/ CHART_TRACE3( "... step=%lf, help=%lf, origin=%lf", mfStep, mfStepHelp, mfOrigin ); +/*N*/ } + +/*N*/ void ChartAxis::StoreMemberCompat(SvStream& rOut) const +/*N*/ { +/*N*/ rOut << mfMin; +/*N*/ rOut << mfMax; +/*N*/ rOut << mfStep; +/*N*/ rOut << mfStepHelp; +/*N*/ rOut << mfOrigin; +/*N*/ } +//ToDo: nLen ist maArea.Width(),Height, oder das ganze bei NetChart /2 (vermutlich) +/*N*/ long ChartAxis::GetLength() const +/*N*/ { +/*N*/ if(mbRadial)//&& Achse=Y (ist aber immer so bei NetCharts) +/*N*/ return maArea.GetHeight () / 2; +/*N*/ +/*N*/ switch(mnId) +/*N*/ { +/*N*/ case CHART_AXIS_X: +/*N*/ return mbFlippedXY ? maArea.GetHeight() : maArea.GetWidth(); +/*N*/ break; +/*N*/ case CHART_AXIS_Y: +/*N*/ return mbFlippedXY ? maArea.GetWidth() : maArea.GetHeight(); +/*N*/ break; +/*N*/ case CHART_AXIS_Z: +/*N*/ return (maArea.GetWidth() * 4) / 6; //ToDo: Das hier ist doch quark... kein Flipped?:; +/*N*/ break; +/*N*/ } +/*?*/ DBG_ERROR("ChartAxis::GetLenght() implementation error - ZAxis failure"); +/*?*/ return maArea.GetWidth(); +/*N*/ } + + + + +/** + @descr Calculate the size of the bounding box of a text string. The size + is measured with respect to the coordinate axes. + + @param rTextAttr Attributes of the font to use. + @param aString The "typical" description. + + @return Returns the size of the bounding box of the text. +*/ +/*N*/ Size ChartAxis::CalcDescriptionSize (const SfxItemSet * rTextAttr, +/*N*/ const String & aString) +/*N*/ { +/*N*/ // Get output device, store old page size and set paper size to +/*N*/ // maximal size to inhibit line breaks. +/*N*/ Outliner * pOutliner = mpModel->GetOutliner(); +/*N*/ pOutliner->SetUpdateMode (FALSE); +/*N*/ Size aOldPaperSize (pOutliner->GetPaperSize()); +/*N*/ pOutliner->SetPaperSize (Size (100000,100000)); // Maximal paper size ? +/*N*/ +/*N*/ // Save first paragraphs attributes, switch off hyphenation, and +/*N*/ // set the font attributes. +/*N*/ SfxItemSet aOldAttr (pOutliner->GetParaAttribs(0)); +/*N*/ SfxItemSet aNewAttr (aOldAttr); +/*N*/ aNewAttr.Put (SfxBoolItem(EE_PARA_HYPHENATE, FALSE)); +/*N*/ aNewAttr.Put (*rTextAttr); +/*N*/ mpModel->SetTextAttributes (aNewAttr); +/*N*/ +/*N*/ // synchronize item with member +/*N*/ meTextOrient = ((const SvxChartTextOrientItem&) +/*N*/ mpAxisAttr->Get(SCHATTR_TEXT_ORIENT)).GetValue(); +/*N*/ // Determine the size of the texts bounding box. +/*N*/ if (meTextOrient == CHTXTORIENT_STACKED) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pOutliner->SetText (StackString(aString), pOutliner->GetParagraph (0)); +/*N*/ else +/*N*/ pOutliner->SetText(aString, pOutliner->GetParagraph (0)); +/*N*/ pOutliner->SetUpdateMode (TRUE); +/*N*/ Size aSize = pOutliner->CalcTextSize(); +/*N*/ // remove content and attributes +/*N*/ pOutliner->Clear(); +/*N*/ pOutliner->SetUpdateMode (FALSE); +/*N*/ +/*N*/ // Restore the old font and old paper size. +/*N*/ mpModel->SetTextAttributes (aOldAttr); +/*N*/ pOutliner->SetPaperSize (aOldPaperSize); +/*N*/ pOutliner->SetUpdateMode (TRUE); +/*N*/ +/*N*/ return (aSize); +/*N*/ } + + + + +/** + @descr Calculate the expected size of a "typical" description. The size + is measured along the axis. The axis orientation is taken into + account. + @precond CalcMinMaxValue() has to have been called already. + + @param rAttr Attributes of the font to use. + + @return Returns the size of the text projected onto the axis. +*/ +/*N*/ long int ChartAxis::CalcTypicalDescriptionSize (const SfxItemSet * rAttr) +/*N*/ { +/*N*/ String aString; +/*N*/ Color * pDummy = NULL; +/*N*/ Size aSize, +/*N*/ aMaxSize; +/*N*/ +/*N*/ // As typical text we use the minimum and maximum and some randomly +/*N*/ // chose value in between. This relies on a previous call to +/*N*/ // CalcMinMaxValue(). +/*N*/ mpNumFormatter->GetOutputString (mfMin, GetNumFormat(), aString, &pDummy); +/*N*/ aMaxSize = CalcDescriptionSize (rAttr, aString); +/*N*/ +/*N*/ mpNumFormatter->GetOutputString (mfMax, GetNumFormat(), aString, &pDummy); +/*N*/ aSize = CalcDescriptionSize (rAttr, aString); +/*N*/ if (aSize.Width() > aMaxSize.Width()) +/*N*/ aMaxSize.Width() = aSize.Width(); +/*N*/ if (aSize.Height() > aMaxSize.Height()) +/*?*/ aMaxSize.Height() = aSize.Height(); +/*N*/ +/*N*/ double fPos = 0.53, // Arbitrary position between mfMin and mfMax. +/*N*/ fValue = (1-fPos) * mfMin + fPos * mfMax; +/*N*/ mpNumFormatter->GetOutputString (fValue, GetNumFormat(), aString, &pDummy); +/*N*/ aSize = CalcDescriptionSize (rAttr, aString); +/*N*/ if (aSize.Width() > aMaxSize.Width()) +/*N*/ aMaxSize.Width() = aSize.Width(); +/*N*/ if (aSize.Height() > aMaxSize.Height()) +/*?*/ aMaxSize.Height() = aSize.Height(); +/*N*/ +/*N*/ // Select the right coordinate and return it. +/*N*/ if (IsVertical()) +/*N*/ return (aMaxSize.Height()); +/*N*/ else +/*N*/ return (aMaxSize.Width()); +/*N*/ } + + +/** + @descr Calculate the intervall delimited by mfMin and mfMax for which + tick marks are drawn, its origin (mfOrigin), which is either zero + if inside the intervall or mfMin or mfMax otherwise. The + distance between two adjacent tick marks of the main grid is + stored into mfStep and the distance for the help grid into + mfStepHelp. +*/ +/*N*/ void ChartAxis::CalcValueSteps (void) +/*N*/ { +/*N*/ long nLen=GetLength(); +/*N*/ +/*N*/ ReadAutoAttr(); //mbAuto* aus mpAxisAttr lesen +/*N*/ +/*N*/ CalcMinMaxValue(); //Min und Max bestimmen +/*N*/ +/*N*/ if (mfMax == DBL_MIN) +/*N*/ { +/*N*/ mfMax = +/*N*/ mfOrigin = +/*N*/ mfMin = +/*N*/ mfStep = +/*N*/ mfStepHelp = 0.0; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ double fRange = mfMax-mfMin, +/*N*/ fApproximateDescriptionSize +/*N*/ = 2.5 * CalcTypicalDescriptionSize(mpAxisAttr); +/*N*/ // former value: (mpModel->GetLineHeight(*mpAxisAttr) * 3) +/*N*/ long nMaxSteps = (long int)(nLen / fApproximateDescriptionSize); +/*N*/ +/*N*/ if (mbLogarithm) +/*N*/ { +/*N*/ if (mbAutoStep) +/*N*/ mfStep = 10.0; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (mbAutoStep) +/*N*/ { +/*N*/ // Find smallest power of 10 lower than or equal to fRange, +/*N*/ // that scales fFactor into the interval [1,10]. +/*N*/ double fFactor = pow ((double)10, floor (log10 (fRange))); +/*N*/ fRange /= fFactor; +/*N*/ +/*N*/ // Calculate mfStep so that the number of divisions (nSteps) +/*N*/ // is 'not much' higher than nMaxSteps. The value of nSteps +/*N*/ // is increased succesively to multiples of 2*10^k, 4*10^k, +/*N*/ // 5*10^k, and 10*10^k, with k>=0. +/*N*/ long nSteps = 1; +/*N*/ mfStep = 10.0; +/*N*/ if (nSteps < nMaxSteps) +/*N*/ { +/*N*/ short nDepth = 0; +/*N*/ +/*N*/ do +/*N*/ { +/*N*/ if (nDepth % 4 == 2) mfStep = mfStep * 4.0 / 5.0; +/*N*/ else mfStep /= 2.0; +/*N*/ +/*N*/ nSteps = (long)(fRange / mfStep); +/*N*/ nDepth++; +/*N*/ } +/*N*/ while (nSteps < nMaxSteps); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (mfStep > fRange) +/*N*/ { +/*N*/ short nDepth = 0; +/*N*/ double fStep = mfStep; +/*N*/ +/*N*/ do +/*N*/ { +/*N*/ if (nDepth % 4 == 2) fStep = fStep * 4.0 / 5.0; +/*N*/ else fStep /= 2.0; +/*N*/ +/*N*/ if (fStep >= fRange) mfStep = fStep; +/*N*/ +/*N*/ nDepth++; +/*N*/ } +/*N*/ while (fStep > fRange); +/*N*/ } +/*N*/ } +/*N*/ mfStep *= fFactor; +/*N*/ +/*N*/ // Special treatment for dates and times. +/*N*/ short int nNumberFormat = mpNumFormatter->GetType ( +/*N*/ GetNumFormat()); +/*N*/ BOOL bIsDate = (nNumberFormat & NUMBERFORMAT_DATE) != 0; +/*N*/ BOOL bIsTime = (nNumberFormat & NUMBERFORMAT_TIME) != 0; +/*N*/ // At the moment the only special case is this: +/*N*/ // Dates without time are spaced whole days apart. +/*N*/ if (bIsDate && ! bIsTime) +/*N*/ { +/*N*/ mfStep = ceil(mfStep); +/*N*/ if (mfStep < 1) +/*N*/ mfStep = 1; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Make sure that the step width is positive and not equal to +/*N*/ // zero. +/*N*/ if ((mfStep<0) || (mfMin+mfStep==mfMin) || (mfMax+mfStep==mfMax)) +/*N*/ { +/*N*/ DBG_ERROR( "Decrement of <= 0.0 not allowed" ); +/*N*/ mfStep = 1.0; // to prevent loop +/*N*/ } +/*N*/ +/*N*/ if (mbAutoMin) +/*N*/ { +/*N*/ double fMin = 0.0; +/*N*/ +/*N*/ // Adjust mfMin to the largest value that is lower than or +/*N*/ // equal to its current value and is an integer multiple of +/*N*/ // mfSteps away of fMin. +/*N*/ if (fMin > mfMin) +/*N*/ mfMin = fMin - mfStep * ceil((fMin - mfMin) / mfStep); +/*N*/ else if (fMin < mfMin) +/*N*/ mfMin = fMin + mfStep * floor((mfMin - fMin) / mfStep); +/*N*/ +/*N*/ if ((mfMin >= 0.0) && (mfMin < mfOrigin)) +/*N*/ mfOrigin = mfMin; +/*N*/ } +/*N*/ +/*N*/ if (mbAutoMax) +/*N*/ { +/*N*/ double fMax = 0.0; +/*N*/ +/*N*/ // Adjust mfMax to the smallest value that is higher than or +/*N*/ // equal to its current value and is an integer multiple of +/*N*/ // mfSteps away of fMax. +/*N*/ if (fMax < mfMax) +/*N*/ mfMax = fMax + mfStep * ceil((mfMax - fMax) / mfStep); +/*N*/ else if (fMax > mfMax) +/*N*/ mfMax = fMax - mfStep * floor ((fMax - mfMax) / mfStep); +/*N*/ +/*N*/ if ((mfMax <= 0.0) && (mfMax > mfOrigin)) +/*N*/ mfOrigin = mfMax; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(mbAutoStepHelp) +/*N*/ { +/*N*/ mfStepHelp = mbLogarithm ? (mfStep / 10) : (mfStep / 2); +/*N*/ } +/*N*/ VerifySteps(); +/*N*/ } +/*N*/ +/* //NetCharts, nur absolutwerte (was passiert bei gemischt ?) + //Sollte sowas nicht vor die Berechnung der Steps? + if (mbRadial) + { + mfMin = std::max (mfMin, 0); + mfMax = std::max (mfMax, 0); + if (mfMin > mfMax) + { + double fTemp = mfMin; + + mfMin = mfMax; + mfMax = fTemp; + } + } +*/ +/*N*/ } + + +/*N*/ void ChartAxis::VerifySteps() +/*N*/ { +/*N*/ //#38835# Sicherheitsueberpruefung der Werte, es werden beide Achsen gleichbehandelt +/*N*/ //Es sollte nur mit Double gerechnet werden da bei Fehlern der Bereich nicht reicht +/*N*/ //(deshalb double nVarName, +/*N*/ //ToDo: GetLenght benutzen! Wir kennen ja in dieser Klasse mittlerweile die Laenge +/*N*/ +/*N*/ double fRange=(mfMax - mfMin); +/*N*/ +/*N*/ double nLimit=Max(maArea.GetWidth(),maArea.GetHeight()); +/*N*/ +/*N*/ if(nLimit < 0.0) +/*N*/ { +/*?*/ DBG_ERROR( "negative value for nLimit, check maArea!" ); +/*?*/ nLimit=1.0; +/*N*/ } +/*N*/ nLimit=nLimit/100.0; //Minimum 1 mm Abstand +/*N*/ +/*N*/ if(nLimit && !mbLogarithm) +/*N*/ { +/*N*/ if(mfStep!=0.0 ) +/*N*/ { +/*N*/ double fSteps=fRange/mfStep; +/*N*/ while(fSteps>nLimit) +/*N*/ { +/*?*/ mfStep*=10; +/*?*/ fSteps=fRange / mfStep; +/*N*/ } +/*N*/ } +/*N*/ nLimit*=10; //Min fuer Hilfsticks: 0,1 mm bzw. 10 Hilfsticks immer moeglich +/*N*/ +/*N*/ if(mfStepHelp!=0.0) +/*N*/ { +/*N*/ double fSteps=fRange/mfStepHelp; +/*N*/ while(fSteps>nLimit) +/*N*/ { +/*?*/ mfStepHelp*=10; +/*?*/ fSteps=fRange/mfStepHelp; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ long ChartAxis::GetPos(double fData) +/*N*/ { +/*N*/ switch(mnId) +/*N*/ { +/*N*/ case CHART_AXIS_X: +/*N*/ if(mbFlippedXY) +/*N*/ return maRefArea.Bottom() - (long)(CalcFact(fData) * maRefArea.GetHeight()); +/*N*/ else +/*N*/ return maRefArea.Left() + (long)(CalcFact(fData) * maRefArea.GetWidth()); +/*N*/ +/*N*/ case CHART_AXIS_Y: +/*N*/ if(!mbFlippedXY) +/*N*/ return maRefArea.Bottom() - (long)(CalcFact(fData) * maRefArea.GetHeight()); +/*N*/ else +/*N*/ return maRefArea.Left() + (long)(CalcFact(fData) * maRefArea.GetWidth()); +/*N*/ +/*N*/ case CHART_AXIS_Z: +/*?*/ DBG_ERROR("ChartAxis - no z pos"); +/*N*/ } +/*N*/ return 0; +/*N*/ } +/*N*/ BOOL ChartAxis::SetArea(const Rectangle &rRect) +/*N*/ { +/*N*/ BOOL bRet=TRUE; +/*N*/ if(rRect==maRefArea) +/*N*/ bRet=FALSE; +/*N*/ maRefArea=rRect; +/*N*/ +/*N*/ SetPosition(mbSecondary ? CHAXIS_POS_B :CHAXIS_POS_A); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ if(maArea!=maRefArea) +/*N*/ DBG_TRACE("ChartAxis:: maArea!=maRefArea!!!"); +/*N*/ #endif +/*N*/ return bRet; +/*N*/ } + + + +/* ************************************************************************ +|* +|* Liefert die maximale Werte-Text-Gr”áe +|* +\*********************************************************************** */ +/*N*/ Size ChartAxis::CalcMaxTextSize() +/*N*/ { +/*N*/ return CalcMaxTextSize(((const SvxChartTextOrientItem&)mpAxisAttr->Get(SCHATTR_TEXT_ORIENT)).GetValue()); +/*N*/ } + +/*N*/ Size ChartAxis::CalcMaxTextSize(SvxChartTextOrient eOrient) +/*N*/ { +/*N*/ meTextOrient = eOrient; +/*N*/ maMaxTextSize=Size(0,0); +/*N*/ +/*N*/ if(!mbShowDescr) +/*N*/ return maMaxTextSize; +/*N*/ +/*N*/ BOOL bStepIsValid = mbLogarithm ? (mfStep > 1.0) : (mfStep > 0.0); +/*N*/ +/*N*/ if( mfMin != mfMax && bStepIsValid ) +/*N*/ { +/*N*/ OutputDevice *pOut = mpModel->GetOutliner()->GetRefDevice(); +/*N*/ Font aNewFont; +/*N*/ ItemsToFont(*mpAxisAttr,aNewFont); +/*N*/ Font aOldFont(pOut->GetFont()); +/*N*/ pOut->SetFont(aNewFont); +/*N*/ +/*N*/ double fAct = mfMin; +/*N*/ +/*N*/ if( ::rtl::math::isInf( mfMax ) || ::rtl::math::isInf( mfMin )) +/*N*/ { +/*N*/ DBG_ERROR( "maximum or minumum is infinity" ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ while (fAct <= mfMax) +/*N*/ { +/*N*/ String aNumStr; +/*N*/ Color* pDummy = NULL; +/*N*/ +/*N*/ if(mbColText) +/*N*/ { +/*N*/ long nCol = long(fAct); +/*N*/ if(nCol<mpModel->GetColCount()) +/*N*/ aNumStr=mpModel->ColText(nCol); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ mpNumFormatter->GetOutputString(mbPercent ? fAct / 100.0: fAct, +/*N*/ GetNumFormat(), aNumStr, &pDummy); +/*N*/ } +/*N*/ +/*N*/ Size aSize; +/*N*/ if (meTextOrient == CHTXTORIENT_STACKED) +/*N*/ { +/*?*/ aSize.Width() = pOut->GetTextWidth( ::binfilter::StackString( aNumStr )); +/*?*/ aSize.Height() = pOut->GetTextHeight(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aSize.Width() = pOut->GetTextWidth( aNumStr ); +/*N*/ aSize.Height() = pOut->GetTextHeight(); +/*N*/ } +/*N*/ +/*N*/ aSize.Height() += TEXTHEIGHT_OFS; +/*N*/ aSize.Width () = (aSize.Width () * 6) / 5; +/*N*/ +/*N*/ if (aSize.Width() > maMaxTextSize.Width()) +/*N*/ maMaxTextSize.Width() = aSize.Width(); +/*N*/ if (aSize.Height() > maMaxTextSize.Height()) +/*N*/ maMaxTextSize.Height() = aSize.Height(); +/*N*/ +/*N*/ IncValue(fAct, mfStep, mbLogarithm); +/*N*/ } +/*N*/ maMaxTextSize = GetRotatedTextSize( maMaxTextSize, +/*N*/ GetTextRotation( *mpAxisAttr, meTextOrient )); +/*N*/ } +/*N*/ +/*N*/ //Evtl. muss hier noch ein Umbruch eingeplant werden! +/*N*/ +/*N*/ pOut->SetFont(aOldFont); +/*N*/ } +/*N*/ RecalcTextPos(); +/*N*/ return maMaxTextSize; +/*N*/ } + +/*N*/ void ChartAxis::RecalcTextPos() +/*N*/ { +/*N*/ //Textabstand: +/*N*/ long nExtra = -100; //+1mm +/*N*/ if((mbSecondary && IsVertical()) || (!mbSecondary && !IsVertical())) +/*N*/ nExtra=100; +/*N*/ +/*N*/ if(mnTicks&CHAXIS_MARK_OUTER) +/*N*/ { +/*N*/ mnTextPos = mnPos + nExtra + mnTickLen; //LONGMARKS; +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ mnTextPos = mnPos + nExtra; +/*?*/ +/*?*/ if(mnHelpTicks&CHAXIS_MARK_OUTER) +/*?*/ mnTextPos +=mnHelpTickLen; +/*N*/ } +/*N*/ } + +/*N*/ void ChartAxis::SetPosition(long nPos) +/*N*/ { +/*N*/ mbSecondary=(BOOL)(nPos==CHAXIS_POS_B); +/*N*/ +/*N*/ if(nPos<0) +/*N*/ { +/*N*/ if(IsVertical()) +/*N*/ { +/*N*/ if(mbSecondary) +/*N*/ mnPos=maRefArea.Right(); +/*N*/ else +/*N*/ mnPos=maRefArea.Left(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(mbSecondary) +/*N*/ mnPos=maRefArea.Top(); +/*N*/ else +/*N*/ mnPos=maRefArea.Bottom(); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ mnPos=nPos; +/*N*/ } +/*N*/ +/*N*/ RecalcTextPos(); +/*N*/ } + +//Wenn Ticks nach innen und/oder nach aussen gerichtet sind, wird ein SdrObject returned, +//sollen in keine Richtung Ticks gezeichnet werden, gbts den Nullpointer zurück +/*N*/ SdrObject *ChartAxis::CreateMarks(long nPosition,long nLen,long nWhichTicks) +/*N*/ { +/*N*/ XPolygon saLine(2); +/*N*/ +/*N*/ long nLen2=(nWhichTicks&CHAXIS_MARK_INNER) ? nLen : 0; +/*N*/ +/*N*/ if(!(nWhichTicks&CHAXIS_MARK_OUTER)) +/*N*/ nLen=0; +/*N*/ +/*N*/ if(!nLen && !nLen2) +/*N*/ return NULL; +/*N*/ +/*N*/ if(IsVertical()) +/*N*/ { +/*N*/ saLine[0].X() = mnPos + nLen; +/*N*/ saLine[1].X() = mnPos - nLen2; +/*N*/ saLine[0].Y() = saLine[1].Y() = nPosition; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ saLine[0].Y() = mnPos + nLen; +/*N*/ saLine[1].Y() = mnPos - nLen2; +/*N*/ saLine[0].X() = saLine[1].X() = nPosition; +/*N*/ } +/*N*/ +/*N*/ return SetObjectAttr (new SdrPathObj(OBJ_PLIN,saLine),CHOBJID_LINE,TRUE,TRUE,mpAxisAttr); +/*N*/ } +/*N*/ void ChartAxis::CreateMarkDescr(double fData,long nPosition) +/*N*/ { +/*N*/ String aNumStr; +/*N*/ Color* pTextColor = NULL; +/*N*/ +/*N*/ if(mbColText) +/*N*/ { +/*N*/ long nCol = long(fData); +/*N*/ long nColCnt=mpModel->GetColCount(); +/*N*/ if(IsVertical()) +/*N*/ nCol=nColCnt-nCol; //andere Reihenfolge wegen Bildschirmkoordinaten +/*N*/ +/*N*/ if(nCol<nColCnt && nCol>=0) +/*N*/ CreateMarkDescr(mpModel->ColText(nCol) ,nPosition, pTextColor); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ mpNumFormatter->GetOutputString(mbPercent ? fData/100.0:fData,GetNumFormat() +/*N*/ ,aNumStr,&pTextColor); +/*N*/ CreateMarkDescr(aNumStr, nPosition, pTextColor); +/*N*/ } +/*N*/ +/*N*/ } + +// BM #60999# new parameter pTextColor, if using red text for negative numbers +/*N*/ void ChartAxis::CreateMarkDescr(const String& rString, long nPosition, Color *pTextColor) +/*N*/ { +/*N*/ SvxColorItem* pOldTextColor = NULL; +/*N*/ +/*N*/ if(!mpTextAttr) +/*N*/ { +/*?*/ DBG_ERROR("ChartAxis: description uninitialised!!!!"); +/*?*/ CreateTextAttr(); +/*N*/ } +/*N*/ +/*N*/ if( pTextColor ) +/*N*/ { +/*?*/ pOldTextColor = (SvxColorItem*)mpTextAttr->GetItem( EE_CHAR_COLOR ); +/*?*/ mpTextAttr->Put(SvxColorItem( *pTextColor )); +/*N*/ } +/*N*/ +/*N*/ //Bei z.B. Barcharts ist der Text verschoben (sozusagen unter der Hilfsmarkierung) +/*N*/ long nTextOffset=0; +/*N*/ if(!mbCenterText && mbColText) +/*N*/ nTextOffset+=GetDescrWidth()/2; +/*N*/ +/*N*/ ChartAdjust eAdj; +/*N*/ SdrRectObj *pText=NULL; +/*N*/ if(IsVertical()) +/*N*/ { +/*N*/ Point aPos(mnTextPos,nPosition+nTextOffset); +/*N*/ if(mbStepValue) +/*N*/ { +/*?*/ if(mbValueDown) +/*?*/ { +/*?*/ if(mbSecondary) +/*?*/ aPos.X() += maMaxTextSize.Width(); +/*?*/ else +/*?*/ aPos.X() -= maMaxTextSize.Width(); +/*?*/ } +/*?*/ mbValueDown = !mbValueDown; +/*N*/ } +/*N*/ eAdj = mbSecondary ? CHADJUST_CENTER_LEFT : CHADJUST_CENTER_RIGHT; +/*N*/ pText=mpModel->CreateTextObj(CHOBJID_TEXT,aPos,rString,*mpTextAttr,FALSE,eAdj,mnMaxTextWidth); +/*N*/ } +/*N*/ else //horizontal +/*N*/ { +/*N*/ Point aPos(nPosition+nTextOffset,mnTextPos); +/*N*/ if (mbStepValue) +/*N*/ { +/*?*/ if(mbValueDown) +/*?*/ { +/*?*/ if(mbSecondary) +/*?*/ aPos.Y() -= maMaxTextSize.Height(); +/*?*/ else +/*?*/ aPos.Y() += maMaxTextSize.Height(); +/*?*/ } +/*?*/ mbValueDown = !mbValueDown; +/*N*/ } +/*N*/ eAdj = mbSecondary ? CHADJUST_BOTTOM_CENTER : CHADJUST_TOP_CENTER; +/*N*/ pText=mpModel->CreateTextObj(CHOBJID_TEXT,aPos,rString,*mpTextAttr,FALSE,eAdj,mnMaxTextWidth); +/*N*/ } +/*N*/ +/*N*/ if( pOldTextColor ) +/*N*/ { +/*?*/ mpTextAttr->Put(*pOldTextColor); +/*N*/ } +/*N*/ +/*N*/ CreateMarkDescr(pText,nPosition); +/*N*/ } +/*N*/ void ChartAxis::CreateMarkDescr(SdrRectObj *pTextObj,long nPosition) +/*N*/ { +/*N*/ if(pTextObj && mpAxisList ) +/*N*/ { +/*N*/ Rectangle aTextBoundRect(pTextObj->GetBoundRect()); +/*N*/ Rectangle aIntersect1(maRectA); +/*N*/ Rectangle aIntersect2(maRectB); +/*N*/ +/*N*/ if(!mbTextOverlap && ! (aIntersect1.Intersection(aTextBoundRect).IsEmpty() && +/*N*/ aIntersect2.Intersection(aTextBoundRect).IsEmpty()) ) +/*N*/ { +/*?*/ delete pTextObj; +/*?*/ pTextObj=NULL; +/*N*/ } +/*N*/ +/*N*/ if (pTextObj) +/*N*/ { +/*N*/ SdrObject *pObj=CreateMarks(nPosition,mnTickLen,mnTicks); +/*N*/ SdrObjList* pList = mpAxisList; +/*N*/ if(pObj) +/*N*/ { +/*N*/ pObj->SetMarkProtect( TRUE ); +/*N*/ pList->NbcInsertObject(pObj); +/*N*/ } +/*N*/ +/*N*/ pTextObj->SetMarkProtect( TRUE ); +/*N*/ pList->NbcInsertObject(pTextObj); +/*N*/ maRectA = maRectB; +/*N*/ maRectB = aTextBoundRect; +/*N*/ return; //fertig -> Abbruch (die Marks muessen zuerst, dann die Texte) +/*N*/ } +/*N*/ } +/*N*/ //kein Textobjekt oder der Text würde überlappen +/*?*/ SdrObject *pObj=CreateMarks(nPosition,mnTickLen,mnTicks); +/*?*/ if(pObj && mpAxisList) +/*?*/ mpAxisList->NbcInsertObject(pObj); +/*N*/ } +/*N*/ void ChartAxis::InsertMark(long nPos,long nLen,long nWhichTicks) +/*N*/ { +/*N*/ SdrObject *pObj=CreateMarks(nPos,nLen,nWhichTicks); +/*N*/ if(pObj && mpAxisList) +/*N*/ mpAxisList->NbcInsertObject(pObj); +/*N*/ } + + +//Ähnlich zu SubtractDescrSize, jedoch wird der Umbruch sowie Änderungen am Rect bei +//sehr langen spaltenunterschriften berücksichtigt. +/*N*/ void ChartAxis::SubtractDescrSize_X(Rectangle& rRect,const Rectangle& rOldRect) +/*N*/ { +/*N*/ long nDescrWidth=GetDescrWidth(); +/*N*/ mnMaxTextWidth = (long) (nDescrWidth * 0.8); +/*N*/ +/*N*/ //Breite des ersten und letzten Textes der Achse, war mal ChartModel::nWidthOfFirst(Last)XAxisText +/*N*/ //A() = erster, B()=letzter +/*N*/ Pair aFirstAndLastTextWidth; +/*N*/ +/*N*/ Size aPageSize(mpModel->GetPage(0)->GetSize()); +/*N*/ +/*N*/ //unschön, SID_TEXTBREAK sollte ein SCHATTR_... werden! +/*N*/ BOOL bTextBreak=mpModel->GetFormatXAxisTextInMultipleLinesIfNecessary(); +/*N*/ if(!bTextBreak) // Dann wird kein Umbruch erzeugt. +/*N*/ mnMaxTextWidth = -1; +/*N*/ +/*N*/ meTextOrient = ((const SvxChartTextOrientItem&) +/*N*/ mpAxisAttr->Get(SCHATTR_TEXT_ORIENT)).GetValue(); +/*N*/ +/*N*/ BOOL bStepDescr; +/*N*/ +/*N*/ // FG: Falls die X-Achsenbeschriftung aus Zahlen besteht, wird dies beruecksichtigt. +/*N*/ UINT32 nNumberFormatXAxisDescr = GetNumFormat();//0; +/*N*/ +/*N*/ // FG: Jetzt wird der Rand des Charts so eingestellt, dass die Beschriftung der X-Achse +/*N*/ // garantiert nicht aus dme Chart heraus oder ins Diagramm hineinlaeuft. Hier +/*N*/ // muessen alle Faelle der Textausrichtung beruecksichtigt werden. +/*N*/ // Hier wird erstmal die maximale Textgroesse und die Textgroesse der ersten und letzten Spalte +/*N*/ // berechnet (letzteres wird in CalcMaxDescrSize versteckt durchgezogen) +/*N*/ +/*N*/ +/*N*/ if (HasDescription())//#47500# +/*N*/ { +/*N*/ if (IsVertical()) +/*N*/ { +/*N*/ // FG: hier wird erstmal die urspruengliche Textgroesse berechnet, sie wird abhaengig +/*N*/ // vom Ergebnis nachkorrigiert. Die Textbreite ab der umgebrochen wird darf nichts +/*N*/ // mit der Spaltenbreite zu tun haben falls der Text links neben dem Chart steht +/*N*/ // und von links nach rechts laeuft. +/*N*/ maMaxTextSize = mpModel->CalcMaxDescrSize( FALSE, meTextOrient, mbPercent, mnUId, -1, &aFirstAndLastTextWidth ); +/*N*/ // FG: Falls man den Text umbrechen darf, so muss nur noch beachtet werden, in welche +/*N*/ // Richtung der Text verlaufen soll (senkrecht, waagrecht) und ob die Groesse der +/*N*/ // Beschriftung das restliche Chart zu klein machen wird. Die groesste Beschriftung +/*N*/ // darf nicht mehr als 25% der Breite oder Hoehe einnehmen, je nach Ausrichtung des +/*N*/ // Textes. +/*N*/ if (bTextBreak) +/*N*/ { +/*N*/ if ( (meTextOrient == CHTXTORIENT_BOTTOMTOP) +/*N*/ || (meTextOrient == CHTXTORIENT_TOPBOTTOM) +/*N*/ || (meTextOrient == CHTXTORIENT_STACKED)) +/*N*/ { +/*?*/ if ((aPageSize.Height() / 4) < maMaxTextSize.Width()) +/*?*/ { +/*?*/ mnMaxTextWidth = aPageSize.Height() / 4; +/*?*/ maMaxTextSize = mpModel->CalcMaxDescrSize( FALSE, meTextOrient, nNumberFormatXAxisDescr, +/*?*/ mnUId, mnMaxTextWidth, +/*?*/ &aFirstAndLastTextWidth ); +/*?*/ } +/*?*/ // FG: sonst kann die erste Berechnung beibehalten werden. +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ if ((aPageSize.Width() / 4) < maMaxTextSize.Width()) // waagrechte Ausrichtung +/*N*/ { +/*N*/ // FG. Dann ist also der Platz fuer die Beschriftung groesser als 1/4 des Charts +/*N*/ mnMaxTextWidth = aPageSize.Width() / 4; +/*N*/ } +/*?*/ maMaxTextSize = mpModel->CalcMaxDescrSize( FALSE, meTextOrient, nNumberFormatXAxisDescr, +/*N*/ mnUId, mnMaxTextWidth, +/*N*/ &aFirstAndLastTextWidth ); +/*N*/ } +/*N*/ } +/*N*/ else // FG: Falls der Umbruch nicht erlaubt ist, der Text aber breiter als 1/3 des Charts wird, +/*N*/ { // wird trotzdem umgebrochen. Dann muss dei maximale Hoehe und Breite der groessten +/*N*/ // uns insbesondere der 1. und letzten Beschriftung neu berechnet werden. +/*N*/ // Das laesst sich sicher besser machen als nochmal ueber die gesamte Liste von Texten +/*N*/ // zu iterieren. +/*?*/ if ( ( (meTextOrient == CHTXTORIENT_BOTTOMTOP) +/*?*/ || (meTextOrient == CHTXTORIENT_TOPBOTTOM) +/*?*/ || (meTextOrient == CHTXTORIENT_STACKED) ) +/*?*/ && ((aPageSize.Height() / 3) < maMaxTextSize.Width())) +/*?*/ { +/*?*/ // FG. Dann ist also der Platz fuer die Beschriftung groesser als 1/4 des Charts +/*?*/ mnMaxTextWidth = aPageSize.Height() / 3; +/*?*/ maMaxTextSize = mpModel->CalcMaxDescrSize( FALSE, meTextOrient, nNumberFormatXAxisDescr, +/*?*/ mnUId, mnMaxTextWidth, +/*?*/ &aFirstAndLastTextWidth ); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ else // FG: Der Text steht also unter dem Chart. +/*N*/ { +/*N*/ // FG: Fuer den Fall dass die Beschriftung nicht unter jeden Datenpunkt gesetzt +/*N*/ // wird, weil zu viele Daten vorhanden sind, eignet sich eine vertikale +/*N*/ // Textausrichtung besser (im Falle dass die Ausrichtung automatisch +/*N*/ // erfolgen soll. +/*N*/ maMaxTextSize = mpModel->CalcMaxDescrSize( FALSE, meTextOrient, nNumberFormatXAxisDescr, +/*N*/ mnUId, mnMaxTextWidth, +/*N*/ &aFirstAndLastTextWidth ); +/*N*/ +/*N*/ if ( (meTextOrient == CHTXTORIENT_BOTTOMTOP) +/*N*/ || (meTextOrient == CHTXTORIENT_TOPBOTTOM) +/*N*/ || (meTextOrient == CHTXTORIENT_STACKED)) +/*N*/ { +/*?*/ if ((aPageSize.Width() / 2) < maMaxTextSize.Height()) +/*?*/ { +/*?*/ mnMaxTextWidth = aPageSize.Height() / 2; +/*?*/ maMaxTextSize = mpModel->CalcMaxDescrSize( FALSE, meTextOrient, nNumberFormatXAxisDescr, +/*?*/ mnUId, mnMaxTextWidth, +/*?*/ &aFirstAndLastTextWidth ); +/*?*/ } +/*?*/ if ( ( (aPageSize.Width() / 4) < maMaxTextSize.Height()) && +/*?*/ (bTextBreak)) +/*?*/ { +/*?*/ mnMaxTextWidth = aPageSize.Height() / 4; +/*?*/ maMaxTextSize = mpModel->CalcMaxDescrSize( FALSE, meTextOrient, nNumberFormatXAxisDescr, +/*?*/ mnUId, mnMaxTextWidth, +/*?*/ &aFirstAndLastTextWidth); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ +/*N*/ SvxChartTextOrder eDescrOrder; +/*N*/ +/*N*/ // FG: Einfachere Abfrage ob die Ausrichtung vom Programm vorgegeben wird oder vom Benutzer +/*N*/ // #65364# (BM) text order is now independent from text orientation +/* if (meTextOrient != CHTXTORIENT_AUTOMATIC) + { +*/ +/*N*/ eDescrOrder = ((const SvxChartTextOrderItem&) +/*N*/ mpAxisAttr->Get(SCHATTR_TEXT_ORDER)).GetValue(); +/* } + else + { + eDescrOrder = CHTXTORDER_SIDEBYSIDE; + } +*/ + // FG: Hier wird nur abgefragt, ob die Beschriftung der X-Achse (der Datenachse) + // so erfolgen soll, dass Text abwechselnd hoch-tief gesetzt werden, oder nicht. +/*N*/ long nMaxWidth = IsVertical() ? maMaxTextSize.Height() : maMaxTextSize.Width(); +/*N*/ BOOL bHelp = (nMaxWidth > nDescrWidth * 8.1 / 10); +/*N*/ bStepDescr = ( bHelp && +/*N*/ (eDescrOrder == CHTXTORDER_AUTO) && +/*N*/ (meTextOrient == CHTXTORIENT_STANDARD)) || +/*N*/ (eDescrOrder == CHTXTORDER_UPDOWN) || +/*N*/ (eDescrOrder == CHTXTORDER_DOWNUP); + + // FG: Hier wird aufgrund der Beschriftung der obere und der untere Rand nachgeregelt. + // und zwar nur hier. + +//BEGIN_RECT_CHANGES + +/*N*/ if (IsVertical()) +/*N*/ { +/*N*/ if (! bTextBreak) +/*N*/ { +/*N*/ if ( (meTextOrient == CHTXTORIENT_BOTTOMTOP) +/*N*/ || (meTextOrient == CHTXTORIENT_TOPBOTTOM) +/*N*/ || (meTextOrient == CHTXTORIENT_STACKED)) +/*N*/ { +/*N*/ // FG: In diesem Fall muss man nachregeln, der Text wird ohne Umruch formatiert +/*?*/ if ((rRect.Bottom() - rOldRect.Bottom()) < (aFirstAndLastTextWidth.B() / 2)) +/*?*/ { +/*?*/ rRect.Bottom() -= aFirstAndLastTextWidth.B() / 2; +/*?*/ } +/*?*/ if ((rRect.Top() - rOldRect.Top()) < (aFirstAndLastTextWidth.A() / 2)) +/*?*/ { +/*?*/ rRect.Top() -= aFirstAndLastTextWidth.A() / 2; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // FG: Der Text steht unter dem Chart, egal ob er von links nach rechts oder von oben nach +/*N*/ // unten verlaeuft aMaxDescrSize muss vorher richtig berechnet worden sein. +/*N*/ if(mbSecondary) +/*?*/ rRect.Top() += maMaxTextSize.Height() + mnTickLen + 100; +/*?*/ else +/*N*/ rRect.Bottom() -= maMaxTextSize.Height() + mnTickLen + 100; +/*N*/ } +/*N*/ +/*N*/ if (bStepDescr) // FG: Dann erfolgt die Beschriftung hoch- und tief abwechselnd (wie in der Dialogbox) +/*N*/ { +/*N*/ // dann hat man mehr Platz pro Zeile (eigentlich 2 mal soviel) aber der Platz zwischen den +/*N*/ // Beschriftungen steht auch noch zur Verfuegung (jeweils 0,2 * nDescrWidth) +/*?*/ mnMaxTextWidth = 2 * mnMaxTextWidth + 0,4 * nDescrWidth; +/*?*/ // Man braucht auch 2 mal soviel Platz in unten am Chart. +/*?*/ if(mbSecondary) +/*?*/ rRect.Top() += maMaxTextSize.Height() + mnTickLen; +/*?*/ else +/*?*/ rRect.Bottom() -= maMaxTextSize.Height() + mnTickLen; +/*N*/ } +/*N*/ } +/*N*/ // FG (14.2.97): Hier wird der linke Rand nachgeregelt, und zwar je nach Diagrammtyp unterschiedlich. +/*N*/ if (mpModel->IsDescriptionCenteredUnderDataPoint()) +/*N*/ { +/*N*/ // Nun jetzt weiss ich dass die Beschriftung zentriert unter einem Datenpunkt steht. +/*N*/ // jetzt muss der linke Rand nachgeregelt werden: Genau die Haelfte des +/*N*/ // Spaltentextes mit Nummer 0 muss nach links noch Platz sein. +/*N*/ if (IsVertical()) +/*N*/ { +/*N*/ if ((rRect.Left() - rOldRect.Left()) < maMaxTextSize.Width()) +/*N*/ { +/*N*/ rRect.Left() += maMaxTextSize.Width(); +/*N*/ } +/*N*/ // FG: Ein Nachregeln des rechten Randes ist nicht noetig, da die Beschriftung +/*N*/ // nie rechts neben dem Chart stehen kann. +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(! ( (meTextOrient == CHTXTORIENT_BOTTOMTOP) +/*N*/ || (meTextOrient == CHTXTORIENT_TOPBOTTOM) +/*N*/ || (meTextOrient == CHTXTORIENT_STACKED)) ) +/*N*/ { +/*N*/ if ((rRect.Left() - rOldRect.Left()) < (aFirstAndLastTextWidth.A() / 2)) +/*N*/ { +/*N*/ rRect.Left() += aFirstAndLastTextWidth.A() / 2; +/*N*/ } +/*N*/ if (mpModel->InitialSize().Width() - rRect.Right() < (aFirstAndLastTextWidth.B() / 2)) +/*N*/ { +/*N*/ rRect.Right() -= aFirstAndLastTextWidth.B() / 2; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // FG: Im anderen Fall wird gerade so umgebrochen, dass kein zusaetzlicher Rand gelassen werden muss. +/*N*/ // Es sei denn im Dialog wurde eingestellt, dass man keinen Umbruch wollte. +/*N*/ if (!bTextBreak) +/*N*/ { +/*?*/ if ((rRect.Left() - rOldRect.Left()) < (aFirstAndLastTextWidth.A() / 2)) +/*?*/ { +/*?*/ rRect.Left() += aFirstAndLastTextWidth.A() / 2; +/*?*/ } +/*?*/ if (mpModel->InitialSize().Width() - rRect.Right() < (aFirstAndLastTextWidth.B() / 2)) +/*?*/ { +/*?*/ rRect.Right() -= aFirstAndLastTextWidth.B() / 2; +/*?*/ } +/*N*/ } +/*N*/ } +//END RECT_CHANGES ******************************************************************** +/*N*/ } + + + + +/*N*/ void ChartAxis::SubtractDescrSize(Rectangle& rRect) +/*N*/ { +/*N*/ if(!mbShowDescr) +/*N*/ return; + +/*N*/ long nLong = (mnTicks&CHAXIS_MARK_OUTER) ? 150 : (mnHelpTicks&CHAXIS_MARK_OUTER) ? 100 : 0; + +/*N*/ if(mbSecondary) +/*N*/ { +/*?*/ if(!IsVertical()) +/*?*/ { +/*?*/ rRect.Top() += mbStepValue +/*?*/ ? maMaxTextSize.Height() * 2 +/*?*/ : maMaxTextSize.Height(); +/*?*/ rRect.Top() += nLong; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ rRect.Right() -= mbStepValue +/*?*/ ? maMaxTextSize.Width() * 2 +/*?*/ : maMaxTextSize.Width(); +/*?*/ rRect.Right() -= nLong; +/*?*/ } +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ if(!IsVertical()) +/*N*/ { +/*N*/ rRect.Bottom() -= mbStepValue +/*N*/ ? maMaxTextSize.Height() * 2 +/*N*/ : maMaxTextSize.Height(); +/*N*/ rRect.Bottom() -= nLong; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rRect.Left() += mbStepValue +/*N*/ ? maMaxTextSize.Width() * 2 +/*N*/ : maMaxTextSize.Width(); +/*N*/ rRect.Left() += nLong; +/*N*/ } +/*N*/ } +/*N*/ } +//Bisher nur Y-Achse: +/*N*/ void ChartAxis::InitDescr() +/*N*/ { +/*N*/ InitDescr(meTextOrient,mnMaxTextWidth); +/*N*/ } +/*N*/ void ChartAxis::InitDescr(SvxChartTextOrient &rValueOrient,long nMaxTextWidth) +/*N*/ { +/*N*/ mnMaxTextWidth=nMaxTextWidth;//-1; +/*N*/ +/*N*/ BOOL bAutoValue = (rValueOrient == CHTXTORIENT_AUTOMATIC); +/*N*/ +/*N*/ if(!mbShowDescr) +/*N*/ return; +/*N*/ +/*N*/ if (bAutoValue) +/*N*/ rValueOrient = CHTXTORIENT_STANDARD; + + // #65364# (BM) text order is now independent from text orientation +/*N*/ SvxChartTextOrder eValueOrder = /*( bAutoValue + ||( mbFlippedXY && (rValueOrient != CHTXTORIENT_STANDARD)) + ||(!mbFlippedXY && (rValueOrient == CHTXTORIENT_STANDARD))) + ? CHTXTORDER_SIDEBYSIDE + :*/ +/*N*/ ((const SvxChartTextOrderItem&)mpAxisAttr->Get(SCHATTR_TEXT_ORDER)).GetValue(); +/*N*/ +/*N*/ mbStepValue = (eValueOrder != CHTXTORDER_SIDEBYSIDE); +/*N*/ mbValueDown = (eValueOrder == CHTXTORDER_DOWNUP); +/*N*/ +/*N*/ meTextOrient = rValueOrient; +/*N*/ +/*N*/ CreateTextAttr(); +/*N*/ } +/*N*/ void ChartAxis::InitDescr_X() +/*N*/ { +/*N*/ if(!mbShowDescr) +/*N*/ return; +/*N*/ +/*N*/ SvxChartTextOrder eValueOrder; + + // FG: Einfachere Abfrage ob die Ausrichtung vom Programm vorgegeben wird oder vom Benutzer + // #65364# (BM) text order is now independent from text orientation +/* if (meTextOrient != CHTXTORIENT_AUTOMATIC) + { +*/ +/*N*/ eValueOrder = ((const SvxChartTextOrderItem&) +/*N*/ mpAxisAttr->Get(SCHATTR_TEXT_ORDER)).GetValue(); +/* } + else + { + eValueOrder = CHTXTORDER_SIDEBYSIDE; + } +*/ + // FG: Hier wird nur abgefragt, ob die Beschriftung der X-Achse (der Datenachse) + // so erfolgen soll, dass Text abwechselnd hoch-tief gesetzt werden, oder nicht. +/*N*/ long nMaxWidth = IsVertical() ? maMaxTextSize.Height() : maMaxTextSize.Width(); +/*N*/ BOOL bHelp= (nMaxWidth > GetDescrWidth() * 8.1 / 10); +/*N*/ mbStepValue = (bHelp && +/*N*/ (eValueOrder == CHTXTORDER_AUTO) && +/*N*/ (meTextOrient == CHTXTORIENT_STANDARD)) || +/*N*/ (eValueOrder == CHTXTORDER_UPDOWN) || +/*N*/ (eValueOrder == CHTXTORDER_DOWNUP); +/*N*/ +/*N*/ +/*N*/ mbValueDown = (eValueOrder == CHTXTORDER_DOWNUP); +// meTextOrient = rValueOrient; + +/*N*/ CreateTextAttr(); +/*N*/ } + + + + +/*N*/ void ChartAxis::CreateTextAttr() +/*N*/ { +/*N*/ if(!mpTextAttr) +/*N*/ mpTextAttr=new SfxItemSet((const SfxItemSet &)*mpAxisAttr); +/*N*/ else +/*N*/ mpTextAttr->Put(*mpAxisAttr); //Update +/*N*/ +/*N*/ mpTextAttr->Put(SvxChartTextOrientItem(meTextOrient)); +/*N*/ mpTextAttr->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ mpTextAttr->Put(XLineWidthItem(0)); +/*N*/ } + +/*N*/ void ChartAxis::CreateAxis(SdrObjList& rList,long nChObjId) +/*N*/ { +/*N*/ if(IsVisible() || HasDescription()) +/*N*/ { +/*N*/ mpAxisObj = new SchAxisObj( mpModel ); +/*N*/ SetObjectAttr( mpAxisObj, USHORT(nChObjId), TRUE, TRUE, 0 ); +/*N*/ SetAxisList( mpAxisObj->GetSubList() ); +/*N*/ +/*N*/ rList.NbcInsertObject( mpAxisObj, CONTAINER_APPEND ); +/*N*/ +/*N*/ if( IsVisible()) +/*N*/ CreateAxis(); +/*N*/ } +/*N*/ } + +/*N*/ void ChartAxis::CreateAxis(const long nPos,BOOL bBorderAxis,BOOL bInnerAxis) +/*N*/ { +/*N*/ //Position der X-Achse.... aber nicht der Ticks +/*N*/ //(nicht ganz verständlich bei XY-Diagrammen) +/*N*/ //was ist mit bShow?Descr ? +/*N*/ mnInnerPos=nPos; +/*N*/ +/*N*/ long nPos1 = 0; +/*N*/ if(bBorderAxis) +/*N*/ nPos1=CreateAxis(); +/*N*/ else +/*N*/ { +/*N*/ mbInnerPos=TRUE; //ungenutzt.... evtl. wegen SetArea(){...SetPosition()...} +/*N*/ SetPosition(nPos); +/*N*/ } +/*N*/ mnInnerPos=nPos; +/*N*/ +/*N*/ if(bInnerAxis &&(!bBorderAxis || nPos1!=nPos)) //nur eine Achse oder 2 Achsen an versch. Positionen +/*N*/ { +/*N*/ +/*N*/ XPolygon aLine(2); +/*N*/ if (IsVertical()) +/*N*/ { +/*N*/ aLine[0].X() = aLine[1].X() = nPos; +/*N*/ aLine[0].Y() = maRefArea.Bottom(); +/*N*/ aLine[1].Y() = maRefArea.Top(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aLine[0].Y() = aLine[1].Y() = nPos; +/*N*/ aLine[0].X() = maRefArea.Left(); +/*N*/ aLine[1].X() = maRefArea.Right(); +/*N*/ } +/*N*/ if (mpAxisList) +/*N*/ mpAxisList->NbcInsertObject(SetObjectAttr (new SdrPathObj(OBJ_PLIN, aLine), +/*N*/ CHOBJID_LINE, TRUE, TRUE,mpAxisAttr)); +/*N*/ } +/* alter Original-Source, siehe ###hier### + if (bSwitchColRow) + { + VERTICAL_LINE; + if ((nPos != rRect.Left()) && (bShowYDescr )) + { + aLine[0].X() = aLine[1].X() = rRect.Left (); + + rObjList.InsertObject(SetObjectAttr(new SdrPathObj(OBJ_PLIN, aLine), + CHOBJID_DIAGRAM_X_AXIS,TRUE, TRUE, pXGridMainAttr)); + } + aLine[0].X() = aLine[1].X() = nPos; + } + else //!bSwitchColRow + { + HORIZONTAL_LINE; + if ((nPos != rRect.Bottom()) && (bShowXDescr)) + { + if(pChartYAxis->GetMin() < 0.0) + { + //###hier### ist jetzt anders! + + aLine[0].Y()=aLine[1].Y()= (pChartYAxis->GetMax()>0.0) + ? rRect.Bottom () + : rRect.Top (); + + } + else + aLine[0].Y()=aLine[1].Y()= rRect.Bottom (); + + HORIZONTAL_LINE; + rObjList.InsertObject(SetObjectAttr (new SdrPathObj(OBJ_PLIN, aLine), + CHOBJID_DIAGRAM_X_AXIS,TRUE, TRUE, pXGridMainAttr)); + } + aLine[0].Y() = aLine[1].Y() = nPos; + } +*/ +/*N*/ } + +/*N*/ long ChartAxis::CreateAxis() +/*N*/ { +/*N*/ XPolygon aLine(2); +/*N*/ long nPos; +/*N*/ +/*N*/ if (IsVertical()) +/*N*/ { +/*N*/ if(mbSecondary) +/*N*/ { +/*?*/ aLine[0].X() = aLine[1].X() = maRefArea.Right(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aLine[0].X() = aLine[1].X() = maRefArea.Left(); +/*N*/ } +/*N*/ aLine[0].Y() = maRefArea.Bottom(); +/*N*/ aLine[1].Y() = maRefArea.Top(); +/*N*/ nPos=aLine[0].X(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(mbSecondary) +/*N*/ { +/*?*/ aLine[0].Y() = aLine[1].Y() = maRefArea.Top(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aLine[0].Y() = aLine[1].Y() = maRefArea.Bottom(); +/*N*/ } +/*N*/ aLine[0].X() = maRefArea.Left(); +/*N*/ aLine[1].X() = maRefArea.Right(); +/*N*/ nPos=aLine[0].Y(); +/*N*/ } +/*N*/ +/*N*/ if (mpAxisList && IsVisible()) +/*N*/ mpAxisList->NbcInsertObject(SetObjectAttr (new SdrPathObj(OBJ_PLIN, aLine), +/*N*/ CHOBJID_LINE, TRUE, TRUE,mpAxisAttr)); +/*N*/ +/*N*/ return nPos; +/*N*/ +/*N*/ } +/*N*/ void ChartAxis::SetMainGrid(SdrObjList* pList,SfxItemSet*pAttr) +/*N*/ { +/*N*/ mpMainGridList=pList; +/*N*/ mpMainGridAttr=pAttr; +/*N*/ switch(mnId) +/*N*/ { +/*N*/ case CHART_AXIS_X: +/*N*/ mnIdMainGrid=CHOBJID_DIAGRAM_Y_GRID_MAIN; +/*N*/ break; +/*N*/ case CHART_AXIS_Y: +/*N*/ mnIdMainGrid=CHOBJID_DIAGRAM_X_GRID_MAIN; +/*N*/ break; +/*N*/ case CHART_AXIS_Z: +/*?*/ mnIdMainGrid=CHOBJID_DIAGRAM_Z_GRID_MAIN; +/*?*/ break; +/*N*/ } +/*N*/ } +/*N*/ void ChartAxis::SetHelpGrid(SdrObjList* pList,SfxItemSet*pAttr) +/*N*/ { +/*N*/ mpHelpGridList=pList; +/*N*/ mpHelpGridAttr=pAttr; +/*N*/ switch(mnId) +/*N*/ { +/*N*/ case CHART_AXIS_X: +/*N*/ mnIdHelpGrid=CHOBJID_DIAGRAM_Y_GRID_HELP; +/*N*/ break; +/*N*/ case CHART_AXIS_Y: +/*N*/ mnIdHelpGrid=CHOBJID_DIAGRAM_X_GRID_HELP; +/*N*/ break; +/*N*/ case CHART_AXIS_Z: +/*?*/ mnIdHelpGrid=CHOBJID_DIAGRAM_Z_GRID_HELP; +/*?*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ void ChartAxis::GridLine(XPolygon& aLine,long nPos) +/*N*/ { +/*N*/ if(IsVertical()) +/*N*/ { +/*N*/ aLine[0].Y() = aLine[1].Y() = nPos; +/*N*/ aLine[0].X() = maRefArea.Left(); +/*N*/ aLine[1].X() = maRefArea.Right(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aLine[0].X() = aLine[1].X() = nPos; +/*N*/ aLine[0].Y() = maRefArea.Bottom(); +/*N*/ aLine[1].Y() = maRefArea.Top(); +/*N*/ } +/*N*/ } + +/*N*/ void ChartAxis::ShowDescr(BOOL b) +/*N*/ { +/*N*/ mbShowDescr=b; +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,b)); +/*N*/ } + +/*N*/ void ChartAxis::ShowAxis(BOOL b) +/*N*/ { +/*N*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_SHOWAXIS,b)); +/*N*/ } + +/*N*/ void ChartAxis::DrawGrids() +/*N*/ { +/*N*/ XPolygon aLine(2); +/*N*/ long nPos; +/*N*/ +/*N*/ if(!mpMainGridList && !mpHelpGridList && !mpAxisList) +/*N*/ return ; //nothing to do +/*N*/ +/*N*/ +/*N*/ // if the x-axis has no numbers as description, the meaning of main and help ticks might +/*N*/ // be interpreted the other way round +/*N*/ long nTicksBack =mnTicks; +/*N*/ long nHelpTicksBack =mnHelpTicks; +/*N*/ long nTickLenBack =mnTickLen; +/*N*/ long nHelpTickLenBack =mnHelpTickLen; +/*N*/ +/*N*/ // ...Back is for storing original values +/*N*/ double fMinBack = mfMin; +/*N*/ double fMaxBack = mfMax; +/*N*/ double fStepBack = mfStep; +/*N*/ double fStepHelpBack= mfStepHelp; +/*N*/ BOOL bLogarithmBack = mbLogarithm; +/*N*/ +/*N*/ if(mbColText) //... da hier modifiziert werden kann, aber die Werte nicht +/*N*/ { //in den Attrset sollen (also nicht persistent). In wie weit das nötig ist, ist ne andere Frage... +/*N*/ mfMin=0; +/*N*/ mfStep=1; +/*N*/ mbLogarithm = FALSE; +/*N*/ mfMax=mpModel->GetColCount(); +/*N*/ if(mbCenterText && mfMax>1.0) +/*N*/ { +/*?*/ mfMax-=1; +/*?*/ +/*?*/ //Die Markierungen sind bei Linien und Area-Charts verschoben +/*?*/ //=> dies entspricht gewissermassem dem Swap von Help und MainTicks +/*?*/ mnTicks=0;//nHelpTicksBack; //HelpTicks bzw. innen/aussen noch nicht per GUI zugänglich, daher fixe Werte +/*?*/ mnHelpTicks=CHAXIS_MARK_OUTER;//nTicksBack; +/*?*/ mnHelpTickLen=nTickLenBack; +/*?*/ mnTickLen=nHelpTickLenBack; +/*?*/ +/*?*/ // Now we have to copy with the case of to many tick marks. +/*?*/ // The problem lies in the fact, that creating to many tick +/*?*/ // marks results in an overrun of pool item reference counters. +/*?*/ // Creating them without these items leaves them unchangeable. +/*?*/ // The best solution is to generalize the data set, i.e. +/*?*/ // to draw only a part of the tick marks (and draw only a part +/*?*/ // of the data). The number of tick marks to draw should ideally +/*?*/ // depend on the real window size measured in pixel. This is (at +/*?*/ // the moment) not possible because we don't have access to the +/*?*/ // view and therefore no access to it's output device. +/*?*/ // Leaving a clean solution for the new chart for now we +/*?*/ // set a fixed number as the maximal count of tick marks. +/*?*/ // This solution has one advantage: output to the screen and to +/*?*/ // the printer has the same number of tick marks. +/*?*/ const double maximum_number_of_tick_marks = 1000.0; +/*?*/ mfStep =(mfMax - mfMin) / ::std::min< double > (maximum_number_of_tick_marks, (mfMax - mfMin)); +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ mnHelpTicks=0; //nicht per Gui möglich, daher fixe Werte +/*N*/ mnTicks=CHAXIS_MARK_OUTER; +/*N*/ } +/*N*/ +/*N*/ mfStepHelp = mfStep / 2; +/*N*/ } +/*N*/ +/*N*/ // #69810# prevent infinite loop if step wouldn't change the value of fAct +/*N*/ BOOL bStepIsOK = mbLogarithm? (fabs(mfStep) > 1.0): (mfStep != 0.0); +/*N*/ +/*N*/ // DBG_ASSERT( bStepIsOK, "Axis increment is ineffective and would cause loop" ); +/*N*/ +/*N*/ if( mfMax!=mfMin && ( bStepIsOK ) ) +/*N*/ { +/*N*/ double fAct = mfMin; +/*N*/ double fActHelp = mfMin; +/*N*/ +/*N*/ // in the worst case the threshhold is 1/1000th of the height of the +/*N*/ // diagram this is just done because of minor inaccuracies that may +/*N*/ // occur, because in the following loop the current value is achieved by +/*N*/ // repeatedly adding the main step value where small errors might +/*N*/ // accumulate +/*N*/ double fThreshold = ::std::min( mfMax, ::std::min( mfStep, mfStepHelp )) / 1000.0; +/*N*/ +/*N*/ if( ::rtl::math::isInf( mfMax ) || ::rtl::math::isInf( mfMin )) +/*N*/ { +/*N*/ DBG_ERROR( "maximum or minumum is infinity" ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // #102339# iterate one major tick further and inhibit creating +/*N*/ // ticks in case they are above the maximum (+threshold) +/*N*/ double fUpperLimit = mfMax + fThreshold; +/*N*/ double fIterationEnd = fUpperLimit + mfStep; +/*N*/ while( fAct <= fIterationEnd ) +/*N*/ { +/*N*/ long nMainPos = GetPos(fAct); +/*N*/ +/*N*/ if( fAct <= fUpperLimit ) +/*N*/ { +/*N*/ GridLine(aLine,nMainPos); +/*N*/ +/*N*/ if (mpMainGridList) +/*N*/ mpMainGridList->NbcInsertObject(SetObjectAttr(new SdrPathObj(OBJ_PLIN,aLine), +/*N*/ USHORT(mnIdMainGrid),TRUE,TRUE,mpMainGridAttr)); +/*N*/ } +/*N*/ +/*N*/ if(mpHelpGridList || (mpAxisList && mnHelpTicks) ) +/*N*/ { +/*?*/ if(mbLogarithm) +/*?*/ { +/*?*/ fActHelp = mfStep / mfStepHelp * fAct; +/*?*/ +/*?*/ double fNext = fAct; +/*?*/ IncValue(fNext,mfStep,mbLogarithm); +/*?*/ +/*?*/ while (fActHelp < fNext) +/*?*/ { +/*?*/ if(CalcFact(fActHelp) > 1.0) +/*?*/ break; +/*?*/ +/*?*/ if( fActHelp <= fUpperLimit ) +/*?*/ { +/*?*/ GridLine(aLine,nPos=GetPos(fActHelp)); +/*?*/ +/*?*/ if(mpHelpGridList) +/*?*/ mpHelpGridList->NbcInsertObject(SetObjectAttr(new SdrPathObj(OBJ_PLIN,aLine), +/*?*/ USHORT(mnIdHelpGrid),TRUE,TRUE,mpHelpGridAttr)); +/*?*/ +/*?*/ InsertMark(nPos,mnHelpTickLen,mnHelpTicks); +/*?*/ } +/*?*/ +/*?*/ fActHelp+=mfStep/mfStepHelp*fAct; +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ while(fActHelp <= fAct) +/*?*/ { +/*?*/ if(CalcFact(fActHelp) > 1.0) +/*?*/ break; +/*?*/ +/*?*/ if( fActHelp <= fUpperLimit ) +/*?*/ { +/*?*/ GridLine(aLine,nPos=GetPos(fActHelp)); +/*?*/ +/*?*/ if(mpHelpGridList) +/*?*/ mpHelpGridList->NbcInsertObject(SetObjectAttr(new SdrPathObj(OBJ_PLIN, aLine), +/*?*/ USHORT(mnIdHelpGrid),TRUE,TRUE,mpHelpGridAttr)); +/*?*/ +/*?*/ InsertMark(nPos,mnHelpTickLen,mnHelpTicks); +/*?*/ } +/*?*/ +/*?*/ fActHelp+=mfStepHelp; +/*?*/ } +/*?*/ // If the main grid is drawn then skip the coinciding help grid lines. +/*?*/ if ((fActHelp == fAct) && mpMainGridList || mbColText) +/*?*/ fActHelp+=mfStepHelp; +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ if( mpAxisList && fAct < fUpperLimit ) +/*N*/ { +/*N*/ if(mbShowDescr) +/*N*/ CreateMarkDescr(fAct,nMainPos); +/*N*/ else +/*?*/ InsertMark(nMainPos,mnTickLen,mnTicks); +/*N*/ } +/*N*/ IncValue( fAct, mfStep, mbLogarithm ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // restore original values. Might be obsolete +/*N*/ mfMin = fMinBack; +/*N*/ mfMax = fMaxBack; +/*N*/ mfStep = fStepBack; +/*N*/ mfStepHelp = fStepHelpBack; +/*N*/ +/*N*/ mnTicks =nTicksBack; +/*N*/ mnHelpTicks =nHelpTicksBack; +/*N*/ mnTickLen =nTickLenBack; +/*N*/ mnHelpTickLen =nHelpTickLenBack; +/*N*/ mbLogarithm =bLogarithmBack; +/*N*/ } + +/*?*/ inline double ChartAxis::GetData(long nCol,long nRow) +/*?*/ { +/*?*/ double fData=mpModel->GetData(nCol,nRow); +/*?*/ if(mbPercent) +/*?*/ fData=Data2Percent(fData,nCol,nRow); +/*?*/ return fData; +/*?*/ }; +// Falls es sich um eine gespiegelte Achse handelt, ist es nicht möglich, +// einmal Logarithmus zu setzen, das andere mal nicht. +// Die anderen Werte müssen evtl. (bei automatik) angepasst werden. +// allerdings darf hier geändert werden, um z.B. links 0-10 Volt +// und rechts 0-1000 mV an der Achse zu setzen. Das die Werte dann trotzdem +// identisch sind, liegt in diesem Fall dann in der Verantwortung des Users. +/*N*/ BOOL ChartAxis::AttachIfNoOwnData(const ChartAxis* pAxis) +/*N*/ { +/*N*/ if(!mbAlternativIdUsed) //Hat eigene Daten! +/*N*/ return FALSE; + + //es macht keinen Sinn, unsichtbare Achsen zu kopieren: +/*?*/ if(!pAxis->IsVisible() && !pAxis->HasDescription()) +/*?*/ return FALSE; +/*?*/ +/*?*/ ReadAutoAttr(); +/*?*/ +/*?*/ mbLogarithm = pAxis->mbLogarithm; +/*?*/ mpAxisAttr->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM,mbLogarithm)); +/*?*/ +/*?*/ if(mbAutoStep) +/*?*/ mfStep=pAxis->mfStep; +/*?*/ if(mbAutoStepHelp) +/*?*/ mfStepHelp=pAxis->mfStepHelp; +/*?*/ if(mbAutoMin) +/*?*/ mfMin=pAxis->mfMin; +/*?*/ if(mbAutoMax) +/*?*/ mfMax=pAxis->mfMax; +/*?*/ if(mbAutoOrigin) +/*?*/ mfOrigin=pAxis->mfOrigin; +/*?*/ +/*?*/ FillItemSet(); +/*?*/ +/*?*/ return TRUE; +/*?*/ +/*N*/ } +/*N*/ double ChartAxis::NumStepsMain() +/*N*/ { +/*N*/ if( mbLogarithm ) +/*N*/ { +/*?*/ DBG_ASSERT( mfStep > 1.0, "ChartAxis: argument of log must be greater than 1" ); +/*?*/ return log( mfMax - mfMin ) / log( mfStep ); +/*N*/ } +/*N*/ +/*N*/ return (mfMax - mfMin) / mfStep; +/*N*/ }; + +/*N*/ long ChartAxis::GetDescrWidth() +/*N*/ { +/*N*/ double fAllTextLen = IsVertical() ? (double)maRefArea.GetHeight() +/*N*/ : (double)maRefArea.GetWidth(); +/*N*/ long nDescrWidth=0; +/*N*/ +/*N*/ if(!mbColText) //z.B. bei XY-Charts gelangt man hier hin! +/*N*/ { +/*N*/ if(mfStep!=0.0) +/*N*/ { +/*N*/ double fCnt = NumStepsMain(); +/*N*/ if (mbCenterText) +/*N*/ fCnt -= 1.0; +/*N*/ +/*N*/ nDescrWidth = (long) (fAllTextLen / fCnt); +/*N*/ } +/*N*/ } +/*N*/ else //Area, Bar etc. +/*N*/ { +/*N*/ long nColCnt=mpModel->GetColCount(); +/*N*/ +/*N*/ if (mbCenterText && nColCnt > 1) +/*N*/ nColCnt--; +/*N*/ +/*N*/ nDescrWidth = (long) (fAllTextLen / (double)nColCnt); +/*N*/ } +/*N*/ return nDescrWidth; +/*N*/ } + +/*N*/ UINT32 ChartAxis::GetNumFormat( BOOL bPercent ) +/*N*/ { +/*N*/ return ((const SfxUInt32Item&)mpAxisAttr->Get(bPercent +/*N*/ ? SCHATTR_AXIS_NUMFMTPERCENT : SCHATTR_AXIS_NUMFMT)).GetValue(); +/*N*/ } + + + +/*N*/ BOOL ChartAxis::TranslateMergedNumFormat( SvNumberFormatterIndexTable* pTransTable ) +/*N*/ { +/*N*/ ULONG nFmt, nMrgFmt; +/*N*/ BOOL bRet =FALSE; +/*N*/ +/*N*/ nFmt = GetNumFormat( mbPercent ); +/*N*/ nMrgFmt = mpNumFormatter->GetMergeFmtIndex( nFmt ); +/*N*/ if( nFmt != nMrgFmt ) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SetNumFormat( mbPercent, nMrgFmt ); +/*N*/ } +/*N*/ +/*N*/ nFmt = GetNumFormat( ! mbPercent ); +/*N*/ nMrgFmt = mpNumFormatter->GetMergeFmtIndex( nFmt ); +/*N*/ if( nFmt != nMrgFmt ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 SetNumFormat( ! mbPercent, nMrgFmt ); +/*N*/ +/*N*/ return bRet; +/*N*/ } + +/*N*/ void ChartAxis::SetAxisList( SdrObjList *pList ) +/*N*/ { +/*N*/ mpAxisList = pList; +/*N*/ maRectA = maRectB = Rectangle(); +/*N*/ } + +/*N*/ long ChartAxis::GetUniqueIdByObjectId( long nObjectId ) +/*N*/ { +/*N*/ long nResult = CHAXIS_AXIS_UNKNOWN; +/*N*/ +/*N*/ switch( nObjectId ) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ nResult = CHAXIS_AXIS_X; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ nResult = CHAXIS_AXIS_Y; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ nResult = CHAXIS_AXIS_Z; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_A_AXIS: +/*N*/ nResult = CHAXIS_AXIS_A; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ nResult = CHAXIS_AXIS_B; +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ return nResult; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chdescr.cxx b/binfilter/bf_sch/source/core/sch_chdescr.cxx new file mode 100644 index 000000000000..23731ec5fee1 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chdescr.cxx @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <bf_svtools/eitem.hxx> + +#include "chdescr.hxx" + +#include "float.h" +#include "schgroup.hxx" +#include "chtscene.hxx" +namespace binfilter { + +/*N*/ ChartDataDescription::ChartDataDescription(long nCols, long nRows, SdrObjList *pList, +/*N*/ ChartModel* pModel, BOOL bEnable) : +/*N*/ mnRows(nRows), +/*N*/ mnCols(nCols), +/*N*/ mpList(pList), +/*N*/ mpModel(pModel), +/*N*/ mbEnable(bEnable), +/*N*/ mpDescrLists(NULL), +/*N*/ mpDescrArray(NULL), +/*N*/ mpDescrGroups(NULL) +/*N*/ { +/*N*/ } + +/*N*/ void ChartDataDescription::Build( BOOL bRowDescr ) +/*N*/ { +/*N*/ Dirty2D( bRowDescr ); +/*N*/ if(mpList && mpDescrGroups) +/*N*/ { +/*?*/ for( long nRow=0; nRow<mnRows; nRow++ ) +/*?*/ { +/*?*/ if(mpDescrGroups[nRow]) +/*?*/ mpList->NbcInsertObject( mpDescrGroups[nRow] ); +/*?*/ } +/*?*/ } +/*N*/ } + +/*N*/ void ChartDataDescription::Build3D( ChartScene *pScene, Matrix4D* pMatrix ) +/*N*/ { +/*N*/ if(pScene && mpDescrGroups) +/*N*/ { +/*?*/ for( long nRow=0; nRow<mnRows; nRow++ ) +/*?*/ { +/*?*/ for( long nCol=0; nCol<mnCols; nCol++ ) +/*?*/ { +/*?*/ long nIndex = nCol + nRow * mnCols; +/*?*/ if( mpDescrArray[nIndex].fValue != DBL_MIN ) +/*?*/ { +/*?*/ mpDescrArray[nIndex].pLabelObj->SetMarkProtect(TRUE); +/*?*/ E3dLabelObj* pLabel=new E3dLabelObj(mpDescrArray[nIndex].aTextPos3D, +/*?*/ mpDescrArray[nIndex].pLabelObj); +/*?*/ +/*?*/ CHART_TRACE3( "Descr::Build3D TextPos = (%ld, %ld, %ld)", +/*?*/ mpDescrArray[ nIndex ].aTextPos3D.X(), +/*?*/ mpDescrArray[ nIndex ].aTextPos3D.Y(), +/*?*/ mpDescrArray[ nIndex ].aTextPos3D.Z() ); +/*?*/ +/*?*/ pLabel->SetMarkProtect(TRUE); +/*?*/ pScene->Insert3DObj(pLabel); +/*?*/ if(pMatrix) +/*?*/ pLabel->NbcSetTransform(*pMatrix); +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ } + +/*N*/ ChartDataDescription::~ChartDataDescription() +/*N*/ { +/*N*/ if(mpDescrLists) +/*?*/ delete[] mpDescrLists; +/*N*/ if(mpDescrGroups) +/*?*/ delete[] mpDescrGroups; +/*N*/ if(mpDescrArray) +/*?*/ delete[] mpDescrArray; +/*N*/ } + + +/*N*/ DataDescription* ChartDataDescription::Insert( long nCol, long nRow, const SfxItemSet& rAttr, Point aPos, +/*N*/ BOOL bPercent, ChartAdjust eAdjust, ChartAxis* pAxis ) +/*N*/ { +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)rAttr.Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ if(mbEnable && eDescr != CHDESCR_NONE) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 Create(nRow); //evtl. Array und Liste erstellen +/*N*/ } +/*N*/ return NULL; +/*N*/ } + +/*N*/ void ChartDataDescription::Dirty2D( BOOL bRowDescr ) +/*N*/ { +/*N*/ +/*N*/ if(mpDescrLists) +/*N*/ { +/*?*/ for( long nRow = 0; nRow < mnRows; nRow ++ ) +/*?*/ { +/*?*/ if( mpDescrLists[nRow] ) +/*?*/ { +/*?*/ for( long nCol = 0; nCol < mnCols; nCol++ ) +/*?*/ { +/*?*/ long nIndex = nCol + nRow * mnCols; +/*?*/ if (mpDescrArray[nIndex].fValue != DBL_MIN) +/*?*/ if (mpDescrArray[nIndex].pLabelObj) +/*?*/ mpDescrLists[nRow]->NbcInsertObject(mpDescrArray[nIndex].pLabelObj); +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtm3d2.cxx b/binfilter/bf_sch/source/core/sch_chtm3d2.cxx new file mode 100644 index 000000000000..45b83e00546c --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtm3d2.cxx @@ -0,0 +1,608 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "chtscene.hxx" +#include "datapoin.hxx" + +#include <bf_svx/svxids.hrc> + +#include "schattr.hxx" +#include "objid.hxx" + +#include "axisobj.hxx" + +namespace binfilter { + +#define SCH_MIN(a, b) (((a) < (b))? (a): (b)) + +/*N*/ long ChartModel::GetChartShapeType() +/*N*/ { +/*N*/ long nShape =CHART_SHAPE3D_IGNORE; // BM: ANY instead of IGNORE +/*N*/ long nOldShape=CHART_SHAPE3D_IGNORE; +/*N*/ +/*N*/ if( Is3DChart() && +/*N*/ ( GetBaseType() == CHTYPE_BAR || +/*N*/ GetBaseType() == CHTYPE_COLUMN )) +/*N*/ { +/*N*/ const SfxPoolItem *pPoolItem; +/*N*/ long nRowCnt=GetRowCount(); +/*N*/ long nColCnt=GetColCount(); +/*N*/ for(long nRow=0;nRow<nRowCnt;nRow++) +/*N*/ { +/*N*/ for(long nCol=0;nCol<nColCnt;nCol++) +/*N*/ { +/*N*/ const SfxItemSet& rAttr=GetDataPointAttr(nCol,nRow); +/*N*/ if(rAttr.GetItemState(SCHATTR_STYLE_SHAPE, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ nShape=((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ if(!GetDataPointObj(nCol,nRow)) +/*?*/ { +/*?*/ nShape=nOldShape; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ nShape=CHART_SHAPE3D_SQUARE; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if( (nShape!=nOldShape) && nOldShape!=CHART_SHAPE3D_IGNORE) +/*?*/ return CHART_SHAPE3D_ANY; +/*N*/ +/*N*/ nOldShape=nShape; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return nShape; +/*N*/ } +/************************************************************************* +|* | +|* 3D-Balken erzeugen; aPos: links, unten, hinten |__ +|* / +\************************************************************************/ +/*N*/ E3dCompoundObject* ChartModel::Create3DBar(Vector3D aPos, +/*N*/ Vector3D aSizeVec, +/*N*/ long nCol, +/*N*/ long nRow, +/*N*/ SfxItemSet &rAttr, +/*N*/ BOOL bIsSimple, +/*N*/ double fMinPos, +/*N*/ double fOriPos, +/*N*/ double fMaxPos) +/*N*/ { +/*N*/ Matrix4D aTransMat; +/*N*/ +/*N*/ long mode=CHART_SHAPE3D_SQUARE; +/*N*/ double fHeight=fMaxPos-fMinPos; +/*N*/ double a,b; +/*N*/ +/*N*/ +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ if (rAttr.GetItemState(SCHATTR_STYLE_SHAPE, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ mode=((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ if( (mode==CHART_SHAPE3D_ANY) || +/*N*/ (mode==CHART_SHAPE3D_IGNORE) // BM #66527# shouldn't happen but actually does :-( +/*N*/ ) +/*N*/ mode=CHART_SHAPE3D_SQUARE; +/*N*/ +/*N*/ CHART_TRACE1( "Create3DBar Mode=%ld", mode ); +/*N*/ +/*N*/ PolyPolygon aPolyPoly; +/*N*/ Vector3D aDestCenter; +/*N*/ E3dCompoundObject* pObj; +/*N*/ E3dDefaultAttributes aDefltAttr3D; +/*N*/ +/*N*/ long nSegs=32; +/*N*/ +/*N*/ double fBase = +/*N*/ ( IsBar() +/*N*/ ? SCH_MIN( aSizeVec.Y(), aSizeVec.Z()) +/*N*/ : SCH_MIN( aSizeVec.X(), aSizeVec.Z()) ) +/*N*/ / 2.0 - 1.0; +/*N*/ +/*N*/ aDestCenter = aPos + (aSizeVec / 2); +/*N*/ +/*N*/ double fTmp = IsBar() +/*N*/ ? aDestCenter.X() +/*N*/ : aDestCenter.Y(); +/*N*/ BOOL bNegativ=(fTmp < fOriPos); +/*N*/ +/*N*/ if(mode!=CHART_SHAPE3D_SQUARE && IsBar()) +/*N*/ { +/*N*/ a=aPos.X()-fOriPos; +/*N*/ b=aPos.X()+aSizeVec.X()-fOriPos; +/*N*/ +/*N*/ double fTmp=aSizeVec.X(); +/*N*/ aSizeVec.X()=aSizeVec.Y(); +/*N*/ aSizeVec.Y()=fTmp; +/*N*/ aSizeVec.Z()=-aSizeVec.Z(); //90Grad drehen +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ a=aPos.Y()-fOriPos; +/*N*/ b=aPos.Y()+aSizeVec.Y()-fOriPos; +/*N*/ } +/*N*/ +/*N*/ const double fRelH =(double)( (bNegativ) ? fOriPos-fMaxPos : fMinPos-fOriPos); +/*N*/ +/*N*/ a=fRelH-a; +/*N*/ b=fRelH-b; +/*N*/ +/*N*/ if(bNegativ) +/*N*/ { +/*N*/ double tmp=a; +/*N*/ a=b; +/*N*/ b=tmp; +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if(mode==CHART_SHAPE3D_HANOI) +/*N*/ { +/*N*/ b=a; +/*N*/ mode=CHART_SHAPE3D_CONE; +/*N*/ } +/*N*/ +/*N*/ // add extra points to extrusion-rectangle, to get a uniformly light-distribution +/*N*/ // the distance of these offset points is dependent of the setting of "edge-rounding" +/*N*/ double fRoundedEdge = 0.0; +/*N*/ +/*N*/ fRoundedEdge = ((double)((const Svx3DPercentDiagonalItem&) +/*N*/ rAttr.Get(SDRATTR_3DOBJ_PERCENT_DIAGONAL)).GetValue()) / 200.0; +/*N*/ //-/ SfxItemState nState = rAttr.GetItemState( SID_ATTR_3D_PERCENT_DIAGONAL, TRUE, &pPoolItem ); +/*N*/ //-/ if( nState == SFX_ITEM_DEFAULT ) +/*N*/ //-/ fRoundedEdge = aDefltAttr3D.GetDefaultPercentDiag(); +/*N*/ //-/ else if( nState == SFX_ITEM_SET && pPoolItem ) +/*N*/ //-/ fRoundedEdge = SAL_STATIC_CAST( double, ( SAL_STATIC_CAST( const SfxUInt16Item*, pPoolItem )->GetValue() )) +/*N*/ //-/ / 200.0; +/*N*/ +/*N*/ // always use extra points, so set percent diagonal to 0.4 which is 0% in the UI +/*N*/ if( fRoundedEdge == 0.0 ) +/*N*/ fRoundedEdge = 0.4 / 200.0; +/*N*/ +/*N*/ switch( mode ) +/*N*/ { +/*N*/ case CHART_SHAPE3D_CYLINDER: +/*N*/ { +/*N*/ double fOffset = (fBase * 2.0 * fRoundedEdge) * 1.05; // increase by 5% for safety +/*N*/ short nPolySize; +/*N*/ +/*N*/ aPos = Vector3D( 0.0, 0.0, 0.0 ); +/*N*/ if( 2.0 * fOffset < fBase && +/*N*/ 2.0 * fOffset < aSizeVec.Y() ) +/*N*/ { +/*N*/ nPolySize = 8; +/*N*/ Polygon aPoly( nPolySize ); +/*N*/ aPoly[0] = Point( aPos.X(), aPos.Y() ); +/*N*/ +/*N*/ aPoly[1] = Point( aPos.X() + fBase - fOffset, aPos.Y() ); +/*N*/ aPoly[2] = Point( aPos.X() + fBase, aPos.Y() ); +/*N*/ aPoly[3] = Point( aPos.X() + fBase, aPos.Y() + fOffset ); +/*N*/ +/*N*/ aPoly[4] = Point( aPos.X() + fBase, aPos.Y() + aSizeVec.Y() - fOffset ); +/*N*/ aPoly[5] = Point( aPos.X() + fBase, aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[6] = Point( aPos.X() + fBase - fOffset, aPos.Y() + aSizeVec.Y()); +/*N*/ +/*N*/ aPoly[7] = Point( aPos.X(), aPos.Y() + aSizeVec.Y()); +/*N*/ +/*N*/ aPolyPoly.Insert( aPoly ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nPolySize = 4; +/*N*/ Polygon aPoly( nPolySize ); +/*N*/ +/*N*/ aPoly[0]=Point(aPos.X() , aPos.Y()); +/*N*/ aPoly[1]=Point(aPos.X() + fBase , aPos.Y()); +/*N*/ aPoly[2]=Point(aPos.X() + fBase , aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[3]=Point(aPos.X() , aPos.Y() + aSizeVec.Y()); +/*N*/ +/*N*/ aPolyPoly.Insert(aPoly); +/*N*/ } +/*N*/ +/*N*/ pObj = new SchE3dLatheObj(aDefltAttr3D, aPolyPoly); +/*N*/ ((E3dLatheObj*)pObj)->SetItem( Svx3DHorizontalSegmentsItem( nSegs )); +/*N*/ +/*N*/ +/*N*/ // #67170# just write the necessary attributes +/*N*/ //-/ SfxItemSet aSegmentAttr(*pItemPool, SID_ATTR_3D_START, SID_ATTR_3D_END, +/*N*/ //-/ SCHATTR_STYLE_START, SCHATTR_STYLE_END, +/*N*/ //-/ 0); +/*N*/ SfxItemSet aSegmentAttr(*pItemPool, +/*N*/ SDRATTR_3D_FIRST, SDRATTR_3D_LAST, +/*N*/ SCHATTR_STYLE_START, SCHATTR_STYLE_END, +/*N*/ 0, 0); +/*N*/ +/*N*/ rAttr.Put( Svx3DHorizontalSegmentsItem( nSegs )); +/*N*/ +/*N*/ aSegmentAttr.Put(rAttr); +/*N*/ PutDataPointAttr(nCol, nRow, aSegmentAttr); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ +/*N*/ case CHART_SHAPE3D_PYRAMID: +/*N*/ nSegs = 4; +/*N*/ aTransMat.RotateY( F_PI / 4.0 ); // rotate edge to front +/*N*/ // continue with same code as for cone +/*N*/ +/*N*/ case CHART_SHAPE3D_CONE: +/*N*/ { +/*N*/ aPos = Vector3D( 0, 0, 0 ); +/*N*/ double fOffset = (fBase * fRoundedEdge) * 1.05; // increase by 5% for safety +/*N*/ +/*N*/ BOOL bIsTip = (fRelH == 0.0 || fHeight == 0.0) || // nonstacked chart +/*N*/ (fBase * b <= fOffset * fRelH); // tip of stacked chart +/*N*/ +/*N*/ long nPolySize; +/*N*/ double r1, r2; +/*N*/ if( bIsTip ) +/*N*/ { +/*N*/ r1 = 0.0; +/*N*/ r2 = ( fRelH == 0.0 )? fBase : ( fBase * a ) / fRelH; +/*N*/ nPolySize = 6; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ r1 = ( fBase * b ) / fRelH; +/*N*/ r2 = ( fBase * a ) / fRelH; +/*N*/ nPolySize = 8; +/*N*/ } +/*N*/ double fTemp = ((r2-r1) * (r2-r1)) / (aSizeVec.Y() * aSizeVec.Y()); +/*N*/ double fOffsetX = sqrt( fOffset * fOffset / (1.0 + 1.0/fTemp )); +/*N*/ double fOffsetY = sqrt( fOffset * fOffset / (1.0 + fTemp )); +/*N*/ +/*N*/ Polygon aPoly( nPolySize ); +/*N*/ short i=0; +/*N*/ +/*N*/ if( ! bIsTip ) // skip these points for the tip +/*N*/ { +/*N*/ aPoly[i++] = Point( aPos.X(), aPos.Y()); +/*N*/ aPoly[i++] = Point( aPos.X() + r1 - fOffset, aPos.Y()); +/*N*/ } +/*N*/ aPoly[i++] = Point( aPos.X() + r1, aPos.Y()); +/*N*/ aPoly[i++] = Point( aPos.X() + r1 + fOffsetX, aPos.Y() + fOffsetY); +/*N*/ aPoly[i++] = Point( aPos.X() + r2 - fOffsetX, aPos.Y() + aSizeVec.Y() - fOffsetY); +/*N*/ aPoly[i++] = Point( aPos.X() + r2, aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[i++] = Point( aPos.X() + r2 - fOffset, aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[i++] = Point( aPos.X(), aPos.Y() + aSizeVec.Y()); +/*N*/ +/*N*/ aPolyPoly.Insert( aPoly ); +/*N*/ +/*N*/ pObj = new SchE3dLatheObj( aDefltAttr3D, aPolyPoly ); +/*N*/ ((E3dLatheObj*)pObj)->SetItem( Svx3DHorizontalSegmentsItem( nSegs )); +/*N*/ +/*N*/ // #67170# just write the necessary attributes +/*N*/ //-/ SfxItemSet aSegmentAttr(*pItemPool, SID_ATTR_3D_START, SID_ATTR_3D_END, +/*N*/ //-/ SCHATTR_STYLE_START, SCHATTR_STYLE_END, +/*N*/ //-/ 0); +/*N*/ SfxItemSet aSegmentAttr(*pItemPool, +/*N*/ SDRATTR_3D_FIRST, SDRATTR_3D_LAST, +/*N*/ SCHATTR_STYLE_START, SCHATTR_STYLE_END, +/*N*/ 0, 0); +/*N*/ +/*N*/ rAttr.Put( Svx3DHorizontalSegmentsItem( nSegs )); +/*N*/ +/*N*/ aSegmentAttr.Put(rAttr); +/*N*/ PutDataPointAttr(nCol, nRow, aSegmentAttr); +/*N*/ } +/*N*/ break; +/*N*/ default: +/*N*/ case CHART_SHAPE3D_SQUARE: +/*N*/ { +/*N*/ double fOffset = (aSizeVec.Z() * fRoundedEdge) * 1.05; // increase by 5% for safety +/*N*/ +/*N*/ if( 2.0 * fOffset < aSizeVec.X() && +/*N*/ 2.0 * fOffset < aSizeVec.Y() ) +/*N*/ { +/*N*/ Polygon aPoly( 13 ); +/*N*/ aPoly[ 0] = Point( aPos.X() + fOffset, aPos.Y() ); +/*N*/ aPoly[ 1] = Point( aPos.X(), aPos.Y() ); +/*N*/ aPoly[ 2] = Point( aPos.X(), aPos.Y() + fOffset ); +/*N*/ +/*N*/ aPoly[ 3] = Point( aPos.X(), aPos.Y() + aSizeVec.Y() - fOffset ); +/*N*/ aPoly[ 4] = Point( aPos.X(), aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[ 5] = Point( aPos.X() + fOffset, aPos.Y() + aSizeVec.Y()); +/*N*/ +/*N*/ aPoly[ 6] = Point( aPos.X() + aSizeVec.X() - fOffset, aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[ 7] = Point( aPos.X() + aSizeVec.X(), aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[ 8] = Point( aPos.X() + aSizeVec.X(), aPos.Y() + aSizeVec.Y() - fOffset ); +/*N*/ +/*N*/ aPoly[ 9] = Point( aPos.X() + aSizeVec.X(), aPos.Y() + fOffset ); +/*N*/ aPoly[10] = Point( aPos.X() + aSizeVec.X(), aPos.Y() ); +/*N*/ aPoly[11] = Point( aPos.X() + aSizeVec.X() - fOffset, aPos.Y() ); +/*N*/ +/*N*/ aPoly[12] = aPoly[ 0]; +/*N*/ aPolyPoly.Insert( aPoly ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ Polygon aPoly(5); +/*N*/ aPoly[0]=Point(aPos.X(), aPos.Y()); +/*N*/ aPoly[1]=Point(aPos.X(), aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[2]=Point(aPos.X() + aSizeVec.X(), aPos.Y() + aSizeVec.Y()); +/*N*/ aPoly[3]=Point(aPos.X() + aSizeVec.X(), aPos.Y()); +/*N*/ aPoly[4]=aPoly[0]; +/*N*/ +/*N*/ aPolyPoly.Insert(aPoly); +/*N*/ } +/*N*/ +/*N*/ pObj = new SchE3dExtrudeObj(aDefltAttr3D, aPolyPoly, aSizeVec.Z()); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ } +/*N*/ +/*N*/ Vector3D aOldCenter=pObj->GetCenter(); +/*N*/ if(mode!=CHART_SHAPE3D_SQUARE) +/*N*/ { +/*N*/ if(IsBar()) +/*N*/ { +/*N*/ aTransMat.Translate(-aOldCenter);//Zentrum in Nullpunkt setzen +/*N*/ aTransMat.RotateZ(-3.1415927/2.0);//Saeule umwerfen (90Grad nach rechts) +/*N*/ if(bNegativ) +/*N*/ aTransMat.RotateZ(3.1415927);//Spitze nach unten oder links(Kegel, etc.) +/*N*/ aOldCenter=Vector3D(0,0,0); +/*N*/ } +/*N*/ else if(bNegativ) +/*N*/ { +/*N*/ aTransMat.Translate(-aOldCenter);//Zentrum in Nullpunkt setzen +/*N*/ if(bNegativ) +/*N*/ aTransMat.RotateZ(3.1415927);//Spitze nach unten oder links(Kegel, etc.) +/*N*/ aOldCenter=Vector3D(0,0,0); +/*N*/ } +/*N*/ } +/*N*/ aTransMat.Translate(aDestCenter - aOldCenter);//An die gewuenschte Position schieben +/*N*/ //aTransMat=pObj->GetTransform()*aTransMat; +/*N*/ pObj->NbcSetTransform(aTransMat); +/*N*/ +/*N*/ pObj->SetModel (this); + // #106658# the ChartModel has a different Pool default for the + // Svx3DPercentDiagonalItem. The Geometry is created while using a global + // pool (Model is not set). Ensure recreating the geometry with new Model +/*N*/ pObj->DestroyGeometry(); +/*N*/ +/*N*/ pObj->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM_DATA)); +/*N*/ +/*N*/ // the number vertical segments is always fixed +/*N*/ rAttr.ClearItem( SDRATTR_3DOBJ_VERT_SEGS ); +/*N*/ pObj->SetItemSet(rAttr); +/*N*/ +/*N*/ pObj->InsertUserData(new SchDataPoint(nCol, nRow)); +/*N*/ +/*N*/ return pObj; +/*N*/ } +/************************************************************************* +|* +|* Neues 3D-Object erzeugen +|* +\************************************************************************/ +/*N*/ E3dObject* ChartModel::Create3DObject (UINT16 ID) +/*N*/ { +/*N*/ E3dObject *pMyObject = new SchE3dObject; +/*N*/ pMyObject->SetModel (this); +/*N*/ pMyObject->InsertUserData(new SchObjectId(ID)); +/*N*/ return pMyObject; +/*N*/ } + +/*N*/ E3dScene* ChartModel::Create3DScene (UINT16 ID) +/*N*/ { +/*N*/ E3dScene* pMyObject = new ChartScene( this ); +/*N*/ pMyObject->InsertUserData(new SchObjectId(ID)); +/*N*/ return pMyObject; +/*N*/ } + +/*N*/ E3dObject* ChartModel::Create3DAxisObj( UINT16 nId ) +/*N*/ { +/*N*/ E3dObject *pMyObject = new Sch3dAxisObj; +/*N*/ pMyObject->SetModel( this ); +/*N*/ pMyObject->InsertUserData( new SchObjectId( nId ) ); +/*N*/ return pMyObject; +/*N*/ } + +/************************************************************************* +|* +|* 3D-Polygon erzeugen +|* +\************************************************************************/ +/*N*/ void ChartModel::Create3DPolyObject (const SfxItemSet *pAttr, +/*N*/ E3dPolygonObj *pMyObject, +/*N*/ UINT16 nID, +/*N*/ E3dObject *pParent) +/*N*/ { +/*N*/ pMyObject->InsertUserData(new SchObjectId(nID)); +/*N*/ pParent->Insert3DObj (pMyObject); +/*N*/ pMyObject->SetModel (this); +/*N*/ +/*N*/ //-/ pMyObject->NbcSetAttributes(*pAttr, FALSE); +/*N*/ pMyObject->SetItemSet(*pAttr); +/*N*/ +/*N*/ } + + +/*N*/ void ChartModel::Create3DExtrudePolyObj(const SfxItemSet *pAttr, +/*N*/ E3dExtrudeObj *pMyObject, +/*N*/ UINT16 nID, +/*N*/ E3dObject *pParent) +/*N*/ { +/*N*/ pMyObject->InsertUserData(new SchObjectId(nID)); +/*N*/ pParent->Insert3DObj (pMyObject); +/*N*/ pMyObject->SetModel (this); +/*N*/ +/*N*/ //-/ pMyObject->NbcSetAttributes(*pAttr, FALSE); +/*N*/ pMyObject->SetItemSet(*pAttr); +/*N*/ +/*N*/ } + +/************************************************************************* +|* +|* 3D-Scene erzeugen +|* +\************************************************************************/ + +/*N*/ ChartScene* ChartModel::CreateScene (const Rectangle &rRect, +/*N*/ const Vector3D &aLightVec, +/*N*/ double fSpotIntensity, +/*N*/ Color& rSpotColor, +/*N*/ double fAmbientIntensity, +/*N*/ Color& rAmbientColor) +/*N*/ { +/*N*/ ChartScene *pMyScene = new ChartScene (this); +/*N*/ +/*N*/ pMyScene->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM)); +/*N*/ pMyScene->NbcSetSnapRect(rRect); +/*N*/ +/*N*/ return pMyScene; +/*N*/ } + +/*N*/ void SchRectObj::NbcSetOutlinerParaObject(OutlinerParaObject* pTextObject) +/*N*/ { +/*N*/ SdrRectObj::NbcSetOutlinerParaObject(pTextObject); +/*N*/ ChartModel* pModel=(ChartModel*)GetModel(); +/*N*/ if(pModel) +/*N*/ pModel->SetTextFromObject(this,pTextObject); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + +/*N*/ void ImpStoreObjcetsAttr(SdrObject *pObj) +/*N*/ { +/*N*/ ChartModel* pModel = (ChartModel*)pObj->GetModel(); +/*N*/ if(pModel) +/*N*/ pModel->StoreObjectsAttributes(pObj, pObj->GetItemSet(), FALSE); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + + + +/*N*/ void SchRectObj::SetItemSet(const SfxItemSet& rSet) +/*N*/ { +/*N*/ SdrRectObj::SetItemSet(rSet); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SchE3dExtrudeObj::SetItem(const SfxPoolItem& rItem) +/*N*/ { +/*N*/ E3dExtrudeObj::SetItem(rItem); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + + +/*N*/ void SchE3dExtrudeObj::SetItemSet(const SfxItemSet& rSet) +/*N*/ { +/*N*/ E3dExtrudeObj::SetItemSet(rSet); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SchE3dPolygonObj::SetItem(const SfxPoolItem& rItem) +/*N*/ { +/*N*/ E3dPolygonObj::SetItem(rItem); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + + +/*N*/ void SchE3dPolygonObj::SetItemSet(const SfxItemSet& rSet) +/*N*/ { +/*N*/ E3dPolygonObj::SetItemSet(rSet); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + +/*N*/ void SchE3dLatheObj::SetItem(const SfxPoolItem& rItem) +/*N*/ { +/*N*/ E3dLatheObj::SetItem(rItem); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + + +/*N*/ void SchE3dLatheObj::SetItemSet(const SfxItemSet& rSet) +/*N*/ { +/*N*/ E3dLatheObj::SetItemSet(rSet); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + + + +/*N*/ void SchE3dObject::SetItemSet(const SfxItemSet& rSet) +/*N*/ { +/*N*/ E3dObject::SetItemSet(rSet); +/*N*/ ImpStoreObjcetsAttr(this); +/*N*/ } + +////////////////////////////////////////////////////////////////////////////// + +//-/void SchRectObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) +//-/{ +//-/ SdrRectObj::NbcSetAttributes(rAttr,bReplaceAll); +//-/ ChartModel* pModel=(ChartModel*)GetModel(); +//-/ if(pModel) +//-/ pModel->StoreObjectsAttributes(this,rAttr,bReplaceAll); +//-/}; +//-/void SchE3dExtrudeObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) +//-/{ +//-/ E3dExtrudeObj::NbcSetAttributes(rAttr,bReplaceAll); +//-/ ChartModel* pModel=(ChartModel*)GetModel(); +//-/ if(pModel) +//-/ pModel->StoreObjectsAttributes(this,rAttr,bReplaceAll); +//-/}; +//-/void SchE3dPolygonObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) +//-/{ +//-/ E3dPolygonObj::NbcSetAttributes(rAttr,bReplaceAll); +//-/ ChartModel* pModel=(ChartModel*)GetModel(); +//-/ if(pModel) +//-/ pModel->StoreObjectsAttributes(this,rAttr,bReplaceAll); +//-/}; +//-/void SchE3dLatheObj::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) +//-/{ +//-/ E3dLatheObj::NbcSetAttributes(rAttr,bReplaceAll); +//-/ ChartModel* pModel=(ChartModel*)GetModel(); +//-/ if(pModel) +//-/ pModel->StoreObjectsAttributes(this,rAttr,bReplaceAll); +//-/}; +//-/void SchE3dObject::NbcSetAttributes(const SfxItemSet& rAttr, FASTBOOL bReplaceAll) +//-/{ +//-/ E3dObject::NbcSetAttributes(rAttr,bReplaceAll); +//-/ ChartModel* pModel=(ChartModel*)GetModel(); +//-/ if(pModel) +//-/ pModel->StoreObjectsAttributes(this,rAttr,bReplaceAll); +//-/}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmod2a.cxx b/binfilter/bf_sch/source/core/sch_chtmod2a.cxx new file mode 100644 index 000000000000..1294f59222a4 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmod2a.cxx @@ -0,0 +1,1470 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <bf_svx/eeitem.hxx> +#ifndef _ZFORLIST_HXX //autogen +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif + +#include <bf_svx/svdocirc.hxx> +#include <bf_svx/svdopath.hxx> + +#include "schattr.hxx" +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + + +#endif +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#define ITEMID_FONTWIDTH EE_CHAR_FONTWIDTH +#include <bf_svx/fwdtitem.hxx> +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/svxids.hrc> +#ifndef _CHTMODEL_HXX +#endif + +#include "strings.hrc" +#include "glob.hrc" +#include <math.h> +#include <float.h> + + +#include "pairs.hxx" +#include "globfunc.hxx" + + +#include <bf_svx/xlineit.hxx> +// header for Line + +#include "chaxis.hxx" +#include "chdescr.hxx" +#include "calculat.hxx" +namespace binfilter { + +#define SCH_SIN(a) (sin((double)a * F_PI / 18000.0)) +#define SCH_COS(a) (cos((double)a * F_PI / 18000.0)) + +/************************************************************************* +|* +|* DataDescription Array initialisieren (loeschen) +|* +\************************************************************************/ +/************************************************************************* +|* +|* Kreisdiagramm erzeugen +|* +\************************************************************************/ +/*N*/ SdrObjGroup* ChartModel::Create2DPieChart(Rectangle aRect) +/*N*/ { +/*N*/ SchObjGroup *pGroup; +/*N*/ SdrObjList *pList; +/*N*/ +/*N*/ CreateChartGroup (pGroup, pList); +/*N*/ +/*N*/ // pie charts always have row number 0 for now +/*N*/ const long nRow = 0; +/*N*/ +/*N*/ double fTotal = 0.0; +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nSegOfsMax = 0; +/*N*/ +/*N*/ SchObjGroup* pDescrGroup = NULL; +/*N*/ SdrObjList *pDescrList = NULL; +/*N*/ DataDescription* pDescription = NULL; +/*N*/ long nCol; +/*N*/ Size aDescrOfs; +/*N*/ BOOL bInserted = FALSE; +/*N*/ +/*N*/ // Pie charts may not have titles of axes. +/*N*/ bShowXAxisTitle = FALSE; +/*N*/ bShowYAxisTitle = FALSE; +/*N*/ bShowZAxisTitle = FALSE; +/*N*/ +/*N*/ // determine the space required by the chart. For this chart type +/*N*/ // the labelling is also taken into the calculation +/*N*/ pDescrList = 0; +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fData = GetData (nCol, nRow); +/*N*/ if (fData != DBL_MIN) fTotal += fabs(fData); +/*N*/ } +/*N*/ +/*N*/ for( nCol = 0; nCol < nColCnt; nCol++ ) +/*N*/ { +/*N*/ SfxItemSet aDataPointAttr( GetFullDataPointAttr( nCol, nRow )); +/*N*/ double fData = GetData( nCol, nRow ); +/*N*/ long nIndex = nCol + nRow * nColCnt; +/*N*/ +/*N*/ nSegOfsMax = Max( PieSegOfs( nCol ), nSegOfsMax ); +/*N*/ +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ if( (eDescr != CHDESCR_NONE) && bShowDataDescr ) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ // data description required +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ // shrink rectangle if labels are printed beside the pies +/*N*/ if (pDescription) +/*N*/ { +/*N*/ // shrink by size of description text plus a +/*?*/ // percentage of the rect size as text offset +/*?*/ long nShrinkX = aDescrOfs.Width() + (aRect.GetWidth() / 20); +/*?*/ long nShrinkY = aDescrOfs.Height() + (aRect.GetHeight() / 20); +/*?*/ +/*?*/ aRect.Left() += nShrinkX; +/*?*/ aRect.Right() -= nShrinkX; +/*?*/ aRect.Top() += nShrinkY; +/*?*/ aRect.Bottom() -= nShrinkY; +/*N*/ } +/*N*/ +/*N*/ // make sure the pie rectangle is a square +/*N*/ // shrink rect +/*N*/ if (aRect.GetWidth() > aRect.GetHeight()) +/*N*/ { +/*N*/ aRect.Left() += (aRect.GetWidth() - aRect.GetHeight()) / 2; +/*N*/ aRect.Right() = aRect.Left() + aRect.GetHeight(); +/*N*/ } +/*N*/ else if (aRect.GetHeight() > aRect.GetWidth()) +/*N*/ { +/*?*/ aRect.Top() += (aRect.GetHeight() - aRect.GetWidth()) / 2; +/*?*/ aRect.Bottom() = aRect.Top() + aRect.GetWidth(); +/*N*/ } +/*N*/ +/*N*/ long nEndAng = 9000; +/*N*/ long nSegOfs; +/*N*/ +/*N*/ Rectangle aDefaultCircRect = aRect; +/*N*/ Rectangle aCircRect; +/*N*/ +/*N*/ // shrink default circle rectangle (square) to allow exploded pie segments +/*N*/ if( nSegOfsMax ) +/*N*/ { +/*?*/ double fRadius = (double)(aDefaultCircRect.GetWidth()) / 2.0; +/*?*/ long nRadiusDiff = (long)(fRadius * (1.0 - (1.0 / (1.0 + ((double)nSegOfsMax / 100.0))))); +/*?*/ aDefaultCircRect.Left() += nRadiusDiff; +/*?*/ aDefaultCircRect.Right() -= nRadiusDiff; +/*?*/ +/*?*/ aDefaultCircRect.Top() += nRadiusDiff; +/*?*/ aDefaultCircRect.Bottom() -= nRadiusDiff; +/*N*/ } +/*N*/ nPieRadius = aDefaultCircRect.GetWidth() / 2; // member set to query radius of pie segments +/*N*/ +/*N*/ // create all pie objects +/*N*/ for( nCol = 0; nCol < nColCnt; nCol++ ) +/*N*/ { +/*N*/ long nStartAng = nEndAng; +/*N*/ SfxItemSet aDataPointAttr( GetFullDataPointAttr( nCol, nRow )); +/*N*/ long nIndex = nCol + nRow * nColCnt; +/*N*/ double fData = fabs( GetData( nCol, nRow )); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ if( nCol == nColCnt - 1 ) +/*N*/ { +/*N*/ // ensure that the circle is closed even if we start at 90 degrees +/*N*/ nEndAng = 9000 + 36000; +/*N*/ } +/*N*/ else if( fTotal != 0.0 ) +/*N*/ { +/*?*/ nEndAng += (long)((fData / fTotal) * 36000); +/*N*/ } +/*N*/ +/*N*/ aCircRect = aDefaultCircRect; +/*N*/ +/*N*/ nSegOfs = PieSegOfs(nCol); +/*N*/ if( nSegOfs ) +/*N*/ { +/*?*/ double fSegShift = (double)(nPieRadius * nSegOfs) / 100.0; +/*?*/ +/*?*/ Point aCircPos = aCircRect.TopLeft(); +/*?*/ +/*?*/ long nAngleDiff; +/*?*/ long nAngleHook; +/*?*/ +/*?*/ // determine the bisector angle +/*?*/ if (nStartAng > nEndAng) +/*?*/ { +/*?*/ nAngleDiff = (nEndAng + 36000 - nStartAng) / 2; +/*?*/ nAngleHook = (nStartAng + nAngleDiff) % 36000; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ nAngleDiff = (nEndAng - nStartAng) / 2; +/*?*/ nAngleHook = nStartAng + nAngleDiff; +/*?*/ } +/*?*/ +/*?*/ // set the text position according to the position of the pie +/*?*/ if (nStartAng < 9000) +/*?*/ { +/*?*/ long nAngle = nAngleDiff + nStartAng; +/*?*/ +/*?*/ aCircPos.X() += (long) (SCH_COS( nAngle ) * fSegShift); +/*?*/ aCircPos.Y() -= (long) (SCH_SIN( nAngle ) * fSegShift); +/*?*/ } +/*?*/ else if (nStartAng < 18000) +/*?*/ { +/*?*/ long nAngle = nAngleDiff + (nStartAng - 9000); +/*?*/ +/*?*/ aCircPos.X() -= (long) (SCH_SIN( nAngle ) * fSegShift); +/*?*/ aCircPos.Y() -= (long) (SCH_COS( nAngle ) * fSegShift); +/*?*/ } +/*?*/ else if (nStartAng < 27000) +/*?*/ { +/*?*/ long nAngle = nAngleDiff + (nStartAng - 18000); +/*?*/ +/*?*/ aCircPos.X() -= (long) (SCH_COS( nAngle ) * fSegShift); +/*?*/ aCircPos.Y() += (long) (SCH_SIN( nAngle ) * fSegShift); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ long nAngle = nAngleDiff + (nStartAng - 27000); +/*?*/ +/*?*/ aCircPos.X() += (long) (SCH_SIN( nAngle ) * fSegShift); +/*?*/ aCircPos.Y() += (long) (SCH_COS( nAngle ) * fSegShift); +/*?*/ } +/*?*/ +/*?*/ aCircRect.SetPos(aCircPos); +/*?*/ } +/*N*/ +/*N*/ // pies and description are not grouped +/*N*/ if( fData > 0 ) +/*N*/ { +/*N*/ SdrObject* pObj = CreatePieSegment( aDataPointAttr, aCircRect, nCol, nRow, +/*N*/ nStartAng, nEndAng, GetColCount() ); +/*N*/ pObj->SetMoveProtect( FALSE ); // bm allow dragging pies +/*N*/ pList->NbcInsertObject( pObj ); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ else if( pDescription ) +/*N*/ { +/*?*/ pDescription[ nIndex ].fValue = DBL_MIN; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(pDescrGroup) +/*?*/ pList->NbcInsertObject(pDescrGroup); +/*N*/ +/*N*/ pGroup->GetSubList ()->SetRectsDirty (); +/*N*/ +/*N*/ // resize of pie charts is allowed proportionally only +/*N*/ SdrObjTransformInfoRec aInfo; +/*N*/ aInfo.bResizeFreeAllowed = FALSE; +/*N*/ aInfo.bResizePropAllowed = TRUE; +/*N*/ aInfo.bRotateFreeAllowed = FALSE; +/*N*/ aInfo.bRotate90Allowed = FALSE; +/*N*/ aInfo.bMirrorFreeAllowed = FALSE; +/*N*/ aInfo.bMirror45Allowed = FALSE; +/*N*/ aInfo.bMirror90Allowed = FALSE; +/*N*/ aInfo.bShearAllowed = FALSE; +/*N*/ pGroup->SetObjInfo(aInfo); +/*N*/ +/*N*/ Dirty2D (1, nColCnt, &pDescrList, FALSE, pDescription); +/*N*/ +/*N*/ delete[] pDescription; +/*N*/ +/*N*/ return pGroup; +/*N*/ } +/************************************************************************* +|* +|* Donutdiagramm erzeugen +|* +\************************************************************************/ +/*N*/ SdrObjGroup* ChartModel::Create2DDonutChart(Rectangle aRect) +/*N*/ { +/*N*/ SchObjGroup *pGroup; +/*N*/ SdrObjList *pList; +/*N*/ +/*N*/ CreateChartGroup (pGroup, pList); +/*N*/ +/*N*/ long nCol; +/*N*/ long nRow; +/*N*/ +/*N*/ long nColCnt = GetColCount() ; +/*N*/ long nRowCnt = GetRowCount() ; +/*N*/ +/*N*/ double *pTotal = new double [nColCnt]; +/*N*/ SdrObjList **pRowLists = new SdrObjList* [nRowCnt]; +/*N*/ SdrObjList **pDescrLists = new SdrObjList* [nRowCnt]; +/*N*/ DataDescription* pDescription = NULL; +/*N*/ Size aDescrOfs; +/*N*/ +/*N*/ // Donut charts may not have titles of axes. +/*N*/ bShowXAxisTitle = FALSE; +/*N*/ bShowYAxisTitle = FALSE; +/*N*/ bShowZAxisTitle = FALSE; +/*N*/ +/*N*/ SchObjGroup** pDescrGroups=new SchObjGroup*[nRowCnt]; +/*N*/ for(nRow=0;nRow<nRowCnt;nRow++) +/*N*/ pDescrGroups[nRow]=NULL; +/*N*/ +/*N*/ //Summiere ueber alle Elemente der gleichen Spalte (nicht Reihe!), +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ pTotal [nCol] = 0.0; +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ double fData = GetData (nCol, nRow); +/*N*/ if (fData != DBL_MIN) pTotal [nCol] += fabs(fData); +/*N*/ } +/*N*/ } + + // FG: 22.3.97 Als erstes wird der Platzbedarf der Beschriftung berechnet. + // Bei diesem Chart-Typ ist die Beschriftung mit in die Berechnung der + // Chartgroesse einbezogen worden. +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ SchObjGroup *pRowGroup = (SchObjGroup*) CreateSimpleGroup (CHOBJID_DIAGRAM_ROWGROUP, TRUE, TRUE); +/*N*/ BOOL bInserted = FALSE; +/*N*/ +/*N*/ pRowGroup->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ pList->NbcInsertObject(pRowGroup); +/*N*/ pRowLists[nRow] = pRowGroup->GetSubList(); +/*N*/ pDescrLists[nRow] = 0; +/*N*/ +/*N*/ // ******************** Data Descriptions erstellen ****************************** +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ SfxItemSet aDataPointAttr(GetFullDataPointAttr(nCol, nRow)); +/*N*/ double fData = GetData (nCol, nRow); +/*N*/ long nIndex = nCol + nRow * nColCnt; +/*N*/ +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ if( (eDescr != CHDESCR_NONE) && bShowDataDescr) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 + /************************************************************** + * DataDescription erforderlich + **************************************************************/ +/*N*/ } +/*N*/ } //*************************** END DESCRIPTIONS *********************************** +/*N*/ }//End for nRow + + // Das Rechteck wird dann etwas kleiner, da Text ausgegeben wird +/*N*/ if (pDescription) +/*N*/ { +/*?*/ aRect.Left() += aDescrOfs.Width(); +/*?*/ aRect.Top() += aDescrOfs.Height(); +/*?*/ aRect.Right() -= aDescrOfs.Width(); +/*?*/ aRect.Bottom() -= aDescrOfs.Height(); +/*?*/ +/*?*/ // prozentual verkleinern wir es noch etwas, um einen Offset zum Text zu bekommen +/*?*/ long nWidth = (aRect.GetWidth () * 1) / 20; +/*?*/ long nHeight = (aRect.GetHeight () * 1) / 20; +/*?*/ +/*?*/ aRect.Left () += nWidth; +/*?*/ aRect.Right () -= nWidth; +/*?*/ aRect.Top () += nHeight; +/*?*/ aRect.Bottom () -= nHeight; +/*N*/ } + +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ Size aPageSize = pPage->GetSize(); +/*N*/ if (GetDiagramHasBeenMovedOrResized() && (aInitialSize != aPageSize)) +/*N*/ { // in dem Fall hat ein Resize stattgefunden +/*?*/ if (aInitialSize.Width() > aPageSize.Width()) +/*?*/ { +/*?*/ if (aRect.GetWidth() > aRect.GetHeight()) +/*?*/ { +/*?*/ aRect.Left() += (aRect.GetWidth() - aRect.GetHeight()) / 2; +/*?*/ aRect.Right() = aRect.Left() + aRect.GetHeight(); +/*?*/ } +/*?*/ else if (aRect.GetHeight() > aRect.GetWidth()) +/*?*/ { +/*?*/ aRect.Top() += (aRect.GetHeight() - aRect.GetWidth()) / 2; +/*?*/ aRect.Bottom() = aRect.Top() + aRect.GetWidth(); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ if (aInitialSize.Height() > aPageSize.Height()) +/*?*/ { +/*?*/ if (aRect.GetWidth() > aRect.GetHeight()) +/*?*/ { +/*?*/ aRect.Left() += (aRect.GetWidth() - aRect.GetHeight()) / 2; +/*?*/ aRect.Right() = aRect.Left() + aRect.GetHeight(); +/*?*/ } +/*?*/ else if (aRect.GetHeight() > aRect.GetWidth()) +/*?*/ { +/*?*/ aRect.Top() += (aRect.GetHeight() - aRect.GetWidth()) / 2; +/*?*/ aRect.Bottom() = aRect.Top() + aRect.GetWidth(); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ if (aRect.GetWidth() > aRect.GetHeight()) +/*?*/ { +/*?*/ aRect.Top() += (aRect.GetHeight() - aRect.GetWidth()) / 2; +/*?*/ aRect.Bottom() = aRect.Top() + aRect.GetWidth(); +/*?*/ } +/*?*/ else if (aRect.GetHeight() > aRect.GetWidth()) +/*?*/ { +/*?*/ aRect.Left() += (aRect.GetWidth() - aRect.GetHeight()) / 2; +/*?*/ aRect.Right() = aRect.Left() + aRect.GetHeight(); +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ else // ************* nicht gemoved oder resized ***************************** +/*N*/ { +/*N*/ // FG: Hier wird dafuer gesorgt, dass die Chart-Groesse immer ein Rechteck ist. +/*N*/ if (aRect.GetWidth() > aRect.GetHeight()) +/*N*/ { +/*N*/ aRect.Left() += (aRect.GetWidth() - aRect.GetHeight()) / 2; +/*N*/ aRect.Right() = aRect.Left() + aRect.GetHeight(); +/*N*/ } +/*N*/ else if (aRect.GetHeight() > aRect.GetWidth()) +/*N*/ { +/*?*/ aRect.Top() += (aRect.GetHeight() - aRect.GetWidth()) / 2; +/*?*/ aRect.Bottom() = aRect.Top() + aRect.GetWidth(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ ULONG nSegWidth = (aRect.Right() - aRect.Left()) / (2 * (nColCnt + 1)); +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) //alle Ringe des Donuts +/*N*/ { +/*N*/ long nStartAng, nEndAng = 9000; //90 Grad +/*N*/ +/*N*/ double fTotal = pTotal[nCol]; +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) //Alle Datenreihen +/*N*/ { +/*N*/ nStartAng = nEndAng; +/*N*/ SfxItemSet aDataPointAttr(GetFullDataPointAttr(nCol, nRow)); +/*N*/ long nIndex = nCol + nRow * nColCnt;// long nIndex = nRow + nRowCnt * nCol ; +/*N*/ +/*N*/ +/*N*/ double fData = fabs(GetData(nCol, nRow)); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ //letzte Datenreihe ?? (eigentlich Unsinn, nur wegen evtl. Rundungsfehler notwendig? +/*N*/ if (nRow == nRowCnt - 1) +/*N*/ { +/*N*/ nEndAng = 9000; +/*N*/ } +/*N*/ else if (fTotal != 0.0) +/*N*/ { +/*N*/ nEndAng += (long)((fData / fTotal) * 36000); +/*N*/ } +/*N*/ +/*N*/ Rectangle aCircRect = aRect; +/*N*/ +/*N*/ if( fData > 0.0 ) +/*N*/ // Die Segmente einer Reihe werden nicht gruppiert! +/*N*/ // Diese Ausnahme besteht, da sonst eine Reihe Segmente anderer Reihen +/*N*/ // verdeckt (Gruppenobjekte koennen nicht ineinnander greifen (Problem +/*N*/ // des Drawinglayer), vorher: pRowLists[nRow]-> ... +/*N*/ pList->NbcInsertObject( CreateDonutSegment( aDataPointAttr, +/*N*/ aCircRect, nSegWidth, +/*N*/ nCol, nRow, +/*N*/ nStartAng, nEndAng, nRowCnt)); +/*N*/ +/*N*/ } +/*N*/ else if (pDescription) +/*N*/ { +/*N*/ pDescription [nIndex].fValue = DBL_MIN; +/*N*/ } +/*N*/ +/*N*/ }//Alle Datenreihen +/*N*/ +/*N*/ //Jetzt wird die Flaeche verkleinert, um den naechst-inneren Pie zu zeichnen, +/*N*/ //Ein Donut ist nichts anderes als ein Tuerme-von-Hanoi artiger Pie-Stapel +/*N*/ aRect.Left() += nSegWidth; +/*N*/ aRect.Top() += nSegWidth; +/*N*/ aRect.Right() -= nSegWidth; +/*N*/ aRect.Bottom() -= nSegWidth; +/*N*/ }//Alle Ringe +/*N*/ +/*N*/ const XFillStyleItem &rFillStyleItem = (const XFillStyleItem &) pDiagramAreaAttr->Get (XATTR_FILLSTYLE); +/*N*/ SfxItemSet aAreaAttr (*pDiagramAreaAttr); +/*N*/ +/*N*/ if (rFillStyleItem.GetValue () == XFILL_NONE) +/*N*/ { +/*N*/ aAreaAttr.Put(XFillStyleItem(XFILL_SOLID)); +/*N*/ aAreaAttr.Put(XFillColorItem(String(), RGBColor(COL_WHITE))); +/*N*/ } +/*N*/ +/*N*/ aAreaAttr.Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ aAreaAttr.Put(XLineWidthItem(0)); +/*N*/ aAreaAttr.Put(XLineColorItem(String(), RGBColor(COL_BLACK))); +/*N*/ +/*N*/ SdrCircObj* pCirc = new SdrCircObj(OBJ_CIRC, aRect); +/*N*/ pList->NbcInsertObject(SetObjectAttr( pCirc, CHOBJID_DIAGRAM_AREA, TRUE, TRUE, &aAreaAttr)); +/*N*/ +/*N*/ //Descriptions zuletzt, da sie sonst verdeckt sind! +/*N*/ for(nRow=0;nRow<nRowCnt;nRow++) +/*N*/ { +/*N*/ if(pDescrGroups[nRow]) +/*N*/ { +/*?*/ pList->NbcInsertObject(pDescrGroups[nRow]); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pGroup->GetSubList()->SetRectsDirty(); +/*N*/ +/*N*/ // Ein Kreisdiagramm soll man nur proportional Resizen koennen (vorerst) +/*N*/ SdrObjTransformInfoRec aInfo; +/*N*/ aInfo.bResizeFreeAllowed = FALSE; +/*N*/ aInfo.bResizePropAllowed = TRUE; +/*N*/ aInfo.bRotateFreeAllowed = FALSE; +/*N*/ aInfo.bRotate90Allowed = FALSE; +/*N*/ aInfo.bMirrorFreeAllowed = FALSE; +/*N*/ aInfo.bMirror45Allowed = FALSE; +/*N*/ aInfo.bMirror90Allowed = FALSE; +/*N*/ aInfo.bShearAllowed = FALSE; +/*N*/ pGroup->SetObjInfo(aInfo); +/*N*/ +/*N*/ Dirty2D (nRowCnt, nColCnt, pDescrLists, TRUE, pDescription); +/*N*/ +/*N*/ delete[] pTotal; +/*N*/ delete[] pDescription; +/*N*/ delete[] pDescrLists; +/*N*/ delete[] pRowLists; +/*N*/ delete[] pDescrGroups; +/*N*/ +/*N*/ +/*N*/ return pGroup; +/*N*/ } +/************************************************************************* +|* +|* XY-Diagramm erzeugen +|* +\************************************************************************/ +/*N*/ SdrObjGroup* ChartModel::Create2DXYChart(Rectangle aRect) +/*N*/ { +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ +/*N*/ long nCol, nRow; +/*N*/ +/*N*/ // ask for sorting +/*N*/ +/*N*/ BOOL bSortTable = FALSE; +/*N*/ BOOL bRepaint = FALSE; + +/*N*/ if( IsXYChart() && ! ISFLAGSET( nChartStatus, CHS_USER_NOQUERY ) ) // in this case ask for sorting +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*N*/ +/*N*/ SchObjGroup *pGroup; +/*N*/ SdrObjList *pList; +/*N*/ SdrObject *pObj; +/*N*/ SdrPathObj *pLineObject = NULL; +/*N*/ +/*N*/ CreateChartGroup (pGroup, pList); +/*N*/ +/*N*/ SdrPage* pPage = GetPage(0); +/*N*/ +/*N*/ Create2DBackplane(aRect, *pList, TRUE,CHSTACK_NONE); +/*N*/ +/*N*/ SdrObjList ** pRowLists = new SdrObjList*[nRowCnt]; +/*N*/ SdrObjList ** pStatLists = new SdrObjList*[nRowCnt]; +/*N*/ Size aLegendSize (((SvxFontWidthItem &) pLegendAttr->Get (EE_CHAR_FONTWIDTH)).GetWidth (), +/*N*/ ((SvxFontHeightItem &) pLegendAttr->Get (EE_CHAR_FONTHEIGHT)).GetHeight ()); +/*N*/ +/*N*/ +/*N*/ ChartDataDescription aDescr(nColCnt,nRowCnt,pList,this,bShowDataDescr); + + //#54884# Was soll das hier? //Create2DXYChart +/*N*/ OutputDevice * pRefDev = GetRefDevice(); +/*N*/ if(pRefDev) +/*N*/ aLegendSize = pRefDev->PixelToLogic (pRefDev->LogicToPixel (aLegendSize)); +/*N*/ else +/*N*/ DBG_ERROR("ChartModel: no RefDevice"); +/*N*/ +/*N*/ long nLegendHeight = aLegendSize.Height () * 9 / 10; +/*N*/ +/*N*/ pRowLists [0] = +/*N*/ pStatLists [0] = 0; +/*N*/ +/*N*/ XPolygon aPolygon ((unsigned short)nColCnt); +/*N*/ ::std::vector< ::std::pair< double, double > > aSplinePoints; +/*N*/ bool bIsSplineChart = ( IsSplineChart() != FALSE ); +/*N*/ +/*N*/ SfxItemSet aLineAttr(*pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST, 0); +/*N*/ +/*N*/ ChartAxis* pAxis=pChartYAxis; +/*N*/ BOOL bLogarithmY = pAxis->IsLogarithm(); +/*N*/ BOOL bLogarithmX = pChartXAxis->IsLogarithm(); +/*N*/ +/*N*/ // for some reason the ChartRect is one pixel too small +/*N*/ Rectangle aClipRect( aRect ); +/*N*/ aClipRect.Right() += 1; +/*N*/ aClipRect.Top() -= 1; +/*N*/ +/*N*/ // Iterate in reverse order over the data series so that the first one is displayed +/*N*/ // in the front and the last one in the back. +/*N*/ for( nRow = nRowCnt-1; nRow >= 1; nRow-- ) +/*N*/ { +/*N*/ SchObjGroup* pRowGroup = (SchObjGroup*) CreateSimpleGroup (CHOBJID_DIAGRAM_ROWGROUP, TRUE, TRUE); +/*N*/ +/*N*/ pRowGroup->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ pList->NbcInsertObject(pRowGroup); +/*N*/ pRowLists[nRow] = pRowGroup->GetSubList(); +/*N*/ +/*N*/ SchObjGroup* pStatGroup = (SchObjGroup*) CreateSimpleGroup (CHOBJID_DIAGRAM_STATISTICS_GROUP, TRUE, TRUE); +/*N*/ +/*N*/ pStatGroup->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ pList->NbcInsertObject(pStatGroup); +/*N*/ pStatLists [nRow] = pStatGroup->GetSubList (); +/*N*/ +/*N*/ const SfxItemSet& rDataRowAttr = GetDataRowAttr(nRow); +/*N*/ +/*N*/ pAxis=GetAxisByUID(((const SfxInt32Item&)rDataRowAttr.Get(SCHATTR_AXIS)).GetValue()); +/*N*/ bLogarithmY = pAxis->IsLogarithm(); +/*N*/ +/*N*/ long nPoints = 0; +/*N*/ pLineObject = NULL; +/*N*/ + if( ((const SfxBoolItem &) rDataRowAttr.Get( SCHATTR_STAT_AVERAGE )).GetValue() ) +// pStatLists[ nRow ]->NbcInsertObject( AverageValueY( nRow, FALSE, aRect, + {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pList->NbcInsertObject( AverageValueY( nRow, FALSE, aRect, + +/*N*/ aSplinePoints.clear(); +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ SfxItemSet aDataPointAttr(rDataRowAttr);//#63904# +/*N*/ MergeDataPointAttr(aDataPointAttr,nCol,nRow); +/*N*/ +/*N*/ Point aPoint; +/*N*/ double fDataY = GetData(nCol, nRow, FALSE); +/*N*/ double fDataX = GetData(nCol, 0, FALSE); +/*N*/ +/*N*/ if (((fDataX != DBL_MIN) && (!bLogarithmX || bLogarithmX && (fDataX > 0.0))) && +/*N*/ ((fDataY != DBL_MIN) && (!bLogarithmY || bLogarithmY && (fDataY > 0.0)))) +/*N*/ { +/*N*/ long nXPos = pChartXAxis->GetPos(fDataX); +/*N*/ long nYPos = pAxis->GetPos(fDataY); +/*N*/ +/*N*/ // expect nPoints to be 0 on first entry of the for loop +/*N*/ // insert the empty polygon now, so that symbols are painted over the line +/*N*/ if( nPoints == 0 && +/*N*/ IsLine( nRow )) +/*N*/ { +/*N*/ XPolyPolygon aSeriesPoly; +/*N*/ pLineObject = new SdrPathObj( OBJ_PLIN, aSeriesPoly ); +/*N*/ pRowLists[ nRow ]->NbcInsertObject( pLineObject); +/*N*/ } +/*N*/ aPolygon [(USHORT) nPoints].X () = nXPos; +/*N*/ aPolygon [(USHORT) nPoints].Y () = nYPos; +/*N*/ if( bIsSplineChart ) +/*N*/ { +/*N*/ aSplinePoints.push_back( +/*N*/ ::std::pair< double, double >( +/*N*/ static_cast< double >( nXPos ), +/*N*/ static_cast< double >( nYPos ))); +/*N*/ } +/*N*/ nPoints ++; +/*N*/ +/*N*/ aPoint.X () = nXPos; +/*N*/ aPoint.Y () = nYPos; +/*N*/ +/*N*/ // draw symbols only if they are contained in the diagrams boundrect +/*N*/ if( aClipRect.IsInside( aPoint ) ) +/*N*/ { +/*N*/ if(HasSymbols(nRow)) +/*N*/ { +/*N*/ pObj = CreateSymbol (aPoint, nRow, nCol, aDataPointAttr, nLegendHeight); +/*N*/ if(pObj) +/*N*/ { +/*N*/ pObj->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM_DATA)); +/*N*/ pRowLists[nRow]->NbcInsertObject(pObj); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ((SvxChartKindError) +/*?*/ ((const SfxInt32Item &) aDataPointAttr.Get (SCHATTR_STAT_KIND_ERROR)).GetValue () != CHERROR_NONE) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 AverageErrorY(nRow,fDataY,aPoint,FALSE,aDataPointAttr,pStatLists[nRow],pAxis); +/*N*/ +/*N*/ if(aDescr.Enabled()) +/*N*/ { +/*N*/ Point aPos(aPolygon[(USHORT)nPoints-1]); +/*N*/ aPos.Y () -= 150; +/*N*/ aDescr.Insert(nCol,nRow,aDataPointAttr,aPos,FALSE,CHADJUST_BOTTOM_CENTER,pAxis); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(nPoints && IsLine(nRow)) +/*N*/ { +/*N*/ aPolygon.SetPointCount( nPoints ); +/*N*/ +/*N*/ // clear old items from last loop pass +/*N*/ aLineAttr.ClearItem(); +/*N*/ aLineAttr.Put(rDataRowAttr); +/*N*/ +/*N*/ if( nPoints > 1 ) +/*N*/ { +/*N*/ XPolyPolygon aSeriesPoly; +/*N*/ +/*N*/ if( bIsSplineChart ) +/*N*/ { +/*?*/ if ((eChartStyle == CHSTYLE_2D_CUBIC_SPLINE_XY) || (eChartStyle == CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY)) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ XPolygon aMeshPoly; +/*?*/ approxMesh( nGranularity, aMeshPoly, aPolygon, nPoints - 1, nSplineDepth ); +/*?*/ SchCalculationHelper::IntersectPolygonWithRectangle( +/*?*/ aMeshPoly, aClipRect, aSeriesPoly ); +/*?*/ } +/*?*/ +/*?*/ if( pLineObject ) +/*?*/ pLineObject->NbcSetPathPoly( aSeriesPoly ); +/*?*/ else +/*?*/ { +/*?*/ pLineObject = new SdrPathObj( OBJ_PLIN, aSeriesPoly ); +/*?*/ pRowLists[ nRow ]->NbcInsertObject( pLineObject); +/*?*/ } +/*?*/ } +/*N*/ else // series consits of lines +/*N*/ { +/*N*/ SchCalculationHelper::IntersectPolygonWithRectangle( aPolygon, aClipRect, aSeriesPoly ); +/*N*/ +/*N*/ if( pLineObject ) +/*N*/ pLineObject->NbcSetPathPoly( aSeriesPoly ); +/*N*/ else +/*N*/ { +/*?*/ pLineObject = new SdrPathObj( OBJ_PLIN, aSeriesPoly ); +/*?*/ pRowLists[ nRow ]->NbcInsertObject( pLineObject); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pLineObject->InsertUserData( new SchObjectId( CHOBJID_DIAGRAM_ROWSLINE )); +/*N*/ pLineObject->InsertUserData( new SchDataRow( (short)nRow )); +/*N*/ +//-/ pObj->NbcSetAttributes( aLineAttr, FALSE ); +/*N*/ pLineObject->SetItemSet( aLineAttr); +/*N*/ +/*N*/ } +/*N*/ } + + // insert regression curve if necessary + // ------------------------------------ +/*N*/ if (((const SfxInt32Item &) rDataRowAttr.Get (SCHATTR_STAT_REGRESSTYPE)).GetValue () != CHREGRESS_NONE) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 double fConst; +/*N*/ } +/*N*/ } + +/*N*/ aDescr.Build(TRUE); +/*N*/ +/*N*/ if( bRepaint ) +/*?*/ pPage->SendRepaintBroadcast(); +/*N*/ +/*N*/ delete[] pRowLists; +/*N*/ delete[] pStatLists; +/*N*/ return pGroup; +/*N*/ } + + +/************************************************************************* +|* +|* Netzdiagramm erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjGroup* ChartModel::Create2DNetChart(Rectangle aRect) +/*N*/ { +/*N*/ //vorlaeufiger Hack, bis logarithmus-Ueberpruefung eingebaut (autokorrektur): +/*N*/ pChartXAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM,FALSE)); +/*N*/ pChartYAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM,FALSE)); +/*N*/ +/*N*/ //ToDo: vorlaeufig +/*N*/ SfxItemSet* pYAxisAttr=&GetAttr(CHOBJID_DIAGRAM_Y_AXIS); +/*N*/ +/*N*/ SchObjGroup *pGroup; +/*N*/ SdrObjList *pList; +/*N*/ SdrObject *pObj; +/*N*/ +/*N*/ CreateChartGroup (pGroup, pList); +/*N*/ +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ long nCol, nRow; +/*N*/ +/*N*/ BOOL bPercent = IsPercent(); +/*N*/ BOOL bStacked = IsStacked(); +/*N*/ +/*N*/ // bPercent => bStacked ... ersetzt: (bPercent || bStacked) durch bStacked +/*N*/ USHORT eStackMode = bStacked ? CHSTACK_MINMAX : CHSTACK_NONE; +/*N*/ +/*N*/ Size aYDescrSize; +/*N*/ SdrObjList ** pRowLists = new SdrObjList*[nRowCnt]; +/*N*/ SdrObjList ** pDescrLists = new SdrObjList*[nRowCnt]; +/*N*/ DataDescription* pDescription = NULL; +/*N*/ SdrObjList *pYAxisList = pChartYAxis->IsVisible() +/*N*/ ? CreateGroup (*pList, CHOBJID_DIAGRAM_Y_AXIS, 0) +/*N*/ : NULL; +/*N*/ SdrObjList *pXGridMainList = bShowXGridMain +/*N*/ ? CreateGroup (*pList, CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP, 0) +/*N*/ : 0; +/*N*/ SdrObjList *pXGridHelpList = bShowXGridHelp +/*N*/ ? CreateGroup (*pList, CHOBJID_DIAGRAM_X_GRID_HELP_GROUP, 0) +/*N*/ : 0; +/*N*/ +/*N*/ XPolygon aDataLine (nColCnt + 1); +/*N*/ SfxItemSet aLineAttr(*pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST, 0); +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTextWhichPairs); +/*N*/ aTextAttr.Put(*pYAxisAttr); +/*N*/ +/*N*/ if (aRect.GetWidth() > aRect.GetHeight()) +/*N*/ { +/*N*/ aRect.Left() += (aRect.GetWidth() - aRect.GetHeight()) / 2; +/*N*/ aRect.Right() = aRect.Left() + aRect.GetHeight(); +/*N*/ } +/*N*/ else if (aRect.GetHeight() > aRect.GetWidth()) +/*N*/ { +/*?*/ aRect.Top() += (aRect.GetHeight() - aRect.GetWidth()) / 2; +/*?*/ aRect.Bottom() = aRect.Top() + aRect.GetWidth(); +/*N*/ } + +/*N*/ if (pChartYAxis->HasDescription()) +/*N*/ { +/*N*/ aYDescrSize = Size (((SvxFontWidthItem &) pYAxisTitleAttr->Get (EE_CHAR_FONTWIDTH)).GetWidth (), +/*N*/ ((SvxFontHeightItem &) pYAxisTitleAttr->Get (EE_CHAR_FONTHEIGHT)).GetHeight ()); +/*N*/ +/*N*/ aRect.Bottom () -= (aYDescrSize.Height () * 12) / 5; +/*N*/ aRect.Top () += (aYDescrSize.Height () * 12) / 5; +/*N*/ } + +/*N*/ long nLength = aRect.GetHeight () / 2; +/*N*/ long nOffsetX = aRect.Left () + aRect.GetWidth () / 2; +/*N*/ long nOffsetY = aRect.Top () + aRect.GetHeight () / 2; +/*N*/ double fAngleStep = F_PI * 2 / nColCnt; +/*N*/ long aOldPos = 0; + + +/*N*/ BOOL bSwitchColRow=IsDataSwitched(); +/*N*/ pChartYAxis->Initialise(aRect,bSwitchColRow,eStackMode,bPercent,TRUE); +/*N*/ pChartYAxis->CalcValueSteps(); +/*N*/ +/*N*/ Size aMaxValueSizeY = pChartYAxis->CalcMaxTextSize(CHTXTORIENT_STANDARD); +/*N*/ //nur zu test zwecken +/*N*/ +/*N*/ XPolygon aLine (2); +/*N*/ double fSteps = pChartYAxis->GetMax(); +/*N*/ double* fOldData = new double[nColCnt]; +/*N*/ double fAngle = F_PI / 2; +/*N*/ +/*N*/ Size aLegendSize (((SvxFontWidthItem &) pLegendAttr->Get (EE_CHAR_FONTWIDTH)).GetWidth (), +/*N*/ ((SvxFontHeightItem &) pLegendAttr->Get (EE_CHAR_FONTHEIGHT)).GetHeight ()); +/*N*/ +/*N*/ //#54884# Was soll das hier? Create2DNetChart +/*N*/ OutputDevice * pRefDev = GetRefDevice(); +/*N*/ if(pRefDev) +/*N*/ aLegendSize = pRefDev->PixelToLogic (pRefDev->LogicToPixel (aLegendSize)); +/*N*/ else +/*?*/ DBG_ERROR("ChartModel: no RefDevice"); +/*N*/ +/*N*/ long nLegendHeight = aLegendSize.Height () * 9 / 10; +/*N*/ +/*N*/ if (pChartYAxis->HasDescription()) +/*N*/ while (fSteps >= pChartYAxis->GetMin()) +/*N*/ { +/*N*/ double fLength = nLength * pChartYAxis->CalcFact(fSteps); +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fCos = cos (fAngle); +/*N*/ double fSin = sin (fAngle); +/*N*/ +/*N*/ aLine [1].X () = (long) (nOffsetX + fLength * fCos + nMarkLen * fSin); +/*N*/ aLine [1].Y () = (long) (nOffsetY - fLength * fSin + nMarkLen * fCos); +/*N*/ aLine [0].X () = (long) (nOffsetX + fLength * fCos - nMarkLen * fSin); +/*N*/ aLine [0].Y () = (long) (nOffsetY - fLength * fSin - nMarkLen * fCos); +/*N*/ +/*N*/ pYAxisList->NbcInsertObject(SetObjectAttr (new SdrPathObj(OBJ_PLIN, aLine), CHOBJID_LINE, +/*N*/ TRUE, TRUE, pAxisAttr)); +/*N*/ +/*N*/ if (fSteps == pChartYAxis->GetMax()) +/*N*/ { +/*N*/ Point aTextPos ((long) (nOffsetX + nLength * fCos), +/*N*/ (long) (nOffsetY - nLength * fSin)); +/*N*/ ChartAdjust eAdjust; +/*N*/ +/*N*/ if (fAngle > 0 && fAngle < F_PI / 4) +/*N*/ { +/*?*/ eAdjust = CHADJUST_CENTER_LEFT; +/*?*/ aTextPos.X () = (long) (nOffsetX + nLength * fCos + (aYDescrSize.Height () * 6) / 5); +/*N*/ } +/*N*/ else if (fAngle >= F_PI / 4 && fAngle <= 3 * F_PI / 4) +/*N*/ { +/*N*/ eAdjust = CHADJUST_BOTTOM_CENTER; +/*N*/ aTextPos.Y () = (long) (nOffsetY - nLength * fSin - (aYDescrSize.Height () * 6) / 5); +/*N*/ } +/*N*/ else if (fAngle > 3 * F_PI / 4 && fAngle <= 5 * F_PI / 4) +/*N*/ { +/*N*/ eAdjust = CHADJUST_CENTER_RIGHT; +/*N*/ aTextPos.X () = (long) (nOffsetX + nLength * fCos - (aYDescrSize.Height () * 6) / 5); +/*N*/ } +/*N*/ else if (fAngle > 5 * F_PI / 4 && fAngle <= 7 * F_PI / 4) +/*N*/ { +/*N*/ eAdjust = CHADJUST_TOP_CENTER; +/*N*/ aTextPos.Y () = (long) (nOffsetY - nLength * fSin + (aYDescrSize.Height () * 6) / 5); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ eAdjust = CHADJUST_CENTER_LEFT; +/*N*/ aTextPos.X () = (long) (nOffsetX + nLength * fCos + (aYDescrSize.Height () * 6) / 5); +/*N*/ } +/*N*/ +/*N*/ pYAxisList->NbcInsertObject(CreateTextObj(CHOBJID_TEXT, aTextPos, +/*N*/ ColText(nCol), +/*N*/ aTextAttr, +/*N*/ FALSE, eAdjust)); +/*N*/ } +/*N*/ +/*N*/ fAngle += fAngleStep; +/*N*/ } +/*N*/ +/*N*/ if (pChartYAxis->HasDescription()) +/*N*/ { +/*N*/ Color* pDummy = NULL; +/*N*/ String aNumStr; +/*N*/ Point aPos; +/*N*/ +/*N*/ pNumFormatter->GetOutputString((bPercent)?fSteps/100.0:fSteps, +/*N*/ GetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,bPercent),aNumStr,&pDummy); +/*N*/ +/*N*/ aPos.X() = (long) (nOffsetX + nMarkLen); +/*N*/ aPos.Y() = (long) (nOffsetY - fLength); +/*N*/ +/*N*/ if (aPos.Y () - aMaxValueSizeY.Height () > aOldPos) +/*N*/ { +/*N*/ pYAxisList->NbcInsertObject(CreateTextObj(CHOBJID_TEXT, aPos, aNumStr, +/*N*/ aTextAttr, FALSE, CHADJUST_CENTER_LEFT)); +/*N*/ aOldPos = aPos.Y (); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (pXGridMainList) +/*N*/ { +/*N*/ Rectangle aCircRect ((long) (nOffsetX - fLength), +/*N*/ (long) (nOffsetY - fLength), +/*N*/ (long) (nOffsetX + fLength), +/*N*/ (long) (nOffsetY + fLength)); +/*N*/ +/*N*/ SfxItemSet aCircAttr (*pItemPool, +/*N*/ XATTR_LINE_FIRST, XATTR_LINE_LAST, +/*N*/ XATTR_FILL_FIRST, XATTR_FILL_LAST, +/*N*/ 0); +/*N*/ +/*N*/ aCircAttr.Put (XLineColorItem (String (), +/*N*/ ((XLineColorItem &) pXGridMainAttr->Get (XATTR_LINECOLOR)).GetValue ())); +/*N*/ aCircAttr.Put (XFillColorItem (String (), +/*N*/ ((XFillColorItem &) pXGridMainAttr->Get (XATTR_FILLCOLOR)).GetValue ())); +/*N*/ aCircAttr.Put (XLineStyleItem (((XLineStyleItem &) pXGridMainAttr->Get (XATTR_LINESTYLE)). +/*N*/ GetValue ())); +/*N*/ aCircAttr.Put (XLineWidthItem (((XLineWidthItem &) pXGridMainAttr->Get (XATTR_LINEWIDTH)). +/*N*/ GetValue ())); +/*N*/ aCircAttr.Put (XFillStyleItem(XFILL_NONE)); +/*N*/ SdrCircObj* pCirc = new SdrCircObj( OBJ_CIRC, aCircRect ); +/*N*/ pCirc->SetModel( this ); +/*N*/ pXGridMainList->NbcInsertObject(SetObjectAttr( pCirc, +/*N*/ CHOBJID_DIAGRAM_NET, TRUE, TRUE, +/*N*/ &aCircAttr)); +/*N*/ } +/*N*/ +/*N*/ DecValue(fSteps, pChartYAxis->GetStep(), FALSE); +/*N*/ +/*N*/ if (pChartYAxis->GetStep() == 0.0) break; +/*N*/ } +/*N*/ +/*N*/ fSteps = pChartYAxis->GetMax(); +/*N*/ +/*N*/ if (pXGridHelpList) +/*?*/ while (fSteps >= pChartYAxis->GetMin()) +/*?*/ { +/*?*/ double fLength = nLength * pChartYAxis->CalcFact(fSteps); +/*?*/ +/*?*/ Rectangle aCircRect ((long) (nOffsetX - fLength), +/*?*/ (long) (nOffsetY - fLength), +/*?*/ (long) (nOffsetX + fLength), +/*?*/ (long) (nOffsetY + fLength)); +/*?*/ +/*?*/ SfxItemSet aCircAttr (*pItemPool, +/*?*/ XATTR_LINE_FIRST, XATTR_LINE_LAST, +/*?*/ XATTR_FILL_FIRST, XATTR_FILL_LAST, +/*?*/ 0); +/*?*/ +/*?*/ aCircAttr.Put (XLineColorItem (String (), +/*?*/ ((XLineColorItem &) pXGridHelpAttr->Get (XATTR_LINECOLOR)).GetValue ())); +/*?*/ aCircAttr.Put (XFillColorItem (String (), +/*?*/ ((XFillColorItem &) pXGridHelpAttr->Get (XATTR_FILLCOLOR)).GetValue ())); +/*?*/ aCircAttr.Put (XLineStyleItem (((XLineStyleItem &) pXGridHelpAttr->Get (XATTR_LINESTYLE)). +/*?*/ GetValue ())); +/*?*/ aCircAttr.Put (XLineWidthItem (((XLineWidthItem &) pXGridHelpAttr->Get (XATTR_LINEWIDTH)). +/*?*/ GetValue ())); +/*?*/ aCircAttr.Put (XFillStyleItem(XFILL_NONE)); +/*?*/ +/*?*/ SdrCircObj* pCirc = new SdrCircObj( OBJ_CIRC, aCircRect ); +/*?*/ pCirc->SetModel( this ); +/*?*/ pXGridHelpList->NbcInsertObject(SetObjectAttr( pCirc, +/*?*/ CHOBJID_DIAGRAM_X_GRID_HELP, TRUE, TRUE, +/*?*/ &aCircAttr)); +/*?*/ +/*?*/ DecValue(fSteps, pChartYAxis->GetStep(), FALSE); +/*?*/ +/*?*/ if (pChartYAxis->GetStep() == 0.0) break; +/*?*/ } +/*N*/ +/*N*/ fSteps = pChartYAxis->GetMin(); +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ const SfxItemSet& rDataRowAttr = GetDataRowAttr(nRow); +/*N*/ Point aFirstPoint; +/*N*/ fAngle = F_PI / 2; +/*N*/ long nPoints = 0; +/*N*/ +/*N*/ SchObjGroup* pRowGroup = (SchObjGroup*) CreateSimpleGroup (CHOBJID_DIAGRAM_ROWGROUP, TRUE, TRUE); +/*N*/ +/*N*/ pRowGroup->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ pList->NbcInsertObject(pRowGroup); +/*N*/ pRowLists[nRow] = pRowGroup->GetSubList(); +/*N*/ pDescrLists[nRow] = 0; +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ SfxItemSet aDataPointAttr(rDataRowAttr);//#63904# +/*N*/ MergeDataPointAttr(aDataPointAttr,nCol,nRow); +/*N*/ +/*N*/ long nIndex = nCol + nRow * nColCnt; +/*N*/ // double fData = fabs(GetData(nCol, nRow, bPercent)); +/*N*/ double fData = GetData(nCol, nRow, bPercent); +/*N*/ +/*N*/ if (pYAxisList) +/*N*/ { +/*N*/ if (!nRow) +/*N*/ { +/*N*/ aLine [0].X () = (long) (nOffsetX + nLength * cos (fAngle)); +/*N*/ aLine [0].Y () = (long) (nOffsetY - nLength * sin (fAngle)); +/*N*/ aLine [1].X () = nOffsetX; +/*N*/ aLine [1].Y () = nOffsetY; +/*N*/ +/*N*/ pYAxisList->NbcInsertObject(SetObjectAttr (new SdrPathObj(OBJ_PLIN, aLine), +/*N*/ CHOBJID_LINE, TRUE, TRUE, pYAxisAttr)); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ if( (eDescr != CHDESCR_NONE) && bShowDataDescr) +/*N*/ { + /************************************************************** + * DataDescription erforderlich + **************************************************************/ +/*?*/ if (!pDescription) +/*?*/ { +/*?*/ // DataDescription noch nicht vorhanden -> erzeugen +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pDescription = new DataDescription [nRowCnt * nColCnt]; +/*?*/ } +/*?*/ +/*?*/ pDescription [nIndex].eDescr = eDescr; +/*?*/ pDescription [nIndex].bSymbol = ((const SfxBoolItem&)aDataPointAttr. +/*?*/ Get(SCHATTR_DATADESCR_SHOW_SYM)).GetValue(); +/*?*/ +/*?*/ if (!pDescrLists[nRow]) +/*?*/ { +/*?*/ SchObjGroup* pDescrGroup = (SchObjGroup*) CreateSimpleGroup (CHOBJID_DIAGRAM_DESCRGROUP, TRUE, TRUE); +/*?*/ +/*?*/ pDescrGroup->InsertUserData(new SchDataRow((short)nRow)); +/*?*/ pList->NbcInsertObject(pDescrGroup); +/*?*/ pDescrLists[nRow] = pDescrGroup->GetSubList(); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ if (bStacked && !nRow) fOldData[nCol] = pChartYAxis->GetOrigin(); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ if (bStacked && nRow) fData += fOldData[nCol]; +/*N*/ +/*N*/ double fLength = nLength * pChartYAxis->CalcFact(fData); +/*N*/ +/*N*/ aDataLine [(USHORT) nPoints].X () = (long) (nOffsetX + fLength * cos (fAngle)); +/*N*/ aDataLine [(USHORT) nPoints].Y () = (long) (nOffsetY - fLength * sin (fAngle)); +/*N*/ +/*N*/ if (!nCol) +/*N*/ { +/*N*/ aFirstPoint.X () = aDataLine [(USHORT) nPoints].X(); +/*N*/ aFirstPoint.Y () = aDataLine [(USHORT) nPoints].Y(); +/*N*/ } +/*N*/ +/*N*/ nPoints ++; +/*N*/ +/*N*/ if(HasSymbols(nRow)) // if ((eChartStyle == CHSTYLE_2D_NET_SYMBOLS) ||(eChartStyle == CHSTYLE_2D_NET_SYMBOLS_STACK) ||(eChartStyle == CHSTYLE_2D_NET_SYMBOLS_PERCENT)) +/*N*/ { +/*N*/ SdrObject *pNewObj = CreateSymbol (aDataLine[nPoints - 1], nRow, nCol, +/*N*/ (SfxItemSet &) rDataRowAttr, nLegendHeight); +/*N*/ if(pNewObj) +/*N*/ { +/*N*/ pNewObj->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM_DATA)); +/*N*/ pRowLists[nRow]->NbcInsertObject(pNewObj); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ fOldData [nCol] = fData; +/*N*/ +/*N*/ ChartAdjust eAdjust; +/*N*/ +/*N*/ if (fAngle > 0 && fAngle < F_PI / 4) +/*N*/ { +/*?*/ eAdjust = CHADJUST_CENTER_LEFT; +/*N*/ } +/*N*/ else if (fAngle >= F_PI / 4 && fAngle <= 3 * F_PI / 4) +/*N*/ { +/*N*/ eAdjust = CHADJUST_BOTTOM_CENTER; +/*N*/ } +/*N*/ else if (fAngle > 3 * F_PI / 4 && fAngle <= 5 * F_PI / 4) +/*N*/ { +/*N*/ eAdjust = CHADJUST_CENTER_RIGHT; +/*N*/ } +/*N*/ else if (fAngle > 5 * F_PI / 4 && fAngle <= 7 * F_PI / 4) +/*N*/ { +/*N*/ eAdjust = CHADJUST_TOP_CENTER; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ eAdjust = CHADJUST_CENTER_LEFT; +/*N*/ } +/*N*/ +/*N*/ if (pDescription) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pDescription [nIndex].fValue = GetData(nCol,nRow,FALSE);//#55586# fData; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (nPoints) +/*N*/ { +/*?*/ for (long nFill = nPoints;nFill < nColCnt;nFill ++) +/*?*/ aDataLine [(USHORT) nFill] = aDataLine [(USHORT) nPoints - 1]; +/*?*/ +/*?*/ aLineAttr.Put(rDataRowAttr); +/*?*/ +/*?*/ pObj = new SdrPathObj(OBJ_PLIN, aDataLine); +/*?*/ pObj->InsertUserData(new SchObjectId (CHOBJID_DIAGRAM_ROWSLINE)); +/*?*/ pObj->InsertUserData(new SchDataRow((short)nRow)); +/*?*/ pRowLists[nRow]->NbcInsertObject(pObj,0); //#54870# Linie nach hinten +/*?*/ +/*?*/ //-/ pObj->NbcSetAttributes(aLineAttr, FALSE); +/*?*/ pObj->SetItemSet(aLineAttr); +/*?*/ +/*?*/ nPoints = 0; +/*N*/ } +/*N*/ +/*N*/ if (pDescription) +/*N*/ { +/*?*/ pDescription [nIndex].fValue = DBL_MIN; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ fAngle += fAngleStep; +/*N*/ if (fAngle > 2 * F_PI) fAngle -= 2 * F_PI; +/*N*/ } +/*N*/ +/*N*/ if (nPoints) +/*N*/ { +/*N*/ for (long nFill = nPoints;nFill < nColCnt;nFill ++) +/*?*/ aDataLine [(USHORT) nFill] = aDataLine [(USHORT) nPoints - 1]; +/*N*/ +/*N*/ if (aFirstPoint.X () && aFirstPoint.Y ()) +/*N*/ { +/*N*/ aDataLine [(unsigned short)nColCnt].X () = aFirstPoint.X (); +/*N*/ aDataLine [(unsigned short)nColCnt].Y () = aFirstPoint.Y (); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ aDataLine [(unsigned short)nColCnt].X () = aDataLine [nColCnt - 1].X (); +/*?*/ aDataLine [(unsigned short)nColCnt].Y () = aDataLine [nColCnt - 1].Y (); +/*N*/ } +/*N*/ +/*N*/ aLineAttr.Put(rDataRowAttr); +/*N*/ +/*N*/ pObj = new SdrPathObj(OBJ_PLIN, aDataLine); +/*N*/ pObj->InsertUserData(new SchObjectId (CHOBJID_DIAGRAM_ROWSLINE)); +/*N*/ pObj->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ pRowLists[nRow]->NbcInsertObject(pObj,0);//#54870# hinter die Symbole mit der Linie +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes(aLineAttr, FALSE); +/*N*/ pObj->SetItemSet(aLineAttr); +/*N*/ +/*N*/ } +/*N*/ +/*N*/ IncValue(fSteps, pChartYAxis->GetStep(), FALSE); +/*N*/ +/*N*/ if (pChartYAxis->GetStep() == 0.0) break; +/*N*/ } +/*N*/ +/*N*/ Dirty2D (nRowCnt, nColCnt, pDescrLists, TRUE/*FALSE*/, pDescription); +/*N*/ +/*N*/ delete[] pDescription; +/*N*/ delete[] pDescrLists; +/*N*/ delete[] pRowLists; +/*N*/ delete[] fOldData; +/*N*/ return pGroup; +/*N*/ } + +/************************************************************************* +|* +|* Frisiere die % auf 100% +|* +\************************************************************************/ + +/*N*/ void ChartModel::Dirty2D (long nRowCnt, +/*N*/ long nColCnt, +/*N*/ SdrObjList **pDescrLists, +/*N*/ BOOL bRowDescr, +/*N*/ DataDescription *pDescription) +/*N*/ { +/*N*/ if (!pDescription) +/*N*/ return; + +/*?*/ long nStart = IsXYChart() ? 1 : 0; +/*?*/ +/*?*/ if (bRowDescr) +/*?*/ { +/*?*/ for (long nCols = 0;nCols < nColCnt;nCols ++) +/*?*/ { +/*?*/ double fTotal = 0.0; +/*?*/ double fMax = 0.0; +/*?*/ long nDirty = 0; + long nRows = 0; +/*?*/ +/*?*/ // Calculate the total of all segements with percentage value and +/*?*/ // remember the largest segment's index in nDirty and its value in fMax. +/*?*/ for (nRows = nStart;nRows < nRowCnt;nRows ++) +/*?*/ if (pDescrLists [nRows]) +/*?*/ { +/*?*/ long nIndex= nCols + nRows * nColCnt; +/*?*/ if ((pDescription [nIndex].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nIndex].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ double fTemp = pDescription [nIndex].fValue; +/*?*/ +/*?*/ if (fTemp != DBL_MIN) +/*?*/ { +/*?*/ fTotal += fTemp; +/*?*/ if (fMax < fTemp) +/*?*/ { +/*?*/ fMax = fTemp; +/*?*/ nDirty = nIndex; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ BOOL bIsDirty = FALSE; +/*?*/ +/*?*/ for (nRows = nStart;nRows < nRowCnt;nRows ++) +/*?*/ if (pDescrLists[nRows]) +/*?*/ { +/*?*/ long nIndex = nCols + nRows * nColCnt;// long nIndex = nRows + nCols * nRowCnt; +/*?*/ +/*?*/ if (!bIsDirty) +/*?*/ if ((pDescription [nIndex].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nIndex].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ if (fTotal > 100.0000001) +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 DBG_ERROR2( "Dirty2D: ROW value is being changed total=%lf, Vman=%lf", +/*?*/ } +/*?*/ +/*?*/ if (pDescription [nIndex].fValue != DBL_MIN) +/*?*/ if( pDescription[nIndex].pLabelObj ) +/*?*/ pDescrLists[nRows]->NbcInsertObject( pDescription[nIndex].pLabelObj ); +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ for (long nRows = nStart;nRows < nRowCnt; nRows ++) +/*?*/ { +/*?*/ if ( ! pDescrLists[nRows]) +/*?*/ continue; +/*?*/ +/*?*/ double fTotal = 0.0; +/*?*/ double fMax = 0.0; +/*?*/ long nDirty = 0; + long nCols = 0; +/*?*/ +/*?*/ // Calculate the total of all segements with a percentage value and +/*?*/ // remember the largest segment's index in nDirty and its value in fMax. +/*?*/ for (nCols = 0;nCols < nColCnt;nCols ++) +/*?*/ { +/*?*/ long nIndex = nCols + nRows * nColCnt; +/*?*/ if ((pDescription [nIndex].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nIndex].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ double fTemp = pDescription [nIndex].fValue; +/*?*/ +/*?*/ if (fTemp != DBL_MIN) +/*?*/ { +/*?*/ fTotal += fTemp; +/*?*/ if (fMax < fTemp) +/*?*/ { +/*?*/ fMax = fTemp; +/*?*/ nDirty = nIndex; +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ BOOL bIsDirty = FALSE; +/*?*/ +/*?*/ for (nCols = 0;nCols < nColCnt;nCols ++) +/*?*/ { +/*?*/ long nIndex = nCols + nRows * nColCnt; +/*?*/ +/*?*/ if (!bIsDirty) +/*?*/ if ((pDescription [nIndex].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nIndex].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ if (fTotal > 100.0000001) +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 DBG_ERROR2( "Dirty2D: COL value is being changed total=%lf, Vman=%lf", +/*?*/ } +/*?*/ +/*?*/ if (pDescription[ nIndex ].fValue != DBL_MIN) +/*?*/ if( pDescription[ nIndex ].pLabelObj ) +/*?*/ pDescrLists[nRows]->NbcInsertObject( pDescription[ nIndex ].pLabelObj ); +/*?*/ } +/*?*/ } +/*?*/ } +/*N*/ } + +/************************************************************************* +|* +|* Trage ggf. Mittelwert und Fehlerbalken ein +|* +\************************************************************************/ + +/************************************************************************* +|* +|* Erstelle Kreissegment +|* +\************************************************************************/ +/*N*/ SdrObject *ChartModel::CreatePieSegment(SfxItemSet &rAttr, +/*N*/ Rectangle &rRect, +/*N*/ long nCol, +/*N*/ long nRow, +/*N*/ long nStartAngle, +/*N*/ long nEndAngle, +/*N*/ long nCnt) +/*N*/ { +/*N*/ SdrObject *pObj; +/*N*/ +/*N*/ // BM: Attention: Small angles are treated as equal, if they are equal +/*N*/ // after divided by 10. That is because that is also done in the +/*N*/ // drawing layer. Giving angles which differ by 1 causes the creation +/*N*/ // of a full circle. +/*N*/ +/*N*/ if( nCnt == 1 ) // only one datarow => whole circle +/*N*/ { +/*?*/ pObj = new SdrCircObj( OBJ_CIRC, rRect ); +/*?*/ pObj->SetModel( this ); +/*?*/ SetObjectAttr( pObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &rAttr); +/*N*/ } +/*N*/ else if( (nStartAngle/10) - (nEndAngle/10) ) // create pie segment +/*N*/ { +/*N*/ pObj = new SdrCircObj( OBJ_SECT, rRect, nStartAngle, nEndAngle ); +/*N*/ pObj->SetModel( this ); +/*N*/ SetObjectAttr( pObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &rAttr ); +/*N*/ } +/*N*/ else // the segment is treated as line +/*N*/ { +/*?*/ pObj = new SdrCircObj( OBJ_SECT, rRect, nStartAngle, nStartAngle ); +/*?*/ pObj->SetModel( this ); +/*?*/ SetObjectAttr( pObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &rAttr ); +/*N*/ } +/*N*/ pObj->InsertUserData(new SchDataPoint((short)nCol, (short)nRow)); +/*N*/ return pObj; +/*N*/ } + +/************************************************************* +|* +|* create donut segment - same as circle segment for now +|* +\*************************************************************/ +/*N*/ SdrObject* ChartModel::CreateDonutSegment( SfxItemSet& aAttr, +/*N*/ Rectangle& aRect, ULONG nWidth, +/*N*/ long nCol, long nRow, +/*N*/ long nStartAngle, long nEndAngle, +/*N*/ long nCount) +/*N*/ { +/*N*/ SdrObject* pObj; +/*N*/ if( nStartAngle > nEndAngle ) +/*N*/ nStartAngle += 36000; +/*N*/ +/*N*/ if( nCount==1 || nStartAngle==nEndAngle ) // we have to paint complete ring +/*N*/ { +/*?*/ pObj = new SdrCircObj( OBJ_CIRC, aRect ); +/*?*/ pObj->SetModel( this ); +/*?*/ SetObjectAttr( pObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &aAttr ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pObj = new SdrCircObj( OBJ_SECT, aRect, nStartAngle, nEndAngle ); +/*N*/ pObj->SetModel( this ); +/*N*/ SetObjectAttr( pObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &aAttr ); +/*N*/ } +/*N*/ pObj->InsertUserData( new SchDataPoint( (short)nCol, (short)nRow )); +/*N*/ return pObj; +/*N*/ } + +/************************************************************************* +|* +|* Objektgruppe erzeugen +|* +\************************************************************************/ +/*N*/ SdrRectObj *ChartModel::CreateRect (Rectangle &rRect,long nCol,long nRow,SfxItemSet &rAttr) +/*N*/ { +/*N*/ SdrRectObj* pRectObj = new SdrRectObj( rRect ); +/*N*/ pRectObj->SetModel( this ); +/*N*/ SetObjectAttr( pRectObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &rAttr ); +/*N*/ pRectObj->InsertUserData(new SchDataPoint((short) nCol, (short) nRow)); +/*N*/ return pRectObj; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmod3d.cxx b/binfilter/bf_sch/source/core/sch_chtmod3d.cxx new file mode 100644 index 000000000000..37a7d826e60a --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmod3d.cxx @@ -0,0 +1,2106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define RAD2CDEG(fAngle) ( (long)(((fAngle)*18000.0/F_PI)+36000.0)%36000 ) + + + +#include "schattr.hxx" +#define ITEMID_ADJUST EE_PARA_JUST + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT + +#include <bf_svtools/eitem.hxx> + +#endif + +#include <globfunc.hxx> +#include "axisid.hxx" +#include "chtscene.hxx" + +#undef ITEMID_COLOR // Defined in svx3ditems.hxx +#define ITEMID_COLOR EE_CHAR_COLOR + +#include <bf_svx/svdocirc.hxx> +#include "math.h" +#include "glob.hrc" +#include "float.h" + +#ifndef _ZFORLIST_HXX //autogen +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif +#include <bf_svx/svdopath.hxx> +#include <bf_svx/xlnwtit.hxx> + +#include "pairs.hxx" +#include "chmod3d.hxx" +#include "chaxis.hxx" +#include "chdescr.hxx" +#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000) + +namespace binfilter { + +/************************************************************************* +|* +|* Erzeugt alle 3d-Achsentitel und setzt sie sofort ins Diagramm +|* Positioniert werden sie von der Chartszene +|* +\************************************************************************/ + +/*N*/ void ChartModel::CreateAndInsert3DAxesTitles (Rectangle &rRect, BOOL bSwitchColRow) +/*N*/ { +/*N*/ SdrTextObj *pXAxisTitleObj = NULL; +/*N*/ SdrTextObj *pYAxisTitleObj = NULL; +/*N*/ SdrTextObj *pZAxisTitleObj = NULL; +/*N*/ +/*N*/ if (bShowXAxisTitle) +/*N*/ { +/*N*/ pXAxisTitleObj = CreateTitle (pXAxisTitleAttr, CHOBJID_DIAGRAM_TITLE_X_AXIS, +/*N*/ bSwitchColRow,aXAxisTitle, +/*N*/ FALSE, &eAdjustXAxesTitle); +/*N*/ if (GetAdjustMarginsForXAxisTitle()) +/*N*/ { +/*N*/ if (bSwitchColRow) +/*N*/ rRect.Left() += GetOutputSize(*pXAxisTitleObj).Width() + 200; +/*N*/ else +/*N*/ rRect.Bottom() -= GetOutputSize(*pXAxisTitleObj).Height() + 200; +/*N*/ } +/*N*/ } +/*N*/ if (bShowYAxisTitle) +/*N*/ { +/*N*/ pYAxisTitleObj = CreateTitle (pYAxisTitleAttr, CHOBJID_DIAGRAM_TITLE_Y_AXIS, +/*N*/ bSwitchColRow, aYAxisTitle, +/*N*/ TRUE, &eAdjustYAxesTitle); +/*N*/ if (GetAdjustMarginsForYAxisTitle()) +/*N*/ { +/*N*/ if (bSwitchColRow) +/*N*/ rRect.Bottom() -= GetOutputSize(*pYAxisTitleObj).Height() + 200; +/*N*/ else +/*N*/ rRect.Left() += GetOutputSize(*pYAxisTitleObj).Width() + 200; +/*N*/ } +/*N*/ } +/*N*/ if (bShowZAxisTitle) +/*N*/ { +/*N*/ pZAxisTitleObj = CreateTitle (pZAxisTitleAttr, CHOBJID_DIAGRAM_TITLE_Z_AXIS, +/*N*/ bSwitchColRow,aZAxisTitle, FALSE, &eAdjustZAxesTitle); +/*N*/ if( GetAdjustMarginsForZAxisTitle()) +/*N*/ { +/*N*/ rRect.Right() -= GetOutputSize(*pZAxisTitleObj).Width() + 200; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ if (pXAxisTitleObj) pPage->NbcInsertObject( pXAxisTitleObj ); +/*N*/ if (pYAxisTitleObj) pPage->NbcInsertObject( pYAxisTitleObj ); +/*N*/ if (pZAxisTitleObj) pPage->NbcInsertObject( pZAxisTitleObj ); +/*N*/ +/*N*/ // this should resize the scene according to the space needed +/*N*/ // by the titles. However this results in strange effects like +/*N*/ // constant resizing until the scene has 0 size and also the title +/*N*/ // objects disappear when being moved (?). +/*N*/ // GetScene()->NbcSetSnapRect( rRect ); +/*N*/ } + +/************************************************************************* +|* +|* 3D-Rueckwaende mit Unterteilung und Beschriftung erzeugen +|* +\************************************************************************/ +/*N*/ void ChartModel::Create3DBackplanes (Rectangle &rRect, +/*N*/ Vector3D aPos, +/*N*/ Vector3D aSizeVec, +/*N*/ ChartScene &rScene, +/*N*/ BOOL bPartDescr, +/*N*/ BOOL bXLogarithm, +/*N*/ BOOL bYLogarithm, +/*N*/ BOOL bZLogarithm, +/*N*/ USHORT eStackMode, +/*N*/ BOOL bPercent, +/*N*/ BOOL bFlatChart, +/*N*/ BOOL bSwitchColRow) +/*N*/ { +/*N*/ //vorlaeufiger Hack, bis logarithmus-Ueberpruefung eingebaut (autokorrektur): +/*N*/ pChartXAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM,bXLogarithm)); +/*N*/ pChartYAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM,bYLogarithm)); +/*N*/ pChartZAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM,bZLogarithm)); +/*N*/ +/*N*/ String aNumStr; +/*N*/ +/*N*/ E3dObject* pXGridMainGroup = bShowXGridMain +/*N*/ ? Create3DObject (CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP) +/*N*/ : 0; +/*N*/ E3dObject* pYGridMainGroup = bShowYGridMain +/*N*/ ? Create3DObject (CHOBJID_DIAGRAM_Y_GRID_MAIN_GROUP) +/*N*/ : 0; +/*N*/ E3dObject* pZGridMainGroup = bShowZGridMain +/*N*/ ? Create3DObject (CHOBJID_DIAGRAM_Z_GRID_MAIN_GROUP) +/*N*/ : 0; +/*N*/ E3dObject* pXGridHelpGroup = bShowXGridHelp +/*N*/ ? Create3DObject (CHOBJID_DIAGRAM_X_GRID_HELP_GROUP) +/*N*/ : 0; +/*N*/ E3dObject* pYGridHelpGroup = bShowYGridHelp +/*N*/ ? Create3DObject (CHOBJID_DIAGRAM_Y_GRID_HELP_GROUP) +/*N*/ : 0; +/*N*/ E3dObject* pZGridHelpGroup = bShowZGridHelp +/*N*/ ? Create3DObject (CHOBJID_DIAGRAM_Z_GRID_HELP_GROUP) +/*N*/ : 0; +/*N*/ E3dObject* pXAxisGroup = pChartXAxis->IsVisible()|| pChartXAxis->HasDescription() //#47500# +/*N*/ ? Create3DAxisObj( CHOBJID_DIAGRAM_X_AXIS ) +/*N*/ : 0; +/*N*/ E3dObject* pYAxisGroup = pChartYAxis->IsVisible() || pChartYAxis->HasDescription() //#47500# +/*N*/ ? Create3DAxisObj( CHOBJID_DIAGRAM_Y_AXIS ) +/*N*/ : 0; +/*N*/ E3dObject* pZAxisGroup = pChartZAxis->IsVisible() || pChartZAxis->HasDescription() //#47500# +/*N*/ ? Create3DAxisObj( CHOBJID_DIAGRAM_Z_AXIS ) +/*N*/ : 0; +/*N*/ Polygon3D aRect3D; +/*N*/ +/*N*/ pChartXAxis->Initialise(rRect,bSwitchColRow,eStackMode,bPercent,FALSE); +/*N*/ pChartYAxis->Initialise(rRect,bSwitchColRow,eStackMode,bPercent,FALSE); +/*N*/ pChartZAxis->Initialise(rRect,bSwitchColRow,eStackMode,bPercent,FALSE); +/*N*/ +/*N*/ pChartXAxis->CalcValueSteps(); +/*N*/ pChartYAxis->CalcValueSteps(); +/*N*/ pChartZAxis->CalcValueSteps(); +/*N*/ +/*N*/ //Vorlaeufige Notloesung, entsprechende Stellen sollen noch geaendert werden, daher bitte kein Search&Repleace statt der #defs! +/*N*/ #define fOriginY pChartYAxis->GetOrigin() +/*N*/ #define fMinValueY pChartYAxis->GetMin() +/*N*/ #define fMaxValueY pChartYAxis->GetMax() +/*N*/ #define fValueStepMainY pChartYAxis->GetStep() +/*N*/ #define fValueStepHelpY pChartYAxis->GetHelpStep() +/*N*/ +/*N*/ //ToDo: vorlaeufig +/*N*/ SfxItemSet* pXAxisAttr=&GetAttr(CHOBJID_DIAGRAM_X_AXIS); +/*N*/ SfxItemSet* pYAxisAttr=&GetAttr(CHOBJID_DIAGRAM_Y_AXIS); +/*N*/ SfxItemSet* pZAxisAttr=&GetAttr(CHOBJID_DIAGRAM_Z_AXIS); +/*N*/ +/*N*/ SvxChartTextOrient eDescrOrient = ((const SvxChartTextOrientItem&)pXAxisAttr->Get(SCHATTR_TEXT_ORIENT)).GetValue(); +/*N*/ SvxChartTextOrient eValueOrient = ((const SvxChartTextOrientItem&)pYAxisAttr->Get(SCHATTR_TEXT_ORIENT)).GetValue(); +/*N*/ +/*N*/ Size aMaxValueSizeY = pChartYAxis->CalcMaxTextSize(eValueOrient); +/*N*/ Size aMaxValueSizeX = pChartXAxis->CalcMaxTextSize(eDescrOrient); +/*N*/ +/*N*/ Size aMaxDescrSizeY = CalcMaxDescrSize( TRUE, eValueOrient, bPercent, CHAXIS_AXIS_Y ); +/*N*/ Size aMaxDescrSizeX = CalcMaxDescrSize( FALSE, eDescrOrient, bPercent, CHAXIS_AXIS_X ); +/*N*/ +/*N*/ short nV, i; +/*N*/ +/*N*/ long nRowCnt = bFlatChart +/*N*/ ? 1 +/*N*/ : GetRowCount(); +/*N*/ long nBackColCnt = (bPartDescr || GetColCount() > 1) +/*N*/ ? GetColCount() +/*N*/ : GetColCount() + 1; +/*N*/ long nColumnCnt = bPartDescr +/*N*/ ? nBackColCnt +/*N*/ : nBackColCnt - 1; +/*N*/ +/*N*/ +/*N*/ // FG: Diese Variable ist ein reiner Zwischenspeicher damit in der Chartscene bei FitInSnapRect +/*N*/ // die Achsentitel gemaess dieses Parameters gesetzt werden koennen. +/*N*/ bSwitch3DColRow = bSwitchColRow; +/*N*/ +/*N*/ long nMaxTextWidth = 0; +/*N*/ +/*N*/ aXDescrList.Clear(); +/*N*/ aYDescrList.Clear(); +/*N*/ aZDescrList.Clear(); +/*N*/ +/*N*/ E3dDefaultAttributes aDefltAttr3D; +/*N*/ +/*N*/ Matrix4D aShift; +/*N*/ aShift.Translate(-(aSizeVec/500.0));//Wände etwas verschieben... +/*N*/ +/*N*/ const double fFloorWidth = 100.0; +/*N*/ const double fWallWith = 50.0; // BM: unused for now +/*N*/ +/*N*/ for (nV = 0; nV < 3; nV++) +/*N*/ { +/*N*/ switch (nV) +/*N*/ { +/*N*/ case 0: // X-Achse , XY-Ebene (WALL hinten) +/*N*/ case 1: // Y-Achse , YZ-Ebene (WALL seitlich) +/*N*/ { +/*N*/ aRect3D[0] = aPos; +/*N*/ aPos[nV] += aSizeVec[nV]; //nV=0: X(), sonst Y() +/*N*/ aRect3D[1] = aPos; +/*N*/ aPos[nV + 1] += aSizeVec[nV + 1]; //nV=0: Y(), sonst Z() +/*N*/ aRect3D[2] = aPos; +/*N*/ aPos[nV] -= aSizeVec[nV]; +/*N*/ aRect3D[3] = aPos; +/*N*/ aPos[nV + 1] -= aSizeVec[nV + 1]; +/*N*/ +/*N*/ E3dPolygonObj *pWallObj = new SchE3dPolygonObj(aDefltAttr3D, aRect3D); +/*N*/ +/*N*/ pWallObj->SetModel (this); +/*N*/ pWallObj->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM_WALL)); +/*N*/ rScene.Insert3DObj(pWallObj); +/*N*/ +/*N*/ //-/ pWallObj->NbcSetAttributes(*pDiagramWallAttr, FALSE); +/*N*/ pWallObj->SetItemSet(*pDiagramWallAttr); +/*N*/ +/*N*/ pWallObj->NbcSetTransform(aShift); +/*N*/ +/*N*/ if (!nV) +/*N*/ { +/*N*/ // X-Achse zeichnen +/*N*/ Vector3D aLine3D [2] = { aRect3D [0], aRect3D [1] }; +/*N*/ +/*N*/ //#47500# +/*N*/ if (pXAxisGroup && pChartXAxis->IsVisible()) +/*N*/ { +/*N*/ Create3DPolyObject (pXAxisAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*N*/ CHOBJID_LINE, pXAxisGroup); +/*N*/ } +/*N*/ +/*N*/ if( pYGridMainGroup || pYGridHelpGroup ) +/*N*/ // Y-Anteile +/*N*/ if (bSwitchColRow) +/*N*/ { +/*N*/ Vector3D aLine3D [2] = { aRect3D [0], aRect3D [1] }; +/*N*/ long nStepMainY = (long) aSizeVec.Y () / nColumnCnt; +/*N*/ long nStepHelpY = nStepMainY / 2; +/*N*/ +/*N*/ // hauptgitter auf der X-Ebene, parallel zur X-Achse +/*N*/ for (i = 0; i <= nColumnCnt; i++) +/*N*/ { +/*N*/ aLine3D[0].Y() = +/*N*/ aLine3D[1].Y() = aPos.Y() + nStepMainY * i; +/*N*/ if( pYGridMainGroup ) +/*N*/ Create3DPolyObject (pYGridMainAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*N*/ CHOBJID_DIAGRAM_Y_GRID_MAIN, pYGridMainGroup); +/*N*/ +/*N*/ // hilfsgitter auf der X-Ebene, parallel zur X-Achse +/*N*/ if (pYGridHelpGroup && (i < nColumnCnt)) +/*N*/ { +/*?*/ aLine3D [0].Y () += nStepHelpY; +/*?*/ aLine3D [1].Y () += nStepHelpY; +/*?*/ Create3DPolyObject (pYGridHelpAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*?*/ CHOBJID_DIAGRAM_Y_GRID_HELP, pYGridHelpGroup); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aLine3D [0] = aRect3D[0]; +/*N*/ aLine3D [1] = aRect3D[3]; +/*N*/ +/*N*/ long nStepMainX = (long) aSizeVec.X () / nColumnCnt; +/*N*/ long nStepHelpX = nStepMainX / 2; +/*N*/ +/*N*/ // hauptgitter auf der X-Ebene, parallel zur Y-Achse +/*N*/ for (i = 0; i <= nColumnCnt; i++) +/*N*/ { +/*N*/ aLine3D[0].X() = +/*N*/ aLine3D[1].X() = aPos.X() + nStepMainX * i; +/*N*/ if( pYGridMainGroup ) +/*N*/ Create3DPolyObject (pYGridMainAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*N*/ CHOBJID_DIAGRAM_Y_GRID_MAIN, pYGridMainGroup); +/*N*/ +/*N*/ // hilfsgitter auf der X-Ebene, parallel zur Y-Achse +/*N*/ if (pYGridHelpGroup && (i < nColumnCnt)) +/*N*/ { +/*?*/ aLine3D [0].X () += nStepHelpX; +/*?*/ aLine3D [1].X () += nStepHelpX; +/*?*/ Create3DPolyObject (pYGridHelpAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*?*/ CHOBJID_DIAGRAM_Y_GRID_HELP, pYGridHelpGroup); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Y-Achse zeichnen +/*N*/ Vector3D aLine3D [2] = { aRect3D [0], aRect3D [1] }; +/*N*/ +/*N*/ // Z-Anteile +/*N*/ //#47500# +/*N*/ if (pYAxisGroup && pChartYAxis->IsVisible()) Create3DPolyObject (pYAxisAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*N*/ CHOBJID_LINE, pYAxisGroup); +/*N*/ +/*N*/ // hauptgitter auf der Z-Ebene, parallel zur Z-Achse +/*N*/ if( pZGridMainGroup || pZGridHelpGroup ) +/*N*/ { +/*N*/ Vector3D aLine3D [2] = { aRect3D[2], aRect3D[3] }; +/*N*/ long nStepMainZ = (long) aSizeVec.Z () / nRowCnt; +/*N*/ long nStepHelpZ = nStepMainZ / 2; +/*N*/ +/*N*/ BOOL bCreateGridLine = ( (aLine3D[ 0 ].X() != aLine3D[ 1 ].X()) || +/*N*/ (aLine3D[ 0 ].Y() != aLine3D[ 1 ].Y()) ); +/*N*/ // Z() values become equal in the for loop +/*N*/ // => start and end points would be equal if !bCreateGridLine +/*N*/ +/*N*/ for (i = 0; i <= nRowCnt; i++) +/*N*/ { +/*N*/ aLine3D[0].Z() = +/*N*/ aLine3D[1].Z() = aPos.Z() + nStepMainZ * i; +/*N*/ if( pZGridMainGroup && bCreateGridLine ) +/*N*/ Create3DPolyObject( pZGridMainAttr, new SchE3dPolygonObj( aDefltAttr3D, aLine3D[0], aLine3D[1] ), +/*N*/ CHOBJID_DIAGRAM_Z_GRID_MAIN, pZGridMainGroup ); +/*N*/ +/*N*/ // hilfsgitter auf der Z-Ebene, parallel zur Z-Achse +/*N*/ if (pZGridHelpGroup && (i < nRowCnt)) +/*N*/ { +/*?*/ aLine3D[0].Z() += nStepHelpZ; +/*?*/ aLine3D[1].Z() += nStepHelpZ; +/*?*/ if( bCreateGridLine ) +/*?*/ Create3DPolyObject( pZGridHelpAttr, new SchE3dPolygonObj( aDefltAttr3D, aLine3D[0], aLine3D[1] ), +/*?*/ CHOBJID_DIAGRAM_Z_GRID_HELP, pZGridHelpGroup ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ Vector3D aLine3D [2] = { aRect3D[0], aRect3D[(nV || !nV && bSwitchColRow) +/*N*/ ? 3 +/*N*/ : 1] }; +/*N*/ double fAct = fMinValueY; +/*N*/ +/*N*/ SfxItemSet aYTextAttr ((const SfxItemSet &) *pYAxisAttr); +/*N*/ aYTextAttr.Put(XLineStyleItem (XLINE_NONE)); +/*N*/ aYTextAttr.Put(XLineWidthItem (0)); +/*N*/ +/*N*/ // create Y grid. Attention: Some variables are called XGrid... +/*N*/ if (fMinValueY != fMaxValueY) +/*N*/ while (fAct <= fMaxValueY) +/*N*/ { +/*N*/ double fFact = pChartYAxis->CalcFact(fAct); +/*N*/ +/*N*/ if (bSwitchColRow) +/*N*/ { +/*N*/ // create major gridline +/*N*/ aLine3D[0].X() = aLine3D[1].X() = fFact * aSizeVec.X(); +/*N*/ +/*N*/ if (pXGridMainGroup) +/*N*/ Create3DPolyObject(pXGridMainAttr, new SchE3dPolygonObj(aDefltAttr3D, +/*N*/ aLine3D[0], aLine3D[1]),CHOBJID_DIAGRAM_X_GRID_MAIN,pXGridMainGroup); +/*N*/ +/*N*/ if (pYAxisGroup && pChartYAxis->HasDescription() && nV) +/*N*/ { +/*N*/ Color *pTextColor = NULL; +/*N*/ SvxColorItem *pOldTextColor = NULL; +/*N*/ +/*N*/ pNumFormatter->GetOutputString((bPercent)?fAct/100.0:fAct, +/*N*/ GetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,bPercent), aNumStr, &pTextColor); +/*N*/ +/*N*/ if( pTextColor ) // BM #60999# +/*N*/ { +/*?*/ pOldTextColor = (SvxColorItem*)(aYTextAttr.GetItem( EE_CHAR_COLOR )); +/*?*/ aYTextAttr.Put(SvxColorItem( *pTextColor )); +/*N*/ } +/*N*/ +/*N*/ SdrTextObj *pTextObj = CreateTextObj(CHOBJID_TEXT, Point (),aNumStr, +/*N*/ aYTextAttr, FALSE,CHADJUST_TOP_RIGHT); +/*N*/ +/*N*/ if( pOldTextColor ) +/*N*/ { +/*?*/ aYTextAttr.Put( *pOldTextColor ); +/*N*/ } +/*N*/ +/*N*/ E3dLabelObj *pE3DLabel = new E3dLabelObj(aLine3D[1],pTextObj); +/*N*/ aYDescrList.Insert(pE3DLabel,LIST_APPEND); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // create major gridline +/*N*/ aLine3D[0].Y() = aLine3D[1].Y() = fFact * aSizeVec.Y(); +/*N*/ +/*N*/ if(pXGridMainGroup) +/*N*/ Create3DPolyObject(pXGridMainAttr,new SchE3dPolygonObj(aDefltAttr3D, +/*N*/ aLine3D[0],aLine3D[1]),CHOBJID_DIAGRAM_X_GRID_MAIN, pXGridMainGroup); +/*N*/ // Y-Achsenwerte +/*N*/ if (pYAxisGroup && pChartYAxis->HasDescription() && nV) +/*N*/ { +/*N*/ Color *pTextColor = NULL; +/*N*/ SvxColorItem *pOldTextColor = NULL; +/*N*/ +/*N*/ pNumFormatter->GetOutputString((bPercent)?fAct/100.0:fAct, +/*N*/ GetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,bPercent), aNumStr, &pTextColor); +/*N*/ +/*N*/ if( pTextColor ) // BM #60999# +/*N*/ { +/*?*/ pOldTextColor = (SvxColorItem*)(aYTextAttr.GetItem( EE_CHAR_COLOR )); +/*?*/ aYTextAttr.Put(SvxColorItem( *pTextColor )); +/*N*/ } +/*N*/ +/*N*/ // erzeuge das 3D-textobjekt +/*N*/ SdrTextObj *pTextObj = CreateTextObj(CHOBJID_TEXT, Point (), +/*N*/ aNumStr, +/*N*/ aYTextAttr, FALSE,CHADJUST_CENTER_RIGHT); +/*N*/ +/*N*/ if( pOldTextColor ) +/*N*/ { +/*?*/ aYTextAttr.Put( *pOldTextColor ); +/*N*/ } +/*N*/ +/*N*/ E3dLabelObj *pE3DLabel = new E3dLabelObj(aLine3D [1],pTextObj); +/*N*/ aYDescrList.Insert(pE3DLabel,LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ IncValue(fAct, fValueStepMainY, bYLogarithm); +/*N*/ } +/*N*/ +/*N*/ fAct = fMinValueY; +/*N*/ double fActMain = fAct; // This is used for calculating the positions of main grid lines. +/*N*/ +/*N*/ if (pXGridHelpGroup && (fMinValueY != fMaxValueY)) +/*N*/ { +/*?*/ IncValue(fAct, fValueStepHelpY, FALSE); +/*?*/ if (bSwitchColRow) +/*?*/ { +/*?*/ for (;;) +/*?*/ { +/*?*/ double fPos = pChartYAxis->CalcFact(fAct ) * aSizeVec.X(); +/*?*/ if (fPos > aSizeVec.X()) break; +/*?*/ +/*?*/ // If there is a main grid then ommit creating help grid lines coinciding with main grid lines. +/*?*/ if (pXGridMainGroup) +/*?*/ { +/*?*/ // Advance main raw y position to at least the raw help position. +/*?*/ while (fActMain < fAct-EPSILON) +/*?*/ IncValue(fActMain, fValueStepMainY, bYLogarithm); +/*?*/ // If both positions fall together, then do not create the help line and try the next position. +/*?*/ if (fabs(fAct - fActMain) < EPSILON) +/*?*/ { +/*?*/ IncValue(fAct, fValueStepHelpY, FALSE); +/*?*/ continue; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ aLine3D[0].X() = +/*?*/ aLine3D[1].X() = fPos; +/*?*/ Create3DPolyObject (pXGridHelpAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*?*/ CHOBJID_DIAGRAM_X_GRID_HELP, pXGridHelpGroup); +/*?*/ +/*?*/ // In case of a help grid with a main grid, draw only every other line. +/*?*/ IncValue(fAct, fValueStepHelpY, FALSE); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ for (;;) +/*?*/ { +/*?*/ double fPos = pChartYAxis->CalcFact(fAct ) * aSizeVec.Y(); +/*?*/ if (fPos > aSizeVec.Y()) break; +/*?*/ +/*?*/ // If there is a main grid then ommit creating help grid lines coinciding with main grid lines. +/*?*/ if (pXGridMainGroup) +/*?*/ { +/*?*/ // Advance main raw y position to at least the raw help position. +/*?*/ while (fActMain < fAct-EPSILON) +/*?*/ IncValue(fActMain, fValueStepMainY, bYLogarithm); +/*?*/ // If both positions fall together, then do not create the help line and try the next position. +/*?*/ if (fabs(fAct - fActMain) < EPSILON) +/*?*/ { +/*?*/ IncValue(fAct, fValueStepHelpY, FALSE); +/*?*/ continue; +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ aLine3D[0].Y() = +/*?*/ aLine3D[1].Y() = fPos; +/*?*/ Create3DPolyObject (pXGridHelpAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*?*/ CHOBJID_DIAGRAM_X_GRID_HELP, pXGridHelpGroup); +/*?*/ +/*?*/ // In case of a help grid with a main grid, draw only every other line. +/*?*/ IncValue(fAct, fValueStepHelpY, FALSE); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ case 2: // floor +/*N*/ { +/*N*/ // BM: create 'thick' floor +/*N*/ Rectangle aRect( 0, 0, (long)aSizeVec.X(), (long)aSizeVec.Z() ); +/*N*/ PolyPolygon aPolyPolygon; +/*N*/ Polygon aPoly( aRect ); +/*N*/ aPolyPolygon.Insert( aPoly ); +/*N*/ +/*N*/ E3dExtrudeObj* pFloorObj = new SchE3dExtrudeObj( aDefltAttr3D, aPolyPolygon, fFloorWidth ); +/*N*/ Matrix4D aMatrix; +/*N*/ aMatrix.RotateX( 90.0 * F_PI180 ); +/*N*/ aMatrix.TranslateZ( aSizeVec.Z() ); +/*N*/ aMatrix.Translate( aPos ); +/*N*/ +/*N*/ pFloorObj->SetModel( this ); +/*N*/ pFloorObj->InsertUserData( new SchObjectId( CHOBJID_DIAGRAM_FLOOR ) ); +/*N*/ rScene.Insert3DObj( pFloorObj ); +/*N*/ +/*N*/ //-/ pFloorObj->NbcSetAttributes( *pDiagramFloorAttr, FALSE ); +/*N*/ pFloorObj->SetItemSet(*pDiagramFloorAttr); +/*N*/ +/*N*/ pFloorObj->NbcSetTransform( aMatrix * aShift ); +/*N*/ +/*N*/ Vector3D aEndPos( aPos ); +/*N*/ aEndPos.Z() += aSizeVec.Z(); +/*N*/ +/*N*/ Vector3D aLine3D [2] = { aPos, aEndPos }; +/*N*/ +/*N*/ SfxItemSet aXTextAttr ((const SfxItemSet &) *pXAxisAttr); +/*N*/ aXTextAttr.Put(XLineStyleItem (XLINE_NONE)); +/*N*/ aXTextAttr.Put(XLineWidthItem (0)); +/*N*/ +/*N*/ //#47500# +/*N*/ if (pZAxisGroup && pChartZAxis->IsVisible()) Create3DPolyObject( pZAxisAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*N*/ CHOBJID_LINE, pZAxisGroup ); +/*N*/ +/*N*/ if (bSwitchColRow) +/*N*/ { +/*N*/ long nStepMainY = (long) aSizeVec.Y () / nColumnCnt; +/*N*/ long nStepHelpY = nStepMainY / 2; +/*N*/ +/*N*/ for (i = 0; i <= nColumnCnt; i++) +/*N*/ { +/*N*/ // erzeuge hilfslinie +/*N*/ aLine3D[0].Y() = +/*N*/ aLine3D[1].Y() = aPos.Y() + nStepMainY * i; +/*N*/ +/*N*/ if (pYGridMainGroup) Create3DPolyObject (pYGridMainAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*N*/ CHOBJID_DIAGRAM_Y_GRID_MAIN, pYGridMainGroup); +/*N*/ +/*N*/ if ((i < nColumnCnt) && pXAxisGroup && pChartXAxis->HasDescription()) +/*N*/ { +/*N*/ // bei tiefen diagrammtypen muessen die beschriftungen auf halbem abstand +/*N*/ // untergebracht sein +/*N*/ Vector3D aTextPos = aLine3D[1]; +/*N*/ +/*N*/ if (bPartDescr) aTextPos.Y() += nStepHelpY / 2; +/*N*/ +/*N*/ +/*N*/ SdrTextObj *pTextObj = CreateTextObj(CHOBJID_TEXT, +/*N*/ Point (),ColText(i), +/*N*/ aXTextAttr, FALSE,CHADJUST_CENTER_RIGHT); +/*N*/ E3dLabelObj *pE3DLabel = new E3dLabelObj +/*N*/ (aTextPos,pTextObj ); +/*N*/ pE3DLabel->SetMarkProtect(TRUE); +/*N*/ aXDescrList.Insert(pE3DLabel,LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ // hilfslinien koennen mit erzeugt werden +/*N*/ if (pYGridHelpGroup && (i < nColumnCnt)) +/*N*/ { +/*?*/ aLine3D[0].Y() += nStepHelpY; +/*?*/ aLine3D[1].Y() += nStepHelpY; +/*?*/ Create3DPolyObject (pYGridHelpAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*?*/ CHOBJID_DIAGRAM_Y_GRID_HELP, pYGridHelpGroup); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ long nStepMainX = (long) aSizeVec.X () / nColumnCnt; +/*N*/ long nStepHelpX = nStepMainX / 2; +/*N*/ +/*N*/ for (i = 0; i <= nColumnCnt; i++) +/*N*/ { +/*N*/ // erzeuge hilfslinie +/*N*/ aLine3D[0].X() = +/*N*/ aLine3D[1].X() = aPos.X() + nStepMainX * i; +/*N*/ +/*N*/ if (pYGridMainGroup) Create3DPolyObject (pYGridMainAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*N*/ CHOBJID_DIAGRAM_Y_GRID_MAIN, pYGridMainGroup); +/*N*/ +/*N*/ if ((i < nColumnCnt) && pXAxisGroup && pChartXAxis->HasDescription()) +/*N*/ { +/*N*/ // bei tiefen diagrammtypen muessen die beschriftungen auf halbem abstand +/*N*/ // untergebracht sein +/*N*/ Vector3D aTextPos = aLine3D[1]; +/*N*/ +/*N*/ if (bPartDescr) aTextPos.X() += nStepHelpX; +/*N*/ +/*N*/ +/*N*/ SdrTextObj *pTextObj = CreateTextObj(CHOBJID_TEXT, +/*N*/ Point (),ColText(i), +/*N*/ aXTextAttr, FALSE,CHADJUST_TOP_RIGHT); +/*N*/ E3dLabelObj *pE3DLabel = new E3dLabelObj (aTextPos,pTextObj ); +/*N*/ pE3DLabel->SetMarkProtect(TRUE); +/*N*/ aXDescrList.Insert(pE3DLabel,LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ // hilfslinien koennen mit erzeugt werden +/*N*/ if (pYGridHelpGroup && (i < nColumnCnt)) +/*N*/ { +/*?*/ aLine3D[0].X() += nStepHelpX; +/*?*/ aLine3D[1].X() += nStepHelpX; +/*?*/ Create3DPolyObject (pYGridHelpAttr, new SchE3dPolygonObj (aDefltAttr3D, aLine3D[0], aLine3D[1]), +/*?*/ CHOBJID_DIAGRAM_Y_GRID_HELP, pYGridHelpGroup); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ aLine3D[ 0 ] = +/*N*/ aLine3D[ 1 ] = aEndPos; +/*N*/ aLine3D[ 1 ].X() += aSizeVec.X(); +/*N*/ +/*N*/ SfxItemSet aZTextAttr ((const SfxItemSet &) *pZAxisAttr); +/*N*/ aZTextAttr.Put(XLineStyleItem (XLINE_NONE)); +/*N*/ aZTextAttr.Put(XLineWidthItem (0)); +/*N*/ +/*N*/ long nStepMainZ = (long) aSizeVec.Z () / nRowCnt; +/*N*/ long nStepHelpZ = nStepMainZ / 2; +/*N*/ +/*N*/ BOOL bCreateGridLine = ( (aLine3D[ 0 ].X() != aLine3D[ 1 ].X()) || +/*N*/ (aLine3D[ 0 ].Y() != aLine3D[ 1 ].Y()) ); +/*N*/ // Z() values become equal in the for loop +/*N*/ // => start and end points would be equal +/*N*/ +/*N*/ for (i = 0; i <= nRowCnt; i++) +/*N*/ { +/*N*/ // create main gridline +/*N*/ aLine3D[0].Z() = +/*N*/ aLine3D[1].Z() = aPos.Z() + nStepMainZ * i; +/*N*/ +/*N*/ if( pZGridMainGroup && bCreateGridLine ) +/*N*/ Create3DPolyObject( pZGridMainAttr, new SchE3dPolygonObj( aDefltAttr3D, aLine3D[ 0 ], aLine3D[ 1 ] ), +/*N*/ CHOBJID_DIAGRAM_Z_GRID_MAIN, pZGridMainGroup ); +/*N*/ +/*N*/ // bei tiefen diagrammtypen muessen die beschriftungen auf halbem abstand +/*N*/ // untergebracht sein +/*N*/ Vector3D aTextPos = aLine3D[1]; +/*N*/ +/*N*/ if (bPartDescr) aTextPos.Z () += nStepHelpZ; +/*N*/ +/*N*/ if ((i < nRowCnt) && (nRowCnt > 1) && pZAxisGroup && pChartZAxis->HasDescription()) +/*N*/ { +/*N*/ +/*N*/ SdrTextObj *pTextObj=CreateTextObj(CHOBJID_TEXT, Point (), +/*N*/ RowText(nRowCnt - 1 - i), aZTextAttr, +/*N*/ FALSE, CHADJUST_TOP_LEFT) ; +/*N*/ +/*N*/ E3dLabelObj *pE3DLabel = new E3dLabelObj(aTextPos,pTextObj); +/*N*/ pE3DLabel->SetMarkProtect(TRUE); +/*N*/ aZDescrList.Insert(pE3DLabel,(ULONG)0);//ZListe umgekehrt füllen +/*N*/ } +/*N*/ +/*N*/ if (pZGridHelpGroup && (i < nRowCnt)) +/*N*/ { +/*?*/ aLine3D[0].Z() += nStepHelpZ; +/*?*/ aLine3D[1].Z() += nStepHelpZ; +/*?*/ if( pZGridHelpGroup && bCreateGridLine ) +/*?*/ Create3DPolyObject( pZGridHelpAttr, new SchE3dPolygonObj( aDefltAttr3D, aLine3D[0], aLine3D[1] ), +/*?*/ CHOBJID_DIAGRAM_Z_GRID_HELP, pZGridHelpGroup ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pScene->InsertAllTitleText (aXDescrList, pXAxisGroup,SCH_AXIS_ID_X); +/*N*/ pScene->InsertAllTitleText (aYDescrList, pYAxisGroup,SCH_AXIS_ID_Y); +/*N*/ pScene->InsertAllTitleText (aZDescrList, pZAxisGroup,SCH_AXIS_ID_Z); +/*N*/ +/*N*/ if (pXGridHelpGroup) rScene.Insert3DObj(pXGridHelpGroup); +/*N*/ if (pYGridHelpGroup) rScene.Insert3DObj(pYGridHelpGroup); +/*N*/ if (pZGridHelpGroup) rScene.Insert3DObj(pZGridHelpGroup); +/*N*/ if (pXGridMainGroup) rScene.Insert3DObj(pXGridMainGroup); +/*N*/ if (pYGridMainGroup) rScene.Insert3DObj(pYGridMainGroup); +/*N*/ if (pZGridMainGroup) rScene.Insert3DObj(pZGridMainGroup); +/*N*/ if (pXAxisGroup) rScene.Insert3DObj(pXAxisGroup); +/*N*/ if (pYAxisGroup) rScene.Insert3DObj(pYAxisGroup); +/*N*/ if (pZAxisGroup) rScene.Insert3DObj(pZAxisGroup); +/*N*/ +/*N*/ //TVM: aus FitInSnapRect +/*N*/ //TVM: Bound statt Logic +/*N*/ Position3DAxisTitles(rScene.GetBoundRect()); +/*N*/ } + +/************************************************************************* +|* +|* tiefes 3D-Diagramme erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjGroup* ChartModel::Create3DDeepChart(Rectangle &rRect) +/*N*/ { +/*N*/ const long nGapWidth = 10; +/*N*/ +/*N*/ pScene = CreateScene (rRect, *aLightVec, fSpotIntensity, aSpotColor, +/*N*/ fAmbientIntensity, aAmbientColor); +/*N*/ +/*N*/ Vector3D aTextPos3D; +/*N*/ Polygon3D aRect3D(4); +/*N*/ Polygon3D aTriangle3D(3); +/*N*/ Polygon3D aFrontSide; +/*N*/ Polygon3D aBackSide; +/*N*/ BOOL bSwitchColRow = IsBar(); +/*N*/ E3dDefaultAttributes aDefltAttr3D; +/*N*/ +/*N*/ CreateAndInsert3DAxesTitles (rRect, bSwitchColRow); +/*N*/ +/*N*/ long nX = 0; +/*N*/ long nY = 0; +/*N*/ long nW = FIXED_SIZE_FOR_3D_CHART_VOLUME; +/*N*/ long nH = FIXED_SIZE_FOR_3D_CHART_VOLUME; +/*N*/ long nZ = (FIXED_SIZE_FOR_3D_CHART_VOLUME * 4) / 6; +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ short nCol, nRow; +/*N*/ +/*N*/ Polygon aFrontExtrude(1+nColCnt*2); +/*N*/ +/*N*/ long nGapX = nW * nGapWidth / 1000; +/*N*/ long nGapY = nH * nGapWidth / 1000; +/*N*/ long nGapZ = nZ * nGapWidth / 1000; +/*N*/ long nPartDepth = nZ / nRowCnt; +/*N*/ long nPartWidth; +/*N*/ long nBarWidthX; +/*N*/ long nBarWidthZ = nPartDepth - nGapZ * 2; +/*N*/ +/*N*/ BOOL bLogarithm = ((const SfxBoolItem&) pChartYAxis->GetItemSet()->Get(SCHATTR_AXIS_LOGARITHM)).GetValue(); +/*N*/ +/*N*/ BOOL bPartDescr; +/*N*/ long nDepth = ((eChartStyle == CHSTYLE_3D_BAR) || +/*N*/ (eChartStyle == CHSTYLE_3D_COLUMN) || +/*N*/ (eChartStyle == CHSTYLE_3D_STRIPE) || +/*N*/ (eChartStyle == CHSTYLE_3D_AREA)) +/*N*/ ? -nZ +/*N*/ : nPartDepth; +/*N*/ +/*N*/ nPartWidth = (eChartStyle == CHSTYLE_3D_BAR) +/*N*/ ? nH / nColCnt +/*N*/ : ((eChartStyle == CHSTYLE_3D_COLUMN) +/*N*/ ? nW / nColCnt +/*N*/ : ((nColCnt > 1) +/*N*/ ? nW / (nColCnt - 1) +/*N*/ : nW / nColCnt)); +/*N*/ nBarWidthX = (eChartStyle == CHSTYLE_3D_BAR) +/*N*/ ? nPartWidth - nGapY * 2 +/*N*/ : nPartWidth - nGapX * 2; +/*N*/ bPartDescr = TRUE; +/*N*/ +/*N*/ Camera3D aCam(pScene->GetCamera()); +/*N*/ Vector3D aCamPos(nX + nW/2, nH/2, nW/2); +/*N*/ Vector3D aLookAt(nX + nW/2, nH/2, nDepth/2); +/*N*/ aCam.SetViewWindow(-nW/2, -nH/2, nW, nH); +/*N*/ aCam.SetDefaults(aCamPos, aLookAt, 80, DEG2RAD(-(double)nZAngle / 10.0)); +/*N*/ aCam.Reset(); +/*N*/ aCam.SetProjection(eProjection); +/*N*/ aCam.RotateAroundLookAt(DEG2RAD((double)nYAngle / 10.0), DEG2RAD((double)nXAngle / 10.0)); +/*N*/ aCam.SetAspectMapping(AS_HOLD_SIZE); +/*N*/ pScene->SetCamera(aCam); +/*N*/ +/*N*/ nY = 0; +/*N*/ +/*N*/ Vector3D a3DPos(nX, nY, nDepth); +/*N*/ Vector3D a3DSize(nW, nH, -nDepth); +/*N*/ +/*N*/ Create3DBackplanes(rRect, a3DPos, a3DSize, *pScene, +/*N*/ bPartDescr, FALSE, bLogarithm, FALSE, CHSTACK_NONE, FALSE, FALSE, +/*N*/ bSwitchColRow); +/*N*/ +/*N*/ nY = (long)(pChartYAxis->CalcFactOrigin() * nH); +/*N*/ a3DPos = Vector3D(0, nY, nDepth - nBarWidthZ + nPartDepth - nGapZ); +/*N*/ +/*N*/ DataDescription aDescription; +/*N*/ +/*N*/ for (nRow = nRowCnt-1; nRow >= 0; nRow--) +/*N*/ { +/*N*/ E3dScene* pStripe = NULL; +/*N*/ +/*N*/ // create row-groups. Insertion into main scene is done at the end of +/*N*/ // the for loop (#109628#) +/*N*/ E3dScene* pRowGroup = Create3DScene (CHOBJID_DIAGRAM_ROWGROUP); +/*N*/ // #102789# some unset attributes may be propagated to the +/*N*/ // top-level scene +/*N*/ pRowGroup->SetItemSet( pScene->GetItemSet() ); +/*N*/ pRowGroup->InsertUserData(new SchDataRow(nRow)); +/*N*/ +/*N*/ if ( eChartStyle == CHSTYLE_3D_STRIPE ) +/*N*/ pStripe = pRowGroup; +/*N*/ +/*N*/ a3DPos.X() = nX; +/*N*/ a3DPos.Y() = nY; +/*N*/ +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ +/*N*/ a3DPos.X() += nGapX; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ +/*N*/ // #67333# the y axis of bar charts is not interrested in negative values +/*N*/ a3DPos.Y() = nGapY; // += nGapY; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ +/*?*/ aBackSide[0] = a3DPos; +/*?*/ aFrontSide[0] = a3DPos; +/*?*/ aFrontSide[0].Z() += nBarWidthZ; +/*?*/ +/*?*/ aFrontExtrude[0] =Point((long)a3DPos.X(),(long)-a3DPos.Y()); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ Vector3D aLastValue; +/*N*/ short nPoints = 0; +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fData = GetData(nCol, nRow); +/*N*/ +/*N*/ SfxItemSet aDataPointAttr(GetFullDataPointAttr(nCol, nRow)); +/*N*/ +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ BOOL bShowDataDescrLocal = (eDescr != CHDESCR_NONE) && bShowDataDescr && // bShowDataDescr is class member +/*N*/ fData != DBL_MIN; +/*N*/ if( bShowDataDescrLocal ) +/*N*/ { + /************************************************************** + * DataDescription erforderlich + **************************************************************/ +/*N*/ +/*?*/ aDescription.eDescr = eDescr; +/*?*/ aDescription.bSymbol = ((const SfxBoolItem&)aDataPointAttr. +/*?*/ Get(SCHATTR_DATADESCR_SHOW_SYM)).GetValue(); +/*N*/ } +/*N*/ +/*N*/ if (eChartStyle == CHSTYLE_3D_COLUMN) +/*N*/ { +/*N*/ double fTop, fBottom; +/*N*/ if (fData < fOriginY) +/*N*/ { +/*?*/ fTop = fOriginY; +/*?*/ fBottom = fData; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fTop = fData; +/*N*/ fBottom = fOriginY; +/*N*/ } +/*N*/ +/*N*/ long nTop = Min((long)(pChartYAxis->CalcFact(fTop) * nH), nH); +/*N*/ long nBottom = Max((long)(pChartYAxis->CalcFact(fBottom) * nH), 0L); +/*N*/ +/*N*/ if( fData != DBL_MIN ) +/*N*/ { +/*N*/ long nBarHeight = nTop - nBottom + 1; +/*N*/ a3DPos.Y() = nBottom; +/*N*/ +/*N*/ if( nTop > nBottom ) +/*N*/ pRowGroup->Insert3DObj(Create3DBar(a3DPos, Vector3D(nBarWidthX, nBarHeight, nBarWidthZ), nCol, nRow, +/*N*/ aDataPointAttr, FALSE,0,pChartYAxis->CalcFactOrigin()*(double)nH,0)); +/*N*/ +/*N*/ if( bShowDataDescrLocal ) +/*N*/ { +/*?*/ aDescription.aTextPos3D = a3DPos; +/*?*/ aDescription.aTextPos3D.X() += nBarWidthX / 2; +/*?*/ aDescription.aTextPos3D.Y() += (fData<0)? 0: nBarHeight; +/*?*/ aDescription.aTextPos3D.Z() += nBarWidthZ / 2; +/*?*/ aDescription.fValue = GetData(nCol, nRow, // #67378# +/*?*/ ((aDescription.eDescr == CHDESCR_PERCENT) || +/*?*/ (aDescription.eDescr == CHDESCR_TEXTANDPERCENT)) ); +/*?*/ aDescription.eAdjust = CHADJUST_CENTER_CENTER; +/*N*/ } +/*N*/ } +/*N*/ else if (bShowDataDescrLocal) +/*N*/ { +/*N*/ aDescription.fValue = DBL_MIN; +/*N*/ } +/*N*/ } +/*N*/ else if (eChartStyle == CHSTYLE_3D_BAR) +/*N*/ { +/*N*/ double fRight, fLeft; +/*N*/ if (fData < fOriginY) +/*N*/ { +/*?*/ fRight = fOriginY; +/*?*/ fLeft = fData; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fRight = fData; +/*N*/ fLeft = fOriginY; +/*N*/ } +/*N*/ +/*N*/ long nRight = Min((long)(pChartYAxis->CalcFact(fRight) * nW), nW); +/*N*/ long nLeft = Max((long)(pChartYAxis->CalcFact(fLeft) * nW), 0L); +/*N*/ +/*N*/ if( fData != DBL_MIN ) +/*N*/ { +/*N*/ long nBarWidth = nRight - nLeft + 1; +/*N*/ a3DPos.X() = nLeft; +/*N*/ +/*N*/ if( nRight > nLeft ) +/*N*/ pRowGroup->Insert3DObj(Create3DBar(a3DPos, Vector3D(nBarWidth, nBarWidthX, nBarWidthZ), nCol, nRow, +/*N*/ aDataPointAttr,FALSE,0,pChartYAxis->CalcFactOrigin()*(double)nW,0)); +/*N*/ +/*N*/ if (bShowDataDescrLocal) +/*N*/ { +/*?*/ aDescription.aTextPos3D = a3DPos; +/*?*/ +/*?*/ // #67379# corrected orientation of description +/*?*/ aDescription.aTextPos3D.X() += (fData<0)? 0: nBarWidth; +/*?*/ aDescription.aTextPos3D.Y() += nBarWidthX / 2; +/*?*/ aDescription.aTextPos3D.Z() += nBarWidthZ / 2; +/*?*/ +/*?*/ aDescription.fValue = GetData(nCol, nRow, // #67378# +/*?*/ ((aDescription.eDescr == CHDESCR_PERCENT) || +/*?*/ (aDescription.eDescr == CHDESCR_TEXTANDPERCENT)) ); +/*?*/ aDescription.eAdjust = CHADJUST_CENTER_CENTER; +/*N*/ } +/*N*/ } +/*N*/ else if (bShowDataDescrLocal) +/*N*/ { +/*?*/ aDescription.fValue = DBL_MIN; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ long nPos = (long)(pChartYAxis->CalcFact(fData ) * nH); +/*?*/ if (nPos < 0L) nPos = 0L; +/*?*/ else if (nPos > nH) nPos = nH; +/*?*/ +/*?*/ const SfxItemSet& rDataRowAttr = GetDataRowAttr(nRow); +/*?*/ +/*?*/ a3DPos.Y() = nPos; +/*?*/ +/*?*/ switch (eChartStyle) +/*?*/ { +/*?*/ case CHSTYLE_3D_STRIPE: +/*?*/ case CHSTYLE_3D_AREA: +/*?*/ { +/*?*/ UINT16 nRev = nColCnt + 1 - nPoints; +/*?*/ BOOL bValidData = TRUE; +/*?*/ +/*?*/ if ((eChartStyle == CHSTYLE_3D_AREA) && (fData == DBL_MIN)) +/*?*/ { +/*?*/ fData = 0.0; +/*?*/ bValidData = FALSE; +/*?*/ } +/*?*/ +/*?*/ if (fData != DBL_MIN) +/*?*/ { +/*?*/ //Stripes: +/*?*/ aFrontSide[nRev] = a3DPos; +/*?*/ aFrontSide[nRev].Z() += nBarWidthZ; +/*?*/ aBackSide[nPoints] = a3DPos; +/*?*/ //Area: +/*?*/ aFrontExtrude[nRev] = Point((long)a3DPos.X(),(long)-a3DPos.Y()); +/*?*/ +/*?*/ if (!nPoints) +/*?*/ { +/*?*/ //Stripes: +/*?*/ aFrontSide[0] = a3DPos; +/*?*/ aFrontSide[0].Y() = 0; +/*?*/ aFrontSide[0].Z() += nBarWidthZ; +/*?*/ aBackSide[nColCnt + 1] = aFrontSide[0]; +/*?*/ //Area: +/*?*/ aFrontExtrude[0].X() = (long)a3DPos.X(); +/*?*/ aFrontExtrude[0].Y() = 0; +/*?*/ } +/*?*/ else if(eChartStyle == CHSTYLE_3D_STRIPE) +/*?*/ { +/*?*/ if (nColCnt > 1) +/*?*/ { +/*?*/ // deckel +/*?*/ aRect3D[0] = aBackSide[nPoints - 1]; +/*?*/ aRect3D[1] = aFrontSide[nRev + 1]; +/*?*/ aRect3D[2] = aFrontSide[nRev]; +/*?*/ aRect3D[3] = aBackSide[nPoints]; +/*?*/ E3dPolygonObj *pPolyObj=new SchE3dPolygonObj (aDefltAttr3D, aRect3D); +/*?*/ +/*?*/ //-/ pPolyObj->SetDoubleSided(TRUE); //Neu 18.5.98 +/*?*/ pPolyObj->SetItem(Svx3DDoubleSidedItem(TRUE)); //Neu 18.5.98 +/*?*/ +/*?*/ Create3DPolyObject (&rDataRowAttr,pPolyObj,CHOBJID_AREA, pStripe); +/*?*/ } +/*?*/ } +/*?*/ nPoints ++; +/*?*/ } +/*?*/ else bValidData = FALSE; +/*?*/ +/*?*/ if (nPoints && (eChartStyle==CHSTYLE_3D_AREA) && (nCol==nColCnt-1)) +/*?*/ { +/*?*/ Vector3D aFill = (fData == DBL_MIN) ? aLastValue : a3DPos; +/*?*/ for (short nFill = nPoints;nFill <= nColCnt;nFill ++) +/*?*/ { +/*?*/ //aFrontSide wird noch für die Beschriftung gebraucht +/*?*/ aFrontSide[nColCnt+1-nFill]=aFill; +/*?*/ aFrontSide[nColCnt+1-nFill].Y()=0; +/*?*/ aFrontSide[nColCnt+1-nFill].Z() += nBarWidthZ; +/*?*/ aFrontExtrude[nColCnt+1-nFill]=Point((long)aFill.X(),0); +/*?*/ } +/*?*/ +/*?*/ if (nColCnt > 1) +/*?*/ { +/*?*/ PolyPolygon aPolyPoly; +/*?*/ aFrontExtrude[nColCnt*2]=aFrontExtrude[0]; +/*?*/ aPolyPoly.Insert(aFrontExtrude); +/*?*/ E3dExtrudeObj* pExtrudeObj= new SchE3dExtrudeObj(aDefltAttr3D, aPolyPoly, nBarWidthZ); +/*?*/ Matrix4D aMatrix; +/*?*/ aMatrix.Translate(Vector3D(0,0,a3DPos.Z() )); //nDepth - nBarWidthZ + nPartDepth - nGapZ +/*?*/ pExtrudeObj->NbcSetTransform(aMatrix); +/*?*/ Create3DExtrudePolyObj(&rDataRowAttr,pExtrudeObj,CHOBJID_AREA,pRowGroup); +/*?*/ } +/*?*/ } //Area +/*?*/ +/*?*/ if (fData == DBL_MIN) nPoints = 0; +/*?*/ +/*?*/ if (bShowDataDescrLocal) +/*?*/ { +/*?*/ aDescription.aTextPos3D = aFrontSide[nRev]; +/*?*/ +/*?*/ if (bValidData) +/*?*/ { +/*?*/ if ((aDescription.eDescr == CHDESCR_PERCENT) || +/*?*/ (aDescription.eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ aDescription.fValue = GetData (nCol, nRow, TRUE, TRUE); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ aDescription.fValue = GetData (nCol, nRow); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ aDescription.fValue = DBL_MIN; +/*?*/ } +/*?*/ +/*?*/ aDescription.eAdjust = CHADJUST_CENTER_CENTER; +/*?*/ } +/*?*/ +/*?*/ break; +/*?*/ } +/*?*/ +/*?*/ case CHSTYLE_3D_SURFACE: +/*?*/ if (nColCnt > 1) +/*?*/ { +/*?*/ aTriangle3D[0] = a3DPos; +/*?*/ aTriangle3D[1] = a3DPos; +/*?*/ aTriangle3D[1].Z() += nPartDepth; +/*?*/ aTriangle3D[1].Y() = +/*?*/ (long)(pChartYAxis->CalcFact(GetData(nCol, nRow-1)) * nH); +/*?*/ aTriangle3D[2] = aTriangle3D[1]; +/*?*/ aTriangle3D[2].X() += nPartWidth; +/*?*/ aTriangle3D[2].Y() = +/*?*/ (long)(pChartYAxis->CalcFact(GetData(nCol+1, nRow-1)) * nH); +/*?*/ aTriangle3D[3] = aTriangle3D[2]; +/*?*/ aTriangle3D[3].Z() -= nPartDepth; +/*?*/ aTriangle3D[3].Y() = +/*?*/ (long)(pChartYAxis->CalcFact(GetData(nCol+1, nRow)) * nH); +/*?*/ +/*?*/ Create3DPolyObject (&rDataRowAttr, new SchE3dPolygonObj (aDefltAttr3D, aTriangle3D, TRUE, TRUE), +/*?*/ CHOBJID_AREA, pRowGroup); +/*?*/ +/*?*/ aTriangle3D[0] = aTriangle3D[1]; +/*?*/ aTriangle3D[1] = aTriangle3D[2]; +/*?*/ aTriangle3D[2] = a3DPos; +/*?*/ Create3DPolyObject (&rDataRowAttr, new SchE3dPolygonObj (aDefltAttr3D, aTriangle3D, TRUE, TRUE), +/*?*/ CHOBJID_AREA, pRowGroup); +/*?*/ } +/*?*/ break; +/*?*/ } +/*?*/ } +/*N*/ +/*N*/ aLastValue = a3DPos; +/*N*/ if (eChartStyle == CHSTYLE_3D_BAR) a3DPos.Y() += nPartWidth; +/*N*/ else a3DPos.X() += nPartWidth; +/*N*/ +/*N*/ if( pScene && bShowDataDescrLocal ) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ CreateDataDescr( aDescription, nCol, nRow, NULL, FALSE, TRUE ); +/*N*/ } +/*N*/ +/*N*/ }// end for nCol +/*N*/ +/*N*/ // #109628# insert row groups into main scene only if they contain data +/*N*/ // points +/*N*/ if( pRowGroup->GetSubList()->GetObjCount() > 0 ) +/*N*/ { +/*?*/ pScene->Insert3DObj( pRowGroup ); +/*N*/ } + + /*Dirty3D (nColCnt, nRow, TRUE, pDescription, (eDataDescr != CHDESCR_NONE) && bShowDataDescr + ? pScene + : NULL); + */ +/*N*/ a3DPos.Z() += nPartDepth; +/*N*/ }//end for nRow +/*N*/ +/*N*/ return (SdrObjGroup*) pScene; +/*N*/ } + +/************************************************************************* +|* +|* flache 3D-Diagramme erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjGroup* ChartModel::Create3DFlatChart(Rectangle &rRect) +/*N*/ { +/*N*/ const long nGapWidth = 10; +/*N*/ +/*N*/ pScene = CreateScene (rRect, *aLightVec, fSpotIntensity, aSpotColor, +/*N*/ fAmbientIntensity, aAmbientColor); +/*N*/ +/*N*/ Vector3D aTextPos3D; +/*N*/ +/*N*/ Polygon3D aFrontSide; +/*N*/ +/*N*/ BOOL bSwitchColRow = IsBar(); +/*N*/ E3dDefaultAttributes aDefltAttr3D; +/*N*/ +/*N*/ CreateAndInsert3DAxesTitles (rRect, bSwitchColRow); +/*N*/ +/*N*/ BOOL bPercent = IsPercent(); +/*N*/ +/*N*/ +/*N*/ USHORT eStackMode; +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ eStackMode = CHSTACK_MINMAX; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ eStackMode = CHSTACK_OVERLAP; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ eStackMode = CHSTACK_NONE; +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ long nX = 0; +/*N*/ long nY = 0; +/*N*/ long nW = FIXED_SIZE_FOR_3D_CHART_VOLUME; +/*N*/ long nH = FIXED_SIZE_FOR_3D_CHART_VOLUME; +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ long nCol, nRow; +/*N*/ +/*N*/ long nGapX = nW * nGapWidth / 1000; +/*N*/ long nGapY = nH * nGapWidth / 1000; +/*N*/ long nGapZ = nW * nGapWidth / 1000; +/*N*/ long nPartDepth = nW / nRowCnt; +/*N*/ long nPartWidth; +/*N*/ long nColWidthX; +/*N*/ long nBarWidthX; +/*N*/ long nBarWidthZ = nPartDepth - nGapZ * 2; +/*N*/ long nDepth = -nPartDepth; +/*N*/ +/*N*/ SfxItemSet* pYAxisAttr = pChartYAxis->GetItemSet(); +/*N*/ // BOOL bLogarithm = ((const SfxBoolItem&) pYAxisAttr->Get(SCHATTR_Y_AXIS_LOGARITHM)).GetValue(); +/*N*/ BOOL bLogarithm = ((const SfxBoolItem&) pYAxisAttr->Get(SCHATTR_AXIS_LOGARITHM)).GetValue(); +/*N*/ BOOL bPartDescr; +/*N*/ +/*N*/ Polygon aFrontExtrude(1+nColCnt*2); +/*N*/ +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ { +/*N*/ aFrontSide.SetPointCount(nColCnt*2); +/*N*/ nPartWidth = nW / ((nColCnt > 1) ? nColCnt - 1 : nColCnt); +/*N*/ nColWidthX = 0; +/*N*/ nBarWidthX = 0; +/*N*/ bPartDescr = FALSE; +/*N*/ break; +/*N*/ } +/*N*/ default: +/*N*/ { +/*N*/ nPartWidth = bSwitchColRow +/*N*/ ? nH / nColCnt +/*N*/ : nW / nColCnt; +/*N*/ nColWidthX = bSwitchColRow +/*N*/ ? nPartWidth - nGapY * 2 +/*N*/ : nPartWidth - nGapX * 2; +/*N*/ nBarWidthX = ((eChartStyle == CHSTYLE_3D_FLATCOLUMN) || (eChartStyle == CHSTYLE_3D_FLATBAR)) +/*N*/ ? nColWidthX / nRowCnt +/*N*/ : 0; +/*N*/ bPartDescr = TRUE; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ Camera3D aCam(pScene->GetCamera()); +/*N*/ Vector3D aCamPos(nX + nW/2, nH/2, nW/2); +/*N*/ Vector3D aLookAt(nX + nW/2, nH/2, nDepth/2); +/*N*/ aCam.SetViewWindow(-nW/2, -nH/2, nW, nH); +/*N*/ aCam.SetDefaults(aCamPos, aLookAt, 80, DEG2RAD(-(double)nZAngle / 10.0)); +/*N*/ aCam.Reset(); +/*N*/ aCam.SetProjection(eProjection); +/*N*/ aCam.RotateAroundLookAt(DEG2RAD((double)nYAngle / 10.0), DEG2RAD((double)nXAngle / 10.0)); +/*N*/ aCam.SetAspectMapping(AS_HOLD_SIZE); +/*N*/ pScene->SetCamera(aCam); +/*N*/ +/*N*/ nY = 0; +/*N*/ Vector3D a3DPos(nX, nY, nDepth); +/*N*/ Vector3D a3DSize(nW, nH, -nDepth); +/*N*/ +/*N*/ Create3DBackplanes(rRect, a3DPos, a3DSize, *pScene, +/*N*/ bPartDescr, FALSE, bLogarithm, FALSE, eStackMode, bPercent, TRUE, +/*N*/ bSwitchColRow); +/*N*/ +/*N*/ a3DPos = Vector3D(nX, nY, nDepth - nBarWidthZ + nPartDepth - nGapZ); +/*N*/ +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ { +/*N*/ DataDescription* pDescription = NULL; +/*N*/ +/*N*/ double* fOldData = new double[nColCnt]; +/*N*/ a3DPos.Z() += nBarWidthZ; +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ E3dScene* pRowGroup = Create3DScene (CHOBJID_DIAGRAM_ROWGROUP); +/*N*/ pScene->Insert3DObj(pRowGroup); +/*N*/ +/*N*/ pRowGroup->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ +/*N*/ const SfxItemSet& rDataRowAttr = GetDataRowAttr(nRow); +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fData = fabs(GetData(nCol, nRow, bPercent)); +/*N*/ SfxItemSet aDataPointAttr (GetFullDataPointAttr(nCol, nRow)); +/*N*/ BOOL bValidData; +/*N*/ +/*N*/ if (fData == DBL_MIN) +/*N*/ { +/*?*/ fData = 0.0; +/*?*/ bValidData = FALSE; +/*N*/ } +/*N*/ else bValidData = TRUE; +/*N*/ +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ if( (eDescr != CHDESCR_NONE) && bShowDataDescr) +/*N*/ { + /****************************************************** + * DataDescription erforderlich + ******************************************************/ +/*?*/ if (!pDescription) +/*?*/ { +/*?*/ // DataDescription noch nicht vorhanden -> erzeugen +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pDescription = new DataDescription [nColCnt]; +/*?*/ //STRIP001 ClearDataDescription(pDescription,nColCnt); +/*?*/ } +/*?*/ +/*?*/ pDescription [nCol].eDescr = eDescr; +/*?*/ pDescription [nCol].bSymbol = ((const SfxBoolItem&)aDataPointAttr. +/*?*/ Get(SCHATTR_DATADESCR_SHOW_SYM)).GetValue(); +/*N*/ } +/*N*/ +/*N*/ long nRev = nColCnt * 2 - 1 - nCol; +/*N*/ +/*N*/ if (!nRow) +/*N*/ { +/*N*/ a3DPos.Y() = Min((long)(pChartYAxis->CalcFact(fData) * nH), nH); +/*N*/ aFrontSide[(UINT16)nRev] = a3DPos; +/*N*/ aFrontSide[(UINT16)nCol] = a3DPos; +/*N*/ aFrontSide[(UINT16)nCol].Y() = 0; +/*N*/ aFrontExtrude[(UINT16)nRev] = Point((long)a3DPos.X(),(long)-a3DPos.Y()); +/*N*/ aFrontExtrude[(UINT16)nCol] = Point((long)a3DPos.X(),(long)-a3DPos.Y()); +/*N*/ aFrontExtrude[(UINT16)nCol].Y()= 0; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fData = fOldData[nCol] + fData; +/*N*/ a3DPos.Y() = Min((long)(pChartYAxis->CalcFact(fData) * nH), nH); +/*N*/ aFrontSide[(UINT16)nCol] = aFrontSide[(UINT16)nRev]; +/*N*/ aFrontSide[(UINT16)nRev] = a3DPos; +/*N*/ aFrontExtrude[(UINT16)nCol] = aFrontExtrude[(UINT16)nRev]; +/*N*/ aFrontExtrude[(UINT16)nRev]=Point((long)a3DPos.X(),(long)-a3DPos.Y()); +/*N*/ } +/*N*/ +/*N*/ fOldData[nCol] = fData; +/*N*/ +/*N*/ if (pDescription) +/*N*/ { +/*?*/ pDescription [nCol].aTextPos3D = aFrontSide[(UINT16)nRev]; +/*?*/ pDescription [nCol].aTextPos3D.Y() -= (aFrontSide[(UINT16)nRev].Y() - aFrontSide[(UINT16)nCol].Y()) / 2; +/*?*/ +/*?*/ if (bValidData) +/*?*/ { +/*?*/ if ((pDescription [nCol].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nCol].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ pDescription [nCol].fValue = GetData (nCol, nRow, TRUE, TRUE); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDescription [nCol].fValue = GetData(nCol,nRow,FALSE);//#55586# fData; +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDescription [nCol].fValue = DBL_MIN; +/*?*/ } +/*?*/ +/*?*/ pDescription [nCol].eAdjust = CHADJUST_CENTER_CENTER; +/*?*/ +/*?*/ if( eDescr != CHDESCR_NONE && bValidData ) +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 CreateDataDescr( pDescription[ nCol ], nCol, nRow, NULL, FALSE, TRUE ); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ a3DPos.X() += nPartWidth; +/*N*/ } //end for nCol +/*N*/ +/*N*/ if (nColCnt > 1) +/*N*/ { +/*N*/ +/*N*/ PolyPolygon aPolyPoly; +/*N*/ aFrontExtrude[nColCnt*2]=aFrontExtrude[0];//.SetClosed(TRUE); +/*N*/ aPolyPoly.Insert(aFrontExtrude); +/*N*/ +/*N*/ E3dExtrudeObj* pExtrudeObj= new SchE3dExtrudeObj(aDefltAttr3D, aPolyPoly,nBarWidthZ); +/*N*/ Matrix4D aMatrix; +/*N*/ aMatrix.Translate(Vector3D(0,0,nDepth - nBarWidthZ + nPartDepth - nGapZ )); //-(double)nBarWidthZ +/*N*/ pExtrudeObj->NbcSetTransform(aMatrix); +/*N*/ //#54870# falsche ID:CHOBJID_DIAGRAM_AREA +/*N*/ Create3DExtrudePolyObj(&rDataRowAttr,pExtrudeObj,CHOBJID_AREA,pRowGroup); +/*N*/ } +/*N*/ a3DPos.X() = nX; +/*N*/ }//end for nRow +/*N*/ +/*N*/ delete[] fOldData; +/*N*/ delete[] pDescription; +/*N*/ break; +/*N*/ } // end case Area's +/*N*/ +/*N*/ default: +/*N*/ { +/*N*/ DataDescription* pDescription = NULL; +/*N*/ +/*N*/ if (bSwitchColRow) a3DPos.Y() += nGapY; +/*N*/ else a3DPos.X() += nGapX; +/*N*/ +/*N*/ // #100288# same structure as all other charts (no stacked and special groups) +/*N*/ // create groups for all series +/*N*/ E3dScene ** pDataGroup = new E3dScene * [ nRowCnt ]; +/*N*/ +/*N*/ // create 3d sub-scenes for each data series. Insertion into the +/*N*/ // main scene is done at the end of the for loop (#109628#) +/*N*/ for( nRow = 0; nRow < nRowCnt; nRow++ ) +/*N*/ { +/*N*/ pDataGroup[ nRow ] = Create3DScene( CHOBJID_DIAGRAM_ROWGROUP ); +/*N*/ pDataGroup[ nRow ]->InsertUserData( new SchDataRow( static_cast< short >( nRow ) )); +/*N*/ } +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fDataTop = fOriginY; +/*N*/ double fDataBottom = fOriginY; +/*N*/ +/*N*/ //Vor-Berechnung des Maximalen/Minimalen Zeichenpunktes +/*N*/ double fPreBottom=fOriginY; +/*N*/ double fPreTop =fOriginY; +/*N*/ double fPreTopPos,fPreBottomPos,fPreOriPos; +/*N*/ double fTop,fBottom,fMin,fMax,fMin2,fMax2; +/*N*/ fMin2=fMax2=fOriginY; +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ double fData=GetData(nCol, nRow, bPercent); +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ if (fData < fOriginY) +/*N*/ { +/*?*/ fTop = fPreBottom; +/*?*/ if (fTop == fOriginY) +/*?*/ fPreBottom = fData; +/*?*/ else +/*?*/ fPreBottom += fData; +/*?*/ fBottom = fPreBottom; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fBottom = fPreTop; +/*N*/ if (fBottom == fOriginY) +/*N*/ fPreTop = fData; +/*N*/ else +/*N*/ fPreTop += fData; +/*N*/ fTop = fPreTop; +/*N*/ } +/*N*/ } +/*N*/ if(nRow) +/*N*/ { +/*N*/ if(fTop<fMin) +/*N*/ fMin=fTop; +/*N*/ if(fBottom>fMax) +/*N*/ fMax=fBottom; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fMin=fTop; +/*N*/ fMax=fBottom; +/*N*/ } +/*N*/ if(fData<fOriginY) +/*N*/ fMin2-=fData; //top,left +/*N*/ else +/*N*/ fMax2+=fData; //right,bottom +/*N*/ } +/*N*/ +/*N*/ double fR = (double)( IsBar()? nW: nH ); +/*N*/ fPreTopPos = pChartYAxis->CalcFact( fMin2 ) * fR; +/*N*/ if( fR < fPreTopPos ) +/*N*/ fPreTopPos = fR; +/*N*/ fPreBottomPos = pChartYAxis->CalcFact( fMax2 ) * fR; +/*N*/ if( fPreBottomPos < 0.0 ) +/*N*/ fPreBottomPos = 0.0; +/*N*/ fPreOriPos = pChartYAxis->CalcFactOrigin() * fR; +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ double fData = GetData(nCol, nRow, bPercent); +/*N*/ SfxItemSet aDataPointAttr(GetFullDataPointAttr(nCol, nRow)); +/*N*/ +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ if( (eDescr != CHDESCR_NONE) && bShowDataDescr) +/*N*/ { + /****************************************************** + * DataDescription erforderlich + ******************************************************/ +/*?*/ if (!pDescription) +/*?*/ { +/*?*/ // DataDescription noch nicht vorhanden -> erzeugen +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pDescription = new DataDescription [nRowCnt]; +/*?*/ } +/*?*/ +/*?*/ pDescription [nRow].eDescr = eDescr; +/*?*/ pDescription [nRow].bSymbol = ((const SfxBoolItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_SHOW_SYM)).GetValue(); +/*N*/ } +/*N*/ +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_3D_FLATCOLUMN: +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ double fTop; +/*N*/ double fBottom; +/*N*/ +/*N*/ if (fData < fOriginY) +/*N*/ { +/*?*/ fTop = fOriginY; +/*?*/ fBottom = fData; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fTop = fData; +/*N*/ fBottom = fOriginY; +/*N*/ } +/*N*/ +/*N*/ long nBottom = Max ((long) (pChartYAxis->CalcFact(fBottom) * nH),0L); +/*N*/ long nTop = Min ((long) (pChartYAxis->CalcFact(fTop) * nH),nH); +/*N*/ +/*N*/ { +/*N*/ long nBarHeight = nTop - nBottom + 1; +/*N*/ a3DPos.Y() = nBottom; +/*N*/ +/*N*/ if (nTop > nBottom) +/*N*/ pDataGroup[ nRow ]->Insert3DObj(Create3DBar(a3DPos, Vector3D(nBarWidthX, nBarHeight, nBarWidthZ), nCol, nRow, +/*N*/ aDataPointAttr,TRUE,0,fPreOriPos,0)); +/*N*/ +/*N*/ if (pDescription) +/*N*/ { +/*?*/ pDescription [nRow].aTextPos3D = a3DPos; +/*?*/ pDescription [nRow].aTextPos3D.X() += nBarWidthX / 2; +/*?*/ pDescription [nRow].aTextPos3D.Y() += (fData<0)? 0: nBarHeight; +/*?*/ pDescription [nRow].aTextPos3D.Z() += nBarWidthZ; +/*?*/ +/*?*/ if ((pDescription [nRow].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nRow].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData (nCol, nRow, TRUE, TRUE); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData(nCol,nRow,FALSE);//#55586# fData; +/*?*/ } +/*?*/ +/*?*/ pDescription [nRow].eAdjust = CHADJUST_CENTER_CENTER; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if (pDescription) +/*N*/ { +/*?*/ pDescription [nRow].fValue = DBL_MIN; +/*N*/ } +/*N*/ +/*N*/ a3DPos.X() += nBarWidthX; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ double fRight; +/*N*/ double fLeft; +/*N*/ +/*N*/ if (fData < fOriginY) +/*N*/ { +/*?*/ fRight = fOriginY; +/*?*/ fLeft = fData; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fLeft = fOriginY; +/*N*/ fRight = fData; +/*N*/ } +/*N*/ +/*N*/ long nLeft = Max ((long) (pChartYAxis->CalcFact(fLeft) * nW),0L); +/*N*/ long nRight = Min ((long)(pChartYAxis->CalcFact(fRight) * nW),nW); +/*N*/ +/*N*/ { +/*N*/ long nBarWidth = nRight - nLeft + 1; +/*N*/ a3DPos.X() = nLeft; +/*N*/ +/*N*/ if (nRight > nLeft) +/*N*/ pDataGroup[ nRow ]->Insert3DObj(Create3DBar(a3DPos, Vector3D(nBarWidth, nBarWidthX, nBarWidthZ), nCol, nRow, +/*N*/ aDataPointAttr,TRUE,0,fPreOriPos,0)); +/*N*/ +/*N*/ if (pDescription) +/*N*/ { +/*?*/ pDescription [nRow].aTextPos3D = a3DPos; +/*?*/ pDescription [nRow].aTextPos3D.X() += (fData<0)? 0: nBarWidth; +/*?*/ pDescription [nRow].aTextPos3D.Y() += nBarWidthX / 2; +/*?*/ pDescription [nRow].aTextPos3D.Z() += nBarWidthZ; +/*?*/ +/*?*/ if ((pDescription [nRow].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nRow].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData (nCol, nRow, TRUE, TRUE); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData(nCol,nRow,FALSE);//#55586# fData; +/*?*/ } +/*?*/ +/*?*/ pDescription [nRow].eAdjust = CHADJUST_CENTER_CENTER; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if (pDescription) +/*N*/ { +/*?*/ pDescription [nRow].fValue = DBL_MIN; +/*N*/ } +/*N*/ +/*N*/ a3DPos.Y() += nBarWidthX; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*?*/ double fTop; +/*?*/ double fBottom; +/*?*/ +/*?*/ if (fData < fOriginY) +/*?*/ { +/*?*/ fTop = fDataBottom; +/*?*/ if (fTop == fOriginY) fDataBottom = fData; +/*?*/ else fDataBottom += fData; +/*?*/ fBottom = fDataBottom; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fBottom = fDataTop; +/*N*/ if (fBottom == fOriginY) fDataTop = fData; +/*N*/ else fDataTop += fData; +/*N*/ fTop = fDataTop; +/*N*/ } +/*N*/ +/*N*/ long nTop = Min((long)(pChartYAxis->CalcFact(fTop) * nH), nH); +/*N*/ long nBottom = Max((long)(pChartYAxis->CalcFact(fBottom) * nH),0L); +/*N*/ +/*N*/ { +/*N*/ long nBarHeight = nTop - nBottom + 1; +/*N*/ a3DPos.Y() = nBottom; +/*N*/ +/*N*/ if (nTop > nBottom) +/*N*/ pDataGroup[ nRow ]->Insert3DObj(Create3DBar(a3DPos, Vector3D(nColWidthX, nBarHeight, nBarWidthZ), nCol, nRow, +/*N*/ aDataPointAttr,TRUE,fPreBottomPos,fPreOriPos,fPreTopPos)); +/*N*/ +/*N*/ if (pDescription) +/*?*/ { +/*?*/ pDescription [nRow].aTextPos3D = a3DPos; +/*?*/ pDescription [nRow].aTextPos3D.X() += nColWidthX / 2; +/*?*/ pDescription [nRow].aTextPos3D.Y() += nBarHeight / 2; +/*?*/ pDescription [nRow].aTextPos3D.Z() += nBarWidthZ; +/*?*/ +/*?*/ if ((pDescription [nRow].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nRow].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData (nCol, nRow, TRUE, TRUE); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData(nCol,nRow,FALSE);//#55586# fData; +/*?*/ } +/*?*/ +/*?*/ pDescription [nRow].eAdjust = CHADJUST_CENTER_CENTER; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if (pDescription) +/*N*/ { +/*?*/ pDescription [nRow].fValue = DBL_MIN; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ if (fData != DBL_MIN) +/*N*/ { +/*N*/ double fRight; +/*N*/ double fLeft; +/*N*/ +/*N*/ if (fData < fOriginY) +/*N*/ { +/*?*/ fRight = fDataBottom; +/*?*/ if (fRight == fOriginY) fDataBottom = fData; +/*?*/ else fDataBottom += fData; +/*?*/ fLeft = fDataBottom; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fLeft = fDataTop; +/*N*/ if (fLeft == fOriginY) fDataTop = fData; +/*N*/ else fDataTop += fData; +/*N*/ fRight = fDataTop; +/*N*/ } +/*N*/ +/*N*/ long nRight = Min((long)(pChartYAxis->CalcFact(fRight) * nW), nW); +/*N*/ long nLeft = Max((long) (pChartYAxis->CalcFact(fLeft ) * nW), 0L); +/*N*/ +/*N*/ { +/*N*/ long nBarWidth = nRight - nLeft + 1; +/*N*/ a3DPos.X() = nLeft; +/*N*/ +/*N*/ if (nRight > nLeft) +/*N*/ pDataGroup[ nRow ]->Insert3DObj(Create3DBar(a3DPos, Vector3D(nBarWidth, nColWidthX, nBarWidthZ), nCol, nRow, +/*N*/ aDataPointAttr,TRUE,fPreBottomPos,fPreOriPos,fPreTopPos)); +/*N*/ +/*N*/ if (pDescription) +/*N*/ { +/*?*/ pDescription [nRow].aTextPos3D = a3DPos; +/*?*/ pDescription [nRow].aTextPos3D.X() += nBarWidth / 2; +/*?*/ pDescription [nRow].aTextPos3D.Y() += nColWidthX / 2; +/*?*/ pDescription [nRow].aTextPos3D.Z() += nBarWidthZ; +/*?*/ +/*?*/ if ((pDescription [nRow].eDescr == CHDESCR_PERCENT) || +/*?*/ (pDescription [nRow].eDescr == CHDESCR_TEXTANDPERCENT)) +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData (nCol, nRow, TRUE, TRUE); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDescription [nRow].fValue = GetData(nCol,nRow,FALSE);//#55586# fData; +/*?*/ } +/*?*/ +/*?*/ pDescription [nRow].eAdjust = CHADJUST_CENTER_CENTER; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else if (pDescription) +/*N*/ { +/*?*/ pDescription [nRow].fValue = DBL_MIN; +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //Dirty3D (nRowCnt, nCol, TRUE, pDescription, (eDataDescr != CHDESCR_NONE)&& bShowDataDescr +/*N*/ // ? pScene +/*N*/ // : NULL); +/*N*/ +/*N*/ // BM: moved here from Dirty3D. +/*N*/ if( pDescription ) +/*N*/ { +/*?*/ for (nRow = 0; nRow < nRowCnt; nRow ++) +/*?*/ { +/*?*/ if (pScene && pDescription[nRow].fValue != DBL_MIN) +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 CreateDataDescr(pDescription[nRow], nCol, nRow, NULL, TRUE, TRUE); +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (bSwitchColRow) +/*N*/ { +/*N*/ a3DPos.Y() += nBarWidthX ? nGapY * 2 : nPartWidth; +/*N*/ a3DPos.X() = 0; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ a3DPos.X() += nBarWidthX ? nGapX * 2 : nPartWidth; +/*N*/ a3DPos.Y() = 0; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // insert the data series sub-scenes if they contain any data points +/*N*/ // (inserting empty scenes may corrupt the camera parameters of the +/*N*/ // main scene. See #109628#) +/*N*/ for( nRow = 0; nRow < nRowCnt; nRow++ ) +/*N*/ { +/*?*/ // sublist always exists +/*?*/ if( pDataGroup[ nRow ]->GetSubList()->GetObjCount() > 0 ) +/*?*/ pScene->Insert3DObj( pDataGroup[ nRow ] ); +/*N*/ } +/*N*/ +/*N*/ delete[] pDescription; +/*N*/ delete[] pDataGroup; +/*N*/ +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return (SdrObjGroup*) pScene; +/*N*/ } + +/************************************************************************* +|* +|* 3D-Kreisdiagramm erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjGroup* ChartModel::Create3DNewPieChart(Rectangle &rRect) +/*N*/ { +/*N*/ SdrObjList *pList=NULL; +/*N*/ +/*N*/ pChartYAxis->SetPercentMode( FALSE ); // percent is calculated using the row rather than the column +/*N*/ +/*N*/ pScene = CreateScene (rRect, *aLightVec, fSpotIntensity, aSpotColor, +/*N*/ fAmbientIntensity, aAmbientColor); +/*N*/ const long nSize=FIXED_SIZE_FOR_3D_CHART_VOLUME; +/*N*/ +/*N*/ long nW = nSize; +/*N*/ long nH = nSize; +/*N*/ long nZ = nSize;//(nSize * 4) / 6; +/*N*/ +/*N*/ //erweiterung auf Donuts emöglichen! +/*N*/ long nColCnt = GetColCount(); +/*N*/ const short nRowCnt=1;// long nRowCnt = GetRowCount(); +/*N*/ const short nRow=0; +/*N*/ short nCol;//, nRow; +/*N*/ +/*N*/ long nZExtrude=nZ/3; +/*N*/ +/*N*/ Camera3D aCam(pScene->GetCamera()); +/*N*/ const long nDepth=-nZ; +/*N*/ +/*N*/ Vector3D aCamPos(0,0,nW/2); +/*N*/ Vector3D aLookAt(0,0,nDepth/2); +/*N*/ aCam.SetViewWindow(-nW/2, -nH/2, nW, nH); +/*N*/ aCam.SetDefaults(aCamPos, aLookAt, 80, DEG2RAD(-(double)nZAngle / 10.0)); +/*N*/ aCam.Reset(); +/*N*/ aCam.SetProjection(eProjection); +/*N*/ +/*N*/ aCam.SetAspectMapping(AS_HOLD_SIZE); +/*N*/ pScene->SetCamera(aCam); +/*N*/ pScene->SetTransform(aSceneMatrix); +/*N*/ +/*N*/ // Pie charts may not have titles of axes. +/*N*/ bShowXAxisTitle = FALSE; +/*N*/ bShowYAxisTitle = FALSE; +/*N*/ bShowZAxisTitle = FALSE; +/*N*/ +/*N*/ // Max. bestimmen +/*N*/ double fTotal=0.0; +/*N*/ long nSegments=0; +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fTemp = fabs(GetData(nCol,nRow)); +/*N*/ if (fTemp != DBL_MIN && fTemp>0) +/*N*/ { +/*N*/ fTotal += fTemp; +/*N*/ nSegments++; +/*N*/ } +/*N*/ } +/*N*/ if(!nSegments || fTotal == 0.0) +/*N*/ return (SdrObjGroup*) pScene; +/*N*/ +/*N*/ Rectangle aPieRect; +/*N*/ aPieRect=Rectangle(Point(-nW/2,-nH/2),Size(nW,nH)); // rect in which the pie is drawn +/*N*/ +/*N*/ const long nMaxAngle=36000; +/*N*/ long nPos=0; +/*N*/ E3dDefaultAttributes aDefltAttr3D; +/*N*/ +/*N*/ long nEndAngle=0; +/*N*/ long nStartAngle=0; +/*N*/ +/*N*/ ChartDataDescription aDescr(nColCnt,nRowCnt,pList,this,bShowDataDescr); +/*N*/ +/*N*/ Point aCenter = aPieRect.Center(); +/*N*/ Size aPieRectSize = aPieRect.GetSize(); +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ double fValue = fabs(GetData( nCol,nRow)); +/*N*/ if(fValue!=DBL_MIN && fValue>0.0) +/*N*/ { +/*N*/ nPos++; +/*N*/ SfxItemSet aDataPointAttr(GetFullDataPointAttr(nCol,nRow)); +/*N*/ nStartAngle=nEndAngle; +/*N*/ nEndAngle+=(long)((fValue/fTotal)*nMaxAngle); +/*N*/ +/*N*/ // for last segment use exact value to avoid accumulated errors +/*N*/ if( nPos == nSegments ) +/*N*/ nEndAngle = 36000; +/*N*/ +/*N*/ if(nEndAngle>nMaxAngle) +/*N*/ nEndAngle-=nMaxAngle; +/*N*/ +/*N*/ XPolyPolygon aPolyPolygon; +/*N*/ +/*N*/ // if the angle of the sector is too small the conversion method produces an error +/*N*/ // especially as angles are rounded to integers / 10 +/*N*/ if( nEndAngle - nStartAngle < 10 ) // approximate as triangle +/*N*/ { +/*?*/ XPolygon aPoly( 4 ); +/*?*/ double fAngleStart = (double)(nStartAngle) * F_PI / 18000.0, +/*?*/ fAngleEnd = (double)(nEndAngle) * F_PI / 18000.0, +/*?*/ fRadiusX = (double)(aPieRectSize.Width()) / 2.0, +/*?*/ fRadiusY = (double)(aPieRectSize.Height()) / 2.0; +/*?*/ +/*?*/ aPoly[ 0 ] = aCenter; +/*?*/ aPoly[ 1 ] = Point( (long)(aCenter.X() + fRadiusX * cos( fAngleStart )), (long)(aCenter.Y() - fRadiusY * sin( fAngleStart )) ); +/*?*/ aPoly[ 2 ] = Point( (long)(aCenter.X() + fRadiusX * cos( fAngleEnd )), (long)(aCenter.Y() - fRadiusY * sin( fAngleEnd )) ); +/*?*/ aPoly[ 3 ] = aCenter; +/*?*/ +/*?*/ aPolyPolygon.Insert( aPoly ); +/*N*/ } +/*N*/ else // create a polygon +/*N*/ { +/*N*/ SdrCircObj aSegment( OBJ_SECT, aPieRect, nStartAngle, nEndAngle); +/*N*/ GetPage(0)->NbcInsertObject( &aSegment, 0 ); +/*N*/ SdrPathObj* pTmp = (SdrPathObj*)aSegment.ConvertToPolyObj( FALSE, FALSE ); +/*N*/ +/*N*/ // Add two extra points near the end of the arc so that +/*N*/ // the lighting of the 3d object is smoothed +/*N*/ XPolygon aPoly( pTmp->GetPathPoly().GetObject(0) ); +/*N*/ +/*N*/ long nEnd = aPoly.GetPointCount(); +/*N*/ if( nEnd > 3 ) +/*N*/ { +/*N*/ Point aP2b( aPoly[ nEnd-3 ] ); +/*N*/ Point aP1b( aPoly[ 2 ] ); +/*N*/ Point aP2( aPoly[ nEnd-2] ) ; +/*N*/ Point aP1( aPoly[ 1 ] ); +/*N*/ aP1 += (aP1b-aP1) / 100; +/*N*/ aP2 += (aP2b-aP2) / 100; +/*N*/ aPoly.Insert( nEnd - 2, aP2, XPOLY_NORMAL); +/*N*/ aPoly.Insert( 2, aP1, XPOLY_NORMAL ); +/*N*/ } +/*N*/ aPolyPolygon.Insert( aPoly ); +/*N*/ +/*N*/ GetPage( 0 )->RemoveObject( 0 ); +/*N*/ } +/*N*/ +/*N*/ SchE3dExtrudeObj* pObj=new SchE3dExtrudeObj(aDefltAttr3D, +/*N*/ aPolyPolygon,nZExtrude); +/*N*/ +/*N*/ DBG_ASSERT( pObj, "couldn't create extrude object" ); +/*N*/ +/*N*/ // default attributes reset the texture projection items so set them explicitly +/*N*/ // use object specific projection in y direction +/*N*/ //-/ pObj->SetUseStdTextureY( FALSE ); +/*N*/ pObj->SetItem( Svx3DTextureProjectionYItem( 0 )); +/*N*/ pObj->SetItem( Svx3DDoubleSidedItem( TRUE )); +/*N*/ +/*N*/ pScene->Insert3DObj(pObj); +/*N*/ pObj->InsertUserData(new SchDataPoint(nCol, nRow)); +/*N*/ pObj->InsertUserData (new SchObjectId (CHOBJID_DIAGRAM_DATA)); +/*N*/ pObj->SetMoveProtect(TRUE); +/*N*/ pObj->SetResizeProtect(TRUE); +/*N*/ pObj->SetModel(this); +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes(aDataPointAttr,FALSE); +/*N*/ pObj->SetItemSet(aDataPointAttr); +/*N*/ +/*N*/ +/*N*/ Matrix4D aMatrix; +/*N*/ aMatrix.TranslateZ(-nZExtrude/2); +/*N*/ pObj->NbcSetTransform(aMatrix); +/*N*/ +/*N*/ +/*N*/ if(aDescr.Enabled()) +/*N*/ { +/*N*/ double fZPos = (double)nZExtrude / 2.0; +/*N*/ DataDescription* pDescr=aDescr.Insert(nCol,nRow,aDataPointAttr,Point(0,0),FALSE,CHADJUST_BOTTOM_CENTER,pChartYAxis); +/*N*/ if(pDescr) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 Segment3DDescr(*pDescr,aPieRect,nStartAngle,nEndAngle,0,aPieRect.GetWidth()/2,aPieRect.GetWidth()/2,fZPos); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ aDescr.Build3D(pScene); +/*N*/ +/*N*/ return (SdrObjGroup*) pScene; +/*N*/ } + +/************************************************************************* +|* +|* Positioniere die Achsentitel um das Rectangle der Scene +|* +\************************************************************************/ + +/*N*/ void ChartModel::Position3DAxisTitles(const Rectangle& rSceneRect) +/*N*/ { +/*N*/ SdrPage *pPage = GetPage (0); +/*N*/ Size aPageSize = pPage->GetSize(); +/*N*/ +/*N*/ if (bShowXAxisTitle) +/*N*/ { +/*N*/ SdrObject *pXAxisTitleObj = GetObjWithId(CHOBJID_DIAGRAM_TITLE_X_AXIS, *pPage); +/*N*/ if (pXAxisTitleObj != NULL) +/*N*/ { +/*N*/ Rectangle aXAxisOutRect = pXAxisTitleObj->GetBoundRect(); +/*N*/ +/*N*/ Point aXAxesTitlePosition (rSceneRect.Left () + (int) (rSceneRect.GetWidth () / 2), +/*N*/ Min ((long) aChartRect.Bottom(), +/*N*/ (long) (rSceneRect.Bottom () + aXAxisOutRect.GetHeight()) )); +/*N*/ +/*N*/ if (GetXAxisTitleHasBeenMoved() && GetUseRelativePositions() && +/*N*/ (aXAxesTitlePosition.X() > 0) && (aXAxesTitlePosition.Y() > 0)) +/*N*/ { +/*N*/ // FG: Das ist eine Variable die in BuildChart gesetzt wird, kutz bevor +/*N*/ // das Objekt zerstoert wird. +/*?*/ double fRelativeXPosition = ((double) aTitleXAxisPosition.X()) / aInitialSizefor3d.Width(); +/*?*/ double fRelativeYPosition = ((double) aTitleXAxisPosition.Y()) / aInitialSizefor3d.Height(); +/*?*/ aXAxesTitlePosition.X() = (long)(aPageSize.Width() * fRelativeXPosition); +/*?*/ aXAxesTitlePosition.Y() = (long)(aPageSize.Height() * fRelativeYPosition); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (bSwitch3DColRow) +/*N*/ { +/*N*/ aXAxesTitlePosition.X() = Max (0l, (long) (rSceneRect.Left () - 2 * aXAxisOutRect.GetWidth ())); +/*N*/ aXAxesTitlePosition.Y() = Max (0l, (long) (rSceneRect.Top () + rSceneRect.GetHeight () / 2)); +/*N*/ } +/*N*/ } +/*N*/ SetTextPos((SdrTextObj &) *pXAxisTitleObj, aXAxesTitlePosition,pXAxisTitleAttr); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (bShowYAxisTitle) +/*N*/ { +/*N*/ SdrObject *pYAxisTitleObj = GetObjWithId(CHOBJID_DIAGRAM_TITLE_Y_AXIS, *pPage); +/*N*/ if (pYAxisTitleObj != NULL) +/*N*/ { +/*N*/ Rectangle aYAxisOutRect = pYAxisTitleObj->GetBoundRect(); +/*N*/ +/*N*/ Point aYAxesTitlePosition (Max (1l, (long) (rSceneRect.Left () - 2 * aYAxisOutRect.GetWidth ())), +/*N*/ Max (1l, (long) (rSceneRect.Top () + rSceneRect.GetHeight () / 2))); +/*N*/ +/*N*/ if (GetYAxisTitleHasBeenMoved() && GetUseRelativePositions() && +/*N*/ (aYAxesTitlePosition.X() >= 0) && (aYAxesTitlePosition.Y() > 0)) +/*N*/ { +/*N*/ // FG: Das ist eine Variable die in BuildChart gesetzt wird, kutz bevor +/*N*/ // das Objekt zerstoert wird. +/*N*/ double fRelativeXPosition = ((double) aTitleYAxisPosition.X()) / aInitialSizefor3d.Width(); +/*N*/ double fRelativeYPosition = ((double) aTitleYAxisPosition.Y()) / aInitialSizefor3d.Height(); +/*N*/ aYAxesTitlePosition.X() = (long)(aPageSize.Width() * fRelativeXPosition); +/*N*/ aYAxesTitlePosition.Y() = (long)(aPageSize.Height() * fRelativeYPosition); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (bSwitch3DColRow) +/*N*/ { +/*N*/ aYAxesTitlePosition.X() = rSceneRect.Left () + (int) (rSceneRect.GetWidth () / 2 + 0.5); +/*N*/ aYAxesTitlePosition.Y() = Min ((long) aChartRect.Bottom(), +/*N*/ (long) (rSceneRect.Bottom () + aYAxisOutRect.GetHeight()) ); +/*N*/ } +/*N*/ } +/*N*/ SetTextPos((SdrTextObj &) *pYAxisTitleObj, aYAxesTitlePosition,pYAxisTitleAttr); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ if (bShowZAxisTitle) +/*N*/ { +/*N*/ SdrObject *pZAxisTitleObj = GetObjWithId(CHOBJID_DIAGRAM_TITLE_Z_AXIS, *pPage); +/*N*/ if (pZAxisTitleObj != NULL) +/*N*/ { +/*N*/ Rectangle aZAxisOutRect = pZAxisTitleObj->GetBoundRect(); +/*N*/ +/*N*/ +/*N*/ Point aZAxesTitlePosition( (long)(0.95 * rSceneRect.Right()), +/*N*/ (long)Min ((long) aChartRect.Bottom(), +/*N*/ (long) (rSceneRect.Bottom () - aZAxisOutRect.GetHeight()))); +/*N*/ +/*N*/ +/*N*/ if (GetZAxisTitleHasBeenMoved() && GetUseRelativePositions() && +/*N*/ (aZAxesTitlePosition.X() > 0) && (aZAxesTitlePosition.Y() > 0)) +/*N*/ { +/*N*/ // FG: Das ist eine Variable die in BuildChart gesetzt wird, kutz bevor +/*N*/ // das Objekt zerstoert wird. +/*N*/ double fRelativeXPosition = ((double) aTitleZAxisPosition.X()) / aInitialSizefor3d.Width(); +/*N*/ double fRelativeYPosition = ((double) aTitleZAxisPosition.Y()) / aInitialSizefor3d.Height(); +/*N*/ aZAxesTitlePosition.X() = (long)(aPageSize.Width() * fRelativeXPosition); +/*N*/ aZAxesTitlePosition.Y() = (long)(aPageSize.Height() * fRelativeYPosition); +/*N*/ } +/*N*/ else if(aZAxesTitlePosition.Y()<aZAxisOutRect.GetHeight()/2) +/*N*/ { +/*?*/ aZAxesTitlePosition.Y()=aZAxisOutRect.GetHeight(); +/*N*/ } +/*N*/ SetTextPos((SdrTextObj &) *pZAxisTitleObj, aZAxesTitlePosition,pZAxisTitleAttr); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ aInitialSizefor3d = aInitialSize; +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode1.cxx b/binfilter/bf_sch/source/core/sch_chtmode1.cxx new file mode 100644 index 000000000000..bada5ba506fc --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode1.cxx @@ -0,0 +1,1088 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svx/svxids.hrc> + +#include <bf_svx/xlntrit.hxx> +#include <bf_svx/svdviter.hxx> +#include <bf_svx/svdview.hxx> +#ifndef _ZFORLIST_HXX //autogen +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif + +#include "schattr.hxx" +#define ITEMID_ADJUST EE_PARA_JUST +#include <bf_svx/adjitem.hxx> + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT + + +#endif + +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#include "globfunc.hxx" +#include <bf_svx/svxids.hrc> +#include "schresid.hxx" + +#include "glob.hrc" +#include <bf_svx/dialogs.hrc> +#include "math.h" + + +#include <bf_svx/xlnedcit.hxx> + +#include <bf_svx/xlnstcit.hxx> + +#include <bf_svx/xlnedwit.hxx> + +#include <bf_svx/xlnstwit.hxx> + +#include <bf_svx/xlnedit.hxx> + +#include <bf_svx/xlnstit.hxx> + +#include <bf_svx/xlndsit.hxx> + + +#include <bf_svx/xlnclit.hxx> + +#include <bf_svx/xlnwtit.hxx> + +#include "pairs.hxx" +#include "datalog.hxx" + +#include "chaxis.hxx" + +#include "chmod3d.hxx" +#include "schmod.hxx" +namespace binfilter { + +/************************************************************************/ + +/*N*/ const double fDefaultArr[DEFAULT_ROWCNT][DEFAULT_COLCNT] = +/*N*/ { +/*N*/ { 9.1, 3.2, 4.54 }, +/*N*/ { 2.4, 8.8, 9.65 }, +/*N*/ { 3.1, 1.5, 3.7 }, +/*N*/ { 4.3, 9.02, 6.2 } +/*N*/ }; + +/************************************************************************* +|* +|* delete top-level object (called by BuildChart to create shape newly) +|* +\************************************************************************/ + +/*N*/ void ChartModel::DeleteObject( SdrObject* pObj ) +/*N*/ { +/*N*/ if( pObj ) +/*N*/ { +/*N*/ // unmark object in all views +/*N*/ SdrViewIter aIter( pObj ); +/*N*/ SdrView* pView = aIter.FirstView(); +/*N*/ +/*N*/ while( pView ) +/*N*/ { +/*N*/ // important: leave group so that SdrPageView's object list is always +/*N*/ // the same as the object list of the page +/*N*/ pView->LeaveAllGroup(); +/*N*/ pView->UnmarkAll(); +/*N*/ +/*N*/ pView = aIter.NextView(); +/*N*/ } +/*N*/ +/*N*/ #if OSL_DEBUG_LEVEL > 1 +/*N*/ SdrObject* pDelObj = pObj->GetObjList()->RemoveObject( pObj->GetOrdNum()); +/*N*/ DBG_ASSERT( pDelObj == pObj , "Wrong object removed!" ); +/*N*/ #else +/*N*/ pObj->GetObjList()->RemoveObject( pObj->GetOrdNum()); +/*N*/ #endif +/*N*/ +/*N*/ delete pObj; +/*N*/ } +/*N*/ else +/*N*/ DBG_ERROR( "DeleteObject: Invalid object" ); +/*N*/ } + +/*N*/ const USHORT nExchangeTitleWhichPairs[] = +/*N*/ { //ca.: +/*N*/ SCHATTR_TEXT_ORIENT, SCHATTR_TEXT_ORIENT, // 1 +/*N*/ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // +/*N*/ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 +/*N*/ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1020 +/*N*/ SDRATTR_START, SDRATTR_END, //hier geändert auf alle SdrAttr +/*N*/ EE_ITEMS_START, EE_ITEMS_END, // 4000 +/*N*/ 0 +/*N*/ }; + +/************************************************************************* +|* +|* Textobjekt fuer Diagramme erzeugen +|* FG: Der Parameter MaximumWidth wird beachtet, falls er groesser als 0 ist. +|* Dann wird zur Not der Text umgebrochen. Diese Groesse muss auch +|* CalcMaxDescrSize uebergeben werden, sonst stimmt die Formatierung nicht. +|* Es werden maximal 2 Zeilen dieser Breite erzeugt der Rest wird abgeschnitten. +|* +|* Das sollte umgeschrieben werden, denn: +|* 1) Es wird der Text in ein Outline-Objekt gepackt, damit man mit Stacked-Text +|* zurecht kommt. +|* 2) daraus wird die Groesse und die Breite berechnet. +|* 3) dann wird diese Groesse genommen um ein SdrTextObj mit den gleichen +|* Attributen zu erzeugen, wie das Outline Objekt. +|* +\************************************************************************/ + +/*N*/ SdrRectObj* ChartModel::CreateTextObj(UINT16 nId, +/*N*/ const Point &rPos, +/*N*/ const String &rText, +/*N*/ const SfxItemSet &rAttr, +/*N*/ BOOL bIsTitle, +/*N*/ ChartAdjust eAdjust, +/*N*/ const long nMaximumWidth) +/*N*/ { +/*N*/ const SfxPoolItem* pPoolItem = NULL; +/*N*/ SvxChartTextOrient eOrient; +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_TEXT_ORIENT, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ eOrient = ((const SvxChartTextOrientItem*)pPoolItem)->GetValue(); +/*N*/ else +/*N*/ eOrient = CHTXTORIENT_STANDARD; +/*N*/ +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTextWhichPairs); +/*N*/ aTextAttr.Put(rAttr); +/*N*/ +/*N*/ if (bIsTitle) +/*N*/ aTextAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER)); +/*N*/ else +/*N*/ aTextAttr.Put(SvxAdjustItem((eOrient == CHTXTORIENT_BOTTOMTOP) +/*N*/ ? SVX_ADJUST_RIGHT +/*N*/ : SVX_ADJUST_LEFT)); +/*N*/ +/*N*/ // clear old outliner content +/*N*/ pOutliner->Clear(); +/*N*/ +/*N*/ if (eOrient == CHTXTORIENT_STACKED) +/*?*/ pOutliner->SetText(StackString(rText), pOutliner->GetParagraph( 0 )); +/*N*/ else +/*N*/ pOutliner->SetText(rText, pOutliner->GetParagraph( 0 )); +/*N*/ +/*N*/ // FG: Diese Routine berechnet nun wirklich ob der Text umgebrochen werden soll oder nicht. +/*N*/ Size aSize = CalcTextSizeOfOneText (eOrient, aTextAttr, pOutliner, nMaximumWidth,FALSE); +/*N*/ +/*N*/ // FG: Was macht das? +/*N*/ OutlinerParaObject* pPara = pOutliner->CreateParaObject(); +/*N*/ +/*N*/ // FG: Hier wird der Text der oben muehsam erzeugt und formatiert wurde, wieder weggeworfen. +/*N*/ pOutliner->Clear(); +/*N*/ +/*N*/ //rPos=Position im ChartRect, wird als arg uebergeben, +/*N*/ //size ergibt sich aus CalcTextOf... (s.o.) +/*N*/ Rectangle aRect(rPos, aSize); +/*N*/ SdrRectObj* pObj; +/*N*/ +/*N*/ AdjustRect(aRect, eAdjust); +/*N*/ +/*N*/ switch(nId) +/*N*/ { +/*N*/ //Alle Titel sorgen selbst für ihre Attributierung: +/*N*/ case CHOBJID_DIAGRAM_TITLE_X_AXIS: +/*N*/ case CHOBJID_DIAGRAM_TITLE_Y_AXIS: +/*N*/ case CHOBJID_DIAGRAM_TITLE_Z_AXIS: +/*N*/ case CHOBJID_TITLE_MAIN: +/*N*/ case CHOBJID_TITLE_SUB: +/*N*/ pObj = new SchRectObj(OBJ_TEXT, aRect); +/*N*/ break; +/*N*/ default: +/*N*/ pObj = new SdrRectObj(OBJ_TEXT, aRect); +/*N*/ break; +/*N*/ +/*N*/ } +/*N*/ +/*N*/ //Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES +/*N*/ long nDegrees=GetTextRotation((SfxItemSet&)rAttr,eOrient); +/*N*/ if(nDegrees) +/*N*/ { +/*N*/ Rectangle aOldBoundRect=pObj->GetBoundRect(); +/*N*/ double fVal=nDegrees * nPi180; +/*N*/ pObj->Rotate(pObj->GetSnapRect().Center(), nDegrees, sin(fVal), cos(fVal)); +/*N*/ pObj->NbcMove( AdjustRotatedRect(aOldBoundRect, eAdjust,pObj->GetBoundRect())); +/*N*/ } +/*N*/ +/*N*/ //ToDo: anhängen der ,*(pItemPool->GetFrozenIdRanges()) ???, erstmal mit diesen Whichpairs +/*N*/ SfxItemSet aAreaAttr(*pItemPool,nExchangeTitleWhichPairs); +/*N*/ +/*N*/ //Neu: #52009# +/*N*/ aAreaAttr.Put(SdrTextAutoGrowHeightItem( bIsTitle )); +/*N*/ aAreaAttr.Put(SdrTextAutoGrowWidthItem( bIsTitle )); +/*N*/ aAreaAttr.Put(rAttr); +/*N*/ +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes(aAreaAttr, FALSE);//#63904# 10% +/*N*/ pObj->SetItemSet(aAreaAttr);//#63904# 10% +/*N*/ +/*N*/ pObj->InsertUserData(new SchObjectId(nId)); +/*N*/ pObj->InsertUserData(new SchObjectAdjust(eAdjust, eOrient)); +/*N*/ pObj->NbcSetOutlinerParaObject(pPara); +/*N*/ +/*N*/ return pObj; +/*N*/ } + +/************************************************************************* +|* +|* Text von Diagramm-Textobjekten setzen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Attribute von Diagramm-Textobjekten setzen +|* +\************************************************************************/ + +/*N*/ void ChartModel::SetTextAttr(SdrTextObj& rTextObj, +/*N*/ const SfxItemSet& rAttr, +/*N*/ const long nMaximumWidth) +/*N*/ { +/*N*/ // #97992# calling SetItemSet results in changing the p...Attr in the ChartModel +/*N*/ // because of the implementation of SchRectObj. Maybe this is wrong, but it seemed +/*N*/ // to risky, therefore I set here all the correct items to prevent loss +/*N*/ // SfxItemSet aObjAttr( *pItemPool, nAreaWhichPairs ); +/*N*/ // aObjAttr.Put(rAttr); +/*N*/ // rTextObj.SetItemSetAndBroadcast(aAreaAttr); +/*N*/ rTextObj.SetItemSetAndBroadcast( rAttr ); +/*N*/ +/*N*/ if ( rTextObj.GetOutlinerParaObject()) +/*N*/ { +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTextWhichPairs); +/*N*/ aTextAttr.Put(rAttr); +/*N*/ aTextAttr.Put(SvxAdjustItem()); +/*N*/ +/*N*/ pOutliner->SetText(*rTextObj.GetOutlinerParaObject()); +/*N*/ +/*N*/ SetTextAttributes (aTextAttr); +/*N*/ +/*N*/ if(IsAttrChangeNeedsBuildChart(rAttr)) +/*N*/ { +/*N*/ //in diesem Fall koennte ein Textresize/reorg noetig sein +/*N*/ +/*N*/ Size aSize = pOutliner->CalcTextSize(); +/*N*/ aSize.Height() += TEXTHEIGHT_OFS; +/*N*/ aSize.Width () = (aSize.Width () * 6) / 5; +/*N*/ +/*N*/ OutlinerParaObject* pPara = pOutliner->CreateParaObject(); +/*N*/ +/*N*/ pOutliner->Clear(); +/*N*/ +/*N*/ rTextObj.SetOutlinerParaObject(pPara); +/*N*/ AdjustTextSize(rTextObj, aSize); +/*N*/ } +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Liefert die maximale Beschriftungs-Text-Groesse +|* FG: Hier wird der groesste Text berechnet und die Groesse des ersten +|* und letzten (je nach Chart-Typ braucht man einen oder alle 3 Werte +|* nNumberFormat ist der Index fuer ein Zahlenformat, dies kann noetig +|* sin um die wahre Textbreite und Hoehe auszurechnen +|* nMaximumWidth ist die Breite ab der der Text umgebrochen wird +|* +\************************************************************************/ + +/*N*/ Size ChartModel::CalcMaxDescrSize(BOOL bRowDescr, +/*N*/ SvxChartTextOrient eOrient, +/*N*/ const UINT32 nNumberFormat, +/*N*/ long nAxisUId, +/*N*/ const long MaximumWidth, +/*N*/ Pair* pFirstAndLast ) +/*N*/ { +/*N*/ ChartAxis *pCurrentXAxis = (nAxisUId == CHAXIS_AXIS_A)? pChartAAxis: pChartXAxis; +/*N*/ +/*N*/ BOOL bLogarithm = pCurrentXAxis->IsLogarithm(); +/*N*/ short nCnt; +/*N*/ SfxItemSet* pAxisAttr; +/*N*/ if (bRowDescr) +/*N*/ { +/*N*/ nCnt = GetRowCount(); +/*N*/ pAxisAttr = &GetAttr(CHOBJID_DIAGRAM_Z_AXIS); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nCnt = GetColCount(); +/*N*/ pAxisAttr = &GetAttr(CHOBJID_DIAGRAM_X_AXIS); +/*N*/ } +/*N*/ +/*N*/ pOutliner->SetUpdateMode (FALSE); +/*N*/ +/*N*/ Size aMaxSize(0, 0); +/*N*/ +/*N*/ if (IsXYChart()) +/*N*/ { + /********************************************************************** + * XY-Chart oder Zeilen muessen zusammengefasst werden + **********************************************************************/ +/*N*/ if (/*IsXYChart() && */pCurrentXAxis->GetMin() == pCurrentXAxis->GetMax())//#55400# +/*N*/ { +/*?*/ return Size (0, 0); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ +/*N*/ // #55400# +/*N*/ // #67961# +/*N*/ double fMinX = pCurrentXAxis->GetMin(); +/*N*/ double fMaxX = pCurrentXAxis->GetMax(); +/*N*/ double fStepX = pCurrentXAxis->GetStep(); +/*N*/ +/*N*/ // Collect the items which control the text appearence and set them to +/*N*/ // the outliner. +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTextOrientWhichPairs); +/*N*/ aTextAttr.Put(GetAttr(CHOBJID_DIAGRAM_X_AXIS)); +/*N*/ // SetTextAttributes (aTextAttr); +/*N*/ +/*N*/ double fAct = fMinX; +/*N*/ +/*N*/ while (fAct <= fMaxX) +/*N*/ { +/*N*/ String aNumStr; +/*N*/ Color* pDummy = NULL; +/*N*/ +/*N*/ pNumFormatter->GetOutputString(fAct, nNumberFormat, aNumStr, &pDummy); +/*N*/ +/*N*/ if (eOrient == CHTXTORIENT_STACKED) +/*?*/ pOutliner->SetText(StackString(aNumStr), pOutliner->GetParagraph( 0 )); +/*N*/ else +/*N*/ pOutliner->SetText(aNumStr, pOutliner->GetParagraph( 0 )); +/*N*/ +/*N*/ // FG: Hier wird wirklich berechnet wie groß der Textbereich werden soll. Insbesondere +/*N*/ // wird hier entschieden, ob der Text umgebrochen werden soll oder nicht! +/*N*/ SetTextAttributes (aTextAttr); +/*N*/ Size aSize = CalcTextSizeOfOneText (eOrient, aTextAttr, pOutliner, MaximumWidth, +/*N*/ TRUE, FALSE); +/*N*/ pOutliner->SetUpdateMode (FALSE); +/*N*/ +/*N*/ pOutliner->Clear(); +/*N*/ +/*N*/ if (aSize.Width() > aMaxSize.Width()) +/*N*/ aMaxSize.Width() = aSize.Width(); +/*N*/ if (aSize.Height() > aMaxSize.Height()) +/*N*/ aMaxSize.Height() = aSize.Height(); +/*N*/ +/*N*/ // FG: Die Berechnung erfolgt hier, damit die Raender in Create2DBackplane +/*N*/ if (fAct <= fMinX) +/*N*/ { +/*N*/ nWidthOfFirstXAxisText = aSize.Width(); +/*N*/ if(pFirstAndLast) +/*N*/ pFirstAndLast->A()=nWidthOfFirstXAxisText; +/*N*/ +/*N*/ } +/*N*/ IncValue(fAct, fStepX, bLogarithm); +/*N*/ // FG: Die Berechnung erfolgt hier, damit die Raender in Create2DBackplane +/*N*/ if (fAct >= fMaxX) +/*N*/ { +/*N*/ nWidthOfLastXAxisText = aSize.Width(); +/*N*/ if(pFirstAndLast) +/*N*/ pFirstAndLast->B()=nWidthOfLastXAxisText; +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Collect the items which control the text appearence and set them to +/*N*/ // the outliner. +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTextOrientWhichPairs); +/*N*/ aTextAttr.Put(*pAxisAttr); +/*N*/ // SetTextAttributes (aTextAttr); +/*N*/ +/*N*/ for (short i = 0; i < nCnt; i++) +/*N*/ { +/*N*/ String aDescrStr = bRowDescr ? RowText(i) : ColText(i); +/*N*/ +/*N*/ if (eOrient == CHTXTORIENT_STACKED) +/*?*/ pOutliner->SetText(StackString(aDescrStr), pOutliner->GetParagraph( 0 )); +/*N*/ else +/*N*/ pOutliner->SetText(aDescrStr, pOutliner->GetParagraph( 0 )); +/*N*/ +/*N*/ // FG: Hier wird wirklich berechnet wie groß der Textbereich werden soll. Insbesondere wird +/*N*/ // hier entschieden, ob der Text umgebrochen werden soll oder nicht! +/*N*/ SetTextAttributes (aTextAttr); +/*N*/ Size aSize = CalcTextSizeOfOneText (eOrient, aTextAttr, pOutliner, MaximumWidth,TRUE, +/*N*/ FALSE); +/*N*/ pOutliner->SetUpdateMode (FALSE); +/*N*/ pOutliner->Clear(); +/*N*/ +/*N*/ if (aSize.Width() > aMaxSize.Width()) +/*N*/ aMaxSize.Width() = aSize.Width(); +/*N*/ if (aSize.Height() > aMaxSize.Height()) +/*N*/ aMaxSize.Height() = aSize.Height(); +/*N*/ // FG: Die Berechnung erfolgt hier, damit die Raender in Create2DBackplane +/*N*/ // richtig berechnet werden koennen. +/*N*/ if (i == 0) +/*N*/ { +/*N*/ nWidthOfFirstXAxisText = aSize.Width(); +/*N*/ if(pFirstAndLast) +/*N*/ pFirstAndLast->A()=nWidthOfFirstXAxisText; +/*N*/ } +/*N*/ if (i == nCnt-1) +/*N*/ { +/*N*/ nWidthOfLastXAxisText = aSize.Width(); +/*N*/ if(pFirstAndLast) +/*N*/ pFirstAndLast->B()=nWidthOfLastXAxisText; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pOutliner->SetUpdateMode (TRUE); +/*N*/ +/*N*/ return aMaxSize; +/*N*/ } + +/************************************************************************* +|* +|* Text-H”he ermitteln +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Datenzeilen-Attributsets initialisieren +|* +\************************************************************************/ + +// +// schneller machen, es muß nicht alles neu gebaut werden +// + +/*N*/ void ChartModel::InitDataAttrs() +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::InitDataAttrs" ); +/*N*/ +/*N*/ DBG_ASSERT( pChartData, "ChartModel::InitDataAttrs: No ChartData-Object available!" ); +/*N*/ +/*N*/ short nDataColCnt = pChartData->GetColCount(); +/*N*/ short nDataRowCnt = pChartData->GetRowCount(); + + /* For pie charts we need the maximum of both dimensions, because the pie interprets data a bit + * odd: only the first series (data-row) is used for the pie. Each segment is a data point of + * this single series. However to get the correct colors the array containing series attributes + * is used instead of the data point attributes. Thus for a 1x10 data we need 10 series + * attributes although we have only one series. However for 20x10 data we need 20 series + * attributes, because we actually have 20 series although just the first one is visible. But + * we need those attributes in case the chart type is switched. + */ +/*N*/ short nCnt = IsPieChart() +/*N*/ ? ::std::max( GetColCount(), GetRowCount()) +/*N*/ : GetRowCount(); +/*N*/ +/*N*/ short i; +/*N*/ +/*N*/ if (nCnt != nPieSegCount) +/*N*/ { +/*N*/ long *pOfs = new long[nCnt]; +/*N*/ +/*N*/ if (nPieSegCount > nCnt) +/*N*/ for (i = 0; i < nCnt; i++) +/*N*/ pOfs[i] = pPieSegOfs[i]; +/*N*/ else +/*N*/ { +/*N*/ for (i = 0; i < nPieSegCount; i++) +/*N*/ pOfs[i] = pPieSegOfs[i]; +/*N*/ for (; i < nCnt; i++) +/*N*/ pOfs[i] = 0; +/*N*/ } +/*N*/ +/*N*/ delete[] pPieSegOfs; +/*N*/ pPieSegOfs = pOfs; +/*N*/ nPieSegCount = nCnt; +/*N*/ } +/*N*/ +/*N*/ +/*N*/ long nRowListCnt ; +/*N*/ //regressattr +/*N*/ nRowListCnt = (short)aRegressAttrList.Count(); +/*N*/ +/*N*/ DBG_ASSERT( pDefaultColors, "invalid default colors" ); +/*N*/ sal_Int32 nNumDefCol = pDefaultColors->Count(); +/*N*/ DBG_ASSERT( nNumDefCol, "Empty Default Color List" ); +/*N*/ +/*N*/ if (nCnt != nRowListCnt) +/*N*/ { +/*N*/ if (nRowListCnt > nCnt) +/*N*/ { +/*N*/ aRegressAttrList.Seek((ULONG)nCnt); +/*N*/ for (i = nCnt; i < nRowListCnt; i++) +/*N*/ delete aRegressAttrList.Remove(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ for (i = nRowListCnt; i < nCnt; i++) +/*N*/ { +/*N*/ SfxItemSet* pRegressAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ aRegressAttrList.Insert(pRegressAttr, LIST_APPEND); +/*N*/ +/*N*/ pRegressAttr->Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ pRegressAttr->Put(XLineWidthItem(100)); +/*N*/ if( nNumDefCol != 0 ) +/*N*/ { +/*N*/ XColorEntry* pEntry = (XColorEntry*)pDefaultColors-> +/*N*/ GetObject(i % nNumDefCol); +/*N*/ pRegressAttr->Put(XLineColorItem(pEntry->GetName(), +/*N*/ pEntry->GetColor())); +/*N*/ } +/*N*/ pRegressAttr->Put(XLineDashItem()); +/*N*/ pRegressAttr->Put(XLineStartItem()); +/*N*/ pRegressAttr->Put(XLineEndItem()); +/*N*/ pRegressAttr->Put(XLineStartWidthItem()); +/*N*/ pRegressAttr->Put(XLineEndWidthItem()); +/*N*/ pRegressAttr->Put(XLineStartCenterItem()); +/*N*/ pRegressAttr->Put(XLineEndCenterItem()); +/*N*/ pRegressAttr->Put(XLineTransparenceItem()); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //average attr +/*N*/ nRowListCnt = (short)aAverageAttrList.Count(); +/*N*/ if (nCnt != nRowListCnt) +/*N*/ if (nRowListCnt > nCnt) +/*N*/ { +/*N*/ aAverageAttrList.Seek((ULONG)nCnt); +/*N*/ for (i = nCnt; i < nRowListCnt; i++) +/*N*/ delete aAverageAttrList.Remove(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ for (i = nRowListCnt; i < nCnt; i++) +/*N*/ { +/*N*/ SfxItemSet* pAverageAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ aAverageAttrList.Insert(pAverageAttr, LIST_APPEND); +/*N*/ +/*N*/ pAverageAttr->Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ pAverageAttr->Put(XLineWidthItem(0)); +/*N*/ if( nNumDefCol != 0 ) +/*N*/ { +/*N*/ XColorEntry* pEntry = (XColorEntry*)pDefaultColors-> +/*N*/ GetObject(i % nNumDefCol); +/*N*/ pAverageAttr->Put(XLineColorItem(pEntry->GetName(), +/*N*/ pEntry->GetColor())); +/*N*/ } +/*N*/ pAverageAttr->Put(XLineDashItem()); +/*N*/ pAverageAttr->Put(XLineStartItem()); +/*N*/ pAverageAttr->Put(XLineEndItem()); +/*N*/ pAverageAttr->Put(XLineStartWidthItem()); +/*N*/ pAverageAttr->Put(XLineEndWidthItem()); +/*N*/ pAverageAttr->Put(XLineStartCenterItem()); +/*N*/ pAverageAttr->Put(XLineEndCenterItem()); +/*N*/ pAverageAttr->Put(XLineTransparenceItem()); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //error attr +/*N*/ nRowListCnt = (short)aErrorAttrList.Count(); +/*N*/ if (nCnt != nRowListCnt) +/*N*/ if (nRowListCnt > nCnt) +/*N*/ { +/*N*/ aErrorAttrList.Seek((ULONG)nCnt); +/*N*/ for (i = nCnt; i < nRowListCnt; i++) +/*N*/ delete aErrorAttrList.Remove(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ for (i = nRowListCnt; i < nCnt; i++) +/*N*/ { +/*N*/ SfxItemSet* pErrorAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ aErrorAttrList.Insert(pErrorAttr, LIST_APPEND); +/*N*/ +/*N*/ pErrorAttr->Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ pErrorAttr->Put(XLineWidthItem(0)); +/*N*/ pErrorAttr->Put(XLineColorItem(String(), RGBColor(COL_BLACK))); +/*N*/ pErrorAttr->Put(XLineDashItem()); +/*N*/ pErrorAttr->Put(XLineStartItem()); +/*N*/ pErrorAttr->Put(XLineEndItem()); +/*N*/ pErrorAttr->Put(XLineStartWidthItem()); +/*N*/ pErrorAttr->Put(XLineEndWidthItem()); +/*N*/ pErrorAttr->Put(XLineStartCenterItem()); +/*N*/ pErrorAttr->Put(XLineEndCenterItem()); +/*N*/ pErrorAttr->Put(XLineTransparenceItem()); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Point-Attr +/*N*/ long nPointCnt = nDataColCnt * nDataRowCnt; +/*N*/ long nPointListCnt = aDataPointAttrList.Count(); +/*N*/ if (nPointCnt != nPointListCnt) +/*N*/ if (nPointListCnt > nPointCnt) +/*N*/ { +/*N*/ // aDataPointAttrList.Seek((ULONG)nPointCnt); +/*N*/ // for (long i = nPointCnt; i < nPointListCnt; i++) +/*N*/ // delete aDataPointAttrList.Remove(); +/*N*/ while (nPointListCnt-- > nPointCnt) +/*N*/ { +/*N*/ aDataPointAttrList.Seek((ULONG)nPointCnt); +/*N*/ delete aDataPointAttrList.Remove(); +/*N*/ } +/*N*/ } +/*N*/ else for (long ii = nPointListCnt; ii < nPointCnt; ii++) +/*N*/ aDataPointAttrList.Insert(NULL, LIST_APPEND); +/*N*/ +/*N*/ // Switch-Point-Attr +/*N*/ nPointListCnt = aSwitchDataPointAttrList.Count(); +/*N*/ if (nPointCnt != nPointListCnt) +/*N*/ { +/*N*/ if (nPointListCnt > nPointCnt) +/*N*/ { +/*N*/ // aSwitchDataPointAttrList.Seek((ULONG)nPointCnt); +/*N*/ // for (long i = nPointCnt; i < nPointListCnt; i++) +/*N*/ // delete aSwitchDataPointAttrList.Remove(); +/*N*/ while (nPointListCnt-- > nPointCnt) +/*N*/ { +/*N*/ aSwitchDataPointAttrList.Seek((ULONG)nPointCnt); +/*N*/ delete aSwitchDataPointAttrList.Remove(); +/*N*/ } +/*N*/ } +/*N*/ else for (long iii = nPointListCnt; iii < nPointCnt; iii++) +/*N*/ aSwitchDataPointAttrList.Insert(NULL, LIST_APPEND); +/*N*/ // Insert (new SfxItemSet(*pItemPool, nRowWhichPairs),...) +/*N*/ } +/*N*/ +/*N*/ //row attr +/*N*/ nRowListCnt = (short)aDataRowAttrList.Count(); +/*N*/ if (nCnt != nRowListCnt) +/*N*/ { +/*N*/ if (nRowListCnt > nCnt) +/*N*/ { +/*N*/ //bevor attribute geloescht werden, wird reorganisiert +/*N*/ LogBookAttrData(); +/*N*/ +/*N*/ //Jetzt darf erst der Ueberhang geloescht werden: +/*N*/ aDataRowAttrList.Seek((ULONG)nCnt); +/*N*/ for (i = nCnt; i < nRowListCnt; i++) +/*N*/ delete aDataRowAttrList.Remove(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ bool bIsCombiChart = +/*N*/ ( CHSTYLE_2D_LINE_COLUMN == eChartStyle ) || +/*N*/ ( CHSTYLE_2D_LINE_STACKEDCOLUMN == eChartStyle ); +/*N*/ +/*N*/ for (i = nRowListCnt; i < nCnt; i++) +/*N*/ { +/*N*/ SfxItemSet* pDataRowAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ aDataRowAttrList.Insert(pDataRowAttr, LIST_APPEND); +/*N*/ SetDefAttrRow(pDataRowAttr,i); +/*N*/ +/*N*/ // Change the defaults for lines in mixed line-column charts. +/*N*/ if( bIsCombiChart && IsLine( i ) ) +/*N*/ { +/*N*/ pDataRowAttr->ClearItem (SCHATTR_STYLE_SYMBOL); +/*N*/ pDataRowAttr->Put (XLineStyleItem (XLINE_SOLID)); +/*N*/ // #101164# as more than one line is possible via GUI, those +/*N*/ // should not all be black +/*N*/ // pDataRowAttr->Put (XLineColorItem (String(), RGBColor (COL_BLACK))); +/*N*/ pDataRowAttr->Put (XLineWidthItem (0)); +/*N*/ } +/*N*/ } +/*N*/ if( ! bIsCombiChart ) +/*N*/ SetupLineColors( SETLINES_FILLCOLOR, nRowListCnt ); +/*N*/ } +/*N*/ } +/*N*/ LogBookAttrData(); +/*N*/ } + + +/************************************************************************* +|* +|* ggf. Attribute neu Organisieren erzeugen +|* +\************************************************************************/ +/*N*/ void ChartModel::LogBookAttrData() +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::LogBookAttrData" ); +/*N*/ +/*N*/ if(pLogBook) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if(pLogBook->IsValid()) +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* RowAttr neu setzen: +|* +\************************************************************************/ +/*N*/ void ChartModel::SetDefAttrRow(SfxItemSet* pDataRowAttr,const long i) +/*N*/ { +/*N*/ DBG_ASSERT( pDefaultColors, "Invalid default color list" ); +/*N*/ if( ! pDefaultColors ) +/*N*/ return; +/*N*/ +/*N*/ CHART_TRACE1( "ChartModel::SetDefAttrRow - Row #%ld", i ); +/*N*/ +/*N*/ sal_Int32 nNumDefCol = pDefaultColors->Count(); +/*N*/ DBG_ASSERT( nNumDefCol, "invalid default colors" ); +/*N*/ +/*N*/ pDataRowAttr->Put(*pDummyAttr); +/*N*/ if( nNumDefCol != 0 ) +/*N*/ { +/*N*/ XColorEntry* pEntry = (XColorEntry*)pDefaultColors-> +/*N*/ GetObject(i % nNumDefCol); +/*N*/ pDataRowAttr->Put(XFillColorItem(pEntry->GetName(), +/*N*/ pEntry->GetColor())); +/*N*/ +/*N*/ if(IsLine(i)) //#54870# bei Linien defaultfarbe der Linie=FillColor +/*N*/ { +/*N*/ pDataRowAttr->Put(XLineColorItem(pEntry->GetName(), +/*N*/ pEntry->GetColor())); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pDataRowAttr->Put(XLineColorItem(String(), RGBColor(COL_BLACK))); +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* ggf. Demo-Chart erzeugen +|* +\************************************************************************/ + +/*N*/ void ChartModel::InitChartData(BOOL bNewTitles) +/*N*/ { +/*N*/ if (!pChartData) +/*N*/ { +/*N*/ SchMemChart* pMemChart = new SchMemChart(DEFAULT_COLCNT, DEFAULT_ROWCNT); +/*N*/ +/*N*/ pMemChart->SetMainTitle(String(SchResId(STR_TITLE_MAIN))); +/*N*/ pMemChart->SetSubTitle(String(SchResId(STR_TITLE_SUB))); +/*N*/ pMemChart->SetXAxisTitle(String(SchResId(STR_DIAGRAM_TITLE_X_AXIS))); +/*N*/ pMemChart->SetYAxisTitle(String(SchResId(STR_DIAGRAM_TITLE_Y_AXIS))); +/*N*/ pMemChart->SetZAxisTitle(String(SchResId(STR_DIAGRAM_TITLE_Z_AXIS))); +/*N*/ +/*N*/ for( short nCol = 0; nCol < DEFAULT_COLCNT; nCol++ ) +/*N*/ { +/*N*/ pMemChart->SetColText( nCol, pMemChart->GetDefaultColumnText( nCol )); +/*N*/ +/*N*/ for( short nRow = 0; nRow < DEFAULT_ROWCNT; nRow++ ) +/*N*/ { +/*N*/ pMemChart->SetData( nCol, nRow, fDefaultArr[ nRow ][ nCol ] ); +/*N*/ pMemChart->SetRowText( nRow, pMemChart->GetDefaultRowText( nRow )); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ SetChartData(*pMemChart, bNewTitles); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Defaultfarben erstellen +|* +\************************************************************************/ + +/*N*/ void ChartModel::CreateDefaultColors () +/*N*/ { +/*N*/ SchOptions* pOptions = SCH_MOD1()->GetSchOptions(); +/*N*/ long nCount; +/*N*/ ColorData* pDefaultCol = NULL; +/*N*/ +/*N*/ if( pOptions ) +/*N*/ { +/*N*/ const SchColorTable& aDefCols = pOptions->GetDefaultColors(); +/*N*/ nCount = aDefCols.Count(); +/*N*/ pDefaultCol = new ColorData[ nCount ]; +/*N*/ DBG_ASSERT( nCount == ROW_COLOR_COUNT, "Chart: dynamic default color array size not supported yet" ); +/*N*/ +/*N*/ for( int i=0; i<nCount; i++ ) +/*N*/ { +/*N*/ pDefaultCol[ i ] = aDefCols.GetColorData( i ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ nCount = ROW_COLOR_COUNT; +/*?*/ pDefaultCol = new ColorData[ nCount ]; +/*?*/ +/*?*/ pDefaultCol[ 0 ] = RGB_COLORDATA( 0x99, 0x99, 0xff ); +/*?*/ pDefaultCol[ 1 ] = RGB_COLORDATA( 0x99, 0x33, 0x66 ); +/*?*/ pDefaultCol[ 2 ] = RGB_COLORDATA( 0xff, 0xff, 0xcc ); +/*?*/ pDefaultCol[ 3 ] = RGB_COLORDATA( 0xcc, 0xff, 0xff ); +/*?*/ pDefaultCol[ 4 ] = RGB_COLORDATA( 0x66, 0x00, 0x66 ); +/*?*/ pDefaultCol[ 5 ] = RGB_COLORDATA( 0xff, 0x80, 0x80 ); +/*?*/ pDefaultCol[ 6 ] = RGB_COLORDATA( 0x00, 0x66, 0xcc ); +/*?*/ pDefaultCol[ 7 ] = RGB_COLORDATA( 0xcc, 0xcc, 0xff ); +/*?*/ pDefaultCol[ 8 ] = RGB_COLORDATA( 0x00, 0x00, 0x80 ); +/*?*/ pDefaultCol[ 9 ] = RGB_COLORDATA( 0xff, 0x00, 0xff ); +/*?*/ pDefaultCol[ 10 ] = RGB_COLORDATA( 0x00, 0xff, 0xff ); +/*?*/ pDefaultCol[ 11 ] = RGB_COLORDATA( 0xff, 0xff, 0x00 ); +/*N*/ } +/*N*/ +/*N*/ // create colors from table if they exist otherwise copy default colors +/*N*/ pDefaultColors = new List; +/*N*/ Color aCol; +/*N*/ +/*N*/ for( int i=0; i<nCount; i++ ) +/*N*/ { +/*N*/ aCol.SetColor( pDefaultCol[ i ] ); +/*N*/ pDefaultColors->Insert( new XColorEntry( aCol, String() ), LIST_APPEND ); +/*N*/ } +/*N*/ +/*N*/ delete[] pDefaultCol; +/*N*/ } + +/************************************************************************* +|* +|* Defaultfarben kopieren +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Defaultfarben loeschen +|* +\************************************************************************/ + +/*N*/ void ChartModel::DestroyDefaultColors () +/*N*/ { +/*N*/ if (pDefaultColors) +/*N*/ { +/*N*/ while (pDefaultColors->Count()) +/*N*/ delete (XColorEntry*)pDefaultColors->Remove(pDefaultColors->Count() - 1); +/*N*/ delete pDefaultColors; +/*N*/ } +/*N*/ +/*N*/ pDefaultColors = 0; +/*N*/ } + +/************************************************************************* +|* +|* Berechnung der Breite und der Hoehe eines Textes +|* +|* Derzeit ist diese funktion totaler Muell: Im wesentlichen werden die Werte direkt gesetzt +|* Hoehe = 2 * Texthoehe, Breite hoechstens MaximumWidth +|* +|* FG: Damit dies Funktioniert muss per SetText im Outliner (pOutliner) +|* der Text schon gesetzt sein! +|* +\************************************************************************/ +#define MAXLEGENDLINES 3 //#49908# #NACHTRAG# +#define CDEG2RAD(fAngle) ( (double)(fAngle)*F_PI/18000.0 ) + + +/*N*/ void ChartModel::SetTextAttributes (SfxItemSet & rTextAttributes) +/*N*/ { +/* static SfxItemSet * pLastItemSet = NULL; + if (&rTextAttributes == pLastItemSet) + return; + else + pLastItemSet = &rTextAttributes; +*/ +/*N*/ ULONG nParagraphCount = pOutliner->GetParagraphCount(); +/*N*/ for (ULONG i=0; i<nParagraphCount; i++) +/*N*/ pOutliner->SetParaAttribs(i, rTextAttributes); +/*N*/ } + + +// bGetRotated sollte TRUE sein, wenn der verbrauchte Platz des Textes gemessen werden soll, +// und False, falls das TextRect berechnet und dann gedreht wird (sonst doppelte Drehung) +// The flag bSetTextAttributes tells the method wether to set the given attributes to the +// outliner. +/*N*/ Size ChartModel::CalcTextSizeOfOneText (SvxChartTextOrient eOrient, +/*N*/ SfxItemSet &rTextAttr, +/*N*/ SdrOutliner *pOutliner, +/*N*/ long MaxW, +/*N*/ BOOL bGetRotated/*=FALSE*/, +/*N*/ BOOL bUseTextAttributes) +/*N*/ { +/*N*/ long MaximumWidth=MaxW; +/*N*/ +/*N*/ pOutliner->SetUpdateMode (FALSE); +/*N*/ ULONG nParaCnt = pOutliner->GetParagraphCount(); +/*N*/ +/*N*/ // FG: Jeder Absatz muss die Text-Attribute einzeln zugewiesen bekommen. (jedenfalls scheint es so) +/*N*/ // Besser waere es dass fuer alle Absaetze auf einmal setzen zu koennen. +/*N*/ if (bUseTextAttributes) +/*N*/ SetTextAttributes (rTextAttr); +/*N*/ +/*N*/ Size OldPaperSize = pOutliner->GetPaperSize(); +/*N*/ +/*N*/ long nDegrees=GetTextRotation((SfxItemSet&)rTextAttr,eOrient);//#62531# +/*N*/ double fDeg, fSin, +/*N*/ fCos = 1; // BM: Initialize Cos for if statement after if(nDegrees)-Block +/*N*/ BOOL bBreakOK=TRUE; //s.u. +/*N*/ if(nDegrees) +/*N*/ { +/*N*/ //TVM: In einigen Bereichen macht Umbruch keinen Sinn, da die Breite steigt (90 bzw. +/*N*/ //270 Grad ist der triviale Fall!) Der genaue Bereich ist hier nicht festgelegt, +/*N*/ //denn jeder andere Fall ist leider nicht trivial! (Abhängig davon, wieviele Zeichen +/*N*/ //und welche umgebrochen werden, 2 Beispiele: +/*N*/ // 1. nur ein 'i' wird umgebrochen => Text wird fast immer breiter (ausser bei ~ 0 Grad) +/*N*/ // 2. der halbe Text wird umgebrochen => fast immer sinnvoll +/*N*/ //Die genaue Berechnung erfordert einen Test und ein Undo, wenn es breiter wird +/*N*/ //Im folgenden wird einfach die Mitte genommen -> 90% - Lösung +/*N*/ bBreakOK =!( ((nDegrees > 4500) && (nDegrees < 13500)) +/*N*/ || ((nDegrees >22500) && (nDegrees < 31500))); +/*N*/ +/*N*/ fDeg=CDEG2RAD(nDegrees); +/*N*/ fSin=fabs(sin(fDeg)); +/*N*/ fCos=fabs(cos(fDeg)); +/*N*/ +/* + Hat man gedrehten Text, wird ein sinnvoller Umbruch schwierig, da + + 1. bei bestimmten Winkeln und bestimmter Textlänge der Text breiter und nicht schmaler wird + 2. Diese Funktion bei Winkeln != 0 mit MaximumWidth u.U. die Höhe vorgegeben bekommt + (Create2DBackplane tut dies bei gedrehten Texten an der X-Achse) + untenstehender Code berechnet die vorzugebene MaxBreite, wenn der Text gedreht ist, dies + wäre leider nur ein Teil der notwendigen Lösung, die so schon recht viel Performance schluckt: + + if( MaximumWidth > 0 && fCos!=0) + { + Size aFullSize(pOutliner->CalcTextSize()); //Textgröße ohne Umbruch + double dW = aFullSize.Height()*fSin; //delta width je neue Zeile + double Wf = aFullSize.Width(); //Ist-Textbreite durch Soll-Textbreite des Textes ergibt die Anzahl der Zeilen + + double p_halbe = (dW-(double)MaximumWidth)/(2*fCos); + double p_halbe_quadrat = p_halbe * p_halbe; + double q = Wf*dW/fCos; + if(q > p_halbe_quadrat) + { + MaximumWidth=-1; //keine Lösung, Abbruch, nix umbrechen! + } + else + { + long nNewMax1 =(long) (- p_halbe + sqrt(p_halbe_quadrat-q) + 0.5); + long nNewMax2 =(long) (- p_halbe - sqrt(p_halbe_quadrat-q) + 0.5); + //Die größere Breite ist immer die bessere + MaximumWidth=Max(nNewMax1,nNewMax2); + } + } +*/ +/*N*/ } +/*N*/ +/*N*/ if( MaximumWidth > 0 && fCos!=0) //Kein Umbruch bei 90 und 270 Grad oder Max<=0 +/*N*/ pOutliner->SetPaperSize( Size( MaximumWidth, 0 ) ); +/*N*/ +/*N*/ +/*N*/ pOutliner->SetUpdateMode (TRUE); +/*N*/ Size aSize = pOutliner->CalcTextSize(); +/*N*/ pOutliner->SetUpdateMode (FALSE); +/*N*/ Size aRot(aSize); +/*N*/ if(nDegrees) +/*N*/ { +/*N*/ aRot.Width() = (long)( (double)aSize.Width()*fCos + (double)aSize.Height()*fSin ); +/*N*/ aRot.Height()= (long)( (double)aSize.Width()*fSin + (double)aSize.Height()*fCos ); +/*N*/ } +/*N*/ +/*N*/ // FG: Diese Groesse wird nun veraendert, falls MaximumWidth > 0 und +/*N*/ // aSize.Width() > MaximumWidth, dann wird umgebrochen, genau einmal. +/*N*/ // Es kommen also hoechstens 2 Zeilen raus, der Rest wird dann abgeschnitten. +/*N*/ // An dieser Stelle werden aber nur die Attribute berechnet. +/*N*/ +/*N*/ if ((MaximumWidth > 0) && (eOrient != CHTXTORIENT_STACKED)) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ if(!(aRot.Width() <= MaximumWidth)) +/*N*/ DBG_WARNING("ChartModel::CalcTextSizeOfOneText:Doch breiter?" ); +/*N*/ #endif +/*N*/ ULONG nLines = 0; +/*N*/ for( USHORT n = 0; n < pOutliner->GetParagraphCount(); n++ ) +/*N*/ { +/*N*/ nLines += pOutliner->GetLineCount( n ); +/*N*/ } +/*N*/ +/*N*/ // Silbentrennung nur bei >MAXLEGENDLINES Zeilen oder einem zu langen wort... +/*N*/ if ( bBreakOK +/*N*/ && ( ( nLines > MAXLEGENDLINES ) +/*N*/ || ( ( nLines >= 2 ) +/*N*/ && ( nParaCnt == 1 ) +/*N*/ && ( pOutliner->GetText( pOutliner->GetParagraph( 0 ) ).Search( ' ' ) +/*N*/ == STRING_NOTFOUND ) +/*N*/ ) +/*N*/ ) +/*N*/ ) +/*N*/ { +/*?*/ if ( nLines > MAXLEGENDLINES ) +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 long nHeightOfRows = GetHeightOfnRows (rTextAttr, MAXLEGENDLINES);//war mal 2 statt MAX...#50395# +/*?*/ } +/*?*/ +/*?*/ ULONG nParaCnt = pOutliner->GetParagraphCount(); +/*?*/ +/*?*/ for (ULONG i = 0; i < nParaCnt; i++) +/*?*/ { +/*?*/ // Stets Silbentrennung +/*?*/ SfxItemSet aAttr(pOutliner->GetParaAttribs(i)); +/*?*/ aAttr.Put( SfxBoolItem(EE_PARA_HYPHENATE, TRUE) ); +/*?*/ pOutliner->SetParaAttribs(i, aAttr); +/*?*/ } +/*?*/ +/*?*/ //#50395# durch Bindestriche vergrößert worden-> +/*?*/ //statt 2 werden jetzt 3 Zeilen benötigt +/*?*/ ULONG nActLines = 0; +/*?*/ for( USHORT n = 0; n < pOutliner->GetParagraphCount(); n++ ) +/*?*/ { +/*?*/ nActLines += pOutliner->GetLineCount( n ); +/*?*/ } +/*?*/ if(nActLines>nLines) +/*?*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 nActLines=Min((ULONG)MAXLEGENDLINES,nActLines); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pOutliner->SetPaperSize(OldPaperSize); +/*N*/ pOutliner->SetUpdateMode (TRUE); +/*N*/ +/*N*/ return (bGetRotated && nDegrees) ? aRot : aSize; +/*N*/ } + +/************************************************************************* +|* +|* Liefert die Hoehe von n Textzeilen, mit den uebergebenen Attributen +|* FG: 13.2.97 Hier wird einfach n mal die Texthoehe einer Zeile zurueckgegeben +|* +\************************************************************************/ + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode2.cxx b/binfilter/bf_sch/source/core/sch_chtmode2.cxx new file mode 100644 index 000000000000..56058be17e70 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode2.cxx @@ -0,0 +1,2300 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _STREAM_HXX +// enable stream operators >>/<< for UniString (8 Bit !) +//#ifndef ENABLE_STRING_STREAM_OPERATORS +//#define ENABLE_STRING_STREAM_OPERATORS +//#endif +#endif + +#include "schattr.hxx" +#include "memchrt.hxx" + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS + +#include <bf_svtools/eitem.hxx> + +#endif + +#include <bf_svtools/itempool.hxx> + + +#include <bf_svx/svdopath.hxx> + + +#include <bf_svx/xlnclit.hxx> +#include <bf_svx/xlnwtit.hxx> +#ifndef _ZFORLIST_HXX //autogen +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#endif +#include <bf_svx/eeitem.hxx> +#include <bf_svtools/zformat.hxx> +// header for getProcessServiceFactory + +#include "chmod3d.hxx" //SchRectObj + +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#define ITEMID_FONTWIDTH EE_CHAR_FONTWIDTH +#define ITEMID_FONT EE_CHAR_FONTINFO +#include "globfunc.hxx" +#include <bf_svx/svxids.hrc> +#include "schresid.hxx" +#include "schiocmp.hxx" + +#include "strings.hrc" +#include "glob.hrc" + +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/fontitem.hxx> + +#include <tools/tenccvt.hxx> + +#include "pairs.hxx" +#include "chaxis.hxx" + + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + + +/************************************************************************/ +const USHORT nCompatAxisWhichPairs[] = +{ + SCHATTR_TEXT_START, SCHATTR_TEXT_END, + SCHATTR_Y_AXIS_START, SCHATTR_Z_AXIS_END, //X-Z! + SCHATTR_AXISTYPE, SCHATTR_AXISTYPE, + SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, + SCHATTR_TEXT_OVERLAP, SCHATTR_TEXT_OVERLAP, + SCHATTR_AXIS_START,SCHATTR_AXIS_END, + XATTR_LINE_FIRST, XATTR_LINE_LAST, + EE_ITEMS_START, EE_ITEMS_END, + SID_TEXTBREAK, SID_TEXTBREAK, + SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, //10.585 + 0 +}; +/************************************************************************/ + +enum ChartStyleV0 +{ + CHART2D_LINE, + CHART2D_STACKEDLINE, + CHART2D_BAR, + CHART2D_STACKEDBAR, + CHART2D_COLUMN, + CHART2D_STACKEDCOLUMN, + CHART2D_AREA, + CHART2D_STACKEDAREA, + CHART2D_PIE, + CHART3D_STRIPE, + CHART3D_BAR, + CHART3D_FLATBAR, + CHART3D_STACKEDFLATBAR, + CHART3D_AREA, + CHART3D_STACKEDAREA, + CHART3D_SURFACE, + CHART3D_PIE +}; + +/************************************************************************* +|* +|* Datenbeschriftung erzeugen +|* +\************************************************************************/ + +//SdrObject* + +/*N*/ USHORT ChartModel::GetRegressStrId( long nRow ) +/*N*/ { +/*N*/ +/*N*/ const SfxItemSet& aDataRowAttr = GetDataRowAttr( nRow ); +/*N*/ USHORT nStringID = 0; +/*N*/ +/*N*/ switch (((const SfxInt32Item &) aDataRowAttr.Get (SCHATTR_STAT_REGRESSTYPE)).GetValue ()) +/*N*/ { +/*N*/ case CHREGRESS_NONE : +/*N*/ break; +/*N*/ +/*N*/ case CHREGRESS_LINEAR : +/*?*/ nStringID = STR_REGRESSION_LINEAR; +/*?*/ break; +/*N*/ +/*?*/ case CHREGRESS_LOG : +/*?*/ nStringID = STR_REGRESSION_LOG; +/*?*/ break; +/*?*/ +/*?*/ case CHREGRESS_EXP : +/*?*/ nStringID = STR_REGRESSION_EXP; +/*?*/ break; +/*?*/ +/*?*/ case CHREGRESS_POWER : +/*?*/ nStringID = STR_REGRESSION_POWER; +/*?*/ +/*N*/ } +/*N*/ return nStringID; +/*N*/ } +/************************************************************************* +|* +|* Diagrammlegende erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjGroup* ChartModel::CreateLegend(const Rectangle &aRect) +/*N*/ { +/*N*/ // Default ist, dass die Legende nicht breiter als 20% der gesamten Seitenbreite +/*N*/ // verwenden darf, unter der Bedingung, dass sie links oder rechts vom Chart steht. +/*N*/ // wenn sie ueber oder unter dem Chart steht, dann ist die Seitenbreite das Maximum +/*N*/ +/*N*/ //TVM: obiges ist nicht richtig, CreateLegend wurde stets ohne 2.Argument +/*N*/ //aufgerufen, daher galt immer fMax...=0.2, ausserdem bezieht sich die maximale +/*N*/ //Breite auf den Text in der Legende, nicht auf die Legende selbst +/*N*/ //(Test: 1-Zeiliges Chart mit langem Text!) +/*N*/ //Obiges klngt aber durchaus plausibel, also sollte man es mal bei Gelegenheit +/*N*/ //einbauen (ToDo:-Liste) +/*N*/ const double fMaximumWidth=0.2; +/*N*/ +/*N*/ SvxChartLegendPos eLegendPos = ((const SvxChartLegendPosItem&) pLegendAttr->Get(SCHATTR_LEGEND_POS)). +/*N*/ GetValue(); +/*N*/ BOOL bWide = (eLegendPos == CHLEGEND_TOP || eLegendPos == CHLEGEND_BOTTOM); +/*N*/ BOOL bRowLegend = !IsPieChart(); +/*N*/ BOOL bReverse = !bWide && IsStackedChart(); +/*N*/ BOOL bForceSolidLine = FALSE; +/*N*/ +/*N*/ SchObjGroup* pGroup = NULL; +/*N*/ +/*N*/ if (bLegendVisible) +/*N*/ { +/*N*/ +/*N*/ List aTextList; +/*N*/ long i; +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ // FG: nCnt ist die Anzahl Texte! +/*N*/ long nCnt = bRowLegend ? nRowCnt : GetColCount(); +/*N*/ long nMaxX = 0; +/*N*/ long nMaxY = 0; +/*N*/ +/*N*/ long nLineMaxY = 0; //#50082# +/*N*/ +/*N*/ long* pHeightOfEntry = new long[nCnt*2]; // FG: Wirkliche Hoehe der Zeilen +/*N*/ long* pWidthOfEntry = new long[nCnt*2]; // FG: Wirkliche Breite der Zeilen +/*N*/ long nLines = 0; // Anzahl Zeilen +/*N*/ long nActualColumn = 1; // FG: Zaehlt die Anzahl Spalten +/*N*/ +/*N*/ long* pRegressNr = new long [nCnt]; +/*N*/ memset (pRegressNr, 0, sizeof (long) * nCnt); +/*N*/ +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTextWhichPairs); +/*N*/ +/*N*/ aTextAttr.Put(*pLegendAttr); +/*N*/ +/*N*/ // FG: Hier wird einmal die Liste aller Texte durchgegangen um die maximale Hoehe und +/*N*/ // die maximale Breite zu bestimmen. Bei der Gelegenheit merkt man sich auch die +/*N*/ // Ausmasse der einzelnen Eintraege. +/*N*/ for (i = 0; i < nCnt; i++) +/*N*/ { +/*N*/ // FG: Mehr als fMaximumWidth des Charts soll die Legende nie einnehmen +/*N*/ SdrObject *pText = CreateTextObj(CHOBJID_TEXT, Point (), +/*N*/ bRowLegend ? RowText(i) : ColText(i), +/*N*/ aTextAttr, +/*N*/ FALSE, +/*N*/ CHADJUST_TOP_LEFT, //FG: wie der Default +/*N*/ GetPage(0)->GetSize().Width() * fMaximumWidth); +/*N*/ +/*N*/ // FG: Das hier soll verhindern dass der Text in der Legende markiert werden kann +/*N*/ // dazu gibt es ja kein gueltiges Kontextmenue +/*N*/ pText->SetMarkProtect(TRUE); +/*N*/ aTextList.Insert(pText, LIST_APPEND); +/*N*/ +/*N*/ pWidthOfEntry[i] = pText->GetLogicRect().GetWidth(); +/*N*/ pHeightOfEntry[i] = pText->GetLogicRect().GetHeight(); +/*N*/ nMaxX = Max (nMaxX, pWidthOfEntry[i]); +/*N*/ nMaxY = Max (nMaxY, pHeightOfEntry[i]); +/*N*/ } +/*N*/ +/*N*/ if (IsXYChart()) +/*N*/ { +/*N*/ USHORT nStringID; +/*N*/ for( i = 1; i < nCnt; i++ ) +/*N*/ { +/*N*/ nStringID = GetRegressStrId( i ); +/*N*/ if( nStringID ) +/*N*/ { +/*?*/ SchResId aRegId = SchResId( nStringID ); +/*?*/ String aRegressStr( aRegId ); +/*?*/ String aSeriesName( bRowLegend +/*?*/ ? RowText( i ) +/*?*/ : ColText( i )); +/*?*/ String aLegendText( SchResId( STR_STATISTICS_IN_LEGEND )); +/*?*/ +/*?*/ aLegendText.SearchAndReplaceAscii( "$(STATTYP)", aRegressStr ); +/*?*/ aLegendText.SearchAndReplaceAscii( "$(ROWNAME)", aSeriesName ); +/*?*/ +/*?*/ SdrObject *pText = CreateTextObj( CHOBJID_TEXT, Point(), aLegendText, +/*?*/ aTextAttr, FALSE, +/*?*/ CHADJUST_TOP_LEFT, +/*?*/ GetPage( 0 )->GetSize().Width() * fMaximumWidth ); +/*?*/ +/*?*/ pText->SetMarkProtect( TRUE ); +/*?*/ aTextList.Insert(pText, LIST_APPEND); +/*?*/ +/*?*/ pWidthOfEntry[nLines+nCnt] = pText->GetLogicRect().GetWidth(); +/*?*/ pHeightOfEntry[nLines+nCnt] = pText->GetLogicRect().GetHeight(); +/*?*/ nMaxX = Max (nMaxX, pWidthOfEntry[nLines+nCnt]); +/*?*/ nMaxY = Max (nMaxY, pHeightOfEntry[nLines+nCnt]); +/*?*/ +/*?*/ // nMaxX = Max (nMaxX, pText->GetLogicRect().GetWidth()); +/*?*/ // nMaxY = Max (nMaxY, pText->GetLogicRect().GetHeight()); +/*?*/ +/*?*/ pRegressNr [nLines] = i; +/*?*/ nLines ++; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (IsXYChart ()) nCnt --; +/*N*/ nLines += nCnt; +/*N*/ +/*N*/ long nTextRows = 0; +/*N*/ long nTextCols = 0; +/*N*/ long nShows = 0; +/*N*/ +/*N*/ ULONG nLegendHeight = ((SvxFontHeightItem &) pLegendAttr->Get (EE_CHAR_FONTHEIGHT)).GetHeight(); +/*N*/ long nLittleSpace = nLegendHeight / 3; +/*N*/ +/*N*/ // FG: Hier wird berechnet wieviele Spalten und Zeilen die Legende haben soll +/*N*/ if (!bWide) // dann ist die Legende mit den Zeilen untereinander links oder rechts +/*N*/ { +/*N*/ // FG: Die Legende darf maximal 90% der Blatthoehe einnehmen und maximal 50% der Blattbreite +/*N*/ if (nLines * (nMaxY + nLittleSpace) < (aRect.GetHeight() - 0.1 * aRect.GetHeight())) +/*N*/ { +/*N*/ nTextRows = nLines; +/*N*/ nTextCols = 1; // Also eine Spalte +/*N*/ } +/*N*/ else // Es gibt also mehrere Spalten +/*N*/ { +/*?*/ nTextRows = (long) ((aRect.GetHeight() - 0.1 * aRect.GetHeight()) / (nMaxY + nLittleSpace)); +/*?*/ if(!nTextRows) +/*?*/ nTextRows=1; +/*?*/ nTextCols = (long) ((nLines % nTextRows) ? nLines / nTextRows + 1 : nLines / nTextRows); +/*?*/ // FG: Falls die Legende zu breit (mehr als 50% der Chart-Breite) wird muss man nachregeln +/*?*/ if (nTextCols * (nMaxX + nLittleSpace) > aRect.GetWidth()) +/*?*/ { +/*?*/ nTextCols = (long) (aRect.GetWidth() * 0.5 / (nMaxX + nLittleSpace)); +/*?*/ } +/*?*/ } +/*N*/ } +/*N*/ else // die Legende befindet sich also unter oder ueber dem Chart (die wird noch beliebig gross) +/*N*/ { +/*?*/ nTextCols = (nLines * (nMaxX + 2*nLittleSpace + nLegendHeight) + nLittleSpace < aRect.GetWidth()) +/*?*/ ? nLines : (aRect.GetWidth() - nLittleSpace) / (nMaxX + 2*nLittleSpace + nLegendHeight); +/*?*/ nTextRows = nTextCols +/*?*/ ? ((nLines % nTextCols) ? nLines / nTextCols + 1 : nLines / nTextCols) : 0; +/*N*/ } + +/*N*/ if (nTextRows > 0 && nTextCols > 0) +/*N*/ { +/*N*/ pGroup = new SchObjGroup; +/*N*/ pGroup->InsertUserData(new SchObjectId(CHOBJID_LEGEND)); +/*N*/ // pGroup->SetResizeProtect(TRUE); +/*N*/ SdrObject* pObj; +/*N*/ SdrObjList* pObjList = pGroup->GetSubList(); +/*N*/ +/*N*/ Point aTextPos (nLittleSpace, nLegendHeight / 4); +/*N*/ +/*N*/ for (i = 0, nShows = 0; +/*N*/ i < nLines; +/*N*/ i++, nShows ++) +/*N*/ { +/*N*/ // FG: bReverse ist fuer gestapelte Diagramme gedacht, damit die Legendensymbole +/*N*/ // optisch der Reihenfolge des stapelns entsprechen. +/*N*/ long nIndex = (IsXYChart()) +/*N*/ ? i+1 +/*N*/ : (bReverse) +/*N*/ ? nCnt - 1 - i +/*N*/ : i; +/*N*/ +/*N*/ if (i < nCnt) +/*N*/ { +/*N*/ BOOL bIsSymbol = FALSE; +/*N*/ BOOL bIsLine = FALSE; +/*N*/ if(HasSymbols(nIndex)) +/*N*/ { +/*N*/ bIsSymbol = TRUE; +/*N*/ pObj = CreateSymbol (Point (aTextPos.X () + nLegendHeight / 2, +/*N*/ aTextPos.Y () + nLegendHeight / 2 + nLittleSpace / 3), +/*N*/ nIndex, 0, (SfxItemSet &) GetDataRowAttr(nIndex), nLegendHeight, FALSE); +/*N*/ if(pObj) +/*N*/ { +/*N*/ Rectangle aRect(pObj->GetSnapRect()); +/*N*/ if((aRect.GetHeight() > nLegendHeight) && nLegendHeight) +/*N*/ { +/*?*/ Fraction aFract(nLegendHeight,aRect.GetHeight()); +/*?*/ pObj->NbcResize(aRect.Center(),aFract,aFract); +/*N*/ } +/*N*/ } +/*N*/ else //dann Linie als Legendensymbol, sonst geht evtl. garnix mehr +/*N*/ { +/*?*/ XPolygon aLine(2); +/*?*/ aLine [0] = +/*?*/ aLine [1] = aTextPos; +/*?*/ aLine [1].X() += nLegendHeight; +/*?*/ aLine [1].Y() += nLegendHeight; +/*?*/ bIsLine = TRUE; +/*?*/ pObj = new SdrPathObj(OBJ_PLIN, aLine); +/*N*/ } +/*N*/ } +/*N*/ else if (IsLine(nIndex)) +/*N*/ { +/*N*/ XPolygon aLine(2); +/*N*/ +/*N*/ aLine [0] = +/*N*/ aLine [1] = aTextPos; +/*N*/ aLine [1].X() += nLegendHeight; +/*N*/ aLine [1].Y() += nLegendHeight; +/*N*/ +/*N*/ bIsLine = TRUE; +/*N*/ pObj = new SdrPathObj(OBJ_PLIN, aLine); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // create rectangular shape as legend symbol +/*N*/ pObj = new SdrRectObj(Rectangle(Point (aTextPos.X(), +/*N*/ aTextPos.Y() + nLittleSpace / 3), +/*N*/ Size(nLegendHeight, nLegendHeight))); +/*N*/ bForceSolidLine = TRUE; +/*N*/ } +/*N*/ // FG: setzen des Symbols neben dem Legendentext +/*N*/ +/*N*/ SfxItemSet *pSymbolAttr; +/*N*/ +/*N*/ if( bRowLegend ) +/*N*/ { +/*N*/ pSymbolAttr = new SfxItemSet( GetDataRowAttr( nIndex ) ); +/*N*/ if( ! bIsLine && pSymbolAttr ) +/*N*/ GenerateSymbolAttr( *pSymbolAttr, nIndex, SYMBOLMODE_LEGEND ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pSymbolAttr = new SfxItemSet( GetFullDataPointAttr( nIndex, 0 ) ); +/*N*/ if( ! bIsLine && pSymbolAttr ) +/*N*/ GenerateSymbolAttr( *pSymbolAttr, 0, SYMBOLMODE_LEGEND ); +/*N*/ } +/*N*/ +/*N*/ if( bForceSolidLine ) +/*N*/ { +/*N*/ XLineStyle eLineStyle = +/*N*/ SAL_STATIC_CAST( const XLineStyleItem *, &(pSymbolAttr->Get( XATTR_LINESTYLE )) )->GetValue(); // bug in Win-C++ compiler: casting to pointer +/*N*/ +/*N*/ if( eLineStyle == XLINE_NONE ) +/*N*/ { +/*N*/ pSymbolAttr->ClearItem( XATTR_LINESTYLE ); +/*N*/ pSymbolAttr->ClearItem( XATTR_LINEWIDTH ); +/*N*/ pSymbolAttr->ClearItem( XATTR_LINECOLOR ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes( *pSymbolAttr, FALSE ); +/*N*/ pObj->SetItemSet(*pSymbolAttr); +/*N*/ +/*N*/ +/*N*/ if(bRowLegend) +/*N*/ { +/*N*/ pObj->InsertUserData(new SchObjectId(CHOBJID_LEGEND_SYMBOL_ROW)); +/*N*/ pObj->InsertUserData(new SchDataRow(nIndex)); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pObj->InsertUserData(new SchObjectId(CHOBJID_LEGEND_SYMBOL_COL)); +/*N*/ pObj->InsertUserData(new SchDataPoint(nIndex, 0)); +/*N*/ } +/*N*/ +/*N*/ pObj->SetMoveProtect(TRUE); +/*N*/ pObj->SetResizeProtect(TRUE); +/*N*/ pObjList->NbcInsertObject(pObj); +/*N*/ +/*N*/ SdrObject *pText = (SdrObject*)aTextList.GetObject(nIndex); +/*N*/ +/*N*/ pText->NbcMove(Size(aTextPos.X() + nLittleSpace + nLegendHeight, aTextPos.Y())); +/*N*/ pObjList->NbcInsertObject(pText); +/*N*/ +/*N*/ delete pSymbolAttr; +/*N*/ } +/*N*/ else //i >= nCnt +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if (pRegressNr [i - nCnt]) +/*N*/ } +/*N*/ +/*N*/ // FG: Jetzt wird aTextPos fuer den naechsten Legendeneintrag gesetzt +/*N*/ if (bWide) +/*N*/ { +/*?*/ if (nShows >= nTextCols - 1) +/*?*/ { +/*?*/ nLineMaxY = Max(nLineMaxY,pHeightOfEntry[i]);//#50082# #NACHTRAG# +/*?*/ aTextPos.Y () += nLineMaxY + nLittleSpace;//#50082# +/*?*/ aTextPos.X () = nLittleSpace;//nLegendHeight / 6;//SP3: #49906# +/*?*/ nLineMaxY = 0; //#50082# #NACHTRAG# +/*?*/ nShows = -1; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ nLineMaxY = Max(nLineMaxY,pHeightOfEntry[i]);//#50082# +/*?*/ aTextPos.X () += nMaxX + 2 * nLittleSpace + nLegendHeight; +/*?*/ } +/*N*/ } +/*N*/ else if (nShows >= nTextRows - 1) // FG: Die Legende wird in mehrere Spalten umgebrochen +/*N*/ { // also den Spaltenabstand setzen +/*N*/ aTextPos.X () += nMaxX + nLittleSpace + nLegendHeight + 2*nLittleSpace; +/*N*/ aTextPos.Y () = nLegendHeight / 4; +/*N*/ nShows = -1; +/*N*/ if (nActualColumn >= nTextCols) // FG: Dann wird die Legende zu breit! +/*N*/ { +/*N*/ break; // aus der for-Schleife raus, +/*N*/ // es muessen noch Felder deleted werden. +/*N*/ } +/*?*/ nActualColumn++; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ +/*N*/ aTextPos.Y() += pHeightOfEntry[nIndex] + nLittleSpace; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //FG: Jetzt wird das umschliessende Rechteck berechnet. Man fraegt erst das +/*N*/ // BoundingRect des Legenden-Gruppenobjektes ab und addiert an den Raendern ein +/*N*/ // wenig Platz dazu. +/*N*/ Rectangle aLogRect = pGroup->GetLogicRect(); +/*N*/ aLogRect.Left() -= nLittleSpace; +/*N*/ aLogRect.Right() += nLittleSpace; +/*N*/ aLogRect.Top() -= nLittleSpace; +/*N*/ aLogRect.Bottom() += nLittleSpace; +/*N*/ SdrRectObj* pRectObj = new SchRectObj(aLogRect); +/*N*/ // FG: Das hier soll verhindern dass das Rechteck um die Legende markiert werden kann +/*N*/ pRectObj->SetMarkProtect(TRUE); +/*N*/ pRectObj->SetModel( this ); +/*N*/ pObjList->NbcInsertObject(SetObjectAttr(pRectObj, CHOBJID_LEGEND_BACK, +/*N*/ TRUE, TRUE, pLegendAttr), 0); +/*N*/ } +/*N*/ +/*N*/ delete[] pRegressNr; +/*N*/ delete[] pHeightOfEntry; +/*N*/ delete[] pWidthOfEntry; +/*N*/ } +/*N*/ +/*N*/ return pGroup; +/*N*/ } + +/************************************************************************* +|* +|* Diagramm erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjGroup* ChartModel::CreateChart(const Rectangle &rRect) +/*N*/ { +/*N*/ if( pDocShell ) +/*N*/ pDocShell->SetWaitCursor( TRUE ); +/*N*/ +/*N*/ Rectangle aRect( rRect ); +/*N*/ SdrObjGroup* pGroup; +/*N*/ +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_AREA: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ pGroup = Create2DRowLineChart(aRect);//neu, test! +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_LINE: +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_LINESYMBOLS : +/*N*/ case CHSTYLE_2D_STACKEDLINESYM : +/*N*/ case CHSTYLE_2D_PERCENTLINESYM : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_2D_B_SPLINE : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ pGroup = Create2DRowLineChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_COLUMN: +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_BAR: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ pGroup = Create2DColChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ { +/*N*/ for (short i = 1; i < nPieSegCount; i++) +/*N*/ SetPieSegOfs(i, 0); +/*N*/ SetPieSegOfs( 0, 10 ); +/*N*/ pGroup = Create2DPieChart(aRect); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ { +/*N*/ for (short i = 0; i < nPieSegCount; i++) +/*N*/ SetPieSegOfs( i, 10 ); +/*N*/ } +/*N*/ +/*N*/ case CHSTYLE_2D_PIE: +/*N*/ pGroup = Create2DPieChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_DONUT1: //DonutCharts haben jetzt eigenes Create +/*N*/ case CHSTYLE_2D_DONUT2: +/*N*/ pGroup = Create2DDonutChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_XYSYMBOLS : +/*N*/ case CHSTYLE_2D_XY_LINE : +/*N*/ case CHSTYLE_2D_XY : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY : +/*N*/ pGroup = Create2DXYChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_NET: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS: +/*N*/ case CHSTYLE_2D_NET_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_NET_PERCENT: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ pGroup = Create2DNetChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_STRIPE: +/*N*/ case CHSTYLE_3D_AREA: +/*N*/ case CHSTYLE_3D_SURFACE: +/*N*/ pGroup = Create3DDeepChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_FLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ pGroup = Create3DFlatChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_3D_PIE: +/*N*/ pGroup = Create3DNewPieChart(aRect); +/*N*/ break; +/*N*/ +/*N*/ default: +/*?*/ eChartStyle = CHSTYLE_2D_COLUMN; +/*?*/ pGroup = Create2DColChart(aRect); +/*?*/ break; +/*N*/ } +/*N*/ +/*N*/ if( pDocShell ) +/*N*/ pDocShell->SetWaitCursor( FALSE ); +/*N*/ +/*N*/ SdrPage* pPage=GetPage( 0 ); +/*N*/ SdrObject* pObj = GetObjWithId( CHOBJID_DIAGRAM_AREA, *pPage ); +/*N*/ if( pObj ) +/*N*/ pObj->SetMoveProtect( TRUE ); +/*N*/ +/*N*/ return pGroup; +/*N*/ } + +/*N*/ void ChartModel::PrepareOld3DStorage() +/*N*/ { +/*N*/ SfxItemSet aTmpSet(*pItemPool,nRowWhichPairs); +/*N*/ aTmpSet.Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ aTmpSet.Put(XLineWidthItem(0)); +/*N*/ aTmpSet.Put(XLineColorItem(String(), RGBColor(COL_BLACK))); +/*N*/ +/*N*/ +/*N*/ long i,nCount=aDataRowAttrList.Count(); +/*N*/ for (i=0;i<nCount;i++) +/*N*/ { +/*N*/ SfxItemSet *pDataRowAttr = new SfxItemSet (*pItemPool, nRowWhichPairs); +/*N*/ pDataRowAttr->Put(*(aDataRowAttrList.GetObject(i))); +/*N*/ pDataRowAttr->Put(aTmpSet); +/*N*/ aTmpDataRowAttrList.Insert (pDataRowAttr, LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ SfxItemSet * pItemSet; +/*N*/ nCount=aDataPointAttrList.Count(); +/*N*/ for (i=0;i<nCount;i++) +/*N*/ { +/*N*/ SfxItemSet* pSet=new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ pItemSet = aDataPointAttrList.GetObject(i); +/*N*/ if (pItemSet != NULL) +/*N*/ pSet->Put(*pItemSet); +/*N*/ pSet->Put(aTmpSet); +/*N*/ aTmpDataPointAttrList.Insert (pSet, LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ nCount=aSwitchDataPointAttrList.Count(); +/*N*/ for (i=0;i<nCount;i++) +/*N*/ { +/*N*/ SfxItemSet* pSet=new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ pItemSet = aSwitchDataPointAttrList.GetObject(i); +/*N*/ if (pItemSet != NULL) +/*N*/ pSet->Put(*pItemSet); +/*N*/ pSet->Put(aTmpSet); +/*N*/ aTmpSwitchDataPointAttrList.Insert (pSet, LIST_APPEND); +/*N*/ } +/*N*/ } +/*N*/ void ChartModel::CleanupOld3DStorage() +/*N*/ { +/*N*/ long i,nCount = aTmpDataRowAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aTmpDataRowAttrList.GetObject(i); +/*N*/ aTmpDataRowAttrList.Clear(); +/*N*/ +/*N*/ nCount = aTmpDataPointAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aTmpDataPointAttrList.GetObject(i); +/*N*/ aTmpDataPointAttrList.Clear(); +/*N*/ +/*N*/ nCount = aTmpSwitchDataPointAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aTmpSwitchDataPointAttrList.GetObject(i); +/*N*/ aTmpSwitchDataPointAttrList.Clear(); +/*N*/ } +/************************************************************************* +|* +|* Chart-Attribute speichern + +\************************************************************************/ +/*N*/ void ChartModel::PrepareAxisStorage() +/*N*/ { +/*N*/ if(pTmpXItems) +/*?*/ delete pTmpXItems; +/*N*/ if(pTmpYItems) +/*?*/ delete pTmpYItems; +/*N*/ if(pTmpZItems) +/*?*/ delete pTmpZItems; +/*N*/ //Leider muss das ummappen vorm speichern des pools stattfinden +/*N*/ pTmpXItems = new SfxItemSet(*pItemPool,nCompatAxisWhichPairs); +/*N*/ pTmpYItems = new SfxItemSet(*pItemPool,nCompatAxisWhichPairs); +/*N*/ pTmpZItems = new SfxItemSet(*pItemPool,nCompatAxisWhichPairs); +/*N*/ +/*N*/ pTmpXItems->Put(GetAttr(CHOBJID_DIAGRAM_X_AXIS)); +/*N*/ AxisAttrNew2Old(*pTmpXItems,CHOBJID_DIAGRAM_X_AXIS,TRUE); +/*N*/ +/*N*/ pTmpYItems->Put(GetAttr(CHOBJID_DIAGRAM_Y_AXIS)); +/*N*/ AxisAttrNew2Old(*pTmpYItems,CHOBJID_DIAGRAM_Y_AXIS,TRUE); +/*N*/ +/*N*/ pTmpZItems->Put(GetAttr(CHOBJID_DIAGRAM_Z_AXIS)); +/*N*/ AxisAttrNew2Old(*pTmpZItems,CHOBJID_DIAGRAM_Z_AXIS,TRUE); +/*N*/ +/*N*/ +/*N*/ //Achse wird auf Attr-Basis gestreamt! +/*N*/ pChartXAxis->FillItemSet(); +/*N*/ pChartYAxis->FillItemSet(); +/*N*/ pChartZAxis->FillItemSet(); +/*N*/ pChartBAxis->FillItemSet(); +/*N*/ pChartAAxis->FillItemSet(); +/*N*/ } + +/*N*/ void ChartModel::StoreAttributes(SvStream& rOut) const +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ ByteString aBStr( aMainTitle, RTL_TEXTENCODING_ASCII_US ); +/*N*/ CHART_TRACE1( "ChartModel::StoreAttributes (%s)", aBStr.GetBuffer() ); +/*N*/ #endif +/*N*/ +/*N*/ rtl_TextEncoding eSysSet = ::GetSOStoreTextEncoding( gsl_getSystemTextEncoding()); +/*N*/ rOut.SetStreamCharSet( eSysSet ); +/*N*/ +/*N*/ SchIOCompat aIO(rOut, STREAM_WRITE, 17); +/*N*/ long nFileFormat = rOut.GetVersion (); +/*N*/ +/*N*/ //#50116# 8->9 +/*N*/ //#54870# ->10 +/*N*/ //12: ChartAchsen +/*N*/ //13 Nachtrag: X-AchsenAttr-default bei XY-Charts (store unveraendert) +/*N*/ //14 Overlap , Gapwith der 2 Y-Achsen +/*N*/ //15 Neues 3D-Pie +/*N*/ //16 Items fuer Achse SCHATTR_AXIS_SHOWDESCR,SCHATTR_AXIS_SHOWAXIS aktiviert, +/*N*/ // bisher nur von pChartBAxis genutzt! +/*N*/ +/*N*/ //FG: 12 - seit 20.02.1997 - Umbruch ja/ein pro Achse hinzu +/*N*/ //FG: 13 - seit 09.03.1997 Alle Variablen mit Tag 13: +/*N*/ //DL: 14 - seit 11.03.1997 aSpotColor & aAmbientColor +/*N*/ // FG + TextausPositionen +/*N*/ //FG: 15 - set 14.03.1997 Textausrichtung +/*N*/ //SOH:16 - seit 04.05.1997 NumberFormatter +/*N*/ +/*N*/ //TODO: konvertieren der Attribute pChartAttr in eChartStyle (Fileversion >=10) +/*N*/ +/*N*/ UINT32 nMoreData = 16; +/*N*/ +/*N*/ short i, nCount; +/*N*/ +/*N*/ rOut << aLightVec->X (); +/*N*/ rOut << aLightVec->Y (); +/*N*/ rOut << aLightVec->Z (); +/*N*/ +/*N*/ if (pChartData) +/*N*/ { +/*N*/ INT16 ID = CHDATAID_MEMCHART; // damit aeltere versionen damit fertig werden +/*N*/ rOut << (INT16) ID; +/*N*/ rOut << *(SchMemChart*)pChartData; +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ INT16 nInt16 = (INT16)CHDATAID_NONE; rOut << nInt16; +/*N*/ } +/*N*/ +/*N*/ BOOL bDummy = TRUE; // war frueher bOwnChart +/*N*/ rOut << bIsCopied; +/*N*/ rOut << fMinData; +/*N*/ rOut << (INT16)eChartStyle; +/*N*/ +/*N*/ for (i = 0; i < LINE_POINT_COUNT; i++) +/*N*/ rOut << (INT16)eChartLinePoints[i]; +/*N*/ +/*N*/ +/*N*/ // Das ehemalige Member aRowColors[]. Es wird hier simuliert, damit +/*N*/ // alte Codeversionen mit der hier geschriebenen Datei arbeiten koennen. +/*N*/ Color aRowColors[ROW_COLOR_COUNT]; +/*N*/ +/*N*/ aRowColors[0] = Color( 0, 153, 255); +/*N*/ aRowColors[1] = Color(255, 51, 102); +/*N*/ aRowColors[2] = Color(102, 102, 102); +/*N*/ aRowColors[3] = Color( 51, 204, 102); +/*N*/ aRowColors[4] = Color(153, 102, 204); +/*N*/ aRowColors[5] = Color(255, 153, 102); +/*N*/ aRowColors[6] = Color(255, 204, 153); +/*N*/ aRowColors[7] = Color(153, 204, 255); +/*N*/ aRowColors[8] = Color( 0, 204, 204); +/*N*/ aRowColors[9] = Color(153, 0, 153); +/*N*/ aRowColors[10] = Color(255, 51, 51); +/*N*/ +/*N*/ aRowColors[11] = RGBColor(COL_WHITE); +/*N*/ for (i = 0; i < ROW_COLOR_COUNT; i++) +/*N*/ rOut << aRowColors[i]; +/*N*/ +/*N*/ const long nGapWidth = 10; +/*N*/ const long nOverlap = 0; +/*N*/ rOut << (INT32)nGapWidth; +/*N*/ rOut << (INT32)nOverlap; +/*N*/ rOut << (INT32)nMarkLen; //entfaellt demnaechst! -> ChartAxis +/*N*/ rOut << aChartRect; +/*N*/ rOut << (INT32)nPieHeight; +/*N*/ +/*N*/ rOut << (INT16)nPieSegCount; +/*N*/ for (i = 0; i < nPieSegCount; i++) +/*N*/ rOut << (INT32)pPieSegOfs[i]; +/*N*/ +/*N*/ INT16 nXA=nXAngle; +/*N*/ INT16 nYA=nYAngle; +/*N*/ INT16 nZA=nZAngle; +/*N*/ if(IsReal3D() && IsPieChart()) +/*N*/ { +/*N*/ Vector3D aVRot,aVTrans,aVShear,aVScale; +/*N*/ aSceneMatrix.Decompose(aVScale,aVTrans,aVRot,aVShear); +/*N*/ long nAngle= (long)(aVRot.Z() * 1800.0 / F_PI); +/*N*/ nAngle -= 900; +/*N*/ nAngle += 3600; +/*N*/ nAngle %= 3600; +/*N*/ nYA = (INT16)nAngle; +/*N*/ } +/*N*/ +/*N*/ rOut << (INT16)nXA;//anle; +/*N*/ rOut << (INT16)nYA;//ngle; +/*N*/ rOut << (INT16)nZA;//ngle; +/*N*/ +/*N*/ +/*N*/ //neu wegen Achsenrestrukturierung +/*N*/ BOOL bShowXAxis =pChartXAxis->IsVisible(); +/*N*/ BOOL bShowXDescr=pChartXAxis->HasDescription(); +/*N*/ BOOL bShowYAxis =pChartYAxis->IsVisible(); +/*N*/ BOOL bShowYDescr=pChartYAxis->HasDescription(); +/*N*/ BOOL bShowZAxis =pChartZAxis->IsVisible(); +/*N*/ BOOL bShowZDescr=pChartZAxis->HasDescription(); +/*N*/ +/*N*/ +/*N*/ // save unicode strings as ascii-strings for old binary format +/*N*/ rOut << (INT16)eSysSet; +/*N*/ +/*N*/ rOut << bShowMainTitle; +/*N*/ rOut.WriteByteString( aMainTitle ); +/*N*/ rOut << bShowSubTitle; +/*N*/ rOut.WriteByteString( aSubTitle ); +/*N*/ rOut << bShowXAxisTitle; +/*N*/ rOut.WriteByteString( aXAxisTitle ); +/*N*/ rOut << bShowYAxisTitle; +/*N*/ rOut.WriteByteString( aYAxisTitle ); +/*N*/ rOut << bShowZAxisTitle; +/*N*/ rOut.WriteByteString( aZAxisTitle ); +/*N*/ rOut << bShowXAxis; +/*N*/ rOut << bShowXGridMain; +/*N*/ rOut << bShowXGridHelp; +/*N*/ rOut << bShowXDescr; +/*N*/ rOut << bShowYAxis; +/*N*/ rOut << bShowYGridMain; +/*N*/ rOut << bShowYGridHelp; +/*N*/ rOut << bShowYDescr; +/*N*/ rOut << bShowZAxis; +/*N*/ rOut << bShowZGridMain; +/*N*/ rOut << bShowZGridHelp; +/*N*/ rOut << bShowZDescr; +/*N*/ +/*N*/ // In diesem Set koennten ungueltige Items vorhanden sein, da es +/*N*/ // das Set der allgemeinen TitleAttribute (aller Titel) ist +/*N*/ pTitleAttr->ClearInvalidItems(); +/*N*/ pTitleAttr->Store(rOut); +/*N*/ +/*N*/ pMainTitleAttr->Store(rOut); +/*N*/ pSubTitleAttr->Store(rOut); +/*N*/ pXAxisTitleAttr->Store(rOut); +/*N*/ pYAxisTitleAttr->Store(rOut); +/*N*/ pZAxisTitleAttr->Store(rOut); +/*N*/ +/*N*/ pAxisAttr->ClearInvalidItems(); +/*N*/ +/*N*/ pAxisAttr->Store(rOut); +/*N*/ +/*N*/ +/*N*/ +/*N*/ +/*N*/ +/*N*/ //Abwaertskompatibel speichern (this->PrepareAxisStorage()) +/*N*/ pTmpXItems->Store(rOut); +/*N*/ pTmpYItems->Store(rOut); +/*N*/ pTmpZItems->Store(rOut); +/*N*/ +/*N*/ pGridAttr->ClearInvalidItems(); +/*N*/ pGridAttr->Store(rOut); +/*N*/ pXGridMainAttr->Store(rOut); +/*N*/ pYGridMainAttr->Store(rOut); +/*N*/ pZGridMainAttr->Store(rOut); +/*N*/ pXGridHelpAttr->Store(rOut); +/*N*/ pYGridHelpAttr->Store(rOut); +/*N*/ pZGridHelpAttr->Store(rOut); +/*N*/ pDiagramAreaAttr->Store(rOut); +/*N*/ pDiagramWallAttr->Store(rOut); +/*N*/ pDiagramFloorAttr->Store(rOut); +/*N*/ pLegendAttr->Store(rOut); +/*N*/ +/*N*/ +/*N*/ +/*N*/ if (nFileFormat == SOFFICE_FILEFORMAT_31) +/*N*/ { +/*N*/ +/*N*/ SfxItemSet aStoreAttr (*pItemPool, XATTR_LINE_FIRST, XATTR_LINE_LAST, +/*N*/ XATTR_FILL_FIRST, XATTR_FILL_LAST, +/*N*/ //EE_ITEMS_START, EE_ITEMS_END, +/*N*/ SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, 0), +/*N*/ aPoolItemSet (*pItemPool, nRowWhichPairs), +/*N*/ *pItemSet; +/*N*/ +/*N*/ // FG: 25.2.97 Das Schreiben im 3.1 Format geht schief wenn man +/*N*/ // in globfunc.cxx die Routine CopyAttributesFrom40to31 verwendet. +/*N*/ // Dort wurden die items per Invalidate und Set einzeln kopiert. (falsch) +/*N*/ nCount = (short)aDataRowAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ SfxItemSet* pSet = aStoreAttr.Clone(); +/*N*/ pSet->Put( *aDataRowAttrList.GetObject(i), TRUE ); +/*N*/ pSet->Store( rOut ); +/*N*/ delete pSet; +/*N*/ } +/*N*/ +/*N*/ nCount = (short)aDataPointAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ SfxItemSet* pSet = aStoreAttr.Clone(); +/*N*/ pItemSet = aDataPointAttrList.GetObject(i); +/*N*/ if (pItemSet != NULL) +/*N*/ pSet->Put (*pItemSet, TRUE ); +/*N*/ else +/*N*/ pSet->Put (aPoolItemSet, TRUE); +/*N*/ pSet->Store(rOut); +/*N*/ delete pSet; +/*N*/ } +/*N*/ +/*N*/ nCount = (short)aSwitchDataPointAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ SfxItemSet* pSet = aStoreAttr.Clone(); +/*N*/ pItemSet = aSwitchDataPointAttrList.GetObject(i); +/*N*/ if (pItemSet != NULL) +/*N*/ pSet->Put (*pItemSet, TRUE ); +/*N*/ else +/*N*/ pSet->Put (aPoolItemSet, TRUE); +/*N*/ pSet->Store(rOut); +/*N*/ delete pSet; +/*N*/ } +/*N*/ } +/*N*/ else if(nFileFormat <= SOFFICE_FILEFORMAT_40 && IsReal3D()) //siehe auch DocShell, Save,SaveAs!!!!! +/*N*/ { +/*N*/ +/*N*/ nCount = (short)aTmpDataRowAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ aTmpDataRowAttrList.GetObject(i)->Store(rOut); +/*N*/ +/*N*/ nCount = (short)aTmpDataPointAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ aTmpDataPointAttrList.GetObject(i)->Store(rOut); +/*N*/ +/*N*/ nCount = (short)aTmpSwitchDataPointAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ aTmpSwitchDataPointAttrList.GetObject(i)->Store(rOut); +/*N*/ +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SfxItemSet aPoolItemSet (*pItemPool, nRowWhichPairs), +/*N*/ * pItemSet; +/*N*/ +/*N*/ nCount = (short)aDataRowAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ aDataRowAttrList.GetObject(i)->Store(rOut); +/*N*/ +/*N*/ nCount = (short)aDataPointAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pItemSet = aDataPointAttrList.GetObject(i); +/*N*/ if (pItemSet != NULL) +/*N*/ pItemSet->Store(rOut); +/*N*/ else +/*N*/ aPoolItemSet.Store(rOut); +/*N*/ } +/*N*/ +/*N*/ nCount = (short)aSwitchDataPointAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pItemSet = aSwitchDataPointAttrList.GetObject(i); +/*N*/ if (pItemSet != NULL) +/*N*/ pItemSet->Store(rOut); +/*N*/ else +/*N*/ aPoolItemSet.Store(rOut); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ rOut << (INT16)eDataDescr; +/*N*/ rOut << bShowSym; +/*N*/ rOut << bSwitchData; +/*N*/ +/*N*/ UINT32 nTmp; +/*N*/ +/*N*/ nTmp=((ChartModel*)this)->GetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,FALSE); +/*N*/ rOut << nTmp;//nValFormat; +/*N*/ nTmp=((ChartModel*)this)->GetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,TRUE); +/*N*/ rOut << nTmp;//nPercentValFormat; +/*N*/ nTmp=((ChartModel*)this)->GetNumFmt(CHOBJID_DIAGRAM_X_AXIS,FALSE); +/*N*/ rOut << nTmp;//nDescrFormat; +/*N*/ nTmp=((ChartModel*)this)->GetNumFmt(CHOBJID_DIAGRAM_X_AXIS,TRUE); +/*N*/ rOut << nTmp;//nPercentDescrFormat; +/*N*/ +/*N*/ // Achtung : Gravierende Aenderungen an der Datei gegenueber der Auslieferungsversion +/*N*/ // es werden mehr Daten geschrieben : Die alte Version muss (!) das aber auch verkraften +/*N*/ // Die Reihenfolge muss (!!!!) eingehalten werden +/*N*/ pChartYAxis->StoreMemberCompat(rOut); +/*N*/ pChartXAxis->StoreMemberCompat(rOut); +/*N*/ pChartZAxis->StoreMemberCompat(rOut); +/*N*/ +/*N*/ rOut << fMaxData; +/*N*/ +/*N*/ rOut << nMoreData; +/*N*/ +/*N*/ if (nMoreData >= 2) +/*N*/ if (pChartData) +/*N*/ { +/*N*/ rOut.WriteByteString( pChartData->SomeData1() ); +/*N*/ rOut.WriteByteString( pChartData->SomeData2() ); +/*N*/ rOut.WriteByteString( pChartData->SomeData3() ); +/*N*/ rOut.WriteByteString( pChartData->SomeData4() ); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ String aEmpty; +/*?*/ +/*?*/ rOut.WriteByteString( aEmpty ); +/*?*/ rOut.WriteByteString( aEmpty ); +/*?*/ rOut.WriteByteString( aEmpty ); +/*?*/ rOut.WriteByteString( aEmpty ); +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 3) rOut << fSpotIntensity; +/*N*/ +/*N*/ if (nMoreData >= 4) +/*N*/ { +/*N*/ BOOL bDummy = TRUE; // war frueher bIsRegression +/*N*/ +/*N*/ rOut << bShowAverage; +/*N*/ rOut << (INT16)eErrorKind; +/*N*/ rOut << bDummy; +/*N*/ rOut << (INT16)eIndicate; +/*N*/ rOut << fIndicatePercent; +/*N*/ rOut << fIndicateBigError; +/*N*/ rOut << fIndicatePlus; +/*N*/ rOut << fIndicateMinus; +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 5) rOut << (INT16) eRegression; +/*N*/ +/*N*/ if (nMoreData >= 6) +/*N*/ { +/*N*/ rOut << (INT32) nSplineDepth; +/*N*/ rOut << (INT32) nGranularity; +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 7) +/*N*/ { +/*N*/ rOut << bLegendVisible; +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 8) +/*N*/ { +/*N*/ nCount = (short)aRegressAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ aRegressAttrList.GetObject(i)->Store(rOut); +/*N*/ +/*N*/ nCount = (short)aAverageAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ aAverageAttrList.GetObject(i)->Store(rOut); +/*N*/ +/*N*/ nCount = (short)aErrorAttrList.Count(); +/*N*/ rOut << (INT16)nCount; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ aErrorAttrList.GetObject(i)->Store(rOut); +/*N*/ +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 9) rOut << fAmbientIntensity; +/*N*/ if (nMoreData >= 10) rOut << bTextScalable; +/*N*/ if (nMoreData >= 11) rOut << aInitialSize; +/*N*/ if (nMoreData >= 12) // FG: Zusaetze wegen des Umruchs von Achsentext und Legendentext 20.02.97 +/*N*/ { +/*N*/ // FG: Vielleicht etwas viel Speicher fuer BOOL, aber es macht nur 8 Byte pro Chart +/*N*/ rOut << (INT16) bFormatXAxisTextInMultipleLinesIfNecessary; +/*N*/ rOut << (INT16) bFormatYAxisTextInMultipleLinesIfNecessary; +/*N*/ rOut << (INT16) bFormatZAxisTextInMultipleLinesIfNecessary; +/*N*/ rOut << (INT16) bFormatLegendTextInMultipleLinesIfNecessary; +/*N*/ } +/*N*/ if (nMoreData >= 13) // FG: 9.3.1997 Zusaetze wegen einer freien Positionierung und einem freien +/*N*/ { // Resize von Gruppenobjekten im Chart. +/*N*/ rOut << (INT16) nXAxisTextMaximumNumberOfLines; +/*N*/ rOut << (INT16) nYAxisTextMaximumNumberOfLines; +/*N*/ rOut << (INT16) nZAxisTextMaximumNumberOfLines; +/*N*/ rOut << (INT32) nWidthOfFirstXAxisText; +/*N*/ rOut << (INT32) nWidthOfLastXAxisText; +/*N*/ rOut << aTitleTopCenter; +/*N*/ rOut << aSubTitleTopCenter; +/*N*/ rOut << aDiagramRectangle; +/*N*/ rOut << aLegendTopLeft; +/*N*/ rOut << aTitleXAxisPosition; +/*N*/ rOut << aTitleYAxisPosition; +/*N*/ rOut << aTitleZAxisPosition; +/*N*/ rOut << (INT16) bUseRelativePositionsForChartGroups; +/*N*/ rOut << (INT16) bAdjustMarginsForLegend; +/*N*/ rOut << (INT16) bAdjustMarginsForMainTitle; +/*N*/ rOut << (INT16) bAdjustMarginsForSubTitle; +/*N*/ rOut << (INT16) bAdjustMarginsForXAxisTitle; +/*N*/ rOut << (INT16) bAdjustMarginsForYAxisTitle; +/*N*/ rOut << (INT16) bAdjustMarginsForZAxisTitle; +/*N*/ } +/*N*/ if (nMoreData >= 14) +/*N*/ { +/*N*/ rOut << aSpotColor; // FG: Von DL, um sich die Farbeinstellungen der 3d-Lichter +/*N*/ rOut << aAmbientColor; // bei 3d-Charts merken zu koennen. +/*N*/ +/*N*/ BOOL bTmp=bDiagramHasBeenMovedOrResized; //neu -> alt: dann immer rearrange +/*N*/ if(IsReal3D() && IsPieChart()) +/*N*/ bTmp=FALSE; +/*N*/ +/*N*/ rOut << bTmp; // FG: 12.3.97, Falls das Chart gespeichert wird +/*N*/ rOut << bMainTitleHasBeenMoved; // soll es immer noch die relativen Positionen +/*N*/ rOut << bSubTitleHasBeenMoved; // der Objektgruppen beachten, falls eine +/*N*/ rOut << bLegendHasBeenMoved; // dieser Gruppen bewegt worden ist. +/*N*/ rOut << bXAxisTitleHasBeenMoved; +/*N*/ rOut << bYAxisTitleHasBeenMoved; +/*N*/ rOut << bZAxisTitleHasBeenMoved; +/*N*/ } +/*N*/ if (nMoreData >= 15) // FG: 14.3.97 Damit bei einem angefassten Text die Position sinnvoll gesetzt werden +/*N*/ { // auch nach einer Schriftgroessenaenderung muss man sich merken wie die Ausrichtung war +/*N*/ rOut << (INT16) eAdjustXAxesTitle; +/*N*/ rOut << (INT16) eAdjustYAxesTitle; +/*N*/ rOut << (INT16) eAdjustZAxesTitle; +/*N*/ } +/*N*/ if (nMoreData >= 16) // NumberFormater waren bisher nicht persistent +/*N*/ { +/*N*/ pNumFormatter->Save( rOut ); +/*N*/ pNumFormatter->Save( rOut ); +/*N*/ pNumFormatter->Save( rOut ); +/*N*/ } +/*N*/ +/*N*/ rOut << (INT16) nBarPercentWidth; //#50116# ist ein long, aber Range von 0..100 +/*N*/ rOut << (INT32) m_nDefaultColorSet;//#50149# +/*N*/ +/*N*/ rOut << (INT32) nNumLinesInColChart;//#50212# +/*N*/ +/*N*/ // #74536# BM use these three former -1 dummies for +/*N*/ // numberformat last set by CALC +/*N*/ rOut << (INT32) nXLastNumFmt; +/*N*/ rOut << (INT32) nYLastNumFmt; +/*N*/ rOut << (INT32) nBLastNumFmt; +/*N*/ +/*N*/ rOut << (INT32)(-1); // dummy +/*N*/ +/*N*/ //IOVer 11 +/*N*/ pStockLineAttr->Store(rOut); +/*N*/ pStockLossAttr->Store(rOut); +/*N*/ pStockPlusAttr->Store(rOut); +/*N*/ +/*N*/ +/*N*/ //IOVer12: +/*N*/ //nAxisId ist die zu ladene/speichernde Achse, +/*N*/ //festgelegt sind in V12 nur 1=X, 2=Y,3=Z und 4=2.Y-Achse (B) +/*N*/ //neu: 5 = 2. X-Achse +/*N*/ //-1 bedeutet KEINE WEITEREN ACHSEN! +/*N*/ //Es MUSS keine Achse gestreamt werden (siehe Lade-Routine) +/*N*/ //Die Reihenfolge ist eigentlich auch egal, jedoch gilt beim Laden: +/*N*/ //erst die primaere und dann die sekundaere (X, bzw. evtl auch Y) Achse +/*N*/ //(um defaults aus der primaeren Achse heraus zu erzeugen) +/*N*/ +/*N*/ INT32 nAxisId=CHART_AXIS_PRIMARY_X; +/*N*/ rOut << nAxisId; +/*N*/ GetAttr(CHOBJID_DIAGRAM_X_AXIS).Store(rOut); +/*N*/ +/*N*/ nAxisId=CHART_AXIS_PRIMARY_Y; +/*N*/ rOut << nAxisId; +/*N*/ GetAttr(CHOBJID_DIAGRAM_Y_AXIS).Store(rOut); +/*N*/ +/*N*/ nAxisId=CHART_AXIS_PRIMARY_Z; +/*N*/ rOut << nAxisId; +/*N*/ GetAttr(CHOBJID_DIAGRAM_Z_AXIS).Store(rOut); +/*N*/ +/*N*/ nAxisId=CHART_AXIS_SECONDARY_Y; +/*N*/ rOut << nAxisId; +/*N*/ GetAttr(CHOBJID_DIAGRAM_B_AXIS).Store(rOut); +/*N*/ +/*N*/ nAxisId=CHART_AXIS_SECONDARY_X; +/*N*/ rOut << nAxisId; +/*N*/ GetAttr(CHOBJID_DIAGRAM_A_AXIS).Store(rOut); +/*N*/ +/*N*/ //Elementar wichtig! Diesen Wert zu streamen ist absolutes Minimum +/*N*/ //die obigen derzeit 4 Achsen kann man dagegen getrost reduzieren oder aufstocken +/*N*/ //ohne dass die Abwaertskompatiblitaet leidet! Genauso lassen sich beliebige +/*N*/ //Achsen mit einer Id>4 dazwischen haengen. In alten Versionen wird bei +/*N*/ //unbekannter id einfach ein Dummy geladen (und weggeschmissen) +/*N*/ nAxisId=-1; +/*N*/ rOut << nAxisId; +/*N*/ //Ende IOVersion 12 +/*N*/ +/*N*/ nTmp = aBarY1.GetGap(); +/*N*/ rOut << nTmp; +/*N*/ nTmp = aBarY1.GetOverlap(); +/*N*/ rOut << nTmp; +/*N*/ nTmp = aBarY2.GetGap(); +/*N*/ rOut << nTmp; +/*N*/ nTmp = aBarY2.GetOverlap(); +/*N*/ rOut << nTmp; +/*N*/ +/*N*/ +/*N*/ // IOVersion 15 +/*N*/ rOut << bDiagramHasBeenMovedOrResized; // FG: 12.3.97, Falls das Chart gespeichert wird +/*N*/ } + +/************************************************************************* +|* +|* Chart-Attribute laden +|* +\************************************************************************/ + +/*N*/ void ChartModel::LoadAttributes(SvStream& rIn) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ ByteString aBStr( aMainTitle, RTL_TEXTENCODING_ASCII_US ); +/*N*/ CHART_TRACE1( "ChartModel::LoadAttributes (%s)", aBStr.GetBuffer() ); +/*N*/ #endif +/*N*/ +/*N*/ // aInfo is a member of SdrModel +/*N*/ // the SdrModel was read before this, so the value is set +/*N*/ rtl_TextEncoding eSysSet = ::GetSOLoadTextEncoding( aInfo.eLastReadCharSet, rIn.GetVersion()); +/*N*/ rIn.SetStreamCharSet( eSysSet ); +/*N*/ // Note: The CharSet is stored in the MemChart and later set again at the stream ! +/*N*/ +/*N*/ SchIOCompat aIO(rIn, STREAM_READ); +/*N*/ +/*N*/ short i, nCount; +/*N*/ INT16 nInt16, nCharSet; +/*N*/ INT32 nInt32; +/*N*/ SfxItemSet* pAttr; +/*N*/ BOOL bNoMore = FALSE; +/*N*/ int nVersion = aIO.GetVersion(); +/*N*/ +/*N*/ rIn >> aLightVec->X (); +/*N*/ rIn >> aLightVec->Y (); +/*N*/ rIn >> aLightVec->Z (); +/*N*/ +/*N*/ if (nVersion >= 3) +/*N*/ { +/*N*/ rIn >> nInt16; +/*N*/ +/*N*/ // fuer den fall, dass initial das diagrammfenster generiert wurde +/*N*/ delete pChartData; +/*N*/ +/*N*/ // Note: The CharSet is stored in the MemChart and set there at the stream ! +/*N*/ switch ((ChartDataId)nInt16) +/*N*/ { +/*N*/ case CHDATAID_MEMCHART_PLUS : +/*?*/ pChartData = new SchMemChart (CHDATAID_MEMCHART_PLUS); +/*?*/ rIn >> *(SchMemChart*)pChartData; +/*?*/ pChartData->IncreaseRefCount(); +/*?*/ break; +/*?*/ +/*?*/ case CHDATAID_DYNCHART: +/*N*/ case CHDATAID_MEMCHART: +/*N*/ pChartData = new SchMemChart (CHDATAID_MEMCHART); +/*N*/ rIn >> *(SchMemChart*)pChartData; +/*N*/ pChartData->IncreaseRefCount(); +/*N*/ break; +/*N*/ +/*N*/ default : +/*N*/ bNoMore = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (nVersion >= 5) rIn >> bIsCopied; +/*N*/ +/*N*/ if (nVersion >= 8) rIn >> fMinData; +/*N*/ else if (pChartData) +/*N*/ { +/*?*/ long nColCnt = GetColCount(); +/*?*/ long nRowCnt = GetRowCount(); +/*?*/ +/*?*/ for (short nCol = 0; nCol < nColCnt; nCol++) +/*?*/ for (short nRow = 0; nRow < nRowCnt; nRow++) +/*?*/ { +/*?*/ double fData = GetData(nCol, nRow); +/*?*/ +/*?*/ if ((nCol == 0) && (nRow == 0)) +/*?*/ { +/*?*/ pChartYAxis->SetMin(fData); +/*?*/ pChartYAxis->SetMax(fData); +/*?*/ } +/*?*/ if (fData < pChartYAxis->GetMin()) +/*?*/ pChartYAxis->SetMin(fData); +/*?*/ if (fData > pChartYAxis->GetMax()) +/*?*/ pChartYAxis->SetMax(fData); +/*?*/ } +/*?*/ +/*?*/ bNoMore = TRUE; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; +/*N*/ if (nVersion < 1) +/*N*/ { +/*N*/ switch ((ChartStyleV0)nInt16) +/*N*/ { +/*?*/ case CHART2D_LINE: +/*?*/ eChartStyle = CHSTYLE_2D_LINE; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_STACKEDLINE: +/*?*/ eChartStyle = CHSTYLE_2D_STACKEDLINE; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_BAR: +/*?*/ eChartStyle = CHSTYLE_2D_COLUMN; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_STACKEDBAR: +/*?*/ eChartStyle = CHSTYLE_2D_STACKEDCOLUMN; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_COLUMN: +/*?*/ eChartStyle = CHSTYLE_2D_BAR; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_STACKEDCOLUMN: +/*?*/ eChartStyle = CHSTYLE_2D_STACKEDBAR; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_AREA: +/*?*/ eChartStyle = CHSTYLE_2D_AREA; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_STACKEDAREA: +/*?*/ eChartStyle = CHSTYLE_2D_STACKEDAREA; +/*?*/ break; +/*?*/ +/*?*/ case CHART2D_PIE: +/*?*/ eChartStyle = CHSTYLE_2D_PIE; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_STRIPE: +/*?*/ eChartStyle = CHSTYLE_3D_STRIPE; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_BAR: +/*?*/ eChartStyle = CHSTYLE_3D_COLUMN; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_FLATBAR: +/*?*/ eChartStyle = CHSTYLE_3D_FLATCOLUMN; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_STACKEDFLATBAR: +/*?*/ eChartStyle = CHSTYLE_3D_STACKEDFLATCOLUMN; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_AREA: +/*?*/ eChartStyle = CHSTYLE_3D_AREA; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_STACKEDAREA: +/*?*/ eChartStyle = CHSTYLE_3D_STACKEDAREA; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_SURFACE: +/*?*/ eChartStyle = CHSTYLE_3D_SURFACE; +/*?*/ break; +/*?*/ +/*?*/ case CHART3D_PIE: +/*?*/ eChartStyle = CHSTYLE_3D_PIE; +/*?*/ break; +/*?*/ +/*?*/ default : +/*?*/ eChartStyle = CHSTYLE_2D_COLUMN; +/*?*/ break; +/*?*/ } +/*?*/ +/*?*/ bNoMore = TRUE; +/*?*/ } +/*N*/ else +/*N*/ eChartStyle = (SvxChartStyle)nInt16; +/*N*/ +/*N*/ for (i = 0; i < LINE_POINT_COUNT; i++) +/*N*/ { +/*N*/ rIn >> nInt16; eChartLinePoints[i] = nInt16; +/*N*/ } +/*N*/ +/*N*/ // Das ehemalige Member aRowColors[] wird eingelesen. +/*N*/ Color aDummyColor; +/*N*/ for (i = 0; i < ROW_COLOR_COUNT; i++) +/*N*/ rIn >> aDummyColor; +/*N*/ +/*N*/ long nOverlap; +/*N*/ rIn >> nInt32; //nGapWidth = (long)nInt32; +/*N*/ rIn >> nInt32; nOverlap = (long)nInt32; +/*N*/ rIn >> nInt32; +/*N*/ DBG_ASSERT( nInt32 == 100, "LoadAttributes: nMarkLen's value differs from 100 in this stream" ); +/*N*/ +/*N*/ rIn >> aChartRect; +/*N*/ rIn >> nInt32; nPieHeight = (long)nInt32; +/*N*/ +/*N*/ if (nVersion >= 6) +/*N*/ { +/*N*/ rIn >> nInt16; nPieSegCount = (short)nInt16; +/*N*/ pPieSegOfs = new long[nPieSegCount]; +/*N*/ +/*N*/ BOOL bNullify = (nVersion < 17) && eChartStyle == CHSTYLE_2D_PIE; +/*N*/ +/*N*/ for( i = 0; i < nPieSegCount; i++ ) +/*N*/ { +/*N*/ rIn >> nInt32; +/*N*/ pPieSegOfs[ i ] = bNullify? 0: (long)nInt32; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; nXAngle = (short)nInt16; +/*N*/ rIn >> nInt16; nYAngle = (short)nInt16; +/*N*/ rIn >> nInt16; nZAngle = (short)nInt16; +/*N*/ +/*N*/ rIn >> nCharSet; + + /************************************************************************** + * So machts der Writer, und so muessen es alle machen: + * Bug 9714: Der CharSet an den Fonts muss geaendert werden, wenn + * es der globale CharSet ist (MT) + **************************************************************************/ +/*N*/ SfxItemPool& rPool = GetItemPool(); +/*N*/ USHORT nMaxItems = rPool.GetItemCount(EE_CHAR_FONTINFO); +/*N*/ SvxFontItem* pItem; +/*N*/ +/*N*/ for (USHORT n = 0; n < nMaxItems; ++n) +/*N*/ { +/*N*/ pItem = (SvxFontItem*) rPool.GetItem(EE_CHAR_FONTINFO, n); +/*N*/ if (pItem && pItem->GetCharSet() == nCharSet) +/*N*/ { +/*N*/ pItem->GetCharSet() = eSysSet; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ +/*N*/ BOOL bShowXAxis; +/*N*/ BOOL bShowXDescr; +/*N*/ BOOL bShowYAxis; +/*N*/ BOOL bShowYDescr; +/*N*/ BOOL bShowZAxis; +/*N*/ BOOL bShowZDescr; +/*N*/ +/*N*/ rIn >> bShowMainTitle; +/*N*/ rIn.ReadByteString( aMainTitle ); +/*N*/ rIn >> bShowSubTitle; +/*N*/ rIn.ReadByteString( aSubTitle ); +/*N*/ rIn >> bShowXAxisTitle; +/*N*/ rIn.ReadByteString( aXAxisTitle ); +/*N*/ rIn >> bShowYAxisTitle; +/*N*/ rIn.ReadByteString( aYAxisTitle ); +/*N*/ rIn >> bShowZAxisTitle; +/*N*/ rIn.ReadByteString( aZAxisTitle ); +/*N*/ rIn >> bShowXAxis; +/*N*/ rIn >> bShowXGridMain; +/*N*/ rIn >> bShowXGridHelp; +/*N*/ rIn >> bShowXDescr; +/*N*/ rIn >> bShowYAxis; +/*N*/ rIn >> bShowYGridMain; +/*N*/ rIn >> bShowYGridHelp; +/*N*/ rIn >> bShowYDescr; +/*N*/ rIn >> bShowZAxis; +/*N*/ rIn >> bShowZGridMain; +/*N*/ rIn >> bShowZGridHelp; +/*N*/ rIn >> bShowZDescr; +/*N*/ + /************************************************************************** + * Nun werden die Attribut-ItemSets geladen + * Die etwas umstaendliche Art und Weise ist notwendig, da fruehere Charts + * nicht alle Items weggeschrieben haben. Daher wird in ein leeres ItemSet + * gestreamt und dieses in das Default-ItemSet geputtet (damit keine + * Pool-Defaults zum Tragen kommen). + **************************************************************************/ + +/*N*/ SfxItemSet aTitleAttr(*pItemPool, nTitleWhichPairs); +/*N*/ aTitleAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pTitleAttr, aTitleAttr ); +/*N*/ +/*N*/ SfxItemSet aMainTitleAttr(*pItemPool, nTitleWhichPairs); +/*N*/ aMainTitleAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pMainTitleAttr, aMainTitleAttr ); +/*N*/ +/*N*/ SfxItemSet aSubTitleAttr(*pItemPool, nTitleWhichPairs); +/*N*/ aSubTitleAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pSubTitleAttr, aSubTitleAttr ); +/*N*/ +/*N*/ SfxItemSet aXAxisTitleAttr(*pItemPool, nTitleWhichPairs); +/*N*/ aXAxisTitleAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pXAxisTitleAttr, aXAxisTitleAttr ); +/*N*/ +/*N*/ SfxItemSet aYAxisTitleAttr(*pItemPool, nTitleWhichPairs); +/*N*/ aYAxisTitleAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pYAxisTitleAttr, aYAxisTitleAttr ); +/*N*/ +/*N*/ SfxItemSet aZAxisTitleAttr(*pItemPool, nTitleWhichPairs); +/*N*/ aZAxisTitleAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pZAxisTitleAttr, aZAxisTitleAttr ); +/*N*/ +/*N*/ SfxItemSet aAxisAttr(*pItemPool, nAllAxisWhichPairs); +/*N*/ aAxisAttr.Load(rIn); +/*N*/ pAxisAttr->Put(aAxisAttr); +/*N*/ +/*N*/ CHART_TRACE( "LoadAttributes: Debugging load of old axis attr BEFORE conversion" ); +/*N*/ SfxItemSet aXAxisAttr(*pItemPool, nCompatAxisWhichPairs);//nXAxisWhich.... +/*N*/ aXAxisAttr.Load(rIn); +/*N*/ DBG_ITEMS(aXAxisAttr,(ChartModel*)this); +/*N*/ SfxItemSet aYAxisAttr(*pItemPool, nCompatAxisWhichPairs); +/*N*/ aYAxisAttr.Load(rIn); +/*N*/ DBG_ITEMS(aYAxisAttr,(ChartModel*)this); +/*N*/ SfxItemSet aZAxisAttr(*pItemPool, nCompatAxisWhichPairs); +/*N*/ aZAxisAttr.Load(rIn); +/*N*/ DBG_ITEMS(aZAxisAttr,(ChartModel*)this); +/*N*/ +/*N*/ if(nVersion < 12) //sonst wirds eh uebergebuegelt: +/*N*/ { +/*N*/ //konvertieren: +/*N*/ AxisAttrOld2New(aXAxisAttr,TRUE,CHOBJID_DIAGRAM_X_AXIS); +/*N*/ AxisAttrOld2New(aYAxisAttr,TRUE,CHOBJID_DIAGRAM_Y_AXIS); +/*N*/ AxisAttrOld2New(aZAxisAttr,TRUE,CHOBJID_DIAGRAM_Z_AXIS); +/*N*/ pChartXAxis->SetAttributes(aXAxisAttr); +/*N*/ pChartYAxis->SetAttributes(aYAxisAttr); +/*N*/ pChartZAxis->SetAttributes(aZAxisAttr); +/*N*/ CHART_TRACE( "LoadAttributes: Debugging AFTER conversion" ); +/*N*/ DBG_ITEMS(aXAxisAttr,(ChartModel*)this); +/*N*/ DBG_ITEMS(aYAxisAttr,(ChartModel*)this); +/*N*/ DBG_ITEMS(aZAxisAttr,(ChartModel*)this); +/*N*/ } +/*N*/ +/*N*/ SfxItemSet aGridAttr(*pItemPool, nGridWhichPairs); +/*N*/ aGridAttr.Load(rIn); +/*N*/ pGridAttr->Put(aGridAttr); +/*N*/ +/*N*/ SfxItemSet aXGridMainAttr(*pItemPool, nGridWhichPairs); +/*N*/ aXGridMainAttr.Load(rIn); +/*N*/ pXGridMainAttr->Put(aXGridMainAttr); +/*N*/ +/*N*/ SfxItemSet aYGridMainAttr(*pItemPool, nGridWhichPairs); +/*N*/ aYGridMainAttr.Load(rIn); +/*N*/ pYGridMainAttr->Put(aYGridMainAttr); +/*N*/ +/*N*/ SfxItemSet aZGridMainAttr(*pItemPool, nGridWhichPairs); +/*N*/ aZGridMainAttr.Load(rIn); +/*N*/ pZGridMainAttr->Put(aZGridMainAttr); +/*N*/ +/*N*/ SfxItemSet aXGridHelpAttr(*pItemPool, nGridWhichPairs); +/*N*/ aXGridHelpAttr.Load(rIn); +/*N*/ pXGridHelpAttr->Put(aXGridHelpAttr); +/*N*/ +/*N*/ SfxItemSet aYGridHelpAttr(*pItemPool, nGridWhichPairs); +/*N*/ aYGridHelpAttr.Load(rIn); +/*N*/ pYGridHelpAttr->Put(aYGridHelpAttr); +/*N*/ +/*N*/ SfxItemSet aZGridHelpAttr(*pItemPool, nGridWhichPairs); +/*N*/ aZGridHelpAttr.Load(rIn); +/*N*/ pZGridHelpAttr->Put(aZGridHelpAttr); +/*N*/ +/*N*/ SfxItemSet aDiagramAreaAttr(*pItemPool, nDiagramAreaWhichPairs); +/*N*/ aDiagramAreaAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pDiagramAreaAttr, aDiagramAreaAttr ); +/*N*/ +/*N*/ SfxItemSet aDiagramWallAttr(*pItemPool, nDiagramAreaWhichPairs); +/*N*/ aDiagramWallAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pDiagramWallAttr, aDiagramWallAttr ); +/*N*/ +/*N*/ SfxItemSet aDiagramFloorAttr(*pItemPool, nDiagramAreaWhichPairs); +/*N*/ aDiagramFloorAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pDiagramFloorAttr, aDiagramFloorAttr ); +/*N*/ +/*N*/ SfxItemSet aLegendAttr(*pItemPool, nLegendWhichPairs); +/*N*/ aLegendAttr.Load(rIn); +/*N*/ PutItemSetWithNameCreation( *pLegendAttr, aLegendAttr ); +/*N*/ +/*N*/ if (nVersion < 2) +/*N*/ { +/*?*/ pTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ pMainTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ pSubTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ pXAxisTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ pYAxisTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ pZAxisTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ pAxisAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ +/*?*/ //Achsen auch fuer V12+ OK, (ToDo: Hier ist recht viel Overhead! ) +/*?*/ aXAxisAttr.ClearItem(); +/*?*/ aYAxisAttr.ClearItem(); +/*?*/ aZAxisAttr.ClearItem(); +/*?*/ aXAxisAttr.Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ aXAxisAttr.Put(SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE)); +/*?*/ aYAxisAttr.Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ aYAxisAttr.Put(SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE)); +/*?*/ aZAxisAttr.Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*?*/ pChartXAxis->SetAttributes(aXAxisAttr); +/*?*/ pChartYAxis->SetAttributes(aYAxisAttr); +/*?*/ pChartZAxis->SetAttributes(aZAxisAttr); +/*?*/ +/*?*/ bNoMore = TRUE; +/*?*/ } +/*N*/ +/*N*/ if (nVersion < 7) +/*N*/ { +/*?*/ GetAttr(CHOBJID_DIAGRAM_Y_AXIS).Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN, TRUE)); +/*?*/ GetAttr(CHOBJID_DIAGRAM_Y_AXIS).Put(SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN)); +/*?*/ +/*?*/ bNoMore = TRUE; +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; nCount = (short)nInt16; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ +/*N*/ pAttr->Load(rIn); +/*N*/ aDataRowAttrList.Insert(pAttr, LIST_APPEND); +/*N*/ +/*N*/ // Debug-Code +/*N*/ // +/*N*/ // SfxItemState sfx_test_state = aDataRowAttrList.GetObject(i)->GetItemState(XATTR_FILLSTYLE); +/*N*/ // if (sfx_test_state >= SFX_ITEM_AVAILABLE) +/*N*/ // { +/*N*/ // XFillStyleItem& rTest_set = (XFillStyleItem&) aDataRowAttrList.GetObject(i)->Get(XATTR_FILLSTYLE); +/*N*/ // } +/*N*/ // sfx_test_state = aDataRowAttrList.GetObject(i)->GetItemState(XATTR_FILLCOLOR); +/*N*/ // if (sfx_test_state >= SFX_ITEM_AVAILABLE) +/*N*/ // { +/*N*/ // XColorItem& rTest_set = (XColorItem&) aDataRowAttrList.GetObject(i)->Get(XATTR_FILLCOLOR); +/*N*/ // } +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; nCount = (short)nInt16; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ +/*N*/ pAttr->Load(rIn); +/*N*/ if (pAttr->Count() == 0) +/*N*/ { +/*N*/ delete pAttr; +/*N*/ pAttr = NULL; +/*N*/ } +/*N*/ aDataPointAttrList.Insert(pAttr, LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ if (nVersion < 4) +/*N*/ { +/*?*/ for (i = 0; i < nCount; i++) +/*?*/ { +// SfxItemSet* pDataPointAttr = +// new SfxItemSet(*pItemPool, nRowWhichPairs); +/*?*/ aSwitchDataPointAttrList.Insert(NULL, LIST_APPEND); +/*?*/ } +/*?*/ +/*?*/ bNoMore = TRUE; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rIn >> nInt16; nCount = (short)nInt16; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ +/*N*/ pAttr->Load(rIn); +/*N*/ if (pAttr->Count() == 0) +/*N*/ { +/*N*/ delete pAttr; +/*N*/ pAttr = NULL; +/*N*/ } +/*N*/ aSwitchDataPointAttrList.Insert(pAttr, LIST_APPEND); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; eDataDescr = (SvxChartDataDescr)nInt16; +/*N*/ rIn >> bShowSym; +/*N*/ rIn >> bSwitchData; +/*N*/ +/*N*/ if (nVersion < 1) +/*N*/ { +/*?*/ BOOL bDataPercent; +/*?*/ rIn >> bDataPercent; +/*?*/ +/*?*/ switch (eChartStyle) +/*?*/ { +/*?*/ case CHSTYLE_2D_LINE: +/*?*/ eChartStyle = CHSTYLE_2D_PERCENTLINE; +/*?*/ break; +/*?*/ +/*?*/ case CHSTYLE_2D_COLUMN: +/*?*/ eChartStyle = CHSTYLE_2D_PERCENTCOLUMN; +/*?*/ break; +/*?*/ +/*?*/ case CHSTYLE_2D_BAR: +/*?*/ eChartStyle = CHSTYLE_2D_PERCENTBAR; +/*?*/ break; +/*?*/ +/*?*/ case CHSTYLE_2D_AREA: +/*?*/ eChartStyle = CHSTYLE_2D_PERCENTAREA; +/*?*/ break; +/*?*/ +/*?*/ case CHSTYLE_3D_FLATCOLUMN: +/*?*/ eChartStyle = CHSTYLE_3D_PERCENTFLATCOLUMN; +/*?*/ break; +/*?*/ +/*?*/ case CHSTYLE_3D_AREA: +/*?*/ eChartStyle = CHSTYLE_3D_PERCENTAREA; +/*?*/ break; +/*?*/ } +/*?*/ +/*?*/ bNoMore = TRUE; +/*N*/ } +/*N*/ +/*N*/ UINT32 nTmp,nDescrFormat,nDescrPercentFormat; +/*N*/ rIn >> nTmp;//nValFo rmat; +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,nTmp,FALSE); +/*N*/ rIn >> nTmp;//nPerce ntValFormat; +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,nTmp,TRUE); +/*N*/ rIn >> nDescrFormat; +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_X_AXIS,nDescrFormat,FALSE); +/*N*/ rIn >> nDescrPercentFormat; +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_X_AXIS,nDescrPercentFormat,TRUE); +/*N*/ +/*N*/ // Achtung : Gravierende Aenderungen an der Datei gegenueber der Auslieferungsversion +/*N*/ // es werden mehr Daten geschrieben : Die alte Version muss (!) das aber auch verkraften +/*N*/ // Die Reihenfolge muss (!!!!) eingehalten werden +/*N*/ pChartYAxis->LoadMemberCompat(rIn); +/*N*/ pChartXAxis->LoadMemberCompat(rIn); +/*N*/ pChartZAxis->LoadMemberCompat(rIn); +/*N*/ +/*N*/ rIn >> fMaxData; +/*N*/ +/*N*/ if (!bNoMore) +/*N*/ { +/*N*/ UINT32 nMoreData = 0; +/*N*/ rIn >> nMoreData; +/*N*/ +/*N*/ // nMoreData soll als Weiche fuer zukuenftige Versionen dienen, +/*N*/ // insbesondere fuer den Fall, dass weitere Daten geschrieben werden +/*N*/ // muessen. Die Pools duerfen ab dem 19.01.1996 auf gar keinen Fall +/*N*/ // mehr modifiziert oder aufgebohrt werden !!!! +/*N*/ // nMoreData = 1 (Version vom 19.01.1996) +/*N*/ // nMoreData = 2 (Version vom 13.03.1996) +/*N*/ // nMoreData = 3 (Version vom 1.04.1996) +/*N*/ // nMoreData = 4 (Version vom 13.05.1996) +/*N*/ // nMoreData = 5 (Version vom 20.05.1996) +/*N*/ // nMoreData = 6 (Version vom 20.06.1996) +/*N*/ // nMoreData = 7 (Version vom 02.07.1996) +/*N*/ // nMoreData = 8 (Version vom 09.07.1996) +/*N*/ // nMoreData = 9 (Version vom 11.07.1996) +/*N*/ // ... +/*N*/ // nMoreData = 12 (Version vom 20.02.1997) FG (Vobis-Version 4.0) +/*N*/ // nMoreData = 13 (Version vom 9.3.1997) FG Cebit-Version +/*N*/ // .... siehe Text unten +/*N*/ // nMoreData = 15 (Version vom 14.3.1997) FG V4.0 nach Cebit >= 358 +/*N*/ if (nMoreData > 1) +/*N*/ { +/*N*/ ByteString aReadString; +/*N*/ +/*N*/ rIn.ReadByteString( pChartData->SomeData1() ); +/*N*/ rIn.ReadByteString( pChartData->SomeData2() ); +/*N*/ rIn.ReadByteString( pChartData->SomeData3() ); +/*N*/ rIn.ReadByteString( pChartData->SomeData4() ); +/*N*/ +/*N*/ if (nMoreData >= 3) rIn >> fSpotIntensity; +/*N*/ if (nMoreData <= 8) fAmbientIntensity = fSpotIntensity; +/*N*/ +/*N*/ if (nMoreData >= 4) +/*N*/ { +/*N*/ BOOL bDummy; +/*N*/ +/*N*/ rIn >> bShowAverage; +/*N*/ rIn >> nInt16; eErrorKind = (SvxChartKindError) nInt16; +/*N*/ rIn >> bDummy; +/*N*/ rIn >> nInt16; eIndicate = (SvxChartIndicate) nInt16; +/*N*/ rIn >> fIndicatePercent; +/*N*/ rIn >> fIndicateBigError; +/*N*/ rIn >> fIndicatePlus; +/*N*/ rIn >> fIndicateMinus; +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 5) +/*N*/ { +/*N*/ rIn >> nInt16; eRegression = (SvxChartRegress) nInt16; +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 6) +/*N*/ { +/*N*/ INT32 nInt32; +/*N*/ rIn >> nInt32; nSplineDepth = nInt32; +/*N*/ rIn >> nInt32; nGranularity = nInt32; +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 7) +/*N*/ { +/*N*/ rIn >> bLegendVisible; +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 8) +/*N*/ { +/*N*/ rIn >> nInt16; nCount = (short)nInt16; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ +/*N*/ pAttr->Load(rIn); +/*N*/ aRegressAttrList.Insert(pAttr, LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; nCount = (short)nInt16; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ +/*N*/ pAttr->Load(rIn); +/*N*/ aAverageAttrList.Insert(pAttr, LIST_APPEND); +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; nCount = (short)nInt16; +/*N*/ for (i = 0; i < nCount; i++) +/*N*/ { +/*N*/ pAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ +/*N*/ pAttr->Load(rIn); +/*N*/ aErrorAttrList.Insert(pAttr, LIST_APPEND); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (nMoreData >= 9) rIn >> fAmbientIntensity; +/*N*/ if (nMoreData >= 10) rIn >> bTextScalable; +/*N*/ if (nMoreData >= 11) rIn >> aInitialSize; +/*N*/ if (nMoreData >= 12) //FG: 20.2.1997 +/*N*/ { +/*N*/ // FG: Vielleicht etwas viel Speicher fuer BOOL, aber es macht nur 16 Byte pro Chart +/*N*/ rIn >> nInt16; bFormatXAxisTextInMultipleLinesIfNecessary = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bFormatYAxisTextInMultipleLinesIfNecessary = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bFormatZAxisTextInMultipleLinesIfNecessary = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bFormatLegendTextInMultipleLinesIfNecessary = (BOOL) nInt16; +/*N*/ } +/*N*/ if (nMoreData >= 13) // FG: 9.3.1997 Zusaetze wegen einer freien Positionierung und einem freien +/*N*/ { // Resize von Gruppenobjekten im Chart. +/*N*/ rIn >> nInt16; nXAxisTextMaximumNumberOfLines = nInt16; +/*N*/ rIn >> nInt16; nYAxisTextMaximumNumberOfLines = nInt16; +/*N*/ rIn >> nInt16; nZAxisTextMaximumNumberOfLines = nInt16; +/*N*/ rIn >> nInt32; nWidthOfFirstXAxisText = nInt32; +/*N*/ rIn >> nInt32; nWidthOfLastXAxisText = nInt32; +/*N*/ rIn >> aTitleTopCenter; +/*N*/ rIn >> aSubTitleTopCenter; +/*N*/ rIn >> aDiagramRectangle; +/*N*/ rIn >> aLegendTopLeft; +/*N*/ rIn >> aTitleXAxisPosition; // FG: welcher Punkt da jeweils gemeint ist findet +/*N*/ rIn >> aTitleYAxisPosition; // bei nMoreData = 15 +/*N*/ rIn >> aTitleZAxisPosition; +/*N*/ rIn >> nInt16; bUseRelativePositionsForChartGroups = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bAdjustMarginsForLegend = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bAdjustMarginsForMainTitle = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bAdjustMarginsForSubTitle = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bAdjustMarginsForXAxisTitle = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bAdjustMarginsForYAxisTitle = (BOOL) nInt16; +/*N*/ rIn >> nInt16; bAdjustMarginsForZAxisTitle = (BOOL) nInt16; +/*N*/ } +/*N*/ if (nMoreData >= 14) +/*N*/ { +/*N*/ rIn >> aSpotColor; // FG: Aenderung von DL damit sich das 3d-Chart die +/*N*/ rIn >> aAmbientColor; // Farbfilter-Einstellungen merkt. +/*N*/ +/*N*/ rIn >> bDiagramHasBeenMovedOrResized; // FG: 12.3.97, Falls das Chart gespeichert wird +/*N*/ rIn >> bMainTitleHasBeenMoved; // soll es immer noch die relativen Positionen +/*N*/ rIn >> bSubTitleHasBeenMoved; // der Objektgruppen beachten, falls eine +/*N*/ rIn >> bLegendHasBeenMoved; // dieser Gruppen bewegt worden ist. +/*N*/ rIn >> bXAxisTitleHasBeenMoved; +/*N*/ rIn >> bYAxisTitleHasBeenMoved; +/*N*/ rIn >> bZAxisTitleHasBeenMoved; +/*N*/ } +/*N*/ if (nMoreData >= 15) // FG: 14.3.97 Es braucht noch die Information der Ausrichtung +/*N*/ { // damit beim Resize die Texte richtig plaziert werden +/*N*/ rIn >> nInt16; eAdjustXAxesTitle = (ChartAdjust) nInt16; +/*N*/ rIn >> nInt16; eAdjustYAxesTitle = (ChartAdjust) nInt16; +/*N*/ rIn >> nInt16; eAdjustZAxesTitle = (ChartAdjust) nInt16; +/*N*/ } +/*N*/ if (nMoreData >= 16) +/*N*/ { +/*N*/ BOOL bNeedMerge=FALSE; +/*N*/ String aFmtStr; +/*N*/ sal_uInt32 nId; +/*N*/ if(nVersion <= 11)//ab V 12 X=Y=Z-Numberformatter! +/*N*/ { +/*?*/ SvNumberFormatter *pTmp = new SvNumberFormatter( ::legacy_binfilters::getLegacyProcessServiceFactory(), +/*?*/ LANGUAGE_SYSTEM ); +/*?*/ pTmp->Load(rIn); +/*?*/ nId = IsPercentChart() ? nDescrPercentFormat : nDescrFormat; +/*?*/ const SvNumberformat* pFmt=pTmp->GetEntry(nId); +/*?*/ +/*?*/ if(pFmt && (pFmt->GetType() & NUMBERFORMAT_DEFINED)) +/*?*/ { +/*?*/ aFmtStr = pFmt->GetFormatstring(); +/*?*/ bNeedMerge=TRUE; +/*?*/ } +/*?*/ delete pTmp; +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ pNumFormatter->SkipNumberFormatterInStream( rIn ); //Skip x +/*N*/ } +/*N*/ pOwnNumFormatter->Load( rIn ); // if not skipped load the own formatter ... +/*N*/ pNumFormatter = pOwnNumFormatter; // ... and use it +/*N*/ +/*N*/ // merge user formats of x axis formatter +/*N*/ if(bNeedMerge) +/*N*/ { +/*?*/ xub_StrLen nChk; +/*?*/ short nType; +/*?*/ pNumFormatter->PutEntry(aFmtStr,nChk,nType,nId,LANGUAGE_SYSTEM); +/*?*/ DBG_ASSERT(nChk==0,"Chart:: Converting X-Axis Numformat failed"); +/*?*/ SetNumFmt(CHOBJID_DIAGRAM_X_AXIS,nId,IsPercentChart()); +/*N*/ } +/*N*/ +/*N*/ pNumFormatter->SkipNumberFormatterInStream(rIn);//aTmp.Load( rIn );//pNumFormatterZ //immer wegschmeissen, hatte nie userdef. formats +/*N*/ } +/*N*/ } +/*N*/ aLastDiagramRectangle = aDiagramRectangle; // #68131# (#67459#) +/*N*/ } +/*N*/ +/*N*/ // FG: Das ist notwendig damit in SchChartDocShell::Draw das Chart Initialisiert +/*N*/ // wird, es also die wirkliche Groesse mitbekommt. Zum jetzigen Zeitpunkt nach dem +/*N*/ // Laden gibt es ja noch kein Fenster. Ein Aufruf von BuildChart an dieser Stelle +/*N*/ // geht also nicht. Bei einem Repaint wird in der oben genannten Methode abgefragt +/*N*/ // ob das Chart bereits existiert (bNoBuildChart), falls nicht wird es neu angelegt. +/*N*/ // +/*N*/ // bei den Versionen 4.0 oder hoeher wird die Initialisierung richtig gemacht +/*N*/ // bei Charts die Inplace aus Versionen 3.1 verwendet werden passiert das schon +/*N*/ // richtig. +/*N*/ // +/*N*/ // Dies betrifft nur 3D-Charts, die im Format der Version 3.1 geschrieben wurden. +/*N*/ // +/*N*/ // 21.4. Aenderung: Das Chart kann ja aus allen gespeicheten Daten erzeugt werden. +/*N*/ // um das File klein zu halten und da die Neuberechnung sehr viel schneller +/*N*/ // geworden ist. +/*N*/ if (((rIn.GetVersion() <= SOFFICE_FILEFORMAT_31) && (Is3DChart())) || +/*N*/ bUseRelativePositionsForChartGroups || (rIn.GetVersion() > SOFFICE_FILEFORMAT_31)) +/*N*/ { +/*N*/ bNoBuildChart = TRUE; +/*N*/ } +/*N*/ +/*N*/ +/*N*/ +/*N*/ if (nVersion >= 9)//#50116# Saeulenbreite +/*N*/ { +/*N*/ rIn >> nInt16; SetBarPercentWidth((long)nInt16); +/*N*/ +/*N*/ rIn >> nInt32; m_nDefaultColorSet=nInt32;//#50149# +/*N*/ +/*N*/ rIn >> nInt32; +/*N*/ // #78911# always set to 0 if charttype doesn't support lines +/*N*/ SetNumLinesColChart( ( eChartStyle == CHSTYLE_2D_LINE_COLUMN )? nInt32: 0 ); +/*N*/ +/*N*/ // #74536# BM use these three former -1 dummies for +/*N*/ // numberformat last set by CALC +/*N*/ rIn >> nXLastNumFmt; +/*N*/ rIn >> nYLastNumFmt; +/*N*/ rIn >> nBLastNumFmt; +/*N*/ rIn >> nInt32; // still dummy (-1) +/*N*/ +/*N*/ } +/*N*/ +/*N*/ if(nVersion >= 11)//10 existiert nicht (pChartAttr) +/*N*/ { +/*N*/ +/*N*/ SfxItemSet aAttr(*pItemPool, nRowWhichPairs); +/*N*/ aAttr.Load(rIn); +/*N*/ pStockLineAttr->Put(aAttr); +/*N*/ +/*N*/ aAttr.ClearItem(); +/*N*/ aAttr.Load(rIn); +/*N*/ pStockLossAttr->Put(aAttr); +/*N*/ +/*N*/ aAttr.ClearItem(); +/*N*/ aAttr.Load(rIn); +/*N*/ pStockPlusAttr->Put(aAttr); +/*N*/ } +/*N*/ +/*N*/ InitChartData(FALSE); //weia, beeinflusst die Achsen....also erst ab hier: +/*N*/ +/*N*/ +/*N*/ if(nVersion >= 12) +/*N*/ { +/*N*/ //Achse wird nur noch auf Attr-Basis gestreamt! +/*N*/ +/*N*/ //nAxisId ist die zu ladene/speichernde Achse, +/*N*/ //festgelegt sind in V12 nur 1=X, 2=Y,3=Z und 4=B (2.Y-Achse) +/*N*/ //-1 bedeutet KEINE WEITEREN ACHSEN !!!!!!!!!!! +/*N*/ //Es MUSS keine Achse gestreamt werden (siehe Lade-Routine) +/*N*/ INT32 nAxisId=0; +/*N*/ SfxItemSet aAxisSet(*pItemPool,nAxisWhichPairs); +/*N*/ while(nAxisId != -1)//hier koennen beliebig viele, auch unbekannte Achsen kommen +/*N*/ { +/*N*/ aAxisSet.ClearItem(); +/*N*/ rIn >> nAxisId; +/*N*/ +/*N*/ switch(nAxisId) +/*N*/ { +/*N*/ case CHART_AXIS_PRIMARY_X: +/*N*/ aAxisSet.Load(rIn); +/*N*/ SetAttributes(CHOBJID_DIAGRAM_X_AXIS,aAxisSet,FALSE); +/*N*/ SetAttributes(CHOBJID_DIAGRAM_A_AXIS,aAxisSet,FALSE);//falls nicht spaeter geladen wird, hier neue defaults setzen +/*N*/ pChartAAxis->ShowAxis(FALSE); //default aus +/*N*/ pChartAAxis->ShowDescr(FALSE); +/*N*/ pChartXAxis->Update(); //Ab V12 kann jetzt der ganze LoadMemberCompat...Kram uebergebuegelt werden, in den Attr war alles drin! +/*N*/ pChartAAxis->Update(); +/*N*/ break; +/*N*/ case CHART_AXIS_PRIMARY_Y: +/*N*/ aAxisSet.Load(rIn); +/*N*/ SetAttributes(CHOBJID_DIAGRAM_Y_AXIS,aAxisSet,FALSE); +/*N*/ pChartYAxis->Update(); +/*N*/ break; +/*N*/ case CHART_AXIS_PRIMARY_Z: +/*N*/ aAxisSet.Load(rIn); +/*N*/ SetAttributes(CHOBJID_DIAGRAM_Z_AXIS,aAxisSet,FALSE); +/*N*/ pChartZAxis->Update(); +/*N*/ break; +/*N*/ case CHART_AXIS_SECONDARY_Y: +/*N*/ aAxisSet.Load(rIn); +/*N*/ SetAttributes(CHOBJID_DIAGRAM_B_AXIS,aAxisSet,FALSE); +/*N*/ pChartBAxis->Update(); +/*N*/ break; +/*N*/ case CHART_AXIS_SECONDARY_X: +/*N*/ aAxisSet.Load(rIn); +/*N*/ SetAttributes(CHOBJID_DIAGRAM_A_AXIS,aAxisSet,FALSE); +/*N*/ pChartAAxis->Update(); +/*N*/ break; +/*N*/ case -1: //Ende der Achsen! +/*N*/ break; +/*N*/ default: //Attrset kommt aus der Zukunft! Laden und vernichten: +/*N*/ { +/*?*/ aAxisSet.Load(rIn); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else //defaults ergaenzen +/*N*/ { +/*?*/ SfxItemSet aSet(*pItemPool,nAxisWhichPairs); +/*?*/ aSet.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER)); +/*?*/ SetAttributes(CHOBJID_DIAGRAM_X_AXIS,aSet); +/*?*/ SetAttributes(CHOBJID_DIAGRAM_Y_AXIS,aSet); +/*N*/ } +/*N*/ //Ende IOVersion 12 +/*N*/ + +/*N*/ if(nVersion >= 14) +/*N*/ { +/*N*/ rIn >> nTmp; +/*N*/ aBarY1.SetGap(nTmp); +/*N*/ rIn >> nTmp; +/*N*/ aBarY1.SetOverlap(nTmp); +/*N*/ rIn >> nTmp; +/*N*/ aBarY2.SetGap(nTmp); +/*N*/ rIn >> nTmp; +/*N*/ aBarY2.SetOverlap(nTmp); +/*N*/ } +/*N*/ else +/*N*/ { +/* aBarY1.SetGap() + aBarY1.SetOverlap(nTmp) + aBarY2.SetGap(nTmp) + aBarY2.SetOverlap(nTmp) + */ +/*N*/ } +/*N*/ +/*N*/ if(nVersion >= 15) +/*N*/ { +/*N*/ SfxItemSet * pAttributes; +/*N*/ bResizePie=FALSE; +/*N*/ rIn >> bDiagramHasBeenMovedOrResized; // FG: 12.3.97, Falls das Chart gespeichert wird +/*N*/ +/*N*/ if(IsReal3D() && (IsPieChart()||IsLine())) //Hack wegen #62363#, double-sided neu defaulten +/*N*/ { +/*N*/ long nMax; +/*N*/ nMax=aDataRowAttrList.Count(); +/*N*/ for(i=0;i<nMax;i++) +/*N*/ //-/ aDataRowAttrList.GetObject(i)->Put(SfxBoolItem(SID_ATTR_3D_DOUBLE_SIDED,TRUE)); +/*N*/ aDataRowAttrList.GetObject(i)->Put(Svx3DDoubleSidedItem(TRUE)); +/*N*/ nMax=aDataPointAttrList.Count(); +/*N*/ for(i=0;i<nMax;i++) +/*N*/ { +/*N*/ pAttributes = aDataPointAttrList.GetObject(i); +/*N*/ if (pAttributes != NULL) +/*?*/ pAttributes->Put(Svx3DDoubleSidedItem(TRUE)); +/*N*/ } +/*N*/ nMax=aSwitchDataPointAttrList.Count(); +/*N*/ for(i=0;i<nMax;i++) +/*N*/ { +/*N*/ pAttributes = aSwitchDataPointAttrList.GetObject(i); +/*N*/ if (pAttributes != NULL) +/*N*/ pAttributes->Put(Svx3DDoubleSidedItem(TRUE)); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ //altes 3D-Pie? +/*?*/ bResizePie=TRUE; +/*?*/ if(IsReal3D() && IsPieChart()) +/*?*/ { +/*?*/ Matrix4D aTmp; //Matrix auf default +/*?*/ +/*?*/ aTmp.RotateZ((900 + nYAngle) * F_PI / 1800); //??? !!! +/*?*/ aTmp.RotateX(-F_PI/3); +/*?*/ +/*?*/ aSceneMatrix=aTmp; +/*?*/ } +/*?*/ +/*?*/ if(IsReal3D()) //#61923# +/*?*/ { +/*?*/ long nMax; +/*?*/ nMax=aDataRowAttrList.Count(); +/*?*/ SfxItemSet * pAttributes; +/*?*/ +/*?*/ for(i=0;i<nMax;i++) +/*?*/ { +/*?*/ if(IsPieChart()||IsLine()) +/*?*/ //-/ aDataRowAttrList.GetObject(i)->Put(SfxBoolItem(SID_ATTR_3D_DOUBLE_SIDED,TRUE)); +/*?*/ aDataRowAttrList.GetObject(i)->Put(Svx3DDoubleSidedItem(TRUE)); +/*?*/ aDataRowAttrList.GetObject(i)->Put(XLineStyleItem(XLINE_NONE)); +/*?*/ } +/*?*/ +/*?*/ nMax=aDataPointAttrList.Count(); +/*?*/ for(i=0;i<nMax;i++) +/*?*/ { +/*?*/ pAttributes = aDataPointAttrList.GetObject(i); +/*?*/ if (pAttributes == NULL) +/*?*/ continue; +/*?*/ if(IsPieChart()||IsLine()) +/*?*/ aDataPointAttrList.GetObject(i)->Put(Svx3DDoubleSidedItem(TRUE)); +/*?*/ aDataPointAttrList.GetObject(i)->Put(XLineStyleItem(XLINE_NONE)); +/*?*/ } +/*?*/ +/*?*/ +/*?*/ nMax=aSwitchDataPointAttrList.Count(); +/*?*/ for(i=0;i<nMax;i++) +/*?*/ { +/*?*/ pAttributes = aSwitchDataPointAttrList.GetObject(i); +/*?*/ if (pAttributes == NULL) +/*?*/ continue; +/*?*/ if(IsPieChart()||IsLine()) +/*?*/ aSwitchDataPointAttrList.GetObject(i)->Put(Svx3DDoubleSidedItem(TRUE)); +/*?*/ aSwitchDataPointAttrList.GetObject(i)->Put(XLineStyleItem(XLINE_NONE)); +/*?*/ } +/*N*/ } +/*N*/ } + + // ******************** LAST READ ******************** + + + // ############# defaults erstellen, falls alte Fileversion #################### + +/*N*/ if(nVersion < 13) +/*N*/ { +/*?*/ if(IsXYChart()) +/*?*/ aDataRowAttrList.GetObject(0)->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_X)); +/*N*/ } + //#54870# restaurieren der line-attribute +/*N*/ if( nVersion < 10) +/*N*/ { +/*?*/ SetupLineColors(SETLINES_COMPAT); +/*N*/ } +/*N*/ if( nVersion < 16) //Automatische 2.YAchse in Items umsetzten +/*N*/ { +/*?*/ const SfxPoolItem* pPoolItem=NULL; +/*?*/ for(long n=0;n<GetRowCount();n++) +/*?*/ if(GetDataRowAttr(n).GetItemState(SCHATTR_AXIS,TRUE, &pPoolItem) == SFX_ITEM_SET) +/*?*/ if(((const SfxInt32Item*)pPoolItem)->GetValue()==CHART_AXIS_SECONDARY_Y) +/*?*/ { +/*?*/ n=GetRowCount();//abbruch +/*?*/ pChartBAxis->ShowDescr(TRUE); +/*?*/ pChartBAxis->ShowAxis(TRUE); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ //dies ist immer moeglich (IoVersion<=16), in Zukunft sollten nur noch die Attr unterstuetzt werden, dann kann hier evtl. mit IOVersion geklammert werden! +/*N*/ pChartXAxis->ShowDescr(bShowXDescr); +/*N*/ pChartXAxis->ShowAxis(bShowXAxis); +/*N*/ pChartYAxis->ShowDescr(bShowYDescr); +/*N*/ pChartYAxis->ShowAxis(bShowYAxis); +/*N*/ pChartZAxis->ShowDescr(bShowZDescr); +/*N*/ pChartZAxis->ShowAxis(bShowZAxis); +/*N*/ +/*N*/ +/*N*/ //Bei unsortierten Charts machts keinen Sinn, nachdem Laden nochmal zu fragen +/*N*/ if( IsXYChart() ) +/*N*/ SETFLAG( nChartStatus, CHS_USER_NOQUERY ); +/*N*/ else +/*N*/ RESETFLAG( nChartStatus, CHS_USER_NOQUERY ); +/*N*/ +/*N*/ CHART_TRACE( "ChartModel::LoadAttributes END" ); +/*N*/ } + +/************************************************************************* +|* +|* Zeigt Legende an bzw. loescht sie. +|* +\************************************************************************/ + +/*N*/ void ChartModel::SetShowLegend(BOOL bShow) +/*N*/ { +/*N*/ pLegendAttr->Put(SvxChartLegendPosItem(bShow +/*N*/ ? CHLEGEND_RIGHT +/*N*/ : CHLEGEND_NONE)); +/*N*/ bLegendVisible = bShow; +/*N*/ } +/************************************************************************* +|* +|* Legenden-Attribute ermitteln +|* +\************************************************************************/ + +/*N*/ SfxItemSet ChartModel::GetFullLegendAttr() const +/*N*/ { +/*N*/ SfxItemSet aAttr(*pItemPool, nLegendWhichPairs); +/*N*/ aAttr.Put(*pLegendAttr); +/*N*/ return aAttr; +/*N*/ } + +/************************************************************************* +|* +|* Legenden-Attribute aendern; +|* Liefert bei geaenderten Attributen TRUE. +|* +\************************************************************************/ + +/************************************************************************* +|* +|* Chart-Attribute aendern; +|* Liefert bei geaenderten Attributen TRUE. +|* +\************************************************************************/ + +/************************************************************************* +|* +|* Erstelle Symbole fuer Diagrammtypen mit Symbolen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Aendere die Attribute einer Achse +|* +\************************************************************************/ + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode3.cxx b/binfilter/bf_sch/source/core/sch_chtmode3.cxx new file mode 100644 index 000000000000..0c6583dc7537 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode3.cxx @@ -0,0 +1,1712 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <bf_svx/tabline.hxx> +#include <bf_svx/svdograf.hxx> +#include <bf_svx/svdopath.hxx> +#include <bf_svtools/whiter.hxx> +#include <bf_svx/xbtmpit.hxx> + +#include <bf_svx/eeitem.hxx> +#ifndef _SVX_COLRITEM_HXX //autogen +#define ITEMID_COLOR EE_CHAR_COLOR +#endif +#include <bf_svx/xflftrit.hxx> +#include <bf_svx/xflhtit.hxx> +#include <bf_svx/xtable.hxx> +#include "schattr.hxx" + +// header for SvxChartTextOrientItem +#ifndef _SVX_CHRTITEM_HXX +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT + + +#endif +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#include <globfunc.hxx> +#include <bf_svx/svxids.hrc> + + + +#include "schattr.hxx" +#ifndef _SVX_BRSHITEM_HXX //autogen +#define ITEMID_BRUSH SCHATTR_SYMBOL_BRUSH +#include <bf_svx/brshitem.hxx> +#endif +#ifndef _SVX_SIZEITEM_HXX //autogen +#define ITEMID_SIZE 0 +#include <bf_svx/sizeitem.hxx> +#endif +// header for SAL_STATIC_CAST +#include <sal/types.h> + +#include <bf_svx/xlnedit.hxx> + +#include <bf_svx/xlnstit.hxx> + +#include <bf_svx/xlndsit.hxx> + +#include <bf_svx/xlnclit.hxx> + +#include <bf_svx/xlnwtit.hxx> + + +#include "glob.hrc" + +#include "chtscene.hxx" +#include "pairs.hxx" + +#include "chaxis.hxx" + +namespace binfilter { + +/************************************************************************* +|* +|* Entscheidung, ob BuildChart notwendig +|* +\************************************************************************/ +/*N*/ BOOL ChartModel::IsAttrChangeNeedsBuildChart(const SfxItemSet& rAttr) +/*N*/ { +/*N*/ // BM #60999# rebuild for all EE_CHAR attributes because of possibly red color for negative numbers. sorry :-( +/*N*/ return TRUE; + + /* + BOOL bNeedBuild=FALSE; + + SfxWhichIter aWhichIter(rAttr); + USHORT nWhich = aWhichIter.FirstWhich(); + while (nWhich != 0) + { + if (rAttr.GetItemState(nWhich) == SFX_ITEM_SET) + { + if(nWhich < XATTR_LINE_FIRST || nWhich > XATTR_FILL_LAST) + { + + switch(nWhich) + { + + case EE_CHAR_COLOR: + case EE_CHAR_UNDERLINE: + case EE_CHAR_STRIKEOUT: + break; + + default: + + bNeedBuild=TRUE; + break; + } + } + } + nWhich = aWhichIter.NextWhich(); + } + return bNeedBuild; +*/ +/*N*/ } + +/************************************************************************* +|* +|* Achsen-Attribute ermitteln +|* +\************************************************************************/ +/*N*/ ChartAxis* ChartModel::GetAxis(long nId) +/*N*/ { +/*N*/ switch(nId) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ return pChartXAxis; +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ return pChartYAxis; +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ return pChartZAxis; +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ return pChartBAxis; +/*?*/ case CHOBJID_DIAGRAM_A_AXIS: +/*?*/ return pChartAAxis; +/*N*/ } +/*?*/ DBG_ERROR("ChartModel::GetAxis() illegal argument (nId=CHOBJID_)"); +/*?*/ return pChartYAxis; +/*N*/ } + + + +/* + Get axis attributes. + If pAxisObj is NULL then the intersection of the attributes of all five + axes is taken, regardless of wether the axes are visible or not. +*/ +/*N*/ SfxItemSet ChartModel::GetFullAxisAttr( const SdrObjGroup* pAxisObj, bool bOnlyInserted ) const +/*N*/ { +/*N*/ if (pAxisObj) +/*N*/ { +/*?*/ SchObjectId* pObjId = GetObjectId(*pAxisObj); +/*?*/ +/*?*/ if (pObjId) +/*?*/ { +/*?*/ long nId=pObjId->GetObjId(); +/*?*/ +/*?*/ SfxItemSet aAttr(*pItemPool,nAxisWhichPairs); +/*?*/ aAttr.Put(GetAttr(nId)); +/*?*/ ((ChartModel*)this)->GetAxis(nId)->GetMembersAsAttr(aAttr); +/*?*/ return aAttr; +/*?*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // clear member item set for all axes +/*N*/ pAxisAttr->ClearItem(); +/*N*/ bool bIsFirst = true; +/*N*/ +/*N*/ if( ! bOnlyInserted || HasAxis( CHOBJID_DIAGRAM_X_AXIS )) +/*N*/ if( bIsFirst ) +/*N*/ { +/*N*/ pAxisAttr->Set( GetAttr( CHOBJID_DIAGRAM_X_AXIS )); +/*N*/ bIsFirst = false; +/*N*/ } +/*N*/ else +/*?*/ IntersectSets( GetAttr( CHOBJID_DIAGRAM_X_AXIS ), *pAxisAttr ); +/*N*/ +/*N*/ if( ! bOnlyInserted || HasAxis( CHOBJID_DIAGRAM_Y_AXIS )) +/*N*/ if( bIsFirst ) +/*N*/ { +/*?*/ pAxisAttr->Set( GetAttr( CHOBJID_DIAGRAM_Y_AXIS )); +/*?*/ bIsFirst = false; +/*N*/ } +/*N*/ else +/*N*/ IntersectSets( GetAttr( CHOBJID_DIAGRAM_Y_AXIS ), *pAxisAttr ); +/*N*/ +/*N*/ if( ! bOnlyInserted || (Is3DChart() && HasAxis( CHOBJID_DIAGRAM_Z_AXIS ))) +/*N*/ if( bIsFirst ) +/*N*/ { +/*?*/ pAxisAttr->Set( GetAttr( CHOBJID_DIAGRAM_Z_AXIS )); +/*?*/ bIsFirst = false; +/*N*/ } +/*N*/ else +/*N*/ IntersectSets( GetAttr( CHOBJID_DIAGRAM_Z_AXIS ), *pAxisAttr ); +/*N*/ +/*N*/ if( ! bOnlyInserted || HasAxis( CHOBJID_DIAGRAM_A_AXIS )) +/*?*/ if( bIsFirst ) +/*?*/ { +/*?*/ pAxisAttr->Set( GetAttr( CHOBJID_DIAGRAM_A_AXIS )); +/*?*/ bIsFirst = false; +/*?*/ } +/*?*/ else +/*?*/ IntersectSets( GetAttr( CHOBJID_DIAGRAM_A_AXIS ), *pAxisAttr ); +/*N*/ +/*N*/ if( ! bOnlyInserted || HasAxis( CHOBJID_DIAGRAM_B_AXIS )) +/*?*/ if( bIsFirst ) +/*?*/ { +/*?*/ pAxisAttr->Set( GetAttr( CHOBJID_DIAGRAM_B_AXIS )); +/*?*/ bIsFirst = false; +/*?*/ } +/*?*/ else +/*?*/ IntersectSets( GetAttr( CHOBJID_DIAGRAM_B_AXIS ), *pAxisAttr ); +/*N*/ } +/*N*/ +/*N*/ // if( bOnlyInserted ) +/*N*/ // pAxisAttr->ClearItem( SCHATTR_AXIS_SHOWDESCR ); +/*N*/ +/*N*/ return *pAxisAttr; +/*N*/ } + +/************************************************************************* +|* +|* Achsen-Attribute aendern; +|* Liefert bei geaenderten Attributen TRUE. +|* +\************************************************************************/ + +/*N*/ BOOL ChartModel::ChangeAxisAttr(const SfxItemSet &rAttr,SdrObjGroup *pAxisObj,BOOL bMerge) +/*N*/ { +/*N*/ if (pAxisObj) +/*N*/ { +/*N*/ SchObjectId *pObjId = GetObjectId(*pAxisObj); +/*N*/ +/*N*/ if (! pObjId) return FALSE; +/*N*/ else +/*N*/ { +/*N*/ SfxItemSet aSet(*pItemPool,nAxisWhichPairs); +/*N*/ aSet.Put(rAttr); +/*N*/ +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ +/*N*/ if(rAttr.GetItemState(SID_ATTR_NUMBERFORMAT_VALUE,TRUE,&pPoolItem)==SFX_ITEM_SET) +/*N*/ { +/*N*/ UINT32 nTmp=((const SfxUInt32Item*)pPoolItem)->GetValue(); +/*N*/ aSet.Put(SfxUInt32Item(IsPercentChart() +/*N*/ ? SCHATTR_AXIS_NUMFMTPERCENT : SCHATTR_AXIS_NUMFMT , nTmp)); +/*N*/ } +/*N*/ +/*N*/ long nId=pObjId->GetObjId(); +/*N*/ SetAttributes( nId, aSet, bMerge ); // at the model +/*N*/ SetAxisAttributes( &GetAttr( nId ), pAxisObj ); // at the drawing object +/*N*/ +/*N*/ // at the axis itself! +/*N*/ long nAxisUId = ChartAxis::GetUniqueIdByObjectId( nId ); +/*N*/ if( nAxisUId != CHAXIS_AXIS_UNKNOWN ) +/*N*/ { +/*N*/ // this method always returns a valid pointer +/*N*/ GetAxisByUID( nAxisUId )->SetAttributes( rAttr ); +/*N*/ } +/*N*/ else +/*N*/ DBG_ERROR( "ChartAxis not found for Object" ); +/*N*/ +/*N*/ if(IsAttrChangeNeedsBuildChart(aSet)) +/*N*/ BuildChart(FALSE,nId); //z.B. auch Texte skalieren! +/*N*/ return TRUE; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 PutAxisAttr(rAttr,bMerge); + return FALSE; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Datenreihen-Attribute setzen +|* +\************************************************************************/ +/*N*/ void ChartModel::PutDataRowAttrAll(const SfxItemSet& rAttr,BOOL bMerge,BOOL bClearPoints) +/*N*/ { +/*N*/ long nCnt=aDataRowAttrList.Count(); +/*N*/ while(nCnt--) +/*N*/ PutDataRowAttr(nCnt,rAttr,bMerge,bClearPoints); +/*N*/ } + +/*N*/ void ChartModel::PutDataRowAttr(long nRow, const SfxItemSet& rAttr,BOOL bMerge,BOOL bClearPoints) +/*N*/ { +/*N*/ +/*N*/ CHART_TRACE1( "ChartModel::PutDataRowAttr %smerge", bMerge? "": "NO " ); +/*N*/ // DBG_ITEMS((SfxItemSet&)rAttr,this); +/*N*/ +/*N*/ if( aDataRowAttrList.Count() <= (unsigned long)nRow ) +/*N*/ { +/*?*/ DBG_ERROR( "Invalid index to array requested" ); +/*?*/ return; +/*N*/ } +/*N*/ +/*N*/ if(!bMerge) +/*?*/ aDataRowAttrList.GetObject(nRow)->ClearItem(); +/*N*/ +/*N*/ PutItemSetWithNameCreation( *aDataRowAttrList.GetObject( nRow ), rAttr ); +/*N*/ +/*N*/ if(bClearPoints && (nRow < GetRowCount())) +/*N*/ { +/*N*/ long nCol,nColCnt=GetColCount(); +/*N*/ for(nCol=0;nCol<nColCnt;nCol++) +/*N*/ { +/*N*/ ClearDataPointAttr(nCol,nRow,rAttr); +/*N*/ } +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Datenreihen-Attribute ermitteln +|* +\************************************************************************/ + +/*N*/ const SfxItemSet& ChartModel::GetDataRowAttr( long nRow ) const +/*N*/ { +/*N*/ if( nRow < (long)aDataRowAttrList.Count() ) +/*N*/ { +/*N*/ SfxItemSet* pSet = aDataRowAttrList.GetObject( nRow ); +/*N*/ DBG_ASSERT( pSet, "Invalid ItemSet" ); +/*N*/ return *pSet; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ERROR( "Requested data row attribute is unavailable" ); +/*N*/ +/*N*/ // return something +/*?*/ DBG_ASSERT( pChartAttr, "Invalid Chart-ItemSet" ); +/*?*/ return *pChartAttr; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Erstelle Symbole fuer Diagrammtypen mit Symbolen +|* +\************************************************************************/ + +/*N*/ SdrObject* ChartModel::CreateSymbol (Point aPoint, +/*N*/ int nRow, +/*N*/ int nColumn, +/*N*/ SfxItemSet &aDataAttr, +/*N*/ long nSymbolSize, +/*N*/ BOOL bInsert) +/*N*/ { +/*N*/ long nWhatSymbol=SVX_SYMBOLTYPE_AUTO; +/*N*/ SdrObject* pObj=NULL; +/*N*/ long nHalfSymbolSizeX = nSymbolSize / 4; +/*N*/ long nHalfSymbolSizeY = nSymbolSize / 4; +/*N*/ Size aSize(1,1); +/*N*/ long n1Pixel=pRefOutDev ? pRefOutDev->PixelToLogic(aSize).Width() : nHalfSymbolSizeY/2; +/*N*/ +/*N*/ if(!bInsert) +/*N*/ n1Pixel=nHalfSymbolSizeY/2; //für Legende vergrößern +/*N*/ +/*N*/ const SfxPoolItem* pPoolItem; +/*N*/ if(aDataAttr.GetItemState(SCHATTR_STYLE_SYMBOL, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ nWhatSymbol = ((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ } +/*N*/ if(nWhatSymbol<0) +/*N*/ { +/*N*/ BOOL bStock=FALSE; +/*N*/ switch(nWhatSymbol) +/*N*/ { +/*N*/ case SVX_SYMBOLTYPE_NONE: +/*N*/ { +/*N*/ // Create a square as symbol. Its fill and line style is +/*N*/ // later to invisible. This does not show the symbol but +/*N*/ // leaves the data point selectable. +/*N*/ XPolygon aPolygon (5); +/*N*/ aPolygon[0].X() = aPoint.X() - nHalfSymbolSizeX; +/*N*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[1].X() = aPoint.X() - nHalfSymbolSizeX; +/*N*/ aPolygon[1].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*N*/ aPolygon[2].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[2].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*N*/ aPolygon[3].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[3].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[4].X() = aPolygon[0].X(); +/*N*/ aPolygon[4].Y() = aPolygon[0].Y(); +/*N*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*N*/ break; +/*N*/ } +/*N*/ case SVX_SYMBOLTYPE_UNKNOWN: +/*N*/ case SVX_SYMBOLTYPE_AUTO: +/*N*/ CHART_TRACE( "creating SVX_SYMBOLTYPE_AUTO" ); +/*N*/ +/*N*/ +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ default: +/*N*/ break; +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ bStock=TRUE; +/*N*/ nHalfSymbolSizeX=n1Pixel; +/*N*/ break; +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ bStock=TRUE; +/*N*/ if(nRow!=2) +/*N*/ nHalfSymbolSizeX=n1Pixel; +/*N*/ break; +/*N*/ case CHSTYLE_2D_STOCK_3: +/*?*/ bStock=TRUE; +/*?*/ if(nRow!=3) +/*?*/ nHalfSymbolSizeX=n1Pixel; +/*N*/ break; +/*N*/ } +/*N*/ if(bStock) +/*N*/ { +/*N*/ XPolygon aPolygon(2); +/*N*/ +/*N*/ aPolygon[0].X() = aPoint.X(); +/*N*/ aPolygon[0].Y() = aPoint.Y(); +/*N*/ aPolygon[1].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[1].Y() = aPoint.Y(); +/*N*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*N*/ break; +/*N*/ } +/*N*/ nWhatSymbol=nRow; +/*N*/ aDataAttr.ClearItem(SCHATTR_SYMBOL_BRUSH);//Größe gegebenenfalls löschen +/*N*/ aDataAttr.ClearItem(SCHATTR_SYMBOL_SIZE);//Größe gegebenenfalls löschen +/*N*/ break; +/*N*/ +/*N*/ case SVX_SYMBOLTYPE_BRUSHITEM: +/*N*/ { +/*?*/ if(aDataAttr.GetItemState(SCHATTR_SYMBOL_BRUSH,TRUE,&pPoolItem)==SFX_ITEM_SET) +/*?*/ { +/*?*/ CHART_TRACE( "creating SVX_SYMBOLTYPE_BRUSHITEM" ); +/*?*/ const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic(); +/*?*/ Size aSize; +/*?*/ +/*?*/ if( pGraphic ) +/*?*/ { +/*?*/ if(!pObj && aDataAttr.GetItemState(SCHATTR_SYMBOL_SIZE,TRUE,&pPoolItem)==SFX_ITEM_SET) +/*?*/ { +/*?*/ CHART_TRACE( "Size by Item" ); +/*?*/ aSize=((const SvxSizeItem*)pPoolItem)->GetSize(); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ CHART_TRACE( "Size by Graphic" ); +/*?*/ if( pGraphic ) +/*?*/ aSize = ( OutputDevice::LogicToLogic( pGraphic->GetPrefSize(), +/*?*/ pGraphic->GetPrefMapMode(), +/*?*/ MAP_100TH_MM )); +/*?*/ } +/*?*/ +/*?*/ Rectangle aRect(aPoint.X()-aSize.Width()/2,aPoint.Y()-aSize.Height()/2 +/*?*/ ,aPoint.X()+aSize.Width()/2,aPoint.Y()+aSize.Height()/2); +/*?*/ pObj = new SdrGrafObj(*pGraphic); +/*?*/ GetPage(0)->NbcInsertObject(pObj,0); +/*?*/ pObj->NbcSetSnapRect(aRect); +/*?*/ GetPage(0)->RemoveObject(0); +/*?*/ } +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ CHART_TRACE( "failed in SVX_SYMBOLTYPE_BRUSHITEM" ); +/*?*/ nWhatSymbol=nRow; +/*?*/ } +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ CHART_TRACE1( "creating SVX_SYMBOLTYPE = %d", nWhatSymbol ); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if(!pObj && aDataAttr.GetItemState(SCHATTR_SYMBOL_SIZE,TRUE,&pPoolItem)==SFX_ITEM_SET) +/*N*/ { +/*?*/ Size aSize=((const SvxSizeItem*)pPoolItem)->GetSize(); +/*?*/ nHalfSymbolSizeX = aSize.Width() / 2; +/*?*/ nHalfSymbolSizeY = aSize.Height() / 2; +/*?*/ CHART_TRACE2( "reading SCHATTR_SYMBOL_SIZE -> Size = (%ld, %ld)", aSize.Width(), aSize.Height() ); +/*N*/ } +/*N*/ +/*N*/ if(!pObj) //dann default generieren +/*N*/ { +/*N*/ switch (nWhatSymbol % 8) +/*N*/ { +/*N*/ case 0 : +/*N*/ { +/*N*/ XPolygon aPolygon (5); +/*N*/ +/*N*/ aPolygon[0].X() = aPoint.X() - nHalfSymbolSizeX; +/*N*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[1].X() = aPoint.X() - nHalfSymbolSizeX; +/*N*/ aPolygon[1].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*N*/ aPolygon[2].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[2].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*N*/ aPolygon[3].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[3].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[4].X() = aPolygon[0].X(); +/*N*/ aPolygon[4].Y() = aPolygon[0].Y(); +/*N*/ +/*N*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ case 1 : +/*N*/ { +/*N*/ XPolygon aPolygon (5); +/*N*/ +/*N*/ aPolygon[0].X() = aPoint.X(); +/*N*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[1].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[1].Y() = aPoint.Y(); +/*N*/ aPolygon[2].X() = aPoint.X(); +/*N*/ aPolygon[2].Y() = aPoint.Y() + nHalfSymbolSizeY;; +/*N*/ aPolygon[3].X() = aPoint.X() - nHalfSymbolSizeX; +/*N*/ aPolygon[3].Y() = aPoint.Y(); +/*N*/ aPolygon[4].X() = aPolygon[0].X(); +/*N*/ aPolygon[4].Y() = aPolygon[0].Y(); +/*N*/ +/*N*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ case 2 : +/*N*/ { +/*N*/ XPolygon aPolygon (4); +/*N*/ +/*N*/ aPolygon[0].X() = aPoint.X() - nHalfSymbolSizeX; +/*N*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[1].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[1].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[2].X() = aPoint.X(); +/*N*/ aPolygon[2].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*N*/ aPolygon[3].X() = aPolygon[0].X(); +/*N*/ aPolygon[3].Y() = aPolygon[0].Y(); +/*N*/ +/*N*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ case 3 : +/*N*/ { +/*N*/ XPolygon aPolygon (4); +/*N*/ +/*N*/ aPolygon[0].X() = aPoint.X() - nHalfSymbolSizeX; +/*N*/ aPolygon[0].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*N*/ aPolygon[1].X() = aPoint.X() + nHalfSymbolSizeX; +/*N*/ aPolygon[1].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*N*/ aPolygon[2].X() = aPoint.X(); +/*N*/ aPolygon[2].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*N*/ aPolygon[3].X() = aPolygon[0].X(); +/*N*/ aPolygon[3].Y() = aPolygon[0].Y(); +/*N*/ +/*N*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ case 4 : +/*N*/ { +/*?*/ XPolygon aPolygon (4); +/*?*/ +/*?*/ aPolygon[0].X() = aPoint.X() - nHalfSymbolSizeX; +/*?*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*?*/ aPolygon[1].X() = aPoint.X() + nHalfSymbolSizeX; +/*?*/ aPolygon[1].Y() = aPoint.Y(); +/*?*/ aPolygon[2].X() = aPoint.X() - nHalfSymbolSizeX; +/*?*/ aPolygon[2].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*?*/ aPolygon[3].X() = aPolygon[0].X(); +/*?*/ aPolygon[3].Y() = aPolygon[0].Y(); +/*?*/ +/*?*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*?*/ break; +/*?*/ } +/*?*/ +/*?*/ case 5 : +/*?*/ { +/*?*/ XPolygon aPolygon (4); +/*?*/ +/*?*/ aPolygon[0].X() = aPoint.X() + nHalfSymbolSizeX; +/*?*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*?*/ aPolygon[1].X() = aPoint.X() - nHalfSymbolSizeX; +/*?*/ aPolygon[1].Y() = aPoint.Y(); +/*?*/ aPolygon[2].X() = aPoint.X() + nHalfSymbolSizeX; +/*?*/ aPolygon[2].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*?*/ aPolygon[3].X() = aPolygon[0].X(); +/*?*/ aPolygon[3].Y() = aPolygon[0].Y(); +/*?*/ +/*?*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*?*/ break; +/*?*/ } +/*?*/ +/*?*/ case 6 : +/*?*/ { +/*?*/ XPolygon aPolygon (5); +/*?*/ +/*?*/ aPolygon[0].X() = aPoint.X() - nHalfSymbolSizeX; +/*?*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*?*/ aPolygon[1].X() = aPoint.X() + nHalfSymbolSizeX; +/*?*/ aPolygon[1].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*?*/ aPolygon[2].X() = aPoint.X() + nHalfSymbolSizeX; +/*?*/ aPolygon[2].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*?*/ aPolygon[3].X() = aPoint.X() - nHalfSymbolSizeX; +/*?*/ aPolygon[3].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*?*/ aPolygon[4].X() = aPolygon[0].X(); +/*?*/ aPolygon[4].Y() = aPolygon[0].Y(); +/*?*/ +/*?*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*?*/ break; +/*?*/ } +/*?*/ +/*?*/ case 7 : +/*?*/ { +/*?*/ XPolygon aPolygon (5); +/*?*/ +/*?*/ aPolygon[0].X() = aPoint.X() - nHalfSymbolSizeX; +/*?*/ aPolygon[0].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*?*/ aPolygon[1].X() = aPoint.X() + nHalfSymbolSizeX; +/*?*/ aPolygon[1].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*?*/ aPolygon[2].X() = aPoint.X() - nHalfSymbolSizeX; +/*?*/ aPolygon[2].Y() = aPoint.Y() + nHalfSymbolSizeY; +/*?*/ aPolygon[3].X() = aPoint.X() + nHalfSymbolSizeX; +/*?*/ aPolygon[3].Y() = aPoint.Y() - nHalfSymbolSizeY; +/*?*/ aPolygon[4].X() = aPolygon[0].X(); +/*?*/ aPolygon[4].Y() = aPolygon[0].Y(); +/*?*/ +/*?*/ pObj = new SdrPathObj(OBJ_POLY, XPolyPolygon(aPolygon)); +/*?*/ break; +/*?*/ } +/*?*/ +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (bInsert) //nur in CreateLegend FALSE! +/*N*/ { +/*N*/ SfxItemSet aSymbolAttr(aDataAttr); +/*N*/ GenerateSymbolAttr(aSymbolAttr,nRow,SYMBOLMODE_ROW); +/*N*/ if (nWhatSymbol == SVX_SYMBOLTYPE_NONE) +/*N*/ { +/*N*/ // Don´t show the symbol. It is only needed for selection of the +/*N*/ // data point. +/*N*/ aSymbolAttr.Put(XFillStyleItem (XFILL_NONE)); +/*N*/ aSymbolAttr.Put(XLineStyleItem (XLINE_NONE)); +/*N*/ } + if( pObj ) + { +/*N*/ pObj->SetModel( this ); +/*N*/ pObj = SetObjectAttr (pObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &aSymbolAttr); +/*N*/ pObj->InsertUserData(new SchDataPoint(nColumn, nRow)); + } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ return pObj; +/*N*/ } + +/*N*/ void ChartModel::GenerateSymbolAttr(/*const SfxItemSet& rAttr,*/SfxItemSet& rSymbolAttr,const long nRow,const long nMode) +/*N*/ { +/*N*/ // Symbole immer gleiche Umrandung und Füllfarbe = Linienfarbe, wenn es sich um ein "echtes" +/*N*/ // Symbol handelt (d.h. nicht ein Symbol für Bars/Säulen,Pies etc.) +/*N*/ +/*N*/ switch(nMode) +/*N*/ { +/*N*/ case SYMBOLMODE_LEGEND: +/*N*/ case SYMBOLMODE_ROW: +/*N*/ +/*N*/ if(HasSymbols(nRow) && IsLine(nRow)) //Symbol und Linie => ein echtes Symbol wird angezeigt :) +/*N*/ { +/*N*/ rSymbolAttr.Put(XFillColorItem(String(), +/*N*/ ((XLineColorItem &)rSymbolAttr.Get(XATTR_LINECOLOR)).GetValue())); +/*N*/ +/*N*/ rSymbolAttr.Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ rSymbolAttr.Put(XLineColorItem(String(),RGBColor(COL_BLACK))); +/*N*/ rSymbolAttr.Put(XLineWidthItem (0)); +/*N*/ +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case SYMBOLMODE_DESCRIPTION: +/*?*/ if(IsLine(nRow)) +/*?*/ { +/*?*/ rSymbolAttr.Put(XFillColorItem(String(), +/*?*/ ((XLineColorItem &)rSymbolAttr.Get(XATTR_LINECOLOR)).GetValue())); +/*?*/ +/*?*/ rSymbolAttr.Put(XLineStyleItem(XLINE_SOLID)); +/*?*/ rSymbolAttr.Put(XLineColorItem(String(),RGBColor(COL_BLACK))); +/*?*/ rSymbolAttr.Put(XLineWidthItem (0)); +/*?*/ } +/*?*/ else // rectangle with border, if linesytle is NONE +/*?*/ { +/*?*/ XLineStyle eLineStyle = +/*?*/ SAL_STATIC_CAST( const XLineStyleItem *, &(rSymbolAttr.Get( XATTR_LINESTYLE )) )->GetValue(); // bug in Win-C++ compiler: casting to pointer +/*?*/ +/*?*/ if( eLineStyle == XLINE_NONE ) // clear items for defaults to take effect +/*?*/ { +/*?*/ rSymbolAttr.ClearItem( XATTR_LINESTYLE ); +/*?*/ rSymbolAttr.ClearItem( XATTR_LINEWIDTH ); +/*?*/ rSymbolAttr.ClearItem( XATTR_LINECOLOR ); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ break; +/*N*/ case SYMBOLMODE_LINE: +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ } + +/************************************************************************* +|* +|* Datenpunkt-Attribute loeschen, die im Itemset (Argument) vorhanden sind +|* +\************************************************************************/ + +/*N*/ void ChartModel::ClearDataPointAttr( long nCol, long nRow, const SfxItemSet& rAttr ) +/*N*/ { +/*N*/ +/*N*/ CHART_TRACE( "ChartModel::ClearDataPointAttr" ); +/*N*/ +/*N*/ ItemSetList* pAttrList = IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? &aSwitchDataPointAttrList +/*N*/ : &aDataPointAttrList; +/*N*/ +/*N*/ SfxItemSet* pItemSet = pAttrList->GetObject(nCol * GetRowCount() + nRow); +/*N*/ if (pItemSet != NULL) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 ClearDblItems(rAttr,*pItemSet); +/*N*/ } +/************************************************************************* +|* +|* Datenpunkt-Attribute setzen +|* +\************************************************************************/ + +/*N*/ void ChartModel::PutDataPointAttr( long nCol, long nRow,const SfxItemSet& rAttr, BOOL bMerge /*=TRUE*/) +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::PutDataPointAttr" ); +/*N*/ DBG_ITEMS((SfxItemSet&)rAttr,this); +/*N*/ +/*N*/ ItemSetList* pAttrList = IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? &aSwitchDataPointAttrList +/*N*/ : &aDataPointAttrList; +/*N*/ +/*N*/ SfxItemSet* pItemSet = pAttrList->GetObject(nCol * GetRowCount() + nRow); +/*N*/ if (pItemSet == NULL) +/*N*/ { +/*N*/ pItemSet = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ pAttrList->Replace (pItemSet, nCol * GetRowCount() + nRow); +/*N*/ } +/*N*/ if(!bMerge) +/*?*/ pItemSet->ClearItem(); +/*N*/ PutItemSetWithNameCreation( *pItemSet, rAttr ); +/*N*/ } + +// this method exists in analogy to GetFullDataPointAttr +// it is necessary for API (=>XML) and pie charts + +/************************************************************************* +|* +|* Datenpunkt-Attribute ermitteln +|* +\************************************************************************/ + +/*N*/ const SfxItemSet& ChartModel::GetDataPointAttr( long nCol, long nRow) const +/*N*/ { +/*N*/ long nIdx = nCol * GetRowCount() + nRow; +/*N*/ ItemSetList& aAttrList = IsDataSwitched() +/*N*/ ? (class ItemSetList &) aSwitchDataPointAttrList +/*N*/ : (class ItemSetList &) aDataPointAttrList; +/*N*/ +/*N*/ if( nIdx < (long)aAttrList.Count() ) +/*N*/ { +/*N*/ SfxItemSet* pSet = aAttrList.GetObject( nIdx ); +/*N*/ if (pSet == NULL) +/*N*/ return (GetDataRowAttr(nRow)); +/*N*/ else +/*N*/ return *pSet; +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ DBG_ERROR( "Requested data point attribute is unavailable" ); +/*?*/ +/*?*/ // return something +/*?*/ DBG_ASSERT( pChartAttr, "Invalid Chart-ItemSet" ); +/*?*/ return *pChartAttr; +/*N*/ } +/*N*/ } + + +/*N*/ const SfxItemSet * ChartModel::GetRawDataPointAttr (long nCol,long nRow) const +/*N*/ { +/*N*/ long nIndex = nCol * GetRowCount() + nRow; +/*N*/ ItemSetList & aAttrList = IsDataSwitched() +/*N*/ ? (class ItemSetList &) aSwitchDataPointAttrList +/*N*/ : (class ItemSetList &) aDataPointAttrList; +/*N*/ +/*N*/ if (nIndex < (long)aAttrList.Count()) +/*N*/ return aAttrList.GetObject (nIndex); +/*N*/ else +/*N*/ return NULL; +/*N*/ } + +/************************************************************************* +|* +|* Datenpunkt-Attribute ermitteln +|* +\************************************************************************/ + +/*N*/ SfxItemSet ChartModel::GetFullDataPointAttr( long nCol, long nRow ) const +/*N*/ { +/*N*/ ItemSetList* pAttrList = IsDataSwitched() +/*N*/ ? (class ItemSetList *) & aSwitchDataPointAttrList +/*N*/ : (class ItemSetList *) & aDataPointAttrList; +/*N*/ +/*N*/ if( ! IsPieChart()) +/*N*/ { +/*N*/ // get series' attributes and merge with data-point attributes if available +/*N*/ SfxItemSet aAttr( GetDataRowAttr( nRow )); +/*N*/ SfxItemSet *pObj=pAttrList->GetObject( nCol * GetRowCount() + nRow ); +/*N*/ if( pObj ) +/*N*/ aAttr.Put( *pObj ); +/*N*/ return aAttr; +/*N*/ } + + /* the following code is for pie charts only + + data description attributes (SCHATTR_DATADESCR_DESCR and + SCHATTR_DATADESCR_SHOW_SYM) are contained in data point item set while + all other (graphical) attributes are contained in data series (data row) + item set */ + + // get data description attributes +/*N*/ SfxItemSet aDescrAttrib( *pItemPool, SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END ); +/*N*/ aDescrAttrib.Put( GetDataRowAttr( 0 )); // a pie chart always has only one series +/*N*/ +/*N*/ // the different pies use series attributes rather than data-point attributes +/*N*/ long nPieCount = GetColCount(); +/*N*/ long nSecondDimension = GetRowCount(); // pie has only one series, but the data may contain more +/*N*/ +/*N*/ SfxItemSet aAttr( GetDataRowAttr( nCol % nPieCount )); +/*N*/ +/*N*/ if( ( nCol >= nPieCount ) && +/*N*/ pDefaultColors ) +/*N*/ { +/*?*/ XColorEntry* pColEntry = SAL_STATIC_CAST( XColorEntry*, pDefaultColors->GetObject( nCol % pDefaultColors->Count())); +/*?*/ aAttr.Put( XFillColorItem( pColEntry->GetName(), pColEntry->GetColor())); +/*N*/ } +/*N*/ +/*N*/ // add description attributes of series +/*N*/ aAttr.ClearItem( SCHATTR_DATADESCR_DESCR ); +/*N*/ aAttr.ClearItem( SCHATTR_DATADESCR_SHOW_SYM ); +/*N*/ aAttr.Put( aDescrAttrib ); +/*N*/ +/*N*/ SfxItemSet* pAttr = pAttrList->GetObject( nCol * nSecondDimension ); +/*N*/ if( ( pAttr != NULL ) && pAttr->Count()) +/*N*/ aAttr.Put( *pAttr ); +/*N*/ +/*N*/ return aAttr; +/*N*/ } + +/************************************************************************* +|* +|* Datenpunkt-Attribute ermitteln +|* +\************************************************************************/ + +/*N*/ SfxItemSet& ChartModel::MergeDataPointAttr( SfxItemSet& rAttr, long nCol, long nRow ) const +/*N*/ { +/*N*/ CHART_TRACE2( "ChartModel::MergeDataPointAttr nCol=%ld, nRow=%ld", nCol, nRow ); +/*N*/ ItemSetList* pAttrList = IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? (class ItemSetList *) &aSwitchDataPointAttrList +/*N*/ : (class ItemSetList *) &aDataPointAttrList; +/*N*/ +/*N*/ SfxItemSet *pObj=pAttrList->GetObject(nCol * GetRowCount() + nRow); +/*N*/ if(pObj) +/*?*/ rAttr.Put(*pObj); +/*N*/ return rAttr; +/*N*/ } + + + +/*N*/ BOOL ChartModel::IsDataPointAttrSet (long nCol, long nRow) const +/*N*/ { +/*N*/ UINT32 nIndex = nCol * GetRowCount() + nRow; +/*N*/ ItemSetList& aAttrList = IsDataSwitched() +/*N*/ ? (class ItemSetList &) aSwitchDataPointAttrList +/*N*/ : (class ItemSetList &) aDataPointAttrList; +/*N*/ +/*N*/ if (nIndex < static_cast<UINT32>(aAttrList.Count())) +/*N*/ return aAttrList.GetObject (nIndex) != NULL; +/*N*/ else +/*N*/ // Specified data point does not exist. Therefore an item set does not exist also. +/*?*/ return false; +/*N*/ } + + +/************************************************************************* +|* +|* Aendere die Attribute einer Achse +|* +\************************************************************************/ + +/*N*/ void ChartModel::SetAxisAttributes (const SfxItemSet* pAttr,const SdrObjGroup* pAxisObj) +/*N*/ { +/*N*/ if (pAttr && pAxisObj) +/*N*/ { +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTextWhichPairs); +/*N*/ +/*N*/ aTextAttr.Put(*pAttr); +/*N*/ +/*N*/ SdrObjListIter aIterator(*pAxisObj->GetSubList(), IM_FLAT); +/*N*/ while (aIterator.IsMore()) +/*N*/ { +/*N*/ SdrObject *pObj = aIterator.Next(); +/*N*/ SchObjectId *pObjId = GetObjectId(*pObj); +/*N*/ +/*N*/ if (pObjId) +/*N*/ switch (pObjId->GetObjId()) +/*N*/ { +/*N*/ case CHOBJID_LINE : +/*N*/ //-/ pObj->SetAttributes(*pAttr, FALSE); +/*N*/ pObj->SetItemSetAndBroadcast(*pAttr); +/*N*/ break; +/*N*/ +/*N*/ case CHOBJID_TEXT : +/*?*/ SetTextAttr(*(SdrTextObj*)pObj, aTextAttr); +/*N*/ +/*N*/ default : +/*N*/ ; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Aendere die Attribute einer Achse +|* +\************************************************************************/ + + +/*N*/ void ChartModel::SetTextFromObject( SdrTextObj* pObj,OutlinerParaObject* pTextObject ) +/*N*/ { +/*N*/ DBG_ASSERT( pObj, "ChartModel::SetTextFromObject: Object is NULL" ); +/*N*/ if( !bAttrAutoStorage && pTextObject // not during BuildChart +/*N*/ || !pObj ) +/*N*/ return; +/*N*/ +/*N*/ CHART_TRACE( "ChartModel::SetTextFromObject" ); +/*N*/ +/*N*/ SchObjectId* pObjId = GetObjectId( *pObj ); +/*N*/ +/*N*/ SfxItemSet *pItemSet = NULL; +/*N*/ String* pStrToChange = NULL; +/*N*/ +/*N*/ if( pTextObject ) +/*N*/ { +/*N*/ if( pObjId ) +/*N*/ { +/*N*/ pOutliner->SetText( *pTextObject ); +/*N*/ String aTitle = pOutliner->GetText( pOutliner->GetParagraph( 0 ), pOutliner->GetParagraphCount() ); +/*N*/ pOutliner->Clear(); +/*N*/ +/*N*/ long nId = pObjId->GetObjId(); +/*N*/ switch( nId ) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_TITLE_X_AXIS: +/*N*/ pItemSet = pXAxisTitleAttr; +/*N*/ pStrToChange = &aXAxisTitle; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Y_AXIS: +/*N*/ pItemSet = pYAxisTitleAttr; +/*N*/ pStrToChange = &aYAxisTitle; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Z_AXIS: +/*N*/ pItemSet = pZAxisTitleAttr; +/*N*/ pStrToChange = &aZAxisTitle; +/*N*/ break; +/*N*/ case CHOBJID_TITLE_MAIN: +/*N*/ pItemSet = pMainTitleAttr; +/*N*/ pStrToChange = &aMainTitle; +/*N*/ break; +/*N*/ case CHOBJID_TITLE_SUB: +/*N*/ pItemSet = pSubTitleAttr; +/*N*/ pStrToChange = &aSubTitle; +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ // if stacked is set the string contains linefeeds which have to be removed +/*N*/ const SfxPoolItem* pPoolItem = NULL; +/*N*/ if( pItemSet && +/*N*/ pItemSet->GetItemState( SCHATTR_TEXT_ORIENT, FALSE, &pPoolItem ) == SFX_ITEM_SET && +/*N*/ SAL_STATIC_CAST( const SvxChartTextOrientItem*, pPoolItem )->GetValue() == CHTXTORIENT_STACKED ) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 aTitle = UnstackString( aTitle ); +/*N*/ } +/*N*/ +/*N*/ if( pStrToChange ) +/*N*/ *(pStrToChange) = aTitle; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ //Achtung! diese Funktion sollte nur für 3-D-Objekte ausgeführt werden, +/*N*/ //bei z.B. Legendensymbolen führt der Aufruf zu einer Endlos-Schleife !!!!!!!!!!!!! +/*N*/ //Im BuildChart wird ueber bAttrAutoStorage=FALSE doppelte Ausfuehrung unterbunden +/*N*/ void ChartModel::StoreObjectsAttributes(SdrObject* pObj,const SfxItemSet& rAttr, FASTBOOL bReplaceAll) +/*N*/ {//#52277# +/*N*/ if(!bAttrAutoStorage) +/*N*/ return; +/*N*/ bAttrAutoStorage=FALSE; //Rekursionen verhindern +/*N*/ +/*N*/ //Eventuell 3D-Materialfarbe in 2D-Füllfarbe konvertieren: +/* const SfxPoolItem *pPoolItem; + if( SFX_ITEM_SET == rAttr.GetItemState( SID_ATTR_3D_MAT_COLOR, TRUE, &pPoolItem ) ) + { + Color aNew = ( ( const SvxColorItem* ) pPoolItem )->GetValue(); + ((SfxItemSet&)rAttr).Put(XFillColorItem(String(),aNew)); + } +*/ +/*N*/ DBG_ITEMS(((SfxItemSet&)rAttr),this); +/*N*/ +/*N*/ SchObjectId* pObjId = GetObjectId(*pObj); +/*N*/ if(!pObjId) +/*N*/ { +/*?*/ DBG_ERROR("ChartModel::StoreObjectsAttributes failed, no ObjId"); +/*N*/ } +/*N*/ long nId=pObjId->GetObjId(); +/*N*/ +/*N*/ CHART_TRACE2( "ChartModel::StoreObjectsAttributes Id=%s %s", GetCHOBJIDName( nId ), bReplaceAll? "ReplaceAll" : "Merge" ); +/*N*/ +/*N*/ switch(nId) +/*N*/ { +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_SPECIAL_GROUP: +/*N*/ case CHOBJID_DIAGRAM_ROWGROUP: +/*N*/ case CHOBJID_LEGEND_SYMBOL_ROW: +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*?*/ break; +/*?*/ +/*?*/ case CHOBJID_DIAGRAM_DATA: +/*?*/ case CHOBJID_LEGEND_SYMBOL_COL: +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } +/*?*/ break; +/*?*/ +/*?*/ case CHOBJID_DIAGRAM_STATISTICS_GROUP : +/*?*/ case CHOBJID_DIAGRAM_AVERAGEVALUE : +/*?*/ case CHOBJID_DIAGRAM_REGRESSION : +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 +/*?*/ break; +/*?*/ +/*N*/ case CHOBJID_DIAGRAM_WALL: +/*N*/ { +/*N*/ //Spezialfall, 2.Wand suchen +/*N*/ ChartScene* pScene=GetScene(); +/*N*/ if(pScene) +/*N*/ { +/*N*/ SdrObjListIter aIterator(*pScene->GetSubList(), IM_FLAT); +/*N*/ while (aIterator.IsMore()) +/*N*/ { +/*N*/ SdrObject *pO = aIterator.Next(); +/*N*/ SchObjectId *pI = GetObjectId(*pO); +/*N*/ if(pI && pI->GetObjId()==CHOBJID_DIAGRAM_WALL && pO!=pObj) +/*N*/ //-/ pO->SetAttributes(rAttr,FALSE); +/*N*/ pO->SetItemSetAndBroadcast(rAttr); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if(bReplaceAll) +/*?*/ GetAttr(nId).ClearItem(); +/*N*/ GetAttr(nId).Put(rAttr,TRUE); +/*N*/ break; +/*N*/ default: +/*N*/ if(bReplaceAll) +/*?*/ GetAttr(nId).ClearItem(); +/*N*/ GetAttr(nId).Put(rAttr,TRUE); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ bAttrAutoStorage=TRUE; +/*N*/ } + +/************************************************************************* +|* +|* Aendere die Attribute bestimmter Objekte in der Page und im Model, bzw. +|* lokalisiere bestimmte Objekte anhand der Id. +|* Wird derzeit nur fuer UNO verwendet, koennte aber allgemeiner und sollte vor +|* allem vollständiger werden +|* +|* ACHTUNG: es gibt weitere Methoden gleichen/ähnlichen Namens und anderen Argumenten, +|* die ähnlich wie diese Funktionen arbeiten! +|* +\************************************************************************/ + +/*N*/ void ChartModel::SetTitle(const long nId, const String& rTitle) +/*N*/ { +/*N*/ switch(nId) +/*N*/ { +/*N*/ +/*N*/ case CHOBJID_TITLE_MAIN: +/*N*/ MainTitle()=rTitle; +/*N*/ // Replace the current text object with a new one with the given text. +/*N*/ { +/*N*/ SdrObject * pGroupObject = GetObjWithId( CHOBJID_TITLE_MAIN, *GetPage(0) ); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ aTitleTopCenter = pGroupObject->GetBoundRect().TopCenter(); +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ SdrTextObj * pObj = CreateTextObj(CHOBJID_TITLE_MAIN, aTitleTopCenter, +/*N*/ aMainTitle, *pMainTitleAttr, TRUE, CHADJUST_TOP_CENTER); +/*N*/ pObj->SetResizeProtect(TRUE); +/*N*/ GetPage(0)->NbcInsertObject(pObj); +/*N*/ } +/*N*/ break; +/*N*/ case CHOBJID_TITLE_SUB: +/*N*/ SubTitle()=rTitle; +/*N*/ // Replace the current text object with a new one with the given text. +/*N*/ { +/*N*/ +/*N*/ SdrObject * pGroupObject = GetObjWithId( CHOBJID_TITLE_SUB, *GetPage(0) ); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ aSubTitleTopCenter = pGroupObject->GetBoundRect().TopCenter(); +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ SdrTextObj * pObj = CreateTextObj(CHOBJID_TITLE_SUB, aSubTitleTopCenter, +/*N*/ aSubTitle, *pSubTitleAttr, TRUE, CHADJUST_TOP_CENTER); +/*N*/ pObj->SetResizeProtect(TRUE); +/*N*/ GetPage(0)->NbcInsertObject(pObj); +/*N*/ } +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_X_AXIS: +/*N*/ XAxisTitle()=rTitle; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Y_AXIS: +/*N*/ YAxisTitle()=rTitle; +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Z_AXIS: +/*N*/ ZAxisTitle()=rTitle; +/*N*/ break; +/*N*/ default: +/*?*/ CHART_TRACE2( "SetTitle: Title not found by id %ld (%s) ", nId, GetCHOBJIDName( nId )); +/*N*/ break; +/*N*/ } +/*N*/ } + +/*N*/ String ChartModel::GetTitle( const long nId ) +/*N*/ { +/*N*/ switch(nId) +/*N*/ { +/*N*/ case CHOBJID_TITLE_MAIN: +/*N*/ return MainTitle(); +/*N*/ case CHOBJID_TITLE_SUB: +/*N*/ return SubTitle(); +/*N*/ case CHOBJID_DIAGRAM_TITLE_X_AXIS: +/*N*/ return XAxisTitle(); +/*N*/ case CHOBJID_DIAGRAM_TITLE_Y_AXIS: +/*N*/ return YAxisTitle(); +/*N*/ case CHOBJID_DIAGRAM_TITLE_Z_AXIS: +/*N*/ return ZAxisTitle(); +/*N*/ default: +/*?*/ CHART_TRACE2( "GetTitle: Title not found by id %ld (%s) ", nId, GetCHOBJIDName( nId )); +/*?*/ return String(); +/*N*/ } +/*N*/ } + +/*N*/ void ChartModel::SetHasBeenMoved(const long nId,BOOL bMoved) +/*N*/ { +/*N*/ switch(nId) +/*N*/ { +/*N*/ +/*N*/ case CHOBJID_TITLE_MAIN: +/*N*/ SetMainTitleHasBeenMoved(bMoved); +/*N*/ break; +/*N*/ case CHOBJID_TITLE_SUB: +/*N*/ SetSubTitleHasBeenMoved(bMoved); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_X_AXIS: +/*N*/ SetXAxisTitleHasBeenMoved(bMoved); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Y_AXIS: +/*N*/ SetYAxisTitleHasBeenMoved(bMoved); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Z_AXIS: +/*N*/ SetZAxisTitleHasBeenMoved(bMoved); +/*N*/ break; +/*N*/ case CHOBJID_LEGEND: +/*N*/ SetLegendHasBeenMoved(bMoved); +/*N*/ break; +/*N*/ default: +/*?*/ CHART_TRACE2( "SetHasBeenMoved: Object not found by id %ld (%s) ", nId, GetCHOBJIDName( nId )); +/*N*/ break; +/*N*/ } +/*N*/ } + +/*N*/ SdrObject* ChartModel::GetObjectWithId(const long nId,const long nCol,const long nRow) +/*N*/ { +/*N*/ //ToDo: Das hier könnte man auch schöner machen (kein DEEP!) +/*N*/ SdrObject* pObj=(GetObjWithId ((USHORT)nId,*GetPage(0),0,IM_DEEPWITHGROUPS)); +/*N*/ #ifdef DBG_UTIL +/*N*/ // there is no DBG_ASSERT2 +/*N*/ if( !pObj ) +/*N*/ DBG_ERROR2( "GetObjWithId: Object not found (id=%ld => %s)", nId, GetCHOBJIDName( nId ) ); +/*N*/ #endif +/*N*/ return pObj; +/*N*/ } + +// GetAttr-Methoden: +//GetAttr(id) Diese Methode sucht anhand der Id den passenden Model-eigenen AttrSet +//Achtung! Wenn zu einer ID kein Set existiert, wird *pDummyAttr returned! +//(ungefährlich, geringer Overhead, wirft daher nur DBG__TRACE) +//Nicht-Singuläre Objekte können nicht an der ID alleine identifiziert werden, +//in diesem Fall muss GetAttr(SdrObject*) statt GetAttr(long id) gerufen werden +// GetAttr(long id, SfxItemSet&) besorgt alle für ein Objekt verfügbaren und +// gültigen Attribute + +/* +Fehlen evtl. noch in GetAttr(ID): + +#define CHOBJID_DIAGRAM 13 +#define CHOBJID_DIAGRAM_X_GRID_MAIN 22 +#define CHOBJID_DIAGRAM_Y_GRID_MAIN 23 +#define CHOBJID_DIAGRAM_Z_GRID_MAIN 24 +#define CHOBJID_DIAGRAM_X_GRID_HELP 25 +#define CHOBJID_DIAGRAM_Y_GRID_HELP 26 +#define CHOBJID_DIAGRAM_Z_GRID_HELP 27 +#define CHOBJID_DIAGRAM_ROWS 29 +#define CHOBJID_DIAGRAM_ROWSLINE 30 +#define CHOBJID_DIAGRAM_DESCRGROUP 32 +#define CHOBJID_DIAGRAM_DESCR_ROW 33 +#define CHOBJID_DIAGRAM_DESCR_COL 38 +#define CHOBJID_DIAGRAM_DESCR_SYMBOL 39 +#define CHOBJID_DIAGRAM_NET 41 +#define CHOBJID_DIAGRAM_STACKEDGROUP 46 +#define CHOBJID_DIAGRAM_STATISTICS_GROUP 48 + + + nur GetAttr(pObj): +#define CHOBJID_DIAGRAM_AVERAGEVALUE 42 +#define CHOBJID_DIAGRAM_REGRESSION 45 +#define CHOBJID_DIAGRAM_ERROR 43 + +#define CHOBJID_LEGEND_SYMBOL_ROW 36 +#define CHOBJID_LEGEND_SYMBOL_COL 37 +#define CHOBJID_DIAGRAM_DATA 31 +#define CHOBJID_DIAGRAM_SPECIAL_GROUP 55 +#define CHOBJID_DIAGRAM_ROWGROUP 28 + + */ + +/*N*/ void ChartModel::SetAttributes(const long nId,const SfxItemSet& rAttr,BOOL bMerge) +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::SetAttributes" ); +/*N*/ SfxItemSet& rItemSet=GetAttr(nId); +/*N*/ +/*N*/ if(!bMerge) +/*N*/ rItemSet.ClearItem(); + + + //sobald die member bShow*Descr endlich entfallen, kann das hier alles weg +/* if(nId==CHOBJID_DIAGRAM_X_AXIS || nId==CHOBJID_DIAGRAM_Y_AXIS || nId==CHOBJID_DIAGRAM_Z_AXIS) + { + const SfxPoolItem *pPoolItem=NULL; + if( rAttr.GetItemState( SCHATTR_AXIS_SHOWDESCR, FALSE, &pPoolItem ) == SFX_ITEM_SET ) + { + BOOL bShow = ( (const SfxBoolItem*) pPoolItem)->GetValue(); + switch(nId) + { + case CHOBJID_DIAGRAM_X_AXIS: + bShowXDescr=bShow; + break; + case CHOBJID_DIAGRAM_Y_AXIS: + bShowYDescr=bShow; + break; + case CHOBJID_DIAGRAM_Z_AXIS: + bShowZDescr=bShow; + break; + } + } + }*/ + + +/*N*/ rItemSet.Put(rAttr); +/*N*/ } +/*N*/ SfxItemSet& ChartModel::GetAttr(const long nObjId,const long nIndex1/*=-1*/) const +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::GetAttr(const long nObjId)" ); +/*N*/ +/*N*/ switch(nObjId) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_STOCKLINE_GROUP: +/*?*/ return *pStockLineAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_STOCKPLUS_GROUP: +/*N*/ return *pStockPlusAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_STOCKLOSS_GROUP: +/*N*/ return *pStockLossAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP: +/*N*/ return *pXGridMainAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_Y_GRID_MAIN_GROUP: +/*N*/ return *pYGridMainAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_Z_GRID_MAIN_GROUP: +/*N*/ return *pZGridMainAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_X_GRID_HELP_GROUP: +/*?*/ return *pXGridHelpAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_Y_GRID_HELP_GROUP: +/*?*/ return *pYGridHelpAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_Z_GRID_HELP_GROUP: +/*?*/ return *pZGridHelpAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_AREA: +/*N*/ return *pDiagramAreaAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM: //Leider mmehrfache bedeutung, im 2D ist das wohl das selbe +/*N*/ case CHOBJID_DIAGRAM_WALL: +/*N*/ return *pDiagramWallAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_FLOOR: +/*N*/ return *pDiagramFloorAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_TITLE_X_AXIS: +/*N*/ return *pXAxisTitleAttr; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Y_AXIS: +/*N*/ return *pYAxisTitleAttr; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Z_AXIS: +/*N*/ return *pZAxisTitleAttr; +/*N*/ +/*N*/ case CHOBJID_TITLE_MAIN: +/*N*/ return *pMainTitleAttr; +/*N*/ case CHOBJID_TITLE_SUB: +/*N*/ return *pSubTitleAttr; +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ return *pChartXAxis->GetItemSet(); +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ return *pChartYAxis->GetItemSet(); +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ return *pChartZAxis->GetItemSet(); +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ return *pChartBAxis->GetItemSet(); +/*N*/ case CHOBJID_DIAGRAM_A_AXIS: +/*N*/ return *pChartAAxis->GetItemSet(); +/*N*/ +/*N*/ case CHOBJID_LEGEND_BACK: //Achtung, dies ist nur das Drawing-Objekt, normalerweise erhält man die andere ID für das Gruppenobjekt +/*N*/ case CHOBJID_LEGEND: +/*N*/ return *pLegendAttr; +/*N*/ + /*return *pTitleAttr; + return *pAxisAttr; + return *pGridAttr; + return *pChartAttr;*/ +/*N*/ +/*N*/ case CHOBJID_DIAGRAM_REGRESSION: +/*?*/ return *aRegressAttrList.GetObject(nIndex1); +/*N*/ case CHOBJID_DIAGRAM_ERROR: +/*?*/ return *aErrorAttrList.GetObject(nIndex1); +/*N*/ case CHOBJID_DIAGRAM_AVERAGEVALUE: +/*?*/ return *aAverageAttrList.GetObject(nIndex1); +/*N*/ +/*N*/ default: +/*N*/ CHART_TRACE1( "GetAttr illegal Object Id (%ld), returning dummy", nObjId ); +/*N*/ return *pDummyAttr; +/*N*/ } +/*N*/ } + + +// This method fills rAttr with the items stored at the object specified +// by nObjId. Effectively calls GetAttr(long,long) but handles diagram +// axes as special case. +// The item set of the graphical object representation is not merged in +// anymore. +/*N*/ void ChartModel::GetAttr( const long nObjId, SfxItemSet& rAttr, const long nIndex1 /*=-1*/ ) +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::GetAttr( long nObjId, SfxItemSet& rAttr)" ); +/*N*/ +/*N*/ #if 0 +/*N*/ SdrObject* pObj=NULL; +/*N*/ +/*N*/ //Objektattribute aus der Seite holen +/*N*/ //aber keine indizierten Objekte auf diese Weise suchen ! +/*N*/ if(nIndex1==-1) +/*N*/ { +/*N*/ pObj=(GetObjWithId ((USHORT)nObjId,*GetPage(0),0,IM_DEEPWITHGROUPS)); +/*N*/ if(pObj) +/*N*/ rAttr.Put(pObj->GetItemSet()); +/*N*/ } +/*N*/ #endif +/*N*/ +/*N*/ // items at model (and axis object) +/*N*/ switch( nObjId ) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ case CHOBJID_DIAGRAM_A_AXIS: +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ { +/*N*/ // general item set +/*N*/ rAttr.Put( *pAxisAttr ); +/*N*/ +/*N*/ // specialized item set and members +/*N*/ ChartAxis* pAxis = GetAxis( nObjId ); +/*N*/ if( pAxis ) +/*N*/ { +/*N*/ rAttr.Put( *(pAxis->GetItemSet())); +/*N*/ pAxis->GetMembersAsAttr( rAttr ); +/*N*/ } +/*N*/ // ChartModel members for axes +/*N*/ GetTextRotation( rAttr ); +/*N*/ switch( nObjId ) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ case CHOBJID_DIAGRAM_A_AXIS: +/*N*/ rAttr.Put( SfxBoolItem( SID_TEXTBREAK, GetFormatXAxisTextInMultipleLinesIfNecessary() ) ); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ rAttr.Put( SfxBoolItem( SID_TEXTBREAK, GetFormatYAxisTextInMultipleLinesIfNecessary() ) ); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ rAttr.Put( SfxBoolItem( SID_TEXTBREAK, GetFormatZAxisTextInMultipleLinesIfNecessary() ) ); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ rAttr.Put( GetAttr( nObjId, nIndex1 )); +/*N*/ break; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::ChangeAttr(const SfxItemSet& rAttr,const long nId,const long nIndex1/*=-1*/) +/*N*/ { +/*N*/ BOOL bNeedChanges=TRUE; //noch ungenutzt, zur evtl. Optimierung +/*N*/ +/*N*/ +/*N*/ //ToDo: optimieren! klappt wegen XChartView so nicht: +/*N*/ //BOOL bForceBuild=FALSE; +/*N*/ BOOL bForceBuild=TRUE; +/*N*/ +/*N*/ +/*N*/ SdrObject* pObj=NULL; +/*N*/ //Objektattribute am Objekt setzen, falls nicht indiziert +/*N*/ if(nIndex1==-1) +/*N*/ { +/*N*/ pObj=(GetObjWithId ((USHORT)nId,*GetPage(0),0,IM_DEEPWITHGROUPS)); +/*N*/ if(pObj) +/*N*/ //-/ pObj->SetAttributes(rAttr,FALSE); +/*N*/ pObj->SetItemSetAndBroadcast(rAttr); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ //und auch am Model +/*N*/ switch(nId) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ case CHOBJID_DIAGRAM_A_AXIS: +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ { +/*N*/ const SfxPoolItem *pPoolItem; +/*N*/ if(pObj) +/*N*/ { +/*N*/ ChangeAxisAttr(rAttr,(SdrObjGroup*)pObj); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ const SfxPoolItem* pPoolItem=NULL; +/*N*/ if(rAttr.GetItemState(SID_ATTR_NUMBERFORMAT_VALUE,TRUE,&pPoolItem)==SFX_ITEM_SET) +/*N*/ { +/*N*/ SfxItemSet aSet(rAttr); +/*N*/ UINT32 nTmp=((const SfxUInt32Item*)pPoolItem)->GetValue(); +/*N*/ aSet.Put(SfxUInt32Item(IsPercentChart() +/*N*/ ? SCHATTR_AXIS_NUMFMTPERCENT : SCHATTR_AXIS_NUMFMT , nTmp)); +/*N*/ SetAttributes(nId,aSet); //im Model +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SetAttributes(nId,rAttr); //im Model +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ if( SFX_ITEM_SET == rAttr.GetItemState( SID_TEXTBREAK, TRUE, &pPoolItem ) ) +/*N*/ { +/*N*/ switch(nId) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ case CHOBJID_DIAGRAM_A_AXIS: +/*N*/ SetFormatXAxisTextInMultipleLinesIfNecessary(((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ SetFormatYAxisTextInMultipleLinesIfNecessary(((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ SetFormatZAxisTextInMultipleLinesIfNecessary(((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ case CHOBJID_AREA: +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ChangeDiagramAreaAttr( rAttr ); +/*?*/ break; +/*N*/ default: +/*N*/ GetAttr(nId,nIndex1).Put(rAttr,TRUE); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ // calculate result here because BuildChart will delete pObj (dangling pointer) +/*N*/ BOOL bResult = ( pObj != NULL || nIndex1 != -1 ); +/*N*/ +/*N*/ if(bForceBuild || nIndex1!=-1) +/*N*/ BuildChart(FALSE); +/*N*/ else if(bNeedChanges && IsAttrChangeNeedsBuildChart(rAttr)) +/*?*/ BuildChart(FALSE); +/*N*/ +/*N*/ return bResult; +/*N*/ } +/* Anmerkungen zu GetObjectAttr,SetObjectAttr: + +- das koennte bei get(????) fehlen: + CompareSets (*pYGridMainAttr, *pGridAttr); + CompareSets (*pZGridMainAttr, *pGridAttr); + CompareSets (*pXGridHelpAttr, *pGridAttr); + CompareSets (*pYGridHelpAttr, *pGridAttr); + CompareSets (*pZGridHelpAttr, *pGridAttr); + +- evtl. sollten default-itemwerte erkannt und wieder entfert werden (SET) + +- erweitern auf DataRowPoint! + +- Das koennte man mal alles oben hineintun.... + +#define CHOBJID_TEXT 1 +#define CHOBJID_AREA 2 +#define CHOBJID_LINE 3 + + + +#define CHOBJID_TITLE_MAIN 11 +#define CHOBJID_TITLE_SUB 12 +#define CHOBJID_DIAGRAM 13 + +#define CHOBJID_DIAGRAM_TITLE_X_AXIS 16 +#define CHOBJID_DIAGRAM_TITLE_Y_AXIS 17 +#define CHOBJID_DIAGRAM_TITLE_Z_AXIS 18 + + +#define CHOBJID_DIAGRAM_ROWGROUP 28 +#define CHOBJID_DIAGRAM_ROWS 29 +#define CHOBJID_DIAGRAM_ROWSLINE 30 +#define CHOBJID_DIAGRAM_DATA 31 +#define CHOBJID_DIAGRAM_DESCRGROUP 32 +#define CHOBJID_DIAGRAM_DESCR_ROW 33 +#define CHOBJID_DIAGRAM_DESCR_COL 38 +#define CHOBJID_DIAGRAM_DESCR_SYMBOL 39 +#define CHOBJID_LEGEND 34 +#define CHOBJID_LEGEND_BACK 35 +#define CHOBJID_LEGEND_SYMBOL_ROW 36 +#define CHOBJID_LEGEND_SYMBOL_COL 37 +#define CHOBJID_DIAGRAM_NET 41 +#define CHOBJID_DIAGRAM_AVERAGEVALUE 42 +#define CHOBJID_DIAGRAM_ERROR 43 +#define CHOBJID_DIAGRAM_REGRESSION 45 +#define CHOBJID_DIAGRAM_STACKEDGROUP 46 +#define CHOBJID_DIAGRAM_STATISTICS_GROUP 48 +#define CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP 49 +#define CHOBJID_DIAGRAM_Y_GRID_MAIN_GROUP 50 +#define CHOBJID_DIAGRAM_Z_GRID_MAIN_GROUP 51 +#define CHOBJID_DIAGRAM_X_GRID_HELP_GROUP 52 +#define CHOBJID_DIAGRAM_Y_GRID_HELP_GROUP 53 +#define CHOBJID_DIAGRAM_Z_GRID_HELP_GROUP 54 +#define CHOBJID_DIAGRAM_SPECIAL_GROUP 55 + +pYGridMainAttr->Put(rAttr); +*/ + + + + +/*N*/ UINT32 ChartModel::GetNumFmt(long nObjId,BOOL bPercent) +/*N*/ { +/*N*/ return ((const SfxUInt32Item&)GetAttr(nObjId).Get(bPercent +/*N*/ ? SCHATTR_AXIS_NUMFMTPERCENT:SCHATTR_AXIS_NUMFMT)).GetValue(); +/*N*/ } +/*N*/ void ChartModel::SetNumFmt(long nObjId,UINT32 nFmt,BOOL bPercent) +/*N*/ { +/*N*/ SfxItemSet aSet(*pItemPool,SCHATTR_AXIS_NUMFMT,SCHATTR_AXIS_NUMFMTPERCENT); +/*N*/ aSet.Put(SfxUInt32Item(bPercent? SCHATTR_AXIS_NUMFMTPERCENT:SCHATTR_AXIS_NUMFMT,nFmt)); +/*N*/ SetAttributes(nObjId,aSet); +/*N*/ } + + +// Prerequisite: rOutAttributes is empty but can hold all interesting attributes +// Result: All Items that are contained in all data row item sets are set +// (using the Intersect method of the SfxItemSet) +/*N*/ void ChartModel::GetDataRowAttrAll( SfxItemSet& rOutAttributes ) +/*N*/ { +/*N*/ long nListSize = aDataRowAttrList.Count(); +/*N*/ +/*N*/ // no itemsets => result stays empty +/*N*/ if( nListSize == 0 ) +/*N*/ return; +/*N*/ +/*N*/ // set items of first data row and then intersect with all remaining +/*N*/ rOutAttributes.Put( *aDataRowAttrList.GetObject( 0 )); +/*N*/ for( long nRow = 1; nRow < nListSize; nRow++ ) +/*N*/ rOutAttributes.Intersect( *aDataRowAttrList.GetObject( nRow )); +/*N*/ } + +/*N*/ void ChartModel::SetItemWithNameCreation( SfxItemSet& rDestItemSet, const SfxPoolItem* pNewItem ) +/*N*/ { +/*N*/ if( pNewItem == NULL ) +/*N*/ return; +/*N*/ +/*N*/ const SfxPoolItem* pItemToSet = pNewItem; +/*N*/ +/*N*/ // this code comes from bf_svx/source/svdraw/svdoattr.cxx: SdrAttrObj::ItemChange() +/*N*/ switch( pItemToSet->Which()) +/*N*/ { +/*N*/ case XATTR_FILLBITMAP: +/*N*/ pItemToSet = ((XFillBitmapItem*)pItemToSet)->checkForUniqueItem( this ); +/*N*/ break; +/*N*/ case XATTR_LINEDASH: +/*N*/ pItemToSet = ((XLineDashItem*)pItemToSet)->checkForUniqueItem( this ); +/*N*/ break; +/*N*/ case XATTR_LINESTART: +/*N*/ pItemToSet = ((XLineStartItem*)pItemToSet)->checkForUniqueItem( this ); +/*N*/ break; +/*N*/ case XATTR_LINEEND: +/*N*/ pItemToSet = ((XLineEndItem*)pItemToSet)->checkForUniqueItem( this ); +/*N*/ break; +/*N*/ case XATTR_FILLGRADIENT: +/*N*/ pItemToSet = ((XFillGradientItem*)pItemToSet)->checkForUniqueItem( this ); +/*N*/ break; +/*N*/ case XATTR_FILLFLOATTRANSPARENCE: +/*N*/ pItemToSet = ((XFillFloatTransparenceItem*)pItemToSet)->checkForUniqueItem( this ); +/*N*/ break; +/*N*/ case XATTR_FILLHATCH: +/*N*/ pItemToSet = ((XFillHatchItem*)pItemToSet)->checkForUniqueItem( this ); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ if( pItemToSet ) +/*N*/ rDestItemSet.Put( *pItemToSet ); +/*N*/ +/*N*/ // delete item if it was a generated one +/*N*/ if( pNewItem != pItemToSet ) +/*N*/ delete pItemToSet; +/*N*/ } + +/*N*/ void ChartModel::PutItemSetWithNameCreation( SfxItemSet& rDestItemSet, const SfxItemSet& rNewItemSet ) +/*N*/ { +/*N*/ // copy all attributes +/*N*/ rDestItemSet.Put( rNewItemSet ); +/*N*/ +/*N*/ // check for items that need name creation +/*N*/ SfxWhichIter aIter( rNewItemSet ); +/*N*/ sal_uInt16 nWhich = aIter.FirstWhich(); +/*N*/ const SfxPoolItem* pPoolItem = NULL; +/*N*/ +/*N*/ while( nWhich ) +/*N*/ { +/*N*/ switch( nWhich ) +/*N*/ { +/*N*/ case XATTR_FILLBITMAP: +/*N*/ case XATTR_LINEDASH: +/*N*/ case XATTR_LINESTART: +/*N*/ case XATTR_LINEEND: +/*N*/ case XATTR_FILLGRADIENT: +/*N*/ case XATTR_FILLFLOATTRANSPARENCE: +/*N*/ case XATTR_FILLHATCH: +/*N*/ if( SFX_ITEM_SET == rNewItemSet.GetItemState( nWhich, TRUE, &pPoolItem )) +/*N*/ SetItemWithNameCreation( rDestItemSet, pPoolItem ); +/*N*/ } +/*N*/ nWhich = aIter.NextWhich(); +/*N*/ } +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode4.cxx b/binfilter/bf_sch/source/core/sch_chtmode4.cxx new file mode 100644 index 000000000000..a2dd9f1087f4 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode4.cxx @@ -0,0 +1,1721 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "pairs.hxx" + +#include <bf_svx/eeitem.hxx> +#include <bf_sfx2/sfxsids.hrc> +#ifdef _MSC_VER +#pragma hdrstop +#endif +#include <bf_svx/svdopath.hxx> +#include <vcl/msgbox.hxx> +#include <bf_svtools/itempool.hxx> +#include <bf_svx/svdorect.hxx> +#include <bf_sfx2/printer.hxx> + +#include <bf_svx/editdata.hxx> +#include "schattr.hxx" + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#define ITEMID_CHARTSTYLE CHATTR_DIAGRAM_STYLE +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS + +#include <bf_svtools/eitem.hxx> + +#include <bf_svx/chrtitem.hxx> +#endif + +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#define ITEMID_FONTWIDTH EE_CHAR_FONTWIDTH +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/fwdtitem.hxx> +#ifndef _CHTMODEL_HXX +#include <globfunc.hxx> +#include <chtmodel.hxx> +#endif +#include <bf_svx/svdoutl.hxx> // wg. SdrOutliner +#include <bf_svx/svdpage.hxx> +#include "objadj.hxx" +#include "schresid.hxx" +#include "objid.hxx" +#include "datarow.hxx" +#include <bf_svx/dlgutil.hxx> + +#include "chtscene.hxx" +#include "glob.hrc" +#include <math.h> +#include <float.h> + +#include "chmod3d.hxx" +#include "docshell.hxx" + +#include <bf_sfx2/app.hxx> +#include <vcl/virdev.hxx> + +#include <rtl/logfile.hxx> + +#include "chaxis.hxx" +#include "ChXChartDocument.hxx" + +#include "ReBuildHint.hxx" +namespace binfilter { + +/************************************************************************/ + +/************************************************************************* +|* +|* Achsen & Gitter aendern; +|* Liefert bei Aenderung TRUE. +|* +\************************************************************************/ + + + + + +/************************************************************************* +|* +|* Datenbeschriftung aendern; +|* FG: 24.4.97 nRow ist ein Parameter der ermoeglicht die Datenbeschriftung +|* einer einzigen Reihe zu aendern, falls er -1 ist werden alle +|* Datenreihen mit dem uebergebenen Attributen belegt. (default ist alle) +|* +\************************************************************************/ + +/*N*/ void ChartModel::ChangeDataDescr(SvxChartDataDescr eDescr, BOOL bSym, +/*N*/ long nRowToChange, BOOL bBuildChart) +/*N*/ { +/*N*/ if( nRowToChange == -1 || +/*N*/ IsPieChart()) +/*N*/ { +/*N*/ // change setting globally +/*N*/ eDataDescr = eDescr; +/*N*/ bShowSym = bSym; +/*N*/ +/*N*/ // clear individual settings +/*N*/ long nEndRow = GetRowCount(); +/*N*/ for( long nRow = 0; nRow < nEndRow; nRow++ ) +/*N*/ { +/*N*/ SfxItemSet &rAttr = SAL_CONST_CAST( SfxItemSet&, GetDataRowAttr( (short)nRow )); +/*N*/ +/*N*/ rAttr.Put( SvxChartDataDescrItem( eDescr )); +/*N*/ rAttr.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYM, bSym )); +/*N*/ +/*N*/ // the following is the preferred method, but the items are not evaluated appropriately +/*N*/ // rAttr.ClearItem( ITEMID_CHARTDATADESCR ); +/*N*/ // rAttr.ClearItem( SCHATTR_DATADESCR_SHOW_SYM ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SfxItemSet &rAttr = SAL_CONST_CAST( SfxItemSet&, GetDataRowAttr( (short)nRowToChange )); +/*N*/ +/*N*/ rAttr.Put( SvxChartDataDescrItem( eDescr )); +/*N*/ rAttr.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYM, bSym )); +/*N*/ } +/*N*/ +/*N*/ if( bBuildChart ) +/*?*/ BuildChart( FALSE ); +/*N*/ } + +/************************************************************************* +|* +|* Seitengroesse aendern; +|* Liefert bei Aenderung TRUE. +|* +\************************************************************************/ + +/*N*/ BOOL ChartModel::ResizePage(const Size& rNewSize) +/*N*/ { +/*N*/ SdrPage* pPage = GetPage(0); +/*N*/ +/*N*/ if (!pPage || pPage->GetSize() == rNewSize) return FALSE; +/*N*/ else +/*N*/ { +/*N*/ BOOL bWasChanged = IsChanged(); +/*N*/ +/*N*/ pPage->SetSize(rNewSize); +/*N*/ eOldChartStyle = eChartStyle; +/*N*/ if (rNewSize.Width () != 0 && rNewSize.Height () != 0) BuildChart(FALSE); +/*N*/ +/*N*/ if (!bWasChanged) SetChanged(FALSE); +/*N*/ +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + + +/************************************************************************ +|* +|* skaliere Texte neu um +|* +\************************************************************************/ + +/*N*/ void ChartModel::ResizeText (SfxItemSet *pTextAttr, Size aPageSize, BOOL bResizePage ) +/*N*/ { +/*N*/ double fRatio; +/*N*/ if( bResizePage ) +/*N*/ fRatio = (double)aPageSize.Height() / (double)aInitialSize.Height(); +/*N*/ else +/*?*/ fRatio = (double)aDiagramRectangle.GetHeight() / (double)aLastDiagramRectangle.GetHeight(); +/*N*/ +/*N*/ // resize all three fonts +/*N*/ static const USHORT nWhichIds[ 3 ] = { +/*N*/ EE_CHAR_FONTHEIGHT, +/*N*/ EE_CHAR_FONTHEIGHT_CJK, +/*N*/ EE_CHAR_FONTHEIGHT_CTL +/*N*/ }; +/*N*/ +/*N*/ for( int i=0; i < 3; i++ ) +/*N*/ { +/*N*/ long nHeight = ((SvxFontHeightItem &)pTextAttr->Get( nWhichIds[ i ] )).GetHeight(); +/*N*/ +/*N*/ // Scale and round height. +/*N*/ nHeight = (long)( fRatio * (double)nHeight + 0.5 ); +/*N*/ +/*N*/ float fPoints = (float)CalcToPoint( nHeight, SFX_MAPUNIT_100TH_MM, 10 ); +/*N*/ if( fPoints < 2.0 ) fPoints = 2.0; +/*N*/ +/*N*/ pTextAttr->Put( SvxFontHeightItem( CalcToUnit( fPoints / (float)10.0, SFX_MAPUNIT_100TH_MM ), +/*N*/ 100, nWhichIds[ i ] )); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Textobjekt fuer Editieren vorbereiten +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Editieren abschlieáen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Attribute lesen +|* +\************************************************************************/ + +//SfxItemSet ChartModel::GetAttr() const +/*N*/ void ChartModel::GetAttr(SfxItemSet& rAttr) +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::GetAttr(SfxItemSet& rAttr)" ); +/*N*/ +/*N*/ rAttr.Put(SvxChartStyleItem(ChartStyle())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_TITLE_SHOW_MAIN, ShowMainTitle())); +/*N*/ rAttr.Put(SfxStringItem(CHATTR_TITLE_MAIN, MainTitle())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_TITLE_SHOW_SUB, ShowSubTitle())); +/*N*/ rAttr.Put(SfxStringItem(CHATTR_TITLE_SUB, SubTitle())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_TITLE_SHOW_X_AXIS, ShowXAxisTitle())); +/*N*/ rAttr.Put(SfxStringItem(CHATTR_TITLE_X_AXIS, XAxisTitle())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_TITLE_SHOW_Y_AXIS, ShowYAxisTitle())); +/*N*/ rAttr.Put(SfxStringItem(CHATTR_TITLE_Y_AXIS, YAxisTitle())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_TITLE_SHOW_Z_AXIS, ShowZAxisTitle())); +/*N*/ rAttr.Put(SfxStringItem(CHATTR_TITLE_Z_AXIS, ZAxisTitle())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_X_AXIS, ShowXAxis())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_X_MAIN, ShowXGridMain())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_X_HELP, ShowXGridHelp())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_X_DESCR, ShowXDescr())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Y_AXIS, ShowYAxis())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Y_MAIN, ShowYGridMain())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Y_HELP, ShowYGridHelp())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Y_DESCR, ShowYDescr())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Z_AXIS, ShowZAxis())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Z_MAIN, ShowZGridMain())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Z_HELP, ShowZGridHelp())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_Z_DESCR, ShowZDescr())); +/*N*/ +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_2Y_AXIS, GetAxisByUID(CHART_AXIS_SECONDARY_Y)->IsVisible())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_2Y_DESCR, GetAxisByUID(CHART_AXIS_SECONDARY_Y)->HasDescription())); +/*N*/ +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_2X_AXIS, GetAxisByUID(CHART_AXIS_SECONDARY_X)->IsVisible())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_AXISGRID_SHOW_2X_DESCR, GetAxisByUID(CHART_AXIS_SECONDARY_X)->HasDescription())); +/*N*/ +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ if (pLegendAttr->GetItemState(SCHATTR_LEGEND_POS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ rAttr.Put(SvxChartLegendPosItem +/*N*/ (((const SvxChartLegendPosItem*)pPoolItem)->GetValue(), +/*N*/ pItemPool->GetSlotId(SCHATTR_LEGEND_POS))); +/*N*/ +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_DATA_SWITCH, IsSwitchData())); +/*N*/ +/*N*/ +/*N*/ rAttr.Put (SfxBoolItem (SCHATTR_STAT_AVERAGE,bShowAverage)); +/*N*/ rAttr.Put (SfxInt32Item (SCHATTR_STAT_KIND_ERROR, (INT32) eErrorKind)); +/*N*/ rAttr.Put (SfxInt32Item (SCHATTR_STAT_INDICATE, (INT32) eIndicate)); +/*N*/ rAttr.Put (SvxDoubleItem (fIndicatePercent, SCHATTR_STAT_PERCENT)); +/*N*/ rAttr.Put (SvxDoubleItem (fIndicateBigError, SCHATTR_STAT_BIGERROR)); +/*N*/ rAttr.Put (SvxDoubleItem (fIndicatePlus, SCHATTR_STAT_CONSTPLUS)); +/*N*/ rAttr.Put (SvxDoubleItem (fIndicateMinus, SCHATTR_STAT_CONSTMINUS)); +/*N*/ rAttr.Put (SfxInt32Item (SCHATTR_STAT_REGRESSTYPE, (INT32) eRegression)); +/*N*/ +/*N*/ //Datenbeschriftung +/*N*/ rAttr.Put(SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYM,bShowSym)); +/*N*/ rAttr.Put(SvxChartDataDescrItem(eDataDescr)); +/*N*/ +/*N*/ rAttr.Put(SfxInt32Item(CHATTR_BARWIDTH,GetBarPercentWidth())); +/*N*/ rAttr.Put(SfxBoolItem(CHATTR_BARCONNECT, (BOOL)(m_nDefaultColorSet&CHSPECIAL_TRACELINES))); +/*N*/ +/*N*/ if (pChartAttr->GetItemState(SCHATTR_STYLE_SHAPE, TRUE, &pPoolItem)== SFX_ITEM_SET) +/*N*/ { +/*?*/ long nTmp= (long)((const SfxInt32Item*)pPoolItem)->GetValue(); +/*?*/ rAttr.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nTmp)); +/*N*/ } +/*N*/ +/*N*/ ChartScene *pScene=GetScene(); +/*N*/ if(pScene) +/*N*/ //-/ pScene->TakeAttributes(rAttr,TRUE,FALSE); +/*N*/ rAttr.Put(pScene->GetItemSet()); +/*N*/ +/*N*/ if( pChartAttr->GetItemState( SCHATTR_USER_DEFINED_ATTR, TRUE, &pPoolItem ) == SFX_ITEM_SET ) +/*N*/ { +/*?*/ rAttr.Put( *pPoolItem ); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Attribute setzen +|* +\************************************************************************/ + +/*N*/ void ChartModel::PutAttr(const SfxItemSet& rAttr) +/*N*/ { +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_SHOW_MAIN, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowMainTitle () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_MAIN, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ MainTitle () = ((const SfxStringItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_SHOW_SUB, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowSubTitle () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_SUB, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ SubTitle () = ((const SfxStringItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_SHOW_X_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowXAxisTitle () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_X_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ XAxisTitle () = ((const SfxStringItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_SHOW_Y_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowYAxisTitle () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_Y_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ YAxisTitle () = ((const SfxStringItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_SHOW_Z_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowZAxisTitle () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_TITLE_Z_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ ZAxisTitle () = ((const SfxStringItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_X_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowXAxis (((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_X_MAIN, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowXGridMain () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_X_HELP, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ ShowXGridHelp () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_X_DESCR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowXDescr (((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Y_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowYAxis (((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Y_MAIN, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowYGridMain () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Y_HELP, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ ShowYGridHelp () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Y_DESCR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowYDescr (((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Z_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowZAxis (((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Z_MAIN, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ ShowZGridMain () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Z_HELP, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ ShowZGridHelp () = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_Z_DESCR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ ShowZDescr (((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_2Y_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ { +/*N*/ BOOL b = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ pChartBAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_SHOWAXIS,b)); +/*N*/ } +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_2Y_DESCR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ { +/*N*/ BOOL b = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ pChartBAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,b)); +/*N*/ } +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_2X_AXIS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ { +/*N*/ BOOL b = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ pChartAAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_SHOWAXIS,b)); +/*N*/ } +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_AXISGRID_SHOW_2X_DESCR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ { +/*N*/ BOOL b = ((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ pChartAAxis->GetItemSet()->Put(SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,b)); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_LEGEND_POS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ pLegendAttr->Put(SvxChartLegendPosItem +/*N*/ (((const SvxChartLegendPosItem*)pPoolItem)->GetValue(), +/*?*/ pItemPool->GetWhich(CHATTR_LEGEND_POS))); +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_DATA_SWITCH, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ ChangeSwitchData(((const SfxBoolItem*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ +/*N*/ +/*N*/ //Statistik +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_CONSTPLUS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ fIndicatePlus=((const SvxDoubleItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_BIGERROR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ fIndicateBigError=((const SvxDoubleItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_PERCENT, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ fIndicatePercent=((const SvxDoubleItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_INDICATE, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ eIndicate=(SvxChartIndicate)((const SfxInt32Item*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_KIND_ERROR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ eErrorKind=(SvxChartKindError)((const SfxInt32Item*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_AVERAGE, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ bShowAverage=((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_CONSTMINUS, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ fIndicateMinus=((const SvxDoubleItem*)pPoolItem)->GetValue(); +/*N*/ if (rAttr.GetItemState(SCHATTR_STAT_REGRESSTYPE, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ eRegression=(SvxChartRegress)((const SfxInt32Item*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ +/*N*/ //Datenbeschriftung +/*N*/ SvxChartDataDescr eNewDataDescr,eOldDataDescr; +/*N*/ BOOL bNewShowSym, bOldShowSym; +/*N*/ +/*N*/ eNewDataDescr = eOldDataDescr = eDataDescr; +/*N*/ bNewShowSym = bOldShowSym = bShowSym; +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_DATADESCR_DESCR, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ eNewDataDescr=(SvxChartDataDescr)((const SvxChartDataDescrItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_DATADESCR_SHOW_SYM, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ bNewShowSym=((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ +/*N*/ if( bOldShowSym != bNewShowSym || eOldDataDescr != eNewDataDescr ) +/*N*/ { +/*?*/ ChangeDataDescr(eNewDataDescr,bNewShowSym); +/*N*/ } +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_BARWIDTH, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ SetBarPercentWidth((long)((const SfxInt32Item*)pPoolItem)->GetValue()); +/*N*/ +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_BARCONNECT, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*N*/ { +/*N*/ BOOL bTmp=((const SfxBoolItem*)pPoolItem)->GetValue(); +/*N*/ m_nDefaultColorSet=(bTmp) +/*N*/ ?(m_nDefaultColorSet|CHSPECIAL_TRACELINES) +/*N*/ :(m_nDefaultColorSet|CHSPECIAL_TRACELINES)-CHSPECIAL_TRACELINES; +/*N*/ } +/*N*/ +/*N*/ if (rAttr.GetItemState(SCHATTR_STYLE_SHAPE, TRUE, &pPoolItem)== SFX_ITEM_SET) +/*N*/ { +/*N*/ long nTmp= (long)((const SfxInt32Item*)pPoolItem)->GetValue(); +/*N*/ SfxItemSet aS(*pItemPool,SCHATTR_STYLE_SHAPE,SCHATTR_STYLE_SHAPE,0); +/*N*/ aS.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nTmp)); +/*N*/ PutDataRowAttrAll(aS); +/*N*/ } +/*N*/ +/*N*/ // Autopilot mit CHATTR_ +/*N*/ if (rAttr.GetItemState(CHATTR_STYLE_SHAPE, TRUE, &pPoolItem)== SFX_ITEM_SET) +/*N*/ { +/*?*/ long nTmp= (long)((const SfxInt32Item*)pPoolItem)->GetValue(); +/*?*/ SfxItemSet aS(*pItemPool,SCHATTR_STYLE_SHAPE,SCHATTR_STYLE_SHAPE,0); +/*?*/ aS.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nTmp)); +/*?*/ PutDataRowAttrAll(aS); +/*N*/ } +/*N*/ if( rAttr.GetItemState(CHATTR_AXIS_AUTO_ORIGIN, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*?*/ BOOL bTmp= (BOOL)((const SfxBoolItem*)pPoolItem)->GetValue(); +/*?*/ SfxItemSet aS( *pItemPool, SCHATTR_AXIS_AUTO_ORIGIN, SCHATTR_AXIS_AUTO_ORIGIN); +/*?*/ aS.Put( SfxBoolItem( SCHATTR_AXIS_AUTO_ORIGIN, bTmp )); +/*?*/ if( pChartYAxis ) +/*?*/ { +/*?*/ pChartYAxis->SetAttributes( aS ); +/*?*/ } +/*?*/ if( pChartBAxis ) +/*?*/ { +/*?*/ pChartBAxis->SetAttributes( aS ); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ ChartScene *pScene=GetScene(); +/*N*/ if(pScene) //ToDo: Ist das hier nötig??? warum nicht direkt rAttr? #63904# +/*N*/ { +/*N*/ SfxItemSet aSceneSet(*pItemPool,nRowWhichPairs); +/*N*/ aSceneSet.Put(rAttr); +/*N*/ +/*N*/ //-/ pScene->NbcSetAttributes(aSceneSet,FALSE); +/*N*/ pScene->SetItemSet(aSceneSet); +/*N*/ +/*N*/ } +/*N*/ +/*N*/ if( rAttr.GetItemState( SCHATTR_USER_DEFINED_ATTR, TRUE, &pPoolItem ) == SFX_ITEM_SET ) +/*N*/ { +/*?*/ pChartAttr->Put( *pPoolItem ); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if (rAttr.GetItemState(CHATTR_DIAGRAM_STYLE, TRUE, &pPoolItem) +/*N*/ == SFX_ITEM_SET) +/*?*/ ChangeChart( ((const SvxChartStyleItem*)pPoolItem)->GetValue()); +/*N*/ } + +/*N*/ long ChartModel::GetAxisUID(long nRow) +/*N*/ { +/*N*/ return ((const SfxInt32Item &)GetDataRowAttr(nRow).Get(SCHATTR_AXIS)).GetValue(); +/*N*/ }; + + + + +/************************************************************************* +|* +|* Attribute setzen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* gesamte Grafik initialisieren +|* +\************************************************************************/ + +/*N*/ void ChartModel::Initialize() +/*N*/ { +/*N*/ mbIsInitialized = TRUE; +/*N*/ +/*N*/ if (!(aInitialSize.Height () && aInitialSize.Width ())) +/*N*/ { +/*?*/ SdrPage* pPage = GetPage(0); +/*?*/ if (pPage) aInitialSize = pPage->GetSize(); +/*?*/ +/*?*/ if (!(aInitialSize.Height () && aInitialSize.Width ())) aInitialSize = Size (7000, 8000); +/*?*/ // 13000, 8666 +/*N*/ } +/*N*/ +/*N*/ ScaleText( 0, aInitialSize ); +/*N*/ +/*N*/ if( bShouldBuildChart ) +/*N*/ { +/*N*/ // Force build chart. If it has been loaded from an XML file, than that is +/*N*/ // done by unlocking it. +/*N*/ bNoBuildChart = FALSE; +/*N*/ +/*N*/ if( pDocShell && +/*N*/ pDocShell->IsEnableSetModified()) +/*N*/ { +/*?*/ pDocShell->EnableSetModified( FALSE ); +/*?*/ if (IsLockedBuild()) +/*?*/ UnlockBuild(); +/*?*/ else +/*?*/ BuildChart( FALSE ); +/*?*/ pDocShell->EnableSetModified( TRUE ); +/*N*/ } +/*N*/ else +/*N*/ if (IsLockedBuild()) +/*?*/ UnlockBuild(); +/*N*/ else +/*N*/ BuildChart( FALSE ); +/*N*/ } +/*N*/ +/*N*/ SetDiagramRectangle( GetChartRect() ); +/*N*/ } + + +/************************************************************************* +|* +|* Sub-Methode von BuildChart() +|* +\************************************************************************/ +/*N*/ void ChartModel::ScaleText( long nTitle, const Size& rPageSize ) +/*N*/ { +/*N*/ // #67459# +/*N*/ // if the page size is unchanged ... +/*N*/ if( aInitialSize == rPageSize ) +/*N*/ { +/*N*/ // ... and the diagram (possibly) has been resized +/*N*/ if( GetDiagramHasBeenMovedOrResized() && (aLastDiagramRectangle != aDiagramRectangle) ) +/*N*/ { +/*?*/ if( nTitle != CHOBJID_DIAGRAM_X_AXIS ) +/*?*/ ResizeText( &GetAttr(CHOBJID_DIAGRAM_X_AXIS), rPageSize, FALSE ); +/*?*/ if( nTitle != CHOBJID_DIAGRAM_Y_AXIS ) +/*?*/ ResizeText( &GetAttr(CHOBJID_DIAGRAM_Y_AXIS), rPageSize, FALSE ); +/*?*/ if( nTitle != CHOBJID_DIAGRAM_A_AXIS ) +/*?*/ ResizeText( &GetAttr(CHOBJID_DIAGRAM_A_AXIS), rPageSize, FALSE ); +/*?*/ if( nTitle != CHOBJID_DIAGRAM_B_AXIS ) +/*?*/ ResizeText( &GetAttr(CHOBJID_DIAGRAM_B_AXIS), rPageSize, FALSE ); +/*?*/ if( nTitle != CHOBJID_DIAGRAM_Z_AXIS ) +/*?*/ ResizeText( &GetAttr(CHOBJID_DIAGRAM_Z_AXIS), rPageSize, FALSE ); +/*?*/ +/*?*/ for( ULONG i=0; i<aDataRowAttrList.Count(); i++ ) +/*?*/ ResizeText( aDataRowAttrList.GetObject(i), rPageSize, FALSE ); +/*?*/ ResizeText(pDummyAttr,rPageSize); // also resize crash test dummy to normal for next test ? +/*N*/ } +/*N*/ } +/*N*/ else // page size has changed +/*N*/ { +/*N*/ if(nTitle != CHOBJID_TITLE_MAIN) +/*N*/ ResizeText (pMainTitleAttr ,rPageSize); +/*N*/ if(nTitle != CHOBJID_TITLE_SUB) +/*N*/ ResizeText (pSubTitleAttr ,rPageSize); +/*N*/ if(nTitle != CHOBJID_DIAGRAM_TITLE_X_AXIS) +/*N*/ ResizeText (pXAxisTitleAttr,rPageSize); +/*N*/ if(nTitle != CHOBJID_DIAGRAM_TITLE_Y_AXIS) +/*N*/ ResizeText (pYAxisTitleAttr,rPageSize); +/*N*/ if(nTitle != CHOBJID_DIAGRAM_TITLE_Z_AXIS) +/*N*/ ResizeText (pZAxisTitleAttr,rPageSize); +/*N*/ +/*N*/ if(nTitle != CHOBJID_DIAGRAM_X_AXIS) +/*N*/ ResizeText(&GetAttr(CHOBJID_DIAGRAM_X_AXIS),rPageSize); +/*N*/ if(nTitle != CHOBJID_DIAGRAM_Y_AXIS) +/*N*/ ResizeText(&GetAttr(CHOBJID_DIAGRAM_Y_AXIS),rPageSize); +/*N*/ if(nTitle != CHOBJID_DIAGRAM_A_AXIS) +/*N*/ ResizeText(&GetAttr(CHOBJID_DIAGRAM_A_AXIS),rPageSize); +/*N*/ if(nTitle != CHOBJID_DIAGRAM_B_AXIS) +/*N*/ ResizeText(&GetAttr(CHOBJID_DIAGRAM_B_AXIS),rPageSize); +/*N*/ if(nTitle != CHOBJID_DIAGRAM_Z_AXIS) +/*N*/ ResizeText(&GetAttr(CHOBJID_DIAGRAM_Z_AXIS),rPageSize); +/*N*/ if(nTitle != CHOBJID_LEGEND) +/*N*/ ResizeText(pLegendAttr, rPageSize); +/*N*/ for( ULONG i=0; i<aDataRowAttrList.Count(); i++ ) +/*N*/ ResizeText(aDataRowAttrList.GetObject(i),rPageSize); +/*N*/ ResizeText(pDummyAttr,rPageSize); // also resize crash test dummy to normal for next test ? +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), Anzeige des Haupttitels +|* +\************************************************************************/ +/*N*/ void ChartModel::DoShowMainTitle(USHORT& rIndex,const long nYOfs) +/*N*/ { +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ const Size& rPageSize=pPage->GetSize(); +/*N*/ +/*N*/ Point aTitlePosition; +/*N*/ if (bUseRelativePositionsForChartGroups && (aTitleTopCenter.X() >= 0) && +/*N*/ (aTitleTopCenter.Y() >= 0) && GetMainTitleHasBeenMoved()) +/*N*/ { +/*N*/ double fRelativXPosition = ((double) aTitleTopCenter.X()) / aInitialSize.Width(); +/*N*/ double fRelativYPosition = ((double) aTitleTopCenter.Y()) / aInitialSize.Height(); +/*N*/ aTitlePosition.X() = (long)((double)rPageSize.Width() * fRelativXPosition ); +/*N*/ aTitlePosition.Y() = (long)((double)rPageSize.Height() * fRelativYPosition ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aTitlePosition.X() = aChartRect.Left() + aChartRect.GetWidth() / 2; +/*N*/ aTitlePosition.Y() = aChartRect.Top(); +/*N*/ } +/*N*/ +/*N*/ SdrTextObj *pObj = CreateTextObj(CHOBJID_TITLE_MAIN, aTitlePosition, +/*N*/ aMainTitle, +/*N*/ *pMainTitleAttr, TRUE, CHADJUST_TOP_CENTER); +/*N*/ +/*N*/ aChartRect.Top() += GetOutputSize(*pObj).Height() + nYOfs; +/*N*/ pObj->SetResizeProtect(TRUE); +/*N*/ pPage->NbcInsertObject(pObj, rIndex++); +/*N*/ } + +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), man koennte vermutlich DoShowMainTitle und +|* DoShowSubTitle zu DoShowTitle zusammenfassen +|* +\************************************************************************/ +/*N*/ void ChartModel::DoShowSubTitle(USHORT& rIndex,const long nYOfs) +/*N*/ { +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ const Size& rPageSize=pPage->GetSize(); +/*N*/ +/*N*/ Point aSubTitlePosition; +/*N*/ if (bUseRelativePositionsForChartGroups && (aSubTitleTopCenter.X() >= 0) && +/*N*/ (aSubTitleTopCenter.Y() >= 0) && GetSubTitleHasBeenMoved()) +/*N*/ { +/*N*/ double fRelativeXPosition = ((double) aSubTitleTopCenter.X()) / aInitialSize.Width(); +/*N*/ double fRelativeYPosition = ((double) aSubTitleTopCenter.Y()) / aInitialSize.Height(); +/*N*/ aSubTitlePosition.X() = (long)((double)rPageSize.Width() * fRelativeXPosition ); +/*N*/ aSubTitlePosition.Y() = (long)((double)rPageSize.Height() * fRelativeYPosition ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aSubTitlePosition.X() = aChartRect.Left() + aChartRect.GetWidth() / 2; +/*N*/ aSubTitlePosition.Y() = aChartRect.Top(); +/*N*/ } +/*N*/ SdrTextObj *pObj = CreateTextObj(CHOBJID_TITLE_SUB, aSubTitlePosition, +/*N*/ aSubTitle, +/*N*/ *pSubTitleAttr, TRUE, CHADJUST_TOP_CENTER); +/*N*/ +/*N*/ aChartRect.Top() += GetOutputSize(*pObj).Height() + nYOfs; +/*N*/ pObj->SetResizeProtect(TRUE); +/*N*/ pPage->NbcInsertObject(pObj, rIndex++); +/*N*/ } + +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), Anzeige der Legende +|* +\************************************************************************/ +/*N*/ void ChartModel::DoShowLegend(const Rectangle& rWholeRect, +/*N*/ const long nXOfs,const long nYOfs,USHORT& rIndex) +/*N*/ { +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ const Size& rPageSize=pPage->GetSize(); +/*N*/ +/*N*/ SvxChartLegendPos eLegendPos = ((const SvxChartLegendPosItem&) pLegendAttr->Get(SCHATTR_LEGEND_POS)). +/*N*/ GetValue(); +/*N*/ +/*N*/ if (eLegendPos != CHLEGEND_NONE) +/*N*/ { +/*N*/ SdrObject *pObj = CreateLegend(rWholeRect); +/*N*/ +/*N*/ if (pObj) +/*N*/ { +/*N*/ Rectangle aRect = pObj->GetLogicRect(); +/*N*/ ChartAdjust eAdjust; +/*N*/ +/*N*/ Point aLegendPosition; +/*N*/ if (bUseRelativePositionsForChartGroups && (aLegendTopLeft.X() >= 0) && +/*N*/ (aLegendTopLeft.Y() >= 0) && GetLegendHasBeenMoved()) +/*N*/ { +/*N*/ double fRatioX = +/*N*/ static_cast< double >( rPageSize.Width() ) / +/*N*/ static_cast< double >( aInitialSize.Width() ); +/*N*/ double fRatioY = +/*N*/ static_cast< double >( rPageSize.Height() ) / +/*N*/ static_cast< double >( aInitialSize.Height() ); +/*N*/ +/*N*/ aLegendPosition.X() = static_cast< long >( +/*N*/ static_cast< double >( aLegendTopLeft.X() ) * fRatioX ); +/*N*/ aLegendPosition.Y() = static_cast< long >( +/*N*/ static_cast< double >( aLegendTopLeft.Y() ) * fRatioY ); +/*N*/ +/*N*/ if( bAdjustMarginsForLegend ) +/*N*/ { +/*N*/ switch (eLegendPos) +/*N*/ { +/*N*/ case CHLEGEND_LEFT: +/*?*/ eAdjust = CHADJUST_TOP_LEFT; +/*?*/ aChartRect.Left() += aRect.GetWidth() + nXOfs; +/*?*/ break; +/*?*/ +/*?*/ case CHLEGEND_TOP: +/*?*/ eAdjust = CHADJUST_TOP_LEFT; +/*?*/ aChartRect.Top() += aRect.GetHeight() + nYOfs; +/*?*/ break; +/*N*/ +/*N*/ case CHLEGEND_RIGHT: +/*N*/ eAdjust = CHADJUST_TOP_LEFT; +/*N*/ aChartRect.Right() -= aRect.GetWidth() + nXOfs; +/*N*/ break; +/*N*/ +/*?*/ case CHLEGEND_BOTTOM: +/*?*/ eAdjust = CHADJUST_TOP_LEFT; +/*?*/ aChartRect.Bottom() -= aRect.GetHeight() + nYOfs; +/*?*/ break; +/*N*/ } +/*N*/ } +/*N*/ // #96418# why shifting the legend nXOfs/nYOfs away from the +/*N*/ // edge, if it moved manually; it may well reach the edge in +/*N*/ // that case. So just check if it laps out of the edge. Apart +/*N*/ // from that the default position did not satisfy this condition +/*N*/ // and was therefore always shifted inside +/*N*/ if (aLegendPosition.X() + aRect.GetWidth() > rPageSize.Width()) +/*N*/ { +/*?*/ aLegendPosition.X() = rPageSize.Width() - aRect.GetWidth(); +/*N*/ } +/*N*/ if (aLegendPosition.Y() + aRect.GetHeight() > rPageSize.Height()) +/*N*/ { +/*?*/ aLegendPosition.Y() = rPageSize.Height() - aRect.GetHeight(); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ switch (eLegendPos) +/*N*/ { +/*N*/ case CHLEGEND_LEFT: +/*?*/ aLegendPosition.X() = rWholeRect.Left(); +/*?*/ aLegendPosition.Y() = rWholeRect.Top() + rWholeRect.GetHeight() / 2; +/*?*/ eAdjust = CHADJUST_CENTER_LEFT; +/*?*/ aChartRect.Left() += aRect.GetWidth() + nXOfs; +/*?*/ break; +/*?*/ +/*?*/ case CHLEGEND_TOP: +/*?*/ aLegendPosition.X() = rWholeRect.Left() + rWholeRect.GetWidth() / 2; +/*?*/ aLegendPosition.Y() = aChartRect.Top(); +/*?*/ eAdjust = CHADJUST_TOP_CENTER; +/*?*/ aChartRect.Top() += aRect.GetHeight() + nYOfs; +/*?*/ break; +/*N*/ +/*N*/ case CHLEGEND_RIGHT: +/*N*/ aLegendPosition.X() = rWholeRect.Right(); +/*N*/ aLegendPosition.Y() = rWholeRect.Top() + rWholeRect.GetHeight() / 2; +/*N*/ eAdjust = CHADJUST_CENTER_RIGHT; +/*N*/ aChartRect.Right() -= aRect.GetWidth() + nXOfs; +/*N*/ break; +/*N*/ +/*N*/ case CHLEGEND_BOTTOM: +/*?*/ aLegendPosition.X() = rWholeRect.Left() + rWholeRect.GetWidth() / 2; +/*?*/ aLegendPosition.Y() = rWholeRect.Bottom(); +/*?*/ eAdjust = CHADJUST_BOTTOM_CENTER; +/*?*/ aChartRect.Bottom() -= aRect.GetHeight() + nYOfs; +/*?*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // For 3D pie charts that whose position and size have not been altered +/*N*/ // manually, the calculated size in aChartRect is +/*N*/ // set to aDiagramRectangle after a possible adaption to half +/*N*/ // it's height. This adaption mimics the behaviour from BuildChart +/*N*/ // and takes place only if the diagram is not more than twice as wide +/*N*/ // as it is high. +/*N*/ if (IsPieChart() && IsReal3D() && ! GetDiagramHasBeenMovedOrResized()) +/*N*/ { +/*N*/ long nWidth=aChartRect.GetWidth(); +/*N*/ long nHeight=aChartRect.GetHeight(); +/*N*/ if( ((double)nHeight/(double)nWidth) > 0.5 ) +/*N*/ { +/*N*/ aChartRect.Top()+=nHeight/4; +/*N*/ aChartRect.Bottom()-=nHeight/4; +/*N*/ } +/*N*/ SetDiagramRectangle (aChartRect); +/*N*/ } +/*N*/ +/*N*/ aRect.SetPos(aLegendPosition); +/*N*/ AdjustRect(aRect, eAdjust); +/*N*/ pObj->NbcSetLogicRect(aRect); +/*N*/ pObj->SetResizeProtect(TRUE); +/*N*/ if (pObj->ISA(SchObjGroup)) +/*N*/ { +/*N*/ ((SchObjGroup *)pObj)->SetGroupType(SchObjGroup::LEGEND); +/*N*/ ((SchObjGroup *)pObj)->SetModel(this); +/*N*/ } +/*N*/ pPage->InsertObject(pObj, rIndex); +/*N*/ } +/*N*/ } +/*N*/ } + +//Übertragung der Page-Objekt-Attribute in die Modeleigenen AttrSets +/*N*/ void ChartModel::Rescue3DObjAttr(SdrObjList* pList)//#52277# +/*N*/ { +/*N*/ CHART_TRACE( "ChartModel::Rescue3DObjAttr" ); +/*N*/ if(pList) +/*N*/ { +/*N*/ SdrObject* pObj; +/*N*/ long nRow, nCol; +/*N*/ //-/ SfxItemSet aSet( *pItemPool, SID_ATTR_3D_START, SID_ATTR_3D_END ); +/*N*/ SfxItemSet aSet( *pItemPool, SDRATTR_3D_FIRST, SDRATTR_3D_LAST); +/*N*/ aSet.ClearItem(); +/*N*/ +/*N*/ SdrObjListIter aIterator( *pList, IM_DEEPWITHGROUPS ); +/*N*/ +/*N*/ while( aIterator.IsMore() ) +/*N*/ { +/*N*/ pObj = aIterator.Next(); +/*N*/ SchDataRow* pDataRow = GetDataRow( *pObj ); +/*N*/ SchDataPoint* pDataPoint = GetDataPoint( *pObj ); +/*N*/ if( pDataRow ) +/*N*/ { +/*N*/ nRow = pDataRow->GetRow(); +/*N*/ //-/ pObj->TakeAttributes( aSet, FALSE, TRUE ); +/*N*/ aSet.Put(pObj->GetItemSet()); +/*N*/ +/*N*/ aSet.ClearInvalidItems(); +/*N*/ aDataRowAttrList.GetObject( nRow )->Put( aSet ); +/*N*/ aSet.ClearItem(); +/*N*/ } +/*N*/ else if( pDataPoint ) +/*N*/ { +/*N*/ nCol = pDataPoint->GetCol(); +/*N*/ nRow = pDataPoint->GetRow(); +/*N*/ //-/ pObj->TakeAttributes( aSet, FALSE, TRUE ); +/*N*/ aSet.Put(pObj->GetItemSet()); +/*N*/ +/*N*/ aSet.ClearInvalidItems(); +/*N*/ PutDataPointAttr( nCol, nRow, aSet ); +/*N*/ aSet.ClearItem(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SchObjectId *pId = GetObjectId( *pObj ); +/*N*/ if( pId ) +/*N*/ { +/*N*/ long nId = pId->GetObjId(); +/*N*/ //-/ pObj->TakeAttributes( aSet, FALSE, TRUE ); +/*N*/ aSet.Put(pObj->GetItemSet()); +/*N*/ if( aSet.Count() ) +/*N*/ { +/*N*/ aSet.ClearInvalidItems(); +/*N*/ GetAttr( nId ).Put( aSet, TRUE ); +/*N*/ aSet.ClearItem(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), Loeschen aller Chartobjecte +|* +\************************************************************************/ +/*N*/ void ChartModel::DeleteChartObjects() +/*N*/ { +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ BOOL bResize = (aInitialSize != pPage->GetSize()); +/*N*/ +/*N*/ // FG: Bevor die Objekte geloescht und neu aufgebaut werden, merkt man sich deren +/*N*/ // Position. Da in InitalSize die urspruengliche Seitengroesse steht, kann +/*N*/ // man nun die relative Position auf der Seite bestimmen. +/*N*/ // Diese relative Position bleibt bei einem Resize erhalten, +/*N*/ // falls der Schalter "bUseRelativePositionsForChartGroups" auf TRUE steht. +/*N*/ +/*N*/ SdrObject* pGroupObject = GetObjWithId( CHOBJID_DIAGRAM_AREA, *pPage ); +/*N*/ if( pGroupObject != NULL ) +/*N*/ DeleteObject( pGroupObject ); +/*N*/ +/*N*/ pGroupObject = GetObjWithId( CHOBJID_TITLE_MAIN, *pPage ); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ aTitleTopCenter = pGroupObject->GetBoundRect().TopCenter(); +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ +/*N*/ pGroupObject = GetObjWithId(CHOBJID_TITLE_SUB, *pPage); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ aSubTitleTopCenter = pGroupObject->GetBoundRect().TopCenter(); +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ +/*N*/ pGroupObject = GetObjWithId(CHOBJID_DIAGRAM, *pPage); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ // FG: 11.3.97 Wenn die Grenzen des Objekts woanders gesetzt worden sind, duerfen sie hier +/*N*/ // nicht mehr gesetzt werden. +/*N*/ if (pGroupObject->ISA(SchObjGroup)) +/*N*/ { +/*N*/ if (GetDiagramHasBeenMovedOrResized() && +/*N*/ ((SchObjGroup *) pGroupObject)->GetAskForLogicRect()) +/*N*/ { +/*N*/ // FG: So leider nicht das Chart-Rect ist fehlerhafterweise nicht das Bounding-Rectangle +/*N*/ // aDiagramRectangle = pGroupObject->GetLogicRect(); +/*N*/ SetDiagramRectangle( GetChartRect() ); +/*N*/ } +/*N*/ } +/*N*/ else if (pGroupObject->ISA(ChartScene)) +/*N*/ { +/*N*/ if (GetDiagramHasBeenMovedOrResized() && +/*N*/ ((ChartScene *) pGroupObject)->GetAskForLogicRect()) +/*N*/ { +/*N*/ // FG: So leider nicht das Chart-Rect ist fehlerhafterweise nicht das Bounding-Rectangle +/*N*/ // aDiagramRectangle = pGroupObject->GetLogicRect(); +/*N*/ SetDiagramRectangle( GetChartRect() ); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if( pGroupObject == pScene ) +/*N*/ pScene = NULL; +/*N*/ } +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ +/*N*/ pGroupObject = GetObjWithId(CHOBJID_LEGEND, *pPage); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ // FG: 11.3.97 Wenn die Grenzen des Objekts woanders gesetzt worden sind, duerfen sie hier +/*N*/ // nicht mehr gesetzt werden. +/*N*/ if (GetLegendHasBeenMoved()&& +/*N*/ ((SchObjGroup *) pGroupObject)->GetAskForLogicRect() ) +/*N*/ // #107305# I don't see where aLegendTopLeft should have changed at +/*N*/ // another place, if not via resizing. Besides, why should it for +/*N*/ // the legend and not the titles? +/*N*/ // && ! bResize ) +/*N*/ { +/*N*/ aLegendTopLeft = pGroupObject->GetLogicRect().TopLeft(); +/*N*/ } +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ +/*N*/ pGroupObject = GetObjWithId(CHOBJID_DIAGRAM_TITLE_X_AXIS, *pPage); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ aTitleXAxisPosition = SetPointOfRectangle(pGroupObject->GetBoundRect(), eAdjustXAxesTitle); +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ +/*N*/ pGroupObject = GetObjWithId(CHOBJID_DIAGRAM_TITLE_Y_AXIS, *pPage); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ Rectangle Test1 = pGroupObject->GetBoundRect(); +/*N*/ Rectangle Test2 = pGroupObject->GetSnapRect(); +/*N*/ aTitleYAxisPosition = SetPointOfRectangle(pGroupObject->GetBoundRect(), eAdjustYAxesTitle); +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ +/*N*/ pGroupObject = GetObjWithId(CHOBJID_DIAGRAM_TITLE_Z_AXIS, *pPage); +/*N*/ if (pGroupObject != NULL) +/*N*/ { +/*N*/ aTitleZAxisPosition = SetPointOfRectangle(pGroupObject->GetBoundRect(), eAdjustXAxesTitle); +/*N*/ DeleteObject(pGroupObject); +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), Wertebereichueberpruefung mit MsgBox +|* +\************************************************************************/ +/*N*/ BOOL ChartModel::CheckRanges(BOOL bCheckAlways) +/*N*/ { +/*N*/ //ToDo:CHOBJID_DIAGRAM_B_AXIS +/*N*/ BOOL bOK=TRUE; +/*N*/ if ((eChartStyle != eOldChartStyle) || (bCheckAlways)) +/*N*/ { +/*N*/ if ((pChartYAxis->GetMin() < 0.0) && (pChartYAxis->GetMax() > 0.0) && (!IsSignedChart())) +/*N*/ { +/*?*/ // FG: Falls ein Pointer auf ein Fenster uebergeben wird ist die Dialogbox nicht-modal +/*?*/ // Nutzt man dies fuer Veraenderungen am Chart aus, stuertzt das Programm ab. +/*?*/ // InfoBox aInfoBox(SFX_APP()->GetAppWindow(), String(SchResId(STR_ONLY_ABS_VALUES))); +/*?*/ InfoBox aInfoBox(NULL, String(SchResId(STR_ONLY_ABS_VALUES))); +/*?*/ aInfoBox.Execute(); +/*?*/ eOldChartStyle = eChartStyle; +/*?*/ bOK=FALSE; +/*N*/ } +/*N*/ else if ((pChartYAxis->GetMin() < 0.0) && (!IsNegativeChart ())) +/*N*/ { +/*N*/ // FG: Falls ein Pointer auf ein Fenster uebergeben wird ist die Dialogbox nicht-modal +/*N*/ // Nutzt man dies fuer Veraenderungen am Chart aus, stuertzt das Programm ab. +/*N*/ // InfoBox aInfoBox(SFX_APP()->GetAppWindow(), String(SchResId(STR_NO_MIN_VALUES))); +/*?*/ InfoBox aInfoBox(NULL, String(SchResId(STR_NO_MIN_VALUES))); +/*?*/ aInfoBox.Execute(); +/*?*/ eOldChartStyle = eChartStyle; +/*?*/ bOK=FALSE; +/*N*/ } +/*N*/ } + /* + if (bCheckAlways) + if ((pChartYAxis->GetMin() <= 0.0) + && ((const SfxBoolItem&)GetAttr(CHOBJID_DIAGRAM_Y_AXIS).Get(SCHATTR_AXIS_LOGARITHM)).GetValue()) + { + // FG: Falls ein Pointer auf ein Fenster uebergeben wird ist die Dialogbox nicht-modal + // Nutzt man dies fuer Veraenderungen am Chart aus, stuertzt das Programm ab. + // InfoBox aInfoBox(SFX_APP()->GetAppWindow(), String(SchResId(STR_NO_LOGARITHMIC_MIN_VALUES))); + InfoBox aInfoBox(NULL, String(SchResId(STR_NO_LOGARITHMIC_MIN_VALUES))); + aInfoBox.Execute(); + eOldChartStyle = eChartStyle; + bOK=FALSE; + } +*/ +/*N*/ return bOK; +/*N*/ } +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), Chart-ReSizing +|* +\************************************************************************/ +/*N*/ void ChartModel::ResizeChart(const Size& rPageSize) +/*N*/ { +/*N*/ if (GetUseRelativePositions() && GetDiagramHasBeenMovedOrResized()) +/*N*/ { +/*N*/ if ((rPageSize.Width() == aInitialSize.Width()) && (rPageSize.Height() == aInitialSize.Height())) +/*N*/ { // FG: Es war also ein Resize nur des Diagramms (also nur der Grafik und nicht der Seite) +/*N*/ aChartRect= aDiagramRectangle; +/*N*/ } +/*N*/ else // FG: 11.3.97 Dann war es ein Resize des gesamten Charts +/*N*/ { + // The whole chart has been resized. + // The old size aDiagramRectangle of the diagram has to fullfill the constraint + // the it has to have a positive extent both in the horizontal and the vertical + // direction. + // + // Previously (before 24.07.2001) the constraints to fullfill have been tighter: + // All four border lines had to lie inside the chart rectangle. + // If the new solution, that solves error #88404# proves to work, then remove this + // paragraph and the commented code below. +/*N*/ if ( (aDiagramRectangle.nLeft < aDiagramRectangle.nRight) +/*N*/ && (aDiagramRectangle.nTop < aDiagramRectangle.nBottom) ) +// if ((aDiagramRectangle.nLeft >= 0) && (aDiagramRectangle.nTop >= 0) && +// (aDiagramRectangle.nRight >= 0) && (aDiagramRectangle.nBottom >= 0)) +/*N*/ { +/*?*/ double fRelativeXPosition = ((double) aDiagramRectangle.Left()) / aInitialSize.Width(); +/*?*/ double fRelativeYPosition = ((double) aDiagramRectangle.Top()) / aInitialSize.Height(); +// if ((fRelativeXPosition <= 1.0) && (fRelativeYPosition <= 1.0)) +// { +/*?*/ aChartRect.nLeft = (long)((double)rPageSize.Width() * fRelativeXPosition ); +/*?*/ aChartRect.nTop = (long)((double)rPageSize.Height() * fRelativeYPosition ); +// } +/*?*/ fRelativeXPosition = ((double) aDiagramRectangle.Right()) / aInitialSize.Width(); +/*?*/ fRelativeYPosition = ((double) aDiagramRectangle.Bottom()) / aInitialSize.Height(); +// if ((fRelativeXPosition <= 1.0) && (fRelativeYPosition <= 1.0)) +// { +/*?*/ aChartRect.nRight = (long)((double)rPageSize.Width() * fRelativeXPosition ); +/*?*/ aChartRect.nBottom = (long)((double)rPageSize.Height() * fRelativeYPosition ); +// } +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ } +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), +|* +|* FG: Hier wird der Platz berechnet, den man als oberen Rand freilassen +|* soll,falls keine Titel dargestellt werden. +|* +\************************************************************************/ +/*N*/ void ChartModel::CalculateUpperBorder() +/*N*/ { +/*N*/ if ((!bShowMainTitle && !bShowSubTitle)) +/*N*/ { +/*N*/ BOOL bSwitchColRow = eChartStyle == CHSTYLE_2D_BAR || +/*N*/ eChartStyle == CHSTYLE_2D_STACKEDBAR || +/*N*/ eChartStyle == CHSTYLE_2D_PERCENTBAR || +/*N*/ eChartStyle == CHSTYLE_3D_BAR || +/*N*/ eChartStyle == CHSTYLE_3D_FLATBAR || +/*N*/ eChartStyle == CHSTYLE_3D_STACKEDFLATBAR || +/*N*/ eChartStyle == CHSTYLE_3D_PERCENTFLATBAR; +/*N*/ +/*N*/ SfxItemSet aTextAttr((const SfxItemSet &)GetAttr( +/*N*/ bSwitchColRow ? +/*N*/ CHOBJID_DIAGRAM_X_AXIS +/*N*/ : CHOBJID_DIAGRAM_Y_AXIS)); +/*N*/ +/*N*/ Size aTextSize (((SvxFontWidthItem &) aTextAttr.Get (EE_CHAR_FONTWIDTH)).GetWidth (), +/*N*/ ((SvxFontHeightItem &) aTextAttr.Get (EE_CHAR_FONTHEIGHT)).GetHeight ()); +/*N*/ +/*N*/ aChartRect.Top () += aTextSize.Height () / 2; +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Sub-Methode von BuildChart(), Chart-ReSizing +|* +\************************************************************************/ +/*N*/ void ChartModel::CreateRectsAndTitles(long whatTitle) +/*N*/ { +/*N*/ // FG: Abhaengig von der Groesse der Page, also der Ausgabe +/*N*/ // werden die Raender erst mal auf 2% der jeweiligen Richtungsausdehnung gesetzt +/*N*/ // abgespeichert wird das im ChartModel. Sollte ein Text uber den den linken +/*N*/ // Rand zu weit hinausragen, also linker Rand OuterRect(SdrTextObj) < 0, +/*N*/ // So wird entweder der Offset neu berechnet oder der Text veraendert. +/*N*/ // Im Moment ist es nur moeglich den linken Rand nachzuregeln. +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ const Size& rPageSize=pPage->GetSize(); +/*N*/ +/*N*/ long nYOfs = (rPageSize.Height() / 100) * 2; +/*N*/ long nXOfs = (rPageSize.Width() /100) * 2; +/*N*/ USHORT nIndex = 0; +/*N*/ +/*N*/ // #97159# the chart rect was set one unit too large in either direction +/*N*/ aChartRect.SetPos( Point( 0, 0 ) ); +/*N*/ aChartRect.SetSize( rPageSize ); +/*N*/ +/*N*/ SchRectObj* pRect = new SchRectObj(aChartRect); +/*N*/ pRect->SetModel( this ); +/*N*/ pPage->InsertObject(SetObjectAttr( pRect, CHOBJID_DIAGRAM_AREA, +/*N*/ FALSE, TRUE, pDiagramAreaAttr), nIndex++); +/*N*/ +/*N*/ aChartRect.Left() += nXOfs; // FG: Dies ist das Rechteck in das das Chart (also die Balken ...) +/*N*/ aChartRect.Top() += nYOfs; // rein muss. Erst ist es maximal gross und dann wird immer +/*N*/ aChartRect.Right() -= nXOfs; // mehr abgezwackt. +/*N*/ aChartRect.Bottom() -= nYOfs; +/*N*/ +/*N*/ Rectangle aWholeRect (aChartRect); +/*N*/ +/*N*/ // Falls aInitialSize Null ist dann wird es auf die Seitengroesse gesetzt +/*N*/ if( !aInitialSize.Width ()) aInitialSize.Width () = rPageSize.Width (); +/*N*/ if( !aInitialSize.Height ()) aInitialSize.Height () = rPageSize.Height (); +/*N*/ +/*N*/ // FG: Dieser Offset wird bei der Legende und den Diagrammtiteln gebraucht. +/*N*/ // Er wird aus aesthetischen Gruenden verdoppelt. +/*N*/ // Also ab jetzt oberer Rand nYOfs + Titel + 2*nYOfs + Unteritel + 2*nYOfs + Diagramm +/*N*/ // Fuer die Legende gilt das fuer den X-Abstand. +/*N*/ nXOfs *= 2; nYOfs *=2; +/*N*/ +/*N*/ if (bTextScalable) +/*N*/ ScaleText(whatTitle,rPageSize); +/*N*/ +/*N*/ if (bShowMainTitle) +/*N*/ DoShowMainTitle(nIndex,nYOfs); +/*N*/ +/*N*/ if (bShowSubTitle) +/*N*/ DoShowSubTitle(nIndex,nYOfs); +/*N*/ +/*N*/ CalculateUpperBorder(); +/*N*/ DoShowLegend(aWholeRect,nXOfs,nYOfs,nIndex); +/*N*/ ResizeChart(rPageSize); +/*N*/ } +/************************************************************************* +|* +|* gesamte Grafik erzeugen +|* +\************************************************************************/ + +namespace +{ +class lcl_MapModeResetGuard +{ +public: + lcl_MapModeResetGuard( OutputDevice * pOutDev ) : + m_pOutDev( pOutDev ), + m_aMapMode( pOutDev ? pOutDev->GetMapMode() : MapMode() ) + {} + + ~lcl_MapModeResetGuard() + { + if( m_pOutDev ) + m_pOutDev->SetMapMode( m_aMapMode ); + } + +private: + OutputDevice * m_pOutDev; + MapMode m_aMapMode; +}; + +} + +/*N*/ void ChartModel::BuildChart(BOOL bCheckRanges,long whatTitle) +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR (context, "sch", "af119097", "::ChartModel::BuildChart"); +/*N*/ +/*N*/ #ifdef DBG_UTIL +/*N*/ ByteString aBStr( aMainTitle, RTL_TEXTENCODING_ASCII_US ); +/*N*/ CHART_TRACE1( "ChartModel::BuildChart (%s)", aBStr.GetBuffer()); +/*N*/ #endif +/*N*/ +/*N*/ //kein setzen der p*Attr durch die Objekte +/*N*/ SetAttrAutoStorage(FALSE); +/*N*/ +/*N*/ if (bNoBuildChart) +/*N*/ { +/*N*/ bShouldBuildChart = TRUE; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR (context2, +/*N*/ "sch", "af119097", "::ChartModel::BuildChart not locked"); +/*N*/ //nicht ganz so schön, aber vorteilhaft. Hiermit wird ein Itemset mit +/*N*/ //Attributen gefüllt, die beim Einfügen etc. als default benutzt werden +/*N*/ //(SetDefAttrRow). Da an dieser Stelle ein Defaultset erstellt wird, sind +/*N*/ //auch Chart-globale Items gleich gesetzt (Shape3D, Fehlerbalken,Datenbeschriftung) +/*N*/ //lediglich die Linien oder Flächenfarbe muss generiert werden! +/*N*/ //Alternative: nur in ChangeChart defaults erstellen +/*N*/ if( pChartData ) +/*N*/ { +/*N*/ // in scatter charts the first series is for x values +/*N*/ // so use first 'y-series' to copy attributes to new series +/*N*/ if( IsXYChart()) +/*N*/ { +/*N*/ if( GetRowCount() > 1 ) +/*N*/ pDummyAttr->Put( GetDataRowAttr( 1 )); +/*N*/ } +/*N*/ else +/*N*/ if( GetRowCount() > 0 ) +/*N*/ pDummyAttr->Put( GetDataRowAttr( 0 )); +/*N*/ } +/*N*/ +/*N*/ //Hotfix für OLE-Charts #54884# Die Wurzel des Übels liegt möglicherweise irgendwo anders! +/*N*/ if(!pRefOutDev) +/*N*/ { +/*?*/ if(pChartRefOutDev) +/*?*/ { +/*?*/ DBG_ERROR("ChartModel::BuildChart: restoring lost pRefOutDev... something strange happend!"); +/*?*/ SetRefDevice(pChartRefOutDev); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ CHART_TRACE( "ChartModel::BuildChart no pRefOutDev!" ); +/*?*/ if( pDocShell ) +/*?*/ { +/*?*/ // this is a valid upcast, because we 'know' that the +/*?*/ // pDocShell member is always a SchChartDocShell +/*?*/ OutputDevice * pOutDev = static_cast< SchChartDocShell * >( pDocShell )->GetRefDevice(); +/*?*/ SetRefDevice( pOutDev ); +/*?*/ GetOutliner()->SetRefDevice( pOutDev ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ OutputDevice* pOut = Application::GetDefaultDevice(); +/*?*/ // this is no error: if a ChartModel is copied via clipboard there is no docshell +/*?*/ // DBG_ERROR("ChartModel::BuildChart : no Docshell! (OutputDevice)"); +/*?*/ pChartRefOutDev = new VirtualDevice( *pOut ); +/*?*/ MapMode aMapMode = pChartRefOutDev->GetMapMode(); +/*?*/ aMapMode.SetMapUnit(MAP_100TH_MM); +/*?*/ pChartRefOutDev->SetMapMode(aMapMode); +/*?*/ SetRefDevice(pChartRefOutDev); +/*?*/ GetOutliner()->SetRefDevice(pChartRefOutDev); +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ CheckRanges(bCheckRanges); +/*N*/ +/*N*/ if( !pChartData ) // create default chart if no chart exists so far +/*N*/ InitChartData(); +/*N*/ +/*N*/ if (GetColCount() && GetRowCount()) +/*N*/ { +/*N*/ SdrPage* pPage = GetPage(0); +/*N*/ if (pPage) +/*N*/ { +/*N*/ //#61431# MapMode speichern, am Ende BuildCharts restaurieren +/*N*/ +/*N*/ // remember the MapMode of the Printer and restore it at the end +/*N*/ // of the current block, because it may be changed later in this +/*N*/ // method (AdjustPrinter) +/*N*/ lcl_MapModeResetGuard aPrinterMapModeGuard( +/*N*/ static_cast< SchChartDocShell * >( GetObjectShell() )->GetPrinter() ); +/*N*/ +/*N*/ AdjustPrinter(); +/*N*/ +/*N*/ // FG : DAs hier braucht es weil bei 3D-Charts der Bildchsimraufbau von der ChartScene +/*N*/ // erst beim ersten Paint initiiert wird. Erst dann werden die Achsentitel ausgegeben +/*N*/ // da ist aber BuildChart, aInitialSize=aPageSize setzt schon gelaufen. Deshalb diese +/*N*/ // "Chart-Globale" Variable; +/*N*/ aInitialSizefor3d = aInitialSize; +/*N*/ +/*N*/ // ItemSet mit entspr. Bereich anlegen +/*N*/ //-/ SfxItemSet aSet( GetItemPool(), SID_ATTR_3D_RANGE_SCENE, 0); +/*N*/ SfxItemSet aSet( GetItemPool(), +/*N*/ SDRATTR_3DSCENE_FIRST, SDRATTR_3DSCENE_LAST); +/*N*/ BOOL bItemSetUsed = FALSE; +/*N*/ +/*N*/ if( pScene ) +/*N*/ { +/*N*/ //-/ pScene->TakeAttributes(aSet, TRUE, TRUE); +/*N*/ aSet.Put(pScene->GetItemSet()); +/*N*/ bItemSetUsed = TRUE; +/*N*/ aSceneMatrix = pScene->GetTransform(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SdrObject* pLoadedScene = GetObjWithId(CHOBJID_DIAGRAM, *pPage); +/*N*/ if (pLoadedScene && pLoadedScene->ISA(E3dPolyScene)) +/*N*/ { +/*N*/ //-/ ((E3dObject*)pLoadedScene)->SetAttrUseSubObjects(FALSE); +/*N*/ //-/ pLoadedScene->TakeAttributes(aSet, TRUE, TRUE); +/*N*/ aSet.Put(pLoadedScene->GetItemSet()); +/*N*/ bItemSetUsed = TRUE; +/*N*/ aSceneMatrix = ((E3dPolyScene*) pLoadedScene)->GetTransform(); +/*N*/ Rescue3DObjAttr(pLoadedScene->GetSubList()); //#52277# +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ DeleteChartObjects(); +/*N*/ Size aPageSize = pPage->GetSize(); +/*N*/ +/*N*/ SdrObjGroup *pObj = NULL; +/*N*/ BOOL bNeedSetDiagram=FALSE; +/*N*/ +/*N*/ // if type addin is set the core CreateChart shoudln't be called +/*N*/ // if an addin is used together with a base diagram type the base +/*N*/ // type should be set as chart type here (!= CHSTYLE_ADDIN) +/*N*/ if( eChartStyle != CHSTYLE_ADDIN ) +/*N*/ { +/*N*/ // core CreateChart +/*N*/ CreateRectsAndTitles(whatTitle); +/*N*/ +/*N*/ if(bResizePie && IsPieChart() && IsReal3D()) +/*N*/ { +/*N*/ long nWidth=aChartRect.GetWidth(); +/*N*/ long nHeight=aChartRect.GetHeight(); +/*N*/ if( ((double)nHeight/(double)nWidth) > 0.5 ) +/*N*/ { +/*?*/ bNeedSetDiagram=TRUE; +/*?*/ aChartRect.Top()+=nHeight/4; +/*?*/ aChartRect.Bottom()-=nHeight/4; +/*?*/ SetDiagramHasBeenMovedOrResized(TRUE); +/*?*/ SetUseRelativePositions(TRUE); +/*?*/ bResizePie=FALSE; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pObj = CreateChart(aChartRect); +/*N*/ +/*N*/ if (pObj->ISA(SchObjGroup)) +/*N*/ { +/*N*/ ((SchObjGroup *)pObj)->SetModel(this); +/*N*/ ((SchObjGroup *)pObj)->SetGroupIsChart(); +/*N*/ } +/*N*/ +/*N*/ pPage->NbcInsertObject(pObj, 1); +/*N*/ +/*N*/ } +/*N*/ +/*N*/ // ==================== +/*N*/ // call AddIn if required +/*N*/ // ==================== +/*N*/ if( mbIsInitialized && +/*N*/ mxChartAddIn.is()) +/*N*/ { +/*?*/ // avoid recursion +/*?*/ if( ! GetChartStatusFlag( CHS_NO_ADDIN_REFRESH )) +/*?*/ { +/*?*/ SetChartStatusFlag( CHS_NO_ADDIN_REFRESH ); +/*?*/ try +/*?*/ { +/*?*/ mxChartAddIn->refresh(); +/*?*/ } +/*?*/ catch( ::com::sun::star::uno::Exception aEx ) +/*?*/ { +/*?*/ #ifdef DBG_UTIL +/*?*/ // convert ::rtl::OUString => tools String => ByteString +/*?*/ String aStr( aEx.Message ); +/*?*/ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); +/*?*/ DBG_ERROR1( "AddIn threw exception during refresh(): %s", aBStr.GetBuffer()); +/*?*/ #endif +/*?*/ } +/*?*/ ResetChartStatusFlag( CHS_NO_ADDIN_REFRESH ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ aInitialSize = aPageSize; +/*N*/ +/*N*/ if(pScene && IsReal3D() ) +/*N*/ { +/*N*/ +/*N*/ #ifndef NO_56798_FIX //#56798# QuickFix 5.0-Final +/*N*/ +/*N*/ if(bClearDepth) +/*N*/ { +/*N*/ //-/ aSet.ClearItem(SID_ATTR_3D_DEPTH); +/*N*/ aSet.ClearItem(SDRATTR_3DOBJ_DEPTH); +/*N*/ bClearDepth=FALSE; +/*N*/ } +/*N*/ #endif +/*N*/ +/*N*/ //-/ aSet.ClearItem(SID_ATTR_3D_DOUBLE_SIDED); //#56941# +/*N*/ //-/ aSet.ClearItem(SID_ATTR_3D_HORZ_SEGS); +/*?*/ aSet.ClearItem(SDRATTR_3DOBJ_DOUBLE_SIDED); //#56941# +/*?*/ aSet.ClearItem(SDRATTR_3DOBJ_HORZ_SEGS); +/*N*/ +/*N*/ if(bItemSetUsed) +/*N*/ { +/*N*/ //funktioniert nur, wenn nicht durch vorherigen Aufruf (CheckRanges) eine MsgBox entstand +/*N*/ if(eChartStyle != eOldChartStyle) +/*N*/ { +/*N*/ // Falls sich der ChartStyle aendert, die Extrude-Tiefe +/*N*/ // auf unfueltig setzen +/*N*/ const SfxPoolItem* pPoolItem = NULL; +/*N*/ //-/ SfxItemState eState = aSet.GetItemState(SID_ATTR_3D_DEPTH, FALSE, &pPoolItem); +/*N*/ SfxItemState eState = aSet.GetItemState(SDRATTR_3DOBJ_DEPTH, FALSE, &pPoolItem); +/*N*/ if(eState == SFX_ITEM_SET) +/*N*/ { +/*N*/ // Ist gesetzt, invalidiere +/*N*/ //-/ aSet.InvalidateItem(SID_ATTR_3D_DEPTH); +/*N*/ aSet.InvalidateItem(SDRATTR_3DOBJ_DEPTH); +/*N*/ CHART_TRACE( "Chart: Invalidating saveable item ..." ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Attribute an neuer Szene setzen +/*N*/ +/*N*/ //-/ pScene->NbcSetAttributes(aSet, TRUE); +/*N*/ pScene->SetItemSet(aSet); +/*N*/ +/*N*/ } +/*N*/ +/*N*/ pScene->NbcSetTransform(aSceneMatrix); +/*N*/ +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ if(!IsPieChart()) +/*N*/ { +/*N*/ if(pChartXAxis->HasDescription()) +/*N*/ { +/*N*/ if(GetAttr(CHOBJID_DIAGRAM_X_AXIS).GetItemState( SCHATTR_TEXT_OVERLAP, FALSE, &pPoolItem ) >= SFX_ITEM_AVAILABLE ) +/*N*/ { +/*N*/ if(!( (const SfxBoolItem*) pPoolItem)->GetValue()) +/*N*/ pScene->ReduceDescrList(aXDescrList); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(pChartYAxis->HasDescription()) +/*N*/ { +/*N*/ if(GetAttr(CHOBJID_DIAGRAM_Y_AXIS).GetItemState( SCHATTR_TEXT_OVERLAP, FALSE, &pPoolItem ) >= SFX_ITEM_AVAILABLE ) +/*N*/ { +/*N*/ if(!( (const SfxBoolItem*) pPoolItem)->GetValue()) +/*N*/ pScene->ReduceDescrList(aYDescrList); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(pChartZAxis->HasDescription()) +/*N*/ { +/*N*/ if(GetAttr(CHOBJID_DIAGRAM_Z_AXIS).GetItemState( SCHATTR_TEXT_OVERLAP, FALSE, &pPoolItem ) >= SFX_ITEM_AVAILABLE ) +/*N*/ { +/*N*/ if(!( (const SfxBoolItem*) pPoolItem)->GetValue()) +/*N*/ pScene->ReduceDescrList(aZDescrList); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if(bNeedSetDiagram && pScene) +/*N*/ { +/*?*/ Rectangle aRectangle; +/*?*/ aRectangle = pScene->GetSnapRect(); +/*?*/ ((ChartScene *)pObj)->SetAskForLogicRect(FALSE); +/*?*/ SetDiagramRectangle(aRectangle); +/*?*/ SetDiagramHasBeenMovedOrResized(TRUE); +/*N*/ } +/*N*/ +/*N*/ //#61431# MapMode speichern, am Ende BuildCharts restaurieren +/*N*/ +/*N*/ // the MapMode of the RefDevice is restored by the +/*N*/ // lcl_MapModeResetGuard +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ //Jetzt sollen sich die Objekte wieder drum kümmern, da?das Model die Attribute erhält +/*N*/ SetAttrAutoStorage(TRUE); +/*N*/ SetDiagramRectangle( aChartRect ); +/*N*/ eOldChartStyle = eChartStyle; +/*N*/ +/*N*/ // notify build to listeners +/*N*/ Broadcast( SchReBuildHint()); +/*N*/ } + + + +/*N*/ void ChartModel::SetUseRelativePositions (BOOL value) +/*N*/ { +/*N*/ if (value == FALSE) +/*N*/ { +/*N*/ SetDiagramHasBeenMovedOrResized(FALSE); +/*N*/ SetMainTitleHasBeenMoved(FALSE); +/*N*/ SetSubTitleHasBeenMoved(FALSE); +/*N*/ SetLegendHasBeenMoved(FALSE); +/*N*/ SetXAxisTitleHasBeenMoved(FALSE); +/*N*/ SetYAxisTitleHasBeenMoved(FALSE); +/*N*/ SetZAxisTitleHasBeenMoved(FALSE); +/*N*/ if((IsReal3D() && IsPieChart())) +/*N*/ { +/*?*/ Matrix4D aMatrix; //Reset der Matrix.... könnte man auch grundsätzlich machen? +/*?*/ aMatrix.RotateX(-F_PI/3); +/*?*/ aSceneMatrix=aMatrix; +/*?*/ if(pScene) +/*?*/ pScene->NbcSetTransform(aSceneMatrix); +/*?*/ bResizePie=TRUE; +/*N*/ } +/*N*/ } +/*N*/ bUseRelativePositionsForChartGroups = value; +/*N*/ } + +/************************************************************************* +|* +|* bestimme Mittelwert +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* erzeuge mittelwertlinie +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* bestimme Varianz +|* +\************************************************************************/ + + +/*N*/ double ChartModel::GetVariantY (long nRow) +/*N*/ { +/*N*/ long nColCnt = GetColCount(); +/*N*/ +/*N*/ if (nColCnt) +/*N*/ { +/*N*/ double fSum = 0.0; +/*N*/ double fQuadSum = 0.0; +/*N*/ long nValidCols = nColCnt; +/*N*/ +/*N*/ for (long nCol = 0; +/*N*/ nCol < nColCnt; +/*N*/ nCol ++) +/*N*/ { +/*N*/ double fData = GetData ((short) nCol, (short) nRow, FALSE); +/*N*/ +/*N*/ if( fData == DBL_MIN ) +/*N*/ { +/*N*/ nValidCols--; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ fSum += fData; +/*N*/ fQuadSum += fData * fData; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return nValidCols? (fQuadSum - fSum*fSum / (double)nValidCols) / (double)nValidCols: DBL_MIN; +/*N*/ } +/*N*/ else return 0; +/*N*/ } + +/************************************************************************* +|* +|* bestimme Varianz +|* +\************************************************************************/ + + +/*N*/ double ChartModel::GetSigmaY (long nRow) +/*N*/ { +/*N*/ return sqrt (GetVariantY (nRow)); +/*N*/ } + +/************************************************************************* +|* +|* bestimme Fehler des groessten Wertes +|* +\************************************************************************/ + + +/*N*/ double ChartModel::GetBigErrorY (long nRow, +/*N*/ double fError) +/*N*/ { +/*N*/ double fMax = 0.0; +/*N*/ long nColCnt = GetColCount(); +/*N*/ +/*N*/ for (long nCol = 0; +/*N*/ nCol < nColCnt; +/*N*/ nCol ++) +/*N*/ { +/*N*/ double fData = GetData ((short) nCol, (short) nRow, FALSE); +/*N*/ +/*N*/ if (fData != DBL_MIN) +/*N*/ if (fData > fMax) fMax = fData; +/*N*/ } +/*N*/ +/*N*/ return fMax * fError / 100.0; +/*N*/ } + +/************************************************************************* +|* +|* bestimme lineare regression +|* +\************************************************************************/ + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode5.cxx b/binfilter/bf_sch/source/core/sch_chtmode5.cxx new file mode 100644 index 000000000000..745449037b33 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode5.cxx @@ -0,0 +1,408 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include <bf_svx/svdorect.hxx> + +#include "schattr.hxx" +#include "memchrt.hxx" + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT + + +#endif + +#ifndef _CHTMODEL_HXX +#endif +#include <bf_svx/svxids.hrc> +#include <math.h> +#include <float.h> +#include "glob.hrc" + +#include "globfunc.hxx" +#include "pairs.hxx" + +#ifndef _ZFORLIST_HXX +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif +namespace binfilter { + + +/************************************************************************* +|* +|* Chart-Objekt ermitteln; +|* Es koennen nur Objekte ermittelt werden, von denen es jeweils +|* EIN Exemplar gibt. +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Chartdaten auslesen //Angepasst an Umsortierunng +|* +\************************************************************************/ + +/*N*/ double ChartModel::GetData(long nCol,long nRow,BOOL bPercent,BOOL bRowData) const +/*N*/ { +/*N*/ double fData = IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? pChartData->GetTransData(nRow, nCol) +/*N*/ : pChartData->GetTransData(nCol, nRow); +/*N*/ +/*N*/ if ((fData == DBL_MIN) || !bPercent) return fData; +/*N*/ else +/*N*/ { +/*N*/ return IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? pChartData->GetTransDataInPercent(nRow,nCol,!bRowData) +/*N*/ : pChartData->GetTransDataInPercent(nCol,nRow,bRowData); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Datenpunkt-Objekt ermitteln +|* +\************************************************************************/ + +/*N*/ SdrObject* ChartModel::GetDataPointObj(long nCol, long nRow) +/*N*/ { +/*?*/ SdrPage* pPage = GetPage(0); +/*?*/ DBG_ASSERT(pPage, "ChartModel::GetDataPointObj:Keine Seite vorhanden!"); +/*?*/ +/*?*/ SdrObjGroup* pDiagram = +/*?*/ (SdrObjGroup*)GetObjWithId(CHOBJID_DIAGRAM, *pPage); +/*?*/ DBG_ASSERT(pDiagram, "ChartModel::GetDataPointObj:Kein Diagramm-Objekt vorhanden!"); +/*?*/ +/*?*/ SdrObject* pObj = +/*?*/ GetObjWithColRow(nCol, nRow, *pDiagram->GetSubList()); +/*?*/ +/*?*/ if (!pObj) +/*?*/ { +/*?*/ SdrObjGroup* pDataRow = +/*?*/ (SdrObjGroup*)GetObjWithRow(nRow, *pDiagram->GetSubList()); +/*?*/ +/*?*/ if(pDataRow) +/*?*/ pObj = GetObjWithColRow(nCol, nRow, *pDataRow->GetSubList()); +/*?*/ else +/*?*/ DBG_TRACE("ChartModel::GetDataPointObj:Datenreihen-Objekt nicht gefunden!"); +/*?*/ } +/*?*/ +/*?*/ return pObj; +/*N*/ } +/************************************************************************* +|* +|* für SP2 #66110# bzw. #61907# +|* +\************************************************************************/ +/*N*/ void ChartModel::SetChartDataBuffered(SchMemChart& rData, BOOL bNewTitles) +/*N*/ { +/*N*/ if( pChartDataBuffered ) +/*N*/ delete pChartDataBuffered; +/*N*/ +/*N*/ pChartDataBuffered = NULL; +/*N*/ +/*N*/ SetChartData(*new SchMemChart(rData), bNewTitles); +/*N*/ BuildChart (TRUE); +/*N*/ } + + + +/************************************************************************* +|* +|* neue Chart-Datenstruktur setzen; bisherige wird ggf. geloescht +|* +\************************************************************************/ + +/*N*/ void ChartModel::SetChartData(SchMemChart& rData, BOOL bNewTitles) +/*N*/ { +/*N*/ if (pChartData != &rData) +/*N*/ { +/*N*/ BOOL bWasData; +/*N*/ long nOldRowCount = 0; +/*N*/ long nOldColumnCount = 0; +/*N*/ +/*N*/ if (pChartData) +/*N*/ { +/*N*/ nOldRowCount = pChartData->GetRowCount(); +/*N*/ nOldColumnCount = pChartData->GetColCount(); +/*N*/ if(pChartData->DecreaseRefCount()) +/*N*/ delete pChartData; +/*N*/ +/*N*/ bWasData = TRUE; +/*N*/ } +/*N*/ else +/*N*/ bWasData = FALSE; +/*N*/ +/*N*/ pChartData = &rData; +/*N*/ pChartData->IncreaseRefCount(); +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ +/*N*/ // #102853# the adaption of min/max should be (and is) handled by the +/*N*/ // axis themselves. (It should at least check, if the min/max values +/*N*/ // are 'auto') +/*N*/ +/*N*/ // for (long nCol = 0; nCol < nColCnt; nCol++) +/*N*/ // { +/*N*/ // for (long nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ // { +/*N*/ // double fData = GetData(nCol, nRow); +/*N*/ +/*N*/ // if ((nCol == 0) && (nRow == 0)) +/*N*/ // { +/*N*/ //ToDo: wozu das hier? klären! +/*N*/ // pChartYAxis->SetMin(fData); +/*N*/ // pChartYAxis->SetMax(fData); +/*N*/ // } +/*N*/ +/*N*/ // if (fData < pChartYAxis->GetMin()) +/*N*/ // pChartYAxis->SetMin(fData); +/*N*/ // if (fData > pChartYAxis->GetMax()) +/*N*/ // pChartYAxis->SetMax(fData); +/*N*/ // } +/*N*/ // } +/*N*/ +/*N*/ if (!bWasData || bNewTitles) +/*N*/ { +/*N*/ aMainTitle = pChartData->GetMainTitle(); +/*N*/ aSubTitle = pChartData->GetSubTitle(); +/*N*/ aXAxisTitle = pChartData->GetXAxisTitle(); +/*N*/ aYAxisTitle = pChartData->GetYAxisTitle(); +/*N*/ aZAxisTitle = pChartData->GetZAxisTitle(); +/*N*/ } +/*N*/ +/*N*/ InitDataAttrs(); +/*N*/ +/*N*/ if( rData.GetNumberFormatter() ) +/*N*/ { +/*N*/ SvNumberFormatter* pNewFormatter = rData.GetNumberFormatter(); +/*N*/ if( pNewFormatter != pNumFormatter ) +/*N*/ { +/*N*/ // merge numberformatters: +/*N*/ // merge old one to new one and set new one as member +/*N*/ if( pNewFormatter && pNumFormatter ) +/*N*/ { +/*N*/ SvNumberFormatterIndexTable* pTransTable = +/*N*/ pNewFormatter->MergeFormatter( *pNumFormatter ); +/*N*/ +/*N*/ SetNumberFormatter( pNewFormatter ); +/*N*/ +/*N*/ if( pTransTable && pTransTable->Count() ) +/*N*/ { +/*N*/ TranslateAllNumFormatIds( pTransTable ); +/*N*/ } +/*N*/ } +/*N*/ else if( pNewFormatter ) +/*N*/ { +/*?*/ SetNumberFormatter( pNewFormatter ); +/*N*/ } +/*N*/ } +/*N*/ CheckForNewAxisNumFormat(); +/*N*/ } +/*N*/ +/*N*/ if( (nOldRowCount != nRowCnt) || +/*N*/ (nOldColumnCount != nColCnt )) +/*N*/ { +/*N*/ DataRangeChanged( nOldRowCount, nOldColumnCount ); +/*N*/ } +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* Erstelle Diagrammtitel +|* +\************************************************************************/ + +/*N*/ SdrTextObj *ChartModel::CreateTitle (SfxItemSet *pTitleAttr, +/*N*/ short nID, +/*N*/ BOOL bSwitchColRow, +/*N*/ const String &rText, +/*N*/ BOOL bVert, +/*N*/ ChartAdjust *pTextDirection) +/*N*/ { +/*N*/ DBG_ASSERT (pTextDirection, "ChartModel::CreateTitle:Titel-Erzeugung ohne Text-Ausrichtungsinformation"); +/*N*/ if (pTextDirection == NULL) return NULL; //FG: sonst Absturz +/*N*/ +/*N*/ SfxItemSet aTextAttr(*pItemPool, nTitleWhichPairs); +/*N*/ SvxChartTextOrient eOrient = ((const SvxChartTextOrientItem&)pTitleAttr->Get(SCHATTR_TEXT_ORIENT)).GetValue(); +/*N*/ +/*N*/ if (bVert) +/*N*/ { +/*N*/ if (bSwitchColRow) +/*N*/ { +/*N*/ *pTextDirection = CHADJUST_BOTTOM_CENTER; +/*N*/ if (eOrient == CHTXTORIENT_AUTOMATIC) eOrient = CHTXTORIENT_STANDARD; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ *pTextDirection= CHADJUST_CENTER_LEFT; +/*N*/ if (eOrient == CHTXTORIENT_AUTOMATIC) eOrient = CHTXTORIENT_BOTTOMTOP; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ *pTextDirection = bSwitchColRow ? CHADJUST_CENTER_LEFT : CHADJUST_BOTTOM_CENTER; +/*N*/ if (eOrient == CHTXTORIENT_AUTOMATIC) +/*N*/ { +/*N*/ eOrient = bSwitchColRow ? CHTXTORIENT_BOTTOMTOP : CHTXTORIENT_STANDARD; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ aTextAttr.Put(*pTitleAttr); +/*N*/ aTextAttr.Put(SvxChartTextOrientItem(eOrient)); +/*N*/ +/*N*/ // Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES +/*N*/ // Hier wird ein Wert nachgetragen, falls CHTXTORIENT_AUTOMATIC +/*N*/ // im Attribut stehen sollte und noch kein Winkel gesetzt wurde +/*N*/ // ... bisher ohne auswirkung ...? ... evtl. an dieser Stelle unnoetig +/*N*/ GetTextRotation(aTextAttr,eOrient); +/*N*/ +/*N*/ return CreateTextObj (nID, Point(), rText, +/*N*/ aTextAttr, TRUE, *pTextDirection); +/*N*/ } +/************************************************************************* +|* +|* Extractor fuer SvStream zum Laden +|* +\************************************************************************/ + +/*N*/ BOOL ChartModel::ChangeStatistics (const SfxItemSet &rInAttrs) +/*N*/ { +/*N*/ long nRowCnt = IsPieChart() +/*N*/ ? GetColCount() +/*N*/ : GetRowCount(); +/*N*/ +/*N*/ for( long nRow = 0; +/*N*/ nRow < nRowCnt; +/*N*/ nRow++ ) +/*N*/ PutDataRowAttr( nRow, rInAttrs ); +/*N*/ +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ BOOL bChanged = FALSE; +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_AVERAGE, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ bShowAverage = ((const SfxBoolItem*) pPoolItem)->GetValue(); +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_KIND_ERROR, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ eErrorKind = (SvxChartKindError) ((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_PERCENT, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ fIndicatePercent = ((const SvxDoubleItem*) pPoolItem)->GetValue(); +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_BIGERROR, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ fIndicateBigError = ((const SvxDoubleItem*) pPoolItem)->GetValue(); +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_CONSTPLUS, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ fIndicatePlus = ((const SvxDoubleItem*) pPoolItem)->GetValue(); +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_CONSTMINUS, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ fIndicateMinus = ((const SvxDoubleItem*) pPoolItem)->GetValue(); +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_INDICATE, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*?*/ eIndicate = (SvxChartIndicate) ((const SfxInt32Item*) pPoolItem)->GetValue(); +/*?*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if (rInAttrs.GetItemState(SCHATTR_STAT_REGRESSTYPE, TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ { +/*N*/ eRegression = (SvxChartRegress) ((const SfxInt32Item*) pPoolItem)->GetValue(); +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if( bChanged ) +/*N*/ { +/*N*/ BuildChart( FALSE ); +/*N*/ } +/*N*/ +/*N*/ return bChanged; +/*N*/ } + +/*N*/ void ChartModel::DataRangeChanged( long _nOldRowCnt , long _nOldColCnt ) +/*N*/ { +/*N*/ if( Is3DChart() ) +/*N*/ { +/*N*/ // delete depth-attributes for 3d charts +/*N*/ long i, nCount = aDataRowAttrList.Count(); +/*N*/ SfxItemSet * pAttributes; +/*N*/ +/*N*/ for( i=0; i<nCount; i++ ) +/*N*/ //-/ aDataRowAttrList.GetObject( i )->ClearItem( SID_ATTR_3D_DEPTH ); +/*N*/ aDataRowAttrList.GetObject( i )->ClearItem(SDRATTR_3DOBJ_DEPTH); +/*N*/ +/*N*/ nCount = aDataPointAttrList.Count(); +/*N*/ for( i=0; i < nCount; i++ ) +/*N*/ { +/*N*/ pAttributes = aDataPointAttrList.GetObject( i ); +/*N*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(SDRATTR_3DOBJ_DEPTH); +/*N*/ } +/*N*/ +/*N*/ nCount = aSwitchDataPointAttrList.Count(); +/*N*/ for( i=0; i < nCount; i++ ) +/*N*/ { +/*N*/ pAttributes = aSwitchDataPointAttrList.GetObject( i ); +/*N*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(SDRATTR_3DOBJ_DEPTH); +/*N*/ } +/*N*/ } +/*N*/ } + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode6.cxx b/binfilter/bf_sch/source/core/sch_chtmode6.cxx new file mode 100644 index 000000000000..bbc7b747d104 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode6.cxx @@ -0,0 +1,287 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svx/eeitem.hxx> +//svdraw.hxx +#define _SDR_NOITEMS +#define _SDR_NOTOUCH +#define _SDR_NOTRANSFORM +//#define _SDR_NOOBJECTS +//#define _SDR_NOVIEWS *** + +//#define SI_NOITEMS +//#define SI_NODRW +#define _SI_NOSBXCONTROLS +#define _SI_NOOTHERFORMS +#define _SI_NOCONTROL +#define _SI_NOSBXCONTROLS + +#include <bf_svx/xdef.hxx> + +#ifndef _SV_MENU_HXX //autogen +#endif + +#include "schattr.hxx" + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + +#include <bf_svtools/eitem.hxx> + +#endif + +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT + +#include <string.h> // memset + +#include <bf_svx/dialogs.hrc> + +#ifndef _CHTMODEL_HXX +#endif + +#include "docshell.hxx" + + + + + + +#include <bf_sfx2/printer.hxx> +namespace binfilter { + +/************************************************************************* +|* +|* MapMode des Printers auf Seitengroesse einstellen +|* +\************************************************************************/ + +/*N*/ void ChartModel::AdjustPrinter() +/*N*/ { +/*N*/ SchChartDocShell* pDocSh = (SchChartDocShell*) pDocShell; +/*N*/ +/*N*/ if (!pDocSh) +/*N*/ { +/*?*/ pDocSh = PTR_CAST(SchChartDocShell, SfxObjectShell::Current()); +/*N*/ } +/*N*/ +/*N*/ if (pDocSh) +/*N*/ { +/*N*/ SfxPrinter* pPrinter = pDocSh->GetPrinter(); +/*N*/ +/*N*/ if (pPrinter && pPrinter->IsValid()) +/*N*/ { +/*N*/ MapMode aOldMap = pPrinter->GetMapMode(); +/*N*/ MapMode aMap(aOldMap); +/*N*/ aMap.SetMapUnit(MAP_100TH_MM); +/*N*/ aMap.SetScaleX(Fraction(1,1)); +/*N*/ aMap.SetScaleY(Fraction(1,1)); +/*N*/ pPrinter->SetMapMode(aMap); +/*N*/ Size aPrintSize = pPrinter->GetOutputSize(); +/*N*/ +/*N*/ SdrPage* pPage = GetPage( 0 ); +/*N*/ DBG_ASSERT( pPage, "Invalid Page!" ); +/*N*/ +/*N*/ Size aPageSize( 0, 0 ); +/*N*/ long nPageWidth = 0, +/*N*/ nPageHeight = 0; +/*N*/ +/*N*/ if( pPage ) +/*N*/ { +/*N*/ aPageSize = pPage->GetSize(); +/*N*/ nPageWidth = aPageSize.Width(); +/*N*/ nPageHeight = aPageSize.Height(); +/*N*/ } +/*N*/ +/*N*/ const long nPrintWidth = aPrintSize.Width(); +/*N*/ const long nPrintHeight= aPrintSize.Height(); +/*N*/ +/*N*/ if( nPageHeight > 0 && +/*N*/ nPageWidth > 0 && +/*N*/ nPrintHeight > 0 && +/*N*/ nPrintWidth > 0 ) +/*N*/ { +/*N*/ // landscape mode +/*N*/ if( pPrinter->GetOrientation() == ORIENTATION_LANDSCAPE ) +/*N*/ { +/*?*/ double fVert = (double)nPrintWidth / (double)nPageWidth; +/*?*/ double fHorz = (double)nPrintHeight / (double)nPageHeight; +/*?*/ BOOL bVert; +/*?*/ +/*?*/ // bestimmung, welche richtung das hauptgewicht der skalierung hat. dazu werden +/*?*/ // papier- und seitengroesse verglichen und nach der richtung mit der geringeren +/*?*/ // abweichung (1:1) wird die skalierung bestimmt. +/*?*/ // bVert bestimmt nachfolgend die einpassung in das papier, je nachdem, ob das +/*?*/ // chart im hochformat oder quer ausgerichtet (nicht gedruckt !) ist. +/*?*/ // +/*?*/ if (fHorz < 1.0) +/*?*/ if (fVert < 1.0) +/*?*/ { +/*?*/ // wird in jede richtung vergroessert +/*?*/ bVert = fHorz < fVert; +/*?*/ Fraction aFract = bVert +/*?*/ ? Fraction( nPrintWidth, nPageWidth ) +/*?*/ : Fraction( nPrintHeight,nPageHeight ); +/*?*/ +/*?*/ aMap.SetScaleX(aFract); +/*?*/ aMap.SetScaleY(aFract); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // horizontal verkleinert, vertikal vergroessert +/*?*/ bVert = (fVert - 1.0) < (1.0 - fHorz); +/*?*/ Fraction aFract = bVert +/*?*/ ? Fraction( nPrintWidth, nPageWidth ) +/*?*/ : Fraction( nPrintHeight,nPageHeight ); +/*?*/ +/*?*/ aMap.SetScaleX(aFract); +/*?*/ aMap.SetScaleY(aFract); +/*?*/ } +/*?*/ else if (fVert < 1.0) +/*?*/ { +/*?*/ // vertikal verkleinert, horizontal vergroessert +/*?*/ bVert = (1.0 - fVert) < (fHorz - 1.0);//TEST2 +/*?*/ Fraction aFract = bVert +/*?*/ ? Fraction( nPrintWidth, nPageWidth ) +/*?*/ : Fraction( nPrintHeight,nPageHeight ); +/*?*/ +/*?*/ aMap.SetScaleX(aFract); +/*?*/ aMap.SetScaleY(aFract); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // wird in jede richtung verkleinert +/*?*/ bVert = fVert < fHorz; +/*?*/ Fraction aFract = bVert +/*?*/ ? Fraction( nPrintWidth, nPageWidth ) +/*?*/ : Fraction( nPrintHeight,nPageHeight ); +/*?*/ +/*?*/ aMap.SetScaleX(aFract); +/*?*/ aMap.SetScaleY(aFract); +/*?*/ } +/*?*/ +/*?*/ if (bVert) +/*?*/ { +/*?*/ Fraction aYFract = aMap.GetScaleY ();//TEST1,2 +/*?*/ +/*?*/ aMap.SetOrigin(Point(0, (aPrintSize.Height () - aPageSize.Height () * aYFract.GetNumerator () / aYFract.GetDenominator ()) / +/*?*/ 2 * aYFract.GetDenominator () / aYFract.GetNumerator ())); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ Fraction aXFract = aMap.GetScaleX (); +/*?*/ +/*?*/ aMap.SetOrigin(Point((aPrintSize.Width () - aPageSize.Width () * aXFract.GetNumerator () / aXFract.GetDenominator ()) / +/*?*/ 2 * aXFract.GetDenominator () / aXFract.GetNumerator (), 0)); +/*?*/ } +/*?*/ } +/*N*/ // portrait mode +/*N*/ else +/*N*/ { +/*N*/ double fHorz = (double)nPrintWidth / (double)nPageWidth; +/*N*/ double fVert = (double)nPrintHeight / (double)nPageHeight; +/*N*/ BOOL bHorz; +/*N*/ +/*N*/ if (fHorz < 1.0) +/*N*/ if (fVert < 1.0) +/*N*/ { +/*?*/ bHorz = fVert < fHorz; +/*?*/ Fraction aFract = bHorz +/*?*/ ? Fraction( nPrintWidth, nPageWidth ) +/*?*/ : Fraction( nPrintHeight, nPageHeight ); +/*?*/ +/*?*/ aMap.SetScaleX(aFract); +/*?*/ aMap.SetScaleY(aFract); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ bHorz = (1.0 - fHorz) < (fVert - 1.0); +/*?*/ Fraction aFract = bHorz +/*?*/ ? Fraction( nPrintWidth, nPageWidth) +/*?*/ : Fraction( nPrintHeight, nPageHeight); +/*?*/ +/*?*/ aMap.SetScaleX(aFract); +/*?*/ aMap.SetScaleY(aFract); +/*N*/ } +/*N*/ else if (fVert < 1.0) +/*N*/ { +/*?*/ bHorz = (fHorz - 1.0) < (1.0 - fVert); +/*?*/ Fraction aFract = bHorz +/*?*/ ? Fraction( nPrintWidth, nPageWidth) +/*?*/ : Fraction( nPrintHeight, nPageHeight); +/*?*/ +/*?*/ aMap.SetScaleX(aFract); +/*?*/ aMap.SetScaleY(aFract); +/*?*/ } +/*N*/ else +/*N*/ { +/*N*/ bHorz = (fHorz < fVert); +/*N*/ Fraction aFract = bHorz +/*N*/ ? Fraction( nPrintWidth, nPageWidth ) +/*N*/ : Fraction( nPrintHeight, nPageHeight ); +/*N*/ +/*N*/ aMap.SetScaleX(aFract); +/*N*/ aMap.SetScaleY(aFract); +/*N*/ } +/*N*/ +/*N*/ if (bHorz) +/*N*/ { +/*N*/ Fraction aYFract = aMap.GetScaleY (); +/*N*/ +/*N*/ aMap.SetOrigin(Point(0, (aPrintSize.Height () - aPageSize.Height () * aYFract.GetNumerator () / aYFract.GetDenominator ()) / +/*N*/ 2 * aYFract.GetDenominator () / aYFract.GetNumerator ())); +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ Fraction aXFract = aMap.GetScaleX (); +/*?*/ +/*?*/ aMap.SetOrigin(Point((aPrintSize.Width () - aPageSize.Width () * aXFract.GetNumerator () / aXFract.GetDenominator ()) / +/*?*/ 2 * aXFract.GetDenominator () / aXFract.GetNumerator (), 0)); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pPrinter->SetMapMode(aMap); +/*N*/ } +/*N*/ } +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode7.cxx b/binfilter/bf_sch/source/core/sch_chtmode7.cxx new file mode 100644 index 000000000000..9bb0dee80a4d --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode7.cxx @@ -0,0 +1,643 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma optimize("",off) +#endif + +#include "schattr.hxx" +#include "memchrt.hxx" + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + +#include <bf_svtools/eitem.hxx> + +#endif + + +#include <bf_svx/eeitem.hxx> + +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#include <bf_svx/svxids.hrc> +#include <globfunc.hxx> + + + + + +#include "chaxis.hxx" +namespace binfilter { + +// Hier abhaengig von der Reihe den Style zurückgeben, vorerst ist nur aufsplitten der +// Verbundcharts von nöten: +//TVM: bitte nicht benutzen! renovierungsbedürftig! + + +/*N*/ SchMemChart* ChartModel::GetChartData() const +/*N*/ { +/*N*/ return pChartData; +/*N*/ } + + +/*N*/ long ChartModel::GetColCount() const +/*N*/ { +/*N*/ if( !pChartData ) return 0; // GPF via GetMenuState +/*N*/ +/*N*/ return IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? pChartData->GetRowCount() +/*N*/ : pChartData->GetColCount(); +/*N*/ } + + +/*N*/ long ChartModel::GetRowCount() const +/*N*/ { +/*N*/ if( !pChartData ) return 0; // GPF via GetMenuState +/*N*/ +/*N*/ return IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? pChartData->GetColCount() +/*N*/ : pChartData->GetRowCount(); +/*N*/ } + + + + + + +/*N*/ SvxChartStyle ChartModel::ChartStyle () const +/*N*/ { +/*N*/ return eChartStyle; +/*N*/ } + + +/*N*/ SvxChartStyle &ChartModel::ChartStyle() +/*N*/ { +/*N*/ return eChartStyle; +/*N*/ } + + + +/*N*/ long ChartModel::PieSegOfs( long nCol ) const +/*N*/ { +/*N*/ DBG_ASSERT( nCol < nPieSegCount, "pie segment requested is out of bounds" ); +/*N*/ +/*N*/ if( IsPieChart() && +/*N*/ nCol < nPieSegCount ) +/*N*/ { +/*N*/ return pPieSegOfs[ nCol ]; +/*N*/ } +/*N*/ +/*N*/ return 0; +/*N*/ } + + + +/*N*/ BOOL& ChartModel::ShowMainTitle () +/*N*/ { +/*N*/ return bShowMainTitle; +/*N*/ } + + + + +/*N*/ String& ChartModel::MainTitle () +/*N*/ { +/*N*/ return aMainTitle; +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowSubTitle() +/*N*/ { +/*N*/ return bShowSubTitle; +/*N*/ } + + + + +/*N*/ String& ChartModel::SubTitle () +/*N*/ { +/*N*/ return aSubTitle; +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowXAxisTitle () +/*N*/ { +/*N*/ return bShowXAxisTitle; +/*N*/ } + + +/*N*/ String& ChartModel::XAxisTitle () +/*N*/ { +/*N*/ return aXAxisTitle; +/*N*/ } + + + + + + +/*N*/ BOOL& ChartModel::ShowYAxisTitle () +/*N*/ { +/*N*/ return bShowYAxisTitle; +/*N*/ } +/*N*/ + + + +/*N*/ String& ChartModel::YAxisTitle () +/*N*/ { +/*N*/ return aYAxisTitle; +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowZAxisTitle () +/*N*/ { +/*N*/ return bShowZAxisTitle; +/*N*/ } + + + + +/*N*/ String& ChartModel::ZAxisTitle() +/*N*/ { +/*N*/ return aZAxisTitle; +/*N*/ } + + +/*N*/ BOOL ChartModel::ShowXAxis () const +/*N*/ { +/*N*/ return pChartXAxis->IsVisible(); +/*N*/ } + + +/*N*/ void ChartModel::ShowXAxis (BOOL b) +/*N*/ { +/*N*/ pChartXAxis->ShowAxis(b); +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowXGridMain () +/*N*/ { +/*N*/ return bShowXGridMain; +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowXGridHelp () +/*N*/ { +/*N*/ return bShowXGridHelp; +/*N*/ } + + +/*N*/ BOOL ChartModel::ShowXDescr () const +/*N*/ { +/*N*/ return pChartXAxis->HasDescription(); +/*N*/ } + + +/*N*/ void ChartModel::ShowXDescr(BOOL b) +/*N*/ { +/*N*/ pChartXAxis->ShowDescr(b); +/*N*/ } + + +/*N*/ BOOL ChartModel::ShowYAxis () const +/*N*/ { +/*N*/ return pChartYAxis->IsVisible(); +/*N*/ } +/*N*/ void ChartModel::ShowYAxis (BOOL b) +/*N*/ { +/*N*/ pChartYAxis->ShowAxis(b); +/*N*/ } + + + +/*N*/ BOOL& ChartModel::ShowYGridMain () +/*N*/ { +/*N*/ return bShowYGridMain; +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowYGridHelp () +/*N*/ { +/*N*/ return bShowYGridHelp; +/*N*/ } + + +/*N*/ BOOL ChartModel::ShowYDescr () const +/*N*/ { +/*N*/ return pChartYAxis->HasDescription(); +/*N*/ } + + +/*N*/ void ChartModel::ShowYDescr( BOOL b) +/*N*/ { +/*N*/ pChartYAxis->ShowDescr(b); +/*N*/ } + + +/*N*/ BOOL ChartModel::ShowZAxis () const +/*N*/ { +/*N*/ return pChartZAxis->IsVisible(); +/*N*/ } + + +/*N*/ void ChartModel::ShowZAxis(BOOL b) +/*N*/ { +/*N*/ pChartZAxis->ShowAxis(b); +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowZGridMain () +/*N*/ { +/*N*/ return bShowZGridMain; +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ShowZGridHelp () +/*N*/ { +/*N*/ return bShowZGridHelp; +/*N*/ } + + +/*N*/ BOOL ChartModel::ShowZDescr () const +/*N*/ { +/*N*/ return pChartZAxis->HasDescription(); +/*N*/ } + + +/*N*/ void ChartModel::ShowZDescr (BOOL b) +/*N*/ { +/*N*/ pChartZAxis->ShowDescr(b); +/*N*/ } + + +/*N*/ BOOL ChartModel::HasAxis( long nObjectId ) const +/*N*/ { +/*N*/ if( CHOBJID_ANY == nObjectId ) +/*N*/ return IsAxisChart() && +/*N*/ ( pChartXAxis->IsVisible() || +/*N*/ pChartYAxis->IsVisible() || +/*N*/ pChartAAxis->IsVisible() || +/*N*/ pChartBAxis->IsVisible() || +/*N*/ (Is3DChart() && pChartZAxis->IsVisible()) ); +/*N*/ +/*N*/ switch( nObjectId ) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ return pChartXAxis->IsVisible(); +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ return pChartYAxis->IsVisible(); +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ return (Is3DChart() && pChartZAxis->IsVisible()); +/*N*/ case CHOBJID_DIAGRAM_A_AXIS: +/*N*/ return pChartAAxis->IsVisible(); +/*N*/ case CHOBJID_DIAGRAM_B_AXIS: +/*N*/ return pChartBAxis->IsVisible(); +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + + +/*N*/ const SfxItemSet& ChartModel::GetLegendAttr() const +/*N*/ { +/*N*/ return *pLegendAttr; +/*N*/ } + + + + + + + + + +//ToDo: diese Fkt. überflüssig machen (Problem: Austausch der Achseneigenschaften nicht NUR über Attr (??? stimmt das ???) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/*N*/ SdrOutliner* ChartModel::GetOutliner() const +/*N*/ { +/*N*/ return pOutliner; +/*N*/ } + +/* +UINT32 ChartModel::ValFor mat () const +{ + return nValFo rmat; +} + + +UINT32& ChartModel::ValForm at() +{ + return nVal Format; +} + + +UINT32 ChartModel::PercentVa lFormat () const +{ + return nPercentV alFormat; +} + + +UINT32& ChartModel::Per centValFormat () +{ + return nPercentValFo rmat; +} + + +UINT32 ChartModel::Des crFormat () const +{ + return nDescrFor mat; +} + + +UINT32& ChartModel::Desc rFormat() +{ + return nDes crFormat; +} + + +UINT32 ChartModel::PercentD escrFormat () const +{ + return nPercentDescrFo rmat; +} + + +UINT32& ChartModel::Percent DescrF ormat () +{ + return nPercentDescr Format; +} + +*/ +/*N*/ BOOL ChartModel::IsInitialized() const +/*N*/ { +/*N*/ return mbIsInitialized; +/*N*/ } + + + + +/*N*/ BOOL& ChartModel::ReadError () +/*N*/ { +/*N*/ return bReadError; +/*N*/ } + + +/*N*/ ChartScene* ChartModel::GetScene() +/*N*/ { +/*N*/ return pScene; +/*N*/ } + +/*N*/ SvNumberFormatter* ChartModel::GetNumFormatter() const +/*N*/ { +/*N*/ return pNumFormatter; +/*N*/ } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/*N*/ int& ChartModel::Granularity () +/*N*/ { +/*N*/ return nGranularity; +/*N*/ } + + + + +/*N*/ Size& ChartModel::InitialSize () +/*N*/ { +/*N*/ return aInitialSize; +/*N*/ } + + + + + + + + + + + + + + + + + + +/*N*/ void ChartModel::SetPieSegOfs( long nCol, long nOfs ) +/*N*/ { +/*N*/ DBG_ASSERT( pPieSegOfs, "Invalid Array" ); +/*N*/ DBG_ASSERT( nCol < nPieSegCount, "trying to set pie offset out of bounds" ); +/*N*/ +/*N*/ if( nCol < nPieSegCount ) +/*N*/ pPieSegOfs[ nCol ] = nOfs; +/*N*/ } + + +/*N*/ String& ChartModel::ColText( long nCol ) +/*N*/ { +/*N*/ return IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? (String&) pChartData->GetTransRowText(nCol) +/*N*/ : (String&) pChartData->GetTransColText(nCol); +/*N*/ } + + +/*N*/ String& ChartModel::RowText( long nRow ) +/*N*/ { +/*N*/ return IsDataSwitched() //abhaengig vom Charttyp - statt bSwitchData +/*N*/ ? (String&) pChartData->GetTransColText(nRow) +/*N*/ : (String&) pChartData->GetTransRowText(nRow); +/*N*/ } + + + + +// FG: Ist eine Abfrage ob die Beschriftung eines Charts Zentriert unter einem Datenpunkt (Regelfall) steht +// oder zentriert zwischen 2 Marken. +/*N*/ BOOL ChartModel::IsDescriptionCenteredUnderDataPoint () +/*N*/ { +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN : +/*N*/ case CHSTYLE_2D_COLUMN : +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN : +/*N*/ return FALSE; + +// case CHSTYLE_2D_LINE : +// case CHSTYLE_2D_STACKEDLINE : +// case CHSTYLE_2D_PERCENTLINE : +// case CHSTYLE_2D_LINESYMBOLS : +// case CHSTYLE_2D_STACKEDLINESYM : +// case CHSTYLE_2D_PERCENTLINESYM : +// case CHSTYLE_2D_CUBIC_SPLINE : +// case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL : +// case CHSTYLE_2D_B_SPLINE : +// case CHSTYLE_2D_B_SPLINE_SYMBOL : + +// case CHSTYLE_2D_XY : +// case CHSTYLE_2D_XYSYMBOLS : +// case CHSTYLE_2D_XY_LINE : +// case CHSTYLE_2D_CUBIC_SPLINE_XY : +// case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY : +// case CHSTYLE_2D_B_SPLINE_XY : +// case CHSTYLE_2D_B_SPLINE_SYMBOL_XY : + +// case CHSTYLE_2D_BAR : +// case CHSTYLE_2D_STACKEDBAR: +// case CHSTYLE_2D_PERCENTBAR: + +// case CHSTYLE_2D_AREA : +// case CHSTYLE_2D_PERCENTAREA : +// case CHSTYLE_2D_STACKEDAREA : + +// case CHSTYLE_2D_STOCK_1: +// case CHSTYLE_2D_STOCK_2: +// case CHSTYLE_2D_STOCK_3: +// case CHSTYLE_2D_STOCK_4: +/*N*/ default : +/*N*/ return TRUE; +/*N*/ } +/*N*/ } +/*N*/ void ChartModel::LockBuild() +/*N*/ { +/*N*/ bNoBuildChart=TRUE; +/*N*/ } +/*N*/ void ChartModel::UnlockBuild() +/*N*/ { +/*N*/ bNoBuildChart=FALSE; +/*N*/ if(bShouldBuildChart) +/*N*/ BuildChart(FALSE); //evtl. TRUE, um Ranges zu prüfen??? +/*N*/ +/*N*/ // force broadcast SFX_HINT_DOCCHANGED +/*N*/ SfxObjectShell* pObjSh = GetObjectShell(); +/*N*/ if( pObjSh ) +/*N*/ { +/*N*/ pObjSh->SetModified( pObjSh->IsModified()); +/*N*/ } +/*N*/ } +/*N*/ BOOL ChartModel::IsLockedBuild() +/*N*/ { +/*N*/ return bNoBuildChart; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode8.cxx b/binfilter/bf_sch/source/core/sch_chtmode8.cxx new file mode 100644 index 000000000000..4ec91fec6388 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode8.cxx @@ -0,0 +1,647 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "chtmodel.hxx" +namespace binfilter { + +/* + ------------------------------------------------------------ + Some Information about chart types. This may be used as a + basis for creating some chart classes (!) with + corresponding members. + ------------------------------------------------------------ + + Styles Basic: Perc Stack Bar 3D Symbols Net Axis sign neg. spline XY Stat. + +CHSTYLE_2D_LINE, Line - - - - - - - x x - - x +CHSTYLE_2D_STACKEDLINE, Line - x - - - - - x x - - - +CHSTYLE_2D_PERCENTLINE, Line x x - - - - - - x - - - +CHSTYLE_2D_COLUMN, Column - - - - - - - x x - - x +CHSTYLE_2D_STACKEDCOLUMN, Column - x - - - - - x x - - - +CHSTYLE_2D_PERCENTCOLUMN, Column x x - - - - - - x - - - +CHSTYLE_2D_BAR, *Column - - x - - - - x x - - x +CHSTYLE_2D_STACKEDBAR, *Column - x x - - - - x x - - - +CHSTYLE_2D_PERCENTBAR, *Column x x x - - - - - x - - - +CHSTYLE_2D_AREA, Area - - - - - - - x x - - - +CHSTYLE_2D_STACKEDAREA, Area - x - - - - - x x - - - +CHSTYLE_2D_PERCENTAREA, Area x x - - - - x - x - - - +CHSTYLE_2D_PIE, Pie x x - - - - - - x - - - +CHSTYLE_3D_STRIPE, Stripe? - - - x - - - x x - - - +CHSTYLE_3D_COLUMN, Column - - - x - - - x x - - - +CHSTYLE_3D_FLATCOLUMN, Column? - - - x - - - x x - - - +CHSTYLE_3D_STACKEDFLATCOLUMN Column - x - x - - - x x - - - +CHSTYLE_3D_PERCENTFLATCOLUMN Column x x - x - - - - x - - - +CHSTYLE_3D_AREA, Area - - - x - - - x x - - - +CHSTYLE_3D_STACKEDAREA, Area - x - x - - - x x - - - +CHSTYLE_3D_PERCENTAREA, Area x x - x - - - - - - - - +CHSTYLE_3D_SURFACE, Surface - - - x - - - x x - - - +CHSTYLE_3D_PIE, Pie x x ? x - - x - x - - - +CHSTYLE_2D_XY, XYZ - - - - - - - x x - x x +CHSTYLE_3D_XYZ, XYZ - - - x - - - x x - x - +CHSTYLE_2D_LINESYMBOLS, Line - - - - x - - x x - - x +CHSTYLE_2D_STACKEDLINESYM, Line - x - - x - - x x - - - +CHSTYLE_2D_PERCENTLINESYM, Line x x - - x - - - x - - - +CHSTYLE_2D_XYSYMBOLS, XYZ - - - - x - - x x - x x +CHSTYLE_3D_XYZSYMBOLS, XYZ - - - x x - - x x - x - +CHSTYLE_2D_DONUT1, *PIE ? ? ? - - - x - x - - - +CHSTYLE_2D_DONUT2, *PIE ? ? ? - - - x - x - - - +CHSTYLE_3D_BAR, *Column - - x x - - - x x - - - +CHSTYLE_3D_FLATBAR, *Column - - x x - - - x x - - - +CHSTYLE_3D_STACKEDFLATBAR, *Column - x x x - - - x x - - - +CHSTYLE_3D_PERCENTFLATBAR, *Column x x x x - - - - x - - - +CHSTYLE_2D_PIE_SEGOF1, PIE x x ? - - - x - x - - - +CHSTYLE_2D_PIE_SEGOFALL, PIE x x ? - - - x - x - - - +CHSTYLE_2D_NET, Net - - - - - x - x x - - - +CHSTYLE_2D_NET_SYMBOLS, Net - - - - x x - x x - - - +CHSTYLE_2D_NET_STACK, Net - x - - - x - x x - - - +CHSTYLE_2D_NET_SYMBOLS_STACK, Net - x - - x x - x x - - - +CHSTYLE_2D_NET_PERCENT, Net x x - - - x - - x - - - +CHSTYLE_2D_NET_SYMBOLS_PERCENT, Net x x - - x x - - x - - - +CHSTYLE_2D_CUBIC_SPLINE, SplineC - - - - - - - x x C - x +CHSTYLE_2D_CUBIC_SPLINE_SYMBOL, SplineC - - - - x - - x x C - x +CHSTYLE_2D_B_SPLINE, SplineB - - - - - - - x x B - x +CHSTYLE_2D_B_SPLINE_SYMBOL, SplineB - - - - x - - x x B - x +CHSTYLE_2D_CUBIC_SPLINE_XY, SplineC - - - - - - - x x C x x +CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY, SplineC - - - - x - - x x C x x +CHSTYLE_2D_B_SPLINE_XY, SplineB - - - - - - - x x B x x +CHSTYLE_2D_B_SPLINE_SYMBOL_XY, SplineB - - - - x - - x x B x x +CHSTYLE_2D_XY_LINE, Line_&_XYZ - - - - - - - x x - x - +CHSTYLE_2D_LINE_COLUMN, Column+1_Line - - - - - - - x x - - - +CHSTYLE_2D_LINE_STACKEDCOLUMN Column+1_Line - x - - - - - x x - - - */ + +// meaning supports symbols +/*N*/ BOOL ChartModel::HasSymbols(const long nRow) const +/*N*/ { +/*N*/ +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ +/*N*/ +/*N*/ +/*N*/ case CHSTYLE_2D_XY : +/*N*/ DBG_TRACE("ChartModel::HasSymbols:Achtung, neuer Typ, ungetestet"); +/*N*/ +/*N*/ case CHSTYLE_2D_LINESYMBOLS: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_2D_XYSYMBOLS: +/*N*/ case CHSTYLE_3D_XYZSYMBOLS: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY: +/*N*/ return TRUE; +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*?*/ return (nRow!=0); +/*N*/ +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ if(nRow >= (GetRowCount() - nNumLinesInColChart)) +/*N*/ return TRUE; +/*N*/ return FALSE; +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ break; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +/*N*/ BOOL ChartModel::IsLine(const long nRow) const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*?*/ return nRow ? TRUE : FALSE; +/*N*/ +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ +/*N*/ // lines and symbol types +/*N*/ case CHSTYLE_2D_XY : +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK : +/*N*/ case CHSTYLE_2D_NET_SYMBOLS : +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT : +/*N*/ case CHSTYLE_2D_LINESYMBOLS: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY: +/*N*/ +/*N*/ // lines only +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_XY : +/*N*/ case CHSTYLE_2D_LINE : +/*N*/ case CHSTYLE_2D_STACKEDLINE : +/*N*/ case CHSTYLE_2D_PERCENTLINE : +/*N*/ case CHSTYLE_2D_NET : +/*N*/ case CHSTYLE_2D_NET_STACK : +/*N*/ case CHSTYLE_2D_NET_PERCENT : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE : +/*N*/ case CHSTYLE_2D_B_SPLINE : +/*N*/ case CHSTYLE_2D_XY_LINE : +/*N*/ return TRUE; +/*N*/ +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ if( nRow >= (GetRowCount() - nNumLinesInColChart)) +/*N*/ return ( GetRowCount() > 1 ); // only one series => must be a bar +/*N*/ return FALSE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +// for all types which return TRUE here it is assumed +// that toggling bSwitchColRow is allowed +/*N*/ BOOL ChartModel::IsBar() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_BAR: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } +/*N*/ BOOL ChartModel::IsCol(long nRow) const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_COLUMN: +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ case CHSTYLE_3D_FLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ return TRUE; +/*N*/ +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*?*/ return nRow ? FALSE : TRUE ; +/*N*/ +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ return ! (nRow >= (GetRowCount() - nNumLinesInColChart)); +/*N*/ +/*N*/ default: +/*?*/ return FALSE; +/*N*/ } +/*N*/ } + + +/*N*/ BOOL ChartModel::Is3DChart() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_3D_STRIPE: +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_FLATCOLUMN: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ case CHSTYLE_3D_AREA: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_SURFACE: +/*N*/ case CHSTYLE_3D_PIE: +/*N*/ // new since 380 Build 1502, but still not supported +/*N*/ case CHSTYLE_3D_XYZ: +/*N*/ case CHSTYLE_3D_XYZSYMBOLS: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsStackedChart() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsStacked() const +/*N*/ { +/*N*/ if( IsPercent() ) // percent => stacked +/*N*/ return TRUE; +/*N*/ +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_NET_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsPercentChart() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsPercent() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ case CHSTYLE_2D_NET_PERCENT: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsArea(long nRow) +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_AREA: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_AREA: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsAxisChart() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_DONUT1: +/*N*/ case CHSTYLE_2D_DONUT2: +/*N*/ case CHSTYLE_2D_PIE: +/*N*/ case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ case CHSTYLE_3D_PIE: +/*N*/ return FALSE; +/*N*/ +/*N*/ default: +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsNegativeChart( SvxChartStyle* pStyle ) const +/*N*/ { +/*N*/ switch( pStyle? *pStyle: eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ return FALSE; +/*N*/ +/*N*/ default: +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsSignedChart( SvxChartStyle* pStyle ) const +/*N*/ { +/*N*/ switch( pStyle? *pStyle: eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_3D_PIE : +/*N*/ case CHSTYLE_2D_PIE : +/*N*/ case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ case CHSTYLE_2D_DONUT1: +/*N*/ case CHSTYLE_2D_DONUT2: +/*N*/ case CHSTYLE_2D_PERCENTLINE : +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN : +/*N*/ case CHSTYLE_2D_PERCENTAREA : +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN : +/*N*/ case CHSTYLE_3D_PERCENTAREA : +/*N*/ case CHSTYLE_2D_PERCENTBAR : +/*N*/ return FALSE; +/*N*/ +/*N*/ default : +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + + +/*N*/ BOOL ChartModel::IsPieChart() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_3D_PIE : +/*N*/ case CHSTYLE_2D_PIE : +/*N*/ case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsXYChart( SvxChartStyle* pStyle ) const +/*N*/ { +/*N*/ // if pStyle == NULL (default) the current style of 'this' is used +/*N*/ +/*N*/ switch( pStyle? *pStyle: eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_XY : +/*N*/ case CHSTYLE_3D_XYZ : +/*N*/ case CHSTYLE_2D_XYSYMBOLS : +/*N*/ case CHSTYLE_3D_XYZSYMBOLS : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY : +/*N*/ case CHSTYLE_2D_XY_LINE : +/*N*/ return TRUE; +/*N*/ +/*N*/ case CHSTYLE_ADDIN: +/*N*/ return TRUE; +/*N*/ +/*N*/ default : +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + + +/*N*/ BOOL ChartModel::IsSplineChart () const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_2D_B_SPLINE : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_XY : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY : +/*N*/ return TRUE; +/*N*/ +/*N*/ default : +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::IsNetChart() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_NET : +/*N*/ case CHSTYLE_2D_NET_SYMBOLS : +/*N*/ case CHSTYLE_2D_NET_STACK : +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK : +/*N*/ case CHSTYLE_2D_NET_PERCENT : +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT : +/*N*/ return TRUE; +/*N*/ +/*N*/ default : +/*N*/ return FALSE; +/*N*/ } +/*N*/ } + +// ======================================== +// return base type +// ======================================== + +/*N*/ long ChartModel::GetBaseType() const +/*N*/ { +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_B_SPLINE : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_2D_LINE: +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_LINESYMBOLS: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL : +/*N*/ case CHSTYLE_3D_STRIPE: +/*N*/ return CHTYPE_LINE; +/*N*/ +/*N*/ case CHSTYLE_2D_AREA: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/*N*/ case CHSTYLE_3D_AREA: +/*N*/ case CHSTYLE_3D_STACKEDAREA: +/*N*/ case CHSTYLE_3D_PERCENTAREA: +/*N*/ return CHTYPE_AREA; +/*N*/ +/*N*/ case CHSTYLE_2D_PIE: +/*N*/ case CHSTYLE_2D_PIE_SEGOF1: +/*N*/ case CHSTYLE_2D_PIE_SEGOFALL: +/*N*/ case CHSTYLE_3D_PIE: +/*N*/ return CHTYPE_CIRCLE; +/*N*/ +/*N*/ case CHSTYLE_2D_DONUT1: +/*N*/ case CHSTYLE_2D_DONUT2: +/*?*/ return CHTYPE_DONUT; +/*N*/ +/*N*/ case CHSTYLE_2D_B_SPLINE_XY : +/*N*/ case CHSTYLE_2D_XY_LINE : +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY : +/*N*/ case CHSTYLE_2D_XYSYMBOLS: +/*N*/ case CHSTYLE_2D_XY: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY : +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY : +/*N*/ return CHTYPE_XY; +/*N*/ +/*N*/ case CHSTYLE_2D_NET: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS: +/*N*/ case CHSTYLE_2D_NET_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_NET_PERCENT: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ return CHTYPE_NET; +/*N*/ +/*N*/ case CHSTYLE_2D_COLUMN: +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ case CHSTYLE_3D_COLUMN: +/*N*/ case CHSTYLE_3D_FLATCOLUMN: +/*N*/ case CHSTYLE_3D_STACKEDFLATCOLUMN: +/*N*/ case CHSTYLE_3D_PERCENTFLATCOLUMN: +/*N*/ return CHTYPE_COLUMN; +/*N*/ +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ return CHTYPE_STOCK; +/*N*/ +/*N*/ case CHSTYLE_2D_BAR: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/*N*/ return CHTYPE_BAR; +/*N*/ +/*N*/ case CHSTYLE_ADDIN: +/*?*/ return CHTYPE_ADDIN; +/*N*/ +/*N*/ default: +/*?*/ DBG_ERROR( "Invalid Chart style given!" ); +/*?*/ return CHTYPE_INVALID; +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::SetBaseType(long nBaseType) +/*N*/ { +/*N*/ // setting the basetype currently sets the default type in the base category +/*N*/ // returns TRUE, iff chart type has been changed +/*N*/ +/*N*/ SvxChartStyle eNewStyle = eChartStyle; +/*N*/ +/*N*/ switch( nBaseType ) +/*N*/ { +/*N*/ case CHTYPE_LINE: +/*N*/ eNewStyle = CHSTYLE_2D_LINE; +/*N*/ break; +/*N*/ case CHTYPE_AREA: +/*N*/ eNewStyle = CHSTYLE_2D_AREA; +/*N*/ break; +/*N*/ case CHTYPE_DONUT: +/*?*/ eNewStyle = CHSTYLE_2D_DONUT1; +/*?*/ break; +/*N*/ case CHTYPE_CIRCLE: +/*N*/ eNewStyle = CHSTYLE_2D_PIE; +/*N*/ break; +/*N*/ case CHTYPE_XY: +/*N*/ eNewStyle = CHSTYLE_2D_XY; +/*N*/ break; +/*N*/ case CHTYPE_NET: +/*N*/ eNewStyle = CHSTYLE_2D_NET; +/*N*/ break; +/*N*/ case CHTYPE_COLUMN: // == BAR +/*N*/ case CHTYPE_BAR: +/*N*/ eNewStyle = CHSTYLE_2D_COLUMN; +/*N*/ break; +/*N*/ case CHTYPE_STOCK: +/*N*/ eNewStyle = CHSTYLE_2D_STOCK_1; +/*N*/ break; +/*N*/ case CHTYPE_ADDIN: +/*?*/ eNewStyle = CHSTYLE_ADDIN; +/*?*/ break; +/*?*/ default: +/*?*/ DBG_ERROR( "ChartModel::SetBaseType: Invalid Type!" ); +/*?*/ break; +/*N*/ } +/*N*/ +/*N*/ if( eChartStyle != eNewStyle ) +/*N*/ { +/*N*/ ChangeChart( eNewStyle ); +/*N*/ BuildChart( FALSE ); +/*N*/ return TRUE; +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmode9.cxx b/binfilter/bf_sch/source/core/sch_chtmode9.cxx new file mode 100644 index 000000000000..8176a8898a5a --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmode9.cxx @@ -0,0 +1,1976 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifdef _MSC_VER +#pragma optimize("",off) + +#pragma hdrstop +#endif +#include <bf_svx/svdorect.hxx> + +#include <bf_svx/svdopath.hxx> + + +#include <bf_svx/xlnclit.hxx> + +#ifndef _ZFORLIST_HXX //autogen +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#endif + + +#include <list> + +#include <bf_svx/eeitem.hxx> + +#include "schattr.hxx" +#include "memchrt.hxx" + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT + + +#endif + +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#define ITEMID_FONTWIDTH EE_CHAR_FONTWIDTH +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/fwdtitem.hxx> + +// header for class SdrOutliner +// header for GetDraftFillColor() +#include <bf_svx/svdetc.hxx> + +#include "globfunc.hxx" + +#include "ChXChartDocument.hxx" + +#include <float.h> +#include "glob.hrc" + +#include "chaxis.hxx" +#include "chdescr.hxx" +#include "calculat.hxx" +namespace binfilter { + +/************************************************************************* +|* +|* Koordinatenachsen und Rueckwand mit Unterteilung und Beschriftung +|* erzeugen; Liefert die Einfuege-Position fuer die Chart-Datenobjekte. +|* +\************************************************************************/ +/*N*/ void ChartModel::Create2DXYTitles(Rectangle& rRect,BOOL bSwitchColRow) +/*N*/ { +/*N*/ SdrPage* pPage=GetPage(0); +/*N*/ +/*N*/ SdrTextObj *pXAxisTitleObj = NULL; +/*N*/ SdrTextObj *pYAxisTitleObj = NULL; +/*N*/ +/*N*/ if (bShowXAxisTitle) +/*N*/ { +/*N*/ pXAxisTitleObj = CreateTitle (pXAxisTitleAttr, CHOBJID_DIAGRAM_TITLE_X_AXIS, +/*N*/ bSwitchColRow,aXAxisTitle, FALSE, &eAdjustXAxesTitle); +/*N*/ +/*N*/ if (GetAdjustMarginsForXAxisTitle()) +/*N*/ { +/*N*/ if (bSwitchColRow) +/*N*/ rRect.Left() += GetOutputSize(*pXAxisTitleObj).Width() + 200; +/*N*/ else +/*N*/ rRect.Bottom() -= GetOutputSize(*pXAxisTitleObj).Height() + 200; +/*N*/ } +/*N*/ } +/*N*/ if (bShowYAxisTitle) +/*N*/ { +/*N*/ pYAxisTitleObj = CreateTitle (pYAxisTitleAttr, CHOBJID_DIAGRAM_TITLE_Y_AXIS, +/*N*/ bSwitchColRow,aYAxisTitle, TRUE, &eAdjustYAxesTitle); +/*N*/ if (GetAdjustMarginsForYAxisTitle()) +/*N*/ { +/*N*/ if (bSwitchColRow) +/*N*/ rRect.Bottom() -= GetOutputSize(*pYAxisTitleObj).Height() + 200; +/*N*/ else +/*N*/ rRect.Left() += GetOutputSize(*pYAxisTitleObj).Width() + 200; +/*N*/ } +/*N*/ } +/*N*/ if (pXAxisTitleObj) +/*N*/ pPage->NbcInsertObject(pXAxisTitleObj); +/*N*/ if (pYAxisTitleObj) +/*N*/ pPage->NbcInsertObject(pYAxisTitleObj); +/*N*/ } + + +/*N*/ BOOL ChartModel::CanAxis(long nAxisId) const +/*N*/ { +/*N*/ switch(nAxisId) +/*N*/ { +/*N*/ case CHART_AXIS_PRIMARY_X: +/*?*/ return ( ! ( IsPieChart() || IsDonutChart() || IsNetChart() )); +/*N*/ case CHART_AXIS_PRIMARY_Y: +/*?*/ return ( ! ( IsPieChart() || IsDonutChart() )); +/*N*/ case CHART_AXIS_SECONDARY_X: +/*N*/ case CHART_AXIS_SECONDARY_Y: +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_LINE: +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_COLUMN: +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_BAR: +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ case CHSTYLE_2D_AREA: +/*N*/ case CHSTYLE_2D_STACKEDAREA: +/*N*/ case CHSTYLE_2D_PERCENTAREA: +/* case CHSTYLE_2D_PIE: + case CHSTYLE_3D_STRIPE: + case CHSTYLE_3D_COLUMN: + case CHSTYLE_3D_FLATCOLUMN: + case CHSTYLE_3D_STACKEDFLATCOLUMN: + case CHSTYLE_3D_PERCENTFLATCOLUMN: + case CHSTYLE_3D_AREA: + case CHSTYLE_3D_STACKEDAREA: + case CHSTYLE_3D_PERCENTAREA: + case CHSTYLE_3D_SURFACE: + case CHSTYLE_3D_PIE: +*/ case CHSTYLE_2D_XY: +/*N*/ // case CHSTYLE_3D_XYZ: +/*N*/ case CHSTYLE_2D_LINESYMBOLS: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_2D_XYSYMBOLS: +/*N*/ case CHSTYLE_3D_XYZSYMBOLS: +/*N*/ // case CHSTYLE_2D_DONUT1: +/*N*/ // case CHSTYLE_2D_DONUT2: +/*N*/ case CHSTYLE_3D_BAR: +/*N*/ case CHSTYLE_3D_FLATBAR: +/*N*/ case CHSTYLE_3D_STACKEDFLATBAR: +/*N*/ case CHSTYLE_3D_PERCENTFLATBAR: +/* case CHSTYLE_2D_PIE_SEGOF1: + case CHSTYLE_2D_PIE_SEGOFALL: + case CHSTYLE_2D_NET: + case CHSTYLE_2D_NET_SYMBOLS: + case CHSTYLE_2D_NET_STACK: + case CHSTYLE_2D_NET_SYMBOLS_STACK: + case CHSTYLE_2D_NET_PERCENT: + case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +*/ case CHSTYLE_2D_CUBIC_SPLINE: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ case CHSTYLE_2D_B_SPLINE: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_B_SPLINE_XY: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_XY_LINE: +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ case CHSTYLE_ADDIN: +/*N*/ return TRUE; +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ +/*N*/ default: +/*?*/ return FALSE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } +/*N*/ BOOL ChartModel::HasSecondYAxis() const +/*N*/ { +/*N*/ switch(eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ return TRUE; +/*N*/ } +/*N*/ if(!CanAxis(CHART_AXIS_SECONDARY_Y)) +/*N*/ return FALSE; +/*N*/ +/*N*/ if(pChartBAxis->IsVisible()) +/*N*/ return TRUE; +/*N*/ +/*N*/ +/*N*/ const SfxPoolItem *pPoolItem = NULL; +/*N*/ +/*N*/ for(long n=0;n<GetRowCount();n++) +/*N*/ if(GetDataRowAttr(n).GetItemState(SCHATTR_AXIS,TRUE, &pPoolItem) == SFX_ITEM_SET) +/*N*/ if(((const SfxInt32Item*)pPoolItem)->GetValue()==CHART_AXIS_SECONDARY_Y) +/*N*/ return TRUE; +/*N*/ +/*N*/ return FALSE; +/*N*/ } +/*N*/ void ChartModel::Create2DBackplane(Rectangle &rRect,SdrObjList &rObjList,BOOL bPartDescr,USHORT eStackMode) +/*N*/ { +/*N*/ BOOL bPercent=IsPercent(); +/*N*/ BOOL bSwitchColRow=IsXVertikal();//IsBar() +/*N*/ +/*N*/ //Initialisieren: +/*N*/ pChartXAxis->Initialise(rRect,bSwitchColRow,eStackMode,bPercent,FALSE); +/*N*/ pChartYAxis->Initialise(rRect,bSwitchColRow,eStackMode,bPercent,FALSE); +/*N*/ pChartBAxis->Initialise(rRect,bSwitchColRow,eStackMode,bPercent,FALSE); +/*N*/ pChartAAxis->Initialise(rRect,bSwitchColRow,eStackMode,bPercent,FALSE); +/*N*/ +/*N*/ //Position setzen (kann man eigentlich auch im ctor des Model machen?) +/*N*/ pChartAAxis->SetPosition(CHAXIS_POS_B); //A,B sind sekundäre Achsen => oben und rechts +/*N*/ pChartBAxis->SetPosition(CHAXIS_POS_B); +/*N*/ pChartXAxis->SetPosition(CHAXIS_POS_A); //primäre Positionen=links, unten +/*N*/ pChartYAxis->SetPosition(CHAXIS_POS_A); +/*N*/ +/*N*/ pChartXAxis->CalcValueSteps(); +/*N*/ pChartYAxis->CalcValueSteps();//#63904# 12% +/*N*/ pChartAAxis->CalcValueSteps(); +/*N*/ pChartBAxis->CalcValueSteps();//#63904# 11% +/*N*/ +/*N*/ pChartBAxis->AttachIfNoOwnData(pChartYAxis); //skalierung transferieren, falls Y keine automatische Skalierung benutzt und B keine Daten besitzt! +/*N*/ pChartYAxis->AttachIfNoOwnData(pChartBAxis); // und umgekehrt +/*N*/ +/*N*/ //Falls einer der beiden Y-Daten keine Reihen zugeordnet sind, soll diese die andere kopieren +/*N*/ +/*N*/ long nTitleBottom = rRect.Bottom(); +/*N*/ long nTitleLeft = rRect.Left(); +/*N*/ +/*N*/ // ******* RECT_CHANGES **** Ab hier wird am rRect rumgeschraubt ****************** +/*N*/ +/*N*/ Create2DXYTitles(rRect,bSwitchColRow); //abziehen der Achsen-Titel-Fläche +/*N*/ +/*N*/ // FG: Ich merke mir vor jeglicher Aenderung des linken oder rechten Randes wo der Seitenrand +/*N*/ // gewesen ist. Das braucht man um nun zu entscheiden ob der linke Rand wegen eines +/*N*/ // überstehenden Textes nachgeregelt werden soll. +/*N*/ const Rectangle aOldRect(rRect); +/*N*/ +/*N*/ //Zusammenfassen ??? +/*N*/ pChartYAxis->CalcMaxTextSize();//#63904# 14%, aber Aufruf nur wenn nötig +/*N*/ pChartYAxis->InitDescr(); +/*N*/ pChartYAxis->SubtractDescrSize(rRect);//Größe der Beschriftung vom Rechteck abziehen +/*N*/ pChartBAxis->CalcMaxTextSize();//#63904# s.o. 0% wenn nicht benutzt! +/*N*/ pChartBAxis->InitDescr(); +/*N*/ pChartBAxis->SubtractDescrSize(rRect); +/*N*/ +/*N*/ pChartXAxis->SetArea(rRect); //Die X-Achsenlänge ist bereits bekannt! wichtig für nDescrWidth +/*N*/ pChartAAxis->SetArea(rRect); //Die Y-Längen werden nachfolgend korrigiert +/*N*/ +/*N*/ pChartAAxis->SetColTextMode(!IsXYChart(),!bPartDescr); +/*N*/ pChartXAxis->SetColTextMode(!IsXYChart(),!bPartDescr); +/*N*/ +/*N*/ //für die X-Achse gibt es ein paar sonderregel, insbesondere wird +/*N*/ //das Rect auch in der X-Breite geändert, wenn die Spaltenunterschriften sehr lang sind +/*N*/ //hinzu kommt noch Umbruch (an Y-Achse nicht vorgesehen), daher mu?hier eine +/*N*/ //Sonderbehandlung erfolgen, auch das InitDescr erfolgt hier nachträglich! +/*N*/ pChartXAxis->SubtractDescrSize_X(rRect,aOldRect); +/*N*/ +/*N*/ pChartAAxis->SetArea(rRect); +/*N*/ +/*N*/ pChartAAxis->SubtractDescrSize_X(rRect,aOldRect); //noch falsch! +/*N*/ +/*N*/ pChartXAxis->SetArea(rRect); //jetzt sind x und y länge bekannt +/*N*/ pChartYAxis->SetArea(rRect); +/*N*/ pChartAAxis->SetArea(rRect); +/*N*/ pChartBAxis->SetArea(rRect); +/*N*/ +/*N*/ // ******* END RECT_CHANGES ******************************************************************** +/*N*/ +/*N*/ rRect.Justify(); +/*N*/ +/*N*/ pChartXAxis->SetArea(rRect); //jetzt sind x und y länge bekannt +/*N*/ pChartYAxis->SetArea(rRect); +/*N*/ pChartAAxis->SetArea(rRect); +/*N*/ pChartBAxis->SetArea(rRect); +/*N*/ +/*N*/ long nStepPartWidth=pChartXAxis->GetDescrWidth(); //Warum nochmal? sollte noch immer identisch nDescrWidth sein! +/*N*/ +/*N*/ Position2DAxisTitles(rRect,bSwitchColRow,nTitleLeft,nTitleBottom); +/*N*/ +/*N*/ // Diagrammwand +/*N*/ SdrRectObj* pWallObj = new SdrRectObj( rRect ); +/*N*/ pWallObj->SetModel( this ); +/*N*/ rObjList.NbcInsertObject( SetObjectAttr( pWallObj, CHOBJID_DIAGRAM_WALL, +/*N*/ TRUE, TRUE, pDiagramWallAttr)); +/*N*/ +/*N*/ //********* Erzeugung der Achsen und Gitter ***************************** +/*N*/ +/*N*/ SdrObjList* pXGridMainList = NULL; +/*N*/ SdrObjList* pYGridMainList = NULL; +/*N*/ SdrObjList* pXGridHelpList = NULL; +/*N*/ SdrObjList* pYGridHelpList = NULL; +/*N*/ SdrObjList* pBAxisList = NULL; +/*N*/ +/*N*/ +/*N*/ BOOL bXAxis = (pChartXAxis->IsVisible() && pChartYAxis->IsOriginInRange()); +/*N*/ BOOL bYAxis = (pChartYAxis->IsVisible() && +/*N*/ (!IsXYChart() || (IsXYChart() && pChartXAxis->IsOriginInRange()))); +/*N*/ +/*N*/ if(bShowXGridMain) +/*N*/ pXGridMainList = CreateGroup (rObjList, CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP); +/*N*/ if(bShowYGridMain) +/*N*/ pYGridMainList = CreateGroup (rObjList, CHOBJID_DIAGRAM_Y_GRID_MAIN_GROUP); +/*N*/ if(bShowXGridHelp) +/*?*/ pXGridHelpList = CreateGroup (rObjList, CHOBJID_DIAGRAM_X_GRID_HELP_GROUP); +/*N*/ if(bShowYGridHelp) +/*?*/ pYGridHelpList = CreateGroup (rObjList, CHOBJID_DIAGRAM_Y_GRID_HELP_GROUP); +/*N*/ +/*N*/ pChartXAxis->CreateAxis( rObjList, CHOBJID_DIAGRAM_X_AXIS ); +/*N*/ pChartYAxis->CreateAxis( rObjList, CHOBJID_DIAGRAM_Y_AXIS ); +/*N*/ +/*N*/ pChartXAxis->ShowAxis(bXAxis); +/*N*/ pChartYAxis->ShowAxis(bYAxis); +/*N*/ +/*N*/ pChartXAxis->SetMainGrid(pYGridMainList,pYGridMainAttr); +/*N*/ pChartXAxis->SetHelpGrid(pYGridHelpList,pYGridHelpAttr); +/*N*/ +/*N*/ pChartYAxis->SetHelpGrid(pXGridHelpList,pXGridHelpAttr); +/*N*/ pChartYAxis->SetMainGrid(pXGridMainList,pXGridMainAttr); +/*N*/ +/*N*/ pChartAAxis->CreateAxis(rObjList,CHOBJID_DIAGRAM_A_AXIS); +/*N*/ pChartBAxis->CreateAxis(rObjList,CHOBJID_DIAGRAM_B_AXIS); +/*N*/ +/*N*/ //sek. Achsen haben nie ein Gitter +/*N*/ pChartAAxis->SetHelpGrid(NULL,NULL); +/*N*/ pChartAAxis->SetMainGrid(NULL,NULL); +/*N*/ pChartBAxis->SetHelpGrid(NULL,NULL); +/*N*/ pChartBAxis->SetMainGrid(NULL,NULL); +/*N*/ +/*N*/ pChartXAxis->CreateAxis(pChartYAxis->GetPosOrigin(),pChartXAxis->HasDescription(),bXAxis); +/*N*/ +/*N*/ if (IsXYChart()) +/*N*/ { +/*N*/ pChartYAxis->CreateAxis(pChartXAxis->GetPosOrigin(),pChartYAxis->HasDescription(),bYAxis); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if(bYAxis) +/*N*/ pChartYAxis->CreateAxis(); +/*N*/ } +/*N*/ +/*N*/ pChartYAxis->DrawGrids(); +/*N*/ pChartBAxis->DrawGrids();//eigentlich kein Grid, nur die Ticks! +/*N*/ +/*N*/ if(IsXYChart()) +/*N*/ { //Achtung! Die X-Achse unterstützt Umbruch (nColumnTextWidth)! +/*N*/ pChartXAxis->InitDescr(); +/*N*/ pChartAAxis->InitDescr(); +/*N*/ } +/*N*/ else //Hier wird der ColText genutzt -> Beschränkung auf maMaxTextSize! +/*N*/ { +/*N*/ pChartXAxis->InitDescr_X(); +/*N*/ pChartAAxis->InitDescr_X(); +/*N*/ } +/*N*/ pChartAAxis->DrawGrids(); +/*N*/ pChartXAxis->DrawGrids(); +/*N*/ } +/*N*/ void ChartModel::Position2DAxisTitles(const Rectangle& rRect,BOOL bSwitchColRow,long nTitleLeft,long nTitleBottom) +/*N*/ { +/*N*/ SdrPage *pPage = GetPage(0); +/*N*/ Size aPageSize = pPage->GetSize(); +/*N*/ +/*N*/ if(bShowXAxisTitle) +/*N*/ { +/*N*/ SdrObject *pXAxisTitleObj = GetObjWithId(CHOBJID_DIAGRAM_TITLE_X_AXIS,*pPage); +/*N*/ +/*N*/ if (pXAxisTitleObj) +/*N*/ { +/*N*/ +/*N*/ +/*N*/ Point aXAxesTitlePosition (rRect.Left() + (int) (rRect.GetWidth() / 2),nTitleBottom); +/*N*/ +/*N*/ if (GetXAxisTitleHasBeenMoved() && GetUseRelativePositions() && +/*N*/ (aXAxesTitlePosition.X() > 0) && (aXAxesTitlePosition.Y() > 0)) +/*N*/ { +/*N*/ // FG: Das ist eine Variable die in BuildChart gesetzt wird, kurz bevor +/*N*/ // das Objekt zerstoert wird. +/*N*/ double fRelativeXPosition = ((double) aTitleXAxisPosition.X()) / aInitialSize.Width(); +/*N*/ double fRelativeYPosition = ((double) aTitleXAxisPosition.Y()) / aInitialSize.Height(); +/*N*/ aXAxesTitlePosition.X() = (int) (aPageSize.Width() * fRelativeXPosition + 0.5); +/*N*/ aXAxesTitlePosition.Y() = (int) (aPageSize.Height() * fRelativeYPosition + 0.5); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (bSwitchColRow) +/*N*/ { +/*N*/ aXAxesTitlePosition.X() = nTitleLeft; +/*N*/ aXAxesTitlePosition.Y() = (long)(rRect.Top() + rRect.GetHeight() / 2); +/*N*/ } +/*N*/ } +/*N*/ SetTextPos((SdrTextObj &) *pXAxisTitleObj, aXAxesTitlePosition,pXAxisTitleAttr); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(bShowYAxisTitle) +/*N*/ { +/*N*/ SdrObject *pYAxisTitleObj = GetObjWithId(CHOBJID_DIAGRAM_TITLE_Y_AXIS,*pPage); +/*N*/ +/*N*/ if (pYAxisTitleObj) +/*N*/ { +/*N*/ Point aYAxesTitlePosition (Max(0L,nTitleLeft), +/*N*/ Max(0L,(long) (rRect.Top() + (int) (rRect.GetHeight() / 2)))); +/*N*/ +/*N*/ if (GetYAxisTitleHasBeenMoved() && GetUseRelativePositions() && +/*N*/ (aYAxesTitlePosition.X() >= 0) && (aYAxesTitlePosition.Y() >= 0)) +/*N*/ { +/*N*/ // FG: Das ist eine Variable die in BuildChart gesetzt wird, kurz bevor +/*N*/ // das Objekt zerstoert wird. +/*N*/ double fRelativeXPosition = ((double) aTitleYAxisPosition.X()) / aInitialSize.Width(); +/*N*/ double fRelativeYPosition = ((double) aTitleYAxisPosition.Y()) / aInitialSize.Height(); +/*N*/ aYAxesTitlePosition.X() = (int) (aPageSize.Width() * fRelativeXPosition + 0.5); +/*N*/ aYAxesTitlePosition.Y() = (int) (aPageSize.Height() * fRelativeYPosition + 0.5); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if (bSwitchColRow) +/*N*/ { +/*N*/ aYAxesTitlePosition.X() = rRect.Left() + (int) (rRect.GetWidth() / 2); +/*N*/ aYAxesTitlePosition.Y() = nTitleBottom; +/*N*/ } +/*N*/ } +/*N*/ SetTextPos((SdrTextObj &)*pYAxisTitleObj, aYAxesTitlePosition,pYAxisTitleAttr); +/*N*/ } +/*N*/ } +/*N*/ } +/************************************************************************* +|* +|* create 2d column charts +|* +\************************************************************************/ + +/*N*/ SdrObjGroup* ChartModel::Create2DColChart(Rectangle aRect) +/*N*/ { +/*N*/ +/*N*/ // Background +/*N*/ SchObjGroup* pGroup; +/*N*/ SdrObjList* pList; +/*N*/ CreateChartGroup (pGroup, pList); +/*N*/ Create2DBackplane(aRect, *pList, TRUE,IsStacked() ? CHSTACK_MINMAX : CHSTACK_NONE); +/*N*/ +/*N*/ Rectangle aClipRect( aRect ); +/*N*/ aClipRect.Right() += 1; +/*N*/ aClipRect.Top() -= 1; +/*N*/ +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ +/*N*/ ULONG nInsert,nInsStat; +/*N*/ ULONG nAxisBPos=CONTAINER_APPEND; +/*N*/ ULONG nAxisYPos=pList->GetObjCount()-1; +/*N*/ +/*N*/ //VerbundChart, Symbol der Linie, dynamische Größe: +/*N*/ Size aLegendSize (((SvxFontWidthItem &) pLegendAttr->Get (EE_CHAR_FONTWIDTH)).GetWidth (), +/*N*/ ((SvxFontHeightItem &) pLegendAttr->Get (EE_CHAR_FONTHEIGHT)).GetHeight ()); +/*N*/ OutputDevice * pRefDev = GetRefDevice(); +/*N*/ if(pRefDev) +/*N*/ aLegendSize = pRefDev->PixelToLogic (pRefDev->LogicToPixel (aLegendSize)); +/*N*/ else +/*N*/ DBG_ERROR("ChartModel: no RefDevice"); +/*N*/ long nLegendHeight = aLegendSize.Height () * 9 / 10; +/*N*/ +/*N*/ SdrObject *pObj; +/*N*/ ChartAxis* pAxis=pChartYAxis; +/*N*/ short nCol, nRow; +/*N*/ BOOL bPercent = IsPercent(); +/*N*/ +/*N*/ long nLines = Min((long)GetNumLinesColChart(),(long)(nRowCnt));;//#50212# +/*N*/ long nLineStart = nRowCnt-nLines; //#50212# Ab hier werden Linien gezeichnet +/*N*/ +/*N*/ //BarDescriptoren erzeugen +/*N*/ long nR1=0,nR2=0; +/*N*/ if(IsStacked())//Reihenzahl in diesem Fall egal +/*N*/ { +/*N*/ nR1=nR2=1; +/*N*/ } +/*N*/ else //sonst Datenreihen mit Balken je Achse zählen: (Lines fallen weg) +/*N*/ { +/*N*/ for(nRow=0;nRow<nRowCnt;nRow++) +/*N*/ { +/*N*/ long nAxisUID=((const SfxInt32Item&)GetDataRowAttr(nRow).Get(SCHATTR_AXIS)).GetValue(); +/*N*/ if(IsBar()||IsCol(nRow)) +/*N*/ { +/*N*/ if(nAxisUID == CHART_AXIS_SECONDARY_Y) +/*N*/ nR2++; +/*N*/ else +/*N*/ nR1++; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if(!nR1) //Verbundcharts, Lines werden oben nicht berücksichtigt, +/*N*/ nR1=1; //aber nRn=0 macht keinen Sinn -> Korrektur +/*N*/ if(!nR2) +/*N*/ nR2=1; +/*N*/ aBarY1.Create(aRect,nColCnt,nR1); +/*N*/ aBarY2.Create(aRect,nColCnt,nR2); +/*N*/ ChartBarDescriptor* pBar=&aBarY1; +/*N*/ +/*N*/ SdrObjList **pRowLists = new SdrObjList*[nRowCnt]; +/*N*/ SdrObjList **pStatLists = new SdrObjList*[nRowCnt]; +/*N*/ +/*N*/ ChartDataDescription aDescr(nColCnt,nRowCnt,pList,this,bShowDataDescr); +/*N*/ +/*N*/ Point *pTracePoint=0; +/*N*/ if(m_nDefaultColorSet&CHSPECIAL_TRACELINES) +/*N*/ { +/*?*/ pTracePoint = new Point[nRowCnt];//#50149# +/*N*/ } +/*N*/ +/*N*/ +/*N*/ XPolygon *pLine = new XPolygon[nLines]; //#50149# +/*N*/ BOOL bStartPointIsValid; // Indicates wether the first point of a line +/*N*/ // segment is valid. +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ Point aTextPos; +/*N*/ +/*N*/ for (nRow = 0; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ const SfxItemSet& rDataRowAttr = GetDataRowAttr(nRow); +/*N*/ SfxItemSet aDataPointAttr(rDataRowAttr); +/*N*/ MergeDataPointAttr(aDataPointAttr,nCol,nRow); //#63904# +/*N*/ +/*N*/ //Achse und Bardescriptor wählen, Insertreihenfolge festlegen -> +/*N*/ long nAxisUID=((const SfxInt32Item&)rDataRowAttr.Get(SCHATTR_AXIS)).GetValue(); +/*N*/ pAxis=GetAxisByUID(nAxisUID); +/*N*/ if(nAxisUID==CHART_AXIS_SECONDARY_Y) +/*N*/ { +/*?*/ pBar=&aBarY2; +/*?*/ nInsert=nAxisBPos; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pBar=&aBarY1; +/*N*/ nInsert=nAxisYPos;//Insert-Reihenfolge festlegen +/*N*/ } +/*N*/ BOOL bIsLine=IsLine(nRow); +/*N*/ if(bIsLine) +/*N*/ nInsert=CONTAINER_APPEND; +/*N*/ +/*N*/ nInsStat = (nInsert==CONTAINER_APPEND) ? nInsert : nInsert+1;//Statistik immer hinter den Reihenobjekten, sonst wird sie verdeckt +/*N*/ //<- Achse und Bardescriptor wählen, Insertreihenfolge festlegen +/*N*/ +/*N*/ if(!nRow) +/*N*/ { +/*N*/ pChartBAxis->InitStacking(); +/*N*/ pChartYAxis->InitStacking(); +/*N*/ } +/*N*/ +/*N*/ if (!nCol) +/*N*/ { +/*N*/ SchObjGroup* pRowGroup = (SchObjGroup*) CreateSimpleGroup (CHOBJID_DIAGRAM_ROWGROUP, TRUE, TRUE); +/*N*/ +/*N*/ pRowGroup->InsertUserData(new SchDataRow(nRow)); +/*N*/ pList->NbcInsertObject(pRowGroup,nInsert); +/*N*/ pRowLists[nRow] = pRowGroup->GetSubList(); +/*N*/ +/*N*/ SchObjGroup* pStatGroup = (SchObjGroup*) CreateSimpleGroup (CHOBJID_DIAGRAM_STATISTICS_GROUP, TRUE, TRUE); +/*N*/ +/*N*/ pStatGroup->InsertUserData(new SchDataRow(nRow)); +/*N*/ pList->NbcInsertObject(pStatGroup,nInsStat); +/*N*/ pStatLists [nRow] = pStatGroup->GetSubList (); +/*N*/ } +/*N*/ +/*N*/ long nIndex = nCol + nRow * nColCnt; +/*N*/ double fData = GetData(nCol, nRow, bPercent); +/*N*/ +/*N*/ BOOL bLogarithm = pAxis->IsLogarithm(); +/*N*/ switch (eChartStyle) +/*N*/ { +/*N*/ case CHSTYLE_2D_COLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ { +/*N*/ Point aTopLeft(pBar->BarLeft(),pAxis->GetUpper(fData,TRUE)); +/*N*/ Point aBottomRight(pBar->BarRight(),pAxis->GetLower(fData,TRUE)); +/*N*/ +/*N*/ Rectangle aObjRect(aTopLeft, aBottomRight); +/*N*/ +/*N*/ BOOL bShow = (aObjRect.Bottom() >= aObjRect.Top()); +/*N*/ aObjRect.Justify(); +/*N*/ +/*N*/ if (!nCol && ((const SfxBoolItem &) rDataRowAttr.Get (SCHATTR_STAT_AVERAGE)).GetValue ()) + {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pList->NbcInsertObject(AverageValueY(nRow,FALSE,aRect, +/*N*/ +/*N*/ if (bShow && ((!bLogarithm && (fData != DBL_MIN)) || +/*N*/ (bLogarithm && (fData != DBL_MIN) && (fData > 0.0)))) +/*N*/ { +/*N*/ if(bIsLine) //#50212# +/*N*/ { +/*N*/ // Verbund-Chart +/*N*/ // Letzte "Datenreihe" als Linie ausgeben +/*N*/ pLine[nRow-nLineStart][1] = +/*N*/ Point(pBar->Middle(),pAxis->GetPos(fData)); +/*N*/ +/*N*/ if (nCol == 0) +/*N*/ { +/*N*/ // Beim ersten Datenpunkt: Anfangspunkt = EndPunkt +/*N*/ pLine[nRow-nLineStart][0] = pLine[nRow-nLineStart][1];//#50212# +/*N*/ bStartPointIsValid = TRUE; +/*N*/ } +/*N*/ // Symbol einfuegen +/*N*/ Point& rInsert = pLine[ nRow - nLineStart ][ 1 ]; +/*N*/ +/*N*/ if( aClipRect.IsInside( rInsert ) ) +/*N*/ { +/*N*/ SdrObject* pNewObj = CreateSymbol( rInsert, nRow, nCol, +/*N*/ (SfxItemSet &)aDataPointAttr, +/*N*/ nLegendHeight ); //#50212# +/*N*/ if(pNewObj) +/*N*/ { +/*N*/ pNewObj->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM_DATA)); +/*N*/ pRowLists[nRow]->NbcInsertObject(pNewObj); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Insert the line segment only if its starting point has a valid +/*N*/ // value. +/*N*/ if (bStartPointIsValid) +/*N*/ { +/*N*/ // Insert line. +/*N*/ XPolyPolygon aResult; +/*N*/ SchCalculationHelper::IntersectPolygonWithRectangle( pLine[ nRow - nLineStart ], +/*N*/ aClipRect, +/*N*/ aResult ); +/*N*/ if( aResult.Count()) +/*N*/ { +/*N*/ SdrPathObj* pObj = new SdrPathObj( OBJ_PLIN, aResult ); +/*N*/ pObj->InsertUserData( new SchObjectId( CHOBJID_DIAGRAM_ROWSLINE )); +/*N*/ pObj->InsertUserData( new SchDataRow( nRow )); +/*N*/ pRowLists[ nRow ]->NbcInsertObject( pObj, 0 ); +/*N*/ +/*N*/ // Set the line's attributes. +/*N*/ pObj->SetItemSet( rDataRowAttr ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Anfangspunkt des naechsten Datenpunkts = +/*N*/ // Endpunkt des aktuellen Datenpunkts +/*N*/ pLine[nRow-nLineStart][0] = pLine[nRow-nLineStart][1];//#50212# +/*N*/ bStartPointIsValid = TRUE; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pRowLists[nRow]->NbcInsertObject(CreateRect (aObjRect, nCol, nRow, aDataPointAttr)); +/*N*/ } +/*N*/ +/*N*/ if ((SvxChartKindError) +/*N*/ ((const SfxInt32Item &) aDataPointAttr.Get (SCHATTR_STAT_KIND_ERROR)).GetValue () != +/*N*/ CHERROR_NONE) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 AverageErrorY(nRow,fData,aObjRect.TopCenter(),FALSE,aDataPointAttr,pStatLists[nRow],pAxis); +/*N*/ +/*N*/ if(aDescr.Enabled()) +/*N*/ { +/*N*/ Point aPos(bIsLine ? pLine[nRow-nLineStart][1] : aObjRect.TopCenter() ); +/*N*/ aDescr.Insert(nCol,nRow,aDataPointAttr,aPos,FALSE,CHADJUST_BOTTOM_CENTER,pAxis); +/*N*/ } +/*N*/ } +/*N*/ else if (bIsLine) +/*N*/ { +/*N*/ // Remember that the current point may not be inserted. +/*?*/ bStartPointIsValid = FALSE; +/*N*/ } +/*N*/ +/*N*/ pBar->NextBar(); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ { +/*N*/ Pair aTopBottom(pAxis->Stack(fData,TRUE)); +/*N*/ Point aTopLeft(pBar->BarLeft()/*nPos*/,aTopBottom.A()); +/*N*/ Point aBottomRight(pBar->BarRight()/*nPos + nColWidth*/,aTopBottom.B()); +/*N*/ +/*N*/ +/*N*/ Rectangle aObjRect(aTopLeft, aBottomRight); +/*N*/ +/*N*/ BOOL bShow = (aObjRect.Bottom() >= aObjRect.Top()); +/*N*/ +/*N*/ //Stackedline-Chart benutzt dieses ObjectRect nicht => Bug #48970# +/*N*/ if (bIsLine) +/*?*/ bShow=TRUE;//#50212# +/*N*/ +/*N*/ if(fData==DBL_MIN) +/*N*/ { +/*?*/ bShow=FALSE; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // bShow includes Top == Bottom and that may be ok, if there is no data in the chart +/*N*/ // and > might also happen (difference 1 from rounding errors) +/*N*/ // AND if bShow is TRUE the following part fixes the problem +/*N*/ // so ASSERT => TRACE +/*N*/ CHART_TRACE1( "Create2DColChart bShow = %s", bShow? "True" : "False" ); +/*N*/ } +/*N*/ if(bLogarithm && (fData <= 0.0) ) +/*?*/ bShow=FALSE; +/*N*/ +/*N*/ if (bShow) +/*N*/ { +/*N*/ aObjRect.Justify(); +/*N*/ +/*N*/ if (bIsLine)//#50212# +/*N*/ { +/*?*/ pLine[nRow-nLineStart][1] = Point(pBar->Middle()//MIDPOS//zu umständlich: nPos + nPartWidth/2 - nGap +/*?*/ ,pAxis->GetPos(fData));//#50212# +/*?*/ +/*?*/ if (nCol == 0) +/*?*/ { +/*?*/ // Beim ersten Datenpunkt: Anfangspunkt = EndPunkt +/*?*/ pLine[nRow-nLineStart][0] = pLine[nRow-nLineStart][1];//#50212# +/*?*/ } +/*?*/ Point& rInsert = pLine[ nRow - nLineStart ][ 1 ]; +/*?*/ +/*?*/ if( aClipRect.IsInside( rInsert )) +/*?*/ { +/*?*/ SdrObject* pNewObj = CreateSymbol( rInsert, nRow, nCol, +/*?*/ (SfxItemSet &) aDataPointAttr, +/*?*/ nLegendHeight ); //#50212# +/*?*/ if(pNewObj) +/*?*/ { +/*?*/ pNewObj->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM_DATA)); +/*?*/ pRowLists[nRow]->NbcInsertObject(pNewObj); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ // Insert line. +/*?*/ XPolyPolygon aResult; +/*?*/ SchCalculationHelper::IntersectPolygonWithRectangle( pLine[ nRow - nLineStart ], +/*?*/ aClipRect, +/*?*/ aResult ); +/*?*/ if( aResult.Count()) +/*?*/ { +/*?*/ SdrPathObj* pObj = new SdrPathObj( OBJ_PLIN, aResult ); +/*?*/ pObj->InsertUserData( new SchObjectId( CHOBJID_DIAGRAM_ROWSLINE )); +/*?*/ pObj->InsertUserData( new SchDataRow( nRow )); +/*?*/ pRowLists[ nRow ]->NbcInsertObject( pObj, 0 ); +/*?*/ +/*?*/ // Set the line's attributes. +/*?*/ pObj->SetItemSet( rDataRowAttr ); +/*?*/ } +/*?*/ +/*?*/ // Anfangspunkt des naechsten Datenpunkts = +/*?*/ // Endpunkt des aktuellen Datenpunkts +/*?*/ pLine[nRow-nLineStart][0] = pLine[nRow-nLineStart][1];//#50212# +/*N*/ } +/*N*/ else +/*N*/ { //#50116# +/*N*/ Rectangle aBarRect(aObjRect); +/*N*/ if(nBarPercentWidth<100 && nBarPercentWidth>0) +/*N*/ { +/*?*/ double fWidth=aBarRect.GetWidth(); +/*?*/ fWidth=fWidth*((double)nBarPercentWidth/100.0); +/*?*/ long nWidth=Round(fWidth); +/*?*/ long nDiff=(aBarRect.GetWidth()-nWidth); +/*?*/ +/*?*/ Size aSize=aBarRect.GetSize(); +/*?*/ aSize.Width()-=nDiff; +/*?*/ aBarRect.SetSize(aSize); +/*?*/ aBarRect.Move(nDiff/2,0); +/*N*/ } +/*N*/ pRowLists[nRow]->NbcInsertObject(CreateRect (aBarRect, nCol, nRow, aDataPointAttr)); +/*N*/ +/*N*/ BOOL bIsDownward=(BOOL)(fData < 0.0);//FALSE;//#51471# +/*N*/ +/*N*/ if(pTracePoint) //#50149# +/*N*/ { +/*?*/ if(nCol != 0) +/*?*/ { +/*?*/ Point aEndPoint=bIsDownward ? aBarRect.BottomLeft() : aBarRect.TopLeft();//#51471# +/*?*/ SdrPathObj* pObj = new SdrPathObj(pTracePoint[nRow],aEndPoint); +/*?*/ pObj->InsertUserData(new SchObjectId (0)); +/*?*/ pList->NbcInsertObject(pObj);//immer vorne, egal welche Achse +/*?*/ // Linie attributieren +/*?*/ +/*?*/ //-/ pObj->NbcSetAttributes(rDataRowAttr, FALSE); +/*?*/ pObj->SetItemSet(rDataRowAttr); +/*?*/ +/*?*/ } +/*?*/ pTracePoint[nRow]=bIsDownward ? aBarRect.BottomRight() :aBarRect.TopRight();//#51471# +/*N*/ } +/*N*/ } +/*N*/ if(aDescr.Enabled()) +/*N*/ { +/*N*/ if(bIsLine) +/*?*/ aDescr.Insert(nCol,nRow,aDataPointAttr,pLine[nRow-nLineStart][1],FALSE,CHADJUST_BOTTOM_CENTER,pAxis); +/*N*/ else +/*N*/ aDescr.Insert(nCol,nRow,aDataPointAttr,aObjRect.Center(),FALSE,CHADJUST_CENTER_CENTER,pAxis); +/*N*/ } +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ case CHSTYLE_2D_BAR: +/*N*/ { +/*N*/ Point aTopLeft( pAxis->GetLower(fData),pBar->BarTop() ); +/*N*/ Point aRightBottom( pAxis->GetUpper(fData),pBar->BarBottom() ); +/*N*/ Rectangle aObjRect(aTopLeft,aRightBottom); +/*N*/ +/*N*/ BOOL bShow = (aObjRect.Right() >= aObjRect.Left()); +/*N*/ aObjRect.Justify(); +/*N*/ +/*N*/ if (!nCol && ((const SfxBoolItem &) rDataRowAttr.Get (SCHATTR_STAT_AVERAGE)).GetValue ()) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pList->NbcInsertObject (AverageValueY (nRow, TRUE, aRect, +/*N*/ +/*N*/ if ((bShow) && ((!bLogarithm && (fData != DBL_MIN)) || +/*N*/ (bLogarithm && (fData != DBL_MIN) && (fData > 0.0)))) +/*N*/ { +/*N*/ pRowLists[nRow]->NbcInsertObject(CreateRect (aObjRect, nCol, nRow, aDataPointAttr)); +/*N*/ +/*N*/ if ((SvxChartKindError) +/*N*/ ((const SfxInt32Item &) aDataPointAttr.Get (SCHATTR_STAT_KIND_ERROR)).GetValue () != +/*N*/ CHERROR_NONE) +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 AverageErrorY(nRow,fData, aObjRect.RightCenter(),TRUE,aDataPointAttr,pStatLists[nRow],pAxis); +/*N*/ +/*N*/ if(aDescr.Enabled()) +/*N*/ { +/*N*/ Point aPos(aObjRect.TopRight()); +/*N*/ aPos.Y()+=aObjRect.GetHeight() / 2; +/*N*/ aPos.X()+=500; +/*N*/ aDescr.Insert(nCol,nRow,aDataPointAttr,aPos,FALSE,CHADJUST_CENTER_LEFT,pAxis); +/*N*/ } +/*N*/ } +/*N*/ pBar->NextBar(); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHSTYLE_2D_STACKEDBAR: +/*N*/ case CHSTYLE_2D_PERCENTBAR: +/*N*/ { +/*N*/ Pair aLeftRight(pAxis->Stack(fData,TRUE)); +/*N*/ Point aTopLeft(aLeftRight.A(),pBar->BarBottom()); +/*N*/ Point aBottomRight(aLeftRight.B(),pBar->BarTop()); +/*N*/ +/*N*/ Rectangle aObjRect(aTopLeft,aBottomRight); +/*N*/ +/*N*/ +/*N*/ if ((aObjRect.Right() >= aObjRect.Left()) && +/*N*/ ((!bLogarithm && (fData != DBL_MIN)) || +/*N*/ (bLogarithm && (fData != DBL_MIN) && (fData > 0.0)))) +/*N*/ { +/*N*/ aObjRect.Justify(); +/*N*/ +/*N*/ pObj = new SdrRectObj( aObjRect ); +/*N*/ pObj->SetModel( this ); +/*N*/ pObj = SetObjectAttr( pObj, CHOBJID_DIAGRAM_DATA, TRUE, TRUE, &aDataPointAttr ); +/*N*/ pObj->InsertUserData(new SchDataPoint(nCol, nRow)); +/*N*/ pRowLists[nRow]->NbcInsertObject(pObj); +/*N*/ +/*N*/ if(aDescr.Enabled()) +/*N*/ aDescr.Insert(nCol,nRow,aDataPointAttr,aObjRect.Center(),FALSE,CHADJUST_CENTER_CENTER,pAxis); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } //for nRow +/*N*/ aBarY1.NextCol(); +/*N*/ aBarY2.NextCol(); +/*N*/ }//for nCol +/*N*/ +/*N*/ aDescr.Build(TRUE); +/*N*/ delete[] pTracePoint;//#50149# +/*N*/ delete[] pLine;//#50212# +/*N*/ delete[] pRowLists; +/*N*/ delete[] pStatLists; +/*N*/ return pGroup; +/*N*/ } + + +/************************************************************************* +|* +|* Fl„chendiagramm erzeugen +|* case CHSTYLE_2D_LINE: +|* case CHSTYLE_2D_STACKEDLINE: +|* case CHSTYLE_2D_PERCENTLINE: +|* case CHSTYLE_2D_LINESYMBOLS : +|* case CHSTYLE_2D_STACKEDLINESYM : +|* case CHSTYLE_2D_PERCENTLINESYM : +|* case CHSTYLE_2D_CUBIC_SPLINE : +|* case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL : +|* case CHSTYLE_2D_B_SPLINE : +|* case CHSTYLE_2D_B_SPLINE_SYMBOL : +|* +\************************************************************************/ +/*N*/ BOOL ChartModel::HasStockLines( SvxChartStyle* pStyle ) +/*N*/ { +/*N*/ switch( pStyle? *pStyle: eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_STOCK_1: +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ return TRUE; +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } +/*N*/ BOOL ChartModel::HasStockRects( SvxChartStyle* pStyle ) +/*N*/ { +/*N*/ switch( pStyle? *pStyle: eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_STOCK_2: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ return TRUE; +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } +/*N*/ BOOL ChartModel::HasStockBars( SvxChartStyle* pStyle ) +/*N*/ { +/*N*/ switch( pStyle? *pStyle: eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_STOCK_3: +/*N*/ case CHSTYLE_2D_STOCK_4: +/*N*/ return TRUE; +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ } +/*N*/ ChartAxis* ChartModel::GetAxisByUID(long nUId) +/*N*/ { +/*N*/ switch(nUId) +/*N*/ { +/*N*/ case CHART_AXIS_PRIMARY_X: +/*N*/ return pChartXAxis; +/*N*/ case CHART_AXIS_PRIMARY_Y: +/*N*/ return pChartYAxis; +/*N*/ case CHART_AXIS_PRIMARY_Z: +/*N*/ return pChartZAxis; +/*N*/ case CHART_AXIS_SECONDARY_Y: +/*N*/ return pChartBAxis; +/*N*/ case CHART_AXIS_SECONDARY_X: +/*N*/ return pChartAAxis; +/*N*/ } +/*N*/ DBG_ERROR1( "ChartAxis not found: id=%ld", nUId ); +/*N*/ return pChartYAxis; +/*N*/ } +/*N*/ #define SchDataCol(a) SchDataRow(a) //erst mal testen..... (wird eh ne geklonte Klasse) + +/*N*/ void ChartModel::DrawStockLines( SdrObjList* pList, const Rectangle& rRect ) +/*N*/ { //und fuer Stock-Charts +/*N*/ +/*N*/ long nStart=HasStockBars() ? 1:0; +/*N*/ if(HasStockLines()) +/*N*/ { +/*N*/ +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ long nCol, nRow; +/*N*/ +/*N*/ SdrObject *pObj; +/*N*/ SdrObjList *pLineList,*pLossList=NULL,*pPlusList=NULL; +/*N*/ SchObjGroup *pLineGroup,*pLossGroup=NULL,*pPlusGroup=NULL; +/*N*/ +/*N*/ +/*N*/ ChartBarDescriptor* pBar; +/*N*/ aBarY2.Create(rRect,nColCnt,1); +/*N*/ aBarY1.Create(rRect,nColCnt,1); +/*N*/ +/*N*/ pLineGroup =(SchObjGroup*)CreateSimpleGroup(CHOBJID_DIAGRAM_STOCKLINE_GROUP,TRUE, TRUE); +/*N*/ pList->NbcInsertObject(pLineGroup); +/*N*/ pLineList = pLineGroup->GetSubList(); +/*N*/ +/*N*/ XPolygon aPolyStock(2); +/*N*/ +/*N*/ //StockRects: +/*N*/ long nLow,nHi; +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ BOOL bOK=FALSE; +/*N*/ nLow=nHi=0; +/*N*/ for (nRow = nStart; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ if(GetAxisUID(nRow)==CHART_AXIS_SECONDARY_Y) +/*?*/ pBar=&aBarY2; +/*N*/ else +/*N*/ pBar=&aBarY1; +/*N*/ +/*N*/ ChartAxis *pAxis=GetAxisByUID(((const SfxInt32Item &)GetDataRowAttr(nRow).Get(SCHATTR_AXIS)).GetValue()); +/*N*/ double fData = GetData(nCol,nRow,FALSE); +/*N*/ if(fData != DBL_MIN) +/*N*/ { +/*N*/ bOK=TRUE; +/*N*/ long nYPos = pAxis->GetPos(fData); +/*N*/ +/*N*/ aPolyStock[0].X()=aPolyStock[1].X()=(USHORT)pBar->Middle(); +/*N*/ if(nRow==nStart)//geht auch schöner: bInitialise (ToDo:) +/*N*/ { +/*N*/ aPolyStock[0].Y()=aPolyStock[1].Y()=(USHORT) nYPos; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if((USHORT)nYPos > aPolyStock[0].Y()) +/*N*/ aPolyStock[0].Y()=(USHORT)nYPos; +/*N*/ if((USHORT)nYPos < aPolyStock[1].Y()) +/*N*/ aPolyStock[1].Y()=(USHORT)nYPos; +/*N*/ } +/*N*/ switch(nRow-nStart)//StockRects +/*N*/ { +/*N*/ case 0: +/*N*/ nLow=nYPos; +/*N*/ break; +/*N*/ case 3: +/*N*/ nHi=nYPos; +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if(bOK) +/*N*/ { +/*N*/ pObj = new SdrPathObj(OBJ_PLIN, aPolyStock); +/*N*/ pObj->InsertUserData(new SchObjectId (CHOBJID_DIAGRAM_STOCKLINE)); +/*N*/ pObj->InsertUserData(new SchDataCol((short)nCol)); +/*N*/ pLineList->NbcInsertObject(pObj,LIST_APPEND); +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes(*pStockLineAttr, FALSE); +/*N*/ pObj->SetItemSet(*pStockLineAttr); +/*N*/ +/*N*/ +/*N*/ if(HasStockRects()&&nRowCnt>3) +/*N*/ { +/*N*/ BOOL bLoss=TRUE; +/*N*/ if(nLow>nHi) +/*N*/ { +/*N*/ long nTmp=nLow; +/*N*/ nLow=nHi; +/*N*/ nHi=nTmp; +/*N*/ bLoss=FALSE; +/*N*/ } +/*N*/ +/*N*/ if(!pLossList&&bLoss) +/*N*/ { +/*N*/ pLossGroup =(SchObjGroup*)CreateSimpleGroup(CHOBJID_DIAGRAM_STOCKLOSS_GROUP,TRUE, TRUE); +/*N*/ pList->NbcInsertObject(pLossGroup); +/*N*/ pLossList = pLossGroup->GetSubList(); +/*N*/ } +/*N*/ if(!pPlusList && !bLoss) +/*N*/ { +/*N*/ pPlusGroup =(SchObjGroup*)CreateSimpleGroup(CHOBJID_DIAGRAM_STOCKPLUS_GROUP,TRUE, TRUE); +/*N*/ pList->NbcInsertObject(pPlusGroup); +/*N*/ pPlusList = pPlusGroup->GetSubList(); +/*N*/ } +/*N*/ pObj = new SdrRectObj(Rectangle(Point(pBar->BarLeft(),nLow),Size(pBar->BarWidth(),nHi-nLow))); +/*N*/ pObj->InsertUserData(new SchObjectId (CHOBJID_DIAGRAM_STOCKRECT)); +/*N*/ pObj->InsertUserData(new SchDataCol((short)nCol)); +/*N*/ if(bLoss) +/*N*/ { +/*N*/ pLossList->NbcInsertObject(pObj,LIST_APPEND); +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes(*pStockLossAttr, FALSE); +/*N*/ pObj->SetItemSet(*pStockLossAttr); +/*N*/ +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pPlusList->NbcInsertObject(pObj,LIST_APPEND); +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes(*pStockPlusAttr, FALSE); +/*N*/ pObj->SetItemSet(*pStockPlusAttr); +/*N*/ +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ +/*N*/ aBarY1.NextCol(); +/*N*/ aBarY2.NextCol(); +/*N*/ // nPos+=nXWidth; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ void ChartModel::DrawStockBars(SdrObjList* pList,const Rectangle& aRect) +/*N*/ { +/*N*/ const long nRow = 0; +/*N*/ +/*N*/ const SfxItemSet& rDataRowAttr = GetDataRowAttr(nRow); +/*N*/ +/*N*/ long nColCnt = GetColCount(); +/*N*/ +/*N*/ ChartBarDescriptor* pBar; +/*N*/ long nAxisUID=GetAxisUID(nRow); +/*N*/ switch(nAxisUID) +/*N*/ { +/*N*/ case CHART_AXIS_SECONDARY_Y: +/*N*/ aBarY2.Create(aRect,nColCnt,1); +/*N*/ pBar=&aBarY2; +/*N*/ break; +/*N*/ default: +/*N*/ aBarY1.Create(aRect,nColCnt,1); +/*N*/ pBar=&aBarY1; +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ +/*N*/ +/*N*/ SchObjGroup *pStatGroup=NULL; +/*N*/ +/*N*/ +/*N*/ if(GetRowCount()&&HasStockBars()) +/*N*/ { +/*N*/ SdrObjList* pDescrList = NULL; +/*N*/ +/*N*/ ChartAxis *pAxis=GetAxisByUID(((const SfxInt32Item &)rDataRowAttr.Get(SCHATTR_AXIS)).GetValue()); +/*N*/ long nCol; +/*N*/ +/*N*/ SdrObjList *pBarList; +/*N*/ +/*N*/ SdrObjList* pStatList = NULL; +/*N*/ +/*N*/ SchObjGroup *pBarGroup; +/*N*/ +/*N*/ pBarGroup =(SchObjGroup*)CreateSimpleGroup(CHOBJID_DIAGRAM_ROWGROUP,TRUE, TRUE); +/*N*/ pBarGroup->InsertUserData(new SchDataRow(nRow)); +/*N*/ +/*N*/ pList->NbcInsertObject(pBarGroup); +/*N*/ pBarList = pBarGroup->GetSubList(); +/*N*/ +/*N*/ //Statistik: +/*N*/ if ( ((const SfxBoolItem &) rDataRowAttr.Get (SCHATTR_STAT_AVERAGE)).GetValue ()) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if(!pStatList) +/*N*/ } +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ SfxItemSet aDataPointAttr(GetFullDataPointAttr(nCol,nRow)); +/*N*/ +/*N*/ +/*N*/ double fData = GetData(nCol,nRow,FALSE); +/*N*/ long nHi = pAxis->GetPos(fData); +/*N*/ long nLow= pAxis->GetPosOrigin(); +/*N*/ +/*N*/ if(fData != DBL_MIN) +/*N*/ { +/*N*/ Rectangle aObjRect(Point(pBar->BarLeft(),nLow),Size(pBar->BarWidth(),nHi-nLow)); +/*N*/ +/*N*/ pBarList->NbcInsertObject(CreateRect(aObjRect,nCol,nRow,aDataPointAttr)); +/*N*/ +/*N*/ if ((SvxChartKindError) +/*N*/ ((const SfxInt32Item &) aDataPointAttr.Get (SCHATTR_STAT_KIND_ERROR)).GetValue () != +/*N*/ CHERROR_NONE) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if(!pStatList) +/*N*/ } +/*N*/ +/*N*/ +/*N*/ // ***************************** Description ***************************** +/*N*/ SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&)aDataPointAttr. +/*N*/ Get(SCHATTR_DATADESCR_DESCR)).GetValue(); +/*N*/ +/*N*/ if((eDescr!=CHDESCR_NONE)&&bShowDataDescr) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 DataDescription aDescr; +/*N*/ } +/*N*/ // ************************* end description ******************************* +/*N*/ } +/*N*/ pBar->NextCol(); +/*N*/ // nPos+=nXWidth; +/*N*/ } +/*N*/ } +/*N*/ } + + +/*N*/ SdrObjGroup* ChartModel::Create2DRowLineChart(Rectangle aRect) +/*N*/ { +/*N*/ BOOL bPartDescr=FALSE; +/*N*/ if(HasStockLines()) +/*N*/ bPartDescr=TRUE; +/*N*/ +/*N*/ SchObjGroup *pGroup; +/*N*/ SdrObjList *pList; +/*N*/ CreateChartGroup (pGroup, pList); +/*N*/ BOOL bStacked = IsStacked(); +/*N*/ USHORT eStackMode = bStacked ? CHSTACK_OVERLAP : CHSTACK_NONE; +/*N*/ Create2DBackplane(aRect, *pList, bPartDescr, eStackMode); +/*N*/ +/*N*/ Rectangle aClipRect( aRect ); +/*N*/ aClipRect.Right() += 1; +/*N*/ aClipRect.Top() -= 1; +/*N*/ +/*N*/ SdrObject *pObj; +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ long nCol, nRow; +/*N*/ +/*N*/ BOOL bPercent = IsPercent(); +/*N*/ +/*N*/ //ToDo: XAchse-Logarithmus auf FALSE erzwingen (???) +/*N*/ +/*N*/ long nBackColCnt = (bPartDescr) ? nColCnt +1: nColCnt ; +/*N*/ +/*N*/ if (nColCnt > 1) +/*N*/ { +/*N*/ nBackColCnt--; +/*N*/ } +/*N*/ +/*N*/ long nPartWidth = aRect.GetWidth() / nBackColCnt; +/*N*/ double fPartWidth = ((double) aRect.GetWidth() / (double) nBackColCnt); +/*N*/ +/*N*/ SdrObjList** pRowLists = new SdrObjList*[nRowCnt]; +/*N*/ SdrObjList** pStatLists = new SdrObjList*[nRowCnt]; +/*N*/ +/*N*/ ChartDataDescription aDescr(nColCnt,nRowCnt,pList,this,bShowDataDescr); +/*N*/ +/*N*/ //Berechnung von nLegendHeigth: +/*N*/ Size aLegendSize (((SvxFontWidthItem &) pLegendAttr->Get(EE_CHAR_FONTWIDTH)).GetWidth(), +/*N*/ ((SvxFontHeightItem &) pLegendAttr->Get(EE_CHAR_FONTHEIGHT)).GetHeight()); +/*N*/ +/*N*/ //#54884# Was soll das hier? Create2DRowLineChart +/*N*/ OutputDevice * pRefDev = GetRefDevice(); +/*N*/ if(pRefDev) +/*N*/ aLegendSize = pRefDev->PixelToLogic (pRefDev->LogicToPixel (aLegendSize)); +/*N*/ else +/*N*/ DBG_ERROR("ChartModel: no RefDevice"); +/*N*/ +/*N*/ long nLegendHeight = aLegendSize.Height () * 9 / 10; +/*N*/ +/*N*/ Polygon aPolygon( nColCnt + 16 ); // +4 -> +16: let some more points be possible. Is set to exact size later +/*N*/ +/*N*/ //Ab hier speziell fuer (Sp)Line-Charts: +/*N*/ XPolygon *pSpline = new XPolygon(nColCnt * nGranularity); +/*N*/ +/*N*/ long nStartX=aRect.Left(); +/*N*/ if(bPartDescr) +/*N*/ nStartX+=nPartWidth/2; +/*N*/ +/*N*/ if(HasStockBars()) +/*N*/ DrawStockBars( pList, aRect ); +/*N*/ if(HasStockLines()) +/*N*/ DrawStockLines( pList, aRect ); +/*N*/ +/*N*/ long nStart=HasStockBars() ? 1: 0; +/*N*/ +/*N*/ long nAllObjects = pList->GetObjCount () - 1; +/*N*/ +/*N*/ for (nRow = nStart; nRow < nRowCnt; nRow++) +/*N*/ { +/*N*/ BOOL bArea=IsArea(nRow); +/*N*/ const SfxItemSet &rDataRowAttr = GetDataRowAttr(nRow); +/*N*/ long nAxisUId = ((const SfxInt32Item &)rDataRowAttr.Get(SCHATTR_AXIS)).GetValue(); +/*N*/ ChartAxis *pAxis=GetAxisByUID(nAxisUId); +/*N*/ +/*N*/ long nPos = nStartX; +/*N*/ double fPos = nStartX; +/*N*/ USHORT nPoints = 0; +/*N*/ +/*N*/ SchObjGroup *pRowGroup =(SchObjGroup*)CreateSimpleGroup(CHOBJID_DIAGRAM_ROWGROUP,TRUE, TRUE); +/*N*/ SchObjGroup *pStatGroup=(SchObjGroup*)CreateSimpleGroup(CHOBJID_DIAGRAM_STATISTICS_GROUP,TRUE,TRUE); +/*N*/ +/*N*/ pRowGroup->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ +/*N*/ if(bArea) +/*N*/ pList->NbcInsertObject(pRowGroup, nAllObjects); +/*N*/ else +/*N*/ pList->NbcInsertObject(pRowGroup); +/*N*/ +/*N*/ pRowLists[nRow] = pRowGroup->GetSubList(); +/*N*/ +/*N*/ pStatGroup->InsertUserData(new SchDataRow((short)nRow)); +/*N*/ pList->NbcInsertObject(pStatGroup); +/*N*/ pStatLists [nRow] = pStatGroup->GetSubList(); +/*N*/ +/*N*/ if( ! bStacked ) +/*N*/ { +/*N*/ if (((const SfxBoolItem &) rDataRowAttr.Get (SCHATTR_STAT_AVERAGE)).GetValue ()) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pList->NbcInsertObject (AverageValueY (nRow, FALSE, aRect, +/*N*/ } +/*N*/ +/*N*/ for (nCol = 0; nCol < nColCnt; nCol++) +/*N*/ { +/*N*/ SfxItemSet aDataPointAttr(rDataRowAttr);//#63904# +/*N*/ MergeDataPointAttr(aDataPointAttr,nCol,nRow); +/*N*/ +/*N*/ double fData = GetData(nCol, nRow, bPercent); +/*N*/ +/*N*/ BOOL bLogarithm = pAxis->IsLogarithm(); +/*N*/ BOOL bValidData=((fData!=DBL_MIN)&&(!bLogarithm||bLogarithm&&(fData>0.0))); +/*N*/ +/*N*/ if(!bValidData && bStacked) +/*N*/ { +/*N*/ fData = 0.0; +/*N*/ bValidData = TRUE; +/*N*/ } +/*N*/ +/*N*/ // *****************************end Data Valid? *************************** +/*N*/ +/*N*/ if (bValidData) +/*N*/ { +/*N*/ if(eStackMode != CHSTACK_NONE) +/*N*/ fData = pAxis->StackColData(fData,nCol,nColCnt); +/*N*/ +/*N*/ long nYPos = pAxis->GetPos(fData); +/*N*/ +/*N*/ aPolygon[nPoints].X() = nPos; +/*N*/ aPolygon[nPoints].Y() = nYPos; +/*N*/ +/*N*/ nPoints++; +/*N*/ +/*N*/ if (HasSymbols(nRow)) +/*N*/ { +/*N*/ +/*N*/ Point& rInsert = aPolygon[nPoints - 1]; +/*N*/ +/*N*/ if( aClipRect.IsInside( rInsert ) ) +/*N*/ { +/*N*/ SdrObject *pNewObj = CreateSymbol( rInsert, nRow, nCol, +/*N*/ (SfxItemSet &) aDataPointAttr, nLegendHeight ); +/*N*/ if(pNewObj) +/*N*/ { +/*N*/ pNewObj->InsertUserData(new SchObjectId(CHOBJID_DIAGRAM_DATA)); +/*N*/ pRowLists[nRow]->NbcInsertObject(pNewObj); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if (!bStacked) +/*N*/ { +/*N*/ if ((SvxChartKindError) +/*N*/ ((const SfxInt32Item &)aDataPointAttr.Get(SCHATTR_STAT_KIND_ERROR)).GetValue () != CHERROR_NONE) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 AverageErrorY(nRow,fData,aPolygon[nPoints -1],FALSE,aDataPointAttr,pStatLists[nRow],pAxis); +/*N*/ } +/*N*/ +/*N*/ if(aDescr.Enabled()) +/*N*/ { +/*N*/ Point aPos(aPolygon[nPoints-1]); +/*N*/ if(aPos.X() == aRect.Left()) +/*N*/ { +/*N*/ aPos.X()+=50; +/*N*/ aDescr.Insert(nCol,nRow,aDataPointAttr,aPos,FALSE,CHADJUST_BOTTOM_LEFT,pAxis); +/*N*/ } +/*N*/ else +/*N*/ aDescr.Insert(nCol,nRow,aDataPointAttr,aPos,FALSE,CHADJUST_BOTTOM_CENTER,pAxis); +/*N*/ } +/*N*/ // ************************* end description ******************************* +/*N*/ } +/*N*/ else if( bArea ) // invalid data, area +/*N*/ { +/*?*/ if(eStackMode != CHSTACK_NONE) +/*?*/ fData = pAxis->StackColData(fData,nCol,nColCnt); +/*?*/ long nYPos = pAxis->GetPos(0.0); +/*?*/ //fehlende Werte werden hier als 0 interpretiert - weglassen des BlockInhalts wäre Interpolation! +/*?*/ aPolygon[nPoints].X() = nPos; +/*?*/ aPolygon[nPoints].Y() = nYPos; +/*?*/ nPoints++; +/*N*/ } +/*N*/ else // invalid data, no area +/*N*/ { +/*?*/ if( nPoints ) +/*?*/ { +/*?*/ if( nPoints > 1 ) +/*?*/ { +/*?*/ if( IsSplineChart() ) +/*?*/ { +/*?*/ Polygon aNewPoly( nPoints ); +/*?*/ for( USHORT i = 0; i < nPoints; i++ ) +/*?*/ aNewPoly[ i ] = aPolygon[ i ]; +/*?*/ +/*?*/ XPolygon aXPoly( aNewPoly ); +/*?*/ if ((eChartStyle == CHSTYLE_2D_CUBIC_SPLINE) || +/*?*/ (eChartStyle == CHSTYLE_2D_CUBIC_SPLINE_SYMBOL)) +/*?*/ { +/*?*/ CubicSpline( aXPoly, nPoints - 1, nGranularity, *pSpline ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ approxMesh( nGranularity, *pSpline, aXPoly, nPoints - 1, nSplineDepth ); +/*?*/ } +/*?*/ +/*?*/ XPolygon aSplinePoly( *pSpline ); +/*?*/ aSplinePoly.SetSize( (nPoints - 1) * nGranularity ); +/*?*/ +/*?*/ // #67488# crop polygon +/*?*/ XPolyPolygon aResult; +/*?*/ SchCalculationHelper::IntersectPolygonWithRectangle( aSplinePoly, aClipRect, aResult ); +/*?*/ pObj = new SdrPathObj( OBJ_PLIN, aResult ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ Polygon aNewPoly( nPoints ); +/*?*/ for( USHORT i = 0; i < nPoints; i++ ) +/*?*/ aNewPoly[ i ] = aPolygon[ i ]; +/*?*/ +/*?*/ // #67488# crop polygon +/*?*/ XPolyPolygon aResult; +/*?*/ XPolygon aXPoly( aNewPoly ); +/*?*/ +/*?*/ SchCalculationHelper::IntersectPolygonWithRectangle( aXPoly, aClipRect, aResult ); +/*?*/ pObj = new SdrPathObj( OBJ_PLIN, aResult ); +/*?*/ } +/*?*/ +/*?*/ pObj->InsertUserData( new SchObjectId( CHOBJID_DIAGRAM_ROWSLINE )); +/*?*/ pObj->InsertUserData( new SchDataRow( (short)nRow )); +/*?*/ pRowLists[ nRow ]->NbcInsertObject( pObj, 0 ); //#54870# put line to background, so symbol is in front +/*?*/ +/*?*/ //-/ pObj->NbcSetAttributes( rDataRowAttr, FALSE ); +/*?*/ pObj->SetItemSet( rDataRowAttr); +/*?*/ +/*?*/ } +/*?*/ } +/*?*/ nPoints = 0; +/*N*/ } +/*N*/ +/*N*/ fPos += fPartWidth; +/*N*/ nPos = long(fPos); +/*N*/ } //for nCol +/*N*/ +/*N*/ if( nPoints ) +/*N*/ { +/*N*/ pObj = NULL; +/*N*/ +/*N*/ if( IsSplineChart() ) +/*N*/ { +/*N*/ if( nPoints > 1 ) +/*N*/ { +/*N*/ Polygon aNewPoly( nPoints ); +/*N*/ for( USHORT i = 0; i < nPoints; i++ ) +/*N*/ aNewPoly[ i ] = aPolygon[ i ]; +/*N*/ +/*N*/ XPolygon aXPoly( aNewPoly ); +/*N*/ if ((eChartStyle == CHSTYLE_2D_CUBIC_SPLINE) || +/*N*/ (eChartStyle == CHSTYLE_2D_CUBIC_SPLINE_SYMBOL)) +/*N*/ { +/*N*/ CubicSpline( aXPoly, nPoints - 1,nGranularity, *pSpline ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ approxMesh( nGranularity, *pSpline, aXPoly, nPoints - 1, nSplineDepth ); +/*N*/ } +/*N*/ +/*N*/ XPolygon aSplinePoly( *pSpline ); +/*N*/ aSplinePoly.SetSize( (nPoints - 1) * nGranularity ); +/*N*/ +/*N*/ // #67488# crop polygon +/*N*/ XPolyPolygon aResult; +/*N*/ SchCalculationHelper::IntersectPolygonWithRectangle( aSplinePoly, aClipRect, aResult ); +/*N*/ pObj = new SdrPathObj( OBJ_PLIN, aResult ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if( bArea ) +/*N*/ { +/*N*/ Polygon aNewPoly( nPoints + 3 ); +/*N*/ for( USHORT i = 0; i < nPoints + 3; i++ ) +/*N*/ aNewPoly[ i ] = aPolygon[ i ]; +/*N*/ XPolygon aBase( 2 ); +/*N*/ +/*N*/ pAxis->GridLine( aBase, pAxis->GetPosOrigin() ); +/*N*/ aNewPoly[ nPoints ] = aBase[ 1 ]; +/*N*/ aNewPoly[ nPoints + 1 ] = aBase[ 0 ]; +/*N*/ aNewPoly[ nPoints + 2 ] = aNewPoly[ 0 ]; +/*N*/ +/*N*/ // #67488# crop polygon +/*N*/ aNewPoly.Clip( aClipRect ); +/*N*/ XPolygon aXPoly( aNewPoly ); +/*N*/ +/*N*/ pObj = new SdrPathObj( OBJ_POLY, aXPoly ); +/*N*/ pObj->SetModel( this ); +/*N*/ SetObjectAttr( pObj,CHOBJID_DIAGRAM_ROWS, TRUE, TRUE, (SfxItemSet *)&rDataRowAttr ); +/*N*/ } +/*N*/ else if( nPoints > 1 ) // line +/*N*/ { +/*N*/ // #67488# crop polygon +/*N*/ Polygon aNewPoly( nPoints ); +/*N*/ for( USHORT i = 0; i < nPoints; i++ ) +/*N*/ aNewPoly[ i ] = aPolygon[ i ]; +/*N*/ +/*N*/ XPolyPolygon aResult; +/*N*/ XPolygon aXPoly( aNewPoly ); +/*N*/ +/*N*/ SchCalculationHelper::IntersectPolygonWithRectangle( aXPoly, aClipRect, aResult ); +/*N*/ pObj = new SdrPathObj( OBJ_PLIN, aResult ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if( pObj ) +/*N*/ { +/*N*/ pObj->InsertUserData( new SchObjectId( CHOBJID_DIAGRAM_ROWSLINE )); +/*N*/ +/*N*/ //-/ pObj->NbcSetAttributes( rDataRowAttr, FALSE ); +/*N*/ pObj->SetItemSet( rDataRowAttr); +/*N*/ +/*N*/ pObj->InsertUserData( new SchDataRow( (short)nRow )); +/*N*/ +/*N*/ if( ! bArea || (bArea && IsStacked()) ) +/*N*/ pRowLists[ nRow ]->NbcInsertObject( pObj, 0 ); +/*N*/ else +/*N*/ pRowLists[ nRow ]->NbcInsertObject( pObj ); +/*N*/ } +/*N*/ } // if( nPoints ) +/*N*/ } //for nRow +/*N*/ +/*N*/ delete pSpline; +/*N*/ +/*N*/ //Ab hier wieder wie in Create2DRow(Area)Chart: +/*N*/ +/*N*/ aDescr.Build(TRUE); +/*N*/ delete[] pRowLists; +/*N*/ delete[] pStatLists; +/*N*/ return pGroup; +/*N*/ } + +/*N*/ bool ChartModel::UsesSourceFormat( long nAxisUID, SfxItemSet** pItemSetPointer /* = NULL */ ) +/*N*/ { +/*N*/ const SfxPoolItem* pPoolItem = NULL; +/*N*/ ChartAxis* pAxis = NULL; +/*N*/ SfxItemSet* pItemSet = NULL; +/*N*/ +/*N*/ if( ( pAxis = GetAxisByUID( nAxisUID )) && +/*N*/ ( pItemSet = pAxis->GetItemSet())) +/*N*/ { +/*N*/ if( pItemSetPointer ) +/*N*/ *pItemSetPointer = pItemSet; +/*N*/ +/*N*/ // return true if item is not set (default) or it is set to TRUE +/*N*/ return ( ( SFX_ITEM_SET != +/*N*/ pItemSet->GetItemState( SID_ATTR_NUMBERFORMAT_SOURCE, FALSE, &pPoolItem )) || +/*N*/ ( SAL_STATIC_CAST( const SfxBoolItem*, pPoolItem )->GetValue() == TRUE )); +/*N*/ } +/*N*/ +/*N*/ return false; +/*N*/ } + +// checks if the numberformat was set in MemChart (by Calc/Writer) +// if this is the case the axis attributes are overwritten and TRUE is returned +/*N*/ BOOL ChartModel::CheckForNewAxisNumFormat() +/*N*/ { +/*N*/ // Don't set the numberformater for a percent chart. +/*N*/ // or when formats are not set from the outside +/*N*/ if ( IsPercentChart() || +/*N*/ UsesOwnNumberFormatter() ) +/*N*/ return FALSE; +/*N*/ +/*N*/ // if source format is used, update +/*N*/ const SfxPoolItem* pPoolItem = NULL; +/*N*/ SfxItemSet* pItemSet = NULL; +/*N*/ SfxItemSet* pItemSetA = NULL; +/*N*/ bool bRet = false; +/*N*/ long nRow = 0; +/*N*/ INT32 nFmt = -1; +/*N*/ USHORT nSchattr = IsPercentChart() +/*N*/ ? SCHATTR_AXIS_NUMFMTPERCENT +/*N*/ : SCHATTR_AXIS_NUMFMT; +/*N*/ +/*N*/ // x axis +/*N*/ if( IsXYChart()) +/*N*/ { +/*N*/ bool bXUsesSrcFmt = UsesSourceFormat( CHAXIS_AXIS_X, &pItemSet ); +/*N*/ bool bAUsesSrcFmt = UsesSourceFormat( CHAXIS_AXIS_A, &pItemSetA ); +/*N*/ if( bXUsesSrcFmt || bAUsesSrcFmt ) +/*N*/ { +/*N*/ // use source format for x-axis +/*N*/ nFmt = IsDataSwitched() +/*N*/ ? pChartData->GetTransNumFormatIdCol( nRow ) +/*N*/ : pChartData->GetTransNumFormatIdRow( nRow ); +/*N*/ } +/*N*/ +/*N*/ if( bXUsesSrcFmt && pItemSet && nFmt != -1 ) +/*N*/ { +/*N*/ pItemSet->Put( SfxUInt32Item( nSchattr, nFmt )); +/*N*/ bRet = true; +/*N*/ nXLastNumFmt = nFmt; // for binary file format only +/*N*/ } +/*N*/ if( bAUsesSrcFmt && pItemSetA && nFmt != -1 ) +/*N*/ { +/*N*/ pItemSetA->Put( SfxUInt32Item( nSchattr, nFmt )); +/*N*/ bRet = true; +/*N*/ nXLastNumFmt = nFmt; +/*N*/ } +/*N*/ nRow++; +/*N*/ } +/*N*/ +/*N*/ if( HasSecondYAxis() ) // check both y axes +/*N*/ { +/*N*/ // seek first series using second axis +/*N*/ bool bYAxisFound = false; +/*N*/ bool bBAxisFound = false; +/*N*/ long nMaxRow = GetRowCount(); +/*N*/ +/*N*/ for( ; nRow < nMaxRow; nRow++ ) +/*N*/ { +/*N*/ if( ! bBAxisFound && +/*N*/ SFX_ITEM_SET == +/*N*/ GetDataRowAttr( nRow ).GetItemState( SCHATTR_AXIS, FALSE, &pPoolItem ) && +/*N*/ SAL_STATIC_CAST( const SfxInt32Item*, pPoolItem )->GetValue() == CHART_AXIS_SECONDARY_Y ) +/*N*/ { +/*N*/ if( UsesSourceFormat( CHAXIS_AXIS_B, &pItemSet ) && +/*N*/ pItemSet ) +/*N*/ { +/*N*/ // use source format for secondary y-axis +/*N*/ nFmt = IsDataSwitched() +/*N*/ ? pChartData->GetTransNumFormatIdCol( nRow ) +/*N*/ : pChartData->GetTransNumFormatIdRow( nRow ); +/*N*/ +/*N*/ if( nFmt != -1 ) +/*N*/ { +/*N*/ pItemSet->Put( SfxUInt32Item( nSchattr, nFmt )); +/*N*/ bRet = true; +/*N*/ nBLastNumFmt = nFmt; // for binary file format only +/*N*/ } +/*N*/ } +/*N*/ bBAxisFound = true; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ if( ! bYAxisFound && +/*N*/ UsesSourceFormat( CHAXIS_AXIS_Y, &pItemSet ) && +/*N*/ pItemSet ) +/*N*/ { +/*N*/ // use source format for primary y-axis +/*N*/ nFmt = IsDataSwitched() +/*N*/ ? pChartData->GetTransNumFormatIdCol( nRow ) +/*N*/ : pChartData->GetTransNumFormatIdRow( nRow ); +/*N*/ +/*N*/ if( nFmt != -1 ) +/*N*/ { +/*N*/ pItemSet->Put( SfxUInt32Item( nSchattr, nFmt )); +/*N*/ bRet = true; +/*N*/ nYLastNumFmt = nFmt; // for binary file format only +/*N*/ } +/*N*/ } +/*N*/ bYAxisFound = true; +/*N*/ } +/*N*/ +/*N*/ if( bYAxisFound && bBAxisFound ) +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // get first setting +/*N*/ if( nRow < GetRowCount() && +/*N*/ UsesSourceFormat( CHAXIS_AXIS_Y, &pItemSet ) && +/*N*/ pItemSet ) +/*N*/ { +/*N*/ nFmt = IsDataSwitched() +/*N*/ ? pChartData->GetTransNumFormatIdCol( nRow ) +/*N*/ : pChartData->GetTransNumFormatIdRow( nRow ); +/*N*/ +/*N*/ if( nFmt != -1 ) +/*N*/ { +/*N*/ pItemSet->Put( SfxUInt32Item( nSchattr, nFmt )); +/*N*/ bRet = true; +/*N*/ nYLastNumFmt = nFmt; // for binary file format only +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } + +/*N*/ BOOL ChartModel::HasDefaultGrayArea( SvxChartStyle* pStyle ) const +/*N*/ { +/*N*/ SvxChartStyle eStyle = pStyle? *pStyle: eChartStyle; +/*N*/ +/*N*/ switch( eStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_NET: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS: +/*N*/ case CHSTYLE_2D_NET_STACK: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_STACK: +/*N*/ case CHSTYLE_2D_NET_PERCENT: +/*N*/ case CHSTYLE_2D_NET_SYMBOLS_PERCENT: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +/*N*/ BOOL ChartModel::HasDefaultGrayWall( SvxChartStyle* pStyle ) const +/*N*/ { +/*N*/ SvxChartStyle eStyle = pStyle? *pStyle: eChartStyle; +/*N*/ +/*N*/ switch( eStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_LINE: +/*N*/ case CHSTYLE_2D_STACKEDLINE: +/*N*/ case CHSTYLE_2D_PERCENTLINE: +/*N*/ case CHSTYLE_2D_XY: +/*N*/ case CHSTYLE_2D_LINESYMBOLS: +/*N*/ case CHSTYLE_2D_STACKEDLINESYM: +/*N*/ case CHSTYLE_2D_PERCENTLINESYM: +/*N*/ case CHSTYLE_2D_XYSYMBOLS: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_B_SPLINE: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_XY: +/*N*/ case CHSTYLE_2D_CUBIC_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_B_SPLINE_XY: +/*N*/ case CHSTYLE_2D_B_SPLINE_SYMBOL_XY: +/*N*/ case CHSTYLE_2D_XY_LINE: +/*N*/ return TRUE; +/*N*/ +/*N*/ default: +/*N*/ return FALSE; +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +/*N*/ using namespace ::com::sun::star; + +/*N*/ void ChartModel::SetNumberFormatter( SvNumberFormatter* pFormatter ) +/*N*/ { +/*N*/ pNumFormatter = pFormatter; +/*N*/ +/*N*/ pChartXAxis->SetNumberFormatter( pNumFormatter ); +/*N*/ pChartYAxis->SetNumberFormatter( pNumFormatter ); +/*N*/ pChartZAxis->SetNumberFormatter( pNumFormatter ); +/*N*/ pChartAAxis->SetNumberFormatter( pNumFormatter ); +/*N*/ pChartBAxis->SetNumberFormatter( pNumFormatter ); +/*N*/ +/*N*/ // update UNO Numberformatter Wrapper +/*N*/ SfxObjectShell* pMyDocShell = GetObjectShell(); +/*N*/ if( pMyDocShell != NULL ) +/*N*/ { +/*N*/ ChXChartDocument* pUnoDoc = ChXChartDocument::getImplementation( pMyDocShell->GetModel()); +/*N*/ DBG_ASSERT( pUnoDoc, "Couldn't get XModel implementation" ); +/*N*/ if( pUnoDoc != NULL ) +/*N*/ { +/*N*/ // invalidate old number formatter +/*N*/ pUnoDoc->ClearNumberFormatter(); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ void ChartModel::TranslateAllNumFormatIds( SvNumberFormatterIndexTable* pTransTable ) +/*N*/ { +/*N*/ if( pChartXAxis->TranslateMergedNumFormat( pTransTable ) && +/*N*/ nXLastNumFmt >= 0 ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 nXLastNumFmt = pChartXAxis->GetNumFormat(); +/*N*/ +/*N*/ if( pChartYAxis->TranslateMergedNumFormat( pTransTable ) && +/*N*/ nYLastNumFmt >= 0 ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 nYLastNumFmt = pChartYAxis->GetNumFormat(); +/*N*/ +/*N*/ pChartZAxis->TranslateMergedNumFormat( pTransTable ); +/*N*/ pChartAAxis->TranslateMergedNumFormat( pTransTable ); +/*N*/ +/*N*/ if( pChartBAxis->TranslateMergedNumFormat( pTransTable ) && +/*N*/ nBLastNumFmt >= 0 ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 nBLastNumFmt = pChartBAxis->GetNumFormat(); +/*N*/ } + +/*N*/ void ChartModel::SetNumLinesColChart(const long nSet, BOOL bForceStyleChange) +/*N*/ { +/*N*/ const long nOldNumLines = nNumLinesInColChart; +/*N*/ const long nLastSeries = GetRowCount() - 1; +/*N*/ +/*N*/ switch( eChartStyle ) +/*N*/ { +/*N*/ case CHSTYLE_2D_COLUMN: // only types supporting mixing with lines +/*N*/ case CHSTYLE_2D_STACKEDCOLUMN: +/*N*/ case CHSTYLE_2D_PERCENTCOLUMN: +/*N*/ case CHSTYLE_2D_LINE_COLUMN: +/*N*/ case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ if( bForceStyleChange ) +/*N*/ { +/*N*/ if( nSet <= 0 ) +/*N*/ { +/*N*/ nNumLinesInColChart = 0; +/*N*/ if( eChartStyle == CHSTYLE_2D_LINE_COLUMN ) +/*?*/ eChartStyle = CHSTYLE_2D_COLUMN; +/*N*/ else if( eChartStyle == CHSTYLE_2D_LINE_STACKEDCOLUMN ) +/*?*/ eChartStyle = CHSTYLE_2D_STACKEDCOLUMN; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nNumLinesInColChart = nSet; +/*N*/ +/*N*/ if( eChartStyle == CHSTYLE_2D_COLUMN ) +/*N*/ eChartStyle = CHSTYLE_2D_LINE_COLUMN; +/*N*/ else if( eChartStyle == CHSTYLE_2D_STACKEDCOLUMN ) +/*?*/ eChartStyle = CHSTYLE_2D_LINE_STACKEDCOLUMN; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nNumLinesInColChart = nSet > 0 ? nSet : 0; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ // DBG_ASSERT( nSet == 0, "Trying to set number of lines to value >0 for wrong chart type" ); +/*N*/ nNumLinesInColChart = nSet > 0 ? nSet : 0; +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ // #101164# map fill-/line colors +/*N*/ if( nNumLinesInColChart > nOldNumLines ) +/*N*/ { +/*N*/ for( int i = nOldNumLines ; +/*N*/ i < nNumLinesInColChart && i < nLastSeries ; +/*N*/ ++i ) +/*N*/ { +/*N*/ SfxItemSet * pSet = aDataRowAttrList.GetObject( nLastSeries - i ); +/*N*/ OSL_ASSERT( pSet ); +/*N*/ pSet->Put( XLineColorItem( +/*N*/ String(), +/*N*/ static_cast< const XFillColorItem & >( +/*N*/ pSet->Get( XATTR_FILLCOLOR )).GetValue() )); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ for( int i = nNumLinesInColChart ; +/*N*/ i < nOldNumLines && i < nLastSeries ; +/*N*/ ++i ) +/*N*/ { +/*?*/ SfxItemSet * pSet = aDataRowAttrList.GetObject( nLastSeries - i ); +/*?*/ OSL_ASSERT( pSet ); +/*?*/ pSet->Put( XFillColorItem( +/*?*/ String(), +/*?*/ static_cast< const XLineColorItem & >( +/*?*/ pSet->Get( XATTR_LINECOLOR )).GetValue() )); +/*?*/ pSet->Put( XLineColorItem( String(), RGBColor( COL_BLACK ) )); +/*N*/ } +/*N*/ } +/*N*/ } + +/*N*/ BOOL ChartModel::SetObjectShell( SfxObjectShell* pDocSh ) +/*N*/ { +/*N*/ if( ! pDocShell ) +/*N*/ { +/*N*/ pDocShell = pDocSh; +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +/*N*/ using namespace ::com::sun::star; + +/*N*/ void ChartModel::SetChartAddIn( uno::Reference< util::XRefreshable >& xChartAddIn ) +/*N*/ { +/*N*/ if( xChartAddIn.is()) +/*N*/ { +/*N*/ // acquire add-in +/*?*/ mxChartAddIn = xChartAddIn; +/*?*/ ChangeChart( CHSTYLE_ADDIN ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // release add-in +/*N*/ mxChartAddIn = NULL; +/*N*/ // if base type was not set, use default +/*N*/ if( eChartStyle == CHSTYLE_ADDIN ) +/*?*/ ChangeChart( CHSTYLE_2D_BAR ); +/*N*/ } +/*N*/ } + + +/*N*/ void ChartModel::HandsOff() +/*N*/ { +/*N*/ mxPictureStorage = SotStorageRef(); +/*N*/ mpDocStor = NULL; +/*N*/ } + + +/*N*/ uno::Sequence< uno::Sequence< sal_Int32 > > ChartModel::GetSetDataPointList() +/*N*/ { +/*N*/ const ItemSetList & rAttrList = IsDataSwitched() +/*N*/ ? aSwitchDataPointAttrList +/*N*/ : aDataPointAttrList; +/*N*/ const long nSize = rAttrList.Count(); +/*N*/ long nRow, nCol; +/*N*/ long nColCnt = GetColCount(); +/*N*/ long nRowCnt = GetRowCount(); +/*N*/ +/*N*/ DBG_ASSERT( nSize == ( nRowCnt * nColCnt ), "Data-Point list has invalid size!" ); +/*N*/ +/*N*/ // the 'outer' sequence contains one sequence for each series +/*N*/ uno::Sequence< uno::Sequence< sal_Int32 > > aResult( nRowCnt ); +/*N*/ +/*N*/ // here we need again a special treatment for pie charts as a single pie +/*N*/ // uses merged data point and data row attributes the data points are also +/*N*/ // set if data row attributes are set, which is always the case +/*N*/ if( IsPieChart()) +/*N*/ { +/*N*/ aResult[ 0 ].realloc( nColCnt ); +/*N*/ sal_Int32 * pArray = aResult[ 0 ].getArray(); +/*N*/ +/*N*/ for( nCol = 0; nCol < nColCnt; ++nCol ) +/*N*/ pArray[ nCol ] = nCol; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // use a vector for quick dynamic resizing +/*N*/ ::std::list< sal_Int32 > aList; +/*N*/ +/*N*/ for( nRow = 0; nRow < nRowCnt; ++nRow ) +/*N*/ { +/*N*/ for( nCol = 0; nCol < nColCnt; ++nCol ) +/*N*/ { +/*N*/ if( rAttrList.GetObject( nCol * nRowCnt + nRow ) != NULL ) +/*N*/ aList.push_back( nCol ); +/*N*/ } +/*N*/ +/*N*/ if( aList.size() > 0 ) +/*N*/ { +/*N*/ // copy list to 'inner' sequence +/*N*/ aResult[ nRow ].realloc( aList.size()); +/*N*/ sal_Int32 * pArray = aResult[ nRow ].getArray(); +/*N*/ sal_Int32 i = 0; +/*N*/ ::std::list< sal_Int32 >::iterator aIter; +/*N*/ for( aIter = aList.begin(); aIter != aList.end(); ++aIter ) +/*N*/ { +/*N*/ pArray[ i++ ] = (*aIter); +/*N*/ } +/*N*/ aList.clear(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return aResult; +/*N*/ } + +/*N*/ void ChartModel::PageColorChanged( const SfxItemSet& rItems ) +/*N*/ { +/*N*/ Color aColor; +/*N*/ +/*N*/ // GetDraftFillColor is defined in bf_svx/svdetc.hxx +/*N*/ if( GetDraftFillColor( rItems, aColor )) +/*N*/ { +/*N*/ SdrOutliner * pOut = GetOutliner(); +/*N*/ if( pOut ) +/*N*/ pOut->SetBackgroundColor( aColor ); +/*N*/ GetDrawOutliner().SetBackgroundColor( aColor ); +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtmodel.cxx b/binfilter/bf_sch/source/core/sch_chtmodel.cxx new file mode 100644 index 000000000000..1af1da68db38 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtmodel.cxx @@ -0,0 +1,1318 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifdef _MSC_VER +#pragma optimize("e",off) + +#pragma hdrstop +#endif + +class SbxArray; + +#include <bf_svx/svdoutl.hxx> + +#include "itempool.hxx" + +#include <bf_svx/svdpage.hxx> + +#include <bf_svx/svdetc.hxx> + +#include <bf_svx/eeitem.hxx> +#include <bf_sfx2/app.hxx> +#ifndef _ZFORLIST_HXX +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif +#include <bf_svx/svdorect.hxx> +#include <bf_svx/xlnclit.hxx> +#include <bf_svx/xlnwtit.hxx> +#include <bf_svx/xflclit.hxx> +#include "schattr.hxx" +#include "memchrt.hxx" + +#ifndef _SVX_CHRTITEM_HXX +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#define ITEMID_LANGUAGE EE_CHAR_LANGUAGE + +#include <bf_svtools/eitem.hxx> + +#include <bf_svx/chrtitem.hxx> +#endif + +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#include <bf_svx/fontitem.hxx> +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/colritem.hxx> +#include <bf_svx/svxids.hrc> +#include <i18npool/lang.h> + +#include <bf_svx/xlineit0.hxx> + +// header for LinguMgr +#include <bf_svx/unolingu.hxx> +// header for class SvtLinguConfig +#include <bf_svtools/lingucfg.hxx> +// header for getProcessServiceFactory +#include <comphelper/processfactory.hxx> + +#ifndef _CHTMODEL_HXX +#include <chtmodel.hxx> +#include <globfunc.hxx> +#endif +#include "schattr.hxx" +#include "charttyp.hxx" + +#include "float.h" + + +#include "pairs.hxx" +#include "stlpool.hxx" +#include "schresid.hxx" +#include "glob.hrc" + +#include "datalog.hxx" +#include "chaxis.hxx" + +#include "chtscene.hxx" +#include "bf_svx/def3d.hxx" + +#include "docshell.hxx" +#include <com/sun/star/chart/ChartDataChangeEvent.hpp> +#include <bf_svx/unolingu.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <bf_svx/langitem.hxx> +#include <bf_svtools/undo.hxx> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::linguistic2; + +#define LINGUPROP_DEFLOCALE "DefaultLocale" +#define LINGUPROP_CJKLOCALE "DefaultLocale_CJK" +#define LINGUPROP_CTLLOCALE "DefaultLocale_CTL" + + +/************************************************************************/ + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +using namespace ::com::sun::star; + +/*N*/ ChartModel::ChartModel( const String& rPalettePath, SfxObjectShell* pDocSh ) : +/*N*/ pChartDataBuffered(NULL), +/*N*/ pAutoPilot(NULL),//#46895# +/*N*/ bClearDepth(FALSE), +/*N*/ bNewOrLoadCompleted(FALSE),//aus SchChartDocument:: +/*N*/ nChartStatus( CHS_USER_QUERY ), +/*N*/ SdrModel( rPalettePath, NULL, SAL_STATIC_CAST( SvPersist*, pDocSh )), +/*N*/ aChartRect (Rectangle ()), +/*N*/ aInitialSize (Size ()), +/*N*/ bTextScalable (TRUE), +/*N*/ bIsCopied (FALSE), +/*N*/ bLegendVisible (TRUE), +/*N*/ bShowAverage (FALSE), +/*N*/ eErrorKind (CHERROR_NONE), +/*N*/ eIndicate (CHINDICATE_NONE), +/*N*/ eRegression (CHREGRESS_NONE), +/*N*/ fIndicatePercent (0.0), +/*N*/ fIndicateBigError (0.0), +/*N*/ fIndicatePlus (0.0), +/*N*/ fIndicateMinus (0.0), +/*N*/ nSplineDepth (3), +/*N*/ nGranularity (20), +/*N*/ bSwitch3DColRow (FALSE), // FG: reiner Zwischenspeicher, damit die ChartScene das nicht als Parameter bekommt +/*N*/ // ist immer gleich bSwitchRowCol, das aber wird durchs Chart als Parameter +/*N*/ // durchgereicht. +/*N*/ pChItemPool (new SchItemPool), +/*N*/ pScene (0), +/*N*/ aLightVec (new Vector3D (1, 1, 1)), // old: aLightVec (new Vector3D (0, 0, 1)), +/*N*/ pChartData (0), +/*N*/ fMinData (0.0), +/*N*/ fMaxData (0.0), +/*N*/ fAmbientIntensity(0.6), +/*N*/ aAmbientColor(RGBColor(COL_WHITE)), +/*N*/ fSpotIntensity (0.6), +/*N*/ aSpotColor(RGBColor(COL_WHITE)), +/*N*/ eChartStyle (CHSTYLE_2D_COLUMN), +/*N*/ eOldChartStyle (CHSTYLE_3D_XYZSYMBOLS), +/*N*/ pDefaultColors (0), +/*N*/ nMarkLen (100), +/*N*/ nPieHeight (20), +/*N*/ pPieSegOfs (0), +/*N*/ nPieSegCount (0), +/*N*/ nXAngle (100), // old: nXAngle (200), +/*N*/ nYAngle (250), // old: nYAngle (350), +/*N*/ nZAngle (0), +/*N*/ bCanRebuild (TRUE), +/*N*/ bShowMainTitle (TRUE), +/*N*/ aMainTitle (String ()), +/*N*/ bShowSubTitle (FALSE), +/*N*/ aSubTitle (String ()), +/*N*/ bShowXAxisTitle (FALSE), +/*N*/ aXAxisTitle (String ()), +/*N*/ bShowYAxisTitle (FALSE), +/*N*/ aYAxisTitle (String ()), +/*N*/ bShowZAxisTitle (FALSE), +/*N*/ aZAxisTitle (String ()), +/*N*/ bShowXGridMain (TRUE), +/*N*/ bShowXGridHelp (FALSE), +/*N*/ bShowYGridMain (FALSE), +/*N*/ bShowYGridHelp (FALSE), +/*N*/ bShowZGridMain (FALSE), +/*N*/ bShowZGridHelp (FALSE), +/*N*/ eDataDescr (CHDESCR_NONE), +/*N*/ bShowSym (FALSE), +/*N*/ bSwitchData (TRUE), +/*N*/ bNoBuildChart( FALSE ), +/*N*/ bShouldBuildChart( TRUE ), +/*N*/ bReadError (FALSE), +/*N*/ mbIsInitialized(FALSE), +/*N*/ pOwnNumFormatter(FALSE), +/*N*/ pOutliner(NULL), +/*N*/ // FG: nMoreData >=12 +/*N*/ bFormatXAxisTextInMultipleLinesIfNecessary (TRUE), +/*N*/ bFormatYAxisTextInMultipleLinesIfNecessary (FALSE), +/*N*/ bFormatZAxisTextInMultipleLinesIfNecessary (FALSE), +/*N*/ bFormatLegendTextInMultipleLinesIfNecessary (TRUE), +/*N*/ // FG: nMoreData >=13 +/*N*/ nXAxisTextMaximumNumberOfLines(2), +/*N*/ nYAxisTextMaximumNumberOfLines(1), +/*N*/ nZAxisTextMaximumNumberOfLines(1), +/*N*/ nWidthOfFirstXAxisText (0), +/*N*/ nWidthOfLastXAxisText (0), +/*N*/ aTitleTopCenter(-1,-1), +/*N*/ aSubTitleTopCenter(-1,-1), +/*N*/ aDiagramRectangle(-1,-1,-1,-1), +/*N*/ aLastDiagramRectangle(-1,-1,-1,-1), +/*N*/ aLegendTopLeft(-1,-1), +/*N*/ aTitleXAxisPosition (-1,-1), +/*N*/ eAdjustXAxesTitle(CHADJUST_TOP_CENTER), +/*N*/ aTitleYAxisPosition(-1,-1), +/*N*/ eAdjustYAxesTitle(CHADJUST_TOP_CENTER), +/*N*/ aTitleZAxisPosition (-1,-1), +/*N*/ eAdjustZAxesTitle(CHADJUST_TOP_CENTER), +/*N*/ bUseRelativePositionsForChartGroups(FALSE), +/*N*/ bAdjustMarginsForLegend(TRUE), +/*N*/ bAdjustMarginsForMainTitle(TRUE), +/*N*/ bAdjustMarginsForSubTitle(TRUE), +/*N*/ bAdjustMarginsForXAxisTitle(TRUE), +/*N*/ bAdjustMarginsForYAxisTitle(TRUE), +/*N*/ bAdjustMarginsForZAxisTitle(TRUE), +/*N*/ bDiagramHasBeenMovedOrResized(FALSE), +/*N*/ bMainTitleHasBeenMoved(FALSE), +/*N*/ bSubTitleHasBeenMoved(FALSE), +/*N*/ bLegendHasBeenMoved(FALSE), +/*N*/ bXAxisTitleHasBeenMoved(FALSE), +/*N*/ bYAxisTitleHasBeenMoved(FALSE), +/*N*/ bZAxisTitleHasBeenMoved(FALSE), +/*N*/ aInitialSizefor3d (-1,-1), // FG: Zwischenspeicher fuer InitalSize (siehe chtmod3d.cxx, Position3DAxisTitles +/*N*/ pTestTextObj(NULL), // FG: fuer GetHeightOfnRows, ein Dummy-Textpointer +/*N*/ pLogBook(NULL), +/*N*/ bShowDataDescr(TRUE), +/*N*/ +/*N*/ pDocShell(pDocSh), //aus SchChartDocument:: +/*N*/ // bFreshLoaded (FALSE), +/*N*/ m_nDefaultColorSet(0), //#50037# +/*N*/ nBarPercentWidth(100), //#50116# +/*N*/ nNumLinesInColChart(0), //#50212# +/*N*/ bAttrAutoStorage(FALSE), +/*N*/ pChartRefOutDev(NULL), +/*N*/ pChartXAxis(NULL), +/*N*/ pChartYAxis(NULL), +/*N*/ pChartZAxis(NULL), +/*N*/ pChartBAxis(NULL), +/*N*/ pChartAAxis(NULL), +/*N*/ pTmpXItems(NULL), +/*N*/ pTmpYItems(NULL), +/*N*/ pTmpZItems(NULL), +/*N*/ pSdrObjList(NULL), +/*N*/ eProjection(PR_PERSPECTIVE), +/*N*/ bResizePie(TRUE), +/*N*/ nPieRadius(0), +/*N*/ pNumFormatter(NULL), +/*N*/ nXLastNumFmt(-1), +/*N*/ nYLastNumFmt(-1), +/*N*/ nBLastNumFmt(-1), +/*N*/ eLanguage( LANGUAGE_SYSTEM ), +/*N*/ eLanguageCJK( LANGUAGE_SYSTEM ), +/*N*/ eLanguageCTL( LANGUAGE_SYSTEM ), +/*N*/ mpDocStor( NULL ), +/*N*/ m_pUndoActionFromDraw(NULL), +/*N*/ m_bDeleteUndoActionNotificationFromDraw(TRUE) +/*N*/ { +/*N*/ SdrModel::SetNotifyUndoActionHdl(LINK( this, ChartModel, NotifyUndoActionHdl )); +/*N*/ +/*N*/ if( pDocSh != NULL ) +/*N*/ { +/*N*/ // enable swapping of metafiles and bitmaps that +/*N*/ // might be in a chart as additional objects +/*N*/ SetSwapGraphics( TRUE ); +/*N*/ } +/*N*/ +/*N*/ aLightVec->Normalize (); +/*N*/ +/*N*/ SetScaleUnit(MAP_100TH_MM); +/*N*/ SetScaleFraction(Fraction(1, 1)); +/*N*/ SetDefaultFontHeight(847); // 24pt +/*N*/ +/*N*/ SfxItemPool* pPool = &GetItemPool(); +/*N*/ pPool->SetDefaultMetric(SFX_MAPUNIT_100TH_MM); +/*N*/ pPool->SetPoolDefaultItem( SfxBoolItem(EE_PARA_HYPHENATE, TRUE) ); +/*N*/ pPool->SetPoolDefaultItem(Svx3DPercentDiagonalItem (5)); +/*N*/ +/*N*/ pOwnNumFormatter = new SvNumberFormatter( ::legacy_binfilters::getLegacyProcessServiceFactory(), +/*N*/ LANGUAGE_SYSTEM ); +/*N*/ pOwnNumFormatter->ChangeStandardPrec( 15 ); +/*N*/ +/*N*/ // append pool to end of pool chain +/*N*/ for (;;) +/*N*/ { +/*N*/ SfxItemPool* pSecondary = pPool->GetSecondaryPool(); +/*N*/ if (!pSecondary) +/*N*/ break; +/*N*/ +/*N*/ pPool = pSecondary; +/*N*/ } +/*N*/ +/*N*/ pPool->SetSecondaryPool(pChItemPool); +/*N*/ +/*N*/ SfxItemPool* pMasterPool = &GetItemPool(); +/*N*/ pMasterPool->FreezeIdRanges(); +/*N*/ +/*N*/ // get current language +/*N*/ pOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this); +/*N*/ SdrOutliner& rDrawOutliner = GetDrawOutliner(); +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ // set language properties +/*N*/ SvtLinguConfig aLinguConfig; +/*N*/ SvtLinguOptions aLinguOptions; +/*N*/ +/*N*/ if( aLinguConfig.GetOptions( aLinguOptions ) ) +/*N*/ { +/*N*/ SetLanguage( aLinguOptions.nDefaultLanguage, EE_CHAR_LANGUAGE ); +/*N*/ SetLanguage( aLinguOptions.nDefaultLanguage_CJK, EE_CHAR_LANGUAGE_CJK ); +/*N*/ SetLanguage( aLinguOptions.nDefaultLanguage_CTL, EE_CHAR_LANGUAGE_CTL ); +/*N*/ } +/*N*/ } +/*N*/ catch( uno::Exception aEx ) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ // convert ::rtl::OUString => tools String => ByteString +/*N*/ String aStr( aEx.Message ); +/*N*/ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); +/*N*/ DBG_ERROR1( "LinguProperties threw exception: %s", aBStr.GetBuffer()); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ // init item sets for chart objects +/*N*/ pTitleAttr = new SfxItemSet(*pItemPool, nTitleWhichPairs); +/*N*/ pMainTitleAttr = new SfxItemSet(*pItemPool, nTitleWhichPairs); +/*N*/ pSubTitleAttr = new SfxItemSet(*pItemPool, nTitleWhichPairs); +/*N*/ pXAxisTitleAttr = new SfxItemSet(*pItemPool, nTitleWhichPairs); +/*N*/ pYAxisTitleAttr = new SfxItemSet(*pItemPool, nTitleWhichPairs); +/*N*/ pZAxisTitleAttr = new SfxItemSet(*pItemPool, nTitleWhichPairs); +/*N*/ pAxisAttr = new SfxItemSet(*pItemPool, nAllAxisWhichPairs); +/*N*/ pGridAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ pXGridMainAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ pYGridMainAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ pZGridMainAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ pXGridHelpAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ pYGridHelpAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ pZGridHelpAttr = new SfxItemSet(*pItemPool, nGridWhichPairs); +/*N*/ pDiagramAreaAttr = new SfxItemSet(*pItemPool, nDiagramAreaWhichPairs); +/*N*/ pDiagramWallAttr = new SfxItemSet(*pItemPool, nDiagramAreaWhichPairs); +/*N*/ pDiagramFloorAttr = new SfxItemSet(*pItemPool, nDiagramAreaWhichPairs); +/*N*/ pLegendAttr = new SfxItemSet(*pItemPool, nLegendWhichPairs); +/*N*/ pChartAttr = new SfxItemSet(*pItemPool, nChartWhichPairs); +/*N*/ pDummyAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ +/*N*/ pStockLineAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ pStockLossAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ pStockPlusAttr = new SfxItemSet(*pItemPool, nRowWhichPairs); +/*N*/ +/*N*/ SdrPage* pPage = GetPage(0); +/*N*/ if (pPage) aInitialSize = pPage->GetSize(); +/*N*/ +/*N*/ CreateDefaultColors (); +/*N*/ eChartLinePoints[0] = +/*N*/ eChartLinePoints[1] = +/*N*/ eChartLinePoints[2] = +/*N*/ eChartLinePoints[3] = +/*N*/ eChartLinePoints[4] = +/*N*/ eChartLinePoints[5] = +/*N*/ eChartLinePoints[6] = +/*N*/ eChartLinePoints[7] = +/*N*/ eChartLinePoints[8] = 0; +/*N*/ +/*N*/ Font aLatinFont( OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_SPREADSHEET, GetLanguage( EE_CHAR_LANGUAGE ), DEFAULTFONT_FLAGS_ONLYONE ) ); +/*N*/ SvxFontItem aSvxFontItem( aLatinFont.GetFamily(), aLatinFont.GetName(), aLatinFont.GetStyleName(), aLatinFont.GetPitch(), +/*N*/ aLatinFont.GetCharSet(), EE_CHAR_FONTINFO ); +/*N*/ +/*N*/ Font aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_SPREADSHEET, GetLanguage( EE_CHAR_LANGUAGE_CJK ), DEFAULTFONT_FLAGS_ONLYONE ) ); +/*N*/ SvxFontItem aSvxFontItemCJK( aCJKFont.GetFamily(), aCJKFont.GetName(), aCJKFont.GetStyleName(), aCJKFont.GetPitch(), +/*N*/ aCJKFont.GetCharSet(), EE_CHAR_FONTINFO_CJK ); +/*N*/ +/*N*/ Font aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_SPREADSHEET, GetLanguage( EE_CHAR_LANGUAGE_CTL ), DEFAULTFONT_FLAGS_ONLYONE ) ); +/*N*/ SvxFontItem aSvxFontItemCTL( aCTLFont.GetFamily(), aCTLFont.GetName(), aCTLFont.GetStyleName(), aCTLFont.GetPitch(), +/*N*/ aCTLFont.GetCharSet(), EE_CHAR_FONTINFO_CTL ); +/*N*/ +/*N*/ // main title +/*N*/ pTitleAttr->Put(aSvxFontItem); +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 459, 100, EE_CHAR_FONTHEIGHT )); // 13pt +/*N*/ pTitleAttr->Put(aSvxFontItemCJK); +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 459, 100, EE_CHAR_FONTHEIGHT_CJK )); // 13pt +/*N*/ pTitleAttr->Put(aSvxFontItemCTL); +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 459, 100, EE_CHAR_FONTHEIGHT_CTL )); // 13pt +/*N*/ // the font color has 'automatic' as default that should not be overwritten +/*N*/ // pTitleAttr->Put(SvxColorItem(RGBColor(COL_BLACK))); +/*N*/ pTitleAttr->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ pTitleAttr->Put(XFillStyleItem(XFILL_NONE)); +/*N*/ pTitleAttr->Put(SvxChartTextOrientItem(CHTXTORIENT_AUTOMATIC)); +/*N*/ pMainTitleAttr->Put(*pTitleAttr); +/*N*/ +/*N*/ // sub title +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 388, 100, EE_CHAR_FONTHEIGHT )); // 11pt +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 388, 100, EE_CHAR_FONTHEIGHT_CJK )); // 11pt +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 388, 100, EE_CHAR_FONTHEIGHT_CTL )); // 11pt +/*N*/ pSubTitleAttr->Put(*pTitleAttr); +/*N*/ +/*N*/ // axis titles +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 318, 100, EE_CHAR_FONTHEIGHT )); // 9pt +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 318, 100, EE_CHAR_FONTHEIGHT_CJK )); // 9pt +/*N*/ pTitleAttr->Put(SvxFontHeightItem( 318, 100, EE_CHAR_FONTHEIGHT_CTL )); // 9pt +/*N*/ pXAxisTitleAttr->Put(*pTitleAttr); +/*N*/ pYAxisTitleAttr->Put(*pTitleAttr); +/*N*/ pZAxisTitleAttr->Put(*pTitleAttr); +/*N*/ +/*N*/ // general axis attributies: are also set in class ChartAxis() +/*N*/ // (BM) => deprecated and therefore removed here +/*N*/ +/*N*/ Color aAreaBackColor( RGBColor( COL_WHITE )); +/*N*/ pDiagramAreaAttr->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ pDiagramAreaAttr->Put(XFillColorItem(String(), aAreaBackColor)); +/*N*/ +/*N*/ // set the page color (in a chart this is the color of the area) +/*N*/ // at the outliner +/*N*/ if( pOutliner ) +/*N*/ pOutliner->SetBackgroundColor( aAreaBackColor ); +/*N*/ +/*N*/ pDiagramWallAttr->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ pDiagramWallAttr->Put(XFillStyleItem(XFILL_NONE)); +/*N*/ +/*N*/ pDiagramFloorAttr->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ pDiagramFloorAttr->Put(XFillColorItem(String(), Color(153, 153, 153))); +/*N*/ +/*N*/ pLegendAttr->Put(aSvxFontItem); +/*N*/ pLegendAttr->Put(aSvxFontItemCJK); +/*N*/ pLegendAttr->Put(aSvxFontItemCTL); +/*N*/ pLegendAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT )); // 6pt #72012# +/*N*/ pLegendAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CJK )); // 6pt #72012# +/*N*/ pLegendAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CTL )); // 6pt #72012# +/*N*/ pLegendAttr->Put(XFillStyleItem(XFILL_NONE)); +/*N*/ +/*N*/ //Todo: ueberpruefen, ob noch korekkt, es wird der default-ChartTyp erzeugt und der +/*N*/ //AttrSet in pChartAttr gesetzt +/*N*/ ChartType aTyp((SvxChartStyle) CHSTYLE_2D_COLUMN); +/*N*/ aTyp.GetAttrSet(pChartAttr); +/*N*/ +/*N*/ // the dummy attribute is (mainly!) used for data row defaults +/*N*/ // so avoid setting (pool) default values here as fixed +/*N*/ pDummyAttr->Put( aSvxFontItem ); +/*N*/ pDummyAttr->Put( aSvxFontItemCJK ); +/*N*/ pDummyAttr->Put( aSvxFontItemCTL ); +/*N*/ pDummyAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT )); // 6pt #72012# +/*N*/ pDummyAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CJK )); // 6pt #72012# +/*N*/ pDummyAttr->Put(SvxFontHeightItem( 212, 100, EE_CHAR_FONTHEIGHT_CTL )); // 6pt #72012# +/*N*/ +/*N*/ // what are these needed for? +/*N*/ pDummyAttr->Put (SfxInt32Item (SCHATTR_DUMMY0, (INT32) eChartStyle)); +/*N*/ pDummyAttr->Put (SfxInt32Item (SCHATTR_DUMMY1, 0)); +/*N*/ +/*N*/ pStockLossAttr->Put(XFillColorItem(String(), RGBColor(COL_BLACK))); +/*N*/ pStockPlusAttr->Put(XFillColorItem(String(), RGBColor(COL_WHITE))); +/*N*/ +/*N*/ // this test object is for calculating the text height in GetHeightOfnRows +/*N*/ // (chtmode1.cxx) without creating a new object for each call. +/*N*/ pTestTextObj = new SdrRectObj (OBJ_TEXT, Rectangle(0, 0, 10, 10) /*, aTestStr*/); +/*N*/ +/*N*/ //Aus SchChartDocument:: +/*N*/ SetStyleSheetPool(new SchStyleSheetPool(*pItemPool)); +/*N*/ ((SdrOutliner*)pDrawOutliner)->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool); +/*N*/ pOutliner->SetStyleSheetPool((SfxStyleSheetPool*)pStyleSheetPool); +/*N*/ +/*N*/ // Layer anlegen +/*N*/ +/*N*/ SdrLayerAdmin& rLayerAdmin = GetLayerAdmin(); +/*N*/ rLayerAdmin.NewLayer( String( SchResId( STR_LAYOUT ))); +/*N*/ rLayerAdmin.NewLayer( String( SchResId( STR_CONTROLS ))); +/*N*/ +/*N*/ +/*N*/ //Wichtig! die Achsen muessen jetzt erstellt werden, dies darf erst nach dem +/*N*/ //anlegen des ItemPools und der Defaults passieren! +/*N*/ pChartXAxis = new ChartAxis( this, CHART_AXIS_X, CHAXIS_AXIS_X ); +/*N*/ pChartYAxis = new ChartAxis( this, CHART_AXIS_Y, CHAXIS_AXIS_Y ); +/*N*/ pChartZAxis = new ChartAxis( this, CHART_AXIS_Z, CHAXIS_AXIS_Z ); +/*N*/ pChartBAxis = new ChartAxis( this, CHART_AXIS_Y, CHAXIS_AXIS_B ); +/*N*/ pChartAAxis = new ChartAxis( this, CHART_AXIS_X, CHAXIS_AXIS_A ); +/*N*/ +/*N*/ pChartYAxis->IfNoDataLookAt( CHAXIS_AXIS_B ); //Falls Achse nur ein Spiegelbild ist.... +/*N*/ pChartBAxis->IfNoDataLookAt( CHAXIS_AXIS_Y ); //d.h. keine eigenen Datenreihen besitzt +/*N*/ +/*N*/ aBarY1.Assign(this,pChartYAxis); +/*N*/ aBarY2.Assign(this,pChartBAxis); +/*N*/ +/*N*/ pChartXAxis->SetAllAxisAttr(pAxisAttr); +/*N*/ pChartYAxis->SetAllAxisAttr(pAxisAttr); +/*N*/ pChartZAxis->SetAllAxisAttr(pAxisAttr); +/*N*/ pChartAAxis->SetAllAxisAttr(pAxisAttr); +/*N*/ pChartBAxis->SetAllAxisAttr(pAxisAttr); +/*N*/ +/*N*/ pChartXAxis->SetGridAttrList(pYGridMainAttr);//XGrid->YAchse :( (u.U.) +/*N*/ pChartYAxis->SetGridAttrList(pXGridMainAttr); +/*N*/ +/*N*/ SetNumberFormatter( pOwnNumFormatter ); // sets number formatter also for all axes +/*N*/ +/*N*/ long nTmp=pNumFormatter->GetStandardFormat(NUMBERFORMAT_NUMBER, LANGUAGE_SYSTEM); +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_X_AXIS,nTmp,FALSE); +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_Y_AXIS,nTmp,FALSE); +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_Z_AXIS,nTmp,FALSE); +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_A_AXIS,nTmp,FALSE); +/*N*/ SetNumFmt(CHOBJID_DIAGRAM_B_AXIS,nTmp,FALSE); +/*N*/ +/*N*/ pChartBAxis->ShowAxis(FALSE); +/*N*/ pChartBAxis->ShowDescr(FALSE); +/*N*/ pChartAAxis->ShowAxis(FALSE); +/*N*/ pChartAAxis->ShowDescr(FALSE); +/*N*/ +/*N*/ pSdrObjList=new SdrObjList(this,NULL); +/*N*/ +/*N*/ // #99528# change auto-font color according to default diagram area +/*N*/ PageColorChanged( *pDiagramAreaAttr ); +/*N*/ } + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ +/*N*/ void ChartModel::ClearItemSetLists() +/*N*/ { +/*N*/ long i, nCount; +/*N*/ +/*N*/ nCount = aDataRowAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aDataRowAttrList.GetObject(i); +/*N*/ aDataRowAttrList.Clear(); +/*N*/ +/*N*/ nCount = aRegressAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aRegressAttrList.GetObject(i); +/*N*/ aRegressAttrList.Clear(); +/*N*/ +/*N*/ nCount = aDataPointAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aDataPointAttrList.GetObject(i); +/*N*/ aDataPointAttrList.Clear(); +/*N*/ +/*N*/ nCount = aSwitchDataPointAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aSwitchDataPointAttrList.GetObject(i); +/*N*/ aSwitchDataPointAttrList.Clear(); +/*N*/ +/*N*/ nCount = aAverageAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aAverageAttrList.GetObject(i); +/*N*/ aAverageAttrList.Clear(); +/*N*/ +/*N*/ nCount = aErrorAttrList.Count(); +/*N*/ for (i = 0 ; i < nCount; i++) +/*N*/ delete aErrorAttrList.GetObject(i); +/*N*/ aErrorAttrList.Clear(); +/*N*/ } +/*N*/ ChartModel::~ChartModel() +/*N*/ { +/*N*/ if(pTmpXItems) +/*N*/ delete pTmpXItems; +/*N*/ if(pTmpYItems) +/*N*/ delete pTmpYItems; +/*N*/ if(pTmpZItems) +/*N*/ delete pTmpZItems; +/*N*/ +/*N*/ if(pChartRefOutDev) +/*?*/ delete pChartRefOutDev; +/*N*/ +/*N*/ Clear();//aus SchChartDocument:: +/*N*/ +/*N*/ delete pTitleAttr; +/*N*/ delete pMainTitleAttr; +/*N*/ delete pSubTitleAttr; +/*N*/ delete pXAxisTitleAttr; +/*N*/ delete pYAxisTitleAttr; +/*N*/ delete pZAxisTitleAttr; +/*N*/ delete pAxisAttr; +/*N*/ +/*N*/ delete pChartXAxis; +/*N*/ delete pChartYAxis; +/*N*/ delete pChartZAxis; +/*N*/ delete pChartAAxis; +/*N*/ delete pChartBAxis; +/*N*/ +/*N*/ delete pGridAttr; +/*N*/ delete pXGridMainAttr; +/*N*/ delete pYGridMainAttr; +/*N*/ delete pZGridMainAttr; +/*N*/ delete pXGridHelpAttr; +/*N*/ delete pYGridHelpAttr; +/*N*/ delete pZGridHelpAttr; +/*N*/ delete pDiagramAreaAttr; +/*N*/ delete pDiagramWallAttr; +/*N*/ delete pDiagramFloorAttr; +/*N*/ delete pLegendAttr; +/*N*/ delete pChartAttr; +/*N*/ delete pDummyAttr; +/*N*/ delete aLightVec; +/*N*/ +/*N*/ delete pStockLineAttr; +/*N*/ delete pStockLossAttr; +/*N*/ delete pStockPlusAttr; +/*N*/ +/*N*/ DestroyDefaultColors(); +/*N*/ delete pOutliner; +/*N*/ ClearItemSetLists(); +/*N*/ +/*N*/ // suche nach dem ChartPool in der Poolkette, loesche alle verbindungen +/*N*/ // und vernichte den pool. vorgehen ist unabhaengig von der anzahl +/*N*/ // der vorangehendem pools. [RB] +/*N*/ SfxItemPool* pPool = &GetItemPool(); +/*N*/ +/*N*/ for (;;) +/*N*/ { +/*N*/ SfxItemPool* pSecondary = pPool->GetSecondaryPool(); +/*N*/ if (pSecondary == pChItemPool) +/*N*/ { +/*N*/ pPool->SetSecondaryPool (NULL); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ pPool = pSecondary; +/*N*/ } +/*N*/ +/*N*/ delete pChItemPool; +/*N*/ +/*N*/ delete pOwnNumFormatter; +/*N*/ +/*N*/ delete[] pPieSegOfs; +/*N*/ +/*N*/ if(pChartData) +/*N*/ { +/*N*/ if(pChartData->DecreaseRefCount()) +/*N*/ delete pChartData; +/*N*/ pChartData=NULL; +/*N*/ } +/*N*/ +/*N*/ if (pTestTextObj != NULL) delete pTestTextObj; +/*N*/ if (pLogBook) delete pLogBook; +/*N*/ +/*N*/ +/*N*/ +/*N*/ SdrObject *pObj; +/*N*/ while(pSdrObjList->GetObjCount()) +/*?*/ if(pObj=pSdrObjList->RemoveObject(0)) +/*?*/ delete pObj; +/*N*/ delete pSdrObjList; +/*N*/ +/*N*/ if(m_pUndoActionFromDraw) delete m_pUndoActionFromDraw; +/*N*/ } +/************************************************************************* +|* +|* Das Logbuch dient zur ReAttributierung, nachdem die DataBrowseBox +|* aufgerufen und Daten hinzugefuegt wurden. Die BrowseBox setzt +|* eine +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Chart-Datenstruktur auswechseln; bisherige wird ggf. geloescht; +|* Liefert TRUE, wenn die Chart-Datenstruktur gewechselt wurde. +|* +\************************************************************************/ + +/*N*/ BOOL ChartModel::ChangeChartData(SchMemChart& rData, BOOL bNewTitles,BOOL bDontBuild) +/*N*/ { +/*N*/ if (pChartData == &rData) return FALSE; +/*N*/ else +/*N*/ { +/*N*/ SetChartData(rData, bNewTitles); +/*N*/ +/*N*/ if( pDocShell && +/*N*/ pDocShell->ISA( SchChartDocShell )) +/*N*/ { +/*N*/ chart::ChartDataChangeEvent aEvent; +/*N*/ aEvent.Type = chart::ChartDataChangeType_ALL; +/*N*/ aEvent.StartColumn = 0; +/*N*/ aEvent.EndColumn = 0; +/*N*/ aEvent.StartRow = 0; +/*N*/ aEvent.EndRow = 0; +/*N*/ SAL_STATIC_CAST( SchChartDocShell*, pDocShell )->DataModified( aEvent ); +/*N*/ } +/*N*/ +/*N*/ if(!bDontBuild) +/*N*/ BuildChart(FALSE); +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Datenzeilen in Reihen/Spalten umschalten; +|* Liefert bei Umschaltung TRUE +|* +\************************************************************************/ + +/*N*/ BOOL ChartModel::ChangeSwitchData(BOOL bSwitch) +/*N*/ { +/*N*/ if (bSwitchData == bSwitch) return FALSE; +/*N*/ else +/*N*/ { +/*N*/ bSwitchData = bSwitch; +/*N*/ +/*N*/ #ifndef NO_56798_FIX //#56798# QuickFix 5.0-Final +/*N*/ if( IsReal3D() ) +/*N*/ { +/*?*/ bClearDepth=TRUE; +/*?*/ long i,nORow=aDataRowAttrList.Count(); +/*?*/ for(i=0;i<nORow;i++) +/*?*/ //-/ aDataRowAttrList.GetObject(i)->ClearItem(SID_ATTR_3D_DEPTH); +/*?*/ aDataRowAttrList.GetObject(i)->ClearItem(SDRATTR_3DOBJ_DEPTH); +/*?*/ SfxItemSet * pAttributes; +/*?*/ nORow=aDataPointAttrList.Count(); +/*?*/ for(i=0;i<nORow;i++) +/*?*/ { +/*?*/ pAttributes = aDataPointAttrList.GetObject(i); +/*?*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(SDRATTR_3DOBJ_DEPTH); +/*?*/ } +/*?*/ nORow=aSwitchDataPointAttrList.Count(); +/*?*/ for(i=0;i<nORow;i++) +/*?*/ { +/*?*/ pAttributes = aSwitchDataPointAttrList.GetObject(i); +/*?*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(SDRATTR_3DOBJ_DEPTH); +/*?*/ } +/*N*/ } +/*N*/ #endif +/*N*/ +/*N*/ // the number of series may change, so the attribute list +/*N*/ // must be adapted +/*N*/ InitDataAttrs(); +/*N*/ +/*N*/ // BM: #68764# +/*N*/ // if global data descriptions are on transfer them to new rows +/*N*/ if( eDataDescr != CHDESCR_NONE ) +/*N*/ { +/*?*/ ChangeDataDescr( eDataDescr, bShowSym, -1, FALSE ); +/*N*/ } +/*N*/ +/*N*/ BuildChart(FALSE); +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + + + + +/** @descr Set up the line attributes of every data row. This includes + the line style, width, and color. Style is set to solid, width to + the minimal width (if the given mode is not SETLINES_COMPAT). + The color depends on the given mode. + If the chart is a stock chart then all the lines are simply switched + off (by setting line style XLINE_NONE). No other attributes are + modified. + @param nMode Specifies the line color of each data row. + SETLINES_COMPAT and SETLINES_FILLCOLOR set the line color + to the fill color. SETLINES_COMPAT does not change line + style nor width. + SETLINES_REVERSE sets the fill color to the line color. + SETLINES_BLACK sets the line color to black. +*/ +/*N*/ void ChartModel::SetupLineColors( const long nMode, long nStartIndex ) //#54870# +/*N*/ { +/*N*/ long nRow, +/*N*/ nRowCnt; +/*N*/ +/*N*/ // The Row count depends (again) on wether the data set is transposed +/*N*/ // (switched) or not. Because this returns the wrong value in case of +/*N*/ // a pie chart, then we access the raw row count without regarding the +/*N*/ // transpose switch. +/*N*/ if (IsPieChart()) +/*N*/ nRowCnt = GetColCount(); // ChartData()->GetRowCount(); +/*N*/ else +/*N*/ nRowCnt = GetRowCount(); +/*N*/ +/*N*/ long nUpperIndex = ::std::min( static_cast< ULONG >( nRowCnt ), aDataRowAttrList.Count() ); +/*N*/ +/*N*/ if( nStartIndex < nUpperIndex ) +/*N*/ { +/*N*/ if (HasStockLines()) +/*N*/ { +/*N*/ // Switch off lines for stock charts. +/*N*/ for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ ) +/*N*/ aDataRowAttrList.GetObject(nRow)->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // Initialize the item set that will be set to all data rows. +/*N*/ // If nMode==SETLINES_COMPAT initialization is skipped and only +/*N*/ // the line colors are set to the fill colors. +/*N*/ SfxItemSet rAttr(GetItemPool(),XATTR_START,XATTR_END); +/*N*/ if(nMode != SETLINES_COMPAT) +/*N*/ { +/*N*/ // Default values represent a solid black line of minimal width. +/*N*/ rAttr.Put(XLineStyleItem(XLINE_SOLID)); +/*N*/ rAttr.Put(XLineColorItem(String(),RGBColor(COL_BLACK))); +/*N*/ rAttr.Put(XLineWidthItem (0)); +/*N*/ } +/*N*/ +/*N*/ // Set the itemset rAttr to all data rows. Depending on nMode it is first +/*N*/ // modified so that the line color is set to the fill color or the other +/*N*/ // way round. +/*N*/ // The for loop and switch statement changed places in order to not +/*N*/ // having to execute the switch statement in every iteration. +/*N*/ switch(nMode) +/*N*/ { +/*N*/ case SETLINES_COMPAT: +/*N*/ case SETLINES_FILLCOLOR: +/*N*/ // Set the line colors to the former fill colors. +/*N*/ for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ ) +/*N*/ if(IsLine(nRow)) +/*N*/ { +/*N*/ rAttr.Put(XLineColorItem(String(), +/*N*/ ((XFillColorItem &)GetDataRowAttr(nRow).Get(XATTR_FILLCOLOR)). +/*N*/ GetValue())); +/*N*/ aDataRowAttrList.GetObject(nRow)->Put(rAttr); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case SETLINES_REVERSE: +/*N*/ // Set the fill colors to the former line colors. +/*?*/ for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ ) +/*?*/ if(IsLine(nRow)) +/*?*/ { +/*?*/ rAttr.Put(XFillColorItem(String(), +/*?*/ ((XLineColorItem &)GetDataRowAttr(nRow).Get(XATTR_LINECOLOR)). +/*?*/ GetValue())); +/*?*/ aDataRowAttrList.GetObject(nRow)->Put(rAttr); +/*?*/ } +/*?*/ break; +/*N*/ +/*N*/ case SETLINES_BLACK: +/*N*/ // Set the default values to all data rows. +/*N*/ for( nRow = nStartIndex; nRow < nUpperIndex; nRow++ ) +/*N*/ { +/*N*/ aDataRowAttrList.GetObject(nRow)->Put(rAttr); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Charttyp aendern; +|* Liefert bei neuem Charttyp TRUE. +|* +\************************************************************************/ +// BM: src566b: ChangeChart doesn't execute BuildChart any more! +/*N*/ BOOL ChartModel::ChangeChart( SvxChartStyle eStyle, bool bSetDefaultAttr /* = true */ ) +/*N*/ { +/*N*/ if( eStyle == CHSTYLE_ADDIN ) +/*N*/ { +/*?*/ eChartStyle = eStyle; +/*?*/ return FALSE; +/*N*/ } +/*N*/ else if( eStyle == eChartStyle ) +/*N*/ { +/*N*/ return FALSE; +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // if chart style is reset disable addin +/*N*/ if( ! GetChartStatusFlag( CHS_KEEP_ADDIN )) +/*N*/ { +/*N*/ mxChartAddIn = NULL; +/*N*/ } +/*N*/ +/*N*/ bResizePie=TRUE; +/*N*/ +/*N*/ // OldChartStyle merken +/*N*/ eOldChartStyle = eChartStyle; +/*N*/ +/*N*/ //########### Ab hier werden defaultwerte umgesetzt:######### : +/*N*/ +/*N*/ //Wenn Linien, aber nicht 3D, dann muss evtl. bei +/*N*/ //Typwechsel die Linienfarbe neu defaultet werden! +/*N*/ +/*N*/ long nRefLine=0;//Bei StockChart 3,4 ist die erste Zeile keine Linie +/*N*/ if(GetRowCount()>1) +/*N*/ nRefLine=1; +/*N*/ +/*N*/ // #101164# a combi chart may contain lines for all but the first series +/*N*/ if( eOldChartStyle == CHSTYLE_2D_LINE_COLUMN || +/*N*/ eOldChartStyle == CHSTYLE_2D_LINE_STACKEDCOLUMN ) +/*N*/ nRefLine = 0; +/*N*/ +/*N*/ BOOL bOldIsLine=IsLine(nRefLine)&& !Is3DChart();//#54870#//Verbund-Charts OK??? +/*N*/ BOOL bOldIsStock=HasStockLines(); +/*N*/ BOOL bOldIs3D=IsReal3D(); +/*N*/ BOOL bOldHadStockBars=HasStockBars(); +/*N*/ BOOL bOldXY = IsXYChart(); +/*N*/ BOOL bOldNet = IsNetChart(); +/*N*/ BOOL bOldPie = IsPieChart(); +/*N*/ BOOL bOldDonut = IsDonutChart(); +/*N*/ +/*N*/ eChartStyle = eStyle; +/*N*/ +/*N*/ BOOL bNewIsLine=IsLine(nRefLine) && !Is3DChart();//#54870# +/*N*/ BOOL bNewIs3D=IsReal3D(); +/*N*/ +/*N*/ // data row attributes are used for data points in a piechart +/*N*/ // therefore these need to be initialized correctly +/*N*/ BOOL bMustInitDataAttrs = (bOldPie || IsPieChart() || IsDonutChart() || bOldDonut); +/*N*/ +/*N*/ if( eStyle == CHSTYLE_3D_PIE ) +/*N*/ { +/*?*/ for( short i = 0; i < nPieSegCount; i++ ) +/*?*/ SetPieSegOfs( i, 0 ); +/*N*/ } + +/*N*/ if( bSetDefaultAttr ) +/*?*/ { +/*?*/ // BM: use gray (15%) background (wall) for some charts +/*?*/ if( HasDefaultGrayWall() != HasDefaultGrayWall( &eOldChartStyle ) ) +/*?*/ { +/*?*/ if( HasDefaultGrayWall() ) +/*?*/ { +/*?*/ pDiagramWallAttr->Put( XFillStyleItem( XFILL_SOLID )); +/*?*/ pDiagramWallAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) ); +/*?*/ +/*?*/ pLegendAttr->Put( XFillStyleItem( XFILL_SOLID )); +/*?*/ pLegendAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDiagramWallAttr->Put( XFillStyleItem( XFILL_NONE )); +/*?*/ pDiagramWallAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) ); +/*?*/ +/*?*/ pLegendAttr->Put( XFillStyleItem( XFILL_NONE )); +/*?*/ pLegendAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) ); +/*?*/ } +/*?*/ } +/*?*/ +/*?*/ // BM: use gray (15%) background (area) for some charts +/*?*/ if( HasDefaultGrayArea() != HasDefaultGrayArea( &eOldChartStyle ) ) +/*?*/ { +/*?*/ if( HasDefaultGrayArea() ) +/*?*/ { +/*?*/ pDiagramAreaAttr->Put( XFillStyleItem( XFILL_SOLID )); +/*?*/ pDiagramAreaAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) ); +/*?*/ +/*?*/ pLegendAttr->Put( XFillStyleItem( XFILL_SOLID )); +/*?*/ pLegendAttr->Put( XFillColorItem( String(), RGBColor( RGB_COLORDATA( 0xd9, 0xd9, 0xd9 ) )) ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ pDiagramAreaAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) ); +/*?*/ +/*?*/ pLegendAttr->Put( XFillStyleItem( XFILL_NONE )); +/*?*/ pLegendAttr->Put( XFillColorItem( String(), RGBColor( COL_WHITE )) ); +/*?*/ } +/*?*/ } +/*?*/ } +/*?*/ +/*N*/ if(bNewIsLine != bOldIsLine) +/*N*/ { +/*?*/ // map old line colors to new fill colors +/*?*/ if( bNewIsLine ) +/*?*/ { +/*?*/ if( bOldPie ) +/*?*/ // && GetRowCount() < GetColCount()) +/*?*/ { +/*?*/ InitDataAttrs(); +/*?*/ bMustInitDataAttrs = FALSE; +/*?*/ } +/*?*/ SetupLineColors( SETLINES_COMPAT ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ if( IsPieChart() ) +/*?*/ // && GetRowCount() < GetColCount()) +/*?*/ { +/*?*/ InitDataAttrs(); +/*?*/ bMustInitDataAttrs = FALSE; +/*?*/ } +/*?*/ // the chart style must be swapped to the old one +/*?*/ // temporarily, so that IsLine() works correctly +/*?*/ // eChartStyle = eOldChartStyle; +/*?*/ SetupLineColors( SETLINES_BLACK ); +/*?*/ // eChartStyle = eStyle; +/*?*/ } +/*?*/ +/*?*/ } + +/*N*/ if( bMustInitDataAttrs ) +/*N*/ { +/*?*/ InitDataAttrs(); +/*?*/ bMustInitDataAttrs = FALSE; +/*N*/ } +/*N*/ +/*N*/ if(bOldXY!=IsXYChart()) +/*N*/ { +/*?*/ if(bOldXY) +/*?*/ aDataRowAttrList.GetObject(0)->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y));//wird evtl. unten geändert, s.u. StockCharts +/*?*/ else +/*?*/ aDataRowAttrList.GetObject(0)->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_X)); +/*?*/ +/*?*/ CheckForNewAxisNumFormat(); // BM #59532# +/*N*/ } +/*N*/ +/*N*/ +/*N*/ long nRowCnt=aDataRowAttrList.Count();//=GetRowCount(); +/*N*/ if( (bOldIsStock && !HasStockLines()) || (bOldIs3D && !bNewIs3D) ) +/*N*/ { + long n=0; +/*?*/ for(n=0;n<nRowCnt;n++) +/*?*/ aDataRowAttrList.GetObject(n)->Put(XLineStyleItem(XLINE_SOLID)); +/*?*/ long nColCnt=aDataPointAttrList.Count(); +/*?*/ SfxItemSet * pAttributes; +/*?*/ for(n=0;n<nColCnt;n++) +/*?*/ { +/*?*/ pAttributes = aDataPointAttrList.GetObject(n); +/*?*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(XATTR_LINESTYLE); +/*?*/ } +/*?*/ nColCnt=aSwitchDataPointAttrList.Count(); +/*?*/ for(n=0;n<nColCnt;n++) +/*?*/ { +/*?*/ pAttributes = aSwitchDataPointAttrList.GetObject(n); +/*?*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(XATTR_LINESTYLE); +/*?*/ } +/*?*/ } +/*N*/ if(!bOldIsStock && HasStockLines() || (!bOldIs3D && bNewIs3D) ) +/*N*/ { + long n=0; +/*N*/ for(n=0;n<nRowCnt;n++) +/*N*/ aDataRowAttrList.GetObject(n)->Put(XLineStyleItem(XLINE_NONE)); +/*N*/ long nColCnt=aDataPointAttrList.Count(); +/*N*/ SfxItemSet * pAttributes; +/*N*/ for(n=0;n<nColCnt;n++) +/*N*/ { +/*N*/ pAttributes = aDataPointAttrList.GetObject(n); +/*N*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(XATTR_LINESTYLE); +/*N*/ } +/*N*/ nColCnt=aSwitchDataPointAttrList.Count(); +/*N*/ for(n=0;n<nColCnt;n++) +/*N*/ { +/*N*/ pAttributes = aSwitchDataPointAttrList.GetObject(n); +/*N*/ if (pAttributes != NULL) +/*?*/ pAttributes->ClearItem(XATTR_LINESTYLE); +/*N*/ } +/*N*/ } +/*N*/ if(/*!bOldHadStockBars && */HasStockBars())//Hat Balken im Hintergrund (ab jetzt oder Typ 3 <-> 4, #65070#) +/*N*/ { +/*?*/ if(nRowCnt) +/*?*/ { +/*?*/ aDataRowAttrList.GetObject(0)->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y)); +/*?*/ aDataRowAttrList.GetObject(0)->Put(XLineStyleItem(XLINE_SOLID)); +/*?*/ } +/*?*/ for(long n=1;n<nRowCnt;n++) +/*?*/ aDataRowAttrList.GetObject(n)->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y)); +/*?*/ pChartBAxis->ShowAxis(TRUE); +/*?*/ pChartBAxis->ShowDescr(TRUE); +/*?*/ SfxItemSet aSet(*pItemPool,SCHATTR_AXIS_AUTO_ORIGIN,SCHATTR_AXIS_AUTO_ORIGIN); +/*?*/ aSet.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN,TRUE)); +/*?*/ pChartBAxis->SetAttributes(aSet); +/*?*/ +/*?*/ // #100923# +/*?*/ SfxItemSet aSet2( *pItemPool, SCHATTR_AXIS_AUTO_ORIGIN, SCHATTR_AXIS_ORIGIN ); +/*?*/ aSet2.Put( SfxBoolItem( SCHATTR_AXIS_AUTO_ORIGIN, FALSE )); +/*?*/ aSet2.Put( SvxDoubleItem( 0.0, SCHATTR_Y_AXIS_ORIGIN )); +/*?*/ pChartYAxis->SetAttributes( aSet2 ); +/*?*/ } +/*?*/ +/*N*/ if(bOldHadStockBars && !HasStockBars())//hat jetzt keine Balken mehr +/*?*/ { +/*?*/ for(long n=0;n<nRowCnt;n++) +/*?*/ aDataRowAttrList.GetObject(n)->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_Y)); +/*?*/ if(IsXYChart()) +/*?*/ aDataRowAttrList.GetObject(0)->Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_PRIMARY_X)); +/*?*/ pChartBAxis->ShowAxis(FALSE); +/*?*/ pChartBAxis->ShowDescr(FALSE); +/*?*/ } + + // use default position if base type changed +/*N*/ ChartType aOldType( eOldChartStyle ); +/*N*/ ChartType aNewType( eChartStyle ); +/*N*/ +/*N*/ if( aOldType.GetBaseType() != +/*N*/ aNewType.GetBaseType() ) +/*N*/ { +/*?*/ SetUseRelativePositions( FALSE ); +/*N*/ } +/*N*/ +/*N*/ Matrix4D aTmp; +/*N*/ aSceneMatrix = aTmp; +/*N*/ if(IsPieChart() && IsReal3D() ) +/*N*/ { +/*?*/ aSceneMatrix.RotateX(-F_PI/3); +/*?*/ if(pScene) +/*?*/ pScene->NbcSetTransform(aSceneMatrix); +/*N*/ } +/*N*/ else if(pScene) +/*?*/ pScene->NbcSetTransform(aSceneMatrix); +/*N*/ +/*N*/ +/*N*/ if( IsReal3D()) //#56798# QuickFix 5.0-Final +/*N*/ { +/*N*/ bClearDepth=TRUE; +/*N*/ ULONG i, nORow=aDataRowAttrList.Count(); +/*N*/ for(i=0;i<nORow;i++) +/*N*/ { +/*N*/ //-/ aDataRowAttrList.GetObject(i)->ClearItem(SID_ATTR_3D_DEPTH); +/*N*/ aDataRowAttrList.GetObject(i)->ClearItem( SDRATTR_3DOBJ_DEPTH ); +/*N*/ aDataRowAttrList.GetObject(i)->Put( Svx3DDoubleSidedItem( TRUE )); +/*N*/ +/*N*/ //if(eChartStyle == CHSTYLE_3D_STRIPE || eChartStyle==CHSTYLE_3D_PIE) +/*N*/ //-/ aDataRowAttrList.GetObject(i)->Put(SfxBoolItem(SID_ATTR_3D_DOUBLE_SIDED,TRUE)); +/*N*/ // else +/*N*/ //-/ aDataRowAttrList.GetObject(i)->Put(SfxBoolItem(SID_ATTR_3D_DOUBLE_SIDED,FALSE)); +/*N*/ // aDataRowAttrList.GetObject(i)->Put(Svx3DDoubleSidedItem(FALSE)); +/*N*/ } +/*N*/ nORow=aDataPointAttrList.Count(); +/*N*/ SfxItemSet * pAttributes; +/*N*/ for(i=0;i<nORow;i++) +/*N*/ { +/*N*/ pAttributes = aDataPointAttrList.GetObject(i); +/*N*/ if (pAttributes != NULL) +/*N*/ { +/*?*/ pAttributes->ClearItem( SDRATTR_3DOBJ_DEPTH ); +/*?*/ pAttributes->ClearItem( SDRATTR_3DOBJ_DOUBLE_SIDED ); +/*N*/ } +/*N*/ } +/*N*/ nORow=aSwitchDataPointAttrList.Count(); +/*N*/ for(i=0;i<nORow;i++) +/*N*/ { +/*N*/ pAttributes = aSwitchDataPointAttrList.GetObject(i); +/*N*/ if (pAttributes != NULL) +/*N*/ { +/*?*/ pAttributes->ClearItem( SDRATTR_3DOBJ_DEPTH ); +/*?*/ pAttributes->ClearItem( SDRATTR_3DOBJ_DOUBLE_SIDED ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // switch off rounded edges for: +/*N*/ // area charts +/*N*/ Svx3DPercentDiagonalItem aItem( +/*N*/ (eStyle == CHSTYLE_3D_AREA || eStyle == CHSTYLE_3D_STACKEDAREA || eStyle == CHSTYLE_3D_PERCENTAREA || +/*N*/ eStyle == CHSTYLE_3D_PIE ) +/*N*/ ? 0 : 5 ); +/*N*/ +/*N*/ // item-set for whole chart used if item in series is not set +/*N*/ pDummyAttr->Put( aItem ); +/*N*/ +/*N*/ for( i = 0; i < aDataRowAttrList.Count(); i++ ) +/*N*/ { +/*N*/ aDataRowAttrList.GetObject( i )->Put( aItem ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // If set to xy-chart or certain stock chart variants then turn on +/*N*/ // automatic calculation of the origin for all y-axes as default. +/*N*/ // This affects the second y-axis even if it is not (yet) visible. +/*N*/ // This was previously done in the autopilot but belongs here +/*N*/ // because XML loading calls this method but not the autopilot. +/*N*/ if ( IsXYChart() +/*N*/ || (eChartStyle == CHSTYLE_2D_STOCK_1) +/*N*/ || (eChartStyle == CHSTYLE_2D_STOCK_2)) +/*N*/ { +/*?*/ SfxItemSet aAutoOrigin (*pItemPool, SCHATTR_AXIS_AUTO_ORIGIN, SCHATTR_AXIS_AUTO_ORIGIN); +/*?*/ aAutoOrigin.Put (SfxBoolItem (SCHATTR_AXIS_AUTO_ORIGIN, TRUE)); +/*?*/ pChartYAxis->SetAttributes (aAutoOrigin); +/*?*/ // The second y-axis exists (pChartBAxis!=NULL) even if it is not +/*?*/ // visible. +/*?*/ pChartBAxis->SetAttributes (aAutoOrigin); +/*N*/ } +/*N*/ +/*N*/ SetUseRelativePositions(TRUE);// New arrangement (see SID_NEW_ARRANGEMENT) +/*N*/ eOldChartStyle = eChartStyle; +/*N*/ +/*N*/ // Set the number of data series that are displayed as lines to a fixed value. +/*N*/ // This is one for the combined chart types of columns/stacked columns and lines +/*N*/ // and zero for all other chart types. +/*N*/ +/*N*/ // #103682# this seems not to be necessary. This method is called on +/*N*/ // XML-import very early, when the data is 1x1 in size. The number of +/*N*/ // lines must be preserved until in the end the original size-data is +/*N*/ // set. In all other cases when this method is called, the chart-type +/*N*/ // itself should handle a value that is too big or small. (Advantage: if +/*N*/ // you change to bar with no lines and then back, you get the old +/*N*/ // value). +/*N*/ // switch (eStyle) +/*N*/ // { +/*N*/ // case CHSTYLE_2D_LINE_COLUMN: +/*N*/ // case CHSTYLE_2D_LINE_STACKEDCOLUMN: +/*N*/ // { +/*N*/ // long nNumLines = GetNumLinesColChart(); +/*N*/ // if( nNumLines < 1 || +/*N*/ // nNumLines >= GetRowCount() ) +/*N*/ // SetNumLinesColChart (1); +/*N*/ // } +/*N*/ // break; +/*N*/ +/*N*/ // default: +/*N*/ // SetNumLinesColChart (0); +/*N*/ // } +/*N*/ +/*N*/ // #104525# however the default for a combi-chart is one line. So if +/*N*/ // the setting is on 0, we have to change it to 1. +/*N*/ if( ( eStyle == CHSTYLE_2D_LINE_COLUMN +/*N*/ || eStyle == CHSTYLE_2D_LINE_STACKEDCOLUMN ) +/*N*/ && GetNumLinesColChart() == 0 ) +/*N*/ { +/*?*/ SetNumLinesColChart( 1 ); +/*N*/ } +/*N*/ +/*N*/ // broadcast UIFeature chang +/*N*/ // #85069# introduced because the 3d effect flyer has to be disabled for 2d charts +/*N*/ Broadcast( SfxSimpleHint( SFX_HINT_MODECHANGED )); +/*N*/ +/*N*/ return TRUE; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* Language setzen +|* +\************************************************************************/ + +/*N*/ void ChartModel::SetLanguage( const LanguageType eLang, const USHORT nId ) +/*N*/ { +/*N*/ BOOL bChanged = FALSE; +/*N*/ +/*N*/ if( nId == EE_CHAR_LANGUAGE && eLanguage != eLang ) +/*N*/ { +/*N*/ eLanguage = eLang; +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ else if( nId == EE_CHAR_LANGUAGE_CJK && eLanguageCJK != eLang ) +/*N*/ { +/*N*/ eLanguageCJK = eLang; +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ else if( nId == EE_CHAR_LANGUAGE_CTL && eLanguageCTL != eLang ) +/*N*/ { +/*N*/ eLanguageCTL = eLang; +/*N*/ bChanged = TRUE; +/*N*/ } +/*N*/ +/*N*/ if( bChanged ) +/*N*/ { +/*N*/ GetDrawOutliner().SetDefaultLanguage( eLang ); +/*N*/ pOutliner->SetDefaultLanguage( eLang ); +/*N*/ pItemPool->SetPoolDefaultItem( SvxLanguageItem( eLang, nId ) ); +/*N*/ SetChanged( bChanged ); +/*N*/ } +/*N*/ } + + +/************************************************************************* +|* +|* Return language +|* +\************************************************************************/ + +/*N*/ LanguageType ChartModel::GetLanguage( const USHORT nId ) const +/*N*/ { +/*N*/ LanguageType eLangType = eLanguage; +/*N*/ +/*N*/ if( nId == EE_CHAR_LANGUAGE_CJK ) +/*N*/ eLangType = eLanguageCJK; +/*N*/ else if( nId == EE_CHAR_LANGUAGE_CTL ) +/*N*/ eLangType = eLanguageCTL; +/*N*/ +/*N*/ return eLangType; +/*N*/ } + +IMPL_LINK( ChartModel, NotifyUndoActionHdl, SfxUndoAction*, pUndo ) +{ + DBG_ASSERT(!m_pUndoActionFromDraw, "New UndoAction from Draw received while elder is not handled yet"); + if(m_bDeleteUndoActionNotificationFromDraw) + { + if(pUndo) + delete pUndo; + } + else + { + m_pUndoActionFromDraw = pUndo; + } + return 1; +}} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_chtscene.cxx b/binfilter/bf_sch/source/core/sch_chtscene.cxx new file mode 100644 index 000000000000..5bc12765a819 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_chtscene.cxx @@ -0,0 +1,318 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + + +#include "axisid.hxx" +#include "chtscene.hxx" +namespace binfilter { + +#ifdef _MSC_VER +#pragma optimize ("",off) +#endif + + +/*N*/ TYPEINIT1(ChartScene, E3dPolyScene); + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ ChartScene::ChartScene(ChartModel* pDocument) : +/*N*/ E3dPolyScene(), +/*N*/ pDoc(pDocument), +/*N*/ bAskForLogicRect(TRUE) +/*N*/ { +/*N*/ nSortingMode = E3D_SORT_LOOKUP_FIELD | E3D_SORT_NON_POLYOBJ | E3D_SORT_TEST_LENGTH; +/*N*/ Initialize(); +/*N*/ SetModel( pDocument ); +/*N*/ } + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +/*N*/ ChartScene::~ChartScene () +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Einpassen der Projektion aller Szenenobjekte in das +|* umschliessende Rechteck +|* +\************************************************************************/ + +/*N*/ Volume3D ChartScene::FitInSnapRect() +/*N*/ { +/*N*/ // untransformiertes BoundVolume holen und parent rufen +/*N*/ Volume3D aNewVol = E3dScene::FitInSnapRect(); +/*N*/ +/*N*/ // Groesse etwas anpassen, umPlatz am Rand des Charts fu schaffen +/*N*/ aNewVol.MinVec () = Vector3D ( +/*N*/ aNewVol.MinVec ().X () * 1.2, +/*N*/ aNewVol.MinVec ().Y () * 1.2, +/*N*/ aNewVol.MinVec ().Z ()); +/*N*/ aNewVol.MaxVec () = Vector3D ( +/*N*/ aNewVol.MaxVec ().X () * 1.2, +/*N*/ aNewVol.MaxVec ().Y () * 1.2, +/*N*/ aNewVol.MaxVec ().Z ()); +/*N*/ +/*N*/ //pDoc->Position3DAxisTitles(GetLogicRect()); +/*N*/ +/*N*/ SetRectsDirty(FALSE); +/*N*/ return aNewVol; +/*N*/ } + +/************************************************************************* +|* +|* Zuweisungsoperator +|* +\************************************************************************/ + + + + +/************************************************************************* +|* +|* Speichern +|* +\************************************************************************/ + +/*N*/ void ChartScene::WriteData(SvStream& rOut) const +/*N*/ { +/*N*/ if (rOut.GetVersion() > 3780 && pSub && pSub->GetPage()) +/*N*/ { +/*N*/ // FileFormat 5.0 +/*N*/ // Die SubList der ChartScene wird nun nicht mehr geschrieben +/*N*/ +/*N*/ //pSub->GetPage()->SetObjectsNotPersistent(TRUE); +/*N*/ +/*N*/ // Scene schreiben +/*N*/ E3dPolyScene::WriteData(rOut); +/*N*/ +/*N*/ //pSub->GetPage()->SetObjectsNotPersistent(FALSE); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // FileFormat 4.0 und aelter +/*N*/ E3dPolyScene::WriteData(rOut); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Laden +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Erstelle die 3D-Achsenbeschriftung //war mal in globfunc.cxx +|* +\************************************************************************/ + +/*N*/ void ChartScene::InsertAllTitleText (DescrList &rList, +/*N*/ E3dObject *pGroup, +/*N*/ long nAxisId) +/*N*/ { +/*N*/ Rectangle aOldRect; +/*N*/ +/*N*/ for (E3dLabelObj *pLabel = rList.First (); pLabel; pLabel = rList.Next ()) +/*N*/ { +/*N*/ Insert3DObj(pLabel); +/*N*/ pLabel->InsertUserData (new SchAxisId (nAxisId)); +/*N*/ } +/*N*/ } +/*N*/ Rectangle ChartScene::Get3DDescrRect(E3dLabelObj *p3DObj,B3dCamera& rCamSet ) +/*N*/ { +/*N*/ const SdrObject* pObj = p3DObj->Get2DLabelObj(); +/*N*/ // View- Abmessungen des Labels holen +/*N*/ Rectangle aRect = pObj->GetLogicRect(); +/*N*/ +/*N*/ // Position des Objektes in Weltkoordinaten ermitteln +/*N*/ Vector3D aObjPos = p3DObj->GetFullTransform() * p3DObj->GetPosition(); +/*N*/ aObjPos = rCamSet.WorldToViewCoor(aObjPos); +/*N*/ Point aPoint((long)(aObjPos.X() + 0.5), (long)(aObjPos.Y() + 0.5)); +/*N*/ +/*N*/ // Relative Position des Labels in View-Koordinaten +/*N*/ Point aRelPosOne = pObj->GetRelativePos(); +/*N*/ aRelPosOne += aPoint; +/*N*/ +/*N*/ aRect.SetPos(aRelPosOne); +/*N*/ return aRect; +/*N*/ } + +/*N*/ void ChartScene::ReduceDescrList(DescrList & aList) +/*N*/ { +/*N*/ +/*N*/ Rectangle aIntersect(0,0,0,0); +/*N*/ Rectangle aPrevRect(0,0,0,0); +/*N*/ Rectangle aNextRect(0,0,0,0); +/*N*/ +/*N*/ //Transformation berechnen, die später im Paint ausgeführt wird, +/*N*/ //(Derzeit sind die Labelobject-Positionen unbekannt) +/*N*/ Rectangle aBound(GetSnapRect()); +/*N*/ Volume3D aVolume = FitInSnapRect(); +/*N*/ B3dCamera& rSet = GetCameraSet(); +/*N*/ rSet.SetDeviceRectangle(aVolume.MinVec().X(), aVolume.MaxVec().X(), +/*N*/ aVolume.MinVec().Y(), aVolume.MaxVec().Y(), FALSE); +/*N*/ rSet.SetFrontClippingPlane(aVolume.MinVec().Z()); +/*N*/ rSet.SetBackClippingPlane(aVolume.MaxVec().Z()); +/*N*/ rSet.SetViewportRectangle(aBound); +/*N*/ +/*N*/ +/*N*/ E3dLabelObj *p3DObj=aList.First(); +/*N*/ E3dLabelObj *pOld3DObj=p3DObj; +/*N*/ BOOL bGetCurrent=FALSE; +/*N*/ +/*N*/ if(p3DObj) +/*N*/ { +/*N*/ const SdrTextObj* pObj = (const SdrTextObj*)p3DObj->Get2DLabelObj(); +/*N*/ +/*N*/ //Es reicht, die Rotation des ersten Elements zu ermitteln, +/*N*/ //alle in der Liste sind gleichermaßen gedreht +/*N*/ //GetRotateAngle() gibt 100tel, gebraucht werden 10tel Grad. +/*N*/ long nAngle = pObj->GetRotateAngle()/10; +/*N*/ +/*N*/ aPrevRect=Get3DDescrRect(p3DObj,rSet); +/*N*/ if(nAngle!=0) +/*N*/ { +/*?*/ //Um TopLeft drehen, so wie es später gezeichnet wird +/*?*/ XPolygon aPoly(aPrevRect); +/*?*/ aPoly.Rotate(aPrevRect.TopLeft(),(USHORT)nAngle); +/*?*/ //und um den Koordinaten-Ursprung herum zurückdrehen +/*?*/ //um wieder Rectangles zu erhalten (für Intersect) +/*?*/ aPoly.Rotate(Point(0,0),(USHORT)(3600 - nAngle)); +/*?*/ aPrevRect=aPoly.GetBoundRect(); +/*N*/ } +/*N*/ +/*N*/ while(p3DObj) +/*N*/ { +/*N*/ //nächstes Objekt holen, abhängig davon, ob das zuletzt behandelte +/*N*/ //entfernt wurde oder nicht (bGetCurrent) +/*N*/ if(bGetCurrent) +/*N*/ { +/*?*/ p3DObj=aList.GetCurObject(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ p3DObj=aList.Next(); +/*N*/ } +/*N*/ bGetCurrent=FALSE; +/*N*/ +/*N*/ //Da insbesondere bei Remove() des letzten Objects sowohl Next() +/*N*/ //als auch GetCurObject() den alten Pointer zurückgeben, +/*N*/ //wird getestet, ob tatsächlich verschiedene Objekte vorliegen +/*N*/ DBG_ASSERT(p3DObj!=pOld3DObj,"Chart: pointers equal in Scene:reduce..."); +/*N*/ if(p3DObj && p3DObj!=pOld3DObj) +/*N*/ { +/*N*/ pOld3DObj=p3DObj; +/*N*/ +/*N*/ aNextRect=Get3DDescrRect(p3DObj,rSet); +/*N*/ +/*N*/ if(nAngle!=0) +/*N*/ { +/*?*/ //Um TopLeft drehen (wie oben): +/*?*/ XPolygon aPoly(aNextRect); +/*?*/ aPoly.Rotate(aNextRect.TopLeft(),(USHORT)nAngle); +/*?*/ //und um den Ursprung herum zurückdrehen +/*?*/ aPoly.Rotate(Point(0,0),(USHORT)(3600 - nAngle)); +/*?*/ aNextRect=aPoly.GetBoundRect(); +/*N*/ } +/*N*/ +/*N*/ aIntersect=aNextRect.GetIntersection(aPrevRect); +/*N*/ if( ! (aIntersect.IsEmpty()) +/*N*/ && ( (aIntersect.GetHeight()>aNextRect.GetHeight()/100) +/*N*/ ||(aIntersect.GetWidth() >aNextRect.GetHeight()/100)//2% Deckung maximal bezogen auf die Fonthöhe +/*N*/ ) +/*N*/ ) +/*N*/ { +/*N*/ E3dObject* pParent=p3DObj->GetParentObj(); +/*N*/ if(pParent) +/*N*/ { +/*N*/ //aus der Page streichen +/*N*/ pParent->Remove3DObj(p3DObj); +/*N*/ +/*N*/ +/*N*/ //Die Objekte koennen ruhig in der Liste verbleiben, löschen führt +/*N*/ //nur zu Problemen +/*N*/ +/*N*/ //Da das Object entfernt wurde, darf nicht Next gerufen werden. +/*N*/ //bGetCurrent=TRUE; +/*N*/ //und aus der Liste streichen +/*N*/ //aList.Remove(); +/*N*/ //delete p3DObj; (íst offenbar bei Remove() schon geschehen ???) +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ DBG_TRACE("Chart:: Object has no parent (Scene)"); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aPrevRect=aNextRect; +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ } + +/*N*/ void ChartScene::Initialize() +/*N*/ { +/*N*/ // #66930# BM activate second light source and deactivate first one +/*N*/ // reason: the first light source is in contrast to the other seven +/*N*/ // lightsources specular by default +/*N*/ +/*N*/ // Note: Use items at the scene instead of methods at the subobjects +/*N*/ // otherwise settings get overwritten later +/*N*/ +/*N*/ // copy lightsource 1 (Base3DLight0) to lightsource 2 +/*N*/ // color +/*N*/ SetItem( Svx3DLightcolor2Item( GetLightGroup().GetIntensity( Base3DMaterialDiffuse, Base3DLight0 ))); +/*N*/ // direction +/*N*/ SetItem( Svx3DLightDirection2Item( GetLightGroup().GetDirection( Base3DLight0 ))); +/*N*/ +/*N*/ // enable light source 2 +/*N*/ SetItem( Svx3DLightOnOff2Item( TRUE )); +/*N*/ // disable light source 1 +/*N*/ SetItem( Svx3DLightOnOff1Item( FALSE )); +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_datalog.cxx b/binfilter/bf_sch/source/core/sch_datalog.cxx new file mode 100644 index 000000000000..2f39d684404e --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_datalog.cxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "datalog.hxx" +namespace binfilter { + +/*N*/ SchDataLogBook::~SchDataLogBook() +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_datapoin.cxx b/binfilter/bf_sch/source/core/sch_datapoin.cxx new file mode 100644 index 000000000000..2c304959b5d6 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_datapoin.cxx @@ -0,0 +1,167 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svx/svditer.hxx> + +#include "datapoin.hxx" +#include "glob.hxx" +#include <tools/debug.hxx> +namespace binfilter { +/************************************************************************* +|* +|* Datenpunkt ermitteln +|* +\************************************************************************/ + +/*N*/ SchDataPoint* GetDataPoint(const SdrObject& rObj) +/*N*/ {//#63904 2x Schleife (15%), 50% pData, 18% id +/*N*/ USHORT i=rObj.GetUserDataCount(); +/*N*/ while(i--) +/*N*/ { +/*N*/ SdrObjUserData *pData = rObj.GetUserData(i); +/*N*/ if (pData && pData->GetId() == SCH_DATAPOINT_ID) +/*N*/ return (SchDataPoint*)pData; +/*N*/ } +/*N*/ +/*N*/ return NULL; +/*N*/ } + +/************************************************************************* +|* +|* Objekt mit Datenpunkt-Indizes suchen; +|* liefert NULL, wenn kein Objekt gefunden wurde. +|* +\************************************************************************/ + +/*N*/ SdrObject* GetObjWithColRow(short nCol, short nRow, +/*N*/ const SdrObjList& rObjList, ULONG* pIndex) +/*N*/ { +/*N*/ ULONG nIndex = 0; +/*N*/ +/*N*/ SdrObjListIter aIterator(rObjList, IM_FLAT); +/*N*/ while (aIterator.IsMore()) +/*N*/ { +/*N*/ SdrObject* pObj = aIterator.Next(); +/*N*/ SchDataPoint* pDataPoint = GetDataPoint(*pObj); +/*N*/ if (pDataPoint && pDataPoint->GetCol() == nCol && +/*N*/ pDataPoint->GetRow() == nRow) +/*N*/ { +/*N*/ if (pIndex) +/*N*/ *pIndex = nIndex; +/*N*/ return pObj; +/*N*/ } +/*N*/ +/*N*/ nIndex++; +/*N*/ } +/*N*/ +/*N*/ return NULL; +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchDataPoint::SchDataPoint() : +/*N*/ SdrObjUserData(SchInventor, SCH_DATAPOINT_ID, 0), +/*N*/ nCol(0), +/*N*/ nRow(0) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchDataPoint::SchDataPoint(short nC, short nR) : +/*N*/ SdrObjUserData(SchInventor, SCH_DATAPOINT_ID, 0), +/*N*/ nCol(nC), +/*N*/ nRow(nR) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Kopier-Konstruktor +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Kopie erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjUserData* SchDataPoint::Clone(SdrObject *pObj) const +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL; //STRIP001 return new SchDataPoint(*this); +/*N*/ } + +/************************************************************************* +|* +|* Daten in Stream schreiben +|* +\************************************************************************/ + +/*N*/ void SchDataPoint::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ +/*N*/ rOut << (INT16)nCol; +/*N*/ rOut << (INT16)nRow; +/*N*/ } + +/************************************************************************* +|* +|* Daten aus Stream lesen +|* +\************************************************************************/ + +/*N*/ void SchDataPoint::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ +/*N*/ INT16 nInt16; +/*N*/ +/*N*/ rIn >> nInt16; nCol = (short)nInt16; +/*N*/ rIn >> nInt16; nRow = (short)nInt16; +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_datarow.cxx b/binfilter/bf_sch/source/core/sch_datarow.cxx new file mode 100644 index 000000000000..d8b6693777ad --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_datarow.cxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif +#include <bf_svx/svditer.hxx> + +#include "datarow.hxx" +#include "glob.hxx" +#include <tools/debug.hxx> +namespace binfilter { +/************************************************************************* +|* +|* Datenreihen-Index ermitteln +|* +\************************************************************************/ + +/*N*/ SchDataRow* GetDataRow(const SdrObject& rObj) +/*N*/ { +/*N*/ USHORT i=rObj.GetUserDataCount();//#63904 2x Schleife (15%), 50% pData, 18% id +/*N*/ while(i--) +/*N*/ { +/*N*/ SdrObjUserData *pData = rObj.GetUserData(i); +/*N*/ if (pData && pData->GetId() == SCH_DATAROW_ID) +/*N*/ return (SchDataRow*)pData; +/*N*/ } +/*N*/ +/*N*/ return NULL; +/*N*/ } + +/************************************************************************* +|* +|* Objekt mit Datenreihen-Index suchen; +|* liefert NULL, wenn kein Objekt gefunden wurde. +|* +\************************************************************************/ + +/*N*/ SdrObject* GetObjWithRow(short nRow, const SdrObjList& rObjList, +/*N*/ ULONG* pIndex) +/*N*/ { +/*N*/ ULONG nIndex = 0; +/*N*/ +/*N*/ SdrObjListIter aIterator(rObjList, IM_FLAT); +/*N*/ while (aIterator.IsMore()) +/*N*/ { +/*N*/ SdrObject* pObj = aIterator.Next(); +/*N*/ SchDataRow* pDataRow = GetDataRow(*pObj); +/*N*/ if (pDataRow && pDataRow->GetRow() == nRow) +/*N*/ { +/*N*/ if (pIndex) +/*N*/ *pIndex = nIndex; +/*N*/ return pObj; +/*N*/ } +/*N*/ +/*N*/ nIndex++; +/*N*/ } +/*N*/ +/*N*/ return NULL; +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchDataRow::SchDataRow() : +/*N*/ SdrObjUserData(SchInventor, SCH_DATAROW_ID, 0), +/*N*/ nRow(0) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchDataRow::SchDataRow(short nR) : +/*N*/ SdrObjUserData(SchInventor, SCH_DATAROW_ID, 0), +/*N*/ nRow(nR) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Kopier-Konstruktor +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Kopie erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjUserData* SchDataRow::Clone(SdrObject *pObj) const +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return new SchDataRow(*this); +/*N*/ } + +/************************************************************************* +|* +|* Daten in Stream schreiben +|* +\************************************************************************/ + +/*N*/ void SchDataRow::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ +/*N*/ rOut << (INT16)nRow; +/*N*/ } + +/************************************************************************* +|* +|* Daten aus Stream lesen +|* +\************************************************************************/ + +/*N*/ void SchDataRow::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ +/*N*/ INT16 nInt16; +/*N*/ +/*N*/ rIn >> nInt16; nRow = (short)nInt16; +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_glob.src b/binfilter/bf_sch/source/core/sch_glob.src new file mode 100644 index 000000000000..1b8c35c49995 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_glob.src @@ -0,0 +1,507 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + +#include "glob.hrc" +String STR_LAYOUT +{ + Text [ de ] = "Layout" ; + Text [ en-US ] = "Layout" ; + Text[ pt ] = "Configuração"; + Text[ ru ] = "Разметка"; + Text[ el ] = "Διάταξη"; + Text[ nl ] = "Lay-out"; + Text[ fr ] = "Mise en page"; + Text[ es ] = "Diseño"; + Text[ fi ] = "Asettelu"; + Text[ ca ] = "Format"; + Text[ it ] = "Layout"; + Text[ da ] = "Layout"; + Text[ sv ] = "Layout"; + Text[ pl ] = "UkÅ‚ad"; + Text[ pt-BR ] = "Layout"; + Text[ th ] = "เค้าโครง"; + Text[ ja ] = "レイアウト"; + Text[ ko ] = "ë ˆì´ì•„웃"; + Text[ zh-CN ] = "版å¼"; + Text[ zh-TW ] = "版å¼"; + Text[ tr ] = "Sayfa düzeni"; + Text[ hi-IN ] = "अà¤à¤¿à¤¨à¥à¤¯à¤¾à¤¸"; + Text[ ar ] = "تخطيط"; + Text[ he ] = "‮פריסה‬"; +}; +String STR_CONTROLS +{ + Text [ de ] = "Controls" ; + Text [ en-US ] = "Controls" ; + Text[ pt ] = "Controlos"; + Text[ ru ] = "Ðлементы управлениÑ"; + Text[ el ] = "Στοιχεία ελÎγχου"; + Text[ nl ] = "Controls"; + Text[ fr ] = "Contrôles"; + Text[ es ] = "Controles"; + Text[ fi ] = "Ohjausobjektit"; + Text[ ca ] = "Controls"; + Text[ it ] = "Campi di controllo"; + Text[ da ] = "Kontrolelementer"; + Text[ sv ] = "Controls"; + Text[ pl ] = "Formanty"; + Text[ pt-BR ] = "Controles"; + Text[ th ] = "ตัวควบคุม"; + Text[ ja ] = "コントãƒãƒ¼ãƒ«"; + Text[ ko ] = "컨트롤"; + Text[ zh-CN ] = "控件"; + Text[ zh-TW ] = "æŽ§åˆ¶é …"; + Text[ tr ] = "Komut alanları"; + Text[ hi-IN ] = "नियंतà¥à¤°à¤£"; + Text[ ar ] = "عناصر تØكم"; + Text[ he ] = "‮פקדי×‬"; +}; +String STR_CHARTVIEWSHELL +{ + Text [ de ] = "Diagrammmodus" ; + Text [ en-US ] = "Chart mode" ; + Text[ pt ] = "Modo Gráfico"; + Text[ ru ] = "Режим диаграммы"; + Text[ el ] = "Κατάσταση διαγÏάμματος"; + Text[ nl ] = "Diagrammodus"; + Text[ fr ] = "Mode Diagramme"; + Text[ es ] = "Modo diagrama"; + Text[ fi ] = "Kaaviotila"; + Text[ ca ] = "Mode del diagrama"; + Text[ it ] = "Modo diagramma"; + Text[ da ] = "Diagrammodus"; + Text[ sv ] = "Diagramläge"; + Text[ pl ] = "Tryb wykresu"; + Text[ pt-BR ] = "Modo Gráfico"; + Text[ th ] = "โหมดà¹à¸œà¸™à¸ ูมิ"; + Text[ ja ] = "グラフ モード"; + Text[ ko ] = "차트 모드"; + Text[ zh-CN ] = "图表模å¼"; + Text[ zh-TW ] = "圖表模å¼"; + Text[ tr ] = "Åžema kipi"; + Text[ hi-IN ] = "चारà¥à¤Ÿ पà¥à¤°à¤•à¤¾à¤°"; + Text[ ar ] = "وضع الرسم البياني"; + Text[ he ] = "‮תרשי×‬"; +}; +String STR_STDOBJECTBARSHELL +{ + Text [ de ] = "Diagrammleiste" ; + Text [ en-US ] = "Chart Bar" ; + Text[ pt ] = "Barra de gráficos"; + Text[ ru ] = "Панель диаграммы"; + Text[ el ] = "ΓÏαμμή διαγÏάμματος"; + Text[ nl ] = "Diagrammenbalk"; + Text[ fr ] = "Barre de diagramme"; + Text[ es ] = "Barra de diagramas"; + Text[ fi ] = "Kaaviopalkki"; + Text[ ca ] = "Barra del diagrama"; + Text[ it ] = "Barra dei diagrammi"; + Text[ da ] = "Diagramlinje"; + Text[ sv ] = "Diagramlist"; + Text[ pl ] = "SÅ‚upek na wykresie"; + Text[ pt-BR ] = "Barra de Gráficos"; + Text[ th ] = "à¹à¸–บà¹à¸œà¸™à¸ ูมิ"; + Text[ ja ] = "グラフãƒãƒ¼"; + Text[ ko ] = "차트 모ìŒ"; + Text[ zh-CN ] = "图表æ "; + Text[ zh-TW ] = "圖表工具列"; + Text[ tr ] = "Åžema çubuÄŸu"; + Text[ hi-IN ] = "चारà¥à¤Ÿ पटà¥à¤Ÿà¥€"; + Text[ ar ] = "شريط الرسم البياني"; + Text[ he ] = "â€®×ª×¨×©×™× ×¤×¡×™×‬"; +}; +String STR_APPLICATIONOBJECTBAR +{ + Text [ de ] = "Funktionsleiste" ; + Text [ en-US ] = "Function Bar" ; + Text[ pt ] = "Barra de funções"; + Text[ ru ] = "Панель функций"; + Text[ el ] = "ΓÏαμμή λειτουÏγιών"; + Text[ nl ] = "Werkbalk"; + Text[ fr ] = "Barre de fonctions"; + Text[ es ] = "Barra de funciones"; + Text[ fi ] = "Toimintorivi"; + Text[ ca ] = "Barra de funcions"; + Text[ it ] = "Barra delle funzioni"; + Text[ da ] = "Funktionslinje"; + Text[ sv ] = "Funktionslist"; + Text[ pl ] = "Pasek funkcji"; + Text[ pt-BR ] = "Barra de Funções"; + Text[ th ] = "à¹à¸–บฟังà¸à¹Œà¸Šà¸±à¹ˆà¸™"; + Text[ ja ] = "ファンクションãƒãƒ¼"; + Text[ ko ] = "기능 모ìŒ"; + Text[ zh-CN ] = "功能æ "; + Text[ zh-TW ] = "工具列"; + Text[ tr ] = "Ä°ÅŸlev çubuÄŸu"; + Text[ hi-IN ] = "फंकà¥à¤¶à¤¨à¥ पटà¥à¤Ÿà¥€"; + Text[ ar ] = "شريط المهام"; + Text[ he ] = "‮סרגל פעולות × ×¤×•×¦×•×ªâ€¬"; +}; +String STR_TITLE_MAIN +{ + Text [ de ] = "Haupttitel" ; + Text [ en-US ] = "Main title" ; + Text[ pt ] = "TÃtulo principal"; + Text[ ru ] = "Главный заголовок"; + Text[ el ] = "ΚÏÏιος τίτλος"; + Text[ nl ] = "Hoofdtitel"; + Text[ fr ] = "Titre principal"; + Text[ es ] = "TÃtulo principal"; + Text[ fi ] = "Pääotsikko"; + Text[ ca ] = "TÃtol principal"; + Text[ it ] = "Titolo principale"; + Text[ da ] = "Overskrift"; + Text[ sv ] = "Huvudrubrik"; + Text[ pl ] = "TytuÅ‚ główny"; + Text[ pt-BR ] = "TÃtulo principal"; + Text[ th ] = "ชื่à¸à¸«à¸¥à¸±à¸"; + Text[ ja ] = "メインタイトル"; + Text[ ko ] = "주 ì œëª©"; + Text[ zh-CN ] = "ä¸»æ ‡é¢˜"; + Text[ zh-TW ] = "主標題"; + Text[ tr ] = "Ana baÅŸlık"; + Text[ hi-IN ] = "मà¥à¤–à¥à¤¯ शीरà¥à¤·à¤•"; + Text[ ar ] = "العنوان الرئيسي"; + Text[ he ] = "‮כותרת ר×שית‬"; +}; +String STR_TITLE_SUB +{ + Text [ de ] = "Untertitel" ; + Text [ en-US ] = "Subtitle" ; + Text[ pt ] = "SubtÃtulo"; + Text[ ru ] = "Подзаголовок"; + Text[ el ] = "Υπότιτλος"; + Text[ nl ] = "Subtitel"; + Text[ fr ] = "Sous-titre "; + Text[ es ] = "SubtÃtulo"; + Text[ fi ] = "Alaotsikko"; + Text[ ca ] = "SubtÃtol"; + Text[ it ] = "Sottotitolo"; + Text[ da ] = "Undertitel"; + Text[ sv ] = "Underrubrik"; + Text[ pl ] = "PodtytuÅ‚"; + Text[ pt-BR ] = "SubtÃtulo"; + Text[ th ] = "ชื่à¸à¸£à¸à¸‡"; + Text[ ja ] = "サブタイトル"; + Text[ ko ] = "ë¶€ì œ"; + Text[ zh-CN ] = "åˆ†æ ‡é¢˜"; + Text[ zh-TW ] = "分標題"; + Text[ tr ] = "Alt baÅŸlık"; + Text[ hi-IN ] = "अधीन शीरà¥à¤·à¤•"; + Text[ ar ] = "العنوان الÙرعي"; + Text[ he ] = "‮תת כותרת‬"; +}; +String STR_DIAGRAM_TITLE_X_AXIS +{ + Text [ de ] = "X-Achsentitel" ; + Text [ en-US ] = "X axis title" ; + Text[ pt ] = "TÃtulo do eixo X"; + Text[ ru ] = "Заголовок оÑи X"; + Text[ el ] = "Τίτλος άξονα Χ"; + Text[ nl ] = "Titel X-as"; + Text[ fr ] = "Titre de l'axe X"; + Text[ es ] = "TÃtulo del eje X"; + Text[ fi ] = "X-akselin otsikko"; + Text[ ca ] = "TÃtol de l'eix X"; + Text[ it ] = "Titolo asse X"; + Text[ da ] = "X-aksetitel"; + Text[ sv ] = "X-axelrubrik"; + Text[ pl ] = "TytuÅ‚ osi X"; + Text[ pt-BR ] = "TÃtulo do eixo X"; + Text[ th ] = "ชื่à¸à¹à¸à¸™ X "; + Text[ ja ] = "X軸タイトル"; + Text[ ko ] = "X 축 ì œëª©"; + Text[ zh-CN ] = "X è½´æ ‡é¢˜"; + Text[ zh-TW ] = "X-軸標題"; + Text[ tr ] = "X ekseni baÅŸlığı"; + Text[ hi-IN ] = "X अकà¥à¤·à¤°à¥‡à¤–ा शीरà¥à¤·à¤•"; + Text[ ar ] = "عنوان المØور س"; + Text[ he ] = "‮כותרת ציר X‬"; +}; +String STR_DIAGRAM_TITLE_Y_AXIS +{ + Text [ de ] = "Y-Achsentitel" ; + Text [ en-US ] = "Y axis title" ; + Text[ pt ] = "TÃtulo do eixo Y"; + Text[ ru ] = "Заголовок оÑи Y"; + Text[ el ] = "Τίτλος άξονα Y"; + Text[ nl ] = "Titel Y-as"; + Text[ fr ] = "Titre de l'axe Y"; + Text[ es ] = "TÃtulo del eje Y"; + Text[ fi ] = "Y-akselin otsikko"; + Text[ ca ] = "TÃtol de l'eix Y"; + Text[ it ] = "Titolo asse Y"; + Text[ da ] = "Y-aksetitel"; + Text[ sv ] = "Y-axelrubrik"; + Text[ pl ] = "TytuÅ‚ osi Y"; + Text[ pt-BR ] = "TÃtulo do eixo Y"; + Text[ th ] = "ชื่à¸à¹à¸à¸™ Y "; + Text[ ja ] = "Y軸タイトル"; + Text[ ko ] = "Y축 ì œëª©"; + Text[ zh-CN ] = "Y è½´æ ‡é¢˜"; + Text[ zh-TW ] = "Y-軸標題"; + Text[ tr ] = "Y ekseni baÅŸlığı"; + Text[ hi-IN ] = "Y axis title"; + Text[ ar ] = "عنوان المØور ص"; + Text[ he ] = "‮כותרת ציר Y‬"; +}; +String STR_DIAGRAM_TITLE_Z_AXIS +{ + Text [ de ] = "Z-Achsentitel" ; + Text [ en-US ] = "Z axis title" ; + Text[ pt ] = "TÃtulo do eixo Z"; + Text[ ru ] = "Заголовок оÑи Z"; + Text[ el ] = "Τίτλος άξονα Z"; + Text[ nl ] = "Titel Z-as"; + Text[ fr ] = "Titre de l'axe Z"; + Text[ es ] = "TÃtulo del eje Z"; + Text[ fi ] = "Z-akselin otsikko"; + Text[ ca ] = "TÃtol de l'eix Z"; + Text[ it ] = "Titolo asse Z"; + Text[ da ] = "Z-aksetitel"; + Text[ sv ] = "Z-axelrubrik"; + Text[ pl ] = "TytuÅ‚ osi Z"; + Text[ pt-BR ] = "TÃtulo do eixo Z"; + Text[ th ] = "ชื่à¸à¹à¸à¸™ Z "; + Text[ ja ] = "Z軸タイトル"; + Text[ ko ] = "Z축 ì œëª©"; + Text[ zh-CN ] = "Z è½´æ ‡é¢˜"; + Text[ zh-TW ] = "Z-軸標題"; + Text[ tr ] = "Z ekseni baÅŸlığı"; + Text[ hi-IN ] = "Z अकà¥à¤·à¤°à¥‡à¤–ा शीरà¥à¤·à¤•"; + Text[ ar ] = "عنوان المØور ع"; + Text[ he ] = "‮כותרת ציר Z‬"; +}; +String STR_COLUMN +{ + Text [ de ] = "Spalte $(N)" ; + Text [ x-comment ] = "the parameter $(N) is replaced by the number of a column"; + Text [ en-US ] = "Column $(N) " ; + Text[ pt ] = "Coluna $(N)"; + Text[ ru ] = "Столбец $(N)"; + Text[ el ] = "Στήλη $(N)"; + Text[ nl ] = "Kolom $(N)"; + Text[ fr ] = "Colonne $(N)"; + Text[ es ] = "Columna $(N)"; + Text[ fi ] = "Sarake $(N) "; + Text[ ca ] = "Columna $(N) "; + Text[ it ] = "Colonna $(N)"; + Text[ da ] = "Kolonne $(N)"; + Text[ sv ] = "Kolumn $(N)"; + Text[ pl ] = "Kolumna $(N)"; + Text[ pt-BR ] = "Coluna $(N) "; + Text[ th ] = "คà¸à¸¥à¸±à¸¡à¸™à¹Œ $(N) "; + Text[ ja ] = "列 $(N)"; + Text[ ko ] = "ì—´ $(N)"; + Text[ zh-CN ] = "列 $(N)"; + Text[ zh-TW ] = "欄 $(N)"; + Text[ tr ] = "Sütun $(N)"; + Text[ hi-IN ] = "सà¥à¤¤à¤‚ठ$(N)"; + Text[ ar ] = "العمود $(N)"; + Text[ he ] = "‮עמודה $(N) ‬"; +}; +String STR_ROW +{ + Text [ de ] = "Zeile $(N)" ; + Text [ x-comment ] = "the parameter $(N) is replaced by the number of a row"; + Text [ en-US ] = "Row $(N)" ; + Text[ pt ] = "Linha $(N)"; + Text[ ru ] = "Строка $(N)"; + Text[ el ] = "ΓÏαμμή $(N)"; + Text[ nl ] = "Rij $(N)"; + Text[ fr ] = "Ligne $(N)"; + Text[ es ] = "Fila $(N)"; + Text[ fi ] = "Rivi $(N)"; + Text[ ca ] = "Fila $(N)"; + Text[ it ] = "Riga $(N)"; + Text[ da ] = "Række $(N)"; + Text[ sv ] = "Rad $(N)"; + Text[ pl ] = "Wiersz $(N)"; + Text[ pt-BR ] = "Linha $(N) "; + Text[ th ] = "à¹à¸–ว $(N)"; + Text[ ja ] = "è¡Œ $(N)"; + Text[ ko ] = "í–‰$(N)"; + Text[ zh-CN ] = "è¡Œ $(N)"; + Text[ zh-TW ] = "列 $(N)"; + Text[ tr ] = "Satır $(N)"; + Text[ hi-IN ] = "Row $(N)"; + Text[ ar ] = "الص٠$(N)"; + Text[ he ] = "‮ שורה $(N)‬"; +}; +String STR_STLSHEET_TITLE_MAIN +{ + Text = "Haupttitel" ; +}; +String STR_STLSHEET_TITLE_SUB +{ + Text = "Untertitel" ; +}; +String STR_STLSHEET_TITLE_X_AXIS +{ + Text = "X-Achsentitel" ; +}; +String STR_STLSHEET_TITLE_Y_AXIS +{ + Text = "Y-Achsentitel" ; +}; +String STR_STLSHEET_TITLE_Z_AXIS +{ + Text = "Z-Achsentitel" ; +}; +String STR_STLSHEET_DATAROWS +{ + Text = "Datenzeilen" ; +}; +String STR_STLSHEET_DATACOLS +{ + Text = "Datenspalten" ; +}; +String STR_STLSHEET_DATAVALUES +{ + Text = "Datenwerte" ; +}; +String STR_STLSHEET_DATADESCR +{ + Text = "Datenbeschriftung" ; +}; +String STR_STLSHEET_LEGEND +{ + Text = "Legende" ; +}; +String STR_NO_LOGARITHMIC_MIN_VALUES +{ + Text [ de ] = "Negative und Null-Werte können nicht logarithmisch dargestellt werden." ; + Text [ en-US ] = "Negative and zero values cannot be logarithmicaly portrayed." ; + Text[ pt ] = "Valores zero e negativos não podem ser representados de forma logarÃtmica."; + Text[ ru ] = "Ðевозможно предÑтавить логарифмичеÑки отрицательные и нулевые значениÑ."; + Text[ el ] = "Δεν είναι δυνατόν να γίνει λογαÏιθμητική παÏάσταση αÏνητικών και μηδενικών τιμών."; + Text[ nl ] = "Negatieve waarden en nul-waarden kunnen niet logaritmisch worden weergegeven."; + Text[ fr ] = "Valeurs négatives et valeurs zéro ne peuvent être affichées sous forme de logarithme"; + Text[ es ] = "No es posible representar logarÃtmicamente valores cero o valores negativos."; + Text[ fi ] = "Negatiivisia arvoja ja nollaa ei voi kuvata logaritmisesti."; + Text[ ca ] = "No és possible representar logarÃtmicament valors zero o valors negatius."; + Text[ it ] = "Valori nulli e negativi non possono essere rappresentati logaritmamente."; + Text[ da ] = "Negative værdier og nulværdier kan ikke vises logaritmisk."; + Text[ sv ] = "Negativa värden och nollvärden kan inte visas logaritmiskt."; + Text[ pl ] = "WartoÅ›ci ujemne i zerowe nie mogÄ… zostać przedstawione logarytmicznie."; + Text[ pt-BR ] = "Valores nulos e negativos não podem ser apresentados de forma logarÃtmica."; + Text[ th ] = "ไม่สามารถà¸à¸˜à¸´à¸šà¸²à¸¢à¸—างลà¸à¸à¸²à¸£à¸´à¸˜à¸¶à¸¡à¸„่าลบà¹à¸¥à¸°à¸¨à¸¹à¸™à¸¢à¹Œà¹„ด้"; + Text[ ja ] = "マイナス値ã¨ã‚¼ãƒã¯å¯¾æ•°è¡¨ç¤ºã§ãã¾ã›ã‚“。"; + Text[ ko ] = "(ï¼) ë˜ëŠ” 0 ê°’ì€ ë¡œê·¸ë¡œ 표현ë 수 없습니다."; + Text[ zh-CN ] = "è´Ÿæ•°å’Œé›¶æ— æ³•ä»¥å¯¹æ•°çš„å½¢å¼è¡¨ç¤ºã€‚"; + Text[ zh-TW ] = "è² æ•¸å’Œé›¶ç„¡æ³•ä»¥å°æ•¸çš„å½¢å¼è¡¨ç¤ºã€‚"; + Text[ tr ] = "Negatif ve sıfır deÄŸerleri, logaritmik olarak görüntülenemez."; + Text[ hi-IN ] = "ऋणातà¥à¤®à¤• सखà¥à¤¯à¤¾à¤à¤“ à¤à¤µà¤‚ शà¥à¤¨à¥à¤¯ का लघà¥à¤—णक नहीं होता है।"; + Text[ ar ] = "لا يمكن عرض القيم السلبية وقيم الصÙر لوغاريتمياً."; + Text[ he ] = "â€®×œ× × ×™×ª×Ÿ להציג ×¢×¨×›×™× ×©×œ×™×œ×™×™× ×ו ×פס ×‘×ª×¨×©×™× ×œ×•×’×¨×™×ª×ž×™.‬"; +}; +String STR_NO_MIN_VALUES +{ + Text [ de ] = "Der Diagrammtyp kann keine negativen Werte darstellen." ; + Text [ en-US ] = "The selected chart type cannot portay negative values." ; + Text[ pt ] = "O tipo de gráfico não pode apresentar valor negativos."; + Text[ ru ] = "Выбранный тип диаграммы не может предÑтавить отрицательные значениÑ."; + Text[ el ] = "Ο Ï„Ïπος διαγÏάμματος δεν Îχει δυνατότητα εμφάνισης αÏνητικών τιμών."; + Text[ nl ] = "In dit diagramtype kunnen geen negatieve waarden worden weergeven."; + Text[ fr ] = "Ce type de diagramme ne peut représenter des valeurs négatives."; + Text[ es ] = "Este tipo de diagrama no puede representar valores negativos."; + Text[ fi ] = "Valittu kaaviotyyppi ei voi kuvata negatiivisia arvoja."; + Text[ ca ] = "El tipus de diagrama seleccionat no pot representar valors negatius."; + Text[ it ] = "Il tipo di diagramma non può rappresentare valori negativi."; + Text[ da ] = "Denne diagramtype kan ikke vise negative værdier."; + Text[ sv ] = "Diagramtypen kan inte visa negativa värden."; + Text[ pl ] = "Wybrany typ wykresu nie może przedstawiać wartoÅ›ci ujemnych."; + Text[ pt-BR ] = "O tipo de gráfico selecionado não pode apresentar valores negativos."; + Text[ th ] = "ชนิดขà¸à¸‡à¹à¸œà¸™à¸ ูมิที่เลืà¸à¸à¹„ม่สามารถà¸à¸˜à¸´à¸šà¸²à¸¢à¸„่าลบได้"; + Text[ ja ] = "ã“ã®ã‚°ãƒ©ãƒ•ã®ç¨®é¡žã¯ãƒžã‚¤ãƒŠã‚¹å€¤ã‚’表ã™ã“ã¨ãŒã§ãã¾ã›ã‚“。"; + Text[ ko ] = "ì„ íƒëœ ì°¨íŠ¸ì˜ ìœ í˜•ì€ (ï¼ï¼‰ê°’ì„ í‘œí˜„í• ìˆ˜ 없습니다."; + Text[ zh-CN ] = "æ¤ç±»å›¾è¡¨ä¸èƒ½æ˜¾ç¤ºè´Ÿæ•°å€¼ã€‚"; + Text[ zh-TW ] = "æ¤é¡žåœ–表ä¸èƒ½é¡¯ç¤ºè² 數值。"; + Text[ tr ] = "Bu ÅŸema tipi, negatif deÄŸerleri görüntüleyemiyor."; + Text[ hi-IN ] = "चà¥à¤¨à¤¾ हà¥à¤† चारà¥à¤Ÿ वरà¥à¤— कà¥à¤·à¤¯à¤°à¤¾à¤¶à¤¿ मूलà¥à¤¯à¥‹à¤‚ को वरà¥à¤£à¤¨ नहीं कर सकता है ।"; + Text[ ar ] = "هذا النوع من الرسوم البيانية لا يمكنه عرض القيم السلبية."; + Text[ he ] = "‮סוג ×”×ª×¨×©×™× ×”× ×‘×—×¨ ××™× ×• מסוגל להציג ×¢×¨×›×™× ×©×œ×™×œ×™×™×.‬"; +}; +String STR_ONLY_ABS_VALUES +{ + Text [ de ] = "Der Diagrammtyp kann keinen Wertebereich mit unterschiedlichem Vorzeichen darstellen.\nEs werden Absolutwerte angenommen." ; + Text [ en-US ] = "This chart type cannot portray value areas with different signs.\nThe values will be shown as absolutes without signs." ; + Text[ pt ] = "Este tipo de gráfico não pode apresentar áreas de valor com sinais diferentes.\n São aceites valores absolutos."; + Text[ ru ] = "Ðтот тип диаграммы не может предÑтавить облаÑÑ‚ÑŒ значений Ñ Ñ€Ð°Ð·Ð»Ð¸Ñ‡Ð½Ñ‹Ð¼Ð¸ знаками.\nПоÑтому будут показаны абÑолютные значениÑ."; + Text[ el ] = "Ο Ï„Ïπος διαγÏάμματος δεν Îχει δυνατότητα εμφάνισης πεÏιοχής τιμών με διαφοÏετικά Ï€Ïόσημα.\nΘα αναγνωÏιστοÏν ως απόλυτες τιμÎÏ‚."; + Text[ nl ] = "In dit diagramtype kan geen waardenbereik met verschillende voortekens worden weergeven.\nEr worden absolute waarden aangenomen."; + Text[ fr ] = "Ce type de diagramme ne peut représenter des plages valeurs de signes différents.\nLes valeurs absolues seront acceptées."; + Text[ es ] = "Este tipo de diagrama no puede representar una gama de valores con signos diferentes.\nSe aceptan valores absolutos."; + Text[ fi ] = "Tässä kaaviotyypissä ei voi kuvata arvoalueita, joissa on sekä negatiivisia että positiivisia arvoja.\nArvot kuvataan itseisarvoina ilman etumerkkejä."; + Text[ ca ] = "Aquest tipus de diagrama no pot representar una gamma de valors amb signes diferents.\nS'accepten valors absoluts."; + Text[ it ] = "Il tipo di diagramma non può visualizzare aree di dati con diversi segni.\nVengono accettati solo valori assoluti."; + Text[ da ] = "Denne diagramtype kan ikke vise et værdiomrÃ¥de med forskelligt fortegn.\nVærdierne bliver vist som absolutværdier, dvs. uden hensyntagen til fortegn."; + Text[ sv ] = "Diagramtypen kan inte visa värdeomrÃ¥den med olika förtecken.\nAbsolutvärden visas."; + Text[ pl ] = "Ten typ wykresu nie może przedstawiać obszarów wartoÅ›ci o różnych znakach.\nZostanÄ… pokazane wartoÅ›ci absolutne (bez znaków)."; + Text[ pt-BR ] = "Este tipo de gráfico não pode apresentar valores de área com sinais diferentes.\n Os valores serão mostrados como valores absolutos sem sinal."; + Text[ th ] = "ชนิดà¹à¸œà¸™à¸ ูมินี้ไม่สามารถพื้นที่ขà¸à¸‡à¸„่าด้วยสัà¸à¸¥à¸±à¸à¸©à¸“์ที่ต่างà¸à¸±à¸™à¹„ด้\nค่าจะถูà¸à¹à¸ªà¸”งเป็นค่าสัมบูรณ์โดยไม่มีสัà¸à¸¥à¸±à¸à¸©à¸“์"; + Text[ ja ] = "ã“ã®ã‚°ãƒ©ãƒ•ã®ç¨®é¡žã¯ç•°ãªã‚‹ç¬¦å·ã®ä»˜ã数値ã®ç¯„囲を表示ã§ãã¾ã›ã‚“。\n絶対値ãŒæŽ¡ç”¨ã•ã‚Œã¾ã™ã€‚"; + Text[ ko ] = "ì„ íƒëœ ì°¨íŠ¸ì˜ ìœ í˜•ì€ ì—¬ëŸ¬ê°€ì§€ 부호가 ë¶™ì€ ê°’ 구ì—ì„ í‘œí˜„í• ìˆ˜ 없습니다.\nì ˆëŒ€ê°’ìœ¼ë¡œ 간주ë©ë‹ˆë‹¤."; + Text[ zh-CN ] = "æ¤å›¾è¡¨ç±»åž‹æ— 法显示å«æœ‰ä¸åŒæ£è´Ÿå·çš„数值区域。\nåªèƒ½å¤Ÿå¤„ç†ç»å¯¹å€¼ã€‚"; + Text[ zh-TW ] = "æ¤åœ–表類型無法顯示å«æœ‰ä¸åŒæ£è² 號的數值å€åŸŸã€‚\nåªæŽ¥å—絕å°å€¼ã€‚"; + Text[ tr ] = "Bu ÅŸema tipi, farklı iÅŸaretleri olan deÄŸer aralıklarını görüntüleyemiyor.\nMutlak deÄŸerler görüntülenecek."; + Text[ hi-IN ] = "चà¥à¤¨à¤¾ हà¥à¤† चारà¥à¤Ÿà¥ वरà¥à¤— मूलà¥à¤¯ वीसà¥à¤¤à¥€à¤°à¥à¤£à¥‹à¤‚ को अलग-अलग चिनà¥à¤¹ से वरà¥à¤£à¤¨ नहीं कर सकता है ।\nमूलà¥à¤¯ को चिनà¥à¤¹ रहित निशà¥à¤šà¤¿à¤¤ रूप से दिखाया जाà¤à¤—ा ।"; + Text[ ar ] = "لا يمكن لنمط الرسم البياني هذا إظهار نطاق قيم بعلامات مختلÙØ©.\nسو٠يتم قبول القيم المطلقة."; + Text[ he ] = "‮סוג ×”×ª×¨×©×™× ×”×–×” ××™× ×• מסוגל להציג ×¢×¨×›×™× ×‘×¢×œ×™ ×¡×™×ž× ×™× ×”×¤×•×›×™×.\nולכן ×”×¢×¨×›×™× ×™×•×¦×’×• ×›×¢×¨×›×™× ×ž×•×—×œ×˜×™× ×œ×œ× ×¡×™×ž× ×™×.‬"; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binfilter/bf_sch/source/core/sch_globfunc.cxx b/binfilter/bf_sch/source/core/sch_globfunc.cxx new file mode 100644 index 000000000000..de89898de7ad --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_globfunc.cxx @@ -0,0 +1,1395 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifdef _MSC_VER +#pragma optimize("e",off) + + +#pragma hdrstop +#endif +#define ITEMID_FONTLIST 0 +#define ITEMID_POSTURE 0 +#define ITEMID_WEIGHT 0 +#define ITEMID_UNDERLINE 0 +#define ITEMID_CROSSEDOUT 0 +#define ITEMID_SHADOWED 0 +#define ITEMID_AUTOKERN 0 +#define ITEMID_WORDLINEMODE 0 +#define ITEMID_CONTOUR 0 +#define ITEMID_PROPSIZE 0 +#define ITEMID_CHARSETCOLOR 0 +#define ITEMID_KERNING 0 +#define ITEMID_CASEMAP 0 +#define ITEMID_ESCAPEMENT 0 +#define ITEMID_LANGUAGE 0 +#define ITEMID_NOLINEBREAK 0 +#define ITEMID_NOHYPHENHERE 0 +#define ITEMID_BLINK 0 + +#define ITEMID_FONT EE_CHAR_FONTINFO +#define ITEMID_COLOR EE_CHAR_COLOR +#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT +#define ITEMID_FONTWIDTH EE_CHAR_FONTWIDTH + +#include <bf_svtools/whiter.hxx> + +#include <bf_svx/eeitem.hxx> + +#include "schattr.hxx" +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + +#include <bf_svtools/eitem.hxx> + +#endif + + +#include <bf_svx/fhgtitem.hxx> + + + +#include <bf_svx/svxids.hrc> + + +#include <globfunc.hxx> + + + + +#include "math.h" +#include "float.h" + + +#include <bf_svx/fontitem.hxx> +#include <bf_svx/wghtitem.hxx> +#include <bf_svx/udlnitem.hxx> +#include <bf_svx/crsditem.hxx> +#include <bf_svx/postitem.hxx> +#include <bf_svx/cntritem.hxx> +#include <bf_svx/shdditem.hxx> +#include <bf_svx/akrnitem.hxx> +#include <bf_svx/wrlmitem.hxx> + +#include <algorithm> +#include <functional> + +/************************************************************************* +|* +|* Objekt attributieren +|* +\************************************************************************/ +namespace binfilter { +/*N*/ SdrObject *SetObjectAttr (SdrObject *pObj, +/*N*/ UINT16 nID, +/*N*/ BOOL bProtect, +/*N*/ BOOL bResize, +/*N*/ SfxItemSet *pAttr) +/*N*/ { +/*N*/ pObj->InsertUserData (new SchObjectId (nID)); +/*N*/ pObj->SetMoveProtect (bProtect); +/*N*/ pObj->SetResizeProtect (bResize); +/*N*/ if (pAttr) +/*N*/ //-/ pObj->NbcSetAttributes (*pAttr, FALSE);//#63904# Nbc neu +/*N*/ pObj->SetItemSet(*pAttr); +/*N*/ +/*N*/ return pObj; +/*N*/ } + +/************************************************************************* +|* +|* Objektgruppe erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjList *CreateGroup (SdrObjList &rObjList, +/*N*/ UINT16 nID, +/*N*/ ULONG nIndex) +/*N*/ { +/*N*/ SdrObjGroup *pGroup = (SdrObjGroup *) SetObjectAttr (new SchObjGroup, nID, TRUE, TRUE, 0); +/*N*/ +/*N*/ rObjList.NbcInsertObject((SdrObject *) pGroup, nIndex); +/*N*/ return pGroup->GetSubList(); +/*N*/ } + +/************************************************************************* +|* +|* Objektgruppe erzeugen +|* +\************************************************************************/ + +/*N*/ SchObjGroup *CreateSimpleGroup (UINT16 nID, +/*N*/ BOOL bProtect, +/*N*/ BOOL bResize) +/*N*/ { +/*N*/ return (SchObjGroup *) SetObjectAttr (new SchObjGroup, nID, bProtect, bResize, 0); +/*N*/ } + + +/************************************************************************* +|* +|* Berechne kub. Spline +|* +\************************************************************************/ + +/*N*/ void CubicSpline (XPolygon &pKnownPoints, +/*N*/ int n, +/*N*/ int splineSize, +/*N*/ XPolygon &pSplines) +/*N*/ { +/*N*/ double *h = new double [n + 1]; +/*N*/ double *m = new double [n + 1]; +/*N*/ double *q = new double [n + 1]; +/*N*/ double *u = new double [n + 1]; +/*N*/ +/*N*/ for (int k = 1; +/*N*/ k <= n; +/*N*/ k ++) +/*N*/ h [k] = pKnownPoints [k].X () - pKnownPoints [k - 1].X (); +/*N*/ +/*N*/ double p; +/*N*/ double lambda = 0.0; +/*N*/ double d = 0.0; +/*N*/ double mue; +/*N*/ +/*N*/ q [0] = -lambda / 2.0; +/*N*/ u [0] = d / 2.0; +/*N*/ +/*N*/ int j; +/*N*/ for (j = 1; +/*N*/ j <= n; +/*N*/ j ++) +/*N*/ { +/*N*/ mue = (j < n) +/*N*/ ? h[j] / (h [j] + h [j + 1]) +/*N*/ : 0.0; +/*N*/ p = mue * q [j - 1] + 2.0; +/*N*/ lambda = 1.0 - mue; +/*N*/ q [j] = -lambda / p; +/*N*/ d = (j < n) +/*N*/ ? 6.0 * ((pKnownPoints [j + 1].Y () - pKnownPoints [j].Y ()) / h [j + 1] - +/*N*/ (pKnownPoints [j].Y () - pKnownPoints [j - 1].Y ()) / h [j]) / (h [j] + h [j + 1]) +/*N*/ : 0.0; +/*N*/ u [j] = (d - mue * u [j - 1]) / p; +/*N*/ } +/*N*/ +/*N*/ m [n] = u [n]; +/*N*/ +/*N*/ for (j = n - 1; +/*N*/ j >= 0; +/*N*/ j --) +/*N*/ m [j] = q [j] * m [j + 1] + u [j]; +/*N*/ +/*N*/ for (j = 0; +/*N*/ j < n; +/*N*/ j ++) +/*N*/ { +/*N*/ double xStep = (pKnownPoints [j + 1].X () - pKnownPoints [j].X ()) / splineSize; +/*N*/ double x = pKnownPoints [j].X (); +/*N*/ +/*N*/ double alpha = pKnownPoints [j].Y (); +/*N*/ double gamma = m [j] / 2; +/*N*/ double beta = (pKnownPoints [j + 1].Y () - pKnownPoints [j].Y ()) / h [j + 1] - +/*N*/ ((2 * m [j] + m [j + 1]) * h [j + 1]) / 6; +/*N*/ double delta = (m [j + 1] - m [j]) / (6 * h [j + 1]); +/*N*/ +/*N*/ for (int i = 0; +/*N*/ i < splineSize; +/*N*/ i ++) +/*N*/ { +/*N*/ double xdiff = (x - pKnownPoints [j].X ()); +/*N*/ int index = j * splineSize + i; +/*N*/ +/*N*/ pSplines [(short) index].Y () = long(alpha + xdiff * (beta + xdiff * (gamma + xdiff * delta))); +/*N*/ pSplines [(short) index].X () = long(x); +/*N*/ x += xStep; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ pSplines [n * splineSize].Y () = pKnownPoints [n].Y (); +/*N*/ pSplines [n * splineSize].X () = pKnownPoints [n].X (); +/*N*/ +/*N*/ delete[] h; +/*N*/ delete[] m; +/*N*/ delete[] q; +/*N*/ delete[] u; +/*N*/ } + +/************************************************************************* +|* +|* Bestimme Knotenvektor fuer B-Spline +|* +\************************************************************************/ + +/*N*/ void TVector (int n, +/*N*/ int k, +/*N*/ double *t) +/*N*/ { +/*N*/ for (int i = 0; +/*N*/ i <= n + k; +/*N*/ i ++) +/*N*/ { +/*N*/ if (i < k) t [i] = 0; +/*N*/ else if (i <= n) t [i] = i - k + 1; +/*N*/ else t [i] = n - k + 2; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Berechne linken Knotenvektor +|* +\************************************************************************/ + +/*N*/ double TLeft (double x, +/*N*/ int i, +/*N*/ int k, +/*N*/ double *t) +/*N*/ { +/*N*/ double deltaT = t [i + k - 1] - t [i]; +/*N*/ +/*N*/ return (deltaT == 0.0) +/*N*/ ? 0.0 +/*N*/ : (x - t [i]) / deltaT; +/*N*/ } + +/************************************************************************* +|* +|* Berechne rechten Knotenvektor +|* +\************************************************************************/ + +/*N*/ double TRight (double x, +/*N*/ int i, +/*N*/ int k, +/*N*/ double *t) +/*N*/ { +/*N*/ double deltaT = t [i + k] - t [i + 1]; +/*N*/ +/*N*/ return (deltaT == 0.0) +/*N*/ ? 0.0 +/*N*/ : (t [i + k] - x) / deltaT; +/*N*/ } + +/************************************************************************* +|* +|* Berechne Gewichtungsvektor +|* +\************************************************************************/ + +/*N*/ void BVector (double x, +/*N*/ int n, +/*N*/ int k, +/*N*/ double *b, +/*N*/ double *t) +/*N*/ { +/*N*/ for (int i = 0; +/*N*/ i <= n + k; +/*N*/ i ++) +/*N*/ b [i] = 0; +/*N*/ +/*N*/ int i0 = (int) floor (x) + k - 1; +/*N*/ b [i0] = 1; +/*N*/ +/*N*/ for (int j = 2; +/*N*/ j <= k; +/*N*/ j ++) +/*N*/ for (int i = 0; +/*N*/ i <= i0; +/*N*/ i ++) +/*N*/ b [i] = TLeft (x, i, j, t) * b [i] + TRight (x, i, j, t) * b [i + 1]; +/*N*/ } + +/************************************************************************* +|* +|* Berechne einzelnen Punkt +|* +\************************************************************************/ + +/*N*/ void BSPoint (int n, +/*N*/ Point &p1, +/*N*/ Point &p2, +/*N*/ XPolygon &pKnownPoints, +/*N*/ double *b) +/*N*/ { +/*N*/ for (int i = 0; +/*N*/ i <= n; +/*N*/ i ++) +/*N*/ { +/*N*/ p1.Y () = long(p1.Y () + b [i] * pKnownPoints [i].Y ()); +/*N*/ p2.Y () = long(p2.Y () + b [n - i] * pKnownPoints [i].Y ()); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Berechne B-Spline +|* +\************************************************************************/ + +/*N*/ void approxMesh (int splineSize, +/*N*/ XPolygon &pSplines, +/*N*/ XPolygon &pKnownPoints, +/*N*/ int n, +/*N*/ int k) +/*N*/ { +/*N*/ int pCount = splineSize * n; +/*N*/ double *b = new double [n + k + 1]; +/*N*/ double *t = new double [n + k + 2]; +/*N*/ double xStep = ((double) n - (double) k + 2.0) / (double) pCount; +/*N*/ double dStep = ((double) pKnownPoints [n].X () - (double) pKnownPoints [0].X ()) / (double) pCount; +/*N*/ double dXUp = pKnownPoints [0].X (); +/*N*/ double dXDown = pKnownPoints [n].X (); +/*N*/ double x = 0.0; +/*N*/ int nEnd = pCount / 2 + 1; +/*N*/ +/*N*/ TVector (n, k, t); +/*N*/ +/*N*/ for (int j = 0; +/*N*/ j <= nEnd; +/*N*/ j ++) +/*N*/ { +/*N*/ Point aPoint1; +/*N*/ Point aPoint2; +/*N*/ +/*N*/ BVector (x, n, k, b, t); +/*N*/ BSPoint (n, aPoint1, aPoint2, pKnownPoints, b); +/*N*/ +/*N*/ pSplines [j].X () = (int)(floor(dXUp)+0.5); +/*N*/ pSplines [j].Y () = aPoint1.Y (); +/*N*/ pSplines [pCount - j].X () = (int)(floor(dXDown)+0.5); +/*N*/ pSplines [pCount - j].Y () = aPoint2.Y (); +/*N*/ +/*N*/ x += xStep; +/*N*/ dXUp += dStep; +/*N*/ dXDown -= dStep; +/*N*/ } +/*N*/ +/*N*/ delete[] t; +/*N*/ delete[] b; +/*N*/ } + +/************************************************************************* +|* +|* Passe untere Grenze an den Wertebereich an +|* +\************************************************************************/ + +/*N*/ double SizeBounds (double dMinValue, +/*N*/ double dMaxValue, +/*N*/ BOOL bIsMax) +/*N*/ { +/*N*/ if( (dMinValue == DBL_MIN) || +/*N*/ (dMaxValue == DBL_MIN) || +/*N*/ (dMinValue == dMaxValue) || +/*N*/ (dMinValue == 0.0) ) +/*?*/ return 0.0; +/*N*/ +/*N*/ return bIsMax? dMaxValue : dMinValue; +/*N*/ +/*N*/ // BM: I removed some very strange code here. It +/*N*/ // calculated a kind of log10 but the charts didn't +/*N*/ // really use the value calculated. +/*N*/ } + +/************************************************************************* +|* +|* Erhoehe einen Wert mit Log. +|* +\************************************************************************/ + +/*N*/ void IncValue(double &rValue, +/*N*/ double fInc, +/*N*/ BOOL bLogarithm) +/*N*/ { +/*N*/ if (bLogarithm) +/*?*/ rValue *= fInc; +/*N*/ else +/*N*/ rValue += fInc; +/*N*/ } + +/************************************************************************* +|* +|* Vermindere einen Wert mit Log. +|* +\************************************************************************/ + +/*N*/ void DecValue(double &rValue, +/*N*/ double fInc, +/*N*/ BOOL bLogarithm) +/*N*/ { +/*N*/ if (bLogarithm) rValue /= fInc; +/*N*/ else rValue -= fInc; +/*N*/ } + +/************************************************************************* +|* +|* Faktor fuer Koordinaten-Multiplikation berechnen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Konvertiert in echte RGB-Farben. +|* +\************************************************************************/ + +/*N*/ Color RGBColor(ColorData nColorName) +/*N*/ { +/*N*/ Color aColor(nColorName); +/*N*/ +/*N*/ return Color(aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue()); +/*N*/ } + +/************************************************************************* +|* +|* "Stapelt" den angegebenen String. +|* +\************************************************************************/ + +/*N*/ String StackString( const String& aString ) +/*N*/ { +/*N*/ String aStackStr; +/*N*/ xub_StrLen nLen = aString.Len(); +/*N*/ +/*N*/ if( nLen ) +/*N*/ { +/*N*/ // '\n' is interpreted as newline by the outliner +/*N*/ aStackStr.Fill( nLen * 2 - 1, (sal_Unicode)('\n') ); +/*N*/ +/*N*/ for( xub_StrLen posSrc=0, posDest=0; +/*N*/ posSrc < nLen; +/*N*/ posSrc++, posDest += 2 ) +/*N*/ aStackStr.SetChar( posDest, aString.GetChar( posSrc )); +/*N*/ } +/*N*/ +/*N*/ return aStackStr; +/*N*/ } + +/************************************************************************* +|* +|* "Entstapelt" den angegebenen String. +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Aendert die Helligkeit der Fuellfarbe des Ziel-ItemSets; +|* Liefert die alte Fuellfarbe zurueck. +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Position des ungedrehten Rechtecks entsprechend der Ausrichtung anpassen +|* +\************************************************************************/ + +/*N*/ void AdjustRect(Rectangle &rRect, +/*N*/ ChartAdjust eAdjust) +/*N*/ { +/*N*/ Point aPos = rRect.TopLeft(); +/*N*/ Size aSize = rRect.GetSize(); +/*N*/ +/*N*/ switch (eAdjust) +/*N*/ { +/*N*/ case CHADJUST_TOP_LEFT: +/*N*/ +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_TOP_CENTER: +/*N*/ +/*N*/ aPos.X() -= aSize.Width() / 2; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_TOP_RIGHT: +/*N*/ +/*N*/ aPos.X() -= aSize.Width(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_LEFT: +/*N*/ +/*N*/ aPos.Y() -= aSize.Height() / 2; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_CENTER: +/*N*/ +/*?*/ aPos.X() -= aSize.Width() / 2; +/*?*/ aPos.Y() -= aSize.Height() / 2; +/*?*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_RIGHT: +/*N*/ +/*N*/ aPos.X() -= aSize.Width(); +/*N*/ aPos.Y() -= aSize.Height() / 2; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_LEFT: +/*N*/ +/*?*/ aPos.Y() -= aSize.Height(); +/*?*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_CENTER: +/*N*/ +/*N*/ aPos.X() -= aSize.Width() / 2; +/*N*/ aPos.Y() -= aSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_RIGHT: +/*?*/ aPos.X() -= aSize.Width(); +/*?*/ aPos.Y() -= aSize.Height(); +/*N*/ +/*N*/ } +/*N*/ +/*N*/ rRect.SetPos(aPos); +/*N*/ } + +/************************************************************************* +|* +|* Position des gedrehten Rechtecks entsprechend der Ausrichtung anpassen +|* +\************************************************************************/ + +/*N*/ Size AdjustRotatedRect(const Rectangle &rOldRect, +/*N*/ ChartAdjust eAdjust, +/*N*/ const Rectangle &rNewRect) +/*N*/ { +/*N*/ +/*N*/ Size aMovement; +/*N*/ Point aOld; +/*N*/ Point aNew; +/*N*/ Point aDifference; +/*N*/ +/*N*/ switch (eAdjust) +/*N*/ { +/*?*/ case CHADJUST_TOP_LEFT: +/*?*/ +/*?*/ aOld = rOldRect.TopLeft(); +/*?*/ aNew = rNewRect.TopLeft(); +/*?*/ break; +/*?*/ +/*?*/ case CHADJUST_TOP_CENTER: +/*?*/ +/*?*/ aOld = rOldRect.TopCenter(); +/*?*/ aNew = rNewRect.TopCenter(); +/*?*/ break; +/*?*/ +/*?*/ case CHADJUST_TOP_RIGHT: +/*?*/ +/*?*/ aOld = rOldRect.TopRight(); +/*?*/ aNew = rNewRect.TopRight(); +/*?*/ break; +/*?*/ +/*?*/ case CHADJUST_CENTER_LEFT: +/*?*/ +/*N*/ aOld = rOldRect.LeftCenter(); +/*N*/ aNew = rNewRect.LeftCenter(); +/*N*/ break; +/*?*/ +/*?*/ case CHADJUST_CENTER_CENTER: +/*?*/ +/*?*/ aOld = rOldRect.Center(); +/*?*/ aNew = rNewRect.Center(); +/*?*/ break; +/*?*/ +/*?*/ case CHADJUST_CENTER_RIGHT: +/*?*/ +/*?*/ aOld = rOldRect.RightCenter(); +/*?*/ aNew = rNewRect.RightCenter(); +/*?*/ break; +/*?*/ +/*?*/ case CHADJUST_BOTTOM_LEFT: +/*?*/ +/*?*/ aOld = rOldRect.BottomLeft(); +/*?*/ aNew = rNewRect.BottomLeft(); +/*?*/ break; +/*?*/ +/*?*/ case CHADJUST_BOTTOM_CENTER: +/*?*/ +/*?*/ aOld = rOldRect.BottomCenter(); +/*?*/ aNew = rNewRect.BottomCenter(); +/*?*/ break; +/*?*/ +/*?*/ case CHADJUST_BOTTOM_RIGHT: +/*?*/ +/*?*/ aOld = rOldRect.BottomRight(); +/*?*/ aNew = rNewRect.BottomRight(); +/*?*/ break; +/*N*/ } +/*N*/ +/*N*/ aDifference = ( aOld - aNew); +/*N*/ aMovement = Size(aDifference.X(),aDifference.Y()); +/*N*/ +/*N*/ return aMovement; +/*N*/ } +//Umrechnung Textgröße in Größe des BoundRects rotierter Texte +/*N*/ Size GetRotatedTextSize(const Size& rSize,const long nDegrees) +/*N*/ { +/*N*/ if(nDegrees) +/*N*/ { +/*?*/ double fDeg,fSin,fCos; +/*?*/ fDeg=CDEG2RAD(nDegrees); +/*?*/ fSin=fabs(sin(fDeg)); +/*?*/ fCos=fabs(cos(fDeg)); +/*?*/ Size aRetSize( +/*?*/ (long)( (double)rSize.Width()*fCos + (double)rSize.Height()*fSin ), +/*?*/ (long)( (double)rSize.Width()*fSin + (double)rSize.Height()*fCos ) +/*?*/ ); +/*?*/ return aRetSize; +/*N*/ } +/*N*/ Size aRetSize(rSize); +/*N*/ return aRetSize; +/*N*/ } +/************************************************************************* +|* +|* die Rotation des Textes in Grad zurueckgeben, falls kein DEGREE-item +|* vorhanden, (z.B. 4.0-Chart) so wird das Item ergaenzt +|* +\************************************************************************/ +/*N*/ long GetTextRotation(SfxItemSet &rAttr) //Wrapper, falls eOrient noch nicht ermittelt +/*N*/ { +/*N*/ SvxChartTextOrient eOrient +/*N*/ = ((const SvxChartTextOrientItem&)rAttr.Get(SCHATTR_TEXT_ORIENT)).GetValue(); +/*N*/ return GetTextRotation(rAttr,eOrient); +/*N*/ } + +/*N*/ long GetTextRotation(SfxItemSet &rAttr,SvxChartTextOrient eOrient) +/*N*/ { +/*N*/ +/*N*/ const SfxPoolItem* pPoolItem = NULL; +/*N*/ long nDegrees = 0; +/*N*/ +/*N*/ // the attribute is set: use it +/*N*/ if( rAttr.GetItemState( SCHATTR_TEXT_DEGREES, TRUE, &pPoolItem ) == SFX_ITEM_SET ) +/*N*/ { +/*?*/ nDegrees = ((const SfxInt32Item*)pPoolItem)->GetValue(); +/*?*/ return nDegrees; +/*N*/ } +/*N*/ +/*N*/ // otherwise use orientation to set default rotation +/*N*/ switch( eOrient ) +/*N*/ { +/*N*/ case CHTXTORIENT_BOTTOMTOP: +/*N*/ nDegrees = 9000; // 90 deg +/*N*/ break; +/*N*/ +/*N*/ case CHTXTORIENT_TOPBOTTOM: +/*?*/ nDegrees = 27000; // 270 deg +/*?*/ break; +/*N*/ +/*N*/ case CHTXTORIENT_STANDARD: +/*N*/ case CHTXTORIENT_STACKED: +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ return nDegrees; +/*N*/ } + + +/************************************************************************* +|* +|* Ausrichtung entsprechend der Orientierung anpassen +|* +\************************************************************************/ + +/*N*/ void SetAdjust(ChartAdjust &rAdjust, +/*N*/ SvxChartTextOrient eOrient) +/*N*/ { +/*N*/ switch (eOrient) +/*N*/ { +/*N*/ case CHTXTORIENT_BOTTOMTOP: +/*N*/ switch (rAdjust) +/*N*/ { +/*N*/ case CHADJUST_TOP_LEFT: +/*N*/ rAdjust = CHADJUST_TOP_RIGHT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_TOP_CENTER: +/*N*/ rAdjust = CHADJUST_CENTER_RIGHT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_TOP_RIGHT: +/*N*/ rAdjust = CHADJUST_BOTTOM_RIGHT; +/*N*/ +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_LEFT: +/*N*/ rAdjust = CHADJUST_TOP_CENTER; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_RIGHT: +/*N*/ rAdjust = CHADJUST_BOTTOM_CENTER; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_LEFT: +/*N*/ rAdjust = CHADJUST_TOP_LEFT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_CENTER: +/*N*/ rAdjust = CHADJUST_CENTER_LEFT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_RIGHT: +/*N*/ rAdjust = CHADJUST_BOTTOM_LEFT; +/*N*/ break; +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case CHTXTORIENT_TOPBOTTOM: +/*N*/ switch (rAdjust) +/*N*/ { +/*N*/ case CHADJUST_TOP_LEFT: +/*N*/ rAdjust = CHADJUST_BOTTOM_LEFT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_TOP_CENTER: +/*N*/ rAdjust = CHADJUST_CENTER_LEFT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_TOP_RIGHT: +/*N*/ rAdjust = CHADJUST_TOP_LEFT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_LEFT: +/*N*/ rAdjust = CHADJUST_BOTTOM_CENTER; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_RIGHT: +/*N*/ rAdjust = CHADJUST_TOP_CENTER; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_LEFT: +/*N*/ rAdjust = CHADJUST_BOTTOM_RIGHT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_CENTER: +/*N*/ rAdjust = CHADJUST_CENTER_RIGHT; +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_RIGHT: +/*N*/ rAdjust = CHADJUST_TOP_RIGHT; +/*N*/ break; +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Textobjekt positionieren +|* +\************************************************************************/ +/*N*/ void SetTextPos(SdrTextObj &rTextObj, +/*N*/ const Point &rPos,SfxItemSet* pAttr) +/*N*/ { +/*N*/ SchObjectAdjust *pObjAdjust = GetObjectAdjust(rTextObj); +/*N*/ ChartAdjust eAdjust = pObjAdjust->GetAdjust(); +/*N*/ double fVal; +/*N*/ SvxChartTextOrient eOrient = pObjAdjust->GetOrient(); +/*N*/ +/*N*/ switch (eOrient) +/*N*/ { +/*N*/ case CHTXTORIENT_BOTTOMTOP: +/*N*/ case CHTXTORIENT_TOPBOTTOM: +/*N*/ { +/*N*/ long nAng = 36000 - rTextObj.GetRotateAngle(); +/*N*/ fVal = nAng * nPi180; +/*N*/ rTextObj.NbcRotate(rPos, nAng, sin(fVal), cos(fVal)); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ Rectangle aRect = rTextObj.GetLogicRect(); +/*N*/ aRect.SetPos(rPos); +/*N*/ AdjustRect(aRect, eAdjust); +/*N*/ rTextObj.NbcSetLogicRect(aRect); +/*N*/ +/*N*/ switch (eOrient) +/*N*/ { +/*N*/ case CHTXTORIENT_BOTTOMTOP: +/*N*/ case CHTXTORIENT_TOPBOTTOM: +/*N*/ { +/*N*/ long nDegrees = GetTextRotation(*pAttr,eOrient); +/*N*/ Rectangle aOldBoundRect=rTextObj.GetBoundRect(); +/*N*/ fVal = nDegrees * nPi180; +/*N*/ rTextObj.NbcRotate(rPos, nDegrees, sin(fVal), cos(fVal)); +/*N*/ Rectangle aNewBoundRect=rTextObj.GetBoundRect(); +/*N*/ rTextObj.NbcMove( AdjustRotatedRect(aOldBoundRect, eAdjust, aNewBoundRect)); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Textobjekt-Groesse entsprechend der Ausrichtung anpassen +|* +\************************************************************************/ + +/*N*/ void AdjustTextSize(SdrTextObj &rTextObj, +/*N*/ const Size &rTextSize) +/*N*/ { +/*N*/ Rectangle aRect = rTextObj.GetLogicRect(); +/*N*/ +/*N*/ if (aRect.GetSize() != rTextSize) +/*N*/ { +/*N*/ SchObjectAdjust *pObjAdjust = GetObjectAdjust(rTextObj); +/*N*/ ChartAdjust eAdjust = pObjAdjust->GetAdjust(); +/*N*/ SvxChartTextOrient eOrient = pObjAdjust->GetOrient(); +/*N*/ +/*N*/ SetAdjust(eAdjust, eOrient); +/*N*/ +/*N*/ Point aOldPos = aRect.TopLeft(); +/*N*/ +/*N*/ switch (eAdjust) +/*N*/ { +/*N*/ case CHADJUST_TOP_CENTER: +/*N*/ aRect.Left() = aRect.Left() + aRect.GetWidth() / 2 - rTextSize.Width() / 2; +/*N*/ aRect.Right() = aRect.Left() + rTextSize.Width(); +/*N*/ aRect.Bottom() = aRect.Top() + rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_TOP_RIGHT: +/*N*/ aRect.Left() = aRect.Right() - rTextSize.Width(); +/*N*/ aRect.Bottom() = aRect.Top() + rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_LEFT: +/*N*/ aRect.Right() = aRect.Left() + rTextSize.Width(); +/*N*/ aRect.Top() = aRect.Top() + aRect.GetHeight() / 2 - rTextSize.Height() / 2; +/*N*/ aRect.Bottom() = aRect.Top() + rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_CENTER: +/*N*/ aRect.Left() = aRect.Left() + aRect.GetWidth() / 2 - rTextSize.Width() / 2; +/*N*/ aRect.Right() = aRect.Left() + rTextSize.Width(); +/*N*/ aRect.Top() = aRect.Top() + aRect.GetHeight() / 2 - rTextSize.Height() / 2; +/*N*/ aRect.Bottom() = aRect.Top() + rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_CENTER_RIGHT: +/*N*/ aRect.Left() = aRect.Right() - rTextSize.Width(); +/*N*/ aRect.Top() = aRect.Top() + aRect.GetHeight() / 2 - rTextSize.Height() / 2; +/*N*/ aRect.Bottom() = aRect.Top() + rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_LEFT: +/*N*/ aRect.Right() = aRect.Left() + rTextSize.Width(); +/*N*/ aRect.Top() = aRect.Bottom() - rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_CENTER: +/*N*/ aRect.Left() = aRect.Left() + aRect.GetWidth() / 2 - rTextSize.Width() / 2; +/*N*/ aRect.Right() = aRect.Left() + rTextSize.Width(); +/*N*/ aRect.Top() = aRect.Bottom() - rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ case CHADJUST_BOTTOM_RIGHT: +/*N*/ aRect.Left() = aRect.Right() - rTextSize.Width(); +/*N*/ aRect.Top() = aRect.Bottom() - rTextSize.Height(); +/*N*/ break; +/*N*/ +/*N*/ default: +/*N*/ aRect.Right() = aRect.Left() + rTextSize.Width(); +/*N*/ aRect.Bottom() = aRect.Top() + rTextSize.Height(); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ Point aNewPos = aRect.TopLeft(); +/*N*/ +/*N*/ if (aNewPos != aOldPos) +/*N*/ { +/*N*/ long nArc = rTextObj.GetRotateAngle(); +/*N*/ +/*N*/ if (nArc) +/*N*/ { +/*N*/ double fVal = nArc * nPi180; +/*N*/ RotatePoint(aNewPos, aOldPos, sin(fVal), cos(fVal)); +/*N*/ aRect.SetPos(aNewPos); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ rTextObj.SetLogicRect(aRect); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Ausgabegroesse ermitteln +|* +\************************************************************************/ + +/*N*/ Size GetOutputSize(SdrTextObj& rTextObj) +/*N*/ { +/*N*/ return (rTextObj.GetBoundRect().GetSize()); +/*N*/ } + +/************************************************************************* +|* +|* Erstelle eine Gruppe und die Sublist fuer ein Chart +|* +\************************************************************************/ + +/*N*/ void CreateChartGroup( SchObjGroup* &pGroup, +/*N*/ SdrObjList* &pList ) +/*N*/ { +/*N*/ pGroup = new SchObjGroup; +/*N*/ pList = pGroup->GetSubList(); +/*N*/ pGroup->InsertUserData( new SchObjectId( CHOBJID_DIAGRAM )); +/*N*/ } + + + +/************************************************************************* +|* +|* Beseitige alle Statistikattrs +|* +\************************************************************************/ + + +/*N*/ const long nOffX = SCHATTR_AXIS_AUTO_MIN - SCHATTR_X_AXIS_AUTO_MIN; +/*N*/ const long nOffY = SCHATTR_AXIS_AUTO_MIN - SCHATTR_Y_AXIS_AUTO_MIN; +/*N*/ const long nOffZ = SCHATTR_AXIS_AUTO_MIN - SCHATTR_Z_AXIS_AUTO_MIN; + +//neue in alte Achsenattr konvertieren +/*N*/ void AxisAttrNew2Old(SfxItemSet &rDestSet,long nId,BOOL bClear) +/*N*/ { +/*N*/ USHORT nOff; +/*N*/ double f; +/*N*/ BOOL b; +/*N*/ SfxItemSet aSet(rDestSet); //Kopie +/*N*/ +/*N*/ switch(nId) +/*N*/ { +/*N*/ case CHOBJID_DIAGRAM_X_AXIS: +/*N*/ nOff=nOffX; +/*N*/ rDestSet.Put(SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_X_AXIS_AUTO_MIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_X_AXIS_MIN)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_X_AXIS_AUTO_MAX, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_X_AXIS_MAX)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_MAIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_MAIN)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_HELP, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_HELP)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_X_AXIS_LOGARITHM, FALSE)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_X_AXIS_AUTO_ORIGIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_X_AXIS_ORIGIN)); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Y_AXIS: +/*N*/ nOff=nOffY; +/*N*/ rDestSet.Put(SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MIN)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MAX, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MAX)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_MAIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_MAIN)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_HELP, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_HELP)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Y_AXIS_LOGARITHM, FALSE)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Y_AXIS_AUTO_ORIGIN, FALSE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Y_AXIS_ORIGIN)); +/*N*/ break; +/*N*/ case CHOBJID_DIAGRAM_Z_AXIS: +/*N*/ nOff=nOffZ; +/*N*/ rDestSet.Put(SvxChartTextOrderItem(CHTXTORDER_SIDEBYSIDE)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MIN)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MAX, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MAX)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_MAIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_MAIN)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_HELP, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_HELP)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Z_AXIS_LOGARITHM, FALSE)); +/*N*/ rDestSet.Put(SfxBoolItem(SCHATTR_Z_AXIS_AUTO_ORIGIN, TRUE)); +/*N*/ rDestSet.Put(SvxDoubleItem(0.0, SCHATTR_Z_AXIS_ORIGIN)); +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ SfxWhichIter aIter(aSet); +/*N*/ USHORT nWhich = aIter.FirstWhich(); +/*N*/ +/*N*/ while(nWhich) +/*N*/ { +/*N*/ switch(nWhich) +/*N*/ { +/*N*/ case SCHATTR_AXIS_AUTO_MIN: +/*N*/ case SCHATTR_AXIS_AUTO_MAX: +/*N*/ case SCHATTR_AXIS_AUTO_STEP_MAIN: +/*N*/ case SCHATTR_AXIS_AUTO_STEP_HELP: +/*N*/ case SCHATTR_AXIS_LOGARITHM: +/*N*/ case SCHATTR_AXIS_AUTO_ORIGIN: +/*N*/ +/*N*/ b=((const SfxBoolItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SfxBoolItem(nWhich-nOff,b)); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ break; +/*N*/ +/*N*/ case SCHATTR_AXIS_MIN: +/*N*/ case SCHATTR_AXIS_MAX: +/*N*/ case SCHATTR_AXIS_STEP_MAIN: +/*N*/ case SCHATTR_AXIS_STEP_HELP: +/*N*/ case SCHATTR_AXIS_ORIGIN: +/*N*/ +/*N*/ f=((const SvxDoubleItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SvxDoubleItem(f,nWhich-nOff)); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ break; +/*N*/ +/*N*/ } +/*N*/ nWhich = aIter.NextWhich(); +/*N*/ } +/*N*/ } +//alte in neue Achsenattr konvertieren +/*N*/ void AxisAttrOld2New(SfxItemSet &rDestSet,BOOL bClear,long nId) +/*N*/ { +/*N*/ +/*N*/ double f; +/*N*/ BOOL b; +/*N*/ SfxItemSet aSet(rDestSet); //Kopie +/*N*/ +/*N*/ SfxWhichIter aIter (aSet); +/*N*/ USHORT nWhich = aIter.FirstWhich (); +/*N*/ +/*N*/ while (nWhich) +/*N*/ { +/*N*/ switch(nWhich) +/*N*/ { +/*N*/ case SCHATTR_X_AXIS_AUTO_MIN: +/*N*/ case SCHATTR_X_AXIS_AUTO_MAX: +/*N*/ case SCHATTR_X_AXIS_AUTO_STEP_MAIN: +/*N*/ case SCHATTR_X_AXIS_AUTO_STEP_HELP: +/*N*/ case SCHATTR_X_AXIS_LOGARITHM: +/*N*/ case SCHATTR_X_AXIS_AUTO_ORIGIN: +/*N*/ +/*N*/ if(nId==CHOBJID_DIAGRAM_X_AXIS) +/*N*/ { +/*N*/ b=((const SfxBoolItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SfxBoolItem(nWhich+USHORT(nOffX),b)); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case SCHATTR_X_AXIS_MIN: +/*N*/ case SCHATTR_X_AXIS_MAX: +/*N*/ case SCHATTR_X_AXIS_STEP_MAIN: +/*N*/ case SCHATTR_X_AXIS_STEP_HELP: +/*N*/ case SCHATTR_X_AXIS_ORIGIN: +/*N*/ +/*N*/ if(nId==CHOBJID_DIAGRAM_X_AXIS) +/*N*/ { +/*N*/ f=((const SvxDoubleItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SvxDoubleItem(f,nWhich+USHORT(nOffX))); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case SCHATTR_Y_AXIS_AUTO_MIN: +/*N*/ case SCHATTR_Y_AXIS_AUTO_MAX: +/*N*/ case SCHATTR_Y_AXIS_AUTO_STEP_MAIN: +/*N*/ case SCHATTR_Y_AXIS_AUTO_STEP_HELP: +/*N*/ case SCHATTR_Y_AXIS_LOGARITHM: +/*N*/ case SCHATTR_Y_AXIS_AUTO_ORIGIN: +/*N*/ +/*N*/ if(nId==CHOBJID_DIAGRAM_Y_AXIS) +/*N*/ { +/*N*/ b=((const SfxBoolItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SfxBoolItem(nWhich+USHORT(nOffY),b)); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case SCHATTR_Y_AXIS_MIN: +/*N*/ case SCHATTR_Y_AXIS_MAX: +/*N*/ case SCHATTR_Y_AXIS_STEP_MAIN: +/*N*/ case SCHATTR_Y_AXIS_STEP_HELP: +/*N*/ case SCHATTR_Y_AXIS_ORIGIN: +/*N*/ +/*N*/ if(nId==CHOBJID_DIAGRAM_Y_AXIS) +/*N*/ { +/*N*/ f=((const SvxDoubleItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SvxDoubleItem(f,nWhich+USHORT(nOffY))); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case SCHATTR_Z_AXIS_AUTO_MIN: +/*N*/ case SCHATTR_Z_AXIS_AUTO_MAX: +/*N*/ case SCHATTR_Z_AXIS_AUTO_STEP_MAIN: +/*N*/ case SCHATTR_Z_AXIS_AUTO_STEP_HELP: +/*N*/ case SCHATTR_Z_AXIS_LOGARITHM: +/*N*/ case SCHATTR_Z_AXIS_AUTO_ORIGIN: +/*N*/ +/*N*/ if(nId==CHOBJID_DIAGRAM_Z_AXIS) +/*N*/ { +/*N*/ b=((const SfxBoolItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SfxBoolItem(nWhich+USHORT(nOffZ),b)); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ } +/*N*/ break; +/*N*/ +/*N*/ case SCHATTR_Z_AXIS_MIN: +/*N*/ case SCHATTR_Z_AXIS_MAX: +/*N*/ case SCHATTR_Z_AXIS_STEP_MAIN: +/*N*/ case SCHATTR_Z_AXIS_STEP_HELP: +/*N*/ case SCHATTR_Z_AXIS_ORIGIN: +/*N*/ +/*N*/ if(nId==CHOBJID_DIAGRAM_Z_AXIS) +/*N*/ { +/*N*/ f=((const SvxDoubleItem&)rDestSet.Get(nWhich)).GetValue(); +/*N*/ rDestSet.Put(SvxDoubleItem(f,nWhich+USHORT(nOffZ))); +/*N*/ if(bClear) +/*N*/ rDestSet.ClearItem(nWhich); +/*N*/ } +/*N*/ break; +/*N*/ } +/*N*/ nWhich = aIter.NextWhich(); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Pruefe zwei ItemSets und vernichte paarweise verschiedene Items +|* +\************************************************************************/ + + +/*N*/ void IntersectSets( const SfxItemSet & rSource, SfxItemSet & rDest ) +/*N*/ { +/*N*/ SfxWhichIter aIter( rSource ); +/*N*/ SfxItemState aSrcState; +/*N*/ +/*N*/ for( USHORT nWhich = aIter.FirstWhich(); nWhich != 0; nWhich = aIter.NextWhich() ) +/*N*/ { +/*N*/ aSrcState = rSource.GetItemState( nWhich ); +/*N*/ +/*N*/ if( // one item is (may be) set but the other one isn't +/*N*/ ( aSrcState != rDest.GetItemState( nWhich ) ) +/*N*/ || +/*N*/ // both items are set, but their content differs +/*N*/ // (if aSrcState is set it follows that also aDestState is set) +/*N*/ ( ( aSrcState == SFX_ITEM_SET ) +/*N*/ && +/*N*/ ( rSource.Get( nWhich ) != rDest.Get( nWhich ) ) ) ) +/*N*/ { +/*N*/ rDest.InvalidateItem( nWhich ); +/*N*/ } +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Setze je nach Ausrichtungsinformation den Punkt um den ausgerichtet wird +|* +|* Das wird hauptsaechlich von chtmode4 aufgerufen um zu wissen welche +|* Position des Textes man sich merken muss, um dne wird dann mit moeglicherweise +|* veraenderter Schriftgroesse ausgegeben. +|* +\************************************************************************/ + +/*N*/ Point SetPointOfRectangle (const Rectangle& rRect, ChartAdjust eAdjust) +/*N*/ { +/*N*/ switch (eAdjust) +/*N*/ { +/*?*/ case CHADJUST_TOP_LEFT: +/*?*/ return (rRect.TopLeft()); +/*?*/ case CHADJUST_TOP_RIGHT: +/*?*/ return (rRect.TopRight()); +/*N*/ case CHADJUST_TOP_CENTER: +/*N*/ return (rRect.TopCenter()); +/*N*/ case CHADJUST_CENTER_LEFT: +/*N*/ return (rRect.LeftCenter()); +/*?*/ case CHADJUST_CENTER_RIGHT: +/*?*/ return (rRect.RightCenter()); +/*?*/ case CHADJUST_CENTER_CENTER: +/*?*/ return (rRect.Center()); +/*?*/ case CHADJUST_BOTTOM_LEFT: +/*?*/ return (rRect.BottomLeft()); +/*?*/ case CHADJUST_BOTTOM_CENTER: +/*N*/ return (rRect.BottomCenter()); +/*?*/ case CHADJUST_BOTTOM_RIGHT: +/*?*/ return (rRect.BottomRight()); +/*?*/ default: +/*?*/ ; +/*?*/ } +/*?*/ Point aPoint(-1,-1); +/*?*/ return aPoint; // Das ist das Default für die Plazierungsinformation von Chart-Texten +/*N*/ } + +//!!! Es werden NICHT ALLE Attr ausgewertet, nur Größen-relevante! +/*N*/ void ItemsToFont(const SfxItemSet& rSet,Font& rFont) +/*N*/ { +/*N*/ const SfxPoolItem* pItem = NULL; +/*N*/ if( rSet.GetItemState( EE_CHAR_FONTINFO, TRUE, &pItem )) +/*N*/ { +/*N*/ SvxFontItem* pFontItem = (SvxFontItem*)pItem; +/*N*/ +/*N*/ rFont.SetStyleName(pFontItem->GetStyleName() ); +/*N*/ rFont.SetName( pFontItem->GetFamilyName()); +/*N*/ rFont.SetCharSet( pFontItem->GetCharSet()); +/*N*/ rFont.SetFamily( pFontItem->GetFamily()); +/*N*/ rFont.SetPitch( pFontItem->GetPitch()); +/*N*/ } +/*N*/ +/*N*/ // rFont.SetColor( ((const SvxColorItem&)rSet.Get( EE_CHAR_COLOR )).GetValue() ); +/*N*/ // rFont.SetName( ((const SvxFontItem&)rSet.Get( EE_CHAR_FONTINFO )).GetFamilyName() ); +/*N*/ // rFont.SetFamily( ((const SvxFontItem&)rSet.Get( EE_CHAR_FONTINFO )).GetFamily() ); +/*N*/ // rFont.SetPitch( ((const SvxFontItem&)rSet.Get( EE_CHAR_FONTINFO )).GetPitch() ); +/*N*/ // rFont.SetCharSet( ((const SvxFontItem&)rSet.Get( EE_CHAR_FONTINFO )).GetCharSet() ); +/*N*/ +/*N*/ // Scale the font's horizontal size like the vertical size. Assume that the original size is +/*N*/ // 7pt. The scaling is done here because the item EE_CHAR_FONTWIDTH holds a horizontal scaling +/*N*/ // factor. The horizontal size can therefore not be stored there. But as the font is scaled +/*N*/ // uniformly, the horizontal size depends uniquely on the vertical size. +/*N*/ long nFontHeight = static_cast<const SvxFontHeightItem&>(rSet.Get(EE_CHAR_FONTHEIGHT)).GetHeight(); +/*N*/ const double fSevenPoint = (1000/*scale*/ * 2.54/*cm per inch*/ / 72/*point per inch*/ * 7 /*pt*/); +/*N*/ long nFontWidth = 0; // #89001# use default font width +/*N*/ rFont.SetSize (Size (nFontWidth, nFontHeight)); +/*N*/ // Old line. +/*N*/ // rFont.SetSize( Size( ((const SvxFontWidthItem&)rSet.Get( EE_CHAR_FONTWIDTH )).GetWidth(), +/*N*/ // ((const SvxFontHeightItem&)rSet.Get( EE_CHAR_FONTHEIGHT )).GetHeight() ) ); +/*N*/ +/*N*/ rFont.SetWeight( ((const SvxWeightItem&)rSet.Get( EE_CHAR_WEIGHT )).GetWeight() ); +/*N*/ rFont.SetUnderline( ((const SvxUnderlineItem&)rSet.Get( EE_CHAR_UNDERLINE )).GetUnderline() ); +/*N*/ rFont.SetStrikeout( ((const SvxCrossedOutItem&)rSet.Get( EE_CHAR_STRIKEOUT )).GetStrikeout() ); +/*N*/ rFont.SetItalic( ((const SvxPostureItem&)rSet.Get( EE_CHAR_ITALIC )).GetPosture() ); +/*N*/ rFont.SetOutline( ((const SvxContourItem&)rSet.Get( EE_CHAR_OUTLINE )).GetValue() ); +/*N*/ rFont.SetShadow( ((const SvxShadowedItem&)rSet.Get( EE_CHAR_SHADOW )).GetValue() ); +/*N*/ //rFont.SetEscapement( ((const SvxEscapementItem&)rSet.Get( EE_CHAR_ESCAPEMENT)).GetEsc() ); +/*N*/ //rFont.SetPropr( ((const SvxEscapementItem&)rSet.Get( EE_CHAR_ESCAPEMENT)).GetProp() ); +/*N*/ rFont.SetKerning( ((const SvxAutoKernItem&)rSet.Get( EE_CHAR_PAIRKERNING )).GetValue() ); +/*N*/ //rFont.SetFixKerning( ((const SvxKerningItem&)rSet.Get( EE_CHAR_KERNING )).GetValue() ); +/*N*/ rFont.SetWordLineMode( ((const SvxWordLineModeItem&)rSet.Get( EE_CHAR_WLM )).GetValue() ); +/*N*/ // rFont.SetOrientation( (short)(rDesc.Orientation*10) ); +/*N*/ } + + +} //namespace binfilter +#ifdef DBG_UTIL + +// ==================== DEBUG SfxItemSets ==================== + +#include <bf_svtools/itempool.hxx> +#include <bf_svtools/itemiter.hxx> + +#include <cstdio> // for snprintf +#include <cstring> // for strncat +namespace binfilter {//STRIP009 +/*N*/ void Dbg_DebugItems( SfxItemSet& rSet, ChartModel* pModel, long num ) +/*N*/ { +/*N*/ SfxItemPool *pItemPool=&( pModel->GetItemPool() ); +/*N*/ +/*N*/ char pBuf[ 512 ] = ""; +/*N*/ char pSmallBuf[ 128 ] = ""; +/*N*/ +/*N*/ const USHORT* pRanges = rSet.GetRanges(); +/*N*/ for( long n = 0; pRanges[ n ] && n<32; n++ ) +/*N*/ { +/*N*/ snprintf( pSmallBuf, sizeof(pSmallBuf), "[%ld; %ld] ", pRanges[ n ], pRanges[ ++n ] ); +/*N*/ strncat( pBuf, pSmallBuf, sizeof(pBuf) - strlen(pBuf) - 1 ); +/*N*/ } +/*N*/ +/*N*/ DBG_TRACE1( "SCH:ItemDBG - Ranges: %s", pBuf ); +/*N*/ +/*N*/ pBuf[ 0 ] = '\0'; +/*N*/ +/*N*/ long nInv = 0, nCnt = 0, nCnv = 0, nCns = 0; +/*N*/ SfxItemIter aIterator( rSet ); +/*N*/ +/*N*/ const SfxPoolItem* pItem; +/*N*/ USHORT nWhich, nNewWhich; +/*N*/ +/*N*/ pItem = aIterator.FirstItem(); +/*N*/ while( pItem ) +/*N*/ { +/*N*/ if( ! IsInvalidItem( pItem ) ) +/*N*/ { +/*N*/ nWhich= pItem->Which(); +/*N*/ +/*N*/ nCnt++; +/*N*/ if( nWhich < SCHATTR_END ) +/*N*/ nCns++; +/*N*/ if( nCnt < 100 ) +/*N*/ { +/*N*/ snprintf( pSmallBuf, sizeof(pSmallBuf), "%ld, ", nWhich ); +/*N*/ strncat( pBuf, pSmallBuf, sizeof(pBuf) - strlen(pBuf) - 1 ); +/*N*/ } +/*N*/ +/*N*/ nNewWhich = pItemPool->GetWhich( nWhich ); +/*N*/ if( nWhich != nNewWhich ) +/*?*/ nCnv++; +/*N*/ } +/*N*/ else +/*?*/ nInv++; +/*N*/ +/*N*/ pItem = aIterator.NextItem(); +/*N*/ } +/*N*/ +/*N*/ DBG_TRACE1( "SCH:ItemDBG - List: %s", pBuf ); +/*N*/ +/*N*/ long nColor = -1; +/*N*/ long nMat = -1; +/*N*/ const SfxPoolItem *pPoolItem; +/*N*/ +/*N*/ if( SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLCOLOR,TRUE,&pPoolItem ) ) +/*N*/ { +/*N*/ Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetValue() ); +/*N*/ nColor=aColor.GetRGBColor(); +/*N*/ } +/*N*/ //-/ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_3D_MAT_COLOR, TRUE, &pPoolItem ) ) +/*N*/ if( SFX_ITEM_SET == rSet.GetItemState( SDRATTR_3DOBJ_MAT_COLOR, TRUE, &pPoolItem ) ) +/*N*/ { +/*N*/ Color aNew( ((const SvxColorItem*) pPoolItem )->GetValue() ); +/*N*/ nMat=aNew.GetRGBColor(); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ long r=COLORDATA_RED(nColor),g=COLORDATA_GREEN(nColor),b=COLORDATA_BLUE(nColor); +/*N*/ +/*N*/ DBG_TRACE4( "SCH:ItemDBG - Info: this=%lx, #=%ld, WID-able=%ld, invalid=%ld", (long)pModel, nCnt, nCnv, nInv ); +/*N*/ DBG_TRACE5( "... Chart=%ld, RGB=(%d, %d, %d), Mat=%ld", nCns, r, g, b, nMat ); +/*N*/ } +} //namespace binfilter +#endif + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_itempool.cxx b/binfilter/bf_sch/source/core/sch_itempool.cxx new file mode 100644 index 000000000000..d23dcb87a5b3 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_itempool.cxx @@ -0,0 +1,486 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_sfx2/sfxsids.hrc> +#include "schattr.hxx" +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTINDICATE SCHATTR_STAT_INDICATE +#define ITEMID_CHARTKINDERROR SCHATTR_STAT_KIND_ERROR +#define ITEMID_CHARTREGRESSION SCHATTR_STAT_REGRESSTYPE + +#ifndef _SVX_CHRTITEM_HXX //autogen + +#include <bf_svtools/eitem.hxx> + +#endif + +// header for class SvXMLAttrContainerItem +#include <bf_svx/xmlcnitm.hxx> + +#ifndef _SVX_BRSHITEM_HXX //autogen +#define ITEMID_BRUSH SCHATTR_SYMBOL_BRUSH +#include <bf_svx/brshitem.hxx> +#endif +#ifndef _SVX_SIZEITEM_HXX //autogen +#define ITEMID_SIZE 0 +#include <bf_svx/sizeitem.hxx> +#endif + +#include "itempool.hxx" +#include "chaxis.hxx" +namespace binfilter { + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchItemPool::SchItemPool(): +/*N*/ SfxItemPool( String( RTL_CONSTASCII_USTRINGPARAM( "SchItemPool" )), SCHATTR_START, SCHATTR_END, NULL, NULL ) +/*N*/ { + /************************************************************************** + * PoolDefaults + **************************************************************************/ +/*N*/ ppPoolDefaults = new SfxPoolItem*[SCHATTR_END - SCHATTR_START + 1]; +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_DATADESCR_DESCR - SCHATTR_START] = new SvxChartDataDescrItem; +/*N*/ ppPoolDefaults[SCHATTR_DATADESCR_SHOW_SYM - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_SYM); +/*N*/ ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SvxChartLegendPosItem( CHLEGEND_RIGHT ); +/*N*/ ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START] = new SvxChartTextOrientItem; +/*N*/ ppPoolDefaults[SCHATTR_TEXT_ORDER - SCHATTR_START] = new SvxChartTextOrderItem; +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MIN); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MIN); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_MAX); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_MAX); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_LOGARITHM); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Y_AXIS_AUTO_ORIGIN); +/*N*/ ppPoolDefaults[SCHATTR_Y_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Y_AXIS_ORIGIN); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_MIN); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_MIN); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_MAX); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_MAX); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_LOGARITHM); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_X_AXIS_AUTO_ORIGIN); +/*N*/ ppPoolDefaults[SCHATTR_X_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_X_AXIS_ORIGIN); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MIN); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MIN); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_MAX); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_MAX); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_LOGARITHM); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_Z_AXIS_AUTO_ORIGIN); +/*N*/ ppPoolDefaults[SCHATTR_Z_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_Z_AXIS_ORIGIN); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXISTYPE, CHART_AXIS_X); +/*N*/ ppPoolDefaults[SCHATTR_DUMMY0 - SCHATTR_START] = new SfxInt32Item(SCHATTR_DUMMY0, 0); +/*N*/ ppPoolDefaults[SCHATTR_DUMMY1 - SCHATTR_START] = new SfxInt32Item(SCHATTR_DUMMY1, 0); +/*N*/ ppPoolDefaults[SCHATTR_DUMMY2 - SCHATTR_START] = new SfxInt32Item(SCHATTR_DUMMY2, 0); +/*N*/ ppPoolDefaults[SCHATTR_DUMMY3 - SCHATTR_START] = new SfxInt32Item(SCHATTR_DUMMY3, 0); +/*N*/ ppPoolDefaults[SCHATTR_DUMMY_END - SCHATTR_START] = new SfxInt32Item(SCHATTR_DUMMY_END, 0); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_STAT_AVERAGE - SCHATTR_START] = new SfxBoolItem (SCHATTR_STAT_AVERAGE); +/*N*/ ppPoolDefaults[SCHATTR_STAT_KIND_ERROR - SCHATTR_START] = new SfxInt32Item (SCHATTR_STAT_KIND_ERROR, 0); +/*N*/ ppPoolDefaults[SCHATTR_STAT_PERCENT - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_PERCENT); +/*N*/ ppPoolDefaults[SCHATTR_STAT_BIGERROR - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_BIGERROR); +/*N*/ ppPoolDefaults[SCHATTR_STAT_CONSTPLUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTPLUS); +/*N*/ ppPoolDefaults[SCHATTR_STAT_CONSTMINUS - SCHATTR_START] = new SvxDoubleItem (0.0, SCHATTR_STAT_CONSTMINUS); +/*N*/ ppPoolDefaults[SCHATTR_STAT_REGRESSTYPE - SCHATTR_START] = new SfxInt32Item (SCHATTR_STAT_REGRESSTYPE, 0); +/*N*/ ppPoolDefaults[SCHATTR_STAT_INDICATE - SCHATTR_START] = new SfxInt32Item (SCHATTR_STAT_INDICATE, 0); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DEGREES, 0); +/*N*/ ppPoolDefaults[SCHATTR_TEXT_OVERLAP - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_OVERLAP,FALSE); +/*N*/ ppPoolDefaults[SCHATTR_TEXT_DUMMY0 - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DUMMY0, 0); +/*N*/ ppPoolDefaults[SCHATTR_TEXT_DUMMY1 - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DUMMY1, 0); +/*N*/ ppPoolDefaults[SCHATTR_TEXT_DUMMY2 - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DUMMY2, 0); +/*N*/ ppPoolDefaults[SCHATTR_TEXT_DUMMY3 - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DUMMY3, 0); +/*N*/ +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_STYLE_DEEP - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_DEEP, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_3D - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_3D, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_VERTICAL - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_VERTICAL, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_BASETYPE - SCHATTR_START] = new SfxInt32Item(SCHATTR_STYLE_BASETYPE, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_LINES - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_LINES, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_PERCENT - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_PERCENT, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_STACKED - SCHATTR_START] = new SfxBoolItem (SCHATTR_STYLE_STACKED, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_SPLINES - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SPLINES, 0); //Bug: war Bool! ->Fileformat testen (betrifft nur 5er) +/*N*/ ppPoolDefaults[SCHATTR_STYLE_SYMBOL - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SYMBOL, 0); +/*N*/ ppPoolDefaults[SCHATTR_STYLE_SHAPE - SCHATTR_START] = new SfxInt32Item (SCHATTR_STYLE_SHAPE, 0); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_AXIS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS,2); //2 = Y-Achse!!! +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_AXIS_AUTO_MIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MIN); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_MIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MIN); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_AUTO_MAX - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_MAX); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_MAX - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_MAX); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_STEP_MAIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_MAIN); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_STEP_HELP); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_LOGARITHM - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_LOGARITHM); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_AUTO_ORIGIN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_ORIGIN - SCHATTR_START] = new SvxDoubleItem(0.0, SCHATTR_AXIS_ORIGIN); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_AXIS_TICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_TICKS,CHAXIS_MARK_OUTER); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_HELPTICKS,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_NUMFMT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_NUMFMT,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_NUMFMTPERCENT - SCHATTR_START] = new SfxUInt32Item(SCHATTR_AXIS_NUMFMTPERCENT,11); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_SHOWAXIS - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWAXIS,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWDESCR,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_SHOWMAINGRID - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWMAINGRID,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_SHOWHELPGRID - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_SHOWHELPGRID,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_TOPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_AXIS_TOPDOWN,0); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_AXIS_DUMMY0 - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_DUMMY0,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_DUMMY1 - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_DUMMY1,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_DUMMY2 - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_DUMMY2,0); +/*N*/ ppPoolDefaults[SCHATTR_AXIS_DUMMY3 - SCHATTR_START] = new SfxInt32Item(SCHATTR_AXIS_DUMMY3,0); +/*N*/ ppPoolDefaults[SCHATTR_BAR_OVERLAP - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_OVERLAP,0); +/*N*/ ppPoolDefaults[SCHATTR_BAR_GAPWIDTH - SCHATTR_START] = new SfxInt32Item(SCHATTR_BAR_GAPWIDTH,0); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START] = new SvxBrushItem(SCHATTR_SYMBOL_BRUSH); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_VOLUME,0); +/*N*/ ppPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START] = new SfxBoolItem(SCHATTR_STOCK_UPDOWN,0); +/*N*/ +/*N*/ ppPoolDefaults[SCHATTR_SYMBOL_SIZE - SCHATTR_START] = new SvxSizeItem(SCHATTR_SYMBOL_SIZE,Size(0,0)); +/*N*/ ppPoolDefaults[SCHATTR_USER_DEFINED_ATTR - SCHATTR_START] = new SvXMLAttrContainerItem( SCHATTR_USER_DEFINED_ATTR ); +/*N*/ + /************************************************************************** + * ItemInfos + **************************************************************************/ +/*N*/ pItemInfos = new SfxItemInfo[SCHATTR_END - SCHATTR_START + 1]; +/*N*/ +/*N*/ USHORT i; +/*N*/ for( i = SCHATTR_START; i <= SCHATTR_END; i++ ) +/*N*/ { +/*N*/ pItemInfos[i - SCHATTR_START]._nSID = 0; +/*N*/ pItemInfos[i - SCHATTR_START]._nFlags = SFX_ITEM_POOLABLE; +/*N*/ } +/*N*/ +/*N*/ // non-persistent items +/*N*/ for( i = SCHATTR_NONPERSISTENT_START; i <= SCHATTR_NONPERSISTENT_END; i++ ) +/*N*/ { +/*N*/ pItemInfos[ i - SCHATTR_START ]._nFlags = 0; +/*N*/ } +/*N*/ +/*N*/ // slot ids differing from which ids +/*N*/ pItemInfos[SCHATTR_LEGEND_POS - SCHATTR_START]._nSID = CHATTR_LEGEND_POS; +/*N*/ pItemInfos[SCHATTR_SYMBOL_BRUSH - SCHATTR_START]._nSID = SID_ATTR_BRUSH; +/*N*/ pItemInfos[SCHATTR_STYLE_SYMBOL - SCHATTR_START]._nSID = SID_ATTR_SYMBOLTYPE; +/*N*/ pItemInfos[SCHATTR_SYMBOL_SIZE - SCHATTR_START]._nSID = SID_ATTR_SYMBOLSIZE; +/*N*/ +/*N*/ SetDefaults(ppPoolDefaults); +/*N*/ SetItemInfos(pItemInfos); +/*N*/ } + +/************************************************************************* +|* +|* Kopier-Konstruktor, sorgt dafuer, dass die static defaults geclont +|* werden (Parameter 2 = TRUE) +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +/*N*/ SchItemPool::~SchItemPool() +/*N*/ { +/*N*/ Delete(); +/*N*/ +/*N*/ delete[] pItemInfos; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_DATADESCR_DESCR - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_DATADESCR_DESCR - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_DATADESCR_SHOW_SYM - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_DATADESCR_SHOW_SYM - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_ORIENT - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_ORDER - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_ORDER - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_OVERLAP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_OVERLAP - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_LOGARITHM - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_LOGARITHM - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_AUTO_ORIGIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Y_AXIS_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Y_AXIS_ORIGIN - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_AUTO_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_AUTO_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_LOGARITHM - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_LOGARITHM - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_AUTO_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_AUTO_ORIGIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_X_AXIS_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_X_AXIS_ORIGIN - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_LOGARITHM - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_LOGARITHM - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_AUTO_ORIGIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_Z_AXIS_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_Z_AXIS_ORIGIN - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXISTYPE - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_DUMMY0 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_DUMMY0 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_DUMMY1 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_DUMMY1 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_DUMMY2 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_DUMMY2 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_DUMMY3 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_DUMMY3 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_DUMMY_END - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_DUMMY_END - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_AVERAGE - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_AVERAGE - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_KIND_ERROR - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_KIND_ERROR - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_PERCENT - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_PERCENT - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_BIGERROR - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_BIGERROR - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_CONSTPLUS - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_CONSTPLUS - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_CONSTMINUS - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_CONSTMINUS - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_INDICATE - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_INDICATE - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STAT_REGRESSTYPE - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STAT_REGRESSTYPE - SCHATTR_START]; +/*N*/ +/*N*/ +/*N*/ +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_DEEP - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_3D - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_VERTICAL - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_BASETYPE - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_LINES - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_PERCENT - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_STACKED - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_SPLINES - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_SYMBOL - SCHATTR_START],0); +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STYLE_SHAPE - SCHATTR_START],0); +/*N*/ +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_DEEP - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_3D - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_VERTICAL - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_BASETYPE - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_LINES - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_PERCENT - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_STACKED - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_SPLINES - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_SYMBOL - SCHATTR_START]; +/*N*/ delete ppPoolDefaults[SCHATTR_STYLE_SHAPE - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_DUMMY0 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_DUMMY0 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_DUMMY1 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_DUMMY1 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_DUMMY2 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_DUMMY2 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_TEXT_DUMMY3 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_TEXT_DUMMY3 - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_AUTO_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_AUTO_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_MIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_MIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_AUTO_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_AUTO_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_MAX - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_MAX - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_STEP_MAIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_STEP_MAIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_AUTO_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_STEP_HELP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_LOGARITHM - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_LOGARITHM - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_AUTO_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_AUTO_ORIGIN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_ORIGIN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_ORIGIN - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_TICKS - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_TICKS - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_HELPTICKS - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_NUMFMT - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_NUMFMT - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_NUMFMTPERCENT - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_NUMFMTPERCENT - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_SHOWAXIS - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_SHOWAXIS - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_SHOWDESCR - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_SHOWMAINGRID - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_SHOWMAINGRID - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_SHOWHELPGRID - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_SHOWHELPGRID - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_TOPDOWN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_TOPDOWN - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_DUMMY0 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_DUMMY0 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_DUMMY1 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_DUMMY1 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_DUMMY2 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_DUMMY2 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_AXIS_DUMMY3 - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_AXIS_DUMMY3 - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_BAR_OVERLAP - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_BAR_OVERLAP - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_BAR_GAPWIDTH - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_BAR_GAPWIDTH - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_SYMBOL_BRUSH - SCHATTR_START]; +/*N*/ +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STOCK_UPDOWN - SCHATTR_START]; +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_STOCK_VOLUME - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_SYMBOL_SIZE - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_SYMBOL_SIZE - SCHATTR_START]; +/*N*/ +/*N*/ SetRefCount(*ppPoolDefaults[SCHATTR_USER_DEFINED_ATTR - SCHATTR_START], 0); +/*N*/ delete ppPoolDefaults[SCHATTR_USER_DEFINED_ATTR - SCHATTR_START]; +/*N*/ +/*N*/ delete[] ppPoolDefaults; +/*N*/ } + +/************************************************************************* +|* +|* Clone() +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Liefert fuer alle Which-Ids 100TH_MM als MapUnit +|* +\************************************************************************/ + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_memchrt.cxx b/binfilter/bf_sch/source/core/sch_memchrt.cxx new file mode 100644 index 000000000000..cf3b9e646355 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_memchrt.cxx @@ -0,0 +1,1407 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _STREAM_HXX +// enable stream operators >>/<< for UniString (8 Bit !) +//#ifndef ENABLE_STRING_STREAM_OPERATORS +//#define ENABLE_STRING_STREAM_OPERATORS +//#endif +#endif + +#ifndef _ZFORLIST_HXX //autogen +#ifndef _ZFORLIST_DECLARE_TABLE +#define _ZFORLIST_DECLARE_TABLE +#endif +#include <bf_svtools/zforlist.hxx> +#endif + +#include <tools/tenccvt.hxx> + +#include <float.h> +#include <math.h> +#include "schiocmp.hxx" +#include "memchrt.hxx" + +#include "schresid.hxx" +#include "glob.hrc" + +#include <functional> +#include <algorithm> +namespace binfilter { + +// ======================================== +// Helper objects +// ======================================== + +/** unary function that escapes backslashes and single quotes in a sal_Unicode + array (which you can get from an OUString with getStr()) and puts the result + into the OUStringBuffer given in the CTOR + */ +/*N*/ class lcl_Escape : public ::std::unary_function< sal_Unicode, void > +/*N*/ { +/*N*/ public: +/*N*/ lcl_Escape( ::rtl::OUStringBuffer & aResultBuffer ) : m_aResultBuffer( aResultBuffer ) {} +/*N*/ void operator() ( sal_Unicode aChar ) +/*N*/ { +/*N*/ static const sal_Unicode m_aQuote( '\'' ); +/*N*/ static const sal_Unicode m_aBackslash( '\\' ); +/*N*/ +/*N*/ if( aChar == m_aQuote || +/*N*/ aChar == m_aBackslash ) +/*N*/ m_aResultBuffer.append( m_aBackslash ); +/*N*/ m_aResultBuffer.append( aChar ); +/*N*/ } +/*N*/ +/*N*/ private: +/*N*/ ::rtl::OUStringBuffer & m_aResultBuffer; +/*N*/ }; + +/** unary function that removes backslash escapes in a sal_Unicode array (which + you can get from an OUString with getStr()) and puts the result into the + OUStringBuffer given in the CTOR + */ +/*N*/ class lcl_UnEscape : public ::std::unary_function< sal_Unicode, void > +/*N*/ { +/*N*/ public: +/*N*/ lcl_UnEscape( ::rtl::OUStringBuffer & aResultBuffer ) : m_aResultBuffer( aResultBuffer ) {} +/*N*/ void operator() ( sal_Unicode aChar ) +/*N*/ { +/*N*/ static const sal_Unicode m_aBackslash( '\\' ); +/*N*/ +/*N*/ if( aChar != m_aBackslash ) +/*N*/ m_aResultBuffer.append( aChar ); +/*N*/ } +/*N*/ +/*N*/ private: +/*N*/ ::rtl::OUStringBuffer & m_aResultBuffer; +/*N*/ }; + + + +#define MIN(a,b) ( ((a)<(b))? (a) : (b) ) +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchMemChart::SchMemChart(ChartDataId nMyID) : +/*N*/ nTranslated(TRANS_NONE), +/*N*/ nRefCount (0), +/*N*/ mpColNameBuffer(NULL), +/*N*/ mpRowNameBuffer(NULL), +/*N*/ nRowCnt (0), +/*N*/ nColCnt (0), +/*N*/ eDataType(NUMBERFORMAT_NUMBER), +/*N*/ pData (0), +/*N*/ pColText (0), +/*N*/ pRowText (0), +/*N*/ myID (nMyID), +/*N*/ mpNumFormatter(NULL), +/*N*/ pRowNumFmtId(NULL), +/*N*/ pColNumFmtId(NULL), +/*N*/ pRowTable(NULL), +/*N*/ pColTable(NULL), +/*N*/ bReadOnly(FALSE), +/*N*/ nLastSelInfoReturn(0) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchMemChart::SchMemChart(short nCols, short nRows) : +/*N*/ nTranslated(TRANS_NONE), +/*N*/ nRefCount (0), +/*N*/ mpColNameBuffer(NULL), +/*N*/ mpRowNameBuffer(NULL), +/*N*/ eDataType(NUMBERFORMAT_NUMBER), +/*N*/ pData (0), +/*N*/ pColText (0), +/*N*/ pRowText (0), +/*N*/ myID (CHDATAID_MEMCHART_PLUS), +/*N*/ mpNumFormatter(NULL), +/*N*/ pRowNumFmtId(NULL), +/*N*/ pColNumFmtId(NULL), +/*N*/ pRowTable(NULL), +/*N*/ pColTable(NULL), +/*N*/ bReadOnly(FALSE), +/*N*/ nLastSelInfoReturn(0) +/*N*/ { +/*N*/ nRowCnt = nRows; +/*N*/ nColCnt = nCols; +/*N*/ pData = new double[nColCnt * nRowCnt]; +/*N*/ +/*N*/ pRowNumFmtId= new sal_Int32 [nRowCnt]; +/*N*/ pColNumFmtId= new sal_Int32 [nColCnt]; +/*N*/ InitNumFmt(); +/*N*/ +/*N*/ pRowTable = new sal_Int32 [nRowCnt]; +/*N*/ pColTable = new sal_Int32 [nColCnt]; +/*N*/ ResetTranslation(pRowTable,nRowCnt); +/*N*/ ResetTranslation(pColTable,nColCnt); +/*N*/ +/*N*/ if (pData) +/*N*/ { +/*N*/ double *pFill = pData; +/*N*/ +/*N*/ for (short i = 0; i < nColCnt; i++) +/*N*/ for (short j = 0; j < nRowCnt; j++) +/*N*/ *(pFill ++) = 0.0; +/*N*/ } +/*N*/ +/*N*/ pColText = new String[nColCnt]; +/*N*/ pRowText = new String[nRowCnt]; +/*N*/ } +/************************************************************************* +|* +|* Kopiere alles ausser den numerischen Daten (d.h. Texte!) +|* +\************************************************************************/ +/*N*/ void SchMemChart::SetNonNumericData(const SchMemChart &rMemChart) +/*N*/ { +/*N*/ aMainTitle = rMemChart.aMainTitle; +/*N*/ aSubTitle = rMemChart.aSubTitle; +/*N*/ aXAxisTitle = rMemChart.aXAxisTitle; +/*N*/ aYAxisTitle = rMemChart.aYAxisTitle; +/*N*/ aZAxisTitle = rMemChart.aZAxisTitle; +/*N*/ eDataType = rMemChart.eDataType; +/*N*/ aSomeData1 = ((SchMemChart&) rMemChart).SomeData1 (); +/*N*/ aSomeData2 = ((SchMemChart&) rMemChart).SomeData2 (); +/*N*/ aSomeData3 = ((SchMemChart&) rMemChart).SomeData3 (); +/*N*/ aSomeData4 = ((SchMemChart&) rMemChart).SomeData4 (); +/*N*/ +/*N*/ long nCols=MIN(nColCnt,rMemChart.nColCnt); +/*N*/ long nRows=MIN(nRowCnt,rMemChart.nRowCnt); +/*N*/ +/*N*/ short i; +/*N*/ for (i = 0; i < nCols; i++) +/*N*/ pColText[i] = rMemChart.pColText[i]; +/*N*/ for (i = 0; i < nRows; i++) +/*N*/ pRowText[i] = rMemChart.pRowText[i]; +/*N*/ +/*N*/ // copy chart range +/*N*/ SetChartRange( rMemChart.GetChartRange()); +/*N*/ } +/************************************************************************* +|* +|* Kopier-Konstruktor +|* +\************************************************************************/ + +/*N*/ SchMemChart::SchMemChart(const SchMemChart& rMemChart) : +/*N*/ nTranslated(TRANS_NONE), +/*N*/ nRefCount (0), +/*N*/ mpColNameBuffer(NULL), +/*N*/ mpRowNameBuffer(NULL), +/*N*/ myID (CHDATAID_MEMCHART_PLUS), +/*N*/ mpNumFormatter(NULL), +/*N*/ pRowNumFmtId(NULL), +/*N*/ pColNumFmtId(NULL), +/*N*/ pRowTable(NULL), +/*N*/ pColTable(NULL) +/*N*/ { +/*N*/ nColCnt = rMemChart.nColCnt; +/*N*/ nRowCnt = rMemChart.nRowCnt; +/*N*/ aMainTitle = rMemChart.aMainTitle; +/*N*/ aSubTitle = rMemChart.aSubTitle; +/*N*/ aXAxisTitle = rMemChart.aXAxisTitle; +/*N*/ aYAxisTitle = rMemChart.aYAxisTitle; +/*N*/ aZAxisTitle = rMemChart.aZAxisTitle; +/*N*/ eDataType = rMemChart.eDataType; +/*N*/ aSomeData1 = ((SchMemChart&) rMemChart).SomeData1 (); +/*N*/ aSomeData2 = ((SchMemChart&) rMemChart).SomeData2 (); +/*N*/ aSomeData3 = ((SchMemChart&) rMemChart).SomeData3 (); +/*N*/ aSomeData4 = ((SchMemChart&) rMemChart).SomeData4 (); +/*N*/ pData = new double[nColCnt * nRowCnt]; +/*N*/ +/*N*/ pRowNumFmtId= new sal_Int32 [nRowCnt]; +/*N*/ pColNumFmtId= new sal_Int32 [nColCnt]; +/*N*/ pRowTable = new sal_Int32 [nRowCnt]; +/*N*/ pColTable = new sal_Int32 [nColCnt]; +/*N*/ +/*N*/ aAppLink = rMemChart.aAppLink; +/*N*/ nLastSelInfoReturn = rMemChart.nLastSelInfoReturn; +/*N*/ +/*N*/ nTranslated = rMemChart.nTranslated; +/*N*/ long i; +/*N*/ for(i=0;i<nColCnt;i++) +/*N*/ { +/*N*/ pColTable[i] = rMemChart.pColTable[i]; +/*N*/ pColNumFmtId[i] = rMemChart.pColNumFmtId[i]; +/*N*/ } +/*N*/ for(i=0;i<nRowCnt;i++) +/*N*/ { +/*N*/ pRowTable[i] = rMemChart.pRowTable[i]; +/*N*/ pRowNumFmtId[i] = rMemChart.pRowNumFmtId[i]; +/*N*/ } +/*N*/ mpNumFormatter=rMemChart.mpNumFormatter; +/*N*/ +/*N*/ if (pData) +/*N*/ { +/*N*/ double *pDest = pData; +/*N*/ double *pSource = rMemChart.pData; +/*N*/ +/*N*/ for (short i = 0; i < nColCnt; i++) +/*N*/ for (short j = 0; j < nRowCnt; j++) +/*N*/ *(pDest ++) = *(pSource ++); +/*N*/ } +/*N*/ +/*N*/ pColText = new String[nColCnt]; +/*N*/ +/*N*/ for (i = 0; i < nColCnt; i++) +/*N*/ pColText[i] = rMemChart.pColText[i]; +/*N*/ +/*N*/ pRowText = new String[nRowCnt]; +/*N*/ +/*N*/ for (i = 0; i < nRowCnt; i++) +/*N*/ pRowText[i] = rMemChart.pRowText[i]; +/*N*/ +/*N*/ bReadOnly = rMemChart.bReadOnly; // bm #69410# +/*N*/ +/*N*/ // copy address members +/*N*/ maCategoriesRangeAddress = rMemChart.maCategoriesRangeAddress; +/*N*/ maSeriesAddresses = rMemChart.maSeriesAddresses; +/*N*/ +/*N*/ // copy chart range +/*N*/ SetChartRange( rMemChart.GetChartRange()); +/*N*/ } + +//Überprüft, ob die Umordnung/Translation OK ist, Fehlerfall, wenn : +// a) Spaltenumordnung aber Reihen vertauscht (FALSE,TRANS_ERROR) +// b) Reihenumordnung aber Spalten vertauscht (FALSE,TRANS_ERROR) +// c) keine Umordnung, Reihen oder Spalten vertauscht (FALSE,TRANS_ERROR) +// d) Umordnungsflag gesetzt (auf TRANS_ROW,TRANS_COL oder TRANS_ERROR) aber +// keine Umordnung (mehr) vorhanden (FALSE,TRANS_NONE) +// sonst wird TRUE zurückgegeben + +#if OSL_DEBUG_LEVEL > 0 +/*N*/ BOOL SchMemChart::VerifyTranslation() +/*N*/ { +/*N*/ //Fehler ? +/*N*/ if(nTranslated!=TRANS_COL) +/*N*/ { +/*N*/ for(long nCol=0;nCol<nColCnt;nCol++) +/*N*/ { +/*N*/ if(pColTable[nCol]!=nCol) +/*N*/ { +/*?*/ //nTranslated=TRANS_ERROR; +/*?*/ if(nTranslated==TRANS_NONE) +/*?*/ { +/*?*/ DBG_ERROR("SchMemChart::Correcting Translationmode"); +/*?*/ nTranslated=TRANS_COL; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ DBG_ERROR("fatal error in SchMemChart-translation"); +/*?*/ return FALSE; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ if(nTranslated!=TRANS_ROW) +/*N*/ { +/*N*/ for(long nRow=0;nRow<nRowCnt;nRow++) +/*N*/ { +/*N*/ if(pRowTable[nRow]!=nRow) +/*N*/ { +/*?*/ //nTranslated=TRANS_ERROR; +/*?*/ if(nTranslated==TRANS_NONE) +/*?*/ { +/*?*/ DBG_ERROR("SchMemChart::Correcting Translationmode"); +/*?*/ nTranslated=TRANS_ROW; +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ DBG_ERROR("fatal error in SchMemChart-translation"); +/*?*/ return FALSE; +/*?*/ } +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ // Sortierung besteht noch ? +/*N*/ if(nTranslated==TRANS_ROW) +/*N*/ { +/*?*/ for(long nRow=0;nRow<nRowCnt;nRow++) +/*?*/ { +/*?*/ if(pRowTable[nRow]!=nRow) +/*?*/ return TRUE; +/*?*/ } +/*N*/ } +/*N*/ if(nTranslated==TRANS_COL) +/*N*/ { +/*?*/ for(long nCol=0;nCol<nColCnt;nCol++) +/*?*/ { +/*?*/ if(pColTable[nCol]!=nCol) +/*?*/ return TRUE; +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ if(nTranslated!=TRANS_NONE) +/*N*/ { +/*?*/ nTranslated=TRANS_NONE; +/*?*/ return FALSE; +/*N*/ } +/*N*/ return TRUE; +/*N*/ +/*N*/ } +#endif + +/*N*/ double SchMemChart::GetTransData(long nCol,long nRow) +/*N*/ { +/*N*/ DBG_ASSERT(VerifyTranslation(), "Translation table corrupted in MemChart"); +/*N*/ return GetData( (short)pColTable[nCol], (short)pRowTable[nRow]); +/*N*/ } +/*N*/ double SchMemChart::GetTransDataInPercent(long nCol, long nRow, BOOL bRowData) const +/*N*/ { +/*N*/ DBG_ASSERT(((SchMemChart*)this)->VerifyTranslation(), "Translation table corrupted in MemChart"); +/*N*/ return GetDataInPercent( (short)pColTable[nCol], (short)pRowTable[nRow], bRowData); +/*N*/ } +/*N*/ const String& SchMemChart::GetTransColText(long nCol) const +/*N*/ { +/*N*/ DBG_ASSERT(((SchMemChart*)this)->VerifyTranslation(), "Translation table corrupted in MemChart"); +/*N*/ return GetColText( (short)pColTable[nCol] ); +/*N*/ } +/*N*/ const String& SchMemChart::GetTransRowText(long nRow) const +/*N*/ { +/*N*/ DBG_ASSERT(((SchMemChart*)this)->VerifyTranslation(), "Translation table corrupted in MemChart"); +/*N*/ return GetRowText( (short)pRowTable[nRow] ); +/*N*/ } +/*N*/ long SchMemChart::GetTransNumFormatIdRow(const long nRow) const +/*N*/ { +/*N*/ DBG_ASSERT(((SchMemChart*)this)->VerifyTranslation(), "Translation table corrupted in MemChart"); +/*N*/ return ( nTranslated == TRANS_ROW )? pRowNumFmtId[ pRowTable[ nRow ]]: pRowNumFmtId[ nRow ]; +/*N*/ } +/*N*/ long SchMemChart::GetTransNumFormatIdCol(const long nCol) const +/*N*/ { +/*N*/ DBG_ASSERT(((SchMemChart*)this)->VerifyTranslation(), "Translation table corrupted in MemChart"); +/*N*/ return ( nTranslated == TRANS_COL ) ? pColNumFmtId[ pColTable[ nCol ]]: pColNumFmtId[ nCol ]; +/*N*/ } + + +/************************************************************************* +|* +|* Wie GetData, aber in Prozentwerten +|* Optimierungsvorschlag: fTotal fuer jede Zeile und Spalte buffern, +|* dazu muessen alle Schnittstellen bekannt sein, +|* die Daten am MemChart veraendern koennen. +|* +\************************************************************************/ +/*N*/ double SchMemChart::GetDataInPercent(const short nCol , const short nRow, const BOOL bRowData) const +/*N*/ { +/*N*/ double fTotal=0.0,fTemp,fData; +/*N*/ short i; +/*N*/ +/*N*/ fData = GetData(nCol,nRow); +/*N*/ +/*N*/ if(bRowData) +/*N*/ { +/*N*/ for(i=0;i<nRowCnt;i++) +/*N*/ { +/*N*/ fTemp=GetData(nCol,i); +/*N*/ +/*N*/ if(fTemp != DBL_MIN) fTotal += fabs(fTemp); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ for(i=0;i<nColCnt;i++) +/*N*/ { +/*N*/ fTemp=GetData(i,nRow); +/*N*/ +/*N*/ if(fTemp != DBL_MIN) fTotal += fabs(fTemp); +/*N*/ } +/*N*/ +/*N*/ } +/*N*/ return fTotal ? ( (fabs(fData) / fTotal) * 100.0 ) : DBL_MIN; +/*N*/ } + +/************************************************************************* +|* +|* Inserter fuer SvStream zum Speichern +|* +\************************************************************************/ + +/*N*/ SvStream& operator << (SvStream& rOut, const SchMemChart& rMemChart) +/*N*/ { +/*N*/ CharSet aSysCharSet = static_cast< CharSet >( ::GetSOStoreTextEncoding( gsl_getSystemTextEncoding(), +/*N*/ (USHORT)rOut.GetVersion()) ); +/*N*/ rOut.SetStreamCharSet( aSysCharSet ); +/*N*/ +/*N*/ //Version 1: Abspeichern der pRow,pColTable (long-array) +/*N*/ SchIOCompat aIO(rOut, STREAM_WRITE, 2); +/*N*/ +/*N*/ rOut << (INT16)rMemChart.nColCnt; +/*N*/ rOut << (INT16)rMemChart.nRowCnt; +/*N*/ +/*N*/ double *pOut = rMemChart.pData; +/*N*/ +/*N*/ short i; +/*N*/ for (i = 0; i < rMemChart.nColCnt; i++) +/*N*/ for (short j = 0; j < rMemChart.nRowCnt; j++) +/*N*/ rOut << *(pOut ++); +/*N*/ +/*N*/ rOut << (INT16)aSysCharSet; +/*N*/ rOut.WriteByteString( rMemChart.aMainTitle ); +/*N*/ rOut.WriteByteString( rMemChart.aSubTitle ); +/*N*/ rOut.WriteByteString( rMemChart.aXAxisTitle ); +/*N*/ rOut.WriteByteString( rMemChart.aYAxisTitle ); +/*N*/ rOut.WriteByteString( rMemChart.aZAxisTitle ); +/*N*/ +/*N*/ for (i = 0; i < rMemChart.nColCnt; i++) +/*N*/ rOut.WriteByteString( rMemChart.pColText[ i ] ); +/*N*/ +/*N*/ for (i = 0; i < rMemChart.nRowCnt; i++) +/*N*/ rOut.WriteByteString( rMemChart.pRowText[ i ] ); +/*N*/ +/*N*/ rOut << (INT16)rMemChart.eDataType; +/*N*/ +/*N*/ //IOVersion = 1 +/*N*/ long nIndex; +/*N*/ for (nIndex = 0; nIndex < rMemChart.nColCnt; nIndex++) +/*N*/ rOut << rMemChart.pColTable[nIndex]; +/*N*/ +/*N*/ for (nIndex = 0; nIndex < rMemChart.nRowCnt; nIndex++) +/*N*/ rOut << rMemChart.pRowTable[nIndex]; +/*N*/ +/*N*/ //IOVersion = 2 +/*N*/ rOut << rMemChart.nTranslated; +/*N*/ +/*N*/ +/*N*/ return rOut; +/*N*/ } + +/************************************************************************* +|* +|* Extractor fuer SvStream zum Laden +|* +\************************************************************************/ + +/*N*/ SvStream& operator >> (SvStream& rIn, SchMemChart& rMemChart) +/*N*/ { +/*N*/ INT16 nInt16; +/*N*/ +/*N*/ SchIOCompat aIO(rIn, STREAM_READ); +/*N*/ +/*N*/ rIn >> nInt16; rMemChart.nColCnt = (short)nInt16; +/*N*/ rIn >> nInt16; rMemChart.nRowCnt = (short)nInt16; +/*N*/ +/*N*/ rMemChart.pData = new double[rMemChart.nColCnt * rMemChart.nRowCnt]; +/*N*/ +/*N*/ double *pIn = rMemChart.pData; +/*N*/ +/*N*/ short i; +/*N*/ for (i = 0; i < rMemChart.nColCnt; i++) +/*N*/ for (short j = 0; j < rMemChart.nRowCnt; j++) +/*N*/ rIn >> *(pIn ++); +/*N*/ +/*N*/ INT16 nCharSet; +/*N*/ rIn >> nCharSet; +/*N*/ +/*N*/ rtl_TextEncoding aCharSet = ::GetSOLoadTextEncoding( static_cast< rtl_TextEncoding >( nCharSet ), +/*N*/ (USHORT)rIn.GetVersion()); +/*N*/ rIn.SetStreamCharSet( aCharSet ); +/*N*/ +/*N*/ rIn.ReadByteString( rMemChart.aMainTitle ); +/*N*/ rIn.ReadByteString( rMemChart.aSubTitle ); +/*N*/ rIn.ReadByteString( rMemChart.aXAxisTitle ); +/*N*/ rIn.ReadByteString( rMemChart.aYAxisTitle ); +/*N*/ rIn.ReadByteString( rMemChart.aZAxisTitle ); +/*N*/ +/*N*/ rMemChart.pColText = new String[rMemChart.nColCnt]; +/*N*/ +/*N*/ for (i = 0; i < rMemChart.nColCnt; i++) +/*N*/ { +/*N*/ rIn.ReadByteString( rMemChart.pColText[ i ] ); +/*N*/ } +/*N*/ +/*N*/ rMemChart.pRowText = new String[rMemChart.nRowCnt]; +/*N*/ +/*N*/ for (i = 0; i < rMemChart.nRowCnt; i++) +/*N*/ { +/*N*/ rIn.ReadByteString( rMemChart.pRowText[ i ] ); +/*N*/ } +/*N*/ +/*N*/ rIn >> nInt16; rMemChart.eDataType = (short)nInt16; +/*N*/ +/*N*/ rMemChart.pRowNumFmtId = new sal_Int32 [rMemChart.nRowCnt]; +/*N*/ rMemChart.pColNumFmtId = new sal_Int32 [rMemChart.nColCnt]; +/*N*/ rMemChart.pRowTable = new sal_Int32 [rMemChart.nRowCnt]; +/*N*/ rMemChart.pColTable = new sal_Int32 [rMemChart.nColCnt]; +/*N*/ +/*N*/ if(aIO.GetVersion()>=1) +/*N*/ { +/*N*/ long i; +/*N*/ for (i = 0; i < rMemChart.nColCnt; i++) +/*N*/ rIn >> rMemChart.pColTable[i]; +/*N*/ +/*N*/ for (i = 0; i < rMemChart.nRowCnt; i++) +/*N*/ rIn >> rMemChart.pRowTable[i]; +/*N*/ +/*N*/ if(aIO.GetVersion()>=2) +/*N*/ rIn >> rMemChart.nTranslated; +/*N*/ +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ rMemChart.ResetTranslation(rMemChart.pRowTable,rMemChart.nRowCnt); +/*?*/ rMemChart.ResetTranslation(rMemChart.pColTable,rMemChart.nColCnt); +/*N*/ } +/*N*/ +/*N*/ rMemChart.InitNumFmt(); //ab IOVersion 2 (ToDo:) +/*N*/ +/*N*/ return rIn; +/*N*/ } + +/************************************************************************* +|* +|* QuickSort ueber Spalten +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* QuickSort ueber Zeilen +|* +\************************************************************************/ + + +/*N*/ void SchMemChart::InitNumFmt() +/*N*/ { +/*N*/ long i; +/*N*/ for(i=0;i<nColCnt;i++) +/*N*/ pColNumFmtId[i]=-1; //uninitialised! +/*N*/ +/*N*/ for(i=0;i<nRowCnt;i++) +/*N*/ pRowNumFmtId[i]=-1; +/*N*/ } + +/************************************************************************* +|* +|* QuickSort ueber Spalten +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* QuickSort ueber Zeilen +|* +\************************************************************************/ + + +/*N*/ String SchMemChart::GetDefaultColumnText( sal_Int32 nCol ) const +/*N*/ { +/*N*/ if( !mpColNameBuffer ) +/*N*/ { +/*N*/ // initialize resource string +/*N*/ mpColNameBuffer = new String[ 2 ]; +/*N*/ DBG_ASSERT( mpColNameBuffer, "couldn't create two strings!" ); +/*N*/ String aResStr( SchResId( STR_COLUMN )); +/*N*/ xub_StrLen nPos = aResStr.SearchAscii( "$(N)" ); +/*N*/ if( nPos != STRING_NOTFOUND ) +/*N*/ { +/*N*/ mpColNameBuffer[ 0 ] = String( aResStr, 0, nPos ); +/*N*/ mpColNameBuffer[ 1 ] = String( aResStr, nPos + sizeof( "$(N)" ) - 1, STRING_LEN ); +/*N*/ } +/*N*/ else +/*?*/ mpColNameBuffer[ 0 ] = aResStr; +/*N*/ } +/*N*/ +/*N*/ if( mpColNameBuffer ) +/*N*/ { +/*N*/ String aResult( mpColNameBuffer[ 0 ] ); +/*N*/ aResult.Append( String::CreateFromInt32( nCol + 1 )); +/*N*/ aResult.Append( mpColNameBuffer[ 1 ] ); +/*N*/ return aResult; +/*N*/ } +/*N*/ else +/*?*/ return String(); +/*N*/ } + +/*N*/ String SchMemChart::GetDefaultRowText( sal_Int32 nRow ) const +/*N*/ { +/*N*/ if( !mpRowNameBuffer ) +/*N*/ { +/*N*/ // initialize resource string +/*N*/ mpRowNameBuffer = new String[ 2 ]; +/*N*/ DBG_ASSERT( mpRowNameBuffer, "couldn't create two strings!" ); +/*N*/ String aResStr( SchResId( STR_ROW )); +/*N*/ xub_StrLen nPos = aResStr.SearchAscii( "$(N)" ); +/*N*/ if( nPos != STRING_NOTFOUND ) +/*N*/ { +/*N*/ mpRowNameBuffer[ 0 ] = String( aResStr, 0, nPos ); +/*N*/ mpRowNameBuffer[ 1 ] = String( aResStr, nPos + sizeof( "$(N)" ) - 1, STRING_LEN ); +/*N*/ } +/*N*/ else +/*?*/ mpRowNameBuffer[ 0 ] = aResStr; +/*N*/ } +/*N*/ +/*N*/ if( mpRowNameBuffer ) +/*N*/ { +/*N*/ String aResult( mpRowNameBuffer[ 0 ] ); +/*N*/ aResult.Append( String::CreateFromInt32( nRow + 1 )); +/*N*/ aResult.Append( mpRowNameBuffer[ 1 ] ); +/*N*/ return aResult; +/*N*/ } +/*N*/ else +/*?*/ return String(); +/*N*/ } + +using namespace ::com::sun::star; + +// ======================================== + +/*N*/ ::rtl::OUStringBuffer SchMemChart::getXMLStringForCellAddress( const SchCellAddress& rCell ) +/*N*/ { +/*N*/ ::rtl::OUStringBuffer aBuffer; +/*N*/ ::std::vector< SchSingleCell >::const_iterator aIter; +/*N*/ const ::std::vector< SchSingleCell >::const_iterator aEndIter = rCell.maCells.end(); +/*N*/ +/*N*/ for( aIter = rCell.maCells.begin(); aIter != aEndIter; aIter++ ) +/*N*/ { +/*N*/ sal_Int32 nCol = aIter->mnColumn; +/*N*/ aBuffer.append( (sal_Unicode)'.' ); +/*N*/ if( ! aIter->mbRelativeColumn ) +/*N*/ aBuffer.append( (sal_Unicode)'$' ); +/*N*/ +/*N*/ // get A, B, C, ..., AA, AB, ... representation of column number +/*N*/ if( nCol < 26 ) +/*N*/ aBuffer.append( (sal_Unicode)('A' + nCol) ); +/*N*/ else if( nCol < 702 ) +/*N*/ { +/*?*/ aBuffer.append( (sal_Unicode)('A' + nCol / 26 - 1 )); +/*?*/ aBuffer.append( (sal_Unicode)('A' + nCol % 26) ); +/*N*/ } +/*N*/ else // works for nCol <= 18,278 +/*N*/ { +/*?*/ aBuffer.append( (sal_Unicode)('A' + nCol / 702 - 1 )); +/*?*/ aBuffer.append( (sal_Unicode)('A' + (nCol % 702) / 26 )); +/*?*/ aBuffer.append( (sal_Unicode)('A' + nCol % 26) ); +/*N*/ } +/*N*/ +/*N*/ // write row number as number +/*N*/ if( ! aIter->mbRelativeRow ) +/*N*/ aBuffer.append( (sal_Unicode)'$' ); +/*N*/ aBuffer.append( aIter->mnRow + (sal_Int32)1 ); +/*N*/ } +/*N*/ +/*N*/ return aBuffer; +/*N*/ } + +/*N*/ void SchMemChart::getSingleCellAddressFromXMLString( +/*N*/ const ::rtl::OUString& rXMLString, +/*N*/ sal_Int32 nStartPos, sal_Int32 nEndPos, +/*N*/ SchSingleCell& rSingleCell ) +/*N*/ { +/*N*/ // expect "\$?[a-zA-Z]+\$?[1-9][0-9]*" +/*N*/ static const sal_Unicode aDollar( '$' ); +/*N*/ static const sal_Unicode aLetterA( 'A' ); +/*N*/ +/*N*/ ::rtl::OUString aCellStr = rXMLString.copy( nStartPos, nEndPos - nStartPos + 1 ).toAsciiUpperCase(); +/*N*/ const sal_Unicode* pStrArray = aCellStr.getStr(); +/*N*/ sal_Int32 nLength = aCellStr.getLength(); +/*N*/ sal_Int32 i = nLength - 1, nColumn = 0; +/*N*/ +/*N*/ // parse number for row +/*N*/ while( CharClass::isAsciiDigit( pStrArray[ i ] ) && i >= 0 ) +/*N*/ i--; +/*N*/ rSingleCell.mnRow = (aCellStr.copy( i + 1 )).toInt32() - 1; +/*N*/ // a dollar in XML means absolute (whereas in UI it means relative) +/*N*/ if( pStrArray[ i ] == aDollar ) +/*N*/ { +/*N*/ i--; +/*N*/ rSingleCell.mbRelativeRow = sal_False; +/*N*/ } +/*N*/ else +/*N*/ rSingleCell.mbRelativeRow = sal_True; +/*N*/ +/*N*/ // parse rest for column +/*N*/ sal_Int32 nPower = 1; +/*N*/ while( CharClass::isAsciiAlpha( pStrArray[ i ] )) +/*N*/ { +/*N*/ nColumn += (pStrArray[ i ] - aLetterA + 1) * nPower; +/*N*/ i--; +/*N*/ nPower *= 26; +/*N*/ } +/*N*/ rSingleCell.mnColumn = nColumn - 1; +/*N*/ +/*N*/ rSingleCell.mbRelativeColumn = sal_True; +/*N*/ if( i >= 0 && +/*N*/ pStrArray[ i ] == aDollar ) +/*N*/ rSingleCell.mbRelativeColumn = sal_False; +/*N*/ } + +/*N*/ bool SchMemChart::getCellAddressFromXMLString( +/*N*/ const ::rtl::OUString& rXMLString, +/*N*/ sal_Int32 nStartPos, sal_Int32 nEndPos, +/*N*/ SchCellAddress& rOutCell, +/*N*/ ::rtl::OUString& rOutTableName ) +/*N*/ { +/*N*/ static const sal_Unicode aDot( '.' ); +/*N*/ static const sal_Unicode aQuote( '\'' ); +/*N*/ static const sal_Unicode aBackslash( '\\' ); +/*N*/ +/*N*/ sal_Int32 nNextDelimiterPos = nStartPos; +/*N*/ +/*N*/ sal_Int32 nDelimiterPos = nStartPos; +/*N*/ bool bInQuotation = false; +/*N*/ // parse table name +/*N*/ while( nDelimiterPos < nEndPos && +/*N*/ ( bInQuotation || rXMLString[ nDelimiterPos ] != aDot )) +/*N*/ { +/*N*/ // skip escaped characters (with backslash) +/*N*/ if( rXMLString[ nDelimiterPos ] == aBackslash ) +/*N*/ ++nDelimiterPos; +/*N*/ // toggle quotation mode when finding single quotes +/*N*/ else if( rXMLString[ nDelimiterPos ] == aQuote ) +/*N*/ bInQuotation = ! bInQuotation; +/*N*/ +/*N*/ ++nDelimiterPos; +/*N*/ } +/*N*/ +/*N*/ if( nDelimiterPos == -1 || +/*N*/ nDelimiterPos >= nEndPos ) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ String aStr( rXMLString.copy( nStartPos, nEndPos - nStartPos + 1 )); +/*N*/ ByteString aBstr( aStr, RTL_TEXTENCODING_ASCII_US ); +/*N*/ DBG_ERROR1( "Invalid Cell Address <%s> found in XML file", aBstr.GetBuffer()); +/*N*/ #endif +/*N*/ return false; +/*N*/ } +/*N*/ if( nDelimiterPos > nStartPos ) +/*N*/ { +/*N*/ // there is a table name before the address +/*N*/ +/*N*/ ::rtl::OUStringBuffer aTableNameBuffer; +/*N*/ const sal_Unicode * pTableName = rXMLString.getStr(); +/*N*/ +/*N*/ // remove escapes from table name +/*N*/ ::std::for_each( pTableName + nStartPos, +/*N*/ pTableName + nDelimiterPos, +/*N*/ lcl_UnEscape( aTableNameBuffer )); +/*N*/ +/*N*/ // unquote quoted table name +/*N*/ const sal_Unicode * pBuf = aTableNameBuffer.getStr(); +/*N*/ if( pBuf[ 0 ] == aQuote && +/*N*/ pBuf[ aTableNameBuffer.getLength() - 1 ] == aQuote ) +/*N*/ { +/*N*/ ::rtl::OUString aName = aTableNameBuffer.makeStringAndClear(); +/*N*/ rOutTableName = aName.copy( 1, aName.getLength() - 2 ); +/*N*/ } +/*N*/ else +/*N*/ rOutTableName = aTableNameBuffer.makeStringAndClear(); +/*N*/ } +/*N*/ +/*N*/ for( sal_Int32 i = 0; +/*N*/ nNextDelimiterPos < nEndPos; +/*N*/ nDelimiterPos = nNextDelimiterPos, i++ ) +/*N*/ { +/*N*/ nNextDelimiterPos = rXMLString.indexOf( aDot, nDelimiterPos + 1 ); +/*N*/ if( nNextDelimiterPos == -1 || +/*N*/ nNextDelimiterPos > nEndPos ) +/*N*/ nNextDelimiterPos = nEndPos + 1; +/*N*/ +/*N*/ rOutCell.maCells.resize( i + 1 ); +/*N*/ getSingleCellAddressFromXMLString( rXMLString, +/*N*/ nDelimiterPos + 1, nNextDelimiterPos - 1, +/*N*/ rOutCell.maCells[ i ] ); +/*N*/ } +/*N*/ +/*N*/ return true; +/*N*/ } + +/*N*/ bool SchMemChart::getCellRangeAddressFromXMLString( +/*N*/ const ::rtl::OUString& rXMLString, +/*N*/ sal_Int32 nStartPos, sal_Int32 nEndPos, +/*N*/ SchCellRangeAddress& rOutRange ) +/*N*/ { +/*N*/ bool bResult = true; +/*N*/ static const sal_Unicode aColon( ':' ); +/*N*/ static const sal_Unicode aQuote( '\'' ); +/*N*/ static const sal_Unicode aBackslash( '\\' ); +/*N*/ +/*N*/ sal_Int32 nDelimiterPos = nStartPos; +/*N*/ bool bInQuotation = false; +/*N*/ // parse table name +/*N*/ while( nDelimiterPos < nEndPos && +/*N*/ ( bInQuotation || rXMLString[ nDelimiterPos ] != aColon )) +/*N*/ { +/*N*/ // skip escaped characters (with backslash) +/*N*/ if( rXMLString[ nDelimiterPos ] == aBackslash ) +/*N*/ ++nDelimiterPos; +/*N*/ // toggle quotation mode when finding single quotes +/*N*/ else if( rXMLString[ nDelimiterPos ] == aQuote ) +/*N*/ bInQuotation = ! bInQuotation; +/*N*/ +/*N*/ ++nDelimiterPos; +/*N*/ } +/*N*/ +/*N*/ if( nDelimiterPos <= nStartPos || // includes == and 'not found' (==-1) +/*N*/ nDelimiterPos >= nEndPos ) +/*N*/ { +/*N*/ #if OSL_DEBUG_LEVEL > 0 +/*N*/ String aStr( rXMLString.copy( nStartPos, nEndPos - nStartPos + 1 )); +/*N*/ ByteString aBstr( aStr, RTL_TEXTENCODING_ASCII_US ); +/*N*/ DBG_ERROR1( "Invalid Cell Range <%s> found in XML file", aBstr.GetBuffer()); +/*N*/ #endif +/*N*/ return false; +/*N*/ } +/*N*/ bResult = getCellAddressFromXMLString( rXMLString, nStartPos, nDelimiterPos - 1, +/*N*/ rOutRange.maUpperLeft, +/*N*/ rOutRange.msTableName ); +/*N*/ ::rtl::OUString sTableSecondName; +/*N*/ if( bResult ) +/*N*/ { +/*N*/ bResult = getCellAddressFromXMLString( rXMLString, nDelimiterPos + 1, nEndPos, +/*N*/ rOutRange.maLowerRight, +/*N*/ sTableSecondName ); +/*N*/ } +/*N*/ DBG_ASSERT( sTableSecondName.getLength() == 0 || +/*N*/ sTableSecondName.equals( rOutRange.msTableName ), +/*N*/ "Cell Range must be inside the same sheet" ); +/*N*/ return bResult; +/*N*/ } + +/// interpret maChartRange and fill XML string with that +/*N*/ ::rtl::OUString SchMemChart::getXMLStringForChartRange() +/*N*/ { +/*N*/ static const sal_Unicode aSpace( ' ' ); +/*N*/ static const sal_Unicode aQuote( '\'' ); +/*N*/ +/*N*/ ::rtl::OUStringBuffer aBuffer; +/*N*/ ::std::vector< SchCellRangeAddress >::iterator aIter; +/*N*/ const ::std::vector< SchCellRangeAddress >::iterator aEndIter = maChartRange.maRanges.end(); +/*N*/ +/*N*/ for( aIter = maChartRange.maRanges.begin(); aIter != aEndIter; /* increment done in body */ ) +/*N*/ { +/*?*/ if( (aIter->msTableName).getLength()) +/*?*/ { +/*?*/ bool bNeedsEscaping = ( aIter->msTableName.indexOf( aQuote ) > -1 ); +/*?*/ bool bNeedsQuoting = bNeedsEscaping || ( aIter->msTableName.indexOf( aSpace ) > -1 ); +/*?*/ +/*?*/ // quote table name if it contains spaces or quotes +/*?*/ if( bNeedsQuoting ) +/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*?*/ } +/*?*/ else +/*?*/ aBuffer.append( aIter->msTableName ); +/*?*/ } +/*?*/ aBuffer.append( getXMLStringForCellAddress( aIter->maUpperLeft )); +/*?*/ +/*?*/ if( aIter->maLowerRight.maCells.size()) +/*?*/ { +/*?*/ // we have a range (not a single cell) +/*?*/ aBuffer.append( sal_Unicode( ':' )); +/*?*/ aBuffer.append( getXMLStringForCellAddress( aIter->maLowerRight )); +/*?*/ } +/*?*/ +/*?*/ aIter++; +/*?*/ // separator for more than one range +/*?*/ if( aIter != aEndIter ) +/*?*/ aBuffer.append( sal_Unicode( ' ' )); +/*N*/ } +/*N*/ +/*N*/ return aBuffer.makeStringAndClear(); +/*N*/ } + +/// parse String and put results into maChartRange +/*N*/ void SchMemChart::getChartRangeForXMLString( const ::rtl::OUString& rXMLString ) +/*N*/ { +/*N*/ static const sal_Unicode aSpace( ' ' ); +/*N*/ static const sal_Unicode aQuote( '\'' ); +/*N*/ static const sal_Unicode aDoubleQuote( '\"' ); +/*N*/ static const sal_Unicode aDollar( '$' ); +/*N*/ static const sal_Unicode aBackslash( '\\' ); +/*N*/ +/*N*/ sal_Int32 nStartPos = 0; +/*N*/ sal_Int32 nEndPos = nStartPos; +/*N*/ const sal_Int32 nLength = rXMLString.getLength(); +/*N*/ +/*N*/ // reset +/*N*/ maChartRange.maRanges.clear(); +/*N*/ +/*N*/ // iterate over different ranges +/*N*/ for( sal_Int32 i = 0; +/*N*/ nEndPos < nLength; +/*N*/ nStartPos = ++nEndPos, i++ ) +/*N*/ { +/*N*/ // find start point of next range +/*N*/ +/*N*/ // ignore leading '$' +/*N*/ if( rXMLString[ nEndPos ] == aDollar) +/*N*/ nEndPos++; +/*N*/ +/*N*/ bool bInQuotation = false; +/*N*/ // parse range +/*N*/ while( nEndPos < nLength && +/*N*/ ( bInQuotation || rXMLString[ nEndPos ] != aSpace )) +/*N*/ { +/*N*/ // skip escaped characters (with backslash) +/*N*/ if( rXMLString[ nEndPos ] == aBackslash ) +/*N*/ ++nEndPos; +/*N*/ // toggle quotation mode when finding single quotes +/*N*/ else if( rXMLString[ nEndPos ] == aQuote ) +/*N*/ bInQuotation = ! bInQuotation; +/*N*/ +/*N*/ ++nEndPos; +/*N*/ } +/*N*/ +/*N*/ maChartRange.maRanges.resize( i + 1 ); +/*N*/ if( ! getCellRangeAddressFromXMLString( +/*N*/ rXMLString, +/*N*/ nStartPos, nEndPos - 1, +/*N*/ maChartRange.maRanges[ i ] )) +/*N*/ { +/*N*/ // if an error occured, bail out +/*N*/ maChartRange.maRanges.clear(); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ #if OSL_DEBUG_LEVEL > 0 +/*N*/ // output result +/*N*/ OSL_TRACE( +/*N*/ ::rtl::OUStringToOString( +/*N*/ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Ranges retrieved from XML-String: \"" )) + +/*N*/ rXMLString + +/*N*/ ::rtl::OUString( sal_Unicode( '\"' )), +/*N*/ RTL_TEXTENCODING_ASCII_US ).getStr() ); +/*N*/ OSL_TRACE( "Size: %d", maChartRange.maRanges.size() ); +/*N*/ for( ::std::vector< SchCellRangeAddress >::const_iterator aIter = maChartRange.maRanges.begin(); +/*N*/ aIter != maChartRange.maRanges.end(); +/*N*/ ++aIter ) +/*N*/ { +/*N*/ OSL_TRACE( " Cell Address found:" ); +/*N*/ OSL_TRACE( " Upper-Left: " ); +/*N*/ for( ::std::vector< SchSingleCell >::const_iterator aIter2 = (*aIter).maUpperLeft.maCells.begin(); +/*N*/ aIter2 != (*aIter).maUpperLeft.maCells.end(); +/*N*/ ++aIter2 ) +/*N*/ { +/*N*/ OSL_TRACE( " Column: %d, Row: %d, Rel-Col: %s, Rel-Row: %s", +/*N*/ (*aIter2).mnColumn, (*aIter2).mnRow, +/*N*/ (*aIter2).mbRelativeColumn ? "true" : "false", +/*N*/ (*aIter2).mbRelativeRow ? "true" : "false" ); +/*N*/ } +/*N*/ OSL_TRACE( " Lower-Right: " ); +/*N*/ for( ::std::vector< SchSingleCell >::const_iterator aIter3 = (*aIter).maLowerRight.maCells.begin(); +/*N*/ aIter3 != (*aIter).maLowerRight.maCells.end(); +/*N*/ ++aIter3 ) +/*N*/ { +/*N*/ OSL_TRACE( " Column: %d, Row: %d, Rel-Col: %s, Rel-Row: %s", +/*N*/ (*aIter3).mnColumn, (*aIter3).mnRow, +/*N*/ (*aIter3).mbRelativeColumn ? "true" : "false", +/*N*/ (*aIter3).mbRelativeRow ? "true" : "false" ); +/*N*/ } +/*N*/ OSL_TRACE( +/*N*/ ::rtl::OUStringToOString( +/*N*/ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Table-Name: \"" )) + +/*N*/ (*aIter).msTableName + +/*N*/ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\", Number: " )) + +/*N*/ ::rtl::OUString::valueOf( (*aIter).mnTableNumber ), +/*N*/ RTL_TEXTENCODING_ASCII_US ).getStr() ); +/*N*/ } +/*N*/ #endif +/*N*/ } + +/** this is needed for export of charts embedded in calc + for saving an XML document in old binary format +*/ +/*N*/ ::rtl::OUString SchMemChart::createTableNumberList() +/*N*/ { +/*N*/ ::rtl::OUStringBuffer aBuffer; +/*N*/ ::std::vector< SchCellRangeAddress >::iterator aIter; +/*N*/ const ::std::vector< SchCellRangeAddress >::iterator aEndIter = maChartRange.maRanges.end(); +/*N*/ sal_Bool bStarted = sal_False; +/*N*/ +/*N*/ for( aIter = maChartRange.maRanges.begin(); aIter != aEndIter; aIter++ ) +/*N*/ { +/*N*/ if( aIter->mnTableNumber != -1 ) +/*N*/ { +/*N*/ if( bStarted ) +/*?*/ aBuffer.append( (sal_Unicode)' ' ); +/*N*/ else +/*N*/ bStarted = sal_True; +/*N*/ +/*N*/ aBuffer.append( aIter->mnTableNumber ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return aBuffer.makeStringAndClear(); +/*N*/ } + +// prerequisite: maChartRange must be set and have the correct dimension +// for all table numbers to fit in +/*N*/ void SchMemChart::parseTableNumberList( const ::rtl::OUString& aList ) +/*N*/ { +/*N*/ static const sal_Unicode aSpace( ' ' ); +/*N*/ sal_Int32 nChartRangeSize = maChartRange.maRanges.size(); +/*N*/ sal_Int32 nStartPos = 0, nEndPos; +/*N*/ sal_Int32 nLength = aList.getLength(); +/*N*/ sal_Int32 nRangeNumber = 0; +/*N*/ +/*N*/ while( nStartPos < nLength ) +/*N*/ { +/*N*/ nEndPos = aList.indexOf( aSpace, nStartPos ); +/*N*/ if( nEndPos == -1 ) +/*N*/ nEndPos = nLength; +/*N*/ +/*N*/ if( nStartPos != nEndPos ) // there were more than one space +/*N*/ { +/*N*/ if( nRangeNumber < nChartRangeSize ) +/*N*/ { +/*N*/ maChartRange.maRanges[ nRangeNumber++ ].mnTableNumber = +/*N*/ aList.copy( nStartPos, (nEndPos - nStartPos)).toInt32(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ DBG_ERROR( "SchMemChart::parseTableNumberList: Too many table numbers for chart range" ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ nStartPos = nEndPos + 1; +/*N*/ } +/*N*/ } + + +// methods to modify SchChartRange +// ------------------------------- + +/*N*/ static sal_Int32 lcl_GetWriterBoxNum( String& rStr, BOOL bFirst ) +/*N*/ { +/*N*/ sal_Int32 nRet = 0; +/*N*/ xub_StrLen nPos = 0; +/*N*/ if( bFirst ) +/*N*/ { +/*N*/ // the first box starts with a letter +/*N*/ sal_Unicode cChar; +/*N*/ BOOL bFirst = TRUE; +/*N*/ while( 0 != ( cChar = rStr.GetChar( nPos )) && +/*N*/ ( (cChar >= 'A' && cChar <= 'Z') || +/*N*/ (cChar >= 'a' && cChar <= 'z') ) ) +/*N*/ { +/*N*/ if( (cChar -= 'A') >= 26 ) +/*N*/ cChar -= 'a' - '['; +/*N*/ if( bFirst ) +/*N*/ bFirst = FALSE; +/*N*/ else +/*N*/ ++nRet; +/*N*/ nRet = nRet * 52 + cChar; +/*N*/ ++nPos; +/*N*/ } +/*N*/ rStr.Erase( 0, nPos ); // remove the read characters +/*N*/ } +/*N*/ else if( STRING_NOTFOUND == ( nPos = rStr.Search( ':' ) )) +/*N*/ { +/*N*/ nRet = rStr.ToInt32(); +/*N*/ rStr.Erase(); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ nRet = rStr.Copy( 0, nPos ).ToInt32(); +/*N*/ rStr.Erase( 0, nPos+1 ); +/*N*/ } +/*N*/ return nRet; +/*N*/ } + +/*N*/ static void lcl_GetWriterTblBox( const String& rStr, +/*N*/ SchCellAddress& rToFill ) +/*N*/ { +/*N*/ BOOL bFirst = TRUE; +/*N*/ String sNm( rStr ); +/*N*/ while( sNm.Len() ) +/*N*/ { +/*N*/ SchSingleCell aCell; +/*N*/ aCell.mnColumn = ::binfilter::lcl_GetWriterBoxNum( sNm, bFirst ); +/*N*/ bFirst = FALSE; +/*N*/ aCell.mnRow = ::binfilter::lcl_GetWriterBoxNum( sNm, bFirst ); +/*N*/ rToFill.maCells.push_back( aCell ); +/*N*/ } +/*N*/ } + +/*N*/ String lcl_GetWriterBoxName( const SchCellAddress& rCell ) +/*N*/ { +/*N*/ String sNm; +/*N*/ +/*N*/ ::std::vector< SchSingleCell >::const_iterator aIter = rCell.maCells.begin(); +/*N*/ const ::std::vector< SchSingleCell >::const_iterator aEnd = rCell.maCells.end(); +/*N*/ BOOL bFirst = TRUE; +/*N*/ for( ; aIter != aEnd; aIter++ ) +/*N*/ { +/*N*/ String sTmp( String::CreateFromInt32( aIter->mnRow )); +/*N*/ if( sNm.Len() ) +/*N*/ sNm.Insert( '.', 0 ).Insert( sTmp, 0 ); +/*N*/ else +/*N*/ sNm = sTmp; +/*N*/ +/*N*/ if( bFirst ) +/*N*/ { +/*N*/ const sal_Int32 coDiff = 52; // 'A'-'Z' 'a' - 'z' +/*N*/ register sal_Int32 nCalc, nCol = aIter->mnColumn; +/*N*/ +/*N*/ do { +/*N*/ nCalc = nCol % coDiff; +/*N*/ if( nCalc >= 26 ) +/*N*/ sNm.Insert( sal_Unicode('a' - 26 + nCalc ), 0 ); +/*N*/ else +/*N*/ sNm.Insert( sal_Unicode('A' + nCalc ), 0 ); +/*N*/ +/*N*/ if( !(nCol -= nCalc) ) +/*N*/ break; +/*N*/ nCol /= coDiff; +/*N*/ --nCol; +/*N*/ } while( 1 ); +/*N*/ bFirst = FALSE; +/*N*/ } +/*N*/ else +/*N*/ sNm.Insert( '.', 0 ).Insert( +/*N*/ String::CreateFromInt32( aIter->mnColumn ), 0 ); +/*N*/ } +/*N*/ return sNm; +/*N*/ } + + +/// convert SomeData string(s) to SchChartRange and vice versa for Writer +/*N*/ bool SchMemChart::ConvertChartRangeForWriter( BOOL bOldToNew ) +/*N*/ { +/*N*/ if( bOldToNew ) // convert SomeData1 to SchChartRange +/*N*/ { +/*N*/ SchChartRange aRange; +/*N*/ if( 2 < aSomeData1.Len() ) +/*N*/ { +/*N*/ // spitze Klammern am Anfang & Ende enfernen +/*N*/ String sBox( aSomeData1 ); +/*N*/ if( '<' == sBox.GetChar( 0 ) ) sBox.Erase( 0, 1 ); +/*N*/ if( '>' == sBox.GetChar( sBox.Len()-1 ) ) sBox.Erase( sBox.Len()-1 ); +/*N*/ +/*N*/ xub_StrLen nTrenner = sBox.Search( ':' ); + if( STRING_NOTFOUND == nTrenner ) + return false; + +/*N*/ // DBG_ASSERT( STRING_NOTFOUND != nTrenner, "no valid selection" ); +/*N*/ +/*N*/ SchCellRangeAddress aCRA; +/*N*/ ::binfilter::lcl_GetWriterTblBox( sBox.Copy( 0, nTrenner ), aCRA.maUpperLeft ); +/*N*/ ::binfilter::lcl_GetWriterTblBox( sBox.Copy( nTrenner+1 ), aCRA.maLowerRight ); +/*N*/ aRange.maRanges.push_back( aCRA ); +/*N*/ } +/*N*/ if( aSomeData2.Len() ) +/*N*/ { +/*N*/ aRange.mbFirstRowContainsLabels = '1' == aSomeData2.GetChar(0); +/*N*/ aRange.mbFirstColumnContainsLabels = '1' == aSomeData2.GetChar(1); +/*N*/ } +/*N*/ SetChartRange( aRange ); +/*N*/ } +/*N*/ else // convert SchChartRange to SomeData1 +/*N*/ { +/*N*/ String sData1, sData2; +/*N*/ const SchChartRange& rRg = GetChartRange(); +/*N*/ if( rRg.maRanges.size() ) +/*N*/ { +/*N*/ ::std::vector< SchCellRangeAddress >::const_iterator +/*N*/ aIter = rRg.maRanges.begin(); +/*N*/ sData1.Assign( '<' ) +/*N*/ .Append( ::binfilter::lcl_GetWriterBoxName( aIter->maUpperLeft )) +/*N*/ .Append( ':' ) +/*N*/ .Append( ::binfilter::lcl_GetWriterBoxName( aIter->maLowerRight )) +/*N*/ .Append( '>' ); +/*N*/ +/*N*/ sData2.Assign( rRg.mbFirstRowContainsLabels ? '1' : '0' ) +/*N*/ .Append( rRg.mbFirstColumnContainsLabels ? '1' : '0' ); +/*N*/ } +/*N*/ aSomeData1 = sData1; +/*N*/ aSomeData2 = sData2; +/*N*/ } + return true; +/*N*/ } + +/// convert SomeData string(s) to SchChartRange and vice versa for Calc +/*N*/ bool SchMemChart::ConvertChartRangeForCalc( BOOL bOldToNew ) +/*N*/ { +/*N*/ if( bOldToNew ) +/*N*/ { // convert SomeData1/2/3 to SchChartRange + if( ! SomeData1().Len() || ! SomeData2().Len() || ! SomeData3().Len()) + return false; +/*N*/ // DBG_ASSERT( SomeData1().Len() && SomeData2().Len() && SomeData3().Len(), +/*N*/ // "ConvertChartRangeForCalc: can't convert old to new" ); +/*N*/ SchChartRange aChartRange; +/*N*/ const sal_Unicode cTok = ';'; +/*N*/ xub_StrLen nToken; +/*N*/ String aPos = SomeData1(); +/*N*/ if ( (nToken = aPos.GetTokenCount( cTok )) >= 5) +/*N*/ { +/*N*/ aChartRange.mbKeepCopyOfData = sal_False; +/*N*/ String aOpt = SomeData2(); +/*N*/ xub_StrLen nOptToken = aOpt.GetTokenCount( cTok ); +/*N*/ BOOL bNewChart = (nOptToken >= 4); // as of 341/342 +/*N*/ DBG_ASSERT( SomeData3().Len(), "ConvertChartRangeForCalc: no sheet names" ); +/*N*/ String aSheetNames = SomeData3(); // as of 638m +/*N*/ USHORT nCol1, nRow1, nTab1, nCol2, nRow2, nTab2; +/*N*/ xub_StrLen nInd = 0; +/*N*/ xub_StrLen nSheetInd = 0; +/*N*/ for ( xub_StrLen j=0; j < nToken; j+=5 ) +/*N*/ { +/*N*/ xub_StrLen nInd2 = nInd; + // #i73906#, #144135# if table number is -1 avoid conversion to 65535 + { + sal_Int32 nTableNum = aPos.GetToken( 0, cTok, nInd ).ToInt32(); + nTab1 = (nTableNum<0 ? 0: static_cast< USHORT >( nTableNum )); + } +/*N*/ // To make old versions (<341/342) skip it, the token separator +/*N*/ // is a ',' +/*N*/ if ( bNewChart ) + { + // #i73906#, #144135# if table number is -1 avoid conversion to 65535 + sal_Int32 nTableNum = aPos.GetToken( 1, ',', nInd2 ).ToInt32(); + nTab2 = (nTableNum<0 ? 0: static_cast< USHORT >( nTableNum )); + } +/*N*/ else +/*N*/ nTab2 = nTab1; +/*N*/ nCol1 = (USHORT) aPos.GetToken( 0, cTok, nInd ).ToInt32(); +/*N*/ nRow1 = (USHORT) aPos.GetToken( 0, cTok, nInd ).ToInt32(); +/*N*/ nCol2 = (USHORT) aPos.GetToken( 0, cTok, nInd ).ToInt32(); +/*N*/ nRow2 = (USHORT) aPos.GetToken( 0, cTok, nInd ).ToInt32(); +/*N*/ for ( USHORT nTab = nTab1; nTab <= nTab2; ++nTab ) +/*N*/ { +/*N*/ SchCellRangeAddress aCellRangeAddress; +/*N*/ SchSingleCell aCell; +/*N*/ aCell.mnColumn = nCol1; +/*N*/ aCell.mnRow = nRow1; +/*N*/ aCellRangeAddress.maUpperLeft.maCells.push_back( aCell ); +/*N*/ aCell.mnColumn = nCol2; +/*N*/ aCell.mnRow = nRow2; +/*N*/ aCellRangeAddress.maLowerRight.maCells.push_back( aCell ); +/*N*/ aCellRangeAddress.mnTableNumber = nTab; +/*N*/ String aName( aSheetNames.GetToken( 0, cTok, nSheetInd ) ); +/*N*/ aCellRangeAddress.msTableName = aName; +/*N*/ aChartRange.maRanges.push_back( aCellRangeAddress ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ if ( aOpt.Len() >= 2 ) +/*N*/ { +/*N*/ aChartRange.mbFirstRowContainsLabels = ( aOpt.GetChar(0) != '0' ); +/*N*/ aChartRange.mbFirstColumnContainsLabels = ( aOpt.GetChar(1) != '0' ); + #if 0 + /* Calc internal data + if ( aOpt.Len() >= 3 ) + { + if ( bNewChart ) + { + bDummyUpperLeft = ( aOpt.GetChar(2) != '0' ); + xub_StrLen nInd = 4; // 111; + eGlue = (ScChartGlue) aOpt.GetToken( 0, cTok, nInd ).ToInt32(); + nStartCol = (USHORT) aOpt.GetToken( 0, cTok, nInd ).ToInt32(); + nStartRow = (USHORT) aOpt.GetToken( 0, cTok, nInd ).ToInt32(); + bInitOk = TRUE; + } + } + */ + #endif +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aChartRange.mbFirstColumnContainsLabels = sal_False; +/*N*/ aChartRange.mbFirstRowContainsLabels = sal_False; +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ aChartRange.mbFirstColumnContainsLabels = sal_False; +/*N*/ aChartRange.mbFirstRowContainsLabels = sal_False; +/*N*/ aChartRange.mbKeepCopyOfData = sal_True; +/*N*/ } +/*N*/ SetChartRange( aChartRange ); +/*N*/ } +/*N*/ else +/*N*/ { // convert SchChartRange to SomeData1/2/3 +/*N*/ const sal_Unicode cTok = ';'; +/*N*/ String aRef, aSheetNames; +/*N*/ const SchChartRange& rChartRange = GetChartRange(); +/*N*/ ::std::vector< SchCellRangeAddress >::const_iterator iRange = +/*N*/ rChartRange.maRanges.begin(); +/*N*/ DBG_ASSERT( iRange != rChartRange.maRanges.end(), +/*N*/ "ConvertChartRangeForCalc: no SchCellRangeAddress vector" ); +/*N*/ for ( ; iRange != rChartRange.maRanges.end(); ++iRange ) +/*N*/ { +/*N*/ const SchSingleCell& rAddr1 = iRange->maUpperLeft.maCells[0]; +/*N*/ const SchSingleCell& rAddr2 = iRange->maLowerRight.maCells[0]; +/*N*/ sal_Int32 nTab = iRange->mnTableNumber; + // #i73906#, #144135# do not export -1 as table number + if( nTab < 0 ) + nTab = 0; +/*N*/ if ( aRef.Len() ) +/*N*/ aRef += cTok; +/*N*/ aRef += String::CreateFromInt32( nTab ); +/*N*/ // here ',' as TokenSep so old versions (<341/342) will ignore it +/*N*/ aRef += ','; aRef += String::CreateFromInt32( nTab ); +/*N*/ aRef += cTok; aRef += String::CreateFromInt32( rAddr1.mnColumn ); +/*N*/ aRef += cTok; aRef += String::CreateFromInt32( rAddr1.mnRow ); +/*N*/ aRef += cTok; aRef += String::CreateFromInt32( rAddr2.mnColumn ); +/*N*/ aRef += cTok; aRef += String::CreateFromInt32( rAddr2.mnRow ); +/*N*/ if ( aSheetNames.Len() ) +/*N*/ aSheetNames += cTok; +/*N*/ aSheetNames += String( iRange->msTableName ); +/*N*/ } +/*N*/ +/*N*/ String aFlags = rChartRange.mbFirstRowContainsLabels ? '1' : '0'; +/*N*/ aFlags += rChartRange.mbFirstColumnContainsLabels ? '1' : '0'; + #if 0 + /* these can't be stored, automatically recalculated after load by old versions + aFlags += bDummyUpperLeft ? '1' : '0'; + aFlags += cTok; + aFlags += String::CreateFromInt32( eGlue ); + aFlags += cTok; + aFlags += String::CreateFromInt32( nStartCol ); + aFlags += cTok; + aFlags += String::CreateFromInt32( nStartRow ); + */ + #endif +/*N*/ +/*N*/ SomeData1() = aRef; +/*N*/ SomeData2() = aFlags; +/*N*/ SomeData3() = aSheetNames; +/*N*/ } + return true; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_objadj.cxx b/binfilter/bf_sch/source/core/sch_objadj.cxx new file mode 100644 index 000000000000..9a41ce72bf9b --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_objadj.cxx @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "objadj.hxx" +#include "glob.hxx" + +#include <tools/debug.hxx> + +namespace binfilter { + + + + +/************************************************************************* +|* +|* Objekt-Ausrichting ermitteln +|* +\************************************************************************/ + +/*N*/ SchObjectAdjust* GetObjectAdjust(const SdrObject& rObj) +/*N*/ { +/*N*/ for (USHORT i = 0; i < rObj.GetUserDataCount(); i++) +/*N*/ { +/*N*/ SdrObjUserData *pData = rObj.GetUserData(i); +/*N*/ if (pData && pData->GetId() == SCH_OBJECTADJUST_ID) +/*N*/ return (SchObjectAdjust*)pData; +/*N*/ } +/*N*/ +/*?*/ return NULL; +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchObjectAdjust::SchObjectAdjust() : +/*N*/ SdrObjUserData(SchInventor, SCH_OBJECTADJUST_ID, 1), +/*N*/ eAdjust(CHADJUST_TOP_LEFT), +/*N*/ eOrient(CHTXTORIENT_STANDARD) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchObjectAdjust::SchObjectAdjust(ChartAdjust eAdj, +/*N*/ SvxChartTextOrient eOr) : +/*N*/ SdrObjUserData(SchInventor, SCH_OBJECTADJUST_ID, 1), +/*N*/ eAdjust(eAdj), +/*N*/ eOrient(eOr) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Kopier-Konstruktor +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Kopie erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjUserData* SchObjectAdjust::Clone(SdrObject *pObj) const +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return new SchObjectAdjust(*this); +/*N*/ } + +/************************************************************************* +|* +|* Daten in Stream schreiben +|* +\************************************************************************/ + +/*N*/ void SchObjectAdjust::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ +/*N*/ rOut << (INT16)eAdjust; +/*N*/ rOut << (INT16)eOrient; +/*N*/ } + +/************************************************************************* +|* +|* Daten aus Stream lesen +|* +\************************************************************************/ + +/*N*/ void SchObjectAdjust::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ +/*N*/ INT16 nInt16; +/*N*/ +/*N*/ rIn >> nInt16; eAdjust = (ChartAdjust)nInt16; +/*N*/ +/*N*/ if (nVersion < 1) +/*?*/ eOrient = CHTXTORIENT_STANDARD; +/*N*/ else +/*N*/ { +/*N*/ rIn >> nInt16; eOrient = (SvxChartTextOrient)nInt16; +/*N*/ } +/*N*/ +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_objfac.cxx b/binfilter/bf_sch/source/core/sch_objfac.cxx new file mode 100644 index 000000000000..2bb345134537 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_objfac.cxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "axisid.hxx" +#include "schgroup.hxx" +#include "objfac.hxx" +#include "objid.hxx" +#include "objadj.hxx" +#include "datarow.hxx" +#include "datapoin.hxx" +#include "glob.hxx" +namespace binfilter { + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchObjFactory::SchObjFactory() : +/*N*/ bInserted(FALSE) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Chart-interne Objekte erzeugen +|* +\************************************************************************/ + +/*N*/ IMPL_LINK( SchObjFactory, MakeObject, SdrObjFactory*, pObjFactory) +/*N*/ { +/*N*/ if (pObjFactory->nInventor == SchInventor && +/*N*/ pObjFactory->nIdentifier == SCH_OBJGROUP_ID) +/*N*/ pObjFactory->pNewObj = new SchObjGroup; +/*N*/ +/*N*/ return 0; +/*N*/ } + +/************************************************************************* +|* +|* Chart-Userdata erzeugen +|* +\************************************************************************/ + +/*N*/ IMPL_LINK( SchObjFactory, MakeUserData, SdrObjFactory* ,pObjFactory) +/*N*/ { +/*N*/ if (pObjFactory->nInventor == SchInventor) +/*N*/ switch (pObjFactory->nIdentifier) +/*N*/ { +/*N*/ case SCH_OBJECTID_ID: +/*N*/ pObjFactory->pNewData = new SchObjectId; +/*N*/ break; +/*N*/ +/*N*/ case SCH_OBJECTADJUST_ID: +/*N*/ pObjFactory->pNewData = new SchObjectAdjust; +/*N*/ break; +/*N*/ +/*N*/ case SCH_DATAROW_ID: +/*N*/ pObjFactory->pNewData = new SchDataRow; +/*N*/ break; +/*N*/ +/*N*/ case SCH_DATAPOINT_ID: +/*N*/ pObjFactory->pNewData = new SchDataPoint; +/*N*/ break; +/*N*/ +/*N*/ case SCH_LIGHTFACTOR_ID: +/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pObjFactory->pNewData = new SchLightFactor; +/*?*/ DBG_ERROR("SCH_LIGHTFACTOR_ID no longer available"); +/*?*/ break; +/*N*/ +/*N*/ case SCH_AXIS_ID : +/*N*/ pObjFactory->pNewData = new SchAxisId; +/*N*/ break; +/*N*/ } +/*N*/ +/*N*/ return 0; +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_objid.cxx b/binfilter/bf_sch/source/core/sch_objid.cxx new file mode 100644 index 000000000000..64aeda9541b8 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_objid.cxx @@ -0,0 +1,237 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "objid.hxx" +#include "glob.hxx" + +#include "defines.hxx" + +#include <tools/debug.hxx> //STRIP001 +namespace binfilter { +/************************************************************************* +|* +|* Objekt-Id ermitteln; +|* Liefert -1, wenn das Objekt keine Id hat +|* +\************************************************************************/ + +/*N*/ SchObjectId* GetObjectId(const SdrObject& rObj) +/*N*/ { +/*N*/ for (USHORT i = 0; i < rObj.GetUserDataCount(); i++) +/*N*/ { +/*N*/ SdrObjUserData *pData = rObj.GetUserData(i); +/*N*/ if (pData && pData->GetId() == SCH_OBJECTID_ID) +/*N*/ return (SchObjectId*)pData; +/*N*/ } +/*N*/ +/*N*/ return NULL; +/*N*/ } + + +/************************************************************************* +|* +|* Objekt mit Id suchen; +|* liefert NULL, wenn kein Objekt gefunden wurde. +|* +\************************************************************************/ + +/*N*/ SdrObject* GetObjWithId(UINT16 nObjId, const SdrObjList& rObjList, +/*N*/ ULONG* pIndex, SdrIterMode eMode) +/*N*/ { +/*N*/ ULONG nIndex = 0; +/*N*/ +/*N*/ SdrObjListIter aIterator(rObjList, eMode); +/*N*/ while (aIterator.IsMore()) +/*N*/ { +/*N*/ SdrObject* pObj = aIterator.Next(); +/*N*/ SchObjectId* pObjId = GetObjectId(*pObj); +/*N*/ if (pObjId && pObjId->GetObjId() == nObjId) +/*N*/ { +/*N*/ if (pIndex) +/*?*/ *pIndex = nIndex; +/*N*/ return pObj; +/*N*/ } +/*N*/ +/*N*/ nIndex++; +/*N*/ } +/*N*/ +/*N*/ return NULL; +/*N*/ } + +/************************************************************************* +|* +|* Alle Objekt mit Id=nObjId Attributieren, +|* +\************************************************************************/ +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchObjectId::SchObjectId() : +/*N*/ SdrObjUserData(SchInventor, SCH_OBJECTID_ID, 0), +/*N*/ nObjId(0) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchObjectId::SchObjectId(UINT16 nId) : +/*N*/ SdrObjUserData(SchInventor, SCH_OBJECTID_ID, 0), +/*N*/ nObjId(nId) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Kopier-Konstruktor +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Kopie erzeugen +|* +\************************************************************************/ + +/*N*/ SdrObjUserData* SchObjectId::Clone(SdrObject *pObj) const +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return new SchObjectId(*this); +/*N*/ } + +/************************************************************************* +|* +|* Daten in Stream schreiben +|* +\************************************************************************/ + +/*N*/ void SchObjectId::WriteData(SvStream& rOut) +/*N*/ { +/*N*/ SdrObjUserData::WriteData(rOut); +/*N*/ +/*N*/ rOut << nObjId; +/*N*/ } + + +/************************************************************************* +|* +|* Daten aus Stream lesen +|* +\************************************************************************/ + +/*N*/ void SchObjectId::ReadData(SvStream& rIn) +/*N*/ { +/*N*/ SdrObjUserData::ReadData(rIn); +/*N*/ +/*N*/ rIn >> nObjId; +/*N*/ } + +/*N*/ #ifdef DBG_UTIL + +// this function is for debugging only +// therefore it is ok to use char* instead of UniString +/*N*/ char* GetCHOBJIDName( const long id ) +/*N*/ { +/*N*/ switch( id ) +/*N*/ { +/*?*/ case CHOBJID_ANY: return "CHOBJID_ANY"; +/*?*/ case CHOBJID_TEXT: return "CHOBJID_TEXT"; +/*?*/ case CHOBJID_AREA: return "CHOBJID_AREA"; +/*?*/ case CHOBJID_LINE: return "CHOBJID_LINE"; +/*?*/ case CHOBJID_DIAGRAM_AREA: return "CHOBJID_DIAGRAM_AREA"; +/*?*/ case CHOBJID_TITLE_MAIN: return "CHOBJID_TITLE_MAIN"; +/*?*/ case CHOBJID_TITLE_SUB: return "CHOBJID_TITLE_SUB"; +/*?*/ case CHOBJID_DIAGRAM: return "CHOBJID_DIAGRAM"; +/*?*/ case CHOBJID_DIAGRAM_WALL: return "CHOBJID_DIAGRAM_WALL"; +/*?*/ case CHOBJID_DIAGRAM_FLOOR: return "CHOBJID_DIAGRAM_FLOOR"; +/*?*/ case CHOBJID_DIAGRAM_TITLE_X_AXIS: return "CHOBJID_DIAGRAM_TITLE_X_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_TITLE_Y_AXIS: return "CHOBJID_DIAGRAM_TITLE_Y_AXIS"; +/*N*/ case CHOBJID_DIAGRAM_TITLE_Z_AXIS: return "CHOBJID_DIAGRAM_TITLE_Z_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_X_AXIS: return "CHOBJID_DIAGRAM_X_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_Y_AXIS: return "CHOBJID_DIAGRAM_Y_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_Z_AXIS: return "CHOBJID_DIAGRAM_Z_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_A_AXIS: return "CHOBJID_DIAGRAM_A_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_B_AXIS: return "CHOBJID_DIAGRAM_B_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_C_AXIS: return "CHOBJID_DIAGRAM_C_AXIS"; +/*?*/ case CHOBJID_DIAGRAM_X_GRID_MAIN: return "CHOBJID_DIAGRAM_X_GRID_MAIN"; +/*?*/ case CHOBJID_DIAGRAM_Y_GRID_MAIN: return "CHOBJID_DIAGRAM_Y_GRID_MAIN"; +/*?*/ case CHOBJID_DIAGRAM_Z_GRID_MAIN: return "CHOBJID_DIAGRAM_Z_GRID_MAIN"; +/*?*/ case CHOBJID_DIAGRAM_Y_GRID_HELP: return "CHOBJID_DIAGRAM_Y_GRID_HELP"; +/*?*/ case CHOBJID_DIAGRAM_Z_GRID_HELP: return "CHOBJID_DIAGRAM_Z_GRID_HELP"; +/*?*/ case CHOBJID_DIAGRAM_ROWGROUP: return "CHOBJID_DIAGRAM_ROWGROUP"; +/*?*/ case CHOBJID_DIAGRAM_ROWS: return "CHOBJID_DIAGRAM_ROWS"; +/*?*/ case CHOBJID_DIAGRAM_ROWSLINE: return "CHOBJID_DIAGRAM_ROWSLINE"; +/*?*/ case CHOBJID_DIAGRAM_DATA: return "CHOBJID_DIAGRAM_DATA"; +/*?*/ case CHOBJID_DIAGRAM_DESCRGROUP: return "CHOBJID_DIAGRAM_DESCRGROUP"; +/*?*/ case CHOBJID_DIAGRAM_DESCR_ROW: return "CHOBJID_DIAGRAM_DESCR_ROW"; +/*?*/ case CHOBJID_DIAGRAM_DESCR_COL: return "CHOBJID_DIAGRAM_DESCR_COL"; +/*?*/ case CHOBJID_DIAGRAM_DESCR_SYMBOL: return "CHOBJID_DIAGRAM_DESCR_SYMBOL"; +/*?*/ case CHOBJID_LEGEND: return "CHOBJID_LEGEND"; +/*?*/ case CHOBJID_LEGEND_BACK: return "CHOBJID_LEGEND_BACK"; +/*?*/ case CHOBJID_LEGEND_SYMBOL_ROW: return "CHOBJID_LEGEND_SYMBOL_ROW"; +/*?*/ case CHOBJID_LEGEND_SYMBOL_COL: return "CHOBJID_LEGEND_SYMBOL_COL"; +/*?*/ case CHOBJID_DIAGRAM_Z_AXIS_GROUP: return "CHOBJID_DIAGRAM_Z_AXIS_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_NET: return "CHOBJID_DIAGRAM_NET"; +/*?*/ case CHOBJID_DIAGRAM_AVERAGEVALUE: return "CHOBJID_DIAGRAM_AVERAGEVALUE"; +/*?*/ case CHOBJID_DIAGRAM_ERROR: return "CHOBJID_DIAGRAM_ERROR"; +/*?*/ case CHOBJID_DIAGRAM_REGRESSION: return "CHOBJID_DIAGRAM_REGRESSION"; +/*?*/ case CHOBJID_DIAGRAM_STACKEDGROUP: return "CHOBJID_DIAGRAM_STACKEDGROUP"; +/*?*/ case CHOBJID_DIAGRAM_STATISTICS_GROUP: return "CHOBJID_DIAGRAM_STATISTICS_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP: return "CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_Y_GRID_MAIN_GROUP: return "CHOBJID_DIAGRAM_Y_GRID_MAIN_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_Z_GRID_MAIN_GROUP: return "CHOBJID_DIAGRAM_Z_GRID_MAIN_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_X_GRID_HELP_GROUP: return "CHOBJID_DIAGRAM_X_GRID_HELP_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_Y_GRID_HELP_GROUP: return "CHOBJID_DIAGRAM_Y_GRID_HELP_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_Z_GRID_HELP_GROUP: return "CHOBJID_DIAGRAM_Z_GRID_HELP_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_SPECIAL_GROUP: return "CHOBJID_DIAGRAM_SPECIAL_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_STOCKLINE_GROUP: return "CHOBJID_DIAGRAM_STOCKLINE_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_STOCKLOSS_GROUP: return "CHOBJID_DIAGRAM_STOCKLOSS_GROUP"; +/*?*/ case CHOBJID_DIAGRAM_STOCKPLUS_GROUP: return "CHOBJID_DIAGRAM_STOCKPLUS_GROUP"; +/*?*/ +/*?*/ default: +/*?*/ return "unknown Id"; +/*N*/ } +/*N*/ } + +/*N*/ #endif // DBG_UTIL + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_schgroup.cxx b/binfilter/bf_sch/source/core/sch_schgroup.cxx new file mode 100644 index 000000000000..a5657f0999de --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_schgroup.cxx @@ -0,0 +1,235 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include "glob.hxx" +#include "schgroup.hxx" +#include <math.h> +namespace binfilter { + +/*N*/ TYPEINIT1(SchObjGroup, SdrObjGroup); + + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*N*/ SchObjGroup::SchObjGroup(ChartModel *pChmodel) : +/*N*/ SdrObjGroup(), +/*N*/ bAskForLogicRect(TRUE), +/*N*/ mbUseChartInventor( true ) +/*N*/ { +/*N*/ // FG: Damit soll es Objekten im chart ermoeglicht werden sich wie ein +/*N*/ // Objekt im Draw zu verhalten falls gewünscht. Nicht alles was +/*N*/ // prinzipiell geht soll man auch koennen. +/*N*/ aInfo.bResizeFreeAllowed = TRUE; +/*N*/ aInfo.bResizePropAllowed = TRUE; +/*N*/ aInfo.bRotateFreeAllowed = TRUE; +/*N*/ aInfo.bRotate90Allowed = TRUE; +/*N*/ aInfo.bMirrorFreeAllowed = FALSE; +/*N*/ aInfo.bMirror45Allowed = FALSE; +/*N*/ aInfo.bMirror90Allowed = FALSE; +/*N*/ aInfo.bShearAllowed = TRUE; +/*N*/ +/*N*/ eChartGroupType = NOTHING; +/*N*/ pChartmodel = pChmodel; +/*N*/ SetModel( pChartmodel ); +/*N*/ } + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +/*N*/ SchObjGroup::~SchObjGroup() +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Identifier zurueckgeben +|* +\************************************************************************/ + +/*N*/ UINT32 SchObjGroup::GetObjInventor() const +/*N*/ { +/*N*/ if( mbUseChartInventor ) +/*N*/ return SchInventor; +/*N*/ else +/*?*/ return SdrInventor; +/*N*/ } + +/************************************************************************* +|* +|* Identifier zurueckgeben +|* +\************************************************************************/ + +/*N*/ UINT16 SchObjGroup::GetObjIdentifier() const +/*N*/ { +/*N*/ return SCH_OBJGROUP_ID; +/*N*/ } + +/************************************************************************* +|* +|* Handle-Anzahl bestimmen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Handle erzeugen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Handle-Liste fuellen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Identifier zurueckgeben +|* +\************************************************************************/ + + + +/************************************************************************* +|* +|* Faehigkeiten der Chart-Gruppe feststellen +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Faehigkeiten der Chart-Gruppe zuweisen +|* +\************************************************************************/ + +/*N*/ void SchObjGroup::SetObjInfo(SdrObjTransformInfoRec aMyInfo) +/*N*/ { +/*N*/ // FG: Damit soll es Objekten im chart ermoeglicht werden sich wie ein +/*N*/ // Objekt im Draw zu verhalten falls gewünscht. +/*N*/ aInfo.bResizeFreeAllowed = aMyInfo.bResizeFreeAllowed; +/*N*/ aInfo.bResizePropAllowed = aMyInfo.bResizePropAllowed; +/*N*/ aInfo.bRotateFreeAllowed = aMyInfo.bRotateFreeAllowed; +/*N*/ aInfo.bRotate90Allowed = aMyInfo.bRotate90Allowed; +/*N*/ aInfo.bMirrorFreeAllowed = aMyInfo.bMirrorFreeAllowed; +/*N*/ aInfo.bMirror45Allowed = aMyInfo.bMirror45Allowed; +/*N*/ aInfo.bMirror90Allowed = aMyInfo.bMirror90Allowed; +/*N*/ aInfo.bShearAllowed = aMyInfo.bShearAllowed; +/*N*/ } + +/************************************************************************* +|* +|* Wirkliches Resize einer Chart-Gruppe (ohne Broadcast) +|* Bei manchen Chart-Gruppen ist eine Neuberechnung bei einem Resize +|* besser als ein hartes Resize. +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Um das Verhalten bei einem Resize in Abhaehngigkeit des selektierten +|* Objektes zu ernoeglichen. Bei Diagramme werden nicht die Teilobjekte +|* Resized sondern das Chart in den neuen Grenzen aufgebaut. +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Um mitzubekommen welche Objekte bewegt werden. Leider wird das +|* nicht nur vom Benutzer verursacht. +|* +\************************************************************************/ + +/*N*/ void SchObjGroup::Move(const Size& rSiz) +/*N*/ { +/*N*/ +/*N*/ if (eChartGroupType == DIAGRAM) +/*N*/ { +/*?*/ DBG_ASSERT( pChartmodel, "No Model" ); +/*?*/ if (pChartmodel != NULL) +/*?*/ { +/*?*/ Rectangle aRectChart = pChartmodel->GetChartRect(); +/*?*/ Rectangle aRect = GetBoundRect(); +/*?*/ Point aPointBottomLeftRectChart = aRectChart.BottomLeft(); +/*?*/ Point aPointBottomLeftBoundRect = aRect.BottomLeft(); +/*?*/ Point aPointTopRightRectChart = aRectChart.TopRight(); +/*?*/ Point aPointTopRightBoundRect = aRect.TopRight(); +/*?*/ Point aDifferenceLeftBottom = aPointBottomLeftRectChart - aPointBottomLeftBoundRect; +/*?*/ Point aDifferenceTopRight = aPointTopRightRectChart - aPointTopRightBoundRect; +/*?*/ aRect.Left() += rSiz.Width(); +/*?*/ aRect.Right() += rSiz.Width(); +/*?*/ aRect.Top() += rSiz.Height(); +/*?*/ aRect.Bottom() += rSiz.Height(); +/*?*/ bAskForLogicRect = FALSE; +/*?*/ aRect.Left() += aDifferenceLeftBottom.X(); +/*?*/ aRect.Bottom() += aDifferenceLeftBottom.Y(); +/*?*/ aRect.Right() += aDifferenceTopRight.X(); +/*?*/ aRect.Top() += aDifferenceTopRight.Y(); +/*?*/ pChartmodel->SetDiagramRectangle(aRect); +/*?*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ SdrObjGroup::Move(rSiz); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* Um mitzubekommen welche Objekte bewegt werden. Leider wird das +|* nicht nur vom Benutzer verursacht. +|* +\************************************************************************/ + + +/*N*/ void SchObjGroup::SetUseChartInventor( bool bUseChartInventor ) +/*N*/ { +/*N*/ mbUseChartInventor = bUseChartInventor; +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_schiocmp.cxx b/binfilter/bf_sch/source/core/sch_schiocmp.cxx new file mode 100644 index 000000000000..df97d183bb77 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_schiocmp.cxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <tools/debug.hxx> +#include "schiocmp.hxx" +namespace binfilter { + + +// CTOR: writes/reads version number + +/*N*/ SchIOCompat::SchIOCompat( SvStream& rNewStream, USHORT nNewMode, +/*N*/ UINT16 nVer ) : +/*N*/ SdrDownCompat( rNewStream, nNewMode, TRUE ), +/*N*/ nVersion( nVer ) +/*N*/ { +/*N*/ switch( nNewMode ) +/*N*/ { +/*N*/ case STREAM_WRITE: +/*N*/ DBG_ASSERT( nVer != SCHIOCOMPAT_VERSIONDONTKNOW, +/*N*/ "Requesting writing of unknown File Version" ); +/*N*/ rNewStream << nVersion; +/*N*/ break; +/*N*/ +/*N*/ case STREAM_READ: +/*N*/ DBG_ASSERT( nVer == SCHIOCOMPAT_VERSIONDONTKNOW, +/*N*/ "Requesting reading of unknown File Version" ); +/*N*/ rNewStream >> nVersion; +/*N*/ break; +/*N*/ } +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_stlpool.cxx b/binfilter/bf_sch/source/core/sch_stlpool.cxx new file mode 100644 index 000000000000..20e0da508a68 --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_stlpool.cxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include "stlpool.hxx" +#include "stlsheet.hxx" +namespace binfilter { + + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +/*N*/ SchStyleSheetPool::SchStyleSheetPool(SfxItemPool& rPool) : +/*N*/ SfxStyleSheetPool(rPool), +/*N*/ pActualStyleSheet(NULL) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +/*N*/ SchStyleSheetPool::~SchStyleSheetPool() +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Vorlage erzeugen +|* +\************************************************************************/ + +/*N*/ SfxStyleSheetBase* SchStyleSheetPool::Create(const String& rName, +/*N*/ SfxStyleFamily eFamily, +/*N*/ USHORT nMask ) +/*N*/ { +/*N*/ return new SchStyleSheet(rName, *this, eFamily, nMask); +/*N*/ } + + +/************************************************************************* +|* +|* Vorlage nach Vorbild erzeugen +|* +\************************************************************************/ + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/core/sch_stlsheet.cxx b/binfilter/bf_sch/source/core/sch_stlsheet.cxx new file mode 100644 index 000000000000..c7697b3c968e --- /dev/null +++ b/binfilter/bf_sch/source/core/sch_stlsheet.cxx @@ -0,0 +1,163 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svx/eeitem.hxx> + +#include <bf_svx/xdef.hxx> + + +#include <bf_svtools/itemset.hxx> + +#include <bf_svtools/smplhint.hxx> + +#include "stlsheet.hxx" +namespace binfilter { + +/*N*/ TYPEINIT1(SchStyleSheet, SfxStyleSheet); + + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +/*N*/ SchStyleSheet::SchStyleSheet(const String& rName, SfxStyleSheetBasePool& rPool, +/*N*/ SfxStyleFamily eFamily, USHORT nMask) : +/*N*/ SfxStyleSheet(rName, rPool, eFamily, nMask) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +/*N*/ SchStyleSheet::~SchStyleSheet() +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Load +|* +\************************************************************************/ + +/*N*/ void SchStyleSheet::Load (SvStream& rIn, USHORT nVersion) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Store +|* +\************************************************************************/ + +/*N*/ void SchStyleSheet::Store(SvStream& rOut) +/*N*/ { +/*N*/ } + +/************************************************************************* +|* +|* Parent setzen +|* +\************************************************************************/ + +/*N*/ BOOL SchStyleSheet::SetParent(const String& rParentName) +/*N*/ { +/*N*/ if (SfxStyleSheet::SetParent(rParentName)) +/*N*/ { +/*N*/ SfxStyleSheetBase* pStyle = rPool.Find(rParentName, nFamily); +/*N*/ +/*N*/ if (pStyle) +/*N*/ { +/*?*/ SfxItemSet& rParentSet = pStyle->GetItemSet(); +/*?*/ GetItemSet().SetParent(&rParentSet); +/*?*/ Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); +/*?*/ +/*?*/ return TRUE; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +/************************************************************************* +|* +|* ItemSet ggfs. erzeugen und herausreichen +|* +\************************************************************************/ + +/*N*/ SfxItemSet& SchStyleSheet::GetItemSet() +/*N*/ { +/*N*/ if (!pSet) +/*N*/ { +/*N*/ USHORT nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, +/*N*/ XATTR_FILL_FIRST, XATTR_FILL_LAST, +/*N*/ EE_PARA_START, EE_CHAR_END, +/*N*/ (USHORT)0 }; +/*N*/ +/*N*/ pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable); +/*N*/ bMySet = TRUE; //Eigentum erklaeren, damit der DTor der Basisklasse den +/*N*/ //Set wieder abraeumt. +/*N*/ } +/*N*/ +/*N*/ return *pSet; +/*N*/ } + +/************************************************************************* +|* +|* IsUsed(), wird an Listeners erkannt +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/filter/xml/makefile.mk b/binfilter/bf_sch/source/filter/xml/makefile.mk new file mode 100644 index 000000000000..6c5c3de09698 --- /dev/null +++ b/binfilter/bf_sch/source/filter/xml/makefile.mk @@ -0,0 +1,45 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ = ..$/..$/..$/.. +BFPRJ = ..$/..$/.. +PRJNAME = binfilter +TARGET = sch_xml +ENABLE_EXCEPTIONS = TRUE + +# --- Settings ----------------------------------------------------- +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sch +# --- Files -------------------------------------------------------- + +SLOFILES = $(SLO)$/sch_SchXMLWrapper.obj + +# --- Targets -------------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sch/source/filter/xml/sch_SchXMLWrapper.cxx b/binfilter/bf_sch/source/filter/xml/sch_SchXMLWrapper.cxx new file mode 100644 index 000000000000..04c97f2f77e9 --- /dev/null +++ b/binfilter/bf_sch/source/filter/xml/sch_SchXMLWrapper.cxx @@ -0,0 +1,270 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/task/XStatusIndicatorSupplier.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XExporter.hpp> + +#include <bf_sfx2/docfile.hxx> +#include <bf_svtools/sfxecode.hxx> + +#include "SchXMLWrapper.hxx" + +#include <unotools/streamwrap.hxx> +#include <bf_svx/xmlgrhlp.hxx> +#include <tools/debug.hxx> + +#include <comphelper/genericpropertyset.hxx> + +#include <bf_svtools/saveopt.hxx> + +#include <com/sun/star/xml/sax/XParser.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/packages/zip/ZipIOException.hpp> + +#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002 +namespace binfilter { + +#define XML_STRING(i, x) sal_Char __READONLY_DATA i[sizeof(x)] = x +#define MAP_LEN(x) x, sizeof(x) - 1 + +XML_STRING( sXML_metaStreamName, "meta.xml"); +XML_STRING( sXML_styleStreamName, "styles.xml" ); +XML_STRING( sXML_contentStreamName, "content.xml" ); +XML_STRING( sXML_oldContentStreamName, "Content.xml" ); + +XML_STRING( sXML_export_chart_meta_service, "com.sun.star.comp.Chart.XMLMetaExporter" ); +XML_STRING( sXML_export_chart_styles_service, "com.sun.star.comp.Chart.XMLStylesExporter" ); +XML_STRING( sXML_export_chart_content_service, "com.sun.star.comp.Chart.XMLContentExporter" ); +XML_STRING( sXML_export_chart_old_content_service, "com.sun.star.office.sax.exporter.Chart" ); + +XML_STRING( sXML_import_chart_meta_service, "com.sun.star.comp.Chart.XMLMetaImporter" ); +XML_STRING( sXML_import_chart_styles_service, "com.sun.star.comp.Chart.XMLStylesImporter" ); +XML_STRING( sXML_import_chart_content_service, "com.sun.star.comp.Chart.XMLContentImporter" ); +XML_STRING( sXML_import_chart_old_content_service, "com.sun.star.office.sax.importer.Chart" ); + +using namespace ::com::sun::star; +using namespace ::rtl; +using namespace comphelper; + +/*N*/ SchXMLWrapper::SchXMLWrapper( uno::Reference< frame::XModel >& xModel, +/*N*/ SvStorage& rStorage, +/*N*/ sal_Bool bShowProgress ) : +/*N*/ mxModel( xModel ), +/*N*/ mrStorage( rStorage ), +/*N*/ mbShowProgress( bShowProgress ) +/*N*/ {} + +// ----------------------------------------------------------------------------- + +/*N*/ sal_Bool SchXMLWrapper::ExportStream( +/*N*/ const ::rtl::OUString& rsStreamName, +/*N*/ const ::rtl::OUString& rsServiceName, +/*N*/ uno::Reference< io::XActiveDataSource >& xDataSource, +/*N*/ uno::Reference< lang::XMultiServiceFactory>& xServiceFactory, +/*N*/ uno::Sequence< uno::Any >& aArgs ) +/*N*/ { +/*N*/ sal_Bool bRet = sal_False; +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ // create output stream +/*N*/ SvStorageStreamRef rOutputStream( mrStorage.OpenStream( +/*N*/ String( rsStreamName ), STREAM_WRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC )); +/*N*/ +/*N*/ ::rtl::OUString sMIMEType( RTL_CONSTASCII_USTRINGPARAM( "text/xml" ) ); +/*N*/ uno::Any aAny; +/*N*/ aAny <<= sMIMEType; +/*N*/ rOutputStream->SetProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" )), aAny ); +/*N*/ +/*N*/ // "Encrypted" means "Encryptable". Has to be set for all but the meta stream (which doesn't exist in charts) +/*N*/ aAny <<= (sal_Bool)(sal_True); +/*N*/ rOutputStream->SetProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Encrypted" )), aAny ); +/*N*/ +/*N*/ rOutputStream->SetBufferSize( 0x4000 ); // 16*1024 +/*N*/ +/*N*/ if( xDataSource.is()) +/*N*/ xDataSource->setOutputStream( new ::utl::OOutputStreamWrapper( *rOutputStream )); +/*N*/ +/*N*/ uno::Reference< document::XFilter > xFilter( +/*N*/ xServiceFactory->createInstanceWithArguments( rsServiceName, aArgs ), +/*N*/ uno::UNO_QUERY ); +/*N*/ +/*N*/ if( xFilter.is()) +/*N*/ { +/*N*/ uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY ); +/*N*/ if( xExporter.is()) +/*N*/ { +/*N*/ uno::Reference< lang::XComponent > xModelComponent( mxModel, uno::UNO_QUERY ); +/*N*/ xExporter->setSourceDocument( xModelComponent ); +/*N*/ } +/*N*/ +/*N*/ // empty Descriptior (formerly FileName was given) +/*N*/ uno::Sequence< beans::PropertyValue > aEmptyDescriptor( 0 ); +/*N*/ bRet = xFilter->filter( aEmptyDescriptor ); +/*N*/ +/*N*/ if( bRet && rOutputStream.Is()) +/*N*/ rOutputStream->Commit(); +/*N*/ } +/*N*/ } +/*N*/ catch( uno::Exception aEx ) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ // convert ::rtl::OUString => tools String => ByteString +/*?*/ String aStr( aEx.Message ); +/*?*/ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); +/*?*/ ByteString aBStrStreamName = ByteString( String( rsStreamName ), RTL_TEXTENCODING_ASCII_US ); +/*?*/ DBG_ERROR2( "Exception caught during Export of \"%s\" stream(): %s", +/*?*/ aBStrStreamName.GetBuffer(), +/*?*/ aBStr.GetBuffer()); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } + +/*N*/ sal_Bool SchXMLWrapper::Export() +/*N*/ { +/*N*/ sal_Bool bRet = sal_False; +/*N*/ +/*N*/ try +/*N*/ { +/*N*/ if( !mxModel.is() ) +/*N*/ { +/*N*/ DBG_ERROR("Got NO Model in XMLExport"); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel, uno::UNO_QUERY ); +/*N*/ +/*N*/ if( ! xServiceInfo.is() || !xServiceInfo->supportsService( +/*N*/ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartDocument" ) ) ) ) +/*N*/ { +/*N*/ DBG_ERROR( "Model is no ChartDocument in XMLExport" ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::legacy_binfilters::getLegacyProcessServiceFactory() ); +/*N*/ +/*N*/ if( !xServiceFactory.is() ) +/*N*/ { +/*N*/ DBG_ERROR( "got no service manager" ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ +/*N*/ uno::Reference< uno::XInterface > xWriter( xServiceFactory->createInstance( +/*N*/ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) ); +/*N*/ +/*N*/ if( !xWriter.is() ) +/*N*/ { +/*N*/ DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" ); +/*N*/ return sal_False; +/*N*/ } +/*N*/ uno::Reference<xml::sax::XDocumentHandler > xHandler( xWriter, uno::UNO_QUERY ); +/*N*/ uno::Sequence< beans::PropertyValue > aEmptyDescriptor( 0 ); +/*N*/ +/*N*/ +/*N*/ /** property map for export info set */ +/*N*/ PropertyMapEntry aExportInfoMap[] = +/*N*/ { +/*N*/ { MAP_LEN( "UsePrettyPrinting"),0, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0}, +/*N*/ { NULL, 0, 0, NULL, 0, 0 } +/*N*/ }; +/*N*/ +/*N*/ uno::Reference< beans::XPropertySet > xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aExportInfoMap ) ) ); +/*N*/ +/*N*/ SvtSaveOptions aSaveOpt; +/*N*/ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")); +/*N*/ sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() ); +/*N*/ xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny( bUsePrettyPrinting ) ); +/*N*/ +/*N*/ +/*N*/ SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create( mrStorage, GRAPHICHELPER_MODE_WRITE, sal_False ); +/*N*/ uno::Reference< document::XGraphicObjectResolver > xGraphObjResolver( pGraphicHelper ); +/*N*/ uno::Reference< io::XActiveDataSource > xDataSource( xWriter, uno::UNO_QUERY ); +/*N*/ +/*N*/ // there is no meta info needed in charts - they are always OLE objects +/*N*/ // export meta +/*N*/ // uno::Sequence< uno::Any > aMetaArgs( 1 ); +/*N*/ // aMetaArgs[ 0 ] <<= xHandler; +/*N*/ // bRet = ExportStream( +/*N*/ // ::rtl::OUString::createFromAscii( sXML_metaStreamName ), +/*N*/ // ::rtl::OUString::createFromAscii( sXML_export_chart_meta_service ), +/*N*/ // xDataSource, xServiceFactory, aMetaArgs ); +/*N*/ +/*N*/ // prepare arguments: document handler / status indicator and graphics resolver +/*N*/ sal_Int32 nArgs = 2; +/*N*/ if( mxStatusIndicator.is()) +/*N*/ nArgs++; +/*N*/ if( xGraphObjResolver.is()) +/*N*/ nArgs++; +/*N*/ +/*N*/ uno::Sequence< uno::Any > aArgs( nArgs ); +/*N*/ +/*N*/ nArgs = 0; +/*N*/ aArgs[ nArgs++ ] <<= xHandler; +/*N*/ aArgs[ nArgs++ ] <<= xInfoSet; +/*N*/ +/*N*/ if( mxStatusIndicator.is()) +/*?*/ aArgs[ nArgs++ ] <<= mxStatusIndicator; +/*N*/ if( xGraphObjResolver.is()) +/*N*/ aArgs[ nArgs++ ] <<= xGraphObjResolver; +/*N*/ +/*N*/ // styles export +/*N*/ bRet = ExportStream( +/*N*/ ::rtl::OUString::createFromAscii( sXML_styleStreamName ), +/*N*/ ::rtl::OUString::createFromAscii( sXML_export_chart_styles_service ), +/*N*/ xDataSource, xServiceFactory, aArgs ); +/*N*/ +/*N*/ // content export +/*N*/ bRet = ExportStream( +/*N*/ ::rtl::OUString::createFromAscii( sXML_contentStreamName ), +/*N*/ ::rtl::OUString::createFromAscii( sXML_export_chart_content_service ), +/*N*/ xDataSource, xServiceFactory, aArgs ); +/*N*/ +/*N*/ // graphics resolver has to be destroyed this way! +/*N*/ SvXMLGraphicHelper::Destroy( pGraphicHelper ); +/*N*/ } +/*N*/ catch( uno::Exception aEx ) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*?*/ // convert ::rtl::OUString => tools String => ByteString +/*?*/ String aStr( aEx.Message ); +/*?*/ ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); +/*?*/ DBG_ERROR1( "Exception caught during Export of : %s", aBStr.GetBuffer()); +/*N*/ #endif +/*N*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/makefile.mk b/binfilter/bf_sch/source/makefile.mk new file mode 100644 index 000000000000..f063a3086775 --- /dev/null +++ b/binfilter/bf_sch/source/makefile.mk @@ -0,0 +1,69 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/.. +BFPRJ=.. + +PROJECTPCH=sch +PROJECTPCHSOURCE=$(BFPRJ)$/util\sch_sch + +PRJNAME=binfilter +TARGET=sch + +#GEN_HID=TRUE +#GEN_HID_OTHER=TRUE +NO_HIDS=TRUE + +LIBTARGET=NO + +# --- Settings ----------------------------------------------------- +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sch +.IF "$(GUI)$(COM)" == "WINMSC" +LIBFLAGS+=/PAGE:128 +.ENDIF + + +# --- Files -------------------------------------------------------- + +# --- ui Lib + +LIB1TARGET= $(SLB)$/ui.lib +LIB1FILES= \ + $(SLB)$/app.lib \ + $(SLB)$/dlg.lib \ + $(SLB)$/docshell.lib \ + $(SLB)$/func.lib \ + $(SLB)$/view.lib \ + $(SLB)$/chxchart.lib + + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk diff --git a/binfilter/bf_sch/source/ui/app/makefile.mk b/binfilter/bf_sch/source/ui/app/makefile.mk new file mode 100644 index 000000000000..7838be06e489 --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/makefile.mk @@ -0,0 +1,92 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PROJECTPCH=sch +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sch_sch + +PRJNAME=binfilter +TARGET=sch_app + +NO_HIDS=TRUE + +BMP_OUT=$(RES) +BMP_IN =$(BFPRJ)$/res + +# --- Settings ----------------------------------------------------- +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sch +# --- Files -------------------------------------------------------- + +#IMGLST_SRS=$(SRS)$/app.srs + +SRS1NAME=$(TARGET) +SRC1FILES = sch_app.src \ + sch_strings.src + +DEPOBJFILES = \ + $(SLO)$/sch_schlib.obj + +SLOFILES = \ + $(SLO)$/sch_schdll.obj \ + $(SLO)$/sch_schmod.obj \ + $(SLO)$/sch_schresid.obj \ + $(SLO)$/sch_schopt.obj \ + $(SLO)$/sch_globopt.obj + +LIB2TARGET = $(SLB)$/bf_ysch.lib +LIB2ARCHIV = $(LB)$/libbf_ysch.a +LIB2OBJFILES = $(SLO)$/sch_schlib.obj + + +.IF "$(GUI)" == "WNT" +NOOPTFILES=\ + $(SLO)$/sch_schdll.obj +.ENDIF + + + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +$(INCCOM)$/schlib.hxx: makefile.mk +.IF "$(GUI)"=="UNX" + $(RM) $@ + echo \#define DLL_NAME \"libbf_sch$(DLLPOSTFIX)$(DLLPOST)\" >$@ +.ELSE + echo $(EMQ)#define DLL_NAME $(EMQ)"bf_sch$(DLLPOSTFIX)$(DLLPOST)$(EMQ)" >$@ +.ENDIF + +$(SRS)$/sch_app.srs: $(PRJ)$/inc$/bf_svx$/globlmn.hrc + +$(SLO)$/sch_schlib.obj : $(INCCOM)$/schlib.hxx + + diff --git a/binfilter/bf_sch/source/ui/app/sch_app.src b/binfilter/bf_sch/source/ui/app/sch_app.src new file mode 100644 index 000000000000..6dc18b84f299 --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_app.src @@ -0,0 +1,227 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + + +/* StarView ressource file */ + +#include <bf_svx/globlmn.hrc> +#include "app.hrc" +#include "res_bmp.hrc" +#include "bf_svx/dialogs.hrc" +#include "schhids.h" + +#define IMAGE_STDBTN_COLOR Color { Red = 0xff00; Green = 0x0000; Blue = 0xff00; } +#define IMAGE_HCBTN_COLOR IMAGE_STDBTN_COLOR + +#define IMAGE_ID_LIST \ + IdList = { \ + SID_NEWDOCDIRECT; \ + SID_OPENDOC; \ + SID_PRINTDOCDIRECT; \ + SID_SAVEDOC; \ + SID_CUT; \ + SID_COPY; \ + SID_PASTE; \ + SID_UNDO; \ + SID_REDO; \ + SID_TOGGLE_TITLE; \ + SID_TOGGLE_LEGEND; \ + SID_TOGGLE_AXIS_TITLE; \ + SID_TOGGLE_AXIS_DESCR; \ + SID_TOGGLE_GRID_HORZ; \ + SID_TOGGLE_GRID_VERT; \ + SID_DIAGRAM_TYPE; \ + SID_AUTOFORMAT; \ + SID_DIAGRAM_DATA; \ + SID_DATA_IN_ROWS; \ + SID_DATA_IN_COLUMNS; \ + SID_SCALE_TEXT; \ + SID_EXTENDEDHELP; \ + SID_WIN_FULLSCREEN;\ + SID_NEW_ARRANGEMENT;\ + SID_ATTR_TRANSFORM;\ + }; \ + IdCount = { \ + 25; \ + }; + + + + +String RID_DRAW_TOOLBOX +{ + Text [ de ] = "Werkzeugleiste" ; + Text [ en-US ] = "Main Toolbar" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Barra de ferramentas"; + Text[ ru ] = "Ð“Ð»Ð°Ð²Ð½Ð°Ñ Ð¿Ð°Ð½ÐµÐ»ÑŒ инÑтрументов"; + Text[ el ] = "ΓÏαμμή εÏγαλείων"; + Text[ nl ] = "Werktuigbalk"; + Text[ fr ] = "Barre d'instruments"; + Text[ es ] = "Barra de herramientas"; + Text[ fi ] = "Päätyökalurivi"; + Text[ ca ] = "Barra d'eines principal"; + Text[ it ] = "Barra degli strumenti"; + Text[ da ] = "Værktøjslinje"; + Text[ sv ] = "Verktygslist"; + Text[ pl ] = "Główny pasek narzÄ™dzi"; + Text[ pt-BR ] = "Barra de Ferramentas Principal"; + Text[ th ] = "à¹à¸–บเครื่à¸à¸‡à¸¡à¸·à¸à¸«à¸¥à¸±à¸"; + Text[ ja ] = "標準ツールãƒãƒ¼"; + Text[ ko ] = "주 ë„구 모ìŒ"; + Text[ zh-CN ] = "主工具æ "; + Text[ zh-TW ] = "主工具列"; + Text[ tr ] = "Ana araç çubuÄŸu"; + Text[ hi-IN ] = "पà¥à¤°à¤§à¤¾à¤¨ औज़ार पटà¥à¤Ÿà¥€"; + Text[ ar ] = "شريط الأدوات"; + Text[ he ] = "‮סרגל ר×שי‬"; +}; + +ToolBox RID_DRAW_TOOLBOX +{ + HelpId = RID_DRAW_TOOLBOX ; + Customize = TRUE ; + LineSpacing = TRUE ; + Dockable = TRUE ; + Moveable = TRUE ; + Sizeable = TRUE ; + Closeable = TRUE ; + Zoomable = TRUE ; + Scroll = TRUE ; + HideWhenDeactivate = TRUE ; + Border = TRUE ; + SVLook = TRUE ; + Align = BOXALIGN_LEFT ; + Size = MAP_APPFONT ( 0 , 0 ) ; + MenuStrings = TRUE ; + ItemList = + { + ToolBoxItem + { + Identifier = SID_TOGGLE_TITLE ; + HelpID = SID_TOGGLE_TITLE ; + }; + ToolBoxItem + { + Identifier = SID_TOGGLE_LEGEND ; + HelpID = SID_TOGGLE_LEGEND ; + }; + ToolBoxItem + { + Identifier = SID_TOGGLE_AXIS_TITLE ; + HelpID = SID_TOGGLE_AXIS_TITLE ; + }; + ToolBoxItem + { + Identifier = SID_TOGGLE_AXIS_DESCR ; + HelpID = SID_TOGGLE_AXIS_DESCR ; + }; + ToolBoxItem + { + Identifier = SID_TOGGLE_GRID_HORZ ; + HelpID = SID_TOGGLE_GRID_HORZ ; + }; + ToolBoxItem + { + Identifier = SID_TOGGLE_GRID_VERT ; + HelpID = SID_TOGGLE_GRID_VERT ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_DIAGRAM_TYPE ; + HelpID = SID_DIAGRAM_TYPE ; + }; + ToolBoxItem + { + Identifier = SID_AUTOFORMAT ; + HelpID = HID_SCH_CHART_AUTO_FORMAT ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_DIAGRAM_DATA ; + HelpID = SID_DIAGRAM_DATA ; + }; + ToolBoxItem + { + Identifier = SID_DATA_IN_ROWS ; + HelpID = SID_DATA_IN_ROWS ; + }; + ToolBoxItem + { + Identifier = SID_DATA_IN_COLUMNS ; + HelpID = SID_DATA_IN_COLUMNS ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_SCALE_TEXT ; + HelpID = SID_SCALE_TEXT ; + }; + ToolBoxItem + { + Identifier = SID_NEW_ARRANGEMENT ; + HelpID = SID_NEW_ARRANGEMENT ; + }; + }; +}; + + +// *** Popup-Menus *** + +#include "sch_menuids.src" + + + + + + + +#undef IS_DEFAULT +#include "sch_menu.src" + + + + + + + + + + + diff --git a/binfilter/bf_sch/source/ui/app/sch_globopt.cxx b/binfilter/bf_sch/source/ui/app/sch_globopt.cxx new file mode 100644 index 000000000000..b28dc53e8d4f --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_globopt.cxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "globopt.hxx" + +#include <stdio.h> + +#include <bf_svtools/syslocale.hxx> +#include <unotools/configitem.hxx> +namespace binfilter { + +// ================================================================================ + +/*N*/ namespace +/*N*/ { +/*N*/ +/*N*/ bool IsMetric() +/*N*/ { +/*N*/ SvtSysLocale aSysLocale; +/*N*/ const LocaleDataWrapper* pLocWrapper = aSysLocale.GetLocaleDataPtr(); +/*N*/ MeasurementSystem eSys = pLocWrapper->getMeasurementSystemEnum(); +/*N*/ +/*N*/ return ( eSys == MEASURE_METRIC ); +/*N*/ } + +// ---------------------------------------- + +/*N*/ class CalcConfigItem : public ::utl::ConfigItem +/*N*/ { +/*N*/ public: +/*N*/ CalcConfigItem() : +/*N*/ ConfigItem( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Calc/Layout" ))) +/*N*/ {} +/*N*/ +/*N*/ FieldUnit GetMeasureUnit(); + void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + void Commit(); +/*N*/ }; + +/*N*/ FieldUnit CalcConfigItem::GetMeasureUnit() +/*N*/ { +/*N*/ FieldUnit eResult( FUNIT_CM ); +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( 1 ); +/*N*/ if( IsMetric() ) +/*N*/ aNames[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Other/MeasureUnit/Metric" )); +/*N*/ else +/*N*/ aNames[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Other/MeasureUnit/NonMetric" )); +/*N*/ +/*N*/ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aResult( +/*N*/ GetProperties( aNames )); +/*N*/ +/*N*/ if( aResult[ 0 ].hasValue() ) +/*N*/ { +/*N*/ sal_Int32 nValue; +/*N*/ aResult[ 0 ] >>= nValue; +/*N*/ eResult = static_cast< FieldUnit >( nValue ); +/*N*/ } +/*N*/ +/*N*/ return eResult; +/*N*/ } + +void CalcConfigItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ) {} +void CalcConfigItem::Commit() {} + + +} // anonymous namespace + +// ================================================================================ + +namespace sch +{ + +namespace util +{ + +/*N*/ FieldUnit GetMeasureUnit() +/*N*/ { +/*N*/ static CalcConfigItem aCfgItem; +/*N*/ FieldUnit aUnit( aCfgItem.GetMeasureUnit() ); +/*N*/ +/*N*/ return aCfgItem.GetMeasureUnit(); +/*N*/ } + +} // namespace util +} // namespace sch +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/app/sch_menu.src b/binfilter/bf_sch/source/ui/app/sch_menu.src new file mode 100644 index 000000000000..8e823a9b219f --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_menu.src @@ -0,0 +1,1955 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + + + +#ifndef _GLOBLMN_HRC //autogen +#include <bf_svx/globlmn.hrc> +#endif + +#include "sch_menuids.src" + +#define MN_SUB_VIEW 91 +#define MN_SUB_TOOLBAR 92 +#define MN_SUB_GRAPHIC 93 +#define MN_SUB_SPELLING 94 +#define MN_SUB_TEMPLATES 95 + + +#define MN_WIN 28 +#define WORKAROUND_20 20 +#define WORKAROUND_21 21 +#define WORKAROUND_22 22 +#define WORKAROUND_23 23 +#define WORKAROUND_25 25 + + + // defines fuer das Helpmenu + // in globlmn.hrc nur fuer Writer benoetigt +#ifndef MN_HELP +#define MN_HELP +#endif + +#ifdef IS_DEFAULT +Accelerator RID_DEFAULTACCEL +#else +Accelerator RID_ACCEL +#endif +{ + ItemList = + { + AcceleratorItem + { + Identifier = SID_SHOW_ITEMBROWSER ; + Key = KeyCode + { + Code = KEY_9 ; + Shift = TRUE ; + Modifier1 = TRUE ; + Modifier2 = TRUE ; + }; + }; + AcceleratorItem + { + Identifier = SID_NEWDOC ; + Key = KeyCode + { + Function = KEYFUNC_NEW ; + }; + }; + AcceleratorItem + { + Identifier = SID_OPENDOC ; + Key = KeyCode + { + Function = KEYFUNC_OPEN ; + }; + }; + AcceleratorItem + { + Identifier = SID_SAVEDOC ; + Key = KeyCode + { + Function = KEYFUNC_SAVE ; + }; + }; + AcceleratorItem + { + Identifier = SID_SAVEASDOC ; + Key = KeyCode + { + Function = KEYFUNC_SAVEAS ; + }; + }; + AcceleratorItem + { + Identifier = SID_PRINTDOC ; + Key = KeyCode + { + Function = KEYFUNC_PRINT ; + }; + }; + AcceleratorItem + { + Identifier = SID_QUITAPP ; + Key = KeyCode + { + Function = KEYFUNC_QUIT ; + }; + }; + AcceleratorItem + { + Identifier = SID_CUT ; + Key = KeyCode + { + Function = KEYFUNC_CUT ; + }; + }; + AcceleratorItem + { + Identifier = SID_COPY ; + Key = KeyCode + { + Function = KEYFUNC_COPY ; + }; + }; + AcceleratorItem + { + Identifier = SID_PASTE ; + Key = KeyCode + { + Function = KEYFUNC_PASTE ; + }; + }; + AcceleratorItem + { + Identifier = SID_DELETE ; + Key = KeyCode + { + Function = KEYFUNC_DELETE ; + }; + }; + AcceleratorItem + { + Identifier = SID_UNDO ; + Key = KeyCode + { + Function = KEYFUNC_UNDO ; + }; + }; + AcceleratorItem + { + Identifier = SID_REDO ; + Key = KeyCode + { + Function = KEYFUNC_REDO ; + }; + }; + AcceleratorItem + { + Identifier = SID_REPEAT ; + Key = KeyCode + { + Function = KEYFUNC_REPEAT ; + }; + }; + AcceleratorItem + { + Identifier = SID_FOCUSURLBOX ; + Key = KeyCode + { + Code = KEY_O ; + Shift = TRUE ; Modifier1 = TRUE ; Modifier2 = FALSE ; + }; + }; + AcceleratorItem + { + Identifier = SID_WIN_FULLSCREEN ; + Key = KeyCode + { + Code = KEY_J ; + Shift = TRUE ; + Modifier1 = TRUE ; + Modifier2 = FALSE ; + }; + }; + AcceleratorItem + { + Identifier = SID_DESKTOPMODE ; + Key = KeyCode + { + Code = KEY_I ; + Shift = TRUE ; + Modifier1 = TRUE ; + Modifier2 = FALSE ; + }; + }; + AcceleratorItem + { + Identifier = SID_CLOSEWIN ; + Key = KeyCode + { + Function = KEYFUNC_CLOSE ; + }; + }; + }; +}; + +#ifdef IS_DEFAULT +Menu RID_DEFAULTMENU +#else +Menu RID_MENU +#endif +{ + ItemList = + { + MenuItem + { + ITEM_FILE_PICKLIST + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = SID_NEWDOCDIRECT ; + HelpID = SID_NEWDOCDIRECT ; + Text [ de ] = "~Neu" ; + Text [ en-US ] = "~New" ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Novo"; + Text[ ru ] = "Созд~ать"; + Text[ el ] = "~ΔημιουÏγία"; + Text[ nl ] = "~Nieuw"; + Text[ fr ] = "N~ouveau"; + Text[ es ] = "~Nuevo"; + Text[ fi ] = "~Uusi"; + Text[ ca ] = "~Nou"; + Text[ it ] = "Nuovo"; + Text[ da ] = "~Ny(t)"; + Text[ sv ] = "~Nytt"; + Text[ pl ] = "~Nowy"; + Text[ pt-BR ] = "~Novo"; + Text[ th ] = "ใ~หม่"; + Text[ ja ] = "æ–°è¦ä½œæˆ(~N)"; + Text[ ko ] = "새로 만들기(~N)"; + Text[ zh-CN ] = "新建(~N)"; + Text[ zh-TW ] = "開啟新檔(~N)"; + Text[ tr ] = "Yeni"; + Text[ hi-IN ] = "~नया"; + Text[ ar ] = "جديد"; + Text[ he ] = "‮חדש‬"; + }; + MenuItem + { + ITEM_FILE_OPENDOC + }; + ITEM_FILE_AUTOPILOT + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + ITEM_FILE_CLOSEDOC + }; + MenuItem + { + ITEM_FILE_SAVEDOC + }; + MenuItem + { + ITEM_FILE_SAVEASDOC + }; + MenuItem + { + ITEM_FILE_SAVEDOCS + }; + MenuItem + { + ITEM_FILE_LASTVERSIONDOC + }; + MenuItem + { + ITEM_FILE_VERSIONDIALOG + }; + MenuItem + { + ITEM_FILE_MAIL_SENDDOC + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + ITEM_FILE_DOCINFO + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + ITEM_FILE_PRINTDOC + }; + MenuItem + { + ITEM_FILE_SETUPPRINTER + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + ITEM_FILE_QUITAPP + }; + }; + }; + }; + MenuItem + { + Identifier = WORKAROUND_20 ; + HelpID = 20 ; + Text [ de ] = "~Bearbeiten" ; + Text [ en-US ] = "~Edit" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + ITEM_EDIT_UNDO + }; + MenuItem + { + ITEM_EDIT_REDO + }; + MenuItem + { + ITEM_EDIT_REPEAT + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = SID_DIAGRAM_DATA ; + HelpID = SID_DIAGRAM_DATA ; + Text [ de ] = "~Diagrammdaten" ; + Text [ en-US ] = "~Chart Data" ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Dados do gráfico"; + Text[ ru ] = "~Данные диаграммы"; + Text[ el ] = "~ΔεδομÎνα διαγÏάμματος"; + Text[ nl ] = "~Diagramgegevens"; + Text[ fr ] = "~Données du diagramme"; + Text[ es ] = "Datos del ~diagrama"; + Text[ fi ] = "~Kaaviotiedot"; + Text[ ca ] = "Dades del ~diagrama "; + Text[ it ] = "~Dati del diagramma"; + Text[ da ] = "Diagramdata"; + Text[ sv ] = "~Diagramdata"; + Text[ pl ] = "Dane wykresu"; + Text[ pt-BR ] = "Diagrammdaten"; + Text[ th ] = "ข้à¸à¸¡à¸¹à¸¥à¹~ผนภูมิ"; + Text[ ja ] = "グラフã®ãƒ‡ãƒ¼ã‚¿(~C)"; + Text[ ko ] = "차트 ë°ì´í„°(~C)"; + Text[ zh-CN ] = "图表数æ®(~C)"; + Text[ zh-TW ] = "圖表資料(~C)"; + Text[ tr ] = "~Karakter Verisi"; + Text[ hi-IN ] = "~चारà¥à¤Ÿà¥ डॉटा"; + Text[ ar ] = "بيانات الرسم البياني"; + Text[ he ] = "~Diagrammdaten"; + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + ITEM_EDIT_CUT + }; + MenuItem + { + ITEM_EDIT_COPY + }; + MenuItem + { + ITEM_EDIT_PASTE + }; + }; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "~Editar"; + Text[ ru ] = "~Правка"; + Text[ el ] = "~ΕπεξεÏγασία"; + Text[ nl ] = "Be~werken"; + Text[ fr ] = "~Édition"; + Text[ es ] = "~Editar"; + Text[ fi ] = "~Muokkaa"; + Text[ ca ] = "~Edita"; + Text[ it ] = "~Modifica"; + Text[ da ] = "~Rediger"; + Text[ sv ] = "~Redigera"; + Text[ pl ] = "~Edytuj"; + Text[ pt-BR ] = "~Editar"; + Text[ th ] = "à¹~à¸à¹‰à¹„ข"; + Text[ ja ] = "編集(~E)"; + Text[ ko ] = "편집(~E)"; + Text[ zh-CN ] = "编辑(~E)"; + Text[ zh-TW ] = "編輯(~E)"; + Text[ tr ] = "Dü~zenle"; + Text[ hi-IN ] = "~संपादन"; + Text[ ar ] = "~تØرير"; + Text[ he ] = "‮עריכה‬"; + }; + MenuItem + { + Identifier = WORKAROUND_21 ; + HelpID = 21 ; + Text [ de ] = "~Ansicht" ; + Text [ en-US ] = "~View" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = MN_SUB_TOOLBAR ; + HelpID = MN_SUB_TOOLBAR ; + Text [ de ] = "S~ymbolleisten" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + ITEM_VIEW_TOGGLEFUNCTIONBAR + }; + MenuItem + { + Identifier = SID_TOGGLETOOLBAR ; + HelpID = SID_TOGGLETOOLBAR ; + Text [ de ] = "~Werkzeugleiste" ; + Text [ en-US ] = "Main ~Toolbar" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Barra de ~ferramentas"; + Text[ ru ] = "~Панель инÑтрументов"; + Text[ el ] = "~ΓÏαμμή εÏγαλειών"; + Text[ nl ] = "~Werktuigbalk"; + Text[ fr ] = "Barre d'~instruments"; + Text[ es ] = "Barra de ~herramientas"; + Text[ fi ] = "Pää~työkalurivi"; + Text[ ca ] = "Barra d'~eines principal"; + Text[ it ] = "Barra st~rumenti"; + Text[ da ] = "~Værktøjslinje"; + Text[ sv ] = "~Verktygslist"; + Text[ pl ] = "Pasek narzÄ™dziowy"; + Text[ pt-BR ] = "Barra de ~ferramentas"; + Text[ th ] = "à¹~ถบเครื่à¸à¸‡à¸¡à¸·à¸à¸«à¸¥à¸±à¸"; + Text[ ja ] = "標準ツールãƒãƒ¼(~T)"; + Text[ ko ] = "주 ë„구 모ìŒ(~T)"; + Text[ zh-CN ] = "主工具æ (~T)"; + Text[ zh-TW ] = "主工具列(~T)"; + Text[ tr ] = "Ana ~AraççubuÄŸu"; + Text[ hi-IN ] = "~मà¥à¤–à¥à¤¯ औज़ार पटà¥à¤Ÿà¥€"; + Text[ ar ] = "شريط الأدوات"; + Text[ he ] = "~Werkzeugleiste"; + }; + MenuItem + { + ITEM_INSERT_HYPERLINK_INSERT + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = SID_CUSTOMIZETOOLBOX ; + HelpID = SID_CUSTOMIZETOOLBOX ; + Text [ de ] = "~Bearbeiten..." ; + Text [ en-US ] = "Customi~ze..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Personalizar..."; + Text[ ru ] = "~Правка..."; + Text[ el ] = "~ΕπεξεÏγασία..."; + Text[ nl ] = "Be~werken..."; + Text[ fr ] = "~Personnaliser..."; + Text[ es ] = "~Personalizar..."; + Text[ fi ] = "Mukau~ta"; + Text[ ca ] = "Personalit~za..."; + Text[ it ] = "~Modifica..."; + Text[ da ] = "~Rediger..."; + Text[ sv ] = "~Redigera..."; + Text[ pl ] = "Edytuj..."; + Text[ pt-BR ] = "~Configurar..."; + Text[ th ] = "à¸à¸³à¸«à¸™à¸”เ~à¸à¸‡..."; + Text[ ja ] = "カスタマイズ(~Z)..."; + Text[ ko ] = "ì‚¬ìš©ìž ì •ì˜(~Z)..."; + Text[ zh-CN ] = "编辑(~Z)..."; + Text[ zh-TW ] = "編輯(~Z)..."; + Text[ tr ] = "Özelle~ÅŸtir..."; + Text[ hi-IN ] = "~वà¥à¤¯à¤µà¤¸à¥à¤¥à¤¾ करो..."; + Text[ ar ] = "تØرير..."; + Text[ he ] = "~Bearbeiten..."; + }; + }; + }; + Text [ en-US ] = "~Toolbars" ; + Text [ x-comment ] = " "; + Text[ pt ] = "Barras de ~ferramentas"; + Text[ ru ] = "Панели Ñимволов"; + Text[ el ] = "ΓÏαμμÎÏ‚ σ~υμβόλων"; + Text[ nl ] = "~Werkbalken"; + Text[ fr ] = "Barres d'~outils"; + Text[ es ] = "~Barras de sÃmbolos"; + Text[ fi ] = "~Työkalurivit"; + Text[ ca ] = "~Barres d'eines"; + Text[ it ] = "~Barre dei simboli"; + Text[ da ] = "Ikonlin~jer"; + Text[ sv ] = "S~ymbollister"; + Text[ pl ] = "Paski symboli"; + Text[ pt-BR ] = "Barras de ~ferramentas"; + Text[ th ] = "à¹~ถบเครื่à¸à¸‡à¸¡à¸·à¸"; + Text[ ja ] = "ツールãƒãƒ¼(~T)"; + Text[ ko ] = "ë„구 모ìŒ(~T)"; + Text[ zh-CN ] = "å›¾æ ‡æ (~T)"; + Text[ zh-TW ] = "工具列(~T)"; + Text[ tr ] = "~Araç çubukları"; + Text[ hi-IN ] = "~औज़ार पटà¥à¤Ÿà¥€"; + Text[ ar ] = "أشرطة الرموز"; + Text[ he ] = "‮סרגלי כלי×‬"; + }; + MenuItem + { + ITEM_VIEW_TOGGLESTATUSBAR //ITEM_VIEW_TASKBAR + }; + MenuItem + { + ITEM_VIEW_TOGGLEIMESTATUSWINDOW + }; + MenuItem + { + Separator = TRUE ; + }; + ITEM_VIEW_SCREENMODE + }; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "~Ver"; + Text[ ru ] = "~Вид"; + Text[ el ] = "Î Ïο~βολή"; + Text[ nl ] = "Beel~d"; + Text[ fr ] = "~Affichage"; + Text[ es ] = "~Ver"; + Text[ fi ] = "~Näytä"; + Text[ ca ] = "~Visualitza"; + Text[ it ] = "~Visualizza"; + Text[ da ] = "~Vis"; + Text[ sv ] = "Vi~sa"; + Text[ pl ] = "~Widok"; + Text[ pt-BR ] = "~Ver"; + Text[ th ] = "~มุมมà¸à¸‡"; + Text[ ja ] = "表示(~V)"; + Text[ ko ] = "보기(~V)"; + Text[ zh-CN ] = "视图(~V)"; + Text[ zh-TW ] = "檢視(~V)"; + Text[ tr ] = "~Görüntüle"; + Text[ hi-IN ] = "~à ¤¦à ¥ƒà ¤¶à ¥Âà ¤¯"; + Text[ ar ] = "~عرض"; + Text[ he ] = "‮תצוגה‬"; + }; + MenuItem + { + Identifier = WORKAROUND_22 ; + HelpID = 22 ; + Text [ de ] = "~Einfügen" ; + Text [ en-US ] = "~Insert" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = SID_INSERT_TITLE ; + HelpID = SID_INSERT_TITLE ; + Text [ de ] = "~Titel..." ; + Text [ en-US ] = "~Title..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~TÃtulo..."; + Text[ ru ] = "~Заголовок..."; + Text[ el ] = "~Τίτλος..."; + Text[ nl ] = "~Titel..."; + Text[ fr ] = "~Titre..."; + Text[ es ] = "~TÃtulo..."; + Text[ fi ] = "~Otsikko"; + Text[ ca ] = "~TÃtol..."; + Text[ it ] = "~Titolo..."; + Text[ da ] = "Titel..."; + Text[ sv ] = "~Rubrik..."; + Text[ pl ] = "~TytuÅ‚..."; + Text[ pt-BR ] = "T?tulo..."; + Text[ th ] = "~ชื่à¸..."; + Text[ ja ] = "タイトル(~T)..."; + Text[ ko ] = "ì œëª©(~T)..."; + Text[ zh-CN ] = "æ ‡é¢˜(~T)..."; + Text[ zh-TW ] = "標題(~T)..."; + Text[ tr ] = "~BaÅŸlık..."; + Text[ hi-IN ] = "~Title..."; + Text[ ar ] = "عنوان..."; + Text[ he ] = "‮כותרת...‬"; + }; + MenuItem + { + Identifier = SID_INSERT_CHART_LEGEND ; + HelpID = SID_INSERT_CHART_LEGEND ; + Text [ de ] = "~Legende..." ; + Text [ en-US ] = "~Legend..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Legenda..."; + Text[ ru ] = "Легенда..."; + Text[ el ] = "Υπόμνημα..."; + Text[ nl ] = "~Legenda..."; + Text[ fr ] = "~Légende..."; + Text[ es ] = "~Leyenda..."; + Text[ fi ] = "~Selite..."; + Text[ ca ] = "~Llegenda..."; + Text[ it ] = "~Legenda..."; + Text[ da ] = "Forklaring..."; + Text[ sv ] = "~Förklaring..."; + Text[ pl ] = "~Legenda..."; + Text[ pt-BR ] = "Legenda..."; + Text[ th ] = "~คำà¸à¸˜à¸´à¸šà¸²à¸¢..."; + Text[ ja ] = "凡例(~L)..."; + Text[ ko ] = "범례(~L)..."; + Text[ zh-CN ] = "图例(~L)..."; + Text[ zh-TW ] = "圖例(~L)..."; + Text[ tr ] = "~Gösterge"; + Text[ hi-IN ] = "~लेज़नà¥à¤¡à¤¼..."; + Text[ ar ] = "Ù…ÙØªØ§Ø Ø§Ù„Ø±Ø³Ù… البياني..."; + Text[ he ] = "~Legende..."; + }; + MenuItem + { + Identifier = SID_INSERT_DESCRIPTION ; + HelpID = SID_INSERT_DESCRIPTION ; + Text [ de ] = "~Datenbeschriftung..." ; + Text [ en-US ] = "~Data Labels..." ; + Text[ pt ] = "~Rótulos de dados..."; + Text[ ru ] = "~ПодпиÑÑŒ данных..."; + Text[ el ] = "ΕπιγÏαφή δε~δομÎνων..."; + Text[ nl ] = "~Gegevenslabels..."; + Text[ fr ] = "Étiquetage des ~données..."; + Text[ es ] = "~Etiqueta datos..."; + Text[ fi ] = "~Tietonimiöt"; + Text[ ca ] = "Etiquetes de ~dades..."; + Text[ it ] = "~Dicitura dati..."; + Text[ da ] = "Dataetiketter..."; + Text[ sv ] = "~Dataetiketter..."; + Text[ pl ] = "~Etykiety danych..."; + Text[ pt-BR ] = "Descri??o dos dados..."; + Text[ th ] = "ป้ายชื่à¸~ข้à¸à¸¡à¸¹à¸¥..."; + Text[ ja ] = "データラベル(~D)..."; + Text[ ko ] = "ë°ì´í„° ë ˆì´ë¸”(~D)..."; + Text[ zh-CN ] = "æ•°æ®æ ‡å¿—(~D)..."; + Text[ zh-TW ] = "資料標籤(~D)..."; + Text[ tr ] = "~Veri Etiketleri..."; + Text[ hi-IN ] = "~Data Labels..."; + Text[ ar ] = "عنونة البيانات..."; + Text[ he ] = "~Datenbeschriftung..."; + }; + MenuItem + { + Identifier = SID_INSERT_AXIS ; + HelpID = SID_INSERT_AXIS ; + Text [ de ] = "~Achsen..." ; + Text [ en-US ] = "~Axes..." ; +// Text [ norwegian ] = "Akse og rutenett" ; +// Text [ italian ] = "~Assi e Griglia..." ; +// Text [ portuguese_brazilian ] = "Eixo e grade" ; +// Text [ portuguese ] = "Eixos e ~grelhas..." ; +// Text [ finnish ] = "Akseli ja taustaruudukko" ; +// Text [ danish ] = "Akser og gitterlinjer..." ; +// Text [ french ] = "~Axes et grilles..." ; +// Text [ swedish ] = "~Axlar och stödraster..." ; +// Text [ dutch ] = "~Assen en rasters..." ; +// Text [ spanish ] = "~Ejes y cuadrículas..." ; +// Text[ chinese_simplified ] = "ÖáÊýÖµºÍÍø¸ñÏß(~A)..."; +// Text[ russian ] = "~Îñè è ñåòêè..."; +// Text[ polish ] = "Osie i siatki..."; +// Text[ japanese ] = "Ž²‚Æ–Ú·ü(~A)..."; +// Text[ chinese_traditional ] = "¶b©Mºô®æ½u(~A)..."; +// Text[ arabic ] = "ãÍÇæÑ æÔÈßÇÊ..."; + Text [ x-comment ] = " "; + Text[ pt ] = "Ei~xos..."; + Text[ ru ] = "~ОÑи..."; + Text[ el ] = "Άξον~ες..."; + Text[ nl ] = "~Assen..."; + Text[ fr ] = "~Axes..."; + Text[ es ] = "~Ejes..."; + Text[ fi ] = "~Akselit"; + Text[ ca ] = "~Eixos..."; + Text[ it ] = "~Assi..."; + Text[ da ] = "Akser..."; + Text[ sv ] = "~Axlar..."; + Text[ pl ] = "~Osie..."; + Text[ pt-BR ] = "Eixo e grade"; + Text[ th ] = "à¹~à¸à¸™..."; + Text[ ja ] = "軸(~A)..."; + Text[ ko ] = "축(~A)..."; + Text[ zh-CN ] = "è½´(~A)..."; + Text[ zh-TW ] = "軸(~A)..."; + Text[ tr ] = "~Eksenler..."; + Text[ hi-IN ] = "~Axes..."; + Text[ ar ] = "Ù…Øاور..."; + Text[ he ] = "~Achsen..."; + }; + MenuItem + { + Identifier = SID_INSERT_GRIDS ; + HelpID = SID_INSERT_GRIDS ; + Text [ de ] = "~Gitter..."; + Text [ en-US ] = "~Grids..."; + Text [ x-comment ] = " "; + Text[ pt ] = "~Grelhas..."; + Text[ ru ] = "~Сетка..."; + Text[ el ] = "ΠλÎ~γμα..."; + Text[ nl ] = "~Rasters..."; + Text[ fr ] = "~Grilles..."; + Text[ es ] = "~CuadrÃculas..."; + Text[ fi ] = "~Ruudukot"; + Text[ ca ] = "~Graelles..."; + Text[ it ] = "~Griglia..."; + Text[ da ] = "Gitre..."; + Text[ sv ] = "~Gitter..."; + Text[ pl ] = "~Siatki..."; + Text[ pt-BR ] = "~Gridlines..."; + Text[ th ] = "เ~ส้นตาราง..."; + Text[ ja ] = "目盛線(~G)..."; + Text[ ko ] = "ëˆˆê¸ˆì„ (~G)..."; + Text[ zh-CN ] = "ç½‘æ ¼çº¿(~G)..."; + Text[ zh-TW ] = "ç¶²æ ¼ç·š(~G)..."; + Text[ tr ] = "~Izgaralar..."; + Text[ hi-IN ] = "~Grids..."; + Text[ ar ] = "شبكات..."; + Text[ he ] = "~Gitter..."; + }; + MenuItem + { + Identifier = SID_INSERT_STATISTICS ; + HelpID = SID_INSERT_STATISTICS ; + Text [ de ] = "~Statistik..." ; + Text [ en-US ] = "~Statistics..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~EstatÃstica..."; + Text[ ru ] = "СтатиÑтика..."; + Text[ el ] = "~Στατιστικά..."; + Text[ nl ] = "~Statistiek..."; + Text[ fr ] = "~Statistiques..."; + Text[ es ] = "~EstadÃstica..."; + Text[ fi ] = "~Tilastotiedot"; + Text[ ca ] = "~EstadÃstica..."; + Text[ it ] = "~Statistica..."; + Text[ da ] = "Statistik..."; + Text[ sv ] = "~Statistik..."; + Text[ pl ] = "~Statystyka..."; + Text[ pt-BR ] = "Eixo e grade"; + Text[ th ] = "~สถิติ..."; + Text[ ja ] = "統計(~S)..."; + Text[ ko ] = "통계(~S)..."; + Text[ zh-CN ] = "统计(~S)..."; + Text[ zh-TW ] = "統計(~S)..."; + Text[ tr ] = "~Ä°statistikler..."; + Text[ hi-IN ] = "~Statistics..."; + Text[ ar ] = "Ø¥Øصائيات..."; + Text[ he ] = "‮סטטיסטיקות...‬"; + }; + //------------------------------ + MenuItem { Separator = TRUE ; }; + //------------------------------ + MenuItem + { + Identifier = SID_CHARMAP ; + HelpId = SID_CHARMAP ; + Text [ de ] = "~Sonderzeichen..." ; + Text [ en-US ] = "S~pecial Character..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Caracteres especiais..."; + Text[ ru ] = "Специальные Ñимволы..."; + Text[ el ] = "Ειδικοί ~χαÏακτήÏες..."; + Text[ nl ] = "~Speciale tekens..."; + Text[ fr ] = "~Caractères spéciaux..."; + Text[ es ] = "~SÃmbolos..."; + Text[ fi ] = "E~rikoismerkki"; + Text[ ca ] = "~SÃmbols..."; + Text[ it ] = "Caratteri ~speciali..."; + Text[ da ] = "~Specialtegn..."; + Text[ sv ] = "S~pecialtecken..."; + Text[ pl ] = "~Znaki specjalne..."; + Text[ pt-BR ] = "S?mbolo..."; + Text[ th ] = "ตัวà¸à¸±à¸à¸‚ระพิเ~ศษ..."; + Text[ ja ] = "記å·ã¨ç‰¹æ®Šæ–‡å—(~P)..."; + Text[ ko ] = "기호 ë° íŠ¹ìˆ˜ 문ìž(~P)..."; + Text[ zh-CN ] = "特殊å—符(~P)..."; + Text[ zh-TW ] = "特殊å—å…ƒ(~P)..."; + Text[ tr ] = "~Özel Karakterler..."; + Text[ hi-IN ] = "~विशेष अकà¥à¤·à¤°..."; + Text[ ar ] = "رموز خاصة..."; + Text[ he ] = "~Sonderzeichen..."; + }; + }; + + + + + + + + }; + Text [ x-comment ] = " "; + Text[ pt ] = "~Inserir"; + Text[ ru ] = "Ð’ÑÑ‚~авка"; + Text[ el ] = "~Εισαγωγή"; + Text[ nl ] = "~Invoegen"; + Text[ fr ] = "~Insertion"; + Text[ es ] = "~Insertar"; + Text[ fi ] = "~Lisää"; + Text[ ca ] = "~Insereix"; + Text[ it ] = "~Inserisci"; + Text[ da ] = "~Indsæt"; + Text[ sv ] = "~Infoga"; + Text[ pl ] = "W~staw"; + Text[ pt-BR ] = "~Inserir"; + Text[ th ] = "à¹~ทรà¸"; + Text[ ja ] = "挿入(~I)"; + Text[ ko ] = "삽입(~I)"; + Text[ zh-CN ] = "æ’å…¥(~I)"; + Text[ zh-TW ] = "æ’å…¥(~I)"; + Text[ tr ] = "~Ekle"; + Text[ hi-IN ] = "~छिपकाओ"; + Text[ ar ] = "إد~راج"; + Text[ he ] = "~Einfügen"; + }; + MenuItem + { + Identifier = WORKAROUND_23 ; + HelpID = 23 ; + Text [ de ] = "~Format" ; + Text [ en-US ] = "F~ormat" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = SID_DIAGRAM_OBJECTS ; + HelpID = SID_DIAGRAM_OBJECTS ; + Text [ de ] = "~Objekteigenschaften..." ; + Text [ en-US ] = "~Object Properties..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Propriedades do objecto..."; + Text[ ru ] = "~СвойÑтва объекта..."; + Text[ el ] = "Ιδιότητες αντικειμÎν~ων..."; + Text[ nl ] = "~Objecteigenschappen"; + Text[ fr ] = "Propriétés de l'~objet..."; + Text[ es ] = "~Propiedades del objeto..."; + Text[ fi ] = "~Objektin ominaisuudet"; + Text[ ca ] = "~Propietats de l'objecte..."; + Text[ it ] = "Proprietà ~oggetto..."; + Text[ da ] = "Objektegenskaber..."; + Text[ sv ] = "~Objektegenskaper..."; + Text[ pl ] = "WÅ‚aÅ›ciwoÅ›ci obiektu..."; + Text[ pt-BR ] = "Linha de dados/~ponto..."; + Text[ th ] = "คุณสมบัติ~วัตถุ..."; + Text[ ja ] = "オブジェクトã®å±žæ€§(~O)..."; + Text[ ko ] = "개체 ë“±ë¡ ì •ë³´(~O)..."; + Text[ zh-CN ] = "对象属性(~O)..."; + Text[ zh-TW ] = "物件屬性(~O)..."; + Text[ tr ] = "~Nesne Özellikleri..."; + Text[ hi-IN ] = "~वसà¥à¤¤à¥ का विशेषतायें..."; + Text[ ar ] = "خصائص الكائن..."; + Text[ he ] = "~Objekteigenschaften..."; + }; + MN_TRANSFORM; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = SID_CHART_TITLE ; + HelpID = SID_CHART_TITLE ; + Text [ de ] = "~Titel" ; + Text [ en-US ] = "~Title" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = SID_DIAGRAM_TITLE_MAIN ; + HelpID = SID_DIAGRAM_TITLE_MAIN ; + Text [ de ] = "~Haupttitel..." ; + Text [ en-US ] = "~Main Title..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~TÃtulo principal..."; + Text[ ru ] = "Главный заголовок..."; + Text[ el ] = "~ΚÏÏιος τίτλος..."; + Text[ nl ] = "~Hoofdtitel..."; + Text[ fr ] = "Titre ~principal..."; + Text[ es ] = "TÃtulo ~principal..."; + Text[ fi ] = "~Pääotsikko"; + Text[ ca ] = "TÃtol ~principal..."; + Text[ it ] = "Titolo principale..."; + Text[ da ] = "Hovedtitel..."; + Text[ sv ] = "~Huvudrubrik..."; + Text[ pl ] = "TytuÅ‚ główny..."; + Text[ pt-BR ] = "TÃtulo ~principal..."; + Text[ th ] = "ชื่à¸~หลัà¸..."; + Text[ ja ] = "メインタイトル(~M)..."; + Text[ ko ] = "주 ì œëª©(~M)..."; + Text[ zh-CN ] = "ä¸»æ ‡é¢˜(~M)..."; + Text[ zh-TW ] = "主標題(~M)..."; + Text[ tr ] = "Ana ~BaÅŸlık.."; + Text[ hi-IN ] = "~पà¥à¤°à¤§à¤¾à¤¨ शीरà¥à¤·à¤•à¥..."; + Text[ ar ] = "العنوان الرئيسي..."; + Text[ he ] = "~Haupttitel..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_TITLE_SUB ; + HelpID = SID_DIAGRAM_TITLE_SUB ; + Text [ de ] = "~Untertitel..." ; + Text [ en-US ] = "S~ubtitle..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~SubtÃtulo..."; + Text[ ru ] = "Подзаголовок..."; + Text[ el ] = "~Υπότιτλος..."; + Text[ nl ] = "~Subtitel..."; + Text[ fr ] = "~Sous-titre..."; + Text[ es ] = "~SubtÃtulo..."; + Text[ fi ] = "Ala~otsikko"; + Text[ ca ] = "~SubtÃtol..."; + Text[ it ] = "Sottotitolo..."; + Text[ da ] = "Undertitel..."; + Text[ sv ] = "~Underrubrik..."; + Text[ pl ] = "PodtytuÅ‚..."; + Text[ pt-BR ] = "~Sub-tÃtulo..."; + Text[ th ] = "ชื่à¸~รà¸à¸‡..."; + Text[ ja ] = "サブタイトル(~U)..."; + Text[ ko ] = "ë¶€ì œ(~U)..."; + Text[ zh-CN ] = "åˆ†æ ‡é¢˜(~U)..."; + Text[ zh-TW ] = "分標題(~U)..."; + Text[ tr ] = "~AltbaÅŸlık..."; + Text[ hi-IN ] = "उ~पशीरà¥à¤·à¤•..."; + Text[ ar ] = "عنوان Ùرعي..."; + Text[ he ] = "~Untertitel..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_TITLE_X ; + HelpID = SID_DIAGRAM_TITLE_X ; + Text [ de ] = "~X-Achsentitel..." ; + Text [ en-US ] = "Title (~X Axis)..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "TÃtulo do eixo ~X..."; + Text[ ru ] = "Заголовок оÑи X..."; + Text[ el ] = "Τίτλος άξονα ~X..."; + Text[ nl ] = "Titel ~X-as..."; + Text[ fr ] = "Titre de l'axe ~X..."; + Text[ es ] = "TÃtulo del eje ~X..."; + Text[ fi ] = "Otsikko (~X-akseli)"; + Text[ ca ] = "TÃtol de l'eix ~X..."; + Text[ it ] = "Titolo asse ~X..."; + Text[ da ] = "X-aksetitel..."; + Text[ sv ] = "~X-axelrubrik..."; + Text[ pl ] = "TytuÅ‚ osi X..."; + Text[ pt-BR ] = "TÃtulo do eixo ~X..."; + Text[ th ] = "ชื่ภ(à¹à¸à¸™~X )..."; + Text[ ja ] = "X軸タイトル...(~X)"; + Text[ ko ] = "X축 ì œëª©(~X)..."; + Text[ zh-CN ] = "~X è½´æ ‡é¢˜..."; + Text[ zh-TW ] = "標題(~X 軸)..."; + Text[ tr ] = "BaÅŸlık (~X Ekseni)..."; + Text[ hi-IN ] = "~X अकà¥à¤· का शीरà¥à¤·à¤•...."; + Text[ ar ] = "عنوان المØور س..."; + Text[ he ] = "~X-Achsentitel..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_TITLE_Y ; + HelpID = SID_DIAGRAM_TITLE_Y ; + Text [ de ] = "~Y-Achsentitel..." ; + Text [ en-US ] = "Title (~Y Axis)..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "TÃtulo do eixo ~Y..."; + Text[ ru ] = "Заголовок оÑи Y..."; + Text[ el ] = "Τίτλος άξονα ~Y..."; + Text[ nl ] = "Titel ~ Y -as..."; + Text[ fr ] = "Titre de l'axe ~Y..."; + Text[ es ] = "TÃtulo del eje ~Y..."; + Text[ fi ] = "Otsikko (~Y-akseli)"; + Text[ ca ] = "TÃtol de l'eix ~Y..."; + Text[ it ] = "Titolo asse ~Y..."; + Text[ da ] = "Y-aksetitel..."; + Text[ sv ] = "~Y-axelrubrik..."; + Text[ pl ] = "TytuÅ‚ osi Y..."; + Text[ pt-BR ] = "TÃtulo do eixo ~Y..."; + Text[ th ] = "ชื่ภ(à¹à¸à¸™~Y )..."; + Text[ ja ] = "Y軸タイトル...(~Y)"; + Text[ ko ] = "Y축 ì œëª©(~Y)..."; + Text[ zh-CN ] = "~Y è½´æ ‡é¢˜..."; + Text[ zh-TW ] = "標題(~Y 軸)..."; + Text[ tr ] = "BaÅŸlık (~Y Eksen)..."; + Text[ hi-IN ] = "~Y अकà¥à¤· का शीरà¥à¤·à¤•..."; + Text[ ar ] = "عنوان المØور ص..."; + Text[ he ] = "~Y-Achsentitel..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_TITLE_Z ; + HelpID = SID_DIAGRAM_TITLE_Z ; + Text [ de ] = "~Z-Achsentitel..." ; + Text [ en-US ] = "Title (~Z Axis)..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "TÃtulo do eixo ~Z..."; + Text[ ru ] = "Заголовок оÑи Z..."; + Text[ el ] = "Τίτλος άξονα ~Z..."; + Text[ nl ] = "Titel ~Z-as..."; + Text[ fr ] = "Titre de l'axe ~Z..."; + Text[ es ] = "TÃtulo del eje ~Z..."; + Text[ fi ] = "Otsikko (~Z-akseli)"; + Text[ ca ] = "TÃtol de l'eix ~Z..."; + Text[ it ] = "Titolo asse ~Z..."; + Text[ da ] = "Z-aksetitel..."; + Text[ sv ] = "~Z-axelrubrik..."; + Text[ pl ] = "TytuÅ‚ osi Z..."; + Text[ pt-BR ] = "TÃtulo do eixo ~Z..."; + Text[ th ] = "ชื่ภ(à¹à¸à¸™~Z )..."; + Text[ ja ] = "Z軸タイトル...(~Z)"; + Text[ ko ] = "Z축 ì œëª©(~Z)..."; + Text[ zh-CN ] = "~Z è½´æ ‡é¢˜..."; + Text[ zh-TW ] = "標題(~Z 軸)..."; + Text[ tr ] = "BaÅŸlık (~Z Ekseni)..."; + Text[ hi-IN ] = "~Z अकà¥à¤· का शीरà¥à¤·à¤•..."; + Text[ ar ] = "عنوان المØور ع..."; + Text[ he ] = "~Z-Achsentitel..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_TITLE_ALL ; + HelpID = SID_DIAGRAM_TITLE_ALL ; + Text [ de ] = "~Alle Titel..." ; + Text [ en-US ] = "~All Titles..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Todos os tÃtulos..."; + Text[ ru ] = "Ð’Ñе заголовки..."; + Text[ el ] = "Όλ~οι οι τίτλοι..."; + Text[ nl ] = "~Alle titels..."; + Text[ fr ] = "T~ous les titres..."; + Text[ es ] = "~Todos los tÃtulos..."; + Text[ fi ] = "Kaikki otsikot..."; + Text[ ca ] = "~Tots els tÃtols..."; + Text[ it ] = "~Tutti i titoli..."; + Text[ da ] = "Alle titler..."; + Text[ sv ] = "~Alla rubriker..."; + Text[ pl ] = "Wszystkie tytuÅ‚y..."; + Text[ pt-BR ] = "~Todos os tÃtulos..."; + Text[ th ] = "ชื่à¸à¸—ั้งหมด..."; + Text[ ja ] = "ã™ã¹ã¦ã®ã‚¿ã‚¤ãƒˆãƒ«(~A)..."; + Text[ ko ] = "ëª¨ë“ ì œëª©(~A)..."; + Text[ zh-CN ] = "å…¨éƒ¨çš„æ ‡é¢˜(~A)..."; + Text[ zh-TW ] = "全部的標題(~A)..."; + Text[ tr ] = "Bütün BaÅŸlıklar..."; + Text[ hi-IN ] = "सब शीरà¥à¤·à¤•à¥..."; + Text[ ar ] = "كل العناوين..."; + Text[ he ] = "~Alle Titel..."; + }; + }; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "~TÃtulo"; + Text[ ru ] = "Заголовок"; + Text[ el ] = "~Τίτλος"; + Text[ nl ] = "Tite~l"; + Text[ fr ] = "~Titre"; + Text[ es ] = "~TÃtulo"; + Text[ fi ] = "~Otsikko"; + Text[ ca ] = "~TÃtol"; + Text[ it ] = "~Titolo"; + Text[ da ] = "Titel"; + Text[ sv ] = "~Rubrik"; + Text[ pl ] = "TytuÅ‚"; + Text[ pt-BR ] = "~T?tulo"; + Text[ th ] = "~ชื่à¸"; + Text[ ja ] = "タイトル(~T)"; + Text[ ko ] = "ì œëª©(~T)"; + Text[ zh-CN ] = "æ ‡é¢˜(~T)"; + Text[ zh-TW ] = "標題(~T)"; + Text[ tr ] = "~BaÅŸlık"; + Text[ hi-IN ] = "~उपाधि"; + Text[ ar ] = "العنوان"; + Text[ he ] = "‮כותרת‬"; + }; + MenuItem + { + Identifier = SID_LEGEND ; + HelpID = SID_LEGEND ; + Text [ de ] = "~Legende..." ; + Text [ en-US ] = "~Legend..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Legenda..."; + Text[ ru ] = "Легенда..."; + Text[ el ] = "Υπόμνημα..."; + Text[ nl ] = "~Legenda..."; + Text[ fr ] = "~Légende..."; + Text[ es ] = "~Leyenda..."; + Text[ fi ] = "~Selite..."; + Text[ ca ] = "~Llegenda..."; + Text[ it ] = "~Legenda..."; + Text[ da ] = "Forklaring..."; + Text[ sv ] = "Förk~laring..."; + Text[ pl ] = "Legenda..."; + Text[ pt-BR ] = "~Legenda..."; + Text[ th ] = "~คำà¸à¸˜à¸´à¸šà¸²à¸¢..."; + Text[ ja ] = "凡例(~L)..."; + Text[ ko ] = "범례(~L)..."; + Text[ zh-CN ] = "图例(~L)..."; + Text[ zh-TW ] = "圖例(~L)..."; + Text[ tr ] = "~Gösterge"; + Text[ hi-IN ] = "~लेज़नà¥à¤¡à¤¼..."; + Text[ ar ] = "Ù…ÙØªØ§Ø Ø§Ù„Ø±Ø³Ù… البياني..."; + Text[ he ] = "~Legende..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_AXIS ; + HelpID = SID_DIAGRAM_AXIS ; + Text [ de ] = "~Achse" ; + Text [ en-US ] = "A~xis" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = SID_DIAGRAM_AXIS_X ; + HelpID = SID_DIAGRAM_AXIS_X ; + Text [ de ] = "~X-Achse..." ; + Text [ en-US ] = "~X Axis..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Eixo ~X..."; + Text[ ru ] = "ОÑÑŒ X..."; + Text[ el ] = "Άξονας ~Χ..."; + Text[ nl ] = "~X-as..."; + Text[ fr ] = "Axe ~X..."; + Text[ es ] = "Eje ~X..."; + Text[ fi ] = "~X-akseli"; + Text[ ca ] = "Eix ~X..."; + Text[ it ] = "Asse ~X..."; + Text[ da ] = "X-akse..."; + Text[ sv ] = "~X-axel..."; + Text[ pl ] = "OÅ› X..."; + Text[ pt-BR ] = "Eixo ~X..."; + Text[ th ] = "à¹à¸à¸™~X ..."; + Text[ ja ] = "X軸...(~X)"; + Text[ ko ] = "X축(~X)..."; + Text[ zh-CN ] = "~X è½´..."; + Text[ zh-TW ] = "~X 軸..."; + Text[ tr ] = "~X Ekseni..."; + Text[ hi-IN ] = "~X अकà¥à¤·"; + Text[ ar ] = "المØور س..."; + Text[ he ] = "~X-Achse..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_AXIS_Y ; + HelpID = SID_DIAGRAM_AXIS_Y ; + Text [ de ] = "~Y-Achse..." ; + Text [ en-US ] = "~Y Axis..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Eixo ~Y..."; + Text[ ru ] = "ОÑÑŒ Y..."; + Text[ el ] = "Άξονας ~Y..."; + Text[ nl ] = "~Y-as..."; + Text[ fr ] = "Axe ~Y..."; + Text[ es ] = "Eje ~Y..."; + Text[ fi ] = "~Y-akseli..."; + Text[ ca ] = "Eix ~Y..."; + Text[ it ] = "Asse ~Y..."; + Text[ da ] = "Y-akse..."; + Text[ sv ] = "~Y-axel..."; + Text[ pl ] = "OÅ› Y..."; + Text[ pt-BR ] = "Eixo ~Y..."; + Text[ th ] = "à¹à¸à¸™~Y ..."; + Text[ ja ] = "Y軸...(~Y)"; + Text[ ko ] = "Y축(~Y)..."; + Text[ zh-CN ] = "~Y è½´..."; + Text[ zh-TW ] = "~Y 軸..."; + Text[ tr ] = "~Y Ekseni..."; + Text[ hi-IN ] = "~Y अकà¥à¤·"; + Text[ ar ] = "المØور ص..."; + Text[ he ] = "~Y-Achse..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_AXIS_Z ; + HelpID = SID_DIAGRAM_AXIS_Z ; + Text [ de ] = "~Z-Achse..." ; + Text [ en-US ] = "~Z Axis..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Eixo ~Z..."; + Text[ ru ] = "ОÑÑŒ Z..."; + Text[ el ] = "Άξονας ~Z..."; + Text[ nl ] = "~Z-as..."; + Text[ fr ] = "Axe ~Z..."; + Text[ es ] = "Eje ~Z..."; + Text[ fi ] = "~Z-akseli..."; + Text[ ca ] = "Eix ~Z..."; + Text[ it ] = "Asse ~Z..."; + Text[ da ] = "Z-akse..."; + Text[ sv ] = "~Z-axel..."; + Text[ pl ] = "OÅ› Z..."; + Text[ pt-BR ] = "Eixo ~Z..."; + Text[ th ] = "à¹à¸à¸™~Z ..."; + Text[ ja ] = "Z軸...(~Z)"; + Text[ ko ] = "Z축(~Z)..."; + Text[ zh-CN ] = "~Z è½´..."; + Text[ zh-TW ] = "~Z 軸..."; + Text[ tr ] = "~Z Ekseni..."; + Text[ hi-IN ] = "~Z अकà¥à¤·"; + Text[ ar ] = "المØور ع..."; + Text[ he ] = "~Z-Achse..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_AXIS_A ; + HelpID = SID_DIAGRAM_AXIS_A ; + Text [ de ] = "~Sekundäre X-Achse..." ; + Text [ en-US ] = "~Secondary X Axis..."; + Text [ x-comment ] = " "; + Text[ pt ] = "Eixo X ~secundário..."; + Text[ ru ] = "Ð”Ð¾Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð¾ÑÑŒ X..."; + Text[ el ] = "~ΔευτεÏεÏων άξονας Χ..."; + Text[ nl ] = "~Secundaire X as..."; + Text[ fr ] = "Axe X ~secondaire..."; + Text[ es ] = "Eje ~secundario X..."; + Text[ fi ] = "Toissijainen X-akseli..."; + Text[ ca ] = "Eix X secundari..."; + Text[ it ] = "Asse ~X secondario..."; + Text[ da ] = "Sekundær X-akse..."; + Text[ sv ] = "Sekundär X-axel..."; + Text[ pl ] = "Pomocnicze osie X..."; + Text[ pt-BR ] = "2nd X Axis..."; + Text[ th ] = "à¹à¸à¸™ X ทุติยภูมิ..."; + Text[ ja ] = "第2X軸(~S)..."; + Text[ ko ] = "2ì°¨ X축..."; + Text[ zh-CN ] = "第二个 Y è½´(~S)..."; + Text[ zh-TW ] = "第二個 X 軸(~S)..."; + Text[ tr ] = "~Ä°kinci X Ekseni..."; + Text[ hi-IN ] = "दूसरे X अकà¥à¤·..."; + Text[ ar ] = "المØور س الÙرعي..."; + Text[ he ] = "~Sekundäre X-Achse..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_AXIS_B ; + HelpID = SID_DIAGRAM_AXIS_B ; + Text [ de ] = "~Sekundäre Y-Achse..." ; + Text [ en-US ] = "S~econdary Y Axis..."; + Text [ x-comment ] = " "; + Text[ pt ] = "Eixo Y ~secundário..."; + Text[ ru ] = "Ð”Ð¾Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÐµÐ»ÑŒÐ½Ð°Ñ Ð¾ÑÑŒ Y..."; + Text[ el ] = "~ΔευτεÏεÏων άξονας Y..."; + Text[ nl ] = "~Secundaire Y-as..."; + Text[ fr ] = "Axe Y s~econdaire..."; + Text[ es ] = "~Eje secundario Y..."; + Text[ fi ] = "Toissijainen Y-akseli..."; + Text[ ca ] = "Eix Y secundari..."; + Text[ it ] = "Asse ~Y secondario..."; + Text[ da ] = "Sekundær Y-akse..."; + Text[ sv ] = "~Sekundär Y-axel..."; + Text[ pl ] = "Pomocnicza oÅ› Y..."; + Text[ pt-BR ] = "~Secondary Y-Axis..."; + Text[ th ] = "à¹à¸à¸™ Y ทุติยภูมิ..."; + Text[ ja ] = "第2Y軸(~E)..."; + Text[ ko ] = "2ì°¨ Y축..."; + Text[ zh-CN ] = "第二个 Y è½´(~E)..."; + Text[ zh-TW ] = "第二個 Y 軸(~e)..."; + Text[ tr ] = "~Ä°kinci Y Ekseni..."; + Text[ hi-IN ] = "~2nd Y Axis..."; + Text[ ar ] = "المØور ص Ùرعي..."; + Text[ he ] = "~Sekundäre Y-Achse..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_AXIS_ALL ; + HelpID = SID_DIAGRAM_AXIS_ALL ; + Text [ de ] = "~Alle Achsen..." ; + Text [ en-US ] = "~All Axes..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Todos os eixos..."; + Text[ ru ] = "Ð’Ñе оÑи..."; + Text[ el ] = "ÎŒ~λοι οι άξονες..."; + Text[ nl ] = "~Alle assen..."; + Text[ fr ] = "~Tous les axes..."; + Text[ es ] = "~Todos los ejes..."; + Text[ fi ] = "Kaikki akselit..."; + Text[ ca ] = "Tots els eixos..."; + Text[ it ] = "~Tutti gli assi..."; + Text[ da ] = "Alle akser..."; + Text[ sv ] = "~Alla axlar..."; + Text[ pl ] = "Wszystkie osie..."; + Text[ pt-BR ] = "~Todos os eixos..."; + Text[ th ] = "à¹à¸à¸™à¸—ั้งหมด..."; + Text[ ja ] = "ã™ã¹ã¦ã®è»¸(~A)..."; + Text[ ko ] = "ëª¨ë“ ì¶•..."; + Text[ zh-CN ] = "所有的轴(~A)..."; + Text[ zh-TW ] = "所有的軸(~A)..."; + Text[ tr ] = "~Tüm Eksenler..."; + Text[ hi-IN ] = "सब अकà¥à¤·..."; + Text[ ar ] = "كل المØاور..."; + Text[ he ] = "~Alle Achsen..."; + }; + }; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "~Eixo"; + Text[ ru ] = "ОÑÑŒ"; + Text[ el ] = "Άξον~ας"; + Text[ nl ] = "~As"; + Text[ fr ] = "A~xe"; + Text[ es ] = "~Eje"; + Text[ fi ] = "A~kselit"; + Text[ ca ] = "Ei~x"; + Text[ it ] = "A~sse"; + Text[ da ] = "Akse"; + Text[ sv ] = "~Axel"; + Text[ pl ] = "OÅ›"; + Text[ pt-BR ] = "~Eixo"; + Text[ th ] = "à¹à¸~น"; + Text[ ja ] = "軸(~X)"; + Text[ ko ] = "축(~X)"; + Text[ zh-CN ] = "è½´(~X)"; + Text[ zh-TW ] = "軸(~X)"; + Text[ tr ] = "~Eksen"; + Text[ hi-IN ] = "अ~कà¥à¤·"; + Text[ ar ] = "Ù…Øور"; + Text[ he ] = "~Achse"; + }; + MenuItem + { + Identifier = SID_DIAGRAM_GRID ; + HelpID = SID_DIAGRAM_GRID ; + // ### ACHTUNG: Neuer Text in Resource? ~Gitter : ~Gitter... + Text [ de ] = "~Gitter" ; + Text [ en-US ] = "~Grid" ; + // ### ACHTUNG: Neuer Text in Resource? Gitter bearbeiten : Gitter bearbeiten... + SubMenu = Menu + { + ItemList = + { + MenuItem + { + Identifier = SID_DIAGRAM_GRID_Y_MAIN ; + HelpID = SID_DIAGRAM_GRID_Y_MAIN ; + Text [ de ] = "~X-Achsenhauptgitter..." ; + Text [ en-US ] = "~X Axis Main Grid..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Grelha ~principal do eixo X..."; + Text[ ru ] = "ОÑÐ½Ð¾Ð²Ð½Ð°Ñ Ñетка оÑи X..."; + Text[ el ] = "ΚÏÏιο πλÎγμα άξονα ~Χ..."; + Text[ nl ] = "Hoofdraster ~X-as..."; + Text[ fr ] = "Grille principale de l'axe ~X..."; + Text[ es ] = "CuadrÃcula principal del eje ~X...."; + Text[ fi ] = "~X-akselin pääruudukko"; + Text[ ca ] = "Graella principal de l'eix ~X..."; + Text[ it ] = "Griglia principale asse ~X..."; + Text[ da ] = "X-akse overordnet gitter..."; + Text[ sv ] = "~X-axelhuvudgitter..."; + Text[ pl ] = "Główna siatka osi X..."; + Text[ pt-BR ] = "~Y-Achsenhauptgitter..."; + Text[ th ] = "เส้นตารางหลัà¸à¹à¸à¸™~ X ..."; + Text[ ja ] = "X軸主目盛線...(~X)"; + Text[ ko ] = "X축 주 ëˆˆê¸ˆì„ (~X)..."; + Text[ zh-CN ] = "~X è½´ä¸»ç½‘æ ¼çº¿..."; + Text[ zh-TW ] = "~X è»¸ä¸»ç¶²æ ¼ç·š..."; + Text[ tr ] = "X ~Koordinatı Ana Izgarası..."; + Text[ hi-IN ] = "~X अकà¥à¤· का पà¥à¤°à¤§à¤¾à¤¨ जाल..."; + Text[ ar ] = "الشبكة الرئيسية للمØور س..."; + Text[ he ] = "~X-Achsenhauptgitter..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_GRID_X_MAIN ; + HelpID = SID_DIAGRAM_GRID_X_MAIN ; + Text [ de ] = "~Y-Achsenhauptgitter..." ; + Text [ en-US ] = "~Y Axis Main Grid..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Grelha principal do eixo ~Y..."; + Text[ ru ] = "ОÑÐ½Ð¾Ð²Ð½Ð°Ñ Ñетка оÑи Y..."; + Text[ el ] = "ΚÏÏιο πλÎγμα άξονα ~Y..."; + Text[ nl ] = "Hoofdraster ~Y-as..."; + Text[ fr ] = "Grille principale de l'axe ~Y..."; + Text[ es ] = "CuadrÃcula principal del eje ~Y..."; + Text[ fi ] = "~Y-akselin pääruudukko..."; + Text[ ca ] = "Graella principal de l'eix ~Y..."; + Text[ it ] = "Griglia principale asse ~Y..."; + Text[ da ] = "Y-akse overordnet gitter..."; + Text[ sv ] = "~Y-axelhuvudgitter..."; + Text[ pl ] = "Główna siatka osi Y..."; + Text[ pt-BR ] = "~X-Achsenhauptgitter..."; + Text[ th ] = "เส้นตารางหลัà¸à¹à¸à¸™~Y ..."; + Text[ ja ] = "Y軸主目盛線...(~Y)"; + Text[ ko ] = "Y축 주 ëˆˆê¸ˆì„ (~Y)..."; + Text[ zh-CN ] = "~Y è½´ä¸»ç½‘æ ¼çº¿..."; + Text[ zh-TW ] = "~Y è»¸ç¶²æ ¼ç·š..."; + Text[ tr ] = "~Y Ekseni Ana Izgarası..."; + Text[ hi-IN ] = "~Y अकà¥à¤· का पà¥à¤°à¤§à¤¾à¤¨ जाल..."; + Text[ ar ] = "الشبكة الرئيسية للمØور ص..."; + Text[ he ] = "~Y-Achsenhauptgitter..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_GRID_Z_MAIN ; + HelpID = SID_DIAGRAM_GRID_Z_MAIN ; + Text [ de ] = "~Z-Achsenhauptgitter..." ; + Text [ en-US ] = "~Z Axis Main Grid..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Grelha p~rincipal do eixo Z..."; + Text[ ru ] = "ОÑÐ½Ð¾Ð²Ð½Ð°Ñ Ñетка оÑи Z..."; + Text[ el ] = "ΚÏÏιο πλÎγμα άξονα ~Z..."; + Text[ nl ] = "Hoofdraster ~Z-as..."; + Text[ fr ] = "Grille principale de l'axe ~Z..."; + Text[ es ] = "CuadrÃcula principal del eje ~Z..."; + Text[ fi ] = "~Z-akselin pääruudukko..."; + Text[ ca ] = "Graella principal de l'eix ~Z..."; + Text[ it ] = "Griglia principale asse ~Z..."; + Text[ da ] = "Z-akse overordnet gitter..."; + Text[ sv ] = "~Z-axelhuvudgitter..."; + Text[ pl ] = "Główna siatka osi Z..."; + Text[ pt-BR ] = "Grade principal do eixo ~Z..."; + Text[ th ] = "เส้นตารางหลัà¸à¹à¸à¸™~Z ..."; + Text[ ja ] = "Z軸主目盛線...(~Z)"; + Text[ ko ] = "Z축 주 ëˆˆê¸ˆì„ (~Z)..."; + Text[ zh-CN ] = "~Z è½´ä¸»ç½‘æ ¼çº¿..."; + Text[ zh-TW ] = "~Z è»¸ä¸»ç¶²æ ¼ç·š..."; + Text[ tr ] = "~Z Ekseni Ana Izgarası..."; + Text[ hi-IN ] = "~Z अकà¥à¤· का पà¥à¤°à¤§à¤¾à¤¨ जाल..."; + Text[ ar ] = "شبكة رئيسية للمØور ع..."; + Text[ he ] = "~Z-Achsenhauptgitter..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_GRID_Y_HELP ; + HelpID = SID_DIAGRAM_GRID_Y_HELP ; + Text [ de ] = "X-A~chsenhilfsgitter..." ; + Text [ en-US ] = "X Axis ~Minor Grid..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Grelha auxiliar do eixo ~X..."; + Text[ ru ] = "ÐŸÑ€Ð¾Ð¼ÐµÐ¶ÑƒÑ‚Ð¾Ñ‡Ð½Ð°Ñ Ñетка оÑи X..."; + Text[ el ] = "Βοη~θητικό πλÎγμα του άξονα Χ..."; + Text[ nl ] = "Hulpraster ~X-as..."; + Text[ fr ] = "Grille auxiliaire de l'axe ~X..."; + Text[ es ] = "CuadrÃcula auxiliar del eje ~X..."; + Text[ fi ] = "X-akselin toissijainen ruudukko..."; + Text[ ca ] = "CuadrÃcula auxiliar de l'eix ~X..."; + Text[ it ] = "Griglia ausiliaria a~sse X..."; + Text[ da ] = "X-akse underordnet gitter..."; + Text[ sv ] = "X-axels~tödgitter..."; + Text[ pl ] = "Pomocnicza siatka osi X..."; + Text[ pt-BR ] = "~Y-Achsenhilfsgitter..."; + Text[ th ] = "เส้นตาราง~รà¸à¸‡à¹à¸à¸™ X ..."; + Text[ ja ] = "X軸補助目盛線(~M)..."; + Text[ ko ] = "X축 ë³´ì¡° ëˆˆê¸ˆì„ (~M)..."; + Text[ zh-CN ] = "X è½´æ¬¡ç½‘æ ¼çº¿(~M)..."; + Text[ zh-TW ] = "X è»¸æ¬¡ç¶²æ ¼ç·š(~M)..."; + Text[ tr ] = "X Ekseni ~Küçük Izgarası..."; + Text[ hi-IN ] = "X अकà¥à¤· का ~छोटा जाल..."; + Text[ ar ] = "شبكة مساعدة للمØور س..."; + Text[ he ] = "X-A~chsenhilfsgitter..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_GRID_X_HELP ; + HelpID = SID_DIAGRAM_GRID_X_HELP ; + Text [ de ] = "Y-Ac~hsenhilfsgitter..." ; + Text [ en-US ] = "Y Axis Minor ~Grid..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Grelha auxiliar do eixo ~Y..."; + Text[ ru ] = "ÐŸÑ€Ð¾Ð¼ÐµÐ¶ÑƒÑ‚Ð¾Ñ‡Ð½Ð°Ñ Ñетка оÑи Y..."; + Text[ el ] = "Βοη~θητικό πλÎγμα του άξονα Y..."; + Text[ nl ] = "Hulpraster ~Y-as..."; + Text[ fr ] = "Grille auxiliaire de l'axe ~Y..."; + Text[ es ] = "CuadrÃcula auxiliar del eje ~Y..."; + Text[ fi ] = "Y-akselin toissijainen ruudukko..."; + Text[ ca ] = "CuadrÃcula auxiliar de l'eix ~Y..."; + Text[ it ] = "Griglia ausiliaria ~asse Y..."; + Text[ da ] = "Y-akse underordnet gitter..."; + Text[ sv ] = "Y-axel~stödgitter..."; + Text[ pl ] = "Pomocnicza siatka osi Y..."; + Text[ pt-BR ] = "~X-Achsenhilfsgitter..."; + Text[ th ] = "เ~ส้นตารางรà¸à¸‡à¹à¸à¸™ Y..."; + Text[ ja ] = "Y軸補助目盛線(~G)..."; + Text[ ko ] = "Y축 ë³´ì¡° ëˆˆê¸ˆì„ (~G)..."; + Text[ zh-CN ] = "Y è½´æ¬¡ç½‘æ ¼çº¿(~G)..."; + Text[ zh-TW ] = "Y è»¸æ¬¡ç¶²æ ¼ç·š(~G)..."; + Text[ tr ] = "Y Ekseni Küçük ~Izgarası..."; + Text[ hi-IN ] = "Y अकà¥à¤· का ~छोटा जाल..."; + Text[ ar ] = "شبكة مساعدة للمØور ص..."; + Text[ he ] = "Y-Ac~hsenhilfsgitter..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_GRID_Z_HELP ; + HelpID = SID_DIAGRAM_GRID_Z_HELP ; + Text [ de ] = "Z-Ach~senhilfsgitter..." ; + Text [ en-US ] = "Z Ax~is Minor Grid..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Grelha a~uxiliar do eixo Z..."; + Text[ ru ] = "ÐŸÑ€Ð¾Ð¼ÐµÐ¶ÑƒÑ‚Ð¾Ñ‡Ð½Ð°Ñ Ñетка оÑи Z..."; + Text[ el ] = "Βοηθητικό πλÎγμα του άξονα Z..."; + Text[ nl ] = "Hulpraster ~Z-as..."; + Text[ fr ] = "Grille auxiliaire de l'axe ~Z..."; + Text[ es ] = "CuadrÃcula auxiliar del eje ~Z..."; + Text[ fi ] = "Z Ak~selin toissijainen ruudukko..."; + Text[ ca ] = "CuadrÃcula auxiliar de l'eix ~Z..."; + Text[ it ] = "Griglia ausiliaria ass~e Z..."; + Text[ da ] = "Z-akse underordnet gitter..."; + Text[ sv ] = "Z-axelstö~dgitter..."; + Text[ pl ] = "Pomocnicza siatka osi Z..."; + Text[ pt-BR ] = "~Z-Achsenhilfsgitter..."; + Text[ th ] = "เส้นตารางรà¸à¸‡à¹à¸~น Z ..."; + Text[ ja ] = "Z軸補助目盛線(~I)..."; + Text[ ko ] = "Z축 ë³´ì¡° ëˆˆê¸ˆì„ (~I)..."; + Text[ zh-CN ] = "Z è½´æ¬¡ç½‘æ ¼çº¿(~I)..."; + Text[ zh-TW ] = "Z è»¸æ¬¡ç¶²æ ¼ç·š(~I)..."; + Text[ tr ] = "Z Ek~seni Küçük Izgarası..."; + Text[ hi-IN ] = "Z अकà¥à¤· का ~छोटा जाल..."; + Text[ ar ] = "شبكة مساعدة للمØور ع..."; + Text[ he ] = "Z-Ach~senhilfsgitter..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_GRID_ALL ; + HelpID = SID_DIAGRAM_GRID_ALL ; + Text [ de ] = "~Alle Achsengitter..." ; + Text [ en-US ] = "~All Axis Grids..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Todas as grelhas dos eixos..."; + Text[ ru ] = "Ð’Ñе Ñетки оÑи..."; + Text[ el ] = "Όλ~α τα πλÎγματα αξόνων..."; + Text[ nl ] = "~Alle asrasters..."; + Text[ fr ] = "~Toutes les grilles d'axes..."; + Text[ es ] = "~Todas las cuadrÃculas de ejes..."; + Text[ fi ] = "~Kaikki akseliruudukot..."; + Text[ ca ] = "~Totes les graelles de l'eix..."; + Text[ it ] = "Tutte le griglie degli assi..."; + Text[ da ] = "Alle aksegitre..."; + Text[ sv ] = "~Alla axelgitter..."; + Text[ pl ] = "Wszystkie siatki osi..."; + Text[ pt-BR ] = "~Todas as grades dos eixos..."; + Text[ th ] = "เส้นตารางà¹à¸à¸™~ทั้งหมด..."; + Text[ ja ] = "ã™ã¹ã¦ã®è»¸ç›®ç››ç·š(~A)..."; + Text[ ko ] = "ëª¨ë“ ì¶• ëˆˆê¸ˆì„ (~A)..."; + Text[ zh-CN ] = "å…¨éƒ¨çš„è½´ç½‘æ ¼çº¿(~A)..."; + Text[ zh-TW ] = "æ‰€æœ‰çš„è»¸ç¶²æ ¼ç·š(~A)..."; + Text[ tr ] = "~Tüm Eksen Izgaraları..."; + Text[ hi-IN ] = "~सब अकà¥à¤· का जाल.."; + Text[ ar ] = "كل شبكات المØاور..."; + Text[ he ] = "~Alle Achsengitter..."; + }; + }; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "~Grelha"; + Text[ ru ] = "Сетка"; + Text[ el ] = "ΠλÎ~γμα"; + Text[ nl ] = "~Raster"; + Text[ fr ] = "~Grille"; + Text[ es ] = "~CuadrÃcula"; + Text[ fi ] = "~Ruudukko"; + Text[ ca ] = "~Graella"; + Text[ it ] = "~Griglia"; + Text[ da ] = "Gitter"; + Text[ sv ] = "~Gitter"; + Text[ pl ] = "Siatka"; + Text[ pt-BR ] = "~Grade..."; + Text[ th ] = "เ~ส้นตาราง"; + Text[ ja ] = "目盛線(~G)"; + Text[ ko ] = "ëˆˆê¸ˆì„ (~G)"; + Text[ zh-CN ] = "ç½‘æ ¼çº¿(~G)"; + Text[ zh-TW ] = "ç¶²æ ¼ç·š(~G)"; + Text[ tr ] = "~Izgara"; + Text[ hi-IN ] = "~जाल"; + Text[ ar ] = "شبكة"; + Text[ he ] = "~Gitter"; + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = SID_DIAGRAM_WALL ; + HelpID = SID_DIAGRAM_WALL ; + Text [ de ] = "Diagramm~wand..." ; + Text [ en-US ] = "Chart ~Wall..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Parede do gráfico..."; + Text[ ru ] = "Стена диаграммы..."; + Text[ el ] = "Τοίχο~Ï‚ διαγÏάμματος..."; + Text[ nl ] = "Diagram~wand..."; + Text[ fr ] = "P~aroi du diagramme..."; + Text[ es ] = "~Pared del diagrama..."; + Text[ fi ] = "Kaavio~seinä..."; + Text[ ca ] = "~Pla lateral del diagrama..."; + Text[ it ] = "~Pareti del diagramma..."; + Text[ da ] = "Diagramvæg..."; + Text[ sv ] = "Diagram~vägg..."; + Text[ pl ] = "Åšciana wykresu..."; + Text[ pt-BR ] = "Diagram ~wall..."; + Text[ th ] = "~ผนังà¹à¸œà¸™à¸ ูมิ..."; + Text[ ja ] = "グラフã®å£é¢(~W)..."; + Text[ ko ] = "차트 옆면(~W)..."; + Text[ zh-CN ] = "图表背景墙(~W)..."; + Text[ zh-TW ] = "圖表背景牆(~W)..."; + Text[ tr ] = "Harita ~Alanı..."; + Text[ hi-IN ] = "चारà¥à¤Ÿ ~वॉल..."; + Text[ ar ] = "Øائط الرسم البياني..."; + Text[ he ] = "Diagramm~wand..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_FLOOR ; + HelpID = SID_DIAGRAM_FLOOR ; + Text [ de ] = "Diagramm~boden..." ; + Text [ en-US ] = "~Chart Floor..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Base do gráfico..."; + Text[ ru ] = "ОÑнование диаграммы..."; + Text[ el ] = "Δά~πεδο διαγÏάμματος..."; + Text[ nl ] = "Diagram~bodem..."; + Text[ fr ] = "P~lancher du diagramme..."; + Text[ es ] = "~Base del diagrama..."; + Text[ fi ] = "~Kaavion perusta"; + Text[ ca ] = "Base del ~diagrama..."; + Text[ it ] = "~Pavimento del diagramma..."; + Text[ da ] = "Diagramgulv..."; + Text[ sv ] = "D~iagramgolv..."; + Text[ pl ] = "PodÅ‚oże wykresu..."; + Text[ pt-BR ] = "Diagram ~floor..."; + Text[ th ] = "พื้นà¹à¸œ~นภูมิ..."; + Text[ ja ] = "グラフã®åºŠé¢(~C)..."; + Text[ ko ] = "차트 ë°‘ë©´(~C)..."; + Text[ zh-CN ] = "图表基底(~C)..."; + Text[ zh-TW ] = "座標軸(~C)..."; + Text[ tr ] = "~Karakter Altı..."; + Text[ hi-IN ] = "~चारà¥à¤Ÿà¥ फ़ोरà¥..."; + Text[ ar ] = "أرضية الرسم البياني..."; + Text[ he ] = "Diagramm~boden..."; + }; + MenuItem + { + Identifier = SID_DIAGRAM_AREA ; + HelpID = SID_DIAGRAM_AREA ; + Text [ de ] = "Diagram~mfläche..." ; + Text [ en-US ] = "C~hart Area..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Ã~rea do gráfico..."; + Text[ ru ] = "ОблаÑÑ‚ÑŒ диаграммы..."; + Text[ el ] = "ΠεÏιοχή διαγÏά~μματος..."; + Text[ nl ] = "Diagram~oppervlak..."; + Text[ fr ] = "~Arrière-plan du diagramme..."; + Text[ es ] = "~Superficie del diagrama..."; + Text[ fi ] = "Kaa~vioalue"; + Text[ ca ] = "~Àrea de diagrama..."; + Text[ it ] = "~Area del diagramma..."; + Text[ da ] = "DiagramomrÃ¥de..."; + Text[ sv ] = "Diagra~momrÃ¥de..."; + Text[ pl ] = "Obszar wykresu..."; + Text[ pt-BR ] = "?~rea do diagrama..."; + Text[ th ] = "พื้นที่à¹à¸œà¸™~ภูมิ..."; + Text[ ja ] = "グラフエリア(~H)..."; + Text[ ko ] = "차트 ì˜ì—(~H)..."; + Text[ zh-CN ] = "图表平é¢(~H)..."; + Text[ zh-TW ] = "圖表平é¢(~H)..."; + Text[ tr ] = "K~arakter Alanı..."; + Text[ hi-IN ] = "चा~रà¥à¤Ÿ विसà¥à¤¤à¥€à¤°à¥à¤£..."; + Text[ ar ] = "مساØØ© الرسم البياني..."; + Text[ he ] = "Diagram~mfläche..."; + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = SID_DIAGRAM_TYPE ; + HelpID = SID_DIAGRAM_TYPE ; + Text [ de ] = "~Diagrammtyp..." ; + Text [ en-US ] = "Cha~rt Type..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Tipo de gráfico..."; + Text[ ru ] = "Тип диаграммы..."; + Text[ el ] = "ΤÏπος ~διαγÏάμματος..."; + Text[ nl ] = "Diagram~type..."; + Text[ fr ] = "Type de ~diagramme..."; + Text[ es ] = "~Tipo de diagrama..."; + Text[ fi ] = "Kaa~viotyyppi..."; + Text[ ca ] = "Tipus de diag~rama..."; + Text[ it ] = "Ti~po di diagramma..."; + Text[ da ] = "Diagramtype..."; + Text[ sv ] = "~Diagramtyp..."; + Text[ pl ] = "Typ wykresu..."; + Text[ pt-BR ] = "~Tipo de diagrama..."; + Text[ th ] = "ชนิดà¹à¸œà¸™à¸ ู~มิ..."; + Text[ ja ] = "グラフã®ç¨®é¡ž(~R)..."; + Text[ ko ] = "차트 ìœ í˜•(~R)..."; + Text[ zh-CN ] = "图表类型(~R)..."; + Text[ zh-TW ] = "圖表類型(~R)..."; + Text[ tr ] = "Ka~rakter Türü..."; + Text[ hi-IN ] = "चा~रà¥à¤Ÿ वरà¥à¤—...."; + Text[ ar ] = "نوع الرسم البياني..."; + Text[ he ] = "~Diagrammtyp..."; + }; + MenuItem + { + Identifier = SID_AUTOFORMAT ; + HelpID = HID_SCH_CHART_AUTO_FORMAT ; + /* ### ACHTUNG: Neuer Text in Resource? Auto~Format... : Auto~format... */ + /* ### ACHTUNG: Neuer Text in Resource? Auto~Format... : Auto~format... */ + Text [ de ] = "Auto~Format..." ; + Text [ en-US ] = "Auto~Format..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "Auto~Formato..."; + Text[ ru ] = "Ðвтоформат..."; + Text[ el ] = "ΑυτοΜοÏ~φή..."; + Text[ nl ] = "A~utoOpmaak..."; + Text[ fr ] = "Auto~Format..."; + Text[ es ] = "~Formateado automático..."; + Text[ fi ] = "~Automaattinen muotoilu"; + Text[ ca ] = "A~utoFormat..."; + Text[ it ] = "~Formattazione automatica..."; + Text[ da ] = "AutoFormat..."; + Text[ sv ] = "Auto~Format..."; + Text[ pl ] = "Autoformat..."; + Text[ pt-BR ] = "Auto ~formata??o..."; + Text[ th ] = "~รูปà¹à¸šà¸šà¸à¸±à¸•à¹‚นมัติ..."; + Text[ ja ] = "オートフォーマット(~F)..."; + Text[ ko ] = "ìžë™ ì„œì‹(~F)..."; + Text[ zh-CN ] = "è‡ªåŠ¨æ ¼å¼(~F)..."; + Text[ zh-TW ] = "è‡ªå‹•æ ¼å¼(~F)..."; + Text[ tr ] = "Otomatık ~Biçim..."; + Text[ hi-IN ] = "सà¥à¤µà¤šà¤¾à¤²à¤¿à¤¤ ~ढंग से रचना..."; + Text[ ar ] = "تنسيق تلقائي..."; + Text[ he ] = "‮עיצוב ×וטומטי...‬"; + }; + MenuItem + { + Identifier = SID_3D_WIN ; + HelpID = SID_3D_WIN ; + Text [ de ] = "~3D-Effekte" ; + Text [ en-US ] = "~3D Effects" ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Efeitos-3D"; + Text[ ru ] = "Ðффекты 3-Ðœ"; + Text[ el ] = "ΕφΠ~3Δ"; + Text[ nl ] = "3D-~effecten"; + Text[ fr ] = "~Effets 3D"; + Text[ es ] = "~Efectos 3D"; + Text[ fi ] = "~Kolmiulotteiset tehosteet"; + Text[ ca ] = "Efectes ~3D"; + Text[ it ] = "Effetti ~3D"; + Text[ da ] = "3D-effekter"; + Text[ sv ] = "~3D-effekter"; + Text[ pl ] = "Efekty 3-W"; + Text[ pt-BR ] = "3D-~Effekte"; + Text[ th ] = "ลัà¸à¸©à¸“ะพิเศษ~3มิติ"; + Text[ ja ] = "3D 効果(~3)"; + Text[ ko ] = "3D 효과"; + Text[ zh-CN ] = "~3 维效果"; + Text[ zh-TW ] = "~3D 效果"; + Text[ tr ] = "~3D Efektleri"; + Text[ hi-IN ] = "~3D पà¥à¤°à¤à¤¾à¤µ"; + Text[ ar ] = "تأثيرات ثلاثية الأبعاد"; + Text[ he ] = "~3D-Effekte"; + }; + MenuItem + { + Identifier = SID_3D_VIEW ; + HelpID = SID_3D_VIEW ; + Text [ de ] = "3D-An~sicht..." ; + Text [ en-US ] = "3~D View..." ; + Text [ x-comment ] = " "; + Text[ pt ] = "~Vista 3D..."; + Text[ ru ] = "Вид 3-Ðœ..."; + Text[ el ] = "Î Ïο~βολή 3Δ..."; + Text[ nl ] = "~3D-weergave..."; + Text[ fr ] = "Affichage ~3D..."; + Text[ es ] = "~Ver en 3D..."; + Text[ fi ] = "Kolmi~ulotteinen näkymä..."; + Text[ ca ] = "Vista 3~D..."; + Text[ it ] = "~Vista 3D..."; + Text[ da ] = "3D-visning..."; + Text[ sv ] = "3D-v~y..."; + Text[ pl ] = "Widok 3-W..."; + Text[ pt-BR ] = "~Ver 3D..."; + Text[ th ] = "มุมมà¸à¸‡ 3~มิติ..."; + Text[ ja ] = "3D 表示...(~D)"; + Text[ ko ] = "3D 보기(~D)..."; + Text[ zh-CN ] = "~3 维视图..."; + Text[ zh-TW ] = "~3D 檢視..."; + Text[ tr ] = "3~B Görünüm..."; + Text[ hi-IN ] = "3~D दृशà¥à¤¯"; + Text[ ar ] = "عرض ثلاثي الأبعاد..."; + Text[ he ] = "3D-An~sicht..."; + }; + MenuItem + { + Separator = TRUE ; + }; + MN_ROW_POSITION; + }; +}; + Text[ pt ] = "~Formatar"; + Text[ ru ] = "Фор~мат"; + Text[ el ] = "ΜοÏ~φοποίηση"; + Text[ nl ] = "~Formaat"; + Text[ fr ] = "Forma~t"; + Text[ es ] = "~Formato"; + Text[ fi ] = "~Muotoile"; + Text[ ca ] = "F~ormata"; + Text[ it ] = "F~ormato"; + Text[ da ] = "Forma~ter"; + Text[ sv ] = "F~ormat"; + Text[ pl ] = "Format"; + Text[ pt-BR ] = "Form~at"; + Text[ th ] = "รู~ปà¹à¸šà¸š"; + Text[ ja ] = "書å¼(~O)"; + Text[ ko ] = "ì„œì‹(~O)"; + Text[ zh-CN ] = "æ ¼å¼(~O)"; + Text[ zh-TW ] = "æ ¼å¼(~O)"; + Text[ tr ] = "~Biçim"; + Text[ hi-IN ] = "~रचना"; + Text[ ar ] = "تنس~يق"; + Text[ he ] = "‮עיצוב‬"; + }; + MenuItem + { + Identifier = WORKAROUND_25 ; + HelpID = 25 ; + Text [ de ] = "E~xtras" ; + Text [ en-US ] = "~Tools" ; + SubMenu = Menu + { + ItemList = + { + MenuItem + { + ITEM_TOOLS_CONFIG + }; + ITEM_MN_OPTIONS + /* + MenuItem + { + Identifier = SID_OPTIONS ; + HelpID = SID_OPTIONS ; + Text [ de ] = "Optionen..." ; + Text [ en-US ] = "Options..." ; + }; + */ + }; + }; + Text [ x-comment ] = " "; + Text[ pt ] = "~Ferramentas"; + Text[ ru ] = "~СервиÑ"; + Text[ el ] = "Ε~Ïγαλεία"; + Text[ nl ] = "E~xtra"; + Text[ fr ] = "~Outils"; + Text[ es ] = "~Herramientas"; + Text[ fi ] = "~Työkalut"; + Text[ ca ] = "Ei~nes"; + Text[ it ] = "~Strumenti"; + Text[ da ] = "Fun~ktioner"; + Text[ sv ] = "~Verktyg"; + Text[ pl ] = "~NarzÄ™dzia"; + Text[ pt-BR ] = "F~erramentas"; + Text[ th ] = "เ~ครื่à¸à¸‡à¸¡à¸·à¸"; + Text[ ja ] = "ツール(~T)"; + Text[ ko ] = "ë„구(~T)"; + Text[ zh-CN ] = "工具(~T)"; + Text[ zh-TW ] = "工具(~T)"; + Text[ tr ] = "~Araçlar"; + Text[ hi-IN ] = "~औज़ार"; + Text[ ar ] = "Ø£~دوات"; + Text[ he ] = "‮כלי×‬"; + }; + ITEM_WINDOW_MENU + ITEM_HELP_MENU + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binfilter/bf_sch/source/ui/app/sch_menuids.src b/binfilter/bf_sch/source/ui/app/sch_menuids.src new file mode 100644 index 000000000000..ed5744277f90 --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_menuids.src @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + + +#include "app.hrc" + + +#define MN_ROW_POSITION \ +MenuItem\ +{\ + Identifier = SID_ROW_POSITION ; \ + HelpID = SID_ROW_POSITION;\ + Text [ de ] = "A~nordnung" ; \ + Text [ en-US ] = "A~rrangement" ; \ + Text[ pt ] = "~Disposição";\ + Text[ ru ] = "РаÑположение";\ + Text[ el ] = "Τακτοποίηση";\ + Text[ nl ] = "~Rangschikking";\ + Text[ fr ] = "~Disposition";\ + Text[ es ] = "~Disposición";\ + Text[ fi ] = "J~ärjestys";\ + Text[ ca ] = "~Organitza";\ + Text[ it ] = "~Disponi";\ + Text[ da ] = "Placering";\ + Text[ sv ] = "~Placering";\ + Text[ pl ] = "~Rozmieszczenie";\ + Text[ pt-BR ] = "Dis~posição";\ + Text[ th ] = "จั~ดเรียง";\ + Text[ ja ] = "é…ç½®(~R)";\ + Text[ ko ] = "배치(~R)";\ + Text[ zh-CN ] = "排åº(~R)";\ + Text[ zh-TW ] = "排åº(~R)";\ + Text[ tr ] = "Düzenleme";\ + Text[ hi-IN ] = "A~rrangement";\ + Text[ ar ] = "الترتيب";\ + Text[ he ] = "A~nordnung";\ + SubMenu = Menu\ + {\ + ItemList = \ + {\ + MenuItem\ + {\ + Identifier = SID_ROW_MOREFRONT ; \ + HelpID = SID_ROW_MOREFRONT;\ + Text [ de ] = "W~eiter nach vorn" ; \ + Text [ en-US ] = "Bring ~Forward" ; \ + Text [ x-comment ] = " ";\ + Text[ pt ] = "~Mais para a frente";\ + Text[ ru ] = "ПеремеÑтить ~вперед";\ + Text[ el ] = "Îœ~εταφοÏά Îνα επίπεδο εμπÏός";\ + Text[ nl ] = "Naar v~oren";\ + Text[ fr ] = "V~ers l'avant";\ + Text[ es ] = "Traer ~adelante";\ + Text[ fi ] = "Siirrä ~eteenpäin";\ + Text[ ca ] = "Porta al ~davant";\ + Text[ it ] = "Porta più avanti";\ + Text[ da ] = "Længere ~fremad";\ + Text[ sv ] = "Längre fra~m";\ + Text[ pl ] = "P~rzesuÅ„ do przodu";\ + Text[ pt-BR ] = "A~vançar";\ + Text[ th ] = "นำไป~ข้างหน้า";\ + Text[ ja ] = "å‰æ–¹ã«ç§»å‹•(~F)";\ + Text[ ko ] = "앞으로 ì´ë™(~F)";\ + Text[ zh-CN ] = "上移一层(~F)";\ + Text[ zh-TW ] = "上移一層(~F)";\ + Text[ tr ] = "~Bir öne getir";\ + Text[ hi-IN ] = "~आगे पà¥à¤°à¤¸à¥à¤¤à¥à¤¤ करना";\ + Text[ ar ] = "Ø¥Øضار أماماً";\ + Text[ he ] = "W~eiter nach vorn";\ + };\ + MenuItem\ + {\ + Identifier = SID_ROW_MOREBACK ; \ + HelpID = SID_ROW_MOREBACK;\ + Text [ de ] = "Weiter ~nach hinten" ; \ + Text [ en-US ] = "Send Back~ward" ; \ + Text [ x-comment ] = " ";\ + Text[ pt ] = "Mais para o f~undo";\ + Text[ ru ] = "ПеремеÑтить ~назад";\ + Text[ el ] = "~ΜεταφοÏά πίσω";\ + Text[ nl ] = "Naar a~chteren";\ + Text[ fr ] = "~Vers l'arrière";\ + Text[ es ] = "Enviar a~trás";\ + Text[ fi ] = "Siirrä taakse~päin";\ + Text[ ca ] = "Envia cap ~enrere";\ + Text[ it ] = "Porta più i~ndietro";\ + Text[ da ] = "Længere ~tilbage";\ + Text[ sv ] = "Längre ba~k";\ + Text[ pl ] = "Pr~zesuÅ„ do tyÅ‚u";\ + Text[ pt-BR ] = "Rec~uar";\ + Text[ th ] = "ส่งà¸à¸¥à¸±à¸šà¸‚้าง~หลัง";\ + Text[ ja ] = "後方ã«ç§»å‹•(~W)";\ + Text[ ko ] = "뒤로 ì´ë™(~W)";\ + Text[ zh-CN ] = "下移一层(~W)";\ + Text[ zh-TW ] = "下移一層(~W)";\ + Text[ tr ] = "Bir alta gönder";\ + Text[ hi-IN ] = "पिछली ~ओर à¤à¥‡à¤œà¥‹";\ + Text[ ar ] = "إرسال خلÙاً";\ + Text[ he ] = "Weiter ~nach hinten";\ + };\ + };\ + };\ +} + \ + +#define MN_TRANSFORM \ + MenuItem\ + {\ + Identifier = SID_ATTR_TRANSFORM ; \ + HelpID = SID_ATTR_TRANSFORM ; \ + Text [ de ] = "P~osition und Größe..." ; \ + Text [ en-US ] = "Position and Si~ze..." ; \ + Text [ x-comment ] = " ";\ + Text[ pt ] = "P~osição e tamanho...";\ + Text[ ru ] = "~ÐŸÐ¾Ð·Ð¸Ñ†Ð¸Ñ Ð¸ размер...";\ + Text[ el ] = "ΘÎση και μÎγεθ~ος...";\ + Text[ nl ] = "~Positie en grootte...";\ + Text[ fr ] = "P~osition et taille...";\ + Text[ es ] = "P~osición y tamaño...";\ + Text[ fi ] = "Sijainti ja ko~ko";\ + Text[ ca ] = "Position and Si~ze...";\ + Text[ it ] = "P~osizione e dimensione...";\ + Text[ da ] = "Pla~cering og størrelse...";\ + Text[ sv ] = "P~osition och storlek...";\ + Text[ pl ] = "~Pozycja i rozmiar...";\ + Text[ pt-BR ] = "P~osi??o e Tamanho...";\ + Text[ th ] = "ตำà¹à¸«à¸™à¹ˆà¸‡à¹à¸¥à¸°à¸‚~นาด...";\ + Text[ ja ] = "ä½ç½®ã¨ã‚µã‚¤ã‚º(~Z)...";\ + Text[ ko ] = "위치 ë° í¬ê¸°(~Z)...";\ + Text[ zh-CN ] = "ä½ç½®å’Œå¤§å°(~Z)...";\ + Text[ zh-TW ] = "ä½ç½®å’Œå¤§å°(~Z)...";\ + Text[ tr ] = "Konum ve ~Boyut";\ + Text[ hi-IN ] = "Position and Si~ze...";\ + Text[ ar ] = "...الموضع والØجم~";\ + Text[ he ] = "P~osition und Größe...";\ + } + +// EOF + + + + + + + + + + + + + + + + + diff --git a/binfilter/bf_sch/source/ui/app/sch_schdll.cxx b/binfilter/bf_sch/source/ui/app/sch_schdll.cxx new file mode 100644 index 000000000000..1a147a17711f --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_schdll.cxx @@ -0,0 +1,311 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svx/svxids.hrc> + +#include "docshell.hxx" +#include "schmod.hxx" +#include "app.hrc" +#include "schresid.hxx" +#include "memchrt.hxx" +#include "res_bmp.hrc" // contains define for RID_MENU, RID_ACCEL + +#include "globopt.hxx" +namespace binfilter { + +/************************************************************************* +|* +|* Initialisierung aus SfxApplicaton::Init() +|* +\************************************************************************/ + +/*N*/ void __EXPORT SchDLL::Init() +/*N*/ { +/*N*/ // called directly after loading the DLL +/*N*/ // do whatever you want, you may use Sd-DLL too +/*N*/ +/*N*/ // the SchModule must be created (may loaded by doc-fac or direct) +/*N*/ SchModuleDummy** ppShlPtr = (SchModuleDummy**) GetAppData(BF_SHL_SCH); +/*N*/ if ( (*ppShlPtr)->IsLoaded() ) return; +/*N*/ +/*N*/ SvFactory* pFact = PTR_CAST(SvFactory,(*ppShlPtr)->pSchChartDocShellFactory); +/*N*/ +/*N*/ delete (*ppShlPtr); +/*N*/ (*ppShlPtr) = new SchModule(pFact); +/*N*/ +/*N*/ SfxModule* pMod = SCH_MOD(); +/*N*/ +/*N*/ pMod->PutItem( SfxUInt16Item( SID_ATTR_METRIC, ::binfilter::sch::util::GetMeasureUnit() )); +/*N*/ } + +/************************************************************************* +|* +|* Deinitialisierung +|* +\************************************************************************/ + +/*N*/ void __EXPORT SchDLL::Exit() +/*N*/ { +/*N*/ // the SchModule must be destroyed +/*N*/ SchModuleDummy** ppShlPtr = (SchModuleDummy**) GetAppData(BF_SHL_SCH); +/*N*/ delete (*ppShlPtr); +/*N*/ (*ppShlPtr) = NULL; +/*N*/ } + + +/*N*/ extern_c void __LOADONCALLAPI SchSetTransparent( SvInPlaceObjectRef aIPObj, BOOL bTransp ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001 +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ extern_c void __LOADONCALLAPI SchUpdate( SvInPlaceObjectRef aIPObj, +/*N*/ SchMemChart* pData, OutputDevice* pOut ) +/*N*/ { +/*N*/ SchChartDocShellRef aSchChartDocShellRef = &aIPObj; +/*N*/ +/*N*/ if( aSchChartDocShellRef.Is() ) +/*N*/ { +/*N*/ #ifdef DBG_UTIL +/*N*/ if( !pData ) +/*N*/ DBG_TRACE( "SchUpdate was called without MemChart" ); +/*N*/ #endif +/*N*/ ChartModel& rDoc = aSchChartDocShellRef->GetDoc(); +/*N*/ +/*N*/ if( pData ) +/*N*/ { +/*N*/ rDoc.SetChartDataBuffered( *pData, FALSE ); // don't update titles. This can't be done via SchUpdate +/*N*/ rDoc.CheckForNewAxisNumFormat(); +/*N*/ rDoc.SetChanged(); // #72576# +/*N*/ +/*N*/ ::com::sun::star::chart::ChartDataChangeEvent aEvent; +/*N*/ aEvent.Type = ::com::sun::star::chart::ChartDataChangeType_ALL; +/*N*/ aEvent.StartColumn = 0; +/*N*/ aEvent.EndColumn = 0; +/*N*/ aEvent.StartRow = 0; +/*N*/ aEvent.EndRow = 0; +/*N*/ +/*N*/ aSchChartDocShellRef->DataModified( aEvent ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ rDoc.BuildChart( FALSE ); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ aIPObj->SendViewChanged(); +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ extern_c void __LOADONCALLAPI SchUpdateAttr( SvInPlaceObjectRef aIPObj, +/*N*/ SchMemChart* pData, +/*N*/ const SfxItemSet& rAttr, +/*N*/ OutputDevice* pOut ) +/*N*/ { +/*N*/ DBG_ASSERT(pData, "Kein Chart-Datenobjekt angegeben!"); +/*N*/ if(!pData)return; +/*N*/ +/*N*/ SchChartDocShellRef aSchChartDocShellRef = &aIPObj; +/*N*/ +/*N*/ if (aSchChartDocShellRef.Is()) +/*N*/ { +/*N*/ +/*N*/ ChartModel& rDoc = aSchChartDocShellRef->GetDoc(); +/*N*/ +/*N*/ rDoc.SetChartData(*new SchMemChart(*pData)); +/*N*/ rDoc.PutAttr(rAttr); +/*N*/ +/*N*/ if( pOut ) +/*N*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 aSchChartDocShellRef->UpdateChart(pOut); +/*N*/ else +/*N*/ rDoc.BuildChart(TRUE); +/*N*/ } +/*N*/ +/*N*/ aIPObj->SendViewChanged(); +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ extern_c SchMemChart* __LOADONCALLAPI SchGetChartData (SvInPlaceObjectRef aIPObj) +/*N*/ { +/*N*/ SchChartDocShellRef aSchChartDocShellRef = &aIPObj; +/*N*/ +/*N*/ if (aSchChartDocShellRef.Is()) +/*N*/ { +/*N*/ ChartModel& rDoc = aSchChartDocShellRef->GetDoc(); +/*N*/ SchMemChart* pMemChart = rDoc.GetChartData (); +/*N*/ +/*N*/ if (pMemChart) +/*N*/ { +/*N*/ pMemChart->SetMainTitle(rDoc.MainTitle()); +/*N*/ pMemChart->SetSubTitle(rDoc.SubTitle()); +/*N*/ pMemChart->SetXAxisTitle(rDoc.XAxisTitle()); +/*N*/ pMemChart->SetYAxisTitle(rDoc.YAxisTitle()); +/*N*/ pMemChart->SetZAxisTitle(rDoc.ZAxisTitle()); +/*N*/ } +/*N*/ +/*N*/ return pMemChart; +/*N*/ } +/*N*/ else return 0; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ extern_c SchMemChart* __LOADONCALLAPI SchNewMemChartNone () +/*N*/ { +/*N*/ DBG_BF_ASSERT(0, "STRIP");return NULL; //STRIP001 return new SchMemChart; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ extern_c SchMemChart* __LOADONCALLAPI SchNewMemChartXY (short nCols, short nRows) +/*N*/ { +/*N*/ return new SchMemChart (nCols, nRows); +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ extern_c SchMemChart* __LOADONCALLAPI SchNewMemChartCopy (const SchMemChart &rMemChart) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return new SchMemChart (rMemChart); +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ extern_c ChartModel* __LOADONCALLAPI SchGetModel (SvInPlaceObjectRef aIPObj) +/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return 0; //STRIP001 +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchGetDefaultForColumnText( +/*N*/ const SchMemChart& rMemChart, sal_Int32 nCol, String& aResult ) +/*N*/ { +/*N*/ aResult = rMemChart.GetDefaultColumnText( nCol ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchGetDefaultForRowText( +/*N*/ const SchMemChart& rMemChart, sal_Int32 nRow, String& aResult ) +/*N*/ { +/*N*/ aResult = rMemChart.GetDefaultRowText( nRow ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchConvertChartRangeForWriter( +/*N*/ SchMemChart& rMemChart, BOOL bOldToNew ) +/*N*/ { +/*N*/ rMemChart.ConvertChartRangeForWriter( bOldToNew ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchConvertChartRangeForCalc( +/*N*/ SchMemChart& rMemChart, BOOL bOldToNew ) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rMemChart.ConvertChartRangeForCalc( bOldToNew ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartResetTranslation( +/*N*/ SchMemChart& rMemChart, long *pTable,long nCnt ) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rMemChart.ResetTranslation( pTable, nCnt ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartUpdateTranslation( +/*N*/ SchMemChart& rMemChart, long *pTable, long nCnt ) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rMemChart.UpdateTranslation( pTable, nCnt ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartInsertCols( SchMemChart& rMemChart, +/*N*/ short nAtCol, short nCount) +/*N*/ { +/*N*/ rMemChart.InsertCols( nAtCol, nCount ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartRemoveCols( SchMemChart& rMemChart, +/*N*/ short nAtCol, short nCount) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rMemChart.RemoveCols( nAtCol, nCount ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartInsertRows( SchMemChart& rMemChart, +/*N*/ short nAtRow, short nCount) +/*N*/ { +/*N*/ rMemChart.InsertRows( nAtRow, nCount ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartRemoveRows( SchMemChart& rMemChart, +/*N*/ short nAtRow, short nCount) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rMemChart.RemoveRows( nAtRow, nCount ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartSwapCols( SchMemChart& rMemChart, +/*N*/ int nAtCol1, int nAtCol2) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rMemChart.SwapCols( nAtCol1, nAtCol2 ); +/*N*/ } + +/*N*/ extern_c void __LOADONCALLAPI SchMemChartSwapRows( SchMemChart& rMemChart, +/*N*/ int nAtRow1,int nAtRow2) +/*N*/ { +/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rMemChart.SwapRows( nAtRow1, nAtRow2 ); +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/app/sch_schlib.cxx b/binfilter/bf_sch/source/ui/app/sch_schlib.cxx new file mode 100644 index 000000000000..843e86dbd0ad --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_schlib.cxx @@ -0,0 +1,340 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifdef _MSC_VER +#pragma optimize("",off) +#endif + + +#include <bf_sfx2/docfilt.hxx> + +#include <bf_sfx2/app.hxx> + +#include <comphelper/classids.hxx> + +#include <sot/formats.hxx> +#include "schmod.hxx" +#include "docshell.hxx" +#include "schlib.hxx" + +class ValueSet; + +#include "res_bmp.hrc" +namespace binfilter { + +#define SCH_FORMAT_STR_50_FORMAT String( RTL_CONSTASCII_USTRINGPARAM( "StarChart 5.0" )) + +/*?*/ TYPEINIT1( SchModuleDummy, SfxModule ); + +extern "C" { static void SAL_CALL thisModule() {} } + +/*?*/ SFX_IMPL_OBJECTFACTORY_LIB( SchChartDocShell, SFXOBJECTSHELL_STD_NORMAL, schart, + SvGlobalName(BF_SO3_SCH_CLASSID), Sch, String( RTL_CONSTASCII_USTRINGPARAM( DLL_NAME )) ) +// from macro: void __EXPORT SchChartDocShell::InitFactory() +/*?*/ { +/*?*/ ULONG nFormat50 = SOT_FORMATSTR_ID_STARCHART_50; +/*?*/ SfxObjectFactory& rFactory = (SfxObjectFactory&)Factory(); +/*?*/ rFactory.SetDocumentServiceName(String::CreateFromAscii("com.sun.star.chart.ChartDocument")); +/*?*/ } + +/************************************************************************* +|* +|* Konstruktor +|* +\************************************************************************/ + +/*?*/ SchDLL::SchDLL() +/*?*/ { +/*?*/ } + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +/*?*/ SchDLL::~SchDLL() +/*?*/ { +/*?*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + +/*?*/ void SchDLL::LibInit() +/*?*/ { +/*?*/ // Das Anlegen des ResMgr ist nur fuer die obige Filter-Registierung +/*?*/ // notwendig. Sobald dort kein SdResId mehr notwendig ist, kann das +/*?*/ // Anlegen entfallen +/*?*/ SchChartDocShell::RegisterFactory(SDT_SCH_DOCFACTPRIO); +/*?*/ +/*?*/ SCH_MOD() = (SchModule *) new SchModuleDummy(NULL, TRUE, &SchChartDocShell::Factory() ); +/*?*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + +/*?*/ void SchDLL::LibExit() +/*?*/ { +/*?*/ FreeLibSch(); +/*?*/ +/*?*/ // destroy the dummy-module with Object-Factory-Pointer +/*?*/ DELETEZ( SCH_MOD() ); +/*?*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + +/*N*/ void __EXPORT SchDLL::Update( SvInPlaceObjectRef aIPObj, SchMemChart* pData, OutputDevice* pOut ) +/*N*/ { +/*N*/ void (__LOADONCALLAPI*fp)(SvInPlaceObjectRef, SchMemChart*, OutputDevice*); +/*N*/ +/*N*/ fp = (void (__LOADONCALLAPI*)(SvInPlaceObjectRef, SchMemChart*, OutputDevice*))GetFuncSch("SchUpdate"); +/*N*/ +/*N*/ if (fp) +/*N*/ { +/*N*/ fp(aIPObj, pData, pOut); +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + +/*N*/ SchMemChart* __EXPORT SchDLL::GetChartData (SvInPlaceObjectRef aIPObj) +/*N*/ { +/*N*/ SchMemChart* (__LOADONCALLAPI*fp)(SvInPlaceObjectRef); +/*N*/ +/*N*/ fp = (SchMemChart* (__LOADONCALLAPI*)(SvInPlaceObjectRef aIPObj))GetFuncSch("SchGetChartData"); +/*N*/ +/*N*/ return fp +/*N*/ ? fp (aIPObj) +/*N*/ : 0; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ SchMemChart* __EXPORT SchDLL::NewMemChart (short nCols, short nRows) +/*N*/ { +/*N*/ SchMemChart* (__LOADONCALLAPI*fp)(short, short); +/*N*/ +/*N*/ fp = (SchMemChart* (__LOADONCALLAPI*)(short, short))GetFuncSch("SchNewMemChartXY"); +/*N*/ +/*N*/ if (fp) +/*N*/ { +/*N*/ return fp(nCols, nRows); +/*N*/ } +/*N*/ else return 0; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ void __EXPORT SchDLL::GetDefaultForColumnText( const SchMemChart& rMemChart, sal_Int32 nCol, String& aResult ) +/*N*/ { +/*N*/ void (__LOADONCALLAPI*fp)( const SchMemChart&, sal_Int32, String& ); +/*N*/ +/*N*/ fp = (void (__LOADONCALLAPI*)( const SchMemChart&, sal_Int32, String& ))GetFuncSch("SchGetDefaultForColumnText"); +/*N*/ +/*N*/ if( fp ) +/*N*/ { +/*N*/ fp( rMemChart, nCol, aResult ); +/*N*/ } +/*N*/ } + +/*N*/ void __EXPORT SchDLL::GetDefaultForRowText( const SchMemChart& rMemChart, sal_Int32 nRow, String& aResult ) +/*N*/ { +/*N*/ void (__LOADONCALLAPI*fp)( const SchMemChart&, sal_Int32, String& ); +/*N*/ +/*N*/ fp = (void (__LOADONCALLAPI*)( const SchMemChart&, sal_Int32, String& ))GetFuncSch("SchGetDefaultForRowText"); +/*N*/ +/*N*/ if( fp ) +/*N*/ { +/*N*/ fp( rMemChart, nRow, aResult ); +/*N*/ } +/*N*/ } + +/*N*/ void __EXPORT SchDLL::ConvertChartRangeForWriter( SchMemChart& rMemChart, +/*N*/ BOOL bOldToNew ) +/*N*/ { +/*N*/ void (__LOADONCALLAPI* fp )( SchMemChart&, BOOL ) +/*N*/ = (void (__LOADONCALLAPI*)( SchMemChart&, BOOL )) +/*N*/ GetFuncSch("SchConvertChartRangeForWriter"); +/*N*/ if( fp ) +/*N*/ fp( rMemChart, bOldToNew ); +/*N*/ } + +/*N*/ void __EXPORT SchDLL::MemChartInsertCols( SchMemChart& rMemChart, +/*N*/ short nAtCol, short nCount) +/*N*/ { +/*N*/ void (__LOADONCALLAPI* fp )( SchMemChart&, short, short ) +/*N*/ = (void (__LOADONCALLAPI*)( SchMemChart&, short, short )) +/*N*/ GetFuncSch("SchMemChartInsertCols"); +/*N*/ if( fp ) +/*N*/ fp( rMemChart, nAtCol, nCount ); +/*N*/ } +/*?*/ void __EXPORT SchDLL::MemChartRemoveCols( SchMemChart& rMemChart, +/*?*/ short nAtCol, short nCount) +/*?*/ { +/*?*/ void (__LOADONCALLAPI* fp )( SchMemChart&, short, short ) +/*?*/ = (void (__LOADONCALLAPI*)( SchMemChart&, short, short )) +/*?*/ GetFuncSch("SchMemChartRemoveCols"); +/*?*/ if( fp ) +/*?*/ fp( rMemChart, nAtCol, nCount ); +/*?*/ } + +/*N*/ void __EXPORT SchDLL::MemChartInsertRows( SchMemChart& rMemChart, +/*N*/ short nAtRow, short nCount ) +/*N*/ { +/*N*/ void (__LOADONCALLAPI* fp )( SchMemChart&, short, short ) +/*N*/ = (void (__LOADONCALLAPI*)( SchMemChart&, short, short )) +/*N*/ GetFuncSch("SchMemChartInsertRows"); +/*N*/ if( fp ) +/*N*/ fp( rMemChart, nAtRow, nCount ); +/*N*/ } +/*?*/ void __EXPORT SchDLL::MemChartRemoveRows( SchMemChart& rMemChart, +/*?*/ short nAtRow, short nCount ) +/*?*/ { +/*?*/ void (__LOADONCALLAPI* fp )( SchMemChart&, short, short ) +/*?*/ = (void (__LOADONCALLAPI*)( SchMemChart&, short, short )) +/*?*/ GetFuncSch("SchMemChartRemoveRows"); +/*?*/ if( fp ) +/*?*/ fp( rMemChart, nAtRow, nCount ); +/*?*/ } + +/************************************************************************* +|* +|* Lade Module von aussen +|* +\************************************************************************/ + +/*?*/ SfxModule *SchModuleDummy::Load() +/*?*/ { +/*?*/ return (LoadLibSch() ? SCH_MOD() : NULL); +/*?*/ } + +/************************************************************************* +|* +|* Bestimme die GUID abh. von der Version +|* +\************************************************************************/ + +/*?*/ const SvGlobalName SchModuleDummy::GetID (USHORT nFileFormat) +/*?*/ { +/*?*/ SvGlobalName aName; +/*?*/ +/*?*/ switch (nFileFormat) +/*?*/ { +/*?*/ case SOFFICE_FILEFORMAT_60: +/*?*/ { +/*?*/ aName = SvGlobalName(BF_SO3_SCH_CLASSID_60); +/*?*/ } +/*?*/ break; +/*?*/ +/*?*/ case SOFFICE_FILEFORMAT_50: +/*?*/ { +/*?*/ aName = SvGlobalName(BF_SO3_SCH_CLASSID_50); +/*?*/ } +/*?*/ break; +/*?*/ +/*?*/ case SOFFICE_FILEFORMAT_40: +/*?*/ { +/*?*/ aName = SvGlobalName(BF_SO3_SCH_CLASSID_40); +/*?*/ } +/*?*/ break; +/*?*/ +/*?*/ case SOFFICE_FILEFORMAT_31: +/*?*/ { +/*?*/ aName = SvGlobalName(BF_SO3_SCH_CLASSID_30); +/*?*/ } +/*?*/ break; +/*?*/ +/*?*/ default: +/*?*/ { +/*?*/ DBG_ERROR( "Unknown file format" ); +/*?*/ } +/*?*/ break; +/*?*/ } +/*?*/ +/*?*/ return aName; +/*?*/ } + +/************************************************************************* +|* +|* Bestimme die Version aus der GUID +|* +\************************************************************************/ + +/*?*/ USHORT SchModuleDummy::HasID (const SvGlobalName &rName) +/*?*/ { +/*?*/ USHORT nRet = 0; +/*?*/ +/*?*/ if (GetID(SOFFICE_FILEFORMAT_31) == rName) +/*?*/ { +/*?*/ nRet = SOFFICE_FILEFORMAT_31; +/*?*/ } +/*?*/ else if (GetID(SOFFICE_FILEFORMAT_40) == rName) +/*?*/ { +/*?*/ nRet = SOFFICE_FILEFORMAT_40; +/*?*/ } +/*?*/ else if (GetID(SOFFICE_FILEFORMAT_50) == rName) +/*?*/ { +/*?*/ nRet = SOFFICE_FILEFORMAT_50; +/*?*/ } +/*?*/ else if (GetID(SOFFICE_FILEFORMAT_60) == rName) +/*?*/ { +/*?*/ nRet = SOFFICE_FILEFORMAT_60; +/*?*/ } +/*?*/ +/*?*/ return(nRet); +/*?*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/app/sch_schmod.cxx b/binfilter/bf_sch/source/ui/app/sch_schmod.cxx new file mode 100644 index 000000000000..fe8ca7261715 --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_schmod.cxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define ITEMID_SEARCH SID_SEARCH_ITEM + +#ifdef _MSC_VER +#pragma hdrstop +#endif + + +#include <bf_svx/svxids.hrc> +#include <bf_sfx2/app.hxx> +#include <vcl/status.hxx> +#include <bf_svx/svdobj.hxx> + +#define _SCH_DLL // fuer SD_MOD() +#include "schmod.hxx" +#include "schresid.hxx" + +#include "app.hrc" +#include "glob.hrc" +#include "strings.hrc" +#include "res_bmp.hrc" + +namespace binfilter { + +/*N*/ TYPEINIT1( SchModuleDummy, SfxModule ); +/*N*/ TYPEINIT1( SchModule, SchModuleDummy ); + +/************************************************************************* +|* +|* Ctor +|* +\************************************************************************/ + +/*N*/ SchModule::SchModule(SvFactory* pObjFact) : +/*N*/ SchModuleDummy(SFX_APP()->CreateResManager("bf_sch"), FALSE, pObjFact), //STRIP005 +/*N*/ pXOutDevPool( NULL ), +/*N*/ pDragData( NULL ), +/*N*/ pClipboardData( NULL ), +/*N*/ mpTransferDragDrop( NULL ), +/*N*/ mpTransferClipboard( NULL ), +/*N*/ mpTransferSelectionClipbd( NULL ), +/*N*/ pChartOptions( NULL ) +/*N*/ { +/*N*/ pSchObjFactory = new SchObjFactory(); +/*N*/ +/*N*/ if (!pSchObjFactory->GetInserted()) +/*N*/ { +/*N*/ SdrObjFactory::InsertMakeObjectHdl(LINK(pSchObjFactory, SchObjFactory, MakeObject)); +/*N*/ SdrObjFactory::InsertMakeUserDataHdl(LINK(pSchObjFactory, SchObjFactory, MakeUserData)); +/*N*/ +/*N*/ pSchObjFactory->SetInserted(TRUE); +/*N*/ } +/*N*/ +/*N*/ // #62493# this factory exists already +/*N*/ //pE3dFactory = new E3dObjFactory(); +/*N*/ //SdrObjFactory::InsertMakeObjectHdl(LINK(pE3dFactory, E3dObjFactory, MakeObject)); +/*N*/ +/*N*/ SetName( String( RTL_CONSTASCII_USTRINGPARAM( "StarChart" )) ); +/*N*/ +/*N*/ // establish listener, so that the module is informed +/*N*/ // right before the application is going to be shut down +/*N*/ StartListening( *SFX_APP() ); +/*N*/ } + +/************************************************************************* +|* +|* Dtor +|* +\************************************************************************/ + +/*N*/ SchModule::~SchModule() +/*N*/ { +/*N*/ if (pSchObjFactory) +/*N*/ { +/*N*/ if (pSchObjFactory->GetInserted()) +/*N*/ { +/*N*/ SdrObjFactory::RemoveMakeObjectHdl(LINK(pSchObjFactory, SchObjFactory, MakeObject)); +/*N*/ SdrObjFactory::RemoveMakeUserDataHdl(LINK(pSchObjFactory, SchObjFactory, MakeUserData)); +/*N*/ } +/*N*/ +/*N*/ delete pSchObjFactory; +/*N*/ } +/*N*/ } + + +/*?*/ SfxModule *SchModuleDummy::Load() +/*?*/ { +/*?*/ return NULL; +/*?*/ } + +/*N*/ SchOptions* SchModule::GetSchOptions() +/*N*/ { +/*N*/ if( ! pChartOptions ) +/*N*/ pChartOptions = new SchOptions(); +/*N*/ +/*N*/ return pChartOptions; +/*N*/ } + +/************************************************************************* +|* +|* get notifications +|* +\************************************************************************/ + +/*N*/ void SchModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +/*N*/ { +/*N*/ if( rHint.ISA( SfxSimpleHint ) && +/*N*/ ( (SfxSimpleHint&) rHint ).GetId() == SFX_HINT_DEINITIALIZING ) +/*N*/ { +/*N*/ delete pChartOptions, pChartOptions = NULL; +/*N*/ } +/*N*/ } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/app/sch_schopt.cxx b/binfilter/bf_sch/source/ui/app/sch_schopt.cxx new file mode 100644 index 000000000000..deb0dd1f1362 --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_schopt.cxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <com/sun/star/uno/Sequence.hxx> +// header for SvStream +// header for SAL_STATIC_CAST +#include <sal/types.h> + +#include "schopt.hxx" + +#include "schresid.hxx" +#include "strings.hrc" +namespace binfilter { + +using namespace ::com::sun::star; + +#define SCH_OPTIONS_VERSION_001 USHORT( 1 ) + + +// -------------------- +// class SchColorTable +// -------------------- +/*N*/ SchColorTable::SchColorTable() +/*N*/ { +/*N*/ } + + +/*N*/ BOOL SchColorTable::Insert( ULONG nKey, XColorEntry* pEntry ) +/*N*/ { +/*N*/ return Table::Insert( nKey, (void*)pEntry ); +/*N*/ } + + + +/*N*/ void SchColorTable::ClearAndDestroy() +/*N*/ { +/*N*/ for( ULONG i = Count(); i; ) +/*N*/ delete Get( --i ); +/*N*/ Clear(); +/*N*/ } + +/*N*/ XColorEntry* SchColorTable::Get( ULONG nKey ) const +/*N*/ { +/*N*/ return SAL_STATIC_CAST( XColorEntry*, Table::Get( nKey ) ); +/*N*/ } + +/*N*/ Color SchColorTable::GetColor( ULONG nKey ) const +/*N*/ { +/*N*/ XColorEntry* pEntry = Get( nKey ); +/*N*/ if( pEntry ) +/*N*/ return pEntry->GetColor(); +/*N*/ +/*N*/ return COL_BLACK; +/*N*/ } + +/*N*/ ColorData SchColorTable::GetColorData( ULONG nKey ) const +/*N*/ { +/*N*/ return GetColor( nKey ).GetRGBColor(); +/*N*/ } + + +// ==================== +// class SchOptions +// ==================== + +/*N*/ SchOptions::SchOptions() : +/*N*/ ::utl::ConfigItem( ::rtl::OUString::createFromAscii( "Office.Chart" )), +/*N*/ mbIsInitialized( FALSE ) +/*N*/ { +/*N*/ maPropertyNames.realloc( 1 ); +/*N*/ maPropertyNames[ 0 ] = ::rtl::OUString::createFromAscii( "DefaultColor/Series" ); +/*N*/ } + +/*N*/ SchOptions::~SchOptions() +/*N*/ { +/*N*/ maDefColors.ClearAndDestroy(); +/*N*/ } + +/*N*/ const SchColorTable& SchOptions::GetDefaultColors() +/*N*/ { +/*N*/ if( ! mbIsInitialized ) +/*N*/ { +/*N*/ mbIsInitialized = RetrieveOptions(); +/*N*/ } +/*N*/ +/*N*/ return maDefColors; +/*N*/ } + + +/*N*/ BOOL SchOptions::RetrieveOptions() +/*N*/ { +/*N*/ // get sequence containing all properties +/*N*/ +/*N*/ uno::Sequence< ::rtl::OUString > aNames = GetPropertyNames(); +/*N*/ uno::Sequence< uno::Any > aProperties( aNames.getLength()); +/*N*/ aProperties = GetProperties( aNames ); +/*N*/ +/*N*/ if( aProperties.getLength() == aNames.getLength()) +/*N*/ { +/*N*/ // 1. default colors for series +/*N*/ maDefColors.ClearAndDestroy(); +/*N*/ uno::Sequence< sal_Int64 > aColorSeq; +/*N*/ aProperties[ 0 ] >>= aColorSeq; +/*N*/ +/*N*/ sal_Int32 nCount = aColorSeq.getLength(); +/*N*/ Color aCol; +/*N*/ +/*N*/ // create strings for entry names +/*N*/ String aResName( SchResId( STR_DIAGRAM_ROW )); +/*N*/ String aPrefix, aPostfix, aName; +/*N*/ xub_StrLen nPos = aResName.SearchAscii( "$(ROW)" ); +/*N*/ if( nPos != STRING_NOTFOUND ) +/*N*/ { +/*N*/ aPrefix = String( aResName, 0, nPos ); +/*N*/ aPostfix = String( aResName, nPos + sizeof( "$(ROW)" ) - 1, STRING_LEN ); +/*N*/ } +/*N*/ else +/*?*/ aPrefix = aResName; +/*N*/ +/*N*/ // set color values +/*N*/ for( sal_Int32 i=0; i < nCount; i++ ) +/*N*/ { +/*N*/ aCol.SetColor( SAL_STATIC_CAST( ColorData, aColorSeq[ i ] )); +/*N*/ +/*N*/ aName = aPrefix; +/*N*/ aName.Append( String::CreateFromInt32( i + 1 )); +/*N*/ aName.Append( aPostfix ); +/*N*/ +/*N*/ maDefColors.Insert( i, new XColorEntry( aCol, aName ) ); +/*N*/ } +/*N*/ return TRUE; +/*N*/ } +/*N*/ return FALSE; +/*N*/ } + +void SchOptions::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ) {} +void SchOptions::Commit() {} + + +// -------------------- +// class SchColorTableItem +// -------------------- + + + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/app/sch_schresid.cxx b/binfilter/bf_sch/source/ui/app/sch_schresid.cxx new file mode 100644 index 000000000000..5a5e038e7d74 --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_schresid.cxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include "schmod.hxx" +#include "schresid.hxx" +namespace binfilter { + + +/************************************************************************* +|* +|* Funktionsbeschreibung +|* +\************************************************************************/ + +/*N*/ SchResId::SchResId(USHORT nId) : +/*N*/ ResId( nId, *SCH_MOD1()->GetResMgr() ) +/*N*/ { +/*N*/ } + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/app/sch_strings.src b/binfilter/bf_sch/source/ui/app/sch_strings.src new file mode 100644 index 000000000000..67946f8eed6a --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_strings.src @@ -0,0 +1,1058 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT + +#include "strings.hrc" +String RID_BUILDVERSION +{ + Text [ de ] = UPDVER ; + Text [ en-US ] = UPDVER ; +}; +String STR_AREA +{ + Text [ de ] = "Fläche" ; + Text [ en-US ] = "Area" ; + Text[ pt ] = "Preenchimento"; + Text[ ru ] = "ОблаÑÑ‚ÑŒ"; + Text[ el ] = "Επιφάνεια"; + Text[ nl ] = "Vlak"; + Text[ fr ] = "Remplissage"; + Text[ es ] = "Ãrea"; + Text[ fi ] = "Alue"; + Text[ ca ] = "Àrea"; + Text[ it ] = "Area"; + Text[ da ] = "OmrÃ¥de"; + Text[ sv ] = "Yta"; + Text[ pl ] = "Obszar"; + Text[ pt-BR ] = "Ãrea"; + Text[ th ] = "พื้นที่"; + Text[ ja ] = "エリア"; + Text[ ko ] = "ì˜ì—"; + Text[ zh-CN ] = "å……å¡«å¹³é¢"; + Text[ zh-TW ] = "å……å¡«å¹³é¢"; + Text[ tr ] = "Yüzey"; + Text[ hi-IN ] = "विसà¥à¤¤à¥€à¤°à¥à¤£"; + Text[ ar ] = "تعبئة الكائن"; + Text[ he ] = "Fläche"; +}; +String STR_LINE +{ + Text [ de ] = "Linie" ; + Text [ en-US ] = "Line" ; + Text[ pt ] = "Linha"; + Text[ ru ] = "ЛиниÑ"; + Text[ el ] = "ΓÏαμμή"; + Text[ nl ] = "Lijn"; + Text[ fr ] = "Ligne"; + Text[ es ] = "LÃnea"; + Text[ fi ] = "Viiva"; + Text[ ca ] = "LÃnia"; + Text[ it ] = "Linea"; + Text[ da ] = "Linje"; + Text[ sv ] = "Linje"; + Text[ pl ] = "Linia"; + Text[ pt-BR ] = "Linha"; + Text[ th ] = "บรรทัด"; + Text[ ja ] = "折れ線"; + Text[ ko ] = "ì„ "; + Text[ zh-CN ] = "线æ¡"; + Text[ zh-TW ] = "ç·šæ¢"; + Text[ tr ] = "Çizgi"; + Text[ hi-IN ] = "Line"; + Text[ ar ] = "خط"; + Text[ he ] = "Linie"; +}; +String STR_LINES +{ + Text [ de ] = "Linien" ; + Text [ en-US ] = "Lines" ; + Text[ pt ] = "Linhas"; + Text[ ru ] = "Линии"; + Text[ el ] = "ΓÏαμμÎÏ‚"; + Text[ nl ] = "Lijnen"; + Text[ fr ] = "Lignes"; + Text[ es ] = "LÃneas"; + Text[ fi ] = "Rivit"; + Text[ ca ] = "LÃnies"; + Text[ it ] = "Linee"; + Text[ da ] = "Linjer"; + Text[ sv ] = "Linjer"; + Text[ pl ] = "Linie"; + Text[ pt-BR ] = "Linhas"; + Text[ th ] = "บรรทัด"; + Text[ ja ] = "折れ線"; + Text[ ko ] = "ì„ "; + Text[ zh-CN ] = "线æ¡"; + Text[ zh-TW ] = "ç·šæ¢"; + Text[ tr ] = "Çizgi"; + Text[ hi-IN ] = "Lines"; + Text[ ar ] = "خطوط"; + Text[ he ] = "Linien"; +}; +String STR_COLUMNS +{ + Text [ de ] = "Säulen" ; + Text [ en-US ] = "Columns" ; + Text[ pt ] = "Barras"; + Text[ ru ] = "ГиÑтограмма"; + Text[ el ] = "Στήλες"; + Text[ nl ] = "kolommen"; + Text[ fr ] = "Colonnes"; + Text[ es ] = "Columnas"; + Text[ fi ] = "Pylväs"; + Text[ ca ] = "Columnes"; + Text[ it ] = "Colonne"; + Text[ da ] = "Søjler"; + Text[ sv ] = "Staplar"; + Text[ pl ] = "Kolumny"; + Text[ pt-BR ] = "Colunas"; + Text[ th ] = "คà¸à¸¥à¸±à¸¡à¸™à¹Œà¹Œ"; + Text[ ja ] = "縦棒"; + Text[ ko ] = "단"; + Text[ zh-CN ] = "柱"; + Text[ zh-TW ] = "柱"; + Text[ tr ] = "Sütun"; + Text[ hi-IN ] = "सà¥à¤¤à¤‚à¤"; + Text[ ar ] = "أعمدة"; + Text[ he ] = "‮טורי×‬"; +}; +String STR_BARS +{ + Text [ de ] = "Balken" ; + Text [ en-US ] = "Bars" ; + Text [ x-comment ] = "èëè: Ïîëîñû - -"; + Text[ pt ] = "Barras"; + Text[ ru ] = "ЛинейчатаÑ"; + Text[ el ] = "Ράβδοι"; + Text[ nl ] = "balken"; + Text[ fr ] = "Barres"; + Text[ es ] = "Barras"; + Text[ fi ] = "Palkit"; + Text[ ca ] = "Barres"; + Text[ it ] = "Barre"; + Text[ da ] = "Liggende søjler"; + Text[ sv ] = "Liggande staplar"; + Text[ pl ] = "SÅ‚upki"; + Text[ pt-BR ] = "Barras"; + Text[ th ] = "à¹à¸–บ"; + Text[ ja ] = "横棒"; + Text[ ko ] = "ë°”"; + Text[ zh-CN ] = "æ¡"; + Text[ zh-TW ] = "æ¢"; + Text[ tr ] = "Çubuk"; + Text[ hi-IN ] = "पटà¥à¤Ÿà¥€"; + Text[ ar ] = "أعمدة"; + Text[ he ] = "Balken"; +}; +String STR_AREAS +{ + Text [ de ] = "Flächen" ; + Text [ en-US ] = "Areas" ; + Text[ pt ] = "Ãreas"; + Text[ ru ] = "ОблаÑти"; + Text[ el ] = "Επιφάνειες"; + Text[ nl ] = "vlakken"; + Text[ fr ] = "Zones"; + Text[ es ] = "Ãreas"; + Text[ fi ] = "Alueet"; + Text[ ca ] = "Àrees"; + Text[ it ] = "Aree"; + Text[ da ] = "OmrÃ¥der"; + Text[ sv ] = "Ytor"; + Text[ pl ] = "Obszary"; + Text[ pt-BR ] = "Ãreas"; + Text[ th ] = "พื้นที่"; + Text[ ja ] = "エリア"; + Text[ ko ] = "ë©´"; + Text[ zh-CN ] = "å¹³é¢"; + Text[ zh-TW ] = "å¹³é¢"; + Text[ tr ] = "Yüzey"; + Text[ hi-IN ] = "विसà¥à¤¤à¥€à¤°à¥à¤£"; + Text[ ar ] = "مناطق"; + Text[ he ] = "Flächen"; +}; +String STR_CIRCLES +{ + Text [ de ] = "Kreise" ; + Text [ en-US ] = "Pies" ; + Text[ pt ] = "Sectores"; + Text[ ru ] = "КруговаÑ"; + Text[ el ] = "ΚÏκλοι"; + Text[ nl ] = "cirkels"; + Text[ fr ] = "Secteurs"; + Text[ es ] = "CÃrculos"; + Text[ fi ] = "Ympyräkaaviot"; + Text[ ca ] = "Diagrames de sectors"; + Text[ it ] = "Torta"; + Text[ da ] = "Cirkler"; + Text[ sv ] = "Cirklar"; + Text[ pl ] = "KoÅ‚a"; + Text[ pt-BR ] = "Pizzas"; + Text[ th ] = "พาย"; + Text[ ja ] = "円"; + Text[ ko ] = "ì›í˜•"; + Text[ zh-CN ] = "圆"; + Text[ zh-TW ] = "圓"; + Text[ tr ] = "Daire"; + Text[ hi-IN ] = "वृतखणà¥à¤¡"; + Text[ ar ] = "دوائر"; + Text[ he ] = "Kreise"; +}; +String STR_XY +{ + Text [ de ] = "XY-Diagramm" ; + Text [ en-US ] = "XY Chart" ; + Text[ pt ] = "Gráfico XY"; + Text[ ru ] = "Диаграмма XY"; + Text[ el ] = "ΔιάγÏαμμα XY"; + Text[ nl ] = "XY-diagram"; + Text[ fr ] = "Diagramme XY"; + Text[ es ] = "Diagrama XY"; + Text[ fi ] = "XY-kaavio"; + Text[ ca ] = "Diagrama XY"; + Text[ it ] = "Diagramma XY"; + Text[ da ] = "XY-diagram"; + Text[ sv ] = "XY-diagram"; + Text[ pl ] = "Wykres XY"; + Text[ pt-BR ] = "Gráfico XY"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิXY "; + Text[ ja ] = "散布図"; + Text[ ko ] = "XY 차트"; + Text[ zh-CN ] = "XY 图表"; + Text[ zh-TW ] = "XY-圖表"; + Text[ tr ] = "XY ÅŸeması"; + Text[ hi-IN ] = "XY चारà¥à¤Ÿ"; + Text[ ar ] = "رسم بياني س ص"; + Text[ he ] = "XY-Diagramm"; +}; +String STR_XYZ +{ + Text [ de ] = "XYZ-Diagramm" ; + Text [ en-US ] = "XYZ Chart" ; + Text[ pt ] = "Gráfico XYZ"; + Text[ ru ] = "Диаграмма XYZ"; + Text[ el ] = "ΔιάγÏαμμα XYZ"; + Text[ nl ] = "XYZ-diagram"; + Text[ fr ] = "Diagramme XYZ"; + Text[ es ] = "Diagrama XYZ"; + Text[ fi ] = "XYZ-kaavio"; + Text[ ca ] = "Diagrama XYZ"; + Text[ it ] = "Diagramma XYZ"; + Text[ da ] = "XYZ-diagram"; + Text[ sv ] = "XYZ-diagram"; + Text[ pl ] = "Wykres XYZ"; + Text[ pt-BR ] = "Gráfico XYZ"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิXYZ "; + Text[ ja ] = "XYZ軸図表"; + Text[ ko ] = "XYZ 차트"; + Text[ zh-CN ] = "XYZ 图表"; + Text[ zh-TW ] = "XYZ-圖表"; + Text[ tr ] = "XYZ ÅŸeması"; + Text[ hi-IN ] = "XYZ चारà¥à¤Ÿ "; + Text[ ar ] = "رسم بياني س ص ع"; + Text[ he ] = "XYZ-Diagramm"; +}; +String STR_NORMAL +{ + Text [ de ] = "Normal" ; + Text [ en-US ] = "Normal" ; + Text[ pt ] = "Normal"; + Text[ ru ] = "ОбычнаÑ"; + Text[ el ] = "Κανονικά"; + Text[ nl ] = "Normaal"; + Text[ fr ] = "Normal"; + Text[ es ] = "Normal"; + Text[ fi ] = "Normaali"; + Text[ ca ] = "Normal"; + Text[ it ] = "Normale"; + Text[ da ] = "Normal"; + Text[ sv ] = "Normal"; + Text[ pl ] = "ZwykÅ‚y"; + Text[ pt-BR ] = "Normal"; + Text[ th ] = "ปà¸à¸•à¸´"; + Text[ ja ] = "標準"; + Text[ ko ] = "표준"; + Text[ zh-CN ] = "一般"; + Text[ zh-TW ] = "一般"; + Text[ tr ] = "Normal"; + Text[ hi-IN ] = "नॉरà¥à¤®à¤²à¥"; + Text[ ar ] = "عادية"; + Text[ he ] = "Normal"; +}; +String STR_STACKED +{ + Text [ de ] = "Gestapelt" ; + Text [ en-US ] = "Stacked" ; + Text[ pt ] = "Empilhado"; + Text[ ru ] = "С накоплением"; + Text[ el ] = "Σε στοίβα"; + Text[ nl ] = "Gestapeld"; + Text[ fr ] = "Empilé"; + Text[ es ] = "En pilas"; + Text[ fi ] = "Pinottuna"; + Text[ ca ] = "Apilat"; + Text[ it ] = "Sovrapposto"; + Text[ da ] = "Stablet"; + Text[ sv ] = "Staplat"; + Text[ pl ] = "Skumulowany"; + Text[ pt-BR ] = "Empilhado"; + Text[ th ] = "à¸à¸à¸‡à¸‹à¹‰à¸à¸™"; + Text[ ja ] = "ç©ã¿ä¸Šã’"; + Text[ ko ] = "누ì ëœ"; + Text[ zh-CN ] = "é‡å "; + Text[ zh-TW ] = "é‡ç–Š"; + Text[ tr ] = "Yığılmış"; + Text[ hi-IN ] = "Stacked"; + Text[ ar ] = "متراكمة"; + Text[ he ] = "Gestapelt"; +}; +String STR_PERCENT +{ + Text [ de ] = "Prozent" ; + Text [ en-US ] = "Percent" ; + Text[ pt ] = "Percentual"; + Text[ ru ] = "ПроцентнаÑ"; + Text[ el ] = "Ποσοστό (%)"; + Text[ nl ] = "Procent"; + Text[ fr ] = "Pourcentage"; + Text[ es ] = "Porcentaje"; + Text[ fi ] = "Prosenttia"; + Text[ ca ] = "Percentatge"; + Text[ it ] = "Percentuale"; + Text[ da ] = "Procent"; + Text[ sv ] = "Procent"; + Text[ pl ] = "Procent"; + Text[ pt-BR ] = "Percentual"; + Text[ th ] = "เปà¸à¸£à¹Œà¹€à¸‹à¹‡à¸™à¸•à¹Œ"; + Text[ ja ] = "パーセント"; + Text[ ko ] = "백분율"; + Text[ zh-CN ] = "百分比"; + Text[ zh-TW ] = "百分比"; + Text[ tr ] = "Yüzde"; + Text[ hi-IN ] = "पà¥à¤°à¤¤à¤¿à¤¶à¤¤"; + Text[ ar ] = "النسبة المئوية"; + Text[ he ] = "Prozent"; +}; + +String STR_DEEP +{ + Text [ de ] = "Tief" ; + Text [ en-US ] = "Deep" ; + Text[ pt ] = "Fundo"; + Text[ ru ] = "Глубина"; + Text[ el ] = "Σε βάθος"; + Text[ nl ] = "met diepte"; + Text[ fr ] = "Profond"; + Text[ es ] = "Profundidad"; + Text[ fi ] = "Syvyys"; + Text[ ca ] = "Profund"; + Text[ it ] = "In profondità "; + Text[ da ] = "Dyb"; + Text[ sv ] = "Djup"; + Text[ pl ] = "GÅ‚Ä™boki"; + Text[ pt-BR ] = "Profundo"; + Text[ th ] = "ลึà¸"; + Text[ ja ] = "奥行ãã‚ã‚Š"; + Text[ ko ] = "깊ì´"; + Text[ zh-CN ] = "深度"; + Text[ zh-TW ] = "深度"; + Text[ tr ] = "Derin"; + Text[ hi-IN ] = "गहरा"; + Text[ ar ] = "عميقة"; + Text[ he ] = "Tief"; +}; + +String STR_2D +{ + Text [ de ] = "2D-" ; + Text [ en-US ] = "2D " ; + Text[ pt ] = "2D-"; + Text[ ru ] = "ДвумернаÑ"; + Text[ el ] = "2Δ-"; + Text[ nl ] = "2D-"; + Text[ fr ] = "2D-"; + Text[ es ] = "2D-"; + Text[ fi ] = "Kaksiulotteinen "; + Text[ ca ] = "2D "; + Text[ it ] = "2D-"; + Text[ da ] = "2D-"; + Text[ sv ] = "2D-"; + Text[ pl ] = "2D"; + Text[ pt-BR ] = "2D-"; + Text[ th ] = "2มิติ "; + Text[ ja ] = "2D"; + Text[ ko ] = "2D"; + Text[ zh-CN ] = "2 ç»´"; + Text[ zh-TW ] = "å¹³é¢"; + Text[ tr ] = "2B-"; + Text[ hi-IN ] = "2D "; + Text[ ar ] = "ثنائي الأبعاد"; + Text[ he ] = "2D-"; +}; +String STR_3D +{ + Text [ de ] = "3D-" ; + Text [ en-US ] = "3D " ; + Text[ pt ] = "3D-"; + Text[ ru ] = "ТрехмернаÑ"; + Text[ el ] = "3Δ-"; + Text[ nl ] = "3D-"; + Text[ fr ] = "3D-"; + Text[ es ] = "3D-"; + Text[ fi ] = "Kolmiulotteisuus "; + Text[ ca ] = "3D "; + Text[ it ] = "3D-"; + Text[ da ] = "3D-"; + Text[ sv ] = "3D-"; + Text[ pl ] = "3D"; + Text[ pt-BR ] = "3D-"; + Text[ th ] = "3มิติ "; + Text[ ja ] = "3D"; + Text[ ko ] = "3D"; + Text[ zh-CN ] = "3 ç»´"; + Text[ zh-TW ] = "3D"; + Text[ tr ] = "3B-"; + Text[ hi-IN ] = "3D "; + Text[ ar ] = "ثلاثي الأبعاد"; + Text[ he ] = "3D-"; +}; +String STR_DIAGRAM +{ + Text [ de ] = "Diagramm" ; + Text [ en-US ] = "Chart" ; + Text[ pt ] = "Gráfico"; + Text[ ru ] = "Диаграмма"; + Text[ el ] = "ΔιάγÏαμμα"; + Text[ nl ] = "Diagram"; + Text[ fr ] = "Diagramme"; + Text[ es ] = "Diagrama"; + Text[ fi ] = "Kaavio"; + Text[ ca ] = "Diagrama"; + Text[ it ] = "Diagramma"; + Text[ da ] = "Diagram"; + Text[ sv ] = "Diagram"; + Text[ pl ] = "Wykres"; + Text[ pt-BR ] = "Gráfico"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิ"; + Text[ ja ] = "グラフ"; + Text[ ko ] = "차트"; + Text[ zh-CN ] = "图表"; + Text[ zh-TW ] = "圖表"; + Text[ tr ] = "Åžema"; + Text[ hi-IN ] = "चारà¥à¤Ÿ "; + Text[ ar ] = "رسم بياني"; + Text[ he ] = "‮תרשי×‬"; +}; +String STR_DIAGRAM_ROW +{ + // $(ROW) can be a number or the caption of the row in quotes + Text [ de ] = "Datenreihe $(ROW)" ; + Text [ en-US ] = "Data Series $(ROW)" ; + Text[ pt ] = "Série de dados $(ROW)"; + Text[ ru ] = "Ð Ñд данных $(ROW)"; + Text[ el ] = "ΓÏαμμή δεδομÎνων $(ROW)"; + Text[ nl ] = "Gegevensreeks $(ROW)"; + Text[ fr ] = "Série de données $(ROW)"; + Text[ es ] = "Serie de datos $(ROW)"; + Text[ fi ] = "Tietojoukot $(ROW)"; + Text[ ca ] = "Sèrie de dades $(ROW)"; + Text[ it ] = "Serie di dati $(ROW)"; + Text[ da ] = "Dataserie $(ROW)"; + Text[ sv ] = "Dataserie $(ROW)"; + Text[ pl ] = "Seria danych $(ROW)"; + Text[ pt-BR ] = "Série de Dados $(ROW)"; + Text[ th ] = "ชุดข้à¸à¸¡à¸¹à¸¥ $(ROW)"; + Text[ ja ] = "系列$(ROW)"; + Text[ ko ] = "ì—°ì† ë°ì´í„° $(ROW)"; + Text[ zh-CN ] = "æ•°æ®ç»„ $(ROW)"; + Text[ zh-TW ] = "資料欄 $(ROW)"; + Text[ tr ] = "Veri dizisi $(ROW)"; + Text[ hi-IN ] = "ड़ॉटा शà¥à¤°à¥ƒà¤‚खला $(पकà¥à¤¤à¤¿à¤‚)"; + Text[ ar ] = "ص٠البيانات $(ROW)"; + Text[ he ] = "Datenreihe $(ROW)"; +}; + + + +String STR_DEFAULTVIEW +{ + Text [ de ] = "Default" ; + Text [ en-US ] = "Default" ; + Text[ pt ] = "Padrão"; + Text[ ru ] = "Стандарт"; + Text[ el ] = "Î Ïοεπιλογή"; + Text[ nl ] = "Standaard"; + Text[ fr ] = "Défaut"; + Text[ es ] = "Predeterminado"; + Text[ fi ] = "Oletus"; + Text[ ca ] = "Per defecte"; + Text[ it ] = "Predefinito"; + Text[ da ] = "Standard"; + Text[ sv ] = "Standard"; + Text[ pl ] = "DomyÅ›lnie"; + Text[ pt-BR ] = "Padrão"; + Text[ th ] = "ค่าเริ่มต้น"; + Text[ ja ] = "標準"; + Text[ ko ] = "기본값"; + Text[ zh-CN ] = "默认"; + Text[ zh-TW ] = "默èª"; + Text[ tr ] = "Standart"; + Text[ hi-IN ] = "अनà¥à¤ªà¤¸à¥à¤¥à¤¿à¤¤à¤¿"; + Text[ ar ] = "اÙتراضي"; + Text[ he ] = "‮ברירת מחדל‬"; +}; + +String STR_OPEN_DOCUMENT +{ + Text [ de ] = "Dokument laden" ; + Text [ en-US ] = "Load document" ; + Text[ pt ] = "Carregar documento"; + Text[ ru ] = "Загрузить документ"; + Text[ el ] = "ΦόÏτωση εγγÏάφου"; + Text[ nl ] = "Document laden"; + Text[ fr ] = "Charger un document"; + Text[ es ] = "Cargar documento"; + Text[ fi ] = "Lataa asiakirja"; + Text[ ca ] = "Carrega el document"; + Text[ it ] = "Apri documento"; + Text[ da ] = "Indlæs dokument"; + Text[ sv ] = "Ladda dokument"; + Text[ pl ] = "Åaduj dokument"; + Text[ pt-BR ] = "Carregar documento"; + Text[ th ] = "โหลดเà¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントをèªã¿è¾¼ã‚€"; + Text[ ko ] = "문서 로드"; + Text[ zh-CN ] = "装入文档"; + Text[ zh-TW ] = "載入文件"; + Text[ tr ] = "Belge yükle"; + Text[ hi-IN ] = "Load document"; + Text[ ar ] = "تØميل المستند"; + Text[ he ] = "â€®×˜×¢×™× ×ª מסמך‬"; +}; +String STR_SAVE_DOCUMENT +{ + Text [ en-US ] = "Save document"; + Text [ de ] = "Dokument speichern" ; + Text [ en-US ] = "Save document" ; + Text [ de ] = "Dokument speichern" ; + Text[ pt ] = "Guardar documento"; + Text[ ru ] = "Сохранить документ"; + Text[ el ] = "Αποθήκευση εγγÏάφου"; + Text[ nl ] = "Document opslaan"; + Text[ fr ] = "Enregistrer le document"; + Text[ es ] = "Guardar documento"; + Text[ fi ] = "Tallenna asiakirja"; + Text[ ca ] = "Desa el document"; + Text[ it ] = "Salva documento"; + Text[ da ] = "Gem dokument"; + Text[ sv ] = "Spara dokument"; + Text[ pl ] = "Zapisz dokument"; + Text[ pt-BR ] = "Salvar documento"; + Text[ th ] = "บันทึà¸à¹€à¸à¸à¸ªà¸²à¸£"; + Text[ ja ] = "ドã‚ュメントã®ä¿å˜"; + Text[ ko ] = "문서 ì €ìž¥"; + Text[ zh-CN ] = "å˜ç›˜æ–‡æ¡£"; + Text[ zh-TW ] = "儲å˜æ–‡ä»¶"; + Text[ tr ] = "Belgeyi kaydet"; + Text[ hi-IN ] = "लेखपतà¥à¤° संचित करो"; + Text[ ar ] = "ØÙظ المستند"; + Text[ he ] = "Dokument speichern"; +}; +String STR_GRAPHIC +{ + Text [ de ] = "Chart" ; + Text [ en-US ] = "Chart" ; + Text[ pt ] = "Chart"; + Text[ ru ] = "Диаграмма"; + Text[ el ] = "ΔιάγÏαμμα"; + Text[ nl ] = "Chart"; + Text[ fr ] = "Diagramme"; + Text[ es ] = "Diagrama"; + Text[ fi ] = "Kaavio"; + Text[ ca ] = "Diagrama"; + Text[ it ] = "Diagramma"; + Text[ da ] = "Diagram"; + Text[ sv ] = "Chart"; + Text[ pl ] = "Wykres"; + Text[ pt-BR ] = "Gráfico"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิ"; + Text[ ja ] = "グラフ"; + Text[ ko ] = "차트"; + Text[ zh-CN ] = "图表"; + Text[ zh-TW ] = "圖表"; + Text[ tr ] = "Åžema"; + Text[ hi-IN ] = "चारà¥à¤Ÿ"; + Text[ ar ] = "رسم بياني"; + Text[ he ] = "‮תרשי×‬"; +}; +String STR_CHART_DOCUMENT +{ + Text [ de ] = "Diagramm" ; + Text [ en-US ] = "Chart" ; + Text[ pt ] = "Gráfico"; + Text[ ru ] = "Диаграмма"; + Text[ el ] = "ΔιάγÏαμμα"; + Text[ nl ] = "Diagram"; + Text[ fr ] = "Diagramme"; + Text[ es ] = "Diagrama"; + Text[ fi ] = "Kaavio"; + Text[ ca ] = "Diagrama"; + Text[ it ] = "Diagramma"; + Text[ da ] = "Diagram"; + Text[ sv ] = "Diagram"; + Text[ pl ] = "Wykres"; + Text[ pt-BR ] = "Gráfico"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิ"; + Text[ ja ] = "グラフ"; + Text[ ko ] = "차트"; + Text[ zh-CN ] = "图表"; + Text[ zh-TW ] = "圖表"; + Text[ tr ] = "Åžema"; + Text[ hi-IN ] = "चारà¥à¤Ÿ"; + Text[ ar ] = "رسم بياني"; + Text[ he ] = "‮תרשי×‬"; +}; +String STR_CHART_DOCUMENT_FULLTYPE_60 +{ + Text [ de ] = "%PRODUCTNAME 6.0 Diagramm" ; + Text [ en-US ] = "%PRODUCTNAME 6.0 Chart" ; + Text[ pt ] = "%PRODUCTNAME 6.0 Gráfico"; + Text[ ru ] = "Диаграмма %PRODUCTNAME 6.0"; + Text[ el ] = "%PRODUCTNAME 6.0 ΔιάγÏαμμα"; + Text[ nl ] = "%PRODUCTNAME 6.0 Diagram"; + Text[ fr ] = "%PRODUCTNAME 6.0 Diagramme"; + Text[ es ] = "%PRODUCTNAME 6.0 - Diagrama"; + Text[ fi ] = "%PRODUCTNAME 6.0 Chart"; + Text[ ca ] = "%PRODUCTNAME 6.0 Diagrama"; + Text[ it ] = "%PRODUCTNAME 6.0 Diagramma"; + Text[ da ] = "%PRODUCTNAME 6.0-diagram"; + Text[ sv ] = "%PRODUCTNAME 6.0 Diagram"; + Text[ pl ] = "%PRODUCTNAME 6.0 Chart"; + Text[ pt-BR ] = "%PRODUCTNAME 6.0 Chart"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิ%PRODUCTNAME 6.0 "; + Text[ ja ] = "%PRODUCTNAME 6.0 グラフ"; + Text[ ko ] = "%PRODUCTNAME 6.0 차트"; + Text[ zh-CN ] = "%PRODUCTNAME 6.0 图表"; + Text[ zh-TW ] = "%PRODUCTNAME 6.0 圖表"; + Text[ tr ] = "%PRODUCTNAME 6.0 Çizelgesi"; + Text[ hi-IN ] = "%PRODUCTNAME 6.0 चारà¥à¤Ÿ"; + Text[ ar ] = "رسم بياني %PRODUCTNAME 6.0"; + Text[ he ] = "%PRODUCTNAME 6.0 Diagramm"; +}; +String STR_CHART_DOCUMENT_FULLTYPE_50 +{ + Text [ de ] = "%PRODUCTNAME 5.0 Diagramm" ; + Text [ en-US ] = "%PRODUCTNAME 5.0 Chart" ; + Text[ pt ] = "Gráfico (%PRODUCTNAME 5.0)"; + Text[ ru ] = "Диаграмма %PRODUCTNAME 5.0"; + Text[ el ] = "ΔιάγÏαμμα (%PRODUCTNAME 5.0)"; + Text[ nl ] = "%PRODUCTNAME 5.0 diagram"; + Text[ fr ] = "%PRODUCTNAME 5.0 Diagramme"; + Text[ es ] = "%PRODUCTNAME 5.0 - Diagrama"; + Text[ fi ] = "%PRODUCTNAME 5.0 Chart"; + Text[ ca ] = "%PRODUCTNAME 5.0 Diagrama"; + Text[ it ] = "Diagramma %PRODUCTNAME 5.0"; + Text[ da ] = "%PRODUCTNAME 5.0 diagram"; + Text[ sv ] = "%PRODUCTNAME 5.0 Diagram"; + Text[ pl ] = "%PRODUCTNAME 5.0 Chart"; + Text[ pt-BR ] = "%PRODUCTNAME 5.0 Chart"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิ%PRODUCTNAME 5.0 "; + Text[ ja ] = "%PRODUCTNAME 5.0 グラフ"; + Text[ ko ] = "%PRODUCTNAME 5.0 차트"; + Text[ zh-CN ] = "%PRODUCTNAME 5.0 图表"; + Text[ zh-TW ] = "%PRODUCTNAME 5.0 圖表"; + Text[ tr ] = "%PRODUCTNAME 5.0 ÅŸeması"; + Text[ hi-IN ] = "%PRODUCTNAME 5.0 चारà¥à¤Ÿ"; + Text[ ar ] = "رسم بياني %PRODUCTNAME 5.0"; + Text[ he ] = "%PRODUCTNAME 5.0 Diagramm"; +}; +String STR_CHART_DOCUMENT_FULLTYPE_40 +{ + Text [ de ] = "%PRODUCTNAME 4.0 Diagramm" ; + Text [ en-US ] = "%PRODUCTNAME 4.0 Chart" ; + Text[ pt ] = "Gráfico (%PRODUCTNAME 4.0)"; + Text[ ru ] = "Диаграмма %PRODUCTNAME 4.0"; + Text[ el ] = "ΔιάγÏαμμα (%PRODUCTNAME 4.0)"; + Text[ nl ] = "%PRODUCTNAME 4.0 diagram"; + Text[ fr ] = "%PRODUCTNAME 4.0 Diagramme"; + Text[ es ] = "%PRODUCTNAME 4.0 - Diagrama"; + Text[ fi ] = "%PRODUCTNAME 4.0 Chart"; + Text[ ca ] = "%PRODUCTNAME 4.0 Diagrama"; + Text[ it ] = "Diagramma %PRODUCTNAME 4.0"; + Text[ da ] = "%PRODUCTNAME 4.0 diagram"; + Text[ sv ] = "%PRODUCTNAME 4.0 Diagram"; + Text[ pl ] = "%PRODUCTNAME 4.0 Chart"; + Text[ pt-BR ] = "%PRODUCTNAME 4.0 Chart"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิ%PRODUCTNAME 4.0 "; + Text[ ja ] = "%PRODUCTNAME 4.0 グラフ"; + Text[ ko ] = "%PRODUCTNAME 4.0 차트"; + Text[ zh-CN ] = "%PRODUCTNAME 4.0 图表"; + Text[ zh-TW ] = "%PRODUCTNAME 4.0 圖表"; + Text[ tr ] = "%PRODUCTNAME 4.0 ÅŸeması"; + Text[ hi-IN ] = "%PRODUCTNAME 4.0 चारà¥à¤Ÿ"; + Text[ ar ] = "رسم بياني %PRODUCTNAME 4.0"; + Text[ he ] = "%PRODUCTNAME 4.0 Diagramm"; +}; +String STR_CHART_DOCUMENT_FULLTYPE_31 +{ + Text [ de ] = "%PRODUCTNAME 3.0 Diagramm" ; + Text [ en-US ] = "%PRODUCTNAME 3.0 Chart" ; + Text[ pt ] = "Gráfico (%PRODUCTNAME 3.0)"; + Text[ ru ] = "Диаграмма %PRODUCTNAME 3.0"; + Text[ el ] = "ΔιάγÏαμμα (%PRODUCTNAME 3.0)"; + Text[ nl ] = "%PRODUCTNAME 3.0 diagram"; + Text[ fr ] = "%PRODUCTNAME 3.0 Diagramme"; + Text[ es ] = "%PRODUCTNAME 3.0 - Diagrama"; + Text[ fi ] = "%PRODUCTNAME 3.0 Chart"; + Text[ ca ] = "%PRODUCTNAME 3.0 Diagrama"; + Text[ it ] = "Diagramma %PRODUCTNAME 3.0"; + Text[ da ] = "%PRODUCTNAME 3.0 diagram"; + Text[ sv ] = "%PRODUCTNAME 3.0 Diagram"; + Text[ pl ] = "%PRODUCTNAME 3.0 Chart"; + Text[ pt-BR ] = "%PRODUCTNAME 3.0 Chart"; + Text[ th ] = "à¹à¸œà¸™à¸ ูมิ%PRODUCTNAME 3.0 "; + Text[ ja ] = "%PRODUCTNAME 3.0 グラフ"; + Text[ ko ] = "%PRODUCTNAME 3.0 차트"; + Text[ zh-CN ] = "%PRODUCTNAME 3.0 图表"; + Text[ zh-TW ] = "%PRODUCTNAME 3.0 圖表"; + Text[ tr ] = "%PRODUCTNAME 3.0 ÅŸeması"; + Text[ hi-IN ] = "%PRODUCTNAME 3.0 चारà¥à¤Ÿ"; + Text[ ar ] = "رسم بياني %PRODUCTNAME 3.0"; + Text[ he ] = "%PRODUCTNAME 3.0 Diagramm"; +}; +String STR_BAD_PASSWORD_OR_FILE_CORRUPTED +{ + Text [ de ] = "Das Kennwort ist falsch oder die Datei beschädigt." ; + Text [ en-US ] = "The password is incorrect or the file is damaged." ; + Text[ pt ] = "Ou a senha está incorrecta ou o ficheiro danificado."; + Text[ ru ] = "Ðеправильный пароль или файл поврежден."; + Text[ el ] = "Ο κωδικός Ï€Ïόσβασης είναι εσφαλμÎνος ή το αÏχείο ελαττωματικό."; + Text[ nl ] = "Het wachtwoord is niet juist of het bestand is beschadigd"; + Text[ fr ] = "Le mot de passe est incorrect ou le fichier est défectueux."; + Text[ es ] = "La contraseña no es válida o el archivo está dañado."; + Text[ fi ] = "Salasana on virheellinen tai tiedosto on vahingoittunut."; + Text[ ca ] = "La contrasenya no és correcta o el fitxer està danyat."; + Text[ it ] = "La password è errata o il file è danneggiato."; + Text[ da ] = "Adgangskoden er forkert eller filen er beskadiget."; + Text[ sv ] = "Lösenordet är felaktigt eller filen skadad."; + Text[ pl ] = "NieprawidÅ‚owe hasÅ‚o lub uszkodzony plik."; + Text[ pt-BR ] = "A senha é invalida ou o arquivo está corrompido."; + Text[ th ] = "รหัสผ่านไม่ถูà¸à¸•à¹‰à¸à¸‡à¸«à¸£à¸·à¸à¹à¸Ÿà¹‰à¸¡à¹€à¸ªà¸µà¸¢à¸«à¸²à¸¢"; + Text[ ja ] = "パスワードãŒé–“é•ã£ã¦ã„ã‚‹ã‹ã€ã¾ãŸã¯ãƒ•ã‚¡ã‚¤ãƒ«ã«å•é¡ŒãŒã‚ã‚Šã¾ã™ã€‚"; + Text[ ko ] = "암호가 틀리거나 파ì¼ì´ ì†ìƒë˜ì—ˆìŠµë‹ˆë‹¤."; + Text[ zh-CN ] = "æ— æ•ˆçš„å¯†ç 或文件已ç»è¢«æŸå。"; + Text[ zh-TW ] = "無效的密碼或檔案已經被æ壞。"; + Text[ tr ] = "Åžifre yanlış veya dosya zarar görmüş."; + Text[ hi-IN ] = "The password is incorrect or the file is damaged."; + Text[ ar ] = "إما أن كلمة السر غير صØÙŠØØ© أو أن المل٠تالÙ."; + Text[ he ] = "Das Kennwort ist falsch oder die Datei beschädigt."; +}; + + +String STR_REGRESSION_LINEAR +{ + Text [ de ] = "Lineare Regression" ; + Text [ en-US ] = "Linear regression" ; + Text[ pt ] = "Regressão linear"; + Text[ ru ] = "Ð›Ð¸Ð½ÐµÐ¹Ð½Ð°Ñ Ñ€ÐµÐ³Ñ€ÐµÑÑиÑ"; + Text[ el ] = "ΓÏαμμική παλινδÏόμηση"; + Text[ nl ] = "Lineaire regressie"; + Text[ fr ] = "Régression linéaire"; + Text[ es ] = "Regresión lineal"; + Text[ fi ] = "Lineaarinen regressio"; + Text[ ca ] = "Regressió lineal"; + Text[ it ] = "Regressione lineare"; + Text[ da ] = "Lineær regression"; + Text[ sv ] = "Linjär regression"; + Text[ pl ] = "Regresja liniowa"; + Text[ pt-BR ] = "Regressão linear"; + Text[ th ] = "ถดถà¸à¸¢à¹à¸šà¸šà¹€à¸ªà¹‰à¸™à¸•à¸£à¸‡"; + Text[ ja ] = "線形回帰"; + Text[ ko ] = "ì„ íšŒê·€ì„ "; + Text[ zh-CN ] = "ç‰å·®å›žå½’"; + Text[ zh-TW ] = "ç‰å·®å›žæ¸"; + Text[ tr ] = "DoÄŸrusal regresyon"; + Text[ hi-IN ] = "Linear regression"; + Text[ ar ] = "انØدار خطي"; + Text[ he ] = "Lineare Regression"; +}; +String STR_REGRESSION_LOG +{ + Text [ de ] = "Logarithmische Regression" ; + Text [ en-US ] = "Logarithm regression" ; + Text[ pt ] = "Regressão logarÃtmica"; + Text[ ru ] = "ЛогарифмичеÑÐºÐ°Ñ Ñ€ÐµÐ³Ñ€ÐµÑÑиÑ"; + Text[ el ] = "ΛογαÏιθμική παλινδÏόμηση"; + Text[ nl ] = "Logaritmische regressie"; + Text[ fr ] = "Régression logarithmique"; + Text[ es ] = "Regresión logarÃtmica"; + Text[ fi ] = "Logaritminen regressio"; + Text[ ca ] = "Regressió logarÃtmica"; + Text[ it ] = "Regressione logaritmica"; + Text[ da ] = "Logaritmisk regression"; + Text[ sv ] = "Logaritmisk regression"; + Text[ pl ] = "Regresja logarytmiczna"; + Text[ pt-BR ] = "Regressão logarÃtmica"; + Text[ th ] = "ถดถà¸à¸¢à¹à¸šà¸šà¸¥à¸à¸à¸²à¸£à¸´à¸˜à¸¶à¸¡"; + Text[ ja ] = "対数ã®å›žå¸°"; + Text[ ko ] = "로그 íšŒê·€ì„ "; + Text[ zh-CN ] = "对数回归"; + Text[ zh-TW ] = "å°æ•¸å›žæ¸"; + Text[ tr ] = "Logaritmik regresyon"; + Text[ hi-IN ] = "लघà¥à¤—णक रिगà¥à¤°à¥‡à¤¶à¥à¤¯à¤¨"; + Text[ ar ] = "انØدار لوغاريتمي"; + Text[ he ] = "Logarithmische Regression"; +}; +String STR_REGRESSION_EXP +{ + Text [ de ] = "Exponentielle Regression" ; + Text [ en-US ] = "Exponential Regression" ; + Text[ pt ] = "Regressão exponencial"; + Text[ ru ] = "ÐкÑÐ¿Ð¾Ð½ÐµÐ½Ñ†Ð¸Ð°Ð»ÑŒÐ½Ð°Ñ Ñ€ÐµÐ³Ñ€ÐµÑÑиÑ"; + Text[ el ] = "Εκθετική παλινδÏόμηση"; + Text[ nl ] = "Exponentiële regressie"; + Text[ fr ] = "Régression exponentielle"; + Text[ es ] = "Regresión exponencial"; + Text[ fi ] = "Eksponentiaalinen regressio"; + Text[ ca ] = "Regressió exponencial"; + Text[ it ] = "Regressione esponenziale"; + Text[ da ] = "Eksponentiel regression"; + Text[ sv ] = "Exponentiell regression"; + Text[ pl ] = "Regresja wykÅ‚adnicza"; + Text[ pt-BR ] = "Regressão exponencial"; + Text[ th ] = "ถดถà¸à¸¢à¹à¸šà¸šà¹€à¸à¹‡à¸à¸‹à¹Œà¹‚ปเนนเชียล"; + Text[ ja ] = "指数ã®å›žå¸°"; + Text[ ko ] = "지수 íšŒê·€ì„ "; + Text[ zh-CN ] = "指数回归"; + Text[ zh-TW ] = "指數回æ¸"; + Text[ tr ] = "Ãœstel regresyon"; + Text[ hi-IN ] = "Exponential Regression"; + Text[ ar ] = "انØدار أسي"; + Text[ he ] = "Exponentielle Regression"; +}; +String STR_REGRESSION_POWER +{ + Text [ de ] = "Potenzielle Regression" ; + Text [ en-US ] = "Power regression" ; + Text[ pt ] = "Regressão potencial"; + Text[ ru ] = "ÐŸÐ¾Ñ‚ÐµÐ½Ñ†Ð¸Ð°Ð»ÑŒÐ½Ð°Ñ Ñ€ÐµÐ³Ñ€ÐµÑÑиÑ"; + Text[ el ] = "Δυναμική παλινδÏόμηση"; + Text[ nl ] = "Potentiële regressie"; + Text[ fr ] = "Régression potentielle"; + Text[ es ] = "Regresión potencial"; + Text[ fi ] = "Polynomiregressio"; + Text[ ca ] = "Regressió potencial"; + Text[ it ] = "Regressione potenziale"; + Text[ da ] = "Potentiel regression"; + Text[ sv ] = "Potentiell regression"; + Text[ pl ] = "Regresja potÄ™gowa"; + Text[ pt-BR ] = "Regressão de potência"; + Text[ th ] = "à¸à¸³à¸¥à¸±à¸‡à¸à¸²à¸£à¸–ดถà¸à¸¢"; + Text[ ja ] = "乗羃ã®å›žå¸°"; + Text[ ko ] = "í¼í…ì…œíšŒê·€ì„ "; + Text[ zh-CN ] = "ä½èƒ½å›žå½’"; + Text[ zh-TW ] = "指數回æ¸"; + Text[ tr ] = "Kuvvet regresyonu"; + Text[ hi-IN ] = "पवर रिगà¥à¤°à¥‡à¤¶à¥à¤¯à¤¨"; + Text[ ar ] = "انØدار القدرة"; + Text[ he ] = "Potenzielle Regression"; +}; + +String STR_STATISTICS_IN_LEGEND +{ + // comment + Text [ x-comment ] = "BM: This determines how a statistics string (STR_REGRESSION_...) appears in the legend, e.g. in german \"Lineare Regression, Spalte 3\" will appear for \"$(STATTYP), $(ROWNAME)\""; + // comment + Text [ de ] = "$(STATTYP), $(ROWNAME)"; + Text [ en-US ] = "$(STATTYP), $(ROWNAME) " ; + Text[ pt ] = "$(STATTYP), $(ROWNAME)"; + Text[ ru ] = "$(STATTYP), $(ROWNAME)"; + Text[ el ] = "$(STATTYP), $(ROWNAME)"; + Text[ nl ] = "$(STATTYP), $(ROWNAME)"; + Text[ fr ] = "$(STATTYP), $(ROWNAME)"; + Text[ es ] = "$(STATTYP), $(ROWNAME)"; + Text[ fi ] = "$(STATTYP), $(ROWNAME) "; + Text[ ca ] = "$(STATTYP), $(ROWNAME) "; + Text[ it ] = "$(STATTYP), $(ROWNAME)"; + Text[ da ] = "$(STATTYP), $(ROWNAME)"; + Text[ sv ] = "$(STATTYP), $(ROWNAME)"; + Text[ pl ] = "$(STATTYP), $(ROWNAME)"; + Text[ pt-BR ] = "$(STATTYP), $(ROWNAME)"; + Text[ th ] = "$(STATTYP), $(ROWNAME) "; + Text[ ja ] = "$(STATTYP)ã€$(ROWNAME)"; + Text[ ko ] = "$(STATTYP), $(ROWNAME)"; + Text[ zh-CN ] = "$(STATTYP), $(ROWNAME)"; + Text[ zh-TW ] = "$(STATTYP), $(ROWNAME)"; + Text[ tr ] = "$(STATTYP), $(ROWNAME)"; + Text[ hi-IN ] = "$(STATTYP), $(ROWNAME) "; + Text[ ar ] = "$(STATTYP), $(ROWNAME)"; + Text[ he ] = "$(STATTYP), $(ROWNAME) "; +}; + + + + + +//----------------------------------- + +//----------------------------------- + +//----------------------------------- + +//----------------------------------- +//----------------------------------- +//----------------------------------- + + +// some strings merged using arguments now + + + + +// some more strings for QuickHelp + + + + + + + + + + + +//----------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/binfilter/bf_sch/source/ui/app/sch_typemap.cxx b/binfilter/bf_sch/source/ui/app/sch_typemap.cxx new file mode 100644 index 000000000000..2d2aa21748c3 --- /dev/null +++ b/binfilter/bf_sch/source/ui/app/sch_typemap.cxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifdef _MSC_VER +#pragma hdrstop +#endif + +#include <bf_svx/eeitem.hxx> + +#include "eetext.hxx" +#include <bf_svx/fontitem.hxx> +#include <bf_svx/postitem.hxx> +#include <bf_svx/wghtitem.hxx> +#include <bf_svx/shdditem.hxx> +#include <bf_svx/cntritem.hxx> +#include <bf_svx/crsditem.hxx> +#include <bf_svx/udlnitem.hxx> +#include <bf_svx/fhgtitem.hxx> +#include <bf_svx/colritem.hxx> + +#include <bf_svx/svxids.hrc> + +#define ITEMID_FMTSPLIT 0 +#define ITEMID_PAGEMODEL 0 +#include "eetext.hxx" + +#define ITEMID_LINE 0 +#define ITEMID_BRUSH 0 +#define ITEMID_FMTBREAK 0 +#define ITEMID_FMTKEEP 0 +#define ITEMID_SIZE 0 +#include <bf_svx/sizeitem.hxx> + +#define ITEMID_PAGE 0 + + +#include <bf_svtools/stritem.hxx> + +#define ITEMID_AUTHOR 0 +#define ITEMID_DATE 0 +#define ITEMID_TEXT 0 + +#define ITEMID_SEARCH 0 + +#define ITEMID_HORJUSTIFY 0 +#define ITEMID_VERJUSTIFY 0 +#define ITEMID_ORIENTATION 0 + +#include <bf_svx/zoomitem.hxx> + +#define ITEMID_CHARTSTYLE 0 +#include <bf_svx/chrtitem.hxx> + +#include <bf_sfx2/msg.hxx> + +namespace binfilter { + +/*?*/ typedef SfxVoidItem CharSetItem; +/*?*/ typedef SfxVoidItem FontFamilyItem; +/*?*/ typedef SfxVoidItem FontPitchItem; +/*?*/ typedef SfxVoidItem FontAlignItem; +/*?*/ typedef SfxVoidItem FontWeightItem; +/*?*/ typedef SfxVoidItem FontUnderlineItem; +/*?*/ typedef SfxVoidItem FontStrikeoutItem; +/*?*/ typedef SfxVoidItem FontItalicItem; +/*?*/ typedef SfxVoidItem SvxDbTypeItem; +/*?*/ typedef SfxVoidItem SvxLineSpaceItem; +/*?*/ typedef SfxVoidItem SvxInterLineSpaceItem; +/*?*/ typedef SfxVoidItem SvxBreakItem; +/*?*/ typedef SfxVoidItem BrushStyleItem; +/*?*/ typedef SfxVoidItem SvxNumTypeItem; +/*?*/ typedef SfxVoidItem SvxShadowLocationItem; +/*?*/ typedef SfxVoidItem SvxChooseControlEnumItem; +/*?*/ typedef SfxVoidItem SvxDrawToolEnumItem; +/*?*/ typedef SfxVoidItem SvxChooseControlItem; +/*?*/ typedef SfxVoidItem SvxDrawToolItem; +/*?*/ typedef SfxVoidItem SvxCellHorJustifyEnumItem; +/*?*/ typedef SfxVoidItem SvxCellVerJustifyEnumItem; +/*?*/ typedef SfxVoidItem SvxCellOrientationEnumItem; +/*?*/ typedef SfxEnumItem SvxStyleTypeItem; + +#define SFX_TYPEMAP +#include "schslots.hxx" + + + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/docshell/makefile.mk b/binfilter/bf_sch/source/ui/docshell/makefile.mk new file mode 100644 index 000000000000..4b572861acb5 --- /dev/null +++ b/binfilter/bf_sch/source/ui/docshell/makefile.mk @@ -0,0 +1,61 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PROJECTPCH=sch +PROJECTPCHSOURCE=$(BFPRJ)$/util$/sch_sch + +PRJNAME=binfilter +TARGET=sch_docshell + +#GEN_HID=TRUE +#GEN_HID_OTHER=TRUE +NO_HIDS=TRUE + +ENABLE_EXCEPTIONS = TRUE + +# --- Settings ----------------------------------------------------- +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sch +# --- Files -------------------------------------------------------- + +CXXFILES = $(BFPRJ)$/util$/sch_sch.cxx \ + sch_docshell.cxx \ + sch_docshel1.cxx + +SLOFILES = \ + $(SLO)$/sch_docshell.obj \ + $(SLO)$/sch_docshel1.obj + + +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sch/source/ui/docshell/sch_docshel1.cxx b/binfilter/bf_sch/source/ui/docshell/sch_docshel1.cxx new file mode 100644 index 000000000000..9109aef3388f --- /dev/null +++ b/binfilter/bf_sch/source/ui/docshell/sch_docshel1.cxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_SVXIDS_HRC +#define ITEMID_FONTLIST SID_ATTR_CHAR_FONTLIST +#define ITEMID_NUMBERINFO SID_ATTR_NUMBERFORMAT_INFO +#define ITEMID_COLOR_TABLE SID_COLOR_TABLE +#define ITEMID_GRADIENT_LIST SID_GRADIENT_LIST +#define ITEMID_HATCH_LIST SID_HATCH_LIST +#define ITEMID_BITMAP_LIST SID_BITMAP_LIST +#define ITEMID_DASH_LIST SID_DASH_LIST +#define ITEMID_LINEEND_LIST SID_LINEEND_LIST +#include <bf_svx/svxids.hrc> +#endif + +#include <bf_sfx2/app.hxx> + +#include "app.hrc" +#include "strings.hrc" +#include "res_bmp.hrc" +#include "docshell.hxx" + +namespace binfilter { + +/************************************************************************* +|* +|* Zeichnen der DocShell (mittels der Hilfsklasse SchViewSpecial) +|* +\************************************************************************/ + + + + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Bitmap der StyleFamily zurueckgeben (zunaechst Dummy) +|* +\************************************************************************/ + +/*N*/ SfxStyleSheetBasePool* SchChartDocShell::GetStyleSheetPool() throw() +/*N*/ { +/*N*/ return (SfxStyleSheetBasePool*)pChDoc->GetStyleSheetPool(); +/*N*/ } + +/************************************************************************* +|* +|* Vorlage einfuegen (zunaechst nur Dummy) +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Vorlage entfernen (zunaechst nur Dummy) +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Chart updaten +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ Rectangle SchChartDocShell::GetVisArea(USHORT nAspect) const throw() +/*N*/ { +/*N*/ return SfxInPlaceObject::GetVisArea((nAspect == ASPECT_THUMBNAIL) ? +/*N*/ ASPECT_CONTENT : nAspect); +/*N*/ } + +/************************************************************************* +|* +|* VisArea fuer InPlace setzen +|* +\************************************************************************/ + +/*N*/ void SchChartDocShell::SetVisArea(const Rectangle& rRect) throw() +/*N*/ { +/*N*/ Rectangle aRect(rRect); +/*N*/ aRect.SetPos(Point(0, 0)); +/*N*/ +/*N*/ if( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +/*N*/ { +/*N*/ // sets the modified flag +/*N*/ SfxInPlaceObject::SetVisArea( rRect ); +/*N*/ +/*N*/ // #107434# propagate modified status to changed status at model +/*N*/ if( pChDoc && IsModified() ) +/*N*/ pChDoc->SetChanged( TRUE ); +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ // does not set the modified flag +/*?*/ SvEmbeddedObject::SetVisArea( rRect ); +/*N*/ } +/*N*/ +/*N*/ if( GetCreateMode() != SFX_CREATE_MODE_INTERNAL ) +/*N*/ { +/*N*/ Size aSize; +/*N*/ +/*N*/ if (rRect.IsEmpty ()) +/*N*/ aSize = Size (); +/*N*/ else +/*N*/ aSize = GetVisArea(ASPECT_CONTENT).GetSize(); +/*N*/ +/*N*/ SdrPage* pPage = pChDoc->GetPage(0); +/*N*/ +/*N*/ if(aSize.Width() > 0 && aSize.Height() > 0) +/*N*/ { +/*N*/ if( !pPage || aSize != pPage->GetSize() ) +/*N*/ { +/*N*/ pChDoc->ResizePage(aSize); +/*N*/ +/*N*/ // notify the controller +/*N*/ // note: the controller is only available in in-place +/*N*/ // Broadcast( SchVisAreaChangedHint( rRect ) ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* OLE-Status +|* +\************************************************************************/ + +/*N*/ ULONG SchChartDocShell::GetMiscStatus() const throw() +/*N*/ { +/*N*/ // Chart soll stets selber resizen +/*N*/ ULONG nStatus = SfxInPlaceObject::GetMiscStatus() | +/*N*/ SVOBJ_MISCSTATUS_SERVERRESIZE | +/*N*/ SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE; +/*N*/ +/*N*/ return nStatus; +/*N*/ } + +/*N*/ void SchChartDocShell::SetModified( BOOL bModified ) throw() +/*N*/ { +/*N*/ if( IsEnableSetModified() ) +/*N*/ { +/*N*/ SfxInPlaceObject::SetModified( bModified ); +/*N*/ DBG_ASSERT( pChDoc, "Invalid ChartModel" ); +/*N*/ if( ! pChDoc->IsLockedBuild()) +/*N*/ Broadcast( SfxSimpleHint( SFX_HINT_DOCCHANGED ) ); +/*N*/ } +/*N*/ } + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/docshell/sch_docshell.cxx b/binfilter/bf_sch/source/ui/docshell/sch_docshell.cxx new file mode 100644 index 000000000000..c33fe7df87a9 --- /dev/null +++ b/binfilter/bf_sch/source/ui/docshell/sch_docshell.cxx @@ -0,0 +1,1072 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define ITEMID_FONTLIST SID_ATTR_CHAR_FONTLIST +#define ITEMID_NUMBERINFO SID_ATTR_NUMBERFORMAT_INFO +#define ITEMID_COLOR_TABLE SID_COLOR_TABLE +#define ITEMID_GRADIENT_LIST SID_GRADIENT_LIST +#define ITEMID_HATCH_LIST SID_HATCH_LIST +#define ITEMID_BITMAP_LIST SID_BITMAP_LIST +#define ITEMID_DASH_LIST SID_DASH_LIST +#define ITEMID_LINEEND_LIST SID_LINEEND_LIST + +#include <sot/formats.hxx> +#include <bf_sfx2/app.hxx> +#include <bf_svx/svxids.hrc> +#include <comphelper/classids.hxx> +#include <bf_sfx2/printer.hxx> +#include <bf_svtools/ctrltool.hxx> +#include <bf_sfx2/progress.hxx> +#include <bf_svtools/sfxecode.hxx> +#include <bf_svx/drawitem.hxx> +#include <bf_svtools/style.hxx> +#include <bf_svtools/saveopt.hxx> +#include <bf_svtools/pathoptions.hxx> +#include <bf_svx/svxids.hrc> +#include <rtl/logfile.hxx> + +#include "app.hrc" +#include "strings.hrc" +#include "res_bmp.hrc" +#include "schresid.hxx" +#include "schview.hxx" +#include "schmod.hxx" + +#include "ChXChartDocument.hxx" +#include "ChXChartData.hxx" +#include "SchXMLWrapper.hxx" +#include "memchrt.hxx" + +namespace binfilter { + +#define POOL_BUFFER_SIZE (USHORT)32768 +#define BASIC_BUFFER_SIZE (USHORT)8192 +#define DOCUMENT_BUFFER_SIZE (USHORT)32768 + +#define SCH_STYLE_SHEET_NAME String( RTL_CONSTASCII_USTRINGPARAM( "SfxStyleSheets" )) + +#define SCH_DEFAULT_CHART_SIZE_WIDTH 8000 +#define SCH_DEFAULT_CHART_SIZE_HEIGHT 7000 + +using namespace ::com::sun::star::uno; + + +// STATIC DATA ----------------------------------------------------------- + +static const String __FAR_DATA aStarChartDoc = String( RTL_CONSTASCII_USTRINGPARAM( "StarChartDocument" )); + +//---------------------------------------------------------------------- + +/************************************************************************* +|* +|* SFX-Slotmaps und -Definitionen +|* +\************************************************************************/ + + +namespace +{ + +/** This class sets EnableSetModified( TRUE ) in the CTOR, and + EnableSetModified( FALSE ) in the DTOR. Thus, this can be used to safeld do + changes at the model without resulting in a modification. + */ +class lcl_NoModificationGuard +{ +public: + lcl_NoModificationGuard( SvPersist * pPersist ) : + m_pPersist( pPersist ), + m_bModifyingWasEnabled( pPersist ? pPersist->IsEnableSetModified() : FALSE ) + { + if( m_bModifyingWasEnabled && + m_pPersist ) + m_pPersist->EnableSetModified( FALSE ); + } + + ~lcl_NoModificationGuard() + { + if( m_bModifyingWasEnabled && + m_pPersist ) + m_pPersist->EnableSetModified( TRUE ); + } + +private: + SvPersist * m_pPersist; + BOOL m_bModifyingWasEnabled; +}; +} + +using namespace ::com::sun::star; + +/*N*/ SFX_IMPL_OBJECTFACTORY_DLL(SchChartDocShell, schart, +/*N*/ SvGlobalName(BF_SO3_SCH_CLASSID), Sch) + +/*N*/ TYPEINIT1(SchChartDocShell, SfxObjectShell); + +/************************************************************************* +|* +|* shared construction - used by internal CTOR and InitNew +|* +\************************************************************************/ + +/*N*/ void SchChartDocShell::Construct() throw() +/*N*/ { +/*N*/ DBG_ASSERT( pChDoc, "SchChartDocShell::Construct() called with no valid model!" ); +/*N*/ //Wird fuer die ModelCollection benoetigt +/*N*/ SetPool(&pChDoc->GetItemPool()); +/*N*/ if( pUndoManager ) +/*?*/ delete pUndoManager; +/*N*/ pUndoManager = new SfxUndoManager; +/*N*/ +/*N*/ // Listen, bzw. Tables im ItemSet der DocShell anlegen +/*N*/ UpdateTablePointers(); +/*N*/ +/*N*/ if (pChDoc->GetPageCount() == 0L) +/*N*/ { +/*N*/ // Seite einfuegen +/*N*/ SdrPage* pPage = pChDoc->AllocPage(FALSE); +/*N*/ pPage->SetSize(GetVisArea(ASPECT_CONTENT).GetSize()); +/*N*/ pChDoc->InsertPage(pPage); +/*N*/ } +/*N*/ +/*N*/ // #i2914# remove menu item for 'Save Copy as...' +/*N*/ SvVerbList * pVerbList = new SvVerbList( GetVerbList() ); +/*N*/ +/*N*/ ULONG nCount = pVerbList->Count(); +/*N*/ ULONG i = 0; +/*N*/ for( ; i < nCount; ++i ) +/*N*/ { +/*N*/ // The Id 3 is the verb for 'Save Copy as...' +/*N*/ if( pVerbList->GetObject( i ).GetId() == 3 ) +/*N*/ { +/*N*/ pVerbList->Remove( i ); +/*N*/ break; +/*N*/ } +/*N*/ } +/*N*/ SetVerbList( pVerbList, TRUE ); +/*N*/ +/*N*/ } + +/*N*/ void SchChartDocShell::DataModified( chart::ChartDataChangeEvent& aEvent ) throw() +/*N*/ { +/*N*/ uno::Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY ); +/*N*/ if( xChartDoc.is() ) +/*N*/ { +/*N*/ uno::Reference< chart::XChartData > xData = xChartDoc->getData(); +/*N*/ if( xData.is() ) +/*N*/ { +/*N*/ ChXChartData* pChXData = ChXChartData::getImplementation( xData ); +/*N*/ if( pChXData ) +/*N*/ { +/*N*/ pChXData->DataModified( aEvent ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + + +/************************************************************************* +|* +|* Default CTOR - this one is called by the factory from SFX +|* +\************************************************************************/ + +/*N*/ SchChartDocShell::SchChartDocShell(SfxObjectCreateMode eMode) throw() : +/*N*/ SfxObjectShell(eMode), +/*N*/ pUndoManager(NULL), +/*N*/ pPrinter(NULL), +/*N*/ pFontList(NULL), +/*N*/ pChDoc(NULL), +/*N*/ bInitNewNoNewDoc(FALSE), +/*N*/ bOwnPrinter(FALSE), +/*N*/ mbClipboardExport( FALSE ) +/*N*/ { +/*N*/ CHART_TRACE( "SchChartDocShell::SchChartDocShell(SfxObjectCreateMode)" ); +/*N*/ SetShell(this); +/*N*/ SetModel( new ChXChartDocument( this )); +/*N*/ } + +/************************************************************************* +|* +|* CTOR used by dragserver +|* +\************************************************************************/ + + +/************************************************************************* +|* +|* Destruktor +|* +\************************************************************************/ + +/*N*/ SchChartDocShell::~SchChartDocShell() throw() +/*N*/ { +/*N*/ CHART_TRACE( "SchChartDocShell::~SchChartDocShell" ); +/*N*/ +/*N*/ delete pFontList; +/*N*/ +/*N*/ delete pUndoManager; +/*N*/ +/*N*/ if( pChDoc ) +/*N*/ { +/*N*/ pChDoc->ClearUndoBuffer(); // clear draw undo actions +/*N*/ pChDoc->SetMaxUndoActionCount( 1 ); // don't add further undo actions +/*N*/ } +/*N*/ +/*N*/ if(bOwnPrinter) +/*N*/ delete pPrinter; +/*N*/ +/*N*/ delete pChDoc; +/*N*/ } + +/*N*/ SfxUndoManager* SchChartDocShell::GetUndoManager() throw() +/*N*/ { +/*N*/ return pUndoManager; +/*N*/ } + +/************************************************************************* +|* +|* SfxPrinter ggf. erzeugen und zurueckgeben +|* +\************************************************************************/ +/*N*/ SfxPrinter* SchChartDocShell::GetPrinter() throw() +/*N*/ { +/*N*/ if (!pPrinter) +/*N*/ { +/*N*/ SfxBoolItem aItem(SID_PRINTER_NOTFOUND_WARN, TRUE); +/*N*/ // ItemSet mit speziellem Poolbereich anlegen +/*N*/ SfxItemSet* pSet = new SfxItemSet(GetPool(), +/*N*/ SID_PRINTER_NOTFOUND_WARN, +/*N*/ SID_PRINTER_NOTFOUND_WARN, 0); +/*N*/ pSet->Put(aItem); +/*N*/ pPrinter = new SfxPrinter(pSet); +/*N*/ bOwnPrinter = TRUE; +/*N*/ +/*N*/ MapMode aMapMode = pPrinter->GetMapMode(); +/*N*/ aMapMode.SetMapUnit(MAP_100TH_MM); +/*N*/ pPrinter->SetMapMode(aMapMode); +/*N*/ +/*N*/ if (pChDoc) +/*N*/ { +/*N*/ if (pPrinter != pChDoc->GetRefDevice()) +/*N*/ pChDoc->SetRefDevice(pPrinter); +/*N*/ +/*N*/ if (pPrinter != pChDoc->GetOutliner()->GetRefDevice()) +/*N*/ pChDoc->GetOutliner()->SetRefDevice(pPrinter); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return pPrinter; +/*N*/ } + + +/************************************************************************* +|* +|* neuen SfxPrinter setzen +|* +\************************************************************************/ +/*N*/ void SchChartDocShell::SetPrinter( SfxPrinter* pNewPrinter, BOOL bIsDeletedHere ) throw() +/*N*/ { +/*N*/ bool bFirstTimeSettingPrinter = ( pPrinter == NULL ); +/*N*/ +/*N*/ // Printer may only be used, if the MapUnit is correct +/*N*/ if( pNewPrinter && +/*N*/ pNewPrinter->GetMapMode().GetMapUnit() == MAP_100TH_MM ) +/*N*/ { +/*N*/ if (pPrinter && bOwnPrinter && (pPrinter != pNewPrinter)) +/*N*/ { +/*?*/ delete pPrinter; +/*?*/ bOwnPrinter = FALSE; +/*N*/ } +/*N*/ +/*N*/ bOwnPrinter = bIsDeletedHere; +/*N*/ +/*N*/ pPrinter = pNewPrinter; +/*N*/ if(pFontList)delete pFontList; +/*N*/ OutputDevice* pOut = Application::GetDefaultDevice(); // #67730# +/*N*/ pFontList = new FontList( pPrinter, pOut, FALSE ); +/*N*/ PutItem(SvxFontListItem(pFontList)); +/*N*/ } +/*N*/ else +/*?*/ if( bIsDeletedHere ) +/*?*/ delete pNewPrinter; +/*N*/ +/*N*/ OutputDevice * pRefDev = GetRefDevice(); +/*N*/ if( pChDoc && +/*N*/ pRefDev && +/*N*/ pRefDev->GetMapMode().GetMapUnit() == MAP_100TH_MM ) +/*N*/ { +/*N*/ // set ref device at document at its outliner as well +/*N*/ OutputDevice * pRefDev = GetRefDevice(); +/*N*/ if( pRefDev && pRefDev->GetMapMode().GetMapUnit() == MAP_100TH_MM ) +/*N*/ { +/*N*/ pChDoc->SetRefDevice( pRefDev ); +/*N*/ pChDoc->GetOutliner()->SetRefDevice( pRefDev ); +/*N*/ +/*N*/ // re-render chart with new ref-device +/*N*/ +/*N*/ // call EnableSetModified( FALSE ) temporarily and safely +/*N*/ lcl_NoModificationGuard aNoModGuard( this ); +/*N*/ +/*N*/ if( ! bFirstTimeSettingPrinter && +/*N*/ pChDoc->IsInitialized() ) +/*N*/ { +/*?*/ pChDoc->BuildChart( FALSE ); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/************************************************************************* +|* +|* +|* +\************************************************************************/ +/*N*/ void SchChartDocShell::OnDocumentPrinterChanged(Printer* pNewPrinter) throw() +/*N*/ { +/*N*/ // we have no rtti, thus assert that we have an SfxPrinter +/*N*/ SetPrinter( reinterpret_cast< SfxPrinter * >( pNewPrinter ) ); +/*N*/ } + +/*N*/ OutputDevice * SchChartDocShell::GetRefDevice() +/*N*/ { +/*N*/ if ( GetProtocol().IsInPlaceActive() || +/*N*/ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() ) +/*N*/ { +/*N*/ OutputDevice* pOutDev = GetDocumentRefDev(); +/*N*/ if ( pOutDev ) +/*N*/ return pOutDev; +/*N*/ } +/*N*/ +/*N*/ return GetPrinter(); +/*N*/ } + +/************************************************************************* +|* +|* InitNew, (Dokument wird neu erzeugt): Streams oeffnen +|* +\************************************************************************/ + +/*N*/ BOOL SchChartDocShell::InitNew( SvStorage * pStor ) throw() +/*N*/ { +/*N*/ CHART_TRACE1( "SchChartDocShell::InitNew pModel=%lx", (long)pChDoc ); +/*N*/ +/*N*/ if( SfxInPlaceObject::InitNew( pStor )) +/*N*/ { +/*N*/ if(!pChDoc) +/*N*/ { +/*N*/ pChDoc = new ChartModel( SvtPathOptions().GetPalettePath(), this ); +/*N*/ // set new model at ChXChartDocument +/*N*/ ChXChartDocument* pImpl = ChXChartDocument::getImplementation( GetModel() ); +/*N*/ if( pImpl ) +/*N*/ pImpl->SetChartModel( pChDoc ); +/*N*/ Construct(); +/*N*/ } +/*N*/ if( pChDoc ) +/*N*/ { +/*N*/ if(bInitNewNoNewDoc) +/*?*/ pChDoc->NewOrLoadCompleted(DOC_LOADED); +/*N*/ else +/*N*/ pChDoc->NewOrLoadCompleted(NEW_DOC); +/*N*/ } +/*N*/ +/*N*/ SetVisArea(Rectangle(Point(0, 0), Size( SCH_DEFAULT_CHART_SIZE_WIDTH, SCH_DEFAULT_CHART_SIZE_HEIGHT ))); +/*N*/ +/*N*/ return TRUE; +/*N*/ } +/*N*/ +/*N*/ return FALSE; +/*N*/ } + +/************************************************************************* +|* +|* Load: Pools und Dokument laden +|* +\************************************************************************/ + +/*N*/ BOOL SchChartDocShell::Load(SvStorage * pStor) throw() +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR (context, "sch", "af119097", "::SchChartDocShell::Load"); +/*N*/ +/*N*/ CHART_TRACE( "SchChartDocShell::Load" ); +/*N*/ +/*N*/ BOOL bRet = FALSE; +/*N*/ +/*N*/ pChDoc = new ChartModel( SvtPathOptions().GetPalettePath(), this ); +/*N*/ SetPool( &pChDoc->GetItemPool()); +/*N*/ ChXChartDocument* pImpl = ChXChartDocument::getImplementation( GetModel() ); +/*N*/ if( pImpl ) +/*?*/ pImpl->SetChartModel( pChDoc ); +/*N*/ +/*N*/ sal_Bool bIsXML = pStor->GetVersion() >= SOFFICE_FILEFORMAT_60; +/*N*/ +/*N*/ if( bIsXML ) +/*N*/ { +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ ULONG nStorFmt = pStor->GetFormat(); +/*N*/ RTL_LOGFILE_CONTEXT_TRACE1 (context, "binary format %lu", nStorFmt); +/*N*/ +/*N*/ // do some initializations +/*N*/ Construct(); +/*N*/ +/*N*/ pProgress = NULL; +/*N*/ +/*N*/ if ( nStorFmt == SOT_FORMATSTR_ID_STARCHART_50 || +/*N*/ nStorFmt == SOT_FORMATSTR_ID_STARCHART_40 || +/*N*/ nStorFmt == SOT_FORMATSTR_ID_STARCHART || +/*N*/ nStorFmt == SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50 +/*N*/ ) +/*N*/ { +/*N*/ if( GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) +/*N*/ pProgress = new SfxProgress( this, String( SchResId( STR_OPEN_DOCUMENT )), 100 ); +/*N*/ +/*N*/ if( pProgress ) +/*N*/ pProgress->SetState( 0, 100 ); +/*N*/ +/*N*/ bRet = SfxInPlaceObject::Load( pStor ); +/*N*/ +/*N*/ if( pProgress ) +/*N*/ pProgress->SetState( 30 ); +/*N*/ +/*N*/ if( bRet ) +/*N*/ { +/*N*/ SetWaitCursor( TRUE ); +/*N*/ +/*N*/ // Pool und StyleSheet Pool laden +/*N*/ String aStyleSheetsStr( SCH_STYLE_SHEET_NAME ); +/*N*/ +/*N*/ if (pStor->IsStream(aStyleSheetsStr)) +/*N*/ { +/*N*/ ULONG nError; +/*N*/ SvStorageStreamRef rPoolStream = pStor->OpenStream( aStyleSheetsStr ); +/*N*/ rPoolStream->SetVersion( pStor->GetVersion()); +/*N*/ if( ! rPoolStream->GetError()) +/*N*/ { +/*N*/ rPoolStream->SetBufferSize( POOL_BUFFER_SIZE ); +/*N*/ nError = rPoolStream->GetError(); +/*N*/ GetPool().SetFileFormatVersion( (USHORT)pStor->GetVersion ()); +/*N*/ GetPool().Load( *rPoolStream ); +/*N*/ nError = rPoolStream->GetError(); +/*N*/ if( nError ) +/*N*/ { +/*?*/ DBG_ERROR1( "Errorcode 0x%x loading Pool", nError ); +/*?*/ rPoolStream->ResetError(); +/*?*/ SetError( ERRCODE_WARNING_MASK | nError ); +/*N*/ } +/*N*/ GetStyleSheetPool()->Load( *rPoolStream ); +/*N*/ nError = rPoolStream->GetError(); +/*N*/ if( nError ) +/*N*/ { +/*?*/ DBG_ERROR1( "Errorcode 0x%x loading StyleSheet-Pool", nError ); +/*?*/ rPoolStream->ResetError(); +/*?*/ SetError( ERRCODE_WARNING_MASK | nError ); +/*N*/ } +/*N*/ rPoolStream->SetBufferSize( 0 ); +/*N*/ } +/*N*/ else bRet = FALSE; +/*N*/ } +/*N*/ else bRet = FALSE; +/*N*/ +/*N*/ if( pProgress ) +/*N*/ pProgress->SetState( 70 ); +/*N*/ +/*N*/ // wenn gewuenscht, das Dokument laden +/*N*/ if (bRet && (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)) +/*N*/ { +/*N*/ // Model der Drawing Engine laden +/*N*/ if (pStor->IsStream( aStarChartDoc )) +/*N*/ { +/*N*/ SvStorageStreamRef rDocumentStream = pStor->OpenStream( aStarChartDoc ); +/*N*/ rDocumentStream->SetVersion( pStor->GetVersion()); +/*N*/ GetPool().SetFileFormatVersion ( (USHORT)pStor->GetVersion()); +/*N*/ if( ! rDocumentStream->GetError()) +/*N*/ { +/*N*/ rDocumentStream->SetBufferSize( DOCUMENT_BUFFER_SIZE ); +/*N*/ rDocumentStream->SetKey( pStor->GetKey()); // set password +/*N*/ +/*N*/ // read ChartModel +/*N*/ *rDocumentStream >> *pChDoc; +/*N*/ +/*N*/ bRet = ( rDocumentStream->GetError() == 0 ); +/*N*/ +/*N*/ // garbled with password? +/*N*/ if( ! bRet ) +/*N*/ { +/*?*/ if( pStor->GetKey().Len() == 0 ) +/*?*/ { +/*?*/ // no password set => cannot load +/*?*/ SetError( ERRCODE_SFX_DOLOADFAILED ); +/*?*/ } +/*?*/ else +/*?*/ { +/*?*/ // password was set, but obviously wrong +/*?*/ SetError( ERRCODE_SFX_WRONGPASSWORD ); +/*?*/ } +/*N*/ } +/*N*/ +/*N*/ rDocumentStream->SetBufferSize( 0 ); +/*N*/ } +/*N*/ else bRet = FALSE; +/*N*/ } +/*N*/ else bRet = FALSE; +/*N*/ } +/*N*/ +/*N*/ if( pProgress ) +/*N*/ pProgress->SetState( 100 ); +/*N*/ +/*N*/ // (noch) keine ungesicherten Aenderungen im Model +/*N*/ if (bRet) +/*N*/ { + + // #i39672# convert range strings to new XML compatible format + + // Note: Formerly, the parent storage was queried to + // find out whether it is a Writer or a Calc. This + // worked, because it was done in SaveAs(). It is + // better to do the conversion right after loading, + // however here we have no parent. So both conversions + // are called. This works, because the things written + // to the SomeData strings is so different, that both + // routines won't convert the data for the wrong + // format. (Note: only the conversion from old to new, + // i.e. the call with parameter TRUE, work like this, as + // the new format is the same for both) + + // try Writer + bool bConverted = + pChDoc->GetChartData()->ConvertChartRangeForWriter( TRUE ); + + // try Calc + if( ! bConverted ) + { + SchMemChart* pData = pChDoc->GetChartData(); + if( pData && + pData->SomeData3().Len() > 0 && + (pData->GetChartRange().maRanges.size() == 0) ) + bConverted = pData->ConvertChartRangeForCalc( TRUE ); + } + +/*N*/ pChDoc->SetChanged( FALSE ); +/*N*/ pChDoc->NewOrLoadCompleted( DOC_LOADED ); +/*N*/ } +/*N*/ +/*N*/ SetWaitCursor( FALSE ); +/*N*/ } +/*N*/ +/*N*/ if( pProgress ) +/*N*/ pProgress->SetState( 100 ); +/*N*/ +/*N*/ if (bRet) +/*N*/ { +/*N*/ UpdateTablePointers(); +/*N*/ FinishedLoading( SFX_LOADED_ALL ); +/*N*/ } +/*N*/ } +/*N*/ else +/*N*/ { +/*?*/ pStor->SetError( SVSTREAM_WRONGVERSION ); +/*N*/ } +/*N*/ +/*N*/ if( pProgress ) +/*N*/ { +/*N*/ delete pProgress; +/*N*/ pProgress = NULL; +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + + /********************************************************************** + * StarOffice XML-Filter Export + **********************************************************************/ + + /********************************************************************** + * StarOffice XML-Filter Import + **********************************************************************/ + +// ------------------------------------------------------------ + + +// ------------------------------------------------------------ + +/*N*/ BOOL SchChartDocShell::Save() throw() +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR (context, "sch", "af119097", "::SchChartDocShell::Save"); +/*N*/ +/*N*/ SvStorage* pStor = GetStorage(); +/*N*/ DBG_ASSERT( pStor, "Save() without Storage called!" ); + if (!pStor) + return FALSE; +/*N*/ +/*N*/ long nFileFormat = pStor->GetVersion(); +/*N*/ sal_Bool bIsXML = nFileFormat >= SOFFICE_FILEFORMAT_60; +/*N*/ BOOL bRet = FALSE; +/*N*/ +/*N*/ if( bIsXML ) +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_TRACE (context, "XML format"); +/*N*/ bRet = SfxInPlaceObject::Save(); +/*N*/ + /********************************************************************** + * StarOffice XML-Filter Export + **********************************************************************/ +/*N*/ Reference< ::com::sun::star::frame::XModel> xModel(GetModel()); +/*N*/ SchXMLWrapper aFilter( xModel, *pStor, +/*N*/ GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ); +/*N*/ +/*N*/ // update user info before writing +/*N*/ UpdateDocInfoForSave(); +/*N*/ +/*N*/ bRet = aFilter.Export(); + + FinishedLoading( SFX_LOADED_ALL ); +/*N*/ } +/*N*/ else // binary format <= 5.0 +/*N*/ { +/*N*/ pChDoc->PrepareAxisStorage(); +/*N*/ SvStorageStreamRef rDocumentStream = pStor->OpenStream( aStarChartDoc ); +/*N*/ +/*N*/ if( rDocumentStream.Is() && ! rDocumentStream->GetError() ) +/*N*/ { +/*N*/ rDocumentStream->SetVersion( pStor->GetVersion() ); +/*N*/ +/*N*/ if( nFileFormat <= SOFFICE_FILEFORMAT_40 && pChDoc->IsReal3D()) +/*N*/ { +/*?*/ CHART_TRACE( "Fileformat 4.0" ); +/*?*/ pChDoc->PrepareOld3DStorage(); +/*N*/ } +/*N*/ +/*N*/ bRet = SfxInPlaceObject::Save(); +/*N*/ +/*N*/ // komprimiert/native speichern? +/*N*/ const BOOL bSaveNative = FALSE; +/*N*/ const BOOL bSaveCompressed = FALSE; +/*N*/ +/*N*/ pChDoc->SetSaveCompressed( bSaveCompressed ); +/*N*/ pChDoc->SetSaveNative( bSaveNative ); +/*N*/ +/*N*/ if( bRet ) +/*N*/ { +/*N*/ pChDoc->PreSave(); +/*N*/ +/*N*/ SetWaitCursor( TRUE ); +/*N*/ +/*N*/ SvStorageStreamRef rPoolStream = pStor->OpenStream( SCH_STYLE_SHEET_NAME ); +/*N*/ if( ! rPoolStream->GetError()) +/*N*/ { +/*N*/ rPoolStream->SetSize( 0 ); +/*N*/ rPoolStream->SetBufferSize( POOL_BUFFER_SIZE ); +/*N*/ GetPool().Store( *rPoolStream ); +/*N*/ +/*N*/ +/*N*/ // the style sheet pool uses next() and first() methods without resetting +/*N*/ // the search mask (?) so it has to be done here +/*N*/ GetStyleSheetPool()->SetSearchMask( SFX_STYLE_FAMILY_ALL ); +/*N*/ // FALSE = also save unused style sheets +/*N*/ GetStyleSheetPool()->Store( *rPoolStream, FALSE ); +/*N*/ rPoolStream->SetBufferSize( 0 ); +/*N*/ +/*N*/ } +/*N*/ else bRet = FALSE; +/*N*/ if (bRet) +/*N*/ bRet = rPoolStream->GetError() == 0; +/*N*/ DBG_ASSERT(bRet, "Fehler beim Schreiben der Pools"); +/*N*/ +/*N*/ if( ! rDocumentStream->GetError()) +/*N*/ { + // #i56310# set SomeData strings according to + // ChartRange in MemChart like it is done in SaveAs + SvPersist* pParent = GetParent(); + if( pParent ) + { + // determine which is parent application + SvGlobalName aGlobalName; + ULONG nFileFormat; + String aAppName, aFullName, aShortName; + pParent->FillClass( &aGlobalName, &nFileFormat, + &aAppName, &aFullName, &aShortName, + SOFFICE_FILEFORMAT_60 ); + + if( nFileFormat == SOT_FORMATSTR_ID_STARCALC_60 ) + pChDoc->GetChartData()->ConvertChartRangeForCalc( FALSE ); + else if( nFileFormat == SOT_FORMATSTR_ID_STARWRITER_60 ) + pChDoc->GetChartData()->ConvertChartRangeForWriter( FALSE ); + } +/*N*/ rDocumentStream->SetSize( 0 ); +/*N*/ rDocumentStream->SetBufferSize( DOCUMENT_BUFFER_SIZE ); +/*N*/ *rDocumentStream << *pChDoc; +/*N*/ rDocumentStream->SetBufferSize( 0 ); +/*N*/ } +/*N*/ else +/*N*/ bRet = FALSE; +/*N*/ +/*N*/ if (bRet) +/*N*/ bRet = rDocumentStream->GetError() == 0; +/*N*/ DBG_ASSERT(bRet, "Fehler beim Schreiben des Models"); +/*N*/ +/*N*/ // finished +/*N*/ +/*N*/ SetWaitCursor( FALSE ); +/*N*/ +/*N*/ pChDoc->PostSave(); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if(nFileFormat <= SOFFICE_FILEFORMAT_40 && pChDoc->IsReal3D()) +/*N*/ { +/*?*/ pChDoc->CleanupOld3DStorage(); +/*N*/ } +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ BOOL SchChartDocShell::SaveAs(SvStorage * pStor) throw() +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR (context, "sch", "af119097", "::SchChartDocShell::SaveAs"); +/*N*/ +/*N*/ CHART_TRACE( "SchChartDocShell::SaveAs" ); +/*N*/ DBG_ASSERT( pStor, "SaveAs() without Storage called!" ); + if (!pStor) + return FALSE; +/*N*/ +/*N*/ BOOL bRet = FALSE; +/*N*/ +/*N*/ long nOldFormat = GetStorage()->GetVersion(); +/*N*/ long nNewFormat = pStor->GetVersion(); +/*N*/ +/*N*/ BOOL bIsXML = nNewFormat >= SOFFICE_FILEFORMAT_60; +/*N*/ BOOL bFormatChanges = (nOldFormat != nNewFormat); +/*N*/ +/*N*/ // If chart was loaded from binary format it has never been built. +/*N*/ if( ! pChDoc->IsInitialized()) +/*N*/ pChDoc->Initialize(); +/*N*/ +/*N*/ if( bIsXML ) +/*N*/ { +/*N*/ RTL_LOGFILE_CONTEXT_TRACE (context, "XML format"); +/*N*/ bRet = SfxInPlaceObject::SaveAs( pStor ); +/*N*/ + /********************************************************************** + * StarOffice XML-Filter Export + **********************************************************************/ +/*N*/ Reference< ::com::sun::star::frame::XModel> xModel(GetModel()); +/*N*/ SchXMLWrapper aFilter( xModel, *pStor, +/*N*/ GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ); +/*N*/ +/*N*/ // update user info before writing +/*N*/ UpdateDocInfoForSave(); +/*N*/ +/*N*/ // old storage was binary format +/*N*/ if( bFormatChanges ) +/*N*/ { +/*N*/ // convert SomeData-strings from Calc/Writer to data structure +/*N*/ SvPersist* pParent = GetParent(); +/*N*/ if( pParent ) +/*N*/ { +/*?*/ // determine which is parent application + + +/** removed since the actually come up and the fprintf even in pro builds +DBG_BF_ASSERT(0, "STRIP"); +DBG_ERROR( "Conversion routine called" ); +fprintf( stderr, "BM: Conversion routine called\n" ); +*/ + SvGlobalName aGlobalName; + /*?*/ ULONG nFileFormat; + /*?*/ String aAppName, aFullName, aShortName; + /*?*/ pParent->FillClass( &aGlobalName, &nFileFormat, + /*?*/ &aAppName, &aFullName, &aShortName, + /*?*/ SOFFICE_FILEFORMAT_60 ); + /*?*/ + /*?*/ // calc does this conversion itself except when object was + /*?*/ // copied to clipboard. In this case SomeData3 was filled before. + /*?*/ if( nFileFormat == SOT_FORMATSTR_ID_STARCALC_60 ) + /*?*/ { + /*?*/ SchMemChart* pData = pChDoc->GetChartData(); + /*?*/ if( pData && + /*?*/ pData->SomeData3().Len() > 0 && + /*?*/ (pData->GetChartRange().maRanges.size() == 0) ) + /*?*/ { + /*?*/ pData->ConvertChartRangeForCalc( TRUE ); + /*?*/ } + /*?*/ } + /*?*/ else if( nFileFormat == SOT_FORMATSTR_ID_STARWRITER_60 ) + /*?*/ pChDoc->GetChartData()->ConvertChartRangeForWriter( TRUE ); + + /*N*/ } +/*N*/ +/*N*/ bRet = aFilter.Export(); +/*N*/ } +/*N*/ } +/*N*/ else // binary format <= 5.0 +/*N*/ { +/*N*/ pChDoc->PrepareAxisStorage(); +/*N*/ long nFileFormat = pStor->GetVersion(); +/*N*/ RTL_LOGFILE_CONTEXT_TRACE1 (context, "binary format %ld", nFileFormat); +/*N*/ if(nFileFormat <= SOFFICE_FILEFORMAT_40 && pChDoc->IsReal3D()) +/*N*/ { +/*N*/ pChDoc->PrepareOld3DStorage(); +/*N*/ CHART_TRACE( "Fileformat 4.0" ); +/*N*/ } +/*N*/ +/*N*/ bRet = SfxInPlaceObject::SaveAs( pStor ); +/*N*/ +/*N*/ // compressed or native format +/*N*/ const BOOL bSaveNative = FALSE; +/*N*/ const BOOL bSaveCompressed = FALSE; +/*N*/ +/*N*/ pChDoc->SetSaveCompressed( bSaveCompressed ); +/*N*/ pChDoc->SetSaveNative( bSaveNative ); +/*N*/ +/*N*/ if (bRet) +/*N*/ { +/*N*/ pChDoc->PreSave(); +/*N*/ SvStorageStreamRef rPoolStream = pStor->OpenStream( SCH_STYLE_SHEET_NAME ); +/*N*/ rPoolStream->SetVersion( pStor->GetVersion ()); +/*N*/ +/*N*/ SetWaitCursor( TRUE ); +/*N*/ +/*N*/ if( ! rPoolStream->GetError()) +/*N*/ { +/*N*/ rPoolStream->SetBufferSize(POOL_BUFFER_SIZE); +/*N*/ GetPool().SetFileFormatVersion( (USHORT)pStor->GetVersion ()); +/*N*/ GetPool().Store( *rPoolStream ); +/*N*/ +/*N*/ +/*N*/ // the style sheet pool uses next() and first() methods without resetting +/*N*/ // the search mask (?) so it has to be done here +/*N*/ GetStyleSheetPool()->SetSearchMask( SFX_STYLE_FAMILY_ALL ); +/*N*/ // FALSE = also save unused style sheets +/*N*/ GetStyleSheetPool()->Store( *rPoolStream, FALSE ); +/*N*/ rPoolStream->SetBufferSize( 0 ); +/*N*/ +/*N*/ } +/*N*/ else +/*N*/ bRet = FALSE; +/*N*/ +/*N*/ if( bRet ) +/*N*/ bRet = rPoolStream->GetError() == 0; +/*N*/ DBG_ASSERT( bRet, "Fehler beim Schreiben der Pools" ); +/*N*/ +/*N*/ SvStorageStreamRef rDocumentStream = pStor->OpenStream( aStarChartDoc ); +/*N*/ rDocumentStream->SetVersion( pStor->GetVersion()); +/*N*/ GetPool().SetFileFormatVersion ( (USHORT)pStor->GetVersion ()); +/*N*/ +/*N*/ if( ! rDocumentStream->GetError()) +/*N*/ { +/*N*/ // old storage was XML format +/*N*/ // always convert as internal storage is only the chart range +/*N*/ // if( bFormatChanges ) +/*N*/ // { +/*N*/ // convert data structure from Calc/Writer to SomeData strings +/*N*/ SvPersist* pParent = GetParent(); +/*N*/ if( pParent ) +/*N*/ { +/*N*/ // determine which is parent application +/*N*/ SvGlobalName aGlobalName; +/*N*/ ULONG nFileFormat; +/*N*/ String aAppName, aFullName, aShortName; +/*N*/ pParent->FillClass( &aGlobalName, &nFileFormat, +/*N*/ &aAppName, &aFullName, &aShortName, +/*N*/ SOFFICE_FILEFORMAT_60 ); +/*N*/ +/*N*/ if( nFileFormat == SOT_FORMATSTR_ID_STARCALC_60 ) +/*?*/ pChDoc->GetChartData()->ConvertChartRangeForCalc( FALSE ); +/*N*/ else if( nFileFormat == SOT_FORMATSTR_ID_STARWRITER_60 ) +/*N*/ pChDoc->GetChartData()->ConvertChartRangeForWriter( FALSE ); +/*N*/ } +/*N*/ // } +/*N*/ +/*N*/ rDocumentStream->SetBufferSize( DOCUMENT_BUFFER_SIZE ); +/*N*/ rDocumentStream->SetKey( pStor->GetKey()); // set password +/*N*/ *rDocumentStream << *pChDoc; +/*N*/ rDocumentStream->SetBufferSize( 0 ); +/*N*/ } +/*N*/ else bRet = FALSE; +/*N*/ if( bRet ) +/*N*/ bRet = rDocumentStream->GetError() == 0; +/*N*/ DBG_ASSERT( bRet, "Fehler beim Schreiben des Models" ); +/*N*/ +/*N*/ // finished +/*N*/ +/*N*/ SetWaitCursor( FALSE ); +/*N*/ +/*N*/ pChDoc->PostSave(); +/*N*/ } +/*N*/ +/*N*/ +/*N*/ if( nFileFormat <= SOFFICE_FILEFORMAT_40 && pChDoc->IsReal3D()) +/*N*/ { +/*N*/ pChDoc->CleanupOld3DStorage(); +/*N*/ } +/*N*/ } +/*N*/ +/*N*/ return bRet; +/*N*/ } + +/************************************************************************* +|* +|* +|* +\************************************************************************/ + +/*N*/ BOOL SchChartDocShell::SaveCompleted( SvStorage * pStor ) throw() +/*N*/ { +/*N*/ CHART_TRACE( "SchChartDocShell::SaveCompleted" ); +/*N*/ +/*N*/ BOOL bRet = SfxInPlaceObject::SaveCompleted( pStor ); +/*N*/ +/*N*/ if( bRet ) +/*N*/ { +/*N*/ if( pStor && pChDoc ) +/*N*/ { +/*N*/ // #99758# SetChanged was called here which called SetModified(). I +/*N*/ // removed this, since it is not clear why this was introduced in +/*N*/ // rev. 1.48 (loading of files with additional graphics does not set +/*N*/ // the modified flag to true) +/*N*/ +/*N*/ // throw away old graphics streams +/*N*/ pChDoc->HandsOff(); +/*N*/ } +/*N*/ } +/*N*/ return bRet; +/*N*/ } + +/************************************************************************* +|* +|* Tabellenzeiger auffrischen +|* +\************************************************************************/ +/*N*/ void SchChartDocShell::UpdateTablePointers() throw() +/*N*/ { +/*N*/ PutItem(SvxColorTableItem(pChDoc->GetColorTable())); +/*N*/ PutItem(SvxGradientListItem(pChDoc->GetGradientList())); +/*N*/ PutItem(SvxHatchListItem(pChDoc->GetHatchList())); +/*N*/ PutItem(SvxBitmapListItem(pChDoc->GetBitmapList())); +/*N*/ PutItem(SvxDashListItem(pChDoc->GetDashList())); +/*N*/ PutItem(SvxLineEndListItem(pChDoc->GetLineEndList())); +/*N*/ +/*N*/ if(pFontList)delete pFontList; +/*N*/ +/*N*/ if ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pPrinter ) +/*N*/ { +/*N*/ // OLE-Objekt: kein Printer anlegen +/*?*/ pFontList = new FontList( Application::GetDefaultDevice(), NULL, FALSE ); // #67730# +/*N*/ } +/*N*/ else +/*N*/ { +/*N*/ pFontList = new FontList(GetPrinter(), NULL, FALSE); +/*N*/ } +/*N*/ +/*N*/ SvxFontListItem aFontListItem(pFontList); +/*N*/ PutItem(aFontListItem); +/*N*/ +/*N*/ // PutItem(SvxNumberInfoItem(pChDoc->GetNumFormatter())); +/*N*/ } + +/************************************************************************* +|* +|* FillClass +|* +\************************************************************************/ + +/*N*/ void SchChartDocShell::FillClass(SvGlobalName* pClassName, +/*N*/ ULONG* pFormat, +/*N*/ String* pAppName, +/*N*/ String* pFullTypeName, +/*N*/ String* pShortTypeName, +/*N*/ long nFileFormat) const throw() +/*N*/ { +/*N*/ SfxInPlaceObject::FillClass(pClassName, pFormat, pAppName, pFullTypeName, +/*N*/ pShortTypeName, nFileFormat); +/*N*/ +/*N*/ if (nFileFormat == SOFFICE_FILEFORMAT_31) +/*N*/ { +/*N*/ *pClassName = SvGlobalName(BF_SO3_SCH_CLASSID_30); +/*N*/ *pFormat = SOT_FORMATSTR_ID_STARCHART; +/*N*/ (*pAppName).AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Schart 3.1" )); +/*N*/ *pFullTypeName = String(SchResId(STR_CHART_DOCUMENT_FULLTYPE_31)); +/*N*/ *pShortTypeName = String(SchResId(STR_CHART_DOCUMENT)); +/*N*/ } +/*N*/ else if (nFileFormat == SOFFICE_FILEFORMAT_40) +/*N*/ { +/*N*/ *pClassName = SvGlobalName(BF_SO3_SCH_CLASSID_40); +/*N*/ *pFormat = SOT_FORMATSTR_ID_STARCHART_40; +/*N*/ *pFullTypeName = String(SchResId(STR_CHART_DOCUMENT_FULLTYPE_40)); +/*N*/ *pShortTypeName = String(SchResId(STR_CHART_DOCUMENT)); +/*N*/ } +/*N*/ else if (nFileFormat == SOFFICE_FILEFORMAT_50) +/*N*/ { +/*N*/ *pClassName = SvGlobalName(BF_SO3_SCH_CLASSID_50); + + // for binfilter, we need the FormatIDs to be set. Not setting them + // has always been an error (!) + *pFormat = SOT_FORMATSTR_ID_STARCHART_50; + +/*N*/ *pFullTypeName = String(SchResId(STR_CHART_DOCUMENT_FULLTYPE_50)); +/*N*/ *pShortTypeName = String(SchResId(STR_CHART_DOCUMENT)); +/*N*/ } +/*N*/ else if (nFileFormat == SOFFICE_FILEFORMAT_60) +/*N*/ { +/*N*/ *pClassName = SvGlobalName(BF_SO3_SCH_CLASSID_60); + + // for binfilter, we need the FormatIDs to be set. Not setting them + // has always been an error (!) + *pFormat = SOT_FORMATSTR_ID_STARCHART_60; + +/*N*/ *pFullTypeName = String(SchResId(STR_CHART_DOCUMENT_FULLTYPE_60)); +/*N*/ *pShortTypeName = String(SchResId(STR_CHART_DOCUMENT)); +/*N*/ } +/*N*/ } + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChXChartData.hxx b/binfilter/bf_sch/source/ui/inc/ChXChartData.hxx new file mode 100644 index 000000000000..586ccb1c4d3b --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChXChartData.hxx @@ -0,0 +1,167 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CHART_DATA_HXX +#define _CHART_DATA_HXX + +#include <cppuhelper/implbase4.hxx> +// header for OInterfaceContainerHelper +#include <cppuhelper/interfacecontainer.hxx> + +#include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XComponent.hpp> +namespace binfilter { + +class ChartModel; + +// ---------------------------------------- +// ChXChartData +// ---------------------------------------- + +class ChXChartData : public cppu::WeakImplHelper4< + ::com::sun::star::chart::XChartData, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XEventListener, + ::com::sun::star::lang::XUnoTunnel > +{ +private: + ::osl::Mutex maMutex; + cppu::OInterfaceContainerHelper maListeners; + +protected: + ChartModel* mpModel; + +public: + // the model is used for listening for the 'death' of the ChartModel + ChXChartData( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel, + ChartModel* pModel ); + virtual ~ChXChartData(); + + ::osl::Mutex& GetMutex() { return maMutex; } + + virtual void DataModified( ::com::sun::star::chart::ChartDataChangeEvent& ); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + static ChXChartData* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw(); + + // XChartData + virtual void SAL_CALL addChartDataChangeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeChartDataChangeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual double SAL_CALL getNotANumber() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener listens to disposing of XModel + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw( ::com::sun::star::uno::RuntimeException ); +}; + + +// ---------------------------------------- +// ChXChartDataArray +// ---------------------------------------- + +class ChXChartDataArray : + public ChXChartData, + public ::com::sun::star::chart::XChartDataArray +{ +private: + static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; + +public: + // the model is used for listening for the 'death' of the ChartModel + ChXChartDataArray( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel, + ChartModel* pModel ); + virtual ~ChXChartDataArray(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XChartDataArray + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRowDescriptions ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aColumnDescriptions ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XChartData ( ::XChartDataArray ) + virtual void SAL_CALL addChartDataChangeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeChartDataChangeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual double SAL_CALL getNotANumber() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); +}; + +} //namespace binfilter +#endif // _CHART_DATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChXChartDataChangeEventListener.hxx b/binfilter/bf_sch/source/ui/inc/ChXChartDataChangeEventListener.hxx new file mode 100644 index 000000000000..a07d44ec1481 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChXChartDataChangeEventListener.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CHXCHARTDATACHANGEEVENTLISTENER_HXX +#define _CHXCHARTDATACHANGEEVENTLISTENER_HXX + +#include <cppuhelper/implbase1.hxx> // helper for implementations + +#include <com/sun/star/chart/XChartDataChangeEventListener.hpp> +namespace binfilter { + +class ChXChartDocument; + +class ChXChartDataChangeEventListener : + public cppu::WeakImplHelper1< ::com::sun::star::chart::XChartDataChangeEventListener > +{ +private: + ChXChartDocument *mpXDoc; + +public: + ChXChartDataChangeEventListener(); + virtual ~ChXChartDataChangeEventListener(){}; + + void Reset() throw(); + void SetOwner( ChXChartDocument* pXDoc ) throw(); + + // XChartDataChangeEventListener + virtual void SAL_CALL chartDataChanged( const ::com::sun::star::chart::ChartDataChangeEvent& aEvent ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); +}; + +} //namespace binfilter +#endif // _CHXCHARTDATACHANGEEVENTLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChXChartDrawPage.hxx b/binfilter/bf_sch/source/ui/inc/ChXChartDrawPage.hxx new file mode 100644 index 000000000000..e7147e03eea2 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChXChartDrawPage.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CHXCHARTDRAWPAGE_HXX_ +#define _CHXCHARTDRAWPAGE_HXX_ + +#include <bf_svx/unopage.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> + +// header for SvxItemPropertySet +#include <bf_svx/unoprov.hxx> +namespace binfilter { + +class ChartModel; + +class ChXChartDrawPage : + public ::com::sun::star::beans::XPropertySet, + public SvxDrawPage +{ +private: + ChartModel* mpModel; + SvxItemPropertySet maPropSet; + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence; + +public: + ChXChartDrawPage( ChartModel* pModel ); + virtual ~ChXChartDrawPage() throw(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); +}; + +} //namespace binfilter +#endif // _CHXCHARTDRAWPAGE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChXChartObject.hxx b/binfilter/bf_sch/source/ui/inc/ChXChartObject.hxx new file mode 100644 index 000000000000..8ecb5d5dc1e8 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChXChartObject.hxx @@ -0,0 +1,230 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CHXCHART_OBJECT_HXX +#define _CHXCHART_OBJECT_HXX + +#include <cppuhelper/implbase8.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/interfacecontainer.hxx> + +// header for SvxServiceInfoHelper, SvxItemPropertySet +#include <bf_svx/unoprov.hxx> +namespace binfilter { + +class ChartModel; +class SdrObject; + +class ChXChartObject : public cppu::WeakImplHelper8< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::beans::XMultiPropertySet, + ::com::sun::star::beans::XPropertyState, + ::com::sun::star::beans::XMultiPropertyStates, + ::com::sun::star::drawing::XShape, + ::com::sun::star::lang::XComponent, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel > +{ +protected: + SvxItemPropertySet maPropSet; + ChartModel* mpModel; + long mnWhichId; + long mnIndex; // typically a data row index + +public: + ChXChartObject( long _MapId, ChartModel* _Model, long _WhichId, long _Index = -1 ); + virtual ~ChXChartObject(); + + virtual long GetId() const; + SdrObject* GetCurrentSdrObject() const; + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) + throw ( ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw ( ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw ( ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener ( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw ( ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw ( ::com::sun::star::uno::RuntimeException); + + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XMultiPropertyStates +/* virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); +*/ virtual void SAL_CALL setAllPropertiesToDefault (void) + throw ( ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertiesToDefault ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw ( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XShape + virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) + throw( ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + + +protected: + /** @descr In an array of SfxItemPropertyMap entries advance from the position pointed to + by pProperty to that property that has the name given by pPropertyName. If the + property list does not contain such an entry an UnknownPropertyException is thrown. + @param pProperty Pointer into an array of properties. It is modified such that after + the methods returns it points to a property with the same name as pPropertyName. + @param pPropertyName Name of the property that is searched for. + */ + void AdvanceToName (const SfxItemPropertyMap *& pProperty, + const ::rtl::OUString * pPropertyName); + + /** @descr Creates an item set and fill it with the models default values. + If derived classes need other than the default which ranges, the have to overload + this method. + @return Returns a pointer to an item set. The caller is responsible for deleting it. + */ + virtual SfxItemSet * CreateItemSet (void); + + /** @descr Retrieve the value of the property specified by rProperty from the item set given + by rAttributes and put it into rValue. + @param rProperty Specifies the property in question. + @param rValue The property's value is stored into this argument. + @param rAttributes The item set that contains all relevant items from which the property + value is extracted. + */ + virtual void GetPropertyValue (const SfxItemPropertyMap & rProperty, + ::com::sun::star::uno::Any & rValue, + SfxItemSet & rAttributes); + +private: + /// List of listeners for the XComponent interface. + ::cppu::OInterfaceContainerHelper maListenerList; + + /// Mutex used by the interface container. + ::osl::Mutex maMutex; +}; + +} //namespace binfilter +#endif // _CHXCHART_OBJECT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChXDataPoint.hxx b/binfilter/bf_sch/source/ui/inc/ChXDataPoint.hxx new file mode 100644 index 000000000000..85bb2232dc14 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChXDataPoint.hxx @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_DATA_POINT_HXX +#define _SCH_DATA_POINT_HXX + +#include <cppuhelper/implbase5.hxx> + +#include <com/sun/star/drawing/XShapeDescriptor.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +// header for SvxItemPropertySet +#include <bf_svx/unoprov.hxx> +namespace binfilter { + +class ChartModel; + +class ChXDataPoint : public cppu::WeakImplHelper5< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::beans::XPropertyState, + ::com::sun::star::drawing::XShapeDescriptor, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel > +{ +private: + SvxItemPropertySet maPropSet; + ChartModel* mpModel; + + sal_Int32 mnCol, mnRow; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getStatisticsProperties( const sal_Int32 nId ) const; + void AddDataPointAttr( SfxItemSet& rOutAttributes ); + +public: + ChXDataPoint( sal_Int32 _Col, sal_Int32 _Row, ChartModel* _Model = NULL ); + virtual ~ChXDataPoint(); + + sal_Int32 GetCol() const { return mnCol; } + sal_Int32 GetRow() const { return mnRow; } + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); +}; + +} //namespace binfilter +#endif // _SCH_DATA_POINT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChXDataRow.hxx b/binfilter/bf_sch/source/ui/inc/ChXDataRow.hxx new file mode 100644 index 000000000000..d31fa7a0b36a --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChXDataRow.hxx @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_DATA_ROW_HXX +#define _SCH_DATA_ROW_HXX + +#include <cppuhelper/implbase5.hxx> + +#include <com/sun/star/drawing/XShapeDescriptor.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +// header for SvxItemPropertySet +#include <bf_svx/unoprov.hxx> +namespace binfilter { + +class ChartModel; + +class ChXDataRow : public cppu::WeakImplHelper5< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::beans::XPropertyState, + ::com::sun::star::drawing::XShapeDescriptor, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel > +{ +private: + SvxItemPropertySet maPropSet; + ChartModel* mpModel; + + sal_Int32 mnRow; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getStatisticsProperties( sal_Int32 nId ) const; + +public: + ChXDataRow( sal_Int32 _Row, ChartModel* _Model = NULL ); + virtual ~ChXDataRow(); + + sal_Int32 GetRow() const { return mnRow; } + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); +}; + +} //namespace binfilter +#endif // _SCH_DATA_ROW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChXDiagram.hxx b/binfilter/bf_sch/source/ui/inc/ChXDiagram.hxx new file mode 100644 index 000000000000..0c1a0831020b --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChXDiagram.hxx @@ -0,0 +1,474 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CHART_DIAGRAM_HXX +#define _CHART_DIAGRAM_HXX + +#include <cppuhelper/implbase.hxx> + +#include <com/sun/star/chart/XDiagram.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart/XTwoAxisXSupplier.hpp> +#include <com/sun/star/chart/XTwoAxisYSupplier.hpp> +#include <com/sun/star/chart/XAxisZSupplier.hpp> +#include <com/sun/star/chart/XStatisticDisplay.hpp> +#include <com/sun/star/chart/X3DDisplay.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <cppuhelper/interfacecontainer.hxx> + +// header for class SvxItemPropertySet +#include <bf_svx/unoipset.hxx> +namespace binfilter { + +class ChartModel; +class SchChartDocShell; +} //namespace binfilter +// GrP gcc 2.95.2 on Mac OS X chokes on this huge template class. +// Expand the template by hand. +//#if ! (defined(MACOSX) && ( __GNUC__ < 3 )) +#if 1 + +// Construct a WeakImplHelper14 with the emphasis on 14. +// Fourteen interfaces are two to many to use the newer template definition +// of WeakImplHelper. +#define __IFC14 Ifc1, Ifc2, Ifc3, Ifc4, Ifc5, Ifc6, Ifc7, Ifc8, Ifc9, Ifc10,\ + Ifc11, Ifc12, Ifc13, Ifc14 +#define __CLASS_IFC14 class Ifc1, class Ifc2, class Ifc3, class Ifc4, \ + class Ifc5, class Ifc6, class Ifc7, class Ifc8, class Ifc9, class Ifc10,\ + class Ifc11, class Ifc12, class Ifc13, class Ifc14 +#define __PUBLIC_IFC14 public Ifc1, public Ifc2, public Ifc3, public Ifc4,\ + public Ifc5, public Ifc6, public Ifc7, public Ifc8, public Ifc9,\ + public Ifc10, public Ifc11, public Ifc12, public Ifc13, public Ifc14 + +__DEF_IMPLHELPER_PRE(14) + __IFC_WRITEOFFSET(1) __IFC_WRITEOFFSET(2) __IFC_WRITEOFFSET(3)\ + __IFC_WRITEOFFSET(4) __IFC_WRITEOFFSET(5) __IFC_WRITEOFFSET(6)\ + __IFC_WRITEOFFSET(7) __IFC_WRITEOFFSET(8) __IFC_WRITEOFFSET(9)\ + __IFC_WRITEOFFSET(10) __IFC_WRITEOFFSET(11) __IFC_WRITEOFFSET(12)\ + __IFC_WRITEOFFSET(13) __IFC_WRITEOFFSET(14) +__DEF_IMPLHELPER_POST(14) + +// !defined(MACOSX) +#else +// defined(MACOSX) && (__GNUC__ < 3 ) + +namespace cppu { + struct ClassData14 : public ClassDataBase + { + Type_Offset arType2Offset[ 14 ]; + ClassData14( ) SAL_THROW( () ) + : ClassDataBase( 14 ) + {} + }; + + class SAL_NO_VTABLE ImplHelperBase14 + : public ::com::sun::star::lang::XTypeProvider + , public ::com::sun::star::chart::XDiagram, + public ::com::sun::star::chart::XAxisZSupplier, + public ::com::sun::star::chart::XTwoAxisXSupplier, + public ::com::sun::star::chart::XTwoAxisYSupplier, + public ::com::sun::star::chart::XStatisticDisplay, + public ::com::sun::star::chart::X3DDisplay, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::beans::XMultiPropertySet, + public ::com::sun::star::beans::XPropertyState, + public ::com::sun::star::beans::XMultiPropertyStates, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XUnoTunnel, + public ::com::sun::star::lang::XComponent, + public ::com::sun::star::lang::XEventListener + { + protected: + ClassData & SAL_CALL getClassData( ClassDataBase & s_aCD ) SAL_THROW( () ) + { + ClassData & rCD = * static_cast< ClassData * >( &s_aCD ); + if (! rCD.bOffsetsInit) + { + ::osl::MutexGuard aGuard( getImplHelperInitMutex() ); + if (! rCD.bOffsetsInit) + { + char * pBase = (char *)this; + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > *)0 ), + (char *)(::com::sun::star::chart::XDiagram *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XAxisZSupplier > *)0 ), + (char *)(::com::sun::star::chart::XAxisZSupplier *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XTwoAxisXSupplier > *)0 ), + (char *)(::com::sun::star::chart::XTwoAxisXSupplier *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XTwoAxisYSupplier > *)0 ), + (char *)(::com::sun::star::chart::XTwoAxisYSupplier *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XStatisticDisplay > *)0 ), + (char *)(::com::sun::star::chart::XStatisticDisplay *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::chart::X3DDisplay > *)0 ), + (char *)(::com::sun::star::chart::X3DDisplay *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ), + (char *)(::com::sun::star::beans::XPropertySet *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), + (char *)(::com::sun::star::beans::XMultiPropertySet *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > *)0 ), + (char *)(::com::sun::star::beans::XPropertyState *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertyStates > *)0 ), + (char *)(::com::sun::star::beans::XMultiPropertyStates *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo > *)0 ), + (char *)(::com::sun::star::lang::XServiceInfo *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > *)0 ), + (char *)(::com::sun::star::lang::XUnoTunnel *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > *)0 ), + (char *)(::com::sun::star::lang::XComponent *)this - pBase ); + rCD.writeTypeOffset( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > *)0 ), + (char *)(::com::sun::star::lang::XEventListener *)this - pBase ); + rCD.bOffsetsInit = sal_True; + } + } + return rCD; + } + }; + + + class SAL_NO_VTABLE ImplHelper14 + : public ImplHelperBase14 + { + static ClassData14 s_aCD; + public: + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) + { return getClassData( s_aCD ).query( rType, (ImplHelperBase14 *)this ); } + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) + { return getClassData( s_aCD ).getTypes(); } + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) + { return getClassData( s_aCD ).getImplementationId(); } + }; + + + class SAL_NO_VTABLE WeakImplHelper14 + : public ::cppu::OWeakObject + , public ImplHelperBase14 + { + static ClassData14 s_aCD; + public: + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException) + { + ::com::sun::star::uno::Any aRet( getClassData( s_aCD ).query( rType, (ImplHelperBase14 *)this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); + } + virtual void SAL_CALL acquire() throw () + { OWeakObject::acquire(); } + virtual void SAL_CALL release() throw () + { OWeakObject::release(); } + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException) + { return getClassData( s_aCD ).getTypes(); } + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException) + { return getClassData( s_aCD ).getImplementationId(); } + }; + + // namespace ::cppu +} + +#endif +namespace binfilter {//STRIP009 + class ChXDiagram : public ::cppu::WeakImplHelper14 + < + ::com::sun::star::chart::XDiagram, + ::com::sun::star::chart::XAxisZSupplier, + ::com::sun::star::chart::XTwoAxisXSupplier, // : XAxisXSupplier + ::com::sun::star::chart::XTwoAxisYSupplier, // : XAxisYSupplier + ::com::sun::star::chart::XStatisticDisplay, + ::com::sun::star::chart::X3DDisplay, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::beans::XMultiPropertySet, + ::com::sun::star::beans::XPropertyState, + ::com::sun::star::beans::XMultiPropertyStates, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XComponent, + ::com::sun::star::lang::XEventListener + > +{ +private: + ::rtl::OUString maServiceName; + sal_Int32 mnBaseType; + ChartModel* mpModel; + SvxItemPropertySet maPropSet; + + // some shape references (ChXChartObjects) + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxXAxisTitle; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxYAxisTitle; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxZAxisTitle; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxXAxis; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxYAxis; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxZAxis; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSecXAxis; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxSecYAxis; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxMajorGridX; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxMajorGridY; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxMajorGridZ; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxMinorGridX; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxMinorGridY; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxMinorGridZ; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxMinMaxLine; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxUpBar; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxDownBar; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxWall; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxFloor; + + + ::com::sun::star::uno::Any GetAnyByItem( SfxItemSet& aSet, const SfxItemPropertyMap* pMap ); + +public: + ChXDiagram( SchChartDocShell* pShell, sal_Bool bPreInit = sal_True ); + virtual ~ChXDiagram(); + + void SetServiceName( const ::rtl::OUString& u ) throw() { maServiceName = u; } + const ::rtl::OUString& getServiceName() throw() { return maServiceName; } + sal_Bool SetDocShell( SchChartDocShell* pDocShell, sal_Bool bKeepModel = sal_False ) throw(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + static ChXDiagram* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw(); + + // XDiagram + virtual ::rtl::OUString SAL_CALL getDiagramType() throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDataRowProperties( sal_Int32 Row ) + throw( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IndexOutOfBoundsException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDataPointProperties( sal_Int32 Column, sal_Int32 Row ) + throw( ::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IndexOutOfBoundsException ); + + // XShape ( ::XDiagram ) + virtual ::com::sun::star::awt::Size SAL_CALL getSize() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& ) + throw( ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::awt::Point SAL_CALL getPosition() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor ( ::XShape ::XDiagram ) + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + + // XAxisXSupplier, XAxisYSupplier, XAxisZSupplier, + // XTwoAxisXSupplier, XTwoAxisYSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getXAxisTitle() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getYAxisTitle() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXAxis() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYAxis() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getZAxis() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryXAxis() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryYAxis() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXMainGrid() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYMainGrid() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getZMainGrid() + throw( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getXHelpGrid() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getYHelpGrid() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getZHelpGrid() + throw( ::com::sun::star::uno::RuntimeException ); + + + // XStatisticDisplay + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinMaxLine() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getUpBar() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getDownBar() + throw( ::com::sun::star::uno::RuntimeException ); + + + // X3DDisplay + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getWall() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor() + throw( ::com::sun::star::uno::RuntimeException ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) + throw (::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener ( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // XMultiPropertyStates + // getPropertyStates already part of interface XPropertyState + virtual void SAL_CALL setAllPropertiesToDefault (void) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertiesToDefault ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults ( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + // supportsService is handled by SvxServiceInfoHelper + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) + throw( ::com::sun::star::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing (const ::com::sun::star::lang::EventObject & Source) + throw (::com::sun::star::uno::RuntimeException); + +protected: + /** @descr In an array of SfxItemPropertyMap entries advance from the position pointed to + by pProperty to that property that has the name given by pPropertyName. If the + property list does not contain such an entry an UnknownPropertyException is thrown. + @param pProperty Pointer into an array of properties. It is modified such that after + the methods returns it points to a property with the same name as pPropertyName. + @param pPropertyName Name of the property that is searched for. + */ + void AdvanceToName (const SfxItemPropertyMap *& pProperty, + const ::rtl::OUString * pPropertyName) + throw (::com::sun::star::beans::UnknownPropertyException); + +private: + /// Mutex used by the interface container. + ::osl::Mutex maMutex; + + /// List of listeners for the XComponent interface. + ::cppu::OInterfaceContainerHelper maListenerList; +}; + +} //namespace binfilter +#endif // _CHART_DIAGRAM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChartArea.hxx b/binfilter/bf_sch/source/ui/inc/ChartArea.hxx new file mode 100644 index 000000000000..49ff1c541e1e --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChartArea.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CHARTAREA_HXX_ +#define _CHARTAREA_HXX_ + +#include "ChXChartObject.hxx" +namespace binfilter { + +class ChartArea : public ChXChartObject +{ +public: + ChartArea( ChartModel* pModel, sal_Int32 nObjectId ); + virtual ~ChartArea(); + + // helpers for XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + +}; + +} //namespace binfilter +#endif // _CHARTAREA_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChartGrid.hxx b/binfilter/bf_sch/source/ui/inc/ChartGrid.hxx new file mode 100644 index 000000000000..6f1b31bdf3b1 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChartGrid.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CHARTGRID_HXX_ +#define _CHARTGRID_HXX_ + +#include "ChXChartObject.hxx" +namespace binfilter { + +class ChartGrid : public ChXChartObject +{ +public: + ChartGrid( ChartModel* pModel, sal_Int32 nObjectId ); + virtual ~ChartGrid(); + + // helpers for XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + +}; + +} //namespace binfilter +#endif // _CHARTGRID_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChartLegend.hxx b/binfilter/bf_sch/source/ui/inc/ChartLegend.hxx new file mode 100644 index 000000000000..e6f6bff55057 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChartLegend.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CHARTLEGEND_HXX_ +#define _CHARTLEGEND_HXX_ + +#include "ChXChartObject.hxx" +namespace binfilter { + +class ChartLegend : public ChXChartObject +{ +public: + ChartLegend( ChartModel* pModel ); + virtual ~ChartLegend(); + + // helpers for XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + +}; + +} //namespace binfilter +#endif // _CHARTLEGEND_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChartLine.hxx b/binfilter/bf_sch/source/ui/inc/ChartLine.hxx new file mode 100644 index 000000000000..babbd6646355 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChartLine.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CHARTLINE_HXX_ +#define _CHARTLINE_HXX_ + +#include "ChXChartObject.hxx" +namespace binfilter { + +class ChartLine : public ChXChartObject +{ +public: + ChartLine( ChartModel* pModel, sal_Int32 nObjectId, sal_Int32 nIndex = -1 ); + virtual ~ChartLine(); + + // helpers for XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + +}; + +} //namespace binfilter +#endif // _CHARTLINE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/ChartTitle.hxx b/binfilter/bf_sch/source/ui/inc/ChartTitle.hxx new file mode 100644 index 000000000000..3f51b107abdd --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/ChartTitle.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CHARTTITLE_HXX_ +#define _CHARTTITLE_HXX_ + +#include "ChXChartObject.hxx" +namespace binfilter { + +class ChartTitle : public ChXChartObject +{ +public: + ChartTitle( ChartModel* pModel, sal_Int32 nObjectId ); + virtual ~ChartTitle(); + + // helpers for XUnoTunnel + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + /// special handling of title specific properties. Sub of getPropertyValues() + void GetPropertyValue( const SfxItemPropertyMap & rProperty, + ::com::sun::star::uno::Any & rValue, + SfxItemSet & rAttributes ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw( ::com::sun::star::uno::RuntimeException ); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType() throw( ::com::sun::star::uno::RuntimeException ); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) + throw( ::com::sun::star::uno::RuntimeException ); + +}; + +} //namespace binfilter +#endif // _CHARTTITLE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/SchTransferable.hxx b/binfilter/bf_sch/source/ui/inc/SchTransferable.hxx new file mode 100644 index 000000000000..0587bcd0e5cd --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/SchTransferable.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SCH_TRANSFERABLE_HXX_ +#define _SCH_TRANSFERABLE_HXX_ + +#include <bf_svtools/transfer.hxx> + +/*N*/ #include <tools/debug.hxx> //for stripping +class Graphic; +class VirtualDevice; +namespace binfilter { +class SdrModel; +class SdrExchangeView; + +class SchTransferable : + public TransferableHelper +{ +private: + SdrExchangeView * mpSourceView; + +protected: + + // implementation of TransferableHelper methods + +public: + + /** CTOR for clipboard, drag and drop and selection clipboard + @param pObjModel the model containing all objects for the clipboard. + The transferable becomes the owner of this model. + @param pSrcView the view for drag and drop and the selection clipboard + The transferable does not care about destruction of this view + @param rObjDesc A descriptor object that holds properties like the starting + position of a drag action + @param bLateInit If true, the actual data is created in GetData (on paste), + else data is created on construction + */ + SchTransferable( SdrModel* pObjModel, + SdrExchangeView* pSrcView, + const TransferableObjectDescriptor& rObjDesc, + sal_Bool bLateInit = sal_False ); + const SdrExchangeView* GetView() throw() { return mpSourceView; } +}; + +} //namespace binfilter +#endif // _SCH_TRANSFERABLE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/dlgctrls.hxx b/binfilter/bf_sch/source/ui/inc/dlgctrls.hxx new file mode 100644 index 000000000000..be1d70797136 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/dlgctrls.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef SD_DLGCTRLS_HXX +#define SD_DLGCTRLS_HXX + +#include <vcl/lstbox.hxx> +#include <vcl/window.hxx> + +#include "schresid.hxx" +namespace binfilter { + +/************************************************************************* +|* +|* FadeEffectLB +|* +\************************************************************************/ +class FadeEffectLB : public ListBox +{ + +public: + FadeEffectLB( Window* pParent, SchResId Id ) : ListBox( pParent, Id ) {} + FadeEffectLB( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {} + + virtual void Fill(); +}; + +} //namespace binfilter +#endif // SD_DLGCTRLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/fudrarea.hxx b/binfilter/bf_sch/source/ui/inc/fudrarea.hxx new file mode 100644 index 000000000000..3b5ea2d2c417 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/fudrarea.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_FUDRAREA_HXX +#define _SCH_FUDRAREA_HXX + +#include "fupoor.hxx" +namespace binfilter { + +class SchFuDrawingArea : public SchFuPoor +{ + public: + SchFuDrawingArea(SchViewShell* pViewSh, SchWindow* pWin, + SchView* pView, ChartModel* pDoc, + SfxRequest& rReq); + + virtual ~SchFuDrawingArea(); + + virtual void Activate() {} + virtual void Deactivate() {} +}; + +} //namespace binfilter +#endif // _SCH_FUDRAREA_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/fudraw.hxx b/binfilter/bf_sch/source/ui/inc/fudraw.hxx new file mode 100644 index 000000000000..18d12f2fb9fe --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/fudraw.hxx @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_FUDRAW_HXX +#define _SCH_FUDRAW_HXX + +#include "fupoor.hxx" +namespace binfilter { + +/************************************************************************* +|* +|* Basisklasse fuer alle Drawmodul-spezifischen Funktionen +|* +\************************************************************************/ + +class SdrObject; + +class SchFuDraw : public SchFuPoor +{ +protected: + Pointer aNewPointer; + Pointer aOldPointer; + BOOL bMBDown; + + /** possible directions in which to select objects + */ + enum lcl_Selection_Direction + { + lcl_SELECT_PREVIOUS, + lcl_SELECT_NEXT, + lcl_SELECT_FIRST, + lcl_SELECT_LAST + }; + + /** possible directions in which to move an object + */ + enum lcl_Movement_Direction + { + lcl_MOVE_LEFT, + lcl_MOVE_RIGHT, + lcl_MOVE_UP, + lcl_MOVE_DOWN + }; + + /** marks the next/previous/first or last object in the current + group of chart objects. + + @param eDirection determines in which direction to travel + + @param nDepth is to prevent a loop in recursion. When + selecting a new object, this may be invalid. In this + case the method tries the next object. If the last + object is reached without success, the first is + selected using a recursive call. If no valid objects + are available at all this parameter avoids a loop + (which should normally never occur). + + @param bEnterDiagram determines if during navigation the + diagram should be ignored as group and its content + rather be treated as top-level objects. This parameter + is especially needed so that the diagram can still be + selected (without entering). + + @returns TRUE, if an object could be marked + */ + + /** moves an object in one of the four directions given in + lcl_Movement_Direction. This is only possible for top-level + chart objects, i.e., titles, legend and diagram + + @param eDirection the direction in which to move. If an + object is too close to the edge, the object is not + moved. + + @param nAmount the amount of units to be moved about. The + unit can be 100th of a mm or pixels depending on what + bPixel is set to. + + @param bPixel If true, the amount nAmount is treated as pixels + in the current window, otherwise the current logical + unit is used, which in a chart is always 100th of a mm. + + @returns TRUE, if the object could be moved + */ + + /** resizes an object by the amount given into the larger of width + and height. In the smaller extent the amount is calculated + such that the resize is proportional. + + @param nAmount the amount by which the object will be resized. + The amount will be added to the larger extent (width or + height). The resize is proportional in the other + direction. + + @param bPixel If true, the amount nAmount is treated as pixels + in the current window for the larger of width and + height. Otherwise the current logical unit is used, + which in a chart is always 100th of a mm. + + @returns TRUE, if the object could be resized + */ + + /** moves a pie segment by the given amount in percent + + @param bOut if true increases the offset, otherwise decreases + the offset. The offset stays always between 0 and 100. + + @param nAmount the amount of percent by which the pie segment + is dragged. + + @returns TRUE, if the object was a pie and could be moved + */ + + /** determines if the object currently selected is valid, i.e. it + may be selected in the UI for making changes. + + @returns true, if a valid object is selected. + */ + + /** For some objects only the 8 green handles of the group are + shown, for others a special handling is required, e.g. bars in + a bar chart. This is done here for the currently selected + object. + */ + + /** Some groups in a chart may not be entered, e.g. an axis + object. Otherwise you would be able to select all tick-mark + objects or labels. + + @returns true, if the currently selected object is a group + that may be entered, e.g. a data series object. + */ + + /** get the object which is currently selected in the UI. In the + chart this can only be one object at a time. + */ + + /** after move or resize there have to be some things set at chart + objects and the model. It is called by MoveMarkedObject. + */ + +public: + + SchFuDraw(SchViewShell* pViewSh, SchWindow* pWin, SchView* pView, + ChartModel* pDoc, SfxRequest& rReq); + virtual ~SchFuDraw(); + + + virtual void Activate(); + + virtual void ForcePointer(const MouseEvent* pMEvt = NULL); + +}; + +} //namespace binfilter +#endif // _SCH_FUDRAW_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/fupoor.hxx b/binfilter/bf_sch/source/ui/inc/fupoor.hxx new file mode 100644 index 000000000000..5cd79ac586f3 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/fupoor.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_FUPOOR_HXX +#define _SCH_FUPOOR_HXX +//------------------------------------------------------------------ +// +// dieses Define dient nur zum Testen und darf auf keinen Fall aktiv bleiben +// Bei Umstellungen alle Files nach SIG_CHARTMODELDEFSCHDOC durchsuchen +// #define ChartModel SchChartDocument +//------------------------------------------------------------------ + +#include <vcl/dialog.hxx> + +#include "objid.hxx" +namespace binfilter { + +class SchView; +class SchViewShell; +class SchWindow; +class ChartModel; +class SfxRequest; + +#define HITPIX 2 // Hit-Toleranz in Pixel +#define DRGPIX 2 // Drag MinMove in Pixel + + +/************************************************************************* +|* +|* Basisklasse fuer alle Funktionen +|* +\************************************************************************/ + +class SchFuPoor +{ +protected: + SchView* pView; + SchViewShell* pViewShell; + SchWindow* pWindow; + ChartModel* pChDoc; + + USHORT nSlotId; + USHORT nSlotValue; + + Dialog* pDialog; + + Timer aDragTimer; // fuer Drag&Drop + DECL_LINK(DragHdl, Timer*); + BOOL bIsInDragMode; + Point aMDPos; // Position von MouseButtonDown + + SdrObject *pMarkedObj; + SchObjectId *pMarkedObjId; + UINT16 nMarkedID; + + BOOL bFirstMouseMove; + + +public: + + SchFuPoor(SchViewShell* pViewSh, SchWindow* pWin, SchView* pView, + ChartModel* pDoc, SfxRequest& rReq); + virtual ~SchFuPoor(); + + + // Mouse- & Key-Events; Returnwert=TRUE: Event wurde bearbeitet + + virtual void Activate(); // Function aktivieren + virtual void Deactivate(); // Function deaktivieren + + + + USHORT GetSlotID() const { return( nSlotId ); } + +}; + +} //namespace binfilter +#endif // _SCH_FUPOOR_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/fuscale.hxx b/binfilter/bf_sch/source/ui/inc/fuscale.hxx new file mode 100644 index 000000000000..1bcaa52fceab --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/fuscale.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _SCH_FUSCALE_HXX +#define _SCH_FUSCALE_HXX + +#include "fupoor.hxx" +namespace binfilter { + +class SchFuScale : public SchFuPoor +{ + public: + SchFuScale(SchViewShell* pViewSh, SchWindow* pWin, SchView* pView, + ChartModel* pDoc, SfxRequest& rReq); + virtual ~SchFuScale(); + + virtual void Activate(); // Function aktivieren + virtual void Deactivate(); // Function deaktivieren +}; + +} //namespace binfilter +#endif // _SCH_FUSCALE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/fusel.hxx b/binfilter/bf_sch/source/ui/inc/fusel.hxx new file mode 100644 index 000000000000..44b85d68b741 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/fusel.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_FUSEL_HXX +#define _SCH_FUSEL_HXX + + +#include "fudraw.hxx" +namespace binfilter { + +class SdrDragMethod; +class SdrCircObj; + +/************************************************************************* +|* +|* Basisklasse fuer alle Funktionen +|* +\************************************************************************/ + +class SchFuSelection : public SchFuDraw +{ +protected: + BOOL bWasSelected; + BOOL bVCAction; + SdrDragMethod* pDragMethod; + + +public: + + SchFuSelection(SchViewShell* pViewSh, SchWindow* pWin, SchView* pView, + ChartModel* pDoc, SfxRequest& rReq); + + virtual ~SchFuSelection(); + + + virtual void Activate(); + virtual void Deactivate(); +}; + +} //namespace binfilter +#endif // _SCH_FUSEL_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/fuzoom.hxx b/binfilter/bf_sch/source/ui/inc/fuzoom.hxx new file mode 100644 index 000000000000..ac998999cad5 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/fuzoom.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_FUZOOM_HXX +#define _SCH_FUZOOM_HXX + + +#include "fupoor.hxx" +namespace binfilter { + +/************************************************************************* +|* +|* Funktion Zoom +|* +\************************************************************************/ + +class SchFuZoom : public SchFuPoor +{ + protected: + Point aBeginPos; + Rectangle aZoomRect; + BOOL bVisible; + BOOL bStartDrag; + Pointer aPtr; + + public: + SchFuZoom(SchViewShell* pViewSh, SchWindow* pWin, SchView* pView, + ChartModel* pDoc, SfxRequest& rReq); + + virtual ~SchFuZoom(); + // Mouse- & Key-Events + virtual BOOL KeyInput(const KeyEvent& rKEvt); + virtual BOOL MouseMove(const MouseEvent& rMEvt); + virtual BOOL MouseButtonUp(const MouseEvent& rMEvt); + virtual BOOL MouseButtonDown(const MouseEvent& rMEvt); + + virtual void Activate(); // Function aktivieren + virtual void Deactivate(); // Function deaktivieren +}; + + + +} //namespace binfilter +#endif // _SCH_FUZOOM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/globopt.hxx b/binfilter/bf_sch/source/ui/inc/globopt.hxx new file mode 100644 index 000000000000..1194c5c47422 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/globopt.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SCH_GLOBOPT_HXX +#define _SCH_GLOBOPT_HXX + +#include <vcl/fldunit.hxx> +namespace binfilter { + +namespace sch +{ + +namespace util +{ + +/** @descr Retrieve the FieldUnit to be used for the UI. This unit is retrieved + from the registry settings of the Calc application. + + If this setting can not be found there is a fallback to cm which is the most + common setting worldwide (or not?) + + @return the FieldUnit enum. See <vcl/fldunit.hxx> for definition + */ +FieldUnit GetMeasureUnit(); + +} // namespace util +} // namespace sch + + +// _SCH_GLOBOPT_HXX +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/guiutil.hxx b/binfilter/bf_sch/source/ui/inc/guiutil.hxx new file mode 100644 index 000000000000..cd0e590b28b1 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/guiutil.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SCH_GUI_UTIL_HXX +#define _SCH_GUI_UTIL_HXX + +#include <tools/solar.h> +namespace binfilter { +class ChartModel; + +class GuiUtilities +{ +public: + static USHORT GetObjectNameResId(UINT16 nObjId, ChartModel& rDoc); +}; + +} //namespace binfilter +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/res_bmp.hrc b/binfilter/bf_sch/source/ui/inc/res_bmp.hrc new file mode 100644 index 000000000000..ddd968c8d16f --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/res_bmp.hrc @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <bf_sfx2/sfx.hrc> + + +//#define RID_APP_START 30000 +#define RID_DRAW_TOOLBOX (RID_SCH_START + 1) +#define RID_STATUSBAR (RID_APP_START + 10002) +//#define RID_ALIGNMENT (RID_APP_START + 3) +//#define RID_ZOOM (RID_APP_START + 4) +//#define RID_CONTROLS (RID_APP_START + 5) +//#define RID_TEXT_TOOLBOX (RID_APP_START + 6) + + + + + +#define RID_ACCEL (RID_APP_START + 80) +#define RID_MENU (RID_APP_START + 81) +#define RID_PORTAL_MENU (RID_APP_START + 82) + + + + + + +// Popup-Menus + + +//*** diff --git a/binfilter/bf_sch/source/ui/inc/res_hc_bmp.hrc b/binfilter/bf_sch/source/ui/inc/res_hc_bmp.hrc new file mode 100644 index 000000000000..fdb4a0146fdc --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/res_hc_bmp.hrc @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <bf_svtools/solar.hrc> + +// RID_SCH_START is 30512 (see svtools/solar.hrc) + +// chart types + +#define BMP_AREAS_2D_HC ( RID_SCH_START + 0 ) +#define BMP_AREAS_2D_1_HC ( RID_SCH_START + 1 ) +#define BMP_AREAS_2D_3_HC ( RID_SCH_START + 2 ) +#define BMP_AREAS_3D_HC ( RID_SCH_START + 3 ) +#define BMP_AREAS_3D_1_HC ( RID_SCH_START + 4 ) +#define BMP_AREAS_3D_2_HC ( RID_SCH_START + 5 ) +#define BMP_BARS_2D_HC ( RID_SCH_START + 6 ) +#define BMP_BARS_2D_1_HC ( RID_SCH_START + 7 ) +#define BMP_BARS_2D_2_HC ( RID_SCH_START + 8 ) +#define BMP_BARS_2D_3_HC ( RID_SCH_START + 9 ) +#define BMP_BARS_3D_HC ( RID_SCH_START + 10 ) +#define BMP_BARS_3D_1_HC ( RID_SCH_START + 11 ) +#define BMP_BARS_3D_2_HC ( RID_SCH_START + 12 ) +#define BMP_BARS_3D_3_HC ( RID_SCH_START + 13 ) +#define BMP_CIRCLES_2D_HC ( RID_SCH_START + 14 ) +#define BMP_CIRCLES_2D_1_HC ( RID_SCH_START + 15 ) +#define BMP_CIRCLES_2D_2_HC ( RID_SCH_START + 16 ) +#define BMP_CIRCLES_3D_HC ( RID_SCH_START + 17 ) +#define BMP_COLUMNS_2D_HC ( RID_SCH_START + 18 ) +#define BMP_COLUMNS_2D_1_HC ( RID_SCH_START + 19 ) +#define BMP_COLUMNS_2D_2_HC ( RID_SCH_START + 20 ) +#define BMP_COLUMNS_2D_3_HC ( RID_SCH_START + 21 ) +#define BMP_COLUMNS_2D_4_HC ( RID_SCH_START + 22 ) +#define BMP_COLUMNS_3D_HC ( RID_SCH_START + 23 ) +#define BMP_COLUMNS_3D_1_HC ( RID_SCH_START + 24 ) +#define BMP_COLUMNS_3D_2_HC ( RID_SCH_START + 25 ) +#define BMP_COLUMNS_3D_3_HC ( RID_SCH_START + 26 ) +#define BMP_DONUT1_2D_HC ( RID_SCH_START + 27 ) +#define BMP_KEGELQ_3D_1_HC ( RID_SCH_START + 28 ) +#define BMP_KEGELQ_3D_2_HC ( RID_SCH_START + 29 ) +#define BMP_KEGELQ_3D_3_HC ( RID_SCH_START + 30 ) +#define BMP_KEGELQ_3D_4_HC ( RID_SCH_START + 31 ) +#define BMP_KEGEL_3D_1_HC ( RID_SCH_START + 32 ) +#define BMP_KEGEL_3D_2_HC ( RID_SCH_START + 33 ) +#define BMP_KEGEL_3D_3_HC ( RID_SCH_START + 34 ) +#define BMP_KEGEL_3D_4_HC ( RID_SCH_START + 35 ) +#define BMP_LINESYMB_2D_HC ( RID_SCH_START + 36 ) +#define BMP_LINESYMB_2D_1_HC ( RID_SCH_START + 37 ) +#define BMP_LINESYMB_2D_2_HC ( RID_SCH_START + 38 ) +#define BMP_LINESYMB_2D_3_HC ( RID_SCH_START + 39 ) +#define BMP_LINES_2D_HC ( RID_SCH_START + 40 ) +#define BMP_LINES_2D_1_HC ( RID_SCH_START + 41 ) +#define BMP_LINES_2D_2_HC ( RID_SCH_START + 42 ) +#define BMP_LINES_2D_3_HC ( RID_SCH_START + 43 ) +#define BMP_LINES_3D_HC ( RID_SCH_START + 44 ) +#define BMP_NETSYMB_2D_HC ( RID_SCH_START + 45 ) +#define BMP_NETSYMB_2D_PERCENT_HC ( RID_SCH_START + 46 ) +#define BMP_NETSYMB_2D_STACK_HC ( RID_SCH_START + 47 ) +#define BMP_NET_2D_HC ( RID_SCH_START + 48 ) +#define BMP_NET_2D_PERCENT_HC ( RID_SCH_START + 49 ) +#define BMP_NET_2D_STACK_HC ( RID_SCH_START + 50 ) +#define BMP_PYRAMIDQ_3D_1_HC ( RID_SCH_START + 51 ) +#define BMP_PYRAMIDQ_3D_2_HC ( RID_SCH_START + 52 ) +#define BMP_PYRAMIDQ_3D_3_HC ( RID_SCH_START + 53 ) +#define BMP_PYRAMIDQ_3D_4_HC ( RID_SCH_START + 54 ) +#define BMP_PYRAMID_3D_1_HC ( RID_SCH_START + 55 ) +#define BMP_PYRAMID_3D_2_HC ( RID_SCH_START + 56 ) +#define BMP_PYRAMID_3D_3_HC ( RID_SCH_START + 57 ) +#define BMP_PYRAMID_3D_4_HC ( RID_SCH_START + 58 ) +#define BMP_ROEHRE_3D_1_HC ( RID_SCH_START + 59 ) +#define BMP_ROEHRE_3D_2_HC ( RID_SCH_START + 60 ) +#define BMP_ROEHRE_3D_3_HC ( RID_SCH_START + 61 ) +#define BMP_ROEHRE_3D_4_HC ( RID_SCH_START + 62 ) +#define BMP_SAEULE_3D_1_HC ( RID_SCH_START + 63 ) +#define BMP_SAEULE_3D_2_HC ( RID_SCH_START + 64 ) +#define BMP_SAEULE_3D_3_HC ( RID_SCH_START + 65 ) +#define BMP_SAEULE_3D_4_HC ( RID_SCH_START + 66 ) +#define BMP_SPLINE_B_HC ( RID_SCH_START + 67 ) +#define BMP_SPLINE_B_SYMBOL_HC ( RID_SCH_START + 68 ) +#define BMP_SPLINE_CUBIC_HC ( RID_SCH_START + 69 ) +#define BMP_SPLINE_CUBIC_SYMBOL_HC ( RID_SCH_START + 70 ) +#define BMP_STOCK_1_HC ( RID_SCH_START + 71 ) +#define BMP_STOCK_2_HC ( RID_SCH_START + 72 ) +#define BMP_STOCK_3_HC ( RID_SCH_START + 73 ) +#define BMP_STOCK_4_HC ( RID_SCH_START + 74 ) +#define BMP_SURF_3D_HC ( RID_SCH_START + 75 ) +#define BMP_XYSYMB_2D_HC ( RID_SCH_START + 76 ) +#define BMP_XYZSYMB_3D_HC ( RID_SCH_START + 77 ) +#define BMP_XYZ_3D_HC ( RID_SCH_START + 78 ) +#define BMP_XY_2D_HC ( RID_SCH_START + 79 ) +#define BMP_COLUMNS_2D_5_HC ( RID_SCH_START + 80 ) + +// statistics + +#define BMP_INDICATE_NONE_HC ( RID_SCH_START + 81 ) +#define BMP_INDICATE_BOTH_HC ( RID_SCH_START + 82 ) +#define BMP_INDICATE_UP_HC ( RID_SCH_START + 83 ) +#define BMP_INDICATE_DOWN_HC ( RID_SCH_START + 84 ) + +#define BMP_REGRESSION_NONE_HC ( RID_SCH_START + 85 ) +#define BMP_REGRESSION_LINEAR_HC ( RID_SCH_START + 86 ) +#define BMP_REGRESSION_LOG_HC ( RID_SCH_START + 87 ) +#define BMP_REGRESSION_EXP_HC ( RID_SCH_START + 88 ) +#define BMP_REGRESSION_POWER_HC ( RID_SCH_START + 89 ) diff --git a/binfilter/bf_sch/source/ui/inc/schhids.h b/binfilter/bf_sch/source/ui/inc/schhids.h new file mode 100644 index 000000000000..d24b7712f918 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/schhids.h @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + + +#include <bf_svtools/solar.hrc> + +#define HID_SCH_DATA_ROW (HID_SCH_START + 0) +#define HID_SCH_DATA_LINE (HID_SCH_START + 1) +#define HID_SCH_DATA_POINT (HID_SCH_START + 2) +#define HID_SCH_DIAGRAM_X_AXIS (HID_SCH_START + 3) + +#define HID_SCH_ALIGNMENT (HID_SCH_START + 4) +#define HID_SCH_LEGEND_POS (HID_SCH_START + 5) +#define HID_SCH_DATA_DESCR (HID_SCH_START + 6) +#define HID_SCH_SCALE_Y (HID_SCH_START + 7) +#define HID_SCH_STAT (HID_SCH_START + 8) +#define HID_SCH_WIN_DOCUMENT (HID_SCH_START + 9) +#define HID_SCH_CTL_DATA (HID_SCH_START + 10) +#define HID_SCH_CT_INDICATE (HID_SCH_START + 11) +#define HID_SCH_CT_REGRESS (HID_SCH_START + 12) +#define HID_SCH_CT_1_CHARTTYPE (HID_SCH_START + 13) +#define HID_SCH_CT_2_CHARTVARIANT (HID_SCH_START + 14) +#define HID_SCH_CTL_TYPE (HID_SCH_START + 15) +#define HID_SCH_CTL_VARIANT (HID_SCH_START + 16) +#define HID_SCH_CTL_LIGHT (HID_SCH_START + 17) +#define HID_SCH_CT_INDICATE2 (HID_SCH_START + 18) +#define HID_SCH_CT_REGRESS2 (HID_SCH_START + 19) +#define HID_SCH_TBI_EDIT_CANCEL (HID_SCH_START + 20) +#define HID_SCH_TBI_EDIT_ACCEPT (HID_SCH_START + 21) +#define HID_SCH_TBI_DATA_TRANSFER (HID_SCH_START + 22) +#define HID_SCH_TBI_DATA_INSERT_ROW (HID_SCH_START + 23) +#define HID_SCH_TBI_DATA_INSERT_COL (HID_SCH_START + 24) +#define HID_SCH_TBI_DATA_DELETE_ROW (HID_SCH_START + 25) +#define HID_SCH_TBI_DATA_DELETE_COL (HID_SCH_START + 26) +#define HID_SCH_TBI_DATA_SWAP_COL (HID_SCH_START + 27) +#define HID_SCH_TBI_DATA_SWAP_ROW (HID_SCH_START + 28) +#define HID_SCH_TBI_DATA_SORT_ROW (HID_SCH_START + 29) +#define HID_SCH_TBI_DATA_SORT_COL (HID_SCH_START + 30) +#define HID_SCH_TBI_DATA_SORT_TABLE_ROW (HID_SCH_START + 31) +#define HID_SCH_TBI_DATA_SORT_TABLE_COL (HID_SCH_START + 32) + +#define HID_SCH_TBX_EDIT (HID_SCH_START + 33) +#define HID_SCH_TBX_DATA (HID_SCH_START + 34) + + +#define HID_SCH_ALIGNMENT_CTR_DIAL (HID_SCH_START + 35) +#define HID_SCH_ALIGNMENT_STACKED (HID_SCH_START + 36) +#define HID_SCH_ALIGNMENT_DEGREES (HID_SCH_START + 37) + +#define HID_SCH_LAYOUT (HID_SCH_START + 38) + +#define HID_SCH_TBX_EDIT_FIELD (HID_SCH_START + 39) +#define HID_SCH_DIAGRAM_Y_AXIS (HID_SCH_START + 40)//war mal 3 + +#define HID_SCH_DEF_COLOR (HID_SCH_START + 41) +#define HID_SCH_TP_AXIS_LABEL (HID_SCH_START + 42) + +#define HID_SCH_NUM_OF_LINES (HID_SCH_START + 43) + +#define HID_SCH_CHART_AUTO_FORMAT (HID_SCH_START + 44) + +// HID_SCH_START should be 63280 (checked 25.Nov 2002) + +// 453 == SCH_IF_CHARTVIEWSHELL, da SFX_INTERFACE_LIB kein +// Define sondern neuerdings ein Enum ist +#define HID_SCH_VIEWSHELL_DOCUMENT (453) +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/sdvcbrw.hxx b/binfilter/bf_sch/source/ui/inc/sdvcbrw.hxx new file mode 100644 index 000000000000..209cc45e6a00 --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/sdvcbrw.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SDVCBRW_HXX +#define _SDVCBRW_HXX +/* +#include <bf_svx/vcbrw.hxx> +*/ +#include <bf_svtools/brdcst.hxx> + +#include <bf_svtools/lstner.hxx> +namespace binfilter { + +class SdrView; + +/************************************************************************* +|* +|* Klasse fuer Browser +|* +\************************************************************************/ +class SdVCBrowser : public VCBrowser //, public SfxListener, public SfxBroadcaster +{ +protected: + SdrView* pView; + BOOL bUpdate; + + BOOL Close(); + + virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, + const SfxHint& rHint, const TypeId& rHintType ); + void Modify(); + + +public: + SdVCBrowser( Window* pParent ); + + void Update( SdrView* pView ); +}; + + + + +} //namespace binfilter +#endif // _SDVCBRW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/inc/tbx_ww.hxx b/binfilter/bf_sch/source/ui/inc/tbx_ww.hxx new file mode 100644 index 000000000000..c5e9c6c5964c --- /dev/null +++ b/binfilter/bf_sch/source/ui/inc/tbx_ww.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + + +#ifndef _SCH_TBX_WW_HXX +#define _SCH_TBX_WW_HXX + +#include <vcl/toolbox.hxx> +#include <bf_sfx2/tbxctrl.hxx> + + +#include "schresid.hxx" +namespace binfilter { + +//------------------------------------------------------------------------ + +class SchPopupWindowTbx : public SfxPopupWindow +{ +private: + ToolBox aTbx; + +public: + SchPopupWindowTbx( USHORT nId, SfxToolBoxControl* pTbxCtl, + SchResId aRIdWin, SchResId aRIdTbx, + SfxBindings& rBindings ); + ~SchPopupWindowTbx() {} + + void StartSelection() { aTbx.StartSelection(); } + void SelectHdl( void* p ); +}; + +} //namespace binfilter +#endif // _SCH_TBX_WW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartAxis.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartAxis.xml new file mode 100644 index 000000000000..83090d61c2ad --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartAxis.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXChartAxis</name> + <description> + This component provides access to axis objects of a chart +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartAxis</supported-service> + <supported-service>com.sun.star.drawing.LineProperties</supported-service> + <supported-service>com.sun.star.style.CharacterProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartData.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartData.xml new file mode 100644 index 000000000000..ca50925fac39 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartData.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXChartData</name> + <description> + This component yields access to the data of a chart +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartData</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartDataArray.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartDataArray.xml new file mode 100644 index 000000000000..431a44fc5b47 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartDataArray.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXChartDataArray</name> + <description> + With this component you can retrieve or alter the data of a chart +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartData</supported-service> + <supported-service>com.sun.star.chart.ChartDataArray</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartDocument.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartDocument.xml new file mode 100644 index 000000000000..08ae9a42fc0a --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartDocument.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXChartDocument</name> + <description> + This component represents the document (XModel) that + contains a chart +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartDocument</supported-service> + <supported-service>com.sun.star.chart.ChartTableAddressSupplier</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartView.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartView.xml new file mode 100644 index 000000000000..79a9d9c1a2d5 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXChartView.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXChartView</name> + <description> + This component provides access to the view of a chart document. + It can be used to select objects inside the chart as if clicked + using the mouse. +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.view.OfficeDocumentView</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXDataPoint.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXDataPoint.xml new file mode 100644 index 000000000000..69b167ea53f6 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXDataPoint.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXDataPoint</name> + <description> + This component bears properties for data point objects of + a chart +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartDataPointProperties</supported-service> + <supported-service>com.sun.star.drawing.LineProperties</supported-service> + <supported-service>com.sun.star.drawing.FillProperties</supported-service> + <supported-service>com.sun.star.style.CharacterProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXDataRow.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXDataRow.xml new file mode 100644 index 000000000000..18487050d2bf --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXDataRow.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXDataRow</name> + <description> + This component provides properties for a series of a chart, + i.e. a group of corresponding data points +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartDataPointProperties</supported-service> + <supported-service>com.sun.star.chart.ChartDataRowProperties</supported-service> + <supported-service>com.sun.star.chart.ChartStatistics</supported-service> + <supported-service>com.sun.star.drawing.LineProperties</supported-service> + <supported-service>com.sun.star.drawing.FillProperties</supported-service> + <supported-service>com.sun.star.style.CharacterProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChXDiagram.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChXDiagram.xml new file mode 100644 index 000000000000..e567ffeb8a05 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChXDiagram.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChXDiagram</name> + <description> + This component provides access to the plotting area of the chart, + i.e. the object where the chart data is represented graphically. +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.Diagram</supported-service> + <supported-service>com.sun.star.chart.LineDiagram</supported-service> + <supported-service>com.sun.star.chart.ChartAxisXSupplier</supported-service> + <supported-service>com.sun.star.chart.ChartAxisYSupplier</supported-service> + <supported-service>com.sun.star.chart.ChartTwoAxisXSupplier</supported-service> + <supported-service>com.sun.star.chart.ChartTwoAxisYSupplier</supported-service> + <supported-service>com.sun.star.chart.StackableDiagram</supported-service> + <supported-service>com.sun.star.chart.Dim3DDiagram</supported-service> + <supported-service>com.sun.star.chart.AreaDiagram</supported-service> + <supported-service>com.sun.star.chart.BarDiagram</supported-service> + <supported-service>com.sun.star.chart.PieDiagram</supported-service> + <supported-service>com.sun.star.chart.DonutDiagram</supported-service> + <supported-service>com.sun.star.chart.XYDiagram</supported-service> + <supported-service>com.sun.star.chart.NetDiagram</supported-service> + <supported-service>com.sun.star.chart.StockDiagram</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChartArea.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChartArea.xml new file mode 100644 index 000000000000..285472f6760d --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChartArea.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChartArea</name> + <description> + This component represents the background object of the entire + chart region. +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartArea</supported-service> + <supported-service>com.sun.star.drawing.FillProperties</supported-service> + <supported-service>com.sun.star.drawing.LineProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChartGrid.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChartGrid.xml new file mode 100644 index 000000000000..0652b89f6595 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChartGrid.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChartGrid</name> + <description> + This component provides access to the line objects representing + grids inside the plot area of a chart +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartGrid</supported-service> + <supported-service>com.sun.star.drawing.LineProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChartLegend.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChartLegend.xml new file mode 100644 index 000000000000..de8c69cf85e1 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChartLegend.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChartLegend</name> + <description> + This component provides access to the legend object of a chart +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartLegend</supported-service> + <supported-service>com.sun.star.style.CharacterProperties</supported-service> + <supported-service>com.sun.star.drawing.FillProperties</supported-service> + <supported-service>com.sun.star.drawing.LineProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChartLine.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChartLine.xml new file mode 100644 index 000000000000..4e03597f6875 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChartLine.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChartLine</name> + <description> + This component provides line properties of several linear objects + in a chart like a mean-value-line or a regression curve +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartLine</supported-service> + <supported-service>com.sun.star.drawing.LineProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/descr/ChartTitle.xml b/binfilter/bf_sch/source/ui/unoidl/descr/ChartTitle.xml new file mode 100644 index 000000000000..8972f3c97f5b --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/descr/ChartTitle.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name>sch</module-name> + <component-description> + <author>Bjoern Milcke</author> + <name>com.sun.star.comp.office.ChartTitle</name> + <description> + This component provides main-/subtitle of the chart and + titles of axis objects +</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="final"/> + <supported-service>com.sun.star.chart.ChartTitle</supported-service> + <supported-service>com.sun.star.drawing.Shape</supported-service> + <supported-service>com.sun.star.style.CharacterProperties</supported-service> + <supported-service>com.sun.star.xml.UserDefinedAttributeSupplier</supported-service> + </component-description> +</module-description> diff --git a/binfilter/bf_sch/source/ui/unoidl/makefile.mk b/binfilter/bf_sch/source/ui/unoidl/makefile.mk new file mode 100644 index 000000000000..041c621a164c --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/makefile.mk @@ -0,0 +1,90 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +PRJ=..$/..$/..$/.. +BFPRJ=..$/..$/.. + +PRJNAME = binfilter +PROJECTPCH = sch +PROJECTPCHSOURCE = $(BFPRJ)$/util$/sch_sch +TARGET = sch_chxchart +ENABLE_EXCEPTIONS = TRUE +BOOTSTRAP_SERVICE = FALSE + +# --- Settings ----------------------------------------------------- +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sch + +.IF "$(GUI)" == "WNT" +CFLAGS+=-Zm500 +.ENDIF + +# --- Files -------------------------------------------------------- + +CXXFILES = \ + sch_ChXChartAxis.cxx \ + sch_ChXChartData.cxx \ + sch_ChXChartDataChangeEventListener.cxx \ + sch_ChXChartDocument.cxx \ + sch_ChXChartObject.cxx \ + sch_ChXDataPoint.cxx \ + sch_ChXDataRow.cxx \ + sch_ChXDiagram.cxx \ + sch_mapprov.cxx \ + sch_ChXChartDrawPage.cxx \ + sch_ChartLegend.cxx \ + sch_ChartTitle.cxx \ + sch_ChartLegend.cxx \ + sch_ChartArea.cxx \ + sch_ChartLine.cxx \ + sch_ChartGrid.cxx \ + sch_register.cxx \ + sch_unodoc.cxx + +SLOFILES = \ + $(SLO)$/sch_ChXChartAxis.obj \ + $(SLO)$/sch_ChXChartData.obj \ + $(SLO)$/sch_ChXChartDataChangeEventListener.obj \ + $(SLO)$/sch_ChXChartDocument.obj \ + $(SLO)$/sch_ChXChartObject.obj \ + $(SLO)$/sch_ChXDataPoint.obj \ + $(SLO)$/sch_ChXDataRow.obj \ + $(SLO)$/sch_ChXDiagram.obj \ + $(SLO)$/sch_mapprov.obj \ + $(SLO)$/sch_ChXChartDrawPage.obj \ + $(SLO)$/sch_ChartLegend.obj \ + $(SLO)$/sch_ChartTitle.obj \ + $(SLO)$/sch_ChartArea.obj \ + $(SLO)$/sch_ChartLine.obj \ + $(SLO)$/sch_ChartGrid.obj \ + $(SLO)$/sch_register.obj \ + $(SLO)$/sch_unodoc.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartAxis.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartAxis.cxx new file mode 100644 index 000000000000..021e4add9e08 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartAxis.cxx @@ -0,0 +1,901 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "ChXChartAxis.hxx" +#include "schattr.hxx" + +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> +#include <rtl/uuid.h> +#include <rtl/memory.h> +#include <rtl/ustring.h> + +// header for SvxDoubleItem +#ifndef _SVX_CHRTITEM_HXX +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT + +#include <bf_svtools/eitem.hxx> + +#endif +#include "charttyp.hxx" +// header for SvxUnoTextRangeBase +// for OWN_ATTR_... +#include <bf_svx/unoshprp.hxx> +// for SID_ATTR_... +#include <bf_svx/svxids.hrc> +#include <bf_svx/unoshape.hxx> + +#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> + +#include "chaxis.hxx" +#include "mapprov.hxx" +#include "pairs.hxx" + +#include "unonames.hxx" + +namespace binfilter { + +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; + + +ChXChartAxis::ChXChartAxis( ChartModel* _Model, long _WhichId ) : + ChXChartObject( CHMAP_AXIS, _Model, _WhichId ) +{ +} + +ChXChartAxis::~ChXChartAxis() +{} + + +::rtl::OUString SAL_CALL ChXChartAxis::getImplementationName() +throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXChartAxis" ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartAxis::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Sequence< ::rtl::OUString > aSeq( 4 ); + aSeq[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartAxis" ); + aSeq[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" ); + aSeq[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.style.CharacterProperties" ); + aSeq[ 3 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + return aSeq; +} + +// generate a unique Id +const uno::Sequence< sal_Int8 > & ChXChartAxis::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +void ChXChartAxis::InitNumberFormatter() throw( uno::RuntimeException ) +{ + if( ! rNumberFormatter.is()) + { + if( mpModel ) + rNumberFormatter = new SvNumberFormatsSupplierObj( mpModel->GetNumFormatter() ); + else + rNumberFormatter = new SvNumberFormatsSupplierObj(); + } + + if( ! rNumberFormatter.is()) + throw uno::RuntimeException(); +} + +// XNumberFormatsSupplier +uno::Reference< beans::XPropertySet > SAL_CALL ChXChartAxis::getNumberFormatSettings() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + InitNumberFormatter(); + + return rNumberFormatter.get()->getNumberFormatSettings(); +} + +uno::Reference< util::XNumberFormats > SAL_CALL ChXChartAxis::getNumberFormats() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + InitNumberFormatter(); + + return rNumberFormatter.get()->getNumberFormats(); +} + +// XInterface +uno::Any SAL_CALL ChXChartAxis::queryInterface( const uno::Type & rType ) + throw ( uno::RuntimeException ) +{ + uno::Any aAny = ChXChartObject::queryInterface( rType ); + + if( ! aAny.hasValue() ) + { + InitNumberFormatter(); + aAny = rNumberFormatter.get()->queryInterface( rType ); + } + + return aAny; +} + +void SAL_CALL ChXChartAxis::acquire() throw() +{ + ChXChartObject::acquire(); +} + +void SAL_CALL ChXChartAxis::release() throw() +{ + ChXChartObject::release(); +} + +// XTypeProvider +uno::Sequence< uno::Type > SAL_CALL ChXChartAxis::getTypes() throw( uno::RuntimeException ) +{ + if( maTypeSequence.getLength() == 0 ) + { + const uno::Sequence< uno::Type > aBaseTypes( ChXChartObject::getTypes() ); + const sal_Int32 nBaseTypes = aBaseTypes.getLength(); + const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); + + maTypeSequence.realloc( nBaseTypes + 1 ); // Note: Keep the size updated !! + uno::Type* pTypes = maTypeSequence.getArray(); + + *pTypes++ = ::getCppuType((const uno::Reference< util::XNumberFormatsSupplier >*)0); + + for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) + *pTypes++ = *pBaseTypes++; + } + + return maTypeSequence; +} + +uno::Sequence< sal_Int8 > SAL_CALL ChXChartAxis::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; +} + +// XShapeDescriptor +::rtl::OUString SAL_CALL ChXChartAxis::getShapeType() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartAxis" ); +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChXChartAxis::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return 0; +} + +// XPropertySet +uno::Any SAL_CALL ChXChartAxis::getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + if( mpModel ) + { + uno::Any aAny; + if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UNONAME_TEXT_ORDER ))) + { + SfxItemSet aSet( mpModel->GetItemPool(), SCHATTR_TEXT_ORDER, SCHATTR_TEXT_ORDER ); + mpModel->GetAttr( mnWhichId, aSet ); + + chart::ChartAxisArrangeOrderType eArrOrder; + SvxChartTextOrder eTextOrder = + ((const SvxChartTextOrderItem&)(aSet.Get( SCHATTR_TEXT_ORDER ))).GetValue(); + + switch( eTextOrder ) + { + case CHTXTORDER_SIDEBYSIDE: + eArrOrder = chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE; break; + case CHTXTORDER_DOWNUP: + eArrOrder = chart::ChartAxisArrangeOrderType_STAGGER_EVEN; break; + case CHTXTORDER_UPDOWN: + eArrOrder = chart::ChartAxisArrangeOrderType_STAGGER_ODD; break; + case CHTXTORDER_AUTO: + default: + eArrOrder = chart::ChartAxisArrangeOrderType_AUTO; break; + } + aAny <<= eArrOrder; + return aAny; + } + else if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UNONAME_NUMBERFORMAT ))) + { + // if we have a percent chart use the correct number format item + ChartType aType( mpModel ); + if( aType.IsPercent()) + { + SfxItemSet aSet( mpModel->GetItemPool(), SCHATTR_AXIS_NUMFMTPERCENT, SCHATTR_AXIS_NUMFMTPERCENT ); + mpModel->GetAttr( mnWhichId, aSet ); + + aAny <<= (sal_Int32)(((const SfxUInt32Item&)(aSet.Get( SCHATTR_AXIS_NUMFMTPERCENT ))).GetValue()); + return aAny; + } + } + } + + return ChXChartObject::getPropertyValue( PropertyName ); +} + +void SAL_CALL ChXChartAxis::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + if( mpModel && mnWhichId != CHOBJID_ANY ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( pMap && pMap->nWID ) + { + if( pMap->nFlags & beans::PropertyAttribute::READONLY ) + throw beans::PropertyVetoException(); + + USHORT nWID = pMap->nWID; + + // create item set that contains nWID and maybe more + USHORT nAutoWid = 0; + SfxItemSet* pSet = NULL; + switch( nWID ) + { + // min/max/stepmain/stephelp/origin need to disable the auto-settings + case SCHATTR_AXIS_MIN: + nAutoWid = SCHATTR_AXIS_AUTO_MIN; + break; + case SCHATTR_AXIS_MAX: + nAutoWid = SCHATTR_AXIS_AUTO_MAX; + break; + case SCHATTR_AXIS_STEP_MAIN: + nAutoWid = SCHATTR_AXIS_AUTO_STEP_MAIN; + break; + case SCHATTR_AXIS_STEP_HELP: + nAutoWid = SCHATTR_AXIS_AUTO_STEP_HELP; + break; + case SCHATTR_AXIS_ORIGIN: + nAutoWid = SCHATTR_AXIS_AUTO_ORIGIN; + break; + + case SCHATTR_AXIS_LOGARITHM: + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID, + SCHATTR_AXIS_AUTO_STEP_MAIN, SCHATTR_AXIS_AUTO_STEP_MAIN, + SCHATTR_AXIS_MIN, SCHATTR_AXIS_MIN, + SCHATTR_AXIS_MAX, SCHATTR_AXIS_MAX, 0 ); + break; + case SCHATTR_AXIS_AUTO_STEP_MAIN: + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID, + SCHATTR_AXIS_STEP_MAIN, SCHATTR_AXIS_STEP_MAIN, 0 ); + break; + case SCHATTR_AXIS_AUTO_STEP_HELP: + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID, + SCHATTR_AXIS_STEP_HELP, SCHATTR_AXIS_STEP_HELP, 0 ); + break; + + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + // there is a special handling done in the base class for this + ChXChartObject::setPropertyValue( aPropertyName, aValue ); + return; // RETURN ! + + case SCHATTR_AXIS_NUMFMT: + { + ChartType aType( mpModel ); + if( aType.IsPercent()) + { + nWID = SCHATTR_AXIS_NUMFMTPERCENT; + } + } + // intentionally not breaking ! (nWID just changed) + default: + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID ); + } + if( nAutoWid ) + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID, + nAutoWid, nAutoWid, 0 ); + DBG_ASSERT( pSet, "ItemSet was not created!" ); + + mpModel->GetAttr( mnWhichId, *pSet ); + + if( pSet->GetItemState( nWID ) != SFX_ITEM_SET ) + { + // get default from ItemPool + if( mpModel->GetItemPool().IsWhich( nWID )) + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID )); + } + else if( nWID != SID_ATTR_NUMBERFORMAT_SOURCE ) + { +#ifdef DBG_UTIL + String aTmpString( aPropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "ChartAxis: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + // special treatment for some properties + switch( nWID ) + { + case SCHATTR_TEXT_ORDER: + { + SvxChartTextOrder eTextOrder; + chart::ChartAxisArrangeOrderType eArrOrder; + if( ! ( aValue >>= eArrOrder )) + { + // basic might give us an int instead of the enum type + sal_Int32 nIntVal; + if( aValue >>= nIntVal ) + { + eArrOrder = SAL_STATIC_CAST( chart::ChartAxisArrangeOrderType, nIntVal ); + } + } + switch( eArrOrder ) + { + case chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE: + eTextOrder = CHTXTORDER_SIDEBYSIDE; break; + case chart::ChartAxisArrangeOrderType_STAGGER_EVEN: + eTextOrder = CHTXTORDER_DOWNUP; break; + case chart::ChartAxisArrangeOrderType_STAGGER_ODD: + eTextOrder = CHTXTORDER_UPDOWN; break; + case chart::ChartAxisArrangeOrderType_AUTO: + default: + eTextOrder = CHTXTORDER_AUTO; break; + } + pSet->Put( SvxChartTextOrderItem( eTextOrder )); + } + break; + case SCHATTR_TEXT_ORIENT: + { + sal_Bool bVal; + if( aValue >>= bVal ) + { + pSet->Put( SvxChartTextOrientItem( + bVal + ? CHTXTORIENT_STACKED + : CHTXTORIENT_AUTOMATIC )); + } + } + break; + case SCHATTR_AXIS_AUTO_STEP_MAIN: + case SCHATTR_AXIS_AUTO_STEP_HELP: + { + sal_Bool bVal; + aValue >>= bVal; + if( ! bVal ) + { + USHORT nStepWID = ( (nWID == SCHATTR_AXIS_AUTO_STEP_MAIN) ? + SCHATTR_AXIS_STEP_MAIN : + SCHATTR_AXIS_STEP_HELP ); + + BOOL bLog = FALSE; + ChartAxis* pAxis = mpModel->GetAxis( mnWhichId ); + if( pAxis ) + bLog = pAxis->IsLogarithm(); + const SfxPoolItem* pPoolItem = NULL; + if( pSet->GetItemState( nStepWID, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + double fOld = ((const SvxDoubleItem*)pPoolItem)->GetValue(); + if( fOld <= (bLog? 1.0: 0.0) ) + pSet->Put( SvxDoubleItem( bLog? 10.0 : 1.0, nStepWID ) ); + } + } + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + } + break; + case SCHATTR_AXIS_LOGARITHM: + { + sal_Bool bVal; + aValue >>= bVal; + if( bVal ) + { + // for logarithmic scale always use automatic steps + pSet->Put( SfxBoolItem( SCHATTR_AXIS_AUTO_STEP_MAIN, TRUE ) ); + + const SfxPoolItem* pPoolItem = NULL; + double fMin = 0.0; + if( pSet->GetItemState( SCHATTR_AXIS_MIN, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue(); + if( fMin <= 0.0 ) + pSet->Put( SvxDoubleItem( 1.0, SCHATTR_AXIS_MIN ) ); + } + if( pSet->GetItemState( SCHATTR_AXIS_MAX, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + if( ((const SvxDoubleItem*)pPoolItem)->GetValue() <= fMin ) + pSet->Put( SvxDoubleItem( fMin * 10.0, SCHATTR_AXIS_MAX )); + } + } + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + } + break; + + case SCHATTR_AXIS_STEP_MAIN: + case SCHATTR_AXIS_STEP_HELP: + { + BOOL bLog = FALSE; + ChartAxis* pAxis = mpModel->GetAxis( mnWhichId ); + if( pAxis ) + bLog = pAxis->IsLogarithm(); + double fVal; + aValue >>= fVal; + if( fVal <= bLog? 1.0: 0.0 ) + throw lang::IllegalArgumentException(); + + pSet->Put( SfxBoolItem( nAutoWid, FALSE )); + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + } + break; + + case SCHATTR_AXIS_MIN: + case SCHATTR_AXIS_MAX: + { + ChartAxis* pAxis = mpModel->GetAxis( mnWhichId ); + double fVal; + aValue >>= fVal; + if( pAxis && + pAxis->IsLogarithm() && fVal <= 0.0 ) + throw lang::IllegalArgumentException(); + + pSet->Put( SfxBoolItem( nAutoWid, FALSE )); + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + } + break; + + case SCHATTR_AXIS_ORIGIN: + pSet->Put( SfxBoolItem( nAutoWid, FALSE )); + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + + case SCHATTR_AXIS_NUMFMTPERCENT: + // was mapped from SCHATTR_AXIS_NUMFMT, so don't use standard mechanism + { + sal_Int32 nFmt; + aValue >>= nFmt; + pSet->Put( SfxUInt32Item( nWID, nFmt )); + } + break; + + case SID_ATTR_NUMBERFORMAT_SOURCE: + // this is not a which id (>4999) + { + sal_Bool bUseSource = sal_False; + aValue >>= bUseSource; + pSet->Put( SfxBoolItem( nWID, bUseSource )); + } + break; + + default: + // CL: convert special character properties + if( !SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, aValue, *pSet )) + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + } + + if( pSet->Count() ) + mpModel->ChangeAttr( *pSet, mnWhichId ); + else + throw beans::UnknownPropertyException(); + + delete pSet; + } + else + { + throw beans::UnknownPropertyException(); + } + } +} + + + +/* + In contrast to calling the method setPropertyValue (singular) for every given property name + the implementation of this method exploits the following properties: + 1: Both the given sequence of property names and the member property map are sorted according + to the property names. + 2: The item set which gathers all items changed by setting the properties is created only once. + 3: The solar mutex is acquired only once. +*/ +void SAL_CALL ChXChartAxis::setPropertyValues ( + const Sequence<OUString > & aPropertyNames, + const Sequence<Any > & aValues ) + throw ( beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + if (mpModel == NULL || mnWhichId == CHOBJID_ANY) + return; + + // Get pointers to first elements of lists. + const SfxItemPropertyMap * pProperty = maPropSet.getPropertyMap (); + const OUString * pPropertyName = aPropertyNames.getConstArray (); + const Any * pValue = aValues.getConstArray (); + + USHORT nWID, nAutoWID; + + // Create the item which collects all items modified by setting a property. + SfxItemSet aAttributes (mpModel->GetItemPool(), nAxisWhichPairs); + mpModel->GetAttr (mnWhichId, aAttributes); + + // Iterate over all the given property names. + sal_Int32 nCounter = aPropertyNames.getLength(); + while (nCounter-- > 0) + { + AdvanceToName (pProperty, pPropertyName); + + nWID = pProperty->nWID; + + if (pProperty == NULL || pProperty->nWID == 0) + { + OUString sMessage = OUString (RTL_CONSTASCII_USTRINGPARAM ( "ChXChartAxis::setPropertyValues: unknown property ")); + sMessage += *pPropertyName; + throw UnknownPropertyException (sMessage, (::cppu::OWeakObject*)this); + } + + // If the item that internally represents the property is not set, then get it's + // default value. + if (aAttributes.GetItemState(nWID) != SFX_ITEM_SET) + { + // Get default from the model's item pool. + if (mpModel->GetItemPool().IsWhich (nWID)) + aAttributes.Put (mpModel->GetItemPool().GetDefaultItem(nWID)); +#ifdef DBG_UTIL + else if (nWID != SID_ATTR_NUMBERFORMAT_SOURCE) + { + String aTmpString (*pPropertyName); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "ChartAxis: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); + } +#endif + } + + // Set the property's new value and handle some special cases. + switch (nWID) + { + case SCHATTR_TEXT_ORDER: + { + SvxChartTextOrder eTextOrder; + chart::ChartAxisArrangeOrderType eArrOrder; + if ( ! ( *pValue >>= eArrOrder )) + { + // basic might give us an int instead of the enum type + sal_Int32 nIntVal; + if( *pValue >>= nIntVal ) + eArrOrder = SAL_STATIC_CAST (chart::ChartAxisArrangeOrderType, nIntVal); + } + switch( eArrOrder ) + { + case chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE: + eTextOrder = CHTXTORDER_SIDEBYSIDE; + break; + case chart::ChartAxisArrangeOrderType_STAGGER_EVEN: + eTextOrder = CHTXTORDER_DOWNUP; + break; + case chart::ChartAxisArrangeOrderType_STAGGER_ODD: + eTextOrder = CHTXTORDER_UPDOWN; + break; + case chart::ChartAxisArrangeOrderType_AUTO: + default: + eTextOrder = CHTXTORDER_AUTO; + break; + } + aAttributes.Put (SvxChartTextOrderItem( eTextOrder)); + } + break; + + case SCHATTR_TEXT_ORIENT: + { + sal_Bool bVal; + if( *pValue >>= bVal ) + { + aAttributes.Put( SvxChartTextOrientItem( + bVal + ? CHTXTORIENT_STACKED + : CHTXTORIENT_AUTOMATIC )); + } + } + break; + + case SCHATTR_AXIS_AUTO_STEP_MAIN: + case SCHATTR_AXIS_AUTO_STEP_HELP: + { + sal_Bool bVal; + *pValue >>= bVal; + if( ! bVal ) + { + USHORT nStepWID = ( (nWID == SCHATTR_AXIS_AUTO_STEP_MAIN) ? + SCHATTR_AXIS_STEP_MAIN : + SCHATTR_AXIS_STEP_HELP ); + + BOOL bLog = FALSE; + ChartAxis* pAxis = mpModel->GetAxis( mnWhichId ); + if( pAxis ) + bLog = pAxis->IsLogarithm(); + const SfxPoolItem* pPoolItem = NULL; + if( aAttributes.GetItemState( nStepWID, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + double fOld = ((const SvxDoubleItem*)pPoolItem)->GetValue(); + if( fOld <= (bLog? 1.0: 0.0) ) + aAttributes.Put( SvxDoubleItem( bLog? 10.0 : 1.0, nStepWID ) ); + } + } + maPropSet.setPropertyValue( pProperty, *pValue, aAttributes ); + } + break; + + case SCHATTR_AXIS_LOGARITHM: + { + sal_Bool bVal; + *pValue >>= bVal; + if( bVal ) + { + // for logarithmic scale always use automatic steps + aAttributes.Put( SfxBoolItem( SCHATTR_AXIS_AUTO_STEP_MAIN, TRUE ) ); + + const SfxPoolItem* pPoolItem = NULL; + double fMin = 0.0; + if( aAttributes.GetItemState( SCHATTR_AXIS_MIN, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue(); + if( fMin <= 0.0 ) + aAttributes.Put( SvxDoubleItem( 1.0, SCHATTR_AXIS_MIN ) ); + } + if( aAttributes.GetItemState( SCHATTR_AXIS_MAX, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + if( ((const SvxDoubleItem*)pPoolItem)->GetValue() <= fMin ) + aAttributes.Put( SvxDoubleItem( fMin * 10.0, SCHATTR_AXIS_MAX )); + } + } + maPropSet.setPropertyValue( pProperty, *pValue, aAttributes ); + } + break; + + case SCHATTR_AXIS_STEP_MAIN: + case SCHATTR_AXIS_STEP_HELP: + { + BOOL bLog = FALSE; + ChartAxis* pAxis = mpModel->GetAxis( mnWhichId ); + if( pAxis ) + bLog = pAxis->IsLogarithm(); + double fVal; + *pValue >>= fVal; + if( fVal <= bLog? 1.0: 0.0 ) + throw lang::IllegalArgumentException(); + + if (nWID == SCHATTR_AXIS_STEP_MAIN) + nAutoWID = SCHATTR_AXIS_AUTO_STEP_MAIN; + else + nAutoWID = SCHATTR_AXIS_AUTO_STEP_HELP; + aAttributes.Put( SfxBoolItem( nAutoWID, FALSE )); + maPropSet.setPropertyValue( pProperty, *pValue, aAttributes ); + } + break; + + case SCHATTR_AXIS_MIN: + case SCHATTR_AXIS_MAX: + { + ChartAxis* pAxis = mpModel->GetAxis( mnWhichId ); + double fVal; + *pValue >>= fVal; + if ( pAxis + && pAxis->IsLogarithm() + && fVal <= 0.0) + throw lang::IllegalArgumentException(); + if (nWID == SCHATTR_AXIS_MIN) + nAutoWID = SCHATTR_AXIS_AUTO_MIN; + else + nAutoWID = SCHATTR_AXIS_AUTO_MAX; + + aAttributes.Put( SfxBoolItem( nAutoWID, FALSE )); + maPropSet.setPropertyValue (pProperty, *pValue, aAttributes); + } + break; + + case SCHATTR_AXIS_ORIGIN: + aAttributes.Put (SfxBoolItem (SCHATTR_AXIS_AUTO_ORIGIN, FALSE)); + maPropSet.setPropertyValue (pProperty, *pValue, aAttributes); + break; + + case SCHATTR_AXIS_NUMFMTPERCENT: + // was mapped from SCHATTR_AXIS_NUMFMT, so don't use standard mechanism + { + sal_Int32 nFmt; + *pValue >>= nFmt; + aAttributes.Put( SfxUInt32Item( nWID, nFmt )); + } + break; + + case SID_ATTR_NUMBERFORMAT_SOURCE: + // this is not a which id (>4999) + { + sal_Bool bUseSource = sal_False; + *pValue >>= bUseSource; + aAttributes.Put (SfxBoolItem( nWID, bUseSource)); + } + break; + + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + if (pProperty->nMemberId == MID_NAME ) + { + ::rtl::OUString aString; + if (*pValue >>= aString) + SvxShape::SetFillAttribute (nWID, aString, aAttributes, mpModel); + break; + } + // note: this fall-through is intended + + default: + // CL: convert special character properties + if( !SvxUnoTextRangeBase::SetPropertyValueHelper ( + aAttributes, pProperty, *pValue, aAttributes)) + maPropSet.setPropertyValue (pProperty, *pValue, aAttributes); + break; + } + + // Advance to the next property, property name and value. + pPropertyName++; + pValue++; + } + + // Finally set the modified item set to the axis. + mpModel->ChangeAttr (aAttributes, mnWhichId); +} + + + + +/* +Sequence<PropertyState > SAL_CALL ChXChartAxis::getPropertyStates( + const Sequence<OUString > & aPropertyNames) + throw( UnknownPropertyException, + RuntimeException ) +{ + SolarMutexGuard aGuard; + + const sal_Int32 nCount = aPropertyNames.getLength(); + const ::rtl::OUString * pName = aPropertyNames.getConstArray(); + Sequence<PropertyState > aStates (nCount); + PropertyState * pState = aStates.getArray(); + + if (mpModel == NULL) + return aStates; + + for (sal_Int32 nIdx = 0; nIdx < nCount; nIdx++) + pState[nIdx] = getPropertyState (pName[nIdx]); + + return aStates; +} +*/ + + +//===== protected methods ======================================================================= + +SfxItemSet * ChXChartAxis::CreateItemSet (void) +{ + SfxItemSet * pAttributes = new SfxItemSet (mpModel->GetItemPool(), nAxisWhichPairs); + mpModel->GetAttr (mnWhichId, *pAttributes, mnIndex); + return pAttributes; +} + + + +void ChXChartAxis::GetPropertyValue (const SfxItemPropertyMap & rProperty, + ::com::sun::star::uno::Any & rValue, + SfxItemSet & rAttributes) +{ + switch (rProperty.nWID) + { + case SCHATTR_TEXT_ORDER: + { + chart::ChartAxisArrangeOrderType eArrOrder; + + switch (((const SvxChartTextOrderItem&)(rAttributes.Get( SCHATTR_TEXT_ORDER ))).GetValue()) + { + case CHTXTORDER_SIDEBYSIDE: + eArrOrder = chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE; + break; + case CHTXTORDER_DOWNUP: + eArrOrder = chart::ChartAxisArrangeOrderType_STAGGER_EVEN; + break; + case CHTXTORDER_UPDOWN: + eArrOrder = chart::ChartAxisArrangeOrderType_STAGGER_ODD; + break; + case CHTXTORDER_AUTO: + default: + eArrOrder = chart::ChartAxisArrangeOrderType_AUTO; + break; + } + rValue <<= eArrOrder; + break; + } + case SCHATTR_AXIS_NUMFMT: + { + // if we have a percent chart use the correct number format item + ChartType aType( mpModel ); + if( aType.IsPercent()) + { + rValue <<= (sal_Int32)(((const SfxUInt32Item&)(rAttributes.Get( SCHATTR_AXIS_NUMFMTPERCENT ))).GetValue()); + } + else + { + rValue <<= (sal_Int32)(((const SfxUInt32Item&)(rAttributes.Get( SCHATTR_AXIS_NUMFMT ))).GetValue()); + } + } + break; + + + default: + ChXChartObject::GetPropertyValue (rProperty, rValue, rAttributes); + } +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartData.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartData.cxx new file mode 100644 index 000000000000..0f03b7f3478a --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartData.cxx @@ -0,0 +1,479 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "ChXChartData.hxx" + +// header for SvxServiceInfoHelper +#include <bf_svx/unoprov.hxx> +// header for class OGuard +// header for rtl_createUuid +#include <rtl/uuid.h> +// header for class Application +#include <vcl/svapp.hxx> + +#include "chtmodel.hxx" +#include "memchrt.hxx" +namespace binfilter { + +#ifndef SCH_ASCII_TO_OU +#define SCH_ASCII_TO_OU( s ) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( s ) ) +#endif + +using namespace ::com::sun::star; + +#define SCH_BIN_MIN(a,b) ( ((a)<(b))? (a) : (b) ) + +// ---------------------------------------- +// class ChXChartData +// ---------------------------------------- + +ChXChartData::ChXChartData( uno::Reference< lang::XComponent > xModel, + ChartModel* pModel ) : + maListeners( GetMutex() ), + mpModel( pModel ) +{ + if( xModel.is()) + { + uno::Reference< lang::XEventListener > xListener = this; + xModel->addEventListener( xListener ); + } + + DBG_WARNING( "Parameter pModel is NULL." ); +} + +ChXChartData::~ChXChartData() +{} + +void ChXChartData::DataModified( chart::ChartDataChangeEvent& aEvent ) +{ + if( !maListeners.getLength() ) return; + + uno::Reference< uno::XInterface > xSrc( SAL_STATIC_CAST( cppu::OWeakObject*, this ), uno::UNO_QUERY ); + if( xSrc.is() ) + aEvent.Source = xSrc; + + cppu::OInterfaceIteratorHelper aIter( maListeners ); + + while( aIter.hasMoreElements() ) + { + uno::Reference< chart::XChartDataChangeEventListener > xListener( aIter.next(), uno::UNO_QUERY ); + xListener->chartDataChanged( aEvent ); + } +} + +// generate a uniqueId +const uno::Sequence< sal_Int8 > & ChXChartData::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +ChXChartData* ChXChartData::getImplementation( uno::Reference< uno::XInterface > xData ) throw() +{ + uno::Reference< lang::XUnoTunnel > xUT( xData, uno::UNO_QUERY ); + if( xUT.is() ) + return reinterpret_cast< ChXChartData * >( xUT->getSomething( ChXChartData::getUnoTunnelId() )); + else + return NULL; +} + +// XChartData +void SAL_CALL ChXChartData::addChartDataChangeEventListener( + const uno::Reference< chart::XChartDataChangeEventListener >& aListener ) + throw( uno::RuntimeException ) +{ + uno::Reference< uno::XInterface > xIntf( aListener, uno::UNO_QUERY ); + if( xIntf.is() ) + maListeners.addInterface( xIntf ); +} + +void SAL_CALL ChXChartData::removeChartDataChangeEventListener( + const uno::Reference< chart::XChartDataChangeEventListener >& aListener ) + throw( uno::RuntimeException ) +{ + uno::Reference< uno::XInterface > xIntf( aListener, uno::UNO_QUERY ); + if( xIntf.is() ) + maListeners.removeInterface( xIntf ); +} + +double SAL_CALL ChXChartData::getNotANumber() throw( ::com::sun::star::uno::RuntimeException ) +{ + return DBL_MIN; +} + +sal_Bool SAL_CALL ChXChartData::isNotANumber( double nNumber ) throw( ::com::sun::star::uno::RuntimeException ) +{ + return (nNumber == getNotANumber()); +} + + +// XServiceInfo +::rtl::OUString SAL_CALL ChXChartData::getImplementationName() + throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXChartData" ); +} + +sal_Bool SAL_CALL ChXChartData::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartData::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSeq; + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.ChartData"); + return aSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChXChartData::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return reinterpret_cast< sal_Int64 >( this ); + } + return 0; +} + +// XEventListener listens to disposing of XModel +void SAL_CALL ChXChartData::disposing( const lang::EventObject& Source ) throw( uno::RuntimeException ) +{ + // XModel is disposed -> mpModel is invalid now + mpModel = NULL; +} + +// ---------------------------------------- +// class ChXChartDataArray +// ---------------------------------------- +uno::Sequence< uno::Type > ChXChartDataArray::maTypeSequence; + +ChXChartDataArray::ChXChartDataArray( uno::Reference< lang::XComponent > xModel, + ChartModel* pModel ) : + ChXChartData( xModel, pModel ) +{} + +ChXChartDataArray::~ChXChartDataArray() +{} + +// XInterface +uno::Any SAL_CALL ChXChartDataArray::queryInterface( const uno::Type& aType ) + throw( uno::RuntimeException ) +{ + if( aType == ::getCppuType((const uno::Reference< chart::XChartDataArray >*)0) ) + return uno::makeAny( uno::Reference< chart::XChartDataArray >(this)); + else + return ChXChartData::queryInterface( aType ); +} + +void SAL_CALL ChXChartDataArray::acquire() throw() +{ + ChXChartData::acquire(); +} + +void SAL_CALL ChXChartDataArray::release() throw() +{ + ChXChartData::release(); +} + + +// XTypeProvider +uno::Sequence< uno::Type > SAL_CALL ChXChartDataArray::getTypes() throw( uno::RuntimeException ) +{ + if( maTypeSequence.getLength() == 0 ) + { + uno::Sequence< uno::Type > aBaseTypes( ChXChartData::getTypes() ); + uno::Type* pBaseTypes = aBaseTypes.getArray(); + + maTypeSequence.realloc( aBaseTypes.getLength() + 1 ); // keep updated!! + uno::Type* pTypes = maTypeSequence.getArray(); + + // additional interfaces (1) + *pTypes++ = ::getCppuType((const uno::Reference< chart::XChartDataArray >*)0); + + for( sal_Int32 nType = aBaseTypes.getLength(); nType; nType-- ) + *pTypes++ = *pBaseTypes++; + } + return maTypeSequence; +} + +uno::Sequence< sal_Int8 > SAL_CALL ChXChartDataArray::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; +} + + +// XChartDataArray +uno::Sequence< uno::Sequence< double > > SAL_CALL ChXChartDataArray::getData() throw( uno::RuntimeException ) +{ + DBG_ASSERT( mpModel, "No Model" ); + if( ! mpModel ) + return uno::Sequence< uno::Sequence< double > >(); + + SolarMutexGuard aGuard; + + double *pData; + + // get MemChart: + SchMemChart* pDocData = mpModel->GetChartData(); + + // number of rows and columns + sal_Int32 nCol, nColCnt = pDocData->GetColCount(); + sal_Int32 nRow, nRowCnt = pDocData->GetRowCount(); + + // create array + uno::Sequence< uno::Sequence< double > > aSequence( nRowCnt ); + uno::Sequence< double >* pSeqArray = aSequence.getArray(); + for( nRow = 0; nRow < nRowCnt; nRow++ ) + { + pSeqArray[ nRow ].realloc( nColCnt ); + } + + // copy data from MemChart to the array: + for( nRow = 0; nRow < nRowCnt; nRow++ ) + { + pData = pSeqArray[ nRow ].getArray(); // get row + for( nCol = 0; nCol < nColCnt; nCol++ ) + { + pData[ nCol ] = pDocData->GetData( (short)nCol, (short)nRow ); // copy data to column + } + } + return aSequence; +} + +void SAL_CALL ChXChartDataArray::setData( const uno::Sequence< uno::Sequence< double > >& aData ) + throw( uno::RuntimeException ) +{ + DBG_ASSERT( mpModel, "No Model" ); + if( ! mpModel ) + return; + + SolarMutexGuard aGuard; + + // get number of rows/columns + const uno::Sequence< double >* pSequence = aData.getConstArray(); + sal_Int32 nRow, nRowCnt = aData.getLength(); + sal_Int32 nCol, nColCnt = 0; + + const double* pData = NULL; + if( nRowCnt ) + { + pData = pSequence[ 0 ].getConstArray(); + nColCnt = pSequence->getLength(); + } + + // compare size to the size of the existing MemChart + SchMemChart* pDocData = mpModel->GetChartData(); + + if( nColCnt != (sal_Int32)pDocData->GetColCount() || + nRowCnt != (sal_Int32)pDocData->GetRowCount() ) + { // change size, i.e. create new MemChart + pDocData = new SchMemChart( (short)nColCnt, (short)nRowCnt ); + // save as much as possible (title, ...) + pDocData->SetNonNumericData( *(mpModel->GetChartData()) ); + } + + // copy data + for( nRow = 0; nRow < nRowCnt; nRow++ ) + { + pData = pSequence[ nRow ].getConstArray(); + for( nCol = 0; nCol < nColCnt; nCol++ ) + { + pDocData->SetData( (short)nCol, (short)nRow,pData[ nCol ] ); + } + } + + // data is only changed if new MemChart was created (otherwise everything is already in the chart) + // (Wird nur gewechselt, wenn neues erzeugt wurde (sonst ist schon alles im Chart)) + mpModel->ChangeChartData( *pDocData, FALSE ); + + // call listeners + chart::ChartDataChangeEvent aEvent; + aEvent.Type = chart::ChartDataChangeType_ALL; + aEvent.StartColumn = 0; + aEvent.EndColumn = 0; + aEvent.StartRow = 0; + aEvent.EndRow = 0; + + DataModified( aEvent ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartDataArray::getRowDescriptions() throw( uno::RuntimeException ) +{ + DBG_ASSERT( mpModel, "No Model" ); + if( ! mpModel ) + return uno::Sequence< ::rtl::OUString >(); + + SolarMutexGuard aGuard; + + SchMemChart* pDocData = mpModel->GetChartData(); + sal_Int32 nRow, nRowCnt = pDocData->GetRowCount(); + + uno::Sequence< ::rtl::OUString > aResult( nRowCnt ); + + ::rtl::OUString* pResultArray = aResult.getArray(); + for( nRow = 0; nRow < nRowCnt; nRow++ ) + { + pResultArray[ nRow ] = pDocData->GetRowText( (short)nRow ); + } + + return aResult; +} + +void SAL_CALL ChXChartDataArray::setRowDescriptions( const uno::Sequence< ::rtl::OUString >& aRowDescriptions ) + throw( uno::RuntimeException ) +{ + DBG_ASSERT( mpModel, "No Model" ); + if( ! mpModel ) + return; + + SolarMutexGuard aGuard; + + SchMemChart* pDocData = mpModel->GetChartData(); + sal_Int32 nRow, nRowCnt = SCH_BIN_MIN( (sal_Int32)pDocData->GetRowCount(), aRowDescriptions.getLength() ); + ::rtl::OUString* pString = ( (uno::Sequence< ::rtl::OUString >&)aRowDescriptions ).getArray(); + + for( nRow = 0; nRow < nRowCnt; nRow++ ) + { + pDocData->SetRowText( (short)nRow, pString[ nRow ] ); + } + mpModel->BuildChart( FALSE ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartDataArray::getColumnDescriptions() throw( uno::RuntimeException ) +{ + DBG_ASSERT( mpModel, "No Model" ); + if( ! mpModel ) + return uno::Sequence< ::rtl::OUString >(); + + SolarMutexGuard aGuard; + + SchMemChart* pDocData = mpModel->GetChartData(); + sal_Int32 nCol, nColCnt = pDocData->GetColCount(); + uno::Sequence< ::rtl::OUString > aResult( nColCnt ); + + ::rtl::OUString *pResultArray = aResult.getArray(); + for( nCol = 0; nCol < nColCnt; nCol++ ) + { + pResultArray[ nCol ] = pDocData->GetColText( (short)nCol); + } + return aResult; +} + + void SAL_CALL ChXChartDataArray::setColumnDescriptions( const uno::Sequence< ::rtl::OUString >& aColumnDescriptions ) + throw( uno::RuntimeException ) +{ + DBG_ASSERT( mpModel, "No Model" ); + if( ! mpModel ) + return; + + SolarMutexGuard aGuard; + + SchMemChart* pDocData = mpModel->GetChartData(); + sal_Int32 nCol, nColCnt = SCH_BIN_MIN( (sal_Int32)pDocData->GetColCount(), aColumnDescriptions.getLength() ); + + ::rtl::OUString* pString = ( (uno::Sequence< ::rtl::OUString >&)aColumnDescriptions ).getArray(); + + for( nCol = 0; nCol < nColCnt; nCol++ ) + { + pDocData->SetColText( (short)nCol, pString[ nCol ] ); + } + mpModel->BuildChart( FALSE ); +} + + +// XChartData + void SAL_CALL ChXChartDataArray::addChartDataChangeEventListener( + const uno::Reference< chart::XChartDataChangeEventListener >& aListener ) + throw( uno::RuntimeException ) +{ + ChXChartData::addChartDataChangeEventListener( aListener ); +} + +void SAL_CALL ChXChartDataArray::removeChartDataChangeEventListener( + const uno::Reference< chart::XChartDataChangeEventListener >& aListener ) + throw( uno::RuntimeException ) +{ + ChXChartData::removeChartDataChangeEventListener( aListener ); +} + +double SAL_CALL ChXChartDataArray::getNotANumber() throw( uno::RuntimeException ) +{ + return ChXChartData::getNotANumber(); +} + +sal_Bool SAL_CALL ChXChartDataArray::isNotANumber( double nNumber ) throw( uno::RuntimeException ) +{ + return ChXChartData::isNotANumber( nNumber ); +} + + +// XServiceInfo +::rtl::OUString SAL_CALL ChXChartDataArray::getImplementationName() + throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXChartDataArray" ); +} + +sal_Bool SAL_CALL ChXChartDataArray::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return ChXChartData::supportsService( ServiceName ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartDataArray::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSeq( ChXChartData::getSupportedServiceNames() ); + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.ChartDataArray" ); + return aSeq; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDataChangeEventListener.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDataChangeEventListener.cxx new file mode 100644 index 000000000000..598aa4481da4 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDataChangeEventListener.cxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// header for class Application +#include <vcl/svapp.hxx> +// header for class OGuard +#include <osl/mutex.hxx> + +#include "ChXChartDataChangeEventListener.hxx" +#include "ChXChartDocument.hxx" +namespace binfilter { + +#ifndef SCH_ASCII_TO_OU +#define SCH_ASCII_TO_OU( s ) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( s ) ) +#endif + +// using namespace osl; +using namespace rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; + +ChXChartDataChangeEventListener::ChXChartDataChangeEventListener() +{ + mpXDoc = NULL; +} + +void ChXChartDataChangeEventListener::SetOwner( ChXChartDocument* pXDoc ) throw() +{ + SolarMutexGuard aGuard; + + mpXDoc = pXDoc; +} + +void ChXChartDataChangeEventListener::Reset() throw() +{ + SolarMutexGuard aGuard; + mpXDoc = NULL; +} + +// XChartDataChangeEventListener +void SAL_CALL ChXChartDataChangeEventListener::chartDataChanged( const chart::ChartDataChangeEvent& aEvent ) + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + if( mpXDoc ) + mpXDoc->RefreshData( aEvent ); +} + +// XEventListener +void SAL_CALL ChXChartDataChangeEventListener::disposing( const lang::EventObject& Source ) throw( uno::RuntimeException ) +{ + Reset(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL ChXChartDataChangeEventListener::getImplementationName() throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXChartDataChangeEventListener" ); +} + +sal_Bool SAL_CALL ChXChartDataChangeEventListener::supportsService( const OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + uno::Sequence< OUString > aSNL = getSupportedServiceNames(); + const OUString * pArray = aSNL.getConstArray(); + for( INT32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return TRUE; + return FALSE; +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartDataChangeEventListener::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Sequence< OUString > aServSeq( 0 ); + return aServSeq; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDocument.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDocument.cxx new file mode 100644 index 000000000000..d2b0c0175a77 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDocument.cxx @@ -0,0 +1,1681 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "ChXChartDocument.hxx" +#include "ChXDiagram.hxx" +#include "ChXChartData.hxx" +#include "ChXChartDataChangeEventListener.hxx" +#include "ChXChartDrawPage.hxx" + +#include "ChartLegend.hxx" +#include "ChartTitle.hxx" +#include "ChartArea.hxx" + + +#include <bf_svx/UnoNamespaceMap.hxx> +#include <bf_svx/xmlgrhlp.hxx> + +#include "mapprov.hxx" +// header for SvxChartLegendPosItem +#ifndef _SVX_CHRTITEM_HXX +#include "schattr.hxx" +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS + +#include <bf_svtools/eitem.hxx> + +#endif +#include "docshell.hxx" +#include "objid.hxx" + +#include "schgroup.hxx" + +// for access to table addresses +#include "memchrt.hxx" + +// header for SvNumberFormatsSupplierObj +#include <bf_svtools/numuno.hxx> + +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> +#include <bf_svx/unofill.hxx> +#include <bf_svx/unoshcol.hxx> + +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include "unonames.hxx" +#include <rtl/uuid.h> + +namespace binfilter { + +extern SchUnoPropertyMapProvider aSchMapProvider; + +using namespace ::com::sun::star; +using ::rtl::OUString; + +sal_Int32 ChXChartDocument::mnInstanceCounter = 0; +SchAddInCollection * ChXChartDocument::mpAddInCollection = NULL; + +SchAddInCollection& ChXChartDocument::GetAddInCollection() +{ + if( mpAddInCollection == NULL ) + mpAddInCollection = new SchAddInCollection(); + + return *mpAddInCollection; +} + +ChXChartDocument::ChXChartDocument( SchChartDocShell* pShell ) : + SfxBaseModel( pShell ), + m_pModel( NULL ), + m_aPropSet( aSchMapProvider.GetMap( CHMAP_DOC, NULL )) +{ + if( pShell ) + { + SolarMutexGuard aSolarGuard; + + m_pDocShell = pShell; + if( m_pDocShell->GetModelPtr()) + SetChartModel( m_pDocShell->GetModelPtr()); + } + else + DBG_WARNING( "Parameter pShell is NULL." ); + + ++mnInstanceCounter; +} + +ChXChartDocument::~ChXChartDocument() +{ + if( m_rXDiagram.is() ) + { + osl::Guard< osl::Mutex > aGuard( GetMutex()); + ChXDiagram* pDiagram = ChXDiagram::getImplementation( m_rXDiagram ); + if( pDiagram ) + pDiagram->SetDocShell( NULL ); + uno::Reference<lang::XComponent> xComponent (m_rXDiagram,uno::UNO_QUERY); + if (xComponent.is()) + { + try + { + xComponent->removeEventListener (this); + xComponent->dispose(); + } + catch( uno::RuntimeException & aEx ) + { + DBG_ERROR1( "Exception caught in DTOR: %s", + ::rtl::OUStringToOString( aEx.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); + } + } + } + if( --mnInstanceCounter == 0 ) + { + delete mpAddInCollection; + mpAddInCollection = NULL; + } +} + +// public methods +void ChXChartDocument::setDiagramType( const ::rtl::OUString& aType, + sal_Bool bKeepAddin /* = sal_False */ ) throw() +{ + SolarMutexGuard aGuard; + + if( ! m_pModel ) + return; + + // never show sorting dialog + m_pModel->SetChartStatusFlag( CHS_USER_NOQUERY ); + + // disable AddIn if requested + if( bKeepAddin ) + m_pModel->SetChartStatusFlag( CHS_KEEP_ADDIN ); + else + m_pModel->ResetChartStatusFlag( CHS_KEEP_ADDIN ); + + // all chart types start with the prefix com.sun.star.chart + if( 0 == aType.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE ))) + { + // get postfix using copy( beginIndex ) + ::rtl::OUString aPostfix = aType.copy( RTL_CONSTASCII_LENGTH( SCH_X_STR_CHTYPE_NAMESPACE )); + + if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_LINE )) == 0 ) + m_pModel->SetBaseType( CHTYPE_LINE ); + else if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_AREA )) == 0 ) + m_pModel->SetBaseType( CHTYPE_AREA ); + else if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_PIE )) == 0 ) + m_pModel->SetBaseType( CHTYPE_CIRCLE); + else if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_BAR )) == 0 ) + m_pModel->SetBaseType( CHTYPE_BAR); + else if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_XY )) == 0 ) + m_pModel->SetBaseType( CHTYPE_XY ); + else if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_NET )) == 0 ) + m_pModel->SetBaseType( CHTYPE_NET ); + else if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_DONUT )) == 0 ) + m_pModel->SetBaseType( CHTYPE_DONUT ); + else if( aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_STOCK )) == 0 ) + m_pModel->SetBaseType( CHTYPE_STOCK ); + } +} + +sal_Bool ChXChartDocument::setBaseDiagramType( sal_Bool bSet ) throw() +{ + if( bSet ) + { + if( maBaseDiagramType.getLength()) + { + // 2nd param: keep reference to AddIn in model + setDiagramType( maBaseDiagramType, sal_True ); + return sal_True; + } + } + else // unset + { + if( m_pModel ) + m_pModel->SetBaseType( CHTYPE_ADDIN ); + return sal_True; + } + + return sal_False; +} + +void ChXChartDocument::SetChartModel( ChartModel* pModel ) throw() +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + + m_pModel = pModel; + m_aPropSet = SvxItemPropertySet( aSchMapProvider.GetMap( CHMAP_DOC, m_pModel )); +} + +void ChXChartDocument::RefreshData( const chart::ChartDataChangeEvent& aEvent ) throw() +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + + // copy new data ( in member m_xChartData ) + if( m_xChartData.is() ) + { + // get XChartDataArray representation of m_xChartData + uno::Reference< chart::XChartDataArray > xDataArray( m_xChartData, uno::UNO_QUERY ); + + if( xDataArray.is() ) + { + // new data object using own doc shell + uno::Reference< lang::XComponent > xComp( SAL_STATIC_CAST( SfxBaseModel*, this )); + ChXChartDataArray* pNewDataArray = new ChXChartDataArray( xComp, m_pModel ); + chart::XChartDataArray* pSrcArray = xDataArray.get(); + + // the get-methods re-retrieve the (changed) data from the SchMemChart + pNewDataArray->setData( pSrcArray->getData() ); + pNewDataArray->setRowDescriptions( pSrcArray->getRowDescriptions() ); + pNewDataArray->setColumnDescriptions( pSrcArray->getColumnDescriptions() ); + + // remember the new data as member + m_xChartData = SAL_STATIC_CAST( ChXChartData*, pNewDataArray ); + } + } +} + +// generate a uniqueId +const uno::Sequence< sal_Int8 > & ChXChartDocument::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +ChXChartDocument* ChXChartDocument::getImplementation( uno::Reference< uno::XInterface > xData ) throw() +{ + uno::Reference< lang::XUnoTunnel > xUT( xData, uno::UNO_QUERY ); + if( xUT.is() ) + return (ChXChartDocument*)xUT->getSomething( ChXChartDocument::getUnoTunnelId() ); + else + return NULL; +} + + +// XInterface +uno::Any SAL_CALL ChXChartDocument::queryInterface( const uno::Type & rType ) + throw( uno::RuntimeException ) +{ + uno::Any aAny = SfxBaseModel::queryInterface( rType ); + if( aAny.hasValue() ) + return aAny; + + return ::cppu::queryInterface( + rType, + ( lang::XMultiServiceFactory* )this, + ( beans::XPropertySet* )this, + ( chart::XChartDocument* )this, + ( lang::XServiceInfo* )this, + ( util::XNumberFormatsSupplier* )this, + ( drawing::XDrawPageSupplier* )this, + ( lang::XUnoTunnel* )this ); +} + +void SAL_CALL ChXChartDocument::acquire() throw() +{ + SfxBaseModel::acquire(); +} + +void SAL_CALL ChXChartDocument::release() throw() +{ + SfxBaseModel::release(); +} + +// XMultiServiceFactory +uno::Reference< uno::XInterface > SAL_CALL ChXChartDocument::createInstance( const ::rtl::OUString& aServiceSpecifier ) + throw( uno::Exception, uno::RuntimeException ) +{ + bool bServiceFound = false; + uno::Reference< uno::XInterface > xResult; + + // 1. create a new built-in diagram type + if( 0 == aServiceSpecifier.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE ))) + { + ::rtl::OUString aPostfix = aServiceSpecifier.copy( RTL_CONSTASCII_LENGTH( SCH_X_STR_CHTYPE_NAMESPACE )); + + if( 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_LINE )) || + 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_AREA )) || + 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_BAR )) || + 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_PIE )) || + 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_XY )) || + 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_NET )) || + 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_DONUT )) || + 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_STOCK ))) + { + ChXDiagram* pDiagram = new ChXDiagram( m_pDocShell, FALSE ); + pDiagram->SetServiceName( aServiceSpecifier ); + + xResult.set( static_cast< cppu::OWeakObject * >( pDiagram ) ); + bServiceFound = true; + } + } + // 2. create drawing services for XML + else if( 0 == aServiceSpecifier.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing." ))) + { + ::rtl::OUString aPostfix = aServiceSpecifier.copy( RTL_CONSTASCII_LENGTH( "com.sun.star.drawing." )); + + bServiceFound = true; + + // get a table for XML ex-/import + if( 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "DashTable" ))) + { + if( ! xDashTable.is()) + xDashTable = SvxUnoDashTable_createInstance( m_pModel ); + xResult = xDashTable; + } + else if( 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "GradientTable" ))) + { + if( ! xGradientTable.is()) + xGradientTable = SvxUnoGradientTable_createInstance( m_pModel ); + xResult = xGradientTable; + } + else if( 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "HatchTable" ))) + { + if( ! xHatchTable.is()) + xHatchTable = SvxUnoHatchTable_createInstance( m_pModel ); + xResult = xHatchTable; + } + else if( 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "BitmapTable" ))) + { + if( ! xBitmapTable.is()) + xBitmapTable = SvxUnoBitmapTable_createInstance( m_pModel ); + xResult = xBitmapTable; + } + else if( 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "TransparencyGradientTable" ))) + { + if( ! xTransparencyGradientTable.is()) + xTransparencyGradientTable = SvxUnoTransGradientTable_createInstance( m_pModel ); + xResult = xTransparencyGradientTable; + } + else if( 0 == aPostfix.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "MarkerTable" ))) + { + if( ! xMarkerTable.is()) + xMarkerTable = SvxUnoMarkerTable_createInstance( m_pModel ); + xResult = xMarkerTable; + } + else + bServiceFound = false; + } + + // 3. XML namespace-map for alien attributes + if( ! bServiceFound && + 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.xml.NamespaceMap") ) ) + { + static sal_uInt16 aWhichIds[] = { SCHATTR_USER_DEFINED_ATTR, 0 }; + xResult = svx::NamespaceMap_createInstance( aWhichIds, &m_pModel->GetPool() ); + bServiceFound = true; + } + + // 4. graphics resolver + if( ! bServiceFound && + 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.document.ExportGraphicObjectResolver") ) ) + { + xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE )); + bServiceFound = true; + } + if( ! bServiceFound && + 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.document.ImportGraphicObjectResolver") ) ) + { + xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ )); + bServiceFound = true; + } + + // 5. embedded object resolver + if( ! bServiceFound && + ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.document.ExportEmbeddedObjectResolver" )) + || 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.document.ImportEmbeddedObjectResolver" )))) + { + // Charts do not support EmbeddedObjectResolvers, so they return an empty + // reference, but as the request is well known, no assertion is printed + bServiceFound = true; + } + + // 6. create a shape + if( ! bServiceFound ) + { + // try to get a shape + try + { + xResult = SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ); + bServiceFound = true; + } + catch( const uno::Exception& aEx ) + { + // couldn't create shape + } + } + + // 7. try to create an AddIn + if( ! bServiceFound ) + { + uno::Reference< util::XRefreshable > xAddIn = GetAddInCollection().GetAddInByName( aServiceSpecifier ); + if( xAddIn.is()) + { + xResult = xAddIn; + bServiceFound = true; + } + } + + OSL_ENSURE( bServiceFound, + ::rtl::OUStringToOString( + ::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "createInstance() failed in creating the service " )) + + aServiceSpecifier, + RTL_TEXTENCODING_ASCII_US ).getStr() ); + + return xResult; +} + +uno::Reference< uno::XInterface > SAL_CALL ChXChartDocument::createInstanceWithArguments( + const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) + throw( uno::Exception, uno::RuntimeException ) +{ + if( 0 == ServiceSpecifier.compareToAscii( RTL_CONSTASCII_STRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE ))) + { + if( Arguments.getLength() ) + throw lang::IllegalArgumentException(); + else + return createInstance( ServiceSpecifier ); + } + + return SvxUnoDrawMSFactory::createInstanceWithArguments( ServiceSpecifier, Arguments ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartDocument::getAvailableServiceNames() + throw( uno::RuntimeException ) +{ + ::std::vector< OUString > aServices; + + // chart types + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_LINE )); + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_AREA )); + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_BAR )); + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_PIE )); + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_XY )); + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_NET )); + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_DONUT )); + aServices.push_back( OUString::createFromAscii( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_STOCK )); + + // style tables (for XML) + aServices.push_back( OUString::createFromAscii( "com.sun.star.drawing.DashTable" )); + aServices.push_back( OUString::createFromAscii( "com.sun.star.drawing.GradientTable" )); + aServices.push_back( OUString::createFromAscii( "com.sun.star.drawing.HatchTable" )); + aServices.push_back( OUString::createFromAscii( "com.sun.star.drawing.BitmapTable" )); + aServices.push_back( OUString::createFromAscii( "com.sun.star.drawing.TransparencyGradientTable" )); + aServices.push_back( OUString::createFromAscii( "com.sun.star.drawing.MarkerTable" )); + + // XML namespacemap / object resolver + aServices.push_back( OUString::createFromAscii( "com.sun.star.xml.NamespaceMap" )); + aServices.push_back( OUString::createFromAscii( "com.sun.star.document.ExportGraphicObjectResolver" )); + aServices.push_back( OUString::createFromAscii( "com.sun.star.document.ImportGraphicObjectResolver" )); + + // shapes + uno::Sequence< OUString > aDrawServices( SvxUnoDrawMSFactory::getAvailableServiceNames() ); + const OUString * pArr = aDrawServices.getConstArray(); + aServices.insert( aServices.end(), pArr, pArr + aDrawServices.getLength() ); + + // add-ins + uno::Sequence< OUString > aAddIns( GetAddInCollection().GetAddInNames() ); + pArr = aAddIns.getConstArray(); + aServices.insert( aServices.end(), pArr, pArr + aAddIns.getLength() ); + + return uno::Sequence< OUString >( &(* aServices.begin()), aServices.size() ); +} + + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL ChXChartDocument::getPropertySetInfo() + throw( uno::RuntimeException ) +{ + return m_aPropSet.getPropertySetInfo(); +} + +void SAL_CALL ChXChartDocument::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + if( m_pModel ) + { + const SfxItemPropertyMap* pMap = m_aPropSet.getPropertyMapEntry( aPropertyName ); + if( pMap && pMap->nWID ) + { + if( pMap->nFlags & beans::PropertyAttribute::READONLY ) + throw beans::PropertyVetoException(); + + USHORT nWID = pMap->nWID; + + switch( nWID ) + { + case CHATTR_DIAGRAM_START: // dummy id for "HasLegend" + { + sal_Bool bVal; + aValue >>= bVal; + m_pModel->SetShowLegend( bVal ); + m_pModel->SetLegendHasBeenMoved( FALSE ); + m_pModel->BuildChart( FALSE ); + } + break; + + case CHATTR_ADDR_CATEGORIES: + case CHATTR_ADDR_SERIES: + case CHATTR_ADDR_CHART: + case CHATTR_TABLE_NUMBER_LIST: + case CHATTR_EXPORT_TABLE: + case CHATTR_FIRST_COL_LABELS: + case CHATTR_FIRST_ROW_LABELS: + { + SchMemChart* pData = m_pModel->GetChartData(); + if( pData ) + { + switch( nWID ) + { + case CHATTR_ADDR_CATEGORIES: + { + ::rtl::OUString aCatAddr; + aValue >>= aCatAddr; + pData->SetCategoriesRangeAddress( aCatAddr ); + } + break; + case CHATTR_ADDR_SERIES: + { + uno::Sequence< chart::ChartSeriesAddress > aSeriesAddresses; + aValue >>= aSeriesAddresses; + pData->SetSeriesAddresses( aSeriesAddresses ); + } + break; + case CHATTR_ADDR_CHART: + { + ::rtl::OUString aAddr; + aValue >>= aAddr; + pData->getChartRangeForXMLString( aAddr ); + } + break; + case CHATTR_TABLE_NUMBER_LIST: + { + ::rtl::OUString aList; + aValue >>= aList; + pData->parseTableNumberList( aList ); + } + break; + case CHATTR_EXPORT_TABLE: + { + sal_Bool bValueToSet; + aValue >>= bValueToSet; + + SchChartRange aRange = pData->GetChartRange(); + if( aRange.mbKeepCopyOfData != bValueToSet ) + { + aRange.mbKeepCopyOfData = bValueToSet; + pData->SetChartRange( aRange ); + } + } + break; + case CHATTR_FIRST_COL_LABELS: + { + sal_Bool bValueToSet; + aValue >>= bValueToSet; + + SchChartRange aRange = pData->GetChartRange(); + if( aRange.mbFirstColumnContainsLabels != bValueToSet ) + { + aRange.mbFirstColumnContainsLabels = bValueToSet; + pData->SetChartRange( aRange ); + } + } + break; + case CHATTR_FIRST_ROW_LABELS: + { + sal_Bool bValueToSet; + aValue >>= bValueToSet; + + SchChartRange aRange = pData->GetChartRange(); + if( aRange.mbFirstRowContainsLabels != bValueToSet ) + { + aRange.mbFirstRowContainsLabels = bValueToSet; + pData->SetChartRange( aRange ); + } + } + break; + } + } + else + DBG_ERROR( "invalid SchMemChart" ); + } + break; + + case CHATTR_TRANSLATED_COLS: + case CHATTR_TRANSLATED_ROWS: + { + SchMemChart* pData = m_pModel->GetChartData(); + if( pData ) + { + uno::Sequence< sal_Int32 > aSeq; + aValue >>= aSeq; + + if( ! SetTransSequence( pData, CHATTR_TRANSLATED_COLS == nWID, aSeq )) + { + ::rtl::OUString aMsg( + RTL_CONSTASCII_STRINGPARAM( "Conflict on setting row-/col translation" ), + RTL_TEXTENCODING_ASCII_US ); + uno::RuntimeException aExcept( aMsg, static_cast< ::cppu::OWeakObject* >( this )); + throw aExcept; + } + } + else + DBG_ERROR( "invalid SchMemChart" ); + } + break; + + default: + { + SfxItemSet aSet( m_pModel->GetPool(), nWID, nWID ); + m_pModel->GetAttr( aSet ); + + if( ! aSet.Count() ) + { + // get default from ItemPool + if( m_pModel->GetItemPool().IsWhich( nWID ) ) + { + aSet.Put( m_pModel->GetItemPool().GetDefaultItem( pMap->nWID ) ); + } + else + { +#ifdef DBG_UTIL + String aTmpString( aPropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + if( aSet.Count()) + { + m_aPropSet.setPropertyValue( pMap, aValue, aSet ); + m_pModel->PutAttr( aSet ); + m_pModel->BuildChart( FALSE ); + } + else + { + throw beans::UnknownPropertyException(); + } + } + break; + } + } + else if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BaseDiagram" ) )) + { + aValue >>= maBaseDiagramType; + setBaseDiagramType( sal_True ); + } + else if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ExportForClipboard" ))) + { + sal_Bool bBool; + aValue >>= bBool; + m_pDocShell->SetClipboardExport( bBool ); + } + else + { + throw beans::UnknownPropertyException(); + } + } + else + DBG_WARNING( "No Model" ); +} + +uno::Any SAL_CALL ChXChartDocument::getPropertyValue( const ::rtl::OUString& aPropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + if( m_pModel ) + { + const SfxItemPropertyMap* pMap = m_aPropSet.getPropertyMapEntry( aPropertyName ); + if( pMap && pMap->nWID ) + { + USHORT nWID = pMap->nWID; + + switch( nWID ) + { + case CHATTR_ADDITIONAL_SHAPES: + aAny <<= GetAdditionalShapes(); + return aAny; // RETURN + + case CHATTR_DIAGRAM_START: // dummy id for "HasLegend" + { + SfxItemSet rSet( m_pModel->GetFullLegendAttr() ); + const SfxPoolItem *pPoolItem = NULL; + SvxChartLegendPos ePos = CHLEGEND_RIGHT; + if( rSet.GetItemState( SCHATTR_LEGEND_POS, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + { + ePos = ((const SvxChartLegendPosItem*)pPoolItem)->GetValue(); + } + aAny <<= sal_Bool( ePos != CHLEGEND_NONE ); + } + break; + + case CHATTR_ADDR_CATEGORIES: + case CHATTR_ADDR_SERIES: + case CHATTR_ADDR_CHART: + case CHATTR_TABLE_NUMBER_LIST: + case CHATTR_EXPORT_TABLE: + case CHATTR_FIRST_COL_LABELS: + case CHATTR_FIRST_ROW_LABELS: + { + SchMemChart* pData = m_pModel->GetChartData(); + if( pData ) + { + switch( nWID ) + { + case CHATTR_ADDR_CATEGORIES: + aAny <<= pData->GetCategoriesRangeAddress(); + break; + case CHATTR_ADDR_SERIES: + aAny <<= pData->GetSeriesAddresses(); + break; + case CHATTR_ADDR_CHART: + aAny <<= pData->getXMLStringForChartRange(); + break; + case CHATTR_TABLE_NUMBER_LIST: + aAny <<= pData->createTableNumberList(); + break; + case CHATTR_EXPORT_TABLE: + { + // data table is always exported for standalone charts + // if container (Calc/Writer) has set the property not + // to export the data then do so + DBG_ASSERT( pData, "Invalid MemChart" ); + const SchChartRange& rRange = pData->GetChartRange(); + sal_Bool bResult = rRange.mbKeepCopyOfData; + + // if export was set to false it might nontheless be + // necessary to export data for inserting the chart into + // a different container from clipboard + if( !bResult && m_pDocShell ) + aAny <<= m_pDocShell->GetClipboardExport(); + + aAny <<= bResult; + } + break; + case CHATTR_FIRST_COL_LABELS: + { + const SchChartRange& rRange = pData->GetChartRange(); + aAny <<= (sal_Bool)(rRange.mbFirstColumnContainsLabels); + } + break; + case CHATTR_FIRST_ROW_LABELS: + { + const SchChartRange& rRange = pData->GetChartRange(); + aAny <<= (sal_Bool)(rRange.mbFirstRowContainsLabels); + } + break; + } + } + else + DBG_ERROR( "invalid SchMemChart" ); + } + break; + + case CHATTR_HAS_TRANSLATED_COLS: + case CHATTR_HAS_TRANSLATED_ROWS: + case CHATTR_TRANSLATED_COLS: + case CHATTR_TRANSLATED_ROWS: + { + SchMemChart* pData = m_pModel->GetChartData(); + if( pData ) + { + long nTranslation = pData->GetTranslation(); + switch( nWID ) + { + case CHATTR_HAS_TRANSLATED_COLS: + aAny <<= (sal_Bool)( nTranslation == TRANS_COL ); + break; + case CHATTR_HAS_TRANSLATED_ROWS: + aAny <<= (sal_Bool)( nTranslation == TRANS_ROW ); + break; + case CHATTR_TRANSLATED_COLS: + case CHATTR_TRANSLATED_ROWS: + aAny <<= GetTransSequence( pData, (CHATTR_TRANSLATED_COLS == nWID)); + break; + } + } + else + DBG_ERROR( "invalid SchMemChart" ); + } + break; + + default: + { + SfxItemSet aSet( m_pModel->GetPool(), nWID, nWID ); + m_pModel->GetAttr( aSet ); + + if( ! aSet.Count() ) + { + // get default from ItemPool + if( m_pModel->GetItemPool().IsWhich( nWID ) ) + { + aSet.Put( m_pModel->GetItemPool().GetDefaultItem( pMap->nWID ) ); + } + else + { +#ifdef DBG_UTIL + String aTmpString( aPropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + if( aSet.Count() ) + aAny = m_aPropSet.getPropertyValue( pMap, aSet ); + else + throw beans::UnknownPropertyException(); + + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "getPropertyValue(): wrong Type!" ); + } + } + } + } + } + else if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BaseDiagram" ) )) + { + aAny <<= maBaseDiagramType; + } + else if( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "AddIn" ) )) + { + if( m_pModel ) + { + uno::Reference< util::XRefreshable > xAddIn = m_pModel->GetChartAddIn(); + aAny <<= xAddIn; + } + } + else + throw beans::UnknownPropertyException(); + } + else + DBG_WARNING( "No Model" ); + + return aAny; +} + +void SAL_CALL ChXChartDocument::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& xListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartDocument::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartDocument::addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartDocument::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +// XChartDocument + +uno::Reference< drawing::XShape > SAL_CALL ChXChartDocument::getTitle() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + if( ! mxMainTitle.is()) + { + mxMainTitle = new ChartTitle( m_pModel, CHOBJID_TITLE_MAIN ); + uno::Reference<lang::XComponent> xComponent (mxMainTitle, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (this); + } + + return mxMainTitle; +} + +uno::Reference< drawing::XShape > SAL_CALL ChXChartDocument::getSubTitle() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + if( ! mxSubTitle.is()) + { + mxSubTitle = new ChartTitle( m_pModel, CHOBJID_TITLE_SUB ); + uno::Reference<lang::XComponent> xComponent (mxSubTitle, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (this); + } + + return mxSubTitle; +} + +uno::Reference< drawing::XShape > SAL_CALL ChXChartDocument::getLegend() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + if( ! mxLegend.is()) + { + mxLegend = new ChartLegend( m_pModel ); + uno::Reference<lang::XComponent> xComponent (mxLegend, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (this); + } + + return mxLegend; +} + +uno::Reference< beans::XPropertySet > SAL_CALL ChXChartDocument::getArea() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + if( ! mxArea.is()) + { + mxArea = new ChartArea( m_pModel, CHOBJID_DIAGRAM_AREA ); + uno::Reference<lang::XComponent> xComponent (mxArea, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (this); + } + + return mxArea; +} + +uno::Reference< chart::XDiagram > SAL_CALL ChXChartDocument::getDiagram() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + if( ! m_rXDiagram.is() ) + { + m_rXDiagram = new ChXDiagram( m_pDocShell ); + uno::Reference<lang::XComponent> xComponent (m_rXDiagram, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (this); + } + + return m_rXDiagram; +} + +void SAL_CALL ChXChartDocument::setDiagram( const uno::Reference< chart::XDiagram >& _NewDiagram ) + throw( uno::RuntimeException ) +{ + if( _NewDiagram == m_rXDiagram ) + return; + + osl::Guard< osl::Mutex > aGuard( GetMutex()); + + uno::Reference< util::XRefreshable > xAddIn( _NewDiagram, uno::UNO_QUERY ); + if( xAddIn.is()) + { + // use AddIn + if( m_pModel ) + { + SolarMutexGuard aGuard; + m_pModel->SetChartAddIn( xAddIn ); + + // initialize AddIn with this as chart document + uno::Reference< lang::XInitialization > xInit( xAddIn, uno::UNO_QUERY ); + if( xInit.is()) + { + uno::Any aParam; + uno::Reference< chart::XChartDocument > xDoc( (chart::XChartDocument*)this, uno::UNO_QUERY ); + aParam <<= xDoc; + uno::Sequence< uno::Any > aSeq( &aParam, 1 ); + xInit->initialize( aSeq ); + } + + // remember service name in member ChXDiagram instance + uno::Reference< lang::XServiceName > xServiceName( xAddIn, uno::UNO_QUERY ); + if( xServiceName.is()) + { + uno::Reference<lang::XComponent> xComponent (m_rXDiagram,uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener (this); + xComponent->dispose(); + } + + ChXDiagram* pDiagram = new ChXDiagram( m_pDocShell, TRUE ); + pDiagram->SetServiceName( xServiceName->getServiceName() ); + m_rXDiagram = pDiagram; + xComponent = uno::Reference<lang::XComponent>(m_rXDiagram, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (this); + } + } + else + { + DBG_ERROR( "No Model - Couldn't attach AddIn" ); + } + } + else + { + // the new diagram is only set here + // when you have an addin the old diagram is kept as + // 'parent diagram' + + // clear addin + if( m_pModel ) + { + SolarMutexGuard aGuard; + uno::Reference< util::XRefreshable > xRefreshable; + m_pModel->SetChartAddIn( xRefreshable ); + } + + // invalidate and release old diagram + if( m_rXDiagram.is()) + { + uno::Reference<lang::XComponent> xComponent (m_rXDiagram,uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener (this); + xComponent->dispose(); + } + + ChXDiagram* pDiagram = ChXDiagram::getImplementation( m_rXDiagram ); + if( pDiagram ) + pDiagram->SetDocShell( SchChartDocShellRef() ); + } + + // set new diagram + if( _NewDiagram.is() ) + { + ChXDiagram* pDiagram = ChXDiagram::getImplementation( _NewDiagram ); + if( pDiagram ) + { + if( m_pDocShell ) + { + if( pDiagram->SetDocShell( m_pDocShell, sal_True )) // keep model (is copied) + { + // update local model + if( m_pModel ) + { + SolarMutexGuard aGuard; + m_pModel = m_pDocShell->GetModelPtr(); + } + } + else + { + // model was invalid + // so set correct chart type to current model + setDiagramType( pDiagram->getServiceName()); + } + } + } + uno::Reference<lang::XComponent> xComponent (m_rXDiagram, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->removeEventListener (this); + m_rXDiagram = _NewDiagram; + xComponent = uno::Reference<lang::XComponent>(m_rXDiagram, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (this); + } + } +} + +uno::Reference< chart::XChartData > SAL_CALL ChXChartDocument::getData() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + if( ! m_xChartData.is()) + { + uno::Reference< lang::XComponent > xComp( SAL_STATIC_CAST( SfxBaseModel*, this )); + // XChartData is inherited twice + m_xChartData = SAL_STATIC_CAST( chart::XChartDataArray*, + new ChXChartDataArray( xComp, m_pModel )); + } + + return m_xChartData; +} + +void SAL_CALL ChXChartDocument::attachData( const uno::Reference< chart::XChartData >& _Data ) + throw( uno::RuntimeException ) +{ + osl::ClearableGuard< osl::Mutex > aGuard( GetMutex()); + + if( ! _Data.is() ) + return; + + if( ! m_xEventListener.is() ) + { + ChXChartDataChangeEventListener *pEvtListener = new ChXChartDataChangeEventListener; + if( pEvtListener ) + { + pEvtListener->Reset(); // Reset not implemented yet + pEvtListener->SetOwner( this ); // become owner of event listener + m_xEventListener = pEvtListener; // remember Listener as member + } + } + + // add listener to XChartDataArray + uno::Reference< chart::XChartDataArray > xChDataArray( _Data, uno::UNO_QUERY ); + + if( xChDataArray.is() ) + xChDataArray->addChartDataChangeEventListener( m_xEventListener ); + + // copy new Data + m_xChartData = _Data; + aGuard.clear(); + + chart::ChartDataChangeEvent aEvent; + + aEvent.Type = chart::ChartDataChangeType_ALL; + aEvent.StartColumn = 0; + aEvent.EndColumn = 0; + aEvent.StartRow = 0; + aEvent.EndRow = 0; + + RefreshData( aEvent ); // set initial data +} + + +// XModel ( ::SfxBaseModel ) +sal_Bool SAL_CALL ChXChartDocument::attachResource( const ::rtl::OUString& aURL, + const uno::Sequence< beans::PropertyValue >& aArgs ) + throw( uno::RuntimeException ) +{ + return SfxBaseModel::attachResource( aURL, aArgs ); +} + +::rtl::OUString SAL_CALL ChXChartDocument::getURL() throw( uno::RuntimeException ) +{ + return SfxBaseModel::getURL(); +} + +uno::Sequence< beans::PropertyValue > SAL_CALL ChXChartDocument::getArgs() throw( uno::RuntimeException ) +{ + return SfxBaseModel::getArgs(); +} + +void SAL_CALL ChXChartDocument::connectController( const uno::Reference< frame::XController >& xController ) + throw( uno::RuntimeException ) +{ + SfxBaseModel::connectController( xController ); +} + +void SAL_CALL ChXChartDocument::disconnectController( const uno::Reference< frame::XController >& xController ) + throw( uno::RuntimeException ) +{ + SfxBaseModel::disconnectController( xController ); +} + +uno::Reference< frame::XController > SAL_CALL ChXChartDocument::getCurrentController() throw( uno::RuntimeException ) +{ + return SfxBaseModel::getCurrentController(); +} + +void SAL_CALL ChXChartDocument::setCurrentController( const uno::Reference< frame::XController >& xController ) + throw( container::NoSuchElementException, uno::RuntimeException ) +{ + SfxBaseModel::setCurrentController( xController ); +} + +uno::Reference< uno::XInterface > SAL_CALL ChXChartDocument::getCurrentSelection() throw( uno::RuntimeException ) +{ + return SfxBaseModel::getCurrentSelection(); +} + +void SAL_CALL ChXChartDocument::lockControllers() throw( uno::RuntimeException ) +{ + if( m_pModel ) + { + SolarMutexGuard aGuard; + m_pModel->LockBuild(); + } + else + throw uno::RuntimeException(); +} + +void SAL_CALL ChXChartDocument::unlockControllers() throw( uno::RuntimeException ) +{ + if( m_pModel ) + { + SolarMutexGuard aGuard; + m_pModel->UnlockBuild(); + } + else + throw uno::RuntimeException(); +} + +sal_Bool SAL_CALL ChXChartDocument::hasControllersLocked() throw( uno::RuntimeException ) +{ + if( m_pModel ) + { + SolarMutexGuard aGuard; + return m_pModel->IsLockedBuild(); + } + else + return sal_False; +} + +// XTypeProvider ( ::SfxBaseModel ) +uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ChXChartDocument::getTypes() + throw( uno::RuntimeException ) +{ + if( maTypeSequence.getLength() == 0 ) + { + osl::Guard< osl::Mutex > aGuard( GetMutex()); + + const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() ); + const sal_Int32 nBaseTypes = aBaseTypes.getLength(); + const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); + + maTypeSequence.realloc( nBaseTypes + 7 ); // Note: Keep the size updated !! + uno::Type* pTypes = maTypeSequence.getArray(); + + *pTypes++ = ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0); + *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0); + *pTypes++ = ::getCppuType((const uno::Reference< chart::XChartDocument >*)0); + *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0); + *pTypes++ = ::getCppuType((const uno::Reference< util::XNumberFormatsSupplier >*)0); + *pTypes++ = ::getCppuType((const uno::Reference< drawing::XDrawPageSupplier >*)0); + *pTypes++ = ::getCppuType((const uno::Reference< lang::XUnoTunnel >*)0); + + for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) + *pTypes++ = *pBaseTypes++; + } + + return maTypeSequence; +} + +uno::Sequence< sal_Int8 > SAL_CALL ChXChartDocument::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; +} + + + + +// XComponent ( ::XModel ::SfxModel ) +void SAL_CALL ChXChartDocument::dispose() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + + uno::Reference<lang::XComponent> xComponent; + if (mxMainTitle.is()) + { + xComponent = uno::Reference<lang::XComponent>(mxMainTitle,uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener (this); + xComponent->dispose (); + mxMainTitle = NULL; + } + } + if (mxSubTitle.is()) + { + xComponent = uno::Reference<lang::XComponent>(mxSubTitle,uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener (this); + xComponent->dispose (); + mxSubTitle = NULL; + } + } + if (mxLegend.is()) + { + xComponent = uno::Reference<lang::XComponent>(mxLegend,uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener (this); + xComponent->dispose (); + mxLegend = NULL; + } + } + if (mxArea.is()) + { + xComponent = uno::Reference<lang::XComponent>(mxArea,uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener (this); + xComponent->dispose (); + mxArea = NULL; + } + } + + if( m_rXDiagram.is()) + { + ChXDiagram* pDiagram = ChXDiagram::getImplementation( m_rXDiagram ); + if( pDiagram ) + pDiagram->SetDocShell( NULL ); + xComponent = uno::Reference<lang::XComponent>(m_rXDiagram,uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->removeEventListener (this); + xComponent->dispose(); + m_rXDiagram = NULL; + } + } + m_pModel = NULL; + + SfxBaseModel::dispose(); +} + + + + +void SAL_CALL ChXChartDocument::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw( uno::RuntimeException ) +{ + SfxBaseModel::addEventListener( xListener ); +} + +void SAL_CALL ChXChartDocument::removeEventListener( const uno::Reference< lang::XEventListener >& aListener ) + throw( uno::RuntimeException ) +{ + SfxBaseModel::removeEventListener( aListener ); +} + +// XNumberFormatsSupplier +void ChXChartDocument::InitNumberFormatter() throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + if( ! mrNumberFormatter.is()) + { + if( m_pModel ) + { + SolarMutexGuard aGuard; + mrNumberFormatter = new SvNumberFormatsSupplierObj( m_pModel->GetNumFormatter() ); + } + else + mrNumberFormatter = new SvNumberFormatsSupplierObj(); + } + + if( ! mrNumberFormatter.is()) + throw uno::RuntimeException(); +} + +uno::Reference< beans::XPropertySet > SAL_CALL ChXChartDocument::getNumberFormatSettings() throw( uno::RuntimeException ) +{ + if( ! mrNumberFormatter.is()) + InitNumberFormatter(); + + return mrNumberFormatter.get()->getNumberFormatSettings(); +} + +uno::Reference< util::XNumberFormats > SAL_CALL ChXChartDocument::getNumberFormats() throw( uno::RuntimeException ) +{ + if( ! mrNumberFormatter.is()) + InitNumberFormatter(); + + return mrNumberFormatter.get()->getNumberFormats(); +} + +// XServiceInfo +::rtl::OUString SAL_CALL ChXChartDocument::getImplementationName() + throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXChartDocument" ); +} + +sal_Bool SAL_CALL ChXChartDocument::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXChartDocument::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSeq( 4 ); + ::rtl::OUString* pStr = aSeq.getArray(); + pStr[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OfficeDocument" )); + pStr[ 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartDocument" )); + pStr[ 2 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartTableAddressSupplier" )); + pStr[ 3 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.UserDefinedAttributeSupplier" )); + + return aSeq; +} + +// XDrawPageSupplier +uno::Reference< drawing::XDrawPage > SAL_CALL ChXChartDocument::getDrawPage() + throw( uno::RuntimeException ) +{ + osl::Guard< osl::Mutex > aGuard( GetMutex()); + + if( ! mrDrawPage.is() && m_pModel ) + { + mrDrawPage = new ChXChartDrawPage( m_pModel ); + uno::WeakReference< uno::XInterface > xPage( mrDrawPage ); + // set page wrapper (member can be used as this class is declared as friend) + m_pModel->GetPage( 0 )->mxUnoPage = xPage; + } + + return mrDrawPage; +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChXChartDocument::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + + // in XML the implementation of the XNumberFormatsSupplier (SvNumberFormatsSupplierObj) is queried + // so return this member here + + if( ! mrNumberFormatter.is()) + InitNumberFormatter(); + + uno::Reference< lang::XUnoTunnel > xUnoTunnel( mrNumberFormatter, uno::UNO_QUERY ); + if( xUnoTunnel.is()) + return xUnoTunnel->getSomething( aIdentifier ); + + return 0; +} + + + +// XEeventListener +//virtual +void SAL_CALL ChXChartDocument::disposing (const lang::EventObject & Source) + throw (uno::RuntimeException) +{ + sal_Bool bChangeProperty = sal_False; + ::rtl::OUString aProperty; + + if (Source.Source == m_rXDiagram) + m_rXDiagram = NULL; + else if (Source.Source == mxMainTitle) + { + mxMainTitle = NULL; + aProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UNONAME_TITLE_SHOW_MAIN )); + bChangeProperty = sal_True; + } + else if (Source.Source == mxSubTitle) + { + mxSubTitle = NULL; + aProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UNONAME_TITLE_SHOW_SUB )); + bChangeProperty = sal_True; + } + else if (Source.Source == mxLegend) + { + mxLegend = NULL; + aProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UNONAME_HASLEGEND )); + bChangeProperty = sal_True; + } + else if (Source.Source == mxArea) + { + mxArea = NULL; + } + + if ( ! bChangeProperty) + return; + + // Inform the document shell of the disposing of Source.Source. + SolarMutexGuard aGuard; + + SchChartDocShell* pDocSh = (SchChartDocShell*)GetObjectShell(); + if (pDocSh == NULL) + return; + uno::Reference< beans::XPropertySet > xDocProp( pDocSh->GetBaseModel(), uno::UNO_QUERY ); + if( xDocProp.is()) + { + uno::Any aFalseBool; + aFalseBool <<= (sal_Bool)(sal_False); + try + { + xDocProp->setPropertyValue( aProperty, aFalseBool ); + } + catch( beans::UnknownPropertyException ) + { + DBG_WARNING( "cannot set property to false" ); + } + } + + SfxBaseModel::disposing( Source ); +} + +// get additional non-chart shapes for XML export +uno::Reference< drawing::XShapes > ChXChartDocument::GetAdditionalShapes() +{ + uno::Reference< drawing::XShapes > xFoundShapes; + + if( m_pModel == NULL ) + return xFoundShapes; + + // iterate 'flat' over all top-level objects + // and determine all that are no chart objects + // i.e. which have no SchObjectId set as user data + ::std::vector< uno::Reference< drawing::XShape > > aShapeVector; + SdrObjListIter aIter( *(m_pModel->GetPage( 0 )), IM_FLAT ); + SdrObject* pObj; + while( aIter.IsMore()) + { + pObj = aIter.Next(); + + if( GetObjectId( *pObj ) != NULL ) + continue; + + // we have no chart user data, i.e. a non-chart object + + // check if chart is inventor. This has to be changed for XML exportability + if( pObj->GetObjInventor() == SchInventor && + pObj->ISA( SchObjGroup )) + { + static_cast< SchObjGroup* >( pObj )->SetUseChartInventor( false ); + } + + uno::Reference< drawing::XShape > xShape( pObj->getUnoShape(), uno::UNO_QUERY ); + if( xShape.is() ) + aShapeVector.push_back( xShape ); + } + if( ! aShapeVector.empty()) + { + // create a shape collection + xFoundShapes = uno::Reference< drawing::XShapes >( SvxShapeCollection_NewInstance(), uno::UNO_QUERY ); + + DBG_ASSERT( xFoundShapes.is(), "Couldn't create a shape collection!" ); + if( xFoundShapes.is()) + { + ::std::vector< uno::Reference< drawing::XShape > >::iterator aIter; + for( aIter = aShapeVector.begin(); aIter != aShapeVector.end(); ++aIter ) + xFoundShapes->add( *aIter ); + } +// } + } + + return xFoundShapes; +} + +uno::Sequence< sal_Int32 > ChXChartDocument::GetTransSequence( SchMemChart* pData, bool bColumns ) +{ + uno::Sequence< sal_Int32 > aResult; + + if( pData ) + { + long nTranslation = pData->GetTranslation(); + + if( bColumns ) + { + short nColCount = pData->GetColCount(); + aResult.realloc( nColCount ); + sal_Int32* pSeq = aResult.getArray(); + const sal_Int32* pTransArray = pData->GetColTranslation(); + sal_Int32 i; + + if( nTranslation == TRANS_COL && + pTransArray != NULL ) + { + for( i = 0; i < nColCount; ++i ) + pSeq[ i ] = pTransArray[ i ]; + } + else + { + // identity sequence + for( i = 0; i < nColCount; ++i ) + pSeq[ i ] = i; + } + } + else // rows + { + short nRowCount = pData->GetRowCount(); + aResult.realloc( nRowCount ); + sal_Int32* pSeq = aResult.getArray(); + const sal_Int32* pTransArray = pData->GetRowTranslation(); + sal_Int32 i; + + if( nTranslation == TRANS_ROW && + pTransArray != NULL ) + { + for( i = 0; i < nRowCount; ++i ) + pSeq[ i ] = pTransArray[ i ]; + } + else + { + // identity sequence + for( i = 0; i < nRowCount; ++i ) + pSeq[ i ] = i; + } + } + } + else + { + DBG_ERROR( "Invalid MemChart" ); + } + + return aResult; +} + +bool ChXChartDocument::SetTransSequence( SchMemChart* pData, bool bColumns, const uno::Sequence< sal_Int32 >& rSeq ) +{ + bool bResult = false; + + if( pData ) + { + long nTranslation = pData->GetTranslation(); + + if( bColumns ) + { + if( nTranslation != TRANS_ROW && + pData->GetColCount() == rSeq.getLength() ) + { + pData->SetTranslation( TRANS_COL ); + pData->SetColTranslation( rSeq.getConstArray()); + bResult = true; + } + } + else // rows + { + if( nTranslation != TRANS_COL && + pData->GetRowCount() == rSeq.getLength() ) + { + pData->SetTranslation( TRANS_ROW ); + pData->SetRowTranslation( rSeq.getConstArray()); + bResult = true; + } + } + + } + else + { + DBG_ERROR( "Invalid MemChart" ); + } + + return bResult; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDrawPage.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDrawPage.cxx new file mode 100644 index 000000000000..4c54aa078fde --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartDrawPage.cxx @@ -0,0 +1,252 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "ChXChartDrawPage.hxx" +#include "chtmodel.hxx" + +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <rtl/uuid.h> +namespace binfilter { + + +using namespace ::com::sun::star; + +#define CHART_DRAW_PAGE_WIDTH_ID 1 +#define CHART_DRAW_PAGE_HEIGHT_ID 2 + +const SfxItemPropertyMap* ImplGetChartDrawPageMap() +{ + // Propertymap fuer einen Outliner Text + static const SfxItemPropertyMap aChartDrawPage[] = + { + { MAP_CHAR_LEN( "Width" ), CHART_DRAW_PAGE_WIDTH_ID, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( "Height" ), CHART_DRAW_PAGE_HEIGHT_ID, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { 0,0,0,0,0 } + }; + + return aChartDrawPage; +} + +ChXChartDrawPage::ChXChartDrawPage( ChartModel* pModel ) : + SvxDrawPage( pModel? pModel->GetPage( 0 ): NULL ), + mpModel( pModel ), + maPropSet( ImplGetChartDrawPageMap() ) +{ + DBG_ASSERT( pModel != NULL, "ChXChartDrawPage: Invalid model (=> invalid page)" ); +} + +ChXChartDrawPage::~ChXChartDrawPage() throw() +{} + + +// XInterface +uno::Any SAL_CALL ChXChartDrawPage::queryInterface( const uno::Type & rType ) + throw( uno::RuntimeException ) +{ + uno::Any aAny = SvxDrawPage::queryInterface( rType ); + if( aAny.hasValue() ) + return aAny; + + return ::cppu::queryInterface( + rType, + ( beans::XPropertySet* )this ); +} + +void SAL_CALL ChXChartDrawPage::acquire() throw() +{ + SvxDrawPage::acquire(); +} + +void SAL_CALL ChXChartDrawPage::release() throw() +{ + SvxDrawPage::release(); +} + +// XTypeProvider +uno::Sequence< uno::Type > SAL_CALL ChXChartDrawPage::getTypes() throw( uno::RuntimeException ) +{ + if( maTypeSequence.getLength() == 0 ) + { + const uno::Sequence< uno::Type > aBaseTypes( SvxDrawPage::getTypes() ); + const sal_Int32 nBaseTypes = aBaseTypes.getLength(); + const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); + + maTypeSequence.realloc( nBaseTypes + 1 ); // Note: Keep the size updated !! + uno::Type* pTypes = maTypeSequence.getArray(); + + *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet >*)0); + + for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) + *pTypes++ = *pBaseTypes++; + } + + return maTypeSequence; +} + +uno::Sequence< sal_Int8 > SAL_CALL ChXChartDrawPage::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; +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL ChXChartDrawPage::getPropertySetInfo() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + return maPropSet.getPropertySetInfo(); +} + +void SAL_CALL ChXChartDrawPage::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + if( mpModel && + pMap && pMap->nWID ) + { + if( pMap->nFlags & beans::PropertyAttribute::READONLY ) + throw beans::PropertyVetoException(); + + switch( pMap->nWID ) + { + case CHART_DRAW_PAGE_WIDTH_ID: + { + const SdrPage* pPage = mpModel->GetPage( 0 ); + if( pPage ) + { + sal_Int32 nWidth; + aValue >>= nWidth; + Size aSize = pPage->GetSize(); + aSize.setWidth( nWidth ); + + mpModel->ResizePage( aSize ); + } + } + break; + case CHART_DRAW_PAGE_HEIGHT_ID: + { + const SdrPage* pPage = mpModel->GetPage( 0 ); + if( pPage ) + { + sal_Int32 nHeight; + aValue >>= nHeight; + Size aSize = pPage->GetSize(); + aSize.setHeight( nHeight ); + + mpModel->ResizePage( aSize ); + } + } + break; + } + } +} + +uno::Any SAL_CALL ChXChartDrawPage::getPropertyValue( const ::rtl::OUString& aPropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Any aResult; + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( mpModel && + pMap && pMap->nWID ) + { + switch( pMap->nWID ) + { + case CHART_DRAW_PAGE_WIDTH_ID: + { + const SdrPage* pPage = mpModel->GetPage( 0 ); + if( pPage ) + { + Size aSize = pPage->GetSize(); + aResult <<= aSize.getWidth(); + } + } + break; + case CHART_DRAW_PAGE_HEIGHT_ID: + { + const SdrPage* pPage = mpModel->GetPage( 0 ); + if( pPage ) + { + Size aSize = pPage->GetSize(); + aResult <<= aSize.getHeight(); + } + } + break; + } + } + return aResult; +} + +void SAL_CALL ChXChartDrawPage::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& xListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartDrawPage::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartDrawPage::addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartDrawPage::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartObject.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartObject.cxx new file mode 100644 index 000000000000..a8e6a97cd87c --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXChartObject.cxx @@ -0,0 +1,1419 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "ChXChartObject.hxx" +#include "schattr.hxx" + +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> + +// header for SvxUnoTextRangeBase +// for OWN_ATTR_... +#include <bf_svx/unoshprp.hxx> +// for SID_ATTR_... +#include <bf_svx/svxids.hrc> +#include <bf_svx/unoshape.hxx> + +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_DOUBLE 0 +#define ITEMID_CHARTTEXTORDER SCHATTR_TEXT_ORDER +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT +#define ITEMID_CHARTLEGENDPOS SCHATTR_LEGEND_POS +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + +#include <bf_svtools/eitem.hxx> + +#endif +#include <bf_svx/xflbstit.hxx> +#include <bf_svx/xflbmtit.hxx> + +#include "app.hrc" // for SID_TEXTBREAK + +#include "mapprov.hxx" +#include "globfunc.hxx" // for GlobalGenerate3DAttrDefaultItem + +#include <com/sun/star/chart/ChartLegendPosition.hpp> + +// header for any2enum +#include <comphelper/extract.hxx> + +#include <memory> +#include "unonames.hxx" +namespace binfilter { + + +extern SchUnoPropertyMapProvider aSchMapProvider; + +using namespace ::com::sun::star; +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; + +ChXChartObject::ChXChartObject( long _MapId, ChartModel* _Model, long _WhichId, long _Index ) : + maPropSet( aSchMapProvider.GetMap( (short)_MapId, _Model )), + mpModel( _Model ), + mnWhichId( _WhichId? _WhichId: CHOBJID_ANY ), + mnIndex( _Index ), + maListenerList (maMutex) +{} + +ChXChartObject::~ChXChartObject() +{} + +long ChXChartObject::GetId() const +{ + return mnWhichId; +} + +// XShape + +// the following 'Hack' methods are copied from bf_svx/unodraw/unoshape.cxx +// they are needed as long as the drawing layer requires this + +sal_Bool needLogicRectHack( SdrObject* pObj ) +{ + if( pObj->GetObjInventor() == SdrInventor) + { + switch(pObj->GetObjIdentifier()) + { + case OBJ_GRUP: + case OBJ_LINE: + case OBJ_POLY: + case OBJ_PLIN: + case OBJ_PATHLINE: + case OBJ_PATHFILL: + case OBJ_FREELINE: + case OBJ_FREEFILL: + case OBJ_SPLNLINE: + case OBJ_SPLNFILL: + case OBJ_EDGE: + case OBJ_PATHPOLY: + case OBJ_PATHPLIN: + case OBJ_MEASURE: + return sal_True; + } + } + return sal_False; +} + +Rectangle getLogicRectHack( SdrObject* pObj ) +{ + if(needLogicRectHack(pObj)) + { + return pObj->GetSnapRect(); + } + else + { + return pObj->GetLogicRect(); + } +} + +void setLogicRectHack( SdrObject* pObj, const Rectangle& rRect ) +{ + if(needLogicRectHack(pObj)) + { + pObj->SetSnapRect( rRect ); + } + else + { + pObj->SetLogicRect( rRect ); + } +} + +SdrObject* ChXChartObject::GetCurrentSdrObject() const +{ + SolarMutexGuard aGuard; + + SdrObject* pResult = NULL; + if( mpModel ) + pResult = mpModel->GetObjectWithId( mnWhichId ); + + // use first subobject for axes + if( pResult && + pResult->ISA( SdrObjGroup ) && + ( mnWhichId == CHOBJID_DIAGRAM_X_AXIS || + mnWhichId == CHOBJID_DIAGRAM_Y_AXIS || + mnWhichId == CHOBJID_DIAGRAM_Z_AXIS || + mnWhichId == CHOBJID_DIAGRAM_A_AXIS || + mnWhichId == CHOBJID_DIAGRAM_B_AXIS )) + { + pResult = pResult->GetSubList()->GetObj( 0 ); + } + + return pResult; +} + +// XShape interface methods +awt::Point SAL_CALL ChXChartObject::getPosition() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + SdrObject* pObj = GetCurrentSdrObject(); + if( pObj ) + { + Rectangle aRect( getLogicRectHack( pObj )); + Point aPt( aRect.Left(), aRect.Top() ); + + // Position is relative to anchor - calculate absoulte position + aPt -= pObj->GetAnchorPos(); + + return awt::Point( aPt.X(), aPt.Y() ); + } + else + DBG_ERROR( "Couldn't get position due to invalid SdrObject" ); + + return awt::Point(); +} + +void SAL_CALL ChXChartObject::setPosition( const awt::Point& aPosition ) throw( uno::RuntimeException ) +{ + switch( mnWhichId ) + { + // the following objects can not be positioned + case CHOBJID_DIAGRAM_X_AXIS: + case CHOBJID_DIAGRAM_Y_AXIS: + case CHOBJID_DIAGRAM_Z_AXIS: + case CHOBJID_DIAGRAM_AREA: + case CHOBJID_DIAGRAM_WALL: + DBG_ERROR( "Cannot set position of this object" ); + return; + } + + SolarMutexGuard aGuard; + + SdrObject* pObj = GetCurrentSdrObject(); + if( pObj ) + { + Rectangle aRect( getLogicRectHack( pObj ) ); + Point aLocalPos( aPosition.X, aPosition.Y ); + + // Position is absolute - position relative to anchor is required + aLocalPos -= pObj->GetAnchorPos(); + + long nDX = aLocalPos.X() - aRect.Left(); + long nDY = aLocalPos.Y() - aRect.Top(); + + if( nDX != 0 || nDY != 0 ) + { + pObj->Move( Size( nDX, nDY ) ); + if( mpModel ) + { + mpModel->SetChanged(); + + mpModel->SetUseRelativePositions( TRUE ); + mpModel->SetHasBeenMoved( mnWhichId ); + } + } + } + else + DBG_ERROR( "Couldn't set position due to invalid SdrObject" ); +} + +awt::Size SAL_CALL ChXChartObject::getSize() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + SdrObject* pObj = GetCurrentSdrObject(); + if( pObj ) + { + Rectangle aRect( getLogicRectHack( pObj )); + Size aObjSize( aRect.GetWidth(), aRect.GetHeight() ); + return awt::Size( aObjSize.getWidth(), aObjSize.getHeight() ); + } + else + DBG_ERROR( "Couldn't get size due to invalid SdrObject" ); + + return awt::Size(); +} + +void SAL_CALL ChXChartObject::setSize( const awt::Size& aSize ) + throw( beans::PropertyVetoException, uno::RuntimeException ) +{ + // set size is not supported by any chart object except + // the diagram which is covered by ChXDiagram + + DBG_ERROR( "Size of chart objects cannot be changed" ); +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL ChXChartObject::getPropertySetInfo() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + return maPropSet.getPropertySetInfo(); +} + +void SAL_CALL ChXChartObject::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + if( mpModel && mnWhichId != CHOBJID_ANY ) + { + if( aPropertyName.compareToAscii( UNONAME_TEXT_STRING ) == 0 ) + { + ::rtl::OUString aStr; + aValue >>= aStr; + mpModel->SetTitle( mnWhichId, aStr ); + mpModel->BuildChart( FALSE ); + return; + } + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( pMap && pMap->nWID ) + { + if( pMap->nFlags & beans::PropertyAttribute::READONLY ) + throw beans::PropertyVetoException(); + + USHORT nWID = pMap->nWID; + + // create itemset capable of holding necessary items + SfxItemSet* pSet = NULL; + switch( nWID ) + { + case OWN_ATTR_FILLBMP_MODE: + pSet = new SfxItemSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + break; + + default: + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID ); + break; + } + + // special handling + switch( nWID ) + { + case SCHATTR_LEGEND_POS: + if( mnWhichId == CHOBJID_LEGEND ) + { + chart::ChartLegendPosition ePos; + cppu::any2enum< chart::ChartLegendPosition >( ePos, aValue ); + //ToDo: NONE shouldn't be used to disable the legend. There should be a way + // to set the position to 'unanchored' plus a flag for + // 'vertically|horizontally' extending + mpModel->SetShowLegend( ePos != chart::ChartLegendPosition_NONE ); + mpModel->SetLegendHasBeenMoved( FALSE ); + // note: SetShowLegend sets pos to CHLEGEND_RIGHT + pSet->Put( SvxChartLegendPosItem( + SAL_STATIC_CAST( SvxChartLegendPos, SAL_STATIC_CAST( int, ePos )))); + } + break; + + case SCHATTR_TEXT_ORIENT: + { + sal_Bool bVal; + if( aValue >>= bVal ) + { + pSet->Put( SvxChartTextOrientItem( + bVal + ? CHTXTORIENT_STACKED + : CHTXTORIENT_AUTOMATIC )); + } + } + break; + + case OWN_ATTR_FILLBMP_MODE: + do + { + drawing::BitmapMode eMode; + if(!(aValue >>= eMode) ) + { + sal_Int32 nMode; + if(!(aValue >>= nMode)) + break; + + eMode = (drawing::BitmapMode)nMode; + } + pSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); + pSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); + } + while(0); + break; + + case XATTR_FILLBITMAP: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + if( pMap->nMemberId == MID_NAME ) + { + ::rtl::OUString aStr; + if( aValue >>= aStr ) + SvxShape::SetFillAttribute( nWID, aStr, *pSet, mpModel ); + break; + } + // note: this fall-through is intended + + default: + // some item is required for cloning + mpModel->GetAttr( mnWhichId, *pSet, mnIndex ); + + if( ! pSet->Count() && + mpModel->GetItemPool().IsWhich( nWID ) && + ! (( OWN_ATTR_VALUE_START <= nWID ) && ( nWID <= OWN_ATTR_VALUE_END ))) + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID )); + } + + // CL: convert special character properties + if( ! SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, aValue, *pSet )) + { + // standard mapping of any to item + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + } + break; + } + + if( pSet->Count() ) + mpModel->ChangeAttr( *pSet, mnWhichId, mnIndex ); + + delete pSet; + } + } + else + { + throw beans::UnknownPropertyException(); + } +} + +uno::Any SAL_CALL ChXChartObject::getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Any aResultaAny; + sal_Bool bPropertyUnknown = sal_False; + + if( mpModel && mnWhichId != CHOBJID_ANY ) + { + // titles + if( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UNONAME_TEXT_STRING ))) + { + aResultaAny <<= ::rtl::OUString( mpModel->GetTitle( mnWhichId )); + return aResultaAny; + } + + // legend alignment + if( mnWhichId == CHOBJID_LEGEND && + PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UNONAME_CHARTLEGENDALIGN ))) + { + SfxItemSet rSet = mpModel->GetLegendAttr(); + const SfxPoolItem *pPoolItem = NULL; + SvxChartLegendPos ePos = + rSet.GetItemState( SCHATTR_LEGEND_POS,TRUE, &pPoolItem) == SFX_ITEM_SET + ? ((const SvxChartLegendPosItem*)pPoolItem)->GetValue() + : CHLEGEND_RIGHT; + chart::ChartLegendPosition ePosition = (chart::ChartLegendPosition)ePos; + aResultaAny <<= ePosition; + return aResultaAny; + } + + // properties using map + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + if( pMap && pMap->nWID ) + { + USHORT nWID = pMap->nWID; + + if( nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + + // get 'full attributes', ie some members are copied to the set + mpModel->GetAttr( mnWhichId, aSet, mnIndex ); + + XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&aSet.Get( XATTR_FILLBMP_STRETCH ); + XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&aSet.Get( XATTR_FILLBMP_TILE ); + + if( pTileItem && pTileItem->GetValue() ) + { + aResultaAny <<= drawing::BitmapMode_REPEAT; + } + else if( pStretchItem && pStretchItem->GetValue() ) + { + aResultaAny <<= drawing::BitmapMode_STRETCH; + } + else + { + aResultaAny <<= drawing::BitmapMode_NO_REPEAT; + } + return aResultaAny; + } + + std::auto_ptr<SfxItemSet> aSet; + switch (nWID) + { + case SCHATTR_TEXT_DEGREES: + // Needing the text orientation for adapting + // CHTXTORIENT_AUTOMATIC to corresponging degrees. + aSet = std::auto_ptr<SfxItemSet> (new SfxItemSet (mpModel->GetItemPool(), + nWID, nWID, + SCHATTR_TEXT_ORIENT,SCHATTR_TEXT_ORIENT, + 0)); + break; + + default: + // Just interested in the single item. + aSet = std::auto_ptr<SfxItemSet> (new SfxItemSet (mpModel->GetItemPool(), + nWID, nWID)); + } + + // get 'full attributes', ie some members are copied to the set + mpModel->GetAttr( mnWhichId, *aSet, mnIndex ); + + if( SvxUnoTextRangeBase::GetPropertyValueHelper( *aSet, pMap, aResultaAny )) + return aResultaAny; + + // item is not set => use default + if( !aSet->Count() ) + { + // get default value from pool + if( mpModel->GetItemPool().IsWhich( nWID ) ) + { + if( ! ( OWN_ATTR_VALUE_START <= nWID && nWID <= OWN_ATTR_VALUE_END )) // 'private' properties from SvxShape + { + aSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID ) ); + } + } + else if( nWID == SID_TEXTBREAK ) + { + aSet->Put( SfxBoolItem( SID_TEXTBREAK, + ( mnWhichId == CHOBJID_DIAGRAM_X_AXIS || + mnWhichId == CHOBJID_DIAGRAM_A_AXIS ))); + } + else if( nWID == SID_ATTR_NUMBERFORMAT_SOURCE ) + { + aSet->Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, TRUE )); + } + else + { +#ifdef DBG_UTIL + String aTmpString( PropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + // item or default has been set + if( aSet->Count() ) + { + // Special case: Axis title rotation angle. + if (nWID == SCHATTR_TEXT_DEGREES) + { + // Automatic text orientation is changed into corresponding + // rotation angle. + SvxChartTextOrient eOrientation = + ((const SvxChartTextOrientItem&)aSet->Get( + SCHATTR_TEXT_ORIENT)).GetValue(); + if (eOrientation == CHTXTORIENT_AUTOMATIC) + { + switch (mnWhichId) + { + case CHOBJID_DIAGRAM_TITLE_X_AXIS: + if (mpModel->IsXVertikal()) + eOrientation = CHTXTORIENT_BOTTOMTOP; + else + eOrientation = CHTXTORIENT_AUTOMATIC; + break; + + case CHOBJID_DIAGRAM_TITLE_Y_AXIS: + if (mpModel->IsXVertikal()) + eOrientation = CHTXTORIENT_AUTOMATIC; + else + eOrientation = CHTXTORIENT_BOTTOMTOP; + break; + + case CHOBJID_DIAGRAM_TITLE_Z_AXIS: + if (mpModel->IsXVertikal()) + eOrientation = CHTXTORIENT_TOPBOTTOM; + else + eOrientation = CHTXTORIENT_AUTOMATIC; + break; + + default: + eOrientation = CHTXTORIENT_AUTOMATIC; + break; + } + long nAngle = GetTextRotation (*aSet, eOrientation); + aSet->Put (SfxInt32Item (SCHATTR_TEXT_DEGREES, nAngle)); + } + } + + if( nWID == SCHATTR_TEXT_ORIENT ) + { + // map enum to bool: only stacked or not stacked is interesting + SvxChartTextOrient eOrientation = + ((const SvxChartTextOrientItem&)aSet->Get( + SCHATTR_TEXT_ORIENT)).GetValue(); + aResultaAny <<= static_cast< sal_Bool >( eOrientation == CHTXTORIENT_STACKED ); + } + else + { + // get value from ItemSet + aResultaAny = maPropSet.getPropertyValue( pMap, *aSet ); + if( *pMap->pType != aResultaAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aResultaAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aResultaAny >>= nValue; + aResultaAny <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "getPropertyValue(): wrong Type!" ); + } + } + } + } + else + { + bPropertyUnknown = sal_True; + } + } + else + { + bPropertyUnknown = sal_True; + } + + if( bPropertyUnknown ) + { + ::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "Chart Object: Unknown Property " )); + aMessage += PropertyName; + beans::UnknownPropertyException aExcpt( aMessage, (::cppu::OWeakObject*)this ); + throw aExcpt; + } + } + + return aResultaAny; +} + +void SAL_CALL ChXChartObject::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& xListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartObject::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartObject::addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXChartObject::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + + + +//===== XMultiPropertySet =================================================== + +/* + In contrast to calling the method setPropertyValue (singular) for every given property name + the implementation of this method exploits the following properties: + 1: Both the given sequence of property names and the member property map are sorted according + to the property names. + 2: The item set which gathers all items changed by setting the properties is created only once. + 3: The solar mutex is acquired only once. +*/ +void SAL_CALL ChXChartObject::setPropertyValues ( + const uno::Sequence< ::rtl::OUString >& aPropertyNames, + const uno::Sequence< uno::Any >& aValues ) + throw ( beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + // Get pointers to first elements of lists. + const SfxItemPropertyMap * pProperty = maPropSet.getPropertyMap (); + const OUString * pPropertyName = aPropertyNames.getConstArray (); + const Any * pValue = aValues.getConstArray (); + + // Check preconditions. + if (mpModel == NULL) + throw UnknownPropertyException (OUString(RTL_CONSTASCII_USTRINGPARAM( + "ChXChartObject::setPropertyValues: no model")), (::cppu::OWeakObject*)this); + if (mnWhichId == CHOBJID_ANY) + throw UnknownPropertyException (OUString(RTL_CONSTASCII_USTRINGPARAM( + "ChXChartObject::setPropertyValues: invalid object")), (::cppu::OWeakObject*)this); + if (pProperty == NULL || pProperty->pName == NULL) + throw UnknownPropertyException (OUString(RTL_CONSTASCII_USTRINGPARAM( + "ChXChartObject::setPropertyValues: empty property list")), (::cppu::OWeakObject*)this); + + // Some variables used in the following loop. + USHORT nWID; + + // Item set used to collect all modifications from the individual properties to set. + SfxItemSet aModifications (mpModel->GetItemPool()); + mpModel->GetAttr (mnWhichId, aModifications, mnIndex); + + // Iterate over all the given property names. + sal_Int32 nCounter = aPropertyNames.getLength(); + while (nCounter-- > 0) + { + AdvanceToName (pProperty, pPropertyName); + + // Handle the properties in the property map. The case statements handle + // the special cases while the default statement handles all remaining cases. + switch (nWID = pProperty->nWID) + { + case CHATTR_TITLE_MAIN: + // Handle special cases of title objects. + { + OUString aString; + *pValue >>= aString; + mpModel->SetTitle (mnWhichId, aString); + mpModel->BuildChart (FALSE); + } + break; + + case SCHATTR_LEGEND_POS: + // This one is only valid if this object is a legend. + if (mnWhichId == CHOBJID_LEGEND) + { + chart::ChartLegendPosition ePos; + cppu::any2enum< chart::ChartLegendPosition >(ePos, *pValue); + // ToDo: NONE shouldn't be used to disable the legend. There should + // be a way to set the position to 'unanchored' plus a flag for + // 'vertically|horizontally' extending + mpModel->SetShowLegend (ePos != chart::ChartLegendPosition_NONE); + mpModel->SetLegendHasBeenMoved (FALSE); + // note: SetShowLegend sets pos to CHLEGEND_RIGHT + aModifications.Put (SvxChartLegendPosItem ( + SAL_STATIC_CAST (SvxChartLegendPos, + SAL_STATIC_CAST (int, ePos)))); + } + break; + + case SCHATTR_TEXT_ORIENT: + { + sal_Bool bVal; + if( *pValue >>= bVal ) + { + aModifications.Put( SvxChartTextOrientItem( + bVal + ? CHTXTORIENT_STACKED + : CHTXTORIENT_AUTOMATIC )); + } + } + break; + + case OWN_ATTR_FILLBMP_MODE: + { + drawing::BitmapMode eMode; + if ( ! (*pValue >>= eMode)) + { + sal_Int32 nMode; + if ( ! (*pValue >>= nMode)) + break; + eMode = (drawing::BitmapMode)nMode; + } + aModifications.Put (XFillBmpStretchItem (eMode==drawing::BitmapMode_STRETCH)); + aModifications.Put (XFillBmpTileItem (eMode==drawing::BitmapMode_REPEAT)); + } + break; + + case XATTR_FILLBITMAP: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + if (pProperty->nMemberId == MID_NAME ) + { + ::rtl::OUString aString; + if (*pValue >>= aString) + SvxShape::SetFillAttribute (nWID, aString, aModifications, mpModel); + break; + } + // note: this fall-through is intended + + default: +/* if ( aModifications.Count() == 0 + && mpModel->GetItemPool().IsWhich (nWID) + && ! ((nWID >= OWN_ATTR_VALUE_START) && (nWID <= OWN_ATTR_VALUE_END))) + { + aModifications.Put (mpModel->GetItemPool().GetDefaultItem (nWID)); + } +*/ + // First look if we are looking at a special character property. + if ( ! SvxUnoTextRangeBase::SetPropertyValueHelper (aModifications, pProperty, + *pValue, aModifications)) + { + // Not a special character property. + // Convert the given property value to an item and set it. + maPropSet.setPropertyValue (pProperty, *pValue, aModifications); + } + break; + } + + // Advance to the next property, property name and value. + pPropertyName++; + pValue++; + } + // Propagate the modified item set to the chart model. + if (aModifications.Count() > 0) + mpModel->ChangeAttr (aModifications, mnWhichId, mnIndex); +} + + + +/* + Again three facts are exploited: + 1. Getting the solar mutex once outside the main loop. + 2. Using the sorting of both the given list of property names and of the list of properties. + 3. Creating and filling once of the model's item set. + + This method uses two methods to make it usable in a generic way by derived classes. + 1. CreateItemSet creates and fills an item set with all known items which is used to set the + requested properties. + 2. GetPropertyValue is used to retrieve the individual values. + Both methods can be overloaded to implement class specific behaviour. + +*/ +uno::Sequence< uno::Any > SAL_CALL ChXChartObject::getPropertyValues ( + const uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw ( uno::RuntimeException) +{ +#if 0 + uno::Sequence<uno::Any> aResult (aPropertyNames.getLength()); + + for (sal_Int32 i=0; i<aPropertyNames.getLength(); i++) + { + aResult[i] = getPropertyValue (aPropertyNames[i]); + } + + return aResult; +#endif + SolarMutexGuard aGuard; + + // This sequence is filled with the requested values for the given property names. + Sequence<Any> aResult (aPropertyNames.getLength()); + + // Get pointers to first elements of lists. + const SfxItemPropertyMap * pProperty = maPropSet.getPropertyMap (); + const OUString * pPropertyName = aPropertyNames.getConstArray (); + Any * pValue = aResult.getArray (); + + // Check preconditions. + if (mpModel == NULL || mnWhichId == CHOBJID_ANY) + return aResult; + + // Get the models attributes. + SfxItemSet * pAttributes = CreateItemSet(); + + // Iterate over all given property names. + sal_Int32 nCounter = aPropertyNames.getLength(); + while (nCounter-- > 0) + { + AdvanceToName (pProperty, pPropertyName); + + GetPropertyValue (*pProperty, *pValue, *pAttributes); + + // Advance to the next property, property name and value. + pPropertyName++; + pValue++; + } + + delete pAttributes; + return aResult; +} + + + + +void SAL_CALL ChXChartObject::addPropertiesChangeListener ( + const uno::Sequence< ::rtl::OUString >& aPropertyNames, + const uno::Reference< beans::XPropertiesChangeListener >& xListener ) + throw ( uno::RuntimeException) +{ + // Not implemented. +} + + + + +void SAL_CALL ChXChartObject::removePropertiesChangeListener ( + const uno::Reference< beans::XPropertiesChangeListener >& xListener ) + throw ( uno::RuntimeException) +{ + // Not implemented. +} + + + + +void SAL_CALL ChXChartObject::firePropertiesChangeEvent ( + const uno::Sequence< ::rtl::OUString >& aPropertyNames, + const uno::Reference< beans::XPropertiesChangeListener >& xListener ) + throw ( uno::RuntimeException) +{ + // Not implemented. +} + + + +// XPropertyState +beans::PropertyState SAL_CALL ChXChartObject::getPropertyState( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( mpModel && + pMap && pMap->nWID ) + { + USHORT nWID = pMap->nWID; + + if( mnWhichId == CHOBJID_LEGEND && + nWID == CHATTR_LEGEND_POS ) + { + const SfxItemSet& rSet = mpModel->GetLegendAttr(); + SfxItemState aState = rSet.GetItemState( SCHATTR_LEGEND_POS, sal_False ); + + if( aState == SFX_ITEM_DEFAULT ) + return beans::PropertyState_DEFAULT_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } + else if( nWID == CHATTR_TITLE_MAIN || // property 'String' for ALL titles + nWID == SID_TEXTBREAK ) // x, y and z axis have different defaults + { + return beans::PropertyState_DIRECT_VALUE; + } + else if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + mpModel->GetAttr( mnWhichId, aSet, mnIndex ); + + if( aSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET || + aSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET ) + return beans::PropertyState_DIRECT_VALUE; + else + return beans::PropertyState_DEFAULT_VALUE; + } + else + { + SfxItemSet aSet( mpModel->GetItemPool(), nWID, nWID ); + mpModel->GetAttr( mnWhichId, aSet, mnIndex ); + + switch( aSet.GetItemState( nWID, sal_False ) ) + { + case SFX_ITEM_DONTCARE: + case SFX_ITEM_DISABLED: + return beans::PropertyState_AMBIGUOUS_VALUE; + case SFX_ITEM_READONLY: + case SFX_ITEM_SET: + return beans::PropertyState_DIRECT_VALUE; + case SFX_ITEM_DEFAULT: + return beans::PropertyState_DEFAULT_VALUE; + case SFX_ITEM_UNKNOWN: + default: + throw beans::UnknownPropertyException(); + } + } + } + + return beans::PropertyState_DIRECT_VALUE; +} + +uno::Sequence< beans::PropertyState > SAL_CALL ChXChartObject::getPropertyStates( + const uno::Sequence< ::rtl::OUString > & aPropertyNames) + throw( beans::UnknownPropertyException, + uno::RuntimeException ) +{ +#if 0 + SolarMutexGuard aGuard; + + const sal_Int32 nCount = aPropertyNames.getLength(); + const ::rtl::OUString * pName = aPropertyNames.getConstArray(); + Sequence<PropertyState > aStates (nCount); + PropertyState * pState = aStates.getArray(); + + if (mpModel == NULL) + return aStates; + + for (sal_Int32 nIdx = 0; nIdx < nCount; nIdx++) + pState[nIdx] = getPropertyState (pName[nIdx]); + + return aStates; +#else + SolarMutexGuard aGuard; + + // Get pointers to first elements of lists. + const SfxItemPropertyMap * pProperty = maPropSet.getPropertyMap (); + const sal_Int32 nCount = aPropertyNames.getLength(); + const OUString * pPropertyName = aPropertyNames.getConstArray(); + Sequence<PropertyState > aStates (nCount); + PropertyState * pState = aStates.getArray(); + + // Check precondition. + if (mpModel == NULL) + return aStates; + + // Get the models attributes. + SfxItemSet aAttributes (mpModel->GetItemPool(), + mpModel->GetAttr (mnWhichId, mnIndex).GetRanges()); + mpModel->GetAttr (mnWhichId, aAttributes, mnIndex); + + // Some variables used in the following loop. + USHORT nWID; + + // Iterate over all given property names. + sal_Int32 nCounter = aPropertyNames.getLength(); + while (nCounter-- > 0) + { + AdvanceToName (pProperty, pPropertyName); + + switch (nWID = pProperty->nWID) + { + case CHATTR_LEGEND_POS: + if (mnWhichId == CHOBJID_LEGEND) + { + const SfxItemSet& rSet = mpModel->GetLegendAttr(); + SfxItemState aState = rSet.GetItemState( SCHATTR_LEGEND_POS, sal_False ); + + if( aState == SFX_ITEM_DEFAULT ) + *pState = PropertyState_DEFAULT_VALUE; + else + *pState = PropertyState_DIRECT_VALUE; + } + break; + + case CHATTR_TITLE_MAIN: // property 'String' for ALL titles + case SID_TEXTBREAK: // x, y and z axis have different defaults + *pState = PropertyState_DIRECT_VALUE; + break; + + case OWN_ATTR_FILLBMP_MODE: + if ( aAttributes.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET + || aAttributes.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET ) + *pState = PropertyState_DIRECT_VALUE; + else + *pState = PropertyState_DEFAULT_VALUE; + break; + + case SID_ATTR_NUMBERFORMAT_SOURCE: + if( aAttributes.GetItemState( SID_ATTR_NUMBERFORMAT_SOURCE ) != SFX_ITEM_SET ) + *pState = PropertyState_DEFAULT_VALUE; + else + *pState = PropertyState_DIRECT_VALUE; + break; + + default: + switch (aAttributes.GetItemState( nWID, sal_False )) + { + case SFX_ITEM_DONTCARE: + case SFX_ITEM_DISABLED: + *pState = PropertyState_AMBIGUOUS_VALUE; + break; + + case SFX_ITEM_READONLY: + case SFX_ITEM_SET: + *pState = PropertyState_DIRECT_VALUE; + break; + + case SFX_ITEM_DEFAULT: + *pState = PropertyState_DEFAULT_VALUE; + break; + + case SFX_ITEM_UNKNOWN: + default: + { + OUString aMessage (RTL_CONSTASCII_USTRINGPARAM ( "Chart Object: Unknown Property " )); + aMessage += *pPropertyName; + throw UnknownPropertyException (aMessage, (::cppu::OWeakObject*)this ); + } + } + } + pPropertyName ++; + pState ++; + } + + return aStates; +#endif +} + +void SAL_CALL ChXChartObject::setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( mpModel ) + { + // set an empty item to change attribute to default + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + mpModel->ChangeAttr( aSet, mnWhichId, mnIndex ); + } +} + +uno::Any SAL_CALL ChXChartObject::getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + + if( mpModel->GetItemPool().IsWhich( pMap->nWID )) + { + aSet.Put( mpModel->GetItemPool().GetDefaultItem( pMap->nWID )); + } + else if( pMap->nWID == SID_TEXTBREAK ) + { + // default for x axis is true, false for y/z + BOOL bTextBreak = + ( mnWhichId == CHOBJID_DIAGRAM_X_AXIS || + mnWhichId == CHOBJID_DIAGRAM_A_AXIS ); + aSet.Put( SfxBoolItem( SID_TEXTBREAK, bTextBreak )); + } + else + throw beans::UnknownPropertyException(); + + uno::Any aAny = maPropSet.getPropertyValue( pMap, aSet ); + + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "getPropertyDefault(): wrong Type!" ); + } + } + + return aAny; +} + + + + +// XMultiPropertyStates + +// ChXChartObject::getPropertyStates is also part of XPropertyState and is defined above. + + + +void SAL_CALL ChXChartObject::setAllPropertiesToDefault (void) + throw ( uno::RuntimeException) +{ + DBG_ERROR ("ChXChartObject::setAllPropertiesToDefault"); +} + + + + +void SAL_CALL ChXChartObject::setPropertiesToDefault ( + const uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw ( beans::UnknownPropertyException, + uno::RuntimeException) +{ + for (sal_Int32 i=0; i<aPropertyNames.getLength(); i++) + { + setPropertyToDefault (aPropertyNames[i]); + } +} + + + + +uno::Sequence< uno::Any > SAL_CALL ChXChartObject::getPropertyDefaults ( + const uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw ( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException) +{ + uno::Sequence<uno::Any> aResult (aPropertyNames.getLength()); + + for (sal_Int32 i=0; i<aPropertyNames.getLength(); i++) + { + aResult[i] = getPropertyDefault (aPropertyNames[i]); + } + + return aResult; +} + + + +// XComponent +void SAL_CALL ChXChartObject::dispose() throw( uno::RuntimeException ) +{ + ::com::sun::star::lang::EventObject aEvent (*this); + maListenerList.disposeAndClear (aEvent); +} + +void SAL_CALL ChXChartObject::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListenerList.addInterface (xListener); +} + +void SAL_CALL ChXChartObject::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListenerList.removeInterface (xListener); +} + +// XServiceInfo +sal_Bool SAL_CALL ChXChartObject::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + + +// generate a uniqueId +const uno::Sequence< sal_Int8 > & ChXChartObject::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChXChartObject::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return 0; +} + + + +//===== protected methods ======================================================================= + +void ChXChartObject::AdvanceToName (const SfxItemPropertyMap *& pProperty, + const OUString * pPropertyName) +{ + sal_Int32 nComparisonResult; + + // Advance over the property list to the property with the current name. + while ((nComparisonResult=pPropertyName->compareToAscii (pProperty->pName)) > 0) + { + pProperty++; + if (pProperty->pName == NULL) + { + // We reached the end of the property list. Therefore all remaining given + // property names can not be found. + OUString sMessage = OUString (RTL_CONSTASCII_USTRINGPARAM ( "ChXChartObject::setPropertyValues: unknown property ")); + sMessage += *pPropertyName; + throw UnknownPropertyException (sMessage, (::cppu::OWeakObject*)this); + } + } + if (nComparisonResult < 0) + { + // All remaining given property names can not match (because they lie + // alphabetically before) the remaining properties => Error + OUString sMessage = OUString (RTL_CONSTASCII_USTRINGPARAM ( "ChXChartObject::setPropertyValues: unknown property ")); + sMessage += *pPropertyName; + throw UnknownPropertyException (sMessage, (::cppu::OWeakObject*)this); + } + + // If we get here then we have found the propert with the name pProperty->pName. +} + + + +SfxItemSet * ChXChartObject::CreateItemSet (void) +{ + SfxItemSet * pAttributes = new SfxItemSet (mpModel->GetItemPool()); + mpModel->GetAttr (mnWhichId, *pAttributes, mnIndex); + return pAttributes; +} + + + + +void ChXChartObject::GetPropertyValue (const SfxItemPropertyMap & rProperty, + Any & rValue, + SfxItemSet & rAttributes) +{ + USHORT nWID = rProperty.nWID; + + switch (nWID) + { + case CHATTR_TITLE_MAIN: + rValue <<= OUString( mpModel->GetTitle( mnWhichId )); + break; + + case SCHATTR_LEGEND_POS: + if (mnWhichId == CHOBJID_LEGEND) + { + SfxItemSet rSet = mpModel->GetLegendAttr(); + const SfxPoolItem *pPoolItem = NULL; + SvxChartLegendPos ePos = + rSet.GetItemState( SCHATTR_LEGEND_POS,TRUE, &pPoolItem) == SFX_ITEM_SET + ? ((const SvxChartLegendPosItem*)pPoolItem)->GetValue() + : CHLEGEND_RIGHT; + chart::ChartLegendPosition ePosition = (chart::ChartLegendPosition)ePos; + rValue <<= ePosition; + } + break; + + case OWN_ATTR_FILLBMP_MODE: + { + XFillBmpStretchItem * pStretchItem = (XFillBmpStretchItem*)&rAttributes.Get ( + XATTR_FILLBMP_STRETCH ); + XFillBmpTileItem * pTileItem = (XFillBmpTileItem*)&rAttributes.Get ( + XATTR_FILLBMP_TILE ); + + if( pTileItem && pTileItem->GetValue() ) + rValue <<= drawing::BitmapMode_REPEAT; + else if( pStretchItem && pStretchItem->GetValue() ) + rValue <<= drawing::BitmapMode_STRETCH; + else + rValue <<= drawing::BitmapMode_NO_REPEAT; + } + break; + + case SCHATTR_TEXT_ORIENT: + rValue <<= static_cast< sal_Bool >( + CHTXTORIENT_STACKED == + static_cast< const SvxChartTextOrientItem & >( rAttributes.Get( SCHATTR_TEXT_ORIENT )).GetValue() ); + break; + + default : + // Handle some special properties. + if (SvxUnoTextRangeBase::GetPropertyValueHelper (rAttributes, &rProperty, rValue)) + break; + + // item is not set => use default + switch (rAttributes.GetItemState (nWID, FALSE)) + { + case SFX_ITEM_UNKNOWN: + { + OUString sMessage (RTL_CONSTASCII_USTRINGPARAM ( "ChXChartObject::getPropertyValues: unknown property ")); + sMessage += OUString::createFromAscii(rProperty.pName); + throw UnknownPropertyException (sMessage, (::cppu::OWeakObject*)this); + } + + case SFX_ITEM_DEFAULT: + // Get default value from the item pool. + if ( mpModel->GetItemPool().IsWhich( nWID ) + && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END)) + { + // `Private' properties from SvxShape. + rAttributes.Put( mpModel->GetItemPool().GetDefaultItem( nWID ) ); + } + else if( nWID == SID_TEXTBREAK ) + { + rAttributes.Put( SfxBoolItem( SID_TEXTBREAK, + ( mnWhichId == CHOBJID_DIAGRAM_X_AXIS + || mnWhichId == CHOBJID_DIAGRAM_A_AXIS ))); + } + else if( nWID == SID_ATTR_NUMBERFORMAT_SOURCE ) + { + rAttributes.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, TRUE )); + } + else + { +#ifdef DBG_UTIL + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", + rProperty.pName, nWID ); +#endif + } + // Fall through. + + default : + rValue = maPropSet.getPropertyValue( &rProperty, rAttributes ); + if( *rProperty.pType != rValue.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *rProperty.pType == ::getCppuType((const sal_Int16*)0)) && rValue.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + rValue >>= nValue; + rValue <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "GetPropertyValue(): wrong Type!" ); + } + } + } + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXDataPoint.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXDataPoint.cxx new file mode 100644 index 000000000000..25f6aab346d2 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXDataPoint.cxx @@ -0,0 +1,874 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "ChXDataPoint.hxx" +#include "mapprov.hxx" + +// header for SvxServiceInfoHelper +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> +// header for SvxUnoTextRangeBase +// for OWN_ATTR_... +#include <bf_svx/unoshprp.hxx> +// for SID_ATTR_... +#include <bf_svx/svxids.hrc> +#include <bf_svx/unoshape.hxx> +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include "schattr.hxx" + +#ifndef _SVX_BRSHITEM_HXX +#define ITEMID_BRUSH SCHATTR_SYMBOL_BRUSH +#include <bf_svx/brshitem.hxx> +#endif +// header for SVX_SYMBOLTYPE_BRUSHITEM +#include <bf_svx/tabline.hxx> +#include <bf_svx/unoapi.hxx> + +#include <bf_svx/xflbstit.hxx> +#include <bf_svx/xflbmtit.hxx> + +#include <com/sun/star/chart/ChartDataCaption.hpp> + +// header for SvxChartDataDescrItem +#ifndef _SVX_CHRTITEM_HXX +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#endif + +#include "globfunc.hxx" // for GlobalGenerate3DAttrDefaultItem +#include "unonames.hxx" +namespace binfilter { + + +extern SchUnoPropertyMapProvider aSchMapProvider; + +using namespace ::com::sun::star; + +ChXDataPoint::ChXDataPoint( sal_Int32 _Col, sal_Int32 _Row, ChartModel* _Model ) : + maPropSet( aSchMapProvider.GetMap( _Model? CHMAP_DATAPOINT: CHMAP_NONE, _Model )), + mpModel( _Model ), + mnCol( _Col ), + mnRow( _Row ) +{} + +ChXDataPoint::~ChXDataPoint() +{} + + +// generate a uniqueId +const uno::Sequence< sal_Int8 > & ChXDataPoint::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +// XTypeProvider +uno::Sequence< sal_Int8 > SAL_CALL ChXDataPoint::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; +} + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL ChXDataPoint::getPropertySetInfo() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + return maPropSet.getPropertySetInfo(); +} + +void ChXDataPoint::AddDataPointAttr( SfxItemSet& rOutAttributes ) +{ + if( mpModel->IsPieChart()) + rOutAttributes.Put( mpModel->GetFullDataPointAttr( mnCol, 0 )); + else + rOutAttributes.Put( mpModel->GetDataPointAttr( mnCol, mnRow )); +} + +void SAL_CALL ChXDataPoint::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + sal_Bool bPropertyUnknown = sal_False; + + if( mpModel ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( pMap && pMap->nWID ) + { + if( pMap->nFlags & beans::PropertyAttribute::READONLY ) + throw beans::PropertyVetoException(); + + USHORT nWID = pMap->nWID; + SfxItemSet* pSet; + + if( nWID == SCHATTR_DATADESCR_DESCR || nWID == SCHATTR_DATADESCR_SHOW_SYM ) + { + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + } + else if( nWID == CHATTR_PIE_SEGMENT_OFFSET ) // member of ChartModel rather than property + { + sal_Int32 nVal; + aValue >>= nVal; + short nValToSet = (short)(abs( nVal ) % 101); // cast long->short is ok (range 0..100) + + mpModel->SetPieSegOfs( mnCol, nValToSet ); + SvxChartStyle& rStyle = mpModel->ChartStyle(); + if( rStyle == CHSTYLE_2D_PIE_SEGOF1 || + rStyle == CHSTYLE_2D_PIE_SEGOFALL ) + rStyle = CHSTYLE_2D_PIE; + + mpModel->BuildChart( FALSE ); + return; // RETURN + } + else if( nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + + do + { + drawing::BitmapMode eMode; + if(!(aValue >>= eMode) ) + { + sal_Int32 nMode; + if(!(aValue >>= nMode)) + break; + + eMode = (drawing::BitmapMode)nMode; + } + aSet.Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); + aSet.Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); + } + while(0); + mpModel->PutDataPointAttr( mnCol, mnRow, aSet ); + mpModel->BuildChart( FALSE ); + + return; + } + else if( nWID == SCHATTR_SYMBOL_BRUSH ) + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID, + SCHATTR_STYLE_SYMBOL, SCHATTR_STYLE_SYMBOL, 0 ); + else + { + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID ); + } + + pSet->Put( mpModel->GetFullDataPointAttr( mnCol, mnRow )); + + if( ! pSet->Count() ) + { + // get default from ItemPool + if( mpModel->GetItemPool().IsWhich( nWID )) + { + if( ! ( OWN_ATTR_VALUE_START <= nWID && nWID <= OWN_ATTR_VALUE_END )) + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID )); + } + } + else + { +#ifdef DBG_UTIL + String aTmpString( aPropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + if( pSet->Count() ) + { + sal_Int32 nVal; + switch( nWID ) + { + case SCHATTR_STAT_KIND_ERROR: + case SCHATTR_STAT_INDICATE: + case SCHATTR_STAT_REGRESSTYPE: + // property is enum, but item is INT32 + aValue >>= nVal; + pSet->Put( SfxInt32Item( nWID, nVal ) ); + break; + // BM: theese two SCHATTRs are merged into one INT32, so extract them from aValue + case SCHATTR_DATADESCR_DESCR: + case SCHATTR_DATADESCR_SHOW_SYM: + { + // symbol + aValue >>= nVal; + pSet->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYM, + ((nVal & chart::ChartDataCaption::SYMBOL) != 0))); + + // display text, percent or both or value + SvxChartDataDescr eDescr = CHDESCR_NONE; + if( nVal & chart::ChartDataCaption::TEXT ) + { + if( nVal & chart::ChartDataCaption::PERCENT ) + eDescr = CHDESCR_TEXTANDPERCENT; + else if( (nVal & chart::ChartDataCaption::VALUE) ) + eDescr = CHDESCR_TEXTANDVALUE; + else + eDescr = CHDESCR_TEXT; + } + else if( (nVal & chart::ChartDataCaption::VALUE) ) + { + eDescr = CHDESCR_VALUE; + } + else + { + if( (nVal & chart::ChartDataCaption::PERCENT) ) + eDescr = CHDESCR_PERCENT; + } + + // chart::ChartDataCaption::FORMAT (missing) + + pSet->Put( SvxChartDataDescrItem( eDescr ) ); + } + break; + case SCHATTR_SYMBOL_BRUSH: + { + ::rtl::OUString aURL; + aValue >>= aURL; + BfGraphicObject aGraphObj = CreateGraphicObjectFromURL( aURL ); + SvxBrushItem aItem( SCHATTR_SYMBOL_BRUSH ); + aItem.SetGraphic( aGraphObj.GetGraphic() ); + pSet->Put( aItem ); + } + break; + + case XATTR_FILLBITMAP: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + if( pMap->nMemberId == MID_NAME ) + { + ::rtl::OUString aStr; + if( aValue >>= aStr ) + SvxShape::SetFillAttribute( nWID, aStr, *pSet, mpModel ); + break; + } + // note: this fall-through is intended + + default: + // CL: convert special character properties + if( ! SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, aValue, *pSet )) + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + } + mpModel->PutDataPointAttr( mnCol, mnRow, *pSet ); + + mpModel->BuildChart( FALSE ); + } + else + { + bPropertyUnknown = sal_True; + } + if( pSet ) + delete pSet; + } + else + { + bPropertyUnknown = sal_True; + } + } + else + { + DBG_WARNING( "No Model" ); + } + + if( bPropertyUnknown ) + { + ::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "Data Point: Unknown Property " )); + aMessage += aPropertyName; + beans::UnknownPropertyException aExcpt( aMessage, (::cppu::OWeakObject*)this ); + throw aExcpt; + } +} + +uno::Any SAL_CALL ChXDataPoint::getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + + if( mpModel ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( pMap && pMap->nWID ) + { + SfxItemSet* pSet; + USHORT nWID = pMap->nWID; + + if( nWID == SCHATTR_STYLE_SHAPE && + ! mpModel->IsReal3D()) + return aAny; + + if( nWID == SCHATTR_DATADESCR_DESCR || nWID == SCHATTR_DATADESCR_SHOW_SYM ) + { + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + } + else if( nWID == CHATTR_PIE_SEGMENT_OFFSET ) + { + sal_Int32 nVal = mpModel->PieSegOfs( mnCol ); + aAny <<= nVal; + return aAny; // RETURN + } + else if( nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + + aSet.Put( mpModel->GetFullDataPointAttr( mnCol, mnRow )); + + XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&aSet.Get( XATTR_FILLBMP_STRETCH ); + XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&aSet.Get( XATTR_FILLBMP_TILE ); + + if( pTileItem && pTileItem->GetValue() ) + { + aAny <<= drawing::BitmapMode_REPEAT; + } + else if( pStretchItem && pStretchItem->GetValue() ) + { + aAny <<= drawing::BitmapMode_STRETCH; + } + else + { + aAny <<= drawing::BitmapMode_NO_REPEAT; + } + return aAny; + } + else + { + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID ); + } + pSet->Put( mpModel->GetFullDataPointAttr( mnCol, mnRow )); + + if( ! pSet->Count() ) + { + // get default from pool + if( mpModel->GetItemPool().IsWhich( nWID )) + { + if( OWN_ATTR_VALUE_START > nWID || nWID > OWN_ATTR_VALUE_END ) + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID ) ); + } + } + else + { +#ifdef DBG_UTIL + String aTmpString( PropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + if( pSet->Count() ) + { + // get value from ItemSet + + // theese two SCHATTRs have to be merged into one INT32 in aAny + if( nWID == SCHATTR_DATADESCR_DESCR || nWID == SCHATTR_DATADESCR_SHOW_SYM ) + { + BOOL bShowSymbol = ((const SfxBoolItem&) + (pSet->Get(SCHATTR_DATADESCR_SHOW_SYM))).GetValue(); + SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&) + (pSet->Get(SCHATTR_DATADESCR_DESCR))).GetValue(); + + sal_Int32 nVal = 0; + switch( eDescr ) + { + case CHDESCR_NONE: + nVal = chart::ChartDataCaption::NONE; + break; + case CHDESCR_VALUE: + nVal = chart::ChartDataCaption::VALUE; + break; + case CHDESCR_PERCENT: + nVal = chart::ChartDataCaption::PERCENT; + break; + case CHDESCR_TEXT: + nVal = chart::ChartDataCaption::TEXT; + break; + case CHDESCR_TEXTANDPERCENT: + nVal = chart::ChartDataCaption::PERCENT | chart::ChartDataCaption::TEXT; + break; + case CHDESCR_TEXTANDVALUE: + nVal = chart::ChartDataCaption::VALUE | chart::ChartDataCaption::TEXT; + // chart::ChartDataCaption::FORMAT (missing) + } + if( bShowSymbol ) nVal |= chart::ChartDataCaption::SYMBOL; + + aAny <<= nVal; + } + else if( nWID == SCHATTR_SYMBOL_BRUSH ) + { + ::rtl::OUString aURL; + const BfGraphicObject* pGraphObj = + ((const SvxBrushItem &)(pSet->Get( nWID ))).GetGraphicObject(); + if( pGraphObj ) + { + aURL = ::rtl::OUString::createFromAscii( UNO_NAME_GRAPHOBJ_URLPREFIX ); + aURL += ::rtl::OUString::createFromAscii( pGraphObj->GetUniqueID().GetBuffer()); + } + aAny <<= aURL; + } + else + { + aAny = maPropSet.getPropertyValue( pMap, *pSet ); + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "getPropertyValue(): wrong Type!" ); + } + } + } + } + else + { + throw beans::UnknownPropertyException(); + } + if( pSet ) + delete pSet; + } + else + { + throw beans::UnknownPropertyException(); + } + } + + return aAny; +} + +void SAL_CALL ChXDataPoint::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& xListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDataPoint::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDataPoint::addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDataPoint::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +// XPropertyState +beans::PropertyState SAL_CALL ChXDataPoint::getPropertyState( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( mpModel && + pMap && pMap->nWID ) + { + if( pMap->nWID == CHATTR_PIE_SEGMENT_OFFSET ) + { + sal_Int32 nOffset; + uno::Any aAny = getPropertyValue( PropertyName ); + aAny >>= nOffset; + if( nOffset ) + return beans::PropertyState_DIRECT_VALUE; + else + return beans::PropertyState_DEFAULT_VALUE; + } + else if( pMap->nWID == SCHATTR_DATADESCR_DESCR ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + AddDataPointAttr( aSet ); + + SfxItemState eState1 = aSet.GetItemState( SCHATTR_DATADESCR_DESCR ); + SfxItemState eState2 = aSet.GetItemState( SCHATTR_DATADESCR_SHOW_SYM ); + if( eState1 == SFX_ITEM_DEFAULT && + eState2 == SFX_ITEM_DEFAULT ) + return beans::PropertyState_DEFAULT_VALUE; + else if( eState1 < SFX_ITEM_DEFAULT && + eState2 < SFX_ITEM_DEFAULT ) + return beans::PropertyState_AMBIGUOUS_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } + else if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + AddDataPointAttr( aSet ); + + if( aSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET || + aSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET ) + return beans::PropertyState_DIRECT_VALUE; + else + return beans::PropertyState_DEFAULT_VALUE; + } + else + { + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + AddDataPointAttr( aSet ); + + SfxItemState eState = aSet.GetItemState( pMap->nWID ); + if( eState == SFX_ITEM_DEFAULT ) + return beans::PropertyState_DEFAULT_VALUE; + else if( eState < SFX_ITEM_DEFAULT ) + return beans::PropertyState_AMBIGUOUS_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } + } + + return beans::PropertyState_DIRECT_VALUE; +} + +/* +uno::Sequence< beans::PropertyState > SAL_CALL ChXDataPoint::getPropertyStates( + const uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw( beans::UnknownPropertyException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const sal_Int32 nCount = aPropertyName.getLength(); + const ::rtl::OUString* pNames = aPropertyName.getConstArray(); + + uno::Sequence< beans::PropertyState > aRet( nCount ); + beans::PropertyState* pState = aRet.getArray(); + + for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ ) + pState[ nIdx ] = getPropertyState( pNames[ nIdx ] ); + + return aRet; +} +*/ + +uno::Sequence< beans::PropertyState > SAL_CALL + ChXDataPoint::getPropertyStates ( + const uno::Sequence< ::rtl::OUString > & aPropertyName) + throw (beans::UnknownPropertyException, + uno::RuntimeException) +{ + SolarMutexGuard aGuard; + + const sal_Int32 nCount = aPropertyName.getLength(); + const ::rtl::OUString* pNames = aPropertyName.getConstArray(); + + uno::Sequence<beans::PropertyState> aResult (nCount); + beans::PropertyState * pStateArray = aResult.getArray(); + + // for pie charts data point attributes are stored in data rows + // which are returned by GetDataPointAttr() if no explicit + // arguments exist + if (mpModel->IsDataPointAttrSet (mnCol, mnRow) || + (mpModel->IsPieChart())) + { + uno::Any aAny; + SfxAllItemSet aSet( mpModel->GetItemPool() ); + SfxItemState eState1,eState2; + const SfxItemPropertyMap * pMap; + + AddDataPointAttr( aSet ); + + for (sal_Int32 nIndex=0; nIndex<nCount; nIndex++) + { + pMap = maPropSet.getPropertyMapEntry (pNames[nIndex]); + + if (mpModel && pMap && pMap->nWID) + { + switch (pMap->nWID) + { + case CHATTR_PIE_SEGMENT_OFFSET: + if( mpModel->IsPieChart() ) + { + pStateArray[nIndex] = (mpModel->PieSegOfs (mnCol) != 0) + ? beans::PropertyState_DIRECT_VALUE + : beans::PropertyState_DEFAULT_VALUE; + } + else + { + pStateArray[nIndex] = beans::PropertyState_DEFAULT_VALUE; + } + break; + + case SCHATTR_DATADESCR_DESCR: + eState1 = aSet.GetItemState (SCHATTR_DATADESCR_DESCR); + eState2 = aSet.GetItemState (SCHATTR_DATADESCR_SHOW_SYM); + if (eState1 == SFX_ITEM_DEFAULT && eState2 == SFX_ITEM_DEFAULT) + pStateArray[nIndex] = beans::PropertyState_DEFAULT_VALUE; + else if (eState1 < SFX_ITEM_DEFAULT && eState2 < SFX_ITEM_DEFAULT) + pStateArray[nIndex] = beans::PropertyState_AMBIGUOUS_VALUE; + else + pStateArray[nIndex] = beans::PropertyState_DIRECT_VALUE; + break; + + case OWN_ATTR_FILLBMP_MODE: + eState1 = aSet.GetItemState( XATTR_FILLBMP_STRETCH, false ); + eState2 = aSet.GetItemState( XATTR_FILLBMP_TILE, false ); + if (eState1 == SFX_ITEM_SET || eState2 == SFX_ITEM_SET) + pStateArray[nIndex] = beans::PropertyState_DIRECT_VALUE; + else + pStateArray[nIndex] = beans::PropertyState_DEFAULT_VALUE; + break; + + default: + switch (aSet.GetItemState (pMap->nWID)) + { + case SFX_ITEM_DEFAULT: // 0x0020 + pStateArray[nIndex] = beans::PropertyState_DEFAULT_VALUE; + break; + + case SFX_ITEM_UNKNOWN: // 0x0000 + case SFX_ITEM_DISABLED: // 0x0001 + case SFX_ITEM_READONLY: // 0x0002 + case SFX_ITEM_DONTCARE: // 0x0010 + pStateArray[nIndex] = beans::PropertyState_AMBIGUOUS_VALUE; + break; + + default: + // SFX_ITEM_SET 0x0030 + pStateArray[nIndex] = beans::PropertyState_DIRECT_VALUE; + } + } + } + else + pStateArray[nIndex] = beans::PropertyState_DEFAULT_VALUE; +// pStateArray[nIndex] = beans::PropertyState_DIRECT_VALUE; + } + } + else + for (sal_Int32 nIndex=0; nIndex<nCount; nIndex++) + pStateArray[nIndex] = beans::PropertyState_DEFAULT_VALUE; + + return aResult; +} + + + + +void SAL_CALL ChXDataPoint::setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( mpModel && pMap && pMap->nWID ) + { + if( pMap->nWID == CHATTR_PIE_SEGMENT_OFFSET ) + { + mpModel->SetPieSegOfs( mnCol, 0 ); + } + else if( pMap->nWID == SCHATTR_DATADESCR_DESCR ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + + aSet.ClearItem( SCHATTR_DATADESCR_DESCR ); + aSet.ClearItem( SCHATTR_DATADESCR_SHOW_SYM ); + mpModel->PutDataPointAttr( mnCol, mnRow, aSet ); + } + else + { + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + + aSet.ClearItem( pMap->nWID ); + mpModel->PutDataPointAttr( mnCol, mnRow, aSet ); + } + } +} + +uno::Any SAL_CALL ChXDataPoint::getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + uno::Any aAny; + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( mpModel && ! mpModel->GetItemPool().IsWhich( pMap->nWID )) + throw beans::UnknownPropertyException(); + + if( mpModel && pMap && pMap->nWID ) + { + if( pMap->nWID == CHATTR_PIE_SEGMENT_OFFSET ) + { + aAny <<= (sal_Int32)0; + } + else if( pMap->nWID == SCHATTR_DATADESCR_DESCR ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + + aSet.Put( mpModel->GetItemPool().GetDefaultItem( SCHATTR_DATADESCR_DESCR )); + aSet.Put( mpModel->GetItemPool().GetDefaultItem( SCHATTR_DATADESCR_SHOW_SYM )); + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + else + { + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + aSet.Put( mpModel->GetItemPool().GetDefaultItem( pMap->nWID )); + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "getPropertyDefault(): wrong Type!" ); + } + } + } + + return aAny; +} + + +// XShapeDescriptor ( ::XShape ::XDiagram ) +::rtl::OUString SAL_CALL ChXDataPoint::getShapeType() throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "com.sun.star.chart.ChartDataPoint" ); +} + + +// XServiceInfo +::rtl::OUString SAL_CALL ChXDataPoint::getImplementationName() throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXDataPoint" ); +} + +sal_Bool SAL_CALL ChXDataPoint::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException ) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXDataPoint::getSupportedServiceNames() throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSeq; + SvxServiceInfoHelper::addToSequence( + aSeq, 5, + "com.sun.star.chart.ChartDataPointProperties", + "com.sun.star.drawing.LineProperties", + "com.sun.star.drawing.FillProperties", + "com.sun.star.style.CharacterProperties", + "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + if( mpModel ) + { + long nType = mpModel->GetBaseType(); + if( mpModel->Is3DChart() && (nType == CHTYPE_BAR || nType == CHTYPE_COLUMN) ) + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.Chart3DBarProperties" ); + else if( ! mpModel->Is3DChart() && nType == CHTYPE_CIRCLE ) + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.ChartPieSegmentProperties" ); + } + + return aSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChXDataPoint::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return 0; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXDataRow.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXDataRow.cxx new file mode 100644 index 000000000000..42a1632edf86 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXDataRow.cxx @@ -0,0 +1,809 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "ChXDataRow.hxx" +#include "mapprov.hxx" +#include "ChartLine.hxx" + +// header for SvxServiceInfoHelper +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> +// header for SvxUnoTextRangeBase +// for OWN_ATTR_... +#include <bf_svx/unoshprp.hxx> +// for SID_ATTR_... +#include <bf_svx/svxids.hrc> +#include <bf_svx/unoshape.hxx> +#include <rtl/uuid.h> +#include <rtl/memory.h> + +#include "schattr.hxx" + +#ifndef _SVX_BRSHITEM_HXX +#define ITEMID_BRUSH SCHATTR_SYMBOL_BRUSH +#include <bf_svx/brshitem.hxx> +#endif +// header for SVX_SYMBOLTYPE_BRUSHITEM +#include <bf_svx/tabline.hxx> +#include <bf_svx/unoapi.hxx> + +#include <com/sun/star/chart/ChartDataCaption.hpp> +#include <com/sun/star/chart/ChartAxisAssign.hpp> +#include <comphelper/extract.hxx> + +#include <bf_svx/xflbstit.hxx> +#include <bf_svx/xflbmtit.hxx> + +// header for SvxChartDataDescrItem +#ifndef _SVX_CHRTITEM_HXX +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR +#endif + +#include "globfunc.hxx" // for GlobalGenerate3DAttrDefaultItem +#include "unonames.hxx" +namespace binfilter { + +extern SchUnoPropertyMapProvider aSchMapProvider; + +using namespace ::com::sun::star; + +ChXDataRow::ChXDataRow( sal_Int32 _Row, ChartModel* _Model ) : + maPropSet( aSchMapProvider.GetMap( _Model? CHMAP_DATAROW: CHMAP_NONE, _Model )), + mpModel( _Model ), + mnRow( _Row ) +{} + +ChXDataRow::~ChXDataRow() +{} + +// generate a uniqueId +const uno::Sequence< sal_Int8 > & ChXDataRow::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +uno::Reference< beans::XPropertySet > ChXDataRow::getStatisticsProperties( sal_Int32 nId ) const +{ + SolarMutexGuard aGuard; + + if( mpModel ) + { + beans::XPropertySet* pObj = new ChartLine( mpModel, nId, mnRow ); + uno::Reference< beans::XPropertySet > xObj( pObj ); + if( xObj.is() ) + return xObj; + } + else + { + DBG_ERROR( "No Model" ); + } + + return uno::Reference< beans::XPropertySet >(); +} + + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL ChXDataRow::getPropertySetInfo() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + return maPropSet.getPropertySetInfo(); +} + +void SAL_CALL ChXDataRow::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + sal_Bool bPropertyUnknown = sal_False; + + if( mpModel ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( pMap && pMap->nWID ) + { + if( pMap->nFlags & beans::PropertyAttribute::READONLY ) + throw beans::PropertyVetoException(); + + USHORT nWID = pMap->nWID; + SfxItemSet* pSet; + + if( nWID == SCHATTR_DATADESCR_DESCR || nWID == SCHATTR_DATADESCR_SHOW_SYM ) + { + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + } + else if( nWID == CHATTR_PIE_SEGMENT_OFFSET ) // member of ChartModel rather than property + { + // (not fully supported yet. problem: getPropertyValue) + sal_Int32 nVal; + aValue >>= nVal; + short nValToSet = (short)(abs( nVal ) % 101); // cast long->short is ok (range 0..100) + + if( mnRow == 0 ) // must be first row + { + long nCount = mpModel->GetColCount(), i; + for( i=0; i<nCount; i++ ) + mpModel->SetPieSegOfs( i, nValToSet ); + } + SvxChartStyle& rStyle = mpModel->ChartStyle(); + if( rStyle == CHSTYLE_2D_PIE_SEGOF1 || + rStyle == CHSTYLE_2D_PIE_SEGOFALL ) + rStyle = CHSTYLE_2D_PIE; + + mpModel->BuildChart( FALSE ); + return; // RETURN + } + else if( nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + + do + { + drawing::BitmapMode eMode; + if(!(aValue >>= eMode) ) + { + sal_Int32 nMode; + if(!(aValue >>= nMode)) + break; + + eMode = (drawing::BitmapMode)nMode; + } + aSet.Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); + aSet.Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); + } + while(0); + mpModel->PutDataRowAttr( mnRow, aSet ); + mpModel->BuildChart( FALSE ); + + return; + } + else if( nWID == SCHATTR_SYMBOL_BRUSH ) + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID, + SCHATTR_STYLE_SYMBOL, SCHATTR_STYLE_SYMBOL, 0 ); + else + { + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID ); + } + DBG_ASSERT( pSet, "Itemset is invalid!" ); + + pSet->Put( mpModel->GetDataRowAttr( mnRow )); + + if( ! pSet->Count() ) + { + // get default from ItemPool + if( mpModel->GetItemPool().IsWhich( nWID )) + { + if( ! ( OWN_ATTR_VALUE_START <= nWID && nWID <= OWN_ATTR_VALUE_END )) + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID )); + } + } + else + { +#ifdef DBG_UTIL + String aTmpString( aPropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + if( pSet->Count() ) + { + sal_Int32 nVal; + switch( nWID ) + { + case SCHATTR_STAT_KIND_ERROR: + case SCHATTR_STAT_INDICATE: + case SCHATTR_STAT_REGRESSTYPE: + // property is enum, but item is INT32 + cppu::enum2int( nVal, aValue ); + pSet->Put( SfxInt32Item( nWID, nVal ) ); + break; + // BM: theese two SCHATTRs are merged into one INT32, so extract them from aValue + case SCHATTR_DATADESCR_DESCR: + case SCHATTR_DATADESCR_SHOW_SYM: + { + // symbol + aValue >>= nVal; + pSet->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYM, + ((nVal & chart::ChartDataCaption::SYMBOL) != 0 ))); + + // display text, percent or both or value + SvxChartDataDescr eDescr = CHDESCR_NONE; + if( nVal & chart::ChartDataCaption::TEXT ) + { + if( nVal & chart::ChartDataCaption::PERCENT ) + eDescr = CHDESCR_TEXTANDPERCENT; + else if( (nVal & chart::ChartDataCaption::VALUE) ) + eDescr = CHDESCR_TEXTANDVALUE; + else + eDescr = CHDESCR_TEXT; + } + else if( (nVal & chart::ChartDataCaption::VALUE) ) + { + eDescr = CHDESCR_VALUE; + } + else + { + if( (nVal & chart::ChartDataCaption::PERCENT) ) + eDescr = CHDESCR_PERCENT; + } + + // chart::ChartDataCaption::FORMAT (missing) + + pSet->Put( SvxChartDataDescrItem( eDescr ) ); + } + break; + case SCHATTR_SYMBOL_BRUSH: + { + ::rtl::OUString aURL; + aValue >>= aURL; + BfGraphicObject aGraphObj = CreateGraphicObjectFromURL( aURL ); + SvxBrushItem aItem( SCHATTR_SYMBOL_BRUSH ); + aItem.SetGraphic( aGraphObj.GetGraphic() ); + pSet->Put( aItem ); + } + break; + + case XATTR_FILLBITMAP: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + if( pMap->nMemberId == MID_NAME ) + { + ::rtl::OUString aStr; + if( aValue >>= aStr ) + SvxShape::SetFillAttribute( nWID, aStr, *pSet, mpModel ); + break; + } + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + + case SCHATTR_AXIS: + aValue >>= nVal; + if( nVal != chart::ChartAxisAssign::PRIMARY_Y && + nVal != chart::ChartAxisAssign::SECONDARY_Y ) + { + throw lang::IllegalArgumentException(); + } + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + + default: + // CL: convert special character properties + if( ! SvxUnoTextRangeBase::SetPropertyValueHelper( *pSet, pMap, aValue, *pSet )) + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + } + + mpModel->PutDataRowAttr( mnRow, *pSet ); + + if( SCHATTR_DATADESCR_START <= nWID && nWID <= SCHATTR_DATADESCR_END ) + { + SfxItemSet rAttr( mpModel->GetDataRowAttr( mnRow )); + SvxChartDataDescr eNewDataDescr; + BOOL bNewShowSym; + const SfxPoolItem *pPoolItem; + + if( rAttr.GetItemState( SCHATTR_DATADESCR_DESCR, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + eNewDataDescr = ((const SvxChartDataDescrItem*)pPoolItem)->GetValue(); + + if( rAttr.GetItemState( SCHATTR_DATADESCR_SHOW_SYM, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + bNewShowSym = ((const SfxBoolItem*)pPoolItem)->GetValue(); + + mpModel->ChangeDataDescr( eNewDataDescr, bNewShowSym, mnRow, FALSE ); + } + + mpModel->BuildChart( FALSE ); + } + else + { + bPropertyUnknown = sal_True; + } + if( pSet ) + delete pSet; + } + else + { + bPropertyUnknown = sal_True; + } + } + else + { + DBG_WARNING( "No Model" ); + } + + if( bPropertyUnknown ) + { + ::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "Data Row: Unknown Property " )); + aMessage += aPropertyName; + beans::UnknownPropertyException aExcpt( aMessage, (::cppu::OWeakObject*)this ); + throw aExcpt; + } +} + +uno::Any SAL_CALL ChXDataRow::getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Any aAny; + + if( mpModel ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( pMap && pMap->nWID ) + { + SfxItemSet* pSet; + USHORT nWID = pMap->nWID; + + if( nWID == SCHATTR_STYLE_SHAPE && + ! mpModel->IsReal3D()) + return aAny; + + if( nWID == SCHATTR_DATADESCR_DESCR || nWID == SCHATTR_DATADESCR_SHOW_SYM ) + { + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + } + else if( nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + + aSet.Put( mpModel->GetDataRowAttr( mnRow )); + + XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&aSet.Get( XATTR_FILLBMP_STRETCH ); + XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&aSet.Get( XATTR_FILLBMP_TILE ); + + if( pTileItem && pTileItem->GetValue() ) + { + aAny <<= drawing::BitmapMode_REPEAT; + } + else if( pStretchItem && pStretchItem->GetValue() ) + { + aAny <<= drawing::BitmapMode_STRETCH; + } + else + { + aAny <<= drawing::BitmapMode_NO_REPEAT; + } + return aAny; + } + else + { + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID ); + } + + switch( nWID ) + { + case CHATTR_REGRESSION_PROPS: + { + uno::Reference< beans::XPropertySet > xProps = getStatisticsProperties( CHOBJID_DIAGRAM_REGRESSION ); + aAny <<= xProps; + return aAny; // RETURN + } + + case CHATTR_ERROR_PROPS: + { + uno::Reference< beans::XPropertySet > xProps = getStatisticsProperties( CHOBJID_DIAGRAM_ERROR ); + aAny <<= xProps; + return aAny; // RETURN + } + + case CHATTR_AVERAGE_PROPS: + { + uno::Reference< beans::XPropertySet > xProps = getStatisticsProperties( CHOBJID_DIAGRAM_AVERAGEVALUE ); + aAny <<= xProps; + return aAny; // RETURN + } + + default: + pSet->Put( mpModel->GetDataRowAttr( mnRow )); + } + + if( ! pSet->Count() ) + { + // Default aus ItemPool holen + if( mpModel->GetItemPool().IsWhich( nWID )) + { + if( OWN_ATTR_VALUE_START > nWID || nWID > OWN_ATTR_VALUE_END ) + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID ) ); + } + } + else + { +#ifdef DBG_UTIL + String aTmpString( PropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + if( pSet->Count() ) + { + // get value from ItemSet + + // theese two SCHATTRs have to be merged into one INT32 in aAny + if( nWID == SCHATTR_DATADESCR_DESCR || nWID == SCHATTR_DATADESCR_SHOW_SYM ) + { + BOOL bShowSymbol = ((const SfxBoolItem&) + (pSet->Get(SCHATTR_DATADESCR_SHOW_SYM))).GetValue(); + SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&) + (pSet->Get(SCHATTR_DATADESCR_DESCR))).GetValue(); + + sal_Int32 nVal = 0; + switch( eDescr ) + { + case CHDESCR_NONE: + nVal = chart::ChartDataCaption::NONE; + break; + case CHDESCR_VALUE: + nVal = chart::ChartDataCaption::VALUE; + break; + case CHDESCR_PERCENT: + nVal = chart::ChartDataCaption::PERCENT; + break; + case CHDESCR_TEXT: + nVal = chart::ChartDataCaption::TEXT; + break; + case CHDESCR_TEXTANDPERCENT: + nVal = chart::ChartDataCaption::PERCENT | chart::ChartDataCaption::TEXT; + break; + case CHDESCR_TEXTANDVALUE: + nVal = chart::ChartDataCaption::VALUE | chart::ChartDataCaption::TEXT; + // chart::ChartDataCaption::FORMAT (missing) + } + if( bShowSymbol ) nVal |= chart::ChartDataCaption::SYMBOL; + + aAny <<= nVal; + } + else if( nWID == SCHATTR_SYMBOL_BRUSH ) + { + ::rtl::OUString aURL; + const BfGraphicObject* pGraphObj = + ((const SvxBrushItem &)(pSet->Get( nWID ))).GetGraphicObject(); + if( pGraphObj ) + { + aURL = ::rtl::OUString::createFromAscii( UNO_NAME_GRAPHOBJ_URLPREFIX ); + aURL += ::rtl::OUString::createFromAscii( pGraphObj->GetUniqueID().GetBuffer()); + } + aAny <<= aURL; + } + else + { + aAny = maPropSet.getPropertyValue( pMap, *pSet ); + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "getPropertyValue(): wrong Type!" ); + } + } + } + } + else + { + throw beans::UnknownPropertyException(); + } + if( pSet ) + delete pSet; + } + else + { + throw beans::UnknownPropertyException(); + } + } + + return aAny; +} + +void SAL_CALL ChXDataRow::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& xListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDataRow::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDataRow::addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDataRow::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +// XPropertyState +beans::PropertyState SAL_CALL ChXDataRow::getPropertyState( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( mpModel && + pMap && pMap->nWID ) + { + if( pMap->nWID == SCHATTR_DATADESCR_DESCR ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + aSet.Put( mpModel->GetDataRowAttr( mnRow )); + + SfxItemState eState1 = aSet.GetItemState( SCHATTR_DATADESCR_DESCR ); + SfxItemState eState2 = aSet.GetItemState( SCHATTR_DATADESCR_SHOW_SYM ); + if( eState1 == SFX_ITEM_DEFAULT && + eState2 == SFX_ITEM_DEFAULT ) + return beans::PropertyState_DEFAULT_VALUE; + else if( eState1 < SFX_ITEM_DEFAULT && + eState2 < SFX_ITEM_DEFAULT ) + return beans::PropertyState_AMBIGUOUS_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } + else if( pMap->nWID == OWN_ATTR_FILLBMP_MODE ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + XATTR_FILLBMP_STRETCH, XATTR_FILLBMP_STRETCH, + XATTR_FILLBMP_TILE, XATTR_FILLBMP_TILE, 0 ); + aSet.Put( mpModel->GetDataRowAttr( mnRow )); + + if( aSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET || + aSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET ) + return beans::PropertyState_DIRECT_VALUE; + else + return beans::PropertyState_DEFAULT_VALUE; + } + else + { + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + aSet.Put( mpModel->GetDataRowAttr( mnRow )); + + SfxItemState eState = aSet.GetItemState( pMap->nWID ); + if( eState == SFX_ITEM_DEFAULT ) + return beans::PropertyState_DEFAULT_VALUE; + else if( eState < SFX_ITEM_DEFAULT ) + return beans::PropertyState_AMBIGUOUS_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } + } + + return beans::PropertyState_DIRECT_VALUE; +} + +uno::Sequence< beans::PropertyState > SAL_CALL ChXDataRow::getPropertyStates( + const uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw( beans::UnknownPropertyException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const sal_Int32 nCount = aPropertyName.getLength(); + const ::rtl::OUString* pNames = aPropertyName.getConstArray(); + + uno::Sequence< beans::PropertyState > aRet( nCount ); + beans::PropertyState* pState = aRet.getArray(); + + for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ ) + pState[ nIdx ] = getPropertyState( pNames[ nIdx ] ); + + return aRet; +} + +void SAL_CALL ChXDataRow::setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( mpModel && pMap && pMap->nWID ) + { + if( pMap->nWID == SCHATTR_DATADESCR_DESCR ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + + aSet.ClearItem( SCHATTR_DATADESCR_DESCR ); + aSet.ClearItem( SCHATTR_DATADESCR_SHOW_SYM ); + mpModel->PutDataRowAttr( mnRow, aSet ); + } + else + { + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + + aSet.ClearItem( pMap->nWID ); + mpModel->PutDataRowAttr( mnRow, aSet ); + } + } +} + +uno::Any SAL_CALL ChXDataRow::getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + uno::Any aAny; + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( mpModel && ! mpModel->GetItemPool().IsWhich( pMap->nWID )) + throw beans::UnknownPropertyException(); + + if( mpModel && pMap && pMap->nWID ) + { + if( pMap->nWID == CHATTR_PIE_SEGMENT_OFFSET ) + { + aAny <<= (sal_Int32)0; + } + else if( pMap->nWID == SCHATTR_DATADESCR_DESCR ) + { + SfxItemSet aSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + + aSet.Put( mpModel->GetItemPool().GetDefaultItem( SCHATTR_DATADESCR_DESCR )); + aSet.Put( mpModel->GetItemPool().GetDefaultItem( SCHATTR_DATADESCR_SHOW_SYM )); + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + else + { + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + aSet.Put( mpModel->GetItemPool().GetDefaultItem( pMap->nWID )); + aAny = maPropSet.getPropertyValue( pMap, aSet ); + } + + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_Int16 >( nValue ); + } + else + { + DBG_ERROR( "getPropertyDefault(): wrong Type!" ); + } + } + } + + return aAny; +} + +// XShapeDescriptor +::rtl::OUString SAL_CALL ChXDataRow::getShapeType() throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "com.sun.star.chart.ChartDataRow" ); +} + +// XServiceInfo +::rtl::OUString SAL_CALL ChXDataRow::getImplementationName() throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXDataRow" ); +} + +sal_Bool SAL_CALL ChXDataRow::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXDataRow::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSeq; + SvxServiceInfoHelper::addToSequence( + aSeq, 7, + "com.sun.star.chart.ChartDataPointProperties", + "com.sun.star.chart.ChartDataRowProperties", + "com.sun.star.chart.ChartStatistics", + "com.sun.star.drawing.LineProperties", + "com.sun.star.drawing.FillProperties", + "com.sun.star.style.CharacterProperties", + "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + if( mpModel && mpModel->Is3DChart() ) + { + long nType = mpModel->GetBaseType(); + if( nType == CHTYPE_BAR || nType == CHTYPE_COLUMN ) + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.Chart3DBarProperties" ); + } + + return aSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChXDataRow::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return 0; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChXDiagram.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChXDiagram.cxx new file mode 100644 index 000000000000..946386e66436 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChXDiagram.cxx @@ -0,0 +1,2145 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> + +#include "schattr.hxx" +#ifndef _SVX_BRSHITEM_HXX +#define ITEMID_BRUSH SCHATTR_SYMBOL_BRUSH +#include <bf_svx/brshitem.hxx> +#endif +// header for CreateGraphicObjectFromURL +#include <bf_svx/unoapi.hxx> +// header for SvxChartDataDescrItem +#ifndef _SVX_CHRTITEM_HXX +#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR + +#include <bf_svtools/eitem.hxx> + +#endif + +#include "ChXDiagram.hxx" +#include "ChXChartAxis.hxx" +#include "ChXDataRow.hxx" +#include "ChXDataPoint.hxx" +#include "ChartTitle.hxx" +#include "ChartLine.hxx" +#include "ChartArea.hxx" +#include "ChartGrid.hxx" + +#include "mapprov.hxx" + +#include "schattr.hxx" +#include "charttyp.hxx" +#include "chtscene.hxx" +#include "docshell.hxx" + +#include <bf_svx/unoshape.hxx> +// for OWN_ATTR_... +#include <bf_svx/unoshprp.hxx> +// for SID_ATTR_... +#include <bf_svx/svxids.hrc> +#include <rtl/uuid.h> +#include <rtl/memory.h> +// header for any2enum +#include <comphelper/extract.hxx> + +#include <com/sun/star/chart/ChartDataRowSource.hpp> +#include <com/sun/star/chart/ChartErrorCategory.hpp> +#include <com/sun/star/chart/ChartErrorIndicatorType.hpp> +#include <com/sun/star/chart/ChartRegressionCurveType.hpp> +#include <com/sun/star/chart/ChartDataCaption.hpp> + +#include <rtl/logfile.hxx> + +#include "pairs.hxx" +#include "unonames.hxx" + +namespace +{ +::binfilter::ChartScene * lcl_GetScene( ::binfilter::ChartModel * pModel ) +{ + ::binfilter::ChartScene * pScene = NULL; + + if( pModel && pModel->IsReal3D() ) + { + if( ! pModel->IsInitialized()) + pModel->Initialize(); + pScene = pModel->GetScene(); + } + + return pScene; +} +} // anonymous namespace + + +namespace binfilter { + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; + +using rtl::OUString; + +extern SchUnoPropertyMapProvider aSchMapProvider; + +#if defined(MACOSX) && ( __GNUC__ < 3 ) +static cppu::ClassData14 cppu::ImplHelper14::s_aCD; +static cppu::ClassData14 cppu::WeakImplHelper14::s_aCD; +#endif + +#define MATRIX4D_TO_HOMOGEN_MATRIX( m, h ) \ + h.Line1.Column1 = m[0][0]; \ + h.Line1.Column2 = m[0][1]; \ + h.Line1.Column3 = m[0][2]; \ + h.Line1.Column4 = m[0][3]; \ + h.Line2.Column1 = m[1][0]; \ + h.Line2.Column2 = m[1][1]; \ + h.Line2.Column3 = m[1][2]; \ + h.Line2.Column4 = m[1][3]; \ + h.Line3.Column1 = m[2][0]; \ + h.Line3.Column2 = m[2][1]; \ + h.Line3.Column3 = m[2][2]; \ + h.Line3.Column4 = m[2][3]; \ + h.Line4.Column1 = m[3][0]; \ + h.Line4.Column2 = m[3][1]; \ + h.Line4.Column3 = m[3][2]; \ + h.Line4.Column4 = m[3][3] + +#define HOMOGEN_MATRIX_TO_MATRIX4D( h, m ) \ + m[0][0] = h.Line1.Column1; \ + m[0][1] = h.Line1.Column2; \ + m[0][2] = h.Line1.Column3; \ + m[0][3] = h.Line1.Column4; \ + m[1][0] = h.Line2.Column1; \ + m[1][1] = h.Line2.Column2; \ + m[1][2] = h.Line2.Column3; \ + m[1][3] = h.Line2.Column4; \ + m[2][0] = h.Line3.Column1; \ + m[2][1] = h.Line3.Column2; \ + m[2][2] = h.Line3.Column3; \ + m[2][3] = h.Line3.Column4; \ + m[3][0] = h.Line4.Column1; \ + m[3][1] = h.Line4.Column2; \ + m[3][2] = h.Line4.Column3; \ + m[3][3] = h.Line4.Column4 + +#define CALL(object,interface,method) {uno::Reference<interface>x(object,uno::UNO_QUERY); if(x.is())x.method();} +#define CALL1(object,interface,method,arg1) {uno::Reference<interface>x(object,uno::UNO_QUERY); if(x.is())x.method(arg1);} + +inline void add_listener (uno::Reference<uno::XInterface> xObject, ChXDiagram * p) +{ + if ( ! xObject.is()) + return; + uno::Reference<lang::XComponent> xComponent (xObject, uno::UNO_QUERY); + if (xComponent.is()) + xComponent->addEventListener (p); +} + +ChXDiagram::ChXDiagram( SchChartDocShell* pDocShell, sal_Bool bPreInit ) : + mpModel( NULL ), + maPropSet( aSchMapProvider.GetMap( CHMAP_CHART, NULL )), + mnBaseType( -1 ), + maListenerList (maMutex) +{ + if( bPreInit ) + { + DBG_ASSERT( pDocShell, "Cannot do PreInit when using invalid DocShell." ); + SetDocShell( pDocShell ); + } +} + +ChXDiagram::~ChXDiagram() {} + +// bKeepModel = sal_True => try to keep model. If model is invalid take the one from DocShell +sal_Bool ChXDiagram::SetDocShell( SchChartDocShell* pDocShell, sal_Bool bKeepModel ) throw() +{ + SolarMutexGuard aGuard; + sal_Bool bModelKept = sal_False; + + if( pDocShell ) + { + if( bKeepModel && mpModel ) + { + // copy current model + ChartModel* pModel = SAL_STATIC_CAST( ChartModel*, mpModel->AllocModel()); + if( pModel ) + { + pDocShell->SetModelPtr( pModel ); + if( ! pModel->SetObjectShell( pDocShell )) + { + DBG_ERROR( "Couldn't set docshell" ); + } + + delete mpModel; + mpModel = pModel; + bModelKept = sal_True; + } + } + else + { + // use model of new DocShell + mpModel = pDocShell->GetModelPtr(); + if( ! bKeepModel && mpModel ) + { + maPropSet = SvxItemPropertySet( aSchMapProvider.GetMap( CHMAP_CHART, mpModel )); + maServiceName = getDiagramType(); + } + } + } + else + mpModel = NULL; + + return bModelKept; +} + +// generate a uniqueId +const uno::Sequence< sal_Int8 > & ChXDiagram::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +ChXDiagram* ChXDiagram::getImplementation( uno::Reference< uno::XInterface > xData ) throw() +{ + uno::Reference< lang::XUnoTunnel > xUT( xData, uno::UNO_QUERY ); + if( xUT.is() ) + return (ChXDiagram*)xUT->getSomething( ChXDiagram::getUnoTunnelId() ); + else + return NULL; +} + +uno::Any ChXDiagram::GetAnyByItem( SfxItemSet& aSet, const SfxItemPropertyMap* pMap ) +{ + DBG_ASSERT( pMap, "GetAnyByItem: invalid Map!" ); + DBG_ASSERT( mpModel, "GetAnyByItem: invalid Model!" ); + + uno::Any aAny; + + switch( pMap->nWID ) + { + case CHATTR_DATA_SWITCH: // BM: SwitchData is enum now + { + sal_Bool bIsOn = SAL_STATIC_CAST( const SfxBoolItem&, aSet.Get( CHATTR_DATA_SWITCH ) ).GetValue(); + chart::ChartDataRowSource eRowSource = + bIsOn ? chart::ChartDataRowSource_COLUMNS : chart::ChartDataRowSource_ROWS; + aAny <<= eRowSource; + } + break; + + case SCHATTR_STYLE_SHAPE: + aAny <<= SAL_STATIC_CAST( sal_Int32, mpModel->GetChartShapeType() ); + break; + + case SCHATTR_DATADESCR_DESCR: + { + BOOL bShowSymbol = ((const SfxBoolItem&) + (aSet.Get(SCHATTR_DATADESCR_SHOW_SYM))).GetValue(); + SvxChartDataDescr eDescr = ((const SvxChartDataDescrItem&) + (aSet.Get(SCHATTR_DATADESCR_DESCR))).GetValue(); + + sal_Int32 nVal = 0; + switch( eDescr ) + { + case CHDESCR_NONE: + nVal = chart::ChartDataCaption::NONE; + break; + case CHDESCR_VALUE: + nVal = chart::ChartDataCaption::VALUE; + break; + case CHDESCR_PERCENT: + nVal = chart::ChartDataCaption::PERCENT; + break; + case CHDESCR_TEXT: + nVal = chart::ChartDataCaption::TEXT; + break; + case CHDESCR_TEXTANDPERCENT: + nVal = chart::ChartDataCaption::PERCENT | chart::ChartDataCaption::TEXT; + break; + case CHDESCR_TEXTANDVALUE: + nVal = chart::ChartDataCaption::VALUE | chart::ChartDataCaption::TEXT; + } + if( bShowSymbol ) nVal |= chart::ChartDataCaption::SYMBOL; + + aAny <<= nVal; + } + break; + + case SCHATTR_SYMBOL_BRUSH: + { + ::rtl::OUString aURL; + const BfGraphicObject* pGraphObj = + ((const SvxBrushItem &)(aSet.Get( SCHATTR_SYMBOL_BRUSH ))).GetGraphicObject(); + if( pGraphObj ) + { + aURL = ::rtl::OUString::createFromAscii( UNO_NAME_GRAPHOBJ_URLPREFIX ); + aURL += ::rtl::OUString::createFromAscii( pGraphObj->GetUniqueID().GetBuffer()); + } + aAny <<= aURL; + } + break; + + default: + aAny = maPropSet.getPropertyValue( pMap, aSet ); + + if( *pMap->pType != aAny.getValueType() ) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + if( ( *pMap->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_Int16 >( nValue ); + } + else if( ( *pMap->pType == ::getCppuType((const sal_uInt16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) + { + sal_Int32 nValue; + aAny >>= nValue; + aAny <<= static_cast< sal_uInt16 >( nValue ); + } + else + { + OSL_TRACE( "GetAnyByItem(): wrong Type!" ); + DBG_ERROR( "GetAnyByItem(): wrong Type!" ); + } + } + } + return aAny; +} + +// XDiagram +::rtl::OUString SAL_CALL ChXDiagram::getDiagramType() throw( uno::RuntimeException ) +{ + if( maServiceName.getLength() && + mpModel && + mnBaseType == mpModel->GetBaseType() ) + { + return maServiceName; + } + + SolarMutexGuard aGuard; + + if( mpModel ) + { + mnBaseType = mpModel->GetBaseType(); + switch( mnBaseType ) + { + case CHTYPE_LINE: + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_LINE )); + break; + case CHTYPE_AREA: + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_AREA )); + break; + case CHTYPE_DONUT : + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_DONUT )); + break; + case CHTYPE_COLUMN: // is also treated as (vertical) bar chart + case CHTYPE_BAR : + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_BAR )); + break; + case CHTYPE_CIRCLE : + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_PIE )); + break; + case CHTYPE_XY : + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_XY )); + break; + case CHTYPE_NET : + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_NET )); + break; + case CHTYPE_STOCK : + maServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SCH_X_STR_CHTYPE_NAMESPACE SCH_X_STR_CHTYPE_STOCK )); + break; + case CHTYPE_ADDIN : + // when we get here we know that maServiceName.getLength() == 0 + DBG_ERROR( "Addin with empty name !" ); + break; + } + return maServiceName; + } + else + { + DBG_ERROR( "No Model" ); + } + return SCH_ASCII_TO_OU( "UnknownChartType" ); +} + +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getDataRowProperties( sal_Int32 Row ) + throw( uno::RuntimeException, lang::IndexOutOfBoundsException ) +{ + SolarMutexGuard aGuard; + + if( mpModel ) + { + if( Row >= 0 && + Row < mpModel->GetRowCount() ) + { + ChXDataRow* pRet = new ChXDataRow( Row, mpModel ); + return uno::Reference< beans::XPropertySet >( SAL_STATIC_CAST( beans::XPropertySet*, pRet )); + } + else + { + ::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "DataRowProperties: Invalid Index " )); + aMessage += ::rtl::OUString::valueOf( Row ); + lang::IndexOutOfBoundsException aEx( aMessage, (::cppu::OWeakObject*)this ); + throw aEx; + } + } + else + { + DBG_ERROR( "No Model" ); + } + + return uno::Reference< beans::XPropertySet >(); +} + +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getDataPointProperties( sal_Int32 Column, sal_Int32 Row ) + throw( uno::RuntimeException, lang::IndexOutOfBoundsException ) +{ + SolarMutexGuard aGuard; + + if( mpModel ) + { + if( Row >= 0 && Column >= 0 && + (Row < mpModel->GetRowCount()) && + (Column < mpModel->GetColCount()) ) + { + ChXDataPoint* pRet = new ChXDataPoint( Column, Row, mpModel ); + return uno::Reference< beans::XPropertySet >( SAL_STATIC_CAST( beans::XPropertySet*, pRet )); + } + else + { + ::rtl::OUString aMessage( RTL_CONSTASCII_USTRINGPARAM( "DataPointProperties: Invalid Index (col, row): " )); + aMessage += ::rtl::OUString::valueOf( Column ); + aMessage += ::rtl::OUString::createFromAscii( ", " ); + aMessage += ::rtl::OUString::valueOf( Row ); + lang::IndexOutOfBoundsException aEx( aMessage, (::cppu::OWeakObject*)this ); + throw aEx; + } + } + else + { + DBG_ERROR( "No Model" ); + } + + return uno::Reference< beans::XPropertySet >(); +} + +// XShape ( ::XDiagram) +awt::Size SAL_CALL ChXDiagram::getSize() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + if( mpModel ) + { + Size aSize = mpModel->GetChartRect().GetSize(); + return awt::Size( aSize.Width(), aSize.Height() ); + } + else + return awt::Size( 0, 0 ); +} + +void SAL_CALL ChXDiagram::setSize( const awt::Size& aSize ) + throw( uno::RuntimeException, + beans::PropertyVetoException ) +{ + SolarMutexGuard aGuard; + if( mpModel ) + { + Rectangle aRect = mpModel->GetChartRect(); + Size aOldSize = aRect.GetSize(); + if( aOldSize.Width() != aSize.Width || + aOldSize.Height() != aSize.Height ) + { + mpModel->SetUseRelativePositions( TRUE ); + mpModel->SetDiagramHasBeenMovedOrResized( TRUE ); + aRect.SetSize( Size( aSize.Width, aSize.Height ) ); + mpModel->SetChartRect( aRect ); + mpModel->BuildChart( FALSE ); + } + } + else + { + DBG_ERROR( "No Model" ); + } +} + +awt::Point SAL_CALL ChXDiagram::getPosition() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + if( mpModel ) + { + Point aPoint = mpModel->GetChartRect().TopLeft(); + return awt::Point( aPoint.X(), aPoint.Y() ); + } + else + { + DBG_ERROR( "No Model" ); + } + return awt::Point( 0, 0 ); +} + +void SAL_CALL ChXDiagram::setPosition( const awt::Point& aPosition ) throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + if( mpModel ) + { + Rectangle aRect=mpModel->GetChartRect(); + Point aUpperLeft = aRect.TopLeft(); + if( aUpperLeft.X() != aPosition.X || + aUpperLeft.Y() != aPosition.Y ) + { + mpModel->SetUseRelativePositions( TRUE ); + mpModel->SetDiagramHasBeenMovedOrResized( TRUE ); + aRect.SetPos( Point( aPosition.X, aPosition.Y ) ); + mpModel->SetChartRect( aRect ); + mpModel->BuildChart( FALSE ); + } + } + else + { + DBG_ERROR( "No Model" ); + } +} + +// XShapeDescriptor ( ::XShape ::XDiagram ) +::rtl::OUString SAL_CALL ChXDiagram::getShapeType() throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "com.sun.star.chart.Diagram" ); +} + +// XAxisXSupplier, XAxisYSupplier, XAxisZSupplier, +// XTwoAxisXSupplier, XTwoAxisYSupplier +uno::Reference< drawing::XShape > SAL_CALL ChXDiagram::getXAxisTitle() + throw( uno::RuntimeException ) +{ + if( ! mxXAxisTitle.is()) + { + mxXAxisTitle = new ChartTitle( mpModel, CHOBJID_DIAGRAM_TITLE_X_AXIS ); + add_listener (mxXAxisTitle, this); + } + + return mxXAxisTitle; +} + +uno::Reference< drawing::XShape > SAL_CALL ChXDiagram::getYAxisTitle() + throw( uno::RuntimeException ) +{ + if( ! mxYAxisTitle.is()) + { + mxYAxisTitle = new ChartTitle( mpModel, CHOBJID_DIAGRAM_TITLE_Y_AXIS ); + add_listener (mxYAxisTitle, this); + } + + return mxYAxisTitle; +} + +uno::Reference< drawing::XShape > SAL_CALL ChXDiagram::getZAxisTitle() + throw( uno::RuntimeException ) +{ + if( ! mxZAxisTitle.is()) + { + mxZAxisTitle = new ChartTitle( mpModel, CHOBJID_DIAGRAM_TITLE_Z_AXIS ); + add_listener (mxZAxisTitle, this); + } + + return mxZAxisTitle; +} + +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getXAxis() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxXAxis.is()) + { + mxXAxis = new ChXChartAxis( mpModel, CHOBJID_DIAGRAM_X_AXIS ); + add_listener (mxXAxis, this); + } + + return mxXAxis; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getYAxis() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxYAxis.is()) + { + mxYAxis = new ChXChartAxis( mpModel, CHOBJID_DIAGRAM_Y_AXIS ); + add_listener (mxYAxis, this); + } + + return mxYAxis; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getZAxis() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxZAxis.is()) + { + mxZAxis = new ChXChartAxis( mpModel, CHOBJID_DIAGRAM_Z_AXIS ); + add_listener (mxZAxis, this); + } + + return mxZAxis; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getSecondaryXAxis() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxSecXAxis.is()) + { + mxSecXAxis = new ChXChartAxis( mpModel, CHOBJID_DIAGRAM_A_AXIS ); + add_listener (mxSecXAxis, this); + } + + return mxSecXAxis; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getSecondaryYAxis() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxSecYAxis.is()) + { + mxSecYAxis = new ChXChartAxis( mpModel, CHOBJID_DIAGRAM_B_AXIS ); + add_listener (mxSecYAxis, this); + } + + return mxSecYAxis; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getXMainGrid() throw( ::com::sun::star::uno::RuntimeException ) +{ + // attention: x and y grids are interchanged + if( ! mxMajorGridX.is()) + { + mxMajorGridX = new ChartGrid( mpModel, CHOBJID_DIAGRAM_Y_GRID_MAIN_GROUP ); + add_listener (mxMajorGridX, this); + } + + return mxMajorGridX; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getYMainGrid() throw( ::com::sun::star::uno::RuntimeException ) +{ + // attention: x and y grids are interchanged + if( ! mxMajorGridY.is()) + { + mxMajorGridY = new ChartGrid( mpModel, CHOBJID_DIAGRAM_X_GRID_MAIN_GROUP ); + add_listener (mxMajorGridY, this); + } + + return mxMajorGridY; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getZMainGrid() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxMajorGridZ.is()) + { + mxMajorGridZ = new ChartGrid( mpModel, CHOBJID_DIAGRAM_Z_GRID_MAIN_GROUP ); + add_listener (mxMajorGridZ, this); + } + + return mxMajorGridZ; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getXHelpGrid() throw( ::com::sun::star::uno::RuntimeException ) +{ + // attention: x and y grids are interchanged + if( ! mxMinorGridX.is()) + { + mxMinorGridX = new ChartGrid( mpModel, CHOBJID_DIAGRAM_Y_GRID_HELP_GROUP ); + add_listener (mxMinorGridX, this); + } + + return mxMinorGridX; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getYHelpGrid() throw( ::com::sun::star::uno::RuntimeException ) +{ + // attention: x and y grids are interchanged + if( ! mxMinorGridY.is()) + { + mxMinorGridY = new ChartGrid( mpModel, CHOBJID_DIAGRAM_X_GRID_HELP_GROUP ); + add_listener (mxMinorGridY, this); + } + + return mxMinorGridY; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getZHelpGrid() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxMinorGridZ.is()) + { + mxMinorGridZ = new ChartGrid( mpModel, CHOBJID_DIAGRAM_Z_GRID_HELP_GROUP ); + add_listener (mxMinorGridZ, this); + } + + return mxMinorGridZ; +} + +// XStatisticDisplay +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getMinMaxLine() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxMinMaxLine.is()) + { + mxMinMaxLine = new ChartLine( mpModel, CHOBJID_DIAGRAM_STOCKLINE_GROUP ); + add_listener (mxMinMaxLine, this); + } + + return mxMinMaxLine; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getUpBar() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxUpBar.is()) + { + mxUpBar = new ChartArea( mpModel, CHOBJID_DIAGRAM_STOCKPLUS_GROUP ); + add_listener (mxUpBar, this); + } + + return mxUpBar; +} +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getDownBar() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxDownBar.is()) + { + mxDownBar = new ChartArea( mpModel, CHOBJID_DIAGRAM_STOCKLOSS_GROUP ); + add_listener (mxDownBar, this); + } + + return mxDownBar; +} + +// X3DDisplay +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getFloor() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxFloor.is()) + { + mxFloor = new ChartArea( mpModel, CHOBJID_DIAGRAM_FLOOR ); + add_listener (mxFloor, this); + } + + return mxFloor; +} +// note: this method is also valid for 2d charts +uno::Reference< beans::XPropertySet > SAL_CALL ChXDiagram::getWall() throw( ::com::sun::star::uno::RuntimeException ) +{ + if( ! mxWall.is()) + { + mxWall = new ChartArea( mpModel, CHOBJID_DIAGRAM_WALL ); + add_listener (mxWall, this); + } + + return mxWall; +} + + +// XPropertySet +uno::Reference< beans::XPropertySetInfo > SAL_CALL ChXDiagram::getPropertySetInfo() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + return maPropSet.getPropertySetInfo(); +} + +// needed for camera geometry +struct ImpRememberTransAndRect +{ + Matrix4D maMat; + Rectangle maRect; +}; + +void SAL_CALL ChXDiagram::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) + throw( beans::UnknownPropertyException, + beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + if( mpModel ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( pMap && pMap->nWID ) + { + if( pMap->nFlags & PropertyAttribute::READONLY ) + throw PropertyVetoException(); + + USHORT nWID = pMap->nWID; + sal_Int32 nVal; + + SfxItemSet* pSet; + switch( nWID ) + { + case SCHATTR_DATADESCR_DESCR: + case SCHATTR_DATADESCR_SHOW_SYM: + // the Property DataCaption needs two Which Ids + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + break; + + case CHATTR_NUM_OF_LINES_FOR_BAR: + { + aValue >>= nVal; + if( mpModel->GetBaseType() == CHTYPE_COLUMN ) + mpModel->SetNumLinesColChart( nVal, TRUE ); + mpModel->BuildChart( FALSE ); + return; // RETURN + } + + case CHATTR_SPLINE_ORDER: + { + aValue >>= nVal; + // for some reason the value internally is one more + // ie order 1 is linear but is stores as 2 in the core + ++nVal; + mpModel->SplineDepth() = nVal; + if( mpModel->IsSplineChart()) + mpModel->BuildChart( FALSE ); + return; // RETURN + } + + case CHATTR_SPLINE_RESOLUTION: + { + aValue >>= nVal; + mpModel->Granularity() = nVal; + if( mpModel->IsSplineChart()) + mpModel->BuildChart( FALSE ); + return; // RETURN + } + + case SCHATTR_STYLE_STACKED: + case SCHATTR_STYLE_PERCENT: + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_STYLE_STACKED, SCHATTR_STYLE_STACKED, + SCHATTR_STYLE_PERCENT, SCHATTR_STYLE_PERCENT, 0 ); + break; + + case SCHATTR_STYLE_DEEP: + // deep implies 3d + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_STYLE_DEEP, SCHATTR_STYLE_DEEP, + SCHATTR_STYLE_3D, SCHATTR_STYLE_3D, 0 ); + break; + + case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX: + { + E3dObject* pScene = lcl_GetScene( mpModel ); + + if( pScene ) + { + drawing::HomogenMatrix xHomMatrix; + aValue >>= xHomMatrix; + Matrix4D aMtx; + HOMOGEN_MATRIX_TO_MATRIX4D( xHomMatrix, aMtx ); + pScene->SetTransform( aMtx ); + } + return; // RETURN + } + + case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY: + { + E3dScene* pScene = lcl_GetScene( mpModel ); + + if( pScene ) + { + drawing::CameraGeometry aCamGeo; + + if(aValue >>= aCamGeo) + { + Vector3D aVRP(aCamGeo.vrp.PositionX, aCamGeo.vrp.PositionY, aCamGeo.vrp.PositionZ); + Vector3D aVPN(aCamGeo.vpn.DirectionX, aCamGeo.vpn.DirectionY, aCamGeo.vpn.DirectionZ); + Vector3D aVUP(aCamGeo.vup.DirectionX, aCamGeo.vup.DirectionY, aCamGeo.vup.DirectionZ); + + // rescue scene transformation + ImpRememberTransAndRect aSceneTAR; + aSceneTAR.maMat = pScene->GetTransform(); + aSceneTAR.maRect = pScene->GetSnapRect(); + +// // rescue object transformations +// SdrObjListIter aIter(*pScene->GetSubList(), IM_DEEPWITHGROUPS); +// List aObjTrans; +// while(aIter.IsMore()) +// { +// E3dObject* p3DObj = (E3dObject*)aIter.Next(); +// Matrix4D* pNew = new Matrix4D; +// *pNew = p3DObj->GetTransform(); +// aObjTrans.Insert(pNew, LIST_APPEND); +// } + + // reset object transformations +// aIter.Reset(); +// while(aIter.IsMore()) +// { +// E3dObject* p3DObj = (E3dObject*)aIter.Next(); +// p3DObj->NbcResetTransform(); +// } + + // reset scene transformation and make a complete recalc +// pScene->NbcResetTransform(); + + // fill old camera from new parameters + Camera3D aCam(pScene->GetCamera()); + const Volume3D& rVolume = pScene->GetBoundVolume(); + double fW = rVolume.GetWidth(); + double fH = rVolume.GetHeight(); + double fCamPosZ = + (double)((const SfxUInt32Item&)pScene->GetItem(SDRATTR_3DSCENE_DISTANCE)).GetValue(); + double fCamFocal = + (double)((const SfxUInt32Item&)pScene->GetItem(SDRATTR_3DSCENE_FOCAL_LENGTH)).GetValue(); + + aCam.SetAutoAdjustProjection(FALSE); + aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH); + Vector3D aLookAt; + Vector3D aCamPos(0.0, 0.0, fCamPosZ); + aCam.SetPosAndLookAt(aCamPos, aLookAt); + aCam.SetFocalLength(fCamFocal / 100.0); + aCam.SetDefaults(Vector3D(0.0, 0.0, fCamPosZ), aLookAt, fCamFocal / 100.0); + aCam.SetDeviceWindow(Rectangle(0, 0, (long)fW, (long)fH)); + + // set at scene + pScene->SetCamera(aCam); + + // set object transformations again at objects +// aIter.Reset(); +// sal_uInt32 nIndex(0L); +// while(aIter.IsMore()) +// { +// E3dObject* p3DObj = (E3dObject*)aIter.Next(); +// Matrix4D* pMat = (Matrix4D*)aObjTrans.GetObject(nIndex++); +// p3DObj->NbcSetTransform(*pMat); +// delete pMat; +// } + + // set scene transformation again at scene + pScene->NbcSetTransform(aSceneTAR.maMat); + pScene->FitSnapRectToBoundVol(); + pScene->NbcSetSnapRect(aSceneTAR.maRect); + } + } + return; // RETURN + } + + default: + pSet = new SfxItemSet( mpModel->GetPool(), nWID, nWID ); + } + + // fill item: (should be optimized) + ChartType aType( mpModel ); + aType.GetAttrSet( pSet ); + mpModel->GetAttr( *pSet ); + + if( !pSet->Count() ) + { + // get default from ItemPool + if( mpModel->GetItemPool().IsWhich( nWID ) ) + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( pMap->nWID ) ); + } + else + { +#ifdef DBG_UTIL + String aTmpString( aPropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + if( pSet->Count() ) + { + switch( nWID ) + { + case SCHATTR_STAT_KIND_ERROR: + { + chart::ChartErrorCategory eCat; + cppu::any2enum< chart::ChartErrorCategory >( eCat, aValue ); + pSet->Put( SfxInt32Item( nWID, SAL_STATIC_CAST( sal_Int32, eCat ))); + break; + } + case SCHATTR_STAT_INDICATE: + { + chart::ChartErrorIndicatorType eInd; + cppu::any2enum< chart::ChartErrorIndicatorType >( eInd, aValue ); + pSet->Put( SfxInt32Item( nWID, SAL_STATIC_CAST( sal_Int32, eInd ))); + break; + } + case SCHATTR_STAT_REGRESSTYPE: + { + chart::ChartRegressionCurveType eRegType; + cppu::any2enum< chart::ChartRegressionCurveType >( eRegType, aValue ); + pSet->Put( SfxInt32Item( nWID, SAL_STATIC_CAST( sal_Int32, eRegType ))); + break; + } + case CHATTR_DATA_SWITCH: + { + chart::ChartDataRowSource eRowSource; + cppu::any2enum< chart::ChartDataRowSource >( eRowSource, aValue ); + mpModel->ChangeSwitchData( (chart::ChartDataRowSource_COLUMNS == eRowSource) ); + return; + } + case SCHATTR_DATADESCR_DESCR: + { + // symbol + sal_Int32 nVal; + aValue >>= nVal; + pSet->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYM, + ((nVal & chart::ChartDataCaption::SYMBOL) != 0)) ); + + // display text, percent or both or value + SvxChartDataDescr eDescr = CHDESCR_NONE; + if( nVal & chart::ChartDataCaption::TEXT ) + { + if( nVal & chart::ChartDataCaption::PERCENT ) + eDescr = CHDESCR_TEXTANDPERCENT; + else if( (nVal & chart::ChartDataCaption::VALUE) ) + eDescr = CHDESCR_TEXTANDVALUE; + else + eDescr = CHDESCR_TEXT; + } + else if( (nVal & chart::ChartDataCaption::VALUE) ) + { + eDescr = CHDESCR_VALUE; + } + else + { + if( (nVal & chart::ChartDataCaption::PERCENT) ) + eDescr = CHDESCR_PERCENT; + } + + // chart::ChartDataCaption::FORMAT (missing) + + pSet->Put( SvxChartDataDescrItem( eDescr ) ); + } + break; + + case XATTR_FILLBITMAP: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_LINEEND: + case XATTR_LINESTART: + case XATTR_LINEDASH: + if( pMap->nMemberId == MID_NAME ) + { + ::rtl::OUString aStr; + if( aValue >>= aStr ) + SvxShape::SetFillAttribute( nWID, aStr, *pSet, mpModel ); + } + else + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + + case SCHATTR_STYLE_STACKED: + case SCHATTR_STYLE_PERCENT: + { + sal_Bool bSet; + aValue >>= bSet; + if( bSet ) + { + // setting of these two items is exclusive + BOOL bStacked = ( nWID == SCHATTR_STYLE_STACKED ); + + pSet->Put( SfxBoolItem( SCHATTR_STYLE_STACKED, bStacked )); + pSet->Put( SfxBoolItem( SCHATTR_STYLE_PERCENT, ! bStacked )); + } + else + { + // setting either of both properties to FALSE + // sets both to FALSE + pSet->Put( SfxBoolItem( SCHATTR_STYLE_STACKED, FALSE )); + pSet->Put( SfxBoolItem( SCHATTR_STYLE_PERCENT, FALSE )); + } + } + break; + + case SCHATTR_STYLE_DEEP: + { + sal_Bool bSet; + aValue >>= bSet; + + // if deep is turned on, 3d must also be set + if( bSet ) + { + pSet->Put( SfxBoolItem( SCHATTR_STYLE_3D, TRUE )); + } + pSet->Put( SfxBoolItem( SCHATTR_STYLE_DEEP, bSet )); + } + break; + + case SCHATTR_SYMBOL_BRUSH: + { + ::rtl::OUString aURL; + aValue >>= aURL; + BfGraphicObject aGraphObj = CreateGraphicObjectFromURL( aURL ); + SvxBrushItem aItem( SCHATTR_SYMBOL_BRUSH ); + aItem.SetGraphic( aGraphObj.GetGraphic() ); + pSet->Put( aItem ); + } + break; + + default: + maPropSet.setPropertyValue( pMap, aValue, *pSet ); + break; + } + aType.SetType( pSet ); + mpModel->PutAttr( *pSet ); + if( nWID == SCHATTR_SYMBOL_SIZE ) + { + mpModel->PutDataRowAttrAll( *pSet ); + } + + if( mpModel->ChangeChart( aType.GetChartStyle(), false )) + { + mpModel->BuildChart( FALSE ); + } + else if( ! mpModel->ChangeStatistics ( *pSet ) ) + { + mpModel->BuildChart( FALSE ); + } + } + else + { + throw beans::UnknownPropertyException(); + } + delete pSet; + } + else + { + throw beans::UnknownPropertyException(); + } + } + else + { + DBG_WARNING( "No Model" ); + } +} + +uno::Any SAL_CALL ChXDiagram::getPropertyValue( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + RTL_LOGFILE_CONTEXT (context, "sch (af119097) ::ChXDiagram::getPropertyValue"); + SolarMutexGuard aGuard; + + uno::Any aAny; + + if( mpModel ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( pMap && pMap->nWID ) + { + USHORT nWID = pMap->nWID; + SfxItemSet* pSet; + + if( nWID == SCHATTR_STYLE_SHAPE && + ! mpModel->IsReal3D()) + return aAny; + + switch( nWID ) + { + case CHATTR_NUM_OF_LINES_FOR_BAR: + aAny <<= SAL_STATIC_CAST( sal_Int32, mpModel->GetNumLinesColChart() ); + return aAny; // RETURN + + case SCHATTR_DATADESCR_DESCR: + pSet = new SfxItemSet( mpModel->GetItemPool(), + SCHATTR_DATADESCR_DESCR, SCHATTR_DATADESCR_DESCR, + SCHATTR_DATADESCR_SHOW_SYM, SCHATTR_DATADESCR_SHOW_SYM, 0 ); + break; + + case CHATTR_SPLINE_ORDER: + // for some reason the value internally is one more + // ie order 1 is linear but is stores as 2 in the core + aAny <<= static_cast< sal_Int32 >( mpModel->SplineDepth() - 1 ); + return aAny; + + case CHATTR_SPLINE_RESOLUTION: + aAny <<= static_cast< sal_Int32 >( mpModel->Granularity() ); + return aAny; + + case CHATTR_ATTRIBUTED_DATA_POINTS: + aAny <<= mpModel->GetSetDataPointList(); + return aAny; + + default: + pSet = new SfxItemSet( mpModel->GetItemPool(), nWID, nWID ); + } + + // set attributes + if( nWID == SCHATTR_SYMBOL_BRUSH || + nWID == SCHATTR_SYMBOL_SIZE ) + { + mpModel->GetDataRowAttrAll( *pSet ); + } + else + { + ChartType aType( mpModel ); + aType.GetAttrSet( pSet ); + mpModel->GetAttr( *pSet ); // copy SHOW_HIDE_PROPERTIES into ItemSet + } + + if( ! pSet->Count() ) + { + // get default from ItemPool + if( mpModel->GetItemPool().IsWhich( nWID ) ) + { + if( ! ( OWN_ATTR_VALUE_START <= nWID && nWID <= OWN_ATTR_VALUE_END )) // properties from SvxShape + { + pSet->Put( mpModel->GetItemPool().GetDefaultItem( nWID ) ); + } + // 3d properties that have no corresponding item but come from drawing layer + else + { + //E3dPolyScene* mpModel->GetScene(); + E3dObject* pScene = lcl_GetScene( mpModel ); + if( pScene ) + { + if( nWID == OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX ) + { + const Matrix4D& aMtx = pScene->GetFullTransform(); + drawing::HomogenMatrix xHomMatrix; + MATRIX4D_TO_HOMOGEN_MATRIX( aMtx, xHomMatrix ); + aAny <<= xHomMatrix; + + return aAny; // RETURN + } + else if( nWID == OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY ) + { + // get CameraGeometry from scene + E3dScene* pE3dScene = mpModel->GetScene(); + drawing::CameraGeometry aCamGeo; + + // fill Vectors from scene camera + B3dCamera& aCameraSet = pE3dScene->GetCameraSet(); + Vector3D aVRP = aCameraSet.GetVRP(); + Vector3D aVPN = aCameraSet.GetVPN(); + Vector3D aVUP = aCameraSet.GetVUV(); + + // transfer to structure + aCamGeo.vrp.PositionX = aVRP.X(); + aCamGeo.vrp.PositionY = aVRP.Y(); + aCamGeo.vrp.PositionZ = aVRP.Z(); + aCamGeo.vpn.DirectionX = aVPN.X(); + aCamGeo.vpn.DirectionY = aVPN.Y(); + aCamGeo.vpn.DirectionZ = aVPN.Z(); + aCamGeo.vup.DirectionX = aVUP.X(); + aCamGeo.vup.DirectionY = aVUP.Y(); + aCamGeo.vup.DirectionZ = aVUP.Z(); + + return uno::Any(&aCamGeo, ::getCppuType((const drawing::CameraGeometry*)0) ); + } + } + } + } + else + { +#ifdef DBG_UTIL + String aTmpString( PropertyName ); + ByteString aProp( aTmpString, RTL_TEXTENCODING_ASCII_US ); + DBG_ERROR2( "Diagram: Property %s has an invalid ID (%d)", aProp.GetBuffer(), nWID ); +#endif + } + } + + if( pSet->Count() ) + { + aAny = GetAnyByItem( *pSet, pMap ); + } + else + throw beans::UnknownPropertyException(); + + delete pSet; + } + else + throw beans::UnknownPropertyException(); + } + else + { + DBG_ERROR( "No Model" ); + } + return aAny; +} + +void SAL_CALL ChXDiagram::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& xListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDiagram::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const uno::Reference< beans::XPropertyChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDiagram::addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + +void SAL_CALL ChXDiagram::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const uno::Reference< beans::XVetoableChangeListener >& aListener ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{} + + +//===== XMultiPropertySet =================================================== + +void SAL_CALL ChXDiagram::setPropertyValues ( + const Sequence< ::rtl::OUString >& aPropertyNames, + const Sequence<Any >& aValues) + throw (beans::PropertyVetoException, + lang::IllegalArgumentException, + lang::WrappedTargetException, + uno::RuntimeException) +{ + RTL_LOGFILE_CONTEXT (context2, "sch (af119097) ::ChXDiagram::setPropertyValues"); +#if 1 + for (sal_Int32 i=0; i<aPropertyNames.getLength(); i++) + setPropertyValue (aPropertyNames[i], aValues[i]); +#endif +} + + +Sequence<Any> SAL_CALL ChXDiagram::getPropertyValues ( + const Sequence<OUString>& aPropertyNames) + throw (RuntimeException) +{ + RTL_LOGFILE_CONTEXT (context, "sch (af119097) ::ChXDiagram::getPropertyValues"); +#if 0 + uno::Sequence<uno::Any> aResult (aPropertyNames.getLength()); + + for (sal_Int32 i=0; i<aPropertyNames.getLength(); i++) + aResult[i] = getPropertyValue (aPropertyNames[i]); + + return aResult; +#else + SolarMutexGuard aGuard; + + // This sequence is filled with the requested values for the given property names. + Sequence<Any> aResult (aPropertyNames.getLength()); + + // Get pointers to first elements of lists. + const SfxItemPropertyMap * pProperty = maPropSet.getPropertyMap (); + const OUString * pPropertyName = aPropertyNames.getConstArray (); + Any * pPropertyValue = aResult.getArray (); + + // Check preconditions. + if (mpModel == NULL) + throw UnknownPropertyException (OUString ( + RTL_CONSTASCII_USTRINGPARAM ("No model in ::ChXDiagram::getPropertyValues")), + static_cast< ::cppu::OWeakObject*>(this)); + + // Get the models attributes. + SfxItemSet aAttributes (mpModel->GetItemPool(), + CHART_ROW_WHICHPAIRS, + OWN_ATTR_VALUE_START, OWN_ATTR_VALUE_END, + OWN_ATTR_FILLBMP_MODE, OWN_ATTR_FILLBMP_MODE, + SCHATTR_STOCK_VOLUME, SCHATTR_STOCK_UPDOWN, + CHATTR_START, CHATTR_END, + CHATTR_TMP_START, CHATTR_TMP_END, + 0); + + // if( nWID == SCHATTR_SYMBOL_BRUSH ) + mpModel->GetDataRowAttrAll (aAttributes); + // else + ChartType aType (mpModel); + aType.GetAttrSet (&aAttributes); + mpModel->GetAttr (aAttributes); + + // Used in the loop below. + USHORT nWID; + E3dObject* pScene = NULL; + BOOL bTryAgain; + OUString sMessage; + + // Iterate over all given property names. + sal_Int32 nCounter = aPropertyNames.getLength(); + while (nCounter-- > 0) + { + AdvanceToName (pProperty, pPropertyName); + + nWID = pProperty->nWID; + bTryAgain = TRUE; + + // Handling each property is divided into three steps: + // 1. Handle special cases that do not depend on items. + // 2. If the required item is not set, then try to get a + // default value. Handle 3D properties here. + // 3. Try again if the item is now set in the hope that its + // status has been changed in step 2. + + // Step 1 + if (nWID == SCHATTR_STYLE_SHAPE && ! mpModel->IsReal3D()) + { + // Leave the property value unchanged. + bTryAgain = FALSE; + } + else if (nWID == CHATTR_NUM_OF_LINES_FOR_BAR) + { + *pPropertyValue <<= static_cast<sal_Int32>(mpModel->GetNumLinesColChart()); + bTryAgain = FALSE; + } + else if( nWID == CHATTR_SPLINE_ORDER ) + { + // for some reason the value internally is one more + // ie order 1 is linear but is stores as 2 in the core + *pPropertyValue <<= static_cast< sal_Int32 >( mpModel->SplineDepth() - 1 ); + bTryAgain = FALSE; + } + else if( nWID == CHATTR_SPLINE_RESOLUTION ) + { + *pPropertyValue <<= static_cast< sal_Int32 >( mpModel->Granularity() ); + bTryAgain = FALSE; + } + + // Step 2 + else if (aAttributes.GetItemState (nWID, sal_False) != SFX_ITEM_SET) + { + bTryAgain = FALSE; + if ( ! mpModel->GetItemPool().IsWhich(nWID)) + { + } + else if (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END) + { + // properties from SvxShape + aAttributes.Put (mpModel->GetItemPool().GetDefaultItem (nWID)); + // Set the flag to try again to read the item. + bTryAgain = TRUE; + } + else + { + if (pScene == NULL) + { + RTL_LOGFILE_CONTEXT_TRACE (context, "getting 3D scene"); + pScene = lcl_GetScene( mpModel ); + } + if (pScene != NULL) + if (nWID == OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX) + { + const Matrix4D& aMtx = pScene->GetFullTransform(); + drawing::HomogenMatrix xHomMatrix; + MATRIX4D_TO_HOMOGEN_MATRIX (aMtx, xHomMatrix); + *pPropertyValue <<= xHomMatrix; + } + else if (nWID == OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY) + { + // get CameraGeometry from scene + E3dScene* pE3dScene = mpModel->GetScene(); + + // fill Vectors from scene camera + B3dCamera& aCameraSet = pE3dScene->GetCameraSet(); + Vector3D aVRP = aCameraSet.GetVRP(); + Vector3D aVPN = aCameraSet.GetVPN(); + Vector3D aVUP = aCameraSet.GetVUV(); + + // transfer to structure + drawing::CameraGeometry aCamGeo; + aCamGeo.vrp.PositionX = aVRP.X(); + aCamGeo.vrp.PositionY = aVRP.Y(); + aCamGeo.vrp.PositionZ = aVRP.Z(); + aCamGeo.vpn.DirectionX = aVPN.X(); + aCamGeo.vpn.DirectionY = aVPN.Y(); + aCamGeo.vpn.DirectionZ = aVPN.Z(); + aCamGeo.vup.DirectionX = aVUP.X(); + aCamGeo.vup.DirectionY = aVUP.Y(); + aCamGeo.vup.DirectionZ = aVUP.Z(); + + *pPropertyValue = + Any (&aCamGeo, ::getCppuType((const drawing::CameraGeometry*)0)); + } + else + bTryAgain = TRUE; + } + } + + // Step3 + if (bTryAgain) + if (aAttributes.GetItemState (nWID, sal_False) == SFX_ITEM_SET) + { + *pPropertyValue = GetAnyByItem (aAttributes, pProperty); + } + else + { + // Construct a message for an exception but wait with throwing + // it until all known properies have been set. + if (sMessage.getLength() == 0) + { + sMessage = OUString (RTL_CONSTASCII_USTRINGPARAM ("Property ")); + sMessage += *pPropertyName; + sMessage += OUString ( + RTL_CONSTASCII_USTRINGPARAM (" is not known in :ChXDiagram::getPropertyValues")); + } +#ifdef DBG_UTIL + ByteString sName = ByteString(String(*pPropertyName), RTL_TEXTENCODING_ASCII_US); + DBG_ERROR2 ("Diagram: Property %s has an invalid ID (%d)", + sName.GetBuffer(), nWID); +#endif + } + +#if 0 + // Compare to result of original getPropertyValue. + // Used only for debugging. + if (*pPropertyValue != getPropertyValue (*pPropertyName)) + { + DBG_ERROR1 ("ChXDiagram::getPropertyValues : values differ for nWID %d", + nWID); + } +#endif + + // Advance to the next property, property name and value. + pPropertyName++; + pPropertyValue++; + } + + // Throw an exception if one of the properties was unknown. + if (sMessage.getLength() > 0) + throw UnknownPropertyException (sMessage, + static_cast< ::cppu::OWeakObject*>(this)); + + return aResult; +#endif +} + + +void SAL_CALL ChXDiagram::addPropertiesChangeListener ( + const Sequence<OUString >& aPropertyNames, + const Reference<beans::XPropertiesChangeListener >& xListener) + throw (RuntimeException) +{ + // Not implemented. +} + +void SAL_CALL ChXDiagram::removePropertiesChangeListener ( + const Reference<beans::XPropertiesChangeListener>& xListener) + throw (RuntimeException) +{ + // Not implemented. +} + + +void SAL_CALL ChXDiagram::firePropertiesChangeEvent ( + const Sequence<OUString >& aPropertyNames, + const Reference<beans::XPropertiesChangeListener >& xListener) + throw (RuntimeException) +{ + // Not implemented. +} + + + + +//===== XPropertyState ====================================================== + +beans::PropertyState SAL_CALL ChXDiagram::getPropertyState( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, uno::RuntimeException ) +{ + if( mpModel ) + { + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( pMap && pMap->nWID ) + { + switch( pMap->nWID ) + { + case SCHATTR_STYLE_PERCENT: + { + ChartType aType( mpModel ); + return ( aType.IsPercent() + ? beans::PropertyState_DIRECT_VALUE + : beans::PropertyState_DEFAULT_VALUE ); + } + break; + case SCHATTR_STYLE_STACKED: + { + ChartType aType( mpModel ); + return ( ( ! aType.IsPercent() && + aType.IsStacked()) + ? beans::PropertyState_DIRECT_VALUE + : beans::PropertyState_DEFAULT_VALUE ); + } + break; + + case CHATTR_SPLINE_ORDER: + case CHATTR_SPLINE_RESOLUTION: + { + ChartType aType( mpModel ); + return ( ( aType.HasSplines() ) + ? beans::PropertyState_DIRECT_VALUE + : beans::PropertyState_DEFAULT_VALUE ); + } + + case CHATTR_NUM_OF_LINES_FOR_BAR: + case SCHATTR_STYLE_SHAPE: + case SCHATTR_DATADESCR_DESCR: + break; + + default: + { + SolarMutexGuard aGuard; + + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + ChartType aType( mpModel ); + aType.GetAttrSet( &aSet ); + mpModel->GetAttr( aSet ); + + SfxItemState eState = aSet.GetItemState( pMap->nWID ); + if( eState == SFX_ITEM_DEFAULT ) + return beans::PropertyState_DEFAULT_VALUE; + else if( eState < SFX_ITEM_DEFAULT ) + return beans::PropertyState_AMBIGUOUS_VALUE; + else + return beans::PropertyState_DIRECT_VALUE; + } + } + } + } + + return beans::PropertyState_DIRECT_VALUE; +} + + +void SAL_CALL ChXDiagram::setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw( beans::UnknownPropertyException, + uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( PropertyName ); + + if( pMap && pMap->nWID && + ( pMap->nWID == CHATTR_NUM_OF_LINES_FOR_BAR || + pMap->nWID == CHATTR_SPLINE_ORDER || + pMap->nWID == CHATTR_SPLINE_RESOLUTION || + pMap->nWID == SCHATTR_STYLE_SHAPE || + pMap->nWID == SCHATTR_DATADESCR_DESCR )) + { + return; + } + + if( mpModel ) + { + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + ChartType aType( mpModel ); + aType.GetAttrSet( &aSet ); + mpModel->GetAttr( aSet ); + + aSet.ClearItem( pMap->nWID ); + + aType.SetType( &aSet ); + mpModel->PutAttr( aSet ); + + if( mpModel->ChangeChart( aType.GetChartStyle(), false )) + { + mpModel->BuildChart( FALSE ); + } + else if( ! mpModel->ChangeStatistics ( aSet ) ) + { + mpModel->BuildChart( FALSE ); + } + } +} + +uno::Any SAL_CALL ChXDiagram::getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw( beans::UnknownPropertyException, + lang::WrappedTargetException, + uno::RuntimeException ) +{ + const SfxItemPropertyMap* pMap = maPropSet.getPropertyMapEntry( aPropertyName ); + + if( pMap && pMap->nWID && + ( pMap->nWID == CHATTR_NUM_OF_LINES_FOR_BAR || + pMap->nWID == CHATTR_SPLINE_ORDER || + pMap->nWID == CHATTR_SPLINE_RESOLUTION || + pMap->nWID == SCHATTR_STYLE_SHAPE || + pMap->nWID == SCHATTR_DATADESCR_DESCR )) + { + return getPropertyValue( aPropertyName ); + } + + if( ! mpModel->GetItemPool().IsWhich( pMap->nWID )) + throw beans::UnknownPropertyException(); + + SfxItemSet aSet( mpModel->GetItemPool(), pMap->nWID, pMap->nWID ); + aSet.Put( mpModel->GetItemPool().GetDefaultItem( pMap->nWID )); + + return GetAnyByItem( aSet, pMap ); +} + + + + +//==== XMultiPropertyStates ================================================= + +Sequence<PropertyState> SAL_CALL ChXDiagram::getPropertyStates ( + const Sequence<OUString >& aPropertyName) + throw (beans::UnknownPropertyException, + uno::RuntimeException) +{ + SolarMutexGuard aGuard; + +#if 0 + // Old implementation. + + const sal_Int32 nCount = aPropertyName.getLength(); + const ::rtl::OUString* pNames = aPropertyName.getConstArray(); + + uno::Sequence< beans::PropertyState > aRet( nCount ); + beans::PropertyState* pState = aRet.getArray(); + + for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ ) + pState[ nIdx ] = getPropertyState( pNames[ nIdx ] ); + + return aRet; + +#else + + // New implementation. + + // Setup arrays of property names and states for easier iteration. + sal_Int32 nPropertyCount = aPropertyName.getLength(); + const OUString* pPropertyName = aPropertyName.getConstArray(); + Sequence<PropertyState> aPropertyStates (nPropertyCount); + PropertyState* pPropertyState = aPropertyStates.getArray(); + const SfxItemPropertyMap * pProperty = maPropSet.getPropertyMap (); + + // Check preconditions. + if (mpModel == NULL) + return aPropertyStates; + + // Get the models attributes. + ChartType aType (mpModel); +// SfxItemSet aAttributes (mpModel->GetItemPool(), +// mpModel->GetAttr (mnWhichId, mnIndex).GetRanges()); + // This needs still a bit of work. What is the best set of which id ranges? + SfxItemSet aAttributes (mpModel->GetItemPool(), + CHART_ROW_WHICHPAIRS, + OWN_ATTR_FILLBMP_MODE, OWN_ATTR_FILLBMP_MODE, // 3945 bf_svx/unoshprp.hxx + 30689,30689, // RID_SCH_START + 177 ? + 30720,30720, // RID_SCH_START + 208 ? + SCHATTR_STOCK_VOLUME, SCHATTR_STOCK_UPDOWN, + 0); + aType.GetAttrSet (&aAttributes); + mpModel->GetAttr (aAttributes); + + // Variable used in the loop below. + USHORT nWID; + // Setting this error message to a non empty string results throwing an exception + // after the main loop has finished. + OUString sErrorMessage; + + // Iterate over all given property names. + while (nPropertyCount-- > 0) + { + AdvanceToName (pProperty, pPropertyName); + + switch (nWID = pProperty->nWID) + { + case SCHATTR_STYLE_PERCENT: + if (aType.IsPercent()) + *pPropertyState = PropertyState_DIRECT_VALUE; + else + *pPropertyState = PropertyState_DEFAULT_VALUE; + break; + + case SCHATTR_STYLE_STACKED: + if (aType.IsStacked() && ! aType.IsPercent()) + *pPropertyState = PropertyState_DIRECT_VALUE; + else + *pPropertyState = PropertyState_DEFAULT_VALUE; + break; + + case CHATTR_SPLINE_ORDER: + case CHATTR_SPLINE_RESOLUTION: + if( aType.HasSplines()) + *pPropertyState = PropertyState_DIRECT_VALUE; + else + *pPropertyState = PropertyState_DEFAULT_VALUE; + break; + + case CHATTR_NUM_OF_LINES_FOR_BAR: + case SCHATTR_STYLE_SHAPE: + case SCHATTR_DATADESCR_DESCR: + *pPropertyState = PropertyState_DIRECT_VALUE; + break; + + default: + switch (aAttributes.GetItemState (nWID, sal_False)) + { + case SFX_ITEM_DONTCARE: + case SFX_ITEM_DISABLED: + *pPropertyState = PropertyState_AMBIGUOUS_VALUE; + break; + + case SFX_ITEM_READONLY: + case SFX_ITEM_SET: + *pPropertyState = PropertyState_DIRECT_VALUE; + break; + + case SFX_ITEM_DEFAULT: + *pPropertyState = PropertyState_DEFAULT_VALUE; + break; + + case SFX_ITEM_UNKNOWN: + default: + // Set the error message so that it can be used + // to create an exception object after the loop + // has finished. + // The exception is not thrown here in order + // to first process as many properties as possible. + // All unknown properties following the first one + // are ignored. + DBG_ERROR1 ("nWID %d not in property set", nWID); + if (sErrorMessage.getLength() == 0) + { + sErrorMessage = OUString ( + RTL_CONSTASCII_USTRINGPARAM ("Chart Object: Unknown Property ")); + sErrorMessage += *pPropertyName; + } + } + } + pPropertyName ++; + pPropertyState ++; + } + + // Now throw an exception if there has been an unknown property. + if (sErrorMessage.getLength() > 0) + throw UnknownPropertyException (sErrorMessage, + static_cast< ::cppu::OWeakObject*>(this)); + + return aPropertyStates; +#endif +} + + +void SAL_CALL ChXDiagram::setAllPropertiesToDefault (void) + throw (RuntimeException) +{ + DBG_ERROR ("ChXChartObject::setAllPropertiesToDefault"); +} + + +void SAL_CALL ChXDiagram::setPropertiesToDefault ( + const Sequence<OUString >& aPropertyNames) + throw (beans::UnknownPropertyException, + RuntimeException) +{ + for (sal_Int32 i=0; i<aPropertyNames.getLength(); i++) + { + setPropertyToDefault (aPropertyNames[i]); + } +} + + +Sequence<Any> SAL_CALL ChXDiagram::getPropertyDefaults ( + const Sequence<OUString>& aPropertyNames) + throw (beans::UnknownPropertyException, + lang::WrappedTargetException, + RuntimeException) +{ + Sequence<Any> aResult (aPropertyNames.getLength()); + + for (sal_Int32 i=0; i<aPropertyNames.getLength(); i++) + { + aResult[i] = getPropertyDefault (aPropertyNames[i]); + } + + return aResult; +} + + + +//===== XServiceInfo ======================================================== +::rtl::OUString SAL_CALL ChXDiagram::getImplementationName() throw( uno::RuntimeException ) +{ + return SCH_ASCII_TO_OU( "ChXDiagram" ); +} + +sal_Bool SAL_CALL ChXDiagram::supportsService( const ::rtl::OUString& ServiceName ) + throw( uno::RuntimeException ) +{ + return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChXDiagram::getSupportedServiceNames() throw( uno::RuntimeException ) +{ + uno::Sequence< ::rtl::OUString > aSeq; + SvxServiceInfoHelper::addToSequence( + aSeq, 2, + "com.sun.star.chart.Diagram", + "com.sun.star.xml.UserDefinedAttributeSupplier" ); + if( mpModel ) + { + long nType = mpModel->GetBaseType(); + switch( nType ) + { + case CHTYPE_LINE: + SvxServiceInfoHelper::addToSequence( + aSeq, 9, + "com.sun.star.chart.LineDiagram", + "com.sun.star.chart.ChartStatistics", + "com.sun.star.chart.ChartAxisXSupplier", + "com.sun.star.chart.ChartTwoAxisXSupplier", + "com.sun.star.chart.ChartAxisYSupplier", + "com.sun.star.chart.ChartTwoAxisYSupplier", + "com.sun.star.chart.StackableDiagram", + "com.sun.star.chart.Dim3DDiagram", + "com.sun.star.chart.ChartAxisZSupplier" ); + // Note: the required properties and interfaces and therefore the + // service itself is always available +// if( mpModel->Is3DChart() ) +// SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.ChartAxisZSupplier" ); + break; + case CHTYPE_AREA: + SvxServiceInfoHelper::addToSequence( + aSeq, 9, + "com.sun.star.chart.AreaDiagram", + "com.sun.star.chart.ChartStatistics", + "com.sun.star.chart.ChartAxisXSupplier", + "com.sun.star.chart.ChartTwoAxisXSupplier", + "com.sun.star.chart.ChartAxisYSupplier", + "com.sun.star.chart.ChartTwoAxisYSupplier", + "com.sun.star.chart.StackableDiagram", + "com.sun.star.chart.Dim3DDiagram", + "com.sun.star.chart.ChartAxisZSupplier" ); + // Note: the required properties and interfaces and therefore the + // service itself is always available +// if( mpModel->Is3DChart() ) +// SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.ChartAxisZSupplier" ); + break; + case CHTYPE_DONUT : + SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.chart.DonutDiagram" ); + break; + case CHTYPE_COLUMN : // also treated as bar chart + case CHTYPE_BAR : + SvxServiceInfoHelper::addToSequence( + aSeq, 9, + "com.sun.star.chart.BarDiagram", + "com.sun.star.chart.ChartStatistics", + "com.sun.star.chart.ChartAxisXSupplier", + "com.sun.star.chart.ChartTwoAxisXSupplier", + "com.sun.star.chart.ChartAxisYSupplier", + "com.sun.star.chart.ChartTwoAxisYSupplier", + "com.sun.star.chart.StackableDiagram", + "com.sun.star.chart.Dim3DDiagram", + "com.sun.star.chart.ChartAxisZSupplier" ); + // Note: the required properties and interfaces and therefore the + // service itself is always available +// if( mpModel->Is3DChart() ) +// SvxServiceInfoHelper::addToSequence(aSeq, 1, "com.sun.star.chart.ChartAxisZSupplier" ); + break; + case CHTYPE_CIRCLE : + SvxServiceInfoHelper::addToSequence( + aSeq, 2, + "com.sun.star.chart.PieDiagram", + "com.sun.star.chart.Dim3DDiagram"); + break; + case CHTYPE_XY : + SvxServiceInfoHelper::addToSequence( + aSeq, 7, + "com.sun.star.chart.XYDiagram", + "com.sun.star.chart.LineDiagram", + "com.sun.star.chart.ChartStatistics", + "com.sun.star.chart.ChartAxisXSupplier", + "com.sun.star.chart.ChartTwoAxisXSupplier", + "com.sun.star.chart.ChartAxisYSupplier", + "com.sun.star.chart.ChartTwoAxisYSupplier" ); + break; + case CHTYPE_NET : + SvxServiceInfoHelper::addToSequence( + aSeq, 3, + "com.sun.star.chart.NetDiagram", + "com.sun.star.chart.StackableDiagram", + "com.sun.star.chart.ChartAxisYSupplier" ); + break; + case CHTYPE_STOCK : + SvxServiceInfoHelper::addToSequence( + aSeq, 6, + "com.sun.star.chart.StockDiagram", + "com.sun.star.chart.ChartStatistics", + "com.sun.star.chart.ChartAxisXSupplier", + "com.sun.star.chart.ChartTwoAxisXSupplier", + "com.sun.star.chart.ChartAxisYSupplier", + "com.sun.star.chart.ChartTwoAxisYSupplier" ); + break; + } + } + else + { + DBG_ERROR( "No Model" ); + } + + return aSeq; +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChXDiagram::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return 0; +} + +// XComponent +void SAL_CALL ChXDiagram::dispose() throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + const int nMemberListSize = 19; + const uno::Reference<uno::XInterface> xMemberList[nMemberListSize] = { + mxXAxisTitle, mxYAxisTitle, mxZAxisTitle, + mxXAxis, mxYAxis, mxZAxis, mxSecXAxis, mxSecYAxis, + mxMajorGridX, mxMajorGridY, mxMajorGridZ, + mxMinorGridX, mxMinorGridY, mxMinorGridZ, + mxMinMaxLine, mxUpBar, mxDownBar, + mxWall, mxFloor}; + for (int i=0; i<nMemberListSize; i++) + if (xMemberList[i].is()) + { + uno::Reference<lang::XComponent> xComponent (xMemberList[i], uno::UNO_QUERY); + if (xComponent.is()) + { + xComponent->dispose(); + xComponent->removeEventListener (this); + } + } + + ::com::sun::star::lang::EventObject aEvent (*this); + maListenerList.disposeAndClear (aEvent); +} + +void SAL_CALL ChXDiagram::addEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListenerList.addInterface (xListener); +} + +void SAL_CALL ChXDiagram::removeEventListener( const uno::Reference< lang::XEventListener >& xListener ) + throw( uno::RuntimeException ) +{ + maListenerList.removeInterface (xListener); +} + + + + +// XEventListener +void SAL_CALL ChXDiagram::disposing (const ::com::sun::star::lang::EventObject & Source) + throw (uno::RuntimeException) +{ + if (Source.Source == mxXAxisTitle) + mxXAxisTitle = NULL; + else if (Source.Source == mxYAxisTitle) + mxYAxisTitle = NULL; + else if (Source.Source == mxZAxisTitle) + mxZAxisTitle = NULL; + else if (Source.Source == mxXAxis) + mxXAxis = NULL; + else if (Source.Source == mxYAxis) + mxYAxis = NULL; + else if (Source.Source == mxZAxis) + mxZAxis = NULL; + else if (Source.Source == mxSecXAxis) + mxSecXAxis = NULL; + else if (Source.Source == mxSecYAxis) + mxSecYAxis = NULL; + else if (Source.Source == mxMajorGridX) + mxMajorGridX = NULL; + else if (Source.Source == mxMajorGridY) + mxMajorGridY = NULL; + else if (Source.Source == mxMajorGridZ) + mxMajorGridZ = NULL; + else if (Source.Source == mxMinorGridX) + mxMinorGridX = NULL; + else if (Source.Source == mxMinorGridY) + mxMinorGridY = NULL; + else if (Source.Source == mxMinorGridZ) + mxMinorGridZ = NULL; + else if (Source.Source == mxMinMaxLine) + mxMinMaxLine = NULL; + else if (Source.Source == mxUpBar) + mxUpBar = NULL; + else if (Source.Source == mxDownBar) + mxDownBar = NULL; + else if (Source.Source == mxWall) + mxWall = NULL; + else if (Source.Source == mxFloor) + mxFloor = NULL; +} + + + +//===== protected methods ======================================================================= + +void ChXDiagram::AdvanceToName (const SfxItemPropertyMap *& pProperty, + const OUString * pPropertyName) + throw (::com::sun::star::beans::UnknownPropertyException) +{ + sal_Int32 nComparisonResult; + + // Advance over the property list to the property with the current name. + while ((nComparisonResult=pPropertyName->compareToAscii (pProperty->pName)) > 0) + { + pProperty++; + if (pProperty->pName == NULL) + { + // We reached the end of the property list. Therefore all remaining given + // property names can not be found. + OUString sMessage = OUString ( + RTL_CONSTASCII_USTRINGPARAM ("ChXChartObject::setPropertyValues: unknown property ")); + sMessage += *pPropertyName; + throw UnknownPropertyException (sMessage, (::cppu::OWeakObject*)this); + } + } + if (nComparisonResult < 0) + { + // All remaining given property names can not match any of the remaining properties + // because they lie alphabetically before them => Error + OUString sMessage = OUString ( + RTL_CONSTASCII_USTRINGPARAM ("ChXChartObject::setPropertyValues: unknown property ")); + sMessage += *pPropertyName; + throw UnknownPropertyException (sMessage, (::cppu::OWeakObject*)this); + } + + // If we reach this line then we have found the property with the name pPropertyName. +} + + +} //namespace binfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChartArea.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChartArea.cxx new file mode 100644 index 000000000000..9ac4e6674b05 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChartArea.cxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "ChartArea.hxx" + +#include "mapprov.hxx" + +// header for class OGuard +#include <osl/mutex.hxx> +// header for class Application +#include <vcl/svapp.hxx> +#include <rtl/uuid.h> +namespace binfilter { + +using namespace ::com::sun::star; + +ChartArea::ChartArea( ChartModel* pModel, sal_Int32 nObjectId ) : + ChXChartObject( CHMAP_AREA, pModel, nObjectId ) +{ +} + +ChartArea::~ChartArea() +{} + +// XServiceInfo +::rtl::OUString SAL_CALL ChartArea::getImplementationName() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "ChartArea" ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChartArea::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Sequence< ::rtl::OUString > aSeq( 4 ); + aSeq[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartArea" ); + aSeq[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" ); + aSeq[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.FillProperties" ); + aSeq[ 3 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + return aSeq; +} + +// XTypeProvider +uno::Sequence< sal_Int8 > SAL_CALL ChartArea::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; +} + +// XShapeDescriptor +::rtl::OUString SAL_CALL ChartArea::getShapeType() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartArea" ); +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChartArea::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return ChXChartObject::getSomething( aIdentifier ); +} + +// helpers for XUnoTunnel +const uno::Sequence< sal_Int8 > & ChartArea::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChartGrid.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChartGrid.cxx new file mode 100644 index 000000000000..48b86498f4dc --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChartGrid.cxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "ChartGrid.hxx" + +#include "mapprov.hxx" + +// header for class OGuard +#include <osl/mutex.hxx> +// header for class Application +#include <vcl/svapp.hxx> +#include <rtl/uuid.h> +namespace binfilter { + +using namespace ::com::sun::star; + +ChartGrid::ChartGrid( ChartModel* pModel, sal_Int32 nObjectId ) : + ChXChartObject( CHMAP_LINE, pModel, nObjectId ) +{ +} + +ChartGrid::~ChartGrid() +{} + +// XServiceInfo +::rtl::OUString SAL_CALL ChartGrid::getImplementationName() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "ChartGrid" ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChartGrid::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Sequence< ::rtl::OUString > aSeq( 3 ); + aSeq[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartGrid" ); + aSeq[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" ); + aSeq[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + return aSeq; +} + +// XTypeProvider +uno::Sequence< sal_Int8 > SAL_CALL ChartGrid::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; +} + +// XShapeDescriptor +::rtl::OUString SAL_CALL ChartGrid::getShapeType() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartGrid" ); +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChartGrid::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return ChXChartObject::getSomething( aIdentifier ); +} + +// helpers for XUnoTunnel +const uno::Sequence< sal_Int8 > & ChartGrid::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChartLegend.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChartLegend.cxx new file mode 100644 index 000000000000..a0ab36e0ed6e --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChartLegend.cxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "ChartLegend.hxx" +#include "mapprov.hxx" +#include "defines.hxx" + +// header for class OGuard +#include <osl/mutex.hxx> +// header for class Application +#include <vcl/svapp.hxx> +#include <rtl/uuid.h> +namespace binfilter { + +using namespace ::com::sun::star; + +ChartLegend::ChartLegend( ChartModel* pModel ) : + ChXChartObject( CHMAP_LEGEND, pModel, CHOBJID_LEGEND ) +{ +} + +ChartLegend::~ChartLegend() +{} + +// XServiceInfo +::rtl::OUString SAL_CALL ChartLegend::getImplementationName() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "ChartLegend" ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChartLegend::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Sequence< ::rtl::OUString > aSeq( 6 ); + aSeq[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartLegend" ); + aSeq[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.style.CharacterProperties" ); + aSeq[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.FillProperties" ); + aSeq[ 3 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" ); + aSeq[ 4 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.Shape" ); + aSeq[ 5 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + return aSeq; +} + +// XTypeProvider +uno::Sequence< sal_Int8 > SAL_CALL ChartLegend::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; +} + +// XShapeDescriptor +::rtl::OUString SAL_CALL ChartLegend::getShapeType() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartLegend" ); +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChartLegend::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return ChXChartObject::getSomething( aIdentifier ); +} + +// helpers for XUnoTunnel +const uno::Sequence< sal_Int8 > & ChartLegend::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChartLine.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChartLine.cxx new file mode 100644 index 000000000000..27eb421097a1 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChartLine.cxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "ChartLine.hxx" + +#include "mapprov.hxx" + +// header for class OGuard +#include <osl/mutex.hxx> +// header for class Application +#include <vcl/svapp.hxx> +#include <rtl/uuid.h> +namespace binfilter { + +using namespace ::com::sun::star; + +ChartLine::ChartLine( ChartModel* pModel, sal_Int32 nObjectId, sal_Int32 nIndex ) : + ChXChartObject( CHMAP_LINE, pModel, nObjectId, nIndex ) +{ +} + +ChartLine::~ChartLine() +{} + +// XServiceInfo +::rtl::OUString SAL_CALL ChartLine::getImplementationName() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "ChartLine" ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChartLine::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Sequence< ::rtl::OUString > aSeq( 3 ); + aSeq[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartLine" ); + aSeq[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" ); + aSeq[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + return aSeq; +} + +// XTypeProvider +uno::Sequence< sal_Int8 > SAL_CALL ChartLine::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; +} + +// XShapeDescriptor +::rtl::OUString SAL_CALL ChartLine::getShapeType() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartLine" ); +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChartLine::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return ChXChartObject::getSomething( aIdentifier ); +} + +// helpers for XUnoTunnel +const uno::Sequence< sal_Int8 > & ChartLine::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_ChartTitle.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_ChartTitle.cxx new file mode 100644 index 000000000000..fe5760b68013 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_ChartTitle.cxx @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "ChartTitle.hxx" + +#include "mapprov.hxx" + +// header for class OGuard +// header for class Application +#include <vcl/svapp.hxx> +#include <rtl/uuid.h> + +#include "schattr.hxx" +#ifndef _SVX_CHRTITEM_HXX //autogen +#define ITEMID_CHARTTEXTORIENT SCHATTR_TEXT_ORIENT + +#include <bf_svtools/eitem.hxx> + +#endif +#include "globfunc.hxx" +namespace binfilter { + +using namespace ::com::sun::star; + +ChartTitle::ChartTitle( ChartModel* pModel, sal_Int32 nObjectId ) : + ChXChartObject( CHMAP_TITLE, pModel, nObjectId ) +{ +} + +ChartTitle::~ChartTitle() +{} + +// XServiceInfo +::rtl::OUString SAL_CALL ChartTitle::getImplementationName() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "ChartTitle" ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ChartTitle::getSupportedServiceNames() + throw( uno::RuntimeException ) +{ + SolarMutexGuard aGuard; + + uno::Sequence< ::rtl::OUString > aSeq( 4 ); + aSeq[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartTitle" ); + aSeq[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.Shape" ); + aSeq[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.style.CharacterProperties" ); + aSeq[ 3 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" ); + + return aSeq; +} + +// XTypeProvider +uno::Sequence< sal_Int8 > SAL_CALL ChartTitle::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; +} + +// XShapeDescriptor +::rtl::OUString SAL_CALL ChartTitle::getShapeType() + throw( uno::RuntimeException ) +{ + return ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartTitle" ); +} + +// XUnoTunnel +sal_Int64 SAL_CALL ChartTitle::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) + throw( uno::RuntimeException ) +{ + if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + aIdentifier.getConstArray(), 16 ) ) + { + return (sal_Int64)this; + } + return ChXChartObject::getSomething( aIdentifier ); +} + +// helpers for XUnoTunnel +const uno::Sequence< sal_Int8 > & ChartTitle::getUnoTunnelId() throw() +{ + static uno::Sequence< sal_Int8 > * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +void ChartTitle::GetPropertyValue( const SfxItemPropertyMap & rProperty, + ::com::sun::star::uno::Any & rValue, + SfxItemSet & rAttributes ) +{ + switch( rProperty.nWID ) + { + // Axis title rotation angle. + case SCHATTR_TEXT_DEGREES: + { + // Automatic text orientation is changed into corresponding + // rotation angle. + SvxChartTextOrient eOrientation = + ((const SvxChartTextOrientItem&)rAttributes.Get( + SCHATTR_TEXT_ORIENT)).GetValue(); + if (eOrientation == CHTXTORIENT_AUTOMATIC) + { + switch (mnWhichId) + { + case CHOBJID_DIAGRAM_TITLE_X_AXIS: + if (mpModel->IsXVertikal()) + eOrientation = CHTXTORIENT_BOTTOMTOP; + else + eOrientation = CHTXTORIENT_AUTOMATIC; + break; + + case CHOBJID_DIAGRAM_TITLE_Y_AXIS: + if (mpModel->IsXVertikal()) + eOrientation = CHTXTORIENT_AUTOMATIC; + else + eOrientation = CHTXTORIENT_BOTTOMTOP; + break; + + case CHOBJID_DIAGRAM_TITLE_Z_AXIS: + if (mpModel->IsXVertikal()) + eOrientation = CHTXTORIENT_TOPBOTTOM; + else + eOrientation = CHTXTORIENT_AUTOMATIC; + break; + + default: + eOrientation = CHTXTORIENT_AUTOMATIC; + break; + } + } + // GetTextRotation is in globfunc and returns the value of the + // rotation item (SCHATTR_TEXT_DEGREES) if set, otherwise + // defaults according to the orientation + rValue <<= static_cast< sal_Int32 >( GetTextRotation (rAttributes, eOrientation) ); + } + break; + + default: + ChXChartObject::GetPropertyValue( rProperty, rValue, rAttributes ); + } +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_mapprov.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_mapprov.cxx new file mode 100644 index 000000000000..13eecce74107 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_mapprov.cxx @@ -0,0 +1,415 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "mapprov.hxx" +#include "schattr.hxx" + +#include "app.hrc" // for SID_TEXTBREAK +#include <bf_svx/svxids.hrc> // for SID_ATTR_NUMBERFORMAT_SOURCE + +// for SdrObject +// for SdrObjList +// for SdrObjListIter +// header for E3dExtrudeObj +// for SVX_UNOEDIT_CHAR_PROPERTIES, SVX_UNOEDIT_FONT_PROPERTIES +#include <bf_svx/unoshprp.hxx> + +#include <com/sun/star/chart/ChartLegendPosition.hpp> +#include <com/sun/star/chart/ChartErrorIndicatorType.hpp> +#include <com/sun/star/chart/ChartErrorCategory.hpp> +#include <com/sun/star/chart/ChartRegressionCurveType.hpp> +#include <com/sun/star/chart/ChartDataRowSource.hpp> +#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> +#include <com/sun/star/chart/ChartSeriesAddress.hpp> + +#include <com/sun/star/drawing/XShapes.hpp> +#include "unonames.hxx" +namespace binfilter { + +using namespace ::com::sun::star; + +// ---------------------------------- +// create one global instance for use +// from all uno implemetations +// ---------------------------------- +SchUnoPropertyMapProvider aSchMapProvider; + + +// ---------------------- +// shared property ranges +// ---------------------- + +#define SCH_DATA_DESCR_PROPERTIES \ + { MAP_CHAR_LEN( UNONAME_DATACAPTION ), SCHATTR_DATADESCR_DESCR, &::getCppuType( (sal_Int32*)0 ), 0, 0 } + +// attention: x and y grids are interchanged +#define SCH_SHOW_HIDE_PROPERTIES \ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_2X_AXIS ), CHATTR_AXISGRID_SHOW_2X_AXIS, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_2X_DESCR ), CHATTR_AXISGRID_SHOW_2X_DESCR, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_2Y_AXIS ), CHATTR_AXISGRID_SHOW_2Y_AXIS, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_2Y_DESCR ), CHATTR_AXISGRID_SHOW_2Y_DESCR, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_X_AXIS ), CHATTR_AXISGRID_SHOW_X_AXIS, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_X_DESCR ), CHATTR_AXISGRID_SHOW_X_DESCR, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_X_HELP ), CHATTR_AXISGRID_SHOW_Y_HELP, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_X_MAIN ), CHATTR_AXISGRID_SHOW_Y_MAIN, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Y_AXIS ), CHATTR_AXISGRID_SHOW_Y_AXIS, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Y_DESCR ), CHATTR_AXISGRID_SHOW_Y_DESCR, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Y_HELP ), CHATTR_AXISGRID_SHOW_X_HELP, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Y_MAIN ), CHATTR_AXISGRID_SHOW_X_MAIN, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Z_AXIS ), CHATTR_AXISGRID_SHOW_Z_AXIS, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Z_DESCR ), CHATTR_AXISGRID_SHOW_Z_DESCR, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Z_HELP ), CHATTR_AXISGRID_SHOW_Z_HELP, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_AXISGRID_SHOW_Z_MAIN ), CHATTR_AXISGRID_SHOW_Z_MAIN, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_TITLE_SHOW_X_AXIS ), CHATTR_TITLE_SHOW_X_AXIS, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_TITLE_SHOW_Y_AXIS ), CHATTR_TITLE_SHOW_Y_AXIS, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_TITLE_SHOW_Z_AXIS ), CHATTR_TITLE_SHOW_Z_AXIS, &::getBooleanCppuType(), 0, 0 } + +#define SCH_STAT_PROPERTIES \ + { MAP_CHAR_LEN( UNONAME_STAT_AVERAGE ), SCHATTR_STAT_AVERAGE, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STAT_BIGERROR ), SCHATTR_STAT_BIGERROR, &::getCppuType((const double*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STAT_CONSTMINUS ), SCHATTR_STAT_CONSTMINUS, &::getCppuType((const double*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STAT_CONSTPLUS ), SCHATTR_STAT_CONSTPLUS, &::getCppuType((const double*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STAT_INDICATE ), SCHATTR_STAT_INDICATE, &::getCppuType((const chart::ChartErrorIndicatorType*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STAT_KIND_ERROR ), SCHATTR_STAT_KIND_ERROR, &::getCppuType((const chart::ChartErrorCategory*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STAT_PERCENT ), SCHATTR_STAT_PERCENT, &::getCppuType((const double*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STAT_REGRESSTYPE ), SCHATTR_STAT_REGRESSTYPE, &::getCppuType((const chart::ChartRegressionCurveType*)0), 0, 0 } + +#define SCH_SUBTYPE_PROPERTIES \ + { MAP_CHAR_LEN( UNONAME_NUM_OF_LINES_FOR_BAR ), CHATTR_NUM_OF_LINES_FOR_BAR, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STOCK_UPDOWN ), SCHATTR_STOCK_UPDOWN, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STOCK_VOLUME ), SCHATTR_STOCK_VOLUME, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_3D ), SCHATTR_STYLE_3D, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_DEEP ), SCHATTR_STYLE_DEEP, &::getBooleanCppuType() , 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_LINES ), SCHATTR_STYLE_LINES, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_PERCENT ), SCHATTR_STYLE_PERCENT, &::getBooleanCppuType() , 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_SHAPE ), SCHATTR_STYLE_SHAPE, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_SPLINES ), SCHATTR_STYLE_SPLINES, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_STACKED ), SCHATTR_STYLE_STACKED, &::getBooleanCppuType() , 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_SYMBOL ), SCHATTR_STYLE_SYMBOL, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_SYMBOL_BITMAP_URL ), SCHATTR_SYMBOL_BRUSH, &::getCppuType((const ::rtl::OUString*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_SYMBOL_SIZE ), SCHATTR_SYMBOL_SIZE, &::getCppuType((const awt::Size*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_VERTICAL ), SCHATTR_STYLE_VERTICAL, &::getBooleanCppuType(), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_SPLINE_ORDER ), CHATTR_SPLINE_ORDER, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_SPLINE_RESOLUTION ), CHATTR_SPLINE_RESOLUTION, &::getCppuType((const sal_Int32*)0), 0, 0 } + + +#define SCH_TEXT2_PROPERTIES \ + { MAP_CHAR_LEN( UNONAME_TEXT_DEGREES ), SCHATTR_TEXT_DEGREES, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_TEXT_OVERLAP ), SCHATTR_TEXT_OVERLAP, &::getBooleanCppuType(), 0, 0 } + + +#define SCH_GFX_PROPERTIES \ + { MAP_CHAR_LEN( UNONAME_STYLE_SHAPE ), SCHATTR_STYLE_SHAPE, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_STYLE_SYMBOL ), SCHATTR_STYLE_SYMBOL, &::getCppuType((const sal_Int32*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_SYMBOL_BITMAP_URL ),SCHATTR_SYMBOL_BRUSH, &::getCppuType((const ::rtl::OUString*)0), 0, 0 },\ + { MAP_CHAR_LEN( UNONAME_SYMBOL_SIZE ), SCHATTR_SYMBOL_SIZE, &::getCppuType((const awt::Size*)0), 0, 0 } + +#define SCH_ALIEN_PROPERTIES \ + { MAP_CHAR_LEN( UNONAME_USER_DEF_ATTR ), SCHATTR_USER_DEFINED_ATTR, &::getCppuType((uno::Reference< container::XNameContainer >*)0), 0, 0 } + +#define SCH_MAP_END { 0,0,0,0,0 } + +// --------------- +// map definitions +// --------------- + +// see SchUnoPropertyMapProvider::GetMap() + +// ------------------------------------------------------------ +// +// Implementation for SchUnoPropertyMapProvider +// +// ------------------------------------------------------------ + +SchUnoPropertyMapProvider::SchUnoPropertyMapProvider() +{ + for( long i = 0; i < CHMAP_END; i++ ) + pMapArr[i] = 0; +} + +SchUnoPropertyMapProvider::~SchUnoPropertyMapProvider() +{ + for( long i = 0; i < CHMAP_END; i++ ) + if( pMapArr[i] ) + delete pMapArr[i]; +} + +// -------------- copied from SwUnoPropertyMapProvider -------------- +EXTERN_C +#ifdef WNT +int _cdecl +#else +int +#endif +Sch_CompareMap( const void* pSmaller, const void* pBigger ) +{ + int nDiff = strcmp( ((const SfxItemPropertyMap*)pSmaller)->pName, + ((const SfxItemPropertyMap*)pBigger)->pName ); + return nDiff; +} + +void SchUnoPropertyMapProvider::Sort(short nId) +{ + SfxItemPropertyMap* pTemp = pMapArr[ nId ]; + short i = 0; + while( pTemp[i].pName ) + i++; + + qsort( pMapArr[ nId ], i, sizeof(SfxItemPropertyMap), Sch_CompareMap ); +} + +SfxItemPropertyMap* SchUnoPropertyMapProvider::CopyMap( const SfxItemPropertyMap* pMap1 ) +{ + long nCnt = 0; + + while( pMap1[ nCnt ].pName ) + nCnt++; + + nCnt++; + + SfxItemPropertyMap* pNewMap = new SfxItemPropertyMap[ nCnt ]; + memcpy( pNewMap, pMap1, sizeof(SfxItemPropertyMap) * nCnt ); + return pNewMap; +} + +SfxItemPropertyMap* SchUnoPropertyMapProvider::GetMap( short nPropertyId, ChartModel *pModel ) +{ + // --------------- + // map definitions + // --------------- + + static SfxItemPropertyMap aEmptyMap[] = { SCH_MAP_END }; + + // ChXChartDocument + static SfxItemPropertyMap aChartDocumentPropertyMap_Impl[] = + { + { MAP_CHAR_LEN( UNONAME_HASLEGEND ), CHATTR_DIAGRAM_START, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_TITLE_SHOW_MAIN ), CHATTR_TITLE_SHOW_MAIN, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_TITLE_SHOW_SUB ), CHATTR_TITLE_SHOW_SUB, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_CATEGORIES_RANGE_ADDRESS ), CHATTR_ADDR_CATEGORIES, &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_SERIES_ADDRESSES ), CHATTR_ADDR_SERIES, &::getCppuType(( uno::Sequence< chart::ChartSeriesAddress >*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_CHART_RANGE_ADDRESS ), CHATTR_ADDR_CHART, &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_TABLE_NUMBER_LIST ), CHATTR_TABLE_NUMBER_LIST, &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_EXPORT_DATA ), CHATTR_EXPORT_TABLE, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_FIRST_COL_LABELS ), CHATTR_FIRST_COL_LABELS,&::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_FIRST_ROW_LABELS ), CHATTR_FIRST_ROW_LABELS,&::getBooleanCppuType(), 0, 0 }, +// { MAP_CHAR_LEN( UNONAME_MAINTITLE_ADDRESS ), CHATTR_ADDR_MAIN_TITLE, &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, +// { MAP_CHAR_LEN( UNONAME_SUBTITLE_ADDRESS ), CHATTR_ADDR_SUB_TITLE, &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_ADDITIONAL_SHAPES ), CHATTR_ADDITIONAL_SHAPES, &::getCppuType((const uno::Reference< drawing::XShapes >*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_HAS_TRANSLATED_COLS ), CHATTR_HAS_TRANSLATED_COLS, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN( UNONAME_HAS_TRANSLATED_ROWS ), CHATTR_HAS_TRANSLATED_ROWS, &::getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN( UNONAME_TRANSLATED_COLS ), CHATTR_TRANSLATED_COLS, &::getCppuType(( uno::Sequence< sal_Int32 >*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_TRANSLATED_ROWS ), CHATTR_TRANSLATED_ROWS, &::getCppuType(( uno::Sequence< sal_Int32 >*)0), 0, 0 }, + SCH_ALIEN_PROPERTIES, + SCH_MAP_END + }; + + static SfxItemPropertyMap aChartTitleShapePropertyMap_Impl[] = + { + SVX_UNOEDIT_CHAR_PROPERTIES, + { MAP_CHAR_LEN( UNONAME_TEXT_DEGREES ), SCHATTR_TEXT_DEGREES, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_TEXT_STRING ), CHATTR_TITLE_MAIN, &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, // CHATTR_TEXT_TITLE_MAIN is just a 'placeholder' to select the uno property 'String' from the which id + { MAP_CHAR_LEN( UNONAME_STACKED_TEXT ), SCHATTR_TEXT_ORIENT, &::getBooleanCppuType(), 0, 0 }, + SCH_ALIEN_PROPERTIES, + FILL_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + SCH_MAP_END + }; + + static SfxItemPropertyMap aChartLegendPropertyMap_Impl[] = + { + SVX_UNOEDIT_CHAR_PROPERTIES, + { MAP_CHAR_LEN( UNONAME_CHARTLEGENDALIGN ), SCHATTR_LEGEND_POS, &::getCppuType((const chart::ChartLegendPosition*)0), 0, 0 }, + SCH_ALIEN_PROPERTIES, + FILL_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + SCH_MAP_END + }; + + // ChXDiagram + static SfxItemPropertyMap aChartPropertyMap_Impl[] = + { + SCH_STAT_PROPERTIES, + SCH_SHOW_HIDE_PROPERTIES, + SCH_SUBTYPE_PROPERTIES, + SCH_DATA_DESCR_PROPERTIES, + { MAP_CHAR_LEN( UNONAME_DATAROWSOURCE ), CHATTR_DATA_SWITCH, &::getCppuType((const chart::ChartDataRowSource*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_STACKCONNECTORS ), CHATTR_BARCONNECT, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_ATTRIBUTED_DATA_POINTS ),CHATTR_ATTRIBUTED_DATA_POINTS, &::getCppuType(( uno::Sequence< uno::Sequence< sal_Int32 > >*)0), beans::PropertyAttribute::READONLY, 0}, + SCH_ALIEN_PROPERTIES, + FILL_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + SPECIAL_3DSCENEOBJECT_PROPERTIES + SCH_MAP_END + }; + + static SfxItemPropertyMap aChartAxisStylePropertyMap_Impl[] = + { + SCH_TEXT2_PROPERTIES, + SVX_UNOEDIT_CHAR_PROPERTIES, + LINE_PROPERTIES + LINE_PROPERTIES_START_END + { MAP_CHAR_LEN( UNONAME_AXIS_AUTO_MAX ), SCHATTR_AXIS_AUTO_MAX, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_AUTO_MIN ), SCHATTR_AXIS_AUTO_MIN, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_AUTO_ORIGIN ), SCHATTR_AXIS_AUTO_ORIGIN, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_AUTO_STEP_HELP ), SCHATTR_AXIS_AUTO_STEP_HELP, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_AUTO_STEP_MAIN ), SCHATTR_AXIS_AUTO_STEP_MAIN, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_HELPTICKS ), SCHATTR_AXIS_HELPTICKS, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_LOGARITHM ), SCHATTR_AXIS_LOGARITHM, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_MAX ), SCHATTR_AXIS_MAX, &::getCppuType((const double*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_MIN ), SCHATTR_AXIS_MIN, &::getCppuType((const double*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_ORIGIN ), SCHATTR_AXIS_ORIGIN, &::getCppuType((const double*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_STEP_HELP ), SCHATTR_AXIS_STEP_HELP, &::getCppuType((const double*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_STEP_MAIN ), SCHATTR_AXIS_STEP_MAIN, &::getCppuType((const double*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_AXIS_TICKS ), SCHATTR_AXIS_TICKS, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_DIAGRAM_GAPWIDTH ), SCHATTR_BAR_GAPWIDTH, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_DIAGRAM_OVERLAP ), SCHATTR_BAR_OVERLAP, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_NUMBERFORMAT ), SCHATTR_AXIS_NUMFMT, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_TEXTBREAK ), SID_TEXTBREAK, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_TEXT_ORDER ), SCHATTR_TEXT_ORDER, &::getCppuType((const chart::ChartAxisArrangeOrderType*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_DISPLAY_LABELS ), SCHATTR_AXIS_SHOWDESCR, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_VISIBLE ), SCHATTR_AXIS_SHOWAXIS, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_LINK_NUMFMT ), SID_ATTR_NUMBERFORMAT_SOURCE, &::getBooleanCppuType(), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_STACKED_TEXT ), SCHATTR_TEXT_ORIENT, &::getBooleanCppuType(), 0, 0 }, + SCH_ALIEN_PROPERTIES, + SCH_MAP_END + }; + + static SfxItemPropertyMap aChartDataRowPropertyMap_Impl[] = + { + SCH_GFX_PROPERTIES, + SCH_DATA_DESCR_PROPERTIES, + SCH_STAT_PROPERTIES, + SVX_UNOEDIT_CHAR_PROPERTIES, + { MAP_CHAR_LEN( UNONAME_AXIS ), SCHATTR_AXIS, &::getCppuType((const sal_Int32*)0), 0, 0 }, + { MAP_CHAR_LEN( UNONAME_REGRESSION_PROPS ), CHATTR_REGRESSION_PROPS, &::getCppuType((const uno::Reference< beans::XPropertySet >*)0), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN( UNONAME_ERROR_PROPS ), CHATTR_ERROR_PROPS, &::getCppuType((const uno::Reference< beans::XPropertySet >*)0), beans::PropertyAttribute::READONLY, 0}, + { MAP_CHAR_LEN( UNONAME_AVERAGE_PROPS ), CHATTR_AVERAGE_PROPS, &::getCppuType((const uno::Reference< beans::XPropertySet >*)0), beans::PropertyAttribute::READONLY, 0}, + SCH_ALIEN_PROPERTIES, + FILL_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + MISC_3D_OBJ_PROPERTIES + SPECIAL_3DEXTRUDEOBJECT_PROPERTIES + SPECIAL_3DLATHEOBJECT_PROPERTIES + SPECIAL_3DPOLYGONOBJECT_PROPERTIES + SPECIAL_3DBACKSCALE_PROPERTIES + SCH_MAP_END + }; + + static SfxItemPropertyMap aChartDataPointPropertyMap_Impl[] = + { + SCH_GFX_PROPERTIES, + SCH_DATA_DESCR_PROPERTIES, + SVX_UNOEDIT_CHAR_PROPERTIES, + { MAP_CHAR_LEN( UNONAME_PIE_SEGMENT_OFFSET ), CHATTR_PIE_SEGMENT_OFFSET, &::getCppuType((const sal_Int32*)0), 0, 0 }, + SCH_ALIEN_PROPERTIES, + FILL_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + MISC_3D_OBJ_PROPERTIES + SPECIAL_3DEXTRUDEOBJECT_PROPERTIES + SPECIAL_3DLATHEOBJECT_PROPERTIES + SPECIAL_3DPOLYGONOBJECT_PROPERTIES + SPECIAL_3DBACKSCALE_PROPERTIES + SCH_MAP_END + }; + + static SfxItemPropertyMap aFilledShapePropertyMap_Impl[] = + { + FILL_PROPERTIES + LINE_PROPERTIES + LINE_PROPERTIES_START_END + SCH_ALIEN_PROPERTIES, + SCH_MAP_END + }; + + static SfxItemPropertyMap aLineShapePropertyMap_Impl[] = + { + LINE_PROPERTIES + LINE_PROPERTIES_START_END + SCH_ALIEN_PROPERTIES, + SCH_MAP_END + }; + + // ------------ + // program code + // ------------ + + if( nPropertyId >= CHMAP_END ) + DBG_ERROR2( "Invalid Id %d (>=%d)", nPropertyId, CHMAP_END ); + + if( ! pMapArr[ nPropertyId ] ) + { + SfxItemPropertyMap** pNewMap = &(pMapArr[ nPropertyId ]); + switch( nPropertyId ) + { + case CHMAP_CHART: + *pNewMap = CopyMap( aChartPropertyMap_Impl ); + break; + case CHMAP_AREA: + *pNewMap = CopyMap( aFilledShapePropertyMap_Impl ); + break; + case CHMAP_LINE: + *pNewMap = CopyMap( aLineShapePropertyMap_Impl ); + break; + case CHMAP_DOC: + *pNewMap = CopyMap( aChartDocumentPropertyMap_Impl ); + break; + case CHMAP_AXIS: + *pNewMap = CopyMap( aChartAxisStylePropertyMap_Impl ); + break; + case CHMAP_LEGEND: + *pNewMap = CopyMap( aChartLegendPropertyMap_Impl ); + break; + case CHMAP_TITLE: + *pNewMap = CopyMap( aChartTitleShapePropertyMap_Impl ); + break; + case CHMAP_DATAROW: + *pNewMap = CopyMap( aChartDataRowPropertyMap_Impl ); + break; + case CHMAP_DATAPOINT: + *pNewMap = CopyMap( aChartDataPointPropertyMap_Impl ); + break; + case CHMAP_NONE: + default: + *pNewMap = CopyMap( aEmptyMap ); + DBG_WARNING( "Using empty PropertyMap!" ); + break; + } + Sort( nPropertyId ); + } + + return pMapArr[ nPropertyId ]; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_register.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_register.cxx new file mode 100644 index 000000000000..774a46e11a46 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_register.cxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <bf_sfx2/sfxuno.hxx> + +#include "schdll.hxx" +namespace binfilter { + +using namespace ::com::sun::star; + +//StarChart document +extern uno::Sequence< ::rtl::OUString > SAL_CALL SchDocument_getSupportedServiceNames() throw(); +extern ::rtl::OUString SAL_CALL SchDocument_getImplementationName() throw(); +extern uno::Reference< uno::XInterface > SAL_CALL SchDocument_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ); + +extern "C" { + +void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvironmentTypeName , + uno_Environment** ppEnvironment ) +{ + *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; +} + +sal_Bool SAL_CALL component_writeInfo( void* pServiceManager , + void* pRegistryKey ) +{ + uno::Reference< registry::XRegistryKey > + xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) ) ; + + sal_Int32 i; + uno::Reference< registry::XRegistryKey > xNewKey; + + xNewKey = xKey->createKey(::rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/") ) + SchDocument_getImplementationName() + + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); + + uno::Sequence< ::rtl::OUString > rServices = SchDocument_getSupportedServiceNames(); + for(i = 0; i < rServices.getLength(); i++ ) + xNewKey->createKey( rServices.getConstArray()[i]); + + return sal_True; +} + +void* SAL_CALL component_getFactory( const sal_Char* pImplementationName , + void* pServiceManager , + void* pRegistryKey ) +{ + void* pReturn = NULL ; + + if ( ( pImplementationName != NULL ) && ( pServiceManager != NULL ) ) + { + uno::Reference< lang::XSingleServiceFactory > xFactory; + uno::Reference< lang::XMultiServiceFactory > xServiceManager( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ) ); + + if( SchDocument_getImplementationName().equalsAsciiL( + pImplementationName, strlen(pImplementationName)) ) + { + xFactory = ::cppu::createSingleFactory( xServiceManager, + SchDocument_getImplementationName(), + SchDocument_createInstance, + SchDocument_getSupportedServiceNames() ); + } + + + if ( xFactory.is() ) + { + xFactory->acquire(); + pReturn = xFactory.get(); + } + } + + return pReturn ; +} +} // extern "C" + + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/source/ui/unoidl/sch_unodoc.cxx b/binfilter/bf_sch/source/ui/unoidl/sch_unodoc.cxx new file mode 100644 index 000000000000..238d6fdf59a8 --- /dev/null +++ b/binfilter/bf_sch/source/ui/unoidl/sch_unodoc.cxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// System - Includes ----------------------------------------------------- + +#include <bf_sfx2/docfac.hxx> + + +#include "schmod.hxx" + +#include <osl/mutex.hxx> +#include <vcl/svapp.hxx> +namespace binfilter { + +using namespace ::com::sun::star; + +::rtl::OUString SAL_CALL SchDocument_getImplementationName() throw() +{ + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Chart.ChartDocument" ) ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL SchDocument_getSupportedServiceNames() throw() +{ + uno::Sequence< ::rtl::OUString > aSeq( 3 ); + aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartDocument" ) ); + aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart.ChartTableAddressSupplier" ) ); + aSeq[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.UserDefinedAttributeSupplier" ) ); + + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL SchDocument_createInstance( + const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) +{ + SolarMutexGuard aGuard; + + // to create the service the SW_MOD should be already initialized + DBG_ASSERT( SCH_MOD1(), "No StarChart module!" ); + + if ( SCH_MOD1() ) + { + ::rtl::OUString aFactoryURL( RTL_CONSTASCII_USTRINGPARAM ( "private:factory/schart" ) ); + const SfxObjectFactory* pFactory = SfxObjectFactory::GetFactory( aFactoryURL ); + if ( pFactory ) + { + SfxObjectShell* pShell = pFactory->CreateObject(); + if( pShell ) + return uno::Reference< uno::XInterface >( pShell->GetModel() ); + } + } + + return uno::Reference< uno::XInterface >(); +} + + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/util/bf_sch.map b/binfilter/bf_sch/util/bf_sch.map new file mode 100644 index 000000000000..49e8838631fa --- /dev/null +++ b/binfilter/bf_sch/util/bf_sch.map @@ -0,0 +1,31 @@ +UDK_3_0_0 { + global: + CreateSchChartDocShellDll; + CreateObjSchChartDocShellDll; + InitSchDll; + DeInitSchDll; + SchUpdate; + SchUpdateAttr; + SchGetChartData; + SchNewMemChartNone; + SchNewMemChartXY; + SchNewMemChartCopy; + SchSetTransparent; + SchGetDefaultForColumnText; + SchGetDefaultForRowText; + SchMemChartInsertCols; + SchMemChartRemoveCols; + SchMemChartInsertRows; + SchMemChartRemoveRows; + SchMemChartSwapCols; + SchMemChartSwapRows; + SchConvertChartRangeForWriter; + SchConvertChartRangeForCalc; + SchMemChartResetTranslation; + SchMemChartUpdateTranslation; + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + local: + *; +}; diff --git a/binfilter/bf_sch/util/makefile.mk b/binfilter/bf_sch/util/makefile.mk new file mode 100644 index 000000000000..d00a3de8273f --- /dev/null +++ b/binfilter/bf_sch/util/makefile.mk @@ -0,0 +1,105 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +EXTERNAL_WARNINGS_NOT_ERRORS := TRUE + +PRJ=..$/.. +BFPRJ=.. + +PRJNAME=binfilter +TARGET=schart3 + +NO_HIDS=TRUE + +LIBTARGET=NO + +# --- Settings ----------------------------------------------------------- +.INCLUDE : settings.mk +INC+= -I$(PRJ)$/inc$/bf_sch +IENV!:=$(IENV);$(RES);..$/res + +# --- Files -------------------------------------------------------- + +RESLIB1LIST=\ + $(SRS)$/sch_app.srs \ + $(SRS)$/sch_core.srs + +RESLIB1NAME=bf_sch +RESLIB1SRSFILES=\ + $(RESLIB1LIST) + +LIB2TARGET= $(SLB)$/sch_schmod.lib +LIB2OBJFILES= $(SLO)$/sch_schmod.obj + +LIB3TARGET= $(SLB)$/bf_sch.lib +LIB3FILES= $(SLB)$/sch_core.lib \ + $(SLB)$/sch_app.lib \ + $(SLB)$/sch_docshell.lib \ + $(SLB)$/sch_chxchart.lib \ + $(SLB)$/sch_xml.lib + + +SHL1TARGET= bf_sch$(DLLPOSTFIX) +SHL1IMPLIB= bf_schi + +SHL1VERSIONMAP= bf_sch.map +SHL1DEF=$(MISC)$/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) + +SHL1STDLIBS=\ + $(BFSVXLIB) \ + $(LEGACYSMGRLIB) \ + $(BFSO3LIB) \ + $(BFGOODIESLIB) \ + $(BFSVTOOLLIB) \ + $(VCLLIB) \ + $(SOTLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + + +SHL1BASE= 0x1d100000 +SHL1LIBS= $(LIB3TARGET) + +.IF "$(GUI)"!="UNX" +.IF "$(GUI)$(COM)" != "WNTGCC" +SHL1OBJS= $(SLO)$/sch_schdll.obj +.ENDIF +.ENDIF # ! UNX + +.IF "$(GUI)" == "WNT" || "$(GUI)" == "WIN" +SHL1RES= $(RCTARGET) +.ENDIF # WNT || WIN + +# --- Targets ------------------------------------------------------------- + +.INCLUDE : target.mk + diff --git a/binfilter/bf_sch/util/sch_hidother.src b/binfilter/bf_sch/util/sch_hidother.src new file mode 100644 index 000000000000..b86448fec0ab --- /dev/null +++ b/binfilter/bf_sch/util/sch_hidother.src @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define NO_LOCALIZE_EXPORT +#include "..\source\ui\inc\schhids.h" + +hidspecial HID_SCH_DATA_ROW { HelpId = HID_SCH_DATA_ROW; }; +hidspecial HID_SCH_DATA_LINE { HelpId = HID_SCH_DATA_LINE; }; +hidspecial HID_SCH_DATA_POINT { HelpId = HID_SCH_DATA_POINT; }; +hidspecial HID_SCH_DIAGRAM_X_AXIS { HelpId = HID_SCH_DIAGRAM_X_AXIS; }; +hidspecial HID_SCH_DIAGRAM_Y_AXIS { HelpId = HID_SCH_DIAGRAM_Y_AXIS; }; +hidspecial HID_SCH_ALIGNMENT { HelpId = HID_SCH_ALIGNMENT; }; +hidspecial HID_SCH_LEGEND_POS { HelpId = HID_SCH_LEGEND_POS; }; +hidspecial HID_SCH_DATA_DESCR { HelpId = HID_SCH_DATA_DESCR; }; +hidspecial HID_SCH_SCALE_Y { HelpId = HID_SCH_SCALE_Y; }; +hidspecial HID_SCH_STAT { HelpId = HID_SCH_STAT; }; +hidspecial HID_SCH_WIN_DOCUMENT { HelpId = HID_SCH_WIN_DOCUMENT; }; +hidspecial HID_SCH_VIEWSHELL_DOCUMENT { HelpId = HID_SCH_VIEWSHELL_DOCUMENT; }; +hidspecial HID_SCH_CTL_DATA { HelpId = HID_SCH_CTL_DATA; }; +hidspecial HID_SCH_CT_INDICATE { HelpId = HID_SCH_CT_INDICATE; }; +hidspecial HID_SCH_CT_REGRESS { HelpId = HID_SCH_CT_REGRESS; }; +hidspecial HID_SCH_CT_1_CHARTTYPE { HelpId = HID_SCH_CT_1_CHARTTYPE; }; +hidspecial HID_SCH_CT_2_CHARTVARIANT { HelpId = HID_SCH_CT_2_CHARTVARIANT; }; +hidspecial HID_SCH_CTL_TYPE { HelpId = HID_SCH_CTL_TYPE; }; +hidspecial HID_SCH_CTL_VARIANT { HelpId = HID_SCH_CTL_VARIANT; }; +hidspecial HID_SCH_CT_REGRESS2 { HelpId = HID_SCH_CT_REGRESS2; }; +hidspecial HID_SCH_CT_INDICATE2 { HelpId = HID_SCH_CT_INDICATE2; }; +hidspecial HID_SCH_TBI_EDIT_CANCEL { HelpId = HID_SCH_TBI_EDIT_CANCEL; }; +hidspecial HID_SCH_TBI_EDIT_ACCEPT { HelpId = HID_SCH_TBI_EDIT_ACCEPT; }; +hidspecial HID_SCH_TBI_DATA_TRANSFER { HelpId = HID_SCH_TBI_DATA_TRANSFER; }; +hidspecial HID_SCH_TBI_DATA_INSERT_ROW { HelpId = HID_SCH_TBI_DATA_INSERT_ROW; }; +hidspecial HID_SCH_TBI_DATA_INSERT_COL { HelpId = HID_SCH_TBI_DATA_INSERT_COL; }; +hidspecial HID_SCH_TBI_DATA_DELETE_ROW { HelpId = HID_SCH_TBI_DATA_DELETE_ROW; }; +hidspecial HID_SCH_TBI_DATA_DELETE_COL { HelpId = HID_SCH_TBI_DATA_DELETE_COL; }; +hidspecial HID_SCH_TBI_DATA_SWAP_COL { HelpId = HID_SCH_TBI_DATA_SWAP_COL; }; +hidspecial HID_SCH_TBI_DATA_SWAP_ROW { HelpId = HID_SCH_TBI_DATA_SWAP_ROW; }; +hidspecial HID_SCH_TBI_DATA_SORT_ROW { HelpId = HID_SCH_TBI_DATA_SORT_ROW; }; +hidspecial HID_SCH_TBI_DATA_SORT_COL { HelpId = HID_SCH_TBI_DATA_SORT_COL; }; +hidspecial HID_SCH_TBI_DATA_SORT_TABLE_ROW { HelpId = HID_SCH_TBI_DATA_SORT_TABLE_ROW; }; +hidspecial HID_SCH_TBI_DATA_SORT_TABLE_COL { HelpId = HID_SCH_TBI_DATA_SORT_TABLE_COL; }; +hidspecial HID_SCH_TBX_EDIT_FIELD { HelpId = HID_SCH_TBX_EDIT_FIELD; }; + + diff --git a/binfilter/bf_sch/util/sch_sch.cxx b/binfilter/bf_sch/util/sch_sch.cxx new file mode 100644 index 000000000000..b36333c26c85 --- /dev/null +++ b/binfilter/bf_sch/util/sch_sch.cxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <sv.hxx> +#include <svtool.hxx> +#include <sfx.hxx> +#include <sfxitems.hxx> +#include <sfxdoc.hxx> +#include <sfxdlg.hxx> +namespace binfilter { +#include <svdraw.hxx> +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_sch/util/verinfo.rc b/binfilter/bf_sch/util/verinfo.rc new file mode 100644 index 000000000000..ffa861ca9263 --- /dev/null +++ b/binfilter/bf_sch/util/verinfo.rc @@ -0,0 +1,153 @@ +/************************************************************************* +* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * +**************************************************************************/ + +#define VERSION 4 +#define SUBVERSION 0 +#define VERVARIANT 0 +// .0 + VER_CONCEPT +// .100 + VER_ALPHA +// .200 + VER_BETA +// .300 + VER_GAMMA +// .500 + VER_FINAL +//#define VER_CONCEPT 0 +//#define VER_BETA 0 +#define VER_FINAL 0 + +#define VER_DAY 22 +#define VER_MONTH 11 +#define VER_YEAR 96 + +// ----------------------------------------------------------------------- + +#if !defined(ENGLISH) +#define LG_D // generate always german version +#endif +#define VER_FIRSTYEAR 93 + +#include <windows.h> +#include "verinfo.hrc" + +#ifdef WIN32 +#define FOR_WIN_X " 95 / Windows NT 3.51 / 4.0" +#else +#define FOR_WIN_X +#endif + +// ----------------------------------------------------------------------- +// language/character set specification table +// ----------------------------------------------------------------------- + +RCD_LANGUAGE rcdata +{ +#ifdef LG_D + "040704B0", // Germany -> Unicode + "040704E4", // Germany -> Windows, Multilingual +#else + "040904B0", // Germany -> Unicode + "040904E4", // USA -> Windows, Multilingual +#endif + "04090000", // USA -> 7-Bit-ASCII + 0 // end of table +} + +// ----------------------------------------------------------------------- +// version information +// ----------------------------------------------------------------------- + +VS_VERSION_INFO versioninfo + fileversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT + productversion VERSION, SUBVERSION, VERVARIANT, VER_COUNT + fileflagsmask 0x3F + fileflags +#if defined(DEBUG) + VS_FF_DEBUG | +#endif +#ifdef VER_PREL + VS_FF_PRERELEASE | +#endif + 0 +#ifndef WIN32 + fileos VOS_DOS_WINDOWS16 +#else + fileos VOS_NT_WINDOWS32 +#endif + filetype VFT_APP + { + block "StringFileInfo" + { +#ifdef LG_D + block "040704E4" + { + // German StringTable + value "CompanyName", "Star Division GmbH\0" + value "ProductName", "StarChart für Windows" FOR_WIN_X "\0" + value "FileDescription", "StarChart " S_VERSION "\0" + value "FileVersion", PPS(VER_LEVEL) "\0" + value "ProductVersion", PPS(VER_LEVEL) "\0" + value "OriginalFilename", "SCH.DLL\0" + value "InternalName", "SCH4\0" + value "LegalCopyright", S_CRIGHT " Star Division GmbH\0" + value "LegalTrademarks", + "International CorrectSpell® und International Electronic Thesaurus © " + "1993-1996 Inso Corporation. Alle Rechte vorbehalten.\0" + } +#else + block "040904E4" + { + // International StringTable + value "CompanyName", "Star Division GmbH\0" + value "ProductName", "StarChart for Windows" FOR_WIN_X "\0" + value "FileDescription", "StarChart " S_VERSION "\0" + value "FileVersion", PPS(VER_LEVEL) "\0" + value "ProductVersion", PPS(VER_LEVEL) "\0" + value "OriginalFilename", "SCH.DLL\0" + value "InternalName", "SCH4\0" + value "LegalCopyright", S_CRIGHT " Star Division GmbH\0" + value "LegalTrademarks", + "International CorrectSpell® and International Electronic Thesaurus © " + "1993-1996 Inso Corporation. All rights reserved.\0" + } +#endif + } + + block "VarFileInfo" + { +#ifdef LG_D + value "Translation", 0x0407, 1252 +#else + value "Translation", 0x0409, 1252 +#endif + } + } + +// version binary entry +VS_VERSION_INFO rcdata +{ + 0xF0, "sch", 0x0F, VER_YEAR, VER_MONTH, VER_DAY, + VERSION, SUBVERSION, VERVARIANT, VER_COUNT +}; + |