~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to kpresenter/kprcommand.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
 
2
/* This file is part of the KDE project
 
3
   Copyright (C) 2001 Laurent Montel <lmontel@mandrakesoft.com>
 
4
 
 
5
   This library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Library General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2 of the License, or (at your option) any later version.
 
9
 
 
10
   This library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Library General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Library General Public License
 
16
   along with this library; see the file COPYING.LIB.  If not, write to
 
17
   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
   Boston, MA 02111-1307, USA.
 
19
*/
 
20
 
 
21
#ifndef kprcommand_h
 
22
#define kprcommand_h
 
23
 
 
24
#include <kcommand.h>
 
25
#include <qptrlist.h>
 
26
#include <qpoint.h>
 
27
#include <qcolor.h>
 
28
#include <qsize.h>
 
29
#include "global.h"
 
30
#include <koPictureCollection.h>
 
31
#include <qvaluelist.h>
 
32
#include <qpen.h>
 
33
#include <qbrush.h>
 
34
#include <koPageLayoutDia.h>
 
35
#include <koparaglayout.h>
 
36
#include <kocommand.h>
 
37
#include <koPoint.h>
 
38
#include <koSize.h>
 
39
#include <qvariant.h>
 
40
 
 
41
class KPresenterDoc;
 
42
class KPTextObject;
 
43
class KPObject;
 
44
class KPPixmapObject;
 
45
class KPGroupObject;
 
46
class KPresenterView;
 
47
class KoParagLayout;
 
48
class KPrPage;
 
49
class KoCustomVariable;
 
50
class KoLinkVariable;
 
51
class KPPolylineObject;
 
52
class KPrFieldVariable;
 
53
class KPrTimeVariable;
 
54
class KPrDateVariable;
 
55
class KPrPgNumVariable;
 
56
 
 
57
class ShadowCmd : public KNamedCommand
 
58
{
 
59
public:
 
60
    struct ShadowValues
 
61
    {
 
62
        int shadowDistance;
 
63
        ShadowDirection shadowDirection;
 
64
        QColor shadowColor;
 
65
    };
 
66
 
 
67
    ShadowCmd( const QString &_name, QPtrList<ShadowValues> &_oldShadow, ShadowValues _newShadow,
 
68
               QPtrList<KPObject> &_objects, KPresenterDoc *_doc );
 
69
    ~ShadowCmd();
 
70
 
 
71
    virtual void execute();
 
72
    virtual void unexecute();
 
73
 
 
74
protected:
 
75
    KPresenterDoc *doc;
 
76
    QPtrList<ShadowValues> oldShadow;
 
77
    QPtrList<KPObject> objects;
 
78
    ShadowValues newShadow;
 
79
    KPrPage *m_page;
 
80
};
 
81
 
 
82
class SetOptionsCmd : public KNamedCommand
 
83
{
 
84
public:
 
85
    SetOptionsCmd( const QString &_name, QValueList<KoPoint> &_diffs, QPtrList<KPObject> &_objects,
 
86
                   double _rastX, double _rastY, double _orastX, double _orastY,
 
87
                   const QColor &_txtBackCol, const QColor &_otxtBackCol, KPresenterDoc *_doc );
 
88
    ~SetOptionsCmd();
 
89
 
 
90
    virtual void execute();
 
91
    virtual void unexecute();
 
92
 
 
93
protected:
 
94
 
 
95
    QValueList<KoPoint> diffs;
 
96
    QPtrList<KPObject> objects;
 
97
    double gridX;
 
98
    double gridY;
 
99
    double oldGridX;
 
100
    double oldGridY;
 
101
    KPresenterDoc *doc;
 
102
    QColor txtBackCol;
 
103
    QColor otxtBackCol;
 
104
};
 
105
 
 
106
class SetBackCmd : public KNamedCommand
 
107
{
 
108
public:
 
109
    SetBackCmd( const QString &_name, const QColor &_backColor1, const QColor &_backColor2, BCType _bcType,
 
110
                bool _backUnbalanced, int _backXFactor, int _backYFactor,
 
111
                const KoPictureKey & _backPix,
 
112
                BackView _backView, BackType _backType,
 
113
                const QColor &_oldBackColor1, const QColor &_oldBackColor2, BCType _oldBcType,
 
114
                bool _oldBackUnbalanced, int _oldBackXFactor, int _oldBackYFactor,
 
115
                const KoPictureKey & _oldBackPix,
 
116
                BackView _oldBackView, BackType _oldBackType,
 
117
                bool _takeGlobal, KPresenterDoc *_doc, KPrPage *_page );
 
118
 
 
119
    virtual void execute();
 
120
    virtual void unexecute();
 
121
 
 
122
protected:
 
123
 
 
124
    QColor backColor1, backColor2;
 
125
    bool unbalanced;
 
126
    int xfactor, yfactor;
 
127
    KoPictureKey backPix;
 
128
    BCType bcType;
 
129
    BackView backView;
 
130
    BackType backType;
 
131
    QColor oldBackColor1, oldBackColor2;
 
132
    bool oldUnbalanced;
 
133
    int oldXFactor, oldYFactor;
 
134
    KoPictureKey oldBackPix;
 
135
    BCType oldBcType;
 
136
    BackView oldBackView;
 
137
    BackType oldBackType;
 
138
    bool takeGlobal;
 
139
    KPresenterDoc *doc;
 
140
    KPrPage *m_page;
 
141
};
 
