diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
commit | a233dac0653f3f3054f7ad2da114ed989747e89a (patch) | |
tree | bf1e11438321c06125a94308649c496648061ccb /vcl/win | |
parent | acb6133d89abe071108577f821d7eaa381378879 (diff) | |
parent | e5647de7dd26775e45af24f11ac4f82a5518bd9e (diff) |
resyncing to master
Diffstat (limited to 'vcl/win')
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/app/saldata.cxx | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/app/salinfo.cxx | 0 | ||||
-rw-r--r-- | vcl/win/source/app/salinst.cxx | 19 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/app/salshl.cxx | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/app/saltimer.cxx | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/gdi/salbmp.cxx | 0 | ||||
-rw-r--r-- | vcl/win/source/gdi/salgdi_gdiplus.cxx | 104 | ||||
-rw-r--r-- | vcl/win/source/gdi/salprn.cxx | 754 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/gdi/salvd.cxx | 0 | ||||
-rw-r--r-- | vcl/win/source/gdi/winlayout.cxx | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/src/salsrc.rc | 167 | ||||
-rw-r--r-- | vcl/win/source/window/salframe.cxx | 195 | ||||
-rw-r--r--[-rwxr-xr-x] | vcl/win/source/window/salobj.cxx | 0 |
13 files changed, 340 insertions, 912 deletions
diff --git a/vcl/win/source/app/saldata.cxx b/vcl/win/source/app/saldata.cxx index 805ca84dc906..805ca84dc906 100755..100644 --- a/vcl/win/source/app/saldata.cxx +++ b/vcl/win/source/app/saldata.cxx diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index 4436c0243f1d..4436c0243f1d 100755..100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 6db248c0ddb4..5e8930f4155f 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -34,9 +34,6 @@ #include <svsys.h> #include <process.h> #endif -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <osl/file.hxx> #include <osl/mutex.hxx> @@ -72,15 +69,19 @@ #pragma warning( disable: 4917 ) #endif -#include <GdiPlus.h> -#include <GdiPlusEnums.h> -#include <GdiPlusColor.h> -#include <Shlobj.h> +#include <gdiplus.h> +#include <gdiplusenums.h> +#include <gdipluscolor.h> +#include <shlobj.h> #if defined _MSC_VER #pragma warning(pop) #endif +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + // ======================================================================= void SalAbort( const XubString& rErrorText ) @@ -516,8 +517,6 @@ SalInstance* CreateSalInstance() // determine the windows version aSalShlData.mbWXP = 0; - aSalShlData.mbWPrinter = 0; - WORD nVer = (WORD)GetVersion(); rtl_zeroMemory( &aSalShlData.maVersionInfo, sizeof(aSalShlData.maVersionInfo) ); aSalShlData.maVersionInfo.dwOSVersionInfoSize = sizeof( aSalShlData.maVersionInfo ); if ( GetVersionEx( &aSalShlData.maVersionInfo ) ) @@ -526,8 +525,6 @@ SalInstance* CreateSalInstance() if ( aSalShlData.maVersionInfo.dwMajorVersion > 5 || ( aSalShlData.maVersionInfo.dwMajorVersion == 5 && aSalShlData.maVersionInfo.dwMinorVersion >= 1 ) ) aSalShlData.mbWXP = 1; - if( aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) - aSalShlData.mbWPrinter = 1; } pSalData->mnAppThreadId = GetCurrentThreadId(); diff --git a/vcl/win/source/app/salshl.cxx b/vcl/win/source/app/salshl.cxx index caebe9ca5b18..caebe9ca5b18 100755..100644 --- a/vcl/win/source/app/salshl.cxx +++ b/vcl/win/source/app/salshl.cxx diff --git a/vcl/win/source/app/saltimer.cxx b/vcl/win/source/app/saltimer.cxx index 60c917475a94..5aab67d88cdd 100755..100644 --- a/vcl/win/source/app/saltimer.cxx +++ b/vcl/win/source/app/saltimer.cxx @@ -29,13 +29,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" #include <svsys.h> -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <win/saldata.hxx> #include <win/saltimer.h> #include <win/salinst.h> +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + // ======================================================================= // Maximale Periode diff --git a/vcl/win/source/gdi/salbmp.cxx b/vcl/win/source/gdi/salbmp.cxx index 7661fa5f6ed1..7661fa5f6ed1 100755..100644 --- a/vcl/win/source/gdi/salbmp.cxx +++ b/vcl/win/source/gdi/salbmp.cxx diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index 3c55685f0aba..fd828d6c0878 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -50,9 +50,9 @@ #pragma warning(push, 1) #endif -#include <GdiPlus.h> -#include <GdiPlusEnums.h> -#include <GdiPlusColor.h> +#include <gdiplus.h> +#include <gdiplusenums.h> +#include <gdipluscolor.h> #if defined _MSC_VER #pragma warning(pop) @@ -62,7 +62,7 @@ // ----------------------------------------------------------------------- -void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { sal_uInt32 nCount(rPolygon.count()); @@ -71,44 +71,42 @@ void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, con const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); const bool bControls(rPolygon.areControlPointsUsed()); basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); - Gdiplus::PointF aFCurr(Gdiplus::REAL(aCurr.getX()), Gdiplus::REAL(aCurr.getY())); for(sal_uInt32 a(0); a < nEdgeCount; a++) { const sal_uInt32 nNextIndex((a + 1) % nCount); const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); - const Gdiplus::PointF aFNext(Gdiplus::REAL(aNext.getX()), Gdiplus::REAL(aNext.getY())); if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) { const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); - rPath.AddBezier( - aFCurr, - Gdiplus::PointF(Gdiplus::REAL(aCa.getX()), Gdiplus::REAL(aCa.getY())), - Gdiplus::PointF(Gdiplus::REAL(aCb.getX()), Gdiplus::REAL(aCb.getY())), - aFNext); + Gdiplus::DllExports::GdipAddPathBezier(pPath, + aCurr.getX(), aCurr.getY(), + aCa.getX(), aCa.getY(), + aCb.getX(), aCb.getY(), + aNext.getX(), aNext.getY()); } else { - rPath.AddLine(aFCurr, aFNext); + Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY()); } if(a + 1 < nEdgeCount) { - aFCurr = aFNext; + aCurr = aNext; if(bNoLineJoin) { - rPath.StartFigure(); + Gdiplus::DllExports::GdipStartPathFigure(pPath); } } } } } -void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GpPath *pPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { sal_uInt32 nCount(rPolygon.count()); @@ -117,37 +115,36 @@ void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); const bool bControls(rPolygon.areControlPointsUsed()); basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); - Gdiplus::Point aICurr(INT(aCurr.getX()), INT(aCurr.getY())); for(sal_uInt32 a(0); a < nEdgeCount; a++) { const sal_uInt32 nNextIndex((a + 1) % nCount); const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); - const Gdiplus::Point aINext(INT(aNext.getX()), INT(aNext.getY())); if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) { const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); - rPath.AddBezier( - aICurr, - Gdiplus::Point(INT(aCa.getX()), INT(aCa.getY())), - Gdiplus::Point(INT(aCb.getX()), INT(aCb.getY())), - aINext); + Gdiplus::DllExports::GdipAddPathBezier( + pPath, + aCurr.getX(), aCurr.getY(), + aCa.getX(), aCa.getY(), + aCb.getX(), aCb.getY(), + aNext.getX(), aNext.getY()); } else { - rPath.AddLine(aICurr, aINext); + Gdiplus::DllExports::GdipAddPathLine(pPath, aCurr.getX(), aCurr.getY(), aNext.getX(), aNext.getY()); } if(a + 1 < nEdgeCount) { - aICurr = aINext; + aCurr = aNext; if(bNoLineJoin) { - rPath.StartFigure(); + Gdiplus::DllExports::GdipStartPathFigure(pPath); } } } @@ -160,33 +157,39 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0)) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::GpGraphics *pGraphics = NULL; + Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics); const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0)); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor)); - Gdiplus::SolidBrush aTestBrush(aTestColor); - Gdiplus::GraphicsPath aPath; + Gdiplus::GpSolidFill *pTestBrush; + Gdiplus::DllExports::GdipCreateSolidFill(aTestColor.GetValue(), &pTestBrush); + Gdiplus::GpPath *pPath = NULL; + Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath); for(sal_uInt32 a(0); a < nCount; a++) { if(0 != a) { - aPath.StartFigure(); // #i101491# not needed for first run + Gdiplus::DllExports::GdipStartPathFigure(pPath); // #i101491# not needed for first run } - impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolyPolygon.getB2DPolygon(a), false); - aPath.CloseFigure(); + impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolyPolygon.getB2DPolygon(a), false); + Gdiplus::DllExports::GdipClosePathFigure(pPath); } if(getAntiAliasB2DDraw()) { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias); } else { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone); } - aGraphics.FillPath(&aTestBrush, &aPath); + Gdiplus::DllExports::GdipFillPath(pGraphics, pTestBrush, pPath); + + Gdiplus::DllExports::GdipDeletePath(pPath); + Gdiplus::DllExports::GdipDeleteGraphics(pGraphics); } return true; @@ -198,11 +201,14 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f if(mbPen && nCount) { - Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::GpGraphics *pGraphics = NULL; + Gdiplus::DllExports::GdipCreateFromHDC(mhDC, &pGraphics); const sal_uInt8 aTrans = (sal_uInt8)basegfx::fround( 255 * (1.0 - fTransparency) ); Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); - Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); - Gdiplus::GraphicsPath aPath; + Gdiplus::GpPen *pTestPen = NULL; + Gdiplus::DllExports::GdipCreatePen1(aTestColor.GetValue(), Gdiplus::REAL(rLineWidths.getX()), Gdiplus::UnitWorld, &pTestPen); + Gdiplus::GpPath *pPath; + Gdiplus::DllExports::GdipCreatePath(Gdiplus::FillModeAlternate, &pPath); bool bNoLineJoin(false); switch(eLineJoin) @@ -217,49 +223,53 @@ bool WinSalGraphics::drawPolyLine( const basegfx::B2DPolygon& rPolygon, double f } case basegfx::B2DLINEJOIN_BEVEL : { - aTestPen.SetLineJoin(Gdiplus::LineJoinBevel); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinBevel); break; } case basegfx::B2DLINEJOIN_MIDDLE : case basegfx::B2DLINEJOIN_MITER : { const Gdiplus::REAL aMiterLimit(15.0); - aTestPen.SetMiterLimit(aMiterLimit); - aTestPen.SetLineJoin(Gdiplus::LineJoinMiter); + Gdiplus::DllExports::GdipSetPenMiterLimit(pTestPen, aMiterLimit); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinMiter); break; } case basegfx::B2DLINEJOIN_ROUND : { - aTestPen.SetLineJoin(Gdiplus::LineJoinRound); + Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, Gdiplus::LineJoinRound); break; } } if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5)) { - impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin); + impAddB2DPolygonToGDIPlusGraphicsPathInteger(pPath, rPolygon, bNoLineJoin); } else { - impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolygon, bNoLineJoin); + impAddB2DPolygonToGDIPlusGraphicsPathReal(pPath, rPolygon, bNoLineJoin); } if(rPolygon.isClosed() && !bNoLineJoin) { // #i101491# needed to create the correct line joins - aPath.CloseFigure(); + Gdiplus::DllExports::GdipClosePathFigure(pPath); } if(getAntiAliasB2DDraw()) { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeAntiAlias); } else { - aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + Gdiplus::DllExports::GdipSetSmoothingMode(pGraphics, Gdiplus::SmoothingModeNone); } - aGraphics.DrawPath(&aTestPen, &aPath); + Gdiplus::DllExports::GdipDrawPath(pGraphics, pTestPen, pPath); + + Gdiplus::DllExports::GdipDeletePath(pPath); + Gdiplus::DllExports::GdipDeletePen(pTestPen); + Gdiplus::DllExports::GdipDeleteGraphics(pGraphics); } return true; diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index 07a6b633e11b..7fdd77394cc2 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -39,10 +39,6 @@ #include <tools/urlobj.hxx> -#ifdef __MINGW32__ -#include <excpt.h> -#endif - #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salinst.h> @@ -65,6 +61,10 @@ #include <malloc.h> #ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + +#ifdef __MINGW32__ #define CATCH_DRIVER_EX_BEGIN \ jmp_buf jmpbuf; \ __SEHandler han; \ @@ -110,24 +110,11 @@ static char aImplWindows[] = "windows"; static char aImplDevices[] = "devices"; static char aImplDevice[] = "device"; -static LPDEVMODEA SAL_DEVMODE_A( const ImplJobSetup* pSetupData ) -{ - LPDEVMODEA pRet = NULL; - SalDriverData* pDrv = (SalDriverData*)pSetupData->mpDriverData; - if( pDrv->mnVersion == SAL_DRIVERDATA_VERSION_A && - pSetupData->mnDriverDataLen >= sizeof(DEVMODEA)+sizeof(SalDriverData)-1 - ) - pRet = ((LPDEVMODEA)((pSetupData->mpDriverData) + (pDrv->mnDriverOffset))); - return pRet; -} - static LPDEVMODEW SAL_DEVMODE_W( const ImplJobSetup* pSetupData ) { LPDEVMODEW pRet = NULL; SalDriverData* pDrv = (SalDriverData*)pSetupData->mpDriverData; - if( pDrv->mnVersion == SAL_DRIVERDATA_VERSION_W && - pSetupData->mnDriverDataLen >= sizeof(DEVMODEW)+sizeof(SalDriverData)-1 - ) + if( pSetupData->mnDriverDataLen >= sizeof(DEVMODEW)+sizeof(SalDriverData)-1 ) pRet = ((LPDEVMODEW)((pSetupData->mpDriverData) + (pDrv->mnDriverOffset))); return pRet; } @@ -192,140 +179,8 @@ static sal_uLong ImplWinQueueStatusToSal( DWORD nWinStatus ) // ----------------------------------------------------------------------- -static void getPrinterQueueInfoOldStyle( ImplPrnQueueList* pList ) -{ - DWORD i; - DWORD n; - DWORD nBytes = 0; - DWORD nInfoPrn2; - sal_Bool bFound = FALSE; - PRINTER_INFO_2* pWinInfo2 = NULL; - PRINTER_INFO_2* pGetInfo2; - EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoPrn2 ); - if ( nBytes ) - { - pWinInfo2 = (PRINTER_INFO_2*) rtl_allocateMemory( nBytes ); - if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoPrn2 ) ) - { - pGetInfo2 = pWinInfo2; - for ( i = 0; i < nInfoPrn2; i++ ) - { - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - pInfo->maPrinterName = ImplSalGetUniString( pGetInfo2->pPrinterName ); - pInfo->maDriver = ImplSalGetUniString( pGetInfo2->pDriverName ); - XubString aPortName; - if ( pGetInfo2->pPortName ) - aPortName = ImplSalGetUniString( pGetInfo2->pPortName ); - // pLocation can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) ) - pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation ); - else - pInfo->maLocation = aPortName; - // pComment can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pComment ) - pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment ); - pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status ); - pInfo->mnJobs = pGetInfo2->cJobs; - pInfo->mpSysData = new XubString( aPortName ); - pList->Add( pInfo ); - pGetInfo2++; - } - - bFound = TRUE; - } - } - - // read printers from win.ini - // TODO: MSDN: GetProfileString() should not be called from server - // code because it is just there for WIN16 compatibility - UINT nSize = 4096; - char* pBuf = new char[nSize]; - UINT nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize ); - while ( nRead >= nSize-2 ) - { - nSize += 2048; - delete []pBuf; - pBuf = new char[nSize]; - nRead = GetProfileStringA( aImplDevices, NULL, "", pBuf, nSize ); - } - - // extract printer names from buffer and fill list - char* pName = pBuf; - while ( *pName ) - { - char* pPortName; - char* pTmp; - char aPortBuf[256]; - GetProfileStringA( aImplDevices, pName, "", aPortBuf, sizeof( aPortBuf ) ); - - pPortName = aPortBuf; - - // create name - xub_StrLen nNameLen = sal::static_int_cast<xub_StrLen>(strlen( pName )); - XubString aName( ImplSalGetUniString( pName, nNameLen ) ); - - // get driver name - pTmp = pPortName; - while ( *pTmp != ',' ) - pTmp++; - XubString aDriver( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); - pPortName = pTmp; - - // get port names - do - { - pPortName++; - pTmp = pPortName; - while ( *pTmp && (*pTmp != ',') ) - pTmp++; - - String aPortName( ImplSalGetUniString( pPortName, (sal_uInt16)(pTmp-pPortName) ) ); - - // create new entry - // look up if printer was already found in first loop - sal_Bool bAdd = TRUE; - if ( pWinInfo2 ) - { - pGetInfo2 = pWinInfo2; - for ( n = 0; n < nInfoPrn2; n++ ) - { - if ( aName.EqualsIgnoreCaseAscii( pGetInfo2->pPrinterName ) ) - { - bAdd = FALSE; - break; - } - pGetInfo2++; - } - } - // if it's a new printer, add it - if ( bAdd ) - { - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - pInfo->maPrinterName = aName; - pInfo->maDriver = aDriver; - pInfo->maLocation = aPortName; - pInfo->mnStatus = 0; - pInfo->mnJobs = QUEUE_JOBS_DONTKNOW; - pInfo->mpSysData = new XubString( aPortName ); - pList->Add( pInfo ); - } - } - while ( *pTmp == ',' ); - - pName += nNameLen + 1; - } - - delete []pBuf; - rtl_freeMemory( pWinInfo2 ); -} - void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) { - if( ! aSalShlData.mbWPrinter ) - { - getPrinterQueueInfoOldStyle( pList ); - return; - } DWORD i; DWORD nBytes = 0; DWORD nInfoPrn4 = 0; @@ -352,59 +207,8 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) // ----------------------------------------------------------------------- -static void getPrinterQueueStateOldStyle( SalPrinterQueueInfo* pInfo ) -{ - DWORD nBytes = 0; - DWORD nInfoRet; - PRINTER_INFO_2* pWinInfo2; - EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nBytes, &nInfoRet ); - if ( nBytes ) - { - pWinInfo2 = (PRINTER_INFO_2*) rtl_allocateMemory( nBytes ); - if ( EnumPrintersA( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes, &nInfoRet ) ) - { - PRINTER_INFO_2* pGetInfo2 = pWinInfo2; - for ( DWORD i = 0; i < nInfoRet; i++ ) - { - if ( pInfo->maPrinterName.EqualsAscii( pGetInfo2->pPrinterName ) && - ( pInfo->maDriver.Len() == 0 || - pInfo->maDriver.EqualsAscii( pGetInfo2->pDriverName ) ) - ) - { - XubString aPortName; - if ( pGetInfo2->pPortName ) - aPortName = ImplSalGetUniString( pGetInfo2->pPortName ); - // pLocation can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pLocation && strlen( pGetInfo2->pLocation ) ) - pInfo->maLocation = ImplSalGetUniString( pGetInfo2->pLocation ); - else - pInfo->maLocation = aPortName; - // pComment can be 0 (the Windows docu doesn't describe this) - if ( pGetInfo2->pComment ) - pInfo->maComment = ImplSalGetUniString( pGetInfo2->pComment ); - pInfo->mnStatus = ImplWinQueueStatusToSal( pGetInfo2->Status ); - pInfo->mnJobs = pGetInfo2->cJobs; - if( ! pInfo->mpSysData ) - pInfo->mpSysData = new XubString( aPortName ); - break; - } - - pGetInfo2++; - } - } - - rtl_freeMemory( pWinInfo2 ); - } -} - void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) { - if( ! aSalShlData.mbWPrinter ) - { - getPrinterQueueStateOldStyle( pInfo ); - return; - } - HANDLE hPrinter = 0; LPWSTR pPrnName = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pInfo->maPrinterName.GetBuffer())); if( OpenPrinterW( pPrnName, &hPrinter, NULL ) ) @@ -451,43 +255,19 @@ void WinSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) // ----------------------------------------------------------------------- XubString WinSalInstance::GetDefaultPrinter() { - static bool bGetDefPrtAPI = true; - static sal_Bool(WINAPI*pGetDefaultPrinter)(LPWSTR,LPDWORD) = NULL; - // try to use GetDefaultPrinter API (not available prior to W2000) - if( bGetDefPrtAPI ) + DWORD nChars = 0; + GetDefaultPrinterW( NULL, &nChars ); + if( nChars ) { - bGetDefPrtAPI = false; - // check for W2k and XP - if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) + LPWSTR pStr = (LPWSTR)rtl_allocateMemory(nChars*sizeof(WCHAR)); + XubString aDefPrt; + if( GetDefaultPrinterW( pStr, &nChars ) ) { - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "winspool.drv" ) ); - oslModule pLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - oslGenericFunction pFunc = NULL; - if( pLib ) - { - OUString queryFuncName( RTL_CONSTASCII_USTRINGPARAM( "GetDefaultPrinterW" ) ); - pFunc = osl_getFunctionSymbol( pLib, queryFuncName.pData ); - } - - pGetDefaultPrinter = (sal_Bool(WINAPI*)(LPWSTR,LPDWORD)) pFunc; - } - } - if( pGetDefaultPrinter ) - { - DWORD nChars = 0; - pGetDefaultPrinter( NULL, &nChars ); - if( nChars ) - { - LPWSTR pStr = (LPWSTR)rtl_allocateMemory(nChars*sizeof(WCHAR)); - XubString aDefPrt; - if( pGetDefaultPrinter( pStr, &nChars ) ) - { - aDefPrt = reinterpret_cast<sal_Unicode* >(pStr); - } - rtl_freeMemory( pStr ); - if( aDefPrt.Len() ) - return aDefPrt; + aDefPrt = reinterpret_cast<sal_Unicode* >(pStr); } + rtl_freeMemory( pStr ); + if( aDefPrt.Len() ) + return aDefPrt; } // get default printer from win.ini @@ -511,30 +291,15 @@ XubString WinSalInstance::GetDefaultPrinter() static DWORD ImplDeviceCaps( WinSalInfoPrinter* pPrinter, WORD nCaps, BYTE* pOutput, const ImplJobSetup* pSetupData ) { - if( aSalShlData.mbWPrinter ) - { - DEVMODEW* pDevMode; - if ( !pSetupData || !pSetupData->mpDriverData ) - pDevMode = NULL; - else - pDevMode = SAL_DEVMODE_W( pSetupData ); - - return DeviceCapabilitiesW( reinterpret_cast<LPCWSTR>(pPrinter->maDeviceName.GetBuffer()), - reinterpret_cast<LPCWSTR>(pPrinter->maPortName.GetBuffer()), - nCaps, (LPWSTR)pOutput, pDevMode ); - } + DEVMODEW* pDevMode; + if ( !pSetupData || !pSetupData->mpDriverData ) + pDevMode = NULL; else - { - DEVMODEA* pDevMode; - if ( !pSetupData || !pSetupData->mpDriverData ) - pDevMode = NULL; - else - pDevMode = SAL_DEVMODE_A( pSetupData ); + pDevMode = SAL_DEVMODE_W( pSetupData ); - return DeviceCapabilitiesA( ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - ImplSalGetWinAnsiString( pPrinter->maPortName, TRUE ).GetBuffer(), - nCaps, (LPSTR)pOutput, pDevMode ); - } + return DeviceCapabilitiesW( reinterpret_cast<LPCWSTR>(pPrinter->maDeviceName.GetBuffer()), + reinterpret_cast<LPCWSTR>(pPrinter->maPortName.GetBuffer()), + nCaps, (LPWSTR)pOutput, pDevMode ); } // ----------------------------------------------------------------------- @@ -549,25 +314,15 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, // initialize versions from jobsetup // those will be overwritten with driver's version - DEVMODEA* pDevModeA = NULL; DEVMODEW* pDevModeW = NULL; LONG dmSpecVersion = -1; LONG dmDriverVersion = -1; SalDriverData* pSalDriverData = (SalDriverData*)pSetupData->mpDriverData; BYTE* pDriverData = ((BYTE*)pSalDriverData) + pSalDriverData->mnDriverOffset; - if( pSalDriverData->mnVersion == SAL_DRIVERDATA_VERSION_W ) - { - if( aSalShlData.mbWPrinter ) - pDevModeW = (DEVMODEW*)pDriverData; - } - else if( pSalDriverData->mnVersion == SAL_DRIVERDATA_VERSION_A ) - { - if( ! aSalShlData.mbWPrinter ) - pDevModeA = (DEVMODEA*)pDriverData; - } + pDevModeW = (DEVMODEW*)pDriverData; long nSysJobSize = -1; - if( pPrinter && ( pDevModeA || pDevModeW ) ) + if( pPrinter && pDevModeW ) { // just too many driver crashes in that area -> check the dmSpecVersion and dmDriverVersion fields always !!! // this prevents using the jobsetup between different Windows versions (eg from XP to 9x) but we @@ -576,31 +331,16 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, ByteString aPrinterNameA= ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ); HANDLE hPrn; LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.GetBuffer())); - if ( ! aSalShlData.mbWPrinter ) - { - if ( !OpenPrinterA( (LPSTR)aPrinterNameA.GetBuffer(), &hPrn, NULL ) ) - return FALSE; - } - else - if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) - return FALSE; + if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) + return FALSE; // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded! if( hPrn == HGDI_ERROR ) return FALSE; - if( aSalShlData.mbWPrinter ) - { - nSysJobSize = DocumentPropertiesW( 0, hPrn, - pPrinterNameW, - NULL, NULL, 0 ); - } - else - { - nSysJobSize = DocumentPropertiesA( 0, hPrn, - (LPSTR)aPrinterNameA.GetBuffer(), - NULL, NULL, 0 ); - } + nSysJobSize = DocumentPropertiesW( 0, hPrn, + pPrinterNameW, + NULL, NULL, 0 ); if( nSysJobSize < 0 ) { @@ -609,18 +349,9 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, } BYTE *pBuffer = (BYTE*)_alloca( nSysJobSize ); LONG nRet = -1; - if( aSalShlData.mbWPrinter ) - { - nRet = DocumentPropertiesW( 0, hPrn, - pPrinterNameW, - (LPDEVMODEW)pBuffer, NULL, DM_OUT_BUFFER ); - } - else - { - nRet = DocumentPropertiesA( 0, hPrn, - (LPSTR)aPrinterNameA.GetBuffer(), - (LPDEVMODEA)pBuffer, NULL, DM_OUT_BUFFER ); - } + nRet = DocumentPropertiesW( 0, hPrn, + pPrinterNameW, + (LPDEVMODEW)pBuffer, NULL, DM_OUT_BUFFER ); if( nRet < 0 ) { ClosePrinter( hPrn ); @@ -630,8 +361,8 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, // the spec version differs between the windows platforms, ie 98,NT,2000/XP // this allows us to throw away printer settings from other platforms that might crash a buggy driver // we check the driver version as well - dmSpecVersion = aSalShlData.mbWPrinter ? ((DEVMODEW*)pBuffer)->dmSpecVersion : ((DEVMODEA*)pBuffer)->dmSpecVersion; - dmDriverVersion = aSalShlData.mbWPrinter ? ((DEVMODEW*)pBuffer)->dmDriverVersion : ((DEVMODEA*)pBuffer)->dmDriverVersion; + dmSpecVersion = ((DEVMODEW*)pBuffer)->dmSpecVersion; + dmDriverVersion = ((DEVMODEW*)pBuffer)->dmDriverVersion; ClosePrinter( hPrn ); } @@ -642,10 +373,6 @@ static sal_Bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter, (long)(pSetupData->mnDriverDataLen - pSetupDriverData->mnDriverOffset) == nSysJobSize && pSetupDriverData->mnSysSignature == SAL_DRIVERDATA_SYSSIGN ) { - if( pDevModeA && - (dmSpecVersion == pDevModeA->dmSpecVersion) && - (dmDriverVersion == pDevModeA->dmDriverVersion) ) - return TRUE; if( pDevModeW && (dmSpecVersion == pDevModeW->dmSpecVersion) && (dmDriverVersion == pDevModeW->dmDriverVersion) ) @@ -670,16 +397,8 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup ByteString aPrinterNameA = ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ); HANDLE hPrn; LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.GetBuffer())); - if( aSalShlData.mbWPrinter ) - { - if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) - return FALSE; - } - else - { - if ( !OpenPrinterA( (LPSTR)aPrinterNameA.GetBuffer(), &hPrn, NULL ) ) - return FALSE; - } + if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) ) + return FALSE; // #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded! if( hPrn == HGDI_ERROR ) return FALSE; @@ -692,16 +411,9 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup SalDriverData* pOutBuffer = NULL; BYTE* pInBuffer = NULL; - if( aSalShlData.mbWPrinter ) - { - nSysJobSize = DocumentPropertiesW( hWnd, hPrn, - pPrinterNameW, - NULL, NULL, 0 ); - } - else - nSysJobSize = DocumentPropertiesA( hWnd, hPrn, - (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - NULL, NULL, 0 ); + nSysJobSize = DocumentPropertiesW( hWnd, hPrn, + pPrinterNameW, + NULL, NULL, 0 ); if ( nSysJobSize < 0 ) { ClosePrinter( hPrn ); @@ -712,7 +424,6 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1; pOutBuffer = (SalDriverData*)rtl_allocateZeroMemory( nDriverDataLen ); pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN; - pOutBuffer->mnVersion = aSalShlData.mbWPrinter ? SAL_DRIVERDATA_VERSION_W : SAL_DRIVERDATA_VERSION_A; // calculate driver data offset including structure padding pOutBuffer->mnDriverOffset = sal::static_int_cast<sal_uInt16>( (char*)pOutBuffer->maDriverData - @@ -738,18 +449,9 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup nMutexCount = ImplSalReleaseYieldMutex(); BYTE* pOutDevMode = (((BYTE*)pOutBuffer) + pOutBuffer->mnDriverOffset); - if( aSalShlData.mbWPrinter ) - { - nRet = DocumentPropertiesW( hWnd, hPrn, - pPrinterNameW, - (LPDEVMODEW)pOutDevMode, (LPDEVMODEW)pInBuffer, nMode ); - } - else - { - nRet = DocumentPropertiesA( hWnd, hPrn, - (LPSTR)ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ).GetBuffer(), - (LPDEVMODEA)pOutDevMode, (LPDEVMODEA)pInBuffer, nMode ); - } + nRet = DocumentPropertiesW( hWnd, hPrn, + pPrinterNameW, + (LPDEVMODEW)pOutDevMode, (LPDEVMODEW)pInBuffer, nMode ); if ( pVisibleDlgParent ) ImplSalAcquireYieldMutex( nMutexCount ); ClosePrinter( hPrn ); @@ -761,35 +463,17 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup } // fill up string buffers with 0 so they do not influence a JobSetup's memcmp - if( aSalShlData.mbWPrinter ) + if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 64 ) { - if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 64 ) - { - sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmDeviceName ); - if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )/sizeof(sal_Unicode) ) - memset( ((LPDEVMODEW)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) ); - } - if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 166 ) - { - sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmFormName ); - if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )/sizeof(sal_Unicode) ) - memset( ((LPDEVMODEW)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) ); - } + sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmDeviceName ); + if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )/sizeof(sal_Unicode) ) + memset( ((LPDEVMODEW)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) ); } - else + if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 166 ) { - if( ((LPDEVMODEA)pOutDevMode)->dmSize >= 32 ) - { - sal_Int32 nLen = strlen( (const char*)((LPDEVMODEA)pOutDevMode)->dmDeviceName ); - if ( nLen < sizeof( ((LPDEVMODEA)pOutDevMode)->dmDeviceName ) ) - memset( ((LPDEVMODEA)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEA)pOutDevMode)->dmDeviceName )-nLen ); - } - if( ((LPDEVMODEA)pOutDevMode)->dmSize >= 102 ) - { - sal_Int32 nLen = strlen( (const char*)((LPDEVMODEA)pOutDevMode)->dmFormName ); - if ( nLen < sizeof( ((LPDEVMODEA)pOutDevMode)->dmFormName ) ) - memset( ((LPDEVMODEA)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEA)pOutDevMode)->dmFormName )-nLen ); - } + sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmFormName ); + if ( nLen < sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )/sizeof(sal_Unicode) ) + memset( ((LPDEVMODEW)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) ); } // update data @@ -805,13 +489,12 @@ static sal_Bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup // ----------------------------------------------------------------------- #define DECLARE_DEVMODE( i )\ - DEVMODEA* pDevModeA = SAL_DEVMODE_A(i);\ DEVMODEW* pDevModeW = SAL_DEVMODE_W(i);\ - if( pDevModeA == NULL && pDevModeW == NULL )\ + if( pDevModeW == NULL )\ return #define CHOOSE_DEVMODE(i)\ - (pDevModeW ? pDevModeW->i : pDevModeA->i) + (pDevModeW->i) static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, sal_uLong nFlags ) { @@ -1379,75 +1062,27 @@ static HDC ImplCreateICW_WithCatch( LPWSTR pDriver, return hDC; } -static HDC ImplCreateICA_WithCatch( char* pDriver, - char* pDevice, - LPDEVMODEA pDevMode ) -{ - HDC hDC = 0; - CATCH_DRIVER_EX_BEGIN; - hDC = CreateICA( pDriver, pDevice, 0, pDevMode ); - CATCH_DRIVER_EX_END_2( "exception in CreateICW" ); - return hDC; -} - - static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData ) { HDC hDC = 0; - if( aSalShlData.mbWPrinter ) - { - LPDEVMODEW pDevMode; - if ( pSetupData && pSetupData->mpDriverData ) - pDevMode = SAL_DEVMODE_W( pSetupData ); - else - pDevMode = NULL; - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space - // pl: does this hold true for Unicode functions ? - if( pPrinter->maDriverName.Len() > 2048 || pPrinter->maDeviceName.Len() > 2048 ) - return 0; - sal_Unicode pDriverName[ 4096 ]; - sal_Unicode pDeviceName[ 4096 ]; - rtl_copyMemory( pDriverName, pPrinter->maDriverName.GetBuffer(), pPrinter->maDriverName.Len()*sizeof(sal_Unicode)); - memset( pDriverName+pPrinter->maDriverName.Len(), 0, 32 ); - rtl_copyMemory( pDeviceName, pPrinter->maDeviceName.GetBuffer(), pPrinter->maDeviceName.Len()*sizeof(sal_Unicode)); - memset( pDeviceName+pPrinter->maDeviceName.Len(), 0, 32 ); - hDC = ImplCreateICW_WithCatch( reinterpret_cast< LPWSTR >(pDriverName), - reinterpret_cast< LPCWSTR >(pDeviceName), - pDevMode ); - } + LPDEVMODEW pDevMode; + if ( pSetupData && pSetupData->mpDriverData ) + pDevMode = SAL_DEVMODE_W( pSetupData ); else - { - LPDEVMODEA pDevMode; - if ( pSetupData && pSetupData->mpDriverData ) - pDevMode = SAL_DEVMODE_A( pSetupData ); - else - pDevMode = NULL; - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space - ByteString aDriver ( ImplSalGetWinAnsiString( pPrinter->maDriverName, TRUE ) ); - ByteString aDevice ( ImplSalGetWinAnsiString( pPrinter->maDeviceName, TRUE ) ); - int n = aDriver.Len() > aDevice.Len() ? aDriver.Len() : aDevice.Len(); - // #125813# under some circumstances many printer drivers really - // seem to have a problem with the names and their conversions. - // We need to get on to of this, but haven't been able to reproduce - // the problem yet. Put the names on the stack so we get them - // with an eventual crash report. - if( n >= 2048 ) - return 0; - n += 2048; - char lpszDriverName[ 4096 ]; - char lpszDeviceName[ 4096 ]; - strncpy( lpszDriverName, aDriver.GetBuffer(), n ); - strncpy( lpszDeviceName, aDevice.GetBuffer(), n ); - // HDU: the crashes usually happen in a MBCS to unicode conversion, - // so I suspect the MBCS string's end is not properly recognized. - // The longest MBCS encoding I'm aware of has six bytes per code - // => add a couple of zeroes... - memset( lpszDriverName+aDriver.Len(), 0, 16 ); - memset( lpszDeviceName+aDevice.Len(), 0, 16 ); - hDC = ImplCreateICA_WithCatch( lpszDriverName, - lpszDeviceName, - pDevMode ); - } + pDevMode = NULL; + // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space + // pl: does this hold true for Unicode functions ? + if( pPrinter->maDriverName.Len() > 2048 || pPrinter->maDeviceName.Len() > 2048 ) + return 0; + sal_Unicode pDriverName[ 4096 ]; + sal_Unicode pDeviceName[ 4096 ]; + rtl_copyMemory( pDriverName, pPrinter->maDriverName.GetBuffer(), pPrinter->maDriverName.Len()*sizeof(sal_Unicode)); + memset( pDriverName+pPrinter->maDriverName.Len(), 0, 32 ); + rtl_copyMemory( pDeviceName, pPrinter->maDeviceName.GetBuffer(), pPrinter->maDeviceName.Len()*sizeof(sal_Unicode)); + memset( pDeviceName+pPrinter->maDeviceName.Len(), 0, 32 ); + hDC = ImplCreateICW_WithCatch( reinterpret_cast< LPWSTR >(pDriverName), + reinterpret_cast< LPCWSTR >(pDeviceName), + pDevMode ); return hDC; } @@ -1567,28 +1202,14 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) pPaperSizes = (POINT*)rtl_allocateZeroMemory(nCount*sizeof(POINT)); ImplDeviceCaps( this, DC_PAPERSIZE, (BYTE*)pPaperSizes, pSetupData ); - if( aSalShlData.mbWPrinter ) + sal_Unicode* pNamesBuffer = (sal_Unicode*)rtl_allocateMemory(nCount*64*sizeof(sal_Unicode)); + ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); + for( DWORD i = 0; i < nCount; ++i ) { - sal_Unicode* pNamesBuffer = (sal_Unicode*)rtl_allocateMemory(nCount*64*sizeof(sal_Unicode)); - ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); - for( DWORD i = 0; i < nCount; ++i ) - { - PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); - m_aPaperFormats.push_back( aInfo ); - } - rtl_freeMemory( pNamesBuffer ); - } - else - { - char* pNamesBuffer = (char*)rtl_allocateMemory(nCount*64); - ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData ); - for( DWORD i = 0; i < nCount; ++i ) - { - PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); - m_aPaperFormats.push_back( aInfo ); - } - rtl_freeMemory( pNamesBuffer ); + PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10); + m_aPaperFormats.push_back( aInfo ); } + rtl_freeMemory( pNamesBuffer ); rtl_freeMemory( pPaperSizes ); } @@ -1683,22 +1304,11 @@ XubString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sa DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, NULL, pSetupData ); if ( (nPaperBin < nBins) && (nBins != GDI_ERROR) ) { - if( aSalShlData.mbWPrinter ) - { - sal_Unicode* pBuffer = new sal_Unicode[nBins*24]; - DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); - if ( nRet && (nRet != GDI_ERROR) ) - aPaperBinName = pBuffer + (nPaperBin*24); - delete [] pBuffer; - } - else - { - char* pBuffer = new char[nBins*24]; - DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); - if ( nRet && (nRet != GDI_ERROR) ) - aPaperBinName = ImplSalGetUniString( (const char*)(pBuffer + (nPaperBin*24)) ); - delete [] pBuffer; - } + sal_Unicode* pBuffer = new sal_Unicode[nBins*24]; + DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData ); + if ( nRet && (nRet != GDI_ERROR) ) + aPaperBinName = pBuffer + (nPaperBin*24); + delete [] pBuffer; } return aPaperBinName; @@ -1832,29 +1442,6 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ ) // ----------------------------------------------------------------------- -static LPDEVMODEA ImplSalSetCopies( LPDEVMODEA pDevMode, sal_uLong nCopies, sal_Bool bCollate ) -{ - LPDEVMODEA pNewDevMode = pDevMode; - if ( pDevMode && (nCopies > 1) ) - { - if ( nCopies > 32765 ) - nCopies = 32765; - sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra; - pNewDevMode = (LPDEVMODEA)rtl_allocateMemory( nDevSize ); - memcpy( pNewDevMode, pDevMode, nDevSize ); - pDevMode = pNewDevMode; - pDevMode->dmFields |= DM_COPIES; - pDevMode->dmCopies = (short)(sal_uInt16)nCopies; - pDevMode->dmFields |= DM_COLLATE; - if ( bCollate ) - pDevMode->dmCollate = DMCOLLATE_TRUE; - else - pDevMode->dmCollate = DMCOLLATE_FALSE; - } - - return pNewDevMode; -} - static LPDEVMODEW ImplSalSetCopies( LPDEVMODEW pDevMode, sal_uLong nCopies, sal_Bool bCollate ) { LPDEVMODEW pNewDevMode = pDevMode; @@ -1951,15 +1538,6 @@ static int lcl_StartDocW( HDC hDC, DOCINFOW* pInfo, WinSalPrinter* pPrt ) return nRet; } -static int lcl_StartDocA( HDC hDC, DOCINFOA* pInfo, WinSalPrinter* pPrt ) -{ - int nRet = 0; - CATCH_DRIVER_EX_BEGIN; - nRet = ::StartDocA( hDC, pInfo ); - CATCH_DRIVER_EX_END( "exception in StartDocW", pPrt ); - return nRet; -} - sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString&, @@ -1973,65 +1551,28 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, mnCopies = nCopies; mbCollate = bCollate; - LPDEVMODEA pOrgDevModeA = NULL; - LPDEVMODEA pDevModeA = NULL; LPDEVMODEW pOrgDevModeW = NULL; LPDEVMODEW pDevModeW = NULL; HDC hDC = 0; - if( aSalShlData.mbWPrinter ) - { - if ( pSetupData && pSetupData->mpDriverData ) - { - pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); - pDevModeW = ImplSalSetCopies( pOrgDevModeW, nCopies, bCollate ); - } - else - pDevModeW = NULL; - - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space - sal_Unicode aDrvBuf[4096]; - sal_Unicode aDevBuf[4096]; - rtl_copyMemory( aDrvBuf, mpInfoPrinter->maDriverName.GetBuffer(), (mpInfoPrinter->maDriverName.Len()+1)*sizeof(sal_Unicode)); - rtl_copyMemory( aDevBuf, mpInfoPrinter->maDeviceName.GetBuffer(), (mpInfoPrinter->maDeviceName.Len()+1)*sizeof(sal_Unicode)); - hDC = CreateDCW( reinterpret_cast<LPCWSTR>(aDrvBuf), - reinterpret_cast<LPCWSTR>(aDevBuf), - NULL, - pDevModeW ); - - if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( pDevModeW ); - } - else + if ( pSetupData && pSetupData->mpDriverData ) { - if ( pSetupData && pSetupData->mpDriverData ) - { - pOrgDevModeA = SAL_DEVMODE_A( pSetupData ); - pDevModeA = ImplSalSetCopies( pOrgDevModeA, nCopies, bCollate ); - } - else - pDevModeA = NULL; - - // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space - ByteString aDriver ( ImplSalGetWinAnsiString( mpInfoPrinter->maDriverName, TRUE ) ); - ByteString aDevice ( ImplSalGetWinAnsiString( mpInfoPrinter->maDeviceName, TRUE ) ); - int n = aDriver.Len() > aDevice.Len() ? aDriver.Len() : aDevice.Len(); - n += 2048; - char *lpszDriverName = new char[n]; - char *lpszDeviceName = new char[n]; - strncpy( lpszDriverName, aDriver.GetBuffer(), n ); - strncpy( lpszDeviceName, aDevice.GetBuffer(), n ); - hDC = CreateDCA( lpszDriverName, - lpszDeviceName, - NULL, - pDevModeA ); - - delete [] lpszDriverName; - delete [] lpszDeviceName; - - if ( pDevModeA != pOrgDevModeA ) - rtl_freeMemory( pDevModeA ); + pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); + pDevModeW = ImplSalSetCopies( pOrgDevModeW, nCopies, bCollate ); } + // #95347 some buggy drivers (eg, OKI) write to those buffers in CreateDC, although declared const - so provide some space + sal_Unicode aDrvBuf[4096]; + sal_Unicode aDevBuf[4096]; + rtl_copyMemory( aDrvBuf, mpInfoPrinter->maDriverName.GetBuffer(), (mpInfoPrinter->maDriverName.Len()+1)*sizeof(sal_Unicode)); + rtl_copyMemory( aDevBuf, mpInfoPrinter->maDeviceName.GetBuffer(), (mpInfoPrinter->maDeviceName.Len()+1)*sizeof(sal_Unicode)); + hDC = CreateDCW( reinterpret_cast<LPCWSTR>(aDrvBuf), + reinterpret_cast<LPCWSTR>(aDevBuf), + NULL, + pDevModeW ); + + if ( pDevModeW != pOrgDevModeW ) + rtl_freeMemory( pDevModeW ); + if ( !hDC ) { mnError = SAL_PRINTER_ERROR_GENERALERROR; @@ -2112,71 +1653,33 @@ sal_Bool WinSalPrinter::StartJob( const XubString* pFileName, } } - if( aSalShlData.mbWPrinter ) + DOCINFOW aInfo; + memset( &aInfo, 0, sizeof( DOCINFOW ) ); + aInfo.cbSize = sizeof( aInfo ); + aInfo.lpszDocName = (LPWSTR)rJobName.GetBuffer(); + if ( pFileName || aOutFileName.getLength() ) { - DOCINFOW aInfo; - memset( &aInfo, 0, sizeof( DOCINFOW ) ); - aInfo.cbSize = sizeof( aInfo ); - aInfo.lpszDocName = (LPWSTR)rJobName.GetBuffer(); - if ( pFileName || aOutFileName.getLength() ) + if ( (pFileName && pFileName->Len()) || aOutFileName.getLength() ) { - if ( (pFileName && pFileName->Len()) || aOutFileName.getLength() ) - { - aInfo.lpszOutput = (LPWSTR)( (pFileName && pFileName->Len()) ? pFileName->GetBuffer() : aOutFileName.getStr()); - } - else - aInfo.lpszOutput = L"FILE:"; + aInfo.lpszOutput = (LPWSTR)( (pFileName && pFileName->Len()) ? pFileName->GetBuffer() : aOutFileName.getStr()); } else - aInfo.lpszOutput = NULL; - - // start Job - int nRet = lcl_StartDocW( hDC, &aInfo, this ); - - if ( nRet <= 0 ) - { - long nError = GetLastError(); - if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } + aInfo.lpszOutput = L"FILE:"; } else + aInfo.lpszOutput = NULL; + + // start Job + int nRet = lcl_StartDocW( hDC, &aInfo, this ); + + if ( nRet <= 0 ) { - // Both strings must exist, if StartJob() is called - ByteString aJobName( ImplSalGetWinAnsiString( rJobName, TRUE ) ); - ByteString aFileName; - - DOCINFOA aInfo; - memset( &aInfo, 0, sizeof( DOCINFOA ) ); - aInfo.cbSize = sizeof( aInfo ); - aInfo.lpszDocName = (LPCSTR)aJobName.GetBuffer(); - if ( pFileName || aOutFileName.getLength() ) - { - if ( pFileName->Len() || aOutFileName.getLength() ) - { - aFileName = ImplSalGetWinAnsiString( pFileName ? *pFileName : static_cast<const XubString>(aOutFileName), TRUE ); - aInfo.lpszOutput = (LPCSTR)aFileName.GetBuffer(); - } - else - aInfo.lpszOutput = "FILE:"; - } + long nError = GetLastError(); + if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) + mnError = SAL_PRINTER_ERROR_ABORT; else - aInfo.lpszOutput = NULL; - - // start Job - int nRet = lcl_StartDocA( hDC, &aInfo, this ); - if ( nRet <= 0 ) - { - long nError = GetLastError(); - if ( (nRet == SP_USERABORT) || (nRet == SP_APPABORT) || (nError == ERROR_PRINT_CANCELLED) || (nError == ERROR_CANCELLED) ) - mnError = SAL_PRINTER_ERROR_ABORT; - else - mnError = SAL_PRINTER_ERROR_GENERALERROR; - return FALSE; - } + mnError = SAL_PRINTER_ERROR_GENERALERROR; + return FALSE; } return TRUE; @@ -2285,26 +1788,13 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo HDC hDC = mhDC; if ( pSetupData && pSetupData->mpDriverData && bNewJobData ) { - if( aSalShlData.mbWPrinter ) - { - LPDEVMODEW pOrgDevModeW; - LPDEVMODEW pDevModeW; - pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); - pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate ); - ResetDCW( hDC, pDevModeW ); - if ( pDevModeW != pOrgDevModeW ) - rtl_freeMemory( pDevModeW ); - } - else - { - LPDEVMODEA pOrgDevModeA; - LPDEVMODEA pDevModeA; - pOrgDevModeA = SAL_DEVMODE_A( pSetupData ); - pDevModeA = ImplSalSetCopies( pOrgDevModeA, mnCopies, mbCollate ); - ResetDCA( hDC, pDevModeA ); - if ( pDevModeA != pOrgDevModeA ) - rtl_freeMemory( pDevModeA ); - } + LPDEVMODEW pOrgDevModeW; + LPDEVMODEW pDevModeW; + pOrgDevModeW = SAL_DEVMODE_W( pSetupData ); + pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate ); + ResetDCW( hDC, pDevModeW ); + if ( pDevModeW != pOrgDevModeW ) + rtl_freeMemory( pDevModeW ); } int nRet = 0; CATCH_DRIVER_EX_BEGIN; diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx index 564a50d71ebb..564a50d71ebb 100755..100644 --- a/vcl/win/source/gdi/salvd.cxx +++ b/vcl/win/source/gdi/salvd.cxx diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index ec4917f4201a..6eb423f72cf6 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -57,8 +57,8 @@ #define USE_UNISCRIBE #ifdef USE_UNISCRIBE -#include <Usp10.h> -#include <ShLwApi.h> +#include <usp10.h> +#include <shlwapi.h> #include <winver.h> #endif // USE_UNISCRIBE @@ -2807,7 +2807,7 @@ private: grutils::GrFeatureParser * mpFeatures; mutable GraphiteLayoutWinImpl maImpl; public: - GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE); + GraphiteWinLayout(HDC hDC, const ImplWinFontData& rWFD, ImplWinFontEntry& rWFE) throw(); // used by upper layers virtual bool LayoutText( ImplLayoutArgs& ); // first step of layout diff --git a/vcl/win/source/src/salsrc.rc b/vcl/win/source/src/salsrc.rc index 11b967ff475b..147b80fc3e8c 100755..100644 --- a/vcl/win/source/src/salsrc.rc +++ b/vcl/win/source/src/salsrc.rc @@ -1,3 +1,4 @@ +/* -*- Mode: Fundamental; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -28,94 +29,94 @@ // for WINVER #include <windows.h> -#ifndef _SV_SALIDS_HRC #include <win/salids.hrc> -#endif -SAL_RESID_POINTER_NULL CURSOR NULLPTR.CUR +SAL_RESID_POINTER_NULL CURSOR nullptr.cur #if ( WINVER < 0x0400 ) -SAL_RESID_POINTER_HELP CURSOR HELP.CUR +SAL_RESID_POINTER_HELP CURSOR help.cur #endif #ifndef WNT -SAL_RESID_POINTER_HSIZE CURSOR HSIZE.CUR -SAL_RESID_POINTER_VSIZE CURSOR VSIZE.CUR -SAL_RESID_POINTER_NESWSIZE CURSOR NESWSIZE.CUR -SAL_RESID_POINTER_NWSESIZE CURSOR NWSESIZE.CUR +SAL_RESID_POINTER_HSIZE CURSOR hsize.cur +SAL_RESID_POINTER_VSIZE CURSOR vsize.cur +SAL_RESID_POINTER_NESWSIZE CURSOR neswsize.cur +SAL_RESID_POINTER_NWSESIZE CURSOR nwsesize.cur #endif -SAL_RESID_POINTER_CROSS CURSOR CROSS.CUR -SAL_RESID_POINTER_MOVE CURSOR MOVE.CUR -SAL_RESID_POINTER_HSPLIT CURSOR HSPLIT.CUR -SAL_RESID_POINTER_VSPLIT CURSOR VSPLIT.CUR -SAL_RESID_POINTER_HSIZEBAR CURSOR HSIZEBAR.CUR -SAL_RESID_POINTER_VSIZEBAR CURSOR VSIZEBAR.CUR -SAL_RESID_POINTER_HAND CURSOR HAND.CUR -SAL_RESID_POINTER_REFHAND CURSOR REFHAND.CUR -SAL_RESID_POINTER_PEN CURSOR PEN.CUR -SAL_RESID_POINTER_MAGNIFY CURSOR MAGNIFY.CUR -SAL_RESID_POINTER_FILL CURSOR FILL.CUR -SAL_RESID_POINTER_ROTATE CURSOR ROTATE.CUR -SAL_RESID_POINTER_HSHEAR CURSOR HSHEAR.CUR -SAL_RESID_POINTER_VSHEAR CURSOR VSHEAR.CUR -SAL_RESID_POINTER_MIRROR CURSOR MIRROR.CUR -SAL_RESID_POINTER_CROOK CURSOR CROOK.CUR -SAL_RESID_POINTER_CROP CURSOR CROP.CUR -SAL_RESID_POINTER_MOVEPOINT CURSOR MOVEPT.CUR -SAL_RESID_POINTER_MOVEBEZIERWEIGHT CURSOR MOVEBW.CUR -SAL_RESID_POINTER_MOVEDATA CURSOR MOVEDATA.CUR -SAL_RESID_POINTER_COPYDATA CURSOR COPYDATA.CUR -SAL_RESID_POINTER_LINKDATA CURSOR LINKDATA.CUR -SAL_RESID_POINTER_MOVEDATALINK CURSOR MOVEDLNK.CUR -SAL_RESID_POINTER_COPYDATALINK CURSOR COPYDLNK.CUR -SAL_RESID_POINTER_MOVEFILE CURSOR MOVEF.CUR -SAL_RESID_POINTER_COPYFILE CURSOR COPYF.CUR -SAL_RESID_POINTER_LINKFILE CURSOR LINKF.CUR -SAL_RESID_POINTER_MOVEFILELINK CURSOR MOVEFLNK.CUR -SAL_RESID_POINTER_COPYFILELINK CURSOR COPYFLNK.CUR -SAL_RESID_POINTER_MOVEFILES CURSOR MOVEF2.CUR -SAL_RESID_POINTER_COPYFILES CURSOR COPYF2.CUR -SAL_RESID_POINTER_NOTALLOWED CURSOR NOTALLOW.CUR -SAL_RESID_POINTER_DRAW_LINE CURSOR DLINE.CUR -SAL_RESID_POINTER_DRAW_RECT CURSOR DRECT.CUR -SAL_RESID_POINTER_DRAW_POLYGON CURSOR DPOLYGON.CUR -SAL_RESID_POINTER_DRAW_BEZIER CURSOR DBEZIER.CUR -SAL_RESID_POINTER_DRAW_ARC CURSOR DARC.CUR -SAL_RESID_POINTER_DRAW_PIE CURSOR DPIE.CUR -SAL_RESID_POINTER_DRAW_CIRCLECUT CURSOR DCIRCCUT.CUR -SAL_RESID_POINTER_DRAW_ELLIPSE CURSOR DELLIPSE.CUR -SAL_RESID_POINTER_DRAW_FREEHAND CURSOR DFREE.CUR -SAL_RESID_POINTER_DRAW_CONNECT CURSOR DCONNECT.CUR -SAL_RESID_POINTER_DRAW_TEXT CURSOR DTEXT.CUR -SAL_RESID_POINTER_DRAW_CAPTION CURSOR DCAPT.CUR -SAL_RESID_POINTER_CHART CURSOR CHART.CUR -SAL_RESID_POINTER_DETECTIVE CURSOR DETECTIV.CUR -SAL_RESID_POINTER_PIVOT_COL CURSOR PIVOTCOL.CUR -SAL_RESID_POINTER_PIVOT_ROW CURSOR PIVOTROW.CUR -SAL_RESID_POINTER_PIVOT_FIELD CURSOR PIVOTFLD.CUR -SAL_RESID_POINTER_PIVOT_DELETE CURSOR PIVOTDEL.CUR -SAL_RESID_POINTER_CHAIN CURSOR CHAIN.CUR -SAL_RESID_POINTER_CHAIN_NOTALLOWED CURSOR CHAINNOT.CUR -SAL_RESID_POINTER_TIMEEVENT_MOVE CURSOR TIMEMOVE.CUR -SAL_RESID_POINTER_TIMEEVENT_SIZE CURSOR TIMESIZE.CUR -SAL_RESID_POINTER_AUTOSCROLL_N CURSOR ASN.CUR -SAL_RESID_POINTER_AUTOSCROLL_S CURSOR ASS.CUR -SAL_RESID_POINTER_AUTOSCROLL_W CURSOR ASW.CUR -SAL_RESID_POINTER_AUTOSCROLL_E CURSOR ASE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NW CURSOR ASNW.CUR -SAL_RESID_POINTER_AUTOSCROLL_NE CURSOR ASNE.CUR -SAL_RESID_POINTER_AUTOSCROLL_SW CURSOR ASSW.CUR -SAL_RESID_POINTER_AUTOSCROLL_SE CURSOR ASSE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NS CURSOR ASNS.CUR -SAL_RESID_POINTER_AUTOSCROLL_WE CURSOR ASWE.CUR -SAL_RESID_POINTER_AUTOSCROLL_NSWE CURSOR ASNSWE.CUR -SAL_RESID_POINTER_AIRBRUSH CURSOR AIRBRUSH.CUR -SAL_RESID_POINTER_TEXT_VERTICAL CURSOR VTEXT.CUR -SAL_RESID_POINTER_TAB_SELECT_S CURSOR TBLSELS.CUR -SAL_RESID_POINTER_TAB_SELECT_E CURSOR TBLSELE.CUR -SAL_RESID_POINTER_TAB_SELECT_SE CURSOR TBLSELSE.CUR -SAL_RESID_POINTER_TAB_SELECT_W CURSOR TBLSELW.CUR -SAL_RESID_POINTER_TAB_SELECT_SW CURSOR TBLSELSW.CUR -SAL_RESID_POINTER_PAINTBRUSH CURSOR PNTBRSH.CUR +SAL_RESID_POINTER_CROSS CURSOR cross.cur +SAL_RESID_POINTER_MOVE CURSOR move.cur +SAL_RESID_POINTER_HSPLIT CURSOR hsplit.cur +SAL_RESID_POINTER_VSPLIT CURSOR vsplit.cur +SAL_RESID_POINTER_HSIZEBAR CURSOR hsizebar.cur +SAL_RESID_POINTER_VSIZEBAR CURSOR vsizebar.cur +SAL_RESID_POINTER_HAND CURSOR hand.cur +SAL_RESID_POINTER_REFHAND CURSOR refhand.cur +SAL_RESID_POINTER_PEN CURSOR pen.cur +SAL_RESID_POINTER_MAGNIFY CURSOR magnify.cur +SAL_RESID_POINTER_FILL CURSOR fill.cur +SAL_RESID_POINTER_ROTATE CURSOR rotate.cur +SAL_RESID_POINTER_HSHEAR CURSOR hshear.cur +SAL_RESID_POINTER_VSHEAR CURSOR vshear.cur +SAL_RESID_POINTER_MIRROR CURSOR mirror.cur +SAL_RESID_POINTER_CROOK CURSOR crook.cur +SAL_RESID_POINTER_CROP CURSOR crop.cur +SAL_RESID_POINTER_MOVEPOINT CURSOR movept.cur +SAL_RESID_POINTER_MOVEBEZIERWEIGHT CURSOR movebw.cur +SAL_RESID_POINTER_MOVEDATA CURSOR movedata.cur +SAL_RESID_POINTER_COPYDATA CURSOR copydata.cur +SAL_RESID_POINTER_LINKDATA CURSOR linkdata.cur +SAL_RESID_POINTER_MOVEDATALINK CURSOR movedlnk.cur +SAL_RESID_POINTER_COPYDATALINK CURSOR copydlnk.cur +SAL_RESID_POINTER_MOVEFILE CURSOR movef.cur +SAL_RESID_POINTER_COPYFILE CURSOR copyf.cur +SAL_RESID_POINTER_LINKFILE CURSOR linkf.cur +SAL_RESID_POINTER_MOVEFILELINK CURSOR moveflnk.cur +SAL_RESID_POINTER_COPYFILELINK CURSOR copyflnk.cur +SAL_RESID_POINTER_MOVEFILES CURSOR movef2.cur +SAL_RESID_POINTER_COPYFILES CURSOR copyf2.cur +SAL_RESID_POINTER_NOTALLOWED CURSOR notallow.cur +SAL_RESID_POINTER_DRAW_LINE CURSOR dline.cur +SAL_RESID_POINTER_DRAW_RECT CURSOR drect.cur +SAL_RESID_POINTER_DRAW_POLYGON CURSOR dpolygon.cur +SAL_RESID_POINTER_DRAW_BEZIER CURSOR dbezier.cur +SAL_RESID_POINTER_DRAW_ARC CURSOR darc.cur +SAL_RESID_POINTER_DRAW_PIE CURSOR dpie.cur +SAL_RESID_POINTER_DRAW_CIRCLECUT CURSOR dcirccut.cur +SAL_RESID_POINTER_DRAW_ELLIPSE CURSOR dellipse.cur +SAL_RESID_POINTER_DRAW_FREEHAND CURSOR dfree.cur +SAL_RESID_POINTER_DRAW_CONNECT CURSOR dconnect.cur +SAL_RESID_POINTER_DRAW_TEXT CURSOR dtext.cur +SAL_RESID_POINTER_DRAW_CAPTION CURSOR dcapt.cur +SAL_RESID_POINTER_CHART CURSOR chart.cur +SAL_RESID_POINTER_DETECTIVE CURSOR detectiv.cur +SAL_RESID_POINTER_PIVOT_COL CURSOR pivotcol.cur +SAL_RESID_POINTER_PIVOT_ROW CURSOR pivotrow.cur +SAL_RESID_POINTER_PIVOT_FIELD CURSOR pivotfld.cur +SAL_RESID_POINTER_PIVOT_DELETE CURSOR pivotdel.cur +SAL_RESID_POINTER_CHAIN CURSOR chain.cur +SAL_RESID_POINTER_CHAIN_NOTALLOWED CURSOR chainnot.cur +SAL_RESID_POINTER_TIMEEVENT_MOVE CURSOR timemove.cur +SAL_RESID_POINTER_TIMEEVENT_SIZE CURSOR timesize.cur +SAL_RESID_POINTER_AUTOSCROLL_N CURSOR asn.cur +SAL_RESID_POINTER_AUTOSCROLL_S CURSOR ass.cur +SAL_RESID_POINTER_AUTOSCROLL_W CURSOR asw.cur +SAL_RESID_POINTER_AUTOSCROLL_E CURSOR ase.cur +SAL_RESID_POINTER_AUTOSCROLL_NW CURSOR asnw.cur +SAL_RESID_POINTER_AUTOSCROLL_NE CURSOR asne.cur +SAL_RESID_POINTER_AUTOSCROLL_SW CURSOR assw.cur +SAL_RESID_POINTER_AUTOSCROLL_SE CURSOR asse.cur +SAL_RESID_POINTER_AUTOSCROLL_NS CURSOR asns.cur +SAL_RESID_POINTER_AUTOSCROLL_WE CURSOR aswe.cur +SAL_RESID_POINTER_AUTOSCROLL_NSWE CURSOR asnswe.cur +SAL_RESID_POINTER_AIRBRUSH CURSOR airbrush.cur +SAL_RESID_POINTER_TEXT_VERTICAL CURSOR vtext.cur +SAL_RESID_POINTER_TAB_SELECT_S CURSOR tblsels.cur +SAL_RESID_POINTER_TAB_SELECT_E CURSOR tblsele.cur +SAL_RESID_POINTER_TAB_SELECT_SE CURSOR tblselse.cur +SAL_RESID_POINTER_TAB_SELECT_W CURSOR tblselw.cur +SAL_RESID_POINTER_TAB_SELECT_SW CURSOR tblselsw.cur +SAL_RESID_POINTER_PAINTBRUSH CURSOR pntbrsh.cur + +SAL_RESID_BITMAP_50 BITMAP "50.bmp" -SAL_RESID_BITMAP_50 BITMAP 50.BMP +SAL_RESID_ICON_DEFAULT ICON sd.ico -SAL_RESID_ICON_DEFAULT ICON SD.ICO +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 9ed173ee6170..80051f321eac 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -48,9 +48,6 @@ #include <stdio.h> #include <svsys.h> -#ifdef __MINGW32__ -#include <excpt.h> -#endif #include <rtl/string.h> #include <rtl/ustring.h> @@ -100,6 +97,10 @@ using ::std::max; #include <time.h> +#ifdef __MINGW32__ +#include <sehandler.hxx> +#endif + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -107,30 +108,20 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; -// The following defines are newly added in Longhorn -#ifndef WM_MOUSEHWHEEL -# define WM_MOUSEHWHEEL 0x020E -#endif #ifndef SPI_GETWHEELSCROLLCHARS # define SPI_GETWHEELSCROLLCHARS 0x006C #endif #ifndef SPI_SETWHEELSCROLLCHARS # define SPI_SETWHEELSCROLLCHARS 0x006D #endif - - +#ifndef WM_MOUSEHWHEEL +# define WM_MOUSEHWHEEL 0x020E +#endif #if OSL_DEBUG_LEVEL > 1 void MyOutputDebugString( char *s) { OutputDebugString( s ); } #endif -// misssing prototypes and constants for LayeredWindows -extern "C" { - //WINUSERAPI sal_Bool WINAPI SetLayeredWindowAttributes(HWND,COLORREF,BYTE,DWORD); - typedef sal_Bool ( WINAPI * SetLayeredWindowAttributes_Proc_T ) (HWND,COLORREF,BYTE,DWORD); - static SetLayeredWindowAttributes_Proc_T lpfnSetLayeredWindowAttributes; -}; - // ======================================================================= const unsigned int WM_USER_SYSTEM_WINDOW_ACTIVATED = RegisterWindowMessageA("SYSTEM_WINDOW_ACTIVATED"); @@ -139,18 +130,6 @@ sal_Bool WinSalFrame::mbInReparent = FALSE; // ======================================================================= -// Wegen Fehler in Windows-Headerfiles -#ifndef IMN_OPENCANDIDATE -#define IMN_OPENCANDIDATE 0x0005 -#endif -#ifndef IMN_CLOSECANDIDATE -#define IMN_CLOSECANDIDATE 0x0004 -#endif - -#ifndef WM_THEMECHANGED -#define WM_THEMECHANGED 0x031A -#endif - // Macros for support of WM_UNICHAR & Keyman 6.0 #define Uni_UTF32ToSurrogate1(ch) (((unsigned long) (ch) - 0x10000) / 0x400 + 0xD800) #define Uni_UTF32ToSurrogate2(ch) (((unsigned long) (ch) - 0x10000) % 0x400 + 0xDC00) @@ -232,9 +211,6 @@ static void ImplSaveFrameState( WinSalFrame* pFrame ) // if pParentRect is set, the workarea of the monitor that contains pParentRect is returned void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) { - static int winVerChecked = 0; - static int winVerOk = 0; - // check if we or our parent is fullscreen, then the taskbar should be ignored bool bIgnoreTaskbar = false; WinSalFrame* pFrame = GetWindowPtr( hWnd ); @@ -254,96 +230,64 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect ) } } - if( !winVerChecked ) + // calculates the work area taking multiple monitors into account + static int nMonitors = GetSystemMetrics( SM_CMONITORS ); + if( nMonitors == 1 ) { - winVerChecked = 1; - winVerOk = 1; - - // multi monitor calls not available on Win95/NT - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - if ( aSalShlData.maVersionInfo.dwMajorVersion <= 4 ) - winVerOk = 0; // NT - } - else if( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) + if( bIgnoreTaskbar ) { - if ( aSalShlData.maVersionInfo.dwMajorVersion == 4 && aSalShlData.maVersionInfo.dwMinorVersion == 0 ) - winVerOk = 0; // Win95 + pRect->left = pRect->top = 0; + pRect->right = GetSystemMetrics( SM_CXSCREEN ); + pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } + else + SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } - - // calculates the work area taking multiple monitors into account - if( winVerOk ) + else { - static int nMonitors = GetSystemMetrics( SM_CMONITORS ); - if( nMonitors == 1 ) + if( pParentRect != NULL ) { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); - } + // return the size of the monitor where pParentRect lives + HMONITOR hMonitor; + MONITORINFO mi; + + // get the nearest monitor to the passed rect. + hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); + + // get the work area or entire monitor rect. + mi.cbSize = sizeof(mi); + GetMonitorInfo(hMonitor, &mi); + if( !bIgnoreTaskbar ) + *pRect = mi.rcWork; else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); + *pRect = mi.rcMonitor; } else { - if( pParentRect != NULL ) + // return the union of all monitors + pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); + pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); + pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); + pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); + + // virtualscreen does not take taskbar into account, so use the corresponding + // diffs between screen and workarea from the default screen + // however, this is still not perfect: the taskbar might not be on the primary screen + if( !bIgnoreTaskbar ) { - // return the size of the monitor where pParentRect lives - HMONITOR hMonitor; - MONITORINFO mi; - - // get the nearest monitor to the passed rect. - hMonitor = MonitorFromRect(pParentRect, MONITOR_DEFAULTTONEAREST); - - // get the work area or entire monitor rect. - mi.cbSize = sizeof(mi); - GetMonitorInfo(hMonitor, &mi); - if( !bIgnoreTaskbar ) - *pRect = mi.rcWork; - else - *pRect = mi.rcMonitor; + RECT wRect, scrRect; + SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); + scrRect.left = 0; + scrRect.top = 0; + scrRect.right = GetSystemMetrics( SM_CXSCREEN ); + scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); + + pRect->left += wRect.left; + pRect->top += wRect.top; + pRect->right -= scrRect.right - wRect.right; + pRect->bottom -= scrRect.bottom - wRect.bottom; } - else - { - // return the union of all monitors - pRect->left = GetSystemMetrics( SM_XVIRTUALSCREEN ); - pRect->top = GetSystemMetrics( SM_YVIRTUALSCREEN ); - pRect->right = pRect->left + GetSystemMetrics( SM_CXVIRTUALSCREEN ); - pRect->bottom = pRect->top + GetSystemMetrics( SM_CYVIRTUALSCREEN ); - - // virtualscreen does not take taskbar into account, so use the corresponding - // diffs between screen and workarea from the default screen - // however, this is still not perfect: the taskbar might not be on the primary screen - if( !bIgnoreTaskbar ) - { - RECT wRect, scrRect; - SystemParametersInfo( SPI_GETWORKAREA, 0, &wRect, 0 ); - scrRect.left = 0; - scrRect.top = 0; - scrRect.right = GetSystemMetrics( SM_CXSCREEN ); - scrRect.bottom = GetSystemMetrics( SM_CYSCREEN ); - - pRect->left += wRect.left; - pRect->top += wRect.top; - pRect->right -= scrRect.right - wRect.right; - pRect->bottom -= scrRect.bottom - wRect.bottom; - } - } - } - } - else - { - if( bIgnoreTaskbar ) - { - pRect->left = pRect->top = 0; - pRect->right = GetSystemMetrics( SM_CXSCREEN ); - pRect->bottom = GetSystemMetrics( SM_CYSCREEN ); } - else - SystemParametersInfo( SPI_GETWORKAREA, 0, pRect, 0 ); } } @@ -361,24 +305,6 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, if( getenv( "SAL_SYNCHRONIZE" ) ) // no buffering of drawing commands GdiSetBatchLimit( 1 ); - static int bLayeredAPI = -1; - if( bLayeredAPI == -1 ) - { - bLayeredAPI = 0; - // check for W2k and XP - if ( aSalShlData.maVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT && aSalShlData.maVersionInfo.dwMajorVersion >= 5 ) - { - OUString aLibraryName( RTL_CONSTASCII_USTRINGPARAM( "user32" ) ); - oslModule pLib = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT ); - oslGenericFunction pFunc = NULL; - if( pLib ) - pFunc = osl_getAsciiFunctionSymbol( pLib, "SetLayeredWindowAttributes" ); - - lpfnSetLayeredWindowAttributes = ( SetLayeredWindowAttributes_Proc_T ) pFunc; - - bLayeredAPI = pFunc ? 1 : 0; - } - } static const char* pEnvTransparentFloats = getenv("SAL_TRANSPARENT_FLOATS" ); // determine creation data @@ -449,7 +375,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, { pFrame->mbNoIcon = TRUE; nExSysStyle |= WS_EX_TOOLWINDOW; - if ( pEnvTransparentFloats && bLayeredAPI == 1 /*&& !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) */) + if ( pEnvTransparentFloats /*&& !(nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE) */) nExSysStyle |= WS_EX_LAYERED; } } @@ -458,7 +384,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, nExSysStyle |= WS_EX_TOOLWINDOW; pFrame->mbFloatWin = TRUE; - if ( (bLayeredAPI == 1) && (pEnvTransparentFloats /* does not work remote! || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) */ ) ) + if ( (pEnvTransparentFloats /* does not work remote! || (nSalFrameStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) */ ) ) nExSysStyle |= WS_EX_LAYERED; } @@ -528,8 +454,8 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, ImplWriteLastError( GetLastError(), "CreateWindowEx" ); #if OSL_DEBUG_LEVEL > 1 // set transparency value - if( bLayeredAPI == 1 && GetWindowExStyle( hWnd ) & WS_EX_LAYERED ) - lpfnSetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); + if( GetWindowExStyle( hWnd ) & WS_EX_LAYERED ) + SetLayeredWindowAttributes( hWnd, 0, 230, 0x00000002 /*LWA_ALPHA*/ ); #endif if ( !hWnd ) { @@ -794,8 +720,7 @@ static UINT ImplSalGetWheelScrollChars() { // Depending on Windows version, use proper default or 1 (when // driver emulates hscroll) - if( VER_PLATFORM_WIN32_NT == aSalShlData.maVersionInfo.dwPlatformId && - aSalShlData.maVersionInfo.dwMajorVersion < 6 ) + if( aSalShlData.maVersionInfo.dwMajorVersion < 6 ) { // Windows 2000 & WinXP : emulating driver, use step size // of 1 @@ -5274,7 +5199,11 @@ static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam ) // Feststellen, ob wir IME unterstuetzen WinSalFrame* pFrame = GetWindowPtr( hWnd ); - if ( pFrame && pFrame->mbIME && pFrame->mhDefIMEContext ) + + if ( !pFrame ) + return; + + if ( pFrame->mbIME && pFrame->mhDefIMEContext ) { HKL hKL = (HKL)lParam; UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY ); diff --git a/vcl/win/source/window/salobj.cxx b/vcl/win/source/window/salobj.cxx index f79ad89fff45..f79ad89fff45 100755..100644 --- a/vcl/win/source/window/salobj.cxx +++ b/vcl/win/source/window/salobj.cxx |