diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-09-09 09:48:00 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-09-09 09:48:00 +0000 |
commit | c29d3267dfccdf2b9c562a6b8fdd605bcb11d260 (patch) | |
tree | de1a1c7456d698cc9daf034a4ad0751e5558362a /xmloff | |
parent | 170409c1431e7bdd138d3bb0e6eed3cddab21bf1 (diff) |
INTEGRATION: CWS swqbugfixes06 (1.58.38); FILE MERGED
2004/08/26 07:42:54 od 1.58.38.2: RESYNC: (1.58-1.59); FILE MERGED
2004/08/24 14:22:05 od 1.58.38.1: #i33242# - correct handling of anchor position of at-character anchored
Writer fly frames and drawing objects of type 'Text'.
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 125 |
1 files changed, 70 insertions, 55 deletions
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 39e471b7d6..8a0dbafef9 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLTextFrameContext.cxx,v $ * - * $Revision: 1.59 $ + * $Revision: 1.60 $ * - * last change: $Author: obo $ $Date: 2004-08-12 08:51:02 $ + * last change: $Author: obo $ $Date: 2004-09-09 10:48:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,11 +59,11 @@ * ************************************************************************/ -#ifndef _TOOLS_DEBUG_HXX +#ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif -#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #endif #ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP @@ -72,25 +72,25 @@ #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ #include <com/sun/star/beans/XPropertySet.hpp> #endif -#ifndef _COM_SUN_STAR_TEXT_XTEXTFRAME_HPP_ +#ifndef _COM_SUN_STAR_TEXT_XTEXTFRAME_HPP_ #include <com/sun/star/text/XTextFrame.hpp> #endif -#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ +#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_ #include <com/sun/star/container/XNamed.hpp> #endif -#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HPP_ +#ifndef _COM_SUN_STAR_TEXT_SIZETYPE_HPP_ #include <com/sun/star/text/SizeType.hpp> #endif -#ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_ +#ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_ #include <com/sun/star/drawing/XShape.hpp> #endif #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP #include <com/sun/star/document/XEventsSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_DOCUMENT_XEMBEDDEDOBJECTSUPPLIER_HPP_ +#ifndef _COM_SUN_STAR_DOCUMENT_XEMBEDDEDOBJECTSUPPLIER_HPP_ #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> #endif -#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_ +#ifndef _COM_SUN_STAR_IO_XOUTPUTSTREAM_HPP_ #include <com/sun/star/io/XOutputStream.hpp> #endif #ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HPP_ @@ -99,22 +99,22 @@ #ifndef _COM_SUN_STAR_TEXT_VERTORIENTATION_HPP_ #include <com/sun/star/text/VertOrientation.hpp> #endif -#ifndef _XMLOFF_XMLIMP_HXX +#ifndef _XMLOFF_XMLIMP_HXX #include "xmlimp.hxx" #endif -#ifndef _XMLOFF_XMLTOKEN_HXX +#ifndef _XMLOFF_XMLTOKEN_HXX #include "xmltoken.hxx" #endif -#ifndef _XMLOFF_XMLNMSPE_HXX +#ifndef _XMLOFF_XMLNMSPE_HXX #include "xmlnmspe.hxx" #endif -#ifndef _XMLOFF_XMLKYWD_HXX +#ifndef _XMLOFF_XMLKYWD_HXX #include "xmlkywd.hxx" #endif -#ifndef _XMLOFF_NMSPMAP_HXX +#ifndef _XMLOFF_NMSPMAP_HXX #include "nmspmap.hxx" #endif -#ifndef _XMLOFF_XMLUCONV_HXX +#ifndef _XMLOFF_XMLUCONV_HXX #include "xmluconv.hxx" #endif #ifndef _XMLOFF_XMLANCHORTYPEPROPHDL_HXX @@ -126,10 +126,10 @@ #ifndef _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX #include "XMLBase64ImportContext.hxx" #endif -#ifndef _XMLOFF_PRSTYLEI_HXX_ +#ifndef _XMLOFF_PRSTYLEI_HXX_ #include "prstylei.hxx" #endif -#ifndef _XMLOFF_I18NMAP_HXX +#ifndef _XMLOFF_I18NMAP_HXX #include "i18nmap.hxx" #endif #ifndef _XEXPTRANSFORM_HXX @@ -201,9 +201,9 @@ class XMLTextFrameContextHyperlink_Impl sal_Bool bMap; public: - + inline XMLTextFrameContextHyperlink_Impl( const OUString& rHRef, - const OUString& rName, + const OUString& rName, const OUString& rTargetFrameName, sal_Bool bMap ); @@ -214,7 +214,7 @@ public: }; inline XMLTextFrameContextHyperlink_Impl::XMLTextFrameContextHyperlink_Impl( - const OUString& rHRef, const OUString& rName, + const OUString& rHRef, const OUString& rName, const OUString& rTargetFrameName, sal_Bool bM ) : sHRef( rHRef ), sName( rName ), @@ -383,7 +383,7 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( case XML_TOK_TEXT_CONTOUR_WIDTH: if( GetImport().GetMM100UnitConverter().convertMeasurePx( nWidth, rValue) ) - bPixelWidth = sal_True; + bPixelWidth = sal_True; else GetImport().GetMM100UnitConverter().convertMeasure( nWidth, rValue); @@ -458,11 +458,11 @@ XMLTextFrameContourContext_Impl::~XMLTextFrameContourContext_Impl() class XMLTextFrameContext_Impl : public SvXMLImportContext { - ::com::sun::star::uno::Reference < + ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > xOldTextCursor; - ::com::sun::star::uno::Reference < + ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > xPropSet; - ::com::sun::star::uno::Reference < + ::com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > xBase64Stream; /// old list item and block (#89891#) @@ -559,14 +559,14 @@ public: ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); void SetHyperlink( const ::rtl::OUString& rHRef, - const ::rtl::OUString& rName, + const ::rtl::OUString& rName, const ::rtl::OUString& rTargetFrameName, sal_Bool bMap ); void SetDesc( const ::rtl::OUString& rDesc ); ::com::sun::star::text::TextContentAnchorType GetAnchorType() const { return eAnchorType; } - const ::com::sun::star::uno::Reference < + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& GetPropSet() { return xPropSet; } }; @@ -608,7 +608,7 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) case XML_TEXT_FRAME_APPLET: { xPropSet = GetImport().GetTextImport() - ->createAndInsertApplet( sAppletName, sCode, + ->createAndInsertApplet( sAppletName, sCode, bMayScript, sHRef, nWidth, nHeight); break; @@ -633,7 +633,7 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) { Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(), UNO_QUERY ); - if( xFactory.is() ) + if( xFactory.is() ) { OUString sServiceName; switch( nType ) @@ -643,7 +643,7 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) } Reference<XInterface> xIfc = xFactory->createInstance( sServiceName ); DBG_ASSERT( xIfc.is(), "couldn't create frame" ); - if( xIfc.is() ) + if( xIfc.is() ) xPropSet = Reference < XPropertySet >( xIfc, UNO_QUERY ); } } @@ -662,7 +662,7 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) if( xNamed.is() ) { OUString sOrigName( xNamed->getName() ); - if( !sOrigName.getLength() || + if( !sOrigName.getLength() || (sName.getLength() && sOrigName != sName) ) { OUString sOldName( sName ); @@ -691,7 +691,7 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) Any aAny; if( sStyleName.getLength() ) { - OUString sDisplayStyleName( GetImport().GetStyleDisplayName( + OUString sDisplayStyleName( GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_SD_GRAPHICS_ID, sStyleName ) ); const Reference < XNameContainer > & rStyles = xTxtImport->GetFrameStyles(); @@ -714,7 +714,7 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) pStyle->FillPropertySet( xPropSet ); - // x and y + // x and y sal_Int16 nHoriOrient = HoriOrientation::NONE; aAny = xPropSet->getPropertyValue( sHoriOrient ); aAny >>= nHoriOrient; @@ -750,11 +750,11 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) aAny.setValue( &bTmp, ::getBooleanCppuType() ); xPropSet->setPropertyValue( sIsSyncWidthToHeight, aAny ); } - if( xPropSetInfo->hasPropertyByName( sWidthType ) && + if( xPropSetInfo->hasPropertyByName( sWidthType ) && (bMinWidth || nWidth > 0 || nRelWidth > 0 ) ) { sal_Int16 nSizeType = - (bMinWidth && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN + (bMinWidth && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN : SizeType::FIX; aAny <<= nSizeType; xPropSet->setPropertyValue( sWidthType, aAny ); @@ -776,11 +776,11 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) aAny.setValue( &bTmp, ::getBooleanCppuType() ); xPropSet->setPropertyValue( sIsSyncHeightToWidth, aAny ); } - if( xPropSetInfo->hasPropertyByName( sSizeType ) && + if( xPropSetInfo->hasPropertyByName( sSizeType ) && (bMinHeight || nHeight > 0 || nRelHeight > 0 ) ) { sal_Int16 nSizeType = - (bMinHeight && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN + (bMinHeight && XML_TEXT_FRAME_TEXTBOX == nType) ? SizeType::MIN : SizeType::FIX; aAny <<= nSizeType; xPropSet->setPropertyValue( sSizeType, aAny ); @@ -858,7 +858,7 @@ void XMLTextFrameContext_Impl::Create( sal_Bool bHRefOrBase64 ) xOldTextCursor = xTxtImport->GetCursor(); xTxtImport->SetCursor( xTxt->createTextCursor() ); - // remember old list item and block (#89892#) and reset them + // remember old list item and block (#89892#) and reset them // for the text frame xListBlock = xTxtImport->GetListBlock(); xListItem = xTxtImport->GetListItem(); @@ -942,9 +942,9 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( sal_Int16 nTotalAttrCount = nAttrCount + (rFrameAttrList.is() ? rFrameAttrList->getLength() : 0); for( sal_Int16 i=0; i < nTotalAttrCount; i++ ) { - const OUString& rAttrName = + const OUString& rAttrName = i < nAttrCount ? rAttrList->getNameByIndex( i ) : rFrameAttrList->getNameByIndex( i-nAttrCount ); - const OUString& rValue = + const OUString& rValue = i < nAttrCount ? rAttrList->getValueByIndex( i ): rFrameAttrList->getValueByIndex( i-nAttrCount ); OUString aLocalName; @@ -970,7 +970,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( TextContentAnchorType_AT_CHARACTER == eAnchorType || TextContentAnchorType_AS_CHARACTER == eAnchorType ) { - + TextContentAnchorType eNew; if( XMLAnchorTypePropHdl::convert( rValue, GetImport().GetMM100UnitConverter(), eNew ) && @@ -1025,7 +1025,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( break; case XML_TOK_TEXT_FRAME_MIN_WIDTH: if( rValue.indexOf( '%' ) != -1 ) - { + { sal_Int32 nTmp; GetImport().GetMM100UnitConverter().convertPercent( nTmp, rValue ); @@ -1073,7 +1073,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( break; case XML_TOK_TEXT_FRAME_MIN_HEIGHT: if( rValue.indexOf( '%' ) != -1 ) - { + { sal_Int32 nTmp; GetImport().GetMM100UnitConverter().convertPercent( nTmp, rValue ); @@ -1143,7 +1143,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( XML_TEXT_FRAME_OBJECT_OLE == nType) && !sHRef.getLength() ) || ( XML_TEXT_FRAME_APPLET == nType && !sCode.getLength() ) || - ( XML_TEXT_FRAME_PLUGIN == nType && + ( XML_TEXT_FRAME_PLUGIN == nType && sHRef.getLength() == 0 && sMimeType.getLength() == 0 ) ) return; // no URL: no image or OLE object @@ -1167,9 +1167,9 @@ void XMLTextFrameContext_Impl::EndElement() // reinstall old list item (if necessary) #89892# if ( xListBlock.Is() ) { - GetImport().GetTextImport()->SetListBlock( + GetImport().GetTextImport()->SetListBlock( (XMLTextListBlockContext*)&xListBlock ); - GetImport().GetTextImport()->SetListItem( + GetImport().GetTextImport()->SetListItem( (XMLTextListItemContext*)&xListItem ); } @@ -1220,7 +1220,7 @@ SvXMLImportContext *XMLTextFrameContext_Impl::CreateChildContext( } if( !pContext && ( XML_TEXT_FRAME_OBJECT == nType && - (XML_NAMESPACE_OFFICE == nPrefix && + (XML_NAMESPACE_OFFICE == nPrefix && IsXMLToken( rLocalName, XML_DOCUMENT )) || (XML_NAMESPACE_MATH == nPrefix && IsXMLToken(rLocalName, XML_MATH) ) ) ) @@ -1296,10 +1296,10 @@ void XMLTextFrameContext_Impl::Characters( const OUString& rChars ) sChars = sTrimmedChars; } Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 ); - sal_Int32 nCharsDecoded = + sal_Int32 nCharsDecoded = GetImport().GetMM100UnitConverter(). decodeBase64SomeChars( aBuffer, sChars ); - xBase64Stream->writeBytes( aBuffer ); + xBase64Stream->writeBytes( aBuffer ); if( nCharsDecoded != sChars.getLength() ) sBase64CharsLeft = sChars.copy( nCharsDecoded ); } @@ -1308,7 +1308,7 @@ void XMLTextFrameContext_Impl::Characters( const OUString& rChars ) } void XMLTextFrameContext_Impl::SetHyperlink( const OUString& rHRef, - const OUString& rName, + const OUString& rName, const OUString& rTargetFrameName, sal_Bool bMap ) { @@ -1373,7 +1373,7 @@ sal_Bool XMLTextFrameContext::CreateIfNotThere() return bRet; } -sal_Bool XMLTextFrameContext::CreateIfNotThere( ::com::sun::star::uno::Reference < +sal_Bool XMLTextFrameContext::CreateIfNotThere( ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& rPropSet ) { SvXMLImportContext *pContext = &m_xImplContext; @@ -1484,7 +1484,7 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( if( USHRT_MAX != nFrameType ) { - if( (XML_TEXT_FRAME_TEXTBOX == nFrameType || XML_TEXT_FRAME_GRAPHIC == nFrameType ) + if( (XML_TEXT_FRAME_TEXTBOX == nFrameType || XML_TEXT_FRAME_GRAPHIC == nFrameType ) && !m_bHasName ) { Reference < XShapes > xShapes; @@ -1523,7 +1523,7 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( { pContext = new XMLTextFrameContext_Impl( GetImport(), nPrefix, - rLocalName, xAttrList, + rLocalName, xAttrList, m_eDefaultAnchorType, nFrameType, m_xAttrList ); @@ -1593,7 +1593,7 @@ SvXMLImportContext *XMLTextFrameContext::CreateChildContext( } void XMLTextFrameContext::SetHyperlink( const OUString& rHRef, - const OUString& rName, + const OUString& rName, const OUString& rTargetFrameName, sal_Bool bMap ) { @@ -1620,6 +1620,21 @@ Reference < XTextContent > XMLTextFrameContext::GetTextContent() const XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext ); if( pImpl ) xTxtCntnt.set( pImpl->GetPropSet(), UNO_QUERY ); - + return xTxtCntnt; } + +// --> OD 2004-08-24 #33242# +Reference < XShape > XMLTextFrameContext::GetShape() const +{ + Reference < XShape > xShape; + SvXMLImportContext* pContext = &m_xImplContext; + SvXMLShapeContext* pImpl = PTR_CAST( SvXMLShapeContext, pContext ); + if ( pImpl ) + { + xShape = pImpl->getShape(); + } + + return xShape; +} +// <-- |