[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - sc/source tubes/inc tubes/qa tubes/source

2012-03-23 Thread Will Thompson
 sc/source/ui/collab/collab.cxx |3 +++
 tubes/inc/tubes/conference.hxx |3 ++-
 tubes/qa/test_manager.cxx  |   11 ---
 tubes/source/conference.cxx|   17 ++---
 tubes/source/manager.cxx   |2 --
 5 files changed, 27 insertions(+), 9 deletions(-)

New commits:
commit 1e8d2df6c52ad41375982dac8d4b75d776544161
Author: Will Thompson 
Date:   Fri Mar 23 14:24:56 2012 +

tubes: push sent packets onto the incoming queue.

This ensures that our changes are echoed locally as well as being sent
to the peer.

diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 8a891d5..35812bb 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -63,13 +63,14 @@ public:
 /** @param rPacket
 non-const on purpose, see TelePacket::getData()
  */
-boolsendPacket( TelePacket& rPacket ) const;
+boolsendPacket( TelePacket& rPacket );
 
 /** Pop a received packet. */
 TUBES_DLLPUBLIC boolpopPacket( TelePacket& rPacket );
 
 /** Queue incoming data as TelePacket */
 voidqueue( const char* pDBusSender, const char* 
pPacket, int nSize );
+voidqueue( TelePacket &rPacket );
 
 
 typedef void  (*FileSentCallback)( bool aSuccess, void* pUserData);
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index a7e690f..f76353d 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -279,6 +279,11 @@ void TestTeleTubes::testReceivePacket()
 TelePacket aPacket( "", RTL_CONSTASCII_STRINGPARAM( "from 1 to 2"));
 TelePacket aReceived;
 sal_uInt32 nReceivedPackets = 0;
+/* We expect to get every packet we send pushed onto the queue to be echoed
+ * locally; and since we are also listening at the "other end", we expect
+ * to receive a copy of each packet as well.
+ */
+sal_uInt32 nExpectedPackets = nSentPackets * 2;
 bool bOk;
 do
 {
@@ -291,10 +296,10 @@ void TestTeleTubes::testReceivePacket()
 CPPUNIT_ASSERT( aPacket == aReceived);
 }
 } while (bOk);
-if (nReceivedPackets < nSentPackets)
+if (nReceivedPackets < nExpectedPackets)
 mpManager1->iterateLoop();
-} while (nReceivedPackets < nSentPackets);
-CPPUNIT_ASSERT( nReceivedPackets == nSentPackets);
+} while (nReceivedPackets < nExpectedPackets);
+CPPUNIT_ASSERT( nReceivedPackets == nExpectedPackets);
 }
 
 void TestTeleTubes::FileSent( bool success, void *user_data)
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx
index d48807d..4e218b8 100644
--- a/tubes/source/conference.cxx
+++ b/tubes/source/conference.cxx
@@ -400,7 +400,7 @@ void TeleConference::finalize()
 }
 
 
-bool TeleConference::sendPacket( TelePacket& rPacket ) const
+bool TeleConference::sendPacket( TelePacket& rPacket )
 {
 INFO_LOGGER( "TeleConference::sendPacket");
 
@@ -432,21 +432,32 @@ bool TeleConference::sendPacket( TelePacket& rPacket ) 
const
 
 bool bSent = dbus_connection_send( mpTube, pMessage, NULL);
 SAL_WARN_IF( !bSent, "tubes", "TeleConference::sendPacket: not sent");
+
+/* FIXME: need to impose an ordering on packets. */
+queue( rPacket );
+
 dbus_message_unref( pMessage);
 return bSent;
 }
 
 
-void TeleConference::queue( const char* pDBusSender, const char* pPacketData, 
int nPacketSize )
+void TeleConference::queue( TelePacket &rPacket )
 {
 INFO_LOGGER( "TeleConference::queue");
 
-maPacketQueue.push( TelePacket( pDBusSender, pPacketData, nPacketSize));
+maPacketQueue.push( rPacket);
 
 getManager()->callbackOnRecieved( this);
 }
 
 
+void TeleConference::queue( const char* pDBusSender, const char* pPacketData, 
int nPacketSize )
+{
+TelePacket aPacket( pDBusSender, pPacketData, nPacketSize );
+queue( aPacket );
+}
+
+
 class SendFileRequest {
 public:
 SendFileRequest( TeleConference *pSelf,
commit 79919ef4ebb080f3d01b5024aac465fb90462bb0
Author: Will Thompson 
Date:   Fri Mar 23 14:19:11 2012 +

tubes: delete some loop-spinning debug

diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index f9ca143..5bd0f62 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -864,7 +864,6 @@ rtl::OString TeleManager::getFullObjectPath()
 void TeleManager::iterateLoop()
 {
 GMainContext* pContext = getMainContext();
-SAL_INFO( "tubes.loop", "TeleManager::iterateLoop: once");
 g_main_context_iteration( pContext, TRUE);
 }
 
@@ -906,7 +905,6 @@ void TeleManager::flushLoop() const
 GMainContext* pContext = g_main_loop_get_context( pImpl->mpLoop);
 while (g_main_context_iteration( pContext, FALSE))
 {
-SAL_INFO( "tubes.loop", "TeleManager::flushLoop");
 }
 }
 }
commit 8cf573e82ba33a43ce07a3dcc274f00c9ea7e175
Author: Will Thompson 
Date:   Fri Mar 23 

