diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 16:28:19 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 16:28:19 +0000 |
commit | 9233bae32b8fcac1f968d4ee321298a8686f72a6 (patch) | |
tree | 0b1b215e17e2c10b3cb129344ed43258e52ae8bf /chart2/source/controller/dialogs/DialogModel.hxx | |
parent | 4fe43c99c5dd7796108f81dcc523e802d87ad684 (diff) |
INTEGRATION: CWS chart2mst3 (1.1.2); FILE ADDED
2007/02/27 16:27:59 bm 1.1.2.20: #i71233# disable dialog commit when there are invalid ranges or series with missing mandatory roles
2007/02/27 13:45:31 bm 1.1.2.19: Disable controls and tabs when invalid ranges were entered
2007/02/26 13:20:32 bm 1.1.2.18: use different foreground and background for invalid ranges, like in Firefox.
2006/12/13 14:38:18 bm 1.1.2.17: correct order of roles data dialog
2006/12/12 18:04:10 bm 1.1.2.16: #i71666# show categories also for scatter charts, as data labels
2006/11/10 21:03:05 iha 1.1.2.15: prevent immidiate redraw in wizard and according dialogs (important for charts with many data)
2006/10/27 11:26:51 bm 1.1.2.14: allow to add a categories range when there were no categories before
2006/10/25 11:24:10 bm 1.1.2.13: allow setting previously unset sequences, e.g. labels at data series with external data provider
2006/07/19 15:55:24 bm 1.1.2.12: #i64824# improvement of the data editor for internal data. Especially the handling of flexible data and series with more than one role
2006/04/22 11:12:11 iha 1.1.2.11: park unused categories in scale with AxisType not being CATEGORY
2006/03/17 13:26:09 bm 1.1.2.10: +allArgumentsForRectRangeDetected
2005/11/14 17:56:31 iha 1.1.2.9: removed superfluous method restore - undo is done outside of the dialog
2005/11/11 18:45:22 iha 1.1.2.8: move only compatible series
2005/11/11 13:56:56 iha 1.1.2.7: remove direct view update call
2005/11/11 13:45:01 iha 1.1.2.6: guard DataRange Dialog against to many view updates
2005/10/11 09:20:05 bm 1.1.2.5: license header change
2005/05/12 13:56:39 bm 1.1.2.4: API change XDataProvider
2005/05/09 09:50:55 bm 1.1.2.3: moved parts of API to data namespace
2005/04/19 14:34:40 bm 1.1.2.2: fixing the data source/range chooser dialogs
2005/04/15 14:47:23 bm 1.1.2.1: helpers for data source dialogs
Diffstat (limited to 'chart2/source/controller/dialogs/DialogModel.hxx')
-rw-r--r-- | chart2/source/controller/dialogs/DialogModel.hxx | 230 |
1 files changed, 230 insertions, 0 deletions
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx new file mode 100644 index 000000000000..9871270ed439 --- /dev/null +++ b/chart2/source/controller/dialogs/DialogModel.hxx @@ -0,0 +1,230 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: DialogModel.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-05-22 17:28:19 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef CHART2_DIALOGMODEL_HXX +#define CHART2_DIALOGMODEL_HXX + +#include "TimerTriggeredControllerLock.hxx" + +#ifndef _COM_SUN_STAR_CHART2_XCHARTDOCUMENT_HPP_ +#include <com/sun/star/chart2/XChartDocument.hpp> +#endif +#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ +#include <com/sun/star/frame/XModel.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ +#include <com/sun/star/uno/XComponentContext.hpp> +#endif + +#include <vector> +#include <map> +#include <boost/shared_ptr.hpp> + +namespace com { namespace sun { namespace star { namespace chart2 { + class XDataSeriesContainer; + class XDataSeries; + class XChartType; + class XChartTypeTemplate; + struct InterpretedData; + namespace data { + class XDataProvider; + class XLabeledDataSequence; + } +}}}} + +namespace chart +{ + +class RangeSelectionHelper; + +class DialogModel +{ +public: + explicit DialogModel( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDocument, + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + ~DialogModel(); + + typedef ::std::pair< + ::rtl::OUString, + ::std::pair< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >, + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > > > + tSeriesWithChartTypeByName; + + typedef ::std::map< ::rtl::OUString, ::rtl::OUString > + tRolesWithRanges; + + void setTemplate( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartTypeTemplate > & xTemplate ); + + ::boost::shared_ptr< RangeSelectionHelper > + getRangeSelectionHelper() const throw(); + + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > + getChartModel() const throw(); + + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataProvider > + getDataProvider() const throw(); + + ::std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeriesContainer > > + getAllDataSeriesContainers() const throw(); + + ::std::vector< tSeriesWithChartTypeByName > + getAllDataSeriesWithLabel() const throw(); + + tRolesWithRanges getRolesWithRanges( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::rtl::OUString & aRoleOfSequenceForLabel, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > & xChartType ); + + enum eMoveDirection + { + MOVE_DOWN, + MOVE_UP + }; + + void moveSeries( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + eMoveDirection eDirection ); + + /// @return the newly inserted series + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > insertSeriesAfter( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > & xChartType, + bool bCreateDataCachedSequences = false ) throw(); + + void deleteSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > & xChartType ) throw(); + + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > + getCategories() const throw(); + + void setCategories( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > & xCategories ); + + ::rtl::OUString getCategoriesRange() const throw(); + + bool isCategoryDiagram() const throw(); + + void detectArguments( + ::rtl::OUString & rOutRangeString, + bool & rOutUseColumns, bool & rOutFirstCellAsLabel, bool & rOutHasCategories ) const throw(); + + bool allArgumentsForRectRangeDetected() const; + + bool setData( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > & rArguments ) throw(); + + void startControllerLockTimer(); + + /** Applies the content of xSource to xDestination. As a result + xDestination is a copy of xSource, but maintains its identity. + (Something like a flat assignment operator) + */ + static void restoreModel( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xSource, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xDestination ); + + static ::rtl::OUString ConvertRoleFromInternalToUI( const ::rtl::OUString & rRoleString ); + static ::rtl::OUString ConvertRoleFromUIToInternal( const ::rtl::OUString & rRoleString ); + static ::rtl::OUString GetRoleDataLabel(); + + // pass a role string (not translated) and get an index that serves for + // relative ordering, to get e.g. x-values and y-values in the right order + static sal_Int32 GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString ); + + static bool isSeriesValid( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::rtl::OUString & aRoleOfSequenceForLabel, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > & xChartType ); + +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > + 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; + + ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > + m_xContext; + + mutable ::boost::shared_ptr< RangeSelectionHelper > + m_spRangeSelectionHelper; + + TimerTriggeredControllerLock m_aTimerTriggeredControllerLock; + +private: + void createBackup(); + + void applyInterpretedData( + const ::com::sun::star::chart2::InterpretedData & rNewData, + const ::std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > & rSeriesToReUse, + bool bSetStyles ); + + sal_Int32 countSeries() const; +}; + +} // namespace chart + +// CHART2_DIALOGMODEL_HXX +#endif |