X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.editors.win32%2Fsrc%2Forg%2Fsimantics%2Feditors%2Fwin32%2Fole%2FPreviewController.java;h=23aaa05156d3e47fc5da04c2f3fb8ef0a86608ef;hb=c514d4d064547c6bd0bf2b7c182e5f8c7e389c6c;hp=4a8a7551e753c66cbe86a1bbc61db9b0e0ef7619;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/ole/PreviewController.java b/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/ole/PreviewController.java index 4a8a7551e..23aaa0515 100644 --- a/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/ole/PreviewController.java +++ b/bundles/org.simantics.editors.win32/src/org/simantics/editors/win32/ole/PreviewController.java @@ -1,88 +1,88 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.editors.win32.ole; - -import org.eclipse.swt.ole.win32.OLE; -import org.eclipse.swt.ole.win32.OleAutomation; -import org.eclipse.swt.ole.win32.OleClientSite; -import org.eclipse.swt.ole.win32.OleFrame; -import org.eclipse.swt.ole.win32.Variant; -import org.simantics.editors.win32.OLEEditorInput; - - -/** - * Utility for Windows Picture and Fax Preview - * - * @author Marko Luukkainen - * - */ -public class PreviewController implements OleController { - - OleFrame frame; - OleClientSite site; - OleAutomation auto; - - public PreviewController(OleFrame frame, OleClientSite site, OleAutomation auto) { - this.frame = frame; - this.site = site; - this.auto = auto; - } - - public void show(OLEEditorInput input) { - site.doVerb(OLE.OLEIVERB_SHOW); - loadFile(input.getFile().getAbsoluteFile().toString()); - } - - public void loadFile(String file) { - - int[] rgdispid; - rgdispid = auto.getIDsOfNames(new String[]{"Show"}); - - if (rgdispid != null) { - int dispIdMember = rgdispid[0]; - auto.invoke(dispIdMember, new Variant[]{new Variant(file)}); - } - } - - public void bestFit() { - int[] rgdispid; - rgdispid = auto.getIDsOfNames(new String[]{"BestFit"}); - - if (rgdispid != null) { - int dispIdMember = rgdispid[0]; - auto.invoke(dispIdMember); - } - } - - public void actualSize() { - int[] rgdispid; - rgdispid = auto.getIDsOfNames(new String[]{"ActualSize"}); - - if (rgdispid != null) { - int dispIdMember = rgdispid[0]; - auto.invoke(dispIdMember); - } - } - - public void zoom(int i) { - - int[] rgdispid; - rgdispid = auto.getIDsOfNames(new String[]{"Zoom"}); - - if (rgdispid != null) { - int dispIdMember = rgdispid[0]; - auto.invoke(dispIdMember, new Variant[]{new Variant(i)}); - } - } - - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.editors.win32.ole; + +import org.eclipse.swt.ole.win32.OLE; +import org.eclipse.swt.ole.win32.OleAutomation; +import org.eclipse.swt.ole.win32.OleClientSite; +import org.eclipse.swt.ole.win32.OleFrame; +import org.eclipse.swt.ole.win32.Variant; +import org.simantics.editors.win32.OLEEditorInput; + + +/** + * Utility for Windows Picture and Fax Preview + * + * @author Marko Luukkainen + * + */ +public class PreviewController implements OleController { + + OleFrame frame; + OleClientSite site; + OleAutomation auto; + + public PreviewController(OleFrame frame, OleClientSite site, OleAutomation auto) { + this.frame = frame; + this.site = site; + this.auto = auto; + } + + public void show(OLEEditorInput input) { + site.doVerb(OLE.OLEIVERB_SHOW); + loadFile(input.getFile().getAbsoluteFile().toString()); + } + + public void loadFile(String file) { + + int[] rgdispid; + rgdispid = auto.getIDsOfNames(new String[]{"Show"}); + + if (rgdispid != null) { + int dispIdMember = rgdispid[0]; + auto.invoke(dispIdMember, new Variant[]{new Variant(file)}); + } + } + + public void bestFit() { + int[] rgdispid; + rgdispid = auto.getIDsOfNames(new String[]{"BestFit"}); + + if (rgdispid != null) { + int dispIdMember = rgdispid[0]; + auto.invoke(dispIdMember); + } + } + + public void actualSize() { + int[] rgdispid; + rgdispid = auto.getIDsOfNames(new String[]{"ActualSize"}); + + if (rgdispid != null) { + int dispIdMember = rgdispid[0]; + auto.invoke(dispIdMember); + } + } + + public void zoom(int i) { + + int[] rgdispid; + rgdispid = auto.getIDsOfNames(new String[]{"Zoom"}); + + if (rgdispid != null) { + int dispIdMember = rgdispid[0]; + auto.invoke(dispIdMember, new Variant[]{new Variant(i)}); + } + } + + +}