[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 4 commits - editeng/source slideshow/source svx/source

Thorsten Behrens thorsten at kemper.freedesktop.org
Thu Dec 22 15:03:02 PST 2011


 editeng/source/editeng/impedit3.cxx                          |   42 +++---
 slideshow/source/engine/animationnodes/animationbasenode.cxx |   77 +++++------
 slideshow/source/engine/shapes/drawshape.cxx                 |   52 -------
 slideshow/source/engine/shapes/drawshape.hxx                 |    1 
 slideshow/source/engine/shapes/drawshapesubsetting.cxx       |   17 ++
 slideshow/source/engine/shapes/gdimtftools.cxx               |   28 +---
 slideshow/source/engine/shapes/gdimtftools.hxx               |    3 
 slideshow/source/engine/slide/slideimpl.cxx                  |    8 +
 svx/source/unodraw/UnoGraphicExporter.cxx                    |    7 -
 9 files changed, 98 insertions(+), 137 deletions(-)

New commits:
commit 2f61b26e593b3356c70a7995742935c997ff664a
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Thu Dec 22 23:46:02 2011 +0100

    Correctly handle empty paragraphs in slideshow animation fdo#43684
    
    Fix a problem with empty paragraphs, that previously did not get
    proper end-of-para / end-of-line markup, thus the slideshow mis-
    counting them when getting index-based animation targets.

diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 7c0ae49..ffdd294 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3455,6 +3455,27 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                                             aOverlineColor, aTextLineColor);
                                     }
                                 }
+                                else if ( bStripOnly )
+                                {
+                                    // #i108052# When stripping, a callback for _empty_ paragraphs is also needed.
+                                    // This was optimized away (by not rendering the space-only tab portion), so do
+                                    // it manually here.
+                                    const bool bEndOfLine(y == pLine->GetEndPortion());
+                                    const bool bEndOfParagraph(bEndOfLine && nLine + 1 == nLines);
+
+                                    const Color aOverlineColor(pOutDev->GetOverlineColor());
+                                    const Color aTextLineColor(pOutDev->GetTextLineColor());
+
+                                    GetEditEnginePtr()->DrawingText(
+                                        aTmpPos, String(), 0, 0, 0,
+                                        aTmpFont, n, nIndex, 0,
+                                        0,
+                                        0,
+                                        bEndOfLine, bEndOfParagraph, false,
+                                        0,
+                                        aOverlineColor,
+                                        aTextLineColor);
+                                }
                             }
                             break;
                         }
commit c37c90f5ba271c4086cc7acf989fbd598e621240
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Thu Dec 22 12:46:22 2011 +0100

    Fix slideshow text animations - fdo#43837
    
    String compare was not replaced equivalently, this needs matching
    against the XTEXT prefix, not exactly
    
    Removed VERBOSE_TEXTCOMMENTS exporter flag, that's now unused.
    
    Added some verbose-mode trace output

diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx
index 0e3ed61..17ac98f 100644
--- a/slideshow/source/engine/shapes/drawshape.cxx
+++ b/slideshow/source/engine/shapes/drawshape.cxx
@@ -270,39 +270,6 @@ namespace slideshow
             }
         }
 
-        void DrawShape::ensureVerboseMtfComments() const
-        {
-            // TODO(F1): Text effects don't currently work for drawing
-            // layer animations.
-
-            // only touch mpCurrMtf, if we're not a DrawingLayer
-            // animation.
-            if( (mnCurrMtfLoadFlags & MTF_LOAD_VERBOSE_COMMENTS) == 0 &&
-                maAnimationFrames.empty() )
-            {
-                ENSURE_OR_THROW( !maSubsetting.hasSubsetShapes(),
-                                  "DrawShape::ensureVerboseMtfComments(): reloading the metafile "
-                                  "with active child subsets will wreak havoc on the view!" );
-                ENSURE_OR_THROW( maSubsetting.getSubsetNode().isEmpty(),
-                                  "DrawShape::ensureVerboseMtfComments(): reloading the metafile "
-                                  "for an ALREADY SUBSETTED shape is not possible!" );
-
-                // re-fetch metafile with comments
-                // note that, in case of shapes without text, the new
-                // metafile might still not provide any useful
-                // subsetting information!
-                mpCurrMtf.reset( new GDIMetaFile );
-                mnCurrMtfLoadFlags |= MTF_LOAD_VERBOSE_COMMENTS;
-                local_getMetaFile_WithSpecialChartHandling(
-                    uno::Reference<lang::XComponent>(mxShape, uno::UNO_QUERY),
-                    mxPage, *mpCurrMtf, mnCurrMtfLoadFlags,
-                    mxComponentContext );
-
-                maSubsetting.reset( maSubsetting.getSubsetNode(),
-                                    mpCurrMtf );
-            }
-        }
-
         ViewShape::RenderArgs DrawShape::getViewRenderArgs() const
         {
             return ViewShape::RenderArgs(
@@ -1326,17 +1293,12 @@ namespace slideshow
 
         DocTreeNode DrawShape::getSubsetNode() const
         {
-            ensureVerboseMtfComments();
-
             // forward to delegate
             return maSubsetting.getSubsetNode();
         }
 
         AttributableShapeSharedPtr DrawShape::getSubset( const DocTreeNode& rTreeNode ) const
         {
-            ENSURE_OR_THROW( (mnCurrMtfLoadFlags & MTF_LOAD_VERBOSE_COMMENTS) != 0,
-                              "DrawShape::getSubset(): subset query on shape with apparently no subsets" );
-
             // forward to delegate
             return maSubsetting.getSubsetShape( rTreeNode );
         }
@@ -1344,9 +1306,6 @@ namespace slideshow
         bool DrawShape::createSubset( AttributableShapeSharedPtr&   o_rSubset,
                                       const DocTreeNode&            rTreeNode )
         {
-            ENSURE_OR_THROW( (mnCurrMtfLoadFlags & MTF_LOAD_VERBOSE_COMMENTS) != 0,
-                              "DrawShape::createSubset(): subset query on shape with apparently no subsets" );
-
             // subset shape already created for this DocTreeNode?
             AttributableShapeSharedPtr pSubset( maSubsetting.getSubsetShape( rTreeNode ) );
 
@@ -1388,9 +1347,6 @@ namespace slideshow
 
         bool DrawShape::revokeSubset( const AttributableShapeSharedPtr& rShape )
         {
-            ENSURE_OR_THROW( (mnCurrMtfLoadFlags & MTF_LOAD_VERBOSE_COMMENTS) != 0,
-                              "DrawShape::createSubset(): subset query on shape with apparently no subsets" );
-
             // flush bounds cache
             maCurrentShapeUnitBounds.reset();
 
@@ -1436,16 +1392,12 @@ namespace slideshow
 
         sal_Int32 DrawShape::getNumberOfTreeNodes( DocTreeNode::NodeType eNodeType ) const // throw ShapeLoadFailedException
         {
-            ensureVerboseMtfComments();
-
             return maSubsetting.getNumberOfTreeNodes( eNodeType );
         }
 
         DocTreeNode DrawShape::getTreeNode( sal_Int32               nNodeIndex,
                                             DocTreeNode::NodeType   eNodeType ) const // throw ShapeLoadFailedException
         {
-            ensureVerboseMtfComments();
-
             if ( hasHyperlinks())
             {
                 prepareHyperlinkIndices();
@@ -1457,8 +1409,6 @@ namespace slideshow
         sal_Int32 DrawShape::getNumberOfSubsetTreeNodes ( const DocTreeNode&    rParentNode,
                                                           DocTreeNode::NodeType eNodeType ) const // throw ShapeLoadFailedException
         {
-            ensureVerboseMtfComments();
-
             return maSubsetting.getNumberOfSubsetTreeNodes( rParentNode, eNodeType );
         }
 
@@ -1466,8 +1416,6 @@ namespace slideshow
                                                   sal_Int32             nNodeIndex,
                                                   DocTreeNode::NodeType eNodeType ) const // throw ShapeLoadFailedException
         {
-            ensureVerboseMtfComments();
-
             return maSubsetting.getSubsetTreeNode( rParentNode, nNodeIndex, eNodeType );
         }
     }
diff --git a/slideshow/source/engine/shapes/drawshape.hxx b/slideshow/source/engine/shapes/drawshape.hxx
index 1800ab3..4fcb01c 100644
--- a/slideshow/source/engine/shapes/drawshape.hxx
+++ b/slideshow/source/engine/shapes/drawshape.hxx
@@ -287,7 +287,6 @@ namespace slideshow
             ViewShape::RenderArgs   getViewRenderArgs() const;
             ::basegfx::B2DRectangle getActualUnitShapeBounds() const;
 
-            void ensureVerboseMtfComments() const;
             bool hasIntrinsicAnimation() const;
             bool hasHyperlinks() const;
             void prepareHyperlinkIndices() const;
diff --git a/slideshow/source/engine/shapes/drawshapesubsetting.cxx b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
index bb43fba..1790aba 100644
--- a/slideshow/source/engine/shapes/drawshapesubsetting.cxx
+++ b/slideshow/source/engine/shapes/drawshapesubsetting.cxx
@@ -88,8 +88,10 @@ namespace slideshow
                     {
                         MetaCommentAction* pAct = static_cast<MetaCommentAction*>(pCurrAct);
 
-                        // skip comment if not a special XTEXT comment
-                        if( pAct->GetComment().equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("XTEXT")) )
+                        // skip comment if not a special XTEXT... comment
+                        if( pAct->GetComment().matchIgnoreAsciiCase(
+                                rtl::OString(RTL_CONSTASCII_STRINGPARAM("XTEXT")),
+                                0) )
                         {
                             // fill classification vector with NOOPs,
                             // then insert corresponding classes at
@@ -155,6 +157,8 @@ namespace slideshow
                                 maActionClassVector[ nActionIndex ] = CLASS_SHAPE_START;
                             }
                         }
+                        VERBOSE_TRACE( "Shape text structure: %s at action #%d",
+                                       pAct->GetComment().getStr(), nActionIndex );
                         ++nActionIndex;
                         break;
                     }
@@ -162,6 +166,15 @@ namespace slideshow
                     case META_TEXTARRAY_ACTION:
                     case META_STRETCHTEXT_ACTION:
                         nLastTextActionIndex = nActionIndex;
+#if OSL_DEBUG_LEVEL > 1
+                        {
+                            MetaTextAction* pText = static_cast<MetaTextAction*>(pCurrAct);
+                            VERBOSE_TRACE( "Shape text \"%s\" at action #%d",
+                                           ByteString(pText->GetText(),
+                                                      RTL_TEXTENCODING_ISO_8859_1).GetBuffer(),
+                                           nActionIndex );
+                        }
+#endif
                         // fallthrough intended
                     default:
                         // comment action and all actions not
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx b/slideshow/source/engine/shapes/gdimtftools.cxx
index e58c1bb..e1b4a47 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -224,21 +224,18 @@ bool getMetaFile( const uno::Reference< lang::XComponent >&       xSource,
     aProps[1].Name = OUSTR("GraphicRenderer");
     aProps[1].Value <<= xRenderer;
 
-    uno::Sequence< beans::PropertyValue > aFilterData(5);
-    aFilterData[0].Name = OUSTR("VerboseComments");
-    aFilterData[0].Value <<= ((mtfLoadFlags & MTF_LOAD_VERBOSE_COMMENTS) != 0);
+    uno::Sequence< beans::PropertyValue > aFilterData(4);
+    aFilterData[0].Name = OUSTR("ScrollText");
+    aFilterData[0].Value <<= ((mtfLoadFlags & MTF_LOAD_SCROLL_TEXT_MTF) != 0);
 
-    aFilterData[1].Name = OUSTR("ScrollText");
-    aFilterData[1].Value <<= ((mtfLoadFlags & MTF_LOAD_SCROLL_TEXT_MTF) != 0);
+    aFilterData[1].Name = OUSTR("ExportOnlyBackground");
+    aFilterData[1].Value <<= ((mtfLoadFlags & MTF_LOAD_BACKGROUND_ONLY) != 0);
 
-    aFilterData[2].Name = OUSTR("ExportOnlyBackground");
-    aFilterData[2].Value <<= ((mtfLoadFlags & MTF_LOAD_BACKGROUND_ONLY) != 0);
+    aFilterData[2].Name = OUSTR("Version");
+    aFilterData[2].Value <<= static_cast<sal_Int32>( SOFFICE_FILEFORMAT_50 );
 
-    aFilterData[3].Name = OUSTR("Version");
-    aFilterData[3].Value <<= static_cast<sal_Int32>( SOFFICE_FILEFORMAT_50 );
-
-    aFilterData[4].Name = OUSTR("CurrentPage");
-    aFilterData[4].Value <<= uno::Reference< uno::XInterface >( xContainingPage,
+    aFilterData[3].Name = OUSTR("CurrentPage");
+    aFilterData[3].Value <<= uno::Reference< uno::XInterface >( xContainingPage,
                                                                 uno::UNO_QUERY_THROW );
 
     aProps[2].Name = OUSTR("FilterData");
@@ -478,9 +475,10 @@ bool getRectanglesFromScrollMtf( ::basegfx::B2DRectangle&       o_rScrollRect,
         {
             MetaCommentAction * pAct =
                 static_cast<MetaCommentAction *>(pCurrAct);
-            // skip comment if not a special XTEXT comment
-            if (pAct->GetComment().equalsIgnoreAsciiCaseL(
-                    RTL_CONSTASCII_STRINGPARAM("XTEXT") ))
+            // skip comment if not a special XTEXT... comment
+            if( pAct->GetComment().matchIgnoreAsciiCase(
+                    rtl::OString(RTL_CONSTASCII_STRINGPARAM("XTEXT")),
+                    0) )
             {
                 if (pAct->GetComment().equalsIgnoreAsciiCaseL(
                         RTL_CONSTASCII_STRINGPARAM("XTEXT_SCROLLRECT") ))
diff --git a/slideshow/source/engine/shapes/gdimtftools.hxx b/slideshow/source/engine/shapes/gdimtftools.hxx
index 28a1055..2bcec05 100644
--- a/slideshow/source/engine/shapes/gdimtftools.hxx
+++ b/slideshow/source/engine/shapes/gdimtftools.hxx
@@ -55,9 +55,6 @@ namespace slideshow
         enum mtf_load_flags {
             /// no flags
             MTF_LOAD_NONE = 0,
-            /// annotate text actions with verbose comments,
-            /// denoting logical and physical text entities.
-            MTF_LOAD_VERBOSE_COMMENTS = 1,
             /// the source of the metafile might be a foreign
             /// application. The metafile is checked against unsupported
             /// content, and, if necessary, returned as a pre-rendererd
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index f4475fc..5f22203 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -120,7 +120,6 @@ namespace svx
         sal_Int32 mnWidth;
         sal_Int32 mnHeight;
         sal_Bool mbExportOnlyBackground;
-        sal_Bool mbVerboseComments;
         sal_Bool mbScrollText;
         sal_Bool mbUseHighContrast;
         sal_Bool mbTranslucent;
@@ -137,7 +136,6 @@ namespace svx
     : mnWidth( 0 )
     , mnHeight( 0 )
     , mbExportOnlyBackground( false )
-    , mbVerboseComments( false )
     , mbScrollText( false )
     , mbUseHighContrast( false )
     , mbTranslucent( sal_False )
@@ -538,11 +536,6 @@ void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescripto
                 {
                     pDataValues->Value >>= mnPageNumber;
                 }
-                else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VerboseComments" ) ) )
-                {
-                    // #110496# Read flag for verbose metafile comments
-                    pDataValues->Value >>= rSettings.mbVerboseComments;
-                }
                 else if( pDataValues->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ScrollText" ) ) )
                 {
                     // #110496# Read flag solitary scroll text metafile
commit b0346972539cc2c20b6837f216b0329910e3a825
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Wed Dec 21 02:18:38 2011 +0100

    Revert "aw084: #i108052# Added code to mimic old behaviour and call user layout link when empty paragraph is rendered"
    
    This reverts commit 9d40293f147212120ce2a2e960c1ef23168a428b.
    
    The change was causing extra paragraph markers to be emitted, e.g.
    leading to fdo#43837 and fdo#43684.

diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 6f8cd93..7c0ae49 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2911,27 +2911,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
                     // Over the Portions of the line ...
                     // --------------------------------------------------
                     sal_uInt16 nIndex = pLine->GetStart();
-
-                    // #i108052# When stripping a callback for empty paragraphs is needed. This
-                    // was somehow lost/removed/killed by making the TextPortions with empty
-                    // paragraph to type PORTIONKIND_TAB instead of PORTIONKIND_TEXT. Adding here
-                    // since I could not find out who and why this has changed.
-                    if(bStripOnly && pLine->GetStartPortion() == pLine->GetEndPortion())
-                    {
-                         const Color aOverlineColor(pOutDev->GetOverlineColor());
-                         const Color aTextLineColor(pOutDev->GetTextLineColor());
-
-                        GetEditEnginePtr()->DrawingText(
-                             aTmpPos, String(), 0, 0, 0,
-                             aTmpFont, n, nIndex, 0,
-                             0,
-                             0,
-                             false, true, false, // support for EOL/EOP TEXT comments
-                             0,
-                             aOverlineColor,
-                             aTextLineColor);
-                    }
-
                     for ( sal_uInt16 y = pLine->GetStartPortion(); y <= pLine->GetEndPortion(); y++ )
                     {
                         DBG_ASSERT( pPortion->GetTextPortions().Count(), "Line without Textportion in Paint!" );
commit 373bb825f6ea51266d14f48d228cfeb1e86904d0
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Wed Dec 21 00:03:38 2011 +0100

    Fix for fdo#43837 - prevent invalid shape text indices.
    
    Catch a few cases where an invalid text node index is passed into
    the shape subsetter.

diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx
index c3c8dc6..06ec310 100644
--- a/slideshow/source/engine/animationnodes/animationbasenode.cxx
+++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx
@@ -141,42 +141,47 @@ AnimationBaseNode::AnimationBaseNode(
 
             // okay, found a ParagraphTarget with a valid XShape. Does the shape
             // provide the given paragraph?
-            const DocTreeNode& rTreeNode(
-                mpShape->getTreeNodeSupplier().getTreeNode(
-                    aTarget.Paragraph,
-                    DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) );
-
-            // CAUTION: the creation of the subset shape
-            // _must_ stay in the node constructor, since
-            // Slide::prefetchShow() initializes shape
-            // attributes right after animation import (or
-            // the Slide class must be changed).
-            mpShapeSubset.reset(
-                new ShapeSubset( mpShape,
-                                 rTreeNode,
-                                 mpSubsetManager ));
-
-            // Override NodeContext, and flag this node as
-            // a special independent subset one. This is
-            // important when applying initial attributes:
-            // independent shape subsets must be setup
-            // when the slide starts, since they, as their
-            // name suggest, can have state independent to
-            // the master shape. The following example
-            // might illustrate that: a master shape has
-            // no effect, one of the text paragraphs
-            // within it has an appear effect. Now, the
-            // respective paragraph must be invisible when
-            // the slide is initially shown, and become
-            // visible only when the effect starts.
-            mbIsIndependentSubset = true;
-
-            // already enable subset right here, the
-            // setup of initial shape attributes of
-            // course needs the subset shape
-            // generated, to apply e.g. visibility
-            // changes.
-            mpShapeSubset->enableSubsetShape();
+            if( aTarget.Paragraph >= 0 &&
+                mpShape->getTreeNodeSupplier().getNumberOfTreeNodes(
+                    DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH) > aTarget.Paragraph )
+            {
+                const DocTreeNode& rTreeNode(
+                    mpShape->getTreeNodeSupplier().getTreeNode(
+                        aTarget.Paragraph,
+                        DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) );
+
+                // CAUTION: the creation of the subset shape
+                // _must_ stay in the node constructor, since
+                // Slide::prefetchShow() initializes shape
+                // attributes right after animation import (or
+                // the Slide class must be changed).
+                mpShapeSubset.reset(
+                    new ShapeSubset( mpShape,
+                                     rTreeNode,
+                                     mpSubsetManager ));
+
+                // Override NodeContext, and flag this node as
+                // a special independent subset one. This is
+                // important when applying initial attributes:
+                // independent shape subsets must be setup
+                // when the slide starts, since they, as their
+                // name suggest, can have state independent to
+                // the master shape. The following example
+                // might illustrate that: a master shape has
+                // no effect, one of the text paragraphs
+                // within it has an appear effect. Now, the
+                // respective paragraph must be invisible when
+                // the slide is initially shown, and become
+                // visible only when the effect starts.
+                mbIsIndependentSubset = true;
+
+                // already enable subset right here, the
+                // setup of initial shape attributes of
+                // course needs the subset shape
+                // generated, to apply e.g. visibility
+                // changes.
+                mpShapeSubset->enableSubsetShape();
+            }
         }
     }
 }
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index d7cce3b..c8a307d 100644
--- a/slideshow/source/engine/slide/slideimpl.cxx
+++ b/slideshow/source/engine/slide/slideimpl.cxx
@@ -1062,6 +1062,14 @@ bool SlideImpl::applyInitialShapeAttributes(
                 // this up first.
                 const DocTreeNodeSupplier& rNodeSupplier( pAttrShape->getTreeNodeSupplier() );
 
+                if( rNodeSupplier.getNumberOfTreeNodes(
+                        DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) <= nParaIndex )
+                {
+                    OSL_FAIL( "SlideImpl::applyInitialShapeAttributes(): shape found does not "
+                                "provide a subset for requested paragraph index" );
+                    continue;
+                }
+
                 pAttrShape = pAttrShape->getSubset(
                     rNodeSupplier.getTreeNode(
                         nParaIndex,


More information about the Libreoffice-commits mailing list