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

2017-10-19 Thread Michael Meeks
 vcl/source/opengl/OpenGLContext.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5396ddfb01539424c3aef02bbdea3c5c3152a4ce
Author: Michael Meeks 
Date:   Wed Oct 18 15:24:44 2017 +0100

tdf#113225 - reset framebuffer count when resetting OpenGLContext

Otherwise we can fail to allocate a new one when we need it post reset.


http://crashreport.libreoffice.org/stats/crash_details/e4f26191-15d5-441a-868f-9ada21ef4424

Change-Id: Icc5ec6c51338e18a0a1bc890f56670e8fe9c73ea
Reviewed-on: https://gerrit.libreoffice.org/43508
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit 856d734ee1665b6aa7304847c3a923af09066016)
Reviewed-on: https://gerrit.libreoffice.org/43551
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index fc12d88617ff..57216f9827a2 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -422,6 +422,7 @@ void OpenGLContext::reset()
 delete pFramebuffer;
 pFramebuffer = pPrevFramebuffer;
 }
+mnFramebufferCount = 0;
 mpFirstFramebuffer = nullptr;
 mpLastFramebuffer = nullptr;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-18 Thread Caolán McNamara
 vcl/source/gdi/jobset.cxx |   22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 1eb3822d74f535f75aa336b27568ee8a6084c4dd
Author: Caolán McNamara 
Date:   Sun Sep 17 17:38:39 2017 +0100

detect corrupted job setup

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

diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index f80e246a5c68..31ee4f08dca5 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -239,7 +239,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& 
rJobSetup )
 
 sal_uInt16 nSystem = 0;
 rIStream.ReadUInt16( nSystem );
-const size_t nRead = nLen - sizeof(nLen) - sizeof(nSystem);
+size_t nRead = nLen - sizeof(nLen) - sizeof(nSystem);
 if (nRead > rIStream.remainingSize())
 {
 SAL_WARN("vcl", "Parsing error: " << rIStream.remainingSize() <<
@@ -248,7 +248,7 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& 
rJobSetup )
 }
 sal_uInt64 const nFirstPos = rIStream.Tell();
 std::unique_ptr pTempBuf(new char[nRead]);
-rIStream.ReadBytes(pTempBuf.get(), nRead);
+nRead = rIStream.ReadBytes(pTempBuf.get(), nRead);
 if (nRead >= sizeof(ImplOldJobSetupData))
 {
 ImplOldJobSetupData* pData = 
reinterpret_cast(pTempBuf.get());
@@ -278,11 +278,19 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& 
rJobSetup )
 rJobData.SetPaperHeight( (long)SVBT32ToUInt32( 
pOldJobData->nPaperHeight ) );
 if ( rJobData.GetDriverDataLen() )
 {
-const sal_uInt8* pDriverData = 
reinterpret_cast(pOldJobData) + nOldJobDataSize;
-sal_uInt8* pNewDriverData = static_cast(
-rtl_allocateMemory( rJobData.GetDriverDataLen() ));
-memcpy( pNewDriverData, pDriverData, 
rJobData.GetDriverDataLen() );
-rJobData.SetDriverData( pNewDriverData );
+const char* pDriverData = reinterpret_cast(pOldJobData) + nOldJobDataSize;
+const char* pDriverDataEnd = pDriverData + 
rJobData.GetDriverDataLen();
+if (pDriverDataEnd > pTempBuf.get() + nRead)
+{
+SAL_WARN("vcl", "corrupted job setup");
+}
+else
+{
+sal_uInt8* pNewDriverData = static_cast(
+rtl_allocateMemory( rJobData.GetDriverDataLen() ));
+memcpy( pNewDriverData, pDriverData, 
rJobData.GetDriverDataLen() );
+rJobData.SetDriverData( pNewDriverData );
+}
 }
 if( nSystem == JOBSET_FILE605_SYSTEM )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-05 Thread Caolán McNamara
 vcl/source/font/fontmetric.cxx |   25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

New commits:
commit e0ea7df25faeaae9f98ebde32f49eec92603d629
Author: Caolán McNamara 
Date:   Tue Sep 5 15:24:26 2017 +0100

Resolves: tdf#107249 round ascent/descent/extleading on conversion to int

Reviewed-on: https://gerrit.libreoffice.org/41944
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 0c8b749e602b6743857a9bc4efb24b6183690311)

Change-Id: Ia3ab5960d5288f5831aaa4ade800ca7513dad766
Reviewed-on: https://gerrit.libreoffice.org/41956
Tested-by: Jenkins 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 3d7bf9a0b375..b48b0aaca348 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -448,6 +448,7 @@ void ImplFontMetricData::ImplCalcLineSpacing(const 
std::vector& rHheaDa
 mnAscent = mnDescent = mnExtLeading = mnIntLeading = 0;
 
 double fScale = static_cast(mnHeight) / nUPEM;
+double fAscent = 0, fDescent = 0, fExtLeading = 0;
 
 vcl::TTGlobalFontInfo rInfo;
 memset(, 0, sizeof(vcl::TTGlobalFontInfo));
@@ -456,30 +457,34 @@ void ImplFontMetricData::ImplCalcLineSpacing(const 
std::vector& rHheaDa
 // Try hhea table first.
 if (rInfo.ascender || rInfo.descender)
 {
-mnAscent =  rInfo.ascender  * fScale;
-mnDescent= -rInfo.descender * fScale;
-mnExtLeading =  rInfo.linegap   * fScale;
+fAscent = rInfo.ascender  * fScale;
+fDescent= -rInfo.descender * fScale;
+fExtLeading = rInfo.linegap   * fScale;
 }
 
 // But if OS/2 is present, prefer it.
 if (rInfo.winAscent || rInfo.winDescent || rInfo.typoAscender || 
rInfo.typoDescender)
 {
-if (mnAscent == 0 && mnDescent == 0)
+if (fAscent == 0 && fDescent == 0)
 {
-mnAscent = rInfo.winAscent  * fScale;
-mnDescent= rInfo.winDescent * fScale;
-mnExtLeading = 0;
+fAscent = rInfo.winAscent  * fScale;
+fDescent= rInfo.winDescent * fScale;
+fExtLeading = 0;
 }
 
 const uint16_t kUseTypoMetricsMask = 1 << 7;
 if (rInfo.fsSelection & kUseTypoMetricsMask)
 {
-mnAscent =  rInfo.typoAscender  * fScale;
-mnDescent= -rInfo.typoDescender * fScale;
-mnExtLeading =  rInfo.typoLineGap   * fScale;
+fAscent =  rInfo.typoAscender  * fScale;
+fDescent= -rInfo.typoDescender * fScale;
+fExtLeading =  rInfo.typoLineGap   * fScale;
 }
 }
 
+mnAscent = round(fAscent);
+mnDescent = round(fDescent);
+mnExtLeading = round(fExtLeading);
+
 if (mnAscent || mnDescent)
 mnIntLeading = mnAscent + mnDescent - mnHeight;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-06-20 Thread Vasily Melenchuk
 vcl/source/gdi/pdfwriter_impl.cxx |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 581806182ac7da81115c9675b4e828688178aa04
Author: Vasily Melenchuk 
Date:   Thu May 25 13:44:52 2017 +0300

tdf#99680 modified clipping for PDF export

If clipping is requested, but no clipping region is defined,
clipping is ignored.

This squashes the following 3 commits:

Reviewed-on: https://gerrit.libreoffice.org/38021
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 

Reviewed-on: https://gerrit.libreoffice.org/38403
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

Reviewed-on: https://gerrit.libreoffice.org/38694
Tested-by: Jenkins 
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/38825
Tested-by: Thorsten Behrens 
(cherry picked from commit f6726209329fefe9decca8fda8e136b8472a95a2)

Conflicts:
vcl/qa/cppunit/pdfexport/pdfexport.cxx
no pdf unit tests on -5-3, so dropping those pieces

Change-Id: I793c1de1f4f6b0203727c0ff6aa8adecc43ad413
d4565858b0135b3177044558db87a68ef828955b
102722140e216cb9ad29107aae3bdaa70472d471
Reviewed-on: https://gerrit.libreoffice.org/38852
Tested-by: Jenkins 
Reviewed-by: Katarina Behrens 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 28fb58db826f..e0942f91a1ea 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -12378,12 +12378,13 @@ void PDFWriterImpl::updateGraphicsState(Mode const 
mode)
 getReferenceDevice()->SetMapMode( rNewState.m_aMapMode );
 m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode;
 
-aLine.append( "q " );
-if( rNewState.m_aClipRegion.count() )
+aLine.append("q ");
+if ( rNewState.m_aClipRegion.count() )
+{
 m_aPages.back().appendPolyPolygon( 
rNewState.m_aClipRegion, aLine );
-else
-aLine.append( "0 0 m h " ); // NULL clip, i.e. nothing 
visible
-aLine.append( "W* n\n" );
+aLine.append( "W* n\n" );
+}
+
 rNewState.m_aMapMode = aNewMapMode;
 getReferenceDevice()->SetMapMode( rNewState.m_aMapMode );
 m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-30 Thread Marco Cecchetti
 vcl/source/gdi/bitmap.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 83bd801268203a28a47bafd17307c13fbc41e983
Author: Marco Cecchetti 
Date:   Mon May 29 21:07:10 2017 +0200

tdf#107682 - Repeated images replace correct ones in exported PDF

The problem was due to the buffer acquire methods: in Bitmap::Checksum
(old implementation) Bitmap::AcquireReadAccess is used to get the bitmap
buffer: indeed this method relies on SalBitmap::AcquireBuffer (which is
used in the new implementation) but in case the buffer acquisition
fails, instead of giving up, it tries to update the imp bitmap instance
embedded in the bitmap (see BitmapInfoAccess::ImplCreate).

The solution is to perform this further attemp in Bitmap::Checksum when
the value returned by ImpBitmap::GetChecksum is 0.

Change-Id: Ib901ac941db57756e9a951bacbc573ca206316e0
Reviewed-on: https://gerrit.libreoffice.org/38168
Tested-by: Jenkins 
Reviewed-by: Marco Cecchetti 

diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index cf0bf70343e3..b5641b82857d 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -285,6 +285,21 @@ BitmapChecksum Bitmap::GetChecksum() const
 if( mxImpBmp )
 {
 nRet = mxImpBmp->ImplGetChecksum();
+
+if (!nRet)
+{
+// nRet == 0 => probably, we were not able to acquire
+// the buffer in SalBitmap::updateChecksum;
+// so, we need to update the imp bitmap for this bitmap instance
+// as we do in BitmapInfoAccess::ImplCreate
+std::shared_ptr xNewImpBmp(new ImpBitmap);
+if (xNewImpBmp->ImplCreate(*mxImpBmp, GetBitCount()))
+{
+Bitmap* pThis = const_cast(this);
+pThis->mxImpBmp = xNewImpBmp;
+nRet = mxImpBmp->ImplGetChecksum();
+}
+}
 }
 
 return nRet;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-29 Thread Caolán McNamara
 vcl/source/opengl/OpenGLContext.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c76aa66c60bde1fd009f097a0b974b65b295d1ab
Author: Caolán McNamara 
Date:   Fri May 26 12:41:10 2017 +0100

Resolves: tdf#108069 2nd OpenGLContext::init should dispose earlier results

Change-Id: If6bb9517a4081576347d71ddf26d020119d34247
(cherry picked from commit 0b9b36cafe29916a9fdeac420a49c174adb10c59)
Reviewed-on: https://gerrit.libreoffice.org/38065
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index 33d80095b15c..fc12d88617ff 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -240,7 +240,8 @@ bool OpenGLContext::init( vcl::Window* pParent )
 mpWindow = pParent ? pParent : m_xWindow.get();
 if(m_xWindow)
 m_xWindow->setPosSizePixel(0,0,0,0);
-m_pChildWindow = nullptr;
+//tdf#108069 we may be initted twice, so dispose earlier effort
+m_pChildWindow.disposeAndClear();
 initWindow();
 return ImplInit();
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-05-25 Thread Miklos Vajna
 vcl/source/gdi/pdfwriter_impl.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit f6a66846f50132fab7be6baf516ab6af04acf7e5
Author: Miklos Vajna 
Date:   Mon May 22 21:41:31 2017 +0200

tdf#107868 PDF export of editeng fill color: restrict to logic map modes

The original use case was Writer/Impress shape text, but when the map
mode is pixels, the reference device gives bogus values for the
PixelToLogic() calls, affecting e.g. form controls.

Just go back to the old way of not painting the background for those.

(cherry picked from commit 919a4ef592b6026a7533a93682f39118fef29ce8)

Conflicts:
vcl/qa/cppunit/pdfexport/pdfexport.cxx

Change-Id: I52f1901af15732274915fa3c77c06909b5164afb
Reviewed-on: https://gerrit.libreoffice.org/37977
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 9e592a71b977..28fb58db826f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9424,7 +9424,10 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, 
const OUString& rText, bool
 }
 }
 
-if (m_aCurrentPDFState.m_aFont.GetFillColor() != Color(COL_TRANSPARENT))
+// Avoid fill color when map mode is in pixels, the below code assumes
+// logic map mode.
+bool bPixel = m_aCurrentPDFState.m_aMapMode.GetMapUnit() == 
MapUnit::MapPixel;
+if (m_aCurrentPDFState.m_aFont.GetFillColor() != Color(COL_TRANSPARENT) && 
!bPixel)
 {
 // PDF doesn't have a text fill color, so draw a rectangle before
 // drawing the actual text.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-19 Thread Michael Meeks
 vcl/source/window/window.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 92edd724dd7f1ca85787480f046d48f9f27c51b8
Author: Michael Meeks 
Date:   Wed Apr 19 01:19:59 2017 +0100

vcl: protect Window from exceptions during construction.

Probable fix for:

http://crashreport.libreoffice.org/stats/crash_details/f69188bd-0fdd-4b74-9ec6-35b544cba0c9

Change-Id: I6442451785867f0fc2daf84776118b092d4d6a18
Reviewed-on: https://gerrit.libreoffice.org/36653
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit 6827da5052bfe975a3b34af8dfa8af75d41e904c)
Reviewed-on: https://gerrit.libreoffice.org/36674
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 50e7435eeb53..72c2a5d832e5 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -526,6 +526,7 @@ void Window::dispose()
 }
 
 delete mpWindowImpl->mpWinData;
+mpWindowImpl->mpWinData = nullptr;
 
 // remove BorderWindow or Frame window data
 mpWindowImpl->mpBorderWindow.disposeAndClear();
@@ -552,11 +553,16 @@ void Window::dispose()
 SAL_WARN("vcl", "Window " << this << " marked as frame window, 
"
  "is missing from list of " << nWindows << " frames");
 }
-mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
-pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
+if (mpWindowImpl->mpFrame) // otherwise exception during init
+{
+mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
+pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
+}
 assert (mpWindowImpl->mpFrameData->mnFocusId == nullptr);
 assert (mpWindowImpl->mpFrameData->mnMouseMoveId == nullptr);
+
 delete mpWindowImpl->mpFrameData;
+mpWindowImpl->mpFrameData = nullptr;
 }
 
 // should be the last statements
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-04-12 Thread Caolán McNamara
 vcl/source/window/dialog.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3e4e13300db6a0c2c60dbe733d96ff5a7b0d32e5
Author: Caolán McNamara 
Date:   Wed Apr 12 10:45:35 2017 +0100

infinite SetDefaultSize->SetPosSize->SetDefaultSize

https://retrace.fedoraproject.org/faf/reports/1278627/

presumably the 'optimal' starting size hits the invalid size path
causing another attempt usin the optimal size, so force a valid
initial fallback size

Change-Id: I6c38ee5e1b90ce41a4550c8a8370e791f5c351b0
(cherry picked from commit 4930acb18bbd145fd995084cd95e3e9d631424ed)
Reviewed-on: https://gerrit.libreoffice.org/36453
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index eef4c5ab5018..bff1f27a9613 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -662,7 +662,8 @@ Size bestmaxFrameSizeForScreenSize(const Size )
 else
 h -= 100;
 
-return Size(w, h);
+return Size(std::max(w, 640 - 15),
+std::max(h, 480 - 50));
 }
 
 void Dialog::StateChanged( StateChangedType nType )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-29 Thread Michael Meeks
 vcl/source/window/window.cxx |   25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

New commits:
commit 39a09641a1d2e1b50c831fe5ecf3dc0b0174a210
Author: Michael Meeks 
Date:   Tue Mar 28 10:35:50 2017 +0100

Attempted fix for mirrored geometry crasher.

Only plausible cause is pWindow->GetParent() being null, while
we have a pParent which has to be valid.


http://crashreport.libreoffice.org/stats/crash_details/6161398d-17b6-4a93-aa70-a559efa07868

Code was initially introduced in this form:
commit 4716735ba7d0ad133ff018481f94d6b4f201bbd9
Author: Stephan Schäfer 
Date:   Thu Sep 19 15:46:19 2002 +

#103362# improve positioning and resizing of system windows

No public report, sadly.  And modified by

commit fba46c6efd08d50fee92cc11546f3ed253a57af8
Author: Chris Sherlock 
Date:   Mon Feb 3 16:46:04 2014 +1100

fdo#74424 Use Window::GetOutDev() to access ImplReMirrored()

Part of the decoupling of Window from OutputDevice. We now get
he Window's OutputDevice instance and manipulate this. Do not rely
on the inherited function.

where the GetParent()/pWindow->GetParent() problem surfaces

Change-Id: Ia261028a4719525135e3fe4b00074427c1d9df6c
Reviewed-on: https://gerrit.libreoffice.org/35796
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit d93b8268da982ad26db9e03156ce9b89f3410486)
Reviewed-on: https://gerrit.libreoffice.org/35827
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index e483e2952b7c..50e7435eeb53 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2722,7 +2722,7 @@ void Window::setPosSizePixel( long nX, long nY,
 mpWindowImpl->mbDefSize = false;
 
 // The top BorderWindow is the window which is to be positioned
-vcl::Window* pWindow = this;
+VclPtr pWindow = this;
 while ( pWindow->mpWindowImpl->mpBorderWindow )
 pWindow = pWindow->mpWindowImpl->mpBorderWindow;
 
@@ -2739,7 +2739,8 @@ void Window::setPosSizePixel( long nX, long nY,
 nHeight = pWindow->mnOutHeight;
 
 sal_uInt16 nSysFlags=0;
-vcl::Window *pParent = GetParent();
+VclPtr pParent = GetParent();
+VclPtr pWinParent = pWindow->GetParent();
 
 if( nFlags & PosSizeFlags::Width )
 nSysFlags |= SAL_FRAME_POSSIZE_WIDTH;
@@ -2748,9 +2749,9 @@ void Window::setPosSizePixel( long nX, long nY,
 if( nFlags & PosSizeFlags::X )
 {
 nSysFlags |= SAL_FRAME_POSSIZE_X;
-if( pParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
+if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
 {
-nX += pParent->mnOutOffX;
+nX += pWinParent->mnOutOffX;
 }
 if( pParent && pParent->ImplIsAntiparallel() )
 {
@@ -2765,9 +2766,9 @@ void Window::setPosSizePixel( long nX, long nY,
 {
 // --- RTL ---  make sure the old right aligned position is not 
changed
 //  system windows will always grow to the right
-if ( pParent )
+if ( pWinParent )
 {
-OutputDevice *pParentOutDev = pParent->GetOutDev();
+OutputDevice *pParentOutDev = pWinParent->GetOutDev();
 if( pParentOutDev->HasMirroredGraphics() )
 {
 long myWidth = nOldWidth;
@@ -2777,13 +2778,13 @@ void Window::setPosSizePixel( long nX, long nY,
 myWidth = nWidth;
 nFlags |= PosSizeFlags::X;
 nSysFlags |= SAL_FRAME_POSSIZE_X;
-nX = 
pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - 
mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration +
-
pParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - 
mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX;
+nX = 
pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - 
mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration +
+
pWinParent->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 
- mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX;
 if(!(nFlags & PosSizeFlags::Y))
 {
 nFlags |= PosSizeFlags::Y;
 nSysFlags |= SAL_FRAME_POSSIZE_Y;
-nY = 

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

2017-03-19 Thread Mark Hung
 vcl/source/gdi/CommonSalLayout.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 465da7d95e17367e615ec5ef65f368d89c8d7f5d
Author: Mark Hung 
Date:   Fri Mar 17 20:00:03 2017 +0800

tdf#106295 fix vertical orientation for fullwidth colon and semicolon.

Chinese users would expect fullwidth colon (U+FF1A) and semi-colon (U+FF1B)
to be Tu( transformed upright ) instead of Tr ( Transformed rotated ) in
vertical writing mode. Make them exceptions of UTR50 when language is zh.

Change-Id: If7d01199973d73136a621bf2f32377da76ccb22a
Reviewed-on: https://gerrit.libreoffice.org/34980
Reviewed-by: Khaled Hosny 
Tested-by: Jenkins 
Reviewed-on: https://gerrit.libreoffice.org/35382

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index df2849828df7..4d8d65f9501c 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -330,8 +330,12 @@ namespace vcl {
 
 #include "VerticalOrientationData.cxx"
 
-VerticalOrientation GetVerticalOrientation(sal_UCS4 cCh)
+VerticalOrientation GetVerticalOrientation(sal_UCS4 cCh, const 
LanguageTag& rTag)
 {
+// Override fullwidth colon and semi-colon orientation. Tu is 
preferred.
+if ((cCh == 0xff1a || cCh == 0xff1b) && rTag.getLanguage() == "zh")
+return VerticalOrientation::TransformedUpright;
+
 uint8_t nRet = 1;
 
 if (cCh < 0x1)
@@ -524,7 +528,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 {
 sal_Int32 nPrevIdx = nIdx;
 sal_UCS4 aChar = rArgs.mrStr.iterateCodePoints();
-VerticalOrientation aVo = 
vcl::GetVerticalOrientation(aChar);
+VerticalOrientation aVo = 
vcl::GetVerticalOrientation(aChar, rArgs.maLanguageTag);
 
 sal_UCS4 aVariationSelector = 0;
 if (nIdx < nEndRunPos)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-17 Thread Khaled Hosny
 vcl/source/gdi/CommonSalLayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 68b546b17afa0082862f2a20b8f089ae9124a16a
Author: Khaled Hosny 
Date:   Fri Mar 10 16:53:08 2017 +0200

tdf#106466: Use graphite2 shaper first

We want to always prefer Graphite shaping when supported by the font,
which is also what HarfBuzz does by default.

Change-Id: I6670fc03b8e6b3d7e07e1b8e0062880524da1655
Reviewed-on: https://gerrit.libreoffice.org/35046
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 
(cherry picked from commit 3cee50476e422e3ed84169cdcbe6bd9883fc9316)
Reviewed-on: https://gerrit.libreoffice.org/35058
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 21be0c99bf01..a6ca683c15f5 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -579,7 +579,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 // preference. The coretext_aat shaper is available only on macOS,
 // but there is no harm in always including it, HarfBuzz will
 // ignore unavailable shapers.
-const char* pHbShapers[] = { "coretext_aat", "graphite2", "ot", 
"fallback", nullptr };
+const char* pHbShapers[] = { "graphite2", "coretext_aat", "ot", 
"fallback", nullptr };
 hb_segment_properties_t aHbProps;
 hb_buffer_get_segment_properties(pHbBuffer, );
 hb_shape_plan_t* pHbPlan = hb_shape_plan_create_cached(pHbFace, 
, maFeatures.data(), maFeatures.size(), pHbShapers);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-01 Thread Michael Meeks
 vcl/source/window/mouse.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e2eb25a52d86eec868ace658dd3a27eaf536b311
Author: Michael Meeks 
Date:   Wed Mar 1 15:13:19 2017 +

Tolerate mouse move generation on disposed windows.


http://crashreport.libreoffice.org/stats/crash_details/524d28fb-4fd2-4d11-83b1-1360b5ab5068

Change-Id: I19a13f751b5cf000c9938ff991d7d44bba0a4de7
Reviewed-on: https://gerrit.libreoffice.org/34756
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit a9be0b6a4e39240871a9b35ae9afd04f242a3ea4)
Reviewed-on: https://gerrit.libreoffice.org/34757
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index adea785..a2a214b 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -160,7 +160,8 @@ void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, bool 
bModChanged )
 
 void Window::ImplGenerateMouseMove()
 {
-if ( !mpWindowImpl->mpFrameData->mnMouseMoveId )
+if ( mpWindowImpl && mpWindowImpl->mpFrameData &&
+ !mpWindowImpl->mpFrameData->mnMouseMoveId )
 mpWindowImpl->mpFrameData->mnMouseMoveId = Application::PostUserEvent( 
LINK( mpWindowImpl->mpFrameWindow, Window, ImplGenerateMouseMoveHdl ), nullptr, 
true );
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-28 Thread Jan-Marek Glogowski
 vcl/source/window/status.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit b192cf7791aa7a218b0657715f4c4ad2adf5bb4d
Author: Jan-Marek Glogowski 
Date:   Wed Feb 22 17:08:25 2017 +0100

tdf#104482 Force updating progress bar on safe

I don't know why the progress bar on load is handled differently
then on safe. As a workaround, this converts all Flush() calls
to Update() calls, but we should update the UI on safe correctly.

Change-Id: I97d6fc5797d08e9556f7fa7f9f8110aef30b3772
(cherry picked from commit 0b08eacd79a2133a07410dfb99bcc04bb9dd2199)
Reviewed-on: https://gerrit.libreoffice.org/34551
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 5a48fbd..d2adcacf 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1163,7 +1163,7 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const 
OUString& rText )
 {
 Rectangle aRect = ImplGetItemRectPos(nPos);
 Invalidate(aRect);
-Flush();
+Update();
 }
 }
 }
@@ -1216,7 +1216,7 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* 
pNewData )
 {
 Rectangle aRect = ImplGetItemRectPos(nPos);
 Invalidate(aRect, InvalidateFlags::NoErase);
-Flush();
+Update();
 }
 }
 }
@@ -1246,7 +1246,7 @@ void StatusBar::RedrawItem(sal_uInt16 nItemId)
 {
 Rectangle aRect = ImplGetItemRectPos(nPos);
 Invalidate(aRect);
-Flush();
+Update();
 }
 }
 
@@ -1338,7 +1338,7 @@ void StatusBar::StartProgressMode( const OUString& rText )
 if ( IsReallyVisible() )
 {
 Invalidate();
-Flush();
+Update();
 }
 }
 
@@ -1353,7 +1353,7 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
 {
 bool bNeedErase = ImplGetSVData()->maNWFData.mbProgressNeedsErase;
 Invalidate(maPrgsFrameRect, bNeedErase ? InvalidateFlags::NONE : 
InvalidateFlags::NoErase);
-Flush();
+Update();
 }
 mnPercent = nNewPercent;
 }
@@ -1368,7 +1368,7 @@ void StatusBar::EndProgressMode()
 if ( IsReallyVisible() )
 {
 Invalidate();
-Flush();
+Update();
 }
 }
 
@@ -1385,7 +1385,7 @@ void StatusBar::SetText(const OUString& rText)
 {
 Invalidate();
 Window::SetText(rText);
-Flush();
+Update();
 }
 }
 else if (mbProgressMode)
@@ -1394,7 +1394,7 @@ void StatusBar::SetText(const OUString& rText)
 if (IsReallyVisible())
 {
 Invalidate();
-Flush();
+Update();
 }
 }
 else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-16 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |   49 
 1 file changed, 30 insertions(+), 19 deletions(-)

New commits:
commit d301dc1b2bdcc345fd8d91c0a973b1960a7e1d55
Author: Caolán McNamara 
Date:   Thu Feb 9 09:21:39 2017 +

Resolves: ofz#576 unexpected exception with invalid fraction

(cherry picked from commit cff6cdb2ee37e836b9bab39500d24fcedc360121)

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 73c62b0..de1cf5a 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -129,19 +129,26 @@ void ImplWriteColor( SvStream& rOStm, const Color& rColor 
)
 rOStm.WriteInt16( nVal );
 }
 
-void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode )
+bool ImplReadMapMode(SvStream& rIStm, MapMode& rMapMode)
 {
-Point   aOrg;
-sal_Int32   nXNum;
-sal_Int32   nXDenom;
-sal_Int32   nYNum;
-sal_Int32   nYDenom;
-sal_Int16   nUnit;
-
-rIStm.ReadInt16( nUnit );
-ReadPair( rIStm, aOrg );
-rIStm.ReadInt32( nXNum ).ReadInt32( nXDenom ).ReadInt32( nYNum 
).ReadInt32( nYDenom );
+sal_Int16 nUnit(0);
+rIStm.ReadInt16(nUnit);
+
+Point aOrg;
+ReadPair(rIStm, aOrg);
+
+sal_Int32 nXNum(0), nXDenom(0), nYNum(0), nYDenom(0);
+
rIStm.ReadInt32(nXNum).ReadInt32(nXDenom).ReadInt32(nYNum).ReadInt32(nYDenom);
+
+if (!rIStm.good() || nXDenom == 0 || nYDenom == 0)
+{
+SAL_WARN("vcl.gdi", "Parsing error: invalid mapmode fraction");
+return false;
+}
+
 rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), 
