2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-17 12:30:48 +01:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2007-05-22 16:22:23 +00:00
|
|
|
|
|
|
|
#include "WrappedNumberFormatProperty.hxx"
|
|
|
|
#include "macros.hxx"
|
2014-06-17 11:41:06 -04:00
|
|
|
#include <unonames.hxx>
|
2014-11-14 22:52:35 +01:00
|
|
|
#include <osl/diagnose.h>
|
2007-05-22 16:22:23 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
namespace wrapper
|
|
|
|
{
|
|
|
|
|
|
|
|
WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
|
2014-06-17 11:41:06 -04:00
|
|
|
: WrappedDirectStateProperty( CHART_UNONAME_NUMFMT, CHART_UNONAME_NUMFMT )
|
2007-05-22 16:22:23 +00:00
|
|
|
, m_spChart2ModelContact(spChart2ModelContact)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
WrappedNumberFormatProperty::~WrappedNumberFormatProperty()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
sal_Int32 nFormat = 0;
|
|
|
|
if( ! (rOuterValue >>= nFormat) )
|
2012-04-08 10:48:08 -04:30
|
|
|
throw lang::IllegalArgumentException( "Property 'NumberFormat' requires value of type sal_Int32", 0, 0 );
|
2007-05-22 16:22:23 +00:00
|
|
|
|
|
|
|
if(xInnerPropertySet.is())
|
2014-06-13 11:12:50 -04:00
|
|
|
xInnerPropertySet->setPropertyValue(getInnerName(), this->convertOuterToInnerValue(rOuterValue));
|
2007-05-22 16:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
2007-06-11 13:57:34 +00:00
|
|
|
if( !xInnerPropertySet.is() )
|
|
|
|
{
|
2011-03-01 19:05:02 +01:00
|
|
|
OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
|
2007-06-11 13:57:34 +00:00
|
|
|
return Any();
|
|
|
|
}
|
2014-06-13 11:12:50 -04:00
|
|
|
Any aRet( xInnerPropertySet->getPropertyValue(getInnerName()));
|
2007-05-22 16:22:23 +00:00
|
|
|
if( !aRet.hasValue() )
|
|
|
|
{
|
2009-07-02 19:17:43 +00:00
|
|
|
sal_Int32 nKey = 0;
|
|
|
|
Reference< chart2::XDataSeries > xSeries( xInnerPropertySet, uno::UNO_QUERY );
|
|
|
|
if( xSeries.is() )
|
|
|
|
nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForSeries( xSeries );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
|
|
|
|
nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
|
|
|
|
}
|
2007-05-22 16:22:23 +00:00
|
|
|
aRet <<= nKey;
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2007-07-25 07:28:45 +00:00
|
|
|
Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
|
2007-05-22 16:22:23 +00:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return uno::makeAny( sal_Int32( 0 ) );
|
|
|
|
}
|
|
|
|
|
2014-06-13 11:12:50 -04:00
|
|
|
WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact ) :
|
|
|
|
WrappedDirectStateProperty(CHART_UNONAME_LINK_TO_SRC_NUMFMT, CHART_UNONAME_LINK_TO_SRC_NUMFMT),
|
|
|
|
m_pChart2ModelContact(pChart2ModelContact)
|
2007-05-22 16:22:23 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
2007-06-11 13:57:34 +00:00
|
|
|
if( !xInnerPropertySet.is() )
|
|
|
|
{
|
2011-03-01 19:05:02 +01:00
|
|
|
OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::setPropertyValue");
|
2007-06-11 13:57:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-06-13 11:12:50 -04:00
|
|
|
xInnerPropertySet->setPropertyValue(getInnerName(), rOuterValue);
|
2007-05-22 16:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
2008-04-18 12:21:40 +00:00
|
|
|
if( !xInnerPropertySet.is() )
|
|
|
|
{
|
2011-03-01 19:05:02 +01:00
|
|
|
OSL_FAIL("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
|
2008-05-15 07:25:21 +00:00
|
|
|
return getPropertyDefault(0);
|
2008-04-18 12:21:40 +00:00
|
|
|
}
|
2014-06-13 11:12:50 -04:00
|
|
|
|
|
|
|
return xInnerPropertySet->getPropertyValue(getInnerName());
|
2007-05-22 16:22:23 +00:00
|
|
|
}
|
|
|
|
|
2007-07-25 07:28:45 +00:00
|
|
|
Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
|
2007-05-22 16:22:23 +00:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
bool bLink = true;
|
|
|
|
return uno::makeAny( bLink );
|
|
|
|
}
|
|
|
|
|
|
|
|
} //namespace wrapper
|
|
|
|
} //namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|