home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / FWPresen.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  19.6 KB  |  620 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWPresen.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFrameW.hpp"
  11.  
  12. #ifndef FWPRESEN_H
  13. #include "FWPresen.h"
  14. #endif
  15.  
  16. #ifndef FWPART_H
  17. #include "FWPart.h"
  18. #endif
  19.  
  20. #ifndef FWFRAME_H
  21. #include "FWFrame.h"
  22. #endif
  23.  
  24. #ifndef FWSELECT_H
  25. #include "FWSelect.h"
  26. #endif
  27.  
  28. #ifndef FWITERS_H
  29. #include "FWIters.h"
  30. #endif
  31.  
  32. #ifndef FWUTIL_H
  33. #include "FWUtil.h"
  34. #endif
  35.  
  36. #ifndef FWVIEWAS_H
  37. #include "FWViewAs.h"
  38. #endif
  39.  
  40. #ifndef FWEXCEPT_H
  41. #include "FWExcept.h"
  42. #endif
  43.  
  44. #ifndef FWSESION_H
  45. #include "FWSesion.h"
  46. #endif
  47.  
  48. // ----- OS Layer -----
  49.  
  50. #ifndef FWODGEOM_H
  51. #include "FWODGeom.h"
  52. #endif
  53.  
  54. #ifndef FWWINDOW_H
  55. #include "FWWindow.h"
  56. #endif
  57.  
  58. // ----- Foundation Includes -----
  59.  
  60. #ifndef FWBNDSTR_H
  61. #include "FWBndStr.h"
  62. #endif
  63.  
  64. #ifndef FWSOMENV_H
  65. #include "FWSOMEnv.h"
  66. #endif
  67.  
  68. // ----- OpenDoc Includes -----
  69. #ifndef SOM_ODFacet_xh
  70. #include <Facet.xh>
  71. #endif
  72.  
  73. #ifndef SOM_ODFocusSet_xh
  74. #include <FocusSet.xh>
  75. #endif
  76.  
  77. #ifndef SOM_ODShape_xh
  78. #include <Shape.xh>
  79. #endif
  80.  
  81. #ifndef SOM_ODFrame_xh
  82. #include <Frame.xh>
  83. #endif
  84.  
  85. #ifndef SOM_ODArbitrator_xh
  86. #include <Arbitrat.xh>
  87. #endif
  88.  
  89. //========================================================================================
  90. // RunTime Info
  91. //========================================================================================
  92.  
  93. #ifdef FW_BUILD_MAC
  94. #pragma segment fwpart2
  95. #endif
  96.  
  97. //========================================================================================
  98. //    Template Instantiations
  99. //========================================================================================
  100.  
  101. FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollectionIterator, FW_CPresentation)
  102. FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollection, FW_CPresentation)
  103. FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollectionIterator, FW_CPrivDisplayFrame)
  104. FW_DEFINE_AUTO_TEMPLATE(FW_TOrderedCollection, FW_CPrivDisplayFrame)
  105.  
  106. #ifdef FW_USE_TEMPLATE_PRAGMAS
  107.  
  108. #pragma template_access public
  109. #pragma template FW_TOrderedCollection<FW_CPresentation>
  110. #pragma template FW_TOrderedCollectionIterator<FW_CPresentation>
  111. #pragma template FW_TOrderedCollection<FW_CPrivDisplayFrame>
  112. #pragma template FW_TOrderedCollectionIterator<FW_CPrivDisplayFrame>
  113.  
  114. #endif
  115.  
  116. //========================================================================================
  117. //    class FW_CPrivDisplayFrame
  118. //========================================================================================
  119.  
  120. //----------------------------------------------------------------------------------------
  121. //    FW_CPrivDisplayFrame::FW_CPrivDisplayFrame
  122. //----------------------------------------------------------------------------------------
  123.  
  124. FW_CPrivDisplayFrame::FW_CPrivDisplayFrame(Environment *ev, FW_CFrame* frame) :
  125.     fFrameID(frame->GetID(ev)),
  126.     fODFrame(frame->GetODFrame(ev)),
  127.     fFrame(frame)
  128. {
  129.     fODFrame->Acquire(ev);
  130.     fODFrame->SetPartInfo(ev, (ODInfoType)frame);
  131. }
  132.  
  133. //----------------------------------------------------------------------------------------
  134. //    FW_CPrivDisplayFrame::FW_CPrivDisplayFrame
  135. //----------------------------------------------------------------------------------------
  136.  
  137. FW_CPrivDisplayFrame::FW_CPrivDisplayFrame(Environment *ev, ODID frameID) :
  138.     fFrameID(frameID),
  139.     fODFrame(NULL),
  140.     fFrame(NULL)
  141. {
  142. FW_UNUSED(ev);
  143. }
  144.  
  145. //----------------------------------------------------------------------------------------
  146. //    FW_CPrivDisplayFrame::~FW_CPrivDisplayFrame
  147. //----------------------------------------------------------------------------------------
  148.  
  149. FW_CPrivDisplayFrame::~FW_CPrivDisplayFrame()
  150. {
  151.     FW_SOMEnvironment ev;
  152.     Release(ev);
  153. }
  154.  
  155. //----------------------------------------------------------------------------------------
  156. //    FW_CPrivDisplayFrame::Release
  157. //----------------------------------------------------------------------------------------
  158.  
  159. void FW_CPrivDisplayFrame::Release(Environment *ev)
  160. {
  161.     if (fODFrame)
  162.     {
  163.         fODFrame->SetPartInfo(ev, NULL);
  164.         fODFrame->Release(ev);
  165.         fODFrame = NULL;
  166.     }
  167. }
  168.  
  169. //========================================================================================
  170. //    class FW_CPresentation
  171. //========================================================================================
  172.  
  173. //----------------------------------------------------------------------------------------
  174. //    FW_CPresentation::FW_CPresentation
  175. //----------------------------------------------------------------------------------------
  176.  
  177. FW_CPresentation::FW_CPresentation(Environment *ev, 
  178.                                 FW_CPart* thePart, 
  179.                                 FW_CSelection* selection,
  180.                                 ODTypeToken presentationType,
  181.                                 FW_ResourceID viewResourceID,
  182.                                 FW_ResourceID rootViewResourceID) :
  183.     fPart(thePart),
  184.     fFrames(NULL),
  185.     fSelection(selection),
  186.     fPresentationType(presentationType),
  187.     fFocusSet(NULL),
  188.     fViewAsThumbnail(NULL),
  189.     fViewAsSmallIcon(NULL),
  190.     fViewAsLargeIcon(NULL),
  191.     fDefaultEmbeddedFrameViewType(FW_CPart::fgViewAsFrameToken),
  192.     fDragPending(FALSE),
  193.     fViewResourceID(viewResourceID),
  194.     fRootViewResourceID(rootViewResourceID)
  195. {
  196.     FW_ASSERT(thePart);
  197.     
  198.     fFrames = FW_NEW(FW_TOrderedCollection<FW_CPrivDisplayFrame>, ());
  199.  
  200.     // ----- By default add all common foci to the presentation
  201.     //         (floating windows & dialogs will updated later)
  202.     fFocusSet = FW_CSession::GetArbitrator(ev)->CreateFocusSet(ev);
  203.     fFocusSet->Add(ev, FW_CPart::fgKeyFocusToken);
  204.     fFocusSet->Add(ev, FW_CPart::fgMenuFocusToken);
  205.     fFocusSet->Add(ev, FW_CPart::fgSelectionFocusToken);
  206.     fFocusSet->Add(ev, FW_CPart::fgClipboardFocusToken);
  207. }
  208.  
  209. //----------------------------------------------------------------------------------------
  210. //    FW_CPresentation::~FW_CPresentation
  211. //----------------------------------------------------------------------------------------
  212.  
  213. FW_CPresentation::~FW_CPresentation()
  214. {
  215.     FW_ASSERT(fViewAsThumbnail == NULL);        // Should already have been released
  216.     FW_ASSERT(fViewAsSmallIcon == NULL);        // Should already have been released
  217.     FW_ASSERT(fViewAsLargeIcon == NULL);        // Should already have been released
  218.  
  219.     delete fSelection;
  220.     
  221.     FW_SOMEnvironment ev;
  222.     
  223.     if (fFrames != NULL)
  224.     {
  225.         FW_CPrivDisplayFrame* displayFrame;
  226.         while ((displayFrame = fFrames->First()) != NULL)
  227.             PrivDeleteDisplayFrame(ev, displayFrame);
  228.         
  229.         delete fFrames;
  230.     }
  231.  
  232.     delete fFocusSet;
  233. }
  234.  
  235. //----------------------------------------------------------------------------------------
  236. //    FW_CPresentation::Invalidate
  237. //----------------------------------------------------------------------------------------
  238. // invalidShape should be in content coordinates
  239.  
  240. void FW_CPresentation::Invalidate(Environment *ev, ODShape* invalidShape, ODID sequenceNumber)
  241. {
  242.     FW_CPresentationFrameIterator ite(ev, this);
  243.     for (FW_CFrame* frame = ite.First(ev); ite.IsNotComplete(ev); frame = ite.Next(ev))
  244.     {
  245.         if (sequenceNumber == 0 || sequenceNumber == frame->GetSequenceNumber(ev))
  246.         {
  247.             FW_CAcquiredODShape aqInvalidShape;
  248.             if (invalidShape != NULL)
  249.             {
  250.                 FW_CAcquiredODTransform aqInternalTransform = frame->AcquireInternalTransform(ev, NULL);
  251.                 aqInvalidShape = invalidShape->Copy(ev);
  252.                 aqInvalidShape->Transform(ev, aqInternalTransform);
  253.             }
  254.             
  255.             frame->GetODFrame(ev)->Invalidate(ev, aqInvalidShape, NULL);        // if aqInvalidShape is NULL OpenDoc will use the aggregate
  256.                                                                                 // clip shape
  257.         }
  258.     }
  259. }
  260.  
  261. //----------------------------------------------------------------------------------------
  262. //    FW_CPresentation::Validate
  263. //----------------------------------------------------------------------------------------
  264. // validShape should be in content coordinates
  265.  
  266. void FW_CPresentation::Validate(Environment *ev, ODShape* validShape, ODID sequenceNumber)
  267. {
  268.     FW_CPresentationFrameIterator ite(ev, this);
  269.     for (FW_CFrame* frame = ite.First(ev); ite.IsNotComplete(ev); frame = ite.Next(ev))
  270.     {
  271.         if (sequenceNumber == 0 || sequenceNumber == frame->GetSequenceNumber(ev))
  272.         {
  273.             FW_CAcquiredODShape aqValidShape;
  274.             if (validShape != NULL)
  275.             {
  276.                 FW_CAcquiredODTransform aqInternalTransform = frame->AcquireInternalTransform(ev, NULL);
  277.                 aqValidShape = validShape->Copy(ev);
  278.                 aqValidShape->Transform(ev, aqInternalTransform);
  279.             }
  280.             
  281.             frame->GetODFrame(ev)->Validate(ev, aqValidShape, NULL);        // if aqInvalidShape is NULL OpenDoc will use the aggregate
  282.                                                                             // clip shape
  283.         }
  284.     }
  285. }
  286.  
  287. //----------------------------------------------------------------------------------------
  288. //    FW_CPresentation::Invalidate
  289. //----------------------------------------------------------------------------------------
  290. // invalidRect should be in content coordinates
  291.  
  292. void FW_CPresentation::Invalidate(Environment* ev, const FW_CRect& invalidRect, ODID sequenceNumber)
  293. {
  294.     FW_CAcquiredODShape aqShape = ::FW_NewODShape(ev, invalidRect);
  295.     Invalidate(ev, aqShape, sequenceNumber);
  296. }
  297.  
  298. //----------------------------------------------------------------------------------------
  299. //    FW_CPresentation::Validate
  300. //----------------------------------------------------------------------------------------
  301. // validRect should be in content coordinates
  302.  
  303. void FW_CPresentation::Validate(Environment* ev, const FW_CRect& validRect, ODID sequenceNumber)
  304. {
  305.     FW_CAcquiredODShape aqShape = ::FW_NewODShape(ev, validRect);
  306.     Validate(ev, aqShape, sequenceNumber);
  307. }
  308.  
  309. //----------------------------------------------------------------------------------------
  310. //    FW_CPresentation::ContentUpdated
  311. //------------------------------------------------------------------------
  312.  
  313. void FW_CPresentation::ContentUpdated(Environment* ev, ODUpdateID updateID)
  314. {
  315.     // When ContentUpdated is called because of updating a link, a change ID is supplied.
  316.     // Otherwise, we need to create a unique change ID -
  317.     if (updateID == kODUnknownUpdate)
  318.         updateID = FW_CSession::UniqueUpdateID(ev);
  319.  
  320.     FW_CPresentationFrameIterator ite(ev, this);
  321.     for (FW_CFrame* frame = ite.First(ev); ite.IsNotComplete(ev); frame = ite.Next(ev))
  322.     {
  323.         frame->GetODFrame(ev)->ContentUpdated(ev, updateID);
  324.     }
  325. }
  326.  
  327. //----------------------------------------------------------------------------------------
  328. //    FW_CPresentation::PrivAddFrame
  329. //----------------------------------------------------------------------------------------
  330.  
  331. void FW_CPresentation::PrivAddFrame(Environment *ev, FW_CFrame* frame)
  332. {    
  333.     fFrames->AddLast(new FW_CPrivDisplayFrame(ev, frame));
  334. }
  335.  
  336. //----------------------------------------------------------------------------------------
  337. //    FW_CPresentation::PrivGetDisplayFrame
  338. //----------------------------------------------------------------------------------------
  339.  
  340. FW_CPrivDisplayFrame* FW_CPresentation::PrivGetDisplayFrame(FW_CFrame* frame) const
  341. {
  342.     FW_TOrderedCollectionIterator<FW_CPrivDisplayFrame> ite(fFrames);
  343.     for (FW_CPrivDisplayFrame* displayFrame = ite.First(); ite.IsNotComplete(); displayFrame = ite.Next())
  344.     {
  345.         if (displayFrame->fFrame == frame)
  346.             return displayFrame;
  347.     }
  348.     
  349.     return NULL;
  350. }
  351.  
  352. //----------------------------------------------------------------------------------------
  353. //    FW_CPresentation::PrivDeleteDisplayFrame
  354. //----------------------------------------------------------------------------------------
  355.  
  356. void FW_CPresentation::PrivDeleteDisplayFrame(Environment *ev, FW_CPrivDisplayFrame* displayFrame)
  357. {
  358. FW_UNUSED(ev);
  359.  
  360.     // ----- First Remove it from the list -----
  361.     fFrames->Remove(displayFrame);
  362.     
  363.     // ----- Now I can delete it
  364.     delete displayFrame;
  365. }
  366.  
  367. //----------------------------------------------------------------------------------------
  368. //    FW_CPresentation::ChangeAllFramesPresentation
  369. //----------------------------------------------------------------------------------------
  370.  
  371. void FW_CPresentation::ChangeAllFramesPresentation(Environment *ev, FW_CPresentation* newPresentation) const
  372. {
  373.     if (this == newPresentation)
  374.         return;
  375.         
  376.     FW_CPrivDisplayFrame* displayFrame = fFrames->First();
  377.     while (displayFrame != NULL)
  378.     {
  379.         FW_CFrame* theFrame = displayFrame->fFrame;
  380.         if (theFrame != NULL)
  381.             theFrame->ChangePresentation(ev, newPresentation);
  382.             
  383.         displayFrame = fFrames->First();
  384.     }
  385. }
  386.  
  387. //----------------------------------------------------------------------------------------
  388. //    FW_CPresentation::ReleaseAll
  389. //----------------------------------------------------------------------------------------
  390.  
  391. void FW_CPresentation::ReleaseAll(Environment *ev)
  392. {
  393.     FW_TOrderedCollectionIterator<FW_CPrivDisplayFrame> ite(fFrames);
  394.     for (FW_CPrivDisplayFrame* displayFrame = ite.First(); ite.IsNotComplete(); displayFrame = ite.Next())
  395.     {
  396.         displayFrame->Release(ev);
  397.     }
  398. }
  399.  
  400. //----------------------------------------------------------------------------------------
  401. //    FW_CPresentation::PrivRemoveFrame
  402. //----------------------------------------------------------------------------------------
  403. // Used in ChangePresentation
  404.  
  405. void FW_CPresentation::PrivRemoveFrame(Environment *ev, FW_CFrame* frame)
  406. {
  407. FW_UNUSED(ev);
  408.  
  409.     // ----- Remove it from the list -----
  410.     FW_CPrivDisplayFrame* displayFrame = PrivGetDisplayFrame(frame);
  411.     FW_ASSERT(displayFrame);
  412.     
  413.     PrivDeleteDisplayFrame(ev, displayFrame);
  414. }
  415.  
  416. //----------------------------------------------------------------------------------------
  417. //    FW_CPresentation::PrivFrameRemoved
  418. //----------------------------------------------------------------------------------------
  419.  
  420. void FW_CPresentation::PrivFrameRemoved(Environment *ev, FW_CFrame* frame, FW_Boolean toStorage)
  421. {
  422.     FW_Boolean wasLastActive = (fPart->GetLastActiveFrame(ev) == frame);
  423.     
  424.     // ----- Notify the frame -----
  425.     frame->FrameRemoved(ev, toStorage);
  426.     
  427.     // ----- Remove it from the list -----
  428.     FW_CPrivDisplayFrame* displayFrame = PrivGetDisplayFrame(frame);
  429.     FW_ASSERT(displayFrame);
  430.  
  431.     PrivDeleteDisplayFrame(ev, displayFrame);
  432.  
  433.     // ----- delete it if not shared -----
  434.     if (!frame->PrivInSharedWindow(ev))
  435.         delete frame;
  436.     
  437.     // ----- Set the last active frame to the first frame of this presentation -----    
  438.     if (wasLastActive)
  439.     {
  440.         FW_CPrivDisplayFrame* displayFrame = fFrames->First();
  441.         fPart->PrivSetLastActiveFrame(displayFrame ? displayFrame->fFrame : NULL);
  442.     }
  443. }
  444.  
  445. //----------------------------------------------------------------------------------------
  446. //    FW_CPresentation::CountFrame
  447. //----------------------------------------------------------------------------------------
  448.  
  449. unsigned long FW_CPresentation::CountFrame(Environment *ev) const
  450. {
  451. FW_UNUSED(ev);
  452.     return fFrames->Count();
  453. }
  454.  
  455. //----------------------------------------------------------------------------------------
  456. //    FW_CPresentation::RemoveSiblingFrame
  457. //----------------------------------------------------------------------------------------
  458.  
  459. void FW_CPresentation::RemoveSiblingFrame(Environment* ev, FW_CFrame* frameToRemove)
  460. {
  461.     FW_ASSERT(frameToRemove->IsRequestedFrame(ev));    // Cannot remove a frame not requested
  462.     
  463.     FW_CAcquiredODFrame embeddingFrame = frameToRemove->AcquireContainingFrame(ev);
  464.     FW_CAcquiredODPart embeddingPart = embeddingFrame->AcquirePart(ev);
  465.     
  466.     embeddingPart->RemoveEmbeddedFrame(ev, frameToRemove->GetODFrame(ev));
  467. }
  468.  
  469. //----------------------------------------------------------------------------------------
  470. //    FW_CPresentation::RequestSiblingFrame
  471. //----------------------------------------------------------------------------------------
  472. //    returns kODNULLID if the request was not fulfilled
  473.  
  474. ODID FW_CPresentation::RequestSiblingFrame(Environment* ev,
  475.                                             FW_CFrame* baseFrame, 
  476.                                             ODShape* suggestedFrameShape,
  477.                                             ODTypeToken viewType,
  478.                                             FW_Boolean isOverlaid)
  479. {
  480.     FW_CAcquiredODFrame embeddingFrame = baseFrame->AcquireContainingFrame(ev);
  481.     FW_CAcquiredODPart embeddingPart = embeddingFrame->AcquirePart(ev);
  482.     
  483.     FW_CAcquiredODShape frameShape = suggestedFrameShape->Copy(ev);
  484.     FW_CAcquiredODFrame newFrame = embeddingPart->RequestEmbeddedFrame(ev,
  485.                                                                         embeddingFrame,
  486.                                                                         baseFrame->GetODFrame(ev),
  487.                                                                         frameShape,
  488.                                                                         fPart->GetODPart(ev),
  489.                                                                         viewType,
  490.                                                                         fPresentationType,
  491.                                                                         isOverlaid);
  492.     ODID newSequence = kODNULLID;
  493.     
  494.     if (newFrame != NULL)
  495.     {
  496.         FW_CFrame* fwFrame = FW_CFrame::ODtoFWFrame(ev, newFrame);
  497.         
  498.         ODID newFrameGroup = fwFrame->GetFrameGroup(ev);
  499.         newSequence = fwFrame->GetSequenceNumber(ev);
  500.     
  501.         // ----- Set the RequestedFrame flag -----
  502.         FW_CPresentationFrameIterator ite(ev, this, newFrameGroup, newSequence);
  503.         for (FW_CFrame* aFrame = ite.First(ev); ite.IsNotComplete(ev); aFrame =  ite.Next(ev))
  504.         {
  505.             aFrame->PrivSetRequestedFrame(ev);
  506.         }    
  507.     }
  508.     
  509.     return newSequence;
  510. }
  511.  
  512. //----------------------------------------------------------------------------------------
  513. // FW_CPresentation::PrivAcquireViewAs
  514. //----------------------------------------------------------------------------------------
  515.  
  516. FW_CViewAs* FW_CPresentation::PrivAcquireViewAs(Environment* ev, FW_CFrame* frame, ODTypeToken viewAsToken)
  517. {
  518.     FW_ASSERT(viewAsToken == FW_CPart::fgViewAsThumbnailToken ||
  519.             viewAsToken == FW_CPart::fgViewAsSmallIconToken ||
  520.             viewAsToken == FW_CPart::fgViewAsLargeIconToken);
  521.             
  522.     FW_CViewAs** viewAsPtr = NULL;    
  523.     
  524.     if (viewAsToken == FW_CPart::fgViewAsThumbnailToken)
  525.         viewAsPtr = &fViewAsThumbnail;
  526.     else if (viewAsToken == FW_CPart::fgViewAsSmallIconToken)
  527.         viewAsPtr = &fViewAsSmallIcon;
  528.     else
  529.         viewAsPtr = &fViewAsLargeIcon;
  530.  
  531.     if ((*viewAsPtr) != NULL)
  532.         (*viewAsPtr)->Acquire();
  533.     else
  534.         (*viewAsPtr) = frame->NewViewAs(ev, viewAsToken);
  535.  
  536.     (*viewAsPtr)->Load(ev, frame);
  537.     
  538.     return (*viewAsPtr);
  539. }
  540.  
  541. //----------------------------------------------------------------------------------------
  542. // FW_CPresentation::PrivReleaseViewAs
  543. //----------------------------------------------------------------------------------------
  544.  
  545. void FW_CPresentation::PrivReleaseViewAs(FW_CViewAs* viewAs)
  546. {
  547.     FW_ASSERT(viewAs == fViewAsThumbnail || viewAs == fViewAsSmallIcon || viewAs == fViewAsLargeIcon);
  548.     
  549.     if (viewAs->Release() == 0)
  550.     {
  551.         if (viewAs == fViewAsThumbnail)
  552.             fViewAsThumbnail = NULL;
  553.         else if (viewAs == fViewAsSmallIcon)
  554.             fViewAsSmallIcon = NULL;
  555.         else
  556.             fViewAsLargeIcon = NULL;
  557.     }
  558. }
  559.  
  560. //----------------------------------------------------------------------------------------
  561. //    FW_CPresentation::UpdateViewAs
  562. //----------------------------------------------------------------------------------------
  563.  
  564. void FW_CPresentation::UpdateViewAs(Environment* ev)
  565. {
  566.     if (fViewAsThumbnail != NULL)
  567.         fViewAsThumbnail->Unload(ev);
  568.     
  569.     if (fViewAsSmallIcon != NULL)
  570.         fViewAsSmallIcon->Unload(ev);
  571.     
  572.     if (fViewAsLargeIcon != NULL)
  573.         fViewAsSmallIcon->Unload(ev);
  574. }
  575.  
  576. //----------------------------------------------------------------------------------------
  577. //    FW_CPresentation::AdoptFocusSet
  578. //----------------------------------------------------------------------------------------
  579. //    Pass NULL to create an empty focus Set
  580.  
  581. void FW_CPresentation::AdoptFocusSet(Environment* ev, ODFocusSet* newFocusSet)
  582. {
  583. #ifdef FW_DEBUG
  584.     // No frame should be active when changing the focus set because it is used
  585.     // during activation/deactivation
  586.     FW_CPresentationFrameIterator ite(ev, this);
  587.     for (FW_CFrame* aFrame = ite.First(ev); ite.IsNotComplete(ev); aFrame =  ite.Next(ev))
  588.     {
  589.         FW_ASSERT(aFrame->HasSelectionFocus(ev) == FALSE);
  590.     }
  591. #endif
  592.     
  593.     // ----- Test first that we are not reassigning the same one -----
  594.     if (newFocusSet != fFocusSet)
  595.     {
  596.         delete fFocusSet;
  597.         fFocusSet = NULL;
  598.     }
  599.     
  600.     if (newFocusSet)
  601.         fFocusSet = newFocusSet;
  602.     else
  603.         fFocusSet = FW_CSession::GetArbitrator(ev)->CreateFocusSet(ev);    // Empty focus set
  604. }
  605.  
  606. //----------------------------------------------------------------------------------------
  607. //    FW_CPresentation::PrivNewFrame
  608. //----------------------------------------------------------------------------------------
  609. //    PrivNewFrame is used internaly for example by the about dialog. Part should never
  610. //    have to subclass FW_CPresentation. Use FW_CPart::NewFrame instead.
  611.  
  612. FW_CFrame* FW_CPresentation::PrivNewFrame(Environment *ev,
  613.                                         ODFrame* odFrame, 
  614.                                         FW_Boolean fromStorage)
  615. {
  616. FW_UNUSED(ev);
  617. FW_UNUSED(odFrame);
  618. FW_UNUSED(fromStorage);
  619.     return NULL;
  620. }