File:  [mozdev] / chimera / BookmarksService.h
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Sat Feb 9 01:52:27 2002 UTC (18 years, 3 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Preparing for bookmark notifications.

    1: /*
    2:  *  BookmarksService.h
    3:  *  Chimera
    4:  *
    5:  *  Created by David Hyatt on Thu Feb 07 2002.
    6:  *  Copyright (c) 2001 __MyCompanyName__. All rights reserved.
    7:  *
    8:  */
    9: 
   10: #include <Appkit/Appkit.h>
   11: #include <Carbon/Carbon.h>
   12: #include "nsCOMPtr.h"
   13: #include "nsIDocument.h"
   14: #include "nsIDocumentObserver.h"
   15: 
   16: class BookmarksService;
   17: class nsIAtom;
   18: 
   19: @interface BookmarksDataSource : NSObject
   20: {
   21:     BookmarksService* mBookmarks;
   22:     IBOutlet id mOutlineView;
   23:     IBOutlet id mBrowserView;
   24:     IBOutlet id mAddButton;
   25:     IBOutlet id mDeleteButton;
   26: }
   27: 
   28: -(id) init;
   29: -(void) dealloc;
   30: 
   31: -(void) ensureBookmarks;
   32: 
   33: -(IBAction)addBookmark:(id)aSender;
   34: -(IBAction)deleteBookmark: (id)aSender;
   35: 
   36: // Datasource methods.
   37: - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
   38: - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
   39: - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
   40: - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
   41: - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
   42: 
   43: @end
   44: 
   45: @interface BookmarkItem : NSObject
   46: {
   47:     nsIContent* mContentNode;
   48: }
   49: 
   50: -(nsIContent*)contentNode;
   51: -(void)setContentNode: (nsIContent*)aContentNode;
   52: @end
   53: 
   54: class BookmarksService: public nsIDocumentObserver
   55: {
   56: public:
   57:     BookmarksService();
   58:     virtual ~BookmarksService();
   59:     
   60:     NS_DECL_ISUPPORTS;
   61:     
   62:     // nsIDocumentObserver interface
   63:     NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; };
   64:     NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; };
   65:     NS_IMETHOD BeginLoad(nsIDocument *aDocument)  { return NS_OK; };
   66:     NS_IMETHOD EndLoad(nsIDocument *aDocument)  { return NS_OK; };
   67:     NS_IMETHOD BeginReflow(nsIDocument *aDocument, nsIPresShell* aShell)  { return NS_OK; };
   68:     NS_IMETHOD EndReflow(nsIDocument *aDocument, nsIPresShell* aShell)  { return NS_OK; };
   69:     NS_IMETHOD ContentChanged(nsIDocument *aDocument,
   70:                             nsIContent* aContent,
   71:                             nsISupports* aSubContent)  { return NS_OK; };
   72:     NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
   73:                                   nsIContent* aContent1,
   74:                                   nsIContent* aContent2)  { return NS_OK; };
   75:     NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
   76:                              nsIContent* aContainer,
   77:                              nsIContent* aOldChild,
   78:                              nsIContent* aNewChild,
   79:                              PRInt32 aIndexInContainer) { return NS_OK; };
   80:     NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
   81:                              nsIStyleSheet* aStyleSheet)  { return NS_OK; };
   82: 
   83:     NS_IMETHOD StyleSheetRemoved(nsIDocument *aDocument,
   84:                                nsIStyleSheet* aStyleSheet)  { return NS_OK; };
   85:     
   86:     NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument *aDocument,
   87:                                             nsIStyleSheet* aStyleSheet,
   88:                                             PRBool aDisabled)  { return NS_OK; };
   89:     NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument,
   90:                               nsIStyleSheet* aStyleSheet,
   91:                               nsIStyleRule* aStyleRule,
   92:                               PRInt32 aHint) { return NS_OK; };
   93:     NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument,
   94:                             nsIStyleSheet* aStyleSheet,
   95:                             nsIStyleRule* aStyleRule)  { return NS_OK; };
   96:     NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument,
   97:                               nsIStyleSheet* aStyleSheet,
   98:                               nsIStyleRule* aStyleRule)  { return NS_OK; };
   99:     NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument)  { return NS_OK; };
  100: 
  101: 
  102:     NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
  103:                               nsIContent*  aContent,
  104:                               PRInt32      aNameSpaceID,
  105:                               nsIAtom*     aAttribute,
  106:                               PRInt32      aModType,    
  107:                               PRInt32      aHint);  // See nsStyleConsts fot hint values
  108:     NS_IMETHOD ContentAppended(nsIDocument *aDocument,
  109:                              nsIContent* aContainer,
  110:                              PRInt32     aNewIndexInContainer);
  111: 
  112:     NS_IMETHOD ContentInserted(nsIDocument *aDocument,
  113:                              nsIContent* aContainer,
  114:                              nsIContent* aChild,
  115:                              PRInt32 aIndexInContainer);
  116:     
  117:     NS_IMETHOD ContentRemoved(nsIDocument *aDocument,
  118:                             nsIContent* aContainer,
  119:                             nsIContent* aChild,
  120:                             PRInt32 aIndexInContainer);
  121: 
  122:     void AddObserver();
  123:     void RemoveObserver();
  124: 
  125: public:
  126:     static void GetRootContent(nsIContent** aResult);
  127:     static BookmarkItem* GetWrapperFor(nsIContent* aItem);
  128:     
  129: private:
  130:     // Global counter and pointers to our singletons.
  131:     static PRUint32 gRefCnt;
  132:     static nsIDocument* gBookmarks;
  133:     static NSMutableDictionary* gDictionary;
  134:     
  135: public:
  136:     static nsIAtom* gFolderAtom;
  137:     static nsIAtom* gNameAtom;
  138:     static nsIAtom* gHrefAtom;
  139:     static nsIAtom* gBookmarkAtom;
  140: };

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>