[Libreoffice-commits] core.git: 5 commits - filter/source include/filter sd/source

Jan Holesovsky kendy at suse.cz
Sun May 12 09:07:29 PDT 2013


 filter/source/msfilter/svdfppt.cxx  |   11 +++++-
 include/filter/msfilter/svdfppt.hxx |    3 -
 sd/source/filter/ppt/pptin.cxx      |   57 ++++++------------------------------
 3 files changed, 20 insertions(+), 51 deletions(-)

New commits:
commit 55c63ccfd460895af22e91979967cec15d80b72d
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sun May 12 17:33:22 2013 +0200

    bnc#758621: Set the attribs for the entire para if a placeholder.
    
    Setting attributes for empty paragraphs does nothing, we have to apply it to
    the style directly.
    
    Change-Id: Id2a63c961e408906fa7c6457091405692262c6b7

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index be54854..59219d9 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2288,6 +2288,14 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj*
                     }
                     pPortion->ApplyTo( aPortionAttribs, (SdrPowerPointImport&)*this, nDestinationInstance, pTextObj );
                     rOutliner.QuickSetAttribs( aPortionAttribs, aSelection );
+
+                    // set the attribs for the entire paragraph, if it is a placeholder
+                    if ( pTextObj->GetOEPlaceHolderAtom() && aSelection.nStartPos == aSelection.nEndPos )
+                    {
+                        SfxItemSet& rItemSet = rOutliner.GetStyleSheet( nParaIndex )->GetItemSet();
+                        pPortion->ApplyTo( rItemSet, (SdrPowerPointImport&)*this, nDestinationInstance, pTextObj );
+                    }
+
                     aSelection.nStartPos = aSelection.nEndPos;
                 }
                 boost::optional< sal_Int16 > oStartNumbering;
commit cd086e9457c6a6eb70459b21375fedbb2113edf8
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri May 10 20:27:40 2013 +0200

    bnc#758621: Set presentation object as non-empty only if not a placeholder.
    
    Based on work of Felix Zhang <fezhang at suse.com>, thank you!
    
    Change-Id: I26c7cef17b9a5f3d73107b5c974983e58c347d52

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 4729a21..76b5d67 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2332,8 +2332,6 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                     sal_Bool    bVertical = sal_False;
                     if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
                     {
-                        if ( pTextObj->Count() )
-                            bEmptyPresObj = sal_False;
                         switch ( nPlaceholderId )
                         {
                             case PPT_PLACEHOLDER_NOTESBODY :            ePresObjKind = PRESOBJ_NOTES;   break;
@@ -2348,7 +2346,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
 
                             default :
                             {
-                                if ( !pTextObj->Count() )
+                                if ( pTextObj->Count() == 0 )
                                 {
                                     switch ( nPlaceholderId )
                                     {
@@ -2360,6 +2358,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                                         case PPT_PLACEHOLDER_ORGANISZATIONCHART : ePresObjKind = PRESOBJ_ORGCHART; break;
                                     }
                                 }
+                                else
+                                    bEmptyPresObj = sal_False;
                             };
                         }
                     }
