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