142
 
 
143
class RotateCmd : public KNamedCommand
 
144
{
 
145
public:
 
146
    struct RotateValues
 
147
    {
 
148
        float angle;
 
149
    };
 
150
 
 
151
    RotateCmd( const QString &_name, QPtrList<RotateValues> &_oldRotate, float _newAngle,
 
152
               QPtrList<KPObject> &_objects, KPresenterDoc *_doc, bool _addAngle = false );
 
153
    ~RotateCmd();
 
154
 
 
155
    virtual void execute();
 
156
    virtual void unexecute();
 
157
 
 
158
protected:
 
159
    KPresenterDoc *doc;
 
160
    QPtrList<RotateValues> oldRotate;
 
161
    QPtrList<KPObject> objects;
 
162
    float newAngle;
 
163
    //necessary for duplicate object, we can duplicated and add angle.
 
164
    bool addAngle;
 
165
    KPrPage *m_page;
 
166
};
 
167
 
 
168
class ResizeCmd : public KNamedCommand
 
169
{
 
170
public:
 
171
    ResizeCmd( const QString &_name, const KoPoint &_m_diff, const KoSize &_r_diff,
 
172
               KPObject *_object, KPresenterDoc *_doc );
 
173
    ~ResizeCmd();
 
174
 
 
175
    virtual void execute();
 
176
    virtual void unexecute();
 
177
    virtual void unexecute( bool _repaint );
 
178
 
 
179
protected:
 
180
 
 
181
    KoPoint m_diff;
 
182
    KoSize r_diff;
 
183
    KPObject *object;
 
184
    KPresenterDoc *doc;
 
185
    KPrPage *m_page;
 
186
};
 
187
 
 
188
class ChgPixCmd : public KNamedCommand
 
189
{
 
190
public:
 
191
    ChgPixCmd( const QString &_name, KPPixmapObject *_oldObject, KPPixmapObject *_newObject,
 
192
               KPresenterDoc *_doc, KPrPage *_page );
 
193
    ~ChgPixCmd();
 
194
 
 
195
    virtual void execute();
 
196
    virtual void unexecute();
 
197
 
 
198
protected:
 
199
 
 
200
    KPPixmapObject *oldObject, *newObject;
 
201
    KPresenterDoc *doc;
 
202
    KPrPage *m_page;
 
203
};
 
204
 
 
205
class DeleteCmd : public KNamedCommand
 
206
{
 
207
public:
 
208
    DeleteCmd( const QString &_name, QPtrList<KPObject> &_objects, KPresenterDoc *_doc,
 
209
               KPrPage *_page);
 
210
    ~DeleteCmd();
 
211
 
 
212
    virtual void execute();
 
213
    virtual void unexecute();
 
214
 
 
215
protected:
 
216
 
 
217
    QPtrList<KPObject> objects;
 
218
    KPresenterDoc *doc;
 
219
    KPrPage *m_page;
 
220
};
 
221
 
 
222
class EffectCmd : public KNamedCommand
 
223
{
 
224
public:
 
225
    struct EffectStruct {
 
226
        int presNum, disappearNum;
 
227
        Effect effect;
 
228
        Effect2 effect2;
 
229
        Effect3 effect3;
 
230
        bool disappear;
 
231
        int appearTimer, disappearTimer;
 
232
        bool appearSoundEffect, disappearSoundEffect;
 
233
        QString a_fileName, d_fileName;
 
234
    };
 
235
 
 
236
    EffectCmd( const QString &_name, const QPtrList<KPObject> &_objs,
 
237
               const QValueList<EffectStruct> &_oldEffects, EffectStruct _newEffect );
 
238
    ~EffectCmd();
 
239
 
 
240
    virtual void execute();
 
241
    virtual void unexecute();
 
242
 
 
243
protected:
 
244
 
 
245
    QValueList<EffectStruct> oldEffects;
 
246
    EffectStruct newEffect;
 
247
    QPtrList<KPObject> objs;
 
248
};
 
249
 
 
250
class GroupObjCmd : public KNamedCommand
 
251
{
 
252
public:
 
253
    GroupObjCmd( const QString &_name,
 
254
                 const QPtrList<KPObject> &_objects,
 
255
                 KPresenterDoc *_doc, KPrPage *_page );
 
256
    ~GroupObjCmd();
 
257
 
 
258
    virtual void execute();
 
259
    virtual void unexecute();
 
260
 
 
261
protected:
 
262
 
 
263
    QPtrList<KPObject> objects;
 
264
    KPresenterDoc *doc;
 
265
    KPGroupObject *grpObj;
 
266
    KPrPage *m_page;
 
267
 
 
268
};
 
