[Libreoffice-commits] .: vcl/source

2012-04-23 Thread Caolán McNamara
 vcl/source/gdi/pngread.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7f5be85719985ce54ff65b88aaa420ed5b2e7a9b
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Apr 23 20:35:40 2012 +0100

cut out negative widths/heights early

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 81b9280..a7cf7ec 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -472,7 +472,7 @@ sal_Bool PNGReaderImpl::ImplReadHeader( const Size 
rPreviewSizeHint )
 maOrigSize.Width()  = ImplReadsal_uInt32();
 maOrigSize.Height() = ImplReadsal_uInt32();
 
-if ( !maOrigSize.Width() || !maOrigSize.Height() )
+if (maOrigSize.Width() = 0 || maOrigSize.Height() = 0)
 return sal_False;
 
 mnPngDepth = *(maDataIter++);
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-04-03 Thread Lubos Lunak
 vcl/source/control/edit.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 248edba9de6c25a37f014316a89e38e788a1ac09
Author: Luboš Luňák l.lu...@suse.cz
Date:   Tue Apr 3 13:51:18 2012 +0200

adjust code for what the original Intersect() usage probably meant

Daniel Bankston is right, the call probably meant to check whether
the intersection is not empty, as an optimization.

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index b3f7516..aaa72bb 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -671,7 +671,7 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, 
bool bLayout )
 }
 i = nIndex;
aClip.Intersect(aRegion);
-if( nAttr )
+if( !aClip.IsEmpty()  nAttr )
 {
 Font aFont = GetFont();
 if ( nAttr  EXTTEXTINPUT_ATTR_UNDERLINE )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-03-29 Thread Muthu Subramanian
 vcl/source/gdi/outdev2.cxx |   68 ++---
 1 file changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 27d9df17c13b22aed7d9194d9dfcf7980b632b3c
Author: Muthu Subramanian sumu...@suse.com
Date:   Thu Mar 29 16:08:56 2012 +0530

n714787: Duplicate code removal.

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index b8c144e..d0f727e 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1582,6 +1582,36 @@ namespace
   (int)nDstAlpha*nDestColor*nSourceAlpha/255 ) / 
(int)nResAlpha : 0;
 return sal_uInt8( c );
 }
+
+inline BitmapColor lcl_AlphaBlend( int nX,   int nY,
+   const longnMapX,
+   const longnMapY,
+   BitmapReadAccess* pP,
+   BitmapReadAccess* pA,
+   BitmapReadAccess* pB,
+   BitmapWriteAccess*pAlphaW,
+   sal_uInt8nResAlpha )
+{
+BitmapColor aDstCol,aSrcCol;
+aSrcCol = pP-GetColor( nMapY, nMapX );
+aDstCol = pB-GetColor( nY, nX );
+
+// vcl stores transparency, not alpha - invert it
+const sal_uInt8 nSrcAlpha = 255 - pA-GetPixel( nMapY, nMapX 
).GetBlueOrIndex();
+const sal_uInt8 nDstAlpha = 255 - pAlphaW-GetPixel( nY, nX 
).GetBlueOrIndex();
+
+// Perform porter-duff compositing 'over' operation
+//
+// Co = Cs + Cd*(1-As)
+// Ad = As + Ad*(1-As)
+nResAlpha = (int)nSrcAlpha + (int)nDstAlpha - (int)nDstAlpha*nSrcAlpha/255;
+
+aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcAlpha, nDstAlpha, 
nResAlpha, aDstCol.GetRed() ) );
+aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), nSrcAlpha, nDstAlpha, 
nResAlpha, aDstCol.GetBlue() ) );
+aDstCol.SetGreen( lcl_calcColor( aSrcCol.GetGreen(), nSrcAlpha, nDstAlpha, 
nResAlpha, aDstCol.GetGreen() ) );
+
+return aDstCol;
+}
 }
 
 // 
@@ -1597,9 +1627,10 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap  
aBmp,
  const long* pMapX,
  const long* pMapY )
 {
-BitmapColor aDstCol,aSrcCol;
+BitmapColor aDstCol;
 Bitmap  res;
 int nX, nY;
+sal_uInt8   nResAlpha;
 
 OSL_ENSURE(mpAlphaVDev,
ImplBlendWithAlpha(): call me only with valid alpha VDev! );
@@ -1632,22 +1663,7 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap  
aBmp,
 const long  nMapX = pMapX[ nX ];
 const sal_uLong nD = nVCLDitherLut[ nModY | ( nOutX  
0x0FL ) ];
 
-aSrcCol = pP-GetColor( nMapY, nMapX );
-aDstCol = pB-GetColor( nY, nX );
-
-// vcl stores transparency, not alpha - invert it
-const sal_uInt8 nSrcAlpha = 255 - pA-GetPixel( nMapY, 
nMapX ).GetBlueOrIndex();
-const sal_uInt8 nDstAlpha = 255 - pAlphaW-GetPixel( nY, 
nX ).GetBlueOrIndex();
-
-// Perform porter-duff compositing 'over' operation
-//
-// Co = Cs + Cd*(1-As)
-// Ad = As + Ad*(1-As)
-const sal_uInt8 nResAlpha = (int)nSrcAlpha + 
(int)nDstAlpha - (int)nDstAlpha*nSrcAlpha/255;
-
-aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), 
nSrcAlpha, nDstAlpha, nResAlpha, aDstCol.GetRed() ) );
-aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), 
nSrcAlpha, nDstAlpha, nResAlpha, aDstCol.GetBlue() ) );
-aDstCol.SetGreen( lcl_calcColor( aSrcCol.GetGreen(), 
nSrcAlpha, nDstAlpha, nResAlpha, aDstCol.GetGreen() ) );
+aDstCol = lcl_AlphaBlend( nX, nY, nMapX, nMapY, pP, pA, 
pB, pAlphaW, nResAlpha );
 
 aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ 
aDstCol.GetRed() ] + nD )  16UL ] +
   nVCLGLut[ ( nVCLLut[ 
aDstCol.GetGreen() ] + nD )  16UL ] +
@@ -1678,23 +1694,7 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap  
aBmp,
 for( nX = 0; nX  nDstWidth; nX++ )
 {
 const long nMapX = pMapX[ nX ];
-
-aSrcCol = pP-GetColor( nMapY, nMapX );
-aDstCol = pB-GetColor( nY, nX );
-
-// vcl stores transparency, not alpha - invert it
-const sal_uInt8 nSrcAlpha = 255 - pA-GetPixel( nMapY, 
nMapX ).GetBlueOrIndex();
-const sal_uInt8 nDstAlpha = 255 - pAlphaW-GetPixel( nY, 
nX ).GetBlueOrIndex();
-
-// Perform porter-duff compositing 'over' operation
-//
- 

[Libreoffice-commits] .: vcl/source

2012-03-27 Thread Noel Power
 vcl/source/window/toolbox.cxx |   14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 5ae64e4b0c23f209410fe84df041c9445234df74
Author: Noel Power noel.po...@novell.com
Date:   Tue Mar 27 12:32:05 2012 +0100

fix vertical align when switching mode in multibar fdo#44140

switching between SumAssign  OkCancel mode in the multibar results in a 
slight 'jumping' of the toolbar items when end up out of allignment with the 
other toolbar items.

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 4dc2458..7b317a1 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2722,7 +2722,19 @@ void ToolBox::ImplFormat( sal_Bool bResize )
 // if special TBX_LAYOUT_LOCKVERT lock vertical 
position
 // don't recalulate the vertical position of the item
 if ( meLayoutMode == TBX_LAYOUT_LOCKVERT  mnLines == 
1 )
-it-maCalcRect.Top()  =  it-maRect.Top();
+{
+// Somewhat of a hack here, calc deletes and 
re-adds
+// the sum/assign  ok/cancel items dynamically.
+// Because TBX_LAYOUT_LOCKVERT effectively prevents
+// recalculation of the vertical pos of an item the
+// it-maRect.Top() for those newly added items is
+// 0. The hack here is that we want to effectively
+// recalculate the vertical pos for those added
+// items here. ( Note: assume mnMaxItemHeight is
+// equal to the LineSize when multibar has a single
+// line size )
+it-maCalcRect.Top()  =  it-maRect.Top() ? 
it-maRect.Top() : ( nY + ( mnMaxItemHeight-aCurrentItemSize.Height())/2 );
+}
 else
 it-maCalcRect.Top()  = 
nY+(nLineSize-aCurrentItemSize.Height())/2;
 it-maCalcRect.Right()= 
nX+aCurrentItemSize.Width()-1;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-03-26 Thread Thorsten Behrens
 vcl/source/gdi/outdev2.cxx |   66 -
 1 file changed, 36 insertions(+), 30 deletions(-)

New commits:
commit 06c16e1e26a0137a0048085cdf1c7758d3ac96cd
Author: Thorsten Behrens tbehr...@suse.com
Date:   Tue Mar 27 02:54:42 2012 +0200

Fix vcl alpha blending n#714787

The way alpha compositing took place in vcl's alpha vdev was subtly
wrong - it was supposed to implement porter-duff 'over', but didn't.
This is now fixed also for cases where the source surface contains
alpha, and needs to blend correctly into fully-transparent
background.

For reference: http://en.wikipedia.org/wiki/Alpha_compositing

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 11a9c1e..b8c144e 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -1573,11 +1573,14 @@ void OutputDevice::DrawPixel( const Polygon rPts, 
const Color rColor )
 
 namespace
 {
-sal_uInt8 lcl_calcColor( const sal_uInt8 nSourceColor, const sal_uInt8 
nSourceOpaq, const sal_uInt8 nDestColor )
+// Co = Cs + Cd*(1-As) premultiplied alpha -or-
+// Co = (AsCs + AdCd*(1-As)) / Ao
+inline sal_uInt8 lcl_calcColor( const sal_uInt8 nSourceColor, const 
sal_uInt8 nSourceAlpha,
+const sal_uInt8 nDstAlpha, const sal_uInt8 
nResAlpha, const sal_uInt8 nDestColor )
 {
-int c = ( (int)nDestColor * ( 255 - nSourceOpaq ) )
-+ (int)nSourceOpaq * (int)nSourceColor;
-return sal_uInt8( c / 255 );
+int c = nResAlpha ? ( (int)nSourceAlpha*nSourceColor + 
(int)nDstAlpha*nDestColor -
+  (int)nDstAlpha*nDestColor*nSourceAlpha/255 ) / 
(int)nResAlpha : 0;
+return sal_uInt8( c );
 }
 }
 
@@ -1631,27 +1634,29 @@ Bitmap OutputDevice::ImplBlendWithAlpha( Bitmap 
 aBmp,
 
 aSrcCol = pP-GetColor( nMapY, nMapX );
 aDstCol = pB-GetColor( nY, nX );
-const sal_uInt8 nSrcOpaq = 255 - pA-GetPixel( nMapY, 
nMapX ).GetBlueOrIndex();
-const sal_uInt8 nDstOpaq  = 255 - pAlphaW-GetPixel( nY, 
nX ).GetBlueOrIndex();
 
-aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), nSrcOpaq, 
aDstCol.GetRed() ) );
-aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), 
nSrcOpaq, aDstCol.GetBlue() ) );
-aDstCol.SetGreen( lcl_calcColor( aSrcCol.GetGreen(), 
nSrcOpaq, aDstCol.GetGreen() ) );
+// vcl stores transparency, not alpha - invert it
+const sal_uInt8 nSrcAlpha = 255 - pA-GetPixel( nMapY, 
nMapX ).GetBlueOrIndex();
+const sal_uInt8 nDstAlpha = 255 - pAlphaW-GetPixel( nY, 
nX ).GetBlueOrIndex();
+
+// Perform porter-duff compositing 'over' operation
+//
+// Co = Cs + Cd*(1-As)
+// Ad = As + Ad*(1-As)
+const sal_uInt8 nResAlpha = (int)nSrcAlpha + 
(int)nDstAlpha - (int)nDstAlpha*nSrcAlpha/255;
+
+aDstCol.SetRed( lcl_calcColor( aSrcCol.GetRed(), 
nSrcAlpha, nDstAlpha, nResAlpha, aDstCol.GetRed() ) );
+aDstCol.SetBlue( lcl_calcColor( aSrcCol.GetBlue(), 
nSrcAlpha, nDstAlpha, nResAlpha, aDstCol.GetBlue() ) );
+aDstCol.SetGreen( lcl_calcColor( aSrcCol.GetGreen(), 
nSrcAlpha, nDstAlpha, nResAlpha, aDstCol.GetGreen() ) );
 
 aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ 
aDstCol.GetRed() ] + nD )  16UL ] +
   nVCLGLut[ ( nVCLLut[ 
aDstCol.GetGreen() ] + nD )  16UL ] +
   nVCLBLut[ ( nVCLLut[ 
aDstCol.GetBlue() ] + nD )  16UL ] ) );
 pW-SetPixel( nY, nX, aIndex );
 
-// Have to perform the compositing 'algebra' in
-// the inverse alpha space (with 255 meaning
-// opaque), otherwise, transitivity is not
-// achieved.
-const sal_uInt8 nSrcAlpha = 255-COLOR_CHANNEL_MERGE( 255, 
(sal_uInt8)nDstOpaq, nSrcOpaq );
-
-aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ 
nSrcAlpha ] + nD )  16UL ] +
-  nVCLGLut[ ( nVCLLut[ nSrcAlpha ] 
+ nD )  16UL ] +
-  nVCLBLut[ ( nVCLLut[ nSrcAlpha ] 
+ nD )  16UL ] ) );
+aIndex.SetIndex( (sal_uInt8) ( nVCLRLut[ ( nVCLLut[ 
255-nResAlpha ] + nD )  16UL ] +
+   nVCLGLut[ ( nVCLLut[ 
255-nResAlpha ] + nD )  16UL ] +
+   nVCLBLut[ ( nVCLLut[ 
255-nResAlpha ] + nD )  16UL ] ) );
 pAlphaW-SetPixel( nY, nX, aIndex );
 }
 }
@@ -1676,22 +1681,23 @@ Bitmap OutputDevice::ImplBlendWithAlpha( 

[Libreoffice-commits] .: vcl/source

2012-03-20 Thread Petr Mladek
 vcl/source/glyphs/graphite_layout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3a878d3dbfdb11cf2f0cce9dbf28a408c130d556
Author: Petr Mladek pmla...@suse.cz
Date:   Tue Mar 20 11:35:13 2012 +0100

vcl: better check in GraphiteLayout::expandOrCondense:

Improves the commit d066f7e4afb3c9e395932ba7bf8715ad0770bcdd that
fixed crash when printing the bugdoc from i#103958

diff --git a/vcl/source/glyphs/graphite_layout.cxx 
b/vcl/source/glyphs/graphite_layout.cxx
index 1ec9650..93c1bc5 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -847,7 +847,7 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs rArgs)
 assert(nCharIndex  -1);
 mvCharDxs[nCharIndex-mnMinCharPos] += nOffset;
 // adjust char dxs for rest of characters in cluster
-while (++nCharIndex  
static_castint(mvChar2BaseGlyph.size()))
+while (++nCharIndex - mnMinCharPos  
static_castint(mvChar2BaseGlyph.size()))
 {
 int nChar2Base = 
mvChar2BaseGlyph[nCharIndex-mnMinCharPos];
 if (nChar2Base == -1 || nChar2Base == 
static_castint(i))
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-03-15 Thread David Tardon
 vcl/source/gdi/print3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 504aead0573befc744a00b8b1d68e3ebbaca8c47
Author: David Tardon dtar...@redhat.com
Date:   Thu Mar 15 14:15:09 2012 +0100

Revert fix setting of paper tray from print dialog (fdo#43932)

This reverts commit 6d4cca9c22c52b5a7742adc47ebf1a2930e29764.

diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 817e6d5..4824203 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -773,7 +773,7 @@ PrinterController::PageSize 
vcl::ImplPrinterControllerData::modifyJobSetup( cons
 PrinterController::PageSize aPageSize;
 aPageSize.aSize = mpPrinter-GetPaperSize();
 awt::Size aSetSize, aIsSize;
-sal_Int32 nPaperBin = (mnFixedPaperBin != -1) ? mnFixedPaperBin : 
mnDefaultPaperBin;
+sal_Int32 nPaperBin = mnDefaultPaperBin;
 for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); 
nProperty  nPropertyCount; ++nProperty )
 {
 if( i_rProps[ nProperty ].Name.equalsAsciiL( 
RTL_CONSTASCII_STRINGPARAM( PreferredPageSize ) ) )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-03-14 Thread David Tardon
 vcl/source/gdi/print3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6d4cca9c22c52b5a7742adc47ebf1a2930e29764
Author: David Tardon dtar...@redhat.com
Date:   Wed Mar 14 13:58:37 2012 +0100

fix setting of paper tray from print dialog (fdo#43932)

This fixes the simple case when all pages are to be printed from the
same paper tray. The use of this setting is still confusing when there
is application-set tray for a page (e.g., for a page style in Writer,
through Format-Page), because the change in Preferences is applied (and
will be used for pages without application-set tray), but Preferences
shows the application-set value on second try again...

IOW, it still s---s, but it s---s a bit less .-)

diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 4824203..817e6d5 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -773,7 +773,7 @@ PrinterController::PageSize 
vcl::ImplPrinterControllerData::modifyJobSetup( cons
 PrinterController::PageSize aPageSize;
 aPageSize.aSize = mpPrinter-GetPaperSize();
 awt::Size aSetSize, aIsSize;
-sal_Int32 nPaperBin = mnDefaultPaperBin;
+sal_Int32 nPaperBin = (mnFixedPaperBin != -1) ? mnFixedPaperBin : 
mnDefaultPaperBin;
 for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); 
nProperty  nPropertyCount; ++nProperty )
 {
 if( i_rProps[ nProperty ].Name.equalsAsciiL( 
RTL_CONSTASCII_STRINGPARAM( PreferredPageSize ) ) )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-03-05 Thread Norbert Thiebaud
 vcl/source/gdi/sallayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cecbf715396b5297a99d72e36526de5c24b927b4
Author: Norbert Thiebaud nthieb...@gmail.com
Date:   Mon Mar 5 04:08:28 2012 -0600

iterator are not ordered

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 781cb03..f7c2f15 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -841,7 +841,7 @@ bool GenericSalLayout::GetCharWidths( sal_Int32* 
pCharWidths ) const
 // calculate right x-position for this glyph cluster
 // break if no more glyphs in layout
 // break at next glyph cluster start
-while( (pG+1  end)  !pG[1].IsClusterStart() )
+while( (pG+1 != end)  !pG[1].IsClusterStart() )
 {
 // advance to next glyph in cluster
 ++pG;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-03-04 Thread Norbert Thiebaud
 vcl/source/gdi/sallayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 330461ffa3871e125bce16e0c26f45b034289d8f
Author: Norbert Thiebaud nthieb...@gmail.com
Date:   Sun Mar 4 21:36:15 2012 -0600

iterator end should be tested with != not 

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 3ca646d..781cb03 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -863,7 +863,7 @@ bool GenericSalLayout::GetCharWidths( sal_Int32* 
pCharWidths ) const
 // rightmost cluster edge is the leftmost edge of next cluster
 // for clusters that do not have x-sorted glyphs
 // TODO: avoid recalculation of left bound in next cluster iteration
-for( GlyphVector::const_iterator pN = pG; ++pN  end; )
+for( GlyphVector::const_iterator pN = pG; ++pN != end; )
 {
 if( pN-IsClusterStart() )
 break;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-02-29 Thread Caolán McNamara
 vcl/source/gdi/outdev3.cxx |   30 +-
 1 file changed, 25 insertions(+), 5 deletions(-)

New commits:
commit 8c9823d311fdf8092cc75873e4565325d204a658
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Feb 29 17:05:11 2012 +

we use mpFontData-IsSymbolFont() in our comparison to detect symbol fonts

If we change that between cache lookup and insert we run the risk of
invalidating the results of our lookup.

This should fix some hard to replicate reference count nasties

diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 4c0123f..d9367c0 100755
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -2385,18 +2385,38 @@ ImplFontEntry* ImplFontCache::GetFontEntry( 
ImplDevFontList* pFontList,
 }
 }
 
+ImplFontData* pFontData = NULL;
+
+if (!pEntry  pFontFamily)// no cache hit = find the best matching 
physical font face
+{
+bool bOrigWasSymbol = aFontSelData.mpFontData  
aFontSelData.mpFontData-IsSymbolFont();
+pFontData = pFontFamily-FindBestFontFace( aFontSelData );
+aFontSelData.mpFontData = pFontData;
+bool bNewIsSymbol = aFontSelData.mpFontData  
aFontSelData.mpFontData-IsSymbolFont();
+
+if (bNewIsSymbol || bOrigWasSymbol)
+{
+// it is possible, though generally unlikely, that at this point we
+// will attempt to use a symbol font as a last-ditch fallback for a
+// non-symbol font request or vice versa, and by changing
+// aFontSelData.mpFontData to/from a symbol font we may now find
+// something in the cache that can be reused which previously
+// wasn't a candidate
+FontInstanceList::iterator it = maFontInstanceList.find( 
aFontSelData );
+if( it != maFontInstanceList.end() )
+pEntry = (*it).second;
+}
+}
+
 if( pEntry ) // cache hit = use existing font instance
 {
 // increase the font instance's reference count
 if( !pEntry-mnRefCount++ )
 --mnRef0Count;
 }
-else if (pFontFamily)// no cache hit = create a new font instance
-{
-// find the best matching physical font face
-ImplFontData* pFontData = pFontFamily-FindBestFontFace( aFontSelData 
);
-aFontSelData.mpFontData = pFontData;
 
+if (!pEntry  pFontData)// still no cache hit = create a new font 
instance
+{
 // create a new logical font instance from this physical font face
 pEntry = pFontData-CreateFontInstance( aFontSelData );
 
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-02-20 Thread Thomas Arnhold
 vcl/source/gdi/outdev2.cxx |   24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

New commits:
commit 30869cdcf761fea01b80ff09d99fd25b9fd7ce39
Author: Thomas Arnhold tho...@arnhold.org
Date:   Mon Feb 20 23:49:48 2012 +0100

vcl: TwoRect - SalTwoRect

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 1781655..6d8987e 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -78,8 +78,6 @@ DBG_NAMEEX( OutputDevice )
 return; \
 }
 
-#define TwoRect SalTwoRect
-
 // -
 // - externals -
 // -
@@ -92,7 +90,7 @@ extern sal_uLong nVCLLut[ 256 ];
 
 // ===
 
-sal_uLong ImplAdjustTwoRect( TwoRect rTwoRect, const Size rSizePix )
+sal_uLong ImplAdjustTwoRect( SalTwoRect rTwoRect, const Size rSizePix )
 {
 sal_uLong nMirrFlags = 0;
 
@@ -151,7 +149,7 @@ sal_uLong ImplAdjustTwoRect( TwoRect rTwoRect, const Size 
rSizePix )
 
 // ===
 
-void ImplAdjustTwoRect( TwoRect rTwoRect, const Rectangle rValidSrcRect )
+void ImplAdjustTwoRect( SalTwoRect rTwoRect, const Rectangle rValidSrcRect )
 {
 if( ( rTwoRect.mnSrcX  rValidSrcRect.Left() ) || ( rTwoRect.mnSrcX = 
rValidSrcRect.Right() ) ||
 ( rTwoRect.mnSrcY  rValidSrcRect.Top() ) || ( rTwoRect.mnSrcY = 
rValidSrcRect.Bottom() ) ||
@@ -192,7 +190,7 @@ void ImplAdjustTwoRect( TwoRect rTwoRect, const Rectangle 
rValidSrcRect )
 
 void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* 
pVoidPosAry )
 {
-TwoRect*pPosAry = (TwoRect*)pVoidPosAry;
+SalTwoRect*pPosAry = (SalTwoRect*)pVoidPosAry;
 SalGraphics*pGraphics2;
 
 if ( this == pSrcDev )
@@ -285,7 +283,7 @@ void OutputDevice::DrawOutDev( const Point rDestPt, const 
Size rDestSize,
 
 OUTDEV_INIT();
 
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 aPosAry.mnSrcWidth   = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
 aPosAry.mnSrcHeight  = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
 aPosAry.mnDestWidth  = ImplLogicWidthToDevicePixel( rDestSize.Width() );
@@ -340,7 +338,7 @@ void OutputDevice::DrawOutDev( const Point rDestPt, const 
Size rDestSize,
 
 OUTDEV_INIT();
 
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 aPosAry.mnSrcX   = rOutDev.ImplLogicXToDevicePixel( rSrcPt.X() );
 aPosAry.mnSrcY   = rOutDev.ImplLogicYToDevicePixel( rSrcPt.Y() );
 aPosAry.mnSrcWidth   = rOutDev.ImplLogicWidthToDevicePixel( 
rSrcSize.Width() );
@@ -402,7 +400,7 @@ void OutputDevice::CopyArea( const Point rDestPt,
 
 OUTDEV_INIT();
 
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 aPosAry.mnSrcWidth   = ImplLogicWidthToDevicePixel( rSrcSize.Width() );
 aPosAry.mnSrcHeight  = ImplLogicHeightToDevicePixel( rSrcSize.Height() );
 
@@ -478,7 +476,7 @@ void OutputDevice::ImplDrawFrameDev( const Point rPt, 
const Point rDevPt, cons
 else
 ImplSelectClipRegion( rRegion );
 
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 aPosAry.mnSrcX   = rDevPt.X();
 aPosAry.mnSrcY   = rDevPt.Y();
 aPosAry.mnSrcWidth   = rDevSize.Width();
@@ -637,7 +635,7 @@ void OutputDevice::ImplDrawBitmap( const Point rDestPt, 
const Size rDestSize,
 
 if( !aBmp.IsEmpty() )
 {
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 
 aPosAry.mnSrcX = rSrcPtPixel.X();
 aPosAry.mnSrcY = rSrcPtPixel.Y();
@@ -884,7 +882,7 @@ void OutputDevice::ImplDrawBitmapEx( const Point rDestPt, 
const Size rDestSize
 
 if( !( !aBmpEx ) )
 {
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 
 aPosAry.mnSrcX = rSrcPtPixel.X();
 aPosAry.mnSrcY = rSrcPtPixel.Y();
@@ -1131,7 +1129,7 @@ void OutputDevice::ImplDrawMask( const Point rDestPt, 
const Size rDestSize,
 const ImpBitmap* pImpBmp = rBitmap.ImplGetImpBitmap();
 if ( pImpBmp )
 {
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 
 aPosAry.mnSrcX = rSrcPtPixel.X();
 aPosAry.mnSrcY = rSrcPtPixel.Y();
@@ -1298,7 +1296,7 @@ Bitmap OutputDevice::GetBitmap( const Point rSrcPt, 
const Size rSize ) const
 {
 if ( ((OutputDevice*)aVDev)-mpGraphics || 
((OutputDevice*)aVDev)-ImplGetGraphics() )
 {
-TwoRect aPosAry;
+SalTwoRect aPosAry;
 
 aPosAry.mnSrcX = nX;
 aPosAry.mnSrcY = nY;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-02-18 Thread Michael Meeks
 vcl/source/window/splitwin.cxx |  218 -
 1 file changed, 109 insertions(+), 109 deletions(-)

New commits:
commit a88f9ad3d26fabf0438b1e1720212313c75bee44
Author: Mariusz Dykierek mariuszdykie...@gmail.com
Date:   Sat Feb 18 14:18:19 2012 +0100

Replaced 'if-elseif-else' chains with 'switches' where they seem natural

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index f5da206..dfe66d1 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -135,33 +135,32 @@ static void ImplCalcBorder( WindowAlign eAlign, sal_Bool 
bNoAlign,
 }
 else
 {
-if ( eAlign == WINDOWALIGN_TOP )
+switch ( eAlign )
 {
+case WINDOWALIGN_TOP:
 rLeft   = 2;
 rTop= 2;
 rRight  = 2;
 rBottom = 0;
-}
-else if ( eAlign == WINDOWALIGN_LEFT )
-{
+break;
+case WINDOWALIGN_LEFT:
 rLeft   = 2;
 rTop= 2;
 rRight  = 0;
 rBottom = 2;
-}
-else if ( eAlign == WINDOWALIGN_BOTTOM )
-{
+break;
+case WINDOWALIGN_BOTTOM:
 rLeft   = 2;
 rTop= 0;
 rRight  = 2;
 rBottom = 2;
-}
-else
-{
+break;
+default:
 rLeft   = 0;
 rTop= 2;
 rRight  = 2;
 rBottom = 2;
+break;
 }
 }
 }
@@ -183,8 +182,9 @@ void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
 }
 else
 {
-if ( pWin-meAlign == WINDOWALIGN_BOTTOM )
+switch ( pWin-meAlign )
 {
+case WINDOWALIGN_BOTTOM:
 pWin-SetLineColor( rStyleSettings.GetShadowColor() );
 pWin-DrawLine( Point( 0, nDY-2 ), Point( nDX-1, nDY-2 ) );
 pWin-DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
@@ -194,9 +194,8 @@ void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
 pWin-DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
 pWin-DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
 pWin-DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
-}
-else if ( pWin-meAlign == WINDOWALIGN_TOP )
-{
+break;
+case WINDOWALIGN_TOP:
 pWin-SetLineColor( rStyleSettings.GetShadowColor() );
 pWin-DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
 pWin-DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
@@ -206,9 +205,8 @@ void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
 pWin-DrawLine( Point( 1, 1 ), Point( nDX-3, 1 ) );
 pWin-DrawLine( Point( 1, 1 ), Point( 1, nDY-1 ) );
 pWin-DrawLine( Point( nDX-1, 1 ), Point( nDX-1, nDY-1 ) );
-}
-else if ( pWin-meAlign == WINDOWALIGN_LEFT )
-{
+break;
+case WINDOWALIGN_LEFT:
 pWin-SetLineColor( rStyleSettings.GetShadowColor() );
 pWin-DrawLine( Point( 0, 0 ), Point( nDX-1, 0 ) );
 pWin-DrawLine( Point( 0, 0 ), Point( 0, nDY-1 ) );
@@ -218,9 +216,8 @@ void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
 pWin-DrawLine( Point( 1, 1 ), Point( nDX-1, 1 ) );
 pWin-DrawLine( Point( 1, 1 ), Point( 1, nDY-3 ) );
 pWin-DrawLine( Point( 1, nDY-1 ), Point( nDX-1, nDY-1 ) );
-}
-else
-{
+break;
+default:
 pWin-SetLineColor( rStyleSettings.GetShadowColor() );
 pWin-DrawLine( Point( 0, 0 ), Point( nDX-2, 0 ) );
 pWin-DrawLine( Point( nDX-2, 0 ), Point( nDX-2, nDY-3 ) );
@@ -230,6 +227,7 @@ void SplitWindow::ImplDrawBorder( SplitWindow* pWin )
 pWin-DrawLine( Point( 0, 1 ), Point( nDX-3, 1 ) );
 pWin-DrawLine( Point( nDX-1, 0 ), Point( nDX-1, nDY-1 ) );
 pWin-DrawLine( Point( 0, nDY-1 ), Point( nDX-1, nDY-1 ) );
+break;
 }
 }
 }
@@ -244,33 +242,32 @@ void SplitWindow::ImplDrawBorderLine( SplitWindow* pWin )
 longnDX = pWin-mnDX;
 longnDY = pWin-mnDY;
 
-if ( pWin-meAlign == WINDOWALIGN_LEFT )
+switch ( pWin-meAlign )
 {
+case WINDOWALIGN_LEFT:
 pWin-SetLineColor( rStyleSettings.GetShadowColor() );
 pWin-DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( 
nDX-SPLITWIN_SPLITSIZEEXLN-1, nDY-3 ) );
 pWin-SetLineColor( rStyleSettings.GetLightColor() );
 pWin-DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN, 1 ), Point( 
nDX-SPLITWIN_SPLITSIZEEXLN, nDY-4 ) );
-}
-else if ( pWin-meAlign == WINDOWALIGN_RIGHT )
-{
+break;
+case WINDOWALIGN_RIGHT:
 pWin-SetLineColor( rStyleSettings.GetShadowColor() );
 pWin-DrawLine( Point( SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( 

[Libreoffice-commits] .: vcl/source

2012-02-18 Thread Ivan Timofeev
 vcl/source/window/splitwin.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 46506f82d1d514194aa2b472f6a74398c404fa9d
Author: Ivan Timofeev timofeev@gmail.com
Date:   Sat Feb 18 22:24:11 2012 +0400

fix build

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index dfe66d1..4d5c8ad 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -1435,12 +1435,14 @@ void SplitWindow::ImplSetWindowSize( long nDelta )
 SetSizePixel( aSize );
 break;
 case WINDOWALIGN_BOTTOM:
+{
 maDragRect.Top() += nDelta;
 Point aPos = GetPosPixel();
 aPos.Y() -= nDelta;
 aSize.Height() += nDelta;
 SetPosSizePixel( aPos, aSize );
 break;
+}
 case WINDOWALIGN_LEFT:
 aSize.Width() += nDelta;
 SetSizePixel( aSize );
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-02-18 Thread Michael Meeks
 vcl/source/window/splitwin.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 35244a509981c950acd0d8e7e035af791bf2b0ba
Author: Michael Meeks michael.me...@suse.com
Date:   Sat Feb 18 20:08:38 2012 +

WaE: fix build

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 4d5c8ad..64bec90 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -1449,6 +1449,7 @@ void SplitWindow::ImplSetWindowSize( long nDelta )
 break;
 case WINDOWALIGN_RIGHT:
 default:
+{
 maDragRect.Left() += nDelta;
 Point aPos = GetPosPixel();
 aPos.X() -= nDelta;
@@ -1456,6 +1457,7 @@ void SplitWindow::ImplSetWindowSize( long nDelta )
 SetPosSizePixel( aPos, aSize );
 break;
 }
+}
 
 SplitResize();
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-02-15 Thread Tor Lillqvist
 vcl/source/app/svmain.cxx |5 -
 1 file changed, 5 deletions(-)

New commits:
commit 2185849852aa4cdf4d288d4bd01be44ebd3b4433
Author: Tor Lillqvist tlillqv...@suse.com
Date:   Wed Feb 15 13:14:38 2012 +0200

Revert temporary and not properly ifdeffed Android stuff

diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 4db7b12..cf98fb8 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -155,16 +155,12 @@ oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* 
/*pData*/, oslSignalInfo
 
 }
 
-extern void VCL_DLLPUBLIC plasma_now(const char *msg);
-
 // ===
 int ImplSVMain()
 {
 // The 'real' SVMain()
 RTL_LOGFILE_CONTEXT( aLog, vcl (ss112471) ::SVMain );
 
-//plasma_now(top); - works here
-
 ImplSVData* pSVData = ImplGetSVData();
 
 DBG_ASSERT( pSVData-mpApp, no instance of class Application );
@@ -179,7 +175,6 @@ int ImplSVMain()
 {
 // Application-Main rufen
 pSVData-maAppData.mbInAppMain = sal_True;
-//plasma_now(after vcl init); - works here
 nReturn = pSVData-mpApp-Main();
 pSVData-maAppData.mbInAppMain = sal_False;
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-01-25 Thread Radek Doulík
 vcl/source/gdi/gdimtf.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9b20b8e9c6a177b98b86f227e2e5d056563ec9d5
Author: Radek Doulik r...@novell.com
Date:   Wed Jan 25 09:29:00 2012 +0100

Revert fix rendering of metafiles embedded in emf+

This reverts commit f7b6cd87f78b786b59984e5b3c8a5a78f0ed7a94.

diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 49d3bbb..f6cb49c 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -406,9 +406,9 @@ void GDIMetaFile::Play( OutputDevice* pOut, size_t nPos )
 pOut-SetLayoutMode( 0 );
 pOut-SetDigitLanguage( 0 );
 
-OSL_TRACE(GDIMetaFile::Play on device of size: %d x %d, 
pOut-GetOutputSizePixel().Width(), pOut-GetOutputSizePixel().Height());
-if( !ImplPlayWithRenderer( pOut, Point(0,0), 
pOut-GetOutputSizePixel() ) ) {
-for( size_t nCurPos = nCurrentActionElement; nCurPos  nPos; 
nCurPos++ )
+for( size_t nCurPos = nCurrentActionElement; nCurPos  nPos; nCurPos++ 
)
+{
+if( !Hook() )
 {
 MetaCommentAction* pCommentAct = 
static_castMetaCommentAction*(pAction);
 if( pAction-GetType() == META_COMMENT_ACTION 
@@ -608,7 +608,7 @@ void GDIMetaFile::Play( OutputDevice* pOut, const Point 
rPos,
 {
 GDIMetaFile*pMtf = pOut-GetConnectMetaFile();
 
-if( bUseCanvas  ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
+if( bUseCanvas  !pMtf  ImplPlayWithRenderer( pOut, rPos, aDestSize 
) )
 return;
 
 Size aTmpPrefSize( pOut-LogicToPixel( GetPrefSize(), aDrawMap ) );
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-01-18 Thread Thorsten Behrens
 vcl/source/gdi/outdev2.cxx |  183 +
 1 file changed, 89 insertions(+), 94 deletions(-)

New commits:
commit 649457776f11de1f27157c98fd4b05432b425897
Author: Thorsten Behrens tbehr...@suse.com
Date:   Wed Jan 18 18:09:39 2012 +0100

Unify blitting in vcl.

vcl's DrawBitmap methods have a very nice optimisation, that reduce
the blit to exactly the area covered (i.e. taking into account clip,
scale etc.). This was hand-coded, now moved out to own AdjustTwoRect
method, and also used from DrawOutDev / CopyArea.

diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx
index 329f5f4..2003de8 100644
--- a/vcl/source/gdi/outdev2.cxx
+++ b/vcl/source/gdi/outdev2.cxx
@@ -26,7 +26,6 @@
  *
  /
 
-
 #include tools/debug.hxx
 
 #include vcl/bitmap.hxx
@@ -152,19 +151,69 @@ sal_uLong ImplAdjustTwoRect( TwoRect rTwoRect, const 
Size rSizePix )
 
 // ===
 
+void ImplAdjustTwoRect( TwoRect rTwoRect, const Rectangle rValidSrcRect )
+{
+if( ( rTwoRect.mnSrcX  rValidSrcRect.Left() ) || ( rTwoRect.mnSrcX = 
rValidSrcRect.Right() ) ||
+( rTwoRect.mnSrcY  rValidSrcRect.Top() ) || ( rTwoRect.mnSrcY = 
rValidSrcRect.Bottom() ) ||
+( ( rTwoRect.mnSrcX + rTwoRect.mnSrcWidth )  rValidSrcRect.Right() ) 
||
+( ( rTwoRect.mnSrcY + rTwoRect.mnSrcHeight )  rValidSrcRect.Bottom() 
) )
+{
+const Rectangle aSourceRect( Point( rTwoRect.mnSrcX, rTwoRect.mnSrcY ),
+ Size( rTwoRect.mnSrcWidth, 
rTwoRect.mnSrcHeight ) );
+Rectangle   aCropRect( aSourceRect );
+
+aCropRect.Intersection( rValidSrcRect );
+
+if( aCropRect.IsEmpty() )
+rTwoRect.mnSrcWidth = rTwoRect.mnSrcHeight = rTwoRect.mnDestWidth 
= rTwoRect.mnDestHeight = 0;
+else
+{
+const doublefFactorX = ( rTwoRect.mnSrcWidth  1 ) ? (double) 
( rTwoRect.mnDestWidth - 1 ) / ( rTwoRect.mnSrcWidth - 1 ) : 0.0;
+const doublefFactorY = ( rTwoRect.mnSrcHeight  1 ) ? (double) 
( rTwoRect.mnDestHeight - 1 ) / ( rTwoRect.mnSrcHeight - 1 ) : 0.0;
+
+const long nDstX1 = rTwoRect.mnDestX + FRound( fFactorX * ( 
aCropRect.Left() - rTwoRect.mnSrcX ) );
+const long nDstY1 = rTwoRect.mnDestY + FRound( fFactorY * ( 
aCropRect.Top() - rTwoRect.mnSrcY ) );
+const long nDstX2 = rTwoRect.mnDestX + FRound( fFactorX * ( 
aCropRect.Right() - rTwoRect.mnSrcX ) );
+const long nDstY2 = rTwoRect.mnDestY + FRound( fFactorY * ( 
aCropRect.Bottom() - rTwoRect.mnSrcY ) );
+
+rTwoRect.mnSrcX = aCropRect.Left();
+rTwoRect.mnSrcY = aCropRect.Top();
+rTwoRect.mnSrcWidth = aCropRect.GetWidth();
+rTwoRect.mnSrcHeight = aCropRect.GetHeight();
+rTwoRect.mnDestX = nDstX1;
+rTwoRect.mnDestY = nDstY1;
+rTwoRect.mnDestWidth = nDstX2 - nDstX1 + 1;
+rTwoRect.mnDestHeight = nDstY2 - nDstY1 + 1;
+}
+}
+}
+
+// ===
+
 void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, void* 
pVoidPosAry )
 {
 TwoRect*pPosAry = (TwoRect*)pVoidPosAry;
 SalGraphics*pGraphics2;
 
-if ( pPosAry-mnSrcWidth  pPosAry-mnSrcHeight  pPosAry-mnDestWidth 
 pPosAry-mnDestHeight )
+if ( this == pSrcDev )
+pGraphics2 = NULL;
+else
 {
-if ( this == pSrcDev )
-pGraphics2 = NULL;
+if ( (GetOutDevType() != pSrcDev-GetOutDevType()) ||
+ (GetOutDevType() != OUTDEV_WINDOW) )
+{
+if ( !pSrcDev-mpGraphics )
+{
+if ( !((OutputDevice*)pSrcDev)-ImplGetGraphics() )
+return;
+}
+pGraphics2 = pSrcDev-mpGraphics;
+}
 else
 {
-if ( (GetOutDevType() != pSrcDev-GetOutDevType()) ||
- (GetOutDevType() != OUTDEV_WINDOW) )
+if ( ((Window*)this)-mpWindowImpl-mpFrameWindow == 
((Window*)pSrcDev)-mpWindowImpl-mpFrameWindow )
+pGraphics2 = NULL;
+else
 {
 if ( !pSrcDev-mpGraphics )
 {
@@ -172,68 +221,38 @@ void OutputDevice::ImplDrawOutDevDirect( const 
OutputDevice* pSrcDev, void* pVoi
 return;
 }
 pGraphics2 = pSrcDev-mpGraphics;
-}
-else
-{
-if ( ((Window*)this)-mpWindowImpl-mpFrameWindow == 
((Window*)pSrcDev)-mpWindowImpl-mpFrameWindow )
-pGraphics2 = NULL;
-else
-{
-if ( !pSrcDev-mpGraphics )
-{
-if ( 

[Libreoffice-commits] .: vcl/source

2012-01-09 Thread Stephan Bergmann
 vcl/source/control/combobox.cxx |   21 +++--
 1 file changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 04292aee154d03e87395722d314c60be6c10b2ec
Author: Marcel Metz mm...@adrian-broher.net
Date:   Mon Jan 9 11:53:48 2012 +0100

Replace Table with std::set.

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 584e493..97abfc1 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -27,6 +27,7 @@
  /
 
 
+#include set
 #include comphelper/string.hxx
 #include tools/table.hxx
 #include tools/debug.hxx
@@ -44,15 +45,7 @@
 
 // ===
 
-inline sal_uLong ImplCreateKey( sal_uInt16 nPos )
-{
-// Key = Pos+1, wegen Pos 0
-return nPos+1;
-}
-
-// ---
-
-static void lcl_GetSelectedEntries( Table rSelectedPos, const XubString 
rText, xub_Unicode cTokenSep, const ImplEntryList* pEntryList )
+static void lcl_GetSelectedEntries( ::std::set sal_uInt16  rSelectedPos, 
const XubString rText, xub_Unicode cTokenSep, const ImplEntryList* pEntryList )
 {
 for (xub_StrLen n = comphelper::string::getTokenCount(rText, cTokenSep); 
n;)
 {
@@ -60,7 +53,7 @@ static void lcl_GetSelectedEntries( Table rSelectedPos, 
const XubString rText,
 aToken = comphelper::string::strip(aToken, ' ');
 sal_uInt16 nPos = pEntryList-FindEntry( aToken );
 if ( nPos != LISTBOX_ENTRY_NOTFOUND )
-rSelectedPos.Insert( ImplCreateKey( nPos ), (void*)sal_IntPtr(1L) 
);
+rSelectedPos.insert( nPos );
 }
 }
 
@@ -417,13 +410,13 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
 }
 
 // Fehlende Eintraege anhaengen...
-Table aSelInText;
+::std::set sal_uInt16  aSelInText;
 lcl_GetSelectedEntries( aSelInText, aText, mcMultiSep, 
mpImplLB-GetEntryList() );
 sal_uInt16 nSelectedEntries = 
mpImplLB-GetEntryList()-GetSelectEntryCount();
 for ( sal_uInt16 n = 0; n  nSelectedEntries; n++ )
 {
 sal_uInt16 nP = mpImplLB-GetEntryList()-GetSelectEntryPos( n 
);
-if ( !aSelInText.IsKeyValid( ImplCreateKey( nP ) ) )
+if ( !aSelInText.count( nP ) )
 {
 if ( aText.Len()  (aText.GetChar( aText.Len()-1 ) != 
mcMultiSep) )
 aText += mcMultiSep;
@@ -952,10 +945,10 @@ void ComboBox::ImplUpdateFloatSelection()
 }
 else
 {
-Table aSelInText;
+::std::set sal_uInt16  aSelInText;
 lcl_GetSelectedEntries( aSelInText, mpSubEdit-GetText(), mcMultiSep, 
mpImplLB-GetEntryList() );
 for ( sal_uInt16 n = 0; n  mpImplLB-GetEntryList()-GetEntryCount(); 
n++ )
-mpImplLB-SelectEntry( n, aSelInText.IsKeyValid( ImplCreateKey( n 
) ) );
+mpImplLB-SelectEntry( n, aSelInText.count( n ) );
 }
 mpImplLB-SetCallSelectionChangedHdl( sal_True );
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2012-01-05 Thread Norbert Thiebaud
 vcl/source/gdi/bitmap3.cxx |   76 +++--
 1 file changed, 39 insertions(+), 37 deletions(-)

New commits:
commit bb0438f010893b6bc083aac6c1037f9a80ae8add
Author: Norbert Thiebaud nthieb...@gmail.com
Date:   Thu Jan 5 03:24:16 2012 -0600

potential null pointer dereference

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 19f5f25..a2b8587 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -949,63 +949,65 @@ sal_Bool Bitmap::ImplScaleFast( const double rScaleX, 
const double rScaleY )
 const Size  aSizePix( GetSizePixel() );
 const long  nNewWidth = FRound( aSizePix.Width() * rScaleX );
 const long  nNewHeight = FRound( aSizePix.Height() * rScaleY );
-sal_BoolbRet = sal_False;
+sal_BoolbRet = sal_False;
 
 if( nNewWidth  nNewHeight )
 {
 BitmapReadAccess*   pReadAcc = AcquireReadAccess();
-Bitmap  aNewBmp( Size( nNewWidth, nNewHeight ), 
GetBitCount(), pReadAcc-GetPalette() );
-BitmapWriteAccess*  pWriteAcc = aNewBmp.AcquireWriteAccess();
 
-if( pReadAcc  pWriteAcc )
+if(pReadAcc)
 {
-const long  nScanlineSize = pWriteAcc-GetScanlineSize();
-const long  nNewWidth1 = nNewWidth - 1L;
-const long  nNewHeight1 = nNewHeight - 1L;
-const long  nWidth = pReadAcc-Width();
-const long  nHeight = pReadAcc-Height();
-long*   pLutX = new long[ nNewWidth ];
-long*   pLutY = new long[ nNewHeight ];
-
-if( nNewWidth1  nNewHeight1 )
-{
-longnX, nY, nMapY, nActY = 0L;
-
-for( nX = 0L; nX  nNewWidth; nX++ )
-pLutX[ nX ] = nX * nWidth / nNewWidth;
-
-for( nY = 0L; nY  nNewHeight; nY++ )
-pLutY[ nY ] = nY * nHeight / nNewHeight;
+Bitmap  aNewBmp( Size( nNewWidth, nNewHeight ), 
GetBitCount(), pReadAcc-GetPalette() );
+BitmapWriteAccess*  pWriteAcc = aNewBmp.AcquireWriteAccess();
 
-while( nActY  nNewHeight )
+if( pWriteAcc )
+{
+const long  nScanlineSize = pWriteAcc-GetScanlineSize();
+const long  nNewWidth1 = nNewWidth - 1L;
+const long  nNewHeight1 = nNewHeight - 1L;
+const long  nWidth = pReadAcc-Width();
+const long  nHeight = pReadAcc-Height();
+long*   pLutX = new long[ nNewWidth ];
+long*   pLutY = new long[ nNewHeight ];
+
+if( nNewWidth1  nNewHeight1 )
 {
-nMapY = pLutY[ nActY ];
+longnX, nY, nMapY, nActY = 0L;
 
 for( nX = 0L; nX  nNewWidth; nX++ )
-pWriteAcc-SetPixel( nActY, nX, pReadAcc-GetPixel( 
nMapY , pLutX[ nX ] ) );
+pLutX[ nX ] = nX * nWidth / nNewWidth;
+
+for( nY = 0L; nY  nNewHeight; nY++ )
+pLutY[ nY ] = nY * nHeight / nNewHeight;
 
-while( ( nActY  nNewHeight1 )  ( pLutY[ nActY + 1 ] == 
nMapY ) )
+while( nActY  nNewHeight )
 {
-memcpy( pWriteAcc-GetScanline( nActY + 1L ),
- pWriteAcc-GetScanline( nActY ), 
nScanlineSize );
+nMapY = pLutY[ nActY ];
+
+for( nX = 0L; nX  nNewWidth; nX++ )
+pWriteAcc-SetPixel( nActY, nX, 
pReadAcc-GetPixel( nMapY , pLutX[ nX ] ) );
+
+while( ( nActY  nNewHeight1 )  ( pLutY[ nActY + 1 ] 
== nMapY ) )
+{
+memcpy( pWriteAcc-GetScanline( nActY + 1L ),
+pWriteAcc-GetScanline( nActY ), 
nScanlineSize );
+nActY++;
+}
 nActY++;
 }
 
-nActY++;
+bRet = sal_True;
+aNewBmp.ReleaseAccess( pWriteAcc );
 }
 
-bRet = sal_True;
+delete[] pLutX;
+delete[] pLutY;
 }
+ReleaseAccess( pReadAcc );
 
-delete[] pLutX;
-delete[] pLutY;
+if( bRet )
+ImplAssignWithSize( aNewBmp );
 }
-
-ReleaseAccess( pReadAcc );
-aNewBmp.ReleaseAccess( pWriteAcc );
-
-if( bRet )
-ImplAssignWithSize( aNewBmp );
 }
 
 return bRet;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-12-30 Thread Julien Nabet
 vcl/source/window/menu.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 86b528bb05a8b3a389ebdf6ce09d9963019ec058
Author: Julien Nabet serval2...@yahoo.fr
Date:   Fri Dec 30 12:43:15 2011 +0100

Checking is useless here

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index c44f906..baa6bdb 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -5404,7 +5404,7 @@ void MenuBarWindow::KillActivePopup()
 pActivePopup-Deactivate();
 pActivePopup-bInCallback = sal_False;
 // check for pActivePopup, if stopped by deactivate...
-if ( pActivePopup  pActivePopup-ImplGetWindow() )
+if ( pActivePopup-ImplGetWindow() )
 {
 pActivePopup-ImplGetFloatingWindow()-StopExecute();
 pActivePopup-ImplGetFloatingWindow()-doShutdown();
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-12-30 Thread Julien Nabet
 vcl/source/control/button.cxx |   15 ---
 1 file changed, 15 deletions(-)

New commits:
commit 4fd2b87dc4cc30de67fb26436ed9aee26b738368
Author: Julien Nabet serval2...@yahoo.fr
Date:   Fri Dec 30 13:50:16 2011 +0100

Useless since LoadThemedImageList (reported by cppcheck)

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index f41cf74..e49e0cb 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2938,21 +2938,6 @@ Image RadioButton::GetRadioImage( const AllSettings 
rSettings, sal_uInt16 nFlag
 pSVData-maCtrlData.mnLastRadioWColor = 
rStyleSettings.GetWindowColor().GetColor();
 pSVData-maCtrlData.mnLastRadioLColor = 
rStyleSettings.GetLightColor().GetColor();
 
-Color pColorAry1[6];
-Color pColorAry2[6];
-pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );
-pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );
-pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );
-pColorAry1[3] = Color( 0x80, 0x80, 0x80 );
-pColorAry1[4] = Color( 0x00, 0x00, 0x00 );
-pColorAry1[5] = Color( 0x00, 0xFF, 0x00 );
-pColorAry2[0] = rStyleSettings.GetFaceColor();
-pColorAry2[1] = rStyleSettings.GetWindowColor();
-pColorAry2[2] = rStyleSettings.GetLightColor();
-pColorAry2[3] = rStyleSettings.GetShadowColor();
-pColorAry2[4] = rStyleSettings.GetDarkShadowColor();
-pColorAry2[5] = rStyleSettings.GetWindowTextColor();
-
 ResMgr* pResMgr = ImplGetResMgr();
 pSVData-maCtrlData.mpRadioImgList = new ImageList();
 if( pResMgr )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-12-28 Thread Julien Nabet
 vcl/source/gdi/pdfextoutdevdata.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 39b185e9ce2aa86b36ca80f8286533c306107826
Author: Julien Nabet serval2...@yahoo.fr
Date:   Wed Dec 28 22:55:15 2011 +0100

Fix init order

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx 
b/vcl/source/gdi/pdfextoutdevdata.cxx
index a2d856d..23d81a4 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -511,8 +511,8 @@ PDFExtOutDevData::PDFExtOutDevData( const OutputDevice 
rOutDev ) :
 mbTransitionEffects ( sal_True ),
 mbUseLosslessCompression( sal_True ),
 mbReduceImageResolution ( sal_False ),
-mbExportNDests  ( sal_False ),
 mbExportHiddenSlides( sal_False ),
+mbExportNDests  ( sal_False ),
 mnFormsFormat   ( 0 ),
 mnPage  ( -1 ),
 mpPageSyncData  ( NULL ),
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-12-23 Thread Ivan Timofeev
 vcl/source/window/menu.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 22ebb32863f7874ccd1d39881140a0bbcbc5f72a
Author: Ivan Timofeev timofeev@gmail.com
Date:   Fri Dec 23 19:10:18 2011 +0400

don't hide images in menus (fdo#31471, fdo#41264)

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 65a83a5..c44f906 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -960,7 +960,7 @@ void Menu::ImplInit()
 {
 mnHighlightedItemPos = ITEMPOS_INVALID;
 mpSalMenu   = NULL;
-nMenuFlags  = 0;
+nMenuFlags  = MENU_FLAG_SHOWCHECKIMAGES;
 nDefaultItem= 0;
 //bIsMenuBar  = sal_False;  // this is now set in the ctor, must not 
be changed here!!!
 nSelectedId = 0;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-12-17 Thread Ivan Timofeev
 vcl/source/window/decoview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f26635c3869a85ae03dba3dfb833276f13ffc478
Author: Ivan Timofeev timofeev@gmail.com
Date:   Sat Dec 17 17:11:54 2011 +0400

fix decoration drawing

diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 38dbe74..6b6bc1a 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -747,7 +747,7 @@ void ImplDrawFrame( OutputDevice *const pDev, Rectangle 
rRect,
 rRect.Right(), rRect.Bottom() ) );
 pDev-SetLineColor( rStyleSettings.GetShadowColor() );
 pDev-DrawRect( Rectangle( rRect.Left(), rRect.Top(),
-rRect.Right()+1, rRect.Bottom()+1 
) );
+rRect.Right()-1, rRect.Bottom()-1 
) );
 
 // adjust target rectangle
 rRect.Left()   += 2;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-12-16 Thread Michael Meeks
 vcl/source/window/decoview.cxx |  398 +++--
 1 file changed, 187 insertions(+), 211 deletions(-)

New commits:
commit ee23ea13ddb527c0aa2e1739c2b4a3f7dd66c742
Author: Matteo Casalin matteo.casa...@poste.it
Date:   Fri Dec 9 21:13:58 2011 +0100

DecoView cleanup: rework ImplDrawFrame

diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index a1511ab..38dbe74 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -633,6 +633,193 @@ void ImplDrawButton( OutputDevice *const pDev, Rectangle 
aFillRect,
 }
 }
 
+void ImplDrawFrame( OutputDevice *const pDev, Rectangle rRect,
+const StyleSettings rStyleSettings, sal_uInt16 nStyle )
+{
+Window *const pWin = (pDev-GetOutDevType()==OUTDEV_WINDOW) ? (Window*) 
pDev : NULL;
+
+const bool bMenuStyle = nStyle  FRAME_DRAW_MENU;
+
+// UseFlatBorders disables 3D style for all frames except menus
+// menus may use different border colors (eg on XP)
+// normal frames will be drawn using the shadow color
+// whereas window frame borders will use black
+bool bFlatBorders = !bMenuStyle  rStyleSettings.GetUseFlatBorders();
+
+// no flat borders for standard VCL controls (ie formcontrols that keep 
their classic look)
+// will not affect frame windows (like dropdowns)
+if( bFlatBorders  pWin  pWin-GetType() == WINDOW_BORDERWINDOW  
(pWin != pWin-ImplGetFrameWindow()) )
+{
+// check for formcontrol, i.e., a control without NWF enabled
+Control *const pControl = dynamic_cast Control* ( pWin-GetWindow( 
WINDOW_CLIENT ) );
+if( !pControl || !pControl-IsNativeWidgetEnabled() )
+bFlatBorders = false;
+}
+
+const bool bNoDraw = nStyle  FRAME_DRAW_NODRAW;
+
+if ( (rStyleSettings.GetOptions()  STYLE_OPTION_MONO) ||
+ (pDev-GetOutDevType() == OUTDEV_PRINTER) ||
+ bFlatBorders )
+nStyle |= FRAME_DRAW_MONO;
+
+if( pWin  pWin-IsNativeControlSupported(CTRL_FRAME, PART_BORDER) )
+{
+ImplControlValue aControlValue( nStyle |
+(pWin-GetType()==WINDOW_BORDERWINDOW) 
?
+FRAME_DRAW_BORDERWINDOWBORDER : 0 );
+Rectangle aBound, aContent;
+Rectangle aNatRgn( rRect );
+if( pWin-GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
+aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) )
+{
+// if bNoDraw is true then don't call the drawing routine
+// but just update the target rectangle
+if( bNoDraw ||
+pWin-DrawNativeControl( CTRL_FRAME, PART_BORDER, aContent, 
CTRL_STATE_ENABLED,
+ aControlValue, rtl::OUString()) )
+{
+rRect = aContent;
+return;
+}
+}
+}
+
+if ( nStyle  FRAME_DRAW_MONO )
+{
+// no round corners for window frame borders
+const bool bRound = bFlatBorders  !(nStyle  
FRAME_DRAW_WINDOWBORDER);
+
+if ( bNoDraw )
+{
+ImplDrawDPILineRect( pDev, rRect, NULL, bRound );
+}
+else
+{
+Color aColor = bRound ? rStyleSettings.GetShadowColor()
+  : 
pDev-GetSettings().GetStyleSettings().GetMonoColor();
+// when the MonoColor wasn't set, check face color
+if (
+(bRound  aColor.IsDark()) ||
+(
+  (aColor == Color(COL_BLACK)) 
+  
pDev-GetSettings().GetStyleSettings().GetFaceColor().IsDark()
+)
+   )
+{
+aColor = Color( COL_WHITE );
+}
+ImplDrawDPILineRect( pDev, rRect, aColor, bRound );
+}
+}
+else
+{
+if ( bNoDraw )
+{
+switch ( nStyle  FRAME_DRAW_STYLE )
+{
+case FRAME_DRAW_IN:
+case FRAME_DRAW_OUT:
+++rRect.Left();
+++rRect.Top();
+--rRect.Right();
+--rRect.Bottom();
+break;
+
+case FRAME_DRAW_GROUP:
+case FRAME_DRAW_DOUBLEIN:
+case FRAME_DRAW_DOUBLEOUT:
+rRect.Left()   += 2;
+rRect.Top()+= 2;
+rRect.Right()  -= 2;
+rRect.Bottom() -= 2;
+break;
+}
+}
+else
+{
+switch ( nStyle  FRAME_DRAW_STYLE )
+{
+case FRAME_DRAW_GROUP:
+pDev-SetFillColor();
+pDev-SetLineColor( rStyleSettings.GetLightColor() );
+pDev-DrawRect( Rectangle( rRect.Left()+1, rRect.Top()+1,
+rRect.Right(), 

[Libreoffice-commits] .: vcl/source

2011-12-12 Thread Caolán McNamara
 vcl/source/window/accel.cxx |   20 
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 26c0c9d404a65d5ab7a5a9c227132594e467cef4
Author: Marcel Metz mm...@adrian-broher.net
Date:   Mon Dec 12 16:02:22 2011 +

Related: fdo#38832 Replace ImplAccesTable with std::map

diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index f45b145..e755d48 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -27,18 +27,18 @@
  /
 
 
-#include tools/table.hxx
 #include tools/debug.hxx
 #include tools/rc.h
 
 #include vcl/svapp.hxx
 #include accel.h
 #include vcl/accel.hxx
+#include map
 #include vector
 
 // ===
 
-DECLARE_TABLE( ImplAccelTable, ImplAccelEntry* )
+typedef ::std::map sal_uLong, ImplAccelEntry*  ImplAccelMap;
 typedef ::std::vector ImplAccelEntry*  ImplAccelList;
 
 #define ACCELENTRY_NOTFOUND ((sal_uInt16)0x)
@@ -48,8 +48,8 @@ typedef ::std::vector ImplAccelEntry*  ImplAccelList;
 class ImplAccelData
 {
 public:
-ImplAccelTable  maKeyTable; // for keycodes, generated with a code
-ImplAccelList   maIdList;   // Id-List
+ImplAccelMap  maKeyMap; // for keycodes, generated with a code
+ImplAccelList maIdList; // Id-List
 };
 
 // ===
@@ -179,7 +179,11 @@ void Accelerator::ImplInit()
 
 ImplAccelEntry* Accelerator::ImplGetAccelData( const KeyCode rKeyCode ) const
 {
-return mpData-maKeyTable.Get( rKeyCode.GetFullKeyCode() );
+ImplAccelMap::iterator it = mpData-maKeyMap.find( 
rKeyCode.GetFullKeyCode() );
+if( it != mpData-maKeyMap.end() )
+return it-second;
+else
+return NULL;
 }
 
 // ---
@@ -200,7 +204,7 @@ void Accelerator::ImplCopyData( ImplAccelData rAccelData )
 else
 pEntry-mpAutoAccel = NULL;
 
-mpData-maKeyTable.Insert( 
(sal_uLong)pEntry-maKeyCode.GetFullKeyCode(), pEntry );
+mpData-maKeyMap.insert( std::make_pair( 
pEntry-maKeyCode.GetFullKeyCode(), pEntry ) );
 mpData-maIdList.push_back( pEntry );
 }
 }
@@ -267,7 +271,7 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, 
const KeyCode rKeyCode,
 OSL_FAIL( Accelerator::InsertItem(): KeyCode with KeyCode 0 not 
allowed );
 delete pEntry;
 }
-else if ( !mpData-maKeyTable.Insert( nCode, pEntry ) )
+else if ( mpData-maKeyMap.insert( std::make_pair( nCode, pEntry ) 
).second )
 {
 OSL_TRACE( Accelerator::InsertItem(): KeyCode (Key: %lx) already 
exists, nCode );
 delete pEntry;
@@ -470,7 +474,7 @@ Accelerator Accelerator::operator=( const Accelerator 
rAccel )
 
 // delete and copy tables
 ImplDeleteData();
-mpData-maKeyTable.Clear();
+mpData-maKeyMap.clear();
 ImplCopyData( *((ImplAccelData*)(rAccel.mpData)) );
 
 return *this;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-12-12 Thread Caolán McNamara
 vcl/source/window/accel.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 20d6bd273c43a9b8573fa077f6d9d631bd2d53cc
Author: Caolán McNamara caol...@redhat.com
Date:   Mon Dec 12 16:18:37 2011 +

pair::second is false if element with same key already existed

The pair::second element in the pair is set to true if a new element was
inserted or false if an element with the same value existed

diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index e755d48..50afd2b 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -271,7 +271,7 @@ void Accelerator::ImplInsertAccel( sal_uInt16 nItemId, 
const KeyCode rKeyCode,
 OSL_FAIL( Accelerator::InsertItem(): KeyCode with KeyCode 0 not 
allowed );
 delete pEntry;
 }
-else if ( mpData-maKeyMap.insert( std::make_pair( nCode, pEntry ) 
).second )
+else if ( !mpData-maKeyMap.insert( std::make_pair( nCode, pEntry ) 
).second )
 {
 OSL_TRACE( Accelerator::InsertItem(): KeyCode (Key: %lx) already 
exists, nCode );
 delete pEntry;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-11-25 Thread Noel Power
 vcl/source/window/toolbox.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 93a5933060f61a5fb585148e4125a8ab22305259
Author: Noel Power noel.po...@novell.com
Date:   Fri Nov 25 14:25:46 2011 +

really limit special layout to single line non-floating toolbars

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 1016301..3531ea1 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2721,7 +2721,7 @@ void ToolBox::ImplFormat( sal_Bool bResize )
 if ( mbHorz )
 {
 it-maCalcRect.Left() = nX;
-if ( meLayoutMode == TBX_LAYOUT_TOP  mnLines )
+if ( meLayoutMode == TBX_LAYOUT_TOP  mnLines == 1 )
 it-maCalcRect.Top()  = nY/2;
 else
 it-maCalcRect.Top()  = 
nY+(nLineSize-aCurrentItemSize.Height())/2;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-11-14 Thread David Tardon
 vcl/source/gdi/print.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6947091ab0d93bfa84dbbb4a919368f2865d2a45
Author: David Tardon dtar...@redhat.com
Date:   Tue Nov 15 06:13:30 2011 +0100

use SAL_N_ELEMENTS

diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 440da9c..7812032 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1292,8 +1292,8 @@ rtl::OUString Printer::GetPaperName( Paper ePaper )
 PAPER_ENV_9, PAPER_ENV_10, PAPER_ENV_11, PAPER_ENV_12, 
PAPER_KAI16,
 PAPER_KAI32, PAPER_KAI32BIG, PAPER_B4_JIS, PAPER_B5_JIS, 
PAPER_B6_JIS
 };
-OSL_ENSURE( sal_uInt32(sizeof(PaperIndex)/sizeof(PaperIndex[0])) 
== aPaperStrings.Count(), localized paper name count wrong );
-for( int i = 0; i  int(sizeof(PaperIndex)/sizeof(PaperIndex[0])); 
i++ )
+OSL_ENSURE( sal_uInt32(SAL_N_ELEMENTS(PaperIndex)) == 
aPaperStrings.Count(), localized paper name count wrong );
+for( int i = 0; i  int(SAL_N_ELEMENTS(PaperIndex)); i++ )
 (*pSVData-mpPaperNames)[PaperIndex[i]] = 
aPaperStrings.GetString(i);
 }
 }
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-10-09 Thread Jan Holesovsky
 vcl/source/window/toolbox.cxx |   23 +++
 1 file changed, 3 insertions(+), 20 deletions(-)

New commits:
commit 16f5c269890156395644caa5f557570c1c65ca50
Author: Jan Holesovsky ke...@suse.cz
Date:   Mon Oct 10 00:09:24 2011 +0200

Improve the look of the 'More' toolbar indicator in the non-NWF case.

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index c19e6fb..f458fdc 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3141,7 +3141,6 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, 
sal_Bool bHighlight )
 sal_Bool bLineColor = pThis-IsLineColor();
 Color aOldFillCol = pThis-GetFillColor();
 Color aOldLineCol = pThis-GetLineColor();
-sal_Bool bNativeButtons = pThis-IsNativeControlSupported( 
CTRL_TOOLBAR, PART_BUTTON );
 
 Rectangle aInnerRect( pThis-mpData-maMenubuttonItem.maRect );
 if( pThis-mpData-mnMenuButtonWidth  TB_MENUBUTTON_SIZE )
@@ -3176,27 +3175,11 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, 
sal_Bool bHighlight )
 aInnerRect.nBottom-=1;
 }
 
-ImplErase( pThis, bNativeButtons ? 
pThis-mpData-maMenubuttonItem.maRect : aInnerRect, bHighlight );
+// draw the 'more' indicator / button ()
+ImplErase( pThis, pThis-mpData-maMenubuttonItem.maRect, bHighlight );
 
 if( bHighlight )
-{
-if( bNativeButtons )
-ImplDrawButton( pThis, pThis-mpData-maMenubuttonItem.maRect, 
2, sal_False, sal_True, sal_False );
-else
-pThis-DrawSelectionBackground( aInnerRect, 2, sal_False, 
sal_False, sal_False );
-}
-else if( !bNativeButtons )
-{
-// improve visibility by using a dark gradient
-Gradient g;
-g.SetAngle( pThis-mbHorz ? 0 : 900 );
-g.SetStyle( GRADIENT_LINEAR );
-
-g.SetStartColor( 
pThis-GetSettings().GetStyleSettings().GetFaceColor() );
-g.SetEndColor( 
pThis-GetSettings().GetStyleSettings().GetShadowColor() );
-
-pThis-DrawGradient( aInnerRect, g );
-}
+ImplDrawButton( pThis, pThis-mpData-maMenubuttonItem.maRect, 2, 
sal_False, sal_True, sal_False );
 
 Rectangle aRect( aInnerRect );
 if( pThis-mbHorz )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-10-09 Thread Jan Holesovsky
 vcl/source/window/toolbox.cxx |   41 +
 1 file changed, 1 insertion(+), 40 deletions(-)

New commits:
commit 225b8d6bbf3516725b11120e4fa8d0a21a6a8647
Author: Jan Holesovsky ke...@suse.cz
Date:   Mon Oct 10 00:40:04 2011 +0200

Simplify drawing of the toolbar indicator.

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index f458fdc..7361f8a 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3142,53 +3142,14 @@ void ToolBox::ImplDrawMenubutton( ToolBox *pThis, 
sal_Bool bHighlight )
 Color aOldFillCol = pThis-GetFillColor();
 Color aOldLineCol = pThis-GetLineColor();
 
-Rectangle aInnerRect( pThis-mpData-maMenubuttonItem.maRect );
-if( pThis-mpData-mnMenuButtonWidth  TB_MENUBUTTON_SIZE )
-{
-long nDiff = pThis-mpData-mnMenuButtonWidth - TB_MENUBUTTON_SIZE;
-long nDiff1 = nDiff/2;
-long nDiff2 = nDiff - nDiff1;
-if( pThis-IsHorizontal() )
-{
-aInnerRect.Left() += nDiff1;
-aInnerRect.Right() -= nDiff2;
-}
-else
-{
-aInnerRect.Top() += nDiff1;
-aInnerRect.Bottom() -= nDiff2;
-}
-}
-
-if( pThis-IsHorizontal() )
-{
-aInnerRect.nLeft+=2;
-aInnerRect.nRight-=1;
-aInnerRect.nTop+=1;
-aInnerRect.nBottom-=1;
-}
-else
-{
-aInnerRect.nLeft+=1;
-aInnerRect.nRight-=1;
-aInnerRect.nTop+=2;
-aInnerRect.nBottom-=1;
-}
-
 // draw the 'more' indicator / button ()
 ImplErase( pThis, pThis-mpData-maMenubuttonItem.maRect, bHighlight );
 
 if( bHighlight )
 ImplDrawButton( pThis, pThis-mpData-maMenubuttonItem.maRect, 2, 
sal_False, sal_True, sal_False );
 
-Rectangle aRect( aInnerRect );
-if( pThis-mbHorz )
-aRect.Top() = aRect.Bottom() - aRect.getHeight()/3;
-else
-aRect.Left() = aRect.Right() - aRect.getWidth()/3;
-
 if( pThis-ImplHasClippedItems() )
-ImplDrawMoreIndicator( pThis, aInnerRect, sal_True, !pThis-mbHorz 
);
+ImplDrawMoreIndicator( pThis, 
pThis-mpData-maMenubuttonItem.maRect, sal_True, !pThis-mbHorz );
 
 // store highlight state
 pThis-mpData-mbMenubuttonSelected = bHighlight;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: vcl/source

2011-10-03 Thread Caolán McNamara
 vcl/source/window/printdlg.cxx |   26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

New commits:
commit bd9c699d27f323c9f685560e63e268742ec94802
Author: Ivan Timofeev timofeev@gmail.com
Date:   Tue Sep 27 18:52:30 2011 +0400

Print preview: set frame size to preview size even if there is no preview

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 5f01ac2..969030c 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -158,21 +158,17 @@ void PrintDialog::PrintPreviewWindow::Paint( const 
Rectangle )
 {
 long nTextHeight = maHorzDim.GetTextHeight();
 Size aSize( GetSizePixel() );
-aSize.Width()  -= nTextHeight;
-aSize.Height() -= nTextHeight;
+Point aOffset( (aSize.Width()  - maPreviewSize.Width()  + nTextHeight) / 2 
,
+   (aSize.Height() - maPreviewSize.Height() + nTextHeight) / 2 
);
+
 if( maReplacementString.getLength() != 0 )
 {
 // replacement is active
 Push();
-Rectangle aTextRect( Point( nTextHeight, nTextHeight ), aSize );
-DecorationView aVw( this );
-aVw.DrawFrame( aTextRect, FRAME_DRAW_GROUP );
-aTextRect.Left()   += 2;
-aTextRect.Top()+= 2;
-aTextRect.Right()  -= 2;
-aTextRect.Bottom() -= 2;
 Font aFont( GetSettings().GetStyleSettings().GetLabelFont() );
 SetZoomedPointFont( aFont );
+Rectangle aTextRect( aOffset + Point( 2, 2 ),
+Size( maPreviewSize.Width() - 4, maPreviewSize.Height() - 4 ) );
 DrawText( aTextRect, maReplacementString,
   TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | 
TEXT_DRAW_MULTILINE
  );
@@ -182,9 +178,6 @@ void PrintDialog::PrintPreviewWindow::Paint( const 
Rectangle )
 {
 GDIMetaFile aMtf( maMtf );
 
-Point aOffset( (aSize.Width() - maPreviewSize.Width()) / 2 + 
nTextHeight,
-   (aSize.Height() - maPreviewSize.Height()) / 2 + 
nTextHeight );
-
 Size aVDevSize( maPageVDev.GetOutputSizePixel() );
 const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( 
MAP_100TH_MM ) ) );
 Size aOrigSize( maOrigSize );
@@ -213,11 +206,12 @@ void PrintDialog::PrintPreviewWindow::Paint( const 
Rectangle )
 maPageVDev.SetMapMode( MAP_PIXEL );
 DrawOutDev( aOffset, maPreviewSize, Point( 0, 0 ), aVDevSize, 
maPageVDev );
 maPageVDev.SetDrawMode( nOldDrawMode );
-
-DecorationView aVw( this );
-Rectangle aFrame( aOffset + Point( -1, -1 ), Size( 
maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) );
-aVw.DrawFrame( aFrame, FRAME_DRAW_GROUP );
 }
+
+Rectangle aFrameRect( aOffset + Point( -1, -1 ),
+Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) );
+DecorationView aVw( this );
+aVw.DrawFrame( aFrameRect, FRAME_DRAW_GROUP );
 }
 
 void PrintDialog::PrintPreviewWindow::Command( const CommandEvent rEvt )
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits