home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 25.6 KB | 777 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: Linking.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef LINKING_H
- #include "Linking.h"
- #endif
-
- #ifndef PART_H
- #include "Part.h"
- #endif
-
- #ifndef SELECTION_H
- #include "Selection.h"
- #endif
-
- #ifndef COMMANDS_H
- #include "Commands.h"
- #endif
-
- #ifndef PROXY_H
- #include "Proxy.h"
- #endif
-
- #ifndef FRAME_H
- #include "Frame.h"
- #endif
-
- #ifndef CONTENT_H
- #include "Content.h"
- #endif
-
- // ----- Framework Includes -----
-
- #ifndef FWPART_H
- #include "FWPart.h"
- #endif
-
- #ifndef FWFRAME_H
- #include "FWFrame.h"
- #endif
-
- #ifndef FWITERS_H
- #include "FWIters.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- #ifndef FWSELECT_H
- #include "FWSelect.h"
- #endif
-
- // for FW_CCloneInfo
- #ifndef FWPROXY_H
- #include "FWProxy.h"
- #endif
-
- // for FW_SUForceFocus
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWPXYFRM_H
- #include "FWPxyFrm.h"
- #endif
-
- #ifndef FWPRTITE_H
- #include "FWPrtIte.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWCLNINF_H
- #include "FWClnInf.h"
- #endif
-
- #ifndef FWPXYITE_H
- #include "FWPxyIte.h"
- #endif
-
- #ifndef FWLNKITE_H
- #include "FWLnkIte.h"
- #endif
-
- #ifndef FWINTER_H
- #include "FWInter.h"
- #endif
-
- // ----- OS Includes -----
-
- #ifndef FWODEXCE_H
- #include "FWODExce.h"
- #endif
-
- #ifndef FWODMISC_H
- #include "FWODMisc.h"
- #endif
-
- #ifndef FWLINSHP_H
- #include "FWLinShp.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWMEMMGR_H
- #include "FWMemMgr.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #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_ODStorageUnitView_xh
- #include <SUView.xh>
- #endif
-
- #ifndef SOM_ODLink_xh
- #include <Link.xh>
- #endif
-
- #ifndef SOM_ODLinkSpec_xh
- #include <LinkSpec.xh>
- #endif
-
- #ifndef SOM_ODLinkSource_xh
- #include <LinkSrc.xh>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- //========================================================================================
- // Constants
- //========================================================================================
-
- #define kPublishFormat "Apple:ODF:Publish:ODFTable"
- #define kSubscribeFormat "Apple:ODF:Subscribe:ODFTable"
-
- //========================================================================================
- // Runtime Information
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment opftable
- #endif
-
- //========================================================================================
- // Global Functions
- //========================================================================================
-
- ODShape* CreateLinkBorderShape(Environment* ev, CCell cell, CTablePartContent* content);
- void CommonDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc, FW_Boolean selected);
-
- //----------------------------------------------------------------------------------------
- // CreateLinkBorderShape
- //----------------------------------------------------------------------------------------
- ODShape* CreateLinkBorderShape(Environment* ev, CCell cell, CTablePartContent* content)
- {
- FW_CRect rect;
- content->FindRect(cell, rect);
- ODShape* shape = ::FW_NewODShape(ev, rect);
- return shape;
- }
-
- //----------------------------------------------------------------------------------------
- // CommonDrawLinkBorder
- //----------------------------------------------------------------------------------------
- void CommonDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc, FW_Boolean selected)
- {
- FW_CRect box;
- outline->GetBoundingBox(ev, (ODRect*)&box);
-
- FW_CStyle horzStyle(FW_IntToFixed(FW_kLinkBorderWidth), FW_kHLinkPat);
- FW_CStyle vertStyle(FW_IntToFixed(FW_kLinkBorderWidth), FW_kVLinkPat);
- FW_CInk ink(FW_kXOr);
-
- if (selected)
- {
- horzStyle.SetPattern(FW_kSelectedHLinkPat);
- vertStyle.SetPattern(FW_kSelectedVLinkPat);
- }
-
- FW_CLineShape topLine(box.TopLeft(), box.TopRight(), ink, horzStyle);
- FW_CLineShape bottomLine(box.BotLeft(), box.BotRight(), ink, horzStyle);
- FW_CLineShape leftLine(box.TopLeft(), box.BotLeft(), ink, vertStyle);
- FW_CLineShape rightLine(box.TopRight(), box.BotRight(), ink, vertStyle);
-
- topLine.Render(gc);
- bottomLine.Render(gc);
- leftLine.Render(gc);
- rightLine.Render(gc);
- }
-
- //========================================================================================
- // class CTableLinkSource
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource constructor
- //----------------------------------------------------------------------------------------
-
- CTableLinkSource::CTableLinkSource( Environment* ev, ODUpdateID changeID,
- FW_CPresentation* presentation,
- CTablePart* part,
- CTablePartContent* content,
- CTableSelection* selection)
- : FW_CLinkSource(ev, changeID, presentation),
- fTablePart(part),
- fPublishedContent(NULL)
- {
- fPublishedContent = FW_NEW(CTableSelectionContent, (ev, part, content));
- fPublishedContent->SetCell(selection->GetSelectedCell());
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource destructor
- //----------------------------------------------------------------------------------------
-
- CTableLinkSource::~CTableLinkSource()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::LinkEstablished
- //----------------------------------------------------------------------------------------
-
- void CTableLinkSource::LinkEstablished(Environment* ev)
- {
- //---- Change the link status of affected embedded frames
- fTablePart->ChangeFrameStatus(ev, fPublishedContent->GetCell(), kODInLinkSource);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::DoExternalizeLink
- //----------------------------------------------------------------------------------------
-
- void CTableLinkSource::DoExternalizeLink(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(cloneInfo);
- //-- Write out data specific to this part's publisher --
- CCell cell = fPublishedContent->GetCell(); // table cell associated with this publisher
- FW_CByteArray byteArray(&cell, sizeof(CCell));
- storageUnit->SetValue(ev, byteArray);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::ExternalizeLinkContent
- //----------------------------------------------------------------------------------------
-
- void CTableLinkSource::ExternalizeLinkContent(Environment* ev, ODStorageUnit* linkSU)
- {
- // -- Pick a frame, any frame --
- FW_CPresentationFrameIterator piter(ev, fPresentation);
- FW_CFrame* frame = piter.First(ev);
- FW_ASSERT(frame);
-
- fDataInterchange->ExternalizeData(ev, fPublishedContent, frame, linkSU, FW_kLinkStorage, kODCloneToLink);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::HasEmbeddedFrame
- //---------------------------------------------------------------------------------------
- FW_Boolean CTableLinkSource::HasEmbeddedFrame(Environment* ev, ODFrame* odFrame)
- {
- // Is odFrame involved in this link source? (called by Part::EmbeddedFrameChanged)
-
- FW_Boolean result = false;
-
- // --- Find out whether odFrame is involved in any link source ---
- if (odFrame->GetLinkStatus(ev) == kODInLinkSource)
- {
- CTableProxy* proxy = fPublishedContent->GetSelectedProxy(ev);
- FW_CProxyProxyFrameIterator iter((FW_MProxy*) proxy);
- for (FW_CProxyFrame* proxyFrame = iter.First(); iter.IsNotComplete(); proxyFrame = iter.Next())
- if (proxyFrame->GetFrame(ev) == odFrame)
- {
- result = true;
- break;
- }
- }
-
- return result;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::BreakLink
- //----------------------------------------------------------------------------------------
- void CTableLinkSource::BreakLink(Environment* ev)
- {
- FW_CLinkSource::BreakLink(ev);
-
- //--- Erase Link Borders ---
- fPresentation->Invalidate(ev); // force all frames to be redrawn
-
- //--- Change status of embedded frames ---
- fTablePart->ChangeFrameStatus(ev, fPublishedContent->GetCell(), kODNotInLink);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::RevealLinkSource
- //---------------------------------------------------------------------------------------
- void CTableLinkSource::RevealLinkSource(Environment* ev, FW_CFrame* frame)
- {
- FW_UNUSED(frame);
- CTableSelection* selection = fTablePart->GetTableSelection(ev);
- selection->Select(ev, fPublishedContent->GetCell());
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::GetCell
- //----------------------------------------------------------------------------------------
- CCell CTableLinkSource::GetCell(Environment* ev) const
- {
- FW_UNUSED(ev);
- return fPublishedContent->GetCell();
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::SetCell
- //----------------------------------------------------------------------------------------
- void CTableLinkSource::SetCell(Environment* ev, const CCell& cell)
- {
- FW_UNUSED(ev);
- fPublishedContent->SetCell(cell);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::DoCreateLinkBorderShape
- //----------------------------------------------------------------------------------------
- ODShape* CTableLinkSource::DoCreateLinkBorderShape(Environment* ev)
- {
- return CreateLinkBorderShape(ev, GetCell(ev), fTablePart->GetTableContent(ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::DoDrawLinkBorder
- //----------------------------------------------------------------------------------------
- void CTableLinkSource::DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc)
- {
- CommonDrawLinkBorder(ev, outline, gc, this->IsLinkSelected(ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkSource::RestoreLink
- //----------------------------------------------------------------------------------------
- void CTableLinkSource::RestoreLink(Environment* ev, FW_CPart* part)
- {
- FW_CLinkSource::RestoreLink(ev, part);
-
- //---- Change the link status of affected embedded frames
- fTablePart->ChangeFrameStatus(ev, fPublishedContent->GetCell(), kODInLinkSource);
- }
-
-
- //========================================================================================
- // class CTableLink
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CTableLink constructor
- //----------------------------------------------------------------------------------------
-
- CTableLink::CTableLink( Environment* ev,
- ODLink* odLink,
- ODLinkInfo* linkInfo,
- FW_CPresentation* presentation,
- CTablePart* part,
- CTablePartContent* content,
- CTableSelection* selection)
- : FW_CLinkDestination(ev, odLink, linkInfo, presentation),
- fTablePart(part),
- fLinkedContent(NULL)
- {
- //---- Create a new content object ----
- fLinkedContent = FW_NEW(CTableSelectionContent, (ev, part, content));
- fLinkedContent->SetCell(selection->GetSelectedCell());
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink destructor
- //----------------------------------------------------------------------------------------
-
- CTableLink::~CTableLink()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::LinkEstablished
- //----------------------------------------------------------------------------------------
-
- void CTableLink::LinkEstablished(Environment* ev)
- {
- fTablePart->ChangeFrameStatus(ev, fLinkedContent->GetCell(), kODInLinkDestination);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::DoUpdateLink
- //--------------------------------------------------------------------
- FW_Boolean CTableLink::DoUpdateLink(Environment* ev, ODStorageUnit* linkContentSU, ODPasteAsResult* embedInfo)
- {
- FW_CPresentationFrameIterator piter(ev, fPresentation);
- FW_CFrame* frame = piter.First(ev);
- FW_ASSERT(frame);
-
- //-- Read data from the linkContentSU --
- FW_Boolean result = (fDataInterchange->InternalizeData(ev, fLinkedContent, frame, linkContentSU,
- FW_kLinkStorage, kODCloneFromLink, embedInfo)
- != FW_kInternalizeFailed);
- if (result)
- fPresentation->Invalidate(ev); // force all frames to be redrawn
- return result;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::BreakLink
- //----------------------------------------------------------------------------------------
- void CTableLink::BreakLink(Environment* ev)
- {
- FW_CLinkDestination::BreakLink(ev);
-
- //--- Erase Link Borders ---
- fPresentation->Invalidate(ev); // force all frames to be redrawn
-
- //--- Change status of embedded frames ---
- fTablePart->ChangeFrameStatus(ev, fLinkedContent->GetCell(), kODNotInLink);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::DoExternalizeLink
- //----------------------------------------------------------------------------------------
-
- void CTableLink::DoExternalizeLink(Environment* ev, ODStorageUnit* storageUnit, FW_CCloneInfo* cloneInfo)
- {
- FW_UNUSED(cloneInfo);
- // Write out data specific to this part's subscriber
- CCell cell = fLinkedContent->GetCell(); // table cell associated with this link
- FW_CByteArray byteArray(&cell, sizeof(CCell));
- storageUnit->SetValue(ev, byteArray);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::GetCell
- //----------------------------------------------------------------------------------------
- CCell CTableLink::GetCell(Environment* ev) const
- {
- FW_UNUSED(ev);
- return fLinkedContent->GetCell();
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::SetCell
- //----------------------------------------------------------------------------------------
- void CTableLink::SetCell(Environment* ev, const CCell& cell)
- {
- FW_UNUSED(ev);
- fLinkedContent->SetCell(cell);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::DoCreateLinkBorderShape
- //----------------------------------------------------------------------------------------
- ODShape* CTableLink::DoCreateLinkBorderShape(Environment* ev)
- {
- return CreateLinkBorderShape(ev, GetCell(ev), fTablePart->GetTableContent(ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::DoDrawLinkBorder
- //----------------------------------------------------------------------------------------
- void CTableLink::DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc)
- {
- CommonDrawLinkBorder(ev, outline, gc, this->IsLinkSelected(ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLink::GetContainingFrame
- //----------------------------------------------------------------------------------------
- FW_CFrame* CTableLink::GetContainingFrame(Environment* ev, ODFrame* odEmbeddedFrame)
- {
- // Is odEmbeddedFrame involved in this link? (called by FW_CLinkManager::EditInLinkAttempted)
-
- if (odEmbeddedFrame->GetLinkStatus(ev) == kODInLinkDestination)
- {
- CTableProxy* proxy = fLinkedContent->GetSelectedProxy(ev);
- FW_CProxyProxyFrameIterator iter((FW_MProxy*) proxy);
- for (FW_CProxyFrame* proxyFrame = iter.First(); iter.IsNotComplete(); proxyFrame = iter.Next())
- {
- if (proxyFrame->GetFrame(ev) == odEmbeddedFrame)
- return proxyFrame->GetContainingFrame(ev);
- }
- }
-
- return NULL;
- }
-
- //========================================================================================
- // class CTableLinkManager
- //========================================================================================
-
- FW_DEFINE_AUTO(CTableLinkManager)
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager constructor
- //----------------------------------------------------------------------------------------
-
- CTableLinkManager::CTableLinkManager(Environment* ev, CTablePart* thePart, CTablePartContent* tableContent) :
- FW_CLinkManager(ev, (FW_CPart*)thePart),
- fTablePart(thePart),
- fTableContent(tableContent)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager destructor
- //----------------------------------------------------------------------------------------
-
- CTableLinkManager::~CTableLinkManager()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::NewLinkSource
- //----------------------------------------------------------------------------------------
-
- FW_CLinkSource* CTableLinkManager::NewLinkSource(Environment* ev,
- ODUpdateID changeID,
- FW_CPresentation* presentation)
- {
- return new CTableLinkSource(ev, changeID, presentation, fTablePart, fTableContent, fTablePart->GetTableSelection(ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::NewLinkDestination
- //----------------------------------------------------------------------------------------
-
- FW_CLinkDestination* CTableLinkManager::NewLinkDestination(Environment* ev, ODLink *odLink,
- ODLinkInfo* linkInfo,
- FW_CPresentation* presentation)
- {
- return new CTableLink(ev, odLink, linkInfo, presentation, fTablePart, fTableContent, fTablePart->GetTableSelection(ev));
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::DoChangeLinkStatus
- //----------------------------------------------------------------------------------------
-
- void CTableLinkManager::DoChangeLinkStatus(Environment* ev, ODFrame* odFrame)
- {
- // call ODFrame::ChangeLinkStatus on any embedded frames that are involved in a link
- // when a link is created, broken, moved, etc.
- // odFrame is the frame of this part whose link status has changed.
-
- FW_CEmbeddingFrame* frame = FW_CEmbeddingFrame::ODtoFWEmbeddingFrame(ev, odFrame);
- if (frame)
- {
- ODLinkStatus linkStatus = odFrame->GetLinkStatus(ev);
-
- // Only need to propagate linkStatus to embedded frames that don't participate in
- // any of this part's links; otherwise their local link status takes precedence.
-
- CTableProxysIterator iter(fTableContent);
- for (CTableProxy* proxy = iter.First(); iter.IsNotComplete(); proxy = iter.Next())
- {
- if (!this->IsCellInLink(ev, proxy->GetCell()))
- {
- FW_CProxyEmbeddedFrameIterator efiter(ev, proxy);
- for (ODFrame* embFrame = efiter.First(ev); efiter.IsNotComplete(ev); embFrame = efiter.Next(ev))
- embFrame->ChangeLinkStatus(ev, linkStatus);
- }
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::GetSourceLinkFormat, GetDestLinkFormat
- //----------------------------------------------------------------------------------------
- ODValueType CTableLinkManager::GetSourceLinkFormat(Environment* ev)
- {
- FW_UNUSED(ev);
- // Must be different from subscribe format!
- return kPublishFormat;
- }
-
- ODValueType CTableLinkManager::GetDestLinkFormat(Environment* ev)
- {
- FW_UNUSED(ev);
- // Must be different from publish format!
- return kSubscribeFormat;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::IsCellInLink
- //----------------------------------------------------------------------------------------
- FW_Boolean CTableLinkManager::IsCellInLink(Environment* ev, const CCell& cell)
- {
- //--- Check whether the cell participates in any of our source links
- FW_CLinkMgrLinkSourceIterator sit(this);
- for (CTableLinkSource* publisher = (CTableLinkSource*)sit.First(); sit.IsNotComplete();
- publisher = (CTableLinkSource*)sit.Next())
- {
- if (publisher->GetCell(ev) == cell)
- return true;
- }
-
- //--- Check whether the cell participates in any of our destination links
- FW_CLinkMgrLinkDestIterator dit(this);
- for (CTableLink* link = (CTableLink*)dit.First(); dit.IsNotComplete(); link = (CTableLink*)dit.Next())
- {
- if (link->GetCell(ev) == cell)
- return true;
- }
-
- return false;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::CellToSourceLink
- //----------------------------------------------------------------------------------------
- CTableLinkSource* CTableLinkManager::CellToSourceLink(Environment* ev, const CCell& cell) const
- {
- FW_CLinkMgrLinkSourceIterator iter(this);
- for (CTableLinkSource* slink = (CTableLinkSource*)iter.First(); iter.IsNotComplete();
- slink = (CTableLinkSource*)iter.Next())
- {
- if (slink->GetCell(ev) == cell)
- return slink;
- }
-
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::CellToLink
- //----------------------------------------------------------------------------------------
- CTableLink* CTableLinkManager::CellToLink(Environment* ev, const CCell& cell) const
- {
- FW_CLinkMgrLinkDestIterator iter(this);
- for (CTableLink* link = (CTableLink*)iter.First(); iter.IsNotComplete();
- link = (CTableLink*)iter.Next())
- {
- if (link->GetCell(ev) == cell)
- return link;
- }
-
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::DoInternalizeOneSourceLink
- //---------------------------------------------------------------------------------------
-
- FW_CLinkSource* CTableLinkManager::DoInternalizeOneSourceLink(Environment* ev,
- ODStorageUnit* storageUnit,
- ODUpdateID updateID)
- {
- //-- Read the link source's cell
- CCell cell;
- FW_CByteArray byteArray;
- storageUnit->GetValue(ev, sizeof(CCell), byteArray);
- byteArray.CopyBuffer(&cell, sizeof(CCell));
-
- //-- Create and add a publisher to represent the link source
- CTableLinkSource* publisher = (CTableLinkSource*)this->NewLinkSource(ev,
- updateID, fTablePart->fTablePresentation);
- publisher->SetCell(ev, cell);
- fTablePart->ChangeFrameStatus(ev, cell, kODInLinkSource);
-
- return publisher;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::DoInternalizeOneDestLink
- //---------------------------------------------------------------------------------------
-
- FW_CLinkDestination* CTableLinkManager::DoInternalizeOneDestLink(Environment* ev,
- ODStorageUnit* storageUnit,
- ODLink* odLink,
- ODLinkInfo* linkInfo)
- {
- //-- Read the link's cell
- CCell cell;
- FW_CByteArray byteArray;
- storageUnit->GetValue(ev, sizeof(CCell), byteArray);
- byteArray.CopyBuffer(&cell, sizeof(CCell));
-
- //-- Create and add a subscriber to represent the link
- CTableLink* subscriber = (CTableLink*)this->NewLinkDestination(ev,
- odLink, linkInfo, fTablePart->fTablePresentation);
- subscriber->SetCell(ev, cell);
- return subscriber;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::UpdateLinkSource
- //----------------------------------------------------------------------------------------
-
- void CTableLinkManager::UpdateLinkSource(Environment* ev, ODUpdateID updateID)
- {
- CTableLinkSource* linkSource = this->GetSelectedLinkSource(ev);
- if (linkSource)
- linkSource->ContentUpdated(ev, updateID);
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::GetSelectedLinkSource
- //----------------------------------------------------------------------------------------
- CTableLinkSource* CTableLinkManager::GetSelectedLinkSource(Environment* ev)
- {
- FW_CLinkMgrLinkSourceIterator iter(this);
- for (CTableLinkSource* slink = (CTableLinkSource*)iter.First(); iter.IsNotComplete();
- slink = (CTableLinkSource*)iter.Next())
- {
- if (slink->IsLinkSelected(ev))
- return slink;
- }
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::BreakExistingLinks
- //----------------------------------------------------------------------------------------
- void CTableLinkManager::BreakExistingLinks(Environment* ev, const CCell& cell)
- {
- //-- Check for a link being broken --
- CTableLinkSource* linkSource = this->CellToSourceLink(ev, cell);
- if (linkSource)
- {
- this->BreakSourceLink(ev, linkSource);
- delete linkSource;
- }
- CTableLink* link = this->CellToLink(ev, cell);
- if (link)
- {
- this->BreakDestinationLink(ev, link);
- delete link;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // CTableLinkManager::MoveExistingLinks
- //----------------------------------------------------------------------------------------
- void CTableLinkManager::MoveExistingLinks(Environment* ev,
- const CCell& fromCell,
- const CCell& toCell)
- {
- //-- Adjust affected links --
- CTableLinkSource* slink = this->CellToSourceLink(ev, fromCell);
- if (slink)
- slink->SetCell(ev, toCell);
- CTableLink* link = this->CellToLink(ev, fromCell);
- if (link)
- link->SetCell(ev, toCell);
- }
-
-