merge the formfield patch from ooo-build
[ooovba.git] / sfx2 / inc / msgnodei.hxx
blobc26b5e2e8f0c8a39e723bbb0cc88d549c67894c4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: msgnodei.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _MSGNODEI_HXX
32 #define _MSGNODEI_HXX
35 #include <svtools/eitem.hxx>
36 #include <tools/string.hxx>
37 #include <svtools/poolitem.hxx>
38 #include <tools/list.hxx>
39 struct SfxMsgAttachFile {
40 String aFile;
41 String aName;
43 int operator==( const SfxMsgAttachFile& rRec ) const
45 if( aName == rRec.aName && aFile == rRec.aFile )
46 return TRUE;
47 return FALSE;
50 SfxMsgAttachFile( const String& rFile, const String& rName)
51 : aName( rName ), aFile( rFile ) {}
53 SfxMsgAttachFile( const SfxMsgAttachFile& rRec )
54 : aName( rRec.aName), aFile( rRec.aFile ) {}
57 enum SfxMsgReceiverRole
59 MSG_RECEIVER_TO = 0,
60 MSG_RECEIVER_CC,
61 MSG_RECEIVER_BCC,
62 MSG_RECEIVER_NEWSGROUP
65 struct SfxMsgReceiver {
66 String aName;
67 SfxMsgReceiverRole eRole;
69 int operator==( const SfxMsgReceiver& rRec ) const
71 if( aName == rRec.aName && eRole == rRec.eRole )
72 return TRUE;
73 return FALSE;
76 SfxMsgReceiver( const String& rName, SfxMsgReceiverRole _eRole )
77 : aName( rName ), eRole( _eRole ) {}
79 SfxMsgReceiver( const SfxMsgReceiver& rRec )
80 : aName( rRec.aName), eRole( rRec.eRole ) {}
83 // ------------------------------------------------------------------------
85 class SfxMsgReceiverList_Impl : public List
87 ULONG nRef;
88 ~SfxMsgReceiverList_Impl();
89 SfxMsgReceiverList_Impl& operator=( const SfxMsgReceiverList_Impl&); //n.i.
90 public:
91 SfxMsgReceiverList_Impl();
92 SfxMsgReceiverList_Impl(const SfxMsgReceiverList_Impl&);
94 void Load( SvStream& );
95 void Store( SvStream& ) const;
96 void IncRef() { nRef++; }
97 void DecRef() { nRef--; if( !nRef ) delete this; }
98 ULONG GetRefCount() const { return nRef; }
99 int operator==( const SfxMsgReceiverList_Impl& ) const;
102 class SfxMsgReceiverListItem : public SfxPoolItem
104 void Disconnect();
105 protected:
106 SfxMsgReceiverList_Impl* pImp;
107 public:
108 TYPEINFO();
110 SfxMsgReceiverListItem();
111 SfxMsgReceiverListItem( USHORT nWhich );
112 SfxMsgReceiverListItem( USHORT nWhich, SvStream& rStream );
113 SfxMsgReceiverListItem( const SfxMsgReceiverListItem& rItem );
114 ~SfxMsgReceiverListItem();
116 virtual int operator==( const SfxPoolItem& ) const;
118 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
119 SfxMapUnit eCoreMetric,
120 SfxMapUnit ePresMetric,
121 XubString &rText ) const;
123 USHORT Count() const;
124 SfxMsgReceiver* GetObject( USHORT nPos );
125 void Remove( USHORT nPos );
126 void Add( const SfxMsgReceiver& );
128 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
129 virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const;
130 virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const;
134 // ------------------------------------------------------------------------
136 class SfxMsgAttachFileList_Impl : public List
138 ULONG nRef;
139 ~SfxMsgAttachFileList_Impl();
140 SfxMsgAttachFileList_Impl& operator=( const SfxMsgAttachFileList_Impl&); //n.i.
142 public:
143 SfxMsgAttachFileList_Impl();
144 SfxMsgAttachFileList_Impl(const SfxMsgAttachFileList_Impl&);
146 int operator==( const SfxMsgAttachFileList_Impl& rRec ) const;
147 SfxMsgAttachFile* GetReceiver(ULONG nPos) { return (SfxMsgAttachFile*)List::GetObject(nPos); }
148 void Load( SvStream& );
149 void Store( SvStream& ) const;
150 void IncRef() { nRef++; }
151 void DecRef() { nRef--; if( !nRef ) delete this; }
152 ULONG GetRefCount() const { return nRef; }
155 class SfxMsgAttachFileListItem : public SfxPoolItem
157 protected:
158 SfxMsgAttachFileList_Impl* pImp;
159 void Disconnect();
160 public:
161 TYPEINFO();
163 SfxMsgAttachFileListItem();
164 SfxMsgAttachFileListItem( USHORT nWhich );
165 SfxMsgAttachFileListItem( USHORT nWhich, SvStream& rStream );
166 SfxMsgAttachFileListItem( const SfxMsgAttachFileListItem& rItem );
167 ~SfxMsgAttachFileListItem();
169 virtual int operator==( const SfxPoolItem& ) const;
171 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
172 SfxMapUnit eCoreMetric,
173 SfxMapUnit ePresMetric,
174 XubString &rText ) const;
176 USHORT Count() const;
177 SfxMsgAttachFile* GetObject( USHORT nPos );
178 void Remove( USHORT nPos );
179 void Add( const SfxMsgAttachFile& );
181 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
182 virtual SfxPoolItem* Create( SvStream &, USHORT nVersion ) const;
183 virtual SvStream& Store( SvStream &, USHORT nItemVersion ) const;
187 //=========================================================================
189 enum SfxMsgPriority
191 MSG_PRIORITY_LOW = 0,
192 MSG_PRIORITY_NORMAL,
193 MSG_PRIORITY_URGENT
195 #define SFXMSGPRIORITYCOUNT 3
197 class SfxMsgPriorityItem : public SfxEnumItem
199 public:
200 TYPEINFO();
202 SfxMsgPriorityItem( USHORT nWhich, SfxMsgPriority = MSG_PRIORITY_NORMAL);
204 virtual SfxPoolItem* Clone( SfxItemPool* pPool=0 ) const;
205 virtual SfxPoolItem* Create( SvStream&, USHORT ) const;
206 virtual SvStream& Store( SvStream&, USHORT ) const;
207 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePresentation,
208 SfxMapUnit eCoreMetric,
209 SfxMapUnit ePresentationMetric,
210 String &rText ) const;
211 virtual USHORT GetValueCount() const;
212 virtual String GetValueTextByPos( USHORT nPos ) const;
214 inline SfxMsgPriorityItem& operator=(const SfxMsgPriorityItem& rPrio)
216 SetValue( rPrio.GetValue() );
217 return *this;
222 #endif