269
 
 
270
class UnGroupObjCmd : public KNamedCommand
 
271
{
 
272
public:
 
273
    UnGroupObjCmd( const QString &_name,
 
274
                   KPGroupObject *grpObj_,
 
275
                   KPresenterDoc *_doc, KPrPage *_page );
 
276
    ~UnGroupObjCmd();
 
277
 
 
278
    virtual void execute();
 
279
    virtual void unexecute();
 
280
 
 
281
protected:
 
282
 
 
283
    QPtrList<KPObject> objects;
 
284
    KPresenterDoc *doc;
 
285
    KPGroupObject *grpObj;
 
286
    KPrPage *m_page;
 
287
};
 
288
 
 
289
 
 
290
class InsertCmd : public KNamedCommand
 
291
{
 
292
public:
 
293
    InsertCmd( const QString &_name, KPObject *_object, KPresenterDoc *_doc, KPrPage *_page );
 
294
    ~InsertCmd();
 
295
 
 
296
    virtual void execute();
 
297
    virtual void unexecute();
 
298
 
 
299
protected:
 
300
 
 
301
    KPObject *object;
 
302
    KPresenterDoc *doc;
 
303
    KPrPage *m_page;
 
304
};
 
305
 
 
306
 
 
307
class LowerRaiseCmd : public KNamedCommand
 
308
{
 
309
public:
 
310
    LowerRaiseCmd( const QString &_name, QPtrList<KPObject> _oldList, QPtrList<KPObject> _newList,
 
311
                   KPresenterDoc *_doc, KPrPage *_page );
 
312
    ~LowerRaiseCmd();
 
313
 
 
314
    virtual void execute();
 
315
    virtual void unexecute();
 
316
 
 
317
protected:
 
318
 
 
319
    QPtrList<KPObject> oldList, newList;
 
320
    KPresenterDoc *doc;
 
321
    KPrPage *m_page;
 
322
};
 
323
 
 
324
class MoveByCmd : public KNamedCommand
 
325
{
 
326
public:
 
327
    MoveByCmd( const QString &_name, const KoPoint &_diff, QPtrList<KPObject> &_objects,
 
328
               KPresenterDoc *_doc, KPrPage *_page );
 
329
    ~MoveByCmd();
 
330
 
 
331
    virtual void execute();
 
332
    virtual void unexecute();
 
333
 
 
334
protected:
 
335
 
 
336
    KoPoint diff;
 
337
    QPtrList<KPObject> objects;
 
338
    KPresenterDoc *doc;
 
339
    KPrPage *m_page;
 
340
};
 
341
 
 
342
class MoveByCmd2 : public KNamedCommand
 
343
{
 
344
public:
 
345
    MoveByCmd2( const QString &_name, QPtrList<KoPoint> &_diffs, QPtrList<KPObject> &_objects,
 
346
                KPresenterDoc *_doc, KPrPage *_page );
 
347
    ~MoveByCmd2();
 
348
 
 
349
    virtual void execute();
 
350
    virtual void unexecute();
 
351
 
 
352
protected:
 
353
 
 
354
    QPtrList<KoPoint> diffs;
 
355
    QPtrList<KPObject> objects;
 
356
    KPresenterDoc *doc;
 
357
    KPrPage *m_page;
 
358
};
 
359
 
 
360
class PenCmd : public KNamedCommand
 
361
{
 
362
public:
 
363
    struct Pen {
 
364
        QPen pen;
 
365
        LineEnd lineBegin, lineEnd;
 
366
 
 
367
        Pen &operator=( const Pen &_pen ) {
 
368
            pen  = _pen.pen;
 
369
            lineBegin = _pen.lineBegin;
 
370
            lineEnd = _pen.lineEnd;
 
371
            return *this;
 
372
        }
 
373
    };
 
374
 
 
375
    // the flags indicate what has changed
 
376
    enum PenConfigChange {
 
377
        LineBegin = 1,
 
378
        LineEnd = 2,
 
379
        Color = 4,
 
380
        Width = 8,
 
381
        Style = 16,
 
382
        All = LineBegin | LineEnd | Color | Width | Style
 
383
    };
 
384
 
 
385
    PenCmd(const QString &_name, QPtrList<Pen> &_oldPen, Pen _newPen,
 
386
           QPtrList<KPObject> &_objects, KPresenterDoc *_doc, KPrPage *_page, int _flags = All);
 
387
    ~PenCmd();
 
388
    void applyPen(KPObject *kpobject, Pen *tmpPen);
 
389
 
 
390
    virtual void execute();
 
391
    virtual void unexecute();
 
392
 
 
393
protected:
 
394
    KPresenterDoc *doc;
 
395
    KPrPage *m_page;
 
396
    QPtrList<Pen> oldPen;
 
397
    QPtrList<KPObject> objects;
 
398
    Pen newPen;
 
399
    int flags;
 
400
};
 
