Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / qadevOOo / runner / helper / ObjectInspectorModelImpl.java
blob5075c50e795bc4a4b85adc9d7c8f643c617d3c86
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************
29 package helper;
31 import com.sun.star.inspection.PropertyCategoryDescriptor;
32 import com.sun.star.inspection.XObjectInspectorModel;
34 /**
35 * This is an implementation of <CODE>ObjectInspectorModel</CODE>.
36 * @see com.sun.star.inspection.XObjectInspectorModel
38 public class ObjectInspectorModelImpl implements XObjectInspectorModel{
40 /**
41 * class variable which contains the implementations of
42 * <CODE>PropertyCategoryDescriptor</CODE>
43 * @see com.sun.star.inspection.PropertyCategoryDescriptor
45 PropertyCategoryDescriptor[] m_Categories;
47 /**
48 * class variable which contains the count of implementations of
49 * <CODE>PropertyCategoryDescriptor</CODE>
51 int m_count;
53 /**
54 * Creates a new instance of ObjectInspectorModelImpl
55 * For every count given in parameter <CODE>count</CODE> an
56 * <CODE>PropertyCategoryDescriptor</CODE> was created an filled with valuable content.
57 * @param count count of <CODE>PropertyCategoryDescriptor</CODE> to create
59 public ObjectInspectorModelImpl(int count) {
60 m_count = count;
61 m_Categories = new PropertyCategoryDescriptor[m_count];
62 int CategoryMem = 0;
63 int inCat = 0;
64 for (int n=0; n < m_count; n++ ){
66 m_Categories[n] = new PropertyCategoryDescriptor();
68 int category = n / 2;
69 inCat =(CategoryMem == category)? ++inCat: 1;
70 CategoryMem = category;
72 //System.out.println("Category" + category + "Number" + inCat);
73 m_Categories[n].ProgrammaticName = "Category" + category;
74 m_Categories[n].UIName = "Category" + category + "Number" + inCat;
75 m_Categories[n].HelpURL = "h:" + n;
79 /**
80 * returns the catrgories
81 * @return returns the catrgories
83 public PropertyCategoryDescriptor[] describeCategories() {
84 return m_Categories;
87 /**
88 * returns currently nothing
89 * @return nothing
91 public Object[] getHandlerFactories() {
92 return null;
95 /** determines whether the object inspector should have a help section
96 @return false
98 public boolean getHasHelpSection() {
99 return false;
102 /** returns minimum number of lines in the help text section.
103 @return 3
105 public int getMinHelpTextLines() {
106 return 3;
109 /** returns maximum number of lines in the help text section.
110 @return 8
112 public int getMaxHelpTextLines() {
113 return 8;
116 /** returns whether or not the inspector's UI should be read-only
118 public boolean getIsReadOnly() {
119 return false;
122 /** sets the inspector's read-only state
124 public void setIsReadOnly( boolean _IsReadOnly ) {
125 // not supported, and not used so far in our test cases
129 * retrieves an index in a global property ordering, for a given property name
130 * @param UIName the property whose global order index should be retrieved
131 * @throws com.sun.star.beans.UnknownPropertyException if the given property is unknown
132 * @return the global order index of PropertyName
134 public int getPropertyOrderIndex(String UIName) {
135 int index = 0;
136 for (int n=0; n < m_Categories.length; n++){
137 if (m_Categories[n].UIName.equals(UIName)){
138 index = n;
139 break;
142 return index;