// Copyright 1997-2000 Omni Development, Inc.  All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
// distributed with this project and can also be found at
// http://www.omnigroup.com/DeveloperResources/OmniSourceLicense.html.

#import "OHHTMLOwner.h"

#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <OmniBase/OmniBase.h>
#import <OmniFoundation/OmniFoundation.h>
#import <OmniAppKit/OmniAppKit.h>
#import <OWF/OWF.h>

#import "OHBasicCell.h"
#import "OHHTMLDocument.h"
#import "OHHTMLView.h"

RCS_ID("$Header: /Network/Source/CVS/OmniGroup/Frameworks/OmniHTML/View.subproj/OHHTMLOwner.m,v 1.13 2000/01/20 00:28:03 kc Exp $")

@interface OHHTMLOwner (Private)
@end

@implementation OHHTMLOwner

// Init and dealloc

- initWithHTMLViewClass:(Class)htmlViewClass htmlDocument:(OHHTMLDocument *)htmlDocument;
{
    if (![super init])
        return nil;

    OBASSERT(htmlDocument);

    htmlView = [[htmlViewClass allocWithZone:[self zone]] initWithHTMLOwner:self];
    nonretainedHTMLDocument = htmlDocument;
    [nonretainedHTMLDocument addHTMLOwner:self];
    
    return self;
}

- init;
{
    return [self initWithHTMLViewClass:[OHHTMLView class] htmlDocument:nil];
}

- (void)dealloc;
{
    [htmlView nullifyHTMLOwner];
    [htmlView release];
    [super dealloc];
}


// API

- (OHHTMLDocument *)htmlDocument;
{
    return nonretainedHTMLDocument;
}

- (void)nullifyHTMLDocument;
{
    nonretainedHTMLDocument = nil;
}

- (NSTextStorage *)htmlStorage;
{
    return [htmlView textStorage];
}

- (OHHTMLView *)htmlView;
{
    return htmlView;
}

- (void)documentDidDeactivate:(OHHTMLView *)document
{
    // Nothing needs to be done by this class
}

@end

@implementation OHHTMLOwner (Private)
@end
