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