[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.3' - 10 commits - sc/source sd/source sw/inc sw/source vcl/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Jan 12 00:23:30 PST 2015


 sc/source/core/data/table3.cxx       |    2 +-
 sc/source/core/tool/compiler.cxx     |   34 +++++++++++++++++++++++++++++-----
 sc/source/filter/excel/xecontent.cxx |   12 ++++++++----
 sc/source/filter/excel/xelink.cxx    |    2 +-
 sc/source/filter/inc/xecontent.hxx   |    5 +++--
 sc/source/ui/unoobj/linkuno.cxx      |    8 +++++---
 sd/source/ui/dlg/animobjs.cxx        |    2 ++
 sd/source/ui/inc/animobjs.hxx        |    2 +-
 sw/inc/ndtxt.hxx                     |    3 +++
 sw/source/core/text/txtfld.cxx       |   23 ++++++++++++++++++++++-
 sw/source/core/txtnode/thints.cxx    |    7 +++----
 sw/source/filter/ww8/ww8par.cxx      |    7 ++++---
 vcl/source/filter/wmf/enhwmf.cxx     |   12 ++++++------
 13 files changed, 88 insertions(+), 31 deletions(-)

New commits:
commit 9f3130b762dbd617c901409b99e8cceb35383a29
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jan 12 06:53:31 2015 +0100

    Revert "fix Werror build"
    
    This reverts commit cabf7158a8fa3eabda8d6436f46bdaf1a6ae8516.
    
    (cherry picked from commit a5f58fd67935503d49f263f4eb9578bdb771cb14)

diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index 4f6c7b4..2839300 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -440,7 +440,7 @@ namespace slideshow
 
         bool ViewMediaShape::implInitializePlayerWindow( const ::basegfx::B2DRectangle&   rBounds,
                                                                  const uno::Sequence< uno::Any >& rVCLDeviceParams,
-                                                                 const OUString& )
+                                                                 const OUString& rMimeType )
         {
             OSL_TRACE( "ViewMediaShape::implInitializePlayerWindow" );
             if( !mpMediaWindow.get() && !rBounds.isEmpty() )
commit 99c0a4225b5c69dcdce0bb006793a3fdf351613b
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jan 9 13:53:27 2015 +0100

    Resolves: fdo#85617 always store fully encoded external document name
    
    Also OOXML calls these API functions, this is the central place to handle it.
    
    (cherry picked from commit 97a8b3ed5e5bd42e213d3230fa764b0f5d10f0f2)
    
    write externalLink Relationship Target IURI encoded, fdo#85617 related
    
    (cherry picked from commit 7eb5e135422f1a5830a44d129300bc3fafb4627d)
    
    do not drop entire external reference, fdo#85617 related
    
    If there are no matching tab names for a FileId, preserve at least the known
    reference parts. In case of 2D references the sheet name is in the token if
    for example read from .xlsx, only for 3D references the second sheet name
    would be needed. The underlying makeExternalRefStr() and its subroutines
    handle the missing tabname elements gracefully.
    
    Still this situation is worth an assertion.
    
    (cherry picked from commit b6339617b1cc3136f9e527acd0746d712cd21643)
    
    Change-Id: I3df065af8e4ef44734f468fd455c3b7c93d7fbc6
    Reviewed-on: https://gerrit.libreoffice.org/13840
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 80bbe4a4dcbb0286f472ca3ee0e21746995fe4a6)

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 510a2b8..98bad50 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4184,8 +4184,7 @@ void ScCompiler::CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken*
         {
             vector<OUString> aTabNames;
             pRefMgr->getAllCachedTableNames(nFileId, aTabNames);
-            if (aTabNames.empty())
-                return;
+            assert(!aTabNames.empty()); // something is seriously wrong, but continue
 
             pConv->makeExternalRefStr(
                 rBuffer, GetPos(), nFileId, *pFileName, aTabNames, t->GetString().getString(),
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index f0e8a07..ca9f8db 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -353,7 +353,9 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
     {
         sal_uInt16 nLevel;
         bool bRel;
-        OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot ) );
+        /* TODO: should we differentiate between BIFF and OOXML and write IURI
+         * encoded for OOXML? */
+        OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot, false ) );
 
         if( eProtocol == INET_PROT_SMB )
         {
@@ -444,9 +446,10 @@ XclExpHyperlink::~XclExpHyperlink()
 }
 
 OUString XclExpHyperlink::BuildFileName(
-        sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const XclExpRoot& rRoot )
+        sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const XclExpRoot& rRoot, bool bEncoded )
 {
-    OUString aDosName( INetURLObject( rUrl ).getFSysPath( INetURLObject::FSYS_DOS ) );
+    INetURLObject aURLObject( rUrl );
+    OUString aDosName( bEncoded ? aURLObject.GetURLPath() : aURLObject.getFSysPath( INetURLObject::FSYS_DOS ) );
     rnLevel = 0;
     rbRel = rRoot.IsRelUrl();
 
@@ -455,7 +458,8 @@ OUString XclExpHyperlink::BuildFileName(
         // try to convert to relative file name
         OUString aTmpName( aDosName );
         aDosName = INetURLObject::GetRelURL( rRoot.GetBasePath(), rUrl,
-            INetURLObject::WAS_ENCODED, INetURLObject::DECODE_WITH_CHARSET );
+            INetURLObject::WAS_ENCODED,
+            (bEncoded ? INetURLObject::DECODE_TO_IURI : INetURLObject::DECODE_WITH_CHARSET));
 
         if (aDosName.startsWith(INET_FILE_SCHEME))
         {
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 08b2afb..1f6143f 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1659,7 +1659,7 @@ void XclExpSupbook::SaveXml( XclExpXmlStream& rStrm )
     bool bRel = true;
     OUString sId = rStrm.addRelation( pExternalLink->getOutputStream(),
             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath",
-            XclExpHyperlink::BuildFileName( nLevel, bRel, maUrl, GetRoot()),
+            XclExpHyperlink::BuildFileName( nLevel, bRel, maUrl, GetRoot(), true),
             true );
 
     pExternalLink->startElement( XML_externalLink,
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index 2142293..f2e8ee9 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -113,10 +113,11 @@ public:
 
     /** Builds file name from the passed file URL. Tries to convert to relative file name.
         @param rnLevel  (out-param) The parent directory level.
-        @param rbRel  (out-param) true = path is relative. */
+        @param rbRel  (out-param) true = path is relative.
+        @param bEncoded if true return an IURI encoded name, not a DOS name. */
     static OUString     BuildFileName(
                             sal_uInt16& rnLevel, bool& rbRel,
-                            const OUString& rUrl, const XclExpRoot& rRoot );
+                            const OUString& rUrl, const XclExpRoot& rRoot, bool bEncoded );
 private:
 
     /** Writes the body of the HLINK record. */
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index 86e7fc8..63b4b06 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -1708,7 +1708,8 @@ Reference< sheet::XExternalDocLink > SAL_CALL ScExternalDocLinksObj::addDocLink(
         throw (RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocName);
+    OUString aDocUrl( ScGlobal::GetAbsDocName( aDocName, mpDocShell));
+    sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
     Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
     return aDocLink;
 }
@@ -1717,10 +1718,11 @@ Any SAL_CALL ScExternalDocLinksObj::getByName(const OUString &aName)
         throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    if (!mpRefMgr->hasExternalFile(aName))
+    OUString aDocUrl( ScGlobal::GetAbsDocName( aName, mpDocShell));
+    if (!mpRefMgr->hasExternalFile(aDocUrl))
         throw container::NoSuchElementException();
 
-    sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aName);
+    sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocUrl);
     Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
 
     Any aAny;
