restructure the code a bit more

This commit is contained in:
Markus Mohrhard
2012-03-21 21:44:01 +01:00
parent ac5455a688
commit 278c53c933
6 changed files with 10 additions and 20 deletions

View File

@@ -33,6 +33,7 @@
#include <memory> #include <memory>
#include "formula/formuladllapi.h" #include "formula/formuladllapi.h"
#include "formula/omoduleclient.hxx" #include "formula/omoduleclient.hxx"
#include <formula/IFunctionDescription.hxx>
namespace formula namespace formula
{ {
@@ -48,7 +49,6 @@ enum FormulaDlgMode { FORMULA_FORMDLG_FORMULA, FORMULA_FORMDLG_ARGS, FORMULA_FOR
//============================================================================ //============================================================================
class IFormulaEditorHelper;
class FormulaDlg_Impl; class FormulaDlg_Impl;
class IControlReferenceHandler; class IControlReferenceHandler;
class IFunctionDescription; class IFunctionDescription;
@@ -58,7 +58,7 @@ class RefEdit;
class RefButton; class RefButton;
class FormEditData; class FormEditData;
//============================================================================ //============================================================================
class FORMULA_DLLPUBLIC FormulaModalDialog : public ModalDialog class FORMULA_DLLPUBLIC FormulaModalDialog : public ModalDialog, public formula::IFormulaEditorHelper
{ {
friend class FormulaDlg_Impl; friend class FormulaDlg_Impl;
public: public:
@@ -66,7 +66,6 @@ public:
, bool _bSupportFunctionResult , bool _bSupportFunctionResult
, bool _bSupportResult , bool _bSupportResult
, bool _bSupportMatrix , bool _bSupportMatrix
,IFormulaEditorHelper* _pHelper
,IFunctionManager* _pFunctionMgr ,IFunctionManager* _pFunctionMgr
,IControlReferenceHandler* _pDlg = NULL ); ,IControlReferenceHandler* _pDlg = NULL );
virtual ~FormulaModalDialog(); virtual ~FormulaModalDialog();
@@ -92,7 +91,7 @@ protected:
}; };
class FORMULA_DLLPUBLIC FormulaDlg: class FORMULA_DLLPUBLIC FormulaDlg:
private OModuleClient, public SfxModelessDialog private OModuleClient, public SfxModelessDialog, public IFormulaEditorHelper
// order of base classes is important, as OModuleClient controls the // order of base classes is important, as OModuleClient controls the
// lifecycle of the ResMgr passed into SfxModelessDialog (via // lifecycle of the ResMgr passed into SfxModelessDialog (via
// formula::ModuleRes), and at least with DBG_UTIL calling TestRes in // formula::ModuleRes), and at least with DBG_UTIL calling TestRes in
@@ -107,7 +106,6 @@ public:
, bool _bSupportFunctionResult , bool _bSupportFunctionResult
, bool _bSupportResult , bool _bSupportResult
, bool _bSupportMatrix , bool _bSupportMatrix
, IFormulaEditorHelper* _pHelper
, IFunctionManager* _pFunctionMgr , IFunctionManager* _pFunctionMgr
, IControlReferenceHandler* _pDlg = NULL ); , IControlReferenceHandler* _pDlg = NULL );
virtual ~FormulaDlg(); virtual ~FormulaDlg();

View File

