1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 package com.sun.star.wizards.reportbuilder.layout; 24 25 import com.sun.star.awt.FontDescriptor; 26 import com.sun.star.wizards.common.PropertyNames; 27 import com.sun.star.wizards.common.PropertySetHelper; 28 29 /** 30 * 31 * @author ll93751 32 */ 33 abstract public class SectionObject 34 { 35 36 Object m_aParentObject; // this could be FixedText or FormattedField or null 37 PropertySetHelper m_aPropertySetHelper; 38 SectionObject()39 public SectionObject() 40 { 41 m_aParentObject = null; 42 } 43 getParent()44 protected Object getParent() 45 { 46 return m_aParentObject; 47 } 48 getFontDescriptor()49 abstract public FontDescriptor getFontDescriptor(); 50 getPropertySetHelper()51 private PropertySetHelper getPropertySetHelper() 52 { 53 if (m_aPropertySetHelper == null) 54 { 55 m_aPropertySetHelper = new PropertySetHelper(getParent()); 56 } 57 return m_aPropertySetHelper; 58 } 59 getHeight(int _nDefault)60 public int getHeight(int _nDefault) 61 { 62 return getPropertySetHelper().getPropertyValueAsInteger(PropertyNames.PROPERTY_HEIGHT, _nDefault); 63 } 64 getCharWeight(float _nDefault)65 public float getCharWeight(float _nDefault) 66 { 67 return(float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault); 68 } 69 setFontToBold()70 public void setFontToBold() 71 { 72 setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD)); 73 } 74 setPropertyValue(String _sKey, Object _nValue)75 public void setPropertyValue(String _sKey, Object _nValue) 76 { 77 getPropertySetHelper().setPropertyValueDontThrow(_sKey, _nValue); 78 } 79 } 80