/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/*
 *  Copyright (C) 2008 OMC Denmark ApS.
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef F2T_IMAPITABLE_DEF
#define F2T_IMAPITABLE_DEF

#pragma prefix "omc.brutus"

#include "types.idl"
#include "IMAPIAdviseSink.idl"

module BRUTUS {

        interface IMAPITable : IUnknown {
                BRESULT GetLastError(in BRESULT ReturnCode,
                                     in BDEFINE ulFlags,
                                     out MAPIERROR lppMAPIError); 

                BRESULT Advise(in BDEFINE ulEventMask, 
                               in IMAPIAdviseSink lpAdviseSink, 
                               out unsigned long lpulConnection); 

                BRESULT Unadvise(in unsigned long ulConnection);        

                BRESULT GetStatus(out unsigned long lpulTableStatus,
                                  out unsigned long lpulTableType);

                BRESULT SetColumns(in SPropTagArray lpPropTagArray,
                                   in BDEFINE ulFlags);

                BRESULT QueryColumns(in BDEFINE  ulFlags,
                                     out SPropTagArray lpPropTagArray);

                BRESULT GetRowCount(in BDEFINE ulFlags, 
                                    out unsigned long lpulCount); 

                BRESULT SeekRow(in unsigned long bkOrigin,
                                in long lRowCount,
                                out long lplRowsSought);

                BRESULT SeekRowApprox(in unsigned long ulNumerator,
                                      in unsigned long ulDenominator);

                BRESULT QueryPosition(out unsigned long lpulRow,
                                      out unsigned long lpulNumerator,
                                      out unsigned long lpulDenominator); 

                BRESULT FindRow(in SRestrictionContainer lpRestriction,              
                                in unsigned long bkOrigin,                   
                                in BDEFINE ulFlags);             

                BRESULT Restrict(in SRestrictionContainer lpRestriction,              
                                 in BDEFINE ulFlags);             

                BRESULT CreateBookmark(out unsigned long lpbkPosition);        

                BRESULT FreeBookmark(in unsigned long bkPosition);          

                BRESULT SortTable(in SSortOrderSet lpSortCriteria,             
                                  in BDEFINE ulFlags);             

                BRESULT QuerySortOrder(out SSortOrderSet lppSortCriteria);     

                BRESULT QueryRows(in long lRowCount,                  
                                  in BDEFINE ulFlags,                    
                                  out SRowSet lppRows);             

                BRESULT Abort();                                     

                BRESULT ExpandRow(in seq_octet pbInstanceKey, 
                                  in unsigned long ulRowCount, 
                                  in BDEFINE ulFlags,
                                  out SRowSet lppRows, 
                                  out unsigned long lpulMoreRows); 

                BRESULT CollapseRow(in seq_octet pbInstanceKey,
                                    in BDEFINE ulFlags,
                                    out unsigned long lpulRowCount);

                BRESULT WaitForCompletion(in BDEFINE ulFlags,
                                          in unsigned long ulTimeout,
                                          inout unsigned long lpulTableStatus);

                BRESULT GetCollapseState(in BDEFINE ulFlags, 
                                         in seq_octet lpbInstanceKey, 
                                         out seq_octet lppbCollapseState);

                BRESULT SetCollapseState(in BDEFINE ulFlags, 
                                         in seq_octet pbCollapseState,
                                         out unsigned long lpbkLocation); 

		// Hack alert! Needed by e.g ITnef::EncodeRecips()
		// A client should *NEVER* have any use for this method!
                BRESULT GetLocalPointer(out unsigned long long Pointer);
        };

}; // End of module BRUTUS


#endif
