[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source sd/qa

2018-04-19 Thread Caolán McNamara
 filter/source/graphicfilter/icgm/actimpr.cxx |6 ++
 filter/source/graphicfilter/icgm/class4.cxx  |   14 ++
 filter/source/graphicfilter/icgm/outact.hxx  |2 +-
 sd/qa/unit/data/cgm/pass/binary_corvette.cgm |binary
 4 files changed, 9 insertions(+), 13 deletions(-)

New commits:
commit 67d236252a743c77da4d929e95d5223454a47cd4
Author: Caolán McNamara 
Date:   Mon Apr 16 10:16:56 2018 +0100

Resolves: tdf#116999 fix reading cgm text at record bounds

Change-Id: Ibbff7b0a3c3447135e0f6c585914dc6018e51765
Reviewed-on: https://gerrit.libreoffice.org/52953
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/filter/source/graphicfilter/icgm/actimpr.cxx 
b/filter/source/graphicfilter/icgm/actimpr.cxx
index a2d844fb3723..3c5659fa6756 100644
--- a/filter/source/graphicfilter/icgm/actimpr.cxx
+++ b/filter/source/graphicfilter/icgm/actimpr.cxx
@@ -711,7 +711,7 @@ void CGMImpressOutAct::DrawPolyPolygon( tools::PolyPolygon& 
rPolyPolygon )
 }
 }
 
-void CGMImpressOutAct::DrawText( awt::Point& rTextPos, awt::Size& rTextSize, 
char* pString, FinalFlag eFlag )
+void CGMImpressOutAct::DrawText( awt::Point& rTextPos, awt::Size& rTextSize, 
const OUString& rString, FinalFlag eFlag )
 {
 if ( ImplCreateShape( "com.sun.star.drawing.TextShape" ) )
 {
@@ -800,8 +800,6 @@ void CGMImpressOutAct::DrawText( awt::Point& rTextPos, 
awt::Size& rTextSize, cha
 uno::Any aFirstQuery( maXShape->queryInterface( 
cppu::UnoType::get()));
 if( aFirstQuery >>= xText )
 {
-OUString aStr(pString, rtl_str_getLength(pString), 
RTL_TEXTENCODING_ASCII_US);
-
 uno::Reference< text::XTextCursor >  aXTextCursor( 
xText->createTextCursor() );
 {
 aXTextCursor->gotoEnd( false );
@@ -837,7 +835,7 @@ void CGMImpressOutAct::DrawText( awt::Point& rTextPos, 
awt::Size& rTextSize, cha
 aAny <<= true;
 maXPropSet->setPropertyValue( "TextFitToSize", 
aAny );
 }
-aCursorText->setString( aStr );
+aCursorText->setString(rString);
 aXTextCursor->gotoEnd( true );
 ImplSetTextBundle( aCursorPropSet );
 }
diff --git a/filter/source/graphicfilter/icgm/class4.cxx 
b/filter/source/graphicfilter/icgm/class4.cxx
index dc92f79cf560..a0b87dbff93e 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -186,15 +186,14 @@ void CGM::ImplDoClass4()
 sal_uInt32 nType = ImplGetUI16();
 sal_uInt32 nSize = ImplGetUI( 1 );
 
-if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) <= nSize)
+if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) < nSize)
 throw css::uno::Exception("attempt to read past end of 
input", nullptr);
 
-mpSource[mnParaSize + nSize] = 0;
+OUString aStr(reinterpret_cast(mpSource) + mnParaSize, 
nSize, RTL_TEXTENCODING_ASCII_US);
 
 awt::Size aSize;
 awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y );
-mpOutAct->DrawText( aPoint, aSize,
-reinterpret_cast(mpSource) + 
mnParaSize, (FinalFlag)nType );
+mpOutAct->DrawText(aPoint, aSize, aStr, (FinalFlag)nType);
 mnParaSize = mnElementSize;
 }
 break;
@@ -224,15 +223,14 @@ void CGM::ImplDoClass4()
 sal_uInt32 nType = ImplGetUI16();
 sal_uInt32 nSize = ImplGetUI(1);
 
-if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) <= nSize)
+if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) < nSize)
 throw css::uno::Exception("attempt to read past end of 
input", nullptr);
 
-mpSource[ mnParaSize + nSize ] = 0;
+OUString aStr(reinterpret_cast(mpSource) + mnParaSize, 
nSize, RTL_TEXTENCODING_ASCII_US);
 
 awt::Point aPoint( (long)aFloatPoint.X, (long)aFloatPoint.Y );
 awt::Size aSize((long)dx, (long)dy);
-mpOutAct->DrawText( aPoint, aSize ,
-reinterpret_cast(mpSource) + 
mnParaSize, (FinalFlag)nType );
+mpOutAct->DrawText(aPoint, aSize , aStr, (FinalFlag)nType);
 mnParaSize = mnElementSize;
 }
 break;
