[Libreoffice-commits] .: 3 commits - filter/inc filter/source solenv/gbuild sw/source

Michael Stahl mst at kemper.freedesktop.org
Fri Jul 27 15:50:04 PDT 2012


 filter/inc/filter/msfilter/msdffimp.hxx |   78 ++++++++++++------------
 filter/source/msfilter/msdffimp.cxx     |  103 ++++++++++++++++++--------------
 solenv/gbuild/WinResTarget.mk           |    2 
 sw/source/filter/ww8/ww8par.cxx         |    9 +-
 4 files changed, 108 insertions(+), 84 deletions(-)

New commits:
commit bcee196287027b4fde406eec73e10f93dcd8ddd8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jul 28 00:47:22 2012 +0200

    SvxMSDffManager::CheckTxBxStoryChain: translate comments
    
    Change-Id: I24643236d0beda0e91576119ed42d296d7dfdd71

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 01ccaca..cd44fd9 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -5903,8 +5903,7 @@ void SvxMSDffManager::GetFidclData( sal_uInt32 nOffsDggL )
 void SvxMSDffManager::CheckTxBxStoryChain()
 {
     m_pShapeInfosById.reset(new SvxMSDffShapeInfos_ById);
-    // altes Info-Array ueberarbeiten
-    // (ist sortiert nach nTxBxComp)
+    // mangle old Info array, sorted by nTxBxComp
     sal_uLong nChain    = ULONG_MAX;
     sal_Bool bSetReplaceFALSE = sal_False;
     for (SvxMSDffShapeInfos_ByTxBxComp::iterator iter =
@@ -5916,21 +5915,21 @@ void SvxMSDffManager::CheckTxBxStoryChain()
         if( pObj->nTxBxComp )
         {
             pObj->bLastBoxInChain = sal_False;
-            // Gruppenwechsel ?
+            // group change?
             // #156763#
             // the text id also contains an internal drawing container id
             // to distinguish between text id of drawing objects in different
             // drawing containers.
             if( nChain != pObj->nTxBxComp )
             {
-                // voriger war letzter seiner Gruppe
+                // previous was last of its group
                 if (iter != m_pShapeInfosByTxBxComp->begin())
                 {
                     SvxMSDffShapeInfos_ByTxBxComp::iterator prev(iter);
                     --prev;
                     (*prev)->bLastBoxInChain = true;
                 }
-                // Merker und Hilfs-Flag zuruecksetzen
+                // reset mark and helper flag
                 mark = iter;
                 nChain = pObj->nTxBxComp;
                 bSetReplaceFALSE = !pObj->bReplaceByFly;
@@ -5938,10 +5937,9 @@ void SvxMSDffManager::CheckTxBxStoryChain()
             else
             if( !pObj->bReplaceByFly )
             {
-                // Objekt, das NICHT durch Rahmen ersetzt werden darf ?
-                // Hilfs-Flag setzen
+                // object that must NOT be replaced by frame?
                 bSetReplaceFALSE = sal_True;
-                // ggfs Flag in Anfang der Gruppe austragen
+                // maybe reset flags in start of group
                 for (SvxMSDffShapeInfos_ByTxBxComp::iterator itemp = mark;
                         itemp != iter; ++itemp)
                 {
@@ -5954,17 +5952,16 @@ void SvxMSDffManager::CheckTxBxStoryChain()
                 pObj->bReplaceByFly = sal_False;
             }
         }
-        // alle Shape-Info-Objekte in pShapeInfos umkopieren
-        // (aber nach nShapeId sortieren)
+        // copy all Shape Info objects to m_pShapeInfosById, sorted by nShapeId
         pObj->nTxBxComp = pObj->nTxBxComp & 0xFFFF0000;
         m_pShapeInfosById->insert( pObj );
     }
-    // voriger war letzter seiner Gruppe
+    // last one was last of its group
     if (!m_pShapeInfosByTxBxComp->empty())
     {
         (*m_pShapeInfosByTxBxComp->rbegin())->bLastBoxInChain = true;
     }
-    // urspruengliches Array freigeben, ohne Objekte zu zerstoeren
+    // free original array but don't free its elements
     m_pShapeInfosByTxBxComp.reset();
 }
 
commit ce66ded6fe2a291301c8e075be67347211d4309d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jul 28 00:35:14 2012 +0200

    fix STL conversion 3ae618f9e4c34d5f6f10d953e3fb074018001748:
    
    It turns out that this SvxMSDffShapeInfos has some, shall we say,
    non-obvious properties, including a split personality that changes
    its nature from checking for pointer equality to not doing so;
    symptoms of this include a failing sw_subsequent_ww8export test.
    Try to cure this madness by splitting the personalities into distinct
    types, a set and a multiset.
    
    Change-Id: Ib87368564b8e1f61379703034c0965422c6dcd0e

diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index 6b20aaa..f69f076 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -26,26 +26,36 @@
  *
  ************************************************************************/
 
-#ifndef _MSDFFIMP_HXX
-#define _MSDFFIMP_HXX
+#ifndef FLT_MSDFFIMP_HXX
+#define FLT_MSDFFIMP_HXX
+
+#include <string.h>
+
+#include <map>
+#include <vector>
+#include <set>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_set.hpp>
 
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
 #include <tools/solar.h>
 #include <tools/color.hxx>
 #include <tools/gen.hxx>
-#include <svx/msdffdef.hxx>
+
+#include <sot/storage.hxx>
+
 #include <vcl/graph.hxx>
-#include <string.h>
-#include <map>
-#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <svx/msdffdef.hxx>
+
 #include <filter/msfilter/msfilterdllapi.h>
-#include <sot/storage.hxx>
-#include <vector>
-#include <set>
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/ptr_container/ptr_set.hpp>
-#include <o3tl/sorted_vector.hxx>
+
 
 class Graphic;
 class SvStream;
@@ -189,18 +199,23 @@ public:
     ~SvxMSDffShapeOrders();
 };
 
-// the following will be sorted explicitly:
-class SvxMSDffShapeInfos
-    : public o3tl::sorted_vector<SvxMSDffShapeInfo*,
-                o3tl::less_ptr_to<SvxMSDffShapeInfo> >
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
 {
-public:
-    ~SvxMSDffShapeInfos()
-    {
-        DeleteAndDestroyAll();
-    }
+    bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+                    ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoByTxBxComp
+{
+    bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+                    ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
 };
 
+// the following will be sorted explicitly:
+typedef ::std::set< ::boost::shared_ptr<SvxMSDffShapeInfo>,
+            CompareSvxMSDffShapeInfoById > SvxMSDffShapeInfos_ById;
+typedef ::std::multiset< ::boost::shared_ptr<SvxMSDffShapeInfo>,
+            CompareSvxMSDffShapeInfoByTxBxComp> SvxMSDffShapeInfos_ByTxBxComp;
+
 #define SVXMSDFF_SETTINGS_CROP_BITMAPS      1
 #define SVXMSDFF_SETTINGS_IMPORT_PPT        2
 #define SVXMSDFF_SETTINGS_IMPORT_EXCEL      4
@@ -463,7 +478,8 @@ class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
 {
     FmFormModel*            pFormModel;
     SvxMSDffBLIPInfos*      pBLIPInfos;
-    SvxMSDffShapeInfos*     pShapeInfos;
+    ::boost::scoped_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_pShapeInfosByTxBxComp;
+    ::boost::scoped_ptr<SvxMSDffShapeInfos_ById> m_pShapeInfosById;
     SvxMSDffShapeOrders*    pShapeOrders;
     sal_uLong               nDefaultFontHeight;
     sal_uInt32              nOffsDgg;
@@ -751,8 +767,8 @@ public:
                           const Rectangle& rClientRect,
                           const Rectangle& rGlobalChildRect );
 
-    inline const SvxMSDffShapeInfos* GetShapeInfos( void ) const
-        { return pShapeInfos; }
+    inline const SvxMSDffShapeInfos_ById* GetShapeInfos( void ) const
+        { return m_pShapeInfosById.get(); }
 
     inline const SvxMSDffShapeOrders* GetShapeOrders( void ) const
         { return pShapeOrders; }
@@ -820,7 +836,6 @@ struct SvxMSDffShapeInfo
     sal_uInt32 nTxBxComp;
 
     sal_Bool bReplaceByFly  :1; ///< shape can be replaced by a frame in Writer
-    sal_Bool bSortByShapeId :1;
     sal_Bool bLastBoxInChain:1;
 
     explicit SvxMSDffShapeInfo(sal_uLong nFPos, sal_uInt32 nId=0, // sal_uLong nBIdx=0,
@@ -830,7 +845,6 @@ struct SvxMSDffShapeInfo
         nTxBxComp( (nSeqId << 16) + nBoxId )
         {
             bReplaceByFly   = sal_False;
-            bSortByShapeId  = sal_False;
             bLastBoxInChain = sal_True;
         }
     SvxMSDffShapeInfo(SvxMSDffShapeInfo& rInfo):
@@ -839,21 +853,11 @@ struct SvxMSDffShapeInfo
         nTxBxComp( rInfo.nTxBxComp )
         {
             bReplaceByFly   = rInfo.bReplaceByFly;
-            bSortByShapeId  = rInfo.bSortByShapeId;
             bLastBoxInChain = rInfo.bLastBoxInChain;
         }
-    sal_Bool operator==( const SvxMSDffShapeInfo& rEntry ) const
-    {
-        return bSortByShapeId ? (nShapeId  == rEntry.nShapeId)
-                              : (nTxBxComp == rEntry.nTxBxComp && this == &rEntry);
-    }
-    sal_Bool operator<( const SvxMSDffShapeInfo& rEntry ) const
-    {
-        return bSortByShapeId ? (nShapeId  < rEntry.nShapeId)
-                              : (nTxBxComp < rEntry.nTxBxComp);
-    }
 };
 
+
 struct SvxMSDffShapeOrder
 {
     sal_uLong nShapeId;  ///< shape id used in PLCF SPA and in mso_fbtSp (FSP)
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 9e10b63..01ccaca 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3225,6 +3225,20 @@ DffRecordHeader* DffRecordManager::GetRecordHeader( sal_uInt16 nRecId, DffSeekTo
 //  private Methoden
 //---------------------------------------------------------------------------
 
+bool CompareSvxMSDffShapeInfoById::operator() (
+    ::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+    ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const
+{
+    return lhs->nShapeId < rhs->nShapeId;
+}
+
+bool CompareSvxMSDffShapeInfoByTxBxComp::operator() (
+    ::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+    ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const
+{
+    return lhs->nTxBxComp < rhs->nTxBxComp;
+}
+
 void SvxMSDffManager::Scale( sal_Int32& rVal ) const
 {
     if ( bNeedMap )
@@ -5359,11 +5373,12 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
             // das Objekt durch einen Rahmen ersetzen, ansonsten
             if( bTextFrame )
             {
-                SvxMSDffShapeInfo aTmpRec( 0, pImpRec->nShapeId );
-                aTmpRec.bSortByShapeId = sal_True;
+                ::boost::shared_ptr<SvxMSDffShapeInfo> const pTmpRec(
+                    new SvxMSDffShapeInfo(0, pImpRec->nShapeId));
 
-                SvxMSDffShapeInfos::const_iterator it = pShapeInfos->find( &aTmpRec );
-                if( it != pShapeInfos->end() )
+                SvxMSDffShapeInfos_ById::const_iterator const it =
+                    m_pShapeInfosById->find(pTmpRec);
+                if (it != m_pShapeInfosById->end())
                 {
                     SvxMSDffShapeInfo& rInfo = **it;
                     pTextImpRec->bReplaceByFly   = rInfo.bReplaceByFly;
@@ -5730,7 +5745,7 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
     :DffPropertyReader( *this ),
      pFormModel( NULL ),
      pBLIPInfos( new SvxMSDffBLIPInfos  ),
-     pShapeInfos(  new SvxMSDffShapeInfos ),
+     m_pShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
      pShapeOrders( new SvxMSDffShapeOrders ),
      nDefaultFontHeight( nDefaultFontHeight_),
      nOffsDgg( nOffsDgg_ ),
@@ -5776,7 +5791,7 @@ SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const String& rBaseURL )
     :DffPropertyReader( *this ),
      pFormModel( NULL ),
      pBLIPInfos(   new SvxMSDffBLIPInfos  ),
-     pShapeInfos(  new SvxMSDffShapeInfos ),
+     m_pShapeInfosByTxBxComp( new SvxMSDffShapeInfos_ByTxBxComp ),
      pShapeOrders( new SvxMSDffShapeOrders ),
      nDefaultFontHeight( 24 ),
      nOffsDgg( 0 ),
@@ -5797,7 +5812,6 @@ SvxMSDffManager::SvxMSDffManager( SvStream& rStCtrl_, const String& rBaseURL )
 SvxMSDffManager::~SvxMSDffManager()
 {
     delete pBLIPInfos;
-    delete pShapeInfos;
     delete pShapeOrders;
     delete pFormModel;
 }
@@ -5888,18 +5902,17 @@ void SvxMSDffManager::GetFidclData( sal_uInt32 nOffsDggL )
 
 void SvxMSDffManager::CheckTxBxStoryChain()
 {
-    SvxMSDffShapeInfos* pOld = pShapeInfos;
-    sal_uInt16 nCnt             = pOld->size();
-    pShapeInfos             = new SvxMSDffShapeInfos;
+    m_pShapeInfosById.reset(new SvxMSDffShapeInfos_ById);
     // altes Info-Array ueberarbeiten
     // (ist sortiert nach nTxBxComp)
     sal_uLong nChain    = ULONG_MAX;
-    sal_uInt16 nObjMark = 0;
     sal_Bool bSetReplaceFALSE = sal_False;
-    sal_uInt16 nObj;
-    for( nObj = 0; nObj < nCnt; ++nObj )
+    for (SvxMSDffShapeInfos_ByTxBxComp::iterator iter =
+                m_pShapeInfosByTxBxComp->begin(),
+            mark = m_pShapeInfosByTxBxComp->begin();
+         iter != m_pShapeInfosByTxBxComp->end(); ++iter)
     {
-        SvxMSDffShapeInfo* pObj = (*pOld)[nObj];
+        boost::shared_ptr<SvxMSDffShapeInfo> const pObj = *iter;
         if( pObj->nTxBxComp )
         {
             pObj->bLastBoxInChain = sal_False;
@@ -5911,10 +5924,14 @@ void SvxMSDffManager::CheckTxBxStoryChain()
             if( nChain != pObj->nTxBxComp )
             {
                 // voriger war letzter seiner Gruppe
-                if( nObj )
-                    (*pOld)[ nObj-1 ]->bLastBoxInChain = sal_True;
+                if (iter != m_pShapeInfosByTxBxComp->begin())
+                {
+                    SvxMSDffShapeInfos_ByTxBxComp::iterator prev(iter);
+                    --prev;
+                    (*prev)->bLastBoxInChain = true;
+                }
                 // Merker und Hilfs-Flag zuruecksetzen
-                nObjMark = nObj;
+                mark = iter;
                 nChain = pObj->nTxBxComp;
                 bSetReplaceFALSE = !pObj->bReplaceByFly;
             }
@@ -5925,8 +5942,11 @@ void SvxMSDffManager::CheckTxBxStoryChain()
                 // Hilfs-Flag setzen
                 bSetReplaceFALSE = sal_True;
                 // ggfs Flag in Anfang der Gruppe austragen
-                for( sal_uInt16 nObj2 = nObjMark; nObj2 < nObj; ++nObj2 )
-                    (*pOld)[ nObj2 ]->bReplaceByFly = sal_False;
+                for (SvxMSDffShapeInfos_ByTxBxComp::iterator itemp = mark;
+                        itemp != iter; ++itemp)
+                {
+                    (*itemp)->bReplaceByFly = false;
+                }
             }
 
             if( bSetReplaceFALSE )
@@ -5936,16 +5956,16 @@ void SvxMSDffManager::CheckTxBxStoryChain()
         }
         // alle Shape-Info-Objekte in pShapeInfos umkopieren
         // (aber nach nShapeId sortieren)
-        pObj->bSortByShapeId = sal_True;
         pObj->nTxBxComp = pObj->nTxBxComp & 0xFFFF0000;
-        pShapeInfos->insert( pObj );
+        m_pShapeInfosById->insert( pObj );
     }
     // voriger war letzter seiner Gruppe
-    if( nObj )
-        (*pOld)[ nObj-1 ]->bLastBoxInChain = sal_True;
+    if (!m_pShapeInfosByTxBxComp->empty())
+    {
+        (*m_pShapeInfosByTxBxComp->rbegin())->bLastBoxInChain = true;
+    }
     // urspruengliches Array freigeben, ohne Objekte zu zerstoeren
-    pOld->clear();
-    delete pOld;
+    m_pShapeInfosByTxBxComp.reset();
 }
 
 
@@ -6348,7 +6368,8 @@ sal_Bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
         {
             aInfo.bReplaceByFly = sal_True;
         }
-        pShapeInfos->insert(  new SvxMSDffShapeInfo(  aInfo          ) );
+        m_pShapeInfosByTxBxComp->insert(::boost::shared_ptr<SvxMSDffShapeInfo>(
+                    new SvxMSDffShapeInfo(aInfo)));
         pShapeOrders->push_back( new SvxMSDffShapeOrder( aInfo.nShapeId ) );
     }
 
@@ -6367,11 +6388,12 @@ sal_Bool SvxMSDffManager::GetShapeContainerData( SvStream& rSt,
 sal_Bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*&         rpShape,
                                           SvxMSDffImportData& rData)
 {
-    SvxMSDffShapeInfo aTmpRec(0, nId);
-    aTmpRec.bSortByShapeId = sal_True;
+    ::boost::shared_ptr<SvxMSDffShapeInfo> const pTmpRec(
+        new SvxMSDffShapeInfo(0, nId));
 
-    SvxMSDffShapeInfos::const_iterator it = pShapeInfos->find( &aTmpRec );
-    if( it != pShapeInfos->end() )
+    SvxMSDffShapeInfos_ById::const_iterator const it =
+        m_pShapeInfosById->find(pTmpRec);
+    if (it != m_pShapeInfosById->end())
     {
         // eventuell altes Errorflag loeschen
         if( rStCtrl.GetError() )
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 1512cc0..505369c 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -591,11 +591,12 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt,
             // das Objekt durch einen Rahmen ersetzen, ansonsten
             if( bIsSimpleDrawingTextBox )
             {
-                SvxMSDffShapeInfo aTmpRec( 0, pImpRec->nShapeId );
-                aTmpRec.bSortByShapeId = sal_True;
+                ::boost::shared_ptr<SvxMSDffShapeInfo> const pTmpRec(
+                        new SvxMSDffShapeInfo(0, pImpRec->nShapeId));
 
-                SvxMSDffShapeInfos::const_iterator it = GetShapeInfos()->find( &aTmpRec );
-                if( it != GetShapeInfos()->end() )
+                SvxMSDffShapeInfos_ById::const_iterator const it =
+                    GetShapeInfos()->find(pTmpRec);
+                if (it != GetShapeInfos()->end())
                 {
                     SvxMSDffShapeInfo& rInfo = **it;
                     pImpRec->bReplaceByFly   = rInfo.bReplaceByFly;
commit 8a05f1265e6307c34b2ffdb5fc5279870c8397b7
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 27 21:39:39 2012 +0200

    gbuild: WinResTarget: fix dep-target dependencies:
    
    Windows specific fallout of 8b5a984d45005d3df1c89eae897d6e04612625d8,
    similar to 236055746ffe92ce3b2a7a9316b1083da046deb9; can be observed by
    building with "make check" from scratch, on the "subsequentcheck" target
    one res file depends on some lngconvex executable by way of a custom
    target in shell, which causes udkapi to rebuild itself before the make
    restart.
    
    Change-Id: I14f370a66f4ac5088da4af7eceede09f5a6bae84

diff --git a/solenv/gbuild/WinResTarget.mk b/solenv/gbuild/WinResTarget.mk
index c8d5393..1731db6 100644
--- a/solenv/gbuild/WinResTarget.mk
+++ b/solenv/gbuild/WinResTarget.mk
@@ -27,7 +27,7 @@ endif
 endef
 
 ifeq ($(gb_FULLDEPS),$(true))
-$(call gb_WinResTarget_get_dep_target,%) : $(call gb_WinResTarget_get_target,%)
+$(call gb_WinResTarget_get_dep_target,%) :
 	$(call gb_WinResTarget__command_dep,$@,$*,$<)
 endif
 


More information about the Libreoffice-commits mailing list