merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / inc / viewfunc.hxx
blob0f71150c78c0fd4c62bf09a16ebb01e3f4cefbb2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewfunc.hxx,v $
10 * $Revision: 1.34.128.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SC_VIEWFUNC_HXX
31 #define SC_VIEWFUNC_HXX
33 #include "tabview.hxx"
35 #include "tabbgcolor.hxx"
37 #ifndef _SVSTDARR_SHORTS
38 #define _SVSTDARR_SHORTS
39 #include <svtools/svstdarr.hxx>
41 #endif
43 #ifndef _SVSTDARR_STRINGS
45 #define _SVSTDARR_STRINGS
46 #include <svtools/svstdarr.hxx>
48 #endif
49 #include <com/sun/star/embed/XEmbeddedObject.hpp>
50 #include <com/sun/star/embed/Aspects.hpp>
52 class ScPatternAttr;
53 class ScAutoFormatData;
54 class SvxSearchItem;
55 class SfxItemSet;
56 class SvxBorderLine;
57 class SvxBoxItem;
58 class SvxBoxInfoItem;
59 class SfxStyleSheet;
60 class SfxPoolItem;
61 class EditTextObject;
62 struct ScSolveParam;
63 struct ScTabOpParam;
64 class ScPostIt;
65 class ScConditionalFormat;
66 class ScValidationData;
67 class ScConversionParam;
68 class SdrModel;
69 class Graphic;
70 class Exchange;
71 class ScRangeList;
72 class SvxHyperlinkItem;
73 class ScTransferObj;
74 class ScTableProtection;
76 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
78 //==================================================================
80 class ScViewFunc : public ScTabView
82 private:
83 ScAddress aFormatSource; // fuer automatisches Erweitern von Formatierung
84 ScRange aFormatArea;
85 BOOL bFormatValid;
87 public:
88 ScViewFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
89 //UNUSED2008-05 ScViewFunc( Window* pParent, const ScViewFunc& rViewFunc, ScTabViewShell* pViewShell );
90 ~ScViewFunc();
92 const ScPatternAttr* GetSelectionPattern ();
93 void GetSelectionFrame ( SvxBoxItem& rLineOuter,
94 SvxBoxInfoItem& rLineInner );
96 BYTE GetSelectionScriptType();
98 BOOL GetAutoSumArea(ScRangeList& rRangeList);
99 void EnterAutoSum(const ScRangeList& rRangeList, sal_Bool bSubTotal);
100 bool AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor, bool bContinue );
101 String GetAutoSumFormula( const ScRangeList& rRangeList, bool bSubTotal );
103 void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
104 BOOL bRecord = TRUE, const EditTextObject* pData = NULL );
105 void EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue );
106 void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextObject* pData,
107 BOOL bRecord = TRUE, BOOL bTestSimple = FALSE );
109 void EnterMatrix( const String& rString );
110 void EnterBlock( const String& rString, const EditTextObject* pData );
112 void EnterDataAtCursor( const String& rString ); //! nicht benutzt ?
114 SC_DLLPUBLIC void CutToClip( ScDocument* pClipDoc = NULL, BOOL bIncludeObjects = FALSE );
115 SC_DLLPUBLIC BOOL CopyToClip( ScDocument* pClipDoc = NULL, BOOL bCut = FALSE, BOOL bApi = FALSE,
116 BOOL bIncludeObjects = FALSE, BOOL bStopEdit = TRUE );
117 ScTransferObj* CopyToTransferable();
118 SC_DLLPUBLIC BOOL PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
119 USHORT nFunction = PASTE_NOFUNC, BOOL bSkipEmpty = FALSE,
120 BOOL bTranspose = FALSE, BOOL bAsLink = FALSE,
121 InsCellCmd eMoveMode = INS_NONE,
122 USHORT nUndoExtraFlags = IDF_NONE,
123 BOOL bAllowDialogs = FALSE );
125 void FillTab( USHORT nFlags, USHORT nFunction, BOOL bSkipEmpty, BOOL bAsLink );
127 SC_DLLPUBLIC void PasteFromSystem();
128 SC_DLLPUBLIC BOOL PasteFromSystem( ULONG nFormatId, BOOL bApi = FALSE );
129 void PasteFromTransferable( const ::com::sun::star::uno::Reference<
130 ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
132 void PasteDraw();
133 void PasteDraw( const Point& rLogicPos, SdrModel* pModel,
134 BOOL bGroup = FALSE, BOOL bSameDocClipboard = FALSE );
136 BOOL PasteOnDrawObject( const ::com::sun::star::uno::Reference<
137 ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
138 SdrObject* pHitObj, BOOL bLink );
140 BOOL PasteDataFormat( ULONG nFormatId,
141 const ::com::sun::star::uno::Reference<
142 ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
143 SCCOL nPosX, SCROW nPosY, Point* pLogicPos = NULL,
144 BOOL bLink = FALSE, BOOL bAllowDialogs = FALSE );
146 BOOL PasteFile( const Point&, const String&, BOOL bLink=FALSE );
147 BOOL PasteObject( const Point&, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >&, const Size* = NULL, const Graphic* = NULL, const ::rtl::OUString& = ::rtl::OUString(), sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT );
148 BOOL PasteBitmap( const Point&, const Bitmap& );
149 BOOL PasteMetaFile( const Point&, const GDIMetaFile& );
150 BOOL PasteGraphic( const Point& rPos, const Graphic& rGraphic,
151 const String& rFile, const String& rFilter );
152 BOOL PasteBookmark( ULONG nFormatId,
153 const ::com::sun::star::uno::Reference<
154 ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
155 SCCOL nPosX, SCROW nPosY );
156 BOOL PasteDDE( const ::com::sun::star::uno::Reference<
157 ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
159 BOOL ApplyGraphicToObject( SdrObject* pObject, const Graphic& rGraphic );
161 void InsertBookmark( const String& rDescription, const String& rURL,
162 SCCOL nPosX, SCROW nPosY, const String* pTarget = NULL,
163 BOOL bTryReplace = FALSE );
164 BOOL HasBookmarkAtCursor( SvxHyperlinkItem* pContent );
166 long DropRequestHdl( Exchange* pExchange );
167 BOOL MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos,
168 BOOL bCut, BOOL bRecord, BOOL bPaint, BOOL bApi );
170 BOOL LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, BOOL bApi );
172 void CreateNames( USHORT nFlags );
173 USHORT GetCreateNameFlags();
174 void InsertNameList();
175 BOOL InsertName( const String& rName, const String& rSymbol,
176 const String& rType );
178 void ApplyAttributes( const SfxItemSet* pDialogSet, const SfxItemSet* pOldSet,
179 BOOL bRecord = TRUE );
180 void ApplyAttr( const SfxPoolItem& rAttrItem );
181 void ApplySelectionPattern( const ScPatternAttr& rAttr,
182 BOOL bRecord = TRUE,
183 BOOL bCursorOnly = FALSE );
184 void ApplyPatternLines( const ScPatternAttr& rAttr,
185 const SvxBoxItem* pNewOuter,
186 const SvxBoxInfoItem* pNewInner, BOOL bRecord = TRUE );
188 void ApplyUserItemSet( const SfxItemSet& rItemSet );
190 const SfxStyleSheet* GetStyleSheetFromMarked();
191 void SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet,
192 BOOL bRecord = TRUE );
193 void RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet );
194 void UpdateStyleSheetInUse( SfxStyleSheet* pStyleSheet );
196 void SetNumberFormat( short nFormatType, ULONG nAdd = 0 );
197 void SetNumFmtByStr( const String& rCode );
198 void ChangeNumFmtDecimals( BOOL bIncrement );
200 void SetConditionalFormat( const ScConditionalFormat& rNew );
201 void SetValidation( const ScValidationData& rNew );
203 void ChangeIndent( BOOL bIncrement );
205 void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
207 void Protect( SCTAB nTab, const String& rPassword );
208 BOOL Unprotect( SCTAB nTab, const String& rPassword );
210 void DeleteCells( DelCellCmd eCmd, BOOL bRecord = TRUE );
211 BOOL InsertCells( InsCellCmd eCmd, BOOL bRecord = TRUE, BOOL bPartOfPaste = FALSE );
212 void DeleteMulti( BOOL bRows, BOOL bRecord = TRUE );
214 void DeleteContents( USHORT nFlags, BOOL bRecord = TRUE );
216 void SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges,
217 ScSizeMode eMode, USHORT nSizeTwips,
218 BOOL bRecord = TRUE, BOOL bPaint = TRUE,
219 ScMarkData* pMarkData = NULL );
220 void SetMarkedWidthOrHeight( BOOL bWidth, ScSizeMode eMode, USHORT nSizeTwips,
221 BOOL bRecord = TRUE, BOOL bPaint = TRUE );
222 void ShowMarkedColumns( BOOL bShow, BOOL bRecord = TRUE );
223 void ShowMarkedRows( BOOL bShow, BOOL bRecord = TRUE );
225 BOOL AdjustBlockHeight( BOOL bPaint = TRUE, ScMarkData* pMarkData = NULL );
226 BOOL AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, BOOL bPaint = TRUE );
228 void ModifyCellSize( ScDirection eDir, BOOL bOptimal );
230 SC_DLLPUBLIC void InsertPageBreak( BOOL bColumn, BOOL bRecord = TRUE,
231 const ScAddress* pPos = NULL,
232 BOOL bSetModified = TRUE );
233 SC_DLLPUBLIC void DeletePageBreak( BOOL bColumn, BOOL bRecord = TRUE,
234 const ScAddress* pPos = NULL,
235 BOOL bSetModified = TRUE );
237 void RemoveManualBreaks();
239 void SetPrintZoom(USHORT nScale, USHORT nPages);
240 void AdjustPrintZoom();
242 BOOL TestMergeCells();
243 BOOL TestRemoveMerge();
245 BOOL MergeCells( BOOL bApi, BOOL& rDoContents, BOOL bRecord = TRUE, BOOL bCenter = FALSE );
246 BOOL RemoveMerge( BOOL bRecord = TRUE );
248 void FillSimple( FillDir eDir, BOOL bRecord = TRUE );
249 void FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd,
250 double fStart, double fStep, double fMax, BOOL bRecord = TRUE );
251 void FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
252 SCCOL nEndCol, SCROW nEndRow, ULONG nCount, BOOL bRecord = TRUE );
253 void FillCrossDblClick();
255 void TransliterateText( sal_Int32 nType );
257 ScAutoFormatData* CreateAutoFormatData();
258 void AutoFormat( USHORT nFormatNo, BOOL bRecord = TRUE );
260 void SearchAndReplace( const SvxSearchItem* pSearchItem,
261 BOOL bAddUndo, BOOL bIsApi );
263 void Solve( const ScSolveParam& rParam );
264 void TabOp( const ScTabOpParam& rParam, BOOL bRecord = TRUE );
266 BOOL InsertTable( const String& rName, SCTAB nTabNr, BOOL bRecord = TRUE );
267 BOOL InsertTables(SvStrings *pNames, SCTAB nTab, SCTAB nCount, BOOL bRecord = TRUE);
270 BOOL AppendTable( const String& rName, BOOL bRecord = TRUE );
272 BOOL DeleteTable( SCTAB nTabNr, BOOL bRecord = TRUE );
273 BOOL DeleteTables(const SvShorts &TheTabs, BOOL bRecord = TRUE );
275 BOOL RenameTable( const String& rName, SCTAB nTabNr );
276 void MoveTable( USHORT nDestDocNo, SCTAB nDestTab, BOOL bCopy );
277 void ImportTables( ScDocShell* pSrcShell,
278 SCTAB nCount, const SCTAB* pSrcTabs,
279 BOOL bLink,SCTAB nTab);
281 BOOL SetTabBgColor( const Color& rColor, SCTAB nTabNr );
282 BOOL SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList );
284 void InsertTableLink( const String& rFile,
285 const String& rFilter, const String& rOptions,
286 const String& rTabName );
287 void InsertAreaLink( const String& rFile,
288 const String& rFilter, const String& rOptions,
289 const String& rSource, ULONG nRefresh );
291 void ShowTable( const String& rName );
292 void HideTable( SCTAB nTabNr );
294 void MakeScenario( const String& rName, const String& rComment,
295 const Color& rColor, USHORT nFlags );
296 void ExtendScenario();
297 void UseScenario( const String& rName );
299 void InsertSpecialChar( const String& rStr, const Font& rFont );
301 void InsertDummyObject();
302 void InsertOleObject();
304 void InsertDraw();
306 void SetSelectionFrameLines( const SvxBorderLine* pLine,
307 BOOL bColorOnly );
309 void SetNoteText( const ScAddress& rPos, const String& rNoteText );
310 void ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate );
311 void DoRefConversion( BOOL bRecord = TRUE );
313 //UNUSED2008-05 void DoSpellingChecker( BOOL bRecord = TRUE );
314 void DoHangulHanjaConversion( BOOL bRecord = TRUE );
315 void DoThesaurus( BOOL bRecord = TRUE );
316 //UNUSED2008-05 DECL_LINK( SpellError, void * );
318 /** Generic implementation of sheet conversion functions. */
319 void DoSheetConversion( const ScConversionParam& rParam, BOOL bRecord = TRUE );
321 void SetPrintRanges( BOOL bEntireSheet,
322 const String* pPrint,
323 const String* pRepCol, const String* pRepRow,
324 BOOL bAddPrint );
326 void DetectiveAddPred();
327 void DetectiveDelPred();
328 void DetectiveAddSucc();
329 void DetectiveDelSucc();
330 void DetectiveAddError();
331 void DetectiveMarkInvalid();
332 void DetectiveDelAll();
333 void DetectiveRefresh();
334 void DetectiveMarkPred();
335 void DetectiveMarkSucc();
337 void ShowNote( bool bShow = true );
338 inline void HideNote() { ShowNote( false ); }
339 void EditNote();
341 void ForgetFormatArea() { bFormatValid = FALSE; }
342 BOOL SelectionEditable( BOOL* pOnlyNotBecauseOfMatrix = NULL );
344 // Amelia Wang
345 SC_DLLPUBLIC void DataFormPutData( SCROW nCurrentRow ,
346 SCROW nStartRow , SCCOL nStartCol ,
347 SCROW nEndRow , SCCOL nEndCol ,
348 Edit** pEdits ,
349 sal_uInt16 aColLength );
351 // interne Hilfsfunktionen
352 protected:
353 void UpdateLineAttrs( SvxBorderLine& rLine,
354 const SvxBorderLine* pDestLine,
355 const SvxBorderLine* pSrcLine,
356 BOOL bColor );
358 //UNUSED2008-05 void PaintWidthHeight( BOOL bColumns, SCCOLROW nStart, SCCOLROW nEnd );
361 private:
362 void PasteRTF( SCCOL nCol, SCROW nStartRow,
363 const ::com::sun::star::uno::Reference<
364 ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
365 bool PasteMultiRangesFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction,
366 bool bSkipEmpty, bool bTranspos, bool bAsLink, bool bAllowDialogs,
367 InsCellCmd eMoveMode, sal_uInt16 nCondFlags, sal_uInt16 nUndoFlags );
368 void PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark);
370 USHORT GetOptimalColWidth( SCCOL nCol, SCTAB nTab, BOOL bFormula );
372 void StartFormatArea();
373 BOOL TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, BOOL bAttrChanged );
374 void DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab,
375 BOOL bAttrChanged, BOOL bAddUndo );
377 void MarkAndJumpToRanges(const ScRangeList& rRanges);
382 #endif