1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_DOCFUNC_HXX
21 #define SC_DOCFUNC_HXX
23 #include <tools/link.hxx>
25 #include "formula/grammar.hxx"
26 #include "tabbgcolor.hxx"
28 #include "rangenam.hxx"
33 class ScEditEngineDefaulter
;
44 class ScTableProtection
;
45 struct ScCellMergeOption
;
46 class ScConditionalFormat
;
47 class ScConditionalFormatList
;
49 // ---------------------------------------------------------------------------
54 ScDocShell
& rDocShell
;
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
);
63 ScDocFunc( ScDocShell
& rDocSh
): rDocShell(rDocSh
) {}
65 virtual ~ScDocFunc() {}
67 DECL_LINK( NotifyDrawUndo
, SdrUndoAction
* );
69 // for grouping multiple operations into one with a new name
70 virtual void EnterListAction( sal_uInt16 nNameResId
);
71 virtual void EndListAction();
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
);
84 virtual sal_Bool
DeleteContents( const ScMarkData
& rMark
, sal_uInt16 nFlags
,
85 sal_Bool bRecord
, sal_Bool bApi
);
87 virtual sal_Bool
TransliterateText( const ScMarkData
& rMark
, sal_Int32 nType
,
88 sal_Bool bRecord
, sal_Bool bApi
);
90 virtual sal_Bool
SetNormalString( bool& o_rbNumFmtSet
, const ScAddress
& rPos
, const OUString
& rText
, sal_Bool bApi
);
91 virtual bool SetValueCell( const ScAddress
& rPos
, double fVal
, bool bInteraction
);
92 virtual bool SetStringCell( const ScAddress
& rPos
, const OUString
& rStr
, bool bInteraction
);
93 virtual bool SetEditCell( const ScAddress
& rPos
, const EditTextObject
& rStr
, bool bInteraction
);
95 bool SetStringOrEditCell( const ScAddress
& rPos
, const OUString
& rStr
, bool bInteraction
);
98 * This method takes ownership of the formula cell instance. The caller
99 * must not delete it after passing it to this call.
101 virtual bool SetFormulaCell( const ScAddress
& rPos
, ScFormulaCell
* pCell
, bool bInteraction
);
102 virtual bool PutData( const ScAddress
& rPos
, ScEditEngineDefaulter
& rEngine
, bool bApi
);
103 virtual bool SetCellText(
104 const ScAddress
& rPos
, const OUString
& rText
, bool bInterpret
, bool bEnglish
, bool bApi
,
105 const formula::FormulaGrammar::Grammar eGrammar
);
107 virtual bool ShowNote( const ScAddress
& rPos
, bool bShow
= true );
108 inline bool HideNote( const ScAddress
& rPos
) { return ShowNote( rPos
, false ); }
110 virtual bool SetNoteText( const ScAddress
& rPos
, const OUString
& rNoteText
, sal_Bool bApi
);
111 virtual bool ReplaceNote( const ScAddress
& rPos
, const OUString
& rNoteText
, const OUString
* pAuthor
, const OUString
* pDate
, sal_Bool bApi
);
113 virtual sal_Bool
ApplyAttributes( const ScMarkData
& rMark
, const ScPatternAttr
& rPattern
,
114 sal_Bool bRecord
, sal_Bool bApi
);
115 virtual sal_Bool
ApplyStyle( const ScMarkData
& rMark
, const OUString
& rStyleName
,
116 sal_Bool bRecord
, sal_Bool bApi
);
118 virtual bool InsertCells( const ScRange
& rRange
,const ScMarkData
* pTabMark
,
119 InsCellCmd eCmd
, bool bRecord
, bool bApi
, bool bPartOfPaste
= false );
121 virtual bool DeleteCells( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
122 DelCellCmd eCmd
, bool bRecord
, bool bApi
);
124 virtual sal_Bool
MoveBlock( const ScRange
& rSource
, const ScAddress
& rDestPos
,
125 sal_Bool bCut
, sal_Bool bRecord
, sal_Bool bPaint
, sal_Bool bApi
);
127 virtual sal_Bool
InsertTable( SCTAB nTab
, const OUString
& rName
, sal_Bool bRecord
, sal_Bool bApi
);
128 virtual sal_Bool
RenameTable( SCTAB nTab
, const OUString
& rName
, sal_Bool bRecord
, sal_Bool bApi
);
129 virtual sal_Bool
DeleteTable( SCTAB nTab
, sal_Bool bRecord
, sal_Bool bApi
);
131 virtual bool SetTabBgColor( SCTAB nTab
, const Color
& rColor
, bool bRecord
, bool bApi
);
132 virtual bool SetTabBgColor( ScUndoTabColorInfo::List
& rUndoTabColorList
, bool bRecord
, bool bApi
);
134 virtual sal_Bool
SetTableVisible( SCTAB nTab
, bool bVisible
, sal_Bool bApi
);
136 virtual sal_Bool
SetLayoutRTL( SCTAB nTab
, bool bRTL
, sal_Bool bApi
);
138 virtual SC_DLLPUBLIC sal_Bool
139 SetWidthOrHeight( sal_Bool bWidth
, SCCOLROW nRangeCnt
, SCCOLROW
* pRanges
,
140 SCTAB nTab
, ScSizeMode eMode
, sal_uInt16 nSizeTwips
,
141 sal_Bool bRecord
, sal_Bool bApi
);
143 virtual sal_Bool
InsertPageBreak( sal_Bool bColumn
, const ScAddress
& rPos
,
144 sal_Bool bRecord
, sal_Bool bSetModified
, sal_Bool bApi
);
145 virtual sal_Bool
RemovePageBreak( sal_Bool bColumn
, const ScAddress
& rPos
,
146 sal_Bool bRecord
, sal_Bool bSetModified
, sal_Bool bApi
);
148 virtual void ProtectSheet( SCTAB nTab
, const ScTableProtection
& rProtect
);
150 virtual sal_Bool
Protect( SCTAB nTab
, const OUString
& rPassword
, sal_Bool bApi
);
151 virtual sal_Bool
Unprotect( SCTAB nTab
, const OUString
& rPassword
, sal_Bool bApi
);
153 virtual sal_Bool
ClearItems( const ScMarkData
& rMark
, const sal_uInt16
* pWhich
, sal_Bool bApi
);
154 virtual sal_Bool
ChangeIndent( const ScMarkData
& rMark
, sal_Bool bIncrement
, sal_Bool bApi
);
155 virtual bool AutoFormat( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
156 sal_uInt16 nFormatNo
, bool bRecord
, bool bApi
);
158 virtual sal_Bool
EnterMatrix( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
159 const ScTokenArray
* pTokenArray
,
160 const OUString
& rString
, sal_Bool bApi
, sal_Bool bEnglish
,
161 const OUString
& rFormulaNmsp
,
162 const formula::FormulaGrammar::Grammar
);
164 virtual sal_Bool
TabOp( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
165 const ScTabOpParam
& rParam
, sal_Bool bRecord
, sal_Bool bApi
);
167 virtual bool FillSimple( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
168 FillDir eDir
, bool bRecord
, bool bApi
);
169 virtual sal_Bool
FillSeries( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
170 FillDir eDir
, FillCmd eCmd
, FillDateCmd eDateCmd
,
171 double fStart
, double fStep
, double fMax
,
172 sal_Bool bRecord
, sal_Bool bApi
);
174 // FillAuto: rRange wird von Source-Range auf Dest-Range angepasst
175 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
);
177 virtual sal_Bool
FillAuto( ScRange
& rRange
, const ScMarkData
* pTabMark
,
178 FillDir eDir
, sal_uLong nCount
, sal_Bool bRecord
, sal_Bool bApi
);
180 virtual sal_Bool
ResizeMatrix( const ScRange
& rOldRange
, const ScAddress
& rNewEnd
, sal_Bool bApi
);
182 virtual sal_Bool
MergeCells( const ScCellMergeOption
& rOption
, sal_Bool bContents
,
183 sal_Bool bRecord
, sal_Bool bApi
);
184 sal_Bool
UnmergeCells( const ScRange
& rRange
, sal_Bool bRecord
);
185 bool UnmergeCells( const ScCellMergeOption
& rOption
, sal_Bool bRecord
);
187 virtual bool SetNewRangeNames( ScRangeName
* pNewRanges
, bool bModifyDoc
= true, SCTAB nTab
= -1 ); // takes ownership of pNewRanges //nTab = -1 for local range names
188 virtual bool ModifyRangeNames( const ScRangeName
& rNewRanges
, SCTAB nTab
= -1 );
190 * Modify all range names, global scope names as well as sheet local ones,
191 * in one go. Note that this method will <b>not</b> destroy the instances
192 * passed as arguments (it creates copies); the caller is responsible for
195 virtual void ModifyAllRangeNames( const boost::ptr_map
<OUString
, ScRangeName
>& rRangeMap
);
197 virtual sal_Bool
CreateNames( const ScRange
& rRange
, sal_uInt16 nFlags
, sal_Bool bApi
, SCTAB nTab
= -1 ); // -1 for global range names
198 virtual sal_Bool
InsertNameList( const ScAddress
& rStartPos
, sal_Bool bApi
);
200 sal_Bool
InsertAreaLink( const OUString
& rFile
, const OUString
& rFilter
,
201 const OUString
& rOptions
, const OUString
& rSource
,
202 const ScRange
& rDestRange
, sal_uLong nRefresh
,
203 sal_Bool bFitBlock
, sal_Bool bApi
);
206 * @param nOldIndex If 0 don't delete an old format
207 * @param pFormat if NULL only delete an old format
209 virtual void ReplaceConditionalFormat( sal_uLong nOldIndex
, ScConditionalFormat
* pFormat
, SCTAB nTab
, const ScRangeList
& rRanges
);
212 * Sets or replaces the conditional format list of a table
214 * @param pList the new ScConditionalFormatList, method takes ownership
215 * @param nTab the tab to which the conditional format list belongs
217 virtual void SetConditionalFormatList( ScConditionalFormatList
* pList
, SCTAB nTab
);
220 class ScDocFuncDirect
: public ScDocFunc
223 ScDocFuncDirect( ScDocShell
& rDocSh
) : ScDocFunc( rDocSh
) {}
224 virtual ~ScDocFuncDirect() {}
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */