update dev300-m58
[ooovba.git] / qadevOOo / runner / helper / ObjectInspectorModelImpl.java
blobf738fda20f57b0ecfd560b0d48ee52c6d0747d9a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ObjectInspectorModelImpl.java,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************
32 package helper;
34 import com.sun.star.inspection.PropertyCategoryDescriptor;
35 import com.sun.star.inspection.XObjectInspectorModel;
37 /**
38 * This is an implementation of <CODE>ObjectInspectorModel</CODE>.
39 * @see com.sun.star.inspection.XObjectInspectorModel
41 public class ObjectInspectorModelImpl implements XObjectInspectorModel{
43 /**
44 * class variable which contains the implementations of
45 * <CODE>PropertyCategoryDescriptor</CODE>
46 * @see com.sun.star.inspection.PropertyCategoryDescriptor
48 PropertyCategoryDescriptor[] m_Categories;
50 /**
51 * class variable which contains the count of implementations of
52 * <CODE>PropertyCategoryDescriptor</CODE>
54 int m_count;
56 /**
57 * Creates a new instance of ObjectInspectorModelImpl
58 * For every count given in parameter <CODE>count</CODE> an
59 * <CODE>PropertyCategoryDescriptor</CODE> was created an filled with valuable content.
60 * @param count count of <CODE>PropertyCategoryDescriptor</CODE> to create
62 public ObjectInspectorModelImpl(int count) {
63 m_count = count;
64 m_Categories = new PropertyCategoryDescriptor[m_count];
65 int CategoryMem = 0;
66 int inCat = 0;
67 for (int n=0; n < m_count; n++ ){
69 m_Categories[n] = new PropertyCategoryDescriptor();
71 int category = n / 2;
72 inCat =(CategoryMem == category)? ++inCat: 1;
73 CategoryMem = category;
75 //System.out.println("Category" + category + "Number" + inCat);
76 m_Categories[n].ProgrammaticName = "Category" + category;
77 m_Categories[n].UIName = "Category" + category + "Number" + inCat;
78 m_Categories[n].HelpURL = "h:" + n;
82 /**
83 * returns the catrgories
84 * @return returns the catrgories
86 public PropertyCategoryDescriptor[] describeCategories() {
87 return m_Categories;
90 /**
91 * returns currently nothing
92 * @return nothing
94 public Object[] getHandlerFactories() {
95 return null;
98 /** determines whether the object inspector should have a help section
99 @return false
101 public boolean getHasHelpSection() {
102 return false;
105 /** returns minimum number of lines in the help text section.
106 @return 3
108 public int getMinHelpTextLines() {
109 return 3;
112 /** returns maximum number of lines in the help text section.
113 @return 8
115 public int getMaxHelpTextLines() {
116 return 8;
119 /** returns whether or not the inspector's UI should be read-only
121 public boolean getIsReadOnly() {
122 return false;
125 /** sets the inspector's read-only state
127 public void setIsReadOnly( boolean _IsReadOnly ) {
128 // not supported, and not used so far in our test cases
132 * retrieves an index in a global property ordering, for a given property name
133 * @param UIName the property whose global order index should be retrieved
134 * @throws com.sun.star.beans.UnknownPropertyException if the given property is unknown
135 * @return the global order index of PropertyName
137 public int getPropertyOrderIndex(String UIName) {
138 int index = 0;
139 for (int n=0; n < m_Categories.length; n++){
140 if (m_Categories[n].UIName.equals(UIName)){
141 index = n;
142 break;
145 return index;