summaryrefslogtreecommitdiff
path: root/vcl/aqua/source
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-07-14 19:09:11 +0000
committerArmin Le Grand <alg@apache.org>2014-07-14 19:09:11 +0000
commit3c1d4742e649fe9c8aed8c2817fe3e1f3364f298 (patch)
treee0c6e02c89aa9227726c9469da1001b3e29c41df /vcl/aqua/source
parentc5c31e2aeaedbdf76e1f38d3c385e34f5ed875ca (diff)
Resync to trunk, windows non-pro build aoo/aw080
Diffstat (limited to 'vcl/aqua/source')
-rw-r--r--vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm5
-rw-r--r--vcl/aqua/source/a11y/aqua11ytextwrapper.mm6
-rw-r--r--vcl/aqua/source/a11y/documentfocuslistener.cxx51
-rw-r--r--vcl/aqua/source/app/salinst.cxx15
-rw-r--r--vcl/aqua/source/gdi/atsfonts.cxx2
-rw-r--r--vcl/aqua/source/gdi/ctfonts.cxx27
-rw-r--r--vcl/aqua/source/gdi/ctfonts.hxx2
-rw-r--r--vcl/aqua/source/gdi/ctlayout.cxx86
-rw-r--r--vcl/aqua/source/gdi/salgdiutils.cxx7
-rw-r--r--vcl/aqua/source/gdi/salnativewidgets.cxx2
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx2
-rw-r--r--vcl/aqua/source/window/salframeview.mm104
12 files changed, 169 insertions, 140 deletions
diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
index 39ec4461da92..5f30b34cf7fd 100644
--- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
@@ -227,12 +227,13 @@ using namespace ::rtl;
[ string beginEditing ];
// add default attributes for whole string
Sequence < PropertyValue > defaultAttributes = [ wrapper accessibleTextAttributes ] -> getDefaultAttributes ( emptySequence );
- [ AquaA11yTextAttributesWrapper applyAttributesFrom: defaultAttributes toString: string forRange: [ origRange rangeValue ] storeDefaultsTo: wrapper getDefaultsFrom: nil ];
+ NSRange offsetRange = NSMakeRange ( 0, len );
+ [ AquaA11yTextAttributesWrapper applyAttributesFrom: defaultAttributes toString: string forRange: offsetRange storeDefaultsTo: wrapper getDefaultsFrom: nil ];
// add attributes for attribute run(s)
while ( currentIndex < endIndex ) {
TextSegment textSegment = [ wrapper accessibleText ] -> getTextAtIndex ( currentIndex, AccessibleTextType::ATTRIBUTE_RUN );
int endOfRange = endIndex > textSegment.SegmentEnd ? textSegment.SegmentEnd : endIndex;
- NSRange rangeForAttributeRun = NSMakeRange ( currentIndex, endOfRange - currentIndex );
+ NSRange rangeForAttributeRun = NSMakeRange ( currentIndex-loc, endOfRange - currentIndex );
// add run attributes
Sequence < PropertyValue > attributes = [ wrapper accessibleTextAttributes ] -> getRunAttributes ( currentIndex, emptySequence );
[ AquaA11yTextAttributesWrapper applyAttributesFrom: attributes toString: string forRange: rangeForAttributeRun storeDefaultsTo: nil getDefaultsFrom: wrapper ];
diff --git a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
index 1320b09fe27a..616bf084e7b4 100644
--- a/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytextwrapper.mm
@@ -210,7 +210,11 @@ using namespace ::rtl;
+(id)rangeForPositionAttributeForElement:(AquaA11yWrapper *)wrapper forParameter:(id)point {
NSValue * value = nil;
- sal_Int32 index = [ wrapper accessibleText ] -> getIndexAtPoint ( [ AquaA11yUtil nsPointToVclPoint: point ] );
+ Point aPoint( [ AquaA11yUtil nsPointToVclPoint: point ]);
+ const Point screenPos = [ wrapper accessibleComponent ] -> getLocationOnScreen();
+ aPoint.X -= screenPos.X;
+ aPoint.Y -= screenPos.Y;
+ sal_Int32 index = [ wrapper accessibleText ] -> getIndexAtPoint( aPoint );
if ( index > -1 ) {
value = [ AquaA11yTextWrapper rangeForIndexAttributeForElement: wrapper forParameter: [ NSNumber numberWithLong: index ] ];
}
diff --git a/vcl/aqua/source/a11y/documentfocuslistener.cxx b/vcl/aqua/source/a11y/documentfocuslistener.cxx
index 3fbda71a43ed..b15d4f8fccfe 100644
--- a/vcl/aqua/source/a11y/documentfocuslistener.cxx
+++ b/vcl/aqua/source/a11y/documentfocuslistener.cxx
@@ -65,10 +65,10 @@ void SAL_CALL
DocumentFocusListener::notifyEvent( const AccessibleEventObject& aEvent )
throw( RuntimeException )
{
- switch( aEvent.EventId )
- {
- case AccessibleEventId::STATE_CHANGED:
- try
+ try {
+ switch( aEvent.EventId )
+ {
+ case AccessibleEventId::STATE_CHANGED:
{
sal_Int16 nState = AccessibleStateType::INVALID;
aEvent.NewValue >>= nState;
@@ -76,34 +76,35 @@ DocumentFocusListener::notifyEvent( const AccessibleEventObject& aEvent )
if( AccessibleStateType::FOCUSED == nState )
m_aFocusTracker.setFocusedObject( getAccessible(aEvent) );
}
- catch(IndexOutOfBoundsException e)
- {
- OSL_TRACE("Focused object has invalid index in parent");
- }
break;
- case AccessibleEventId::CHILD:
- {
- Reference< XAccessible > xChild;
- if( (aEvent.OldValue >>= xChild) && xChild.is() )
- detachRecursive(xChild);
+ case AccessibleEventId::CHILD:
+ {
+ Reference< XAccessible > xChild;
+ if( (aEvent.OldValue >>= xChild) && xChild.is() )
+ detachRecursive(xChild);
- if( (aEvent.NewValue >>= xChild) && xChild.is() )
- attachRecursive(xChild);
- }
+ if( (aEvent.NewValue >>= xChild) && xChild.is() )
+ attachRecursive(xChild);
+ }
break;
- case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
- {
- Reference< XAccessible > xAccessible( getAccessible(aEvent) );
- detachRecursive(xAccessible);
- attachRecursive(xAccessible);
- }
-
+ case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
+ {
+ Reference< XAccessible > xAccessible( getAccessible(aEvent) );
+ detachRecursive(xAccessible);
+ attachRecursive(xAccessible);
+ }
OSL_TRACE( "Invalidate all children called\n" );
break;
- default:
- break;
+
+ default:
+ break;
+ }
+ }
+ catch(IndexOutOfBoundsException e)
+ {
+ OSL_TRACE("Focused object has invalid index in parent");
}
}
diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx
index 5bf7944ce591..819b16263b39 100644
--- a/vcl/aqua/source/app/salinst.cxx
+++ b/vcl/aqua/source/app/salinst.cxx
@@ -303,32 +303,29 @@ void InitSalMain()
// Assign to PATH environment variable
if ( aCmdPath.Len() )
{
- aTmpPath = ByteString( "PATH=" );
- aTmpPath += aCmdPath;
+ aTmpPath = aCmdPath;
if ( aPath.Len() )
aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
aTmpPath += aPath;
- putenv( (char*)aTmpPath.GetBuffer() );
+ setenv( "PATH", aTmpPath.GetBuffer(), TRUE );
}
// Assign to STAR_RESOURCEPATH environment variable
if ( aCmdPath.Len() )
{
- aTmpPath = ByteString( "STAR_RESOURCEPATH=" );
- aTmpPath += aCmdPath;
+ aTmpPath = aCmdPath;
if ( aResPath.Len() )
aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
aTmpPath += aResPath;
- putenv( (char*)aTmpPath.GetBuffer() );
+ setenv( "STAR_RESOURCEPATH", aTmpPath.GetBuffer(), TRUE );
}
// Assign to DYLD_LIBRARY_PATH environment variable
if ( aCmdPath.Len() )
{
- aTmpPath = ByteString( "DYLD_LIBRARY_PATH=" );
- aTmpPath += aCmdPath;
+ aTmpPath = aCmdPath;
if ( aLibPath.Len() )
aTmpPath += ByteString( DirEntry::GetSearchDelimiter(), RTL_TEXTENCODING_ASCII_US );
aTmpPath += aLibPath;
- putenv( (char*)aTmpPath.GetBuffer() );
+ setenv( "DYLD_LIBRARY_PATH", aTmpPath.GetBuffer(), TRUE );
}
}
}
diff --git a/vcl/aqua/source/gdi/atsfonts.cxx b/vcl/aqua/source/gdi/atsfonts.cxx
index ce8d993afbd4..7c6960feda84 100644
--- a/vcl/aqua/source/gdi/atsfonts.cxx
+++ b/vcl/aqua/source/gdi/atsfonts.cxx
@@ -393,7 +393,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF
continue;
// heuristic to find the most common font name
- // prefering default language names or even better the names matching to the UI language
+ // preferring default language names or even better the names matching to the UI language
int nNameValue = (eFontNameLanguage==eUILangCode) ? 0 : ((eFontNameLanguage==0) ? -10 : -20);
rtl_TextEncoding eEncoding = RTL_TEXTENCODING_UNICODE;
const int nPlatformEncoding = ((int)eFontNamePlatform << 8) + (int)eFontNameScript;
diff --git a/vcl/aqua/source/gdi/ctfonts.cxx b/vcl/aqua/source/gdi/ctfonts.cxx
index d7f3a2daa801..5ff8c057bc90 100644
--- a/vcl/aqua/source/gdi/ctfonts.cxx
+++ b/vcl/aqua/source/gdi/ctfonts.cxx
@@ -140,6 +140,9 @@ CTTextStyle::CTTextStyle( const ImplFontSelectData& rFSD )
CFDictionarySetValue( mpStyleDict, kCTFontAttributeName, pNewCTFont );
CFRelease( pNewCTFont);
+ // allow delayed setting the font color, i.e. after the text layout
+ CFDictionarySetValue( mpStyleDict, kCTForegroundColorFromContextAttributeName, kCFBooleanTrue );
+
// handle emulation of bold styles if requested and the font that doesn't provide them
if( (pReqFont->meWeight > WEIGHT_MEDIUM)
&& (mpFontData->meWeight <= WEIGHT_MEDIUM)
@@ -176,10 +179,13 @@ void CTTextStyle::GetFontMetric( float fDPIY, ImplFontMetricData& rMetric ) cons
CTFontRef aCTFontRef = (CTFontRef)CFDictionaryGetValue( mpStyleDict, kCTFontAttributeName );
const double fPixelSize = (mfFontScale * fDPIY);
- rMetric.mnAscent = lrint( CTFontGetAscent( aCTFontRef ) * fPixelSize);
+ const CGFloat fAscent = CTFontGetAscent( aCTFontRef );
+ const CGFloat fCapHeight = CTFontGetCapHeight( aCTFontRef );
+ rMetric.mnAscent = lrint( fAscent * fPixelSize);
rMetric.mnDescent = lrint( CTFontGetDescent( aCTFontRef ) * fPixelSize);
- rMetric.mnIntLeading = lrint( CTFontGetLeading( aCTFontRef ) * fPixelSize);
- rMetric.mnExtLeading = 0;
+ rMetric.mnExtLeading = lrint( CTFontGetLeading( aCTFontRef ) * fPixelSize);
+ rMetric.mnIntLeading = lrint( (fAscent - fCapHeight) * fPixelSize);
+
// since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
// setting this width to the pixel height of the fontsize is good enough
// it also makes the calculation of the stretch factor simple
@@ -279,21 +285,6 @@ bool CTTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon
return true;
}
-// -----------------------------------------------------------------------
-
-void CTTextStyle::SetTextColor( const RGBAColor& rColor )
-{
-#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
- CGColorRef pCGColor = CGColorCreateGenericRGB( rColor.GetRed(),
- rColor.GetGreen(), rColor.GetBlue(), rColor.GetAlpha() );
-#else // for builds on OSX 10.4 SDK
- const CGColorSpaceRef pCGColorSpace = GetSalData()->mxRGBSpace;
- CGColorRef pCGColor = CGColorCreate( pCGColorSpace, rColor.AsArray() );
-#endif
- CFDictionarySetValue( mpStyleDict, kCTForegroundColorAttributeName, pCGColor );
- CFRelease( pCGColor);
-}
-
// =======================================================================
CTFontData::CTFontData( const ImplDevFontAttributes& rDFA, sal_IntPtr nFontId )
diff --git a/vcl/aqua/source/gdi/ctfonts.hxx b/vcl/aqua/source/gdi/ctfonts.hxx
index 3ad46e9cb057..c8118dd17b56 100644
--- a/vcl/aqua/source/gdi/ctfonts.hxx
+++ b/vcl/aqua/source/gdi/ctfonts.hxx
@@ -39,7 +39,7 @@ public:
virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) const;
virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) const;
- virtual void SetTextColor( const RGBAColor& );
+ virtual void SetTextColor( const RGBAColor& ) {}
private:
/// CoreText text style object
diff --git a/vcl/aqua/source/gdi/ctlayout.cxx b/vcl/aqua/source/gdi/ctlayout.cxx
index 88b912f74fc0..aac5e77f8d52 100644
--- a/vcl/aqua/source/gdi/ctlayout.cxx
+++ b/vcl/aqua/source/gdi/ctlayout.cxx
@@ -52,9 +52,8 @@ public:
virtual void Simplify( bool bIsBase );
private:
- const CTTextStyle* const mpTextStyle;
-
// CoreText specific objects
+ CFMutableDictionaryRef mpStyleDict;
CFAttributedStringRef mpAttrString;
CTLineRef mpCTLine;
@@ -67,6 +66,9 @@ private:
// in these cases the font scale becomes something bigger than 1.0
float mfFontScale; // TODO: does CoreText have a font size limit?
+ CGFloat mfFontRotation; // text direction angle (in radians)
+ CGFloat mfFontStretch; // <1.0: font gets squeezed, >1.0: font gets stretched
+
// cached details about the resulting layout
// mutable members since these details are all lazy initialized
mutable double mfCachedWidth; // cached value of resulting typographical width
@@ -79,17 +81,19 @@ private:
// =======================================================================
CTLayout::CTLayout( const CTTextStyle* pTextStyle )
-: mpTextStyle( pTextStyle )
+: mpStyleDict( pTextStyle->GetStyleDict() )
, mpAttrString( NULL )
, mpCTLine( NULL )
, mnCharCount( 0 )
, mnTrailingSpaceCount( 0 )
, mfTrailingSpaceWidth( 0.0 )
, mfFontScale( pTextStyle->mfFontScale )
+, mfFontRotation( pTextStyle->mfFontRotation )
+, mfFontStretch( pTextStyle->mfFontStretch )
, mfCachedWidth( -1 )
, mnBaseAdv( 0 )
{
- CFRetain( mpTextStyle->GetStyleDict() );
+ CFRetain( mpStyleDict );
}
// -----------------------------------------------------------------------
@@ -100,13 +104,14 @@ CTLayout::~CTLayout()
CFRelease( mpCTLine );
if( mpAttrString )
CFRelease( mpAttrString );
- CFRelease( mpTextStyle->GetStyleDict() );
+ CFRelease( mpStyleDict );
}
// -----------------------------------------------------------------------
bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
{
+ // release an eventual older layout
if( mpAttrString )
CFRelease( mpAttrString );
mpAttrString = NULL;
@@ -114,6 +119,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
CFRelease( mpCTLine );
mpCTLine = NULL;
+ // initialize the new layout
SalLayout::AdjustLayout( rArgs );
mnCharCount = mnEndCharPos - mnMinCharPos;
@@ -121,9 +127,17 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
if( mnCharCount <= 0 )
return false;
- // create the CoreText line layout
+ // prepare the string to be layouted by CoreText
CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( NULL, rArgs.mpStr + mnMinCharPos, mnCharCount, kCFAllocatorNull );
- mpAttrString = CFAttributedStringCreate( NULL, aCFText, mpTextStyle->GetStyleDict() );
+ // #i124375# force soft-hyphen visibility to meet the expectations of Writer+EditEngine
+ if( CFStringFind( aCFText, (CFStringRef)@"\u00AD", 0).length > 0 )
+ {
+ NSString* pDashStr = [(NSString*)aCFText stringByReplacingOccurrencesOfString: @"\u00AD" withString: @"-"];
+ aCFText = CFStringCreateCopy( NULL, (CFStringRef)pDashStr );
+ }
+
+ // create the CoreText line layout using the requested text style
+ mpAttrString = CFAttributedStringCreate( NULL, aCFText, mpStyleDict );
mpCTLine = CTLineCreateWithAttributedString( mpAttrString );
CFRelease( aCFText);
@@ -193,7 +207,7 @@ void CTLayout::AdjustLayout( ImplLayoutArgs& rArgs )
CFRelease( mpCTLine );
CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( NULL, rArgs.mpStr + mnMinCharPos,
mnCharCount - mnTrailingSpaceCount, kCFAllocatorNull );
- CFAttributedStringRef pAttrStr = CFAttributedStringCreate( NULL, aCFText, mpTextStyle->GetStyleDict() );
+ CFAttributedStringRef pAttrStr = CFAttributedStringCreate( NULL, aCFText, mpStyleDict );
mpCTLine = CTLineCreateWithAttributedString( pAttrStr );
CFRelease( aCFText);
CFRelease( pAttrStr );
@@ -237,23 +251,21 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const
CGContextScaleCTM( rAquaGraphics.mrContext, +mfFontScale, -mfFontScale );
CGContextSetShouldAntialias( rAquaGraphics.mrContext, !rAquaGraphics.mbNonAntialiasedText );
- // Draw the text
+ // set the text transformation (e.g. position)
const Point aVclPos = GetDrawPosition( Point(mnBaseAdv,0) );
CGPoint aTextPos = { +aVclPos.X()/mfFontScale, -aVclPos.Y()/mfFontScale };
- if( mpTextStyle->mfFontRotation != 0.0 )
+ if( mfFontRotation != 0.0 )
{
- const CGFloat fRadians = mpTextStyle->mfFontRotation;
- CGContextRotateCTM( rAquaGraphics.mrContext, +fRadians );
+ CGContextRotateCTM( rAquaGraphics.mrContext, +mfFontRotation );
- const CGAffineTransform aInvMatrix = CGAffineTransformMakeRotation( -fRadians );
+ const CGAffineTransform aInvMatrix = CGAffineTransformMakeRotation( -mfFontRotation );
aTextPos = CGPointApplyAffineTransform( aTextPos, aInvMatrix );
}
CGContextSetTextPosition( rAquaGraphics.mrContext, aTextPos.x, aTextPos.y );
- CTLineDraw( mpCTLine, rAquaGraphics.mrContext );
- // request an update of the changed window area
+ // request an update of the to-be-changed window area
if( rAquaGraphics.IsWindowGraphics() )
{
const CGRect aInkRect = CTLineGetImageBounds( mpCTLine, rAquaGraphics.mrContext );
@@ -261,6 +273,12 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const
rAquaGraphics.RefreshRect( aRefreshRect );
}
+ // set the text color as fill color (see kCTForegroundColorFromContextAttributeName)
+ CGContextSetFillColor( rAquaGraphics.mrContext, rAquaGraphics.maTextColor.AsArray() );
+
+ // draw the text
+ CTLineDraw( mpCTLine, rAquaGraphics.mrContext );
+
// restore the original graphic context transformations
CGContextRestoreGState( rAquaGraphics.mrContext );
}
@@ -345,12 +363,12 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
// convert glyph details for VCL
*(pOutGlyphIds++) = pCGGlyphIdx[ nSubIndex ];
if( pGlyphAdvances )
- *(pGlyphAdvances++) = pCGGlyphAdvs[ nSubIndex ].width;
+ *(pGlyphAdvances++) = mfFontStretch * pCGGlyphAdvs[ nSubIndex ].width;
if( pCharIndexes )
*(pCharIndexes++) = pCGGlyphStrIdx[ nSubIndex] + mnMinCharPos;
if( !nCount++ ) {
const CGPoint& rCurPos = pCGGlyphPos[ nSubIndex ];
- rPos = GetDrawPosition( Point( mfFontScale * rCurPos.x, mfFontScale * rCurPos.y) );
+ rPos = GetDrawPosition( Point( mfFontScale * mfFontStretch * rCurPos.x, mfFontScale * rCurPos.y) );
}
}
nSubIndex = 0; // prepare for the next glyph run
@@ -433,13 +451,35 @@ int CTLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const
return STRING_LEN;
CTTypesetterRef aCTTypeSetter = CTTypesetterCreateWithAttributedString( mpAttrString );
- const double fCTMaxWidth = (double)nMaxWidth / (nFactor * mfFontScale);
- CFIndex nIndex = CTTypesetterSuggestClusterBreak( aCTTypeSetter, 0, fCTMaxWidth );
- if( nIndex >= mnCharCount )
- return STRING_LEN;
- nIndex += mnMinCharPos;
- return (int)nIndex;
+ CFIndex nBestGuess = (nCharExtra >= 0) ? 0 : mnCharCount;
+ for( int i = 1; i <= mnCharCount; i *= 2 )
+ {
+ // guess the target width considering char-extra expansion/condensation
+ const long nTargetWidth = nMaxWidth - nBestGuess * nCharExtra;
+ const double fCTMaxWidth = nTargetWidth / (nFactor * mfFontScale);
+ // calculate the breaking index for the guessed target width
+ const CFIndex nNewIndex = CTTypesetterSuggestClusterBreak( aCTTypeSetter, 0, fCTMaxWidth );
+ if( nNewIndex >= mnCharCount ) {
+ CFRelease( aCTTypeSetter );
+ return STRING_LEN;
+ }
+ // check if the original extra-width guess was good
+ if( !nCharExtra )
+ nBestGuess = nNewIndex;
+ if( nBestGuess == nNewIndex )
+ break;
+ // prepare another round for a different number of characters
+ CFIndex nNewGuess = (nNewIndex + nBestGuess + 1) / 2;
+ if( nNewGuess == nBestGuess )
+ nNewGuess += (nNewIndex > nBestGuess) ? +1 : -1;
+ nBestGuess = nNewGuess;
+ }
+
+ // suggest the best fitting cluster break as breaking position
+ CFRelease( aCTTypeSetter );
+ const int nIndex = nBestGuess + mnMinCharPos;
+ return nIndex;
}
// -----------------------------------------------------------------------
diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx
index a219609e6e9c..ca120d038644 100644
--- a/vcl/aqua/source/gdi/salgdiutils.cxx
+++ b/vcl/aqua/source/gdi/salgdiutils.cxx
@@ -243,10 +243,13 @@ void AquaSalGraphics::RefreshRect(float lX, float lY, float lWidth, float lHeigh
{
// update a little more around the designated rectangle
// this helps with antialiased rendering
+ // Rounding down x and width can accumulate a rounding error of up to 2
+ // The decrementing of x, the rounding error and the antialiasing border
+ // require that the width and the height need to be increased by four
const Rectangle aVclRect(Point(static_cast<long int>(lX-1),
static_cast<long int>(lY-1) ),
- Size( static_cast<long int>(lWidth+2),
- static_cast<long int>(lHeight+2) ) );
+ Size( static_cast<long int>(lWidth+4),
+ static_cast<long int>(lHeight+4) ) );
mpFrame->maInvalidRect.Union( aVclRect );
}
}
diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx
index f49e56ba7f78..37d23b5f7161 100644
--- a/vcl/aqua/source/gdi/salnativewidgets.cxx
+++ b/vcl/aqua/source/gdi/salnativewidgets.cxx
@@ -533,7 +533,7 @@ sal_Bool AquaSalGraphics::drawNativeControl(ControlType nType,
HIThemeBackgroundDrawInfo aThemeBackgroundInfo;
aThemeBackgroundInfo.version = 0;
aThemeBackgroundInfo.state = getState( nState );
- aThemeBackgroundInfo.kind = kThemeBrushDialogBackgroundInactive;
+ aThemeBackgroundInfo.kind = kThemeBrushDialogBackgroundActive;
// FIXME: without this magical offset there is a 2 pixel black border on the right and bottom
rc.size.width += 2;
rc.size.height += 2;
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index 6bb3a057f59a..ae5edf5d7cc5 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -312,7 +312,7 @@ static bool getUseNativeDialog()
{
// get service provider
uno::Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() );
- // create configuration hierachical access name
+ // create configuration hierarchical access name
if( xSMgr.is() )
{
try
diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm
index e21727ae3af3..4e0bbd14503f 100644
--- a/vcl/aqua/source/window/salframeview.mm
+++ b/vcl/aqua/source/window/salframeview.mm
@@ -20,7 +20,6 @@
*************************************************************/
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
@@ -37,13 +36,6 @@
#define WHEEL_EVENT_FACTOR 1.5
-// for allowing fullscreen support on deployment targets < OSX 10.7
-#if !defined(MAC_OS_X_VERSION_10_7)
- #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7)
- #define NSWindowCollectionBehaviorFullScreenAuxiliary (1 << 8)
-// #define NSFullScreenWindowMask (1 << 14)
-#endif
-
static sal_uInt16 ImplGetModifierMask( unsigned int nMask )
{
@@ -80,15 +72,15 @@ static sal_uInt16 ImplMapCharCode( sal_Unicode aCode )
KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U, KEY_V, KEY_W,
KEY_X, KEY_Y, KEY_Z, 0, 0, 0, KEY_TILDE, KEY_BACKSPACE
};
-
+
// Note: the mapping 0x7f should by rights be KEY_DELETE
// however if you press "backspace" 0x7f is reported
// whereas for "delete" 0xf728 gets reported
-
+
// Note: the mapping of 0x19 to KEY_TAB is because for unknown reasons
// tab alone is reported as 0x09 (as expected) but shift-tab is
// reported as 0x19 (end of medium)
-
+
static sal_uInt16 aFunctionKeyCodeMap[ 128 ] =
{
KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_F1, KEY_F2, KEY_F3, KEY_F4,
@@ -108,7 +100,7 @@ static sal_uInt16 ImplMapCharCode( sal_Unicode aCode )
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
-
+
sal_uInt16 nKeyCode = 0;
if( aCode < sizeof( aKeyCodeMap) / sizeof( aKeyCodeMap[0] ) )
nKeyCode = aKeyCodeMap[ aCode ];
@@ -179,7 +171,7 @@ static AquaSalFrame* getMouseContainerFrame()
[pNSWindow performSelector:setRestorable withObject:(id)NO];
}
- return pNSWindow;
+ return (SalFrameWindow*)pNSWindow;
}
-(AquaSalFrame*)getSalFrame
@@ -237,7 +229,7 @@ static AquaSalFrame* getMouseContainerFrame()
static const sal_uLong nGuessDocument = SAL_FRAME_STYLE_MOVEABLE|
SAL_FRAME_STYLE_SIZEABLE|
SAL_FRAME_STYLE_CLOSEABLE;
-
+
if( mpFrame->mpMenu )
mpFrame->mpMenu->setMainMenu();
else if( ! mpFrame->mpParent &&
@@ -489,7 +481,7 @@ static AquaSalFrame* getMouseContainerFrame()
}
// helper class similar to a vos::OGuard for the SalYieldMutex
-// the difference is that it only does tryToAcquire instead of aquire
+// the difference is that it only does tryToAcquire instead of acquire
// so dreaded deadlocks like #i93512# are prevented
class TryGuard
{
@@ -547,7 +539,7 @@ private:
pDispatchFrame = s_pMouseFrame;
else
pDispatchFrame = mpFrame;
-
+
/* #i81645# Cocoa reports mouse events while a button is pressed
to the window in which it was first pressed. This is reasonable and fine and
gets one around most cases where on other platforms one uses CaptureMouse or XGrabPointer,
@@ -560,7 +552,7 @@ private:
// is this event actually inside that NSWindow ?
NSPoint aPt = [NSEvent mouseLocation];
NSRect aFrameRect = [pDispatchFrame->getNSWindow() frame];
-
+
if ( ! NSPointInRect( aPt, aFrameRect ) )
{
// no, it is not
@@ -573,7 +565,7 @@ private:
NSWindow* pWindow = [NSApp makeWindowsPerform: @selector(containsMouse) inOrder: YES];
if( pWindow && [pWindow isMemberOfClass: [SalFrameWindow class]] )
pDispatchFrame = [(SalFrameWindow*)pWindow getSalFrame];
-
+
However if a non SalFrameWindow is on screen (like e.g. the file dialog)
it can be hit with the containsMouse selector, which it doesn't support.
Sadly NSApplication:makeWindowsPerform does not check (for performance reasons
@@ -584,7 +576,7 @@ private:
pDispatchFrame = pMouseFrame;
}
}
-
+
if( pDispatchFrame && AquaSalFrame::isAlive( pDispatchFrame ) )
{
pDispatchFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 );
@@ -592,7 +584,7 @@ private:
NSPoint aPt = [NSEvent mouseLocation];
pDispatchFrame->CocoaToVCL( aPt );
-
+
sal_uInt16 nModMask = ImplGetModifierMask( [pEvent modifierFlags] );
// #i82284# emulate ctrl left
if( nModMask == KEY_MOD3 && nButton == MOUSE_LEFT )
@@ -611,7 +603,7 @@ private:
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
aEvent.mnX = pDispatchFrame->maGeometry.nWidth-1-aEvent.mnX;
-
+
pDispatchFrame->CallCallback( nEvent, &aEvent );
}
}
@@ -654,7 +646,7 @@ private:
-(void)mouseEntered: (NSEvent*)pEvent
{
s_pMouseFrame = mpFrame;
-
+
// #i107215# the only mouse events we get when inactive are enter/exit
// actually we would like to have all of them, but better none than some
if( [NSApp isActive] )
@@ -722,7 +714,7 @@ private:
- (void)magnifyWithEvent: (NSEvent*)pEvent
{
YIELD_GUARD;
-
+
// TODO: ?? -(float)magnification;
if( AquaSalFrame::isAlive( mpFrame ) )
{
@@ -761,7 +753,7 @@ private:
NSPoint aPt = [NSEvent mouseLocation];
mpFrame->CocoaToVCL( aPt );
-
+
SalWheelMouseEvent aEvent;
aEvent.mnTime = mpFrame->mnLastEventTime;
aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
@@ -769,11 +761,11 @@ private:
aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
aEvent.mnCode |= KEY_MOD1; // we want zooming, no scrolling
aEvent.mbDeltaIsPixel = TRUE;
-
+
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX;
-
+
aEvent.mnDelta = nDeltaZ;
aEvent.mnNotchDelta = (nDeltaZ >= 0) ? +1 : -1;
if( aEvent.mnDelta == 0 )
@@ -796,15 +788,15 @@ private:
- (void)swipeWithEvent: (NSEvent*)pEvent
{
YIELD_GUARD;
-
+
if( AquaSalFrame::isAlive( mpFrame ) )
{
mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 );
mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
-
+
// merge pending scroll wheel events
- float dX = 0.0;
- float dY = 0.0;
+ CGFloat dX = 0.0;
+ CGFloat dY = 0.0;
for(;;)
{
dX += [pEvent deltaX];
@@ -815,25 +807,25 @@ private:
break;
pEvent = pNextEvent;
}
-
+
NSPoint aPt = [NSEvent mouseLocation];
mpFrame->CocoaToVCL( aPt );
-
+
SalWheelMouseEvent aEvent;
aEvent.mnTime = mpFrame->mnLastEventTime;
aEvent.mnX = static_cast<long>(aPt.x) - mpFrame->maGeometry.nX;
aEvent.mnY = static_cast<long>(aPt.y) - mpFrame->maGeometry.nY;
aEvent.mnCode = ImplGetModifierMask( mpFrame->mnLastModifierFlags );
aEvent.mbDeltaIsPixel = TRUE;
-
+
// --- RTL --- (mirror mouse pos)
if( Application::GetSettings().GetLayoutRTL() )
aEvent.mnX = mpFrame->maGeometry.nWidth-1-aEvent.mnX;
-
+
if( dX != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dX));
- aEvent.mnNotchDelta = dX < 0 ? -1 : 1;
+ aEvent.mnNotchDelta = (dX < 0) ? -1 : +1;
if( aEvent.mnDelta == 0 )
aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = TRUE;
@@ -843,7 +835,7 @@ private:
if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ))
{
aEvent.mnDelta = static_cast<long>(floor(dY));
- aEvent.mnNotchDelta = dY < 0 ? -1 : 1;
+ aEvent.mnNotchDelta = (dY < 0) ? -1 : +1;
if( aEvent.mnDelta == 0 )
aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
@@ -856,15 +848,15 @@ private:
-(void)scrollWheel: (NSEvent*)pEvent
{
YIELD_GUARD;
-
+
if( AquaSalFrame::isAlive( mpFrame ) )
{
mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 );
mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
// merge pending scroll wheel events
- float dX = 0.0;
- float dY = 0.0;
+ CGFloat dX = 0.0;
+ CGFloat dY = 0.0;
for(;;)
{
dX += [pEvent deltaX];
@@ -893,11 +885,11 @@ private:
if( dX != 0.0 )
{
aEvent.mnDelta = static_cast<long>(floor(dX));
- aEvent.mnNotchDelta = dX < 0 ? -1 : 1;
+ aEvent.mnNotchDelta = (dX < 0) ? -1 : +1;
if( aEvent.mnDelta == 0 )
aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = TRUE;
- aEvent.mnScrollLines = dY > 0 ? dX/WHEEL_EVENT_FACTOR : -dX/WHEEL_EVENT_FACTOR;
+ aEvent.mnScrollLines = fabs(dX) / WHEEL_EVENT_FACTOR;
if( aEvent.mnScrollLines == 0 )
aEvent.mnScrollLines = 1;
@@ -906,12 +898,12 @@ private:
if( dY != 0.0 && AquaSalFrame::isAlive( mpFrame ) )
{
aEvent.mnDelta = static_cast<long>(floor(dY));
- aEvent.mnNotchDelta = dY < 0 ? -1 : 1;
+ aEvent.mnNotchDelta = (dY < 0) ? -1 : +1;
if( aEvent.mnDelta == 0 )
aEvent.mnDelta = aEvent.mnNotchDelta;
aEvent.mbHorz = FALSE;
- aEvent.mnScrollLines = dY > 0 ? dY/WHEEL_EVENT_FACTOR : -dY/WHEEL_EVENT_FACTOR;
- if( aEvent.mnScrollLines < 1 )
+ aEvent.mnScrollLines = fabs(dY) / WHEEL_EVENT_FACTOR;
+ if( aEvent.mnScrollLines == 0 )
aEvent.mnScrollLines = 1;
mpFrame->CallCallback( SALEVENT_WHEELMOUSE, &aEvent );
@@ -923,7 +915,7 @@ private:
-(void)keyDown: (NSEvent*)pEvent
{
YIELD_GUARD;
-
+
if( AquaSalFrame::isAlive( mpFrame ) )
{
mpLastEvent = pEvent;
@@ -933,7 +925,7 @@ private:
mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 );
mpFrame->mnLastModifierFlags = [pEvent modifierFlags];
-
+
if( ! [self handleKeyDownException: pEvent] )
{
NSArray* pArray = [NSArray arrayWithObject: pEvent];
@@ -963,7 +955,7 @@ private:
}
unichar keyChar = [pUnmodifiedString characterAtIndex: 0];
sal_uInt16 nKeyCode = ImplMapCharCode( keyChar );
-
+
// Caution: should the table grow to more than 5 or 6 entries,
// we must consider moving it to a kind of hash map
const unsigned int nExceptions = sizeof( aExceptionalKeys ) / sizeof( aExceptionalKeys[0] );
@@ -985,7 +977,7 @@ private:
-(void)flagsChanged: (NSEvent*)pEvent
{
YIELD_GUARD;
-
+
if( AquaSalFrame::isAlive( mpFrame ) )
{
mpFrame->mnLastEventTime = static_cast<sal_uLong>( [pEvent timestamp] * 1000.0 );
@@ -996,7 +988,7 @@ private:
-(void)insertText:(id)aString
{
YIELD_GUARD;
-
+
if( AquaSalFrame::isAlive( mpFrame ) )
{
NSString* pInsert = nil;
@@ -1004,14 +996,14 @@ private:
pInsert = [aString string];
else
pInsert = aString;
-
+
int nLen = 0;
if( pInsert && ( nLen = [pInsert length] ) > 0 )
{
OUString aInsertString( GetOUString( pInsert ) );
// aCharCode initializer is safe since aInsertString will at least contain '\0'
sal_Unicode aCharCode = *aInsertString.getStr();
-
+
if( nLen == 1 &&
aCharCode < 0x80 &&
aCharCode > 0x1f &&
@@ -1023,7 +1015,7 @@ private:
// #i99567#
// find out the unmodified key code
-
+
// sanity check
if( mpLastEvent && ( [mpLastEvent type] == NSKeyDown || [mpLastEvent type] == NSKeyUp ) )
{
@@ -1443,7 +1435,7 @@ private:
mpLastSuperEvent = mpLastEvent;
[NSApp performSelector:@selector(sendSuperEvent:) withObject: mpLastEvent];
mpLastSuperEvent = pLastSuperEvent;
-
+
std::map< NSEvent*, bool >::iterator it = GetSalData()->maKeyEventAnswer.find( mpLastEvent );
if( it != GetSalData()->maKeyEventAnswer.end() )
it->second = true;
@@ -1466,7 +1458,7 @@ private:
-(BOOL)sendKeyToFrameDirect: (sal_uInt16)nKeyCode character: (sal_Unicode)aChar modifiers: (unsigned int)nMod
{
YIELD_GUARD;
-
+
long nRet = 0;
if( AquaSalFrame::isAlive( mpFrame ) )
{
@@ -1551,7 +1543,7 @@ private:
// and b) why we should have a marked range at this point.
if( ! mbInKeyInput )
return NSMakeRange( 0, 0 );
-
+
return [self hasMarkedText] ? mMarkedRange : NSMakeRange( NSNotFound, 0 );
}
@@ -1589,7 +1581,7 @@ private:
{
unsigned int nUnderlineValue;
NSRange effectiveRange;
-
+
effectiveRange = NSMakeRange(i, 1);
nUnderlineValue = [[aString attribute:NSUnderlineStyleAttributeName atIndex:i effectiveRange:&effectiveRange] unsignedIntValue];