summaryrefslogtreecommitdiff
path: root/sc/source/ui/collab/sccollaboration.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/collab/sccollaboration.cxx')
-rw-r--r--sc/source/ui/collab/sccollaboration.cxx62
1 files changed, 62 insertions, 0 deletions
diff --git a/sc/source/ui/collab/sccollaboration.cxx b/sc/source/ui/collab/sccollaboration.cxx
new file mode 100644
index 000000000000..758db8918f4e
--- /dev/null
+++ b/sc/source/ui/collab/sccollaboration.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "sccollaboration.hxx"
+
+#include "docsh.hxx"
+#include "sendfunc.hxx"
+
+ScCollaboration::ScCollaboration()
+{
+}
+
+ScCollaboration::~ScCollaboration()
+{
+}
+
+TeleConference* ScCollaboration::GetConference() const
+{
+ ScDocFuncSend* pSender = GetScDocFuncSend();
+ if (pSender)
+ return pSender->GetConference();
+
+ return NULL;
+}
+
+void ScCollaboration::SetCollaboration( TeleConference* pConference )
+{
+ ScDocShell* pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
+ ScDocFunc* pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
+ 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->SetCollaboration( pConference );
+}
+
+void ScCollaboration::SendFile( TpContact* pContact, const OUString& rURL )
+{
+ ScDocFuncSend* pSender = GetScDocFuncSend();
+ if (pSender)
+ pSender->SendFile( pContact, rURL );
+}
+
+ScDocFuncSend* ScCollaboration::GetScDocFuncSend() const
+{
+ ScDocShell *pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
+ ScDocFunc *pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
+ return dynamic_cast<ScDocFuncSend*> (pDocFunc);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */