mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@491629 13f79535-47bb-0310-9956-ffa450edef68
144 lines
4.0 KiB
Java
144 lines
4.0 KiB
Java
/* ====================================================================
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
this work for additional information regarding copyright ownership.
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
(the "License"); you may not use this file except in compliance with
|
|
the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
==================================================================== */
|
|
package org.apache.poi.hssf.usermodel;
|
|
|
|
import org.apache.poi.hssf.record.EscherAggregate;
|
|
import org.apache.poi.hssf.record.NoteRecord;
|
|
import org.apache.poi.hssf.record.TextObjectRecord;
|
|
import org.apache.poi.ddf.*;
|
|
|
|
import java.util.Map;
|
|
import java.util.List;
|
|
import java.util.Iterator;
|
|
|
|
/**
|
|
* Represents a cell comment - a sticky note associated with a cell.
|
|
*
|
|
* @author Yegor Kolzlov
|
|
*/
|
|
public class HSSFComment extends HSSFTextbox {
|
|
|
|
private boolean visible;
|
|
private short col, row;
|
|
private String author;
|
|
|
|
/**
|
|
* Construct a new comment with the given parent and anchor.
|
|
*
|
|
* @param parent
|
|
* @param anchor defines position of this anchor in the sheet
|
|
*/
|
|
public HSSFComment( HSSFShape parent, HSSFAnchor anchor )
|
|
{
|
|
super( parent, anchor );
|
|
setShapeType(OBJECT_TYPE_COMMENT);
|
|
|
|
//default color for comments
|
|
fillColor = 0x08000050;
|
|
|
|
//by default comments are hidden
|
|
visible = false;
|
|
|
|
author = "";
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns whether this comment is visible.
|
|
*
|
|
* @param visible <code>true</code> if the comment is visible, <code>false</code> otherwise
|
|
*/
|
|
public void setVisible(boolean visible){
|
|
this.visible = visible;
|
|
}
|
|
|
|
/**
|
|
* Sets whether this comment is visible.
|
|
*
|
|
* @return <code>true</code> if the comment is visible, <code>false</code> otherwise
|
|
*/
|
|
public boolean isVisible(){
|
|
return this.visible;
|
|
}
|
|
|
|
/**
|
|
* Return the row of the cell that contains the comment
|
|
*
|
|
* @return the 0-based row of the cell that contains the comment
|
|
*/
|
|
public int getRow(){
|
|
return row;
|
|
}
|
|
|
|
/**
|
|
* Set the row of the cell that contains the comment
|
|
*
|
|
* @param row the 0-based row of the cell that contains the comment
|
|
*/
|
|
public void setRow(int row){
|
|
this.row = (short)row;
|
|
}
|
|
|
|
/**
|
|
* Return the column of the cell that contains the comment
|
|
*
|
|
* @return the 0-based column of the cell that contains the comment
|
|
*/
|
|
public short getColumn(){
|
|
return col;
|
|
}
|
|
|
|
/**
|
|
* Set the column of the cell that contains the comment
|
|
*
|
|
* @param col the 0-based column of the cell that contains the comment
|
|
*/
|
|
public void setColumn(short col){
|
|
this.col = col;
|
|
}
|
|
|
|
/**
|
|
* Name of the original comment author
|
|
*
|
|
* @return the name of the original author of the comment
|
|
*/
|
|
public String getAuthor(){
|
|
return author;
|
|
}
|
|
|
|
/**
|
|
* Name of the original comment author
|
|
*
|
|
* @param author the name of the original author of the comment
|
|
*/
|
|
public void setAuthor(String author){
|
|
this.author = author;
|
|
}
|
|
|
|
/**
|
|
* Sets the rich text string used by this comment.
|
|
*
|
|
* @param string Sets the rich text string used by this object.
|
|
*/
|
|
public void setString( HSSFRichTextString string )
|
|
{
|
|
//if font is not set we must set the default one implicitly
|
|
if (string.numFormattingRuns() == 0) string.applyFont((short)0);
|
|
super.setString(string);
|
|
}
|
|
}
|