summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2017-02-15 23:27:34 +0100
committerEike Rathke <erack@redhat.com>2017-04-10 15:46:30 +0200
commit9f70f8761a8cc180171022ffcffc0094c4957057 (patch)
tree8248d77488f3a95fdf45935ebbe7f030c7c3d44d /include
parent32f2370ac805513c4a968bd461d08f66958651d7 (diff)
tdf#105657 Treat "Precision as shown" for fractions
For Option "Precision as shown", fraction must specificly be treated ImpGetFractionElements retrieves values of each part of fraction (integer, numerator, denominator) independently from its exact representation Update: avoid include of zformat.hxx in document4.cxx Change-Id: Ia3ea2322f3d311c04ef71f3260730c7154c3dc15 Reviewed-on: https://gerrit.libreoffice.org/34331 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 5706b29974c1c3ab0ba5a23685accf2fbebc3e06) Reviewed-on: https://gerrit.libreoffice.org/36365 Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r--include/svl/zforlist.hxx3
-rw-r--r--include/svl/zformat.hxx19
2 files changed, 22 insertions, 0 deletions
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index ab7dd90f1426..36e468726a64 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -531,6 +531,9 @@ public:
sal_uInt16& nPrecision, sal_uInt16& nAnzLeading,
LanguageType eLnge = LANGUAGE_DONTKNOW );
+ /// Get round value with fraction representation
+ double GetRoundFractionValue( sal_uInt32 nFormat, double fValue ) const;
+
/// Check if format code string may be deleted by user
bool IsUserDefined( const OUString& sStr, LanguageType eLnge = LANGUAGE_DONTKNOW );
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index ceba6a4993ca..f798d4090638 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -212,6 +212,9 @@ public:
sal_uInt16& nPrecision,
sal_uInt16& nAnzLeading) const;
+ /// Get index of subformat (0..3) according to conditions and fNumber value
+ sal_uInt16 GetSubformatIndex( double fNumber ) const;
+
/// Count of decimal precision
sal_uInt16 GetFormatPrecision() const { return NumFor[0].Info().nCntPost; }
@@ -242,6 +245,9 @@ public:
OUString GetDenominatorString( sal_uInt16 nNumFor ) const;
OUString GetNumeratorString( sal_uInt16 nNumFor ) const;
OUString GetIntegerFractionDelimiterString( sal_uInt16 nNumFor ) const;
+ /// Round fNumber to its fraction representation
+ double GetRoundFractionValue ( double fNumber ) const;
+
/** If the count of string elements (substrings, ignoring [modifiers] and
so on) in a subformat code nNumFor (0..3) is equal to the given number.
Used by ImpSvNumberInputScan::IsNumberFormatMain() to detect a matched
@@ -580,6 +586,19 @@ private:
sal_uInt16 nIx,
bool bInteger );
+ /** Calculate each element of fraction:
+ * integer part, numerator part, denominator part
+ * @param fNumber value to be represented as fraction. Will contain absolute fractional part
+ * @param nIx subformat number 0..3
+ * @param fIntPart integral part of fraction
+ * @param nFrac numerator of fraction
+ * @param nDic denominator of fraction
+ */
+ SVL_DLLPRIVATE void ImpGetFractionElements( double& fNumber,
+ sal_uInt16 nIx,
+ double& fIntPart,
+ sal_uInt64& nFrac,
+ sal_uInt64& nDiv ) const;
SVL_DLLPRIVATE bool ImpGetFractionOutput(double fNumber,
sal_uInt16 nIx,
OUStringBuffer& OutString);