diff --git a/filter/source/graphicfilter/icgm/outact.hxx 
b/filter/source/graphicfilter/icgm/outact.hxx
index badf8362b115..4b5d04f8d145 100644
--- a/filter/source/graphicfilter/icgm/outact.hxx
+++ b/filter/source/graphicfilter/icgm/outact.hxx
@@ -85,7 +85,7 @@ public:
 voidDrawPolyLine( 

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

2018-02-14 Thread Caolán McNamara
 filter/source/msfilter/msdffimp.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 6be2c684effd6732c92df7ef75581772adb6dac3
Author: Caolán McNamara 
Date:   Tue Feb 13 21:16:56 2018 +

ofz#6300 Abrt

Change-Id: I814b0e4255894d909d29a9a301488a23acf418a0
Reviewed-on: https://gerrit.libreoffice.org/49688
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
Reviewed-by: Michael Stahl 

diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index eadbf3afcc9a..b0f715f4bd4d 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -1114,7 +1114,8 @@ void ApplyRectangularGradientAsBitmap( const 
SvxMSDffManager& rManager, SvStream
 {
 Size aBitmapSizePixel( static_cast< sal_Int32 >( ( 
rObjData.aBoundRect.GetWidth() / 2540.0 ) * 90.0 ),  // we will create a 
bitmap with 90 dpi
static_cast< sal_Int32 >( ( 
rObjData.aBoundRect.GetHeight() / 2540.0 ) * 90.0 ) );
-if ( aBitmapSizePixel.Width() && aBitmapSizePixel.Height() && ( 
aBitmapSizePixel.Width() <= 1024 ) && ( aBitmapSizePixel.Height() <= 1024 ) )
+if (aBitmapSizePixel.Width() > 0 && aBitmapSizePixel.Height() > 0 &&
+aBitmapSizePixel.Width() <= 1024 && aBitmapSizePixel.Height() <= 1024)
 {
 double fFocusX = rManager.GetPropertyValue( DFF_Prop_fillToRight, 0 ) 
/ 65536.0;
 double fFocusY = rManager.GetPropertyValue( DFF_Prop_fillToBottom, 0 ) 
/ 65536.0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source include/filter

2018-01-30 Thread Caolán McNamara
 filter/source/msfilter/mscodec.cxx  |   25 +++--
 include/filter/msfilter/mscodec.hxx |8 ++--
 2 files changed, 25 insertions(+), 8 deletions(-)

New commits:
commit 82e74f704ce4fe3ffe7ab74c14fe83d2d44dd088
Author: Caolán McNamara 
Date:   Fri Jan 26 10:47:24 2018 +

Resolves: tdf#114221 generate both std97 and cryptoapi keys from password..

when we open a cryptoapi encrypted binary msoffice document. That way when 
we
save as the same format, and try to reuse the generated keys for 
encryption, we
have matching std97 encryption keys available because we always export using
that scheme.

Change-Id: I25f24a01d102242615768255ce888acb08ef6447
Reviewed-on: https://gerrit.libreoffice.org/48712
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit b5914ba44f2fff9f282b6a5cbe21cbebf19e45b2)
Reviewed-on: https://gerrit.libreoffice.org/48914

diff --git a/filter/source/msfilter/mscodec.cxx 
b/filter/source/msfilter/mscodec.cxx
index 83dee6c37223..837916508d50 100644
--- a/filter/source/msfilter/mscodec.cxx
+++ b/filter/source/msfilter/mscodec.cxx
@@ -244,8 +244,9 @@ void MSCodec_Xor95::Skip( std::size_t nBytes )
 mnOffset = (mnOffset + nBytes) & 0x0F;
 }
 
-MSCodec97::MSCodec97(size_t nHashLen)
-: m_nHashLen(nHashLen)
+MSCodec97::MSCodec97(size_t nHashLen, const OUString& rEncKeyName)
+: m_sEncKeyName(rEncKeyName)
+, m_nHashLen(nHashLen)
 , m_hCipher(rtl_cipher_create(rtl_Cipher_AlgorithmARCFOUR, 
rtl_Cipher_ModeStream))
 , m_aDocId(16, 0)
 , m_aDigestValue(nHashLen, 0)
@@ -254,14 +255,14 @@ MSCodec97::MSCodec97(size_t nHashLen)
 }
 
 MSCodec_Std97::MSCodec_Std97()
-: MSCodec97(RTL_DIGEST_LENGTH_MD5)
+: MSCodec97(RTL_DIGEST_LENGTH_MD5, "STD97EncryptionKey")
 {
 m_hDigest = rtl_digest_create(rtl_Digest_AlgorithmMD5);
 assert(m_hDigest != nullptr);
 }
 
 MSCodec_CryptoAPI::MSCodec_CryptoAPI()
-: MSCodec97(RTL_DIGEST_LENGTH_SHA1)
+: MSCodec97(RTL_DIGEST_LENGTH_SHA1, "CryptoAPIEncryptionKey")
 {
 }
 
@@ -299,7 +300,7 @@ bool MSCodec97::InitCodec( const uno::Sequence< 
beans::NamedValue >& aData )
 bool bResult = false;
 
 ::comphelper::SequenceAsHashMap aHashData( aData );
-uno::Sequence< sal_Int8 > aKey = 
aHashData.getUnpackedValueOrDefault("STD97EncryptionKey", uno::Sequence< 
sal_Int8 >() );
+uno::Sequence aKey = 
aHashData.getUnpackedValueOrDefault(m_sEncKeyName, uno::Sequence());
 const size_t nKeyLen = aKey.getLength();
 if (nKeyLen == m_nHashLen)
 {
@@ -327,7 +328,7 @@ uno::Sequence< beans::NamedValue > 
MSCodec97::GetEncryptionData()
 {
 ::comphelper::SequenceAsHashMap aHashData;
 assert(m_aDigestValue.size() == m_nHashLen);
-aHashData[ OUString( "STD97EncryptionKey" ) ] <<= uno::Sequence< sal_Int8 
>( reinterpret_cast(m_aDigestValue.data()), m_nHashLen );
+aHashData[m_sEncKeyName] <<= 
uno::Sequence(reinterpret_cast(m_aDigestValue.data()), 
m_nHashLen);
 aHashData[ OUString( "STD97UniqueID" ) ] <<= uno::Sequence< sal_Int8 >( 
reinterpret_cast(m_aDocId.data()), m_aDocId.size() );
 
 return aHashData.getAsConstNamedValueList();
@@ -380,6 +381,9 @@ void MSCodec_CryptoAPI::InitKey (
 (void)memcpy(m_aDocId.data(), pDocId, 16);
 
 lcl_PrintDigest(m_aDocId.data(), "DocId value");
+
+//generate the old format key while we have the required data
+m_aStd97Key = ::comphelper::DocPasswordHelper::GenerateStd97Key(pPassData, 
pDocId);
 }
 
 bool MSCodec97::VerifyKey(const sal_uInt8* pSaltData, const sal_uInt8* 
pSaltDigest)
@@ -477,6 +481,15 @@ bool MSCodec_CryptoAPI::InitCipher(sal_uInt32 nCounter)
 return (result == rtl_Cipher_E_None);
 }
 
+uno::Sequence MSCodec_CryptoAPI::GetEncryptionData()
+{
+::comphelper::SequenceAsHashMap aHashData(MSCodec97::GetEncryptionData());
+//add in the old encryption key as well as our new key so saving using the
+//old crypto scheme can be done without reprompt for the password
+aHashData[OUString("STD97EncryptionKey")] <<= m_aStd97Key;
+return aHashData.getAsConstNamedValueList();
+}
+
 void MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 
nSaltDigest[16] )
 {
 #if DEBUG_MSO_ENCRYPTION_STD97
diff --git a/include/filter/msfilter/mscodec.hxx 
b/include/filter/msfilter/mscodec.hxx
index b0ab818449ae..aa38f6e9fc00 100644
--- a/include/filter/msfilter/mscodec.hxx
+++ b/include/filter/msfilter/mscodec.hxx
@@ -178,7 +178,7 @@ public:
 class MSFILTER_DLLPUBLIC MSCodec97
 {
 public:
-MSCodec97(size_t nHashLen);
+MSCodec97(size_t nHashLen, const OUString& rEncKeyName);
 virtual ~MSCodec97();
 
 /** Initializes the algorithm with the encryption data.
@@ -195,7 +195,7 @@ public:
 The sequence contains the necessary data to initialize
 the codec.
  */
-css::uno::Sequence< 

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

2018-01-09 Thread Caolán McNamara
 filter/source/msfilter/svdfppt.cxx |   26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

New commits:
commit ee6165a184b9ac7f004f2086adb669b5a31575cf
Author: Caolán McNamara 
Date:   Tue Jan 9 16:27:15 2018 +

ofz#5154 limit depth to max legal depth

i <= 5 was nonsense here

Change-Id: Ic1b0daf874b9df13ad012d11efaee1c31a47b1d6
Reviewed-on: https://gerrit.libreoffice.org/47667
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/filter/source/msfilter/svdfppt.cxx 
b/filter/source/msfilter/svdfppt.cxx
index 43449eb59337..eb083340d6a0 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -3327,22 +3327,17 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& 
rMan, SvStream& rSt, const
 if ( aHd.nRecInstance < PPT_STYLESHEETENTRYS )
 {
 sal_uInt16 nDepth = 0, i = 0;
-rSt.ReadUInt16( nDepth );
-if ( i <= 5 )
+rSt.ReadUInt16(nDepth);
+nDepth = std::min(nDepth, nMaxPPTLevels);
+auto nHdEndRecPos = DffPropSet::SanitizeEndPos(rSt, 
aHd.GetRecEndFilePos());
+while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < 
nHdEndRecPos ) && ( i < nDepth ) )
 {
-auto nHdEndRecPos = 
DffPropSet::SanitizeEndPos(rSt, aHd.GetRecEndFilePos());
-while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < 
nHdEndRecPos ) && ( i < nDepth ) )
-{
-bStyles = true;
-ReadPPTExtParaLevel( rSt, aExtParaSheet[ 
(TSS_Type)aHd.nRecInstance ].aExtParaLevel[ i++ ] );
-}
-#ifdef DBG_UTIL
-if ( rSt.Tell() != aHd.GetRecEndFilePos() )
-OSL_FAIL( "PPTExParaProv::PPTExParaProv - 
error reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
-#endif
+bStyles = true;
+ReadPPTExtParaLevel( rSt, aExtParaSheet[ 
(TSS_Type)aHd.nRecInstance ].aExtParaLevel[ i++ ] );
 }
 #ifdef DBG_UTIL
-else OSL_FAIL( "PPTExParaProv::PPTExParaProv - depth 
is greater than 5 (SJ)" );
+if ( rSt.Tell() != aHd.GetRecEndFilePos() )
+OSL_FAIL( "PPTExParaProv::PPTExParaProv - error 
reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
 #endif
 }
 #ifdef DBG_UTIL
@@ -3421,8 +3416,9 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( 
SdrPowerPointImport& rManag
 }
 
 if ( ( nBuFlags & 0x0380 ) != 0x0380 )  // merge style sheet
-{   // we have to read the master attributes
-if ( pParaProv && ( nLevel < 5 ) )
+{
+// we have to read the master attributes
+if (pParaProv && nLevel < nMaxPPTLevels)
 {
 if ( pParaProv->bStyles )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-27 Thread Caolán McNamara
 filter/source/msfilter/msdffimp.cxx |   24 
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit cd1613eb5fcdd7f5a1176a3f8c4be9447b97c5b1
Author: Caolán McNamara 
Date:   Sun Nov 26 13:18:04 2017 +

ofz#4435 Bad-cast

Change-Id: Ie0364c758af84097cee93e4f6c5e8af2816359d4
Reviewed-on: https://gerrit.libreoffice.org/45287
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 443feb8ea728..eadbf3afcc9a 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4102,11 +4102,15 @@ SdrObject* SvxMSDffManager::ImportGroup( const 
DffRecordHeader& rHd, SvStream& r
 return pRet;
 sal_Int32 nShapeId;
 SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, 
aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1,  );
-if ( pTmp && pRet && 
static_cast(pRet)->GetSubList() )
+if (pTmp)
 {
-
static_cast(pRet)->GetSubList()->NbcInsertObject( pTmp );
-if( nShapeId )
-insertShapeId( nShapeId, pTmp );
+SdrObjGroup* pGroup = dynamic_cast(pRet);
+if (pGroup && pGroup->GetSubList())
+{
+pGroup->GetSubList()->NbcInsertObject(pTmp);
+if (nShapeId)
+insertShapeId(nShapeId, pTmp);
+}
 }
 }
 else if ( aRecHd2.nRecType == DFF_msofbtSpContainer )
@@ -4115,11 +4119,15 @@ SdrObject* SvxMSDffManager::ImportGroup( const 
DffRecordHeader& rHd, SvStream& r
 return pRet;
 sal_Int32 nShapeId;
 SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, 
aClientRect, aGlobalChildRect, nCalledByGroup + 1,  );
-if ( pTmp && pRet && 
static_cast(pRet)->GetSubList())
+if (pTmp)
 {
-
static_cast(pRet)->GetSubList()->NbcInsertObject( pTmp );
-if( nShapeId )
-insertShapeId( nShapeId, pTmp );
+SdrObjGroup* pGroup = dynamic_cast(pRet);
+if (pGroup && pGroup->GetSubList())
+{
+pGroup->GetSubList()->NbcInsertObject(pTmp);
+if (nShapeId)
+insertShapeId(nShapeId, pTmp);
+}
 }
 }
 if (!aRecHd2.SeekToEndOfRecord(rSt))
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source sd/source

2017-11-27 Thread Caolán McNamara
 filter/source/msfilter/msdffimp.cxx |5 -
 sd/source/filter/ppt/pptin.cxx  |2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 765ff606426251f90aff5d1fc89f01ed7594ed59
Author: Caolán McNamara 
Date:   Sun Nov 26 20:45:10 2017 +

ofz#4436 check if seek succeeded

Change-Id: I56d9692647b28c706b56ccacf08d494b3d830d94
Reviewed-on: https://gerrit.libreoffice.org/45296
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index e6acd585ab5e..443feb8ea728 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6026,7 +6026,10 @@ bool SvxMSDffManager::GetShapeGroupContainerData( 
SvStream& rSt,
 return false;
 }
 else
-rSt.SeekRel( nLength );
+{
+if (!checkSeek(rSt, rSt.Tell() + nLength))
+return false;
+}
 nReadSpGrCont += nLength;
 }
 while( nReadSpGrCont < nLenShapeGroupCont );
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 738e865cb23a..6d0551ac01c9 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -855,7 +855,7 @@ bool ImplSdPPTImport::Import()
 bool bSuccess = aHd.SeekToEndOfRecord(rStCtrl);
 if (!bSuccess)
 {
-SAL_WARN("filter.ms", "Count not seek to end of 
record");
+SAL_WARN("filter.ms", "Could not seek to end of 
record");
 break;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-20 Thread Caolán McNamara
 filter/source/graphicfilter/icgm/class7.cxx |   18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 7e3572833b8ce0c9d2b92130df099a8bbbe95c4d
Author: Caolán McNamara 
Date:   Mon Nov 13 16:03:28 2017 +

ofz: compare against available data len

Change-Id: I407e104e08aa393d66ed5c6baf5e0b0ab2d361bd
Reviewed-on: https://gerrit.libreoffice.org/44688
Tested-by: Jenkins 
Reviewed-by: David Tardon 

diff --git a/filter/source/graphicfilter/icgm/class7.cxx 
b/filter/source/graphicfilter/icgm/class7.cxx
index 116338b870da..1d5f442b7427 100644
--- a/filter/source/graphicfilter/icgm/class7.cxx
+++ b/filter/source/graphicfilter/icgm/class7.cxx
@@ -30,16 +30,23 @@ void CGM::ImplDoClass7()
 case 0x01 : /*Message */break;
 case 0x02 :
 {
-sal_uInt8*  pAppData = mpSource + 12;
+if (mpEndValidSource - mpSource < 12)
+throw css::uno::Exception("attempt to read past end of input", 
nullptr);
+
 sal_uInt16* pTemp = reinterpret_cast(mpSource);
 sal_uInt16 nOpcode = pTemp[ 4 ];
 
+sal_uInt8* pAppData = mpSource + 12;
+
 if ( mpChart || ( nOpcode == 0 ) )
 {
 switch ( nOpcode )
 {
 case 0x000 : /*AppData - Beginning of File Opcodes*/
 {
+if (mpEndValidSource - pAppData < 4)
+throw css::uno::Exception("attempt to read past 
end of input", nullptr);
+
 if ( mpChart == nullptr )
 mpChart = new CGMChart;
 mpChart->mnCurrentFileType = pAppData[ 3 ];
@@ -68,6 +75,9 @@ void CGM::ImplDoClass7()
 case 0x262 : /*AppData - ENDGROUP */break;
 case 0x264 : /*AppData - DATANODE*/
 {
+if (static_cast(mpEndValidSource - pAppData) < 
sizeof(DataNode))
+throw css::uno::Exception("attempt to read past 
end of input", nullptr);
+
 mpChart->mDataNode[ 0 ] = 
*reinterpret_cast( pAppData );
 sal_Int8 nZoneEnum = mpChart->mDataNode[ 0 ].nZoneEnum;
 if ( nZoneEnum && ( nZoneEnum <= 6 ) )
@@ -76,6 +86,9 @@ void CGM::ImplDoClass7()
 break;
 case 0x2BE : /*AppData - SHWSLIDEREC*/
 {
+if (mpEndValidSource - pAppData < 16)
+throw css::uno::Exception("attempt to read past 
end of input", nullptr);
+
 if ( pAppData[ 16 ] == 0 )  // a blank template ?
 {
 if ( pAppData[ 2 ] == 46 )
@@ -101,6 +114,9 @@ void CGM::ImplDoClass7()
 case 0x2CA : /*AppData - SHWAPP */break;
 case 0x320 : /*AppData - TEXT*/
 {
+if (mpEndValidSource - pAppData < 9)
+throw css::uno::Exception("attempt to read past 
end of input", nullptr);
+
 TextEntry* pTextEntry = new TextEntry;
 pTextEntry->nTypeOfText = 
*(reinterpret_cast( pAppData ) );
 pTextEntry->nRowOrLineNum = 
*(reinterpret_cast( pAppData + 2 ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-10-25 Thread Caolán McNamara
 filter/source/graphicfilter/idxf/dxftblrd.cxx |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 2851316853b6c9106d9dc89a8ea4c3ca42eab01e
Author: Caolán McNamara 
Date:   Tue Oct 24 11:28:47 2017 +0100

ofz#3759 check for valid starting dash index

Change-Id: I09e117e14eda2565c9b25d407cc4328d4f2ee97a
Reviewed-on: https://gerrit.libreoffice.org/43802
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/filter/source/graphicfilter/idxf/dxftblrd.cxx 
b/filter/source/graphicfilter/idxf/dxftblrd.cxx
index 1d2f8b483428..a7b968de6db3 100644
--- a/filter/source/graphicfilter/idxf/dxftblrd.cxx
+++ b/filter/source/graphicfilter/idxf/dxftblrd.cxx
@@ -68,9 +68,14 @@ void DXFLType::Read(DXFGroupReader & rDGR)
 rDGR.SetError();
 return;
 }
-if (nDashIndex

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

2017-10-20 Thread Caolán McNamara
 filter/source/msfilter/escherex.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit bb14f64131148b01f599a91373e81b822d624ba4
Author: Caolán McNamara 
Date:   Fri Oct 20 14:18:29 2017 +0100

Resolves: tdf#113253 graphics change shape after ppt roundtrip

Change-Id: I8e7520c206e909c016298f76fcd5083c98184dc4
Reviewed-on: https://gerrit.libreoffice.org/43610
Reviewed-by: Michael Stahl 
Tested-by: Jenkins 

diff --git a/filter/source/msfilter/escherex.cxx 
b/filter/source/msfilter/escherex.cxx
index ec2db79883cb..01a77919ec69 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3160,7 +3160,7 @@ void 
EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
 break;
 case 
css::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
 {
-nVal = (msopathEscape 
<< 13) | (5 << 8);
+nVal = (msopathEscape 
<< 13) | (10 << 8);
 }
 break;
 case 
css::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source sd/qa svx/source xmloff/inc xmloff/source

2017-10-20 Thread Michael Stahl
 filter/source/msfilter/escherex.cxx |3 
 sd/qa/unit/data/fit-to-size.fodp|  724 
 sd/qa/unit/export-tests.cxx |  101 ++
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |5 
 svx/source/toolbars/fontworkbar.cxx |   10 
 xmloff/inc/xmlsdtypes.hxx   |1 
 xmloff/source/draw/sdpropls.cxx |   67 +
 7 files changed, 900 insertions(+), 11 deletions(-)

New commits:
commit 451fcee7f7c2bdc5a9241662c412027672df3a1c
Author: Michael Stahl 
Date:   Tue Oct 17 17:24:03 2017 +0200

tdf#97630 xmloff: ODF extended draw:fit-to-size mess

The plan:

1. As Regina points out, there is already (in ODF 1.2, but not ODF 1.1)
   a style:shrink-to-fit attribute for shapes, so use this to represent
   the AUTOFIT value.

   The fallback from AUTOFIT to draw:fit-to-size="true" was a stupid
   idea anyway, probably "false" is less annoying in practice.

   There are 2 different shapes that implement TextFitToSize property:

   a) text shapes already interpret ALLLINES and PROPORTIONAL exactly
  the same
   b) fontwork custom shapes interpret ALLLINES but do nothing for
  PROPORTIONAL

   As Regina points out, there is no shape that needs to distinguish
   between ALLLINES and PROPORTIONAL, so we do a minor behavioral
   API CHANGE and from now on interpret PROPORTIONAL as ALLLINES
   on fontwork custom shapes.  This obviates the need to distinguish
   the values in ODF and so we don't need a new attribute,
   just use draw:fit-to-size="true" for both.

   On import, use MID_FLAG_MERGE_PROPERTY to combine the 2 attributes
   into one value.

2. Restrict the export of draw:fit-to-size to only the standard
   values "true"/"false".

This implements step 1, the step 2 will be done in the future when
most users have the import of the style:shrink-to-fit.

Change-Id: I4a378aa110fdb82db7a99a839d7ff207248a73e7
Reviewed-on: https://gerrit.libreoffice.org/43521
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 
(cherry picked from commit 33eb9fdb61033b3fd35d923900b1f5791f4b71c8)
Reviewed-on: https://gerrit.libreoffice.org/43595
Reviewed-by: Thorsten Behrens 

diff --git a/filter/source/msfilter/escherex.cxx 
b/filter/source/msfilter/escherex.cxx
index 6149a1ccc8c0..ec2db79883cb 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3464,7 +3464,8 @@ void 
EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
 case drawing::TextHorizontalAdjust_BLOCK:
 {
 SdrFitToSizeType  eFTS( 
static_cast(pCustoShape->GetMergedItem( 
SDRATTR_TEXT_FITTOSIZE )).GetValue() );
-if ( eFTS == 
SdrFitToSizeType::AllLines)
+if (eFTS == SdrFitToSizeType::AllLines 
||
+eFTS == 
SdrFitToSizeType::Proportional)
 {
 gTextAlign = mso_alignTextStretch;
 }
diff --git a/sd/qa/unit/data/fit-to-size.fodp b/sd/qa/unit/data/fit-to-size.fodp
new file mode 100644
index ..734cf8a3a6c6
--- /dev/null
+++ b/sd/qa/unit/data/fit-to-size.fodp
@@ -0,0 +1,724 @@
+
+http://www.w3.org/1999/xlink; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:scr
 ipt="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" 
xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source sw/qa

2017-09-19 Thread Szymon Kłos
 filter/source/msfilter/msdffimp.cxx   |2 +-
 sw/qa/extras/ww8export/data/tdf111480.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx |9 +
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit f289357c6bc5e145e05075de4749591a05c37844
Author: Szymon Kłos 
Date:   Wed Aug 9 12:15:53 2017 +0200

tdf#111480 Circular text was imported horizontally

Change-Id: I84a6c3a30fd1dddf104ad8bf037a5e0b2a90d376
Reviewed-on: https://gerrit.libreoffice.org/40912
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/42350
Reviewed-by: Michael Stahl 

diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 8053abeb8d26..e6acd585ab5e 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4421,7 +4421,7 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
 aFont.SetFamilyName( aFontName );
 auto nTextWidth = pOut->GetTextWidth( aObjectText );
 
-if ( nTextWidth )
+if ( nTextWidth && aObjData.eShapeType == 
mso_sptTextPlainText )
 {
 fRatio = aFont.GetFontSize().Height();
 fRatio /= nTextWidth;
diff --git a/sw/qa/extras/ww8export/data/tdf111480.doc 
b/sw/qa/extras/ww8export/data/tdf111480.doc
new file mode 100755
index ..888126066624
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf111480.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx 
b/sw/qa/extras/ww8export/ww8export2.cxx
index 681e3173b519..c7f124e85f15 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -115,6 +115,15 @@ DECLARE_WW8EXPORT_TEST(testTdf91687, "tdf91687.doc")
 CPPUNIT_ASSERT_EQUAL((sal_Int32)18105, xWatermark->getSize().Width);
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf111480, "tdf111480.doc")
+{
+// Circular text was imported horizontally
+uno::Reference xText = getShape(1);
+
+CPPUNIT_ASSERT(xText->getSize().Height > 11000);
+CPPUNIT_ASSERT(xText->getSize().Width  > 11000);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-15 Thread Samuel Mehrbrodt
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl   |6 +++---
 filter/source/xslt/odf2xhtml/export/xhtml/header.xsl |2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 0f689a844576bbb200d5b9bb7b822fa53396f3e0
Author: Samuel Mehrbrodt 
Date:   Thu Sep 7 09:34:14 2017 +0200

xhtml filter: Use css class instead of 

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

2017-09-13 Thread Samuel Mehrbrodt
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6b9470405f63e169ce9098797213c4520f053811
Author: Samuel Mehrbrodt 
Date:   Wed Sep 6 16:07:10 2017 +0200

tdf#111492 Numbering: entry B.1 is exported as 2.1

Look for the current number format, not always for the first one

Change-Id: Ic11bcb420873bc0a5a644a05623bb801a1579dd7
Reviewed-on: https://gerrit.libreoffice.org/42000
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 
Reviewed-on: https://gerrit.libreoffice.org/42009
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 98358fd48627..3043c1f1d312 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1337,7 +1337,7 @@



-   
+   



@@ -1367,7 +1367,7 @@



-   
+   



___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-13 Thread Samuel Mehrbrodt
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3de0b7ecaac7b00d82a7ce74212d98ce44c30818
Author: Samuel Mehrbrodt 
Date:   Wed Sep 6 14:51:09 2017 +0200

xhtml export: Rather use rem than cm for margin

follow-up for 46b4eb8b0e9325f8c29cd391baf9504bccee1837

Change-Id: I70986537b842b7fd26de9c2efd1fbdad7b5271a1
Reviewed-on: https://gerrit.libreoffice.org/41990
Tested-by: Jenkins 
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 3811da1b854896fa96f65a87efb1876523353618)
Reviewed-on: https://gerrit.libreoffice.org/42003
Reviewed-by: Christian Lohmaier 

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index c0ba08f5e8a7..98358fd48627 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1282,7 +1282,7 @@



-   
margin-right:0.64cm;
+   
margin-right:0.8rem;



___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-07 Thread Julien Nabet
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |   20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 94b583dccc90651bc6366c2a85813d91b708496f
Author: Julien Nabet 
Date:   Sat Aug 19 23:45:48 2017 +0200

tdf#111492 XHTML export does not honor numbering levels

In heading, for preceding level, count only those with num-format != ''

Reviewed-on: https://gerrit.libreoffice.org/41341
Reviewed-by: Samuel Mehrbrodt 
Tested-by: Samuel Mehrbrodt 
(cherry picked from commit c284e1de170add762906658b1f44e7d11a370c5e)

Change-Id: I93cb73ae5a236f5413c149c412b247da559671e4
Reviewed-on: https://gerrit.libreoffice.org/42004
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 124411bfa639..c0ba08f5e8a7 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1329,15 +1329,17 @@

 

-   
-   
-   
-   
-   
-   
-   
-   
-   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   
+   



___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source sw/qa

2017-09-01 Thread Vasily Melenchuk
 filter/source/svg/svgwriter.cxx   |2 -
 sw/qa/extras/odfexport/data/tdf100492.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx  |   34 ++
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 52f0d67e9756d81032c4b73fbb3e0aefe053e41d
Author: Vasily Melenchuk 
Date:   Tue Jul 25 18:08:13 2017 +0300

tdf#100492 Skip empty shapes in SVG export

Some shapes do not contain polyline and meanwhile contain start/end
arrows. This is causing unexpected line endings appear in export.

TODO: Unittest is disabled, since XML parsing returns only root node
without children. So XPATH assert fails.

Change-Id: Ibc28f12b0f3838065978a674f0debe8e1b8103e9
Reviewed-on: https://gerrit.libreoffice.org/41684
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
Reviewed-by: Vasily Melenchuk 

diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 93329daf02f9..927cda90f33a 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3278,7 +3278,7 @@ void SVGActionWriter::ImplWriteActions( const 
GDIMetaFile& rMtf,
 }
 }
 
-if(mapCurShape.get() &&(aStartArrow.Count() || 
aEndArrow.Count()))
+if(mapCurShape.get() && 
mapCurShape->maShapePolyPoly.Count() && (aStartArrow.Count() || 
aEndArrow.Count()))
 {
 ImplWriteShape( *mapCurShape );
 
diff --git a/sw/qa/extras/odfexport/data/tdf100492.odt 
b/sw/qa/extras/odfexport/data/tdf100492.odt
new file mode 100644
index ..e17bd67c5096
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf100492.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 012cbf1893ed..544602996baf 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -19,6 +19,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -32,6 +34,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -1588,6 +1592,36 @@ DECLARE_ODFEXPORT_TEST(testImageMimetype, 
"image-mimetype.odt")
 }
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf100492, "tdf100492.odt")
+{
+uno::Reference xShape = getShape(1);
+CPPUNIT_ASSERT(xShape.is());
+
+// Save the first shape to a SVG
+uno::Reference xGraphicExporter = 
drawing::GraphicExportFilter::create(comphelper::getProcessComponentContext());
+uno::Reference xSourceDoc(xShape, uno::UNO_QUERY);
+xGraphicExporter->setSourceDocument(xSourceDoc);
+
+SvMemoryStream aStream;
+uno::Reference xOutputStream(new 
utl::OStreamWrapper(aStream));
+uno::Sequence aDescriptor( 
comphelper::InitPropertySequence({
+{ "OutputStream", uno::Any(xOutputStream) },
+{ "FilterName", uno::Any(OUString("SVG")) }
+}));
+xGraphicExporter->filter(aDescriptor);
+aStream.Seek(STREAM_SEEK_TO_BEGIN);
+
+// TODO: Disabled. Parsing of SVG gives just root node without any 
children.
+// Reason of such behavior unclear. So XPATH assert fails.
+
+// Parse resulting SVG as XML file.
+// xmlDocPtr pXmlDoc = parseXmlStream();
+
+// Check amount of paths required to draw an arrow.
+// Since there are still some emty paths in output test can fail later. 
There are just two
+// really used and visible paths.
+//assertXPath(pXmlDoc, "/svg/path", 4);
+}
 
 #endif
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-28 Thread Caolán McNamara
 filter/source/graphicfilter/icgm/class4.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 2f252e0cc62b7cf9d35ba1a427a3c0b4606cd0d1
Author: Caolán McNamara 
Date:   Mon Aug 28 10:53:42 2017 +0100

ofz#3121 check bounds better

Change-Id: Ib1eacda7e4cdf1d0238532f4e38059a9c30556ac
Reviewed-on: https://gerrit.libreoffice.org/41627
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/filter/source/graphicfilter/icgm/class4.cxx 
b/filter/source/graphicfilter/icgm/class4.cxx
index 617f88aa7307..dc92f79cf560 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -186,7 +186,7 @@ void CGM::ImplDoClass4()
 sal_uInt32 nType = ImplGetUI16();
 sal_uInt32 nSize = ImplGetUI( 1 );
 
-if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) < nSize)
+if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) <= nSize)
 throw css::uno::Exception("attempt to read past end of 
input", nullptr);
 
 mpSource[mnParaSize + nSize] = 0;
@@ -224,7 +224,7 @@ void CGM::ImplDoClass4()
 sal_uInt32 nType = ImplGetUI16();
 sal_uInt32 nSize = ImplGetUI(1);
 
-if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) < nSize)
+if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) <= nSize)
 throw css::uno::Exception("attempt to read past end of 
input", nullptr);
 
 mpSource[ mnParaSize + nSize ] = 0;
@@ -242,7 +242,7 @@ void CGM::ImplDoClass4()
 (void)ImplGetUI16(); // nType
 sal_uInt32 nSize = ImplGetUI( 1 );
 
-if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) < nSize)
+if (static_cast(mpEndValidSource - (mpSource + 
mnParaSize)) <= nSize)
 throw css::uno::Exception("attempt to read past end of 
input", nullptr);
 
 mpSource[ mnParaSize + nSize ] = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-08-11 Thread Samuel Mehrbrodt
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |   30 -
 1 file changed, 7 insertions(+), 23 deletions(-)

New commits:
commit d8c4c6946e5dc3b1756294496e7fac1d343aadea
Author: Samuel Mehrbrodt 
Date:   Thu Aug 10 17:35:19 2017 +0200

tdf#111492 Honor ODF 1.2 style tab indentation in XHTML export

Change-Id: I9db61ed54b59b142d5198ec977044f7f52ba6b4d
Reviewed-on: https://gerrit.libreoffice.org/40981
Tested-by: Jenkins 
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 46b4eb8b0e9325f8c29cd391baf9504bccee1837)
Reviewed-on: https://gerrit.libreoffice.org/41046
Reviewed-by: Christian Lohmaier 

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index d638f6294ad9..124411bfa639 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1273,32 +1273,16 @@

 

-   
-   
-   
+   
+   
 
-   
+   
+   

-   
-   
margin-right:
-   
-   
-   
-   cm;
-   
-   
-   
display:block;float:
-   
-   
-   
-   ;
-   
min-width:
-   
-   
-   
-   cm;
-   
+   
margin-right:0.64cm;



___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-07-28 Thread Caolán McNamara
 filter/source/graphicfilter/itiff/itiff.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 73301934b4a1861d751724e8153fbb4fb26912b9
Author: Caolán McNamara 
Date:   Fri Jul 28 10:07:50 2017 +0100

ofz#2766 ensure palette is large enough for all colors

Change-Id: I4669b473f5975ac74a37025f7c936f13bcfea420
Reviewed-on: https://gerrit.libreoffice.org/40512
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/filter/source/graphicfilter/itiff/itiff.cxx 
b/filter/source/graphicfilter/itiff/itiff.cxx
index af1707379a44..20e4ce45fcd4 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1128,7 +1128,6 @@ void TIFFReader::MakePalCol()
 nNumColors = nLargestPixelIndex + 1;
 }
 
-pAcc->SetPaletteEntryCount(nNumColors);
 for (sal_uInt32 i = 0; i < nNumColors; ++i)
 {
 sal_uInt32 nVal = ( i * 255 / ( nNumColors - 1 ) ) & 0xff;
@@ -1139,6 +1138,7 @@ void TIFFReader::MakePalCol()
 xColorMap[nNumColors - i - 1] = n0RGB;
 }
 }
+pAcc->SetPaletteEntryCount(std::max(nNumColors, 
pAcc->GetPaletteEntryCount()));
 for (sal_uInt32 i = 0; i < nNumColors; ++i)
 {
 pAcc->SetPaletteColor(i, BitmapColor( (sal_uInt8)( xColorMap[ i ] 
>> 16 ),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source sw/qa xmloff/source

2017-07-27 Thread Samuel Mehrbrodt
 filter/source/xslt/odf2xhtml/export/common/body.xsl |   52 +++-
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl  |3 -
 sw/qa/extras/odfexport/data/image-mimetype.odt  |binary
 sw/qa/extras/odfexport/odfexport.cxx|   11 
 xmloff/source/text/txtparae.cxx |   26 ++
 5 files changed, 69 insertions(+), 23 deletions(-)

New commits:
commit 01b92d73b6efd638e025d4b0520c996d5e417937
Author: Samuel Mehrbrodt 
Date:   Mon Jul 24 15:46:06 2017 +0200

tdf#109202 Add mimetype to image element

Browsers don't recognize base64 svg if the mimetype is missing.
So we add the image mimetype to our flat odf export, which the xhtml
export uses and transforms it into an xhtml document.

Change-Id: I21aafdb97b4104e14e2d40abda73a526bb37041a
Reviewed-on: https://gerrit.libreoffice.org/40371
Reviewed-by: Michael Stahl 
Tested-by: Samuel Mehrbrodt 
Reviewed-on: https://gerrit.libreoffice.org/40478
Tested-by: Jenkins 

diff --git a/filter/source/xslt/odf2xhtml/export/common/body.xsl 
b/filter/source/xslt/odf2xhtml/export/common/body.xsl
index 3196facc8092..05b78a5ed43e 100644
--- a/filter/source/xslt/odf2xhtml/export/common/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/body.xsl
@@ -1,21 +1,21 @@
 
-
+
 
@@ -317,6 +317,7 @@
 


+   
 


@@ -332,7 +333,14 @@



-   
data:image/*;base64,
+
+
+data:;base64,
+
+
+data:image/*;base64,
+
+



@@ -361,10 +369,10 @@


 
-
-  
-  
-
+
+  
+  
+



diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 823d048254c5..d638f6294ad9 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -19,7 +19,7 @@
 
-http://www.w3.org/1999/XSL/Transform; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:s
 tyle="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xt="http://www.jclark.com/xt; xmlns:common="http://exslt.org/common; 
xmlns:xalan="http://xml.apache.org/xalan; exclude-result-prefixes="chart config 
dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg 
table text xforms xlink xsd xsi xt common xalan" 
xmlns="http://www.w3.org/1999/xhtml;>
+http://www.w3.org/1999/XSL/Transform; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source include/svx sw/qa sw/source

2017-07-06 Thread Szymon Kłos
 filter/source/msfilter/escherex.cxx  |4 +++
 filter/source/msfilter/msdffimp.cxx  |   34 ++-
 include/svx/msdffdef.hxx |7 ++
 sw/qa/extras/ww8export/data/tdf91687.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx|   10 +
 sw/source/filter/ww8/wrtw8esh.cxx|7 +-
 6 files changed, 56 insertions(+), 6 deletions(-)

New commits:
commit bba6e442b0d8a4adae1b4e64a7fa7246130e300e
Author: Szymon Kłos 
Date:   Mon Jun 19 15:32:16 2017 +0200

Watermark: tdf#91687 correct size in the .doc

Export:
* Watermarks saved using Writer were very small in the MSO.
  Export fUsegtextFStretch property in the Geometry Text
  Boolean Properties.
* tdf#91687: SnapRect contains size of Watermark after rotation.
  We have to export size without rotation.

Import:
* When import set height depending on used font and width.
  Text will keep the ratio. Remember the padding for export.

* added unit test
* introduced enum to avoid magic numbers for stretch and best fit
  properties.

Change-Id: I3427afe78488d499f13c543ca401c096161aaf34
Reviewed-on: https://gerrit.libreoffice.org/38979
Tested-by: Jenkins 
Reviewed-by: Andras Timar 
(cherry picked from commit d72e0cadceb0b43928a9b4f18d75c9d5d30afdda)
Reviewed-on: https://gerrit.libreoffice.org/39607
Reviewed-by: Christian Lohmaier 

diff --git a/filter/source/msfilter/escherex.cxx 
b/filter/source/msfilter/escherex.cxx
index cf83e13057d6..6149a1ccc8c0 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3486,6 +3486,10 @@ void 
EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT
 if ( pOutlinerParaObject && 
pOutlinerParaObject->IsVertical() )
 nTextPathFlags |= 0x2000;
 }
+
+// Use gtextFStretch for Watermark like MSO does
+nTextPathFlags |= use_gtextFStretch | gtextFStretch;
+
 if ( nTextPathFlags != nTextPathFlagsOrg )
 AddOpt( DFF_Prop_gtextFStrikethrough, 
nTextPathFlags );
 }
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 4dd1519bd74f..8053abeb8d26 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4338,7 +4338,8 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
 pRet = new SdrObjCustomShape();
 pRet->SetModel( pSdrModel );
 
-bool bIsFontwork = ( GetPropertyValue( 
DFF_Prop_gtextFStrikethrough, 0 ) & 0x4000 ) != 0;
+sal_uInt32 ngtextFStrikethrough = GetPropertyValue( 
DFF_Prop_gtextFStrikethrough, 0 );
+bool bIsFontwork = ( ngtextFStrikethrough & 0x4000 ) != 0;
 
 // in case of a FontWork, the text is set by the escher 
import
 if ( bIsFontwork )
@@ -4363,16 +4364,16 @@ SdrObject* SvxMSDffManager::ImportShape( const 
DffRecordHeader& rHd, SvStream& r
 
 // SJ: applying fontattributes for Fontwork :
 if ( IsHardAttribute( DFF_Prop_gtextFItalic ) )
-aSet.Put( SvxPostureItem( ( GetPropertyValue( 
DFF_Prop_gtextFStrikethrough, 0 ) & 0x0010 ) != 0 ? ITALIC_NORMAL : 
ITALIC_NONE, EE_CHAR_ITALIC ) );
+aSet.Put( SvxPostureItem( ( ngtextFStrikethrough & 
0x0010 ) != 0 ? ITALIC_NORMAL : ITALIC_NONE, EE_CHAR_ITALIC ) );
 
 if ( IsHardAttribute( DFF_Prop_gtextFBold ) )
-aSet.Put( SvxWeightItem( ( GetPropertyValue( 
DFF_Prop_gtextFStrikethrough, 0 ) & 0x0020 ) != 0 ? WEIGHT_BOLD : 
WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
+aSet.Put( SvxWeightItem( ( ngtextFStrikethrough & 
0x0020 ) != 0 ? WEIGHT_BOLD : WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
 
 // SJ TODO: Vertical Writing is not correct, instead
 // this should be replaced through "CharacterRotation"
 // by 90 degrees, therefore a new Item has to be
 // supported by svx core, api and xml file format
-
static_cast(pRet)->SetVerticalWriting( ( GetPropertyValue( 
DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 );
+
static_cast(pRet)->SetVerticalWriting( ( 
ngtextFStrikethrough & 0x2000 ) != 0 );
 
 if ( SeekToContent( DFF_Prop_gtextUNICODE, rSt ) )
 {
@@ -4407,12 +4408,35 @@ SdrObject* SvxMSDffManager::ImportShape( const 

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

2017-06-21 Thread Caolán McNamara
 filter/source/msfilter/svdfppt.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 14141f72d6019cad66796ab12aaec686ae4db439
Author: Caolán McNamara 
Date:   Wed Jun 21 09:16:33 2017 +0100

ofz#2332 fix dangling pCObj

Change-Id: Ifa62b1ce2aefa939cfceb2e110d126b785cb6e26
Reviewed-on: https://gerrit.libreoffice.org/39034
Tested-by: Jenkins 
Reviewed-by: Eike Rathke 

diff --git a/filter/source/msfilter/svdfppt.cxx 
b/filter/source/msfilter/svdfppt.cxx
index d51b2a811b78..43449eb59337 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2937,6 +2937,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, 
const PptSlidePersistEntry*
 pPtr->pAObj = nullptr;
 if (pPtr->pBObj == rSlidePersist.pBObj)
 pPtr->pBObj = nullptr;
+if (pPtr->pCObj == rSlidePersist.pBObj)
+pPtr->pCObj = nullptr;
 }
 }
 SdrObject::Free(rSlidePersist.pBObj);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-09 Thread Julien Nabet
 filter/source/msfilter/msvbahelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e97c7ea6febe887b7123d960aea5e441ac0ce662
Author: Julien Nabet 
Date:   Thu Jun 8 21:56:48 2017 +0200

Typo: F9 should be mapped with KEY_F9

Like this since mapping added:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=75fbed472cd689c8cc0b89e13a97969d77a0ea7c
(2012-03-05)

Change-Id: I8243080257c7a116207293426c2a8b840324859b
Reviewed-on: https://gerrit.libreoffice.org/38582
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 
(cherry picked from commit c1567aa18a79b807b23da12423166dc217ff582a)
Reviewed-on: https://gerrit.libreoffice.org/38585

diff --git a/filter/source/msfilter/msvbahelper.cxx 
b/filter/source/msfilter/msvbahelper.cxx
index ed3eb18ebe03..8f58a82f410d 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -671,7 +671,7 @@ KeyCodeEntry const aMSKeyCodesData[] = {
 { "F6", KEY_F6 },
 { "F7", KEY_F7 },
 { "F8", KEY_F8 },
-{ "F9", KEY_F1 },
+{ "F9", KEY_F9 },
 { "F10", KEY_F10 },
 { "F11", KEY_F11 },
 { "F12", KEY_F12 },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-02 Thread Caolán McNamara
 filter/source/graphicfilter/ieps/ieps.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 3b96a1690c617f53844925e105f36e138e7e3d56
Author: Caolán McNamara 
Date:   Fri Jun 2 19:22:19 2017 +0100

ofz: fix remaining length check

Change-Id: I1788ae2a15823b0dc165ad1a99bd0f2aac0bcaf1
Reviewed-on: https://gerrit.libreoffice.org/38362
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/filter/source/graphicfilter/ieps/ieps.cxx 
b/filter/source/graphicfilter/ieps/ieps.cxx
index 954668bdea92..ba887d421f98 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -647,15 +647,17 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
 if (!bHasPreview && nBytesRead >= nSecurityCount)
 {
 sal_uInt8* pDest = ImplSearchEntry( pBuf.get(), 
reinterpret_cast("%%BeginPreview:"), nBytesRead - 
nSecurityCount, 15 );
-if ( pDest  )
+sal_uInt32 nRemainingBytes = pDest ? (nBytesRead - (pDest - 
pBuf.get())) : 0;
+if (nRemainingBytes >= 15)
 {
 pDest += 15;
+nSecurityCount = nRemainingBytes - 15;
 long nWidth = ImplGetNumber(pDest, nSecurityCount);
 long nHeight = ImplGetNumber(pDest, nSecurityCount);
 long nBitDepth = ImplGetNumber(pDest, nSecurityCount);
 long nScanLines = ImplGetNumber(pDest, nSecurityCount);
-pDest = nSecurityCount ? ImplSearchEntry(pDest, 
reinterpret_cast("%"), 16, 1) : nullptr;   // go to the 
first Scanline
-if ( nSecurityCount && pDest && nWidth && nHeight && ( ( 
nBitDepth == 1 ) || ( nBitDepth == 8 ) ) && nScanLines )
+pDest = ImplSearchEntry(pDest, reinterpret_cast("%"), nSecurityCount, 1);   // go to the first Scanline
+if (pDest && nWidth && nHeight && ( ( nBitDepth == 1 ) || 
( nBitDepth == 8 ) ) && nScanLines)
 {
 rStream.Seek( nBufStartPos + ( pDest - pBuf.get() ) );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - filter/source include/vcl vcl/source

2017-05-25 Thread Miklos Vajna
 filter/source/pdf/pdfexport.cxx   |8 +---
 include/vcl/pdfwriter.hxx |2 +-
 vcl/source/gdi/pdfwriter.cxx  |2 +-
 vcl/source/gdi/pdfwriter_impl.cxx |4 ++--
 vcl/source/gdi/pdfwriter_impl.hxx |   10 +-
 5 files changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 3a2ccb419c5face6fbf56b1a4877e675d4cd5fe8
Author: Miklos Vajna 
Date:   Thu May 25 16:37:04 2017 +0200

tdf#108056 PDF export: work with double page size

Our coordinate system has the origo in the top left corner, PDF's one is
at the bottom left corner. So the page height affects the coordinate of
all widths and y positions. That page width is 870.25 in the case of the
bugdoc, but it was handled as 870 due to the integer rounding. The
coordinates and heights are now closer to the expected ones.

(cherry picked from commit a05dc747caf5b8fef6bd95a999cb6098f2b4dbc7)

Change-Id: I9c7d77298df3850bbc170c9ace18120900d7e3fa
Reviewed-on: https://gerrit.libreoffice.org/38035
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 2c4849fd9928..4fdd7a450626 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -1009,12 +1009,14 @@ void PDFExport::showErrors( const std::set< 
vcl::PDFWriter::ErrorCode >& rErrors
 
 bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, 
vcl::PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf )
 {
-const Size  aSizePDF( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), 
rMtf.GetPrefMapMode(), MapUnit::MapPoint ) );
+basegfx::B2DPolygon aSize(tools::Polygon(tools::Rectangle(Point(0, 0), 
rMtf.GetPrefSize())).getB2DPolygon());
+basegfx::B2DPolygon aSizePDF(OutputDevice::LogicToLogic(aSize, 
rMtf.GetPrefMapMode(), MapUnit::MapPoint));
+basegfx::B2DRange aRangePDF(aSizePDF.getB2DRange());
 Point   aOrigin;
 tools::Rectangle   aPageRect( aOrigin, rMtf.GetPrefSize() );
 boolbRet = true;
 
-rWriter.NewPage( aSizePDF.Width(), aSizePDF.Height() );
+rWriter.NewPage( aRangePDF.getWidth(), aRangePDF.getHeight() );
 rWriter.SetMapMode( rMtf.GetPrefMapMode() );
 
 vcl::PDFWriter::PlayMetafileContext aCtx;
@@ -1042,7 +1044,7 @@ bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, 
vcl::PDFExtOutDevData&
 rPDFExtOutDevData.ResetSyncData();
 
 if (!msWatermark.isEmpty())
-ImplWriteWatermark( rWriter, aSizePDF );
+ImplWriteWatermark( rWriter, Size(aRangePDF.getWidth(), 
aRangePDF.getHeight()) );
 
 return bRet;
 }
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index bc2608444714..78a28231ea10 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -689,7 +689,7 @@ The following structure describes the permissions used in 
PDF security
 Colors and other state information MUST
 be set again or are undefined.
 */
-void NewPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, Orientation 
eOrientation = Orientation::Inherit );
+void NewPage( double nPageWidth, double nPageHeight, Orientation 
eOrientation = Orientation::Inherit );
 /** Play a metafile like an outputdevice would do
 */
 struct PlayMetafileContext
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index ec612820e15d..28a176ba3c51 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -53,7 +53,7 @@ OutputDevice* PDFWriter::GetReferenceDevice()
 return xImplementation->getReferenceDevice();
 }
 
-void PDFWriter::NewPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, 
Orientation eOrientation )
+void PDFWriter::NewPage( double nPageWidth, double nPageHeight, Orientation 
eOrientation )
 {
 xImplementation->newPage( nPageWidth, nPageHeight, eOrientation );
 }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 3ee96131e070..a4a49436b820 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1126,7 +1126,7 @@ void PDFWriterImpl::ResourceDict::append( OStringBuffer& 
rBuf, sal_Int32 nFontDi
 rBuf.append( "]\n>>\n" );
 };
 
-PDFWriterImpl::PDFPage::PDFPage( PDFWriterImpl* pWriter, sal_Int32 nPageWidth, 
sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation )
+PDFWriterImpl::PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, 
double nPageHeight, PDFWriter::Orientation eOrientation )
 :
 m_pWriter( pWriter ),
 m_nPageWidth( nPageWidth ),
@@ -2258,7 +2258,7 @@ LogicalFontInstance* 
PdfBuiltinFontFace::CreateFontInstance( FontSelectPattern&
 }
 
 
-void PDFWriterImpl::newPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, 
PDFWriter::Orientation eOrientation )
+void PDFWriterImpl::newPage( double nPageWidth, double nPageHeight, 
PDFWriter::Orientation 

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

2017-05-18 Thread Caolán McNamara
 filter/source/graphicfilter/ieps/ieps.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1cbb19e187a981d4f4803aae189ed931d9e03a62
Author: Caolán McNamara 
Date:   Mon May 15 11:29:11 2017 +0100

ofz#1542 check remaining size of dest

Change-Id: I37cff45afdb242b31919a8a02e737424e2ecfd52
Reviewed-on: https://gerrit.libreoffice.org/37763
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/filter/source/graphicfilter/ieps/ieps.cxx 
b/filter/source/graphicfilter/ieps/ieps.cxx
index 3ab880a9ae3a..954668bdea92 100644
--- a/filter/source/graphicfilter/ieps/ieps.cxx
+++ b/filter/source/graphicfilter/ieps/ieps.cxx
@@ -654,7 +654,7 @@ ipsGraphicImport( SvStream & rStream, Graphic & rGraphic, 
FilterConfigItem* )
 long nHeight = ImplGetNumber(pDest, nSecurityCount);
 long nBitDepth = ImplGetNumber(pDest, nSecurityCount);
 long nScanLines = ImplGetNumber(pDest, nSecurityCount);
-pDest = ImplSearchEntry( pDest, reinterpret_cast("%"), 16, 1 );   // go to the first Scanline
+pDest = nSecurityCount ? ImplSearchEntry(pDest, 
reinterpret_cast("%"), 16, 1) : nullptr;   // go to the 
first Scanline
 if ( nSecurityCount && pDest && nWidth && nHeight && ( ( 
nBitDepth == 1 ) || ( nBitDepth == 8 ) ) && nScanLines )
 {
 rStream.Seek( nBufStartPos + ( pDest - pBuf.get() ) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits