fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / inc / viewfunc.hxx
blob6f3cabd1364004ceb562b598d4fce51472ed6fd0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_SC_SOURCE_UI_INC_VIEWFUNC_HXX
20 #define INCLUDED_SC_SOURCE_UI_INC_VIEWFUNC_HXX
22 #include "tabview.hxx"
24 #include "tabbgcolor.hxx"
26 #include <com/sun/star/embed/XEmbeddedObject.hpp>
27 #include <com/sun/star/embed/Aspects.hpp>
28 #include <vector>
29 #include <boost/ptr_container/ptr_vector.hpp>
31 class ScPatternAttr;
32 class ScAutoFormatData;
33 class SvxSearchItem;
34 class SfxItemSet;
35 class SvxBoxItem;
36 class SvxBoxInfoItem;
37 class SfxStyleSheetBase;
38 class SfxStyleSheet;
39 class SfxPoolItem;
40 class EditTextObject;
41 struct ScSolveParam;
42 struct ScTabOpParam;
43 class ScValidationData;
44 class ScConversionParam;
45 class SdrModel;
46 class Graphic;
47 class Exchange;
48 class ScRangeList;
49 class SvxHyperlinkItem;
50 class ScTransferObj;
51 class ScTableProtection;
53 namespace editeng { class SvxBorderLine; }
55 namespace sc {
57 struct ColRowSpan;
61 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
63 class ScViewFunc : public ScTabView
65 private:
66 ScAddress aFormatSource; // for automatic extension of formatting
67 ScRange aFormatArea;
68 bool bFormatValid;
70 public:
71 ScViewFunc( vcl::Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
72 ~ScViewFunc();
74 const ScPatternAttr* GetSelectionPattern ();
75 void GetSelectionFrame ( SvxBoxItem& rLineOuter,
76 SvxBoxInfoItem& rLineInner );
78 SvtScriptType GetSelectionScriptType();
80 bool GetAutoSumArea(ScRangeList& rRangeList);
81 void EnterAutoSum(const ScRangeList& rRangeList, bool bSubTotal, const ScAddress& rAddr);
82 bool AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor, bool bContinue );
83 OUString GetAutoSumFormula( const ScRangeList& rRangeList, bool bSubTotal, const ScAddress& rAddr );
85 void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
86 const EditTextObject* pData = NULL );
87 void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
88 const EditTextObject& rData, bool bTestSimple = false );
89 void EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue );
91 void EnterMatrix( const OUString& rString, ::formula::FormulaGrammar::Grammar eGram );
93 /**
94 * @param pData The caller must manage the life cycle of the object this
95 * pointer points to. NULL is allowed.
97 void EnterBlock( const OUString& rString, const EditTextObject* pData );
99 void EnterDataAtCursor( const OUString& rString ); //! Not used?
101 SC_DLLPUBLIC void CutToClip( ScDocument* pClipDoc = NULL, bool bIncludeObjects = false );
102 SC_DLLPUBLIC bool CopyToClip( ScDocument* pClipDoc = NULL, bool bCut = false, bool bApi = false,
103 bool bIncludeObjects = false, bool bStopEdit = true );
104 SC_DLLPUBLIC bool CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRange, bool bCut = false,
105 bool bApi = false, bool bIncludeObjects = false, bool bStopEdit = true, bool bUseRangeForVBA = true );
106 ScTransferObj* CopyToTransferable();
107 SC_DLLPUBLIC bool PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
108 sal_uInt16 nFunction = PASTE_NOFUNC, bool bSkipEmpty = false,
109 bool bTranspose = false, bool bAsLink = false,
110 InsCellCmd eMoveMode = INS_NONE,
111 InsertDeleteFlags nUndoExtraFlags = IDF_NONE,
112 bool bAllowDialogs = false );
114 void FillTab( InsertDeleteFlags nFlags, sal_uInt16 nFunction, bool bSkipEmpty, bool bAsLink );
116 SC_DLLPUBLIC void PasteFromSystem();
117 SC_DLLPUBLIC bool PasteFromSystem( SotClipboardFormatId nFormatId, bool bApi = false );
118 void PasteFromTransferable( const ::com::sun::star::uno::Reference<
119 ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
121 void PasteDraw();
122 void PasteDraw( const Point& rLogicPos, SdrModel* pModel, bool bGroup,
123 const OUString& rSrcShellID, const OUString& rDestShellID );
125 bool PasteOnDrawObjectLinked(
126 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
127 SdrObject& rHitObj);
129 bool PasteDataFormat( SotClipboardFormatId nFormatId,
130 const ::com::sun::star::uno::Reference<
131 ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
132 SCCOL nPosX, SCROW nPosY, Point* pLogicPos = NULL,
133 bool bLink = false, bool bAllowDialogs = false );
135 bool PasteFile( const Point&, const OUString&, bool bLink=false );
136 bool PasteObject( const Point&, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >&, const Size* = NULL, const Graphic* = NULL, const OUString& = OUString(), sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT );
137 bool PasteBitmapEx( const Point&, const BitmapEx& );
138 bool PasteMetaFile( const Point&, const GDIMetaFile& );
139 bool PasteGraphic( const Point& rPos, const Graphic& rGraphic,
140 const OUString& rFile, const OUString& rFilter );
141 bool PasteBookmark( SotClipboardFormatId nFormatId,
142 const ::com::sun::star::uno::Reference<
143 ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
144 SCCOL nPosX, SCROW nPosY );
145 bool PasteLink( const ::com::sun::star::uno::Reference<
146 ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
148 void InsertBookmark( const OUString& rDescription, const OUString& rURL,
149 SCCOL nPosX, SCROW nPosY, const OUString* pTarget = NULL,
150 bool bTryReplace = false );
151 bool HasBookmarkAtCursor( SvxHyperlinkItem* pContent );
153 long DropRequestHdl( Exchange* pExchange );
154 bool MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos,
155 bool bCut, bool bRecord, bool bPaint, bool bApi );
157 bool LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, bool bApi );
159 void CreateNames( sal_uInt16 nFlags );
160 sal_uInt16 GetCreateNameFlags();
161 void InsertNameList();
162 bool InsertName( const OUString& rName, const OUString& rSymbol,
163 const OUString& rType );
165 void ApplyAttributes( const SfxItemSet* pDialogSet, const SfxItemSet* pOldSet,
166 bool bRecord = true );
167 void ApplyAttr( const SfxPoolItem& rAttrItem );
168 void ApplySelectionPattern( const ScPatternAttr& rAttr,
169 bool bRecord = true,
170 bool bCursorOnly = false );
171 void ApplyPatternLines( const ScPatternAttr& rAttr,
172 const SvxBoxItem* pNewOuter,
173 const SvxBoxInfoItem* pNewInner, bool bRecord = true );
175 void ApplyUserItemSet( const SfxItemSet& rItemSet );
177 const SfxStyleSheet*
178 GetStyleSheetFromMarked();
179 void SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet,
180 bool bRecord = true );
181 void RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet );
182 void UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet );
184 void SetNumberFormat( short nFormatType, sal_uLong nAdd = 0 );
185 void SetNumFmtByStr( const OUString& rCode );
186 void ChangeNumFmtDecimals( bool bIncrement );
188 void SetValidation( const ScValidationData& rNew );
190 void ChangeIndent( bool bIncrement );
192 void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
194 void Protect( SCTAB nTab, const OUString& rPassword );
195 bool Unprotect( SCTAB nTab, const OUString& rPassword );
197 void DeleteCells( DelCellCmd eCmd, bool bRecord = true );
198 bool InsertCells( InsCellCmd eCmd, bool bRecord = true, bool bPartOfPaste = false );
199 void DeleteMulti( bool bRows, bool bRecord = true );
201 void DeleteContents( InsertDeleteFlags nFlags, bool bRecord = true );
203 void SetWidthOrHeight(
204 bool bWidth, const std::vector<sc::ColRowSpan>& rRanges, ScSizeMode eMode,
205 sal_uInt16 nSizeTwips, bool bRecord = true, bool bPaint = true, ScMarkData* pMarkData = NULL );
207 void SetMarkedWidthOrHeight( bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips,
208 bool bRecord = true, bool bPaint = true );
209 void ShowMarkedColumns( bool bShow, bool bRecord = true );
210 void ShowMarkedRows( bool bShow, bool bRecord = true );
212 bool AdjustBlockHeight( bool bPaint = true, ScMarkData* pMarkData = NULL );
213 bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bPaint = true );
215 void ModifyCellSize( ScDirection eDir, bool bOptimal );
217 SC_DLLPUBLIC void
218 InsertPageBreak( bool bColumn, bool bRecord = true,
219 const ScAddress* pPos = NULL,
220 bool bSetModified = true );
221 SC_DLLPUBLIC void
222 DeletePageBreak( bool bColumn, bool bRecord = true,
223 const ScAddress* pPos = NULL,
224 bool bSetModified = true );
226 void RemoveManualBreaks();
228 void SetPrintZoom(sal_uInt16 nScale, sal_uInt16 nPages);
229 void AdjustPrintZoom();
231 bool TestMergeCells();
232 bool TestRemoveMerge();
234 bool MergeCells( bool bApi, bool& rDoContents, bool bRecord = true, bool bCenter = false );
235 bool RemoveMerge( bool bRecord = true );
237 void FillSimple( FillDir eDir, bool bRecord = true );
238 void FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd,
239 double fStart, double fStep, double fMax, bool bRecord = true );
240 void FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
241 SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount, bool bRecord = true );
242 void FillCrossDblClick();
243 void ConvertFormulaToValue();
245 void TransliterateText( sal_Int32 nType );
247 ScAutoFormatData* CreateAutoFormatData();
248 void AutoFormat( sal_uInt16 nFormatNo, bool bRecord = true );
250 bool SearchAndReplace( const SvxSearchItem* pSearchItem,
251 bool bAddUndo, bool bIsApi );
253 void Solve( const ScSolveParam& rParam );
254 void TabOp( const ScTabOpParam& rParam, bool bRecord = true );
256 bool InsertTable( const OUString& rName, SCTAB nTabNr, bool bRecord = true );
257 bool InsertTables(std::vector<OUString>& aNames, SCTAB nTab, SCTAB nCount, bool bRecord = true);
259 bool AppendTable( const OUString& rName, bool bRecord = true );
261 bool DeleteTable( SCTAB nTabNr, bool bRecord = true );
262 bool DeleteTables(const std::vector<SCTAB>& TheTabs, bool bRecord = true );
263 bool DeleteTables(SCTAB nTab, SCTAB nSheets);
265 bool RenameTable( const OUString& rName, SCTAB nTabNr );
266 void MoveTable( sal_uInt16 nDestDocNo, SCTAB nDestTab, bool bCopy, const OUString* pNewTabName = NULL );
267 void ImportTables( ScDocShell* pSrcShell,
268 SCTAB nCount, const SCTAB* pSrcTabs,
269 bool bLink,SCTAB nTab);
271 bool SetTabBgColor( const Color& rColor, SCTAB nTabNr );
272 bool SetTabBgColor( ScUndoTabColorInfo::List& rUndoSetTabBgColorInfoList );
274 void InsertTableLink( const OUString& rFile,
275 const OUString& rFilter, const OUString& rOptions,
276 const OUString& rTabName );
277 void InsertAreaLink( const OUString& rFile,
278 const OUString& rFilter, const OUString& rOptions,
279 const OUString& rSource, sal_uLong nRefresh );
281 void ShowTable( const std::vector<OUString>& rNames );
282 void HideTable( const ScMarkData& rMark );
284 void MakeScenario( const OUString& rName, const OUString& rComment,
285 const Color& rColor, sal_uInt16 nFlags );
286 void ExtendScenario();
287 void UseScenario( const OUString& rName );
289 void InsertSpecialChar( const OUString& rStr, const vcl::Font& rFont );
291 void InsertDummyObject();
292 void InsertOleObject();
294 void InsertDraw();
296 void SetSelectionFrameLines( const ::editeng::SvxBorderLine* pLine,
297 bool bColorOnly );
299 void SetNoteText( const ScAddress& rPos, const OUString& rNoteText );
300 void ReplaceNote( const ScAddress& rPos, const OUString& rNoteText, const OUString* pAuthor, const OUString* pDate );
301 void DoRefConversion( bool bRecord = true );
303 void DoHangulHanjaConversion( bool bRecord = true );
304 void DoThesaurus( bool bRecord = true );
306 /** Generic implementation of sheet conversion functions. */
307 void DoSheetConversion( const ScConversionParam& rParam, bool bRecord = true );
309 void SetPrintRanges( bool bEntireSheet,
310 const OUString* pPrint,
311 const OUString* pRepCol, const OUString* pRepRow,
312 bool bAddPrint );
314 void DetectiveAddPred();
315 void DetectiveDelPred();
316 void DetectiveAddSucc();
317 void DetectiveDelSucc();
318 void DetectiveAddError();
319 void DetectiveMarkInvalid();
320 void DetectiveDelAll();
321 void DetectiveRefresh();
322 void DetectiveMarkPred();
323 void DetectiveMarkSucc();
325 void InsertCurrentTime(short nCellFmt, const OUString& rUndoStr);
327 void ShowNote( bool bShow = true );
328 inline void HideNote() { ShowNote( false ); }
329 void EditNote();
331 void ForgetFormatArea() { bFormatValid = false; }
332 bool SelectionEditable( bool* pOnlyNotBecauseOfMatrix = NULL );
334 SC_DLLPUBLIC void
335 DataFormPutData( SCROW nCurrentRow ,
336 SCROW nStartRow , SCCOL nStartCol ,
337 SCROW nEndRow , SCCOL nEndCol ,
338 std::vector<VclPtr<Edit> >& aEdits,
339 sal_uInt16 aColLength );
340 void UpdateSelectionArea( const ScMarkData& rSel, ScPatternAttr* pAttr = NULL );
341 // Internal helper functions
342 protected:
343 static void UpdateLineAttrs( ::editeng::SvxBorderLine& rLine,
344 const ::editeng::SvxBorderLine* pDestLine,
345 const ::editeng::SvxBorderLine* pSrcLine,
346 bool bColor );
348 private:
349 void PasteRTF( SCCOL nCol, SCROW nStartRow,
350 const ::com::sun::star::uno::Reference<
351 ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
353 bool PasteMultiRangesFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction,
354 bool bSkipEmpty, bool bTranspose, bool bAsLink, bool bAllowDialogs,
355 InsCellCmd eMoveMode, InsertDeleteFlags nUndoFlags );
357 bool PasteFromClipToMultiRanges( InsertDeleteFlags nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction,
358 bool bSkipEmpty, bool bTranspose, bool bAsLink, bool bAllowDialogs,
359 InsCellCmd eMoveMode, InsertDeleteFlags nUndoFlags );
361 void PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMarkData& rMark);
363 sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula );
365 void StartFormatArea();
366 bool TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, bool bAttrChanged );
367 void DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab,
368 bool bAttrChanged, bool bAddUndo );
370 void MarkAndJumpToRanges(const ScRangeList& rRanges);
371 void CopyAutoSpellData( FillDir eDir, SCCOL nStartCol, SCROW nStartRow,
372 SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount );
375 #endif
377 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */