[Libreoffice-commits] core.git: 3 commits - include/svx svx/source sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Jun 1 00:14:38 PDT 2015


 include/svx/svddrgv.hxx                                  |    2 -
 svx/source/svdraw/svdedtv.cxx                            |   10 ++---
 svx/source/svdraw/svdmark.cxx                            |    4 +-
 svx/source/svdraw/svdmrkv.cxx                            |   30 +++++++--------
 svx/source/svdraw/svdobj.cxx                             |    4 +-
 svx/source/svdraw/svdpntv.cxx                            |    4 +-
 svx/source/svdraw/svdundo.cxx                            |    8 ++--
 sw/qa/extras/ooxmlexport/data/tdf79639.docx              |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                 |    8 ++++
 sw/source/core/table/swtable.cxx                         |    3 +
 sw/source/core/undo/unins.cxx                            |    3 +
 sw/source/filter/writer/writer.cxx                       |    3 +
 sw/source/filter/ww8/docxtablestyleexport.cxx            |    3 +
 sw/source/filter/ww8/docxtablestyleexport.hxx            |    2 -
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |   11 ++++-
 15 files changed, 57 insertions(+), 38 deletions(-)

New commits:
commit c8923c61bb6e6cf603991c87a9981cb62fa4e660
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 1 09:06:56 2015 +0200

    Use o3tl::make_unique<>
    
    Change-Id: I9be8542d5ea99694af54121d3fe659bb4ed8ebb6

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index bd36f01..9000baa 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -27,6 +27,7 @@
 #include <editeng/colritem.hxx>
 #include <sfx2/linkmgr.hxx>
 #include <editeng/boxitem.hxx>
+#include <o3tl/make_unique.hxx>
 #include <fmtfsize.hxx>
 #include <fmtornt.hxx>
 #include <fmtpdsc.hxx>
@@ -2720,8 +2721,8 @@ bool SwTableCellInfo::Impl::getNext()
 }
 
 SwTableCellInfo::SwTableCellInfo(const SwTable * pTable)
+    : m_pImpl(o3tl::make_unique<Impl>())
 {
-    m_pImpl.reset(new Impl());
     m_pImpl->setTable(pTable);
 }
 
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 58bdcf4..d8e7ac5 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -24,6 +24,7 @@
 #include <sot/storage.hxx>
 #include <editeng/keepitem.hxx>
 #include <svx/svdobj.hxx>
+#include <o3tl/make_unique.hxx>
 
 #include <docsh.hxx>
 #include <fmtcntnt.hxx>
@@ -513,7 +514,7 @@ public:
 SwUndoReplace::SwUndoReplace(SwPaM const& rPam,
         OUString const& rIns, bool const bRegExp)
     : SwUndo( UNDO_REPLACE )
-    , m_pImpl(new Impl(rPam, rIns, bRegExp))
+    , m_pImpl(o3tl::make_unique<Impl>(rPam, rIns, bRegExp))
 {
 }
 
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index be8088a..c84dfab 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -25,6 +25,7 @@
 #include <vcl/graphicfilter.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/eeitem.hxx>
+#include <o3tl/make_unique.hxx>
 #include <shellio.hxx>
 #include <doc.hxx>
 #include <docary.hxx>
@@ -117,7 +118,7 @@ void Writer_Impl::InsertBkmk(const ::sw::mark::IMark& rBkmk)
  */
 
 Writer::Writer()
-    : m_pImpl(new Writer_Impl)
+    : m_pImpl(o3tl::make_unique<Writer_Impl>())
     , pOrigPam(0), pOrigFileName(0), pDoc(0), pCurPam(0)
 {
     bWriteAll = bShowProgress = bUCS2_WithStartChar = true;
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index 6a1a947..60510da 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -13,6 +13,7 @@
 #include <docsh.hxx>
 #include <oox/token/tokens.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <o3tl/make_unique.hxx>
 
 using namespace com::sun::star;
 using namespace oox;
@@ -682,7 +683,7 @@ void DocxTableStyleExport::SetSerializer(sax_fastparser::FSHelperPtr pSerializer
 }
 
 DocxTableStyleExport::DocxTableStyleExport(SwDoc* pDoc, sax_fastparser::FSHelperPtr pSerializer)
-    : m_pImpl(std::make_shared<Impl>())
+    : m_pImpl(o3tl::make_unique<Impl>())
 {
     m_pImpl->m_pDoc = pDoc;
     m_pImpl->m_pSerializer = pSerializer;
diff --git a/sw/source/filter/ww8/docxtablestyleexport.hxx b/sw/source/filter/ww8/docxtablestyleexport.hxx
index 201aea6..8900d92 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.hxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.hxx
@@ -22,7 +22,7 @@ class SwDoc;
 class DocxTableStyleExport
 {
     struct Impl;
-    std::shared_ptr<Impl> m_pImpl;
+    std::unique_ptr<Impl> m_pImpl;
 public:
     void TableStyles(sal_Int32 nCountStylesToWrite);
 
commit da7758dad3c6ca0747bd51cc41ad19fcc958205d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 1 09:04:20 2015 +0200

    svx: nObjAnz -> nObjCount
    
    Change-Id: I1ae00035c5ae9ac620f01982d6e4fff593f7c054

diff --git a/include/svx/svddrgv.hxx b/include/svx/svddrgv.hxx
index 1aae1fb..45a35f4 100644
--- a/include/svx/svddrgv.hxx
+++ b/include/svx/svddrgv.hxx
@@ -173,7 +173,7 @@ public:
     // NoDragPolys is (temporarily) activated implicitely.
     // PolyPolygons etc. are regarded as multiple objects respectively.
     // Default=100
-    void  SetDragXorPolyLimit(sal_uIntPtr nObjAnz) { nDragXorPolyLimit=nObjAnz; }
+    void  SetDragXorPolyLimit(sal_uIntPtr nLimit) { nDragXorPolyLimit=nLimit; }
     sal_uIntPtr GetDragXorPolyLimit() const { return nDragXorPolyLimit; }
 
     // Like DragXorPolyLimit, but in respect to the total number of
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index fd3361c..18830ea 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -153,13 +153,13 @@ bool SdrEditView::ImpDelLayerCheck(SdrObjList* pOL, SdrLayerID nDelID) const
 
 void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID)
 {
-    const size_t nObjAnz(pOL->GetObjCount());
+    const size_t nObjCount(pOL->GetObjCount());
     // make sure OrdNums are correct
     pOL->GetObj(0)->GetOrdNum();
 
     const bool bUndo = GetModel()->IsUndoEnabled();
 
-    for(size_t nObjNum = nObjAnz; nObjNum > 0;)
+    for(size_t nObjNum = nObjCount; nObjNum > 0;)
     {
         nObjNum--;
         SdrObject* pObj = pOL->GetObj(nObjNum);
@@ -223,13 +223,13 @@ void SdrEditView::DeleteLayer(const OUString& rName)
             {
                 // over all pages
                 SdrPage* pPage = (bMaPg) ? pMod->GetMasterPage(nPgNum) : pMod->GetPage(nPgNum);
-                const size_t nObjAnz(pPage->GetObjCount());
+                const size_t nObjCount(pPage->GetObjCount());
 
                 // make sure OrdNums are correct
-                if(nObjAnz)
+                if(nObjCount)
                     pPage->GetObj(0)->GetOrdNum();
 
-                for(size_t nObjNum(nObjAnz); nObjNum > 0;)
+                for(size_t nObjNum(nObjCount); nObjNum > 0;)
                 {
                     nObjNum--;
                     SdrObject* pObj = pPage->GetObj(nObjNum);
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index b1f8464..7ddde61 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -513,9 +513,9 @@ bool SdrMarkList::InsertPageView(const SdrPageView& rPV)
     bool bChgd(false);
     DeletePageView(rPV); // delete all of them, then append the entire page
     const SdrObjList* pOL = rPV.GetObjList();
-    const size_t nObjAnz(pOL->GetObjCount());
+    const size_t nObjCount(pOL->GetObjCount());
 
-    for(size_t nO = 0; nO < nObjAnz; ++nO)
+    for(size_t nO = 0; nO < nObjCount; ++nO)
     {
         SdrObject* pObj = pOL->GetObj(nO);
         bool bDoIt(rPV.IsObjMarkable(pObj));
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 808f432..d6c95ed 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -510,8 +510,8 @@ sal_uIntPtr SdrMarkView::GetMarkableObjCount() const
     if(pPV)
     {
         SdrObjList* pOL=pPV->GetObjList();
-        const size_t nObjAnz = pOL->GetObjCount();
-        for (size_t nObjNum=0; nObjNum<nObjAnz; ++nObjNum) {
+        const size_t nObjCount = pOL->GetObjCount();
+        for (size_t nObjNum=0; nObjNum<nObjCount; ++nObjNum) {
             SdrObject* pObj=pOL->GetObj(nObjNum);
             if (IsObjMarkable(pObj,pPV)) {
                 nCount++;
@@ -527,8 +527,8 @@ bool SdrMarkView::HasMarkableObj() const
     if(pPV)
     {
         SdrObjList* pOL=pPV->GetObjList();
-        const size_t nObjAnz = pOL->GetObjCount();
-        for (size_t nObjNum = 0; nObjNum<nObjAnz; ++nObjNum) {
+        const size_t nObjCount = pOL->GetObjCount();
+        for (size_t nObjNum = 0; nObjNum<nObjCount; ++nObjNum) {
             SdrObject* pObj=pOL->GetObj(nObjNum);
             if (IsObjMarkable(pObj,pPV)) {
                 return true;
@@ -1395,10 +1395,10 @@ bool SdrMarkView::MarkNextObj(bool bPrev)
 
     SdrObject* pMarkObj=NULL;
     SdrObjList* pSearchObjList=pPageView->GetObjList();
-    const size_t nObjAnz = pSearchObjList->GetObjCount();
-    if (nObjAnz!=0) {
-        if (nSearchObjNum>nObjAnz) nSearchObjNum=nObjAnz;
-        while (pMarkObj==NULL && ((!bPrev && nSearchObjNum>0) || (bPrev && nSearchObjNum<nObjAnz)))
+    const size_t nObjCount = pSearchObjList->GetObjCount();
+    if (nObjCount!=0) {
+        if (nSearchObjNum>nObjCount) nSearchObjNum=nObjCount;
+        while (pMarkObj==NULL && ((!bPrev && nSearchObjNum>0) || (bPrev && nSearchObjNum<nObjCount)))
         {
             if (!bPrev)
                 nSearchObjNum--;
@@ -1466,7 +1466,7 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev)
     }
     if (pBtmMarkHit==NULL) { pBtmMarkHit=pTopMarkHit; nBtmMarkHit=nTopMarkHit; }
     SdrObject* pBtmObjHit=pBtmMarkHit->GetMarkedSdrObj();
-    const size_t nObjAnz = pObjList->GetObjCount();
+    const size_t nObjCount = pObjList->GetObjCount();
 
     size_t nSearchBeg = 0;
     E3dScene* pScene = NULL;
@@ -1499,7 +1499,7 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev)
 
     size_t no=nSearchBeg;
     SdrObject* pFndObj=NULL;
-    while (pFndObj==NULL && ((!bPrev && no>0) || (bPrev && no<nObjAnz))) {
+    while (pFndObj==NULL && ((!bPrev && no>0) || (bPrev && no<nObjCount))) {
         if (!bPrev) no--;
         SdrObject* pObj;
 
@@ -1544,8 +1544,8 @@ bool SdrMarkView::MarkObj(const Rectangle& rRect, bool bUnmark)
     {
         pObjList=pPV->GetObjList();
         Rectangle aFrm1(aR);
-        const size_t nObjAnz = pObjList->GetObjCount();
-        for (size_t nO=0; nO<nObjAnz; ++nO) {
+        const size_t nObjCount = pObjList->GetObjCount();
+        for (size_t nO=0; nO<nObjCount; ++nO) {
             SdrObject* pObj=pObjList->GetObj(nO);
             Rectangle aRect(pObj->GetCurrentBoundRect());
             if (aFrm1.IsInside(aRect)) {
@@ -1698,9 +1698,9 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT
         bool bRemap(pOL->GetOwnerObj() && pOL->GetOwnerObj()->ISA(E3dScene));
         E3dScene* pRemapScene = (bRemap ? static_cast<E3dScene*>(pOL->GetOwnerObj()) : 0L);
 
-        const size_t nObjAnz=pOL->GetObjCount();
-        size_t nObjNum=bBack ? 0 : nObjAnz;
-        while (pRet==NULL && (bBack ? nObjNum<nObjAnz : nObjNum>0)) {
+        const size_t nObjCount=pOL->GetObjCount();
+        size_t nObjNum=bBack ? 0 : nObjCount;
+        while (pRet==NULL && (bBack ? nObjNum<nObjCount : nObjNum>0)) {
             if (!bBack) nObjNum--;
             SdrObject* pObj;
 
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 20adb07..a8b6c51 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -590,8 +590,8 @@ void SdrObject::getMergedHierarchyLayerSet(SetOfByte& rSet) const
     rSet.Set(GetLayer());
     SdrObjList* pOL=GetSubList();
     if (pOL!=NULL) {
-        const size_t nObjAnz = pOL->GetObjCount();
-        for (size_t nObjNum = 0; nObjNum<nObjAnz; ++nObjNum) {
+        const size_t nObjCount = pOL->GetObjCount();
+        for (size_t nObjNum = 0; nObjNum<nObjCount; ++nObjNum) {
             pOL->GetObj(nObjNum)->getMergedHierarchyLayerSet(rSet);
         }
     }
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 515c439..945a6a6 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -897,8 +897,8 @@ void SdrPaintView::GlueInvalidate() const
             if(mpPageView)
             {
                 const SdrObjList* pOL=mpPageView->GetObjList();
-                const size_t nObjAnz = pOL->GetObjCount();
-                for (size_t nObjNum=0; nObjNum<nObjAnz; ++nObjNum) {
+                const size_t nObjCount = pOL->GetObjCount();
+                for (size_t nObjNum=0; nObjNum<nObjCount; ++nObjNum) {
                     const SdrObject* pObj=pOL->GetObj(nObjNum);
                     const SdrGluePointList* pGPL=pObj->GetGluePointList();
                     if (pGPL!=NULL && pGPL->GetCount()!=0) {
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 7466532..b2c85d2 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -285,9 +285,9 @@ SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1, bool bSave
     {
         // it's a group object!
         pUndoGroup = new SdrUndoGroup(*pObj->GetModel());
-        const size_t nObjAnz(pOL->GetObjCount());
+        const size_t nObjCount(pOL->GetObjCount());
 
-        for(size_t nObjNum = 0; nObjNum < nObjAnz; ++nObjNum)
+        for(size_t nObjNum = 0; nObjNum < nObjCount; ++nObjNum)
         {
             pUndoGroup->AddAction(
                 new SdrUndoAttrObj(*pOL->GetObj(nObjNum), bStyleSheet1));
@@ -612,8 +612,8 @@ SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj)
         // If this were 3D scene, we'd only add an Undo for the scene itself
         // (which we do elsewhere).
         pUndoGroup=new SdrUndoGroup(*pObj->GetModel());
-        const size_t nObjAnz = pOL->GetObjCount();
-        for (size_t nObjNum = 0; nObjNum<nObjAnz; ++nObjNum) {
+        const size_t nObjCount = pOL->GetObjCount();
+        for (size_t nObjNum = 0; nObjNum<nObjCount; ++nObjNum) {
             pUndoGroup->AddAction(new SdrUndoGeoObj(*pOL->GetObj(nObjNum)));
         }
     }
commit 81ef96a2417c7843dfed0558c920ad3064e58921
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Jun 1 09:03:05 2015 +0200

    tdf#79639 DOCX import: don't delay text frame conversion of in-header tables
    
    Floating tables may or may not be converted to table-in-textframes
    during import, depending on if we guess that it'll be a multi-page table
    with minimal wrapping or a real wrapped table.
    
    If the floating table is in a header or footer, then it won't be a
    multi-page one, so can do the conversion right away.
    
    Change-Id: I8d5ff8c5fe00037d5cef92dea6b54de6806214bc

diff --git a/sw/qa/extras/ooxmlexport/data/tdf79639.docx b/sw/qa/extras/ooxmlexport/data/tdf79639.docx
new file mode 100644
index 0000000..b84aaea
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf79639.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ba7715b..fc05887 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -695,6 +695,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf91261, "tdf91261.docx")
 
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf79639, "tdf79639.docx")
+{
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+    // This was 0, floating table in header wasn't converted to a TextFrame.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xDrawPage->getCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 809429d..b08e52a 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -1113,12 +1113,19 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
             // Also, when the anchor is within a table, then do it here as well,
             // as xStart/xEnd would not point to the start/end at conversion
             // time anyway.
+            // Next exception: it's pointless to delay the conversion if the
+            // table is not in the body text.
             sal_Int32 nTableWidth = 0;
             m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH, nTableWidth);
-            if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1)
+            if (m_rDMapper_Impl.GetSectionContext() && nestedTableLevel <= 1 && !m_rDMapper_Impl.IsInHeaderFooter())
                 m_rDMapper_Impl.m_aPendingFloatingTables.push_back(FloatingTableInfo(xStart, xEnd, comphelper::containerToSequence(aFrameProperties), nTableWidth));
             else
-                m_xText->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties));
+            {
+                // m_xText points to the body text, get to current xText from m_rDMapper_Impl, in case e.g. we would be in a header.
+                uno::Reference<text::XTextAppendAndConvert> xTextAppendAndConvert(m_rDMapper_Impl.GetTopTextAppend(), uno::UNO_QUERY);
+                if (xTextAppendAndConvert.is())
+                    xTextAppendAndConvert->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties));
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list