xref: /aoo42x/main/sc/inc/scextopt.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 #ifndef SC_SCEXTOPT_HXX
24 #define SC_SCEXTOPT_HXX
25 
26 #include <memory>
27 #include <tools/gen.hxx>
28 #include <tools/color.hxx>
29 #include "global.hxx"
30 #include "rangelst.hxx"
31 
32 // ============================================================================
33 
34 /** Extended settings for the document, used in import/export filters. */
35 struct ScExtDocSettings
36 {
37     String              maGlobCodeName;     /// Global codename (VBA module name).
38     double              mfTabBarWidth;      /// Width of the tabbar, relative to frame window width (0.0 ... 1.0).
39     sal_uInt32          mnLinkCnt;          /// Recursive counter for loading external documents.
40     SCTAB               mnDisplTab;         /// Index of displayed sheet.
41 
42     explicit            ScExtDocSettings();
43 };
44 
45 // ============================================================================
46 
47 /** Enumerates possible positions of panes in split sheets. */
48 enum ScExtPanePos
49 {
50     SCEXT_PANE_TOPLEFT,         /// Single, top, left, or top-left pane.
51     SCEXT_PANE_TOPRIGHT,        /// Right, or top-right pane.
52     SCEXT_PANE_BOTTOMLEFT,      /// Bottom, or bottom-left pane.
53     SCEXT_PANE_BOTTOMRIGHT      /// Bottom-right pane.
54 };
55 
56 // ----------------------------------------------------------------------------
57 
58 /** Extended settings for a sheet, used in import/export filters. */
59 struct ScExtTabSettings
60 {
61     ScRange             maUsedArea;         /// Used area in the sheet (columns/rows only).
62     ScRangeList         maSelection;        /// Selected cell ranges (columns/rows only).
63     ScAddress           maCursor;           /// The cursor position (column/row only).
64     ScAddress           maFirstVis;         /// Top-left visible cell (column/row only).
65     ScAddress           maSecondVis;        /// Top-left visible cell in add. panes (column/row only).
66     ScAddress           maFreezePos;        /// Position of frozen panes (column/row only).
67     Point               maSplitPos;         /// Position of split.
68     ScExtPanePos        meActivePane;       /// Active (focused) pane.
69     Color               maGridColor;        /// Grid color.
70     long                mnNormalZoom;       /// Zoom in percent for normal view.
71     long                mnPageZoom;         /// Zoom in percent for pagebreak preview.
72     bool                mbSelected;         /// true = Sheet is selected.
73     bool                mbFrozenPanes;      /// true = Frozen panes; false = Normal splits.
74     bool                mbPageMode;         /// true = Pagebreak mode; false = Normal view mode.
75 
76     explicit            ScExtTabSettings();
77 };
78 
79 // ============================================================================
80 
81 struct ScExtDocOptionsImpl;
82 
83 /** Extended options held by an ScDocument containing additional settings for filters.
84 
85     This object is owned by a Calc document. It contains global document settings
86     (struct ScExtDocSettings), settings for all sheets in the document
87     (struct ScExtTabSettings), and a list of codenames used for VBA import/export.
88  */
89 class SC_DLLPUBLIC ScExtDocOptions
90 {
91 public:
92     explicit            ScExtDocOptions();
93                         ScExtDocOptions( const ScExtDocOptions& rSrc );
94                         ~ScExtDocOptions();
95 
96     ScExtDocOptions&    operator=( const ScExtDocOptions& rSrc );
97 
98     /** Returns true, if the data needs to be copied to the view data after import. */
99     bool                IsChanged() const;
100     /** If set to true, the data will be copied to the view data after import. */
101     void                SetChanged( bool bChanged );
102 
103     /** Returns read access to the global document settings. */
104     const ScExtDocSettings& GetDocSettings() const;
105     /** Returns read/write access to the global document settings. */
106     ScExtDocSettings&   GetDocSettings();
107 
108     /** Returns read access to the settings of a sheet, if extant; otherwise 0. */
109     const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const;
110     /** Returns read/write access to the settings of a sheet, may create a new struct. */
111     ScExtTabSettings&   GetOrCreateTabSettings( SCTAB nTab );
112 
113     /** Returns the number of sheet codenames. */
114     SCTAB               GetCodeNameCount() const;
115     /** Returns the specified codename (empty string = no codename). */
116     const String&       GetCodeName( SCTAB nTab ) const;
117     /** Appends a codename for a sheet. */
118     void                SetCodeName( SCTAB nTab, const String& rCodeName );
119 
120 private:
121     ::std::auto_ptr< ScExtDocOptionsImpl > mxImpl;
122 };
123 
124 // ============================================================================
125 
126 #endif
127 
128