summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-10-13 10:55:27 +0100
committerNoel Power <noel.power@novell.com>2010-10-13 10:55:27 +0100
commit8c6ba71655f67845e11c5a7566a45118151f55c9 (patch)
treef0ad544c538f55e01dffb585994ae9afb8adcd44 /vcl/source
parent34ebfb2b61686999065015295dab9f623027e94d (diff)
parent48e0d844280937f54d65aca7ad4ce911bf02b5c4 (diff)
Merge branch 'vba' fix conflics, trailing ws & tab issues
Conflicts: unotools/source/config/fltrcfg.cxx
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/combobox.cxx9
-rw-r--r--vcl/source/gdi/bitmap2.cxx30
-rw-r--r--vcl/source/gdi/bitmapex.cxx56
-rw-r--r--vcl/source/window/dialog.cxx11
-rw-r--r--vcl/source/window/toolbox2.cxx2
5 files changed, 99 insertions, 9 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index d760b0b46914..0ca12b1b4db1 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -44,7 +44,7 @@
// =======================================================================
-
+
inline ULONG ImplCreateKey( USHORT nPos )
{
// Key = Pos+1, wegen Pos 0
@@ -66,7 +66,7 @@ static void lcl_GetSelectedEntries( Table& rSelectedPos, const XubString& rText,
}
// =======================================================================
-
+
ComboBox::ComboBox( WindowType nType ) :
Edit( nType )
{
@@ -467,7 +467,10 @@ IMPL_LINK( ComboBox, ImplSelectHdl, void*, EMPTYARG )
mbSyntheticModify = TRUE;
Modify();
mbSyntheticModify = FALSE;
- Select();
+ if (ImplGetWindowImpl() != NULL) //liuchen 2009-7-28, resolve the problem that soffice get crashed if in ComboBox_Change event a Worksheets("SheetX").Activate sentence needs to be executed
+ {
+ Select();
+ }
}
return 0;
diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx
index 0079073216f5..3dbb4e920717 100644
--- a/vcl/source/gdi/bitmap2.cxx
+++ b/vcl/source/gdi/bitmap2.cxx
@@ -44,6 +44,8 @@
#define DIBCOREHEADERSIZE ( 12UL )
#define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) )
+#define BITMAPINFOHEADER 0x28
+
#define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 );
// ----------------------
@@ -127,7 +129,7 @@ SvStream& operator<<( SvStream& rOStm, const Bitmap& rBitmap )
// ------------------------------------------------------------------
-BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
+BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader, BOOL bIsMSOFormat )
{
const USHORT nOldFormat = rIStm.GetNumberFormatInt();
const ULONG nOldPos = rIStm.Tell();
@@ -142,7 +144,7 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
bRet = ImplReadDIB( rIStm, *this, nOffset );
}
else
- bRet = ImplReadDIB( rIStm, *this, nOffset );
+ bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat );
if( !bRet )
{
@@ -159,14 +161,14 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
// ------------------------------------------------------------------
-BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset )
+BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIsMSOFormat )
{
DIBInfoHeader aHeader;
const ULONG nStmPos = rIStm.Tell();
BOOL bRet = FALSE;
sal_Bool bTopDown = sal_False;
- if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
+ if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
{
const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) );
@@ -297,21 +299,37 @@ BOOL Bitmap::ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset )
// ------------------------------------------------------------------
-BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown )
+BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat )
{
// BITMAPINFOHEADER or BITMAPCOREHEADER
rIStm >> rHeader.nSize;
// BITMAPCOREHEADER
+ sal_Int16 nTmp16 = 0;
+ sal_uInt8 nTmp8 = 0;
if ( rHeader.nSize == DIBCOREHEADERSIZE )
{
- sal_Int16 nTmp16;
rIStm >> nTmp16; rHeader.nWidth = nTmp16;
rIStm >> nTmp16; rHeader.nHeight = nTmp16;
rIStm >> rHeader.nPlanes;
rIStm >> rHeader.nBitCount;
}
+ else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) )
+ {
+ rIStm >> nTmp16; rHeader.nWidth = nTmp16;
+ rIStm >> nTmp16; rHeader.nHeight = nTmp16;
+ rIStm >> nTmp8; rHeader.nPlanes = nTmp8;
+ rIStm >> nTmp8; rHeader.nBitCount = nTmp8;
+ rIStm >> nTmp16; rHeader.nSizeImage = nTmp16;
+ rIStm >> nTmp16; rHeader.nCompression = nTmp16;
+ if ( !rHeader.nSizeImage ) // uncompressed?
+ rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
+ rIStm >> rHeader.nXPelsPerMeter;
+ rIStm >> rHeader.nYPelsPerMeter;
+ rIStm >> rHeader.nColsUsed;
+ rIStm >> rHeader.nColsImportant;
+ }
else
{
// unknown Header
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index ddcf2fe05248..4eb658c1ccb0 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -41,6 +41,7 @@
#include <tools/rc.h>
#include <vcl/svapp.hxx>
#include <vcl/bmpacc.hxx>
+#include <vcl/virdev.hxx>
// ------------
// - BitmapEx -
@@ -753,6 +754,61 @@ void BitmapEx::Draw( OutputDevice* pOutDev,
pOutDev->DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, *this );
}
+BitmapEx BitmapEx:: AutoScaleBitmap(BitmapEx & aBitmap, const long aStandardSize)
+{
+ Point aEmptyPoint(0,0);
+ sal_Int32 imgNewWidth = 0;
+ sal_Int32 imgNewHeight = 0;
+ double imgposX = 0;
+ double imgposY = 0;
+ BitmapEx aRet = aBitmap;
+ double imgOldWidth = aRet.GetSizePixel().Width();
+ double imgOldHeight =aRet.GetSizePixel().Height();
+
+ Size aScaledSize;
+ if (imgOldWidth >= aStandardSize || imgOldHeight >= aStandardSize)
+ {
+ if (imgOldWidth >= imgOldHeight)
+ {
+ imgNewWidth = aStandardSize;
+ imgNewHeight = sal_Int32(imgOldHeight / (imgOldWidth / aStandardSize) + 0.5);
+ imgposX = 0;
+ imgposY = (aStandardSize - (imgOldHeight / (imgOldWidth / aStandardSize) + 0.5)) / 2 + 0.5;
+ }
+ else
+ {
+ imgNewHeight = aStandardSize;
+ imgNewWidth = sal_Int32(imgOldWidth / (imgOldHeight / aStandardSize) + 0.5);
+ imgposY = 0;
+ imgposX = (aStandardSize - (imgOldWidth / (imgOldHeight / aStandardSize) + 0.5)) / 2 + 0.5;
+ }
+
+ aScaledSize = Size( imgNewWidth, imgNewHeight );
+ aRet.Scale( aScaledSize, BMP_SCALE_INTERPOLATE );
+ }
+ else
+ {
+ imgposX = (aStandardSize - imgOldWidth) / 2 + 0.5;
+ imgposY = (aStandardSize - imgOldHeight) / 2 + 0.5;
+ }
+
+ Size aBmpSize = aRet.GetSizePixel();
+ Size aStdSize( aStandardSize, aStandardSize );
+ Rectangle aRect(aEmptyPoint, aStdSize );
+
+ VirtualDevice aVirDevice( *Application::GetDefaultDevice(), 0, 1 );
+ aVirDevice.SetOutputSizePixel( aStdSize );
+ aVirDevice.SetFillColor( COL_TRANSPARENT );
+ aVirDevice.SetLineColor( COL_TRANSPARENT );
+
+ //draw a rect into virDevice
+ aVirDevice.DrawRect( aRect );
+ Point aPointPixel( (long)imgposX, (long)imgposY );
+ aVirDevice.DrawBitmapEx( aPointPixel, aRet );
+ aRet = aVirDevice.GetBitmapEx( aEmptyPoint, aStdSize );
+
+ return aRet;
+}
// ------------------------------------------------------------------
sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1f6ebd658c84..1ed9fd002289 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -557,7 +557,18 @@ BOOL Dialog::Close()
{
ImplDelData aDelData;
ImplAddDel( &aDelData );
+ //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event
+ mnCancelClose = 0;
ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE );
+ // basic boolean ( and what the user might use in the event handler) can
+ // be ambiguous ( e.g. basic true = -1 )
+ // test agains 0 ( false ) and assume anything else is true
+ // ( Note: ) this used to work ( something changes somewhere )
+ if (mnCancelClose != 0)
+ {
+ return FALSE;
+ }
+ //liuchen 2009-7-22
if ( aDelData.IsDelete() )
return FALSE;
ImplRemoveDel( &aDelData );
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 47f4d68ef8fc..bdefc7b56802 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -54,6 +54,8 @@ using namespace rtl;
#define TB_SEP_SIZE 8
+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType );
+
// -----------------------------------------------------------------------
ImplToolBoxPrivateData::ImplToolBoxPrivateData() :