xref: /aoo41x/main/vcl/aqua/source/a11y/aqua11yutil.mm (revision 323de322)
1*323de322SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*323de322SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*323de322SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*323de322SAndrew Rist * distributed with this work for additional information
6*323de322SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*323de322SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*323de322SAndrew Rist * "License"); you may not use this file except in compliance
9*323de322SAndrew Rist * with the License.  You may obtain a copy of the License at
10*323de322SAndrew Rist *
11*323de322SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12*323de322SAndrew Rist *
13*323de322SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*323de322SAndrew Rist * software distributed under the License is distributed on an
15*323de322SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*323de322SAndrew Rist * KIND, either express or implied.  See the License for the
17*323de322SAndrew Rist * specific language governing permissions and limitations
18*323de322SAndrew Rist * under the License.
19*323de322SAndrew Rist *
20*323de322SAndrew Rist *************************************************************/
21*323de322SAndrew Rist
22*323de322SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir// MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir#include "precompiled_vcl.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir#include "aqua/aquavcltypes.h"
28cdf0e10cSrcweir
29cdf0e10cSrcweir#include "aqua11yutil.h"
30cdf0e10cSrcweir
31cdf0e10cSrcweirusing namespace ::com::sun::star::awt;
32cdf0e10cSrcweir
33cdf0e10cSrcweir@implementation AquaA11yUtil : NSObject
34cdf0e10cSrcweir
35cdf0e10cSrcweir// TODO: should be merged with AquaSalFrame::VCLToCocoa... to a general helper method
36cdf0e10cSrcweir+(NSValue *)vclPointToNSPoint:(Point)vclPoint {
37cdf0e10cSrcweir    // VCL coordinates are in upper-left-notation, Cocoa likes it the Cartesian way (lower-left)
38cdf0e10cSrcweir    NSRect screenRect = [ [ NSScreen mainScreen ] frame ];
39cdf0e10cSrcweir    NSPoint nsPoint = NSMakePoint ( (float) vclPoint.X, (float) ( screenRect.size.height - vclPoint.Y ) );
40cdf0e10cSrcweir    return [ NSValue valueWithPoint: nsPoint ];
41cdf0e10cSrcweir}
42cdf0e10cSrcweir
43cdf0e10cSrcweir// TODO: should be merged with AquaSalFrame::VCLToCocoa... to a general helper method
44cdf0e10cSrcweir+(Point)nsPointToVclPoint:(NSValue *)nsPoint {
45cdf0e10cSrcweir    // VCL coordinates are in upper-left-notation, Cocoa likes it the Cartesian way (lower-left)
46cdf0e10cSrcweir    NSRect screenRect = [ [ NSScreen mainScreen ] frame ];
47cdf0e10cSrcweir    return Point ( static_cast<long>([ nsPoint pointValue ].x), static_cast<long>(screenRect.size.height - [ nsPoint pointValue ].y) );
48cdf0e10cSrcweir}
49cdf0e10cSrcweir
50cdf0e10cSrcweir@end
51