/* AbstractObjectHandler.java

	Purpose:
		
	Description:
		
	History:
		Fri, May 02, 2014 11:54:26 AM, Created by RaymondChao

Copyright (C) 2014 Potix Corporation. All Rights Reserved.

*/
package org.zkoss.zssex.ui.impl.ua;

import org.zkoss.zss.api.Ranges;
import org.zkoss.zss.api.model.Book;
import org.zkoss.zss.api.model.Sheet;
import org.zkoss.zss.ui.impl.ua.AbstractHandler;

/**
 * 
 * @author RaymondChao
 */
public abstract class AbstractObjectHandler extends AbstractHandler {
	private static final long serialVersionUID = -2450452988926080445L;

	@Override
	public boolean isEnabled(Book book, Sheet sheet) {
		return book != null && sheet != null && ( !sheet.isProtected() ||
				Ranges.range(sheet).getSheetProtection().isObjectsEditable());
	}
}
