// $Revision: 1.3 $ // Copyright (C) 1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_FOLLOWURLCOMMAND #include "FollowURLCommand.h" #endif #ifndef TaligentSamples_WEBMODEL #include "WebModel.h" #endif MCollectibleDefinitionsMacro(TFollowURLCommand, kOriginalVersion); TFollowURLCommand::TFollowURLCommand() : TCommandOn(TCommonCommand::kSerialUndo), fDestination(), fPreviousURL() { } TFollowURLCommand::TFollowURLCommand(const TURL& destination) : TCommandOn(TCommonCommand::kSerialUndo), fDestination(destination), fPreviousURL() { } TFollowURLCommand::TFollowURLCommand(const TFollowURLCommand& source) : TCommandOn(source), fDestination(source.fDestination), fPreviousURL(source.fPreviousURL) { } TFollowURLCommand::~TFollowURLCommand() { } TFollowURLCommand& TFollowURLCommand::operator=(const TFollowURLCommand& source) { if (&source != this) { TCommandOn::operator=(source); fDestination = source.fDestination; fPreviousURL = source.fPreviousURL; } return *this; } TStream& TFollowURLCommand::operator>>=(TStream& toStream) const { ::WriteVersion(toStream); TCommandOn::operator>>=(toStream); fDestination >>= toStream; fPreviousURL >>= toStream; return toStream; } TStream& TFollowURLCommand::operator<<=(TStream& fromStream) { ::ReadVersion(fromStream, kOriginalVersion, kOriginalVersion); TCommandOn::operator<<=(fromStream); fDestination <<= fromStream; fPreviousURL <<= fromStream; return fromStream; } void TFollowURLCommand::HandleDoBegin(TModelSelection& selection) { TModelPointerTo model(selection.GetModelReference()); fPreviousURL = model->FollowURL(fDestination); } void TFollowURLCommand::HandleUndo(TModelSelection& selection) { TModelPointerTo model(selection.GetModelReference()); model->FollowURL(fPreviousURL); } void TFollowURLCommand::HandleRedo(TModelSelection& selection) { TModelPointerTo model(selection.GetModelReference()); model->FollowURL(fDestination); }