Subversion Repositories Scribus

Rev

Rev 3934 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3903 cbradney 1
/***************************************************************************
2
        copyright            : (C) 2005 by Craig Bradney
3
        email                : cbradney@zip.com.au
4
***************************************************************************/
5
 
6
/***************************************************************************
7
*                                                                         *
8
*   This program is free software; you can redistribute it and/or modify  *
9
*   it under the terms of the GNU General Public License as published by  *
10
*   the Free Software Foundation; either version 2 of the License, or     *
11
*   (at your option) any later version.                                   *
12
*                                                                         *
13
***************************************************************************/
14
#ifndef SELECTION_H
15
#define SELECTION_H
16
 
17
#include <qguardedptr.h>
18
#include <qobject.h>
19
#include <qmap.h>
20
#include <qvaluevector.h>
21
 
22
#include "pageitem.h"
23
 
24
typedef enum {
25
        GUISelection=0,
26
        NonGUISelection=1,
27
        Delete=2,
28
        CustomStart=10
29
} SelectionListType;
30
 
31
typedef QValueList< QGuardedPtr<PageItem> > SelectionList;
32
typedef QMap<int, SelectionList > ListOfSelections;
33
typedef QMap<int, bool> ListBool;
34
 
35
class Selection : public QObject
36
{
37
        Q_OBJECT
38
        public:
39
                Selection();
40
                ~Selection();
41
 
42
                void setDoc(ScribusDoc*);
43
 
44
                QPtrList<PageItem>* requestList();
45
                bool connectItemToGUI(int listNumber);
46
                /**
47
                 * Disconnect all items from the GUI slots.
48
                 * This should not really be necessary if all things are going ok
49
                 * except for within the clearAll function.
50
                 * @return
51
                 */
52
                bool disconnectAllItemsFromGUI();
53
                bool addItem(PageItem *item, int listNumber=GUISelection);
54
                bool addGroup();
55
                bool removeItem(PageItem *item, int listNumber=GUISelection);
56
                bool removeGroup();
57
                int count(int listNumber=GUISelection);
58
                bool clear(int listNumber=GUISelection);
59
                void clearAll();
60
                /**
61
                 * See if the first selected item is "me", called from an item object with "this".
62
                 * @param item
63
                 * @return
64
                 */
65
                const bool primarySelectionIsMyself(const PageItem* item, int listNumber);
66
                PageItem *itemAt(int index=0, int listNumber=GUISelection);
67
 
68
        protected:
69
                ScribusDoc* m_Doc;
70
                ListOfSelections sellists;
71
                ListBool hasGroupSelection;
72
};
73
 
74
#endif