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 CHART2_CHARTMODELCLONE_HXX
25 #define CHART2_CHARTMODELCLONE_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <com/sun/star/chart2/XInternalDataProvider.hpp>
30 /** === end UNO includes === **/
31 
32 #include <boost/noncopyable.hpp>
33 
34 //......................................................................................................................
35 namespace chart
36 {
37 //......................................................................................................................
38 
39 	//==================================================================================================================
40 	//= ModelFacet
41 	//==================================================================================================================
42     enum ModelFacet
43     {
44         E_MODEL,
45         E_MODEL_WITH_DATA,
46         E_MODEL_WITH_SELECTION
47     };
48 
49 	//==================================================================================================================
50 	//= ChartModelClone
51 	//==================================================================================================================
52     class ChartModelClone : public ::boost::noncopyable
53     {
54     public:
55         ChartModelClone(
56             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_model,
57             const ModelFacet i_facet
58         );
59 
60         ~ChartModelClone();
61 
62         ModelFacet getFacet() const;
63 
64         void applyToModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& i_model ) const;
65 
66         static void applyModelContentToModel(
67             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & i_model,
68             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & i_modelToCopyFrom,
69             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > & i_data );
70 
71         void dispose();
72 
73     private:
impl_isDisposed() const74         bool    impl_isDisposed() const { return !m_xModelClone.is(); }
75 
76     private:
77         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >                 m_xModelClone;
78         ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XInternalDataProvider > m_xDataClone;
79         ::com::sun::star::uno::Any                                                          m_aSelection;
80     };
81 
82 //......................................................................................................................
83 } // namespace chart
84 //......................................................................................................................
85 
86 #endif // CHART2_CHARTMODELCLONE_HXX
87