1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: msgnodei.hxx,v $
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 ************************************************************************/
35 #include <svtools/eitem.hxx>
36 #include <tools/string.hxx>
37 #include <svtools/poolitem.hxx>
38 #include <tools/list.hxx>
39 struct SfxMsgAttachFile
{
43 int operator==( const SfxMsgAttachFile
& rRec
) const
45 if( aName
== rRec
.aName
&& aFile
== rRec
.aFile
)
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
62 MSG_RECEIVER_NEWSGROUP
65 struct SfxMsgReceiver
{
67 SfxMsgReceiverRole eRole
;
69 int operator==( const SfxMsgReceiver
& rRec
) const
71 if( aName
== rRec
.aName
&& eRole
== rRec
.eRole
)
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
88 ~SfxMsgReceiverList_Impl();
89 SfxMsgReceiverList_Impl
& operator=( const SfxMsgReceiverList_Impl
&); //n.i.
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
106 SfxMsgReceiverList_Impl
* pImp
;
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
139 ~SfxMsgAttachFileList_Impl();
140 SfxMsgAttachFileList_Impl
& operator=( const SfxMsgAttachFileList_Impl
&); //n.i.
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
158 SfxMsgAttachFileList_Impl
* pImp
;
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 //=========================================================================
191 MSG_PRIORITY_LOW
= 0,
195 #define SFXMSGPRIORITYCOUNT 3
197 class SfxMsgPriorityItem
: public SfxEnumItem
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() );