Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SC_INC_SCEXTOPT_HXX
20 : #define INCLUDED_SC_INC_SCEXTOPT_HXX
21 :
22 : #include <memory>
23 : #include <tools/gen.hxx>
24 : #include <tools/color.hxx>
25 : #include "global.hxx"
26 : #include "rangelst.hxx"
27 :
28 : /** Extended settings for the document, used in import/export filters. */
29 336 : struct ScExtDocSettings
30 : {
31 : OUString maGlobCodeName; ///< Global codename (VBA module name).
32 : double mfTabBarWidth; ///< Width of the tabbar, relative to frame window width (0.0 ... 1.0).
33 : sal_uInt32 mnLinkCnt; ///< Recursive counter for loading external documents.
34 : SCTAB mnDisplTab; ///< Index of displayed sheet.
35 :
36 : explicit ScExtDocSettings();
37 : };
38 :
39 : /** Enumerates possible positions of panes in split sheets. */
40 : enum ScExtPanePos
41 : {
42 : SCEXT_PANE_TOPLEFT, ///< Single, top, left, or top-left pane.
43 : SCEXT_PANE_TOPRIGHT, ///< Right, or top-right pane.
44 : SCEXT_PANE_BOTTOMLEFT, ///< Bottom, or bottom-left pane.
45 : SCEXT_PANE_BOTTOMRIGHT ///< Bottom-right pane.
46 : };
47 :
48 : /** Extended settings for a sheet, used in import/export filters. */
49 750 : struct ScExtTabSettings
50 : {
51 : ScRange maUsedArea; ///< Used area in the sheet (columns/rows only).
52 : ScRangeList maSelection; ///< Selected cell ranges (columns/rows only).
53 : ScAddress maCursor; ///< The cursor position (column/row only).
54 : ScAddress maFirstVis; ///< Top-left visible cell (column/row only).
55 : ScAddress maSecondVis; ///< Top-left visible cell in add. panes (column/row only).
56 : ScAddress maFreezePos; ///< Position of frozen panes (column/row only).
57 : Point maSplitPos; ///< Position of split.
58 : ScExtPanePos meActivePane; ///< Active (focused) pane.
59 : Color maGridColor; ///< Grid color.
60 : long mnNormalZoom; ///< Zoom in percent for normal view.
61 : long mnPageZoom; ///< Zoom in percent for pagebreak preview.
62 : bool mbSelected; ///< true = Sheet is selected.
63 : bool mbFrozenPanes; ///< true = Frozen panes; false = Normal splits.
64 : bool mbPageMode; ///< true = Pagebreak mode; false = Normal view mode.
65 : bool mbShowGrid; ///< Whether or not to display gridlines.
66 :
67 : explicit ScExtTabSettings();
68 : };
69 :
70 : struct ScExtDocOptionsImpl;
71 :
72 : /** Extended options held by an ScDocument containing additional settings for filters.
73 :
74 : This object is owned by a Calc document. It contains global document settings
75 : (struct ScExtDocSettings), settings for all sheets in the document
76 : (struct ScExtTabSettings), and a list of codenames used for VBA import/export.
77 : */
78 : class SC_DLLPUBLIC ScExtDocOptions
79 : {
80 : public:
81 : explicit ScExtDocOptions();
82 : ScExtDocOptions( const ScExtDocOptions& rSrc );
83 : ~ScExtDocOptions();
84 :
85 : ScExtDocOptions& operator=( const ScExtDocOptions& rSrc );
86 :
87 : /** @return true, if the data needs to be copied to the view data after import. */
88 : bool IsChanged() const;
89 : /** If set to true, the data will be copied to the view data after import. */
90 : void SetChanged( bool bChanged );
91 :
92 : /** @return read access to the global document settings. */
93 : const ScExtDocSettings& GetDocSettings() const;
94 : /** @return read/write access to the global document settings. */
95 : ScExtDocSettings& GetDocSettings();
96 :
97 : /** @return read access to the settings of a sheet, if extant; otherwise 0. */
98 : const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const;
99 :
100 : /**
101 : * @return index of the last sheet that has settings, or -1 if no tab
102 : * settings are present.
103 : */
104 : SCTAB GetLastTab() const;
105 :
106 : /** @return read/write access to the settings of a sheet, may create a new struct. */
107 : ScExtTabSettings& GetOrCreateTabSettings( SCTAB nTab );
108 :
109 : /** @return the number of sheet codenames. */
110 : SCTAB GetCodeNameCount() const;
111 : /** @return the specified codename (empty string = no codename). */
112 : const OUString& GetCodeName( SCTAB nTab ) const;
113 : /** Appends a codename for a sheet. */
114 : void SetCodeName( SCTAB nTab, const OUString& rCodeName );
115 :
116 : private:
117 : ::std::unique_ptr< ScExtDocOptionsImpl > mxImpl;
118 : };
119 :
120 : #endif
121 :
122 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|