[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - sc/source

2012-03-21 Thread Michael Meeks
 sc/source/ui/docshell/docfunc.cxx |   12 -
 sc/source/ui/docshell/docsh.cxx   |   80 +-
 sc/source/ui/inc/docfunc.hxx  |4 +
 sc/source/ui/inc/viewfunc.hxx |6 +-
 sc/source/ui/view/cellsh3.cxx |2 
 sc/source/ui/view/viewfun4.cxx|8 ++-
 sc/source/ui/view/viewfunc.cxx|   17 +++-
 7 files changed, 109 insertions(+), 20 deletions(-)

New commits:
commit de709a5b0d0a0c774c9997fad98ce607103140a7
Author: Michael Meeks 
Date:   Wed Mar 21 15:58:52 2012 +

dummy interception of ScFunc methods with INTERCEPT env var set.

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index ab5dcd9..0485370 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2507,6 +2507,82 @@ sal_Bool ScDocShell::HasAutomaticTableName( const 
String& rFilter )
 || rFilter.EqualsAscii( pFilterRtf );
 }
 
+namespace {
+
+class ScDocFuncIntercept : public ScDocFunc
+{
+public:
+ScDocFuncIntercept( ScDocShell& rDocSh ) : ScDocFunc( rDocSh )
+{
+fprintf( stderr, "Interceptor created !\n" );
+}
+virtual ~ScDocFuncIntercept() {}
+virtual void EnterListAction( sal_uInt16 nNameResId )
+{
+// Want to group these operations for the other side ...
+String aUndo( ScGlobal::GetRscString( nNameResId ) );
+}
+virtual void EndListAction()
+{
+}
+virtual ScBaseCell* InterpretEnglishString( const ScAddress& rPos, const 
String& rText,
+const String& rFormulaNmsp,
+const 
formula::FormulaGrammar::Grammar eGrammar,
+short* pRetFormatType )
+{
+fprintf( stderr, "interp. english string '%s'\n",
+ rtl::OUStringToOString( rText, RTL_TEXTENCODING_UTF8 
).getStr() );
+return ScDocFunc::InterpretEnglishString( rPos, rText, rFormulaNmsp,
+  eGrammar, pRetFormatType );
+}
+virtual sal_Bool SetNormalString( const ScAddress& rPos, const String& 
rText, sal_Bool bApi )
+{
+fprintf( stderr, "set normal string '%s'\n",
+ rtl::OUStringToOString( rText, RTL_TEXTENCODING_UTF8 
).getStr() );
+return ScDocFunc::SetNormalString( rPos, rText, bApi );
+}
+
+virtual sal_Bool PutCell( const ScAddress& rPos, ScBaseCell* pNewCell, 
sal_Bool bApi )
+{
+fprintf( stderr, "put cell string '%p' %d\n", pNewCell, bApi );
+return ScDocFunc::PutCell( rPos, pNewCell, bApi );
+}
+
+virtual sal_Bool PutData( const ScAddress& rPos, ScEditEngineDefaulter& 
rEngine,
+  sal_Bool bInterpret, sal_Bool bApi )
+{
+fprintf( stderr, "put data\n" );
+return ScDocFunc::PutData( rPos, rEngine, bInterpret, bApi );
+}
+
+virtual sal_Bool SetCellText( const ScAddress& rPos, const String& rText,
+  sal_Bool bInterpret, sal_Bool bEnglish, 
sal_Bool bApi,
+  const String& rFormulaNmsp,
+  const formula::FormulaGrammar::Grammar 
eGrammar )
+{
+fprintf( stderr, "set cell text '%s'\n",
+ rtl::OUStringToOString( rText, RTL_TEXTENCODING_UTF8 
).getStr() );
+return ScDocFunc::SetCellText( rPos, rText, bInterpret, bEnglish, 
bApi, rFormulaNmsp, eGrammar );
+}
+
+virtual bool ShowNote( const ScAddress& rPos, bool bShow = true )
+{
+fprintf( stderr, "%s note\n", bShow ? "show" : "hide" );
+return ScDocFunc::ShowNote( rPos, bShow );
+}
+};
+
+static ScDocFunc *
+createDocFunc( ScDocShell *pThis )
+{
+if (getenv ("INTERCEPT"))
+return new ScDocFuncIntercept( *pThis );
+else
+return new ScDocFuncDirect( *pThis );
+}
+
+} // anonymous namespace
+
 ScDocShell::ScDocShell( const ScDocShell& rShell ) :
 SvRefBase(),
 SotObject(),
@@ -2538,7 +2614,7 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) :
 
 bIsInplace = rShell.bIsInplace;
 
-pDocFunc = new ScDocFuncDirect(*this);
+pDocFunc = createDocFunc( this );
 
 //  SetBaseModel needs exception handling
 ScModelObj::CreateAndSet( this );
@@ -2585,7 +2661,7 @@ ScDocShell::ScDocShell( const sal_uInt64 
i_nSfxCreationFlags ) :
 bIsInplace = (GetCreateMode() == SFX_CREATE_MODE_EMBEDDED);
 //  wird zurueckgesetzt, wenn nicht inplace
 
-pDocFunc = new ScDocFuncDirect(*this);
+pDocFunc = createDocFunc( this );
 
 //  SetBaseModel needs exception handling
 ScModelObj::CreateAndSet( this );
commit 5d6ca544b4e9030be60f31583551b31c8d4c2f9a
Author: Michael Meeks 
Date:   Wed Mar 21 15:57:35 2012 +

EnterData - remove un-necessary bRecord parameter for corner-case

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index e6be63c..9e72fac 100644
---