401
 
 
402
class BrushCmd : public KNamedCommand
 
403
{
 
404
public:
 
405
    struct Brush {
 
406
        QBrush brush;
 
407
        QColor gColor1;
 
408
        QColor gColor2;
 
409
        BCType gType;
 
410
        FillType fillType;
 
411
        bool unbalanced;
 
412
        int xfactor, yfactor;
 
413
 
 
414
        Brush &operator=( const Brush &_brush ) {
 
415
            brush = _brush.brush;
 
416
            gColor1 = _brush.gColor1;
 
417
            gColor2 = _brush.gColor2;
 
418
            gType = _brush.gType;
 
419
            fillType = _brush.fillType;
 
420
            unbalanced = _brush.unbalanced;
 
421
            xfactor = _brush.xfactor;
 
422
            yfactor = _brush.yfactor;
 
423
            return *this;
 
424
        }
 
425
    };
 
426
 
 
427
    // the flags indicate what has changed
 
428
    enum BrushConfigChange {
 
429
        BrushColor = 1,
 
430
        BrushStyle = 2,
 
431
        BrushGradientSelect = 4,
 
432
        GradientColor1 = 8,
 
433
        GradientColor2 = 16,
 
434
        GradientType = 32,
 
435
        GradientBalanced = 64,
 
436
        All = BrushColor | BrushStyle | BrushGradientSelect | GradientColor1 | GradientColor2 | GradientType | GradientBalanced
 
437
    };
 
438
 
 
439
    BrushCmd(const QString &_name, QPtrList<Brush> &_oldBrush, Brush _newBrush,
 
440
             QPtrList<KPObject> &_objects, KPresenterDoc *_doc, KPrPage *_page, int _flags = All);
 
441
    ~BrushCmd();
 
442
    void applyBrush(KPObject *kpobject, Brush *tmpBrush);
 
443
 
 
444
    virtual void execute();
 
445
    virtual void unexecute();
 
446
 
 
447
protected:
 
448
    KPresenterDoc *doc;
 
449
    QPtrList<Brush> oldBrush;
 
450
    QPtrList<KPObject> objects;
 
451
    Brush newBrush;
 
452
    KPrPage *m_page;
 
453
    int flags;
 
454
};
 
455
 
 
456
class PgConfCmd : public KNamedCommand
 
457
{
 
458
public:
 
459
    PgConfCmd( const QString &_name, bool _manualSwitch, bool _infiniteLoop,
 
460
               bool _showPresentationDuration, QPen _pen,
 
461
               PresSpeed _presSpeed,
 
462
               QValueList<bool> _selectedSlides,
 
463
               bool _oldManualSwitch, bool _oldInfiniteLoop,
 
464
               bool _oldShowPresentationDuration, QPen _oldPen,
 
465
               PresSpeed _oldPresSpeed,
 
466
               QValueList<bool> _oldSelectedSlides,
 
467
               KPresenterDoc *_doc );
 
468
 
 
469
    virtual void execute();
 
470
    virtual void unexecute();
 
471
 
 
472
protected:
 
473
    bool manualSwitch, oldManualSwitch;
 
474
    bool infiniteLoop, oldInfiniteLoop;
 
475
    bool showPresentationDuration, oldShowPresentationDuration;
 
476
    QPen pen, oldPen;
 
477
    QValueList<bool> selectedSlides, oldSelectedSlides;
 
478
    PresSpeed presSpeed, oldPresSpeed;
 
479
    KPresenterDoc *doc;
 
480
};
 
481
 
 
482
class TransEffectCmd : public KNamedCommand
 
483
{
 
484
public:
 
485
    TransEffectCmd( const QString &_name, PageEffect _pageEffect, PresSpeed _transSpeed,
 
486
                    bool _soundEffect, const QString& _soundFileName,
 
487
                    bool _autoAdvance, int _slideTime,
 
488
                    PageEffect _oldPageEffect, PresSpeed _oldTransSpeed,
 
489
                    bool _oldSoundEffect, const QString& _oldSoundFileName,
 
490
                    bool _oldAutoAdvance, int _oldSlideTime,
 
491
                    KPrPage *_page );
 
492
 
 
493
    virtual void execute();
 
494
    virtual void unexecute();
 
495
 
 
496
protected:
 
497
    PageEffect pageEffect, oldPageEffect;
 
498
    PresSpeed transSpeed, oldTransSpeed;
 
499
    bool soundEffect, oldSoundEffect;
 
500
    QString soundFileName, oldSoundFileName;
 
501
    bool autoAdvance, oldAutoAdvance;
 
502
    int slideTime, oldSlideTime;
 
503
 
 
504
    KPrPage *m_page;
 
505
    KPresenterDoc *doc;
 
506
};
 
