diff options
Diffstat (limited to 'chart2/source/controller')
204 files changed, 4339 insertions, 3288 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx index 38108fced14b..67fa0d2ece5d 100644 --- a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx +++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx @@ -53,7 +53,7 @@ AccessibleViewForwarder::~AccessibleViewForwarder() // ________ IAccessibleViewforwarder ________ -BOOL AccessibleViewForwarder::IsValid() const +sal_Bool AccessibleViewForwarder::IsValid() const { return sal_True; } diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx index 5437541851d1..98c58a00a444 100644 --- a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx +++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx @@ -45,7 +45,7 @@ public: virtual ~AccessibleViewForwarder(); // ________ IAccessibleViewforwarder ________ - virtual BOOL IsValid() const; + virtual sal_Bool IsValid() const; virtual Rectangle GetVisibleArea() const; virtual Point LogicToPixel( const Point& rPoint ) const; virtual Size LogicToPixel( const Size& rSize ) const; diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx index 66ca1e60fe43..95b206c09774 100644..100755 --- a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx @@ -58,29 +58,34 @@ namespace static const ::rtl::OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Area" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticAreaWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; + +struct StaticAreaWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAreaWrapperPropertyArray_Initializer > +{ +}; + - return aPropSeq; -} } // anonymous namespace // -------------------------------------------------------------------------------- @@ -172,7 +177,7 @@ Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet() const Sequence< beans::Property >& AreaWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticAreaWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > AreaWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx index 59f0f6f372dd..f7d13280d263 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx @@ -30,10 +30,15 @@ #include "precompiled_chart2.hxx" #include "AxisWrapper.hxx" #include "AxisHelper.hxx" +#include "TitleHelper.hxx" #include "Chart2ModelContact.hxx" #include "ContainerHelper.hxx" #include "macros.hxx" #include "WrappedDirectStateProperty.hxx" +#include "GridWrapper.hxx" +#include "TitleWrapper.hxx" +#include "DisposeHelper.hxx" + #include <comphelper/InlineContainer.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp> @@ -83,6 +88,9 @@ enum PROP_AXIS_AUTO_MIN, PROP_AXIS_AUTO_STEPMAIN, PROP_AXIS_AUTO_STEPHELP, + PROP_AXIS_TYPE, + PROP_AXIS_TIME_INCREMENT, + PROP_AXIS_EXPLICIT_TIME_INCREMENT, PROP_AXIS_LOGARITHMIC, PROP_AXIS_REVERSEDIRECTION, PROP_AXIS_VISIBLE, @@ -175,6 +183,27 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( + Property( C2U( "AxisType" ), + PROP_AXIS_TYPE, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), //type com::sun::star::chart::ChartAxisType + //#i111967# no PropertyChangeEvent is fired on change so far + beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "TimeIncrement" ), + PROP_AXIS_TIME_INCREMENT, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)), + //#i111967# no PropertyChangeEvent is fired on change so far + beans::PropertyAttribute::MAYBEVOID )); + + rOutProperties.push_back( + Property( C2U( "ExplicitTimeIncrement" ), + PROP_AXIS_EXPLICIT_TIME_INCREMENT, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::TimeIncrement * >(0)), + beans::PropertyAttribute::READONLY | + beans::PropertyAttribute::MAYBEVOID )); + + rOutProperties.push_back( Property( C2U( "Logarithmic" ), PROP_AXIS_LOGARITHMIC, ::getBooleanCppuType(), @@ -324,14 +353,17 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::MAYBEDEFAULT )); } -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticAxisWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); @@ -339,16 +371,16 @@ const Sequence< Property > & lcl_GetPropertySequence() ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticAxisWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAxisWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -371,6 +403,83 @@ AxisWrapper::~AxisWrapper() { } +// ____ chart::XAxis ____ +Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getAxisTitle() throw (uno::RuntimeException) +{ + if( !m_xAxisTitle.is() ) + { + TitleHelper::eTitleType eTitleType( TitleHelper::X_AXIS_TITLE ); + switch( m_eType ) + { + case X_AXIS: + eTitleType = TitleHelper::X_AXIS_TITLE; + break; + case Y_AXIS: + eTitleType = TitleHelper::Y_AXIS_TITLE; + break; + case Z_AXIS: + eTitleType = TitleHelper::Z_AXIS_TITLE; + break; + case SECOND_X_AXIS: + eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE; + break; + case SECOND_Y_AXIS: + eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE; + break; + default: + return 0; + } + m_xAxisTitle = new TitleWrapper( eTitleType, m_spChart2ModelContact ); + } + return m_xAxisTitle; +} +Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMajorGrid() throw (uno::RuntimeException) +{ + if( !m_xMajorGrid.is() ) + { + GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID ); + switch( m_eType ) + { + case X_AXIS: + eGridType = GridWrapper::X_MAJOR_GRID; + break; + case Y_AXIS: + eGridType = GridWrapper::Y_MAJOR_GRID; + break; + case Z_AXIS: + eGridType = GridWrapper::Z_MAJOR_GRID; + break; + default: + return 0; + } + m_xMajorGrid = new GridWrapper( eGridType, m_spChart2ModelContact ); + } + return m_xMajorGrid; +} +Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getMinorGrid() throw (uno::RuntimeException) +{ + if( !m_xMinorGrid.is() ) + { + GridWrapper::tGridType eGridType( GridWrapper::X_MAJOR_GRID ); + switch( m_eType ) + { + case X_AXIS: + eGridType = GridWrapper::X_MINOR_GRID; + break; + case Y_AXIS: + eGridType = GridWrapper::Y_MINOR_GRID; + break; + case Z_AXIS: + eGridType = GridWrapper::Z_MINOR_GRID; + break; + default: + return 0; + } + m_xMinorGrid = new GridWrapper( eGridType, m_spChart2ModelContact ); + } + return m_xMinorGrid; +} + // ____ XShape ____ awt::Point SAL_CALL AxisWrapper::getPosition() throw (uno::RuntimeException) @@ -451,6 +560,10 @@ void SAL_CALL AxisWrapper::dispose() Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); + DisposeHelper::DisposeAndClear( m_xAxisTitle ); + DisposeHelper::DisposeAndClear( m_xMajorGrid ); + DisposeHelper::DisposeAndClear( m_xMinorGrid ); + clearWrappedPropertySet(); } @@ -530,7 +643,7 @@ Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet() const Sequence< beans::Property >& AxisWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticAxisWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx index 8ff813f42c4b..d55db6e0f34c 100644..100755 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx @@ -31,9 +31,10 @@ #include "WrappedPropertySet.hxx" #include "ReferenceSizePropertyProvider.hxx" #include "ServiceMacros.hxx" -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> #include <comphelper/uno3.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <com/sun/star/chart/XAxis.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/drawing/XShape.hpp> @@ -46,14 +47,13 @@ namespace chart { - namespace wrapper { - class Chart2ModelContact; -class AxisWrapper : public ::cppu::ImplInheritanceHelper4< +class AxisWrapper : public ::cppu::ImplInheritanceHelper5< WrappedPropertySet + , com::sun::star::chart::XAxis , com::sun::star::drawing::XShape , com::sun::star::lang::XComponent , com::sun::star::lang::XServiceInfo @@ -94,6 +94,11 @@ public: ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + // ____ chart::XAxis ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getAxisTitle( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMajorGrid( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getMinorGrid( ) throw (::com::sun::star::uno::RuntimeException); + // ____ XShape ____ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw (::com::sun::star::uno::RuntimeException); @@ -132,6 +137,10 @@ private: //member tAxisType m_eType; ::com::sun::star::uno::Any m_aTemporaryHelpStepValue; + + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAxisTitle; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMajorGrid; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xMinorGrid; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx index 6b60c3010990..26d1d5af76a7 100644..100755 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx @@ -28,8 +28,7 @@ #ifndef CHART_CHART2MODELCONTACT_HXX #define CHART_CHART2MODELCONTACT_HXX -#include <com/sun/star/chart2/ExplicitScaleData.hpp> -#include <com/sun/star/chart2/ExplicitIncrementData.hpp> +#include <chartview/ExplicitScaleValues.hxx> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDataSeries.hpp> @@ -80,8 +79,8 @@ public: sal_Bool getExplicitValuesForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > & xAxis, - ::com::sun::star::chart2::ExplicitScaleData & rOutExplicitScale, - ::com::sun::star::chart2::ExplicitIncrementData & rOutExplicitIncrement ); + ExplicitScaleData & rOutExplicitScale, + ExplicitIncrementData & rOutExplicitIncrement ); sal_Int32 getExplicitNumberFormatKeyForAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index bf1b879334b2..aec879688e1e 100644..100755 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -65,9 +65,11 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::rtl::OUString; using ::osl::MutexGuard; +using ::com::sun::star::chart2::XAnyDescriptionAccess; using ::com::sun::star::chart::XComplexDescriptionAccess; using ::com::sun::star::chart::XChartData; using ::com::sun::star::chart::XChartDataArray; +using ::com::sun::star::chart::XDateCategories; namespace { @@ -133,7 +135,7 @@ struct lcl_Operator virtual ~lcl_Operator() { } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) = 0; + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) = 0; virtual bool setsCategories( bool /*bDataInColumns*/ ) { @@ -156,13 +158,20 @@ struct lcl_AllOperator : public lcl_Operator return true; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( !xDataAccess.is() ) return; + Reference< XAnyDescriptionAccess > xNewAny( m_xDataToApply, uno::UNO_QUERY ); Reference< XComplexDescriptionAccess > xNewComplex( m_xDataToApply, uno::UNO_QUERY ); - if( xNewComplex.is() ) + if( xNewAny.is() ) + { + xDataAccess->setData( xNewAny->getData() ); + xDataAccess->setComplexRowDescriptions( xNewAny->getComplexRowDescriptions() ); + xDataAccess->setComplexColumnDescriptions( xNewAny->getComplexColumnDescriptions() ); + } + else if( xNewComplex.is() ) { xDataAccess->setData( xNewComplex->getData() ); xDataAccess->setComplexRowDescriptions( xNewComplex->getComplexRowDescriptions() ); @@ -193,7 +202,7 @@ struct lcl_DataOperator : public lcl_Operator { } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) xDataAccess->setData( lcl_getNANInsteadDBL_MIN( m_rData ) ); @@ -206,96 +215,208 @@ struct lcl_DataOperator : public lcl_Operator struct lcl_RowDescriptionsOperator : public lcl_Operator { - lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions ) + lcl_RowDescriptionsOperator( const Sequence< OUString >& rRowDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rRowDescriptions( rRowDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { + m_bDataInColumns = bDataInColumns; return bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setRowDescriptions( m_rRowDescriptions ); + if( m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< OUString >& m_rRowDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; }; //-------------------------------------------------------------------------- struct lcl_ComplexRowDescriptionsOperator : public lcl_Operator { - lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions ) + lcl_ComplexRowDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexRowDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rComplexRowDescriptions( rComplexRowDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { - return !bDataInColumns; + m_bDataInColumns = bDataInColumns; + return bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setComplexRowDescriptions( m_rComplexRowDescriptions ); + if( m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< Sequence< OUString > >& m_rComplexRowDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; +}; +//-------------------------------------------------------------------------- + +struct lcl_AnyRowDescriptionsOperator : public lcl_Operator +{ + lcl_AnyRowDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyRowDescriptions ) + : lcl_Operator() + , m_rAnyRowDescriptions( rAnyRowDescriptions ) + { + } + + virtual bool setsCategories( bool bDataInColumns ) + { + return bDataInColumns; + } + + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) + { + if( xDataAccess.is() ) + xDataAccess->setAnyRowDescriptions( m_rAnyRowDescriptions ); + } + + const Sequence< Sequence< uno::Any > >& m_rAnyRowDescriptions; }; //-------------------------------------------------------------------------- struct lcl_ColumnDescriptionsOperator : public lcl_Operator { - lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions ) + lcl_ColumnDescriptionsOperator( const Sequence< OUString >& rColumnDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rColumnDescriptions( rColumnDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { + m_bDataInColumns = bDataInColumns; return !bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setColumnDescriptions( m_rColumnDescriptions ); + if( !m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< OUString >& m_rColumnDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; }; //-------------------------------------------------------------------------- struct lcl_ComplexColumnDescriptionsOperator : public lcl_Operator { - lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions ) + lcl_ComplexColumnDescriptionsOperator( const Sequence< Sequence< OUString > >& rComplexColumnDescriptions + , const Reference< chart2::XChartDocument >& xChartDoc ) : lcl_Operator() , m_rComplexColumnDescriptions( rComplexColumnDescriptions ) + , m_xChartDoc(xChartDoc) + , m_bDataInColumns(true) { } virtual bool setsCategories( bool bDataInColumns ) { + m_bDataInColumns = bDataInColumns; return !bDataInColumns; } - virtual void apply( const Reference< XComplexDescriptionAccess >& xDataAccess ) + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) { if( xDataAccess.is() ) + { xDataAccess->setComplexColumnDescriptions( m_rComplexColumnDescriptions ); + if( !m_bDataInColumns ) + DiagramHelper::switchToTextCategories( m_xChartDoc ); + } } const Sequence< Sequence< OUString > >& m_rComplexColumnDescriptions; + Reference< chart2::XChartDocument > m_xChartDoc; + bool m_bDataInColumns; +}; + +//-------------------------------------------------------------------------- + +struct lcl_AnyColumnDescriptionsOperator : public lcl_Operator +{ + lcl_AnyColumnDescriptionsOperator( const Sequence< Sequence< uno::Any > >& rAnyColumnDescriptions ) + : lcl_Operator() + , m_rAnyColumnDescriptions( rAnyColumnDescriptions ) + { + } + + virtual bool setsCategories( bool bDataInColumns ) + { + return bDataInColumns; + } + + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) + { + if( xDataAccess.is() ) + xDataAccess->setAnyColumnDescriptions( m_rAnyColumnDescriptions ); + } + + const Sequence< Sequence< uno::Any > >& m_rAnyColumnDescriptions; +}; + +//-------------------------------------------------------------------------- + +struct lcl_DateCategoriesOperator : public lcl_Operator +{ + lcl_DateCategoriesOperator( const Sequence< double >& rDates ) + : lcl_Operator() + , m_rDates( rDates ) + { + } + + virtual bool setsCategories( bool /*bDataInColumns*/ ) + { + return true; + } + + virtual void apply( const Reference< XAnyDescriptionAccess >& xDataAccess ) + { + Reference< XDateCategories > xDateCategories( xDataAccess, uno::UNO_QUERY ); + if( xDateCategories.is() ) + xDateCategories->setDateCategories( m_rDates ); + } + + const Sequence< double >& m_rDates; }; //-------------------------------------------------------------------------- @@ -354,6 +475,7 @@ Sequence< OUString > SAL_CALL ChartDataWrapper::getColumnDescriptions() return m_xDataAccess->getColumnDescriptions(); return Sequence< OUString > (); } + // ____ XComplexDescriptionAccess (read) ____ Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexRowDescriptions() throw (uno::RuntimeException) { @@ -370,6 +492,32 @@ Sequence< Sequence< OUString > > SAL_CALL ChartDataWrapper::getComplexColumnDesc return Sequence< Sequence< OUString > >(); } +// ____ XAnyDescriptionAccess (read) ____ +Sequence< Sequence< uno::Any > > SAL_CALL ChartDataWrapper::getAnyRowDescriptions() throw (uno::RuntimeException) +{ + initDataAccess(); + if( m_xDataAccess.is() ) + return m_xDataAccess->getAnyRowDescriptions(); + return Sequence< Sequence< uno::Any > >(); +} +Sequence< Sequence< uno::Any > > SAL_CALL ChartDataWrapper::getAnyColumnDescriptions() throw (uno::RuntimeException) +{ + initDataAccess(); + if( m_xDataAccess.is() ) + return m_xDataAccess->getAnyColumnDescriptions(); + return Sequence< Sequence< uno::Any > >(); +} + +// ____ XDateCategories (read) ____ +Sequence< double > SAL_CALL ChartDataWrapper::getDateCategories() throw (uno::RuntimeException) +{ + initDataAccess(); + Reference< XDateCategories > xDateCategories( m_xDataAccess, uno::UNO_QUERY ); + if( xDateCategories.is() ) + return xDateCategories->getDateCategories(); + return Sequence< double >(); +} + // ____ XChartDataArray (write)____ void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& rData ) throw (uno::RuntimeException) @@ -380,28 +528,50 @@ void SAL_CALL ChartDataWrapper::setData( const Sequence< Sequence< double > >& r void SAL_CALL ChartDataWrapper::setRowDescriptions( const Sequence< OUString >& rRowDescriptions ) throw (uno::RuntimeException) { - lcl_RowDescriptionsOperator aOperator( rRowDescriptions ); + lcl_RowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() ); applyData( aOperator ); } void SAL_CALL ChartDataWrapper::setColumnDescriptions( const Sequence< OUString >& rColumnDescriptions ) throw (uno::RuntimeException) { - lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions ); + lcl_ColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() ); applyData( aOperator ); } // ____ XComplexDescriptionAccess (write) ____ void SAL_CALL ChartDataWrapper::setComplexRowDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rRowDescriptions ) throw (uno::RuntimeException) { - lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions ); + lcl_ComplexRowDescriptionsOperator aOperator( rRowDescriptions, m_spChart2ModelContact->getChart2Document() ); applyData( aOperator ); } void SAL_CALL ChartDataWrapper::setComplexColumnDescriptions( const Sequence< Sequence< ::rtl::OUString > >& rColumnDescriptions ) throw (uno::RuntimeException) { - lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions ); + lcl_ComplexColumnDescriptionsOperator aOperator( rColumnDescriptions, m_spChart2ModelContact->getChart2Document() ); + applyData( aOperator ); +} + +// ____ XAnyDescriptionAccess (write) ____ +void SAL_CALL ChartDataWrapper::setAnyRowDescriptions( const Sequence< Sequence< uno::Any > >& rRowDescriptions ) throw (uno::RuntimeException) +{ + lcl_AnyRowDescriptionsOperator aOperator( rRowDescriptions ); + applyData( aOperator ); +} +void SAL_CALL ChartDataWrapper::setAnyColumnDescriptions( const Sequence< Sequence< uno::Any > >& rColumnDescriptions ) throw (uno::RuntimeException) +{ + lcl_AnyColumnDescriptionsOperator aOperator( rColumnDescriptions ); applyData( aOperator ); } +// ____ XDateCategories (write) ____ +void SAL_CALL ChartDataWrapper::setDateCategories( const Sequence< double >& rDates ) throw (uno::RuntimeException) +{ + Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() ); + ControllerLockGuard aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY )); + lcl_DateCategoriesOperator aOperator( rDates ); + applyData( aOperator ); + DiagramHelper::switchToDateCategories( xChartDoc ); +} + //-------------------------------------------------------------------------------------- // ____ XChartData (base of XChartDataArray) ____ @@ -504,11 +674,11 @@ void ChartDataWrapper::initDataAccess() if( !xChartDoc.is() ) return; if( xChartDoc->hasInternalDataProvider() ) - m_xDataAccess = Reference< XComplexDescriptionAccess >( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW ); + m_xDataAccess = Reference< XAnyDescriptionAccess >( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW ); else { //create a separate "internal data provider" that is not connected to the model - m_xDataAccess = Reference< XComplexDescriptionAccess >( ChartModelHelper::createInternalDataProvider( + m_xDataAccess = Reference< XAnyDescriptionAccess >( ChartModelHelper::createInternalDataProvider( xChartDoc, false /*bConnectToModel*/ ), uno::UNO_QUERY_THROW ); } } @@ -565,30 +735,9 @@ void ChartDataWrapper::applyData( lcl_Operator& rDataOperator ) return; uno::Reference< chart2::data::XDataSource > xSource( xDataProvider->createDataSource( aArguments ) ); - // determine a template - uno::Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY ); - uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram()); - DiagramHelper::tTemplateWithServiceName aTemplateAndService = - DiagramHelper::getTemplateForDiagram( xDia, xFact ); - ::rtl::OUString aServiceName( aTemplateAndService.second ); - uno::Reference< chart2::XChartTypeTemplate > xTemplate = aTemplateAndService.first; - - // (fall-back) - if( ! xTemplate.is()) - { - if( aServiceName.getLength() == 0 ) - aServiceName = C2U("com.sun.star.chart2.template.Column"); - xTemplate.set( xFact->createInstance( aServiceName ), uno::UNO_QUERY ); - } - OSL_ASSERT( xTemplate.is()); - - if( xTemplate.is() && xSource.is()) - { - // argument detection works with internal knowledge of the - // ArrayDataProvider - OSL_ASSERT( xDia.is()); - xTemplate->changeDiagramData( xDia, xSource, aArguments ); - } + uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram() ); + if( xDia.is() ) + xDia->setDiagramData( xSource, aArguments ); //correct stacking mode if( bStacked || bPercent || bDeep ) diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx index de3ed722de60..ac28d23cfb41 100644..100755 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx @@ -30,9 +30,10 @@ #include "ServiceMacros.hxx" #include "MutexContainer.hxx" -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> #include <cppuhelper/interfacecontainer.hxx> -#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> +#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> +#include <com/sun/star/chart/XDateCategories.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -49,8 +50,9 @@ class Chart2ModelContact; struct lcl_Operator; class ChartDataWrapper : public MutexContainer, public - ::cppu::WeakImplHelper4< - com::sun::star::chart::XComplexDescriptionAccess, + ::cppu::WeakImplHelper5< + com::sun::star::chart2::XAnyDescriptionAccess, + com::sun::star::chart::XDateCategories, com::sun::star::lang::XServiceInfo, com::sun::star::lang::XEventListener, com::sun::star::lang::XComponent > @@ -65,7 +67,25 @@ public: APPHELPER_XSERVICEINFO_DECL() protected: - // ____ XComplexDescriptionAccess ____ + // ____ XDateCategories ____ + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getDateCategories() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDateCategories( const ::com::sun::star::uno::Sequence< double >& rDates ) throw (::com::sun::star::uno::RuntimeException); + + // ____ XAnyDescriptionAccess ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL + getAnyRowDescriptions() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAnyRowDescriptions( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aRowDescriptions ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL + getAnyColumnDescriptions() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAnyColumnDescriptions( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aColumnDescriptions ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setComplexRowDescriptions( @@ -137,7 +157,7 @@ private: //methods private: //member ::com::sun::star::uno::Reference< - ::com::sun::star::chart::XComplexDescriptionAccess > m_xDataAccess; + ::com::sun::star::chart2::XAnyDescriptionAccess > m_xDataAccess; ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index e61821a117f5..baca5d41cf27 100644..100755 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -57,11 +57,9 @@ #include "WrappedAddInProperty.hxx" #include "WrappedIgnoreProperty.hxx" #include "ChartRenderer.hxx" -#include "UndoManager.hxx" #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/chart/ChartDataRowSource.hpp> -#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> #include <comphelper/InlineContainer.hxx> // header for function SvxShapeCollection_NewInstance #include <svx/unoshcol.hxx> @@ -83,8 +81,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart; -using ::com::sun::star::chart::XComplexDescriptionAccess; using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; @@ -251,27 +249,30 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::MAYBEDEFAULT ) ); } -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticChartDocumentWrapperPropertyArray_Initializer { - static uno::Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + uno::Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticChartDocumentWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticChartDocumentWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -1401,12 +1402,6 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( xResult.set( m_xChartView ); bServiceFound = true; } - else if ( aServiceSpecifier.equals( CHART_UNDOMANAGER_SERVICE_NAME ) ) - { - Reference< chart2::XUndoManager > xUndoManager( new UndoManager() ); - xResult.set( xUndoManager ); - bServiceFound = true; - } else { // try to create a shape @@ -1559,7 +1554,7 @@ Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet() } const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticChartDocumentWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index 39b2a0ef9b77..1dd3a94ff833 100644..100755 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -174,43 +174,55 @@ void lcl_AddPropertiesToVector_SeriesOnly( | beans::PropertyAttribute::MAYBEDEFAULT )); } -const uno::Sequence< Property > & lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType ) +uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType ) { - static uno::Sequence< Property > aSeriesPropSeq; - static uno::Sequence< Property > aPointPropSeq; + ::std::vector< ::com::sun::star::beans::Property > aProperties; - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - uno::Sequence< Property >& rPropSeq = - (_eType == DataSeriesPointWrapper::DATA_SERIES) ? aSeriesPropSeq : aPointPropSeq; - if( 0 == rPropSeq.getLength() ) + lcl_AddPropertiesToVector_PointProperties( aProperties ); + if( _eType == DataSeriesPointWrapper::DATA_SERIES ) { - // get properties - ::std::vector< ::com::sun::star::beans::Property > aProperties; + lcl_AddPropertiesToVector_SeriesOnly( aProperties ); + WrappedStatisticProperties::addProperties( aProperties ); + } + WrappedSymbolProperties::addProperties( aProperties ); //for series and points + WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points - lcl_AddPropertiesToVector_PointProperties( aProperties ); - if( _eType == DataSeriesPointWrapper::DATA_SERIES ) - { - lcl_AddPropertiesToVector_SeriesOnly( aProperties ); - WrappedStatisticProperties::addProperties( aProperties ); - } - WrappedSymbolProperties::addProperties( aProperties ); //for series and points - WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points + ::chart::FillProperties::AddPropertiesToVector( aProperties ); + ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); + ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); + ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); - ::chart::FillProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); - ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); + ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // and sort them for access via bsearch - ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); +} - // transfer result to static Sequence - rPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); +struct StaticSeriesWrapperPropertyArray_Initializer +{ + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) ); + return &aPropSeq; } +}; - return rPropSeq; -} +struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer > +{ +}; + +struct StaticPointWrapperPropertyArray_Initializer +{ + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) ); + return &aPropSeq; + } +}; + +struct StaticPointWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticPointWrapperPropertyArray_Initializer > +{ +}; //---------------------------------------------------------------------------------------------------------------------- @@ -702,7 +714,10 @@ Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet() const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence() { - return lcl_GetPropertySequence( m_eType ); + if( m_eType == DATA_SERIES ) + return *StaticSeriesWrapperPropertyArray::get(); + else + return *StaticPointWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index d22f5dd6dfeb..070dca26372a 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -31,14 +31,11 @@ #include "DiagramWrapper.hxx" #include "macros.hxx" #include "servicenames_charttypes.hxx" -#include "TitleWrapper.hxx" #include "DataSeriesPointWrapper.hxx" #include "AxisWrapper.hxx" #include "AxisHelper.hxx" #include "Chart2ModelContact.hxx" #include "PositionAndSizeHelper.hxx" -#include "TitleHelper.hxx" -#include "GridWrapper.hxx" #include "WallFloorWrapper.hxx" #include "MinMaxLineWrapper.hxx" #include "UpDownBarWrapper.hxx" @@ -89,6 +86,7 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; +using ::com::sun::star::chart::XAxis; using ::osl::MutexGuard; using ::rtl::OUString; @@ -435,14 +433,17 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticDiagramWrapperPropertyArray_Initializer { - static uno::Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + uno::Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); @@ -456,16 +457,16 @@ const uno::Sequence< Property > & lcl_GetPropertySequence() WrappedStockProperties::addProperties( aProperties ); WrappedAutomaticPositionProperties::addProperties( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer > +{ +}; bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram ) { @@ -883,193 +884,209 @@ void SAL_CALL DiagramWrapper::setDiagramPositionIncludingAxesAndAxisTitles( cons return m_spChart2ModelContact->GetDiagramRectangleIncludingTitle(); } -// ____ XAxisZSupplier ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle() +// ____ XAxisSupplier ____ +Reference< XAxis > SAL_CALL DiagramWrapper::getAxis( sal_Int32 nDimensionIndex ) throw (uno::RuntimeException) { - if( !m_xZAxisTitle.is() ) + Reference< XAxis > xAxis; + if(!nDimensionIndex) + { + if( !m_xXAxis.is() ) + m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact ); + xAxis = m_xXAxis; + } + else if(1==nDimensionIndex) { - m_xZAxisTitle = new TitleWrapper( TitleHelper::Z_AXIS_TITLE, m_spChart2ModelContact ); + if( !m_xYAxis.is() ) + m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact ); + xAxis = m_xYAxis; } - return m_xZAxisTitle; + else if(2==nDimensionIndex) + { + if( !m_xZAxis.is() ) + m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact ); + xAxis = m_xZAxis; + } + return xAxis; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid() +Reference< XAxis > SAL_CALL DiagramWrapper::getSecondaryAxis( sal_Int32 nDimensionIndex ) throw (uno::RuntimeException) { - if( ! m_xZMainGrid.is()) + Reference< XAxis > xAxis; + if(!nDimensionIndex) + { + if( !m_xSecondXAxis.is() ) + m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact ); + xAxis = m_xSecondXAxis; + } + else if(1==nDimensionIndex) { - m_xZMainGrid = new GridWrapper( GridWrapper::Z_MAIN_GRID, m_spChart2ModelContact ); + if( !m_xSecondYAxis.is() ) + m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact ); + xAxis = m_xSecondYAxis; } - return m_xZMainGrid; + return xAxis; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid() +// ____ XAxisZSupplier ____ +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle() throw (uno::RuntimeException) { - if( !m_xZHelpGrid.is() ) - { - m_xZHelpGrid = new GridWrapper( GridWrapper::Z_SUB_GRID, m_spChart2ModelContact ); - } - return m_xZHelpGrid; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getAxis(2) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid() + throw (uno::RuntimeException) +{ + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(2) ); + if( xAxis.is() ) + xRet = xAxis->getMajorGrid(); + return xRet; +} + +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid() + throw (uno::RuntimeException) +{ + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(2) ); + if( xAxis.is() ) + xRet = xAxis->getMinorGrid(); + return xRet; +} + +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis() throw (uno::RuntimeException) { if( ! m_xZAxis.is()) - { m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact ); - } - return m_xZAxis; + return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY ); } // ____ XTwoAxisXSupplier ____ -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis() throw (uno::RuntimeException) { if( ! m_xSecondXAxis.is()) - { m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact ); - } - return m_xSecondXAxis; + return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY ); } // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle() throw (uno::RuntimeException) { - - if( !m_xXAxisTitle.is() ) - { - m_xXAxisTitle = new TitleWrapper( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xXAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getAxis(0) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis() throw (uno::RuntimeException) { if( ! m_xXAxis.is()) - { m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact ); - } - - return m_xXAxis; + return Reference< beans::XPropertySet >( m_xXAxis, uno::UNO_QUERY ); } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid() throw (uno::RuntimeException) { - if( ! m_xXMainGrid.is()) - { - m_xXMainGrid = new GridWrapper( GridWrapper::X_MAIN_GRID, m_spChart2ModelContact ); - } - - return m_xXMainGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(0) ); + if( xAxis.is() ) + xRet = xAxis->getMajorGrid(); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid() throw (uno::RuntimeException) { - if( ! m_xXHelpGrid.is()) - { - m_xXHelpGrid = new GridWrapper( GridWrapper::X_SUB_GRID, m_spChart2ModelContact ); - } - return m_xXHelpGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(0) ); + if( xAxis.is() ) + xRet = xAxis->getMinorGrid(); + return xRet; } // ____ XTwoAxisYSupplier ____ -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis() throw (uno::RuntimeException) { if( ! m_xSecondYAxis.is()) - { m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact ); - } - return m_xSecondYAxis; + return Reference< beans::XPropertySet >( m_xSecondYAxis, uno::UNO_QUERY ); } // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle() throw (uno::RuntimeException) { - if( !m_xYAxisTitle.is() ) - { - m_xYAxisTitle = new TitleWrapper( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xYAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getAxis(1) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis() throw (uno::RuntimeException) { if( ! m_xYAxis.is()) - { m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact ); - } - return m_xYAxis; + return Reference< beans::XPropertySet >( m_xYAxis, uno::UNO_QUERY ); } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid() throw (uno::RuntimeException) { - if( ! m_xYHelpGrid.is()) - { - m_xYHelpGrid = new GridWrapper( GridWrapper::Y_SUB_GRID, m_spChart2ModelContact ); - } - return m_xYHelpGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(1) ); + if( xAxis.is() ) + xRet = xAxis->getMajorGrid(); + return xRet; } -Reference< - beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid() +Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid() throw (uno::RuntimeException) { - if( ! m_xYMainGrid.is()) - { - m_xYMainGrid = new GridWrapper( GridWrapper::Y_MAIN_GRID, m_spChart2ModelContact ); - } - return m_xYMainGrid; + Reference< beans::XPropertySet > xRet; + Reference< XAxis > xAxis( getAxis(1) ); + if( xAxis.is() ) + xRet = xAxis->getMinorGrid(); + return xRet; } // ____ XSecondAxisTitleSupplier ____ -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle() throw (uno::RuntimeException) { - if( !m_xSecondXAxisTitle.is() ) - { - m_xSecondXAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_X_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xSecondXAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getSecondaryAxis(0) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } -Reference< - drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle() +Reference< drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle() throw (uno::RuntimeException) { - if( !m_xSecondYAxisTitle.is() ) - { - m_xSecondYAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_Y_AXIS_TITLE, m_spChart2ModelContact ); - } - return m_xSecondYAxisTitle; + Reference< drawing::XShape > xRet; + Reference< XAxis > xAxis( getSecondaryAxis(1) ); + if( xAxis.is() ) + xRet = Reference< drawing::XShape >( xAxis->getAxisTitle(), uno::UNO_QUERY ); + return xRet; } // ____ XStatisticDisplay ____ @@ -1161,22 +1178,11 @@ void SAL_CALL DiagramWrapper::dispose() MutexGuard aGuard( GetMutex()); - DisposeHelper::DisposeAndClear( m_xXAxisTitle ); - DisposeHelper::DisposeAndClear( m_xYAxisTitle ); - DisposeHelper::DisposeAndClear( m_xZAxisTitle ); - DisposeHelper::DisposeAndClear( m_xSecondXAxisTitle ); - DisposeHelper::DisposeAndClear( m_xSecondYAxisTitle ); DisposeHelper::DisposeAndClear( m_xXAxis ); DisposeHelper::DisposeAndClear( m_xYAxis ); DisposeHelper::DisposeAndClear( m_xZAxis ); DisposeHelper::DisposeAndClear( m_xSecondXAxis ); DisposeHelper::DisposeAndClear( m_xSecondYAxis ); - DisposeHelper::DisposeAndClear( m_xXMainGrid ); - DisposeHelper::DisposeAndClear( m_xYMainGrid ); - DisposeHelper::DisposeAndClear( m_xZMainGrid ); - DisposeHelper::DisposeAndClear( m_xXHelpGrid ); - DisposeHelper::DisposeAndClear( m_xYHelpGrid ); - DisposeHelper::DisposeAndClear( m_xZHelpGrid ); DisposeHelper::DisposeAndClear( m_xWall ); DisposeHelper::DisposeAndClear( m_xFloor ); DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper ); @@ -2055,7 +2061,7 @@ Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet() const Sequence< beans::Property >& DiagramWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticDiagramWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx index bee3961eeaac..c58fb6ab0fa2 100644..100755 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx @@ -31,7 +31,13 @@ #include "WrappedPropertySet.hxx" #include "ServiceMacros.hxx" #include "DiagramHelper.hxx" -#include <cppuhelper/implbase12.hxx> + +#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13) +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13 +#include "comphelper/implbase_var.hxx" +#endif + #include <comphelper/uno3.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -42,6 +48,7 @@ #include <com/sun/star/chart2/XChartTypeTemplate.hpp> #include <com/sun/star/chart2/XChartTypeManager.hpp> #include <com/sun/star/chart/XDiagram.hpp> +#include <com/sun/star/chart/XAxisSupplier.hpp> #include <com/sun/star/chart/XAxisZSupplier.hpp> #include <com/sun/star/chart/XTwoAxisXSupplier.hpp> #include <com/sun/star/chart/XTwoAxisYSupplier.hpp> @@ -57,15 +64,15 @@ namespace chart { - namespace wrapper { class Chart2ModelContact; -class DiagramWrapper : public ::cppu::ImplInheritanceHelper12< +class DiagramWrapper : public ::comphelper::ImplInheritanceHelper13< WrappedPropertySet , ::com::sun::star::chart::XDiagram + , ::com::sun::star::chart::XAxisSupplier , ::com::sun::star::chart::XAxisZSupplier , ::com::sun::star::chart::XTwoAxisXSupplier // : XAxisXSupplier , ::com::sun::star::chart::XTwoAxisYSupplier // : XAxisYSupplier @@ -123,6 +130,14 @@ public: virtual ::rtl::OUString SAL_CALL getShapeType() throw (::com::sun::star::uno::RuntimeException); + // ____ XAxisSupplier ____ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart::XAxis > SAL_CALL getAxis( sal_Int32 nDimensionIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart::XAxis > SAL_CALL getSecondaryAxis( sal_Int32 nDimensionIndex ) + throw (::com::sun::star::uno::RuntimeException); + // ____ XAxisZSupplier ____ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle() @@ -239,72 +254,27 @@ private: ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xXAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xYAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xZAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xSecondXAxisTitle; - ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShape > - m_xSecondYAxisTitle; - - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xXAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xYAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xZAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xSecondXAxis; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xSecondYAxis; - - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xXMainGrid; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xYMainGrid; + ::com::sun::star::chart::XAxis > m_xXAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xZMainGrid; + ::com::sun::star::chart::XAxis > m_xYAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xXHelpGrid; + ::com::sun::star::chart::XAxis > m_xZAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xYHelpGrid; + ::com::sun::star::chart::XAxis > m_xSecondXAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xZHelpGrid; + ::com::sun::star::chart::XAxis > m_xSecondYAxis; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xWall; + ::com::sun::star::beans::XPropertySet > m_xWall; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xFloor; + ::com::sun::star::beans::XPropertySet > m_xFloor; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xMinMaxLineWrapper; + ::com::sun::star::beans::XPropertySet > m_xMinMaxLineWrapper; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xUpBarWrapper; + ::com::sun::star::beans::XPropertySet > m_xUpBarWrapper; ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - m_xDownBarWrapper; + ::com::sun::star::beans::XPropertySet > m_xDownBarWrapper; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx index 94862f800e7f..be184b30150d 100644..100755 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx @@ -60,28 +60,30 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Grid" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticGridWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; - - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticGridWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticGridWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -110,17 +112,17 @@ void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDime switch( eType ) { - case X_MAIN_GRID: + case X_MAJOR_GRID: rnDimensionIndex = 0; rbSubGrid = false; break; - case Y_MAIN_GRID: + case Y_MAJOR_GRID: rnDimensionIndex = 1; rbSubGrid = false; break; - case Z_MAIN_GRID: + case Z_MAJOR_GRID: rnDimensionIndex = 2; rbSubGrid = false; break; - case X_SUB_GRID: + case X_MINOR_GRID: rnDimensionIndex = 0; rbSubGrid = true; break; - case Y_SUB_GRID: + case Y_MINOR_GRID: rnDimensionIndex = 1; rbSubGrid = true; break; - case Z_SUB_GRID: + case Z_MINOR_GRID: rnDimensionIndex = 2; rbSubGrid = true; break; } } @@ -177,7 +179,7 @@ Reference< beans::XPropertySet > GridWrapper::getInnerPropertySet() const Sequence< beans::Property >& GridWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticGridWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > GridWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx index bd075cba2666..5d4769574d7f 100644..100755 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx @@ -43,7 +43,6 @@ namespace chart { - namespace wrapper { @@ -58,12 +57,12 @@ class GridWrapper : public ::cppu::ImplInheritanceHelper2< public: enum tGridType { - X_MAIN_GRID, - Y_MAIN_GRID, - Z_MAIN_GRID, - X_SUB_GRID, - Y_SUB_GRID, - Z_SUB_GRID + X_MAJOR_GRID, + Y_MAJOR_GRID, + Z_MAJOR_GRID, + X_MINOR_GRID, + Y_MINOR_GRID, + Z_MINOR_GRID }; GridWrapper( tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ); diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx index 38b444c49dda..c2982c11451e 100644..100755 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/chart2/XTitled.hpp> #include <com/sun/star/chart/ChartLegendPosition.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/drawing/FillStyle.hpp> @@ -139,13 +139,13 @@ void WrappedLegendAlignmentProperty::setPropertyValue( const Any& rOuterValue, c chart2::LegendPosition eNewInnerPos(chart2::LegendPosition_LINE_END); if( aInnerValue >>= eNewInnerPos ) { - chart2::LegendExpansion eNewExpansion = + ::com::sun::star::chart::ChartLegendExpansion eNewExpansion = ( eNewInnerPos == chart2::LegendPosition_LINE_END || eNewInnerPos == chart2::LegendPosition_LINE_START ) - ? chart2::LegendExpansion_HIGH - : chart2::LegendExpansion_WIDE; + ? ::com::sun::star::chart::ChartLegendExpansion_HIGH + : ::com::sun::star::chart::ChartLegendExpansion_WIDE; - chart2::LegendExpansion eOldExpansion( chart2::LegendExpansion_HIGH ); + ::com::sun::star::chart::ChartLegendExpansion eOldExpansion( ::com::sun::star::chart::ChartLegendExpansion_HIGH ); bool bExpansionWasSet( xInnerPropertySet->getPropertyValue( C2U( "Expansion" ) ) >>= eOldExpansion ); @@ -229,7 +229,8 @@ static const ::rtl::OUString lcl_aServiceName( enum { - PROP_LEGEND_ALIGNMENT + PROP_LEGEND_ALIGNMENT, + PROP_LEGEND_EXPANSION }; void lcl_AddPropertiesToVector( @@ -241,16 +242,26 @@ void lcl_AddPropertiesToVector( ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendPosition * >(0)), //#i111967# no PropertyChangeEvent is fired on change so far beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( C2U( "Expansion" ), + PROP_LEGEND_EXPANSION, + ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendExpansion * >(0)), + //#i111967# no PropertyChangeEvent is fired on change so far + beans::PropertyAttribute::MAYBEDEFAULT )); } -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticLegendWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); @@ -260,16 +271,17 @@ const Sequence< Property > & lcl_GetPropertySequence() ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; + +struct StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticLegendWrapperPropertyArray_Initializer > +{ +}; - return aPropSeq; -} } // anonymous namespace // -------------------------------------------------------------------------------- @@ -410,7 +422,7 @@ Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet() const Sequence< beans::Property >& LegendWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticLegendWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties() @@ -418,6 +430,7 @@ const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties() ::std::vector< ::chart::WrappedProperty* > aWrappedProperties; aWrappedProperties.push_back( new WrappedLegendAlignmentProperty() ); + aWrappedProperties.push_back( new WrappedProperty( C2U("Expansion"), C2U("Expansion") )); WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this ); //same problem as for wall: thje defaults ion the old chart are different for different charttypes, so we need to export explicitly aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillStyle"), C2U("FillStyle") ) ); diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index a3e91a89c919..ad6584b796f6 100644..100755 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -57,29 +57,78 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticMinMaxLineWrapperDefaults_Initializer { - static Sequence< Property > aPropSeq; + ::chart::tPropertyValueMap* operator()() + { + static ::chart::tPropertyValueMap aStaticDefaults; + lcl_AddDefaultsToMap( aStaticDefaults ); + return &aStaticDefaults; + } +private: + void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) + { + ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + } +}; + +struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer > +{ +}; + +struct StaticMinMaxLineWrapperPropertyArray_Initializer +{ + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer > +{ +}; + +struct StaticMinMaxLineWrapperInfoHelper_Initializer +{ + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() ); + return &aPropHelper; + } +}; + +struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer > +{ +}; + +struct StaticMinMaxLineWrapperInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer > +{ +}; } // anonymous namespace @@ -93,7 +142,6 @@ namespace wrapper MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) : m_spChart2ModelContact( spChart2ModelContact ) , m_aEventListenerContainer( m_aMutex ) - , m_pPropertyArrayHelper() , m_aWrappedLineJointProperty( C2U("LineJoint"), uno::makeAny( drawing::LineJoint_NONE )) { } @@ -108,9 +156,6 @@ void SAL_CALL MinMaxLineWrapper::dispose() { Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); - - MutexGuard aGuard( GetMutex()); - m_xInfo.clear(); } void SAL_CALL MinMaxLineWrapper::addEventListener( @@ -129,30 +174,16 @@ void SAL_CALL MinMaxLineWrapper::removeEventListener( ::cppu::IPropertyArrayHelper& MinMaxLineWrapper::getInfoHelper() { - if(!m_pPropertyArrayHelper.get()) - { - ::osl::MutexGuard aGuard( GetMutex() ); - if(!m_pPropertyArrayHelper.get()) - { - sal_Bool bSorted = sal_True; - m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) ); - } - } - return *m_pPropertyArrayHelper.get(); + return *StaticMinMaxLineWrapperInfoHelper::get(); } //XPropertySet uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo() throw (uno::RuntimeException) { - if( !m_xInfo.is() ) - { - ::osl::MutexGuard aGuard( GetMutex() ); - if( !m_xInfo.is() ) - m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); - } - return m_xInfo; + return *StaticMinMaxLineWrapperInfo::get(); } + void SAL_CALL MinMaxLineWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { @@ -344,25 +375,14 @@ void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const ::rtl::OUString& rP { this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) ); } + uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - static tPropertyValueMap aStaticDefaults; - - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aStaticDefaults.size() ) - { - LineProperties::AddDefaultsToMap( aStaticDefaults ); - } - - sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; } @@ -371,7 +391,7 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( ) throw (uno::RuntimeException) { - const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence(); + const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get(); for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) { ::rtl::OUString aPropertyName( rPropSeq[nN].Name ); diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx index 6ecc276382c0..0e02ed3294e4 100644..100755 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx @@ -121,12 +121,6 @@ private: //member ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySetInfo > - m_xInfo;//outer PropertySetInfo - - ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper; - WrappedIgnoreProperty m_aWrappedLineJointProperty; }; diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index eea3a3eadd50..01af102984fe 100644..100755 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -178,14 +178,17 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticTitleWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); @@ -195,16 +198,16 @@ const Sequence< Property > & lcl_GetPropertySequence() ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticTitleWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticTitleWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -518,7 +521,7 @@ Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet() const Sequence< beans::Property >& TitleWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticTitleWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index e803e0033d51..a972e61a6119 100644..100755 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -57,30 +57,80 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartArea" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticUpDownBarWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticUpDownBarWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticUpDownBarWrapperPropertyArray_Initializer > +{ +}; + +struct StaticUpDownBarWrapperInfoHelper_Initializer +{ + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( *StaticUpDownBarWrapperPropertyArray::get() ); + return &aPropHelper; + } +}; + +struct StaticUpDownBarWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticUpDownBarWrapperInfoHelper_Initializer > +{ +}; + +struct StaticUpDownBarWrapperInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticUpDownBarWrapperInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticUpDownBarWrapperInfo_Initializer > +{ +}; + +struct StaticUpDownBarWrapperDefaults_Initializer +{ + ::chart::tPropertyValueMap* operator()() + { + static ::chart::tPropertyValueMap aStaticDefaults; + lcl_AddDefaultsToMap( aStaticDefaults ); + return &aStaticDefaults; + } +private: + void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) + { + ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::FillProperties::AddDefaultsToMap( rOutMap ); + } +}; + +struct StaticUpDownBarWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticUpDownBarWrapperDefaults_Initializer > +{ +}; } // anonymous namespace @@ -96,8 +146,6 @@ UpDownBarWrapper::UpDownBarWrapper( : m_spChart2ModelContact( spChart2ModelContact ) , m_aEventListenerContainer( m_aMutex ) , m_aPropertySetName( bUp ? C2U("WhiteDay") : C2U("BlackDay") ) - , m_xInfo(0) - , m_pPropertyArrayHelper() { } @@ -111,9 +159,6 @@ void SAL_CALL UpDownBarWrapper::dispose() { Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); - - MutexGuard aGuard( GetMutex()); - m_xInfo.clear(); } void SAL_CALL UpDownBarWrapper::addEventListener( @@ -132,29 +177,14 @@ void SAL_CALL UpDownBarWrapper::removeEventListener( ::cppu::IPropertyArrayHelper& UpDownBarWrapper::getInfoHelper() { - if(!m_pPropertyArrayHelper.get()) - { - ::osl::MutexGuard aGuard( GetMutex() ); - if(!m_pPropertyArrayHelper.get()) - { - sal_Bool bSorted = sal_True; - m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) ); - } - } - return *m_pPropertyArrayHelper.get(); + return *StaticUpDownBarWrapperInfoHelper::get(); } //XPropertySet uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo() throw (uno::RuntimeException) { - if( !m_xInfo.is() ) - { - ::osl::MutexGuard aGuard( GetMutex() ); - if( !m_xInfo.is() ) - m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); - } - return m_xInfo; + return *StaticUpDownBarWrapperInfo::get(); } void SAL_CALL UpDownBarWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) @@ -308,26 +338,14 @@ void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const ::rtl::OUString& rPr { this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) ); } + uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - static tPropertyValueMap aStaticDefaults; - - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aStaticDefaults.size() ) - { - LineProperties::AddDefaultsToMap( aStaticDefaults ); - FillProperties::AddDefaultsToMap( aStaticDefaults ); - } - - sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticUpDownBarWrapperDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; } @@ -336,7 +354,7 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& r void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( ) throw (uno::RuntimeException) { - const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence(); + const Sequence< beans::Property >& rPropSeq = *StaticUpDownBarWrapperPropertyArray::get(); for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) { ::rtl::OUString aPropertyName( rPropSeq[nN].Name ); diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx index 0ccef58f2583..7e3602f0aa36 100644..100755 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx @@ -121,11 +121,6 @@ private: //member ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; rtl::OUString m_aPropertySetName; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySetInfo > - m_xInfo;//outer PropertySetInfo - ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper; - }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx index e18d6baae881..76ef90ffffc9 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx @@ -60,29 +60,32 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.WallOrFloor" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticWallFloorWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } +}; - return aPropSeq; -} +struct StaticWallFloorWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticWallFloorWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -152,7 +155,7 @@ Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet() const Sequence< beans::Property >& WallFloorWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticWallFloorWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > WallFloorWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx index ab91436809f9..ab91436809f9 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx index 75eee8549812..75eee8549812 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx index b0c62d859694..b0c62d859694 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx index 45539f76f5a6..45539f76f5a6 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx index ff5e93c0a497..0fa172ae2f18 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx @@ -34,9 +34,8 @@ #include "CommonConverters.hxx" #include "AxisHelper.hxx" #include <com/sun/star/chart2/XAxis.hpp> -#include <com/sun/star/chart2/ExplicitIncrementData.hpp> -#include <com/sun/star/chart2/ExplicitScaleData.hpp> -#include <com/sun/star/chart2/AxisOrientation.hpp> +#include <com/sun/star/chart/ChartAxisType.hpp> +#include <chartview/ExplicitScaleValues.hxx> using namespace ::com::sun::star; using ::com::sun::star::uno::Any; @@ -44,6 +43,7 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::rtl::OUString; +using ::com::sun::star::chart::TimeIncrement; //............................................................................. namespace chart @@ -92,6 +92,15 @@ WrappedScaleProperty::WrappedScaleProperty( tScaleProperty eScaleProperty case SCALE_PROP_AUTO_STEPHELP: m_aOuterName = C2U("AutoStepHelp"); break; + case SCALE_PROP_AXIS_TYPE: + m_aOuterName = C2U("AxisType"); + break; + case SCALE_PROP_DATE_INCREMENT: + m_aOuterName = C2U("TimeIncrement"); + break; + case SCALE_PROP_EXPLICIT_DATE_INCREMENT: + m_aOuterName = C2U("ExplicitTimeIncrement"); + break; case SCALE_PROP_LOGARITHMIC: m_aOuterName = C2U("Logarithmic"); break; @@ -122,6 +131,9 @@ void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* > rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_ORIGIN, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPMAIN, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPHELP, spChart2ModelContact ) ); + rList.push_back( new WrappedScaleProperty( SCALE_PROP_AXIS_TYPE, spChart2ModelContact ) ); + rList.push_back( new WrappedScaleProperty( SCALE_PROP_DATE_INCREMENT, spChart2ModelContact ) ); + rList.push_back( new WrappedScaleProperty( SCALE_PROP_EXPLICIT_DATE_INCREMENT, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_LOGARITHMIC, spChart2ModelContact ) ); rList.push_back( new WrappedScaleProperty( SCALE_PROP_REVERSEDIRECTION, spChart2ModelContact ) ); } @@ -267,6 +279,43 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons bSetScaleData = true; break; } + case SCALE_PROP_AXIS_TYPE: + { + sal_Int32 nType = 0; + if( (rOuterValue >>= nType) ) + { + if( ::com::sun::star::chart::ChartAxisType::AUTOMATIC == nType ) + { + aScaleData.AutoDateAxis = true; + if( aScaleData.AxisType == AxisType::DATE ) + aScaleData.AxisType = AxisType::CATEGORY; + } + else if( ::com::sun::star::chart::ChartAxisType::CATEGORY == nType ) + { + aScaleData.AutoDateAxis = false; + if( aScaleData.AxisType == AxisType::DATE ) + aScaleData.AxisType = AxisType::CATEGORY; + } + else if( ::com::sun::star::chart::ChartAxisType::DATE == nType ) + { + if( aScaleData.AxisType == AxisType::CATEGORY ) + aScaleData.AxisType = AxisType::DATE; + } + bSetScaleData = true; + } + break; + } + case SCALE_PROP_DATE_INCREMENT: + { + TimeIncrement aTimeIncrement; + rOuterValue >>= aTimeIncrement; + aScaleData.TimeIncrement = aTimeIncrement; + bSetScaleData = true; + break; + } + case SCALE_PROP_EXPLICIT_DATE_INCREMENT: + //read only property + break; case SCALE_PROP_LOGARITHMIC: { if( rOuterValue >>= bBool ) @@ -321,8 +370,8 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const chart2::ScaleData aScaleData( xAxis->getScaleData() ); - chart2::ExplicitScaleData aExplicitScale; - chart2::ExplicitIncrementData aExplicitIncrement; + ExplicitScaleData aExplicitScale; + ExplicitIncrementData aExplicitIncrement; switch( eScaleProperty ) { @@ -402,7 +451,8 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const { m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement ); - if( aExplicitIncrement.SubIncrements.getLength() > 0 && + + if( !aExplicitIncrement.SubIncrements.empty() && aExplicitIncrement.SubIncrements[ 0 ].IntervalCount > 0 ) { if( bLogarithmic ) @@ -441,7 +491,7 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const if( bNeedToCalculateExplicitValues ) { m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement ); - if( aExplicitIncrement.SubIncrements.getLength() > 0 ) + if( !aExplicitIncrement.SubIncrements.empty() ) nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount; } aRet = uno::makeAny( nIntervalCount ); @@ -487,6 +537,46 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const aRet <<= !hasDoubleValue(aScaleData.Origin); break; } + case SCALE_PROP_AXIS_TYPE: + { + sal_Int32 nType = ::com::sun::star::chart::ChartAxisType::AUTOMATIC; + if( aScaleData.AxisType == AxisType::DATE ) + { + nType = ::com::sun::star::chart::ChartAxisType::DATE; + } + else if( aScaleData.AxisType == AxisType::CATEGORY ) + { + if( !aScaleData.AutoDateAxis ) + nType = ::com::sun::star::chart::ChartAxisType::CATEGORY; + } + aRet = uno::makeAny( nType ); + break; + } + case SCALE_PROP_DATE_INCREMENT: + { + if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis ) + aRet = uno::makeAny( aScaleData.TimeIncrement ); + break; + } + case SCALE_PROP_EXPLICIT_DATE_INCREMENT: + { + if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis ) + { + m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement ); + if( aExplicitScale.AxisType == AxisType::DATE ) + { + TimeIncrement aTimeIncrement; + aTimeIncrement.MajorTimeInterval = uno::makeAny( aExplicitIncrement.MajorTimeInterval ); + aTimeIncrement.MinorTimeInterval = uno::makeAny( aExplicitIncrement.MinorTimeInterval ); + aTimeIncrement.TimeResolution = uno::makeAny( aExplicitScale.TimeResolution ); + aRet = uno::makeAny(aTimeIncrement); + } + } + + if( aScaleData.AxisType == AxisType::DATE || aScaleData.AutoDateAxis ) + aRet = uno::makeAny( aScaleData.TimeIncrement ); + break; + } case SCALE_PROP_LOGARITHMIC: { aRet <<= static_cast< sal_Bool >( AxisHelper::isLogarithmic(aScaleData.Scaling) ); @@ -508,7 +598,7 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const } } // namespace wrapper -} //namespace chart +} // namespace chart //............................................................................. /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx index 73bb17bc158e..8863906c8db9 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx @@ -56,6 +56,9 @@ public: , SCALE_PROP_AUTO_ORIGIN , SCALE_PROP_AUTO_STEPMAIN , SCALE_PROP_AUTO_STEPHELP + , SCALE_PROP_AXIS_TYPE + , SCALE_PROP_DATE_INCREMENT + , SCALE_PROP_EXPLICIT_DATE_INCREMENT , SCALE_PROP_LOGARITHMIC , SCALE_PROP_REVERSEDIRECTION }; diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx index a76f6e17436c..a76f6e17436c 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx index 23039f73f7a7..23039f73f7a7 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx index 24abf9cfda71..ae2910d865be 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx @@ -223,7 +223,7 @@ void WrappedSplineProperties::addWrappedProperties( std::vector< WrappedProperty , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { rList.push_back( new WrappedSplineTypeProperty( spChart2ModelContact ) ); - rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineOrder"), C2U("SplineOrder"), uno::makeAny(sal_Int32(2)), spChart2ModelContact ) ); + rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineOrder"), C2U("SplineOrder"), uno::makeAny(sal_Int32(3)), spChart2ModelContact ) ); rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineResolution"), C2U("CurveResolution"), uno::makeAny(sal_Int32(20)), spChart2ModelContact ) ); } diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx index aea06297bcee..aea06297bcee 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx index 7dc04fe121ad..7dc04fe121ad 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx index 88bdc8c971d2..5707a0aa8f21 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx @@ -555,8 +555,19 @@ void WrappedSymbolAndLinesProperty::setValueToSeries( if(!xSeriesPropertySet.is()) return; - drawing::LineStyle eLineStyle( bDrawLines ? drawing::LineStyle_SOLID : drawing::LineStyle_NONE ); - xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( eLineStyle ) ); + drawing::LineStyle eOldLineStyle( drawing::LineStyle_SOLID ); + xSeriesPropertySet->getPropertyValue( C2U("LineStyle") ) >>= eOldLineStyle; + if( bDrawLines ) + { + //#i114298# don't overwrite dashed lines with solid lines here + if( eOldLineStyle == drawing::LineStyle_NONE ) + xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID ) ); + } + else + { + if( eOldLineStyle != drawing::LineStyle_NONE ) + xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_NONE ) ); + } } beans::PropertyState WrappedSymbolAndLinesProperty::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const diff --git a/chart2/source/controller/chartcontroller.component b/chart2/source/controller/chartcontroller.component new file mode 100644 index 000000000000..fc99913b5a74 --- /dev/null +++ b/chart2/source/controller/chartcontroller.component @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.chart.ElementSelectorToolbarController"> + <service name="com.sun.star.frame.ToolbarController"/> + </implementation> + <implementation name="com.sun.star.comp.chart2.ChartController"> + <service name="com.sun.star.chart2.ChartController"/> + <service name="com.sun.star.frame.Controller"/> + </implementation> + <implementation name="com.sun.star.comp.chart2.ChartDocumentWrapper"> + <service name="com.sun.star.beans.PropertySet"/> + <service name="com.sun.star.chart.ChartDocument"/> + <service name="com.sun.star.chart2.ChartDocumentWrapper"/> + <service name="com.sun.star.xml.UserDefinedAttributeSupplier"/> + </implementation> + <implementation name="com.sun.star.comp.chart2.ChartFrameLoader"> + <service name="com.sun.star.frame.SynchronousFrameLoader"/> + </implementation> + <implementation name="com.sun.star.comp.chart2.ChartTypeDialog"> + <service name="com.sun.star.chart2.ChartTypeDialog"/> + </implementation> + <implementation name="com.sun.star.comp.chart2.ShapeToolbarController"> + <service name="com.sun.star.chart2.ShapeToolbarController"/> + </implementation> + <implementation name="com.sun.star.comp.chart2.WizardDialog"> + <service name="com.sun.star.chart2.WizardDialog"/> + </implementation> +</component> diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index 1e336a91ab55..148175596967 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -1167,6 +1167,8 @@ void CombiColumnLineChartDialogController::showExtraControls( Window* pParent, c m_pFT_NumberOfLines->Show(); m_pMF_NumberOfLines->Show(); + m_pMF_NumberOfLines->SetAccessibleName(m_pFT_NumberOfLines->GetText()); + m_pMF_NumberOfLines->SetAccessibleRelationLabeledBy(m_pFT_NumberOfLines); } void CombiColumnLineChartDialogController::hideExtraControls() const { diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 85bbc8c82fda..bebbf410a89c 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -48,7 +48,7 @@ #include "ChartModelHelper.hxx" #include "CommonConverters.hxx" #include "macros.hxx" -#include "chartview/NumberFormatterWrapper.hxx" +#include "NumberFormatterWrapper.hxx" #include "servicenames_charttypes.hxx" #include "ResId.hxx" #include "Bitmaps.hrc" @@ -64,6 +64,7 @@ #include <com/sun/star/chart2/XChartType.hpp> #include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/util/XNumberFormats.hpp> #include <algorithm> #include <functional> @@ -102,7 +103,7 @@ sal_Int32 lcl_getRowInData( long nRow ) return static_cast< sal_Int32 >( nRow ); } -sal_Int32 lcl_getColumnInData( USHORT nCol ) +sal_Int32 lcl_getColumnInData( sal_uInt16 nCol ) { return static_cast< sal_Int32 >( nCol ) - 1; } @@ -237,7 +238,7 @@ SeriesHeader::SeriesHeader( Window * pParent ) : m_spSeriesName->EnableUpdateData( 4 * EDIT_UPDATEDATA_TIMEOUT ); // define is in vcl/edit.hxx m_spSeriesName->SetUpdateDataHdl( LINK( this, SeriesHeader, SeriesNameChanged )); m_spSeriesName->SetModifyHdl( LINK( this, SeriesHeader, SeriesNameEdited )); - m_spSeriesName->SetSmartHelpId( SmartId( HID_SCH_DATA_SERIES_LABEL )); + m_spSeriesName->SetHelpId( HID_SCH_DATA_SERIES_LABEL ); Show(); } @@ -471,13 +472,13 @@ bool lcl_SeriesHeaderHasFocus( } sal_Int32 lcl_getColumnInDataOrHeader( - USHORT nCol, const ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader ) + sal_uInt16 nCol, const ::std::vector< ::boost::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader ) { sal_Int32 nColIdx = 0; bool bHeaderHasFocus( lcl_SeriesHeaderHasFocus( rSeriesHeader, &nColIdx )); if( bHeaderHasFocus ) - nColIdx = lcl_getColumnInData( static_cast< USHORT >( rSeriesHeader[nColIdx]->GetStartColumn())); + nColIdx = lcl_getColumnInData( static_cast< sal_uInt16 >( rSeriesHeader[nColIdx]->GetStartColumn())); else nColIdx = lcl_getColumnInData( nCol ); @@ -502,7 +503,7 @@ DataBrowser::DataBrowser( Window* pParent, const ResId& rId, bool bLiveUpdate ) double fNan; ::rtl::math::setNan( & fNan ); m_aNumberEditField.SetDefaultValue( fNan ); - m_aNumberEditField.TreatAsNumber( TRUE ); + m_aNumberEditField.TreatAsNumber( sal_True ); RenewTable(); SetClean(); } @@ -578,10 +579,10 @@ void DataBrowser::RenewTable() return; long nOldRow = GetCurRow(); - USHORT nOldColId = GetCurColumnId(); + sal_uInt16 nOldColId = GetCurColumnId(); - BOOL bLastUpdateMode = GetUpdateMode(); - SetUpdateMode( FALSE ); + sal_Bool bLastUpdateMode = GetUpdateMode(); + SetUpdateMode( sal_False ); if( IsModified() ) SaveModified(); @@ -609,7 +610,7 @@ void DataBrowser::RenewTable() RowInserted( 1, nRowCountLocal ); GoToRow( ::std::min( nOldRow, GetRowCount() - 1 )); - GoToColumnId( ::std::min( nOldColId, static_cast< USHORT >( ColCount() - 1 ))); + GoToColumnId( ::std::min( nOldColId, static_cast< sal_uInt16 >( ColCount() - 1 ))); Window * pWin = this->GetParent(); if( !pWin ) @@ -665,7 +666,7 @@ String DataBrowser::GetRowString( sal_Int32 nRow ) const return String::CreateFromInt32( nRow + 1 ); } -String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const +String DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const { String aResult; @@ -690,6 +691,23 @@ String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const GetNumberFormatKey( nRow, nColumnId ), fData, nLabelColor, bColorChanged )); } + else if( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::TEXTORDATE ) + { + uno::Any aAny = m_apDataBrowserModel->getCellAny( nColIndex, nRow ); + OUString aText; + double fDouble=0.0; + if( aAny>>=aText ) + aResult = aText; + else if( aAny>>=fDouble ) + { + sal_Int32 nLabelColor; + bool bColorChanged = false; + sal_Int32 nDateNumberFormat = DiagramHelper::getDateNumberFormat( Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY) ); + if( ! ::rtl::math::isNan( fDouble ) && m_spNumberFormatterWrapper.get() ) + aResult = String( m_spNumberFormatterWrapper->getFormattedString( + nDateNumberFormat, fDouble, nLabelColor, bColorChanged )); + } + } else { OSL_ASSERT( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::TEXT ); @@ -700,7 +718,7 @@ String DataBrowser::GetCellText( long nRow, USHORT nColumnId ) const return aResult; } -double DataBrowser::GetCellNumber( long nRow, USHORT nColumnId ) const +double DataBrowser::GetCellNumber( long nRow, sal_uInt16 nColumnId ) const { double fResult; ::rtl::math::setNan( & fResult ); @@ -717,8 +735,8 @@ double DataBrowser::GetCellNumber( long nRow, USHORT nColumnId ) const void DataBrowser::Resize() { - BOOL bLastUpdateMode = GetUpdateMode(); - SetUpdateMode( FALSE ); + sal_Bool bLastUpdateMode = GetUpdateMode(); + SetUpdateMode( sal_False ); ::svt::EditBrowseBox::Resize(); ImplAdjustHeaderControls(); @@ -848,6 +866,9 @@ void DataBrowser::SetDataFromModel( new NumberFormatterWrapper( Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ))); + if( m_spNumberFormatterWrapper.get() ) + m_aNumberEditField.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() ); + RenewTable(); const sal_Int32 nColCnt = m_apDataBrowserModel->getColumnCount(); @@ -1115,6 +1136,22 @@ sal_uInt32 DataBrowser::GetNumberFormatKey( sal_Int32 nRow, sal_uInt16 nCol ) co return m_apDataBrowserModel->getNumberFormatKey( lcl_getColumnInData( nCol ), lcl_getRowInData( nRow )); } +bool DataBrowser::isDateString( rtl::OUString aInputString, double& fOutDateValue ) +{ + sal_uInt32 nNumberFormat=0; + SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper.get() ? m_spNumberFormatterWrapper->getSvNumberFormatter() : 0; + if( aInputString.getLength() > 0 && pSvNumberFormatter && pSvNumberFormatter->IsNumberFormat( aInputString, nNumberFormat, fOutDateValue ) ) + { + Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( m_xChartDoc, uno::UNO_QUERY ); + Reference< util::XNumberFormats > xNumberFormats; + if( xNumberFormatsSupplier.is() ) + xNumberFormats = Reference< util::XNumberFormats >( xNumberFormatsSupplier->getNumberFormats() ); + if( DiagramHelper::isDateNumberFormat( nNumberFormat, xNumberFormats ) ) + return true; + } + return false; +} + sal_Bool DataBrowser::SaveModified() { if( ! IsModified() ) @@ -1127,6 +1164,7 @@ sal_Bool DataBrowser::SaveModified() DBG_ASSERT( nRow >= 0 || nCol >= 0, "This cell should not be modified!" ); + SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper.get() ? m_spNumberFormatterWrapper->getSvNumberFormatter() : 0; switch( m_apDataBrowserModel->getCellType( nCol, nRow )) { case DataBrowserModel::NUMBER: @@ -1136,11 +1174,8 @@ sal_Bool DataBrowser::SaveModified() String aText( m_aNumberEditField.GetText()); // an empty string is valid, if no numberformatter exists, all // values are treated as valid - if( aText.Len() > 0 && - m_spNumberFormatterWrapper.get() && - m_spNumberFormatterWrapper->getSvNumberFormatter() && - ! m_spNumberFormatterWrapper->getSvNumberFormatter()->IsNumberFormat( - aText, nDummy, fDummy )) + if( aText.Len() > 0 && pSvNumberFormatter && + ! pSvNumberFormatter->IsNumberFormat( aText, nDummy, fDummy ) ) { bChangeValid = sal_False; } @@ -1151,6 +1186,17 @@ sal_Bool DataBrowser::SaveModified() } } break; + case DataBrowserModel::TEXTORDATE: + { + OUString aText( m_aTextEditField.GetText() ); + double fDateValue=0.0; + bChangeValid = sal_False; + if( isDateString( aText, fDateValue ) ) + bChangeValid = m_apDataBrowserModel->setCellAny( nCol, nRow, uno::makeAny( fDateValue ) ); + if(!bChangeValid) + bChangeValid = m_apDataBrowserModel->setCellAny( nCol, nRow, uno::makeAny( aText ) ); + } + break; case DataBrowserModel::TEXT: { OUString aText( m_aTextEditField.GetText()); @@ -1191,10 +1237,10 @@ sal_Int16 DataBrowser::GetFirstVisibleColumNumber() const return GetFirstVisibleColNumber(); } -void DataBrowser::ColumnResized( USHORT nColId ) +void DataBrowser::ColumnResized( sal_uInt16 nColId ) { - BOOL bLastUpdateMode = GetUpdateMode(); - SetUpdateMode( FALSE ); + sal_Bool bLastUpdateMode = GetUpdateMode(); + SetUpdateMode( sal_False ); EditBrowseBox::ColumnResized( nColId ); ImplAdjustHeaderControls(); @@ -1203,8 +1249,8 @@ void DataBrowser::ColumnResized( USHORT nColId ) void DataBrowser::EndScroll() { - BOOL bLastUpdateMode = GetUpdateMode(); - SetUpdateMode( FALSE ); + sal_Bool bLastUpdateMode = GetUpdateMode(); + SetUpdateMode( sal_False ); EditBrowseBox::EndScroll(); RenewSeriesHeaders(); @@ -1331,8 +1377,8 @@ IMPL_LINK( DataBrowser, SeriesHeaderChanged, impl::SeriesHeaderEdit*, pEdit ) sal_Int32 DataBrowser::GetTotalWidth() const { - ULONG nWidth = 0; - for ( USHORT nCol = 0; nCol < ColCount(); ++nCol ) + sal_uLong nWidth = 0; + for ( sal_uInt16 nCol = 0; nCol < ColCount(); ++nCol ) nWidth += GetColumnWidth( nCol ); return static_cast< sal_Int32 >( nWidth ); } diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx index 9ebaca3f860e..4f63138cd619 100644 --- a/chart2/source/controller/dialogs/DataBrowser.hxx +++ b/chart2/source/controller/dialogs/DataBrowser.hxx @@ -69,7 +69,7 @@ protected: virtual void CursorMoved(); // called whenever the control of the current cell has been modified virtual void CellModified(); - virtual void ColumnResized( USHORT nColId ); + virtual void ColumnResized( sal_uInt16 nColId ); virtual void EndScroll(); virtual void MouseButtonDown( const BrowserMouseEvent& rEvt ); @@ -87,12 +87,14 @@ public: @return the text out of the cell */ - virtual String GetCellText(long nRow, USHORT nColId) const; + virtual String GetCellText(long nRow, sal_uInt16 nColId) const; /** returns the number in the given cell. If a cell is empty or contains a string, the result will be Nan */ - double GetCellNumber( long nRow, USHORT nColumnId ) const; + double GetCellNumber( long nRow, sal_uInt16 nColumnId ) const; + + bool isDateString( rtl::OUString aInputString, double& fOutDateValue ); // Window virtual void Resize(); diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index f0d08ea42719..2ee7f3f580c7 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -44,6 +44,7 @@ #include "ExplicitCategoriesProvider.hxx" #include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> #include <com/sun/star/chart2/XInternalDataProvider.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -589,7 +590,7 @@ Reference< chart2::XDataSeries > return 0; } -DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ ) +DataBrowserModel::eCellType DataBrowserModel::getCellType( sal_Int32 nAtColumn, sal_Int32 /* nAtRow */ ) const { eCellType eResult = TEXT; tDataColumnVector::size_type nIndex( nAtColumn ); @@ -619,6 +620,26 @@ double DataBrowserModel::getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow ) return fResult; } +uno::Any DataBrowserModel::getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow ) +{ + uno::Any aResult; + + tDataColumnVector::size_type nIndex( nAtColumn ); + if( nIndex < m_aColumns.size() && + m_aColumns[ nIndex ].m_xLabeledDataSequence.is()) + { + Reference< chart2::data::XDataSequence > xData( + m_aColumns[ nIndex ].m_xLabeledDataSequence->getValues() ); + if( xData.is() ) + { + Sequence< uno::Any > aValues( xData->getData()); + if( nAtRow < aValues.getLength()) + aResult = aValues[nAtRow]; + } + } + return aResult; +} + OUString DataBrowserModel::getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow ) { OUString aResult; @@ -800,7 +821,7 @@ void DataBrowserModel::updateFromModel() aCategories.m_aUIRoleName = DialogModel::GetRoleDataLabel(); else aCategories.m_aUIRoleName = lcl_getUIRoleName( xCategories ); - aCategories.m_eCellType = TEXT; + aCategories.m_eCellType = TEXTORDATE; m_aColumns.push_back( aCategories ); ++nHeaderStart; } diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/controller/dialogs/DataBrowserModel.hxx index 58d64be83a80..ee48fa0d8065 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.hxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx @@ -82,18 +82,20 @@ public: enum eCellType { NUMBER, - TEXT + TEXT, + TEXTORDATE }; - eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow ); + eCellType getCellType( sal_Int32 nAtColumn, sal_Int32 nAtRow ) const; /// If getCellType( nAtColumn, nAtRow ) returns TEXT, the result will be Nan double getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow ); ::rtl::OUString getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow ); + ::com::sun::star::uno::Any getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow ); sal_uInt32 getNumberFormatKey( sal_Int32 nAtColumn, sal_Int32 nAtRow ); - /// returns </TRUE> if the number could successfully be set at the given position + /// returns </sal_True> if the number could successfully be set at the given position bool setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue ); - /// returns </TRUE> if the text could successfully be set at the given position + /// returns </sal_True> if the text could successfully be set at the given position bool setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::rtl::OUString & rText ); bool setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const ::com::sun::star::uno::Any & aValue ); diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index ad2916e74bbe..8dd2e0ff2602 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -162,7 +162,7 @@ void lcl_createRoleIndexMap( lcl_tRoleIndexMap & rOutMap ) struct lcl_DataSeriesContainerAppend : public ::std::iterator< ::std::output_iterator_tag, Reference< XDataSeriesContainer > > { - typedef ::std::vector< chart::DialogModel::tSeriesWithChartTypeByName > tContainerType; + typedef ::std::vector< ::chart::DialogModel::tSeriesWithChartTypeByName > tContainerType; explicit lcl_DataSeriesContainerAppend( tContainerType & rCnt ) : m_rDestCnt( rCnt ) @@ -182,7 +182,7 @@ struct lcl_DataSeriesContainerAppend : public for( sal_Int32 nI = 0; nI < aSeq.getLength(); ++ nI ) { m_rDestCnt.push_back( - chart::DialogModel::tSeriesWithChartTypeByName( + ::chart::DialogModel::tSeriesWithChartTypeByName( ::chart::DataSeriesHelper::getDataSeriesLabel( aSeq[nI], aRole ), ::std::make_pair( aSeq[nI], xCT ))); } @@ -383,7 +383,6 @@ DialogModel::DialogModel( m_xContext( xContext ), m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) ) { - createBackup(); } DialogModel::~DialogModel() @@ -752,20 +751,6 @@ sal_Int32 DialogModel::GetRoleIndexForSorting( const ::rtl::OUString & rInternal // private methods -void DialogModel::createBackup() -{ - OSL_ENSURE( ! m_xBackupChartDocument.is(), "Cloning already cloned model" ); - try - { - Reference< util::XCloneable > xCloneable( m_xChartDocument, uno::UNO_QUERY_THROW ); - m_xBackupChartDocument.set( xCloneable->createClone(), uno::UNO_QUERY_THROW ); - } - catch( uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } -} - void DialogModel::applyInterpretedData( const InterpretedData & rNewData, const ::std::vector< Reference< XDataSeries > > & rSeriesToReUse, diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx index 3f79356e8675..8b113311e927 100644 --- a/chart2/source/controller/dialogs/DialogModel.hxx +++ b/chart2/source/controller/dialogs/DialogModel.hxx @@ -164,10 +164,6 @@ private: m_xChartDocument; ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > - m_xBackupChartDocument; - - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartTypeTemplate > m_xTemplate; diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 86b85c427828..34838abaeee3 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -41,7 +41,7 @@ #include "AxisIndexDefines.hxx" #include "ExplicitCategoriesProvider.hxx" #include "CommonConverters.hxx" -#include "chartview/NumberFormatterWrapper.hxx" +#include "NumberFormatterWrapper.hxx" #include "RegressionCurveHelper.hxx" #include <rtl/math.hxx> #include <tools/debug.hxx> @@ -192,14 +192,7 @@ OUString lcl_getDataPointValueText( const Reference< XDataSeries >& xSeries, sal if( aX.getLength() == 0 ) { - rtl::OUString aCategory = ::rtl::OUString( String(SchResId(STR_TIP_CATEGORY_VALUE))); - - replaceParamterInString( aCategory - , C2U("%CATEGORYVALUE") - , ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, xChartModel, nPointIndex ) - ); - - aRet = aCategory; + aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, xChartModel, nPointIndex ); } else { diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index cf189b1b82bf..67967140ae71 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -101,6 +101,15 @@ String STR_PAGE_POSITION Text [ en-US ] = "Position" ; }; +String STR_BUTTON_UP +{ + Text [ en-US ] = "Up"; +}; +String STR_BUTTON_DOWN +{ + Text [ en-US ] = "Down"; +}; + String STR_PAGE_LAYOUT { Text [ en-US ] = "Layout"; @@ -383,11 +392,6 @@ String STR_TIP_DATAPOINT_VALUES Text [ en-US ] = "Values: %POINTVALUES"; }; -String STR_TIP_CATEGORY_VALUE -{ - Text [ en-US ] = "'%CATEGORYVALUE'"; -}; - String STR_TIP_DATAPOINT { Text [ en-US ] = "Data Point %POINTNUMBER, data series %SERIESNUMBER, values: %POINTVALUES"; @@ -458,6 +462,10 @@ String STR_ACTION_NOTPOSSIBLE { Text [ en-US ] = "This function cannot be completed with the selected objects." ; }; +String STR_ACTION_EDIT_TEXT +{ + Text [ en-US ] = "Edit text"; +}; String STR_COLUMN_LABEL { diff --git a/chart2/source/controller/dialogs/Strings_Scale.src b/chart2/source/controller/dialogs/Strings_Scale.src index e7a3d6c2b1cf..6f8b75d9509c 100644 --- a/chart2/source/controller/dialogs/Strings_Scale.src +++ b/chart2/source/controller/dialogs/Strings_Scale.src @@ -42,3 +42,11 @@ String STR_MIN_GREATER_MAX { Text [ en-US ] = "The minimum must be lower than the maximum. Check your input." ; }; +String STR_INVALID_INTERVALS +{ + Text [ en-US ] = "The major interval needs to be greater than the minor interval. Check your input." ; +}; +String STR_INVALID_TIME_UNIT +{ + Text [ en-US ] = "The major and minor interval need to be greater or equal to the resolution. Check your input." ; +}; diff --git a/chart2/source/controller/dialogs/Strings_Statistic.src b/chart2/source/controller/dialogs/Strings_Statistic.src index f2dc4235f783..10c59a4c9b1d 100644 --- a/chart2/source/controller/dialogs/Strings_Statistic.src +++ b/chart2/source/controller/dialogs/Strings_Statistic.src @@ -51,22 +51,22 @@ String STR_CONTROLTEXT_ERROR_BARS_FROM_DATA String STR_REGRESSION_LINEAR { - Text [ en-US ] = "Linear Regression" ; + Text [ en-US ] = "Linear (%SERIESNAME)" ; }; String STR_REGRESSION_LOG { - Text [ en-US ] = "Logarithmic Regression" ; + Text [ en-US ] = "Logarithmic (%SERIESNAME)" ; }; String STR_REGRESSION_EXP { - Text [ en-US ] = "Exponential Regression" ; + Text [ en-US ] = "Exponential (%SERIESNAME)" ; }; String STR_REGRESSION_POWER { - Text [ en-US ] = "Power Regression" ; + Text [ en-US ] = "Power (%SERIESNAME)" ; }; -String STR_STATISTICS_IN_LEGEND +String STR_REGRESSION_MEAN { - Text [ en-US ] = "%REGRESSIONCURVE for %SERIESNAME" ; + Text [ en-US ] = "Mean (%SERIESNAME)" ; }; diff --git a/chart2/source/controller/dialogs/TabPages.hrc b/chart2/source/controller/dialogs/TabPages.hrc index 697f700d4de9..c43ef24cd003 100644 --- a/chart2/source/controller/dialogs/TabPages.hrc +++ b/chart2/source/controller/dialogs/TabPages.hrc @@ -77,28 +77,9 @@ #define FL_SEPARATOR 18 #define FT_AXIS_TEXTDIR 19 #define LB_AXIS_TEXTDIR 20 -#define FL_SCALE 1 - -#define TXT_MIN 1 -#define TXT_MAX 2 -#define TXT_STEP_MAIN 3 -#define TXT_STEP_HELP 4 -#define TXT_ORIGIN 5 - -#define CBX_AUTO_MIN 1 -#define CBX_AUTO_MAX 2 -#define CBX_AUTO_STEP_MAIN 3 -#define CBX_AUTO_STEP_HELP 4 -#define CBX_AUTO_ORIGIN 5 -#define CBX_LOGARITHM 6 -#define CBX_REVERSE 7 - -#define EDT_STEP_MAIN 1 -#define EDT_MAX 2 -#define EDT_MIN 3 -#define EDT_ORIGIN 4 - -#define MT_STEPHELP 10 + +//#define TP_AXIS_POSITIONS 904 + #define FL_AXIS_LINE 1 #define FL_LABELS 2 #define FL_TICKS 3 diff --git a/chart2/source/controller/dialogs/dlg_ChartType.src b/chart2/source/controller/dialogs/dlg_ChartType.src index 5523ad8956db..57e1f281a613 100644 --- a/chart2/source/controller/dialogs/dlg_ChartType.src +++ b/chart2/source/controller/dialogs/dlg_ChartType.src @@ -38,7 +38,7 @@ ModalDialog DLG_DIAGRAM_TYPE { - HelpID = SID_DIAGRAM_TYPE ; + HelpID = HID_DIAGRAM_TYPE ; Size = MAP_APPFONT ( CHART_TYPE_DLG_WIDTH , CHART_TYPE_DLG_HEIGHT ) ; diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx index 31e9d542ec05..d4e7147ac23a 100644 --- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx +++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx @@ -84,7 +84,7 @@ CreationWizard::CreationWizard( Window* pParent, const uno::Reference< frame::XM m_apDialogModel.reset( new DialogModel( m_xChartModel, m_xCC )); // Do not call FreeResource(), because there are no sub-elements defined in // the dialog resource - ShowButtonFixedLine( TRUE ); + ShowButtonFixedLine( sal_True ); defaultButton( WZB_FINISH ); if( m_nOnePageOnlyIndex < 0 || m_nOnePageOnlyIndex >= nPageCount ) @@ -102,7 +102,7 @@ CreationWizard::CreationWizard( Window* pParent, const uno::Reference< frame::XM , STATE_OBJECTS , WZS_INVALID_STATE ); - this->SetRoadmapSmartHelpId( SmartId( HID_SCH_WIZARD_ROADMAP ) ); + this->SetRoadmapHelpId( HID_SCH_WIZARD_ROADMAP ); this->SetRoadmapInteractive( sal_True ); Size aAdditionalRoadmapSize( LogicToPixel( Size( 85, 0 ), MAP_APPFONT ) ); Size aSize( this->GetSizePixel() ); @@ -213,7 +213,7 @@ void CreationWizard::setValidPage( TabPage * /* pTabPage */ ) String CreationWizard::getStateDisplayName( WizardState nState ) const { - USHORT nResId = 0; + sal_uInt16 nResId = 0; switch( nState ) { case STATE_CHARTTYPE: diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx index 8f3502204107..574b464b5dac 100644 --- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx +++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx @@ -186,13 +186,13 @@ void DataEditor::SetReadOnly( bool bReadOnly ) m_bReadOnly = bReadOnly; if( m_bReadOnly ) { - m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, FALSE ); - m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, FALSE ); - m_aTbxData.EnableItem( TBI_DATA_INSERT_TEXT_COL, FALSE ); - m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, FALSE ); - m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, FALSE ); - m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, FALSE ); - m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, FALSE ); + m_aTbxData.EnableItem( TBI_DATA_INSERT_ROW, sal_False ); + m_aTbxData.EnableItem( TBI_DATA_INSERT_COL, sal_False ); + m_aTbxData.EnableItem( TBI_DATA_INSERT_TEXT_COL, sal_False ); + m_aTbxData.EnableItem( TBI_DATA_DELETE_ROW, sal_False ); + m_aTbxData.EnableItem( TBI_DATA_DELETE_COL, sal_False ); + m_aTbxData.EnableItem( TBI_DATA_SWAP_COL, sal_False ); + m_aTbxData.EnableItem( TBI_DATA_SWAP_ROW, sal_False ); } m_apBrwData->SetReadOnly( m_bReadOnly ); @@ -235,12 +235,12 @@ void DataEditor::Resize() AdaptBrowseBoxSize(); } -BOOL DataEditor::Close() +sal_Bool DataEditor::Close() { if( ApplyChangesToModel() ) return ModalDialog::Close(); else - return TRUE; + return sal_True; } bool DataEditor::ApplyChangesToModel() diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.src b/chart2/source/controller/dialogs/dlg_DataEditor.src index 4f4d33ebb832..1bee31dd21fe 100644 --- a/chart2/source/controller/dialogs/dlg_DataEditor.src +++ b/chart2/source/controller/dialogs/dlg_DataEditor.src @@ -36,7 +36,7 @@ ModalDialog DLG_DIAGRAM_DATA { - HelpID = SID_DIAGRAM_DATA ; + HelpID = HID_DIAGRAM_DATA ; OutputSize = TRUE ; Hide = TRUE ; SVLook = TRUE ; diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index ec72cd6c0381..b90f9a569665 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -147,7 +147,7 @@ void DataSourceTabControl::EnableTabToggling() // ---------------------------------------- -USHORT DataSourceDialog::m_nLastPageId = 0; +sal_uInt16 DataSourceDialog::m_nLastPageId = 0; DataSourceDialog::DataSourceDialog( Window * pParent, @@ -221,7 +221,7 @@ void DataSourceDialog::setInvalidPage( TabPage * pTabPage ) if( ! (m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid )) { - m_aBtnOK.Enable( FALSE ); + m_aBtnOK.Enable( sal_False ); OSL_ASSERT( m_pTabControl ); // note: there seems to be no suitable mechanism to address pages by // identifier, at least it is unclear what the page identifiers are. @@ -243,7 +243,7 @@ void DataSourceDialog::setValidPage( TabPage * pTabPage ) if( m_bRangeChooserTabIsValid && m_bDataSourceTabIsValid ) { - m_aBtnOK.Enable( TRUE ); + m_aBtnOK.Enable( sal_True ); OSL_ASSERT( m_pTabControl ); m_pTabControl->EnableTabToggling(); } diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx index 0ca0a2abc497..7e0bc698f436 100644 --- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx @@ -64,7 +64,7 @@ InsertAxisOrGridDialogData::InsertAxisOrGridDialogData() //============================== SchAxisDlg::SchAxisDlg( Window* pWindow - , const InsertAxisOrGridDialogData& rInput, BOOL bAxisDlg ) + , const InsertAxisOrGridDialogData& rInput, sal_Bool bAxisDlg ) : ModalDialog( pWindow, SchResId( DLG_AXIS_OR_GRID )), @@ -89,7 +89,7 @@ SchAxisDlg::SchAxisDlg( Window* pWindow FreeResource(); if(!bAxisDlg) { - SetHelpId( SID_INSERT_GRIDS ); + SetHelpId( HID_INSERT_GRIDS ); SetText( ObjectNameProvider::getName(OBJECTTYPE_GRID,true) ); aCbPrimaryX.SetHelpId( HID_SCH_CB_XGRID ); diff --git a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src index 91d995b5231c..03faaa4ede45 100644 --- a/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src +++ b/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src @@ -33,7 +33,7 @@ ModalDialog DLG_AXIS_OR_GRID { - HelpID = SID_INSERT_AXIS ; + HelpID = HID_INSERT_AXIS ; OutputSize = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 160 , 113 ) ; diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src index 8f8a64485778..24ae2f63fce1 100644 --- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src +++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src @@ -32,7 +32,7 @@ ModalDialog DLG_DATA_DESCR { - HelpID = SID_INSERT_DESCRIPTION ; + HelpID = HID_INSERT_DESCRIPTION ; OutputSize = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 316 , 185 ) ; diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx index 78218e2e4ae1..d804d19e3cf8 100644 --- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx @@ -119,7 +119,7 @@ double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( pExplicitValueProvider->getExplicitValuesForAxis( xAxis,aExplicitScale, aExplicitIncrement ); fStepWidth = aExplicitIncrement.Distance; - if( aExplicitIncrement.SubIncrements.getLength() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 ) + if( !aExplicitIncrement.SubIncrements.empty() && aExplicitIncrement.SubIncrements[0].IntervalCount>0 ) fStepWidth=fStepWidth/double(aExplicitIncrement.SubIncrements[0].IntervalCount); else fStepWidth/=10; diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.src b/chart2/source/controller/dialogs/dlg_InsertErrorBars.src index f7a61cf1e283..462c81211011 100644 --- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.src +++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.src @@ -33,6 +33,7 @@ ModalDialog DLG_DATA_YERRORBAR { + HelpID = "chart2:ModalDialog:DLG_DATA_YERRORBAR"; OutputSize = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 300 , 156 ) ; diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.src b/chart2/source/controller/dialogs/dlg_InsertLegend.src index 95a1d5516ab5..1f768f7c065b 100644 --- a/chart2/source/controller/dialogs/dlg_InsertLegend.src +++ b/chart2/source/controller/dialogs/dlg_InsertLegend.src @@ -36,7 +36,7 @@ ModalDialog DLG_LEGEND { - HelpID = SID_INSERT_CHART_LEGEND ; + HelpID = HID_INSERT_CHART_LEGEND ; OutputSize = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 156 , 80 ) ; diff --git a/chart2/source/controller/dialogs/dlg_InsertTitle.src b/chart2/source/controller/dialogs/dlg_InsertTitle.src index f84ff2c6acd7..446763e93b9e 100644 --- a/chart2/source/controller/dialogs/dlg_InsertTitle.src +++ b/chart2/source/controller/dialogs/dlg_InsertTitle.src @@ -32,7 +32,7 @@ ModalDialog DLG_TITLE { - HelpID = SID_INSERT_TITLE ; + HelpID = HID_INSERT_TITLE ; OutputSize = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 220 , 156 ) ; diff --git a/chart2/source/controller/dialogs/dlg_InsertTrendline.src b/chart2/source/controller/dialogs/dlg_InsertTrendline.src index 24704f0d0c7c..3a866501ef92 100644 --- a/chart2/source/controller/dialogs/dlg_InsertTrendline.src +++ b/chart2/source/controller/dialogs/dlg_InsertTrendline.src @@ -37,7 +37,7 @@ ModalDialog DLG_DATA_TRENDLINE { - HelpID = SID_INSERT_STATISTICS ; + HelpID = HID_INSERT_STATISTICS ; OutputSize = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT( DLG_DATA_TRENDLINE_RES_WIDTH + DLG_DATA_TRENDLINE_ADD_TO_RES, 172 ); diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx index 87533fc9069c..b50398309700 100644 --- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx +++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx @@ -70,7 +70,7 @@ NumberFormatDialog::~NumberFormatDialog() SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool ) { - static const USHORT nWhichPairs[] = + static const sal_uInt16 nWhichPairs[] = { SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE, diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index a7f30165c0c2..54e0a606cd3d 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -57,9 +57,10 @@ #include "ChartTypeHelper.hxx" #include "ObjectNameProvider.hxx" #include "DiagramHelper.hxx" -#include "chartview/NumberFormatterWrapper.hxx" +#include "NumberFormatterWrapper.hxx" #include "AxisIndexDefines.hxx" #include "AxisHelper.hxx" +#include "ExplicitCategoriesProvider.hxx" #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/XChartType.hpp> @@ -117,6 +118,7 @@ ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUS , m_bIsCrossingAxisIsCategoryAxis(false) , m_aCategories() , m_xChartDocument( 0 ) + , m_bComplexCategoriesAxis( false ) { rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID ); m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS")); @@ -180,7 +182,7 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel ScaleData aData( xAxis->getScaleData() ); if( chart2::AxisType::SERIES == aData.AxisType ) m_bHasScaleProperties = false; - if( chart2::AxisType::REALNUMBER == aData.AxisType || chart2::AxisType::PERCENT == aData.AxisType ) + if( chart2::AxisType::SERIES != aData.AxisType ) m_bHasNumberProperties = true; sal_Int32 nCooSysIndex=0; @@ -207,6 +209,13 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel if( m_bIsCrossingAxisIsCategoryAxis ) m_aCategories = DiagramHelper::getExplicitSimpleCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) ); } + + m_bComplexCategoriesAxis = false; + if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY ) + { + ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel ); + m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories(); + } } } @@ -323,8 +332,12 @@ uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDoc { return m_xChartDocument; } +bool ObjectPropertiesDialogParameter::IsComplexCategoriesAxis() const +{ + return m_bComplexCategoriesAxis; +} -const USHORT nNoArrowNoShadowDlg = 1101; +const sal_uInt16 nNoArrowNoShadowDlg = 1101; //------------------------------------------------------------------- //------------------------------------------------------------------- @@ -505,7 +518,7 @@ SchAttribTabDlg::~SchAttribTabDlg() delete m_pAutoSymbolGraphic; } -void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage) +void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); switch (nId) @@ -561,6 +574,7 @@ void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage) { bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered(); ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls ); + ( dynamic_cast< SchAxisLabelTabPage& >( rPage ) ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() ); break; } @@ -604,7 +618,7 @@ void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage) break; case RID_SVXPAGE_NUMBERFORMAT: - aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO)); + aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO)); rPage.PageCreated(aSet); break; diff --git a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx index 3f188aa90bfd..5bf73b537b59 100644 --- a/chart2/source/controller/dialogs/dlg_ShapeFont.cxx +++ b/chart2/source/controller/dialogs/dlg_ShapeFont.cxx @@ -64,7 +64,7 @@ ShapeFontDialog::~ShapeFontDialog() { } -void ShapeFontDialog::PageCreated( USHORT nId, SfxTabPage& rPage ) +void ShapeFontDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) { SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) ); switch ( nId ) diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx index ee43d301255f..b53851f20779 100644 --- a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx +++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx @@ -70,7 +70,7 @@ ShapeParagraphDialog::~ShapeParagraphDialog() { } -void ShapeParagraphDialog::PageCreated( USHORT nId, SfxTabPage& rPage ) +void ShapeParagraphDialog::PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) { SfxAllItemSet aSet( *( GetInputSetImpl()->GetPool() ) ); switch ( nId ) diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index 11170fa5a466..b852d561764d 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -57,7 +57,8 @@ using namespace ::com::sun::star::chart2; //----------------------------------------------------------------------------- //------------------------------------------------------------------- //------------------------------------------------------------------- -USHORT View3DDialog::m_nLastPageId = 0; + +sal_uInt16 View3DDialog::m_nLastPageId = 0; View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable ) : TabDialog(pParent,SchResId(DLG_3D_VIEW)) diff --git a/chart2/source/controller/dialogs/dlg_View3D.src b/chart2/source/controller/dialogs/dlg_View3D.src index 0f1fb639d326..02818733b2a9 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.src +++ b/chart2/source/controller/dialogs/dlg_View3D.src @@ -28,10 +28,11 @@ #include "dlg_View3D.hrc" #include "SchSlotIds.hxx" #include "CommonResources.hrc" +#include "HelpIds.hrc" TabDialog DLG_3D_VIEW { - HelpID = SID_3D_VIEW ; + HelpID = HID_3D_VIEW ; OutputSize = TRUE ; SVLook = TRUE ; Moveable = TRUE ; diff --git a/chart2/source/controller/dialogs/hidother.src b/chart2/source/controller/dialogs/hidother.src index 4b006f0f1f93..195115e93bd1 100644 --- a/chart2/source/controller/dialogs/hidother.src +++ b/chart2/source/controller/dialogs/hidother.src @@ -25,9 +25,6 @@ * ************************************************************************/ #include "HelpIds.hrc" -#include "SchSlotIds.hxx" - -hidspecial SID_INSERT_GRIDS {HelpId= SID_INSERT_GRIDS; }; hidspecial HID_SCH_CB_XAXIS {HelpId= HID_SCH_CB_XAXIS; }; hidspecial HID_SCH_CB_YAXIS {HelpId= HID_SCH_CB_YAXIS; }; diff --git a/chart2/source/controller/dialogs/res_BarGeometry.cxx b/chart2/source/controller/dialogs/res_BarGeometry.cxx index 06b8be7a3f6e..45465066db7e 100644 --- a/chart2/source/controller/dialogs/res_BarGeometry.cxx +++ b/chart2/source/controller/dialogs/res_BarGeometry.cxx @@ -47,6 +47,8 @@ BarGeometryResources::BarGeometryResources( Window* pWindow ) { m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) ); m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() ); + m_aLB_Geometry.SetAccessibleName(m_aFT_Geometry.GetText()); + m_aLB_Geometry.SetAccessibleRelationLabeledBy(&m_aFT_Geometry); } void BarGeometryResources::SetPosPixel( const Point& rPosition ) { @@ -91,15 +93,15 @@ void BarGeometryResources::Enable( bool bEnable ) m_aLB_Geometry.Enable( bEnable ); } -USHORT BarGeometryResources::GetSelectEntryCount() const +sal_uInt16 BarGeometryResources::GetSelectEntryCount() const { return m_aLB_Geometry.GetSelectEntryCount(); } -USHORT BarGeometryResources::GetSelectEntryPos() const +sal_uInt16 BarGeometryResources::GetSelectEntryPos() const { return m_aLB_Geometry.GetSelectEntryPos(); } -void BarGeometryResources::SelectEntryPos( USHORT nPos ) +void BarGeometryResources::SelectEntryPos( sal_uInt16 nPos ) { if( nPos < m_aLB_Geometry.GetEntryCount() ) m_aLB_Geometry.SelectEntryPos( nPos ); diff --git a/chart2/source/controller/dialogs/res_BarGeometry.hxx b/chart2/source/controller/dialogs/res_BarGeometry.hxx index cdddd9cfb4ce..07d853d74dca 100644 --- a/chart2/source/controller/dialogs/res_BarGeometry.hxx +++ b/chart2/source/controller/dialogs/res_BarGeometry.hxx @@ -50,9 +50,9 @@ public: void Show( bool bShow ); void Enable( bool bEnable ); - USHORT GetSelectEntryCount() const; - USHORT GetSelectEntryPos() const; - void SelectEntryPos( USHORT nPos ); + sal_uInt16 GetSelectEntryCount() const; + sal_uInt16 GetSelectEntryPos() const; + void SelectEntryPos( sal_uInt16 nPos ); void SetSelectHdl( const Link& rLink ); diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 27f54002c1d4..e7d3ed750f54 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -66,11 +66,11 @@ namespace chart namespace { -bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich, USHORT nSourceFormatWhich, ULONG& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut ) +bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, sal_uInt16 nValueWhich, sal_uInt16 nSourceFormatWhich, sal_uLong& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut ) { bool bSet = false; const SfxPoolItem *pItem1 = NULL; - if( rSet.GetItemState( nValueWhich, TRUE, &pItem1 ) == SFX_ITEM_SET ) + if( rSet.GetItemState( nValueWhich, sal_True, &pItem1 ) == SFX_ITEM_SET ) { const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 ); if( pNumItem ) @@ -82,7 +82,7 @@ bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich rbSourceFormatMixedStateOut=true; const SfxPoolItem *pItem2 = NULL; - if( rSet.GetItemState( nSourceFormatWhich, TRUE, &pItem2 ) == SFX_ITEM_SET ) + if( rSet.GetItemState( nSourceFormatWhich, sal_True, &pItem2 ) == SFX_ITEM_SET ) { const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 ); if( pBoolItem ) @@ -94,16 +94,16 @@ bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, USHORT nValueWhich return bSet; } -void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, USHORT nWhichId, CheckBox& rCheckbox ) +void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, sal_uInt16 nWhichId, CheckBox& rCheckbox ) { - rCheckbox.EnableTriState( FALSE ); + rCheckbox.EnableTriState( sal_False ); const SfxPoolItem *pPoolItem = NULL; - if( rInAttrs.GetItemState(nWhichId, TRUE, &pPoolItem) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState(nWhichId, sal_True, &pPoolItem) == SFX_ITEM_SET ) rCheckbox.Check( ((const SfxBoolItem*)pPoolItem)->GetValue() ); else { - rCheckbox.EnableTriState( TRUE ); + rCheckbox.EnableTriState( sal_True ); rCheckbox.SetState( STATE_DONTKNOW ); } } @@ -141,17 +141,17 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt //fill label placement list std::map< sal_Int32, XubString > aPlacementToStringMap; for( sal_Int32 nEnum=0; nEnum<m_aLB_LabelPlacement.GetEntryCount(); ++nEnum ) - aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<USHORT>(nEnum)); + aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<sal_uInt16>(nEnum)); ::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList; const SfxPoolItem *pPoolItem = NULL; - if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, TRUE, &pPoolItem) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, sal_True, &pPoolItem) == SFX_ITEM_SET ) aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence(); m_aLB_LabelPlacement.Clear(); for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN ) { - USHORT nListBoxPos = static_cast<USHORT>( nN ); + sal_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN ); sal_Int32 nPlacement = aAvailabelPlacementList[nN]; m_aPlacementToListBoxMap[nPlacement]=nListBoxPos; m_aListBoxToPlacementMap[nListBoxPos]=nPlacement; @@ -213,7 +213,7 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); - if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, TRUE, &pPoolItem) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, sal_True, &pPoolItem) == SFX_ITEM_SET ) { bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() ); if( bForbidPercentValue ) @@ -246,11 +246,11 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) m_aCBPercent.Check(); SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool ); - aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO)); + aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO)); bool bPercent = ( pButton == &m_aPB_NumberFormatForPercent ); - ULONG& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue; + sal_uLong& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue; bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue; bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState; bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState; @@ -268,7 +268,7 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) if( pResult ) { bool bOldSource = rUseSourceFormat; - ULONG nOldFormat = rnFormatKey; + sal_uLong nOldFormat = rnFormatKey; bool bOldMixedState = rbMixedState || rbSourceMixedState; rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState ); @@ -284,7 +284,7 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox ) { if( pBox ) - pBox->EnableTriState( FALSE ); + pBox->EnableTriState( sal_False ); EnableControls(); return 0; } @@ -321,7 +321,7 @@ void DataLabelResources::EnableControls() m_aNF_Degrees.Enable( bEnableRotation ); } -BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const +sal_Bool DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const { if( m_aCBNumber.IsChecked() ) { @@ -348,7 +348,7 @@ BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol.IsChecked()) ); rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, m_aSeparatorResources.GetValue() ) ); - ::std::map< USHORT, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) ); + ::std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) ); if(aIt!=m_aListBoxToPlacementMap.end()) { sal_Int32 nValue = aIt->second; @@ -364,13 +364,13 @@ BOOL DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) ); } - return TRUE; + return sal_True; } void DataLabelResources::Reset(const SfxItemSet& rInAttrs) { // default state - m_aCBSymbol.Enable( FALSE ); + m_aCBSymbol.Enable( sal_False ); lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber ); lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent ); @@ -381,18 +381,18 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); const SfxPoolItem *pPoolItem = NULL; - if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, TRUE, &pPoolItem) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, sal_True, &pPoolItem) == SFX_ITEM_SET ) m_aSeparatorResources.SetValue( ((const SfxStringItem*)pPoolItem)->GetValue() ); else m_aSeparatorResources.SetDefault(); - if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, TRUE, &pPoolItem) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, sal_True, &pPoolItem) == SFX_ITEM_SET ) { sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue(); - ::std::map< sal_Int32, USHORT >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) ); + ::std::map< sal_Int32, sal_uInt16 >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) ); if(aIt!=m_aPlacementToListBoxMap.end()) { - USHORT nPos = aIt->second; + sal_uInt16 nPos = aIt->second; m_aLB_LabelPlacement.SelectEntryPos( nPos ); } else @@ -401,10 +401,10 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) else m_aLB_LabelPlacement.SetNoSelection(); - if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET ) m_aLB_TextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) ); - if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_True, &pPoolItem ) == SFX_ITEM_SET ) { sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); m_aDC_Dial.SetRotation( nDegrees ); diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx index 525d52b8da3b..f8b56fb9e855 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.hxx +++ b/chart2/source/controller/dialogs/res_DataLabel.hxx @@ -50,7 +50,7 @@ public: DataLabelResources( Window* pParent, const SfxItemSet& rInAttrs ); virtual ~DataLabelResources(); - BOOL FillItemSet(SfxItemSet& rOutAttrs) const; + sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const; void Reset(const SfxItemSet& rInAttrs); void SetNumberFormatter( SvNumberFormatter* pFormatter ); @@ -76,14 +76,14 @@ private: FixedText m_aFT_TextDirection; TextDirectionListBox m_aLB_TextDirection; - ::std::map< sal_Int32, USHORT > m_aPlacementToListBoxMap; - ::std::map< USHORT, sal_Int32 > m_aListBoxToPlacementMap; + ::std::map< sal_Int32, sal_uInt16 > m_aPlacementToListBoxMap; + ::std::map< sal_uInt16, sal_Int32 > m_aListBoxToPlacementMap; SvNumberFormatter* m_pNumberFormatter; bool m_bNumberFormatMixedState; bool m_bPercentFormatMixedState; - ULONG m_nNumberFormatForValue; - ULONG m_nNumberFormatForPercent; + sal_uLong m_nNumberFormatForValue; + sal_uLong m_nNumberFormatForPercent; bool m_bSourceFormatMixedState; bool m_bPercentSourceMixedState; diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index da60335824c2..f4e76f28edd9 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -51,8 +51,8 @@ void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog ) { if( pDialog ) { - pDialog->Show( bEnable ? FALSE : TRUE ); - pDialog->SetModalInputMode( bEnable ? FALSE : TRUE ); + pDialog->Show( bEnable ? sal_False : sal_True ); + pDialog->SetModalInputMode( bEnable ? sal_False : sal_True ); } } @@ -158,7 +158,7 @@ ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog, m_aRbRange.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); m_aLbFunction.SetSelectHdl( LINK( this, ErrorBarResources, CategoryChosen )); - m_aCbSyncPosNeg.Check( FALSE ); + m_aCbSyncPosNeg.Check( sal_False ); m_aCbSyncPosNeg.SetToggleHdl( LINK( this, ErrorBarResources, SynchronizePosAndNeg )); m_aMfPositive.SetModifyHdl( LINK( this, ErrorBarResources, PosValueChanged )); @@ -470,12 +470,12 @@ IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton ) if( pButton == &m_aIbRangePositive ) { m_pCurrentRangeChoosingField = &m_aEdRangePositive; - aUIString = ::rtl::OUString( String( SchResId( STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS ))); + aUIString = String( SchResId( STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS )); } else { m_pCurrentRangeChoosingField = &m_aEdRangeNegative; - aUIString = ::rtl::OUString( String( SchResId( STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS ))); + aUIString = String( SchResId( STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS )); } OSL_ASSERT( m_pParentDialog ); @@ -516,7 +516,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) // category m_eErrorKind = CHERROR_NONE; - aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, sal_True, &pPoolItem ); m_bErrorKindUnique = ( aState != SFX_ITEM_DONTCARE ); if( aState == SFX_ITEM_SET ) @@ -550,14 +550,14 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) } else { - m_aRbNone.Check( FALSE ); - m_aRbConst.Check( FALSE ); - m_aRbPercent.Check( FALSE ); - m_aRbFunction.Check( FALSE ); + m_aRbNone.Check( sal_False ); + m_aRbConst.Check( sal_False ); + m_aRbPercent.Check( sal_False ); + m_aRbFunction.Check( sal_False ); } // parameters - aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, sal_True, &pPoolItem ); m_bPlusUnique = ( aState != SFX_ITEM_DONTCARE ); double fPlusValue = 0.0; if( aState == SFX_ITEM_SET ) @@ -567,7 +567,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) m_aMfPositive.SetValue( nPlusValue ); } - aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, sal_True, &pPoolItem ); m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE ); if( aState == SFX_ITEM_SET ) { @@ -581,7 +581,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) } // indicator - aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, sal_True, &pPoolItem ); m_bIndicatorUnique = ( aState != SFX_ITEM_DONTCARE ); if( aState == SFX_ITEM_SET) m_eIndicate = ((const SvxChartIndicateItem * ) pPoolItem)->GetValue(); @@ -604,13 +604,13 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) } else { - m_aRbBoth.Check( FALSE ); - m_aRbPositive.Check( FALSE ); - m_aRbNegative.Check( FALSE ); + m_aRbBoth.Check( sal_False ); + m_aRbPositive.Check( sal_False ); + m_aRbNegative.Check( sal_False ); } // ranges - aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, sal_True, &pPoolItem ); m_bRangePosUnique = ( aState != SFX_ITEM_DONTCARE ); if( aState == SFX_ITEM_SET ) { @@ -618,7 +618,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) m_aEdRangePositive.SetText( sRangePositive ); } - aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, sal_True, &pPoolItem ); m_bRangeNegUnique = ( aState != SFX_ITEM_DONTCARE ); if( aState == SFX_ITEM_SET ) { @@ -633,7 +633,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) UpdateControlStates(); } -BOOL ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const +sal_Bool ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const { if( m_bErrorKindUnique ) rOutAttrs.Put( SvxChartKindErrorItem( m_eErrorKind, SCHATTR_STAT_KIND_ERROR )); @@ -686,7 +686,7 @@ BOOL ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const } } - return TRUE; + return sal_True; } void ErrorBarResources::FillValueSets() diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx index 33f02c442f1b..6d99a2fbea3c 100644 --- a/chart2/source/controller/dialogs/res_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx @@ -40,13 +40,12 @@ #include <svtools/controldims.hrc> #include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> //itemset stuff #include "chartview/ChartSfxItemIds.hxx" -#include <svx/chrtitem.hxx> -// header for class SfxItemPool -#include <svl/itempool.hxx> +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> //............................................................................. namespace chart @@ -60,8 +59,8 @@ LegendPositionResources::LegendPositionResources( Window* pWindow ) : m_xCC() //unused in this scenario , m_aCbxShow( pWindow ) //unused in this scenario , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) ) - , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) ) + , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) ) { m_aCbxShow.Check();//legend is assumed to be visible in this scenario @@ -72,12 +71,17 @@ LegendPositionResources::LegendPositionResources( Window* pWindow, const uno::Re : m_xCC( xCC ) , m_aCbxShow( pWindow, SchResId(CBX_SHOWLEGEND) ) , m_aRbtLeft( pWindow, SchResId(RBT_LEFT) ) - , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtRight( pWindow, SchResId(RBT_RIGHT) ) + , m_aRbtTop( pWindow, SchResId(RBT_TOP) ) , m_aRbtBottom( pWindow, SchResId(RBT_BOTTOM) ) { m_aCbxShow.SetToggleHdl( LINK( this, LegendPositionResources, PositionEnableHdl ) ); impl_setRadioButtonToggleHdl(); + m_aCbxShow.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtLeft.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtRight.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtTop.SetAccessibleRelationMemberOf(&m_aCbxShow); + m_aRbtBottom.SetAccessibleRelationMemberOf(&m_aCbxShow); } void LegendPositionResources::impl_setRadioButtonToggleHdl() @@ -150,7 +154,7 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen //position chart2::LegendPosition eNewPos; - chart2::LegendExpansion eExp = chart2::LegendExpansion_HIGH; + ::com::sun::star::chart::ChartLegendExpansion eExp = ::com::sun::star::chart::ChartLegendExpansion_HIGH; if( m_aRbtLeft.IsChecked() ) eNewPos = chart2::LegendPosition_LINE_START; @@ -161,12 +165,12 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen else if( m_aRbtTop.IsChecked() ) { eNewPos = chart2::LegendPosition_PAGE_START; - eExp = chart2::LegendExpansion_WIDE; + eExp = ::com::sun::star::chart::ChartLegendExpansion_WIDE; } else if( m_aRbtBottom.IsChecked() ) { eNewPos = chart2::LegendPosition_PAGE_END; - eExp = chart2::LegendExpansion_WIDE; + eExp = ::com::sun::star::chart::ChartLegendExpansion_WIDE; } xProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( eNewPos )); @@ -182,7 +186,7 @@ void LegendPositionResources::writeToModel( const ::com::sun::star::uno::Referen IMPL_LINK( LegendPositionResources, PositionEnableHdl, void*, EMPTYARG ) { - BOOL bEnable = m_aCbxShow.IsChecked(); + sal_Bool bEnable = m_aCbxShow.IsChecked(); m_aRbtLeft.Enable( bEnable ); m_aRbtTop.Enable( bEnable ); @@ -196,51 +200,50 @@ IMPL_LINK( LegendPositionResources, PositionEnableHdl, void*, EMPTYARG ) void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs ) { - SvxChartLegendPos ePos = CHLEGEND_NONE; - const SfxPoolItem* pPoolItem = NULL; - if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, - TRUE, &pPoolItem ) != SFX_ITEM_SET ) - pPoolItem = &(rInAttrs.GetPool()->GetDefaultItem( SCHATTR_LEGEND_POS )); - - if( pPoolItem ) - ePos = ((const SvxChartLegendPosItem*)pPoolItem)->GetValue(); + if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, sal_True, &pPoolItem ) == SFX_ITEM_SET ) + { + sal_Int32 nLegendPosition = ((const SfxInt32Item*)pPoolItem)->GetValue(); + switch( nLegendPosition ) + { + case chart2::LegendPosition_LINE_START: + m_aRbtLeft.Check(sal_True); + break; + case chart2::LegendPosition_PAGE_START: + m_aRbtTop.Check(sal_True); + break; + case chart2::LegendPosition_LINE_END: + m_aRbtRight.Check(sal_True); + break; + case chart2::LegendPosition_PAGE_END: + m_aRbtBottom.Check(sal_True); + break; + default: + break; + } + } - switch( ePos ) + if( rInAttrs.GetItemState( SCHATTR_LEGEND_SHOW, sal_True, &pPoolItem ) == SFX_ITEM_SET ) { - case CHLEGEND_LEFT: - m_aRbtLeft.Check(TRUE); - break; - case CHLEGEND_TOP: - m_aRbtTop.Check(TRUE); - break; - case CHLEGEND_RIGHT: - m_aRbtRight.Check(TRUE); - break; - case CHLEGEND_BOTTOM: - m_aRbtBottom.Check(TRUE); - break; - default: - break; + bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); + m_aCbxShow.Check(bShow); } } void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const { - SvxChartLegendPos ePos; - + sal_Int32 nLegendPosition = chart2::LegendPosition_CUSTOM; if( m_aRbtLeft.IsChecked() ) - ePos = CHLEGEND_LEFT; + nLegendPosition = chart2::LegendPosition_LINE_START; else if( m_aRbtTop.IsChecked() ) - ePos = CHLEGEND_TOP; + nLegendPosition = chart2::LegendPosition_PAGE_START; else if( m_aRbtRight.IsChecked() ) - ePos = CHLEGEND_RIGHT; + nLegendPosition = chart2::LegendPosition_LINE_END; else if( m_aRbtBottom.IsChecked() ) - ePos = CHLEGEND_BOTTOM; - else - ePos = CHLEGEND_NONE; + nLegendPosition = chart2::LegendPosition_PAGE_END; + rOutAttrs.Put(SfxInt32Item(SCHATTR_LEGEND_POS, nLegendPosition )); - rOutAttrs.Put(SvxChartLegendPosItem( ePos, SCHATTR_LEGEND_POS )); + rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, m_aCbxShow.IsChecked()) ); } IMPL_LINK( LegendPositionResources, PositionChangeHdl, RadioButton*, pRadio ) @@ -258,6 +261,14 @@ void LegendPositionResources::SetChangeHdl( const Link& rLink ) m_aChangeLink = rLink; } +void LegendPositionResources::SetAccessibleRelationMemberOf(Window* pMemberOf) +{ + m_aRbtLeft.SetAccessibleRelationMemberOf(pMemberOf); + m_aRbtRight.SetAccessibleRelationMemberOf(pMemberOf); + m_aRbtTop.SetAccessibleRelationMemberOf(pMemberOf); + m_aRbtBottom.SetAccessibleRelationMemberOf(pMemberOf); +} + //............................................................................. } //namespace chart //............................................................................. diff --git a/chart2/source/controller/dialogs/res_LegendPosition.hxx b/chart2/source/controller/dialogs/res_LegendPosition.hxx index 0fc13b3b068b..bee192ff8b03 100644 --- a/chart2/source/controller/dialogs/res_LegendPosition.hxx +++ b/chart2/source/controller/dialogs/res_LegendPosition.hxx @@ -43,6 +43,7 @@ namespace chart class LegendPositionResources { + public: //constructor without Display checkbox LegendPositionResources( Window* pParent ); @@ -65,6 +66,8 @@ public: DECL_LINK( PositionEnableHdl, void* ); DECL_LINK( PositionChangeHdl, RadioButton* ); + void SetAccessibleRelationMemberOf(Window* pMemberOf); //IAccessibility2 Implementation 2009----- + private: void impl_setRadioButtonToggleHdl(); @@ -75,8 +78,8 @@ private: CheckBox m_aCbxShow; RadioButton m_aRbtLeft; - RadioButton m_aRbtTop; RadioButton m_aRbtRight; + RadioButton m_aRbtTop; RadioButton m_aRbtBottom; Link m_aChangeLink; diff --git a/chart2/source/controller/dialogs/res_TextSeparator.cxx b/chart2/source/controller/dialogs/res_TextSeparator.cxx index cef13277d9cf..7bf1cc0c8221 100644 --- a/chart2/source/controller/dialogs/res_TextSeparator.cxx +++ b/chart2/source/controller/dialogs/res_TextSeparator.cxx @@ -58,6 +58,9 @@ TextSeparatorResources::TextSeparatorResources( Window* pWindow ) m_aEntryMap[ C2U( ", " ) ] = 1; m_aEntryMap[ C2U( "; " ) ] = 2; m_aEntryMap[ C2U( "\n" ) ] = 3; + + m_aLB_Separator.SetAccessibleName(m_aFT_Separator.GetText()); + m_aLB_Separator.SetAccessibleRelationLabeledBy(&m_aFT_Separator); } TextSeparatorResources::~TextSeparatorResources() { @@ -123,7 +126,7 @@ Size TextSeparatorResources::GetCurrentListBoxSize() const void TextSeparatorResources::SetValue( const rtl::OUString& rSeparator ) { - ::std::map< ::rtl::OUString, USHORT >::iterator aIter( m_aEntryMap.find(rSeparator) ); + ::std::map< ::rtl::OUString, sal_uInt16 >::iterator aIter( m_aEntryMap.find(rSeparator) ); if( aIter == m_aEntryMap.end() ) m_aLB_Separator.SelectEntryPos( m_nDefaultPos ); else @@ -137,8 +140,8 @@ void TextSeparatorResources::SetDefault() rtl::OUString TextSeparatorResources::GetValue() const { - USHORT nPos = m_aLB_Separator.GetSelectEntryPos(); - ::std::map< ::rtl::OUString, USHORT >::const_iterator aIter( m_aEntryMap.begin() ); + sal_uInt16 nPos = m_aLB_Separator.GetSelectEntryPos(); + ::std::map< ::rtl::OUString, sal_uInt16 >::const_iterator aIter( m_aEntryMap.begin() ); while( aIter != m_aEntryMap.end() ) { if(aIter->second==nPos ) diff --git a/chart2/source/controller/dialogs/res_TextSeparator.hxx b/chart2/source/controller/dialogs/res_TextSeparator.hxx index b2701bf0aaec..9113c6bdcfa5 100644 --- a/chart2/source/controller/dialogs/res_TextSeparator.hxx +++ b/chart2/source/controller/dialogs/res_TextSeparator.hxx @@ -64,9 +64,9 @@ private: FixedText m_aFT_Separator; ListBox m_aLB_Separator; - ::std::map< ::rtl::OUString, USHORT > m_aEntryMap; + ::std::map< ::rtl::OUString, sal_uInt16 > m_aEntryMap; - const USHORT m_nDefaultPos; + const sal_uInt16 m_nDefaultPos; }; //............................................................................. diff --git a/chart2/source/controller/dialogs/res_Titles.cxx b/chart2/source/controller/dialogs/res_Titles.cxx index 2b164216c28a..b24dc911ab94 100644 --- a/chart2/source/controller/dialogs/res_Titles.cxx +++ b/chart2/source/controller/dialogs/res_Titles.cxx @@ -127,7 +127,7 @@ TitleResources::~TitleResources() void TitleResources::SetUpdateDataHdl( const Link& rLink ) { - ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT; + sal_uLong nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT; m_aEd_Main.EnableUpdateData( nTimeout ); m_aEd_Main.SetUpdateDataHdl( rLink ); diff --git a/chart2/source/controller/dialogs/res_Trendline.cxx b/chart2/source/controller/dialogs/res_Trendline.cxx index dadfd998940a..dcd376530a90 100644 --- a/chart2/source/controller/dialogs/res_Trendline.cxx +++ b/chart2/source/controller/dialogs/res_Trendline.cxx @@ -184,7 +184,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs ) const SfxPoolItem *pPoolItem = NULL; SfxItemState aState = SFX_ITEM_UNKNOWN; - aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_TYPE, sal_True, &pPoolItem ); m_bTrendLineUnique = ( aState != SFX_ITEM_DONTCARE ); if( aState == SFX_ITEM_SET ) { @@ -193,28 +193,28 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs ) m_eTrendLineType = pItem->GetValue(); } - aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_EQUATION, sal_True, &pPoolItem ); if( aState == SFX_ITEM_DONTCARE ) { - m_aCBShowEquation.EnableTriState( TRUE ); + m_aCBShowEquation.EnableTriState( sal_True ); m_aCBShowEquation.SetState( STATE_DONTKNOW ); } else { - m_aCBShowEquation.EnableTriState( FALSE ); + m_aCBShowEquation.EnableTriState( sal_False ); if( aState == SFX_ITEM_SET ) m_aCBShowEquation.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue()); } - aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, TRUE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_REGRESSION_SHOW_COEFF, sal_True, &pPoolItem ); if( aState == SFX_ITEM_DONTCARE ) { - m_aCBShowCorrelationCoeff.EnableTriState( TRUE ); + m_aCBShowCorrelationCoeff.EnableTriState( sal_True ); m_aCBShowCorrelationCoeff.SetState( STATE_DONTKNOW ); } else { - m_aCBShowCorrelationCoeff.EnableTriState( FALSE ); + m_aCBShowCorrelationCoeff.EnableTriState( sal_False ); if( aState == SFX_ITEM_SET ) m_aCBShowCorrelationCoeff.Check( static_cast< const SfxBoolItem * >( pPoolItem )->GetValue()); } @@ -243,7 +243,7 @@ void TrendlineResources::Reset( const SfxItemSet& rInAttrs ) } } -BOOL TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const +sal_Bool TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const { if( m_bTrendLineUnique ) rOutAttrs.Put( SvxChartRegressItem( m_eTrendLineType, SCHATTR_REGRESSION_TYPE )); @@ -251,7 +251,7 @@ BOOL TrendlineResources::FillItemSet(SfxItemSet& rOutAttrs) const rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SHOW_EQUATION, m_aCBShowEquation.IsChecked() )); if( m_aCBShowCorrelationCoeff.GetState() != STATE_DONTKNOW ) rOutAttrs.Put( SfxBoolItem( SCHATTR_REGRESSION_SHOW_COEFF, m_aCBShowCorrelationCoeff.IsChecked() )); - return TRUE; + return sal_True; } void TrendlineResources::FillValueSets() diff --git a/chart2/source/controller/dialogs/res_Trendline.hxx b/chart2/source/controller/dialogs/res_Trendline.hxx index 45a054e4ae57..6e290f850328 100644 --- a/chart2/source/controller/dialogs/res_Trendline.hxx +++ b/chart2/source/controller/dialogs/res_Trendline.hxx @@ -45,7 +45,7 @@ public: virtual ~TrendlineResources(); void Reset(const SfxItemSet& rInAttrs); - BOOL FillItemSet(SfxItemSet& rOutAttrs) const; + sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const; void FillValueSets(); diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx index 74ee184fc892..15006901c577 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx @@ -111,9 +111,9 @@ ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage( , m_aFT_Scheme ( this, SchResId( FT_SCHEME ) ) , m_aLB_Scheme ( this, SchResId( LB_SCHEME ) ) , m_aFL_Seperator ( this, SchResId( FL_SEPERATOR ) ) - , m_aCB_RoundedEdge ( this, SchResId( CB_ROUNDEDEDGE ) ) , m_aCB_Shading ( this, SchResId( CB_SHADING ) ) , m_aCB_ObjectLines ( this, SchResId( CB_OBJECTLINES ) ) + , m_aCB_RoundedEdge ( this, SchResId( CB_ROUNDEDEDGE ) ) , m_bUpdateOtherControls( true ) , m_bCommitToModel( true ) , m_rControllerLockHelper( rControllerLockHelper ) @@ -129,9 +129,9 @@ ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage( m_aCB_Shading.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectShading ) ); m_aCB_ObjectLines.SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) ); - m_aCB_RoundedEdge.EnableTriState( TRUE ); - m_aCB_Shading.EnableTriState( TRUE ); - m_aCB_ObjectLines.EnableTriState( TRUE ); + m_aCB_RoundedEdge.EnableTriState( sal_True ); + m_aCB_Shading.EnableTriState( sal_True ); + m_aCB_ObjectLines.EnableTriState( sal_True ); initControlsFromModel(); } @@ -220,50 +220,50 @@ void ThreeD_SceneAppearance_TabPage::initControlsFromModel() if(aProps.m_aShadeMode == drawing::ShadeMode_FLAT) { - m_aCB_Shading.EnableTriState( FALSE ); - m_aCB_Shading.Check(FALSE); + m_aCB_Shading.EnableTriState( sal_False ); + m_aCB_Shading.Check(sal_False); } else if(aProps.m_aShadeMode == drawing::ShadeMode_SMOOTH) { - m_aCB_Shading.EnableTriState( FALSE ); - m_aCB_Shading.Check(TRUE); + m_aCB_Shading.EnableTriState( sal_False ); + m_aCB_Shading.Check(sal_True); } else { - m_aCB_Shading.EnableTriState( TRUE ); + m_aCB_Shading.EnableTriState( sal_True ); m_aCB_Shading.SetState( STATE_DONTKNOW ); } if(aProps.m_nObjectLines == 0) { - m_aCB_ObjectLines.EnableTriState( FALSE ); - m_aCB_ObjectLines.Check(FALSE); + m_aCB_ObjectLines.EnableTriState( sal_False ); + m_aCB_ObjectLines.Check(sal_False); } else if(aProps.m_nObjectLines==1) { - m_aCB_ObjectLines.EnableTriState( FALSE ); - m_aCB_ObjectLines.Check(TRUE); + m_aCB_ObjectLines.EnableTriState( sal_False ); + m_aCB_ObjectLines.Check(sal_True); } else { - m_aCB_ObjectLines.EnableTriState( TRUE ); + m_aCB_ObjectLines.EnableTriState( sal_True ); m_aCB_ObjectLines.SetState( STATE_DONTKNOW ); } if(aProps.m_nRoundedEdges >= 5) { - m_aCB_RoundedEdge.EnableTriState( FALSE ); - m_aCB_RoundedEdge.Check(TRUE); + m_aCB_RoundedEdge.EnableTriState( sal_False ); + m_aCB_RoundedEdge.Check(sal_True); } else if(aProps.m_nRoundedEdges<0) { - m_aCB_RoundedEdge.EnableTriState( FALSE ); + m_aCB_RoundedEdge.EnableTriState( sal_False ); m_aCB_RoundedEdge.SetState( STATE_DONTKNOW ); } else { - m_aCB_RoundedEdge.EnableTriState( TRUE ); - m_aCB_RoundedEdge.Check(FALSE); + m_aCB_RoundedEdge.EnableTriState( sal_True ); + m_aCB_RoundedEdge.Check(sal_False); } m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() ); @@ -331,7 +331,7 @@ IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectShading, void*, EMPTYARG ) if( !m_bUpdateOtherControls ) return 0; - m_aCB_Shading.EnableTriState( FALSE ); + m_aCB_Shading.EnableTriState( sal_False ); applyShadeModeToModel(); updateScheme(); return 0; @@ -343,15 +343,15 @@ IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, Check if( pCheckBox == &m_aCB_ObjectLines ) { - m_aCB_ObjectLines.EnableTriState( FALSE ); + m_aCB_ObjectLines.EnableTriState( sal_False ); m_bUpdateOtherControls = false; m_aCB_RoundedEdge.Enable( !m_aCB_ObjectLines.IsChecked() ); if(!m_aCB_RoundedEdge.IsEnabled()) - m_aCB_RoundedEdge.Check(FALSE); + m_aCB_RoundedEdge.Check(sal_False); m_bUpdateOtherControls = true; } else - m_aCB_RoundedEdge.EnableTriState( FALSE ); + m_aCB_RoundedEdge.EnableTriState( sal_False ); applyRoundedEdgeAndObjectLinesToModel(); updateScheme(); return 0; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx index db7d91e59766..7ec53947dd52 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx @@ -81,9 +81,9 @@ private: FixedLine m_aFL_Seperator; - CheckBox m_aCB_RoundedEdge; CheckBox m_aCB_Shading; CheckBox m_aCB_ObjectLines; + CheckBox m_aCB_RoundedEdge; bool m_bUpdateOtherControls; bool m_bCommitToModel; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src index e9b4887da21a..5f193db7e252 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src +++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.src @@ -51,6 +51,7 @@ TabPage TP_3D_SCENEAPPEARANCE { + HelpID = "chart2:TabPage:TP_3D_SCENEAPPEARANCE"; OutputSize = TRUE ; SVLook = TRUE ; Hide = TRUE ; @@ -64,6 +65,7 @@ TabPage TP_3D_SCENEAPPEARANCE }; ListBox LB_SCHEME { + HelpID = "chart2:ListBox:TP_3D_SCENEAPPEARANCE:LB_SCHEME"; Border = TRUE; TabStop = TRUE; DropDown = TRUE; @@ -78,12 +80,14 @@ TabPage TP_3D_SCENEAPPEARANCE CheckBox CB_SHADING { + HelpID = "chart2:CheckBox:TP_3D_SCENEAPPEARANCE:CB_SHADING"; Pos = MAP_APPFONT ( POS_X_1 , POS_Y_SHADING ) ; Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ; Text [ en-US ] = "~Shading" ; }; CheckBox CB_OBJECTLINES { + HelpID = "chart2:CheckBox:TP_3D_SCENEAPPEARANCE:CB_OBJECTLINES"; Pos = MAP_APPFONT ( POS_X_1 , POS_Y_OBJECTLINES ) ; Size = MAP_APPFONT ( WIDTH_FL , HEIGHT_LB ) ; Text [ en-US ] = "~Object borders" ; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx index b280f0476357..536ecce1eeca 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx @@ -116,7 +116,7 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( Window* pWindow m_aMFYRotation.SetValue(m_nYRotation); m_aMFZRotation.SetValue(m_nZRotation); - const ULONG nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT; + const sal_uLong nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT; Link aAngleChangedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleChanged )); Link aAngleEditedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleEdited )); @@ -162,6 +162,8 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( Window* pWindow { m_aCbxRightAngledAxes.Enable(false); } + m_aMFPerspective.SetAccessibleName(m_aCbxPerspective.GetText()); + m_aMFPerspective.SetAccessibleRelationLabeledBy(&m_aCbxPerspective); } ThreeD_SceneGeometry_TabPage::~ThreeD_SceneGeometry_TabPage() diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src index 85b306523960..ac277d34c4f9 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.src @@ -28,6 +28,7 @@ #include "tp_3D_SceneGeometry.hrc" #include "dlg_View3D.hrc" #include "SchSlotIds.hxx" +#include "HelpIds.hrc" #ifndef _SVT_CONTROLDIMS_HRC_ #include <svtools/controldims.hrc> @@ -68,7 +69,7 @@ CustomUnitText [ en-US ] = " degrees" ; TabPage TP_3D_SCENEGEOMETRY { - HelpID = SID_3D_VIEW ; + HelpID = HID_3D_VIEW ; OutputSize = TRUE ; SVLook = TRUE ; Hide = TRUE ; @@ -76,6 +77,7 @@ TabPage TP_3D_SCENEGEOMETRY CheckBox CBX_RIGHT_ANGLED_AXES { + HelpID = "chart2:CheckBox:TP_3D_SCENEGEOMETRY:CBX_RIGHT_ANGLED_AXES"; Pos = MAP_APPFONT ( POS_X_1 , POS_Y_0 ) ; Size = MAP_APPFONT ( (WIDTH_FT+WIDTH_MF) , HEIGHT_FT ) ; TabStop = TRUE ; @@ -101,18 +103,21 @@ TabPage TP_3D_SCENEGEOMETRY }; MetricField MTR_FLD_X_ROTATION { + HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_X_ROTATION"; Pos = MAP_APPFONT ( POS_X_2 , POS_Y_1-2 ) ; Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ; CUSTOMUNITTEXT_DEGREE }; MetricField MTR_FLD_Y_ROTATION { + HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_Y_ROTATION"; Pos = MAP_APPFONT ( POS_X_2 , POS_Y_2-2 ) ; Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ; CUSTOMUNITTEXT_DEGREE }; MetricField MTR_FLD_Z_ROTATION { + HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_Z_ROTATION"; Pos = MAP_APPFONT ( POS_X_2 , POS_Y_3-2 ) ; Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ; CUSTOMUNITTEXT_DEGREE @@ -120,6 +125,7 @@ TabPage TP_3D_SCENEGEOMETRY CheckBox CBX_PERSPECTIVE { + HelpID = "chart2:CheckBox:TP_3D_SCENEGEOMETRY:CBX_PERSPECTIVE"; Pos = MAP_APPFONT ( POS_X_1 , POS_Y_4 ) ; Size = MAP_APPFONT ( WIDTH_FT , HEIGHT_FT ) ; TabStop = TRUE ; @@ -127,6 +133,7 @@ TabPage TP_3D_SCENEGEOMETRY }; MetricField MTR_FLD_PERSPECTIVE { + HelpID = "chart2:MetricField:TP_3D_SCENEGEOMETRY:MTR_FLD_PERSPECTIVE"; Pos = MAP_APPFONT ( POS_X_2 , POS_Y_4-2 ) ; Size = MAP_APPFONT ( WIDTH_MF , HEIGHT_MF ) ; Border = TRUE ; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index 47f9e15c1ef6..e6548b58d112 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -163,13 +163,13 @@ namespace rtl::OUString lcl_makeColorName( Color rColor ) { String aStr(SVX_RES(RID_SVXFLOAT3D_FIX_R)); - aStr += String::CreateFromInt32((INT32)rColor.GetRed()); + aStr += String::CreateFromInt32((sal_Int32)rColor.GetRed()); aStr += sal_Unicode(' '); aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_G)); - aStr += String::CreateFromInt32((INT32)rColor.GetGreen()); + aStr += String::CreateFromInt32((sal_Int32)rColor.GetGreen()); aStr += sal_Unicode(' '); aStr += String(SVX_RES(RID_SVXFLOAT3D_FIX_B)); - aStr += String::CreateFromInt32((INT32)rColor.GetBlue()); + aStr += String::CreateFromInt32((sal_Int32)rColor.GetBlue()); return aStr; } void lcl_selectColor( ColorListBox& rListBox, const Color& rColor ) @@ -178,7 +178,7 @@ namespace rListBox.SelectEntry( rColor ); if( rListBox.GetSelectEntryCount() == 0 ) { - USHORT nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) ); + sal_uInt16 nPos = rListBox.InsertEntry( rColor, lcl_makeColorName( rColor ) ); rListBox.SelectEntryPos( nPos ); } } @@ -354,6 +354,15 @@ ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( Window* pWin ClickLightSourceButtonHdl(&m_aBtn_Light2); m_aModelChangeListener.startListening( uno::Reference< util::XModifyBroadcaster >(m_xSceneProperties, uno::UNO_QUERY) ); + m_aBtn_Light1.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aBtn_Light2.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aBtn_Light3.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aBtn_Light4.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aBtn_Light5.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aBtn_Light6.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aBtn_Light7.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aBtn_Light8.SetAccessibleRelationLabeledBy(&m_aFT_LightSource); + m_aCtl_Preview.SetAccessibleName(String(SchResId( STR_LIGHT_PREVIEW ))); } ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage() diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc index e2d031955867..f5ae0dcda267 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc @@ -42,5 +42,7 @@ #define BTN_LIGHT_6 8 #define BTN_LIGHT_7 9 #define BTN_LIGHT_8 10 - +//IAccessibility2 Implementation 2009----- +#define STR_LIGHT_PREVIEW 6000 +//-----IAccessibility2 Implementation 2009 #define CTL_LIGHT_PREVIEW 1 diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src index 57f15a1894d7..cf5898af8c85 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.src @@ -59,6 +59,7 @@ TabPage TP_3D_SCENEILLUMINATION { + HelpID = "chart2:TabPage:TP_3D_SCENEILLUMINATION"; OutputSize = TRUE ; SVLook = TRUE ; Hide = TRUE ; @@ -72,46 +73,55 @@ TabPage TP_3D_SCENEILLUMINATION }; ImageButton BTN_LIGHT_1 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_1"; Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_BUTTONS ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ImageButton BTN_LIGHT_2 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_2"; Pos = MAP_APPFONT ( POS_X_0+BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ImageButton BTN_LIGHT_3 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_3"; Pos = MAP_APPFONT ( POS_X_0+2*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ImageButton BTN_LIGHT_4 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_4"; Pos = MAP_APPFONT ( POS_X_0+3*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ImageButton BTN_LIGHT_5 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_5"; Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ImageButton BTN_LIGHT_6 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_6"; Pos = MAP_APPFONT ( POS_X_0+1*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ImageButton BTN_LIGHT_7 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_7"; Pos = MAP_APPFONT ( POS_X_0+2*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ImageButton BTN_LIGHT_8 { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHT_8"; Pos = MAP_APPFONT ( POS_X_0+3*BUTTON_DISTANCE , POS_Y_LIGHTSOURCE_BUTTONS_2 ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; }; ListBox LB_LIGHTSOURCE { + HelpID = "chart2:ListBox:TP_3D_SCENEILLUMINATION:LB_LIGHTSOURCE"; Border = TRUE ; Pos = MAP_APPFONT ( POS_X_0 , POS_Y_LIGHTSOURCE ) ; Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ; @@ -120,6 +130,7 @@ TabPage TP_3D_SCENEILLUMINATION }; ImageButton BTN_LIGHTSOURCE_COLOR { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_LIGHTSOURCE_COLOR"; Pos = MAP_APPFONT ( POS_X_1 , POS_Y_LIGHTSOURCE ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; TabStop = TRUE ; @@ -136,6 +147,7 @@ TabPage TP_3D_SCENEILLUMINATION }; ListBox LB_AMBIENTLIGHT { + HelpID = "chart2:ListBox:TP_3D_SCENEILLUMINATION:LB_AMBIENTLIGHT"; Border = TRUE ; Pos = MAP_APPFONT ( POS_X_0 , POS_Y_AMBIENT ) ; Size = MAP_APPFONT ( WIDTH_LB , HEIGHT_LB ) ; @@ -144,6 +156,7 @@ TabPage TP_3D_SCENEILLUMINATION }; ImageButton BTN_AMBIENT_COLOR { + HelpID = "chart2:ImageButton:TP_3D_SCENEILLUMINATION:BTN_AMBIENT_COLOR"; Pos = MAP_APPFONT ( POS_X_1 , POS_Y_AMBIENT ) ; Size = MAP_APPFONT ( WIDTH_IB , HEIGHT_IB ) ; TabStop = TRUE ; @@ -160,3 +173,8 @@ TabPage TP_3D_SCENEILLUMINATION }; }; +String STR_LIGHT_PREVIEW +{ + Text [ en-US ] = "Light Preview" ; +}; + diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index fd21bacca0b2..4da8cd64b08c 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -79,11 +79,12 @@ SchAxisLabelTabPage::SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rIn m_nInitialDegrees( 0 ), m_bHasInitialDegrees( true ), m_bInitialStacking( false ), - m_bHasInitialStacking( true ) + m_bHasInitialStacking( true ), + m_bComplexCategories( false ) { FreeResource(); - aCbStacked.EnableTriState( FALSE ); + aCbStacked.EnableTriState( sal_False ); aOrientHlp.AddDependentWindow( aFlOrient ); aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK ); @@ -108,7 +109,7 @@ SfxTabPage* SchAxisLabelTabPage::Create( Window* pParent, const SfxItemSet& rAtt return new SchAxisLabelTabPage( pParent, rAttrs ); } -BOOL SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs ) +sal_Bool SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs ) { bool bStacked = false; if( aOrientHlp.GetStackedState() != STATE_DONTKNOW ) @@ -142,20 +143,20 @@ BOOL SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs ) bRadioButtonChecked = false; if( bRadioButtonChecked ) - rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_TEXT_ORDER )); + rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_AXIS_LABEL_ORDER )); } if( aCbTextOverlap.GetState() != STATE_DONTKNOW ) - rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_OVERLAP, aCbTextOverlap.IsChecked() ) ); + rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_OVERLAP, aCbTextOverlap.IsChecked() ) ); if( aCbTextBreak.GetState() != STATE_DONTKNOW ) - rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXTBREAK, aCbTextBreak.IsChecked() ) ); + rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_BREAK, aCbTextBreak.IsChecked() ) ); if( aCbShowDescription.GetState() != STATE_DONTKNOW ) rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, aCbShowDescription.IsChecked() ) ); if( m_aLbTextDirection.GetSelectEntryCount() > 0 ) rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) ); - return TRUE; + return sal_True; } void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) @@ -164,16 +165,16 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) SfxItemState aState = SFX_ITEM_UNKNOWN; // show description ---------- - aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, FALSE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, sal_False, &pPoolItem ); if( aState == SFX_ITEM_DONTCARE ) { - aCbShowDescription.EnableTriState( TRUE ); + aCbShowDescription.EnableTriState( sal_True ); aCbShowDescription.SetState( STATE_DONTKNOW ); } else { - aCbShowDescription.EnableTriState( FALSE ); - BOOL bCheck = FALSE; + aCbShowDescription.EnableTriState( sal_False ); + sal_Bool bCheck = sal_False; if( aState == SFX_ITEM_SET ) bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); aCbShowDescription.Check( bCheck ); @@ -186,7 +187,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) // check new degree item m_nInitialDegrees = 0; - aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, FALSE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_False, &pPoolItem ); if( aState == SFX_ITEM_SET ) m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); @@ -198,7 +199,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) // check stacked item m_bInitialStacking = false; - aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, FALSE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, sal_False, &pPoolItem ); if( aState == SFX_ITEM_SET ) m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); @@ -208,20 +209,20 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) else aOrientHlp.SetStackedState( STATE_DONTKNOW ); - if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET ) m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) ); // Text overlap ---------- - aState = rInAttrs.GetItemState( SCHATTR_TEXT_OVERLAP, FALSE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_OVERLAP, sal_False, &pPoolItem ); if( aState == SFX_ITEM_DONTCARE ) { - aCbTextOverlap.EnableTriState( TRUE ); + aCbTextOverlap.EnableTriState( sal_True ); aCbTextOverlap.SetState( STATE_DONTKNOW ); } else { - aCbTextOverlap.EnableTriState( FALSE ); - BOOL bCheck = FALSE; + aCbTextOverlap.EnableTriState( sal_False ); + sal_Bool bCheck = sal_False; if( aState == SFX_ITEM_SET ) bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); aCbTextOverlap.Check( bCheck ); @@ -231,16 +232,16 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) } // text break ---------- - aState = rInAttrs.GetItemState( SCHATTR_TEXTBREAK, FALSE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_BREAK, sal_False, &pPoolItem ); if( aState == SFX_ITEM_DONTCARE ) { - aCbTextBreak.EnableTriState( TRUE ); + aCbTextBreak.EnableTriState( sal_True ); aCbTextBreak.SetState( STATE_DONTKNOW ); } else { - aCbTextBreak.EnableTriState( FALSE ); - BOOL bCheck = FALSE; + aCbTextBreak.EnableTriState( sal_False ); + sal_Bool bCheck = sal_False; if( aState == SFX_ITEM_SET ) bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); aCbTextBreak.Check( bCheck ); @@ -256,7 +257,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) // text order ---------- if( m_bShowStaggeringControls ) { - aState = rInAttrs.GetItemState( SCHATTR_TEXT_ORDER, FALSE, &pPoolItem ); + aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_ORDER, sal_False, &pPoolItem ); if( aState == SFX_ITEM_SET ) { SvxChartTextOrder eOrder = static_cast< const SvxChartTextOrderItem * >( pPoolItem )->GetValue(); @@ -282,7 +283,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs ) ToggleShowLabel( (void*)0 ); } -void SchAxisLabelTabPage::ShowStaggeringControls( BOOL bShowStaggeringControls ) +void SchAxisLabelTabPage::ShowStaggeringControls( sal_Bool bShowStaggeringControls ) { m_bShowStaggeringControls = bShowStaggeringControls; @@ -296,12 +297,17 @@ void SchAxisLabelTabPage::ShowStaggeringControls( BOOL bShowStaggeringControls ) } } +void SchAxisLabelTabPage::SetComplexCategories( bool bComplexCategories ) +{ + m_bComplexCategories = bComplexCategories; +} + // event handling routines // ----------------------- IMPL_LINK ( SchAxisLabelTabPage, ToggleShowLabel, void *, EMPTYARG ) { - BOOL bEnable = ( aCbShowDescription.GetState() != STATE_NOCHECK ); + sal_Bool bEnable = ( aCbShowDescription.GetState() != STATE_NOCHECK ); aOrientHlp.Enable( bEnable ); aFlOrder.Enable( bEnable ); @@ -311,7 +317,7 @@ IMPL_LINK ( SchAxisLabelTabPage, ToggleShowLabel, void *, EMPTYARG ) aRbAuto.Enable( bEnable ); aFlTextFlow.Enable( bEnable ); - aCbTextOverlap.Enable( bEnable ); + aCbTextOverlap.Enable( bEnable && !m_bComplexCategories ); aCbTextBreak.Enable( bEnable ); m_aFtTextDirection.Enable( bEnable ); diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx index 8e234b76af47..e56ed843fad6 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx @@ -71,12 +71,13 @@ private: FixedText m_aFtTextDirection; TextDirectionListBox m_aLbTextDirection; - BOOL m_bShowStaggeringControls; + sal_Bool m_bShowStaggeringControls; sal_Int32 m_nInitialDegrees; bool m_bHasInitialDegrees; /// false = DialControl in tristate bool m_bInitialStacking; bool m_bHasInitialStacking; /// false = checkbox in tristate + bool m_bComplexCategories; DECL_LINK ( ToggleShowLabel, void* ); @@ -87,10 +88,11 @@ public: void Construct(); static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); - virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); + virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs ); virtual void Reset( const SfxItemSet& rInAttrs ); - void ShowStaggeringControls( BOOL bShowStaggeringControls ); + void ShowStaggeringControls( sal_Bool bShowStaggeringControls ); + void SetComplexCategories( bool bComplexCategories ); }; //............................................................................. } //namespace chart diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.src b/chart2/source/controller/dialogs/tp_AxisLabel.src index bcba1926c242..75da7dc5e653 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.src +++ b/chart2/source/controller/dialogs/tp_AxisLabel.src @@ -35,6 +35,7 @@ TabPage TP_AXIS_LABEL CheckBox CB_AXIS_LABEL_SCHOW_DESCR { + HelpID = "chart2:CheckBox:TP_AXIS_LABEL:CB_AXIS_LABEL_SCHOW_DESCR"; Pos = MAP_APPFONT ( 6 , 6 ) ; Size = MAP_APPFONT ( 248 , 12 ) ; @@ -112,6 +113,7 @@ TabPage TP_AXIS_LABEL }; CheckBox CB_AXIS_LABEL_TEXTOVERLAP { + HelpID = "chart2:CheckBox:TP_AXIS_LABEL:CB_AXIS_LABEL_TEXTOVERLAP"; Pos = MAP_APPFONT ( 139 , 33 ) ; Size = MAP_APPFONT ( 115 , 10 ) ; TabStop = TRUE ; @@ -120,6 +122,7 @@ TabPage TP_AXIS_LABEL }; CheckBox CB_AXIS_LABEL_TEXTBREAK { + HelpID = "chart2:CheckBox:TP_AXIS_LABEL:CB_AXIS_LABEL_TEXTBREAK"; Pos = MAP_APPFONT ( 139 , 47 ) ; Size = MAP_APPFONT ( 115 , 10 ) ; TabStop = TRUE ; @@ -137,6 +140,7 @@ TabPage TP_AXIS_LABEL }; RadioButton RB_AXIS_LABEL_SIDEBYSIDE { + HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_SIDEBYSIDE"; Pos = MAP_APPFONT ( 12 , 33 ) ; Size = MAP_APPFONT ( 112 , 10 ) ; TabStop = TRUE ; @@ -145,6 +149,7 @@ TabPage TP_AXIS_LABEL }; RadioButton RB_AXIS_LABEL_UPDOWN { + HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_UPDOWN"; Pos = MAP_APPFONT ( 12 , 47 ) ; Size = MAP_APPFONT ( 112 , 10 ) ; TabStop = TRUE ; @@ -153,6 +158,7 @@ TabPage TP_AXIS_LABEL }; RadioButton RB_AXIS_LABEL_DOWNUP { + HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_DOWNUP"; Pos = MAP_APPFONT ( 12 , 61 ) ; Size = MAP_APPFONT ( 112 , 10 ) ; TabStop = TRUE ; @@ -161,6 +167,7 @@ TabPage TP_AXIS_LABEL }; RadioButton RB_AXIS_LABEL_AUTOORDER { + HelpID = "chart2:RadioButton:TP_AXIS_LABEL:RB_AXIS_LABEL_AUTOORDER"; Pos = MAP_APPFONT ( 12 , 75 ) ; Size = MAP_APPFONT ( 112 , 10 ) ; TabStop = TRUE ; @@ -176,6 +183,7 @@ TabPage TP_AXIS_LABEL }; ListBox LB_AXIS_TEXTDIR { + HelpID = "chart2:ListBox:TP_AXIS_LABEL:LB_AXIS_TEXTDIR"; Pos = MAP_APPFONT ( 78 , 154 ) ; Size = MAP_APPFONT ( 170 , 100 ) ; Border = TRUE; diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx index c4d073e3d03d..61cde8fabf56 100644 --- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx +++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx @@ -221,6 +221,10 @@ AxisPositionsTabPage::AxisPositionsTabPage(Window* pWindow,const SfxItemSet& rIn m_aLB_PlaceLabels.SetSelectHdl( LINK( this, AxisPositionsTabPage, PlaceLabelsSelectHdl ) ); m_aLB_PlaceLabels.SetDropDownLineCount( m_aLB_PlaceLabels.GetEntryCount() ); m_aLB_PlaceTicks.SetDropDownLineCount( m_aLB_PlaceTicks.GetEntryCount() ); + m_aCB_TicksInner.SetAccessibleRelationLabeledBy(&m_aFT_Major); + m_aCB_TicksOuter.SetAccessibleRelationLabeledBy(&m_aFT_Major); + m_aCB_MinorInner.SetAccessibleRelationLabeledBy(&m_aFT_Minor); + m_aCB_MinorOuter.SetAccessibleRelationLabeledBy(&m_aFT_Minor); } SfxTabPage* AxisPositionsTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs) @@ -228,10 +232,10 @@ SfxTabPage* AxisPositionsTabPage::Create(Window* pWindow,const SfxItemSet& rOutA return new AxisPositionsTabPage(pWindow, rOutAttrs); } -BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs) +sal_Bool AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs) { // axis line - USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos(); + sal_uInt16 nPos = m_aLB_CrossesAt.GetSelectEntryPos(); rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_POSITION, nPos+1 )); if( 2==nPos ) { @@ -242,7 +246,7 @@ BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs) } // labels - USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos(); + sal_uInt16 nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos(); if( nLabelPos != LISTBOX_ENTRY_NOTFOUND ) rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_LABEL_POSITION, nLabelPos )); @@ -262,11 +266,11 @@ BOOL AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs) rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,nTicks)); rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELPTICKS,nMinorTicks)); - USHORT nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos(); + sal_uInt16 nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos(); if( nMarkPos != LISTBOX_ENTRY_NOTFOUND ) rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_MARK_POSITION, nMarkPos )); - return TRUE; + return sal_True; } void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs) @@ -280,7 +284,7 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs) for( sal_Int32 nN=0; nN<m_aCategories.getLength() && nN<nMaxCount; nN++ ) m_aED_CrossesAtCategory.InsertEntry( m_aCategories[nN] ); - USHORT nCount = m_aED_CrossesAtCategory.GetEntryCount(); + sal_uInt16 nCount = m_aED_CrossesAtCategory.GetEntryCount(); if( nCount>30 ) nCount=30; m_aED_CrossesAtCategory.SetDropDownLineCount( nCount ); @@ -298,10 +302,10 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs) const SfxPoolItem *pPoolItem = NULL; //axis line - if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,TRUE, &pPoolItem)== SFX_ITEM_SET) + if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,sal_True, &pPoolItem)== SFX_ITEM_SET) { bool bZero = false; - USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); if(nPos==0) { //switch to value @@ -315,13 +319,13 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs) m_aLB_CrossesAt.SelectEntryPos( nPos ); CrossesAtSelectHdl( (void*)0 ); - if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,TRUE, &pPoolItem)== SFX_ITEM_SET || bZero ) + if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,sal_True, &pPoolItem)== SFX_ITEM_SET || bZero ) { double fCrossover = 0.0; if( !bZero ) fCrossover = (((const SvxDoubleItem*)pPoolItem)->GetValue()); if( m_bCrossingAxisIsCategoryAxis ) - m_aED_CrossesAtCategory.SelectEntryPos( static_cast<USHORT>(::rtl::math::round(fCrossover-1.0)) ); + m_aED_CrossesAtCategory.SelectEntryPos( static_cast<sal_uInt16>(::rtl::math::round(fCrossover-1.0)) ); else m_aED_CrossesAt.SetValue(fCrossover); } @@ -334,13 +338,13 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs) else { m_aLB_CrossesAt.SetNoSelection(); - m_aED_CrossesAt.Enable( FALSE ); + m_aED_CrossesAt.Enable( sal_False ); } // Labels - if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, sal_False, &pPoolItem ) == SFX_ITEM_SET ) { - USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); if( nPos < m_aLB_PlaceLabels.GetEntryCount() ) m_aLB_PlaceLabels.SelectEntryPos( nPos ); } @@ -350,20 +354,20 @@ void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs) // Tick marks long nTicks=0,nMinorTicks=0; - if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,TRUE, &pPoolItem)== SFX_ITEM_SET) + if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,sal_True, &pPoolItem)== SFX_ITEM_SET) nTicks=((const SfxInt32Item*)pPoolItem)->GetValue(); - if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,TRUE, &pPoolItem)== SFX_ITEM_SET) + if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,sal_True, &pPoolItem)== SFX_ITEM_SET) nMinorTicks=((const SfxInt32Item*)pPoolItem)->GetValue(); - m_aCB_TicksInner.Check(BOOL(nTicks&CHAXIS_MARK_INNER)); - m_aCB_TicksOuter.Check(BOOL(nTicks&CHAXIS_MARK_OUTER)); - m_aCB_MinorInner.Check(BOOL(nMinorTicks&CHAXIS_MARK_INNER)); - m_aCB_MinorOuter.Check(BOOL(nMinorTicks&CHAXIS_MARK_OUTER)); + m_aCB_TicksInner.Check(sal_Bool(nTicks&CHAXIS_MARK_INNER)); + m_aCB_TicksOuter.Check(sal_Bool(nTicks&CHAXIS_MARK_OUTER)); + m_aCB_MinorInner.Check(sal_Bool(nMinorTicks&CHAXIS_MARK_INNER)); + m_aCB_MinorOuter.Check(sal_Bool(nMinorTicks&CHAXIS_MARK_OUTER)); // Tick position - if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, FALSE, &pPoolItem ) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, sal_False, &pPoolItem ) == SFX_ITEM_SET ) { - USHORT nPos = (USHORT)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); if( nPos < m_aLB_PlaceTicks.GetEntryCount() ) m_aLB_PlaceTicks.SelectEntryPos( nPos ); } @@ -438,9 +442,9 @@ void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter ) m_aED_CrossesAt.UseInputStringForFormatting(); const SfxPoolItem *pPoolItem = NULL; - if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, sal_True, &pPoolItem ) == SFX_ITEM_SET ) { - ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue(); + sal_uLong nFmt = (sal_uLong)((const SfxInt32Item*)pPoolItem)->GetValue(); m_aED_CrossesAt.SetFormatKey( nFmt ); } } @@ -462,7 +466,7 @@ void AxisPositionsTabPage::SupportAxisPositioning( bool bSupportAxisPositioning IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG ) { - USHORT nPos = m_aLB_CrossesAt.GetSelectEntryPos(); + sal_uInt16 nPos = m_aLB_CrossesAt.GetSelectEntryPos(); m_aED_CrossesAt.Show( (2==nPos) && !m_bCrossingAxisIsCategoryAxis ); m_aED_CrossesAtCategory.Show( (2==nPos) && m_bCrossingAxisIsCategoryAxis ); @@ -477,12 +481,12 @@ IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG ) IMPL_LINK ( AxisPositionsTabPage, PlaceLabelsSelectHdl, void *, EMPTYARG ) { - USHORT nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos(); + sal_uInt16 nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos(); bool bEnableTickmarkPlacement = (nLabelPos>1); if( bEnableTickmarkPlacement ) { - USHORT nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos(); + sal_uInt16 nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos(); if( nLabelPos-2 == nAxisPos ) bEnableTickmarkPlacement=false; } diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.hxx b/chart2/source/controller/dialogs/tp_AxisPositions.hxx index 61fb13ecedd3..5bfc694b8939 100644 --- a/chart2/source/controller/dialogs/tp_AxisPositions.hxx +++ b/chart2/source/controller/dialogs/tp_AxisPositions.hxx @@ -47,7 +47,7 @@ public: AxisPositionsTabPage( Window* pParent, const SfxItemSet& rInAttrs ); static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); - virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); + virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs ); virtual void Reset( const SfxItemSet& rInAttrs ); using TabPage::DeactivatePage; virtual int DeactivatePage( SfxItemSet* pItemSet = NULL ); diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.src b/chart2/source/controller/dialogs/tp_AxisPositions.src index 8ce1ba39056a..1173b841354a 100644 --- a/chart2/source/controller/dialogs/tp_AxisPositions.src +++ b/chart2/source/controller/dialogs/tp_AxisPositions.src @@ -60,6 +60,7 @@ TabPage TP_AXIS_POSITIONS { + HelpID = "chart2:TabPage:TP_AXIS_POSITIONS"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; @@ -79,6 +80,7 @@ TabPage TP_AXIS_POSITIONS }; ListBox LB_CROSSES_OTHER_AXIS_AT { + HelpID = "chart2:ListBox:TP_AXIS_POSITIONS:LB_CROSSES_OTHER_AXIS_AT"; Border = TRUE ; AutoHScroll = TRUE ; Pos = MAP_APPFONT ( X4 , Y1-2 ) ; @@ -98,6 +100,7 @@ TabPage TP_AXIS_POSITIONS }; SpinField EDT_CROSSES_OTHER_AXIS_AT { + HelpID = "chart2:SpinField:TP_AXIS_POSITIONS:EDT_CROSSES_OTHER_AXIS_AT"; Border = TRUE ; SVLook = TRUE ; Pos = MAP_APPFONT ( X5 , Y1-2 ) ; @@ -106,6 +109,7 @@ TabPage TP_AXIS_POSITIONS }; ComboBox EDT_CROSSES_OTHER_AXIS_AT_CATEGORY { + HelpID = "chart2:ComboBox:TP_AXIS_POSITIONS:EDT_CROSSES_OTHER_AXIS_AT_CATEGORY"; Border = TRUE ; SVLook = TRUE ; Pos = MAP_APPFONT ( X5 , Y1-2 ) ; @@ -116,6 +120,7 @@ TabPage TP_AXIS_POSITIONS CheckBox CB_AXIS_BETWEEN_CATEGORIES { + HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_AXIS_BETWEEN_CATEGORIES"; Hide = TRUE; Pos = MAP_APPFONT ( X2 , Y2 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; @@ -137,6 +142,7 @@ TabPage TP_AXIS_POSITIONS }; ListBox LB_PLACE_LABELS { + HelpID = "chart2:ListBox:TP_AXIS_POSITIONS:LB_PLACE_LABELS"; Border = TRUE ; AutoHScroll = TRUE ; Pos = MAP_APPFONT ( X4 , Y4-2 ) ; @@ -164,6 +170,7 @@ TabPage TP_AXIS_POSITIONS }; SpinField EDT_AXIS_LABEL_DISTANCE { + HelpID = "chart2:SpinField:TP_AXIS_POSITIONS:EDT_AXIS_LABEL_DISTANCE"; Hide = TRUE; Border = TRUE ; SVLook = TRUE ; @@ -186,12 +193,14 @@ TabPage TP_AXIS_POSITIONS }; CheckBox CB_TICKS_INNER { + HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_TICKS_INNER"; Pos = MAP_APPFONT ( XTICK_2 , Y7 ) ; Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; Text [ en-US ] = "~Inner"; }; CheckBox CB_TICKS_OUTER { + HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_TICKS_OUTER"; Pos = MAP_APPFONT ( XTICK_3 , Y7 ) ; Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; Text [ en-US ] = "~Outer"; @@ -205,12 +214,14 @@ TabPage TP_AXIS_POSITIONS }; CheckBox CB_MINOR_INNER { + HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MINOR_INNER"; Pos = MAP_APPFONT ( XTICK_2 , Y8 ); Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; Text [ en-US ] = "I~nner"; }; CheckBox CB_MINOR_OUTER { + HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MINOR_OUTER"; Pos = MAP_APPFONT ( XTICK_3 , Y8 ) ; Size = MAP_APPFONT ( TICKWIDTH , 10 ) ; Text [ en-US ] = "O~uter"; @@ -232,6 +243,7 @@ TabPage TP_AXIS_POSITIONS }; ListBox LB_PLACE_TICKS { + HelpID = "chart2:ListBox:TP_AXIS_POSITIONS:LB_PLACE_TICKS"; Border = TRUE ; AutoHScroll = TRUE ; Pos = MAP_APPFONT ( X3 , Y9-2 ) ; @@ -259,6 +271,7 @@ TabPage TP_AXIS_POSITIONS }; CheckBox CB_MAJOR_GRID { + HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MAJOR_GRID"; Hide = TRUE ; Pos = MAP_APPFONT ( X2 , Y11 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; @@ -267,6 +280,7 @@ TabPage TP_AXIS_POSITIONS }; PushButton PB_MAJOR_GRID { + HelpID = "chart2:PushButton:TP_AXIS_POSITIONS:PB_MAJOR_GRID"; Hide = TRUE ; TabStop = TRUE; Pos = MAP_APPFONT ( X3 , Y11-2 ); @@ -275,6 +289,7 @@ TabPage TP_AXIS_POSITIONS }; CheckBox CB_MINOR_GRID { + HelpID = "chart2:CheckBox:TP_AXIS_POSITIONS:CB_MINOR_GRID"; Hide = TRUE ; Pos = MAP_APPFONT ( X2 , Y12 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; @@ -283,6 +298,7 @@ TabPage TP_AXIS_POSITIONS }; PushButton PB_MINOR_GRID { + HelpID = "chart2:PushButton:TP_AXIS_POSITIONS:PB_MINOR_GRID"; Hide = TRUE ; TabStop = TRUE; Pos = MAP_APPFONT ( X3 , Y12-2 ); diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index 728e7e6cf443..c91200547f6c 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -179,6 +179,8 @@ Dim3DLookResourceGroup::Dim3DLookResourceGroup( Window* pWindow ) m_aLB_Scheme.SetDropDownLineCount(2); m_aLB_Scheme.SetSelectHdl( LINK( this, Dim3DLookResourceGroup, SelectSchemeHdl ) ); + m_aLB_Scheme.SetAccessibleName(m_aCB_3DLook.GetText()); + m_aLB_Scheme.SetAccessibleRelationLabeledBy(&m_aCB_3DLook); } Dim3DLookResourceGroup::~Dim3DLookResourceGroup() { @@ -218,7 +220,7 @@ void Dim3DLookResourceGroup::fillControls( const ChartTypeParameter& rParameter void Dim3DLookResourceGroup::fillParameter( ChartTypeParameter& rParameter ) { rParameter.b3DLook = m_aCB_3DLook.IsChecked(); - USHORT nPos = m_aLB_Scheme.GetSelectEntryPos(); + sal_uInt16 nPos = m_aLB_Scheme.GetSelectEntryPos(); if( POS_3DSCHEME_SIMPLE == nPos ) rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple; else if( POS_3DSCHEME_REALISTIC == nPos ) @@ -334,6 +336,9 @@ StackingResourceGroup::StackingResourceGroup( Window* pWindow ) m_aRB_Stack_Y.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) ); m_aRB_Stack_Y_Percent.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) ); m_aRB_Stack_Z.SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) ); + m_aRB_Stack_Y.SetAccessibleRelationMemberOf(&m_aCB_Stacked); + m_aRB_Stack_Y_Percent.SetAccessibleRelationMemberOf(&m_aCB_Stacked); + m_aRB_Stack_Z.SetAccessibleRelationMemberOf(&m_aCB_Stacked); } StackingResourceGroup::~StackingResourceGroup() { @@ -462,9 +467,9 @@ private: MetricField m_aMF_SplineOrder; FixedLine m_aFL_DialogButtons; + HelpButton m_aBP_Help; OKButton m_aBP_OK; CancelButton m_aBP_Cancel; - HelpButton m_aBP_Help; }; SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent ) @@ -477,9 +482,9 @@ SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent ) , m_aFT_SplineOrder( this, SchResId( FT_SPLINE_ORDER ) ) , m_aMF_SplineOrder( this, SchResId( MF_SPLINE_ORDER ) ) , m_aFL_DialogButtons( this, SchResId( FL_SPLINE_DIALOGBUTTONS ) ) + , m_aBP_Help( this, SchResId(BTN_HELP) ) , m_aBP_OK( this, SchResId(BTN_OK) ) - , m_aBP_Cancel( this, SchResId(BTN_CANCEL) ) - , m_aBP_Help( this, SchResId(BTN_HELP) ) + , m_aBP_Cancel( this, SchResId(BTN_CANCEL) ) { FreeResource(); @@ -697,7 +702,7 @@ IMPL_LINK( SplineResourceGroup, SplineDetailsDialogHdl, void*, EMPTYARG ) ChartTypeParameter aOldParameter; getSplinePropertiesDialog().fillParameter( aOldParameter, m_aCB_Splines.IsChecked() ); - BOOL bOldSmoothLines = m_aCB_Splines.IsChecked(); + sal_Bool bOldSmoothLines = m_aCB_Splines.IsChecked(); m_aCB_Splines.Check(); if( RET_OK == getSplinePropertiesDialog().Execute() ) { @@ -758,7 +763,7 @@ void GeometryResourceGroup::setPosition( const Point& rPoint ) void GeometryResourceGroup::fillControls( const ChartTypeParameter& rParameter ) { - USHORT nGeometry3D = static_cast<USHORT>(rParameter.nGeometry3D); + sal_uInt16 nGeometry3D = static_cast<sal_uInt16>(rParameter.nGeometry3D); m_aGeometryResources.SelectEntryPos(nGeometry3D); m_aGeometryResources.Enable(rParameter.b3DLook); } @@ -1074,8 +1079,10 @@ void ChartTypeTabPage::fillAllControls( const ChartTypeParameter& rParameter, bo { m_nChangingCalls++; if( m_pCurrentMainType && bAlsoResetSubTypeList ) + { m_pCurrentMainType->fillSubTypeList( m_aSubTypeList, rParameter ); - m_aSubTypeList.SelectItem( static_cast<USHORT>( rParameter.nSubTypeIndex) ); + } + m_aSubTypeList.SelectItem( static_cast<sal_uInt16>( rParameter.nSubTypeIndex) ); m_pAxisTypeResourceGroup->fillControls( rParameter ); m_pDim3DLookResourceGroup->fillControls( rParameter ); m_pStackingResourceGroup->fillControls( rParameter ); @@ -1100,7 +1107,7 @@ void ChartTypeTabPage::initializePage() ::std::vector< ChartTypeDialogController* >::iterator aIter = m_aChartTypeDialogControllerList.begin(); const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end(); - for( USHORT nM=0; aIter != aEnd; aIter++, nM++ ) + for( sal_uInt16 nM=0; aIter != aEnd; aIter++, nM++ ) { if( (*aIter)->isSubType(aServiceName) ) { diff --git a/chart2/source/controller/dialogs/tp_ChartType.src b/chart2/source/controller/dialogs/tp_ChartType.src index a9bb2a039f3c..69c33cd14021 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.src +++ b/chart2/source/controller/dialogs/tp_ChartType.src @@ -69,7 +69,7 @@ TabPage TP_CHARTTYPE { Hide = TRUE ; - HelpID = SID_DIAGRAM_TYPE; + HelpID = HID_DIAGRAM_TYPE; SVLook = TRUE ; Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ; @@ -99,18 +99,21 @@ TabPage TP_CHARTTYPE CheckBox CB_X_AXIS_CATEGORIES { + HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_X_AXIS_CATEGORIES"; Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_VALUE_X_AXIS ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text [ en-US ] = "X axis with Categories" ; }; CheckBox CB_3D_LOOK { + HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_3D_LOOK"; Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_3D_LOOK ) ; Size = MAP_APPFONT ( WIDTH_3D , 10 ) ; Text [ en-US ] = "~3D Look" ; }; ListBox LB_3D_SCHEME { + HelpID = "chart2:ListBox:TP_CHARTTYPE:LB_3D_SCHEME"; Border = TRUE; TabStop = TRUE; DropDown = TRUE; @@ -120,12 +123,14 @@ TabPage TP_CHARTTYPE CheckBox CB_STACKED { + HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_STACKED"; Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_STACKING ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text [ en-US ] = "~Stack series" ; }; RadioButton RB_STACK_Y { + HelpID = "chart2:RadioButton:TP_CHARTTYPE:RB_STACK_Y"; Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+12 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -135,6 +140,7 @@ TabPage TP_CHARTTYPE }; RadioButton RB_STACK_Y_PERCENT { + HelpID = "chart2:RadioButton:TP_CHARTTYPE:RB_STACK_Y_PERCENT"; Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+2*12 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -142,6 +148,7 @@ TabPage TP_CHARTTYPE }; RadioButton RB_STACK_Z { + HelpID = "chart2:RadioButton:TP_CHARTTYPE:RB_STACK_Z"; Pos = MAP_APPFONT ( POS_X_IMAGELIST+RSC_SP_CHK_TEXTINDENT, POS_Y_STACKING+3*12 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -152,6 +159,7 @@ TabPage TP_CHARTTYPE CheckBox CB_SPLINES { + HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_SPLINES"; Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_SPLINES ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text [ en-US ] = "S~mooth lines" ; @@ -159,6 +167,7 @@ TabPage TP_CHARTTYPE PushButton PB_SPLINE_DIALOG { + HelpID = "chart2:PushButton:TP_CHARTTYPE:PB_SPLINE_DIALOG"; TabStop = TRUE ; Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_SPLINES-6 ) ; Size = MAP_APPFONT ( 12 , 14 ) ; @@ -167,6 +176,7 @@ TabPage TP_CHARTTYPE CheckBox CB_XVALUE_SORTING { + HelpID = "chart2:CheckBox:TP_CHARTTYPE:CB_XVALUE_SORTING"; TabStop = TRUE ; Pos = MAP_APPFONT ( POS_X_IMAGELIST , POS_Y_XVALUE_SORTING ) ; Size = MAP_APPFONT ( WIDTH_XVALUE_SORTING , 10 ) ; @@ -185,6 +195,7 @@ ModalDialog DLG_SPLINE_PROPERTIES Closeable = TRUE; RadioButton RB_SPLINES_CUBIC { + HelpID = "chart2:RadioButton:DLG_SPLINE_PROPERTIES:RB_SPLINES_CUBIC"; Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_2 ) ; Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ; TabStop = TRUE ; @@ -192,6 +203,7 @@ ModalDialog DLG_SPLINE_PROPERTIES }; RadioButton RB_SPLINES_B { + HelpID = "chart2:RadioButton:DLG_SPLINE_PROPERTIES:RB_SPLINES_B"; Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_3 ) ; Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ; TabStop = TRUE ; @@ -213,6 +225,7 @@ ModalDialog DLG_SPLINE_PROPERTIES }; MetricField MF_SPLINE_RESOLUTION { + HelpID = "chart2:MetricField:DLG_SPLINE_PROPERTIES:MF_SPLINE_RESOLUTION"; Border = TRUE ; Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_2-2 ) ; Size = MAP_APPFONT ( 25 , 12 ) ; @@ -236,6 +249,7 @@ ModalDialog DLG_SPLINE_PROPERTIES }; MetricField MF_SPLINE_ORDER { + HelpID = "chart2:MetricField:DLG_SPLINE_PROPERTIES:MF_SPLINE_ORDER"; Border = TRUE ; Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_3-2 ) ; Size = MAP_APPFONT ( 25 , 12 ) ; diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx index a53c205d9ecc..78b730cfb9ed 100644 --- a/chart2/source/controller/dialogs/tp_DataLabel.cxx +++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx @@ -55,7 +55,7 @@ SfxTabPage* DataLabelsTabPage::Create(Window* pWindow, return new DataLabelsTabPage(pWindow, rOutAttrs); } -BOOL DataLabelsTabPage::FillItemSet(SfxItemSet& rOutAttrs) +sal_Bool DataLabelsTabPage::FillItemSet(SfxItemSet& rOutAttrs) { return m_aDataLabelResources.FillItemSet(rOutAttrs); } diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx index ed49bd58cab7..5c40ec6872f4 100644 --- a/chart2/source/controller/dialogs/tp_DataLabel.hxx +++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx @@ -53,7 +53,7 @@ public: void SetNumberFormatter( SvNumberFormatter* pFormatter ); virtual void Reset(const SfxItemSet& rInAttrs); - virtual BOOL FillItemSet(SfxItemSet& rOutAttrs); + virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs); private: DataLabelResources m_aDataLabelResources; diff --git a/chart2/source/controller/dialogs/tp_DataLabel.src b/chart2/source/controller/dialogs/tp_DataLabel.src index 615e81c2c550..0f8f12c3e48b 100644 --- a/chart2/source/controller/dialogs/tp_DataLabel.src +++ b/chart2/source/controller/dialogs/tp_DataLabel.src @@ -28,10 +28,6 @@ #include "TabPages.hrc" #include "res_DataLabel.hrc" -#ifndef _GLOBLMN_HRC -#include <svx/globlmn.hrc> -#endif - TabPage TP_DATA_DESCR { Hide = TRUE ; diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index 557de8492384..d18fe55d2951 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -152,7 +152,7 @@ static long lcl_pRoleListBoxTabs[] = void lcl_ShowChooserButton( ::chart::RangeSelectionButton & rChooserButton, Edit & rEditField, - BOOL bShow ) + sal_Bool bShow ) { if( rChooserButton.IsVisible() != bShow ) { @@ -170,8 +170,8 @@ void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog ) { if( pDialog ) { - pDialog->Show( bEnable ? FALSE : TRUE ); - pDialog->SetModalInputMode( bEnable ? FALSE : TRUE ); + pDialog->Show( bEnable ? sal_False : sal_True ); + pDialog->SetModalInputMode( bEnable ? sal_False : sal_True ); } } @@ -312,7 +312,7 @@ DataSourceTabPage::DataSourceTabPage( // set handlers m_apLB_SERIES->SetSelectHdl( LINK( this, DataSourceTabPage, SeriesSelectionChangedHdl )); - m_aLB_ROLE.SetWindowBits( WB_HSCROLL | WB_CLIPCHILDREN ); + m_aLB_ROLE.SetStyle( m_aLB_ROLE.GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN ); m_aLB_ROLE.SetSelectionMode( SINGLE_SELECTION ); m_aLB_ROLE.SetSelectHdl( LINK( this, DataSourceTabPage, RoleSelectionChangedHdl )); @@ -360,6 +360,8 @@ DataSourceTabPage::DataSourceTabPage( if( m_apLB_SERIES->First()) m_apLB_SERIES->Select( m_apLB_SERIES->First()); m_apLB_SERIES->GrabFocus(); + m_aBTN_UP.SetAccessibleName(String(SchResId(STR_BUTTON_UP))); + m_aBTN_DOWN.SetAccessibleName(String(SchResId(STR_BUTTON_DOWN))); } DataSourceTabPage::~DataSourceTabPage() @@ -460,7 +462,7 @@ void DataSourceTabPage::updateControlsFromDialogModel() void DataSourceTabPage::fillSeriesListBox() { - m_apLB_SERIES->SetUpdateMode( FALSE ); + m_apLB_SERIES->SetUpdateMode( sal_False ); Reference< XDataSeries > xSelected; SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected()); @@ -512,7 +514,7 @@ void DataSourceTabPage::fillSeriesListBox() if( bHasSelectedEntry && pSelectedEntry ) m_apLB_SERIES->Select( pSelectedEntry ); - m_apLB_SERIES->SetUpdateMode( TRUE ); + m_apLB_SERIES->SetUpdateMode( sal_True ); } void DataSourceTabPage::fillRoleListBox() @@ -521,7 +523,7 @@ void DataSourceTabPage::fillRoleListBox() bool bHasSelectedEntry = (pSeriesEntry != 0); SvLBoxEntry * pRoleEntry = m_aLB_ROLE.FirstSelected(); - ULONG nRoleIndex = SAL_MAX_UINT32; + sal_uLong nRoleIndex = SAL_MAX_UINT32; if( pRoleEntry ) nRoleIndex = m_aLB_ROLE.GetModel()->GetAbsPos( pRoleEntry ); @@ -534,7 +536,7 @@ void DataSourceTabPage::fillRoleListBox() pSeriesEntry->m_xChartType )); // fill role list - m_aLB_ROLE.SetUpdateMode( FALSE ); + m_aLB_ROLE.SetUpdateMode( sal_False ); m_aLB_ROLE.Clear(); m_aLB_ROLE.RemoveSelection(); @@ -552,7 +554,7 @@ void DataSourceTabPage::fillRoleListBox() m_aLB_ROLE.Select( m_aLB_ROLE.GetEntry( nRoleIndex )); } - m_aLB_ROLE.SetUpdateMode( TRUE ); + m_aLB_ROLE.SetUpdateMode( sal_True ); } } @@ -579,7 +581,7 @@ void DataSourceTabPage::updateControlState() m_aFT_DATALABELS.Show(!bHasCategories); m_aFT_CATEGORIES.Show( bHasCategories); - BOOL bShowIB = bHasRangeChooser; + sal_Bool bShowIB = bHasRangeChooser; lcl_ShowChooserButton( m_aIMB_RANGE_CAT, m_aEDT_CATEGORIES, bShowIB ); m_aFT_SERIES.Enable(); diff --git a/chart2/source/controller/dialogs/tp_DataSource.hxx b/chart2/source/controller/dialogs/tp_DataSource.hxx index 291e3719a9a0..f606e9899e66 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.hxx +++ b/chart2/source/controller/dialogs/tp_DataSource.hxx @@ -125,12 +125,12 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener > getSelectionRangeListener(); - /** @return </TRUE>, if the edit field contains a valid range entry. if no - XCellRangesAccess can be obtained, </TRUE> is returned. + /** @return </sal_True>, if the edit field contains a valid range entry. if no + XCellRangesAccess can be obtained, </sal_True> is returned. */ bool isRangeFieldContentValid( Edit & rEdit ); - /** @return </TRUE>, if the tab-page is in a consistent (commitable) state + /** @return </sal_True>, if the tab-page is in a consistent (commitable) state */ bool isValid(); void setDirty(); diff --git a/chart2/source/controller/dialogs/tp_DataSource.src b/chart2/source/controller/dialogs/tp_DataSource.src index 3e1f8a51c68a..9173a9c709ab 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.src +++ b/chart2/source/controller/dialogs/tp_DataSource.src @@ -29,6 +29,7 @@ TabPage TP_DATA_SOURCE { + HelpID = "chart2:TabPage:TP_DATA_SOURCE"; Hide = TRUE; Size = MAP_APPFONT ( 248, 140 ); SVLook = TRUE ; @@ -86,6 +87,7 @@ TabPage TP_DATA_SOURCE }; Edit EDT_RANGE { + HelpID = "chart2:Edit:TP_DATA_SOURCE:EDT_RANGE"; Border = TRUE; TabStop = TRUE; Pos = MAP_APPFONT ( 82 , 89 ); @@ -93,6 +95,7 @@ TabPage TP_DATA_SOURCE }; ImageButton IMB_RANGE_MAIN { + HelpID = "chart2:ImageButton:TP_DATA_SOURCE:IMB_RANGE_MAIN"; TabStop = TRUE; Pos = MAP_APPFONT ( 228 , 88 ); Size = MAP_APPFONT ( 14 , 14 ); @@ -118,6 +121,7 @@ TabPage TP_DATA_SOURCE Edit EDT_CATEGORIES { + HelpID = "chart2:Edit:TP_DATA_SOURCE:EDT_CATEGORIES"; Border = TRUE; TabStop = TRUE; Pos = MAP_APPFONT ( 82 , 117 ); @@ -125,6 +129,7 @@ TabPage TP_DATA_SOURCE }; ImageButton IMB_RANGE_CAT { + HelpID = "chart2:ImageButton:TP_DATA_SOURCE:IMB_RANGE_CAT"; TabStop = TRUE; Pos = MAP_APPFONT ( 228 , 116 ); Size = MAP_APPFONT ( 14 , 14 ); @@ -134,6 +139,7 @@ TabPage TP_DATA_SOURCE PushButton BTN_ADD { + HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_ADD"; TabStop = TRUE; Disable = FALSE; Pos = MAP_APPFONT ( 6 , 105 ); @@ -143,6 +149,7 @@ TabPage TP_DATA_SOURCE }; PushButton BTN_REMOVE { + HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_REMOVE"; TabStop = TRUE; Disable = TRUE; Pos = MAP_APPFONT ( 6 , 121 ); @@ -154,6 +161,7 @@ TabPage TP_DATA_SOURCE // Note: Text is only a black triangle symbol PushButton BTN_UP { + HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_UP"; TabStop = TRUE; Disable = TRUE; Pos = MAP_APPFONT ( 64 , 105 ); @@ -163,6 +171,7 @@ TabPage TP_DATA_SOURCE // Note: Text is only a black triangle symbol PushButton BTN_DOWN { + HelpID = "chart2:PushButton:TP_DATA_SOURCE:BTN_DOWN"; TabStop = TRUE; Disable = TRUE; Pos = MAP_APPFONT ( 64 , 121 ); diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx index 14214eb4189a..0c945846af44 100644 --- a/chart2/source/controller/dialogs/tp_ErrorBars.cxx +++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx @@ -62,7 +62,7 @@ SfxTabPage* ErrorBarsTabPage::Create( return new ErrorBarsTabPage( pParent, rOutAttrs ); } -BOOL ErrorBarsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) +sal_Bool ErrorBarsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) { return m_aErrorBarResources.FillItemSet( rOutAttrs ); } diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.hxx b/chart2/source/controller/dialogs/tp_ErrorBars.hxx index cc581dd7afac..1d7c291f4fb3 100644 --- a/chart2/source/controller/dialogs/tp_ErrorBars.hxx +++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx @@ -50,7 +50,7 @@ public: ::com::sun::star::chart2::XChartDocument > & xChartDocument ); static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); - virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); + virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs ); virtual void Reset( const SfxItemSet& rInAttrs ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.src b/chart2/source/controller/dialogs/tp_ErrorBars.src index aede04751907..b649cb4474c9 100644 --- a/chart2/source/controller/dialogs/tp_ErrorBars.src +++ b/chart2/source/controller/dialogs/tp_ErrorBars.src @@ -30,6 +30,7 @@ TabPage TP_YERRORBAR { + HelpID = "chart2:TabPage:TP_YERRORBAR"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx index 9b7d34b72930..8cbdc35b1d44 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx @@ -52,6 +52,7 @@ SchLegendPosTabPage::SchLegendPosTabPage(Window* pWindow, , m_aFtTextDirection( this, SchResId( FT_LEGEND_TEXTDIR ) ) , m_aLbTextDirection( this, SchResId( LB_LEGEND_TEXTDIR ), &m_aFlTextOrient, &m_aFtTextDirection ) { + m_apLegendPositionResources->SetAccessibleRelationMemberOf(&aGrpLegend); FreeResource(); } @@ -65,14 +66,14 @@ SfxTabPage* SchLegendPosTabPage::Create(Window* pWindow, return new SchLegendPosTabPage(pWindow, rOutAttrs); } -BOOL SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs) +sal_Bool SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs) { m_apLegendPositionResources->writeToItemSet(rOutAttrs); if( m_aLbTextDirection.GetSelectEntryCount() > 0 ) rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) ); - return TRUE; + return sal_True; } void SchLegendPosTabPage::Reset(const SfxItemSet& rInAttrs) @@ -80,7 +81,7 @@ void SchLegendPosTabPage::Reset(const SfxItemSet& rInAttrs) m_apLegendPositionResources->initFromItemSet(rInAttrs); const SfxPoolItem* pPoolItem = 0; - if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET ) m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) ); } diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx index 521877af30b1..6140e7395623 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx +++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx @@ -58,7 +58,7 @@ public: virtual ~SchLegendPosTabPage(); static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs); - virtual BOOL FillItemSet(SfxItemSet& rOutAttrs); + virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs); virtual void Reset(const SfxItemSet& rInAttrs); }; diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.src b/chart2/source/controller/dialogs/tp_LegendPosition.src index 54b1065259df..2b0f93892fa9 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.src +++ b/chart2/source/controller/dialogs/tp_LegendPosition.src @@ -60,6 +60,7 @@ TabPage TP_LEGEND_POS ListBox LB_LEGEND_TEXTDIR { + HelpID = "chart2:ListBox:TP_LEGEND_POS:LB_LEGEND_TEXTDIR"; Pos = MAP_APPFONT ( 78 , 14 + RESOURCE_LEGENDPOSITION_HEIGHT + 17 ) ; Size = MAP_APPFONT ( 170 , 100 ) ; Border = TRUE; diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.cxx b/chart2/source/controller/dialogs/tp_PointGeometry.cxx index 5dd8f7cb44e6..1dd218a71d30 100644 --- a/chart2/source/controller/dialogs/tp_PointGeometry.cxx +++ b/chart2/source/controller/dialogs/tp_PointGeometry.cxx @@ -67,7 +67,7 @@ SfxTabPage* SchLayoutTabPage::Create(Window* pWindow, return new SchLayoutTabPage(pWindow, rOutAttrs); } -BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs) +sal_Bool SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs) { if(m_pGeometryResources && m_pGeometryResources->GetSelectEntryCount()) @@ -82,19 +82,19 @@ BOOL SchLayoutTabPage::FillItemSet(SfxItemSet& rOutAttrs) rOutAttrs.Put(SfxInt32Item(SCHATTR_STYLE_SHAPE,nShape)); rOutAttrs.Put(Svx3DHorizontalSegmentsItem(nSegs)); } - return TRUE; + return sal_True; } void SchLayoutTabPage::Reset(const SfxItemSet& rInAttrs) { const SfxPoolItem *pPoolItem = NULL; - if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_STYLE_SHAPE,sal_True, &pPoolItem) == SFX_ITEM_SET) { long nVal=((const SfxInt32Item*)pPoolItem)->GetValue(); if(m_pGeometryResources) { - m_pGeometryResources->SelectEntryPos(static_cast<USHORT>(nVal)); + m_pGeometryResources->SelectEntryPos(static_cast<sal_uInt16>(nVal)); m_pGeometryResources->Show( true ); } } diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.hxx b/chart2/source/controller/dialogs/tp_PointGeometry.hxx index aafe7856aafe..8a868158cf09 100644 --- a/chart2/source/controller/dialogs/tp_PointGeometry.hxx +++ b/chart2/source/controller/dialogs/tp_PointGeometry.hxx @@ -44,7 +44,7 @@ public: virtual ~SchLayoutTabPage(); static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs); - virtual BOOL FillItemSet(SfxItemSet& rOutAttrs); + virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs); virtual void Reset(const SfxItemSet& rInAttrs); private: diff --git a/chart2/source/controller/dialogs/tp_PointGeometry.src b/chart2/source/controller/dialogs/tp_PointGeometry.src index 39e1e1e9e21d..b6862cba3b77 100644 --- a/chart2/source/controller/dialogs/tp_PointGeometry.src +++ b/chart2/source/controller/dialogs/tp_PointGeometry.src @@ -29,6 +29,7 @@ TabPage TP_LAYOUT { + HelpID = "chart2:TabPage:TP_LAYOUT"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx index e71f29c54d9f..a915a6e2604f 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx @@ -66,7 +66,7 @@ SfxTabPage* PolarOptionsTabPage::Create( Window* pWindow,const SfxItemSet& rOutA return new PolarOptionsTabPage( pWindow, rOutAttrs ); } -BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) +sal_Bool PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) { if( m_aAngleDial.IsVisible() ) { @@ -80,44 +80,43 @@ BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) if (m_aCB_IncludeHiddenCells.IsVisible()) rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCB_IncludeHiddenCells.IsChecked())); - return TRUE; + return sal_True; } void PolarOptionsTabPage::Reset(const SfxItemSet& rInAttrs) { const SfxPoolItem *pPoolItem = NULL; - if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_STARTING_ANGLE, sal_True, &pPoolItem) == SFX_ITEM_SET) { long nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue(); - m_aAngleDial.SetRotation( nTmp*100 ); } else { - m_aFL_StartingAngle.Show(FALSE); - m_aAngleDial.Show(FALSE); - m_aNF_StartingAngle.Show(FALSE); - m_aFT_Degrees.Show(FALSE); + m_aFL_StartingAngle.Show(sal_False); + m_aAngleDial.Show(sal_False); + m_aNF_StartingAngle.Show(sal_False); + m_aFT_Degrees.Show(sal_False); } - if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_CLOCKWISE, sal_True, &pPoolItem) == SFX_ITEM_SET) { - BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); + sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); m_aCB_Clockwise.Check(bCheck); } else { - m_aCB_Clockwise.Show(FALSE); + m_aCB_Clockwise.Show(sal_False); } - if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_True, &pPoolItem) == SFX_ITEM_SET) { bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue(); m_aCB_IncludeHiddenCells.Check(bVal); } else { - m_aCB_IncludeHiddenCells.Show(FALSE); - m_aFL_PlotOptions.Show(FALSE); + m_aCB_IncludeHiddenCells.Show(sal_False); + m_aFL_PlotOptions.Show(sal_False); } } diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.hxx b/chart2/source/controller/dialogs/tp_PolarOptions.hxx index 73ade4a4cecb..51a0e5c9ec3c 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.hxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.hxx @@ -47,7 +47,7 @@ public: virtual ~PolarOptionsTabPage(); static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs); - virtual BOOL FillItemSet(SfxItemSet& rOutAttrs); + virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs); virtual void Reset(const SfxItemSet& rInAttrs); private: diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.src b/chart2/source/controller/dialogs/tp_PolarOptions.src index 237fa027b55f..96463a97341b 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.src +++ b/chart2/source/controller/dialogs/tp_PolarOptions.src @@ -30,12 +30,14 @@ TabPage TP_POLAROPTIONS { + HelpID = "chart2:TabPage:TP_POLAROPTIONS"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; CheckBox CB_CLOCKWISE { + HelpID = "chart2:CheckBox:TP_POLAROPTIONS:CB_CLOCKWISE"; Pos = MAP_APPFONT ( 12 , 8 ); Size = MAP_APPFONT ( 248 , 10 ); TabStop = TRUE; @@ -61,6 +63,7 @@ TabPage TP_POLAROPTIONS }; NumericField NF_STARTING_ANGLE { + HelpID = "chart2:NumericField:TP_POLAROPTIONS:NF_STARTING_ANGLE"; Pos = MAP_APPFONT ( 61 , 53 ) ; Size = MAP_APPFONT ( 28 , 12 ) ; Border = TRUE ; @@ -79,6 +82,7 @@ TabPage TP_POLAROPTIONS }; CheckBox CB_INCLUDE_HIDDEN_CELLS_POLAR { + HelpID = "chart2:CheckBox:TP_POLAROPTIONS:CB_INCLUDE_HIDDEN_CELLS_POLAR"; Pos = MAP_APPFONT ( 12 , 104 ) ; Size = MAP_APPFONT ( 200 , 10 ) ; TabStop = TRUE ; diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.cxx b/chart2/source/controller/dialogs/tp_RangeChooser.cxx index ee2ff7047285..9ae9ab4579fd 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.cxx +++ b/chart2/source/controller/dialogs/tp_RangeChooser.cxx @@ -49,7 +49,7 @@ namespace void lcl_ShowChooserButton( ::chart::RangeSelectionButton & rChooserButton, Edit & rEditField, - BOOL bShow ) + sal_Bool bShow ) { if( rChooserButton.IsVisible() != bShow ) { @@ -66,8 +66,8 @@ void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog ) { if( pDialog ) { - pDialog->Show( bEnable ? FALSE : TRUE ); - pDialog->SetModalInputMode( bEnable ? FALSE : TRUE ); + pDialog->Show( bEnable ? sal_False : sal_True ); + pDialog->SetModalInputMode( bEnable ? sal_False : sal_True ); } } void lcl_shiftControlY( Control & rControl, long nYOffset ) @@ -340,7 +340,7 @@ bool RangeChooserTabPage::isValid() m_aCB_FirstRowAsLabel.Enable( bIsValid ); m_aCB_FirstColumnAsLabel.Enable( bIsValid ); } - BOOL bShowIB = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection(); + sal_Bool bShowIB = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection(); lcl_ShowChooserButton( m_aIB_Range, m_aED_Range, bShowIB ); return bIsValid; @@ -365,7 +365,7 @@ IMPL_LINK( RangeChooserTabPage, ChooseRangeHdl, void *, EMPTYARG ) { rtl::OUString aRange = m_aED_Range.GetText(); // using assignment for broken gcc 3.3 - rtl::OUString aTitle = ::rtl::OUString( String( SchResId( STR_PAGE_DATA_RANGE ) )); + rtl::OUString aTitle = String( SchResId( STR_PAGE_DATA_RANGE ) ); lcl_enableRangeChoosing( true, m_pParentDialog ); m_rDialogModel.getRangeSelectionHelper()->chooseRange( aRange, aTitle, *this ); diff --git a/chart2/source/controller/dialogs/tp_RangeChooser.src b/chart2/source/controller/dialogs/tp_RangeChooser.src index de07c9763b7d..962722b41c71 100644 --- a/chart2/source/controller/dialogs/tp_RangeChooser.src +++ b/chart2/source/controller/dialogs/tp_RangeChooser.src @@ -37,6 +37,7 @@ TabPage TP_RANGECHOOSER { + HelpID = "chart2:TabPage:TP_RANGECHOOSER"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 248, 140 ) ; @@ -55,18 +56,21 @@ TabPage TP_RANGECHOOSER }; Edit ED_RANGE { + HelpID = "chart2:Edit:TP_RANGECHOOSER:ED_RANGE"; Border = TRUE ; Pos = MAP_APPFONT ( 6 , 32 ) ; Size = MAP_APPFONT ( 220 , 12 ) ; }; ImageButton IB_RANGE { + HelpID = "chart2:ImageButton:TP_RANGECHOOSER:IB_RANGE"; Pos = MAP_APPFONT ( 228 , 31 ) ; Size = MAP_APPFONT ( 14 , 14 ) ; TabStop = FALSE ; }; RadioButton RB_DATAROWS { + HelpID = "chart2:RadioButton:TP_RANGECHOOSER:RB_DATAROWS"; Pos = MAP_APPFONT ( 6 , 52 ) ; Size = MAP_APPFONT ( 236 , 10 ) ; TabStop = TRUE ; @@ -74,6 +78,7 @@ TabPage TP_RANGECHOOSER }; RadioButton RB_DATACOLS { + HelpID = "chart2:RadioButton:TP_RANGECHOOSER:RB_DATACOLS"; Pos = MAP_APPFONT ( 6 , 66 ) ; Size = MAP_APPFONT ( 236 , 10 ) ; TabStop = TRUE ; @@ -81,12 +86,14 @@ TabPage TP_RANGECHOOSER }; CheckBox CB_FIRST_ROW_ASLABELS { + HelpID = "chart2:CheckBox:TP_RANGECHOOSER:CB_FIRST_ROW_ASLABELS"; Pos = MAP_APPFONT ( 6 , 84 ) ; Size = MAP_APPFONT ( 236 , 10 ) ; Text [ en-US ] = "~First row as label" ; }; CheckBox CB_FIRST_COLUMN_ASLABELS { + HelpID = "chart2:CheckBox:TP_RANGECHOOSER:CB_FIRST_COLUMN_ASLABELS"; Pos = MAP_APPFONT ( 6 , 98 ) ; Size = MAP_APPFONT ( 236 , 10 ) ; Text [ en-US ] = "F~irst column as label" ; diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index a71a512e4a27..0eb9ae7bf047 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -29,9 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_chart2.hxx" #include "tp_Scale.hxx" +#include "tp_Scale.hrc" #include "ResId.hxx" -#include "TabPages.hrc" #include "Strings.hrc" #include "chartview/ChartSfxItemIds.hxx" #include "NoWarningThisInCTOR.hxx" @@ -71,6 +71,20 @@ namespace chart namespace { +void lcl_placeControlAtX( Control& rControl, long nNewXPos ) +{ + Point aPos( rControl.GetPosPixel() ); + aPos.X() = nNewXPos; + rControl.SetPosPixel(aPos); +} + +void lcl_placeControlAtY( Control& rControl, long nNewYPos ) +{ + Point aPos( rControl.GetPosPixel() ); + aPos.Y() = nNewYPos; + rControl.SetPosPixel(aPos); +} + void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos ) { Point aPos( rEdit.GetPosPixel() ); @@ -83,16 +97,15 @@ void lcl_shiftControls( Control& rEdit, Control& rAuto, long nNewXPos ) rAuto.SetPosPixel(aPos); } -void lcl_placeControlsAtY( Control& rTop, Control& rBottom, long nNewYPos ) +long lcl_getLabelDistance( Control& rControl ) { - Point aPos( rTop.GetPosPixel() ); - long nShift = nNewYPos - aPos.Y(); - aPos.Y() = nNewYPos; - rTop.SetPosPixel(aPos); + return rControl.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); +} - aPos = rBottom.GetPosPixel(); - aPos.Y() += nShift; - rBottom.SetPosPixel(aPos); +void lcl_setValue( FormattedField& rFmtField, double fValue ) +{ + rFmtField.SetValue( fValue ); + rFmtField.SetDefaultValue( fValue ); } } @@ -101,32 +114,51 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : SfxTabPage(pWindow, SchResId(TP_SCALE), rInAttrs), aFlScale(this, SchResId(FL_SCALE)), + + aCbxReverse(this, SchResId(CBX_REVERSE)), + aCbxLogarithm(this, SchResId(CBX_LOGARITHM)), + + m_aTxt_AxisType(this, SchResId (TXT_AXIS_TYPE)), + m_aLB_AxisType(this, SchResId(LB_AXIS_TYPE)), + aTxtMin (this, SchResId (TXT_MIN)), aFmtFldMin(this, SchResId(EDT_MIN)), aCbxAutoMin(this, SchResId(CBX_AUTO_MIN)), + aTxtMax(this, SchResId (TXT_MAX)), aFmtFldMax(this, SchResId(EDT_MAX)), aCbxAutoMax(this, SchResId(CBX_AUTO_MAX)), + + m_aTxt_TimeResolution(this, SchResId (TXT_TIME_RESOLUTION)), + m_aLB_TimeResolution(this, SchResId(LB_TIME_RESOLUTION)), + m_aCbx_AutoTimeResolution(this, SchResId(CBX_AUTO_TIME_RESOLUTION)), + aTxtMain (this, SchResId (TXT_STEP_MAIN)), aFmtFldStepMain(this, SchResId(EDT_STEP_MAIN)), + m_aMt_MainDateStep(this, SchResId(MT_MAIN_DATE_STEP)), + m_aLB_MainTimeUnit(this, SchResId(LB_MAIN_TIME_UNIT)), aCbxAutoStepMain(this, SchResId(CBX_AUTO_STEP_MAIN)), + + aTxtHelpCount (this, SchResId (TXT_STEP_HELP_COUNT)), aTxtHelp (this, SchResId (TXT_STEP_HELP)), aMtStepHelp (this, SchResId (MT_STEPHELP)), + m_aLB_HelpTimeUnit(this, SchResId(LB_HELP_TIME_UNIT)), aCbxAutoStepHelp(this, SchResId(CBX_AUTO_STEP_HELP)), aTxtOrigin (this, SchResId (TXT_ORIGIN)), aFmtFldOrigin(this, SchResId(EDT_ORIGIN)), aCbxAutoOrigin(this, SchResId(CBX_AUTO_ORIGIN)), - aCbxLogarithm(this, SchResId(CBX_LOGARITHM)), - aCbxReverse(this, SchResId(CBX_REVERSE)), - fMin(0.0), fMax(0.0), fStepMain(0.0), nStepHelp(0), fOrigin(0.0), - nAxisType(chart2::AxisType::REALNUMBER), + m_nTimeResolution(1), + m_nMainTimeUnit(1), + m_nHelpTimeUnit(1), + m_nAxisType(chart2::AxisType::REALNUMBER), + m_bAllowDateAxis(false), pNumFormatter(NULL), m_bShowAxisOrigin(false) { @@ -138,6 +170,26 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); aCbxAutoStepHelp.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); + m_aCbx_AutoTimeResolution.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); + + m_aLB_AxisType.SetDropDownLineCount(3); + m_aLB_AxisType.SetSelectHdl(LINK(this, ScaleTabPage, SelectAxisTypeHdl)); + + m_aLB_TimeResolution.SetDropDownLineCount(3); + m_aLB_MainTimeUnit.SetDropDownLineCount(3); + m_aLB_HelpTimeUnit.SetDropDownLineCount(3); + + aFmtFldMin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); + aFmtFldMax.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); + aFmtFldStepMain.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); + aFmtFldOrigin.SetModifyHdl(LINK(this, ScaleTabPage, FmtFieldModifiedHdl)); +} + +IMPL_LINK( ScaleTabPage, FmtFieldModifiedHdl, FormattedField*, pFmtFied ) +{ + if( pFmtFied ) + pFmtFied->SetDefaultValue( pFmtFied->GetValue() ); + return 0; } void ScaleTabPage::StateChanged( StateChangedType nType ) @@ -154,10 +206,13 @@ void ScaleTabPage::AdjustControlPositions() long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() ); nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth ); nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth = ::std::max( aTxtHelpCount.CalcMinimumSize().Width(), nLabelWidth ); nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth = ::std::max( m_aTxt_TimeResolution.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth = ::std::max( m_aTxt_AxisType.CalcMinimumSize().Width(), nLabelWidth ); nLabelWidth+=1; - long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); + long nLabelDistance = lcl_getLabelDistance(aTxtMin); long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance; //ensure that the auto checkboxes are wide enough and have correct size for calculation @@ -166,9 +221,10 @@ void ScaleTabPage::AdjustControlPositions() aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() ); aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() ); aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() ); + m_aCbx_AutoTimeResolution.SetSizePixel( m_aCbx_AutoTimeResolution.CalcMinimumSize() ); //ensure new pos is ok - long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X(); + long nWidthOfOtherControls = m_aLB_MainTimeUnit.GetPosPixel().X() + m_aLB_MainTimeUnit.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X(); long nDialogWidth = GetSizePixel().Width(); long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls; @@ -180,85 +236,201 @@ void ScaleTabPage::AdjustControlPositions() aTxtMax.SetSizePixel(aSize); aTxtMain.SetSizePixel(aSize); aTxtHelp.SetSizePixel(aSize); + aTxtHelpCount.SetSizePixel(aSize); aTxtOrigin.SetSizePixel(aSize); + m_aTxt_TimeResolution.SetSizePixel(aSize); + m_aTxt_AxisType.SetSizePixel(aSize); + + long nOrgAutoCheckX = aCbxAutoMin.GetPosPixel().X(); + lcl_placeControlAtX( aCbxAutoStepMain, nOrgAutoCheckX ); + lcl_placeControlAtX( aCbxAutoStepHelp, nOrgAutoCheckX ); lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos ); lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos ); lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos ); + lcl_placeControlAtX( m_aMt_MainDateStep, aFmtFldStepMain.GetPosPixel().X() ); lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos ); lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos ); + lcl_shiftControls( m_aLB_TimeResolution, m_aCbx_AutoTimeResolution, nNewXPos ); + lcl_placeControlAtX( m_aLB_AxisType, nNewXPos ); + + nNewXPos = aCbxAutoStepMain.GetPosPixel().X() + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance; + lcl_placeControlAtX( m_aLB_MainTimeUnit, nNewXPos ); + lcl_placeControlAtX( m_aLB_HelpTimeUnit, nNewXPos ); } + PlaceIntervalControlsAccordingToAxisType(); } -void ScaleTabPage::EnableControls() +void ScaleTabPage::PlaceIntervalControlsAccordingToAxisType() { - bool bEnableForValueOrPercentAxis = chart2::AxisType::REALNUMBER == nAxisType || chart2::AxisType::PERCENT == nAxisType; - aFlScale.Enable( bEnableForValueOrPercentAxis ); - aTxtMin.Enable( bEnableForValueOrPercentAxis ); - aFmtFldMin.Enable( bEnableForValueOrPercentAxis ); - aCbxAutoMin.Enable( bEnableForValueOrPercentAxis ); - aTxtMax.Enable( bEnableForValueOrPercentAxis ); - aFmtFldMax.Enable( bEnableForValueOrPercentAxis ); - aCbxAutoMax.Enable( bEnableForValueOrPercentAxis ); - aTxtMain.Enable( bEnableForValueOrPercentAxis ); - aFmtFldStepMain.Enable( bEnableForValueOrPercentAxis ); - aCbxAutoStepMain.Enable( bEnableForValueOrPercentAxis ); - aTxtHelp.Enable( bEnableForValueOrPercentAxis ); - aMtStepHelp.Enable( bEnableForValueOrPercentAxis ); - aCbxAutoStepHelp.Enable( bEnableForValueOrPercentAxis ); - aCbxLogarithm.Enable( bEnableForValueOrPercentAxis ); - - aTxtOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis ); - aFmtFldOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis ); - aCbxAutoOrigin.Show( m_bShowAxisOrigin && bEnableForValueOrPercentAxis ); - - long nNewYPos = aTxtOrigin.GetPosPixel().Y(); - if( m_bShowAxisOrigin ) - nNewYPos += ( aTxtOrigin.GetPosPixel().Y() - aTxtHelp.GetPosPixel().Y() ); - lcl_placeControlsAtY( aCbxLogarithm, aCbxReverse, nNewYPos ); + long nMinX = std::min( aCbxAutoStepMain.GetPosPixel().X(), m_aLB_MainTimeUnit.GetPosPixel().X() ); + long nLabelDistance = lcl_getLabelDistance(aTxtMin); + long nListWidth = m_aLB_MainTimeUnit.GetSizePixel().Width(); + + if( chart2::AxisType::DATE == m_nAxisType ) + { + lcl_placeControlAtX( m_aLB_MainTimeUnit, nMinX ); + lcl_placeControlAtX( m_aLB_HelpTimeUnit, nMinX ); + long nSecondX = nMinX + nListWidth + nLabelDistance; + lcl_placeControlAtX( aCbxAutoStepMain, nSecondX ); + lcl_placeControlAtX( aCbxAutoStepHelp, nSecondX ); + + long nOne = m_aMt_MainDateStep.LogicToPixel( Size(0, 1), MapMode(MAP_APPFONT) ).Height(); + + long nYMajor = m_aMt_MainDateStep.GetPosPixel().Y(); + lcl_placeControlAtY( aCbxAutoStepMain , nYMajor+(3*nOne)); + lcl_placeControlAtY( aTxtMain , nYMajor+nOne+nOne); + + long nYMinor = m_aLB_HelpTimeUnit.GetPosPixel().Y(); + lcl_placeControlAtY( aMtStepHelp , nYMinor ); + lcl_placeControlAtY( aCbxAutoStepHelp , nYMinor+(3*nOne)); + } + else + { + lcl_placeControlAtX( aCbxAutoStepMain, nMinX ); + lcl_placeControlAtX( aCbxAutoStepHelp, nMinX ); + long nSecondX = nMinX + aCbxAutoStepMain.GetSizePixel().Width() + nLabelDistance; + long nSecondXMax = GetSizePixel().Width() - nListWidth; + if( nSecondX > nSecondXMax ) + nSecondX = nSecondXMax; + lcl_placeControlAtX( m_aLB_MainTimeUnit, nSecondX ); + lcl_placeControlAtX( m_aLB_HelpTimeUnit, nSecondX ); + } } +void ScaleTabPage::EnableControls() +{ + bool bValueAxis = chart2::AxisType::REALNUMBER == m_nAxisType || chart2::AxisType::PERCENT == m_nAxisType || chart2::AxisType::DATE == m_nAxisType; + bool bDateAxis = chart2::AxisType::DATE == m_nAxisType; + + m_aTxt_AxisType.Show(m_bAllowDateAxis); + m_aLB_AxisType.Show(m_bAllowDateAxis); + + aCbxLogarithm.Show( bValueAxis && !bDateAxis ); + aTxtMin.Show( bValueAxis ); + aFmtFldMin.Show( bValueAxis ); + aCbxAutoMin.Show( bValueAxis ); + aTxtMax.Show( bValueAxis ); + aFmtFldMax.Show( bValueAxis ); + aCbxAutoMax.Show( bValueAxis ); + aTxtMain.Show( bValueAxis ); + aFmtFldStepMain.Show( bValueAxis ); + aCbxAutoStepMain.Show( bValueAxis ); + aTxtHelp.Show( bValueAxis ); + aTxtHelpCount.Show( bValueAxis ); + aMtStepHelp.Show( bValueAxis ); + aCbxAutoStepHelp.Show( bValueAxis ); + + aTxtOrigin.Show( m_bShowAxisOrigin && bValueAxis ); + aFmtFldOrigin.Show( m_bShowAxisOrigin && bValueAxis ); + aCbxAutoOrigin.Show( m_bShowAxisOrigin && bValueAxis ); + + aTxtHelpCount.Show( bValueAxis && !bDateAxis ); + aTxtHelp.Show( bDateAxis ); + + m_aTxt_TimeResolution.Show( bDateAxis ); + m_aLB_TimeResolution.Show( bDateAxis ); + m_aCbx_AutoTimeResolution.Show( bDateAxis ); + + bool bWasDateAxis = m_aMt_MainDateStep.IsVisible(); + if( bWasDateAxis != bDateAxis ) + { + //transport value from one to other control + if( bWasDateAxis ) + lcl_setValue( aFmtFldStepMain, m_aMt_MainDateStep.GetValue() ); + else + m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(aFmtFldStepMain.GetValue()) ); + } + aFmtFldStepMain.Show( bValueAxis && !bDateAxis ); + m_aMt_MainDateStep.Show( bDateAxis ); + + m_aLB_MainTimeUnit.Show( bDateAxis ); + m_aLB_HelpTimeUnit.Show( bDateAxis ); + EnableValueHdl(&aCbxAutoMin); + EnableValueHdl(&aCbxAutoMax); + EnableValueHdl(&aCbxAutoStepMain); + EnableValueHdl(&aCbxAutoStepHelp); + EnableValueHdl(&aCbxAutoOrigin); + EnableValueHdl(&m_aCbx_AutoTimeResolution); +} IMPL_LINK( ScaleTabPage, EnableValueHdl, CheckBox *, pCbx ) { + bool bEnable = pCbx && !pCbx->IsChecked() && pCbx->IsEnabled(); if (pCbx == &aCbxAutoMin) { - aFmtFldMin.Enable(!aCbxAutoMin.IsChecked()); + aFmtFldMin.Enable( bEnable ); } else if (pCbx == &aCbxAutoMax) { - aFmtFldMax.Enable(!aCbxAutoMax.IsChecked()); + aFmtFldMax.Enable( bEnable ); } else if (pCbx == &aCbxAutoStepMain) { - aFmtFldStepMain.Enable(!aCbxAutoStepMain.IsChecked()); + aFmtFldStepMain.Enable( bEnable ); + m_aMt_MainDateStep.Enable( bEnable ); + m_aLB_MainTimeUnit.Enable( bEnable ); } else if (pCbx == &aCbxAutoStepHelp) { - aMtStepHelp.Show (); - aMtStepHelp.Enable( ! aCbxAutoStepHelp.IsChecked() ); + aMtStepHelp.Enable( bEnable ); + m_aLB_HelpTimeUnit.Enable( bEnable ); + } + else if (pCbx == &m_aCbx_AutoTimeResolution) + { + m_aLB_TimeResolution.Enable( bEnable ); } else if (pCbx == &aCbxAutoOrigin) { - aFmtFldOrigin.Enable(!aCbxAutoOrigin.IsChecked()); + aFmtFldOrigin.Enable( bEnable ); } return 0; } +enum AxisTypeListBoxEntry +{ + TYPE_AUTO=0, + TYPE_TEXT=1, + TYPE_DATE=2 +}; + +IMPL_LINK( ScaleTabPage, SelectAxisTypeHdl, void *, EMPTYARG ) +{ + sal_uInt16 nPos = m_aLB_AxisType.GetSelectEntryPos(); + if( nPos==TYPE_DATE ) + m_nAxisType = chart2::AxisType::DATE; + else + m_nAxisType = chart2::AxisType::CATEGORY; + if( chart2::AxisType::DATE == m_nAxisType ) + aCbxLogarithm.Check(false); + EnableControls(); + PlaceIntervalControlsAccordingToAxisType(); + SetNumFormat(); + return 0; +} + SfxTabPage* ScaleTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs) { return new ScaleTabPage(pWindow, rOutAttrs); } -BOOL ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs) +sal_Bool ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs) { DBG_ASSERT( pNumFormatter, "No NumberFormatter available" ); - rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,aCbxAutoMin.IsChecked())); - rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,aCbxAutoMax.IsChecked())); - rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,aCbxAutoStepHelp.IsChecked())); - rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,aCbxAutoOrigin.IsChecked())); + rOutAttrs.Put(SfxInt32Item(SCHATTR_AXISTYPE, m_nAxisType)); + if(m_bAllowDateAxis) + rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_DATEAXIS, TYPE_AUTO==m_aLB_AxisType.GetSelectEntryPos())); + + bool bAutoScale = false; + if( m_nAxisType==chart2::AxisType::CATEGORY ) + bAutoScale = true;//reset scaling for category charts + + rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MIN ,bAutoScale || aCbxAutoMin.IsChecked())); + rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_MAX ,bAutoScale || aCbxAutoMax.IsChecked())); + rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_HELP,bAutoScale || aCbxAutoStepHelp.IsChecked())); + rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_ORIGIN ,bAutoScale || aCbxAutoOrigin.IsChecked())); rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_LOGARITHM ,aCbxLogarithm.IsChecked())); rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_REVERSE ,aCbxReverse.IsChecked())); rOutAttrs.Put(SvxDoubleItem(fMax , SCHATTR_AXIS_MAX)); @@ -266,10 +438,16 @@ BOOL ScaleTabPage::FillItemSet(SfxItemSet& rOutAttrs) rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_STEP_HELP, nStepHelp)); rOutAttrs.Put(SvxDoubleItem(fOrigin , SCHATTR_AXIS_ORIGIN)); - rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,aCbxAutoStepMain.IsChecked())); + rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_STEP_MAIN,bAutoScale || aCbxAutoStepMain.IsChecked())); rOutAttrs.Put(SvxDoubleItem(fStepMain,SCHATTR_AXIS_STEP_MAIN)); - return TRUE; + rOutAttrs.Put(SfxBoolItem(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,bAutoScale || m_aCbx_AutoTimeResolution.IsChecked())); + rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TIME_RESOLUTION,m_nTimeResolution)); + + rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_MAIN_TIME_UNIT,m_nMainTimeUnit)); + rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELP_TIME_UNIT,m_nHelpTimeUnit)); + + return sal_True; } void ScaleTabPage::Reset(const SfxItemSet& rInAttrs) @@ -279,63 +457,110 @@ void ScaleTabPage::Reset(const SfxItemSet& rInAttrs) return; const SfxPoolItem *pPoolItem = NULL; - nAxisType=chart2::AxisType::REALNUMBER; - if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_ALLOW_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET) + m_bAllowDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue(); + m_nAxisType=chart2::AxisType::REALNUMBER; + if (rInAttrs.GetItemState(SCHATTR_AXISTYPE, sal_True, &pPoolItem) == SFX_ITEM_SET) + m_nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue(); + if( m_nAxisType==chart2::AxisType::DATE && !m_bAllowDateAxis ) + m_nAxisType=chart2::AxisType::CATEGORY; + if( m_bAllowDateAxis ) { - nAxisType = (int) ((const SfxInt32Item*)pPoolItem)->GetValue(); - EnableControls(); + bool bAutoDateAxis = false; + if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_DATEAXIS, sal_True, &pPoolItem) == SFX_ITEM_SET) + bAutoDateAxis = (bool) ((const SfxBoolItem*)pPoolItem)->GetValue(); + + sal_uInt16 nPos = 0; + if( m_nAxisType==chart2::AxisType::DATE ) + nPos=TYPE_DATE; + else if( bAutoDateAxis ) + nPos=TYPE_AUTO; + else + nPos=TYPE_TEXT; + m_aLB_AxisType.SelectEntryPos( nPos ); } - if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,TRUE,&pPoolItem) == SFX_ITEM_SET) + if( m_bAllowDateAxis ) + aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:MayBeDateAxis"); + else if( m_nAxisType==chart2::AxisType::CATEGORY || m_nAxisType==chart2::AxisType::SERIES ) + aCbxReverse.SetHelpId("chart2:CheckBox:TP_SCALE:CBX_REVERSE:Category"); + + PlaceIntervalControlsAccordingToAxisType(); + + aCbxAutoMin.Check( true ); + aCbxAutoMax.Check( true ); + aCbxAutoStepMain.Check( true ); + aCbxAutoStepHelp.Check( true ); + aCbxAutoOrigin.Check( true ); + m_aCbx_AutoTimeResolution.Check( true ); + + if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MIN,sal_True,&pPoolItem) == SFX_ITEM_SET) aCbxAutoMin.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); - if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_MIN,sal_True, &pPoolItem) == SFX_ITEM_SET) { fMin = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldMin.SetValue( fMin ); + lcl_setValue( aFmtFldMin, fMin ); } - if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET) aCbxAutoMax.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); - if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_MAX,sal_True, &pPoolItem) == SFX_ITEM_SET) { fMax = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldMax.SetValue( fMax ); + lcl_setValue( aFmtFldMax, fMax ); } - if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET) aCbxAutoStepMain.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); - if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_MAIN,sal_True, &pPoolItem) == SFX_ITEM_SET) { fStepMain = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldStepMain.SetValue( fStepMain ); + lcl_setValue( aFmtFldStepMain, fStepMain ); + m_aMt_MainDateStep.SetValue( static_cast<sal_Int32>(fStepMain) ); } - if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_STEP_HELP,sal_True, &pPoolItem) == SFX_ITEM_SET) aCbxAutoStepHelp.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); - if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_LOGARITHM,sal_True, &pPoolItem) == SFX_ITEM_SET) aCbxLogarithm.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); - if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_REVERSE,sal_True, &pPoolItem) == SFX_ITEM_SET) aCbxReverse.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); - if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_STEP_HELP,sal_True, &pPoolItem) == SFX_ITEM_SET) { nStepHelp = ((const SfxInt32Item*)pPoolItem)->GetValue(); aMtStepHelp.SetValue( nStepHelp ); } - if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET) aCbxAutoOrigin.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); - if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_ORIGIN,sal_True, &pPoolItem) == SFX_ITEM_SET) { fOrigin = ((const SvxDoubleItem*)pPoolItem)->GetValue(); - aFmtFldOrigin.SetValue( fOrigin ); + lcl_setValue( aFmtFldOrigin, fOrigin ); } - EnableValueHdl(&aCbxAutoMin); - EnableValueHdl(&aCbxAutoMax); - EnableValueHdl(&aCbxAutoStepMain); - EnableValueHdl(&aCbxAutoStepHelp); - EnableValueHdl(&aCbxAutoOrigin); + if (rInAttrs.GetItemState(SCHATTR_AXIS_AUTO_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET) + m_aCbx_AutoTimeResolution.Check(((const SfxBoolItem*)pPoolItem)->GetValue()); + if (rInAttrs.GetItemState(SCHATTR_AXIS_TIME_RESOLUTION,sal_True, &pPoolItem) == SFX_ITEM_SET) + { + m_nTimeResolution = ((const SfxInt32Item*)pPoolItem)->GetValue(); + m_aLB_TimeResolution.SelectEntryPos( m_nTimeResolution ); + } + + if (rInAttrs.GetItemState(SCHATTR_AXIS_MAIN_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET) + { + m_nMainTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue(); + m_aLB_MainTimeUnit.SelectEntryPos( m_nMainTimeUnit ); + } + if (rInAttrs.GetItemState(SCHATTR_AXIS_HELP_TIME_UNIT,sal_True, &pPoolItem) == SFX_ITEM_SET) + { + m_nHelpTimeUnit = ((const SfxInt32Item*)pPoolItem)->GetValue(); + m_aLB_HelpTimeUnit.SelectEntryPos( m_nHelpTimeUnit ); + } + + EnableControls(); + SetNumFormat(); } int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet) @@ -346,84 +571,116 @@ int ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet) return LEAVE_PAGE; } + bool bDateAxis = chart2::AxisType::DATE == m_nAxisType; + sal_uInt32 nIndex = pNumFormatter->GetStandardIndex(LANGUAGE_SYSTEM); const SfxPoolItem *pPoolItem = NULL; - if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET ) nIndex = static_cast< sal_uInt32 >( static_cast< const SfxInt32Item* >(pPoolItem)->GetValue()); else { OSL_FAIL( "Using Standard Language" ); } - Edit* pEdit = NULL; - USHORT nErrStrId = 0; + Control* pControl = NULL; + sal_uInt16 nErrStrId = 0; double fDummy; fMax = aFmtFldMax.GetValue(); fMin = aFmtFldMin.GetValue(); fOrigin = aFmtFldOrigin.GetValue(); - fStepMain = aFmtFldStepMain.GetValue(); + fStepMain = bDateAxis ? m_aMt_MainDateStep.GetValue() : aFmtFldStepMain.GetValue(); nStepHelp = static_cast< sal_Int32 >( aMtStepHelp.GetValue()); + m_nTimeResolution = m_aLB_TimeResolution.GetSelectEntryPos(); + m_nMainTimeUnit = m_aLB_MainTimeUnit.GetSelectEntryPos(); + m_nHelpTimeUnit = m_aLB_HelpTimeUnit.GetSelectEntryPos(); + + if( chart2::AxisType::REALNUMBER != m_nAxisType ) + aCbxLogarithm.Show( false ); + + //check wich entries need user action - //do some reasonable automatic correction of user input if necessary - if (!aCbxAutoMax.IsChecked() && !aCbxAutoMin.IsChecked() && - fMin >= fMax) - { - pEdit = &aFmtFldMin; - nErrStrId = STR_MIN_GREATER_MAX; - } - // check for entries in invalid ranges if ( aCbxLogarithm.IsChecked() && ( ( !aCbxAutoMin.IsChecked() && fMin <= 0.0 ) || ( !aCbxAutoMax.IsChecked() && fMax <= 0.0 ) ) ) { - pEdit = &aFmtFldMin; + pControl = &aFmtFldMin; nErrStrId = STR_BAD_LOGARITHM; } - if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0) + else if (!aCbxAutoMax.IsChecked() && !aCbxAutoMin.IsChecked() && + fMin >= fMax) + { + pControl = &aFmtFldMin; + nErrStrId = STR_MIN_GREATER_MAX; + } + else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0) { - pEdit = &aFmtFldStepMain; + pControl = &aFmtFldStepMain; nErrStrId = STR_STEP_GT_ZERO; } - - //check wich entries need user action - // check for entries that cannot be parsed for the current number format - if ( aFmtFldMin.IsModified() + else if ( aFmtFldMin.IsModified() && !aCbxAutoMin.IsChecked() && !pNumFormatter->IsNumberFormat(aFmtFldMin.GetText(), nIndex, fDummy)) { - pEdit = &aFmtFldMin; + pControl = &aFmtFldMin; nErrStrId = STR_INVALID_NUMBER; } else if (aFmtFldMax.IsModified() && !aCbxAutoMax.IsChecked() && !pNumFormatter->IsNumberFormat(aFmtFldMax.GetText(), nIndex, fDummy)) { - pEdit = &aFmtFldMax; + pControl = &aFmtFldMax; nErrStrId = STR_INVALID_NUMBER; } - else if (aFmtFldStepMain.IsModified() && !aCbxAutoStepMain.IsChecked() && + else if ( !bDateAxis && aFmtFldStepMain.IsModified() && !aCbxAutoStepMain.IsChecked() && !pNumFormatter->IsNumberFormat(aFmtFldStepMain.GetText(), nIndex, fDummy)) { - pEdit = &aFmtFldStepMain; + pControl = &aFmtFldStepMain; nErrStrId = STR_STEP_GT_ZERO; } else if (aFmtFldOrigin.IsModified() && !aCbxAutoOrigin.IsChecked() && !pNumFormatter->IsNumberFormat(aFmtFldOrigin.GetText(), nIndex, fDummy)) { - pEdit = &aFmtFldOrigin; + pControl = &aFmtFldOrigin; nErrStrId = STR_INVALID_NUMBER; } else if (!aCbxAutoStepMain.IsChecked() && fStepMain <= 0.0) { - pEdit = &aFmtFldStepMain; + pControl = &aFmtFldStepMain; nErrStrId = STR_STEP_GT_ZERO; } + else if( bDateAxis ) + { + if( !aCbxAutoStepMain.IsChecked() && !aCbxAutoStepHelp.IsChecked() ) + { + if( m_nHelpTimeUnit > m_nMainTimeUnit ) + { + pControl = &m_aLB_MainTimeUnit; + nErrStrId = STR_INVALID_INTERVALS; + } + else if( m_nHelpTimeUnit == m_nMainTimeUnit && nStepHelp > fStepMain ) + { + pControl = &m_aLB_MainTimeUnit; + nErrStrId = STR_INVALID_INTERVALS; + } + } + if( !nErrStrId && !m_aCbx_AutoTimeResolution.IsChecked() ) + { + if( (!aCbxAutoStepMain.IsChecked() && m_nTimeResolution > m_nMainTimeUnit ) + || + (!aCbxAutoStepHelp.IsChecked() && m_nTimeResolution > m_nHelpTimeUnit ) + ) + { + pControl = &m_aLB_TimeResolution; + nErrStrId = STR_INVALID_TIME_UNIT; + } + } + } - if( ShowWarning( nErrStrId, pEdit ) ) + if( ShowWarning( nErrStrId, pControl ) ) return KEEP_PAGE; if( pItemSet ) @@ -456,9 +713,9 @@ void ScaleTabPage::SetNumFormat() { const SfxPoolItem *pPoolItem = NULL; - if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET ) { - ULONG nFmt = (ULONG)((const SfxInt32Item*)pPoolItem)->GetValue(); + sal_uLong nFmt = (sal_uLong)((const SfxInt32Item*)pPoolItem)->GetValue(); aFmtFldMax.SetFormatKey( nFmt ); aFmtFldMin.SetFormatKey( nFmt ); @@ -485,6 +742,19 @@ void ScaleTabPage::SetNumFormat() else nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_TIME ); } + + if( chart2::AxisType::DATE == m_nAxisType && ( eType != NUMBERFORMAT_DATE && eType != NUMBERFORMAT_DATETIME) ) + { + const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt ); + if( pFormat ) + nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE, pFormat->GetLanguage() ); + else + nFmt = pNumFormatter->GetStandardFormat( NUMBERFORMAT_DATE ); + + aFmtFldMax.SetFormatKey( nFmt ); + aFmtFldMin.SetFormatKey( nFmt ); + aFmtFldOrigin.SetFormatKey( nFmt ); + } } aFmtFldStepMain.SetFormatKey( nFmt ); @@ -498,7 +768,7 @@ void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin ) m_bShowAxisOrigin = true; } -bool ScaleTabPage::ShowWarning( USHORT nResIdMessage, Edit * pControl /* = NULL */ ) +bool ScaleTabPage::ShowWarning( sal_uInt16 nResIdMessage, Control* pControl /* = NULL */ ) { if( nResIdMessage == 0 ) return false; @@ -507,7 +777,9 @@ bool ScaleTabPage::ShowWarning( USHORT nResIdMessage, Edit * pControl /* = NULL if( pControl ) { pControl->GrabFocus(); - pControl->SetSelection( Selection( 0, SELECTION_MAX )); + Edit* pEdit = dynamic_cast<Edit*>(pControl); + if(pEdit) + pEdit->SetSelection( Selection( 0, SELECTION_MAX )); } return true; } diff --git a/chart2/source/controller/dialogs/tp_Scale.hrc b/chart2/source/controller/dialogs/tp_Scale.hrc new file mode 100644 index 000000000000..4e40ca586fcc --- /dev/null +++ b/chart2/source/controller/dialogs/tp_Scale.hrc @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "ResourceIds.hrc" + +#define FL_SCALE 1 + +#define TXT_MIN 1 +#define TXT_MAX 2 +#define TXT_STEP_MAIN 3 +#define TXT_STEP_HELP_COUNT 4 +#define TXT_ORIGIN 5 +#define TXT_TIME_RESOLUTION 6 +#define TXT_AXIS_TYPE 7 +#define TXT_STEP_HELP 8 + +#define CBX_AUTO_MIN 1 +#define CBX_AUTO_MAX 2 +#define CBX_AUTO_STEP_MAIN 3 +#define CBX_AUTO_STEP_HELP 4 +#define CBX_AUTO_ORIGIN 5 +#define CBX_LOGARITHM 6 +#define CBX_REVERSE 7 +#define CBX_AUTO_TIME_RESOLUTION 8 + +#define EDT_STEP_MAIN 1 +#define EDT_MAX 2 +#define EDT_MIN 3 +#define EDT_ORIGIN 4 + +#define MT_STEPHELP 10 +#define MT_MAIN_DATE_STEP 11 + +#define LB_AXIS_TYPE 1 +#define LB_MAIN_TIME_UNIT 2 +#define LB_HELP_TIME_UNIT 3 +#define LB_TIME_RESOLUTION 4 + diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx index 47745657dd53..f062ed438383 100644 --- a/chart2/source/controller/dialogs/tp_Scale.hxx +++ b/chart2/source/controller/dialogs/tp_Scale.hxx @@ -38,6 +38,8 @@ #include <vcl/button.hxx> // header for MetricField #include <vcl/field.hxx> +// header for class ListBox +#include <vcl/lstbox.hxx> //............................................................................. namespace chart @@ -50,7 +52,7 @@ public: ScaleTabPage( Window* pParent, const SfxItemSet& rInAttrs ); static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); - virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); + virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs ); virtual void Reset( const SfxItemSet& rInAttrs ); using TabPage::DeactivatePage; virtual int DeactivatePage( SfxItemSet* pItemSet = NULL ); @@ -65,6 +67,13 @@ public: private: FixedLine aFlScale; + CheckBox aCbxReverse; + + CheckBox aCbxLogarithm; + + FixedText m_aTxt_AxisType; + ListBox m_aLB_AxisType; + FixedText aTxtMin; FormattedField aFmtFldMin; CheckBox aCbxAutoMin; @@ -73,35 +82,47 @@ private: FormattedField aFmtFldMax; CheckBox aCbxAutoMax; + FixedText m_aTxt_TimeResolution; + ListBox m_aLB_TimeResolution; + CheckBox m_aCbx_AutoTimeResolution; + FixedText aTxtMain; FormattedField aFmtFldStepMain; + MetricField m_aMt_MainDateStep; + ListBox m_aLB_MainTimeUnit; CheckBox aCbxAutoStepMain; + FixedText aTxtHelpCount; FixedText aTxtHelp; MetricField aMtStepHelp; + ListBox m_aLB_HelpTimeUnit; CheckBox aCbxAutoStepHelp; FixedText aTxtOrigin; FormattedField aFmtFldOrigin; CheckBox aCbxAutoOrigin; - CheckBox aCbxLogarithm; - CheckBox aCbxReverse; - double fMin; double fMax; double fStepMain; sal_Int32 nStepHelp; double fOrigin; - int nAxisType; + sal_Int32 m_nTimeResolution; + sal_Int32 m_nMainTimeUnit; + sal_Int32 m_nHelpTimeUnit; + int m_nAxisType; + bool m_bAllowDateAxis; SvNumberFormatter* pNumFormatter; bool m_bShowAxisOrigin; void AdjustControlPositions(); void EnableControls(); + void PlaceIntervalControlsAccordingToAxisType(); + DECL_LINK( SelectAxisTypeHdl, void* ); DECL_LINK( EnableValueHdl, CheckBox* ); + DECL_LINK( FmtFieldModifiedHdl, FormattedField* ); /** shows a warning window due to an invalid input. @@ -116,7 +137,7 @@ private: @return false, if nResIdMessage was 0, true otherwise */ - bool ShowWarning( USHORT nResIdMessage, Edit * pControl = NULL ); + bool ShowWarning( sal_uInt16 nResIdMessage, Control* pControl = NULL ); }; //............................................................................. diff --git a/chart2/source/controller/dialogs/tp_Scale.src b/chart2/source/controller/dialogs/tp_Scale.src index e0705fc32083..eb27b586f24b 100644..100755 --- a/chart2/source/controller/dialogs/tp_Scale.src +++ b/chart2/source/controller/dialogs/tp_Scale.src @@ -25,7 +25,7 @@ * ************************************************************************/ #include "HelpIds.hrc" -#include "TabPages.hrc" +#include "tp_Scale.hrc" #define YLine1 3 #define Y1 (YLine1+13) @@ -33,19 +33,30 @@ #define Y3 (Y2+16) #define Y4 (Y3+16) #define Y5 (Y4+16) -#define Y6 (Y5+17) -#define Y7 (Y6+15) +#define Y6 (Y5+16) +#define Y7 (Y6+16) +#define Y8 (Y7+16) #define LABELWIDTH 88 -#define AUTOCHECKWIDTH 88 +#define AUTOCHECKWIDTH 41 #define EDITWIDTH 50 #define X1 6 #define X2 11 #define X3 (X2+LABELWIDTH+4) #define X4 (X3+EDITWIDTH+5) +#define X5 (X4+AUTOCHECKWIDTH+5) + +#define STR_LIST_TIME_UNIT \ + StringList [ en-US ] = \ + { \ + "Days" ; \ + "Months" ; \ + "Years" ; \ + }; TabPage TP_SCALE { + HelpID = "chart2:TabPage:TP_SCALE"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; @@ -57,25 +68,71 @@ TabPage TP_SCALE Text [ en-US ] = "Scale" ; }; - FixedText TXT_MIN + CheckBox CBX_REVERSE { + HelpID = "chart2:CheckBox:TP_SCALE:CBX_REVERSE:ValueAxis"; Pos = MAP_APPFONT ( X2 , Y1 ) ; + Size = MAP_APPFONT ( 244 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Reverse direction" ; + }; + //--------------------------- + CheckBox CBX_LOGARITHM + { + HelpID = "chart2:CheckBox:TP_SCALE:CBX_LOGARITHM"; + Pos = MAP_APPFONT ( X2 , Y2 ) ; + Size = MAP_APPFONT ( 244 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Logarithmic scale" ; + }; + //--------------------------- + FixedText TXT_AXIS_TYPE + { + Pos = MAP_APPFONT ( X2 , Y2 ) ; Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; - Text [ en-US ] = "~Minimum:" ; + Text [ en-US ] = "T~ype" ; + }; + ListBox LB_AXIS_TYPE + { + HelpID = "chart2:ListBox:TP_SCALE:LB_AXIS_TYPE"; + Border = TRUE ; + AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( X3 , Y2-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown=TRUE; + DDExtraWidth = TRUE ; + + StringList [ en-US ] = + { + "Automatic" ; + "Text" ; + "Date" ; + }; + }; + //--------------------------- + FixedText TXT_MIN + { + Pos = MAP_APPFONT ( X2 , Y3 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; + Text [ en-US ] = "~Minimum" ; }; SpinField EDT_MIN { + HelpID = "chart2:SpinField:TP_SCALE:EDT_MIN"; Border = TRUE ; SVLook = TRUE ; - Pos = MAP_APPFONT ( X3 , Y1-2 ) ; + Pos = MAP_APPFONT ( X3 , Y3-2 ) ; Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; }; CheckBox CBX_AUTO_MIN { - Pos = MAP_APPFONT ( X4 , Y1-1 ) ; + HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_MIN"; + Pos = MAP_APPFONT ( X4 , Y3+1 ) ; Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "~Automatic" ; @@ -83,62 +140,134 @@ TabPage TP_SCALE FixedText TXT_MAX { - Pos = MAP_APPFONT ( X2 , Y2 ) ; + Pos = MAP_APPFONT ( X2 , Y4 ) ; Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; - Text [ en-US ] = "Ma~ximum:" ; + Text [ en-US ] = "Ma~ximum" ; }; SpinField EDT_MAX { + HelpID = "chart2:SpinField:TP_SCALE:EDT_MAX"; Border = TRUE ; SVLook = TRUE ; - Pos = MAP_APPFONT ( X3 , Y2-2 ) ; + Pos = MAP_APPFONT ( X3 , Y4-2 ) ; Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; }; CheckBox CBX_AUTO_MAX { - Pos = MAP_APPFONT ( X4 , Y2-1 ) ; + HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_MAX"; + Pos = MAP_APPFONT ( X4 , Y4+1 ) ; Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "A~utomatic" ; }; + //--------------------------- + FixedText TXT_TIME_RESOLUTION + { + Pos = MAP_APPFONT ( X2 , Y5 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; + Text [ en-US ] = "R~esolution" ; + }; + ListBox LB_TIME_RESOLUTION + { + HelpID = "chart2:ListBox:TP_SCALE:LB_TIME_RESOLUTION"; + Border = TRUE ; + AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( X3 , Y5-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown=TRUE; + DDExtraWidth = TRUE ; + STR_LIST_TIME_UNIT + }; + CheckBox CBX_AUTO_TIME_RESOLUTION + { + HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_TIME_RESOLUTION"; + Pos = MAP_APPFONT ( X4 , Y5+1 ) ; + Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Automat~ic" ; + }; + //--------------------------- FixedText TXT_STEP_MAIN { - Pos = MAP_APPFONT ( X2 , Y3 ) ; + Pos = MAP_APPFONT ( X2 , Y5 ) ; Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; - Text [ en-US ] = "Ma~jor interval:" ; + Text [ en-US ] = "Ma~jor interval" ; }; SpinField EDT_STEP_MAIN { + HelpID = "chart2:SpinField:TP_SCALE:EDT_STEP_MAIN"; + Border = TRUE ; + Pos = MAP_APPFONT ( X3 , Y5-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + }; + MetricField MT_MAIN_DATE_STEP + { + HelpID = "chart2:MetricField:TP_SCALE:MT_MAIN_DATE_STEP"; + Border = TRUE ; + Pos = MAP_APPFONT ( X3 , Y6-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 100000 ; + StrictFormat = TRUE ; + Unit = FUNIT_CUSTOM ; + First = 1 ; + Last = 100000 ; + SpinSize = 1 ; + }; + + ListBox LB_MAIN_TIME_UNIT + { + HelpID = "chart2:ListBox:TP_SCALE:LB_MAIN_TIME_UNIT"; Border = TRUE ; - Pos = MAP_APPFONT ( X3 , Y3-2 ) ; + AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( X5 , Y6-2 ) ; Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; + Group = TRUE ; + DropDown=TRUE; + DDExtraWidth = TRUE ; + + STR_LIST_TIME_UNIT }; CheckBox CBX_AUTO_STEP_MAIN { - Pos = MAP_APPFONT ( X4 , Y3-1 ) ; + HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_STEP_MAIN"; + Pos = MAP_APPFONT ( X4 , Y5+1 ) ; Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Au~tomatic" ; }; - + //--------------------------- + FixedText TXT_STEP_HELP_COUNT + { + Pos = MAP_APPFONT ( X2 , Y6 ) ; + Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; + Text [ en-US ] = "Minor inter~val count" ; + }; FixedText TXT_STEP_HELP { - Pos = MAP_APPFONT ( X2 , Y4 ) ; + Pos = MAP_APPFONT ( X2 , Y7 ) ; Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; - Text [ en-US ] = "Minor interval ~count:" ; + Text [ en-US ] = "Minor inter~val" ; }; MetricField MT_STEPHELP { + HelpID = "chart2:MetricField:TP_SCALE:MT_STEPHELP"; Border = TRUE ; - Pos = MAP_APPFONT ( X3 , Y4-2 ) ; + Pos = MAP_APPFONT ( X3 , Y6-2 ) ; Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; Repeat = TRUE ; @@ -151,10 +280,24 @@ TabPage TP_SCALE Last = 100 ; SpinSize = 1 ; }; + ListBox LB_HELP_TIME_UNIT + { + HelpID = "chart2:ListBox:TP_SCALE:LB_HELP_TIME_UNIT"; + Border = TRUE ; + AutoHScroll = TRUE ; + Pos = MAP_APPFONT ( X5 , Y7-2 ) ; + Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown=TRUE; + DDExtraWidth = TRUE ; + STR_LIST_TIME_UNIT + }; CheckBox CBX_AUTO_STEP_HELP { - Pos = MAP_APPFONT ( X4 , Y4-1 ) ; + HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_STEP_HELP"; + Pos = MAP_APPFONT ( X4 , Y6+1 ) ; Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Aut~omatic" ; @@ -162,40 +305,27 @@ TabPage TP_SCALE FixedText TXT_ORIGIN { - Pos = MAP_APPFONT ( X2 , Y5 ) ; + Pos = MAP_APPFONT ( X2 , Y7 ) ; Size = MAP_APPFONT ( LABELWIDTH , 8 ) ; - Text [ en-US ] = "Reference ~value:" ; + Text [ en-US ] = "Re~ference value" ; }; SpinField EDT_ORIGIN { + HelpID = "chart2:SpinField:TP_SCALE:EDT_ORIGIN"; Border = TRUE ; SVLook = TRUE ; - Pos = MAP_APPFONT ( X3 , Y5-2 ) ; + Pos = MAP_APPFONT ( X3 , Y7-2 ) ; Size = MAP_APPFONT ( EDITWIDTH , 12 ) ; TabStop = TRUE ; }; CheckBox CBX_AUTO_ORIGIN { - Pos = MAP_APPFONT ( X4 , Y5-1 ) ; + HelpID = "chart2:CheckBox:TP_SCALE:CBX_AUTO_ORIGIN"; + Pos = MAP_APPFONT ( X4 , Y7+1 ) ; Size = MAP_APPFONT ( AUTOCHECKWIDTH , 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Automat~ic" ; }; - - CheckBox CBX_LOGARITHM - { - Pos = MAP_APPFONT ( X2 , Y6 ) ; - Size = MAP_APPFONT ( 244 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Logarithmic scale" ; - }; - - CheckBox CBX_REVERSE - { - Pos = MAP_APPFONT ( X2 , Y7 ) ; - Size = MAP_APPFONT ( 244 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Reverse direction" ; - }; + //--------------------------- }; diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx index b99675652084..c3f00f1c2ace 100644 --- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx +++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx @@ -97,7 +97,7 @@ SfxTabPage* SchOptionTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs return new SchOptionTabPage(pWindow, rOutAttrs); } -BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs) +sal_Bool SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs) { if(aRbtAxis2.IsChecked()) rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS,CHART_AXIS_SECONDARY_Y)); @@ -128,113 +128,113 @@ BOOL SchOptionTabPage::FillItemSet(SfxItemSet& rOutAttrs) if (m_aCBIncludeHiddenCells.IsVisible()) rOutAttrs.Put(SfxBoolItem(SCHATTR_INCLUDE_HIDDEN_CELLS, m_aCBIncludeHiddenCells.IsChecked())); - return TRUE; + return sal_True; } void SchOptionTabPage::Reset(const SfxItemSet& rInAttrs) { const SfxPoolItem *pPoolItem = NULL; - aRbtAxis1.Check(TRUE); - aRbtAxis2.Check(FALSE); - if (rInAttrs.GetItemState(SCHATTR_AXIS,TRUE, &pPoolItem) == SFX_ITEM_SET) + aRbtAxis1.Check(sal_True); + aRbtAxis2.Check(sal_False); + if (rInAttrs.GetItemState(SCHATTR_AXIS,sal_True, &pPoolItem) == SFX_ITEM_SET) { long nVal=((const SfxInt32Item*)pPoolItem)->GetValue(); if(nVal==CHART_AXIS_SECONDARY_Y) { - aRbtAxis2.Check(TRUE); - aRbtAxis1.Check(FALSE); + aRbtAxis2.Check(sal_True); + aRbtAxis1.Check(sal_False); } } long nTmp; - if (rInAttrs.GetItemState(SCHATTR_BAR_GAPWIDTH, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_BAR_GAPWIDTH, sal_True, &pPoolItem) == SFX_ITEM_SET) { nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue(); aMTGap.SetValue(nTmp); } - if (rInAttrs.GetItemState(SCHATTR_BAR_OVERLAP, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_BAR_OVERLAP, sal_True, &pPoolItem) == SFX_ITEM_SET) { nTmp = (long)((const SfxInt32Item*)pPoolItem)->GetValue(); aMTOverlap.SetValue(nTmp); } - if (rInAttrs.GetItemState(SCHATTR_BAR_CONNECT, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_BAR_CONNECT, sal_True, &pPoolItem) == SFX_ITEM_SET) { - BOOL bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); + sal_Bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); aCBConnect.Check(bCheck); } - if (rInAttrs.GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_AXIS_FOR_ALL_SERIES, sal_True, &pPoolItem) == SFX_ITEM_SET) { m_nAllSeriesAxisIndex = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); aCBAxisSideBySide.Disable(); } - if (rInAttrs.GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_GROUP_BARS_PER_AXIS, sal_True, &pPoolItem) == SFX_ITEM_SET) { // model property is "group bars per axis", UI feature is the other way // round: "show bars side by side" - BOOL bCheck = ! static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); + sal_Bool bCheck = ! static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); aCBAxisSideBySide.Check( bCheck ); } else { - aCBAxisSideBySide.Show(FALSE); + aCBAxisSideBySide.Show(sal_False); } //missing value treatment { ::com::sun::star::uno::Sequence < sal_Int32 > aMissingValueTreatments; - if( rInAttrs.GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, TRUE, &pPoolItem) == SFX_ITEM_SET ) + if( rInAttrs.GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, sal_True, &pPoolItem) == SFX_ITEM_SET ) aMissingValueTreatments =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence(); - if ( aMissingValueTreatments.getLength()>1 && rInAttrs.GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,TRUE, &pPoolItem) == SFX_ITEM_SET) + if ( aMissingValueTreatments.getLength()>1 && rInAttrs.GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,sal_True, &pPoolItem) == SFX_ITEM_SET) { - m_aRB_DontPaint.Enable(FALSE); - m_aRB_AssumeZero.Enable(FALSE); - m_aRB_ContinueLine.Enable(FALSE); + m_aRB_DontPaint.Enable(sal_False); + m_aRB_AssumeZero.Enable(sal_False); + m_aRB_ContinueLine.Enable(sal_False); for( sal_Int32 nN =0; nN<aMissingValueTreatments.getLength(); nN++ ) { sal_Int32 nVal = aMissingValueTreatments[nN]; if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP) - m_aRB_DontPaint.Enable(TRUE); + m_aRB_DontPaint.Enable(sal_True); else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO) - m_aRB_AssumeZero.Enable(TRUE); + m_aRB_AssumeZero.Enable(sal_True); else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE) - m_aRB_ContinueLine.Enable(TRUE); + m_aRB_ContinueLine.Enable(sal_True); } long nVal=((const SfxInt32Item*)pPoolItem)->GetValue(); if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP) - m_aRB_DontPaint.Check(TRUE); + m_aRB_DontPaint.Check(sal_True); else if(nVal==::com::sun::star::chart::MissingValueTreatment::USE_ZERO) - m_aRB_AssumeZero.Check(TRUE); + m_aRB_AssumeZero.Check(sal_True); else if(nVal==::com::sun::star::chart::MissingValueTreatment::CONTINUE) - m_aRB_ContinueLine.Check(TRUE); + m_aRB_ContinueLine.Check(sal_True); } else { - m_aFT_MissingValues.Show(FALSE); - m_aRB_DontPaint.Show(FALSE); - m_aRB_AssumeZero.Show(FALSE); - m_aRB_ContinueLine.Show(FALSE); + m_aFT_MissingValues.Show(sal_False); + m_aRB_DontPaint.Show(sal_False); + m_aRB_AssumeZero.Show(sal_False); + m_aRB_ContinueLine.Show(sal_False); } } // Include hidden cells - if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, TRUE, &pPoolItem) == SFX_ITEM_SET) + if (rInAttrs.GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, sal_True, &pPoolItem) == SFX_ITEM_SET) { bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue(); m_aCBIncludeHiddenCells.Check(bVal); } else { - m_aCBIncludeHiddenCells.Show(FALSE); + m_aCBIncludeHiddenCells.Show(sal_False); if(!m_aFT_MissingValues.IsVisible()) - m_aFL_PlotOptions.Show(FALSE); + m_aFL_PlotOptions.Show(sal_False); } AdaptControlPositionsAndVisibility(); @@ -276,7 +276,7 @@ void SchOptionTabPage::AdaptControlPositionsAndVisibility() if( !aMTGap.IsVisible() && !aMTOverlap.IsVisible() ) { - aGrpBar.Show(FALSE); + aGrpBar.Show(sal_False); Point aPos; if( !aRbtAxis1.IsVisible() && !aRbtAxis2.IsVisible() ) aPos = aGrpAxis.GetPosPixel(); diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx index baa8c5e8b4d1..f09b24814511 100644 --- a/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx +++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.hxx @@ -49,7 +49,7 @@ public: virtual ~SchOptionTabPage(); static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs); - virtual BOOL FillItemSet(SfxItemSet& rOutAttrs); + virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs); virtual void Reset(const SfxItemSet& rInAttrs); void Init( bool bProvidesSecondaryYAxis, bool bProvidesOverlapAndGapWidth, bool bProvidesBarConnectors ); diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.src b/chart2/source/controller/dialogs/tp_SeriesToAxis.src index 0d67feb22cee..f307d4750062 100644 --- a/chart2/source/controller/dialogs/tp_SeriesToAxis.src +++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.src @@ -29,6 +29,7 @@ TabPage TP_OPTIONS { + HelpID = "chart2:TabPage:TP_OPTIONS"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; @@ -42,6 +43,7 @@ TabPage TP_OPTIONS RadioButton RBT_OPT_AXIS_1 { + HelpID = "chart2:RadioButton:TP_OPTIONS:RBT_OPT_AXIS_1"; Pos = MAP_APPFONT ( 12 , 20 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -50,6 +52,7 @@ TabPage TP_OPTIONS RadioButton RBT_OPT_AXIS_2 { + HelpID = "chart2:RadioButton:TP_OPTIONS:RBT_OPT_AXIS_2"; Pos = MAP_APPFONT ( 12 , 34 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -72,6 +75,7 @@ TabPage TP_OPTIONS MetricField MT_OVERLAP { + HelpID = "chart2:MetricField:TP_OPTIONS:MT_OVERLAP"; Border = TRUE ; Pos = MAP_APPFONT ( 63 , 78 ) ; Size = MAP_APPFONT ( 40 , 12 ) ; @@ -98,6 +102,7 @@ TabPage TP_OPTIONS MetricField MT_GAP { + HelpID = "chart2:MetricField:TP_OPTIONS:MT_GAP"; Border = TRUE ; Pos = MAP_APPFONT ( 63 , 62 ) ; Size = MAP_APPFONT ( 40 , 12 ) ; @@ -117,6 +122,7 @@ TabPage TP_OPTIONS CheckBox CB_CONNECTOR { + HelpID = "chart2:CheckBox:TP_OPTIONS:CB_CONNECTOR"; Pos = MAP_APPFONT ( 12 , 97 ) ; Size = MAP_APPFONT ( 200 , 10 ) ; TabStop = TRUE ; @@ -125,6 +131,7 @@ TabPage TP_OPTIONS CheckBox CB_BARS_SIDE_BY_SIDE { + HelpID = "chart2:CheckBox:TP_OPTIONS:CB_BARS_SIDE_BY_SIDE"; Pos = MAP_APPFONT ( 12 , 97 ) ; Size = MAP_APPFONT ( 200 , 10 ) ; TabStop = TRUE ; @@ -147,6 +154,7 @@ TabPage TP_OPTIONS RadioButton RB_DONT_PAINT { + HelpID = "chart2:RadioButton:TP_OPTIONS:RB_DONT_PAINT"; Pos = MAP_APPFONT ( 82 , 127 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -155,6 +163,7 @@ TabPage TP_OPTIONS RadioButton RB_ASSUME_ZERO { + HelpID = "chart2:RadioButton:TP_OPTIONS:RB_ASSUME_ZERO"; Pos = MAP_APPFONT ( 82 , 141 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -163,6 +172,7 @@ TabPage TP_OPTIONS RadioButton RB_CONTINUE_LINE { + HelpID = "chart2:RadioButton:TP_OPTIONS:RB_CONTINUE_LINE"; Pos = MAP_APPFONT ( 82 , 155 ) ; Size = MAP_APPFONT ( 80 , 10 ) ; TabStop = TRUE ; @@ -171,6 +181,7 @@ TabPage TP_OPTIONS CheckBox CB_INCLUDE_HIDDEN_CELLS { + HelpID = "chart2:CheckBox:TP_OPTIONS:CB_INCLUDE_HIDDEN_CELLS"; Pos = MAP_APPFONT ( 12 , 172 ) ; Size = MAP_APPFONT ( 200 , 10 ) ; TabStop = TRUE ; diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx index ecbeb6f6d7b0..8e9e66e30f03 100644 --- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx +++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx @@ -59,7 +59,7 @@ SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow, { FreeResource(); - aCbStacked.EnableTriState( FALSE ); + aCbStacked.EnableTriState( sal_False ); aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK ); if( !bWithRotation ) @@ -89,7 +89,7 @@ SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent, return new SchAlignmentTabPage(pParent, rInAttrs, false); } -BOOL SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs) +sal_Bool SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs) { //Since 04/1998 text can be rotated by an arbitrary angle: SCHATTR_TEXT_DEGREES bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK; @@ -101,7 +101,7 @@ BOOL SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs) SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() ); rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) ); - return TRUE; + return sal_True; } void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs) @@ -116,7 +116,7 @@ void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs) aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK ); - if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pItem) == SFX_ITEM_SET) + if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pItem) == SFX_ITEM_SET) aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) ); } diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.hxx b/chart2/source/controller/dialogs/tp_TitleRotation.hxx index 190bbcaf1d42..87c3e43a914a 100644 --- a/chart2/source/controller/dialogs/tp_TitleRotation.hxx +++ b/chart2/source/controller/dialogs/tp_TitleRotation.hxx @@ -59,7 +59,7 @@ public: static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs); static SfxTabPage* CreateWithoutRotation(Window* pParent, const SfxItemSet& rInAttrs); - virtual BOOL FillItemSet(SfxItemSet& rOutAttrs); + virtual sal_Bool FillItemSet(SfxItemSet& rOutAttrs); virtual void Reset(const SfxItemSet& rInAttrs); }; diff --git a/chart2/source/controller/dialogs/tp_Trendline.cxx b/chart2/source/controller/dialogs/tp_Trendline.cxx index 97859daa14fc..f64e40f8f5a9 100644 --- a/chart2/source/controller/dialogs/tp_Trendline.cxx +++ b/chart2/source/controller/dialogs/tp_Trendline.cxx @@ -55,7 +55,7 @@ SfxTabPage* TrendlineTabPage::Create( return new TrendlineTabPage( pParent, rOutAttrs ); } -BOOL TrendlineTabPage::FillItemSet( SfxItemSet& rOutAttrs ) +sal_Bool TrendlineTabPage::FillItemSet( SfxItemSet& rOutAttrs ) { return m_aTrendlineResources.FillItemSet( rOutAttrs ); } diff --git a/chart2/source/controller/dialogs/tp_Trendline.hxx b/chart2/source/controller/dialogs/tp_Trendline.hxx index d4d3726c01a2..f2a1ac94b395 100644 --- a/chart2/source/controller/dialogs/tp_Trendline.hxx +++ b/chart2/source/controller/dialogs/tp_Trendline.hxx @@ -44,7 +44,7 @@ public: virtual ~TrendlineTabPage (); static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs ); - virtual BOOL FillItemSet( SfxItemSet& rOutAttrs ); + virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs ); virtual void Reset( const SfxItemSet& rInAttrs ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); diff --git a/chart2/source/controller/dialogs/tp_Trendline.src b/chart2/source/controller/dialogs/tp_Trendline.src index f7a3fa33a6d8..1a283844a8d1 100644 --- a/chart2/source/controller/dialogs/tp_Trendline.src +++ b/chart2/source/controller/dialogs/tp_Trendline.src @@ -30,6 +30,7 @@ TabPage TP_TRENDLINE { + HelpID = "chart2:TabPage:TP_TRENDLINE"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( 260 , 185 ) ; diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src index a17f5655e751..473007f1c32b 100644 --- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src +++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.src @@ -59,6 +59,7 @@ TabPage TP_WIZARD_TITLEANDOBJECTS { + HelpID = "chart2:TabPage:TP_WIZARD_TITLEANDOBJECTS"; Hide = TRUE ; SVLook = TRUE ; Size = MAP_APPFONT ( CHART_WIZARD_PAGEWIDTH , CHART_WIZARD_PAGEHEIGHT ) ; diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index 9a4d9ecdf76b..56ee37614ba4 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -195,7 +195,7 @@ void DrawViewWrapper::SetMarkHandles() SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const { SdrObject* pRet = NULL; - ULONG nOptions = SDRSEARCH_DEEP | SDRSEARCH_TESTMARKABLE; + sal_uLong nOptions = SDRSEARCH_DEEP | SDRSEARCH_TESTMARKABLE; SdrPageView* pSdrPageView = this->GetPageView(); this->SdrView::PickObj(rPnt, lcl_getHitTolerance( this->GetFirstOutputDevice() ), pRet, pSdrPageView, nOptions); diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx index 8aefcfe40b24..bf1096a26e25 100644 --- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx +++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx @@ -182,7 +182,7 @@ Graphic ViewElementListProvider::GetSymbolGraphic( sal_Int32 nStandardSymbol, co aVDev.SetMapMode(MapMode(MAP_100TH_MM)); SdrModel* pModel = new SdrModel(); pModel->GetItemPool().FreezeIdRanges(); - SdrPage* pPage = new SdrPage( *pModel, FALSE ); + SdrPage* pPage = new SdrPage( *pModel, sal_False ); pPage->SetSize(Size(1000,1000)); pModel->InsertPage( pPage, 0 ); SdrView* pView = new SdrView( pModel, &aVDev ); @@ -225,7 +225,7 @@ FontList* ViewElementListProvider::getFontList() const OutputDevice* pDefaultOut = Application::GetDefaultDevice(); m_pFontList = new FontList( pRefDev ? pRefDev : pDefaultOut , pRefDev ? pDefaultOut : NULL - , FALSE ); + , sal_False ); } return m_pFontList; } diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx index 7cae06bd446b..eb43cb984f76 100644 --- a/chart2/source/controller/inc/AxisItemConverter.hxx +++ b/chart2/source/controller/inc/AxisItemConverter.hxx @@ -28,8 +28,7 @@ #ifndef CHART_AXISITEMCONVERTER_HXX #define CHART_AXISITEMCONVERTER_HXX -#include <com/sun/star/chart2/ExplicitScaleData.hpp> -#include <com/sun/star/chart2/ExplicitIncrementData.hpp> +#include <chartview/ExplicitScaleValues.hxx> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/awt/Size.hpp> @@ -56,8 +55,8 @@ public: SdrModel& rDrawModel, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDoc, - ::com::sun::star::chart2::ExplicitScaleData * pScale = NULL, - ::com::sun::star::chart2::ExplicitIncrementData * pIncrement = NULL, + ExplicitScaleData * pScale = NULL, + ExplicitIncrementData * pIncrement = NULL, ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize = ::std::auto_ptr< ::com::sun::star::awt::Size >() ); virtual ~AxisItemConverter(); @@ -66,12 +65,12 @@ public: virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: @@ -82,8 +81,8 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartDoc; - ::com::sun::star::chart2::ExplicitScaleData * m_pExplicitScale; - ::com::sun::star::chart2::ExplicitIncrementData * m_pExplicitIncrement; + ExplicitScaleData* m_pExplicitScale; + ExplicitIncrementData* m_pExplicitIncrement; }; } // namespace wrapper diff --git a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx index 05086b005271..51b91c0dd3dd 100644 --- a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx +++ b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx @@ -60,12 +60,12 @@ public: virtual ~CharacterPropertyItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); ::com::sun::star::uno::Reference< diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx b/chart2/source/controller/inc/ConfigurationAccess.hxx index a28177ed236f..2964e9f889ea 100644 --- a/chart2/source/controller/inc/ConfigurationAccess.hxx +++ b/chart2/source/controller/inc/ConfigurationAccess.hxx @@ -30,7 +30,7 @@ #define _CHART2_CONFIGURATIONACCESS_HXX // header for enum FieldUnit -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> //............................................................................. namespace chart diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx index 618979ac43da..9f9d6174289d 100644 --- a/chart2/source/controller/inc/DataPointItemConverter.hxx +++ b/chart2/source/controller/inc/DataPointItemConverter.hxx @@ -30,7 +30,7 @@ #include "ItemConverter.hxx" #include "GraphicPropertyItemConverter.hxx" -#include "chartview/NumberFormatterWrapper.hxx" +#include "NumberFormatterWrapper.hxx" #include <com/sun/star/chart2/XDataSeries.hpp> #include <com/sun/star/awt/Size.hpp> @@ -82,12 +82,12 @@ public: virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx index 93b5b4d64312..fda4898f274c 100644 --- a/chart2/source/controller/inc/DrawViewWrapper.hxx +++ b/chart2/source/controller/inc/DrawViewWrapper.hxx @@ -70,11 +70,11 @@ public: SdrPageView* GetPageView() const; SdrObject* getHitObject( const Point& rPnt ) const; - //BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions, SdrObject** ppRootObj, ULONG* pnMarkNum=NULL, USHORT* pnPassNum=NULL) const; - //BOOL PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const; - //BOOL PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, ULONG nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); } + //sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions, SdrObject** ppRootObj, sal_uLong* pnMarkNum=NULL, sal_uInt16* pnPassNum=NULL) const; + //sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions=0) const; + //sal_Bool PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); } - //void MarkObj(SdrObject* pObj, SdrPageView* pPV, BOOL bUnmark=FALSE, BOOL bImpNoSetMarkHdl=FALSE); + //void MarkObj(SdrObject* pObj, SdrPageView* pPV, sal_Bool bUnmark=sal_False, sal_Bool bImpNoSetMarkHdl=sal_False); void MarkObject( SdrObject* pObj ); //---------------------- diff --git a/chart2/source/controller/inc/ErrorBarItemConverter.hxx b/chart2/source/controller/inc/ErrorBarItemConverter.hxx index e1e4af7b2350..8251e1e73ba7 100644 --- a/chart2/source/controller/inc/ErrorBarItemConverter.hxx +++ b/chart2/source/controller/inc/ErrorBarItemConverter.hxx @@ -30,7 +30,7 @@ #include "ItemConverter.hxx" #include "GraphicPropertyItemConverter.hxx" -#include "chartview/NumberFormatterWrapper.hxx" +#include "NumberFormatterWrapper.hxx" #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -64,12 +64,12 @@ public: virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx index 420d776abf2d..1d8ab0b96901 100644 --- a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx +++ b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx @@ -64,12 +64,12 @@ public: virtual ~GraphicPropertyItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/HelpIds.hrc b/chart2/source/controller/inc/HelpIds.hrc index 3515497b240f..5e20b7980c8b 100644 --- a/chart2/source/controller/inc/HelpIds.hrc +++ b/chart2/source/controller/inc/HelpIds.hrc @@ -27,131 +27,136 @@ #ifndef CHART_HELPIDS_HRC #define CHART_HELPIDS_HRC -#include <svl/solar.hrc> -//next is 120 -//free: 20, 21, 22, 30, 31, 32, 33 +#define HID_SCH_ALIGNMENT "CHART2_HID_SCH_ALIGNMENT" +#define HID_SCH_LEGEND_POS "CHART2_HID_SCH_LEGEND_POS" +#define HID_SCH_DATA_DESCR "CHART2_HID_SCH_DATA_DESCR" -//see old chart: schhids.h +#define HID_SCH_STAT "CHART2_HID_SCH_STAT" +#define HID_SCH_WIN_DOCUMENT "CHART2_HID_SCH_WIN_DOCUMENT" +#define HID_SCH_CTL_DATA "CHART2_HID_SCH_CTL_DATA" -#define HID_SCH_ALIGNMENT (HID_SCH_START + 4) -#define HID_SCH_LEGEND_POS (HID_SCH_START + 5) -#define HID_SCH_DATA_DESCR (HID_SCH_START + 6) - -#define HID_SCH_STAT (HID_SCH_START + 8) -#define HID_SCH_WIN_DOCUMENT (HID_SCH_START + 9) -#define HID_SCH_CTL_DATA (HID_SCH_START + 10) - -#define HID_SCH_CT_INDICATE (HID_SCH_START + 11) +#define HID_SCH_CT_INDICATE "CHART2_HID_SCH_CT_INDICATE" //for chart type dialog: -#define HID_SCH_CTL_TYPE (HID_SCH_START + 13) -#define HID_SCH_CTL_VARIANT (HID_SCH_START + 14) -#define HID_SCH_NUM_OF_LINES (HID_SCH_START + 43) -#define HID_SCH_SERIES_LIST (HID_SCH_START + 15) -#define HID_SCH_DATA_RANGES_LIST (HID_SCH_START + 16) - -#define HID_SCH_TBI_DATA_INSERT_ROW (HID_SCH_START + 23) -#define HID_SCH_TBI_DATA_INSERT_COL (HID_SCH_START + 24) -#define HID_SCH_TBI_DATA_DELETE_ROW (HID_SCH_START + 25) -#define HID_SCH_TBI_DATA_DELETE_COL (HID_SCH_START + 26) -#define HID_SCH_TBI_DATA_SWAP_COL (HID_SCH_START + 27) -#define HID_SCH_TBI_DATA_SWAP_ROW (HID_SCH_START + 28) -#define HID_SCH_TBI_DATA_INSERT_TEXT_COL (HID_SCH_START + 29) -#define HID_SCH_TBX_DATA (HID_SCH_START + 34) - -#define HID_SCH_ALIGNMENT_CTR_DIAL (HID_SCH_START + 35) -#define HID_SCH_ALIGNMENT_STACKED (HID_SCH_START + 36) -#define HID_SCH_ALIGNMENT_DEGREES (HID_SCH_START + 37) -#define HID_SCH_TP_AXIS_LABEL (HID_SCH_START + 42) - -#define HID_SCH_CHART_AUTO_FORMAT (HID_SCH_START + 44) -#define HID_SCH_LB_BAR_GEOMETRY (HID_SCH_START + 45) -#define HID_SCH_DLG_SPLINE_PROPERTIES (HID_SCH_START + 46) -#define HID_SCH_DLG_RANGES (HID_SCH_START + 47) - -#define HID_SCH_CB_XAXIS (HID_SCH_START + 48) -#define HID_SCH_CB_YAXIS (HID_SCH_START + 49) -#define HID_SCH_CB_ZAXIS (HID_SCH_START + 50) -#define HID_SCH_CB_SECONDARY_XAXIS (HID_SCH_START + 51) -#define HID_SCH_CB_SECONDARY_YAXIS (HID_SCH_START + 52) -#define HID_SCH_CB_SECONDARY_ZAXIS (HID_SCH_START + 53) - -#define HID_SCH_CB_XGRID (HID_SCH_START + 54) -#define HID_SCH_CB_YGRID (HID_SCH_START + 55) -#define HID_SCH_CB_ZGRID (HID_SCH_START + 56) -#define HID_SCH_CB_SECONDARY_XGRID (HID_SCH_START + 57) -#define HID_SCH_CB_SECONDARY_YGRID (HID_SCH_START + 58) -#define HID_SCH_CB_SECONDARY_ZGRID (HID_SCH_START + 59) - -#define HID_SCH_LEGEND_POS_LEFT (HID_SCH_START + 60) -#define HID_SCH_LEGEND_POS_TOP (HID_SCH_START + 61) -#define HID_SCH_LEGEND_POS_RIGHT (HID_SCH_START + 62) -#define HID_SCH_LEGEND_POS_BOTTOM (HID_SCH_START + 63) - -#define HID_SCH_STATISTIK_MEANVALUE (HID_SCH_START + 64) -#define HID_SCH_STATISTIK_NO_ERROR (HID_SCH_START + 65) -#define HID_SCH_STATISTIK_VARIANT (HID_SCH_START + 66) -#define HID_SCH_STATISTIK_SIGMA (HID_SCH_START + 67) -#define HID_SCH_STATISTIK_PERCENT (HID_SCH_START + 68) -#define HID_SCH_STATISTIK_BIGERROR (HID_SCH_START + 69) -#define HID_SCH_STATISTIK_CONSTERROR (HID_SCH_START + 70) -#define HID_SCH_STATISTIK_PERCENT_VALUE (HID_SCH_START + 71) -#define HID_SCH_STATISTIK_BIGERROR_VALUE (HID_SCH_START + 72) -#define HID_SCH_STATISTIK_PLUS_VALUE (HID_SCH_START + 73) -#define HID_SCH_STATISTIK_MINUS_VALUE (HID_SCH_START + 74) - -#define HID_SCH_DATALABEL_VALUE (HID_SCH_START + 75) -#define HID_SCH_DATALABEL_NUMBER (HID_SCH_START + 76) -#define HID_SCH_DATALABEL_PERCENT (HID_SCH_START + 77) -#define HID_SCH_DATALABEL_TEXT (HID_SCH_START + 78) -#define HID_SCH_DATALABEL_SYMBOL (HID_SCH_START + 79) -#define HID_SCH_PB_NUMBERFORMAT (HID_SCH_START + 88) -#define HID_SCH_PB_PERCENT_NUMBERFORMAT (HID_SCH_START + 89) -#define HID_SCH_DATALABEL_SEPARATOR (HID_SCH_START + 90) -#define HID_SCH_DATALABEL_PLACEMENT (HID_SCH_START + 91) -#define HID_SCH_TEXTDIRECTION (HID_SCH_START + 115) -#define HID_SCH_TEXTDIRECTION_TITLE (HID_SCH_START + 116) -#define HID_SCH_TEXTDIRECTION_EQUATION (HID_SCH_START + 117) -#define HID_SCH_DATALABEL_ROTATION_KNOB (HID_SCH_START + 118) -#define HID_SCH_DATALABEL_ROTATION_EDIT (HID_SCH_START + 119) - -#define HID_SCH_TITLE_MAIN (HID_SCH_START + 80) -#define HID_SCH_TITLE_SUB (HID_SCH_START + 81) -#define HID_SCH_TITLE_X (HID_SCH_START + 82) -#define HID_SCH_TITLE_Y (HID_SCH_START + 83) -#define HID_SCH_TITLE_Z (HID_SCH_START + 84) -#define HID_SCH_TITLE_SECONDARY_X (HID_SCH_START + 92) -#define HID_SCH_TITLE_SECONDARY_Y (HID_SCH_START + 93) - -#define HID_SCH_WIZARD_ROADMAP (HID_SCH_START + 85) -#define HID_SCH_LEGEND_SHOW (HID_SCH_START + 86) -#define HID_SCH_DATA_SERIES_LABEL (HID_SCH_START + 87) - -#define HID_SCH_STARTING_ANGLE_DIAL (HID_SCH_START + 94) - -#define HID_SCH_TRENDLINE_RB_NONE (HID_SCH_START + 95) -#define HID_SCH_TRENDLINE_RB_LINEAR (HID_SCH_START + 96) -#define HID_SCH_TRENDLINE_RB_LOGARITHMIC (HID_SCH_START + 97) -#define HID_SCH_TRENDLINE_RB_EXPONENTIAL (HID_SCH_START + 98) -#define HID_SCH_TRENDLINE_RB_POWER (HID_SCH_START + 99) -#define HID_SCH_TRENDLINE_SHOW_EQUATION (HID_SCH_START + 100) -#define HID_SCH_TRENDLINE_SHOW_R_SQUARED (HID_SCH_START + 101) - -#define HID_SCH_STATISTIK_FUNCTION (HID_SCH_START + 102) -#define HID_SCH_STATISTIK_RANGE (HID_SCH_START + 103) -#define HID_SCH_STATISTIK_FUNCTION_LB (HID_SCH_START + 104) -#define HID_SCH_STATISTIK_POSITIVE_VALUE (HID_SCH_START + 105) -#define HID_SCH_STATISTIK_POSITIVE_RANGE (HID_SCH_START + 106) -#define HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER (HID_SCH_START + 107) -#define HID_SCH_STATISTIK_NEGATIVE_VALUE (HID_SCH_START + 108) -#define HID_SCH_STATISTIK_NEGATIVE_RANGE (HID_SCH_START + 109) -#define HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER (HID_SCH_START + 110) -#define HID_SCH_STATISTIK_SAME_FOR_BOTH (HID_SCH_START + 111) -#define HID_SCH_STATISTIK_SHOW_BOTH (HID_SCH_START + 112) -#define HID_SCH_STATISTIK_SHOW_POSITIVE (HID_SCH_START + 113) -#define HID_SCH_STATISTIK_SHOW_NEGATIVE (HID_SCH_START + 114) - - -// HID_SCH_START should be 63280 (checked 25.Nov 2002) +#define HID_SCH_CTL_TYPE "CHART2_HID_SCH_CTL_TYPE" +#define HID_SCH_CTL_VARIANT "CHART2_HID_SCH_CTL_VARIANT" +#define HID_SCH_NUM_OF_LINES "CHART2_HID_SCH_NUM_OF_LINES" +#define HID_SCH_SERIES_LIST "CHART2_HID_SCH_SERIES_LIST" +#define HID_SCH_DATA_RANGES_LIST "CHART2_HID_SCH_DATA_RANGES_LIST" +// + +#define HID_SCH_TBI_DATA_INSERT_ROW "CHART2_HID_SCH_TBI_DATA_INSERT_ROW" +#define HID_SCH_TBI_DATA_INSERT_COL "CHART2_HID_SCH_TBI_DATA_INSERT_COL" +#define HID_SCH_TBI_DATA_DELETE_ROW "CHART2_HID_SCH_TBI_DATA_DELETE_ROW" +#define HID_SCH_TBI_DATA_DELETE_COL "CHART2_HID_SCH_TBI_DATA_DELETE_COL" +#define HID_SCH_TBI_DATA_SWAP_COL "CHART2_HID_SCH_TBI_DATA_SWAP_COL" +#define HID_SCH_TBI_DATA_SWAP_ROW "CHART2_HID_SCH_TBI_DATA_SWAP_ROW" +#define HID_SCH_TBI_DATA_INSERT_TEXT_COL "CHART2_HID_SCH_TBI_DATA_INSERT_TEXT_COL" +#define HID_SCH_TBX_DATA "CHART2_HID_SCH_TBX_DATA" + +#define HID_SCH_ALIGNMENT_CTR_DIAL "CHART2_HID_SCH_ALIGNMENT_CTR_DIAL" +#define HID_SCH_ALIGNMENT_STACKED "CHART2_HID_SCH_ALIGNMENT_STACKED" +#define HID_SCH_ALIGNMENT_DEGREES "CHART2_HID_SCH_ALIGNMENT_DEGREES" + +#define HID_SCH_TP_AXIS_LABEL "CHART2_HID_SCH_TP_AXIS_LABEL" + +#define HID_SCH_CHART_AUTO_FORMAT "CHART2_HID_SCH_CHART_AUTO_FORMAT" +#define HID_SCH_LB_BAR_GEOMETRY "CHART2_HID_SCH_LB_BAR_GEOMETRY" +#define HID_SCH_DLG_SPLINE_PROPERTIES "CHART2_HID_SCH_DLG_SPLINE_PROPERTIES" +#define HID_SCH_DLG_RANGES "CHART2_HID_SCH_DLG_RANGES" + +#define HID_SCH_CB_XAXIS "CHART2_HID_SCH_CB_XAXIS" +#define HID_SCH_CB_YAXIS "CHART2_HID_SCH_CB_YAXIS" +#define HID_SCH_CB_ZAXIS "CHART2_HID_SCH_CB_ZAXIS" +#define HID_SCH_CB_SECONDARY_XAXIS "CHART2_HID_SCH_CB_SECONDARY_XAXIS" +#define HID_SCH_CB_SECONDARY_YAXIS "CHART2_HID_SCH_CB_SECONDARY_YAXIS" +#define HID_SCH_CB_SECONDARY_ZAXIS "CHART2_HID_SCH_CB_SECONDARY_ZAXIS" + +#define HID_SCH_CB_XGRID "CHART2_HID_SCH_CB_XGRID" +#define HID_SCH_CB_YGRID "CHART2_HID_SCH_CB_YGRID" +#define HID_SCH_CB_ZGRID "CHART2_HID_SCH_CB_ZGRID" +#define HID_SCH_CB_SECONDARY_XGRID "CHART2_HID_SCH_CB_SECONDARY_XGRID" +#define HID_SCH_CB_SECONDARY_YGRID "CHART2_HID_SCH_CB_SECONDARY_YGRID" +#define HID_SCH_CB_SECONDARY_ZGRID "CHART2_HID_SCH_CB_SECONDARY_ZGRID" + +#define HID_SCH_LEGEND_POS_LEFT "CHART2_HID_SCH_LEGEND_POS_LEFT" +#define HID_SCH_LEGEND_POS_TOP "CHART2_HID_SCH_LEGEND_POS_TOP" +#define HID_SCH_LEGEND_POS_RIGHT "CHART2_HID_SCH_LEGEND_POS_RIGHT" +#define HID_SCH_LEGEND_POS_BOTTOM "CHART2_HID_SCH_LEGEND_POS_BOTTOM" + +#define HID_SCH_STATISTIK_MEANVALUE "CHART2_HID_SCH_STATISTIK_MEANVALUE" +#define HID_SCH_STATISTIK_NO_ERROR "CHART2_HID_SCH_STATISTIK_NO_ERROR" +#define HID_SCH_STATISTIK_VARIANT "CHART2_HID_SCH_STATISTIK_VARIANT" +#define HID_SCH_STATISTIK_SIGMA "CHART2_HID_SCH_STATISTIK_SIGMA" +#define HID_SCH_STATISTIK_PERCENT "CHART2_HID_SCH_STATISTIK_PERCENT" +#define HID_SCH_STATISTIK_BIGERROR "CHART2_HID_SCH_STATISTIK_BIGERROR" +#define HID_SCH_STATISTIK_CONSTERROR "CHART2_HID_SCH_STATISTIK_CONSTERROR" +#define HID_SCH_STATISTIK_PERCENT_VALUE "CHART2_HID_SCH_STATISTIK_PERCENT_VALUE" +#define HID_SCH_STATISTIK_BIGERROR_VALUE "CHART2_HID_SCH_STATISTIK_BIGERROR_VALUE" +#define HID_SCH_STATISTIK_PLUS_VALUE "CHART2_HID_SCH_STATISTIK_PLUS_VALUE" +#define HID_SCH_STATISTIK_MINUS_VALUE "CHART2_HID_SCH_STATISTIK_MINUS_VALUE" + +#define HID_SCH_DATALABEL_VALUE "CHART2_HID_SCH_DATALABEL_VALUE" +#define HID_SCH_DATALABEL_NUMBER "CHART2_HID_SCH_DATALABEL_NUMBER" +#define HID_SCH_DATALABEL_PERCENT "CHART2_HID_SCH_DATALABEL_PERCENT" +#define HID_SCH_DATALABEL_TEXT "CHART2_HID_SCH_DATALABEL_TEXT" +#define HID_SCH_DATALABEL_SYMBOL "CHART2_HID_SCH_DATALABEL_SYMBOL" +#define HID_SCH_PB_NUMBERFORMAT "CHART2_HID_SCH_PB_NUMBERFORMAT" +#define HID_SCH_PB_PERCENT_NUMBERFORMAT "CHART2_HID_SCH_PB_PERCENT_NUMBERFORMAT" +#define HID_SCH_DATALABEL_SEPARATOR "CHART2_HID_SCH_DATALABEL_SEPARATOR" +#define HID_SCH_DATALABEL_PLACEMENT "CHART2_HID_SCH_DATALABEL_PLACEMENT" +#define HID_SCH_TEXTDIRECTION "CHART2_HID_SCH_TEXTDIRECTION" +#define HID_SCH_TEXTDIRECTION_TITLE "CHART2_HID_SCH_TEXTDIRECTION_TITLE" +#define HID_SCH_TEXTDIRECTION_EQUATION "CHART2_HID_SCH_TEXTDIRECTION_EQUATION" +#define HID_SCH_DATALABEL_ROTATION_KNOB "CHART2_HID_SCH_DATALABEL_ROTATION_KNOB" +#define HID_SCH_DATALABEL_ROTATION_EDIT "CHART2_HID_SCH_DATALABEL_ROTATION_EDIT" + +#define HID_SCH_TITLE_MAIN "CHART2_HID_SCH_TITLE_MAIN" +#define HID_SCH_TITLE_SUB "CHART2_HID_SCH_TITLE_SUB" +#define HID_SCH_TITLE_X "CHART2_HID_SCH_TITLE_X" +#define HID_SCH_TITLE_Y "CHART2_HID_SCH_TITLE_Y" +#define HID_SCH_TITLE_Z "CHART2_HID_SCH_TITLE_Z" +#define HID_SCH_TITLE_SECONDARY_X "CHART2_HID_SCH_TITLE_SECONDARY_X" +#define HID_SCH_TITLE_SECONDARY_Y "CHART2_HID_SCH_TITLE_SECONDARY_Y" + +#define HID_SCH_WIZARD_ROADMAP "CHART2_HID_SCH_WIZARD_ROADMAP" +#define HID_SCH_LEGEND_SHOW "CHART2_HID_SCH_LEGEND_SHOW" +#define HID_SCH_DATA_SERIES_LABEL "CHART2_HID_SCH_DATA_SERIES_LABEL" + +#define HID_SCH_STARTING_ANGLE_DIAL "CHART2_HID_SCH_STARTING_ANGLE_DIAL" + +#define HID_SCH_TRENDLINE_RB_NONE "CHART2_HID_SCH_TRENDLINE_RB_NONE" +#define HID_SCH_TRENDLINE_RB_LINEAR "CHART2_HID_SCH_TRENDLINE_RB_LINEAR" +#define HID_SCH_TRENDLINE_RB_LOGARITHMIC "CHART2_HID_SCH_TRENDLINE_RB_LOGARITHMIC" +#define HID_SCH_TRENDLINE_RB_EXPONENTIAL "CHART2_HID_SCH_TRENDLINE_RB_EXPONENTIAL" +#define HID_SCH_TRENDLINE_RB_POWER "CHART2_HID_SCH_TRENDLINE_RB_POWER" +#define HID_SCH_TRENDLINE_SHOW_EQUATION "CHART2_HID_SCH_TRENDLINE_SHOW_EQUATION" +#define HID_SCH_TRENDLINE_SHOW_R_SQUARED "CHART2_HID_SCH_TRENDLINE_SHOW_R_SQUARED" + +#define HID_SCH_STATISTIK_FUNCTION "CHART2_HID_SCH_STATISTIK_FUNCTION" +#define HID_SCH_STATISTIK_RANGE "CHART2_HID_SCH_STATISTIK_RANGE" +#define HID_SCH_STATISTIK_FUNCTION_LB "CHART2_HID_SCH_STATISTIK_FUNCTION_LB" +#define HID_SCH_STATISTIK_POSITIVE_VALUE "CHART2_HID_SCH_STATISTIK_POSITIVE_VALUE" +#define HID_SCH_STATISTIK_POSITIVE_RANGE "CHART2_HID_SCH_STATISTIK_POSITIVE_RANGE" +#define HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER "CHART2_HID_SCH_STATISTIK_POSITIVE_RANGE_CHOOSER" +#define HID_SCH_STATISTIK_NEGATIVE_VALUE "CHART2_HID_SCH_STATISTIK_NEGATIVE_VALUE" +#define HID_SCH_STATISTIK_NEGATIVE_RANGE "CHART2_HID_SCH_STATISTIK_NEGATIVE_RANGE" +#define HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER "CHART2_HID_SCH_STATISTIK_NEGATIVE_RANGE_CHOOSER" +#define HID_SCH_STATISTIK_SAME_FOR_BOTH "CHART2_HID_SCH_STATISTIK_SAME_FOR_BOTH" +#define HID_SCH_STATISTIK_SHOW_BOTH "CHART2_HID_SCH_STATISTIK_SHOW_BOTH" +#define HID_SCH_STATISTIK_SHOW_POSITIVE "CHART2_HID_SCH_STATISTIK_SHOW_POSITIVE" +#define HID_SCH_STATISTIK_SHOW_NEGATIVE "CHART2_HID_SCH_STATISTIK_SHOW_NEGATIVE" + +#define HID_INSERT_GRIDS "CHART2_HID_INSERT_GRIDS" + +#define HID_DIAGRAM_TYPE "CHART2_HID_DIAGRAM_TYPE" +#define HID_3D_VIEW "CHART2_HID_3D_VIEW" +#define HID_DIAGRAM_DATA "CHART2_HID_DIAGRAM_DATA" +#define HID_INSERT_AXIS "CHART2_HID_INSERT_AXIS" +#define HID_INSERT_STATISTICS "CHART2_HID_INSERT_STATISTICS" +#define HID_INSERT_TITLE "CHART2_HID_INSERT_TITLE" +#define HID_INSERT_CHART_LEGEND "CHART2_HID_INSERT_CHART_LEGEND" +#define HID_INSERT_DESCRIPTION "CHART2_HID_INSERT_DESCRIPTION" + #endif diff --git a/chart2/source/controller/inc/ItemConverter.hxx b/chart2/source/controller/inc/ItemConverter.hxx index 619ea1b483d4..25c5ef5a817c 100644 --- a/chart2/source/controller/inc/ItemConverter.hxx +++ b/chart2/source/controller/inc/ItemConverter.hxx @@ -90,9 +90,9 @@ public: // typedefs ------------------------------- - typedef USHORT tWhichIdType; + typedef sal_uInt16 tWhichIdType; typedef ::rtl::OUString tPropertyNameType; - typedef BYTE tMemberIdType; + typedef sal_uInt8 tMemberIdType; typedef ::std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId; @@ -134,7 +134,7 @@ protected: /** implement this method to provide an array of which-ranges of the form: - const USHORT aMyPairs[] = + const sal_uInt16 aMyPairs[] = { from_1, to_1, from_2, to_2, @@ -143,7 +143,7 @@ protected: 0 }; */ - virtual const USHORT * GetWhichPairs() const = 0; + virtual const sal_uInt16 * GetWhichPairs() const = 0; /** implement this method to return a Property object for a given which id. @@ -162,7 +162,7 @@ protected: The default implementation does nothing except showing an assertion */ - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); /** for items that can not be mapped directly to a property. @@ -174,7 +174,7 @@ protected: @return true if the item changed a property, false otherwise. */ - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); // ________ diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx index 9c008f972b74..9ec794aed482 100644 --- a/chart2/source/controller/inc/LegendItemConverter.hxx +++ b/chart2/source/controller/inc/LegendItemConverter.hxx @@ -61,12 +61,12 @@ public: virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/MultipleChartConverters.hxx b/chart2/source/controller/inc/MultipleChartConverters.hxx index 00f05c32f8da..a4f08c697525 100644 --- a/chart2/source/controller/inc/MultipleChartConverters.hxx +++ b/chart2/source/controller/inc/MultipleChartConverters.hxx @@ -56,7 +56,7 @@ public: virtual ~AllAxisItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; }; class AllGridItemConverter : public ::comphelper::MultipleItemConverter @@ -72,7 +72,7 @@ public: virtual ~AllGridItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; }; class AllDataLabelItemConverter : public ::comphelper::MultipleItemConverter @@ -90,7 +90,7 @@ public: virtual ~AllDataLabelItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; }; class AllTitleItemConverter : public ::comphelper::MultipleItemConverter @@ -108,7 +108,7 @@ public: virtual ~AllTitleItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; }; class AllSeriesStatisticsConverter : public ::comphelper::MultipleItemConverter @@ -121,7 +121,7 @@ public: virtual ~AllSeriesStatisticsConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; }; } // namespace wrapper diff --git a/chart2/source/controller/inc/MultipleItemConverter.hxx b/chart2/source/controller/inc/MultipleItemConverter.hxx index 89e27a67c7e1..7ac432bd1c7d 100644 --- a/chart2/source/controller/inc/MultipleItemConverter.hxx +++ b/chart2/source/controller/inc/MultipleItemConverter.hxx @@ -37,7 +37,7 @@ namespace comphelper { -/** Note: virtual const USHORT * GetWhichPairs() const; is still pure virtual +/** Note: virtual const sal_uInt16 * GetWhichPairs() const; is still pure virtual */ class MultipleItemConverter : public ItemConverter { diff --git a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx index 9aa85a8858c9..a02a0d956515 100644 --- a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx +++ b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx @@ -62,12 +62,12 @@ public: virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx index 2064cb77fc50..799189ff1017 100644 --- a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx +++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx @@ -65,12 +65,12 @@ public: virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx index f900d1096976..1029accb3f3a 100644 --- a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx +++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx @@ -55,12 +55,12 @@ public: virtual ~SeriesOptionsItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/StatisticsItemConverter.hxx b/chart2/source/controller/inc/StatisticsItemConverter.hxx index e20a3f839068..44e157039a89 100644 --- a/chart2/source/controller/inc/StatisticsItemConverter.hxx +++ b/chart2/source/controller/inc/StatisticsItemConverter.hxx @@ -32,7 +32,7 @@ #include "ItemConverter.hxx" #include "GraphicPropertyItemConverter.hxx" -#include "chartview/NumberFormatterWrapper.hxx" +#include "NumberFormatterWrapper.hxx" #include <vector> @@ -56,12 +56,12 @@ public: virtual ~StatisticsItemConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx index e5ba911fa411..cb149ffdd43f 100644 --- a/chart2/source/controller/inc/TitleItemConverter.hxx +++ b/chart2/source/controller/inc/TitleItemConverter.hxx @@ -62,12 +62,12 @@ public: virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const; - virtual void FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( ::com::sun::star::uno::Exception ); - virtual bool ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( ::com::sun::star::uno::Exception ); private: diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx index 1ea3fe942b1b..74ef15aa9fce 100644 --- a/chart2/source/controller/inc/dlg_DataEditor.hxx +++ b/chart2/source/controller/inc/dlg_DataEditor.hxx @@ -63,7 +63,7 @@ public: virtual void Resize(); // Dialog - virtual BOOL Close(); + virtual sal_Bool Close(); void SetReadOnly( bool bReadOnly ); bool ApplyChangesToModel(); diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx index c385ebc26dfa..140066f5b5c1 100644 --- a/chart2/source/controller/inc/dlg_DataSource.hxx +++ b/chart2/source/controller/inc/dlg_DataSource.hxx @@ -90,7 +90,7 @@ private: bool m_bRangeChooserTabIsValid; bool m_bDataSourceTabIsValid; - static USHORT m_nLastPageId; + static sal_uInt16 m_nLastPageId; }; } // namespace chart diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx index c0512731db4c..62d9c0cf578b 100644 --- a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx +++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx @@ -74,7 +74,7 @@ protected: HelpButton aPbHelp; public: - SchAxisDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput, BOOL bAxisDlg=true ); + SchAxisDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput, sal_Bool bAxisDlg=true ); virtual ~SchAxisDlg(); void getResult( InsertAxisOrGridDialogData& rOutput ); diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx index 02deda974fc3..2f40c7dcc20c 100644 --- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx +++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx @@ -70,6 +70,8 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > getDocument() const; + bool IsComplexCategoriesAxis() const; + private: rtl::OUString m_aObjectCID; ObjectType m_eObjectType; @@ -97,6 +99,8 @@ private: ::com::sun::star::uno::Sequence< rtl::OUString > m_aCategories; ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xChartDocument; + + bool m_bComplexCategoriesAxis; }; /************************************************************************* @@ -112,8 +116,8 @@ class SchAttribTabDlg : public SfxTabDialog private: ObjectType eObjectType; bool bAffectsMultipleObjects;//is true if more than one object of the given type will be changed (e.g. all axes or all titles) - USHORT nDlgType; - USHORT nPageType; + sal_uInt16 nDlgType; + sal_uInt16 nPageType; const ObjectPropertiesDialogParameter * const m_pParameter; const ViewElementListProvider* const m_pViewElementListProvider; @@ -125,7 +129,7 @@ private: double m_fAxisMinorStepWidthForErrorBarDecimals; bool m_bOKPressed; - virtual void PageCreated(USHORT nId, SfxTabPage& rPage); + virtual void PageCreated(sal_uInt16 nId, SfxTabPage& rPage); Link m_aOriginalOKClickHdl; DECL_LINK( OKPressed, void * ); diff --git a/chart2/source/controller/inc/dlg_ShapeFont.hxx b/chart2/source/controller/inc/dlg_ShapeFont.hxx index cc9f29cb8e2f..6fdab7a1eca3 100644 --- a/chart2/source/controller/inc/dlg_ShapeFont.hxx +++ b/chart2/source/controller/inc/dlg_ShapeFont.hxx @@ -47,7 +47,7 @@ public: virtual ~ShapeFontDialog(); private: - virtual void PageCreated( USHORT nId, SfxTabPage& rPage ); + virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage ); const ViewElementListProvider* m_pViewElementListProvider; }; diff --git a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx index 8eeaecb6e9de..404bb6e0081a 100644 --- a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx +++ b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx @@ -44,7 +44,7 @@ public: virtual ~ShapeParagraphDialog(); private: - virtual void PageCreated( USHORT nId, SfxTabPage& rPage ); + virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage ); }; //............................................................................. diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx index f11a9c2d7895..d9e82e93000c 100644 --- a/chart2/source/controller/inc/dlg_View3D.hxx +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -73,7 +73,7 @@ private: ControllerLockHelper m_aControllerLocker; - static USHORT m_nLastPageId; + static sal_uInt16 m_nLastPageId; }; //............................................................................. diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx index ad8871dbbc33..74ee6de625fe 100644 --- a/chart2/source/controller/inc/res_ErrorBar.hxx +++ b/chart2/source/controller/inc/res_ErrorBar.hxx @@ -74,7 +74,7 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDocument ); void Reset(const SfxItemSet& rInAttrs); - BOOL FillItemSet(SfxItemSet& rOutAttrs) const; + sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const; void FillValueSets(); diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 0f1ce591ad4f..4eb1a92d21c0 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -39,12 +39,14 @@ #include "ChartModelHelper.hxx" #include "AxisHelper.hxx" #include "CommonConverters.hxx" +#include "ChartTypeHelper.hxx" #include <com/sun/star/chart/ChartAxisLabelPosition.hpp> #include <com/sun/star/chart/ChartAxisMarkPosition.hpp> #include <com/sun/star/chart/ChartAxisPosition.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart2/AxisOrientation.hpp> +#include <com/sun/star/chart2/AxisType.hpp> // for SfxBoolItem #include <svl/eitem.hxx> @@ -59,6 +61,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; +using ::com::sun::star::chart::TimeInterval; +using ::com::sun::star::chart::TimeIncrement; namespace { @@ -66,13 +70,13 @@ namespace { static ::comphelper::ItemPropertyMapType aAxisPropertyMap( ::comphelper::MakeItemPropertyMap - IPM_MAP_ENTRY( SCHATTR_AXIS_SHOWDESCR, "DisplayLabels", 0 ) - IPM_MAP_ENTRY( SCHATTR_AXIS_TICKS, "MajorTickmarks", 0 ) - IPM_MAP_ENTRY( SCHATTR_AXIS_HELPTICKS, "MinorTickmarks", 0 ) - IPM_MAP_ENTRY( SCHATTR_TEXT_ORDER, "ArrangeOrder", 0 ) - IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED, "StackCharacters", 0 ) - IPM_MAP_ENTRY( SCHATTR_TEXTBREAK, "TextBreak", 0 ) - IPM_MAP_ENTRY( SCHATTR_TEXT_OVERLAP, "TextOverlap", 0 ) + IPM_MAP_ENTRY( SCHATTR_AXIS_SHOWDESCR, "DisplayLabels", 0 ) + IPM_MAP_ENTRY( SCHATTR_AXIS_TICKS, "MajorTickmarks", 0 ) + IPM_MAP_ENTRY( SCHATTR_AXIS_HELPTICKS, "MinorTickmarks", 0 ) + IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_ORDER, "ArrangeOrder", 0 ) + IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED, "StackCharacters", 0 ) + IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_BREAK, "TextBreak", 0 ) + IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_OVERLAP, "TextOverlap", 0 ) ); return aAxisPropertyMap; @@ -89,8 +93,8 @@ AxisItemConverter::AxisItemConverter( SfxItemPool& rItemPool, SdrModel& rDrawModel, const Reference< chart2::XChartDocument > & xChartDoc, - chart2::ExplicitScaleData * pScale /* = NULL */, - chart2::ExplicitIncrementData * pIncrement /* = NULL */, + ::chart::ExplicitScaleData * pScale /* = NULL */, + ::chart::ExplicitIncrementData * pIncrement /* = NULL */, ::std::auto_ptr< awt::Size > pRefSize /* = NULL */ ) : ItemConverter( rPropertySet, rItemPool ), m_xChartDoc( xChartDoc ), @@ -100,9 +104,9 @@ AxisItemConverter::AxisItemConverter( Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY ); if( pScale ) - m_pExplicitScale = new chart2::ExplicitScaleData( *pScale ); + m_pExplicitScale = new ::chart::ExplicitScaleData( *pScale ); if( pIncrement ) - m_pExplicitIncrement = new chart2::ExplicitIncrementData( *pIncrement ); + m_pExplicitIncrement = new ::chart::ExplicitIncrementData( *pIncrement ); m_aConverters.push_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, @@ -144,7 +148,7 @@ bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const USHORT * AxisItemConverter::GetWhichPairs() const +const sal_uInt16 * AxisItemConverter::GetWhichPairs() const { // must span all used items! return nAxisWhichPairs; @@ -163,30 +167,40 @@ bool AxisItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWit return true; } -void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const +bool lcl_hasTimeIntervalValue( const uno::Any& rAny ) +{ + bool bRet = false; + TimeInterval aValue; + if( rAny >>= aValue ) + bRet = true; + return bRet; +} + +void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { - if( ! m_xAxis.is() ) + if( !m_xAxis.is() ) return; - const chart2::ScaleData aScale( m_xAxis->getScaleData() ); - const chart2::IncrementData aInc( aScale.IncrementData ); - const uno::Sequence< chart2::SubIncrement > aSubIncs( aScale.IncrementData.SubIncrements ); + const chart2::ScaleData& rScale( m_xAxis->getScaleData() ); + const chart2::IncrementData& rIncrement( rScale.IncrementData ); + const uno::Sequence< chart2::SubIncrement >& rSubIncrements( rScale.IncrementData.SubIncrements ); + const TimeIncrement& rTimeIncrement( rScale.TimeIncrement ); + bool bDateAxis = (chart2::AxisType::DATE == rScale.AxisType); + if( m_pExplicitScale ) + bDateAxis = (chart2::AxisType::DATE == m_pExplicitScale->AxisType); switch( nWhichId ) { case SCHATTR_AXIS_AUTO_MAX: - // if the any has no value => auto is on - rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Maximum) ) ); + rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Maximum) ) ); break; case SCHATTR_AXIS_MAX: { double fMax = 10.0; - if( aScale.Maximum >>= fMax ) - { + if( rScale.Maximum >>= fMax ) rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) ); - } else { if( m_pExplicitScale ) @@ -197,106 +211,141 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS break; case SCHATTR_AXIS_AUTO_MIN: - // if the any has no value => auto is on - rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aScale.Minimum) ) ); + rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Minimum) ) ); break; case SCHATTR_AXIS_MIN: { double fMin = 0.0; - if( aScale.Minimum >>= fMin ) - { + if( rScale.Minimum >>= fMin ) rOutItemSet.Put( SvxDoubleItem( fMin, nWhichId ) ); - } - else - { - if( m_pExplicitScale ) - rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId )); - } + else if( m_pExplicitScale ) + rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId )); } break; case SCHATTR_AXIS_LOGARITHM: - { - BOOL bValue = AxisHelper::isLogarithmic( aScale.Scaling ); - rOutItemSet.Put( SfxBoolItem( nWhichId, bValue )); - } - break; + { + sal_Bool bValue = AxisHelper::isLogarithmic( rScale.Scaling ); + rOutItemSet.Put( SfxBoolItem( nWhichId, bValue )); + } + break; case SCHATTR_AXIS_REVERSE: - rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == aScale.Orientation) )); + rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == rScale.Orientation) )); break; // Increment case SCHATTR_AXIS_AUTO_STEP_MAIN: - // if the any has no value => auto is on - rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(aInc.Distance) ) ); + if( bDateAxis ) + rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MajorTimeInterval) ) ); + else + rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rIncrement.Distance) ) ); + break; + + case SCHATTR_AXIS_MAIN_TIME_UNIT: + { + TimeInterval aTimeInterval; + if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval ) + rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) ); + else if( m_pExplicitIncrement ) + rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MajorTimeInterval.TimeUnit ) ); + } break; case SCHATTR_AXIS_STEP_MAIN: + if( bDateAxis ) + { + TimeInterval aTimeInterval; + if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval ) + rOutItemSet.Put( SvxDoubleItem(aTimeInterval.Number, nWhichId )); + else if( m_pExplicitIncrement ) + rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->MajorTimeInterval.Number, nWhichId )); + } + else { double fDistance = 1.0; - if( aInc.Distance >>= fDistance ) - { + if( rIncrement.Distance >>= fDistance ) rOutItemSet.Put( SvxDoubleItem(fDistance, nWhichId )); - } - else - { - if( m_pExplicitIncrement ) - rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId )); - } + else if( m_pExplicitIncrement ) + rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId )); } break; // SubIncrement case SCHATTR_AXIS_AUTO_STEP_HELP: - { - // if the any has no value => auto is on - rOutItemSet.Put( - SfxBoolItem( - nWhichId, - ! ( aSubIncs.getLength() > 0 && - aSubIncs[0].IntervalCount.hasValue() ))); - } - break; + if( bDateAxis ) + rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MinorTimeInterval) ) ); + else + rOutItemSet.Put( SfxBoolItem( nWhichId, + ! ( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue() ))); + break; + + case SCHATTR_AXIS_HELP_TIME_UNIT: + { + TimeInterval aTimeInterval; + if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval ) + rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) ); + else if( m_pExplicitIncrement ) + rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.TimeUnit ) ); + } + break; case SCHATTR_AXIS_STEP_HELP: - { - if( aSubIncs.getLength() > 0 && - aSubIncs[0].IntervalCount.hasValue()) + if( bDateAxis ) { - OSL_ASSERT( aSubIncs[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG ); - rOutItemSet.Put( - SfxInt32Item( - nWhichId, - *reinterpret_cast< const sal_Int32 * >( - aSubIncs[0].IntervalCount.getValue()) )); + TimeInterval aTimeInterval; + if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval ) + rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.Number )); + else if( m_pExplicitIncrement ) + rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.Number )); } else { - if( m_pExplicitIncrement && - m_pExplicitIncrement->SubIncrements.getLength() > 0 ) + if( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue()) + { + OSL_ASSERT( rSubIncrements[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG ); + rOutItemSet.Put( SfxInt32Item( nWhichId, + *reinterpret_cast< const sal_Int32 * >( + rSubIncrements[0].IntervalCount.getValue()) )); + } + else { - rOutItemSet.Put( - SfxInt32Item( - nWhichId, - m_pExplicitIncrement->SubIncrements[0].IntervalCount )); + if( m_pExplicitIncrement && !m_pExplicitIncrement->SubIncrements.empty() ) + { + rOutItemSet.Put( SfxInt32Item( nWhichId, + m_pExplicitIncrement->SubIncrements[0].IntervalCount )); + } } } - } - break; + break; + + case SCHATTR_AXIS_AUTO_TIME_RESOLUTION: + { + rOutItemSet.Put( SfxBoolItem( nWhichId, + !rTimeIncrement.TimeResolution.hasValue() )); + } + break; + case SCHATTR_AXIS_TIME_RESOLUTION: + { + long nTimeResolution=0; + if( rTimeIncrement.TimeResolution >>= nTimeResolution ) + rOutItemSet.Put( SfxInt32Item( nWhichId, nTimeResolution ) ); + else if( m_pExplicitScale ) + rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitScale->TimeResolution ) ); + } + break; case SCHATTR_AXIS_AUTO_ORIGIN: { - // if the any has no double value => auto is on - rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(aScale.Origin) ))); + rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(rScale.Origin) ))); } break; case SCHATTR_AXIS_ORIGIN: { double fOrigin = 0.0; - if( !(aScale.Origin >>= fOrigin) ) + if( !(rScale.Origin >>= fOrigin) ) { if( m_pExplicitScale ) fOrigin = m_pExplicitScale->Origin; @@ -391,12 +440,45 @@ void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemS break; case SCHATTR_AXISTYPE: - rOutItemSet.Put( SfxInt32Item( nWhichId, aScale.AxisType )); + rOutItemSet.Put( SfxInt32Item( nWhichId, rScale.AxisType )); + break; + + case SCHATTR_AXIS_AUTO_DATEAXIS: + rOutItemSet.Put( SfxBoolItem( nWhichId, rScale.AutoDateAxis )); + break; + + case SCHATTR_AXIS_ALLOW_DATEAXIS: + { + Reference< chart2::XCoordinateSystem > xCooSys( + AxisHelper::getCoordinateSystemOfAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) ); + sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0; + AxisHelper::getIndicesForAxis(m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ); + bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), 2, nDimensionIndex ); + rOutItemSet.Put( SfxBoolItem( nWhichId, bChartTypeAllowsDateAxis )); + } break; } } -bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) +bool lcl_isDateAxis( const SfxItemSet & rItemSet ) +{ + sal_Int32 nAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( SCHATTR_AXISTYPE )).GetValue();//::com::sun::star::chart2::AxisType + return (chart2::AxisType::DATE == nAxisType); +} + +bool lcl_isAutoMajor( const SfxItemSet & rItemSet ) +{ + bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue(); + return bRet; +} + +bool lcl_isAutoMinor( const SfxItemSet & rItemSet ) +{ + bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue(); + return bRet; +} + +bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { if( !m_xAxis.is() ) @@ -502,23 +584,47 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI // Increment case SCHATTR_AXIS_AUTO_STEP_MAIN: - if( (static_cast< const SfxBoolItem & >( - rItemSet.Get( nWhichId )).GetValue() )) + if( lcl_isAutoMajor(rItemSet) ) { aScale.IncrementData.Distance.clear(); + aScale.TimeIncrement.MajorTimeInterval.clear(); bSetScale = true; } // else SCHATTR_AXIS_STEP_MAIN must have some value break; + case SCHATTR_AXIS_MAIN_TIME_UNIT: + if( !lcl_isAutoMajor(rItemSet) ) + { + if( rItemSet.Get( nWhichId ).QueryValue( aValue ) ) + { + TimeInterval aTimeInterval; + aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval; + aValue >>= aTimeInterval.TimeUnit; + aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval ); + bSetScale = true; + } + } + break; + case SCHATTR_AXIS_STEP_MAIN: // only if auto if false - if( ! (static_cast< const SfxBoolItem & >( - rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue() )) + if( !lcl_isAutoMajor(rItemSet) ) { rItemSet.Get( nWhichId ).QueryValue( aValue ); - - if( aScale.IncrementData.Distance != aValue ) + if( lcl_isDateAxis(rItemSet) ) + { + double fValue = 1.0; + if( aValue >>= fValue ) + { + TimeInterval aTimeInterval; + aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval; + aTimeInterval.Number = static_cast<double>(fValue); + aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval ); + bSetScale = true; + } + } + else if( aScale.IncrementData.Distance != aValue ) { aScale.IncrementData.Distance = aValue; bSetScale = true; @@ -528,35 +634,85 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI // SubIncrement case SCHATTR_AXIS_AUTO_STEP_HELP: - if( (static_cast< const SfxBoolItem & >( - rItemSet.Get( nWhichId )).GetValue() ) && - aScale.IncrementData.SubIncrements.getLength() > 0 && - aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ) + if( lcl_isAutoMinor(rItemSet) ) { - aScale.IncrementData.SubIncrements[0].IntervalCount.clear(); + if( aScale.IncrementData.SubIncrements.getLength() > 0 && + aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ) + { + aScale.IncrementData.SubIncrements[0].IntervalCount.clear(); + bSetScale = true; + } + if( aScale.TimeIncrement.MinorTimeInterval.hasValue() ) + { + aScale.TimeIncrement.MinorTimeInterval.clear(); bSetScale = true; + } } // else SCHATTR_AXIS_STEP_MAIN must have some value break; + case SCHATTR_AXIS_HELP_TIME_UNIT: + if( !lcl_isAutoMinor(rItemSet) ) + { + if( rItemSet.Get( nWhichId ).QueryValue( aValue ) ) + { + TimeInterval aTimeInterval; + aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval; + aValue >>= aTimeInterval.TimeUnit; + aScale.TimeIncrement.MinorTimeInterval = uno::makeAny( aTimeInterval ); + bSetScale = true; + } + } + break; + case SCHATTR_AXIS_STEP_HELP: - // only if auto if false - if( ! (static_cast< const SfxBoolItem & >( - rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue() ) && - aScale.IncrementData.SubIncrements.getLength() > 0 ) + // only if auto is false + if( !lcl_isAutoMinor(rItemSet) ) + { + rItemSet.Get( nWhichId ).QueryValue( aValue ); + if( lcl_isDateAxis(rItemSet) ) + { + TimeInterval aTimeInterval; + aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval; + aValue >>= aTimeInterval.Number; + aScale.TimeIncrement.MinorTimeInterval = uno::makeAny(aTimeInterval); + bSetScale = true; + } + else if( aScale.IncrementData.SubIncrements.getLength() > 0 ) + { + if( ! aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() || + aScale.IncrementData.SubIncrements[0].IntervalCount != aValue ) + { + OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG ); + aScale.IncrementData.SubIncrements[0].IntervalCount = aValue; + bSetScale = true; + } + } + } + break; + + case SCHATTR_AXIS_AUTO_TIME_RESOLUTION: + if( (static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue() )) + { + aScale.TimeIncrement.TimeResolution.clear(); + bSetScale = true; + } + break; + case SCHATTR_AXIS_TIME_RESOLUTION: + // only if auto is false + if( ! (static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_TIME_RESOLUTION )).GetValue() )) { rItemSet.Get( nWhichId ).QueryValue( aValue ); - if( ! aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() || - aScale.IncrementData.SubIncrements[0].IntervalCount != aValue ) + if( aScale.TimeIncrement.TimeResolution != aValue ) { - OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG ); - aScale.IncrementData.SubIncrements[0].IntervalCount = aValue; + aScale.TimeIncrement.TimeResolution = aValue; bSetScale = true; } } break; + case SCHATTR_AXIS_AUTO_ORIGIN: { if( (static_cast< const SfxBoolItem & >( @@ -820,7 +976,23 @@ bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rI break; case SCHATTR_AXISTYPE: - //don't allow to change the axis type so far + { + sal_Int32 nNewAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();//::com::sun::star::chart2::AxisType + aScale.AxisType = nNewAxisType; + bSetScale = true; + } + break; + + case SCHATTR_AXIS_AUTO_DATEAXIS: + { + bool bNewValue = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue(); + bool bOldValue = aScale.AutoDateAxis; + if( bOldValue != bNewValue ) + { + aScale.AutoDateAxis = bNewValue; + bSetScale = true; + } + } break; } diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx index 3993a98a90ae..d047a6ac03b6 100644 --- a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx @@ -103,7 +103,7 @@ CharacterPropertyItemConverter::CharacterPropertyItemConverter( CharacterPropertyItemConverter::~CharacterPropertyItemConverter() {} -const USHORT * CharacterPropertyItemConverter::GetWhichPairs() const +const sal_uInt16 * CharacterPropertyItemConverter::GetWhichPairs() const { return nCharacterPropertyWhichPairs; } @@ -121,7 +121,7 @@ bool CharacterPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPr } void CharacterPropertyItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) @@ -289,7 +289,7 @@ void CharacterPropertyItemConverter::FillSpecialItem( } bool CharacterPropertyItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 4359efa95909..e399e4ba82b1 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -108,13 +108,13 @@ sal_Int32 lcl_getSymbolStyleForSymbol( const chart2::Symbol & rSymbol ) return nStyle; } -bool lcl_NumberFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso ) +bool lcl_NumberFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso ) { bool bChanged = false; if( !xPropertySet.is() ) return bChanged; rtl::OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" ); - USHORT nSourceWhich = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE; + sal_uInt16 nSourceWhich = (SID_ATTR_NUMBERFORMAT_VALUE==nWhichId) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE; if( SFX_ITEM_SET != rItemSet.GetItemState( nSourceWhich ) ) return bChanged; @@ -155,13 +155,13 @@ bool lcl_NumberFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet & return bChanged; } -bool lcl_UseSourceFormatFromItemToPropertySet( USHORT nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso ) +bool lcl_UseSourceFormatFromItemToPropertySet( sal_uInt16 nWhichId, const SfxItemSet & rItemSet, const uno::Reference< beans::XPropertySet > & xPropertySet, bool bOverwriteAttributedDataPointsAlso ) { bool bChanged = false; if( !xPropertySet.is() ) return bChanged; rtl::OUString aPropertyName = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? C2U( "NumberFormat" ) : C2U( "PercentageNumberFormat" ); - USHORT nFormatWhich = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE; + sal_uInt16 nFormatWhich = (SID_ATTR_NUMBERFORMAT_SOURCE==nWhichId) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE; if( SFX_ITEM_SET != rItemSet.GetItemState( nWhichId ) ) return bChanged; @@ -291,7 +291,7 @@ bool DataPointItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const USHORT * DataPointItemConverter::GetWhichPairs() const +const sal_uInt16 * DataPointItemConverter::GetWhichPairs() const { // must span all used items! if( m_bDataSeries ) @@ -313,7 +313,7 @@ bool DataPointItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNa bool DataPointItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; @@ -545,7 +545,7 @@ bool DataPointItemConverter::ApplySpecialItem( } void DataPointItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) @@ -643,7 +643,7 @@ void DataPointItemConverter::FillSpecialItem( { SvULongs aList; for ( sal_Int32 nN=0; nN<m_aAvailableLabelPlacements.getLength(); nN++ ) - aList.Insert( m_aAvailableLabelPlacements[nN], sal::static_int_cast< USHORT >(nN) ); + aList.Insert( m_aAvailableLabelPlacements[nN], sal::static_int_cast< sal_uInt16 >(nN) ); rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) ); } break; diff --git a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx index 5330cfa66d02..3304f36f9e42 100644 --- a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx @@ -134,7 +134,7 @@ bool ErrorBarItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const USHORT * ErrorBarItemConverter::GetWhichPairs() const +const sal_uInt16 * ErrorBarItemConverter::GetWhichPairs() const { // must span all used items! return nErrorBarWhichPairs; @@ -148,7 +148,7 @@ bool ErrorBarItemConverter::GetItemProperty( } bool ErrorBarItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; @@ -343,7 +343,7 @@ bool ErrorBarItemConverter::ApplySpecialItem( } void ErrorBarItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx index 91761b8a9337..05b8af1c4ba6 100644 --- a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx @@ -140,7 +140,7 @@ bool lcl_supportsLineProperties( ::chart::wrapper::GraphicPropertyItemConverter: bool lcl_SetContentForNamedProperty( const uno::Reference< lang::XMultiServiceFactory > & xFactory, const ::rtl::OUString & rTableName, - NameOrIndex & rItem, BYTE nMemberId ) + NameOrIndex & rItem, sal_uInt8 nMemberId ) { bool bResult = false; if( xFactory.is()) @@ -184,9 +184,9 @@ GraphicPropertyItemConverter::GraphicPropertyItemConverter( GraphicPropertyItemConverter::~GraphicPropertyItemConverter() {} -const USHORT * GraphicPropertyItemConverter::GetWhichPairs() const +const sal_uInt16 * GraphicPropertyItemConverter::GetWhichPairs() const { - const USHORT * pResult = NULL; + const sal_uInt16 * pResult = NULL; switch( m_eGraphicObjectType ) { @@ -251,7 +251,7 @@ bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tProp } void GraphicPropertyItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) @@ -294,7 +294,7 @@ void GraphicPropertyItemConverter::FillSpecialItem( if( (aValue >>= aName) && aName.getLength()) { - aItem.SetEnabled( TRUE ); + aItem.SetEnabled( sal_True ); rOutItemSet.Put( aItem ); } } @@ -453,7 +453,7 @@ void GraphicPropertyItemConverter::FillSpecialItem( } bool GraphicPropertyItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx index 7e5b9ec9839d..a121a774615c 100644 --- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx @@ -101,7 +101,7 @@ void ItemConverter::_disposing( const lang::EventObject& rSource ) void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const { - const USHORT * pRanges = rOutItemSet.GetRanges(); + const sal_uInt16 * pRanges = rOutItemSet.GetRanges(); tPropertyNameWithMemberId aProperty; SfxItemPool & rPool = GetItemPool(); @@ -111,13 +111,13 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const while( (*pRanges) != 0) { - USHORT nBeg = (*pRanges); + sal_uInt16 nBeg = (*pRanges); ++pRanges; - USHORT nEnd = (*pRanges); + sal_uInt16 nEnd = (*pRanges); ++pRanges; OSL_ASSERT( nBeg <= nEnd ); - for( USHORT nWhich = nBeg; nWhich <= nEnd; ++nWhich ) + for( sal_uInt16 nWhich = nBeg; nWhich <= nEnd; ++nWhich ) { if( GetItemProperty( nWhich, aProperty )) { @@ -172,14 +172,14 @@ void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const } void ItemConverter::FillSpecialItem( - USHORT /*nWhichId*/, SfxItemSet & /*rOutItemSet*/ ) const + sal_uInt16 /*nWhichId*/, SfxItemSet & /*rOutItemSet*/ ) const throw( uno::Exception ) { OSL_FAIL( "ItemConverter: Unhandled special item found!" ); } bool ItemConverter::ApplySpecialItem( - USHORT /*nWhichId*/, const SfxItemSet & /*rItemSet*/ ) + sal_uInt16 /*nWhichId*/, const SfxItemSet & /*rItemSet*/ ) throw( uno::Exception ) { OSL_FAIL( "ItemConverter: Unhandled special item found!" ); @@ -198,7 +198,7 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) while( pItem ) { - if( rItemSet.GetItemState( pItem->Which(), FALSE ) == SFX_ITEM_SET ) + if( rItemSet.GetItemState( pItem->Which(), sal_False ) == SFX_ITEM_SET ) { if( GetItemProperty( pItem->Which(), aProperty )) { @@ -242,13 +242,13 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet ) { SfxWhichIter aIter (rSourceSet); - USHORT nWhich = aIter.FirstWhich (); + sal_uInt16 nWhich = aIter.FirstWhich (); const SfxPoolItem *pPoolItem = NULL; while (nWhich) { - if ((rSourceSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_SET) && - (rDestSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_SET)) + if ((rSourceSet.GetItemState(nWhich, sal_True, &pPoolItem) == SFX_ITEM_SET) && + (rDestSet.GetItemState(nWhich, sal_True, &pPoolItem) == SFX_ITEM_SET)) { if (rSourceSet.Get(nWhich) != rDestSet.Get(nWhich)) { @@ -258,7 +258,7 @@ void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItem } } } - else if( rSourceSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_DONTCARE ) + else if( rSourceSet.GetItemState(nWhich, sal_True, &pPoolItem) == SFX_ITEM_DONTCARE ) rDestSet.InvalidateItem(nWhich); nWhich = aIter.NextWhich (); diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx index d17feda59b48..75f2254c2218 100644 --- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx @@ -34,10 +34,12 @@ #include "ItemPropertyMap.hxx" #include "GraphicPropertyItemConverter.hxx" #include "CharacterPropertyItemConverter.hxx" -#include <svx/chrtitem.hxx> #include <com/sun/star/chart2/XLegend.hpp> #include <com/sun/star/chart2/LegendPosition.hpp> -#include <com/sun/star/chart2/LegendExpansion.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> + +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> #include <functional> #include <algorithm> @@ -92,7 +94,7 @@ bool LegendItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const USHORT * LegendItemConverter::GetWhichPairs() const +const sal_uInt16 * LegendItemConverter::GetWhichPairs() const { // must span all used items! return nLegendWhichPairs; @@ -105,52 +107,19 @@ bool LegendItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPropertyN } -bool LegendItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) +bool LegendItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet& rInItemSet ) throw( uno::Exception ) { bool bChanged = false; switch( nWhichId ) { - case SCHATTR_LEGEND_POS: + case SCHATTR_LEGEND_SHOW: { - chart2::LegendPosition eNewPos = chart2::LegendPosition_LINE_END; - chart2::LegendPosition eOldPos; - bool bIsWide = false; - sal_Bool bShow = sal_True; - - SvxChartLegendPos eItemPos = - static_cast< const SvxChartLegendPosItem & >( - rItemSet.Get( nWhichId )).GetValue(); - switch( eItemPos ) - { - case CHLEGEND_LEFT: - eNewPos = chart2::LegendPosition_LINE_START; - break; - case CHLEGEND_RIGHT: - eNewPos = chart2::LegendPosition_LINE_END; - break; - case CHLEGEND_TOP: - eNewPos = chart2::LegendPosition_PAGE_START; - bIsWide = true; - break; - case CHLEGEND_BOTTOM: - eNewPos = chart2::LegendPosition_PAGE_END; - bIsWide = true; - break; - - case CHLEGEND_NONE: - case CHLEGEND_NONE_LEFT: - case CHLEGEND_NONE_RIGHT: - case CHLEGEND_NONE_TOP: - case CHLEGEND_NONE_BOTTOM: - bShow = sal_False; - break; - } - - try + const SfxPoolItem* pPoolItem = NULL; + if( rInItemSet.GetItemState( SCHATTR_LEGEND_SHOW, sal_True, &pPoolItem ) == SFX_ITEM_SET ) { + sal_Bool bShow = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); sal_Bool bWasShown = sal_True; if( ! (GetPropertySet()->getPropertyValue( C2U("Show")) >>= bWasShown) || ( bWasShown != bShow )) @@ -158,25 +127,48 @@ bool LegendItemConverter::ApplySpecialItem( GetPropertySet()->setPropertyValue( C2U("Show"), uno::makeAny( bShow )); bChanged = true; } + } + + } + break; + case SCHATTR_LEGEND_POS: + { + const SfxPoolItem* pPoolItem = NULL; + if( rInItemSet.GetItemState( SCHATTR_LEGEND_POS, sal_True, &pPoolItem ) == SFX_ITEM_SET ) + { + chart2::LegendPosition eNewPos = static_cast<chart2::LegendPosition>(((const SfxInt32Item*)pPoolItem)->GetValue()); - if( bShow ) + ::com::sun::star::chart::ChartLegendExpansion eExpansion = ::com::sun::star::chart::ChartLegendExpansion_HIGH; + switch( eNewPos ) { + case chart2::LegendPosition_LINE_START: + case chart2::LegendPosition_LINE_END: + eExpansion = ::com::sun::star::chart::ChartLegendExpansion_HIGH; + break; + case chart2::LegendPosition_PAGE_START: + case chart2::LegendPosition_PAGE_END: + eExpansion = ::com::sun::star::chart::ChartLegendExpansion_WIDE; + break; + default: + break; + } + + try + { + chart2::LegendPosition eOldPos; if( ! ( GetPropertySet()->getPropertyValue( C2U( "AnchorPosition" )) >>= eOldPos ) || ( eOldPos != eNewPos )) { GetPropertySet()->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny( eNewPos )); - chart2::LegendExpansion eExp = bIsWide - ? chart2::LegendExpansion_WIDE - : chart2::LegendExpansion_HIGH; - GetPropertySet()->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExp )); + GetPropertySet()->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eExpansion )); GetPropertySet()->setPropertyValue( C2U( "RelativePosition" ), uno::Any()); bChanged = true; } } - } - catch( uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); + catch( uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } } } break; @@ -186,48 +178,23 @@ bool LegendItemConverter::ApplySpecialItem( } void LegendItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) { - case SCHATTR_LEGEND_POS: + case SCHATTR_LEGEND_SHOW: { - SvxChartLegendPos eItemPos( CHLEGEND_RIGHT ); - chart2::LegendPosition ePos; - sal_Bool bShow = sal_True; GetPropertySet()->getPropertyValue( C2U( "Show" )) >>= bShow; - - if( ! bShow ) - { - eItemPos = CHLEGEND_NONE; - } - else if( GetPropertySet()->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos ) - { - switch( ePos ) - { - case chart2::LegendPosition_LINE_START: - eItemPos = CHLEGEND_LEFT; - break; - case chart2::LegendPosition_LINE_END: - eItemPos = CHLEGEND_RIGHT; - break; - case chart2::LegendPosition_PAGE_START: - eItemPos = CHLEGEND_TOP; - break; - case chart2::LegendPosition_PAGE_END: - eItemPos = CHLEGEND_BOTTOM; - break; - - case chart2::LegendPosition_CUSTOM: - default: - eItemPos = CHLEGEND_RIGHT; - break; - } - } - - rOutItemSet.Put( SvxChartLegendPosItem( eItemPos, SCHATTR_LEGEND_POS ) ); + rOutItemSet.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, bShow) ); + } + break; + case SCHATTR_LEGEND_POS: + { + chart2::LegendPosition eLegendPos( chart2::LegendPosition_LINE_END ); + GetPropertySet()->getPropertyValue( C2U( "AnchorPosition" )) >>= eLegendPos; + rOutItemSet.Put( SfxInt32Item(SCHATTR_LEGEND_POS, eLegendPos ) ); } break; } diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index 9ba75dbbe6ea..46d5269793de 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -84,7 +84,7 @@ AllAxisItemConverter::~AllAxisItemConverter() { } -const USHORT * AllAxisItemConverter::GetWhichPairs() const +const sal_uInt16 * AllAxisItemConverter::GetWhichPairs() const { // must span all used items! return nAllAxisWhichPairs; @@ -114,7 +114,7 @@ AllGridItemConverter::~AllGridItemConverter() { } -const USHORT * AllGridItemConverter::GetWhichPairs() const +const sal_uInt16 * AllGridItemConverter::GetWhichPairs() const { // must span all used items! return nGridWhichPairs; @@ -162,7 +162,7 @@ AllDataLabelItemConverter::~AllDataLabelItemConverter() { } -const USHORT * AllDataLabelItemConverter::GetWhichPairs() const +const sal_uInt16 * AllDataLabelItemConverter::GetWhichPairs() const { // must span all used items! return nDataLabelWhichPairs; @@ -196,7 +196,7 @@ AllTitleItemConverter::~AllTitleItemConverter() { } -const USHORT * AllTitleItemConverter::GetWhichPairs() const +const sal_uInt16 * AllTitleItemConverter::GetWhichPairs() const { // must span all used items! return nTitleWhichPairs; @@ -224,7 +224,7 @@ AllSeriesStatisticsConverter::AllSeriesStatisticsConverter( AllSeriesStatisticsConverter::~AllSeriesStatisticsConverter() {} -const USHORT * AllSeriesStatisticsConverter::GetWhichPairs() const +const sal_uInt16 * AllSeriesStatisticsConverter::GetWhichPairs() const { // must span all used items! return nStatWhichPairs; diff --git a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx index 672bf52ab652..e517fdd82702 100644 --- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx @@ -112,7 +112,7 @@ bool RegressionCurveItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const USHORT * RegressionCurveItemConverter::GetWhichPairs() const +const sal_uInt16 * RegressionCurveItemConverter::GetWhichPairs() const { // must span all used items! return nRegressionCurveWhichPairs; @@ -127,7 +127,7 @@ bool RegressionCurveItemConverter::GetItemProperty( bool RegressionCurveItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { uno::Reference< chart2::XRegressionCurve > xCurve( GetPropertySet(), uno::UNO_QUERY ); @@ -172,7 +172,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem( OSL_ASSERT( xCurve.is()); if( xCurve.is()) { - bool bNewShow = static_cast< BOOL >( + bool bNewShow = static_cast< sal_Bool >( static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue()); @@ -195,7 +195,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem( OSL_ASSERT( xCurve.is()); if( xCurve.is()) { - bool bNewShow = static_cast< BOOL >( + bool bNewShow = static_cast< sal_Bool >( static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue()); @@ -218,7 +218,7 @@ bool RegressionCurveItemConverter::ApplySpecialItem( } void RegressionCurveItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { uno::Reference< chart2::XRegressionCurve > xCurve( GetPropertySet(), uno::UNO_QUERY ); diff --git a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx index e4e95884461c..0244bc6cba92 100644 --- a/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/RegressionEquationItemConverter.cxx @@ -105,7 +105,7 @@ bool RegressionEquationItemConverter::ApplyItemSet( const SfxItemSet & rItemSet return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const USHORT * RegressionEquationItemConverter::GetWhichPairs() const +const sal_uInt16 * RegressionEquationItemConverter::GetWhichPairs() const { // must span all used items! return nRegEquationWhichPairs; @@ -124,7 +124,7 @@ bool RegressionEquationItemConverter::GetItemProperty( tWhichIdType nWhichId, tP } bool RegressionEquationItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; @@ -149,7 +149,7 @@ bool RegressionEquationItemConverter::ApplySpecialItem( } void RegressionEquationItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx index 596c495b8635..7a842dfe2174 100644 --- a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx +++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx @@ -42,10 +42,9 @@ namespace EE_ITEMS_START, EE_ITEMS_END, \ SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING -const USHORT nTitleWhichPairs[] = +const sal_uInt16 nTitleWhichPairs[] = { - SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx - SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx + SCHATTR_TEXT_START, SCHATTR_TEXT_END, XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx @@ -53,40 +52,33 @@ const USHORT nTitleWhichPairs[] = 0 }; -const USHORT nAxisWhichPairs[] = +const sal_uInt16 nAxisWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx CHARACTER_WHICHPAIRS, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, // 10585 - 10585 svx/svxids.hrc SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, // 11432 svx/svxids.hrc - SCHATTR_AXISTYPE, SCHATTR_AXISTYPE, // 39 sch/schattr.hxx - SCHATTR_TEXT_START, SCHATTR_TEXT_END, // 4 - 6 sch/schattr.hxx - SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx - SCHATTR_TEXT_OVERLAP, SCHATTR_TEXT_OVERLAP, // 54 sch/schattr.hxx - SCHATTR_AXIS_START, SCHATTR_AXIS_END, // 70 - 95 sch/schattr.hxx - SCHATTR_TEXTBREAK, SCHATTR_TEXTBREAK, // 30587 sch/schattr.hxx + SCHATTR_AXIS_START, SCHATTR_AXIS_END, + SCHATTR_TEXT_START, SCHATTR_TEXT_END, 0 }; -const USHORT nAllAxisWhichPairs[] = +const sal_uInt16 nAllAxisWhichPairs[] = { - XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx + XATTR_LINE_FIRST, XATTR_LINE_LAST, CHARACTER_WHICHPAIRS, - SCHATTR_TEXT_START, SCHATTR_TEXT_END, // 4 - 6 sch/schattr.hxx - SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx - SCHATTR_TEXT_OVERLAP, SCHATTR_TEXT_OVERLAP, // 54 sch/schattr.hxx - SCHATTR_AXIS_SHOWDESCR, SCHATTR_AXIS_SHOWDESCR, // 85 sch/schattr.hxx - SCHATTR_TEXTBREAK, SCHATTR_TEXTBREAK, // 30587 sch/schattr.hxx + SCHATTR_AXIS_LABEL_START, SCHATTR_AXIS_LABEL_END, + SCHATTR_TEXT_START, SCHATTR_TEXT_END, 0 }; -const USHORT nGridWhichPairs[] = +const sal_uInt16 nGridWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx 0 }; -const USHORT nLegendWhichPairs[] = +const sal_uInt16 nLegendWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx @@ -96,13 +88,11 @@ const USHORT nLegendWhichPairs[] = 0 }; -const USHORT nDataLabelWhichPairs[] = +const sal_uInt16 nDataLabelWhichPairs[] = { SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, /* 10585 - 10585 svx/svxids.hrc */ \ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */ \ - SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, /* 40 sch/schattr.hxx*/ \ - SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, /* 41 sch/schattr.hxx*/ \ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, EE_PARA_WRITINGDIR,EE_PARA_WRITINGDIR, 0 @@ -116,15 +106,13 @@ const USHORT nDataLabelWhichPairs[] = SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, /* 1 - 2 sch/schattr.hxx*/ \ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, /* 10585 - 10585 svx/svxids.hrc */ \ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, /* 11432 svx/svxids.hrc */ \ - SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, /* 40 sch/schattr.hxx*/ \ - SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, /* 41 sch/schattr.hxx*/ \ SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES, \ SCHATTR_STYLE_START,SCHATTR_STYLE_END, /* 59 - 68 sch/schattr.hxx*/ \ SCHATTR_SYMBOL_BRUSH,SCHATTR_SYMBOL_BRUSH, /* 94 sch/schattr.hxx*/ \ SCHATTR_SYMBOL_SIZE,SCHATTR_SYMBOL_SIZE, /* 97 sch/schattr.hxx*/ \ SDRATTR_3D_FIRST, SDRATTR_3D_LAST /* 1244 - 1334 svx/svddef.hxx */ -const USHORT nDataPointWhichPairs[] = +const sal_uInt16 nDataPointWhichPairs[] = { CHART_POINT_WHICHPAIRS, 0 @@ -140,20 +128,20 @@ const USHORT nDataPointWhichPairs[] = SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS,SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, \ SCHATTR_INCLUDE_HIDDEN_CELLS,SCHATTR_INCLUDE_HIDDEN_CELLS -const USHORT nSeriesOptionsWhichPairs[] = +const sal_uInt16 nSeriesOptionsWhichPairs[] = { CHART_SERIES_OPTIONS_WHICHPAIRS, 0 }; -const USHORT nRowWhichPairs[] = +const sal_uInt16 nRowWhichPairs[] = { CHART_POINT_WHICHPAIRS, CHART_SERIES_OPTIONS_WHICHPAIRS, 0 }; -const USHORT nAreaWhichPairs[] = +const sal_uInt16 nAreaWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx @@ -161,30 +149,28 @@ const USHORT nAreaWhichPairs[] = 0 }; -const USHORT nTextWhichPairs[] = +const sal_uInt16 nTextWhichPairs[] = { CHARACTER_WHICHPAIRS, - SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx - SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx + SCHATTR_TEXT_START, SCHATTR_TEXT_END, 0 }; -const USHORT nTextOrientWhichPairs[] = +const sal_uInt16 nTextOrientWhichPairs[] = { CHARACTER_WHICHPAIRS, - SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx - SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx + SCHATTR_TEXT_START, SCHATTR_TEXT_END, 0 }; -const USHORT nStatWhichPairs[]= +const sal_uInt16 nStatWhichPairs[]= { SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109 0 }; -const USHORT nErrorBarWhichPairs[]= +const sal_uInt16 nErrorBarWhichPairs[]= { SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx @@ -193,26 +179,26 @@ const USHORT nErrorBarWhichPairs[]= // for CharacterProperties -const USHORT nCharacterPropertyWhichPairs[] = +const sal_uInt16 nCharacterPropertyWhichPairs[] = { CHARACTER_WHICHPAIRS, 0 }; -const USHORT nLinePropertyWhichPairs[] = +const sal_uInt16 nLinePropertyWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx 0 }; -const USHORT nFillPropertyWhichPairs[] = +const sal_uInt16 nFillPropertyWhichPairs[] = { XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx 0 }; -const USHORT nLineAndFillPropertyWhichPairs[] = +const sal_uInt16 nLineAndFillPropertyWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx @@ -220,7 +206,7 @@ const USHORT nLineAndFillPropertyWhichPairs[] = 0 }; -const USHORT nChartStyleWhichPairs[] = +const sal_uInt16 nChartStyleWhichPairs[] = { SCHATTR_DIAGRAM_STYLE, SCHATTR_DIAGRAM_STYLE, SCHATTR_STYLE_SHAPE, SCHATTR_STYLE_SHAPE, @@ -230,14 +216,14 @@ const USHORT nChartStyleWhichPairs[] = 0 }; -const USHORT nRegressionCurveWhichPairs[] = +const sal_uInt16 nRegressionCurveWhichPairs[] = { SCHATTR_REGRESSION_START, SCHATTR_REGRESSION_END, // 108 - 109 XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx 0 }; -const USHORT nRegEquationWhichPairs[] = +const sal_uInt16 nRegEquationWhichPairs[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index ce2bf41a7479..1782d9513caa 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -187,7 +187,7 @@ SeriesOptionsItemConverter::~SeriesOptionsItemConverter() { } -const USHORT * SeriesOptionsItemConverter::GetWhichPairs() const +const sal_uInt16 * SeriesOptionsItemConverter::GetWhichPairs() const { // must span all used items! return nSeriesOptionsWhichPairs; @@ -198,7 +198,7 @@ bool SeriesOptionsItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPr return false; } -bool SeriesOptionsItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) +bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; @@ -373,7 +373,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxIte } void SeriesOptionsItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) @@ -435,7 +435,7 @@ void SeriesOptionsItemConverter::FillSpecialItem( { SvULongs aList; for ( sal_Int32 nN=0; nN<m_aSupportedMissingValueTreatments.getLength(); nN++ ) - aList.Insert( m_aSupportedMissingValueTreatments[nN], sal::static_int_cast< USHORT >(nN) ); + aList.Insert( m_aSupportedMissingValueTreatments[nN], sal::static_int_cast< sal_uInt16 >(nN) ); rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) ); break; } diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx index 7efa65b92ea7..60b5141c3a9c 100644 --- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx @@ -154,7 +154,7 @@ uno::Reference< beans::XPropertySet > lcl_getEquationProperties( { SvxChartRegress eRegress = CHREGRESS_NONE; const SfxPoolItem *pPoolItem = NULL; - if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, TRUE, &pPoolItem ) == SFX_ITEM_SET ) + if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, sal_True, &pPoolItem ) == SFX_ITEM_SET ) { eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue(); bEquationExists = ( eRegress != CHREGRESS_NONE ); @@ -204,7 +204,7 @@ StatisticsItemConverter::StatisticsItemConverter( StatisticsItemConverter::~StatisticsItemConverter() {} -const USHORT * StatisticsItemConverter::GetWhichPairs() const +const sal_uInt16 * StatisticsItemConverter::GetWhichPairs() const { // must span all used items! return nStatWhichPairs; @@ -218,7 +218,7 @@ bool StatisticsItemConverter::GetItemProperty( } bool StatisticsItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; @@ -522,7 +522,7 @@ bool StatisticsItemConverter::ApplySpecialItem( } void StatisticsItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index fffaa31a8590..2dd9d8730055 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -76,7 +76,7 @@ public: virtual ~FormattedStringsConverter(); protected: - virtual const USHORT * GetWhichPairs() const; + virtual const sal_uInt16 * GetWhichPairs() const; }; // ---------------------------------------- @@ -110,7 +110,7 @@ FormattedStringsConverter::~FormattedStringsConverter() { } -const USHORT * FormattedStringsConverter::GetWhichPairs() const +const sal_uInt16 * FormattedStringsConverter::GetWhichPairs() const { return nCharacterPropertyWhichPairs; } @@ -171,7 +171,7 @@ bool TitleItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const USHORT * TitleItemConverter::GetWhichPairs() const +const sal_uInt16 * TitleItemConverter::GetWhichPairs() const { // must span all used items! return nTitleWhichPairs; @@ -191,7 +191,7 @@ bool TitleItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWi bool TitleItemConverter::ApplySpecialItem( - USHORT nWhichId, const SfxItemSet & rItemSet ) + sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) throw( uno::Exception ) { bool bChanged = false; @@ -222,7 +222,7 @@ bool TitleItemConverter::ApplySpecialItem( } void TitleItemConverter::FillSpecialItem( - USHORT nWhichId, SfxItemSet & rOutItemSet ) const + sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const throw( uno::Exception ) { switch( nWhichId ) diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 8c6e46057d9a..cf87f5b0ca6a 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -53,13 +53,12 @@ #include "AccessibleChartView.hxx" #include "DrawCommandDispatch.hxx" #include "ShapeController.hxx" -#include "UndoManager.hxx" +#include "UndoActions.hxx" #include <comphelper/InlineContainer.hxx> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> -#include <com/sun/star/chart2/XUndoSupplier.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/util/XCloneable.hpp> @@ -67,6 +66,8 @@ #include <com/sun/star/util/XModeChangeBroadcaster.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> #include <com/sun/star/frame/LayoutManagerEvents.hpp> +#include <com/sun/star/document/XUndoManagerSupplier.hpp> +#include <com/sun/star/document/XUndoAction.hpp> //------- // header for define RET_OK @@ -86,6 +87,7 @@ // object in the DTOR #include <svtools/acceleratorexecute.hxx> #include <svx/ActionDescriptionProvider.hxx> +#include <tools/diagnose_ex.h> // enable the following define to let the controller listen to model changes and // react on this by rebuilding the view @@ -470,6 +472,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent if( rEvent.NewMode.equals(C2U("dirty")) ) { //the view has become dirty, we should repaint it if we have a window + SolarMutexGuard aGuard; if( m_pChartWindow ) m_pChartWindow->ForceInvalidate(); } @@ -512,8 +515,11 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent impl_initializeAccessible(); - if( m_pChartWindow ) - m_pChartWindow->Invalidate(); + { + SolarMutexGuard aGuard; + if( m_pChartWindow ) + m_pChartWindow->Invalidate(); + } } m_bConnectingToView = false; @@ -522,8 +528,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent } } - sal_Bool SAL_CALL ChartController -::attachModel( const uno::Reference< frame::XModel > & xModel ) +sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XModel > & xModel ) throw(uno::RuntimeException) { impl_invalidateAccessible(); @@ -531,15 +536,10 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent //is called to attach the controller to a new model. //return true if attach was successfully, false otherwise (e.g. if you do not work with a model) - { - // FIXME: ths is suspicious: why just proctect the call to isDisposedOrSuspened - // and not all the way until he new model is attached ? - // seems racy to me - SolarMutexGuard aGuard; - if( impl_isDisposedOrSuspended() ) //@todo? allow attaching a new model while suspended? - return sal_False; //behave passive if already disposed or suspended - } - + SolarMutexClearableGuard aClearableGuard; + if( impl_isDisposedOrSuspended() ) //@todo? allow attaching a new model while suspended? + return sal_False; //behave passive if already disposed or suspended + aClearableGuard.clear(); TheModelRef aNewModelRef( new TheModel( xModel), m_aModelMutex); TheModelRef aOldModelRef(m_aModel,m_aModelMutex); @@ -608,12 +608,14 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent } //the frameloader is responsible to call xModel->connectController - if( m_pChartWindow ) - m_pChartWindow->Invalidate(); + { + SolarMutexGuard aGuard; + if( m_pChartWindow ) + m_pChartWindow->Invalidate(); + } - uno::Reference< chart2::XUndoSupplier > xUndoSupplier( getModel(), uno::UNO_QUERY ); - if( xUndoSupplier.is()) - m_xUndoManager.set( xUndoSupplier->getUndoManager()); + uno::Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW ); + m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW ); return sal_True; } @@ -1084,6 +1086,7 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) else if(aCommand.equals("Update")) //Update Chart { ChartViewHelper::setViewToDirtyState( getModel() ); + SolarMutexGuard aGuard; if( m_pChartWindow ) m_pChartWindow->Invalidate(); } @@ -1286,7 +1289,7 @@ void SAL_CALL ChartController::executeDispatch_ChartType() { // using assignment for broken gcc 3.3 UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard( - ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_CHARTTYPE ))), m_xUndoManager, getModel() ); + String( SchResId( STR_ACTION_EDIT_CHARTTYPE )), m_xUndoManager ); SolarMutexGuard aSolarGuard; //prepare and open dialog @@ -1294,7 +1297,7 @@ void SAL_CALL ChartController::executeDispatch_ChartType() if( aDlg.Execute() == RET_OK ) { impl_adaptDataSeriesAutoResize(); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -1309,7 +1312,7 @@ void SAL_CALL ChartController::executeDispatch_SourceData() // using assignment for broken gcc 3.3 UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard( - ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_DATA_RANGES ))), m_xUndoManager, getModel() ); + String( SchResId( STR_ACTION_EDIT_DATA_RANGES )), m_xUndoManager ); if( xChartDoc.is()) { SolarMutexGuard aSolarGuard; @@ -1317,7 +1320,7 @@ void SAL_CALL ChartController::executeDispatch_SourceData() if( aDlg.Execute() == RET_OK ) { impl_adaptDataSeriesAutoResize(); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } } @@ -1334,14 +1337,14 @@ void SAL_CALL ChartController::executeDispatch_MoveSeries( sal_Bool bForward ) UndoGuardWithSelection aUndoGuard( ActionDescriptionProvider::createDescription( (bForward ? ActionDescriptionProvider::MOVE_TOTOP : ActionDescriptionProvider::MOVE_TOBOTTOM), - ::rtl::OUString( String( SchResId( STR_OBJECT_DATASERIES )))), - m_xUndoManager, getModel()); + String( SchResId( STR_OBJECT_DATASERIES ))), + m_xUndoManager ); bool bChanged = DiagramHelper::moveSeries( ChartModelHelper::findDiagram( getModel() ), xGivenDataSeries, bForward ); if( bChanged ) { m_aSelection.setSelection( ObjectIdentifier::getMovedSeriesCID( aObjectCID, bForward ) ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -1396,13 +1399,21 @@ void SAL_CALL ChartController::modified( const lang::EventObject& /* aEvent */ ) IMPL_LINK( ChartController, NotifyUndoActionHdl, SdrUndoAction*, pUndoAction ) { + ENSURE_OR_RETURN( pUndoAction, "invalid Undo action", 1L ); + ::rtl::OUString aObjectCID = m_aSelection.getSelectedCID(); if ( aObjectCID.getLength() == 0 ) { - UndoManager* pUndoManager = UndoManager::getImplementation( m_xUndoManager ); - if ( pUndoManager ) + try + { + const Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW ); + const Reference< document::XUndoManager > xUndoManager( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW ); + const Reference< document::XUndoAction > xAction( new impl::ShapeUndoElement( *pUndoAction ) ); + xUndoManager->addUndoAction( xAction ); + } + catch( const uno::Exception& ) { - pUndoManager->addShapeUndoAction( pUndoAction ); + DBG_UNHANDLED_EXCEPTION(); } } return 0L; @@ -1441,6 +1452,7 @@ uno::Reference< XAccessible > ChartController::CreateAccessible() void ChartController::impl_invalidateAccessible() { + SolarMutexGuard aGuard; if( m_pChartWindow ) { Reference< lang::XInitialization > xInit( m_pChartWindow->GetAccessible(false), uno::UNO_QUERY ); @@ -1453,6 +1465,7 @@ void ChartController::impl_invalidateAccessible() } void ChartController::impl_initializeAccessible() { + SolarMutexGuard aGuard; if( m_pChartWindow ) this->impl_initializeAccessible( Reference< lang::XInitialization >( m_pChartWindow->GetAccessible(false), uno::UNO_QUERY ) ); } @@ -1467,11 +1480,14 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn aArguments[1]=uno::makeAny(xModel); aArguments[2]=uno::makeAny(m_xChartView); uno::Reference< XAccessible > xParent; - if( m_pChartWindow ) { - Window* pParentWin( m_pChartWindow->GetAccessibleParentWindow()); - if( pParentWin ) - xParent.set( pParentWin->GetAccessible()); + SolarMutexGuard aGuard; + if( m_pChartWindow ) + { + Window* pParentWin( m_pChartWindow->GetAccessibleParentWindow()); + if( pParentWin ) + xParent.set( pParentWin->GetAccessible()); + } } aArguments[3]=uno::makeAny(xParent); aArguments[4]=uno::makeAny(m_xViewWindow); diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx index 8ddc44ddb592..829fbe50918d 100644 --- a/chart2/source/controller/main/ChartController.hxx +++ b/chart2/source/controller/main/ChartController.hxx @@ -43,7 +43,7 @@ #include <cppuhelper/implbase12.hxx> #include <com/sun/star/accessibility/XAccessible.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/document/XUndoManager.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -90,6 +90,8 @@ namespace chart { //............................................................................. +class UndoGuard; + enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT }; class WindowController @@ -125,7 +127,7 @@ public: @param rOutEqualRect is filled with a rectangle that denotes the region in which the quick help does not change. - @return </TRUE>, if a quick help should be shown. + @return </sal_True>, if a quick help should be shown. */ virtual bool requestQuickHelp( ::Point aAtLogicPosition, bool bIsBalloonHelp, @@ -579,7 +581,8 @@ private: bool volatile m_bConnectingToView; - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager; + ::std::auto_ptr< UndoGuard > m_pTextActionUndoGuard; /// needed for dispatching URLs in FeatureStateEvents mutable ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; @@ -701,7 +704,7 @@ private: MOVE_OBJECT, CENTERED_RESIZE_OBJECT }; - /// @return </TRUE>, if resize/move was successful + /// @return </sal_True>, if resize/move was successful bool impl_moveOrResizeObject( const ::rtl::OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY ); bool impl_DragDataPoint( const ::rtl::OUString & rCID, double fOffset ); diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx index 4f1cc58bb06b..666ef87eb881 100644 --- a/chart2/source/controller/main/ChartController_EditData.cxx +++ b/chart2/source/controller/main/ChartController_EditData.cxx @@ -66,12 +66,12 @@ void ChartController::executeDispatch_EditData() SolarMutexGuard aSolarGuard; // using assignment for broken gcc 3.3 UndoLiveUpdateGuardWithData aUndoGuard = UndoLiveUpdateGuardWithData( - ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_CHART_DATA ))), - m_xUndoManager, getModel() ); + String( SchResId( STR_ACTION_EDIT_CHART_DATA )), + m_xUndoManager ); DataEditor aDataEditorDialog( pParent, xChartDoc, m_xCC ); // the dialog has no OK/Cancel aDataEditorDialog.Execute(); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } } diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 50d5d6b7fda6..238009d9a8d3 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -45,7 +45,7 @@ #include "DiagramHelper.hxx" #include "macros.hxx" #include "chartview/DrawModelWrapper.hxx" -#include "chartview/NumberFormatterWrapper.hxx" +#include "NumberFormatterWrapper.hxx" #include "ViewElementListProvider.hxx" #include "MultipleChartConverters.hxx" #include "ControllerLockGuard.hxx" @@ -122,8 +122,8 @@ void ChartController::executeDispatch_InsertAxes() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXES )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXES ))), + m_xUndoManager ); try { @@ -147,7 +147,7 @@ void ChartController::executeDispatch_InsertAxes() , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC , mpRefSizeProvider.get() ); if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -160,8 +160,8 @@ void ChartController::executeDispatch_InsertGrid() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRIDS )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRIDS ))), + m_xUndoManager ); try { @@ -181,7 +181,7 @@ void ChartController::executeDispatch_InsertGrid() bool bChanged = AxisHelper::changeVisibilityOfGrids( xDiagram , aDialogInput.aExistenceList, aDialogOutput.aExistenceList, m_xCC ); if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -197,8 +197,8 @@ void ChartController::executeDispatch_InsertTitles() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLES )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLES ))), + m_xUndoManager ); try { @@ -215,7 +215,7 @@ void ChartController::executeDispatch_InsertTitles() aDlg.getResult( aDialogOutput ); bool bChanged = aDialogOutput.writeDifferenceToModel( getModel(), m_xCC, &aDialogInput ); if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -228,30 +228,30 @@ void ChartController::executeDispatch_DeleteLegend() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LEGEND ))), + m_xUndoManager ); LegendHelper::hideLegend( getModel() ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_InsertLegend() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))), + m_xUndoManager ); Reference< chart2::XLegend > xLegend = LegendHelper::showLegend( getModel(), m_xCC ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_OpenLegendDialog() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_LEGEND ))), + m_xUndoManager ); try { @@ -265,7 +265,7 @@ void ChartController::executeDispatch_OpenLegendDialog() ControllerLockGuard aCLGuard( getModel() ); bool bChanged = aDlg.writeToModel( getModel() ); if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -281,8 +281,8 @@ void ChartController::executeDispatch_InsertMenu_DataLabels() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_DATALABELS ))), + m_xUndoManager ); //if a series is selected insert labels for that series only: uno::Reference< chart2::XDataSeries > xSeries( @@ -299,7 +299,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels() bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, true ); if( bSuccess ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); return; } @@ -331,7 +331,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels() ControllerLockGuard aCLGuard( getModel() ); bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -355,7 +355,7 @@ void ChartController::executeDispatch_InsertMenu_YErrorBars() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_ERRORS ) ), - m_xUndoManager, getModel() ); + m_xUndoManager ); try { @@ -381,7 +381,7 @@ void ChartController::executeDispatch_InsertMenu_YErrorBars() ControllerLockGuard aCLGuard( getModel() ); bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -394,19 +394,19 @@ void ChartController::executeDispatch_InsertMeanValue() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), + m_xUndoManager ); lcl_InsertMeanValueLine( m_xCC ).operator()( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() )); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_InsertMenu_MeanValues() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), + m_xUndoManager ); uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); @@ -421,7 +421,7 @@ void ChartController::executeDispatch_InsertMenu_MeanValues() DiagramHelper::getDataSeriesFromDiagram( ChartModelHelper::findDiagram( getModel() ))); ::std::for_each( aSeries.begin(), aSeries.end(), lcl_InsertMeanValueLine( m_xCC )); } - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_InsertMenu_Trendlines() @@ -438,7 +438,7 @@ void ChartController::executeDispatch_InsertMenu_Trendlines() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_CURVE ) ), - m_xUndoManager, getModel() ); + m_xUndoManager ); try { @@ -461,7 +461,7 @@ void ChartController::executeDispatch_InsertMenu_Trendlines() ControllerLockGuard aCLGuard( getModel() ); bool bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -478,8 +478,8 @@ void ChartController::executeDispatch_InsertTrendline() { UndoLiveUpdateGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE ))), + m_xUndoManager ); // add a linear curve RegressionCurveHelper::addRegressionCurve( @@ -519,7 +519,7 @@ void ChartController::executeDispatch_InsertTrendline() ControllerLockGuard aCLGuard( getModel() ); aItemConverter.ApplyItemSet( *pOutItemSet ); } - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } } @@ -532,8 +532,8 @@ void ChartController::executeDispatch_InsertYErrorBars() { UndoLiveUpdateGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_ERROR_BARS ))), + m_xUndoManager ); // add error bars with standard deviation uno::Reference< beans::XPropertySet > xErrorBarProp( @@ -569,7 +569,7 @@ void ChartController::executeDispatch_InsertYErrorBars() ControllerLockGuard aCLGuard( getModel() ); aItemConverter.ApplyItemSet( *pOutItemSet ); } - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } } @@ -592,11 +592,11 @@ void ChartController::executeDispatch_InsertTrendlineEquation( bool bInsertR2 ) // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), + m_xUndoManager ); xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( true )); xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bInsertR2 )); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } } @@ -609,10 +609,10 @@ void ChartController::executeDispatch_InsertR2Value() { UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), + m_xUndoManager ); xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( true )); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -624,10 +624,10 @@ void ChartController::executeDispatch_DeleteR2Value() { UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), + m_xUndoManager ); xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false )); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -639,10 +639,10 @@ void ChartController::executeDispatch_DeleteMeanValue() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), + m_xUndoManager ); RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -654,10 +654,10 @@ void ChartController::executeDispatch_DeleteTrendline() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))), + m_xUndoManager ); RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -669,10 +669,10 @@ void ChartController::executeDispatch_DeleteTrendlineEquation() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), + m_xUndoManager ); RegressionCurveHelper::removeEquations( xRegCurveCnt ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -684,10 +684,10 @@ void ChartController::executeDispatch_DeleteYErrorBars() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE ))), + m_xUndoManager ); StatisticsHelper::removeErrorBars( xDataSeries ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -698,20 +698,20 @@ void ChartController::executeDispatch_InsertDataLabels() if( xSeries.is() ) { UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, - ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))), - m_xUndoManager, getModel() ); + String( SchResId( STR_OBJECT_DATALABELS ))), + m_xUndoManager ); DataSeriesHelper::insertDataLabelsToSeriesAndAllPoints( xSeries ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } void ChartController::executeDispatch_InsertDataLabel() { UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::INSERT, - ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))), - m_xUndoManager, getModel() ); + String( SchResId( STR_OBJECT_LABEL ))), + m_xUndoManager ); DataSeriesHelper::insertDataLabelToPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_DeleteDataLabels() @@ -721,44 +721,44 @@ void ChartController::executeDispatch_DeleteDataLabels() if( xSeries.is() ) { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, - ::rtl::OUString( String( SchResId( STR_OBJECT_DATALABELS )))), - m_xUndoManager, getModel() ); + String( SchResId( STR_OBJECT_DATALABELS ))), + m_xUndoManager ); DataSeriesHelper::deleteDataLabelsFromSeriesAndAllPoints( xSeries ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } void ChartController::executeDispatch_DeleteDataLabel() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, - ::rtl::OUString( String( SchResId( STR_OBJECT_LABEL )))), - m_xUndoManager, getModel() ); + String( SchResId( STR_OBJECT_LABEL ))), + m_xUndoManager ); DataSeriesHelper::deleteDataLabelsFromPoint( ObjectIdentifier::getObjectPropertySet( m_aSelection.getSelectedCID(), getModel() ) ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_ResetAllDataPoints() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, - ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINTS )))), - m_xUndoManager, getModel() ); + String( SchResId( STR_OBJECT_DATAPOINTS ))), + m_xUndoManager ); uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); if( xSeries.is() ) xSeries->resetAllDataPoints(); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_ResetDataPoint() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, - ::rtl::OUString( String( SchResId( STR_OBJECT_DATAPOINT )))), - m_xUndoManager, getModel() ); + String( SchResId( STR_OBJECT_DATAPOINT ))), + m_xUndoManager ); uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), getModel() ), uno::UNO_QUERY ); if( xSeries.is() ) { sal_Int32 nPointIndex = ObjectIdentifier::getIndexFromParticleOrCID( m_aSelection.getSelectedCID() ); xSeries->resetDataPoint( nPointIndex ); } - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_InsertAxisTitle() @@ -769,8 +769,8 @@ void ChartController::executeDispatch_InsertAxisTitle() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_TITLE ))), + m_xUndoManager ); Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() ); sal_Int32 nDimensionIndex = -1; @@ -788,7 +788,7 @@ void ChartController::executeDispatch_InsertAxisTitle() ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProvider( impl_createReferenceSizeProvider()); xTitle = TitleHelper::createTitle( eTitleType, ObjectNameProvider::getTitleNameByType(eTitleType), getModel(), m_xCC, apRefSizeProvider.get() ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -801,8 +801,8 @@ void ChartController::executeDispatch_InsertAxis() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_AXIS ))), + m_xUndoManager ); try { @@ -810,7 +810,7 @@ void ChartController::executeDispatch_InsertAxis() if( xAxis.is() ) { AxisHelper::makeAxisVisible( xAxis ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -823,8 +823,8 @@ void ChartController::executeDispatch_DeleteAxis() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AXIS )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AXIS ))), + m_xUndoManager ); try { @@ -832,7 +832,7 @@ void ChartController::executeDispatch_DeleteAxis() if( xAxis.is() ) { AxisHelper::makeAxisInvisible( xAxis ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -845,8 +845,8 @@ void ChartController::executeDispatch_InsertMajorGrid() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))), + m_xUndoManager ); try { @@ -854,7 +854,7 @@ void ChartController::executeDispatch_InsertMajorGrid() if( xAxis.is() ) { AxisHelper::makeGridVisible( xAxis->getGridProperties() ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -867,8 +867,8 @@ void ChartController::executeDispatch_DeleteMajorGrid() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))), + m_xUndoManager ); try { @@ -876,7 +876,7 @@ void ChartController::executeDispatch_DeleteMajorGrid() if( xAxis.is() ) { AxisHelper::makeGridInvisible( xAxis->getGridProperties() ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -889,8 +889,8 @@ void ChartController::executeDispatch_InsertMinorGrid() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::INSERT, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::INSERT, String( SchResId( STR_OBJECT_GRID ))), + m_xUndoManager ); try { @@ -900,7 +900,7 @@ void ChartController::executeDispatch_InsertMinorGrid() Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++) AxisHelper::makeGridVisible( aSubGrids[nN] ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) @@ -913,8 +913,8 @@ void ChartController::executeDispatch_DeleteMinorGrid() { UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_GRID )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_GRID ))), + m_xUndoManager ); try { @@ -924,7 +924,7 @@ void ChartController::executeDispatch_DeleteMinorGrid() Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++) AxisHelper::makeGridInvisible( aSubGrids[nN] ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException& e) diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx index 96942d1bf055..ffbaf72d8677 100644 --- a/chart2/source/controller/main/ChartController_Position.cxx +++ b/chart2/source/controller/main/ChartController_Position.cxx @@ -38,6 +38,7 @@ #include "UndoGuard.hxx" #include "Strings.hrc" #include "ObjectNameProvider.hxx" +#include "DiagramHelper.hxx" #include "chartview/ExplicitValueProvider.hxx" #include "CommonConverters.hxx" #include <svx/ActionDescriptionProvider.hxx> @@ -73,16 +74,16 @@ void lcl_getPositionAndSizeFromItemSet( const SfxItemSet& rItemSet, Rectangle& r const SfxPoolItem* pPoolItem=NULL; //read position - if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_X,TRUE,&pPoolItem)) + if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_X,sal_True,&pPoolItem)) nPosX=((const SfxInt32Item*)pPoolItem)->GetValue(); - if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_Y,TRUE,&pPoolItem)) + if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_POS_Y,sal_True,&pPoolItem)) nPosY=((const SfxInt32Item*)pPoolItem)->GetValue(); //read size - if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_WIDTH,TRUE,&pPoolItem)) + if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_WIDTH,sal_True,&pPoolItem)) nSizX=((const SfxUInt32Item*)pPoolItem)->GetValue(); - if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,TRUE,&pPoolItem)) + if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_HEIGHT,sal_True,&pPoolItem)) nSizY=((const SfxUInt32Item*)pPoolItem)->GetValue(); - if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT,TRUE,&pPoolItem)) + if (SFX_ITEM_SET==rItemSet.GetItemState(SID_ATTR_TRANSFORM_SIZE_POINT,sal_True,&pPoolItem)) eRP=(RECT_POINT)((const SfxAllEnumItem*)pPoolItem)->GetValue(); switch( eRP ) @@ -136,11 +137,13 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() if( pProvider ) aSelectedSize = ToSize( ( pProvider->getRectangleOfObject( aCID ) ) ); + ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID ); + UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::POS_SIZE, - ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aCID ))), - m_xUndoManager, getModel() ); + ObjectNameProvider::getName( eObjectType)), + m_xUndoManager ); SfxAbstractTabDialog * pDlg = NULL; try @@ -170,12 +173,15 @@ void SAL_CALL ChartController::executeDispatch_PositionAndSize() awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) ); Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); - bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() - , getModel() + bool bChanged = false; + if ( eObjectType == OBJECTTYPE_LEGEND ) + bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true ); + + bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID(), getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); - if( bChanged ) - aUndoGuard.commitAction(); + if( bMoved || bChanged ) + aUndoGuard.commit(); } } delete pDlg; diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 62a3d8bdc929..a84dccbaa2ef 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -715,11 +715,11 @@ void SAL_CALL ChartController::executeDlg_ObjectProperties( const ::rtl::OUStrin UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::FORMAT, ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID ))), - m_xUndoManager, getModel() ); + m_xUndoManager ); bool bSuccess = ChartController::executeDlg_ObjectProperties_withoutUndoGuard( aObjectCID, false ); if( bSuccess ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const ::rtl::OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso ) @@ -831,14 +831,14 @@ void SAL_CALL ChartController::executeDispatch_View3D() { // using assignment for broken gcc 3.3 UndoLiveUpdateGuard aUndoGuard = UndoLiveUpdateGuard( - ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_3D_VIEW ))), - m_xUndoManager, getModel()); + String( SchResId( STR_ACTION_EDIT_3D_VIEW )), + m_xUndoManager ); //open dialog SolarMutexGuard aSolarGuard; View3DDialog aDlg( m_pChartWindow, getModel(), m_pDrawModelWrapper->GetColorTable() ); if( aDlg.Execute() == RET_OK ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } catch( uno::RuntimeException& e) { diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index 8635e80a6597..d61321586561 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -30,6 +30,8 @@ #include "precompiled_chart2.hxx" #include "ChartController.hxx" +#include "ResId.hxx" +#include "UndoGuard.hxx" #include "DrawViewWrapper.hxx" #include "ChartWindow.hxx" #include "TitleHelper.hxx" @@ -37,6 +39,7 @@ #include "macros.hxx" #include "ControllerLockGuard.hxx" #include "AccessibleTextHelper.hxx" +#include "Strings.hrc" #include "chartview/DrawModelWrapper.hxx" #include <svx/svdotext.hxx> @@ -74,11 +77,14 @@ void ChartController::StartTextEdit( const Point* pMousePixel ) { //the first marked object will be edited + SolarMutexGuard aGuard; SdrObject* pTextObj = m_pDrawViewWrapper->getTextEditObject(); if(!pTextObj) return; - m_xUndoManager->preAction( getModel()); + OSL_PRECOND( !m_pTextActionUndoGuard.get(), "ChartController::StartTextEdit: already have a TextUndoGuard!?" ); + m_pTextActionUndoGuard.reset( new UndoGuard( + String( SchResId( STR_ACTION_EDIT_TEXT ) ), m_xUndoManager ) ); SdrOutliner* pOutliner = m_pDrawViewWrapper->getOutliner(); //#i77362 change notification for changes on additional shapes are missing @@ -152,26 +158,11 @@ bool ChartController::EndTextEdit() TitleHelper::setCompleteString( aString, uno::Reference< ::com::sun::star::chart2::XTitle >::query( xPropSet ), m_xCC ); - try - { - m_xUndoManager->postAction( C2U("Edit Text") ); - } - catch( uno::RuntimeException& e) - { - ASSERT_EXCEPTION( e ); - } - } - else - { - try - { - m_xUndoManager->cancelAction(); - } - catch ( uno::RuntimeException& e ) - { - ASSERT_EXCEPTION( e ); - } + OSL_ENSURE( m_pTextActionUndoGuard.get(), "ChartController::EndTextEdit: no TextUndoGuard!" ); + if ( m_pTextActionUndoGuard.get() ) + m_pTextActionUndoGuard->commit(); } + m_pTextActionUndoGuard.reset(); } return true; } @@ -190,10 +181,10 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter() DBG_ASSERT( pFact, "No dialog factory" ); SfxAllItemSet aSet( m_pDrawModelWrapper->GetItemPool() ); - aSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) ); + aSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); //set fixed current font - aSet.Put( SfxBoolItem( FN_PARAM_2, TRUE ) ); //maybe not necessary in future + aSet.Put( SfxBoolItem( FN_PARAM_2, sal_True ) ); //maybe not necessary in future Font aCurFont = m_pDrawViewWrapper->getOutliner()->GetRefDevice()->GetFont(); aSet.Put( SvxFontItem( aCurFont.GetFamily(), aCurFont.GetName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), aCurFont.GetCharSet(), SID_ATTR_CHAR_FONT ) ); @@ -205,7 +196,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter() const SfxItemSet* pSet = pDlg->GetOutputItemSet(); const SfxPoolItem* pItem=0; String aString; - if ( pSet && pSet->GetItemState( SID_CHARMAP, TRUE, &pItem) == SFX_ITEM_SET && + if ( pSet && pSet->GetItemState( SID_CHARMAP, sal_True, &pItem) == SFX_ITEM_SET && pItem->ISA(SfxStringItem) ) aString = dynamic_cast<const SfxStringItem*>(pItem)->GetValue(); @@ -219,13 +210,13 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter() // prevent flicker pOutlinerView->HideCursor(); - pOutliner->SetUpdateMode(FALSE); + pOutliner->SetUpdateMode(sal_False); // delete current selection by inserting empty String, so current // attributes become unique (sel. has to be erased anyway) pOutlinerView->InsertText(String()); - pOutlinerView->InsertText(aString, TRUE); + pOutlinerView->InsertText(aString, true); ESelection aSel = pOutlinerView->GetSelection(); aSel.nStartPara = aSel.nEndPara; @@ -233,7 +224,7 @@ void SAL_CALL ChartController::executeDispatch_InsertSpecialCharacter() pOutlinerView->SetSelection(aSel); // show changes - pOutliner->SetUpdateMode(TRUE); + pOutliner->SetUpdateMode(sal_True); pOutlinerView->ShowCursor(); } diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 23dc588dd13f..3ecee57543b4 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -103,7 +103,7 @@ namespace bool lcl_deleteDataSeries( const OUString & rCID, const Reference< frame::XModel > & xModel, - const Reference< chart2::XUndoManager > & xUndoManager ) + const Reference< document::XUndoManager > & xUndoManager ) { bool bResult = false; uno::Reference< chart2::XDataSeries > xSeries( ::chart::ObjectIdentifier::getDataSeriesForCID( rCID, xModel )); @@ -116,8 +116,8 @@ bool lcl_deleteDataSeries( { ::chart::UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_DATASERIES )))), - xUndoManager, xModel ); + ActionDescriptionProvider::DELETE, String( ::chart::SchResId( STR_OBJECT_DATASERIES ))), + xUndoManager ); Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) ); uno::Reference< chart2::XAxis > xAxis( ::chart::DiagramHelper::getAttachedAxis( xSeries, xDiagram ) ); @@ -127,7 +127,7 @@ bool lcl_deleteDataSeries( ::chart::AxisHelper::hideAxisIfNoDataIsAttached( xAxis, xDiagram ); bResult = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } return bResult; @@ -136,7 +136,7 @@ bool lcl_deleteDataSeries( bool lcl_deleteDataCurve( const OUString & rCID, const Reference< frame::XModel > & xModel, - const Reference< chart2::XUndoManager > & xUndoManager ) + const Reference< document::XUndoManager > & xUndoManager ) { bool bResult = false; uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( @@ -146,11 +146,11 @@ bool lcl_deleteDataCurve( { ::chart::UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_CURVE )))), - xUndoManager, xModel ); + ActionDescriptionProvider::DELETE, String( ::chart::SchResId( STR_OBJECT_CURVE ))), + xUndoManager ); ::chart::RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCurveCnt ); bResult = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } return bResult; } @@ -191,8 +191,8 @@ void ChartController::executeDispatch_NewArrangement() { // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( - ::rtl::OUString( String( SchResId( STR_ACTION_REARRANGE_CHART ))), - m_xUndoManager, xModel ); + String( SchResId( STR_ACTION_REARRANGE_CHART )), + m_xUndoManager ); ControllerLockGuard aCtlLockGuard( xModel ); // diagram @@ -207,7 +207,11 @@ void ChartController::executeDispatch_NewArrangement() // legend Reference< beans::XPropertyState > xLegendState( xDiagram->getLegend(), uno::UNO_QUERY ); if( xLegendState.is()) + { xLegendState->setPropertyToDefault( C2U("RelativePosition")); + xLegendState->setPropertyToDefault( C2U("RelativeSize")); + xLegendState->setPropertyToDefault( C2U("AnchorPosition")); + } // titles for( sal_Int32 eType = TitleHelper::TITLE_BEGIN; @@ -227,7 +231,7 @@ void ChartController::executeDispatch_NewArrangement() ::std::for_each( aRegressionCurves.begin(), aRegressionCurves.end(), RegressionCurveHelper::resetEquationPosition ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } catch( uno::RuntimeException & ex ) @@ -241,18 +245,19 @@ void ChartController::executeDispatch_ScaleText() SolarMutexGuard aSolarGuard; // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( - ::rtl::OUString( String( SchResId( STR_ACTION_SCALE_TEXT ))), - m_xUndoManager, getModel() ); + String( SchResId( STR_ACTION_SCALE_TEXT )), + m_xUndoManager ); ControllerLockGuard aCtlLockGuard( getModel() ); ::std::auto_ptr< ReferenceSizeProvider > apRefSizeProv( impl_createReferenceSizeProvider()); OSL_ASSERT( apRefSizeProv.get()); if( apRefSizeProv.get()) apRefSizeProv->toggleAutoResizeState(); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_Paste() { + SolarMutexGuard aGuard; if( m_pChartWindow ) { Graphic aGraphic; @@ -610,12 +615,12 @@ bool ChartController::executeDispatch_Delete() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_TITLE )))), - m_xUndoManager, getModel()); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_TITLE ))), + m_xUndoManager ); TitleHelper::removeTitle( ObjectIdentifier::getTitleTypeForCID( aCID ), getModel() ); bReturn = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); break; } case OBJECTTYPE_LEGEND: @@ -629,11 +634,11 @@ bool ChartController::executeDispatch_Delete() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_LEGEND )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_LEGEND ))), + m_xUndoManager ); xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( false )); bReturn = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } break; @@ -651,6 +656,11 @@ bool ChartController::executeDispatch_Delete() bReturn = lcl_deleteDataSeries( aCID, getModel(), m_xUndoManager ); else if( eParentObjectType == OBJECTTYPE_DATA_CURVE ) bReturn = lcl_deleteDataCurve( aCID, getModel(), m_xUndoManager ); + else if( eParentObjectType == OBJECTTYPE_DATA_AVERAGE_LINE ) + { + executeDispatch_DeleteMeanValue(); + bReturn = true; + } break; } @@ -664,11 +674,11 @@ bool ChartController::executeDispatch_Delete() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_AVERAGE_LINE )))), - m_xUndoManager, getModel() ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_AVERAGE_LINE ))), + m_xUndoManager ); RegressionCurveHelper::removeMeanValueLine( xRegCurveCnt ); bReturn = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } break; } @@ -687,15 +697,15 @@ bool ChartController::executeDispatch_Delete() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_CURVE_EQUATION )))), - m_xUndoManager, xModel ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_CURVE_EQUATION ))), + m_xUndoManager ); { ControllerLockGuard aCtlLockGuard( xModel ); xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( false )); xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( false )); } bReturn = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } break; } @@ -710,8 +720,8 @@ bool ChartController::executeDispatch_Delete() // using assignment for broken gcc 3.3 UndoGuard aUndoGuard = UndoGuard( ActionDescriptionProvider::createDescription( - ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( STR_OBJECT_ERROR_BARS )))), - m_xUndoManager, xModel ); + ActionDescriptionProvider::DELETE, String( SchResId( STR_OBJECT_ERROR_BARS ))), + m_xUndoManager ); { ControllerLockGuard aCtlLockGuard( xModel ); xErrorBarProp->setPropertyValue( @@ -719,7 +729,7 @@ bool ChartController::executeDispatch_Delete() uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE )); } bReturn = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } break; } @@ -735,7 +745,7 @@ bool ChartController::executeDispatch_Delete() ActionDescriptionProvider::createDescription( ActionDescriptionProvider::DELETE, ::rtl::OUString( String( SchResId( aObjectType == OBJECTTYPE_DATA_LABEL ? STR_OBJECT_LABEL : STR_OBJECT_DATALABELS )))), - m_xUndoManager, getModel() ); + m_xUndoManager ); chart2::DataPointLabel aLabel; xObjectProperties->getPropertyValue( C2U( "Label" ) ) >>= aLabel; aLabel.ShowNumber = false; @@ -750,7 +760,7 @@ bool ChartController::executeDispatch_Delete() else xObjectProperties->setPropertyValue( C2U( "Label" ), uno::makeAny(aLabel) ); bReturn = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } break; } @@ -799,7 +809,7 @@ void ChartController::executeDispatch_ToggleLegend() { Reference< frame::XModel > xModel( getModel() ); UndoGuard aUndoGuard = UndoGuard( - ::rtl::OUString( String( SchResId( STR_ACTION_TOGGLE_LEGEND ))), m_xUndoManager, xModel ); + String( SchResId( STR_ACTION_TOGGLE_LEGEND )), m_xUndoManager ); Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend( xModel ), uno::UNO_QUERY ); bool bChanged = false; if( xLegendProp.is()) @@ -826,14 +836,14 @@ void ChartController::executeDispatch_ToggleLegend() } if( bChanged ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } void ChartController::executeDispatch_ToggleGridHorizontal() { Reference< frame::XModel > xModel( getModel() ); UndoGuard aUndoGuard = UndoGuard( - ::rtl::OUString( String( SchResId( STR_ACTION_TOGGLE_GRID_HORZ ))), m_xUndoManager, xModel ); + String( SchResId( STR_ACTION_TOGGLE_GRID_HORZ )), m_xUndoManager ); Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( getModel() )); if( xDiagram.is()) { @@ -848,7 +858,7 @@ void ChartController::executeDispatch_ToggleGridHorizontal() else AxisHelper::showGrid( nDimensionIndex, nCooSysIndex, bIsMainGrid, xDiagram, m_xCC ); - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -866,9 +876,9 @@ void ChartController::impl_switchDiagramPositioningToExcludingPositioning() UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( ActionDescriptionProvider::POS_SIZE, ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)), - m_xUndoManager, m_aModel->getModel() ); + m_xUndoManager ); if( DiagramHelper::switchDiagramPositioningToExcludingPositioning( m_aModel->getModel(), true, true ) ) - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } // namespace chart diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 9e214900ab06..a39a2c1f54c7 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -244,12 +244,12 @@ const short HITPIX=2; //hit-tolerance in pixel , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (uno::RuntimeException) { + SolarMutexGuard aGuard; uno::Reference<awt::XWindow> xWindow = m_xViewWindow; - Window* pWindow = m_pChartWindow; - if(xWindow.is() && pWindow) + if(xWindow.is() && m_pChartWindow) { - Size aLogicSize = pWindow->PixelToLogic( Size( Width, Height ), MapMode( MAP_100TH_MM ) ); + Size aLogicSize = m_pChartWindow->PixelToLogic( Size( Width, Height ), MapMode( MAP_100TH_MM ) ); bool bIsEmbedded = true; //todo: for standalone chart: detect wether we are standalone @@ -264,8 +264,8 @@ const short HITPIX=2; //hit-tolerance in pixel MapMode aNewMapMode( MAP_100TH_MM, Point(0,0) , Fraction(nScaleXNumerator,nScaleXDenominator) , Fraction(nScaleYNumerator,nScaleYDenominator) ); - pWindow->SetMapMode(aNewMapMode); - pWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); + m_pChartWindow->SetMapMode(aNewMapMode); + m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100% uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY ); @@ -286,7 +286,7 @@ const short HITPIX=2; //hit-tolerance in pixel //a correct work area is at least necessary for correct values in the position and size dialog and for dragging area if(m_pDrawViewWrapper) { - Rectangle aRect(Point(0,0), pWindow->GetOutputSize()); + Rectangle aRect(Point(0,0), m_pChartWindow->GetOutputSize()); m_pDrawViewWrapper->SetWorkArea( aRect ); } } @@ -294,9 +294,9 @@ const short HITPIX=2; //hit-tolerance in pixel { //change visarea ChartModelHelper::setPageSize( awt::Size( aLogicSize.Width(), aLogicSize.Height() ), getModel() ); - pWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); + m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); } - pWindow->Invalidate(); + m_pChartWindow->Invalidate(); } } @@ -534,12 +534,11 @@ void ChartController::execute_Paint( const Rectangle& rRect ) if( xUpdatable.is() ) xUpdatable->update(); - Window* pWindow = m_pChartWindow; { SolarMutexGuard aGuard; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; if(pDrawViewWrapper) - pDrawViewWrapper->CompleteRedraw(pWindow, Region(rRect) ); + pDrawViewWrapper->CompleteRedraw(m_pChartWindow, Region(rRect) ); } } catch( uno::Exception & ex ) @@ -563,9 +562,11 @@ bool isDoubleClick( const MouseEvent& rMEvt ) void ChartController::startDoubleClickWaiting() { + SolarMutexGuard aGuard; + m_bWaitingForDoubleClick = true; - ULONG nDblClkTime = 500; + sal_uLong nDblClkTime = 500; if( m_pChartWindow ) { const MouseSettings& rMSettings = m_pChartWindow->GetSettings().GetMouseSettings(); @@ -588,11 +589,12 @@ IMPL_LINK( ChartController, DoubleClickWaitingHdl, void*, EMPTYARG ) if( !m_bWaitingForMouseUp && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() ) { this->impl_selectObjectAndNotiy(); + SolarMutexGuard aGuard; if( m_pChartWindow ) { Window::PointerState aPointerState( m_pChartWindow->GetPointerState() ); MouseEvent aMouseEvent( aPointerState.maPos,1/*nClicks*/, - 0/*nMode*/, static_cast< USHORT >( aPointerState.mnState )/*nButtons*/, + 0/*nMode*/, static_cast< sal_uInt16 >( aPointerState.mnState )/*nButtons*/, 0/*nModifier*/ ); impl_SetMousePointer( aMouseEvent ); } @@ -616,17 +618,16 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) m_aSelection.remindSelectionBeforeMouseDown(); - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper ) + if(!m_pChartWindow || !pDrawViewWrapper ) return; - Point aMPos = pWindow->PixelToLogic(rMEvt.GetPosPixel()); + Point aMPos = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel()); if ( MOUSE_LEFT == rMEvt.GetButtons() ) { - pWindow->GrabFocus(); - pWindow->CaptureMouse(); + m_pChartWindow->GrabFocus(); + m_pChartWindow->CaptureMouse(); } if( pDrawViewWrapper->IsTextEdit() ) @@ -711,7 +712,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) && !rMEvt.IsRight() ) { //start drag - USHORT nDrgLog = (USHORT)pWindow->PixelToLogic(Size(DRGPIX,0)).Width(); + sal_uInt16 nDrgLog = (sal_uInt16)m_pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width(); SdrDragMethod* pDragMethod = NULL; //change selection to 3D scene if rotate mode @@ -751,9 +752,8 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt ) { SolarMutexGuard aGuard; - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return; if( m_pDrawViewWrapper->IsTextEdit() ) @@ -764,7 +764,7 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt ) if(pDrawViewWrapper->IsAction()) { - pDrawViewWrapper->MovAction( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); + pDrawViewWrapper->MovAction( m_pChartWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); } impl_SetMousePointer( rMEvt ); @@ -784,12 +784,11 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) { SolarMutexGuard aGuard; - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return; - Point aMPos = pWindow->PixelToLogic(rMEvt.GetPosPixel()); + Point aMPos = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel()); if(pDrawViewWrapper->IsTextEdit()) { @@ -801,7 +800,11 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if ( m_eDrawMode == CHARTDRAW_INSERT && pDrawViewWrapper->IsCreateObj() ) { pDrawViewWrapper->EndCreateObj( SDRCREATE_FORCEEND ); - impl_switchDiagramPositioningToExcludingPositioning(); + { + HiddenUndoContext aUndoContext( m_xUndoManager ); + // don't want the positioning Undo action to appear in the UI + impl_switchDiagramPositioningToExcludingPositioning(); + } if ( pDrawViewWrapper->AreObjectsMarked() ) { if ( pDrawViewWrapper->GetCurrentObjIdentifier() == OBJ_TEXT ) @@ -838,12 +841,12 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if( pChartDragMethod ) { UndoGuard aUndoGuard( pChartDragMethod->getUndoDescription(), - m_xUndoManager, getModel() ); + m_xUndoManager ); if( pDrawViewWrapper->EndDragObj(false) ) { bDraggingDone = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } @@ -867,19 +870,25 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if( !bIsMoveOnly && m_aSelection.isResizeableObjectSelected() ) eActionType = ActionDescriptionProvider::RESIZE; + ObjectType eObjectType = ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ); + UndoGuard aUndoGuard( - ActionDescriptionProvider::createDescription( - eActionType, - ObjectNameProvider::getName( ObjectIdentifier::getObjectType( m_aSelection.getSelectedCID() ))), - m_xUndoManager, getModel() ); - bool bChanged = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() + ActionDescriptionProvider::createDescription( eActionType, ObjectNameProvider::getName( eObjectType)), + m_xUndoManager ); + + bool bChanged = false; + if ( eObjectType == OBJECTTYPE_LEGEND ) + bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( getModel(), false , true ); + + bool bMoved = PositionAndSizeHelper::moveObject( m_aSelection.getSelectedCID() , getModel() , awt::Rectangle(aObjectRect.getX(),aObjectRect.getY(),aObjectRect.getWidth(),aObjectRect.getHeight()) , awt::Rectangle(aPageRect.getX(),aPageRect.getY(),aPageRect.getWidth(),aPageRect.getHeight()) ); - if( bChanged ) + + if( bMoved || bChanged ) { bDraggingDone = true; - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } } @@ -919,7 +928,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) } //@todo ForcePointer(&rMEvt); - pWindow->ReleaseMouse(); + m_pChartWindow->ReleaseMouse(); if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) bNotifySelectionChange = true; @@ -968,16 +977,18 @@ void ChartController::execute_DoubleClick( const Point* pMousePixel ) void ChartController::execute_Resize() { - m_pChartWindow->Invalidate(); + SolarMutexGuard aGuard; + if(m_pChartWindow) + m_pChartWindow->Invalidate(); } void ChartController::execute_Activate() { - ///// pDrawViewWrapper->SetEditMode(TRUE); + ///// pDrawViewWrapper->SetEditMode(sal_True); } void ChartController::execute_Deactivate() { /* - pDrawViewWrapper->SetEditMode(FALSE); + pDrawViewWrapper->SetEditMode(sal_False); this->ReleaseMouse(); */ } @@ -991,13 +1002,11 @@ void ChartController::execute_LoseFocus() void ChartController::execute_Command( const CommandEvent& rCEvt ) { - Window* pWindow = m_pChartWindow; - bool bIsAction = false; { SolarMutexGuard aGuard; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return; bIsAction = m_pDrawViewWrapper->IsAction(); } @@ -1005,7 +1014,11 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) // pop-up menu if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction) { - m_pChartWindow->ReleaseMouse(); + { + SolarMutexGuard aGuard; + if(m_pChartWindow) + m_pChartWindow->ReleaseMouse(); + } if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) impl_notifySelectionChangeListeners(); @@ -1019,7 +1032,9 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) Point aPos( rCEvt.GetMousePosPixel() ); if( !rCEvt.IsMouseEvent() ) { - aPos = m_pChartWindow->GetPointerState().maPos; + SolarMutexGuard aGuard; + if(m_pChartWindow) + aPos = m_pChartWindow->GetPointerState().maPos; } aContextMenuHelper.completeAndExecute( aPos, aContextMenu ); } @@ -1280,7 +1295,11 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); Point aPos( rCEvt.GetMousePosPixel() ); if( !rCEvt.IsMouseEvent() ) - aPos = m_pChartWindow->GetPointerState().maPos; + { + SolarMutexGuard aGuard; + if(m_pChartWindow) + aPos = m_pChartWindow->GetPointerState().maPos; + } aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } } @@ -1291,6 +1310,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) ) { //#i84417# enable editing with IME + SolarMutexGuard aGuard; if( m_pDrawViewWrapper ) m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow ); } @@ -1300,9 +1320,8 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { bool bReturn=false; - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return bReturn; // handle accelerators @@ -1324,14 +1343,17 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) if( bReturn ) return bReturn; - if( pDrawViewWrapper->IsTextEdit() ) { - if( pDrawViewWrapper->KeyInput(rKEvt,pWindow) ) + SolarMutexGuard aGuard; + if( pDrawViewWrapper->IsTextEdit() ) { - bReturn = true; - if( nCode == KEY_ESCAPE ) + if( pDrawViewWrapper->KeyInput(rKEvt,m_pChartWindow) ) { - this->EndTextEdit(); + bReturn = true; + if( nCode == KEY_ESCAPE ) + { + this->EndTextEdit(); + } } } } @@ -1421,12 +1443,16 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) // default 1 mm in each direction double fGrowAmountX = 200.0; double fGrowAmountY = 200.0; - if( bAlternate && pWindow ) + if( bAlternate && m_pChartWindow ) { // together with Alt-key: 1 px in each direction - Size aPixelSize = pWindow->PixelToLogic( Size( 2, 2 )); - fGrowAmountX = static_cast< double >( aPixelSize.Width()); - fGrowAmountY = static_cast< double >( aPixelSize.Height()); + SolarMutexGuard aGuard; + if( m_pChartWindow ) + { + Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 2, 2 )); + fGrowAmountX = static_cast< double >( aPixelSize.Width()); + fGrowAmountY = static_cast< double >( aPixelSize.Height()); + } } if( nCode == KEY_SUBTRACT ) { @@ -1448,12 +1474,16 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) // default 1 mm double fShiftAmountX = 100.0; double fShiftAmountY = 100.0; - if( bAlternate && pWindow ) + if( bAlternate && m_pChartWindow ) { // together with Alt-key: 1 px - Size aPixelSize = pWindow->PixelToLogic( Size( 1, 1 )); - fShiftAmountX = static_cast< double >( aPixelSize.Width()); - fShiftAmountY = static_cast< double >( aPixelSize.Height()); + SolarMutexGuard aGuard; + if(m_pChartWindow) + { + Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 1, 1 )); + fShiftAmountX = static_cast< double >( aPixelSize.Width()); + fShiftAmountY = static_cast< double >( aPixelSize.Height()); + } } switch( nCode ) { @@ -1544,6 +1574,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) bReturn = executeDispatch_Delete(); if( ! bReturn ) { + SolarMutexGuard aGuard; InfoBox( m_pChartWindow, String(SchResId( STR_ACTION_NOTPOSSIBLE ))).Execute(); } } @@ -1701,11 +1732,14 @@ bool ChartController::requestQuickHelp( void ChartController::impl_selectObjectAndNotiy() { - DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if( pDrawViewWrapper ) { - pDrawViewWrapper->SetDragMode( m_eDragMode ); - m_aSelection.applySelection( m_pDrawViewWrapper ); + SolarMutexGuard aGuard; + DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; + if( pDrawViewWrapper ) + { + pDrawViewWrapper->SetDragMode( m_eDragMode ); + m_aSelection.applySelection( m_pDrawViewWrapper ); + } } impl_notifySelectionChangeListeners(); } @@ -1780,7 +1814,7 @@ bool ChartController::impl_moveOrResizeObject( ObjectType eObjectType = ObjectIdentifier::getObjectType( rCID ); UndoGuard aUndoGuard( ActionDescriptionProvider::createDescription( - eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager, xChartModel ); + eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager ); { ControllerLockGuard aCLGuard( xChartModel ); if( bNeedShift ) @@ -1788,7 +1822,7 @@ bool ChartController::impl_moveOrResizeObject( if( bNeedResize || (eObjectType == OBJECTTYPE_DIAGRAM) )//Also set an explicat size at the diagram when an explicit position is set xObjProp->setPropertyValue( C2U("RelativeSize"), uno::makeAny( aRelSize )); } - aUndoGuard.commitAction(); + aUndoGuard.commit(); } } return bResult; @@ -1834,19 +1868,18 @@ bool ChartController::impl_DragDataPoint( const ::rtl::OUString & rCID, double f void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) { SolarMutexGuard aGuard; - Window* pWindow = m_pChartWindow; - if( m_pDrawViewWrapper && pWindow ) + if( m_pDrawViewWrapper && m_pChartWindow ) { - Point aMousePos( pWindow->PixelToLogic( rEvent.GetPosPixel())); + Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel())); sal_uInt16 nModifier = rEvent.GetModifier(); - BOOL bLeftDown = rEvent.IsLeft(); + sal_Bool bLeftDown = rEvent.IsLeft(); if ( m_pDrawViewWrapper->IsTextEdit() ) { if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) ) { - pWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer( - aMousePos, pWindow, nModifier, bLeftDown ) ); + m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer( + aMousePos, m_pChartWindow, nModifier, bLeftDown ) ); return; } } @@ -1863,7 +1896,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) { Pointer aPointer = m_pDrawViewWrapper->GetPreferedPointer( - aMousePos, pWindow, nModifier, bLeftDown ); + aMousePos, m_pChartWindow, nModifier, bLeftDown ); bool bForceArrowPointer = false; ObjectIdentifier aOID( m_aSelection.getSelectedOID() ); @@ -1896,9 +1929,9 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) } if( bForceArrowPointer ) - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); else - pWindow->SetPointer( aPointer ); + m_pChartWindow->SetPointer( aPointer ); } else { @@ -1947,7 +1980,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) } break; } - pWindow->SetPointer( Pointer( ePointerStyle ) ); + m_pChartWindow->SetPointer( Pointer( ePointerStyle ) ); return; } @@ -1959,7 +1992,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) { if( aHitObjectCID.equals(m_aSelection.getSelectedCID()) ) { - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); return; } } @@ -1967,14 +2000,14 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) if( !aHitObjectCID.getLength() ) { //additional shape was hit - pWindow->SetPointer( POINTER_MOVE ); + m_pChartWindow->SetPointer( POINTER_MOVE ); } else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) ) { if( (m_eDragMode == SDRDRAG_ROTATE) && SelectionHelper::isRotateableObject( aHitObjectCID , getModel() ) ) - pWindow->SetPointer( Pointer( POINTER_ROTATE ) ); + m_pChartWindow->SetPointer( Pointer( POINTER_ROTATE ) ); else { ObjectType eHitObjectType = ObjectIdentifier::getObjectType( aHitObjectCID ); @@ -1983,15 +2016,15 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) if( !ObjectIdentifier::areSiblings(aHitObjectCID,m_aSelection.getSelectedCID()) && !ObjectIdentifier::areIdenticalObjects(aHitObjectCID,m_aSelection.getSelectedCID()) ) { - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); return; } } - pWindow->SetPointer( POINTER_MOVE ); + m_pChartWindow->SetPointer( POINTER_MOVE ); } } else - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); } } } diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx index 0e779b3833a1..7975aa12c90c 100644 --- a/chart2/source/controller/main/ChartDropTargetHelper.cxx +++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx @@ -138,58 +138,47 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt ) // parent) if( bDataComesFromParent ) { + Reference< chart2::XDiagram > xDiagram( m_xChartDocument->getFirstDiagram() ); Reference< chart2::data::XDataProvider > xDataProvider( m_xChartDocument->getDataProvider()); - if( xDataProvider.is() && + if( xDataProvider.is() && xDiagram.is() && DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument )) { - DiagramHelper::tTemplateWithServiceName aTempWithServ( - DiagramHelper::getTemplateForDiagram( - m_xChartDocument->getFirstDiagram(), - Reference< lang::XMultiServiceFactory >( - m_xChartDocument->getChartTypeManager(), uno::UNO_QUERY ))); - if( aTempWithServ.first.is()) + Reference< chart2::data::XDataSource > xDataSource( + DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument )); + Sequence< beans::PropertyValue > aArguments( + xDataProvider->detectArguments( xDataSource )); + + OUString aOldRange; + beans::PropertyValue * pCellRange = 0; + for( sal_Int32 i=0; i<aArguments.getLength(); ++i ) { - Reference< chart2::data::XDataSource > xDataSource( - DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument )); - Sequence< beans::PropertyValue > aArguments( - xDataProvider->detectArguments( xDataSource )); - - OUString aOldRange; - beans::PropertyValue * pCellRange = 0; - for( sal_Int32 i=0; i<aArguments.getLength(); ++i ) + if( aArguments[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CellRangeRepresentation"))) { - if( aArguments[i].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("CellRangeRepresentation"))) - { - pCellRange = (aArguments.getArray() + i); - aArguments[i].Value >>= aOldRange; - break; - } + pCellRange = (aArguments.getArray() + i); + aArguments[i].Value >>= aOldRange; + break; } - if( pCellRange ) + } + if( pCellRange ) + { + // copy means add ranges, move means replace + if( rEvt.mnAction == DND_ACTION_COPY ) + { + // @todo: using implcit knowledge that ranges can be + // merged with ";". This should be done more general + pCellRange->Value <<= (aOldRange + OUString( sal_Unicode(';')) + aRangeString ); + } + // move means replace range + else { - // copy means add ranges, move means replace - if( rEvt.mnAction == DND_ACTION_COPY ) - { - // @todo: using implcit knowledge that ranges can be - // merged with ";". This should be done more general - pCellRange->Value <<= (aOldRange + OUString( sal_Unicode(';')) + aRangeString ); - } - // move means replace range - else - { - pCellRange->Value <<= aRangeString; - } - - xDataSource.set( xDataProvider->createDataSource( aArguments )); - aTempWithServ.first->changeDiagramData( - m_xChartDocument->getFirstDiagram(), - xDataSource, - aArguments ); - - // always return copy state to avoid deletion of the - // dragged range - nResult = DND_ACTION_COPY; + pCellRange->Value <<= aRangeString; } + + xDataSource.set( xDataProvider->createDataSource( aArguments )); + xDiagram->setDiagramData( xDataSource, aArguments ); + + // always return copy state to avoid deletion of the dragged range + nResult = DND_ACTION_COPY; } } } diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx new file mode 100755 index 000000000000..69991eb081df --- /dev/null +++ b/chart2/source/controller/main/ChartModelClone.cxx @@ -0,0 +1,280 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_chart2.hxx" + +#include "ChartModelClone.hxx" +#include "ChartModelHelper.hxx" +#include "ControllerLockGuard.hxx" +#include "DataSourceHelper.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/chart2/XTitled.hpp> +#include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> +/** === end UNO includes === **/ + +#include <comphelper/property.hxx> +#include <tools/diagnose_ex.h> + +//...................................................................................................................... +namespace chart +{ +//...................................................................................................................... + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::XModel; + using ::com::sun::star::util::XCloneable; + using ::com::sun::star::chart2::XChartDocument; + using ::com::sun::star::chart2::XInternalDataProvider; + using ::com::sun::star::chart2::XAnyDescriptionAccess; + using ::com::sun::star::view::XSelectionSupplier; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::chart2::XTitled; + using ::com::sun::star::util::XModifiable; + using ::com::sun::star::chart2::data::XDataSource; + using ::com::sun::star::chart2::data::XLabeledDataSequence; + /** === end UNO using === **/ + + // ================================================================================================================= + // = helper + // ================================================================================================================= + namespace + { + Reference< XModel > lcl_cloneModel( const Reference< XModel > & xModel ) + { + Reference< XModel > xResult; + try + { + const Reference< XCloneable > xCloneable( xModel, UNO_QUERY_THROW ); + xResult.set( xCloneable->createClone(), UNO_QUERY_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xResult; + } + + } + + // ================================================================================================================= + // = ChartModelClone + // ================================================================================================================= + // ----------------------------------------------------------------------------------------------------------------- + ChartModelClone::ChartModelClone( const Reference< XModel >& i_model, const ModelFacet i_facet ) + { + m_xModelClone.set( lcl_cloneModel( i_model ) ); + + try + { + if ( i_facet == E_MODEL_WITH_DATA ) + { + const Reference< XChartDocument > xChartDoc( m_xModelClone, UNO_QUERY_THROW ); + ENSURE_OR_THROW( xChartDoc->hasInternalDataProvider(), "invalid chart model" ); + + const Reference< XCloneable > xCloneable( xChartDoc->getDataProvider(), UNO_QUERY_THROW ); + m_xDataClone.set( xCloneable->createClone(), UNO_QUERY_THROW ); + } + + if ( i_facet == E_MODEL_WITH_SELECTION ) + { + const Reference< XSelectionSupplier > xSelSupp( m_xModelClone->getCurrentController(), UNO_QUERY_THROW ); + m_aSelection = xSelSupp->getSelection(); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + + // ----------------------------------------------------------------------------------------------------------------- + ChartModelClone::~ChartModelClone() + { + if ( !impl_isDisposed() ) + dispose(); + } + + // ----------------------------------------------------------------------------------------------------------------- + void ChartModelClone::dispose() + { + if ( impl_isDisposed() ) + return; + + try + { + Reference< XComponent > xComp( m_xModelClone, UNO_QUERY_THROW ); + xComp->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + m_xModelClone.clear(); + m_xDataClone.clear(); + m_aSelection.clear(); + } + + // ----------------------------------------------------------------------------------------------------------------- + ModelFacet ChartModelClone::getFacet() const + { + if ( m_aSelection.hasValue() ) + return E_MODEL_WITH_SELECTION; + if ( m_xDataClone.is() ) + return E_MODEL_WITH_DATA; + return E_MODEL; + } + + // ----------------------------------------------------------------------------------------------------------------- + void ChartModelClone::applyToModel( const Reference< XModel >& i_model ) const + { + applyModelContentToModel( i_model, m_xModelClone, m_xDataClone ); + + if ( m_aSelection.hasValue() ) + { + try + { + Reference< XSelectionSupplier > xCurrentSelectionSuppl( i_model->getCurrentController(), UNO_QUERY_THROW ); + xCurrentSelectionSuppl->select( m_aSelection ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + namespace + { + void ImplApplyDataToModel( const Reference< XModel >& i_model, const Reference< XInternalDataProvider > & i_data ) + { + Reference< XChartDocument > xDoc( i_model, UNO_QUERY ); + OSL_ASSERT( xDoc.is() && xDoc->hasInternalDataProvider() ); + + // copy data from stored internal data provider + if( xDoc.is() && xDoc->hasInternalDataProvider()) + { + Reference< XAnyDescriptionAccess > xCurrentData( xDoc->getDataProvider(), UNO_QUERY ); + Reference< XAnyDescriptionAccess > xSavedData( i_data, UNO_QUERY ); + if ( xCurrentData.is() && xSavedData.is() ) + { + xCurrentData->setData( xSavedData->getData() ); + xCurrentData->setAnyRowDescriptions( xSavedData->getAnyRowDescriptions()); + xCurrentData->setAnyColumnDescriptions( xSavedData->getAnyColumnDescriptions()); + } + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + void ChartModelClone::applyModelContentToModel( const Reference< XModel >& i_model, + const Reference< XModel >& i_modelToCopyFrom, const Reference< XInternalDataProvider >& i_data ) + { + ENSURE_OR_RETURN_VOID( i_model.is(), "ChartModelElement::applyModelContentToModel: invalid source model!" ); + ENSURE_OR_RETURN_VOID( i_modelToCopyFrom.is(), "ChartModelElement::applyModelContentToModel: invalid source model!" ); + try + { + // /-- loccked controllers of destination + ControllerLockGuard aLockedControllers( i_model ); + Reference< XChartDocument > xSource( i_modelToCopyFrom, UNO_QUERY_THROW ); + Reference< XChartDocument > xDestination( i_model, UNO_QUERY_THROW ); + + // propagate the correct flag for plotting of hidden values to the data provider and all used sequences + ChartModelHelper::setIncludeHiddenCells( ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ) , i_model ); + + // diagram + xDestination->setFirstDiagram( xSource->getFirstDiagram() ); + + // main title + Reference< XTitled > xDestinationTitled( xDestination, UNO_QUERY_THROW ); + Reference< XTitled > xSourceTitled( xSource, UNO_QUERY_THROW ); + xDestinationTitled->setTitleObject( xSourceTitled->getTitleObject() ); + + // page background + ::comphelper::copyProperties( + xSource->getPageBackground(), + xDestination->getPageBackground() ); + + // apply data (not applied in standard Undo) + if ( i_data.is() ) + ImplApplyDataToModel( i_model, i_data ); + + // register all sequences at the internal data provider to get adapted + // indexes when columns are added/removed + if ( xDestination->hasInternalDataProvider() ) + { + Reference< XInternalDataProvider > xNewDataProvider( xDestination->getDataProvider(), UNO_QUERY ); + Reference< XDataSource > xUsedData( DataSourceHelper::getUsedData( i_model ) ); + if ( xUsedData.is() && xNewDataProvider.is() ) + { + Sequence< Reference< XLabeledDataSequence > > aData( xUsedData->getDataSequences() ); + for( sal_Int32 i=0; i<aData.getLength(); ++i ) + { + xNewDataProvider->registerDataSequenceForChanges( aData[i]->getValues() ); + xNewDataProvider->registerDataSequenceForChanges( aData[i]->getLabel() ); + } + } + } + + // restore modify status + Reference< XModifiable > xSourceMod( xSource, UNO_QUERY ); + Reference< XModifiable > xDestMod( xDestination, UNO_QUERY ); + if ( xSourceMod.is() && xDestMod.is() && !xSourceMod->isModified() ) + { + xDestMod->setModified( sal_False ); + } + // \-- loccked controllers of destination + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + +//...................................................................................................................... +} // namespace chart +//...................................................................................................................... diff --git a/chart2/source/controller/main/ChartModelClone.hxx b/chart2/source/controller/main/ChartModelClone.hxx new file mode 100755 index 000000000000..d5653b8e1ccc --- /dev/null +++ b/chart2/source/controller/main/ChartModelClone.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef CHART2_CHARTMODELCLONE_HXX +#define CHART2_CHARTMODELCLONE_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/chart2/XInternalDataProvider.hpp> +/** === end UNO includes === **/ + +#include <boost/noncopyable.hpp> + +//...................................................................................................................... +namespace chart +{ +//...................................................................................................................... + + //================================================================================================================== + //= ModelFacet + //================================================================================================================== + enum ModelFacet + { + E_MODEL, + E_MODEL_WITH_DATA, + E_MODEL_WITH_SELECTION + }; + + //================================================================================================================== + //= ChartModelClone + //================================================================================================================== + class ChartModelClone : public ::boost::noncopyable + { + public: + ChartModelClone( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_model, + const ModelFacet i_facet + ); + + ~ChartModelClone(); + + ModelFacet getFacet() const; + + void applyToModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_model ) const; + + static void applyModelContentToModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & i_model, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & i_modelToCopyFrom, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > & i_data ); + + void dispose(); + + private: + bool impl_isDisposed() const { return !m_xModelClone.is(); } + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModelClone; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > m_xDataClone; + ::com::sun::star::uno::Any m_aSelection; + }; + +//...................................................................................................................... +} // namespace chart +//...................................................................................................................... + +#endif // CHART2_CHARTMODELCLONE_HXX diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx index bb142a212985..35819ef2a648 100644 --- a/chart2/source/controller/main/ChartTransferable.cxx +++ b/chart2/source/controller/main/ChartTransferable.cxx @@ -65,7 +65,7 @@ ChartTransferable::ChartTransferable( SdrModel* pDrawModel, SdrObject* pSelected pExchgView->MarkObj( pSelectedObj, pPv ); else pExchgView->MarkAllObj( pPv ); - Graphic aGraphic( pExchgView->GetMarkedObjMetaFile( TRUE )); + Graphic aGraphic( pExchgView->GetMarkedObjMetaFile( sal_True )); m_xMetaFileGraphic.set( aGraphic.GetXGraphic()); if ( m_bDrawing ) { diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index 45a206abff55..c1dc9924f291 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -60,14 +60,14 @@ ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent, , m_pWindowController( pWindowController ) , m_bInPaint(false) { - this->SetSmartHelpId( SmartId( HID_SCH_WIN_DOCUMENT ) ); + this->SetHelpId( HID_SCH_WIN_DOCUMENT ); this->SetMapMode( MapMode(MAP_100TH_MM) ); adjustHighContrastMode(); // chart does not depend on exact pixel painting => enable antialiased drawing SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | GetAntialiasing() ); - EnableRTL( FALSE ); + EnableRTL( sal_False ); if( pParent ) - pParent->EnableRTL( FALSE );// #i96215# necessary for a correct position of the context menu in rtl mode + pParent->EnableRTL( sal_False );// #i96215# necessary for a correct position of the context menu in rtl mode } ChartWindow::~ChartWindow() @@ -248,19 +248,19 @@ void ChartWindow::ForceInvalidate() { ::Window::Invalidate(); } -void ChartWindow::Invalidate( USHORT nFlags ) +void ChartWindow::Invalidate( sal_uInt16 nFlags ) { if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts" return; ::Window::Invalidate( nFlags ); } -void ChartWindow::Invalidate( const Rectangle& rRect, USHORT nFlags ) +void ChartWindow::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) { if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts" return; ::Window::Invalidate( rRect, nFlags ); } -void ChartWindow::Invalidate( const Region& rRegion, USHORT nFlags ) +void ChartWindow::Invalidate( const Region& rRegion, sal_uInt16 nFlags ) { if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts" return; diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx index d471b51d28d7..99737e469c90 100644 --- a/chart2/source/controller/main/ChartWindow.hxx +++ b/chart2/source/controller/main/ChartWindow.hxx @@ -69,9 +69,9 @@ public: virtual void RequestHelp( const HelpEvent& rHEvt ); void ForceInvalidate(); - virtual void Invalidate( USHORT nFlags = 0 ); - virtual void Invalidate( const Rectangle& rRect, USHORT nFlags = 0 ); - virtual void Invalidate( const Region& rRegion, USHORT nFlags = 0 ); + virtual void Invalidate( sal_uInt16 nFlags = 0 ); + virtual void Invalidate( const Rectangle& rRect, sal_uInt16 nFlags = 0 ); + virtual void Invalidate( const Region& rRegion, sal_uInt16 nFlags = 0 ); virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); diff --git a/chart2/source/controller/main/CommandDispatchContainer.hxx b/chart2/source/controller/main/CommandDispatchContainer.hxx index b698494a9f1e..7c9f0dc2122c 100644 --- a/chart2/source/controller/main/CommandDispatchContainer.hxx +++ b/chart2/source/controller/main/CommandDispatchContainer.hxx @@ -29,7 +29,6 @@ #define CHART2_COMMANDDISPATCHCONTAINER_HXX #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/DispatchDescriptor.hpp> @@ -138,9 +137,8 @@ private: mutable tDispatchMap m_aCachedDispatches; mutable tDisposeVector m_aToBeDisposedDispatches; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel; - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xModel; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xChartDispatcher; ::std::set< ::rtl::OUString > m_aChartCommands; diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 4f4f91022c18..b4d25161f467 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -387,7 +387,7 @@ void DrawCommandDispatch::execute( const ::rtl::OUString& rCommand, const Sequen { SolarMutexGuard aGuard; m_pChartController->setDrawMode( eDrawMode ); - setInsertObj( sal::static_int_cast< USHORT >( eKind ) ); + setInsertObj( sal::static_int_cast< sal_uInt16 >( eKind ) ); if ( bCreate ) { pDrawViewWrapper->SetCreateMode(); @@ -444,7 +444,7 @@ void DrawCommandDispatch::describeSupportedFeatures() implDescribeSupportedFeature( ".uno:StarShapes", COMMAND_ID_DRAWTBX_CS_STAR, CommandGroup::INSERT ); } -void DrawCommandDispatch::setInsertObj( USHORT eObj ) +void DrawCommandDispatch::setInsertObj( sal_uInt16 eObj ) { DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL ); if ( pDrawViewWrapper ) @@ -528,13 +528,13 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID ) if ( pTextObj ) { pTextObj->SetLogicRect( aRect ); - BOOL bVertical = ( nID == SID_DRAW_TEXT_VERTICAL ); + sal_Bool bVertical = ( nID == SID_DRAW_TEXT_VERTICAL ); pTextObj->SetVerticalWriting( bVertical ); if ( bVertical ) { SfxItemSet aSet( pDrawModelWrapper->GetItemPool() ); - aSet.Put( SdrTextAutoGrowWidthItem( TRUE ) ); - aSet.Put( SdrTextAutoGrowHeightItem( FALSE ) ); + aSet.Put( SdrTextAutoGrowWidthItem( sal_True ) ); + aSet.Put( SdrTextAutoGrowHeightItem( sal_False ) ); aSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_TOP ) ); aSet.Put( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_RIGHT ) ); pTextObj->SetMergedItemSet( aSet ); diff --git a/chart2/source/controller/main/DrawCommandDispatch.hxx b/chart2/source/controller/main/DrawCommandDispatch.hxx index 1af8086d6f72..6ac74e052c10 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.hxx +++ b/chart2/source/controller/main/DrawCommandDispatch.hxx @@ -77,7 +77,7 @@ protected: virtual void describeSupportedFeatures(); private: - void setInsertObj( USHORT eObj ); + void setInsertObj( sal_uInt16 eObj ); SdrObject* createDefaultObject( const sal_uInt16 nID ); bool parseCommandURL( const ::rtl::OUString& rCommandURL, sal_uInt16* pnFeatureId, ::rtl::OUString* pBaseCommand, ::rtl::OUString* pCustomShapeType ); diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index 16f7592fe5a9..49d13eca7112 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -163,9 +163,9 @@ void SelectorListBox::UpdateChartElementsListAndSelection() } } - USHORT nEntryPosToSelect = 0; bool bSelectionFound = false; + sal_uInt16 nEntryPosToSelect = 0; bool bSelectionFound = false; aIt = m_aEntries.begin(); - for( USHORT nN=0; aIt != m_aEntries.end(); ++aIt, ++nN ) + for( sal_uInt16 nN=0; aIt != m_aEntries.end(); ++aIt, ++nN ) { InsertEntry( aIt->UIName ); if ( !bSelectionFound && aSelectedOID == aIt->OID ) @@ -178,7 +178,7 @@ void SelectorListBox::UpdateChartElementsListAndSelection() if( bSelectionFound ) SelectEntryPos(nEntryPosToSelect); - USHORT nEntryCount = GetEntryCount(); + sal_uInt16 nEntryCount = GetEntryCount(); if( nEntryCount > 100 ) nEntryCount = 100; SetDropDownLineCount( nEntryCount ); @@ -206,7 +206,7 @@ void SelectorListBox::Select() if ( !IsTravelSelect() ) { - USHORT nPos = GetSelectEntryPos(); + sal_uInt16 nPos = GetSelectEntryPos(); if( nPos < m_aEntries.size() ) { ObjectHierarchy::tOID aOID = m_aEntries[nPos].OID; @@ -224,7 +224,7 @@ long SelectorListBox::Notify( NotifyEvent& rNEvt ) if ( rNEvt.GetType() == EVENT_KEYINPUT ) { - USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); + sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); switch ( nCode ) { diff --git a/chart2/source/controller/main/ImplUndoManager.cxx b/chart2/source/controller/main/ImplUndoManager.cxx deleted file mode 100644 index 90bc3394ba2f..000000000000 --- a/chart2/source/controller/main/ImplUndoManager.cxx +++ /dev/null @@ -1,506 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_chart2.hxx" - -#include "ImplUndoManager.hxx" -#include "DisposeHelper.hxx" -#include "CommonFunctors.hxx" -#include "ControllerLockGuard.hxx" -#include "PropertyHelper.hxx" -#include "DataSourceHelper.hxx" -#include "ChartModelHelper.hxx" - -#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> -#include <com/sun/star/chart2/XChartDocument.hpp> -#include <com/sun/star/chart2/XInternalDataProvider.hpp> -#include <com/sun/star/chart2/XTitled.hpp> -#include <com/sun/star/util/XCloneable.hpp> -#include <com/sun/star/util/XModifiable.hpp> -#include <com/sun/star/view/XSelectionSupplier.hpp> - -#include <boost/bind.hpp> -#include <algorithm> - -using namespace ::com::sun::star; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::rtl::OUString; -using ::com::sun::star::chart::XComplexDescriptionAccess; - -namespace chart -{ -namespace impl -{ - -void ImplApplyDataToModel( - Reference< frame::XModel > & xInOutModelToChange, - const Reference< chart2::XInternalDataProvider > & xData ) -{ - Reference< chart2::XChartDocument > xDoc( xInOutModelToChange, uno::UNO_QUERY ); - OSL_ASSERT( xDoc.is() && xDoc->hasInternalDataProvider()); - - // copy data from stored internal data provider - if( xDoc.is() && xDoc->hasInternalDataProvider()) - { - Reference< XComplexDescriptionAccess > xCurrentData( xDoc->getDataProvider(), uno::UNO_QUERY ); - Reference< XComplexDescriptionAccess > xSavedData( xData, uno::UNO_QUERY ); - if( xCurrentData.is() && xSavedData.is()) - { - xCurrentData->setData( xSavedData->getData()); - xCurrentData->setComplexRowDescriptions( xSavedData->getComplexRowDescriptions()); - xCurrentData->setComplexColumnDescriptions( xSavedData->getComplexColumnDescriptions()); - } - } -} - -// ---------------------------------------- - -UndoElement::UndoElement( - const OUString & rActionString, - const Reference< frame::XModel > & xModel ) : - m_aActionString( rActionString ) -{ - initialize( xModel ); -} - -UndoElement::UndoElement( - const Reference< frame::XModel > & xModel ) -{ - initialize( xModel ); -} - -UndoElement::UndoElement( const UndoElement & rOther ) : - m_aActionString( rOther.m_aActionString ) -{ - initialize( rOther.m_xModel ); -} - -UndoElement::~UndoElement() -{} - -void UndoElement::initialize( const Reference< frame::XModel > & xModel ) -{ - if ( xModel.is() ) - { - m_xModel.set( UndoElement::cloneModel( xModel ) ); - } -} - -void UndoElement::dispose() -{ - Reference< lang::XComponent > xComp( m_xModel, uno::UNO_QUERY ); - if( xComp.is()) - xComp->dispose(); - m_xModel.set( 0 ); -} - -void UndoElement::applyToModel( - Reference< frame::XModel > & xInOutModelToChange ) -{ - UndoElement::applyModelContentToModel( xInOutModelToChange, m_xModel ); -} - -UndoElement * UndoElement::createFromModel( - const Reference< frame::XModel > & xModel ) -{ - return new UndoElement( getActionString(), xModel ); -} - -void UndoElement::setActionString( const ::rtl::OUString & rActionString ) -{ - m_aActionString = rActionString; -} - -OUString UndoElement::getActionString() const -{ - return m_aActionString; -} - -Reference< frame::XModel > UndoElement::cloneModel( const Reference< frame::XModel > & xModel ) -{ - Reference< frame::XModel > xResult; - uno::Reference< util::XCloneable > xCloneable( xModel, uno::UNO_QUERY ); - OSL_ENSURE( xCloneable.is(), "Cannot clone model" ); - if( xCloneable.is()) - xResult.set( xCloneable->createClone(), uno::UNO_QUERY ); - - return xResult; -} - -void UndoElement::applyModelContentToModel( - Reference< frame::XModel > & xInOutModelToChange, - const Reference< frame::XModel > & xModelToCopyFrom, - const Reference< chart2::XInternalDataProvider > & xData /* = 0 */ ) -{ - - if( xModelToCopyFrom.is() && xInOutModelToChange.is()) - { - try - { - // /-- loccked controllers of destination - ControllerLockGuard aLockedControllers( xInOutModelToChange ); - Reference< chart2::XChartDocument > xSource( xModelToCopyFrom, uno::UNO_QUERY_THROW ); - Reference< chart2::XChartDocument > xDestination( xInOutModelToChange, uno::UNO_QUERY_THROW ); - - // propagate the correct flag for plotting of hidden values to the data provider and all used sequences - ChartModelHelper::setIncludeHiddenCells( ChartModelHelper::isIncludeHiddenCells( xModelToCopyFrom ) , xInOutModelToChange ); - - // diagram - xDestination->setFirstDiagram( xSource->getFirstDiagram()); - - // main title - Reference< chart2::XTitled > xDestinationTitled( xDestination, uno::UNO_QUERY_THROW ); - Reference< chart2::XTitled > xSourceTitled( xSource, uno::UNO_QUERY_THROW ); - xDestinationTitled->setTitleObject( xSourceTitled->getTitleObject()); - - // page background - comphelper::copyProperties( - xSource->getPageBackground(), - xDestination->getPageBackground() ); - - // apply data (not applied in standard Undo) - if( xData.is()) - ImplApplyDataToModel( xInOutModelToChange, xData ); - - // register all sequences at the internal data provider to get adapted - // indexes when columns are added/removed - if( xDestination->hasInternalDataProvider()) - { - Reference< chart2::XInternalDataProvider > xNewDataProvider( xDestination->getDataProvider(), uno::UNO_QUERY ); - Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( xInOutModelToChange )); - if( xUsedData.is() && xNewDataProvider.is()) - { - Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xUsedData->getDataSequences()); - for( sal_Int32 i=0; i<aData.getLength(); ++i ) - { - xNewDataProvider->registerDataSequenceForChanges( aData[i]->getValues()); - xNewDataProvider->registerDataSequenceForChanges( aData[i]->getLabel()); - } - } - } - - // restore modify status - Reference< util::XModifiable > xSourceMod( xSource, uno::UNO_QUERY ); - Reference< util::XModifiable > xDestMod( xDestination, uno::UNO_QUERY ); - if( xSourceMod.is() && xDestMod.is() && - ! xSourceMod->isModified() ) - { - xDestMod->setModified( sal_False ); - } - // \-- loccked controllers of destination - } - catch( uno::Exception & ) - { - } - } -} - -// ---------------------------------------- - -UndoElementWithData::UndoElementWithData( - const OUString & rActionString, - const Reference< frame::XModel > & xModel ) : - UndoElement( rActionString, xModel ) -{ - initializeData(); -} - -UndoElementWithData::UndoElementWithData( - const Reference< frame::XModel > & xModel ) : - UndoElement( xModel ) -{ - initializeData(); -} - - -UndoElementWithData::UndoElementWithData( - const UndoElementWithData & rOther ) : - UndoElement( rOther ) -{ - initializeData(); -} - -UndoElementWithData::~UndoElementWithData() -{} - -void UndoElementWithData::initializeData() -{ - try - { - Reference< chart2::XChartDocument > xChartDoc( m_xModel, uno::UNO_QUERY_THROW ); - OSL_ASSERT( xChartDoc->hasInternalDataProvider()); - if( xChartDoc->hasInternalDataProvider()) - { - Reference< util::XCloneable > xCloneable( xChartDoc->getDataProvider(), uno::UNO_QUERY ); - OSL_ENSURE( xCloneable.is(), "Cannot clone data" ); - if( xCloneable.is()) - m_xData.set( xCloneable->createClone(), uno::UNO_QUERY ); - } - } - catch( uno::Exception & ) - { - } -} - -void UndoElementWithData::dispose() -{ - UndoElement::dispose(); - m_xData.set( 0 ); -} - -void UndoElementWithData::applyToModel( - Reference< frame::XModel > & xInOutModelToChange ) -{ - UndoElement::applyModelContentToModel( xInOutModelToChange, m_xModel, m_xData ); -} - -UndoElement * UndoElementWithData::createFromModel( - const Reference< frame::XModel > & xModel ) -{ - return new UndoElementWithData( getActionString(), xModel ); -} - -// ======================================== - -// ---------------------------------------- - -UndoElementWithSelection::UndoElementWithSelection( - const OUString & rActionString, - const Reference< frame::XModel > & xModel ) : - UndoElement( rActionString, xModel ) -{ - initialize( xModel ); -} - -UndoElementWithSelection::UndoElementWithSelection( - const Reference< frame::XModel > & xModel ) : - UndoElement( xModel ) -{ - initialize( xModel ); -} - -UndoElementWithSelection::UndoElementWithSelection( - const UndoElementWithSelection & rOther ) : - UndoElement( rOther ) -{ - initialize( rOther.m_xModel ); -} - -UndoElementWithSelection::~UndoElementWithSelection() -{} - -void UndoElementWithSelection::initialize( const Reference< frame::XModel > & xModel ) -{ - try - { - uno::Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), uno::UNO_QUERY ); - OSL_ASSERT( xSelSupp.is() ); - - if( xSelSupp.is() ) - m_aSelection = xSelSupp->getSelection(); - } - catch( const uno::Exception & ) - { - } -} - -void UndoElementWithSelection::dispose() -{ - UndoElement::dispose(); - m_aSelection.clear(); -} - -void UndoElementWithSelection::applyToModel( - Reference< frame::XModel > & xInOutModelToChange ) -{ - UndoElement::applyModelContentToModel( xInOutModelToChange, m_xModel ); - Reference< view::XSelectionSupplier > xCurrentSelectionSuppl( xInOutModelToChange->getCurrentController(), uno::UNO_QUERY ); - OSL_ASSERT( xCurrentSelectionSuppl.is() ); - - if( xCurrentSelectionSuppl.is()) - xCurrentSelectionSuppl->select( m_aSelection ); -} - -UndoElement * UndoElementWithSelection::createFromModel( - const Reference< frame::XModel > & xModel ) -{ - return new UndoElementWithSelection( getActionString(), xModel ); -} - -// ---------------------------------------- - -ShapeUndoElement::ShapeUndoElement( const OUString& rActionString, SdrUndoAction* pAction ) - :UndoElement( rActionString, Reference< frame::XModel >() ) - ,m_pAction( pAction ) -{ -} - -ShapeUndoElement::ShapeUndoElement( const ShapeUndoElement& rOther ) - :UndoElement( rOther ) - ,m_pAction( rOther.m_pAction ) -{ -} - -ShapeUndoElement::~ShapeUndoElement() -{ -} - -SdrUndoAction* ShapeUndoElement::getSdrUndoAction() -{ - return m_pAction; -} - -// ======================================== - -UndoStack::UndoStack() : - m_nSizeLimit( 1000 ) -{ -} - -UndoStack::~UndoStack() -{ - disposeAndClear(); -} - -void UndoStack::pop() -{ - if( ! empty()) - { - top()->dispose(); - delete top(); - m_aStack.pop_back(); - } -} - -void UndoStack::push( UndoElement * pElement ) -{ - m_aStack.push_back( pElement ); - applyLimitation(); -} - -UndoElement * UndoStack::top() const -{ - return m_aStack.back(); -} - -OUString UndoStack::topUndoString() const -{ - if( ! empty()) - return top()->getActionString(); - return OUString(); -} - -Sequence< OUString > UndoStack::getUndoStrings() const -{ - sal_Int32 nSize( static_cast< sal_Int32 >( m_aStack.size())); - Sequence< OUString > aResult( nSize ); - for( sal_Int32 i=0; i<nSize; ++i ) - aResult[i] = m_aStack[i]->getActionString(); - return aResult; -} - -bool UndoStack::empty() const -{ - return m_aStack.empty(); -} - -void UndoStack::disposeAndClear() -{ - ::std::for_each( m_aStack.begin(), m_aStack.end(), ::boost::mem_fn( & UndoElement::dispose )); - ::std::for_each( m_aStack.begin(), m_aStack.end(), CommonFunctors::DeletePtr< UndoElement >() ); - m_aStack.clear(); -} - -void UndoStack::limitSize( sal_Int32 nMaxSize ) -{ - m_nSizeLimit = nMaxSize; - applyLimitation(); -} - -void UndoStack::applyLimitation() -{ - if( m_aStack.size() > static_cast< sal_uInt32 >( m_nSizeLimit )) - { - tUndoStackType::iterator aBegin( m_aStack.begin()); - tUndoStackType::iterator aEnd( aBegin + (m_aStack.size() - m_nSizeLimit)); - // dispose and remove all undo elements that are over the limit - ::std::for_each( aBegin, aEnd, ::boost::mem_fn( & UndoElement::dispose )); - ::std::for_each( aBegin, aEnd, CommonFunctors::DeletePtr< UndoElement >() ); - m_aStack.erase( aBegin, aEnd ); - } -} - -// ================================================================================ - -namespace -{ -static const OUString aUndoStepsPropName( RTL_CONSTASCII_USTRINGPARAM("Steps")); -} // anonymous namespace - -UndoStepsConfigItem::UndoStepsConfigItem( ConfigItemListener & rListener ) : - ::utl::ConfigItem( OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Undo"))), - m_rListener( rListener ) -{ - EnableNotification( Sequence< OUString >( & aUndoStepsPropName, 1 )); -} - -UndoStepsConfigItem::~UndoStepsConfigItem() -{ -} - -void UndoStepsConfigItem::Notify( const Sequence< OUString > & aPropertyNames ) -{ - for( sal_Int32 nIdx=0; nIdx<aPropertyNames.getLength(); ++nIdx ) - { - if( aPropertyNames[nIdx].equals( aUndoStepsPropName )) - m_rListener.notify( aPropertyNames[nIdx] ); - } -} - -void UndoStepsConfigItem::Commit() -{ -} - -// mtehod is not const, because GetProperties is not const -sal_Int32 UndoStepsConfigItem::getUndoSteps() -{ - sal_Int32 nSteps = -1; - Sequence< uno::Any > aValues( - GetProperties( Sequence< OUString >( & aUndoStepsPropName, 1 ))); - if( aValues.getLength()) - aValues[0] >>= nSteps; - return nSteps; -} - -} // namespace impl -} // namespace chart - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/main/ImplUndoManager.hxx b/chart2/source/controller/main/ImplUndoManager.hxx deleted file mode 100644 index 71d56758d51a..000000000000 --- a/chart2/source/controller/main/ImplUndoManager.hxx +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef CHART2_IMPLUNDOMANAGER_HXX -#define CHART2_IMPLUNDOMANAGER_HXX - -#include "ConfigItemListener.hxx" - -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/uno/Sequence.hxx> - -#include <rtl/ustring.hxx> -#include <unotools/configitem.hxx> - -#include <utility> -#include <deque> - - -class SdrUndoAction; - -namespace com { namespace sun { namespace star { -namespace chart2 { - class XInternalDataProvider; -} -}}} - - -namespace chart -{ -namespace impl -{ - -class UndoElement -{ -public: - UndoElement( const ::rtl::OUString & rActionString, - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - UndoElement( const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - UndoElement( const UndoElement & rOther ); - virtual ~UndoElement(); - - virtual void dispose(); - virtual UndoElement * createFromModel( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - - virtual void applyToModel( - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xInOutModelToChange ); - - void setActionString( const ::rtl::OUString & rActionString ); - ::rtl::OUString getActionString() const; - - static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > cloneModel( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel ); - - static void applyModelContentToModel( - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xInOutModelToChange, - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModelToCopyFrom, - const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > & xData = 0 ); - -protected: - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > m_xModel; - -private: - void initialize( const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - - ::rtl::OUString m_aActionString; -}; - -class UndoElementWithData : public UndoElement -{ -public: - UndoElementWithData( const ::rtl::OUString & rActionString, - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - UndoElementWithData( const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - UndoElementWithData( const UndoElementWithData & rOther ); - virtual ~UndoElementWithData(); - - virtual void dispose(); - virtual UndoElement * createFromModel( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - - virtual void applyToModel( - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xInOutModelToChange ); - -private: - void initializeData(); - - ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XInternalDataProvider > m_xData; -}; - -class UndoElementWithSelection : public UndoElement -{ -public: - UndoElementWithSelection( const ::rtl::OUString & rActionString, - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - UndoElementWithSelection( const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - UndoElementWithSelection( const UndoElementWithSelection & rOther ); - virtual ~UndoElementWithSelection(); - - virtual void dispose(); - virtual UndoElement * createFromModel( - const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - - virtual void applyToModel( - ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xInOutModelToChange ); - -private: - void initialize( const ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > & xModel ); - - ::com::sun::star::uno::Any m_aSelection; -}; - -class ShapeUndoElement : public UndoElement -{ -public: - ShapeUndoElement( const ::rtl::OUString& rActionString, SdrUndoAction* pAction ); - ShapeUndoElement( const ShapeUndoElement& rOther ); - virtual ~ShapeUndoElement(); - - SdrUndoAction* getSdrUndoAction(); - -private: - SdrUndoAction* m_pAction; -}; - -/** Note that all models that are put into this container are at some point - disposed of inside this class. (At least in the destructor). That means - the models retrieved here should never be used, but instead their content - should be copied to a living model. - */ -class UndoStack -{ -public: - UndoStack(); - // disposes of all models left in the stack - ~UndoStack(); - - // removes he last undo action and disposes of the model - void pop(); - void push( UndoElement * rElement ); - - // precondition: !empty() - UndoElement * top() const; - ::rtl::OUString topUndoString() const; - - ::com::sun::star::uno::Sequence< ::rtl::OUString > getUndoStrings() const; - - bool empty() const; - void disposeAndClear(); - - // removes all actions that have been inserted more than nMaxSize steps ago. - // The models of those actions are disposed of - void limitSize( sal_Int32 nMaxSize ); - -private: - void applyLimitation(); - - typedef ::std::deque< UndoElement * > tUndoStackType; - - tUndoStackType m_aStack; - sal_Int32 m_nSizeLimit; -}; - -// ---------------------------------------- - -class UndoStepsConfigItem : public ::utl::ConfigItem -{ -public: - explicit UndoStepsConfigItem( ConfigItemListener & rListener ); - virtual ~UndoStepsConfigItem(); - - sal_Int32 getUndoSteps(); - -protected: - // ____ ::utl::ConfigItem ____ - virtual void Notify( const ::com::sun::star::uno::Sequence< ::rtl::OUString > & aPropertyNames ); - virtual void Commit(); - -private: - ConfigItemListener & m_rListener; -}; - - -} // namespace impl -} // namespace chart - -// CHART2_IMPLUNDOMANAGER_HXX -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/main/PositionAndSizeHelper.cxx b/chart2/source/controller/main/PositionAndSizeHelper.cxx index fd88410697f0..a392e3c8c1fc 100644 --- a/chart2/source/controller/main/PositionAndSizeHelper.cxx +++ b/chart2/source/controller/main/PositionAndSizeHelper.cxx @@ -34,6 +34,7 @@ #include "ChartModelHelper.hxx" #include "ControllerLockGuard.hxx" #include <com/sun/star/chart2/LegendPosition.hpp> +#include <com/sun/star/chart/ChartLegendExpansion.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/RelativeSize.hpp> #include "chartview/ExplicitValueProvider.hxx" @@ -84,51 +85,12 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType } else if(OBJECTTYPE_LEGEND==eObjectType) { - LegendPosition ePos = LegendPosition_LINE_END; - xObjectProp->getPropertyValue( C2U( "AnchorPosition" )) >>= ePos; + xObjectProp->setPropertyValue( C2U( "AnchorPosition" ), uno::makeAny(LegendPosition(LegendPosition_CUSTOM))); + xObjectProp->setPropertyValue( C2U( "Expansion" ), uno::makeAny(::com::sun::star::chart::ChartLegendExpansion_CUSTOM)); chart2::RelativePosition aRelativePosition; + chart2::RelativeSize aRelativeSize; Point aAnchor = aObjectRect.TopLeft(); - switch( ePos ) - { - case LegendPosition_LINE_START: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_LEFT; - aAnchor = aObjectRect.LeftCenter(); - } - break; - case LegendPosition_LINE_END: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_RIGHT; - aAnchor = aObjectRect.RightCenter(); - } - break; - case LegendPosition_PAGE_START: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_TOP; - aAnchor = aObjectRect.TopCenter(); - } - break; - case LegendPosition_PAGE_END: - //@todo language dependent positions ... - { - aRelativePosition.Anchor = drawing::Alignment_BOTTOM; - aAnchor = aObjectRect.BottomCenter(); - } - break; - case LegendPosition_CUSTOM: - { - //@todo language dependent positions ... - aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT; - } - break; - case LegendPosition_MAKE_FIXED_SIZE: - OSL_ASSERT( false ); - break; - } aRelativePosition.Primary = static_cast< double >( aAnchor.X()) / static_cast< double >( aPageRect.getWidth() ); @@ -137,6 +99,19 @@ bool PositionAndSizeHelper::moveObject( ObjectType eObjectType static_cast< double >( aPageRect.getHeight()); xObjectProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) ); + + aRelativeSize.Primary = + static_cast< double >( aObjectRect.getWidth()) / + static_cast< double >( aPageRect.getWidth() ); + if (aRelativeSize.Primary > 1.0) + aRelativeSize.Primary = 1.0; + aRelativeSize.Secondary = + static_cast< double >( aObjectRect.getHeight()) / + static_cast< double >( aPageRect.getHeight()); + if (aRelativeSize.Secondary > 1.0) + aRelativeSize.Secondary = 1.0; + + xObjectProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) ); } else if(OBJECTTYPE_DIAGRAM==eObjectType || OBJECTTYPE_DIAGRAM_WALL==eObjectType || OBJECTTYPE_DIAGRAM_FLOOR==eObjectType) { diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 967c059a7fba..12a5fc589878 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -276,10 +276,11 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* } //check wether the diagram was hit but not selected (e.g. because it has no filling): + rtl::OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) ); rtl::OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, rtl::OUString() ) );//@todo read CID from model - if ( m_aSelectedOID.getObjectCID().equals( aPageCID ) || m_aSelectedOID.getObjectCID().equals( aWallCID ) || !m_aSelectedOID.isAutoGeneratedObject() ) + bool bBackGroundHit = m_aSelectedOID.getObjectCID().equals( aPageCID ) || m_aSelectedOID.getObjectCID().equals( aWallCID ) || !m_aSelectedOID.isAutoGeneratedObject(); + if( bBackGroundHit ) { - rtl::OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, rtl::OUString::valueOf( sal_Int32(0) ) ); //todo: if more than one diagram is available in future do chack the list of all diagrams here SdrObject* pDiagram = pDrawViewWrapper->getNamedSdrObject( aDiagramCID ); if( pDiagram ) @@ -291,6 +292,20 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* } } } + //check wether the legend was hit but not selected (e.g. because it has no filling): + if( bBackGroundHit || m_aSelectedOID.getObjectCID().equals( aDiagramCID ) ) + { + rtl::OUString aLegendCID( ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::createParticleForLegend(0,0) ) );//@todo read CID from model + SdrObject* pLegend = pDrawViewWrapper->getNamedSdrObject( aLegendCID ); + if( pLegend ) + { + if( pDrawViewWrapper->IsObjectHit( pLegend, rMousePos ) ) + { + m_aSelectedOID = ObjectIdentifier( aLegendCID ); + pNewObj = pLegend; + } + } + } } } @@ -309,6 +324,7 @@ bool Selection::isResizeableObjectSelected() case OBJECTTYPE_DIAGRAM: case OBJECTTYPE_DIAGRAM_WALL: case OBJECTTYPE_SHAPE: + case OBJECTTYPE_LEGEND: return true; default: return false; diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index e3a76704abb6..3885eee5d20e 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -263,6 +263,7 @@ IMPL_LINK( ShapeController, CheckNameHdl, AbstractSvxNameDialog*, pDialog ) void ShapeController::executeDispatch_FormatLine() { + SolarMutexGuard aGuard; if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -272,12 +273,11 @@ void ShapeController::executeDispatch_FormatLine() { SdrObject* pSelectedObj = pDrawViewWrapper->getSelectedObject(); SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() ); - BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked(); + sal_Bool bHasMarked = pDrawViewWrapper->AreObjectsMarked(); if ( bHasMarked ) { - pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE ); + pDrawViewWrapper->MergeAttrFromMarked( aAttr, sal_False ); } - SolarMutexGuard aGuard; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -289,11 +289,11 @@ void ShapeController::executeDispatch_FormatLine() const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); if ( bHasMarked ) { - pDrawViewWrapper->SetAttrToMarked( *pOutAttr, FALSE ); + pDrawViewWrapper->SetAttrToMarked( *pOutAttr, sal_False ); } else { - pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE ); + pDrawViewWrapper->SetDefaultAttr( *pOutAttr, sal_False ); } } } @@ -303,6 +303,7 @@ void ShapeController::executeDispatch_FormatLine() void ShapeController::executeDispatch_FormatArea() { + SolarMutexGuard aGuard; if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -311,12 +312,11 @@ void ShapeController::executeDispatch_FormatArea() if ( pParent && pDrawModelWrapper && pDrawViewWrapper ) { SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() ); - BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked(); + sal_Bool bHasMarked = pDrawViewWrapper->AreObjectsMarked(); if ( bHasMarked ) { - pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE ); + pDrawViewWrapper->MergeAttrFromMarked( aAttr, sal_False ); } - SolarMutexGuard aGuard; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -337,11 +337,11 @@ void ShapeController::executeDispatch_FormatArea() const SfxItemSet* pOutAttr = pDlg->GetOutputItemSet(); if ( bHasMarked ) { - pDrawViewWrapper->SetAttrToMarked( *pOutAttr, FALSE ); + pDrawViewWrapper->SetAttrToMarked( *pOutAttr, sal_False ); } else { - pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE ); + pDrawViewWrapper->SetDefaultAttr( *pOutAttr, sal_False ); } } } @@ -352,6 +352,7 @@ void ShapeController::executeDispatch_FormatArea() void ShapeController::executeDispatch_TextAttributes() { + SolarMutexGuard aGuard; if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -359,12 +360,11 @@ void ShapeController::executeDispatch_TextAttributes() if ( pParent && pDrawViewWrapper ) { SfxItemSet aAttr( pDrawViewWrapper->GetDefaultAttr() ); - BOOL bHasMarked = pDrawViewWrapper->AreObjectsMarked(); + sal_Bool bHasMarked = pDrawViewWrapper->AreObjectsMarked(); if ( bHasMarked ) { - pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE ); + pDrawViewWrapper->MergeAttrFromMarked( aAttr, sal_False ); } - SolarMutexGuard aGuard; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -379,7 +379,7 @@ void ShapeController::executeDispatch_TextAttributes() } else { - pDrawViewWrapper->SetDefaultAttr( *pOutAttr, FALSE ); + pDrawViewWrapper->SetDefaultAttr( *pOutAttr, sal_False ); } } } @@ -389,6 +389,7 @@ void ShapeController::executeDispatch_TextAttributes() void ShapeController::executeDispatch_TransformDialog() { + SolarMutexGuard aGuard; if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -403,7 +404,6 @@ void ShapeController::executeDispatch_TransformDialog() pDrawViewWrapper->GetAttributes( aAttr ); // item set for position and size SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() ); - SolarMutexGuard aGuard; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -411,7 +411,7 @@ void ShapeController::executeDispatch_TransformDialog() pFact->CreateCaptionDialog( pParent, pDrawViewWrapper ) ); if ( pDlg.get() ) { - const USHORT* pRange = pDlg->GetInputRanges( *aAttr.GetPool() ); + const sal_uInt16* pRange = pDlg->GetInputRanges( *aAttr.GetPool() ); SfxItemSet aCombAttr( *aAttr.GetPool(), pRange ); aCombAttr.Put( aAttr ); aCombAttr.Put( aGeoAttr ); @@ -428,7 +428,6 @@ void ShapeController::executeDispatch_TransformDialog() else { SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() ); - SolarMutexGuard aGuard; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -447,6 +446,7 @@ void ShapeController::executeDispatch_TransformDialog() void ShapeController::executeDispatch_ObjectTitleDescription() { + SolarMutexGuard aGuard; if ( m_pChartController ) { DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); @@ -457,7 +457,6 @@ void ShapeController::executeDispatch_ObjectTitleDescription() { String aTitle( pSelectedObj->GetTitle() ); String aDescription( pSelectedObj->GetDescription() ); - SolarMutexGuard aGuard; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -478,6 +477,7 @@ void ShapeController::executeDispatch_ObjectTitleDescription() void ShapeController::executeDispatch_RenameObject() { + SolarMutexGuard aGuard; if ( m_pChartController ) { DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); @@ -487,7 +487,6 @@ void ShapeController::executeDispatch_RenameObject() if ( pSelectedObj ) { String aName( pSelectedObj->GetName() ); - SolarMutexGuard aGuard; SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -510,10 +509,10 @@ void ShapeController::executeDispatch_RenameObject() void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId ) { + SolarMutexGuard aGuard; DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL ); if ( pDrawViewWrapper ) { - SolarMutexGuard aGuard; switch ( nId ) { case COMMAND_ID_BRING_TO_FRONT: @@ -559,6 +558,7 @@ void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId ) void ShapeController::executeDispatch_FontDialog() { + SolarMutexGuard aGuard; if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -569,7 +569,6 @@ void ShapeController::executeDispatch_FontDialog() SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() ); pDrawViewWrapper->GetAttributes( aAttr ); ViewElementListProvider aViewElementListProvider( pDrawModelWrapper ); - SolarMutexGuard aGuard; ::boost::scoped_ptr< ShapeFontDialog > pDlg( new ShapeFontDialog( pParent, &aAttr, &aViewElementListProvider ) ); if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) { @@ -582,6 +581,7 @@ void ShapeController::executeDispatch_FontDialog() void ShapeController::executeDispatch_ParagraphDialog() { + SolarMutexGuard aGuard; if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -607,7 +607,6 @@ void ShapeController::executeDispatch_ParagraphDialog() aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) ); aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) ); - SolarMutexGuard aGuard; ::boost::scoped_ptr< ShapeParagraphDialog > pDlg( new ShapeParagraphDialog( pParent, &aNewAttr ) ); if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) { @@ -702,6 +701,7 @@ bool ShapeController::isBackwardPossible() { if ( m_pChartController && m_pChartController->m_aSelection.isAdditionalShapeSelected() ) { + SolarMutexGuard aGuard; DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pDrawViewWrapper ) { @@ -720,6 +720,7 @@ bool ShapeController::isForwardPossible() { if ( m_pChartController && m_pChartController->m_aSelection.isAdditionalShapeSelected() ) { + SolarMutexGuard aGuard; DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pDrawViewWrapper ) { diff --git a/chart2/source/controller/main/ShapeToolbarController.cxx b/chart2/source/controller/main/ShapeToolbarController.cxx index 7fe9acad757e..4e2cda70bbf6 100644 --- a/chart2/source/controller/main/ShapeToolbarController.cxx +++ b/chart2/source/controller/main/ShapeToolbarController.cxx @@ -127,10 +127,10 @@ void ShapeToolbarController::initialize( const Sequence< uno::Any >& rArguments ToolBox* pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ) ); if ( pToolBox ) { - const USHORT nCount = pToolBox->GetItemCount(); - for ( USHORT nPos = 0; nPos < nCount; ++nPos ) + const sal_uInt16 nCount = pToolBox->GetItemCount(); + for ( sal_uInt16 nPos = 0; nPos < nCount; ++nPos ) { - const USHORT nItemId = pToolBox->GetItemId( nPos ); + const sal_uInt16 nItemId = pToolBox->GetItemId( nPos ); if ( pToolBox->GetItemCommand( nItemId ) == String( m_aCommandURL ) ) { m_nToolBoxId = nItemId; @@ -202,9 +202,9 @@ void ShapeToolbarController::statusChanged( const frame::FeatureStateEvent& Even sal_Bool bCheckmark = sal_False; ToolBox& rTb = m_pToolbarController->GetToolBox(); - for ( USHORT i = 0; i < rTb.GetItemCount(); ++i ) + for ( sal_uInt16 i = 0; i < rTb.GetItemCount(); ++i ) { - USHORT nId = rTb.GetItemId( i ); + sal_uInt16 nId = rTb.GetItemId( i ); if ( nId == 0 ) { continue; diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.cxx b/chart2/source/controller/main/StatusBarCommandDispatch.cxx index 82620e94acce..bd3d547dfe77 100644 --- a/chart2/source/controller/main/StatusBarCommandDispatch.cxx +++ b/chart2/source/controller/main/StatusBarCommandDispatch.cxx @@ -34,9 +34,6 @@ #include "macros.hxx" #include <com/sun/star/util/XModifyBroadcaster.hpp> -// for ressource strings STR_UNDO and STR_REDO -#include <sfx2/sfx.hrc> - #include "ResId.hxx" using namespace ::com::sun::star; diff --git a/chart2/source/controller/main/UndoActions.cxx b/chart2/source/controller/main/UndoActions.cxx new file mode 100644 index 000000000000..86c0e365f590 --- /dev/null +++ b/chart2/source/controller/main/UndoActions.cxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_chart2.hxx" + +#include "UndoActions.hxx" +#include "DisposeHelper.hxx" +#include "CommonFunctors.hxx" +#include "PropertyHelper.hxx" +#include "ChartModelClone.hxx" + +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/lang/DisposedException.hpp> + +#include <tools/diagnose_ex.h> +#include <svx/svdundo.hxx> + +#include <boost/bind.hpp> +#include <algorithm> + +using namespace ::com::sun::star; + +using ::rtl::OUString; + +namespace chart +{ +namespace impl +{ + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::frame::XModel; + using ::com::sun::star::util::XCloneable; + using ::com::sun::star::lang::XComponent; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::view::XSelectionSupplier; + using ::com::sun::star::chart2::XChartDocument; + using ::com::sun::star::document::UndoFailedException; + /** === end UNO using === **/ + +// --------------------------------------------------------------------------------------------------------------------- +UndoElement::UndoElement( const OUString& i_actionString, const Reference< XModel >& i_documentModel, const ::boost::shared_ptr< ChartModelClone >& i_modelClone ) + :UndoElement_MBase() + ,UndoElement_TBase( m_aMutex ) + ,m_sActionString( i_actionString ) + ,m_xDocumentModel( i_documentModel ) + ,m_pModelClone( i_modelClone ) +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +UndoElement::~UndoElement() +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UndoElement::disposing() +{ + if ( !!m_pModelClone ) + m_pModelClone->dispose(); + m_pModelClone.reset(); + m_xDocumentModel.clear(); +} + +// --------------------------------------------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL UndoElement::getTitle() throw (RuntimeException) +{ + return m_sActionString; +} + +// --------------------------------------------------------------------------------------------------------------------- +void UndoElement::impl_toggleModelState() +{ + // get a snapshot of the current state of our model + ::boost::shared_ptr< ChartModelClone > pNewClone( new ChartModelClone( m_xDocumentModel, m_pModelClone->getFacet() ) ); + // apply the previous snapshot to our model + m_pModelClone->applyToModel( m_xDocumentModel ); + // remember the new snapshot, for the next toggle + m_pModelClone = pNewClone; +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UndoElement::undo( ) throw (UndoFailedException, RuntimeException) +{ + impl_toggleModelState(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL UndoElement::redo( ) throw (UndoFailedException, RuntimeException) +{ + impl_toggleModelState(); +} + +// ===================================================================================================================== +// = ShapeUndoElement +// ===================================================================================================================== + +// --------------------------------------------------------------------------------------------------------------------- +ShapeUndoElement::ShapeUndoElement( SdrUndoAction& i_sdrUndoAction ) + :ShapeUndoElement_MBase() + ,ShapeUndoElement_TBase( m_aMutex ) + ,m_pAction( &i_sdrUndoAction ) +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +ShapeUndoElement::~ShapeUndoElement() +{ +} + +// --------------------------------------------------------------------------------------------------------------------- +::rtl::OUString SAL_CALL ShapeUndoElement::getTitle() throw (RuntimeException) +{ + if ( !m_pAction ) + throw DisposedException( ::rtl::OUString(), *this ); + return m_pAction->GetComment(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL ShapeUndoElement::undo( ) throw (UndoFailedException, RuntimeException) +{ + if ( !m_pAction ) + throw DisposedException( ::rtl::OUString(), *this ); + m_pAction->Undo(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL ShapeUndoElement::redo( ) throw (UndoFailedException, RuntimeException) +{ + if ( !m_pAction ) + throw DisposedException( ::rtl::OUString(), *this ); + m_pAction->Redo(); +} + +// --------------------------------------------------------------------------------------------------------------------- +void SAL_CALL ShapeUndoElement::disposing() +{ +} + +} // namespace impl +} // namespace chart diff --git a/chart2/source/controller/main/UndoActions.hxx b/chart2/source/controller/main/UndoActions.hxx new file mode 100644 index 000000000000..2c98d6af1d54 --- /dev/null +++ b/chart2/source/controller/main/UndoActions.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CHART2_IMPLUNDOMANAGER_HXX +#define CHART2_IMPLUNDOMANAGER_HXX + +#include "ConfigItemListener.hxx" + +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/document/XUndoAction.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +#include <rtl/ustring.hxx> +#include <unotools/configitem.hxx> +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <utility> +#include <deque> + +#include <boost/noncopyable.hpp> +#include <boost/shared_ptr.hpp> + +class SdrUndoAction; + +namespace com { namespace sun { namespace star { +namespace chart2 { + class XInternalDataProvider; +} +}}} + + +namespace chart +{ +class ChartModelClone; + +namespace impl +{ + +typedef ::cppu::BaseMutex UndoElement_MBase; +typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::document::XUndoAction > UndoElement_TBase; + +class UndoElement :public UndoElement_MBase + ,public UndoElement_TBase + ,public ::boost::noncopyable +{ +public: + /** creates a new undo action + + @param i_actionString + is the title of the Undo action + @param i_documentModel + is the actual document model which the undo actions operates on + @param i_modelClone + is the cloned model from before the changes, which the Undo action represents, have been applied. + Upon <member>invoking</member>, the clone model is applied to the document model. + */ + UndoElement( const ::rtl::OUString & i_actionString, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_documentModel, + const ::boost::shared_ptr< ChartModelClone >& i_modelClone + ); + + // XUndoAction + virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL undo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL redo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + +protected: + virtual ~UndoElement(); + +private: + void impl_toggleModelState(); + +private: + ::rtl::OUString m_sActionString; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocumentModel; + ::boost::shared_ptr< ChartModelClone > m_pModelClone; +}; + + +typedef ::cppu::BaseMutex ShapeUndoElement_MBase; +typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::document::XUndoAction > ShapeUndoElement_TBase; +class ShapeUndoElement :public ShapeUndoElement_MBase + ,public ShapeUndoElement_TBase +{ +public: + ShapeUndoElement( SdrUndoAction& i_sdrUndoAction ); + + // XUndoAction + virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL undo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL redo( ) throw (::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + +protected: + virtual ~ShapeUndoElement(); + +private: + SdrUndoAction* m_pAction; +}; + +} // namespace impl +} // namespace chart + +// CHART2_IMPLUNDOMANAGER_HXX +#endif diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx index d1245b57f27d..fcc396025cfa 100644 --- a/chart2/source/controller/main/UndoCommandDispatch.cxx +++ b/chart2/source/controller/main/UndoCommandDispatch.cxx @@ -30,18 +30,19 @@ #include "precompiled_chart2.hxx" #include "UndoCommandDispatch.hxx" +#include "ResId.hxx" #include "macros.hxx" -#include <com/sun/star/chart2/XUndoSupplier.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/document/XUndoManagerSupplier.hpp> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> +#include <tools/diagnose_ex.h> // for ressource strings STR_UNDO and STR_REDO -#include <sfx2/sfx.hrc> - -#include "ResId.hxx" +#include <svtools/svtools.hrc> +#include <svtools/svtdata.hxx> using namespace ::com::sun::star; @@ -58,10 +59,8 @@ UndoCommandDispatch::UndoCommandDispatch( CommandDispatch( xContext ), m_xModel( xModel ) { - Reference< chart2::XUndoSupplier > xUndoSupplier( xModel, uno::UNO_QUERY ); - OSL_ASSERT( xUndoSupplier.is()); - if( xUndoSupplier.is()) - m_xUndoManager.set( xUndoSupplier->getUndoManager()); + uno::Reference< document::XUndoManagerSupplier > xSuppUndo( m_xModel, uno::UNO_QUERY_THROW ); + m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW ); } UndoCommandDispatch::~UndoCommandDispatch() @@ -70,10 +69,8 @@ UndoCommandDispatch::~UndoCommandDispatch() void UndoCommandDispatch::initialize() { Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY ); - if( xBroadcaster.is() ) - { - xBroadcaster->addModifyListener( this ); - } + ENSURE_OR_RETURN_VOID( xBroadcaster.is(), "UndoCommandDispatch::initialize: missing modification broadcaster interface!" ); + xBroadcaster->addModifyListener( this ); } void UndoCommandDispatch::fireStatusEvent( @@ -84,23 +81,23 @@ void UndoCommandDispatch::fireStatusEvent( { bool bFireAll = (rURL.getLength() == 0); uno::Any aUndoState, aRedoState; - if( m_xUndoManager->undoPossible()) + if( m_xUndoManager->isUndoPossible()) { // using assignment for broken gcc 3.3 - OUString aUndo = OUString( String( SchResId( STR_UNDO ))); - aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoString()); + OUString aUndo = OUString( String( SvtResId( STR_UNDO ))); + aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoActionTitle()); } - if( m_xUndoManager->redoPossible()) + if( m_xUndoManager->isRedoPossible()) { // using assignment for broken gcc 3.3 - OUString aRedo = OUString( String( SchResId( STR_REDO ))); - aRedoState <<= ( aRedo + m_xUndoManager->getCurrentRedoString()); + OUString aRedo = OUString( String( SvtResId( STR_REDO ))); + aRedoState <<= ( aRedo + m_xUndoManager->getCurrentRedoActionTitle()); } if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Undo"))) - fireStatusEventForURL( C2U(".uno:Undo"), aUndoState, m_xUndoManager->undoPossible(), xSingleListener ); + fireStatusEventForURL( C2U(".uno:Undo"), aUndoState, m_xUndoManager->isUndoPossible(), xSingleListener ); if( bFireAll || rURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(".uno:Redo"))) - fireStatusEventForURL( C2U(".uno:Redo"), aRedoState, m_xUndoManager->redoPossible(), xSingleListener ); + fireStatusEventForURL( C2U(".uno:Redo"), aRedoState, m_xUndoManager->isRedoPossible(), xSingleListener ); } } @@ -114,10 +111,22 @@ void SAL_CALL UndoCommandDispatch::dispatch( { // why is it necessary to lock the solar mutex here? SolarMutexGuard aSolarGuard; - if( URL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" ))) - m_xUndoManager->undo( m_xModel ); - else - m_xUndoManager->redo( m_xModel ); + try + { + if( URL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" ))) + m_xUndoManager->undo(); + else + m_xUndoManager->redo(); + } + catch( const document::UndoFailedException& ) + { + // silently ignore + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + // \-- } } @@ -126,6 +135,7 @@ void SAL_CALL UndoCommandDispatch::dispatch( void SAL_CALL UndoCommandDispatch::disposing() { Reference< util::XModifyBroadcaster > xBroadcaster( m_xUndoManager, uno::UNO_QUERY ); + OSL_ENSURE( xBroadcaster.is(), "UndoCommandDispatch::initialize: missing modification broadcaster interface!" ); if( xBroadcaster.is() ) { xBroadcaster->removeModifyListener( this ); diff --git a/chart2/source/controller/main/UndoCommandDispatch.hxx b/chart2/source/controller/main/UndoCommandDispatch.hxx index c2b1225780d2..d64f66f63102 100644 --- a/chart2/source/controller/main/UndoCommandDispatch.hxx +++ b/chart2/source/controller/main/UndoCommandDispatch.hxx @@ -31,15 +31,12 @@ #include "CommandDispatch.hxx" #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/document/XUndoManager.hpp> namespace chart { /** This is a CommandDispatch implementation for Undo and Redo. - - You need to pass an UndoManager to this class that is then used for Undo and - Redo. The changes are applied to the given XModel. */ class UndoCommandDispatch : public CommandDispatch { @@ -78,7 +75,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + ::com::sun::star::document::XUndoManager > m_xUndoManager; }; } // namespace chart diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx index 17d33f689975..26b13cd0a265 100644 --- a/chart2/source/controller/main/UndoGuard.cxx +++ b/chart2/source/controller/main/UndoGuard.cxx @@ -30,6 +30,12 @@ #include "precompiled_chart2.hxx" #include "UndoGuard.hxx" +#include "ChartModelClone.hxx" +#include "UndoActions.hxx" + +#include <com/sun/star/container/XChild.hpp> + +#include <tools/diagnose_ex.h> using namespace ::com::sun::star; @@ -40,105 +46,154 @@ using ::rtl::OUString; namespace chart { -UndoGuard_Base::UndoGuard_Base( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager - , const uno::Reference< frame::XModel > & xModel ) - : m_xModel( xModel ) - , m_xUndoManager( xUndoManager ) - , m_aUndoString( rUndoString ) - , m_bActionPosted( false ) +//----------------------------------------------------------------------------- + +UndoGuard::UndoGuard( const OUString& i_undoString, const uno::Reference< document::XUndoManager > & i_undoManager, + const ModelFacet i_facet ) + :m_xChartModel( i_undoManager->getParent(), uno::UNO_QUERY_THROW ) + ,m_xUndoManager( i_undoManager ) + ,m_pDocumentSnapshot() + ,m_aUndoString( i_undoString ) + ,m_bActionPosted( false ) { + m_pDocumentSnapshot.reset( new ChartModelClone( m_xChartModel, i_facet ) ); } -UndoGuard_Base::~UndoGuard_Base() +//----------------------------------------------------------------------------- + +UndoGuard::~UndoGuard() { + if ( !!m_pDocumentSnapshot ) + discardSnapshot(); } -void UndoGuard_Base::commitAction() +//----------------------------------------------------------------------------- + +void UndoGuard::commit() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->postAction( m_aUndoString ); + if ( !m_bActionPosted && !!m_pDocumentSnapshot ) + { + try + { + const Reference< document::XUndoAction > xAction( new impl::UndoElement( m_aUndoString, m_xChartModel, m_pDocumentSnapshot ) ); + m_pDocumentSnapshot.reset(); // don't dispose, it's data went over to the UndoElement + m_xUndoManager->addUndoAction( xAction ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } m_bActionPosted = true; } //----------------------------------------------------------------------------- -UndoGuard::UndoGuard( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager - , const uno::Reference< frame::XModel > & xModel ) - : UndoGuard_Base( rUndoString, xUndoManager, xModel ) +void UndoGuard::rollback() { - if( m_xUndoManager.is() ) - m_xUndoManager->preAction( m_xModel ); + ENSURE_OR_RETURN_VOID( !!m_pDocumentSnapshot, "no snapshot!" ); + m_pDocumentSnapshot->applyToModel( m_xChartModel ); + discardSnapshot(); } -UndoGuard::~UndoGuard() +//----------------------------------------------------------------------------- +void UndoGuard::discardSnapshot() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelAction(); + ENSURE_OR_RETURN_VOID( !!m_pDocumentSnapshot, "no snapshot!" ); + m_pDocumentSnapshot->dispose(); + m_pDocumentSnapshot.reset(); } //----------------------------------------------------------------------------- -UndoLiveUpdateGuard::UndoLiveUpdateGuard( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager - , const uno::Reference< frame::XModel > & xModel ) - : UndoGuard_Base( rUndoString, xUndoManager, xModel ) +UndoLiveUpdateGuard::UndoLiveUpdateGuard( const OUString& i_undoString, const uno::Reference< document::XUndoManager >& i_undoManager ) + :UndoGuard( i_undoString, i_undoManager, E_MODEL ) { - if( m_xUndoManager.is() ) - m_xUndoManager->preAction( m_xModel ); } UndoLiveUpdateGuard::~UndoLiveUpdateGuard() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelActionWithUndo( m_xModel ); + if ( !isActionPosted() ) + rollback(); } //----------------------------------------------------------------------------- -UndoLiveUpdateGuardWithData::UndoLiveUpdateGuardWithData( const OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager - , const uno::Reference< frame::XModel > & xModel ) - : UndoGuard_Base( rUndoString, xUndoManager, xModel ) +UndoLiveUpdateGuardWithData::UndoLiveUpdateGuardWithData( + const OUString& i_undoString, const uno::Reference< document::XUndoManager >& i_undoManager ) + :UndoGuard( i_undoString, i_undoManager, E_MODEL_WITH_DATA ) { - if( m_xUndoManager.is() ) - { - Sequence< beans::PropertyValue > aArgs(1); - aArgs[0] = beans::PropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("WithData")), -1, uno::Any(), - beans::PropertyState_DIRECT_VALUE ); - m_xUndoManager->preActionWithArguments( m_xModel, aArgs ); - } } UndoLiveUpdateGuardWithData::~UndoLiveUpdateGuardWithData() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelActionWithUndo( m_xModel ); + if ( !isActionPosted() ) + rollback(); } //----------------------------------------------------------------------------- -UndoGuardWithSelection::UndoGuardWithSelection( const rtl::OUString& rUndoString - , const uno::Reference< chart2::XUndoManager > & xUndoManager - , const uno::Reference< frame::XModel > & xModel ) - : UndoGuard_Base( rUndoString, xUndoManager, xModel ) +UndoGuardWithSelection::UndoGuardWithSelection( + const OUString& i_undoString, const uno::Reference< document::XUndoManager >& i_undoManager ) + :UndoGuard( i_undoString, i_undoManager, E_MODEL_WITH_SELECTION ) { - if( m_xUndoManager.is() ) +} + +//----------------------------------------------------------------------------- + +UndoGuardWithSelection::~UndoGuardWithSelection() +{ + if ( !isActionPosted() ) + rollback(); +} + +//----------------------------------------------------------------------------- + +UndoContext::UndoContext( const Reference< document::XUndoManager > & i_undoManager, const ::rtl::OUString& i_undoTitle ) + :m_xUndoManager( i_undoManager ) +{ + ENSURE_OR_THROW( m_xUndoManager.is(), "invalid undo manager!" ); + m_xUndoManager->enterUndoContext( i_undoTitle ); +} + +//----------------------------------------------------------------------------- + +UndoContext::~UndoContext() +{ + m_xUndoManager->leaveUndoContext(); +} + +//----------------------------------------------------------------------------- + +HiddenUndoContext::HiddenUndoContext( const Reference< document::XUndoManager > & i_undoManager ) + :m_xUndoManager( i_undoManager ) +{ + ENSURE_OR_THROW( m_xUndoManager.is(), "invalid undo manager!" ); + try + { + m_xUndoManager->enterHiddenUndoContext(); + } + catch( const uno::Exception& ) { - Sequence< beans::PropertyValue > aArgs(1); - aArgs[0] = beans::PropertyValue( - OUString( RTL_CONSTASCII_USTRINGPARAM("WithSelection")), -1, uno::Any(), - beans::PropertyState_DIRECT_VALUE ); - m_xUndoManager->preActionWithArguments( m_xModel, aArgs ); + DBG_UNHANDLED_EXCEPTION(); + m_xUndoManager.clear(); + // prevents the leaveUndoContext in the dtor } } -UndoGuardWithSelection::~UndoGuardWithSelection() +//----------------------------------------------------------------------------- + +HiddenUndoContext::~HiddenUndoContext() { - if( !m_bActionPosted && m_xUndoManager.is() ) - m_xUndoManager->cancelAction(); + try + { + if ( m_xUndoManager.is() ) + m_xUndoManager->leaveUndoContext(); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } } } // namespace chart diff --git a/chart2/source/controller/main/UndoGuard.hxx b/chart2/source/controller/main/UndoGuard.hxx new file mode 100644 index 000000000000..c5c00dd62d1b --- /dev/null +++ b/chart2/source/controller/main/UndoGuard.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef CHART2_UNDOGUARD_HXX +#define CHART2_UNDOGUARD_HXX + +#include "ChartModelClone.hxx" + +#include <com/sun/star/document/XUndoManager.hpp> +#include <com/sun/star/frame/XModel.hpp> + +#include <rtl/ustring.hxx> + +#include <boost/shared_ptr.hpp> + +namespace chart +{ + +/** A guard which which does nothing, unless you explicitly call commitAction. In particular, in its destructor, it + does neither auto-commit nor auto-rollback the model changes. + */ +class UndoGuard +{ +public: + explicit UndoGuard( + const ::rtl::OUString& i_undoMessage, + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager, + const ModelFacet i_facet = E_MODEL + ); + ~UndoGuard(); + + void commit(); + void rollback(); + +protected: + bool isActionPosted() const { return m_bActionPosted; } + +private: + void discardSnapshot(); + +private: + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xChartModel; + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager; + + ::boost::shared_ptr< ChartModelClone > m_pDocumentSnapshot; + rtl::OUString m_aUndoString; + bool m_bActionPosted; +}; + +/** A guard which, in its destructor, restores the model state it found in the constructor. If + <member>commitAction</member> is called inbetween, the restouration is not performed. + */ +class UndoLiveUpdateGuard : public UndoGuard +{ +public: + explicit UndoLiveUpdateGuard( + const ::rtl::OUString& i_undoMessage, + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager + ); + ~UndoLiveUpdateGuard(); +}; + +/** Same as UndoLiveUpdateGuard but with additional storage of the chart's data. + Only use this if the data has internal data. + */ +class UndoLiveUpdateGuardWithData : + public UndoGuard +{ +public: + explicit UndoLiveUpdateGuardWithData( + const ::rtl::OUString& i_undoMessage, + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager + ); + ~UndoLiveUpdateGuardWithData(); +}; + +class UndoGuardWithSelection : public UndoGuard +{ +public: + explicit UndoGuardWithSelection( + const ::rtl::OUString& i_undoMessage, + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager + ); + virtual ~UndoGuardWithSelection(); +}; + +class UndoContext +{ +public: + UndoContext( + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager, + const ::rtl::OUString& i_undoTitle + ); + ~UndoContext(); + +private: + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager; +}; + +class HiddenUndoContext +{ +public: + HiddenUndoContext( + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager + ); + ~HiddenUndoContext(); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager; +}; + +} +// CHART2_UNDOGUARD_HXX +#endif diff --git a/chart2/source/controller/main/UndoManager.cxx b/chart2/source/controller/main/UndoManager.cxx deleted file mode 100644 index d282201ad63d..000000000000 --- a/chart2/source/controller/main/UndoManager.cxx +++ /dev/null @@ -1,441 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_chart2.hxx" - -#include "UndoManager.hxx" -#include "ImplUndoManager.hxx" -#include "DisposeHelper.hxx" -#include "MutexContainer.hxx" -#include "macros.hxx" -#include "ChartViewHelper.hxx" - -#include <com/sun/star/util/XCloneable.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/chart2/XChartDocument.hpp> - -#include <unotools/configitem.hxx> -#include <cppuhelper/compbase1.hxx> -#include <rtl/uuid.h> -#include <svx/svdundo.hxx> - -#include <functional> - -using namespace ::com::sun::star; - -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::Sequence; -using ::rtl::OUString; - - -// -------------------------------------------------------------------------------- - -namespace chart -{ - -namespace impl -{ -typedef ::cppu::WeakComponentImplHelper1< - util::XModifyBroadcaster > - ModifyBroadcaster_Base; - -class ModifyBroadcaster : - public ::chart::MutexContainer, - public ModifyBroadcaster_Base -{ -public: - ModifyBroadcaster(); - - void fireEvent(); - -protected: - // ____ XModifyBroadcaster ____ - virtual void SAL_CALL addModifyListener( const Reference< util::XModifyListener >& xListener ) - throw (uno::RuntimeException); - virtual void SAL_CALL removeModifyListener( const Reference< util::XModifyListener >& xListener ) - throw (uno::RuntimeException); -}; - -ModifyBroadcaster::ModifyBroadcaster() : - ModifyBroadcaster_Base( m_aMutex ) -{} - -void SAL_CALL ModifyBroadcaster::addModifyListener( - const Reference< util::XModifyListener >& xListener ) - throw (uno::RuntimeException) -{ - rBHelper.addListener( ::getCppuType( & xListener ), xListener); -} - -void SAL_CALL ModifyBroadcaster::removeModifyListener( - const Reference< util::XModifyListener >& xListener ) - throw (uno::RuntimeException) -{ - rBHelper.removeListener( ::getCppuType( & xListener ), xListener ); -} - -void ModifyBroadcaster::fireEvent() -{ - ::cppu::OInterfaceContainerHelper* pIC = rBHelper.getContainer( - ::getCppuType((const uno::Reference< util::XModifyListener >*)0) ); - if( pIC ) - { - lang::EventObject aEvent( static_cast< lang::XComponent* >( this ) ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - uno::Reference< util::XModifyListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->modified( aEvent ); - } - } -} - -} // namespace impl - -UndoManager::UndoManager() : - impl::UndoManager_Base( m_aMutex ), - m_apUndoStack( new impl::UndoStack()), - m_apRedoStack( new impl::UndoStack()), - m_pLastRemeberedUndoElement( 0 ), - m_nMaxNumberOfUndos( 100 ), - m_pModifyBroadcaster( 0 ) -{} - -UndoManager::~UndoManager() -{ - DisposeHelper::Dispose( m_xModifyBroadcaster ); - m_apUndoStack->disposeAndClear(); - m_apRedoStack->disposeAndClear(); - - delete m_pLastRemeberedUndoElement; - m_pLastRemeberedUndoElement = 0; -} - -void UndoManager::addShapeUndoAction( SdrUndoAction* pAction ) -{ - if ( !pAction ) - { - return; - } - - impl::ShapeUndoElement* pShapeUndoElement = new impl::ShapeUndoElement( pAction->GetComment(), pAction ); - if ( pShapeUndoElement ) - { - m_apUndoStack->push( pShapeUndoElement ); - m_apRedoStack->disposeAndClear(); - if ( !m_apUndoStepsConfigItem.get() ) - { - retrieveConfigUndoSteps(); - } - fireModifyEvent(); - } -} - -void UndoManager::impl_undoRedo( - Reference< frame::XModel > & xCurrentModel, - impl::UndoStack * pStackToRemoveFrom, - impl::UndoStack * pStackToAddTo, - bool bUndo ) -{ - if( pStackToRemoveFrom && ! pStackToRemoveFrom->empty() ) - { - // get model from undo/redo - impl::UndoElement * pTop( pStackToRemoveFrom->top()); - if( pTop ) - { - impl::ShapeUndoElement* pShapeUndoElement = dynamic_cast< impl::ShapeUndoElement* >( pTop ); - if ( pShapeUndoElement ) - { - impl::ShapeUndoElement* pNewShapeUndoElement = new impl::ShapeUndoElement( *pShapeUndoElement ); - pStackToAddTo->push( pNewShapeUndoElement ); - SdrUndoAction* pAction = pNewShapeUndoElement->getSdrUndoAction(); - if ( pAction ) - { - if ( bUndo ) - { - pAction->Undo(); - } - else - { - pAction->Redo(); - } - } - } - else - { - // put a clone of current model into redo/undo stack with the same - // action string as the undo/redo - pStackToAddTo->push( pTop->createFromModel( xCurrentModel )); - // change current model by properties of the model from undo - pTop->applyToModel( xCurrentModel ); - } - // remove the top undo element - pStackToRemoveFrom->pop(), pTop = 0; - ChartViewHelper::setViewToDirtyState( xCurrentModel ); - fireModifyEvent(); - } - } - else - { - OSL_FAIL( "Can't Undo/Redo" ); - } -} - -void UndoManager::fireModifyEvent() -{ - if( m_xModifyBroadcaster.is()) - m_pModifyBroadcaster->fireEvent(); -} - - -// ____ ConfigItemListener ____ -void UndoManager::notify( const ::rtl::OUString & rPropertyName ) -{ - OSL_ENSURE( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Steps" )), - "Unwanted config property change Notified" ); - if( rPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Steps" ))) - retrieveConfigUndoSteps(); -} - -void UndoManager::retrieveConfigUndoSteps() -{ - if( ! m_apUndoStepsConfigItem.get()) - m_apUndoStepsConfigItem.reset( new impl::UndoStepsConfigItem( *this )); - m_nMaxNumberOfUndos = m_apUndoStepsConfigItem->getUndoSteps(); - m_apUndoStack->limitSize( m_nMaxNumberOfUndos ); - m_apRedoStack->limitSize( m_nMaxNumberOfUndos ); - - // a list of available undo steps could shrink here - fireModifyEvent(); -} - -// ____ XModifyBroadcaster ____ -void SAL_CALL UndoManager::addModifyListener( const Reference< util::XModifyListener >& aListener ) - throw (uno::RuntimeException) -{ - if( ! m_xModifyBroadcaster.is()) - { - m_pModifyBroadcaster = new impl::ModifyBroadcaster(); - m_xModifyBroadcaster.set( static_cast< cppu::OWeakObject* >( m_pModifyBroadcaster ), uno::UNO_QUERY ); - } - m_xModifyBroadcaster->addModifyListener( aListener ); -} - -void SAL_CALL UndoManager::removeModifyListener( const Reference< util::XModifyListener >& aListener ) - throw (uno::RuntimeException) -{ - if( ! m_xModifyBroadcaster.is()) - { - m_pModifyBroadcaster = new impl::ModifyBroadcaster(); - m_xModifyBroadcaster.set( static_cast< cppu::OWeakObject* >( m_pModifyBroadcaster ), uno::UNO_QUERY ); - } - m_xModifyBroadcaster->removeModifyListener( aListener ); -} - -// ____ chart2::XUndoManager ____ -void SAL_CALL UndoManager::preAction( const Reference< frame::XModel >& xModelBeforeChange ) - throw (uno::RuntimeException) -{ - OSL_ENSURE( ! m_pLastRemeberedUndoElement, "Looks like postAction or cancelAction call was missing" ); - m_pLastRemeberedUndoElement = new impl::UndoElement( xModelBeforeChange ); -} - -void SAL_CALL UndoManager::preActionWithArguments( - const Reference< frame::XModel >& xModelBeforeChange, - const Sequence< beans::PropertyValue >& aArguments ) - throw (uno::RuntimeException) -{ - bool bActionHandled( false ); - OSL_ENSURE( ! m_pLastRemeberedUndoElement, "Looks like postAction or cancelAction call was missing" ); - if( aArguments.getLength() > 0 ) - { - OSL_ENSURE( aArguments.getLength() == 1, "More than one argument is not supported yet" ); - if( aArguments[0].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("WithData"))) - { - m_pLastRemeberedUndoElement = new impl::UndoElementWithData( xModelBeforeChange ); - bActionHandled = true; - } - else if( aArguments[0].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("WithSelection"))) - { - m_pLastRemeberedUndoElement = new impl::UndoElementWithSelection( xModelBeforeChange ); - bActionHandled = true; - } - } - - if( !bActionHandled ) - preAction( xModelBeforeChange ); -} - -void SAL_CALL UndoManager::postAction( const OUString& aUndoText ) - throw (uno::RuntimeException) -{ - OSL_ENSURE( m_pLastRemeberedUndoElement, "Looks like preAction call was missing" ); - if( m_pLastRemeberedUndoElement ) - { - m_pLastRemeberedUndoElement->setActionString( aUndoText ); - m_apUndoStack->push( m_pLastRemeberedUndoElement ); - m_pLastRemeberedUndoElement = 0; - - // redo no longer possible - m_apRedoStack->disposeAndClear(); - - // it suffices to get the number of undo steps from config after the - // first time postAction has been called - if( ! m_apUndoStepsConfigItem.get()) - retrieveConfigUndoSteps(); - - fireModifyEvent(); - } -} - -void SAL_CALL UndoManager::cancelAction() - throw (uno::RuntimeException) -{ - delete m_pLastRemeberedUndoElement; - m_pLastRemeberedUndoElement = 0; -} - -void SAL_CALL UndoManager::cancelActionWithUndo( Reference< frame::XModel >& xModelToRestore ) - throw (uno::RuntimeException) -{ - if( m_pLastRemeberedUndoElement ) - { - m_pLastRemeberedUndoElement->applyToModel( xModelToRestore ); - cancelAction(); - } -} - -void SAL_CALL UndoManager::undo( Reference< frame::XModel >& xCurrentModel ) - throw (uno::RuntimeException) -{ - OSL_ASSERT( m_apUndoStack.get() && m_apRedoStack.get()); - impl_undoRedo( xCurrentModel, m_apUndoStack.get(), m_apRedoStack.get(), true ); -} - -void SAL_CALL UndoManager::redo( Reference< frame::XModel >& xCurrentModel ) - throw (uno::RuntimeException) -{ - OSL_ASSERT( m_apUndoStack.get() && m_apRedoStack.get()); - impl_undoRedo( xCurrentModel, m_apRedoStack.get(), m_apUndoStack.get(), false ); -} - -::sal_Bool SAL_CALL UndoManager::undoPossible() - throw (uno::RuntimeException) -{ - return ! m_apUndoStack->empty(); -} - -::sal_Bool SAL_CALL UndoManager::redoPossible() - throw (uno::RuntimeException) -{ - return ! m_apRedoStack->empty(); -} - -OUString SAL_CALL UndoManager::getCurrentUndoString() - throw (uno::RuntimeException) -{ - return m_apUndoStack->topUndoString(); -} - -OUString SAL_CALL UndoManager::getCurrentRedoString() - throw (uno::RuntimeException) -{ - return m_apRedoStack->topUndoString(); -} - -Sequence< OUString > SAL_CALL UndoManager::getAllUndoStrings() - throw (uno::RuntimeException) -{ - return m_apUndoStack->getUndoStrings(); -} - -Sequence< OUString > SAL_CALL UndoManager::getAllRedoStrings() - throw (uno::RuntimeException) -{ - return m_apRedoStack->getUndoStrings(); -} - -// ____ XUndoHelper ____ -Reference< frame::XModel > SAL_CALL UndoManager::getModelCloneForUndo( - const Reference< frame::XModel >& xModelBeforeChange ) - throw (uno::RuntimeException) -{ - return impl::UndoElement::cloneModel( xModelBeforeChange ); -} - -void SAL_CALL UndoManager::applyModelContent( - Reference< frame::XModel >& xModelToChange, - const Reference< frame::XModel >& xModelToCopyFrom ) - throw (uno::RuntimeException) -{ - impl::UndoElement::applyModelContentToModel( xModelToChange, xModelToCopyFrom ); -} - -// ____ XUnoTunnel ____ -sal_Int64 UndoManager::getSomething( const Sequence< sal_Int8 >& rId ) - throw (uno::RuntimeException) -{ - if ( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) - { - return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) ); - } - return 0; -} - -const Sequence< sal_Int8 >& UndoManager::getUnoTunnelId() -{ - static Sequence< sal_Int8 >* pSeq = 0; - if( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -UndoManager* UndoManager::getImplementation( const Reference< uno::XInterface > xObj ) -{ - UndoManager* pRet = NULL; - Reference< lang::XUnoTunnel > xUT( xObj, uno::UNO_QUERY ); - if ( xUT.is() ) - { - pRet = reinterpret_cast< UndoManager* >( sal::static_int_cast< sal_IntPtr >( xUT->getSomething( getUnoTunnelId() ) ) ); - } - return pRet; -} - -} // namespace chart - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/main/_serviceregistration_controller.cxx b/chart2/source/controller/main/_serviceregistration_controller.cxx index 26576d026b46..40be8ac313fa 100644 --- a/chart2/source/controller/main/_serviceregistration_controller.cxx +++ b/chart2/source/controller/main/_serviceregistration_controller.cxx @@ -109,13 +109,6 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, g_entries_chart2_controller ); -} -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk index 729276d5bd0e..557d6cf6216f 100644 --- a/chart2/source/controller/main/makefile.mk +++ b/chart2/source/controller/main/makefile.mk @@ -72,12 +72,9 @@ SLOFILES = \ $(SLO)$/DrawCommandDispatch.obj \ $(SLO)$/ShapeController.obj \ $(SLO)$/ShapeToolbarController.obj \ - $(SLO)$/ImplUndoManager.obj \ - $(SLO)$/UndoManager.obj \ - $(SLO)$/UndoGuard.obj - -# $(SLO)$/CommonConverters.obj \ -# $(SLO)$/Scaling.obj \ + $(SLO)$/UndoActions.obj \ + $(SLO)$/UndoGuard.obj \ + $(SLO)$/ChartModelClone.obj \ # --- Targets ----------------------------------------------------------------- diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk index daaae0af0323..dc3ed778b3c8 100644 --- a/chart2/source/controller/makefile.mk +++ b/chart2/source/controller/makefile.mk @@ -109,11 +109,10 @@ DEF1NAME= $(SHL1TARGET) # --- Resources --------------------------------------------------------------- -# sfx.srs is needed for the strings for UNDO and REDO in the UndoCommandDispatch RESLIB1LIST=\ $(SRS)$/chcdialogs.srs \ $(SRS)$/chcmenus.srs \ - $(SOLARCOMMONRESDIR)$/sfx.srs + RESLIB1NAME= $(TARGET) RESLIB1IMAGES=$(PRJ)$/res @@ -123,3 +122,11 @@ RESLIB1DEPN=$(RESLIB1LIST) # --- Targets ----------------------------------------------------------------- .INCLUDE: target.mk + +ALLTAR : $(MISC)/chartcontroller.component + +$(MISC)/chartcontroller.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt chartcontroller.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt chartcontroller.component |