1*e357d40eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e357d40eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e357d40eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e357d40eSAndrew Rist  * distributed with this work for additional information
6*e357d40eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e357d40eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e357d40eSAndrew Rist  * "License"); you may not use this file except in compliance
9*e357d40eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*e357d40eSAndrew Rist  *
11*e357d40eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*e357d40eSAndrew Rist  *
13*e357d40eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e357d40eSAndrew Rist  * software distributed under the License is distributed on an
15*e357d40eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e357d40eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*e357d40eSAndrew Rist  * specific language governing permissions and limitations
18*e357d40eSAndrew Rist  * under the License.
19*e357d40eSAndrew Rist  *
20*e357d40eSAndrew Rist  *************************************************************/
21*e357d40eSAndrew Rist 
22*e357d40eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir import sun.awt.*;
25cdf0e10cSrcweir import com.sun.star.awt.*;
26cdf0e10cSrcweir 
27cdf0e10cSrcweir public class SystemWindowAdapter
28cdf0e10cSrcweir {
createFrame( int windowHandle )29cdf0e10cSrcweir     static public java.awt.Frame createFrame( int windowHandle )
30cdf0e10cSrcweir     {
31cdf0e10cSrcweir         java.awt.Frame aFrame;
32cdf0e10cSrcweir 
33cdf0e10cSrcweir         // we're initialized with the operating system window handle
34cdf0e10cSrcweir         // as the parameter. We then generate a dummy Java frame with
35cdf0e10cSrcweir         // that window as the parent, to fake a root window for the
36cdf0e10cSrcweir         // Java implementation.
37cdf0e10cSrcweir 
38cdf0e10cSrcweir          // now, we're getting slightly system dependent here.
39cdf0e10cSrcweir          String os = (String) System.getProperty( "os.name" );
40cdf0e10cSrcweir 
41cdf0e10cSrcweir          // create the embedded frame
42cdf0e10cSrcweir          if( os.startsWith( "Windows" ) )
43cdf0e10cSrcweir              aFrame = new sun.awt.windows.WEmbeddedFrame( windowHandle );
44cdf0e10cSrcweir          else
45cdf0e10cSrcweir              throw new com.sun.star.uno.RuntimeException();
46cdf0e10cSrcweir 
47cdf0e10cSrcweir         return aFrame;
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir }
50