[Libreoffice-commits] .: 5 commits - chart2/source sal/rtl sc/CppunitTest_sc_namedrangeobj.mk sc/Module_sc.mk sc/qa sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Tue Dec 13 18:27:10 PST 2011
chart2/source/view/axes/ScaleAutomatism.cxx | 6
sal/rtl/source/math.cxx | 4
sc/CppunitTest_sc_namedrangeobj.mk | 141 ++++++++++++++
sc/Module_sc.mk | 1
sc/qa/extras/testdocuments/rangenames.ods |binary
sc/qa/extras/xrangename.cxx | 265 ++++++++++++++++++++++++++++
sc/source/ui/namedlg/namedefdlg.cxx | 1
7 files changed, 417 insertions(+), 1 deletion(-)
New commits:
commit 15fd1375d3321f764cf73efa938c7ed195d7a369
Author: Laurent Godard <lgodard.libre at laposte.net>
Date: Wed Dec 14 03:23:14 2011 +0100
add c++ based subsequenttest for XNamedRange
one test disabled because we first need to write a patch for our
internal cppunit
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 4b2d8cc..00d4ea8 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
CppunitTest_sc_macros_test \
CppunitTest_sc_cellrangesbase \
CppunitTest_sc_subsequent_filters_test \
+ CppunitTest_sc_namedrangeobj \
CppunitTest_sc_tableautoformatfield \
CppunitTest_sc_datapilotfieldobj \
JunitTest_sc_complex \
diff --git a/sc/qa/extras/testdocuments/rangenames.ods b/sc/qa/extras/testdocuments/rangenames.ods
new file mode 100644
index 0000000..7a743d7
Binary files /dev/null and b/sc/qa/extras/testdocuments/rangenames.ods differ
diff --git a/sc/qa/extras/xrangename.cxx b/sc/qa/extras/xrangename.cxx
new file mode 100644
index 0000000..2a61145
--- /dev/null
+++ b/sc/qa/extras/xrangename.cxx
@@ -0,0 +1,265 @@
+/* -*- 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) 2011 Laurent Godard lgodard.libre at laposte.net (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 <test/unoapi_test.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
+#include <com/sun/star/sheet/XNamedRanges.hpp>
+#include <com/sun/star/sheet/XNamedRange.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/sheet/Border.hpp>
+#include <com/sun/star/sheet/NamedRangeFlag.hpp>
+
+#include <rtl/oustringostreaminserter.hxx>
+
+namespace ScNamedRangeObj {
+
+class ScXNamedRange : public UnoApiTest
+{
+ uno::Reference< sheet::XSpreadsheetDocument> init();
+
+ // XNamedRanges
+ void testAddNewByName();
+ void testAddNewFromTitles();
+ void testRemoveByName();
+ void testOutputList();
+
+ CPPUNIT_TEST_SUITE(ScXNamedRange);
+ CPPUNIT_TEST(testAddNewByName);
+ CPPUNIT_TEST(testAddNewFromTitles);
+ //fix first warning in ExceptionsTestCaseDecorator
+ //CPPUNIT_TEST_EXCEPTION(testRemoveByName, uno::RuntimeException);
+ CPPUNIT_TEST(testOutputList);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+
+void ScXNamedRange::testAddNewByName()
+{
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
+ uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
+
+ uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+
+ table::CellAddress xBaseAddress = table::CellAddress(0,0,0);
+
+ sal_Int32 nType = 0;
+ rtl::OUString content1(RTL_CONSTASCII_USTRINGPARAM("D1"));
+ rtl::OUString name1(RTL_CONSTASCII_USTRINGPARAM("type_0"));
+ xNamedRanges->addNewByName(name1, content1, xBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type 0 - Normal case", xNamedRanges->hasByName(name1));
+
+ nType = ::sheet::NamedRangeFlag::COLUMN_HEADER;
+ rtl::OUString content2(RTL_CONSTASCII_USTRINGPARAM("D2"));
+ rtl::OUString name2(RTL_CONSTASCII_USTRINGPARAM("type_COLUMN_HEADER"));
+ xNamedRanges->addNewByName(name2, content2, xBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type COLUMN_HEADER", xNamedRanges->hasByName(name2));
+
+ nType = ::sheet::NamedRangeFlag::FILTER_CRITERIA;
+ rtl::OUString content3(RTL_CONSTASCII_USTRINGPARAM("D3"));
+ rtl::OUString name3(RTL_CONSTASCII_USTRINGPARAM("type_FILTER_CRITERIA"));
+ xNamedRanges->addNewByName(name3, content3, xBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type FILTER_CRITERIA", xNamedRanges->hasByName(name3));
+
+ nType = ::sheet::NamedRangeFlag::PRINT_AREA;
+ rtl::OUString content4(RTL_CONSTASCII_USTRINGPARAM("D4"));
+ rtl::OUString name4(RTL_CONSTASCII_USTRINGPARAM("type_PRINT_AREA"));
+ xNamedRanges->addNewByName(name4, content4, xBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type PRINT_AREA", xNamedRanges->hasByName(name4));
+
+ nType = ::sheet::NamedRangeFlag::ROW_HEADER;
+ rtl::OUString content5(RTL_CONSTASCII_USTRINGPARAM("D5"));
+ rtl::OUString name5(RTL_CONSTASCII_USTRINGPARAM("type_ROW_HEADERA"));
+ xNamedRanges->addNewByName(name5, content5, xBaseAddress, nType);
+ CPPUNIT_ASSERT_MESSAGE("Failed to create Namedrange Type ROW_HEADER", xNamedRanges->hasByName(name5));
+
+}
+
+void ScXNamedRange::testAddNewFromTitles()
+{
+
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
+ uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(1), UNO_QUERY_THROW);
+
+ uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xNamedRangesIndex(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xNamedRangesNameAccess(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+
+ table::CellRangeAddress xCellRangeAddress = table::CellRangeAddress(1,0,0,3,3);
+
+ rtl::OUString aString;
+ uno::Reference< table::XCell > xCell;
+
+ xNamedRanges->addNewFromTitles(xCellRangeAddress, sheet::Border_TOP);
+
+ for (sal_Int32 i = 1; i < 4; i++)
+ {
+ // verify namedrange exists
+ xCell = xSheet->getCellByPosition(i,0);
+ uno::Reference< text::XTextRange > xTextRange(xCell, UNO_QUERY_THROW);
+ aString = xTextRange->getString();
+ std::cout << "verify " << aString << std::endl;
+ CPPUNIT_ASSERT_MESSAGE("Non existing NamedRange", xNamedRanges->hasByName(aString));
+
+ // verify it points on the right cell
+ uno::Any aNr = xNamedRangesNameAccess->getByName(aString);
+ uno::Reference< sheet::XNamedRange > xNamedRange(aNr, UNO_QUERY_THROW);
+
+ uno::Reference< sheet::XCellRangeReferrer > xCellRangeRef(xNamedRange, UNO_QUERY_THROW);
+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAdr(xCellRangeRef->getReferredCells(), UNO_QUERY_THROW);
+ table::CellRangeAddress cellRangeAddress = xCellRangeAdr->getRangeAddress();
+
+ CPPUNIT_ASSERT(cellRangeAddress.EndColumn == i && cellRangeAddress.StartColumn == i);
+ CPPUNIT_ASSERT(cellRangeAddress.StartRow == 1);
+ CPPUNIT_ASSERT(cellRangeAddress.EndRow == 3);
+ CPPUNIT_ASSERT(cellRangeAddress.Sheet == 1);
+ }
+
+ xNamedRanges->addNewFromTitles(xCellRangeAddress, sheet::Border_LEFT);
+
+ for (sal_Int32 i = 1; i < 4; i++)
+ {
+ // verify namedrange exists
+ xCell = xSheet->getCellByPosition(0,i);
+ uno::Reference< text::XTextRange > xTextRange(xCell, UNO_QUERY_THROW);
+ aString = xTextRange->getString();
+ std::cout << "verify " << aString << std::endl;
+ CPPUNIT_ASSERT_MESSAGE("Non existing NamedRange", xNamedRanges->hasByName(aString));
+
+ // verify it points on the right cell
+ uno::Any aNr= xNamedRangesNameAccess->getByName(aString);
+ uno::Reference< sheet::XNamedRange > xNamedRange(aNr, UNO_QUERY_THROW);
+
+ uno::Reference< sheet::XCellRangeReferrer > xCellRangeRef(xNamedRange, UNO_QUERY_THROW);
+ uno::Reference< sheet::XCellRangeAddressable > xCellRangeAdr(xCellRangeRef->getReferredCells(), UNO_QUERY_THROW);
+ table::CellRangeAddress cellRangeAddress = xCellRangeAdr->getRangeAddress();
+
+ CPPUNIT_ASSERT(cellRangeAddress.EndRow == i && cellRangeAddress.StartRow == i);
+ CPPUNIT_ASSERT(cellRangeAddress.StartColumn == 1);
+ CPPUNIT_ASSERT(cellRangeAddress.EndColumn == 3);
+ CPPUNIT_ASSERT(cellRangeAddress.Sheet == 1);
+ }
+}
+
+void ScXNamedRange::testRemoveByName()
+{
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
+ uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIndex(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+
+ rtl::OUString aNr1(RTL_CONSTASCII_USTRINGPARAM("initial1"));
+ bool bHasIt = xNamedRanges->hasByName(aNr1);
+ CPPUNIT_ASSERT_MESSAGE("NamedRange initial1 des not exits, can't remove it", bHasIt);
+
+ if (bHasIt)
+ {
+ // remove existing
+ sal_Int32 nInitialCount = xIndex->getCount();
+ xNamedRanges->removeByName(aNr1);
+ sal_Int32 nNewCount = xIndex->getCount();
+ CPPUNIT_ASSERT_MESSAGE("NamedRange initial1 not removed", nNewCount == nInitialCount - 1);
+ bool bHasItAgain = xNamedRanges->hasByName(aNr1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present", !bHasItAgain);
+
+ rtl::OUString nr2(RTL_CONSTASCII_USTRINGPARAM("dummyNamedRange"));
+ xNamedRanges->removeByName(aNr1);
+ // should throw an exception
+ }
+}
+
+void ScXNamedRange::testOutputList()
+{
+
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc = init();
+ uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW);
+
+ table::CellAddress xCellAddress = table::CellAddress (0,2,0);
+
+ uno::Reference< beans::XPropertySet > propSet (xDoc, UNO_QUERY_THROW);
+ rtl::OUString namedRangesString(RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
+ uno::Reference< sheet::XNamedRanges > xNamedRanges(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xNamedRangesIndex(propSet->getPropertyValue(namedRangesString), UNO_QUERY_THROW);
+ sal_Int32 nElementsCount = xNamedRangesIndex->getCount();
+
+ xNamedRanges->outputList(xCellAddress);
+
+ rtl::OUString aString;
+ uno::Reference< table::XCell > xCell;
+
+ for (sal_Int32 i = 0; i < nElementsCount; i++)
+ {
+ xCell = xSheet->getCellByPosition(2,i);
+ uno::Reference< text::XTextRange > xTextRange(xCell, UNO_QUERY_THROW);
+ aString = xTextRange->getString();
+ std::cout << "verify " << aString << std::endl;
+ CPPUNIT_ASSERT_MESSAGE("Non existing NamedRange", xNamedRanges->hasByName(aString));
+ }
+}
+
+uno::Reference< sheet::XSpreadsheetDocument> ScXNamedRange::init()
+{
+ rtl::OUString aFileURL;
+ const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("rangenames.ods"));
+ createFileURL(aFileBase, aFileURL);
+ static uno::Reference< lang::XComponent > xComponent;
+ if( !xComponent.is())
+ xComponent = loadFromDesktop(aFileURL);
+ uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDoc.is());
+
+ return xDoc;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScXNamedRange);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit cd3bf24a544ca9015cc5200df65c424f36f86eef
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Dec 14 03:19:39 2011 +0100
add makefile for new XNamedRange subsequenttest
diff --git a/sc/CppunitTest_sc_namedrangeobj.mk b/sc/CppunitTest_sc_namedrangeobj.mk
new file mode 100644
index 0000000..ee6845f
--- /dev/null
+++ b/sc/CppunitTest_sc_namedrangeobj.mk
@@ -0,0 +1,141 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+# 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.
+#
+# The Initial Developer of the Original Code is
+# Markus Mohrhard <markus.mohrhard at googlemail.com>
+# Portions created by the Initial Developer are Copyright (C) 2011 the
+# Initial Developer. All Rights Reserved.
+#
+# Major Contributor(s):
+#
+# 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.
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_namedrangeobj))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_namedrangeobj, \
+ sc/qa/extras/xrangename \
+))
+
+$(eval $(call gb_CppunitTest_add_linked_libs,sc_namedrangeobj, \
+ avmedia \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ editeng \
+ fileacc \
+ for \
+ forui \
+ i18nisolang1 \
+ msfilter \
+ oox \
+ sal \
+ salhelper \
+ sax \
+ sb \
+ sc \
+ sfx \
+ sot \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tl \
+ tk \
+ ucbhelper \
+ unotest \
+ utl \
+ vbahelper \
+ vcl \
+ xo \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_namedrangeobj,\
+ -I$(realpath $(SRCDIR)/sc/source/ui/inc) \
+ -I$(realpath $(SRCDIR)/sc/inc) \
+ $$(INCLUDE) \
+ -I$(OUTDIR)/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_api,sc_namedrangeobj,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_uses_ure,sc_namedrangeobj))
+
+$(eval $(call gb_CppunitTest_add_type_rdbs,sc_namedrangeobj,\
+ types \
+))
+
+$(eval $(call gb_CppunitTest_add_components,sc_namedrangeobj,\
+ basic/util/sb \
+ comphelper/util/comphelp \
+ dbaccess/util/dba \
+ fileaccess/source/fileacc \
+ filter/source/config/cache/filterconfig1 \
+ forms/util/frm \
+ framework/util/fwk \
+ i18npool/util/i18npool \
+ oox/util/oox \
+ package/source/xstor/xstor \
+ package/util/package2 \
+ sax/source/expatwrap/expwrap \
+ sax/source/fastparser/fastsax \
+ sc/util/sc \
+ sc/util/scd \
+ sc/util/scfilt \
+ sc/util/vbaobj \
+ scripting/source/basprov/basprov \
+ scripting/util/scriptframe \
+ sfx2/util/sfx \
+ sot/util/sot \
+ svl/source/fsstor/fsstorage \
+ toolkit/util/tk \
+ unotools/util/utl \
+ unoxml/source/rdf/unordf \
+ unoxml/source/service/unoxml \
+))
+
+$(eval $(call gb_CppunitTest_add_old_components,sc_namedrangeobj,\
+ configmgr \
+ ucb1 \
+ ucpfile1 \
+ ucptdoc1 \
+))
+
+$(eval $(call gb_CppunitTest_set_args,sc_namedrangeobj,\
+ --headless \
+ --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
+ "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/registry)" \
+))
+ # .../spool is required for the (somewhat strange) filter configuration
+
+# we need to
+# a) explicitly depend on library msword because it is not implied by a link
+# relation
+# b) explicitly depend on the sc resource files needed at unit-test runtime
+$(call gb_CppunitTest_get_target,sc_namedrangeobj) : $(call gb_Library_get_target,scfilt) $(WORKDIR)/AllLangRes/sc
+
+# vim: set noet sw=4 ts=4:
commit 38a93a59af68fb0262a0753e6ae8d31958b16138
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Wed Dec 14 01:41:42 2011 +0100
ManageNames: info text should be centered in the text field
diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx
index f57bd82..9f87047 100644
--- a/sc/source/ui/namedlg/namedefdlg.cxx
+++ b/sc/source/ui/namedlg/namedefdlg.cxx
@@ -96,6 +96,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParen
maEdName.SetModifyHdl( LINK( this, ScNameDefDlg, NameModifyHdl ));
maEdRange.SetGetFocusHdl( LINK( this, ScNameDefDlg, AssignGetFocusHdl ) );
+ maFtInfo.SetStyle(WB_VCENTER);
maFtInfo.SetText(maStrInfoDefault);
maBtnAdd.Disable(); // empty name is invalid
commit 49bb030e9b9ef6b61c8a309a84a0ac78218db971
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Dec 13 00:09:42 2011 +0100
fix crash for std::numeric_limits<int>::min() in our math lib impl
diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx
index 947f733..67b3a51 100644
--- a/sal/rtl/source/math.cxx
+++ b/sal/rtl/source/math.cxx
@@ -59,7 +59,9 @@ static double getN10Exp( int nExp )
{
if ( nExp < 0 )
{
- if ( -nExp <= n10Count )
+ // && -nExp > 0 necessary for std::numeric_limits<int>::min()
+ // because -nExp = nExp
+ if ( -nExp <= n10Count && -nExp > 0 )
return n10s[1][-nExp-1];
else
return pow( 10.0, static_cast<double>( nExp ) );
commit ab125155cf576e6ad1725947309cbe7eee9e8b0f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Dec 12 23:51:48 2011 +0100
don't try to use Inf for axes calculation fdo#43703
diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx
index 2ac44fc..ba10366 100644
--- a/chart2/source/view/axes/ScaleAutomatism.cxx
+++ b/chart2/source/view/axes/ScaleAutomatism.cxx
@@ -909,6 +909,12 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForLinear(
fDistanceNormalized = 1.0;
fDistanceMagnitude = 1.0e-307;
}
+ else if ( !rtl::math::isFinite(fDistance) )
+ {
+ // fdo#43703: Handle values bigger than limits correctly
+ fDistanceNormalized = 1.0;
+ fDistanceMagnitude = std::numeric_limits<double>::max();
+ }
else
{
// distance magnitude (a power of 10)
More information about the Libreoffice-commits
mailing list