sc/Library_sc.mk | 1 sc/source/ui/collab/sendfunc.cxx | 134 +++++++++++++++++++++++++++++++++++++++ sc/source/ui/docshell/docsh.cxx | 80 ----------------------- sc/source/ui/inc/docsh.hxx | 2 4 files changed, 139 insertions(+), 78 deletions(-)
New commits: commit 7cd15beb86a11bc5721436b8441cc4cff7e50ef5 Author: Michael Meeks <michael.me...@suse.com> Date: Wed Mar 21 19:06:35 2012 +0000 split ScDocFunc interceptor to new collab/ module and start on it diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 3856a08..a3554ce 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -313,6 +313,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 0000000..ccc785d --- /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.me...@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 e57c751..3d3afb8 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2507,82 +2507,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(), @@ -2614,7 +2538,7 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) : bIsInplace = rShell.bIsInplace; - pDocFunc = createDocFunc( this ); + pDocFunc = CreateDocFunc(); // SetBaseModel needs exception handling ScModelObj::CreateAndSet( this ); @@ -2661,7 +2585,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 488c202..a00e98e 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -166,6 +166,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 ); _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits