summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorKatarina Machalkova <kmachalkova@suse.cz>2010-10-19 16:41:27 +0200
committerKatarina Machalkova <kmachalkova@suse.cz>2010-10-19 16:41:27 +0200
commit96c3e6d82eb24c1582e7582859f49b3ee998d18d (patch)
tree62fe12182718b9445db69a997bb5a98344719bf6 /sd/source
parent7c44931a14c700867750de4ebcfe1679eed45482 (diff)
Merged oox-pptx-export-animations-paragraph-target.diff
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/filter/pptx/pptexanimations.hxx1
-rw-r--r--sd/source/filter/pptx/pptx-epptooxml.cxx17
-rw-r--r--sd/source/filter/pptx/pptx-pptexanimations.cxx87
3 files changed, 66 insertions, 39 deletions
diff --git a/sd/source/filter/pptx/pptexanimations.hxx b/sd/source/filter/pptx/pptexanimations.hxx
index bbc9b6e32b80..7618467f3d28 100644
--- a/sd/source/filter/pptx/pptexanimations.hxx
+++ b/sd/source/filter/pptx/pptexanimations.hxx
@@ -144,6 +144,7 @@ public:
static sal_uInt32 GetValueTypeForAttributeName( const rtl::OUString& rAttributeName );
static const sal_Char* FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTargetElementShape( const ::com::sun::star::uno::Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, sal_Bool& rParagraphTarget );
};
} // namespace ppt
diff --git a/sd/source/filter/pptx/pptx-epptooxml.cxx b/sd/source/filter/pptx/pptx-epptooxml.cxx
index e93f735b94c9..7c9806e799c7 100644
--- a/sd/source/filter/pptx/pptx-epptooxml.cxx
+++ b/sd/source/filter/pptx/pptx-epptooxml.cxx
@@ -633,13 +633,24 @@ void PowerPointExport::WriteAnimationAttributeName( FSHelperPtr pFS, const OUStr
void PowerPointExport::WriteAnimationTarget( FSHelperPtr pFS, Any aTarget )
{
- Reference< XShape > rXShape( aTarget, UNO_QUERY );
+ sal_Int32 nBegin = -1, nEnd = -1;
+ sal_Bool bParagraphTarget;
+ Reference< XShape > rXShape = AnimationExporter::getTargetElementShape( aTarget, nBegin, nEnd, bParagraphTarget );
if( rXShape.is() ) {
pFS->startElementNS( XML_p, XML_tgtEl, FSEND );
- pFS->singleElementNS( XML_p, XML_spTgt,
- XML_spid, I32S( ShapeExport::GetShapeID( rXShape, &maShapeMap ) ),
+ pFS->startElementNS( XML_p, XML_spTgt,
+ XML_spid, I32S( ShapeExport::GetShapeID( rXShape, &maShapeMap ) ),
+ FSEND );
+ if( bParagraphTarget ) {
+ pFS->startElementNS( XML_p, XML_txEl, FSEND );
+ pFS->singleElementNS( XML_p, XML_pRg,
+ XML_st, I32S( nBegin ),
+ XML_end, I32S( nEnd ),
FSEND );
+ pFS->endElementNS( XML_p, XML_txEl );
+ }
+ pFS->endElementNS( XML_p, XML_spTgt );
pFS->endElementNS( XML_p, XML_tgtEl );
}
}
diff --git a/sd/source/filter/pptx/pptx-pptexanimations.cxx b/sd/source/filter/pptx/pptx-pptexanimations.cxx
index bf502ab655e8..70c5b38f6053 100644
--- a/sd/source/filter/pptx/pptx-pptexanimations.cxx
+++ b/sd/source/filter/pptx/pptx-pptexanimations.cxx
@@ -1761,54 +1761,69 @@ void AnimationExporter::exportAnimateTarget( SvStream& rStrm, const Reference< X
}
}
-void AnimationExporter::exportAnimateTargetElement( SvStream& rStrm, const Any aAny, const sal_Bool bCreate2b01Atom )
+Reference< XShape > AnimationExporter::getTargetElementShape( const Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, sal_Bool& rParagraphTarget )
{
Reference< XShape > xShape;
- aAny >>= xShape;
- sal_uInt32 nRefMode = 0; // nRefMode == 2 -> Paragraph
- sal_Int32 begin = -1;
- sal_Int32 end = -1;
+ rAny >>= xShape;
+
+ rParagraphTarget = sal_False;
if( !xShape.is() )
{
- ParagraphTarget aParaTarget;
- if( aAny >>= aParaTarget )
- xShape = aParaTarget.Shape;
- if ( xShape.is() )
+ ParagraphTarget aParaTarget;
+ if( rAny >>= aParaTarget )
+ xShape = aParaTarget.Shape;
+ if ( xShape.is() )
+ {
+ // now calculating the character range for the paragraph
+ sal_Int16 nParagraph = aParaTarget.Paragraph;
+ Reference< XSimpleText > xText( xShape, UNO_QUERY );
+ if ( xText.is() )
+ {
+ rParagraphTarget = sal_True;
+ Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY );
+ if ( xTextParagraphEnumerationAccess.is() )
{
- // now calculating the character range for the paragraph
- sal_Int16 nParagraph = aParaTarget.Paragraph;
- Reference< XSimpleText > xText( xShape, UNO_QUERY );
- if ( xText.is() )
+ Reference< XEnumeration > xTextParagraphEnumeration( xTextParagraphEnumerationAccess->createEnumeration() );
+ if ( xTextParagraphEnumeration.is() )
{
- nRefMode = 2;
- Reference< XEnumerationAccess > xTextParagraphEnumerationAccess( xText, UNO_QUERY );
- if ( xTextParagraphEnumerationAccess.is() )
+ sal_Int16 nCurrentParagraph;
+ rBegin = rEnd = nCurrentParagraph = 0;
+ while ( xTextParagraphEnumeration->hasMoreElements() )
+ {
+ Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY );
+ if ( xTextRange.is() )
{
- Reference< XEnumeration > xTextParagraphEnumeration( xTextParagraphEnumerationAccess->createEnumeration() );
- if ( xTextParagraphEnumeration.is() )
- {
- sal_Int16 nCurrentParagraph;
- begin = end = nCurrentParagraph = 0;
- while ( xTextParagraphEnumeration->hasMoreElements() )
- {
- Reference< XTextRange > xTextRange( xTextParagraphEnumeration->nextElement(), UNO_QUERY );
- if ( xTextRange.is() )
- {
- rtl::OUString aParaText( xTextRange->getString() );
- sal_Int32 nLength = aParaText.getLength() + 1;
- end += nLength;
- if ( nCurrentParagraph == nParagraph )
- break;
- nCurrentParagraph++;
- begin += nLength;
- }
- }
- }
+ rtl::OUString aParaText( xTextRange->getString() );
+ sal_Int32 nLength = aParaText.getLength() + 1;
+ rEnd += nLength;
+ if ( nCurrentParagraph == nParagraph )
+ break;
+ nCurrentParagraph++;
+ rBegin += nLength;
}
}
+ }
}
+ }
+ }
}
+
+ return xShape;
+}
+
+void AnimationExporter::exportAnimateTargetElement( SvStream& rStrm, const Any aAny, const sal_Bool bCreate2b01Atom )
+{
+ sal_uInt32 nRefMode = 0; // nRefMode == 2 -> Paragraph
+ sal_Int32 begin = -1;
+ sal_Int32 end = -1;
+ sal_Bool bParagraphTarget;
+
+ Reference< XShape > xShape = getTargetElementShape( aAny, begin, end, bParagraphTarget );
+
+ if( bParagraphTarget )
+ nRefMode = 2;
+
if ( xShape.is() || bCreate2b01Atom )
{
EscherExContainer aAnimateTargetElement( rStrm, DFF_msofbtAnimateTargetElement );