[Libreoffice-commits] .: 5 commits - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Oct 28 17:59:12 PDT 2011


 sc/inc/address.hxx                |    8 -
 sc/source/core/tool/address.cxx   |   10 +-
 sc/source/filter/xml/xmlexprt.cxx |  189 ++++++++++++++++++++++----------------
 sc/source/ui/view/drawvie3.cxx    |   46 +++++++--
 4 files changed, 159 insertions(+), 94 deletions(-)

New commits:
commit adefe9fce8bec3fb3c01eaa5deab7c22a1f09953
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Oct 28 17:38:25 2011 -0400

    bnc#726152: Avoid adjusting cell-anchored objects on other sheets.
    
    The old code would incorrectly move anchors from one sheet to another
    when updating the anchors of an object that was not on current sheet.
    
    That can happen e.g. when modifying a cell value which triggers a
    (cell-anchored) chart object on another sheet to get updated.
    
    Interestingly, this issue ended up causing a write error during file
    save in some situations, and in others silenting removing the affected
    chart objects on save.

diff --git a/sc/source/ui/view/drawvie3.cxx b/sc/source/ui/view/drawvie3.cxx
index 400384a..7c976a2 100644
--- a/sc/source/ui/view/drawvie3.cxx
+++ b/sc/source/ui/view/drawvie3.cxx
@@ -139,6 +139,42 @@ ScAnchorType ScDrawView::GetAnchorType() const
     return SCA_DONTKNOW;
 }
 
+namespace {
+
+/**
+ * Updated the anchors of any non-note object that is cell anchored which
+ * has been moved since the last anchors for its position was calculated.
+ */
+void adjustAnchoredPosition(const SdrHint& rHint, const ScDocument& rDoc, SCTAB nTab)
+{
+    if (rHint.GetKind() != HINT_OBJCHG && rHint.GetKind() != HINT_OBJINSERTED)
+        return;
+
+    SdrObject* pObj = const_cast<SdrObject*>(rHint.GetObject());
+    if (!pObj)
+        return;
+
+    ScDrawObjData *pAnchor = ScDrawLayer::GetObjData(pObj);
+    if (!pAnchor)
+        return;
+
+    if (pAnchor->mbNote)
+        return;
+
+    if (pAnchor->maLastRect == pObj->GetLogicRect())
+        return;
+
+    if (pAnchor->maStart.Tab() != nTab)
+        // The object is not anchored on the current sheet.  Skip it.
+        // TODO: In the future, we may want to adjust objects that are
+        // anchored on all selected sheets.
+        return;
+
+    ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rDoc, pAnchor->maStart.Tab());
+}
+
+}
+
 void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 {
     if (rHint.ISA(ScTabDeletedHint))                        // Tabelle geloescht
@@ -159,15 +195,7 @@ void ScDrawView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     else if ( rHint.ISA( SdrHint ) )
     {
         if (const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ))
-        {
-            //Update the anchors of any non note object that is cell anchored which has
-            //been moved since the last anchors for its position was calculated
-            if (pSdrHint->GetKind() == HINT_OBJCHG || pSdrHint->GetKind() == HINT_OBJINSERTED)
-                if (SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject()))
-                    if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData(pObj))
-                        if (!pAnchor->mbNote && pAnchor->maLastRect != pObj->GetLogicRect())
-                            ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *pDoc, nTab);
-        }
+            adjustAnchoredPosition(*pSdrHint, *pDoc, nTab);
         FmFormView::Notify( rBC,rHint );
     }
     else
commit 418a35f4861e863feb39eec73f4a39a87fbcb1f3
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Oct 28 15:38:58 2011 -0400

    These can be const pointers.

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 0fa41b3..761158d 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -320,9 +320,9 @@ public:
                   const ::com::sun::star::uno::Sequence<
                     const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL );
 
