xref: /aoo42x/main/sc/inc/clipparam.hxx (revision 38d50f7b)
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_CLIPPARAM_HXX
25 #define SC_CLIPPARAM_HXX
26 
27 #include "rangelst.hxx"
28 #include "rangenam.hxx"
29 #include "charthelper.hxx"
30 
31 #include <vector>
32 
33 /**
34  * This struct stores general clipboard parameters associated with a
35  * ScDocument instance created in clipboard mode.
36  */
37 struct ScClipParam
38 {
39     enum Direction { Unspecified, Column, Row };
40 
41     ScRangeList         maRanges;
42     Direction           meDirection;
43     bool                mbCutMode;
44     sal_uInt32          mnSourceDocID;
45     ScRangeListVector   maProtectedChartRangesVector;
46 
47     ScClipParam();
48     ScClipParam(const ScRange& rRange, bool bCutMode);
49     explicit ScClipParam(const ScClipParam& r);
50 
51     bool isMultiRange() const;
52 
53     /**
54      * Get the column size of a pasted range.  Note that when the range is
55      * non-contiguous, we first compress all individual ranges into a single
56      * range, and the size of that compressed range is returned.
57      */
58     SCCOL getPasteColSize();
59 
60     /**
61      * Same as the above method, but returns the row size of the compressed
62      * range.
63      */
64     SCROW getPasteRowSize();
65 
66     /**
67      * Return a single range that encompasses all individual ranges.
68      */
69     ScRange getWholeRange() const;
70 
71     void transpose();
72 
getSourceDocIDScClipParam73     sal_uInt32 getSourceDocID() const { return mnSourceDocID; }
setSourceDocIDScClipParam74     void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; }
75 };
76 
77 // ============================================================================
78 
79 struct ScClipRangeNameData
80 {
81     ScRangeData::IndexMap       maRangeMap;
82     ::std::vector<ScRangeData*> mpRangeNames;
83     bool                        mbReplace;
84 
85     ScClipRangeNameData();
86     ~ScClipRangeNameData();
87     void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex);
88 };
89 
90 #endif
91