Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "tp_DataSource.hxx"
22 : #include "tp_DataSource.hrc"
23 : #include "Strings.hrc"
24 : #include "ResId.hxx"
25 : #include "chartview/ChartSfxItemIds.hxx"
26 : #include "macros.hxx"
27 : #include "ChartTypeTemplateProvider.hxx"
28 : #include "RangeSelectionHelper.hxx"
29 : #include "DataSeriesHelper.hxx"
30 : #include "tp_DataSourceControls.hxx"
31 : #include "ControllerLockGuard.hxx"
32 : #include "DataSourceHelper.hxx"
33 : #include <com/sun/star/sheet/XRangeSelection.hpp>
34 : #include <com/sun/star/table/XCellRange.hpp>
35 : #include <com/sun/star/chart2/XChartType.hpp>
36 : #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
37 : #include <com/sun/star/util/XModifiable.hpp>
38 : #include <com/sun/star/chart2/data/XDataSink.hpp>
39 :
40 : // for RET_OK
41 : #include <vcl/msgbox.hxx>
42 : #include <rtl/ustrbuf.hxx>
43 :
44 : #include <functional>
45 : #include <algorithm>
46 : #include <map>
47 :
48 : using namespace ::com::sun::star;
49 : using namespace ::com::sun::star::chart2;
50 :
51 : using ::com::sun::star::uno::Reference;
52 : using ::com::sun::star::uno::Sequence;
53 : using ::rtl::OUString;
54 : using ::rtl::OUStringBuffer;
55 :
56 : // --------------------------------------------------------------------------------
57 :
58 : namespace
59 : {
60 :
61 1 : const OUString lcl_aLabelRole( "label" );
62 :
63 0 : String lcl_GetRoleLBEntry(
64 : const OUString & rRole, const OUString & rRange )
65 : {
66 0 : String aEntry( rRole );
67 0 : aEntry += '\t';
68 : aEntry += String(
69 0 : ::chart::DialogModel::ConvertRoleFromInternalToUI( rRole ));
70 0 : aEntry += '\t';
71 0 : aEntry += String( rRange );
72 :
73 0 : return aEntry;
74 : }
75 :
76 0 : void lcl_UpdateCurrentRange(
77 : SvTabListBox & rOutListBox,
78 : const OUString & rRole, const OUString & rRange )
79 : {
80 0 : SvTreeListEntry * pEntry = rOutListBox.FirstSelected();
81 0 : if( pEntry )
82 0 : rOutListBox.SetEntryText( lcl_GetRoleLBEntry( rRole, rRange ), pEntry );
83 0 : }
84 :
85 0 : bool lcl_UpdateCurrentSeriesName(
86 : SvTreeListBox & rOutListBox )
87 : {
88 0 : bool bResult = false;
89 0 : ::chart::SeriesEntry * pEntry = dynamic_cast< ::chart::SeriesEntry * >( rOutListBox.FirstSelected());
90 0 : if( pEntry &&
91 0 : pEntry->m_xDataSeries.is() &&
92 0 : pEntry->m_xChartType.is())
93 : {
94 : String aLabel( ::chart::DataSeriesHelper::getDataSeriesLabel(
95 : pEntry->m_xDataSeries,
96 0 : pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel()));
97 0 : if( aLabel.Len())
98 : {
99 0 : rOutListBox.SetEntryText( pEntry, aLabel );
100 0 : bResult = true;
101 0 : }
102 : }
103 0 : return bResult;
104 : }
105 :
106 0 : OUString lcl_GetSelectedRole( const SvTabListBox & rRoleListBox, bool bUITranslated = false )
107 : {
108 0 : OUString aResult;
109 0 : SvTreeListEntry * pEntry = rRoleListBox.FirstSelected();
110 0 : if( pEntry )
111 : aResult = OUString( rRoleListBox.GetEntryText( pEntry,
112 0 : bUITranslated ? 1 : 0 ));
113 0 : return aResult;
114 : }
115 :
116 0 : OUString lcl_GetSelectedRolesRange( const SvTabListBox & rRoleListBox )
117 : {
118 0 : OUString aResult;
119 0 : SvTreeListEntry * pEntry = rRoleListBox.FirstSelected();
120 0 : if( pEntry )
121 0 : aResult = OUString( rRoleListBox.GetEntryText( pEntry, 2 ));
122 0 : return aResult;
123 : }
124 :
125 0 : OUString lcl_GetSequenceNameForLabel( ::chart::SeriesEntry * pEntry )
126 : {
127 0 : OUString aResult( "values-y" );
128 0 : if( pEntry &&
129 0 : pEntry->m_xChartType.is())
130 : {
131 0 : aResult = pEntry->m_xChartType->getRoleOfSequenceForSeriesLabel();
132 : }
133 0 : return aResult;
134 : }
135 :
136 : static long lcl_pRoleListBoxTabs[] =
137 : { 3, // Number of Tabs
138 : 0, 0, 75
139 : };
140 :
141 0 : void lcl_ShowChooserButton(
142 : ::chart::RangeSelectionButton & rChooserButton,
143 : Edit & rEditField,
144 : sal_Bool bShow )
145 : {
146 0 : if( rChooserButton.IsVisible() != bShow )
147 : {
148 0 : rChooserButton.Show( bShow );
149 0 : sal_Int32 nWidhtDiff = 12 + 4;
150 0 : if( bShow )
151 0 : nWidhtDiff = -nWidhtDiff;
152 0 : Size aSize = rChooserButton.PixelToLogic( rEditField.GetSizePixel(), MAP_APPFONT );
153 0 : aSize.setWidth( aSize.getWidth() + nWidhtDiff );
154 0 : rEditField.SetSizePixel( rChooserButton.LogicToPixel( aSize, MAP_APPFONT ));
155 : }
156 0 : }
157 :
158 0 : void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog )
159 : {
160 0 : if( pDialog )
161 : {
162 0 : pDialog->Show( bEnable ? sal_False : sal_True );
163 0 : pDialog->SetModalInputMode( bEnable ? sal_False : sal_True );
164 : }
165 0 : }
166 :
167 0 : void lcl_addLSequenceToDataSource(
168 : const Reference< chart2::data::XLabeledDataSequence > & xLSequence,
169 : const Reference< chart2::data::XDataSource > & xSource )
170 : {
171 0 : Reference< data::XDataSink > xSink( xSource, uno::UNO_QUERY );
172 0 : if( xSink.is())
173 : {
174 0 : Sequence< Reference< chart2::data::XLabeledDataSequence > > aData( xSource->getDataSequences());
175 0 : aData.realloc( aData.getLength() + 1 );
176 0 : aData[ aData.getLength() - 1 ] = xLSequence;
177 0 : xSink->setData( aData );
178 0 : }
179 0 : }
180 :
181 0 : Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel(
182 : const Reference< chart2::data::XDataSource > & xDataSource )
183 : {
184 0 : Reference< chart2::data::XLabeledDataSequence > xResult;
185 0 : Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences());
186 :
187 0 : for( sal_Int32 i=0; i<aSequences.getLength(); ++i )
188 : {
189 : // no values are set but a label exists
190 0 : if( ! aSequences[i]->getValues().is() &&
191 0 : aSequences[i]->getLabel().is())
192 : {
193 0 : xResult.set( aSequences[i] );
194 0 : break;
195 : }
196 : }
197 :
198 0 : return xResult;
199 : }
200 :
201 0 : void lcl_shiftControlY( Control & rControl, long nYOffset )
202 : {
203 0 : Point aPos( rControl.GetPosPixel());
204 0 : aPos.setY( aPos.getY() + nYOffset );
205 0 : rControl.SetPosPixel( aPos );
206 0 : }
207 :
208 0 : void lcl_increaseHeightOfControl( Control & rControl, long nYOffset )
209 : {
210 0 : Size aSize( rControl.GetSizePixel());
211 0 : aSize.setHeight( aSize.getHeight () + nYOffset );
212 0 : rControl.SetSizePixel( aSize );
213 0 : }
214 :
215 : } // anonymous namespace
216 :
217 : // --------------------------------------------------------------------------------
218 :
219 : namespace chart
220 : {
221 :
222 0 : DataSourceTabPage::DataSourceTabPage(
223 : Window * pParent,
224 : DialogModel & rDialogModel,
225 : ChartTypeTemplateProvider* pTemplateProvider,
226 : Dialog * pParentDialog,
227 : bool bHideDescription /* = false */ ) :
228 : ::svt::OWizardPage( pParent, SchResId( TP_DATA_SOURCE )),
229 :
230 : m_aFT_CAPTION ( this, SchResId( FT_CAPTION_FOR_WIZARD )),
231 : m_aFT_SERIES ( this, SchResId( FT_SERIES )),
232 0 : m_apLB_SERIES( new SeriesListBox( this, SchResId( LB_SERIES ))),
233 : m_aBTN_ADD ( this, SchResId( BTN_ADD )),
234 : m_aBTN_REMOVE ( this, SchResId( BTN_REMOVE )),
235 : m_aBTN_UP ( this, SchResId( BTN_UP )),
236 : m_aBTN_DOWN ( this, SchResId( BTN_DOWN )),
237 : m_aFT_ROLE ( this, SchResId( FT_ROLE )),
238 : m_aLB_ROLE ( this, SchResId( LB_ROLE )),
239 : m_aFT_RANGE ( this, SchResId( FT_RANGE )),
240 : m_aEDT_RANGE ( this, SchResId( EDT_RANGE )),
241 : m_aIMB_RANGE_MAIN ( this, SchResId( IMB_RANGE_MAIN )),
242 : m_aFT_CATEGORIES ( this, SchResId( FT_CATEGORIES )),
243 : m_aFT_DATALABELS ( this, SchResId( FT_DATALABELS )),
244 : m_aEDT_CATEGORIES ( this, SchResId( EDT_CATEGORIES )),
245 : m_aIMB_RANGE_CAT ( this, SchResId( IMB_RANGE_CAT )),
246 :
247 : m_pTemplateProvider( pTemplateProvider ),
248 : m_rDialogModel( rDialogModel ),
249 :
250 : m_pCurrentRangeChoosingField( 0 ),
251 : m_bIsDirty( false ),
252 : m_pParentDialog( pParentDialog ),
253 0 : m_pTabPageNotifiable( dynamic_cast< TabPageNotifiable * >( pParentDialog ))
254 : {
255 0 : FreeResource();
256 :
257 0 : if( bHideDescription )
258 : {
259 : // note: the offset should be a negative value for shifting upwards, the
260 : // 4 is for the offset difference between a wizard page and a tab-page
261 0 : long nYOffset = - ( m_aFT_SERIES.GetPosPixel().getY() - m_aFT_CAPTION.GetPosPixel().getY() + 4 );
262 0 : long nUpShift = - 2;
263 0 : long nYResize = - (nYOffset - nUpShift);
264 0 : m_aFT_CAPTION.Hide();
265 :
266 : // shift list boxes and enlarge them by the space saved by hiding the caption
267 0 : lcl_shiftControlY( m_aFT_SERIES, nYOffset );
268 0 : lcl_shiftControlY( *(m_apLB_SERIES.get()), nYOffset );
269 0 : lcl_increaseHeightOfControl( *(m_apLB_SERIES.get()), nYResize );
270 :
271 0 : lcl_shiftControlY( m_aFT_ROLE, nYOffset );
272 0 : lcl_shiftControlY( m_aLB_ROLE, nYOffset );
273 0 : lcl_increaseHeightOfControl( m_aLB_ROLE, nYResize );
274 :
275 0 : lcl_shiftControlY( m_aBTN_ADD, nUpShift );
276 0 : lcl_shiftControlY( m_aBTN_REMOVE, nUpShift );
277 0 : lcl_shiftControlY( m_aBTN_UP, nUpShift );
278 0 : lcl_shiftControlY( m_aBTN_DOWN, nUpShift );
279 0 : lcl_shiftControlY( m_aFT_RANGE, nUpShift );
280 0 : lcl_shiftControlY( m_aEDT_RANGE, nUpShift );
281 0 : lcl_shiftControlY( m_aIMB_RANGE_MAIN, nUpShift );
282 0 : lcl_shiftControlY( m_aFT_CATEGORIES, nUpShift );
283 0 : lcl_shiftControlY( m_aFT_DATALABELS, nUpShift );
284 0 : lcl_shiftControlY( m_aEDT_CATEGORIES, nUpShift );
285 0 : lcl_shiftControlY( m_aIMB_RANGE_CAT, nUpShift );
286 : }
287 : else
288 : {
289 : // make font of caption bold
290 0 : Font aFont( m_aFT_CAPTION.GetControlFont() );
291 0 : aFont.SetWeight( WEIGHT_BOLD );
292 0 : m_aFT_CAPTION.SetControlFont( aFont );
293 :
294 : // no mnemonic
295 0 : m_aFT_CAPTION.SetStyle( m_aFT_CAPTION.GetStyle() | WB_NOLABEL );
296 : }
297 :
298 0 : m_aFixedTextRange = OUString( m_aFT_RANGE.GetText() );
299 0 : this->SetText( String( SchResId( STR_OBJECT_DATASERIES_PLURAL ) ) );
300 :
301 : // set handlers
302 0 : m_apLB_SERIES->SetSelectHdl( LINK( this, DataSourceTabPage, SeriesSelectionChangedHdl ));
303 :
304 0 : m_aLB_ROLE.SetStyle( m_aLB_ROLE.GetStyle() | WB_HSCROLL | WB_CLIPCHILDREN );
305 0 : m_aLB_ROLE.SetSelectionMode( SINGLE_SELECTION );
306 0 : m_aLB_ROLE.SetSelectHdl( LINK( this, DataSourceTabPage, RoleSelectionChangedHdl ));
307 :
308 0 : m_aEDT_RANGE.SetKeyInputHdl( LINK( this, DataSourceTabPage, MainRangeButtonClickedHdl ));
309 0 : m_aEDT_CATEGORIES.SetKeyInputHdl( LINK( this, DataSourceTabPage, CategoriesRangeButtonClickedHdl ));
310 :
311 0 : m_aIMB_RANGE_MAIN.SetClickHdl( LINK( this, DataSourceTabPage, MainRangeButtonClickedHdl ));
312 0 : m_aIMB_RANGE_CAT.SetClickHdl( LINK( this, DataSourceTabPage, CategoriesRangeButtonClickedHdl ));
313 :
314 0 : m_aBTN_ADD.SetClickHdl( LINK( this, DataSourceTabPage, AddButtonClickedHdl ));
315 0 : m_aBTN_REMOVE.SetClickHdl( LINK( this, DataSourceTabPage, RemoveButtonClickedHdl ));
316 :
317 0 : m_aBTN_UP.SetClickHdl( LINK( this, DataSourceTabPage, UpButtonClickedHdl ));
318 0 : m_aBTN_DOWN.SetClickHdl( LINK( this, DataSourceTabPage, DownButtonClickedHdl ));
319 :
320 0 : m_aEDT_RANGE.SetModifyHdl( LINK( this, DataSourceTabPage, RangeModifiedHdl ));
321 0 : m_aEDT_CATEGORIES.SetModifyHdl( LINK( this, DataSourceTabPage, RangeModifiedHdl ));
322 0 : m_aEDT_RANGE.SetUpdateDataHdl( LINK( this, DataSourceTabPage, RangeUpdateDataHdl ));
323 0 : m_aEDT_CATEGORIES.SetUpdateDataHdl( LINK( this, DataSourceTabPage, RangeUpdateDataHdl ));
324 :
325 : // #i75179# enable setting the background to a different color
326 0 : m_aEDT_RANGE.SetStyle( m_aEDT_RANGE.GetStyle() | WB_FORCECTRLBACKGROUND );
327 0 : m_aEDT_CATEGORIES.SetStyle( m_aEDT_CATEGORIES.GetStyle() | WB_FORCECTRLBACKGROUND );
328 :
329 : // set symbol font for arrows
330 : // note: StarSymbol is substituted to OpenSymbol for OOo
331 0 : Font aSymbolFont( m_aBTN_UP.GetFont());
332 0 : aSymbolFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "StarSymbol" )));
333 0 : m_aBTN_UP.SetControlFont( aSymbolFont );
334 0 : m_aBTN_DOWN.SetControlFont( aSymbolFont );
335 :
336 : // set button text
337 0 : sal_Unicode cBlackUpPointingTriangle( 0x25b2 );
338 0 : sal_Unicode cBlackDownPointingTriangle( 0x25bc );
339 0 : m_aBTN_UP.SetText( rtl::OUString( cBlackUpPointingTriangle ));
340 0 : m_aBTN_DOWN.SetText( rtl::OUString( cBlackDownPointingTriangle ));
341 :
342 : // init controls
343 0 : m_aLB_ROLE.SetTabs( lcl_pRoleListBoxTabs, MAP_APPFONT );
344 0 : m_aLB_ROLE.Show();
345 :
346 0 : updateControlsFromDialogModel();
347 :
348 : // select first series
349 0 : if( m_apLB_SERIES->First())
350 0 : m_apLB_SERIES->Select( m_apLB_SERIES->First());
351 0 : m_apLB_SERIES->GrabFocus();
352 0 : m_aBTN_UP.SetAccessibleName(String(SchResId(STR_BUTTON_UP)));
353 0 : m_aBTN_DOWN.SetAccessibleName(String(SchResId(STR_BUTTON_DOWN)));
354 0 : }
355 :
356 0 : DataSourceTabPage::~DataSourceTabPage()
357 0 : {}
358 :
359 0 : void DataSourceTabPage::ActivatePage()
360 : {
361 0 : OWizardPage::ActivatePage();
362 0 : updateControlsFromDialogModel();
363 0 : }
364 :
365 0 : void DataSourceTabPage::initializePage()
366 : {
367 0 : }
368 :
369 0 : void DataSourceTabPage::DeactivatePage()
370 : {
371 0 : commitPage();
372 0 : svt::OWizardPage::DeactivatePage();
373 0 : }
374 :
375 0 : void DataSourceTabPage::commitPage()
376 : {
377 0 : commitPage(::svt::WizardTypes::eFinish);
378 0 : }
379 :
380 0 : sal_Bool DataSourceTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
381 : {
382 : //ranges may have been edited in the meanwhile (dirty is true in that case here)
383 0 : if( isValid() )
384 : {
385 0 : updateModelFromControl( 0 /*update all*/ );
386 0 : return sal_True;//return false if this page should not be left
387 : }
388 : else
389 0 : return sal_False;
390 : }
391 :
392 0 : bool DataSourceTabPage::isRangeFieldContentValid( Edit & rEdit )
393 : {
394 0 : OUString aRange( rEdit.GetText());
395 0 : bool bIsValid = ( aRange.isEmpty() ) ||
396 0 : m_rDialogModel.getRangeSelectionHelper()->verifyCellRange( aRange );
397 :
398 0 : if( bIsValid )
399 : {
400 0 : rEdit.SetControlForeground();
401 0 : rEdit.SetControlBackground();
402 : }
403 : else
404 : {
405 0 : rEdit.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR );
406 0 : rEdit.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR );
407 : }
408 :
409 0 : return bIsValid;
410 : }
411 :
412 0 : bool DataSourceTabPage::isValid()
413 : {
414 0 : bool bRoleRangeValid = true;
415 0 : bool bCategoriesRangeValid = true;
416 0 : bool bHasSelectedEntry = (m_apLB_SERIES->FirstSelected() != 0);
417 :
418 0 : if( bHasSelectedEntry )
419 0 : bRoleRangeValid = isRangeFieldContentValid( m_aEDT_RANGE );
420 0 : if( m_aEDT_CATEGORIES.IsEnabled() )
421 0 : bCategoriesRangeValid = isRangeFieldContentValid( m_aEDT_CATEGORIES );
422 0 : bool bValid = ( bRoleRangeValid && bCategoriesRangeValid );
423 :
424 0 : if( m_pTabPageNotifiable )
425 : {
426 0 : if( bValid )
427 0 : m_pTabPageNotifiable->setValidPage( this );
428 : else
429 0 : m_pTabPageNotifiable->setInvalidPage( this );
430 : }
431 :
432 0 : return bValid;
433 : }
434 :
435 0 : void DataSourceTabPage::setDirty()
436 : {
437 0 : m_bIsDirty = true;
438 0 : }
439 :
440 0 : void DataSourceTabPage::updateControlsFromDialogModel()
441 : {
442 : // series
443 0 : fillSeriesListBox();
444 0 : SeriesSelectionChangedHdl( 0 );
445 :
446 : // categories
447 0 : m_aEDT_CATEGORIES.SetText( String( m_rDialogModel.getCategoriesRange() ));
448 :
449 0 : updateControlState();
450 0 : }
451 :
452 0 : void DataSourceTabPage::fillSeriesListBox()
453 : {
454 0 : m_apLB_SERIES->SetUpdateMode( sal_False );
455 :
456 0 : Reference< XDataSeries > xSelected;
457 0 : SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
458 0 : if( pEntry )
459 0 : xSelected.set( pEntry->m_xDataSeries );
460 :
461 0 : bool bHasSelectedEntry = (pEntry != 0);
462 0 : SvTreeListEntry * pSelectedEntry = 0;
463 0 : m_apLB_SERIES->Clear();
464 :
465 : ::std::vector< DialogModel::tSeriesWithChartTypeByName > aSeries(
466 0 : m_rDialogModel.getAllDataSeriesWithLabel() );
467 :
468 0 : sal_Int32 nUnnamedSeriesIndex = 1;
469 0 : for( ::std::vector< DialogModel::tSeriesWithChartTypeByName >::const_iterator aIt = aSeries.begin();
470 0 : aIt != aSeries.end(); ++aIt )
471 : {
472 0 : String aLabel( (*aIt).first );
473 0 : if( !aLabel.Len())
474 : {
475 0 : if( nUnnamedSeriesIndex > 1 )
476 : {
477 0 : OUString aResString( String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES_WITH_INDEX )));
478 :
479 : // replace index of unnamed series
480 0 : const OUString aReplacementStr( "%NUMBER" );
481 0 : sal_Int32 nIndex = aResString.indexOf( aReplacementStr );
482 0 : if( nIndex != -1 )
483 : aLabel = String( aResString.replaceAt(
484 : nIndex, aReplacementStr.getLength(),
485 0 : rtl::OUString::valueOf(nUnnamedSeriesIndex)));
486 : }
487 0 : if( aLabel.Len() == 0 )
488 0 : aLabel = String( ::chart::SchResId( STR_DATA_UNNAMED_SERIES ));
489 :
490 0 : ++nUnnamedSeriesIndex;
491 : }
492 : pEntry = dynamic_cast< SeriesEntry * >(
493 0 : m_apLB_SERIES->InsertEntry( aLabel ));
494 0 : if( pEntry )
495 : {
496 0 : pEntry->m_xDataSeries.set( (*aIt).second.first );
497 0 : pEntry->m_xChartType.set( (*aIt).second.second );
498 0 : if( bHasSelectedEntry && ((*aIt).second.first == xSelected))
499 0 : pSelectedEntry = pEntry;
500 : }
501 0 : }
502 :
503 0 : if( bHasSelectedEntry && pSelectedEntry )
504 0 : m_apLB_SERIES->Select( pSelectedEntry );
505 :
506 0 : m_apLB_SERIES->SetUpdateMode( sal_True );
507 0 : }
508 :
509 0 : void DataSourceTabPage::fillRoleListBox()
510 : {
511 0 : SeriesEntry * pSeriesEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
512 0 : bool bHasSelectedEntry = (pSeriesEntry != 0);
513 :
514 0 : SvTreeListEntry * pRoleEntry = m_aLB_ROLE.FirstSelected();
515 0 : sal_uLong nRoleIndex = SAL_MAX_UINT32;
516 0 : if( pRoleEntry )
517 0 : nRoleIndex = m_aLB_ROLE.GetModel()->GetAbsPos( pRoleEntry );
518 :
519 0 : if( bHasSelectedEntry )
520 : {
521 : DialogModel::tRolesWithRanges aRoles(
522 : m_rDialogModel.getRolesWithRanges(
523 : pSeriesEntry->m_xDataSeries,
524 : lcl_GetSequenceNameForLabel( pSeriesEntry ),
525 0 : pSeriesEntry->m_xChartType ));
526 :
527 : // fill role list
528 0 : m_aLB_ROLE.SetUpdateMode( sal_False );
529 0 : m_aLB_ROLE.Clear();
530 0 : m_aLB_ROLE.RemoveSelection();
531 :
532 0 : for( DialogModel::tRolesWithRanges::const_iterator aIt( aRoles.begin());
533 0 : aIt != aRoles.end(); ++ aIt )
534 : {
535 0 : m_aLB_ROLE.InsertEntry( lcl_GetRoleLBEntry( aIt->first, aIt->second ));
536 : }
537 :
538 : // series may contain no roles, check listbox size before selecting entries
539 0 : if( m_aLB_ROLE.GetEntryCount() > 0 )
540 : {
541 0 : if( nRoleIndex >= m_aLB_ROLE.GetEntryCount())
542 0 : nRoleIndex = 0;
543 0 : m_aLB_ROLE.Select( m_aLB_ROLE.GetEntry( nRoleIndex ));
544 : }
545 :
546 0 : m_aLB_ROLE.SetUpdateMode( sal_True );
547 : }
548 0 : }
549 :
550 0 : void DataSourceTabPage::updateControlState()
551 : {
552 0 : SvTreeListEntry * pSeriesEntry = m_apLB_SERIES->FirstSelected();
553 0 : bool bHasSelectedSeries = (pSeriesEntry != 0);
554 0 : bool bHasValidRole = false;
555 0 : bool bHasRangeChooser = m_rDialogModel.getRangeSelectionHelper()->hasRangeSelection();
556 :
557 0 : if( bHasSelectedSeries )
558 : {
559 0 : SvTreeListEntry * pRoleEntry = m_aLB_ROLE.FirstSelected();
560 0 : bHasValidRole = (pRoleEntry != 0);
561 : }
562 :
563 0 : m_aBTN_ADD.Enable( true );
564 0 : m_aBTN_REMOVE.Enable( bHasSelectedSeries );
565 :
566 0 : m_aBTN_UP.Enable( bHasSelectedSeries && (pSeriesEntry != m_apLB_SERIES->First()));
567 0 : m_aBTN_DOWN.Enable( bHasSelectedSeries && (pSeriesEntry != m_apLB_SERIES->Last()));
568 :
569 0 : bool bHasCategories = m_rDialogModel.isCategoryDiagram();
570 :
571 0 : m_aFT_DATALABELS.Show(!bHasCategories);
572 0 : m_aFT_CATEGORIES.Show( bHasCategories);
573 0 : sal_Bool bShowIB = bHasRangeChooser;
574 0 : lcl_ShowChooserButton( m_aIMB_RANGE_CAT, m_aEDT_CATEGORIES, bShowIB );
575 :
576 0 : m_aFT_SERIES.Enable();
577 0 : m_apLB_SERIES->Enable();
578 :
579 0 : m_aFT_ROLE.Enable( bHasSelectedSeries );
580 0 : m_aLB_ROLE.Enable( bHasSelectedSeries );
581 :
582 0 : m_aFT_RANGE.Enable( bHasValidRole );
583 0 : m_aEDT_RANGE.Enable( bHasValidRole );
584 0 : lcl_ShowChooserButton( m_aIMB_RANGE_MAIN, m_aEDT_RANGE, bShowIB );
585 0 : isValid();
586 0 : }
587 :
588 0 : IMPL_LINK_NOARG(DataSourceTabPage, SeriesSelectionChangedHdl)
589 : {
590 0 : m_rDialogModel.startControllerLockTimer();
591 0 : if( m_apLB_SERIES->FirstSelected())
592 : {
593 0 : fillRoleListBox();
594 0 : RoleSelectionChangedHdl( 0 );
595 : }
596 0 : updateControlState();
597 :
598 0 : return 0;
599 : }
600 :
601 0 : IMPL_LINK_NOARG(DataSourceTabPage, RoleSelectionChangedHdl)
602 : {
603 0 : m_rDialogModel.startControllerLockTimer();
604 0 : SvTreeListEntry * pEntry = m_aLB_ROLE.FirstSelected();
605 0 : if( pEntry )
606 : {
607 0 : OUString aRange( m_aEDT_RANGE.GetText());
608 0 : OUString aSelectedRoleUI = lcl_GetSelectedRole( m_aLB_ROLE, true );
609 0 : OUString aSelectedRange = lcl_GetSelectedRolesRange( m_aLB_ROLE );
610 :
611 : // replace role in fixed text label
612 0 : const OUString aReplacementStr( "%VALUETYPE" );
613 0 : sal_Int32 nIndex = m_aFixedTextRange.indexOf( aReplacementStr );
614 0 : if( nIndex != -1 )
615 : {
616 : m_aFT_RANGE.SetText(
617 : String( m_aFixedTextRange.replaceAt(
618 0 : nIndex, aReplacementStr.getLength(), aSelectedRoleUI )));
619 : }
620 :
621 0 : m_aEDT_RANGE.SetText( String( aSelectedRange ));
622 0 : isValid();
623 : }
624 :
625 0 : return 0;
626 : }
627 :
628 0 : IMPL_LINK_NOARG(DataSourceTabPage, MainRangeButtonClickedHdl)
629 : {
630 : OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
631 0 : m_pCurrentRangeChoosingField = & m_aEDT_RANGE;
632 0 : if( m_aEDT_RANGE.GetText().Len() > 0 &&
633 0 : ! updateModelFromControl( m_pCurrentRangeChoosingField ))
634 0 : return 0;
635 :
636 0 : SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
637 0 : bool bHasSelectedEntry = (pEntry != 0);
638 :
639 0 : OUString aSelectedRolesRange = lcl_GetSelectedRolesRange( m_aLB_ROLE );
640 :
641 0 : if( bHasSelectedEntry && (m_aLB_ROLE.FirstSelected() != 0))
642 : {
643 0 : String aStr( SchResId( STR_DATA_SELECT_RANGE_FOR_SERIES ));
644 0 : OUString aUIStr( aStr );
645 :
646 : // replace role
647 0 : OUString aReplacement( "%VALUETYPE" );
648 0 : sal_Int32 nIndex = aUIStr.indexOf( aReplacement );
649 0 : if( nIndex != -1 )
650 : {
651 : aUIStr = aUIStr.replaceAt( nIndex, aReplacement.getLength(),
652 0 : lcl_GetSelectedRole( m_aLB_ROLE, true ));
653 : }
654 : // replace series name
655 0 : aReplacement = "%SERIESNAME";
656 0 : nIndex = aUIStr.indexOf( aReplacement );
657 0 : if( nIndex != -1 )
658 : {
659 : aUIStr = aUIStr.replaceAt( nIndex, aReplacement.getLength(),
660 0 : OUString( m_apLB_SERIES->GetEntryText( pEntry )));
661 : }
662 :
663 0 : lcl_enableRangeChoosing( true, m_pParentDialog );
664 0 : m_rDialogModel.getRangeSelectionHelper()->chooseRange( aSelectedRolesRange, aUIStr, *this );
665 : }
666 : else
667 0 : m_pCurrentRangeChoosingField = 0;
668 :
669 0 : return 0;
670 : }
671 :
672 0 : IMPL_LINK_NOARG(DataSourceTabPage, CategoriesRangeButtonClickedHdl)
673 : {
674 : OSL_ASSERT( m_pCurrentRangeChoosingField == 0 );
675 0 : m_pCurrentRangeChoosingField = & m_aEDT_CATEGORIES;
676 0 : if( m_aEDT_CATEGORIES.GetText().Len() > 0 &&
677 0 : ! updateModelFromControl( m_pCurrentRangeChoosingField ))
678 0 : return 0;
679 :
680 0 : String aStr( SchResId( m_aFT_CATEGORIES.IsVisible() ? STR_DATA_SELECT_RANGE_FOR_CATEGORIES : STR_DATA_SELECT_RANGE_FOR_DATALABELS ));
681 0 : lcl_enableRangeChoosing( true, m_pParentDialog );
682 : m_rDialogModel.getRangeSelectionHelper()->chooseRange(
683 0 : m_rDialogModel.getCategoriesRange(), OUString( aStr ), *this );
684 0 : return 0;
685 : }
686 :
687 0 : IMPL_LINK_NOARG(DataSourceTabPage, AddButtonClickedHdl)
688 : {
689 0 : m_rDialogModel.startControllerLockTimer();
690 0 : SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
691 0 : Reference< XDataSeries > xSeriesToInsertAfter;
692 0 : Reference< XChartType > xChartTypeForNewSeries;
693 0 : if( m_pTemplateProvider )
694 0 : m_rDialogModel.setTemplate( m_pTemplateProvider->getCurrentTemplate());
695 :
696 0 : if( pEntry )
697 : {
698 0 : xSeriesToInsertAfter.set( pEntry->m_xDataSeries );
699 0 : xChartTypeForNewSeries.set( pEntry->m_xChartType );
700 : }
701 : else
702 : {
703 : ::std::vector< Reference< XDataSeriesContainer > > aCntVec(
704 0 : m_rDialogModel.getAllDataSeriesContainers());
705 0 : if( ! aCntVec.empty())
706 0 : xChartTypeForNewSeries.set( aCntVec.front(), uno::UNO_QUERY );
707 : }
708 : OSL_ENSURE( xChartTypeForNewSeries.is(), "Cannot insert new series" );
709 :
710 0 : m_rDialogModel.insertSeriesAfter( xSeriesToInsertAfter, xChartTypeForNewSeries );
711 0 : setDirty();
712 :
713 0 : fillSeriesListBox();
714 : // note the box was cleared and refilled, so pEntry is invalid now
715 0 : SvTreeListEntry * pSelEntry = m_apLB_SERIES->FirstSelected();
716 0 : if( pSelEntry )
717 : {
718 0 : SvTreeListEntry * pNextEntry = m_apLB_SERIES->Next( pSelEntry );
719 0 : if( pNextEntry )
720 0 : m_apLB_SERIES->Select( pNextEntry );
721 : }
722 0 : SeriesSelectionChangedHdl( 0 );
723 :
724 0 : return 0;
725 : }
726 :
727 0 : IMPL_LINK_NOARG(DataSourceTabPage, RemoveButtonClickedHdl)
728 : {
729 0 : m_rDialogModel.startControllerLockTimer();
730 0 : SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
731 0 : if( pEntry )
732 : {
733 0 : Reference< XDataSeries > xNewSelSeries;
734 : SeriesEntry * pNewSelEntry = dynamic_cast< SeriesEntry * >(
735 0 : m_apLB_SERIES->Next( pEntry ));
736 0 : if( pNewSelEntry )
737 0 : xNewSelSeries.set( pNewSelEntry->m_xDataSeries );
738 : else
739 : {
740 0 : pNewSelEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->Prev( pEntry ));
741 0 : if( pNewSelEntry )
742 0 : xNewSelSeries.set( pNewSelEntry->m_xDataSeries );
743 : }
744 :
745 0 : m_rDialogModel.deleteSeries( pEntry->m_xDataSeries, pEntry->m_xChartType );
746 0 : setDirty();
747 :
748 0 : m_apLB_SERIES->RemoveSelection();
749 0 : fillSeriesListBox();
750 :
751 : // select previous or next series
752 : //@improve: see methods GetModel()->GetAbsPos()/GetEntry() for absoulte list positions
753 0 : if( xNewSelSeries.is())
754 : {
755 0 : pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->First());
756 0 : while( pEntry )
757 : {
758 0 : if( pEntry->m_xDataSeries == xNewSelSeries )
759 : {
760 0 : m_apLB_SERIES->Select( pEntry );
761 0 : break;
762 : }
763 0 : pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->Next( pEntry ));
764 : }
765 : }
766 0 : SeriesSelectionChangedHdl( 0 );
767 : }
768 :
769 0 : return 0;
770 : }
771 :
772 0 : IMPL_LINK_NOARG(DataSourceTabPage, UpButtonClickedHdl)
773 : {
774 0 : m_rDialogModel.startControllerLockTimer();
775 0 : SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
776 0 : bool bHasSelectedEntry = (pEntry != 0);
777 :
778 0 : if( bHasSelectedEntry )
779 : {
780 0 : m_rDialogModel.moveSeries( pEntry->m_xDataSeries, DialogModel::MOVE_UP );
781 0 : setDirty();
782 0 : fillSeriesListBox();
783 0 : SeriesSelectionChangedHdl(0);
784 : }
785 :
786 0 : return 0;
787 : }
788 :
789 0 : IMPL_LINK_NOARG(DataSourceTabPage, DownButtonClickedHdl)
790 : {
791 0 : m_rDialogModel.startControllerLockTimer();
792 0 : SeriesEntry * pEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
793 0 : bool bHasSelectedEntry = (pEntry != 0);
794 :
795 0 : if( bHasSelectedEntry )
796 : {
797 0 : m_rDialogModel.moveSeries( pEntry->m_xDataSeries, DialogModel::MOVE_DOWN );
798 0 : setDirty();
799 0 : fillSeriesListBox();
800 0 : SeriesSelectionChangedHdl(0);
801 : }
802 :
803 0 : return 0;
804 : }
805 :
806 0 : IMPL_LINK( DataSourceTabPage, RangeModifiedHdl, Edit*, pEdit )
807 : {
808 0 : if( isRangeFieldContentValid( *pEdit ))
809 0 : setDirty();
810 :
811 : // enable/disable OK button
812 0 : isValid();
813 :
814 0 : return 0;
815 : }
816 :
817 0 : IMPL_LINK( DataSourceTabPage, RangeUpdateDataHdl, Edit*, pEdit )
818 : {
819 : // note: isValid sets the color of the edit field
820 0 : if( isRangeFieldContentValid( *pEdit ))
821 : {
822 0 : setDirty();
823 0 : updateModelFromControl( pEdit );
824 0 : if( pEdit== &m_aEDT_RANGE )
825 : {
826 0 : if( ! lcl_UpdateCurrentSeriesName( *m_apLB_SERIES ))
827 0 : fillSeriesListBox();
828 : }
829 : }
830 : // enable/disable OK button
831 0 : isValid();
832 :
833 0 : return 0;
834 : }
835 :
836 0 : void DataSourceTabPage::listeningFinished(
837 : const ::rtl::OUString & rNewRange )
838 : {
839 : // rNewRange becomes invalid after removing the listener
840 0 : OUString aRange( rNewRange );
841 :
842 0 : m_rDialogModel.startControllerLockTimer();
843 :
844 : // stop listening
845 0 : m_rDialogModel.getRangeSelectionHelper()->stopRangeListening();
846 :
847 : // change edit field
848 0 : ToTop();
849 0 : GrabFocus();
850 0 : if( m_pCurrentRangeChoosingField )
851 : {
852 0 : m_pCurrentRangeChoosingField->SetText( String( aRange ));
853 0 : m_pCurrentRangeChoosingField->GrabFocus();
854 : }
855 :
856 0 : if( m_pCurrentRangeChoosingField == & m_aEDT_RANGE )
857 : {
858 0 : m_aEDT_RANGE.SetText( String( aRange ));
859 0 : setDirty();
860 : }
861 0 : else if( m_pCurrentRangeChoosingField == & m_aEDT_CATEGORIES )
862 : {
863 0 : m_aEDT_CATEGORIES.SetText( String( aRange ));
864 0 : setDirty();
865 : }
866 :
867 0 : updateModelFromControl( m_pCurrentRangeChoosingField );
868 0 : if( ! lcl_UpdateCurrentSeriesName( *m_apLB_SERIES ))
869 0 : fillSeriesListBox();
870 :
871 0 : m_pCurrentRangeChoosingField = 0;
872 :
873 0 : updateControlState();
874 0 : lcl_enableRangeChoosing( false, m_pParentDialog );
875 0 : }
876 :
877 0 : void DataSourceTabPage::disposingRangeSelection()
878 : {
879 0 : m_rDialogModel.getRangeSelectionHelper()->stopRangeListening( false );
880 0 : }
881 :
882 0 : bool DataSourceTabPage::updateModelFromControl( Edit * pField )
883 : {
884 0 : if( !m_bIsDirty )
885 0 : return true;
886 :
887 0 : ControllerLockGuard aLockedControllers( m_rDialogModel.getChartModel() );
888 :
889 : // @todo: validity check of field content
890 0 : bool bResult = true;
891 0 : bool bAll = (pField == 0);
892 0 : Reference< data::XDataProvider > xDataProvider( m_rDialogModel.getDataProvider());
893 :
894 0 : if( bAll || (pField == & m_aEDT_CATEGORIES) )
895 : {
896 0 : Reference< data::XLabeledDataSequence > xLabeledSeq( m_rDialogModel.getCategories() );
897 0 : if( xDataProvider.is())
898 : {
899 0 : OUString aRange( m_aEDT_CATEGORIES.GetText());
900 0 : if( !aRange.isEmpty())
901 : {
902 : // create or change categories
903 0 : if( !xLabeledSeq.is())
904 : {
905 0 : xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
906 0 : m_rDialogModel.setCategories( xLabeledSeq );
907 : }
908 : try
909 : {
910 0 : xLabeledSeq->setValues( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
911 : }
912 0 : catch( const uno::Exception & ex )
913 : {
914 : // should work as validation should have happened before
915 : ASSERT_EXCEPTION( ex );
916 : }
917 : }
918 0 : else if( xLabeledSeq.is())
919 : {
920 : // clear existing categories
921 0 : xLabeledSeq.set(0);
922 0 : m_rDialogModel.setCategories( xLabeledSeq );
923 0 : }
924 0 : }
925 : }
926 :
927 0 : SeriesEntry * pSeriesEntry = dynamic_cast< SeriesEntry * >( m_apLB_SERIES->FirstSelected());
928 0 : bool bHasSelectedEntry = (pSeriesEntry != 0);
929 :
930 0 : if( bHasSelectedEntry )
931 : {
932 0 : if( bAll || (pField == & m_aEDT_RANGE) )
933 : {
934 : try
935 : {
936 0 : OUString aSelectedRole = lcl_GetSelectedRole( m_aLB_ROLE );
937 0 : OUString aRange( m_aEDT_RANGE.GetText());
938 0 : OUString aSequenceRole( aSelectedRole );
939 0 : bool bIsLabel = (aSequenceRole == lcl_aLabelRole );
940 0 : OUString aSequenceNameForLabel( lcl_GetSequenceNameForLabel( pSeriesEntry ));
941 :
942 0 : if( bIsLabel )
943 0 : aSequenceRole = aSequenceNameForLabel;
944 :
945 0 : Reference< data::XDataSource > xSource( pSeriesEntry->m_xDataSeries, uno::UNO_QUERY_THROW );
946 : Reference< data::XLabeledDataSequence > xLabeledSeq(
947 0 : DataSeriesHelper::getDataSequenceByRole( xSource, aSequenceRole ));
948 :
949 0 : if( xDataProvider.is())
950 : {
951 0 : if( bIsLabel )
952 : {
953 0 : if( ! xLabeledSeq.is())
954 : {
955 : // check if there is already an "orphan" label sequence
956 0 : xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
957 0 : if( ! xLabeledSeq.is())
958 : {
959 : // no corresponding labeled data sequence for label found
960 0 : xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
961 0 : lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
962 : }
963 : }
964 0 : if( xLabeledSeq.is())
965 : {
966 0 : if( !aRange.isEmpty())
967 : {
968 0 : Reference< data::XDataSequence > xNewSeq;
969 : try
970 : {
971 0 : xNewSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
972 : }
973 0 : catch( const uno::Exception & ex )
974 : {
975 : // should work as validation should have happened before
976 : ASSERT_EXCEPTION( ex );
977 : }
978 0 : if( xNewSeq.is())
979 : {
980 : // update range name by the full string provided
981 : // by the data provider. E.g. "a1" might become
982 : // "$Sheet1.$A$1"
983 0 : aRange = xNewSeq->getSourceRangeRepresentation();
984 0 : Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
985 0 : xProp->setPropertyValue( "Role" , uno::makeAny( lcl_aLabelRole ));
986 0 : xLabeledSeq->setLabel( xNewSeq );
987 0 : }
988 : }
989 : else
990 : {
991 0 : xLabeledSeq->setLabel( Reference< data::XDataSequence >());
992 : }
993 : }
994 : }
995 : else
996 : {
997 0 : if( !aRange.isEmpty())
998 : {
999 0 : Reference< data::XDataSequence > xNewSeq;
1000 : try
1001 : {
1002 0 : xNewSeq.set( xDataProvider->createDataSequenceByRangeRepresentation( aRange ));
1003 : }
1004 0 : catch( const uno::Exception & ex )
1005 : {
1006 : // should work as validation should have happened before
1007 : ASSERT_EXCEPTION( ex );
1008 : }
1009 0 : if( xNewSeq.is())
1010 : {
1011 : // update range name by the full string provided
1012 : // by the data provider. E.g. "a1:e1" might become
1013 : // "$Sheet1.$A$1:$E$1"
1014 0 : aRange = xNewSeq->getSourceRangeRepresentation();
1015 :
1016 0 : Reference< beans::XPropertySet > xProp( xNewSeq, uno::UNO_QUERY_THROW );
1017 0 : xProp->setPropertyValue( "Role" , uno::makeAny( aSelectedRole ));
1018 0 : if( !xLabeledSeq.is())
1019 : {
1020 0 : if( aSelectedRole == aSequenceNameForLabel )
1021 0 : xLabeledSeq.set( lcl_findLSequenceWithOnlyLabel( xSource ));
1022 0 : if( ! xLabeledSeq.is())
1023 : {
1024 0 : xLabeledSeq.set( DataSourceHelper::createLabeledDataSequence( Reference< uno::XComponentContext >(0)));
1025 0 : lcl_addLSequenceToDataSource( xLabeledSeq, xSource );
1026 : }
1027 : }
1028 0 : xLabeledSeq->setValues( xNewSeq );
1029 0 : }
1030 : }
1031 : }
1032 : }
1033 :
1034 0 : lcl_UpdateCurrentRange( m_aLB_ROLE, aSelectedRole, aRange );
1035 : }
1036 0 : catch( const uno::Exception & ex )
1037 : {
1038 0 : bResult = false;
1039 : ASSERT_EXCEPTION( ex );
1040 : }
1041 : }
1042 : }
1043 :
1044 : // update View
1045 : // @todo remove this when automatic view updates from calc, writer and own data sequences are available
1046 0 : if( bResult )
1047 : {
1048 : try
1049 : {
1050 0 : Reference< util::XModifiable > xModifiable( m_rDialogModel.getChartModel(), uno::UNO_QUERY );
1051 0 : if( xModifiable.is() )
1052 0 : xModifiable->setModified( sal_True );
1053 : }
1054 0 : catch( const uno::Exception & ex )
1055 : {
1056 : ASSERT_EXCEPTION( ex );
1057 : }
1058 : }
1059 :
1060 0 : return bResult;
1061 : }
1062 :
1063 3 : } // namespace chart
1064 :
1065 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|