home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Table / Sources / TblPart.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  18.8 KB  |  680 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                TblPart.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "Table.hpp"
  11.  
  12. // ----- TablePart Includes -----
  13.  
  14. #ifndef TBLPART_H
  15. #include "TblPart.h"
  16. #endif
  17.  
  18. #ifndef TBLFRAME_H
  19. #include "TblFrame.h"
  20. #endif
  21.  
  22. #ifndef TBLPROXY_H
  23. #include "TblProxy.h"
  24. #endif
  25.  
  26. #ifndef TBLSEL_H
  27. #include "TblSel.h"
  28. #endif
  29.  
  30. #ifndef SOM_ODFExamples_ODFTableEmbeddedFramesIterator_xh
  31. #include "SOMIter.xh"
  32. #endif
  33.  
  34. #ifndef TBLLINK_H
  35. #include "TblLink.h"
  36. #endif
  37.  
  38. // ----- Part Layer -----
  39.  
  40. #ifndef FWFRAME_H
  41. #include "FWFrame.h"
  42. #endif
  43.  
  44. #ifndef FWFCTCLP_H
  45. #include "FWFctClp.h"
  46. #endif
  47.  
  48. #ifndef FWPRTITE_H
  49. #include "FWPrtIte.h"
  50. #endif
  51.  
  52. #ifndef FWDRCMD_H
  53. #include "FWDrCmd.h"
  54. #endif
  55.  
  56. #ifndef FWUTIL_H
  57. #include "FWUtil.h"
  58. #endif
  59.  
  60. // ----- OS Layer -----
  61.  
  62. #ifndef FWACQUIR_H
  63. #include "FWAcquir.h"
  64. #endif
  65.  
  66. #ifndef FWEVENT_H
  67. #include "FWEvent.h"
  68. #endif
  69.  
  70. #ifndef FWMENU_H
  71. #include "FWMenu.h"
  72. #endif
  73.  
  74. #ifndef FWPOINT_H
  75. #include "FWPoint.h"
  76. #endif
  77.  
  78. #ifndef FWRECT_H
  79. #include "FWRect.h"
  80. #endif
  81.  
  82. #ifndef FWSUSINK_H
  83. #include "FWSUSink.h"
  84. #endif
  85.  
  86. #ifndef FWODGEOM_H
  87. #include "FWODGeom.h"
  88. #endif
  89.  
  90. #ifndef FWBARRAY_H
  91. #include "FWBArray.h"
  92. #endif
  93.  
  94. #ifndef FWCFMRES_H
  95. #include "FWCFMRes.h"
  96. #endif
  97.  
  98. // ----- ODUtil -----
  99.  
  100. #ifndef FWORDCOL_H
  101. #include "FWOrdCol.h"
  102. #endif
  103.  
  104. // ----- Foundation Layer -----
  105.  
  106. #ifndef FWSTRING_H
  107. #include "FWString.h"
  108. #endif
  109.  
  110. #ifndef FWEXCDEF_H
  111. #include "FWExcDef.h"
  112. #endif
  113.  
  114. // ----- OpenDoc Includes -----
  115.  
  116. #ifndef _ODTYPES_
  117. #include <ODTypes.h>
  118. #endif
  119.  
  120. #ifndef SOM_ODArbitrator_xh
  121. #include <Arbitrat.xh>
  122. #endif
  123.  
  124. #ifndef SOM_ODMenuBar_xh
  125. #include <MenuBar.xh>
  126. #endif
  127.  
  128. #ifndef SOM_ODShape_xh
  129. #include <Shape.xh>
  130. #endif
  131.  
  132. #ifndef SOM_Module_OpenDoc_StdProps_defined
  133. #include <StdProps.xh>
  134. #endif
  135.  
  136. #ifndef SOM_Module_OpenDoc_StdTypes_defined
  137. #include <StdTypes.xh>
  138. #endif
  139.  
  140. #ifndef SOM_ODStorageUnit_xh
  141. #include <StorageU.xh>
  142. #endif
  143.  
  144. #ifndef SOM_ODTransform_xh
  145. #include <Trnsform.xh>
  146. #endif
  147.  
  148. #ifndef SOM_ODSession_xh
  149. #include <ODSessn.xh>
  150. #endif
  151.  
  152. //========================================================================================
  153. // RunTime Info
  154. //========================================================================================
  155.  
  156. #ifdef FW_BUILD_MAC
  157. #pragma segment odfTable
  158. #endif
  159.  
  160. //========================================================================================
  161. //    Globals
  162. //========================================================================================
  163.  
  164. const ODValueType CTablePart::kPartKind = kODFTableKind;
  165. const ODValueType CTablePart::kPartUserName = kODFTableEditorUserString;
  166.  
  167. //========================================================================================
  168. //    class CTablePart
  169. //========================================================================================
  170.  
  171. //----------------------------------------------------------------------------------------
  172. //    CTablePart::CTablePart
  173. //----------------------------------------------------------------------------------------
  174.  
  175. CTablePart::CTablePart(ODPart* odPart) :
  176.     FW_CEmbeddingPart(odPart, CTablePart::kPartKind, CTablePart::kPartUserName, FW_gInstance, kPartIconID),
  177.     fProxys(NULL),
  178.     fTableLinkManager(NULL),
  179.     fSubscribersRegistered(FALSE)
  180. {
  181. }
  182.  
  183. //----------------------------------------------------------------------------------------
  184. //    CTablePart::~CTablePart
  185. //----------------------------------------------------------------------------------------
  186.  
  187. CTablePart::~CTablePart()
  188. {
  189.     if (fProxys)
  190.     {
  191.         CTableProxy* proxy;
  192.         while ((proxy = (CTableProxy*)fProxys->First()) != NULL)
  193.         {
  194.             fProxys->Remove(proxy);
  195.             delete proxy;
  196.         }        
  197.     }
  198.         
  199.     delete fProxys;
  200. }
  201.  
  202. //----------------------------------------------------------------------------------------
  203. //    CTablePart::Initialize
  204. //----------------------------------------------------------------------------------------
  205.  
  206. void CTablePart::Initialize(Environment* ev)
  207. {
  208.     // ----- Call Inherited Initialize -----
  209.     FW_CEmbeddingPart::Initialize(ev);
  210.  
  211.     // ----- Register Presentation -----
  212.     fTablePresentation = RegisterPresentation(ev, "Apple:Presentation:ODFTable", TRUE, new CTableSelection(ev, this));
  213.     
  214.     // ----- Create list of proxies -----
  215.     fProxys = new FW_CPrivOrderedCollection;
  216.  
  217.     // ----- Build Table menu -----
  218.     InitializeMenuBar(ev, this->GetMenuBar(ev));
  219.     
  220.     fCells.fX = kMaxCols;
  221.     fCells.fY = kMaxRows;
  222.     
  223.     // ----- Initialize arrays
  224.     unsigned long s;
  225.     for(s=0; s < kMaxCols; s++)
  226.         fWidth[s] = kDefaultCellWidth;
  227.     for(s=0; s < kMaxRows; s++)
  228.         fHeight[s] = kDefaultCellHeight;
  229. }
  230.  
  231. //------------------------------------------------------------------------------
  232. //    CTablePart::InitializeMenuBar
  233. //------------------------------------------------------------------------------
  234.  
  235. void CTablePart::InitializeMenuBar(Environment *ev, FW_CMenuBar *menuBar)
  236. {
  237.     FW_CSharedLibraryResourceFile resFile;    // Open the resource file of this shared library
  238.  
  239. #ifdef FW_BUILD_WIN
  240.     // [HLX] Temporary embed menu for windows
  241.     WinAddEmbedMenu(ev, menuBar);
  242. #endif
  243.  
  244.     FW_CPullDownMenu* tableMenu = new FW_CPullDownMenu(ev, resFile, kMenuStrings, kTableStr);
  245.     tableMenu->AppendToggleItem(ev, resFile, kMenuStrings, kHideGridStr, kShowGridStr, cHideShowGrid);    
  246.     menuBar->AdoptMenuLast(ev, tableMenu);
  247. }
  248.  
  249. //----------------------------------------------------------------------------------------
  250. //    CTablePart::ExternalizeContent
  251. //----------------------------------------------------------------------------------------
  252.  
  253. void CTablePart::ExternalizeContent(Environment *ev, ODStorageUnit* su, FW_CCloneInfo* cloneInfo)
  254. {
  255.     ODValueType propertyValueType = this->GetPartKind(ev);
  256.     su->Focus(ev, kODPropContents, kODPosUndefined, propertyValueType, 0, kODPosUndefined);
  257.     su->Remove(ev);
  258.     su->AddValue(ev, propertyValueType);
  259.     
  260.     // ---- Write out grid info ----
  261.     FW_CStorageUnitSink sink(su, kODPropContents, propertyValueType);
  262.     FW_CWritableStream archive(&sink);
  263.  
  264.     archive << fCells.fX;
  265.     archive << fCells.fY;
  266.     archive.Write(fWidth, fCells.fX);
  267.     archive.Write(fHeight, fCells.fY);
  268.  
  269.     // ---- Write number of embedded parts ----
  270.     unsigned long partCount = fProxys->Count();
  271.     archive << partCount;
  272.  
  273.     // ---- Write out embedded parts ----
  274.     if (partCount > 0)
  275.     {
  276.         FW_COrderedCollectionIterator iter(fProxys);
  277.         for (CTableProxy* proxy = (CTableProxy*)iter.First(); iter.IsNotComplete(); proxy = (CTableProxy*)iter.Next())
  278.         {
  279.             CCell cell = proxy->GetCell();
  280.             archive << cell.fX;
  281.             archive << cell.fY;
  282.             proxy->Externalize(ev, sink.GetStorageUnitView(), cloneInfo);
  283.         }
  284.     }
  285.  
  286.     //--- Write source and destination links, if any ---
  287.     fTableLinkManager->ExternalizeLinks(ev, sink.GetStorageUnitView(), cloneInfo);
  288. }
  289.  
  290. //----------------------------------------------------------------------------------------
  291. //    CTablePart::InternalizeContent
  292. //----------------------------------------------------------------------------------------
  293.  
  294. void CTablePart::InternalizeContent(Environment* ev, ODStorageUnit* su, FW_CCloneInfo* cloneInfo)
  295. {
  296.     // ---- Read grid info -----
  297.     FW_CStorageUnitSink sink(su, kODPropContents, this->GetPartKind(ev));
  298.     FW_CReadableStream archive(&sink);
  299.  
  300.     archive >> fCells.fX;
  301.     archive >> fCells.fY;
  302.  
  303.     FW_ASSERT(fCells.fX == kMaxCols);
  304.     archive.Read(fWidth, fCells.fX);
  305.  
  306.     FW_ASSERT(fCells.fY == kMaxRows);
  307.     archive.Read(fHeight, fCells.fY);
  308.  
  309.     // ---- Read number of embedded parts ----
  310.     unsigned long partCount;
  311.     archive >> partCount;
  312.  
  313.     // ---- Read embedded parts ----
  314.     CCell cell;
  315.     CTableProxy* proxy;
  316.     for (unsigned long i = 0; i < partCount; i++)
  317.     {
  318.         archive >> cell.fX;
  319.         archive >> cell.fY;
  320.         proxy = new CTableProxy(ev, this, fTablePresentation);
  321.         proxy->SetCell(cell);
  322.         proxy->Internalize(ev, sink.GetStorageUnitView(), cloneInfo);        // read part and embed it
  323.         this->AddProxy(proxy);
  324.     }
  325.  
  326.     // ----- Read link information -----
  327.     fTableLinkManager->InternalizeLinks(ev, su);
  328. }
  329.  
  330. //----------------------------------------------------------------------------------------
  331. //    CTablePart::NewFrame
  332. //----------------------------------------------------------------------------------------
  333.  
  334. FW_CFrame* CTablePart::NewFrame(Environment* ev, 
  335.                                 ODFrame* odFrame, 
  336.                                 FW_CPresentation* presentation,
  337.                                 FW_Boolean fromStorage)
  338. {
  339. FW_UNUSED(fromStorage);
  340.  
  341.     return new CTableFrame(ev, odFrame, presentation, this);
  342. }
  343.  
  344. //----------------------------------------------------------------------------------------
  345. //    CTablePart::GetWidth
  346. //----------------------------------------------------------------------------------------
  347.  
  348. FW_CFixed CTablePart::GetWidth(short c) const
  349. {
  350.     return (c < fCells.fX ? fWidth[c] : kDefaultCellWidth);
  351. }
  352.  
  353. //----------------------------------------------------------------------------------------
  354. //    CTablePart::GetHeight
  355. //----------------------------------------------------------------------------------------
  356.  
  357. FW_CFixed CTablePart::GetHeight(short r) const
  358. {
  359.     return (r < fCells.fY ? fHeight[r] : kDefaultCellHeight);
  360. }
  361.  
  362. //----------------------------------------------------------------------------------------
  363. //    CTablePart::SetWidth
  364. //----------------------------------------------------------------------------------------
  365.  
  366. void CTablePart::SetWidth(short c, FW_CFixed w)
  367. {
  368.     FW_ASSERT(c < fCells.fX);
  369.     fWidth[c] = w;
  370. }
  371.  
  372. //----------------------------------------------------------------------------------------
  373. //    CTablePart::SetHeight
  374. //----------------------------------------------------------------------------------------
  375.  
  376. void CTablePart::SetHeight(short r, FW_CFixed h)
  377. {
  378.     FW_ASSERT(r < fCells.fY);
  379.     fHeight[r] = h;
  380. }
  381.  
  382. //----------------------------------------------------------------------------------------
  383. //    CTablePart::HitTest
  384. //----------------------------------------------------------------------------------------
  385.  
  386. ETableLoc CTablePart::HitTest(Environment* ev, 
  387.                               const CTableFrame* frame,
  388.                               const FW_CPoint& where,
  389.                               CCell& cell) const
  390. {
  391.     FW_ASSERT(frame != NULL);
  392.     
  393.     // Verify point is in table area (also exclude the top or left margins)
  394.     FW_CRect rect;
  395.     frame->GetRect(ev, rect);
  396.     
  397.     cell.fX = cell.fY = 0;
  398.  
  399.     if(!rect.Contains(where))
  400.         return kTLNone;
  401.         
  402.     FW_CRect cellRect;
  403.     while (TRUE)
  404.     {
  405.         FindRect(cell, cellRect);
  406.         cellRect.Inset(-kPenWidth, -kPenHeight);
  407.         FW_CPoint testPoint(where.x, cellRect.top);
  408.         if (cellRect.Contains(testPoint))
  409.             break;
  410.         cell.fX += 1;
  411.     } 
  412.     
  413.     while (TRUE)
  414.     {
  415.         FindRect(cell, cellRect);
  416.         cellRect.Inset(-kPenWidth, -kPenHeight);
  417.         FW_CPoint testPoint(cellRect.left, where.y);
  418.         if (cellRect.Contains(testPoint))
  419.             break;
  420.         cell.fY += 1;
  421.     } 
  422.  
  423.     ETableLoc tl = kTLCell;
  424.  
  425.     FindRect(cell, cellRect);
  426.     
  427.     if (where.x <= cellRect.left + kHMargin)
  428.         tl += kTLLeftBorder;
  429.     else if (cellRect.right - kHMargin <= where.x)
  430.         tl += kTLRightBorder;
  431.  
  432.     if (where.y <= cellRect.top + kVMargin)
  433.         tl += kTLTopBorder;
  434.     else if (cellRect.bottom - kVMargin <= where.y)
  435.         tl += kTLBottomBorder;
  436.         
  437.     if (cell.fY == 0 && ((tl & kTLTopBorder) != 0))
  438.         tl = kTLNone;
  439.  
  440.     if (cell.fX == 0 && ((tl & kTLLeftBorder) != 0))
  441.         tl = kTLNone;
  442.             
  443.     return tl;
  444. }
  445.  
  446. //----------------------------------------------------------------------------------------
  447. //    CTablePart::FindLeft
  448. //----------------------------------------------------------------------------------------
  449.  
  450. FW_CFixed CTablePart::FindLeft(short col) const
  451. {
  452.     FW_CFixed x = kHMargin + kBorderWidth;
  453.     for(short c = 0; c < col; c += 1)
  454.         x += this->GetWidth(c) + kBorderWidth;
  455.     return x;
  456. }
  457.  
  458. //----------------------------------------------------------------------------------------
  459. //    CTablePart::FindTop
  460. //----------------------------------------------------------------------------------------
  461.  
  462. FW_CFixed CTablePart::FindTop(short row) const
  463. {
  464.     FW_CFixed y = kVMargin + kBorderHeight;
  465.     for(short r = 0; r < row; r += 1)
  466.         y += this->GetHeight(r) + kBorderWidth;
  467.     return y;
  468. }
  469.  
  470. //----------------------------------------------------------------------------------------
  471. //    CTablePart::FindRect
  472. //----------------------------------------------------------------------------------------
  473.  
  474. void CTablePart::FindRect(const CCell& cell,
  475.                           FW_CRect& rect) const
  476. {
  477.     FW_CFixed x = this->FindLeft(cell.fX);
  478.     FW_CFixed y = this->FindTop (cell.fY);
  479.  
  480.     rect.Set(x, y,
  481.              x + this->GetWidth(cell.fX),
  482.              y + this->GetHeight(cell.fY));
  483. }
  484.  
  485. //----------------------------------------------------------------------------------------
  486. //    CTablePart::CellToProxy
  487. //----------------------------------------------------------------------------------------
  488.  
  489. CTableProxy* CTablePart::CellToProxy(Environment* ev, const CCell& cell) const
  490. {
  491.     FW_COrderedCollectionIterator iter(fProxys);
  492.     for (CTableProxy* proxy = (CTableProxy*)iter.First(); iter.IsNotComplete(); proxy = (CTableProxy*)iter.Next())
  493.     {
  494.         if (proxy->GetCell() == cell)
  495.             return proxy;
  496.     }
  497.  
  498.     return NULL;
  499. }
  500.  
  501. //----------------------------------------------------------------------------------------
  502. //    CTablePart::Resize
  503. //----------------------------------------------------------------------------------------
  504.  
  505. void CTablePart::Resize(Environment* ev, const CCell& cell, ETableLoc tl, const FW_CPoint& delta)
  506. {
  507.     CCell topLeftCell(cell);
  508.     
  509.     if (delta.x)
  510.     {
  511.         if ((tl & kTLLeftBorder) != 0)
  512.             topLeftCell.fX -= 1;
  513.         this->SetWidth(topLeftCell.fX, this->GetWidth (topLeftCell.fX) + delta.x);        
  514.     }
  515.     
  516.     if (delta.y)
  517.     {
  518.         if ((tl & kTLTopBorder) != 0)
  519.             topLeftCell.fY -= 1;
  520.         this->SetHeight(topLeftCell.fY, this->GetHeight(topLeftCell.fY) + delta.y);
  521.     }
  522.     
  523.     // Move all embedded frames
  524.     FW_COrderedCollectionIterator ite(fProxys);
  525.     for (CTableProxy* proxy = (CTableProxy*)ite.First(); ite.IsNotComplete(); proxy = (CTableProxy*)ite.Next())
  526.     {
  527.         // Get operations being performed
  528.         CCell frCell = proxy->GetCell();
  529.         FW_Boolean resizing = (frCell.fX == topLeftCell.fX || frCell.fY == topLeftCell.fY);
  530.         FW_Boolean moving   = (frCell.fX > topLeftCell.fX || frCell.fY > topLeftCell.fY);
  531.         
  532.         if (resizing || moving)
  533.             proxy->MoveEmbeddedFrames(ev, frCell);
  534.     }
  535.  
  536.     this->Changed(ev);
  537.     
  538.     fTablePresentation->Invalidate(ev);
  539. }
  540.  
  541. //----------------------------------------------------------------------------------------
  542. //    CTablePart::AddProxy
  543. //----------------------------------------------------------------------------------------
  544.  
  545. void CTablePart::AddProxy(CTableProxy* proxy)
  546. {
  547.     fProxys->AddLast(proxy);
  548. }
  549.  
  550. //----------------------------------------------------------------------------------------
  551. //    CTablePart::RemoveProxy
  552. //----------------------------------------------------------------------------------------
  553.  
  554. void CTablePart::RemoveProxy(CTableProxy* proxy)
  555. {
  556.     fProxys->Remove(proxy);
  557. }
  558.     
  559. //========================================================
  560. // ADDITIONS FOR LINKING SUPPORT
  561. //========================================================
  562.  
  563. //----------------------------------------------------------------------------------------
  564. //    CTablePart::ContentUpdated
  565. //----------------------------------------------------------------------------------------
  566. void CTablePart::ContentUpdated(Environment* ev, FW_CFrame* frame, ODUpdateID change)
  567. {
  568.     FW_CEmbeddingPart::ContentUpdated(ev, frame, change);
  569.  
  570.     //--- Update affected link sources ---
  571.     if (change == kODUnknownUpdate)
  572.         fTableLinkManager->UpdateLinkSource(ev, change);
  573. }
  574.  
  575. //----------------------------------------------------------------------------------------
  576. // CTablePart::RegisterSubscribers
  577. //----------------------------------------------------------------------------------------
  578.  
  579. void CTablePart::RegisterSubscribers(Environment* ev)
  580. {
  581.     //--- Check for subscribers that need to be registered for automatic updates
  582.     if (!fSubscribersRegistered)    // only want to do this once!
  583.     {
  584.         fTableLinkManager->RegisterSubscribers(ev);
  585.         fSubscribersRegistered = TRUE;
  586.     }
  587. }
  588.  
  589. //----------------------------------------------------------------------------------------
  590. // CTablePart::ShowLinkInfo
  591. //----------------------------------------------------------------------------------------
  592. FW_Boolean CTablePart::ShowLinkInfo(Environment* ev, FW_CFrame* frame)
  593. {
  594.     return fTableLinkManager->ShowLinkInfo(ev, frame->GetActiveFacet(ev));
  595. }
  596.  
  597. //----------------------------------------------------------------------------------------
  598. //    CTablePart::IsLinkSelected
  599. //----------------------------------------------------------------------------------------
  600. FW_Boolean CTablePart::IsLinkSelected(Environment* ev)
  601. {
  602.     /* for now, return TRUE if a link's cell is selected */
  603.     if (fTableLinkManager->GetSelectedLinkSource(ev) != NULL)
  604.         return TRUE;
  605.     else if (fTableLinkManager->GetSelectedLinkDest(ev) != NULL)
  606.         return TRUE;
  607.  
  608.     return FALSE;
  609. }
  610.  
  611. //----------------------------------------------------------------------------------------
  612. //    CTablePart::ChangeFrameStatus
  613. //----------------------------------------------------------------------------------------
  614.  
  615. void CTablePart::ChangeFrameStatus(Environment* ev, const CCell& cell, ODLinkStatus newStatus)
  616. {
  617.     CTableProxy* proxy = this->CellToProxy(ev, cell);
  618.     FW_ASSERT(proxy);
  619.  
  620.     proxy->ChangeLinkStatus(ev, newStatus);
  621. }
  622.  
  623. //----------------------------------------------------------------------------------------
  624. //    CTablePart::AboutToClearCell
  625. //----------------------------------------------------------------------------------------
  626. void CTablePart::AboutToClearCell(Environment* ev, const CCell& cell)
  627. {
  628.     //-- Break affected links --
  629.     fTableLinkManager->BreakExistingLinks(ev, cell);
  630. }
  631.  
  632. //----------------------------------------------------------------------------------------
  633. //    CTablePart::ProxyMoved
  634. //----------------------------------------------------------------------------------------
  635. void CTablePart::ProxyMoved(Environment* ev,
  636.                             const CCell& fromCell,
  637.                             const CCell& toCell)
  638. {
  639.     //-- Adjust affected links --
  640.     fTableLinkManager->MoveExistingLinks(ev, fromCell, toCell);
  641. }
  642.  
  643. //----------------------------------------------------------------------------------------
  644. //    CTablePart::GetTableSelection
  645. //----------------------------------------------------------------------------------------
  646. CTableSelection* CTablePart::GetTableSelection(Environment* ev)
  647. {
  648.     return (CTableSelection*) fTablePresentation->GetSelection(ev);
  649. }
  650.  
  651. //----------------------------------------------------------------------------------------
  652. //    CTablePart::DoAdjustMenus
  653. //----------------------------------------------------------------------------------------
  654.  
  655. FW_Boolean CTablePart::DoAdjustMenus(Environment* ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus, FW_Boolean isRoot)
  656. {
  657.     if (hasMenuFocus)
  658.     {
  659.         //--- Set up the Part Info menu item ---
  660.         if (this->IsLinkSelected(ev))
  661.         {
  662.             menuBar->SetItemString(ev, kODCommandGetPartInfo, FW_CString32("Link Info"));
  663.             menuBar->EnableCommand(ev, kODCommandGetPartInfo, TRUE);
  664.         }
  665.     }
  666.     
  667.     return FALSE;
  668. }
  669.  
  670. //----------------------------------------------------------------------------------------
  671. //    CTablePart::NewLinkManager
  672. //----------------------------------------------------------------------------------------
  673.  
  674. FW_CLinkManager* CTablePart::NewLinkManager(Environment *ev)    // Override
  675. {
  676.     CTableLinkManager* linkMgr = FW_NEW(CTableLinkManager, (ev, this));
  677.     fTableLinkManager = linkMgr;
  678.     return linkMgr;
  679. }
  680.