1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChartRangeSelectionListener.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #include "ChartRangeSelectionListener.hxx"
36 #include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
38 #include <sfx2/viewfrm.hxx>
39 #include "tabvwsh.hxx"
40 #include "unonames.hxx"
41 #include "miscuno.hxx"
43 using namespace ::com::sun::star
;
45 using ::com::sun::star::uno::Reference
;
46 using ::com::sun::star::uno::Sequence
;
47 using ::rtl::OUString
;
49 SC_SIMPLE_SERVICE_INFO( ScChartRangeSelectionListener
, "ScChartRangeSelectionListener",
50 SC_SERVICENAME_CHRANGEHILIGHT
)
52 ScChartRangeSelectionListener::ScChartRangeSelectionListener( ScTabViewShell
* pViewShell
) :
53 ScChartRangeSelectionListener_Base( m_aMutex
),
54 m_pViewShell( pViewShell
)
57 ScChartRangeSelectionListener::~ScChartRangeSelectionListener()
60 // ____ XModifyListener ____
61 void SAL_CALL
ScChartRangeSelectionListener::selectionChanged( const lang::EventObject
& aEvent
)
62 throw (uno::RuntimeException
)
64 Reference
< chart2::data::XRangeHighlighter
> xRangeHighlighter( aEvent
.Source
, uno::UNO_QUERY
);
65 if( xRangeHighlighter
.is())
67 Sequence
< chart2::data::HighlightedRange
> aRanges( xRangeHighlighter
->getSelectedRanges());
69 // search the view on which the chart is active
73 m_pViewShell
->DoChartSelection( aRanges
);
75 // SfxViewFrame *pFrame = SfxViewFrame::GetFirst( m_pDocShell );
78 // SfxViewShell* pSh = pFrame->GetViewShell();
79 // if (pSh && pSh->ISA(ScTabViewShell))
81 // ScTabViewShell* pViewSh = (ScTabViewShell*)pSh;
83 // pFrame = SfxViewFrame::GetNext( *pFrame, m_pDocShell );
88 // ____ XEventListener ____
89 void SAL_CALL
ScChartRangeSelectionListener::disposing( const lang::EventObject
& /*Source*/ )
90 throw (uno::RuntimeException
)
94 // ____ WeakComponentImplHelperBase ____
95 void SAL_CALL
ScChartRangeSelectionListener::disposing()