commit acb2943c8125f4ceed74f35f31776929dedeb8d8
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri May 10 19:56:04 2013 +0200

    bnc#758621: We don't need this index for anything.
    
    Worse, it prevents us to enter part of the code that we need to execute in
    some (valid) circumstances.
    
    Change-Id: I15084b5efa10fbd5cd0d42856c2745c93d6765da

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index c496292..4729a21 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2324,17 +2324,9 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
             {
                 sal_uInt32 nPlacementId = pPlaceHolder->nPlacementId;
                 sal_Int16 nPlaceholderId = pPlaceHolder->nPlaceholderId;
-                sal_uInt16 i = 0;
+
                 if ( eAktPageKind == PPT_SLIDEPAGE )
                 {
-                    for ( ; i < 8; i++ )
-                    {
-                        if ( pSlideLayout->aPlaceholderId[ i ] == nPlaceholderId )
-                            break;
-                    }
-                }
-                if ( i < 8 )
-                {
                     PresObjKind ePresObjKind = PRESOBJ_NONE;
                     sal_Bool    bEmptyPresObj = sal_True;
                     sal_Bool    bVertical = sal_False;
commit 4bba85981771d3626569633796e120e372172750
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Fri May 10 19:48:06 2013 +0200

    bnc#758621: Kill unused aPlacementId, it is never set.
    
    Based on work of Felix Zhang <fezhang at suse.com>, thank you!
    
    Change-Id: I733a2b69d01f86bcaf0fa401671d475d9b4641a6

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 4d942b4..be54854 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -286,10 +286,7 @@ void PptSlideLayoutAtom::Clear()
 {
     eLayout = 0;
     for ( sal_uInt16 i = 0; i < 8; i++ )
-    {
         aPlaceholderId[ i ] = 0;
-        aPlacementId[ i ] = 0;
-    }
 }
 
 SvStream& operator>>( SvStream& rIn, PptSlideLayoutAtom& rAtom )
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 2fbf096..6fc22af 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -195,7 +195,6 @@ struct PptSlideLayoutAtom
 {
     sal_Int32           eLayout;                // 0..18
     sal_uInt8           aPlaceholderId[ 8 ];
-    sal_uLong           aPlacementId[ 8 ];
 
 public:
                         PptSlideLayoutAtom() { Clear(); }
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 30e90f2..c496292 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2322,6 +2322,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
             const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
             if ( pSlideLayout || ( eAktPageKind == PPT_NOTEPAGE ) )
             {
+                sal_uInt32 nPlacementId = pPlaceHolder->nPlacementId;
                 sal_Int16 nPlaceholderId = pPlaceHolder->nPlaceholderId;
                 sal_uInt16 i = 0;
                 if ( eAktPageKind == PPT_SLIDEPAGE )
@@ -2401,7 +2402,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                             ApplyAttributes( rStCtrl, aSet );
                             pPresObj->SetMergedItemSet(aSet);
 
-                            if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( pSlideLayout->aPlacementId[ i ] != (sal_uLong)-1 ) )
+                            if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( nPlacementId != 0xffffffff ) )
                             {
                                 SdrObject* pTitleObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_TITLE );
                                 SdrObject* pOutlineObj = ((SdPage&)pPage->TRG_GetMasterPage()).GetPresObj( PRESOBJ_OUTLINE );
@@ -2420,7 +2421,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                                 Rectangle aLogicRect( pPresObj->GetLogicRect() );
                                 Size      aLogicSize( aLogicRect.GetSize() );
 
-                                switch ( pSlideLayout->aPlacementId[ i ] )
+                                switch ( nPlacementId )
                                 {
                                     case 0 :            // position in title area
                                     {
commit b5465ea16383975357a774128a3432cb2a4a5d27
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Sun May 12 17:39:21 2013 +0200

    Revert "bnc#758621: show preset texts in slide placeholder"
    
    This reverts commit 95bb951826c7fbaafb055008416f4f1d5cfc95dc.
    
    Mid-air collision :-)  I've been working on an improvement based on this patch
    when Muthu pushed it - the following commits are based on the Felix's work,
    thank you Felix!
    
    Change-Id: I12d649219911815e6b97d62f4584fa4d258d8917

diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index f21323c..2fbf096 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -1200,7 +1200,7 @@ struct ImplPPTTextObj
     explicit ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry ) : mrPersistEntry ( rPersistEntry ) {};
 };
 
-class MSFILTER_DLLPUBLIC PPTTextObj
+class PPTTextObj
 {
     ImplPPTTextObj*         mpImplTextObj;
     void                    ImplClear();
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 6b43d07..30e90f2 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2322,7 +2322,6 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
             const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
             if ( pSlideLayout || ( eAktPageKind == PPT_NOTEPAGE ) )
             {
-                sal_uInt32 nPlacementId = pPlaceHolder->nPlacementId;
                 sal_Int16 nPlaceholderId = pPlaceHolder->nPlaceholderId;
                 sal_uInt16 i = 0;
                 if ( eAktPageKind == PPT_SLIDEPAGE )
@@ -2333,7 +2332,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                             break;
                     }
                 }
-                if ( i < 8 || nPlacementId == 0xffffffff )
+                if ( i < 8 )
                 {
                     PresObjKind ePresObjKind = PRESOBJ_NONE;
                     sal_Bool    bEmptyPresObj = sal_True;
@@ -2341,40 +2340,18 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                     if ( ( pTextObj->GetShapeType() == mso_sptRectangle ) || ( pTextObj->GetShapeType() == mso_sptTextBox ) )
                     {
                         if ( pTextObj->Count() )
-                            if ( pTextObj->Count() > 1 || pTextObj->First()->GetTextSize() )
-                                bEmptyPresObj = sal_False;
+                            bEmptyPresObj = sal_False;
                         switch ( nPlaceholderId )
                         {
                             case PPT_PLACEHOLDER_NOTESBODY :            ePresObjKind = PRESOBJ_NOTES;   break;
                             case PPT_PLACEHOLDER_VERTICALTEXTTITLE :
                                 bVertical = sal_True;   // PASSTHROUGH !!!
-                            case PPT_PLACEHOLDER_TITLE :
-                            case PPT_PLACEHOLDER_CENTEREDTITLE :
-                                {
-                                    ePresObjKind = PRESOBJ_TITLE;
-                                    aPresentationText = pPage->GetPresObjText( ePresObjKind );
-                                    break;
-                                }
+                            case PPT_PLACEHOLDER_TITLE :                ePresObjKind = PRESOBJ_TITLE;   break;
                             case PPT_PLACEHOLDER_VERTICALTEXTBODY :
                                 bVertical = sal_True;   // PASSTHROUGH !!!
-                            case PPT_PLACEHOLDER_BODY :
-                                {
-                                    ePresObjKind = PRESOBJ_OUTLINE;
-                                    aPresentationText = pPage->GetPresObjText( ePresObjKind );
-                                    break;
-                                }
-                            case PPT_PLACEHOLDER_SUBTITLE :
-                                {
-                                    ePresObjKind = PRESOBJ_TEXT;
-                                    aPresentationText = pPage->GetPresObjText( ePresObjKind );
-                                    break;
-                                }
-                            case PPT_PLACEHOLDER_OBJECT :
-                                {
-                                    ePresObjKind = PRESOBJ_OBJECT;
-                                    aPresentationText = pPage->GetPresObjText( ePresObjKind );
-                                    break;
-                                }
+                            case PPT_PLACEHOLDER_BODY :                 ePresObjKind = PRESOBJ_OUTLINE; break;
+                            case PPT_PLACEHOLDER_CENTEREDTITLE :        ePresObjKind = PRESOBJ_TITLE;   break;
+                            case PPT_PLACEHOLDER_SUBTITLE :             ePresObjKind = PRESOBJ_TEXT;    break;      // PRESOBJ_OUTLINE
 
                             default :
                             {
@@ -2383,6 +2360,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                                     switch ( nPlaceholderId )
                                     {
                                         case PPT_PLACEHOLDER_MEDIACLIP :
+                                        case PPT_PLACEHOLDER_OBJECT : ePresObjKind = PRESOBJ_OBJECT; break;
                                         case PPT_PLACEHOLDER_GRAPH : ePresObjKind = PRESOBJ_CHART; break;
                                         case PPT_PLACEHOLDER_TABLE : ePresObjKind = PRESOBJ_TABLE; break;
                                         case PPT_PLACEHOLDER_CLIPART : ePresObjKind = PRESOBJ_GRAPHIC; break;
@@ -2413,12 +2391,6 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                         if ( !bEmptyPresObj )
                         {
                             pPage->InsertPresObj( pRet, ePresObjKind );
-                            if ( !pText->HasText() )
-                            {
-                                SdrOutliner* pOutl = ((SdDrawDocument*)(pPage->GetModel()))->GetInternalOutliner();
-                                if ( aPresentationText.Len() )
-                                    pPage->SetObjText( (SdrTextObj*)pText, pOutl, ePresKind, aPresentationText );
-                            }
                         }
                         else
                         {


More information about the Libreoffice-commits mailing list