diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-01-17 17:02:58 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-01-17 18:45:14 +0100 |
commit | 5169abbac92f30b950ab19c2c8e285c47fb1f0d7 (patch) | |
tree | 12dc79b6a99b1978982f816037a9c1bad23032f0 /vcl/source | |
parent | 3e5ff1f8d4da3470fa4016264c9410834a9736d8 (diff) |
bool improvements
Change-Id: I7ec4f5b2e691ec03e9e2c5ca3a004f1e04efbc27
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/fontsubset/cff.cxx | 32 | ||||
-rw-r--r-- | vcl/source/fontsubset/gsub.cxx | 6 | ||||
-rw-r--r-- | vcl/source/fontsubset/gsub.h | 2 | ||||
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 12 | ||||
-rw-r--r-- | vcl/source/fontsubset/ttcr.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/graphictools.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/impfont.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 26 | ||||
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 4 | ||||
-rw-r--r-- | vcl/source/helper/strhelper.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 152 |
13 files changed, 129 insertions, 127 deletions
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index cfd428242ed8..a9761a0b0b1b 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -288,7 +288,7 @@ sal_uInt16 ImplEntryList::FindMatchingEntry( const OUString& rStr, sal_uInt16 nS nStart++; // decrements right away const vcl::I18nHelper& rI18nHelper = mpWindow->GetSettings().GetLocaleI18nHelper(); - for ( sal_uInt16 n = nStart; bForward ? ( n < nEntryCount ) : n; ) + for ( sal_uInt16 n = nStart; bForward ? n < nEntryCount : n != 0; ) { if ( !bForward ) n--; diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 0fbe9407b633..d57b849ad965 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -1113,7 +1113,7 @@ void CffSubsetterContext::convertOneTypeEsc( void) break; case TYPE2OP::NOT: assert( mnStackIdx >= 1 ); - pTop[0] = (pTop[0] == 0); + pTop[0] = ValType(pTop[0] == 0); break; case TYPE2OP::ABS: assert( mnStackIdx >= 1 ); @@ -1148,7 +1148,7 @@ void CffSubsetterContext::convertOneTypeEsc( void) break; case TYPE2OP::EQ: assert( mnStackIdx >= 2 ); - pTop[0] = (pTop[0] == pTop[-1]); + pTop[0] = ValType(pTop[0] == pTop[-1]); --mnStackIdx; break; case TYPE2OP::DROP: @@ -2130,22 +2130,22 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, int nPrivEntryCount = 9; #if !defined(IGNORE_HINTS) // emit blue hints only if non-default values - nPrivEntryCount += !mpCffLocal->maOtherBlues.empty(); - nPrivEntryCount += !mpCffLocal->maFamilyBlues.empty(); - nPrivEntryCount += !mpCffLocal->maFamilyOtherBlues.empty(); - nPrivEntryCount += (mpCffLocal->mfBlueScale != 0.0); - nPrivEntryCount += (mpCffLocal->mfBlueShift != 0.0); - nPrivEntryCount += (mpCffLocal->mfBlueFuzz != 0.0); + nPrivEntryCount += int(!mpCffLocal->maOtherBlues.empty()); + nPrivEntryCount += int(!mpCffLocal->maFamilyBlues.empty()); + nPrivEntryCount += int(!mpCffLocal->maFamilyOtherBlues.empty()); + nPrivEntryCount += int(mpCffLocal->mfBlueScale != 0.0); + nPrivEntryCount += int(mpCffLocal->mfBlueShift != 0.0); + nPrivEntryCount += int(mpCffLocal->mfBlueFuzz != 0.0); // emit stem hints only if non-default values - nPrivEntryCount += (mpCffLocal->maStemStdHW != 0); - nPrivEntryCount += (mpCffLocal->maStemStdVW != 0); - nPrivEntryCount += !mpCffLocal->maStemSnapH.empty(); - nPrivEntryCount += !mpCffLocal->maStemSnapV.empty(); + nPrivEntryCount += int(mpCffLocal->maStemStdHW != 0); + nPrivEntryCount += int(mpCffLocal->maStemStdVW != 0); + nPrivEntryCount += int(!mpCffLocal->maStemSnapH.empty()); + nPrivEntryCount += int(!mpCffLocal->maStemSnapV.empty()); // emit other hints only if non-default values - nPrivEntryCount += (mpCffLocal->mfExpFactor != 0.0); - nPrivEntryCount += (mpCffLocal->mnLangGroup != 0); - nPrivEntryCount += (mpCffLocal->mnLangGroup == 1); - nPrivEntryCount += (mpCffLocal->mbForceBold != false); + nPrivEntryCount += int(mpCffLocal->mfExpFactor != 0.0); + nPrivEntryCount += int(mpCffLocal->mnLangGroup != 0); + nPrivEntryCount += int(mpCffLocal->mnLangGroup == 1); + nPrivEntryCount += int(mpCffLocal->mbForceBold != false); #endif // IGNORE_HINTS // emit the privdict header pOut += sprintf( pOut, diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index cf75d28cd4bf..e51fb2ee34f3 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -53,12 +53,12 @@ inline sal_uInt16 NEXT_UShort( const unsigned char* &p ) #define MKTAG(s) ((((((s[0]<<8)+s[1])<<8)+s[2])<<8)+s[3]) -int ReadGSUB( struct _TrueTypeFont* pTTFile, +bool ReadGSUB( struct _TrueTypeFont* pTTFile, int nRequestedScript, int nRequestedLangsys ) { const FT_Byte* pGsubBase = (FT_Byte*)pTTFile->tables[ O_gsub ]; if( !pGsubBase ) - return -1; + return false; // #129682# check offsets inside GSUB table const FT_Byte* pGsubLimit = pGsubBase + pTTFile->tlens[ O_gsub ]; @@ -73,7 +73,7 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, // sanity check the GSUB header if( nVersion != 0x00010000 ) if( nVersion != 0x00001000 ) // workaround for SunBatang etc. - return -1; // unknown format or broken + return false; // unknown format or broken typedef std::vector<sal_uLong> ReqFeatureTagList; ReqFeatureTagList aReqFeatureTagList; diff --git a/vcl/source/fontsubset/gsub.h b/vcl/source/fontsubset/gsub.h index 66ac7bc3a77f..b4111e48fa88 100644 --- a/vcl/source/fontsubset/gsub.h +++ b/vcl/source/fontsubset/gsub.h @@ -27,7 +27,7 @@ int HasVerticalGSUB( struct vcl::_TrueTypeFont* pTTFile ); int UseGSUB( struct vcl::_TrueTypeFont* pTTFile, int nGlyph, int wmode ); -int ReadGSUB( struct vcl::_TrueTypeFont* pTTFile, int nRequestedScript, int nRequestedLangsys ); +bool ReadGSUB( struct vcl::_TrueTypeFont* pTTFile, int nRequestedScript, int nRequestedLangsys ); void ReleaseGSUB( struct vcl::_TrueTypeFont* pTTFile ); diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 1fd3e8f4316f..23a15f64d1bb 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -715,9 +715,9 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat PSPathElement p( PS_NOOP ); int x0 = 0, y0 = 0, x1 = 0, y1 = 0, x2, y2, curx, cury; - int lastOff = 0; /*- last point was off-contour */ + bool lastOff = false; /*- last point was off-contour */ int scflag = 1; /*- start contour flag */ - int ecflag = 0; /*- end contour flag */ + bool ecflag = false; /*- end contour flag */ int cp = 0; /*- current point */ int StartContour = 0, EndContour = 1; @@ -753,7 +753,7 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat cp++; } aPathList.push_back( p ); - lastOff = 0; + lastOff = false; scflag = 0; } @@ -783,7 +783,7 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat aPathList.push_back( p ); } } - x0 = curx; y0 = cury; lastOff = 0; + x0 = curx; y0 = cury; lastOff = false; } else { @@ -810,7 +810,7 @@ static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **pat if (ecflag) { aPathList.push_back( PSPathElement(PS_CLOSEPATH) ); scflag = 1; - ecflag = 0; + ecflag = false; cp = EndContour + 1; if (cp >= srcCount) break; continue; @@ -2512,7 +2512,7 @@ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID) d->compflag = (GetInt16( srcptr, 0, 1 ) < 0); } else { d->ptr = 0; - d->compflag = 0; + d->compflag = false; } d->glyphID = glyphID; diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index f92db8caf4e3..d8a97c16b389 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -1370,7 +1370,7 @@ static void ProcessTables(TrueTypeCreator *tt) if (z > yMax) yMax = z; } - if (gd->compflag == 0) { /* non-composite glyph */ + if (!gd->compflag) { /* non-composite glyph */ if (gd->npoints > maxPoints) maxPoints = gd->npoints; if (gd->ncontours > maxContours) maxContours = gd->ncontours; } else { /* composite glyph */ diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 1ea6906ade0a..31d9d61d23a7 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -301,7 +301,7 @@ SvStream& WriteSvtGraphicFill( SvStream& rOStm, const SvtGraphicFill& rClass ) int i; for(i=0; i<SvtGraphicFill::Transform::MatrixSize; ++i) rOStm.WriteDouble( rClass.maFillTransform.matrix[i] ); - nTmp = rClass.mbTiling; + nTmp = sal_uInt16(rClass.mbTiling); rOStm.WriteUInt16( nTmp ); nTmp = sal::static_int_cast<sal_uInt16>( rClass.maHatchType ); rOStm.WriteUInt16( nTmp ); diff --git a/vcl/source/gdi/impfont.cxx b/vcl/source/gdi/impfont.cxx index 9b27e3a29cfb..09bb07e77e5c 100644 --- a/vcl/source/gdi/impfont.cxx +++ b/vcl/source/gdi/impfont.cxx @@ -174,7 +174,7 @@ int ImplFontCharMap::GetGlyphIndex( sal_UCS4 cChar ) const // check that we are inside any range if( (nRange == 0) && (cChar < mpRangeCodes[0]) ) { // symbol aliasing gives symbol fonts a second chance - const bool bSymbolic = (mpRangeCodes[0]>=0xF000) & (mpRangeCodes[1]<=0xF0FF); + const bool bSymbolic = (mpRangeCodes[0]>=0xF000) && (mpRangeCodes[1]<=0xF0FF); if( !bSymbolic ) return 0; // check for symbol aliasing (U+F0xx -> U+00xx) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index f7a73ea5e865..464062aadfd0 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2885,10 +2885,10 @@ bool PDFWriterImpl::emitTilings() CHECK_RETURN( updateObject( it->m_nObject ) ); CHECK_RETURN( writeBuffer( aTilingObj.getStr(), aTilingObj.getLength() ) ); checkAndEnableStreamEncryption( it->m_nObject ); - nTilingStreamSize = writeBuffer( it->m_pTilingStream->GetData(), nTilingStreamSize ); + bool written = writeBuffer( it->m_pTilingStream->GetData(), nTilingStreamSize ); delete it->m_pTilingStream; it->m_pTilingStream = NULL; - if( nTilingStreamSize == 0 ) + if( !written ) return false; disableStreamEncryption(); aTilingObj.setLength( 0 ); @@ -6329,8 +6329,8 @@ sal_Int32 PDFWriterImpl::emitOutputIntent() aLine.append( "/Filter/FlateDecode" ); #endif aLine.append( ">>\nstream\n" ); - CHECK_RETURN( updateObject( nICCObject ) ); - CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); + if ( !updateObject( nICCObject ) ) return 0; + if ( !writeBuffer( aLine.getStr(), aLine.getLength() ) ) return 0; //get file position sal_uInt64 nBeginStreamPos = 0; osl_getFilePos( m_aFile, &nBeginStreamPos ); @@ -6346,31 +6346,31 @@ sal_Int32 PDFWriterImpl::emitOutputIntent() std::vector<unsigned char> xBuffer(nBytesNeeded); cmsSaveProfileToMem(hProfile, &xBuffer[0], &nBytesNeeded); cmsCloseProfile(hProfile); - sal_Int32 nStreamSize = writeBuffer( &xBuffer[0], (sal_Int32) xBuffer.size() ); + bool written = writeBuffer( &xBuffer[0], (sal_Int32) xBuffer.size() ); disableStreamEncryption(); endCompression(); sal_uInt64 nEndStreamPos = 0; osl_getFilePos( m_aFile, &nEndStreamPos ); - if( nStreamSize == 0 ) + if( !written ) return 0; if( ! writeBuffer( "\nendstream\nendobj\n\n", 19 ) ) return 0 ; aLine.setLength( 0 ); //emit the stream length object - CHECK_RETURN( updateObject( nStreamLengthObject ) ); + if ( !updateObject( nStreamLengthObject ) ) return 0; aLine.setLength( 0 ); aLine.append( nStreamLengthObject ); aLine.append( " 0 obj\n" ); aLine.append( (sal_Int64)(nEndStreamPos-nBeginStreamPos) ); aLine.append( "\nendobj\n\n" ); - CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); + if ( !writeBuffer( aLine.getStr(), aLine.getLength() ) ) return 0; aLine.setLength( 0 ); //emit the OutputIntent dictionary sal_Int32 nOIObject = createObject(); - CHECK_RETURN( updateObject( nOIObject ) ); + if ( !updateObject( nOIObject ) ) return 0; aLine.append( nOIObject ); aLine.append( " 0 obj\n" "<</Type/OutputIntent/S/GTS_PDFA1/OutputConditionIdentifier"); @@ -6380,7 +6380,7 @@ sal_Int32 PDFWriterImpl::emitOutputIntent() aLine.append("/DestOutputProfile "); aLine.append( nICCObject ); aLine.append( " 0 R>>\nendobj\n\n" );; - CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); + if ( !writeBuffer( aLine.getStr(), aLine.getLength() ) ) return 0; return nOIObject; } @@ -6554,9 +6554,11 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata() aMetadataObj.append( (sal_Int32) aMetadataStream.getLength() ); aMetadataObj.append( ">>\nstream\n" ); - CHECK_RETURN( writeBuffer( aMetadataObj.getStr(), aMetadataObj.getLength() ) ); + if ( !writeBuffer( aMetadataObj.getStr(), aMetadataObj.getLength() ) ) + return 0; //emit the stream - CHECK_RETURN( writeBuffer( aMetadataStream.getStr(), aMetadataStream.getLength() ) ); + if ( !writeBuffer( aMetadataStream.getStr(), aMetadataStream.getLength() ) ) + return 0; aMetadataObj.setLength( 0 ); aMetadataObj.append( "\nendstream\nendobj\n\n" ); diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 51a79f15dd1d..30be7b152ed2 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -357,10 +357,10 @@ bool ImplLayoutRuns::AddPos( int nCharPos, bool bRTL ) { int nRunPos0 = maRuns[ nIndex-2 ]; int nRunPos1 = maRuns[ nIndex-1 ]; - if( ((nCharPos + bRTL) == nRunPos1) && ((nRunPos0 > nRunPos1) == bRTL) ) + if( ((nCharPos + int(bRTL)) == nRunPos1) && ((nRunPos0 > nRunPos1) == bRTL) ) { // extend current run by new charpos - maRuns[ nIndex-1 ] = nCharPos + !bRTL; + maRuns[ nIndex-1 ] = nCharPos + int(!bRTL); return false; } // ignore new charpos when it is in current run diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx index 41e82929d24a..b5a35266415c 100644 --- a/vcl/source/helper/strhelper.cxx +++ b/vcl/source/helper/strhelper.cxx @@ -23,7 +23,7 @@ namespace psp { -inline int isSpace( char cChar ) +inline bool isSpace( char cChar ) { return cChar == ' ' || cChar == '\t' || @@ -31,7 +31,7 @@ inline int isSpace( char cChar ) cChar == 0x0c || cChar == 0x0b; } -inline int isSpace( sal_Unicode cChar ) +inline bool isSpace( sal_Unicode cChar ) { return cChar == ' ' || cChar == '\t' || @@ -39,12 +39,12 @@ inline int isSpace( sal_Unicode cChar ) cChar == 0x0c || cChar == 0x0b; } -inline int isProtect( char cChar ) +inline bool isProtect( char cChar ) { return cChar == '`' || cChar == '\'' || cChar == '"'; } -inline int isProtect( sal_Unicode cChar ) +inline bool isProtect( sal_Unicode cChar ) { return cChar == '`' || cChar == '\'' || cChar == '"'; } diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index e3303ded6f53..e22114746f02 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -929,10 +929,10 @@ void VclGrid::calcMaxs(const array_type &A, std::vector<Value> &rWidths, std::ve sal_Int32 nHeight = rEntry.nSpanHeight; for (sal_Int32 nSpanX = 0; nSpanX < nWidth; ++nSpanX) - rWidths[x+nSpanX].m_bExpand = rWidths[x+nSpanX].m_bExpand | pChild->get_hexpand(); + rWidths[x+nSpanX].m_bExpand |= pChild->get_hexpand(); for (sal_Int32 nSpanY = 0; nSpanY < nHeight; ++nSpanY) - rHeights[y+nSpanY].m_bExpand = rHeights[y+nSpanY].m_bExpand | pChild->get_vexpand(); + rHeights[y+nSpanY].m_bExpand |= pChild->get_vexpand(); if (nWidth == 1 || nHeight == 1) { @@ -1034,7 +1034,7 @@ VclGrid::Value accumulateValues(const VclGrid::Value &i, const VclGrid::Value &j { VclGrid::Value aRet; aRet.m_nValue = i.m_nValue + j.m_nValue; - aRet.m_bExpand = i.m_bExpand | j.m_bExpand; + aRet.m_bExpand = i.m_bExpand || j.m_bExpand; return aRet; } diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index e6d3d23b5101..90d1b2c56093 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -325,14 +325,14 @@ static long ContextMenuEventLink( void* pCEvent, void* ) return 0; } -long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouseLeave, +bool ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouseLeave, long nX, long nY, sal_uLong nMsgTime, sal_uInt16 nCode, sal_uInt16 nMode ) { ImplSVData* pSVData = ImplGetSVData(); Point aMousePos( nX, nY ); Window* pChild; - long nRet; + bool nRet; sal_uInt16 nClicks; ImplFrameData* pWinFrameData = pWindow->ImplGetFrameData(); sal_uInt16 nOldCode = pWinFrameData->mnMouseCode; @@ -349,7 +349,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse if( pWindow->ImplGetWindow() == pSVData->maHelpData.mpHelpWin ) { ImplDestroyHelpWindow( false ); - return 1; // pWindow is dead now - avoid crash! + return true; // pWindow is dead now - avoid crash! } else ImplDestroyHelpWindow( true ); @@ -379,7 +379,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse ImplDestroyHelpWindow( true ); if ( aDelData.IsDead() ) - return 1; // pWindow is dead now - avoid crash! (#122045#) + return true; // pWindow is dead now - avoid crash! (#122045#) } } else @@ -393,7 +393,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse if ( pSVData->maWinData.mpAutoScrollWin && (nSVEvent == EVENT_MOUSEBUTTONDOWN) ) { pSVData->maWinData.mpAutoScrollWin->EndAutoScroll(); - return 1; + return true; } // find mouse window @@ -406,10 +406,10 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse // java client cannot capture mouse correctly if ( pWindow != pChild->ImplGetFrameWindow() ) - return 0; + return false; if ( bMouseLeave ) - return 0; + return false; } else { @@ -422,7 +422,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse // test this because mouse events are buffered in the remote version // and size may not be in sync if ( !pChild && !bMouseLeave ) - return 0; + return false; // execute a few tests and catch the message or implement the status if ( pChild ) @@ -435,7 +435,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse // no mouse messages to system object windows ? // !!!KA: Is it OK to comment this out? !!! // if ( pChild->ImplGetWindowImpl()->mpSysObj ) -// return 0; +// return false; // no mouse messages to disabled windows // #106845# if the window was disabed during capturing we have to pass the mouse events to release capturing @@ -462,14 +462,14 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse } if ( nSVEvent == EVENT_MOUSEBUTTONDOWN ) - return 1; + return true; else { // Set normal MousePointer for disabled windows if ( nSVEvent == EVENT_MOUSEMOVE ) ImplSetMousePointer( pChild ); - return 0; + return false; } } @@ -497,7 +497,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse // set mouse pointer anew, as it could have changed // due to the mode switch ImplSetMousePointer( pChild ); - return 0; + return false; } pWinFrameData->mnLastMouseWinX = aChildMousePos.X(); @@ -622,7 +622,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse pChild->ImplRemoveDel( &aDelData2 ); } if ( aDelData.IsDead() ) - return 1; + return true; pMouseMoveWin->ImplRemoveDel( &aDelData ); } @@ -634,7 +634,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse // MouseLeave if ( !pChild ) - return 0; + return false; } else { @@ -700,7 +700,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse pChild->ImplRemoveDel( &aDelData ); pChild->ImplGetFrameData()->mbStartDragCalled = sal_True; } - return 1; + return true; } else pChild->ImplRemoveDel( &aDelData ); @@ -724,14 +724,14 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse !(pChild->ImplGetFrameWindow()->GetStyle() & WB_OWNERDRAWDECORATION) ) // ownerdrawdecorated windows must never grab focus pChild->ToTop(); if ( aDelData.IsDead() ) - return 1; + return true; } if ( ImplCallPreNotify( aNEvt ) || aDelData.IsDead() ) - nRet = 1; + nRet = true; else { - nRet = 0; + nRet = false; if ( nSVEvent == EVENT_MOUSEMOVE ) { if ( pSVData->maWinData.mpTrackWin ) @@ -746,7 +746,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse pSVData->maWinData.mpTrackTimer->Start(); } bCallHelpRequest = sal_False; - nRet = 1; + nRet = true; } else { @@ -773,7 +773,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse { if ( pSVData->maWinData.mpTrackWin && !(pSVData->maWinData.mnTrackFlags & STARTTRACK_MOUSEBUTTONDOWN) ) - nRet = 1; + nRet = true; else { pChild->ImplGetWindowImpl()->mbMouseButtonDown = sal_False; @@ -785,7 +785,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse if ( pSVData->maWinData.mpTrackWin ) { pChild->EndTracking(); - nRet = 1; + nRet = true; } else { @@ -800,7 +800,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse } if ( aDelData.IsDead() ) - return 1; + return true; if ( nSVEvent == EVENT_MOUSEMOVE ) @@ -810,19 +810,19 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse { if ( bCallHelpRequest && !pSVData->maHelpData.mbKeyboardHelp ) ImplHandleMouseHelpRequest( pChild, pChild->OutputToScreenPixel( aMEvt.GetPosPixel() ) ); - nRet = 1; + nRet = true; } else if ( !nRet ) { if ( nSVEvent == EVENT_MOUSEBUTTONDOWN ) { if ( !pChild->ImplGetWindowImpl()->mbMouseButtonDown ) - nRet = 1; + nRet = true; } else { if ( !pChild->ImplGetWindowImpl()->mbMouseButtonUp ) - nRet = 1; + nRet = true; } } @@ -839,7 +839,7 @@ long ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, sal_Bool bMouse if ( !bDrag ) { // Command-Events - if ( /*(nRet == 0) &&*/ (nClicks == 1) && (nSVEvent == EVENT_MOUSEBUTTONDOWN) && + if ( /*!nRet &&*/ (nClicks == 1) && (nSVEvent == EVENT_MOUSEBUTTONDOWN) && (nCode == MOUSE_MIDDLE) ) { sal_uInt16 nMiddleAction = pChild->GetSettings().GetMouseSettings().GetMiddleButtonAction(); @@ -934,7 +934,7 @@ static Window* ImplGetKeyInputWindow( Window* pWindow ) // ----------------------------------------------------------------------- -static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, +static bool ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, sal_uInt16 nKeyCode, sal_uInt16 nCharCode, sal_uInt16 nRepeat, sal_Bool bForward ) { ImplSVData* pSVData = ImplGetSVData(); @@ -961,7 +961,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, break; } if( nVCLEvent && pSVData->mpApp->HandleKey( nVCLEvent, pWindow, &aKeyEvent ) ) - return 1; + return true; } // #i1820# use locale specific decimal separator @@ -987,7 +987,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, if ( aKeyCode.IsShift() && aKeyCode.IsMod1() && (aKeyCode.IsMod2() || aKeyCode.IsMod3()) && (aKeyCode.GetCode() == KEY_D) ) { DBGGUI_START(); - return 1; + return true; } #endif @@ -995,7 +995,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, { Help::EndExtHelp(); if ( nEvCode == KEY_ESCAPE ) - return 1; + return true; } if ( pSVData->maHelpData.mpHelpWin ) ImplDestroyHelpWindow( false ); @@ -1005,7 +1005,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, { pSVData->maWinData.mpAutoScrollWin->EndAutoScroll(); if ( nEvCode == KEY_ESCAPE ) - return 1; + return true; } if ( pSVData->maWinData.mpTrackWin ) @@ -1026,15 +1026,15 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); } } - return 1; + return true; } else if ( nOrigCode == KEY_RETURN ) { pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_KEY ); - return 1; + return true; } else if ( !(pSVData->maWinData.mnTrackFlags & STARTTRACK_KEYINPUT) ) - return 1; + return true; } // handle FloatingMode @@ -1049,7 +1049,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, { pLastLevelFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL ); if( !bCtrlF6 ) - return 1; + return true; } } } @@ -1058,14 +1058,14 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, if ( pSVData->maAppData.mpAccelMgr ) { if ( pSVData->maAppData.mpAccelMgr->IsAccelKey( aKeyCode, nRepeat ) ) - return 1; + return true; } } // find window Window* pChild = ImplGetKeyInputWindow( pWindow ); if ( !pChild ) - return 0; + return false; // --- RTL --- mirror cursor keys if( (aKeyCode.GetCode() == KEY_LEFT || aKeyCode.GetCode() == KEY_RIGHT) && @@ -1079,7 +1079,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, KeyEvent aKeyEvt( (sal_Unicode)nCharCode, aKeyCode, nRepeat ); NotifyEvent aNotifyEvt( nSVEvent, pChild, &aKeyEvt ); sal_Bool bKeyPreNotify = (ImplCallPreNotify( aNotifyEvt ) != 0); - long nRet = 1; + bool nRet = true; if ( !bKeyPreNotify && !aDelData.IsDead() ) { @@ -1099,7 +1099,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, } if ( aDelData.IsDead() ) - return 1; + return true; pChild->ImplRemoveDel( &aDelData ); @@ -1157,29 +1157,29 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, pChild->RequestHelp( aHelpEvent ); } else - nRet = 0; + nRet = false; } else if ( aKeyCode.IsShift() ) { if ( pSVData->maHelpData.mbExtHelp ) Help::StartExtHelp(); else - nRet = 0; + nRet = false; } } else { if ( ImplCallHotKey( aKeyCode ) ) - nRet = 1; + nRet = true; else - nRet = 0; + nRet = false; } } } else { if ( !bKeyPreNotify && pChild->ImplGetWindowImpl()->mbKeyUp ) - nRet = 0; + nRet = false; } // #105591# send keyinput to parent if we are a floating window and the key was not pocessed yet @@ -1193,7 +1193,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, NotifyEvent aNEvt( nSVEvent, pChild, &aKEvt ); sal_Bool bPreNotify = (ImplCallPreNotify( aNEvt ) != 0); if ( aChildDelData.IsDead() ) - return 1; + return true; if ( !bPreNotify ) { @@ -1211,11 +1211,11 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, if( !aChildDelData.IsDead() ) aNEvt.GetWindow()->ImplNotifyKeyMouseCommandEventListeners( aNEvt ); if ( aChildDelData.IsDead() ) - return 1; + return true; } if( bPreNotify || !pChild->ImplGetWindowImpl()->mbKeyInput ) - nRet = 1; + nRet = true; } return nRet; @@ -1223,7 +1223,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent, // ----------------------------------------------------------------------- -static long ImplHandleExtTextInput( Window* pWindow, +static bool ImplHandleExtTextInput( Window* pWindow, const OUString& rText, const sal_uInt16* pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags ) @@ -1239,7 +1239,7 @@ static long ImplHandleExtTextInput( Window* pWindow, { pChild = ImplGetKeyInputWindow( pWindow ); if ( !pChild ) - return 0; + return false; } if( !pChild->ImplGetWindowImpl()->mpFrameData->mnFocusId ) break; @@ -1264,7 +1264,7 @@ static long ImplHandleExtTextInput( Window* pWindow, // be aware of being recursively called in StartExtTextInput if ( !pChild->ImplGetWindowImpl()->mbExtTextInput ) - return 0; + return false; // Test for changes bool bOnlyCursor = false; @@ -1318,11 +1318,11 @@ static long ImplHandleExtTextInput( Window* pWindow, // ----------------------------------------------------------------------- -static long ImplHandleEndExtTextInput( Window* /* pWindow */ ) +static bool ImplHandleEndExtTextInput( Window* /* pWindow */ ) { ImplSVData* pSVData = ImplGetSVData(); Window* pChild = pSVData->maWinData.mpExtTextInputWin; - long nRet = 0; + bool nRet = false; if ( pChild ) { @@ -1394,7 +1394,7 @@ static void ImplHandleExtTextInputPos( Window* pWindow, // ----------------------------------------------------------------------- -static long ImplHandleInputContextChange( Window* pWindow, LanguageType eNewLang ) +static bool ImplHandleInputContextChange( Window* pWindow, LanguageType eNewLang ) { Window* pChild = ImplGetKeyInputWindow( pWindow ); CommandInputContextData aData( eNewLang ); @@ -1427,7 +1427,7 @@ static sal_Bool ImplCallWheelCommand( Window* pWindow, const Point& rPos, // ----------------------------------------------------------------------- -static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEvt, bool scaleDirectly = false ) +static bool ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEvt, bool scaleDirectly = false ) { ImplDelData aDogTag( pWindow ); @@ -1437,7 +1437,7 @@ static long ImplHandleWheelEvent( Window* pWindow, const SalWheelMouseEvent& rEv if ( pSVData->maHelpData.mpHelpWin ) ImplDestroyHelpWindow( true ); if( aDogTag.IsDead() ) - return 0; + return false; sal_uInt16 nMode; sal_uInt16 nCode = rEvt.mnCode; @@ -2017,7 +2017,7 @@ static sal_uInt16 ImplGetMouseButtonMode( SalMouseEvent* pEvent ) // ----------------------------------------------------------------------- -inline long ImplHandleSalMouseLeave( Window* pWindow, SalMouseEvent* pEvent ) +inline bool ImplHandleSalMouseLeave( Window* pWindow, SalMouseEvent* pEvent ) { return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, sal_True, pEvent->mnX, pEvent->mnY, @@ -2027,7 +2027,7 @@ inline long ImplHandleSalMouseLeave( Window* pWindow, SalMouseEvent* pEvent ) // ----------------------------------------------------------------------- -inline long ImplHandleSalMouseMove( Window* pWindow, SalMouseEvent* pEvent ) +inline bool ImplHandleSalMouseMove( Window* pWindow, SalMouseEvent* pEvent ) { return ImplHandleMouseEvent( pWindow, EVENT_MOUSEMOVE, sal_False, pEvent->mnX, pEvent->mnY, @@ -2037,7 +2037,7 @@ inline long ImplHandleSalMouseMove( Window* pWindow, SalMouseEvent* pEvent ) // ----------------------------------------------------------------------- -inline long ImplHandleSalMouseButtonDown( Window* pWindow, SalMouseEvent* pEvent ) +inline bool ImplHandleSalMouseButtonDown( Window* pWindow, SalMouseEvent* pEvent ) { return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONDOWN, sal_False, pEvent->mnX, pEvent->mnY, @@ -2052,7 +2052,7 @@ inline long ImplHandleSalMouseButtonDown( Window* pWindow, SalMouseEvent* pEvent // ----------------------------------------------------------------------- -inline long ImplHandleSalMouseButtonUp( Window* pWindow, SalMouseEvent* pEvent ) +inline bool ImplHandleSalMouseButtonUp( Window* pWindow, SalMouseEvent* pEvent ) { return ImplHandleMouseEvent( pWindow, EVENT_MOUSEBUTTONUP, sal_False, pEvent->mnX, pEvent->mnY, @@ -2067,17 +2067,17 @@ inline long ImplHandleSalMouseButtonUp( Window* pWindow, SalMouseEvent* pEvent ) // ----------------------------------------------------------------------- -static long ImplHandleSalMouseActivate( Window* /*pWindow*/, SalMouseActivateEvent* /*pEvent*/ ) +static bool ImplHandleSalMouseActivate( Window* /*pWindow*/, SalMouseActivateEvent* /*pEvent*/ ) { - return sal_False; + return false; } // ----------------------------------------------------------------------- -static long ImplHandleMenuEvent( Window* pWindow, SalMenuEvent* pEvent, sal_uInt16 nEvent ) +static bool ImplHandleMenuEvent( Window* pWindow, SalMenuEvent* pEvent, sal_uInt16 nEvent ) { // Find SystemWindow and its Menubar and let it dispatch the command - long nRet = 0; + bool nRet = false; Window *pWin = pWindow->ImplGetWindowImpl()->mpFirstChild; while ( pWin ) { @@ -2093,19 +2093,19 @@ static long ImplHandleMenuEvent( Window* pWindow, SalMenuEvent* pEvent, sal_uInt switch( nEvent ) { case SALEVENT_MENUACTIVATE: - nRet = pMenuBar->HandleMenuActivateEvent( (Menu*) pEvent->mpMenu ) ? 1 : 0; + nRet = pMenuBar->HandleMenuActivateEvent( (Menu*) pEvent->mpMenu ); break; case SALEVENT_MENUDEACTIVATE: - nRet = pMenuBar->HandleMenuDeActivateEvent( (Menu*) pEvent->mpMenu ) ? 1 : 0; + nRet = pMenuBar->HandleMenuDeActivateEvent( (Menu*) pEvent->mpMenu ); break; case SALEVENT_MENUHIGHLIGHT: - nRet = pMenuBar->HandleMenuHighlightEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ) ? 1 : 0; + nRet = pMenuBar->HandleMenuHighlightEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ); break; case SALEVENT_MENUBUTTONCOMMAND: - nRet = pMenuBar->HandleMenuButtonEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ) ? 1 : 0; + nRet = pMenuBar->HandleMenuButtonEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ); break; case SALEVENT_MENUCOMMAND: - nRet = pMenuBar->HandleMenuCommandEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ) ? 1 : 0; + nRet = pMenuBar->HandleMenuCommandEvent( (Menu*) pEvent->mpMenu, pEvent->mnId ); break; default: break; @@ -2249,10 +2249,10 @@ static void ImplHandleSalExtTextInputPos( Window* pWindow, SalExtTextInputPosEve // ----------------------------------------------------------------------- -static long ImplHandleShowDialog( Window* pWindow, int nDialogId ) +static bool ImplHandleShowDialog( Window* pWindow, int nDialogId ) { if( ! pWindow ) - return sal_False; + return false; if( pWindow->GetType() == WINDOW_BORDERWINDOW ) { @@ -2381,18 +2381,18 @@ static void ImplHandleSalQueryCharPosition( Window *pWindow, // ----------------------------------------------------------------------- -long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, +bool ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, sal_uInt16 nEvent, const void* pEvent ) { DBG_TESTSOLARMUTEX(); - long nRet = 0; + bool nRet = false; // #119709# for some unknown reason it is possible to receive events (in this case key events) // although the corresponding VCL window must have been destroyed already // at least ImplGetWindowImpl() was NULL in these cases, so check this here if( pWindow->ImplGetWindowImpl() == NULL ) - return 0; + return false; switch ( nEvent ) { @@ -2565,15 +2565,15 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/, { // Message-Schleife beenden Application::Quit(); - return sal_False; + return false; } else { bInQueryExit = false; - return sal_True; + return true; } } - return sal_False; + return false; } case SALEVENT_SETTINGSCHANGED: |