commit 863c6e85ad42b5f9dc41e115092995b1f780085a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Dec 27 06:51:52 2014 +0100

    handle index based external refs in formulas in ooxml import, fdo#85617
    
    (cherry picked from commit 18cccd62fb5b730319878df6fac748d5cdf73f1f)
    
    return after finding the reference
    
    (cherry picked from commit cef36587674b6472471478524e87b1add4109507)
    
    that method is the same as in the base class
    
    (cherry picked from commit 02caf8f2eef75d8b5acb6a4ec40277355c3c6c6e)
    
    remove copy&paste code
    
    (cherry picked from commit 757ce63f7346aea132f11c3d9a328b0a1a776403)
    
    a22b97b0a45d8d840095737638c2ccf68373e27a
    8cb6f59795d9461c0e02ab70d7edd60af1410c1f
    5710856fdb9fb91573de89eeb5a29d3d106ad7a6
    
    Change-Id: Ie4f43f041f5d614b9c2826c74574c854af05c266
    Reviewed-on: https://gerrit.libreoffice.org/13839
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit 90bbc9e6f51a2281f7cf06577252791e62a9189b)

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 13639cc..510a2b8 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -991,6 +991,10 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
 
 struct ConventionXL
 {
+    virtual ~ConventionXL()
+    {
+    }
+
     static void GetTab(
         const ScAddress& rPos, const std::vector<OUString>& rTabNames,
         const ScSingleRefData& rRef, OUString& rTabName )
@@ -1105,7 +1109,7 @@ struct ConventionXL
         }
     }
 
