1*76b6b121SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*76b6b121SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*76b6b121SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*76b6b121SAndrew Rist * distributed with this work for additional information 6*76b6b121SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*76b6b121SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*76b6b121SAndrew Rist * "License"); you may not use this file except in compliance 9*76b6b121SAndrew Rist * with the License. You may obtain a copy of the License at 10*76b6b121SAndrew Rist * 11*76b6b121SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*76b6b121SAndrew Rist * 13*76b6b121SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*76b6b121SAndrew Rist * software distributed under the License is distributed on an 15*76b6b121SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*76b6b121SAndrew Rist * KIND, either express or implied. See the License for the 17*76b6b121SAndrew Rist * specific language governing permissions and limitations 18*76b6b121SAndrew Rist * under the License. 19*76b6b121SAndrew Rist * 20*76b6b121SAndrew Rist *************************************************************/ 21*76b6b121SAndrew Rist 22*76b6b121SAndrew Rist 23cdf0e10cSrcweir package complex.imageManager; 24cdf0e10cSrcweir 25cdf0e10cSrcweir import com.sun.star.graphic.XGraphic; 26cdf0e10cSrcweir import com.sun.star.ui.ImageType; 27cdf0e10cSrcweir import com.sun.star.ui.XImageManager; 28cdf0e10cSrcweir import lib.TestParameters; 29cdf0e10cSrcweir 30cdf0e10cSrcweir 31cdf0e10cSrcweir /** 32cdf0e10cSrcweir * 33cdf0e10cSrcweir */ 34cdf0e10cSrcweir public class _XImageManager { 35cdf0e10cSrcweir 36cdf0e10cSrcweir TestParameters tEnv = null; 37cdf0e10cSrcweir String[]imageNames = null; 38cdf0e10cSrcweir XGraphic[] xGraphicArray = null; 39cdf0e10cSrcweir public XImageManager oObj; 40cdf0e10cSrcweir 41cdf0e10cSrcweir public _XImageManager( TestParameters tEnv, XImageManager oObj) { 42cdf0e10cSrcweir 43cdf0e10cSrcweir this.tEnv = tEnv; 44cdf0e10cSrcweir this.oObj = oObj; 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir public boolean _getAllImageNames() { 48cdf0e10cSrcweir short s = ImageType.COLOR_NORMAL + ImageType.SIZE_DEFAULT; 49cdf0e10cSrcweir imageNames = oObj.getAllImageNames(s); 50cdf0e10cSrcweir for (int i=0; i<(imageNames.length>10?10:imageNames.length); i++) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir System.out.println("###### Image: " + imageNames[i]); 53cdf0e10cSrcweir } 54cdf0e10cSrcweir return imageNames != null; 55cdf0e10cSrcweir } 56cdf0e10cSrcweir 57cdf0e10cSrcweir public boolean _getImages() { 58cdf0e10cSrcweir short s = ImageType.COLOR_NORMAL + ImageType.SIZE_DEFAULT; 59cdf0e10cSrcweir try { 60cdf0e10cSrcweir xGraphicArray = oObj.getImages(s, imageNames); 61cdf0e10cSrcweir } 62cdf0e10cSrcweir catch(com.sun.star.lang.IllegalArgumentException e) { 63cdf0e10cSrcweir } 64cdf0e10cSrcweir return xGraphicArray != null; 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir public boolean _hasImage() { 68cdf0e10cSrcweir boolean result = true; 69cdf0e10cSrcweir short s = ImageType.COLOR_NORMAL + ImageType.SIZE_DEFAULT; 70cdf0e10cSrcweir try { // check the first image names, 10 at max 71cdf0e10cSrcweir for (int i=0; i<(imageNames.length>10?10:imageNames.length); i++) 72cdf0e10cSrcweir { 73cdf0e10cSrcweir result &= oObj.hasImage(s, imageNames[i]); 74cdf0e10cSrcweir } 75cdf0e10cSrcweir } 76cdf0e10cSrcweir catch(com.sun.star.lang.IllegalArgumentException e) { 77cdf0e10cSrcweir result = false; 78cdf0e10cSrcweir } 79cdf0e10cSrcweir return result; 80cdf0e10cSrcweir } 81cdf0e10cSrcweir 82cdf0e10cSrcweir public boolean _insertImages() { 83cdf0e10cSrcweir try { 84cdf0e10cSrcweir oObj.insertImages((short)imageNames.length, imageNames, xGraphicArray); 85cdf0e10cSrcweir } 86cdf0e10cSrcweir catch(com.sun.star.container.ElementExistException e) { 87cdf0e10cSrcweir } 88cdf0e10cSrcweir catch(com.sun.star.lang.IllegalArgumentException e) { 89cdf0e10cSrcweir } 90cdf0e10cSrcweir catch(com.sun.star.lang.IllegalAccessException e) { 91cdf0e10cSrcweir } 92cdf0e10cSrcweir return true; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir public boolean _removeImages() { 96cdf0e10cSrcweir try { 97cdf0e10cSrcweir oObj.removeImages((short)(imageNames.length-1), imageNames); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir catch(com.sun.star.lang.IllegalArgumentException e) { 100cdf0e10cSrcweir } 101cdf0e10cSrcweir catch(com.sun.star.lang.IllegalAccessException e) { 102cdf0e10cSrcweir } 103cdf0e10cSrcweir return true; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir public boolean _replaceImages() { 107cdf0e10cSrcweir return true; 108cdf0e10cSrcweir } 109cdf0e10cSrcweir 110cdf0e10cSrcweir public boolean _reset() { 111cdf0e10cSrcweir return true; 112cdf0e10cSrcweir } 113cdf0e10cSrcweir } 114