507
 
 
508
class PgLayoutCmd : public KNamedCommand
 
509
{
 
510
public:
 
511
    PgLayoutCmd( const QString &_name, KoPageLayout _layout, KoPageLayout _oldLayout,
 
512
                 KoUnit::Unit _oldUnit, KoUnit::Unit _unit,KPresenterDoc *_doc );
 
513
 
 
514
    virtual void execute();
 
515
    virtual void unexecute();
 
516
 
 
517
protected:
 
518
    KPresenterDoc *m_doc;
 
519
    KoPageLayout layout, oldLayout;
 
520
    KoUnit::Unit unit, oldUnit;
 
521
};
 
522
 
 
523
class PieValueCmd : public KNamedCommand
 
524
{
 
525
public:
 
526
    struct PieValues
 
527
    {
 
528
        PieType pieType;
 
529
        int pieAngle, pieLength;
 
530
    };
 
531
 
 
532
    // the flags indicate what has changed
 
533
    enum PieConfigChange {
 
534
        Type = 1,
 
535
        Angle = 2,
 
536
        Length = 4,
 
537
        All = Type | Angle | Length
 
538
    };
 
539
 
 
540
    PieValueCmd( const QString &_name, QPtrList<PieValues> &_oldValues, PieValues _newValues,
 
541
                 QPtrList<KPObject> &_objects, KPresenterDoc *_doc, KPrPage *_page, int _flags = All );
 
542
    ~PieValueCmd();
 
543
 
 
544
    virtual void execute();
 
545
    virtual void unexecute();
 
546
 
 
547
protected:
 
548
 
 
549
    KPresenterDoc *doc;
 
550
    KPrPage *m_page;
 
551
    QPtrList<PieValues> oldValues;
 
552
    QPtrList<KPObject> objects;
 
553
    PieValues newValues;
 
554
    int flags;
 
555
};
 
556
 
 
557
class PolygonSettingCmd : public KNamedCommand
 
558
{
 
559
public:
 
560
    struct PolygonSettings
 
561
    {
 
562
        bool checkConcavePolygon;
 
563
        int cornersValue;
 
564
        int sharpnessValue;
 
565
    };
 
566
 
 
567
    // the flags indicate what has changed
 
568
    enum PolygonConfigChange {
 
569
        ConcaveConvex = 1,
 
570
        Corners = 2,
 
571
        Sharpness = 4,
 
572
        All = ConcaveConvex | Corners | Sharpness
 
573
    };
 
574
 
 
575
    PolygonSettingCmd( const QString &_name, QPtrList<PolygonSettings> &_oldSettings,
 
576
                       PolygonSettings _newSettings, QPtrList<KPObject> &_objects,
 
577
                       KPresenterDoc *_doc,  KPrPage *_page, int _flags = All );
 
578
    ~PolygonSettingCmd();
 
579
 
 
580
    virtual void execute();
 
581
    virtual void unexecute();
 
582
 
 
583
protected:
 
584
 
 
585
    KPresenterDoc *doc;
 
586
    KPrPage *m_page;
 
587
    QPtrList<PolygonSettings> oldSettings;
 
588
    QPtrList<KPObject> objects;
 
589
    PolygonSettings newSettings;
 
590
    int flags;
 
591
};
 
592
 
 
593
class PictureSettingCmd : public KNamedCommand
 
594
{
 
595
public:
 
596
    struct PictureSettings
 
597
    {
 
598
        PictureMirrorType mirrorType;
 
599
        int depth;
 
600
        bool swapRGB;
 
601
        bool grayscal;
 
602
        int bright;
 
603
    };
 
604
 
 
605
    PictureSettingCmd( const QString &_name, QPtrList<PictureSettings> &_oldSettings,
 
606
                       PictureSettings _newSettings, QPtrList<KPObject> &_objects,
 
607
                       KPresenterDoc *_doc );
 
608
    ~PictureSettingCmd();
 
609
 
 
610
    virtual void execute();
 
611
    virtual void unexecute();
 
612
 
 
613
protected:
 
614
    KPresenterDoc *doc;
 
615
    QPtrList<PictureSettings> oldSettings;
 
616
    QPtrList<KPObject> objects;
 
617
    PictureSettings newSettings;
 
618
    KPrPage *m_page;
 
619
};
 
620
 
 
621
class ImageEffectCmd : public KNamedCommand
 
622
{
 
623
public:
 
624
    struct ImageEffectSettings
 
625
    {
 
626
        ImageEffect effect;
 
627
        QVariant param1;
 
628
        QVariant param2;
 
629
        QVariant param3;
 
630
    };
 
631
 
 
632
    ImageEffectCmd(const QString &_name, QPtrList<ImageEffectSettings> &_oldSettings,
 
633
                   ImageEffectSettings _newSettings, QPtrList<KPObject> &_objects,
 
634
                   KPresenterDoc *_doc );
 
635
    ~ImageEffectCmd();
 
636
 
 
637
    virtual void execute();
 
638
    virtual void unexecute();
 
639
 
 
640
protected:
 
641
    KPresenterDoc *doc;
 
642
    QPtrList<ImageEffectSettings> oldSettings;
 
643
    QPtrList<KPObject> objects;
 
644
    ImageEffectSettings newSettings;
 
645
    KPrPage *m_page;
 
646
 
 
647
};
 