-    static void parseExternalDocName( const OUString& rFormula, sal_Int32& rSrcPos )
+    virtual void parseExternalDocName( const OUString& rFormula, sal_Int32& rSrcPos ) const
     {
         sal_Int32 nLen = rFormula.getLength();
         const sal_Unicode* p = rFormula.getStr();
@@ -1241,7 +1245,7 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
                                        sal_Int32 nSrcPos,
                                        const CharClass* pCharClass) const SAL_OVERRIDE
     {
-        ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+        parseExternalDocName(rFormula, nSrcPos);
 
         ParseResult aRet;
         if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
@@ -1327,6 +1331,27 @@ struct ConventionXL_OOX : public ConventionXL_A1
          * CellStr. */
     }
 
+    virtual void parseExternalDocName(const OUString& rFormula, sal_Int32& rSrcPos) const SAL_OVERRIDE
+    {
+        sal_Int32 nLen = rFormula.getLength();
+        const sal_Unicode* p = rFormula.getStr();
+        for (sal_Int32 i = rSrcPos; i < nLen; ++i)
+        {
+            sal_Unicode c = p[i];
+            if (i == rSrcPos)
+            {
+                // first character must be '['.
+                if (c != '[')
+                    return;
+            }
+            else if (c == ']')
+            {
+                rSrcPos = i + 1;
+                return;
+            }
+        }
+    }
+
     virtual void makeExternalRefStr(
         OUStringBuffer& rBuffer, const ScAddress& rPos, sal_uInt16 nFileId, const OUString& /*rFileName*/,
         const OUString& rTabName, const ScSingleRefData& rRef ) const SAL_OVERRIDE
@@ -1466,7 +1491,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
                                sal_Int32 nSrcPos,
                                const CharClass* pCharClass) const SAL_OVERRIDE
     {
-        ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+        parseExternalDocName(rFormula, nSrcPos);
 
         ParseResult aRet;
         if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
commit aee36f9aef312cd8e94dc3cdd02ddd972f945b14
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 10 16:47:10 2015 +0100

    fix Werror build
    
    Change-Id: I1f29a83657894d234f93ce79edeab79fefacf3d1
    Reviewed-on: https://gerrit.libreoffice.org/13849
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
    (cherry picked from commit cabf7158a8fa3eabda8d6436f46bdaf1a6ae8516)

diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index 2839300..4f6c7b4 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -440,7 +440,7 @@ namespace slideshow
 
         bool ViewMediaShape::implInitializePlayerWindow( const ::basegfx::B2DRectangle&   rBounds,
                                                                  const uno::Sequence< uno::Any >& rVCLDeviceParams,
-                                                                 const OUString& rMimeType )
+                                                                 const OUString& )
         {
             OSL_TRACE( "ViewMediaShape::implInitializePlayerWindow" );
             if( !mpMediaWindow.get() && !rBounds.isEmpty() )
commit 5a7e304e594141b68dcd2965c7507520bf6cacbe
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 10 16:27:14 2015 +0100

    fix Mac build
    
    Change-Id: Ie5a25da16753bd28df0514a831512e147de6a715
    Reviewed-on: https://gerrit.libreoffice.org/13848
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
    (cherry picked from commit 6280261ad37f25219c3f232724790f012372a7ef)

diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 111b37c..65bc8d8 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -127,6 +127,8 @@ void SdDisplay::DataChanged( const DataChangedEvent& rDCEvt )
     }
 }
 
+size_t AnimationWindow::EMPTY_FRAMELIST = std::numeric_limits<size_t>::max();
+
 /**
  *  AnimationWindow - FloatingWindow
  */
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index 0be13e4..18548d0 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -132,7 +132,7 @@ private:
 
     ::Window*       pWin;
     ::std::vector< ::std::pair<BitmapEx*, Time*> > m_FrameList;
-    static const size_t EMPTY_FRAMELIST = std::numeric_limits<size_t>::max();
+    static size_t EMPTY_FRAMELIST;
     size_t          m_nCurrentFrame;
     SdDrawDocument* pMyDoc;
 
