summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Balland-Poirier <laurent.balland-poirier@laposte.net>2017-02-15 23:27:34 +0100
committerAndras Timar <andras.timar@collabora.com>2017-04-12 17:16:54 +0200
commit2caec05af2ff90101c68b2f0acac1045b5e5074c (patch)
treef81478c08b4a6c869dbabe1278f8262d200b134e /include
parent05c0bbf341d6cd2ca87ec1aacd12e33ab1b979a8 (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> (cherry picked from commit 9f70f8761a8cc180171022ffcffc0094c4957057)
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);