xref: /AOO41X/main/sfx2/inc/msgnodei.hxx (revision 353d8f4d17010cd2d0ea815067cad67e477f2bee)
1*353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _MSGNODEI_HXX
25cdf0e10cSrcweir #define _MSGNODEI_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <svl/eitem.hxx>
29cdf0e10cSrcweir #include <tools/string.hxx>
30cdf0e10cSrcweir #include <svl/poolitem.hxx>
31cdf0e10cSrcweir #include <tools/list.hxx>
32cdf0e10cSrcweir struct SfxMsgAttachFile {
33cdf0e10cSrcweir 	String	aFile;
34cdf0e10cSrcweir 	String	aName;
35cdf0e10cSrcweir 
operator ==SfxMsgAttachFile36cdf0e10cSrcweir 	int 				operator==( const SfxMsgAttachFile& rRec ) const
37cdf0e10cSrcweir 						{
38cdf0e10cSrcweir 							if( aName == rRec.aName && aFile == rRec.aFile )
39cdf0e10cSrcweir 								return sal_True;
40cdf0e10cSrcweir 							return sal_False;
41cdf0e10cSrcweir 						}
42cdf0e10cSrcweir 
SfxMsgAttachFileSfxMsgAttachFile43cdf0e10cSrcweir 						SfxMsgAttachFile( const String& rFile, const String& rName)
44cdf0e10cSrcweir 							: aName( rName ), aFile( rFile ) {}
45cdf0e10cSrcweir 
SfxMsgAttachFileSfxMsgAttachFile46cdf0e10cSrcweir 						SfxMsgAttachFile( const SfxMsgAttachFile& rRec )
47cdf0e10cSrcweir 							: aName( rRec.aName), aFile( rRec.aFile ) {}
48cdf0e10cSrcweir };
49cdf0e10cSrcweir 
50cdf0e10cSrcweir enum SfxMsgReceiverRole
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 	MSG_RECEIVER_TO = 0,
53cdf0e10cSrcweir 	MSG_RECEIVER_CC,
54cdf0e10cSrcweir 	MSG_RECEIVER_BCC,
55cdf0e10cSrcweir 	MSG_RECEIVER_NEWSGROUP
56cdf0e10cSrcweir };
57cdf0e10cSrcweir 
58cdf0e10cSrcweir struct SfxMsgReceiver {
59cdf0e10cSrcweir 	String				aName;
60cdf0e10cSrcweir 	SfxMsgReceiverRole  eRole;
61cdf0e10cSrcweir 
operator ==SfxMsgReceiver62cdf0e10cSrcweir 	int 				operator==( const SfxMsgReceiver& rRec ) const
63cdf0e10cSrcweir 						{
64cdf0e10cSrcweir 							if( aName == rRec.aName && eRole == rRec.eRole )
65cdf0e10cSrcweir 								return sal_True;
66cdf0e10cSrcweir 							return sal_False;
67cdf0e10cSrcweir 						}
68cdf0e10cSrcweir 
SfxMsgReceiverSfxMsgReceiver69cdf0e10cSrcweir 						SfxMsgReceiver( const String& rName, SfxMsgReceiverRole _eRole )
70cdf0e10cSrcweir 							: aName( rName ), eRole( _eRole ) {}
71cdf0e10cSrcweir 
SfxMsgReceiverSfxMsgReceiver72cdf0e10cSrcweir 						SfxMsgReceiver( const SfxMsgReceiver& rRec )
73cdf0e10cSrcweir 							: aName( rRec.aName), eRole( rRec.eRole ) {}
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
76cdf0e10cSrcweir // ------------------------------------------------------------------------
77cdf0e10cSrcweir 
78cdf0e10cSrcweir class SfxMsgReceiverList_Impl : public List
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	sal_uIntPtr 			nRef;
81cdf0e10cSrcweir 					~SfxMsgReceiverList_Impl();
82cdf0e10cSrcweir 	SfxMsgReceiverList_Impl& operator=( const SfxMsgReceiverList_Impl&); //n.i.
83cdf0e10cSrcweir public:
84cdf0e10cSrcweir 					SfxMsgReceiverList_Impl();
85cdf0e10cSrcweir 					SfxMsgReceiverList_Impl(const SfxMsgReceiverList_Impl&);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	void			Load( SvStream& );
88cdf0e10cSrcweir 	void			Store( SvStream& ) const;
IncRef()89cdf0e10cSrcweir 	void 			IncRef() { nRef++; }
DecRef()90cdf0e10cSrcweir 	void 			DecRef() { nRef--; if( !nRef ) delete this; }
GetRefCount() const91cdf0e10cSrcweir 	sal_uIntPtr			GetRefCount() const { return nRef; }
92cdf0e10cSrcweir 	int 			operator==( const SfxMsgReceiverList_Impl& ) const;
93cdf0e10cSrcweir };
94cdf0e10cSrcweir 
95cdf0e10cSrcweir class SfxMsgReceiverListItem : public SfxPoolItem
96cdf0e10cSrcweir {
97cdf0e10cSrcweir 	void					Disconnect();
98cdf0e10cSrcweir protected:
99cdf0e10cSrcweir 	SfxMsgReceiverList_Impl* pImp;
100cdf0e10cSrcweir public:
101cdf0e10cSrcweir 							TYPEINFO();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 							SfxMsgReceiverListItem();
104cdf0e10cSrcweir 							SfxMsgReceiverListItem( sal_uInt16 nWhich );
105cdf0e10cSrcweir 							SfxMsgReceiverListItem( sal_uInt16 nWhich, SvStream& rStream );
106cdf0e10cSrcweir 							SfxMsgReceiverListItem( const SfxMsgReceiverListItem& rItem );
107cdf0e10cSrcweir 							~SfxMsgReceiverListItem();
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	virtual int 			operator==( const SfxPoolItem& ) const;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
112cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
113cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
114cdf0e10cSrcweir 									XubString &rText ) const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	sal_uInt16					Count() const;
117cdf0e10cSrcweir 	SfxMsgReceiver*			GetObject( sal_uInt16 nPos );
118cdf0e10cSrcweir 	void					Remove( sal_uInt16 nPos );
119cdf0e10cSrcweir 	void					Add( const SfxMsgReceiver& );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
122cdf0e10cSrcweir 	virtual SfxPoolItem*	Create( SvStream &, sal_uInt16 nVersion ) const;
123cdf0e10cSrcweir 	virtual SvStream&		Store( SvStream &, sal_uInt16 nItemVersion ) const;
124cdf0e10cSrcweir };
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 
127cdf0e10cSrcweir // ------------------------------------------------------------------------
128cdf0e10cSrcweir 
129cdf0e10cSrcweir class SfxMsgAttachFileList_Impl : public List
130cdf0e10cSrcweir {
131cdf0e10cSrcweir 	sal_uIntPtr 			nRef;
132cdf0e10cSrcweir 					~SfxMsgAttachFileList_Impl();
133cdf0e10cSrcweir 	SfxMsgAttachFileList_Impl& operator=( const SfxMsgAttachFileList_Impl&); //n.i.
134cdf0e10cSrcweir 
135cdf0e10cSrcweir public:
136cdf0e10cSrcweir 					SfxMsgAttachFileList_Impl();
137cdf0e10cSrcweir 					SfxMsgAttachFileList_Impl(const SfxMsgAttachFileList_Impl&);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	int				operator==( const SfxMsgAttachFileList_Impl& rRec ) const;
GetReceiver(sal_uIntPtr nPos)140cdf0e10cSrcweir 	SfxMsgAttachFile* GetReceiver(sal_uIntPtr nPos) { return (SfxMsgAttachFile*)List::GetObject(nPos); }
141cdf0e10cSrcweir 	void			Load( SvStream& );
142cdf0e10cSrcweir 	void			Store( SvStream& ) const;
IncRef()143cdf0e10cSrcweir 	void 			IncRef() { nRef++; }
DecRef()144cdf0e10cSrcweir 	void 			DecRef() { nRef--; if( !nRef ) delete this; }
GetRefCount() const145cdf0e10cSrcweir 	sal_uIntPtr			GetRefCount() const { return nRef; }
146cdf0e10cSrcweir };
147cdf0e10cSrcweir 
148cdf0e10cSrcweir class SfxMsgAttachFileListItem : public SfxPoolItem
149cdf0e10cSrcweir {
150cdf0e10cSrcweir protected:
151cdf0e10cSrcweir 	SfxMsgAttachFileList_Impl* pImp;
152cdf0e10cSrcweir 	void					Disconnect();
153cdf0e10cSrcweir public:
154cdf0e10cSrcweir 							TYPEINFO();
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 							SfxMsgAttachFileListItem();
157cdf0e10cSrcweir 							SfxMsgAttachFileListItem( sal_uInt16 nWhich );
158cdf0e10cSrcweir 							SfxMsgAttachFileListItem( sal_uInt16 nWhich, SvStream& rStream );
159cdf0e10cSrcweir 							SfxMsgAttachFileListItem( const SfxMsgAttachFileListItem& rItem );
160cdf0e10cSrcweir 							~SfxMsgAttachFileListItem();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	virtual int 			operator==( const SfxPoolItem& ) const;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
165cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
166cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
167cdf0e10cSrcweir 									XubString &rText ) const;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	sal_uInt16					Count() const;
170cdf0e10cSrcweir 	SfxMsgAttachFile*		GetObject( sal_uInt16 nPos );
171cdf0e10cSrcweir 	void					Remove( sal_uInt16 nPos );
172cdf0e10cSrcweir 	void					Add( const SfxMsgAttachFile& );
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 	virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
175cdf0e10cSrcweir 	virtual SfxPoolItem*	Create( SvStream &, sal_uInt16 nVersion ) const;
176cdf0e10cSrcweir 	virtual SvStream&		Store( SvStream &, sal_uInt16 nItemVersion ) const;
177cdf0e10cSrcweir };
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 
180cdf0e10cSrcweir //=========================================================================
181cdf0e10cSrcweir 
182cdf0e10cSrcweir enum SfxMsgPriority
183cdf0e10cSrcweir {
184cdf0e10cSrcweir 	MSG_PRIORITY_LOW = 0,
185cdf0e10cSrcweir 	MSG_PRIORITY_NORMAL,
186cdf0e10cSrcweir 	MSG_PRIORITY_URGENT
187cdf0e10cSrcweir };
188cdf0e10cSrcweir #define SFXMSGPRIORITYCOUNT 3
189cdf0e10cSrcweir 
190cdf0e10cSrcweir class SfxMsgPriorityItem : public SfxEnumItem
191cdf0e10cSrcweir {
192cdf0e10cSrcweir public:
193cdf0e10cSrcweir 	TYPEINFO();
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 	SfxMsgPriorityItem( sal_uInt16 nWhich, SfxMsgPriority = MSG_PRIORITY_NORMAL);
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	virtual SfxPoolItem*	 	Clone( SfxItemPool* pPool=0 ) const;
198cdf0e10cSrcweir 	virtual SfxPoolItem*	 	Create( SvStream&, sal_uInt16 ) const;
199cdf0e10cSrcweir 	virtual SvStream&		 	Store( SvStream&, sal_uInt16 ) const;
200cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePresentation,
201cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
202cdf0e10cSrcweir 									SfxMapUnit ePresentationMetric,
203cdf0e10cSrcweir 									String &rText ) const;
204cdf0e10cSrcweir 	virtual sal_uInt16			 	GetValueCount() const;
205cdf0e10cSrcweir 	virtual String			 	GetValueTextByPos( sal_uInt16 nPos ) const;
206cdf0e10cSrcweir 
operator =(const SfxMsgPriorityItem & rPrio)207cdf0e10cSrcweir 	inline SfxMsgPriorityItem& operator=(const SfxMsgPriorityItem& rPrio)
208cdf0e10cSrcweir 	{
209cdf0e10cSrcweir 		SetValue( rPrio.GetValue() );
210cdf0e10cSrcweir 		return *this;
211cdf0e10cSrcweir 	}
212cdf0e10cSrcweir };
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 
215cdf0e10cSrcweir #endif
216