MessageBox.java (34dd1e25) | MessageBox.java (61161268) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 8 unchanged lines hidden (view full) --- 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24import com.sun.star.awt.Rectangle; | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 8 unchanged lines hidden (view full) --- 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24import com.sun.star.awt.Rectangle; |
25import com.sun.star.awt.MessageBoxType; |
|
25import com.sun.star.awt.XMessageBox; 26import com.sun.star.awt.XMessageBoxFactory; 27import com.sun.star.awt.XVclWindowPeer; 28import com.sun.star.awt.XWindow; 29import com.sun.star.awt.XWindowPeer; 30import com.sun.star.beans.PropertyValue; 31import com.sun.star.frame.XFrame; 32import com.sun.star.frame.XModel; --- 126 unchanged lines hidden (view full) --- 159 * @param _sTitle the title of the messagebox 160 * @param _sMessage the message of the messagebox 161 */ 162 public void showErrorMessageBox(XWindowPeer _xParentWindowPeer, String _sTitle, String _sMessage) { 163 XComponent xComponent = null; 164 try { 165 Object oToolkit = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); 166 XMessageBoxFactory xMessageBoxFactory = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit); | 26import com.sun.star.awt.XMessageBox; 27import com.sun.star.awt.XMessageBoxFactory; 28import com.sun.star.awt.XVclWindowPeer; 29import com.sun.star.awt.XWindow; 30import com.sun.star.awt.XWindowPeer; 31import com.sun.star.beans.PropertyValue; 32import com.sun.star.frame.XFrame; 33import com.sun.star.frame.XModel; --- 126 unchanged lines hidden (view full) --- 160 * @param _sTitle the title of the messagebox 161 * @param _sMessage the message of the messagebox 162 */ 163 public void showErrorMessageBox(XWindowPeer _xParentWindowPeer, String _sTitle, String _sMessage) { 164 XComponent xComponent = null; 165 try { 166 Object oToolkit = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); 167 XMessageBoxFactory xMessageBoxFactory = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit); |
167 // rectangle may be empty if position is in the center of the parent peer 168 Rectangle aRectangle = new Rectangle(); 169 XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(_xParentWindowPeer, aRectangle, "errorbox", com.sun.star.awt.MessageBoxButtons.BUTTONS_OK, _sTitle, _sMessage); | 168 XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(_xParentWindowPeer, MessageBoxType.ERRORBOX, com.sun.star.awt.MessageBoxButtons.BUTTONS_OK, _sTitle, _sMessage); |
170 xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMessageBox); 171 if (xMessageBox != null){ 172 short nResult = xMessageBox.execute(); 173 } 174 } catch (com.sun.star.uno.Exception ex) { 175 ex.printStackTrace(System.out); 176 } finally{ 177 //make sure always to dispose the component and free the memory! --- 57 unchanged lines hidden --- | 169 xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMessageBox); 170 if (xMessageBox != null){ 171 short nResult = xMessageBox.execute(); 172 } 173 } catch (com.sun.star.uno.Exception ex) { 174 ex.printStackTrace(System.out); 175 } finally{ 176 //make sure always to dispose the component and free the memory! --- 57 unchanged lines hidden --- |