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 :
20 : #ifndef SC_DOCFUNC_HXX
21 : #define SC_DOCFUNC_HXX
22 :
23 : #include <tools/link.hxx>
24 : #include "global.hxx"
25 : #include "formula/grammar.hxx"
26 : #include "tabbgcolor.hxx"
27 : #include "token.hxx"
28 : #include "rangenam.hxx"
29 :
30 : #include <vector>
31 : #include <map>
32 :
33 : class ScEditEngineDefaulter;
34 : class SdrUndoAction;
35 : class ScAddress;
36 : class ScDocShell;
37 : class ScMarkData;
38 : class ScPatternAttr;
39 : class ScRange;
40 : class ScRangeList;
41 : class ScBaseCell;
42 : class ScTokenArray;
43 : struct ScTabOpParam;
44 : class ScTableProtection;
45 : struct ScCellMergeOption;
46 : class ScConditionalFormat;
47 : class ScConditionalFormatList;
48 :
49 : // ---------------------------------------------------------------------------
50 :
51 : class ScDocFunc
52 : {
53 : protected:
54 : ScDocShell& rDocShell;
55 :
56 : sal_Bool AdjustRowHeight( const ScRange& rRange, sal_Bool bPaint = true );
57 : void CreateOneName( ScRangeName& rList,
58 : SCCOL nPosX, SCROW nPosY, SCTAB nTab,
59 : SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
60 : sal_Bool& rCancel, sal_Bool bApi );
61 : void NotifyInputHandler( const ScAddress& rPos );
62 :
63 189 : ScDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {}
64 : public:
65 108 : virtual ~ScDocFunc() {}
66 :
67 : DECL_LINK( NotifyDrawUndo, SdrUndoAction* );
68 :
69 : // for grouping multiple operations into one with a new name
70 : virtual void EnterListAction( sal_uInt16 nNameResId );
71 : virtual void EndListAction();
72 :
73 : virtual sal_Bool DetectiveAddPred(const ScAddress& rPos);
74 : virtual sal_Bool DetectiveDelPred(const ScAddress& rPos);
75 : virtual sal_Bool DetectiveAddSucc(const ScAddress& rPos);
76 : virtual sal_Bool DetectiveDelSucc(const ScAddress& rPos);
77 : virtual sal_Bool DetectiveAddError(const ScAddress& rPos);
78 : virtual sal_Bool DetectiveMarkInvalid(SCTAB nTab);
79 : virtual sal_Bool DetectiveDelAll(SCTAB nTab);
80 : virtual sal_Bool DetectiveRefresh(sal_Bool bAutomatic = false);
81 : virtual void DetectiveCollectAllPreds(const ScRangeList& rSrcRanges, ::std::vector<ScTokenRef>& rRefTokens);
82 : virtual void DetectiveCollectAllSuccs(const ScRangeList& rSrcRanges, ::std::vector<ScTokenRef>& rRefTokens);
83 :
84 : virtual sal_Bool DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
85 : sal_Bool bRecord, sal_Bool bApi );
86 :
87 : virtual sal_Bool TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
88 : sal_Bool bRecord, sal_Bool bApi );
89 :
90 : virtual sal_Bool SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, const String& rText, sal_Bool bApi );
91 : virtual sal_Bool PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi );
92 : virtual sal_Bool PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
93 : sal_Bool bInterpret, sal_Bool bApi );
94 : virtual sal_Bool SetCellText( const ScAddress& rPos, const String& rText,
95 : sal_Bool bInterpret, sal_Bool bEnglish, sal_Bool bApi,
96 : const String& rFormulaNmsp,
97 : const formula::FormulaGrammar::Grammar eGrammar );
98 :
99 : // creates a new cell for use with PutCell
100 : virtual ScBaseCell* InterpretEnglishString( const ScAddress& rPos, const String& rText,
101 : const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar,
102 : short* pRetFormatType = NULL );
103 :
104 : virtual bool ShowNote( const ScAddress& rPos, bool bShow = true );
105 : inline bool HideNote( const ScAddress& rPos ) { return ShowNote( rPos, false ); }
106 :
107 : virtual bool SetNoteText( const ScAddress& rPos, const String& rNoteText, sal_Bool bApi );
108 : virtual bool ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate, sal_Bool bApi );
109 :
110 : virtual sal_Bool ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
111 : sal_Bool bRecord, sal_Bool bApi );
112 : virtual sal_Bool ApplyStyle( const ScMarkData& rMark, const String& rStyleName,
113 : sal_Bool bRecord, sal_Bool bApi );
114 :
115 : virtual sal_Bool InsertCells( const ScRange& rRange,const ScMarkData* pTabMark,
116 : InsCellCmd eCmd, sal_Bool bRecord, sal_Bool bApi,
117 : sal_Bool bPartOfPaste = false );
118 : virtual sal_Bool DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
119 : DelCellCmd eCmd, sal_Bool bRecord, sal_Bool bApi );
120 :
121 : virtual sal_Bool MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
122 : sal_Bool bCut, sal_Bool bRecord, sal_Bool bPaint, sal_Bool bApi );
123 :
124 : virtual sal_Bool InsertTable( SCTAB nTab, const String& rName, sal_Bool bRecord, sal_Bool bApi );
125 : virtual sal_Bool RenameTable( SCTAB nTab, const String& rName, sal_Bool bRecord, sal_Bool bApi );
126 : virtual sal_Bool DeleteTable( SCTAB nTab, sal_Bool bRecord, sal_Bool bApi );
127 :
128 : virtual bool SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bool bApi );
129 : virtual bool SetTabBgColor( ScUndoTabColorInfo::List& rUndoTabColorList, bool bRecord, bool bApi );
130 :
131 : virtual sal_Bool SetTableVisible( SCTAB nTab, bool bVisible, sal_Bool bApi );
132 :
133 : virtual sal_Bool SetLayoutRTL( SCTAB nTab, bool bRTL, sal_Bool bApi );
134 :
135 : virtual SC_DLLPUBLIC sal_Bool
136 : SetWidthOrHeight( sal_Bool bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges,
137 : SCTAB nTab, ScSizeMode eMode, sal_uInt16 nSizeTwips,
138 : sal_Bool bRecord, sal_Bool bApi );
139 :
140 : virtual sal_Bool InsertPageBreak( sal_Bool bColumn, const ScAddress& rPos,
141 : sal_Bool bRecord, sal_Bool bSetModified, sal_Bool bApi );
142 : virtual sal_Bool RemovePageBreak( sal_Bool bColumn, const ScAddress& rPos,
143 : sal_Bool bRecord, sal_Bool bSetModified, sal_Bool bApi );
144 :
145 : virtual void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
146 :
147 : virtual sal_Bool Protect( SCTAB nTab, const String& rPassword, sal_Bool bApi );
148 : virtual sal_Bool Unprotect( SCTAB nTab, const String& rPassword, sal_Bool bApi );
149 :
150 : virtual sal_Bool ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, sal_Bool bApi );
151 : virtual sal_Bool ChangeIndent( const ScMarkData& rMark, sal_Bool bIncrement, sal_Bool bApi );
152 : virtual bool AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
153 : sal_uInt16 nFormatNo, bool bRecord, bool bApi );
154 :
155 : virtual sal_Bool EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
156 : const ScTokenArray* pTokenArray,
157 : const String& rString, sal_Bool bApi, sal_Bool bEnglish,
158 : const String& rFormulaNmsp,
159 : const formula::FormulaGrammar::Grammar );
160 :
161 : virtual sal_Bool TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
162 : const ScTabOpParam& rParam, sal_Bool bRecord, sal_Bool bApi );
163 :
164 : virtual bool FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
165 : FillDir eDir, bool bRecord, bool bApi );
166 : virtual sal_Bool FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
167 : FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd,
168 : double fStart, double fStep, double fMax,
169 : sal_Bool bRecord, sal_Bool bApi );
170 :
171 : // FillAuto: rRange wird von Source-Range auf Dest-Range angepasst
172 : SC_DLLPUBLIC virtual sal_Bool FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, sal_uLong nCount, double fStep, double fMax, sal_Bool bRecord, sal_Bool bApi );
173 :
174 : virtual sal_Bool FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
175 : FillDir eDir, sal_uLong nCount, sal_Bool bRecord, sal_Bool bApi );
176 :
177 : virtual sal_Bool ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd, sal_Bool bApi );
178 :
179 : virtual sal_Bool MergeCells( const ScCellMergeOption& rOption, sal_Bool bContents,
180 : sal_Bool bRecord, sal_Bool bApi );
181 : sal_Bool UnmergeCells( const ScRange& rRange, sal_Bool bRecord );
182 : bool UnmergeCells( const ScCellMergeOption& rOption, sal_Bool bRecord );
183 :
184 : virtual bool SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc = true, SCTAB nTab = -1 ); // takes ownership of pNewRanges //nTab = -1 for local range names
185 : virtual bool ModifyRangeNames( const ScRangeName& rNewRanges, SCTAB nTab = -1 );
186 : /**
187 : * Modify all range names, global scope names as well as sheet local ones,
188 : * in one go. Note that this method will <b>not</b> destroy the instances
189 : * passed as arguments (it creates copies); the caller is responsible for
190 : * destroying them.
191 : */
192 : virtual void ModifyAllRangeNames( const boost::ptr_map<rtl::OUString, ScRangeName>& rRangeMap );
193 :
194 : virtual sal_Bool CreateNames( const ScRange& rRange, sal_uInt16 nFlags, sal_Bool bApi, SCTAB nTab = -1 ); // -1 for global range names
195 : virtual sal_Bool InsertNameList( const ScAddress& rStartPos, sal_Bool bApi );
196 :
197 : virtual sal_Bool InsertAreaLink( const String& rFile, const String& rFilter,
198 : const String& rOptions, const String& rSource,
199 : const ScRange& rDestRange, sal_uLong nRefresh,
200 : sal_Bool bFitBlock, sal_Bool bApi );
201 :
202 : /**
203 : * @param nOldIndex If 0 don't delete an old format
204 : * @param pFormat if NULL only delete an old format
205 : */
206 : virtual void ReplaceConditionalFormat( sal_uLong nOldIndex, ScConditionalFormat* pFormat, SCTAB nTab, const ScRangeList& rRanges );
207 :
208 : /**
209 : * Sets or replaces the conditional format list of a table
210 : *
211 : * @param pList the new ScConditionalFormatList, method takes ownership
212 : * @param nTab the tab to which the conditional format list belongs
213 : */
214 : virtual void SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB nTab );
215 : };
216 :
217 : class ScDocFuncDirect : public ScDocFunc
218 : {
219 : public:
220 189 : ScDocFuncDirect( ScDocShell& rDocSh ) : ScDocFunc( rDocSh ) {}
221 216 : virtual ~ScDocFuncDirect() {}
222 : };
223 :
224 :
225 : #endif
226 :
227 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|