648
 
 
649
class RectValueCmd : public KNamedCommand
 
650
{
 
651
public:
 
652
    struct RectValues
 
653
    {
 
654
        int xRnd, yRnd;
 
655
    };
 
656
 
 
657
    // the flags indicate what has changed
 
658
    enum RectangleConfigChange {
 
659
        XRnd = 1,
 
660
        YRnd = 2,
 
661
        All = XRnd | YRnd
 
662
    };
 
663
 
 
664
    RectValueCmd( const QString &_name, QPtrList<RectValues> &_oldValues, RectValues _newValues,
 
665
                  QPtrList<KPObject> &_objects, KPresenterDoc *_doc, KPrPage *_page, int _flags = All );
 
666
    ~RectValueCmd();
 
667
 
 
668
    virtual void execute();
 
669
    virtual void unexecute();
 
670
 
 
671
protected:
 
672
 
 
673
    KPresenterDoc *doc;
 
674
    KPrPage *m_page;
 
675
    QPtrList<RectValues> oldValues;
 
676
    QPtrList<KPObject> objects;
 
677
    RectValues newValues;
 
678
    int flags;
 
679
};
 
680
 
 
681
class KPrDeletePageCmd : public KNamedCommand
 
682
{
 
683
public:
 
684
    KPrDeletePageCmd( const QString &_name,int _pos, KPrPage *page, KPresenterDoc *_doc );
 
685
    ~KPrDeletePageCmd();
 
686
 
 
687
    virtual void execute();
 
688
    virtual void unexecute();
 
689
 
 
690
protected:
 
691
    KPresenterDoc *doc;
 
692
    KPrPage *m_page;
 
693
    int position;
 
694
};
 
695
 
 
696
class KPrInsertPageCmd : public KNamedCommand
 
697
{
 
698
public:
 
699
    KPrInsertPageCmd( const QString &_name,int _pos, KPrPage *page, KPresenterDoc *_doc );
 
700
    ~KPrInsertPageCmd();
 
701
 
 
702
    virtual void execute();
 
703
    virtual void unexecute();
 
704
protected:
 
705
    KPresenterDoc *doc;
 
706
    KPrPage *m_page;
 
707
    int position;
 
708
};
 
709
 
 
710
class KPrMovePageCmd : public KNamedCommand
 
711
{
 
712
public:
 
713
    KPrMovePageCmd( const QString &_name,int _oldpos,int newPos, KPrPage *page, KPresenterDoc *_doc );
 
714
    ~KPrMovePageCmd();
 
715
 
 
716
    virtual void execute();
 
717
    virtual void unexecute();
 
718
protected:
 
719
    KPresenterDoc *doc;
 
720
    KPrPage *m_page;
 
721
    int oldPosition;
 
722
    int newPosition;
 
723
};
 
724
 
 
725
class KPrPasteTextCommand : public KoTextDocCommand
 
726
{
 
727
public:
 
728
    KPrPasteTextCommand( KoTextDocument *d, int parag, int idx,
 
729
                         const QCString & data );
 
730
    ~KPrPasteTextCommand() {}
 
731
    KoTextCursor *execute( KoTextCursor *c );
 
732
    KoTextCursor *unexecute( KoTextCursor *c );
 
733
protected:
 
734
    int m_parag;
 
735
    int m_idx;
 
736
    QCString m_data;
 
737
    // filled in by execute(), for unexecute()
 
738
    int m_lastParag;
 
739
    int m_lastIndex;
 
740
    KoParagLayout m_oldParagLayout;
 
741
};
 
742
 
 
743
/**
 
744
 * Command to change variable setting
 
745
 */
 
746
class KPrChangeStartingPageCommand : public KNamedCommand
 
747
{
 
748
public:
 
749
    KPrChangeStartingPageCommand( const QString &name, KPresenterDoc *_doc,
 
750
                                  int _oldStartingPage, int _newStartingPage);
 
751
    ~KPrChangeStartingPageCommand(){}
 
752
 
 
753
    void execute();
 
754
    void unexecute();
 
755
protected:
 
756
    KPresenterDoc *m_doc;
 
757
    int oldStartingPage;
 
758
    int newStartingPage;
 
759
};
 
760
 
 
761
/**
 
762
 * Command to display link setting
 
763
 */
 
764
class KPrChangeVariableSettingsCommand : public KNamedCommand
 
