diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 19:14:55 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 19:14:55 +0000 |
commit | 3f1dfde497d94b1d8b440b0ce4d7e673e3562767 (patch) | |
tree | 992861c7e590479250ecac983a7632bf60ae4141 /sc/source/ui/view/tabvwshb.cxx | |
parent | a632f756e54c507220833696b69e52620a8ab4c8 (diff) |
INTEGRATION: CWS chart2mst3 (1.26.10); FILE MERGED
2007/04/25 04:17:06 bm 1.26.10.8: RESYNC: (1.33-1.34); FILE MERGED
2006/11/24 18:34:58 bm 1.26.10.7: RESYNC: (1.31-1.33); FILE MERGED
2006/11/20 13:39:22 nn 1.26.10.6: #i71560# remove old chart dialog
2006/11/07 07:58:01 nn 1.26.10.5: #i71250# remove unused include
2006/10/25 18:17:37 nn 1.26.10.4: allow range selection from inplace object without deactivating the object
2006/10/19 00:56:26 bm 1.26.10.3: RESYNC: (1.28-1.31); FILE MERGED
2006/05/05 15:33:32 bm 1.26.10.2: RESYNC: (1.26-1.28); FILE MERGED
2005/12/02 13:32:09 bm 1.26.10.1: #i58786# on activation of charts instantiate an ScChartRangeSelectionListener for showing selected ranges
Diffstat (limited to 'sc/source/ui/view/tabvwshb.cxx')
-rw-r--r-- | sc/source/ui/view/tabvwshb.cxx | 80 |
1 files changed, 31 insertions, 49 deletions
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index a67e2510b9ed..4bf973640d50 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -4,9 +4,9 @@ * * $RCSfile: tabvwshb.cxx,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: vg $ $Date: 2007-02-27 13:59:19 $ + * last change: $Author: vg $ $Date: 2007-05-22 20:14:55 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -39,6 +39,9 @@ #ifndef _COM_SUN_STAR_EMBED_NOVISUALAREASIZEEXCEPTION_HPP_ #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #endif +#ifndef _COM_SUN_STAR_CHART2_DATA_XDATARECEIVER_HPP_ +#include <com/sun/star/chart2/data/XDataReceiver.hpp> +#endif @@ -73,8 +76,6 @@ #include <svtools/rectitem.hxx> #include <svtools/whiter.hxx> #include <svtools/moduleoptions.hxx> -#include <sch/schdll.hxx> -#include <sch/memchrt.hxx> #include <sot/exchange.hxx> #include "tabvwsh.hxx" @@ -87,6 +88,7 @@ #include "docsh.hxx" #include "chartarr.hxx" #include "drawview.hxx" +#include "ChartRangeSelectionListener.hxx" using namespace com::sun::star; @@ -186,55 +188,38 @@ BOOL ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) ((ScClient*)pClient)->SetGrafEdit( NULL ); - // Link fuer Daten-Highlighting im Chart setzen + nErr = pClient->DoVerb( nVerb ); + bErrorShown = TRUE; + // SfxViewShell::DoVerb zeigt seine Fehlermeldungen selber an + + // attach listener to selection changes in chart that affect cell + // ranges, so those can be highlighted + // note: do that after DoVerb, so that the chart controller exists if ( SvtModuleOptions().IsChart() ) { SvGlobalName aObjClsId ( xObj->getClassID() ); if (SotExchange::IsChart( aObjClsId )) { - SchMemChart* pMemChart = SchDLL::GetChartData(xObj); - if (pMemChart) + try { - // set handler for highlighting cell ranges - // for selection inside the chart - pMemChart->SetSelectionHdl( LINK( GetViewData()->GetDocShell(), - ScDocShell, ChartSelectionHdl ) ); - - // #96148# if an unmodified chart in a 5.2-document is edited - // after swapping out and in again, the ChartRange has to be set - // (from SomeData strings) again, or SetReadOnly doesn't work - if ( pMemChart->SomeData1().Len() && pMemChart->GetChartRange().maRanges.size() == 0 ) + uno::Reference < embed::XComponentSupplier > xSup( xObj, uno::UNO_QUERY_THROW ); + uno::Reference< chart2::data::XDataReceiver > xDataReceiver( + xSup->getComponent(), uno::UNO_QUERY_THROW ); + uno::Reference< chart2::data::XRangeHighlighter > xRangeHightlighter( + xDataReceiver->getRangeHighlighter()); + if( xRangeHightlighter.is()) { - ScChartArray aArray( GetViewData()->GetDocument(), *pMemChart ); - if ( aArray.IsValid() ) - aArray.SetExtraStrings( *pMemChart ); + uno::Reference< view::XSelectionChangeListener > xListener( + new ScChartRangeSelectionListener( this )); + xRangeHightlighter->addSelectionChangeListener( xListener ); } - - // #102706# After loaded, a chart doesn't know our - // number formatter, therefor new formats added in the - // meantime aren't available in the chart's number - // formatter dialog. Set the formatter here. The - // original bug was the SourceFormat checkbox not being - // available, but that is a problem of the chart. - pMemChart->SetNumberFormatter( GetViewData()->GetDocument()->GetFormatTable() ); - - // disable DataBrowseBox for editing chart data - pMemChart->SetReadOnly( TRUE ); - - // #102706# The new NumberFormatter is set at the - // SchMemChart, but not at the corresponding - // ChartModel. Therefore, an Update is needed, because - // the MemChart doesn't know its ChartModel. - - // TODO/LATER: Looks like there is no need to update the replacement, since the object will be activated. - SchDLL::Update( xObj, pMemChart ); + } + catch( const uno::Exception & ) + { + DBG_ERROR( "Exception caught while querying chart" ); } } } - - nErr = pClient->DoVerb( nVerb ); - bErrorShown = TRUE; - // SfxViewShell::DoVerb zeigt seine Fehlermeldungen selber an } } if (nErr != ERRCODE_NONE && !bErrorShown) @@ -284,8 +269,11 @@ void ScTabViewShell::DeactivateOle() { // deactivate inplace editing if currently active + ScModule* pScMod = SC_MOD(); + bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF; + ScClient* pClient = (ScClient*) GetIPClient(); - if ( pClient && pClient->IsObjectInPlaceActive() ) + if ( pClient && pClient->IsObjectInPlaceActive() && !bUnoRefDialog ) pClient->DeactivateObject(); } @@ -465,16 +453,10 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet) switch ( nWhich ) { case SID_INSERT_DIAGRAM: - case SID_OPENDLG_CHART: if ( bOle || bTabProt || !SvtModuleOptions().IsChart() ) rSet.DisableItem( nWhich ); break; - case SID_OPENDLG_MODCHART: - if ( bTabProt || !GetSelectedChartName().Len() ) - rSet.DisableItem( nWhich ); - break; - case SID_INSERT_SMATH: if ( bOle || bTabProt || !SvtModuleOptions().IsMath() ) rSet.DisableItem( nWhich ); |