-    SC_DLLPUBLIC void Format( rtl::OUString&, sal_uInt16 = 0, ScDocument* = NULL,
+    SC_DLLPUBLIC void Format( rtl::OUString&, sal_uInt16 = 0, const ScDocument* = NULL,
                  const Details& rDetails = detailsOOOa1) const;
-    SC_DLLPUBLIC void Format( String&, sal_uInt16 = 0, ScDocument* = NULL,
+    SC_DLLPUBLIC void Format( String&, sal_uInt16 = 0, const ScDocument* = NULL,
                  const Details& rDetails = detailsOOOa1) const;
 
     // The document for the maximum defined sheet number
@@ -517,10 +517,10 @@ public:
             const ::com::sun::star::uno::Sequence<
                 const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL );
 
-    SC_DLLPUBLIC void Format( String&, sal_uInt16 = 0, ScDocument* = NULL,
+    SC_DLLPUBLIC void Format( String&, sal_uInt16 = 0, const ScDocument* = NULL,
                  const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ) const;
 
-    SC_DLLPUBLIC void Format( rtl::OUString&, sal_uInt16 = 0, ScDocument* = NULL,
+    SC_DLLPUBLIC void Format( rtl::OUString&, sal_uInt16 = 0, const ScDocument* = NULL,
                  const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ) const;
 
     inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1,
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 64fe5e3..08f7af2 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1633,7 +1633,7 @@ getFileNameFromDoc( const ScDocument* pDoc )
     return sFileName;
 }
 
-void ScAddress::Format( OUString& r, sal_uInt16 nFlags, ScDocument* pDoc,
+void ScAddress::Format( OUString& r, sal_uInt16 nFlags, const ScDocument* pDoc,
                         const Details& rDetails) const
 {
     String aStr;
@@ -1641,7 +1641,7 @@ void ScAddress::Format( OUString& r, sal_uInt16 nFlags, ScDocument* pDoc,
     r = aStr;
 }
 
-void ScAddress::Format( String& r, sal_uInt16 nFlags, ScDocument* pDoc,
+void ScAddress::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc,
                         const Details& rDetails) const
 {
     r.Erase();
@@ -1762,7 +1762,7 @@ lcl_Split_DocTab( const ScDocument* pDoc,  SCTAB nTab,
 
 static void
 lcl_ScRange_Format_XL_Header( String& r, const ScRange& rRange,
-                              sal_uInt16 nFlags, ScDocument* pDoc,
+                              sal_uInt16 nFlags, const ScDocument* pDoc,
                               const ScAddress::Details& rDetails )
 {
     if( nFlags & SCA_TAB_3D )
@@ -1789,7 +1789,7 @@ lcl_ScRange_Format_XL_Header( String& r, const ScRange& rRange,
     }
 }
 
-void ScRange::Format( String& r, sal_uInt16 nFlags, ScDocument* pDoc,
+void ScRange::Format( String& r, sal_uInt16 nFlags, const ScDocument* pDoc,
                       const ScAddress::Details& rDetails ) const
 {
     r.Erase();
@@ -1893,7 +1893,7 @@ void ScRange::Format( String& r, sal_uInt16 nFlags, ScDocument* pDoc,
 #undef  absrel_differ
 }
 
-void ScRange::Format( OUString& r, sal_uInt16 nFlags, ScDocument* pDoc,
+void ScRange::Format( OUString& r, sal_uInt16 nFlags, const ScDocument* pDoc,
                       const ScAddress::Details& rDetails ) const
 {
     String aStr;
commit c2e931d53b810dfab1880c236e03d5c873ed0e34
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Oct 28 12:18:35 2011 -0400

    More reduction of scoping inside nested for loop.

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 03af144..378f1bf 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -689,43 +689,48 @@ void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCo
         for (sal_Int32 nShape = 0; nShape < nShapes; ++nShape)
         {
             uno::Reference<drawing::XShape> xShape(xShapesIndex->getByIndex(nShape), uno::UNO_QUERY);
-            if (xShape.is())
+            if (!xShape.is())
+                continue;
+
+            uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
+            if (!xShapeProp.is())
+                continue;
+
+            sal_Int16 nLayerID = 0;
+            bool bExtracted = xShapeProp->getPropertyValue(sLayerID) >>= nLayerID;
+            if (!bExtracted)
+                continue;
+
+            if ((nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN))
             {
-                uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
-                if( xShapeProp.is() )
-                {
-                    sal_Int16 nLayerID = 0;
-                    if( xShapeProp->getPropertyValue(sLayerID) >>= nLayerID )
-                    {
-                        if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
-                            CollectInternalShape(xShape);
-                        else
-                        {
-                            ++nShapesCount;
-                            if (SvxShape* pShapeImp = SvxShape::getImplementation(xShape))
-                            {
-                                if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
-                                {
-                                    if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData( pSdrObj ))
-                                    {
-                                        ScMyShape aMyShape;
-                                        aMyShape.aAddress = pAnchor->maStart;
-                                        aMyShape.aEndAddress = pAnchor->maEnd;
-                                        aMyShape.nEndX = pAnchor->maEndOffset.X();
-                                        aMyShape.nEndY = pAnchor->maEndOffset.Y();
-                                        aMyShape.xShape = xShape;
-                                        pSharedData->AddNewShape(aMyShape);
-                                        pSharedData->SetLastColumn(nTable, pAnchor->maStart.Col());
-                                        pSharedData->SetLastRow(nTable, pAnchor->maStart.Row());
-                                    }
-                                    else
-                                        pSharedData->AddTableShape(nTable, xShape);
-                                }
-                            }
-                        }
-                    }
-                }
+                CollectInternalShape(xShape);
+                continue;
+            }
+
+            ++nShapesCount;
+
+            SvxShape* pShapeImp = SvxShape::getImplementation(xShape);
+            if (!pShapeImp)
+                continue;
+
+            SdrObject* pSdrObj = pShapeImp->GetSdrObject();
+            if (!pSdrObj)
+                continue;
+
+            if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData(pSdrObj))
+            {
+                ScMyShape aMyShape;
+                aMyShape.aAddress = pAnchor->maStart;
+                aMyShape.aEndAddress = pAnchor->maEnd;
+                aMyShape.nEndX = pAnchor->maEndOffset.X();
+                aMyShape.nEndY = pAnchor->maEndOffset.Y();
+                aMyShape.xShape = xShape;
+                pSharedData->AddNewShape(aMyShape);
+                pSharedData->SetLastColumn(nTable, pAnchor->maStart.Col());
+                pSharedData->SetLastRow(nTable, pAnchor->maStart.Row());
             }
+            else
+                pSharedData->AddTableShape(nTable, xShape);
         }
     }
 }
commit 1b623cdaabbb97f3888db0cf0d7288ab9536d1d0
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Oct 28 12:11:01 2011 -0400

    More reduction of scoping inside for loop.

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 4ba62a4..03af144 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -673,53 +673,53 @@ void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCo
     {
         nCurrentTable = sal::static_int_cast<sal_uInt16>(nTable);
         uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-        if (xDrawPageSupplier.is())
+        if (!xDrawPageSupplier.is())
+            continue;
+
+        uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage());
+        ScMyDrawPage aDrawPage;
+        aDrawPage.bHasForms = false;
+        aDrawPage.xDrawPage.set(xDrawPage);
+        pSharedData->AddDrawPage(aDrawPage, nTable);
+        uno::Reference<container::XIndexAccess> xShapesIndex(xDrawPage, uno::UNO_QUERY);
+        if (!xShapesIndex.is())
+            continue;
+
+        sal_Int32 nShapes = xShapesIndex->getCount();
+        for (sal_Int32 nShape = 0; nShape < nShapes; ++nShape)
         {
-            uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage());
-            ScMyDrawPage aDrawPage;
-            aDrawPage.bHasForms = false;
-            aDrawPage.xDrawPage.set(xDrawPage);
-            pSharedData->AddDrawPage(aDrawPage, nTable);
-            uno::Reference<container::XIndexAccess> xShapesIndex(xDrawPage, uno::UNO_QUERY);
-            if (xShapesIndex.is())
+            uno::Reference<drawing::XShape> xShape(xShapesIndex->getByIndex(nShape), uno::UNO_QUERY);
+            if (xShape.is())
             {
-                sal_Int32 nShapes = xShapesIndex->getCount();
-                for (sal_Int32 nShape = 0; nShape < nShapes; ++nShape)
+                uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
+                if( xShapeProp.is() )
                 {
-                    uno::Reference<drawing::XShape> xShape(xShapesIndex->getByIndex(nShape), uno::UNO_QUERY);
-                    if (xShape.is())
+                    sal_Int16 nLayerID = 0;
+                    if( xShapeProp->getPropertyValue(sLayerID) >>= nLayerID )
                     {
-                        uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
-                        if( xShapeProp.is() )
+                        if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
+                            CollectInternalShape(xShape);
+                        else
                         {
-                            sal_Int16 nLayerID = 0;
-                            if( xShapeProp->getPropertyValue(sLayerID) >>= nLayerID )
+                            ++nShapesCount;
+                            if (SvxShape* pShapeImp = SvxShape::getImplementation(xShape))
                             {
-                                if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
-                                    CollectInternalShape(xShape);
-                                else
+                                if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
                                 {
-                                    ++nShapesCount;
-                                    if (SvxShape* pShapeImp = SvxShape::getImplementation(xShape))
+                                    if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData( pSdrObj ))
                                     {
-                                        if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
-                                        {
-                                            if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData( pSdrObj ))
-                                            {
-                                                ScMyShape aMyShape;
-                                                aMyShape.aAddress = pAnchor->maStart;
-                                                aMyShape.aEndAddress = pAnchor->maEnd;
-                                                aMyShape.nEndX = pAnchor->maEndOffset.X();
-                                                aMyShape.nEndY = pAnchor->maEndOffset.Y();
-                                                aMyShape.xShape = xShape;
-                                                pSharedData->AddNewShape(aMyShape);
-                                                pSharedData->SetLastColumn(nTable, pAnchor->maStart.Col());
-                                                pSharedData->SetLastRow(nTable, pAnchor->maStart.Row());
-                                            }
-                                            else
-                                                pSharedData->AddTableShape(nTable, xShape);
-                                        }
+                                        ScMyShape aMyShape;
+                                        aMyShape.aAddress = pAnchor->maStart;
+                                        aMyShape.aEndAddress = pAnchor->maEnd;
+                                        aMyShape.nEndX = pAnchor->maEndOffset.X();
+                                        aMyShape.nEndY = pAnchor->maEndOffset.Y();
+                                        aMyShape.xShape = xShape;
+                                        pSharedData->AddNewShape(aMyShape);
+                                        pSharedData->SetLastColumn(nTable, pAnchor->maStart.Col());
+                                        pSharedData->SetLastRow(nTable, pAnchor->maStart.Row());
                                     }
+                                    else
+                                        pSharedData->AddTableShape(nTable, xShape);
                                 }
                             }
                         }
commit 277ef71c4a9f6ea57fa82681d71b62d0bdbe83a4
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Fri Oct 28 11:46:15 2011 -0400

    Reduce excessive scoping.

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 05a5dc0..4ba62a4 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -612,77 +612,112 @@ bool ScXMLExport::HasDrawPages(uno::Reference <sheet::XSpreadsheetDocument>& xDo
     return (xDocProps.is() && ::cppu::any2bool( xDocProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_HASDRAWPAGES))) ));
 }
 
+namespace {
+
+/**
+ * Update the progress bar state when an instance of this class goes out of
+ * scope.
+ */
+class ProgressBarUpdater
+{
+    ProgressBarHelper& mrHelper;
+    const sal_Int32& mrTableCount;
+    const sal_Int32& mrShapesCount;
+    const sal_Int32 mnCellCount;
+public:
+    ProgressBarUpdater(ProgressBarHelper& rHelper,
+                       const sal_Int32& rTableCount, const sal_Int32& rShapesCount,
+                       const sal_Int32 nCellCount) :
+        mrHelper(rHelper),
+        mrTableCount(rTableCount),
+        mrShapesCount(rShapesCount),
+        mnCellCount(nCellCount) {}
+
+    ~ProgressBarUpdater()
+    {
+        sal_Int32 nRef = mnCellCount + (2 * mrTableCount) + (2 * mrShapesCount);
+        mrHelper.SetReference(nRef);
+        mrHelper.SetValue(0);
+    }
+};
+
+}
+
 void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCount, const sal_Int32 nCellCount)
 {
-    if (GetModel().is())
+    ProgressBarUpdater(*GetProgressBarHelper(), nTableCount, nShapesCount, nCellCount);
+
+    if (!GetModel().is())
+        return;
+
+    uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc(GetModel(), uno::UNO_QUERY);
+    if (!xSpreadDoc.is())
+        return;
+
+    uno::Reference<container::XIndexAccess> xIndex(xSpreadDoc->getSheets(), uno::UNO_QUERY);
+    if (!xIndex.is())
+        return;
+
+    nTableCount = xIndex->getCount();
+    if (!pSharedData)
+        CreateSharedData(nTableCount);
+
+    pCellStyles->AddNewTable(nTableCount - 1);
+    pDoc->InitializeAllNoteCaptions(true);
+    if (!HasDrawPages(xSpreadDoc))
+        return;
+
+    rtl::OUString sCaptionPoint(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint"));
+
+    for (SCTAB nTable = 0; nTable < nTableCount; ++nTable)
     {
-        uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY );
-        if ( xSpreadDoc.is())
+        nCurrentTable = sal::static_int_cast<sal_uInt16>(nTable);
+        uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+        if (xDrawPageSupplier.is())
         {
-            uno::Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY );
-            if ( xIndex.is() )
+            uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage());
+            ScMyDrawPage aDrawPage;
+            aDrawPage.bHasForms = false;
+            aDrawPage.xDrawPage.set(xDrawPage);
+            pSharedData->AddDrawPage(aDrawPage, nTable);
+            uno::Reference<container::XIndexAccess> xShapesIndex(xDrawPage, uno::UNO_QUERY);
+            if (xShapesIndex.is())
             {
-                nTableCount = xIndex->getCount();
-                if (!pSharedData)
-                    CreateSharedData(nTableCount);
-                pCellStyles->AddNewTable(nTableCount - 1);
-                pDoc->InitializeAllNoteCaptions( true );
-                if (HasDrawPages(xSpreadDoc))
+                sal_Int32 nShapes = xShapesIndex->getCount();
+                for (sal_Int32 nShape = 0; nShape < nShapes; ++nShape)
                 {
-                    rtl::OUString sCaptionPoint( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ));
-                    for (SCTAB nTable = 0; nTable < nTableCount; ++nTable)
+                    uno::Reference<drawing::XShape> xShape(xShapesIndex->getByIndex(nShape), uno::UNO_QUERY);
+                    if (xShape.is())
                     {
-                        nCurrentTable = sal::static_int_cast<sal_uInt16>( nTable );
-                        uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-                        if (xDrawPageSupplier.is())
+                        uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
+                        if( xShapeProp.is() )
                         {
-                            uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage());
-                            ScMyDrawPage aDrawPage;
-                            aDrawPage.bHasForms = false;
-                            aDrawPage.xDrawPage.set(xDrawPage);
-                            pSharedData->AddDrawPage(aDrawPage, nTable);
-                            uno::Reference<container::XIndexAccess> xShapesIndex (xDrawPage, uno::UNO_QUERY);
-                            if (xShapesIndex.is())
+                            sal_Int16 nLayerID = 0;
+                            if( xShapeProp->getPropertyValue(sLayerID) >>= nLayerID )
                             {
-                                sal_Int32 nShapes(xShapesIndex->getCount());
-                                for (sal_Int32 nShape = 0; nShape < nShapes; ++nShape)
+                                if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
+                                    CollectInternalShape(xShape);
+                                else
                                 {
-                                    uno::Reference<drawing::XShape> xShape(xShapesIndex->getByIndex(nShape), uno::UNO_QUERY);
-                                    if (xShape.is())
+                                    ++nShapesCount;
+                                    if (SvxShape* pShapeImp = SvxShape::getImplementation(xShape))
                                     {
-                                        uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
-                                        if( xShapeProp.is() )
+                                        if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
                                         {
-                                            sal_Int16 nLayerID = 0;
-                                            if( xShapeProp->getPropertyValue(sLayerID) >>= nLayerID )
+                                            if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData( pSdrObj ))
                                             {
-                                                if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
-                                                    CollectInternalShape( xShape );
-                                                else
-                                                {
-                                                    ++nShapesCount;
-                                                    if (SvxShape* pShapeImp = SvxShape::getImplementation(xShape))
-                                                    {
-                                                        if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
-                                                        {
-                                                            if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData( pSdrObj ))
-                                                            {
-                                                                ScMyShape aMyShape;
-                                                                aMyShape.aAddress = pAnchor->maStart;
-                                                                aMyShape.aEndAddress = pAnchor->maEnd;
-                                                                aMyShape.nEndX = pAnchor->maEndOffset.X();
-                                                                aMyShape.nEndY = pAnchor->maEndOffset.Y();
-                                                                aMyShape.xShape = xShape;
-                                                                pSharedData->AddNewShape(aMyShape);
-                                                                pSharedData->SetLastColumn(nTable, pAnchor->maStart.Col());
-                                                                pSharedData->SetLastRow(nTable, pAnchor->maStart.Row());
-                                                            }
-                                                            else
-                                                                pSharedData->AddTableShape(nTable, xShape);
-                                                        }
-                                                    }
-                                                }
+                                                ScMyShape aMyShape;
+                                                aMyShape.aAddress = pAnchor->maStart;
+                                                aMyShape.aEndAddress = pAnchor->maEnd;
+                                                aMyShape.nEndX = pAnchor->maEndOffset.X();
+                                                aMyShape.nEndY = pAnchor->maEndOffset.Y();
+                                                aMyShape.xShape = xShape;
+                                                pSharedData->AddNewShape(aMyShape);
+                                                pSharedData->SetLastColumn(nTable, pAnchor->maStart.Col());
+                                                pSharedData->SetLastRow(nTable, pAnchor->maStart.Row());
                                             }
+                                            else
+                                                pSharedData->AddTableShape(nTable, xShape);
                                         }
                                     }
                                 }
@@ -693,9 +728,6 @@ void ScXMLExport::CollectSharedData(sal_Int32& nTableCount, sal_Int32& nShapesCo
             }
         }
     }
-    sal_Int32 nRef(nCellCount + (2 * nTableCount) + (2 * nShapesCount));
-    GetProgressBarHelper()->SetReference(nRef);
-    GetProgressBarHelper()->SetValue(0);
 }
 
 void ScXMLExport::CollectShapesAutoStyles(const sal_Int32 nTableCount)


More information about the Libreoffice-commits mailing list