765
{
 
766
public:
 
767
    enum VariableProperties { VS_DISPLAYLINK, VS_UNDERLINELINK, VS_DISPLAYCOMMENT, VS_DISPLAYFIELDCODE};
 
768
    KPrChangeVariableSettingsCommand( const QString &name, KPresenterDoc *_doc, bool _oldValue,
 
769
                                      bool _newValue, VariableProperties _type);
 
770
    ~KPrChangeVariableSettingsCommand(){}
 
771
 
 
772
    void execute();
 
773
    void unexecute();
 
774
protected:
 
775
    void changeValue( bool b );
 
776
    KPresenterDoc *m_doc;
 
777
    VariableProperties type;
 
778
    bool m_bOldValue;
 
779
    bool m_bNewValue;
 
780
};
 
781
 
 
782
/**
 
783
 * Command to change title page name
 
784
 */
 
785
class KPrChangeTitlePageNameCommand : public KNamedCommand
 
786
{
 
787
public:
 
788
    KPrChangeTitlePageNameCommand( const QString &name, KPresenterDoc *_doc, const QString &_oldPageName,
 
789
                                   const QString &_newPageName, KPrPage *_page);
 
790
    ~KPrChangeTitlePageNameCommand(){}
 
791
 
 
792
    void execute();
 
793
    void unexecute();
 
794
protected:
 
795
    KPresenterDoc *m_doc;
 
796
    QString oldPageName;
 
797
    QString newPageName;
 
798
    KPrPage *m_page;
 
799
};
 
800
 
 
801
class KPrChangeCustomVariableValue : public KNamedCommand
 
802
{
 
803
public:
 
804
    KPrChangeCustomVariableValue( const QString &name, KPresenterDoc *_doc,const QString & _oldValue,
 
805
                                  const QString & _newValue, KoCustomVariable *var);
 
806
 
 
807
    void execute();
 
808
    void unexecute();
 
809
protected:
 
810
    KPresenterDoc *m_doc;
 
811
    QString newValue;
 
812
    QString oldValue;
 
813
    KoCustomVariable *m_var;
 
814
};
 
815
 
 
816
class KPrChangeLinkVariable : public KNamedCommand
 
817
{
 
818
public:
 
819
    KPrChangeLinkVariable( const QString &name, KPresenterDoc *_doc,const QString & _oldHref,
 
820
                           const QString & _newHref, const QString & _oldLink,const QString &_newLink, KoLinkVariable *var);
 
821
    ~KPrChangeLinkVariable(){};
 
822
    void execute();
 
823
    void unexecute();
 
824
protected:
 
825
    KPresenterDoc *m_doc;
 
826
    QString oldHref;
 
827
    QString newHref;
 
828
    QString oldLink;
 
829
    QString newLink;
 
830
    KoLinkVariable *m_var;
 
831
};
 
832
 
 
833
class KPrStickyObjCommand : public KNamedCommand
 
834
{
 
835
public:
 
836
    KPrStickyObjCommand( const QString &_name, QPtrList<KPObject> &_objects, bool sticky,
 
837
                         KPrPage*_page,KPresenterDoc *_doc );
 
838
 
 
839
    ~KPrStickyObjCommand();
 
840
    void execute();
 
841
    void unexecute();
 
842
    void stickObj(KPObject *_obj);
 
843
    void unstickObj(KPObject *_obj);
 
844
protected:
 
845
    QPtrList<KPObject> objects;
 
846
    bool m_bSticky;
 
847
    KPresenterDoc *m_doc;
 
848
    KPrPage*m_page;
 
849
};
 
850
 
 
851
class KPrNameObjectCommand : public KNamedCommand
 
852
{
 
853
public:
 
854
    KPrNameObjectCommand( const QString &_name, const QString &_objectName, KPObject *_obj, KPresenterDoc *_doc );
 
855
    ~KPrNameObjectCommand();
 
856
    void execute();
 
857
    void unexecute();
 
858
protected:
 
859
    QString oldObjectName, newObjectName;
 
860
    KPObject *object;
 
861
    KPresenterDoc *doc;
 
862
    KPrPage *m_page;
 
863
};
 
864
 
 
865
class KPrHideShowHeaderFooter : public KNamedCommand
 
866
{
 
867
public:
 
868
    KPrHideShowHeaderFooter( const QString &name, KPresenterDoc *_doc, bool _newValue,KPTextObject *_textObject);
 
869
    ~KPrHideShowHeaderFooter(){};
 
870
    void execute();
 
871
    void unexecute();
 
872
protected:
 
873
    KPresenterDoc *m_doc;
 
874
    KPTextObject *m_textObject;
 
875
    bool newValue;
 
876
};
 
877
 
 
878
class KPrFlipObjectCommand : public KNamedCommand
 