@@ -1657,14 +1657,13 @@ FormulaModalDialog::FormulaModalDialog( Window* pParent
, bool _bSupportFunctionResult , bool _bSupportFunctionResult
, bool _bSupportResult , bool _bSupportResult
, bool _bSupportMatrix , bool _bSupportMatrix
, IFormulaEditorHelper* _pHelper
, IFunctionManager* _pFunctionMgr , IFunctionManager* _pFunctionMgr
, IControlReferenceHandler* _pDlg ) : , IControlReferenceHandler* _pDlg ) :
ModalDialog( pParent, ModuleRes(RID_FORMULADLG_FORMULA_MODAL) ), ModalDialog( pParent, ModuleRes(RID_FORMULADLG_FORMULA_MODAL) ),
m_pImpl( new FormulaDlg_Impl(this,_bSupportFunctionResult m_pImpl( new FormulaDlg_Impl(this,_bSupportFunctionResult
, _bSupportResult , _bSupportResult
, _bSupportMatrix , _bSupportMatrix
,_pHelper,_pFunctionMgr,_pDlg)) ,this,_pFunctionMgr,_pDlg))
{ {
FreeResource(); FreeResource();
SetText(m_pImpl->aTitle1); SetText(m_pImpl->aTitle1);
@@ -1745,12 +1744,12 @@ FormulaDlg::FormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
, bool _bSupportFunctionResult , bool _bSupportFunctionResult
, bool _bSupportResult , bool _bSupportResult
, bool _bSupportMatrix , bool _bSupportMatrix
, IFormulaEditorHelper* _pHelper,IFunctionManager* _pFunctionMgr,IControlReferenceHandler* _pDlg ) : , IFunctionManager* _pFunctionMgr, IControlReferenceHandler* _pDlg ) :
SfxModelessDialog( pB, pCW, pParent, ModuleRes(RID_FORMULADLG_FORMULA) ), SfxModelessDialog( pB, pCW, pParent, ModuleRes(RID_FORMULADLG_FORMULA) ),
m_pImpl( new FormulaDlg_Impl(this, _bSupportFunctionResult m_pImpl( new FormulaDlg_Impl(this, _bSupportFunctionResult
, _bSupportResult , _bSupportResult
, _bSupportMatrix , _bSupportMatrix
,_pHelper,_pFunctionMgr,_pDlg)) , this, _pFunctionMgr, _pDlg))
{ {
FreeResource(); FreeResource();
if(GetHelpId().isEmpty()) //Hack which hides the HelpId for a model Dialog in SfxModelessDialog if(GetHelpId().isEmpty()) //Hack which hides the HelpId for a model Dialog in SfxModelessDialog

View File

@@ -60,7 +60,7 @@ FormulaDialog::FormulaDialog(Window* pParent
, const ::boost::shared_ptr< IFunctionManager >& _pFunctionMgr , const ::boost::shared_ptr< IFunctionManager >& _pFunctionMgr
, const ::rtl::OUString& _sFormula , const ::rtl::OUString& _sFormula
, const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet) , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet)
: FormulaModalDialog( pParent, false,false,false,this,_pFunctionMgr.get(),this) : FormulaModalDialog( pParent, false,false,false,_pFunctionMgr.get(),this)
,m_aFunctionManager(_pFunctionMgr) ,m_aFunctionManager(_pFunctionMgr)
,m_pFormulaData(new FormEditData()) ,m_pFormulaData(new FormEditData())
,m_pAddField(NULL) ,m_pAddField(NULL)

View File

@@ -30,7 +30,6 @@
#define RPTUI_FORMULA_HXX #define RPTUI_FORMULA_HXX
#include <formula/formula.hxx> #include <formula/formula.hxx>
#include <formula/IFunctionDescription.hxx>
#include <formula/IControlReferenceHandler.hxx> #include <formula/IControlReferenceHandler.hxx>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
@@ -45,8 +44,7 @@ class FunctionManager;
class OAddFieldWindow; class OAddFieldWindow;
//============================================================================ //============================================================================
class FormulaDialog : public formula::IFormulaEditorHelper, class FormulaDialog : public formula::FormulaModalDialog,
public formula::FormulaModalDialog,
public formula::IControlReferenceHandler public formula::IControlReferenceHandler
{ {
::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager; ::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager;

View File

@@ -84,7 +84,7 @@ ScAddress ScFormulaDlg::aCursorPos;
ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW, ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW,
Window* pParent, ScViewData* pViewData,formula::IFunctionManager* _pFunctionMgr ) Window* pParent, ScViewData* pViewData,formula::IFunctionManager* _pFunctionMgr )
: formula::FormulaDlg( pB, pCW, pParent, true,true,true,this, _pFunctionMgr,this) : formula::FormulaDlg( pB, pCW, pParent, true,true,true, _pFunctionMgr,this)
, m_aHelper(this,pB) , m_aHelper(this,pB)
{ {
m_aHelper.SetWindow(this); m_aHelper.SetWindow(this);

View File

@@ -43,7 +43,6 @@
#include "formula/formula.hxx" #include "formula/formula.hxx"
#include "IAnyRefDialog.hxx" #include "IAnyRefDialog.hxx"
#include "anyrefdg.hxx" #include "anyrefdg.hxx"
#include <formula/IFunctionDescription.hxx>
class ScViewData; class ScViewData;
class ScDocument; class ScDocument;
@@ -56,11 +55,7 @@ class SvLBoxEntry;
typedef ScTabViewShell* PtrTabViewShell; typedef ScTabViewShell* PtrTabViewShell;
//============================================================================ //============================================================================
// Order of base classes is important, as pointer to IFormulaEditorHelper base class ScFormulaDlg : public formula::FormulaDlg,
// is passed into constructor of FormulaDlg base, which expects the former to
// outlive itself:
class ScFormulaDlg : public formula::IFormulaEditorHelper,
public formula::FormulaDlg,
public IAnyRefDialog public IAnyRefDialog
{ {
ScFormulaReferenceHelper m_aHelper; ScFormulaReferenceHelper m_aHelper;