2010-10-12 08:56:41 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2008-01-17 01:06:10 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 09:21:05 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2008-01-17 01:06:10 -06:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2008-01-17 01:06:10 -06:00
|
|
|
*
|
2008-04-10 09:21:05 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2008-01-17 01:06:10 -06:00
|
|
|
*
|
2008-04-10 09:21:05 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2008-01-17 01:06:10 -06:00
|
|
|
*
|
2008-04-10 09:21:05 -05:00
|
|
|
* 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.
|
2008-01-17 01:06:10 -06:00
|
|
|
*
|
2008-04-10 09:21:05 -05:00
|
|
|
* 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).
|
2008-01-17 01:06:10 -06:00
|
|
|
*
|
2008-04-10 09:21:05 -05:00
|
|
|
* 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.
|
2008-01-17 01:06:10 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2008-07-22 07:45:06 -05:00
|
|
|
#include "oox/drawingml/textfieldcontext.hxx"
|
2008-01-17 01:06:10 -06:00
|
|
|
#include "oox/drawingml/textparagraphpropertiescontext.hxx"
|
|
|
|
#include "oox/drawingml/textcharacterpropertiescontext.hxx"
|
2008-07-22 07:45:06 -05:00
|
|
|
#include "oox/drawingml/textfield.hxx"
|
2008-01-17 01:06:10 -06:00
|
|
|
|
|
|
|
using ::rtl::OUString;
|
|
|
|
using namespace ::oox::core;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::xml::sax;
|
|
|
|
|
|
|
|
namespace oox { namespace drawingml {
|
|
|
|
|
2008-07-22 07:45:06 -05:00
|
|
|
TextFieldContext::TextFieldContext( ContextHandler& rParent,
|
|
|
|
const Reference< XFastAttributeList >& rXAttributes,
|
|
|
|
TextField& rTextField)
|
|
|
|
: ContextHandler( rParent )
|
|
|
|
, mrTextField( rTextField )
|
|
|
|
, mbIsInText( false )
|
|
|
|
{
|
|
|
|
mrTextField.setUuid( rXAttributes->getOptionalValue( XML_id ) );
|
|
|
|
mrTextField.setType( rXAttributes->getOptionalValue( XML_type ) );
|
|
|
|
}
|
2008-01-17 01:06:10 -06:00
|
|
|
|
2008-07-22 07:45:06 -05:00
|
|
|
void TextFieldContext::endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException)
|
|
|
|
{
|
2010-11-08 06:47:01 -06:00
|
|
|
if( aElementToken == (A_TOKEN( t )) )
|
2008-01-17 01:06:10 -06:00
|
|
|
{
|
2008-07-22 07:45:06 -05:00
|
|
|
mbIsInText = false;
|
2008-01-17 01:06:10 -06:00
|
|
|
}
|
2008-07-22 07:45:06 -05:00
|
|
|
}
|
2008-01-17 01:06:10 -06:00
|
|
|
|
2008-07-22 07:45:06 -05:00
|
|
|
void TextFieldContext::characters( const OUString& aChars ) throw (SAXException, RuntimeException)
|
|
|
|
{
|
|
|
|
if( mbIsInText )
|
2008-01-17 01:06:10 -06:00
|
|
|
{
|
2008-07-22 07:45:06 -05:00
|
|
|
mrTextField.getText() += aChars;
|
2008-01-17 01:06:10 -06:00
|
|
|
}
|
2008-07-22 07:45:06 -05:00
|
|
|
}
|
2008-01-17 01:06:10 -06:00
|
|
|
|
2008-07-22 07:45:06 -05:00
|
|
|
Reference< XFastContextHandler > TextFieldContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
|
|
|
|
throw (SAXException, RuntimeException)
|
|
|
|
{
|
|
|
|
Reference< XFastContextHandler > xRet;
|
|
|
|
switch( aElementToken )
|
2008-01-17 01:06:10 -06:00
|
|
|
{
|
2010-11-08 06:47:01 -06:00
|
|
|
case A_TOKEN( rPr ):
|
2008-07-22 07:45:06 -05:00
|
|
|
xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mrTextField.getTextCharacterProperties() ) );
|
|
|
|
break;
|
2010-11-08 06:47:01 -06:00
|
|
|
case A_TOKEN( pPr ):
|
2008-07-22 07:45:06 -05:00
|
|
|
xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrTextField.getTextParagraphProperties() ) );
|
|
|
|
break;
|
2010-11-08 06:47:01 -06:00
|
|
|
case A_TOKEN( t ):
|
2008-07-22 07:45:06 -05:00
|
|
|
mbIsInText = true;
|
|
|
|
break;
|
2008-01-17 01:06:10 -06:00
|
|
|
}
|
2008-07-22 07:45:06 -05:00
|
|
|
if ( !xRet.is() )
|
|
|
|
xRet.set( this );
|
|
|
|
return xRet;
|
|
|
|
}
|
2008-01-17 01:06:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
} }
|
2010-10-12 08:56:41 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|