[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 12 commits - dbaccess/source include/oox oox/Library_oox.mk oox/source sc/source sd/source sw/qa sw/source unotools/source vcl/win

Armin Le Grand alg at apache.org
Thu Jul 10 02:09:11 PDT 2014


 dbaccess/source/core/dataaccess/documentdefinition.cxx |    2 
 include/oox/drawingml/ThemeOverrideFragmentHandler.hxx |   40 +++++++++
 include/oox/drawingml/shapepropertymap.hxx             |    4 
 include/oox/ppt/pptimport.hxx                          |    1 
 oox/Library_oox.mk                                     |    1 
 oox/source/drawingml/ThemeOverrideFragmentHandler.cxx  |   48 +++++++++++
 oox/source/drawingml/chart/objectformatter.cxx         |    8 -
 oox/source/drawingml/shape.cxx                         |   20 ++++
 sc/source/filter/xml/xmlcelli.cxx                      |    6 +
 sd/source/ui/unoidl/unopage.cxx                        |   16 +++
 sw/qa/extras/ww8import/data/fdo77844.doc               |binary
 sw/qa/extras/ww8import/ww8import.cxx                   |   47 ++++++++++
 sw/source/filter/ww8/ww8par.cxx                        |   74 ++++++++++++-----
 sw/source/filter/ww8/ww8par.hxx                        |    2 
 unotools/source/config/useroptions.cxx                 |   38 +++++++-
 vcl/win/source/window/salframe.cxx                     |    2 
 16 files changed, 278 insertions(+), 31 deletions(-)

New commits:
commit 9e3b80f2348da3455f5c751d74a1f1c5a622af13
Author: Armin Le Grand <alg at apache.org>
Date:   Wed Jul 9 11:57:21 2014 +0000

    Resolves: #i119287# corrected default style for draw objects...
    
    created using UNO API
    
    (cherry picked from commit d07778f62ed386672a60ef7570a89b5fa109e026)
    
    Conflicts:
    	sd/source/ui/unoidl/unopage.cxx
    
    (cherry picked from commit 0aa3dee5e88a1494a7a6a8401e084cbdb4324727)
    Signed-off-by: Andras Timar <andras.timar at collabora.com>
    
    Conflicts:
    	sd/source/ui/unoidl/unopage.cxx
    
    Change-Id: I016d801edefb5ab32b7b6a8e13a1dc3e8fdb866e

diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 9ad3473..fa61e5f 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -69,6 +69,7 @@
 #include "unopback.hxx"
 #include "unohelp.hxx"
 #include <vcl/dibtools.hxx>
+#include <svx/svdograf.hxx>
 
 using ::com::sun::star::animations::XAnimationNode;
 using ::com::sun::star::animations::XAnimationNodeSupplier;
@@ -410,7 +411,22 @@ SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShap
         {
             SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
             if( pDoc )
+            {
+                // #i119287# similar to the code in the SdrObject methods the graphic and ole
+                // SdrObjects need another default style than the rest, see task. Adding here, too.
+                // TTTT: Same as for #i119287#: Can be removed in branch aw080 again
+                const bool bIsSdrGrafObj(0 != dynamic_cast< SdrGrafObj* >(pObj));
+                const bool bIsSdrOle2Obj(0 != dynamic_cast< SdrOle2Obj* >(pObj));
+
+                if(bIsSdrGrafObj || bIsSdrOle2Obj)
+                {
+                    pObj->NbcSetStyleSheet(pDoc->GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), sal_True);
+                }
+                else
+                {
                 pObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
+                }
+            }
         }
         return pObj;
     }
commit 8196454b0e6fd1d48d6d862ac3207f36abb869e2
Author: Andras Timar <andras.timar at collabora.com>
Date:   Wed Jul 9 11:44:32 2014 +0200

    localized GetFullName()
    
    Change-Id: I4f2bffadef3db1bd07432202525734ab9b0cb0de
    (cherry picked from commit 33c36fb9fbc69bbc32088532dd21db7153aee09d)

diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index 01ae9e6..1dadaf3 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -19,7 +19,7 @@
 
 
 #include <unotools/useroptions.hxx>
-
+#include <unotools/syslocale.hxx>
 #include <unotools/configmgr.hxx>
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
@@ -39,6 +39,7 @@
 #include <com/sun/star/util/ChangesEvent.hpp>
 #include <comphelper/configurationhelper.hxx>
 #include <comphelper/processfactory.hxx>
+#include <i18nlangtag/mslangid.hxx>
 
 using namespace utl;
 using namespace com::sun::star;
@@ -210,11 +211,36 @@ void SvtUserOptions::Impl::SetToken (sal_uInt16 nToken, OUString const& sToken)
 
 OUString SvtUserOptions::Impl::GetFullName () const
 {
-    // TODO international name
-    OUString sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
-    if (!sFullName.isEmpty())
-        sFullName += " ";
-    sFullName += GetToken(USER_OPT_LASTNAME).trim();
+    OUString sFullName;
+    switch (LanguageType const eLang = SvtSysLocale().GetUILanguageTag().getLanguageType())
+    {
+        case LANGUAGE_RUSSIAN:
+            sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
+            if (!sFullName.isEmpty())
+                sFullName += " ";
+            sFullName += GetToken(USER_OPT_FATHERSNAME).trim();
+            if (!sFullName.isEmpty())
+                sFullName += " ";
+            sFullName += GetToken(USER_OPT_LASTNAME).trim();
+            break;
+        default:
+            if (MsLangId::isFamilyNameFirst(eLang))
+            {
+                sFullName = GetToken(USER_OPT_LASTNAME).trim();
+                if (!sFullName.isEmpty())
+                    sFullName += " ";
+                sFullName += GetToken(USER_OPT_FIRSTNAME).trim();
+            }
+            else
+            {
+                sFullName = GetToken(USER_OPT_FIRSTNAME).trim();
+                if (!sFullName.isEmpty())
+                    sFullName += " ";
+                sFullName += GetToken(USER_OPT_LASTNAME).trim();
+            }
+            break;
+    }
+
     return sFullName;
 }
 
commit cbe1e2e735ca4f90cff32986b415d3e7fea52b07
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jul 9 19:16:19 2014 +0200

    resolved fdo#62250 absent value cell values are not NaN, set to 0.0
    
    Change-Id: I41459d72adbaa8f6c0c7c22447f6eba5eb8be3e1
    (cherry picked from commit fea6f83df8d2183b108695217bc4ff7a93e942c9)
    Reviewed-on: https://gerrit.libreoffice.org/10176
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 41e6111..a3321c2 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1151,6 +1151,12 @@ void ScXMLTableRowCellContext::PutValueCell( const ScAddress& rCurrentPos )
     }
     else  //regular value cell
     {
+        // fdo#62250 absent values are not NaN, set to 0.0
+        // PutValueCell() is called only for a known cell value type,
+        // bIsEmpty==false in all these cases, no sense to check it here.
+        if (::rtl::math::isNan( fValue))
+            fValue = 0.0;
+
         // #i62435# Initialize the value cell's script type if the default
         // style's number format is latin-only. If the cell uses a different
         // format, the script type will be reset when the style is applied.
commit 1d211f098c5c9b55663092d2a0a8fd7e28d539a8
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Fri Jul 4 15:12:59 2014 +0200

    bnc#882383: Do not ignore themeOverride for charts in .pptx
    
    Otherwise wrong colors are displayed.
    
    (cherry picked from commit 08818d8a45e034ad825c7fafbb76766f106f1d1d)
    
    Conflicts:
    	oox/source/drawingml/shape.cxx
    
    Change-Id: I5d7444100355fdbc5fcd2aaa1c01202ace54312d
    Reviewed-on: https://gerrit.libreoffice.org/10164
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/include/oox/drawingml/ThemeOverrideFragmentHandler.hxx b/include/oox/drawingml/ThemeOverrideFragmentHandler.hxx
new file mode 100644
index 0000000..827cf5a
--- /dev/null
+++ b/include/oox/drawingml/ThemeOverrideFragmentHandler.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_THEMEOVERRICEFRAGMENTHANDLER_HXX
+#define INCLUDED_OOX_DRAWINGML_THEMEOVERRICEFRAGMENTHANDLER_HXX
+
+#include <oox/core/fragmenthandler2.hxx>
+
+namespace oox {
+namespace drawingml {
+
+class Theme;
+
+class ThemeOverrideFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+    explicit            ThemeOverrideFragmentHandler(
+                            ::oox::core::XmlFilterBase& rFilter,
+                            const OUString& rFragmentPath,
+                            Theme& rTheme );
+    virtual             ~ThemeOverrideFragmentHandler();
+
+    virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
+
+private:
+    Theme&              mrTheme;
+};
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/ppt/pptimport.hxx b/include/oox/ppt/pptimport.hxx
index ffde992..3aaf5f1 100644
--- a/include/oox/ppt/pptimport.hxx
+++ b/include/oox/ppt/pptimport.hxx
@@ -50,6 +50,7 @@ public:
     virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
     virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
 
+    SlidePersistPtr                                         getActualSlidePersist() const { return mpActualSlidePersist; };
     void                                                    setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; };
     std::map< OUString, oox::drawingml::ThemePtr >&    getThemes(){ return maThemes; };
     std::vector< SlidePersistPtr >&                         getDrawPages(){ return maDrawPages; };
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index f9ac63e..d933b56 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -201,6 +201,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
     oox/source/drawingml/theme \
     oox/source/drawingml/themeelementscontext \
     oox/source/drawingml/themefragmenthandler \
+    oox/source/drawingml/ThemeOverrideFragmentHandler \
     oox/source/drawingml/transform2dcontext \
     oox/source/dump/dffdumper \
     oox/source/dump/dumperbase \
diff --git a/oox/source/drawingml/ThemeOverrideFragmentHandler.cxx b/oox/source/drawingml/ThemeOverrideFragmentHandler.cxx
new file mode 100644
index 0000000..5f3e7fc
--- /dev/null
+++ b/oox/source/drawingml/ThemeOverrideFragmentHandler.cxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "oox/drawingml/ThemeOverrideFragmentHandler.hxx"
+#include "oox/drawingml/theme.hxx"
+#include "oox/drawingml/themeelementscontext.hxx"
+
+using namespace ::oox::core;
+
+namespace oox {
+namespace drawingml {
+
+ThemeOverrideFragmentHandler::ThemeOverrideFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, Theme& rTheme ) :
+    FragmentHandler2( rFilter, rFragmentPath ),
+    mrTheme( rTheme )
+{
+}
+
+ThemeOverrideFragmentHandler::~ThemeOverrideFragmentHandler()
+{
+}
+
+ContextHandlerRef ThemeOverrideFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& )
+{
+    // CT_OfficeStyleSheet
+    switch( getCurrentElement() )
+    {
+        case XML_ROOT_CONTEXT:
+            switch( nElement )
+            {
+                case A_TOKEN( themeOverride ): // CT_BaseStylesOverride
+                    return new ThemeElementsContext( *this, mrTheme );
+            }
+        break;
+    }
+    return 0;
+}
+
+} // namespace drawingml
+} // namespace oox
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 0e351d5..b567e1c 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -25,10 +25,12 @@
 #include "oox/drawingml/effectproperties.hxx"
 #include "oox/drawingml/shapepropertymap.hxx"
 #include "oox/drawingml/textbody.hxx"
+#include "oox/drawingml/ThemeOverrideFragmentHandler.hxx"
 #include "oox/drawingml/table/tableproperties.hxx"
 #include "oox/drawingml/chart/chartconverter.hxx"
 #include "oox/drawingml/chart/chartspacefragment.hxx"
 #include "oox/drawingml/chart/chartspacemodel.hxx"
+#include "oox/ppt/pptimport.hxx"
 #include "oox/vml/vmldrawing.hxx"
 #include "oox/vml/vmlshape.hxx"
 #include "oox/vml/vmlshapecontainer.hxx"
@@ -47,6 +49,7 @@
 #include <com/sun/star/beans/XMultiPropertySet.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
 #include <com/sun/star/drawing/GraphicExportFilter.hpp>
@@ -856,7 +859,22 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >&
 
                 // load the chart data from the XML fragment
                 chart::ChartSpaceModel aModel;
-                rFilter.importFragment( new chart::ChartSpaceFragment( rFilter, mxChartShapeInfo->maFragmentPath, aModel ) );
+                chart::ChartSpaceFragment *pChartSpaceFragment = new chart::ChartSpaceFragment(
+                        rFilter, mxChartShapeInfo->maFragmentPath, aModel );
+                const OUString aThemeOverrideFragmentPath( pChartSpaceFragment->
+                        getFragmentPathFromFirstTypeFromOfficeDoc("themeOverride") );
+                rFilter.importFragment( pChartSpaceFragment );
+                ::oox::ppt::PowerPointImport *pPowerPointImport =
+                    dynamic_cast< ::oox::ppt::PowerPointImport* >(&rFilter);
+                if (!aThemeOverrideFragmentPath.isEmpty() && pPowerPointImport)
+                {
+                    uno::Reference< xml::sax::XFastSAXSerializable > xDoc(
+                            rFilter.importFragment(aThemeOverrideFragmentPath), uno::UNO_QUERY_THROW);
+                    ThemePtr pTheme = pPowerPointImport->getActualSlidePersist()->getTheme();
+                    rFilter.importFragment(new ThemeOverrideFragmentHandler(
+                                rFilter, aThemeOverrideFragmentPath, *pTheme), xDoc);
+                    pPowerPointImport->getActualSlidePersist()->setTheme(pTheme);
+                }
 
                 // convert imported chart model to chart document
                 Reference< drawing::XShapes > xExternalPage;
commit 6d269e805f5cc395acd49e6f1288da5560784d9f
Author: Luke Deller <luke at deller.id.au>
Date:   Sun Jul 6 23:19:18 2014 +1000

    fix fdo#77844: header wrongly enabled from .doc
    
    The LO page style needs page headers to be turned on if the
    corresponding .doc file section has a left (=even) page header or a
    first page header.
    
    However this should not be triggered in the case where a first page
    header is present but hidden due to the "different first page" header
    option being disabled. This case is fixed by this commit.
    
    Change-Id: If3de0df45378587fdbdecc6a091d2f4b60940b43
    Reviewed-on: https://gerrit.libreoffice.org/10100
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit f312ef98de57a5926be67421395544bb9d41b809)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/ww8import/data/fdo77844.doc b/sw/qa/extras/ww8import/data/fdo77844.doc
new file mode 100755
index 0000000..cd7368d
Binary files /dev/null and b/sw/qa/extras/ww8import/data/fdo77844.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index 09467cd..0d360d8 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -278,6 +278,53 @@ DECLARE_WW8IMPORT_TEST(testBnc875715, "bnc875715.doc")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xSections->getByIndex(0), "SectionLeftMargin"));
 }
 
