xref: /aoo41x/main/sc/inc/clipparam.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_CLIPPARAM_HXX
29 #define SC_CLIPPARAM_HXX
30 
31 #include "rangelst.hxx"
32 #include "rangenam.hxx"
33 #include "charthelper.hxx"
34 
35 #include <vector>
36 
37 /**
38  * This struct stores general clipboard parameters associated with a
39  * ScDocument instance created in clipboard mode.
40  */
41 struct ScClipParam
42 {
43     enum Direction { Unspecified, Column, Row };
44 
45     ScRangeList         maRanges;
46     Direction           meDirection;
47     bool                mbCutMode;
48     sal_uInt32          mnSourceDocID;
49     ScRangeListVector   maProtectedChartRangesVector;
50 
51     ScClipParam();
52     ScClipParam(const ScRange& rRange, bool bCutMode);
53     explicit ScClipParam(const ScClipParam& r);
54 
55     bool isMultiRange() const;
56 
57     /**
58      * Get the column size of a pasted range.  Note that when the range is
59      * non-contiguous, we first compress all individual ranges into a single
60      * range, and the size of that compressed range is returned.
61      */
62     SCCOL getPasteColSize();
63 
64     /**
65      * Same as the above method, but returns the row size of the compressed
66      * range.
67      */
68     SCROW getPasteRowSize();
69 
70     /**
71      * Return a single range that encompasses all individual ranges.
72      */
73     ScRange getWholeRange() const;
74 
75     void transpose();
76 
77     sal_uInt32 getSourceDocID() const { return mnSourceDocID; }
78     void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; }
79 };
80 
81 // ============================================================================
82 
83 struct ScClipRangeNameData
84 {
85     ScRangeData::IndexMap       maRangeMap;
86     ::std::vector<ScRangeData*> mpRangeNames;
87     bool                        mbReplace;
88 
89     ScClipRangeNameData();
90     ~ScClipRangeNameData();
91     void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex);
92 };
93 
94 #endif
95