xref: /AOO41X/main/sfx2/inc/msgnodei.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _MSGNODEI_HXX
29*cdf0e10cSrcweir #define _MSGNODEI_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #include <svl/eitem.hxx>
33*cdf0e10cSrcweir #include <tools/string.hxx>
34*cdf0e10cSrcweir #include <svl/poolitem.hxx>
35*cdf0e10cSrcweir #include <tools/list.hxx>
36*cdf0e10cSrcweir struct SfxMsgAttachFile {
37*cdf0e10cSrcweir 	String	aFile;
38*cdf0e10cSrcweir 	String	aName;
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir 	int 				operator==( const SfxMsgAttachFile& rRec ) const
41*cdf0e10cSrcweir 						{
42*cdf0e10cSrcweir 							if( aName == rRec.aName && aFile == rRec.aFile )
43*cdf0e10cSrcweir 								return sal_True;
44*cdf0e10cSrcweir 							return sal_False;
45*cdf0e10cSrcweir 						}
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 						SfxMsgAttachFile( const String& rFile, const String& rName)
48*cdf0e10cSrcweir 							: aName( rName ), aFile( rFile ) {}
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 						SfxMsgAttachFile( const SfxMsgAttachFile& rRec )
51*cdf0e10cSrcweir 							: aName( rRec.aName), aFile( rRec.aFile ) {}
52*cdf0e10cSrcweir };
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir enum SfxMsgReceiverRole
55*cdf0e10cSrcweir {
56*cdf0e10cSrcweir 	MSG_RECEIVER_TO = 0,
57*cdf0e10cSrcweir 	MSG_RECEIVER_CC,
58*cdf0e10cSrcweir 	MSG_RECEIVER_BCC,
59*cdf0e10cSrcweir 	MSG_RECEIVER_NEWSGROUP
60*cdf0e10cSrcweir };
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir struct SfxMsgReceiver {
63*cdf0e10cSrcweir 	String				aName;
64*cdf0e10cSrcweir 	SfxMsgReceiverRole  eRole;
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 	int 				operator==( const SfxMsgReceiver& rRec ) const
67*cdf0e10cSrcweir 						{
68*cdf0e10cSrcweir 							if( aName == rRec.aName && eRole == rRec.eRole )
69*cdf0e10cSrcweir 								return sal_True;
70*cdf0e10cSrcweir 							return sal_False;
71*cdf0e10cSrcweir 						}
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 						SfxMsgReceiver( const String& rName, SfxMsgReceiverRole _eRole )
74*cdf0e10cSrcweir 							: aName( rName ), eRole( _eRole ) {}
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 						SfxMsgReceiver( const SfxMsgReceiver& rRec )
77*cdf0e10cSrcweir 							: aName( rRec.aName), eRole( rRec.eRole ) {}
78*cdf0e10cSrcweir };
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir // ------------------------------------------------------------------------
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir class SfxMsgReceiverList_Impl : public List
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir 	sal_uIntPtr 			nRef;
85*cdf0e10cSrcweir 					~SfxMsgReceiverList_Impl();
86*cdf0e10cSrcweir 	SfxMsgReceiverList_Impl& operator=( const SfxMsgReceiverList_Impl&); //n.i.
87*cdf0e10cSrcweir public:
88*cdf0e10cSrcweir 					SfxMsgReceiverList_Impl();
89*cdf0e10cSrcweir 					SfxMsgReceiverList_Impl(const SfxMsgReceiverList_Impl&);
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	void			Load( SvStream& );
92*cdf0e10cSrcweir 	void			Store( SvStream& ) const;
93*cdf0e10cSrcweir 	void 			IncRef() { nRef++; }
94*cdf0e10cSrcweir 	void 			DecRef() { nRef--; if( !nRef ) delete this; }
95*cdf0e10cSrcweir 	sal_uIntPtr			GetRefCount() const { return nRef; }
96*cdf0e10cSrcweir 	int 			operator==( const SfxMsgReceiverList_Impl& ) const;
97*cdf0e10cSrcweir };
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir class SfxMsgReceiverListItem : public SfxPoolItem
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir 	void					Disconnect();
102*cdf0e10cSrcweir protected:
103*cdf0e10cSrcweir 	SfxMsgReceiverList_Impl* pImp;
104*cdf0e10cSrcweir public:
105*cdf0e10cSrcweir 							TYPEINFO();
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 							SfxMsgReceiverListItem();
108*cdf0e10cSrcweir 							SfxMsgReceiverListItem( sal_uInt16 nWhich );
109*cdf0e10cSrcweir 							SfxMsgReceiverListItem( sal_uInt16 nWhich, SvStream& rStream );
110*cdf0e10cSrcweir 							SfxMsgReceiverListItem( const SfxMsgReceiverListItem& rItem );
111*cdf0e10cSrcweir 							~SfxMsgReceiverListItem();
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 	virtual int 			operator==( const SfxPoolItem& ) const;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
116*cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
117*cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
118*cdf0e10cSrcweir 									XubString &rText ) const;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 	sal_uInt16					Count() const;
121*cdf0e10cSrcweir 	SfxMsgReceiver*			GetObject( sal_uInt16 nPos );
122*cdf0e10cSrcweir 	void					Remove( sal_uInt16 nPos );
123*cdf0e10cSrcweir 	void					Add( const SfxMsgReceiver& );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
126*cdf0e10cSrcweir 	virtual SfxPoolItem*	Create( SvStream &, sal_uInt16 nVersion ) const;
127*cdf0e10cSrcweir 	virtual SvStream&		Store( SvStream &, sal_uInt16 nItemVersion ) const;
128*cdf0e10cSrcweir };
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir // ------------------------------------------------------------------------
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir class SfxMsgAttachFileList_Impl : public List
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir 	sal_uIntPtr 			nRef;
136*cdf0e10cSrcweir 					~SfxMsgAttachFileList_Impl();
137*cdf0e10cSrcweir 	SfxMsgAttachFileList_Impl& operator=( const SfxMsgAttachFileList_Impl&); //n.i.
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir public:
140*cdf0e10cSrcweir 					SfxMsgAttachFileList_Impl();
141*cdf0e10cSrcweir 					SfxMsgAttachFileList_Impl(const SfxMsgAttachFileList_Impl&);
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	int				operator==( const SfxMsgAttachFileList_Impl& rRec ) const;
144*cdf0e10cSrcweir 	SfxMsgAttachFile* GetReceiver(sal_uIntPtr nPos) { return (SfxMsgAttachFile*)List::GetObject(nPos); }
145*cdf0e10cSrcweir 	void			Load( SvStream& );
146*cdf0e10cSrcweir 	void			Store( SvStream& ) const;
147*cdf0e10cSrcweir 	void 			IncRef() { nRef++; }
148*cdf0e10cSrcweir 	void 			DecRef() { nRef--; if( !nRef ) delete this; }
149*cdf0e10cSrcweir 	sal_uIntPtr			GetRefCount() const { return nRef; }
150*cdf0e10cSrcweir };
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir class SfxMsgAttachFileListItem : public SfxPoolItem
153*cdf0e10cSrcweir {
154*cdf0e10cSrcweir protected:
155*cdf0e10cSrcweir 	SfxMsgAttachFileList_Impl* pImp;
156*cdf0e10cSrcweir 	void					Disconnect();
157*cdf0e10cSrcweir public:
158*cdf0e10cSrcweir 							TYPEINFO();
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 							SfxMsgAttachFileListItem();
161*cdf0e10cSrcweir 							SfxMsgAttachFileListItem( sal_uInt16 nWhich );
162*cdf0e10cSrcweir 							SfxMsgAttachFileListItem( sal_uInt16 nWhich, SvStream& rStream );
163*cdf0e10cSrcweir 							SfxMsgAttachFileListItem( const SfxMsgAttachFileListItem& rItem );
164*cdf0e10cSrcweir 							~SfxMsgAttachFileListItem();
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	virtual int 			operator==( const SfxPoolItem& ) const;
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
169*cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
170*cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
171*cdf0e10cSrcweir 									XubString &rText ) const;
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 	sal_uInt16					Count() const;
174*cdf0e10cSrcweir 	SfxMsgAttachFile*		GetObject( sal_uInt16 nPos );
175*cdf0e10cSrcweir 	void					Remove( sal_uInt16 nPos );
176*cdf0e10cSrcweir 	void					Add( const SfxMsgAttachFile& );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
179*cdf0e10cSrcweir 	virtual SfxPoolItem*	Create( SvStream &, sal_uInt16 nVersion ) const;
180*cdf0e10cSrcweir 	virtual SvStream&		Store( SvStream &, sal_uInt16 nItemVersion ) const;
181*cdf0e10cSrcweir };
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir //=========================================================================
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir enum SfxMsgPriority
187*cdf0e10cSrcweir {
188*cdf0e10cSrcweir 	MSG_PRIORITY_LOW = 0,
189*cdf0e10cSrcweir 	MSG_PRIORITY_NORMAL,
190*cdf0e10cSrcweir 	MSG_PRIORITY_URGENT
191*cdf0e10cSrcweir };
192*cdf0e10cSrcweir #define SFXMSGPRIORITYCOUNT 3
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir class SfxMsgPriorityItem : public SfxEnumItem
195*cdf0e10cSrcweir {
196*cdf0e10cSrcweir public:
197*cdf0e10cSrcweir 	TYPEINFO();
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 	SfxMsgPriorityItem( sal_uInt16 nWhich, SfxMsgPriority = MSG_PRIORITY_NORMAL);
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 	virtual SfxPoolItem*	 	Clone( SfxItemPool* pPool=0 ) const;
202*cdf0e10cSrcweir 	virtual SfxPoolItem*	 	Create( SvStream&, sal_uInt16 ) const;
203*cdf0e10cSrcweir 	virtual SvStream&		 	Store( SvStream&, sal_uInt16 ) const;
204*cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePresentation,
205*cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
206*cdf0e10cSrcweir 									SfxMapUnit ePresentationMetric,
207*cdf0e10cSrcweir 									String &rText ) const;
208*cdf0e10cSrcweir 	virtual sal_uInt16			 	GetValueCount() const;
209*cdf0e10cSrcweir 	virtual String			 	GetValueTextByPos( sal_uInt16 nPos ) const;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	inline SfxMsgPriorityItem& operator=(const SfxMsgPriorityItem& rPrio)
212*cdf0e10cSrcweir 	{
213*cdf0e10cSrcweir 		SetValue( rPrio.GetValue() );
214*cdf0e10cSrcweir 		return *this;
215*cdf0e10cSrcweir 	}
216*cdf0e10cSrcweir };
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir #endif
220