comparison dwt/ole/win32/OleClientSite.d @ 246:fd9c62a2998e

Updater SWT 3.4M7 to 3.4
author Frank Benoit <benoit@tionex.de>
date Tue, 01 Jul 2008 10:15:59 +0200
parents ab60f3309436
children bb89fd34ec82
comparison
equal deleted inserted replaced
245:d8c3d4a4f2b0 246:fd9c62a2998e
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2000, 2007 IBM Corporation and others. 2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
84 * <dl> 84 * <dl>
85 * <dt><b>Styles</b> <dd>BORDER 85 * <dt><b>Styles</b> <dd>BORDER
86 * <dt><b>Events</b> <dd>Dispose, Move, Resize 86 * <dt><b>Events</b> <dd>Dispose, Move, Resize
87 * </dl> 87 * </dl>
88 * 88 *
89 * @see <a href="http://www.eclipse.org/swt/snippets/#ole">OLE and ActiveX snippets</a>
90 * @see <a href="http://www.eclipse.org/swt/examples.php">DWT Examples: OLEExample, OleWebBrowser</a>
89 */ 91 */
90 public class OleClientSite : Composite { 92 public class OleClientSite : Composite {
91 93
92 // Interfaces for this Ole Client Container 94 // Interfaces for this Ole Client Container
93 private _IUnknownImpl iUnknown; 95 private _IUnknownImpl iUnknown;
631 objIOleObject.GetExtent(aspect, sizel); 633 objIOleObject.GetExtent(aspect, sizel);
632 } 634 }
633 } 635 }
634 return xFormHimetricToPixels(sizel); 636 return xFormHimetricToPixels(sizel);
635 } 637 }
638 /**
639 * Returns the indent value that would be used to compute the clipping area
640 * of the active X object.
641 *
642 * NOTE: The indent value is no longer being used by the client site.
643 *
644 * @return the rectangle representing the indent
645 */
636 public Rectangle getIndent() { 646 public Rectangle getIndent() {
637 return new Rectangle(indent.left, indent.right, indent.top, indent.bottom); 647 return new Rectangle(indent.left, indent.right, indent.top, indent.bottom);
638 } 648 }
639 /** 649 /**
640 * Returns the program ID of the OLE Document or ActiveX Control. 650 * Returns the program ID of the OLE Document or ActiveX Control.
738 } 748 }
739 COM.MoveMemory(lpFrameInfo, frameInfo, OLEINPLACEFRAMEINFO.sizeof); 749 COM.MoveMemory(lpFrameInfo, frameInfo, OLEINPLACEFRAMEINFO.sizeof);
740 750
741 return COM.S_OK; 751 return COM.S_OK;
742 } 752 }
753 /**
754 * Returns whether ole document is dirty by checking whether the content
755 * of the file representing the document is dirty.
756 *
757 * @return <code>true</code> if the document has been modified,
758 * <code>false</code> otherwise.
759 * @since 3.1
760 */
743 public bool isDirty() { 761 public bool isDirty() {
744 /* 762 /*
745 * Note: this method must return true unless it is absolutely clear that the 763 * Note: this method must return true unless it is absolutely clear that the
746 * contents of the Ole Document do not differ from the contents in the file 764 * contents of the Ole Document do not differ from the contents in the file
747 * on the file system. 765 * on the file system.
985 } 1003 }
986 return refCount; 1004 return refCount;
987 } 1005 }
988 protected void releaseObjectInterfaces() { 1006 protected void releaseObjectInterfaces() {
989 1007
990 if (objIOleInPlaceObject!is null) 1008 if (objIOleInPlaceObject !is null)
991 objIOleInPlaceObject.Release(); 1009 objIOleInPlaceObject.Release();
992 objIOleInPlaceObject = null; 1010 objIOleInPlaceObject = null;
993 1011
994 if (objIOleObject !is null) { 1012 if (objIOleObject !is null) {
995 objIOleObject.Close(COM.OLECLOSE_NOSAVE); 1013 objIOleObject.Close(COM.OLECLOSE_NOSAVE);
1017 } 1035 }
1018 objIUnknown = null; 1036 objIUnknown = null;
1019 1037
1020 COM.CoFreeUnusedLibraries(); 1038 COM.CoFreeUnusedLibraries();
1021 } 1039 }
1040 /**
1041 * Saves the document to the specified file and includes OLE specific information if specified.
1042 * This method must <b>only</b> be used for files that have an OLE Storage format. For example,
1043 * a word file edited with Word.Document should be saved using this method because there is
1044 * formating information that should be stored in the OLE specific Storage format.
1045 *
1046 * @param file the file to which the changes are to be saved
1047 * @param includeOleInfo the flag to indicate whether OLE specific information should be saved.
1048 *
1049 * @return true if the save was successful
1050 */
1022 public bool save(File file, bool includeOleInfo) { 1051 public bool save(File file, bool includeOleInfo) {
1023 if (includeOleInfo) 1052 if (includeOleInfo)
1024 return saveToStorageFile(file); 1053 return saveToStorageFile(file);
1025 return saveToTraditionalFile(file); 1054 return saveToTraditionalFile(file);
1026 } 1055 }
1208 if (!alreadyRunning) 1237 if (!alreadyRunning)
1209 // Close server if it wasn't already running upon entering this method. 1238 // Close server if it wasn't already running upon entering this method.
1210 objIOleObject.Close(COM.OLECLOSE_SAVEIFDIRTY); 1239 objIOleObject.Close(COM.OLECLOSE_SAVEIFDIRTY);
1211 } 1240 }
1212 } 1241 }
1242 /**
1243 * The indent value is no longer being used by the client site.
1244 *
1245 * @param newIndent the rectangle representing the indent amount
1246 */
1213 public void setIndent(Rectangle newIndent) { 1247 public void setIndent(Rectangle newIndent) {
1214 indent.left = newIndent.x; 1248 indent.left = newIndent.x;
1215 indent.right = newIndent.width; 1249 indent.right = newIndent.width;
1216 indent.top = newIndent.y; 1250 indent.top = newIndent.y;
1217 indent.bottom = newIndent.height; 1251 indent.bottom = newIndent.height;