home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 4.4 KB | 205 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWInsCmd.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFrameW.hpp"
-
- #ifndef FWINSCMD_H
- #include "FWInsCmd.h"
- #endif
-
- #ifndef FWPART_H
- #include "FWPart.h"
- #endif
-
- #ifndef FWINTER_H
- #include "FWInter.h"
- #endif
-
- #ifndef FWFRMING_H
- #include "FWFrming.h"
- #endif
-
- #ifndef FWSELECT_H
- #include "FWSelect.h"
- #endif
-
- #ifndef FWLINK_H
- #include "FWLink.h"
- #endif
-
- #ifndef FWLNKMGR_H
- #include "FWLnkMgr.h"
- #endif
-
- #ifndef FWEMBUTL_H
- #include "FWEmbUtl.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWBARRAY_H
- #include "FWBArray.h"
- #endif
-
- #ifndef SLODFSTR_K
- #include "SLODFStr.k"
- #endif
-
- #ifndef SLODFSTR_H
- #include "SLODFStr.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_Module_OpenDoc_Commands_defined
- #include <CmdDefs.xh>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- #ifndef SOM_ODClipboard_xh
- #include <Clipbd.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdProps_defined
- #include <StdProps.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_StdTypes_defined
- #include <StdTypes.xh>
- #endif
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef SOM_ODLinkSpec_xh
- #include <LinkSpec.xh>
- #endif
-
- //========================================================================================
- // Runtime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfcommands
- #endif
-
- FW_DEFINE_AUTO(FW_CInsertCommand)
-
- //====================================================================
- // FW_CInsertCommand class
- //====================================================================
-
- //--------------------------------------------------------------------
- // FW_CInsertCommand constructor
- //--------------------------------------------------------------------
-
- FW_CInsertCommand::FW_CInsertCommand(Environment* ev,
- FW_CEmbeddingFrame* frame,
- const FW_PFileSpecification& fileSpec,
- FW_Boolean canUndo) :
- FW_CCommand(ev, kODCommandInsert, frame, canUndo),
- fFileSpec(fileSpec),
- fEmbeddingFrame(frame)
- {
- if (GetCanUndo(ev))
- {
- FW_CString undoString;
- FW_CString redoString;
-
- ::FW_PrivLoadUndoStrings(ev, FW_kUndoInsertMsg, undoString, redoString);
- SetMenuStrings(ev, undoString, redoString);
- }
-
- FW_END_CONSTRUCTOR
- }
-
- //--------------------------------------------------------------------
- // FW_CInsertCommand destructor
- //--------------------------------------------------------------------
-
- FW_CInsertCommand::~FW_CInsertCommand()
- {
- FW_START_DESTRUCTOR
- }
-
- //--------------------------------------------------------------------
- // FW_CInsertCommand::DoIt
- //--------------------------------------------------------------------
-
- void FW_CInsertCommand::DoIt(Environment* ev) // Override
- {
- FW_Boolean result = FALSE;
-
- if (GetCanUndo(ev))
- this->SaveUndoState(ev); // save current state, for later Undo
-
- if (this->IsOKtoEdit(ev) && this->Insert(ev))
- {
- result = TRUE;
- }
-
-
- if (result == FALSE)
- {
- SetCanUndo(ev, FALSE);
- SetCausesChange(ev, FALSE);
- }
- else if (GetCanUndo(ev))
- {
- this->SaveRedoState(ev); // save new state, for later Redo
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInsertCommand::Insert
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_CInsertCommand::Insert(Environment* ev)
- {
- PreCommand(ev);
-
- FW_Boolean result = FW_InsertPartFromFile(ev, fEmbeddingFrame, fFileSpec) != FW_kInternalizeFailed;
-
- if (result)
- CommandDone(ev);
-
- return result;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInsertCommand::PreCommand
- //----------------------------------------------------------------------------------------
-
- void FW_CInsertCommand::PreCommand(Environment* ev)
- {
- FW_UNUSED(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CInsertCommand::CommandDone
- //----------------------------------------------------------------------------------------
-
- void FW_CInsertCommand::CommandDone(Environment* ev)
- {
- FW_UNUSED(ev);
- // User may override; only gets called if the Insert was successful
- }
-
-
-
-
-