/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// each 'Item' in the Axes collection is indexed via 2 indexes, group and type. // We need to 'flatten' this into a single index in order to be able to wrap // iteration over the set of Axis(s) in a XIndexAccess implementation
typedef ::std::pair<sal_Int32, sal_Int32 > AxesCoordinate; // type and group combination
class AxisIndexWrapper : public ::cppu::WeakImplHelper< container::XIndexAccess >
{ // if necessary for better performance we could change this into a map and cache the // indices -> Axis, currently we create a new Axis object // on each getByIndex
uno::Reference< uno::XComponentContext > mxContext;
std::vector< AxesCoordinate > mCoordinates;
rtl::Reference< ScVbaChart > mxChart; public:
AxisIndexWrapper( uno::Reference< uno::XComponentContext > xContext, rtl::Reference< ScVbaChart > xChart ) : mxContext(std::move( xContext )), mxChart(std::move( xChart ))
{ if ( !mxChart.is() ) return;
uno::Any SAL_CALL
ScVbaAxes::Item( const css::uno::Any& _nType, const css::uno::Any& _oAxisGroup)
{ // #TODO map the possible index combinations to a container::XIndexAccess wrapper impl // using a vector of valid std::pair maybe? // body helper api port bits
sal_Int32 nAxisGroup = xlPrimary;
sal_Int32 nType = -1; if ( !_nType.hasValue() || !( _nType >>= nType ) ) throw uno::RuntimeException(u"Axes::Item Failed to extract type"_ustr );
if ( _oAxisGroup.hasValue() )
_oAxisGroup >>= nAxisGroup ;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.