[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 10 commits - connectivity/source desktop/source include/formula sc/source svx/source sw/qa sw/source writerfilter/source

Michael Stahl mstahl at redhat.com
Wed Jun 18 05:26:32 PDT 2014


 connectivity/source/drivers/firebird/StatementCommonBase.cxx |    1 
 desktop/source/deployment/registry/script/dp_script.cxx      |    3 
 desktop/source/lib/init.cxx                                  |    4 -
 include/formula/errorcodes.hxx                               |    4 +
 sc/source/core/tool/interpr1.cxx                             |    2 
 sc/source/core/tool/interpr5.cxx                             |   16 +++-
 sc/source/core/tool/scmatrix.cxx                             |   10 +-
 svx/source/sdr/contact/viewcontactofunocontrol.cxx           |    9 +-
 sw/qa/extras/rtfexport/data/fdo77979.odt                     |binary
 sw/qa/extras/rtfexport/rtfexport.cxx                         |    7 +
 sw/qa/extras/rtfimport/data/fdo76633.rtf                     |   32 ++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx                         |   15 +++
 sw/source/core/unocore/unoframe.cxx                          |    1 
 sw/source/filter/inc/msfilter.hxx                            |   12 ++-
 sw/source/filter/ww8/rtfattributeoutput.cxx                  |   20 ++++-
 sw/source/filter/ww8/writerwordglue.cxx                      |   42 +++++++++++
 sw/source/filter/ww8/wrtw8sty.cxx                            |    3 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx               |   21 +++--
 writerfilter/source/rtftok/rtfsdrimport.cxx                  |    6 +
 writerfilter/source/rtftok/rtfsdrimport.hxx                  |    3 
 20 files changed, 181 insertions(+), 30 deletions(-)

New commits:
commit 99de5eedf3f88d8928e1f7753f2497c9f34853d8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jun 12 20:37:47 2014 +0200

    fdo#76633: writerfilter RTF import: disappear the rectangle shapes on images
    
    If the shape properties are inside \picprop destination, don't set
    shapeType.
    
    (regression from 9f1f7199736e2ae07b34849ba66f61a1ef5782e8)
    
    Actually this does not fix the root cause, this is just a work-around,
    the extra shape is still inserted but it's invisible now.
    
    Change-Id: I6cf093de2a5657533f393863ed8010ae083bec16
    (cherry picked from commit b7857e5cfe9d5d007785ae93e5505620fc8ed475)
    Reviewed-on: https://gerrit.libreoffice.org/9773
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/rtfimport/data/fdo76633.rtf b/sw/qa/extras/rtfimport/data/fdo76633.rtf
new file mode 100644
index 0000000..d339b12
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo76633.rtf
@@ -0,0 +1,32 @@
+{\rtf1\ansi
+{\*\generator LibreOfficeDev/4.4.0.0.alpha0$Linux_X86_64 LibreOffice_project/b534967caca6767cd2100da363b1da2433640ddd}
+{\*\shppict{\pict{\*\picprop{\sp{\sn wzDescription}{\sv }}{\sp{\sn wzName}{\sv }}}\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0\picw64\pich60\picwgoal1280\pichgoal1200\jpegblip
+ffd8ffe000104a46494600010101004800480000ffe101604578696600004d4d002a000000080009010e00020000000100000000010f0002000000060000007a
+011000020000001500000080011200030000000100010000011a00050000000100000096011b0005000000010000009e01280003000000010002000001310002
+0000000c000000a68769000400000001000000b20000000043616e6f6e0043616e6f6e20506f77657253686f7420413531300000000000480000000100000048
+0000000147494d5020322e362e3131000009829a00050000000100000124829d0005000000010000012c88270003000000010000000090000007000000043032
+3130900300020000001400000134920a00050000000100000148928600070000000800000150a00000070000000430313030a001000300000001ffff00000000
+00000051eb85ffffffff0000000400000001323031313a30363a31322031393a32363a3436000000001000000001554e49434f444500ffdb0043000806060706
+05080707070909080a0c140d0c0b0b0c1912130f141d1a1f1e1d1a1c1c20242e2720222c231c1c2837292c30313434341f27393d38323c2e333432ffdb004301
+0909090c0b0c180d0d1832211c213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232
+ffc0001108003c004003012200021101031101ffc4001a000002030101000000000000000000000004050203060100ffc4003210000201030302050302050500
+000000000102030004110512213151132241617106143242911523a1c1e17281b1d1f0ffc400190101010101010100000000000000000000010200030405ffc4
+001d110002020203010000000000000000000000010211213103225141ffda000c03010002110311003f007e1df6912a2c9e8372f27fdc509731bc571f731065
+8b1b668f180bcf0c3e3d7da99c6ca3cf24783ed5cbd1b6d8c91287232319ea3b7c57cc3d82cbdd5adecf62c9b9e50be6551d3e6975d7d49163f976ec47405985
+461fa6defa797c49e73264332a614007b64e71e993da8a6fa26d9b02459ca8f533e7fe055df1ad93d9e81edbea8831992270c060ed20d7351d76316ea6c9f6cb
+2379ba7007b50b7bf467dabaf812c881f254b9ca8f63eb54e816da6dd4d2e9978a535589cf926fc5d7b2907b7355d2ad076d0136b5746e15da77dcbd8fbf6ada
+0769144858052a0e3b8a51aae876a34b98ac31c4f1a92194739a274f995b4cb7594296f0c0233d7ff62a66d35686298dadc1958a89627e7aa9dbd7d0a9fed5c9
+199565555c323608cf0738ff001553b9824dc5778f6f37a54cb89e4dfbcf9941f4c71dea1942c86ff1acc9340764817c2970bc9c72323f7a7aba84aea4e0678e
+0f18acb5bec3acdeba070e1b1c0e09029c2baf86482aa71fa813fd3d6a65156298d3ee5a67db22a6d230ca4fe5599fa8fe985bb432443c2b98fcd6f32b727d42
+934c22994b30cb021b9214f1c7bfad1e2fa27b6922b91cc433b80f6c8c0ef5a2dc5e0cf3b10e8badaeb7612595f0116ab0a14911b8f1401f97cf7ab6cadd52d8
+44e780be50f80323af3e99a5b7f6f8d5edb53b3c7de6e2bb0ae04a30723fd445398d0f86889e424701b079aa963408b2662a049092c18ed200cd4236731c4f9c
+7246339aba1b83185049f7e7d4f7cd0f730cd736720b6f0dd8e498d9f6ab8edd29fa0cc83eb725bdd4a2d88f348497c641f807a579b59bb698399873fa71c0cf
+b502da16b0d3304b275009e0b00073e849a99d175a4600d8bf27960ca40f9e6bbd44e76c3df57ba38669cee1ea3028cd2f5dbcbabb4b090f8aae0e18e015e339
+f7ff00349a6d1355455678939e021917767f7a23e9bb37fe2c65b872823181b39e4fa1ed44a31a14dd9a2d4d360b62ea1b1386ebedd28a376890659d843fa8c9
+d71ff79a13584630c1b18bb8940c28f53d28a8bc4306638f3819219871f39e95c19d11631324061207dc6762b95cec61dc0f71fd69969f0d9ff0f8e2ba01655d
+d9c291ce4f208e71cd7a3b48597c464cbb1de5ba1cf1daaefb189433465e321b8d871d41a993148b25d26d76f98b0e47490f3f3533a4da642a028e0648ce78a5
+1717973671954999f613867e49c9c609edc554faadda40ec24e9818f91454bd3606efa05a4cd993c49075db9c0c8f8aea68f681b7a0973c91e62c47ef40a5ecc
+d023b90c73b79cf4aaef6e678d86d95c33851bb3c8cf6f4a5a97a6c1ed6ece3b7804b02ac9b86c1c12d93c8c01d7a1a147871a239dc84f250b647b64d4e79a53
+0c71072a646c175fc8704e476e959db6bdb892cd54c9b40214ed00646ec7f7aa8a6d03747fffd9}}
+
+\par }
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 345f205..6cd3776 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -569,6 +569,21 @@ DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(19)), xShape->getSize().Height);
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo76633, "fdo76633.rtf")
+{
+    // check that there is only a graphic object, not an additional rectangle
+    uno::Reference<lang::XServiceInfo> xShape(getShape(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xShape.is());
+#if 0
+    // disabled - fails currently
+    CPPUNIT_ASSERT(xShape->supportsService("com.sun.star.text.TextGraphicObject"));
+    try {
+        uno::Reference<drawing::XShape> xShape2(getShape(2), uno::UNO_QUERY);
+        CPPUNIT_FAIL("exception expected");
+    } catch (lang::IndexOutOfBoundsException const&) { /* expected */ }
+#endif
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo48033, "fdo48033.rtf")
 {
     /*
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 67285b0..dd14ca5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1391,7 +1391,8 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
         else if (boost::get<0>(aTuple) == BUFFER_PAR)
             parBreak();
         else if (boost::get<0>(aTuple) == BUFFER_STARTSHAPE)
-            m_pSdrImport->resolve(boost::get<1>(aTuple)->getShape(), false);
+            m_pSdrImport->resolve(boost::get<1>(aTuple)->getShape(), false,
+                    RTFSdrImport::SHAPE);
         else if (boost::get<0>(aTuple) == BUFFER_ENDSHAPE)
             m_pSdrImport->close();
         else
@@ -1660,7 +1661,8 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
                     if (nKeyword == RTF_SHPTXT)
                     {
                         if (!m_aStates.top().pCurrentBuffer)
-                            m_pSdrImport->resolve(m_aStates.top().aShape, false);
+                    m_pSdrImport->resolve(m_aStates.top().aShape, false,
+                            RTFSdrImport::SHAPE);
                         else
                         {
                             RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aShape));
@@ -4326,7 +4328,11 @@ int RTFDocumentImpl::popState()
         case DESTINATION_SHAPEINSTRUCTION:
             // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself.
             if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape))
-                m_pSdrImport->resolve(m_aStates.top().aShape, true);
+        {
+            m_pSdrImport->resolve(m_aStates.top().aShape, true,
+                    (aState.nDestinationState == DESTINATION_SHAPEINSTRUCTION)
+                        ? RTFSdrImport::SHAPE : RTFSdrImport::PICT);
+        }
             else if (aState.bInShapeGroup && !aState.bInShape)
             {
                 // End of a groupshape, as we're in shapegroup, but not in a real shape.
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 7788414..e855086 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -212,7 +212,8 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
     }
 }
 
-void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
+void RTFSdrImport::resolve(RTFShape& rShape, bool bClose,
+        ShapeOrPict const shapeOrPict)
 {
     int nType = -1;
     bool bPib = false;
@@ -243,7 +244,8 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
     bool bOpaque = true;
 
     // The spec doesn't state what is the default for shapeType, Word seems to implement it as a rectangle.
-    if (std::find_if(rShape.aProperties.begin(),
+    if (SHAPE == shapeOrPict &&
+        std::find_if(rShape.aProperties.begin(),
                 rShape.aProperties.end(),
                 boost::bind(&OUString::equals, boost::bind(&std::pair<OUString, OUString>::first, _1), OUString("shapeType")))
             == rShape.aProperties.end())
diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx
index 31d08b4..e4fbaae 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.hxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.hxx
@@ -23,7 +23,8 @@ namespace writerfilter {
                 RTFSdrImport(RTFDocumentImpl& rImport, uno::Reference<lang::XComponent> const& xDstDoc);
                 virtual ~RTFSdrImport();
 
-                void resolve(RTFShape& rShape, bool bClose);
+    enum ShapeOrPict { SHAPE, PICT };
+    void resolve(RTFShape& rShape, bool bClose, ShapeOrPict shapeOrPict);
                 void close();
                 void append(OUString aKey, OUString aValue);
                 /// Append property on the current parent.
commit 3b487a4129828c21770d486c941726cf0106c6c8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jun 13 10:09:41 2014 +0200

    fdo#77979: Make rtl_TextEncodingToWinCharsetRTF work for non-Unicode
    
    "LC_ALL=C make CppunitTest_sw_rtfexport" was still failing after
    e47a02b1524061143d8e77a54eb95c77f2e6dae2 "fdo#77979: sw: RTF export: write non-
    ASCII font names encoded," so for each given eTextEncoding determine a Windows
    charset that can at least encode the font's name, and not only for Unicode-
    related eTextEncodings.
    
    Change-Id: If547566bb0cffc60411d8f667d76749a904f7a3f
    (cherry picked from commit 0dc7d6367dcedff8741b64f5b8775ebf26f7f14f)
    Reviewed-on: https://gerrit.libreoffice.org/9763
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index f4141e5..0f4c133 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -725,38 +725,31 @@ namespace sw
                 OUString const& rFontName, OUString const& rAltName,
                 rtl_TextEncoding eTextEncoding)
         {
-            static struct { rtl_TextEncoding enc; sal_uInt8 charset; }
+            sal_uInt8 nRet =
+                rtl_getBestWindowsCharsetFromTextEncoding(eTextEncoding);
+            rtl_TextEncoding enc2 = rtl_getTextEncodingFromWindowsCharset(nRet);
+            if (!(CanEncode(rFontName, enc2) && CanEncode(rAltName, enc2)))
+            {
+                static struct { rtl_TextEncoding enc; sal_uInt8 charset; }
                 const s_fallbacks [] = {
                     { RTL_TEXTENCODING_MS_932, 0x80 }, // Shift-JIS
                     { RTL_TEXTENCODING_MS_936, 0x86 }, // GB-2312
                     { RTL_TEXTENCODING_MS_950, 0x88 }, // Big5
                     { RTL_TEXTENCODING_MS_949, 0x81 }, // EUC-KR
                 };
-            sal_uInt8 nRet =
-                rtl_getBestWindowsCharsetFromTextEncoding(eTextEncoding);
-            switch (eTextEncoding)
-            {
-                case RTL_TEXTENCODING_DONTKNOW:
-                case RTL_TEXTENCODING_UCS2:
-                case RTL_TEXTENCODING_UTF7:
-                case RTL_TEXTENCODING_UTF8:
-                case RTL_TEXTENCODING_JAVA_UTF8:
-                    for (size_t i = 0; i < SAL_N_ELEMENTS(s_fallbacks); ++i)
+                for (size_t i = 0; i < SAL_N_ELEMENTS(s_fallbacks); ++i)
+                {
+                    // fall back to a charset that can at least encode the
+                    // font's name
+                    if (CanEncode(rFontName, s_fallbacks[i].enc)
+                        && CanEncode(rAltName, s_fallbacks[i].enc))
                     {
-                        // fall back to a charset that can at least encode
-                        // the font's name
-                        if (CanEncode(rFontName, s_fallbacks[i].enc)
-                            && CanEncode(rAltName, s_fallbacks[i].enc))
-                        {
-                            return s_fallbacks[i].charset;
-                        }
+                        return s_fallbacks[i].charset;
                     }
-                    SAL_INFO("sw.rtf", "no fallback charset found for font: "
-                            << rFontName << " " << rAltName);
-                    nRet = 0x01; // all hope lost: "default", whatever that is
-                    break;
-                default:
-                    break;
+                }
+                SAL_INFO("sw.rtf", "no fallback charset found for font: "
+                         << rFontName << " " << rAltName);
+                nRet = 0x01; // all hope lost: "default", whatever that is
             }
             return nRet;
         }
commit b689a929882562f3cd282f71b30167b3451047ac
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jun 13 14:16:11 2014 +0200

    resolved fdo#79978 propagate error through DoubleArray of matrix
    
    Regression introduced with 83f77ab0661df992f241e5f9ecb1aa8f8eaeafec.
    
    Interpreter errors are transported using NaN coded doubles, using simple
    setNan()/isNan() to flag and ignore non-numeric values skips all error
    values.
    
    Change-Id: I0d3cb30262bc5ba7ee77e53a2bc45e56569fbc4b
    (cherry picked from commit a288bebbcec0b16e1ced09a601de5ffbb6b1bbe0)
    Reviewed-on: https://gerrit.libreoffice.org/9768
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/include/formula/errorcodes.hxx b/include/formula/errorcodes.hxx
index d178aec..87dab2b 100644
--- a/include/formula/errorcodes.hxx
+++ b/include/formula/errorcodes.hxx
@@ -75,6 +75,10 @@ const sal_uInt16 errNotNumericString     = 534;
 // ScInterpreter internal:  jump matrix already has a result at this position,
 // do not overwrite in case of empty code path.
 const sal_uInt16 errJumpMatHasResult     = 535;
+// ScInterpreter internal:  (matrix) element is not a numeric value, i.e.
+// string or empty, to be distinguished from the general errNoValue NAN and not
+// to be used as result.
+const sal_uInt16 errElementNaN           = 536;
 
 // Interpreter: NA() not available condition, not a real error
 const sal_uInt16 NOTAVAILABLE            = 0x7fff;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 758ce15..a834488 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5615,7 +5615,7 @@ double ScInterpreter::IterateParametersIfs( ScIterFuncIfs eFunc )
                         continue;
 
                     fVal = *itMain;
-                    if (rtl::math::isNan(fVal))
+                    if (GetDoubleErrorValue(fVal) == errElementNaN)
                         continue;
 
                     ++fCount;
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index d8b97c03..6f1b9ba 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1598,13 +1598,25 @@ namespace {
 class SumValues : std::unary_function<double, void>
 {
     double mfSum;
+    bool   mbError;
 public:
-    SumValues() : mfSum(0.0) {}
+    SumValues() : mfSum(0.0), mbError(false) {}
 
     void operator() (double f)
     {
-        if (!rtl::math::isNan(f))
+        if (mbError)
+            return;
+
+        sal_uInt16 nErr = GetDoubleErrorValue(f);
+        if (!nErr)
             mfSum += f;
+        else if (nErr != errElementNaN)
+        {
+            // Propagate the first error encountered, ignore "this is not a
+            // number" elements.
+            mfSum = f;
+            mbError = true;
+        }
     }
 
     double getValue() const { return mfSum; }
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 3b2c42c..4f210a8 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1512,7 +1512,7 @@ public:
     ToDoubleArray( size_t nSize, bool bEmptyAsZero ) :
         maArray(nSize, 0.0), miPos(maArray.begin()), mbEmptyAsZero(bEmptyAsZero)
     {
-        rtl::math::setNan(&mfNaN);
+        mfNaN = CreateDoubleError( errElementNaN);
     }
 
     void operator() (const MatrixImplType::element_block_node_type& node)
@@ -1583,7 +1583,7 @@ class MergeDoubleArrayFunc : std::unary_function<MatrixImplType::element_block_t
 public:
     MergeDoubleArrayFunc(std::vector<double>& rArray) : mrArray(rArray), miPos(mrArray.begin())
     {
-        rtl::math::setNan(&mfNaN);
+        mfNaN = CreateDoubleError( errElementNaN);
     }
 
     void operator() (const MatrixImplType::element_block_node_type& node)
@@ -1599,7 +1599,7 @@ public:
                 numeric_element_block::const_iterator itEnd = numeric_element_block::end(*node.data);
                 for (; it != itEnd; ++it, ++miPos)
                 {
-                    if (rtl::math::isNan(*miPos))
+                    if (GetDoubleErrorValue(*miPos) == errElementNaN)
                         continue;
 
                     *miPos = op(*miPos, *it);
@@ -1612,7 +1612,7 @@ public:
                 boolean_element_block::const_iterator itEnd = boolean_element_block::end(*node.data);
                 for (; it != itEnd; ++it, ++miPos)
                 {
-                    if (rtl::math::isNan(*miPos))
+                    if (GetDoubleErrorValue(*miPos) == errElementNaN)
                         continue;
 
                     *miPos = op(*miPos, *it ? 1.0 : 0.0);
@@ -1630,7 +1630,7 @@ public:
                 // Empty element is equivalent of having a numeric value of 0.0.
                 for (size_t i = 0; i < node.size; ++i, ++miPos)
                 {
-                    if (rtl::math::isNan(*miPos))
+                    if (GetDoubleErrorValue(*miPos) == errElementNaN)
                         continue;
 
                     *miPos = op(*miPos, 0.0);
commit 6df950ee50047ddd755d652b8019ff51cd64c788
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Thu Jun 12 13:27:27 2014 +0100

    liblok: set the size for the correct structure.
    
    (cherry picked from commit 4ed5bacc86e0137d9ace5a2ceda09c2393716793)
    
    Signed-off-by: Andrzej Hunt <andrzej.hunt at collabora.com>
    
    Conflicts:
    	desktop/source/lib/init.cxx
    
    Change-Id: Id79d76893bfc931334afd59b05ab96a31e441e02

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 204d39b..aaf8929 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -133,7 +133,7 @@ struct LibLODocument_Impl : public _LibreOfficeDocument
     LibLODocument_Impl( const uno::Reference < css::lang::XComponent > &xComponent )
             : mxComponent( xComponent )
     {
-        nSize = sizeof( LibreOffice );
+        nSize = sizeof( LibreOfficeDocument );
 
         destroy = doc_destroy;
         saveAs = doc_saveAs;
@@ -159,7 +159,7 @@ struct LibLibreOffice_Impl : public _LibreOffice
 
     LibLibreOffice_Impl()
     {
-        nSize = sizeof( LibreOfficeDocument );
+        nSize = sizeof( LibreOffice );
 
         destroy = lo_destroy;
         initialize = lo_initialize;
commit 7f6c25aaeb7efadbbc47d7a75c627d2099a15325
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Thu Jun 12 18:00:42 2014 +0200

    allow extensions to override Access2Base
    
    In particular, this allows users or administrators to upgrade Access2Base by installing the extension version of it.
    
    Change-Id: I1650e5beced0fd168afa029dbac2025e2fa16e1f
    Reviewed-on: https://gerrit.libreoffice.org/9754
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx
index 5bd7239..60dc3f2 100644
--- a/desktop/source/deployment/registry/script/dp_script.cxx
+++ b/desktop/source/deployment/registry/script/dp_script.cxx
@@ -346,7 +346,8 @@ lcl_maybeAddScript(
             //same id
             if (sOriginalUrl.match("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE")
                 || sOriginalUrl.match("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE")
-                || sOriginalUrl.match("vnd.sun.star.expand:$BUNDLED_EXTENSIONS"))
+                || sOriginalUrl.match("vnd.sun.star.expand:$BUNDLED_EXTENSIONS")
+                || sOriginalUrl.match("$(INST)/share/basic/Access2Base/"))
             {
                 xScriptLibs->removeLibrary(rName);
                 bCanAdd = true;
commit 5c64d1cf8d3d408b739083b5c00d2143b552fb15
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jun 12 12:16:28 2014 +0200

    fdo#77979: sw: RTF export: write non-ASCII font names encoded
    
    Currently font names like "微软雅黑" (Microsoft YaHei) are
    written as "????" in the RTF export; to avoid that, set the \fcharset
    of the font entry to something that at least is able to encode
    the font name and alternate name.
    
    This requires a new function since the existing
    rtl_TextEncodingToWinCharset was changed in
    b88fe998ce8c80d7629fe70118311096615d959d to return "default" 0x01
    (for OOXML) which is quite unhelpful for RTF.
    
    This is not entirely satisfactory, as of course that is no guarantee
    that the encoding can represent all of the actual text that has the
    font applied; hence there are some \'3f in the fall-back encoded text
    of the heading of the bugdoc, which indicates that the detected
    Shift-JIS is insufficient and GB-2132 would be required; but it's not
    obvious how to do better here without iterating over all the text
    twice, and that still leaves the possibility that all text that has a
    particular font applied cannot be represented by a single non-Unicode
    encoding.
    
    But since we always write text as the \u Unicode + legacy fall-back,
    this should not be a big problem since modern RTF readers will simply
    read the Unicode.
    
    (cherry picked from commit e47a02b1524061143d8e77a54eb95c77f2e6dae2)
    
    fdo#77979: argh forgot to add the test document
    (cherry picked from commit 90b2b378aecfa1914be0ce9aa7aa4e006e225e96)
    
    (cherry picked from commit 276fb59ee66806709382d0eeef20f62a094a5995)
    
    error C2361: initialization of 's_fallbacks' is skipped by 'default'
    (cherry picked from commit f3695bbc17a547b547876dd1175c0b74e5b3e90e)
    
    Conflicts:
    	sw/source/filter/ww8/rtfattributeoutput.cxx
    
    Spell out UTF-8
    (cherry picked from commit 809c8d4c990e77cd8ba52672be7c5e77aae4e90e)
    
    Change-Id: Ie6a42294c501d014dd9f0df82638519412ca19bb
    Reviewed-on: https://gerrit.libreoffice.org/9750
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/rtfexport/data/fdo77979.odt b/sw/qa/extras/rtfexport/data/fdo77979.odt
new file mode 100644
index 0000000..532724c
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo77979.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index ce7dc55..a8db213 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -309,6 +309,13 @@ DECLARE_RTFEXPORT_TEST(testMathRuns, "math-runs.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1)));
 }
 
+DECLARE_RTFEXPORT_TEST(testFdo77979, "fdo77979.odt")
+{
+    // font name is encoded with \fcharset of font
+    CPPUNIT_ASSERT_EQUAL(OUString("\xE5\xBE\xAE\xE8\xBD\xAF\xE9\x9B\x85\xE9\xBB\x91", 12, RTL_TEXTENCODING_UTF8),
+            getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName"));
+}
+
 DECLARE_RTFEXPORT_TEST(testFdo53113, "fdo53113.odt")
 {
     /*
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index 30a5997..0575252 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -59,8 +59,7 @@ namespace sw
     {
         /** MSOffice appears to set the charset of unicode fonts to MS 932
 
-            Arial Unicode MS for example is a unicode font, but word sets
-            exported uses of it to the MS 932 charset
+            But we do "default", whatever that means.
 
             @param eTextEncoding
                 the OOo encoding to convert from
@@ -73,6 +72,15 @@ namespace sw
         */
         sal_uInt8 rtl_TextEncodingToWinCharset(rtl_TextEncoding eTextEncoding);
 
+        /** MSOffice appears to set the charset of unicode fonts to MS 932
+
+            Arial Unicode MS for example is a unicode font, but word sets
+            exported uses of it to the MS 932 charset
+
+        */
+        sal_uInt8 rtl_TextEncodingToWinCharsetRTF(OUString const& rFontName,
+                OUString const& rAltName, rtl_TextEncoding eTextEncoding);
+
         /** Import a MSWord XE field. Suitable for .doc and .rtf
 
             @param rDoc
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 3cf3b69..5844c0d 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2016,7 +2016,12 @@ void RtfAttributeOutput::CharFont( const SvxFontItem& rFont)
     m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LOCH);
     m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_F);
     m_aStylesEnd.append((sal_Int32)m_rExport.maFontHelper.GetId(rFont));
-    m_rExport.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(rtl_getBestWindowsCharsetFromTextEncoding(rFont.GetCharSet()));
+    // FIXME: this may be a tad expensive... but the charset needs to be
+    // consistent with what wwFont::WriteRtf() does
+    FontMapExport aTmp(rFont.GetFamilyName());
+    m_rExport.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(
+            sw::ms::rtl_TextEncodingToWinCharsetRTF(
+                aTmp.msPrimary, aTmp.msSecondary, rFont.GetCharSet()));
 }
 
 void RtfAttributeOutput::CharFontSize( const SvxFontHeightItem& rFontSize)
@@ -3274,7 +3279,10 @@ void RtfAttributeOutput::StartFont( const OUString& rFamilyName ) const
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 
-    m_rExport.Strm() << OUStringToOString( rFamilyName, m_rExport.eCurrentEncoding ).getStr();
+    // write the font name hex-encoded, but without Unicode - Word at least
+    // cannot read *both* Unicode and fallback as written by OutString
+    m_rExport.Strm() <<
+        msfilter::rtfutil::OutString(rFamilyName, m_rExport.eCurrentEncoding, false).getStr();
 }
 
 /// End the font.
@@ -3283,6 +3291,7 @@ void RtfAttributeOutput::EndFont() const
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 
     m_rExport.Strm() << ";}";
+    m_rExport.eCurrentEncoding = m_rExport.eDefaultEncoding;
 }
 
 /// Alternate name for the font.
@@ -3291,7 +3300,11 @@ void RtfAttributeOutput::FontAlternateName( const OUString& rName ) const
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 
     m_rExport.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_FALT << ' ';
-    m_rExport.Strm() << OUStringToOString( rName, m_rExport.eCurrentEncoding ).getStr() << '}';
+    // write the font name hex-encoded, but without Unicode - Word at least
+    // cannot read *both* Unicode and fallback as written by OutString
+    m_rExport.Strm() <<
+        msfilter::rtfutil::OutString(rName, m_rExport.eCurrentEncoding, false).getStr()
+        << '}';
 }
 
 /// Font charset.
@@ -3302,6 +3315,7 @@ void RtfAttributeOutput::FontCharset( sal_uInt8 nCharSet ) const
     m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_FCHARSET;
     m_rExport.OutULong( nCharSet );
     m_rExport.Strm() << ' ';
+    m_rExport.eCurrentEncoding =rtl_getTextEncodingFromWindowsCharset(nCharSet);
 }
 
 /// Font family.
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index bafa0f0..f4141e5 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -712,6 +712,55 @@ namespace sw
             return nRet;
         }
 
+        static bool
+        CanEncode(OUString const& rString, rtl_TextEncoding const eEncoding)
+        {
+            rtl::OString tmp;
+            return rString.convertToString(&tmp, eEncoding,
+                    RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+                    RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
+        }
+
+        sal_uInt8 rtl_TextEncodingToWinCharsetRTF(
+                OUString const& rFontName, OUString const& rAltName,
+                rtl_TextEncoding eTextEncoding)
+        {
+            static struct { rtl_TextEncoding enc; sal_uInt8 charset; }
+                const s_fallbacks [] = {
+                    { RTL_TEXTENCODING_MS_932, 0x80 }, // Shift-JIS
+                    { RTL_TEXTENCODING_MS_936, 0x86 }, // GB-2312
+                    { RTL_TEXTENCODING_MS_950, 0x88 }, // Big5
+                    { RTL_TEXTENCODING_MS_949, 0x81 }, // EUC-KR
+                };
+            sal_uInt8 nRet =
+                rtl_getBestWindowsCharsetFromTextEncoding(eTextEncoding);
+            switch (eTextEncoding)
+            {
+                case RTL_TEXTENCODING_DONTKNOW:
+                case RTL_TEXTENCODING_UCS2:
+                case RTL_TEXTENCODING_UTF7:
+                case RTL_TEXTENCODING_UTF8:
+                case RTL_TEXTENCODING_JAVA_UTF8:
+                    for (size_t i = 0; i < SAL_N_ELEMENTS(s_fallbacks); ++i)
+                    {
+                        // fall back to a charset that can at least encode
+                        // the font's name
+                        if (CanEncode(rFontName, s_fallbacks[i].enc)
+                            && CanEncode(rAltName, s_fallbacks[i].enc))
+                        {
+                            return s_fallbacks[i].charset;
+                        }
+                    }
+                    SAL_INFO("sw.rtf", "no fallback charset found for font: "
+                            << rFontName << " " << rAltName);
+                    nRet = 0x01; // all hope lost: "default", whatever that is
+                    break;
+                default:
+                    break;
+            }
+            return nRet;
+        }
+
         long DateTime2DTTM( const DateTime& rDT )
         {
         /*
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 52a050a..2675cc5 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -857,7 +857,8 @@ void wwFont::WriteRtf( const RtfAttributeOutput* rAttrOutput ) const
 {
     rAttrOutput->FontFamilyType( meFamily, *this );
     rAttrOutput->FontPitchType( mePitch );
-    rAttrOutput->FontCharset( rtl_getBestWindowsCharsetFromTextEncoding( meChrSet ) );
+    rAttrOutput->FontCharset(
+        sw::ms::rtl_TextEncodingToWinCharsetRTF(msFamilyNm, msAltNm, meChrSet));
     rAttrOutput->StartFont( msFamilyNm );
     if ( mbAlt )
         rAttrOutput->FontAlternateName( msAltNm );
commit 8fdbeb7d55a6d534c476e3fc89979df25d7920c8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Jun 12 12:04:01 2014 +0200

    related: fdo#77979: writerfilter RTF import: read encoded font name
    
    The font name is encoded in the font's charset given by \fcharset.
    
    (cherry picked from commit 04d5a280beeeb6e056df68395dc9c3b3a674361b)
    
    Conflicts:
    	writerfilter/source/rtftok/rtfdocumentimpl.cxx
    
    (cherry picked from commit 790df682574eb4b3da9a973c3116b54d7666837c)
    
    Conflicts:
    	writerfilter/source/rtftok/rtfdocumentimpl.cxx
    
    Change-Id: Id9520649a1eb3b55f4314e140abda7399f23d925
    Reviewed-on: https://gerrit.libreoffice.org/9749
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 920b19f..67285b0 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -967,10 +967,6 @@ int RTFDocumentImpl::resolveChars(char ch)
 
         if (RTL_TEXTENCODING_MS_932 == m_aStates.top().nCurrentEncoding)
         {
-            // fdo#79384: Word will reject Shift-JIS following \loch
-            // but apparently OOo could read and (worse) write such documents
-            SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::DBCH,
-                "writerfilter.rtftok", "invalid Shift-JIS without DBCH");
             unsigned char uch = ch;
             if ((uch >= 0x80 && uch <= 0x9F) || uch >= 0xE0)
             {
@@ -978,6 +974,9 @@ int RTFDocumentImpl::resolveChars(char ch)
                 Strm() >> ch;
                 if (m_aStates.top().nCharsToSkip == 0)
                 {
+                    // fdo#79384: Word will reject Shift-JIS following \loch
+                    // but apparently OOo could read and (worse) write such documents
+                    SAL_INFO_IF(m_aStates.top().eRunType != RTFParserState::DBCH, "writerfilter.rtf", "invalid Shift-JIS without DBCH");
                     assert(bUnicodeChecked);
                     aBuf.append(ch);
                 }
@@ -3254,6 +3253,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                     return 0;
 
                 m_aFontEncodings[m_nCurrentFontIndex] = rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage);
+                m_aStates.top().nCurrentEncoding = m_aFontEncodings[m_nCurrentFontIndex];
             }
             break;
         case RTF_ANSICPG:
@@ -3264,6 +3264,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             break;
         case RTF_CPG:
             m_aFontEncodings[m_nCurrentFontIndex] = rtl_getTextEncodingFromWindowsCodePage(nParam);
+            m_aStates.top().nCurrentEncoding = m_aFontEncodings[m_nCurrentFontIndex];
             break;
         case RTF_CF:
             {
commit c53500d3af2009f0954b662e76167198dbac7c49
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Jun 12 12:10:33 2014 +0200

    fdo#79883 the page view object contact must exist
    
    Change-Id: I5c6bd3ea267f1ea84b46e46aa508a27d00903347
    (cherry picked from commit 551c915dcbf3e1d6bfd799c6e13e5700e2c3e535)
    Reviewed-on: https://gerrit.libreoffice.org/9747
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/source/sdr/contact/viewcontactofunocontrol.cxx b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
index 08f1100..98b4243 100644
--- a/svx/source/sdr/contact/viewcontactofunocontrol.cxx
+++ b/svx/source/sdr/contact/viewcontactofunocontrol.cxx
@@ -106,10 +106,13 @@ namespace sdr { namespace contact {
     {
         // print or print preview requires special handling
         const OutputDevice* pDevice = _rObjectContact.TryToGetOutputDevice();
-        bool bPrintOrPreview = ( pDevice != NULL ) && ( pDevice->GetOutDevType() == OUTDEV_PRINTER );
+        ObjectContactOfPageView* const pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &_rObjectContact  );
 
-        ObjectContactOfPageView* pPageViewContact = dynamic_cast< ObjectContactOfPageView* >( &_rObjectContact  );
-        bPrintOrPreview |= ( pPageViewContact != NULL ) && pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview();
+        const bool bPrintOrPreview = pPageViewContact
+            && ( ( ( pDevice != NULL ) && ( pDevice->GetOutDevType() == OUTDEV_PRINTER ) )
+                    || pPageViewContact->GetPageWindow().GetPageView().GetView().IsPrintPreview()
+               )
+            ;
 
         if ( bPrintOrPreview )
             return *new UnoControlPrintOrPreviewContact( *pPageViewContact, *this );
commit 0941f86f75cec4e78466cac0964ea1aab2c36266
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Wed Jun 11 19:24:03 2014 +0200

    Related fdo#79714 OSX-crash opening query or table in embedded Firebird ODB
    
    See https://bugs.freedesktop.org/attachment.cgi?id=100839 and other comments
    
    Change-Id: I1187b171caf54997f5e8850ade4a3fb35ad9ec29
    Reviewed-on: https://gerrit.libreoffice.org/9742
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
index dfff5d7..4820da4 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -194,6 +194,7 @@ void OStatementCommonBase::prepareAndDescribeStatement(const OUString& sql,
         free(pOutSqlda);
         pOutSqlda = (XSQLDA*) malloc(XSQLDA_LENGTH(n));
         pOutSqlda->version = SQLDA_VERSION1;
+        pOutSqlda->sqln = n;
         aErr = isc_dsql_describe(m_statusVector,
                                  &m_aStatementHandle,
                                  1,
commit 3e9238767319b5ebc131e69f338e5052a1739253
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Tue Jun 10 14:49:06 2014 +0000

    Related: #i125072# map given style name to corresponding UI name...
    
    before searching for it.
    
    (cherry picked from commit 4a76d7f700da112a553ec9d9811731e645581a7f)
    
    Conflicts:
    	sw/source/core/unocore/unoframe.cxx
    
    Change-Id: I294bd7f21ec0acee0f7b8e7be067e04b5a785e43
    (cherry picked from commit 3a72f4ba07458ee9c4c726486304f31900d89044)
    Reviewed-on: https://gerrit.libreoffice.org/9736
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index e2093aa..c7f0a44 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -693,6 +693,7 @@ bool SwGraphicProperties_Impl::AnyToItemSet(
     {
         OUString sStyle;
         *pStyleName >>= sStyle;
+        SwStyleNameMapper::FillUIName(sStyle, sStyle, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, true);
         pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
                                                     SFX_STYLE_FAMILY_FRAME);
     }


More information about the Libreoffice-commits mailing list