879
{
 
880
public:
 
881
    KPrFlipObjectCommand( const QString &name, KPresenterDoc *_doc, bool _horizontal ,
 
882
                          QPtrList<KPObject> &_objects );
 
883
    ~KPrFlipObjectCommand();
 
884
    void execute();
 
885
    void unexecute();
 
886
protected:
 
887
    void flipObjects();
 
888
    KPresenterDoc *m_doc;
 
889
    QPtrList<KPObject> objects;
 
890
    bool horizontal;
 
891
    KPrPage *m_page;
 
892
};
 
893
 
 
894
class KPrGeometryPropertiesCommand : public KNamedCommand
 
895
{
 
896
public:
 
897
    enum KgpType { ProtectSize, KeepRatio};
 
898
    KPrGeometryPropertiesCommand( const QString &_name, QValueList<bool> &_lst, QPtrList<KPObject> &_objects,
 
899
                                  bool _newValue, KPresenterDoc *_doc, KgpType _type );
 
900
    ~KPrGeometryPropertiesCommand();
 
901
 
 
902
    virtual void execute();
 
903
    virtual void unexecute();
 
904
 
 
905
protected:
 
906
    QValueList<bool> list;
 
907
    QPtrList<KPObject> objects;
 
908
    bool newValue;
 
909
    KPresenterDoc *doc;
 
910
    KgpType m_type;
 
911
};
 
912
 
 
913
class KPrProtectContentCommand : public KNamedCommand
 
914
{
 
915
public:
 
916
    KPrProtectContentCommand( const QString &_name, bool _protectContent, KPTextObject *_obj, KPresenterDoc *_doc );
 
917
 
 
918
    ~KPrProtectContentCommand();
 
919
    virtual void execute();
 
920
    virtual void unexecute();
 
921
 
 
922
protected:
 
923
    bool protectContent;
 
924
    KPTextObject *objects;
 
925
    KPresenterDoc * doc;
 
926
};
 
927
 
 
928
class KPrCloseObjectCommand : public KNamedCommand
 
929
{
 
930
public:
 
931
    KPrCloseObjectCommand( const QString &_name, KPObject *_obj, KPresenterDoc *_doc );
 
932
 
 
933
    ~KPrCloseObjectCommand();
 
934
    virtual void execute();
 
935
    virtual void unexecute();
 
936
 
 
937
protected:
 
938
    void closeObject(bool close);
 
939
 
 
940
    KPObject *objects;
 
941
    KPresenterDoc * doc;
 
942
    KPrPage *m_page;
 
943
};
 
944
 
 
945
struct MarginsStruct {
 
946
    MarginsStruct() {}
 
947
    MarginsStruct( KPTextObject *obj );
 
948
    MarginsStruct( double _left, double top, double right, double bottom );
 
949
    double topMargin;
 
950
    double bottomMargin;
 
951
    double leftMargin;
 
952
    double rightMargin;
 
953
};
 
954
 
 
955
class KPrChangeMarginCommand : public KNamedCommand
 
956
{
 
957
public:
 
958
    KPrChangeMarginCommand( const QString &name, KPTextObject *_obj, MarginsStruct _MarginsBegin,
 
959
                            MarginsStruct _MarginsEnd, KPresenterDoc *_doc );
 
960
    ~KPrChangeMarginCommand() {}
 
961
 
 
962
    virtual void execute();
 
963
    virtual void unexecute();
 
964
protected:
 
965
    KPTextObject *m_obj;
 
966
    MarginsStruct m_marginsBegin;
 
967
    MarginsStruct m_marginsEnd;
 
968
    KPrPage *m_page;
 
969
    KPresenterDoc *m_doc;
 
970
};
 
971
 
 
972
 
 
973
class KPrChangeVerticalAlignmentCommand : public KNamedCommand
 
974
{
 
975
public:
 
976
    KPrChangeVerticalAlignmentCommand( const QString &name, KPTextObject *_obj, VerticalAlignmentType _oldAlign,
 
977
                                       VerticalAlignmentType _newAlign, KPresenterDoc *_doc);
 
978
    ~KPrChangeVerticalAlignmentCommand() {}
 
979
 
 
980
    virtual void execute();
 
981
    virtual void unexecute();
 
982
protected:
 
983
    KPTextObject *m_obj;
 
984
    VerticalAlignmentType m_oldAlign;
 
985
    VerticalAlignmentType m_newAlign;
 
986
    KPrPage *m_page;
 
987
    KPresenterDoc *m_doc;
 
988
};
 
989
 
 
990
 
 
991
class KPrChangeTabStopValueCommand : public KNamedCommand
 
992
{
 
993
public:
 
994
    KPrChangeTabStopValueCommand( const QString &name, double _oldValue, double _newValue, KPresenterDoc *_doc);
 
995
 
 
996
    ~KPrChangeTabStopValueCommand() {}
 
997
 
 
998
    virtual void execute();
 
999
    virtual void unexecute();
 
1000
protected:
 
1001
    KPresenterDoc *m_doc;
 
1002
    double m_oldValue;
 
1003
    double m_newValue;
 
1004
};
 
1005
 
 
1006
#endif