+DECLARE_WW8IMPORT_TEST(testFdo77844, "fdo77844.doc")
+{
+    uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles");
+
+    // get a page cursor
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+        xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<text::XPageCursor> xCursor(
+        xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+
+    // check that the first page has no header
+    xCursor->jumpToFirstPage();
+    OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+    uno::Reference<style::XStyle> pageStyle(
+        pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+    bool headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn");
+    CPPUNIT_ASSERT(!headerIsOn);
+
+    // check that the second page has a header
+    xCursor->jumpToPage(2);
+    pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+    pageStyle.set(
+        pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+    headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn");
+    CPPUNIT_ASSERT(headerIsOn);
+
+    // check that the third page has a header
+    xCursor->jumpToPage(3);
+    pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+    pageStyle.set(
+        pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+    headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn");
+    CPPUNIT_ASSERT(headerIsOn);
+
+    // check that the fourth page has no header
+    // (#if'd out as this is not yet imported correctly)
+#if 0
+    xCursor->jumpToPage(4);
+    pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+    pageStyle.set(
+        pageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+    headerIsOn = getProperty<bool>(pageStyle, "HeaderIsOn");
+    CPPUNIT_ASSERT(!headerIsOn);
+#endif
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 3755c8f..e8b2dbc 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2382,6 +2382,9 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
         long nLen;
         sal_uInt8 nNumber = 5;
 
+        // This loops through the 6 flags WW8_{FOOTER,HEADER}_{ODD,EVEN,FIRST}
+        // corresponding to bit fields in grpfIhdt indicating which
+        // header/footer(s) are present in this section
         for( sal_uInt8 nI = 0x20; nI; nI >>= 1, nNumber-- )
         {
             if (nI & grpfIhdt)
@@ -2399,6 +2402,12 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
                     = (nI & ( WW8_HEADER_EVEN | WW8_FOOTER_EVEN )) ? true: false;
                 bool bUseFirst
                     = (nI & ( WW8_HEADER_FIRST | WW8_FOOTER_FIRST )) ? true: false;
+
+                // If we are loading a first-page header/footer which is not
+                // actually enabled in this section (it still needs to be
+                // loaded as it may be inherited by a later section)
+                bool bDisabledFirst = bUseFirst && !rSection.HasTitlePage();
+
                 bool bFooter
                     = (nI & ( WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST )) ? true: false;
 
@@ -2413,7 +2422,8 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
                 {
                     bIsFooter = true;
                     //#i17196# Cannot have left without right
-                    if (!pPD->GetMaster().GetFooter().GetFooterFmt())
+                    if (!bDisabledFirst
+                            && !pPD->GetMaster().GetFooter().GetFooterFmt())
                         pPD->GetMaster().SetFmtAttr(SwFmtFooter(true));
                     if (bUseLeft)
                         pPD->GetLeft().SetFmtAttr(SwFmtFooter(true));
@@ -2425,7 +2435,8 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev,
                 {
                     bIsHeader = true;
                     //#i17196# Cannot have left without right
-                    if (!pPD->GetMaster().GetHeader().GetHeaderFmt())
+                    if (!bDisabledFirst
+                            && !pPD->GetMaster().GetHeader().GetHeaderFmt())
                         pPD->GetMaster().SetFmtAttr(SwFmtHeader(true));
                     if (bUseLeft)
                         pPD->GetLeft().SetFmtAttr(SwFmtHeader(true));
commit 8325d47653063b64f09000d3fd6bea383e0c0e05
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 8 13:05:41 2014 +0200

    sw: do more input validation in SwWW8ImplReader::Read_And
    
    (to fix up f2945255df273404ee2457dcf761cb8f334b732b)
    
    Change-Id: Ie20fb9db4515b9737322ec7224ecd7e411d31c03
    (cherry picked from commit ae2e7ad276acb9394691a9d4a702ed7a6b07b508)
    Reviewed-on: https://gerrit.libreoffice.org/10141
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 96b6221..3755c8f 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2184,7 +2184,9 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
                 //that relate to each annotation index as the parser passes
                 //those points.
                 sal_Int32 nLen = nEnd - nStart;
-                if( nLen )
+                // the start and end positions are apparently stored in
+                // different arrays, so in an invalid file only one could exist
+                if(SAL_MAX_INT32 != nEnd && SAL_MAX_INT32 != nStart && nLen > 0)
                 {
                     if (pPaM->GetPoint()->nContent.GetIndex() >= nLen)
                     {
commit 78ec69d2247dfdef9b5a5b94a76cfd1411c72b7f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 7 11:44:23 2014 +0100

    fix crash loading ooo100546-1.xls
    
    regressions around inserted extra enum values
    into ShapePropertyId
    
    (cherry picked from commit aacfd5038d05a02f8b1eade3a5896d3d7e959f3d)
    
    Conflicts:
    	include/oox/drawingml/shapepropertymap.hxx
    	oox/source/drawingml/chart/objectformatter.cxx
    
    Change-Id: I06696c8cfe4acc3836723c31d5e714bd7d8439b3
    Reviewed-on: https://gerrit.libreoffice.org/10136
    Reviewed-by: Matúš Kukan <matus.kukan at collabora.com>
    Tested-by: Matúš Kukan <matus.kukan at collabora.com>

diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index f2dc8ec..f8ba462 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -34,6 +34,10 @@ namespace drawingml {
 
     This is an abstraction for shape formatting properties that have different
     names in various implementations, e.g. drawing shapes vs. chart objects.
+
+    If you *insert* ids into this list, then update spnCommonPropIds, spnLinearPropIds
+    and spnFilledPropIds of oox/source/drawingml/chart/objectformatter.cxx if
+    the newly inserted enum is inside the range they cover
  */
 enum ShapePropertyId
 {
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 5f01ab0..b5b0a5b 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -460,14 +460,14 @@ const AutoTextEntry* lclGetAutoTextEntry( const AutoTextEntry* pEntries, sal_Int
     return 0;
 }
 
-// ----------------------------------------------------------------------------
+// These PropIds arrays will be indexed into using a ShapePropertyId enum (include/oox/drawingml/shapepropertymap.hxx)
 
 /** Property identifiers for common chart objects, to be used in ShapePropertyInfo. */
 static const sal_Int32 spnCommonPropIds[] =
 {
     PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDashName,
     PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
-    PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillGradientName,
+    PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, PROP_FillGradientName,
     PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
     PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint
 };
@@ -477,7 +477,7 @@ static const sal_Int32 spnLinearPropIds[] =
 {
     PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName,
     PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
-    PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
+    PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
     PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
     PROP_INVALID, PROP_INVALID, PROP_INVALID
 };
@@ -487,7 +487,7 @@ static const sal_Int32 spnFilledPropIds[] =
 {
     PROP_BorderStyle, PROP_BorderWidth, PROP_BorderColor, PROP_BorderTransparency, PROP_BorderDashName,
     PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
-    PROP_FillStyle, PROP_Color, PROP_Transparency, PROP_GradientName,
+    PROP_FillStyle, PROP_Color, PROP_Transparency, PROP_INVALID, PROP_GradientName,
     PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
     PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint
 };
commit 26b85df67f6fad0fd5035b835ab724f6be52067e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 4 16:50:54 2014 +0100

    fix crash loading ooo#93570-3.doc
    
    regression from f2945255df273404ee2457dcf761cb8f334b732b
    cp#2013101510000026: doc import of comments affecting more text nodes
    
    use Move(fnMoveBackward, fnGoNode) to at least ensure we stop going
    backwards when we run out of valid places to go backwards to.
    
    This still isn't great because the distance between two msword character
    indexes only equates to the same distance between our characters in the very
    simple cases
    
    Change-Id: I248fd12c067577d2f1fd64f48583321eb6d453e4
    (cherry picked from commit b1cd83c625a2afeb9da43cc9745d79c01963c797)
    Reviewed-on: https://gerrit.libreoffice.org/10140
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index d2929e0..96b6221 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2174,9 +2174,18 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
             {
                 WW8_CP nStart = GetAnnotationStart(nAtnIndex);
                 WW8_CP nEnd = GetAnnotationEnd(GetAnnotationEndIndex(nAtnIndex));
+                //It is unfortunately fragile and wrong to assume that two
+                //character positions in the original word document, which is
+                //what nStart and nEnd are, will equate to the same length in
+                //the destination writer document.
+                //
+                //Better would be, while writing the content into the writer
+                //document to store the equivalent writer document positions
+                //that relate to each annotation index as the parser passes
+                //those points.
                 sal_Int32 nLen = nEnd - nStart;
                 if( nLen )
-                 {
+                {
                     if (pPaM->GetPoint()->nContent.GetIndex() >= nLen)
                     {
                         pPaM->SetMark();
@@ -2188,24 +2197,28 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
                         nLen -= pPaM->GetPoint()->nContent.GetIndex();
 
                         SwTxtNode* pTxtNode = 0;
-                        // Find first text node which affected by the comment
-                        while( pPaM->GetPoint()->nNode >= 0 )
+
+                        // Find first text node which is affected by the comment
+                        while (nLen > 0)
                         {
-                            SwNode* pNode = 0;
-                            // Find previous text node
-                            do
+                            // Move to previous content node
+                            bool bSuccess = pPaM->Move(fnMoveBackward, fnGoNode);
+
+                            if (!bSuccess)
                             {
-                                pPaM->GetPoint()->nNode--;
-                                nLen--; // End line character
-                                pNode = &pPaM->GetPoint()->nNode.GetNode();
+                                nLen = 0;
+                                break;
                             }
-                            while( !pNode->IsTxtNode() && pPaM->GetPoint()->nNode >= 0 );
+
+                            --nLen; // End line character
+
+                            SwNode& rNode = pPaM->GetPoint()->nNode.GetNode();
 
                             // Subtract previous text node's length
-                            if( pNode->IsTxtNode() )
+                            if (rNode.IsTxtNode())
                             {
-                                pTxtNode = pNode->GetTxtNode();
-                                if( nLen < pTxtNode->Len() )
+                                pTxtNode = rNode.GetTxtNode();
+                                if (nLen < pTxtNode->Len())
                                     break;
                                 else
                                     nLen -= pTxtNode->Len();
commit b0e9c366211718f8f5385e81d43a963b775814a7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Feb 4 16:02:49 2014 +0100

    DOC import: fix nested comments
    
    See 2.9.70 (FBKF) in the spec, the ibkl field should be used to find the
    position in PlcfBkf.
    
    Previously we assumed that PlcfBkl and PlcfBkf is parallel for
    annotations, as but that's not true for nested comments.
    
    Change-Id: I76a6a757b41d2f9b7fe7fe9c9e01a92c251f7b32
    (cherry picked from commit 5cfda4f4de8da82485e27b1f0f0d94211d3b4d95)
    Reviewed-on: https://gerrit.libreoffice.org/10138
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 3f80e3c..d2929e0 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2173,7 +2173,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
             if (nAtnIndex != -1)
             {
                 WW8_CP nStart = GetAnnotationStart(nAtnIndex);
-                WW8_CP nEnd = GetAnnotationEnd(nAtnIndex);
+                WW8_CP nEnd = GetAnnotationEnd(GetAnnotationEndIndex(nAtnIndex));
                 sal_Int32 nLen = nEnd - nStart;
                 if( nLen )
                  {
@@ -5962,6 +5962,18 @@ int SwWW8ImplReader::GetAnnotationIndex(sal_uInt32 nTag)
     return -1;
 }
 
+sal_uInt16 SwWW8ImplReader::GetAnnotationEndIndex(sal_uInt16 nStart)
+{
+    WW8_CP nStartAkt;
+    void* p;
+    if (mpAtnStarts->GetData(nStart, nStartAkt, p) && p)
+    {
+        // p is an FBKF, and its first 2 bytes is the ibkl member, which is the end index.
+        return SVBT16ToShort(*((SVBT16*)p));
+    }
+    return nStart;
+}
+
 WW8_CP SwWW8ImplReader::GetAnnotationStart(int nIndex)
 {
     if (!mpAtnStarts.get() && pWwFib->lcbPlcfAtnbkf)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 772da4c..9434c2e 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1635,6 +1635,8 @@ private:
 
     const OUString* GetAnnotationAuthor(sal_uInt16 nIdx);
     int GetAnnotationIndex(sal_uInt32 nTag);
+    /// Return the end index based on the start one.
+    sal_uInt16 GetAnnotationEndIndex(sal_uInt16 nStart);
     WW8_CP GetAnnotationStart(int nIndex);
     WW8_CP GetAnnotationEnd(int nIndex);
 
commit 283a2ccf0ff65187dee0a888c627a1df93571183
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 24 13:13:59 2014 +0000

    coverity#1158240 Dereference before null check
    
    Change-Id: I5ce6d5514c6bb2298dd00c43d21a43dba55268c3
    (cherry picked from commit 6c7b64bad403fb6eeac6e79d356f456f741a00d4)
    Reviewed-on: https://gerrit.libreoffice.org/10139
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 4df1185..3f80e3c 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2201,8 +2201,8 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
                             }
                             while( !pNode->IsTxtNode() && pPaM->GetPoint()->nNode >= 0 );
 
-                            // Subtrackt previous text node's length
-                            if( pNode && pNode->IsTxtNode() )
+                            // Subtract previous text node's length
+                            if( pNode->IsTxtNode() )
                             {
                                 pTxtNode = pNode->GetTxtNode();
                                 if( nLen < pTxtNode->Len() )
commit 64b92ecbd55f243eb8b80849cc1eb44ff22cdb5e
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Jul 8 10:17:48 2014 +0300

    Fix some OUString construction error with VS2013
    
    A bit unclear to me whether the code really did what was intended with
    earlier VS versions either.
    
    VS2013 said: error C2664: 'rtl::OUString::OUString(const sal_uInt32
    *,sal_Int32)' : cannot convert argument 1 from 'const char *' to
    'const rtl::OUString &'
    
    Reason: cannot convert from 'const char *' to 'const rtl::OUString'
    
    No constructor could take the source type, or constructor overload
    resolution was ambiguous
    
    Change-Id: Ie23d8382515064062a3ed46418d9d4a977b35d28
    (cherry picked from commit eee44c951c104da342d55fd4de634efd51ae59ae)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 31047ba..5db4d8c 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -4615,7 +4615,7 @@ static int ImplMenuChar( HWND, WPARAM wParam, LPARAM lParam )
 {
     int nRet = MNC_IGNORE;
     HMENU hMenu = (HMENU) lParam;
-    OUString aMnemonic( "&" + (sal_Unicode) LOWORD(wParam) );
+    OUString aMnemonic( "&" + OUString((sal_Unicode) LOWORD(wParam)) );
     aMnemonic = aMnemonic.toAsciiLowerCase();   // we only have ascii mnemonics
 
     // search the mnemonic in the current menu
commit b0973f1cc2c14e710993049b8641b7ae8094dc0d
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Mon Jun 30 23:27:34 2014 +0200

    Resolves fdo#43277  Send Legacy Report "E-Mail as ..."=>error message
    
    Cherry-picked from 501ebd0f7c867c4df5ba84fd8b6b1a197aeeea92
    
    Change-Id: Iaaadd4fd3015214c007a86d1a83f837aa0d2bdb6
    Reviewed-on: https://gerrit.libreoffice.org/9998
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 941443a..7f7d19f 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -928,7 +928,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons
         if ( m_bForm )
             xModule->setIdentifier( "com.sun.star.sdb.FormDesign" );
         else if ( !xReportDefinition.is() )
-            xModule->setIdentifier( "com.sun.star.sdb.TextReportDesign" );
+            xModule->setIdentifier( "com.sun.star.text.TextDocument" );
 
         updateDocumentTitle();
     }


More information about the Libreoffice-commits mailing list