summaryrefslogtreecommitdiffstats
path: root/scribus/pageitempointer.h
blob: 9750bb90cd90fa3f9bc89c1d3e1e2635180c773d (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
//
// C++ Interface: pageitempointer
//
// Description:
//
//
// Author: Pierre Marchand <pierremarc@oep-h.com>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef PAGEITEMPOINTER_H
#define PAGEITEMPOINTER_H

#include <QDataStream>
#include <QMap>
#include <QObject>
#include <QPointer>
#include <QString>


class PageItem;

class PageItemPointerDB : public QObject ,public QMap<QString, PageItem*> 
{
		Q_OBJECT
	public:
		PageItemPointerDB(){}
		~PageItemPointerDB(){}
		
		void addToDB(const QString& key, PageItem* value );
				
	public slots:
		void removeFromDB ( QObject* obj );
};

/**
 * Holds a guarded pointer and offers some kind of serialization.
 *
 */

class PageItemPointer :  public QPointer<PageItem>
{
	static PageItemPointerDB PIdb;
	public:
		PageItemPointer() :QPointer<PageItem>() {}
		PageItemPointer ( PageItem* pi );
		PageItemPointer ( const PageItemPointer& pip );
		PageItemPointer ( const QString& objname );
		~PageItemPointer();


};

QDataStream & operator<< ( QDataStream & out , const PageItemPointer& pip );
QDataStream & operator>> ( QDataStream & in  , PageItemPointer& pip );




#endif