1*cde9e8dcSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*cde9e8dcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*cde9e8dcSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*cde9e8dcSAndrew Rist * distributed with this work for additional information 6*cde9e8dcSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*cde9e8dcSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*cde9e8dcSAndrew Rist * "License"); you may not use this file except in compliance 9*cde9e8dcSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*cde9e8dcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*cde9e8dcSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*cde9e8dcSAndrew Rist * software distributed under the License is distributed on an 15*cde9e8dcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*cde9e8dcSAndrew Rist * KIND, either express or implied. See the License for the 17*cde9e8dcSAndrew Rist * specific language governing permissions and limitations 18*cde9e8dcSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*cde9e8dcSAndrew Rist *************************************************************/ 21*cde9e8dcSAndrew Rist 22*cde9e8dcSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_chart2.hxx" 26cdf0e10cSrcweir #include "DiagramWrapper.hxx" 27cdf0e10cSrcweir #include "macros.hxx" 28cdf0e10cSrcweir #include "servicenames_charttypes.hxx" 29cdf0e10cSrcweir #include "DataSeriesPointWrapper.hxx" 30cdf0e10cSrcweir #include "AxisWrapper.hxx" 31cdf0e10cSrcweir #include "AxisHelper.hxx" 32cdf0e10cSrcweir #include "Chart2ModelContact.hxx" 33cdf0e10cSrcweir #include "PositionAndSizeHelper.hxx" 34cdf0e10cSrcweir #include "WallFloorWrapper.hxx" 35cdf0e10cSrcweir #include "MinMaxLineWrapper.hxx" 36cdf0e10cSrcweir #include "UpDownBarWrapper.hxx" 37cdf0e10cSrcweir #include "DiagramHelper.hxx" 38cdf0e10cSrcweir #include "DataSourceHelper.hxx" 39cdf0e10cSrcweir #include "ChartModelHelper.hxx" 40cdf0e10cSrcweir #include "WrappedIgnoreProperty.hxx" 41cdf0e10cSrcweir #include "WrappedAxisAndGridExistenceProperties.hxx" 42cdf0e10cSrcweir #include "WrappedStatisticProperties.hxx" 43cdf0e10cSrcweir #include "WrappedSymbolProperties.hxx" 44cdf0e10cSrcweir #include "WrappedDataCaptionProperties.hxx" 45cdf0e10cSrcweir #include "WrappedSplineProperties.hxx" 46cdf0e10cSrcweir #include "WrappedStockProperties.hxx" 47cdf0e10cSrcweir #include "WrappedSceneProperty.hxx" 48cdf0e10cSrcweir #include "RelativePositionHelper.hxx" 49cdf0e10cSrcweir #include "ContainerHelper.hxx" 50cdf0e10cSrcweir #include "ControllerLockGuard.hxx" 51cdf0e10cSrcweir #include "ModifyListenerHelper.hxx" 52cdf0e10cSrcweir #include "DisposeHelper.hxx" 53cdf0e10cSrcweir #include <comphelper/InlineContainer.hxx> 54cdf0e10cSrcweir #include "WrappedAutomaticPositionProperties.hxx" 55cdf0e10cSrcweir #include "CommonConverters.hxx" 56cdf0e10cSrcweir 57cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 58cdf0e10cSrcweir #include <com/sun/star/chart2/XTitled.hpp> 59cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp> 60cdf0e10cSrcweir #include <com/sun/star/chart2/RelativeSize.hpp> 61cdf0e10cSrcweir #include <com/sun/star/chart2/RelativePosition.hpp> 62cdf0e10cSrcweir #include <com/sun/star/chart/ChartSolidType.hpp> 63cdf0e10cSrcweir 64cdf0e10cSrcweir #include "LineProperties.hxx" 65cdf0e10cSrcweir #include "FillProperties.hxx" 66cdf0e10cSrcweir #include "UserDefinedProperties.hxx" 67cdf0e10cSrcweir #include "SceneProperties.hxx" 68cdf0e10cSrcweir 69cdf0e10cSrcweir #include <map> 70cdf0e10cSrcweir #include <algorithm> 71cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 72cdf0e10cSrcweir // header for define DBG_ERROR 73cdf0e10cSrcweir #include <tools/debug.hxx> 74cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp> 75cdf0e10cSrcweir #include <com/sun/star/util/XRefreshable.hpp> 76cdf0e10cSrcweir 77cdf0e10cSrcweir using namespace ::com::sun::star; 78cdf0e10cSrcweir using namespace ::chart::wrapper; 79cdf0e10cSrcweir 80cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 81cdf0e10cSrcweir using ::com::sun::star::uno::Any; 82cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 83cdf0e10cSrcweir using ::com::sun::star::beans::Property; 84cdf0e10cSrcweir using ::com::sun::star::chart::XAxis; 85cdf0e10cSrcweir using ::osl::MutexGuard; 86cdf0e10cSrcweir using ::rtl::OUString; 87cdf0e10cSrcweir 88cdf0e10cSrcweir namespace 89cdf0e10cSrcweir { 90cdf0e10cSrcweir static const OUString lcl_aServiceName( 91cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Diagram" )); 92cdf0e10cSrcweir 93cdf0e10cSrcweir enum 94cdf0e10cSrcweir { 95cdf0e10cSrcweir PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS, 96cdf0e10cSrcweir PROP_DIAGRAM_PERCENT_STACKED, 97cdf0e10cSrcweir PROP_DIAGRAM_STACKED, 98cdf0e10cSrcweir PROP_DIAGRAM_THREE_D, 99cdf0e10cSrcweir PROP_DIAGRAM_SOLIDTYPE, 100cdf0e10cSrcweir PROP_DIAGRAM_DEEP, 101cdf0e10cSrcweir PROP_DIAGRAM_VERTICAL, 102cdf0e10cSrcweir PROP_DIAGRAM_NUMBER_OF_LINES, 103cdf0e10cSrcweir PROP_DIAGRAM_STACKED_BARS_CONNECTED, 104cdf0e10cSrcweir PROP_DIAGRAM_DATAROW_SOURCE, 105cdf0e10cSrcweir 106cdf0e10cSrcweir PROP_DIAGRAM_GROUP_BARS_PER_AXIS, 107cdf0e10cSrcweir PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, 108cdf0e10cSrcweir 109cdf0e10cSrcweir PROP_DIAGRAM_SORT_BY_X_VALUES, 110cdf0e10cSrcweir 111cdf0e10cSrcweir PROP_DIAGRAM_STARTING_ANGLE, 112cdf0e10cSrcweir 113cdf0e10cSrcweir PROP_DIAGRAM_RIGHT_ANGLED_AXES, 114cdf0e10cSrcweir PROP_DIAGRAM_PERSPECTIVE, 115cdf0e10cSrcweir PROP_DIAGRAM_ROTATION_HORIZONTAL, 116cdf0e10cSrcweir PROP_DIAGRAM_ROTATION_VERTICAL, 117cdf0e10cSrcweir 118cdf0e10cSrcweir PROP_DIAGRAM_MISSING_VALUE_TREATMENT, 119cdf0e10cSrcweir 120cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS, 121cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_DESCR, 122cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_TITLE, 123cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_GRID, 124cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID, 125cdf0e10cSrcweir 126cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS, 127cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_DESCR, 128cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_TITLE, 129cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_GRID, 130cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID, 131cdf0e10cSrcweir 132cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS, 133cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_DESCR, 134cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_TITLE, 135cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_GRID, 136cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID, 137cdf0e10cSrcweir 138cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_X_AXIS, 139cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR, 140cdf0e10cSrcweir 141cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_Y_AXIS, 142cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR, 143cdf0e10cSrcweir 144cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE, 145cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE, 146cdf0e10cSrcweir 147cdf0e10cSrcweir PROP_DIAGRAM_AUTOMATIC_SIZE 148cdf0e10cSrcweir }; 149cdf0e10cSrcweir 150cdf0e10cSrcweir void lcl_AddPropertiesToVector( 151cdf0e10cSrcweir ::std::vector< Property > & rOutProperties ) 152cdf0e10cSrcweir { 153cdf0e10cSrcweir rOutProperties.push_back( 154cdf0e10cSrcweir Property( C2U( "AttributedDataPoints" ), 155cdf0e10cSrcweir PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS, 156cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const uno::Sequence< uno::Sequence< sal_Int32 > > * >(0)), 157cdf0e10cSrcweir beans::PropertyAttribute::BOUND 158cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID )); 159cdf0e10cSrcweir 160cdf0e10cSrcweir // see com.sun.star.chart.StackableDiagram 161cdf0e10cSrcweir rOutProperties.push_back( 162cdf0e10cSrcweir Property( C2U( "Percent" ), 163cdf0e10cSrcweir PROP_DIAGRAM_PERCENT_STACKED, 164cdf0e10cSrcweir ::getBooleanCppuType(), 165cdf0e10cSrcweir beans::PropertyAttribute::BOUND 166cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 167cdf0e10cSrcweir rOutProperties.push_back( 168cdf0e10cSrcweir Property( C2U( "Stacked" ), 169cdf0e10cSrcweir PROP_DIAGRAM_STACKED, 170cdf0e10cSrcweir ::getBooleanCppuType(), 171cdf0e10cSrcweir beans::PropertyAttribute::BOUND 172cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 173cdf0e10cSrcweir 174cdf0e10cSrcweir rOutProperties.push_back( 175cdf0e10cSrcweir Property( C2U( "Dim3D" ), 176cdf0e10cSrcweir PROP_DIAGRAM_THREE_D, 177cdf0e10cSrcweir ::getBooleanCppuType(), 178cdf0e10cSrcweir beans::PropertyAttribute::BOUND 179cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 180cdf0e10cSrcweir 181cdf0e10cSrcweir // see com.sun.star.chart.Chart3DBarProperties 182cdf0e10cSrcweir rOutProperties.push_back( 183cdf0e10cSrcweir Property( C2U( "SolidType" ), 184cdf0e10cSrcweir PROP_DIAGRAM_SOLIDTYPE, 185cdf0e10cSrcweir ::getCppuType( reinterpret_cast< sal_Int32 * >(0)), 186cdf0e10cSrcweir beans::PropertyAttribute::BOUND 187cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 188cdf0e10cSrcweir 189cdf0e10cSrcweir // see com.sun.star.chart.BarDiagram 190cdf0e10cSrcweir rOutProperties.push_back( 191cdf0e10cSrcweir Property( C2U( "Deep" ), 192cdf0e10cSrcweir PROP_DIAGRAM_DEEP, 193cdf0e10cSrcweir ::getBooleanCppuType(), 194cdf0e10cSrcweir beans::PropertyAttribute::BOUND 195cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 196cdf0e10cSrcweir rOutProperties.push_back( 197cdf0e10cSrcweir Property( C2U( "Vertical" ), 198cdf0e10cSrcweir PROP_DIAGRAM_VERTICAL, 199cdf0e10cSrcweir ::getBooleanCppuType(), 200cdf0e10cSrcweir beans::PropertyAttribute::BOUND 201cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 202cdf0e10cSrcweir rOutProperties.push_back( 203cdf0e10cSrcweir Property( C2U( "NumberOfLines" ), 204cdf0e10cSrcweir PROP_DIAGRAM_NUMBER_OF_LINES, 205cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 206cdf0e10cSrcweir beans::PropertyAttribute::BOUND 207cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 208cdf0e10cSrcweir rOutProperties.push_back( 209cdf0e10cSrcweir Property( C2U( "StackedBarsConnected" ), 210cdf0e10cSrcweir PROP_DIAGRAM_STACKED_BARS_CONNECTED, 211cdf0e10cSrcweir ::getBooleanCppuType(), 212cdf0e10cSrcweir beans::PropertyAttribute::BOUND 213cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 214cdf0e10cSrcweir 215cdf0e10cSrcweir rOutProperties.push_back( 216cdf0e10cSrcweir Property( C2U( "DataRowSource" ), 217cdf0e10cSrcweir PROP_DIAGRAM_DATAROW_SOURCE, 218cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartDataRowSource * >(0)), 219cdf0e10cSrcweir beans::PropertyAttribute::BOUND 220cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 221cdf0e10cSrcweir 222cdf0e10cSrcweir rOutProperties.push_back( 223cdf0e10cSrcweir Property( C2U( "GroupBarsPerAxis" ), 224cdf0e10cSrcweir PROP_DIAGRAM_GROUP_BARS_PER_AXIS, 225cdf0e10cSrcweir ::getBooleanCppuType(), 226cdf0e10cSrcweir beans::PropertyAttribute::BOUND 227cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 228cdf0e10cSrcweir 229cdf0e10cSrcweir rOutProperties.push_back( 230cdf0e10cSrcweir Property( C2U( "IncludeHiddenCells" ), 231cdf0e10cSrcweir PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, 232cdf0e10cSrcweir ::getBooleanCppuType(), 233cdf0e10cSrcweir beans::PropertyAttribute::BOUND 234cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 235cdf0e10cSrcweir 236cdf0e10cSrcweir //new for XY charts 237cdf0e10cSrcweir rOutProperties.push_back( 238cdf0e10cSrcweir Property( C2U( "SortByXValues" ), 239cdf0e10cSrcweir PROP_DIAGRAM_SORT_BY_X_VALUES, 240cdf0e10cSrcweir ::getBooleanCppuType(), 241cdf0e10cSrcweir beans::PropertyAttribute::BOUND 242cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 243cdf0e10cSrcweir 244cdf0e10cSrcweir //for pie and donut charts 245cdf0e10cSrcweir rOutProperties.push_back( 246cdf0e10cSrcweir Property( C2U( "StartingAngle" ), 247cdf0e10cSrcweir PROP_DIAGRAM_STARTING_ANGLE, 248cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ), 249cdf0e10cSrcweir beans::PropertyAttribute::BOUND 250cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 251cdf0e10cSrcweir 252cdf0e10cSrcweir //new for 3D charts 253cdf0e10cSrcweir rOutProperties.push_back( 254cdf0e10cSrcweir Property( C2U("RightAngledAxes"), 255cdf0e10cSrcweir PROP_DIAGRAM_RIGHT_ANGLED_AXES, 256cdf0e10cSrcweir ::getBooleanCppuType(), 257cdf0e10cSrcweir beans::PropertyAttribute::BOUND 258cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 259cdf0e10cSrcweir 260cdf0e10cSrcweir rOutProperties.push_back( 261cdf0e10cSrcweir Property( C2U("Perspective"), 262cdf0e10cSrcweir PROP_DIAGRAM_PERSPECTIVE, 263cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 264cdf0e10cSrcweir beans::PropertyAttribute::MAYBEVOID )); 265cdf0e10cSrcweir 266cdf0e10cSrcweir rOutProperties.push_back( 267cdf0e10cSrcweir Property( C2U("RotationHorizontal"), 268cdf0e10cSrcweir PROP_DIAGRAM_ROTATION_HORIZONTAL, 269cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 270cdf0e10cSrcweir beans::PropertyAttribute::MAYBEVOID )); 271cdf0e10cSrcweir 272cdf0e10cSrcweir rOutProperties.push_back( 273cdf0e10cSrcweir Property( C2U("RotationVertical"), 274cdf0e10cSrcweir PROP_DIAGRAM_ROTATION_VERTICAL, 275cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 276cdf0e10cSrcweir beans::PropertyAttribute::MAYBEVOID )); 277cdf0e10cSrcweir 278cdf0e10cSrcweir // XAxisXSupplier 279cdf0e10cSrcweir rOutProperties.push_back( 280cdf0e10cSrcweir Property( C2U( "HasXAxis" ), 281cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS, 282cdf0e10cSrcweir ::getBooleanCppuType(), 283cdf0e10cSrcweir beans::PropertyAttribute::BOUND 284cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 285cdf0e10cSrcweir rOutProperties.push_back( 286cdf0e10cSrcweir Property( C2U( "HasXAxisDescription" ), 287cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_DESCR, 288cdf0e10cSrcweir ::getBooleanCppuType(), 289cdf0e10cSrcweir beans::PropertyAttribute::BOUND 290cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 291cdf0e10cSrcweir rOutProperties.push_back( 292cdf0e10cSrcweir Property( C2U( "HasXAxisTitle" ), 293cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_TITLE, 294cdf0e10cSrcweir ::getBooleanCppuType(), 295cdf0e10cSrcweir beans::PropertyAttribute::BOUND 296cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 297cdf0e10cSrcweir rOutProperties.push_back( 298cdf0e10cSrcweir Property( C2U( "HasXAxisGrid" ), 299cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_GRID, 300cdf0e10cSrcweir ::getBooleanCppuType(), 301cdf0e10cSrcweir beans::PropertyAttribute::BOUND 302cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 303cdf0e10cSrcweir rOutProperties.push_back( 304cdf0e10cSrcweir Property( C2U( "HasXAxisHelpGrid" ), 305cdf0e10cSrcweir PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID, 306cdf0e10cSrcweir ::getBooleanCppuType(), 307cdf0e10cSrcweir beans::PropertyAttribute::BOUND 308cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 309cdf0e10cSrcweir 310cdf0e10cSrcweir // XAxisYSupplier 311cdf0e10cSrcweir rOutProperties.push_back( 312cdf0e10cSrcweir Property( C2U( "HasYAxis" ), 313cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS, 314cdf0e10cSrcweir ::getBooleanCppuType(), 315cdf0e10cSrcweir beans::PropertyAttribute::BOUND 316cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 317cdf0e10cSrcweir rOutProperties.push_back( 318cdf0e10cSrcweir Property( C2U( "HasYAxisDescription" ), 319cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_DESCR, 320cdf0e10cSrcweir ::getBooleanCppuType(), 321cdf0e10cSrcweir beans::PropertyAttribute::BOUND 322cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 323cdf0e10cSrcweir rOutProperties.push_back( 324cdf0e10cSrcweir Property( C2U( "HasYAxisTitle" ), 325cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_TITLE, 326cdf0e10cSrcweir ::getBooleanCppuType(), 327cdf0e10cSrcweir beans::PropertyAttribute::BOUND 328cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 329cdf0e10cSrcweir rOutProperties.push_back( 330cdf0e10cSrcweir Property( C2U( "HasYAxisGrid" ), 331cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_GRID, 332cdf0e10cSrcweir ::getBooleanCppuType(), 333cdf0e10cSrcweir beans::PropertyAttribute::BOUND 334cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 335cdf0e10cSrcweir rOutProperties.push_back( 336cdf0e10cSrcweir Property( C2U( "HasYAxisHelpGrid" ), 337cdf0e10cSrcweir PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID, 338cdf0e10cSrcweir ::getBooleanCppuType(), 339cdf0e10cSrcweir beans::PropertyAttribute::BOUND 340cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 341cdf0e10cSrcweir 342cdf0e10cSrcweir // XAxisZSupplier 343cdf0e10cSrcweir rOutProperties.push_back( 344cdf0e10cSrcweir Property( C2U( "HasZAxis" ), 345cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS, 346cdf0e10cSrcweir ::getBooleanCppuType(), 347cdf0e10cSrcweir beans::PropertyAttribute::BOUND 348cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 349cdf0e10cSrcweir rOutProperties.push_back( 350cdf0e10cSrcweir Property( C2U( "HasZAxisDescription" ), 351cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_DESCR, 352cdf0e10cSrcweir ::getBooleanCppuType(), 353cdf0e10cSrcweir beans::PropertyAttribute::BOUND 354cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 355cdf0e10cSrcweir rOutProperties.push_back( 356cdf0e10cSrcweir Property( C2U( "HasZAxisTitle" ), 357cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_TITLE, 358cdf0e10cSrcweir ::getBooleanCppuType(), 359cdf0e10cSrcweir beans::PropertyAttribute::BOUND 360cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 361cdf0e10cSrcweir rOutProperties.push_back( 362cdf0e10cSrcweir Property( C2U( "HasZAxisGrid" ), 363cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_GRID, 364cdf0e10cSrcweir ::getBooleanCppuType(), 365cdf0e10cSrcweir beans::PropertyAttribute::BOUND 366cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 367cdf0e10cSrcweir rOutProperties.push_back( 368cdf0e10cSrcweir Property( C2U( "HasZAxisHelpGrid" ), 369cdf0e10cSrcweir PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID, 370cdf0e10cSrcweir ::getBooleanCppuType(), 371cdf0e10cSrcweir beans::PropertyAttribute::BOUND 372cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 373cdf0e10cSrcweir 374cdf0e10cSrcweir // XTwoAxisXSupplier 375cdf0e10cSrcweir rOutProperties.push_back( 376cdf0e10cSrcweir Property( C2U( "HasSecondaryXAxis" ), 377cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_X_AXIS, 378cdf0e10cSrcweir ::getBooleanCppuType(), 379cdf0e10cSrcweir beans::PropertyAttribute::BOUND 380cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 381cdf0e10cSrcweir rOutProperties.push_back( 382cdf0e10cSrcweir Property( C2U( "HasSecondaryXAxisDescription" ), 383cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR, 384cdf0e10cSrcweir ::getBooleanCppuType(), 385cdf0e10cSrcweir beans::PropertyAttribute::BOUND 386cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 387cdf0e10cSrcweir 388cdf0e10cSrcweir // XTwoAxisYSupplier 389cdf0e10cSrcweir rOutProperties.push_back( 390cdf0e10cSrcweir Property( C2U( "HasSecondaryYAxis" ), 391cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_Y_AXIS, 392cdf0e10cSrcweir ::getBooleanCppuType(), 393cdf0e10cSrcweir beans::PropertyAttribute::BOUND 394cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 395cdf0e10cSrcweir rOutProperties.push_back( 396cdf0e10cSrcweir Property( C2U( "HasSecondaryYAxisDescription" ), 397cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR, 398cdf0e10cSrcweir ::getBooleanCppuType(), 399cdf0e10cSrcweir beans::PropertyAttribute::BOUND 400cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 401cdf0e10cSrcweir 402cdf0e10cSrcweir // XSecondAxisTitleSupplier 403cdf0e10cSrcweir rOutProperties.push_back( 404cdf0e10cSrcweir Property( C2U( "HasSecondaryXAxisTitle" ), 405cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE, 406cdf0e10cSrcweir ::getBooleanCppuType(), 407cdf0e10cSrcweir beans::PropertyAttribute::BOUND 408cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 409cdf0e10cSrcweir rOutProperties.push_back( 410cdf0e10cSrcweir Property( C2U( "HasSecondaryYAxisTitle" ), 411cdf0e10cSrcweir PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE, 412cdf0e10cSrcweir ::getBooleanCppuType(), 413cdf0e10cSrcweir beans::PropertyAttribute::BOUND 414cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 415cdf0e10cSrcweir 416cdf0e10cSrcweir rOutProperties.push_back( 417cdf0e10cSrcweir Property( C2U( "MissingValueTreatment" ), 418cdf0e10cSrcweir PROP_DIAGRAM_MISSING_VALUE_TREATMENT, 419cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), 420cdf0e10cSrcweir beans::PropertyAttribute::BOUND 421cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEVOID )); 422cdf0e10cSrcweir 423cdf0e10cSrcweir rOutProperties.push_back( 424cdf0e10cSrcweir Property( C2U( "AutomaticSize" ), 425cdf0e10cSrcweir PROP_DIAGRAM_AUTOMATIC_SIZE, 426cdf0e10cSrcweir ::getBooleanCppuType(), 427cdf0e10cSrcweir beans::PropertyAttribute::BOUND 428cdf0e10cSrcweir | beans::PropertyAttribute::MAYBEDEFAULT )); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir struct StaticDiagramWrapperPropertyArray_Initializer 432cdf0e10cSrcweir { 433cdf0e10cSrcweir Sequence< Property >* operator()() 434cdf0e10cSrcweir { 435cdf0e10cSrcweir static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); 436cdf0e10cSrcweir return &aPropSeq; 437cdf0e10cSrcweir } 438cdf0e10cSrcweir 439cdf0e10cSrcweir private: 440cdf0e10cSrcweir uno::Sequence< Property > lcl_GetPropertySequence() 441cdf0e10cSrcweir { 442cdf0e10cSrcweir ::std::vector< ::com::sun::star::beans::Property > aProperties; 443cdf0e10cSrcweir lcl_AddPropertiesToVector( aProperties ); 444cdf0e10cSrcweir ::chart::LineProperties::AddPropertiesToVector( aProperties ); 445cdf0e10cSrcweir ::chart::FillProperties::AddPropertiesToVector( aProperties ); 446cdf0e10cSrcweir ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); 447cdf0e10cSrcweir ::chart::SceneProperties::AddPropertiesToVector( aProperties ); 448cdf0e10cSrcweir WrappedStatisticProperties::addProperties( aProperties ); 449cdf0e10cSrcweir WrappedSymbolProperties::addProperties( aProperties ); 450cdf0e10cSrcweir WrappedDataCaptionProperties::addProperties( aProperties ); 451cdf0e10cSrcweir WrappedSplineProperties::addProperties( aProperties ); 452cdf0e10cSrcweir WrappedStockProperties::addProperties( aProperties ); 453cdf0e10cSrcweir WrappedAutomaticPositionProperties::addProperties( aProperties ); 454cdf0e10cSrcweir 455cdf0e10cSrcweir ::std::sort( aProperties.begin(), aProperties.end(), 456cdf0e10cSrcweir ::chart::PropertyNameLess() ); 457cdf0e10cSrcweir 458cdf0e10cSrcweir return ::chart::ContainerHelper::ContainerToSequence( aProperties ); 459cdf0e10cSrcweir } 460cdf0e10cSrcweir }; 461cdf0e10cSrcweir 462cdf0e10cSrcweir struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer > 463cdf0e10cSrcweir { 464cdf0e10cSrcweir }; 465cdf0e10cSrcweir 466cdf0e10cSrcweir bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram ) 467cdf0e10cSrcweir { 468cdf0e10cSrcweir bool bRet = false; 469cdf0e10cSrcweir Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); 470cdf0e10cSrcweir if( xChartType.is() ) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir rtl::OUString aChartType( xChartType->getChartType() ); 473cdf0e10cSrcweir if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) ) 474cdf0e10cSrcweir bRet = true; 475cdf0e10cSrcweir } 476cdf0e10cSrcweir return bRet; 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir sal_Int32 lcl_getNewAPIIndexForOldAPIIndex( 480cdf0e10cSrcweir sal_Int32 nOldAPIIndex 481cdf0e10cSrcweir , Reference< chart2::XDiagram > xDiagram ) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir sal_Int32 nNewAPIIndex = nOldAPIIndex; 484cdf0e10cSrcweir 485cdf0e10cSrcweir if( lcl_isXYChart( xDiagram ) ) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir if( nNewAPIIndex >= 1 ) 488cdf0e10cSrcweir nNewAPIIndex -= 1; 489cdf0e10cSrcweir } 490cdf0e10cSrcweir 491cdf0e10cSrcweir ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList( 492cdf0e10cSrcweir ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); 493cdf0e10cSrcweir if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) ) 494cdf0e10cSrcweir nNewAPIIndex = -1; 495cdf0e10cSrcweir 496cdf0e10cSrcweir return nNewAPIIndex; 497cdf0e10cSrcweir } 498cdf0e10cSrcweir 499cdf0e10cSrcweir typedef ::std::map< OUString, OUString > tChartTypeMap; 500cdf0e10cSrcweir 501cdf0e10cSrcweir OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir const OUString aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.template.")); 504cdf0e10cSrcweir 505cdf0e10cSrcweir if( rTemplateServiceName.match( aPrefix )) 506cdf0e10cSrcweir { 507cdf0e10cSrcweir const OUString aName( rTemplateServiceName.copy( aPrefix.getLength())); 508cdf0e10cSrcweir 509cdf0e10cSrcweir // "Area" "StackedArea" "PercentStackedArea" "ThreeDArea" 510cdf0e10cSrcweir // "StackedThreeDArea" "PercentStackedThreeDArea" 511cdf0e10cSrcweir if( aName.indexOf( C2U("Area") ) != -1 ) 512cdf0e10cSrcweir return C2U( "com.sun.star.chart.AreaDiagram" ); 513cdf0e10cSrcweir 514cdf0e10cSrcweir // "Pie" "PieAllExploded" "ThreeDPie" "ThreeDPieAllExploded" 515cdf0e10cSrcweir if( aName.indexOf( C2U("Pie") ) != -1 ) 516cdf0e10cSrcweir return C2U( "com.sun.star.chart.PieDiagram" ); 517cdf0e10cSrcweir 518cdf0e10cSrcweir // "Column" "StackedColumn" "PercentStackedColumn" "ThreeDColumnDeep" 519cdf0e10cSrcweir // "ThreeDColumnFlat" "StackedThreeDColumnFlat" 520cdf0e10cSrcweir // "PercentStackedThreeDColumnFlat" "Bar" "StackedBar" 521cdf0e10cSrcweir // "PercentStackedBar" "ThreeDBarDeep" "ThreeDBarFlat" 522cdf0e10cSrcweir // "StackedThreeDBarFlat" "PercentStackedThreeDBarFlat" "ColumnWithLine" 523cdf0e10cSrcweir // "StackedColumnWithLine" 524cdf0e10cSrcweir if( aName.indexOf( C2U("Column") ) != -1 || aName.indexOf( C2U("Bar") ) != -1 ) 525cdf0e10cSrcweir return C2U( "com.sun.star.chart.BarDiagram" ); 526cdf0e10cSrcweir 527cdf0e10cSrcweir // "Donut" "DonutAllExploded" "ThreeDDonut" "ThreeDDonutAllExploded" 528cdf0e10cSrcweir if( aName.indexOf( C2U("Donut") ) != -1 ) 529cdf0e10cSrcweir return C2U( "com.sun.star.chart.DonutDiagram" ); 530cdf0e10cSrcweir 531cdf0e10cSrcweir // "ScatterLineSymbol" "ScatterLine" "ScatterSymbol" "ThreeDScatter" 532cdf0e10cSrcweir if( aName.indexOf( C2U("Scatter") ) != -1 ) 533cdf0e10cSrcweir return C2U( "com.sun.star.chart.XYDiagram" ); 534cdf0e10cSrcweir 535cdf0e10cSrcweir // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet" 536cdf0e10cSrcweir if( aName.indexOf( C2U("FilledNet") ) != -1 ) 537cdf0e10cSrcweir return C2U( "com.sun.star.chart.FilledNetDiagram" ); 538cdf0e10cSrcweir 539cdf0e10cSrcweir // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol" 540cdf0e10cSrcweir // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol" 541cdf0e10cSrcweir // "PercentStackedNetLine" 542cdf0e10cSrcweir if( aName.indexOf( C2U("Net") ) != -1 ) 543cdf0e10cSrcweir return C2U( "com.sun.star.chart.NetDiagram" ); 544cdf0e10cSrcweir 545cdf0e10cSrcweir // "StockLowHighClose" "StockOpenLowHighClose" "StockVolumeLowHighClose" 546cdf0e10cSrcweir // "StockVolumeOpenLowHighClose" 547cdf0e10cSrcweir if( aName.indexOf( C2U("Stock") ) != -1 ) 548cdf0e10cSrcweir return C2U( "com.sun.star.chart.StockDiagram" ); 549cdf0e10cSrcweir 550cdf0e10cSrcweir if( aName.indexOf( C2U("Bubble") ) != -1 ) 551cdf0e10cSrcweir return C2U( "com.sun.star.chart.BubbleDiagram" ); 552cdf0e10cSrcweir 553cdf0e10cSrcweir // Note: this must be checked after Bar, Net and Scatter 554cdf0e10cSrcweir 555cdf0e10cSrcweir // "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine" 556cdf0e10cSrcweir // "PercentStackedLine" "LineSymbol" "StackedLineSymbol" 557cdf0e10cSrcweir // "PercentStackedLineSymbol" "ThreeDLine" "StackedThreeDLine" 558cdf0e10cSrcweir // "PercentStackedThreeDLine" "ThreeDLineDeep" 559cdf0e10cSrcweir if( aName.indexOf( C2U("Line") ) != -1 || aName.indexOf( C2U("Symbol") ) != -1 ) 560cdf0e10cSrcweir return C2U( "com.sun.star.chart.LineDiagram" ); 561cdf0e10cSrcweir 562cdf0e10cSrcweir OSL_ENSURE( false, "unknown template" ); 563cdf0e10cSrcweir } 564cdf0e10cSrcweir 565cdf0e10cSrcweir return OUString(); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir 568cdf0e10cSrcweir typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap; 569cdf0e10cSrcweir const tMakeStringStringMap& lcl_getChartTypeNameMap() 570cdf0e10cSrcweir { 571cdf0e10cSrcweir static tMakeStringStringMap g_aChartTypeNameMap = 572cdf0e10cSrcweir tMakeStringStringMap 573cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.LineChartType" ) 574cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.LineDiagram" ) ) 575cdf0e10cSrcweir 576cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.AreaChartType" ) 577cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.AreaDiagram" ) ) 578cdf0e10cSrcweir 579cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ColumnChartType" ) 580cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BarDiagram" ) ) 581cdf0e10cSrcweir 582cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.PieChartType" ) 583cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.PieDiagram" ) ) 584cdf0e10cSrcweir 585cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.DonutChartType" ) 586cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.DonutDiagram" ) ) 587cdf0e10cSrcweir 588cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" ) 589cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) ) 590cdf0e10cSrcweir 591cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" ) 592cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) ) 593cdf0e10cSrcweir 594cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" ) 595cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) ) 596cdf0e10cSrcweir 597cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" ) 598cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" ) ) 599cdf0e10cSrcweir 600cdf0e10cSrcweir ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" ) 601cdf0e10cSrcweir , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" ) ) 602cdf0e10cSrcweir 603cdf0e10cSrcweir ; 604cdf0e10cSrcweir return g_aChartTypeNameMap; 605cdf0e10cSrcweir } 606cdf0e10cSrcweir 607cdf0e10cSrcweir 608cdf0e10cSrcweir OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName ) 609cdf0e10cSrcweir { 610cdf0e10cSrcweir OUString aOld(rNewChartTypeName); 611cdf0e10cSrcweir 612cdf0e10cSrcweir const tMakeStringStringMap& rMap = lcl_getChartTypeNameMap(); 613cdf0e10cSrcweir tMakeStringStringMap::const_iterator aIt( rMap.find( rNewChartTypeName )); 614cdf0e10cSrcweir if( aIt != rMap.end()) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir aOld = aIt->second; 617cdf0e10cSrcweir } 618cdf0e10cSrcweir return aOld; 619cdf0e10cSrcweir } 620cdf0e10cSrcweir 621cdf0e10cSrcweir } // anonymous namespace 622cdf0e10cSrcweir 623cdf0e10cSrcweir // -------------------------------------------------------------------------------- 624cdf0e10cSrcweir 625cdf0e10cSrcweir namespace chart 626cdf0e10cSrcweir { 627cdf0e10cSrcweir namespace wrapper 628cdf0e10cSrcweir { 629cdf0e10cSrcweir 630cdf0e10cSrcweir DiagramWrapper::DiagramWrapper( 631cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) : 632cdf0e10cSrcweir m_spChart2ModelContact( spChart2ModelContact ), 633cdf0e10cSrcweir m_aEventListenerContainer( m_aMutex ) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir } 636cdf0e10cSrcweir 637cdf0e10cSrcweir DiagramWrapper::~DiagramWrapper() 638cdf0e10cSrcweir {} 639cdf0e10cSrcweir 640cdf0e10cSrcweir // ____ XDiagram ____ 641cdf0e10cSrcweir OUString SAL_CALL DiagramWrapper::getDiagramType() 642cdf0e10cSrcweir throw (uno::RuntimeException) 643cdf0e10cSrcweir { 644cdf0e10cSrcweir OUString aRet; 645cdf0e10cSrcweir 646cdf0e10cSrcweir Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); 647cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 648cdf0e10cSrcweir if( xChartDoc.is() && xDiagram.is() ) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir Reference< beans::XPropertySet > xChartDocProp( xChartDoc, uno::UNO_QUERY ); 651cdf0e10cSrcweir if( xChartDocProp.is() ) 652cdf0e10cSrcweir { 653cdf0e10cSrcweir uno::Reference< util::XRefreshable > xAddIn; 654cdf0e10cSrcweir if( xChartDocProp->getPropertyValue( C2U( "AddIn" ) ) >>= xAddIn ) 655cdf0e10cSrcweir { 656cdf0e10cSrcweir uno::Reference< lang::XServiceName > xServiceName( xAddIn, uno::UNO_QUERY ); 657cdf0e10cSrcweir if( xServiceName.is()) 658cdf0e10cSrcweir return xServiceName->getServiceName(); 659cdf0e10cSrcweir } 660cdf0e10cSrcweir } 661cdf0e10cSrcweir 662cdf0e10cSrcweir Reference< lang::XMultiServiceFactory > xChartTypeManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); 663cdf0e10cSrcweir DiagramHelper::tTemplateWithServiceName aTemplateAndService = 664cdf0e10cSrcweir DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager ); 665cdf0e10cSrcweir 666cdf0e10cSrcweir aRet = lcl_getDiagramType( aTemplateAndService.second ); 667cdf0e10cSrcweir } 668cdf0e10cSrcweir 669cdf0e10cSrcweir if( !aRet.getLength()) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir // none of the standard templates matched 672cdf0e10cSrcweir // use first chart type 673cdf0e10cSrcweir Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); 674cdf0e10cSrcweir if( xChartType.is() ) 675cdf0e10cSrcweir { 676cdf0e10cSrcweir aRet = xChartType->getChartType(); 677cdf0e10cSrcweir if( aRet.getLength() ) 678cdf0e10cSrcweir aRet = lcl_getOldChartTypeName( aRet ); 679cdf0e10cSrcweir } 680cdf0e10cSrcweir if( !aRet.getLength()) 681cdf0e10cSrcweir aRet = C2U( "com.sun.star.chart.BarDiagram" ); 682cdf0e10cSrcweir } 683cdf0e10cSrcweir 684cdf0e10cSrcweir return aRet; 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir Reference< 688cdf0e10cSrcweir beans::XPropertySet > SAL_CALL DiagramWrapper::getDataRowProperties( sal_Int32 nRow ) 689cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, 690cdf0e10cSrcweir uno::RuntimeException) 691cdf0e10cSrcweir { 692cdf0e10cSrcweir if( nRow < 0 ) 693cdf0e10cSrcweir throw lang::IndexOutOfBoundsException( 694cdf0e10cSrcweir C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this )); 695cdf0e10cSrcweir 696cdf0e10cSrcweir Reference< chart2::XDataSeries > xSeries; 697cdf0e10cSrcweir 698cdf0e10cSrcweir sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() ); 699cdf0e10cSrcweir if( nNewAPIIndex < 0 ) 700cdf0e10cSrcweir throw lang::IndexOutOfBoundsException( 701cdf0e10cSrcweir C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this )); 702cdf0e10cSrcweir 703cdf0e10cSrcweir Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper( 704cdf0e10cSrcweir DataSeriesPointWrapper::DATA_SERIES, nNewAPIIndex, 0, m_spChart2ModelContact ) ); 705cdf0e10cSrcweir return xRet; 706cdf0e10cSrcweir } 707cdf0e10cSrcweir 708cdf0e10cSrcweir Reference< 709cdf0e10cSrcweir beans::XPropertySet > SAL_CALL DiagramWrapper::getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow ) 710cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, 711cdf0e10cSrcweir uno::RuntimeException) 712cdf0e10cSrcweir { 713cdf0e10cSrcweir if( nCol < 0 || nRow < 0 ) 714cdf0e10cSrcweir throw lang::IndexOutOfBoundsException( 715cdf0e10cSrcweir C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this )); 716cdf0e10cSrcweir 717cdf0e10cSrcweir Reference< chart2::XDataSeries > xSeries; 718cdf0e10cSrcweir 719cdf0e10cSrcweir sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() ); 720cdf0e10cSrcweir if( nNewAPIIndex < 0 ) 721cdf0e10cSrcweir throw lang::IndexOutOfBoundsException( 722cdf0e10cSrcweir C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this )); 723cdf0e10cSrcweir 724cdf0e10cSrcweir //todo: check borders of point index 725cdf0e10cSrcweir 726cdf0e10cSrcweir Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper( 727cdf0e10cSrcweir DataSeriesPointWrapper::DATA_POINT, nNewAPIIndex, nCol, m_spChart2ModelContact ) ); 728cdf0e10cSrcweir 729cdf0e10cSrcweir return xRet; 730cdf0e10cSrcweir } 731cdf0e10cSrcweir 732cdf0e10cSrcweir // ____ XShape (base of XDiagram) ____ 733cdf0e10cSrcweir awt::Point SAL_CALL DiagramWrapper::getPosition() 734cdf0e10cSrcweir throw (uno::RuntimeException) 735cdf0e10cSrcweir { 736cdf0e10cSrcweir awt::Point aPosition = ToPoint( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() ); 737cdf0e10cSrcweir return aPosition; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition ) 741cdf0e10cSrcweir throw (uno::RuntimeException) 742cdf0e10cSrcweir { 743cdf0e10cSrcweir ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 744cdf0e10cSrcweir Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); 745cdf0e10cSrcweir if( xProp.is() ) 746cdf0e10cSrcweir { 747cdf0e10cSrcweir awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() ); 748cdf0e10cSrcweir 749cdf0e10cSrcweir chart2::RelativePosition aRelativePosition; 750cdf0e10cSrcweir aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT; 751cdf0e10cSrcweir aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width); 752cdf0e10cSrcweir aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height); 753cdf0e10cSrcweir if( aRelativePosition.Primary < 0 || aRelativePosition.Secondary < 0 || aRelativePosition.Primary > 1 || aRelativePosition.Secondary > 1 ) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir DBG_ERROR("DiagramWrapper::setPosition called with a position out of range -> automatic values are taken instead" ); 756cdf0e10cSrcweir uno::Any aEmpty; 757cdf0e10cSrcweir xProp->setPropertyValue( C2U( "RelativePosition" ), aEmpty ); 758cdf0e10cSrcweir return; 759cdf0e10cSrcweir } 760cdf0e10cSrcweir xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) ); 761cdf0e10cSrcweir xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) ); 762cdf0e10cSrcweir } 763cdf0e10cSrcweir } 764cdf0e10cSrcweir 765cdf0e10cSrcweir awt::Size SAL_CALL DiagramWrapper::getSize() 766cdf0e10cSrcweir throw (uno::RuntimeException) 767cdf0e10cSrcweir { 768cdf0e10cSrcweir awt::Size aSize = ToSize( m_spChart2ModelContact->GetDiagramRectangleIncludingAxes() ); 769cdf0e10cSrcweir return aSize; 770cdf0e10cSrcweir } 771cdf0e10cSrcweir 772cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize ) 773cdf0e10cSrcweir throw (beans::PropertyVetoException, 774cdf0e10cSrcweir uno::RuntimeException) 775cdf0e10cSrcweir { 776cdf0e10cSrcweir ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 777cdf0e10cSrcweir Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() ); 778cdf0e10cSrcweir if( xProp.is() ) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() ); 781cdf0e10cSrcweir 782cdf0e10cSrcweir chart2::RelativeSize aRelativeSize; 783cdf0e10cSrcweir aRelativeSize.Primary = double(aSize.Width)/double(aPageSize.Width); 784cdf0e10cSrcweir aRelativeSize.Secondary = double(aSize.Height)/double(aPageSize.Height); 785cdf0e10cSrcweir 786cdf0e10cSrcweir if( aRelativeSize.Primary > 1 || aRelativeSize.Secondary > 1 ) 787cdf0e10cSrcweir { 788cdf0e10cSrcweir DBG_ERROR("DiagramWrapper::setSize called with sizes bigger than page -> automatic values are taken instead" ); 789cdf0e10cSrcweir uno::Any aEmpty; 790cdf0e10cSrcweir xProp->setPropertyValue( C2U( "RelativeSize" ), aEmpty ); 791cdf0e10cSrcweir return; 792cdf0e10cSrcweir } 793cdf0e10cSrcweir 794cdf0e10cSrcweir xProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) ); 795cdf0e10cSrcweir xProp->setPropertyValue( C2U( "PosSizeExcludeAxes" ), uno::makeAny(false) ); 796cdf0e10cSrcweir } 797cdf0e10cSrcweir } 798cdf0e10cSrcweir 799cdf0e10cSrcweir // ____ XShapeDescriptor (base of XShape) ____ 800cdf0e10cSrcweir OUString SAL_CALL DiagramWrapper::getShapeType() 801cdf0e10cSrcweir throw (uno::RuntimeException) 802cdf0e10cSrcweir { 803cdf0e10cSrcweir return C2U( "com.sun.star.chart.Diagram" ); 804cdf0e10cSrcweir } 805cdf0e10cSrcweir 806cdf0e10cSrcweir // ____ XDiagramPositioning ____ 807cdf0e10cSrcweir 808cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setAutomaticDiagramPositioning() throw (uno::RuntimeException) 809cdf0e10cSrcweir { 810cdf0e10cSrcweir ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 811cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); 812cdf0e10cSrcweir if( xDiaProps.is() ) 813cdf0e10cSrcweir { 814cdf0e10cSrcweir xDiaProps->setPropertyValue( C2U( "RelativeSize" ), Any() ); 815cdf0e10cSrcweir xDiaProps->setPropertyValue( C2U( "RelativePosition" ), Any() ); 816cdf0e10cSrcweir } 817cdf0e10cSrcweir } 818cdf0e10cSrcweir ::sal_Bool SAL_CALL DiagramWrapper::isAutomaticDiagramPositioning( ) throw (uno::RuntimeException) 819cdf0e10cSrcweir { 820cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); 821cdf0e10cSrcweir if( xDiaProps.is() ) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) ); 824cdf0e10cSrcweir Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) ); 825cdf0e10cSrcweir if( aRelativeSize.hasValue() && aRelativePosition.hasValue() ) 826cdf0e10cSrcweir return false; 827cdf0e10cSrcweir } 828cdf0e10cSrcweir return true; 829cdf0e10cSrcweir } 830cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagramPositionExcludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) 831cdf0e10cSrcweir { 832cdf0e10cSrcweir ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 833cdf0e10cSrcweir DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); 834cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); 835cdf0e10cSrcweir if( xDiaProps.is() ) 836cdf0e10cSrcweir xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(true) ); 837cdf0e10cSrcweir } 838cdf0e10cSrcweir ::sal_Bool SAL_CALL DiagramWrapper::isExcludingDiagramPositioning() throw (uno::RuntimeException) 839cdf0e10cSrcweir { 840cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); 841cdf0e10cSrcweir if( xDiaProps.is() ) 842cdf0e10cSrcweir { 843cdf0e10cSrcweir Any aRelativeSize( xDiaProps->getPropertyValue( C2U( "RelativeSize" ) ) ); 844cdf0e10cSrcweir Any aRelativePosition( xDiaProps->getPropertyValue( C2U( "RelativePosition" ) ) ); 845cdf0e10cSrcweir if( aRelativeSize.hasValue() && aRelativePosition.hasValue() ) 846cdf0e10cSrcweir { 847cdf0e10cSrcweir sal_Bool bPosSizeExcludeAxes = false; 848cdf0e10cSrcweir xDiaProps->getPropertyValue( C2U( "PosSizeExcludeAxes" ) ) >>= bPosSizeExcludeAxes; 849cdf0e10cSrcweir return bPosSizeExcludeAxes; 850cdf0e10cSrcweir } 851cdf0e10cSrcweir } 852cdf0e10cSrcweir return false; 853cdf0e10cSrcweir } 854cdf0e10cSrcweir awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionExcludingAxes( ) throw (uno::RuntimeException) 855cdf0e10cSrcweir { 856cdf0e10cSrcweir return m_spChart2ModelContact->GetDiagramRectangleExcludingAxes(); 857cdf0e10cSrcweir } 858cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxes( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) 859cdf0e10cSrcweir { 860cdf0e10cSrcweir ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 861cdf0e10cSrcweir DiagramHelper::setDiagramPositioning( m_spChart2ModelContact->getChartModel(), rPositionRect ); 862cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiaProps( this->getDiagram(), uno::UNO_QUERY ); 863cdf0e10cSrcweir if( xDiaProps.is() ) 864cdf0e10cSrcweir xDiaProps->setPropertyValue(C2U("PosSizeExcludeAxes"), uno::makeAny(false) ); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxes( ) throw (uno::RuntimeException) 867cdf0e10cSrcweir { 868cdf0e10cSrcweir return m_spChart2ModelContact->GetDiagramRectangleIncludingAxes(); 869cdf0e10cSrcweir } 870cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( const awt::Rectangle& rPositionRect ) throw (uno::RuntimeException) 871cdf0e10cSrcweir { 872cdf0e10cSrcweir ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 873cdf0e10cSrcweir awt::Rectangle aRect( m_spChart2ModelContact->SubstractAxisTitleSizes(rPositionRect) ); 874cdf0e10cSrcweir DiagramWrapper::setDiagramPositionIncludingAxes( aRect ); 875cdf0e10cSrcweir } 876cdf0e10cSrcweir ::com::sun::star::awt::Rectangle SAL_CALL DiagramWrapper::calculateDiagramPositionIncludingAxesAndAxisTitles( ) throw (::com::sun::star::uno::RuntimeException) 877cdf0e10cSrcweir { 878cdf0e10cSrcweir return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle(); 879cdf0e10cSrcweir } 880cdf0e10cSrcweir 881cdf0e10cSrcweir // ____ XAxisSupplier ____ 882cdf0e10cSrcweir Reference< XAxis > SAL_CALL DiagramWrapper::getAxis( sal_Int32 nDimensionIndex ) 883cdf0e10cSrcweir throw (uno::RuntimeException) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir Reference< XAxis > xAxis; 886cdf0e10cSrcweir if(!nDimensionIndex) 887cdf0e10cSrcweir { 888cdf0e10cSrcweir if( !m_xXAxis.is() ) 889cdf0e10cSrcweir m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact ); 890cdf0e10cSrcweir xAxis = m_xXAxis; 891cdf0e10cSrcweir } 892cdf0e10cSrcweir else if(1==nDimensionIndex) 893cdf0e10cSrcweir { 894cdf0e10cSrcweir if( !m_xYAxis.is() ) 895cdf0e10cSrcweir m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact ); 896cdf0e10cSrcweir xAxis = m_xYAxis; 897cdf0e10cSrcweir } 898cdf0e10cSrcweir else if(2==nDimensionIndex) 899cdf0e10cSrcweir { 900cdf0e10cSrcweir if( !m_xZAxis.is() ) 901cdf0e10cSrcweir m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact ); 902cdf0e10cSrcweir xAxis = m_xZAxis; 903cdf0e10cSrcweir } 904cdf0e10cSrcweir return xAxis; 905cdf0e10cSrcweir } 906cdf0e10cSrcweir 907cdf0e10cSrcweir Reference< XAxis > SAL_CALL DiagramWrapper::getSecondaryAxis( sal_Int32 nDimensionIndex ) 908cdf0e10cSrcweir throw (uno::RuntimeException) 909cdf0e10cSrcweir { 910cdf0e10cSrcweir Reference< XAxis > xAxis; 911cdf0e10cSrcweir if(!nDimensionIndex) 912cdf0e10cSrcweir { 913cdf0e10cSrcweir if( !m_xSecondXAxis.is() ) 914cdf0e10cSrcweir m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact ); 915cdf0e10cSrcweir xAxis = m_xSecondXAxis; 916cdf0e10cSrcweir } 917cdf0e10cSrcweir else if(1==nDimensionIndex) 918cdf0e10cSrcweir { 919cdf0e10cSrcweir if( !m_xSecondYAxis.is() ) 920cdf0e10cSrcweir m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact ); 921cdf0e10cSrcweir xAxis = m_xSecondYAxis; 922cdf0e10cSrcweir } 923cdf0e10cSrcweir return xAxis; 924cdf0e10cSrcweir } 925cdf0e10cSrcweir 926cdf0e10cSrcweir // ____ XAxisZSupplier ____ 927cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle() 928cdf0e10cSrcweir throw (uno::RuntimeException) 929cdf0e10cSrcweir { 930cdf0e10cSrcweir Reference< drawing::XShape > xRet; 931cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(2) ); 932cdf0e10cSrcweir if( xAxis.is() ) 933cdf0e10cSrcweir xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); 934cdf0e10cSrcweir return xRet; 935cdf0e10cSrcweir } 936cdf0e10cSrcweir 937cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid() 938cdf0e10cSrcweir throw (uno::RuntimeException) 939cdf0e10cSrcweir { 940cdf0e10cSrcweir Reference< beans::XPropertySet > xRet; 941cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(2) ); 942cdf0e10cSrcweir if( xAxis.is() ) 943cdf0e10cSrcweir xRet = xAxis->getMajorGrid(); 944cdf0e10cSrcweir return xRet; 945cdf0e10cSrcweir } 946cdf0e10cSrcweir 947cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid() 948cdf0e10cSrcweir throw (uno::RuntimeException) 949cdf0e10cSrcweir { 950cdf0e10cSrcweir Reference< beans::XPropertySet > xRet; 951cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(2) ); 952cdf0e10cSrcweir if( xAxis.is() ) 953cdf0e10cSrcweir xRet = xAxis->getMinorGrid(); 954cdf0e10cSrcweir return xRet; 955cdf0e10cSrcweir } 956cdf0e10cSrcweir 957cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis() 958cdf0e10cSrcweir throw (uno::RuntimeException) 959cdf0e10cSrcweir { 960cdf0e10cSrcweir if( ! m_xZAxis.is()) 961cdf0e10cSrcweir m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact ); 962cdf0e10cSrcweir return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY ); 963cdf0e10cSrcweir } 964cdf0e10cSrcweir 965cdf0e10cSrcweir 966cdf0e10cSrcweir // ____ XTwoAxisXSupplier ____ 967cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis() 968cdf0e10cSrcweir throw (uno::RuntimeException) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir if( ! m_xSecondXAxis.is()) 971cdf0e10cSrcweir m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact ); 972cdf0e10cSrcweir return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY ); 973cdf0e10cSrcweir } 974cdf0e10cSrcweir 975cdf0e10cSrcweir 976cdf0e10cSrcweir // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____ 977cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle() 978cdf0e10cSrcweir throw (uno::RuntimeException) 979cdf0e10cSrcweir { 980cdf0e10cSrcweir Reference< drawing::XShape > xRet; 981cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(0) ); 982cdf0e10cSrcweir if( xAxis.is() ) 983cdf0e10cSrcweir xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); 984cdf0e10cSrcweir return xRet; 985cdf0e10cSrcweir } 986cdf0e10cSrcweir 987cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis() 988cdf0e10cSrcweir throw (uno::RuntimeException) 989cdf0e10cSrcweir { 990cdf0e10cSrcweir if( ! m_xXAxis.is()) 991cdf0e10cSrcweir m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact ); 992cdf0e10cSrcweir return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY ); 993cdf0e10cSrcweir } 994cdf0e10cSrcweir 995cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid() 996cdf0e10cSrcweir throw (uno::RuntimeException) 997cdf0e10cSrcweir { 998cdf0e10cSrcweir Reference< beans::XPropertySet > xRet; 999cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(0) ); 1000cdf0e10cSrcweir if( xAxis.is() ) 1001cdf0e10cSrcweir xRet = xAxis->getMajorGrid(); 1002cdf0e10cSrcweir return xRet; 1003cdf0e10cSrcweir } 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid() 1006cdf0e10cSrcweir throw (uno::RuntimeException) 1007cdf0e10cSrcweir { 1008cdf0e10cSrcweir Reference< beans::XPropertySet > xRet; 1009cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(0) ); 1010cdf0e10cSrcweir if( xAxis.is() ) 1011cdf0e10cSrcweir xRet = xAxis->getMinorGrid(); 1012cdf0e10cSrcweir return xRet; 1013cdf0e10cSrcweir } 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir // ____ XTwoAxisYSupplier ____ 1017cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis() 1018cdf0e10cSrcweir throw (uno::RuntimeException) 1019cdf0e10cSrcweir { 1020cdf0e10cSrcweir if( ! m_xSecondYAxis.is()) 1021cdf0e10cSrcweir m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact ); 1022cdf0e10cSrcweir return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY ); 1023cdf0e10cSrcweir } 1024cdf0e10cSrcweir 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____ 1027cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle() 1028cdf0e10cSrcweir throw (uno::RuntimeException) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir Reference< drawing::XShape > xRet; 1031cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(1) ); 1032cdf0e10cSrcweir if( xAxis.is() ) 1033cdf0e10cSrcweir xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); 1034cdf0e10cSrcweir return xRet; 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis() 1038cdf0e10cSrcweir throw (uno::RuntimeException) 1039cdf0e10cSrcweir { 1040cdf0e10cSrcweir if( ! m_xYAxis.is()) 1041cdf0e10cSrcweir m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact ); 1042cdf0e10cSrcweir return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY ); 1043cdf0e10cSrcweir } 1044cdf0e10cSrcweir 1045cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid() 1046cdf0e10cSrcweir throw (uno::RuntimeException) 1047cdf0e10cSrcweir { 1048cdf0e10cSrcweir Reference< beans::XPropertySet > xRet; 1049cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(1) ); 1050cdf0e10cSrcweir if( xAxis.is() ) 1051cdf0e10cSrcweir xRet = xAxis->getMajorGrid(); 1052cdf0e10cSrcweir return xRet; 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid() 1056cdf0e10cSrcweir throw (uno::RuntimeException) 1057cdf0e10cSrcweir { 1058cdf0e10cSrcweir Reference< beans::XPropertySet > xRet; 1059cdf0e10cSrcweir Reference< XAxis > xAxis( getAxis(1) ); 1060cdf0e10cSrcweir if( xAxis.is() ) 1061cdf0e10cSrcweir xRet = xAxis->getMinorGrid(); 1062cdf0e10cSrcweir return xRet; 1063cdf0e10cSrcweir } 1064cdf0e10cSrcweir 1065cdf0e10cSrcweir // ____ XSecondAxisTitleSupplier ____ 1066cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle() 1067cdf0e10cSrcweir throw (uno::RuntimeException) 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir Reference< drawing::XShape > xRet; 1070cdf0e10cSrcweir Reference< XAxis > xAxis( getSecondaryAxis(0) ); 1071cdf0e10cSrcweir if( xAxis.is() ) 1072cdf0e10cSrcweir xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); 1073cdf0e10cSrcweir return xRet; 1074cdf0e10cSrcweir } 1075cdf0e10cSrcweir 1076cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle() 1077cdf0e10cSrcweir throw (uno::RuntimeException) 1078cdf0e10cSrcweir { 1079cdf0e10cSrcweir Reference< drawing::XShape > xRet; 1080cdf0e10cSrcweir Reference< XAxis > xAxis( getSecondaryAxis(1) ); 1081cdf0e10cSrcweir if( xAxis.is() ) 1082cdf0e10cSrcweir xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); 1083cdf0e10cSrcweir return xRet; 1084cdf0e10cSrcweir } 1085cdf0e10cSrcweir 1086cdf0e10cSrcweir // ____ XStatisticDisplay ____ 1087cdf0e10cSrcweir Reference< 1088cdf0e10cSrcweir beans::XPropertySet > SAL_CALL DiagramWrapper::getUpBar() 1089cdf0e10cSrcweir throw (uno::RuntimeException) 1090cdf0e10cSrcweir { 1091cdf0e10cSrcweir if( !m_xUpBarWrapper.is() ) 1092cdf0e10cSrcweir { 1093cdf0e10cSrcweir m_xUpBarWrapper = new UpDownBarWrapper( true, m_spChart2ModelContact ); 1094cdf0e10cSrcweir } 1095cdf0e10cSrcweir return m_xUpBarWrapper; 1096cdf0e10cSrcweir } 1097cdf0e10cSrcweir 1098cdf0e10cSrcweir Reference< 1099cdf0e10cSrcweir beans::XPropertySet > SAL_CALL DiagramWrapper::getDownBar() 1100cdf0e10cSrcweir throw (uno::RuntimeException) 1101cdf0e10cSrcweir { 1102cdf0e10cSrcweir if( !m_xDownBarWrapper.is() ) 1103cdf0e10cSrcweir { 1104cdf0e10cSrcweir m_xDownBarWrapper = new UpDownBarWrapper( false, m_spChart2ModelContact ); 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir return m_xDownBarWrapper; 1107cdf0e10cSrcweir } 1108cdf0e10cSrcweir 1109cdf0e10cSrcweir Reference< 1110cdf0e10cSrcweir beans::XPropertySet > SAL_CALL DiagramWrapper::getMinMaxLine() 1111cdf0e10cSrcweir throw (uno::RuntimeException) 1112cdf0e10cSrcweir { 1113cdf0e10cSrcweir if( !m_xMinMaxLineWrapper.is() ) 1114cdf0e10cSrcweir { 1115cdf0e10cSrcweir m_xMinMaxLineWrapper = new MinMaxLineWrapper( m_spChart2ModelContact ); 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir return m_xMinMaxLineWrapper; 1118cdf0e10cSrcweir } 1119cdf0e10cSrcweir 1120cdf0e10cSrcweir // ____ X3DDisplay ____ 1121cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getWall() 1122cdf0e10cSrcweir throw (uno::RuntimeException) 1123cdf0e10cSrcweir { 1124cdf0e10cSrcweir if( !m_xWall.is() ) 1125cdf0e10cSrcweir { 1126cdf0e10cSrcweir m_xWall = new WallFloorWrapper( true, m_spChart2ModelContact ); 1127cdf0e10cSrcweir } 1128cdf0e10cSrcweir return m_xWall; 1129cdf0e10cSrcweir } 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir Reference< 1132cdf0e10cSrcweir beans::XPropertySet > SAL_CALL DiagramWrapper::getFloor() 1133cdf0e10cSrcweir throw (uno::RuntimeException) 1134cdf0e10cSrcweir { 1135cdf0e10cSrcweir if( !m_xFloor.is() ) 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir m_xFloor = new WallFloorWrapper( false, m_spChart2ModelContact ); 1138cdf0e10cSrcweir } 1139cdf0e10cSrcweir return m_xFloor; 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir 1142cdf0e10cSrcweir // ____ X3DDefaultSetter ____ 1143cdf0e10cSrcweir void SAL_CALL DiagramWrapper::set3DSettingsToDefault() 1144cdf0e10cSrcweir throw (uno::RuntimeException) 1145cdf0e10cSrcweir { 1146cdf0e10cSrcweir Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); 1147cdf0e10cSrcweir if( x3DDefaultSetter.is() ) 1148cdf0e10cSrcweir x3DDefaultSetter->set3DSettingsToDefault(); 1149cdf0e10cSrcweir } 1150cdf0e10cSrcweir 1151cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDefaultRotation() 1152cdf0e10cSrcweir throw (uno::RuntimeException) 1153cdf0e10cSrcweir { 1154cdf0e10cSrcweir Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); 1155cdf0e10cSrcweir if( x3DDefaultSetter.is() ) 1156cdf0e10cSrcweir x3DDefaultSetter->setDefaultRotation(); 1157cdf0e10cSrcweir } 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDefaultIllumination() 1160cdf0e10cSrcweir throw (uno::RuntimeException) 1161cdf0e10cSrcweir { 1162cdf0e10cSrcweir Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); 1163cdf0e10cSrcweir if( x3DDefaultSetter.is() ) 1164cdf0e10cSrcweir x3DDefaultSetter->setDefaultIllumination(); 1165cdf0e10cSrcweir } 1166cdf0e10cSrcweir 1167cdf0e10cSrcweir // ____ XComponent ____ 1168cdf0e10cSrcweir void SAL_CALL DiagramWrapper::dispose() 1169cdf0e10cSrcweir throw (uno::RuntimeException) 1170cdf0e10cSrcweir { 1171cdf0e10cSrcweir m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this ))); 1172cdf0e10cSrcweir 1173cdf0e10cSrcweir // /-- 1174cdf0e10cSrcweir MutexGuard aGuard( GetMutex()); 1175cdf0e10cSrcweir 1176cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xXAxis ); 1177cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xYAxis ); 1178cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xZAxis ); 1179cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xSecondXAxis ); 1180cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xSecondYAxis ); 1181cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xWall ); 1182cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xFloor ); 1183cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper ); 1184cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xUpBarWrapper ); 1185cdf0e10cSrcweir DisposeHelper::DisposeAndClear( m_xDownBarWrapper ); 1186cdf0e10cSrcweir 1187cdf0e10cSrcweir clearWrappedPropertySet(); 1188cdf0e10cSrcweir // \-- 1189cdf0e10cSrcweir } 1190cdf0e10cSrcweir 1191cdf0e10cSrcweir void SAL_CALL DiagramWrapper::addEventListener( 1192cdf0e10cSrcweir const Reference< lang::XEventListener >& xListener ) 1193cdf0e10cSrcweir throw (uno::RuntimeException) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir m_aEventListenerContainer.addInterface( xListener ); 1196cdf0e10cSrcweir } 1197cdf0e10cSrcweir 1198cdf0e10cSrcweir void SAL_CALL DiagramWrapper::removeEventListener( 1199cdf0e10cSrcweir const Reference< lang::XEventListener >& aListener ) 1200cdf0e10cSrcweir throw (uno::RuntimeException) 1201cdf0e10cSrcweir { 1202cdf0e10cSrcweir m_aEventListenerContainer.removeInterface( aListener ); 1203cdf0e10cSrcweir } 1204cdf0e10cSrcweir 1205cdf0e10cSrcweir // ____ XEventListener ____ 1206cdf0e10cSrcweir // void SAL_CALL DiagramWrapper::disposing( const lang::EventObject& Source ) 1207cdf0e10cSrcweir // throw (uno::RuntimeException) 1208cdf0e10cSrcweir // { 1209cdf0e10cSrcweir // } 1210cdf0e10cSrcweir 1211cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1212cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1213cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir //PROP_DIAGRAM_DATAROW_SOURCE 1216cdf0e10cSrcweir class WrappedDataRowSourceProperty : public WrappedProperty 1217cdf0e10cSrcweir { 1218cdf0e10cSrcweir public: 1219cdf0e10cSrcweir WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 1220cdf0e10cSrcweir virtual ~WrappedDataRowSourceProperty(); 1221cdf0e10cSrcweir 1222cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1223cdf0e10cSrcweir 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); 1224cdf0e10cSrcweir 1225cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1226cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1227cdf0e10cSrcweir 1228cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1229cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1230cdf0e10cSrcweir 1231cdf0e10cSrcweir private: //member 1232cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 1233cdf0e10cSrcweir mutable Any m_aOuterValue; 1234cdf0e10cSrcweir }; 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir WrappedDataRowSourceProperty::WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 1237cdf0e10cSrcweir : WrappedProperty(C2U("DataRowSource"),OUString()) 1238cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 1239cdf0e10cSrcweir , m_aOuterValue() 1240cdf0e10cSrcweir { 1241cdf0e10cSrcweir m_aOuterValue = WrappedDataRowSourceProperty::getPropertyDefault( 0 ); 1242cdf0e10cSrcweir } 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir WrappedDataRowSourceProperty::~WrappedDataRowSourceProperty() 1245cdf0e10cSrcweir { 1246cdf0e10cSrcweir } 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1249cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1250cdf0e10cSrcweir { 1251cdf0e10cSrcweir ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS; 1252cdf0e10cSrcweir if( ! (rOuterValue >>= eChartDataRowSource) ) 1253cdf0e10cSrcweir { 1254cdf0e10cSrcweir sal_Int32 nNew = ::com::sun::star::chart::ChartDataRowSource_ROWS; 1255cdf0e10cSrcweir if( !(rOuterValue >>= nNew) ) 1256cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Property DataRowSource requires ::com::sun::star::chart::ChartDataRowSource value"), 0, 0 ); 1257cdf0e10cSrcweir else 1258cdf0e10cSrcweir eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource(nNew); 1259cdf0e10cSrcweir } 1260cdf0e10cSrcweir 1261cdf0e10cSrcweir m_aOuterValue = rOuterValue; 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir bool bNewUseColumns = eChartDataRowSource == ::com::sun::star::chart::ChartDataRowSource_COLUMNS; 1264cdf0e10cSrcweir 1265cdf0e10cSrcweir ::rtl::OUString aRangeString; 1266cdf0e10cSrcweir bool bUseColumns = true; 1267cdf0e10cSrcweir bool bFirstCellAsLabel = true; 1268cdf0e10cSrcweir bool bHasCategories = true; 1269cdf0e10cSrcweir uno::Sequence< sal_Int32 > aSequenceMapping; 1270cdf0e10cSrcweir 1271cdf0e10cSrcweir if( DataSourceHelper::detectRangeSegmentation( 1272cdf0e10cSrcweir m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns 1273cdf0e10cSrcweir , bFirstCellAsLabel, bHasCategories ) ) 1274cdf0e10cSrcweir { 1275cdf0e10cSrcweir if( bUseColumns != bNewUseColumns ) 1276cdf0e10cSrcweir { 1277cdf0e10cSrcweir aSequenceMapping.realloc(0); 1278cdf0e10cSrcweir DataSourceHelper::setRangeSegmentation( 1279cdf0e10cSrcweir m_spChart2ModelContact->getChartModel(), aSequenceMapping, bNewUseColumns , bHasCategories, bFirstCellAsLabel ); 1280cdf0e10cSrcweir } 1281cdf0e10cSrcweir } 1282cdf0e10cSrcweir } 1283cdf0e10cSrcweir 1284cdf0e10cSrcweir Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1285cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1286cdf0e10cSrcweir { 1287cdf0e10cSrcweir ::rtl::OUString aRangeString; 1288cdf0e10cSrcweir bool bUseColumns = true; 1289cdf0e10cSrcweir bool bFirstCellAsLabel = true; 1290cdf0e10cSrcweir bool bHasCategories = true; 1291cdf0e10cSrcweir uno::Sequence< sal_Int32 > aSequenceMapping; 1292cdf0e10cSrcweir 1293cdf0e10cSrcweir if( DataSourceHelper::detectRangeSegmentation( 1294cdf0e10cSrcweir m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns 1295cdf0e10cSrcweir , bFirstCellAsLabel, bHasCategories ) ) 1296cdf0e10cSrcweir { 1297cdf0e10cSrcweir ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS; 1298cdf0e10cSrcweir if(bUseColumns) 1299cdf0e10cSrcweir eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS; 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir m_aOuterValue <<= eChartDataRowSource; 1302cdf0e10cSrcweir } 1303cdf0e10cSrcweir 1304cdf0e10cSrcweir return m_aOuterValue; 1305cdf0e10cSrcweir } 1306cdf0e10cSrcweir 1307cdf0e10cSrcweir Any WrappedDataRowSourceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 1308cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1309cdf0e10cSrcweir { 1310cdf0e10cSrcweir Any aRet; 1311cdf0e10cSrcweir aRet <<= ::com::sun::star::chart::ChartDataRowSource_COLUMNS; 1312cdf0e10cSrcweir return aRet; 1313cdf0e10cSrcweir } 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1316cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1317cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1318cdf0e10cSrcweir 1319cdf0e10cSrcweir 1320cdf0e10cSrcweir //PROP_DIAGRAM_STACKED 1321cdf0e10cSrcweir //PROP_DIAGRAM_DEEP 1322cdf0e10cSrcweir //PROP_DIAGRAM_PERCENT_STACKED 1323cdf0e10cSrcweir class WrappedStackingProperty : public WrappedProperty 1324cdf0e10cSrcweir { 1325cdf0e10cSrcweir public: 1326cdf0e10cSrcweir WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 1327cdf0e10cSrcweir virtual ~WrappedStackingProperty(); 1328cdf0e10cSrcweir 1329cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1330cdf0e10cSrcweir 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); 1331cdf0e10cSrcweir 1332cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1333cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1334cdf0e10cSrcweir 1335cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1336cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1337cdf0e10cSrcweir 1338cdf0e10cSrcweir protected: //methods 1339cdf0e10cSrcweir bool detectInnerValue( StackMode& eInnerStackMode ) const; 1340cdf0e10cSrcweir 1341cdf0e10cSrcweir private: //member 1342cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 1343cdf0e10cSrcweir const StackMode m_eStackMode; 1344cdf0e10cSrcweir mutable Any m_aOuterValue; 1345cdf0e10cSrcweir }; 1346cdf0e10cSrcweir 1347cdf0e10cSrcweir WrappedStackingProperty::WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 1348cdf0e10cSrcweir : WrappedProperty(OUString(),OUString()) 1349cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 1350cdf0e10cSrcweir , m_eStackMode( eStackMode ) 1351cdf0e10cSrcweir , m_aOuterValue() 1352cdf0e10cSrcweir { 1353cdf0e10cSrcweir switch( m_eStackMode ) 1354cdf0e10cSrcweir { 1355cdf0e10cSrcweir case StackMode_Y_STACKED: 1356cdf0e10cSrcweir m_aOuterName = C2U( "Stacked" ); 1357cdf0e10cSrcweir break; 1358cdf0e10cSrcweir case StackMode_Y_STACKED_PERCENT: 1359cdf0e10cSrcweir m_aOuterName = C2U( "Percent" ); 1360cdf0e10cSrcweir break; 1361cdf0e10cSrcweir case StackMode_Z_STACKED: 1362cdf0e10cSrcweir m_aOuterName = C2U( "Deep" ); 1363cdf0e10cSrcweir break; 1364cdf0e10cSrcweir default: 1365cdf0e10cSrcweir OSL_ENSURE( false, "unexpected stack mode" ); 1366cdf0e10cSrcweir break; 1367cdf0e10cSrcweir } 1368cdf0e10cSrcweir } 1369cdf0e10cSrcweir 1370cdf0e10cSrcweir WrappedStackingProperty::~WrappedStackingProperty() 1371cdf0e10cSrcweir { 1372cdf0e10cSrcweir } 1373cdf0e10cSrcweir 1374cdf0e10cSrcweir bool WrappedStackingProperty::detectInnerValue( StackMode& eStackMode ) const 1375cdf0e10cSrcweir { 1376cdf0e10cSrcweir bool bHasDetectableInnerValue = false; 1377cdf0e10cSrcweir bool bIsAmbiguous = false; 1378cdf0e10cSrcweir eStackMode = DiagramHelper::getStackMode( m_spChart2ModelContact->getChart2Diagram() 1379cdf0e10cSrcweir , bHasDetectableInnerValue, bIsAmbiguous ); 1380cdf0e10cSrcweir return bHasDetectableInnerValue; 1381cdf0e10cSrcweir } 1382cdf0e10cSrcweir 1383cdf0e10cSrcweir void WrappedStackingProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1384cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1385cdf0e10cSrcweir { 1386cdf0e10cSrcweir sal_Bool bNewValue = false; 1387cdf0e10cSrcweir if( ! (rOuterValue >>= bNewValue) ) 1388cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Stacking Properties require boolean values"), 0, 0 ); 1389cdf0e10cSrcweir 1390cdf0e10cSrcweir StackMode eInnerStackMode; 1391cdf0e10cSrcweir bool bHasDetectableInnerValue = detectInnerValue( eInnerStackMode ); 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir if( !bHasDetectableInnerValue ) 1394cdf0e10cSrcweir { 1395cdf0e10cSrcweir m_aOuterValue = rOuterValue; 1396cdf0e10cSrcweir return; 1397cdf0e10cSrcweir } 1398cdf0e10cSrcweir 1399cdf0e10cSrcweir if( bNewValue && eInnerStackMode == m_eStackMode ) 1400cdf0e10cSrcweir return; 1401cdf0e10cSrcweir if( !bNewValue && eInnerStackMode != m_eStackMode ) 1402cdf0e10cSrcweir return; 1403cdf0e10cSrcweir 1404cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1405cdf0e10cSrcweir if( xDiagram.is() ) 1406cdf0e10cSrcweir { 1407cdf0e10cSrcweir StackMode eNewStackMode = bNewValue ? m_eStackMode : StackMode_NONE; 1408cdf0e10cSrcweir DiagramHelper::setStackMode( xDiagram, eNewStackMode ); 1409cdf0e10cSrcweir } 1410cdf0e10cSrcweir } 1411cdf0e10cSrcweir 1412cdf0e10cSrcweir Any WrappedStackingProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1413cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1414cdf0e10cSrcweir { 1415cdf0e10cSrcweir StackMode eInnerStackMode; 1416cdf0e10cSrcweir if( detectInnerValue( eInnerStackMode ) ) 1417cdf0e10cSrcweir { 1418cdf0e10cSrcweir sal_Bool bValue = (eInnerStackMode == m_eStackMode); 1419cdf0e10cSrcweir Any aAny; 1420cdf0e10cSrcweir aAny <<= bValue; 1421cdf0e10cSrcweir return aAny; 1422cdf0e10cSrcweir } 1423cdf0e10cSrcweir return m_aOuterValue; 1424cdf0e10cSrcweir } 1425cdf0e10cSrcweir 1426cdf0e10cSrcweir Any WrappedStackingProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 1427cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1428cdf0e10cSrcweir { 1429cdf0e10cSrcweir Any aRet; 1430cdf0e10cSrcweir aRet <<= sal_Bool( sal_False ); 1431cdf0e10cSrcweir return aRet; 1432cdf0e10cSrcweir } 1433cdf0e10cSrcweir 1434cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1435cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1436cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1437cdf0e10cSrcweir 1438cdf0e10cSrcweir //PROP_DIAGRAM_THREE_D 1439cdf0e10cSrcweir class WrappedDim3DProperty : public WrappedProperty 1440cdf0e10cSrcweir { 1441cdf0e10cSrcweir public: 1442cdf0e10cSrcweir WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 1443cdf0e10cSrcweir virtual ~WrappedDim3DProperty(); 1444cdf0e10cSrcweir 1445cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1446cdf0e10cSrcweir 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); 1447cdf0e10cSrcweir 1448cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1449cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1450cdf0e10cSrcweir 1451cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1452cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1453cdf0e10cSrcweir 1454cdf0e10cSrcweir private: //member 1455cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 1456cdf0e10cSrcweir mutable Any m_aOuterValue; 1457cdf0e10cSrcweir }; 1458cdf0e10cSrcweir 1459cdf0e10cSrcweir WrappedDim3DProperty::WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 1460cdf0e10cSrcweir : WrappedProperty(C2U("Dim3D"),OUString()) 1461cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 1462cdf0e10cSrcweir , m_aOuterValue() 1463cdf0e10cSrcweir { 1464cdf0e10cSrcweir m_aOuterValue = WrappedDim3DProperty::getPropertyDefault( 0 ); 1465cdf0e10cSrcweir } 1466cdf0e10cSrcweir 1467cdf0e10cSrcweir WrappedDim3DProperty::~WrappedDim3DProperty() 1468cdf0e10cSrcweir { 1469cdf0e10cSrcweir } 1470cdf0e10cSrcweir 1471cdf0e10cSrcweir void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1472cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1473cdf0e10cSrcweir { 1474cdf0e10cSrcweir sal_Bool bNew3D = false; 1475cdf0e10cSrcweir if( ! (rOuterValue >>= bNew3D) ) 1476cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 ); 1477cdf0e10cSrcweir 1478cdf0e10cSrcweir m_aOuterValue = rOuterValue; 1479cdf0e10cSrcweir 1480cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1481cdf0e10cSrcweir if( !xDiagram.is() ) 1482cdf0e10cSrcweir return; 1483cdf0e10cSrcweir 1484cdf0e10cSrcweir sal_Bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3; 1485cdf0e10cSrcweir if( bOld3D != bNew3D ) 1486cdf0e10cSrcweir DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 ); 1487cdf0e10cSrcweir } 1488cdf0e10cSrcweir 1489cdf0e10cSrcweir Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1490cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1491cdf0e10cSrcweir { 1492cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1493cdf0e10cSrcweir if( xDiagram.is() ) 1494cdf0e10cSrcweir { 1495cdf0e10cSrcweir sal_Bool b3D = DiagramHelper::getDimension( xDiagram ) == 3; 1496cdf0e10cSrcweir m_aOuterValue <<= b3D; 1497cdf0e10cSrcweir } 1498cdf0e10cSrcweir return m_aOuterValue; 1499cdf0e10cSrcweir } 1500cdf0e10cSrcweir 1501cdf0e10cSrcweir Any WrappedDim3DProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 1502cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1503cdf0e10cSrcweir { 1504cdf0e10cSrcweir Any aRet; 1505cdf0e10cSrcweir aRet <<= sal_Bool( sal_False ); 1506cdf0e10cSrcweir return aRet; 1507cdf0e10cSrcweir } 1508cdf0e10cSrcweir 1509cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1510cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1511cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1512cdf0e10cSrcweir 1513cdf0e10cSrcweir //PROP_DIAGRAM_VERTICAL 1514cdf0e10cSrcweir class WrappedVerticalProperty : public WrappedProperty 1515cdf0e10cSrcweir { 1516cdf0e10cSrcweir public: 1517cdf0e10cSrcweir WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 1518cdf0e10cSrcweir virtual ~WrappedVerticalProperty(); 1519cdf0e10cSrcweir 1520cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1521cdf0e10cSrcweir 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); 1522cdf0e10cSrcweir 1523cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1524cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1525cdf0e10cSrcweir 1526cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1527cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1528cdf0e10cSrcweir 1529cdf0e10cSrcweir private: //member 1530cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 1531cdf0e10cSrcweir mutable Any m_aOuterValue; 1532cdf0e10cSrcweir }; 1533cdf0e10cSrcweir 1534cdf0e10cSrcweir WrappedVerticalProperty::WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 1535cdf0e10cSrcweir : WrappedProperty(C2U("Vertical"),OUString()) 1536cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 1537cdf0e10cSrcweir , m_aOuterValue() 1538cdf0e10cSrcweir { 1539cdf0e10cSrcweir m_aOuterValue = WrappedVerticalProperty::getPropertyDefault( 0 ); 1540cdf0e10cSrcweir } 1541cdf0e10cSrcweir 1542cdf0e10cSrcweir WrappedVerticalProperty::~WrappedVerticalProperty() 1543cdf0e10cSrcweir { 1544cdf0e10cSrcweir } 1545cdf0e10cSrcweir 1546cdf0e10cSrcweir void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1547cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1548cdf0e10cSrcweir { 1549cdf0e10cSrcweir sal_Bool bNewVertical = false; 1550cdf0e10cSrcweir if( ! (rOuterValue >>= bNewVertical) ) 1551cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Property Vertical requires boolean value"), 0, 0 ); 1552cdf0e10cSrcweir 1553cdf0e10cSrcweir m_aOuterValue = rOuterValue; 1554cdf0e10cSrcweir 1555cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1556cdf0e10cSrcweir if( !xDiagram.is() ) 1557cdf0e10cSrcweir return; 1558cdf0e10cSrcweir 1559cdf0e10cSrcweir bool bFound = false; 1560cdf0e10cSrcweir bool bAmbiguous = false; 1561cdf0e10cSrcweir sal_Bool bOldVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous ); 1562cdf0e10cSrcweir if( bFound && ( bOldVertical != bNewVertical || bAmbiguous ) ) 1563cdf0e10cSrcweir DiagramHelper::setVertical( xDiagram, bNewVertical ); 1564cdf0e10cSrcweir } 1565cdf0e10cSrcweir 1566cdf0e10cSrcweir Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1567cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1568cdf0e10cSrcweir { 1569cdf0e10cSrcweir bool bFound = false; 1570cdf0e10cSrcweir bool bAmbiguous = false; 1571cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1572cdf0e10cSrcweir if( xDiagram.is() ) 1573cdf0e10cSrcweir { 1574cdf0e10cSrcweir sal_Bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous ); 1575cdf0e10cSrcweir if( bFound ) 1576cdf0e10cSrcweir m_aOuterValue <<= bVertical; 1577cdf0e10cSrcweir } 1578cdf0e10cSrcweir return m_aOuterValue; 1579cdf0e10cSrcweir } 1580cdf0e10cSrcweir 1581cdf0e10cSrcweir Any WrappedVerticalProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 1582cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1583cdf0e10cSrcweir { 1584cdf0e10cSrcweir Any aRet; 1585cdf0e10cSrcweir aRet <<= sal_Bool( sal_False ); 1586cdf0e10cSrcweir return aRet; 1587cdf0e10cSrcweir } 1588cdf0e10cSrcweir 1589cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1590cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1591cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1592cdf0e10cSrcweir 1593cdf0e10cSrcweir //PROP_DIAGRAM_NUMBER_OF_LINES 1594cdf0e10cSrcweir class WrappedNumberOfLinesProperty : public WrappedProperty 1595cdf0e10cSrcweir { 1596cdf0e10cSrcweir public: 1597cdf0e10cSrcweir WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 1598cdf0e10cSrcweir virtual ~WrappedNumberOfLinesProperty(); 1599cdf0e10cSrcweir 1600cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1601cdf0e10cSrcweir 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); 1602cdf0e10cSrcweir 1603cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1604cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1605cdf0e10cSrcweir 1606cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1607cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1608cdf0e10cSrcweir 1609cdf0e10cSrcweir protected: //methods 1610cdf0e10cSrcweir bool detectInnerValue( uno::Any& rInnerValue ) const; 1611cdf0e10cSrcweir 1612cdf0e10cSrcweir private: //member 1613cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 1614cdf0e10cSrcweir mutable Any m_aOuterValue; 1615cdf0e10cSrcweir }; 1616cdf0e10cSrcweir 1617cdf0e10cSrcweir WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 1618cdf0e10cSrcweir : WrappedProperty(C2U("NumberOfLines"),OUString()) 1619cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 1620cdf0e10cSrcweir , m_aOuterValue( this->getPropertyDefault(0) ) 1621cdf0e10cSrcweir { 1622cdf0e10cSrcweir } 1623cdf0e10cSrcweir 1624cdf0e10cSrcweir WrappedNumberOfLinesProperty::~WrappedNumberOfLinesProperty() 1625cdf0e10cSrcweir { 1626cdf0e10cSrcweir } 1627cdf0e10cSrcweir 1628cdf0e10cSrcweir bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) const 1629cdf0e10cSrcweir { 1630cdf0e10cSrcweir sal_Int32 nNumberOfLines = 0; 1631cdf0e10cSrcweir bool bHasDetectableInnerValue = false; 1632cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1633cdf0e10cSrcweir uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); 1634cdf0e10cSrcweir if( xDiagram.is() && xChartDoc.is() ) 1635cdf0e10cSrcweir { 1636cdf0e10cSrcweir ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector( 1637cdf0e10cSrcweir DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); 1638cdf0e10cSrcweir if( aSeriesVector.size() > 0 ) 1639cdf0e10cSrcweir { 1640cdf0e10cSrcweir Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); 1641cdf0e10cSrcweir DiagramHelper::tTemplateWithServiceName aTemplateAndService = 1642cdf0e10cSrcweir DiagramHelper::getTemplateForDiagram( xDiagram, xFact ); 1643cdf0e10cSrcweir if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) ) 1644cdf0e10cSrcweir { 1645cdf0e10cSrcweir try 1646cdf0e10cSrcweir { 1647cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProp( aTemplateAndService.first, uno::UNO_QUERY ); 1648cdf0e10cSrcweir xProp->getPropertyValue( m_aOuterName ) >>= nNumberOfLines; 1649cdf0e10cSrcweir bHasDetectableInnerValue = true; 1650cdf0e10cSrcweir } 1651cdf0e10cSrcweir catch( uno::Exception & ex ) 1652cdf0e10cSrcweir { 1653cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 1654cdf0e10cSrcweir } 1655cdf0e10cSrcweir } 1656cdf0e10cSrcweir } 1657cdf0e10cSrcweir } 1658cdf0e10cSrcweir if(bHasDetectableInnerValue) 1659cdf0e10cSrcweir rInnerValue = uno::makeAny(nNumberOfLines); 1660cdf0e10cSrcweir return bHasDetectableInnerValue; 1661cdf0e10cSrcweir } 1662cdf0e10cSrcweir 1663cdf0e10cSrcweir void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1664cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1665cdf0e10cSrcweir { 1666cdf0e10cSrcweir sal_Int32 nNewValue; 1667cdf0e10cSrcweir if( ! (rOuterValue >>= nNewValue) ) 1668cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("property NumberOfLines requires sal_Int32 value"), 0, 0 ); 1669cdf0e10cSrcweir 1670cdf0e10cSrcweir m_aOuterValue = rOuterValue; 1671cdf0e10cSrcweir 1672cdf0e10cSrcweir uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); 1673cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1674cdf0e10cSrcweir sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram ); 1675cdf0e10cSrcweir if( xChartDoc.is() && xDiagram.is() && nDimension == 2 ) 1676cdf0e10cSrcweir { 1677cdf0e10cSrcweir Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); 1678cdf0e10cSrcweir DiagramHelper::tTemplateWithServiceName aTemplateAndService = 1679cdf0e10cSrcweir DiagramHelper::getTemplateForDiagram( xDiagram, xFact ); 1680cdf0e10cSrcweir 1681cdf0e10cSrcweir uno::Reference< chart2::XChartTypeTemplate > xTemplate(0); 1682cdf0e10cSrcweir if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) ) 1683cdf0e10cSrcweir { 1684cdf0e10cSrcweir if( nNewValue != 0 ) 1685cdf0e10cSrcweir { 1686cdf0e10cSrcweir xTemplate.set( aTemplateAndService.first ); 1687cdf0e10cSrcweir try 1688cdf0e10cSrcweir { 1689cdf0e10cSrcweir sal_Int32 nOldValue = 0; 1690cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY ); 1691cdf0e10cSrcweir xProp->getPropertyValue( m_aOuterName ) >>= nOldValue; 1692cdf0e10cSrcweir if( nOldValue == nNewValue ) 1693cdf0e10cSrcweir return; 1694cdf0e10cSrcweir } 1695cdf0e10cSrcweir catch( uno::Exception & ex ) 1696cdf0e10cSrcweir { 1697cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 1698cdf0e10cSrcweir } 1699cdf0e10cSrcweir } 1700cdf0e10cSrcweir else 1701cdf0e10cSrcweir { 1702cdf0e10cSrcweir xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.Column" ) ), uno::UNO_QUERY ); 1703cdf0e10cSrcweir } 1704cdf0e10cSrcweir } 1705cdf0e10cSrcweir else if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.Column" ) ) ) 1706cdf0e10cSrcweir { 1707cdf0e10cSrcweir if( nNewValue == 0 ) 1708cdf0e10cSrcweir return; 1709cdf0e10cSrcweir xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ), uno::UNO_QUERY ); 1710cdf0e10cSrcweir } 1711cdf0e10cSrcweir 1712cdf0e10cSrcweir if(xTemplate.is()) 1713cdf0e10cSrcweir { 1714cdf0e10cSrcweir try 1715cdf0e10cSrcweir { 1716cdf0e10cSrcweir // /-- locked controllers 1717cdf0e10cSrcweir ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() ); 1718cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY ); 1719cdf0e10cSrcweir xProp->setPropertyValue( C2U( "NumberOfLines" ), uno::makeAny(nNewValue) ); 1720cdf0e10cSrcweir xTemplate->changeDiagram( xDiagram ); 1721cdf0e10cSrcweir // \-- locked controllers 1722cdf0e10cSrcweir } 1723cdf0e10cSrcweir catch( uno::Exception & ex ) 1724cdf0e10cSrcweir { 1725cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 1726cdf0e10cSrcweir } 1727cdf0e10cSrcweir } 1728cdf0e10cSrcweir } 1729cdf0e10cSrcweir } 1730cdf0e10cSrcweir 1731cdf0e10cSrcweir Any WrappedNumberOfLinesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1732cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1733cdf0e10cSrcweir { 1734cdf0e10cSrcweir Any aRet; 1735cdf0e10cSrcweir if( !detectInnerValue( aRet ) ) 1736cdf0e10cSrcweir aRet = m_aOuterValue; 1737cdf0e10cSrcweir return aRet; 1738cdf0e10cSrcweir } 1739cdf0e10cSrcweir 1740cdf0e10cSrcweir Any WrappedNumberOfLinesProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 1741cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1742cdf0e10cSrcweir { 1743cdf0e10cSrcweir Any aRet; 1744cdf0e10cSrcweir aRet <<= sal_Int32( 0 ); 1745cdf0e10cSrcweir return aRet; 1746cdf0e10cSrcweir } 1747cdf0e10cSrcweir 1748cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1749cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1750cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1751cdf0e10cSrcweir 1752cdf0e10cSrcweir //PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS 1753cdf0e10cSrcweir class WrappedAttributedDataPointsProperty : public WrappedProperty 1754cdf0e10cSrcweir { 1755cdf0e10cSrcweir public: 1756cdf0e10cSrcweir WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 1757cdf0e10cSrcweir virtual ~WrappedAttributedDataPointsProperty(); 1758cdf0e10cSrcweir 1759cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1760cdf0e10cSrcweir 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); 1761cdf0e10cSrcweir 1762cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1763cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1764cdf0e10cSrcweir 1765cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1766cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1767cdf0e10cSrcweir 1768cdf0e10cSrcweir private: //member 1769cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 1770cdf0e10cSrcweir mutable Any m_aOuterValue; 1771cdf0e10cSrcweir }; 1772cdf0e10cSrcweir 1773cdf0e10cSrcweir WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 1774cdf0e10cSrcweir : WrappedProperty(C2U("AttributedDataPoints"),OUString()) 1775cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 1776cdf0e10cSrcweir , m_aOuterValue() 1777cdf0e10cSrcweir { 1778cdf0e10cSrcweir m_aOuterValue = WrappedAttributedDataPointsProperty::getPropertyDefault( 0 ); 1779cdf0e10cSrcweir } 1780cdf0e10cSrcweir 1781cdf0e10cSrcweir WrappedAttributedDataPointsProperty::~WrappedAttributedDataPointsProperty() 1782cdf0e10cSrcweir { 1783cdf0e10cSrcweir } 1784cdf0e10cSrcweir 1785cdf0e10cSrcweir void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1786cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1787cdf0e10cSrcweir { 1788cdf0e10cSrcweir uno::Sequence< uno::Sequence< sal_Int32 > > aNewValue; 1789cdf0e10cSrcweir if( ! (rOuterValue >>= aNewValue) ) 1790cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Property AttributedDataPoints requires value of type uno::Sequence< uno::Sequence< sal_Int32 > >"), 0, 0 ); 1791cdf0e10cSrcweir 1792cdf0e10cSrcweir m_aOuterValue = rOuterValue; 1793cdf0e10cSrcweir 1794cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1795cdf0e10cSrcweir Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY ); 1796cdf0e10cSrcweir 1797cdf0e10cSrcweir if( xDiagram.is() && xDiaProp.is()) 1798cdf0e10cSrcweir { 1799cdf0e10cSrcweir ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( 1800cdf0e10cSrcweir ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); 1801cdf0e10cSrcweir 1802cdf0e10cSrcweir uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() ); 1803cdf0e10cSrcweir 1804cdf0e10cSrcweir ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt = 1805cdf0e10cSrcweir aSeriesVector.begin(); 1806cdf0e10cSrcweir sal_Int32 i = 0; 1807cdf0e10cSrcweir for( ; aIt != aSeriesVector.end(); ++aIt, ++i ) 1808cdf0e10cSrcweir { 1809cdf0e10cSrcweir Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY ); 1810cdf0e10cSrcweir if( xProp.is()) 1811cdf0e10cSrcweir { 1812cdf0e10cSrcweir uno::Any aVal; 1813cdf0e10cSrcweir if( i < aNewValue.getLength() ) 1814cdf0e10cSrcweir aVal <<= aNewValue[i]; 1815cdf0e10cSrcweir else 1816cdf0e10cSrcweir { 1817cdf0e10cSrcweir //set empty sequence 1818cdf0e10cSrcweir uno::Sequence< sal_Int32 > aSeq; 1819cdf0e10cSrcweir aVal <<= aSeq; 1820cdf0e10cSrcweir } 1821cdf0e10cSrcweir xProp->setPropertyValue( C2U( "AttributedDataPoints" ), aVal ); 1822cdf0e10cSrcweir } 1823cdf0e10cSrcweir } 1824cdf0e10cSrcweir } 1825cdf0e10cSrcweir } 1826cdf0e10cSrcweir 1827cdf0e10cSrcweir Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1828cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1829cdf0e10cSrcweir { 1830cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1831cdf0e10cSrcweir Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY ); 1832cdf0e10cSrcweir 1833cdf0e10cSrcweir if( xDiagram.is() && xDiaProp.is()) 1834cdf0e10cSrcweir { 1835cdf0e10cSrcweir ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( 1836cdf0e10cSrcweir ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) ); 1837cdf0e10cSrcweir 1838cdf0e10cSrcweir uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() ); 1839cdf0e10cSrcweir 1840cdf0e10cSrcweir ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt = 1841cdf0e10cSrcweir aSeriesVector.begin(); 1842cdf0e10cSrcweir sal_Int32 i = 0; 1843cdf0e10cSrcweir for( ; aIt != aSeriesVector.end(); ++aIt, ++i ) 1844cdf0e10cSrcweir { 1845cdf0e10cSrcweir Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY ); 1846cdf0e10cSrcweir if( xProp.is()) 1847cdf0e10cSrcweir { 1848cdf0e10cSrcweir uno::Any aVal( 1849cdf0e10cSrcweir xProp->getPropertyValue( C2U( "AttributedDataPoints" ))); 1850cdf0e10cSrcweir uno::Sequence< sal_Int32 > aSeq; 1851cdf0e10cSrcweir if( aVal >>= aSeq ) 1852cdf0e10cSrcweir aResult[ i ] = aSeq; 1853cdf0e10cSrcweir } 1854cdf0e10cSrcweir } 1855cdf0e10cSrcweir m_aOuterValue <<= aResult; 1856cdf0e10cSrcweir } 1857cdf0e10cSrcweir return m_aOuterValue; 1858cdf0e10cSrcweir } 1859cdf0e10cSrcweir 1860cdf0e10cSrcweir Any WrappedAttributedDataPointsProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 1861cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1862cdf0e10cSrcweir { 1863cdf0e10cSrcweir Any aRet; 1864cdf0e10cSrcweir uno::Sequence< uno::Sequence< sal_Int32 > > aSeq; 1865cdf0e10cSrcweir aRet <<= aSeq; 1866cdf0e10cSrcweir return aRet; 1867cdf0e10cSrcweir } 1868cdf0e10cSrcweir 1869cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1870cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1871cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1872cdf0e10cSrcweir 1873cdf0e10cSrcweir //PROP_DIAGRAM_SOLIDTYPE 1874cdf0e10cSrcweir class WrappedSolidTypeProperty : public WrappedProperty 1875cdf0e10cSrcweir { 1876cdf0e10cSrcweir public: 1877cdf0e10cSrcweir WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 1878cdf0e10cSrcweir virtual ~WrappedSolidTypeProperty(); 1879cdf0e10cSrcweir 1880cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1881cdf0e10cSrcweir 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); 1882cdf0e10cSrcweir 1883cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1884cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1885cdf0e10cSrcweir 1886cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1887cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1888cdf0e10cSrcweir 1889cdf0e10cSrcweir private: //member 1890cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 1891cdf0e10cSrcweir mutable Any m_aOuterValue; 1892cdf0e10cSrcweir }; 1893cdf0e10cSrcweir 1894cdf0e10cSrcweir WrappedSolidTypeProperty::WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 1895cdf0e10cSrcweir : WrappedProperty( C2U( "SolidType" ), OUString() ) 1896cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 1897cdf0e10cSrcweir , m_aOuterValue() 1898cdf0e10cSrcweir { 1899cdf0e10cSrcweir m_aOuterValue = WrappedSolidTypeProperty::getPropertyDefault( 0 ); 1900cdf0e10cSrcweir } 1901cdf0e10cSrcweir 1902cdf0e10cSrcweir WrappedSolidTypeProperty::~WrappedSolidTypeProperty() 1903cdf0e10cSrcweir { 1904cdf0e10cSrcweir } 1905cdf0e10cSrcweir 1906cdf0e10cSrcweir void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1907cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1908cdf0e10cSrcweir { 1909cdf0e10cSrcweir sal_Int32 nNewSolidType = ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID; 1910cdf0e10cSrcweir if( ! (rOuterValue >>= nNewSolidType) ) 1911cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Property SolidType requires integer value"), 0, 0 ); 1912cdf0e10cSrcweir 1913cdf0e10cSrcweir m_aOuterValue = rOuterValue; 1914cdf0e10cSrcweir 1915cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1916cdf0e10cSrcweir if( !xDiagram.is() ) 1917cdf0e10cSrcweir return; 1918cdf0e10cSrcweir 1919cdf0e10cSrcweir bool bFound = false; 1920cdf0e10cSrcweir bool bAmbiguous = false; 1921cdf0e10cSrcweir sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous ); 1922cdf0e10cSrcweir if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) ) 1923cdf0e10cSrcweir DiagramHelper::setGeometry3D( xDiagram, nNewSolidType ); 1924cdf0e10cSrcweir } 1925cdf0e10cSrcweir 1926cdf0e10cSrcweir Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 1927cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1928cdf0e10cSrcweir { 1929cdf0e10cSrcweir bool bFound = false; 1930cdf0e10cSrcweir bool bAmbiguous = false; 1931cdf0e10cSrcweir Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); 1932cdf0e10cSrcweir if( xDiagram.is() ) 1933cdf0e10cSrcweir { 1934cdf0e10cSrcweir sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous ); 1935cdf0e10cSrcweir if( bFound ) 1936cdf0e10cSrcweir m_aOuterValue <<= nGeometry; 1937cdf0e10cSrcweir } 1938cdf0e10cSrcweir return m_aOuterValue; 1939cdf0e10cSrcweir } 1940cdf0e10cSrcweir 1941cdf0e10cSrcweir Any WrappedSolidTypeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 1942cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1943cdf0e10cSrcweir { 1944cdf0e10cSrcweir return uno::makeAny( ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID ); 1945cdf0e10cSrcweir } 1946cdf0e10cSrcweir 1947cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1948cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1949cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 1950cdf0e10cSrcweir 1951cdf0e10cSrcweir class WrappedAutomaticSizeProperty : public WrappedProperty 1952cdf0e10cSrcweir { 1953cdf0e10cSrcweir public: 1954cdf0e10cSrcweir WrappedAutomaticSizeProperty(); 1955cdf0e10cSrcweir virtual ~WrappedAutomaticSizeProperty(); 1956cdf0e10cSrcweir 1957cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1958cdf0e10cSrcweir 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); 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 1961cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1962cdf0e10cSrcweir 1963cdf0e10cSrcweir virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const 1964cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 1965cdf0e10cSrcweir }; 1966cdf0e10cSrcweir 1967cdf0e10cSrcweir WrappedAutomaticSizeProperty::WrappedAutomaticSizeProperty() 1968cdf0e10cSrcweir : WrappedProperty( C2U( "AutomaticSize" ), OUString() ) 1969cdf0e10cSrcweir { 1970cdf0e10cSrcweir } 1971cdf0e10cSrcweir 1972cdf0e10cSrcweir WrappedAutomaticSizeProperty::~WrappedAutomaticSizeProperty() 1973cdf0e10cSrcweir { 1974cdf0e10cSrcweir } 1975cdf0e10cSrcweir 1976cdf0e10cSrcweir void WrappedAutomaticSizeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const 1977cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1978cdf0e10cSrcweir { 1979cdf0e10cSrcweir if( xInnerPropertySet.is() ) 1980cdf0e10cSrcweir { 1981cdf0e10cSrcweir bool bNewValue = true; 1982cdf0e10cSrcweir if( ! (rOuterValue >>= bNewValue) ) 1983cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Property AutomaticSize requires value of type boolean"), 0, 0 ); 1984cdf0e10cSrcweir 1985cdf0e10cSrcweir try 1986cdf0e10cSrcweir { 1987cdf0e10cSrcweir if( bNewValue ) 1988cdf0e10cSrcweir { 1989cdf0e10cSrcweir Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) ); 1990cdf0e10cSrcweir if( aRelativeSize.hasValue() ) 1991cdf0e10cSrcweir xInnerPropertySet->setPropertyValue( C2U( "RelativeSize" ), Any() ); 1992cdf0e10cSrcweir } 1993cdf0e10cSrcweir } 1994cdf0e10cSrcweir catch( uno::Exception & ex ) 1995cdf0e10cSrcweir { 1996cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 1997cdf0e10cSrcweir } 1998cdf0e10cSrcweir } 1999cdf0e10cSrcweir } 2000cdf0e10cSrcweir 2001cdf0e10cSrcweir Any WrappedAutomaticSizeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const 2002cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 2003cdf0e10cSrcweir { 2004cdf0e10cSrcweir Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) ); 2005cdf0e10cSrcweir if( xInnerPropertySet.is() ) 2006cdf0e10cSrcweir { 2007cdf0e10cSrcweir Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) ); 2008cdf0e10cSrcweir if( !aRelativeSize.hasValue() ) 2009cdf0e10cSrcweir aRet <<= true; 2010cdf0e10cSrcweir } 2011cdf0e10cSrcweir return aRet; 2012cdf0e10cSrcweir } 2013cdf0e10cSrcweir 2014cdf0e10cSrcweir Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const 2015cdf0e10cSrcweir throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 2016cdf0e10cSrcweir { 2017cdf0e10cSrcweir Any aRet; 2018cdf0e10cSrcweir aRet <<= false; 2019cdf0e10cSrcweir return aRet; 2020cdf0e10cSrcweir } 2021cdf0e10cSrcweir 2022cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 2023cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 2024cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 2025cdf0e10cSrcweir 2026cdf0e10cSrcweir //PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS 2027cdf0e10cSrcweir class WrappedIncludeHiddenCellsProperty : public WrappedProperty 2028cdf0e10cSrcweir { 2029cdf0e10cSrcweir public: 2030cdf0e10cSrcweir WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); 2031cdf0e10cSrcweir virtual ~WrappedIncludeHiddenCellsProperty(); 2032cdf0e10cSrcweir 2033cdf0e10cSrcweir virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const 2034cdf0e10cSrcweir 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); 2035cdf0e10cSrcweir 2036cdf0e10cSrcweir private: //member 2037cdf0e10cSrcweir ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; 2038cdf0e10cSrcweir }; 2039cdf0e10cSrcweir 2040cdf0e10cSrcweir WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) 2041cdf0e10cSrcweir : WrappedProperty(C2U("IncludeHiddenCells"),C2U("IncludeHiddenCells")) 2042cdf0e10cSrcweir , m_spChart2ModelContact( spChart2ModelContact ) 2043cdf0e10cSrcweir { 2044cdf0e10cSrcweir } 2045cdf0e10cSrcweir 2046cdf0e10cSrcweir WrappedIncludeHiddenCellsProperty::~WrappedIncludeHiddenCellsProperty() 2047cdf0e10cSrcweir { 2048cdf0e10cSrcweir } 2049cdf0e10cSrcweir 2050cdf0e10cSrcweir void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 2051cdf0e10cSrcweir throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 2052cdf0e10cSrcweir { 2053cdf0e10cSrcweir sal_Bool bNewValue = false; 2054cdf0e10cSrcweir if( ! (rOuterValue >>= bNewValue) ) 2055cdf0e10cSrcweir throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 ); 2056cdf0e10cSrcweir 2057cdf0e10cSrcweir ChartModelHelper::setIncludeHiddenCells( bNewValue, m_spChart2ModelContact->getChartModel() ); 2058cdf0e10cSrcweir } 2059cdf0e10cSrcweir 2060cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 2061cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 2062cdf0e10cSrcweir //----------------------------------------------------------------------------------------------------------------- 2063cdf0e10cSrcweir 2064cdf0e10cSrcweir // ____ XDiagramProvider ____ 2065cdf0e10cSrcweir Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram() 2066cdf0e10cSrcweir throw (uno::RuntimeException) 2067cdf0e10cSrcweir { 2068cdf0e10cSrcweir return m_spChart2ModelContact->getChart2Diagram(); 2069cdf0e10cSrcweir } 2070cdf0e10cSrcweir 2071cdf0e10cSrcweir void SAL_CALL DiagramWrapper::setDiagram( 2072cdf0e10cSrcweir const Reference< chart2::XDiagram >& /*xDiagram*/ ) 2073cdf0e10cSrcweir throw (uno::RuntimeException) 2074cdf0e10cSrcweir { 2075cdf0e10cSrcweir //@todo: remove this method from interface 2076cdf0e10cSrcweir DBG_ERROR("DiagramWrapper::setDiagram is not implemented, should be removed and not be called" ); 2077cdf0e10cSrcweir } 2078cdf0e10cSrcweir 2079cdf0e10cSrcweir // ================================================================================ 2080cdf0e10cSrcweir 2081cdf0e10cSrcweir Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet() 2082cdf0e10cSrcweir { 2083cdf0e10cSrcweir return Reference< beans::XPropertySet >( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY ); 2084cdf0e10cSrcweir } 2085cdf0e10cSrcweir 2086cdf0e10cSrcweir const Sequence< beans::Property >& DiagramWrapper::getPropertySequence() 2087cdf0e10cSrcweir { 2088cdf0e10cSrcweir return *StaticDiagramWrapperPropertyArray::get(); 2089cdf0e10cSrcweir } 2090cdf0e10cSrcweir 2091cdf0e10cSrcweir const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties() 2092cdf0e10cSrcweir { 2093cdf0e10cSrcweir ::std::vector< ::chart::WrappedProperty* > aWrappedProperties; 2094cdf0e10cSrcweir 2095cdf0e10cSrcweir WrappedAxisAndGridExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact ); 2096cdf0e10cSrcweir WrappedAxisTitleExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact ); 2097cdf0e10cSrcweir WrappedAxisLabelExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact ); 2098cdf0e10cSrcweir WrappedSceneProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact ); 2099cdf0e10cSrcweir WrappedIgnoreProperties::addIgnoreFillProperties( aWrappedProperties ); 2100cdf0e10cSrcweir WrappedIgnoreProperties::addIgnoreLineProperties( aWrappedProperties ); 2101cdf0e10cSrcweir WrappedStatisticProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact ); 2102cdf0e10cSrcweir WrappedSymbolProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact ); 2103cdf0e10cSrcweir WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact ); 2104cdf0e10cSrcweir WrappedSplineProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact ); 2105cdf0e10cSrcweir WrappedStockProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact ); 2106cdf0e10cSrcweir WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties ); 2107cdf0e10cSrcweir 2108cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedDataRowSourceProperty( m_spChart2ModelContact ) ); 2109cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED,m_spChart2ModelContact ) ); 2110cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED_PERCENT, m_spChart2ModelContact ) ); 2111cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Z_STACKED, m_spChart2ModelContact ) ); 2112cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedDim3DProperty( m_spChart2ModelContact ) ); 2113cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedVerticalProperty( m_spChart2ModelContact ) ); 2114cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedNumberOfLinesProperty( m_spChart2ModelContact ) ); 2115cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedAttributedDataPointsProperty( m_spChart2ModelContact ) ); 2116cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedBarsConnected" ), C2U( "ConnectBars" ) ) ); 2117cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedSolidTypeProperty( m_spChart2ModelContact ) ); 2118cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedAutomaticSizeProperty() ); 2119cdf0e10cSrcweir aWrappedProperties.push_back( new WrappedIncludeHiddenCellsProperty( m_spChart2ModelContact ) ); 2120cdf0e10cSrcweir 2121cdf0e10cSrcweir return aWrappedProperties; 2122cdf0e10cSrcweir } 2123cdf0e10cSrcweir 2124cdf0e10cSrcweir // ================================================================================ 2125cdf0e10cSrcweir 2126cdf0e10cSrcweir uno::Sequence< OUString > DiagramWrapper::getSupportedServiceNames_Static() 2127cdf0e10cSrcweir { 2128cdf0e10cSrcweir uno::Sequence< OUString > aServices( 8 ); 2129cdf0e10cSrcweir aServices[ 0 ] = C2U( "com.sun.star.chart.Diagram" ); 2130cdf0e10cSrcweir aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" ); 2131cdf0e10cSrcweir aServices[ 2 ] = C2U( "com.sun.star.chart.StackableDiagram" ); 2132cdf0e10cSrcweir aServices[ 3 ] = C2U( "com.sun.star.chart.ChartAxisXSupplier" ); 2133cdf0e10cSrcweir aServices[ 4 ] = C2U( "com.sun.star.chart.ChartAxisYSupplier" ); 2134cdf0e10cSrcweir aServices[ 5 ] = C2U( "com.sun.star.chart.ChartAxisZSupplier" ); 2135cdf0e10cSrcweir aServices[ 6 ] = C2U( "com.sun.star.chart.ChartTwoAxisXSupplier" ); 2136cdf0e10cSrcweir aServices[ 7 ] = C2U( "com.sun.star.chart.ChartTwoAxisYSupplier" ); 2137cdf0e10cSrcweir // aServices[ x ] = C2U( "com.sun.star.beans.PropertySet" ); 2138cdf0e10cSrcweir // aServices[ x ] = C2U( "com.sun.star.drawing.FillProperties" ); 2139cdf0e10cSrcweir // aServices[ x ] = C2U( "com.sun.star.drawing.LineProperties" ); 2140cdf0e10cSrcweir 2141cdf0e10cSrcweir return aServices; 2142cdf0e10cSrcweir } 2143cdf0e10cSrcweir 2144cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static 2145cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( DiagramWrapper, lcl_aServiceName ); 2146cdf0e10cSrcweir 2147cdf0e10cSrcweir } // namespace wrapper 2148cdf0e10cSrcweir } // namespace chart 2149cdf0e10cSrcweir 2150