xref: /aoo41x/main/sc/inc/charthelper.hxx (revision fd44edf3)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_CHARTHELPER_HXX
25 #define SC_CHARTHELPER_HXX
26 
27 #include <tools/solar.h>
28 #include "address.hxx"
29 #include "global.hxx"
30 #include "rangelst.hxx"
31 
32 #include <com/sun/star/chart2/XChartDocument.hpp>
33 
34 #include <vector>
35 
36 class SdrObject;
37 class SdrPage;
38 class ScModelObj;
39 
40 typedef ::std::vector< ScRangeList > ScRangeListVector;
41 
42 /** Use this to handle charts in a calc document
43 */
44 class ScChartHelper
45 {
46 public:
47     static sal_uInt16 DoUpdateAllCharts( ScDocument* pDoc );
48     static sal_uInt16 DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc ); //use this to replace ScDBFunc::DoUpdateCharts in future
49     static void AdjustRangesOfChartsOnDestinationPage( ScDocument* pSrcDoc, ScDocument* pDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab );
50 	static void UpdateChartsOnDestinationPage( ScDocument* pDestDoc, const SCTAB nDestTab );
51     static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartFromSdrObject( SdrObject* pObject );
52     static void GetChartRanges( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc,
53             ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges );
54     static void SetChartRanges( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc,
55             const ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges );
56 
57     static void AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrObject* pObject );
58     static void FillProtectedChartRangesVector( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrPage* pPage );
59     static void GetChartNames( ::std::vector< ::rtl::OUString >& rChartNames, SdrPage* pPage );
60     static void CreateProtectedChartListenersAndNotify( ScDocument* pDoc, SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab,
61         const ScRangeListVector& rRangesVector, const ::std::vector< ::rtl::OUString >& rExcludedChartNames, bool bSameDoc = true );
62 };
63 
64 #endif
65