summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/Library_sc.mk1
-rw-r--r--sc/source/ui/collab/sendfunc.cxx134
-rw-r--r--sc/source/ui/docshell/docsh.cxx80
-rw-r--r--sc/source/ui/inc/docsh.hxx2
4 files changed, 139 insertions, 78 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index cba0dabd5c5c..f03fbc0f617e 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -316,6 +316,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/cctrl/popmenu \
sc/source/ui/cctrl/tbinsert \
sc/source/ui/cctrl/tbzoomsliderctrl \
+ sc/source/ui/collab/sendfunc \
sc/source/ui/dbgui/asciiopt \
sc/source/ui/dbgui/consdlg \
sc/source/ui/dbgui/csvcontrol \
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
new file mode 100644
index 000000000000..ccc785d725b0
--- /dev/null
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -0,0 +1,134 @@
+/* -*- 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 Michael Meeks <michael.meeks@suse.com> (initial developer)
+ *
+ * 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 "sal/config.h"
+#include "cell.hxx"
+#include "docsh.hxx"
+#include "docfunc.hxx"
+
+namespace {
+
+// Ye noddy protocol !
+// method name ',' then arguments comma separated
+class ScChangeOp
+{
+ rtl::OUStringBuffer aMessage;
+public:
+ ScChangeOp( const char *pName )
+ {
+ aMessage.appendAscii( pName );
+ aMessage.append( sal_Unicode( ',' ) );
+ }
+
+ void appendString( const ScAddress &rPos )
+ {
+ rtl::OUString aStr;
+ rPos.Format( aStr );
+ aMessage.append( aStr );
+ }
+
+ void appendAddress( const ScAddress &rPos )
+ {
+ (void)rPos;
+ }
+};
+
+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 '%p' type %d %d\n", pNewCell, pNewCell->GetCellType(), 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 );
+ }
+};
+
+} // anonymous namespace
+
+SC_DLLPRIVATE ScDocFunc *ScDocShell::CreateDocFunc()
+{
+ if (getenv ("INTERCEPT"))
+ return new ScDocFuncIntercept( *this );
+ else
+ return new ScDocFuncDirect( *this );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index ecc3d24af4e9..475f3b77115d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2500,82 +2500,6 @@ 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 '%p' type %d %d\n", pNewCell, pNewCell->GetCellType(), 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(),
@@ -2607,7 +2531,7 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) :
bIsInplace = rShell.bIsInplace;
- pDocFunc = createDocFunc( this );
+ pDocFunc = CreateDocFunc();
// SetBaseModel needs exception handling
ScModelObj::CreateAndSet( this );
@@ -2654,7 +2578,7 @@ ScDocShell::ScDocShell( const sal_uInt64 i_nSfxCreationFlags ) :
bIsInplace = (GetCreateMode() == SFX_CREATE_MODE_EMBEDDED);
// wird zurueckgesetzt, wenn nicht inplace
- pDocFunc = createDocFunc( this );
+ pDocFunc = CreateDocFunc();
// SetBaseModel needs exception handling
ScModelObj::CreateAndSet( this );
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index eeb0124299b3..3971e5edc19e 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -165,6 +165,8 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
SC_DLLPRIVATE void UseSheetSaveEntries();
+ SC_DLLPRIVATE ScDocFunc *CreateDocFunc();
+
protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );