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 |