diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm | 20 | ||||
-rw-r--r-- | vcl/aqua/source/a11y/aqua11ywrapper.mm | 9 | ||||
-rw-r--r-- | vcl/inc/aqua/aqua11ywrapper.h | 3 |
3 files changed, 28 insertions, 4 deletions
diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm index 2e4ab40a5034..e8a676e0924b 100644 --- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm @@ -50,7 +50,7 @@ using namespace ::rtl; } +(int)convertBoldStyle:(PropertyValue)property { - int boldStyle = 0; + int boldStyle = NSUnboldFontMask; float value = 0; property.Value >>= value; if ( value == ::css_awt::FontWeight::SEMIBOLD @@ -63,7 +63,7 @@ using namespace ::rtl; } +(int)convertItalicStyle:(PropertyValue)property { - int italicStyle = 0; + int italicStyle = NSUnitalicFontMask; sal_Int16 value = property.Value.get< ::css_awt::FontSlant>(); if ( value == ::css_awt::FontSlant_ITALIC ) { italicStyle = NSItalicFontMask; @@ -198,10 +198,22 @@ using namespace ::rtl; if ( wrapperStore != nil ) { // default [ wrapperStore setDefaultFontname: CreateNSString ( fontname ) ]; [ wrapperStore setDefaultFontsize: fontsize ]; + [ wrapperStore setDefaultFonttraits: fonttraits ]; NSFont * font = [ [ NSFontManager sharedFontManager ] fontWithFamily: CreateNSString ( fontname ) traits: fonttraits weight: 0 size: fontsize ]; [ AquaA11yTextAttributesWrapper addFont: font toString: string forRange: range ]; - } else if ( wrapper != nil && fonttraits != 0 ) { // attribute run and bold and/or italic was found - NSFont * font = [ [ NSFontManager sharedFontManager ] fontWithFamily: [ wrapper defaultFontname ] traits: fonttraits weight: 0 size: [ wrapper defaultFontsize ] ]; + } else if ( wrapper != nil) { // attribute run and bold and/or italic was found + NSString *fontName = nil; + if (fontname.isEmpty()) + fontName = [wrapper defaultFontname]; + else + fontName = CreateNSString(fontname); + if (!(fonttraits & (NSBoldFontMask | NSUnboldFontMask))) + fonttraits |= [wrapper defaultFonttraits] & (NSBoldFontMask | NSUnboldFontMask); + if (!(fonttraits & (NSItalicFontMask | NSUnitalicFontMask))) + fonttraits |= [wrapper defaultFonttraits] & (NSItalicFontMask | NSUnitalicFontMask); + if (fontsize == 0.0) + fontsize = [wrapper defaultFontsize]; + NSFont * font = [ [ NSFontManager sharedFontManager ] fontWithFamily: fontName traits: fonttraits weight: 0 size: fontsize ]; [ AquaA11yTextAttributesWrapper addFont: font toString: string forRange: range ]; } [ pool release ]; diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm index bb0d81b18f52..375997f6f77f 100644 --- a/vcl/aqua/source/a11y/aqua11ywrapper.mm +++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm @@ -82,6 +82,7 @@ static std::ostream &operator<<(std::ostream &s, NSPoint point) { -(void) setDefaults: (Reference < XAccessibleContext >) rxAccessibleContext { mDefaultFontsize = 0.0; + mDefaultFonttraits = 0; mpDefaultFontname = nil; mpReferenceWrapper = new ReferenceWrapper; mActsAsRadioGroup = NO; @@ -1145,6 +1146,14 @@ Reference < XAccessibleContext > hitTestRunner ( com::sun::star::awt::Point poin return mDefaultFontsize; } +-(void)setDefaultFonttraits:(int)fonttraits { + mDefaultFonttraits = fonttraits; +} + +-(int)defaultFonttraits { + return mDefaultFonttraits; +} + -(void)setActsAsRadioGroup:(BOOL)actsAsRadioGroup { mActsAsRadioGroup = actsAsRadioGroup; } diff --git a/vcl/inc/aqua/aqua11ywrapper.h b/vcl/inc/aqua/aqua11ywrapper.h index da34264ab0e7..185536adbb25 100644 --- a/vcl/inc/aqua/aqua11ywrapper.h +++ b/vcl/inc/aqua/aqua11ywrapper.h @@ -54,6 +54,7 @@ struct ReferenceWrapper ReferenceWrapper * mpReferenceWrapper; NSString * mpDefaultFontname; float mDefaultFontsize; + int mDefaultFonttraits; BOOL mActsAsRadioGroup; BOOL mIsTableCell; } @@ -94,6 +95,8 @@ struct ReferenceWrapper -(NSString *)defaultFontname; -(void)setDefaultFontsize:(float)fontsize; -(float)defaultFontsize; +-(void)setDefaultFonttraits:(int)fonttraits; +-(int)defaultFonttraits; +(void)setPopupMenuOpen:(BOOL)popupMenuOpen; -(::com::sun::star::accessibility::XAccessibleAction *)accessibleAction; -(::com::sun::star::accessibility::XAccessibleContext *)accessibleContext; |