1*ef39d40dSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ef39d40dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ef39d40dSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ef39d40dSAndrew Rist * distributed with this work for additional information 6*ef39d40dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ef39d40dSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ef39d40dSAndrew Rist * "License"); you may not use this file except in compliance 9*ef39d40dSAndrew Rist * with the License. You may obtain a copy of the License at 10*ef39d40dSAndrew Rist * 11*ef39d40dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ef39d40dSAndrew Rist * 13*ef39d40dSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ef39d40dSAndrew Rist * software distributed under the License is distributed on an 15*ef39d40dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ef39d40dSAndrew Rist * KIND, either express or implied. See the License for the 17*ef39d40dSAndrew Rist * specific language governing permissions and limitations 18*ef39d40dSAndrew Rist * under the License. 19*ef39d40dSAndrew Rist * 20*ef39d40dSAndrew Rist *************************************************************/ 21*ef39d40dSAndrew Rist 22*ef39d40dSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir package ifc.frame; 25cdf0e10cSrcweir 26cdf0e10cSrcweir import com.sun.star.awt.Point; 27cdf0e10cSrcweir import com.sun.star.frame.XFrame; 28cdf0e10cSrcweir import com.sun.star.frame.XLayoutManager; 29cdf0e10cSrcweir import com.sun.star.awt.Rectangle; 30cdf0e10cSrcweir import com.sun.star.awt.Size; 31cdf0e10cSrcweir import com.sun.star.ui.DockingArea; 32cdf0e10cSrcweir import com.sun.star.ui.XUIElement; 33cdf0e10cSrcweir import lib.MultiMethodTest; 34cdf0e10cSrcweir import util.utils; 35cdf0e10cSrcweir 36cdf0e10cSrcweir public class _XLayoutManager extends MultiMethodTest { 37cdf0e10cSrcweir public XLayoutManager oObj = null; 38cdf0e10cSrcweir 39cdf0e10cSrcweir private XFrame xFrame = null; 40cdf0e10cSrcweir private String sElementName = "private:resource/menubar/myMenu"; 41cdf0e10cSrcweir before()42cdf0e10cSrcweir public void before() { 43cdf0e10cSrcweir xFrame = (XFrame)tEnv.getObjRelation("XLayoutManager.Frame"); 44cdf0e10cSrcweir } 45cdf0e10cSrcweir _attachFrame()46cdf0e10cSrcweir public void _attachFrame() { 47cdf0e10cSrcweir oObj.attachFrame(xFrame); 48cdf0e10cSrcweir tRes.tested("attachFrame()", true); 49cdf0e10cSrcweir } 50cdf0e10cSrcweir _createElement()51cdf0e10cSrcweir public void _createElement() { 52cdf0e10cSrcweir requiredMethod("attachFrame()"); 53cdf0e10cSrcweir oObj.createElement(sElementName); 54cdf0e10cSrcweir tRes.tested("createElement()", true); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir _destroyElement()57cdf0e10cSrcweir public void _destroyElement() { 58cdf0e10cSrcweir requiredMethod("getElement()"); 59cdf0e10cSrcweir requiredMethod("getElements()"); 60cdf0e10cSrcweir oObj.destroyElement(sElementName); 61cdf0e10cSrcweir tRes.tested("destroyElement()", true); 62cdf0e10cSrcweir } 63cdf0e10cSrcweir _doLayout()64cdf0e10cSrcweir public void _doLayout() { 65cdf0e10cSrcweir oObj.doLayout(); 66cdf0e10cSrcweir tRes.tested("doLayout()", true); 67cdf0e10cSrcweir } 68cdf0e10cSrcweir _dockWindow()69cdf0e10cSrcweir public void _dockWindow() { 70cdf0e10cSrcweir requiredMethod("createElement()"); 71cdf0e10cSrcweir Point p = new Point(); 72cdf0e10cSrcweir p.X = 0; 73cdf0e10cSrcweir p.Y = 0; 74cdf0e10cSrcweir oObj.dockWindow(sElementName, DockingArea.DOCKINGAREA_TOP, p); 75cdf0e10cSrcweir tRes.tested("dockWindow()", true); 76cdf0e10cSrcweir } 77cdf0e10cSrcweir _floatWindow()78cdf0e10cSrcweir public void _floatWindow() { 79cdf0e10cSrcweir requiredMethod("createElement()"); 80cdf0e10cSrcweir oObj.floatWindow(sElementName); 81cdf0e10cSrcweir tRes.tested("floatWindow()", true); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir _getCurrentDockingArea()84cdf0e10cSrcweir public void _getCurrentDockingArea() { 85cdf0e10cSrcweir requiredMethod("attachFrame()"); 86cdf0e10cSrcweir Rectangle rect = oObj.getCurrentDockingArea(); 87cdf0e10cSrcweir tRes.tested("getCurrentDockingArea()", rect != null); 88cdf0e10cSrcweir } 89cdf0e10cSrcweir _getElement()90cdf0e10cSrcweir public void _getElement() { 91cdf0e10cSrcweir requiredMethod("createElement()"); 92cdf0e10cSrcweir XUIElement xElement = oObj.getElement(sElementName); 93cdf0e10cSrcweir tRes.tested("getElement()", true); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir _getElementPos()96cdf0e10cSrcweir public void _getElementPos() { 97cdf0e10cSrcweir Point p = oObj.getElementPos(sElementName); 98cdf0e10cSrcweir tRes.tested("getElementPos()", p != null); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir _getElementSize()101cdf0e10cSrcweir public void _getElementSize() { 102cdf0e10cSrcweir Size s = oObj.getElementSize(sElementName); 103cdf0e10cSrcweir tRes.tested("getElementSize()", s != null); 104cdf0e10cSrcweir } 105cdf0e10cSrcweir _getElements()106cdf0e10cSrcweir public void _getElements() { 107cdf0e10cSrcweir requiredMethod("createElement()"); 108cdf0e10cSrcweir XUIElement[] xElements = oObj.getElements(); 109cdf0e10cSrcweir for (int i=0; i<xElements.length; i++) { 110cdf0e10cSrcweir Object o = xElements[i].getRealInterface(); 111cdf0e10cSrcweir log.println("Element " + i + ": " + o.toString() + " " + utils.getImplName(o)); 112cdf0e10cSrcweir } 113cdf0e10cSrcweir tRes.tested("getElements()", xElements != null); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir _hideElement()116cdf0e10cSrcweir public void _hideElement() { 117cdf0e10cSrcweir boolean hidden = oObj.hideElement(sElementName); 118cdf0e10cSrcweir tRes.tested("hideElement()", true); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir _isElementDocked()121cdf0e10cSrcweir public void _isElementDocked() { 122cdf0e10cSrcweir boolean docked = oObj.isElementDocked(sElementName); 123cdf0e10cSrcweir tRes.tested("isElementDocked()", true); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir _isElementFloating()126cdf0e10cSrcweir public void _isElementFloating() { 127cdf0e10cSrcweir boolean docked = oObj.isElementFloating(sElementName); 128cdf0e10cSrcweir tRes.tested("isElementFloating()", true); 129cdf0e10cSrcweir } 130cdf0e10cSrcweir _isElementVisible()131cdf0e10cSrcweir public void _isElementVisible() { 132cdf0e10cSrcweir boolean docked = oObj.isElementVisible(sElementName); 133cdf0e10cSrcweir tRes.tested("isElementVisible()", true); 134cdf0e10cSrcweir } 135cdf0e10cSrcweir _lock()136cdf0e10cSrcweir public void _lock() { 137cdf0e10cSrcweir oObj.lock(); 138cdf0e10cSrcweir tRes.tested("lock()", true); 139cdf0e10cSrcweir } 140cdf0e10cSrcweir _reset()141cdf0e10cSrcweir public void _reset() { 142cdf0e10cSrcweir oObj.reset(); 143cdf0e10cSrcweir tRes.tested("reset()", true); 144cdf0e10cSrcweir } 145cdf0e10cSrcweir _setDockingAreaAcceptor()146cdf0e10cSrcweir public void _setDockingAreaAcceptor() { 147cdf0e10cSrcweir oObj.setDockingAreaAcceptor(null); 148cdf0e10cSrcweir tRes.tested("setDockingAreaAcceptor()", true); 149cdf0e10cSrcweir } 150cdf0e10cSrcweir _setElementPos()151cdf0e10cSrcweir public void _setElementPos() { 152cdf0e10cSrcweir requiredMethod("createElement()"); 153cdf0e10cSrcweir Point p = new Point(); 154cdf0e10cSrcweir p.X = 0; 155cdf0e10cSrcweir p.Y = 150; 156cdf0e10cSrcweir oObj.setElementPos(sElementName, p); 157cdf0e10cSrcweir tRes.tested("setElementPos()", true); 158cdf0e10cSrcweir } 159cdf0e10cSrcweir _setElementPosSize()160cdf0e10cSrcweir public void _setElementPosSize() { 161cdf0e10cSrcweir requiredMethod("createElement()"); 162cdf0e10cSrcweir Point p = new Point(); 163cdf0e10cSrcweir p.X = 150; 164cdf0e10cSrcweir p.Y = 0; 165cdf0e10cSrcweir Size size = new Size(); 166cdf0e10cSrcweir size.Height = 50; 167cdf0e10cSrcweir size.Width = 80; 168cdf0e10cSrcweir oObj.setElementPosSize(sElementName, p, size); 169cdf0e10cSrcweir tRes.tested("setElementPosSize()", true); 170cdf0e10cSrcweir } 171cdf0e10cSrcweir _setElementSize()172cdf0e10cSrcweir public void _setElementSize() { 173cdf0e10cSrcweir requiredMethod("createElement()"); 174cdf0e10cSrcweir Size size = new Size(); 175cdf0e10cSrcweir size.Height = 80; 176cdf0e10cSrcweir size.Width = 50; 177cdf0e10cSrcweir oObj.setElementSize(sElementName, size); 178cdf0e10cSrcweir tRes.tested("setElementSize()", true); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir _showElement()181cdf0e10cSrcweir public void _showElement() { 182cdf0e10cSrcweir requiredMethod("createElement()"); 183cdf0e10cSrcweir boolean shown = oObj.showElement(sElementName); 184cdf0e10cSrcweir tRes.tested("showElement()", true); 185cdf0e10cSrcweir 186cdf0e10cSrcweir } 187cdf0e10cSrcweir _unlock()188cdf0e10cSrcweir public void _unlock() { 189cdf0e10cSrcweir requiredMethod("lock()"); 190cdf0e10cSrcweir oObj.unlock(); 191cdf0e10cSrcweir tRes.tested("unlock()", true); 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir } 195