1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salsys.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
34 #include "tools/rc.hxx"
35 #include "vcl/svids.hrc"
38 #include "saldata.hxx"
39 #include "rtl/ustrbuf.hxx"
43 // =======================================================================
45 AquaSalSystem::~AquaSalSystem()
49 unsigned int AquaSalSystem::GetDisplayScreenCount()
51 NSArray
* pScreens
= [NSScreen screens
];
52 return pScreens
? [pScreens count
] : 1;
55 bool AquaSalSystem::IsMultiDisplay()
60 unsigned int AquaSalSystem::GetDefaultDisplayNumber()
65 Rectangle
AquaSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen
)
67 NSArray
* pScreens
= [NSScreen screens
];
69 NSScreen
* pScreen
= nil
;
70 if( pScreens
&& nScreen
< [pScreens count
] )
71 pScreen
= [pScreens objectAtIndex
: nScreen
];
73 pScreen
= [NSScreen mainScreen
];
77 NSRect aFrame
= [pScreen frame
];
78 aRet
= Rectangle( Point( static_cast<long int>(aFrame
.origin
.x
), static_cast<long int>(aFrame
.origin
.y
) ),
79 Size( static_cast<long int>(aFrame
.size
.width
), static_cast<long int>(aFrame
.size
.height
) ) );
84 Rectangle
AquaSalSystem::GetDisplayWorkAreaPosSizePixel( unsigned int nScreen
)
86 NSArray
* pScreens
= [NSScreen screens
];
88 NSScreen
* pScreen
= nil
;
89 if( pScreens
&& nScreen
< [pScreens count
] )
90 pScreen
= [pScreens objectAtIndex
: nScreen
];
92 pScreen
= [NSScreen mainScreen
];
96 NSRect aFrame
= [pScreen visibleFrame
];
97 aRet
= Rectangle( Point( static_cast<long int>(aFrame
.origin
.x
), static_cast<long int>(aFrame
.origin
.y
) ),
98 Size( static_cast<long int>(aFrame
.size
.width
), static_cast<long int>(aFrame
.size
.height
) ) );
103 rtl::OUString
AquaSalSystem::GetScreenName( unsigned int nScreen
)
105 NSArray
* pScreens
= [NSScreen screens
];
107 if( nScreen
< [pScreens count
] )
109 ResMgr
* pMgr
= ImplGetResMgr();
112 String
aScreenName( ResId( SV_MAC_SCREENNNAME
, *pMgr
) );
113 aScreenName
.SearchAndReplaceAllAscii( "%d", String::CreateFromInt32( nScreen
) );
120 int AquaSalSystem::ShowNativeDialog( const String
& rTitle
,
121 const String
& rMessage
,
122 const std::list
< String
>& rButtons
,
128 int AquaSalSystem::ShowNativeMessageBox( const String
& rTitle
,
129 const String
& rMessage
,
130 int nButtonCombination
,