D:/develop/v65/clients/outlook/install/output/export/funambol/clients/outlook/mainclientDll/src/include/outlook/ClientRecurrence.h

00001  /*
00002  * Copyright (C) 2006-2007 Funambol, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 02111-1307  USA
00017 */
00018 
00019 #ifndef INCL_CLIENTRECURRENCE
00020 #define INCL_CLIENTRECURRENCE
00021 
00026 #include "outlook/defs.h"
00027 #include "outlook/ClientAppException.h"
00028 
00029 #include <string>
00030 #include <list>
00031 
00032 typedef std::list<ClientAppException>     exceptionList;
00033 typedef exceptionList::iterator           exceptionIterator;
00034 
00035 
00053 class ClientRecurrence {
00054 
00055 private:
00056 
00057     // Rec properties:
00058     int          recurrenceType;
00059     int          interval;
00060     int          monthOfYear;
00061     int          dayOfMonth;
00062     int          dayOfWeekMask;
00063     int          instance;
00064     std::wstring patternStartDate;
00065     BOOL         noEndDate;
00066     std::wstring patternEndDate;
00067     int          occurrences;
00068 
00069     std::wstring start;             
00070     BOOL      isAllDay;             
00073 
00074     RecurrencePatternPtr  pRec;
00075 
00077     exceptionList appExceptions;
00078 
00079 
00083     bool recurring;
00084 
00088     bool isUpdated;
00089 
00091     int numRecursions;
00092 
00093 
00094 
00096     void checkIfRecIsCorrect();
00097 
00099     bool changeDay(const std::wstring dest);
00100 
00101 
00102     //
00103     // Internal methods to manage exceptions.
00104     //
00106     ClientAppException* getExceptionOnClient(const int index);
00107     const int           getExceptionsCountOnClient();
00108     int                 saveException(ClientAppException* cException);
00109     //void              freeDestinationDays(const DATE startDate, const DATE originalDate);
00110     //int               safeSaveException(ClientAppException* cException);
00111 
00112 public:
00113 
00115     ClientRecurrence();
00116 
00118     ~ClientRecurrence();
00119 
00121     void setCOMPtr(RecurrencePatternPtr& ptr);
00122 
00123 
00124 
00131     int read();
00132 
00141     int save();
00142 
00143 
00144 
00146     bool isRecurring();
00147 
00150     void setRecurrence();
00151 
00154     void clearRecurrence();
00155 
00156 
00157 
00158     //
00159     // Methods to get recurrence properties.
00160     // -------------------------------------
00161     // The first time a property is needed (isUpdated = false), all values 
00162     // are retrieved from Outlook calling 'read()'.
00163     //
00164     const int           getRecurrenceType  ();
00165     const int           getInterval        ();
00166     const int           getMonthOfYear     ();
00167     const int           getDayOfMonth      ();
00168     const int           getDayOfWeekMask   ();
00169     const int           getInstance        ();
00170     const std::wstring& getPatternStartDate();
00171     const BOOL          getNoEndDate       ();
00172     const std::wstring& getPatternEndDate  ();
00173     const int           getOccurrences     ();
00174 
00175     // Get property value (wstring) from its name.
00176     const std::wstring getProperty(const std::wstring& propertyName);
00177 
00178 
00179     //
00180     // Methods to set recurrence properties.
00181     // -------------------------------------
00182     // Values passed are stored in internal members, calling 'save()' all properties 
00183     // are put together into Outlook rec pattern (this is for UTC transformations).
00184     // No test on value content is done at this level.
00185     // 'isUpdated' is set to false, cause setting a property the rec pattern is no
00186     // more updated with Outlook.
00187     //
00188     void setRecurrenceType  (const int           val);
00189     void setInterval        (const int           val);
00190     void setMonthOfYear     (const int           val);
00191     void setDayOfMonth      (const int           val);
00192     void setDayOfWeekMask   (const int           val);
00193     void setInstance        (const int           val);
00194     void setPatternStartDate(const std::wstring& val);
00195     void setNoEndDate       (const BOOL          val);
00196     void setPatternEndDate  (const std::wstring& val);
00197     void setOccurrences     (const int           val);
00198 
00200     void setStart           (const std::wstring& val);
00201     void setIsAllDay        (const BOOL          val);
00202 
00203     // Set property value from its name: set internal object values.
00204     int setProperty(const std::wstring& propertyName, const std::wstring& propertyValue);
00205 
00206 
00207 
00208     //
00209     // To manage appointment exceptions.
00210     //
00211     ClientAppException* getException(const int index);
00212     const int           getExceptionsCount();
00213     int                 addException(ClientAppException* cException);
00214     void                resetExceptions();
00215     int                 saveAllExceptions();
00216     int                 removeDuplicatedExceptions();
00217 
00218     _AppointmentItemPtr getOccurrence(const DATE originalDate);
00219 
00220 };
00221 
00224 #endif

Generated on Fri Nov 9 12:21:26 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2