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 #ifndef _SVSTDARR_SHORTS
36 #define _SVSTDARR_SHORTS
37 #include <svtools/svstdarr.hxx>
41 #ifndef _SVSTDARR_STRINGS
43 #define _SVSTDARR_STRINGS
44 #include <svtools/svstdarr.hxx>
47 #include <com/sun/star/embed/XEmbeddedObject.hpp>
48 #include <com/sun/star/embed/Aspects.hpp>
51 class ScAutoFormatData
;
63 class ScConditionalFormat
;
64 class ScValidationData
;
65 class ScConversionParam
;
70 class SvxHyperlinkItem
;
72 class ScTableProtection
;
74 namespace com
{ namespace sun
{ namespace star
{ namespace datatransfer
{ class XTransferable
; } } } }
76 //==================================================================
78 class ScViewFunc
: public ScTabView
81 ScAddress aFormatSource
; // fuer automatisches Erweitern von Formatierung
86 ScViewFunc( Window
* pParent
, ScDocShell
& rDocSh
, ScTabViewShell
* pViewShell
);
87 //UNUSED2008-05 ScViewFunc( Window* pParent, const ScViewFunc& rViewFunc, ScTabViewShell* pViewShell );
90 const ScPatternAttr
* GetSelectionPattern ();
91 void GetSelectionFrame ( SvxBoxItem
& rLineOuter
,
92 SvxBoxInfoItem
& rLineInner
);
94 BYTE
GetSelectionScriptType();
96 BOOL
GetAutoSumArea(ScRangeList
& rRangeList
);
97 void EnterAutoSum(const ScRangeList
& rRangeList
, sal_Bool bSubTotal
);
98 bool AutoSum( const ScRange
& rRange
, bool bSubTotal
, bool bSetCursor
, bool bContinue
);
99 String
GetAutoSumFormula( const ScRangeList
& rRangeList
, bool bSubTotal
);
101 void EnterData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const String
& rString
,
102 BOOL bRecord
= TRUE
, const EditTextObject
* pData
= NULL
);
103 void EnterValue( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const double& rValue
);
104 void EnterData( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const EditTextObject
* pData
,
105 BOOL bRecord
= TRUE
, BOOL bTestSimple
= FALSE
);
107 void EnterMatrix( const String
& rString
);
108 void EnterBlock( const String
& rString
, const EditTextObject
* pData
);
110 void EnterDataAtCursor( const String
& rString
); //! nicht benutzt ?
112 SC_DLLPUBLIC
void CutToClip( ScDocument
* pClipDoc
= NULL
, BOOL bIncludeObjects
= FALSE
);
113 SC_DLLPUBLIC BOOL
CopyToClip( ScDocument
* pClipDoc
= NULL
, BOOL bCut
= FALSE
, BOOL bApi
= FALSE
,
114 BOOL bIncludeObjects
= FALSE
, BOOL bStopEdit
= TRUE
);
115 ScTransferObj
* CopyToTransferable();
116 SC_DLLPUBLIC BOOL
PasteFromClip( USHORT nFlags
, ScDocument
* pClipDoc
,
117 USHORT nFunction
= PASTE_NOFUNC
, BOOL bSkipEmpty
= FALSE
,
118 BOOL bTranspose
= FALSE
, BOOL bAsLink
= FALSE
,
119 InsCellCmd eMoveMode
= INS_NONE
,
120 USHORT nUndoExtraFlags
= IDF_NONE
,
121 BOOL bAllowDialogs
= FALSE
);
123 void FillTab( USHORT nFlags
, USHORT nFunction
, BOOL bSkipEmpty
, BOOL bAsLink
);
125 SC_DLLPUBLIC
void PasteFromSystem();
126 SC_DLLPUBLIC BOOL
PasteFromSystem( ULONG nFormatId
, BOOL bApi
= FALSE
);
127 void PasteFromTransferable( const ::com::sun::star::uno::Reference
<
128 ::com::sun::star::datatransfer::XTransferable
>& rxTransferable
);
131 void PasteDraw( const Point
& rLogicPos
, SdrModel
* pModel
,
132 BOOL bGroup
= FALSE
, BOOL bSameDocClipboard
= FALSE
);
134 BOOL
PasteOnDrawObject( const ::com::sun::star::uno::Reference
<
135 ::com::sun::star::datatransfer::XTransferable
>& rxTransferable
,
136 SdrObject
* pHitObj
, BOOL bLink
);
138 BOOL
PasteDataFormat( ULONG nFormatId
,
139 const ::com::sun::star::uno::Reference
<
140 ::com::sun::star::datatransfer::XTransferable
>& rxTransferable
,
141 SCCOL nPosX
, SCROW nPosY
, Point
* pLogicPos
= NULL
,
142 BOOL bLink
= FALSE
, BOOL bAllowDialogs
= FALSE
);
144 BOOL
PasteFile( const Point
&, const String
&, BOOL bLink
=FALSE
);
145 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
);
146 BOOL
PasteBitmap( const Point
&, const Bitmap
& );
147 BOOL
PasteMetaFile( const Point
&, const GDIMetaFile
& );
148 BOOL
PasteGraphic( const Point
& rPos
, const Graphic
& rGraphic
,
149 const String
& rFile
, const String
& rFilter
);
150 BOOL
PasteBookmark( ULONG nFormatId
,
151 const ::com::sun::star::uno::Reference
<
152 ::com::sun::star::datatransfer::XTransferable
>& rxTransferable
,
153 SCCOL nPosX
, SCROW nPosY
);
154 BOOL
PasteDDE( const ::com::sun::star::uno::Reference
<
155 ::com::sun::star::datatransfer::XTransferable
>& rxTransferable
);
157 BOOL
ApplyGraphicToObject( SdrObject
* pObject
, const Graphic
& rGraphic
);
159 void InsertBookmark( const String
& rDescription
, const String
& rURL
,
160 SCCOL nPosX
, SCROW nPosY
, const String
* pTarget
= NULL
,
161 BOOL bTryReplace
= FALSE
);
162 BOOL
HasBookmarkAtCursor( SvxHyperlinkItem
* pContent
);
164 long DropRequestHdl( Exchange
* pExchange
);
165 BOOL
MoveBlockTo( const ScRange
& rSource
, const ScAddress
& rDestPos
,
166 BOOL bCut
, BOOL bRecord
, BOOL bPaint
, BOOL bApi
);
168 BOOL
LinkBlock( const ScRange
& rSource
, const ScAddress
& rDestPos
, BOOL bApi
);
170 void CreateNames( USHORT nFlags
);
171 USHORT
GetCreateNameFlags();
172 void InsertNameList();
173 BOOL
InsertName( const String
& rName
, const String
& rSymbol
,
174 const String
& rType
);
176 void ApplyAttributes( const SfxItemSet
* pDialogSet
, const SfxItemSet
* pOldSet
,
177 BOOL bRecord
= TRUE
);
178 void ApplyAttr( const SfxPoolItem
& rAttrItem
);
179 void ApplySelectionPattern( const ScPatternAttr
& rAttr
,
181 BOOL bCursorOnly
= FALSE
);
182 void ApplyPatternLines( const ScPatternAttr
& rAttr
,
183 const SvxBoxItem
* pNewOuter
,
184 const SvxBoxInfoItem
* pNewInner
, BOOL bRecord
= TRUE
);
186 void ApplyUserItemSet( const SfxItemSet
& rItemSet
);
188 const SfxStyleSheet
* GetStyleSheetFromMarked();
189 void SetStyleSheetToMarked( SfxStyleSheet
* pStyleSheet
,
190 BOOL bRecord
= TRUE
);
191 void RemoveStyleSheetInUse( SfxStyleSheet
* pStyleSheet
);
192 void UpdateStyleSheetInUse( SfxStyleSheet
* pStyleSheet
);
194 void SetNumberFormat( short nFormatType
, ULONG nAdd
= 0 );
195 void SetNumFmtByStr( const String
& rCode
);
196 void ChangeNumFmtDecimals( BOOL bIncrement
);
198 void SetConditionalFormat( const ScConditionalFormat
& rNew
);
199 void SetValidation( const ScValidationData
& rNew
);
201 void ChangeIndent( BOOL bIncrement
);
203 void ProtectSheet( SCTAB nTab
, const ScTableProtection
& rProtect
);
205 void Protect( SCTAB nTab
, const String
& rPassword
);
206 BOOL
Unprotect( SCTAB nTab
, const String
& rPassword
);
208 void DeleteCells( DelCellCmd eCmd
, BOOL bRecord
= TRUE
);
209 BOOL
InsertCells( InsCellCmd eCmd
, BOOL bRecord
= TRUE
, BOOL bPartOfPaste
= FALSE
);
210 void DeleteMulti( BOOL bRows
, BOOL bRecord
= TRUE
);
212 void DeleteContents( USHORT nFlags
, BOOL bRecord
= TRUE
);
214 void SetWidthOrHeight( BOOL bWidth
, SCCOLROW nRangeCnt
, SCCOLROW
* pRanges
,
215 ScSizeMode eMode
, USHORT nSizeTwips
,
216 BOOL bRecord
= TRUE
, BOOL bPaint
= TRUE
,
217 ScMarkData
* pMarkData
= NULL
);
218 void SetMarkedWidthOrHeight( BOOL bWidth
, ScSizeMode eMode
, USHORT nSizeTwips
,
219 BOOL bRecord
= TRUE
, BOOL bPaint
= TRUE
);
220 void ShowMarkedColumns( BOOL bShow
, BOOL bRecord
= TRUE
);
221 void ShowMarkedRows( BOOL bShow
, BOOL bRecord
= TRUE
);
223 BOOL
AdjustBlockHeight( BOOL bPaint
= TRUE
, ScMarkData
* pMarkData
= NULL
);
224 BOOL
AdjustRowHeight( SCROW nStartRow
, SCROW nEndRow
, BOOL bPaint
= TRUE
);
226 void ModifyCellSize( ScDirection eDir
, BOOL bOptimal
);
228 SC_DLLPUBLIC
void InsertPageBreak( BOOL bColumn
, BOOL bRecord
= TRUE
,
229 const ScAddress
* pPos
= NULL
,
230 BOOL bSetModified
= TRUE
);
231 SC_DLLPUBLIC
void DeletePageBreak( BOOL bColumn
, BOOL bRecord
= TRUE
,
232 const ScAddress
* pPos
= NULL
,
233 BOOL bSetModified
= TRUE
);
235 void RemoveManualBreaks();
237 void SetPrintZoom(USHORT nScale
, USHORT nPages
);
238 void AdjustPrintZoom();
240 BOOL
TestMergeCells();
241 BOOL
TestRemoveMerge();
243 BOOL
MergeCells( BOOL bApi
, BOOL
& rDoContents
, BOOL bRecord
= TRUE
, BOOL bCenter
= FALSE
);
244 BOOL
RemoveMerge( BOOL bRecord
= TRUE
);
246 void FillSimple( FillDir eDir
, BOOL bRecord
= TRUE
);
247 void FillSeries( FillDir eDir
, FillCmd eCmd
, FillDateCmd eDateCmd
,
248 double fStart
, double fStep
, double fMax
, BOOL bRecord
= TRUE
);
249 void FillAuto( FillDir eDir
, SCCOL nStartCol
, SCROW nStartRow
,
250 SCCOL nEndCol
, SCROW nEndRow
, ULONG nCount
, BOOL bRecord
= TRUE
);
251 void FillCrossDblClick();
253 void TransliterateText( sal_Int32 nType
);
255 ScAutoFormatData
* CreateAutoFormatData();
256 void AutoFormat( USHORT nFormatNo
, BOOL bRecord
= TRUE
);
258 void SearchAndReplace( const SvxSearchItem
* pSearchItem
,
259 BOOL bAddUndo
, BOOL bIsApi
);
261 void Solve( const ScSolveParam
& rParam
);
262 void TabOp( const ScTabOpParam
& rParam
, BOOL bRecord
= TRUE
);
264 BOOL
InsertTable( const String
& rName
, SCTAB nTabNr
, BOOL bRecord
= TRUE
);
265 BOOL
InsertTables(SvStrings
*pNames
, SCTAB nTab
, SCTAB nCount
, BOOL bRecord
= TRUE
);
268 BOOL
AppendTable( const String
& rName
, BOOL bRecord
= TRUE
);
270 BOOL
DeleteTable( SCTAB nTabNr
, BOOL bRecord
= TRUE
);
271 BOOL
DeleteTables(const SvShorts
&TheTabs
, BOOL bRecord
= TRUE
);
273 BOOL
RenameTable( const String
& rName
, SCTAB nTabNr
);
274 void MoveTable( USHORT nDestDocNo
, SCTAB nDestTab
, BOOL bCopy
);
275 void ImportTables( ScDocShell
* pSrcShell
,
276 SCTAB nCount
, const SCTAB
* pSrcTabs
,
277 BOOL bLink
,SCTAB nTab
);
279 void InsertTableLink( const String
& rFile
,
280 const String
& rFilter
, const String
& rOptions
,
281 const String
& rTabName
);
282 void InsertAreaLink( const String
& rFile
,
283 const String
& rFilter
, const String
& rOptions
,
284 const String
& rSource
, ULONG nRefresh
);
286 void ShowTable( const String
& rName
);
287 void HideTable( SCTAB nTabNr
);
289 void MakeScenario( const String
& rName
, const String
& rComment
,
290 const Color
& rColor
, USHORT nFlags
);
291 void ExtendScenario();
292 void UseScenario( const String
& rName
);
294 void InsertSpecialChar( const String
& rStr
, const Font
& rFont
);
296 void InsertDummyObject();
297 void InsertOleObject();
301 void SetSelectionFrameLines( const SvxBorderLine
* pLine
,
304 void SetNoteText( const ScAddress
& rPos
, const String
& rNoteText
);
305 void ReplaceNote( const ScAddress
& rPos
, const String
& rNoteText
, const String
* pAuthor
, const String
* pDate
);
306 void DoRefConversion( BOOL bRecord
= TRUE
);
308 //UNUSED2008-05 void DoSpellingChecker( BOOL bRecord = TRUE );
309 void DoHangulHanjaConversion( BOOL bRecord
= TRUE
);
310 void DoThesaurus( BOOL bRecord
= TRUE
);
311 //UNUSED2008-05 DECL_LINK( SpellError, void * );
313 /** Generic implementation of sheet conversion functions. */
314 void DoSheetConversion( const ScConversionParam
& rParam
, BOOL bRecord
= TRUE
);
316 void SetPrintRanges( BOOL bEntireSheet
,
317 const String
* pPrint
,
318 const String
* pRepCol
, const String
* pRepRow
,
321 void DetectiveAddPred();
322 void DetectiveDelPred();
323 void DetectiveAddSucc();
324 void DetectiveDelSucc();
325 void DetectiveAddError();
326 void DetectiveMarkInvalid();
327 void DetectiveDelAll();
328 void DetectiveRefresh();
329 void DetectiveMarkPred();
330 void DetectiveMarkSucc();
332 void ShowNote( bool bShow
= true );
333 inline void HideNote() { ShowNote( false ); }
336 void ForgetFormatArea() { bFormatValid
= FALSE
; }
337 BOOL
SelectionEditable( BOOL
* pOnlyNotBecauseOfMatrix
= NULL
);
340 SC_DLLPUBLIC
void DataFormPutData( SCROW nCurrentRow
,
341 SCROW nStartRow
, SCCOL nStartCol
,
342 SCROW nEndRow
, SCCOL nEndCol
,
344 sal_uInt16 aColLength
);
346 // interne Hilfsfunktionen
348 void UpdateLineAttrs( SvxBorderLine
& rLine
,
349 const SvxBorderLine
* pDestLine
,
350 const SvxBorderLine
* pSrcLine
,
353 //UNUSED2008-05 void PaintWidthHeight( BOOL bColumns, SCCOLROW nStart, SCCOLROW nEnd );
357 void PasteRTF( SCCOL nCol
, SCROW nStartRow
,
358 const ::com::sun::star::uno::Reference
<
359 ::com::sun::star::datatransfer::XTransferable
>& rxTransferable
);
360 bool PasteMultiRangesFromClip( sal_uInt16 nFlags
, ScDocument
* pClipDoc
, sal_uInt16 nFunction
,
361 bool bSkipEmpty
, bool bTranspos
, bool bAsLink
, bool bAllowDialogs
,
362 InsCellCmd eMoveMode
, sal_uInt16 nCondFlags
, sal_uInt16 nUndoFlags
);
363 void PostPasteFromClip(const ScRange
& rPasteRange
, const ScMarkData
& rMark
);
365 USHORT
GetOptimalColWidth( SCCOL nCol
, SCTAB nTab
, BOOL bFormula
);
367 void StartFormatArea();
368 BOOL
TestFormatArea( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, BOOL bAttrChanged
);
369 void DoAutoAttributes( SCCOL nCol
, SCROW nRow
, SCTAB nTab
,
370 BOOL bAttrChanged
, BOOL bAddUndo
);
372 void MarkAndJumpToRanges(const ScRangeList
& rRanges
);