commit c47b603b97e3ead3d651fe0327118dd1e7fa2205
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jan 10 16:12:20 2015 +0100

    fix Werror build
    
    Change-Id: Ief706ff4dc74efe2a8cee69d9e9806e025394329
    Reviewed-on: https://gerrit.libreoffice.org/13847
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
    (cherry picked from commit e4c2cada42d5f81bc09291da3b000f57de4a50b0)

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 6a1a305..fd22ead 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -948,7 +948,7 @@ void ScTable::SortReorderByRow(
                         pNew->GetCode()->AdjustReferenceOnMovedOriginIfOtherSheet(aOldPos, aCellPos);
                     }
 
-                    sc::CellStoreType::iterator itBlk = rCellStore.push_back(pNew);
+                    rCellStore.push_back(pNew);
                 }
                 break;
                 default:
commit 02a47e7cae17f0715e885fdbede802e7219712ac
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Nov 20 11:02:45 2014 +0100

    fdo#79810: SwTxtNode::IsIgnoredCharFmtForNumbering: ignore RES_CHRATR_COLOR
    
    And also in SwTxtFormatter::NewNumberPortion(), use
    SwTxtNode::IsIgnoredCharFmtForNumbering(), via
    checkApplyParagraphMarkFormatToNumbering().  Otherwise the color of the
    paragraph mark is inherited by the numbering portion, which is not what
    IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING
    (mirroring Word's behavior) is supposed to do.
    
    (cherry picked from commit b2c1474c1dc93b69f0ede03fc5c9ab496c669955)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    This fixes regression fdo#79810.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/data/num-override-lvltext.docx
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    	sw/source/core/text/txtfld.cxx
    
    Change-Id: I5d8df9b404916cc4a4405bf796d971ede59e6111
    (cherry picked from commit 54eb3d31b7be999468f1ae54a99730a8c739a22d)

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 4f39e52..9bbd455 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -51,6 +51,7 @@
 #include "reffld.hxx"
 #include "flddat.hxx"
 #include "fmtautofmt.hxx"
+#include <svl/itemiter.hxx>
 
 static bool lcl_IsInBody( SwFrm *pFrm )
 {
@@ -421,7 +422,27 @@ static void checkApplyParagraphMarkFormatToNumbering( SwFont* pNumFnt, SwTxtForm
                 && *hint->GetStart() == *hint->GetEnd() && *hint->GetStart() == node->Len())
             {
                 boost::shared_ptr<SfxItemSet> pSet(hint->GetAutoFmt().GetStyleHandle());
-                pNumFnt->SetDiffFnt( pSet.get(), pIDSA );
+
+                // Check each item and in case it should be ignored, then clear it.
+                boost::shared_ptr<SfxItemSet> pCleanedSet;
+                if (pSet.get())
+                {
+                    pCleanedSet.reset(pSet->Clone());
+
+                    SfxItemIter aIter(*pSet);
+                    const SfxPoolItem* pItem = aIter.GetCurItem();
+                    while (true)
+                    {
+                        if (SwTxtNode::IsIgnoredCharFmtForNumbering(pItem->Which()))
+                            pCleanedSet->ClearItem(pItem->Which());
+
+                        if (aIter.IsAtEnd())
+                            break;
+
+                        pItem = aIter.NextItem();
+                    }
+                }
+                pNumFnt->SetDiffFnt(pCleanedSet.get(), pIDSA);
             }
         }
     }
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index f680282..5dc8df8 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1763,7 +1763,7 @@ void SwTxtNode::DelSoftHyph( const sal_Int32 nStt, const sal_Int32 nEnd )
 
 bool SwTxtNode::IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich)
 {
-    return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_ESCAPEMENT);
+    return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_COLOR || nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_ESCAPEMENT);
 }
 
 //In MS Word, following properties of the paragraph end position wont affect the formatting of bullets, so we ignore them:
commit 385698cc245aafb2f87f9181b4656db78846b6be
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Nov 20 09:54:15 2014 +0100

    sw: move IsIgnoredCharFmtForNumbering() to SwTxtNode
    
    I need this in SwTxtFormatter.
    
    (cherry picked from commit 96664bf0152ecf8ee64aa6b22ed399c1866117f1)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    	sw/inc/ndtxt.hxx
    
    Change-Id: Ib1586299f468a88e92fdb367fbab69a683791dc9
    (cherry picked from commit 01c4588fdad04c45d239afb3136b82f72fdd1c80)

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index b7af846..72a1a3d 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -797,6 +797,9 @@ public:
     bool CompareParRsid( const SwTxtNode &rTxtNode ) const;
 
     DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode)
