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

tubes: move sc/source/ui/collab/contacts.* to tubes

- sc no longer directly links against telepathy
- there is new class ScCollaboration derived from abstract Collaboration
  describing collaboration functionality for apps used in tubes/
- also added resource manager into tubes/

Change-Id: Ic89ae955f5b47490f4f4b8781bcee5dea5336bae
üst 4311938f
......@@ -83,7 +83,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
sc/source/ui/src/condformatdlg.src \
sc/source/ui/src/condformatmgr.src \
sc/source/ui/cctrl/checklistmenu.src \
sc/source/ui/collab/contacts.src \
sc/source/ui/navipi/navipi.src \
sc/source/ui/docshell/tpstat.src \
sc/source/ui/optdlg/calcoptionsdlg.src \
......
......@@ -44,15 +44,7 @@ $(call gb_CxxObject_get_target,sc/qa/unit/ucalc): \
$(WORKDIR)/AllLangRes/sc \
ifeq ($(ENABLE_TELEPATHY),TRUE)
$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc,\
tubes \
))
$(eval $(call gb_CppunitTest_use_externals,sc_ucalc,\
telepathy \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc,tubes))
endif
$(eval $(call gb_CppunitTest_use_libraries,sc_ucalc, \
......
......@@ -43,24 +43,16 @@ $(eval $(call gb_Library_add_defs,sc,\
$(eval $(call gb_Library_use_sdk_api,sc))
ifeq ($(ENABLE_TELEPATHY),TRUE)
$(eval $(call gb_Library_use_libraries,sc,\
tubes \
))
$(eval $(call gb_Library_use_libraries,sc,tubes))
$(eval $(call gb_Library_add_defs,sc,\
-DENABLE_TELEPATHY \
))
$(eval $(call gb_Library_use_externals,sc,\
telepathy \
))
$(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/collab/contacts \
sc/source/ui/collab/sccollaboration \
sc/source/ui/collab/sendfunc \
))
endif
$(eval $(call gb_Library_use_libraries,sc,\
......
/* -*- 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: */
......@@ -31,12 +31,13 @@
#include <vector>
#include "cell.hxx"
#include "contacts.hxx"
#include "docsh.hxx"
#include "docfunc.hxx"
#include "sccollaboration.hxx"
#include "sendfunc.hxx"
#include <tubes/manager.hxx>
#include <tubes/conference.hxx>
#include <tubes/contacts.hxx>
#include <tubes/manager.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <unotools/tempfile.hxx>
......@@ -252,7 +253,7 @@ sal_Bool ScDocFuncSend::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& r
SendFile( NULL, rText );
if ( rtl::OUString( rText ) == "contacts" )
tubes::createContacts();
tubes::createContacts( new ScCollaboration() );
return true; // needs some code auditing action
}
......
/* -*- 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/.
*/
#ifndef INCLUDED_SC_COLLABORATION_HXX
#define INCLUDED_SC_COLLABORATION_HXX
#include <tubes/collaboration.hxx>
class ScDocFuncSend;
class ScCollaboration : public Collaboration
{
public:
ScCollaboration();
virtual ~ScCollaboration();
virtual TeleConference* GetConference() const;
virtual void SetCollaboration( TeleConference* pConference );
virtual void SendFile( TpContact* pContact, const OUString& rURL );
private:
ScDocFuncSend* GetScDocFuncSend() const;
};
#endif // INCLUDED_SC_COLLABORATION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -53,9 +53,8 @@
#include "scabstdlg.hxx"
#ifdef ENABLE_TELEPATHY
namespace tubes {
void createContacts();
}
#include "sccollaboration.hxx"
#include <tubes/contacts.hxx>
#endif
#define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
......@@ -119,7 +118,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
case SID_COLLABORATION:
#ifdef ENABLE_TELEPATHY
tubes::createContacts();
tubes::createContacts( new ScCollaboration() );
#endif
break;
......
......@@ -124,3 +124,6 @@ STD_RES_FILE( gid_File_Res_T602Filter, t602filter )
STD_RES_FILE( gid_File_Res_Forui, forui )
STD_RES_FILE( gid_File_Res_For, for )
#ifdef ENABLE_TELEPATHY
STD_RES_FILE( gid_File_Res_Tubes, tubes )
#endif
......@@ -88,6 +88,7 @@ Module gid_Module_Langpack_Resource_Template
gid_File_Res_Tk,
gid_File_Res_Acc,
gid_File_Res_Tpl,
gid_File_Res_Tubes,
gid_File_Res_Uui,
gid_File_Res_Vcl,
gid_File_Res_Wzi,
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#
# 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/.
#
$(eval $(call gb_AllLangResTarget_AllLangResTarget,tubes))
$(eval $(call gb_AllLangResTarget_add_srs,tubes,tubes/res))
$(eval $(call gb_SrsTarget_SrsTarget,tubes/res))
$(eval $(call gb_SrsTarget_add_files,tubes/res,\
tubes/source/contacts.src \
))
# vim: set noet sw=4 ts=4:
......@@ -38,7 +38,11 @@ $(eval $(call gb_CppunitTest_use_libraries,tubes_test, \
comphelper \
cppu \
sal \
svt \
svxcore \
tl \
utl \
vcl \
$(gb_STDLIBS) \
))
......
......@@ -43,6 +43,11 @@ $(eval $(call gb_Library_use_libraries,tubes,\
comphelper \
cppu \
sal \
svt \
svxcore \
tl \
utl \
vcl \
))
$(eval $(call gb_Library_use_externals,tubes,\
......@@ -51,8 +56,9 @@ $(eval $(call gb_Library_use_externals,tubes,\
$(eval $(call gb_Library_add_exception_objects,tubes,\
tubes/source/conference \
tubes/source/manager \
tubes/source/contact-list \
tubes/source/contacts \
tubes/source/manager \
))
$(eval $(call gb_Library_add_cobjects,tubes,\
......
......@@ -30,6 +30,7 @@ $(eval $(call gb_Module_Module,tubes))
ifeq ($(ENABLE_TELEPATHY),TRUE)
$(eval $(call gb_Module_add_targets,tubes,\
AllLangResTarget_tubes \
Library_tubes \
Package_inc \
Executable_liboapprover \
......
......@@ -26,8 +26,10 @@
$(eval $(call gb_Package_Package,tubes_inc,$(SRCDIR)/tubes/inc))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/collaboration.hxx,tubes/collaboration.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/conference.hxx,tubes/conference.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/contact-list.hxx,tubes/contact-list.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/contacts.hxx,tubes/contacts.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/manager.hxx,tubes/manager.hxx))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/tubesdllapi.h,tubes/tubesdllapi.h))
$(eval $(call gb_Package_add_file,tubes_inc,inc/tubes/warnings_guard_boost_signals2.hpp,tubes/warnings_guard_boost_signals2.hpp))
......
/* -*- 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/.
*/
#ifndef INCLUDED_TUBES_COLLABORATION_HXX
#define INCLUDED_TUBES_COLLABORATION_HXX
#include <sal/config.h>
#include <rtl/ustring.hxx>
class TeleConference;
typedef struct _TpContact TpContact;
class Collaboration
{
public:
Collaboration() {}
virtual ~Collaboration() {}
virtual TeleConference* GetConference() const = 0;
virtual void SetCollaboration( TeleConference* pConference ) = 0;
// TODO: I think this could be moved to TeleManager later.
virtual void SendFile( TpContact* pContact, const OUString& rURL ) = 0;
};
#endif // INCLUDED_TUBES_COLLABORATION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -27,9 +27,12 @@
*/
#include "sal/config.h"
#include <tubes/tubesdllapi.h>
class Collaboration;
namespace tubes {
void createContacts();
void TUBES_DLLPUBLIC createContacts( Collaboration* pCollaboration );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -26,23 +26,36 @@
* instead of those above.
*/
#include "sal/config.h"
#include <sal/config.h>
#include <vector>
#include "contacts.hrc"
#include "sendfunc.hxx"
#include "docsh.hxx"
#include "scresid.hxx"
#include <svtools/filter.hxx>
#include <svx/simptabl.hxx>
#include <tools/resid.hxx>
#include <tubes/conference.hxx>
#include <tubes/collaboration.hxx>
#include <tubes/contact-list.hxx>
#include <tubes/contacts.hxx>
#include <tubes/manager.hxx>
#include <unotools/confignode.hxx>
#include <vcl/fixed.hxx>
#include <vcl/dialog.hxx>
#include <svx/simptabl.hxx>
#include <vcl/unohelp.hxx>
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
#include <telepathy-glib/telepathy-glib.h>
ResId TubesResId( sal_uInt32 nId )
{
static ResMgr* pResMgr = NULL;
if (!pResMgr)
{
pResMgr = ResMgr::CreateResMgr( "tubes" );
}
return ResId( nId, *pResMgr );
}
#define CONTACTS_DLG
#ifdef CONTACTS_DLG
......@@ -57,6 +70,7 @@ class TubeContacts : public ModelessDialog
SvxSimpleTableContainer maListContainer;
SvxSimpleTable maList;
TeleManager* mpManager;
Collaboration* mpCollaboration;
DECL_LINK( BtnConnectHdl, void * );
DECL_LINK( BtnGroupHdl, void * );
......@@ -72,29 +86,6 @@ class TubeContacts : public ModelessDialog
};
boost::ptr_vector<AccountContact> maACs;
ScDocFuncSend* GetScDocFuncSendInCurrentSfxObjectShell()
{
ScDocShell *pScDocShell = dynamic_cast<ScDocShell*> (SfxObjectShell::Current());
ScDocFunc *pDocFunc = pScDocShell ? &pScDocShell->GetDocFunc() : NULL;
return dynamic_cast<ScDocFuncSend*> (pDocFunc);
}
ScDocFuncSend* EnsureScDocFuncSendInCurrentSfxObjectShell()
{
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 );
}
return pSender;
}
void Invite()
{
AccountContact *pAC = NULL;
......@@ -102,13 +93,12 @@ class TubeContacts : public ModelessDialog
pAC = static_cast<AccountContact*> (maList.FirstSelected()->GetUserData());
if (pAC)
{
ScDocFuncSend *pSender = GetScDocFuncSendInCurrentSfxObjectShell();
if (pSender && pSender->GetConference())
if (mpCollaboration->GetConference())
{
TpContact* pContact = pAC->mpContact;
pSender->GetConference()->invite( pContact );
pSender->SendFile( pContact, OStringToOUString(
pSender->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
mpCollaboration->GetConference()->invite( pContact );
mpCollaboration->SendFile( pContact, OStringToOUString(
mpCollaboration->GetConference()->getUuid(), RTL_TEXTENCODING_UTF8 ) );
}
}
}
......@@ -135,9 +125,8 @@ class TubeContacts : public ModelessDialog
tp_contact_get_identifier( pContact ) );
else
{
ScDocFuncSend* pSender = EnsureScDocFuncSendInCurrentSfxObjectShell();
pSender->SetCollaboration( pConference );
pSender->SendFile( pContact, OStringToOUString(
mpCollaboration->SetCollaboration( pConference );
mpCollaboration->SendFile( pContact, OStringToOUString(
pConference->getUuid(), RTL_TEXTENCODING_UTF8 ) );
}
}
......@@ -158,23 +147,23 @@ class TubeContacts : public ModelessDialog
fprintf( stderr, "could not start group session\n" );
else
{
ScDocFuncSend* pSender = EnsureScDocFuncSendInCurrentSfxObjectShell();
pSender->SetCollaboration( pConference );
mpCollaboration->SetCollaboration( pConference );
}
}
}
public:
TubeContacts() :
ModelessDialog( NULL, ScResId( RID_SCDLG_CONTACTS ) ),
maLabel( this, ScResId( FL_LABEL ) ),
maBtnConnect( this, ScResId( BTN_CONNECT ) ),
maBtnGroup( this, ScResId( BTN_GROUP ) ),
maBtnInvite( this, ScResId( BTN_INVITE ) ),
maBtnListen( this, ScResId( BTN_LISTEN ) ),
maListContainer( this, ScResId( CTL_LIST ) ),
TubeContacts( Collaboration* pCollaboration ) :
ModelessDialog( NULL, TubesResId( RID_TUBES_DLG_CONTACTS ) ),
maLabel( this, TubesResId( FL_LABEL ) ),
maBtnConnect( this, TubesResId( BTN_CONNECT ) ),
maBtnGroup( this, TubesResId( BTN_GROUP ) ),
maBtnInvite( this, TubesResId( BTN_INVITE ) ),
maBtnListen( this, TubesResId( BTN_LISTEN ) ),
maListContainer( this, TubesResId( CTL_LIST ) ),
maList( maListContainer ),
mpManager( new TeleManager() )
mpManager( new TeleManager() ),
mpCollaboration( pCollaboration )
{
Hide();
maBtnConnect.SetClickHdl( LINK( this, TubeContacts, BtnConnectHdl ) );
......@@ -189,9 +178,9 @@ public:
maList.SvxSimpleTable::SetTabs( aStaticTabs );
String sHeader( '\t' );
sHeader += String( ScResId( STR_HEADER_ALIAS ) );
sHeader += String( TubesResId( STR_HEADER_ALIAS ) );
sHeader += '\t';
sHeader += String( ScResId( STR_HEADER_NAME ) );
sHeader += String( TubesResId( STR_HEADER_NAME ) );
sHeader += '\t';
maList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT );
......@@ -200,6 +189,7 @@ public:
}
virtual ~TubeContacts()
{
delete mpCollaboration;
delete mpManager;
}
......@@ -278,10 +268,10 @@ IMPL_LINK_NOARG( TubeContacts, BtnListenHdl )
#endif
namespace tubes {
void createContacts()
void createContacts( Collaboration* pCollaboration )
{
#ifdef CONTACTS_DLG
static TubeContacts *pContacts = new TubeContacts();
static TubeContacts *pContacts = new TubeContacts( pCollaboration );
pContacts->Populate();
#endif
}
......
#include "sc.hrc" // -> RID_SCDLG_CONTACTS
#define RID_TUBES_DLG_CONTACTS 1000
#define FL_LABEL 1
#define CTL_LIST 2
......
#include "sc.hrc"
#include "contacts.hrc"
ModelessDialog RID_SCDLG_CONTACTS
ModelessDialog RID_TUBES_DLG_CONTACTS
{
HelpId = HID_SCPAGE_AREAS; // has to be something ...
HelpId = "TUBES_HID"; // has to be something ...
OutputSize = TRUE ;
SVLook = TRUE ;
Hide = FALSE ;
......
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