summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-09-09 09:48:54 +0000
committerOliver Bolte <obo@openoffice.org>2004-09-09 09:48:54 +0000
commit0127634bbfa86c13a4538ce6f185d0aedef6ac2b (patch)
tree3c1363365775e2f96773d78849a8fde8baabd870 /xmloff
parent8b82a998e746c182276e4eefcf6114f68cea8264 (diff)
INTEGRATION: CWS swqbugfixes06 (1.42.34); FILE MERGED
2004/08/24 14:22:06 od 1.42.34.2: #i33242# - correct handling of anchor position of at-character anchored Writer fly frames and drawing objects of type 'Text'. 2004/08/17 16:25:26 dvo 1.42.34.1: #117544# improve robustness with incorrect index entries
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtparai.cxx115
1 files changed, 80 insertions, 35 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index e1ec770ab5..7a8ab12a50 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: txtparai.cxx,v $
*
- * $Revision: 1.43 $
+ * $Revision: 1.44 $
*
- * last change: $Author: rt $ $Date: 2004-09-08 15:01:40 $
+ * last change: $Author: obo $ $Date: 2004-09-09 10:48:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -506,7 +506,7 @@ SvXMLImportContext *XMLImpHyperlinkContext_Impl::CreateChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList )
{
- if ( (nPrefix == XML_NAMESPACE_OFFICE) &&
+ if ( (nPrefix == XML_NAMESPACE_OFFICE) &&
IsXMLToken(rLocalName, XML_EVENT_LISTENERS) )
{
XMLEventsImportContext* pCtxt = new XMLEventsImportContext(
@@ -1102,9 +1102,10 @@ void XMLTOCMarkImportContext_Impl::ProcessAttribute(
{
// ouline level: set Level property
sal_Int32 nTmp;
- if (SvXMLUnitConverter::convertNumber(
- nTmp, sValue, 0,
- GetImport().GetTextImport()->GetChapterNumbering()->getCount()))
+ if ( SvXMLUnitConverter::convertNumber( nTmp, sValue )
+ && nTmp >= 1
+ && nTmp < GetImport().GetTextImport()->
+ GetChapterNumbering()->getCount() )
{
Any aAny;
aAny <<= (sal_Int16)(nTmp - 1);
@@ -1494,13 +1495,15 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
rImport.GetTextImport()->GetCursor()->getStart();
XMLTextFrameContext *pTextFrameContext =
new XMLTextFrameContext( rImport, nPrefix,
- rLocalName, xAttrList,
+ rLocalName, xAttrList,
TextContentAnchorType_AS_CHARACTER );
+ // --> OD 2004-08-24 #i33242# - remove check for text content.
+ // Check for text content is done on the processing of the hint
if( TextContentAnchorType_AT_CHARACTER ==
- pTextFrameContext->GetAnchorType() &&
- pTextFrameContext->GetTextContent().is() )
+ pTextFrameContext->GetAnchorType() )
+ // <--
{
- rHints.Insert( new XMLTextFrameHint_Impl(
+ rHints.Insert( new XMLTextFrameHint_Impl(
pTextFrameContext, xAnchorPos ),
rHints.Count() );
}
@@ -1512,9 +1515,9 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
{
Reference < XTextRange > xAnchorPos =
rImport.GetTextImport()->GetCursor()->getStart();
- pContext =
+ pContext =
new XMLTextFrameHyperlinkContext( rImport, nPrefix,
- rLocalName, xAttrList,
+ rLocalName, xAttrList,
TextContentAnchorType_AS_CHARACTER );
XMLTextFrameHint_Impl *pHint =
new XMLTextFrameHint_Impl( pContext, xAnchorPos);
@@ -1717,7 +1720,7 @@ XMLParaContext::~XMLParaContext()
xTxtImport->FindOutlineStyleName( sStyleName, nOutlineLevel );
// set style and hard attributes at the previous paragraph
- sStyleName = xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
+ sStyleName = xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
sStyleName, sal_True );
if( bHeading )
@@ -1737,7 +1740,7 @@ XMLParaContext::~XMLParaContext()
const OUString& rStyleName =
((XMLStyleHint_Impl *)pHint)->GetStyleName();
if( rStyleName.getLength() )
- xTxtImport->SetStyleAndAttrs( GetImport(),
+ xTxtImport->SetStyleAndAttrs( GetImport(),
xAttrCursor, rStyleName,
sal_False );
}
@@ -1805,39 +1808,81 @@ XMLParaContext::~XMLParaContext()
{
const XMLTextFrameHint_Impl *pFHint =
(const XMLTextFrameHint_Impl *)pHint;
- // OD 2004-04-20 #i26791#
- Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
- if ( pFHint->IsBoundAtChar() )
+ // --> OD 2004-08-24 #i33242# - check for text content
+ Reference < XTextContent > xTextContent =
+ pFHint->GetTextContent();
+ if ( xTextContent.is() )
{
- pFHint->GetTextContent()->attach( xRange );
+ // OD 2004-04-20 #i26791#
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+ if ( pFHint->IsBoundAtChar() )
+ {
+ xTextContent->attach( xRange );
+ }
}
+ // <--
+ // --> OD 2004-08-24 #i33242# - consider, that hint can
+ // also contain a shape - e.g. drawing object of type 'Text'.
+ else
+ {
+ Reference < XShape > xShape = pFHint->GetShape();
+ if ( xShape.is() )
+ {
+ // determine anchor type
+ Reference < XPropertySet > xPropSet( xShape, UNO_QUERY );
+ TextContentAnchorType eAnchorType =
+ TextContentAnchorType_AT_PARAGRAPH;
+ {
+ OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
+ Any aAny = xPropSet->getPropertyValue( sAnchorType );
+ aAny >>= eAnchorType;
+ }
+ if ( TextContentAnchorType_AT_CHARACTER == eAnchorType )
+ {
+ // set anchor position for at-character anchored objects
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+ Any aPos;
+ aPos <<= xRange;
+ OUString sTextRange( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) );
+ xPropSet->setPropertyValue(sTextRange, aPos);
+ }
+ }
+ }
+ // <--
}
break;
- // --> DVO, OD 2004-07-14 #i26791#
+ // --> DVO, OD 2004-07-14 #i26791#
case XML_HINT_DRAW:
{
const XMLDrawHint_Impl *pDHint =
static_cast<const XMLDrawHint_Impl*>(pHint);
- SvXMLShapeContext* pShapeContext = pDHint->GetShapeContext();
- // determine anchor type
- Reference < XPropertySet > xPropSet( pShapeContext->getShape(), UNO_QUERY );
- TextContentAnchorType eAnchorType = TextContentAnchorType_AT_PARAGRAPH;
- {
- OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
- Any aAny = xPropSet->getPropertyValue( sAnchorType );
- aAny >>= eAnchorType;
- }
- if ( TextContentAnchorType_AT_CHARACTER == eAnchorType )
+ // --> OD 2004-08-24 #i33242# - improvement: hint directly
+ // provides the shape.
+ Reference < XShape > xShape = pDHint->GetShape();
+ if ( xShape.is() )
{
- Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
- Any aPos;
- aPos <<= xRange;
- OUString sTextRange( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) );
- xPropSet->setPropertyValue(sTextRange, aPos);
+ // determine anchor type
+ Reference < XPropertySet > xPropSet( xShape, UNO_QUERY );
+ TextContentAnchorType eAnchorType = TextContentAnchorType_AT_PARAGRAPH;
+ {
+ OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) );
+ Any aAny = xPropSet->getPropertyValue( sAnchorType );
+ aAny >>= eAnchorType;
+ }
+ if ( TextContentAnchorType_AT_CHARACTER == eAnchorType )
+ {
+ // set anchor position for at-character anchored objects
+ Reference<XTextRange> xRange(xAttrCursor, UNO_QUERY);
+ Any aPos;
+ aPos <<= xRange;
+ OUString sTextRange( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) );
+ xPropSet->setPropertyValue(sTextRange, aPos);
+ }
}
+ // <--
}
break;
- // <--
+ // <--
default:
DBG_ASSERT( !this, "What's this" );