View | Details | Raw Unified | Return to issue 63017
Collapse All | Expand All

(-)controller/main/CommandDispatch.cxx (-1 / +1 lines)
Lines 146-162 void CommandDispatch::fireAllStatusEvent Link Here
146
    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener )
146
    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener )
147
{
147
{
148
    fireStatusEvent( OUString(), xSingleListener );
148
    fireStatusEvent( OUString(), xSingleListener );
149
}
149
}
150
150
151
void CommandDispatch::fireStatusEventForURL(
151
void CommandDispatch::fireStatusEventForURL(
152
    const OUString & rURL,
152
    const OUString & rURL,
153
    const uno::Any & rState,
153
    const uno::Any & rState,
154
    sal_Bool bEnabled,
154
    bool bEnabled,
155
    const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
155
    const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
156
{
156
{
157
    // prepare event to send
157
    // prepare event to send
158
    util::URL aURL;
158
    util::URL aURL;
159
    aURL.Complete = rURL;
159
    aURL.Complete = rURL;
160
    if( !m_xURLTransformer.is())
160
    if( !m_xURLTransformer.is())
161
    {
161
    {
162
        m_xURLTransformer.set(
162
        m_xURLTransformer.set(
(-)controller/main/CommandDispatch.hxx (-1 / +1 lines)
Lines 116-132 protected: Link Here
116
        @param xSingleListener
116
        @param xSingleListener
117
            If set, the event is only sent to this listener rather than to all
117
            If set, the event is only sent to this listener rather than to all
118
            registered ones.  Whenever a listener adds itself, this method is
118
            registered ones.  Whenever a listener adds itself, this method is
119
            called with this parameter set to give an initial state.
119
            called with this parameter set to give an initial state.
120
     */
120
     */
121
    void fireStatusEventForURL(
121
    void fireStatusEventForURL(
122
        const ::rtl::OUString & rURL,
122
        const ::rtl::OUString & rURL,
123
        const ::com::sun::star::uno::Any & rState,
123
        const ::com::sun::star::uno::Any & rState,
124
        sal_Bool bEnabled,
124
        bool bEnabled,
125
        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener =
125
        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener =
126
            ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >() );
126
            ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >() );
127
127
128
    // ____ XDispatch ____
128
    // ____ XDispatch ____
129
    virtual void SAL_CALL dispatch(
129
    virtual void SAL_CALL dispatch(
130
        const ::com::sun::star::util::URL& URL,
130
        const ::com::sun::star::util::URL& URL,
131
        const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
131
        const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments )
132
        throw (::com::sun::star::uno::RuntimeException);
132
        throw (::com::sun::star::uno::RuntimeException);
(-)controller/main/ControllerCommandDispatch.cxx (-98 / +244 lines)
Lines 44-75 Link Here
44
#include <com/sun/star/util/XModifyBroadcaster.hpp>
44
#include <com/sun/star/util/XModifyBroadcaster.hpp>
45
#endif
45
#endif
46
#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
46
#ifndef _COM_SUN_STAR_FRAME_XSTORABLE_HPP_
47
#include <com/sun/star/frame/XStorable.hpp>
47
#include <com/sun/star/frame/XStorable.hpp>
48
#endif
48
#endif
49
#ifndef _COM_SUN_STAR_CHART2_XCHARTDOCUMENT_HPP_
49
#ifndef _COM_SUN_STAR_CHART2_XCHARTDOCUMENT_HPP_
50
#include <com/sun/star/chart2/XChartDocument.hpp>
50
#include <com/sun/star/chart2/XChartDocument.hpp>
51
#endif
51
#endif
52
#ifndef _COM_SUN_STAR_CHART2_XDATASERIES_HPP_
53
#include <com/sun/star/chart2/XDataSeries.hpp>
54
#endif
55
52
56
53
using namespace ::com::sun::star;
57
using namespace ::com::sun::star;
54
58
55
using ::com::sun::star::uno::Reference;
59
using ::com::sun::star::uno::Reference;
56
using ::com::sun::star::uno::Sequence;
60
using ::com::sun::star::uno::Sequence;
57
using ::rtl::OUString;
61
using ::rtl::OUString;
58
62
59
namespace chart
63
namespace chart
60
{
64
{
61
65
62
// ----------------------------------------
66
// ----------------------------------------
63
67
64
namespace impl
68
namespace impl
65
{
69
{
66
70
67
/** Represents the current state of the model.
71
		/**
72
		 * Declaring constants for moving the series.
73
		 * 
74
		 */
75
		enum EnumForward{ 
76
				MOVE_SERIES_FORWARD = true,
77
				MOVE_SERIES_BACKWARD = false
78
		};
79
		
80
		/**
81
		 * Represents the current state of the controller (needed for issue
82
		 * 63017).
83
		 *
84
		 * You can set the state by calling update().  After this call the state
85
		 * is preserved in this class until the next call to update().
86
		 *
87
		 * This is useful, not to say necessary, for enabling and disabling of
88
		 * menu entries (format>arrangement). As the status requests are sent very
89
		 * frequently it would be impossible, from a performance point of view, to
90
		 * query the current status every time directly at the model.  So this
91
		 * class serves as a cache for the state.
92
		 *
93
		 */
94
		struct ControllerState
95
		{ 
96
				ControllerState( const Reference< frame::XController > & xController );
97
				
98
				void update( const Reference< frame::XModel > & xModel );
99
100
				// -- State variables -------
101
				
102
				bool bHasSelectedObject;
103
				bool bIsDraggableObject;
104
				
105
				// May the selected series be moved forward or backward (cf
106
				// format>arrangement).
107
				bool bMayMoveSeriesForward;
108
				bool bMayMoveSeriesBackward;
109
110
			private:
111
				
112
				::com::sun::star::uno::Reference<
113
						::com::sun::star::frame::XController > m_xController;
114
115
		};
116
117
118
		ControllerState::ControllerState(
119
				const Reference< frame::XController > & xController	) :
120
				m_xController( xController ),
121
				bHasSelectedObject( false ),
122
				bIsDraggableObject( false ),
123
				bMayMoveSeriesForward( false ),
124
				bMayMoveSeriesBackward( false )
125
		{
126
		}
127
128
129
		void ControllerState::update( const Reference< frame::XModel > & xModel )
130
		{
131
132
				OSL_TRACE( "\nControllerState Updated -------------------------" );
133
				
134
				::com::sun::star::uno::Reference<
135
						::com::sun::star::view::XSelectionSupplier >
136
						m_xSelectionSupplier( m_xController, uno::UNO_QUERY );
137
138
				::rtl::OUString aSelObjCID;
139
				
140
				// Update ControllerState variables.
141
				if( m_xSelectionSupplier.is())
142
				{
143
						uno::Any aSelObj( m_xSelectionSupplier->getSelection() );
144
145
						bHasSelectedObject = ((aSelObj >>= aSelObjCID) && aSelObjCID.getLength() > 0);
146
147
						bIsDraggableObject = ObjectIdentifier::isDragableObject( aSelObjCID );
148
						
149
						uno::Reference< ::com::sun::star::chart2::XDataSeries > xGivenDataSeries( 
150
								ObjectIdentifier::getDataSeriesForCID( 
151
										aSelObjCID, xModel ) );
152
153
						bMayMoveSeriesForward = DiagramHelper::isSeriesMoveable( 
154
								ChartModelHelper::findDiagram( xModel ),
155
								xGivenDataSeries,
156
								MOVE_SERIES_FORWARD );
157
158
						bMayMoveSeriesBackward = DiagramHelper::isSeriesMoveable( 
159
								ChartModelHelper::findDiagram( xModel ),
160
								xGivenDataSeries,
161
								MOVE_SERIES_BACKWARD);
162
163
						
164
						// TODO : debug only
165
						if ( bIsDraggableObject )
166
								OSL_TRACE( "Draggable Object");
167
168
				}
169
170
		}
171
172
		
173
174
		/** Represents the current state of the model.
68
175
69
    You can set the state by calling update().  After this call the state is
176
    You can set the state by calling update().  After this call the state is
70
    preserved in this class until the next call to update().
177
    preserved in this class until the next call to update().
71
178
72
    This is useful, not to say necessary, for enabling and disabling of menu
179
    This is useful, not to say necessary, for enabling and disabling of menu
73
    entries and toolbar icons.  As the status requests are sent very frequently
180
    entries and toolbar icons.  As the status requests are sent very frequently
74
    it would be impossible, from a performance point of view, to query the
181
    it would be impossible, from a performance point of view, to query the
75
    current status every time directly at the model.  So this class serves as a
182
    current status every time directly at the model.  So this class serves as a
Lines 80-150 struct ModelState Link Here
80
    ModelState();
187
    ModelState();
81
188
82
    void update( const Reference< frame::XModel > & xModel );
189
    void update( const Reference< frame::XModel > & xModel );
83
190
84
    bool HasAnyAxis() const;
191
    bool HasAnyAxis() const;
85
    bool HasAnyGrid() const;
192
    bool HasAnyGrid() const;
86
    bool HasAnyTitle() const;
193
    bool HasAnyTitle() const;
87
194
88
    sal_Bool bIsReadOnly;
195
    bool bIsReadOnly;
89
    sal_Bool bIsThreeD;
196
    bool bIsThreeD;
90
    sal_Bool bHasOwnData;
197
    bool bHasOwnData;
91
198
92
    sal_Bool bHasMainTitle;
199
    bool bHasMainTitle;
93
    sal_Bool bHasSubTitle;
200
    bool bHasSubTitle;
94
    sal_Bool bHasXAxisTitle;
201
    bool bHasXAxisTitle;
95
    sal_Bool bHasYAxisTitle;
202
    bool bHasYAxisTitle;
96
    sal_Bool bHasZAxisTitle;
203
    bool bHasZAxisTitle;
97
204
98
    sal_Bool bHasXAxis;
205
    bool bHasXAxis;
99
    sal_Bool bHasYAxis;
206
    bool bHasYAxis;
100
    sal_Bool bHasZAxis;
207
    bool bHasZAxis;
101
    sal_Bool bHasAAxis;
208
    bool bHasAAxis;
102
    sal_Bool bHasBAxis;
209
    bool bHasBAxis;
103
210
104
    sal_Bool bHasMainXGrid;
211
    bool bHasMainXGrid;
105
    sal_Bool bHasMainYGrid;
212
    bool bHasMainYGrid;
106
    sal_Bool bHasMainZGrid;
213
    bool bHasMainZGrid;
107
    sal_Bool bHasHelpXGrid;
214
    bool bHasHelpXGrid;
108
    sal_Bool bHasHelpYGrid;
215
    bool bHasHelpYGrid;
109
    sal_Bool bHasHelpZGrid;
216
    bool bHasHelpZGrid;
217
218
    bool bHasAutoScaledText;
110
219
111
    sal_Bool bHasAutoScaledText;
112
};
220
};
113
221
114
ModelState::ModelState() :
222
ModelState::ModelState() :
115
        bIsReadOnly( sal_True ),
223
        bIsReadOnly( true ),
116
        bIsThreeD( sal_False ),
224
        bIsThreeD( false ),
117
        bHasOwnData( sal_False ),
225
        bHasOwnData( false ),
118
        bHasMainTitle( sal_False ),
226
        bHasMainTitle( false ),
119
        bHasSubTitle( sal_False ),
227
        bHasSubTitle( false ),
120
        bHasXAxisTitle( sal_False ),
228
        bHasXAxisTitle( false ),
121
        bHasYAxisTitle( sal_False ),
229
        bHasYAxisTitle( false ),
122
        bHasZAxisTitle( sal_False ),
230
        bHasZAxisTitle( false ),
123
        bHasXAxis( sal_False ),
231
        bHasXAxis( false ),
124
        bHasYAxis( sal_False ),
232
        bHasYAxis( false ),
125
        bHasZAxis( sal_False ),
233
        bHasZAxis( false ),
126
        bHasAAxis( sal_False ),
234
        bHasAAxis( false ),
127
        bHasBAxis( sal_False ),
235
        bHasBAxis( false ),
128
        bHasMainXGrid( sal_False ),
236
        bHasMainXGrid( false ),
129
        bHasMainYGrid( sal_False ),
237
        bHasMainYGrid( false ),
130
        bHasMainZGrid( sal_False ),
238
        bHasMainZGrid( false ),
131
        bHasHelpXGrid( sal_False ),
239
        bHasHelpXGrid( false ),
132
        bHasHelpYGrid( sal_False ),
240
        bHasHelpYGrid( false ),
133
        bHasHelpZGrid( sal_False ),
241
        bHasHelpZGrid( false ),
134
        bHasAutoScaledText( sal_False )
242
        bHasAutoScaledText( false )
135
{}
243
{}
136
244
137
void ModelState::update( const Reference< frame::XModel > & xModel )
245
void ModelState::update( const Reference< frame::XModel > & xModel )
138
{
246
{
139
    Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
247
    Reference< chart2::XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
140
    Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
248
    Reference< chart2::XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ));
141
249
142
    bIsReadOnly = sal_True;
250
    bIsReadOnly = true;
143
    Reference< frame::XStorable > xStorable( xModel, uno::UNO_QUERY );
251
    Reference< frame::XStorable > xStorable( xModel, uno::UNO_QUERY );
144
    if( xStorable.is())
252
    if( xStorable.is())
145
        bIsReadOnly = xStorable->isReadonly();
253
        bIsReadOnly = xStorable->isReadonly();
146
254
147
    bIsThreeD = (DiagramHelper::getDimension( xDiagram ) == 3);
255
    bIsThreeD = (DiagramHelper::getDimension( xDiagram ) == 3);
148
    bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider());
256
    bHasOwnData = (xChartDoc.is() && xChartDoc->hasInternalDataProvider());
149
257
150
    bHasMainTitle =  TitleHelper::getTitle( TitleHelper::MAIN_TITLE, xModel ).is();
258
    bHasMainTitle =  TitleHelper::getTitle( TitleHelper::MAIN_TITLE, xModel ).is();
Lines 164-179 void ModelState::update( const Reference Link Here
164
    bHasMainZGrid = AxisHelper::isGridShown( 2, 0, true, xDiagram );
272
    bHasMainZGrid = AxisHelper::isGridShown( 2, 0, true, xDiagram );
165
    bHasHelpXGrid = AxisHelper::isGridShown( 0, 0, false, xDiagram );
273
    bHasHelpXGrid = AxisHelper::isGridShown( 0, 0, false, xDiagram );
166
    bHasHelpYGrid = AxisHelper::isGridShown( 1, 0, false, xDiagram );
274
    bHasHelpYGrid = AxisHelper::isGridShown( 1, 0, false, xDiagram );
167
    bHasHelpZGrid = AxisHelper::isGridShown( 2, 0, false, xDiagram );
275
    bHasHelpZGrid = AxisHelper::isGridShown( 2, 0, false, xDiagram );
168
276
169
    bHasAutoScaledText =
277
    bHasAutoScaledText =
170
        (ReferenceSizeProvider::getAutoResizeState( xChartDoc ) ==
278
        (ReferenceSizeProvider::getAutoResizeState( xChartDoc ) ==
171
         ReferenceSizeProvider::AUTO_RESIZE_YES);
279
         ReferenceSizeProvider::AUTO_RESIZE_YES);
280
172
}
281
}
173
282
174
bool ModelState::HasAnyAxis() const
283
bool ModelState::HasAnyAxis() const
175
{
284
{
176
    return bHasXAxis || bHasYAxis || bHasZAxis || bHasAAxis || bHasBAxis;
285
    return bHasXAxis || bHasYAxis || bHasZAxis || bHasAAxis || bHasBAxis;
177
}
286
}
178
287
179
bool ModelState::HasAnyGrid() const
288
bool ModelState::HasAnyGrid() const
Lines 189-285 bool ModelState::HasAnyTitle() const Link Here
189
298
190
} // namespace impl
299
} // namespace impl
191
300
192
// ----------------------------------------
301
// ----------------------------------------
193
302
194
ControllerCommandDispatch::ControllerCommandDispatch(
303
ControllerCommandDispatch::ControllerCommandDispatch(
195
    const Reference< uno::XComponentContext > & xContext,
304
    const Reference< uno::XComponentContext > & xContext,
196
    const Reference< frame::XController > & xController ) :
305
    const Reference< frame::XController > & xController ) :
197
        CommandDispatch( xContext ),
306
        impl::ControllerCommandDispatch_Base( xContext ),
198
        m_xController( xController ),
307
        m_xController( xController ),
199
        m_xSelectionSupplier( xController, uno::UNO_QUERY ),
308
        m_xSelectionSupplier( xController, uno::UNO_QUERY ),
200
        m_xDispatch( xController, uno::UNO_QUERY ),
309
        m_xDispatch( xController, uno::UNO_QUERY ),
201
        m_apModelState( new impl::ModelState())
310
        m_apModelState( new impl::ModelState() ),
311
				m_apControllerState( new impl::ControllerState( xController ) )
202
{}
312
{}
203
313
204
ControllerCommandDispatch::~ControllerCommandDispatch()
314
ControllerCommandDispatch::~ControllerCommandDispatch()
205
{}
315
{}
206
316
207
void ControllerCommandDispatch::initialize()
317
void ControllerCommandDispatch::initialize()
208
{
318
{
209
    if( m_xController.is())
319
    if( m_xController.is())
210
    {
320
    {
211
        Reference< frame::XModel > xModel( m_xController->getModel());
321
        Reference< frame::XModel > xModel( m_xController->getModel());
212
        Reference< util::XModifyBroadcaster > xModifyBroadcaster( xModel, uno::UNO_QUERY );
322
        Reference< util::XModifyBroadcaster > xModifyBroadcaster( xModel, uno::UNO_QUERY );
213
        OSL_ASSERT( xModifyBroadcaster.is());
323
        OSL_ASSERT( xModifyBroadcaster.is());
214
        if( xModifyBroadcaster.is())
324
        if( xModifyBroadcaster.is())
215
            xModifyBroadcaster->addModifyListener( this );
325
            xModifyBroadcaster->addModifyListener( this );
326
327
				// Listen selection modifications (Arrangement feature - issue 63017).
328
				if( m_xSelectionSupplier.is() )
329
						m_xSelectionSupplier->addSelectionChangeListener( this );
330
				
216
        if( m_apModelState.get() && xModel.is())
331
        if( m_apModelState.get() && xModel.is())
217
            m_apModelState->update( xModel );
332
            m_apModelState->update( xModel );
333
334
        if( m_apControllerState.get() && xModel.is())
335
            m_apControllerState->update( xModel );
336
				
218
    }
337
    }
219
}
338
}
220
339
221
void ControllerCommandDispatch::conditionalFireStatusEventForURL(
340
void ControllerCommandDispatch::conditionalFireStatusEventForURL(
222
        const OUString & rCompareURL,
341
        const OUString & rCompareURL,
223
        const OUString & rURL,
342
        const OUString & rURL,
224
        const uno::Any & rState,
343
        const uno::Any & rState,
225
        sal_Bool bEnabled,
344
        bool bEnabled,
226
        const Reference< frame::XStatusListener > & xSingleListener )
345
        const Reference< frame::XStatusListener > & xSingleListener )
227
{
346
{
228
    if( rCompareURL.getLength() == 0 ||
347
    if( rCompareURL.getLength() == 0 ||
229
        rURL.equals( rCompareURL ))
348
        rURL.equals( rCompareURL ))
230
    {
349
    {
231
        fireStatusEventForURL( rURL, rState, bEnabled, xSingleListener );
350
        fireStatusEventForURL( rURL, rState, bEnabled, xSingleListener );
232
    }
351
    }
233
}
352
}
234
353
235
void ControllerCommandDispatch::fireStatusEvent(
354
void ControllerCommandDispatch::fireStatusEvent(
236
    const OUString & rURL,
355
    const OUString & rURL,
237
    const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
356
    const Reference< frame::XStatusListener > & xSingleListener /* = 0 */ )
238
{
357
{
239
    uno::Any aEmptyArg;
358
    uno::Any aEmptyArg;
240
359
241
    // readonly
360
    // readonly
242
    sal_Bool bIsWritable = ! m_apModelState->bIsReadOnly;
361
    bool bIsWritable = ! m_apModelState->bIsReadOnly;
243
    // selection
362
    
244
    sal_Bool bHasSelectedObject = sal_False;
363
		// selection
245
    OUString aSelObjCID;
364
    bool bHasSelectedObject = false;
246
    if( m_xSelectionSupplier.is())
365
		
247
    {
366
		// Model and controller exist.
248
        uno::Any aSelObj( m_xSelectionSupplier->getSelection());
367
		OSL_ASSERT( m_apModelState.get() );
249
        bHasSelectedObject = ((aSelObj >>= aSelObjCID) && aSelObjCID.getLength() > 0);
368
		OSL_ASSERT( m_apControllerState.get() );
250
    }
369
		
251
370
		bool bModelStateIsValid = ( m_apModelState.get() != 0 );
371
		bool bControllerStateIsValid = ( m_apControllerState.get() != 0 );
372
		
373
		
252
    // base commands (offered by all apps)
374
    // base commands (offered by all apps)
253
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Save"), aEmptyArg, bIsWritable, xSingleListener );
375
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Save"), aEmptyArg, bIsWritable, xSingleListener );
254
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SaveAs"), aEmptyArg, bIsWritable, xSingleListener );
376
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SaveAs"), aEmptyArg, bIsWritable, xSingleListener );
255
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SaveAll"), aEmptyArg, bIsWritable, xSingleListener );
377
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SaveAll"), aEmptyArg, bIsWritable, xSingleListener );
256
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Close"), aEmptyArg, sal_True, xSingleListener );
378
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Close"), aEmptyArg, true, xSingleListener );
257
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Cut"), aEmptyArg, bIsWritable && bHasSelectedObject, xSingleListener );
379
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Cut"), aEmptyArg, bIsWritable && bHasSelectedObject, xSingleListener );
258
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Copy"), aEmptyArg, bHasSelectedObject, xSingleListener );
380
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Copy"), aEmptyArg, bHasSelectedObject, xSingleListener );
259
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Paste"), aEmptyArg, bIsWritable, xSingleListener );
381
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Paste"), aEmptyArg, bIsWritable, xSingleListener );
260
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SelectAll"), aEmptyArg, sal_True, xSingleListener );
382
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SelectAll"), aEmptyArg, true, xSingleListener );
261
383
262
384
263
    // toolbar commands
385
    // toolbar commands
264
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleTitle"), aEmptyArg, bIsWritable, xSingleListener );
386
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleTitle"), aEmptyArg, bIsWritable, xSingleListener );
265
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleLegend"), aEmptyArg, bIsWritable, xSingleListener );
387
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleLegend"), aEmptyArg, bIsWritable, xSingleListener );
266
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleAxisTitle"), aEmptyArg, bIsWritable, xSingleListener );
388
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleAxisTitle"), aEmptyArg, bIsWritable, xSingleListener );
267
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleAxisDescr"), aEmptyArg, bIsWritable, xSingleListener );
389
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleAxisDescr"), aEmptyArg, bIsWritable, xSingleListener );
268
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleGridHorizontal"), aEmptyArg, bIsWritable, xSingleListener );
390
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleGridHorizontal"), aEmptyArg, bIsWritable, xSingleListener );
269
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleGridVertical"), aEmptyArg, bIsWritable, xSingleListener );
391
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ToggleGridVertical"), aEmptyArg, bIsWritable, xSingleListener );
270
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataInRows"), aEmptyArg, bIsWritable, xSingleListener );
392
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataInRows"), aEmptyArg, bIsWritable, xSingleListener );
271
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataInColumns"), aEmptyArg, bIsWritable, xSingleListener );
393
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataInColumns"), aEmptyArg, bIsWritable, xSingleListener );
272
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ContextType"), aEmptyArg, bIsWritable, xSingleListener );
394
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ContextType"), aEmptyArg, bIsWritable, xSingleListener );
273
    conditionalFireStatusEventForURL( rURL, C2U(".uno:NewArrangement"), aEmptyArg, bIsWritable, xSingleListener );
395
    conditionalFireStatusEventForURL( rURL, C2U(".uno:NewArrangement"), aEmptyArg, bIsWritable, xSingleListener );
274
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Update"), aEmptyArg, bIsWritable, xSingleListener );
396
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Update"), aEmptyArg, bIsWritable, xSingleListener );
275
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ScaleText"),
276
                           uno::makeAny( m_apModelState->bHasAutoScaledText ),
277
                           bIsWritable, xSingleListener );
278
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataDescriptionType"), aEmptyArg, bIsWritable, xSingleListener );
397
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataDescriptionType"), aEmptyArg, bIsWritable, xSingleListener );
279
    conditionalFireStatusEventForURL( rURL, C2U(".uno:LegendPosition"), aEmptyArg, bIsWritable, xSingleListener );
398
    conditionalFireStatusEventForURL( rURL, C2U(".uno:LegendPosition"), aEmptyArg, bIsWritable, xSingleListener );
280
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DefaultColors"), aEmptyArg, bIsWritable, xSingleListener );
399
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DefaultColors"), aEmptyArg, bIsWritable, xSingleListener );
281
    conditionalFireStatusEventForURL( rURL, C2U(".uno:BarWidth"), aEmptyArg, bIsWritable, xSingleListener );
400
    conditionalFireStatusEventForURL( rURL, C2U(".uno:BarWidth"), aEmptyArg, bIsWritable, xSingleListener );
282
    conditionalFireStatusEventForURL( rURL, C2U(".uno:NumberOfLines"), aEmptyArg, bIsWritable, xSingleListener );
401
    conditionalFireStatusEventForURL( rURL, C2U(".uno:NumberOfLines"), aEmptyArg, bIsWritable, xSingleListener );
283
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ArrangeRow"), aEmptyArg, bIsWritable, xSingleListener );
402
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ArrangeRow"), aEmptyArg, bIsWritable, xSingleListener );
284
403
285
    // insert objects
404
    // insert objects
Lines 291-355 void ControllerCommandDispatch::fireStat Link Here
291
    conditionalFireStatusEventForURL( rURL, C2U(".uno:InsertStatistics"), aEmptyArg, bIsWritable, xSingleListener );
410
    conditionalFireStatusEventForURL( rURL, C2U(".uno:InsertStatistics"), aEmptyArg, bIsWritable, xSingleListener );
292
    conditionalFireStatusEventForURL( rURL, C2U(".uno:InsertSymbol"), aEmptyArg, bIsWritable, xSingleListener );
411
    conditionalFireStatusEventForURL( rURL, C2U(".uno:InsertSymbol"), aEmptyArg, bIsWritable, xSingleListener );
293
412
294
    // format objects
413
    // format objects
295
//MENUCHANGE    conditionalFireStatusEventForURL( rURL, C2U(".uno:SelectSourceRanges"), aEmptyArg, bIsWritable, xSingleListener );
414
//MENUCHANGE    conditionalFireStatusEventForURL( rURL, C2U(".uno:SelectSourceRanges"), aEmptyArg, bIsWritable, xSingleListener );
296
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramObjects"), aEmptyArg, bIsWritable && bHasSelectedObject, xSingleListener );
415
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramObjects"), aEmptyArg, bIsWritable && bHasSelectedObject, xSingleListener );
297
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramType"), aEmptyArg, bIsWritable, xSingleListener );
416
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramType"), aEmptyArg, bIsWritable, xSingleListener );
298
    conditionalFireStatusEventForURL( rURL, C2U(".uno:AutoFormat"), aEmptyArg, bIsWritable, xSingleListener );
417
    conditionalFireStatusEventForURL( rURL, C2U(".uno:AutoFormat"), aEmptyArg, bIsWritable, xSingleListener );
299
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Forward"), aEmptyArg, bIsWritable, xSingleListener );
300
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Backward"), aEmptyArg, bIsWritable, xSingleListener );
301
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Legend"), aEmptyArg, bIsWritable, xSingleListener );
418
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Legend"), aEmptyArg, bIsWritable, xSingleListener );
302
303
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramWall"), aEmptyArg, bIsWritable, xSingleListener );
419
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramWall"), aEmptyArg, bIsWritable, xSingleListener );
304
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramArea"), aEmptyArg, bIsWritable, xSingleListener );
420
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramArea"), aEmptyArg, bIsWritable, xSingleListener );
421
    conditionalFireStatusEventForURL( rURL, C2U(".uno:TransformDialog"), aEmptyArg, bIsWritable && bHasSelectedObject && m_apControllerState->bIsDraggableObject, xSingleListener );
305
422
306
    conditionalFireStatusEventForURL( rURL, C2U(".uno:TransformDialog"), aEmptyArg,
423
    
307
                           bIsWritable && bHasSelectedObject && ObjectIdentifier::isDragableObject( aSelObjCID ),
424
		
308
                           xSingleListener );
425
		// Tests requiring that the Model State is valid ("bModelStateIsValid").
309
426
		
310
    OSL_ASSERT( m_apModelState.get());
311
    if( ! m_apModelState.get())
312
        bIsWritable = sal_False;
313
314
    // 3d commands
427
    // 3d commands
315
    conditionalFireStatusEventForURL( rURL, C2U(".uno:View3D"), aEmptyArg, bIsWritable && m_apModelState->bIsThreeD, xSingleListener );
428
		conditionalFireStatusEventForURL( rURL, C2U(".uno:View3D"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bIsThreeD, xSingleListener );
316
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramFloor"), aEmptyArg, bIsWritable && m_apModelState->bIsThreeD, xSingleListener );
429
		conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramFloor"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bIsThreeD, xSingleListener );
317
430
318
    // depending on own data
431
    // depending on own data
319
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataRanges"), aEmptyArg, ! m_apModelState->bHasOwnData, xSingleListener );
432
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DataRanges"), aEmptyArg, bIsWritable && bModelStateIsValid && (! m_apModelState->bHasOwnData), xSingleListener );
320
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramData"), aEmptyArg, m_apModelState->bHasOwnData, xSingleListener );
433
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramData"), aEmptyArg, bIsWritable && bModelStateIsValid &&  m_apModelState->bHasOwnData, xSingleListener );
321
434
322
    // titles
435
    // titles
323
    conditionalFireStatusEventForURL( rURL, C2U(".uno:MainTitle"), aEmptyArg, bIsWritable && m_apModelState->bHasMainTitle, xSingleListener );
436
    conditionalFireStatusEventForURL( rURL, C2U(".uno:MainTitle"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasMainTitle, xSingleListener );
324
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SubTitle"), aEmptyArg, bIsWritable && m_apModelState->bHasSubTitle, xSingleListener );
437
    conditionalFireStatusEventForURL( rURL, C2U(".uno:SubTitle"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasSubTitle, xSingleListener );
325
    conditionalFireStatusEventForURL( rURL, C2U(".uno:XTitle"), aEmptyArg, bIsWritable && m_apModelState->bHasXAxisTitle, xSingleListener );
438
    conditionalFireStatusEventForURL( rURL, C2U(".uno:XTitle"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasXAxisTitle, xSingleListener );
326
    conditionalFireStatusEventForURL( rURL, C2U(".uno:YTitle"), aEmptyArg, bIsWritable && m_apModelState->bHasYAxisTitle, xSingleListener );
439
    conditionalFireStatusEventForURL( rURL, C2U(".uno:YTitle"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasYAxisTitle, xSingleListener );
327
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ZTitle"), aEmptyArg, bIsWritable && m_apModelState->bHasZAxisTitle, xSingleListener );
440
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ZTitle"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasZAxisTitle, xSingleListener );
328
    conditionalFireStatusEventForURL( rURL, C2U(".uno:AllTitles"), aEmptyArg, bIsWritable && m_apModelState->HasAnyTitle(), xSingleListener );
441
    conditionalFireStatusEventForURL( rURL, C2U(".uno:AllTitles"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->HasAnyTitle(), xSingleListener );
442
443
		// text
444
    conditionalFireStatusEventForURL( rURL, C2U(".uno:ScaleText"), uno::makeAny( m_apModelState->bHasAutoScaledText ), bIsWritable && bModelStateIsValid , xSingleListener );
329
445
330
    // axes
446
    // axes
331
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisX"), aEmptyArg, bIsWritable && m_apModelState->bHasXAxis, xSingleListener );
447
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisX"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasXAxis, xSingleListener );
332
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisY"), aEmptyArg, bIsWritable && m_apModelState->bHasYAxis, xSingleListener );
448
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisY"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasYAxis, xSingleListener );
333
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisZ"), aEmptyArg, bIsWritable && m_apModelState->bHasZAxis, xSingleListener );
449
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisZ"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasZAxis, xSingleListener );
334
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisA"), aEmptyArg, bIsWritable && m_apModelState->bHasAAxis, xSingleListener );
450
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisA"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasAAxis, xSingleListener );
335
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisB"), aEmptyArg, bIsWritable && m_apModelState->bHasBAxis, xSingleListener );
451
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisB"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasBAxis, xSingleListener );
336
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisAll"), aEmptyArg, bIsWritable && m_apModelState->HasAnyAxis(), xSingleListener );
452
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramAxisAll"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->HasAnyAxis(), xSingleListener );
337
453
338
    // grids
454
    // grids
339
    // note: x and y are swapped in the commands!
455
    // note: x and y are swapped in the commands!
340
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridYMain"), aEmptyArg, bIsWritable && m_apModelState->bHasMainXGrid, xSingleListener );
456
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridYMain"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasMainXGrid, xSingleListener );
341
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridXMain"), aEmptyArg, bIsWritable && m_apModelState->bHasMainYGrid, xSingleListener );
457
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridXMain"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasMainYGrid, xSingleListener );
342
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridZMain"), aEmptyArg, bIsWritable && m_apModelState->bHasMainZGrid, xSingleListener );
458
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridZMain"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasMainZGrid, xSingleListener );
343
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridYHelp"), aEmptyArg, bIsWritable && m_apModelState->bHasHelpXGrid, xSingleListener );
459
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridYHelp"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpXGrid, xSingleListener );
344
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridXHelp"), aEmptyArg, bIsWritable && m_apModelState->bHasHelpYGrid, xSingleListener );
460
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridXHelp"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpYGrid, xSingleListener );
345
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridZHelp"), aEmptyArg, bIsWritable && m_apModelState->bHasHelpZGrid, xSingleListener );
461
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridZHelp"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->bHasHelpZGrid, xSingleListener );
346
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridAll"), aEmptyArg, bIsWritable && m_apModelState->HasAnyGrid(), xSingleListener );
462
    conditionalFireStatusEventForURL( rURL, C2U(".uno:DiagramGridAll"), aEmptyArg, bIsWritable && bModelStateIsValid && m_apModelState->HasAnyGrid(), xSingleListener );
347
463
464
465
		// Tests requiring that the Model State is valid ("bModelStateIsValid")
466
		// and that the Controller State ("bControllerStateIsValid") is valid.
467
468
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Forward"), aEmptyArg, bIsWritable && bModelStateIsValid && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesForward, xSingleListener );
469
		
470
    conditionalFireStatusEventForURL( rURL, C2U(".uno:Backward"), aEmptyArg, bIsWritable && bModelStateIsValid && bControllerStateIsValid && m_apControllerState->bMayMoveSeriesBackward, xSingleListener );
471
		
348
}
472
}
349
473
350
// ____ XDispatch ____
474
// ____ XDispatch ____
351
void SAL_CALL ControllerCommandDispatch::dispatch(
475
void SAL_CALL ControllerCommandDispatch::dispatch(
352
    const util::URL& URL,
476
    const util::URL& URL,
353
    const Sequence< beans::PropertyValue >& Arguments )
477
    const Sequence< beans::PropertyValue >& Arguments )
354
    throw (uno::RuntimeException)
478
    throw (uno::RuntimeException)
355
{
479
{
Lines 373-386 void SAL_CALL ControllerCommandDispatch: Link Here
373
    m_xDispatch.clear();
497
    m_xDispatch.clear();
374
    m_xSelectionSupplier.clear();
498
    m_xSelectionSupplier.clear();
375
}
499
}
376
500
377
// ____ XModifyListener ____
501
// ____ XModifyListener ____
378
void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEvent )
502
void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEvent )
379
    throw (uno::RuntimeException)
503
    throw (uno::RuntimeException)
380
{
504
{
505
		// Update the "ModelState" Struct.
381
    if( m_apModelState.get() && m_xController.is())
506
    if( m_apModelState.get() && m_xController.is())
382
        m_apModelState->update( m_xController->getModel());
507
        m_apModelState->update( m_xController->getModel());
508
509
		// Update the "ControllerState" Struct.
510
    if( m_apControllerState.get() && m_xController.is())
511
        m_apControllerState->update( m_xController->getModel());
512
		
383
    CommandDispatch::modified( aEvent );
513
    CommandDispatch::modified( aEvent );
384
}
514
}
385
515
516
517
// ____ XSelectionChangeListener ____
518
void SAL_CALL ControllerCommandDispatch::selectionChanged( const lang::EventObject& aEvent )
519
    throw (uno::RuntimeException)
520
{
521
		
522
		// TODO : remove the comment
523
		OSL_TRACE( "Selection Changed" );
524
		
525
		// Update the "ControllerState" Struct.
526
    if( m_apControllerState.get() && m_xController.is())
527
        m_apControllerState->update( m_xController->getModel());
528
		
529
}
530
531
386
} //  namespace chart
532
} //  namespace chart
(-)controller/main/ControllerCommandDispatch.hxx (-4 / +30 lines)
Lines 32-75 Link Here
32
 *    MA  02111-1307  USA
32
 *    MA  02111-1307  USA
33
 *
33
 *
34
 ************************************************************************/
34
 ************************************************************************/
35
#ifndef CHART2_CONTROLLERCOMMANDDISPATCH_HXX
35
#ifndef CHART2_CONTROLLERCOMMANDDISPATCH_HXX
36
#define CHART2_CONTROLLERCOMMANDDISPATCH_HXX
36
#define CHART2_CONTROLLERCOMMANDDISPATCH_HXX
37
37
38
#include "CommandDispatch.hxx"
38
#include "CommandDispatch.hxx"
39
39
40
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
41
#include <cppuhelper/implbase1.hxx>
42
#endif
40
#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
43
#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
41
#include <com/sun/star/frame/XModel.hpp>
44
#include <com/sun/star/frame/XModel.hpp>
42
#endif
45
#endif
43
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
46
#ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_
44
#include <com/sun/star/frame/XController.hpp>
47
#include <com/sun/star/frame/XController.hpp>
45
#endif
48
#endif
46
#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
49
#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
47
#include <com/sun/star/view/XSelectionSupplier.hpp>
50
#include <com/sun/star/view/XSelectionSupplier.hpp>
48
#endif
51
#endif
52
#ifndef _COM_SUN_STAR_VIEW_XSELECTIONCHANGELISTENER_HPP_
53
#include <com/sun/star/view/XSelectionChangeListener.hpp>
54
#endif
55
49
56
50
#include <memory>
57
#include <memory>
51
58
52
namespace chart
59
namespace chart
53
{
60
{
54
61
55
namespace impl
62
namespace impl
56
{
63
{
57
struct ModelState;
64
		struct ControllerState;
65
		struct ModelState;
66
67
		// issue 63017 : need to implement the XSelectionChangeListener in order
68
		// to update the ModelState when the selected series changes.
69
		typedef ::cppu::ImplInheritanceHelper1<
70
				CommandDispatch, ::com::sun::star::view::XSelectionChangeListener >
71
				ControllerCommandDispatch_Base;
72
58
}
73
}
59
74
60
/** This class is a CommandDispatch that is responsible for all commands that
75
/** This class is a CommandDispatch that is responsible for all commands that
61
    the ChartController supports.
76
    the ChartController supports.
62
77
63
    This class determines which commands are currently available (via the model
78
    This class determines which commands are currently available (via the model
64
    state) and if an available command is called forwards it to the
79
    state) and if an available command is called forwards it to the
65
    ChartController.
80
		ChartController.
66
 */
81
 */
67
class ControllerCommandDispatch : public CommandDispatch
82
class ControllerCommandDispatch : public impl::ControllerCommandDispatch_Base
68
{
83
{
69
public:
84
public:
70
    explicit ControllerCommandDispatch(
85
    explicit ControllerCommandDispatch(
71
        const ::com::sun::star::uno::Reference<
86
        const ::com::sun::star::uno::Reference<
72
            ::com::sun::star::uno::XComponentContext > & xContext,
87
            ::com::sun::star::uno::XComponentContext > & xContext,
73
        const ::com::sun::star::uno::Reference<
88
        const ::com::sun::star::uno::Reference<
74
            ::com::sun::star::frame::XController > & xController );
89
            ::com::sun::star::frame::XController > & xController );
75
	virtual ~ControllerCommandDispatch();
90
	virtual ~ControllerCommandDispatch();
Lines 97-134 protected: Link Here
97
        const ::rtl::OUString & rURL,
112
        const ::rtl::OUString & rURL,
98
        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
113
        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
99
114
100
    // ____ XModifyListener ____
115
    // ____ XModifyListener ____
101
    virtual void SAL_CALL modified(
116
    virtual void SAL_CALL modified(
102
        const ::com::sun::star::lang::EventObject& aEvent )
117
        const ::com::sun::star::lang::EventObject& aEvent )
103
        throw (::com::sun::star::uno::RuntimeException);
118
        throw (::com::sun::star::uno::RuntimeException);
104
119
120
    // ____ XSelectionChangeListener ____
121
		// This is related to the arrangement feature (issue 63017).
122
    virtual void SAL_CALL selectionChanged(
123
        const ::com::sun::star::lang::EventObject& aEvent )
124
        throw (::com::sun::star::uno::RuntimeException);
125
		
126
127
105
private:
128
private:
106
    /** Simplification for doing a string compare between a given URL
129
    /** Simplification for doing a string compare between a given URL
107
        (rCompareURL) with a fixed string (rURL), and only in case of equality
130
        (rCompareURL) with a fixed string (rURL), and only in case of equality
108
        call the fireStatusEvent method at the base class.
131
        call the fireStatusEvent method at the base class.
109
132
110
        @param xSingleListener
133
        @param xSingleListener
111
            Same behaviour that in base class CommandDispatch: If set, the event
134
            Same behaviour that in base class CommandDispatch: If set, the event
112
            is only sent to this listener rather than to all registered ones.
135
            is only sent to this listener rather than to all registered ones.
113
     */
136
     */
114
    void conditionalFireStatusEventForURL(
137
    void conditionalFireStatusEventForURL(
115
        const ::rtl::OUString & rCompareURL,
138
        const ::rtl::OUString & rCompareURL,
116
        const ::rtl::OUString & rURL,
139
        const ::rtl::OUString & rURL,
117
        const ::com::sun::star::uno::Any & rState,
140
        const ::com::sun::star::uno::Any & rState,
118
        sal_Bool bEnabled,
141
        bool bEnabled,
119
        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
142
        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener );
120
143
121
    ::com::sun::star::uno::Reference<
144
    ::com::sun::star::uno::Reference<
122
            ::com::sun::star::frame::XController > m_xController;
145
            ::com::sun::star::frame::XController > m_xController;
123
    ::com::sun::star::uno::Reference<
146
    ::com::sun::star::uno::Reference<
124
            ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
147
            ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
125
    ::com::sun::star::uno::Reference<
148
    ::com::sun::star::uno::Reference<
126
            ::com::sun::star::frame::XDispatch > m_xDispatch;
149
            ::com::sun::star::frame::XDispatch > m_xDispatch;
127
150
128
    ::std::auto_ptr< impl::ModelState > m_apModelState;
151
    ::std::auto_ptr< impl::ModelState > m_apModelState;
152
		
153
    ::std::auto_ptr< impl::ControllerState > m_apControllerState;
154
		
129
};
155
};
130
156
131
} //  namespace chart
157
} //  namespace chart
132
158
133
// CHART2_CONTROLLERCOMMANDDISPATCH_HXX
159
// CHART2_CONTROLLERCOMMANDDISPATCH_HXX
134
#endif
160
#endif
(-)inc/DiagramHelper.hxx (-5 / +83 lines)
Lines 288-307 public: Link Here
288
            const ::com::sun::star::uno::Reference<
288
            const ::com::sun::star::uno::Reference<
289
                ::com::sun::star::chart2::XDiagram > & xDiagram );
289
                ::com::sun::star::chart2::XDiagram > & xDiagram );
290
290
291
    static bool areChartTypesCompatible( const ::com::sun::star::uno::Reference<
291
    static bool areChartTypesCompatible( const ::com::sun::star::uno::Reference<
292
                ::com::sun::star::chart2::XChartType >& xFirstType,
292
                ::com::sun::star::chart2::XChartType >& xFirstType,
293
                const ::com::sun::star::uno::Reference<
293
                const ::com::sun::star::uno::Reference<
294
                ::com::sun::star::chart2::XChartType >& xSecondType );
294
                ::com::sun::star::chart2::XChartType >& xSecondType );
295
295
296
    static bool moveSeries( const ::com::sun::star::uno::Reference<
296
297
                ::com::sun::star::chart2::XDiagram >& xDiagram,
297
		/**
298
                const ::com::sun::star::uno::Reference<
298
		 * Test if the series can be moved.
299
                ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries, bool bForward );
299
		 *
300
		 * @param xDiagram
301
		 * 	Reference to the diagram that contains the selected series.
302
		 * 
303
		 * @param xGivenDataSeries
304
		 * 	Reference to the series that needs to be moved.
305
		 * 	
306
		 * @param bForward
307
		 * 	Test to move the series forward or backward.
308
		 * 
309
		 * @returns </TRUE> if the series can be moved.
310
		 * 
311
		 */
312
		static bool DiagramHelper::isSeriesMoveable( 
313
				const ::com::sun::star::uno::Reference< 
314
				  ::com::sun::star::chart2::XDiagram >& xDiagram,
315
				const ::com::sun::star::uno::Reference<
316
          ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries,
317
				bool bForward );
318
				  
319
		/**
320
		 * Move the series forward or backward.
321
		 *
322
		 * @param xDiagram
323
		 * 	Reference to the diagram that contains the selected series.
324
		 * 
325
		 * @param xGivenDataSeries
326
		 * 	Reference to the series that needs to be moved.
327
		 * 	
328
		 * @param bForward
329
		 * 	Test to move the series forward or backward.
330
		 *
331
		 * @returns </TRUE> if the series was moved.
332
		 * 
333
		 */
334
    static bool moveSeries( 
335
				const ::com::sun::star::uno::Reference< 
336
				  ::com::sun::star::chart2::XDiagram >& xDiagram,
337
				const ::com::sun::star::uno::Reference<
338
          ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries,
339
				bool bForward );
300
340
301
    static sal_Int32 getIndexOfSeriesWithinChartType( 
341
    static sal_Int32 getIndexOfSeriesWithinChartType( 
302
                const ::com::sun::star::uno::Reference<
342
                const ::com::sun::star::uno::Reference<
303
                    ::com::sun::star::chart2::XDataSeries >& xDataSeries,
343
                    ::com::sun::star::chart2::XDataSeries >& xDataSeries,
304
               const ::com::sun::star::uno::Reference<
344
               const ::com::sun::star::uno::Reference<
305
                    ::com::sun::star::chart2::XChartType >& xChartType );
345
                    ::com::sun::star::chart2::XChartType >& xChartType );
306
346
307
    enum BarConnectorState
347
    enum BarConnectorState
Lines 319-335 public: Link Here
319
    static BarConnectorState hasBarConnectors(
359
    static BarConnectorState hasBarConnectors(
320
        const ::com::sun::star::uno::Reference<
360
        const ::com::sun::star::uno::Reference<
321
            ::com::sun::star::chart2::XDiagram >& xDiagram );
361
            ::com::sun::star::chart2::XDiagram >& xDiagram );
322
362
323
    /** Set the property "ConnectDataPoints" to true for all series that are
363
    /** Set the property "ConnectDataPoints" to true for all series that are
324
        contained in chart types that support bar connectors (see
364
        contained in chart types that support bar connectors (see
325
        ChartTypeHelper::isSupportingBarConnectors)
365
        ChartTypeHelper::isSupportingBarConnectors)
326
366
327
        @return </TRUE> iff the property could be set at some data series
367
        @return </TRUE> if the property could be set at some data series
328
     */
368
     */
329
    static bool setBarConnectors(
369
    static bool setBarConnectors(
330
        const ::com::sun::star::uno::Reference<
370
        const ::com::sun::star::uno::Reference<
331
            ::com::sun::star::chart2::XDiagram >& xDiagram,
371
            ::com::sun::star::chart2::XDiagram >& xDiagram,
332
        bool bOn );
372
        bool bOn );
333
373
334
    /** Returns the default camera geometry that is set in the Diagram CTOR.
374
    /** Returns the default camera geometry that is set in the Diagram CTOR.
335
        This is not the property default!
375
        This is not the property default!
Lines 359-372 public: Link Here
359
    static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
399
    static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance );
360
400
361
    static bool isSupportingFloorAndWall( const ::com::sun::star::uno::Reference<
401
    static bool isSupportingFloorAndWall( const ::com::sun::star::uno::Reference<
362
                ::com::sun::star::chart2::XDiagram > & xDiagram );
402
                ::com::sun::star::chart2::XDiagram > & xDiagram );
363
403
364
private:
404
private:
365
    // not implemented
405
    // not implemented
366
	DiagramHelper();
406
	DiagramHelper();
407
408
	  /** 
409
		 * This method implements the logic of checking if a series can be moved
410
		 * forward/backward. Depending on the "bDoMove" parameter the series will
411
		 * be moved (bDoMove = true) or the function just will just test if the
412
		 * series can be moved without doing the move (bDoMove = false).
413
		 *
414
		 * Note : This function should be restructured, but is kept as is for the
415
		 * moment.
416
		 *
417
		 * @param xDiagram
418
		 * 	Reference to the diagram that contains the selected series.
419
		 * 
420
		 * @param xGivenDataSeries
421
		 * 	Reference to the series that needs to be moved.
422
		 * 	
423
		 * @param bForward
424
		 * 	Move the series forward or backward.
425
		 * 	
426
		 * @param bDoMove
427
		 * 	Should this function really move the series (true) or just test if it is
428
		 * 	possible (false).
429
		 * 
430
		 *
431
		 * @returns
432
		 * 	bDoMove = true
433
		 * 		- True : if the move was done
434
		 * 		- False : the move failed
435
		 * 	bDoMove = false
436
		 * 		- True : the series can be moved
437
		 * 		- False : the series can not be moved
438
		 *
439
		 */
440
    static bool lcl_moveSeriesOrCheckIfMoveIsAllowed( 
441
				const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram,
442
        const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries,
443
				bool bForward,
444
				bool bDoMove );
367
};
445
};
368
446
369
} //  namespace chart
447
} //  namespace chart
370
448
371
// CHART2_DIAGRAMHELPER_HXX
449
// CHART2_DIAGRAMHELPER_HXX
372
#endif
450
#endif
(-)tools/DiagramHelper.cxx (-79 / +179 lines)
Lines 1084-1227 bool DiagramHelper::areChartTypesCompati Link Here
1084
1084
1085
    ::std::vector< ::rtl::OUString > aFirstRoles( ContainerHelper::SequenceToVector( xFirstType->getSupportedMandatoryRoles() ) );
1085
    ::std::vector< ::rtl::OUString > aFirstRoles( ContainerHelper::SequenceToVector( xFirstType->getSupportedMandatoryRoles() ) );
1086
    ::std::vector< ::rtl::OUString > aSecondRoles( ContainerHelper::SequenceToVector( xSecondType->getSupportedMandatoryRoles() ) );
1086
    ::std::vector< ::rtl::OUString > aSecondRoles( ContainerHelper::SequenceToVector( xSecondType->getSupportedMandatoryRoles() ) );
1087
    ::std::sort( aFirstRoles.begin(), aFirstRoles.end() );
1087
    ::std::sort( aFirstRoles.begin(), aFirstRoles.end() );
1088
    ::std::sort( aSecondRoles.begin(), aSecondRoles.end() );
1088
    ::std::sort( aSecondRoles.begin(), aSecondRoles.end() );
1089
    return ( aFirstRoles == aSecondRoles );
1089
    return ( aFirstRoles == aSecondRoles );
1090
}
1090
}
1091
1091
1092
1093
1094
bool DiagramHelper::isSeriesMoveable( 
1095
		const Reference< XDiagram >& xDiagram,
1096
		const Reference< XDataSeries >& xGivenDataSeries,
1097
		bool bForward )
1098
{
1099
		
1100
		bool bIsMoveable = false;
1101
		const bool bDoMove = false;
1102
		
1103
		bIsMoveable = lcl_moveSeriesOrCheckIfMoveIsAllowed( 
1104
				xDiagram, xGivenDataSeries, bForward, bDoMove );
1105
		
1106
		return bIsMoveable;
1107
}
1108
1109
1092
bool DiagramHelper::moveSeries( const Reference< XDiagram >& xDiagram, const Reference< XDataSeries >& xGivenDataSeries, bool bForward )
1110
bool DiagramHelper::moveSeries( const Reference< XDiagram >& xDiagram, const Reference< XDataSeries >& xGivenDataSeries, bool bForward )
1093
{
1111
{
1094
    bool bChanged = false;
1112
1113
		bool bMoved = false;
1114
		const bool bDoMove = true;
1115
		
1116
		bMoved = lcl_moveSeriesOrCheckIfMoveIsAllowed( 
1117
				xDiagram, xGivenDataSeries, bForward, bDoMove );
1118
1119
		return bMoved;
1120
}
1121
1122
1123
bool DiagramHelper::lcl_moveSeriesOrCheckIfMoveIsAllowed( 
1124
		const Reference< XDiagram >& xDiagram, 
1125
		const Reference< XDataSeries >& xGivenDataSeries,
1126
		bool bForward,
1127
		bool bDoMove )
1128
{
1129
		
1130
		OSL_TRACE( "LOCAL_MOVE_SERIES" );
1131
		
1132
		if( bForward )
1133
				OSL_TRACE( "move forward" );
1134
		else
1135
				OSL_TRACE( "move backward" );
1136
				
1137
		
1138
		if( bDoMove )
1139
				OSL_TRACE( "Really move" );
1140
		else
1141
				OSL_TRACE( "DO NOT move" );
1142
			
1143
		
1144
    bool bMovedOrMoveAllowed = false;
1145
		
1095
    try
1146
    try
1096
    {
1147
    {
1097
        uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
1148
        uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
1098
1149
1099
        //find position of series
1150
        // Find position of series.
1100
        bool bFound = false;
1151
        bool bFound = false;
1101
1152
1102
        if( xGivenDataSeries.is() && xCooSysContainer.is() )
1153
        if( xGivenDataSeries.is() && xCooSysContainer.is() )
1103
        {
1154
        {
1104
            uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
1155
            uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
1156
1157
						// Coordinate system(s). At the moment, there is only one
1158
						// coordinate.
1105
            for( sal_Int32 nCS = 0; !bFound && nCS < aCooSysList.getLength(); ++nCS )
1159
            for( sal_Int32 nCS = 0; !bFound && nCS < aCooSysList.getLength(); ++nCS )
1106
            {
1160
            {
1107
                uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
1161
                uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
1108
                
1162
                
1109
                //iterate through all chart types in the current coordinate system
1163
                //iterate through all chart types in the current coordinate system
1110
                uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
1164
                uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
1111
                OSL_ASSERT( xChartTypeContainer.is());
1165
                OSL_ASSERT( xChartTypeContainer.is());
1112
                if( !xChartTypeContainer.is() )
1166
                if( !xChartTypeContainer.is() )
1113
                    continue;
1167
                    continue;
1114
                uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
1168
                uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
1115
                uno::Reference< XChartType > xFormerChartType;
1169
                uno::Reference< XChartType > xFormerChartType;
1170
								
1116
                for( sal_Int32 nT = 0; !bFound && nT < aChartTypeList.getLength(); ++nT )
1171
                for( sal_Int32 nT = 0; !bFound && nT < aChartTypeList.getLength(); ++nT )
1117
                {
1172
                {
1118
                    uno::Reference< XChartType > xCurrentChartType( aChartTypeList[nT] );
1173
                    uno::Reference< XChartType > xCurrentChartType( aChartTypeList[nT] );
1119
                                        
1174
                                        
1120
                    //iterate through all series in this chart type
1175
                    //iterate through all series in this chart type
1121
                    uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xCurrentChartType, uno::UNO_QUERY );
1176
                    uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xCurrentChartType, uno::UNO_QUERY );
1122
                    OSL_ASSERT( xDataSeriesContainer.is());
1177
                    OSL_ASSERT( xDataSeriesContainer.is());
1123
                    if( !xDataSeriesContainer.is() )
1178
                    if( !xDataSeriesContainer.is() )
1124
                        continue;
1179
                        continue;
1125
                        
1180
                        
1126
                    uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
1181
                    uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
1182
1183
										
1127
                    for( sal_Int32 nS = 0; !bFound && nS < aSeriesList.getLength(); ++nS )
1184
                    for( sal_Int32 nS = 0; !bFound && nS < aSeriesList.getLength(); ++nS )
1128
                    {
1185
                    {
1129
			            if( xGivenDataSeries==aSeriesList[nS] )
1186
1187
												// Aim : know at which index is the series.
1188
												// We found the series we are interrested in !
1189
												if( xGivenDataSeries==aSeriesList[nS] )
1130
                        {
1190
                        {
1131
                            sal_Int32 nOldCooSysIndex=nCS;
1191
                            sal_Int32 nOldCooSysIndex = nCS;
1132
                            sal_Int32 nOldChartTypeIndex=nT;
1192
                            sal_Int32 nOldChartTypeIndex = nT;
1133
                            sal_Int32 nOldSeriesIndex=nS;
1193
                            sal_Int32 nOldSeriesIndex = nS;
1134
                            bFound = true;
1194
                            bFound = true;
1135
1195
1136
                            try
1196
                            try
1137
                            {
1197
                            {
1138
                                sal_Int32 nNewSeriesIndex=nS;
1198
                                sal_Int32 nNewSeriesIndex = nS;
1139
                                if( bForward )
1199
                                
1200
																// Should the series be moved forward or backward.
1201
																if( bForward )
1140
                                    nNewSeriesIndex--;
1202
                                    nNewSeriesIndex--;
1141
                                else
1203
                                else
1142
                                    nNewSeriesIndex++;
1204
                                    nNewSeriesIndex++;
1143
                                if( nNewSeriesIndex >= 0 && nNewSeriesIndex < aSeriesList.getLength() )
1205
1144
                                {
1206
																
1145
                                    //move series in the same charttype
1207
																// --- Moving in real the series -------------
1146
                                    bChanged = true;
1208
																
1147
                                    aSeriesList[nOldSeriesIndex]=aSeriesList[nNewSeriesIndex];
1209
																if( bDoMove )
1148
                                    aSeriesList[nNewSeriesIndex]=xGivenDataSeries;
1210
																{
1149
                                    xDataSeriesContainer->setDataSeries(aSeriesList);
1211
																
1150
                                }
1212
																
1151
                                else if( nNewSeriesIndex<0 )
1213
																		if( nNewSeriesIndex >= 0 && nNewSeriesIndex < aSeriesList.getLength() )
1152
                                {
1214
																		{
1153
                                    //exchange series with former charttype
1215
																				//move series in the same charttype
1154
                                    if( xFormerChartType.is() && DiagramHelper::areChartTypesCompatible( xFormerChartType, xCurrentChartType ) )
1216
																				bMovedOrMoveAllowed = true;
1155
                                    {
1217
																				aSeriesList[ nOldSeriesIndex ] = aSeriesList[ nNewSeriesIndex ];
1156
                                        bChanged = true;
1218
																				aSeriesList[ nNewSeriesIndex ] = xGivenDataSeries;
1157
                                        uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xFormerChartType, uno::UNO_QUERY );
1219
																				xDataSeriesContainer->setDataSeries( aSeriesList );
1158
                                        if( xOtherDataSeriesContainer.is() )
1220
																		}
1159
                                        {
1221
																		else if( nNewSeriesIndex<0 )
1160
                                            uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() );
1222
																		{
1161
                                            sal_Int32 nOtherSeriesIndex = aOtherSeriesList.getLength()-1;
1223
																				//exchange series with former charttype
1162
                                            if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() )
1224
																				if( xFormerChartType.is() && DiagramHelper::areChartTypesCompatible( xFormerChartType, xCurrentChartType ) )
1163
                                            {
1225
																				{
1164
                                                uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
1226
																						bMovedOrMoveAllowed = true;
1165
                                                aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
1227
																						uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xFormerChartType, uno::UNO_QUERY );
1166
                                                xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
1228
																						if( xOtherDataSeriesContainer.is() )
1229
																						{
1230
																								uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() );
1231
																								sal_Int32 nOtherSeriesIndex = aOtherSeriesList.getLength()-1;
1232
																								if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() )
1233
																								{
1234
																										uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
1235
																										aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
1236
																										xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
1167
1237
1168
                                                aSeriesList[nOldSeriesIndex]=xExchangeSeries;
1238
                                                aSeriesList[nOldSeriesIndex]=xExchangeSeries;
1169
                                                xDataSeriesContainer->setDataSeries(aSeriesList);
1239
                                                xDataSeriesContainer->setDataSeries(aSeriesList);
1170
                                            }
1240
																								}
1171
                                        }
1241
																						}
1172
                                    }
1242
																				}
1173
                                }
1243
																		}
1174
                                else if( nT+1 < aChartTypeList.getLength() )
1244
																		else if( nT+1 < aChartTypeList.getLength() )
1175
                                {
1245
																		{
1176
                                    //exchange series with next charttype
1246
																				//exchange series with next charttype
1177
                                    uno::Reference< XChartType > xOtherChartType( aChartTypeList[nT+1] );
1247
																				uno::Reference< XChartType > xOtherChartType( aChartTypeList[nT+1] );
1178
                                    if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) )
1248
																				if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) )
1179
                                    {
1249
																				{
1180
                                        bChanged = true;
1250
																						bMovedOrMoveAllowed = true;
1181
                                        uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xOtherChartType, uno::UNO_QUERY );
1251
																						uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xOtherChartType, uno::UNO_QUERY );
1182
                                        if( xOtherDataSeriesContainer.is() )
1252
																						if( xOtherDataSeriesContainer.is() )
1183
                                        {
1253
																						{
1184
                                            uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() );
1254
																								uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() );
1185
                                            sal_Int32 nOtherSeriesIndex = 0;
1255
																								sal_Int32 nOtherSeriesIndex = 0;
1186
                                            if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() )
1256
																								if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() )
1187
                                            {
1257
																								{
1188
                                                uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
1258
																										uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] );
1189
                                                aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
1259
																										aOtherSeriesList[nOtherSeriesIndex] = xGivenDataSeries;
1190
                                                xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
1260
																										xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList);
1191
1261
1192
                                                aSeriesList[nOldSeriesIndex]=xExchangeSeries;
1262
                                                aSeriesList[nOldSeriesIndex]=xExchangeSeries;
1193
                                                xDataSeriesContainer->setDataSeries(aSeriesList);
1263
                                                xDataSeriesContainer->setDataSeries(aSeriesList);
1194
                                            }
1264
																								}
1195
                                        }
1265
																						}
1196
                                    }
1266
																				}
1197
                                }
1267
																		}
1198
                                
1268
1199
                            }
1269
																		// --- End Moving the series --------------------
1200
                            catch( util::CloseVetoException& )
1270
1201
                            {
1271
																}
1202
                            }
1272
																
1203
                            catch( uno::RuntimeException& )
1273
																// --- Test if the series can be moved without
1204
                            {
1274
																// doing the move. ---
1205
                            }
1275
																
1206
                        }
