ff30491fc4
2009-09-09 11:45:28 +0200 dr r275979 : suncc failure 2009-09-09 11:33:34 +0200 dr r275977 : gcc warning 2009-09-09 11:09:02 +0200 er r275976 : #i87171# reworked name check for creating defined names 2009-09-09 10:38:02 +0200 dr r275973 : adapt changes in oox base class 2009-09-09 10:21:03 +0200 dr r275969 : remove faulty pagesize stuff 2009-09-09 10:20:13 +0200 dr r275968 : remove faulty pagesize stuff 2009-09-08 20:24:39 +0200 nn r275958 : #i104899# interpret cells when creating chart listener after loading 2009-09-08 16:05:37 +0200 er r275937 : ScXMLDDELinkContext::EndElement: Excel writes bad ODF <table:dde-link> <table:table> without <table:table-column>'s table:number-columns-repeated attribute; be lenient ... 2009-09-08 13:14:54 +0200 er r275925 : #i103315# handle external references in Excel's ODF msoxl namespace 2009-09-07 17:37:18 +0200 dr r275907 : #i104753# crash when deleting cell with note 2009-09-07 14:02:29 +0200 dr r275896 : #i103520# reworked sheet name buffer to resolve internal hyperlinks, fix almost all remaining problems with external links in BIFF, fix auto color import for BIFF 2009-09-06 20:01:05 +0200 er r275862 : #i35913# fix regression introduced by integration of CWS fhawfixes1; patch from <wsfulton> 2009-09-05 18:32:00 +0200 er r275847 : #i104156# merge #i103918# from uncloned dr68ooo311 2009-09-05 18:19:23 +0200 er r275846 : #i104156# merge #i103317# from uncloned dr68ooo311 2009-09-05 17:32:12 +0200 er r275844 : #i104484# glueState: correct casts in range bounds; patch from <cmc> slightly modified 2009-09-03 17:26:38 +0200 dr r275764 : #i103520# handle apostrophs in sheet names in internal URLs 2009-09-03 17:21:26 +0200 dr r275763 : #i95271# show text formatting in temp notes 2009-09-03 12:24:52 +0200 dr r275747 : unused declaration 2009-09-02 21:33:03 +0200 dr r275727 : #i96438# cleanup color handling in xls filter, extend VML color parser 2009-09-02 15:39:57 +0200 dr r275715 : #158571# #i96438# accept also VML colors in the form '#RRGGBB [xyz]' 2009-09-02 15:16:36 +0200 dr r275714 : #158571# #i96438# set note text 2009-09-02 14:59:33 +0200 dr r275713 : #158571# #i96438# load custom line dashes from DrawingML and VML 2009-09-02 11:53:35 +0200 dr r275702 : #158571# #i96438# import VML fill gradients 2009-08-31 19:28:10 +0200 dr r275632 : #158571# #i96438# more vml formatting 2009-08-31 14:29:30 +0200 dr r275606 : #158571# #i96438# changed handling of xml token ids/names 2009-08-28 18:25:26 +0200 dr r275545 : #158571# #i96438# preparations for and basic support of VML shape formatting, load spreadsheet cell notes position, formatting, and visibility 2009-08-25 19:08:31 +0200 dr r275378 : #i103390# dump BIFF STYLEEXT 2009-08-25 18:28:50 +0200 dr r275377 : #i103390# improve built-in style handling 2009-08-25 18:27:38 +0200 dr r275376 : #i103390# improve built-in style handling 2009-08-04 18:49:40 +0200 dr r274629 : CWS-TOOLING: rebase CWS dr69 to trunk@274622 (milestone: DEV300:m54)
160 lines
5.9 KiB
C++
160 lines
5.9 KiB
C++
/*************************************************************************
|
|
*
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
|
*
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
*
|
|
* $RCSfile: tablebuffer.cxx,v $
|
|
* $Revision: 1.4 $
|
|
*
|
|
* This file is part of OpenOffice.org.
|
|
*
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
* only, as published by the Free Software Foundation.
|
|
*
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License version 3 for more details
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
* <http://www.openoffice.org/license.html>
|
|
* for a copy of the LGPLv3 License.
|
|
*
|
|
************************************************************************/
|
|
|
|
#include "oox/xls/commentsbuffer.hxx"
|
|
#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
|
|
#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
|
|
#include <com/sun/star/sheet/XSheetAnnotations.hpp>
|
|
#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
|
|
#include "oox/helper/attributelist.hxx"
|
|
#include "oox/helper/recordinputstream.hxx"
|
|
#include "oox/vml/vmlshape.hxx"
|
|
#include "oox/xls/addressconverter.hxx"
|
|
#include "oox/xls/drawingfragment.hxx"
|
|
|
|
using ::rtl::OUString;
|
|
using ::com::sun::star::uno::Reference;
|
|
using ::com::sun::star::uno::Exception;
|
|
using ::com::sun::star::uno::UNO_QUERY_THROW;
|
|
using ::com::sun::star::uno::UNO_SET_THROW;
|
|
using ::com::sun::star::drawing::XShape;
|
|
using ::com::sun::star::table::CellAddress;
|
|
using ::com::sun::star::sheet::XSheetAnnotation;
|
|
using ::com::sun::star::sheet::XSheetAnnotationAnchor;
|
|
using ::com::sun::star::sheet::XSheetAnnotationShapeSupplier;
|
|
using ::com::sun::star::sheet::XSheetAnnotations;
|
|
using ::com::sun::star::sheet::XSheetAnnotationsSupplier;
|
|
|
|
namespace oox {
|
|
namespace xls {
|
|
|
|
// ============================================================================
|
|
|
|
CommentModel::CommentModel() :
|
|
mnAuthorId( -1 )
|
|
{
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
Comment::Comment( const WorksheetHelper& rHelper ) :
|
|
WorksheetHelper( rHelper )
|
|
{
|
|
}
|
|
|
|
void Comment::importComment( const AttributeList& rAttribs )
|
|
{
|
|
maModel.mnAuthorId = rAttribs.getInteger( XML_authorId, -1 );
|
|
// cell range will be checked while inserting the comment into the document
|
|
getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex() );
|
|
}
|
|
|
|
void Comment::importComment( RecordInputStream& rStrm )
|
|
{
|
|
BinRange aBinRange;
|
|
rStrm >> maModel.mnAuthorId >> aBinRange;
|
|
// cell range will be checked while inserting the comment into the document
|
|
getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, aBinRange, getSheetIndex() );
|
|
}
|
|
|
|
RichStringRef Comment::createText()
|
|
{
|
|
maModel.mxText.reset( new RichString( *this ) );
|
|
return maModel.mxText;
|
|
}
|
|
|
|
void Comment::finalizeImport()
|
|
{
|
|
// OOBIN format stores cell range instead of cell address, use first cell of this range
|
|
OSL_ENSURE( (maModel.maRange.StartColumn == maModel.maRange.EndColumn) &&
|
|
(maModel.maRange.StartRow == maModel.maRange.EndRow),
|
|
"Comment::finalizeImport - comment anchor should be a single cell" );
|
|
CellAddress aNotePos( maModel.maRange.Sheet, maModel.maRange.StartColumn, maModel.maRange.StartRow );
|
|
if( getAddressConverter().checkCellAddress( aNotePos, true ) && maModel.mxText.get() ) try
|
|
{
|
|
maModel.mxText->finalizeImport();
|
|
OUString aNoteText = maModel.mxText->getPlainText();
|
|
// non-empty string required by note implementation
|
|
if( aNoteText.getLength() > 0 )
|
|
{
|
|
Reference< XSheetAnnotationsSupplier > xAnnosSupp( getSheet(), UNO_QUERY_THROW );
|
|
Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW );
|
|
xAnnos->insertNew( aNotePos, aNoteText );
|
|
// receive craeted note from cell (insertNew does not return the note)
|
|
Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( aNotePos ), UNO_QUERY_THROW );
|
|
Reference< XSheetAnnotation > xAnno( xAnnoAnchor->getAnnotation(), UNO_SET_THROW );
|
|
Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnno, UNO_QUERY_THROW );
|
|
Reference< XShape > xAnnoShape( xAnnoShapeSupp->getAnnotationShape(), UNO_SET_THROW );
|
|
// convert shape formatting
|
|
if( const ::oox::vml::ShapeBase* pNoteShape = getVmlDrawing().getNoteShape( aNotePos ) )
|
|
{
|
|
// position and formatting
|
|
pNoteShape->convertFormatting( xAnnoShape );
|
|
// visibility
|
|
const ::oox::vml::ShapeModel::ShapeClientDataPtr& rxClientData = pNoteShape->getShapeModel().mxClientData;
|
|
bool bVisible = rxClientData.get() && rxClientData->mbVisible;
|
|
xAnno->setIsVisible( bVisible );
|
|
}
|
|
}
|
|
}
|
|
catch( Exception& )
|
|
{
|
|
}
|
|
}
|
|
|
|
// ============================================================================
|
|
|
|
CommentsBuffer::CommentsBuffer( const WorksheetHelper& rHelper ) :
|
|
WorksheetHelper( rHelper )
|
|
{
|
|
}
|
|
|
|
void CommentsBuffer::appendAuthor( const OUString& rAuthor )
|
|
{
|
|
maAuthors.push_back( rAuthor );
|
|
}
|
|
|
|
CommentRef CommentsBuffer::createComment()
|
|
{
|
|
CommentRef xComment( new Comment( *this ) );
|
|
maComments.push_back( xComment );
|
|
return xComment;
|
|
}
|
|
|
|
void CommentsBuffer::finalizeImport()
|
|
{
|
|
maComments.forEachMem( &Comment::finalizeImport );
|
|
}
|
|
|
|
// ============================================================================
|
|
|
|
} // namespace xls
|
|
} // namespace oox
|
|
|