+
+    /// In MS Word, the font underline setting of the paragraph end position wont affect the formatting of numbering, so we ignore it
+    static bool IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich);
 };
 
 inline SwpHints & SwTxtNode::GetSwpHints()
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 4932195..f680282 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1761,8 +1761,7 @@ void SwTxtNode::DelSoftHyph( const sal_Int32 nStt, const sal_Int32 nEnd )
     }
 }
 
-//In MS Word, the font underline setting of the paragraph end position wont affect the formatting of numbering, so we ignore it
-bool lcl_IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich)
+bool SwTxtNode::IsIgnoredCharFmtForNumbering(const sal_uInt16 nWhich)
 {
     return (nWhich ==  RES_CHRATR_UNDERLINE || nWhich == RES_CHRATR_BACKGROUND || nWhich == RES_CHRATR_ESCAPEMENT);
 }
@@ -1812,7 +1811,7 @@ bool SwTxtNode::TryCharSetExpandToNum(const SfxItemSet& aCharSet)
         {
             if (pCurrNumFmt->IsItemize() && lcl_IsIgnoredCharFmtForBullets(nWhich))
                 return bRet;
-            if (pCurrNumFmt->IsEnumeration() && lcl_IsIgnoredCharFmtForNumbering(nWhich))
+            if (pCurrNumFmt->IsEnumeration() && SwTxtNode::IsIgnoredCharFmtForNumbering(nWhich))
                 return bRet;
             SwCharFmt* pCurrCharFmt =pCurrNumFmt->GetCharFmt();
 
commit 20abcacca02a146519539289b4435570965c61c0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 9 11:30:00 2015 +0000

    asan: global-buffer-overflow on ooo12093-1.doc
    
    Change-Id: I5e29626fe2803d2751bdec9c6919662ea37cf64c
    Reviewed-on: https://gerrit.libreoffice.org/13820
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit f35d61f021fc46b48ca1978ef6092e56a25c446a)

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index bf1d564..7e085bf 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5002,7 +5002,8 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
 
         aInfo.ePos = FTNPOS_PAGE;
         aInfo.eNum = eNumA[pWDop->rncFtn];
-        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[pWDop->nfcFtnRef]) );
+        sal_uInt16 nfcFtnRef = pWDop->nfcFtnRef & 0xF;
+        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[nfcFtnRef]) );
         if( pWDop->nFtn )
             aInfo.nFtnOffset = pWDop->nFtn - 1;
         rDoc.SetFtnInfo( aInfo );
@@ -5011,8 +5012,8 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
     {
         SwEndNoteInfo aInfo;
         aInfo = rDoc.GetEndNoteInfo(); // Same as for Ftn
-
-        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[pWDop->nfcEdnRef]) );
+        sal_uInt16 nfcEdnRef = pWDop->nfcEdnRef & 0xF;
+        aInfo.aFmt.SetNumberingType( static_cast< sal_uInt16 >(eNumTA[nfcEdnRef]) );
         if( pWDop->nEdn )
             aInfo.nFtnOffset = pWDop->nEdn - 1;
         rDoc.SetEndNoteInfo( aInfo );
commit 22ef9f282d89958283145a664a3e48b0f55a2e4e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 9 14:55:35 2015 +0000

    asan: stack-buffer-overflow with fdo76216-1.doc
    
    Change-Id: Ica5ebb04ec50c6579f71d1152ae7619dd37b879e
    (cherry picked from commit 8f43132c4d68dd2a1af7a4d1088413c2a0064902)
    Reviewed-on: https://gerrit.libreoffice.org/13833
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 9e283042477521416af2fc641c1843078d322480)

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 4047093..e990030 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -1235,13 +1235,13 @@ bool EnhWMFReader::ReadEnhWMF()
                              .ReadUChar( aLogFont.lfQuality )
                              .ReadUChar( aLogFont.lfPitchAndFamily );
 
-                        sal_Unicode lfFaceName[ LF_FACESIZE ];
-
-                        for ( int i = 0; i < LF_FACESIZE; i++ )
+                        sal_Unicode lfFaceName[LF_FACESIZE+1];
+                        lfFaceName[LF_FACESIZE] = 0;
+                        for (int i = 0; i < LF_FACESIZE; ++i)
                         {
-                            sal_uInt16 nChar;
-                            pWMF->ReadUInt16( nChar );
-                            lfFaceName[ i ] = nChar;
+                            sal_uInt16 nChar(0);
+                            pWMF->ReadUInt16(nChar);
+                            lfFaceName[i] = nChar;
                         }
                         aLogFont.alfFaceName = OUString( lfFaceName );
 


More information about the Libreoffice-commits mailing list