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