Fraction( nYNum, nYDenom ) );
+
+return true;
 }
 
 void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
@@ -506,7 +513,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 boolbFatLine = false;
 
 // TODO: fix reindentation below if you can accept being blamed by the SCM
-MapMode aMapMode;
 tools::Polygon aActionPoly;
 Rectangle   aRect;
 Point   aPt, aPt1;
@@ -516,7 +522,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 sal_uInt32  nUnicodeCommentStreamPos = 0;
 sal_Int32   nUnicodeCommentActionNumber = 0;
 
-ImplReadMapMode( rIStm, aMapMode ); // MapMode
+rMtf.SetPrefSize( aPrefSz );
+
+MapMode aMapMode;
+if (ImplReadMapMode(rIStm, aMapMode))   // MapMode
+rMtf.SetPrefMapMode(aMapMode);
+
 sal_Int32 nActions(0);
 rIStm.ReadInt32( nActions );// Action count
 if (nActions < 0)
@@ -533,8 +544,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 nActions = nMaxPossibleActions;
 }
 
-rMtf.SetPrefSize( aPrefSz );
-rMtf.SetPrefMapMode( aMapMode );
 size_t nLastPolygonAction(0);
 
 for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
@@ -1060,11 +1069,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& 
rIStm, GDIMetaFile& rMtf )
 
 case GDI_MAPMODE_ACTION:
 {
-ImplReadMapMode( rIStm, aMapMode );
-rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
+if (ImplReadMapMode(rIStm, aMapMode))
+{
+rMtf.AddAction(new MetaMapModeAction(aMapMode));
 
-// #106172# Track font relevant data in shadow VDev
-aFontVDev->SetMapMode( aMapMode );
+// #106172# Track font relevant data in shadow VDev
+aFontVDev->SetMapMode(aMapMode);
+}
 }
 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-3' - vcl/source

2017-02-15 Thread Michael Meeks
 vcl/source/window/toolbox2.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b57bfba7c1f331e13ca995c493c2973d67aa5021
Author: Michael Meeks 
Date:   Wed Feb 15 11:01:41 2017 +

Simple work-around for unpleasant framework shutdown to avoid crash.


http://crashreport.libreoffice.org/stats/crash_details/2de31c06-da20-4280-916a-e282a337b16b

