diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-10-24 18:56:51 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-10-25 18:07:27 -0400 |
commit | dff4e51f5db23baab368ab7e656ad1b74f2663bd (patch) | |
tree | f5f108fc581f163aa815bd98ab2765ba4d02b524 | |
parent | Ensure that GroupScope can only be instantiated by FormulaLogger. (diff) | |
download | core-dff4e51f5db23baab368ab7e656ad1b74f2663bd.tar.gz core-dff4e51f5db23baab368ab7e656ad1b74f2663bd.zip |
Add configure option --enable-formula-logger to conditionalize it.
Change-Id: I1badbcfa259b22d742e5241bd817ea44769a771e
-rw-r--r-- | config_host.mk.in | 1 | ||||
-rw-r--r-- | config_host/config_options_calc.h.in | 10 | ||||
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | sc/Library_sc.mk | 7 | ||||
-rw-r--r-- | sc/inc/formulalogger.hxx | 33 |
5 files changed, 72 insertions, 1 deletions
diff --git a/config_host.mk.in b/config_host.mk.in index 90c25a63dc99..260acf7787c4 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -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@ diff --git a/config_host/config_options_calc.h.in b/config_host/config_options_calc.h.in new file mode 100644 index 000000000000..f369797a5ed8 --- /dev/null +++ b/config_host/config_options_calc.h.in @@ -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 diff --git a/configure.ac b/configure.ac index af07d135032c..f06ef8e2806a 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index f3abc81ac818..0e2190361554 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -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 \ diff --git a/sc/inc/formulalogger.hxx b/sc/inc/formulalogger.hxx index 144fabf02849..1348c63d9218 100644 --- a/sc/inc/formulalogger.hxx +++ b/sc/inc/formulalogger.hxx @@ -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 |