1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_DOCFUNC_HXX 25cdf0e10cSrcweir #define SC_DOCFUNC_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/link.hxx> 28cdf0e10cSrcweir #include "global.hxx" 29cdf0e10cSrcweir #include "formula/grammar.hxx" 30cdf0e10cSrcweir #include "tabbgcolor.hxx" 31cdf0e10cSrcweir 32cdf0e10cSrcweir class ScEditEngineDefaulter; 33cdf0e10cSrcweir class SdrUndoAction; 34cdf0e10cSrcweir class ScAddress; 35cdf0e10cSrcweir class ScDocShell; 36cdf0e10cSrcweir class ScMarkData; 37cdf0e10cSrcweir class ScPatternAttr; 38cdf0e10cSrcweir class ScRange; 39cdf0e10cSrcweir class ScRangeName; 40cdf0e10cSrcweir class ScBaseCell; 41cdf0e10cSrcweir class ScTokenArray; 42cdf0e10cSrcweir struct ScTabOpParam; 43cdf0e10cSrcweir class ScTableProtection; 44cdf0e10cSrcweir 45cdf0e10cSrcweir // --------------------------------------------------------------------------- 46cdf0e10cSrcweir 47cdf0e10cSrcweir class ScDocFunc 48cdf0e10cSrcweir { 49cdf0e10cSrcweir private: 50cdf0e10cSrcweir ScDocShell& rDocShell; 51cdf0e10cSrcweir 52cdf0e10cSrcweir sal_Bool AdjustRowHeight( const ScRange& rRange, sal_Bool bPaint = sal_True ); 53cdf0e10cSrcweir void CreateOneName( ScRangeName& rList, 54cdf0e10cSrcweir SCCOL nPosX, SCROW nPosY, SCTAB nTab, 55cdf0e10cSrcweir SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, 56cdf0e10cSrcweir sal_Bool& rCancel, sal_Bool bApi ); 57cdf0e10cSrcweir void NotifyInputHandler( const ScAddress& rPos ); 58cdf0e10cSrcweir 59cdf0e10cSrcweir public: ScDocFunc(ScDocShell & rDocSh)60cdf0e10cSrcweir ScDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {} ~ScDocFunc()61cdf0e10cSrcweir ~ScDocFunc() {} 62cdf0e10cSrcweir 63cdf0e10cSrcweir DECL_LINK( NotifyDrawUndo, SdrUndoAction* ); 64cdf0e10cSrcweir 65cdf0e10cSrcweir sal_Bool DetectiveAddPred(const ScAddress& rPos); 66cdf0e10cSrcweir sal_Bool DetectiveDelPred(const ScAddress& rPos); 67cdf0e10cSrcweir sal_Bool DetectiveAddSucc(const ScAddress& rPos); 68cdf0e10cSrcweir sal_Bool DetectiveDelSucc(const ScAddress& rPos); 69cdf0e10cSrcweir sal_Bool DetectiveAddError(const ScAddress& rPos); 70cdf0e10cSrcweir sal_Bool DetectiveMarkInvalid(SCTAB nTab); 71cdf0e10cSrcweir sal_Bool DetectiveDelAll(SCTAB nTab); 72cdf0e10cSrcweir sal_Bool DetectiveRefresh(sal_Bool bAutomatic = sal_False); 73cdf0e10cSrcweir 74cdf0e10cSrcweir sal_Bool DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags, 75cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bApi ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir sal_Bool TransliterateText( const ScMarkData& rMark, sal_Int32 nType, 78cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bApi ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir sal_Bool SetNormalString( const ScAddress& rPos, const String& rText, sal_Bool bApi ); 81cdf0e10cSrcweir sal_Bool PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi ); 82cdf0e10cSrcweir sal_Bool PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine, 83cdf0e10cSrcweir sal_Bool bInterpret, sal_Bool bApi ); 84cdf0e10cSrcweir sal_Bool SetCellText( const ScAddress& rPos, const String& rText, 85cdf0e10cSrcweir sal_Bool bInterpret, sal_Bool bEnglish, sal_Bool bApi, 86cdf0e10cSrcweir const String& rFormulaNmsp, 87cdf0e10cSrcweir const formula::FormulaGrammar::Grammar eGrammar ); 88cdf0e10cSrcweir 89cdf0e10cSrcweir // creates a new cell for use with PutCell 90cdf0e10cSrcweir ScBaseCell* InterpretEnglishString( const ScAddress& rPos, const String& rText, 91cdf0e10cSrcweir const String& rFormulaNmsp, const formula::FormulaGrammar::Grammar eGrammar, 92cdf0e10cSrcweir short* pRetFormatType = NULL ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir bool ShowNote( const ScAddress& rPos, bool bShow = true ); HideNote(const ScAddress & rPos)95cdf0e10cSrcweir inline bool HideNote( const ScAddress& rPos ) { return ShowNote( rPos, false ); } 96cdf0e10cSrcweir 97cdf0e10cSrcweir bool SetNoteText( const ScAddress& rPos, const String& rNoteText, sal_Bool bApi ); 98cdf0e10cSrcweir bool ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate, sal_Bool bApi ); 99cdf0e10cSrcweir 100cdf0e10cSrcweir sal_Bool ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& rPattern, 101cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bApi ); 102cdf0e10cSrcweir sal_Bool ApplyStyle( const ScMarkData& rMark, const String& rStyleName, 103cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bApi ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir sal_Bool InsertCells( const ScRange& rRange,const ScMarkData* pTabMark, 106cdf0e10cSrcweir InsCellCmd eCmd, sal_Bool bRecord, sal_Bool bApi, 107cdf0e10cSrcweir sal_Bool bPartOfPaste = sal_False ); 108cdf0e10cSrcweir sal_Bool DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, 109cdf0e10cSrcweir DelCellCmd eCmd, sal_Bool bRecord, sal_Bool bApi ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir sal_Bool MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, 112cdf0e10cSrcweir sal_Bool bCut, sal_Bool bRecord, sal_Bool bPaint, sal_Bool bApi ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir sal_Bool InsertTable( SCTAB nTab, const String& rName, sal_Bool bRecord, sal_Bool bApi ); 115cdf0e10cSrcweir sal_Bool RenameTable( SCTAB nTab, const String& rName, sal_Bool bRecord, sal_Bool bApi ); 116cdf0e10cSrcweir sal_Bool DeleteTable( SCTAB nTab, sal_Bool bRecord, sal_Bool bApi ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir bool SetTabBgColor( SCTAB nTab, const Color& rColor, bool bRecord, bool bApi ); 119cdf0e10cSrcweir bool SetTabBgColor( ScUndoTabColorInfo::List& rUndoTabColorList, bool bRecord, bool bApi ); 120cdf0e10cSrcweir 121cdf0e10cSrcweir sal_Bool SetTableVisible( SCTAB nTab, sal_Bool bVisible, sal_Bool bApi ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir sal_Bool SetLayoutRTL( SCTAB nTab, sal_Bool bRTL, sal_Bool bApi ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir //UNUSED2009-05 sal_Bool SetGrammar( formula::FormulaGrammar::Grammar eGrammar ); 126cdf0e10cSrcweir 127cdf0e10cSrcweir SC_DLLPUBLIC sal_Bool SetWidthOrHeight( sal_Bool bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges, 128cdf0e10cSrcweir SCTAB nTab, ScSizeMode eMode, sal_uInt16 nSizeTwips, 129cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bApi ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir sal_Bool InsertPageBreak( sal_Bool bColumn, const ScAddress& rPos, 132cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bSetModified, sal_Bool bApi ); 133cdf0e10cSrcweir sal_Bool RemovePageBreak( sal_Bool bColumn, const ScAddress& rPos, 134cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bSetModified, sal_Bool bApi ); 135cdf0e10cSrcweir 136cdf0e10cSrcweir void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir sal_Bool Protect( SCTAB nTab, const String& rPassword, sal_Bool bApi ); 139cdf0e10cSrcweir sal_Bool Unprotect( SCTAB nTab, const String& rPassword, sal_Bool bApi ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir sal_Bool ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, sal_Bool bApi ); 142cdf0e10cSrcweir sal_Bool ChangeIndent( const ScMarkData& rMark, sal_Bool bIncrement, sal_Bool bApi ); 143cdf0e10cSrcweir sal_Bool AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark, 144cdf0e10cSrcweir sal_uInt16 nFormatNo, sal_Bool bRecord, sal_Bool bApi ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir sal_Bool EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, 147cdf0e10cSrcweir const ScTokenArray* pTokenArray, 148cdf0e10cSrcweir const String& rString, sal_Bool bApi, sal_Bool bEnglish, 149cdf0e10cSrcweir const String& rFormulaNmsp, 150cdf0e10cSrcweir const formula::FormulaGrammar::Grammar ); 151cdf0e10cSrcweir 152cdf0e10cSrcweir sal_Bool TabOp( const ScRange& rRange, const ScMarkData* pTabMark, 153cdf0e10cSrcweir const ScTabOpParam& rParam, sal_Bool bRecord, sal_Bool bApi ); 154cdf0e10cSrcweir 155cdf0e10cSrcweir sal_Bool FillSimple( const ScRange& rRange, const ScMarkData* pTabMark, 156cdf0e10cSrcweir FillDir eDir, sal_Bool bRecord, sal_Bool bApi ); 157cdf0e10cSrcweir sal_Bool FillSeries( const ScRange& rRange, const ScMarkData* pTabMark, 158cdf0e10cSrcweir FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, 159cdf0e10cSrcweir double fStart, double fStep, double fMax, 160cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bApi ); 161cdf0e10cSrcweir // FillAuto: rRange wird von Source-Range auf Dest-Range angepasst 162cdf0e10cSrcweir sal_Bool FillAuto( ScRange& rRange, const ScMarkData* pTabMark, 163cdf0e10cSrcweir FillDir eDir, sal_uLong nCount, sal_Bool bRecord, sal_Bool bApi ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir sal_Bool ResizeMatrix( const ScRange& rOldRange, const ScAddress& rNewEnd, sal_Bool bApi ); 166cdf0e10cSrcweir 167cdf0e10cSrcweir sal_Bool MergeCells( const ScRange& rRange, sal_Bool bContents, 168cdf0e10cSrcweir sal_Bool bRecord, sal_Bool bApi ); 169cdf0e10cSrcweir sal_Bool UnmergeCells( const ScRange& rRange, sal_Bool bRecord, sal_Bool bApi ); 170cdf0e10cSrcweir 171cdf0e10cSrcweir sal_Bool SetNewRangeNames( ScRangeName* pNewRanges, sal_Bool bApi ); // takes ownership of pNewRanges 172cdf0e10cSrcweir sal_Bool ModifyRangeNames( const ScRangeName& rNewRanges, sal_Bool bApi ); 173cdf0e10cSrcweir 174cdf0e10cSrcweir sal_Bool CreateNames( const ScRange& rRange, sal_uInt16 nFlags, sal_Bool bApi ); 175cdf0e10cSrcweir sal_Bool InsertNameList( const ScAddress& rStartPos, sal_Bool bApi ); 176cdf0e10cSrcweir 177cdf0e10cSrcweir sal_Bool InsertAreaLink( const String& rFile, const String& rFilter, 178cdf0e10cSrcweir const String& rOptions, const String& rSource, 179cdf0e10cSrcweir const ScRange& rDestRange, sal_uLong nRefresh, 180cdf0e10cSrcweir sal_Bool bFitBlock, sal_Bool bApi ); 181cdf0e10cSrcweir }; 182cdf0e10cSrcweir 183cdf0e10cSrcweir 184cdf0e10cSrcweir 185cdf0e10cSrcweir #endif 186cdf0e10cSrcweir 187