Change-Id: I0b599de9b36f62d65988c1ab698f1559134fbf7c
Reviewed-on: https://gerrit.libreoffice.org/34294
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit 2c60e02bbfde8655828a5b019642f5e85f975e61)
Reviewed-on: https://gerrit.libreoffice.org/34297
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 37f809c..6345910 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -635,7 +635,8 @@ ToolBoxButtonSize ToolBox::GetToolboxButtonSize() const
 
 /*static*/ Size ToolBox::GetDefaultImageSize(ToolBoxButtonSize 
eToolBoxButtonSize)
 {
-float fScaleFactor = Application::GetDefaultDevice()->GetDPIScaleFactor();
+OutputDevice *pDefault = Application::GetDefaultDevice();
+float fScaleFactor = pDefault ? pDefault->GetDPIScaleFactor() : 1.0;
 
 Size aUnscaledSize = Size(16, 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-3' - vcl/source

2017-02-13 Thread Caolán McNamara
 vcl/source/window/menu.cxx   |2 +-
 vcl/source/window/syswin.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1cd4913603d112b47106939de350aaca3143d37a
Author: Caolán McNamara 
Date:   Thu Feb 9 10:26:05 2017 +

Resolves: tdf#101972 skip invalidating labels on alt if autoaccel is 
disabled

so no Invalidate will be called if auto accelerators are not enabled
so there should be no blinking under windows

Change-Id: Iccc5dad7af41f39ac02d3be93e935f2d926a82a6
(cherry picked from commit f67dc04cfdd9e63a45ec6c8bc00829bce8f17d4b)
Reviewed-on: https://gerrit.libreoffice.org/34076
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 934fdb0..e88914c 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2556,7 +2556,7 @@ bool MenuBar::ImplHandleCmdEvent( const CommandEvent& 
rCEvent )
 MenuBarWindow* pWin = static_cast(ImplGetWindow());
 if ( pWin && pWin->IsEnabled() && pWin->IsInputEnabled()  && ! 
pWin->IsInModalMode() )
 {
-if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+if (rCEvent.GetCommand() == CommandEventId::ModKeyChange && 
ImplGetSVData()->maNWFData.mbAutoAccel)
 {
 const CommandModKeyData* pCData = rCEvent.GetModKeyData ();
 if (pWin->nHighlightedItem == ITEMPOS_INVALID)
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index e7e6683..f31dff2 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -164,7 +164,7 @@ namespace
 
 bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, 
vcl::Window *pWindow)
 {
-if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+if (rCEvent.GetCommand() == CommandEventId::ModKeyChange && 
ImplGetSVData()->maNWFData.mbAutoAccel)
 {
 const CommandModKeyData *pCData = rCEvent.GetModKeyData();
 const bool bShowAccel = pCData && pCData->IsMod2();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-09 Thread Caolán McNamara
 vcl/source/gdi/pngread.cxx |   21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

New commits:
commit b3caa0eb0d85718aab4c3b37d73755f930433eed
Author: Caolán McNamara 
Date:   Wed Feb 8 13:33:02 2017 +

ofz#574 sanitize png palette indexes

clarify we're not setting a pal index in the mask

no logic changed intended, SetPixelIndex expands
to this, just want to clarify that this is an alpha
value, not an index into a palette

(cherry picked from commit e5b23d924d60e7a0fb67c44c6dad3f4cb3bd5ddc)

Change-Id: I006ffdf5c8c751e7e07b133716022e2a9b154478
e9bb188b116adf3eab4e2bb1d6da8badbaead88b
Reviewed-on: https://gerrit.libreoffice.org/34035
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index c26a841..09aae89 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -1124,6 +1124,19 @@ void PNGReaderImpl::ImplApplyFilter()
 
 namespace
 {
+sal_uInt8 SanitizePaletteIndex(sal_uInt8 nIndex, sal_uInt16 
nPaletteEntryCount)
+{
+if (nIndex >= nPaletteEntryCount)
+{
+auto nSanitizedIndex = nIndex % nPaletteEntryCount;
+SAL_WARN_IF(nIndex != nSanitizedIndex, "vcl", "invalid colormap 
index: "
+<< static_cast(nIndex) << ", colormap 
len is: "
+<< nPaletteEntryCount);
+nIndex = nSanitizedIndex;
+}
+return nIndex;
+}
+
 void SanitizePaletteIndexes(sal_uInt8* pEntries, int nLen, 
BitmapWriteAccess* pAcc)
 {
 sal_uInt16 nPaletteEntryCount = pAcc->GetPaletteEntryCount();
@@ -1612,7 +1625,7 @@ void PNGReaderImpl::ImplSetPixel( sal_uInt32 nY, 
sal_uInt32 nX, sal_uInt8 nPalIn
 return;
 nX >>= mnPreviewShift;
 
-mpAcc->SetPixelIndex( nY, nX, nPalIndex );
+mpAcc->SetPixelIndex(nY, nX, SanitizePaletteIndex(nPalIndex, 
mpAcc->GetPaletteEntryCount()));
 }
 
 void PNGReaderImpl::ImplSetTranspPixel( sal_uInt32 nY, sal_uInt32 nX, const 
BitmapColor& rBitmapColor, bool bTrans )
@@ -1638,8 +1651,8 @@ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, 
sal_uInt32 nX,
 return;
 nX >>= mnPreviewShift;
 
-mpAcc->SetPixelIndex( nY, nX, nPalIndex );
-mpMaskAcc->SetPixelIndex( nY, nX, ~nAlpha );
+mpAcc->SetPixelIndex(nY, nX, SanitizePaletteIndex(nPalIndex, 
mpAcc->GetPaletteEntryCount()));
+mpMaskAcc->SetPixel(nY, nX, BitmapColor(~nAlpha));
 }
 
 void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, sal_uInt32 nX,
@@ -1653,7 +1666,7 @@ void PNGReaderImpl::ImplSetAlphaPixel( sal_uInt32 nY, 
sal_uInt32 nX,
 mpAcc->SetPixel( nY, nX, rBitmapColor );
 if (!mpMaskAcc)
 return;
-mpMaskAcc->SetPixelIndex( nY, nX, ~nAlpha );
+mpMaskAcc->SetPixel(nY, nX, BitmapColor(~nAlpha));
 }
 
 sal_uInt32 PNGReaderImpl::ImplReadsal_uInt32()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-01 Thread Miklos Vajna
 vcl/source/gdi/pdfwriter_impl.cxx |   23 +++
 1 file changed, 23 insertions(+)

New commits:
commit 27d641761cff82ed34987ac1f70b838f1028bc6e
Author: Miklos Vajna 
Date:   Wed Feb 1 10:52:19 2017 +0100

tdf#105461 PDF export: handle text fill color

Text portion level background in Writer text was working already, as
Writer paints its background explicitly, and then uses no text fill
color in the metafile (that is turned into a PDF later).

However, text fill color is used for Writer shape text and also in
Impress. The rectangle is not just the text itself, but also the ascent
/ descent region, this matches the desktop rendering result.

(cherry picked from commit ee32c7d8083ae1449d6b379034be92995c142da9)

Change-Id: I644007ade43a8b9e663890643b826ae12c427ea5
Reviewed-on: https://gerrit.libreoffice.org/33794
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 1697cfd..9e592a7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9424,6 +9424,29 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, 
const OUString& rText, bool
 }
 }
 
+if (m_aCurrentPDFState.m_aFont.GetFillColor() != Color(COL_TRANSPARENT))
+{
+// PDF doesn't have a text fill color, so draw a rectangle before
+// drawing the actual text.
+push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+setFillColor(m_aCurrentPDFState.m_aFont.GetFillColor());
+// Avoid border around the rectangle for Writer shape text.
+setLineColor(Color(COL_TRANSPARENT));
+
+// The rectangle is the bounding box of the text, but also includes
+// ascent / descent to match the on-screen rendering.
+Rectangle aRectangle;
+// This is the top left of the text without ascent / descent.
+
aRectangle.SetPos(m_pReferenceDevice->PixelToLogic(rLayout.GetDrawPosition()));
+aRectangle.setY(aRectangle.getY() - aRefDevFontMetric.GetAscent());
+
aRectangle.SetSize(m_pReferenceDevice->PixelToLogic(Size(rLayout.GetTextWidth(),
 0)));
+// This includes ascent / descent.
+aRectangle.setHeight(aRefDevFontMetric.GetLineHeight());
+drawRectangle(aRectangle);
+
+pop();
+}
+
 Point aAlignOffset;
 if ( eAlign == ALIGN_BOTTOM )
 aAlignOffset.Y() -= aRefDevFontMetric.GetDescent();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-02-01 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fe2260df51f543292bd5db54aab7db5d76a3fbbe
Author: Caolán McNamara 
Date:   Tue Jan 31 09:23:09 2017 +

ofz#502 negative index

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index f504f63..73c62b0 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -941,7 +941,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 // #106172# Add last DX array elem, if missing
 if( nAryLen != nStrLen )
 {
-if( nAryLen+1 == nStrLen )
+if (nAryLen+1 == nStrLen && nIndex >= 0)
 {
 std::unique_ptr pTmpAry(new 
long[nStrLen]);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-26 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 6198071ef3b9b30cb2b686f0a60f217f00bbef4b
Author: Caolán McNamara 
Date:   Thu Jan 26 14:40:57 2017 +

only alloc pDXAry if we are going to use it

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 633171c..f504f63 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -921,7 +921,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 sal_Int32 nStrLen( aStr.getLength() );
 
 nDXAryLen = std::max(nAryLen, nStrLen);
-pDXAry.reset(new long[nDXAryLen]);
 
 if (nDXAryLen < nLen)
 {
@@ -934,6 +933,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 }
 else
 {
+pDXAry.reset(new long[nDXAryLen]);
+
 for (sal_Int32 j = 0; j < nAryLen; ++j)
 rIStm.ReadInt32( nTmp ), pDXAry[ j ] = 
nTmp;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-26 Thread Michael Stahl
 vcl/source/gdi/svmconverter.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 7f5a10a3aaf8b48156aeab168afb7648dae1e020
Author: Michael Stahl 
Date:   Thu Jan 26 14:01:16 2017 +0100

ofz#424 vcl: reset nLen too

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 89e6c5b..633171c 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -929,6 +929,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 //be achieved, don't read it, it's utterly 
broken.
 SAL_WARN("vcl.gdi", "dxary too short, 
discarding completely");
 rIStm.SeekRel(sizeof(sal_Int32) * nDXAryLen);
+nLen = 0;
+nIndex = 0;
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-26 Thread Caolán McNamara
 vcl/source/filter/wmf/emfwr.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit c9f5d8e189fec339d6c3d1a476fc42ef078bf273
Author: Caolán McNamara 
Date:   Wed Jan 25 16:51:00 2017 +

Resolves: tdf#94457 our EmfPlusSetPageTransform is malformed

we write a single short, resulting in a record of 0x000C in length 
MS-EMFPLUS
spec has EmfPlusSetPageTransform as 0x0010 in length because we're not 
writing
the 4 byte PageScale value.

the previous pageunit unit we are writing is of value 1, which is
UnitTypeDisplay, the same spec says...

"The unit of measure for page space coordinates, from the UnitType 
enumeration.
This value SHOULD NOT be UnitTypeDisplay or UnitTypeWorld"

and footnotes that with...

"Windows never writes those values to the PageUnit field, but they are 
accepted
with undefined results."

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

diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index dda3d56..6bcd461 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -102,8 +102,7 @@ enum class EmfPlusRecordType
 SetAntiAliasMode   = 0x401E,
 SetInterpolationMode   = 0x4021,
 SetPixelOffsetMode = 0x4022,
-SetCompositingQuality  = 0x4024,
-SetPageTransform   = 0x4030,
+SetCompositingQuality  = 0x4024
 };
 
 void EMFWriter::ImplBeginCommentRecord( sal_Int32 nCommentType )
@@ -190,7 +189,6 @@ void EMFWriter::WriteEMFPlusHeader( const Size 
, const Size 
 ImplPlusRecord( EmfPlusRecordType::SetPixelOffsetMode, 0x0 );
 ImplPlusRecord( EmfPlusRecordType::SetAntiAliasMode, 0x09 );  // TODO: 
Check actual values for AntiAlias
 ImplPlusRecord( EmfPlusRecordType::SetCompositingQuality, 0x0100 ); // 
Default Quality
-ImplPlusRecord( EmfPlusRecordType::SetPageTransform, 1 );
 ImplPlusRecord( EmfPlusRecordType::SetInterpolationMode, 0x00 );  // 
Default
 ImplPlusRecord( EmfPlusRecordType::GetDC, 0x00 );
 ImplEndCommentRecord();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-26 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5891a45fa08729ba01f78bece9312b2c01d3a214
Author: Caolán McNamara 
Date:   Wed Jan 25 09:10:37 2017 +

fix guard

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index d9aae46..89e6c5b 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -923,7 +923,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 nDXAryLen = std::max(nAryLen, nStrLen);
 pDXAry.reset(new long[nDXAryLen]);
 
-if (nDXAryLen <= nLen)
+if (nDXAryLen < nLen)
 {
 //MetaTextArrayAction ctor expects pDXAry to 
be >= nLen if set, so if this can't
 //be achieved, don't read it, it's utterly 
broken.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-25 Thread Caolán McNamara
 vcl/source/gdi/metaact.cxx  |2 +-
 vcl/source/gdi/svmconverter.cxx |9 +
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6ed838bfd59ae4db7822daf60ef12cb023799a75
Author: Caolán McNamara 
Date:   Wed Jan 25 09:21:25 2017 +

ofz#463 unable to mmap

Reviewed-on: https://gerrit.libreoffice.org/33519
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit f6c465bc8e7583a8321f5c881cb008b980e0e3fa)

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

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 047a207..b8169cd 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1114,7 +1114,7 @@ MetaTextArrayAction::MetaTextArrayAction( const Point& 
rStartPt,
 {
 const sal_Int32 nAryLen = pDXAry ? mnLen : 0;
 
-if( nAryLen )
+if (nAryLen > 0)
 {
 mpDXAry = new long[ nAryLen ];
 memcpy( mpDXAry, pDXAry, nAryLen * sizeof(long) );
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 616e5e7..d9aae46 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -909,6 +909,15 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 sal_Int32 nDXAryLen = 0;
 if (nAryLen > 0)
 {
+const size_t nMinRecordSize = sizeof(sal_Int32);
+const size_t nMaxRecords = rIStm.remainingSize() / 
nMinRecordSize;
+if (static_cast(nAryLen) > nMaxRecords)
+{
+SAL_WARN("vcl.gdi", "Parsing error: " << 
nMaxRecords <<
+ " max possible entries, but " << 
nAryLen << " claimed, truncating");
+nAryLen = nMaxRecords;
+}
+
 sal_Int32 nStrLen( aStr.getLength() );
 
 nDXAryLen = std::max(nAryLen, nStrLen);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-25 Thread Caolán McNamara
 vcl/source/filter/wmf/winmtf.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 033b47dd2ace4d43bf0be1a6983717adf044b0c2
Author: Caolán McNamara 
Date:   Sat Jan 21 17:13:47 2017 +

ofz#439 protect against 0 len text

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

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 36aae28..6bc8b7d 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -1457,9 +1457,9 @@ void WinMtfOutput::DrawText( Point& rPosition, OUString& 
rText, long* pDXArry, b
 sal_Int32 nTextWidth;
 pVDev->SetMapMode( MapMode( MapUnit::Map100thMM ) );
 pVDev->SetFont( maFont );
-if( pDXArry )
+const sal_uInt32 nLen = pDXArry ? rText.getLength() : 0;
+if (nLen)
 {
-sal_uInt32 nLen = rText.getLength();
 nTextWidth = pVDev->GetTextWidth( OUString(rText[ nLen - 1 ]) );
 if( nLen > 1 )
 nTextWidth += pDXArry[ nLen - 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-3' - vcl/source

2017-01-24 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |   62 +++-
 1 file changed, 37 insertions(+), 25 deletions(-)

New commits:
commit 336764ad6b8f4d88ac579684c905c88c8c630bcd
Author: Caolán McNamara 
Date:   Thu Jan 19 16:56:34 2017 +

Resolves: ofz#424 guard against broken dxary length

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 7bafa7e..616e5e7 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -906,40 +906,52 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 OUString aStr(OStringToOUString(aByteStr, 
eActualCharSet));
 
 std::unique_ptr pDXAry;
+sal_Int32 nDXAryLen = 0;
 if (nAryLen > 0)
 {
 sal_Int32 nStrLen( aStr.getLength() );
 
-pDXAry.reset(new long[ std::max( nAryLen, nStrLen 
) ]);
+nDXAryLen = std::max(nAryLen, nStrLen);
+pDXAry.reset(new long[nDXAryLen]);
 
-for (sal_Int32 j = 0; j < nAryLen; ++j)
-rIStm.ReadInt32( nTmp ), pDXAry[ j ] = nTmp;
-
-// #106172# Add last DX array elem, if missing
-if( nAryLen != nStrLen )
+if (nDXAryLen <= nLen)
+{
+//MetaTextArrayAction ctor expects pDXAry to 
be >= nLen if set, so if this can't
+//be achieved, don't read it, it's utterly 
broken.
+SAL_WARN("vcl.gdi", "dxary too short, 
discarding completely");
+rIStm.SeekRel(sizeof(sal_Int32) * nDXAryLen);
+}
+else
 {
-if( nAryLen+1 == nStrLen )
+for (sal_Int32 j = 0; j < nAryLen; ++j)
+rIStm.ReadInt32( nTmp ), pDXAry[ j ] = 
nTmp;
+
+// #106172# Add last DX array elem, if missing
+if( nAryLen != nStrLen )
 {
-std::unique_ptr pTmpAry(new 
long[nStrLen]);
-
-aFontVDev->GetTextArray( aStr, 
pTmpAry.get(), nIndex, nLen );
-
-// now, the difference between the
-// last and the second last DX array
-// is the advancement for the last
-// glyph. Thus, to complete our meta
-// action's DX array, just add that
-// difference to last elem and store
-// in very last.
-if( nStrLen > 1 )
-pDXAry[ nStrLen-1 ] = pDXAry[ 
nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
+if( nAryLen+1 == nStrLen )
+{
+std::unique_ptr pTmpAry(new 
long[nStrLen]);
+
+aFontVDev->GetTextArray( aStr, 
pTmpAry.get(), nIndex, nLen );
+
+// now, the difference between the
+// last and the second last DX array
+// is the advancement for the last
+// glyph. Thus, to complete our meta
+// action's DX array, just add that
+// difference to last elem and store
+// in very last.
+if( nStrLen > 1 )
+pDXAry[ nStrLen-1 ] = pDXAry[ 
nStrLen-2 ] + pTmpAry[ nStrLen-1 ] - pTmpAry[ nStrLen-2 ];
+else
+pDXAry[ nStrLen-1 ] = pTmpAry[ 
nStrLen-1 ]; // len=1: 0th position taken to be 0
+}
+#ifdef DBG_UTIL
 else
-pDXAry[ nStrLen-1 ] = pTmpAry[ 
nStrLen-1 ]; // len=1: 0th position taken to be 0
+OSL_FAIL("More than one DX array 
element 

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

2017-01-18 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit f365db4e64d4bfcab561936787759348bcd50a7a
Author: Caolán McNamara 
Date:   Wed Jan 18 09:03:23 2017 +

ofz#419 same problem as wmf and emf

this is the *third* effective copy of this, see

the other two uses of LF_FACESIZE in wmf parsing

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index cab6c05..7bafa7e 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -464,6 +464,8 @@ SVMConverter::SVMConverter( SvStream& rStm, GDIMetaFile& 
rMtf, sal_uLong nConver
 }
 }
 
+#define LF_FACESIZE 32
+
 void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
 {
 const sal_uLong nPos = rIStm.Tell();
@@ -823,7 +825,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 case GDI_FONT_ACTION:
 {
 vcl::Font   aFont;
-charaName[ 32 ];
+charaName[LF_FACESIZE+1];
 sal_Int32   nWidth, nHeight;
 sal_Int16   nCharSet, nFamily, nPitch, nAlign, nWeight, 
nUnderline, nStrikeout;
 sal_Int16   nCharOrient, nLineOrient;
@@ -831,7 +833,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 ImplReadColor( rIStm, aActionColor ); aFont.SetColor( 
aActionColor );
 ImplReadColor( rIStm, aActionColor ); aFont.SetFillColor( 
aActionColor );
-rIStm.ReadBytes( aName, 32 );
+size_t nRet = rIStm.ReadBytes(aName, LF_FACESIZE);
+aName[nRet] = 0;
 aFont.SetFamilyName( OUString( aName, strlen(aName), 
rIStm.GetStreamCharSet() ) );
 rIStm.ReadInt32( nWidth ).ReadInt32( nHeight );
 rIStm.ReadInt16( nCharOrient ).ReadInt16( nLineOrient );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-18 Thread Caolán McNamara
 vcl/source/gdi/svmconverter.cxx |   35 +--
 1 file changed, 25 insertions(+), 10 deletions(-)

New commits:
commit e0f262b998074eb493a56ff372c35b817e856b17
Author: Caolán McNamara 
Date:   Wed Jan 18 09:43:17 2017 +

ofz: reduce scope, check stream, validate nActions

(cherry picked from commit bd78b28a1233e26c023a52df6b119d60a61d53ad)

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

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 0ed8e5f..cab6c05 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -473,12 +473,12 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 charaCode[ 5 ];
 SizeaPrefSz;
-sal_Int16   nSize;
-sal_Int16   nVersion;
 
 // read header
 rIStm.ReadBytes(aCode, sizeof(aCode));  // Identifier
+sal_Int16 nSize(0);
 rIStm.ReadInt16( nSize ); // Size
+sal_Int16 nVersion(0);
 rIStm.ReadInt16( nVersion );  // Version
 sal_Int32 nTmp32(0);
 rIStm.ReadInt32( nTmp32 );
@@ -510,24 +510,37 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 Point   aPt, aPt1;
 SizeaSz;
 Color   aActionColor;
-sal_Int32   nTmp, nTmp1, nActionSize;
-sal_Int32   nActions;
-sal_Int16   nType;
 
 sal_uInt32  nUnicodeCommentStreamPos = 0;
 sal_Int32   nUnicodeCommentActionNumber = 0;
 
 ImplReadMapMode( rIStm, aMapMode ); // MapMode
-rIStm.ReadInt32( nActions );  // Action 
count
+sal_Int32 nActions(0);
+rIStm.ReadInt32( nActions );// Action count
+if (nActions < 0)
+{
+SAL_WARN("vcl.gdi", "svm claims negative action count (" << 
nActions << ")");
+nActions = 0;
+}
+
+const size_t nMinActionSize = sizeof(sal_uInt16) + sizeof(sal_Int32);
+const size_t nMaxPossibleActions = rIStm.remainingSize() / 
nMinActionSize;
+if (static_cast(nActions) > nMaxPossibleActions)
+{
+SAL_WARN("vcl.gdi", "svm claims more actions (" << nActions << ") 
than stream could provide, truncating");
+nActions = nMaxPossibleActions;
+}
 
 rMtf.SetPrefSize( aPrefSz );
 rMtf.SetPrefMapMode( aMapMode );
 size_t nLastPolygonAction(0);
 
-for (sal_Int32 i = 0; i < nActions; ++i)
+for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
 {
+sal_Int16 nType(0);
 rIStm.ReadInt16( nType );
 sal_Int32 nActBegin = rIStm.Tell();
+sal_Int32 nActionSize(0);
 rIStm.ReadInt32( nActionSize );
 
 SAL_WARN_IF( ( nType > 33 ) && ( nType < 1024 ), "vcl", "Unknown 
GDIMetaAction while converting!" );
@@ -664,6 +677,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 case GDI_RECT_ACTION:
 {
 ImplReadRect( rIStm, aRect );
+sal_Int32 nTmp(0), nTmp1(0);
 rIStm.ReadInt32( nTmp ).ReadInt32( nTmp1 );
 
 if( nTmp || nTmp1 )
@@ -855,7 +869,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case GDI_TEXT_ACTION:
 {
-sal_Int32   nIndex, nLen;
+sal_Int32 nIndex(0), nLen(0), nTmp(0);
 
 ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen 
).ReadInt32( nTmp );
 if (nTmp > 0)
@@ -876,7 +890,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case GDI_TEXTARRAY_ACTION:
 {
-sal_Int32   nIndex, nLen, nAryLen;
+sal_Int32 nIndex(0), nLen(0), nAryLen(0), nTmp(0);
 
 ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen 
).ReadInt32( nTmp ).ReadInt32( nAryLen );
 if (nTmp > 0)
@@ -935,7 +949,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case GDI_STRETCHTEXT_ACTION:
 {
-sal_Int32   nIndex, nLen, nWidth;
+sal_Int32 nIndex(0), nLen(0), nWidth(0), nTmp(0);
 
 ReadPair( rIStm, aPt ).ReadInt32( nIndex ).ReadInt32( nLen 
).ReadInt32( nTmp ).ReadInt32( nWidth );
 if (nTmp > 0)
@@ -1088,6 +1102,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 case 

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

2017-01-17 Thread Caolán McNamara
 vcl/source/filter/ixpm/xpmread.cxx |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit caa24065bc0436cde5aa5bd5de4f76c65b1933f0
Author: Caolán McNamara 
Date:   Tue Jan 17 12:35:24 2017 +

ofz#411: XPMReader::ImplGetColKey short read

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

diff --git a/vcl/source/filter/ixpm/xpmread.cxx 
b/vcl/source/filter/ixpm/xpmread.cxx
index 3d22258..61c 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -66,7 +66,7 @@ private:
 sal_uLong   mnWidth;
 sal_uLong   mnHeight;
 sal_uLong   mnColors;
-sal_uLong   mnCpp;  // characters 
per pix
+sal_uInt32  mnCpp;  // characters 
per pix
 boolmbTransparent;
 boolmbStatus;
 sal_uLong   mnStatus;
@@ -305,9 +305,12 @@ bool XPMReader::ImplGetColor( sal_uLong nNumb )
 sal_uInt8*  pPtr =  ( mpColMap + nNumb * ( 4 + mnCpp ) );
 boolbStatus = ImplGetString();
 
-if ( bStatus )
+if (bStatus && mnStringSize < mnCpp)
+bStatus = false;
+
+if (bStatus)
 {
-for ( sal_uLong i = 0; i < mnCpp; i++ )
+for (sal_uInt32 i = 0; i < mnCpp; ++i)
 *pPtr++ = *pString++;
 bStatus = ImplGetColSub ( pPtr );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-14 Thread Noel Grandin
 vcl/source/window/dialog.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0c1cd678f71e519f5a4e623d93442e046485005a
Author: Noel Grandin 
Date:   Fri Jan 13 15:18:15 2017 +0200

tdf#105017 Crash when click a "New Theme..." in Gallery on detached SideBar

Change-Id: I6a3c44a0a08cf036776976d40c985889698c08ac
Reviewed-on: https://gerrit.libreoffice.org/33041
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 
(cherry picked from commit a076a062ceb02bd34a460819db61dcbfbca5c8d7)
Reviewed-on: https://gerrit.libreoffice.org/33056
Tested-by: Noel Grandin 

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index eef4c5a..c6fcae3 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1039,7 +1039,7 @@ void Dialog::SetModalInputMode( bool bModal )
 // Disable the prev Modal Dialog, because our dialog must close at 
first,
 // before the other dialog can be closed (because the other dialog
 // is on stack since our dialog returns)
-if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->IsWindowOrChild( this, 
true ) )
+if ( mpPrevExecuteDlg && !mpPrevExecuteDlg->isDisposed() && 
!mpPrevExecuteDlg->IsWindowOrChild( this, true ) )
 mpPrevExecuteDlg->EnableInput( false, this );
 
 // determine next overlap dialog parent
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-13 Thread Caolán McNamara
 vcl/source/filter/ixpm/xpmread.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 10a7f48aa83aaf78ccd09d3cab1a961aa1e8219e
Author: Caolán McNamara 
Date:   Fri Jan 13 11:41:55 2017 +

ofz: ensure all not explicitly set indexes are zero

Change-Id: Idbe6ceeb61d3dfe26f281349181e7a60f7e59000
(cherry picked from commit 14d9b3519adac8543b52ddb84e49eecbdd1d9eb2)
Reviewed-on: https://gerrit.libreoffice.org/33035
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/filter/ixpm/xpmread.cxx 
b/vcl/source/filter/ixpm/xpmread.cxx
index bdeacf9..3d22258 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -223,7 +223,9 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
 // using 2 charakters per pixel and less than 257 
Colors we speed up
 if ( mnCpp == 2 )   // by using a 64kb indexing 
table
 {
-mpFastColorTable = new sal_uInt8[ 256 * 256 ];
+const size_t nSize = 256 * 256;
+mpFastColorTable = new sal_uInt8[nSize];
+memset(mpFastColorTable, 0, nSize);
 for ( pPtr = mpColMap, i = 0; i < mnColors; 
i++, pPtr += mnCpp + 4 )
 {
 sal_uLong   j =  pPtr[ 0 ] << 8;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-12 Thread Michael Meeks
 vcl/source/window/window2.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 16867471ffdb4742c18d6a04ceacd66e8f33dfa6
Author: Michael Meeks 
Date:   Fri Jan 6 15:23:30 2017 +

tdf#105151 - be more conservative about EndTracking / Tracking calls.

We really shouldn't be emitting these into widgets after they are
disposed - it serves only to confuse things. Restore behaviour to how
it was before the VclPtr change for this.

Change-Id: Ife666929f8aac0e4431a5e43970769692c11888c
Reviewed-on: https://gerrit.libreoffice.org/32785
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit d788d37a16d382d7ff32a19e8d65e5c605ac55dd)
Reviewed-on: https://gerrit.libreoffice.org/32789
Reviewed-by: Eike Rathke 

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 9e42f3c..24d1fa7 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -365,7 +365,11 @@ void Window::EndTracking( TrackingEventFlags nFlags )
mpWindowImpl->mpFrameData->mnMouseCode,
mpWindowImpl->mpFrameData->mnMouseCode );
 TrackingEvent   aTEvt( aMEvt, nFlags | TrackingEventFlags::End );
-Tracking( aTEvt );
+// CompatTracking effectively
+if (!mpWindowImpl || mpWindowImpl->mbInDispose)
+return Window::Tracking( aTEvt );
+else
+return Tracking( aTEvt );
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-10 Thread Caolán McNamara
 vcl/source/filter/ixbm/xbmread.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e0eee341997e372e2e07638c1b8a5d2e42bd7bbf
Author: Caolán McNamara 
Date:   Mon Jan 9 09:05:12 2017 +

ofz#394 xbm ParseDefine problem

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

diff --git a/vcl/source/filter/ixbm/xbmread.cxx 
b/vcl/source/filter/ixbm/xbmread.cxx
index 5b0741f..15931a6 100644
--- a/vcl/source/filter/ixbm/xbmread.cxx
+++ b/vcl/source/filter/ixbm/xbmread.cxx
@@ -165,11 +165,11 @@ long XBMReader::ParseDefine( const sal_Char* pDefine )
 cTmp = *pTmp--;
 
 // search last digit
-while( pHexTable[ cTmp ] == -1 )
+while (pHexTable[ cTmp ] == -1 && pTmp >= pDefine)
 cTmp = *pTmp--;
 
 // move before number
-while( pHexTable[ cTmp ] != -1 )
+while (pHexTable[ cTmp ] != -1 && pTmp >= pDefine)
 cTmp = *pTmp--;
 
 // move to start of number
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-01-04 Thread Michael Meeks
 vcl/source/window/window.cxx |   26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit f7879b26ea7ab04d4e8bbfcc2ca2439c13a0504f
Author: Michael Meeks 
Date:   Tue Jan 3 22:00:32 2017 +

vcl: hold VclPtrs to avoid possible lifecycle related crashers.

Makes code on common EnableInput crash reporter trace safer.

Change-Id: Ibcf218d0d2460383d12e19f48aaf0ab08e541532
Reviewed-on: https://gerrit.libreoffice.org/32706
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
(cherry picked from commit 61aa97c1be23398acb7e9160763b621f63c13d88)
Reviewed-on: https://gerrit.libreoffice.org/32719
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index ac89e1c..e483e29 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1408,7 +1408,7 @@ bool Window::ImplUpdatePos()
 mnOutOffY  = mpWindowImpl->mnY + pParent->mnOutOffY;
 }
 
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 if ( pChild->ImplUpdatePos() )
@@ -1427,7 +1427,7 @@ void Window::ImplUpdateSysObjPos()
 if ( mpWindowImpl->mpSysObj )
 mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, 
mnOutHeight );
 
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 pChild->ImplUpdateSysObjPos();
@@ -1957,7 +1957,7 @@ bool Window::IsLocked() const
 if ( mpWindowImpl->mnLockCount != 0 )
 return true;
 
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 if ( pChild->IsLocked() )
@@ -2156,7 +2156,7 @@ void Window::CollectChildren(::std::vector& rAllChildren )
 {
 rAllChildren.push_back( this );
 
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 pChild->CollectChildren( rAllChildren );
@@ -2470,7 +2470,7 @@ void Window::Enable( bool bEnable, bool bChild )
 
 if ( bChild )
 {
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 pChild->Enable( bEnable, bChild );
@@ -2486,7 +2486,7 @@ void Window::SetCallHandlersOnInputDisabled( bool bCall )
 {
 mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall;
 
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 pChild->SetCallHandlersOnInputDisabled( bCall );
@@ -2543,7 +2543,7 @@ void Window::EnableInput( bool bEnable, bool bChild )
 
 if ( bChild )
 {
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 pChild->EnableInput( bEnable, bChild );
@@ -2642,7 +2642,7 @@ void Window::AlwaysEnableInput( bool bAlways, bool bChild 
)
 
 if ( bChild )
 {
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 pChild->AlwaysEnableInput( bAlways, bChild );
@@ -2671,7 +2671,7 @@ void Window::AlwaysDisableInput( bool bAlways, bool 
bChild )
 
 if ( bChild )
 {
-vcl::Window* pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while ( pChild )
 {
 pChild->AlwaysDisableInput( bAlways, bChild );
@@ -3415,7 +3415,7 @@ void Window::DrawSelectionBackground( const Rectangle& 
rRect,
 bool Window::IsScrollable() const
 {
 // check for scrollbars
-vcl::Window *pChild = mpWindowImpl->mpFirstChild;
+VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild;
 while( pChild )
 {
 if( pChild->GetType() == WINDOW_SCROLLBAR )
@@ -3488,14 +3488,14 @@ bool Window::HasActiveChildFrame()
 if( pFrameWin != mpWindowImpl->mpFrameWindow )
 {
 bool bDecorated = false;
-vcl::Window *pChildFrame = pFrameWin->ImplGetWindow();
+VclPtr< vcl::Window > pChildFrame = pFrameWin->ImplGetWindow();
 // #i15285# unfortunately WB_MOVEABLE is the same as WB_TABSTOP 
which can
 // be removed for ToolBoxes to influence the keyboard accessibility
 // thus WB_MOVEABLE is no indicator for decoration anymore
 // but FloatingWindows carry this information in their TitleType...
 // TODO: avoid duplicate WinBits !!!
 if( 

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

2016-12-22 Thread Khaled Hosny
 vcl/source/gdi/CommonSalLayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f804c7d0d36997db6bbbcb3b5619adf3f0064d1e
Author: Khaled Hosny 
Date:   Thu Dec 22 20:31:39 2016 +0200

Fix glyph Y offset

Typo from 9eb4b14ffa57cd7bbdf0fc43096f5f1e65c8e388.

Change-Id: I542b84cae50d09f2ed58a58ba9de519354a6900d
Reviewed-on: https://gerrit.libreoffice.org/32352
Reviewed-by: Khaled Hosny 
Tested-by: Khaled Hosny 

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 6358a07..0cfda53 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -648,7 +648,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 nAdvance = std::lround(nAdvance * nXScale);
 nXOffset = std::lround(nXOffset * nXScale);
-nYOffset = std::lround(nXOffset * nYScale);
+nYOffset = std::lround(nYOffset * nYScale);
 
 Point aNewPos(aCurrPos.X() + nXOffset, aCurrPos.Y() + 
nYOffset);
 const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, 
nGlyphFlags,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-22 Thread Caolán McNamara
 vcl/source/filter/wmf/enhwmf.cxx |   17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 371f0f6770add78ae81e0f769d0490874bca353c
Author: Caolán McNamara 
Date:   Thu Dec 22 13:35:31 2016 +

Resolves: ofz#313 cbBmiSrc > getDIBV5HeaderSize

Change-Id: I67fb67dc0a4cb609b8f1391c1eb6dd395755a933
(cherry picked from commit 7485fc2a1484f31631f62f97e5c64c0ae74c6416)

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index 05b4f79..ddd7e9b 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -1252,13 +1252,22 @@ bool EnhWMFReader::ReadEnhWMF()
 else
 {
 const sal_uInt32 nSourceSize = cbBmiSrc + cbBitsSrc + 
14;
-if ( nSourceSize <= ( nEndPos - nStartPos ) )
+bool bSafeRead = nSourceSize <= (nEndPos - nStartPos);
+sal_uInt32 nDeltaToDIB5HeaderSize(0);
+const bool bReadAlpha(0x01 == aFunc.aAlphaFormat);
+if (bSafeRead && bReadAlpha)
 {
 // we need to read alpha channel data if 
AlphaFormat of BLENDFUNCTION is
 // AC_SRC_ALPHA (==0x01). To read it, create a 
temp DIB-File which is ready
 // for DIB-5 format
-const bool bReadAlpha(0x01 == aFunc.aAlphaFormat);
-const sal_uInt32 nDeltaToDIB5HeaderSize(bReadAlpha 
? getDIBV5HeaderSize() - cbBmiSrc : 0);
+const sal_uInt32 nHeaderSize = 
getDIBV5HeaderSize();
+if (cbBmiSrc > nHeaderSize)
+bSafeRead = false;
+else
+nDeltaToDIB5HeaderSize = nHeaderSize - 
cbBmiSrc;
+}
+if (bSafeRead)
+{
 const sal_uInt32 nTargetSize(cbBmiSrc + 
nDeltaToDIB5HeaderSize + cbBitsSrc + 14);
 char* pBuf = new char[ nTargetSize ];
 SvMemoryStream aTmp( pBuf, nTargetSize, 
StreamMode::READ | StreamMode::WRITE );
@@ -1277,7 +1286,7 @@ bool EnhWMFReader::ReadEnhWMF()
 pWMF->Seek( nStart + offBmiSrc );
 pWMF->ReadBytes(pBuf + 14, cbBmiSrc);
 
-if(bReadAlpha)
+if (bReadAlpha)
 {
 // need to add values for all stuff that 
DIBV5Header is bigger
 // than DIBInfoHeader, all values are 
correctly initialized to zero,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-22 Thread Caolán McNamara
 vcl/source/filter/wmf/winwmf.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3ea598f65bed096dbf4bda5fe4105b57c58b5310
Author: Caolán McNamara 
Date:   Thu Dec 22 11:09:08 2016 +

valgrind: stick 0 at end of successfully read data

Change-Id: Id79f68c9095ab313ac05d2c8b55df71788df81d3
(cherry picked from commit 0dfc6f70ab53a773ee05664235d7c8927ab20f2c)

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 1544def..ce83658 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -886,7 +886,6 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 {
 Size aFontSize;
 char lfFaceName[LF_FACESIZE+1];
-lfFaceName[LF_FACESIZE] = 0;
 sal_Int16 lfEscapement = 0;
 sal_Int16 lfOrientation = 0;
 sal_Int16 lfWeight = 0;
@@ -904,7 +903,8 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 pWMF->ReadUChar( aLogFont.lfClipPrecision );
 pWMF->ReadUChar( aLogFont.lfQuality );
 pWMF->ReadUChar( aLogFont.lfPitchAndFamily );
-pWMF->ReadBytes( lfFaceName, LF_FACESIZE );
+size_t nRet = pWMF->ReadBytes( lfFaceName, LF_FACESIZE );
+lfFaceName[nRet] = 0;
 aLogFont.lfWidth = aFontSize.Width();
 aLogFont.lfHeight = aFontSize.Height();
 aLogFont.lfEscapement = lfEscapement;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-22 Thread Caolán McNamara
 vcl/source/gdi/dibtools.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 3bff2da31ed580817f6b5b653f48727e38078af5
Author: Caolán McNamara 
Date:   Thu Dec 22 10:51:39 2016 +

Resolves: ofz#310: Sanitize 1 bit bitmap palette indexes too

Change-Id: Ied2b71eb1c9088bbbff5fed97f7a04b43f4b4827
(cherry picked from commit b08e48166310ab8a53f06f4fee227a948416cf4a)

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index ebe9d89..6bf5843 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -565,6 +565,9 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, 
BitmapWriteAccess& r
 {
 case 1:
 {
+const bool bHasPalette = rAcc.HasPalette();
+const sal_uInt16 nPaletteEntryCount = 
rAcc.GetPaletteEntryCount();
+
 for( ; nCount--; nY += nI )
 {
 sal_uInt8 * pTmp = pBuf.get();
@@ -583,7 +586,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, 
BitmapWriteAccess& r
 cTmp = *pTmp++;
 }
 
-rAcc.SetPixelIndex( nY, nX, (cTmp >> --nShift) & 
1);
+auto nIndex = (cTmp >> --nShift) & 1;
+rAcc.SetPixelIndex(nY, nX, 
SanitizePaletteIndex(nIndex, bHasPalette, nPaletteEntryCount));
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-20 Thread Julien Nabet
 vcl/source/gdi/CommonSalLayout.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit e1d892b0cd0df500a1ea53d4c227f9a6fe943fdd
Author: Julien Nabet 
Date:   Tue Dec 20 09:11:45 2016 +0100

vcl: fix Android build

lround() is missing in the std namespace on the broken Android toolchain, 
work
it around.

(same as 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=0cb7d76bc5552245642ba423a87831cd9e0b2b92)

Change-Id: I84c97e6d6bcbc193565c01db3011eb9d4edba6a1
Reviewed-on: https://gerrit.libreoffice.org/32216
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 
(cherry picked from commit 456363919105253dd344b80b3ad3f649662c5658)

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 1be0673..6358a07 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -30,6 +30,17 @@
 #include 
 #include 
 
+#if defined(ANDROID)
+namespace std
+{
+template
+T lround(T x)
+{
+return ::lround(x);
+}
+}
+#endif
+
 
 static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* 
pUserData)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-20 Thread Khaled Hosny
 vcl/source/gdi/CommonSalLayout.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5e63617ef934d3602bbc22f0f01c77b024347e60
Author: Khaled Hosny 
Date:   Tue Dec 20 01:36:34 2016 +0200

tdf#103765: Round positions instead of truncating

Change-Id: Id0505163e10bb4c76970f2f96af568da453d3d05
Reviewed-on: https://gerrit.libreoffice.org/32211
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins 
(cherry picked from commit 9eb4b14ffa57cd7bbdf0fc43096f5f1e65c8e388)
Reviewed-on: https://gerrit.libreoffice.org/32212
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 521d178..1be0673 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -635,9 +635,9 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 nYOffset = -pHbPositions[i].y_offset;
 }
 
-nAdvance *= nXScale;
-nXOffset *= nXScale;
-nYOffset *= nYScale;
+nAdvance = std::lround(nAdvance * nXScale);
+nXOffset = std::lround(nXOffset * nXScale);
+nYOffset = std::lround(nXOffset * nYScale);
 
 Point aNewPos(aCurrPos.X() + nXOffset, aCurrPos.Y() + 
nYOffset);
 const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, 
nGlyphFlags,
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-19 Thread Caolán McNamara
 vcl/source/control/edit.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e38415d1c76461123106bb07708665da23cf5249
Author: Caolán McNamara 
Date:   Mon Dec 19 11:15:06 2016 +

Related: rhbz#1405521 abrt reported crash in dnd

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

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 1542d5b..fe7f6f9 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2848,7 +2848,7 @@ void Edit::dragDropEnd( const 
css::datatransfer::dnd::DragSourceDropEvent& rDSDE
 {
 SolarMutexGuard aVclGuard;
 
-if ( rDSDE.DropSuccess && ( rDSDE.DropAction & 
datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
+if (rDSDE.DropSuccess && (rDSDE.DropAction & 
datatransfer::dnd::DNDConstants::ACTION_MOVE) && mpDDInfo)
 {
 Selection aSel( mpDDInfo->aDndStartSel );
 if ( mpDDInfo->bDroppedInMe )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - vcl/source vcl/win

2016-12-16 Thread Khaled Hosny
 vcl/source/gdi/CommonSalLayout.cxx |5 -
 vcl/win/gdi/winlayout.cxx  |   16 +---
 2 files changed, 9 insertions(+), 12 deletions(-)

New commits:
commit a813623240ac9614c8b2b8b890b9eb83663c72c1
Author: Khaled Hosny 
Date:   Fri Dec 16 09:16:29 2016 +0200

tdf#104159: Fix caching glyphs of non-UI fonts

Partially reverts "tdf#103725: Fix horizontal scaling on Windows",
which didn't work on newer Windows versions anyway.

This reverts commit a5750d92b2136d60d698b41ef5760f2efac0ffce.

Reviewed-on: https://gerrit.libreoffice.org/32068
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 
(cherry picked from commit ab291ac3b8576a086cab60ffb64d60b046a271a2)

Change-Id: Ia4bb426a21804517d3ec313ab7494ba121c5751b
Reviewed-on: https://gerrit.libreoffice.org/32094
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 8ab8eb3..521d178 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -19,6 +19,9 @@
 
 #include "CommonSalLayout.hxx"
 
+#if defined(_WIN32)
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -195,7 +198,7 @@ CommonSalLayout::CommonSalLayout(HDC hDC, WinFontInstance& 
rWinFontInstance, con
 }
 
 // Calculate the mnAveWidthFactor, see the comment where it is used.
-if (mrFontSelData.mnWidth)
+if (mrFontSelData.mnWidth && ! OpenGLHelper::isVCLOpenGLEnabled())
 {
 double nUPEM = hb_face_get_upem(hb_font_get_face(mpHbFont));
 
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 2d35175..cefe4b1 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3341,19 +3341,9 @@ std::vector 
D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid
 bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** 
ppFontFace, float * lfSize) const
 {
 bool succeeded = false;
-IDWriteFont* pFont;
-
-LOGFONTW aLogFont;
-HFONT hFont = static_cast(::GetCurrentObject(hDC, OBJ_FONT));
-GetObjectW(hFont, sizeof(LOGFONTW), );
 try
 {
-succeeded = SUCCEEDED(mpGdiInterop->CreateFontFromLOGFONT(, 
));
-if (succeeded)
-{
-succeeded = SUCCEEDED(pFont->CreateFontFace(ppFontFace));
-pFont->Release();
-}
+succeeded = SUCCEEDED(mpGdiInterop->CreateFontFaceFromHdc(hDC, 
ppFontFace));
 }
 catch (const std::exception& e)
 {
@@ -3363,6 +3353,10 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC 
hDC, IDWriteFontFace ** p
 
 if (succeeded)
 {
+LOGFONTW aLogFont;
+HFONT hFont = static_cast(::GetCurrentObject(hDC, OBJ_FONT));
+
+GetObjectW(hFont, sizeof(LOGFONTW), );
 float dpix, dpiy;
 mpRT->GetDpi(, );
 *lfSize = aLogFont.lfHeight * 96.0f / dpiy;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-09 Thread Caolán McNamara
 vcl/source/filter/wmf/winwmf.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b832d7019f7e7499f5fb3da5d5f49ddbf0f35585
Author: Caolán McNamara 
Date:   Fri Dec 9 15:26:59 2016 +

oss-fuzz we don't want this stream to automatically resize on seeks past end

Change-Id: Ie42b2e173cd3ed9faaf17c3c978227613129fa84
(cherry picked from commit f212bd45a7c7d97fb16380cd9fa7c6abbfb71e05)

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index f1b907f..a93c79a 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -1093,7 +1093,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 {   // first EMF comment
 nEMFRecCount= nComRecCount;
 nEMFSize= nEMFTotalSize;
-pEMFStream = 
o3tl::make_unique( nEMFSize );
+pEMFStream = 
o3tl::make_unique(nEMFSize, 0);
 }
 else if( ( nEMFRecCount != nComRecCount ) || ( 
nEMFSize != nEMFTotalSize ) ) // add additional checks here
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - vcl/source xmlsecurity/qa xmlsecurity/source

2016-11-30 Thread Miklos Vajna
 vcl/source/gdi/pdfwriter_impl.cxx  |  133 -
 xmlsecurity/qa/unit/pdfsigning/data/good-pades.pdf |binary
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx  |8 +
 xmlsecurity/qa/unit/signing/data/good-xades.odt|binary
 xmlsecurity/qa/unit/signing/data/no.odt|binary
 xmlsecurity/qa/unit/signing/signing.cxx|   33 +
 xmlsecurity/source/pdfio/pdfdocument.cxx   |   22 +++
 7 files changed, 168 insertions(+), 28 deletions(-)

New commits:
commit d8f50337fcafc52a12ad87f29233e5650b7bfca3
Author: Miklos Vajna 
Date:   Mon Nov 28 15:38:39 2016 +0100

vcl mscrypto PDF sign: bring it up to date with NSS, part 2

This is a combination of 6 commits:

1) CppunitTest_xmlsecurity_signing: fix this on Windows with non-empty cert 
store

The NSS code earlier started to save the hash algo ID of the signature
into the signature structure and I also added a unit test for this. This
failed on Windows when the system had at least one signing certificate
installed, as the mscrypto part of the patch was missing.

(cherry picked from commit fd3db1cf77c86cd787f912b7bb2ba3ad894203f3)

2) vcl mscrypto PDF sign: don't assume that header length is always 2 bytes

For now just assert that the short form doesn't try to handle larger
values than expected, the long form has to be implemented once we hit
the assert.

(cherry picked from commit 5bf32e4e78ffbe34f3b2840a9677ded34e5b4da7)

3) vcl mscrypto PDF sign: write IssuerSerial sequence

It fixes a problem detected by the PAdES validator from
, and with this the Windows output is in
sync with NSS.

(cherry picked from commit e1446e9e25f784a730c0399ba64b52b36a01a91c)

4) vcl mscrypto PDF sign: fix typo in GetDERLengthOfLength()

When id-aa-signingCertificateV2 had a value that was larger than 255
bytes, then the header size is expected to be 4 bytes, but it was only
3. The length part of the header is 3 bytes: one byte declaring the
length-of-length, and 3 bytes for the length. We added this additional
byte to the result too early, that way we counted that e.g. 278 (the
number) fits into a single uint8_t, which is not the case.

Also introduce named constants for some of the hardwired numbers in the
code for better readability.

(cherry picked from commit 7339a3d39035ccc7541fbbddc858121ce464dc68)

5) CppunitTest_xmlsecurity_signing: add 2 more ODF / XAdES tests

Make sure we handle the case when the document has a signature
stream, but it's empty.

Make sure we find a given XAdES-enabled ODF document valid.
Previously this was tested only dynamically, i.e. breaking both the
import and the export at the same time went unnoticed.

(cherry picked from commit deaa4701e609f698999c3e05ce79b15f4cb94670)

6) CppunitTest_xmlsecurity_pdfsigning: add first PAdES test

As a start just make sure we accept "ETSI.CAdES.detached" as a valid
SubFilter value.

(cherry picked from commit 568e0394868114457c9dbf7cc1af5bc863ae2a4d)

Change-Id: I19f480a5a24df0f451261d6d9a0dd9bd72ff6cc1
Reviewed-on: https://gerrit.libreoffice.org/31435
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 372f08e..1697cfd 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6807,8 +6807,52 @@ typedef BOOL (WINAPI 
*PointerTo_CryptRetrieveTimeStamp)(LPCWSTR wszUrl,
 
 namespace
 {
+
+/// Counts how many bytes are needed to encode a given length.
+size_t GetDERLengthOfLength(size_t nLength)
+{
+size_t nRet = 1;
+
+if(nLength > 127)
+{
+while (nLength >> (nRet * 8))
+++nRet;
+// Long form means one additional byte: the length of the length and
+// the length itself.
+++nRet;
+}
+return nRet;
+}
+
+/// Writes the length part of the header.
+void WriteDERLength(SvStream& rStream, size_t nLength)
+{
+size_t nLengthOfLength = GetDERLengthOfLength(nLength);
+if (nLengthOfLength == 1)
+{
+// We can use the short form.
+rStream.WriteUInt8(nLength);
+return;
+}
+
+// 0x80 means that the we use the long form: the first byte is the length
+// of length with the highest bit set to 1, not the actual length.
+rStream.WriteUInt8(0x80 | (nLengthOfLength - 1));
+for (size_t i = 1; i < nLengthOfLength; ++i)
+rStream.WriteUInt8(nLength >> ((nLengthOfLength - i - 1) * 8));
+}
+
+const unsigned nASN1_INTEGER = 0x02;
+const unsigned nASN1_OCTET_STRING = 0x04;
+const unsigned nASN1_NULL = 0x05;
+const unsigned nASN1_OBJECT_IDENTIFIER = 0x06;
+const unsigned 

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

2016-11-30 Thread Jan Holesovsky
 vcl/source/outdev/bitmap.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9ab5f1bf616080c49829e58f1390b9f0c65965f9
Author: Jan Holesovsky 
Date:   Wed Nov 30 15:38:38 2016 +0100

tdf#103747: Don't re-position images when re-playing a metafile.

I am not sure it's a good idea to re-position them at all; but for the 
moment
don't do that only with the metafiles, as I am not sure what the other
consequences could be.

Change-Id: I50e50663149f7879ddc86149d92d44cf2d5df40d
(cherry picked from commit be5369e7aa426be8b88776f58aaaba1ae926229c)

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index ca736ed..e536b22 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1188,6 +1188,7 @@ void OutputDevice::DrawTransformedBitmapEx(
 const bool bMirroredY(basegfx::fTools::less(aScale.getY(), 0.0));
 
 static bool bForceToOwnTransformer(false);
+const bool bMetafile = mpMetaFile != nullptr;
 
 if(!bForceToOwnTransformer && !bRotated && !bSheared && !bMirroredX && 
!bMirroredY)
 {
@@ -1199,14 +1200,14 @@ void OutputDevice::DrawTransformedBitmapEx(
 basegfx::fround(aScale.getX() + aTranslate.getX()) - aDestPt.X(),
 basegfx::fround(aScale.getY() + aTranslate.getY()) - aDestPt.Y());
 const Point aOrigin = GetMapMode().GetOrigin();
-if (comphelper::LibreOfficeKit::isActive() && 
GetMapMode().GetMapUnit() != MapUnit::MapPixel)
+if (!bMetafile && comphelper::LibreOfficeKit::isActive() && 
GetMapMode().GetMapUnit() != MapUnit::MapPixel)
 {
 aDestPt.Move(aOrigin.getX(), aOrigin.getY());
 EnableMapMode(false);
 }
 
 DrawBitmapEx(aDestPt, aDestSize, rBitmapEx);
-if (comphelper::LibreOfficeKit::isActive() && 
GetMapMode().GetMapUnit() != MapUnit::MapPixel)
+if (!bMetafile && comphelper::LibreOfficeKit::isActive() && 
GetMapMode().GetMapUnit() != MapUnit::MapPixel)
 {
 EnableMapMode();
 aDestPt.Move(-aOrigin.getX(), -aOrigin.getY());
@@ -1218,7 +1219,6 @@ void OutputDevice::DrawTransformedBitmapEx(
 // created transformed bitmap
 const bool bInvert(RasterOp::Invert == meRasterOp);
 const bool bBitmapChangedColor(mnDrawMode & (DrawModeFlags::BlackBitmap | 
DrawModeFlags::WhiteBitmap | DrawModeFlags::GrayBitmap | 
DrawModeFlags::GhostedBitmap));
-const bool bMetafile(mpMetaFile);
 bool bDone(false);
 const basegfx::B2DHomMatrix aFullTransform(GetViewTransformation() * 
rTransformation);
 const bool bTryDirectPaint(!bInvert && !bBitmapChangedColor && !bMetafile 
);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-30 Thread Marco Cecchetti
 vcl/source/gdi/pdfextoutdevdata.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit dbdf91f93ee975b1b9b6bfc6d9571e13ca0e750e
Author: Marco Cecchetti 
Date:   Fri Nov 25 10:23:31 2016 +0100

tdf#101458 - check PNG for adequate compression

Change-Id: I7131d3b721ebb4d47b0bb43f09fcb9767f8ac6d8
Reviewed-on: https://gerrit.libreoffice.org/31411
Tested-by: Jenkins 
Reviewed-by: Marco Cecchetti 

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx 
b/vcl/source/gdi/pdfextoutdevdata.cxx
index 34c448c..73d9232 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -420,9 +420,10 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, 
sal_uInt32& rCurGDIMtfAc
 if ( !mbGroupIgnoreGDIMtfActions )
 mCurrentGraphic = rGraphic;
 }
-else if ( eType == GfxLinkType::NativePng )
+else if ( eType == GfxLinkType::NativePng && 
mParaRects.size() >= 2 )
 {
-mCurrentGraphic = rGraphic;
+if ( 
rOutDevData.HasAdequateCompression(rGraphic, mParaRects[0], mParaRects[1]) )
+mCurrentGraphic = rGraphic;
 }
 }
 break;
@@ -805,7 +806,7 @@ bool PDFExtOutDevData::HasAdequateCompression( const 
Graphic ,
 {
 bool bReduceResolution = false;
 
-assert( rGraphic.IsLink() && rGraphic.GetLink().GetType() == 
GfxLinkType::NativeJpg );
+assert( rGraphic.IsLink() && (rGraphic.GetLink().GetType() ==  
GfxLinkType::NativeJpg || rGraphic.GetLink().GetType() == 
GfxLinkType::NativePng));
 
 // small items better off as PNG anyway
 if ( rGraphic.GetSizePixel().Width() < 32 &&
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - vcl/source xmlsecurity/CppunitTest_xmlsecurity_signing.mk xmlsecurity/inc xmlsecurity/qa xmlsecurity/source

2016-11-29 Thread Miklos Vajna
 vcl/source/gdi/pdfwriter_impl.cxx|  117 +++
 xmlsecurity/CppunitTest_xmlsecurity_signing.mk   |1 
 xmlsecurity/inc/pdfio/pdfdocument.hxx|   66 
 xmlsecurity/inc/sigstruct.hxx|3 
 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx|   28 +++--
 xmlsecurity/qa/unit/signing/data/certificate.crt |   27 -
 xmlsecurity/qa/unit/signing/data/key3.db |binary
 xmlsecurity/qa/unit/signing/signing.cxx  |   94 ++
 xmlsecurity/source/pdfio/pdfdocument.cxx |   74 --
 9 files changed, 286 insertions(+), 124 deletions(-)

New commits:
commit d02c3ba8c5e723561edb694e7ed8b2f2c33604af
Author: Miklos Vajna 
Date:   Wed Nov 23 11:27:32 2016 +0100

vcl mscrypto PDF sign: bring it up to date with NSS, part 1

This is a combination of 6 commits:

1) vcl mscrypto PDF sign: add initial 'signing-certificate' signed attribute

Equivalent of the earlier NSS commit, payload is just an empty sequence
at the moment.

(cherry picked from commit cb851cbb09adc637bb6e8095050292f7a8c6a7b1)

2) vcl mscrypto PDF sign: write ESSCertIDv2

With this, the value of signing-certificate conforms to the RFC on
Windows as well.

(cherry picked from commit b12410f212658996fdb5fb291a06038e9ac39b2e)

3) xmlsecurity mscrypto PDF sign: conditionally add back CAdES SubFilter

We can now write that on Windows as well when requested, after the
signing-certificate attribute is implemented using mscrypto.

With this, the PAdES validator at


finds our Windows signature valid.

(cherry picked from commit 8a279d7de4cf94c99f655f6edd0da0c24ab4003c)

4) CppunitTest_xmlsecurity_signing: don't assume we always have a signing 
cert

This makes this suite in sync with CppunitTest_xmlsecurity_pdfsigning. A
signing certificate is available on 64bit NSS platforms, as there we
provide a pre-created NSS db, but on other platforms by default there is
just no signing certificate.  The certificate.crt I added earlier is not
enough, that's just the certificate, but it doesn't provide a private
key.

(cherry picked from commit 748f778d0f42f2cbb78a7ca7e013bfbd77cdf2b7)

5) CppunitTest_xmlsecurity_signing: add XAdES testcase

Assert the two user-visible changes: SHA-256 hashes and the digest of
the signing certificate.

(cherry picked from commit 426495cb441e6a83cd0d1f74b0ddf656322815b5)

6) CppunitTest_xmlsecurity_pdfsigning: add PAdES testcase

Assert the two user-visible changes: SHA-256 hashes and the SubFilter of the
signature.

(cherry picked from commit 5cb580144c286117db485e605c79ce1139cb94fb)

Change-Id: I12a2355e2ddfc368bed4430a7b5ad244b5778afe
Reviewed-on: https://gerrit.libreoffice.org/31316
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index e5af4d4..372f08e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6805,6 +6805,101 @@ typedef BOOL (WINAPI 
*PointerTo_CryptRetrieveTimeStamp)(LPCWSTR wszUrl,
 PCCERT_CONTEXT 
*ppTsSigner,
 HCERTSTORE phStore);
 
+namespace
+{
+/// Create payload for the 'signing-certificate' signed attribute.
+bool CreateSigningCertificateAttribute(vcl::PDFWriter::PDFSignContext& 
rContext, SvStream& rEncodedCertificate)
+{
+// CryptEncodeObjectEx() does not support encoding arbitrary ASN.1
+// structures, like SigningCertificateV2 from RFC 5035, so let's build it
+// manually.
+
+// Count the certificate hash and put it to aHash.
+// 2.16.840.1.101.3.4.2.1, i.e. sha256.
+std::vector aSHA256{0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 
0x04, 0x02, 0x01};
+
+HCRYPTPROV hProv = 0;
+if (!CryptAcquireContext(, nullptr, nullptr, PROV_RSA_AES, 
CRYPT_VERIFYCONTEXT))
+{
+SAL_WARN("vcl.pdfwriter", "CryptAcquireContext() failed");
+return false;
+}
+
+HCRYPTHASH hHash = 0;
+if (!CryptCreateHash(hProv, CALG_SHA_256, 0, 0, ))
+{
+SAL_WARN("vcl.pdfwriter", "CryptCreateHash() failed");
+return false;
+}
+
+if (!CryptHashData(hHash, reinterpret_cast(rContext.m_pDerEncoded), rContext.m_nDerEncoded, 0))
+{
+SAL_WARN("vcl.pdfwriter", "CryptHashData() failed");
+return false;
+}
+
+DWORD nHash = 0;
+if (!CryptGetHashParam(hHash, HP_HASHVAL, nullptr, , 0))
+{
+SAL_WARN("vcl.pdfwriter", "CryptGetHashParam() failed to provide the 
hash length");
+return false;
+}
+

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

2016-11-28 Thread Michael Meeks
 vcl/source/window/window.cxx |   16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 6c8bfac5329741530f7cb2740246dbd11449fb74
Author: Michael Meeks 
Date:   Sat Nov 26 15:47:15 2016 +

tdf#101327 - tolerate exceptions during window construction better.

It appears we can end up being a frame window, which is not added
into the list of frames; so tolerate that.

Change-Id: I7696e79636f7794f327027f0ca73363eef1937e5
Reviewed-on: https://gerrit.libreoffice.org/31235
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 
(cherry picked from commit 115671bf929a82709c535b475bf19f4967a666c8)
Reviewed-on: https://gerrit.libreoffice.org/31254
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 9170c6b..ac89e1c 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -535,12 +535,22 @@ void Window::dispose()
 pSVData->maWinData.mpFirstFrame = 
mpWindowImpl->mpFrameData->mpNextFrame;
 else
 {
+sal_Int32 nWindows = 0;
 vcl::Window* pSysWin = pSVData->maWinData.mpFirstFrame;
-while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame.get() != 
this )
+while ( pSysWin && 
pSysWin->mpWindowImpl->mpFrameData->mpNextFrame.get() != this )
+{
 pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame;
+nWindows++;
+}
 
-assert (mpWindowImpl->mpFrameData->mpNextFrame.get() != pSysWin);
-pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = 
mpWindowImpl->mpFrameData->mpNextFrame;
+if ( pSysWin )
+{
+assert (mpWindowImpl->mpFrameData->mpNextFrame.get() != 
pSysWin);
+pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = 
mpWindowImpl->mpFrameData->mpNextFrame;
+}
+else // if it is not in the list, we can't remove it.
+SAL_WARN("vcl", "Window " << this << " marked as frame window, 
"
+ "is missing from list of " << nWindows << " frames");
 }
 mpWindowImpl->mpFrame->SetCallback( nullptr, nullptr );
 pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-11-27 Thread Khaled Hosny
 vcl/source/gdi/CommonSalLayout.cxx |   76 +++--
 1 file changed, 32 insertions(+), 44 deletions(-)

New commits:
commit 8715f20644483df9fd26b5656f4f64c4ca9f5411
Author: Khaled Hosny 
Date:   Mon Nov 28 07:53:29 2016 +0200

Simplify things a bit

* Drop SortGlyphItems() and update the Kashida insertion code not depend
  on that sorting.
* IS_DIACRITIC flag can now be based solely on the General Category
  property, since it now is used for non-spacing marks not any OpenType
  mark glyph. Pending complete removal.
* Check whether a glyph can take Kashida or not in one place. We need to
  stop second-guessing here and pass explicit Kashida insertion points
  from upper layers.

Change-Id: I39caa126a07d08c5725505615acc0c8f7a14e169
Reviewed-on: https://gerrit.libreoffice.org/31300
Tested-by: Jenkins 
Reviewed-by: Khaled Hosny 
(cherry picked from commit f246542d1f61b5253189676688f59e5f952267a1)
Reviewed-on: https://gerrit.libreoffice.org/31301

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index ea7093d..4c5327e 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -598,29 +598,15 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 sal_Int32 indexUtf16 = nCharPos;
 sal_UCS4 aChar = rArgs.mrStr.iterateCodePoints(, 0);
 
-bool bDiacritic = false;
-if (hb_ot_layout_has_glyph_classes(pHbFace))
-{
-// the font has GDEF table
-if (pHbPositions[i].x_advance == 0)
-bDiacritic = hb_ot_layout_get_glyph_class(pHbFace, 
nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK;
-}
-else
-{
 #if HB_VERSION_ATLEAST(0, 9, 42)
-if (u_getIntPropertyValue(aChar, UCHAR_GENERAL_CATEGORY) 
== U_NON_SPACING_MARK)
-bDiacritic = true;
-#else
-// the font lacks GDEF table
-if (pHbPositions[i].x_advance == 0)
-bDiacritic = true;
-#endif
-}
-
-if (bDiacritic)
+if (u_getIntPropertyValue(aChar, UCHAR_GENERAL_CATEGORY) == 
U_NON_SPACING_MARK)
 nGlyphFlags |= GlyphItem::IS_DIACRITIC;
+#endif
 
-if ((aSubRun.maScript == HB_SCRIPT_ARABIC) || 
(aSubRun.maScript == HB_SCRIPT_SYRIAC))
+if ((aSubRun.maScript == HB_SCRIPT_ARABIC ||
+ aSubRun.maScript == HB_SCRIPT_SYRIAC) &&
+HB_DIRECTION_IS_BACKWARD(aSubRun.maDirection) &&
+!u_isUWhiteSpace(aChar))
 {
 nGlyphFlags |= GlyphItem::ALLOW_KASHIDA;
 rArgs.mnFlags |= SalLayoutFlags::KashidaJustification;
@@ -664,11 +650,6 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 hb_buffer_destroy(pHbBuffer);
 
-// sort glyphs in visual order
-// and then in logical order (e.g. diacritics after cluster start)
-// XXX: why?
-SortGlyphItems();
-
 return true;
 }
 
@@ -753,14 +734,10 @@ void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
 int nCharPos = m_GlyphItems[i].mnCharPos - mnMinCharPos;
 DeviceCoordinate nDiff = pNewCharWidths[nCharPos] - 
pOldCharWidths[nCharPos];
 
-// nDiff > 1 to ignore rounding errors.
-if (bKashidaJustify && m_GlyphItems[i].AllowKashida() && nDiff > 1)
-pKashidas[i] = nDiff;
-
-// Adjust the width of the first glyph belonging to current character.
+// Adjust the width of the first glyph in the cluster.
 m_GlyphItems[i].mnNewWidth += nDiff;
 
-// Apply the X position of all glyphs belonging to current character.
+// Apply the X position of all glyphs in the cluster.
 size_t j = i;
 while (j < m_GlyphItems.size())
 {
@@ -773,10 +750,31 @@ void CommonSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs)
 ++j;
 }
 
+// Id this glyph is Kashida-justifiable, then mark this as a Kashida
+// position. Since this must be a RTL glyph, we mark the last glyph in
+// the cluster not the fisrt as this would be the base glyph.
+// nDiff > 1 to ignore rounding errors.
+if (bKashidaJustify && m_GlyphItems[i].AllowKashida() && nDiff > 1)
+{
+pKashidas[j - 1] = nDiff;
+// Move any non-spacing marks attached to this cluster as well.
+// Looping backward because this is RTL glyph.
+if (i > 0)
+{
+auto pGlyph = m_GlyphItems.begin() + i - 1;
+while (pGlyph != m_GlyphItems.begin() && pGlyph->IsDiacritic())
+{
+