Kaydet (Commit) 374fb913 authored tarafından Matúš Kukan's avatar Matúš Kukan

tubes: make ScDocShell* member of ScCollaboration

Change-Id: I8e9bab6d97e7fb4a3de3b3d3896a57c6496958bd
üst 56977dfa
......@@ -12,7 +12,8 @@
#include "docsh.hxx"
#include "sendfunc.hxx"
ScCollaboration::ScCollaboration()
ScCollaboration::ScCollaboration( ScDocShell* pScDocShell ) :
mpScDocShell( pScDocShell )
{
}
......@@ -31,21 +32,20 @@ TeleConference* ScCollaboration::GetConference()
sal_uInt64 ScCollaboration::GetId()
{
return reinterpret_cast<sal_uInt64> (SfxObjectShell::Current());
return reinterpret_cast<sal_uInt64> (mpScDocShell);
}
void ScCollaboration::SetCollaboration( TeleConference* pConference )
{
ScDocShell* pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
ScDocFunc* pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
ScDocFunc* pDocFunc = &mpScDocShell->GetDocFunc();
ScDocFuncSend* pSender = dynamic_cast<ScDocFuncSend*> (pDocFunc);
if (!pSender)
{
// This means pDocFunc has to be ScDocFuncDirect* and we are not collaborating yet.
ScDocFuncDirect *pDirect = dynamic_cast<ScDocFuncDirect*> (pDocFunc);
ScDocFuncRecv *pReceiver = new ScDocFuncRecv( pDirect );
pSender = new ScDocFuncSend( *pScDocShell, pReceiver );
pScDocShell->SetDocFunc( pSender );
pSender = new ScDocFuncSend( *mpScDocShell, pReceiver );
mpScDocShell->SetDocFunc( pSender );
}
pSender->SetCollaboration( pConference );
}
......@@ -59,9 +59,7 @@ void ScCollaboration::SendFile( TpContact* pContact, const OUString& rURL )
ScDocFuncSend* ScCollaboration::GetScDocFuncSend()
{
ScDocShell *pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
ScDocFunc *pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
return dynamic_cast<ScDocFuncSend*> (pDocFunc);
return dynamic_cast<ScDocFuncSend*> (&mpScDocShell->GetDocFunc());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -2540,7 +2540,7 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) :
pSheetSaveData ( NULL ),
pModificator ( NULL )
#ifdef ENABLE_TELEPATHY
, mpCollaboration( new ScCollaboration() )
, mpCollaboration( new ScCollaboration( this ) )
#endif
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ScDocShell" );
......@@ -2589,7 +2589,7 @@ ScDocShell::ScDocShell( const sal_uInt64 i_nSfxCreationFlags ) :
pSheetSaveData ( NULL ),
pModificator ( NULL )
#ifdef ENABLE_TELEPATHY
, mpCollaboration( new ScCollaboration() )
, mpCollaboration( new ScCollaboration( this ) )
#endif
{
RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ScDocShell" );
......
......@@ -12,11 +12,13 @@
#include <tubes/collaboration.hxx>
class ScDocFuncSend;
class ScDocShell;
class ScCollaboration : public Collaboration
{
ScDocShell* mpScDocShell;
public:
ScCollaboration();
ScCollaboration( ScDocShell* pScDocShell );
virtual ~ScCollaboration();
virtual TeleConference* GetConference();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment