[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - 2 commits - dbaccess/source sc/source

Julien Nabet serval2412 at yahoo.fr
Wed Jun 7 19:55:03 UTC 2017


 dbaccess/source/ui/misc/TokenWriter.cxx |    2 +-
 sc/source/ui/view/formatsh.cxx          |   28 ++++++++--------------------
 2 files changed, 9 insertions(+), 21 deletions(-)

New commits:
commit a485908af200fadd561af0a5011276613849e356
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue May 30 23:50:18 2017 +0200

    tdf#37859: Odb data copied to Calc showed wrong encoding in Windows
    
    Blind fix since I don't have Windows.
    If it works, many thanks to:
    - Urmas (see https://bugs.documentfoundation.org/show_bug.cgi?id=37859#c16)
    - Himajin100000 (see https://bugs.documentfoundation.org/show_bug.cgi?id=37859#c35)
    
    Change-Id: I9fd84977eab8410ec022b6e34f1a636326eaf56a
    Reviewed-on: https://gerrit.libreoffice.org/38253
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 39487b14956d883899311b6294f6f09ca2371366)
    Reviewed-on: https://gerrit.libreoffice.org/38513

diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index f81c7fa651d0..5fd36c8b0af9 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -675,7 +675,7 @@ void OHTMLImportExport::WriteHeader()
     IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_head );
 
     SfxFrameHTMLWriter::Out_DocInfo( (*m_pStream), OUString(),
-        xDocProps, sIndent );
+        xDocProps, sIndent, osl_getThreadTextEncoding() );
     OUT_LF();
     IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head );
 }
commit 07dcac8a0057fc24e8cf0a8daebacd97da9c982c
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date:   Tue Jun 6 13:28:57 2017 +0300

    tdf#86119 Generalize number format control.
    
    Change-Id: I3d657aee45533d4c2cafb0c6ea8aab7a77732d2d
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/38434
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 864f3d6d305240823304f8bad7b5d2603bbc0339)
    Reviewed-on: https://gerrit.libreoffice.org/38517

diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index cef3eab48bc3..4943dd8b1dfb 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1127,9 +1127,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
             rReq.Done();
             break;
         case SID_NUMBER_STANDARD:
-            if (!(nType & css::util::NumberFormat::NUMBER))
-                pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
-            rBindings.Invalidate( nSlot );
+            pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
             rReq.Done();
             break;
         case SID_NUMBER_INCDEC:
@@ -2485,9 +2483,14 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
     ScTabViewShell* pTabViewShell   = GetViewData()->GetViewShell();
     ScDocument* pDoc                = pViewData->GetDocument();
     short nType                     = GetCurrentNumberFormatType();
+    const SfxItemSet& rAttrSet      = pTabViewShell->GetSelectionPattern()->GetItemSet();
+    sal_uInt32 nNumberFormat        = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue();
+    SvNumberFormatter* pFormatter   = pDoc->GetFormatTable();
+    NfIndexTableOffset nOffset      = pFormatter->GetIndexTableOffset(nNumberFormat);
 
     SfxWhichIter aIter(rSet);
     sal_uInt16 nWhich = aIter.FirstWhich();
+
     while ( nWhich )
     {
         switch ( nWhich )
@@ -2495,12 +2498,8 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
             case SID_NUMBER_FORMAT:
                 // symphony version with format interpretation
                 {
-                    const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
-
                     if(SfxItemState::DONTCARE != rAttrSet.GetItemState(ATTR_VALUE_FORMAT))
                     {
-                        SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-                        sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue();
                         bool bThousand(false);
                         bool bNegRed(false);
                         sal_uInt16 nPrecision(0);
@@ -2543,11 +2542,8 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
             case SID_NUMBER_TYPE_FORMAT:
                 {
                     sal_Int16 aFormatCode = -1;
-                    const SfxItemSet& rAttrSet  = pTabViewShell->GetSelectionPattern()->GetItemSet();
                     if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) >= SfxItemState::DEFAULT ) //Modify for more robust
                     {
-                        SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-                        sal_uInt32 nNumberFormat = pTabViewShell->GetSelectionPattern()->GetNumberFormat( pFormatter );
                         const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat );
                         bool bStandard = false;
 
@@ -2633,18 +2629,10 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
                 rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::TIME)) );
                 break;
             case SID_NUMBER_TWODEC:
-                {
-                    const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
-                    sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue();
-                    rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 4 ) );
-                }
+                    rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && nOffset == NF_NUMBER_1000DEC2 ) );
                 break;
             case SID_NUMBER_STANDARD:
-                {
-                    const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
-                    sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue();
-                    rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 0 ) );
-                }
+                    rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && (nNumberFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) );
                 break;
         }
         nWhich = aIter.NextWhich();


More information about the Libreoffice-commits mailing list