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 .
|
|
|
|
*/
|
2006-09-17 11:56:32 +00:00
|
|
|
|
2003-12-18 12:50:56 +00:00
|
|
|
#include "TitleWrapper.hxx"
|
|
|
|
#include "macros.hxx"
|
2007-05-22 16:19:25 +00:00
|
|
|
#include "ContainerHelper.hxx"
|
2010-05-21 15:53:45 +02:00
|
|
|
#include "ControllerLockGuard.hxx"
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
#include <comphelper/InlineContainer.hxx>
|
2014-12-09 08:30:11 +02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2003-12-18 12:50:56 +00:00
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
2007-05-22 16:19:25 +00:00
|
|
|
#include <com/sun/star/chart2/RelativePosition.hpp>
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
#include "CharacterProperties.hxx"
|
2013-04-21 02:49:04 +02:00
|
|
|
#include "LinePropertiesHelper.hxx"
|
2003-12-18 12:50:56 +00:00
|
|
|
#include "FillProperties.hxx"
|
|
|
|
#include "UserDefinedProperties.hxx"
|
2007-05-22 16:19:25 +00:00
|
|
|
#include "WrappedCharacterHeightProperty.hxx"
|
|
|
|
#include "WrappedTextRotationProperty.hxx"
|
2008-10-01 07:35:04 +00:00
|
|
|
#include "WrappedAutomaticPositionProperties.hxx"
|
|
|
|
#include "WrappedScaleTextProperties.hxx"
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using ::com::sun::star::beans::Property;
|
|
|
|
using ::osl::MutexGuard;
|
2007-05-22 16:19:25 +00:00
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::uno::Sequence;
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
class WrappedTitleStringProperty : public WrappedProperty
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext );
|
|
|
|
virtual ~WrappedTitleStringProperty();
|
|
|
|
|
|
|
|
virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
2014-03-27 18:12:18 +01:00
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) SAL_OVERRIDE;
|
2007-05-22 16:19:25 +00:00
|
|
|
virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
2014-03-27 18:12:18 +01:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) SAL_OVERRIDE;
|
2007-05-22 16:19:25 +00:00
|
|
|
virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
|
2014-03-27 18:12:18 +01:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) SAL_OVERRIDE;
|
2007-05-22 16:19:25 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
Reference< uno::XComponentContext > m_xContext;
|
|
|
|
};
|
|
|
|
|
|
|
|
WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext )
|
2012-04-08 10:48:08 -04:30
|
|
|
: ::chart::WrappedProperty( "String", OUString() )
|
2007-05-22 16:19:25 +00:00
|
|
|
, m_xContext( xContext )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
WrappedTitleStringProperty::~WrappedTitleStringProperty()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrappedTitleStringProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
Revert "fdo#46808, Convert chart2::Title service to new style"
This reverts commit d256dbede60533369d1aac64cca34721183f6a8a:
For one, the new css.chart2.XTitle2 looked unfinished, in that it transfered the
direct properties of the old-style css.chart2.Title service into attributes, but
left out all the properties inherited by the old-style service from
css.style.ParagraphProperties, css.drawing.FillProperties,
css.drawing.LineProperties (and that missing FIXME css.layout.LayoutElement,
whatever that is supposed to be). This needs more thought, to either make
available all propertiers as attributes, or none.
For another, this broke JunitTest_chart2_unoapi (sch.ChXChartDocument,
sch.ChartTitle), for hard-to-debug reasons.
Conflicts:
chart2/source/model/main/Title.cxx
chart2/source/model/main/Title.hxx
offapi/com/sun/star/chart2/XTitle2.idl
sc/source/filter/inc/xlchart.hxx
Change-Id: I4747208a13984904d0e409ea49a73b0f667c86c7
2013-05-23 10:11:49 +02:00
|
|
|
Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
|
2007-05-22 16:19:25 +00:00
|
|
|
if(xTitle.is())
|
|
|
|
{
|
|
|
|
OUString aString;
|
|
|
|
rOuterValue >>= aString;
|
|
|
|
TitleHelper::setCompleteString( aString, xTitle, m_xContext );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
|
Revert "fdo#46808, Convert chart2::Title service to new style"
This reverts commit d256dbede60533369d1aac64cca34721183f6a8a:
For one, the new css.chart2.XTitle2 looked unfinished, in that it transfered the
direct properties of the old-style css.chart2.Title service into attributes, but
left out all the properties inherited by the old-style service from
css.style.ParagraphProperties, css.drawing.FillProperties,
css.drawing.LineProperties (and that missing FIXME css.layout.LayoutElement,
whatever that is supposed to be). This needs more thought, to either make
available all propertiers as attributes, or none.
For another, this broke JunitTest_chart2_unoapi (sch.ChXChartDocument,
sch.ChartTitle), for hard-to-debug reasons.
Conflicts:
chart2/source/model/main/Title.cxx
chart2/source/model/main/Title.hxx
offapi/com/sun/star/chart2/XTitle2.idl
sc/source/filter/inc/xlchart.hxx
Change-Id: I4747208a13984904d0e409ea49a73b0f667c86c7
2013-05-23 10:11:49 +02:00
|
|
|
Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
|
2007-05-22 16:19:25 +00:00
|
|
|
if(xTitle.is())
|
|
|
|
{
|
|
|
|
Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
|
|
|
|
|
2013-02-28 19:28:03 +01:00
|
|
|
OUStringBuffer aBuf;
|
2007-05-22 16:19:25 +00:00
|
|
|
for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
|
|
|
|
{
|
|
|
|
aBuf.append( aStrings[ i ]->getString());
|
|
|
|
}
|
|
|
|
aRet <<= aBuf.makeStringAndClear();
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
2007-07-25 07:27:35 +00:00
|
|
|
Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
|
2007-05-22 16:19:25 +00:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
2013-02-28 19:28:03 +01:00
|
|
|
return uno::makeAny( OUString() );//default title is a empty String
|
2007-05-22 16:19:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class WrappedStackedTextProperty : public WrappedProperty
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WrappedStackedTextProperty();
|
|
|
|
virtual ~WrappedStackedTextProperty();
|
|
|
|
};
|
|
|
|
|
|
|
|
WrappedStackedTextProperty::WrappedStackedTextProperty()
|
2012-04-08 10:48:08 -04:30
|
|
|
: ::chart::WrappedProperty( "StackedText", "StackCharacters" )
|
2007-05-22 16:19:25 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
WrappedStackedTextProperty::~WrappedStackedTextProperty()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
}// end namespace chart
|
|
|
|
|
2003-12-18 12:50:56 +00:00
|
|
|
namespace
|
|
|
|
{
|
2014-11-03 14:03:54 +02:00
|
|
|
static const char lcl_aServiceName[] = "com.sun.star.comp.chart.Title";
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_TITLE_STRING,
|
|
|
|
PROP_TITLE_TEXT_ROTATION,
|
|
|
|
PROP_TITLE_TEXT_STACKED
|
|
|
|
};
|
|
|
|
|
|
|
|
void lcl_AddPropertiesToVector(
|
|
|
|
::std::vector< Property > & rOutProperties )
|
|
|
|
{
|
|
|
|
rOutProperties.push_back(
|
2012-04-08 10:48:08 -04:30
|
|
|
Property( "String",
|
2003-12-18 12:50:56 +00:00
|
|
|
PROP_TITLE_STRING,
|
2014-05-18 00:35:50 +02:00
|
|
|
cppu::UnoType<OUString>::get(),
|
2003-12-18 12:50:56 +00:00
|
|
|
beans::PropertyAttribute::BOUND
|
|
|
|
| beans::PropertyAttribute::MAYBEVOID ));
|
|
|
|
|
|
|
|
rOutProperties.push_back(
|
2012-04-08 10:48:08 -04:30
|
|
|
Property( "TextRotation",
|
2003-12-18 12:50:56 +00:00
|
|
|
PROP_TITLE_TEXT_ROTATION,
|
2014-05-18 00:35:50 +02:00
|
|
|
cppu::UnoType<sal_Int32>::get(),
|
2003-12-18 12:50:56 +00:00
|
|
|
beans::PropertyAttribute::BOUND
|
|
|
|
| beans::PropertyAttribute::MAYBEDEFAULT ));
|
|
|
|
rOutProperties.push_back(
|
2012-04-08 10:48:08 -04:30
|
|
|
Property( "StackedText",
|
2003-12-18 12:50:56 +00:00
|
|
|
PROP_TITLE_TEXT_STACKED,
|
2015-04-01 08:35:38 +02:00
|
|
|
cppu::UnoType<bool>::get(),
|
2003-12-18 12:50:56 +00:00
|
|
|
beans::PropertyAttribute::BOUND
|
|
|
|
| beans::PropertyAttribute::MAYBEDEFAULT ));
|
|
|
|
}
|
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
struct StaticTitleWrapperPropertyArray_Initializer
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2010-10-05 11:10:54 +02:00
|
|
|
Sequence< Property >* operator()()
|
|
|
|
{
|
|
|
|
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
|
|
|
|
return &aPropSeq;
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
private:
|
|
|
|
Sequence< Property > lcl_GetPropertySequence()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
::std::vector< beans::Property > aProperties;
|
2003-12-18 12:50:56 +00:00
|
|
|
lcl_AddPropertiesToVector( aProperties );
|
2007-05-22 16:19:25 +00:00
|
|
|
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
|
2013-04-21 02:49:04 +02:00
|
|
|
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
|
2007-05-22 16:19:25 +00:00
|
|
|
::chart::FillProperties::AddPropertiesToVector( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
|
2008-10-01 07:35:04 +00:00
|
|
|
::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
|
|
|
|
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
::std::sort( aProperties.begin(), aProperties.end(),
|
2007-05-22 16:19:25 +00:00
|
|
|
::chart::PropertyNameLess() );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
return ::chart::ContainerHelper::ContainerToSequence( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
2010-10-05 11:10:54 +02:00
|
|
|
};
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
struct StaticTitleWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticTitleWrapperPropertyArray_Initializer >
|
|
|
|
{
|
|
|
|
};
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
namespace wrapper
|
|
|
|
{
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
|
|
|
|
::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
|
|
|
|
m_spChart2ModelContact( spChart2ModelContact ),
|
|
|
|
m_aEventListenerContainer( m_aMutex ),
|
|
|
|
m_eTitleType(eTitleType)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2013-10-15 07:55:26 +02:00
|
|
|
ControllerLockGuardUNO aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
|
2010-05-21 15:53:45 +02:00
|
|
|
if( !getTitleObject().is() ) //#i83831# create an empty title at the model, thus references to properties can be mapped mapped correctly
|
|
|
|
TitleHelper::createTitle( m_eTitleType, OUString(), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TitleWrapper::~TitleWrapper()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XShape ____
|
|
|
|
awt::Point SAL_CALL TitleWrapper::getPosition()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-08-17 11:12:17 +00:00
|
|
|
return m_spChart2ModelContact->GetTitlePosition( this->getTitleObject() );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL TitleWrapper::setPosition( const awt::Point& aPosition )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Reference< beans::XPropertySet > xPropertySet( this->getInnerPropertySet() );
|
|
|
|
if(xPropertySet.is())
|
|
|
|
{
|
|
|
|
awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
|
|
|
|
|
|
|
|
chart2::RelativePosition aRelativePosition;
|
|
|
|
aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
|
|
|
|
aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
|
|
|
|
aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
|
2012-04-08 10:48:08 -04:30
|
|
|
xPropertySet->setPropertyValue( "RelativePosition", uno::makeAny(aRelativePosition) );
|
2007-05-22 16:19:25 +00:00
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
awt::Size SAL_CALL TitleWrapper::getSize()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-08-17 11:12:17 +00:00
|
|
|
return m_spChart2ModelContact->GetTitleSize( this->getTitleObject() );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-07-25 07:27:35 +00:00
|
|
|
void SAL_CALL TitleWrapper::setSize( const awt::Size& /*aSize*/ )
|
2003-12-18 12:50:56 +00:00
|
|
|
throw (beans::PropertyVetoException,
|
2014-02-25 21:31:58 +01:00
|
|
|
uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2011-03-12 11:28:41 +01:00
|
|
|
OSL_FAIL( "trying to set size of title" );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XShapeDescriptor (base of XShape) ____
|
2007-05-22 16:19:25 +00:00
|
|
|
OUString SAL_CALL TitleWrapper::getShapeType()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2013-02-28 19:28:03 +01:00
|
|
|
return OUString( "com.sun.star.chart.ChartTitle" );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XComponent ____
|
|
|
|
void SAL_CALL TitleWrapper::dispose()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
|
|
|
|
m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
MutexGuard aGuard( GetMutex());
|
2007-05-22 16:19:25 +00:00
|
|
|
clearWrappedPropertySet();
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL TitleWrapper::addEventListener(
|
2007-05-22 16:19:25 +00:00
|
|
|
const Reference< lang::XEventListener >& xListener )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
|
|
|
m_aEventListenerContainer.addInterface( xListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL TitleWrapper::removeEventListener(
|
2007-05-22 16:19:25 +00:00
|
|
|
const Reference< lang::XEventListener >& aListener )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
|
|
|
m_aEventListenerContainer.removeInterface( aListener );
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Reference< beans::XPropertySet > xProp;
|
2003-12-18 12:50:56 +00:00
|
|
|
|
Revert "fdo#46808, Convert chart2::Title service to new style"
This reverts commit d256dbede60533369d1aac64cca34721183f6a8a:
For one, the new css.chart2.XTitle2 looked unfinished, in that it transfered the
direct properties of the old-style css.chart2.Title service into attributes, but
left out all the properties inherited by the old-style service from
css.style.ParagraphProperties, css.drawing.FillProperties,
css.drawing.LineProperties (and that missing FIXME css.layout.LayoutElement,
whatever that is supposed to be). This needs more thought, to either make
available all propertiers as attributes, or none.
For another, this broke JunitTest_chart2_unoapi (sch.ChXChartDocument,
sch.ChartTitle), for hard-to-debug reasons.
Conflicts:
chart2/source/model/main/Title.cxx
chart2/source/model/main/Title.hxx
offapi/com/sun/star/chart2/XTitle2.idl
sc/source/filter/inc/xlchart.hxx
Change-Id: I4747208a13984904d0e409ea49a73b0f667c86c7
2013-05-23 10:11:49 +02:00
|
|
|
Reference< chart2::XTitle > xTitle( this->getTitleObject() );
|
2007-05-22 16:19:25 +00:00
|
|
|
if( xTitle.is())
|
|
|
|
{
|
|
|
|
Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
|
|
|
|
if( aStrings.getLength() > 0 )
|
|
|
|
xProp.set( aStrings[0], uno::UNO_QUERY );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
return xProp;
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
void TitleWrapper::getFastCharacterPropertyValue( sal_Int32 nHandle, Any& rValue )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
|
|
|
|
nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
Reference< beans::XPropertySet > xProp( getFirstCharacterPropertySet(), uno::UNO_QUERY );
|
|
|
|
Reference< beans::XFastPropertySet > xFastProp( xProp, uno::UNO_QUERY );
|
|
|
|
if(xProp.is())
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
|
|
|
|
if( pWrappedProperty )
|
|
|
|
{
|
|
|
|
rValue = pWrappedProperty->getPropertyValue( xProp );
|
|
|
|
}
|
|
|
|
else if( xFastProp.is() )
|
|
|
|
{
|
|
|
|
rValue = xFastProp->getFastPropertyValue( nHandle );
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
2007-05-22 16:19:25 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void TitleWrapper::setFastCharacterPropertyValue(
|
|
|
|
sal_Int32 nHandle, const Any& rValue ) throw (uno::Exception)
|
|
|
|
{
|
|
|
|
OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
|
|
|
|
nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
|
|
|
|
|
Revert "fdo#46808, Convert chart2::Title service to new style"
This reverts commit d256dbede60533369d1aac64cca34721183f6a8a:
For one, the new css.chart2.XTitle2 looked unfinished, in that it transfered the
direct properties of the old-style css.chart2.Title service into attributes, but
left out all the properties inherited by the old-style service from
css.style.ParagraphProperties, css.drawing.FillProperties,
css.drawing.LineProperties (and that missing FIXME css.layout.LayoutElement,
whatever that is supposed to be). This needs more thought, to either make
available all propertiers as attributes, or none.
For another, this broke JunitTest_chart2_unoapi (sch.ChXChartDocument,
sch.ChartTitle), for hard-to-debug reasons.
Conflicts:
chart2/source/model/main/Title.cxx
chart2/source/model/main/Title.hxx
offapi/com/sun/star/chart2/XTitle2.idl
sc/source/filter/inc/xlchart.hxx
Change-Id: I4747208a13984904d0e409ea49a73b0f667c86c7
2013-05-23 10:11:49 +02:00
|
|
|
Reference< chart2::XTitle > xTitle( this->getTitleObject() );
|
2007-05-22 16:19:25 +00:00
|
|
|
if( xTitle.is())
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
|
|
|
|
const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
|
|
|
|
|
|
|
|
for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Reference< beans::XFastPropertySet > xFastPropertySet( aStrings[ i ], uno::UNO_QUERY );
|
|
|
|
Reference< beans::XPropertySet > xPropSet( xFastPropertySet, uno::UNO_QUERY );
|
|
|
|
|
|
|
|
if( pWrappedProperty )
|
|
|
|
pWrappedProperty->setPropertyValue( rValue, xPropSet );
|
|
|
|
else if( xFastPropertySet.is() )
|
|
|
|
xFastPropertySet->setFastPropertyValue( nHandle, rValue );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
// WrappedPropertySet
|
|
|
|
|
|
|
|
void SAL_CALL TitleWrapper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
|
|
|
|
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
setFastCharacterPropertyValue( nHandle, rValue );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
else
|
2007-05-22 16:19:25 +00:00
|
|
|
WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
Any SAL_CALL TitleWrapper::getPropertyValue( const OUString& rPropertyName )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Any aRet;
|
|
|
|
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
|
|
|
|
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
|
|
|
|
getFastCharacterPropertyValue( nHandle, aRet );
|
|
|
|
else
|
|
|
|
aRet = WrappedPropertySet::getPropertyValue( rPropertyName );
|
|
|
|
return aRet;
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
beans::PropertyState SAL_CALL TitleWrapper::getPropertyState( const OUString& rPropertyName )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
|
2007-05-22 16:19:25 +00:00
|
|
|
{
|
2007-07-25 07:27:35 +00:00
|
|
|
beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
|
|
|
|
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
|
|
|
|
if( xPropState.is() )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
|
|
|
|
if( pWrappedProperty )
|
|
|
|
aState = pWrappedProperty->getPropertyState( xPropState );
|
|
|
|
else
|
|
|
|
aState = xPropState->getPropertyState( rPropertyName );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-22 16:19:25 +00:00
|
|
|
else
|
|
|
|
aState = WrappedPropertySet::getPropertyState( rPropertyName );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
return aState;
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
2007-05-22 16:19:25 +00:00
|
|
|
void SAL_CALL TitleWrapper::setPropertyToDefault( const OUString& rPropertyName )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
|
|
|
|
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Any aDefault = getPropertyDefault( rPropertyName );
|
|
|
|
setFastCharacterPropertyValue( nHandle, aDefault );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
WrappedPropertySet::setPropertyToDefault( rPropertyName );
|
|
|
|
}
|
|
|
|
Any SAL_CALL TitleWrapper::getPropertyDefault( const OUString& rPropertyName )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
|
2007-05-22 16:19:25 +00:00
|
|
|
{
|
|
|
|
Any aRet;
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
|
|
|
|
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
|
|
|
|
{
|
|
|
|
Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
|
|
|
|
if( xPropState.is() )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
|
|
|
|
if( pWrappedProperty )
|
|
|
|
aRet = pWrappedProperty->getPropertyDefault(xPropState);
|
|
|
|
else
|
|
|
|
aRet = xPropState->getPropertyDefault( rPropertyName );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-22 16:19:25 +00:00
|
|
|
else
|
|
|
|
aRet = WrappedPropertySet::getPropertyDefault( rPropertyName );
|
|
|
|
|
|
|
|
return aRet;
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2010-05-21 15:53:45 +02:00
|
|
|
void SAL_CALL TitleWrapper::addPropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& xListener )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
|
2010-05-21 15:53:45 +02:00
|
|
|
{
|
|
|
|
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
|
|
|
|
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
|
|
|
|
{
|
|
|
|
Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
|
|
|
|
if( xPropSet.is() )
|
|
|
|
xPropSet->addPropertyChangeListener( rPropertyName, xListener );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
WrappedPropertySet::addPropertyChangeListener( rPropertyName, xListener );
|
|
|
|
}
|
|
|
|
void SAL_CALL TitleWrapper::removePropertyChangeListener( const OUString& rPropertyName, const Reference< beans::XPropertyChangeListener >& xListener )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
|
2010-05-21 15:53:45 +02:00
|
|
|
{
|
|
|
|
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
|
|
|
|
if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
|
|
|
|
{
|
|
|
|
Reference< beans::XPropertySet > xPropSet( getFirstCharacterPropertySet(), uno::UNO_QUERY );
|
|
|
|
if( xPropSet.is() )
|
|
|
|
xPropSet->removePropertyChangeListener( rPropertyName, xListener );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
WrappedPropertySet::removePropertyChangeListener( rPropertyName, xListener );
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
//ReferenceSizePropertyProvider
|
2008-10-01 07:35:04 +00:00
|
|
|
void TitleWrapper::updateReferenceSize()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-08-17 11:12:17 +00:00
|
|
|
Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
|
2007-05-22 16:19:25 +00:00
|
|
|
if( xProp.is() )
|
2008-10-01 07:35:04 +00:00
|
|
|
{
|
2012-04-08 10:48:08 -04:30
|
|
|
if( xProp->getPropertyValue( "ReferencePageSize" ).hasValue() )
|
|
|
|
xProp->setPropertyValue( "ReferencePageSize", uno::makeAny(
|
2007-05-22 16:19:25 +00:00
|
|
|
m_spChart2ModelContact->GetPageSize() ));
|
2008-10-01 07:35:04 +00:00
|
|
|
}
|
2007-05-22 16:19:25 +00:00
|
|
|
}
|
|
|
|
Any TitleWrapper::getReferenceSize()
|
|
|
|
{
|
|
|
|
Any aRet;
|
2007-08-17 11:12:17 +00:00
|
|
|
Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
|
2007-05-22 16:19:25 +00:00
|
|
|
if( xProp.is() )
|
2012-04-08 10:48:08 -04:30
|
|
|
aRet = xProp->getPropertyValue( "ReferencePageSize" );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
awt::Size TitleWrapper::getCurrentSizeForReference()
|
|
|
|
{
|
|
|
|
return m_spChart2ModelContact->GetPageSize();
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
|
Revert "fdo#46808, Convert chart2::Title service to new style"
This reverts commit d256dbede60533369d1aac64cca34721183f6a8a:
For one, the new css.chart2.XTitle2 looked unfinished, in that it transfered the
direct properties of the old-style css.chart2.Title service into attributes, but
left out all the properties inherited by the old-style service from
css.style.ParagraphProperties, css.drawing.FillProperties,
css.drawing.LineProperties (and that missing FIXME css.layout.LayoutElement,
whatever that is supposed to be). This needs more thought, to either make
available all propertiers as attributes, or none.
For another, this broke JunitTest_chart2_unoapi (sch.ChXChartDocument,
sch.ChartTitle), for hard-to-debug reasons.
Conflicts:
chart2/source/model/main/Title.cxx
chart2/source/model/main/Title.hxx
offapi/com/sun/star/chart2/XTitle2.idl
sc/source/filter/inc/xlchart.hxx
Change-Id: I4747208a13984904d0e409ea49a73b0f667c86c7
2013-05-23 10:11:49 +02:00
|
|
|
Reference< chart2::XTitle > TitleWrapper::getTitleObject()
|
2007-05-22 16:19:25 +00:00
|
|
|
{
|
|
|
|
return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
// WrappedPropertySet
|
|
|
|
|
|
|
|
Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-08-17 11:12:17 +00:00
|
|
|
return Reference< beans::XPropertySet >( this->getTitleObject(), uno::UNO_QUERY );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
const Sequence< beans::Property >& TitleWrapper::getPropertySequence()
|
|
|
|
{
|
2010-10-05 11:10:54 +02:00
|
|
|
return *StaticTitleWrapperPropertyArray::get();
|
2007-05-22 16:19:25 +00:00
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
|
2014-04-30 02:33:02 +02:00
|
|
|
aWrappedProperties.push_back( new WrappedTextRotationProperty( true ) );
|
2007-05-22 16:19:25 +00:00
|
|
|
aWrappedProperties.push_back( new WrappedStackedTextProperty() );
|
|
|
|
WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
|
2008-10-01 07:35:04 +00:00
|
|
|
WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
|
|
|
|
WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
return aWrappedProperties;
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:19:25 +00:00
|
|
|
Sequence< OUString > TitleWrapper::getSupportedServiceNames_Static()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:19:25 +00:00
|
|
|
Sequence< OUString > aServices( 4 );
|
2012-04-08 10:48:08 -04:30
|
|
|
aServices[ 0 ] = "com.sun.star.chart.ChartTitle";
|
|
|
|
aServices[ 1 ] = "com.sun.star.drawing.Shape";
|
2012-11-29 20:48:11 +01:00
|
|
|
aServices[ 2 ] = "com.sun.star.xml.UserDefinedAttributesSupplier";
|
2012-04-08 10:48:08 -04:30
|
|
|
aServices[ 3 ] = "com.sun.star.style.CharacterProperties";
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
|
2014-12-09 08:30:11 +02:00
|
|
|
OUString SAL_CALL TitleWrapper::getImplementationName()
|
|
|
|
throw( css::uno::RuntimeException, std::exception )
|
|
|
|
{
|
|
|
|
return getImplementationName_Static();
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString TitleWrapper::getImplementationName_Static()
|
|
|
|
{
|
|
|
|
return OUString(lcl_aServiceName);
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL TitleWrapper::supportsService( const OUString& rServiceName )
|
|
|
|
throw( css::uno::RuntimeException, std::exception )
|
|
|
|
{
|
|
|
|
return cppu::supportsService(this, rServiceName);
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence< OUString > SAL_CALL TitleWrapper::getSupportedServiceNames()
|
|
|
|
throw( css::uno::RuntimeException, std::exception )
|
|
|
|
{
|
|
|
|
return getSupportedServiceNames_Static();
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
} // namespace wrapper
|
|
|
|
} // namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|