1276
																else
1207
                    }
1277
																{
1208
                    xFormerChartType = xCurrentChartType;
1278
1209
                }
1279
																		if( nNewSeriesIndex >= 0 && nNewSeriesIndex < aSeriesList.getLength() )
1210
            }
1280
																				bMovedOrMoveAllowed = true;
1211
        }
1281
1212
    }
1282
																		else if( nNewSeriesIndex<0 )
1213
    catch( util::CloseVetoException& )
1283
																		{
1214
    {
1284
																				//exchange series with former charttype
1215
    }
1285
																				if( xFormerChartType.is() && DiagramHelper::areChartTypesCompatible( xFormerChartType, xCurrentChartType ) )
1216
    catch( uno::RuntimeException& )
1286
																						bMovedOrMoveAllowed = true;
1217
    {
1287
																		}
1218
    }
1288
																		else if( nT+1 < aChartTypeList.getLength() )
1219
    return bChanged;
1289
																		{
1290
																				//exchange series with next charttype
1291
																				uno::Reference< XChartType > xOtherChartType( aChartTypeList[nT+1] );
1292
																				if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) )
1293
																				{
1294
																						bMovedOrMoveAllowed = true;
1295
																				}
1296
																		}
1297
																}
1298
1299
														}
1300
														catch( util::CloseVetoException& )
1301
														{
1302
														}
1303
														catch( uno::RuntimeException& )
1304
														{
1305
														}
1306
												}
1307
										}
1308
										xFormerChartType = xCurrentChartType;
1309
								}
1310
						}
1311
				}
1312
		}
1313
		catch( util::CloseVetoException& )
1314
		{
1315
		}
1316
		catch( uno::RuntimeException& )
1317
		{
1318
		}
1319
		return bMovedOrMoveAllowed;
1220
}
1320
}
1221
1321
1222
sal_Int32 DiagramHelper::getIndexOfSeriesWithinChartType( 
1322
sal_Int32 DiagramHelper::getIndexOfSeriesWithinChartType( 
1223
                const Reference< XDataSeries >& xDataSeries,
1323
                const Reference< XDataSeries >& xDataSeries,
1224
               const Reference< XChartType >& xChartType )
1324
               const Reference< XChartType >& xChartType )
1225
{
1325
{
1226
    sal_Int32 nRet = -1;
1326
    sal_Int32 nRet = -1;
1227
1327

Return to issue 63017