chart2/source/view/charttypes/PieChart.cxx | 12 ++++- jvmfwk/plugins/sunmajor/pluginlib/sunjre.cxx | 3 - jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx | 7 ++- sal/textenc/tcvtkr6.tab | 2 svx/source/unodraw/unoshape.cxx | 3 - sw/qa/core/data/odt/pass/tdf112017.odt |binary sw/qa/core/data/odt/pass/tdf112101.odt |binary sw/qa/core/data/odt/pass/tdf112123.odt |binary sw/source/filter/ww8/ww8graf.cxx | 2 sw/source/filter/ww8/ww8par.cxx | 4 - sw/source/filter/ww8/ww8par.hxx | 2 sw/source/filter/ww8/ww8par2.cxx | 2 sw/source/filter/ww8/ww8par3.cxx | 4 - sw/source/filter/ww8/ww8par6.cxx | 4 - sw/source/filter/ww8/ww8scan.cxx | 52 ++++++++++++++++------- sw/source/filter/ww8/ww8scan.hxx | 11 ++-- xmloff/source/text/txtimp.cxx | 3 + xmloff/source/text/txtparai.cxx | 5 +- 18 files changed, 79 insertions(+), 37 deletions(-)
New commits: commit be03a9c4b2fb4d320379b8f221320d652df701a5 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Aug 31 13:16:25 2017 +0100 Resolves: tdf#112123 check m_xAutoStyles like in similar methods Change-Id: I099da789a0e64fd862d09bb462ccb699e1dc8b9f Reviewed-on: https://gerrit.libreoffice.org/41753 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit 3576aa7a7328b04faf222451d73681db7c1d9c54) diff --git a/sw/qa/core/data/odt/pass/tdf112123.odt b/sw/qa/core/data/odt/pass/tdf112123.odt new file mode 100644 index 000000000000..c5d2195b9468 Binary files /dev/null and b/sw/qa/core/data/odt/pass/tdf112123.odt differ diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 4d1b1333d9d2..ddb51718bf9f 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -2430,6 +2430,9 @@ SvXMLImportContext *XMLTextImportHelper::CreateTableChildContext( sal_Int32 XMLTextImportHelper::GetDataStyleKey(const OUString& sStyleName, bool* pIsSystemLanguage ) { + if (!m_xImpl->m_xAutoStyles.is()) + return -1; + const SvXMLStyleContext* pStyle = static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())-> FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, commit 6d3c174ce7fcd21ec7f080c68399ca147f3fbec0 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Aug 30 09:22:45 2017 +0100 Resolves tdf#112101 crash on particular file with office:event-listeners Change-Id: I99a007543f90f4024666d296e9a775f8cee15086 Reviewed-on: https://gerrit.libreoffice.org/41725 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit fb8fba4a99e71ba9faa9d93dc126bae80baffdde) diff --git a/sw/qa/core/data/odt/pass/tdf112101.odt b/sw/qa/core/data/odt/pass/tdf112101.odt new file mode 100644 index 000000000000..ca29bd732ea4 Binary files /dev/null and b/sw/qa/core/data/odt/pass/tdf112101.odt differ diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index b37db9a9d551..f2fad10da496 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -427,7 +427,7 @@ XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl( XMLImpHyperlinkContext_Impl::~XMLImpHyperlinkContext_Impl() { - if( mpHint != nullptr ) + if (mpHint) mpHint->SetEnd( GetImport().GetTextImport() ->GetCursorAsRange()->getStart() ); } @@ -441,7 +441,8 @@ SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext( { XMLEventsImportContext* pCtxt = new XMLEventsImportContext( GetImport(), nPrefix, rLocalName); - mpHint->SetEventsContext(pCtxt); + if (mpHint) + mpHint->SetEventsContext(pCtxt); return pCtxt; } else commit b7df772e5d32d930927605d6e02a35d9e60bc6dd Author: Caolán McNamara <caol...@redhat.com> Date: Tue Aug 29 11:43:42 2017 +0100 Resolves: tdf#112017 crash on particular odt Change-Id: I6ba2e73562a16afecb6abdfe4f1a40b1e316379e Reviewed-on: https://gerrit.libreoffice.org/41712 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit 932a81e9c31a3a5bf5edad3d9e79b111e19b113d) diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index a93e1eb3b973..76d0dd22a97f 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -3069,7 +3069,8 @@ void SvxShape::setAllPropertiesToDefault() throw (uno::RuntimeException, std::ex mpObj->SetMergedItem(Svx3DCharacterModeItem(true)); } - mpModel->SetChanged(); + if (mpModel) + mpModel->SetChanged(); } void SvxShape::setPropertiesToDefault( diff --git a/sw/qa/core/data/odt/pass/tdf112017.odt b/sw/qa/core/data/odt/pass/tdf112017.odt new file mode 100644 index 000000000000..02a24d9db146 Binary files /dev/null and b/sw/qa/core/data/odt/pass/tdf112017.odt differ commit 63e158c66edf74d320fd05197779429efc964955 Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Aug 28 15:35:43 2017 +0200 tdf#100501: Adapt to Java 9 (at least on Linux x86-64) Checking with both jdk-9+181_linux-x64_bin.tar.gz and jre-9+181_linux-x64_bin.tar.gz as currently available at <http://jdk.java.net/9/> "JDK 9 Early-Access Builds": For one, make SunVersion::init understand <http://openjdk.java.net/jeps/223> "JEP 223: New Version-String Scheme" at least insofar as to accept strings like "9" with less than three dot-separated segments (where the missing segments are treated like "0"). For another, at least for Linux x86-64, libjvm.so is now apparently located in a path without an "amd64" architecture segment, "lib/server/libjvm.so". (But could that also be "client"?) Other platforms may need further adjustments. (cherry picked from commit 52ffad9bb7be800790de6d918154dbeade88cadd, plus cda4cea7cdfc9a8de814b901b3b957f029d36aaf "tdf#100501: Fix thinko") Reviewed-on: https://gerrit.libreoffice.org/41678 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit c83aec1d026b9567e7e6d982e4d19f3a566b66d2) Change-Id: Idcebc833472c81a1dc74dcdd481b0a37274a8713 Reviewed-on: https://gerrit.libreoffice.org/41700 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit a2fb0739bd1a9823f9b52f8efabae0bcf9ff6b0c) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjre.cxx index 7f7c4943c8be..7543f497eb83 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjre.cxx @@ -68,7 +68,8 @@ char const* const* SunInfo::getRuntimePaths(int * size) "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so", "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so", - "/lib/" JFW_PLUGIN_ARCH "/jrockit/libjvm.so" + "/lib/" JFW_PLUGIN_ARCH "/jrockit/libjvm.so", + "/lib/server/libjvm.so" #endif }; *size = SAL_N_ELEMENTS(ar); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx index b4ad7019d449..2aedaa29938c 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx @@ -88,7 +88,7 @@ bool SunVersion::init(const char *szVersion) ! (nPartPos == 0) // prevents: ".4.1", "..1", part must start with digit && ( //separators after maintenance (1.4.1_01, 1.4.1-beta, or 1.4.1) - ((pCur == pEnd || *pCur == '_' || *pCur == '-') && (nPart == 2 )) + (pCur == pEnd || *pCur == '_' || *pCur == '-') || //separators between major-minor and minor-maintenance (nPart < 2 && *pCur == '.') ) @@ -96,6 +96,8 @@ bool SunVersion::init(const char *szVersion) //prevent 1.4.0. 1.4.0- pCur + 1 != pEnd || isdigit(*(pCur))) ) { + bool afterMaint = pCur == pEnd || *pCur == '_' || *pCur == '-'; + int len = pCur - pLast; if (len >= 127) return false; @@ -106,6 +108,9 @@ bool SunVersion::init(const char *szVersion) pLast = pCur; m_arVersionParts[nPart] = atoi(buf); + + if (afterMaint) + nPart = 2; nPart ++; nPartPos = 0; if (nPart == 3) commit dee0773acd8bf2c537e6574534824599f29feaab Author: Caolán McNamara <caol...@redhat.com> Date: Mon Aug 28 12:13:41 2017 +0100 ofz#3154 check bounds of special sprm Change-Id: I82566e2f2ad479c392f06ae7149e3781c0338e50 ofz: sanity check L_VAR2 record bounds Change-Id: I862457a7239108974f360a87b4f6ccf433eae364 Reviewed-on: https://gerrit.libreoffice.org/37534 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 016e4d0e2650b2fb350068d86e8d392a7ef5acb1) ofz: stay within available data Change-Id: Ic959cf5b2cd92ba5bc297e686beb1fd50427a994 Reviewed-on: https://gerrit.libreoffice.org/36102 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit fdcac49119d3fc9f6216af834e7afc56d2c2e376) Reviewed-on: https://gerrit.libreoffice.org/41648 Reviewed-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit f33a136dc6bcb8bc0ed6ddd6c3d38d75e067e6eb) diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index bd1a8ca64cad..2664cdb3971e 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -617,7 +617,7 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(long nStartCp, long nEndCp, // off and convert them later if (bStartAttr) { - ImportSprm(aRes.pMemPos, aRes.nSprmId); + ImportSprm(aRes.pMemPos, aRes.nMemLen, aRes.nSprmId); if (!bDoingSymbol && m_bSymbol) { bDoingSymbol = true; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 503ed16c6d5f..88f4f4f3d22c 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -3824,7 +3824,7 @@ long SwWW8ImplReader::ReadTextAttr(WW8_CP& rTextPos, long nTextEnd, bool& rbStar if( bStartAttr ) // WW attributes { if( aRes.nMemLen >= 0 ) - ImportSprm(aRes.pMemPos, aRes.nSprmId); + ImportSprm(aRes.pMemPos, aRes.nMemLen, aRes.nSprmId); } else EndSprm( aRes.nSprmId ); // Switch off Attr @@ -6434,7 +6434,7 @@ bool SwMSDffManager::GetOLEStorageName(long nOLEId, OUString& rStorageName, while (nLen >= 2 && !nPictureId) { sal_uInt16 nId = aSprmParser.GetSprmId(pSprm); - sal_uInt16 nSL = aSprmParser.GetSprmSize(nId, pSprm); + sal_uInt16 nSL = aSprmParser.GetSprmSize(nId, pSprm, nLen); if( nLen < nSL ) break; // Not enough Bytes left diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index e117ee980422..600cb409b263 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1846,7 +1846,7 @@ public: // really private, but can only be done public void DeleteFormImpl(); - short ImportSprm( const sal_uInt8* pPos, sal_uInt16 nId = 0 ); + short ImportSprm(const sal_uInt8* pPos, sal_Int32 nMemLen, sal_uInt16 nId = 0); bool SearchRowEnd(WW8PLCFx_Cp_FKP* pPap,WW8_CP &rStartCp, int nLevel) const; /// Seek to the end of the table with pPap, returns true on success. diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 869e6e86c4d1..7a3f269bb1ab 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -3718,7 +3718,7 @@ void WW8RStyle::ImportSprms(sal_uInt8 *pSprms, short nLen, bool bPap) #ifdef DEBUGSPRMREADER fprintf(stderr, "id is %x\n", aIter.GetAktId()); #endif - pIo->ImportSprm(pSprm); + pIo->ImportSprm(pSprm, aSprmIter.GetRemLen(), aSprmIter.GetAktId()); aSprmIter.advance(); } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index f3211bac3b6b..7b1c37c76bdf 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -714,7 +714,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, SfxItemSet*& rpItemSet, maSprmParser); while (const sal_uInt8* pSprm = aSprmIter.GetSprms()) { - rReader.ImportSprm(pSprm); + rReader.ImportSprm(pSprm, aSprmIter.GetRemLen(), aSprmIter.GetAktId()); aSprmIter.advance(); } @@ -1908,7 +1908,7 @@ void SwWW8ImplReader::RegisterNumFormatOnTextNode(sal_uInt16 nActLFO, sal_uInt8* pSprms1 = &aParaSprms[0]; while (0 < nLen) { - sal_uInt16 nL1 = ImportSprm(pSprms1); + sal_uInt16 nL1 = ImportSprm(pSprms1, nLen); nLen = nLen - nL1; pSprms1 += nL1; } diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 5cd9e4ba74fd..f86eb4c80819 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -6301,7 +6301,7 @@ void SwWW8ImplReader::EndSprm( sal_uInt16 nId ) (this->*rSprm.pReadFnc)( nId, nullptr, -1 ); } -short SwWW8ImplReader::ImportSprm(const sal_uInt8* pPos,sal_uInt16 nId) +short SwWW8ImplReader::ImportSprm(const sal_uInt8* pPos, sal_Int32 nMemLen, sal_uInt16 nId) { if (!nId) nId = m_pSprmParser->GetSprmId(pPos); @@ -6311,7 +6311,7 @@ short SwWW8ImplReader::ImportSprm(const sal_uInt8* pPos,sal_uInt16 nId) const SprmReadInfo& rSprm = GetSprmReadInfo(nId); sal_uInt16 nFixedLen = m_pSprmParser->DistanceToData(nId); - sal_uInt16 nL = m_pSprmParser->GetSprmSize(nId, pPos); + sal_uInt16 nL = m_pSprmParser->GetSprmSize(nId, pPos, nMemLen); if (rSprm.pReadFnc) (this->*rSprm.pReadFnc)(nId, pPos + nFixedLen, nL - nFixedLen); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 1d51c27a5623..4d138aa6f5f7 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -883,14 +883,14 @@ inline long Get_Long( sal_uInt8 *& p ) return Get_ULong(p); } -WW8SprmIter::WW8SprmIter(const sal_uInt8* pSprms_, long nLen_, +WW8SprmIter::WW8SprmIter(const sal_uInt8* pSprms_, sal_Int32 nLen_, const wwSprmParser &rParser) : mrSprmParser(rParser), pSprms( pSprms_), nRemLen( nLen_) { UpdateMyMembers(); } -void WW8SprmIter::SetSprms(const sal_uInt8* pSprms_, long nLen_) +void WW8SprmIter::SetSprms(const sal_uInt8* pSprms_, sal_Int32 nLen_) { pSprms = pSprms_; nRemLen = nLen_; @@ -917,7 +917,7 @@ void WW8SprmIter::UpdateMyMembers() if (bValid) { nAktId = mrSprmParser.GetSprmId(pSprms); - nAktSize = mrSprmParser.GetSprmSize(nAktId, pSprms); + nAktSize = mrSprmParser.GetSprmSize(nAktId, pSprms, nRemLen); pAktParams = pSprms + mrSprmParser.DistanceToData(nAktId); bValid = nAktSize <= nRemLen; SAL_WARN_IF(!bValid, "sw.ww8", "sprm longer than remaining bytes, doc or parser is wrong"); @@ -3527,7 +3527,7 @@ bool WW8PLCFx_SEPX::Find4Sprms(sal_uInt16 nId1,sal_uInt16 nId2,sal_uInt16 nId3,s bOk = false; bFound |= bOk; // increment pointer so that it points to next SPRM - const sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp); + const sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp, nSprmSiz - i); i += x; pSp += x; } @@ -3553,7 +3553,7 @@ const sal_uInt8* WW8PLCFx_SEPX::HasSprm( sal_uInt16 nId, sal_uInt8 n2nd ) const return pRet; } // increment pointer so that it points to next SPRM - const sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp); + const sal_uInt16 x = maSprmParser.GetSprmSize(nAktId, pSp, nSprmSiz - i); i += x; pSp += x; } @@ -4901,7 +4901,7 @@ void WW8PLCFMan::GetSprmStart( short nIdx, WW8PLCFManResult* pRes ) const else if (p->nSprmsLen >= maSprmParser.MinSprmLen()) //normal { // Length of actual sprm - pRes->nMemLen = maSprmParser.GetSprmSize(pRes->nSprmId, pRes->pMemPos); + pRes->nMemLen = maSprmParser.GetSprmSize(pRes->nSprmId, pRes->pMemPos, p->nSprmsLen); if (pRes->nMemLen > p->nSprmsLen) { SAL_WARN("sw.ww8", "Short sprm, len " << pRes->nMemLen << " claimed, max possible is " << p->nSprmsLen); @@ -5009,7 +5009,7 @@ void WW8PLCFMan::AdvSprm(short nIdx, bool bStart) if( p->pMemPos ) { // Length of last sprm - const sal_uInt16 nSprmL = maSprmParser.GetSprmSize(nLastId, p->pMemPos); + const sal_uInt16 nSprmL = maSprmParser.GetSprmSize(nLastId, p->pMemPos, p->nSprmsLen); // Reduce length of all sprms by length of last sprm p->nSprmsLen -= nSprmL; @@ -7903,7 +7903,7 @@ sal_uInt16 WW8DopTypography::GetConvertedLang() const // Sprms -sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm) +sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, sal_Int32 nRemLen) const { SprmInfo aSprm = GetSprmInfo(nId); @@ -7918,15 +7918,26 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm) nL = static_cast< sal_uInt16 >(pSprm[1 + mnDelta] + aSprm.nLen); else { - sal_uInt8 nDel = pSprm[2 + mnDelta]; - sal_uInt8 nIns = pSprm[3 + mnDelta + 4 * nDel]; + sal_uInt8 nDelIdx = 2 + mnDelta; + sal_uInt8 nDel = nDelIdx < nRemLen ? pSprm[nDelIdx] : 0; + sal_uInt8 nInsIdx = 3 + mnDelta + 4 * nDel; + sal_uInt8 nIns = nInsIdx < nRemLen ? pSprm[nInsIdx] : 0; nL = 2 + 4 * nDel + 3 * nIns; } break; case 0xD608: - nL = SVBT16ToShort( &pSprm[1 + mnDelta] ); + { + sal_uInt8 nIndex = 1 + mnDelta; + if (nIndex + 1 >= nRemLen) + { + SAL_WARN("sw.ww8", "sprm longer than remaining bytes, doc or parser is wrong"); + nL = 0; + } + else + nL = SVBT16ToShort(&pSprm[nIndex]); break; + } default: switch (aSprm.nVari) { @@ -7939,10 +7950,21 @@ sal_uInt16 wwSprmParser::GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm) nL = static_cast< sal_uInt16 >(pSprm[1 + mnDelta] + aSprm.nLen); break; case L_VAR2: + { // Variable 2-Byte Length? // Excl. Token + Var-Lengthbyte - nL = static_cast< sal_uInt16 >(SVBT16ToShort( &pSprm[1 + mnDelta] ) + aSprm.nLen - 1); + sal_uInt8 nIndex = 1 + mnDelta; + sal_uInt16 nCount; + if (nIndex + 1 >= nRemLen) + { + SAL_WARN("sw.ww8", "sprm longer than remaining bytes, doc or parser is wrong"); + nCount = 0; + } + else + nCount = SVBT16ToShort(&pSprm[nIndex]); + nL = static_cast< sal_uInt16 >(nCount + aSprm.nLen - 1); break; + } default: OSL_ENSURE(false, "Unknown sprm variant"); break; @@ -7978,9 +8000,9 @@ sal_uInt16 wwSprmParser::GetSprmId(const sal_uInt8* pSp) const } // with tokens and length byte -sal_uInt16 wwSprmParser::GetSprmSize(sal_uInt16 nId, const sal_uInt8* pSprm) const +sal_uInt16 wwSprmParser::GetSprmSize(sal_uInt16 nId, const sal_uInt8* pSprm, sal_Int32 nRemLen) const { - return GetSprmTailLen(nId, pSprm) + 1 + mnDelta + SprmDataOfs(nId); + return GetSprmTailLen(nId, pSprm, nRemLen) + 1 + mnDelta + SprmDataOfs(nId); } sal_uInt8 wwSprmParser::SprmDataOfs(sal_uInt16 nId) const @@ -8000,7 +8022,7 @@ sal_uInt8* wwSprmParser::findSprmData(sal_uInt16 nId, sal_uInt8* pSprms, { const sal_uInt16 nAktId = GetSprmId(pSprms); // set pointer to data - sal_uInt16 nSize = GetSprmSize(nAktId, pSprms); + sal_uInt16 nSize = GetSprmSize(nAktId, pSprms, nLen); bool bValid = nSize <= nLen; diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 3587a9fabdf5..b71d8885a719 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -125,7 +125,7 @@ public: /// Return the SPRM id at the beginning of this byte sequence sal_uInt16 GetSprmId(const sal_uInt8* pSp) const; - sal_uInt16 GetSprmSize(sal_uInt16 nId, const sal_uInt8* pSprm) const; + sal_uInt16 GetSprmSize(sal_uInt16 nId, const sal_uInt8* pSprm, sal_Int32 nRemLen) const; /// Get known len of a sprms head, the bytes of the sprm id + any bytes /// reserved to hold a variable length @@ -133,7 +133,7 @@ public: /// Get len of a sprms data area, ignoring the bytes of the sprm id and /// ignoring any len bytes. Reports the remaining data after those bytes - sal_uInt16 GetSprmTailLen(sal_uInt16 nId, const sal_uInt8 * pSprm) const; + sal_uInt16 GetSprmTailLen(sal_uInt16 nId, const sal_uInt8* pSprm, sal_Int32 nRemLen) const; /// The minimum acceptable sprm len possible for this type of parser int MinSprmLen() const { return (IsSevenMinus(meVersion)) ? 2 : 3; } @@ -262,20 +262,21 @@ private: sal_uInt16 nAktId; sal_uInt16 nAktSize; - long nRemLen; // length of remaining SPRMs (including akt. SPRM) + sal_Int32 nRemLen; // length of remaining SPRMs (including akt. SPRM) void UpdateMyMembers(); public: - explicit WW8SprmIter( const sal_uInt8* pSprms_, long nLen_, + explicit WW8SprmIter(const sal_uInt8* pSprms_, sal_Int32 nLen_, const wwSprmParser &rSprmParser); - void SetSprms( const sal_uInt8* pSprms_, long nLen_ ); + void SetSprms(const sal_uInt8* pSprms_, sal_Int32 nLen_); const sal_uInt8* FindSprm(sal_uInt16 nId); void advance(); const sal_uInt8* GetSprms() const { return ( pSprms && (0 < nRemLen) ) ? pSprms : nullptr; } const sal_uInt8* GetAktParams() const { return pAktParams; } sal_uInt16 GetAktId() const { return nAktId; } + sal_Int32 GetRemLen() const { return nRemLen; } private: WW8SprmIter(const WW8SprmIter&) = delete; commit 51a45423c7ca4795f43659852fa8f2cd4320f858 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Aug 28 14:34:16 2017 +0100 ofz#3186: wrong starting offset for JOHAB 0x6D block Change-Id: I4de6d9d781b2f2313d8fd338b34dcb31434efe91 Reviewed-on: https://gerrit.libreoffice.org/41640 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> (cherry picked from commit 4f982fb4f6ec635f8f900431761a55ab7d5cac2a) diff --git a/sal/textenc/tcvtkr6.tab b/sal/textenc/tcvtkr6.tab index e03f3405e811..fab6c6131a5f 100644 --- a/sal/textenc/tcvtkr6.tab +++ b/sal/textenc/tcvtkr6.tab @@ -1033,7 +1033,7 @@ static ImplUniToDBCSHighTab const aJOHABDBCSHighTab[256] = { 0x02, 0xFB, aImplUniToDBCSTab_JOHAB_6A }, /* 0x6A */ { 0x04, 0xEC, aImplUniToDBCSTab_JOHAB_6B }, /* 0x6B */ { 0x08, 0xF3, aImplUniToDBCSTab_JOHAB_6C }, /* 0x6C */ - { 0x03, 0xFB, aImplUniToDBCSTab_JOHAB_6D }, /* 0x6D */ + { 0x0B, 0xFB, aImplUniToDBCSTab_JOHAB_6D }, /* 0x6D */ { 0x17, 0xFF, aImplUniToDBCSTab_JOHAB_6E }, /* 0x6E */ { 0x01, 0xFE, aImplUniToDBCSTab_JOHAB_6F }, /* 0x6F */ { 0x01, 0xFD, aImplUniToDBCSTab_JOHAB_70 }, /* 0x70 */ commit 256e2cb6702a22c55d1e5db304e58dbe5f7b26bf Author: Dennis Francis <dennis.fran...@collabora.co.uk> Date: Mon Aug 21 13:59:41 2017 +0530 tdf#62363: When pie chart sector is too small do "Outside" placement ...of its label when "Best fit" label placement setting is used. Change-Id: Id201d922505de0e134286f4772abe282bb0722bc Reviewed-on: https://gerrit.libreoffice.org/41572 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> (cherry picked from commit 8c8edfabdee656ac5a9a0b1106f90baf315f1dd4) Reviewed-on: https://gerrit.libreoffice.org/41622 (cherry picked from commit d44e12f1f77514059375e6da3f981a992ff7de7e) diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index f3b854ee8707..98fffc60e430 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -288,14 +288,23 @@ void PieChart::createTextLabelShape( ///the label position is allowed; the `createTextLabelShape` treats the ///`AVOID_OVERLAP` as if it was of `CENTER` type; + double nVal = rSeries.getYValue(nPointIndex); //AVOID_OVERLAP is in fact "Best fit" in the UI. bool bMovementAllowed = ( nLabelPlacement == css::chart::DataLabelPlacement::AVOID_OVERLAP ); if( bMovementAllowed ) + { // Use center for "Best fit" for now. In the future we // may want to implement a real best fit algorithm. // But center is good enough, and close to what Excel // does. - nLabelPlacement = css::chart::DataLabelPlacement::CENTER; + + // Place the label outside if the sector is too small + // The threshold is set to 2%, but can be improved by making it a function of + // label width and radius too ? + double fFrac = fabs( nVal / rParam.mfLogicYSum ); + nLabelPlacement = ( fFrac <= 0.02 ) ? css::chart::DataLabelPlacement::OUTSIDE : + css::chart::DataLabelPlacement::CENTER; + } ///for `OUTSIDE` (`INSIDE`) label placements an offset of 150 (-150), in the ///radius direction, is added to the final screen position of the label @@ -354,7 +363,6 @@ void PieChart::createTextLabelShape( sal_Int32 nTextMaximumFrameWidth = ceil(fTextMaximumFrameWidth); ///the text shape for the label is created - double nVal = rSeries.getYValue(nPointIndex); aPieLabelInfo.xTextShape = createDataLabel( xTextTarget, rSeries, nPointIndex, nVal, rParam.mfLogicYSum, aScreenPosition2D, eAlignment, 0, nTextMaximumFrameWidth);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits