[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/sendfunc.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 184b8f8919bced256bcb2315e7c843b3ba9d8027 Author: Eike Rathke Date: Wed Mar 28 20:27:32 2012 +0200 tubes: LINK is gone diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 26f1ef5..5055136 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -275,7 +275,6 @@ public: void packetReceived( TeleConference* pConference, const rtl::OString & ); void fileReceived( rtl::OUString *rStr ); -DECL_LINK( ReceiveFileCallback, rtl::OUString * ); void RecvMessage( const rtl::OString &rString ) { ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source tubes/inc tubes/source
sc/source/ui/collab/contacts.cxx | 66 ++- sc/source/ui/collab/contacts.hxx |3 + sc/source/ui/collab/contacts.src |9 ++--- sc/source/ui/collab/sendfunc.cxx |3 + tubes/inc/tubes/manager.hxx |2 - tubes/source/manager.cxx |2 - 6 files changed, 69 insertions(+), 16 deletions(-) New commits: commit 5ac3317860a84750e4962bce15da76eb3cc3c84c Author: Michael Meeks Date: Fri Mar 23 17:54:06 2012 + tubes: make the contacts list show something diff --git a/sc/source/ui/collab/contacts.cxx b/sc/source/ui/collab/contacts.cxx index d517888..00e0392 100644 --- a/sc/source/ui/collab/contacts.cxx +++ b/sc/source/ui/collab/contacts.cxx @@ -30,15 +30,20 @@ #include #include "collab.hxx" +#include "contacts.hrc" +#include "scresid.hxx" +#include #include -#include +#include +#include +#include #include -// #define CONTACTS +#define CONTACTS_DLG #ifdef CONTACTS_DLG namespace { -class TubeContacts : ModelessDialog +class TubeContacts : public ModelessDialog { FixedLine maLabel; SvxSimpleTableContainer maListContainer; @@ -46,24 +51,69 @@ class TubeContacts : ModelessDialog public: TubeContacts() : -ModelessDialog( NULL, RID_SCDLG_CONTACTS ), +ModelessDialog( NULL, ScResId( RID_SCDLG_CONTACTS ) ), maLabel( this, ScResId( FL_LABEL ) ), maListContainer( this, ScResId( CTL_LIST ) ), -maList( maListContainer ), +maList( maListContainer ) { -SetMinOutputSizePixel( Size( 640, 480 ) ); +static long aStaticTabs[]= +{ +3 /* count */, 0, 20, 80, 150, 200 +}; + +maList.SvxSimpleTable::SetTabs( aStaticTabs ); +String sHeader( '\t' ); +sHeader += String( ScResId( STR_HEADER_ALIAS ) ); +sHeader += '\t'; +sHeader += String( ScResId( STR_HEADER_NAME ) ); +sHeader += '\t'; +maList.InsertHeaderEntry( sHeader, HEADERBAR_APPEND, HIB_LEFT ); Show(); } virtual ~TubeContacts() {} + +static rtl::OUString fromUTF8( const char *pStr ) +{ +return rtl::OStringToOUString( rtl::OString( pStr, strlen( pStr ) ), + RTL_TEXTENCODING_UTF8 ); +} + +void Populate( const TeleManager &rManager ) +{ +ContactList *pContacts = rManager.getContactList(); +if ( pContacts ) +{ +fprintf( stderr, "contacts !\n" ); +AccountContactPairV aPairs = pContacts->getContacts(); +AccountContactPairV::iterator it; +for( it = aPairs.begin(); it != aPairs.end(); it++ ) +{ +fprintf( stderr, "'%s' => '%s' '%s'\n", + tp_account_get_display_name( it->first ), + tp_contact_get_alias( it->second ), + tp_contact_get_identifier( it->second ) ); +rtl::OUStringBuffer aEntry( 128 ); +aEntry.append( sal_Unicode( '\t' ) ); +aEntry.append( fromUTF8 ( tp_contact_get_alias( it->second ) ) ); +aEntry.append( sal_Unicode( '\t' ) ); +aEntry.append( fromUTF8 ( tp_contact_get_identifier( it->second ) ) ); +aEntry.append( sal_Unicode( '\t' ) ); +SvLBoxEntry* pEntry = maList.InsertEntry( aEntry.makeStringAndClear() ); +// FIXME: ref the TpContact ... +pEntry->SetUserData( it->second ); +} +} +} }; } // anonymous namespace #endif namespace tubes { -void createContacts() +void createContacts( const TeleManager &rManager ) { #ifdef CONTACTS_DLG -new TubeContacts(); +TubeContacts *pContacts = new TubeContacts(); +pContacts->Populate( rManager ); #endif } } diff --git a/sc/source/ui/collab/contacts.hxx b/sc/source/ui/collab/contacts.hxx index 657df23..eba76a3 100644 --- a/sc/source/ui/collab/contacts.hxx +++ b/sc/source/ui/collab/contacts.hxx @@ -32,8 +32,9 @@ #include "collab.hxx" #include +class TeleManager; namespace tubes { -void createContacts(); +void createContacts( const TeleManager &rContacts ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/collab/contacts.src b/sc/source/ui/collab/contacts.src index 0972920..6a1081f 100644 --- a/sc/source/ui/collab/contacts.src +++ b/sc/source/ui/collab/contacts.src @@ -9,19 +9,20 @@ ModelessDialog RID_SCDLG_CONTACTS Hide = FALSE ; Moveable = TRUE ; Closeable = TRUE ; -Size = MAP_APPFONT ( 320 , 480 ) ; +Size = MAP_APPFONT ( 220 , 200 ) ; +OutputSize = TRUE ; Text [ en-US ] = "Contacts" ; FixedLine FL_LABEL { Pos = MAP_APPFONT ( 6 , 3 ) ; Size = MAP_APPFONT ( 400 , 8 ) ; -Text [ en-US ] = "Here are your contacts" ; +Text [ en-US ] = "Select a contact to collaborate with" ; }; Control CTL_LIST {
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/collab.cxx |6 ++ sc/source/ui/collab/sendfunc.cxx | 12 ++-- sc/source/ui/inc/collab.hxx | 12 +--- 3 files changed, 13 insertions(+), 17 deletions(-) New commits: commit 762ed00a6b9ee7fbbbf88b59ad751223d0d70227 Author: Will Thompson Date: Fri Mar 23 17:40:21 2012 + Replace file received link with a signal. diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index a68ba45..4c02045 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -31,9 +31,8 @@ #include #include -ScCollaboration::ScCollaboration( const Link& rLinkFile ) +ScCollaboration::ScCollaboration() : -maLinkFile( rLinkFile ), mpAccount( NULL), mpContact( NULL), mpManager( NULL) @@ -57,8 +56,7 @@ void ScCollaboration::receivedFile( rtl::OUString &rFileURL ) { fprintf( stderr, "file recieved '%s'\n", rtl::OUStringToOString( rFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); -if ( maLinkFile.IsSet() ) -maLinkFile.Call( &rFileURL ); +sigFileReceived( &rFileURL ); } void ScCollaboration::packetReceivedCallback( TeleConference *pConference, TelePacket &rPacket ) diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 38c598f..66db1d2 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -262,6 +262,7 @@ public: } void packetReceived( TeleConference* pConference, const rtl::OString & ); +void fileReceived( rtl::OUString *rStr ); DECL_LINK( ReceiveFileCallback, rtl::OUString * ); void RecvMessage( const rtl::OString &rString ) @@ -301,12 +302,12 @@ public: } }; -void ScDocFuncRecv::packetReceived( TeleConference* pConference, const rtl::OString &rStr) +void ScDocFuncRecv::packetReceived( TeleConference*, const rtl::OString &rStr) { RecvMessage( rStr); } -IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) +void ScDocFuncRecv::fileReceived( rtl::OUString *pStr ) { fprintf( stderr, "incoming file '%s'\n", rtl::OUStringToOString( *pStr, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -362,8 +363,6 @@ IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) fprintf( stderr, "exception when loading '%s' !\n", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); } - -return 0; } class ScDocFuncSend : public ScDocFunc @@ -552,10 +551,11 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() ScDocFuncRecv* pReceiver = new ScDocFuncRecv( *this, new ScDocFuncDirect( *this ) ); ScDocFuncSend* pSender = new ScDocFuncSend( *this, pReceiver ); bool bOk = true; -ScCollaboration* pCollab = new ScCollaboration( -LINK( pReceiver, ScDocFuncRecv, ReceiveFileCallback) ); +ScCollaboration* pCollab = new ScCollaboration(); pCollab->sigPacketReceived.connect( boost::bind( &ScDocFuncRecv::packetReceived, pReceiver, _1, _2 )); +pCollab->sigFileReceived.connect( +boost::bind( &ScDocFuncRecv::fileReceived, pReceiver, _1)); bOk = bOk && pCollab->initManager(); if (!strcmp( pEnv, "master")) { diff --git a/sc/source/ui/inc/collab.hxx b/sc/source/ui/inc/collab.hxx index 0337b79..df059ad 100644 --- a/sc/source/ui/inc/collab.hxx +++ b/sc/source/ui/inc/collab.hxx @@ -30,7 +30,6 @@ #define INCLUDED_SC_COLLAB_HXX #include -#include #include typedef struct _TpContact TpContact; @@ -44,10 +43,7 @@ class ScCollaboration { public: -/** @param rLink -Callback when a file is received, called with TeleConference* - */ -ScCollaboration( const Link& rLinkFile ); +ScCollaboration(); ~ScCollaboration(); boolinitManager(); @@ -61,14 +57,16 @@ public: boolrecvPacket( rtl::OString& rString, TeleConference* pConference ); voidsendFile( rtl::OUString &rFileURL ); -voidreceivedFile( rtl::OUString &rFileURL ); +/** Emitted when a file is received + */ +boost::signals2::signal sigFileReceived; /* Internal callbacks */ voidpacketReceivedCallback( TeleConference *pConference, TelePacket &rPacket ); +voidreceivedFile( rtl::OUString &rFileURL ); private: -LinkmaLinkFile; TpAccount* mpAccount; TpContact* mpContact; TeleManager*mpManager; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source tubes/inc tubes/qa tubes/source
sc/source/ui/collab/collab.cxx | 26 ++ sc/source/ui/collab/sendfunc.cxx | 10 -- sc/source/ui/inc/collab.hxx |5 +++-- tubes/inc/tubes/manager.hxx | 10 +++--- tubes/qa/test_manager.cxx| 19 +-- tubes/source/conference.cxx |2 +- tubes/source/manager.cxx | 12 +++- 7 files changed, 29 insertions(+), 55 deletions(-) New commits: commit 30ad3ccd848e0832d5dd669b3feb9579e5248ba8 Author: Will Thompson Date: Fri Mar 23 17:14:36 2012 + Include packet in packetReceived signals. (And also signalify receiving files.) diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index cf8777c..a68ba45 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -61,28 +61,22 @@ void ScCollaboration::receivedFile( rtl::OUString &rFileURL ) maLinkFile.Call( &rFileURL ); } -extern "C" { -void file_recv_cb( rtl::OUString &localUri, void* pUserData ) -{ -ScCollaboration *pCollab = reinterpret_cast( pUserData ); -pCollab->receivedFile( localUri ); -} -} - -void ScCollaboration::packetReceivedCallback( TeleConference *pConference ) +void ScCollaboration::packetReceivedCallback( TeleConference *pConference, TelePacket &rPacket ) { +rtl::OString aString( rPacket.getData(), rPacket.getSize()); /* Relay the signal out⦠*/ -sigPacketReceived( pConference); +sigPacketReceived( pConference, aString); } bool ScCollaboration::initManager() { mpManager = TeleManager::get(); mpManager->sigPacketReceived.connect( -boost::bind( &ScCollaboration::packetReceivedCallback, this, _1 )); +boost::bind( &ScCollaboration::packetReceivedCallback, this, _1, _2 )); mpManager->connect(); mpManager->prepareAccountManager(); -mpManager->setFileReceivedCallback( file_recv_cb, (void *)this ); +mpManager->sigFileReceived.connect( +boost::bind( &ScCollaboration::receivedFile, this, _1 )); return true; } @@ -119,14 +113,6 @@ bool ScCollaboration::sendPacket( const rtl::OString& rString ) } -bool ScCollaboration::recvPacket( rtl::OString& rString, TeleConference* pConference ) -{ -TelePacket aPacket; -bool bOk = (pConference ? pConference->popPacket( aPacket) : mpManager->popPacket( aPacket)); -rString = rtl::OString( aPacket.getData(), aPacket.getSize()); -return bOk; -} - extern "C" { static void file_sent_cb( bool aSuccess, void* /* pUserData */ ) { diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 08383fa..38c598f 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -261,7 +261,7 @@ public: mpCollab = pCollab; } -void packetReceived( TeleConference* pConference); +void packetReceived( TeleConference* pConference, const rtl::OString & ); DECL_LINK( ReceiveFileCallback, rtl::OUString * ); void RecvMessage( const rtl::OString &rString ) @@ -301,11 +301,9 @@ public: } }; -void ScDocFuncRecv::packetReceived( TeleConference* pConference) +void ScDocFuncRecv::packetReceived( TeleConference* pConference, const rtl::OString &rStr) { -rtl::OString aStr; -if (mpCollab && mpCollab->recvPacket( aStr, pConference)) -RecvMessage( aStr); +RecvMessage( rStr); } IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) @@ -557,7 +555,7 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() ScCollaboration* pCollab = new ScCollaboration( LINK( pReceiver, ScDocFuncRecv, ReceiveFileCallback) ); pCollab->sigPacketReceived.connect( -boost::bind( &ScDocFuncRecv::packetReceived, pReceiver, _1 )); +boost::bind( &ScDocFuncRecv::packetReceived, pReceiver, _1, _2 )); bOk = bOk && pCollab->initManager(); if (!strcmp( pEnv, "master")) { diff --git a/sc/source/ui/inc/collab.hxx b/sc/source/ui/inc/collab.hxx index faf8145..0337b79 100644 --- a/sc/source/ui/inc/collab.hxx +++ b/sc/source/ui/inc/collab.hxx @@ -37,6 +37,7 @@ typedef struct _TpContact TpContact; typedef struct _TpAccount TpAccount; class TeleManager; class TeleConference; +class TelePacket; namespace rtl { class OString; class OUString; } class ScCollaboration @@ -56,14 +57,14 @@ public: boolsendPacket( const rtl::OString& rString ); /** Emitted when a packet is received */ -boost::signals2::signal sigPacketReceived; +boost::signals2::signal sigPacketReceived; boolrecvPacket( rtl::OString& rString, TeleConference* pConference ); voidsendFile( rtl::OUString &rFileURL ); voidreceivedFile( rtl::OUString &rFileURL ); /* Internal callbacks */ -voidpacketReceivedCallback( TeleConference *pConference );
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source tubes/source
sc/source/ui/collab/sendfunc.cxx |4 +++- tubes/source/manager.cxx |3 --- 2 files changed, 3 insertions(+), 4 deletions(-) New commits: commit 95a53ef4250708759a5631d98b2f567dceeb8750 Author: Michael Meeks Date: Fri Mar 23 14:10:36 2012 + tubes: calm debug thrash and get master connections right. diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 771ee8b..1026d9b 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -523,9 +523,11 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() LINK( pReceiver, ScDocFuncRecv, ReceiverCallback), LINK( pReceiver, ScDocFuncRecv, ReceiveFileCallback) ); bOk = bOk && pCollab->initManager(); -bOk = bOk && pCollab->initAccountContact(); if (!strcmp( pEnv, "master")) +{ +bOk = bOk && pCollab->initAccountContact(); bOk = bOk && pCollab->startCollaboration(); +} if (bOk) { pReceiver->SetCollaboration( pCollab); diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index 74145ec..f9ca143 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -874,7 +874,6 @@ void TeleManager::iterateLoop( CallBackInvokedFunc pFunc ) GMainContext* pContext = getMainContext(); while (!(*pFunc)()) { -SAL_INFO( "tubes.loop", "TeleManager::iterateLoop: CallBackInvokedFunc"); g_main_context_iteration( pContext, TRUE); } } @@ -885,7 +884,6 @@ void TeleManager::iterateLoop( ManagerCallBackInvokedFunc pFunc ) GMainContext* pContext = getMainContext(); while (!(this->*pFunc)()) { -SAL_INFO( "tubes.loop", "TeleManager::iterateLoop: ManagerCallBackInvokedFunc"); g_main_context_iteration( pContext, TRUE); } } @@ -896,7 +894,6 @@ void TeleManager::iterateLoop( const TeleConference* pConference, ConferenceCall GMainContext* pContext = getMainContext(); while (!(pConference->*pFunc)()) { -SAL_INFO( "tubes.loop", "TeleManager::iterateLoop: ConferenceCallBackInvokedFunc"); g_main_context_iteration( pContext, TRUE); } } ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/sendfunc.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 171bb4d0cd214ad436c691b1683c7cb7139c5920 Author: Michael Meeks Date: Fri Mar 23 13:13:30 2012 + tubes: more helpful exception printing on file load failure diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 50d6649..771ee8b 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -327,9 +327,10 @@ IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) rDocShell.GetBaseModel(), css::uno::UNO_QUERY_THROW ); xLoad->load( aLoadArgs ); } -catch ( css::uno::Exception& ) +catch ( css::uno::Exception& e ) { -fprintf( stderr, "exception when loading !\n" ); +fprintf( stderr, "exception when loading '%s' !\n", + rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); } return 0; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/sendfunc.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 5db9b41638b66b1198b65b72d31c36613475fd25 Author: Michael Meeks Date: Fri Mar 23 11:32:13 2012 + tubes: fix crash with no collaboration setup diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 4e16629..50d6649 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -374,7 +374,8 @@ class ScDocFuncSend : public ScDocFunc fprintf( stderr, "Temp file is '%s'\n", rtl::OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); -mpCollab->sendFile( aFileURL ); +if ( mpCollab ) +mpCollab->sendFile( aFileURL ); } public: ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/sendfunc.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 9a02dc094aaf9f7051fdcc103f1c2ef80e372479 Author: Eike Rathke Date: Fri Mar 23 12:39:35 2012 +0100 tubes: start session only if LIBO_TUBES=master diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index afeef96..4e16629 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -509,9 +509,10 @@ public: SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() { // FIXME: the chains should be auto-ptrs, so should be collab +const char* pEnv; if (getenv ("INTERCEPT")) return new ScDocFuncSend( *this, new ScDocFuncRecv( *this, new ScDocFuncDirect( *this ) ) ); -else if (getenv ("LIBO_TUBES")) +else if ((pEnv = getenv ("LIBO_TUBES")) != NULL) { ScDocFuncRecv* pReceiver = new ScDocFuncRecv( *this, new ScDocFuncDirect( *this ) ); ScDocFuncSend* pSender = new ScDocFuncSend( *this, pReceiver ); @@ -521,7 +522,8 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() LINK( pReceiver, ScDocFuncRecv, ReceiveFileCallback) ); bOk = bOk && pCollab->initManager(); bOk = bOk && pCollab->initAccountContact(); -bOk = bOk && pCollab->startCollaboration(); +if (!strcmp( pEnv, "master")) +bOk = bOk && pCollab->startCollaboration(); if (bOk) { pReceiver->SetCollaboration( pCollab); ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/collab.cxx | 37 ++-- sc/source/ui/collab/sendfunc.cxx | 44 +-- sc/source/ui/inc/collab.hxx | 12 +++--- 3 files changed, 85 insertions(+), 8 deletions(-) New commits: commit fe1107971a734ddc3e06b1d05f1295331338715c Author: Michael Meeks Date: Fri Mar 23 11:29:48 2012 + tubes: add hooks for send / recv file (untested) diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index 87d6f93..fdb1a30 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -31,9 +31,11 @@ #include #include -ScCollaboration::ScCollaboration( const Link& rLink ) +ScCollaboration::ScCollaboration( const Link& rLinkPacket, + const Link& rLinkFile ) : -maLink( rLink), +maLinkPacket( rLinkPacket ), +maLinkFile( rLinkFile ), mpAccount( NULL), mpContact( NULL), mpManager( NULL) @@ -51,11 +53,28 @@ ScCollaboration::~ScCollaboration() } +void ScCollaboration::receivedFile( rtl::OUString &rFileURL ) +{ +fprintf( stderr, "file recieved '%s'\n", + rtl::OUStringToOString( rFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); +if ( maLinkFile.IsSet() ) +maLinkFile.Call( &rFileURL ); +} + +extern "C" { +void file_recv_cb( rtl::OUString &localUri, void* pUserData ) +{ +ScCollaboration *pCollab = reinterpret_cast( pUserData ); +pCollab->receivedFile( localUri ); +} +} + bool ScCollaboration::initManager() { -mpManager = new TeleManager( maLink); +mpManager = new TeleManager( maLinkPacket ); bool bOk = mpManager->connect(); mpManager->prepareAccountManager(); +mpManager->setFileReceivedCallback( file_recv_cb, (void *)this ); return bOk; } @@ -97,4 +116,16 @@ bool ScCollaboration::recvPacket( rtl::OString& rString, TeleConference* pConfer return bOk; } +extern "C" { +static void file_sent_cb( bool aSuccess, void* /* pUserData */ ) +{ +fprintf( stderr, "File send %s\n", aSuccess ? "success" : "failed" ); +} +} + +void ScCollaboration::sendFile( rtl::OUString &rFileURL ) +{ +mpManager->sendFile( rFileURL, file_sent_cb, NULL ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index ed08955..afeef96 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -37,9 +37,12 @@ #include // new file send/recv fun ... +#include #include #include #include +#include +#include #include namespace css = ::com::sun::star; @@ -253,6 +256,7 @@ public: } DECL_LINK( ReceiverCallback, TeleConference* ); +DECL_LINK( ReceiveFileCallback, rtl::OUString * ); void RecvMessage( const rtl::OString &rString ) { @@ -299,6 +303,38 @@ IMPL_LINK( ScDocFuncRecv, ReceiverCallback, TeleConference*, pConference ) return 0; } +IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr ) +{ +fprintf( stderr, "incoming file '%s'\n", + rtl::OUStringToOString( *pStr, RTL_TEXTENCODING_UTF8 ).getStr() ); + +css::uno::Sequence < css::beans::PropertyValue > aLoadArgs(5); +aLoadArgs[0].Name = rtl::OUString( "URL" ); +aLoadArgs[0].Value <<= (*pStr); +aLoadArgs[1].Name = rtl::OUString( "FilterName" ); +aLoadArgs[1].Value <<= rtl::OUString( "calc8" ); +aLoadArgs[2].Name = rtl::OUString( "Referer" ); +aLoadArgs[2].Value <<= rtl::OUString( "" ); +// no interaction handler ? +aLoadArgs[3].Name = rtl::OUString( "MacroExecutionMode" ); +aLoadArgs[3].Value <<= sal_Int32( 3 ); +aLoadArgs[4].Name = rtl::OUString( "UpdateDocMode" ); +aLoadArgs[4].Value <<= sal_Int32( 2 ); + +try +{ +css::uno::Reference < css::frame::XLoadable > xLoad( +rDocShell.GetBaseModel(), css::uno::UNO_QUERY_THROW ); +xLoad->load( aLoadArgs ); +} +catch ( css::uno::Exception& ) +{ +fprintf( stderr, "exception when loading !\n" ); +} + +return 0; +} + class ScDocFuncSend : public ScDocFunc { ScDocFuncRecv *mpChain; @@ -337,7 +373,9 @@ class ScDocFuncSend : public ScDocFunc fprintf( stderr, "Temp file is '%s'\n", rtl::OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); -} + +mpCollab->sendFile( aFileURL ); +} public: // FIXME: really ScDocFunc should be an abstract base, so @@ -478,7 +516,9 @@ SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc() ScDocFuncRecv* pReceiver = new ScDocFuncRecv( *this, new ScDocFuncDirect( *this ) ); ScDocFuncSend* pSender = new ScDocFuncSend( *this, pReceiver ); bool bOk = true; -ScCollaboration* pCollab = new ScCollaboration( LINK( pReceiver, ScDocFuncRecv, ReceiverCallback)); +ScCollaboration* pCollab = new
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/collab.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit f202e7f9e73331d8271cb00c314bdbcefd176d45 Author: Eike Rathke Date: Fri Mar 23 11:44:15 2012 +0100 tubes: adapt to new contact list interface diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx index bc0c99e..87d6f93 100644 --- a/sc/source/ui/collab/collab.cxx +++ b/sc/source/ui/collab/collab.cxx @@ -55,14 +55,15 @@ bool ScCollaboration::initManager() { mpManager = new TeleManager( maLink); bool bOk = mpManager->connect(); +mpManager->prepareAccountManager(); return bOk; } bool ScCollaboration::initAccountContact() { -ContactList aContacts; -AccountContactPairV aVec( aContacts.getContacts()); +ContactList* pContactList = mpManager->getContactList(); +AccountContactPairV aVec( pContactList->getContacts()); if (aVec.empty()) return false; ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source tubes/inc tubes/qa tubes/source
sc/source/ui/collab/collab.cxx | 99 +++ sc/source/ui/collab/sendfunc.cxx | 58 +- sc/source/ui/inc/collab.hxx | 67 ++ tubes/inc/tubes/conference.hxx |3 - tubes/inc/tubes/manager.hxx | 15 - tubes/qa/test_manager.cxx| 15 + tubes/source/conference.cxx |2 tubes/source/manager.cxx | 13 - 8 files changed, 261 insertions(+), 11 deletions(-) New commits: commit cc604f84d6fca6f01c82a1714c814f999e0b3eac Author: Eike Rathke Date: Fri Mar 23 10:55:09 2012 +0100 tubes: wrapper to enable tubes If environment variable LIBO_TUBES is set, Calc's ScDocFuncSend and ScDocFuncRecv act over tubes. diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx new file mode 100644 index 000..bc0c99e --- /dev/null +++ b/sc/source/ui/collab/collab.cxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * Copyright (C) 2012 Red Hat, Inc., Eike Rathke + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include "collab.hxx" +#include +#include +#include + +ScCollaboration::ScCollaboration( const Link& rLink ) +: +maLink( rLink), +mpAccount( NULL), +mpContact( NULL), +mpManager( NULL) +{ +} + + +ScCollaboration::~ScCollaboration() +{ +if (mpAccount) +g_object_unref( mpAccount); +if (mpContact) +g_object_unref( mpContact); +delete mpManager; +} + + +bool ScCollaboration::initManager() +{ +mpManager = new TeleManager( maLink); +bool bOk = mpManager->connect(); +return bOk; +} + + +bool ScCollaboration::initAccountContact() +{ +ContactList aContacts; +AccountContactPairV aVec( aContacts.getContacts()); +if (aVec.empty()) +return false; + +/* TODO: select a pair, for now just take the first */ +mpAccount = aVec[0].first; +mpContact = aVec[0].second; +return true; +} + + +bool ScCollaboration::startCollaboration() +{ +bool bOk = mpManager->startBuddySession( mpAccount, mpContact); +return bOk; +} + + +bool ScCollaboration::sendPacket( const rtl::OString& rString ) +{ +TelePacket aPacket( "sender", rString.getStr(), rString.getLength()); +bool bOk = mpManager->sendPacket( aPacket); +return bOk; +} + + +bool ScCollaboration::recvPacket( rtl::OString& rString, TeleConference* pConference ) +{ +TelePacket aPacket; +bool bOk = (pConference ? pConference->popPacket( aPacket) : mpManager->popPacket( aPacket)); +rString = rtl::OString( aPacket.getData(), aPacket.getSize()); +return bOk; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index 9d9a10c..ed08955 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -33,6 +33,8 @@ #include "cell.hxx" #include "docsh.hxx" #include "docfunc.hxx" +#include "collab.hxx" +#include // new file send/recv fun ... #include @@ -233,16 +235,25 @@ public: class ScDocFuncRecv : public ScDocFunc { ScDocFunc *mpChain; +ScCollaboration* mpCollab; public: // FIXME: really ScDocFunc should be an abstract base ScDocFuncRecv( ScDocShell& rDocSh, ScDocFunc *pChain ) : ScDocFunc( rDocSh ), - mpChain( pChain ) + mpChain( pChain ), + mpCollab( NULL) { fprintf( stderr, "Receiver created !\n" ); } virtual ~ScDocFuncRecv() {} +void SetCollaboration( ScCollaboration* pCollab ) +{ +mpCollab = pCollab; +} + +DECL_LINK( ReceiverCallback, TeleConference* ); + void RecvMessage( const rtl::OString &rString ) { try { @@ -280,14 +291,26 @@ public: } }; +IMPL_LINK( ScDocFuncRecv, ReceiverCallback, TeleConference*, pConference ) +{ +rtl::OString aStr; +if (mpCollab && mpCollab->recvPacket( aStr, pConference
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/sendfunc.cxx | 38 ++ sc/source/ui/inc/docfunc.hxx |3 +-- 2 files changed, 39 insertions(+), 2 deletions(-) New commits: commit 96fc7b84dd6820acd6fb59116ee69bf383bbdb80 Author: Michael Meeks Date: Thu Mar 22 19:44:44 2012 + tubes: re-use autorecovery to serialize to a file for exchange diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index f1aec1b..9d9a10c 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -34,6 +34,14 @@ #include "docsh.hxx" #include "docfunc.hxx" +// new file send/recv fun ... +#include +#include +#include +#include + +namespace css = ::com::sun::star; + namespace { rtl::OUString cellToString( ScBaseCell *pCell ) @@ -282,6 +290,32 @@ class ScDocFuncSend : public ScDocFunc mpChain->RecvMessage( rOp.toString() ); } +void SendFile( const rtl::OUString &rURL ) +{ +(void)rURL; + +String aTmpPath = utl::TempFile::CreateTempName(); +aTmpPath.Append( rtl::OUString( ".ods" ) ); + +rtl::OUString aFileURL; +::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTmpPath, aFileURL ); + +::comphelper::MediaDescriptor aDescriptor; +// some issue with hyperlinks: +aDescriptor[::comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL()] <<= ::rtl::OUString(); +try { +css::uno::Reference< css::document::XDocumentRecovery > xDocRecovery( +rDocShell.GetBaseModel(), css::uno::UNO_QUERY_THROW); + +xDocRecovery->storeToRecoveryFile( aFileURL, aDescriptor.getAsConstPropertyValueList() ); +} catch (const css::uno::Exception &ex) { +fprintf( stderr, "exception foo !\n" ); +} + +fprintf( stderr, "Temp file is '%s'\n", + rtl::OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8 ).getStr() ); +} + public: // FIXME: really ScDocFunc should be an abstract base, so // we don't need the rDocSh hack/pointer @@ -314,6 +348,10 @@ public: aOp.appendString( rText ); aOp.appendBool( bApi ); SendMessage( aOp ); + +if ( rtl::OUString( rText ) == "saveme" ) +SendFile( rText ); + return true; // needs some code auditing action } diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx index e47442e..1303f5e 100644 --- a/sc/source/ui/inc/docfunc.hxx +++ b/sc/source/ui/inc/docfunc.hxx @@ -57,7 +57,7 @@ struct ScCellMergeOption; class ScDocFunc { -private: +protected: ScDocShell&rDocShell; sal_BoolAdjustRowHeight( const ScRange& rRange, sal_Bool bPaint = true ); @@ -67,7 +67,6 @@ private: sal_Bool& rCancel, sal_Bool bApi ); voidNotifyInputHandler( const ScAddress& rPos ); -protected: ScDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {} public: virtual ~ScDocFunc() {} ___ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/collab/sendfunc.cxx | 189 --- sc/source/ui/view/viewfunc.cxx |3 2 files changed, 156 insertions(+), 36 deletions(-) New commits: commit 503f0d340997c95d9077be0fec21ee07aa3d4a02 Author: Michael Meeks Date: Thu Mar 22 12:31:15 2012 + tubes: chain noddy serialize & de-serialize to partial docfunc re-impl. diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx index ccc785d..0de59bf 100644 --- a/sc/source/ui/collab/sendfunc.cxx +++ b/sc/source/ui/collab/sendfunc.cxx @@ -27,45 +27,172 @@ */ #include "sal/config.h" + +#include + #include "cell.hxx" #include "docsh.hxx" #include "docfunc.hxx" namespace { -// Ye noddy protocol ! -// method name ',' then arguments comma separated -class ScChangeOp +// Ye noddy mangling - needs improvement ... +// method name ';' then arguments ; separated +class ScChangeOpWriter { rtl::OUStringBuffer aMessage; + void appendSeparator() + { + aMessage.append( sal_Unicode( ';' ) ); + } public: - ScChangeOp( const char *pName ) + + ScChangeOpWriter( const char *pName ) + { + aMessage.appendAscii( pName ); + appendSeparator(); + } + + void appendString( const rtl::OUString &rStr ) { -aMessage.appendAscii( pName ); -aMessage.append( sal_Unicode( ',' ) ); + aMessage.append( rStr ); + appendSeparator(); } - void appendString( const ScAddress &rPos ) + void appendString( const String &rStr ) { -rtl::OUString aStr; -rPos.Format( aStr ); -aMessage.append( aStr ); + aMessage.append( rStr ); + appendSeparator(); } void appendAddress( const ScAddress &rPos ) { -(void)rPos; + rtl::OUString aStr; + rPos.Format( aStr, SCA_VALID ); + aMessage.append( aStr ); + appendSeparator(); + } + + void appendInt( sal_Int32 i ) + { + aMessage.append( i ); + appendSeparator(); + } + + void appendBool( sal_Bool b ) + { + aMessage.appendAscii( b ? "true" : "false" ); + appendSeparator(); + } + + rtl::OString toString() + { + return rtl::OUStringToOString( aMessage.toString(), RTL_TEXTENCODING_UTF8 ); } }; -class ScDocFuncIntercept : public ScDocFunc +struct ProtocolError { +const char *message; +}; + +class ScChangeOpReader { +std::vector< rtl::OString > maArgs; + +public: + +ScChangeOpReader( const rtl::OString &rString) +{ +// will need to handle escaping etc. +for (sal_Int32 n = 0; n >= 0 && n < rString.getLength();) +maArgs.push_back( rString.getToken( 0, ';', n ) ); +} +~ScChangeOpReader() {} + +rtl::OString getMethod() +{ +return maArgs[0]; +} + +size_t getArgCount() { return maArgs.size(); } + +rtl::OUString getString( sal_Int32 n ) +{ +if (n > 0 && (size_t)n < getArgCount() ) +return rtl::OUString( maArgs[n].getStr(), maArgs[n].getLength(), + RTL_TEXTENCODING_UTF8 ); +else +return rtl::OUString(); +} + +ScAddress getAddress( sal_Int32 n ) +{ +ScAddress aAddr; +rtl::OUString aToken( getString( n ) ); +aAddr.Parse( aToken ); +return aAddr; +} + +bool getBool( sal_Int32 n ) +{ +if (n > 0 && (size_t)n < getArgCount() ) +return maArgs[n].equalsIgnoreAsciiCase( "true" ); +else +return false; +} +}; + + +class ScDocFuncRecv : public ScDocFunc { +ScDocFunc *mpChain; public: -ScDocFuncIntercept( ScDocShell& rDocSh ) : ScDocFunc( rDocSh ) +// FIXME: really ScDocFunc should be an abstract base +ScDocFuncRecv( ScDocShell& rDocSh, ScDocFunc *pChain ) +: ScDocFunc( rDocSh ), + mpChain( pChain ) { -fprintf( stderr, "Interceptor created !\n" ); +fprintf( stderr, "Receiver created !\n" ); } -virtual ~ScDocFuncIntercept() {} +virtual ~ScDocFuncRecv() {} + +void RecvMessage( const rtl::OString &rString ) +{ +try { +ScChangeOpReader aReader( rString ); +// FIXME: have some hash to enumeration mapping here +if ( aReader.getMethod() == "setNormalString" ) +mpChain->SetNormalString( aReader.getAddress( 1 ), aReader.getString( 2 ), + aReader.getBool( 3 ) ); +else +fprintf( stderr, "Error: unknown message '%s' (%d)\n", + rString.getStr(), (int)aReader.getArgCount() ); +} catch (const ProtocolError &e) { +fprintf( stderr, "Error: protocol twisting '%s'\n", e.message ); +} +} +}; + +class ScDocFuncSend : public ScDocFunc +{ +ScDocFuncRecv *mpChain; + +void SendMessage( ScChangeOpWriter &rOp ) +{ +fprintf( stderr, "Op: '%s'\n", rOp.toString().getStr() ); +mpChain->RecvMessage( rOp.toString() ); +} + +public: +// FIXME: rea
[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
sc/source/ui/docshell/docfunc.cxx | 15 ++- sc/source/ui/docshell/docsh.cxx |2 sc/source/ui/view/viewfunc.cxx| 152 +++--- 3 files changed, 41 insertions(+), 128 deletions(-) New commits: commit 9570147a927e5db8e3944deb8cb1045d685f59ea Author: Michael Meeks Date: Wed Mar 21 18:21:23 2012 + re-direct EnterData and turn it into many smaller ops. diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 5cb7c18..294dd76 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -859,12 +859,19 @@ sal_Bool ScDocFunc::PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bo pDoc->PutCell( rPos, pNewCell ); -// wegen ChangeTracking darf UndoAction erst nach PutCell angelegt werden -if (bUndo) +if ( !bXMLLoading && pNewCell->GetCellType() == CELLTYPE_FORMULA && !pDoc->GetAutoCalc() ) { +ScFormulaCell *pFormCell = static_cast( pNewCell ); +// calculate just the cell once and set Dirty again +pFormCell->Interpret(); +pFormCell->SetDirtyVar(); +pDoc->PutInFormulaTree( pFormCell ); +} + +// wegen ChangeTracking darf UndoAction erst nach PutCell angelegt werden +if (bUndo) rDocShell.GetUndoManager()->AddUndoAction( new ScUndoPutCell( &rDocShell, rPos, pUndoCell, pRedoCell, bHeight ) ); -} if (bHeight) AdjustRowHeight( ScRange(rPos) ); @@ -1283,7 +1290,7 @@ sal_Bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAtt sal_Bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const String& rStyleName, -sal_Bool bRecord, sal_Bool bApi ) +sal_Bool bRecord, sal_Bool bApi ) { ScDocument* pDoc = rDocShell.GetDocument(); if ( bRecord && !pDoc->IsUndoEnabled() ) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 0485370..e57c751 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2544,7 +2544,7 @@ public: virtual sal_Bool PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, sal_Bool bApi ) { -fprintf( stderr, "put cell string '%p' %d\n", pNewCell, bApi ); +fprintf( stderr, "put cell '%p' type %d %d\n", pNewCell, pNewCell->GetCellType(), bApi ); return ScDocFunc::PutCell( rPos, pNewCell, bApi ); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 28600b5..6277537 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -212,7 +212,7 @@ sal_Bool ScViewFunc::TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Boo } void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, -sal_Bool bAttrChanged, sal_Bool bAddUndo ) + sal_Bool bAttrChanged, sal_Bool bAddUndo ) { ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDocument* pDoc = pDocSh->GetDocument(); @@ -226,27 +226,18 @@ void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr* pDocOld = pDoc->GetPattern( nCol, nRow, nTab ); // pDocOld is only valid till call ApplyPattern! -ScPatternAttr* pOldPattern = NULL; -if ( bAddUndo ) -pOldPattern = new ScPatternAttr( *pDocOld ); - const ScStyleSheet* pSrcStyle = pSource->GetStyleSheet(); -if ( pSrcStyle && pSrcStyle != pDocOld->GetStyleSheet() ) -pDoc->ApplyStyle( nCol, nRow, nTab, *pSrcStyle ); -pDoc->ApplyPattern( nCol, nRow, nTab, *pSource ); -AdjustRowHeight( nRow, nRow, sal_True );//! nicht doppelt ? -if ( bAddUndo ) -{ -const ScPatternAttr* pNewPattern = pDoc->GetPattern( nCol, nRow, nTab ); +// Ho hum ... - totally untested but looks fun ! :-) +ScRange aRange( nCol, nRow, nTab, nCol, nRow, nTab ); +ScMarkData aMark; +aMark.SetMarkArea( aRange ); -pDocSh->GetUndoManager()->AddUndoAction( -new ScUndoCursorAttr( pDocSh, nCol, nRow, nTab, - pOldPattern, pNewPattern, pSource, - sal_True ) ); +ScDocFunc &rFunc = GetViewData()->GetDocFunc(); +if ( pSrcStyle && pSrcStyle != pDocOld->GetStyleSheet() ) +rFunc.ApplyStyle( aMark, pSrcStyle->GetName(), sal_True, sal_False ); -delete pOldPattern; // copied in undo (pool) -} +rFunc.ApplyAttributes( aMark, *pSource, sal_True, sal_False ); } if ( bAttrChanged ) // value entered with number format? @@ -359,75 +350,21 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { ScDocument* pDoc = GetViewData()->GetDocumen