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