Add configure option --enable-formula-logger to conditionalize it.

Change-Id: I1badbcfa259b22d742e5241bd817ea44769a771e
This commit is contained in:
Kohei Yoshida 2016-10-24 18:56:51 -04:00
parent 08086d76f8
commit dff4e51f5d
5 changed files with 72 additions and 1 deletions

View file

@ -130,6 +130,7 @@ export ENABLE_DIRECTX=@ENABLE_DIRECTX@
export ENABLE_EOT=@ENABLE_EOT@
export ENABLE_EVOAB2=@ENABLE_EVOAB2@
export ENABLE_FIREBIRD_SDBC=@ENABLE_FIREBIRD_SDBC@
export ENABLE_FORMULA_LOGGER=@ENABLE_FORMULA_LOGGER@
export ENABLE_GIO=@ENABLE_GIO@
export ENABLE_GRAPHITE=@ENABLE_GRAPHITE@
export ENABLE_ORCUS=@ENABLE_ORCUS@

View file

@ -0,0 +1,10 @@
/*
* General configuration settings for various options specific to Calc.
*/
#ifndef CONFIG_OPTIONS_CALC_H
#define CONFIG_OPTIONS_CALC_H
#define ENABLE_FORMULA_LOGGER 0
#endif

View file

@ -1515,6 +1515,13 @@ AC_ARG_ENABLE(dconf,
[Disable the dconf configuration backend (enabled by default where
available).]))
AC_ARG_ENABLE(formula-logger,
AS_HELP_STRING(
[--enable-formula-logger],
[Enable formula logger for logging formula calculation flow in Calc.]
)
)
dnl ===================================================================
dnl Optional Packages (--with/without-)
dnl ===================================================================
@ -12754,6 +12761,20 @@ else
fi
AC_SUBST(MPL_SUBSET)
dnl ===================================================================
AC_MSG_CHECKING([formula logger])
ENABLE_FORMULA_LOGGER=
if test "x$enable_formula_logger" = "xyes"; then
AC_MSG_RESULT([yes])
AC_DEFINE(ENABLE_FORMULA_LOGGER)
ENABLE_FORMULA_LOGGER=TRUE
else
AC_MSG_RESULT([no])
fi
AC_SUBST(ENABLE_FORMULA_LOGGER)
dnl ===================================================================
dnl Setting up the environment.
@ -12927,6 +12948,7 @@ AC_CONFIG_HEADERS([config_host/config_kde4.h])
AC_CONFIG_HEADERS([config_host/config_oox.h])
AC_CONFIG_HEADERS([config_host/config_opengl.h])
AC_CONFIG_HEADERS([config_host/config_options.h])
AC_CONFIG_HEADERS([config_host/config_options_calc.h])
AC_CONFIG_HEADERS([config_host/config_test.h])
AC_CONFIG_HEADERS([config_host/config_telepathy.h])
AC_CONFIG_HEADERS([config_host/config_typesizes.h])

View file

@ -230,7 +230,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/editutil \
sc/source/core/tool/filtopt \
sc/source/core/tool/formulagroup \
sc/source/core/tool/formulalogger \
sc/source/core/tool/formulaopt \
sc/source/core/tool/formulaparserpool \
sc/source/core/tool/formularesult \
@ -671,6 +670,12 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/xmlsource/xmlsourcedlg \
))
ifeq ($(ENABLE_FORMULA_LOGGER),TRUE)
$(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/tool/formulalogger \
))
endif
ifneq (,$(gb_ENABLE_DBGUTIL))
$(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/view/gridwin_dbgutil \

View file

@ -12,11 +12,15 @@
#include <memory>
#include <vector>
#include <config_options_calc.h>
class ScFormulaCell;
class ScDocument;
namespace sc {
#if ENABLE_FORMULA_LOGGER
/**
* Outputs formula calculation log outputs to specified file.
*/
@ -84,6 +88,35 @@ public:
GroupScope enterGroup( const ScDocument& rDoc, const ScFormulaCell& rCell );
};
#else
/**
* Dummy class with all empty inline methods.
*/
class FormulaLogger
{
public:
static FormulaLogger get()
{
return FormulaLogger();
}
class GroupScope
{
public:
void addMessage( const OUString& /*rMsg*/ ) {}
void setCalcComplete() {}
};
GroupScope enterGroup( const ScDocument& /*rDoc*/, const ScFormulaCell& /*rCell*/ )
{
return GroupScope();
}
};
#endif // ENABLE_FORMULA_LOGGER
}
#endif