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 / Embed / Sources / Select.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.6 KB  |  128 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Select.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                M.Boetcher
  7. //
  8. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "Embed.hpp"
  13.  
  14. #ifndef SELECT_H
  15. #include "Select.h"
  16. #endif
  17.  
  18. #ifndef PROXY_H
  19. #include "Proxy.h"
  20. #endif
  21.  
  22. #ifndef CONTENT_H
  23. #include "Content.h"
  24. #endif
  25.  
  26. // ----- Framework Includes -----
  27.  
  28. #ifndef FWPRESEN_H
  29. #include "FWPresen.h"
  30. #endif
  31.  
  32. //========================================================================================
  33. //    Runtime information
  34. //========================================================================================
  35.  
  36. #ifdef FW_BUILD_MAC
  37. #pragma segment odfembed
  38. #endif
  39.  
  40. FW_DEFINE_AUTO(CEmbedSelection)
  41.  
  42. //========================================================================================
  43. //    CLASS CEmbedSelection
  44. //========================================================================================
  45.  
  46. //---------------------------------------------------------------------------------------
  47. //    CEmbedSelection constructor
  48. //---------------------------------------------------------------------------------------
  49.  
  50. CEmbedSelection::CEmbedSelection(Environment* ev, CEmbedContent* content) :
  51.     FW_CSelection(ev, false, false),
  52.     fContent(content)
  53. {
  54. }
  55.  
  56. //---------------------------------------------------------------------------------------
  57. //    CEmbedSelection destructor
  58. //---------------------------------------------------------------------------------------
  59.  
  60. CEmbedSelection::~CEmbedSelection()
  61. {
  62. }
  63.  
  64. //---------------------------------------------------------------------------------------
  65. //    CEmbedSelection::CloseSelection
  66. //---------------------------------------------------------------------------------------
  67.  
  68. void CEmbedSelection::CloseSelection(Environment* ev)
  69. {
  70. FW_UNUSED(ev);
  71.     // Nothing to do
  72. }
  73.  
  74. //---------------------------------------------------------------------------------------
  75. //    CEmbedSelection::ClearSelection
  76. //---------------------------------------------------------------------------------------
  77.  
  78. void CEmbedSelection::ClearSelection(Environment* ev)
  79. {
  80.     CEmbedProxy* proxy = fContent->GetProxy();
  81.  
  82.     if (proxy)    // there is an embedded part - don't delete it, because this action might be undone
  83.     {
  84.         proxy->SetSelectState(ev, false);
  85.         proxy->DetachEmbeddedFrames(ev);
  86.         fContent->SetProxy(NULL);
  87.         GetPresentation(ev)->Invalidate(ev);
  88.     }
  89. }
  90.  
  91. //---------------------------------------------------------------------------------------
  92. //    CEmbedSelection::SelectAll
  93. //---------------------------------------------------------------------------------------
  94.  
  95. void CEmbedSelection::SelectAll(Environment* ev)
  96. {
  97. FW_UNUSED(ev);
  98.     // Nothing to do
  99. }
  100.  
  101. //---------------------------------------------------------------------------------------
  102. //    CEmbedSelection::IsEmpty
  103. //---------------------------------------------------------------------------------------
  104.  
  105. FW_Boolean CEmbedSelection::IsEmpty(Environment* ev) const
  106. {
  107. FW_UNUSED(ev);
  108.     return (fContent->GetProxy() == NULL);
  109. }
  110.  
  111. //---------------------------------------------------------------------------------------
  112. //    CEmbedSelection::GetSelectedContent
  113. //---------------------------------------------------------------------------------------
  114.  
  115. FW_CContent* CEmbedSelection::GetSelectedContent(Environment* ev)
  116. {
  117. FW_UNUSED(ev);
  118.     return fContent;
  119. }
  120.  
  121. #pragma segment Main
  122. FW_Boolean  CEmbedSelection::CanPasteAsLink(Environment*,  ODPasteAsMergeSetting& setting,  ODStorageUnit* )
  123. {
  124.     setting = kODPasteAsEmbedOnly;
  125.     return fAllowLink;
  126. }
  127.  
  128.