summaryrefslogtreecommitdiff
path: root/include/svl/zformat.hxx
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-02-20 18:35:18 +0000
commit5706b29974c1c3ab0ba5a23685accf2fbebc3e06 (patch)
tree9af9c43945ae83c417e59ff3eabff5d90ddaf974 /include/svl/zformat.hxx
parentfc711de31b57e0f4d4c4615ef4fd201425cd9f47 (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>
Diffstat (limited to 'include/svl/zformat.hxx')
-rw-r--r--include/svl/zformat.hxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index ce632ae04920..d68a1007cc24 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
@@ -579,6 +585,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);