[Libreoffice-commits] .: Branch 'feature/tubes' - sc/source
Michael Meeks
michael at kemper.freedesktop.org
Tue Mar 20 07:28:21 PDT 2012
sc/source/ui/docshell/docsh.cxx | 66 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 64 insertions(+), 2 deletions(-)
New commits:
commit 5608a20ce5d526634641112fed77a9a805e9e27c
Author: Michael Meeks <michael.meeks at suse.com>
Date: Tue Mar 20 14:26:37 2012 +0000
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..0bf22e3 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2507,6 +2507,68 @@ 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 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 );
+// rtl::OUStringToOString( rText, RTL_TEXTENCODING_UTF8 ).getStr() );
+ return ScDocFunc::PutCell( rPos, pNewCell, 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 +2600,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 +2647,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 );
More information about the Libreoffice-commits
mailing list