summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-04-06 13:10:37 +0200
committerDavid Tardon <dtardon@redhat.com>2013-04-06 13:33:33 +0200
commitab382911aeb83d6a8f5347f6d5502daab87924dd (patch)
treec3637a846b97e3ad2a592a6f122e02562b4c8dbf /sc/source/ui
parentff52d60b166f6758cacf639311244a594bb8d2ab (diff)
move anonymous namespace to .cxx
Change-Id: I52d2ed4b0454233da21e9040dd324772247113c1
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/collab/sendfunc.cxx218
-rw-r--r--sc/source/ui/collab/sendfunc.hxx218
2 files changed, 219 insertions, 217 deletions
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 75233cfe218b..37f51c2099ca 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -32,8 +32,226 @@
#include "docsh.hxx"
#include "docfunc.hxx"
#include "sccollaboration.hxx"
+#include <editeng/editobj.hxx>
#include <tubes/manager.hxx>
+namespace {
+
+OUString formulaCellToString( ScFormulaCell *pCell )
+{
+ (void)pCell; // FIXME: implement me
+ return OUString();
+}
+
+OUString editToString( const EditTextObject& /*rEditText*/ )
+{
+ // FIXME: implement me.
+ return OUString();
+}
+
+EditTextObject stringToEdit( const OUString& rStr )
+{
+ // FIXME: implement me.
+ return EditTextObject();
+}
+
+ScFormulaCell* stringToFormulaCell( const OUString &rString )
+{
+ (void)rString; // FIXME: implement me
+ return NULL;
+}
+
+struct ProtocolError {
+ const char *message;
+};
+
+class ScChangeOpReader {
+ std::vector< rtl::OUString > maArgs;
+
+public:
+ ScChangeOpReader( const rtl::OUString &rString)
+ {
+ // will need to handle escaping etc.
+ // Surely someone else wrote this before ! [!?]
+ enum {
+ IN_TEXT, CHECK_QUOTE, FIND_LAST_QUOTE, SKIP_SEMI
+ } eState = CHECK_QUOTE;
+
+ sal_Int32 nStart = 0;
+ for (sal_Int32 n = 0; n < rString.getLength(); n++)
+ {
+ if (rString[n] == '\\')
+ {
+ n++; // skip next char
+ continue;
+ }
+ switch (eState) {
+ case CHECK_QUOTE:
+ if (rString[n] == '"')
+ {
+ nStart = n + 1;
+ eState = FIND_LAST_QUOTE;
+ break;
+ }
+ // else drop through
+ case IN_TEXT:
+ if (rString[n] == ';')
+ {
+ maArgs.push_back( rString.copy( nStart, n - nStart ) );
+ nStart = n + 1;
+ eState = CHECK_QUOTE;
+ }
+ break;
+ case FIND_LAST_QUOTE:
+ if (rString[n] == '"')
+ {
+ maArgs.push_back( rString.copy( nStart, n - nStart ) );
+ eState = SKIP_SEMI;
+ break;
+ }
+ break;
+ case SKIP_SEMI:
+ if (rString[n] == ';')
+ {
+ nStart = n + 1;
+ eState = CHECK_QUOTE;
+ }
+ break;
+ }
+ }
+ if ( nStart < rString.getLength())
+ maArgs.push_back( rString.copy( nStart, rString.getLength() - nStart ) );
+ }
+ ~ScChangeOpReader() {}
+
+ rtl::OUString getMethod()
+ {
+ return maArgs[0];
+ }
+
+ size_t getArgCount() { return maArgs.size(); }
+
+ rtl::OUString getString( sal_Int32 n )
+ {
+ if (n > 0 && (size_t)n < getArgCount() )
+ {
+ rtl::OUString aUStr( maArgs[ n ] );
+ ScGlobal::EraseQuotes( aUStr );
+ return aUStr;
+ } else
+ return rtl::OUString();
+ }
+
+ ScAddress getAddress( sal_Int32 n )
+ {
+ ScAddress aAddr;
+ rtl::OUString aToken( getString( n ) );
+ aAddr.Parse( aToken );
+ return aAddr;
+ }
+
+ sal_Int32 getInt( sal_Int32 n )
+ {
+ return getString( n ).toInt32();
+ }
+
+ bool getBool( sal_Int32 n )
+ {
+ return getString( n ).equalsIgnoreAsciiCase( "true" );
+ }
+
+ ScFormulaCell* getFormulaCell( sal_Int32 n )
+ {
+ return stringToFormulaCell( getString( n ) );
+ }
+
+ double getDouble( sal_Int32 n )
+ {
+ return getString(n).toDouble();
+ }
+
+ EditTextObject getEdit( sal_Int32 n )
+ {
+ return stringToEdit(getString(n));
+ }
+
+};
+
+} // anonymous namespace
+
+// Ye noddy mangling - needs improvement ...
+// method name ';' then arguments ; separated
+class ScChangeOpWriter
+{
+ rtl::OUStringBuffer aMessage;
+ void appendSeparator()
+ {
+ aMessage.append( sal_Unicode( ';' ) );
+ }
+
+public:
+ ScChangeOpWriter( const char *pName )
+ {
+ aMessage.appendAscii( pName );
+ appendSeparator();
+ }
+
+ void appendString( const rtl::OUString &rStr )
+ {
+ if ( rStr.indexOf( sal_Unicode( '"' ) ) >= 0 ||
+ rStr.indexOf( sal_Unicode( ';' ) ) >= 0 )
+ {
+ rtl::OUString aQuoted( rStr );
+ ScGlobal::AddQuotes( aQuoted, sal_Unicode( '"' ) );
+ aMessage.append( aQuoted );
+ }
+ else
+ aMessage.append( rStr );
+ appendSeparator();
+ }
+
+ void appendAddress( const ScAddress &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();
+ }
+
+ void appendFormulaCell( ScFormulaCell *pCell )
+ {
+ appendString( formulaCellToString( pCell ) );
+ }
+
+ void appendEditText( const EditTextObject& rStr )
+ {
+ appendString( editToString(rStr) );
+ }
+
+ void appendDouble( double fVal )
+ {
+ aMessage.append(fVal);
+ appendSeparator();
+ }
+
+ rtl::OString toString()
+ {
+ return rtl::OUStringToOString( aMessage.toString(), RTL_TEXTENCODING_UTF8 );
+ }
+};
+
void ScDocFuncSend::RecvMessage( const rtl::OString &rString )
{
try {
diff --git a/sc/source/ui/collab/sendfunc.hxx b/sc/source/ui/collab/sendfunc.hxx
index 032ff0147154..fa2d1fcee4a1 100644
--- a/sc/source/ui/collab/sendfunc.hxx
+++ b/sc/source/ui/collab/sendfunc.hxx
@@ -14,223 +14,7 @@
#include "docfunc.hxx"
class ScCollaboration;
-
-namespace {
-
-OUString formulaCellToString( ScFormulaCell *pCell )
-{
- (void)pCell; // FIXME: implement me
- return OUString();
-}
-
-OUString editToString( const EditTextObject& /*rEditText*/ )
-{
- // FIXME: implement me.
- return OUString();
-}
-
-EditTextObject stringToEdit( const OUString& rStr )
-{
- // FIXME: implement me.
- return EditTextObject();
-}
-
-ScFormulaCell* stringToFormulaCell( const OUString &rString )
-{
- (void)rString; // FIXME: implement me
- return NULL;
-}
-
-// Ye noddy mangling - needs improvement ...
-// method name ';' then arguments ; separated
-class ScChangeOpWriter
-{
- rtl::OUStringBuffer aMessage;
- void appendSeparator()
- {
- aMessage.append( sal_Unicode( ';' ) );
- }
-
-public:
- ScChangeOpWriter( const char *pName )
- {
- aMessage.appendAscii( pName );
- appendSeparator();
- }
-
- void appendString( const rtl::OUString &rStr )
- {
- if ( rStr.indexOf( sal_Unicode( '"' ) ) >= 0 ||
- rStr.indexOf( sal_Unicode( ';' ) ) >= 0 )
- {
- rtl::OUString aQuoted( rStr );
- ScGlobal::AddQuotes( aQuoted, sal_Unicode( '"' ) );
- aMessage.append( aQuoted );
- }
- else
- aMessage.append( rStr );
- appendSeparator();
- }
-
- void appendAddress( const ScAddress &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();
- }
-
- void appendFormulaCell( ScFormulaCell *pCell )
- {
- appendString( formulaCellToString( pCell ) );
- }
-
- void appendEditText( const EditTextObject& rStr )
- {
- appendString( editToString(rStr) );
- }
-
- void appendDouble( double fVal )
- {
- aMessage.append(fVal);
- appendSeparator();
- }
-
- rtl::OString toString()
- {
- return rtl::OUStringToOString( aMessage.toString(), RTL_TEXTENCODING_UTF8 );
- }
-};
-
-struct ProtocolError {
- const char *message;
-};
-
-class ScChangeOpReader {
- std::vector< rtl::OUString > maArgs;
-
-public:
- ScChangeOpReader( const rtl::OUString &rString)
- {
- // will need to handle escaping etc.
- // Surely someone else wrote this before ! [!?]
- enum {
- IN_TEXT, CHECK_QUOTE, FIND_LAST_QUOTE, SKIP_SEMI
- } eState = CHECK_QUOTE;
-
- sal_Int32 nStart = 0;
- for (sal_Int32 n = 0; n < rString.getLength(); n++)
- {
- if (rString[n] == '\\')
- {
- n++; // skip next char
- continue;
- }
- switch (eState) {
- case CHECK_QUOTE:
- if (rString[n] == '"')
- {
- nStart = n + 1;
- eState = FIND_LAST_QUOTE;
- break;
- }
- // else drop through
- case IN_TEXT:
- if (rString[n] == ';')
- {
- maArgs.push_back( rString.copy( nStart, n - nStart ) );
- nStart = n + 1;
- eState = CHECK_QUOTE;
- }
- break;
- case FIND_LAST_QUOTE:
- if (rString[n] == '"')
- {
- maArgs.push_back( rString.copy( nStart, n - nStart ) );
- eState = SKIP_SEMI;
- break;
- }
- break;
- case SKIP_SEMI:
- if (rString[n] == ';')
- {
- nStart = n + 1;
- eState = CHECK_QUOTE;
- }
- break;
- }
- }
- if ( nStart < rString.getLength())
- maArgs.push_back( rString.copy( nStart, rString.getLength() - nStart ) );
- }
- ~ScChangeOpReader() {}
-
- rtl::OUString getMethod()
- {
- return maArgs[0];
- }
-
- size_t getArgCount() { return maArgs.size(); }
-
- rtl::OUString getString( sal_Int32 n )
- {
- if (n > 0 && (size_t)n < getArgCount() )
- {
- rtl::OUString aUStr( maArgs[ n ] );
- ScGlobal::EraseQuotes( aUStr );
- return aUStr;
- } else
- return rtl::OUString();
- }
-
- ScAddress getAddress( sal_Int32 n )
- {
- ScAddress aAddr;
- rtl::OUString aToken( getString( n ) );
- aAddr.Parse( aToken );
- return aAddr;
- }
-
- sal_Int32 getInt( sal_Int32 n )
- {
- return getString( n ).toInt32();
- }
-
- bool getBool( sal_Int32 n )
- {
- return getString( n ).equalsIgnoreAsciiCase( "true" );
- }
-
- ScFormulaCell* getFormulaCell( sal_Int32 n )
- {
- return stringToFormulaCell( getString( n ) );
- }
-
- double getDouble( sal_Int32 n )
- {
- return getString(n).toDouble();
- }
-
- EditTextObject getEdit( sal_Int32 n )
- {
- return stringToEdit(getString(n));
- }
-
-};
-
-} // anonymous namespace
+class ScChangeOpWriter;
class ScDocFuncSend : public ScDocFunc
{