summaryrefslogtreecommitdiff
path: root/sc/source/ui/inc/viewfunc.hxx
blob: 390c25079b312bb8287a1b0c316a85be711a7c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
/*************************************************************************
 *
 *  $RCSfile: viewfunc.hxx,v $
 *
 *  $Revision: 1.19 $
 *
 *  last change: $Author: obo $ $Date: 2004-04-27 16:11:23 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifndef SC_VIEWFUNC_HXX
#define SC_VIEWFUNC_HXX

#ifndef SC_TABVIEW_HXX
#include "tabview.hxx"
#endif

#ifndef _SVSTDARR_USHORTS

#define _SVSTDARR_USHORTS
#include <svtools/svstdarr.hxx>

#endif

#ifndef _SVSTDARR_STRINGS

#define _SVSTDARR_STRINGS
#include <svtools/svstdarr.hxx>

#endif

#define TABLEID_DOC     0xFFFF

class ScPatternAttr;
class ScAutoFormatData;
class SvxSearchItem;
class SfxItemSet;
class SvxBorderLine;
class SvxBoxItem;
class SvxBoxInfoItem;
class SfxStyleSheet;
class SfxPoolItem;
class EditTextObject;
struct ScSolveParam;
struct ScTabOpParam;
class ScPostIt;
class ScConditionalFormat;
class ScValidationData;
class SdrModel;
class SvInPlaceObject;
class Graphic;
class Exchange;
class ScRangeList;
class SvxHyperlinkItem;

namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }

// ---------------------------------------------------------------------------

class ScViewFunc : public ScTabView
{
private:
    ScAddress   aFormatSource;      // fuer automatisches Erweitern von Formatierung
    ScRange     aFormatArea;
    BOOL        bFormatValid;

public:
                    ScViewFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
                    ScViewFunc( Window* pParent, const ScViewFunc& rViewFunc, ScTabViewShell* pViewShell );
                    ~ScViewFunc();

    const ScPatternAttr*    GetSelectionPattern ();
    void                    GetSelectionFrame   ( SvxBoxItem&       rLineOuter,
                                                  SvxBoxInfoItem&   rLineInner );

    BYTE            GetSelectionScriptType();

    BOOL            GetAutoSumArea(ScRangeList& rRangeList);
    void            EnterAutoSum(const ScRangeList& rRangeList, sal_Bool bSubTotal);

    void            EnterData( USHORT nCol, USHORT nRow, USHORT nTab, const String& rString,
                                BOOL bRecord = TRUE );
    void            EnterData( USHORT nCol, USHORT nRow, USHORT nTab, const double& rValue );
    void            EnterData( USHORT nCol, USHORT nRow, USHORT nTab, const EditTextObject* pData,
                                BOOL bRecord = TRUE, BOOL bTestSimple = FALSE );

    void            EnterMatrix( const String& rString );
    void            EnterBlock( const String& rString, const EditTextObject* pData );

    void            EnterDataAtCursor( const String& rString );         //! nicht benutzt ?

    void            CutToClip( ScDocument* pClipDoc = NULL, BOOL bIncludeObjects = FALSE );
    BOOL            CopyToClip( ScDocument* pClipDoc = NULL, BOOL bCut = FALSE, BOOL bApi = FALSE,
                                BOOL bIncludeObjects = FALSE, BOOL bStopEdit = TRUE );
    BOOL            PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
                                    USHORT nFunction = PASTE_NOFUNC, BOOL bSkipEmpty = FALSE,
                                    BOOL bTranspose = FALSE, BOOL bAsLink = FALSE,
                                    InsCellCmd eMoveMode = INS_NONE,
                                    USHORT nUndoExtraFlags = IDF_NONE,
                                    BOOL bAllowDialogs = FALSE );

    void            FillTab( USHORT nFlags, USHORT nFunction, BOOL bSkipEmpty, BOOL bAsLink );

    void            PasteFromSystem();
    BOOL            PasteFromSystem( ULONG nFormatId, BOOL bApi = FALSE );

    void            PasteDraw();
    void            PasteDraw( const Point& rLogicPos, SdrModel* pModel,
                                BOOL bGroup = FALSE, BOOL bSameDocClipboard = FALSE );

    BOOL            PasteOnDrawObject( const ::com::sun::star::uno::Reference<
                                            ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
                                        SdrObject* pHitObj, BOOL bLink );

    BOOL            PasteDataFormat( ULONG nFormatId,
                                        const ::com::sun::star::uno::Reference<
                                            ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
                                        USHORT nPosX, USHORT nPosY, Point* pLogicPos = NULL,
                                        BOOL bLink = FALSE, BOOL bAllowDialogs = FALSE );

    BOOL            PasteFile( const Point&, const String&, BOOL bLink=FALSE );
    BOOL            PasteObject( const Point&, SvInPlaceObject*, const Size* = NULL );
    BOOL            PasteBitmap( const Point&, const Bitmap& );
    BOOL            PasteMetaFile( const Point&, const GDIMetaFile& );
    BOOL            PasteGraphic( const Point& rPos, const Graphic& rGraphic,
                                    const String& rFile, const String& rFilter );
    BOOL            PasteBookmark( ULONG nFormatId,
                                const ::com::sun::star::uno::Reference<
                                    ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
                                USHORT nPosX, USHORT nPosY );
    BOOL            PasteDDE( const ::com::sun::star::uno::Reference<
                                ::com::sun::star::datatransfer::XTransferable >& rxTransferable );

    BOOL            ApplyGraphicToObject( SdrObject* pObject, const Graphic& rGraphic );

    void            InsertBookmark( const String& rDescription, const String& rURL,
                                    USHORT nPosX, USHORT nPosY, const String* pTarget = NULL,
                                    BOOL bTryReplace = FALSE );
    BOOL            HasBookmarkAtCursor( SvxHyperlinkItem* pContent );

    long            DropRequestHdl( Exchange* pExchange );
    BOOL            MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos,
                                    BOOL bCut, BOOL bRecord, BOOL bPaint, BOOL bApi );

    BOOL            LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, BOOL bApi );

    void            CreateNames( USHORT nFlags );
    USHORT          GetCreateNameFlags();
    void            InsertNameList();
    BOOL            InsertName( const String& rName, const String& rSymbol,
                                const String& rType );

    void            ApplyAttributes( const SfxItemSet* pDialogSet, const SfxItemSet* pOldSet,
                                        BOOL bRecord = TRUE );
    void            ApplyAttr( const SfxPoolItem& rAttrItem );
    void            ApplySelectionPattern( const ScPatternAttr& rAttr,
                                            BOOL bRecord = TRUE,
                                            BOOL bCursorOnly = FALSE );
    void            ApplyPatternLines( const ScPatternAttr& rAttr,
                                        const SvxBoxItem* pNewOuter,
                                        const SvxBoxInfoItem* pNewInner, BOOL bRecord = TRUE );

    void            ApplyUserItemSet( const SfxItemSet& rItemSet );

    const SfxStyleSheet*    GetStyleSheetFromMarked();
    void                    SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet,
                                                        BOOL bRecord = TRUE );
    void                    RemoveStyleSheetInUse( SfxStyleSheet* pStyleSheet );
    void                    UpdateStyleSheetInUse( SfxStyleSheet* pStyleSheet );

    void            SetNumberFormat( short nFormatType, ULONG nAdd = 0 );
    void            SetNumFmtByStr( const String& rCode );
    void            ChangeNumFmtDecimals( BOOL bIncrement );

    void            SetConditionalFormat( const ScConditionalFormat& rNew );
    void            SetValidation( const ScValidationData& rNew );

    void            ChangeIndent( BOOL bIncrement );

    void            Protect( USHORT nTab, const String& rPassword );
    BOOL            Unprotect( USHORT nTab, const String& rPassword );

    void            DeleteCells( DelCellCmd eCmd, BOOL bRecord = TRUE );
    BOOL            InsertCells( InsCellCmd eCmd, BOOL bRecord = TRUE, BOOL bPartOfPaste = FALSE );
    void            DeleteMulti( BOOL bRows, BOOL bRecord = TRUE );

    void            DeleteContents( USHORT nFlags, BOOL bRecord = TRUE );

    void            SetWidthOrHeight( BOOL bWidth, USHORT nRangeCnt, USHORT* pRanges,
                                        ScSizeMode eMode, USHORT nSizeTwips,
                                        BOOL bRecord = TRUE, BOOL bPaint = TRUE,
                                        ScMarkData* pMarkData = NULL );
    void            SetMarkedWidthOrHeight( BOOL bWidth, ScSizeMode eMode, USHORT nSizeTwips,
                                        BOOL bRecord = TRUE, BOOL bPaint = TRUE );
    void            ShowMarkedColumns( BOOL bShow, BOOL bRecord = TRUE );
    void            ShowMarkedRows( BOOL bShow, BOOL bRecord = TRUE );

    BOOL            AdjustBlockHeight( BOOL bPaint = TRUE, ScMarkData* pMarkData = NULL );
    BOOL            AdjustRowHeight( USHORT nStartRow, USHORT nEndRow, BOOL bPaint = TRUE );

    void            ModifyCellSize( ScDirection eDir, BOOL bOptimal );

    void            InsertPageBreak( BOOL bColumn, BOOL bRecord = TRUE,
                                        const ScAddress* pPos = NULL,
                                        BOOL bSetModified = TRUE );
    void            DeletePageBreak( BOOL bColumn, BOOL bRecord = TRUE,
                                        const ScAddress* pPos = NULL,
                                        BOOL bSetModified = TRUE );

    void            RemoveManualBreaks();

    void            SetPrintZoom(USHORT nScale, USHORT nPages);
    void            AdjustPrintZoom();

    BOOL            TestMergeCells();
    BOOL            TestRemoveMerge();

    BOOL            MergeCells( BOOL bApi, BOOL& rDoContents, BOOL bRecord = TRUE );
    BOOL            RemoveMerge( BOOL bRecord = TRUE );

    void            FillSimple( FillDir eDir, BOOL bRecord = TRUE );
    void            FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd,
                                double fStart, double fStep, double fMax, BOOL bRecord = TRUE );
    void            FillAuto( FillDir eDir, USHORT nStartCol, USHORT nStartRow,
                                USHORT nEndCol, USHORT nEndRow, USHORT nCount, BOOL bRecord = TRUE );

    void            TransliterateText( sal_Int32 nType );

    ScAutoFormatData* CreateAutoFormatData();
    void            AutoFormat( USHORT nFormatNo, BOOL bRecord = TRUE );

    void            SearchAndReplace( const SvxSearchItem* pSearchItem,
                                        BOOL bAddUndo, BOOL bIsApi );

    void            Solve( const ScSolveParam& rParam );
    void            TabOp( const ScTabOpParam& rParam,  BOOL bRecord = TRUE );

    BOOL            InsertTable( const String& rName, USHORT nTabNr, BOOL bRecord = TRUE );
    BOOL            InsertTables(SvStrings *pNames, USHORT nTab, USHORT nCount, BOOL bRecord = TRUE);


    BOOL            AppendTable( const String& rName, BOOL bRecord = TRUE );

    BOOL            DeleteTable( USHORT nTabNr, BOOL bRecord = TRUE );
    BOOL            DeleteTables(const SvUShorts &TheTabs, BOOL bRecord = TRUE );

    BOOL            RenameTable( const String& rName, USHORT nTabNr );
    void            MoveTable( USHORT nDestDocNo, USHORT nDestTab, BOOL bCopy );
    void            ImportTables( ScDocShell* pSrcShell,
                                    USHORT nCount, const USHORT* pSrcTabs,
                                    BOOL bLink,USHORT nTab);

    void            InsertTableLink( const String& rFile,
                                        const String& rFilter, const String& rOptions,
                                        const String& rTabName );
    void            InsertAreaLink( const String& rFile,
                                        const String& rFilter, const String& rOptions,
                                        const String& rSource, ULONG nRefresh );

    void            ShowTable( const String& rName );
    void            HideTable( USHORT nTabNr );

    void            MakeScenario( const String& rName, const String& rComment,
                                    const Color& rColor, USHORT nFlags );
    void            ExtendScenario();
    void            UseScenario( const String& rName );

    void            InsertSpecialChar( const String& rStr, const Font& rFont );

    void            InsertDummyObject();
    void            InsertOleObject();

    void            InsertDraw();

    void            SetSelectionFrameLines( const SvxBorderLine* pLine,
                                            BOOL bColorOnly );

    void            SetNote( USHORT nCol, USHORT nRow, USHORT nTab, const ScPostIt& rNote );
    void            DoSpellingChecker( BOOL bRecord = TRUE );
    void            DoHangulHanjaConversion( BOOL bRecord = TRUE );
    void            DoThesaurus( BOOL bRecord = TRUE );
    DECL_LINK( SpellError, void * );

    /** Generic implementation of sheet conversion functions. */
    void            DoSheetConversion( ScConversionType eConvType, BOOL bRecord );

    void            SetPrintRanges( BOOL bEntireSheet,
                                    const String* pPrint,
                                    const String* pRepCol, const String* pRepRow,
                                    BOOL bAddPrint );

    void            DetectiveAddPred();
    void            DetectiveDelPred();
    void            DetectiveAddSucc();
    void            DetectiveDelSucc();
    void            DetectiveAddError();
    void            DetectiveMarkInvalid();
    void            DetectiveDelAll();
    void            DetectiveRefresh();

    void            ShowNote();
    void            EditNote();
    void            HideNote();

    void            ForgetFormatArea()      { bFormatValid = FALSE; }
    BOOL            SelectionEditable( BOOL* pOnlyNotBecauseOfMatrix = NULL );

                                                // interne Hilfsfunktionen
protected:
    void            UpdateLineAttrs( SvxBorderLine&       rLine,
                                     const SvxBorderLine* pDestLine,
                                     const SvxBorderLine* pSrcLine,
                                     BOOL                 bColor );

    void            PaintWidthHeight( BOOL bColumns, USHORT nStart, USHORT nEnd );


private:
    void            PasteRTF( USHORT nCol, USHORT nStartRow,
                                const ::com::sun::star::uno::Reference<
                                        ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
    USHORT          GetOptimalColWidth( USHORT nCol, USHORT nTab, BOOL bFormula );

    void            StartFormatArea();
    BOOL            TestFormatArea( USHORT nCol, USHORT nRow, USHORT nTab, BOOL bAttrChanged );
    void            DoAutoAttributes( USHORT nCol, USHORT nRow, USHORT nTab,
                                        BOOL bAttrChanged, BOOL bAddUndo );
};



#endif