[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-09-14 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/png/PngImageReader.cxx |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit b34359bcf2f387bc250411a3b78ffcde88329b0e
Author: Caolán McNamara 
AuthorDate: Thu Sep 14 17:41:08 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 14 21:07:47 2023 +0200

nFrames can't be trusted to believe nSequence exists

Change-Id: Id4745487c97ce89fcf149676c15a974e40ee0eb6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156925
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/png/PngImageReader.cxx 
b/vcl/source/filter/png/PngImageReader.cxx
index f0236490d773..8b6e319a473c 100644
--- a/vcl/source/filter/png/PngImageReader.cxx
+++ b/vcl/source/filter/png/PngImageReader.cxx
@@ -699,9 +699,12 @@ bool reader(SvStream& rStream, Graphic& rGraphic,
 }
 for (sal_uInt32 i = 0; i < nFrames; i++)
 {
-// Guaranteed to be fcTL chunk here because it was checked earlier
 fcTLChunk* aFctlChunk
-= 
static_cast(aAPNGInfo.maFrameData[nSequenceIndex++].get());
+= nSequenceIndex < aAPNGInfo.maFrameData.size()
+  ? 
dynamic_cast(aAPNGInfo.maFrameData[nSequenceIndex++].get())
+  : nullptr;
+if (!aFctlChunk)
+return false;
 Disposal aDisposal = static_cast(aFctlChunk->dispose_op);
 Blend aBlend = static_cast(aFctlChunk->blend_op);
 if (i == 0 && aDisposal == Disposal::Back)
@@ -710,7 +713,9 @@ bool reader(SvStream& rStream, Graphic& rGraphic,
 getImportantChunks(rStream, aFrameStream, aFctlChunk->width, 
aFctlChunk->height);
 // A single frame can have multiple fdAT chunks
 while (fdATChunk* pFdatChunk
-   = 
dynamic_cast(aAPNGInfo.maFrameData[nSequenceIndex].get()))
+   = nSequenceIndex < aAPNGInfo.maFrameData.size()
+ ? 
dynamic_cast(aAPNGInfo.maFrameData[nSequenceIndex].get())
+ : nullptr)
 {
 // Write fdAT chunks as IDAT chunks
 auto nDataSize = pFdatChunk->frame_data.size();
@@ -719,8 +724,6 @@ bool reader(SvStream& rStream, Graphic& rGraphic,
 sal_uInt32 nCrc = rtl_crc32(0, pFdatChunk->frame_data.data(), 
nDataSize);
 aFrameStream.WriteUInt32(nCrc);
 nSequenceIndex++;
-if (nSequenceIndex >= aAPNGInfo.maFrameData.size())
-break;
 }
 aFrameStream.WriteUInt32(PNG_IEND_SIZE);
 aFrameStream.WriteUInt32(PNG_IEND_SIGNATURE);
commit 0aa3e40a733230ae439c98244f6db2f97ede1b01
Author: Caolán McNamara 
AuthorDate: Thu Sep 14 17:29:33 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 14 21:07:39 2023 +0200

ofz#62352 Null-dereference READ

Change-Id: Ibf8aa63a6d63809b361902b853dabd8ff0944503
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156924
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/png/PngImageReader.cxx 
b/vcl/source/filter/png/PngImageReader.cxx
index fcdcd210a157..f0236490d773 100644
--- a/vcl/source/filter/png/PngImageReader.cxx
+++ b/vcl/source/filter/png/PngImageReader.cxx
@@ -676,6 +676,8 @@ bool reader(SvStream& rStream, Graphic& rGraphic,
 sal_uInt32 nFrames
 = aAPNGInfo.maACTLChunk.num_frames - 
static_cast(bFctlBeforeIDAT);
 {
+if (aAPNGInfo.maFrameData.empty())
+return false;
 fcTLChunk* aFctlChunk = 
dynamic_cast(aAPNGInfo.maFrameData[0].get());
 if (!aFctlChunk)
 return false;


[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-08-07 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/itiff/itiff.cxx  |   11 ++-
 vcl/source/filter/svm/SvmConverter.cxx |2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit daa589af6a7c8ad6bdb273fda949553ad508bd9e
Author: Caolán McNamara 
AuthorDate: Sun Aug 6 20:19:34 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 7 11:24:14 2023 +0200

ofz#57493 Timeout

the oss-fuzzer has gotten itself into that nasty state where it
can't reproduce the original problem (because its fixed) but keeps
finding other unreproducible ones that don't allow the fixed one
to get closed. Disable this part of the fuzzer for a while so the
original issue can close and then we can reenable and new findings will
be recorded as a new fresh bug.

Change-Id: Ie73c5c50a850a0ac6ea51345f6478f5750f8248e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155385
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/svm/SvmConverter.cxx 
b/vcl/source/filter/svm/SvmConverter.cxx
index ea6dc961a659..48e5a29f5a31 100644
--- a/vcl/source/filter/svm/SvmConverter.cxx
+++ b/vcl/source/filter/svm/SvmConverter.cxx
@@ -1274,6 +1274,7 @@ bool TestImportSVM(SvStream& rStream)
 GDIMetaFile aGDIMetaFile;
 SvmReader aReader(rStream);
 aReader.Read(aGDIMetaFile);
+#if 0
 ScopedVclPtrInstance aVDev;
 try
 {
@@ -1283,6 +1284,7 @@ bool TestImportSVM(SvStream& rStream)
 {
 return false;
 }
+#endif
 return true;
 }
 
commit d384da42a0f710040fffcf12120e8f81e99ac56a
Author: Caolán McNamara 
AuthorDate: Sun Aug 6 19:45:34 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 7 11:24:06 2023 +0200

ofz: Use-of-uninitialized-value

For tdf#149417 we generally allow one short read for fidelity with the
old parser that this replaced. But don't allow that for new format
variations that the old parser didn't handle so we don't take libtiff
into uncharted territory.

Change-Id: I8d2d6954257a63a56d201eaed6510fcc38f9a5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155384
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index bdbf0309e296..39bc51a00860 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -222,7 +222,16 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
 break;
 
 std::vector raster(nPixelsRequired);
-aContext.bAllowOneShortRead = true;
+
+uint16_t compression(COMPRESSION_NONE);
+const bool bNewCodec = TIFFGetField(tif, TIFFTAG_COMPRESSION, 
) == 1 &&
+   compression >= COMPRESSION_ZSTD; // >= 5 at 
time of writing
+// For tdf#149417 we generally allow one short read for fidelity with 
the old
+// parser that this replaced. But don't allow that for new format 
variations
+// that the old parser didn't handle so we don't take libtiff into 
uncharted
+// territory.
+aContext.bAllowOneShortRead = !bNewCodec;
+
 if (TIFFReadRGBAImageOriented(tif, w, h, raster.data(), 
ORIENTATION_TOPLEFT, 1))
 {
 Bitmap bitmap(Size(w, h), vcl::PixelFormat::N24_BPP);


[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-07-22 Thread Khaled Hosny (via logerrit)
 vcl/source/outdev/text.cxx |   22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 9057641f678b8e36c9dbc41960b182c6ecfdda15
Author: Khaled Hosny 
AuthorDate: Wed Jul 19 05:53:09 2023 +0300
Commit: خالد حسني 
CommitDate: Sun Jul 23 06:03:29 2023 +0200

vcl: SalLayout::GetTextWidth() returns double

Change-Id: I4c8cfec4160da260556615bc17939af6b20d60ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154596
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 8cf805fe4870..4a3b04121899 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -169,7 +169,7 @@ void OutputDevice::ImplDrawTextRect( tools::Long nBaseX, 
tools::Long nBaseY,
 
 void OutputDevice::ImplDrawTextBackground( const SalLayout& rSalLayout )
 {
-const tools::Long nWidth = rSalLayout.GetTextWidth();
+const double nWidth = rSalLayout.GetTextWidth();
 const DevicePoint aBase = rSalLayout.DrawBase();
 const tools::Long nX = aBase.getX();
 const tools::Long nY = aBase.getY();
@@ -193,7 +193,7 @@ tools::Rectangle OutputDevice::ImplGetTextBoundRect( const 
SalLayout& rSalLayout
 tools::Long nX = aPoint.getX();
 tools::Long nY = aPoint.getY();
 
-tools::Long nWidth = rSalLayout.GetTextWidth();
+double nWidth = rSalLayout.GetTextWidth();
 tools::Long nHeight = mpFontInstance->mnLineHeight + mnEmphasisAscent + 
mnEmphasisDescent;
 
 nY -= mpFontInstance->mxFontMetric->GetAscent() + mnEmphasisAscent;
@@ -236,7 +236,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& 
rSalLayout )
 if (!rSalLayout.GetBoundRect(aBoundRect))
 {
 // guess vertical text extents if GetBoundRect failed
-tools::Long nRight = rSalLayout.GetTextWidth();
+double nRight = rSalLayout.GetTextWidth();
 tools::Long nTop = mpFontInstance->mxFontMetric->GetAscent() + 
mnEmphasisAscent;
 tools::Long nHeight = mpFontInstance->mnLineHeight + mnEmphasisAscent 
+ mnEmphasisDescent;
 aBoundRect = tools::Rectangle( 0, -nTop, nRight, nHeight - nTop );
@@ -1055,7 +1055,7 @@ void OutputDevice::GetCaretPositions( const OUString& 
rStr, sal_Int32* pCaretXAr
 }
 
 pSalLayout->GetCaretPositions( 2*nLen, pCaretXArray );
-tools::Long nWidth = pSalLayout->GetTextWidth();
+double nWidth = pSalLayout->GetTextWidth();
 
 // fixup unknown caret positions
 int i;
@@ -2303,7 +2303,7 @@ bool OutputDevice::GetTextBoundRect( tools::Rectangle& 
rRect,
 std::unique_ptr pSalLayout;
 const Point aPoint;
 // calculate offset when nBase!=nIndex
-tools::Long nXOffset = 0;
+double nXOffset = 0;
 if( nBase != nIndex )
 {
 sal_Int32 nStart = std::min( nBase, nIndex );
@@ -2370,7 +2370,7 @@ bool OutputDevice::GetTextOutlines( 
basegfx::B2DPolyPolygonVector& rVector,
 std::unique_ptr pSalLayout;
 
 // calculate offset when nBase!=nIndex
-tools::Long nXOffset = 0;
+double nXOffset = 0;
 if( nBase != nIndex )
 {
 sal_Int32 nStart = std::min( nBase, nIndex );
@@ -2395,7 +2395,7 @@ bool OutputDevice::GetTextOutlines( 
basegfx::B2DPolyPolygonVector& rVector,
 // transform polygon to pixel units
 basegfx::B2DHomMatrix aMatrix;
 
-if( nXOffset | mnTextOffX | mnTextOffY )
+if (nXOffset || mnTextOffX || mnTextOffY)
 {
 DevicePoint aRotatedOfs(mnTextOffX, mnTextOffY);
 aRotatedOfs -= 
pSalLayout->GetDrawPosition(DevicePoint(nXOffset, 0));
commit f9e993a91c2c11a17948d394bf207f836e10d28b
Author: Khaled Hosny 
AuthorDate: Tue Jul 18 17:20:56 2023 +0300
Commit: خالد حسني 
CommitDate: Sun Jul 23 06:03:21 2023 +0200

vcl: Don’t use nSubPixelFactor when in map mode

We are already using a subpixel factor when in map mode, so no need for
one more.

Change-Id: I704d52bf402f92f83a3d4ef40409d644921314d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154587
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 8d4f557288c2..8cf805fe4870 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1455,7 +1455,9 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& 
rStr, tools::Long nTextWid
 // NOTE: be very careful to avoid rounding errors for nCharExtra case
 // problem with rounding errors especially for small nCharExtras
 // TODO: remove when layout units have subpixel granularity
-tools::Long nSubPixelFactor = 64;
+tools::Long nSubPixelFactor = 1;
+if (!mbMap)
+nSubPixelFactor = 64;
 double nTextPixelWidth = ImplLogicWidthToDeviceSubPixel(nTextWidth * 
nSubPixelFactor);
 double nExtraPixelWidth = 0;
 if( nCharExtra != 0 )
@@ -1484,7 +1486,9 @@ sal_Int32 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-07-22 Thread Khaled Hosny (via logerrit)
 vcl/source/font/LogicalFontInstance.cxx |2 +-
 vcl/source/gdi/CommonSalLayout.cxx  |2 ++
 vcl/source/outdev/font.cxx  |6 +-
 vcl/source/outdev/text.cxx  |   26 +-
 4 files changed, 17 insertions(+), 19 deletions(-)

New commits:
commit a21958db9111e27312c6ae52e2d5e3a9e8a39e08
Author: Khaled Hosny 
AuthorDate: Tue Jul 18 17:13:33 2023 +0300
Commit: خالد حسني 
CommitDate: Sun Jul 23 06:02:51 2023 +0200

vcl: Use doubles in GetTextBreak()

Change-Id: I88ee2434ba6ddb41cf1983afceebe1ae72be8d9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154584
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index c02509718a60..8d4f557288c2 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1456,14 +1456,10 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& 
rStr, tools::Long nTextWid
 // problem with rounding errors especially for small nCharExtras
 // TODO: remove when layout units have subpixel granularity
 tools::Long nSubPixelFactor = 64;
-nTextWidth *= nSubPixelFactor;
-DeviceCoordinate nTextPixelWidth = LogicWidthToDeviceCoordinate( 
nTextWidth );
-DeviceCoordinate nExtraPixelWidth = 0;
+double nTextPixelWidth = ImplLogicWidthToDeviceSubPixel(nTextWidth * 
nSubPixelFactor);
+double nExtraPixelWidth = 0;
 if( nCharExtra != 0 )
-{
-nCharExtra *= nSubPixelFactor;
-nExtraPixelWidth = LogicWidthToDeviceCoordinate( nCharExtra );
-}
+nExtraPixelWidth = ImplLogicWidthToDeviceSubPixel(nCharExtra * 
nSubPixelFactor);
 nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, 
nSubPixelFactor );
 }
 
@@ -1490,14 +1486,10 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& 
rStr, tools::Long nTextWid
 // TODO: remove when layout units have subpixel granularity
 tools::Long nSubPixelFactor = 64;
 
-nTextWidth *= nSubPixelFactor;
-DeviceCoordinate nTextPixelWidth = LogicWidthToDeviceCoordinate( 
nTextWidth );
-DeviceCoordinate nExtraPixelWidth = 0;
+double nTextPixelWidth = ImplLogicWidthToDeviceSubPixel(nTextWidth * 
nSubPixelFactor);
+double nExtraPixelWidth = 0;
 if( nCharExtra != 0 )
-{
-nCharExtra *= nSubPixelFactor;
-nExtraPixelWidth = LogicWidthToDeviceCoordinate( nCharExtra );
-}
+nExtraPixelWidth = ImplLogicWidthToDeviceSubPixel(nCharExtra * 
nSubPixelFactor);
 
 // calculate un-hyphenated break position
 nRetVal = pSalLayout->GetTextBreak( nTextPixelWidth, nExtraPixelWidth, 
nSubPixelFactor );
@@ -1508,7 +1500,7 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& 
rStr, tools::Long nTextWid
 if( pHyphenLayout )
 {
 // calculate subpixel width of hyphenation character
-tools::Long nHyphenPixelWidth = pHyphenLayout->GetTextWidth() * 
nSubPixelFactor;
+double nHyphenPixelWidth = pHyphenLayout->GetTextWidth() * 
nSubPixelFactor;
 
 // calculate hyphenated break position
 nTextPixelWidth -= nHyphenPixelWidth;
@@ -1689,7 +1681,7 @@ void OutputDevice::ImplDrawText( OutputDevice& 
rTargetDevice, const tools::Recta
 nIndex, nLineLen );
 sal_Int32 lc_x1 = pCaretXArray[2*(nMnemonicPos - 
nIndex)];
 sal_Int32 lc_x2 = pCaretXArray[2*(nMnemonicPos - 
nIndex)+1];
-nMnemonicWidth = 
rTargetDevice.LogicWidthToDeviceCoordinate( std::abs(lc_x1 - lc_x2) );
+nMnemonicWidth = 
rTargetDevice.ImplLogicWidthToDeviceSubPixel(std::abs(lc_x1 - lc_x2));
 
 Point   aTempPos = rTargetDevice.LogicToPixel( 
aPos );
 nMnemonicX = rTargetDevice.GetOutOffXPixel() + 
aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( std::min( lc_x1, 
lc_x2 ) );
@@ -1757,7 +1749,7 @@ void OutputDevice::ImplDrawText( OutputDevice& 
rTargetDevice, const tools::Recta
 /*sal_Bool bRet =*/ _rLayout.GetCaretPositions( aStr, 
pCaretXArray.get(), 0, aStr.getLength() );
 tools::Long lc_x1 = pCaretXArray[2*nMnemonicPos];
 tools::Long lc_x2 = pCaretXArray[2*nMnemonicPos+1];
-nMnemonicWidth = rTargetDevice.LogicWidthToDeviceCoordinate( 
std::abs(lc_x1 - lc_x2) );
+nMnemonicWidth = 
rTargetDevice.ImplLogicWidthToDeviceSubPixel(std::abs(lc_x1 - lc_x2));
 
 Point aTempPos = rTargetDevice.LogicToPixel( aPos );
 nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + 
rTargetDevice.ImplLogicWidthToDevicePixel( std::min(lc_x1, lc_x2) );
commit 9d9e3b439883c3c315501f56bb613e080863db64
Author: Khaled Hosny 
AuthorDate: Mon Jul 17 17:21:34 2023 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-07-21 Thread Michael Weghorn (via logerrit)
 vcl/source/treelist/svtabbx.cxx |   18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 5f7ae99211594919408dd20cd1215393b3c4b76b
Author: Michael Weghorn 
AuthorDate: Fri Jul 21 09:55:34 2023 +0200
Commit: Michael Weghorn 
CommitDate: Fri Jul 21 15:03:22 2023 +0200

tdf#99609 a11y: Implement retrieving selected rows in tab list box

With this in place, the index of the selected row
in the Expert Configuration dialog can e.g. be seen
in Accerciser using this in its Python console with
the table object selected in the tree view of the a11y objects:

In [1]: table = acc.queryTable()
In [2]: table.getSelectedRows()
Out[2]: [12]

Change-Id: I2f07e73552ef12989acab461b33c3e41d9195490
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154713
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index c98be249152d..91740daf3fb0 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -729,8 +729,20 @@ bool SvHeaderTabListBox::IsColumnSelected( sal_Int32 ) 
const
 return false;
 }
 
-void SvHeaderTabListBox::GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& 
) const
+void SvHeaderTabListBox::GetAllSelectedRows(css::uno::Sequence& 
rRowIndices) const
 {
+const sal_Int32 nCount = GetSelectedRowCount();
+rRowIndices.realloc(nCount);
+auto pRows = rRowIndices.getArray();
+SvTreeListEntry* pEntry = FirstSelected();
+sal_Int32 nIndex = 0;
+while (nIndex < nCount && pEntry)
+{
+pRows[nIndex] = GetEntryPos(pEntry);
+pEntry = NextSelected( pEntry );
+++nIndex;
+}
+assert(nIndex == nCount && "Mismatch between GetSelectedRowCount() and 
count of selected rows when iterating.");
 }
 
 void SvHeaderTabListBox::GetAllSelectedColumns( css::uno::Sequence< sal_Int32 
>& ) const
commit ab72f6a4a4ceee41842c8a87b23086bce692b1e3
Author: Michael Weghorn 
AuthorDate: Fri Jul 21 09:10:26 2023 +0200
Commit: Michael Weghorn 
CommitDate: Fri Jul 21 15:03:15 2023 +0200

tdf#99609 a11y: Use GetEntryOnPos in more places in tab list box

As described in more detail for the case in
Change-Id I35f7280d2c386a9a8e04e636ebf34850a733c84a
("tdf#99609 a11y: Announce the correct entry in tab list box"),
`GetEntryOnPos` is the method that returns the correct entry
when passing the row index (when there are also non-visible
dummy entries) and that commit also mentioned:

> There are more uses of `GetEntry` that will be
> looked at separately.

These two uses in `SvHeaderTabListBox::GetCurrRow` and
`SvHeaderTabListBox::IsCellCheckBox` are also using a row
index, so it looks to me like they should also be using
`GetEntryOnPos`.

Change-Id: I1170063d760c020ad543fb458cac99a10e37c9a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154710
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index d9b3e2eaecb9..c98be249152d 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -613,7 +613,7 @@ void SvHeaderTabListBox::RecalculateAccessibleChildren()
 bool SvHeaderTabListBox::IsCellCheckBox( sal_Int32 _nRow, sal_uInt16 _nColumn, 
TriState& _rState ) const
 {
 bool bRet = false;
-SvTreeListEntry* pEntry = GetEntry( _nRow );
+SvTreeListEntry* pEntry = GetEntryOnPos( _nRow );
 if ( pEntry )
 {
 sal_uInt16 nItemCount = pEntry->ItemCount();
@@ -653,7 +653,7 @@ sal_Int32 SvHeaderTabListBox::GetCurrRow() const
 sal_uInt32 nCount = GetEntryCount();
 for ( sal_uInt32 i = 0; i < nCount; ++i )
 {
-if ( pEntry == GetEntry(i) )
+if ( pEntry == GetEntryOnPos(i) )
 {
 nRet = i;
 break;


[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-07-04 Thread Noel Grandin (via logerrit)
 vcl/source/control/combobox.cxx |9 -
 vcl/source/window/tabpage.cxx   |5 ++---
 2 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit f73e8c895e24fda10931ecf344a1a0dd8bcdf92c
Author: Noel Grandin 
AuthorDate: Tue Jul 4 15:00:12 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 4 20:18:47 2023 +0200

unnecessary LogicToPixel in TabPage::Draw

we are already using logical pixels here, and DrawBitmapEx wants logical
pixels

Change-Id: Ia099fbfbf33349003df23a93e1183472b27dc7a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153969
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index 5a83165eb1af..90abeaa25968 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -163,7 +163,6 @@ void TabPage::Paint( vcl::RenderContext& rRenderContext, 
const tools::Rectangle&
 
 void TabPage::Draw( OutputDevice* pDev, const Point& rPos, 
SystemTextColorFlags )
 {
-Point aPos = pDev->LogicToPixel( rPos );
 Size aSize = GetSizePixel();
 
 Wallpaper aWallpaper = GetBackground();
@@ -175,14 +174,14 @@ void TabPage::Draw( OutputDevice* pDev, const Point& 
rPos, SystemTextColorFlags
 pDev->SetLineColor();
 
 if ( aWallpaper.IsBitmap() )
-pDev->DrawBitmapEx( aPos, aSize, aWallpaper.GetBitmap() );
+pDev->DrawBitmapEx( rPos, aSize, aWallpaper.GetBitmap() );
 else
 {
 if( aWallpaper.GetColor() == COL_AUTO )
 pDev->SetFillColor( 
GetSettings().GetStyleSettings().GetDialogColor() );
 else
 pDev->SetFillColor( aWallpaper.GetColor() );
-pDev->DrawRect( tools::Rectangle( aPos, aSize ) );
+pDev->DrawRect( tools::Rectangle( rPos, aSize ) );
 }
 
 pDev->Pop();
commit a2dacae0c8acfad8a5e5a16c766ee740ec202c5e
Author: Noel Grandin 
AuthorDate: Tue Jul 4 14:58:03 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 4 20:18:38 2023 +0200

unnecessary LogicToPixel in ComboBox::Draw

we are already using logical pixels here, and Draw wants logical pixels

Change-Id: I5409abccef4473cbca4d38654a27a677e68d82f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153968
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 2fa7913c5148..0edd309ba7f2 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1152,7 +1152,6 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& 
rPos, SystemTextColorFlags
 {
 GetMainWindow()->ApplySettings(*pDev);
 
-Point aPos = pDev->LogicToPixel( rPos );
 Size aSize = GetSizePixel();
 vcl::Font aFont = GetMainWindow()->GetDrawPixelFont( pDev );
 
@@ -1168,7 +1167,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& 
rPos, SystemTextColorFlags
 bool bBackground = IsControlBackground();
 if ( bBorder || bBackground )
 {
-tools::Rectangle aRect( aPos, aSize );
+tools::Rectangle aRect( rPos, aSize );
 // aRect.Top() += nEditHeight;
 if ( bBorder )
 {
@@ -1192,7 +1191,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& 
rPos, SystemTextColorFlags
 // First, draw the edit part
 Size aOrigSize(m_pImpl->m_pSubEdit->GetSizePixel());
 m_pImpl->m_pSubEdit->SetSizePixel(Size(aSize.Width(), nEditHeight));
-m_pImpl->m_pSubEdit->Draw( pDev, aPos, nFlags );
+m_pImpl->m_pSubEdit->Draw( pDev, rPos, nFlags );
 m_pImpl->m_pSubEdit->SetSizePixel(aOrigSize);
 
 // Second, draw the listbox
@@ -1220,14 +1219,14 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& 
rPos, SystemTextColorFlags
 }
 }
 
-tools::Rectangle aClip( aPos, aSize );
+tools::Rectangle aClip( rPos, aSize );
 pDev->IntersectClipRegion( aClip );
 sal_Int32 nLines = static_cast( nTextHeight > 0 ? 
(aSize.Height()-nEditHeight)/nTextHeight : 1 );
 if ( !nLines )
 nLines = 1;
 const sal_Int32 nTEntry = IsReallyVisible() ? 
m_pImpl->m_pImplLB->GetTopEntry() : 0;
 
-tools::Rectangle aTextRect( aPos, aSize );
+tools::Rectangle aTextRect( rPos, aSize );
 
 aTextRect.AdjustLeft(3*nOnePixel );
 aTextRect.AdjustRight( -(3*nOnePixel) );


[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-07-04 Thread Noel Grandin (via logerrit)
 vcl/source/control/button.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 7441aaa4c5b2215e369c62e22af098184e8ce807
Author: Noel Grandin 
AuthorDate: Tue Jul 4 14:46:24 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 4 19:17:04 2023 +0200

unnecessary LogicToPixel in RadioButton::Draw

we are already using logical pixels here, and ImplDraw wants logical
pixels

Change-Id: I0edc990c9943d68228600a15ccadca62127b02bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153967
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index ec171d91137d..a99e9733496c 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2531,7 +2531,6 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& 
rPos,
 if ( !maImage )
 {
 MapMode aResMapMode( MapUnit::Map100thMM );
-Point   aPos  = pDev->LogicToPixel( rPos );
 SizeaSize = GetSizePixel();
 SizeaImageSize = pDev->LogicToPixel( Size( 300, 300 ), 
aResMapMode );
 SizeaBrd1Size = pDev->LogicToPixel( Size( 20, 20 ), 
aResMapMode );
@@ -2565,7 +2564,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& 
rPos,
 pDev->SetTextColor( GetTextColor() );
 pDev->SetTextFillColor();
 
-ImplDraw( pDev, nFlags, aPos, aSize,
+ImplDraw( pDev, nFlags, rPos, aSize,
   aImageSize, aStateRect, aMouseRect );
 
 Point   aCenterPos = aStateRect.Center();
commit d408fe5cd45c9594feecec727ab2f73c66e361d0
Author: Noel Grandin 
AuthorDate: Tue Jul 4 14:36:48 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 4 19:16:55 2023 +0200

unnecessary LogicToPixel in CheckBox::Draw

we are already in logical pixels here, and the ImplDraw call expects
logical pixels

Change-Id: I7eab69b92998fd36c811fc7ac3949adb2f4fff7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153966
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 69646cc9637e..ec171d91137d 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -3355,7 +3355,6 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& 
rPos,
  SystemTextColorFlags nFlags )
 {
 MapMode aResMapMode( MapUnit::Map100thMM );
-Point   aPos  = pDev->LogicToPixel( rPos );
 SizeaSize = GetSizePixel();
 SizeaImageSize = pDev->LogicToPixel( Size( 300, 300 ), aResMapMode 
);
 SizeaBrd1Size = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode );
@@ -3392,7 +3391,7 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& 
rPos,
 pDev->SetTextColor( GetTextColor() );
 pDev->SetTextFillColor();
 
-ImplDraw( pDev, nFlags, aPos, aSize,
+ImplDraw( pDev, nFlags, rPos, aSize,
   aImageSize, aStateRect, aMouseRect );
 
 pDev->SetLineColor();


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2023-05-09 Thread Caolán McNamara (via logerrit)
 vcl/source/gdi/metaact.cxx  |3 +++
 vcl/unx/generic/window/screensaverinhibitor.cxx |   12 +++-
 2 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 4a8a24be5a378308680a0b6e2e246d5d9df414c4
Author: Caolán McNamara 
AuthorDate: Mon May 8 10:43:07 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 9 11:20:08 2023 +0200

Related: tdf#142176 document what the other inhibit options are

via an enum like the gtk one so it can be seen how to inhibit logging
out due to unsaved changes

Change-Id: I07609cfb7a97b5b6c1b94a09b7b79bcca308d5d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151559
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx 
b/vcl/unx/generic/window/screensaverinhibitor.cxx
index ec19fad09e5d..a2274028b526 100644
--- a/vcl/unx/generic/window/screensaverinhibitor.cxx
+++ b/vcl/unx/generic/window/screensaverinhibitor.cxx
@@ -207,6 +207,16 @@ void ScreenSaverInhibitor::inhibitFDOPM( bool bInhibit, 
const char* appname, con
 #endif // ENABLE_GIO
 }
 
+#if ENABLE_GIO
+enum ApplicationInhibitFlags
+{
+APPLICATION_INHIBIT_LOGOUT  = (1 << 0),
+APPLICATION_INHIBIT_SWITCH  = (1 << 1),
+APPLICATION_INHIBIT_SUSPEND = (1 << 2),
+APPLICATION_INHIBIT_IDLE= (1 << 3) // Inhibit the session being marked 
as idle
+};
+#endif
+
 void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, const char* appname, 
const char* reason, const unsigned int xid )
 {
 #if ENABLE_GIO
@@ -218,7 +228,7 @@ void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, const 
char* appname, const
   appname,
   xid,
   reason,
-  8 //Inhibit 
the session being marked as idle
+  
APPLICATION_INHIBIT_IDLE
  ),
 G_DBUS_CALL_FLAGS_NONE, 
-1, nullptr,  );
  },
commit b7ec54b7c6e85d507066442de3b7398f34bbb653
Author: Caolán McNamara 
AuthorDate: Tue May 9 08:45:34 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 9 11:19:57 2023 +0200

ofz#58756 Integer-overflow

Change-Id: Ie2782c1d68f73e5e88cf868eb1ce106ec0c181b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151558
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index 107972fe8765..22093a95735e 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -973,6 +973,9 @@ MetaBmpScalePartAction::MetaBmpScalePartAction( const 
Point& rDstPt, const Size&
 
 void MetaBmpScalePartAction::Execute( OutputDevice* pOut )
 {
+if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maDstPt, maDstSz
+return;
+
 pOut->DrawBitmap( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp );
 }
 


[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-03-25 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/svm/SvmReader.cxx |5 +
 vcl/source/gdi/metaact.cxx  |3 +++
 2 files changed, 8 insertions(+)

New commits:
commit 67bb7f71b785d3d831ffaa47262b6cbd84e71c42
Author: Caolán McNamara 
AuthorDate: Sat Mar 25 19:56:34 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 25 21:05:51 2023 +

ofz#57134 Timeout

Change-Id: I81cded1dc765d4939a03d46f7df293dfebddcfbe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149585
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/svm/SvmReader.cxx 
b/vcl/source/filter/svm/SvmReader.cxx
index 6d84d44d879f..5cb9009a5834 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -818,6 +818,11 @@ rtl::Reference SvmReader::TextLineHandler()
 mrStream.ReadInt32(nTempWidth);
 
 pAction->SetStartPoint(aPos);
+if (nTempWidth < 0)
+{
+SAL_WARN("vcl.gdi", "negative width");
+nTempWidth = 0;
+}
 pAction->SetWidth(nTempWidth);
 
 sal_uInt32 nTempStrikeout(0);
commit c76c805472ff07695d1b1de5e5ed567162c5f227
Author: Caolán McNamara 
AuthorDate: Sat Mar 25 19:46:28 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Mar 25 21:05:43 2023 +

ofz#57444 Integer-overflow

Change-Id: I8e18854379c6ad71ebe316d60fbf586cbdc240ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149584
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index ad50fa4b2e18..2b8f0809b9fa 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1313,6 +1313,9 @@ MetaHatchAction::MetaHatchAction( tools::PolyPolygon 
aPolyPoly, const Hatch& rHa
 
 void MetaHatchAction::Execute( OutputDevice* pOut )
 {
+if (!AllowRect(pOut->LogicToPixel(maPolyPoly.GetBoundRect(
+return;
+
 pOut->DrawHatch( maPolyPoly, maHatch );
 }
 


[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-02-03 Thread Aron Budea (via logerrit)
 vcl/source/window/window2.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit d4c99f07ed4a795519797f56be29c24a242f4db2
Author: Aron Budea 
AuthorDate: Thu Feb 2 00:08:41 2023 +0100
Commit: Andras Timar 
CommitDate: Sat Feb 4 06:18:30 2023 +

vcl: fix online crash in vcl::Window::IsTracking()

Crashreport signature:

program/libmergedlo.so
vcl::Window::IsTracking() const
vcl/source/window/window2.cxx:340
program/libmergedlo.so
(anonymous namespace)::LOKPostAsyncEvent(void*, void*)
sfx2/source/view/lokhelper.cxx:812
program/libmergedlo.so
LokChartHelper::postMouseEvent(int, int, int, int, int, int, 
double, double)
include/rtl/ref.hxx:128
program/libmergedlo.so
SfxLokHelper::testInPlaceComponentMouseEventHit(SfxViewShell*, int, 
int, int, int, int, int, double, double, bool)
sfx2/source/view/lokhelper.cxx:980
/program/libswlo.so
SwXTextDocument::postMouseEvent(int, int, int, int, int, int)
sw/source/uibase/uno/unotxdoc.cxx:3663
program/libmergedlo.so
doc_postMouseEvent
desktop/source/lib/init.cxx:4831

Change-Id: Iab7d24a901e57dc8af3fb2c77fbea3b4fdad9fb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146483
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146549
Tested-by: Jenkins
Reviewed-by: Andras Timar 

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 87db8e470e21..180edf5cf961 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -341,9 +341,15 @@ bool Window::IsTracking() const
 {
 if (!mpWindowImpl)
 return false;
-return (mpWindowImpl->mbUseFrameData ?
-mpWindowImpl->mpFrameData->mpTrackWin == this :
-ImplGetSVData()->mpWinData->mpTrackWin == this);
+if (mpWindowImpl->mbUseFrameData && mpWindowImpl->mpFrameData)
+{
+return mpWindowImpl->mpFrameData->mpTrackWin == this;
+}
+if (!mpWindowImpl->mbUseFrameData && ImplGetSVData()->mpWinData)
+{
+return ImplGetSVData()->mpWinData->mpTrackWin == this;
+}
+return false;
 }
 
 void Window::StartAutoScroll( StartAutoScrollFlags nFlags )
commit cb44dab0784476a2be0708e801696f47486aa3a2
Author: Noel Grandin 
AuthorDate: Fri Jan 27 08:50:04 2023 +0200
Commit: Andras Timar 
CommitDate: Sat Feb 4 06:18:21 2023 +

fix online crash in WIndow::IsTracking

/opt/collaboraoffice/program/libmergedlo.so
  vcl::Window::IsTracking() const
  
/home/collabora/jenkins/workspace/build_core_co-22.05_for_online_snapshot/vcl/source/window/window2.cxx:340
/opt/collaboraoffice/program/libmergedlo.so
  (anonymous namespace)::LOKPostAsyncEvent(void*, void*)
  
/home/collabora/jenkins/workspace/build_core_co-22.05_for_online_snapshot/sfx2/source/view/lokhelper.cxx:812
/opt/collaboraoffice/program/libmergedlo.so
  LokChartHelper::postMouseEvent(int, int, int, int, int, int, double, 
double)
  
/home/collabora/jenkins/workspace/build_core_co-22.05_for_online_snapshot/include/rtl/ref.hxx:128

Change-Id: I204bac7d8f595054abe9b6e8e631c02b26e20361
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146231
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Noel Grandin 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146548
Tested-by: Jenkins
Reviewed-by: Andras Timar 

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 978dc0b6ecf8..87db8e470e21 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -339,6 +339,8 @@ void Window::EndTracking( TrackingEventFlags nFlags )
 
 bool Window::IsTracking() const
 {
+if (!mpWindowImpl)
+return false;
 return (mpWindowImpl->mbUseFrameData ?
 mpWindowImpl->mpFrameData->mpTrackWin == this :
 ImplGetSVData()->mpWinData->mpTrackWin == this);


[Libreoffice-commits] core.git: 2 commits - vcl/source

2023-01-07 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/itiff/itiff.cxx |4 +++-
 vcl/source/gdi/metaact.cxx|2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit ab2a44f81bf5035fe85f3fb7494a910a75055041
Author: Caolán McNamara 
AuthorDate: Fri Jan 6 20:38:57 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Jan 7 10:56:44 2023 +

ofz#54567 Out-of-memory

Change-Id: If7a3f75aea614bf136049efc9d04ff404acbb170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145165
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index a611810a9aec..a306317b60b0 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -127,6 +127,7 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
 Animation aAnimation;
 
 const bool bFuzzing = utl::ConfigManager::IsFuzzing();
+uint64_t nTotalPixelsRequired = 0;
 
 do
 {
@@ -160,7 +161,8 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
 {
 const uint64_t MAX_PIXEL_SIZE = 15000;
 const uint64_t MAX_TILE_SIZE = 1;
-if (TIFFTileSize64(tif) > MAX_TILE_SIZE || nPixelsRequired > 
MAX_PIXEL_SIZE)
+nTotalPixelsRequired += nPixelsRequired;
+if (TIFFTileSize64(tif) > MAX_TILE_SIZE || nTotalPixelsRequired > 
MAX_PIXEL_SIZE)
 {
 SAL_WARN("filter.tiff", "skipping large tiffs");
 break;
commit 8ddb962846020d1534454fdeea628bb72d92ba40
Author: Caolán McNamara 
AuthorDate: Fri Jan 6 20:27:01 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Jan 7 10:56:36 2023 +

ofz#54707 Integer-overflow

Change-Id: I3b448ed2752bfbffa2f38db3fe0d4099b9f83b2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145164
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx
index c3d1d11b9a4c..cbec9f54a1d5 100644
--- a/vcl/source/gdi/metaact.cxx
+++ b/vcl/source/gdi/metaact.cxx
@@ -1152,6 +1152,8 @@ MetaMaskScaleAction::MetaMaskScaleAction( const Point& 
rPt, const Size& rSz,
 
 void MetaMaskScaleAction::Execute( OutputDevice* pOut )
 {
+if (!AllowRect(pOut->LogicToPixel(tools::Rectangle(maPt, maSz
+return;
 pOut->DrawMask( maPt, maSz, maBmp, maColor );
 }
 


[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-11-09 Thread Caolán McNamara (via logerrit)
 vcl/source/graphic/UnoGraphicProvider.cxx |6 +++---
 vcl/source/helper/commandinfoprovider.cxx |   11 ---
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit cb8a05bfccf77d5217f4f2e20b5898d6a24f990d
Author: Caolán McNamara 
AuthorDate: Wed Nov 9 12:34:06 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 9 16:37:09 2022 +0100

Related: tdf#151898 set origin for implLoadRepositoryImage XGraphics

like we do when we get one from Image so we can treat these with the
same shortcuts we do for Image to have the option to pass the
underlying svg data to the final widget it ends up in

Change-Id: I13a5aecc73821e88f1958e1e1e9e7322628cce6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142484
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index 1f33a14ea1bc..f0e0d12e7895 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -143,7 +143,6 @@ uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadMemory( std::u16s
 return xRet;
 }
 
-
 uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadRepositoryImage( std::u16string_view rResourceURL )
 {
 uno::Reference< ::graphic::XGraphic >   xRet;
@@ -154,13 +153,14 @@ uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadRepositoryImage(
 BitmapEx aBitmap;
 if ( vcl::ImageRepository::loadImage( OUString(sPathName), aBitmap ) )
 {
-xRet = Graphic(aBitmap).GetXGraphic();
+Graphic aGraphic(aBitmap);
+aGraphic.setOriginURL(OUString(rResourceURL));
+xRet = aGraphic.GetXGraphic();
 }
 }
 return xRet;
 }
 
-
 uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( 
std::u16string_view rResourceURL )
 {
 uno::Reference< ::graphic::XGraphic >   xRet;
commit b2cde58886c8a08fe240f74af6c4f257c15d2835
Author: Caolán McNamara 
AuthorDate: Wed Nov 9 11:36:40 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Nov 9 16:36:54 2022 +0100

don't need to ctor and assign, just ctor

Change-Id: I0ad410205350c7d035c8e645f00344d3e5641def
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142483
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/helper/commandinfoprovider.cxx 
b/vcl/source/helper/commandinfoprovider.cxx
index 5c280bb663c3..eb964b34b8ee 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -360,10 +360,9 @@ Reference GetXGraphicForCommand(const 
OUString& rsCommandName
 Reference 
xDocUICfgMgr(xSupplier->getUIConfigurationManager());
 Reference 
xDocImgMgr(xDocUICfgMgr->getImageManager(), UNO_QUERY);
 
-Sequence< Reference > aGraphicSeq;
 Sequence aImageCmdSeq { rsCommandName };
 
-aGraphicSeq = xDocImgMgr->getImages( nImageType, aImageCmdSeq );
+Sequence> aGraphicSeq = 
xDocImgMgr->getImages(nImageType, aImageCmdSeq);
 Reference xGraphic = aGraphicSeq[0];
 if (xGraphic.is())
 return xGraphic;
@@ -373,17 +372,15 @@ Reference GetXGraphicForCommand(const 
OUString& rsCommandName
 {
 }
 
-try {
+try
+{
 Reference 
xModuleCfgMgrSupplier(GetModuleConfigurationSupplier());
 Reference 
xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
-
-Sequence< Reference > aGraphicSeq;
 Reference 
xModuleImageManager(xUICfgMgr->getImageManager(), UNO_QUERY);
 
 Sequence aImageCmdSeq { rsCommandName };
 
-aGraphicSeq = xModuleImageManager->getImages(nImageType, aImageCmdSeq);
-
+Sequence> aGraphicSeq = 
xModuleImageManager->getImages(nImageType, aImageCmdSeq);
 Reference xGraphic(aGraphicSeq[0]);
 
 return xGraphic;


[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-09-21 Thread Noel Grandin (via logerrit)
 vcl/source/fontsubset/sft.cxx |   47 ++
 1 file changed, 16 insertions(+), 31 deletions(-)

New commits:
commit fd49a057c9d0fc3a184097f4f3bcb6835eb70edb
Author: Noel Grandin 
AuthorDate: Tue Sep 20 21:27:09 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 21 10:19:28 2022 +0200

use more unique_ptr

Change-Id: I7836a1b1813d16db53ca0d6cc2b2ff2ae95e70cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140267
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 3cf0ccf4735c..b96d924b2253 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace vcl
 {
@@ -126,9 +127,8 @@ private:
 class GlyphOffsets {
 public:
 GlyphOffsets(sal_uInt8 *sfntP, sal_uInt32 sfntLen);
-~GlyphOffsets();
 sal_uInt32 nGlyphs;   /* number of glyphs in the font + 1 */
-sal_uInt32 *offs; /* array of nGlyphs offsets */
+std::unique_ptr offs; /* array of nGlyphs 
offsets */
 };
 
 }
@@ -1964,7 +1964,7 @@ GlyphOffsets::GlyphOffsets(sal_uInt8 *sfntP, sal_uInt32 
sfntLen)
 
 this->nGlyphs = locaLen / ((indexToLocFormat == 1) ? 4 : 2);
 assert(this->nGlyphs != 0);
-this->offs = static_cast(scalloc(this->nGlyphs, 
sizeof(sal_uInt32)));
+this->offs = std::make_unique(this->nGlyphs);
 
 for (sal_uInt32 i = 0; i < this->nGlyphs; i++) {
 if (indexToLocFormat == 1) {
@@ -1975,11 +1975,6 @@ GlyphOffsets::GlyphOffsets(sal_uInt8 *sfntP, sal_uInt32 
sfntLen)
 }
 }
 
-GlyphOffsets::~GlyphOffsets()
-{
-free(this->offs);
-}
-
 static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen)
 {
 if (sfntLen < 12)
commit 4df352d39602c1b45c5cf156d9dee2c148418dc0
Author: Noel Grandin 
AuthorDate: Tue Sep 20 21:20:12 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 21 10:19:14 2022 +0200

convert GlyphOffsets to a C++ class

Change-Id: If693a5d0a94da666fd0361d45a3047890d9dec8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140265
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 9794cc23f118..3cf0ccf4735c 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -123,20 +123,16 @@ private:
 int total = 0;
 };
 
-struct GlyphOffsets {
+class GlyphOffsets {
+public:
+GlyphOffsets(sal_uInt8 *sfntP, sal_uInt32 sfntLen);
+~GlyphOffsets();
 sal_uInt32 nGlyphs;   /* number of glyphs in the font + 1 */
 sal_uInt32 *offs; /* array of nGlyphs offsets */
 };
 
 }
 
-static void *smalloc(size_t size)
-{
-void *res = malloc(size);
-assert(res != nullptr);
-return res;
-}
-
 static void *scalloc(size_t n, size_t size)
 {
 void *res = calloc(n, size);
@@ -1929,9 +1925,8 @@ bool CreateCFFfontSubset(const unsigned char* pFontBytes, 
int nByteLength,
 return bRet;
 }
 
-static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP, sal_uInt32 sfntLen)
+GlyphOffsets::GlyphOffsets(sal_uInt8 *sfntP, sal_uInt32 sfntLen)
 {
-GlyphOffsets* res = 
static_cast(smalloc(sizeof(GlyphOffsets)));
 sal_uInt8 *loca = nullptr;
 sal_uInt16 numTables = GetUInt16(sfntP, 4);
 sal_uInt32 locaLen = 0;
@@ -1967,26 +1962,22 @@ static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP, 
sal_uInt32 sfntLen)
 }
 }
 
-res->nGlyphs = locaLen / ((indexToLocFormat == 1) ? 4 : 2);
-assert(res->nGlyphs != 0);
-res->offs = static_cast(scalloc(res->nGlyphs, 
sizeof(sal_uInt32)));
+this->nGlyphs = locaLen / ((indexToLocFormat == 1) ? 4 : 2);
+assert(this->nGlyphs != 0);
+this->offs = static_cast(scalloc(this->nGlyphs, 
sizeof(sal_uInt32)));
 
-for (sal_uInt32 i = 0; i < res->nGlyphs; i++) {
+for (sal_uInt32 i = 0; i < this->nGlyphs; i++) {
 if (indexToLocFormat == 1) {
-res->offs[i] = GetUInt32(loca, i * 4);
+this->offs[i] = GetUInt32(loca, i * 4);
 } else {
-res->offs[i] = GetUInt16(loca, i * 2) << 1;
+this->offs[i] = GetUInt16(loca, i * 2) << 1;
 }
 }
-return res;
 }
 
-static void GlyphOffsetsDispose(GlyphOffsets *_this)
+GlyphOffsets::~GlyphOffsets()
 {
-if (_this) {
-free(_this->offs);
-free(_this);
-}
+free(this->offs);
 }
 
 static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen)
@@ -2004,7 +1995,7 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, 
sal_uInt32 sfntLen)
 
 HexFmt h(outf);
 sal_uInt16 i, numTables = GetUInt16(sfntP, 4);
-GlyphOffsets *go = GlyphOffsetsNew(sfntP, sfntLen);
+GlyphOffsets go(sfntP, sfntLen);
 sal_uInt8 const pad[] = {0,0,0,0}; /* zeroes   
*/
 
 if (numTables > nMaxPossibleTables)
@@ -2060,9 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-08-22 Thread offtkp (via logerrit)
 vcl/source/filter/GraphicFormatDetector.cxx |  172 +++-
 vcl/source/filter/graphicfilter2.cxx|  199 +---
 2 files changed, 180 insertions(+), 191 deletions(-)

New commits:
commit 6a2fd2d07ed1cb7713776b32ff175b300ee732e9
Author: offtkp 
AuthorDate: Sat Aug 13 12:02:01 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Mon Aug 22 18:04:54 2022 +0200

Remove code duplication in GraphicDescriptor for PNG

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for PNG files

Change-Id: I8ce1c5eee44ff4122f4ecf1094d3d8b18379c6b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138226
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index 43e403e59936..5b5ccf33d004 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -645,6 +645,102 @@ bool GraphicFormatDetector::checkPNG()
 if (mnFirstLong == 0x89504e47 && mnSecondLong == 0x0d0a1a0a)
 {
 maMetadata.mnFormat = GraphicFileFormat::PNG;
+if (mbExtendedInfo)
+{
+sal_uInt32 nTemp32;
+mrStream.Seek(mnStreamPosition + 8);
+do
+{
+sal_uInt8 cByte = 0;
+
+// IHDR-Chunk
+mrStream.SeekRel(8);
+
+// width
+mrStream.ReadUInt32(nTemp32);
+if (!mrStream.good())
+break;
+maMetadata.maPixSize.setWidth(nTemp32);
+
+// height
+mrStream.ReadUInt32(nTemp32);
+if (!mrStream.good())
+break;
+maMetadata.maPixSize.setHeight(nTemp32);
+
+// Bits/Pixel
+mrStream.ReadUChar(cByte);
+if (!mrStream.good())
+break;
+maMetadata.mnBitsPerPixel = cByte;
+
+// Colour type - check whether it supports alpha values
+sal_uInt8 cColType = 0;
+mrStream.ReadUChar(cColType);
+if (!mrStream.good())
+break;
+maMetadata.mbIsAlpha = maMetadata.mbIsTransparent
+= (cColType == 4 || cColType == 6);
+
+// Planes always 1;
+// compression always
+maMetadata.mnPlanes = 1;
+
+sal_uInt32 nLen32 = 0;
+nTemp32 = 0;
+
+mrStream.SeekRel(7);
+
+// read up to the start of the image
+mrStream.ReadUInt32(nLen32);
+mrStream.ReadUInt32(nTemp32);
+while (mrStream.good() && nTemp32 != 0x49444154)
+{
+if (nTemp32 == 0x70485973) // physical pixel dimensions
+{
+sal_uLong nXRes;
+sal_uLong nYRes;
+
+// horizontal resolution
+nTemp32 = 0;
+mrStream.ReadUInt32(nTemp32);
+nXRes = nTemp32;
+
+// vertical resolution
+nTemp32 = 0;
+mrStream.ReadUInt32(nTemp32);
+nYRes = nTemp32;
+
+// unit
+cByte = 0;
+mrStream.ReadUChar(cByte);
+
+if (cByte)
+{
+if (nXRes)
+maMetadata.maLogSize.setWidth(
+(maMetadata.maPixSize.Width() * 10) / 
nXRes);
+
+if (nYRes)
+maMetadata.maLogSize.setHeight(
+(maMetadata.maPixSize.Height() * 10) / 
nYRes);
+}
+
+nLen32 -= 9;
+}
+else if (nTemp32 == 0x74524e53) // transparency
+{
+maMetadata.mbIsTransparent = true;
+maMetadata.mbIsAlpha = (cColType != 0 && cColType != 
2);
+}
+
+// skip forward to next chunk
+mrStream.SeekRel(4 + nLen32);
+mrStream.ReadUInt32(nLen32);
+mrStream.ReadUInt32(nTemp32);
+}
+} while (false);
+}
 return true;
 }
 return false;
diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 0ef05ef1db9d..4327ef5e2f59 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -427,113 +427,12 @@ 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-08-22 Thread offtkp (via logerrit)
 vcl/source/filter/GraphicFormatDetector.cxx |8 +
 vcl/source/filter/graphicfilter2.cxx|   43 ++--
 2 files changed, 18 insertions(+), 33 deletions(-)

New commits:
commit c24b88efc4ac80d25d79b9764e6718d0392f718a
Author: offtkp 
AuthorDate: Fri Aug 12 22:04:35 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Mon Aug 22 18:04:02 2022 +0200

Remove code duplication in GraphicDescriptor for RAS

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for RAS files

Change-Id: I736c583a9cc974a9eb4151443295dbb4b1e71053
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138212
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 0706e1b2301c..e622901767e8 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -838,16 +838,12 @@ bool GraphicDescriptor::ImpDetectPPM( SvStream& rStm, 
bool )
 
 bool GraphicDescriptor::ImpDetectRAS( SvStream& rStm, bool )
 {
-sal_uInt32 nMagicNumber = 0;
-bool bRet = false;
 sal_Int32 nStmPos = rStm.Tell();
-rStm.SetEndian( SvStreamEndian::BIG );
-rStm.ReadUInt32( nMagicNumber );
-if ( nMagicNumber == 0x59a66a95 )
-{
-aMetadata.mnFormat = GraphicFileFormat::RAS;
-bRet = true;
-}
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false /* 
bExtendedInfo */ );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkRAS();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
 rStm.Seek( nStmPos );
 return bRet;
 }
commit 0853187cbc66f17620c2951d24d1f71c9ea9f81a
Author: offtkp 
AuthorDate: Fri Aug 12 22:01:58 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Mon Aug 22 18:03:53 2022 +0200

Remove code duplication in GraphicDescriptor for WEBP

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for WEBP files

Change-Id: Ib9d7169433b391e2520d6b9bca831fa964a8d136
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138211
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index 684298ac773a..0bd3394bc99d 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 constexpr sal_uInt32 SVG_CHECK_SIZE = 2048;
@@ -884,6 +885,13 @@ bool GraphicFormatDetector::checkWEBP()
 && maFirstBytes[10] == 'B' && maFirstBytes[11] == 'P')
 {
 maMetadata.mnFormat = GraphicFileFormat::WEBP;
+if (mbExtendedInfo)
+{
+mrStream.Seek(mnStreamPosition);
+ReadWebpInfo(mrStream, maMetadata.maPixSize, 
maMetadata.mnBitsPerPixel,
+ maMetadata.mbIsAlpha);
+maMetadata.mbIsTransparent = maMetadata.mbIsAlpha;
+}
 return true;
 }
 return false;
diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 93588c40c229..0706e1b2301c 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include "graphicfilter_internal.hxx"
 
@@ -1081,30 +1080,12 @@ bool GraphicDescriptor::ImpDetectSVG( SvStream& rStm, 
bool /*bExtendedInfo*/ )
 
 bool GraphicDescriptor::ImpDetectWEBP( SvStream& rStm, bool bExtendedInfo )
 {
-sal_uInt32  nTemp32 = 0;
-boolbRet = false;
-
 sal_Int32 nStmPos = rStm.Tell();
-rStm.SetEndian( SvStreamEndian::BIG );
-rStm.ReadUInt32( nTemp32 );
-
-if ( nTemp32 == 0x52494646 )
-{
-rStm.ReadUInt32( nTemp32 ); // skip
-rStm.ReadUInt32( nTemp32 );
-if ( nTemp32 == 0x57454250 )
-{
-aMetadata.mnFormat = GraphicFileFormat::WEBP;
-bRet = true;
-
-if ( bExtendedInfo )
-{
-rStm.Seek(nStmPos);
-ReadWebpInfo(rStm, aMetadata.maPixSize, 
aMetadata.mnBitsPerPixel, aMetadata.mbIsAlpha );
-aMetadata.mbIsTransparent = aMetadata.mbIsAlpha;
-}
-}
-}
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, bExtendedInfo );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkWEBP();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
 rStm.Seek( nStmPos );
 return bRet;
 }


[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-08-22 Thread offtkp (via logerrit)
 vcl/source/filter/graphicfilter2.cxx |   26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 3682ef9da1ba3b6479e6bd6bf6d9705c784b4fd4
Author: offtkp 
AuthorDate: Fri Aug 12 21:35:25 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Mon Aug 22 18:03:17 2022 +0200

Remove code duplication in GraphicDescriptor for MET

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for MET files

Change-Id: I3188fe4bcdd5e0d9a942c6606d28a01c56319619
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138210
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 59b468a5317e..93588c40c229 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -943,12 +943,15 @@ bool GraphicDescriptor::ImpDetectDXF( SvStream& rStm, 
bool )
 return bRet;
 }
 
-bool GraphicDescriptor::ImpDetectMET( SvStream&, bool )
+bool GraphicDescriptor::ImpDetectMET( SvStream& rStm, bool )
 {
-bool bRet = aPathExt.startsWith( "met" );
-if (bRet)
-aMetadata.mnFormat = GraphicFileFormat::MET;
-
+sal_Int32 nStmPos = rStm.Tell();
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false 
/*bExtendedInfo*/ );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkMET();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
+rStm.Seek( nStmPos );
 return bRet;
 }
 
commit a1b2a8370e61ada2690a29a623d55b38bd7a7cf3
Author: offtkp 
AuthorDate: Fri Aug 12 21:30:19 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Mon Aug 22 18:03:05 2022 +0200

Remove code duplication in GraphicDescriptor for TGA

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for TGA files

Change-Id: I939426d3016c90500c2a250ef464213b0fd7d642
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138209
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 01741afa7ec2..59b468a5317e 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -853,12 +853,15 @@ bool GraphicDescriptor::ImpDetectRAS( SvStream& rStm, 
bool )
 return bRet;
 }
 
-bool GraphicDescriptor::ImpDetectTGA( SvStream&, bool )
+bool GraphicDescriptor::ImpDetectTGA( SvStream& rStm, bool )
 {
-bool bRet = aPathExt.startsWith( "tga" );
-if (bRet)
-aMetadata.mnFormat = GraphicFileFormat::TGA;
-
+sal_Int32 nStmPos = rStm.Tell();
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false /* 
bExtendedInfo */ );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkTGA();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
+rStm.Seek( nStmPos );
 return bRet;
 }
 


[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-08-19 Thread offtkp (via logerrit)
 vcl/source/filter/graphicfilter2.cxx|   35 
 vcl/source/graphic/UnoGraphicDescriptor.cxx |1 
 2 files changed, 16 insertions(+), 20 deletions(-)

New commits:
commit e2043fd557200efc71ac8f014b79a40be2eaef76
Author: offtkp 
AuthorDate: Fri Aug 12 12:34:09 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:25:55 2022 +0200

Remove code duplication in GraphicDescriptor for PCT

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for PCT files

Change-Id: I67b9d2ada18d5c141dd108564a4e8b632fc7299a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138189
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 2061b1a5b531..3ffe27991dd9 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -978,21 +978,13 @@ bool GraphicDescriptor::ImpDetectMET( SvStream&, bool )
 
 bool GraphicDescriptor::ImpDetectPCT( SvStream& rStm, bool )
 {
-bool bRet = aPathExt.startsWith( "pct" );
-if (bRet)
-aMetadata.mnFormat = GraphicFileFormat::PCT;
-else
-{
-sal_uInt64 const nStreamPos = rStm.Tell();
-sal_uInt64 const nStreamLen = rStm.remainingSize();
-if (isPCT(rStm, nStreamPos, nStreamLen))
-{
-bRet = true;
-aMetadata.mnFormat = GraphicFileFormat::PCT;
-}
-rStm.Seek(nStreamPos);
-}
-
+sal_Int32 nStmPos = rStm.Tell();
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false 
/*bExtendedInfo*/ );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkPCT();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
+rStm.Seek( nStmPos );
 return bRet;
 }
 
commit ea75ae547eaf69f7b4063264fe4c811d044a5798
Author: offtkp 
AuthorDate: Thu Aug 11 01:57:21 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:25:39 2022 +0200

Remove code duplication in GraphicDescriptor for SVG

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for SVG files

Change-Id: I5ababbd43ece4e8c08c5833895dc0b56ad467f77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138102
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 5ad698169dad..2061b1a5b531 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -1096,12 +1096,15 @@ bool GraphicDescriptor::ImpDetectEMF(SvStream& rStm, 
bool bExtendedInfo)
 return bRet;
 }
 
-bool GraphicDescriptor::ImpDetectSVG( SvStream& /*rStm*/, bool 
/*bExtendedInfo*/ )
+bool GraphicDescriptor::ImpDetectSVG( SvStream& rStm, bool /*bExtendedInfo*/ )
 {
-bool bRet = aPathExt.startsWith( "svg" );
-if (bRet)
-aMetadata.mnFormat = GraphicFileFormat::SVG;
-
+sal_Int32 nStmPos = rStm.Tell();
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false 
/*bExtendedInfo*/ );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkSVG();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
+rStm.Seek( nStmPos );
 return bRet;
 }
 
diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx 
b/vcl/source/graphic/UnoGraphicDescriptor.cxx
index ca25e5c6d964..b9daeeab6b61 100644
--- a/vcl/source/graphic/UnoGraphicDescriptor.cxx
+++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx
@@ -139,6 +139,7 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const 
OUString* pURL )
 case GraphicFileFormat::EMF: pMimeType = MIMETYPE_EMF; cType = 
graphic::GraphicType::VECTOR; break;
 case GraphicFileFormat::EMZ: pMimeType = MIMETYPE_EMF; cType = 
graphic::GraphicType::VECTOR; break;
 case GraphicFileFormat::SVG: pMimeType = MIMETYPE_SVG; cType = 
graphic::GraphicType::VECTOR; break;
+case GraphicFileFormat::SVGZ: pMimeType = MIMETYPE_SVG; cType = 
graphic::GraphicType::VECTOR; break;
 
 default:
 break;


[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-08-19 Thread offtkp (via logerrit)
 vcl/source/filter/graphicfilter2.cxx |   26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 735c6412deb4934e28ded552466be034a7b7b3fe
Author: offtkp 
AuthorDate: Wed Aug 10 01:01:45 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:25:29 2022 +0200

Remove code duplication in GraphicDescriptor for XPM

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for XPM files

Change-Id: I9a5919cb4144edf70edc71ed89ab2cb0d605158a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138070
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index 331cf12f0feb..5ad698169dad 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -773,12 +773,15 @@ bool GraphicDescriptor::ImpDetectXBM( SvStream& rStm, 
bool )
 return bRet;
 }
 
-bool GraphicDescriptor::ImpDetectXPM( SvStream&, bool )
+bool GraphicDescriptor::ImpDetectXPM( SvStream& rStm, bool )
 {
-bool bRet = aPathExt.startsWith( "xpm" );
-if (bRet)
-aMetadata.mnFormat = GraphicFileFormat::XPM;
-
+sal_Int32 nStmPos = rStm.Tell();
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false /* 
bExtendedInfo */ );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkXPM();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
+rStm.Seek( nStmPos );
 return bRet;
 }
 
commit ca5e7672d6f0d149373aae00db082758bf3d1715
Author: offtkp 
AuthorDate: Wed Aug 10 00:34:06 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:25:18 2022 +0200

Remove code duplication in GraphicDescriptor for XBM

GraphicFormatDetector and GraphicDescriptor have duplicate format
detection code so now GraphicDescriptor uses GraphicFormatDetector
functions instead to detect the format for XBM files

Change-Id: Id3cf1e573ec3125830299e49f0a99aab7b3fe77e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138069
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/filter/graphicfilter2.cxx 
b/vcl/source/filter/graphicfilter2.cxx
index ea9e5a9480d7..331cf12f0feb 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -761,12 +761,15 @@ bool GraphicDescriptor::ImpDetectTIF( SvStream& rStm, 
bool bExtendedInfo )
 return bRet;
 }
 
-bool GraphicDescriptor::ImpDetectXBM( SvStream&, bool )
+bool GraphicDescriptor::ImpDetectXBM( SvStream& rStm, bool )
 {
-bool bRet = aPathExt.startsWith( "xbm" );
-if (bRet)
-aMetadata.mnFormat = GraphicFileFormat::XBM;
-
+sal_Int32 nStmPos = rStm.Tell();
+vcl::GraphicFormatDetector aDetector( rStm, aPathExt, false /* 
bExtendedInfo */ );
+bool bRet = aDetector.detect();
+bRet &= aDetector.checkXBM();
+if ( bRet )
+aMetadata = aDetector.getMetadata();
+rStm.Seek( nStmPos );
 return bRet;
 }
 


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2022-07-19 Thread offtkp (via logerrit)
 vcl/source/treelist/transfer.cxx |8 
 vcl/unx/gtk3/gtkinst.cxx |9 +
 2 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 7785a62cd74e5924e4ade4d69519966c63a0decf
Author: offtkp 
AuthorDate: Sat Jul 16 19:16:01 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 13:24:22 2022 +0200

Replace old png writer in transfer.cxx

Change-Id: I1423bd4e7650da71f31de50df8a88ee3c09db33b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137135
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 4506fa2ffea7..f2c453792a6f 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -64,7 +64,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -668,9 +668,9 @@ bool TransferableHelper::SetBitmapEx( const BitmapEx& 
rBitmapEx, const DataFlavo
 
 aFilterData.getArray()[aFilterData.getLength() - 1].Value <<= 1;
 #endif
-vcl::PNGWriter aPNGWriter(rBitmapEx, );
-
-aPNGWriter.Write(aMemStm);
+vcl::PngImageWriter aPNGWriter(aMemStm);
+aPNGWriter.setParameters(aFilterData);
+aPNGWriter.write(rBitmapEx);
 }
 else
 {
commit 20d0d2d2ff5ee0b8e1f40ca1adda115a82d974b6
Author: offtkp 
AuthorDate: Sat Jul 16 19:18:43 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 13:24:09 2022 +0200

Replace old png writer in gtkinst.cxx

Change-Id: I5a9aefe1b957b800b5c56f3200d28ef727324cac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137136
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index c88c6886ee85..4aacd3979b4e 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -86,7 +86,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -4814,9 +4814,10 @@ namespace
 // We "know" that this gets passed to zlib's deflateInit2_(). 1 means 
best speed.
 css::uno::Sequence aFilterData{ 
comphelper::makePropertyValue(
 "Compression", sal_Int32(1)) };
-
-vcl::PNGWriter aWriter(aImage.GetBitmapEx(), );
-aWriter.Write(aMemStm);
+auto aBitmapEx = aImage.GetBitmapEx();
+vcl::PngImageWriter aWriter(aMemStm);
+aWriter.setParameters(aFilterData);
+aWriter.write(aBitmapEx);
 
 return load_icon_from_stream(aMemStm);
 }


[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-07-19 Thread offtkp (via logerrit)
 vcl/source/image/ImplImageTree.cxx |6 +++---
 vcl/source/opengl/OpenGLHelper.cxx |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit f5371a2e5367ab4cb1cd62efb18e46872159a94e
Author: offtkp 
AuthorDate: Sat Jul 16 19:13:13 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 13:22:20 2022 +0200

Replace old png writer in OpenGLHelper.cxx

Change-Id: I028db48230fae64a539ee0a7964d73c039289740
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137134
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/opengl/OpenGLHelper.cxx 
b/vcl/source/opengl/OpenGLHelper.cxx
index a0dff4a5f567..b04afad288f3 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -19,7 +19,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -531,9 +531,9 @@ void OpenGLHelper::renderToFile(tools::Long nWidth, 
tools::Long nHeight, const O
 glReadPixels(0, 0, nWidth, nHeight, OptimalBufferFormat(), 
GL_UNSIGNED_BYTE, pBuffer.get());
 BitmapEx aBitmap = ConvertBufferToBitmapEx(pBuffer.get(), nWidth, nHeight);
 try {
-vcl::PNGWriter aWriter( aBitmap );
 SvFileStream sOutput( rFileName, StreamMode::WRITE );
-aWriter.Write( sOutput );
+vcl::PngImageWriter aWriter( sOutput );
+aWriter.write( aBitmap );
 sOutput.Close();
 } catch (...) {
 SAL_WARN("vcl.opengl", "Error writing png to " << rFileName);
commit a91d5e5a69682ac857e39f6d015b6c8470273e96
Author: offtkp 
AuthorDate: Sat Jul 16 19:12:09 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 13:22:04 2022 +0200

Replace old png writer in ImplImageTree.cxx

Change-Id: I26702462ec19056f33a582083e69630bec1fb3a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137133
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/image/ImplImageTree.cxx 
b/vcl/source/image/ImplImageTree.cxx
index 94105a48545d..4489fe1d9e0f 100644
--- a/vcl/source/image/ImplImageTree.cxx
+++ b/vcl/source/image/ImplImageTree.cxx
@@ -55,7 +55,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -381,11 +381,11 @@ bool loadDiskCachedVersion(std::u16string_view sVariant, 
ImageRequestParameters&
 void cacheBitmapToDisk(std::u16string_view sVariant, ImageRequestParameters 
const & rParameters)
 {
 OUString sUrl(createIconCacheUrl(sVariant, rParameters));
-vcl::PNGWriter aWriter(rParameters.mrBitmap);
 try
 {
 SvFileStream aStream(sUrl, StreamMode::WRITE);
-aWriter.Write(aStream);
+vcl::PngImageWriter aWriter(aStream);
+aWriter.write(rParameters.mrBitmap);
 aStream.Close();
 }
 catch (...)


[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-04-12 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/imet/ios2met.cxx |   21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit f0801aba21f20c6305ae2b9083443d74bad01d3e
Author: Caolán McNamara 
AuthorDate: Tue Apr 12 11:36:23 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 12 14:57:27 2022 +0200

ofz#46638 Integer-overflow

Change-Id: Iaf3a6d1b5db1428a4cdfa440ac3484d115a491cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132896
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/imet/ios2met.cxx 
b/vcl/source/filter/imet/ios2met.cxx
index d7fa46a9a6f8..9054a244d62c 100644
--- a/vcl/source/filter/imet/ios2met.cxx
+++ b/vcl/source/filter/imet/ios2met.cxx
@@ -2089,8 +2089,11 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, 
sal_uInt16 nOrderLen)
 sal_uInt16 nLen=nOrderLen;
 (void) ReadCoord(bCoord32); // Width, unused
 auto nHeight = ReadCoord(bCoord32);
-if (nHeight < 0)
+if (nHeight < 0 || nHeight > SAL_MAX_INT16)
+{
+SAL_WARN("filter.os2met", "ignoring out of sane range font 
height: " << nHeight);
 aAttr.nChrCellHeight = aDefAttr.nChrCellHeight;
+}
 else
 aAttr.nChrCellHeight = nHeight;
 if (bCoord32) nLen-=8; else nLen-=4;
commit 71a11d27e2ef8ccf3e7a0f570d53ddb6a86d5a27
Author: Caolán McNamara 
AuthorDate: Tue Apr 12 11:34:53 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Apr 12 14:57:12 2022 +0200

drop unused width variable

Change-Id: I836234f86c01300d1a55e901699fee840efb37dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132895
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/imet/ios2met.cxx 
b/vcl/source/filter/imet/ios2met.cxx
index 2beac50bde2c..d7fa46a9a6f8 100644
--- a/vcl/source/filter/imet/ios2met.cxx
+++ b/vcl/source/filter/imet/ios2met.cxx
@@ -313,7 +313,7 @@ struct OSAttr
 RasterOp eImgBgMix;
 sal_Int32 nArcP, nArcQ, nArcR, nArcS;
 Degree10  nChrAng;
-Size aChrCellSize;
+sal_Int32 nChrCellHeight;
 sal_uInt32 nChrSet;
 PointaCurPos;
 PenStyle eLinStyle;
@@ -1035,7 +1035,7 @@ void OS2METReader::ReadChrStr(bool bGivenPos, bool bMove, 
bool bExtra, sal_uInt1
 if (pF!=nullptr)
 aFont = pF->aFont;
 aFont.SetColor(aAttr.aChrCol);
-aFont.SetFontSize(Size(0,aAttr.aChrCellSize.Height()));
+aFont.SetFontSize(Size(0,aAttr.nChrCellHeight));
 if ( aAttr.nChrAng )
 aFont.SetOrientation(aAttr.nChrAng);
 
@@ -2087,12 +2087,12 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, 
sal_uInt16 nOrderLen)
 [[fallthrough]];
 case GOrdSChCel: {
 sal_uInt16 nLen=nOrderLen;
-auto nWidth = ReadCoord(bCoord32);
+(void) ReadCoord(bCoord32); // Width, unused
 auto nHeight = ReadCoord(bCoord32);
-if (nWidth < 0 || nHeight < 0)
-aAttr.aChrCellSize = aDefAttr.aChrCellSize;
+if (nHeight < 0)
+aAttr.nChrCellHeight = aDefAttr.nChrCellHeight;
 else
-aAttr.aChrCellSize = Size(nWidth, nHeight);
+aAttr.nChrCellHeight = nHeight;
 if (bCoord32) nLen-=8; else nLen-=4;
 if (nLen>=4) {
 pOS2MET->SeekRel(4); nLen-=4;
@@ -2100,8 +2100,8 @@ void OS2METReader::ReadOrder(sal_uInt16 nOrderID, 
sal_uInt16 nOrderLen)
 if (nLen>=2) {
 sal_uInt8 nbyte(0);
 pOS2MET->ReadUChar( nbyte );
-if ((nbyte&0x80)==0 && aAttr.aChrCellSize==Size(0,0))
-aAttr.aChrCellSize = aDefAttr.aChrCellSize;
+if ((nbyte&0x80)==0 && aAttr.nChrCellHeight == 0)
+aAttr.nChrCellHeight = aDefAttr.nChrCellHeight;
 }
 break;
 }
@@ -2757,7 +2757,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, 
GDIMetaFile & rGDIMetaF
 aDefAttr.nArcR   =0;
 aDefAttr.nArcS   =0;
 aDefAttr.nChrAng =0_deg10;
-aDefAttr.aChrCellSize=Size(12,12);
+aDefAttr.nChrCellHeight = 12;
 aDefAttr.nChrSet =0;
 aDefAttr.aCurPos =Point(0,0);
 aDefAttr.eLinStyle   =PEN_SOLID;


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/workben

2022-03-06 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/svm/SvmConverter.cxx |   18 ++
 vcl/source/filter/svm/SvmConverter.hxx |2 ++
 vcl/source/outdev/hatch.cxx|7 +++
 vcl/workben/fftester.cxx   |   28 ++--
 vcl/workben/svmfuzzer.cxx  |   11 +++
 5 files changed, 44 insertions(+), 22 deletions(-)

New commits:
commit 2e6a7db11b8cfbf326789600393549e9c01d24cd
Author: Caolán McNamara 
AuthorDate: Sun Mar 6 15:49:28 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 6 18:30:44 2022 +0100

ofz: Too many hatch points

Change-Id: I08cb9d09a9bb48ab31763f50bc2fa23cf723330f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131079
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 31bcf6e71ba1..c85febe3a38f 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -373,7 +373,14 @@ void OutputDevice::DrawHatchLine( const tools::Line& 
rLine, const tools::PolyPol
 nAdd = 1;
 
 if( nAdd )
+{
+if (nPCounter == HATCH_MAXPOINTS)
+{
+SAL_WARN("vcl.gdi", "too many hatch points");
+return;
+}
 pPtBuffer[ nPCounter++ ] = Point( FRound( fX ), 
FRound( fY ) );
+}
 }
 
 aCurSegment.SetStart( aCurSegment.GetEnd() );
commit 434d852762eafe7230299ea6110096b9ac8bb98d
Author: Caolán McNamara 
AuthorDate: Sun Mar 6 15:39:18 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 6 18:30:27 2022 +0100

ofz#45276 uncaught exception

Change-Id: I5863d6474aa47f24b24a15481c8329a5e587a8d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131078
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/svm/SvmConverter.cxx 
b/vcl/source/filter/svm/SvmConverter.cxx
index 004abcd4d751..36fc1d43f7db 100644
--- a/vcl/source/filter/svm/SvmConverter.cxx
+++ b/vcl/source/filter/svm/SvmConverter.cxx
@@ -33,6 +33,7 @@
 
 #include "SvmConverter.hxx"
 
+#include 
 #include 
 #include 
 #include 
@@ -1268,4 +1269,21 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 rIStm.SetEndian( nOldFormat );
 }
 
+bool TestImportSVM(SvStream& rStream)
+{
+GDIMetaFile aGDIMetaFile;
+SvmReader aReader(rStream);
+aReader.Read(aGDIMetaFile);
+ScopedVclPtrInstance aVDev;
+try
+{
+aGDIMetaFile.Play(*aVDev);
+}
+catch (const boost::bad_rational&)
+{
+return false;
+}
+return true;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/svm/SvmConverter.hxx 
b/vcl/source/filter/svm/SvmConverter.hxx
index 459f327d409c..23185dc04b4b 100644
--- a/vcl/source/filter/svm/SvmConverter.hxx
+++ b/vcl/source/filter/svm/SvmConverter.hxx
@@ -85,6 +85,8 @@ private:
 SVMConverter&   operator=( const SVMConverter& ) = delete;
 };
 
+extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportSVM(SvStream& rStream);
+
 #endif // INCLUDED_VCL_INC_SVMCONVERTER_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 7938f0011b38..4950341462a8 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -182,15 +182,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 SvFileStream aFileStream(out, StreamMode::READ);
 ret = static_cast(ReadDIB(aTarget, aFileStream, true));
 }
-else if (strcmp(argv[2], "svm") == 0)
-{
-GDIMetaFile aGDIMetaFile;
-SvFileStream aFileStream(out, StreamMode::READ);
-SvmReader aReader(aFileStream);
-aReader.Read(aGDIMetaFile);
-ScopedVclPtrInstance aVDev;
-aGDIMetaFile.Play(*aVDev);
-}
 else if (strcmp(argv[2], "pcd") == 0)
 {
 Graphic aGraphic;
@@ -263,6 +254,13 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 SvFileStream aFileStream(out, StreamMode::READ);
 ret = static_cast(ImportWebpGraphic(aFileStream, aGraphic));
 }
+else if (strcmp(argv[2], "sft") == 0)
+{
+SvFileStream aFileStream(out, StreamMode::READ);
+std::vector aData(aFileStream.remainingSize());
+aFileStream.ReadBytes(aData.data(), aData.size());
+ret = TestFontSubset(aData.data(), aData.size());
+}
 #ifndef DISABLE_DYNLOADING
 else if ((strcmp(argv[2], "doc") == 0) || (strcmp(argv[2], "ww8") == 
0))
 {
@@ -524,14 +522,16 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 SvFileStream aFileStream(out, StreamMode::READ);
 ret = static_cast((*pfnImport)(aFileStream));
 }
-else if 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2022-01-24 Thread Szymon Kłos (via logerrit)
 vcl/source/window/cursor.cxx |   15 ++-
 vcl/source/window/paint.cxx  |   19 +--
 2 files changed, 27 insertions(+), 7 deletions(-)

New commits:
commit c892b224bee72c35e145f0f190b3fec64ac343e1
Author: Szymon Kłos 
AuthorDate: Thu Jan 13 19:58:34 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 24 09:46:10 2022 +0100

RTL: lok: mirror cursor position when needed

Change-Id: I3e574e1b1d5e26528794c39cb631d8f5cf60e927
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128390
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128836
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 09406b927e00..45f2f6d46282 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -256,7 +256,20 @@ void vcl::Cursor::LOKNotify( vcl::Window* pWindow, const 
OUString& rAction )
 if (!aSize.Width())
 aSize.setWidth( 
pWindow->GetSettings().GetStyleSettings().GetCursorSize() );
 
-const tools::Rectangle aRect(Point(nX, nY), aSize);
+Point aPos(nX, nY);
+
+if (pWindow->IsRTLEnabled() && pWindow->GetOutDev() && 
pParent->GetOutDev()
+&& !pWindow->GetOutDev()->ImplIsAntiparallel())
+pParent->GetOutDev()->ReMirror(aPos);
+
+if (!pWindow->IsRTLEnabled() && pWindow->GetOutDev() && 
pParent->GetOutDev()
+&& pWindow->GetOutDev()->ImplIsAntiparallel())
+{
+pWindow->GetOutDev()->ReMirror(aPos);
+pParent->GetOutDev()->ReMirror(aPos);
+}
+
+const tools::Rectangle aRect(aPos, aSize);
 aItems.emplace_back("rectangle", aRect.toString());
 }
 
commit 26a57a59b9ca8af2f9584e292f03655c02fc2698
Author: Szymon Kłos 
AuthorDate: Thu Jan 13 11:04:36 2022 +0100
Commit: Szymon Kłos 
CommitDate: Mon Jan 24 09:45:56 2022 +0100

RTL: lok: render tunneled dialogs mirrored

Change-Id: I14d33706eddb99167cf5537f6ece379124187bf2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128371
Reviewed-by: Henry Castro 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128835
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index b2b7db7b6557..49fd65f8c5fe 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1211,13 +1211,14 @@ void Window::PixelInvalidate(const tools::Rectangle* 
pRectangle)
 {
 // In case we are routing the window, notify the client
 std::vector aPayload;
+tools::Rectangle aRect(Point(0, 0), aSize);
 if (pRectangle)
-aPayload.emplace_back("rectangle", pRectangle->toString());
-else
-{
-const tools::Rectangle aRect(Point(0, 0), aSize);
-aPayload.emplace_back("rectangle", aRect.toString());
-}
+aRect = *pRectangle;
+
+if (IsRTLEnabled() && GetOutDev() && 
!GetOutDev()->ImplIsAntiparallel())
+GetOutDev()->ReMirror(aRect);
+
+aPayload.emplace_back("rectangle", aRect.toString());
 
 pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload);
 }
@@ -1353,6 +1354,7 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 if (comphelper::LibreOfficeKit::isActive())
 {
 VclPtrInstance pDevice(*i_pTargetOutDev);
+pDevice->EnableRTL(IsRTLEnabled());
 
 Size aSize(GetOutputSizePixel());
 pDevice->SetOutputSizePixel(aSize);
@@ -1405,6 +1407,8 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 
 i_pTargetOutDev->DrawOutDev(i_rPos, aSize, Point(), 
pDevice->PixelToLogic(aSize), *pDevice);
 
+bool bHasMirroredGraphics = pDevice->HasMirroredGraphics();
+
 // get rid of virtual device now so they don't pile up during 
recursive calls
 pDevice.disposeAndClear();
 
@@ -1414,6 +1418,9 @@ void Window::ImplPaintToDevice( OutputDevice* 
i_pTargetOutDev, const Point& i_rP
 if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && 
pChild->IsVisible() )
 {
 tools::Long nDeltaX = pChild->GetOutDev()->mnOutOffX - 
GetOutDev()->mnOutOffX;
+if( bHasMirroredGraphics )
+nDeltaX = GetOutDev()->mnOutWidth - nDeltaX - 
pChild->GetOutDev()->mnOutWidth;
+
 tools::Long nDeltaY = pChild->GetOutDev()->mnOutOffY - 
GetOutDev()->mnOutOffY;
 
 Point aPos( i_rPos );


[Libreoffice-commits] core.git: 2 commits - vcl/source

2021-09-02 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/ipcd/ipcd.cxx |   87 
 1 file changed, 36 insertions(+), 51 deletions(-)

New commits:
commit 58da51715425d781b5b8b9b9e412c98daf80b601
Author: Caolán McNamara 
AuthorDate: Thu Sep 2 09:21:11 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 2 18:18:58 2021 +0200

convert malloc/free to std::vector

Change-Id: Icc9bb8cd6851ee027d5a5469c78d26cf6a943708
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121501
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/ipcd/ipcd.cxx b/vcl/source/filter/ipcd/ipcd.cxx
index 1ce59f20c1bb..220ac6111012 100644
--- a/vcl/source/filter/ipcd/ipcd.cxx
+++ b/vcl/source/filter/ipcd/ipcd.cxx
@@ -193,33 +193,27 @@ void PCDReader::ReadImage()
 sal_uInt32 nH2 = nHeight>>1;
 
 // luminance for each pixel of the 1st row of the current pair of rows
-sal_uInt8* pL0 = static_cast(std::malloc( nWidth ));
+std::vector aL0(nWidth);
 // luminance for each pixel of the 2nd row of the current pair of rows
-sal_uInt8* pL1 = static_cast(std::malloc( nWidth ));
+std::vector aL1(nWidth);
 // blue chrominance for each 2x2 pixel of the current pair of rows
-sal_uInt8* pCb = static_cast(std::malloc( nW2+1 ));
+std::vector aCb(nW2 + 1);
 // red chrominance for each 2x2 pixel of the current pair of rows
-sal_uInt8* pCr = static_cast(std::malloc( nW2+1 ));
+std::vector aCr(nW2 + 1);
 // like above, but for the next pair of rows
-sal_uInt8* pL0N = static_cast(std::malloc( nWidth ));
-sal_uInt8* pL1N = static_cast(std::malloc( nWidth ));
-sal_uInt8* pCbN = static_cast(std::malloc( nW2+1 ));
-sal_uInt8* pCrN = static_cast(std::malloc( nW2+1 ));
-
-if ( pL0 == nullptr || pL1 == nullptr || pCb == nullptr || pCr == nullptr 
||
-pL0N == nullptr || pL1N == nullptr || pCbN == nullptr || pCrN == 
nullptr)
-{
-std::free(static_cast(pL0) );
-std::free(static_cast(pL1) );
-std::free(static_cast(pCb) );
-std::free(static_cast(pCr) );
-std::free(static_cast(pL0N));
-std::free(static_cast(pL1N));
-std::free(static_cast(pCbN));
-std::free(static_cast(pCrN));
-bStatus = false;
-return;
-}
+std::vector aL0N(nWidth);
+std::vector aL1N(nWidth);
+std::vector aCbN(nW2 + 1);
+std::vector aCrN(nW2 + 1);
+
+sal_uInt8* pL0 = aL0.data();
+sal_uInt8* pL1 = aL1.data();
+sal_uInt8* pCb = aCb.data();
+sal_uInt8* pCr = aCr.data();
+sal_uInt8* pL0N = aL0N.data();
+sal_uInt8* pL1N = aL1N.data();
+sal_uInt8* pCbN = aCbN.data();
+sal_uInt8* pCrN = aCrN.data();
 
 m_rPCD.Seek( nImagePos );
 
@@ -345,14 +339,6 @@ void PCDReader::ReadImage()
 if ( !bStatus )
 break;
 }
-std::free(static_cast(pL0) );
-std::free(static_cast(pL1) );
-std::free(static_cast(pCb) );
-std::free(static_cast(pCr) );
-std::free(static_cast(pL0N));
-std::free(static_cast(pL1N));
-std::free(static_cast(pCbN));
-std::free(static_cast(pCrN));
 }
 
 //== GraphicImport - the exported Function 
commit 65ca2be823ce29d506e9c2cb5a42b611234194ac
Author: Caolán McNamara 
AuthorDate: Thu Sep 2 09:16:14 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 2 18:18:44 2021 +0200

move variables to where they're used

Change-Id: Iaf7e7bf1a58aedb0ad6852812f969fc7e6153a54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121500
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/filter/ipcd/ipcd.cxx b/vcl/source/filter/ipcd/ipcd.cxx
index dbe7eb12d5db..1ce59f20c1bb 100644
--- a/vcl/source/filter/ipcd/ipcd.cxx
+++ b/vcl/source/filter/ipcd/ipcd.cxx
@@ -184,29 +184,27 @@ void PCDReader::ReadOrientation()
 
 void PCDReader::ReadImage()
 {
-sal_uInt32  nx,ny,nW2,nH2,nYPair,ndy,nXPair;
-tools::Long   nL,nCb,nCr,nRed,nGreen,nBlue;
-sal_uInt8 * pt;
-sal_uInt8 * pL0; // luminance for each pixel of the 1st row of the current 
pair of rows
-sal_uInt8 * pL1; // luminance for each pixel of the 2nd row of the current 
pair of rows
-sal_uInt8 * pCb; // blue chrominance for each 2x2 pixel of the current 
pair of rows
-sal_uInt8 * pCr; // red chrominance for each 2x2 pixel of the current pair 
of rows
-sal_uInt8 * pL0N, * pL1N, * pCbN, * pCrN; // like above, but for the next 
pair of rows
+tools::Long   nL,nCb,nCr;
 
 if ( !bStatus )
 return;
 
-nW2=nWidth>>1;
-nH2=nHeight>>1;
-
-pL0 =static_cast(std::malloc( nWidth ));
-pL1 =static_cast(std::malloc( nWidth ));
-pCb =static_cast(std::malloc( nW2+1 ));
-pCr =static_cast(std::malloc( nW2+1 ));
-pL0N=static_cast(std::malloc( nWidth ));
-pL1N=static_cast(std::malloc( nWidth ));
-pCbN=static_cast(std::malloc( nW2+1 ));
-pCrN=static_cast(std::malloc( nW2+1 ));
+sal_uInt32 nW2 = 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2020-04-26 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/impgraph.cxx |   76 ++--
 1 file changed, 45 insertions(+), 31 deletions(-)

New commits:
commit c5b6bc45d535cdad15d0d614bc3102bdf6cfd856
Author: Tomaž Vajngerl 
AuthorDate: Wed Apr 22 10:03:16 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 27 06:56:36 2020 +0200

ImpGraphic: move filename handling from swapout to ImpSwapFile

Change-Id: I30930f61385e31e7754d6653ff2eecfea61ce4e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92945
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 610d98b9528c..4a3e26946678 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -74,8 +74,8 @@ private:
 OUString maOriginURL;
 
 public:
-ImpSwapFile(INetURLObject const & aSwapURL, OUString const & rOriginURL)
-: maSwapURL(aSwapURL)
+ImpSwapFile(INetURLObject const & rSwapURL, OUString const & rOriginURL)
+: maSwapURL(rSwapURL)
 , maOriginURL(rOriginURL)
 {
 }
@@ -85,8 +85,33 @@ public:
 
utl::UCBContentHelper::Kill(maSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
 }
 
-INetURLObject getSwapURL() { return maSwapURL; }
+INetURLObject getSwapURL()
+{
+return maSwapURL;
+}
+
+OUString getSwapURLString()
+{
+return maSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+}
+
 OUString const & getOriginURL() { return maOriginURL; }
+
+std::unique_ptr openOutputStream()
+{
+OUString sSwapURL = getSwapURLString();
+if (!sSwapURL.isEmpty())
+{
+try
+{
+return utl::UcbStreamHelper::CreateStream(sSwapURL, 
StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
+}
+catch (const css::uno::Exception&)
+{
+}
+}
+return std::unique_ptr();
+}
 };
 
 OUString ImpGraphic::getSwapFileURL()
@@ -1333,39 +1358,26 @@ bool ImpGraphic::swapOut()
 
 utl::TempFile aTempFile;
 const INetURLObject aTempFileURL(aTempFile.GetURL());
-OUString sTempFileURLString = 
aTempFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
-if (sTempFileURLString.isEmpty())
-return false;
-std::unique_ptr xOutputStream;
+std::shared_ptr pSwapFile(new ImpSwapFile(aTempFileURL, 
getOriginURL()), o3tl::default_delete());
 
-try
-{
-xOutputStream = utl::UcbStreamHelper::CreateStream(sTempFileURLString, 
StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
-}
-catch (const css::uno::Exception&)
-{
-}
+std::unique_ptr xOutputStream = pSwapFile->openOutputStream();
 
 if (!xOutputStream)
 return false;
+
 xOutputStream->SetVersion(SOFFICE_FILEFORMAT_50);
 xOutputStream->SetCompressMode(SvStreamCompressFlags::NATIVE);
 
 bool bResult = swapOutToStream(xOutputStream.get());
 
-if (bResult)
-{
-mpSwapFile.reset(new ImpSwapFile(aTempFileURL, getOriginURL()), 
o3tl::default_delete());
-}
-else
-{
-xOutputStream.reset();
-utl::UCBContentHelper::Kill(sTempFileURLString);
-}
+xOutputStream.reset();
 
 if (bResult)
+{
+mpSwapFile = pSwapFile;
 vcl::graphic::Manager::get().swappedOut(this);
+}
 
 return bResult;
 }
commit 25983404aa710990194ca8afa89f91bee879a6be
Author: Tomaž Vajngerl 
AuthorDate: Mon Apr 20 22:29:04 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Apr 27 06:56:22 2020 +0200

ImpGraphic: clean-up and simplify swapOut()

Change-Id: I3e578c3172fcea341a218798843cd750971a5af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92944
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 9eb42fec39e8..610d98b9528c 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1328,44 +1328,46 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
 
 bool ImpGraphic::swapOut()
 {
-
-if( isSwappedOut() )
+if (isSwappedOut())
 return false;
 
-::utl::TempFile aTempFile;
-const INetURLObject aTmpURL( aTempFile.GetURL() );
+utl::TempFile aTempFile;
+const INetURLObject aTempFileURL(aTempFile.GetURL());
+OUString sTempFileURLString = 
aTempFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
-if( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ).isEmpty() )
+if (sTempFileURLString.isEmpty())
 return false;
+std::unique_ptr xOutputStream;
 
-std::unique_ptr xOStm;
 try
 {
-xOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( 
INetURLObject::DecodeMechanism::NONE ), StreamMode::READWRITE | 
StreamMode::SHARE_DENYWRITE );
+xOutputStream = utl::UcbStreamHelper::CreateStream(sTempFileURLString, 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.hxx |   86 +++---
 1 file changed, 43 insertions(+), 43 deletions(-)

New commits:
commit be3856df54e6a19041312479b8ffa8bd944aadd8
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 18:06:34 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 23:14:45 2019 +0100

pdf: move PDFAddStream out of PDFWriterImpl class

Change-Id: I3c96fcb3438f982fa6d40f806c4fc90db5025091
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86028
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 0ece9135782c..3302c533acfa 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -520,6 +520,16 @@ struct PDFStructureElement
 
 };
 
+struct PDFAddStream
+{
+OUString   m_aMimeType;
+PDFOutputStream*m_pStream;
+sal_Int32   m_nStreamObject;
+boolm_bCompress;
+
+PDFAddStream() : m_pStream( nullptr ), m_nStreamObject( 0 ), m_bCompress( 
true ) {}
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -529,16 +539,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-struct PDFAddStream
-{
-OUString   m_aMimeType;
-PDFOutputStream*m_pStream;
-sal_Int32   m_nStreamObject;
-boolm_bCompress;
-
-PDFAddStream() : m_pStream( nullptr ), m_nStreamObject( 0 ), 
m_bCompress( true ) {}
-};
-
 // helper structure for drawLayout and friends
 struct PDFGlyph
 {
commit a8085e5a0765ae078b3125dec7e05eddaecf9a1d
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 18:05:15 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 23:14:35 2019 +0100

pdf: move PDFStructureElement out of PDFWriterImpl class

Change-Id: I41b2f314f3eef7b28af7e1592a7167a216c1fd7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86027
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index eefb11b79d4b..0ece9135782c 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -487,6 +487,39 @@ struct PDFStructureElementKid // for Kids entries
 PDFStructureElementKid( sal_Int32 MCID, sal_Int32 nPage ) : nObject( nPage 
), nMCID( MCID ) {}
 };
 
+struct PDFStructureElement
+{
+sal_Int32   m_nObject;
+PDFWriter::StructElementm_eType;
+OStringm_aAlias;
+sal_Int32   m_nOwnElement; // 
index into structure vector
+sal_Int32   m_nParentElement; // 
index into structure vector
+sal_Int32   m_nFirstPageObject;
+boolm_bOpenMCSeq;
+std::list< sal_Int32 >  m_aChildren; // 
indexes into structure vector
+std::list< PDFStructureElementKid > m_aKids;
+std::map
+m_aAttributes;
+tools::Rectanglem_aBBox;
+OUStringm_aActualText;
+OUStringm_aAltText;
+css::lang::Locale   m_aLocale;
+
+// m_aContents contains the element's marked content sequence
+// as pairs of (page nr, MCID)
+
+PDFStructureElement()
+: m_nObject( 0 ),
+  m_eType( PDFWriter::NonStructElement ),
+  m_nOwnElement( -1 ),
+  m_nParentElement( -1 ),
+  m_nFirstPageObject( 0 ),
+  m_bOpenMCSeq( false )
+{
+}
+
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -496,39 +529,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-struct PDFStructureElement
-{
-sal_Int32   m_nObject;
-PDFWriter::StructElementm_eType;
-OStringm_aAlias;
-sal_Int32   m_nOwnElement; // 
index into structure vector
-sal_Int32   m_nParentElement; 
// index into structure vector
-sal_Int32   m_nFirstPageObject;
-boolm_bOpenMCSeq;
-std::list< sal_Int32 >  m_aChildren; // 
indexes into structure vector
-std::list< PDFStructureElementKid > m_aKids;
-std::map
-  

[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.hxx |   48 +++---
 1 file changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 7cd0a5b1a1b23a7c50b92302511e081703c8ec3a
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 17:54:55 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 21:14:37 2019 +0100

pdf: move PDFScreen out of PDFWriterImpl class

Change-Id: I9d41a1a1daac66ca760ae47e88b17bd97a1278e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86020
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 62a6f467adf2..c2145aa8c2de 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -394,6 +394,22 @@ struct PDFNoteEntry : public PDFAnnotation
 {}
 };
 
+/// A PDF Screen annotation.
+struct PDFScreen : public PDFAnnotation
+{
+/// Linked video.
+OUString m_aURL;
+/// Embedded video.
+OUString m_aTempFileURL;
+/// ID of the EmbeddedFile object.
+sal_Int32 m_nTempFileObject;
+
+PDFScreen()
+: m_nTempFileObject(0)
+{
+}
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -403,22 +419,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-/// A PDF Screen annotation.
-struct PDFScreen : public PDFAnnotation
-{
-/// Linked video.
-OUString m_aURL;
-/// Embedded video.
-OUString m_aTempFileURL;
-/// ID of the EmbeddedFile object.
-sal_Int32 m_nTempFileObject;
-
-PDFScreen()
-: m_nTempFileObject(0)
-{
-}
-};
-
 struct PDFWidget : public PDFAnnotation
 {
 typedef std::unordered_map 
PDFAppearanceStreams;
commit 7327e9b392124679280921131079d2c4ca2588b7
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 17:53:49 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 21:14:24 2019 +0100

pdf: move PDFNoteEntry out of PDFWriterImpl class

Change-Id: I1837f85fe1a532c644581ca3103808247b335295
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86019
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 37b2d6762fdc..62a6f467adf2 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -386,6 +386,14 @@ struct PDFEmbeddedFile
 }
 };
 
+struct PDFNoteEntry : public PDFAnnotation
+{
+PDFNote m_aContents;
+
+PDFNoteEntry()
+{}
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -411,14 +419,6 @@ public:
 }
 };
 
-struct PDFNoteEntry : public PDFAnnotation
-{
-PDFNote m_aContents;
-
-PDFNoteEntry()
-{}
-};
-
 struct PDFWidget : public PDFAnnotation
 {
 typedef std::unordered_map 
PDFAppearanceStreams;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.hxx |   24 
 vcl/unx/gtk3/gtk3gtkobject.cxx|4 ++--
 2 files changed, 14 insertions(+), 14 deletions(-)

New commits:
commit 69b221263be58118b3293363ab9ecf7581c50c6f
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 17:50:25 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 19:45:18 2019 +0100

pdf: move PDFAnnotation out of PDFWriterImpl class

Change-Id: I37db3419eeaa8c5f8096a663a2ccede178bfadf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86016
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 8ee67280c962..1e6f40c24843 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -348,6 +348,18 @@ struct PDFOutlineEntry
 {}
 };
 
+struct PDFAnnotation
+{
+sal_Int32   m_nObject;
+tools::Rectangle   m_aRect;
+sal_Int32   m_nPage;
+
+PDFAnnotation()
+: m_nObject( -1 ),
+  m_nPage( -1 )
+{}
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -357,18 +369,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-struct PDFAnnotation
-{
-sal_Int32   m_nObject;
-tools::Rectangle   m_aRect;
-sal_Int32   m_nPage;
-
-PDFAnnotation()
-: m_nObject( -1 ),
-  m_nPage( -1 )
-{}
-};
-
 struct PDFLink : public PDFAnnotation
 {
 sal_Int32   m_nDest; // set to -1 for URL, to a dest 
else
commit 82a22f62e5b1c7bfa7fb117a0423475f10410194
Author: Stephan Bergmann 
AuthorDate: Sun Dec 29 23:24:42 2019 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 30 19:45:10 2019 +0100

Fix GDK_KEY_RELEASE -> GDK_KEY_RELEASE_MASK

...as found with recent Clang 10 trunk:

> vcl/unx/gtk3/gtk3gtkobject.cxx:255:76: error: bitwise operation between 
different enumeration types ('GdkEventMask' and 'GdkEventType') is deprecated 
[-Werror,-Wdeprecated-enum-enum-conversion]
> gtk_widget_add_events( GTK_WIDGET( m_pSocket ), 
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE );
> 
~~ ^ ~~~

This is presumably a typo originating with
31fa4545985acc1594107e087cedc2d99b3d0f0b "split the gtk2 and gtk2 
gtkobjects".


states that the "gint events" parameter of gtk_widget_add_events is "an 
event
mask, see GdkEventMask", and /usr/include/gtk-3.0/gdk/gdktypes.h has

> typedef enum
> {
[...]
>   GDK_KEY_PRESS_MASK= 1 << 10,
>   GDK_KEY_RELEASE_MASK  = 1 << 11,
[...]
> } GdkEventMask;

while /usr/include/gtk-3.0/gdk/gdkevents.h (both
gtk3-devel-3.24.13-1.fc31.x86_64) has

> typedef enum
> {
[...]
>   GDK_KEY_PRESS = 8,
>   GDK_KEY_RELEASE   = 9,
[...]
> } GdkEventType;

Change-Id: I23acfef5e59803d2b71eed6c65a78e9895e415af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85971
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx
index d038a6121432..9b9fff958908 100644
--- a/vcl/unx/gtk3/gtk3gtkobject.cxx
+++ b/vcl/unx/gtk3/gtk3gtkobject.cxx
@@ -252,9 +252,9 @@ void GtkSalObject::signalDestroy( GtkWidget* pObj, gpointer 
object )
 void GtkSalObjectBase::SetForwardKey( bool bEnable )
 {
 if( bEnable )
-gtk_widget_add_events( GTK_WIDGET( m_pSocket ), GDK_KEY_PRESS_MASK | 
GDK_KEY_RELEASE );
+gtk_widget_add_events( GTK_WIDGET( m_pSocket ), GDK_KEY_PRESS_MASK | 
GDK_KEY_RELEASE_MASK );
 else
-gtk_widget_set_events( GTK_WIDGET( m_pSocket ), ~(GDK_KEY_PRESS_MASK | 
GDK_KEY_RELEASE) & gtk_widget_get_events( GTK_WIDGET( m_pSocket ) ) );
+gtk_widget_set_events( GTK_WIDGET( m_pSocket ), ~(GDK_KEY_PRESS_MASK | 
GDK_KEY_RELEASE_MASK) & gtk_widget_get_events( GTK_WIDGET( m_pSocket ) ) );
 }
 
 GtkSalObjectWidgetClip::GtkSalObjectWidgetClip(GtkSalFrame* pParent, bool 
bShow)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.hxx |  106 +++---
 1 file changed, 55 insertions(+), 51 deletions(-)

New commits:
commit 2351ee06d6c4d5af35b46d63510d93c618ad0276
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 12:23:50 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 17:41:15 2019 +0100

pdf: move FontEmit, Glyph, FontSubset, EmbedFont from PDFWriterImpl

Change-Id: I8032a31d3237459713ec386c6810b6f05daabf08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86005
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 3696316c0626..e93d4005121e 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -286,6 +286,33 @@ public:
 }
 };
 
+struct FontEmit
+{
+sal_Int32   m_nFontID;
+std::map m_aMapping;
+
+explicit FontEmit( sal_Int32 nID ) : m_nFontID( nID ) {}
+};
+
+struct Glyph
+{
+sal_Int32   m_nFontID;
+sal_uInt8   m_nSubsetGlyphID;
+};
+
+struct FontSubset
+{
+std::vector< FontEmit >m_aSubsets;
+std::map m_aMapping;
+};
+
+struct EmbedFont
+{
+sal_Int32   m_nNormalFontID;
+
+EmbedFont() : m_nNormalFontID( 0 ) {}
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -295,30 +322,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-struct FontEmit
-{
-sal_Int32   m_nFontID;
-std::map m_aMapping;
-
-explicit FontEmit( sal_Int32 nID ) : m_nFontID( nID ) {}
-};
-struct Glyph
-{
-sal_Int32   m_nFontID;
-sal_uInt8   m_nSubsetGlyphID;
-};
-struct FontSubset
-{
-std::vector< FontEmit >m_aSubsets;
-std::map m_aMapping;
-};
-struct EmbedFont
-{
-sal_Int32   m_nNormalFontID;
-
-EmbedFont() : m_nNormalFontID( 0 ) {}
-};
-
 struct PDFDest
 {
 sal_Int32   m_nPage;
commit fffc244319a4f39beef3739c9d08c087e713f36b
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 12:19:26 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 17:41:01 2019 +0100

pdf: move GlyphEmit out of PDFWriterImpl class

Change-Id: I9ea67cd219a7304baa7abe20be207156a4c0e75e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86004
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 57e9ca4eb9c7..3696316c0626 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -256,6 +256,36 @@ struct TransparencyEmit
 {}
 };
 
+// font subsets
+class GlyphEmit
+{
+// performance: actually this should probably a vector;
+std::vectorm_CodeUnits;
+sal_uInt8   m_nSubsetGlyphID;
+
+public:
+GlyphEmit() : m_nSubsetGlyphID(0)
+{
+}
+
+void setGlyphId( sal_uInt8 i_nId ) { m_nSubsetGlyphID = i_nId; }
+sal_uInt8 getGlyphId() const { return m_nSubsetGlyphID; }
+
+void addCode( sal_Ucs i_cCode )
+{
+m_CodeUnits.push_back(i_cCode);
+}
+sal_Int32 countCodes() const { return m_CodeUnits.size(); }
+const std::vector& codes() const { return m_CodeUnits; }
+sal_Ucs getCode( sal_Int32 i_nIndex ) const
+{
+sal_Ucs nRet = 0;
+if (static_cast(i_nIndex) < m_CodeUnits.size())
+nRet = m_CodeUnits[i_nIndex];
+return nRet;
+}
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -265,35 +295,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-// font subsets
-class GlyphEmit
-{
-// performance: actually this should probably a vector;
-std::vectorm_CodeUnits;
-sal_uInt8   m_nSubsetGlyphID;
-
-public:
-GlyphEmit() : m_nSubsetGlyphID(0)
-{
-}
-
-void setGlyphId( sal_uInt8 i_nId ) { m_nSubsetGlyphID = i_nId; }
-sal_uInt8 getGlyphId() const { return m_nSubsetGlyphID; }
-
-void addCode( sal_Ucs i_cCode )
-{
-m_CodeUnits.push_back(i_cCode);
-}
-sal_Int32 countCodes() const { return m_CodeUnits.size(); }
-const std::vector& codes() const { return m_CodeUnits; }
-sal_Ucs getCode( sal_Int32 i_nIndex ) const
-{
-sal_Ucs nRet = 0;
-if (static_cast(i_nIndex) < m_CodeUnits.size())
-nRet = m_CodeUnits[i_nIndex];
-return nRet;
-}
-};
 struct FontEmit
 {
 sal_Int32   m_nFontID;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |4 +-
 vcl/source/gdi/pdfwriter_impl.hxx |   76 +++---
 2 files changed, 40 insertions(+), 40 deletions(-)

New commits:
commit e03895b8e621f641af686fa83d359e3571047ddb
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 12:09:36 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 17:20:21 2019 +0100

pdf: move BitmapEmit out of PDFWriterImpl class

Change-Id: Ia86803e9ad732d94cac59814ac8dcae8772542a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85999
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index f05260d613b7..3f1a3aaadb7f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9387,7 +9387,7 @@ void PDFWriterImpl::drawBitmap( const Point& rDestPoint, 
const Size& rDestSize,
 writeBuffer( aLine.getStr(), aLine.getLength() );
 }
 
-const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const 
BitmapEx& i_rBitmap, const Graphic& rGraphic )
+const BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx& i_rBitmap, 
const Graphic& rGraphic )
 {
 BitmapEx aBitmap( i_rBitmap );
 if( m_aContext.ColorMode == PDFWriter::DrawGreyscale )
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 37d8a1fbe94c..8e3b188a13bc 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -187,6 +187,19 @@ struct ReferenceXObjectEmit
 sal_Int32 getObject() const;
 };
 
+struct BitmapEmit
+{
+BitmapIDm_aID;
+BitmapExm_aBitmap;
+sal_Int32   m_nObject;
+ReferenceXObjectEmit m_aReferenceXObject;
+
+BitmapEmit()
+: m_nObject(0)
+{
+}
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -196,19 +209,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-struct BitmapEmit
-{
-BitmapIDm_aID;
-BitmapExm_aBitmap;
-sal_Int32   m_nObject;
-ReferenceXObjectEmit m_aReferenceXObject;
-
-BitmapEmit()
-: m_nObject(0)
-{
-}
-};
-
 struct JPGEmit
 {
 BitmapIDm_aID;
commit 99940fd70cd36c93872d89c604a0ddb0e77163ef
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 12:06:03 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 17:20:10 2019 +0100

pdf: move ReferenceXObjectEmit out of PDFWriterImpl class

Change-Id: Ic173a6fcb189966e785907cd24a3e90857811b83
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85998
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 7cb77f2f60c4..f05260d613b7 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11224,7 +11224,7 @@ void PDFWriterImpl::MARK( const char* pString )
 emitComment( pString );
 }
 
-sal_Int32 PDFWriterImpl::ReferenceXObjectEmit::getObject() const
+sal_Int32 ReferenceXObjectEmit::getObject() const
 {
 if (m_nFormObject > 0)
 return m_nFormObject;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index d375d7842bd0..37d8a1fbe94c 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -162,6 +162,31 @@ struct PDFPage
 double getHeight() const { return m_nPageHeight ? m_nPageHeight : 
vcl::pdf::g_nInheritedPageHeight; }
 };
 
+/// Contains information to emit a reference XObject.
+struct ReferenceXObjectEmit
+{
+/// ID of the Form XObject, if any.
+sal_Int32 m_nFormObject;
+/// ID of the vector/embedded object, if m_nFormObject is used.
+sal_Int32 m_nEmbeddedObject;
+/// ID of the bitmap object, if m_nFormObject is used.
+sal_Int32 m_nBitmapObject;
+/// Size of the bitmap replacement, in pixels.
+Size m_aPixelSize;
+/// PDF data from the graphic object, if not writing a reference XObject.
+std::vector m_aPDFData;
+
+ReferenceXObjectEmit()
+: m_nFormObject(0),
+  m_nEmbeddedObject(0),
+  m_nBitmapObject(0)
+{
+}
+
+/// Returns the ID one should use when referring to this bitmap.
+sal_Int32 getObject() const;
+};
+
 }
 
 class PDFWriterImpl : public VirtualDevice
@@ -171,31 +196,6 @@ class PDFWriterImpl : public VirtualDevice
 public:
 friend struct vcl::pdf::PDFPage;
 
-/// Contains information to emit a reference XObject.
-struct ReferenceXObjectEmit
-{
-/// ID of the Form XObject, if any.
-sal_Int32 m_nFormObject;
-/// ID of the vector/embedded object, if m_nFormObject is used.
-sal_Int32 m_nEmbeddedObject;
-/// ID of the bitmap object, if m_nFormObject is used.
-sal_Int32 m_nBitmapObject;
-/// Size of the bitmap replacement, in pixels.
-Size 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |   36 +-
 vcl/source/gdi/pdfwriter_impl.hxx |  128 +++---
 2 files changed, 84 insertions(+), 80 deletions(-)

New commits:
commit 166390fdf1a09329b9b218fa7e5b8a142f87e728
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 09:45:32 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 14:31:09 2019 +0100

pdf: move PDFPage out of PDFWriterImpl into vcl::pdf namespace

Change-Id: Ia3a092d53b8c3cad785222868c5c259419c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85993
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 4c02c41717af..7cb77f2f60c4 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -566,7 +566,7 @@ public:
 void translate( double tx, double ty );
 void invert();
 
-void append( PDFWriterImpl::PDFPage const & rPage, OStringBuffer& rBuffer 
);
+void append( PDFPage const & rPage, OStringBuffer& rBuffer );
 
 Point transform( const Point& rPoint ) const;
 };
@@ -670,7 +670,7 @@ void Matrix3::invert()
 set( fn );
 }
 
-void Matrix3::append( PDFWriterImpl::PDFPage const & rPage, OStringBuffer& 
rBuffer )
+void Matrix3::append( PDFPage const & rPage, OStringBuffer& rBuffer )
 {
 appendDouble( f[0], rBuffer );
 rBuffer.append( ' ' );
@@ -683,7 +683,7 @@ void Matrix3::append( PDFWriterImpl::PDFPage const & rPage, 
OStringBuffer& rBuff
 rPage.appendPoint( Point( static_cast(f[4]), static_cast(f[5]) 
), rBuffer );
 }
 
-PDFWriterImpl::PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, 
double nPageHeight, PDFWriter::Orientation eOrientation )
+PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double 
nPageHeight, PDFWriter::Orientation eOrientation )
 :
 m_pWriter( pWriter ),
 m_nPageWidth( nPageWidth ),
@@ -699,7 +699,7 @@ PDFWriterImpl::PDFPage::PDFPage( PDFWriterImpl* pWriter, 
double nPageWidth, doub
 m_nPageObject = m_pWriter->createObject();
 }
 
-void PDFWriterImpl::PDFPage::beginStream()
+void PDFPage::beginStream()
 {
 if (g_bDebugDisableCompression)
 {
@@ -731,7 +731,7 @@ void PDFWriterImpl::PDFPage::beginStream()
 m_pWriter->checkAndEnableStreamEncryption( m_aStreamObjects.back() );
 }
 
-void PDFWriterImpl::PDFPage::endStream()
+void PDFPage::endStream()
 {
 if (!g_bDebugDisableCompression)
 m_pWriter->endCompression();
@@ -756,7 +756,7 @@ void PDFWriterImpl::PDFPage::endStream()
 m_pWriter->writeBuffer( aLine.getStr(), aLine.getLength() );
 }
 
-bool PDFWriterImpl::PDFPage::emit(sal_Int32 nParentObject )
+bool PDFPage::emit(sal_Int32 nParentObject )
 {
 // emit page object
 if( ! m_pWriter->updateObject( m_nPageObject ) )
@@ -917,7 +917,7 @@ static GEOMETRY lcl_convert( const MapMode& _rSource, const 
MapMode& _rDest, Out
 }
 }
 
-void PDFWriterImpl::PDFPage::appendPoint( const Point& rPoint, OStringBuffer& 
rBuffer ) const
+void PDFPage::appendPoint( const Point& rPoint, OStringBuffer& rBuffer ) const
 {
 Point aPoint( lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode,
m_pWriter->m_aMapMode,
@@ -935,7 +935,7 @@ void PDFWriterImpl::PDFPage::appendPoint( const Point& 
rPoint, OStringBuffer& rB
 appendFixedInt( nValue, rBuffer );
 }
 
-void PDFWriterImpl::PDFPage::appendPixelPoint( const basegfx::B2DPoint& 
rPoint, OStringBuffer& rBuffer ) const
+void PDFPage::appendPixelPoint( const basegfx::B2DPoint& rPoint, 
OStringBuffer& rBuffer ) const
 {
 double fValue   = pixelToPoint(rPoint.getX());
 
@@ -945,7 +945,7 @@ void PDFWriterImpl::PDFPage::appendPixelPoint( const 
basegfx::B2DPoint& rPoint,
 appendDouble( fValue, rBuffer, nLog10Divisor );
 }
 
-void PDFWriterImpl::PDFPage::appendRect( const tools::Rectangle& rRect, 
OStringBuffer& rBuffer ) const
+void PDFPage::appendRect( const tools::Rectangle& rRect, OStringBuffer& 
rBuffer ) const
 {
 appendPoint( rRect.BottomLeft() + Point( 0, 1 ), rBuffer );
 rBuffer.append( ' ' );
@@ -955,7 +955,7 @@ void PDFWriterImpl::PDFPage::appendRect( const 
tools::Rectangle& rRect, OStringB
 rBuffer.append( " re" );
 }
 
-void PDFWriterImpl::PDFPage::convertRect( tools::Rectangle& rRect ) const
+void PDFPage::convertRect( tools::Rectangle& rRect ) const
 {
 Point aLL = lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode,
  m_pWriter->m_aMapMode,
@@ -972,7 +972,7 @@ void PDFWriterImpl::PDFPage::convertRect( tools::Rectangle& 
rRect ) const
 rRect.SetBottom( rRect.Top() + aSize.Height() );
 }
 
-void PDFWriterImpl::PDFPage::appendPolygon( const tools::Polygon& rPoly, 
OStringBuffer& rBuffer, bool bClose ) const
+void PDFPage::appendPolygon( const tools::Polygon& rPoly, OStringBuffer& 
rBuffer, bool bClose ) const
 {
 sal_uInt16 nPoints = rPoly.GetSize();
 /*
@@ -1017,7 +1017,7 @@ 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |6 +++---
 vcl/source/gdi/pdfwriter_impl.hxx |   10 --
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 283f1fb10a7a1643712e70b46c2ab09a89ac013e
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 09:28:19 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 13:56:21 2019 +0100

pdf: remove PDFAppearanceMap typdef, but keep PDFAppearanceStreams

The full declaration would be very long so only remove
PDFAppearanceMap but keep PDFAppearanceStreams and only move it
inside PDFWidget class.

Change-Id: Idd783a37dcb631d63cb4f2cf1ebd6040e0f723ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85991
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 633c40780b7c..4c02c41717af 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10954,10 +10954,10 @@ void PDFWriterImpl::ensureUniqueRadioOnValues()
 for (auto const& nKidIndex : rGroupWidget.m_aKidsIndex)
 {
 PDFWidget& rKid = m_aWidgets[nKidIndex];
-PDFAppearanceMap::iterator app_it = rKid.m_aAppearances.find( "N" 
);
+auto app_it = rKid.m_aAppearances.find( "N" );
 if( app_it != rKid.m_aAppearances.end() )
 {
-PDFAppearanceStreams::iterator stream_it = 
app_it->second.find( "Yes" );
+auto stream_it = app_it->second.find( "Yes" );
 if( stream_it != app_it->second.end() )
 {
 SvMemoryStream* pStream = stream_it->second;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index da7ff1d823b4..9651f98801a5 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -409,11 +409,10 @@ public:
 {}
 };
 
-typedef std::unordered_map< OString, SvMemoryStream* > 
PDFAppearanceStreams;
-typedef std::unordered_map< OString, PDFAppearanceStreams > 
PDFAppearanceMap;
-
 struct PDFWidget : public PDFAnnotation
 {
+typedef std::unordered_map 
PDFAppearanceStreams;
+
 PDFWriter::WidgetType   m_eType;
 OStringm_aName;
 OUString   m_aDescription;
@@ -441,7 +440,7 @@ public:
 sal_Int32   m_nDest;
 std::vector  m_aListEntries;
 std::vector  m_aSelectedEntries;
-PDFAppearanceMapm_aAppearances;
+std::unordered_map m_aAppearances;
 PDFWidget()
 : m_eType( PDFWriter::PushButton ),
   m_nTextStyle( DrawTextFlags::NONE ),
commit c10d76aac978beb36439512be0a36aac90a4c03f
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 09:23:31 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 13:56:10 2019 +0100

pdf: remove FontEmbedData typedef

Change-Id: Ib74bd652917d4c7852bc53570986d5b13bc99d32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85987
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 143460b457cf..633c40780b7c 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -5671,7 +5671,7 @@ sal_Int32 PDFWriterImpl::getSystemFont( const vcl::Font& 
i_rFont )
 
 const PhysicalFontFace* pDevFont = GetFontInstance()->GetFontFace();
 sal_Int32 nFontID = 0;
-FontEmbedData::iterator it = m_aSystemFonts.find( pDevFont );
+auto it = m_aSystemFonts.find( pDevFont );
 if( it != m_aSystemFonts.end() )
 nFontID = it->second.m_nNormalFontID;
 else
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 8cc7c714f338..da7ff1d823b4 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -311,7 +311,6 @@ public:
 
 EmbedFont() : m_nNormalFontID( 0 ) {}
 };
-typedef std::map< const PhysicalFontFace*, EmbedFont > FontEmbedData;
 
 struct PDFDest
 {
@@ -643,7 +642,7 @@ private:
 std::list< TransparencyEmit >   m_aTransparentObjects;
 /*  contains all font subsets in use */
 std::map m_aSubsets;
-FontEmbedData   m_aSystemFonts;
+std::map m_aSystemFonts;
 sal_Int32   m_nNextFID;
 PDFFontCachem_aFontCache;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-12-30 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 vcl/source/gdi/pdfwriter_impl.hxx |6 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 06d8d773f07fa7fba55f3ec5aa2715c9f857ab02
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 09:17:44 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 12:00:00 2019 +0100

pdf: remove FontMapping typedef

Change-Id: Idb4ea16bc9ebc238eaab7ff242468a39e241948e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85985
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 1e5490fa9f58..143460b457cf 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -5694,7 +5694,7 @@ void PDFWriterImpl::registerGlyph(const GlyphItem* pGlyph,
 const int nFontGlyphId = pGlyph->glyphId();
 FontSubset& rSubset = m_aSubsets[ pFont ];
 // search for font specific glyphID
-FontMapping::iterator it = rSubset.m_aMapping.find( nFontGlyphId );
+auto it = rSubset.m_aMapping.find( nFontGlyphId );
 if( it != rSubset.m_aMapping.end() )
 {
 nMappedFontObject = it->second.m_nFontID;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 2381b107c14e..7ccd43119151 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -300,11 +300,10 @@ public:
 sal_Int32   m_nFontID;
 sal_uInt8   m_nSubsetGlyphID;
 };
-typedef std::map< sal_GlyphId, Glyph > FontMapping;
 struct FontSubset
 {
 std::vector< FontEmit >m_aSubsets;
-FontMapping m_aMapping;
+std::map m_aMapping;
 };
 typedef std::map< const PhysicalFontFace*, FontSubset > FontSubsetData;
 struct EmbedFont
commit e2da69a47f313126849d52d4581f87ff30dc398b
Author: Tomaž Vajngerl 
AuthorDate: Mon Dec 30 09:15:31 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 30 11:59:48 2019 +0100

pdf: remove FontEmitMapping typedef

Change-Id: I298750f9bce8ed04f6818d209e14db7e8932330a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85984
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 0420567ef5ba..2381b107c14e 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -288,11 +288,10 @@ public:
 return nRet;
 }
 };
-typedef std::map< sal_GlyphId, GlyphEmit > FontEmitMapping;
 struct FontEmit
 {
 sal_Int32   m_nFontID;
-FontEmitMapping m_aMapping;
+std::map m_aMapping;
 
 explicit FontEmit( sal_Int32 nID ) : m_nFontID( nID ) {}
 };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/win

2019-11-27 Thread Andrea Gelmini (via logerrit)
 vcl/source/window/status.cxx |2 +-
 vcl/win/gdi/winlayout.cxx|1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 3208e9153cfc51eae05bee1af02cbff844e3b3ca
Author: Andrea Gelmini 
AuthorDate: Wed Nov 27 14:38:07 2019 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 27 15:47:02 2019 +0100

Removed duplicated include

Change-Id: Ibf3142a88def08fd9b531b39bde5643aa8498f7f
Reviewed-on: https://gerrit.libreoffice.org/83908
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index cf264425ae17..7b8f5df30180 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -36,7 +36,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #if HAVE_FEATURE_SKIA
 #include 
commit 6d1089069e9b8d1a58998d9c31dc110bdb5e6093
Author: Andrea Gelmini 
AuthorDate: Wed Nov 27 14:40:48 2019 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 27 15:46:04 2019 +0100

Fix typo

Change-Id: I3b2cd8942a3a2f7871f296fff884af930e33905c
Reviewed-on: https://gerrit.libreoffice.org/83910
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 8cc26fa95146..e5ba91043c53 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -1348,7 +1348,7 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
 
 if (bInvalidate)
 {
-// Rate limit how often we paint, otherwise in some loading scenerios 
we can spend significant
+// Rate limit how often we paint, otherwise in some loading scenarios 
we can spend significant
 // time just painting progress bars.
 sal_uInt32 nTime_ms = osl_getGlobalTimer();
 if ((nTime_ms - mnLastProgressPaint_ms) > 100)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - vcl/source xmlsecurity/source

2019-07-16 Thread Caolán McNamara (via logerrit)
 vcl/source/font/Feature.cxx  |1 +
 xmlsecurity/source/dialogs/certificateviewer.cxx |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b157e408e51e43be707141fdb783df8a2eb8737f
Author: Caolán McNamara 
AuthorDate: Mon Jul 15 20:15:29 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 16 09:30:48 2019 +0200

cid#1448533 Uninitialized scalar field

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

diff --git a/vcl/source/font/Feature.cxx b/vcl/source/font/Feature.cxx
index 4be8152d4bc7..7beb238a2d20 100644
--- a/vcl/source/font/Feature.cxx
+++ b/vcl/source/font/Feature.cxx
@@ -94,6 +94,7 @@ uint32_t FeatureParameter::getCode() const { return m_nCode; }
 FeatureDefinition::FeatureDefinition()
 : m_pDescriptionID(nullptr)
 , m_nCode(0)
+, m_nDefault(0)
 , m_eType(FeatureParameterType::BOOL)
 {
 }
commit 3e66a826c09a2d968f2307594ffe28e486bbbf3a
Author: Caolán McNamara 
AuthorDate: Mon Jul 15 20:25:14 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 16 09:30:31 2019 +0200

cid#1448248 Unchecked return value

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

diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx 
b/xmlsecurity/source/dialogs/certificateviewer.cxx
index f0023fbcb87e..e916fffceb17 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -293,7 +293,7 @@ void CertificateViewerCertPathTP::ActivatePage()
 if (!xParent)
 {
 xParent = mxCertPathLB->make_iterator();
-mxCertPathLB->get_iter_first(*xParent);
+(void)mxCertPathLB->get_iter_first(*xParent);
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-04-13 Thread Tomaž Vajngerl (via logerrit)
 vcl/source/bitmap/BitmapScaleSuperFilter.cxx |  684 ++-
 1 file changed, 278 insertions(+), 406 deletions(-)

New commits:
commit 99b6997a314cf74df17ea3eda1abcabd63d89cef
Author: Tomaž Vajngerl 
AuthorDate: Sat Apr 13 14:42:09 2019 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Apr 13 13:32:00 2019 +0200

BitmapScaleSuper: generalize 24bit scaling

Until now we had RGB and BGR version. Because we never change the
byte order when scaling and the scanline type, we can generalize
the two funcions into one, where we only need to be careful that
we don't change the order of color components.

The same is done already for 4 variants of 32-bit bitmap, where
we really only need 1 function for all 4 variants, using the same
principle.

Change-Id: I0f6d6b0c06a45e53bcd048e2ae009a471bf90a06
Reviewed-on: https://gerrit.libreoffice.org/70695
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx 
b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
index bd8db3ace9e7..1011efa31287 100644
--- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
+++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
@@ -259,84 +259,57 @@ void scalePalleteGeneral(ScaleContext , long 
nStartY, long nEndY)
 }
 }
 
-void scale24bitBGR(ScaleContext , long nStartY, long nEndY)
+void scaleUp24bit(ScaleContext , long nStartY, long nEndY)
 {
-const long nStartX = 0, nEndX = rCtx.mnDestW - 1;
+const int nColorComponents = 3;
 
-for( long nY = nStartY; nY <= nEndY; nY++ )
+const long nStartX = 0;
+const long nEndX = rCtx.mnDestW - 1;
+
+for (long nY = nStartY; nY <= nEndY; nY++)
 {
-long nTempY = rCtx.maMapIY[ nY ];
-BilinearWeightType nTempFY = rCtx.maMapFY[ nY ];
-Scanline pLine0 = rCtx.mpSrc->GetScanline( nTempY );
-Scanline pLine1 = rCtx.mpSrc->GetScanline( ++nTempY );
-Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
+long nTempY = rCtx.maMapIY[nY];
+BilinearWeightType nTempFY = rCtx.maMapFY[nY];
 
-for( long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ )
-{
-long nOff = 3 * rCtx.maMapIX[ nX ];
-BilinearWeightType nTempFX = rCtx.maMapFX[ nX ];
+Scanline pLine0 = rCtx.mpSrc->GetScanline(nTempY+0);
+Scanline pLine1 = rCtx.mpSrc->GetScanline(nTempY+1);
+Scanline pScanDest = rCtx.mpDest->GetScanline(nY);
 
-Scanline pTmp0 = pLine0 + nOff ;
-Scanline pTmp1 = pTmp0 + 3;
-sal_uInt8 cB0 = MAP( *pTmp0, *pTmp1, nTempFX );
-pTmp0++; pTmp1++;
-sal_uInt8 cG0 = MAP( *pTmp0, *pTmp1, nTempFX );
-pTmp0++; pTmp1++;
-sal_uInt8 cR0 = MAP( *pTmp0, *pTmp1, nTempFX );
-
-pTmp0 = pLine1 + nOff;
-pTmp1 = pTmp0 + 3;
-sal_uInt8 cB1 = MAP( *pTmp0, *pTmp1, nTempFX );
-pTmp0++; pTmp1++;
-sal_uInt8 cG1 = MAP( *pTmp0, *pTmp1, nTempFX );
-pTmp0++; pTmp1++;
-sal_uInt8 cR1 = MAP( *pTmp0, *pTmp1, nTempFX );
+sal_uInt8 nComponent1[nColorComponents];
+sal_uInt8 nComponent2[nColorComponents];
 
-BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
-MAP( cG0, cG1, nTempFY ),
-MAP( cB0, cB1, nTempFY ) );
-rCtx.mpDest->SetPixelOnData( pScanDest, nXDst++, aColRes );
-}
-}
-}
+Scanline pColorPtr0;
+Scanline pColorPtr1;
 
-void scale24bitRGB(ScaleContext , long nStartY, long nEndY)
-{
-const long nStartX = 0, nEndX = rCtx.mnDestW - 1;
+for (long nX = nStartX; nX <= nEndX; nX++)
+{
+long nTempX = rCtx.maMapIX[nX];
+BilinearWeightType nTempFX = rCtx.maMapFX[nX];
 
-for( long nY = nStartY; nY <= nEndY; nY++ )
-{
-long nTempY = rCtx.maMapIY[ nY ];
-BilinearWeightType nTempFY = rCtx.maMapFY[ nY ];
-Scanline pLine0 = rCtx.mpSrc->GetScanline( nTempY );
-Scanline pLine1 = rCtx.mpSrc->GetScanline( ++nTempY );
-Scanline pScanDest = rCtx.mpDest->GetScanline( nY );
+pColorPtr0 = pLine0 + nTempX * nColorComponents;
+pColorPtr1 = pColorPtr0 + nColorComponents;
 
-for( long nX = nStartX, nXDst = 0; nX <= nEndX; nX++ )
-{
-long nOff = 3 * rCtx.maMapIX[ nX ];
-BilinearWeightType nTempFX = rCtx.maMapFX[ nX ];
+nComponent1[0] = MAP(*pColorPtr0, *pColorPtr1, nTempFX);
+pColorPtr0++; pColorPtr1++;
+nComponent1[1] = MAP(*pColorPtr0, *pColorPtr1, nTempFX);
+pColorPtr0++; pColorPtr1++;
+nComponent1[2] = MAP(*pColorPtr0, *pColorPtr1, nTempFX);
+
+pColorPtr0 = pLine1 + nTempX * nColorComponents;
+pColorPtr1 = pColorPtr0 + nColorComponents;
 
-Scanline pTmp0 = pLine0 + nOff;
-Scanline pTmp1 = pTmp0 + 3;
-  

[Libreoffice-commits] core.git: 2 commits - vcl/source

2019-03-16 Thread Libreoffice Gerrit user
 vcl/source/fontsubset/cff.cxx |   45 --
 1 file changed, 26 insertions(+), 19 deletions(-)

New commits:
commit 6907cbd0f8e198a0f1810b1a07f552a47c9da660
Author: Thorsten Behrens 
AuthorDate: Thu Mar 14 00:36:37 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Mar 16 23:41:33 2019 +0100

tdf#113448 fix type1 font subsetter

This fixes verapdf A-1 validation error '6.2.11.5-1 glyph width in
dict and font file inconsistent'

Previous code was writing hard-coded '1000' as glyph width for any
type1 font subsetting - since actual type2 width info only became
available during subsequent convertOneTypeOp() parsing.

Catch was, that loop sometimes already modifies the output buffer
(whenever glyph path info was given), so we fix that by first padding
out 5 bytes for the width (size of integers are sadly variable), then
parsing Type2 glyph code, and in the end putting in the actual width
value we then know.

Can't put hsbw type1 op last, since standard requires that to be first
(and can only be given _once_)...

Could be re-done nicer by buffering Type2 glyph data, then writing it.
Left as an exercise for the reader.

Change-Id: I64ffaa32ded2f0a7c06311d1e0426cf358308a0a
Reviewed-on: https://gerrit.libreoffice.org/69293
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index a311104dca9b..57824367d366 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -1099,16 +1099,34 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* 
pCffLocal, const U8* const
 mpReadEnd = pT2Ops + nT2Len;
 // prepend "hsbw" or "sbw"
 // TODO: only emit hsbw when charwidth is known
-// TODO: remove charwidth from T2 stack
-writeType1Val( 0); // TODO: aSubsetterContext.getLeftSideBearing();
-writeType1Val( 1000/*###getCharWidth()###*/);
-writeTypeOp( TYPE1OP::HSBW);
+writeType1Val(0); // TODO: aSubsetterContext.getLeftSideBearing();
+U8* pCharWidthPtr=mpWritePtr; // need to overwrite that later
+// pad out 5 bytes for the char width with default val 1000 (to be
+// filled with the actual value below)
+*(mpWritePtr++) = 255;
+*(mpWritePtr++) = static_cast(0);
+*(mpWritePtr++) = static_cast(0);
+*(mpWritePtr++) = static_cast(250);
+*(mpWritePtr++) = static_cast(124);
+writeTypeOp(TYPE1OP::HSBW);
 mbNeedClose = false;
 mbIgnoreHints = false;
 mnHintSize=mnHorzHintSize=mnStackIdx=0; maCharWidth=-1;//###
 mnCntrMask = 0;
 while( mpReadPtr < mpReadEnd)
 convertOneTypeOp();
+if( maCharWidth != -1 )
+{
+// overwrite earlier charWidth value, which we only now have
+// parsed out of mpReadPtr buffer (by way of
+// convertOneTypeOp()s above)
+const int nInt = static_cast(maCharWidth);
+*(pCharWidthPtr++) = 255;
+*(pCharWidthPtr++) = static_cast(nInt >> 24);
+*(pCharWidthPtr++) = static_cast(nInt >> 16);
+*(pCharWidthPtr++) = static_cast(nInt >> 8);
+*(pCharWidthPtr++) = static_cast(nInt);
+}
 
 const int nType1Len = mpWritePtr - pT1Ops;
 
commit b4d5e95b3c9454ead87dd2333799dcae41ac7970
Author: Thorsten Behrens 
AuthorDate: Wed Mar 13 19:16:52 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Mar 16 23:41:22 2019 +0100

vcl: cleanup font subsetter from ancient TODOs

Change-Id: I8e6b6747f2b6c60523c8dc0878c08da39fe1da5b
Reviewed-on: https://gerrit.libreoffice.org/69292
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 79c344d8fbfb..a311104dca9b 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -377,11 +377,10 @@ inline int CffSubsetterContext::popInt()
 
 inline void CffSubsetterContext::updateWidth( bool bUseFirstVal)
 {
-#if 1 // TODO: is this still needed?
 // the first value is not a hint but the charwidth
 if( hasCharWidth())
 return;
-#endif
+
 if( bUseFirstVal) {
 maCharWidth = mpCffLocal->maNominalWidth + mnValStack[0];
 // remove bottom stack entry
@@ -1084,21 +1083,18 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* 
pCffLocal, const U8* const
 
 // prepare the charstring conversion
 mpWritePtr = pT1Ops;
-#if 1   // TODO: update caller
 U8 aType1Ops[ MAX_T1OPS_SIZE];
 if( !pT1Ops)
 mpWritePtr = aType1Ops;
 *const_cast() = mpWritePtr;
-#else
-assert( pT1Ops);
-#endif
 
 // prepend random seed for T1crypt
 *(mpWritePtr++) = 0x48;
 *(mpWritePtr++) = 0x44;
 *(mpWritePtr++) = 0x55;
 *(mpWritePtr++) = ' ';
-#if 1 // convert the Type2 charstring to Type1
+
+// convert the Type2 charstring to Type1
 mpReadPtr = pT2Ops;
 mpReadEnd = pT2Ops + nT2Len;
 // 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/uiconfig

2019-03-11 Thread Libreoffice Gerrit user
 vcl/source/gdi/FileDefinitionWidgetDraw.cxx   |   74 +++---
 vcl/uiconfig/theme_definitions/definition.xml |2 
 2 files changed, 35 insertions(+), 41 deletions(-)

New commits:
commit 212a40aaf7ec3316d5209b688f5f79821f99fbdc
Author: Tomaž Vajngerl 
AuthorDate: Mon Mar 11 17:08:18 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 11 23:09:18 2019 +0100

widget theme: change the tab item height to (min) 32 px

Change-Id: I1919300071a06242fe832880b46c944989daa4b6
Reviewed-on: https://gerrit.libreoffice.org/69057
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 213547cc2d3a..64ef751c7476 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -776,10 +776,12 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion(
 if (!pPart)
 return false;
 
-rNativeBoundingRegion = tools::Rectangle(
-rBoundingControlRegion.TopLeft(),
-Size(rBoundingControlRegion.GetWidth() + pPart->mnMarginWidth,
- rBoundingControlRegion.GetHeight() + 
pPart->mnMarginHeight));
+long nWidth = std::max(rBoundingControlRegion.GetWidth() + 
pPart->mnMarginWidth,
+   long(pPart->mnWidth));
+long nHeight = std::max(rBoundingControlRegion.GetHeight() + 
pPart->mnMarginHeight,
+long(pPart->mnHeight));
+
+rNativeBoundingRegion = tools::Rectangle(aLocation, Size(nWidth, 
nHeight));
 rNativeContentRegion = rNativeBoundingRegion;
 return true;
 }
diff --git a/vcl/uiconfig/theme_definitions/definition.xml 
b/vcl/uiconfig/theme_definitions/definition.xml
index e91953109554..5a4be114ea97 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -320,7 +320,7 @@
 
 
 
-
+
 
 
 
commit 897f6f6252f38e93764aa0e72135768ab1ec3679
Author: Tomaž Vajngerl 
AuthorDate: Mon Mar 11 16:52:37 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 11 23:09:08 2019 +0100

better adjustment algorithm for dynamic sized widgets

A algorithm that gives better results for dynamically sized
widgets is to increase proportionally only the points in shapes
that are over the half of the widget width (or height, when
adjusting the other dimension). This preserves the margins and
doesn't distort the shape of the paths, which is especially
visible when the source needs to be largely resized in one
dimension only.

Change-Id: I2cceb249063387c0f7400ef8d75adb5899aa8c23
Reviewed-on: https://gerrit.libreoffice.org/69056
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 3c0ad43c99b7..213547cc2d3a 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -165,24 +165,18 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, 
SalGraphics& rGraphics
 
 basegfx::B2DRange aInputRectangle(rRectangle.maRectangle);
 
+double fDeltaX = aTargetSurface.getWidth() - 
aSVGRect.getWidth();
+double fDeltaY = aTargetSurface.getHeight() - 
aSVGRect.getHeight();
+
 basegfx::B2DRange aFinalRectangle(
-aTargetSurface.getMinX() + aInputRectangle.getMinX(),
-aTargetSurface.getMinY() + aInputRectangle.getMinY(),
-aTargetSurface.getMaxX() - (aSVGRect.getMaxX() - 
aInputRectangle.getMaxX()),
-aTargetSurface.getMaxY() - (aSVGRect.getMaxY() - 
aInputRectangle.getMaxY()));
-
-
aInputRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
--aInputRectangle.getMinX(), -aInputRectangle.getMinY()));
-
aInputRectangle.transform(basegfx::utils::createScaleB2DHomMatrix(
-aFinalRectangle.getWidth() / aInputRectangle.getWidth(),
-aFinalRectangle.getHeight() / 
aInputRectangle.getHeight()));
-
aInputRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
-aFinalRectangle.getMinX() - 0.5,
-aFinalRectangle.getMinY()
-- 0.5)); // compensate 0.5 for different 
interpretation of where the center of a pixel is
+aInputRectangle.getMinX(), aInputRectangle.getMinY(),
+aInputRectangle.getMaxX() + fDeltaX, 
aInputRectangle.getMaxY() + fDeltaY);
+
+
aFinalRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(
+aTargetSurface.getMinX() 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/uiconfig

2019-03-10 Thread Libreoffice Gerrit user
 vcl/source/gdi/FileDefinitionWidgetDraw.cxx   |   10 --
 vcl/uiconfig/theme_definitions/definition.xml |   11 +++
 2 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit e089b75ba2758183e6eb389d4070560c8989c4e4
Author: Tomaž Vajngerl 
AuthorDate: Sun Mar 10 21:30:28 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 11 00:14:35 2019 +0100

widget theme: change color for window background and frame

Change-Id: I37f1524db71eea2912ffb65fdd7a00605e6b1d4d
Reviewed-on: https://gerrit.libreoffice.org/69017
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/vcl/uiconfig/theme_definitions/definition.xml 
b/vcl/uiconfig/theme_definitions/definition.xml
index 23a19de392d5..46346286756c 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -366,25 +366,20 @@
 
 
 
-
+
 
 
 
 
-
+
 
 
 
 
 
-
-
-
-
-
 
 
-
+
 
 
 
commit cbfe46bf79ac89f7cd1916eeaaf5f10164038535
Author: Tomaž Vajngerl 
AuthorDate: Sun Mar 10 21:29:25 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 11 00:14:22 2019 +0100

widget theme: take into account scaling factor for images

Change-Id: I65bd71dfd113fae33aee7c2b60b945e065314f80
Reviewed-on: https://gerrit.libreoffice.org/69016
Reviewed-by: Tomaž Vajngerl 
Tested-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index b51d98b2c073..5c0920bca4d6 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -27,6 +27,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -336,13 +337,18 @@ void 
munchDrawCommands(std::vector> const& rDrawCom
 break;
 case DrawCommandType::IMAGE:
 {
+double nScaleFactor = 1.0;
+if (comphelper::LibreOfficeKit::isActive())
+nScaleFactor = comphelper::LibreOfficeKit::getDPIScale();
+
 auto const& rDrawCommand = static_cast(*pDrawCommand);
 SvFileStream aFileStream(rDrawCommand.msSource, 
StreamMode::READ);
 BitmapEx aBitmap;
-vcl::bitmap::loadFromSvg(aFileStream, "", aBitmap, 1.0);
+vcl::bitmap::loadFromSvg(aFileStream, "", aBitmap, 
nScaleFactor);
 long nImageWidth = aBitmap.GetSizePixel().Width();
 long nImageHeight = aBitmap.GetSizePixel().Height();
-SalTwoRect aTR(0, 0, nImageWidth, nImageHeight, nX, nY, 
nImageWidth, nImageHeight);
+SalTwoRect aTR(0, 0, nImageWidth, nImageHeight, nX, nY, 
nImageWidth / nScaleFactor,
+   nImageHeight / nScaleFactor);
 if (!!aBitmap)
 {
 const std::shared_ptr pSalBitmap
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/uiconfig

2019-03-04 Thread Libreoffice Gerrit user
 vcl/source/gdi/FileDefinitionWidgetDraw.cxx   |   58 ++
 vcl/source/gdi/WidgetDefinitionReader.cxx |   11 
 vcl/uiconfig/theme_definitions/definition.xml |   33 ++
 3 files changed, 94 insertions(+), 8 deletions(-)

New commits:
commit 394bf64515273985b30f77033c95277b41f021c4
Author: Tomaž Vajngerl 
AuthorDate: Tue Jan 29 13:53:48 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 4 22:42:00 2019 +0100

Draw basic combobox from the theme definition

Change-Id: I2ed631676be878bd5e89872077ab47937aabbf7a
Reviewed-on: https://gerrit.libreoffice.org/68697
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index a287f2c0fee7..6681d2190dd2 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -42,7 +42,7 @@ 
FileDefinitionWidgetDraw::FileDefinitionWidgetDraw(SalGraphics& rGraphics)
 pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
 }
 
-bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, 
ControlPart /*ePart*/)
+bool FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, 
ControlPart ePart)
 {
 switch (eType)
 {
@@ -52,7 +52,9 @@ bool 
FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr
 case ControlType::Checkbox:
 return true;
 case ControlType::Combobox:
-return false;
+if (ePart == ControlPart::HasBackgroundTexture)
+return false;
+return true;
 case ControlType::Editbox:
 case ControlType::EditboxNoBorder:
 case ControlType::MultilineEditbox:
@@ -248,7 +250,21 @@ bool 
FileDefinitionWidgetDraw::drawNativeControl(ControlType eType, ControlPart
 }
 break;
 case ControlType::Combobox:
-break;
+{
+std::shared_ptr pPart
+= m_aWidgetDefinition.getDefinition(eType, ePart);
+if (pPart)
+{
+auto aStates = pPart->getStates(eState, rValue);
+if (!aStates.empty())
+{
+std::shared_ptr pState = 
aStates.back();
+munchDrawCommands(pState->mpDrawCommands, m_rGraphics, nX, 
nY, nWidth, nHeight);
+bOK = true;
+}
+}
+}
+break;
 case ControlType::Editbox:
 case ControlType::EditboxNoBorder:
 case ControlType::MultilineEditbox:
@@ -309,6 +325,9 @@ bool FileDefinitionWidgetDraw::getNativeControlRegion(
 case ControlType::Checkbox:
 rNativeContentRegion = tools::Rectangle(Point(), Size(48, 32));
 return true;
+case ControlType::Radiobutton:
+rNativeContentRegion = tools::Rectangle(Point(), Size(32, 32));
+return true;
 default:
 break;
 }
diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx 
b/vcl/source/gdi/WidgetDefinitionReader.cxx
index 40dcbcee45bb..f37385cc09b9 100644
--- a/vcl/source/gdi/WidgetDefinitionReader.cxx
+++ b/vcl/source/gdi/WidgetDefinitionReader.cxx
@@ -153,6 +153,11 @@ bool getControlTypeForXmlString(OString const& rString, 
ControlType& reType)
 reType = ControlType::Checkbox;
 bReturn = true;
 }
+else if (rString == "combobox")
+{
+reType = ControlType::Combobox;
+bReturn = true;
+}
 
 return bReturn;
 }
diff --git a/vcl/uiconfig/theme_definitions/definition.xml 
b/vcl/uiconfig/theme_definitions/definition.xml
index fa37bf8f5ba2..0cbdebaa078c 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -90,6 +90,26 @@
 
 
 
+
+
+
+   
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
commit c4378dd23edd70110cada99b97a8df6d6f6d47d2
Author: Tomaž Vajngerl 
AuthorDate: Tue Jan 29 13:51:50 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 4 22:41:51 2019 +0100

Draw basic checkbox from the theme definition

Change-Id: I8b8a0bbe0d17736dd19151cebe4ad2d5344ea691
Reviewed-on: https://gerrit.libreoffice.org/68693
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index bc46bcbdd67f..a287f2c0fee7 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -49,8 +49,8 @@ bool 
FileDefinitionWidgetDraw::isNativeControlSupported(ControlType eType, Contr
 case ControlType::Generic:
 case ControlType::Pushbutton:
 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/uiconfig

2019-03-04 Thread Libreoffice Gerrit user
 vcl/source/gdi/FileDefinitionWidgetDraw.cxx   |9 -
 vcl/uiconfig/theme_definitions/definition.xml |3 ++-
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit e881cb41363874f1644728f2d35dc057e7e484ec
Author: Tomaž Vajngerl 
AuthorDate: Fri Jan 25 17:01:12 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 4 12:32:10 2019 +0100

draw polyline and polygon when drawing rect draw command

Change-Id: Ic00d090e0aa85d451a50be52794606546021be38
Reviewed-on: https://gerrit.libreoffice.org/68671
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx 
b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
index 600b736c3c7c..854066694e22 100644
--- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
+++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx
@@ -107,10 +107,17 @@ void 
munchDrawCommands(std::vector> const& rDrawCom
 rRectDrawCommand.mnRx, 
rRectDrawCommand.mnRy);
 
 basegfx::B2DPolygon aB2DPolygon(aPolygon.getB2DPolygon());
-rGraphics.SetLineColor(rRectDrawCommand.maStrokeColor);
+rGraphics.SetLineColor();
 rGraphics.SetFillColor(rRectDrawCommand.maFillColor);
 rGraphics.DrawPolyPolygon(basegfx::B2DHomMatrix(),
   
basegfx::B2DPolyPolygon(aB2DPolygon), 0.0f, nullptr);
+rGraphics.SetLineColor(rRectDrawCommand.maStrokeColor);
+rGraphics.SetFillColor();
+rGraphics.DrawPolyLine(basegfx::B2DHomMatrix(), aB2DPolygon, 
0.0f,
+   
basegfx::B2DVector(rRectDrawCommand.mnStrokeWidth,
+  
rRectDrawCommand.mnStrokeWidth),
+   basegfx::B2DLineJoin::Round, 
css::drawing::LineCap_ROUND,
+   0.0f, false, nullptr);
 }
 break;
 case DrawCommandType::CIRCLE:
commit 9d86d3538b588d1e4864b9d26c301cd8d6932858
Author: Tomaž Vajngerl 
AuthorDate: Fri Jan 25 17:00:06 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Mar 4 12:31:55 2019 +0100

use line for editbox theme definition

Change-Id: Ie70d1050a58d96443fe5df9c743ba201fca9d25f
Reviewed-on: https://gerrit.libreoffice.org/68670
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/uiconfig/theme_definitions/definition.xml 
b/vcl/uiconfig/theme_definitions/definition.xml
index 2bd0212007ee..91c473f290a6 100644
--- a/vcl/uiconfig/theme_definitions/definition.xml
+++ b/vcl/uiconfig/theme_definitions/definition.xml
@@ -81,7 +81,8 @@
 
 
 
-
+
+
 
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx writerfilter/source xmlhelp/source xmloff/source

2019-02-10 Thread Libreoffice Gerrit user
 vcl/source/app/help.cxx|2 
 vcl/source/app/svmain.cxx  |2 
 vcl/source/control/ctrl.cxx|2 
 vcl/source/control/field.cxx   |2 
 vcl/source/control/imgctrl.cxx |2 
 vcl/source/control/notebookbar.cxx |4 
 vcl/source/edit/vclmedit.cxx   |2 
 vcl/source/filter/graphicfilter.cxx|8 
 vcl/source/filter/wmf/emfwr.cxx|4 
 vcl/source/filter/wmf/wmfwr.cxx|   14 
 vcl/source/fontsubset/cff.cxx  |   16 -
 vcl/source/gdi/gradient.cxx|4 
 vcl/source/gdi/metaact.cxx |2 
 vcl/source/gdi/pdfextoutdevdata.cxx|2 
 vcl/source/gdi/pdfwriter_impl.cxx  |4 
 vcl/source/graphic/UnoGraphicDescriptor.cxx|2 
 vcl/source/outdev/gradient.cxx |   32 +-
 vcl/source/outdev/text.cxx |2 
 vcl/source/treelist/svimpbox.cxx   |4 
 vcl/source/treelist/transfer.cxx   |2 
 vcl/source/treelist/transfer2.cxx  |   16 -
 vcl/source/window/accel.cxx|2 
 vcl/source/window/accessibility.cxx|4 
 vcl/source/window/dialog.cxx   |   20 -
 vcl/source/window/dlgctrl.cxx  |2 
 vcl/source/window/dndlistenercontainer.cxx |6 
 vcl/source/window/menu.cxx |4 
 vcl/source/window/paint.cxx|8 
 vcl/source/window/seleng.cxx   |2 
 vcl/source/window/syswin.cxx   |2 
 vcl/source/window/window.cxx   |4 
 vcl/unx/generic/app/i18n_cb.cxx|   34 +-
 vcl/unx/generic/dtrans/X11_selection.cxx   |2 
 vcl/unx/generic/gdi/gdiimpl.cxx|8 
 vcl/unx/generic/gdi/salvd.cxx  |2 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |4 
 vcl/unx/generic/glyphs/glyphcache.cxx  |4 
 vcl/unx/generic/printer/ppdparser.cxx  |2 
 vcl/unx/generic/window/salframe.cxx|   22 -
 vcl/unx/glxtest.cxx|2 
 vcl/unx/gtk/a11y/atkfactory.cxx|6 
 vcl/unx/gtk/a11y/atkutil.cxx   |4 
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx   |2 
 vcl/unx/gtk3/gtk3gtkdata.cxx   |6 
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx  |3 
 writerfilter/source/dmapper/DomainMapper.cxx   |8 
 writerfilter/source/dmapper/DomainMapperTableManager.cxx   |   22 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |   12 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx  |2 
 writerfilter/source/dmapper/NumberingManager.cxx   |6 
 writerfilter/source/dmapper/ThemeTable.cxx |   24 -
 writerfilter/source/ooxml/OOXMLDocumentImpl.cxx|   12 
 xmlhelp/source/cxxhelp/provider/content.cxx|2 
 xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx  |2 
 xmlhelp/source/treeview/tvread.cxx |   36 +-
 xmloff/source/chart/SchXMLExport.cxx   |4 
 xmloff/source/core/XMLEmbeddedObjectImportContext.cxx  |   18 -
 xmloff/source/core/nmspmap.cxx |2 
 xmloff/source/draw/eventimp.cxx|  192 ++---
 xmloff/source/draw/sdxmlexp.cxx|2 
 xmloff/source/draw/ximpshap.cxx|2 
 xmloff/source/draw/ximpstyl.cxx|2 
 xmloff/source/forms/elementexport.cxx  |   12 
 xmloff/source/forms/elementimport.cxx  |2 
 xmloff/source/style/DrawAspectHdl.cxx  |2 
 xmloff/source/style/ImageStyle.cxx |2 
 xmloff/source/style/PageMasterImportPropMapper.cxx |6 
 xmloff/source/style/XMLClipPropertyHandler.cxx |2 
 xmloff/source/style/XMLPercentOrMeasurePropertyHandler.cxx |2 
 xmloff/source/style/shadwhdl.cxx   |2 
 xmloff/source/style/xmlbahdl.cxx   |8 
 xmloff/source/table/XMLTableExport.cxx |   31 +-
 xmloff/source/text/XMLIndexTabStopEntryContext.cxx |2 
 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2018-11-05 Thread Libreoffice Gerrit user
 vcl/source/window/dialog.cxx |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 15aee54bb56982d57c27234a4ae946b45354c310
Author: Tor Lillqvist 
AuthorDate: Mon Nov 5 16:52:49 2018 +0200
Commit: Tor Lillqvist 
CommitDate: Mon Nov 5 16:52:53 2018 +0200

Bin obsolete comment and the related commented-out line of code

Change-Id: I158f99429ebeb4cbdaa6ca2614b689cc287c8010

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index aae21743daf9..00f471ef9604 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1055,12 +1055,7 @@ short Dialog::Execute()
 return static_cast(nRet);
 
 #else
-
-// touch_ui_dialog_modal was dummied out both for Android and iOS (well, 
TiledLibreOffice anyway)
-// For Android it returned MLODialogOK always, for iOS Cancel. Let's go 
with OK.
-// MLODialogResult result = touch_ui_dialog_modal(kind, 
ImplGetDialogText(this).getStr());
 return RET_OK;
-
 #endif
 }
 
commit 2a8a93b521c313aba09c034899a70849d8b17710
Author: Tor Lillqvist 
AuthorDate: Mon Nov 5 16:49:25 2018 +0200
Commit: Tor Lillqvist 
CommitDate: Mon Nov 5 16:51:24 2018 +0200

We do need Dialog::Execute() for iOS

Otherwise the Data>Sort dialog in a spreadsheet document, for
instance, will not show up. No idea about Android, so keep it dummied
out for that.

Change-Id: If9a8f8f4cfb813721a9edd6a0a3da398615981b2

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 11a92bb9a8f4..aae21743daf9 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1017,7 +1017,10 @@ BitmapEx Dialog::createScreenshot()
 
 short Dialog::Execute()
 {
-#if HAVE_FEATURE_DESKTOP
+// Once the Android app is based on same idea as the iOS one currently
+// being developed, no conditional should be needed here. Until then,
+// play it safe.
+#if HAVE_FEATURE_DESKTOP || defined IOS
 VclPtr xWindow = this;
 
 mbInSyncExecute = true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx vcl/workben xmloff/qa xmloff/source

2018-10-18 Thread Libreoffice Gerrit user
 vcl/source/app/svapp.cxx |   86 ++--
 vcl/source/font/font.cxx |6 -
 vcl/source/fontsubset/ttcr.cxx   |4 
 vcl/source/window/debugevent.cxx |6 -
 vcl/source/window/layout.cxx |2 
 vcl/unx/generic/app/i18n_ic.cxx  |2 
 vcl/unx/generic/app/saldisp.cxx  |   17 +---
 vcl/unx/generic/fontmanager/fontmanager.cxx  |2 
 vcl/unx/gtk3/gtk3gtkinst.cxx |2 
 vcl/workben/vcldemo.cxx  |   12 +-
 xmloff/qa/unit/uxmloff.cxx   |2 
 xmloff/source/forms/controlpropertymap.cxx   |   48 ---
 xmloff/source/forms/gridcolumnproptranslator.cxx |4 
 xmloff/source/style/xmlexppr.cxx |2 
 xmloff/source/transform/EventMap.cxx |4 
 xmloff/source/transform/EventMap.hxx |4 
 xmloff/source/transform/EventOASISTContext.cxx   |4 
 xmloff/source/transform/EventOOoTContext.cxx |   12 +-
 xmloff/source/transform/OOo2Oasis.cxx|   82 +--
 xmloff/source/transform/Oasis2OOo.cxx|   96 +++
 xmloff/source/transform/PropertyActionsOASIS.cxx |   26 +++---
 xmloff/source/transform/PropertyActionsOASIS.hxx |   26 +++---
 xmloff/source/transform/PropertyActionsOOo.cxx   |   36 
 xmloff/source/transform/PropertyActionsOOo.hxx   |   36 
 xmloff/source/transform/StyleOASISTContext.cxx   |2 
 xmloff/source/transform/StyleOOoTContext.cxx |2 
 xmloff/source/transform/TransformerActions.cxx   |4 
 xmloff/source/transform/TransformerActions.hxx   |4 
 xmloff/source/transform/TransformerBase.cxx  |4 
 xmloff/source/transform/TransformerBase.hxx  |4 
 xmloff/source/transform/TransformerTokenMap.cxx  |2 
 xmloff/source/transform/TransformerTokenMap.hxx  |2 
 32 files changed, 249 insertions(+), 296 deletions(-)

New commits:
commit 265072a4cafd9f8552264448e2fc049ae3ac97e5
Author: Noel Grandin 
AuthorDate: Thu Oct 18 11:54:34 2018 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 19 07:57:49 2018 +0200

loplugin:staticvar in vcl

Change-Id: I2bdab84dc81e0545aa96542caec213db61765f68
Reviewed-on: https://gerrit.libreoffice.org/61922
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index a43b830ded2b..fb8ec12d28d7 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -89,65 +89,35 @@ void InitSettings(ImplSVData* pSVData);
 }
 
 // keycodes handled internally by VCL
-class ImplReservedKey
-{
-public:
-explicit ImplReservedKey( vcl::KeyCode aKeyCode )
-: mKeyCode(aKeyCode)
-{
-}
-
-vcl::KeyCode mKeyCode;
-};
-
-typedef std::pair ReservedKeys;
-namespace
-{
-struct ImplReservedKeysImpl
-{
-ReservedKeys* operator()()
-{
-static ImplReservedKey ImplReservedKeys[] =
-{
-ImplReservedKey(vcl::KeyCode(KEY_F1,0)  ),
-ImplReservedKey(vcl::KeyCode(KEY_F1,KEY_SHIFT)  ),
-ImplReservedKey(vcl::KeyCode(KEY_F1,KEY_MOD1)   ),
-ImplReservedKey(vcl::KeyCode(KEY_F2,KEY_SHIFT)  ),
-ImplReservedKey(vcl::KeyCode(KEY_F4,KEY_MOD1)   ),
-ImplReservedKey(vcl::KeyCode(KEY_F4,KEY_MOD2)   ),
-ImplReservedKey(vcl::KeyCode(KEY_F4,KEY_MOD1|KEY_MOD2)  ),
-ImplReservedKey(vcl::KeyCode(KEY_F6,0)  ),
-ImplReservedKey(vcl::KeyCode(KEY_F6,KEY_MOD1)   ),
-ImplReservedKey(vcl::KeyCode(KEY_F6,KEY_SHIFT)  ),
-ImplReservedKey(vcl::KeyCode(KEY_F6,KEY_MOD1|KEY_SHIFT) ),
-ImplReservedKey(vcl::KeyCode(KEY_F10,0) )
+static vcl::KeyCode const ReservedKeys[]
+{
+vcl::KeyCode(KEY_F1,0)  ,
+vcl::KeyCode(KEY_F1,KEY_SHIFT)  ,
+vcl::KeyCode(KEY_F1,KEY_MOD1)   ,
+vcl::KeyCode(KEY_F2,KEY_SHIFT)  ,
+vcl::KeyCode(KEY_F4,KEY_MOD1)   ,
+vcl::KeyCode(KEY_F4,KEY_MOD2)   ,
+vcl::KeyCode(KEY_F4,KEY_MOD1|KEY_MOD2)  ,
+vcl::KeyCode(KEY_F6,0)  ,
+vcl::KeyCode(KEY_F6,KEY_MOD1)   ,
+vcl::KeyCode(KEY_F6,KEY_SHIFT)  ,
+vcl::KeyCode(KEY_F6,KEY_MOD1|KEY_SHIFT) ,
+vcl::KeyCode(KEY_F10,0)
 #ifdef UNX
 ,
-ImplReservedKey(vcl::KeyCode(KEY_1,KEY_SHIFT|KEY_MOD1)),
-ImplReservedKey(vcl::KeyCode(KEY_2,KEY_SHIFT|KEY_MOD1)),
-ImplReservedKey(vcl::KeyCode(KEY_3,KEY_SHIFT|KEY_MOD1)),
-

[Libreoffice-commits] core.git: 2 commits - vcl/source

2018-09-05 Thread Libreoffice Gerrit user
 vcl/source/gdi/print.cxx   |7 ++-
 vcl/source/window/clipping.cxx |   26 --
 vcl/source/window/window.cxx   |   15 ++-
 3 files changed, 20 insertions(+), 28 deletions(-)

New commits:
commit 3b4ffee640b9f3f19d142de518ebc85378e68e9c
Author: Noel Grandin 
AuthorDate: Tue Sep 4 12:12:48 2018 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 5 09:29:42 2018 +0200

loplugin:useuniqueptr in Window

Change-Id: I0072d3085b1c00573d72948d1bbefb241b0da205
Reviewed-on: https://gerrit.libreoffice.org/59998
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx
index b7c6fbf36cb5..8ad91cedb45f 100644
--- a/vcl/source/window/clipping.cxx
+++ b/vcl/source/window/clipping.cxx
@@ -403,9 +403,9 @@ bool Window::ImplSetClipFlagChildren( bool 
bSysObjOnlySmaller )
 bool bUpdate = true;
 if ( mpWindowImpl->mpSysObj )
 {
-vcl::Region* pOldRegion = nullptr;
+std::unique_ptr pOldRegion;
 if ( bSysObjOnlySmaller && !mpWindowImpl->mbInitWinClipRegion )
-pOldRegion = new vcl::Region( mpWindowImpl->maWinClipRegion );
+pOldRegion.reset(new vcl::Region( mpWindowImpl->maWinClipRegion ));
 
 mbInitClipRegion = true;
 mpWindowImpl->mbInitWinClipRegion = true;
@@ -418,27 +418,25 @@ bool Window::ImplSetClipFlagChildren( bool 
bSysObjOnlySmaller )
 pWindow = pWindow->mpWindowImpl->mpNext;
 }
 
-if ( !ImplSysObjClip( pOldRegion ) )
+if ( !ImplSysObjClip( pOldRegion.get() ) )
 {
 mbInitClipRegion = true;
 mpWindowImpl->mbInitWinClipRegion = true;
 bUpdate = false;
 }
-
-delete pOldRegion;
 }
 else
 {
-mbInitClipRegion = true;
-mpWindowImpl->mbInitWinClipRegion = true;
+mbInitClipRegion = true;
+mpWindowImpl->mbInitWinClipRegion = true;
 
-vcl::Window* pWindow = mpWindowImpl->mpFirstChild;
-while ( pWindow )
-{
-if ( !pWindow->ImplSetClipFlagChildren( bSysObjOnlySmaller ) )
-bUpdate = false;
-pWindow = pWindow->mpWindowImpl->mpNext;
-}
+vcl::Window* pWindow = mpWindowImpl->mpFirstChild;
+while ( pWindow )
+{
+if ( !pWindow->ImplSetClipFlagChildren( bSysObjOnlySmaller ) )
+bUpdate = false;
+pWindow = pWindow->mpWindowImpl->mpNext;
+}
 }
 return bUpdate;
 }
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 243d30a93beb..c6d2fea5c614 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1440,14 +1440,14 @@ void Window::ImplPosSizeWindow( long nX, long nY,
 longnOldOutOffY = mnOutOffY;
 longnOldOutWidth= mnOutWidth;
 longnOldOutHeight   = mnOutHeight;
-vcl::Region* pOverlapRegion  = nullptr;
-vcl::Region* pOldRegion  = nullptr;
+std::unique_ptr pOverlapRegion;
+std::unique_ptr pOldRegion;
 
 if ( IsReallyVisible() )
 {
 tools::Rectangle aOldWinRect( Point( nOldOutOffX, nOldOutOffY ),
Size( nOldOutWidth, nOldOutHeight ) );
-pOldRegion = new vcl::Region( aOldWinRect );
+pOldRegion.reset( new vcl::Region( aOldWinRect ) );
 if ( mpWindowImpl->mbWinRegion )
 pOldRegion->Intersect( ImplPixelToDevicePixel( 
mpWindowImpl->maWinRegion ) );
 
@@ -1527,7 +1527,7 @@ void Window::ImplPosSizeWindow( long nX, long nY,
 {
 if ( bCopyBits && !pOverlapRegion )
 {
-pOverlapRegion = new vcl::Region();
+pOverlapRegion.reset( new vcl::Region() );
 ImplCalcOverlapRegion( tools::Rectangle( Point( mnOutOffX, 
mnOutOffY ),
   Size( mnOutWidth, 
mnOutHeight ) ),
*pOverlapRegion, false, true );
@@ -1545,7 +1545,7 @@ void Window::ImplPosSizeWindow( long nX, long nY,
 {
 if ( bCopyBits && !pOverlapRegion )
 {
-pOverlapRegion = new vcl::Region();
+pOverlapRegion.reset( new vcl::Region() );
 ImplCalcOverlapRegion( tools::Rectangle( Point( mnOutOffX, 
mnOutOffY ),
   Size( mnOutWidth, 
mnOutHeight ) ),
*pOverlapRegion, false, true );
@@ -1670,7 +1670,7 @@ void Window::ImplPosSizeWindow( long nX, long nY,
 if ( !bInvalidate )
 {
 if ( !pOverlapRegion->IsEmpty() )
-ImplInvalidateFrameRegion( pOverlapRegion, 
InvalidateFlags::Children );
+ImplInvalidateFrameRegion( 
pOverlapRegion.get(), InvalidateFlags::Children );
   

[Libreoffice-commits] core.git: 2 commits - vcl/source

2018-07-24 Thread Libreoffice Gerrit user
 vcl/source/gdi/CommonSalLayout.cxx |9 +++--
 vcl/source/gdi/sallayout.cxx   |7 ---
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit d43c1b718f9a290307510b7d526a981b15264622
Author: Caolán McNamara 
AuthorDate: Tue Jul 24 15:24:35 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 24 17:59:03 2018 +0200

split buffers to clarify what it does

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

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 9cf26a6971cd..a738a1d5168b 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1400,20 +1400,21 @@ sal_Int32 MultiSalLayout::GetTextBreak( 
DeviceCoordinate nMaxWidth, DeviceCoordi
 return mpLayouts[0]->GetTextBreak( nMaxWidth, nCharExtra, nFactor );
 
 int nCharCount = mnEndCharPos - mnMinCharPos;
-std::unique_ptr const pCharWidths(new 
DeviceCoordinate[2 * nCharCount]);
+std::unique_ptr const pCharWidths(new 
DeviceCoordinate[nCharCount]);
+std::unique_ptr const pFallbackCharWidths(new 
DeviceCoordinate[nCharCount]);
 mpLayouts[0]->FillDXArray( pCharWidths.get() );
 
 for( int n = 1; n < mnLevel; ++n )
 {
 SalLayout& rLayout = *mpLayouts[ n ];
-rLayout.FillDXArray( [nCharCount] );
+rLayout.FillDXArray( pFallbackCharWidths.get() );
 double fUnitMul = mnUnitsPerPixel;
 fUnitMul /= rLayout.GetUnitsPerPixel();
 for( int i = 0; i < nCharCount; ++i )
 {
 if( pCharWidths[ i ] == 0 )
 {
-DeviceCoordinate w = pCharWidths[ i + nCharCount ];
+DeviceCoordinate w = pFallbackCharWidths[i];
 w = static_cast(w * fUnitMul + 0.5);
 pCharWidths[ i ] = w;
 }
commit ad3595cac951d069a2b0883a18711edab138c1ab
Author: Caolán McNamara 
AuthorDate: Tue Jul 24 14:47:14 2018 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 24 17:58:53 2018 +0200

forcepoint#53 restrict to expected index range

Change-Id: I22f01e5a3e3cf51b014ac841cd14071dce5baf0f
Reviewed-on: https://gerrit.libreoffice.org/57920
Tested-by: Jenkins
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 eb3260bdbdc9..647788129d32 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -574,13 +574,18 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 bool GenericSalLayout::GetCharWidths(DeviceCoordinate* pCharWidths) const
 {
-int nCharCount = mnEndCharPos - mnMinCharPos;
+const int nCharCount = mnEndCharPos - mnMinCharPos;
 
 for (int i = 0; i < nCharCount; ++i)
 pCharWidths[i] = 0;
 
 for (auto const& aGlyphItem : m_GlyphItems)
-pCharWidths[aGlyphItem.mnCharPos - mnMinCharPos] += 
aGlyphItem.mnNewWidth;
+{
+const int nIndex = aGlyphItem.mnCharPos - mnMinCharPos;
+if (nIndex >= nCharCount)
+continue;
+pCharWidths[nIndex] += aGlyphItem.mnNewWidth;
+}
 
 return true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2018-04-23 Thread Tor Lillqvist
 vcl/source/bitmap/BitmapEmbossGreyFilter.cxx |2 +-
 vcl/source/bitmap/BitmapMosaicFilter.cxx |2 +-
 vcl/source/bitmap/BitmapSepiaFilter.cxx  |2 +-
 vcl/source/bitmap/BitmapSmoothenFilter.cxx   |2 +-
 vcl/source/bitmap/BitmapSobelGreyFilter.cxx  |   20 ++--
 vcl/source/bitmap/BitmapSolarizeFilter.cxx   |2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit c250b6a5c6edbca08d5f083ff33fbfc5a49b3b4a
Author: Tor Lillqvist 
Date:   Mon Apr 23 09:31:01 2018 +0300

loplugin:expressionalwayszero

So comment out the use of those expressions, and to avoid ununsed
variables, also comment out the definitions of those const variables.

Change-Id: I870c7d9599f944d3d55758492c059bcf15628a4a
Reviewed-on: https://gerrit.libreoffice.org/53305
Tested-by: Jenkins 
Reviewed-by: Tor Lillqvist 

diff --git a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx 
b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx
index 450772dd2abe..a80b09c1dad7 100644
--- a/vcl/source/bitmap/BitmapSobelGreyFilter.cxx
+++ b/vcl/source/bitmap/BitmapSobelGreyFilter.cxx
@@ -37,11 +37,11 @@ BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& 
rBitmapEx)
 BitmapColor aGrey(sal_uInt8(0));
 const long nWidth = pWriteAcc->Width();
 const long nHeight = pWriteAcc->Height();
-const long nMask111 = -1, nMask121 = 0, nMask131 = 1;
-const long nMask211 = -2, nMask221 = 0, nMask231 = 2;
-const long nMask311 = -1, nMask321 = 0, nMask331 = 1;
+const long nMask111 = -1, /* nMask121 = 0, */ nMask131 = 1;
+const long nMask211 = -2, /* nMask221 = 0, */ nMask231 = 2;
+const long nMask311 = -1, /* nMask321 = 0, */ nMask331 = 1;
 const long nMask112 = 1, nMask122 = 2, nMask132 = 1;
-const long nMask212 = 0, nMask222 = 0, nMask232 = 0;
+// const long /* nMask212 = 0, */ /* nMask222 = 0, */ /* 
nMask232 = 0 */;
 const long nMask312 = -1, nMask322 = -2, nMask332 = -1;
 long nGrey11, nGrey12, nGrey13;
 long nGrey21, nGrey22, nGrey23;
@@ -89,25 +89,25 @@ BitmapEx BitmapSobelGreyFilter::execute(BitmapEx const& 
rBitmapEx)
 nSum1 += nMask111 * nGrey11;
 nSum2 += nMask112 * nGrey11;
 
-nSum1 += nMask121 * nGrey12;
+// nSum1 += nMask121 * nGrey12;
 nSum2 += nMask122 * nGrey12;
 
 nSum1 += nMask131 * nGrey13;
 nSum2 += nMask132 * nGrey13;
 
 nSum1 += nMask211 * nGrey21;
-nSum2 += nMask212 * nGrey21;
+// nSum2 += nMask212 * nGrey21;
 
-nSum1 += nMask221 * nGrey22;
-nSum2 += nMask222 * nGrey22;
+// nSum1 += nMask221 * nGrey22;
+// nSum2 += nMask222 * nGrey22;
 
 nSum1 += nMask231 * nGrey23;
-nSum2 += nMask232 * nGrey23;
+// nSum2 += nMask232 * nGrey23;
 
 nSum1 += nMask311 * nGrey31;
 nSum2 += nMask312 * nGrey31;
 
-nSum1 += nMask321 * nGrey32;
+// nSum1 += nMask321 * nGrey32;
 nSum2 += nMask322 * nGrey32;
 
 nSum1 += nMask331 * nGrey33;
commit c08b09331083aff367c153b9da14fb5a2e6d130b
Author: Stephan Bergmann 
Date:   Mon Apr 23 09:35:37 2018 +0200

loplugin:redundantfcast

(Presumably  "vcl: 
ImplSolarize() to
BitmapSolarizeFilter" passed Gerrit/Jenkins because the Linux Clang plugin 
build
was done in C++11, not C++17 mode.)

Change-Id: I8a7afee18ed2f83921eb82b74252d0ebf76c25d5

diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx 
b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
index f6ea34527de5..f64126ac978a 100644
--- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
+++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
@@ -145,7 +145,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& 
rBitmapEx)
 }
 
 if (bRet)
-return BitmapEx(rBitmapEx);
+return rBitmapEx;
 
 return BitmapEx();
 }
diff --git a/vcl/source/bitmap/BitmapMosaicFilter.cxx 
b/vcl/source/bitmap/BitmapMosaicFilter.cxx
index faefbe5d3766..f17a25ff2283 100644
--- a/vcl/source/bitmap/BitmapMosaicFilter.cxx
+++ b/vcl/source/bitmap/BitmapMosaicFilter.cxx
@@ -179,7 +179,7 @@ BitmapEx BitmapMosaicFilter::execute(BitmapEx const& 
rBitmapEx)
 }
 
 if (bRet)
-return BitmapEx(rBitmapEx);
+return rBitmapEx;
 
 return BitmapEx();
 }
diff --git 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2018-01-26 Thread Pranav Kant
 vcl/source/window/paint.cxx   |1 +
 vcl/source/window/winproc.cxx |4 
 2 files changed, 5 insertions(+)

New commits:
commit 3dcf50fb383ebd8c38b1b931e41e3985adcc9bed
Author: Pranav Kant 
Date:   Fri Jan 26 22:25:43 2018 +0530

lokdialog: Don't leak tooltip text window through tunnelling f/w

Change-Id: I0491c86fdb1511ee4841aa670428c78aba24b8d0

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 66233e765941..efe671705472 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -22,6 +22,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -157,6 +158,9 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, 
const Point& rMousePo
 
 static void ImplHandleMouseHelpRequest( vcl::Window* pChild, const Point& 
rMousePos )
 {
+if (comphelper::LibreOfficeKit::isActive())
+return;
+
 ImplSVData* pSVData = ImplGetSVData();
 if ( !pSVData->maHelpData.mpHelpWin ||
  !( pSVData->maHelpData.mpHelpWin->IsWindowOrChild( pChild ) ||
commit a39cefd99c40f121b60c882dba6000894b6996d9
Author: Pranav Kant 
Date:   Fri Jan 26 15:53:32 2018 +0530

lokdialog: Call LOK invalidate explicitly here

In some cases, Window::Update is called directly by the child classes.
This is not good for LOK clients because they rely on 'invalidate'
callbacks for painting the window.

Change-Id: I05402d7597841c96a25b7f5ac4cc60dda6ec5a16

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 5179f5648f0f..17e6db733711 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1299,6 +1299,7 @@ void Window::Update()
  }
 
 pUpdateWindow->ImplCallPaint(nullptr, 
pUpdateWindow->mpWindowImpl->mnPaintFlags);
+pUpdateWindow->LogicInvalidate(nullptr);
 
 if (xWindow->IsDisposed())
return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/workben

2017-11-06 Thread Caolán McNamara
 vcl/source/gdi/pngread.cxx |   26 +-
 vcl/workben/fftester.cxx   |1 +
 2 files changed, 14 insertions(+), 13 deletions(-)

New commits:
commit b22ddf60d5c42f39b39214134e819c582b58ad3d
Author: Caolán McNamara 
Date:   Mon Nov 6 09:51:29 2017 +

mbIDAT is actually set when mbIDAT is complete, not when started

Change-Id: I8d733ab07b6e989c05f131b61441da7e6d124772

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 0752d52ff6f7..a29ed669d048 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -126,7 +126,7 @@ private:
 boolmbGrayScale : 1;
 boolmbzCodecInUse : 1;
 boolmbStatus : 1;
-boolmbIDAT : 1; // true if finished with enough 
IDAT chunks
+boolmbIDATComplete : 1; // true if finished with enough 
IDAT chunks
 boolmbpHYs : 1; // true if physical size of pixel 
available
 boolmbIgnoreGammaChunk : 1;
 
@@ -205,7 +205,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
 mbGrayScale( false ),
 mbzCodecInUse   ( false ),
 mbStatus( true ),
-mbIDAT( false ),
+mbIDATComplete( false ),
 mbpHYs  ( false ),
 mbIgnoreGammaChunk  ( false ),
 #if OSL_DEBUG_LEVEL > 0
@@ -341,7 +341,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 }
 
 // parse the remaining chunks
-while (mbStatus && !mbIDAT && ReadNextChunk())
+while (mbStatus && !mbIDATComplete && ReadNextChunk())
 {
 switch( mnChunkType )
 {
@@ -353,7 +353,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 
 case PNGCHUNK_gAMA :// the gamma 
chunk must precede
 {   // the 'IDAT' 
and also the 'PLTE'(if available )
-if ( !mbIgnoreGammaChunk && !mbIDAT )
+if (!mbIgnoreGammaChunk && !mbIDATComplete)
 ImplGetGamma();
 }
 break;
@@ -367,14 +367,14 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 
 case PNGCHUNK_tRNS :
 {
-if ( !mbIDAT )  // the tRNS 
chunk must precede the IDAT
+if (!mbIDATComplete)// the tRNS 
chunk must precede the IDAT
 mbStatus = ImplReadTransparent();
 }
 break;
 
 case PNGCHUNK_bKGD :// the 
background chunk must appear
 {
-if ( !mbIDAT && mbPalette ) // before the 'IDAT' and 
after the
+if (!mbIDATComplete && mbPalette)   // before the 
'IDAT' and after the
 ImplGetBackground();// PLTE(if 
available ) chunk.
 }
 break;
@@ -383,14 +383,14 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 {
 if ( !mpInflateInBuf )  // taking care that the header has 
properly been read
 mbStatus = false;
-else if ( !mbIDAT ) // the gfx is finished, but there may 
be left a zlibCRC of about 4Bytes
+else if (!mbIDATComplete) // the gfx is finished, but there 
may be left a zlibCRC of about 4Bytes
 ImplReadIDAT();
 }
 break;
 
 case PNGCHUNK_pHYs :
 {
-if ( !mbIDAT && mnChunkLen == 9 )
+if (!mbIDATComplete && mnChunkLen == 9)
 {
 sal_uInt32 nXPixelPerMeter = ImplReadsal_uInt32();
 sal_uInt32 nYPixelPerMeter = ImplReadsal_uInt32();
@@ -409,7 +409,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 break;
 
 case PNGCHUNK_IEND:
-mbStatus = mbIDAT;  // there is a problem if the image is not 
complete yet
+mbStatus = mbIDATComplete;  // there is a problem if the image 
is not complete yet
 break;
 }
 }
@@ -423,7 +423,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& 
rPreviewSizeHint )
 // return the resulting BitmapEx
 BitmapEx aRet;
 
-if( !mbStatus || !mbIDAT )
+if (!mbStatus || !mbIDATComplete)
 aRet.Clear();
 else
 {
@@ -479,7 +479,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& 
rPreviewSizeHint )
 }
 
 mbPalette = true;
-mbIDAT = mbAlphaChannel = mbTransparent = false;
+mbIDATComplete = mbAlphaChannel = mbTransparent = false;
 mbGrayScale = mbRGBTriple = false;
 mnTargetDepth = mnPngDepth;
 sal_uInt64 nScansize64 = ( ( static_cast< sal_uInt64 >( maOrigSize.Width() 
) * mnPngDepth ) + 7 ) >> 3;
@@ -929,13 +929,13 @@ 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/win

2017-07-17 Thread Stephan Bergmann
 vcl/source/window/window.cxx |2 +-
 vcl/win/app/salinst.cxx  |2 +-
 vcl/win/gdi/salbmp.cxx   |8 ++--
 vcl/win/gdi/salprn.cxx   |2 +-
 vcl/win/window/salframe.cxx  |6 +++---
 5 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit d4bda10ceef4502ce4717368c6a39ecd709cff7f
Author: Stephan Bergmann 
Date:   Mon Jul 17 17:27:02 2017 +0200

loplugin:unnecessaryparen: vcl (clang-cl)

Change-Id: I3d31a5b56007451a9982602b488ae6ac1baf1f50

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6e35ebac9815..9f31fc185e29 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3580,7 +3580,7 @@ Reference< css::rendering::XCanvas > 
Window::ImplGetCanvas( bool bSpriteCanvas )
 // surfaces spanning multiple displays). Note: canvas
 // (without sprite) stays the same)
 const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( 
mpWindowImpl->mpFrame )->mnDisplay;
-if( (nDisplay >= Application::GetScreenCount()) )
+if( nDisplay >= Application::GetScreenCount() )
 {
 xCanvas.set( xCanvasFactory->createInstanceWithArgumentsAndContext(
  bSpriteCanvas ?
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 98b59e771c74..e8f1a1fa99fb 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -42,6 +42,10 @@
 #include 
 #include "postwin.h"
 
+#if defined _MSC_VER
+#undef min
+#undef max
+#endif
 
 inline void ImplSetPixel4( sal_uInt8* pScanline, long nX, const BYTE cIndex )
 {
@@ -762,7 +766,7 @@ HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, 
sal_uInt16 nBits, const
 if( nColors )
 {
 // copy the palette entries if any
-const sal_uInt16 nMinCount = (std::min)( nColors, rPal.GetEntryCount() 
);
+const sal_uInt16 nMinCount = std::min( nColors, rPal.GetEntryCount() );
 if( nMinCount )
 memcpy( pBI->bmiColors, rPal.ImplGetColorBuffer(), nMinCount * 
sizeof(RGBQUAD) );
 }
@@ -944,7 +948,7 @@ void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, 
BitmapAccessMode nMode
 PBITMAPINFO pBI = static_cast(GlobalLock( 
mhDIB ));
 const sal_uInt16nCount = 
pBuffer->maPalette.GetEntryCount();
 const sal_uInt16nDIBColorCount = ImplGetDIBColorCount( 
mhDIB );
-memcpy( pBI->bmiColors, 
pBuffer->maPalette.ImplGetColorBuffer(), (std::min)( nDIBColorCount, nCount ) * 
sizeof( RGBQUAD ) );
+memcpy( pBI->bmiColors, 
pBuffer->maPalette.ImplGetColorBuffer(), std::min( nDIBColorCount, nCount ) * 
sizeof( RGBQUAD ) );
 GlobalUnlock( mhDIB );
 }
 
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 11731ddd657d..44cc665c94b4 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -685,7 +685,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* 
pPrinter, ImplJobSetup* pS
 if( nFlags & JobSetFlags::DUPLEXMODE )
 {
 DuplexMode eDuplex = DuplexMode::Unknown;
-if( (pDevModeW->dmFields & DM_DUPLEX) )
+if( pDevModeW->dmFields & DM_DUPLEX )
 {
 if( pDevModeW->dmDuplex == DMDUP_SIMPLEX )
 eDuplex = DuplexMode::Off;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index b31249db81d2..3c370f50e6b5 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5817,17 +5817,17 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, 
WPARAM wParam, LPARAM lP
 }
 break;
 case WM_IME_REQUEST:
-if ( (sal_uIntPtr)( wParam ) == IMR_RECONVERTSTRING )
+if ( (sal_uIntPtr)wParam == IMR_RECONVERTSTRING )
 {
 nRet = ImplHandleIMEReconvertString( hWnd, lParam );
 rDef = FALSE;
 }
-else if( (sal_uIntPtr)( wParam ) == IMR_CONFIRMRECONVERTSTRING )
+else if( (sal_uIntPtr)wParam == IMR_CONFIRMRECONVERTSTRING )
 {
 nRet = ImplHandleIMEConfirmReconvertString( hWnd, lParam );
 rDef = FALSE;
 }
-else if ( (sal_uIntPtr)( wParam ) == IMR_QUERYCHARPOSITION )
+else if ( (sal_uIntPtr)wParam == IMR_QUERYCHARPOSITION )
 {
 if ( ImplSalYieldMutexTryToAcquire() )
 {
commit 7243c13bdd4cbc528673b658faea6772077fa1f6
Author: Stephan Bergmann 
Date:   Mon Jul 17 17:26:08 2017 +0200

loplugin:implicitboolconversion: vcl (clang-cl)

Change-Id: I81ae357574e5020a5e2dfb7162d451b985c18766

diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 3b29cf820b01..d6a970e7eca8 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -210,7 +210,7 @@ void ImplSalYieldMutexAcquireWithWait( sal_uLong nCount )
 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/workben

2017-04-02 Thread Caolán McNamara
 vcl/source/filter/wmf/winwmf.cxx |   17 -
 vcl/workben/fftester.cxx |2 --
 2 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit e9bd695a063e111cdc002b73a6a5cccbc52ef4d3
Author: Caolán McNamara 
Date:   Sun Apr 2 11:52:06 2017 +0100

ofz: avoid oom

Change-Id: Ibffae78a1186492300c237e85089702491cf4a0f

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 94783f8879d4..0ce2ff3eccac 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -1131,18 +1131,25 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 }
 nEMFRec++;
 
-if( pEMFStream && nCurRecSize + 34 > nLen )
+if (pEMFStream && nCurRecSize + 34 > nLen)
 {
 nEMFRecCount = 0x;
 pEMFStream.reset();
 }
 
-if( pEMFStream )
+if (pEMFStream && nCurRecSize > 
pWMF->remainingSize())
 {
-std::unique_ptr pBuf(new sal_Int8[ 
nCurRecSize ]);
-sal_uInt32 nCount = 
pWMF->ReadBytes(pBuf.get(), nCurRecSize);
+SAL_WARN("vcl.wmf", "emf record size claims to 
be larger than remaining data");
+nEMFRecCount = 0x;
+pEMFStream.reset();
+}
+
+if (pEMFStream)
+{
+std::vector aBuf(nCurRecSize);
+sal_uInt32 nCount = 
pWMF->ReadBytes(aBuf.data(), nCurRecSize);
 if( nCount == nCurRecSize )
-pEMFStream->WriteBytes(pBuf.get(), nCount);
+pEMFStream->WriteBytes(aBuf.data(), 
nCount);
 }
 }
 }
commit 4f2825f590f4d4921d9336961fd727e76b525b92
Author: Caolán McNamara 
Date:   Sun Apr 2 11:49:12 2017 +0100

align fftester and wmffuzzer

Change-Id: Ib0017cfd290b41fc886b5516d2f50ee219185d5a

diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 3b7a1619d45e..63e33e14b735 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -115,8 +115,6 @@ try_again:
 GDIMetaFile aGDIMetaFile;
 SvFileStream aFileStream(out, StreamMode::READ);
 ret = (int) ReadWindowMetafile(aFileStream, aGDIMetaFile);
-BitmapEx aTarget;
-(void)aGDIMetaFile.CreateThumbnail(aTarget);
 }
 else if (strcmp(argv[2], "jpg") == 0)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2017-03-31 Thread Caolán McNamara
 vcl/source/gdi/dibtools.cxx |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit d6eaa8aa5211f1c140d7e9ed27a7fef806b4af3b
Author: Caolán McNamara 
Date:   Fri Mar 31 11:04:16 2017 +0100

ofz: 0 bitcount bmps are unsupported

Change-Id: Ibd7b25546006506350f9fc009596f2989a305a4c

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 37408f408154..4cd7c5419199 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -772,6 +772,10 @@ bool ImplReadDIBBody(SvStream& rIStm, Bitmap& rBmp, 
AlphaMask* pBmpAlpha, sal_uL
 if (!ImplReadDIBInfoHeader(rIStm, aHeader, bTopDown, bMSOFormat) && 
aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount)
 return false;
 
+//BI_BITCOUNT_0 jpeg/png is unsupported
+if (aHeader.nBitCount == 0)
+return false;
+
 // In case ImplReadDIB() didn't call ImplReadDIBFileHeader() before
 // this method, nOffset is 0, that's OK.
 if (nOffset && aHeader.nSize > nOffset)
commit 473066c526ac1d970658b39381436b23d78676ac
Author: Caolán McNamara 
Date:   Fri Mar 31 09:36:05 2017 +0100

expand forcing to mono mask during load to non-indexed sources too

Change-Id: I38c1eec5e180d689de72413b1438c88a1085bbb5

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 576c38871918..37408f408154 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -337,6 +337,14 @@ namespace
 
 return nIndex;
 }
+
+BitmapColor SanitizeColor(const BitmapColor , bool 
bForceToMonoWhileReading)
+{
+if (!bForceToMonoWhileReading)
+return rColor;
+return BitmapColor(static_cast(rColor.GetLuminance() >= 
255));
+}
+
 }
 
 bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header& rHeader, 
BitmapWriteAccess& rAcc, BitmapPalette& rPalette, bool 
bForceToMonoWhileReading, bool bRLE4)
@@ -661,7 +669,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, 
BitmapWriteAccess& r
 for( long nX = 0; nX < nWidth; nX++ )
 {
 aMask.GetColorFor16BitLSB( aColor, 
reinterpret_cast(pTmp16++) );
-rAcc.SetPixel( nY, nX, aColor );
+rAcc.SetPixel(nY, nX, SanitizeColor(aColor, 
bForceToMonoWhileReading));
 }
 }
 }
@@ -685,7 +693,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, 
BitmapWriteAccess& r
 aPixelColor.SetBlue( *pTmp++ );
 aPixelColor.SetGreen( *pTmp++ );
 aPixelColor.SetRed( *pTmp++ );
-rAcc.SetPixel( nY, nX, aPixelColor );
+rAcc.SetPixel(nY, nX, SanitizeColor(aPixelColor, 
bForceToMonoWhileReading));
 }
 }
 }
@@ -723,7 +731,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, 
BitmapWriteAccess& r
 for( long nX = 0; nX < nWidth; nX++ )
 {
 aMask.GetColorAndAlphaFor32Bit( aColor, 
aAlpha, reinterpret_cast(pTmp32++) );
-rAcc.SetPixel( nY, nX, aColor );
+rAcc.SetPixel(nY, nX, SanitizeColor(aColor, 
bForceToMonoWhileReading));
 pAccAlpha->SetPixelIndex(nY, nX, 
sal_uInt8(0xff) - aAlpha);
 rAlphaUsed |= bool(0xff != aAlpha);
 }
@@ -743,7 +751,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, 
BitmapWriteAccess& r
 for( long nX = 0; nX < nWidth; nX++ )
 {
 aMask.GetColorFor32Bit( aColor, 
reinterpret_cast(pTmp32++) );
-rAcc.SetPixel( nY, nX, aColor );
+rAcc.SetPixel(nY, nX, SanitizeColor(aColor, 
bForceToMonoWhileReading));
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2017-03-20 Thread Markus Mohrhard
 vcl/source/uitest/logger.cxx |3 +++
 vcl/source/window/dialog.cxx |4 
 2 files changed, 7 insertions(+)

New commits:
commit b0026125ab60d98cf6705e5d89e2f87575b5d337
Author: Markus Mohrhard 
Date:   Tue Mar 21 00:12:23 2017 +0100

uitest: log when we execute a dialog

Change-Id: Ibf3e739ce096dd7326325eb2010bf89630993dbd
Reviewed-on: https://gerrit.libreoffice.org/35496
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 15a31bc1c40d..2371d88fe73a 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -587,6 +588,7 @@ void Dialog::dispose()
 css::document::DocumentEvent aObject;
 aObject.EventName = "DialogClosed";
 xEventBroadcaster->documentEventOccured(aObject);
+UITestLogger::getInstance().log("DialogClosed");
 
 SystemWindow::dispose();
 }
@@ -701,6 +703,7 @@ void Dialog::StateChanged( StateChangedType nType )
 css::document::DocumentEvent aObject;
 aObject.EventName = "ModelessDialogVisible";
 xEventBroadcaster->documentEventOccured(aObject);
+UITestLogger::getInstance().log("Modeless Dialog Visible");
 }
 }
 
@@ -904,6 +907,7 @@ short Dialog::Execute()
 css::document::DocumentEvent aObject;
 aObject.EventName = "DialogExecute";
 xEventBroadcaster->documentEventOccured(aObject);
+UITestLogger::getInstance().log("DialogExecute");
 // Yield util EndDialog is called or dialog gets destroyed
 // (the latter should not happen, but better safe than sorry
 while ( !xWindow->IsDisposed() && mbInExecute )
commit ce786b9115b5f6d158bfa62d8ccca4ddf38a9630
Author: Markus Mohrhard 
Date:   Tue Mar 21 00:11:33 2017 +0100

uitest: only log actions for elements with the focus

Change-Id: Ic480f0d2c5749f3b32a873fc7695394becbebfcc
Reviewed-on: https://gerrit.libreoffice.org/35495
Tested-by: Jenkins 
Reviewed-by: Markus Mohrhard 

diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 2549b7dd9a44..f56cc349860b 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -50,6 +50,9 @@ void UITestLogger::logAction(VclPtr& xUIElement, 
VclEventId nEvent)
 if (xUIElement->get_id().isEmpty())
 return;
 
+if (!xUIElement->HasFocus())
+return;
+
 std::unique_ptr pUIObject = 
xUIElement->GetUITestFactory()(xUIElement.get());
 OUString aAction = pUIObject->get_action(nEvent);
 if (!aAction.isEmpty())
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/workben

2017-03-18 Thread Caolán McNamara
 vcl/source/filter/jpeg/jpeg.h|2 +-
 vcl/source/filter/jpeg/jpegc.cxx |4 +---
 vcl/workben/commonfuzzer.hxx |1 +
 vcl/workben/fftester.cxx |1 +
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4154b710ae4f4e0ee221042e3905469f3014f50b
Author: Caolán McNamara 
Date:   Sat Mar 18 21:40:44 2017 +

use SAL_NO_FONT_LOOPUP for consistent results

Change-Id: Ibdc0df66325b49fb24c8e59c86beb2875b0e200e

diff --git a/vcl/workben/commonfuzzer.hxx b/vcl/workben/commonfuzzer.hxx
index ee8df4b79e12..a4cb5d33f664 100644
--- a/vcl/workben/commonfuzzer.hxx
+++ b/vcl/workben/commonfuzzer.hxx
@@ -81,6 +81,7 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
 setenv("JPEGMEM", "1024M", 1);
 setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1);
 setenv("SAL_DISABLE_PRINTERLIST", "1", 1);
+setenv("SAL_NO_FONT_LOOPUP", "1", 1);
 
 osl_setCommandArgs(*argc, *argv);
 
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 50e8995b25d1..d5938725872a 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -105,6 +105,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 setenv("JPEGMEM", "1024M", 1);
 setenv("SAL_WMF_COMPLEXCLIP_VIA_REGION", "1", 1);
 setenv("SAL_DISABLE_PRINTERLIST", "1", 1);
+setenv("SAL_NO_FONT_LOOPUP", "1", 1);
 
 try_again:
 
commit cfd749370465ca25ffe8cd776a3bde8aae75260c
Author: Caolán McNamara 
Date:   Sat Mar 18 20:23:59 2017 +

noone cares about the return value

Change-Id: I1f5e0ea481c39b92726812722d3f6f782f3cec9d

diff --git a/vcl/source/filter/jpeg/jpeg.h b/vcl/source/filter/jpeg/jpeg.h
index 19276635aa0d..bb6c73fc5834 100644
--- a/vcl/source/filter/jpeg/jpeg.h
+++ b/vcl/source/filter/jpeg/jpeg.h
@@ -48,7 +48,7 @@ boolWriteJPEG( JPEGWriter* pJPEGWriter, void* 
pOutputStream,
 voidReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
   Size const & previewSize );
 
-longTransform( void* pInputStream, void* pOutputStream, long nAngle );
+voidTransform(void* pInputStream, void* pOutputStream, long nAngle);
 
 /* Expanded data source object for stdio input */
 
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index c47bb126d65e..c49c42fd5c7b 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -371,7 +371,7 @@ bool WriteJPEG( JPEGWriter* pJPEGWriter, void* 
pOutputStream,
 return true;
 }
 
-long Transform(void* pInputStream, void* pOutputStream, long nAngle)
+void Transform(void* pInputStream, void* pOutputStream, long nAngle)
 {
 try
 {
@@ -449,9 +449,7 @@ long Transform(void* pInputStream, void* pOutputStream, 
long nAngle)
 }
 catch (const css::uno::RuntimeException&)
 {
-return 0;
 }
-return 1;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2017-03-10 Thread Caolán McNamara
 vcl/source/filter/jpeg/JpegReader.cxx |4 +---
 vcl/source/filter/jpeg/JpegReader.hxx |1 -
 vcl/source/gdi/svmconverter.cxx   |   16 +++-
 3 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit d4c26cbcd89660be3af8df09ee24a8ba1c1172b4
Author: Caolán McNamara 
Date:   Fri Mar 10 17:31:19 2017 +

ofz: min action has to be >= 4

Change-Id: If03837dff5d7db6907f13c32ce05a74e4a0b7b55

diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index e4a00a1..6149f00 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -333,10 +333,10 @@ void ImplSkipActions(SvStream& rIStm, sal_uLong 
nSkipCount)
 sal_Int16 nType;
 for (sal_uLong i = 0UL; i < nSkipCount; ++i)
 {
-rIStm.ReadInt16( nType ).ReadInt32( nActionSize );
-if (!rIStm.good())
+rIStm.ReadInt16(nType).ReadInt32(nActionSize);
+if (!rIStm.good() || nActionSize < 4)
 break;
-rIStm.SeekRel( nActionSize - 4 );
+rIStm.SeekRel(nActionSize - 4);
 }
 }
 
@@ -1430,12 +1430,18 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& 
rIStm, GDIMetaFile& rMtf )
 {
 nUnicodeCommentActionNumber = i + 1;
 nUnicodeCommentStreamPos = rIStm.Tell() - 6;
-rIStm.SeekRel( nActionSize - 4 );
+if (nActionSize < 4)
+rIStm.SetError(SVSTREAM_FILEFORMAT_ERROR);
+else
+rIStm.SeekRel(nActionSize - 4);
 }
 break;
 
 default:
-rIStm.SeekRel( nActionSize - 4 );
+if (nActionSize < 4)
+rIStm.SetError(SVSTREAM_FILEFORMAT_ERROR);
+else
+rIStm.SeekRel(nActionSize - 4);
 break;
 }
 }
commit c3ee3f104bcca354d80ecc4d8a3dd67b5123e1a5
Author: Caolán McNamara 
Date:   Fri Mar 10 15:59:41 2017 +

mnFormerPos is unused

Change-Id: I147b68882d99b8712625178e5206ea7c0f5f7401

diff --git a/vcl/source/filter/jpeg/JpegReader.cxx 
b/vcl/source/filter/jpeg/JpegReader.cxx
index ad67332..86dda22 100644
--- a/vcl/source/filter/jpeg/JpegReader.cxx
+++ b/vcl/source/filter/jpeg/JpegReader.cxx
@@ -168,7 +168,6 @@ JPEGReader::JPEGReader( SvStream& rStream, void* 
/*pCallData*/, bool bSetLogSize
 mbSetLogSize ( bSetLogSize )
 {
 maUpperName = "SVIJPEG";
-mnFormerPos = mnLastPos;
 }
 
 JPEGReader::~JPEGReader()
@@ -301,11 +300,10 @@ ReadState JPEGReader::Read( Graphic& rGraphic )
 }
 
 // Set status ( Pending has priority )
-if( mrStream.GetError() == ERRCODE_IO_PENDING )
+if (mrStream.GetError() == ERRCODE_IO_PENDING)
 {
 eReadState = JPEGREAD_NEED_MORE;
 mrStream.ResetError();
-mnFormerPos = mrStream.Tell();
 }
 else
 {
diff --git a/vcl/source/filter/jpeg/JpegReader.hxx 
b/vcl/source/filter/jpeg/JpegReader.hxx
index 3362519..3a20ad9 100644
--- a/vcl/source/filter/jpeg/JpegReader.hxx
+++ b/vcl/source/filter/jpeg/JpegReader.hxx
@@ -50,7 +50,6 @@ class JPEGReader : public GraphicReader
 Bitmap  maIncompleteAlpha;
 
 longmnLastPos;
-longmnFormerPos;
 longmnLastLines;
 boolmbSetLogSize;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2017-02-13 Thread Caolán McNamara
 vcl/source/gdi/gdimtf.cxx |   42 --
 1 file changed, 24 insertions(+), 18 deletions(-)

New commits:
commit aec27009c732d19764423ec41c231bb945dbd728
Author: Caolán McNamara 
Date:   Mon Feb 13 10:41:08 2017 +

Resolves: ofz#584 don't terminate on bad fraction exception

Change-Id: Icf6c7a29ad129550fbc533c3af2b77fe7e91ce26

diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index dc48275..320e9a1 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2672,54 +2672,62 @@ SvStream& ReadGDIMetaFile( SvStream& rIStm, 
GDIMetaFile& rGDIMetaFile )
 return rIStm;
 }
 
-charaId[ 7 ];
 sal_uLong  nStmPos = rIStm.Tell();
 SvStreamEndian nOldFormat = rIStm.GetEndian();
 
 rIStm.SetEndian( SvStreamEndian::LITTLE );
 
-aId[ 0 ] = 0;
-aId[ 6 ] = 0;
-rIStm.ReadBytes( aId, 6 );
-
-if ( !strcmp( aId, "VCLMTF" ) )
+try
 {
-// new format
-sal_uInt32 nStmCompressMode = 0;
-sal_uInt32 nCount = 0;
-std::unique_ptr pCompat(new VersionCompat( rIStm, 
StreamMode::READ ));
+char aId[7];
+aId[0] = 0;
+aId[6] = 0;
+rIStm.ReadBytes( aId, 6 );
 
-rIStm.ReadUInt32( nStmCompressMode );
-ReadMapMode( rIStm, rGDIMetaFile.m_aPrefMapMode );
-ReadPair( rIStm, rGDIMetaFile.m_aPrefSize );
-rIStm.ReadUInt32( nCount );
+if ( !strcmp( aId, "VCLMTF" ) )
+{
+// new format
+sal_uInt32 nStmCompressMode = 0;
+sal_uInt32 nCount = 0;
+std::unique_ptr pCompat(new VersionCompat( rIStm, 
StreamMode::READ ));
 
-pCompat.reset(); // destructor writes stuff into the header
+rIStm.ReadUInt32( nStmCompressMode );
+ReadMapMode( rIStm, rGDIMetaFile.m_aPrefMapMode );
+ReadPair( rIStm, rGDIMetaFile.m_aPrefSize );
+rIStm.ReadUInt32( nCount );
 
-ImplMetaReadData aReadData;
-aReadData.meActualCharSet = rIStm.GetStreamCharSet();
+pCompat.reset(); // destructor writes stuff into the header
 
-for( sal_uInt32 nAction = 0UL; ( nAction < nCount ) && !rIStm.IsEof(); 
nAction++ )
-{
-MetaAction* pAction = MetaAction::ReadMetaAction( rIStm, 
 );
-if( pAction )
+ImplMetaReadData aReadData;
+aReadData.meActualCharSet = rIStm.GetStreamCharSet();
+
+for( sal_uInt32 nAction = 0UL; ( nAction < nCount ) && 
!rIStm.IsEof(); nAction++ )
 {
-if (pAction->GetType() == MetaActionType::COMMENT)
+MetaAction* pAction = MetaAction::ReadMetaAction( rIStm, 
 );
+if( pAction )
 {
-MetaCommentAction* pCommentAct = 
static_cast(pAction);
-if ( pCommentAct->GetComment() == "EMF_PLUS" )
-rGDIMetaFile.UseCanvas( true );
+if (pAction->GetType() == MetaActionType::COMMENT)
+{
+MetaCommentAction* pCommentAct = 
static_cast(pAction);
+if ( pCommentAct->GetComment() == "EMF_PLUS" )
+rGDIMetaFile.UseCanvas( true );
+}
+rGDIMetaFile.AddAction( pAction );
 }
-rGDIMetaFile.AddAction( pAction );
 }
 }
+else
+{
+// to avoid possible compiler optimizations => new/delete
+rIStm.Seek( nStmPos );
+delete( new SVMConverter( rIStm, rGDIMetaFile, CONVERT_FROM_SVM1 ) 
);
+}
 }
-else
+catch (...)
 {
-// to avoid possible compiler optimizations => new/delete
-rIStm.Seek( nStmPos );
-delete( new SVMConverter( rIStm, rGDIMetaFile, CONVERT_FROM_SVM1 ) );
-}
+SAL_WARN("vcl", "GDIMetaFile exception during load");
+rIStm.SetError(SVSTREAM_FILEFORMAT_ERROR);
+};
 
 // check for errors
 if( rIStm.GetError() )
commit a9f5140ed087961dbb951da87c040b049bc4e464
Author: Caolán McNamara 
Date:   Mon Feb 13 10:31:00 2017 +

return early on error

no logic change intended

Change-Id: I26558d743f1ab6c3d7b42179fe44f06a786806b6

diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 1604103..dc48275 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2666,71 +2666,69 @@ sal_uLong GDIMetaFile::GetSizeBytes() const
 
 SvStream& ReadGDIMetaFile( SvStream& rIStm, GDIMetaFile& rGDIMetaFile )
 {
-if( !rIStm.GetError() )
+if (rIStm.GetError())
 {
-charaId[ 7 ];
-sal_uLong  nStmPos = rIStm.Tell();
-SvStreamEndian nOldFormat = rIStm.GetEndian();
+SAL_WARN("vcl.gdi", "Stream error: " << 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/workben

2016-12-05 Thread Caolán McNamara
 vcl/source/filter/wmf/winmtf.cxx |3 +++
 vcl/workben/wmftester.cxx|2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 4e6369c51bbf59d29e2686d4e5d3b2e8b4393903
Author: Caolán McNamara 
Date:   Mon Dec 5 12:36:13 2016 +

AvoidConfig fastpath for testing

Change-Id: I50aa865f1b5f0524c2c8af32fa94faea9f6943e9

diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 36aae28..fc4bd6e 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -32,6 +32,7 @@
 #include 
 #include "officecfg/Setup.hxx"
 #include "officecfg/Office/Linguistic.hxx"
+#include "unotools/configmgr.hxx"
 #include "unotools/wincodepage.hxx"
 
 #if OSL_DEBUG_LEVEL > 1
@@ -149,6 +150,8 @@ namespace {
 
 OUString getLODefaultLanguage()
 {
+if (utl::ConfigManager::IsAvoidConfig())
+return "en-US";
 OUString 
result(officecfg::Office::Linguistic::General::DefaultLocale::get());
 if (result.isEmpty())
 result = officecfg::Setup::L10N::ooSetupSystemLocale::get();
commit 48a46f631a9997ac97aa5de5db2c3b5390ee179a
Author: Caolán McNamara 
Date:   Mon Dec 5 12:35:55 2016 +

fix LLVMFuzzerInitialize

Change-Id: I238d210bccbf74913b5f2c0ec2de0ac27d93fef6

diff --git a/vcl/workben/wmftester.cxx b/vcl/workben/wmftester.cxx
index 9514cae..e685465 100644
--- a/vcl/workben/wmftester.cxx
+++ b/vcl/workben/wmftester.cxx
@@ -25,7 +25,7 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace cppu;
 
-int LLVMFuzzerInitialize(int *argc, char ***argv)
+extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
 osl_setCommandArgs(*argc, *argv);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source xmlsecurity/Executable_pdfverify.mk xmlsecurity/source xmlsecurity/workben

2016-11-22 Thread Miklos Vajna
 vcl/source/gdi/pdfwriter_impl.cxx  |   78 
 xmlsecurity/Executable_pdfverify.mk|2 
 xmlsecurity/source/pdfio/pdfverify.cxx |  155 -
 xmlsecurity/workben/pdfverify.cxx  |  155 +
 4 files changed, 234 insertions(+), 156 deletions(-)

New commits:
commit 6971159bb4468110d79c8367fcd776138302c1b9
Author: Miklos Vajna 
Date:   Tue Nov 22 11:16:24 2016 +0100

Executable_pdfverify: move pdfverify.cxx to workben/

That's where the implementation of such internal test binaries usually
are.

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

diff --git a/xmlsecurity/Executable_pdfverify.mk 
b/xmlsecurity/Executable_pdfverify.mk
index 5cfbcd2..446c68f 100644
--- a/xmlsecurity/Executable_pdfverify.mk
+++ b/xmlsecurity/Executable_pdfverify.mk
@@ -26,7 +26,7 @@ $(eval $(call gb_Executable_use_libraries,pdfverify,\
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,pdfverify,\
-xmlsecurity/source/pdfio/pdfverify \
+xmlsecurity/workben/pdfverify \
 ))
 
 # vim:set noet sw=4 ts=4:
diff --git a/xmlsecurity/source/pdfio/pdfverify.cxx 
b/xmlsecurity/workben/pdfverify.cxx
similarity index 100%
rename from xmlsecurity/source/pdfio/pdfverify.cxx
rename to xmlsecurity/workben/pdfverify.cxx
commit 7c18387dd46391f033af504792b33b6ff4a4e9ad
Author: Miklos Vajna 
Date:   Tue Nov 22 10:26:50 2016 +0100

vcl NSS PDF sign: write IssuerSerial sequence

Nominally this is optional, but RFC 5035 says:

"The encoding of the ESSCertIDv2 for this certificate SHOULD include the
issuerSerial field."

So do write it, it fixes a warning issued by the PAdES validator from
.

Change-Id: I344f79e17febe82a697a0936a837c17aefa242df

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 47be24f..4b20942 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6037,6 +6037,31 @@ typedef struct {
 } TimeStampReq;
 
 /**
+ * General name, defined by RFC 3280.
+ */
+struct GeneralName
+{
+CERTName name;
+};
+
+/**
+ * List of general names (only one for now), defined by RFC 3280.
+ */
+struct GeneralNames
+{
+GeneralName names;
+};
+
+/**
+ * Supplies different fields to identify a certificate, defined by RFC 5035.
+ */
+struct IssuerSerial
+{
+GeneralNames issuer;
+SECItem serialNumber;
+};
+
+/**
  * Supplies different fields that are used to identify certificates, defined by
  * RFC 5035.
  */
@@ -6044,6 +6069,7 @@ struct ESSCertIDv2
 {
 SECAlgorithmID hashAlgorithm;
 SECItem certHash;
+IssuerSerial issuerSerial;
 };
 
 /**
@@ -6275,6 +6301,50 @@ const SEC_ASN1Template TimeStampReq_Template[] =
 };
 
 /**
+ * GeneralName ::= CHOICE {
+ *  otherName   [0] OtherName,
+ *  rfc822Name  [1] IA5String,
+ *  dNSName [2] IA5String,
+ *  x400Address [3] ORAddress,
+ *  directoryName   [4] Name,
+ *  ediPartyName[5] EDIPartyName,
+ *  uniformResourceIdentifier   [6] IA5String,
+ *  iPAddress   [7] OCTET STRING,
+ *  registeredID[8] OBJECT IDENTIFIER
+ * }
+ */
+const SEC_ASN1Template GeneralNameTemplate[] =
+{
+{SEC_ASN1_SEQUENCE, 0, nullptr, sizeof(GeneralName)},
+{SEC_ASN1_INLINE, offsetof(GeneralName, name), CERT_NameTemplate, 0},
+{0, 0, nullptr, 0}
+};
+
+/**
+ * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
+ */
+const SEC_ASN1Template GeneralNamesTemplate[] =
+{
+{SEC_ASN1_SEQUENCE, 0, nullptr, sizeof(GeneralNames)},
+{SEC_ASN1_INLINE | SEC_ASN1_CONTEXT_SPECIFIC | 4, offsetof(GeneralNames, 
names), GeneralNameTemplate, 0},
+{0, 0, nullptr, 0}
+};
+
+/**
+ * IssuerSerial ::= SEQUENCE {
+ * issuer GeneralNames,
+ * serialNumber CertificateSerialNumber
+ * }
+ */
+const SEC_ASN1Template IssuerSerialTemplate[] =
+{
+{SEC_ASN1_SEQUENCE, 0, nullptr, sizeof(IssuerSerial)},
+{SEC_ASN1_INLINE, offsetof(IssuerSerial, issuer), GeneralNamesTemplate, 0},
+{SEC_ASN1_INTEGER, offsetof(IssuerSerial, serialNumber), nullptr, 0},
+{0, 0, nullptr, 0}
+};
+
+/**
  * Hash ::= OCTET STRING
  *
  * ESSCertIDv2 ::= SEQUENCE {
@@ -6288,6 +6358,7 @@ const SEC_ASN1Template ESSCertIDv2Template[] =
 {SEC_ASN1_SEQUENCE, 0, nullptr, sizeof(ESSCertIDv2)},
 {SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(ESSCertIDv2, hashAlgorithm), 
SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate), 0},
 {SEC_ASN1_OCTET_STRING, offsetof(ESSCertIDv2, certHash), nullptr, 0},
+{SEC_ASN1_INLINE | SEC_ASN1_XTRN, 

[Libreoffice-commits] core.git: 2 commits - vcl/source xmlsecurity/source

2016-11-17 Thread Caolán McNamara
 vcl/source/fontsubset/sft.cxx  |   29 +
 xmlsecurity/source/helper/documentsignaturemanager.cxx |5 ++
 2 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit 447a65db6b7ea2ed580f2fdd364ac6084cc282be
Author: Caolán McNamara 
Date:   Thu Nov 17 13:26:36 2016 +

coverity#1394292 Unchecked return value

Change-Id: I90db6e3c69a6dc90ce1df0dbb5b9d7a81cd1bbea

diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx 
b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index f10c277..f9b4355 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -63,8 +63,11 @@ bool DocumentSignatureManager::init()
 
 PDFSignatureHelper& DocumentSignatureManager::getPDFSignatureHelper()
 {
+bool bInit = true;
 if (!mxSecurityContext.is())
-init();
+bInit = init();
+
+SAL_WARN_IF(!bInit, "xmlsecurity.comp", "Error initializing security 
context!");
 
 if (!mpPDFSignatureHelper)
 mpPDFSignatureHelper.reset(new PDFSignatureHelper(mxContext));
commit dc6d4772e03d78baa6ee85b69b582598fb5f240a
Author: Caolán McNamara 
Date:   Thu Nov 17 13:23:10 2016 +

coverity#1394372 Division or modulo by zero

Change-Id: I1d8d134bf423778a76f7dc6fc5a5e4f8c30c6c3d

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index d82c082..8e9ccb9 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -614,18 +614,23 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, 
sal_uInt32 glyphID, ControlPo
 if (abs3 < 0) abs3 = -abs3;
 if (abs3 <= 33) n *= 2;
 
-for (i=0; i> 16);
-t = fixedMulDiv(b, x << 16, n) + fixedMulDiv(d, y << 16, n) + (f 
<< 16);
-cp.y = (sal_Int16)(fixedMul(t, n) >> 16);
-
-myPoints.push_back( cp );
+SAL_WARN_IF(np && !m, "vcl.fonts", "Parsing error in " << 
OUString::createFromAscii(ttf->fname) <<
+ ": " << "divide by zero");
+
+if (m != 0) {
+for (i=0; i> 16);
+t = fixedMulDiv(b, x << 16, n) + fixedMulDiv(d, y << 16, n) + 
(f << 16);
+cp.y = (sal_Int16)(fixedMul(t, n) >> 16);
+
+myPoints.push_back( cp );
+}
 }
 
 free(nextComponent);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

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

New commits:
commit 66c1ae50e43f9a738f089356e8225022f776f90b
Author: Khaled Hosny 
Date:   Thu Oct 20 23:22:56 2016 +0200

Typo in commented-out code

Change-Id: I9f276a6de54dd3542249b47986d2ca6b3f27413d

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index f4fc63f..cd2e91b 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -379,7 +379,7 @@ static int GetVerticalFlagsForScript(UScriptCode aScript)
 nFlag = ??;
 break;
 /* btt -90° */
-case USCRIPT_MONGOLIAN:
+case USCRIPT_OGHAM:
 nFlag = ??;
 break;
 #endif
commit 95c787160448d37e82efe8b7ee2f63bc4eea8541
Author: Khaled Hosny 
Date:   Thu Oct 20 23:04:02 2016 +0200

Vertical Mongolian and Phags-pa seem to work fine

The fonts are designed so that they are rotating 90° is all needed, so
we don’t to rotate them back, unlike CJK.

Change-Id: I0afa4b066257718a5a52eb2e93a18ce839aec2f0

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index cdb9b19..f4fc63f 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -374,11 +374,6 @@ static int GetVerticalFlagsForScript(UScriptCode aScript)
 nFlag = GF_ROTL;
 break;
 #if 0
-/* ttb 90° */
-case USCRIPT_MONGOLIAN:
-case USCRIPT_PHAGS_PA:
-nFlag = ??;
-break;
 /* ttb -90° */
 case USCRIPT_ORKHON:
 nFlag = ??;
@@ -388,6 +383,10 @@ static int GetVerticalFlagsForScript(UScriptCode aScript)
 nFlag = ??;
 break;
 #endif
+/* ttb 90°, no extra rotation needed */
+case USCRIPT_MONGOLIAN:
+case USCRIPT_PHAGS_PA:
+/* horizontal scripts */
 default:
 break;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-10-20 Thread Khaled Hosny
 vcl/source/gdi/CommonSalLayout.cxx |   33 -
 1 file changed, 24 insertions(+), 9 deletions(-)

New commits:
commit d5424208a5b63a9d5ac658279c3f9824aa38a2d6
Author: Khaled Hosny 
Date:   Thu Oct 20 16:37:22 2016 +0200

Reuse the HarfBuzz buffer as much as possible

Less allocations in case we have many sub runs.

Change-Id: I50d4a57702c030c185fc7edef576c64d739a6194

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index b8f18c4..cdb9b19 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -418,6 +418,13 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 pTextLayout = pNewScriptRun.get();
 }
 
+hb_buffer_t* pHbBuffer = hb_buffer_create();
+hb_buffer_pre_allocate(pHbBuffer, nGlyphCapacity);
+#if !HB_VERSION_ATLEAST(1, 1, 0)
+static hb_unicode_funcs_t* pHbUnicodeFuncs = getUnicodeFuncs();
+hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs);
+#endif
+
 Point aCurrPos(0, 0);
 while (true)
 {
@@ -457,6 +464,8 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 for (const auto& aScriptRun : aScriptSubRuns)
 {
+hb_buffer_clear_contents(pHbBuffer);
+
 int nMinRunPos = aScriptRun.mnMin;
 int nEndRunPos = aScriptRun.mnEnd;
 int nRunLen = nEndRunPos - nMinRunPos;
@@ -479,11 +488,6 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 if (nEndRunPos == nLength)
 nHbFlags |= HB_BUFFER_FLAG_EOT; /* End-of-text */
 
-hb_buffer_t *pHbBuffer = hb_buffer_create();
-#if !HB_VERSION_ATLEAST(1, 1, 0)
-static hb_unicode_funcs_t* pHbUnicodeFuncs = getUnicodeFuncs();
-hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs);
-#endif
 if (bVertical)
 hb_buffer_set_direction(pHbBuffer, HB_DIRECTION_TTB);
 else
@@ -592,11 +596,11 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 
 aCurrPos.X() += nAdvance;
 }
-
-hb_buffer_destroy(pHbBuffer);
 }
 }
 
+hb_buffer_destroy(pHbBuffer);
+
 // sort glyphs in visual order
 // and then in logical order (e.g. diacritics after cluster start)
 // XXX: why?
commit 7854d35cd8172b201f1f3ad247860f242e5cb06b
Author: Khaled Hosny 
Date:   Thu Oct 6 04:15:41 2016 +0200

Use HarfBuzz shape plan for a bit more control

This way we control exactly what shapers we use in what order, and as an
extra we can now tell which shaper HarfBuzz ends up using.

Change-Id: Idd303b2a557e16ac86ada0c2006d3e2a052ac489

diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 527d827..b8f18c4 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -397,6 +397,7 @@ static int GetVerticalFlagsForScript(UScriptCode aScript)
 
 bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 {
+hb_face_t* pHbFace = hb_font_get_face(mpHbFont);
 hb_script_t aHbScript = HB_SCRIPT_INVALID;
 
 int nGlyphCapacity = 2 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos);
@@ -496,7 +497,18 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 #if HB_VERSION_ATLEAST(0, 9, 42)
 hb_buffer_set_cluster_level(pHbBuffer, 
HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
 #endif
-hb_shape(mpHbFont, pHbBuffer, maFeatures.data(), 
maFeatures.size());
+// The shapers that we want HarfBuzz to use, in the order of
+// 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 };
+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);
+bool ok = hb_shape_plan_execute(pHbPlan, mpHbFont, pHbBuffer, 
maFeatures.data(), maFeatures.size());
+assert(ok);
+(void) ok;
+SAL_INFO("vcl.harfbuzz", hb_shape_plan_get_shaper(pHbPlan) << " 
shaper used for " << mrFontSelData.GetFamilyName());
 
 int nRunGlyphCount = hb_buffer_get_length(pHbBuffer);
 hb_glyph_info_t *pHbGlyphInfos = 
hb_buffer_get_glyph_infos(pHbBuffer, nullptr);
@@ -529,7 +541,6 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
 nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
 
 bool bDiacritic = false;
-hb_face_t* pHbFace = hb_font_get_face(mpHbFont);
 if (hb_ot_layout_has_glyph_classes(pHbFace))
 {
 // the 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2016-10-11 Thread Khaled Hosny
 vcl/source/gdi/sallayout.cxx|4 
 vcl/unx/generic/glyphs/gcach_layout.cxx |   30 +++---
 2 files changed, 11 insertions(+), 23 deletions(-)

New commits:
commit f48cbaac0a2a7278f366a3b0118b399c0a938a44
Author: Khaled Hosny 
Date:   Tue Oct 11 14:53:06 2016 +0200

tdf#103103: Many Arabic fonts dont render correctly

Revert the remaining bits of 1da9b4c24e806ad2447b4a656e2a7192755bb6a8,
the rest was reverted in 6323e6628668849438e6e19ba7ad2c6598263261.

This break many assumptions made by GenericSalLayout::ApplyDXArray().

Change-Id: I25fbafe06032ab1e8860df6c5932a7157575aa32

diff --git a/vcl/unx/generic/glyphs/gcach_layout.cxx 
b/vcl/unx/generic/glyphs/gcach_layout.cxx
index 38d7e84..46420cb 100644
--- a/vcl/unx/generic/glyphs/gcach_layout.cxx
+++ b/vcl/unx/generic/glyphs/gcach_layout.cxx
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -309,16 +308,14 @@ static unsigned int 
unicodeDecomposeCompatibility(hb_unicode_funcs_t* /*ufuncs*/
 {
 return 0;
 }
-#endif
 
 static hb_unicode_funcs_t* getUnicodeFuncs()
 {
 static hb_unicode_funcs_t* ufuncs = 
hb_unicode_funcs_create(hb_icu_get_unicode_funcs());
-#if !HB_VERSION_ATLEAST(1, 1, 0)
 hb_unicode_funcs_set_decompose_compatibility_func(ufuncs, 
unicodeDecomposeCompatibility, nullptr, nullptr);
-#endif
 return ufuncs;
 }
+#endif
 
 class HbLayoutEngine : public ServerFontLayoutEngine
 {
@@ -492,8 +489,8 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, 
ImplLayoutArgs& rArgs)
 nHbFlags |= HB_BUFFER_FLAG_EOT; /* End-of-text */
 
 hb_buffer_t *pHbBuffer = hb_buffer_create();
-static hb_unicode_funcs_t* pHbUnicodeFuncs = getUnicodeFuncs();
 #if !HB_VERSION_ATLEAST(1, 1, 0)
+static hb_unicode_funcs_t* pHbUnicodeFuncs = getUnicodeFuncs();
 hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs);
 #endif
 hb_buffer_set_direction(pHbBuffer, bRightToLeft ? 
HB_DIRECTION_RTL: HB_DIRECTION_LTR);
@@ -503,9 +500,6 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, 
ImplLayoutArgs& rArgs)
 hb_buffer_add_utf16(
 pHbBuffer, reinterpret_cast(pStr), nLength,
 nMinRunPos, nRunLen);
-#if HB_VERSION_ATLEAST(0, 9, 42)
-hb_buffer_set_cluster_level(pHbBuffer, 
HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
-#endif
 hb_shape(pHbFont, pHbBuffer, nullptr, 0);
 
 int nRunGlyphCount = hb_buffer_get_length(pHbBuffer);
@@ -554,12 +548,15 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, 
ImplLayoutArgs& rArgs)
 //   but usually harmless), so we try to sniff what HarfBuzz 
thinks
 //   about this glyph by checking if it gives it a zero advance
 //   width.
-// * If the font has no GDEF table, we then check the unicode 
class
-//   of the glyph. If it is a non spacing mark then the glyph 
is a
-//   diacritic. This is only done if the HarfBuzz version is 
>= 0.9.42
-//   Else, we fallback to setting bDiacritic to true if the x 
advance
-//   of the glyph is zero. This maybe wrong in some cases but 
needs to
-//   be kept until the base version of HarfBuzz can be updated.
+// * If the font has no GDEF table, we just check if the glyph 
has
+//   zero advance width, but this is stupid and can be wrong. A
+//   better way would to check the character's Unicode 
combining
+//   class, but unfortunately HarfBuzz gives combining marks 
the
+//   cluster value of its base character, so nCharPos will be
+//   pointing to the wrong character (but HarfBuzz might change
+//   this in the future).
+//   Newer versions of HarfBuzz can control this behaviour with
+//   hb_buffer_set_cluster_level().
 bool bDiacritic = false;
 if (hb_ot_layout_has_glyph_classes(mpHbFace))
 {
@@ -570,14 +567,9 @@ bool HbLayoutEngine::Layout(ServerFontLayout& rLayout, 
ImplLayoutArgs& rArgs)
 }
 else
 {
-#if HB_VERSION_ATLEAST(0, 9, 42)
-if(hb_unicode_general_category (pHbUnicodeFuncs, aChar) == 
HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
-bDiacritic = true;
-#else
 // the font lacks GDEF table
 if (pHbPositions[i].x_advance == 0)
 bDiacritic = true;
-#endif
 }
 
 if (bDiacritic)
commit faddf2aefd5874b2bbd6c3b7bbed0812de911f47
Author: Khaled Hosny 
Date:   Tue Oct 11 15:11:58 2016 +0200

Revert "Hack to make Arabic subtending marks work"

This reverts 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-10-03 Thread Caolán McNamara
 vcl/source/window/syswin.cxx |   65 +--
 1 file changed, 33 insertions(+), 32 deletions(-)

New commits:
commit 348dcf1edb1a45027b52ba1e6f15bbf4d484a2c5
Author: Caolán McNamara 
Date:   Mon Oct 3 12:49:30 2016 +0100

Resolves: tdf#99324 accel underlines don't appear in extension option pages

because they are not widget-layout tab pages, we have to dive down
through the WB_DIALOGCONTROL widgets as well

Change-Id: I13dbf88878efd89794158ce43137381008e18890

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index cb45ea4..7526fa9 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -128,46 +128,47 @@ void ImplHandleControlAccelerator( vcl::Window* pWindow, 
bool bShow )
 }
 }
 
-bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, 
vcl::Window *pWindow)
+namespace
 {
-if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+void processChildren(vcl::Window *pParent, bool bShowAccel)
 {
-const CommandModKeyData *pCData = rCEvent.GetModKeyData();
-const bool bShowAccel =  pCData && pCData->IsMod2();
-
-vcl::Window *pGetChild = firstLogicalChildOfParent(pWindow);
-while (pGetChild)
+// go through its children
+vcl::Window* pChild = firstLogicalChildOfParent(pParent);
+while (pChild)
 {
-if (pGetChild->GetType() == WINDOW_TABCONTROL)
+if (pChild->GetType() == WINDOW_TABCONTROL)
 {
 // find currently shown tab page
-TabControl* pTabControl = static_cast( pGetChild 
);
+TabControl* pTabControl = static_cast(pChild);
 TabPage* pTabPage = pTabControl->GetTabPage( 
pTabControl->GetCurPageId() );
-vcl::Window* pTabPageChild = firstLogicalChildOfParent( 
pTabPage );
-
-// and go through its children
-while ( pTabPageChild )
-{
-ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
-pTabPageChild = nextLogicalChildOfParent(pTabPage, 
pTabPageChild);
-}
+processChildren(pTabPage, bShowAccel);
 }
-else if (pGetChild->GetType() == WINDOW_TABPAGE)
+else if (pChild->GetType() == WINDOW_TABPAGE)
 {
 // bare tabpage without tabcontrol parent (options dialog)
-vcl::Window* pTabPageChild = firstLogicalChildOfParent( 
pGetChild );
-
-// and go through its children
-while ( pTabPageChild )
-{
-ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
-pTabPageChild = nextLogicalChildOfParent(pGetChild, 
pTabPageChild);
-}
+processChildren(pChild, bShowAccel);
 }
-
-ImplHandleControlAccelerator( pGetChild, bShowAccel );
-pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
+else if ((pChild->GetStyle() & (WB_DIALOGCONTROL | 
WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL)
+{
+// special controls that manage their children outside of 
widget layout
+processChildren(pChild, bShowAccel);
+}
+else
+{
+ImplHandleControlAccelerator(pChild, bShowAccel);
+}
+pChild = nextLogicalChildOfParent(pParent, pChild);
 }
+}
+}
+
+bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, 
vcl::Window *pWindow)
+{
+if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+{
+const CommandModKeyData *pCData = rCEvent.GetModKeyData();
+const bool bShowAccel = pCData && pCData->IsMod2();
+processChildren(pWindow, bShowAccel);
 return true;
 }
 return false;
commit 1bceb4e6aeaea138fac5ea9b3dfb8710babb3d43
Author: Caolán McNamara 
Date:   Mon Oct 3 10:55:04 2016 +0100

fix indent

Change-Id: Ia1bc9fe3c2c3833e36ec6fb9636856049acf03ec

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index c4d5017..cb45ea4 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -138,31 +138,31 @@ bool Accelerator::ToggleMnemonicsOnHierarchy(const 
CommandEvent& rCEvent, vcl::W
 vcl::Window *pGetChild = firstLogicalChildOfParent(pWindow);
 while (pGetChild)
 {
-if ( pGetChild->GetType() == WINDOW_TABCONTROL )
+if (pGetChild->GetType() == WINDOW_TABCONTROL)
 {
- // find currently shown tab page
- TabControl* pTabControl = static_cast( pGetChild 
);
- TabPage* pTabPage = pTabControl->GetTabPage( 
pTabControl->GetCurPageId() );
- 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-09-27 Thread Caolán McNamara
 vcl/source/window/menu.cxx   |   25 +--
 vcl/source/window/menufloatingwindow.cxx |   49 ++-
 vcl/source/window/menufloatingwindow.hxx |4 +-
 3 files changed, 42 insertions(+), 36 deletions(-)

New commits:
commit 1aaba02fafe0b9131c2cdeba3fb4ad9924da81be
Author: Caolán McNamara 
Date:   Tue Sep 27 16:09:57 2016 +0100

this should always be empty now

Change-Id: I5849ce78407675150ca1fd96388a4569bcd14f4a

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 183d331..4fca315 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -3096,15 +3096,9 @@ sal_uInt16 PopupMenu::ImplExecute( const 
VclPtr& pW, const Rectangl
 if (pWin->IsDisposed())
 return 0;
 
-// Restore focus (could already have been
-// restored in Select)
 xFocusId = pWin->GetFocusId();
-if ( xFocusId != nullptr )
-{
-pWin->SetFocusId( nullptr );
-pSVData->maWinData.mbNoDeactivate = false;
-}
-pWin->ImplEndPopupMode( FloatWinPopupEndFlags::NONE, xFocusId );
+assert(xFocusId == nullptr && "Focus should already be restored by 
MenuFloatingWindow::End");
+pWin->ImplEndPopupMode(FloatWinPopupEndFlags::NONE, xFocusId);
 
 if ( nSelectedId )  // then clean up .. ( otherwise done by TH )
 {
commit 4da7971812b0a53ba80f7d9c29851c527488067d
Author: Caolán McNamara 
Date:   Tue Sep 27 15:33:54 2016 +0100

Resolves: tdf#102177 focus not restored from context menus

the problem being that the attempt to restore the focus in the document in 
the
floatingwindow tear down is blocked because the menus have set that window 
as
modal so the focus isn't set.

The attempt to set the focus in the floatingwindow teardown causes the
SavedFocus in the menufloatingwindow to be dropped, so the extra layer of 
code
to restore focus after modality is removed doesn't do anything

this is fallout from...

commit dd46727b99d4bb5135451aa7e5e1bdb197373843
Author: Caolán McNamara 
Date:   Tue Apr 5 15:27:38 2016 +0100

Resolves: tdf#87120 no keyboard navigation inside floating windows

which allows the focus to "truly" enter the menus, triggering the
floatingwindow attempt, which fails but blocks the menufloatingwindow 
attempt

easiest thing seems to make the restoring modality, and then restore focus,
something that MenuFloatingWindow does before it finishes

Change-Id: I97a4ac71419dcb04709e4667586d8343e89ddbeb

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index a93811d..183d331 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -3043,12 +3043,6 @@ sal_uInt16 PopupMenu::ImplExecute( const 
VclPtr& pW, const Rectangl
 
 pWin->SetFocusId( xFocusId );
 pWin->SetOutputSizePixel( aSz );
-// #102158# menus must never grab the focus, otherwise
-// they will be closed immediately
-// from now on focus grabbing is only prohibited automatically if
-// FloatWinPopupFlags::GrabFocus was set (which is done below), because 
some
-// floaters (like floating toolboxes) may grab the focus
-// pWin->GrabFocus();
 if ( GetItemCount() )
 {
 SalMenu* pMenu = ImplGetSalMenu();
@@ -3098,15 +3092,8 @@ sal_uInt16 PopupMenu::ImplExecute( const 
VclPtr& pW, const Rectangl
 }
 if ( bRealExecute )
 {
-pW->ImplIncModalCount();
-
 pWin->Execute();
-
-SAL_WARN_IF(  pW->IsDisposed(), "vcl", "window for popup died, modal 
count incorrect !" );
-if( ! pW->IsDisposed() )
-pW->ImplDecModalCount();
-
-if ( pWin->IsDisposed() )
+if (pWin->IsDisposed())
 return 0;
 
 // Restore focus (could already have been
diff --git a/vcl/source/window/menufloatingwindow.cxx 
b/vcl/source/window/menufloatingwindow.cxx
index f4adcf0..aeb97dc 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -272,13 +272,13 @@ IMPL_LINK_NOARG_TYPED(MenuFloatingWindow, PopupEnd, 
FloatingWindow*, void)
 Menu* pM = pMenu;
 if ( bInExecute )
 {
+End();
 if ( pActivePopup )
 {
 //SAL_WARN_IF( pActivePopup->ImplGetWindow(), "vcl", "PopupEnd, 
obwohl pActivePopup MIT Window!" );
 KillActivePopup(); // should be ok to just remove it
 //pActivePopup->bCanceled = true;
 }
-bInExecute = false;
 pMenu->bInCallback = true;
 pMenu->Deactivate();
 pMenu->bInCallback = false;
@@ -388,15 +388,44 @@ void MenuFloatingWindow::EnableScrollMenu( bool b )
 InitMenuClipRegion(*this);
 }
 
+void MenuFloatingWindow::Start()
+{
+if (bInExecute)
+return;
+bInExecute = true;
+if (GetParent())
+

[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-08-04 Thread Caolán McNamara
 vcl/source/control/edit.cxx|   30 --
 vcl/source/control/listbox.cxx |8 
 2 files changed, 20 insertions(+), 18 deletions(-)

New commits:
commit 628a21e7e4dad565f676252fdd50cd7423e12f6f
Author: Caolán McNamara 
Date:   Thu Aug 4 15:46:48 2016 +0100

like listbox put margins on both sides of an edit too

Change-Id: I425b1005297b20ace85181edce72ab5829006a0e

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 8e41d0e..d4d9936 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1819,15 +1819,12 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, 
const Size& rSize, DrawF
 if ( GetStyle() & WB_CENTER )
 nTextStyle |= DrawTextFlags::Center;
 else if ( GetStyle() & WB_RIGHT )
-{
 nTextStyle |= DrawTextFlags::Right;
-aTextRect.Left() += nOffX;
-}
 else
-{
 nTextStyle |= DrawTextFlags::Left;
-aTextRect.Right() -= nOffX;
-}
+
+aTextRect.Left() += nOffX;
+aTextRect.Right() -= nOffX;
 
 OUStringaText = ImplGetText();
 longnTextHeight = pDev->GetTextHeight();
commit cc62d87d5f1abcff2affd56f1077114289c68c7e
Author: Caolán McNamara 
Date:   Thu Aug 4 15:43:37 2016 +0100

use same scheme in Edit and ListBox for rendering text in ::Draw

Change-Id: I5b17103e838f221cf3815002979c6b8c9c443300

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index b6a4989..8e41d0e 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1811,11 +1811,27 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, 
const Size& rSize, DrawF
 }
 }
 
+const long nOnePixel = GetDrawPixel( pDev, 1 );
+const long nOffX = 3*nOnePixel;
+DrawTextFlags nTextStyle = DrawTextFlags::VCenter;
+Rectangle aTextRect( aPos, aSize );
+
+if ( GetStyle() & WB_CENTER )
+nTextStyle |= DrawTextFlags::Center;
+else if ( GetStyle() & WB_RIGHT )
+{
+nTextStyle |= DrawTextFlags::Right;
+aTextRect.Left() += nOffX;
+}
+else
+{
+nTextStyle |= DrawTextFlags::Left;
+aTextRect.Right() -= nOffX;
+}
+
 OUStringaText = ImplGetText();
 longnTextHeight = pDev->GetTextHeight();
 longnTextWidth = pDev->GetTextWidth( aText );
-longnOnePixel = GetDrawPixel( pDev, 1 );
-longnOffX = 3*nOnePixel;
 longnOffY = (aSize.Height() - nTextHeight) / 2;
 
 // Clipping?
@@ -1829,18 +1845,7 @@ void Edit::Draw( OutputDevice* pDev, const Point& rPos, 
const Size& rSize, DrawF
 pDev->IntersectClipRegion( aClip );
 }
 
-if ( GetStyle() & WB_CENTER )
-{
-aPos.X() += (aSize.Width() - nTextWidth) / 2;
-nOffX = 0;
-}
-else if ( GetStyle() & WB_RIGHT )
-{
-aPos.X() += aSize.Width() - nTextWidth;
-nOffX = -nOffX;
-}
-
-pDev->DrawText( Point( aPos.X() + nOffX, aPos.Y() + nOffY ), aText );
+pDev->DrawText( aTextRect, aText, nTextStyle );
 pDev->Pop();
 
 if ( GetSubEdit() )
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index 5b35044..b95c1dc 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -412,7 +412,8 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, 
const Size& rSize, Dr
 }
 }
 
-long nOnePixel = GetDrawPixel( pDev, 1 );
+const long nOnePixel = GetDrawPixel( pDev, 1 );
+const long nOffX = 3*nOnePixel;
 DrawTextFlags nTextStyle = DrawTextFlags::VCenter;
 Rectangle aTextRect( aPos, aSize );
 
@@ -423,15 +424,14 @@ void ListBox::Draw( OutputDevice* pDev, const Point& 
rPos, const Size& rSize, Dr
 else
 nTextStyle |= DrawTextFlags::Left;
 
-aTextRect.Left() += 3*nOnePixel;
-aTextRect.Right() -= 3*nOnePixel;
+aTextRect.Left() += nOffX;
+aTextRect.Right() -= nOffX;
 
 if ( IsDropDownBox() )
 {
 OUString   aText = GetSelectEntry();
 long   nTextHeight = pDev->GetTextHeight();
 long   nTextWidth = pDev->GetTextWidth( aText );
-long   nOffX = 3*nOnePixel;
 long   nOffY = (aSize.Height()-nTextHeight) / 2;
 
 // Clipping?
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2016-07-21 Thread Caolán McNamara
 vcl/source/control/field2.cxx   |2 +-
 vcl/unx/gtk/a11y/atkfactory.cxx |6 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 82913e694a4169f9ddeef399e659aec78cc9c8d6
Author: Caolán McNamara 
Date:   Thu Jul 21 12:18:36 2016 +0100

Resolves: tdf#100558 last 'section' of date field not incremented

presumably a regression from...

commit 3cad6c806e5247ce20b78eb688551aa5d872b934
Author: Chr. Rossmanith 
Date:   Fri Mar 1 21:47:10 2013 +0100

Replace (Xub)String with OUString in vcl(field)

where UniString::Search returned a max short on not-found
while OUString::indexOf returns a -1

Change-Id: Ia3ef80dd318375ccdb3bdcee9bed7b70bf67cae1

diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 27b6b41..6076074 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -1351,7 +1351,7 @@ void DateField::ImplDateSpinArea( bool bUp )
 for ( sal_Int8 i = 1; i <= 3; i++ )
 {
 nPos = aText.indexOf( aDateSep, nPos );
-if ( nPos >= (sal_Int32)aSelection.Max() )
+if (nPos < 0 || nPos >= (sal_Int32)aSelection.Max())
 {
 nDateArea = i;
 break;
commit 27328034f5e2644b4a0287532e762e87ea36c4a0
Author: Caolán McNamara 
Date:   Thu Jul 21 11:55:13 2016 +0100

gtk3-a11y: our eventbox is inside a grid now

Change-Id: Icb49d6274b09fb426ab6c0f9f67b7c71c4ef9a31

diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx
index bca68a6..2f51f14 100644
--- a/vcl/unx/gtk/a11y/atkfactory.cxx
+++ b/vcl/unx/gtk/a11y/atkfactory.cxx
@@ -109,7 +109,11 @@ wrapper_factory_create_accessible( GObject *obj )
 if (!pEventBox)
 return atk_noop_object_wrapper_new();
 
-GtkWidget* pTopLevel = gtk_widget_get_parent(pEventBox);
+GtkWidget* pTopLevelGrid = gtk_widget_get_parent(pEventBox);
+if (!pTopLevelGrid)
+return atk_noop_object_wrapper_new();
+
+GtkWidget* pTopLevel = gtk_widget_get_parent(pTopLevelGrid);
 if (!pTopLevel)
 return atk_noop_object_wrapper_new();
 #else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2016-07-04 Thread Caolán McNamara
 vcl/source/window/winproc.cxx |4 
 vcl/unx/gtk3/gtk3gtkframe.cxx |3 ---
 2 files changed, 7 deletions(-)

New commits:
commit 43fbd02a82f9c87c75e83671c95c2617cc30d035
Author: Caolán McNamara 
Date:   Mon Jul 4 11:35:36 2016 +0100

this flush refers to the gtk2/X impl

where there is two connections to the display, for gtk3 there
is just the one connection

Change-Id: I2da02efa12205ab4ca39d9585965e5d6d0adf474

diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index b0a4e62..8e12b96 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1462,9 +1462,6 @@ void GtkSalFrame::Show( bool bVisible, bool 
/*bNoActivate*/ )
 gtk_widget_hide( m_pWindow );
 if( m_pIMHandler )
 m_pIMHandler->focusChanged( false );
-// flush here; there may be a very seldom race between
-// the display connection used for clipboard and our connection
-Flush();
 }
 }
 }
commit a760ff5b41612c0c6aefeac5fb06691f819ceee2
Author: Caolán McNamara 
Date:   Fri Jul 1 21:17:18 2016 +0100

lets assume its ok this was commented out

Change-Id: Ic22c8b1f0f0b9e7427eae756f9f16630f951baa6

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 7333612..5093c1e 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -364,10 +364,6 @@ bool ImplHandleMouseEvent( const VclPtr& 
xWindow, MouseNotifyEvent
 const OutputDevice *pChildWinOutDev = pChild->GetOutDev();
 pChildWinOutDev->ReMirror( aMousePos );
 }
-// no mouse messages to system object windows ?
-// !!!KA: Is it OK to comment this out? !!!
-//if ( pChild->ImplGetWindowImpl()->mpSysObj )
-//return false;
 
 // no mouse messages to disabled windows
 // #106845# if the window was disabled during capturing we have to 
pass the mouse events to release capturing
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-05-25 Thread Tor Lillqvist
 vcl/source/opengl/OpenGLHelper.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit dfa1f2c83ff57e2e225c0c79ced1d13a48f2317a
Author: Tor Lillqvist 
Date:   Wed May 25 15:33:17 2016 +0300

Use VCL_GL_INFO here

Failing to open a cached shader binary is a no reason for a
SAL_WARN. It is normal that they don't exist when first trying, that
is the very nature of a 'cache'.

Change-Id: Iaa40af11f0679b859f1fa8b246665c61640df379

diff --git a/vcl/source/opengl/OpenGLHelper.cxx 
b/vcl/source/opengl/OpenGLHelper.cxx
index 2451594..5dff689 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -290,12 +290,12 @@ namespace
 sal_uInt64 nBytesRead = 0;
 aFile.read( rBinary.data(), nSize, nBytesRead );
 assert( nSize == nBytesRead );
-SAL_INFO("vcl.opengl", "Loading file: '" << rBinaryFileName << "': 
success" );
+VCL_GL_INFO("Loading file: '" << rBinaryFileName << "': success" );
 return true;
 }
 else
 {
-SAL_WARN("vcl.opengl", "Loading file: '" << rBinaryFileName << "': 
FAIL");
+VCL_GL_INFO("Loading file: '" << rBinaryFileName << "': FAIL");
 }
 
 return false;
commit 2864c50d0ad8a00eb5b518728d70af81120da4ab
Author: Tor Lillqvist 
Date:   Wed May 25 15:29:21 2016 +0300

Avoid redundancy: The same information was logged in readProgramBinary()

Change-Id: Id5619c9c102ba72826265c1b5f46ddb58596b8b1

diff --git a/vcl/source/opengl/OpenGLHelper.cxx 
b/vcl/source/opengl/OpenGLHelper.cxx
index 70f4b09..2451594 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -406,7 +406,6 @@ GLint OpenGLHelper::LoadShaders(const OUString& 
rVertexShaderName,
 OString aFileName =
 createFileName(rVertexShaderName, rFragmentShaderName, 
rGeometryShaderName, rDigest);
 bBinaryResult = loadProgramBinary(ProgramID, aFileName);
-VCL_GL_INFO("Load binary shader from '" << aFileName << "'" << 
bBinaryResult);
 CHECK_GL_ERROR();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-05-12 Thread Caolán McNamara
 vcl/source/app/svapp.cxx |   44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 3beb77bb6753a77b7d801fdc65fad78b98331813
Author: Caolán McNamara 
Date:   Thu May 12 11:30:14 2016 +0100

Resolves: tdf#99464 don't allow a menu as a dialog parent

which is an issue since...

commit dd46727b99d4bb5135451aa7e5e1bdb197373843
Author: Caolán McNamara 
Date:   Tue Apr 5 15:27:38 2016 +0100

Resolves; tdf#87120 no keyboard navigation inside floating windows

lets try and treat these the same as we do normal toplevels
like dialogs if they popup with GrabFocus.

This way focus can be set on widgets inside the floating windows, and
so keyboard traversal of widgets etc all works.

which allows keyboard focus inside floatinging windows to allow
a11y keyboard navigation inside them without jumping through difficult 
hoops.

Its typically better to explicitly set the parent of the dialog rather
than depend no the auto-search stuff

Change-Id: I869f3ef6c86d32dd9a1f5b53a2677be9f16a1598

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 76947cf..1374a7a 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1442,7 +1442,7 @@ vcl::Window* Application::GetDefDialogParent()
 
 // current focus frame
 vcl::Window *pWin = pSVData->maWinData.mpFocusWin;
-if (pWin)
+if (pWin && !pWin->IsMenuFloatingWindow())
 {
 while (pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent)
 pWin = pWin->mpWindowImpl->mpParent;
commit 9226f602bade8a153fe2d5877cc47856cdcffd0c
Author: Caolán McNamara 
Date:   Thu May 12 11:27:11 2016 +0100

rejig for legibility, no logic change

Change-Id: I73418e29dd85488613ea5c54ca8d505715ed3cbf

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 5a2ae0c..76947cf 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1441,51 +1441,51 @@ vcl::Window* Application::GetDefDialogParent()
 // as DefDialogParent
 
 // current focus frame
-vcl::Window *pWin = nullptr;
-if( (pWin = pSVData->maWinData.mpFocusWin) != nullptr )
+vcl::Window *pWin = pSVData->maWinData.mpFocusWin;
+if (pWin)
 {
-while( pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent )
+while (pWin->mpWindowImpl && pWin->mpWindowImpl->mpParent)
 pWin = pWin->mpWindowImpl->mpParent;
 
 // check for corrupted window hierarchy, #122232#, may be we now crash 
somewhere else
-if( !pWin->mpWindowImpl )
+if (!pWin->mpWindowImpl)
 {
 OSL_FAIL( "Window hierarchy corrupted!" );
 pSVData->maWinData.mpFocusWin = nullptr;   // avoid further access
 return nullptr;
 }
 
-if( (pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
+if ((pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0)
 {
 return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
 }
 }
 
 // last active application frame
-if( nullptr != (pWin = pSVData->maWinData.mpActiveApplicationFrame) )
+pWin = pSVData->maWinData.mpActiveApplicationFrame;
+if (pWin)
 {
 return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
 }
-else
+
+// first visible top window (may be totally wrong)
+pWin = pSVData->maWinData.mpFirstFrame;
+while (pWin)
 {
-// first visible top window (may be totally wrong)
-pWin = pSVData->maWinData.mpFirstFrame;
-while( pWin )
+if( pWin->ImplGetWindow()->IsTopWindow() &&
+pWin->mpWindowImpl->mbReallyVisible &&
+(pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0
+)
 {
-if( pWin->ImplGetWindow()->IsTopWindow() &&
-pWin->mpWindowImpl->mbReallyVisible &&
-(pWin->mpWindowImpl->mnStyle & WB_INTROWIN) == 0
-)
-{
-while( pWin->mpWindowImpl->mpParent )
-pWin = pWin->mpWindowImpl->mpParent;
-return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
-}
-pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
+while( pWin->mpWindowImpl->mpParent )
+pWin = pWin->mpWindowImpl->mpParent;
+return pWin->mpWindowImpl->mpFrameWindow->ImplGetWindow();
 }
-// use the desktop
-return nullptr;
+pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame;
 }
+
+// use the desktop
+return nullptr;
 }
 
 Application::DialogCancelMode Application::GetDialogCancelMode()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org

[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-03-03 Thread Caolán McNamara
 vcl/source/gdi/pdfwriter_impl.cxx |   21 ++---
 1 file changed, 6 insertions(+), 15 deletions(-)

New commits:
commit 5f6065f980756fdb81c7018bedbb7f54e2b8214a
Author: Caolán McNamara 
Date:   Thu Mar 3 20:44:47 2016 +

coverity#1355126 Logically dead code

maybe we should be using more precision, but we haven't
been in the past

Change-Id: Icf1e1e95099c783435e04f60d8ade755a8d2d4d5

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 746636a..0a4d595 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -845,17 +845,14 @@ static void appendFixedInt( sal_Int32 nValue, 
OStringBuffer& rBuffer )
 rBuffer.append( '-' );
 nValue = -nValue;
 }
-sal_Int32 nFactor = 10;
-sal_Int32 nInt = nValue / nFactor;
+const sal_Int32 nFactor = 10;
+const sal_Int32 nInt = nValue / nFactor;
 rBuffer.append( nInt );
 sal_Int32 nDecimal  = nValue % nFactor;
-if( nDecimal )
+if (nDecimal)
 {
-rBuffer.append( '.' );
-// omit trailing zeros
-while( (nDecimal % 10) == 0 )
-nDecimal /= 10;
-rBuffer.append( nDecimal );
+rBuffer.append('.');
+rBuffer.append(nDecimal);
 }
 }
 
commit cd5cc12d4330d68d0a233a82eda30e983ce202a4
Author: Caolán McNamara 
Date:   Thu Mar 3 20:42:52 2016 +

nLog10Divisor is 1

Change-Id: I8820d435e2f26d04ac3eccb710383399d050e020

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 6911134..746636a 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -845,23 +845,17 @@ static void appendFixedInt( sal_Int32 nValue, 
OStringBuffer& rBuffer )
 rBuffer.append( '-' );
 nValue = -nValue;
 }
-sal_Int32 nFactor = 1, nDiv = nLog10Divisor;
-while( nDiv-- )
-nFactor *= 10;
-
-sal_Int32 nInt  = nValue / nFactor;
+sal_Int32 nFactor = 10;
+sal_Int32 nInt = nValue / nFactor;
 rBuffer.append( nInt );
-if( nFactor > 1 )
+sal_Int32 nDecimal  = nValue % nFactor;
+if( nDecimal )
 {
-sal_Int32 nDecimal  = nValue % nFactor;
-if( nDecimal )
-{
-rBuffer.append( '.' );
-// omit trailing zeros
-while( (nDecimal % 10) == 0 )
-nDecimal /= 10;
-rBuffer.append( nDecimal );
-}
+rBuffer.append( '.' );
+// omit trailing zeros
+while( (nDecimal % 10) == 0 )
+nDecimal /= 10;
+rBuffer.append( nDecimal );
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-01-25 Thread Chris Sherlock
 vcl/source/gdi/salgdilayout.cxx |   31 +++
 vcl/source/gdi/virdev.cxx   |   19 +--
 2 files changed, 8 insertions(+), 42 deletions(-)

New commits:
commit 841d9bfab4207ccb36ecffcba16171a05e80874b
Author: Chris Sherlock 
Date:   Tue Jan 26 00:42:01 2016 +1100

vcl: remove unnecessary header includes in vcl/source/gdi/salgdilayout.cxx

Change-Id: I4a49ef84b95e90976a8c1ed76a628c1d0dbf4ed2

diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 6d04c1e..7506b9e 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -17,34 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
+#include "openglgdiimpl.hxx"
+#include "salgdi.hxx"
+#include "salframe.hxx"
 
 // The only common SalFrame method
 
commit eee10037ae401cd53c4dd8dc61430ee167f999c9
Author: Chris Sherlock 
Date:   Tue Jan 26 00:35:50 2016 +1100

vcl: remove unnecessary header includes in vcl/source/gdi/virdev.cxx

Change-Id: I28579cb30397ac88c94952632e7cd3db7277dce0

diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 259d5e1..0b00b4c 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -17,21 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
+#include "salinst.hxx"
+#include "salgdi.hxx"
+#include "salvd.hxx"
+#include "outdev.h"
 #include "PhysicalFontCollection.hxx"
-#include "impfontmetricdata.hxx"
-#include 
+#include "svdata.hxx"
 
 #include 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-01-25 Thread Chris Sherlock
 vcl/source/outdev/outdev.cxx  |   50 +++---
 vcl/source/outdev/outdevstate.cxx |   15 ---
 2 files changed, 6 insertions(+), 59 deletions(-)

New commits:
commit aee5d4e41156cc2b0b56e370ee51fa5b1d285522
Author: Chris Sherlock 
Date:   Tue Jan 26 01:21:41 2016 +1100

vcl: remove unnecessary headers from outdev.cxx

Change-Id: I8714718830f8b86567ef2750373ce2dab828c07f

diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 26346ed..eb118de 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -17,58 +17,18 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
-
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
-#include 
 #include 
 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
+#include "salgdi.hxx"
+#include "svdata.hxx"
+#include "window.h"
+#include "outdev.h"
+#include "outdevstatestack.hxx"
 #include "PhysicalFontCollection.hxx"
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include 
-#include 
-
 #ifdef DISABLE_DYNLOADING
 // Linking all needed LO code into one .so/executable, these already
 // exist in the tools library, so put them in the anonymous namespace
commit 209acc934a65ff4eae6b8e4bad0474d751ada94f
Author: Chris Sherlock 
Date:   Tue Jan 26 01:12:42 2016 +1100

vcl: remove unnecessary headers from outdevstate.cxx

Change-Id: I19d8ea633d5fd5462af29a43b916518a31a94787

diff --git a/vcl/source/outdev/outdevstate.cxx 
b/vcl/source/outdev/outdevstate.cxx
index 354d6d0..4a0f485 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -18,26 +18,13 @@
  */
 
 #include 
-
-#include 
 #include 
-
 #include 
 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
 #include "outdev.h"
 #include "outdata.hxx"
-#include 
+#include "outdevstatestack.hxx"
 #include "salgdi.hxx"
-#include "sallayout.hxx"
 
 OutDevState::OutDevState()
 : mpMapMode(nullptr)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-01-25 Thread Chris Sherlock
 vcl/source/outdev/map.cxx  |7 ---
 vcl/source/outdev/text.cxx |   25 +
 2 files changed, 5 insertions(+), 27 deletions(-)

New commits:
commit 3de2c3952b9757c40615194811142fd19a9b72eb
Author: Chris Sherlock 
Date:   Tue Jan 26 01:43:09 2016 +1100

vcl: remove unnecessary header includes from text.cxx

Change-Id: Iefa9cad66248297e4639567cd3f5836abb2e167c

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 97e6754..147d82f 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -17,13 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
-#include 
-
-#include 
-
 #include 
 
 #include 
@@ -33,27 +26,19 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-#include 
-
+#include "outdata.hxx"
+#include "outdev.h"
+#include "salgdi.hxx"
+#include "svdata.hxx"
+#include "textlayout.hxx"
 #include "textlineinfo.hxx"
 
-#include 
-#if ENABLE_GRAPHITE
-#include "graphite_features.hxx"
-#endif
-
 #define TEXT_DRAW_ELLIPSIS  (DrawTextFlags::EndEllipsis | 
DrawTextFlags::PathEllipsis | DrawTextFlags::NewsEllipsis)
 
 ImplMultiTextLineInfo::ImplMultiTextLineInfo()
commit ded0da10d8a6fc4a4ae732f9e99433e0b69c3c68
Author: Chris Sherlock 
Date:   Tue Jan 26 01:36:15 2016 +1100

vcl: remove unnecessary header includes in map.cxx

Change-Id: I60fafe283740f6246fa2978a1d2e4ee283ecea87

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index e2a85a7..6b3ce3e 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -17,18 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
-#include 
-
 #include 
 #include 
 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-01-25 Thread Chris Sherlock
 vcl/source/window/dndeventdispatcher.cxx   |   30 -
 vcl/source/window/dndlistenercontainer.cxx |   40 -
 2 files changed, 70 deletions(-)

New commits:
commit 0406203eeca0ef5883f608566d4a0915f86a558b
Author: Chris Sherlock 
Date:   Mon Jan 25 19:39:06 2016 +1100

vcl: remove comment cruft from dndeventcontainer.cxx

Change-Id: I55a3297916df9cb4f380f29299e7555e6aed7979

diff --git a/vcl/source/window/dndeventdispatcher.cxx 
b/vcl/source/window/dndeventdispatcher.cxx
index 165ad27..9ca0a92 100644
--- a/vcl/source/window/dndeventdispatcher.cxx
+++ b/vcl/source/window/dndeventdispatcher.cxx
@@ -32,14 +32,12 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::datatransfer;
 using namespace ::com::sun::star::datatransfer::dnd;
 
-// DNDEventDispatcher::DNDEventDispatcher
 DNDEventDispatcher::DNDEventDispatcher( vcl::Window * pTopWindow ):
 m_pTopWindow( pTopWindow ),
 m_pCurrentWindow( nullptr )
 {
 }
 
-// DNDEventDispatcher::~DNDEventDispatcher
 DNDEventDispatcher::~DNDEventDispatcher()
 {
 designate_currentwindow(nullptr);
@@ -87,7 +85,6 @@ void DNDEventDispatcher::designate_currentwindow(vcl::Window 
*pWindow)
 m_pCurrentWindow->AddEventListener(LINK(this, DNDEventDispatcher, 
WindowEventListener));
 }
 
-// DNDEventDispatcher::drop
 void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
 throw(RuntimeException, std::exception)
 {
@@ -124,8 +121,6 @@ void SAL_CALL DNDEventDispatcher::drop( const 
DropTargetDropEvent& dtde )
 m_aDataFlavorList.realloc( 0 );
 }
 
-// DNDEventDispatcher::dragEnter
-
 void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& 
dtdee )
 throw(RuntimeException, std::exception)
 {
@@ -150,8 +145,6 @@ void SAL_CALL DNDEventDispatcher::dragEnter( const 
DropTargetDragEnterEvent& dtd
 
 }
 
-// DNDEventDispatcher::dragExit
-
 void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& /*dte*/ )
 throw(RuntimeException, std::exception)
 {
@@ -164,8 +157,6 @@ void SAL_CALL DNDEventDispatcher::dragExit( const 
DropTargetEvent& /*dte*/ )
 m_aDataFlavorList.realloc( 0 );
 }
 
-// DNDEventDispatcher::dragOver
-
 void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde )
 throw(RuntimeException, std::exception)
 {
@@ -203,7 +194,6 @@ void SAL_CALL DNDEventDispatcher::dragOver( const 
DropTargetDragEvent& dtde )
 }
 }
 
-// DNDEventDispatcher::dropActionChanged
 void SAL_CALL DNDEventDispatcher::dropActionChanged( const 
DropTargetDragEvent& dtde )
 throw(RuntimeException, std::exception)
 {
@@ -241,8 +231,6 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const 
DropTargetDragEvent&
 }
 }
 
-// DNDEventDispatcher::dragGestureRecognized
-
 void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const 
DragGestureEvent& dge )
 throw(RuntimeException, std::exception)
 {
@@ -255,27 +243,19 @@ void SAL_CALL DNDEventDispatcher::dragGestureRecognized( 
const DragGestureEvent&
 fireDragGestureEvent( pChildWindow, dge.DragSource, dge.Event, origin, 
dge.DragAction );
 }
 
-// DNDEventDispatcher::disposing
-
 void SAL_CALL DNDEventDispatcher::disposing( const EventObject& )
 throw(RuntimeException, std::exception)
 {
 }
 
-// DNDEventDispatcher::acceptDrag
-
 void SAL_CALL DNDEventDispatcher::acceptDrag( sal_Int8 /*dropAction*/ ) 
throw(RuntimeException, std::exception)
 {
 }
 
-// DNDEventDispatcher::rejectDrag
-
 void SAL_CALL DNDEventDispatcher::rejectDrag() throw(RuntimeException, 
std::exception)
 {
 }
 
-// DNDEventDispatcher::fireDragEnterEvent
-
 sal_Int32 DNDEventDispatcher::fireDragEnterEvent( vcl::Window *pWindow,
 const Reference< XDropTargetDragContext >& xContext, const sal_Int8 
nDropAction,
 const Point& rLocation, const sal_Int8 nSourceActions, const Sequence< 
DataFlavor >& aFlavorList
@@ -308,8 +288,6 @@ sal_Int32 DNDEventDispatcher::fireDragEnterEvent( 
vcl::Window *pWindow,
 return n;
 }
 
-// DNDEventDispatcher::fireDragOverEvent
-
 sal_Int32 DNDEventDispatcher::fireDragOverEvent( vcl::Window *pWindow,
 const Reference< XDropTargetDragContext >& xContext, const sal_Int8 
nDropAction,
 const Point& rLocation, const sal_Int8 nSourceActions
@@ -339,8 +317,6 @@ sal_Int32 DNDEventDispatcher::fireDragOverEvent( 
vcl::Window *pWindow,
 return n;
 }
 
-// DNDEventDispatcher::fireDragExitEvent
-
 sal_Int32 DNDEventDispatcher::fireDragExitEvent( vcl::Window *pWindow ) 
throw(RuntimeException)
 {
 sal_Int32 n = 0;
@@ -364,8 +340,6 @@ sal_Int32 DNDEventDispatcher::fireDragExitEvent( 
vcl::Window *pWindow ) throw(Ru
 return n;
 }
 
-// DNDEventDispatcher::fireDropActionChangedEvent
-
 sal_Int32 DNDEventDispatcher::fireDropActionChangedEvent( vcl::Window *pWindow,
 const Reference< XDropTargetDragContext >& xContext, const sal_Int8 
nDropAction,
 const Point& rLocation, const sal_Int8 nSourceActions
@@ 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-01-25 Thread Stephan Bergmann
 vcl/source/window/dialog.cxx|2 +-
 vcl/source/window/menubarwindow.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bd383c3f74a31366b139044ad21b48cc671e2213
Author: Stephan Bergmann 
Date:   Fri Jan 22 20:53:47 2016 +0100

Dialog's ImplAsyncCloseHdl is IMPL_LINK_NOARG_TYPED

...so no need to pass it an actual argument

Change-Id: Idd349aec9a93bf9097f4a2f868d5e4cc9eb0aaed

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1849b72..d06ca87 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -649,7 +649,7 @@ bool Dialog::Notify( NotifyEvent& rNEvt )
 // like e.g. SfxModelessDialog which destroy themselves inside 
Close()
 // post this Close asynchronous so we can leave our key 
handler before
 // we get destroyed
-PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this, 
true);
+PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), 
nullptr, true);
 return true;
 }
 }
commit 8ccd76c6ea8fa50f88c76c6c250cee76290a1f90
Author: Stephan Bergmann 
Date:   Fri Jan 22 20:49:44 2016 +0100

MenuBar's CloseButtonClickHdl doesn't need an argument

...the only actual use of it, LayoutManager's MenuBarClose in
framework/source/layoutmanager/layoutmanager.cxx is IMPL_LINK_NOARG_TYPED.

Change-Id: Idf12fe5735cd452954a9d2ddbce305fa96b832a0

diff --git a/vcl/source/window/menubarwindow.cxx 
b/vcl/source/window/menubarwindow.cxx
index aa9c355..8954513 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -233,7 +233,7 @@ IMPL_LINK_NOARG_TYPED(MenuBarWindow, CloseHdl, ToolBox *, 
void)
 // #i106052# call close hdl asynchronously to ease handler 
implementation
 // this avoids still being in the handler while the DecoToolBox already
 // gets destroyed
-
Application::PostUserEvent(static_cast(pMenu)->GetCloseButtonClickHdl(),
 pMenu);
+
Application::PostUserEvent(static_cast(pMenu)->GetCloseButtonClickHdl());
 }
 else
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2016-01-07 Thread Chris Sherlock
 vcl/source/edit/textview.cxx|  102 +---
 vcl/source/filter/graphicfilter.cxx |   14 ++--
 2 files changed, 56 insertions(+), 60 deletions(-)

New commits:
commit e415bab58ba859f783f12932e478e503bcaa9e4c
Author: Chris Sherlock 
Date:   Fri Jan 8 11:44:43 2016 +1100

vcl: cleanup namespaces in vcl/source/filter/graphicfilter.cxx

Change-Id: I00cb940d20dd2ce712ab206f088789ae73792c70

diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index 64c1b5bb..7b3d34c 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -71,8 +71,6 @@
 
 #define PMGCHUNG_msOG   0x6d734f47  // Microsoft Office Animated GIF
 
-using namespace ::com::sun::star;
-
 using comphelper::string::getTokenCount;
 
 typedef ::std::vector< GraphicFilter* > FilterList_impl;
@@ -1348,7 +1346,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& 
rGraphic, const OUString& rPat
 {
 if ( (*pFilterData)[ i ].Name == "PreviewSizeHint" )
 {
-awt::Size aSize;
+css::awt::Size aSize;
 if ( (*pFilterData)[ i ].Value >>= aSize )
 {
 aPreviewSizeHint = Size( aSize.Width, aSize.Height );
@@ -1789,7 +1787,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& 
rGraphic, const OUString& rPat
 }
 
 sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const 
INetURLObject& rPath,
-sal_uInt16 nFormat, const uno::Sequence< beans::PropertyValue >* 
pFilterData )
+sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue >* 
pFilterData )
 {
 #ifdef DISABLE_EXPORT
 (void) rGraphic;
@@ -1832,7 +1830,7 @@ extern "C" bool etiGraphicExport( SvStream& rStream, 
Graphic& rGraphic, FilterCo
 #endif
 
 sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const 
OUString& rPath,
-SvStream& rOStm, sal_uInt16 nFormat, const uno::Sequence< 
beans::PropertyValue >* pFilterData )
+SvStream& rOStm, sal_uInt16 nFormat, const css::uno::Sequence< 
css::beans::PropertyValue >* pFilterData )
 {
 #ifdef DISABLE_EXPORT
 (void) rGraphic;
@@ -1866,7 +1864,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, const OUString
 if( nFormat >= nFormatCount )
 return (sal_uInt16) ImplSetError( GRFILTER_FORMATERROR );
 
-FilterConfigItem aConfigItem( const_cast*>(pFilterData) );
+FilterConfigItem aConfigItem( const_cast*>(pFilterData) );
 OUString aFilterName( pConfig->GetExportFilterName( nFormat ) );
 #ifndef DISABLE_DYNLOADING
 OUString aExternalFilterName(pConfig->GetExternalFilterName(nFormat, 
true));
@@ -2065,7 +2063,7 @@ sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, const OUString
 css::uno::Reference< css::uno::XComponentContext > 
xContext( ::comphelper::getProcessComponentContext() );
 
 css::uno::Reference< css::xml::sax::XDocumentHandler > 
xSaxWriter(
-xml::sax::Writer::create( xContext ), 
uno::UNO_QUERY_THROW);
+css::xml::sax::Writer::create( xContext ), 
css::uno::UNO_QUERY_THROW);
 css::uno::Sequence< css::uno::Any > aArguments( 1 );
 aArguments[ 0 ] <<= aConfigItem.GetFilterData();
 css::uno::Reference< css::svg::XSVGWriter > xSVGWriter(
@@ -2298,7 +2296,7 @@ sal_uInt16 GraphicFilter::compressAsPNG(const Graphic& 
rGraphic, SvStream& rOutp
 {
 nCompression = MinMax(nCompression, 0, 100);
 
-uno::Sequence aFilterData(1);
+css::uno::Sequence< css::beans::PropertyValue > aFilterData(1);
 aFilterData[0].Name = "Compression";
 aFilterData[0].Value <<= nCompression;
 
commit 3b5f702fab50371174008243f8b9b46fe43e51c6
Author: Chris Sherlock 
Date:   Fri Jan 8 10:58:12 2016 +1100

vcl: cleanup namespace in vcl/source/edit/textview.cxx

Change-Id: If33d4e30d39f9382eab2deb4f4ceb6f65211b912

diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 45cc854..93d7957 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -58,8 +58,6 @@
 
 #include 
 
-using namespace ::com::sun::star;
-
 class TETextDataObject :public css::datatransfer::XTransferable,
 public ::cppu::OWeakObject
 
@@ -94,17 +92,17 @@ TETextDataObject::~TETextDataObject()
 {
 }
 
-// uno::XInterface
-uno::Any TETextDataObject::queryInterface( const uno::Type & rType ) 
throw(uno::RuntimeException, std::exception)
+// css::uno::XInterface
+css::uno::Any TETextDataObject::queryInterface( const css::uno::Type & rType ) 
throw(css::uno::RuntimeException, std::exception)
 {
-uno::Any aRet = ::cppu::queryInterface( rType, (static_cast< 

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2015-11-30 Thread Caolán McNamara
 vcl/source/window/seleng.cxx   |2 +-
 vcl/source/window/toolbox.cxx  |6 --
 vcl/source/window/toolbox2.cxx |6 --
 vcl/unx/gtk/gtksalframe.cxx|   14 --
 4 files changed, 21 insertions(+), 7 deletions(-)

New commits:
commit 503864037b2f6b73979f46d11df5d365b81f9dcf
Author: Caolán McNamara 
Date:   Mon Nov 30 16:42:15 2015 +

gtk3: implement GetIndicatorState

Change-Id: I006c739a9dc876dd9ec83375f76fd1343b39557a

diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index b465404..64994bf 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -2770,8 +2770,18 @@ KeyIndicatorState GtkSalFrame::GetIndicatorState()
 #if !GTK_CHECK_VERSION(3,0,0)
 return GetGtkSalData()->GetGtkDisplay()->GetIndicatorState();
 #else
-g_warning ("missing get indicator state");
-return KeyIndicatorState::NONE;
+KeyIndicatorState nState = KeyIndicatorState::NONE;
+
+GdkKeymap *pKeyMap = gdk_keymap_get_for_display(getGdkDisplay());
+
+if (gdk_keymap_get_caps_lock_state(pKeyMap))
+nState |= KeyIndicatorState::CAPSLOCK;
+if (gdk_keymap_get_num_lock_state(pKeyMap))
+nState |= KeyIndicatorState::NUMLOCK;
+if (gdk_keymap_get_scroll_lock_state(pKeyMap))
+nState |= KeyIndicatorState::SCROLLLOCK;
+
+return nState;
 #endif
 }
 
commit a4e58b509828d806513217efc03134845629cccd
Author: Caolán McNamara 
Date:   Mon Nov 30 16:18:35 2015 +

silence ReleaseMouse warning

Change-Id: I615b4877ab29075ed45149259260acfb2563cad8

diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index 69b220b..6aefea1 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -280,7 +280,7 @@ bool SelectionEngine::SelMouseButtonUp( const MouseEvent& 
rMEvt )
 
 void SelectionEngine::ReleaseMouse()
 {
-if (!pWin)
+if (!pWin || !pWin->IsMouseCaptured())
 return;
 pWin->ReleaseMouse();
 }
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 4105b58..311d12e 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1251,7 +1251,8 @@ void ImplTBDragMgr::Dragging( const Point& rPos )
 void ImplTBDragMgr::EndDragging( bool bOK )
 {
 mpDragBox->HideTracking();
-mpDragBox->ReleaseMouse();
+if (mpDragBox->IsMouseCaptured())
+mpDragBox->ReleaseMouse();
 mpDragBox->mbDragging = false;
 mbShowDragRect = false;
 Application::RemoveAccel(  );
@@ -3346,7 +3347,8 @@ void ToolBox::ImplFloatControl( bool bStart, 
FloatingWindow* pFloatWindow )
 
 mbDrag = false;
 EndTracking();
-ReleaseMouse();
+if (IsMouseCaptured())
+ReleaseMouse();
 }
 else
 {
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index dddb65f..2bcb44e 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1335,7 +1335,8 @@ void ToolBox::EndSelection()
 if (mnCurPos != TOOLBOX_ITEM_NOTFOUND)
 InvalidateItem(mnCurPos);
 EndTracking();
-ReleaseMouse();
+if (IsMouseCaptured())
+ReleaseMouse();
 Deactivate();
 }
 
@@ -1378,7 +1379,8 @@ void ToolBox::SetItemDown( sal_uInt16 nItemId, bool 
bDown, bool bRelease )
 mbDrag = false;
 mbSelection = false;
 EndTracking();
-ReleaseMouse();
+if (IsMouseCaptured())
+ReleaseMouse();
 Deactivate();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-11-26 Thread Michael Stahl
 vcl/source/outdev/font.cxx |6 ++
 vcl/source/outdev/text.cxx |   14 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit e6e409b684f9b046dcde9f0615018508f769c369
Author: Michael Stahl 
Date:   Wed Nov 25 22:42:16 2015 +0100

vcl: OutputDevice::GetTextArray() should always init pDXAry

CppunitTest_writerperfect_writer file libmwaw/pass/Acta_1.0.hqx uses the
font "Courier", and for unknown reasons we can't properly load that
font, because the PhysicalFontFamily::mpFirst for "courier" is null.

This causes OutputDevice::GetTextArray() to fail to create a SalLayout
and return early before initializing the passed pDXAry, which then
generates lots of DrMemory warnings.

Let's hope the callers are happy about an all-0 pDXAry.

Change-Id: I07b29a59660cf5cd060fd77da5d96021f9d8f9f5

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 097d21c..8bb7778 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1006,7 +1006,7 @@ long OutputDevice::GetTextArray( const OUString& rStr, 
long* pDXAry,
 }
 
 if( nIndex >= rStr.getLength() )
-return 0;
+return 0; // TODO: this looks like a buggy caller?
 
 if( nLen < 0 || nIndex + nLen >= rStr.getLength() )
 {
@@ -1016,7 +1016,19 @@ long OutputDevice::GetTextArray( const OUString& rStr, 
long* pDXAry,
 SalLayout *const pSalLayout = ImplLayout(rStr, nIndex, nLen,
 Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache);
 if( !pSalLayout )
+{
+// The caller expects this to init the elements of pDXAry.
+// Adapting all the callers to check that GetTextArray succeeded seems
+// too much work.
+// Init here to 0 only in the (rare) error case, so that any missing
+// element init in the happy case will still be found by tools,
+// and hope that is sufficient.
+if (pDXAry)
+{
+memset(pDXAry, 0, nLen * sizeof(*pDXAry));
+}
 return 0;
+}
 #if VCL_FLOAT_DEVICE_PIXEL
 std::unique_ptr pDXPixelArray;
 if(pDXAry)
commit b6e354b26bfe2c0790c5817cba3cc3a6dad910b9
Author: Michael Stahl 
Date:   Wed Nov 25 21:49:43 2015 +0100

vcl: warn if we can't set a new font in OutputDevice

Change-Id: I7708590d0c8564271f76e8b80adc566022e6916e

diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 5f9f07d..f2885f0 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1546,7 +1546,10 @@ bool OutputDevice::ImplNewFont() const
 
 // we need a graphics
 if ( !mpGraphics && !AcquireGraphics() )
+{
+SAL_WARN("vcl.gdi", "OutputDevice::ImplNewFont(): no Graphics, no 
Font");
 return false;
+}
 SalGraphics* pGraphics = mpGraphics;
 ImplInitFontList();
 
@@ -1577,7 +1580,10 @@ bool OutputDevice::ImplNewFont() const
 ImplFontEntry* pFontEntry = mpFontEntry;
 
 if (!pFontEntry)
+{
+SAL_WARN("vcl.gdi", "OutputDevice::ImplNewFont(): no ImplFontEntry, no 
Font");
 return false;
+}
 
 // mark when lower layers need to get involved
 mbNewFont = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-11-23 Thread Noel Grandin
 vcl/source/bitmap/BitmapProcessor.cxx |8 
 vcl/source/image/Image.cxx|4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 28f21af7194c887f74190e6c6596fbaafc189e97
Author: Noel Grandin 
Date:   Mon Nov 23 15:19:40 2015 +0200

fix Image::operator==

comparing the pointer values in std::unique_ptr's can never be true
(since they cannot point at the same thing, by definition)

Change-Id: I38eb6406b61d5a3662adb68ca1558248925d7e90

diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index 33a5018..d224da1 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -221,8 +221,8 @@ bool Image::operator==(const Image& rImage) const
 bRet = true;
 else if (!rImage.mpImplData || !mpImplData)
 bRet = false;
-else if (rImage.mpImplData->mpBitmapEx == mpImplData->mpBitmapEx)
-bRet = (rImage.mpImplData->mpBitmapEx == mpImplData->mpBitmapEx);
+else
+bRet = *rImage.mpImplData->mpBitmapEx == *mpImplData->mpBitmapEx;
 
 return bRet;
 }
commit 37605424f51c569d1b80c47a4d42366bf829e683
Author: Noel Grandin 
Date:   Mon Nov 23 15:10:37 2015 +0200

loplugin:loopvartoosmall

Change-Id: I2aca12b994c2fd260803a8897b968ddac848f235

diff --git a/vcl/source/bitmap/BitmapProcessor.cxx 
b/vcl/source/bitmap/BitmapProcessor.cxx
index 20f8121..44a0f7d 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -80,9 +80,9 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& 
rBitmapEx)
 BitmapColor aGreyValue(0);
 BitmapColor aGreyAlphaValue(0);
 
-for (int nY = 0; nY < aSize.Height(); ++nY)
+for (long nY = 0; nY < aSize.Height(); ++nY)
 {
-for (int nX = 0; nX < aSize.Width(); ++nX)
+for (long nX = 0; nX < aSize.Width(); ++nX)
 {
 aGreyValue.SetIndex(pRead->GetLuminance(nY, nX));
 pGrey->SetPixel(nY, nX, aGreyValue);
@@ -104,9 +104,9 @@ BitmapEx BitmapProcessor::createDisabledImage(const 
BitmapEx& rBitmapEx)
 BitmapColor aGreyValue(0);
 BitmapColor aGreyAlphaValue(0);
 
-for (int nY = 0; nY < aSize.Height(); ++nY)
+for (long nY = 0; nY < aSize.Height(); ++nY)
 {
-for (int nX = 0; nX < aSize.Width(); ++nX)
+for (long nX = 0; nX < aSize.Width(); ++nX)
 {
 aGreyValue.SetIndex(pRead->GetLuminance(nY, nX));
 pGrey->SetPixel(nY, nX, aGreyValue);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-11-03 Thread Takeshi Abe
 vcl/source/control/ilstbox.cxx |2 +-
 vcl/source/window/decoview.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8f5748e29ee46315323a38d14af61c4f4e9f8fdf
Author: Takeshi Abe 
Date:   Tue Nov 3 19:58:20 2015 +0900

vcl: Mark it as const

Change-Id: I0ddaf1cf9d0a3f36f88bea3101b7059e04d755ff

diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 3ef2bc9..376c7bf 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -1101,7 +1101,7 @@ void DecorationView::DrawHandle(const Rectangle& rRect, 
bool bVertical)
 mpOutDev->SetLineColor(rStyleSettings.GetDarkShadowColor());
 mpOutDev->SetFillColor(rStyleSettings.GetDarkShadowColor());
 
-sal_Int32 nNumberOfPoints = 3;
+const sal_Int32 nNumberOfPoints = 3;
 
 long nHalfWidth = aOutputSize.Width() / 2.0f;
 long nHalfHeight = aOutputSize.Height() / 2.0f;
commit 0e17dd5810b393b69d7f84bc4529186c98c94caf
Author: Takeshi Abe 
Date:   Tue Nov 3 19:57:51 2015 +0900

vcl: Mark them as const

Change-Id: Ia19d3512d156be725840c24d441a3eaa08e83a5e

diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 92ea383..358fcf2 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -3115,7 +3115,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool 
bStartTracking )
 if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
 GetParent()->IsNativeWidgetEnabled() )
 {
-sal_Int32 nLeft = 4, nTop = 4, nRight = 4, nBottom = 4;
+const sal_Int32 nLeft = 4, nTop = 4, nRight = 4, nBottom = 4;
 aPos.X() += nLeft;
 aPos.Y() += nTop;
 aSz.Width() -= nLeft + nRight;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/workben

2015-10-07 Thread Caolán McNamara
 vcl/source/app/svapp.cxx|   20 
 vcl/workben/README.eventtesting |3 +--
 vcl/workben/eventtesting|binary
 3 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 9bb6863fcf0784c70a95510b488f0162fe6deb37
Author: Caolán McNamara 
Date:   Wed Oct 7 13:40:52 2015 +0100

afl-eventtesting: it has learned to open dialogs, so...

close all open dialogs on quitting to avoid triggering
the hang timeout and get things moving faster

Change-Id: I7469a32549f20d6b0971932e3334cb322f57b1ff

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c797d00..d4b197b 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -36,6 +36,7 @@
 #include 
 #include 
 
+#include "vcl/dialog.hxx"
 #include "vcl/settings.hxx"
 #include "vcl/keycod.hxx"
 #include "vcl/event.hxx"
@@ -347,6 +348,17 @@ namespace
 ImplWindowFrameProc(xWin.get(), NULL, SALEVENT_KEYUP, );
 return true;
 }
+
+void CloseDialogsAndQuit()
+{
+vcl::Window* pAppWindow = Application::GetFirstTopLevelWindow();
+while (pAppWindow)
+{
+Dialog::EndAllDialogs(pAppWindow);
+pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
+}
+Application::Quit();
+}
 }
 
 IMPL_LINK_NOARG_TYPED(ImplSVAppData, VclEventTestingHdl, Idle *, void)
@@ -357,7 +369,7 @@ IMPL_LINK_NOARG_TYPED(ImplSVAppData, VclEventTestingHdl, 
Idle *, void)
 delete mpEventTestInput;
 delete mpEventTestingIdle;
 SAL_INFO("vcl.eventtesting", "Event Limit reached, exiting" << 
mnEventTestLimit);
-Application::Quit();
+CloseDialogsAndQuit();
 }
 else
 {
@@ -369,7 +381,7 @@ IMPL_LINK_NOARG_TYPED(ImplSVAppData, VclEventTestingHdl, 
Idle *, void)
 delete mpEventTestInput;
 delete mpEventTestingIdle;
 SAL_INFO("vcl.eventtesting", "Event Input exhausted, exiting" << 
mnEventTestLimit);
-Application::Quit();
+CloseDialogsAndQuit();
 return;
 }
 Scheduler::ProcessTaskScheduling(true);
commit 967ea727c7f2c954ee8ac33a888718d8dac11837
Author: Caolán McNamara 
Date:   Wed Oct 7 13:22:56 2015 +0100

afl-eventtesting: lets ditch the key repeat and timestamp fields

time stamp doesn't matter apparently for keyboard events
so ditching it gives less surface area to fuzz

repeat showed some interesting effects, but mostly just allows
vast paragraphs to be generated causing timeout hangs which isn't
what I'm super interested in right now.

Change-Id: I955b91745a26d5044f0d53acd3fda0a160e53855

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 7fb612b..c797d00 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -336,10 +336,10 @@ namespace
 return false;
 
 SalKeyEvent aKeyEvent;
-rStream.ReadUInt64(aKeyEvent.mnTime);
+aKeyEvent.mnTime = 0;
 rStream.ReadUInt16(aKeyEvent.mnCode);
 rStream.ReadUInt16(aKeyEvent.mnCharCode);
-rStream.ReadUInt16(aKeyEvent.mnRepeat);
+aKeyEvent.mnRepeat = 0;
 if (!rStream.good())
 return false;
 
diff --git a/vcl/workben/README.eventtesting b/vcl/workben/README.eventtesting
index 0336f22..79472cd 100644
--- a/vcl/workben/README.eventtesting
+++ b/vcl/workben/README.eventtesting
@@ -2,8 +2,7 @@ Notes on experimental afl driven ui fuzzing
 
 only keyboard events for now
 
-vcl/workben/eventtesting is just serialized "helloworld" keystrokes to get
-things started
+vcl/workben/eventtesting is just serialized "hello" + ctrl+a + ctrl+b 
keystrokes to get things started
 
 currently an arbitrary limit of 10 keystrokes before application quits in
 order to initially explore that shallow space
diff --git a/vcl/workben/eventtesting b/vcl/workben/eventtesting
index 363260a..b85a203 100644
Binary files a/vcl/workben/eventtesting and b/vcl/workben/eventtesting differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-09-29 Thread Caolán McNamara
 vcl/source/glyphs/graphite_layout.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit d626345e8f1730eed1bb2b7183499a85133f
Author: Caolán McNamara 
Date:   Tue Sep 29 12:09:33 2015 +0100

coverity#1325059 Argument cannot be negative bodge

Change-Id: I9bae22c7420247a26f0fe73e6c4e590471f19b0e

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 635417b..10be4a0 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -689,6 +689,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , 
std::vector & rDelt
 
 for (int i = startGi; i < endGi; ++i)
 {
+if (i < 0)
+{
+SAL_WARN( "vcl.gdi", "Negative index" );
+continue;
+}
+
 // calculate visual cluster bounds
 int firstChar = mvGlyph2Char[i];
 int nBaseGlyph = mvChar2BaseGlyph[firstChar - mnMinCharPos];
commit 4fd693f718ac74115ea58208ac3427c01857d260
Author: Caolán McNamara 
Date:   Tue Sep 29 12:07:20 2015 +0100

coverity#1325060 Argument cannot be negative bodge

Change-Id: Iee72d75a5609aa6e1098723ff62928bd47b42072

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 305a5d4..635417b 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -739,6 +739,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs , 
std::vector & rDelt
 for (int n = i; n < nLastGlyph; n++)
 mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl ? 
-1 : 1);
 
+if (nBaseGlyph < 0)
+{
+SAL_WARN( "vcl.gdi", "Negative BaseGlyph" );
+continue;
+}
+
 rDeltaWidth[nBaseGlyph] = nDWidth;
 #ifdef GRLAYOUT_DEBUG
 fprintf(grLog(),"c%d=%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld @%d=%d\n", 
firstChar, lastChar, i, nLastGlyph, nNewClusterWidth, nOrigClusterWidth, 
nDWidth, nDGlyphOrigin, mvGlyphs[i].maLinearPos.X(), mvCharDxs[lastChar - 
mnMinCharPos], args.mpDXArray[lastChar - args.mnMinCharPos]);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2015-08-23 Thread Khaled Hosny
 vcl/source/gdi/salgdilayout.cxx   |4 ++-
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |   29 +++---
 2 files changed, 25 insertions(+), 8 deletions(-)

New commits:
commit e2582341af9f6b756e5d95c8ddd99652b62d1a41
Author: Khaled Hosny khaledho...@eglug.org
Date:   Mon Aug 17 04:00:49 2015 +0200

Fix GTK3 right-to-left rendering of spin buttons

The button were not drawn at all

Change-Id: I51dfa30a6daa1034b5e978b09bcdfcc83e859f3d
Reviewed-on: https://gerrit.libreoffice.org/17790
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 8ee0d0a..7344423 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -139,25 +139,40 @@ Rectangle GtkSalGraphics::NWGetSpinButtonRect( 
ControlPart nPart, Rectangle aAre
 buttonRect.SetSize(Size(buttonWidth, buttonHeight));
 buttonRect.setY(aAreaRect.Top());
 buttonRect.Bottom() = buttonRect.Top() + aAreaRect.GetHeight();
+Rectangle partRect(buttonRect);
 if ( nPart == PART_BUTTON_UP )
 {
-buttonRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - 
buttonRect.GetWidth()));
+if (AllSettings::GetLayoutRTL())
+partRect.setX(aAreaRect.Left());
+else
+partRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - 
buttonRect.GetWidth()));
 }
 else if( nPart == PART_BUTTON_DOWN )
 {
-buttonRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - 
2*buttonRect.GetWidth()));
+if (AllSettings::GetLayoutRTL())
+partRect.setX(aAreaRect.Left() + buttonRect.GetWidth());
+else
+partRect.setX(aAreaRect.Left() + (aAreaRect.GetWidth() - 2 * 
buttonRect.GetWidth()));
 }
 else
 {
-buttonRect.Right() = (aAreaRect.Left() + (aAreaRect.GetWidth() - 
2*buttonRect.GetWidth()))-1;
-buttonRect.Left()   = aAreaRect.Left();
-buttonRect.Top()= aAreaRect.Top();
-buttonRect.Bottom() = aAreaRect.Bottom();
+if (AllSettings::GetLayoutRTL())
+{
+partRect.Right() = aAreaRect.Left() + aAreaRect.GetWidth();
+partRect.Left()  = aAreaRect.Left() + (2 * buttonRect.GetWidth()) 
- 1;
+}
+else
+{
+partRect.Right() = (aAreaRect.Left() + (aAreaRect.GetWidth() - 2 * 
buttonRect.GetWidth())) - 1;
+partRect.Left()  = aAreaRect.Left();
+}
+partRect.Top()= aAreaRect.Top();
+partRect.Bottom() = aAreaRect.Bottom();
 }
 
 gtk_style_context_restore(mpSpinStyle);
 
-return buttonRect;
+return partRect;
 }
 
 Rectangle GtkSalGraphics::NWGetScrollButtonRect( ControlPart nPart, Rectangle 
aAreaRect )
commit fff3c9d6e56ae380437333f9c15ff63742904f25
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Aug 23 20:46:53 2015 +0100

don't mirror 0, RECT_EMPTY, 0, RECT_EMPTY rectangle

leave it untouched to make gtk3 rtl spin buttons possible
where the additional mirrorValue contains the region
of the spinbuttons to render within this rectangle

Change-Id: I2648d98ed36373c95947cc4d78e2e54797f01155
Reviewed-on: https://gerrit.libreoffice.org/17940
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 2771c9d6..df124a9 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -703,7 +703,9 @@ bool SalGraphics::DrawNativeControl( ControlType nType, 
ControlPart nPart, const
 if( (m_nLayout  SalLayoutFlags::BiDiRtl) || (pOutDev  
pOutDev-IsRTLEnabled()) )
 {
 Rectangle rgn( rControlRegion );
-mirror( rgn, pOutDev );
+Rectangle aNull;
+if (rgn != aNull)
+mirror(rgn, pOutDev);
 std::unique_ptr ImplControlValue  mirrorValue( aValue.clone());
 mirror( *mirrorValue, pOutDev );
 bool bRet = drawNativeControl( nType, nPart, rgn, nState, 
*mirrorValue, aCaption );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-08-03 Thread Miklos Vajna
 vcl/source/window/paint.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 27f6b2c038f5daf16a7fff4adf478b603eb08399
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Aug 3 10:58:58 2015 +0200

tdf#92982 vcl rendercontext: no need to call SetupBuffer() twice

No need to call it in PaintHelper::StartBufferedPaint(), which would
happen only for the root of the paint hierarchy. It's enough to do it in
PaintHelper::DoPaint(), which happens for each widget.

Change-Id: Iaf3306ef746bedbe64be36c4efeae73afd75db2a

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 724719d..b4965e5 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -124,8 +124,6 @@ void PaintHelper::StartBufferedPaint()
 pFrameData-mbInBufferedPaint = true;
 m_bStartedBufferedPaint = true;
 
-SetupBuffer();
-
 // Remember what was the map mode of m_aPaintRect.
 m_aPaintRectMapMode = m_pWindow-GetMapMode();
 
commit 8bb963c3e51725fba649a5db0f5deb8778f1232b
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Aug 3 10:02:44 2015 +0200

tdf#92982 vcl rendercontext: no buffer is created here

Change-Id: Iebcf9ec9f54102ca13dd36a3d3c2d2b6137dc0f0

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index b707a54..724719d 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -52,7 +52,7 @@ private:
 sal_uInt16 m_nPaintFlags;
 bool m_bPop : 1;
 bool m_bRestoreCursor : 1;
-bool m_bCreatedBuffer : 1; /// This PaintHelper created the buffer for 
the double-buffering, and should dispose it when being destructed (if it is 
still alive by then).
+bool m_bStartedBufferedPaint : 1; /// This PaintHelper started a buffered 
paint, and should paint it on the screen when being destructed.
 public:
 PaintHelper(vcl::Window* pWindow, sal_uInt16 nPaintFlags);
 void SetPop()
@@ -103,7 +103,7 @@ PaintHelper::PaintHelper(vcl::Window *pWindow, sal_uInt16 
nPaintFlags)
 , m_nPaintFlags(nPaintFlags)
 , m_bPop(false)
 , m_bRestoreCursor(false)
-, m_bCreatedBuffer(false)
+, m_bStartedBufferedPaint(false)
 {
 }
 
@@ -122,7 +122,7 @@ void PaintHelper::StartBufferedPaint()
 pFrameData-mpBuffer-Erase(m_aPaintRect);
 
 pFrameData-mbInBufferedPaint = true;
-m_bCreatedBuffer = true;
+m_bStartedBufferedPaint = true;
 
 SetupBuffer();
 
@@ -171,7 +171,7 @@ void PaintHelper::PaintBuffer()
 {
 ImplFrameData* pFrameData = m_pWindow-mpWindowImpl-mpFrameData;
 assert(pFrameData-mbInBufferedPaint);
-assert(m_bCreatedBuffer);
+assert(m_bStartedBufferedPaint);
 
 pFrameData-mpBuffer-mnOutOffX = 0;
 pFrameData-mpBuffer-mnOutOffY = 0;
@@ -524,7 +524,7 @@ PaintHelper::~PaintHelper()
 
 // double-buffering: paint in case we created the buffer, the children are
 // already painted inside
-if (m_bCreatedBuffer  pFrameData-mbInBufferedPaint)
+if (m_bStartedBufferedPaint  pFrameData-mbInBufferedPaint)
 {
 PaintBuffer();
 pFrameData-mbInBufferedPaint = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-07-02 Thread Caolán McNamara
 vcl/source/control/ilstbox.cxx |   10 ++
 vcl/source/fontsubset/sft.cxx  |3 +++
 2 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit c51d5706205cd0282c07d778ffac5f265c3eaf5f
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 2 16:21:26 2015 +0100

Resolves: tdf#92467 crashes with empty history list on pressing down

regression from some 16-32 bit listbox limit changing

Change-Id: I045eeef935afed4154fe11bfd11916c2d6a722e9

diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index a0ff872..fde4faa 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1613,8 +1613,9 @@ bool ImplListBoxWindow::ProcessKeyInput( const KeyEvent 
rKEvt )
 )
 {
 DBG_ASSERT( !mpEntryList-IsEntryPosSelected( nSelect ) || mbMulti, 
ImplListBox: Selecting same Entry );
-if( nSelect = mpEntryList-GetEntryCount() )
-nSelect = mpEntryList-GetEntryCount()-1;
+sal_Int32 nCount = mpEntryList-GetEntryCount();
+if (nSelect = nCount)
+nSelect = nCount ? nCount-1 : LISTBOX_ENTRY_NOTFOUND;
 bool bCurPosChange = (mnCurrentPos != nSelect);
 mnCurrentPos = nSelect;
 if(SelectEntries( nSelect, eLET, bShift, bCtrl, bCurPosChange))
@@ -1674,8 +1675,9 @@ void ImplListBoxWindow::SelectEntry( 
vcl::StringEntryIdentifier _entry )
 
 // normalize
 OSL_ENSURE( nSelect  mpEntryList-GetEntryCount(), 
ImplListBoxWindow::SelectEntry: how that? );
-if( nSelect = mpEntryList-GetEntryCount() )
-nSelect = mpEntryList-GetEntryCount()-1;
+sal_Int32 nCount = mpEntryList-GetEntryCount();
+if (nSelect = nCount)
+nSelect = nCount ? nCount-1 : LISTBOX_ENTRY_NOTFOUND;
 
 // make visible
 ShowProminentEntry( nSelect );
commit cd5fd80ebfa91e6546a10bc5e84f588ad8762add
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jul 2 14:34:36 2015 +0100

coverity#1213369 Untrusted value as argument

Change-Id: Ie929aee9c78a89d9ebed15cc59d33d7f2fdb3fad

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index ede244c..999a697 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1721,6 +1721,9 @@ static int doOpenTTFont( sal_uInt32 facenum, 
TrueTypeFont* t )
 for( i = 0; i = (int)t-nglyphs; ++i )
 t-goffsets[i] = indexfmt ? GetUInt32(table, i  2, 1) : 
(sal_uInt32)GetUInt16(table, i  1, 1)  1;
 } else if( getTable(t, O_CFF) ) {   /* PS-OpenType */
+int k = getTableSize(t, O_CFF); /* set a limit here, presumably much 
lower than the table size, but establishes some sort of physical bound */
+if( k  (int)t-nglyphs )
+t-nglyphs = k;
 t-goffsets = static_castsal_uInt32 *(calloc(1+t-nglyphs, 
sizeof(sal_uInt32)));
 /* TODO: implement to get subsetting */
 assert(t-goffsets != 0);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-06-15 Thread Stephan Bergmann
 vcl/source/outdev/map.cxx |   53 ++
 1 file changed, 26 insertions(+), 27 deletions(-)

New commits:
commit 0b255720a60f15ffe8006b37e367378b229e245f
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jun 15 10:12:19 2015 +0200

Fix indentation

Change-Id: I687f7020284d86a880a0a5db31658f01edf8e850

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 8255c2e..4f2863e 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -366,13 +366,13 @@ static long ImplLogicToPixel( long n, long nDPI, long 
nMapNum, long nMapDenom,
 #if (SAL_TYPES_SIZEOFLONG  8)
 if( (+n  nThres)  (-n  nThres) )
 {
-   n *= nMapNum * nDPI;
-   if( nMapDenom != 1 )
-   {
-  n = (2 * n) / nMapDenom;
-  if( n  0 ) --n; else ++n;
-  n /= 2;
-   }
+n *= nMapNum * nDPI;
+if( nMapDenom != 1 )
+{
+n = (2 * n) / nMapDenom;
+if( n  0 ) --n; else ++n;
+n /= 2;
+}
 }
 else
 #else
@@ -381,17 +381,17 @@ static long ImplLogicToPixel( long n, long nDPI, long 
nMapNum, long nMapDenom,
 assert(nMapNum == 0 || std::abs(n)  std::numeric_limitslong::max() / 
nMapNum / nDPI); //detect overflows
 #endif
 {
-   sal_Int64 n64 = n;
-   n64 *= nMapNum;
-   n64 *= nDPI;
-   if( nMapDenom == 1 )
-  n = (long)n64;
-   else
-   {
-  n = (long)(2 * n64 / nMapDenom);
-  if( n  0 ) --n; else ++n;
-  n /= 2;
-   }
+sal_Int64 n64 = n;
+n64 *= nMapNum;
+n64 *= nDPI;
+if( nMapDenom == 1 )
+n = (long)n64;
+else
+{
+n = (long)(2 * n64 / nMapDenom);
+if( n  0 ) --n; else ++n;
+n /= 2;
+}
 }
 return n;
 }
commit 1bd2fe8943a0235b20c6d6fba09ec0cf8b268066
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jun 15 10:01:59 2015 +0200

Minor clean up

Change-Id: I8e4d123626b5ef750c3b266d1aa1c96e1944b080

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 37db101..8255c2e 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -362,8 +362,7 @@ void OutputDevice::ImplInvalidateViewTransform()
 static long ImplLogicToPixel( long n, long nDPI, long nMapNum, long nMapDenom,
   long nThres )
 {
-// To use it...
-(void) nThres;
+assert(nDPI  0);
 #if (SAL_TYPES_SIZEOFLONG  8)
 if( (+n  nThres)  (-n  nThres) )
 {
@@ -377,8 +376,8 @@ static long ImplLogicToPixel( long n, long nDPI, long 
nMapNum, long nMapDenom,
 }
 else
 #else
+(void) nThres;
 assert(nMapNum = 0);
-assert(nDPI  0);
 assert(nMapNum == 0 || std::abs(n)  std::numeric_limitslong::max() / 
nMapNum / nDPI); //detect overflows
 #endif
 {
@@ -401,16 +400,16 @@ static long ImplPixelToLogic( long n, long nDPI, long 
nMapNum, long nMapDenom,
   long nThres )
 {
 assert(nDPI  0);
-// To use it...
-   (void) nThres;
-   if (nMapNum == 0)
-   {
-   return 0;
-   }
+if (nMapNum == 0)
+{
+return 0;
+}
 #if (SAL_TYPES_SIZEOFLONG  8)
 if( (+n  nThres)  (-n  nThres) )
 n = (2 * n * nMapDenom) / (nDPI * nMapNum);
 else
+#else
+(void) nThres;
 #endif
 {
 sal_Int64 n64 = n;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-05-25 Thread Caolán McNamara
 vcl/source/window/floatwin.cxx |4 
 vcl/source/window/winproc.cxx  |8 
 2 files changed, 12 deletions(-)

New commits:
commit c4bae028efbd32c8938c3a6051d58c1f202d5b8a
Author: Caolán McNamara caol...@redhat.com
Date:   Sat May 23 09:21:50 2015 +0100

Resolves: tdf#90155 don't hide+show window before initial show completes

Change-Id: I16f6fb4ef025f2e464ca581fc348e8dd18981285

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index f9abdf6..468d8cc 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -637,10 +637,6 @@ void FloatingWindow::SetTitleType( FloatWinTitleType 
nTitle )
 
 void FloatingWindow::StartPopupMode( const Rectangle rRect, 
FloatWinPopupFlags nFlags )
 {
-// avoid flickering
-if ( IsVisible() )
-Show( false, ShowFlags::NoFocusChange );
-
 if ( IsRollUp() )
 RollDown();
 
commit 768d445c1fd8a104a6c5e80ce93af99860ec6dc7
Author: Caolán McNamara caol...@redhat.com
Date:   Fri May 22 17:30:44 2015 +0100

gtk3: why close popups when losing focus

I don't see why we want to do this, and it causes trouble with the gtk3 
vclplug
and the undo popup and color popup where gtk is giving us a losing focus
signal even though those windows have the don't ask for input focus bit 
set.

Change-Id: I500ca253cc43c35dda55ee0301fdcaafbd212e2d

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index ff1252b..493147f 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1912,14 +1912,6 @@ static void ImplHandleLoseFocus( vcl::Window* pWindow )
 pSVData-maWinData.mpTrackWin-EndTracking( 
TrackingEventFlags::Cancel );
 }
 
-// here we always terminate the popupmode, also when NOFOCUSCLOSE
-// is set, such that we do not show windows during the switch
-if ( pSVData-maWinData.mpFirstFloat )
-{
-if ( !(pSVData-maWinData.mpFirstFloat-GetPopupModeFlags()  
FloatWinPopupFlags::NoAppFocusClose) )
-pSVData-maWinData.mpFirstFloat-EndPopupMode( 
FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll );
-}
-
 pWindow-ImplGetWindowImpl()-mpFrameData-mbHasFocus = false;
 
 // execute Focus-Events after a delay, such that SystemChildWindows
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2015-04-27 Thread Caolán McNamara
 vcl/source/window/winproc.cxx |   62 +++--
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |  119 --
 2 files changed, 108 insertions(+), 73 deletions(-)

New commits:
commit fc1605e4dc88b6c563dc0712954f58d8bb6979a7
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Apr 27 12:48:07 2015 +0100

don't dismiss floating windows on wheel, etc gestures outside area

so if you are not exactly over the active floating listbox menu
and use the scroll mouse then it still gets the scroll event
instead of popping down and delivering it to the underlying
window.

Change-Id: I6ab0b725af2a8adc712bfe4ec586dcd64a2efdd7

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 6cb1c90..139d771 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1376,17 +1376,6 @@ protected:
 
 public:
 
-struct WindowDescription
-{
-vcl::Window *m_pMouseWindow;
-bool m_bIsFloat;
-WindowDescription(vcl::Window *pMouseWindow, bool bIsFloat)
-: m_pMouseWindow(pMouseWindow)
-, m_bIsFloat(bIsFloat)
-{
-}
-};
-
 HandleGestureEventBase(vcl::Window *pWindow, const Point rMousePos)
 : m_pSVData(ImplGetSVData())
 , m_pWindow(pWindow)
@@ -1394,10 +1383,9 @@ public:
 {
 }
 bool Setup();
-WindowDescription FindTarget();
-vcl::Window *Dispatch(const WindowDescription rTarget);
+vcl::Window* FindTarget();
+vcl::Window* Dispatch(vcl::Window* pTarget);
 virtual bool CallCommand(vcl::Window *pWindow, const Point rMousePos) = 0;
-void Teardown(const WindowDescription rTarget);
 virtual ~HandleGestureEventBase() {}
 };
 
@@ -1414,10 +1402,9 @@ bool HandleGestureEventBase::Setup()
 return true;
 }
 
-HandleGestureEventBase::WindowDescription HandleGestureEventBase::FindTarget()
+vcl::Window* HandleGestureEventBase::FindTarget()
 {
 // first check any floating window ( eg. drop down listboxes)
-bool bIsFloat = false;
 vcl::Window *pMouseWindow = NULL;
 
 if (m_pSVData-maWinData.mpFirstFloat  
!m_pSVData-maWinData.mpCaptureWin 
@@ -1425,10 +1412,14 @@ HandleGestureEventBase::WindowDescription 
HandleGestureEventBase::FindTarget()
 {
 HitTest nHitTest = HITTEST_OUTSIDE;
 pMouseWindow = m_pSVData-maWinData.mpFirstFloat-ImplFloatHitTest( 
m_pWindow, m_aMousePos, nHitTest );
+if (!pMouseWindow)
+pMouseWindow = m_pSVData-maWinData.mpFirstFloat;
 }
 // then try the window directly beneath the mouse
 if( !pMouseWindow )
+{
 pMouseWindow = m_pWindow-ImplFindWindow( m_aMousePos );
+}
 else
 {
 // transform coordinates to float window frame coordinates
@@ -1437,7 +1428,6 @@ HandleGestureEventBase::WindowDescription 
HandleGestureEventBase::FindTarget()
   pMouseWindow-AbsoluteScreenToOutputPixel(
m_pWindow-OutputToAbsoluteScreenPixel(
 m_pWindow-ScreenToOutputPixel( m_aMousePos ) ) ) ) );
-bIsFloat = true;
 }
 
 while (acceptableWheelScrollTarget(pMouseWindow))
@@ -1448,13 +1438,11 @@ HandleGestureEventBase::WindowDescription 
HandleGestureEventBase::FindTarget()
 pMouseWindow = pMouseWindow-GetParent();
 }
 
-return WindowDescription(pMouseWindow, bIsFloat);
+return pMouseWindow;
 }
 
-vcl::Window *HandleGestureEventBase::Dispatch(const WindowDescription rTarget)
+vcl::Window *HandleGestureEventBase::Dispatch(vcl::Window* pMouseWindow)
 {
-vcl::Window *pMouseWindow = rTarget.m_pMouseWindow;
-
 vcl::Window *pDispatchedTo = NULL;
 
 if (acceptableWheelScrollTarget(pMouseWindow)  pMouseWindow-IsEnabled())
@@ -1493,23 +1481,6 @@ vcl::Window *HandleGestureEventBase::Dispatch(const 
WindowDescription rTarget)
 return pDispatchedTo;
 }
 
-void HandleGestureEventBase::Teardown(const WindowDescription rTarget)
-{
-// close floaters
-if (!rTarget.m_bIsFloat  m_pSVData-maWinData.mpFirstFloat)
-{
-FloatingWindow* pLastLevelFloat = 
m_pSVData-maWinData.mpFirstFloat-ImplFindLastLevelFloat();
-if( pLastLevelFloat )
-{
-sal_uLong nPopupFlags = pLastLevelFloat-GetPopupModeFlags();
-if ( nPopupFlags  FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE )
-{
-pLastLevelFloat-EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | 
FLOATWIN_POPUPMODEEND_CLOSEALL );
-}
-}
-}
-}
-
 class HandleWheelEvent : public HandleGestureEventBase
 {
 private:
@@ -1554,21 +1525,19 @@ bool HandleWheelEvent::HandleEvent(const 
SalWheelMouseEvent rEvt)
 if (!Setup())
 return false;
 
-WindowDescription aTarget = FindTarget();
+vcl::Window *pMouseWindow = FindTarget();
 
 // avoid the problem that scrolling via wheel to this point brings a widget
 // under the mouse that also accepts wheel commands, so stick with the 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-03-26 Thread Caolán McNamara
 vcl/source/control/ilstbox.cxx |4 ---
 vcl/source/window/menu.cxx |7 ++
 vcl/source/window/winproc.cxx  |   47 ++---
 3 files changed, 25 insertions(+), 33 deletions(-)

New commits:
commit 4f9e20c46b616c7c51bae74bfefd5247f922b2a6
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Mar 26 16:07:26 2015 +

Resolves: fdo#84795 Menus don't disappear with right mouse click

Change-Id: I95ae2e2d564ec1c45de6df5158e4dec1d93053cb

diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 74969b8..0121b61 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -3075,9 +3075,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool 
bStartTracking )
 pGrandparentOutDev-ReMirror( aRect );
 
 // mouse-button right: close the List-Box-Float-win and don't stop the 
handling fdo#84795
-const sal_uLong nFlags = FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | 
FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
-
-StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | nFlags );
+StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | 
FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE );
 
 if( nPos != LISTBOX_ENTRY_NOTFOUND )
 mpImplLB-ShowProminentEntry( nPos );
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index c7cfb4bae..2890efb 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2871,9 +2871,9 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const 
Rectangle rRect, sal_
 if (bRealExecute)
 nPopupModeFlags |= FLOATWIN_POPUPMODE_NEWLEVEL;
 if (!pStartedFrom || !pStartedFrom-IsMenuBar())
-nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | 
FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
+nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK;
 
-nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE;
+nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE | 
FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
 
 // could be useful during debugging.
 // nPopupModeFlags |= FLOATWIN_POPUPMODE_NOFOCUSCLOSE;
commit 473eae3a7d43ca13ef14eca844b991ffd143e3a0
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Mar 26 15:28:57 2015 +

Revert fdo#84795 Menu, DropDown-List don't disappear with right mouse 
click

This reverts commit fa022a9c4fe74f3f67fb3c35ef49022842d7499b.

because if a right-click context menu is active and we click outside it in
order to remove it then that click goes to whatever is underneath the mouse
which is undesirable

the list dropdown part of this looks good, its the general menus that are 
the problem

Conflicts:
vcl/source/window/winproc.cxx

Change-Id: Ib96e52f22cdeefd59dbf4333f555d9f52b3385e2

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8cdcd0f..c7cfb4bae 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2870,9 +2870,8 @@ sal_uInt16 PopupMenu::ImplExecute( vcl::Window* pW, const 
Rectangle rRect, sal_
 WinBits nStyle = WB_BORDER;
 if (bRealExecute)
 nPopupModeFlags |= FLOATWIN_POPUPMODE_NEWLEVEL;
-
-// mouse-button right: close the sub-menu (float-win) and don't stop the 
handling fdo#84795
-nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | 
FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
+if (!pStartedFrom || !pStartedFrom-IsMenuBar())
+nPopupModeFlags |= FLOATWIN_POPUPMODE_PATHMOUSECANCELCLICK | 
FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE;
 
 nPopupModeFlags |= FLOATWIN_POPUPMODE_NOKEYCLOSE;
 
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 5f1ebc3..83dc516 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -60,9 +60,7 @@ bool ImplCallPreNotify( NotifyEvent rEvt )
 || rEvt.GetWindow()-PreNotify( rEvt );
 }
 
-
-enum ENUM_IHMFM {IHMFM_FALSE = 0, IHMFM_TRUE = 1, IHMFM_FLOAT = 2};
-static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* pChild, const Point 
rMousePos,
+static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point 
rMousePos,
   sal_uInt16 nCode, MouseNotifyEvent 
nSVEvent,
   bool bMouseLeave )
 {
@@ -82,14 +80,14 @@ static sal_uInt16 ImplHandleMouseFloatMode( vcl::Window* 
pChild, const Point rM
 if ( nSVEvent == MouseNotifyEvent::MOUSEMOVE )
 {
 if ( bMouseLeave )
-return IHMFM_TRUE;
+return true;
 
 if ( !pFloat || (nHitTest == HITTEST_RECT) )
 {
 if ( pSVData-maHelpData.mpHelpWin  
!pSVData-maHelpData.mbKeyboardHelp )
 ImplDestroyHelpWindow( true );
 pChild-ImplGetFrame()-SetPointer( POINTER_ARROW );
-return IHMFM_TRUE;
+return true;
 }
 }
 else
@@ 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-03-11 Thread Tor Lillqvist
 vcl/source/gdi/pdfwriter_impl.cxx |   25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

New commits:
commit 33434f47ac44f5cb4612a11b1c28c4582976cb25
Author: Tor Lillqvist t...@collabora.com
Date:   Thu Mar 12 00:31:18 2015 +0200

Fix crash when timestamping PDF signature

Using the NSS API for CMS and ASN.1-based stuff in general correctly is
extremely hard. It is very easy to do things slightly wrong. Of course no
compiler warnings are produced. You just get code that happens to work by
accident when compiled with one compiler, but not another, or depending on
contents of uninitialised memory, or the phase of the moon.

The problem was that the values field of a NSSCMSAttribute struct 
apparently
is supposed to point to *two* SECItem pointers, one pointing to the actual
value, and a NULL one.

Anyway, now valgrind finally does not complain about any use of 
uninitialised
memory.

Most likely my earlier recent commits to this file were not necessary after
all. They just seemed to help by accident, at least at one stage. But
whatever...

Change-Id: Ic98401b5d151bbb2398f809f47699f670e9720fa

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index bc29a4e..fc44073 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6893,7 +6893,9 @@ bool PDFWriterImpl::finalizeSignature()
 SECItem response_item;
 NSSCMSAttribute timestamp;
 SECItem values[2];
-SECItem *valuesp = values;
+SECItem *valuesp[2];
+valuesp[0] = values;
+valuesp[1] = NULL;
 SECOidData typetag;
 
 if( !m_aContext.SignTSA.isEmpty() )
@@ -7149,12 +7151,15 @@ bool PDFWriterImpl::finalizeSignature()
 
 // timestamp.type filled in below
 
+// Not sure if we actually need two entries in the values array, now 
when valuesp is an
+// array too, the pointer to the values array followed by a null 
pointer. But I don't feel
+// like experimenting.
 values[0] = response.timeStampToken;
 values[1].type = siBuffer;
 values[1].data = NULL;
 values[1].len = 0;
 
-timestamp.values = valuesp;
+timestamp.values = valuesp;
 
 typetag.oid.data = NULL;
 // id-aa-timeStampToken OBJECT IDENTIFIER ::= { iso(1)
commit 20e5de21225bfd2b55fcff6afcc235b035b38134
Author: Tor Lillqvist t...@collabora.com
Date:   Wed Mar 11 22:31:47 2015 +0200

Don't bother with macros that are dummy on Unix in Unix-only code

In NSS's secasn1t.h, for non-Windows:

 #define SEC_ASN1_SUB(x)x
 #define SEC_ASN1_XTRN  0
 #define SEC_ASN1_MKSUB(x)

Change-Id: Ie42d881cebffdd060309d6a15d8d9c319c260699

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index df2e74e..bc29a4e 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6299,16 +6299,10 @@ TimeStampResp ::= SEQUENCE  {
  timeStampToken TimeStampToken OPTIONAL  }
 */
 
-SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
-SEC_ASN1_MKSUB(MessageImprint_Template)
-SEC_ASN1_MKSUB(Extensions_Template)
-SEC_ASN1_MKSUB(PKIStatusInfo_Template)
-SEC_ASN1_MKSUB(Any_Template)
-
 const SEC_ASN1Template MessageImprint_Template[] =
 {
 { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(MessageImprint) },
-{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(MessageImprint, 
hashAlgorithm), SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate), 0 },
+{ SEC_ASN1_INLINE, offsetof(MessageImprint, hashAlgorithm), 
SECOID_AlgorithmIDTemplate, 0 },
 { SEC_ASN1_OCTET_STRING, offsetof(MessageImprint, hashedMessage), 0, 0 },
 { 0, 0, 0, 0 }
 };
@@ -6331,11 +6325,11 @@ const SEC_ASN1Template TimeStampReq_Template[] =
 {
 { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(TimeStampReq) },
 { SEC_ASN1_INTEGER, offsetof(TimeStampReq, version), 0, 0 },
-{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(TimeStampReq, messageImprint), 
SEC_ASN1_SUB(MessageImprint_Template), 0 },
+{ SEC_ASN1_INLINE, offsetof(TimeStampReq, messageImprint), 
MessageImprint_Template, 0 },
 { SEC_ASN1_OBJECT_ID | SEC_ASN1_OPTIONAL, offsetof(TimeStampReq, 
reqPolicy), 0, 0 },
 { SEC_ASN1_INTEGER | SEC_ASN1_OPTIONAL, offsetof(TimeStampReq, nonce), 0, 
0 },
 { SEC_ASN1_BOOLEAN | SEC_ASN1_OPTIONAL, offsetof(TimeStampReq, certReq), 
0, 0 },
-{ SEC_ASN1_XTRN | SEC_ASN1_OPTIONAL | SEC_ASN1_CONTEXT_SPECIFIC | 0, 
offsetof(TimeStampReq, extensions), SEC_ASN1_SUB(Extensions_Template), 0 },
+{ SEC_ASN1_OPTIONAL | SEC_ASN1_CONTEXT_SPECIFIC | 0, 
offsetof(TimeStampReq, extensions), Extensions_Template, 0 },
 { 0, 0, 0, 0 }
 };
 
@@ -6367,8 +6361,8 @@ typedef struct {
 const SEC_ASN1Template TimeStampResp_Template[] =
 {
 { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(TimeStampResp) },
-{ SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(TimeStampResp, status), 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-02-25 Thread Tor Lillqvist
 vcl/source/gdi/pdfwriter_impl.cxx |  291 --
 1 file changed, 219 insertions(+), 72 deletions(-)

New commits:
commit 86796f127b15fd33374f2a18344dc944b7b8314d
Author: Tor Lillqvist t...@collabora.com
Date:   Wed Feb 25 22:39:27 2015 +0200

tdf#84881: Try to fix The signature includes an embedded timestamp but ...

... it could not be verified

I got some insight reading this question and reply on stackoverflow:

http://stackoverflow.com/questions/18761993/steps-to-include-timestamp-in-pdf-signature

I had been doing the timestamping wrong in the same way: I had timestamped 
the
hash of the PDF document, not of the signature. That is wrong. If you think
hard, it is obvious: It is the (rest of the) signature that needs an
authenticated timestamp, not the PDF document contents. After all, if the
document contents is timestamped, but not the signature, that doesn't 
prevent
tampering with the signature after the timestamping. When you timestamp the
signature, that proves the date of the signature. (And the signature proves
the authenticity of the document contents.)

So I had to re-engineer the code a bit. I create two originally identical 
NSS
CMS messages with signatures, encode one signature into DER, take the hash 
of
the signature, get a timestamp from the TSA for that hash. Then I add that
timestamp to the other CMS message as an unsigned attribute of its 
signature,
sign it, encode it, convert to hex, and store it the document.

(I first tried to use just one CMS message, but NSS stopped with an 
assertion
when I tried to encode the signature of the same message a second time, 
after
adding the timestamp attribute to the signature. Go figure.)

(I did verify the the encoded signatures, taken from what should be 
identical
but separate CMS messages, was in fact identical. So I am fairly sure the 
idea
described above is sound.)

But, it doesn't help. Adobe Reader still complains The signature includes 
an
embedded timestamp but it could not be verified.

Change-Id: I4e4cd0443005e82f597586942badc7145ef64160

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 4e712a1..b300bc6 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6231,6 +6231,31 @@ RevocationInfoChoice ::= CHOICE {
 
 RevocationInfoChoices ::= SET OF RevocationInfoChoice
 
+SignerIdentifier ::= CHOICE {
+issuerAndSerialNumber IssuerAndSerialNumber,
+subjectKeyIdentifier [0] SubjectKeyIdentifier }
+
+AttributeValue ::= ANY
+
+Attribute ::= SEQUENCE {
+attrType OBJECT IDENTIFIER,
+attrValues SET OF AttributeValue }
+
+SignedAttributes ::= SET SIZE (1..MAX) OF Attribute
+
+SignatureValue ::= OCTET STRING
+
+UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute
+
+SignerInfo ::= SEQUENCE {
+version CMSVersion,
+sid SignerIdentifier,
+digestAlgorithm DigestAlgorithmIdentifier,
+signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
+signatureAlgorithm SignatureAlgorithmIdentifier,
+signature SignatureValue,
+unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
+
 SignerInfos ::= SET OF SignerInfo
 
 SignedData ::= SEQUENCE {
@@ -6625,7 +6650,8 @@ my_NSS_CMSSignerInfo_AddUnauthAttr(NSSCMSSignerInfo 
*signerinfo, NSSCMSAttribute
 return my_NSS_CMSAttributeArray_AddAttr(signerinfo-cmsg-poolp, 
(signerinfo-unAuthAttr), attr);
 }
 
-NSSCMSMessage *CreateCMSMessage(NSSCMSSignedData **cms_sd,
+NSSCMSMessage *CreateCMSMessage(PRTime time,
+NSSCMSSignedData **cms_sd,
 NSSCMSSignerInfo **cms_signer,
 CERTCertificate *cert,
 SECItem *digest)
@@ -6674,7 +6700,7 @@ NSSCMSMessage *CreateCMSMessage(NSSCMSSignedData **cms_sd,
 return NULL;
 }
 
-if (NSS_CMSSignerInfo_AddSigningTime(*cms_signer, PR_Now()) != SECSuccess)
+if (NSS_CMSSignerInfo_AddSigningTime(*cms_signer, time) != SECSuccess)
 {
 SAL_WARN(vcl.pdfwriter, NSS_CMSSignerInfo_AddSigningTime failed);
 NSS_CMSSignedData_Destroy(*cms_sd);
@@ -6835,20 +6861,93 @@ bool PDFWriterImpl::finalizeSignature()
 HASH_End(hc.get(), digest.data, digest.len, SHA1_LENGTH);
 hc.clear();
 
+#ifdef DBG_UTIL
+{
+FILE *out = fopen(PDFWRITER.hash.data, wb);
+fwrite(hash, SHA1_LENGTH, 1, out);
+fclose(out);
+}
+#endif
+
+PRTime now = PR_Now();
 NSSCMSSignedData *cms_sd;
 NSSCMSSignerInfo *cms_signer;
-NSSCMSMessage *cms_msg = CreateCMSMessage(cms_sd, cms_signer, cert, 
digest);
+NSSCMSMessage *cms_msg = CreateCMSMessage(now, cms_sd, cms_signer, cert, 
digest);
 if (!cms_msg)
 return false;
 
+char *pass(strdup(OUStringToOString( m_aContext.SignPassword, 
RTL_TEXTENCODING_UTF8 ).getStr()));
+
   

[Libreoffice-commits] core.git: 2 commits - vcl/source

2015-02-19 Thread Tor Lillqvist
 vcl/source/gdi/pdfwriter_impl.cxx |  350 +-
 1 file changed, 305 insertions(+), 45 deletions(-)

New commits:
commit 3cc45e97dd9189b4c76747fce8925bfe48fac70a
Author: Tor Lillqvist t...@collabora.com
Date:   Fri Feb 20 02:01:09 2015 +0200

tdf#84881: Work in progress: Decode the TimeStampResp

OMG, it is really horrible to use the NSS SEC_ASN1DecodeItem() API. Figuring
out how to set up the SEC_ASN1Template data structure for decoding
TimeStampResp was much harder than setting up the template for encoding a
TimeStampReq. Luckily I don't actually need to look into the timeStampToken,
but can copy that as such into the CMS as an unsigned attribute.

I'll cheerfully ignore for now RFC3161's requirements on how the TSA client
should check the validity of the response. Let's leave that up to the PDF
viewing (and validating) application.

Also improve the SAL_INFO logging, use a timeout for the curl operation, add
more ASN.1 in comments for information, etc.

Still to do: Actually add the TimeStampResp to the NSSCMSSignerInfo.

Change-Id: Id4f800e2cf12a01106b326a31c34eb99f2aa724e

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index b3ef313..f95bf02 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6042,6 +6042,9 @@ public:
 HASHContext *get() { return mpPtr; }
 };
 
+// ASN.1 used in the (much simpler) time stamp request. From RFC3161
+// and other sources.
+
 /*
 AlgorithmIdentifier  ::=  SEQUENCE  {
  algorithm  OBJECT IDENTIFIER,
@@ -6078,19 +6081,6 @@ Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
 */
 
 /*
-Accuracy ::= SEQUENCE {
-seconds INTEGER  OPTIONAL,
-millis  [0] INTEGER (1..999) OPTIONAL,
-micros  [1] INTEGER (1..999) OPTIONAL  }
-*/
-
-typedef struct {
-SECItem seconds;
-SECItem millis;
-SECItem micros;
-} Accuracy;
-
-/*
 TSAPolicyId ::= OBJECT IDENTIFIER
 
 TimeStampReq ::= SEQUENCE  {
@@ -6103,6 +6093,7 @@ TimeStampReq ::= SEQUENCE  {
 certReqBOOLEAN DEFAULT FALSE,
 extensions [0] IMPLICIT Extensions OPTIONAL  }
 */
+
 typedef struct {
 SECItem version;
 MessageImprint messageImprint;
@@ -6112,9 +6103,167 @@ typedef struct {
 Extension *extensions;
 } TimeStampReq;
 
+// (Partial) ASN.1 for the time stamp responce. Very complicated. Pulled
+// together from varuous RFCs.
+
+/*
+Accuracy ::= SEQUENCE {
+seconds INTEGER  OPTIONAL,
+millis  [0] INTEGER (1..999) OPTIONAL,
+micros  [1] INTEGER (1..999) OPTIONAL  }
+
+PKIStatus ::= INTEGER {
+granted(0),
+-- when the PKIStatus contains the value zero a TimeStampToken, as 
requested, is present.
+grantedWithMods(1),
+ -- when the PKIStatus contains the value one a TimeStampToken, with 
modifications, is present.
+rejection  (2),
+waiting(3),
+revocationWarning  (4),
+ -- this message contains a warning that a revocation is
+ -- imminent
+revocationNotification (5)
+ -- notification that a revocation has occurred
+}
+
+PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
+-- text encoded as UTF-8 String [RFC3629] (note: each
+-- UTF8String MAY include an [RFC3066] language tag
+-- to indicate the language of the contained text
+-- see [RFC2482] for details)
+
+PKIFailureInfo ::= BIT STRING {
+badAlg   (0),
+  -- unrecognized or unsupported Algorithm Identifier
+badRequest   (2),
+  -- transaction not permitted or supported
+badDataFormat(5),
+  -- the data submitted has the wrong format
+timeNotAvailable(14),
+  -- the TSA's time source is not available
+unacceptedPolicy(15),
+  -- the requested TSA policy is not supported by the TSA.
+unacceptedExtension (16),
+  -- the requested extension is not supported by the TSA.
+addInfoNotAvailable (17),
+  -- the additional information requested could not be understood
+  -- or is not available
+systemFailure   (25)
+  -- the request cannot be handled due to system failure
+}
+
+PKIStatusInfo ::= SEQUENCE {
+status   PKIStatus,
+statusString PKIFreeTextOPTIONAL,
+failInfo PKIFailureInfo OPTIONAL  }
+
+ContentType ::= OBJECT IDENTIFIER
+
+ContentInfo ::= SEQUENCE {
+contentType ContentType,
+content [0] EXPLICIT ANY DEFINED BY contentType }
+
+CMSVersion ::= INTEGER { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) }
+
+DigestAlgorithmIdentifier ::= AlgorithmIdentifier
+
+DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
+
+ContentType ::= OBJECT IDENTIFIER
+
+EncapsulatedContentInfo ::= SEQUENCE {
+eContentType ContentType,
+eContent [0] EXPLICIT OCTET STRING OPTIONAL }
+
+OtherCertificateFormat ::= SEQUENCE {
+

[Libreoffice-commits] core.git: 2 commits - vcl/source vcl/unx

2015-01-25 Thread Caolán McNamara
 vcl/source/filter/wmf/winwmf.cxx |5 +
 vcl/unx/generic/gdi/gdiimpl.cxx  |2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 2b95714814b60a3d703525a7a5df453e5b87988c
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Jan 25 15:04:48 2015 +

coverity#982431 Division or modulo by float zero

and

coverity#982432 Division or modulo by float zero

Change-Id: I1b9036d85c4b31b8136a96d330d95d7b024530aa

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index aef13a1..3c8ed8b 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -250,6 +250,11 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 {
 short nXNum = 0, nXDenom = 0, nYNum = 0, nYDenom = 0;
 pWMF-ReadInt16( nYDenom ).ReadInt16( nYNum ).ReadInt16( nXDenom 
).ReadInt16( nXNum );
+if (!nYDenom || !nXDenom)
+{
+pWMF-SetError( SVSTREAM_FILEFORMAT_ERROR );
+break;
+}
 pOut-ScaleDevExt( (double)nXNum / nXDenom, (double)nYNum / 
nYDenom );
 }
 break;
commit e3c70196e7f640cfde360b9832e91bec4eb7ab26
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Jan 25 14:44:20 2015 +

coverity#1266437 Unintended comparison to logical negation

Change-Id: Ia4fc4ccbdfe3586afc78a16378ef0b3859308d64

diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 7eddf05..17a9a10 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -1230,7 +1230,7 @@ void X11SalGraphicsImpl::SetROPFillColor( SalROPColor 
nROPColor )
 
 void X11SalGraphicsImpl::SetXORMode( bool bSet, bool )
 {
-if( !mbXORMode == bSet )
+if (mbXORMode != bSet)
 {
 mbXORMode   = bSet;
 mbPenGC = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2014-12-10 Thread Tor Lillqvist
 vcl/source/gdi/pdfwriter_impl.cxx |  140 ++
 1 file changed, 37 insertions(+), 103 deletions(-)

New commits:
commit 6e91763769a562b2a4c2a94b1367c6ed4866
Author: Tor Lillqvist t...@collabora.com
Date:   Thu Dec 11 02:11:35 2014 +0200

fdo#87030: Generate a proper PKCS#7 signature

The signature should be in DER-encoded PKCS#7 format and what 
CryptSignHash()
produces is nothing like that. Luckily CryptSignMessage() is actually almost
easier to use and is capable of doing what we need. This also means that we
won't need any HCRYPTPROV or HCRYPTHASH after all so all the code related to
that can be removed. CryptSignMessage() handles both calculating the hash 
and
signing it.

One less than ideal issue with CryptSignMessage() is that it needs all the
data to be hashed and signed at the same time, so we need to keep both 
buffers
around for signing.

It also turns out that we don't need to look up the certificate anew from 
the
user's certificate store after all.

Now Adobe Reader doesn't complain any longer about the signature's format 
and
contents.

Change-Id: I25cfb93b516ffa723c6228d068d9ffa8e7cc4790

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index fe260d7..457af31 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6025,144 +6025,6 @@ OUString WindowsError(DWORD nErrorCode)
 return result;
 }
 
-#if SAL_LOG_INFO
-
-OUString CertificatePropertyName(int nId)
-{
-switch (nId)
-{
-case CERT_ACCESS_STATE_PROP_ID: return OUString(ACCESS_STATE);
-case CERT_AIA_URL_RETRIEVED_PROP_ID: return OUString(AIA_URL_RETRIEVED);
-case CERT_ARCHIVED_KEY_HASH_PROP_ID: return OUString(ARCHIVED_KEY_HASH);
-case CERT_ARCHIVED_PROP_ID: return OUString(ARCHIVED);
-case CERT_AUTHORITY_INFO_ACCESS_PROP_ID: return 
OUString(AUTHORITY_INFO_ACCESS);
-case CERT_AUTH_ROOT_SHA256_HASH_PROP_ID: return 
OUString(AUTH_ROOT_SHA256_HASH);
-case CERT_AUTO_ENROLL_PROP_ID: return OUString(AUTO_ENROLL);
-case CERT_AUTO_ENROLL_RETRY_PROP_ID: return OUString(AUTO_ENROLL_RETRY);
-case CERT_BACKED_UP_PROP_ID: return OUString(BACKED_UP);
-case CERT_CA_DISABLE_CRL_PROP_ID: return OUString(CA_DISABLE_CRL);
-case CERT_CA_OCSP_AUTHORITY_INFO_ACCESS_PROP_ID: return 
OUString(CA_OCSP_AUTHORITY_INFO_ACCESS);
-case CERT_CEP_PROP_ID: return OUString(CEP);
-case CERT_CROSS_CERT_DIST_POINTS_PROP_ID: return 
OUString(CROSS_CERT_DIST_POINTS);
-case CERT_CTL_USAGE_PROP_ID: return OUString(CTL_USAGE);
-case CERT_DATE_STAMP_PROP_ID: return OUString(DATE_STAMP);
-case CERT_DESCRIPTION_PROP_ID: return OUString(DESCRIPTION);
-case CERT_DISALLOWED_FILETIME_PROP_ID: return 
OUString(DISALLOWED_FILETIME);
-case CERT_EFS_PROP_ID: return OUString(EFS);
-case CERT_ENROLLMENT_PROP_ID: return OUString(ENROLLMENT);
-case CERT_EXTENDED_ERROR_INFO_PROP_ID: return 
OUString(EXTENDED_ERROR_INFO);
-case CERT_FORTEZZA_DATA_PROP_ID: return OUString(FORTEZZA_DATA);
-case CERT_FRIENDLY_NAME_PROP_ID: return OUString(FRIENDLY_NAME);
-case CERT_HASH_PROP_ID: return OUString(HASH);
-case CERT_HCRYPTPROV_OR_NCRYPT_KEY_HANDLE_PROP_ID: return 
OUString(HCRYPTPROV_OR_NCRYPT_KEY_HANDLE);
-case CERT_HCRYPTPROV_TRANSFER_PROP_ID: return 
OUString(HCRYPTPROV_TRANSFER);
-case CERT_IE30_RESERVED_PROP_ID: return OUString(IE30_RESERVED);
-case CERT_ISSUER_CHAIN_PUB_KEY_CNG_ALG_BIT_LENGTH_PROP_ID: return 
OUString(ISSUER_CHAIN_PUB_KEY_CNG_ALG_BIT_LENGTH);
-case CERT_ISSUER_CHAIN_SIGN_HASH_CNG_ALG_PROP_ID: return 
OUString(ISSUER_CHAIN_SIGN_HASH_CNG_ALG);
-case CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID: return 
OUString(ISSUER_PUBLIC_KEY_MD5_HASH);
-case CERT_ISSUER_PUB_KEY_BIT_LENGTH_PROP_ID: return 
OUString(ISSUER_PUB_KEY_BIT_LENGTH);
-case CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: return 
OUString(ISSUER_SERIAL_NUMBER_MD5_HASH);
-case CERT_KEY_CONTEXT_PROP_ID: return OUString(KEY_CONTEXT);
-case CERT_KEY_IDENTIFIER_PROP_ID: return OUString(KEY_IDENTIFIER);
-case CERT_KEY_PROV_HANDLE_PROP_ID: return OUString(KEY_PROV_HANDLE);
-case CERT_KEY_PROV_INFO_PROP_ID: return OUString(KEY_PROV_INFO);
-case CERT_KEY_REPAIR_ATTEMPTED_PROP_ID: return 
OUString(KEY_REPAIR_ATTEMPTED);
-case CERT_KEY_SPEC_PROP_ID: return OUString(KEY_SPEC);
-case CERT_MD5_HASH_PROP_ID: return OUString(MD5_HASH);
-case CERT_NCRYPT_KEY_HANDLE_PROP_ID: return OUString(NCRYPT_KEY_HANDLE);
-case CERT_NCRYPT_KEY_HANDLE_TRANSFER_PROP_ID: return 
OUString(NCRYPT_KEY_HANDLE_TRANSFER);
-case CERT_NEW_KEY_PROP_ID: return OUString(NEW_KEY);
-case CERT_NEXT_UPDATE_LOCATION_PROP_ID: return 
OUString(NEXT_UPDATE_LOCATION);
-case CERT_NO_AUTO_EXPIRE_CHECK_PROP_ID: return 
OUString(NO_AUTO_EXPIRE_CHECK);
-case CERT_NO_EXPIRE_NOTIFICATION_PROP_ID: return 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2014-11-26 Thread Michael Stahl
 vcl/source/opengl/OpenGLContext.cxx |   20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 406883895bee90358f7840bde569abf885ca2712
Author: Michael Stahl mst...@redhat.com
Date:   Wed Nov 26 15:59:28 2014 +0100

vcl: prefix global variable g_vShareList

Change-Id: I13ecc76d8bd75ee65e626670995d7c93efc953ca

diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index 534ce88..fb0e4ed 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -33,9 +33,9 @@ using namespace com::sun::star;
 
 // TODO use rtl::Static instead of 'static'
 #if defined( UNX )  !defined MACOSX  !defined IOS  !defined ANDROID
-static std::vectorGLXContext vShareList;
+static std::vectorGLXContext g_vShareList;
 #elif defined(WNT)
-static std::vectorHGLRC vShareList;
+static std::vectorHGLRC g_vShareList;
 #endif
 
 GLWindow::~GLWindow()
@@ -77,7 +77,7 @@ OpenGLContext::~OpenGLContext()
 #if defined( WNT )
 if (m_aGLWin.hRC)
 {
-vShareList.erase(std::remove(vShareList.begin(), vShareList.end(), 
m_aGLWin.hRC), vShareList.end());
+g_vShareList.erase(std::remove(g_vShareList.begin(), 
g_vShareList.end(), m_aGLWin.hRC), g_vShareList.end());
 
 wglMakeCurrent( m_aGLWin.hDC, 0 );
 wglDeleteContext( m_aGLWin.hRC );
@@ -90,7 +90,7 @@ OpenGLContext::~OpenGLContext()
 #elif defined( UNX )
 if(m_aGLWin.ctx)
 {
-vShareList.erase(std::remove( vShareList.begin(), vShareList.end(), 
m_aGLWin.ctx), vShareList.end());
+g_vShareList.erase(std::remove( g_vShareList.begin(), 
g_vShareList.end(), m_aGLWin.ctx), g_vShareList.end());
 
 glXMakeCurrent(m_aGLWin.dpy, None, NULL);
 if( glGetError() != GL_NO_ERROR )
@@ -696,8 +696,8 @@ bool OpenGLContext::ImplInit()
 
 SAL_INFO(vcl.opengl, OpenGLContext::ImplInitstart);
 
-if( !vShareList.empty() )
-pSharedCtx = vShareList.front();
+if (!g_vShareList.empty())
+pSharedCtx = g_vShareList.front();
 
 #ifdef DBG_UTIL
 if (!mbPixmap  glXCreateContextAttribsARB  !mbRequestLegacyContext)
@@ -737,7 +737,7 @@ bool OpenGLContext::ImplInit()
 
 if( m_aGLWin.ctx )
 {
-vShareList.push_back( m_aGLWin.ctx );
+g_vShareList.push_back( m_aGLWin.ctx );
 }
 else
 {
@@ -903,8 +903,8 @@ bool OpenGLContext::ImplInit()
 return false;
 
 HGLRC hSharedCtx = 0;
-if (!vShareList.empty())
-hSharedCtx = vShareList.front();
+if (!g_vShareList.empty())
+hSharedCtx = g_vShareList.front();
 
 // now setup the shared context; this needs a temporary context already
 // set up in order to work
@@ -926,7 +926,7 @@ bool OpenGLContext::ImplInit()
 return false;
 }
 
-vShareList.push_back(m_aGLWin.hRC);
+g_vShareList.push_back(m_aGLWin.hRC);
 
 RECT clientRect;
 GetClientRect(WindowFromDC(m_aGLWin.hDC), clientRect);
commit bfaf877421bff1db74d1ba84a039075baf9d5800
Author: Michael Stahl mst...@redhat.com
Date:   Wed Nov 26 15:58:02 2014 +0100

vcl: fix STL asserts in ~OpenGLContext(), calling wrong erase() overload

Change-Id: Ia830ac1e70f74859dff871f24538af3f2f83fd9d

diff --git a/vcl/source/opengl/OpenGLContext.cxx 
b/vcl/source/opengl/OpenGLContext.cxx
index a93185f..534ce88 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -77,7 +77,7 @@ OpenGLContext::~OpenGLContext()
 #if defined( WNT )
 if (m_aGLWin.hRC)
 {
-vShareList.erase(std::remove(vShareList.begin(), vShareList.end(), 
m_aGLWin.hRC));
+vShareList.erase(std::remove(vShareList.begin(), vShareList.end(), 
m_aGLWin.hRC), vShareList.end());
 
 wglMakeCurrent( m_aGLWin.hDC, 0 );
 wglDeleteContext( m_aGLWin.hRC );
@@ -90,7 +90,7 @@ OpenGLContext::~OpenGLContext()
 #elif defined( UNX )
 if(m_aGLWin.ctx)
 {
-vShareList.erase(std::remove( vShareList.begin(), vShareList.end(), 
m_aGLWin.ctx ));
+vShareList.erase(std::remove( vShareList.begin(), vShareList.end(), 
m_aGLWin.ctx), vShareList.end());
 
 glXMakeCurrent(m_aGLWin.dpy, None, NULL);
 if( glGetError() != GL_NO_ERROR )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2014-11-17 Thread David Tardon
 vcl/source/fontsubset/sft.cxx |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 06efeee90c6347c4f136fe057188ac04f40a0bb9
Author: David Tardon dtar...@redhat.com
Date:   Fri Nov 14 13:17:07 2014 +0100

use already existing variable

Change-Id: I3f2781e2a041845e732046ea591a15c9bb21f1a5

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 13da74b..b694520f5 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1096,7 +1096,7 @@ static sal_uInt32 getGlyph2(const sal_uInt8 *cmap, const 
sal_uInt32 nMaxCmapSize
 sal_uInt16* const pGlyph = ((subHeader2s[0].idRangeOffset))
  + (Int16FromMOTA(subHeader2s[0].idRangeOffset)/2) 
/* + offset*/
  + theLowByte  
/* + to_look   */
- - Int16FromMOTA(subHeader2s[0].firstCode)
+ - firstCode
  ;
 if (reinterpret_castsal_uInt8*(pGlyph) - cmap  
int(nMaxCmapSize) - 4)
 return *pGlyph;
commit e164eb5c85547a49c0bcbdbdf1b1cdc9726f3133
Author: David Tardon dtar...@redhat.com
Date:   Fri Nov 14 13:16:40 2014 +0100

coverity#1251174 untrusted pointer read

Change-Id: I894fc64d6ae6881347bd1379d2934654536a01cf

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index b512b12..13da74b 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1093,11 +1093,15 @@ static sal_uInt32 getGlyph2(const sal_uInt8 *cmap, 
const sal_uInt32 nMaxCmapSize
 if(k == 0) {
 firstCode = Int16FromMOTA(subHeader2s[k].firstCode);
 if(theLowByte = firstCode  theLowByte  (firstCode + 
Int16FromMOTA(subHeader2s[k].entryCount))) {
-return *(((subHeader2s[0].idRangeOffset))
+sal_uInt16* const pGlyph = ((subHeader2s[0].idRangeOffset))
  + (Int16FromMOTA(subHeader2s[0].idRangeOffset)/2) 
/* + offset*/
  + theLowByte  
/* + to_look   */
  - Int16FromMOTA(subHeader2s[0].firstCode)
- );
+ ;
+if (reinterpret_castsal_uInt8*(pGlyph) - cmap  
int(nMaxCmapSize) - 4)
+return *pGlyph;
+else
+return MISSING_GLYPH_INDEX;
 } else {
 return MISSING_GLYPH_INDEX;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2014-11-17 Thread Chris Sherlock
 vcl/source/gdi/animate.cxx  |   26 +-
 vcl/source/gdi/impanmvw.cxx |   27 +++
 vcl/source/gdi/impanmvw.hxx |   34 +-
 3 files changed, 41 insertions(+), 46 deletions(-)

New commits:
commit cc02d84421182c70f1efbb24d1bda749b1f5e422
Author: Chris Sherlock chris.sherloc...@gmail.com
Date:   Tue Nov 18 12:02:10 2014 +1100

vcl: rename ImplAnimView functions to more readable names

Change-Id: I47e888bcd08cadcbbd3788b264a478c56af4d063

diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 7288847..c6f2438 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -250,12 +250,12 @@ bool Animation::Start( OutputDevice* pOut, const Point 
rDestPt, const Size rDe
 for( size_t i = 0; i  maViewList.size(); ++i )
 {
 pView = maViewList[ i ];
-if( pView-ImplMatches( pOut, nExtraData ) )
+if( pView-matches( pOut, nExtraData ) )
 {
-if( pView-ImplGetOutPos() == rDestPt 
-pView-ImplGetOutSizePix() == pOut-LogicToPixel( 
rDestSz ) )
+if( pView-getOutPos() == rDestPt 
+pView-getOutSizePix() == pOut-LogicToPixel( rDestSz 
) )
 {
-pView-ImplRepaint();
+pView-repaint();
 pMatch = pView;
 }
 else
@@ -300,7 +300,7 @@ void Animation::Stop( OutputDevice* pOut, long nExtraData )
 {
 
 ImplAnimView* pView = maViewList[ i ];
-if( pView-ImplMatches( pOut, nExtraData ) )
+if( pView-matches( pOut, nExtraData ) )
 {
 delete pView;
 maViewList.erase( maViewList.begin() + i );
@@ -369,7 +369,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl)
 
 // create AInfo-List
 for( size_t i = 0, n = maViewList.size(); i  n; ++i )
-aAInfoList.push_back( maViewList[ i ]-ImplCreateAInfo() );
+aAInfoList.push_back( maViewList[ i ]-createAInfo() );
 
 maNotifyLink.Call( this );
 
@@ -387,8 +387,8 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl)
 else
 pView = (ImplAnimView*) pAInfo-pViewData;
 
-pView-ImplPause( pAInfo-bPause );
-pView-ImplSetMarked( true );
+pView-pause( pAInfo-bPause );
+pView-setMarked( true );
 }
 
 // delete AInfo structures
@@ -400,17 +400,17 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl)
 for( size_t i = 0; i  maViewList.size(); )
 {
 pView = maViewList[ i ];
-if( !pView-ImplIsMarked() )
+if( !pView-isMarked() )
 {
 delete pView;
 maViewList.erase( maViewList.begin() + i );
 }
 else
 {
-if( !pView-ImplIsPause() )
+if( !pView-isPause() )
 bGlobalPause = false;
 
-pView-ImplSetMarked( false );
+pView-setMarked( false );
 i++;
 }
 }
@@ -453,9 +453,9 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl)
 for( size_t i = 0; i  maViewList.size(); )
 {
 pView = maViewList[ i ];
-pView-ImplDraw( mnPos );
+pView-draw( mnPos );
 
-if( pView-ImplIsMarked() )
+if( pView-isMarked() )
 {
 delete pView;
 maViewList.erase( maViewList.begin() + i );
diff --git a/vcl/source/gdi/impanmvw.cxx b/vcl/source/gdi/impanmvw.cxx
index 293b148..6fac2e8 100644
--- a/vcl/source/gdi/impanmvw.cxx
+++ b/vcl/source/gdi/impanmvw.cxx
@@ -85,7 +85,7 @@ ImplAnimView::ImplAnimView( Animation* pParent, OutputDevice* 
pOut,
 mpBackground-DrawOutDev( Point(), maSzPix, maDispPt, maDispSz, *mpOut 
);
 
 // Initialize drawing to actual position
-ImplDrawToPos( mpParent-ImplGetCurPos() );
+drawToPos( mpParent-ImplGetCurPos() );
 
 // If first frame OutputDevice is set, update variables now for real 
OutputDevice
 if( pFirstFrameOutDev )
@@ -100,7 +100,7 @@ ImplAnimView::~ImplAnimView()
 Animation::ImplDecAnimCount();
 }
 
-bool ImplAnimView::ImplMatches( OutputDevice* pOut, long nExtraData ) const
+bool ImplAnimView::matches( OutputDevice* pOut, long nExtraData ) const
 {
 bool bRet = false;
 
@@ -115,7 +115,7 @@ bool ImplAnimView::ImplMatches( OutputDevice* pOut, long 
nExtraData ) const
 return bRet;
 }
 
-void ImplAnimView::ImplGetPosSize( const AnimationBitmap rAnm, Point 
rPosPix, Size rSizePix )
+void ImplAnimView::getPosSize( const AnimationBitmap rAnm, Point rPosPix, 
Size rSizePix )
 {
 

[Libreoffice-commits] core.git: 2 commits - vcl/source

2014-10-17 Thread David Tardon
 vcl/source/control/combobox.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 991fb393678f8b7893c9e3c74ecd1401417067cb
Author: David Tardon dtar...@redhat.com
Date:   Fri Oct 17 14:05:03 2014 +0200

coverity#735653 avoid division by 0

Change-Id: Ie3ec074292467f096e69142dc599b0e29e1e7f7b

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index df914a5..d03b321 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1191,7 +1191,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point 
rPos, const Size rSize, s
 
 Rectangle aClip( aPos, aSize );
 pDev-IntersectClipRegion( aClip );
-sal_uInt16 nLines = (sal_uInt16) ( (aSize.Height()-nEditHeight) / 
nTextHeight );
+sal_uInt16 nLines = (sal_uInt16) ( ( nTextHeight  0 ) ? ( 
(aSize.Height()-nEditHeight) / nTextHeight ) : 1 );
 if ( !nLines )
 nLines = 1;
 sal_uInt16 nTEntry = IsReallyVisible() ? mpImplLB-GetTopEntry() : 0;
commit 3dcbcd120c2b42e291f6ec65db7b824cf7acd4f7
Author: David Tardon dtar...@redhat.com
Date:   Fri Oct 17 14:02:36 2014 +0200

coverity#735654 avoid division by 0

Change-Id: If368d300c5ed880e1359cbc67df0e13b00fc6ecf

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 857e389..df914a5 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1114,7 +1114,7 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16 
rnCols, sal_uInt16 rnLines
 else
 {
 Size aOutSz = mpSubEdit-GetOutputSizePixel();
-rnCols = (sal_uInt16)(aOutSz.Width()/nCharWidth);
+rnCols = (nCharWidth  0) ? (sal_uInt16)(aOutSz.Width()/nCharWidth) : 
1;
 rnLines = 1;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2014-08-17 Thread Caolán McNamara
 vcl/source/filter/igif/decode.cxx |   24 ++--
 vcl/source/filter/igif/decode.hxx |2 +-
 2 files changed, 19 insertions(+), 7 deletions(-)

New commits:
commit 43b39d3e47ffd179071732c0a8fc201c31b2bb46
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Aug 17 16:21:31 2014 +0100

check that AddToTable can be done validly

Change-Id: I0ee69279e3bb1d9871feba17b908b8307f0ec5b4

diff --git a/vcl/source/filter/igif/decode.cxx 
b/vcl/source/filter/igif/decode.cxx
index 3a00834..d50ac7c 100644
--- a/vcl/source/filter/igif/decode.cxx
+++ b/vcl/source/filter/igif/decode.cxx
@@ -107,7 +107,7 @@ HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, 
sal_uInt8 cBufSize,
 return pTarget;
 }
 
-void GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 
nCodeFirstData )
+bool GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 
nCodeFirstData )
 {
 GIFLZWTableEntry* pE;
 
@@ -116,12 +116,16 @@ void GIFLZWDecompressor::AddToTable( sal_uInt16 
nPrevCode, sal_uInt16 nCodeFirst
 pE = pTable + nTableSize;
 pE-pPrev = pTable + nPrevCode;
 pE-pFirst = pE-pPrev-pFirst;
-pE-nData = pTable[ nCodeFirstData ].pFirst-nData;
+GIFLZWTableEntry *pEntry = pTable[nCodeFirstData].pFirst;
+if (!pEntry)
+return false;
+pE-nData = pEntry-nData;
 nTableSize++;
 
 if ( ( nTableSize == (sal_uInt16) (1  nCodeSize) )  ( nTableSize  
4096 ) )
 nCodeSize++;
 }
+return true;
 }
 
 bool GIFLZWDecompressor::ProcessOneCode()
@@ -153,17 +157,23 @@ bool GIFLZWDecompressor::ProcessOneCode()
 
 if ( nCode  nClearCode )
 {
+bool bOk = true;
 if ( nOldCode != 0x )
-AddToTable( nOldCode, nCode );
+bOk = AddToTable(nOldCode, nCode);
+if (!bOk)
+return false;
 }
 else if ( ( nCode  nEOICode )  ( nCode = nTableSize ) )
 {
 if ( nOldCode != 0x )
 {
+bool bOk;
 if ( nCode == nTableSize )
-AddToTable( nOldCode, nOldCode );
+bOk = AddToTable( nOldCode, nOldCode );
 else
-AddToTable( nOldCode, nCode );
+bOk = AddToTable( nOldCode, nCode );
+if (!bOk)
+return false;
 }
 }
 else
diff --git a/vcl/source/filter/igif/decode.hxx 
b/vcl/source/filter/igif/decode.hxx
index 5425326..ee093bf 100644
--- a/vcl/source/filter/igif/decode.hxx
+++ b/vcl/source/filter/igif/decode.hxx
@@ -43,7 +43,7 @@ class GIFLZWDecompressor
 sal_uInt8   nBlockBufSize;
 sal_uInt8   nBlockBufPos;
 
-voidAddToTable(sal_uInt16 nPrevCode, sal_uInt16 
nCodeFirstData);
+boolAddToTable(sal_uInt16 nPrevCode, sal_uInt16 
nCodeFirstData);
 boolProcessOneCode();
 
 public:
commit b9623def050f8276d2d4160c01198fba201011fa
Author: Caolán McNamara caol...@redhat.com
Date:   Sun Aug 17 16:14:16 2014 +0100

blank out the remainder of the buffer

Change-Id: I33b6c2ab1068b7138ce99239f56552529d5206f5

diff --git a/vcl/source/filter/igif/decode.cxx 
b/vcl/source/filter/igif/decode.cxx
index 85b417c..3a00834 100644
--- a/vcl/source/filter/igif/decode.cxx
+++ b/vcl/source/filter/igif/decode.cxx
@@ -47,12 +47,14 @@ GIFLZWDecompressor::GIFLZWDecompressor(sal_uInt8 cDataSize)
 
 pTable = new GIFLZWTableEntry[ 4098 ];
 
-for( sal_uInt16 i = 0; i  nTableSize; i++ )
+for (sal_uInt16 i = 0; i  nTableSize; ++i)
 {
 pTable[i].pPrev = NULL;
 pTable[i].pFirst = pTable + i;
 pTable[i].nData = (sal_uInt8) i;
 }
+
+memset(pTable + nTableSize, 0, sizeof(GIFLZWTableEntry) * (4098 - 
nTableSize));
 }
 
 GIFLZWDecompressor::~GIFLZWDecompressor()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - vcl/source

2014-05-11 Thread Jan Holesovsky
 vcl/source/outdev/font.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 07e7e545960b688dcc63c55a6465c95307f19136
Author: Jan Holesovsky ke...@collabora.com
Date:   Mon May 12 00:30:12 2014 +0200

coverity#1209003: Unchecked return value

Just silence coverity, the code is OK.

Change-Id: I0968800d67ab53cbbc942fa495d08adc4e94de0d

diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 7a34317..541df8ef 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -292,8 +292,11 @@ SystemFontData OutputDevice::GetSysFontData(int 
nFallbacklevel) const
 SystemFontData aSysFontData;
 aSysFontData.nSize = sizeof(aSysFontData);
 
-if (!mpGraphics) AcquireGraphics();
-if (mpGraphics) aSysFontData = mpGraphics-GetSysFontData(nFallbacklevel);
+if (!mpGraphics)
+(void) AcquireGraphics();
+
+if (mpGraphics)
+aSysFontData = mpGraphics-GetSysFontData(nFallbacklevel);
 
 return aSysFontData;
 }
commit 11eb3330ea72d994ab2b901a45a3417432364972
Author: Jan Holesovsky ke...@collabora.com
Date:   Mon May 12 00:23:32 2014 +0200

fdo#78567: Revert coverity#1209003: Unchecked return value

This reverts commit 24ec38a96fa33b75435786caaca04f9cef86c289.

The commit has unfortunately caused a regression, reverting it.

Change-Id: If3098d4fce05b3bf95e3ffe021ff4f35e1cc42fc

diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 78f8204..7a34317 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -292,11 +292,8 @@ SystemFontData OutputDevice::GetSysFontData(int 
nFallbacklevel) const
 SystemFontData aSysFontData;
 aSysFontData.nSize = sizeof(aSysFontData);
 
-if (!mpGraphics)
-{
-if (AcquireGraphics())
-aSysFontData = mpGraphics-GetSysFontData(nFallbacklevel);
-}
+if (!mpGraphics) AcquireGraphics();
+if (mpGraphics) aSysFontData = mpGraphics-GetSysFontData(nFallbacklevel);
 
 return aSysFontData;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   >