Kaydet (Commit) 5ffbf312 authored tarafından Herbert Dürr's avatar Herbert Dürr

fix the A11Y text attribute color in Aqua

Using the SalColor->CGFloat[] helper gets more of VCL into the scope
which causes conflicting declarations between css::awt and vcl-classic
font attributes so their namespace must be explicitly qualified
üst 56b3b89a
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "precompiled_vcl.hxx" #include "precompiled_vcl.hxx"
#include "aqua/salinst.h" #include "aqua/salinst.h"
#include "aqua/salgdi.h"
#include "aqua11ytextattributeswrapper.h" #include "aqua11ytextattributeswrapper.h"
...@@ -33,8 +34,8 @@ ...@@ -33,8 +34,8 @@
#include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp> #include <com/sun/star/awt/FontStrikeout.hpp>
namespace css_awt = ::com::sun::star::awt;
using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::beans; using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -46,8 +47,8 @@ using namespace ::rtl; ...@@ -46,8 +47,8 @@ using namespace ::rtl;
int underlineStyle = NSNoUnderlineStyle; int underlineStyle = NSNoUnderlineStyle;
sal_Int16 value = 0; sal_Int16 value = 0;
property.Value >>= value; property.Value >>= value;
if ( value != FontUnderline::NONE if ( value != ::css_awt::FontUnderline::NONE
&& value != FontUnderline::DONTKNOW) { && value != ::css_awt::FontUnderline::DONTKNOW) {
underlineStyle = NSSingleUnderlineStyle; underlineStyle = NSSingleUnderlineStyle;
} }
return underlineStyle; return underlineStyle;
...@@ -57,10 +58,10 @@ using namespace ::rtl; ...@@ -57,10 +58,10 @@ using namespace ::rtl;
int boldStyle = 0; int boldStyle = 0;
float value = 0; float value = 0;
property.Value >>= value; property.Value >>= value;
if ( value == FontWeight::SEMIBOLD if ( value == ::css_awt::FontWeight::SEMIBOLD
|| value == FontWeight::BOLD || value == ::css_awt::FontWeight::BOLD
|| value == FontWeight::ULTRABOLD || value == ::css_awt::FontWeight::ULTRABOLD
|| value == FontWeight::BLACK ) { || value == ::css_awt::FontWeight::BLACK ) {
boldStyle = NSBoldFontMask; boldStyle = NSBoldFontMask;
} }
return boldStyle; return boldStyle;
...@@ -68,8 +69,8 @@ using namespace ::rtl; ...@@ -68,8 +69,8 @@ using namespace ::rtl;
+(int)convertItalicStyle:(PropertyValue)property { +(int)convertItalicStyle:(PropertyValue)property {
int italicStyle = 0; int italicStyle = 0;
sal_Int16 value = property.Value.get<FontSlant>(); sal_Int16 value = property.Value.get<::css_awt::FontSlant>();
if ( value == FontSlant_ITALIC ) { if ( value == ::css_awt::FontSlant_ITALIC ) {
italicStyle = NSItalicFontMask; italicStyle = NSItalicFontMask;
} }
return italicStyle; return italicStyle;
...@@ -79,8 +80,8 @@ using namespace ::rtl; ...@@ -79,8 +80,8 @@ using namespace ::rtl;
BOOL strikethrough = NO; BOOL strikethrough = NO;
sal_Int16 value = 0; sal_Int16 value = 0;
property.Value >>= value; property.Value >>= value;
if ( value != FontStrikeout::NONE if ( value != ::css_awt::FontStrikeout::NONE
&& value != FontStrikeout::DONTKNOW ) { && value != ::css_awt::FontStrikeout::DONTKNOW ) {
strikethrough = YES; strikethrough = YES;
} }
return strikethrough; return strikethrough;
...@@ -102,13 +103,13 @@ using namespace ::rtl; ...@@ -102,13 +103,13 @@ using namespace ::rtl;
return [ NSNumber numberWithShort: value ]; return [ NSNumber numberWithShort: value ];
} }
+(void)addColor:(sal_Int32)salColor forAttribute:(NSString *)attribute andRange:(NSRange)range toString:(NSMutableAttributedString *)string { +(void)addColor:(SalColor)nSalColor forAttribute:(NSString *)attribute andRange:(NSRange)range toString:(NSMutableAttributedString *)string {
if ( salColor != -1 ) { if( nSalColor == COL_TRANSPARENT )
float elements[] = { salColor & 0x00ff0000, salColor & 0x0000ff00, salColor & 0x000000ff }; return;
CGColorRef color = CGColorCreate ( CGColorSpaceCreateWithName ( kCGColorSpaceGenericRGB ), elements ); const RGBAColor aRGBAColor( nSalColor);
[ string addAttribute: attribute value: (id) color range: range ]; CGColorRef aColorRef = CGColorCreate ( CGColorSpaceCreateWithName ( kCGColorSpaceGenericRGB ), aRGBAColor.AsArray() );
CGColorRelease ( color ); [ string addAttribute: attribute value: (id) aColorRef range: range ];
} CGColorRelease( aColorRef );
} }
+(void)addFont:(NSFont *)font toString:(NSMutableAttributedString *)string forRange:(NSRange)range { +(void)addFont:(NSFont *)font toString:(NSMutableAttributedString *)string forRange:(NSRange)range {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment