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 INCLUDED_SC_SOURCE_UI_INC_DOCFUNC_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_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
;
58 ScDocShell
& rDocShell
;
60 bool AdjustRowHeight( const ScRange
& rRange
, bool bPaint
= true );
61 void CreateOneName( ScRangeName
& rList
,
62 SCCOL nPosX
, SCROW nPosY
, SCTAB nTab
,
63 SCCOL nX1
, SCROW nY1
, SCCOL nX2
, SCROW nY2
,
64 bool& rCancel
, bool bApi
);
65 void NotifyInputHandler( const ScAddress
& rPos
);
67 ScDocFunc( ScDocShell
& rDocSh
): rDocShell(rDocSh
) {}
69 virtual ~ScDocFunc() {}
71 DECL_LINK( NotifyDrawUndo
, SdrUndoAction
* );
73 // for grouping multiple operations into one with a new name
74 void EnterListAction( sal_uInt16 nNameResId
);
77 bool DetectiveAddPred(const ScAddress
& rPos
);
78 bool DetectiveDelPred(const ScAddress
& rPos
);
79 bool DetectiveAddSucc(const ScAddress
& rPos
);
80 bool DetectiveDelSucc(const ScAddress
& rPos
);
81 bool DetectiveAddError(const ScAddress
& rPos
);
82 bool DetectiveMarkInvalid(SCTAB nTab
);
83 bool DetectiveDelAll(SCTAB nTab
);
84 bool DetectiveRefresh(bool bAutomatic
= false);
85 void DetectiveCollectAllPreds(const ScRangeList
& rSrcRanges
, ::std::vector
<ScTokenRef
>& rRefTokens
);
86 void DetectiveCollectAllSuccs(const ScRangeList
& rSrcRanges
, ::std::vector
<ScTokenRef
>& rRefTokens
);
88 SC_DLLPUBLIC
bool DeleteContents(
89 const ScMarkData
& rMark
, InsertDeleteFlags nFlags
, bool bRecord
, bool bApi
);
92 const ScAddress
& rPos
, const ScMarkData
& rMark
, InsertDeleteFlags nFlags
, bool bRecord
, bool bApi
);
94 bool TransliterateText( const ScMarkData
& rMark
, sal_Int32 nType
,
95 bool bRecord
, bool bApi
);
97 bool SetNormalString( bool& o_rbNumFmtSet
, const ScAddress
& rPos
, const OUString
& rText
, bool bApi
);
98 bool SetValueCell( const ScAddress
& rPos
, double fVal
, bool bInteraction
);
99 bool SetValueCells( const ScAddress
& rPos
, const std::vector
<double>& aVals
, bool bInteraction
);
100 bool SetStringCell( const ScAddress
& rPos
, const OUString
& rStr
, bool bInteraction
);
101 bool SetEditCell( const ScAddress
& rPos
, const EditTextObject
& rStr
, bool bInteraction
);
103 bool SetStringOrEditCell( const ScAddress
& rPos
, const OUString
& rStr
, bool bInteraction
);
106 * This method takes ownership of the formula cell instance. The caller
107 * must not delete it after passing it to this call.
109 bool SetFormulaCell( const ScAddress
& rPos
, ScFormulaCell
* pCell
, bool bInteraction
);
110 bool PutData( const ScAddress
& rPos
, ScEditEngineDefaulter
& rEngine
, bool bApi
);
112 const ScAddress
& rPos
, const OUString
& rText
, bool bInterpret
, bool bEnglish
, bool bApi
,
113 const formula::FormulaGrammar::Grammar eGrammar
);
115 bool ShowNote( const ScAddress
& rPos
, bool bShow
= true );
116 inline bool HideNote( const ScAddress
& rPos
) { return ShowNote( rPos
, false ); }
118 bool SetNoteText( const ScAddress
& rPos
, const OUString
& rNoteText
, bool bApi
);
119 bool ReplaceNote( const ScAddress
& rPos
, const OUString
& rNoteText
, const OUString
* pAuthor
, const OUString
* pDate
, bool bApi
);
121 bool ApplyAttributes( const ScMarkData
& rMark
, const ScPatternAttr
& rPattern
,
122 bool bRecord
, bool bApi
);
123 bool ApplyStyle( const ScMarkData
& rMark
, const OUString
& rStyleName
,
124 bool bRecord
, bool bApi
);
126 bool InsertCells( const ScRange
& rRange
,const ScMarkData
* pTabMark
,
127 InsCellCmd eCmd
, bool bRecord
, bool bApi
, bool bPartOfPaste
= false );
129 bool DeleteCells( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
130 DelCellCmd eCmd
, bool bRecord
, bool bApi
);
132 bool MoveBlock( const ScRange
& rSource
, const ScAddress
& rDestPos
,
133 bool bCut
, bool bRecord
, bool bPaint
, bool bApi
);
135 SC_DLLPUBLIC
bool InsertTable( SCTAB nTab
, const OUString
& rName
, bool bRecord
, bool bApi
);
136 bool RenameTable( SCTAB nTab
, const OUString
& rName
, bool bRecord
, bool bApi
);
137 bool DeleteTable( SCTAB nTab
, bool bRecord
, bool bApi
);
139 bool SetTabBgColor( SCTAB nTab
, const Color
& rColor
, bool bRecord
, bool bApi
);
140 bool SetTabBgColor( ScUndoTabColorInfo::List
& rUndoTabColorList
, bool bRecord
, bool bApi
);
142 bool SetTableVisible( SCTAB nTab
, bool bVisible
, bool bApi
);
144 bool SetLayoutRTL( SCTAB nTab
, bool bRTL
, bool bApi
);
146 SC_DLLPUBLIC
bool SetWidthOrHeight(
147 bool bWidth
, const std::vector
<sc::ColRowSpan
>& rRanges
, SCTAB nTab
,
148 ScSizeMode eMode
, sal_uInt16 nSizeTwips
, bool bRecord
, bool bApi
);
150 bool InsertPageBreak( bool bColumn
, const ScAddress
& rPos
,
151 bool bRecord
, bool bSetModified
, bool bApi
);
152 bool RemovePageBreak( bool bColumn
, const ScAddress
& rPos
,
153 bool bRecord
, bool bSetModified
, bool bApi
);
155 void ProtectSheet( SCTAB nTab
, const ScTableProtection
& rProtect
);
157 bool Protect( SCTAB nTab
, const OUString
& rPassword
, bool bApi
);
158 bool Unprotect( SCTAB nTab
, const OUString
& rPassword
, bool bApi
);
160 bool ClearItems( const ScMarkData
& rMark
, const sal_uInt16
* pWhich
, bool bApi
);
161 bool ChangeIndent( const ScMarkData
& rMark
, bool bIncrement
, bool bApi
);
162 bool AutoFormat( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
163 sal_uInt16 nFormatNo
, bool bRecord
, bool bApi
);
166 EnterMatrix( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
167 const ScTokenArray
* pTokenArray
,
168 const OUString
& rString
, bool bApi
, bool bEnglish
,
169 const OUString
& rFormulaNmsp
,
170 const formula::FormulaGrammar::Grammar
);
172 bool TabOp( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
173 const ScTabOpParam
& rParam
, bool bRecord
, bool bApi
);
175 bool FillSimple( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
176 FillDir eDir
, bool bRecord
, bool bApi
);
177 bool FillSeries( const ScRange
& rRange
, const ScMarkData
* pTabMark
,
178 FillDir eDir
, FillCmd eCmd
, FillDateCmd eDateCmd
,
179 double fStart
, double fStep
, double fMax
,
180 bool bRecord
, bool bApi
);
182 // FillAuto: rRange wird von Source-Range auf Dest-Range angepasst
184 FillAuto( ScRange
& rRange
, const ScMarkData
* pTabMark
, FillDir eDir
, FillCmd eCmd
, FillDateCmd eDateCmd
, sal_uLong nCount
, double fStep
, double fMax
, bool bRecord
, bool bApi
);
186 bool FillAuto( ScRange
& rRange
, const ScMarkData
* pTabMark
,
187 FillDir eDir
, sal_uLong nCount
, bool bRecord
, bool bApi
);
189 bool ResizeMatrix( const ScRange
& rOldRange
, const ScAddress
& rNewEnd
, bool bApi
);
191 bool MergeCells( const ScCellMergeOption
& rOption
, bool bContents
,
192 bool bRecord
, bool bApi
);
193 bool UnmergeCells( const ScRange
& rRange
, bool bRecord
);
194 bool UnmergeCells( const ScCellMergeOption
& rOption
, bool bRecord
);
196 void SetNewRangeNames( ScRangeName
* pNewRanges
, bool bModifyDoc
= true, SCTAB nTab
= -1 ); // takes ownership of pNewRanges //nTab = -1 for local range names
197 void ModifyRangeNames( const ScRangeName
& rNewRanges
, SCTAB nTab
= -1 );
199 * Modify all range names, global scope names as well as sheet local ones,
200 * in one go. Note that this method will <b>not</b> destroy the instances
201 * passed as arguments (it creates copies); the caller is responsible for
204 void ModifyAllRangeNames( const boost::ptr_map
<OUString
, ScRangeName
>& rRangeMap
);
206 bool CreateNames( const ScRange
& rRange
, sal_uInt16 nFlags
, bool bApi
, SCTAB nTab
= -1 ); // -1 for global range names
207 bool InsertNameList( const ScAddress
& rStartPos
, bool bApi
);
209 bool InsertAreaLink( const OUString
& rFile
, const OUString
& rFilter
,
210 const OUString
& rOptions
, const OUString
& rSource
,
211 const ScRange
& rDestRange
, sal_uLong nRefresh
,
212 bool bFitBlock
, bool bApi
);
215 * @param nOldIndex If 0 don't delete an old format
216 * @param pFormat if NULL only delete an old format
218 void ReplaceConditionalFormat( sal_uLong nOldIndex
, ScConditionalFormat
* pFormat
, SCTAB nTab
, const ScRangeList
& rRanges
);
221 * Sets or replaces the conditional format list of a table
223 * @param pList the new ScConditionalFormatList, method takes ownership
224 * @param nTab the tab to which the conditional format list belongs
226 void SetConditionalFormatList( ScConditionalFormatList
* pList
, SCTAB nTab
);
228 void ConvertFormulaToValue( const ScRange
& rRange
, bool bRecord
, bool bInteraction
);
231 class ScDocFuncDirect
: public ScDocFunc
234 ScDocFuncDirect( ScDocShell
& rDocSh
) : ScDocFunc( rDocSh
) {}
235 virtual ~ScDocFuncDirect() {}
238 void VBA_DeleteModule( ScDocShell
& rDocSh
, const OUString
& sModuleName
);
242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */