xref: /aoo4110/main/sc/source/ui/inc/docfunc.hxx (revision b1cdbd2c)
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_DOCFUNC_HXX
25 #define SC_DOCFUNC_HXX
26 
27 #include <tools/link.hxx>
28 #include "global.hxx"
29 #include "formula/grammar.hxx"
30 #include "tabbgcolor.hxx"
31 
32 class ScEditEngineDefaulter;
33 class SdrUndoAction;
34 class ScAddress;
35 class ScDocShell;
36 class ScMarkData;
37 class ScPatternAttr;
38 class ScRange;
39 class ScRangeName;
40 class ScBaseCell;
41 class ScTokenArray;
42 struct ScTabOpParam;
43 class ScTableProtection;
44 
45 // ---------------------------------------------------------------------------
46 
47 class ScDocFunc
48 {
49 private:
50 	ScDocShell&		rDocShell;
51 
52 	sal_Bool			AdjustRowHeight( const ScRange& rRange, sal_Bool bPaint = sal_True );
53 	void			CreateOneName( ScRangeName& rList,
54 									SCCOL nPosX, SCROW nPosY, SCTAB nTab,
55 									SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
56 									sal_Bool& rCancel, sal_Bool bApi );
57 	void			NotifyInputHandler( const ScAddress& rPos );
58 
59 public:
ScDocFunc(ScDocShell & rDocSh)60 					ScDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {}
~ScDocFunc()61 					~ScDocFunc() {}
62 
63     DECL_LINK( NotifyDrawUndo, SdrUndoAction* );
64 
65 	sal_Bool			DetectiveAddPred(const ScAddress& rPos);
66 	sal_Bool			DetectiveDelPred(const ScAddress& rPos);
67 	sal_Bool			DetectiveAddSucc(const ScAddress& rPos);
68 	sal_Bool			DetectiveDelSucc(const ScAddress& rPos);
69 	sal_Bool			DetectiveAddError(const ScAddress& rPos);
70 	sal_Bool			DetectiveMarkInvalid(SCTAB nTab);
71 	sal_Bool			DetectiveDelAll(SCTAB nTab);
72 	sal_Bool			DetectiveRefresh(sal_Bool bAutomatic = sal_False);
73 
74 	sal_Bool			DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
75 									sal_Bool bRecord, sal_Bool bApi );
76 
77 	sal_Bool			TransliterateText( const ScMarkData& rMark, sal_Int32 nType,
78 									sal_Bool bRecord, sal_Bool bApi );
79 
80 	sal_Bool			SetNormalString( const ScAddress& rPos, const String& rText, sal_Bool bApi );
81 	sal_Bool			PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi );
82 	sal_Bool			PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine,
83 								sal_Bool bInterpret, sal_Bool bApi );
84 	sal_Bool			SetCellText( const ScAddress& rPos, const String& rText,
85 									sal_Bool bInterpret, sal_Bool bEnglish, sal_Bool bApi,
86                                     const String& rFormulaNmsp,
87                                     const formula::FormulaGrammar::Grammar eGrammar );
88 
89 					// creates a new cell for use with PutCell
90 	ScBaseCell*		InterpretEnglishString( const ScAddress& rPos, const String& rText,
91                         const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar,
92                         short* pRetFormatType = NULL );
93 
94 	bool			ShowNote( const ScAddress& rPos, bool bShow = true );
HideNote(const ScAddress & rPos)95 	inline bool		HideNote( const ScAddress& rPos ) { return ShowNote( rPos, false ); }
96 
97     bool            SetNoteText( const ScAddress& rPos, const String& rNoteText, sal_Bool bApi );
98     bool            ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate, sal_Bool bApi );
99 
100 	sal_Bool			ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern,
101 									sal_Bool bRecord, sal_Bool bApi );
102 	sal_Bool			ApplyStyle( const ScMarkData& rMark, const String& rStyleName,
103 									sal_Bool bRecord, sal_Bool bApi );
104 
105 	sal_Bool			InsertCells( const ScRange& rRange,const ScMarkData* pTabMark,
106                                  InsCellCmd eCmd, sal_Bool bRecord, sal_Bool bApi,
107 									sal_Bool bPartOfPaste = sal_False );
108 	sal_Bool			DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
109                                  DelCellCmd eCmd, sal_Bool bRecord, sal_Bool bApi );
110 
111 	sal_Bool			MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
112 								sal_Bool bCut, sal_Bool bRecord, sal_Bool bPaint, sal_Bool bApi );
113 
114 	sal_Bool			InsertTable( SCTAB nTab, const String& rName, sal_Bool bRecord, sal_Bool bApi );
115 	sal_Bool			RenameTable( SCTAB nTab, const String& rName, sal_Bool bRecord, sal_Bool bApi );
116 	sal_Bool			DeleteTable( SCTAB nTab, sal_Bool bRecord, sal_Bool bApi );
117 
118     bool            SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bool bApi );
119     bool            SetTabBgColor( ScUndoTabColorInfo::List& rUndoTabColorList, bool bRecord, bool bApi );
120 
121 	sal_Bool			SetTableVisible( SCTAB nTab, sal_Bool bVisible, sal_Bool bApi );
122 
123 	sal_Bool			SetLayoutRTL( SCTAB nTab, sal_Bool bRTL, sal_Bool bApi );
124 
125 //UNUSED2009-05 sal_Bool	 	    SetGrammar( formula::FormulaGrammar::Grammar eGrammar );
126 
127 	SC_DLLPUBLIC sal_Bool			SetWidthOrHeight( sal_Bool bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges,
128 									SCTAB nTab, ScSizeMode eMode, sal_uInt16 nSizeTwips,
129 									sal_Bool bRecord, sal_Bool bApi );
130 
131 	sal_Bool			InsertPageBreak( sal_Bool bColumn, const ScAddress& rPos,
132 									sal_Bool bRecord, sal_Bool bSetModified, sal_Bool bApi );
133 	sal_Bool			RemovePageBreak( sal_Bool bColumn, const ScAddress& rPos,
134 									sal_Bool bRecord, sal_Bool bSetModified, sal_Bool bApi );
135 
136     void            ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
137 
138 	sal_Bool			Protect( SCTAB nTab, const String& rPassword, sal_Bool bApi );
139 	sal_Bool			Unprotect( SCTAB nTab, const String& rPassword, sal_Bool bApi );
140 
141 	sal_Bool			ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, sal_Bool bApi );
142 	sal_Bool			ChangeIndent( const ScMarkData& rMark, sal_Bool bIncrement, sal_Bool bApi );
143 	sal_Bool			AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
144 									sal_uInt16 nFormatNo, sal_Bool bRecord, sal_Bool bApi );
145 
146 	sal_Bool			EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
147                                     const ScTokenArray* pTokenArray,
148 									const String& rString, sal_Bool bApi, sal_Bool bEnglish,
149                                     const String& rFormulaNmsp,
150                                     const formula::FormulaGrammar::Grammar );
151 
152 	sal_Bool			TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
153 							const ScTabOpParam& rParam, sal_Bool bRecord, sal_Bool bApi );
154 
155 	sal_Bool			FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
156 								FillDir eDir, sal_Bool bRecord, sal_Bool bApi );
157 	sal_Bool			FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
158 								FillDir	eDir, FillCmd eCmd, FillDateCmd	eDateCmd,
159 								double fStart, double fStep, double fMax,
160 								sal_Bool bRecord, sal_Bool bApi );
161 					// FillAuto: rRange wird von Source-Range auf Dest-Range angepasst
162 	sal_Bool			FillAuto( ScRange& rRange, const ScMarkData* pTabMark,
163 								FillDir eDir, sal_uLong nCount, sal_Bool bRecord, sal_Bool bApi );
164 
165 	sal_Bool			ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd, sal_Bool bApi );
166 
167 	sal_Bool			MergeCells( const ScRange& rRange, sal_Bool bContents,
168 								sal_Bool bRecord, sal_Bool bApi );
169 	sal_Bool			UnmergeCells( const ScRange& rRange, sal_Bool bRecord, sal_Bool bApi );
170 
171     sal_Bool            SetNewRangeNames( ScRangeName* pNewRanges, sal_Bool bApi );     // takes ownership of pNewRanges
172 	sal_Bool			ModifyRangeNames( const ScRangeName& rNewRanges, sal_Bool bApi );
173 
174 	sal_Bool			CreateNames( const ScRange& rRange, sal_uInt16 nFlags, sal_Bool bApi );
175 	sal_Bool			InsertNameList( const ScAddress& rStartPos, sal_Bool bApi );
176 
177 	sal_Bool			InsertAreaLink( const String& rFile, const String& rFilter,
178 									const String& rOptions, const String& rSource,
179 									const ScRange& rDestRange, sal_uLong nRefresh,
180 									sal_Bool bFitBlock, sal_Bool bApi );
181 };
182 
183 
184 
185 #endif
186 
187