[Libreoffice-commits] .: 3 commits - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Nov 24 18:01:25 PST 2010


 sc/source/filter/xml/xmlexprt.cxx |  292 ++++++++++++++++++--------------------
 1 file changed, 142 insertions(+), 150 deletions(-)

New commits:
commit f4169cc6cc22b25f26989247d425bebd0f7ab3cf
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Nov 24 21:00:12 2010 -0500

    uno::Reference -> Reference, to make it shorter.

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 5655c55..613fa45 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -167,6 +167,7 @@ using namespace xmloff::token;
 using ::std::vector;
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
 using ::com::sun::star::uno::UNO_QUERY;
 
 //----------------------------------------------------------------------------
@@ -2231,11 +2232,11 @@ void ScXMLExport::_ExportAutoStyles()
     if (!GetModel().is())
         return;
 
-    uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY );
+    Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetModel(), uno::UNO_QUERY );
     if (!xSpreadDoc.is())
         return;
 
-    uno::Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY );
+    Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY );
     if (!xIndex.is())
         return;
 
@@ -2272,8 +2273,8 @@ void ScXMLExport::_ExportAutoStyles()
                 bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
                 if (bCopySheet)
                 {
-                    uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-                    uno::Reference <beans::XPropertySet> xProperties(
+                    Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+                    Reference <beans::XPropertySet> xProperties(
                         xTable->getCellByPosition( aPos.Col(), aPos.Row() ), uno::UNO_QUERY );
 
                     AddStyleFromCells(xProperties, xTable, nTable, &aCellIter->maName);
@@ -2292,9 +2293,9 @@ void ScXMLExport::_ExportAutoStyles()
                 bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
                 if (bCopySheet)
                 {
-                    uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-                    uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
-                    uno::Reference<beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex( aPos.Col() ), uno::UNO_QUERY);
+                    Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+                    Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
+                    Reference<beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex( aPos.Col() ), uno::UNO_QUERY);
 
                     sal_Int32 nIndex(-1);
                     sal_Bool bIsVisible(sal_True);
@@ -2314,9 +2315,9 @@ void ScXMLExport::_ExportAutoStyles()
                 bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
                 if (bCopySheet)
                 {
-                    uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-                    uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
-                    uno::Reference<beans::XPropertySet> xRowProperties(xTableRows->getByIndex( aPos.Row() ), uno::UNO_QUERY);
+                    Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+                    Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
+                    Reference<beans::XPropertySet> xRowProperties(xTableRows->getByIndex( aPos.Row() ), uno::UNO_QUERY);
 
                     sal_Int32 nIndex(-1);
                     AddStyleFromRow( xRowProperties, &aRowIter->maName, nIndex );
@@ -2336,7 +2337,7 @@ void ScXMLExport::_ExportAutoStyles()
                 if (bCopySheet)
                 {
                     //! separate method AddStyleFromTable needed?
-                    uno::Reference<beans::XPropertySet> xTableProperties(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+                    Reference<beans::XPropertySet> xTableProperties(xIndex->getByIndex(nTable), uno::UNO_QUERY);
                     if (xTableProperties.is())
                     {
                         std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties));
@@ -2372,7 +2373,7 @@ void ScXMLExport::_ExportAutoStyles()
                     {
                         SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos );
                         // all uno shapes are created anyway in CollectSharedData
-                        uno::Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY );
+                        Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY );
                         if (xShapeProperties.is())
                         {
                             if ( aNoteIter->maStyleName.getLength() )
@@ -2417,8 +2418,8 @@ void ScXMLExport::_ExportAutoStyles()
                     if (pNote)
                     {
                         SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos );
-                        uno::Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
-                        uno::Reference<beans::XPropertySet> xParaProp(
+                        Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
+                        Reference<beans::XPropertySet> xParaProp(
                             lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY );
                         if ( xParaProp.is() )
                         {
@@ -2452,8 +2453,8 @@ void ScXMLExport::_ExportAutoStyles()
                     if (pNote)
                     {
                         SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos );
-                        uno::Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
-                        uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
+                        Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
+                        Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
                         ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp );
                         if (pCursor)
                         {
@@ -2485,9 +2486,9 @@ void ScXMLExport::_ExportAutoStyles()
                     //! separate method AddStyleFromText needed?
                     //! cache sheet object
 
-                    uno::Reference<table::XCellRange> xCellRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-                    uno::Reference<text::XSimpleText> xCellText(xCellRange->getCellByPosition(aPos.Col(), aPos.Row()), uno::UNO_QUERY);
-                    uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
+                    Reference<table::XCellRange> xCellRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+                    Reference<text::XSimpleText> xCellText(xCellRange->getCellByPosition(aPos.Col(), aPos.Row()), uno::UNO_QUERY);
+                    Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
                     ScCellTextCursor* pCursor = ScCellTextCursor::getImplementation( xCursorProp );
                     if (pCursor)
                     {
@@ -2521,12 +2522,12 @@ void ScXMLExport::_ExportAutoStyles()
             bool bUseStream = pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable) &&
                               pSheetData->HasStreamPos(nTable) && xSourceStream.is();
 
-            uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+            Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
             if (!xTable.is())
                 continue;
 
             // table styles array must be complete, including copied tables - Add should find the stored style
-            uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY);
+            Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY);
             if (xTableProperties.is())
             {
                 std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties));
@@ -2543,20 +2544,20 @@ void ScXMLExport::_ExportAutoStyles()
                 continue;
 
             // collect other auto-styles only for non-copied sheets
-            uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTable, uno::UNO_QUERY );
+            Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTable, uno::UNO_QUERY );
             if ( xCellFormatRanges.is() )
             {
-                uno::Reference<container::XIndexAccess> xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges());
+                Reference<container::XIndexAccess> xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges());
                 if (xFormatRangesIndex.is())
                 {
                     sal_Int32 nFormatRangesCount(xFormatRangesIndex->getCount());
                     GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nFormatRangesCount);
                     for (sal_Int32 nFormatRange = 0; nFormatRange < nFormatRangesCount; ++nFormatRange)
                     {
-                        uno::Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY);
+                        Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY);
                         if (xCellRanges.is())
                         {
-                            uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY);
+                            Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY);
                             if (xProperties.is())
                             {
                                 AddStyleFromCells(xProperties, xTable, nTable, NULL);
@@ -2566,13 +2567,13 @@ void ScXMLExport::_ExportAutoStyles()
                     }
                 }
             }
-            uno::Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY);
+            Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY);
             if (xColumnRowRange.is())
             {
                 if (pDoc)
                 {
                     pDoc->SyncColRowFlags();
-                    uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
+                    Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
                     if (xTableColumns.is())
                     {
                         sal_Int32 nColumns(pDoc->GetLastChangedCol(sal::static_int_cast<SCTAB>(nTable)));
@@ -2590,7 +2591,7 @@ void ScXMLExport::_ExportAutoStyles()
                         {
                             sal_Int32 nIndex(-1);
                             sal_Bool bIsVisible(sal_True);
-                            uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY);
+                            Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY);
                             if (xColumnProperties.is())
                             {
                                 AddStyleFromColumn( xColumnProperties, NULL, nIndex, bIsVisible );
@@ -2609,7 +2610,7 @@ void ScXMLExport::_ExportAutoStyles()
                                 pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
                         }
                     }
-                    uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
+                    Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
                     if (xTableRows.is())
                     {
                         sal_Int32 nRows(pDoc->GetLastChangedRow(sal::static_int_cast<SCTAB>(nTable)));
@@ -2626,7 +2627,7 @@ void ScXMLExport::_ExportAutoStyles()
                         while (nRow <= nRows && nRow <= MAXROW)
                         {
                             sal_Int32 nIndex = 0;
-                            uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY);
+                            Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY);
                             if(xRowProperties.is())
                             {
                                 AddStyleFromRow( xRowProperties, NULL, nIndex );
@@ -2645,25 +2646,25 @@ void ScXMLExport::_ExportAutoStyles()
                     }
                 }
             }
-            uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
+            Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
             if (xCellRangesQuery.is())
             {
-                uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
-                uno::Reference<sheet::XSheetOperation> xSheetOperation(xSheetCellRanges, uno::UNO_QUERY);
+                Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
+                Reference<sheet::XSheetOperation> xSheetOperation(xSheetCellRanges, uno::UNO_QUERY);
                 if (xSheetCellRanges.is() && xSheetOperation.is())
                 {
                     sal_uInt32 nCount(sal_uInt32(xSheetOperation->computeFunction(sheet::GeneralFunction_COUNT)));
-                    uno::Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells());
+                    Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells());
                     if (xCellsAccess.is())
                     {
                         GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount);
-                        uno::Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration());
+                        Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration());
                         if (xCells.is())
                         {
                             sal_uInt32 nCount2(0);
                             while (xCells->hasMoreElements())
                             {
-                                uno::Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY);
+                                Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY);
                                 if (xText.is())
                                     GetTextParagraphExport()->collectTextAutoStyles(xText, sal_False, sal_False);
                                 ++nCount2;
commit 8ec5afbd9779ae17501f28f57c7ec6e82b234f85
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Nov 24 20:56:47 2010 -0500

    Let's not include everything from the rtl namespace.

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 3796fd1..5655c55 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -161,11 +161,12 @@
 #define SC_SHOW_CHANGES_BY_RANGES					11
 #define SC_SHOW_CHANGES_BY_RANGES_LIST				12
 
-using namespace rtl;
 using namespace formula;
 using namespace com::sun::star;
 using namespace xmloff::token;
 using ::std::vector;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
 using ::com::sun::star::uno::UNO_QUERY;
 
 //----------------------------------------------------------------------------
commit e3c3ce85604470b0414d3e0a829bcc8ce227d09b
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Nov 24 20:53:36 2010 -0500

    Reduced indentation levels & some code cleanups.

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index b69e987..3796fd1 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2399,7 +2399,6 @@ void ScXMLExport::_ExportAutoStyles()
 
             // note paragraph styles
 
-            //UniReference<SvXMLExportPropertyMapper> xParaPropMapper = XMLTextParagraphExport::CreateParaExtPropMapper( *this );
             UniReference<SvXMLExportPropertyMapper> xParaPropMapper = GetTextParagraphExport()->GetParagraphPropertyMapper();
 
             const std::vector<ScTextStyleEntry>& rNoteParaEntries = pSheetData->GetNoteParaStyles();
@@ -2472,8 +2471,6 @@ void ScXMLExport::_ExportAutoStyles()
 
             // stored text styles
 
-            //UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this );
-
             const std::vector<ScTextStyleEntry>& rTextEntries = pSheetData->GetTextStyles();
             std::vector<ScTextStyleEntry>::const_iterator aTextIter = rTextEntries.begin();
             std::vector<ScTextStyleEntry>::const_iterator aTextEnd = rTextEntries.end();
@@ -2514,176 +2511,169 @@ void ScXMLExport::_ExportAutoStyles()
             sal_Int32 nShapesCount(0);
             sal_Int32 nCellCount(pDoc ? pDoc->GetCellCount() : 0);
             CollectSharedData(nTableCount, nShapesCount, nCellCount);
-            //DBG_ERROR("no shared data setted");
         }
         sal_Int32 nTableCount(xIndex->getCount());
         pCellStyles->AddNewTable(nTableCount - 1);
         CollectShapesAutoStyles(nTableCount);
-        for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable)
+        for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable, IncrementProgressBar(sal_False))
         {
             bool bUseStream = pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable) &&
                               pSheetData->HasStreamPos(nTable) && xSourceStream.is();
 
             uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
-            if (xTable.is())
+            if (!xTable.is())
+                continue;
+
+            // table styles array must be complete, including copied tables - Add should find the stored style
+            uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY);
+            if (xTableProperties.is())
             {
-                // table styles array must be complete, including copied tables - Add should find the stored style
-                uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY);
-                if (xTableProperties.is())
+                std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties));
+                if(xPropStates.size())
                 {
-                    std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties));
-                    if(xPropStates.size())
-                    {
-                        rtl::OUString sParent;
-                        rtl::OUString sName;
-                        GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates);
-                        aTableStyles.push_back(sName);
-                    }
+                    rtl::OUString sParent;
+                    rtl::OUString sName;
+                    GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates);
+                    aTableStyles.push_back(sName);
                 }
             }
+
+            if (bUseStream)
+                continue;
+
             // collect other auto-styles only for non-copied sheets
-            if (xTable.is() && !bUseStream)
+            uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTable, uno::UNO_QUERY );
+            if ( xCellFormatRanges.is() )
             {
-                uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTable, uno::UNO_QUERY );
-                if ( xCellFormatRanges.is() )
+                uno::Reference<container::XIndexAccess> xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges());
+                if (xFormatRangesIndex.is())
                 {
-                    uno::Reference<container::XIndexAccess> xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges());
-                    if (xFormatRangesIndex.is())
+                    sal_Int32 nFormatRangesCount(xFormatRangesIndex->getCount());
+                    GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nFormatRangesCount);
+                    for (sal_Int32 nFormatRange = 0; nFormatRange < nFormatRangesCount; ++nFormatRange)
                     {
-                        sal_Int32 nFormatRangesCount(xFormatRangesIndex->getCount());
-                        GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nFormatRangesCount);
-                        for (sal_Int32 nFormatRange = 0; nFormatRange < nFormatRangesCount; ++nFormatRange)
+                        uno::Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY);
+                        if (xCellRanges.is())
                         {
-                            uno::Reference< sheet::XSheetCellRanges> xCellRanges(xFormatRangesIndex->getByIndex(nFormatRange), uno::UNO_QUERY);
-                            if (xCellRanges.is())
+                            uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY);
+                            if (xProperties.is())
                             {
-                                uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY);
-                                if (xProperties.is())
-                                {
-                                    AddStyleFromCells(xProperties, xTable, nTable, NULL);
-                                    IncrementProgressBar(sal_False);
-                                }
+                                AddStyleFromCells(xProperties, xTable, nTable, NULL);
+                                IncrementProgressBar(sal_False);
                             }
                         }
                     }
                 }
-                uno::Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY);
-                if (xColumnRowRange.is())
+            }
+            uno::Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY);
+            if (xColumnRowRange.is())
+            {
+                if (pDoc)
                 {
-                    if (pDoc)
+                    pDoc->SyncColRowFlags();
+                    uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
+                    if (xTableColumns.is())
                     {
-                        pDoc->SyncColRowFlags();
-                        uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
-                        if (xTableColumns.is())
+                        sal_Int32 nColumns(pDoc->GetLastChangedCol(sal::static_int_cast<SCTAB>(nTable)));
+                        pSharedData->SetLastColumn(nTable, nColumns);
+                        table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable));
+                        if (aCellAddress.EndColumn > nColumns)
                         {
-                            sal_Int32 nColumns(pDoc->GetLastChangedCol(sal::static_int_cast<SCTAB>(nTable)));
-                            pSharedData->SetLastColumn(nTable, nColumns);
-                            table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable));
-                            if (aCellAddress.EndColumn > nColumns)
-                            {
-                                ++nColumns;
-                                pColumnStyles->AddNewTable(nTable, aCellAddress.EndColumn);
-                            }
-//                              else if (nColumns < MAXCOL)
-//                                  pColumnStyles->AddNewTable(nTable, ++nColumns);
-                            else
-                                pColumnStyles->AddNewTable(nTable, nColumns);
-                            sal_Int32 nColumn = 0;
-                            while (/*nColumn <= nColumns && */nColumn <= MAXCOL)
-                            {
-                                sal_Int32 nIndex(-1);
-                                sal_Bool bIsVisible(sal_True);
-                                uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY);
-                                if (xColumnProperties.is())
-                                {
-                                    AddStyleFromColumn( xColumnProperties, NULL, nIndex, bIsVisible );
-                                    //if(xPropStates.size())
-                                    pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible);
-                                }
-                                sal_Int32 nOld(nColumn);
-                                nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast<SCTAB>(nTable), static_cast<SCCOL>(nColumn));
-                                for (sal_Int32 i = nOld + 1; i < nColumn; ++i)
-                                    pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
-                            }
-                            if (aCellAddress.EndColumn > nColumns)
-                            {
-                                sal_Bool bIsVisible(sal_True);
-                                sal_Int32 nIndex(pColumnStyles->GetStyleNameIndex(nTable, nColumns, bIsVisible));
-                                for (sal_Int32 i = nColumns + 1; i <= aCellAddress.EndColumn; ++i)
-                                    pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
-                            }
+                            ++nColumns;
+                            pColumnStyles->AddNewTable(nTable, aCellAddress.EndColumn);
                         }
-                        uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
-                        if (xTableRows.is())
+                        else
+                            pColumnStyles->AddNewTable(nTable, nColumns);
+                        sal_Int32 nColumn = 0;
+                        while (nColumn <= MAXCOL)
                         {
-                            sal_Int32 nRows(pDoc->GetLastChangedRow(sal::static_int_cast<SCTAB>(nTable)));
-                            pSharedData->SetLastRow(nTable, nRows);
-                            table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable));
-                            if (aCellAddress.EndRow > nRows)
-                            {
-                                ++nRows;
-                                pRowStyles->AddNewTable(nTable, aCellAddress.EndRow);
-                            }
-//                              else if (nRows < MAXROW)
-//                                  pRowStyles->AddNewTable(nTable, ++nRows);
-                            else
-                                pRowStyles->AddNewTable(nTable, nRows);
-                            sal_Int32 nRow = 0;
-                            while (nRow <= nRows && nRow <= MAXROW)
+                            sal_Int32 nIndex(-1);
+                            sal_Bool bIsVisible(sal_True);
+                            uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY);
+                            if (xColumnProperties.is())
                             {
-                                sal_Int32 nIndex = 0;
-                                uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY);
-                                if(xRowProperties.is())
-                                {
-                                    AddStyleFromRow( xRowProperties, NULL, nIndex );
-                                    //if(xPropStates.size())
-                                    pRowStyles->AddFieldStyleName(nTable, nRow, nIndex);
-                                }
-                                sal_Int32 nOld(nRow);
-                                nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<SCROW>(nRow), false);
-                                if (nRow > nOld + 1)
-                                    pRowStyles->AddFieldStyleName(nTable, nOld + 1, nIndex, nRow - 1);
+                                AddStyleFromColumn( xColumnProperties, NULL, nIndex, bIsVisible );
+                                pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible);
                             }
-                            if (aCellAddress.EndRow > nRows)
+                            sal_Int32 nOld(nColumn);
+                            nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast<SCTAB>(nTable), static_cast<SCCOL>(nColumn));
+                            for (sal_Int32 i = nOld + 1; i < nColumn; ++i)
+                                pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
+                        }
+                        if (aCellAddress.EndColumn > nColumns)
+                        {
+                            sal_Bool bIsVisible(sal_True);
+                            sal_Int32 nIndex(pColumnStyles->GetStyleNameIndex(nTable, nColumns, bIsVisible));
+                            for (sal_Int32 i = nColumns + 1; i <= aCellAddress.EndColumn; ++i)
+                                pColumnStyles->AddFieldStyleName(nTable, i, nIndex, bIsVisible);
+                        }
+                    }
+                    uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
+                    if (xTableRows.is())
+                    {
+                        sal_Int32 nRows(pDoc->GetLastChangedRow(sal::static_int_cast<SCTAB>(nTable)));
+                        pSharedData->SetLastRow(nTable, nRows);
+                        table::CellRangeAddress aCellAddress(GetEndAddress(xTable, nTable));
+                        if (aCellAddress.EndRow > nRows)
+                        {
+                            ++nRows;
+                            pRowStyles->AddNewTable(nTable, aCellAddress.EndRow);
+                        }
+                        else
+                            pRowStyles->AddNewTable(nTable, nRows);
+                        sal_Int32 nRow = 0;
+                        while (nRow <= nRows && nRow <= MAXROW)
+                        {
+                            sal_Int32 nIndex = 0;
+                            uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY);
+                            if(xRowProperties.is())
                             {
-                                sal_Int32 nIndex(pRowStyles->GetStyleNameIndex(nTable, nRows));
-                                pRowStyles->AddFieldStyleName(nTable, nRows + 1, nIndex, aCellAddress.EndRow);
+                                AddStyleFromRow( xRowProperties, NULL, nIndex );
+                                pRowStyles->AddFieldStyleName(nTable, nRow, nIndex);
                             }
+                            sal_Int32 nOld(nRow);
+                            nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<SCROW>(nRow), false);
+                            if (nRow > nOld + 1)
+                                pRowStyles->AddFieldStyleName(nTable, nOld + 1, nIndex, nRow - 1);
+                        }
+                        if (aCellAddress.EndRow > nRows)
+                        {
+                            sal_Int32 nIndex(pRowStyles->GetStyleNameIndex(nTable, nRows));
+                            pRowStyles->AddFieldStyleName(nTable, nRows + 1, nIndex, aCellAddress.EndRow);
                         }
                     }
                 }
-                uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
-                if (xCellRangesQuery.is())
+            }
+            uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
+            if (xCellRangesQuery.is())
+            {
+                uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
+                uno::Reference<sheet::XSheetOperation> xSheetOperation(xSheetCellRanges, uno::UNO_QUERY);
+                if (xSheetCellRanges.is() && xSheetOperation.is())
                 {
-                    uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
-                    uno::Reference<sheet::XSheetOperation> xSheetOperation(xSheetCellRanges, uno::UNO_QUERY);
-                    if (xSheetCellRanges.is() && xSheetOperation.is())
+                    sal_uInt32 nCount(sal_uInt32(xSheetOperation->computeFunction(sheet::GeneralFunction_COUNT)));
+                    uno::Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells());
+                    if (xCellsAccess.is())
                     {
-                        sal_uInt32 nCount(sal_uInt32(xSheetOperation->computeFunction(sheet::GeneralFunction_COUNT)));
-                        uno::Reference<container::XEnumerationAccess> xCellsAccess(xSheetCellRanges->getCells());
-                        if (xCellsAccess.is())
+                        GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount);
+                        uno::Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration());
+                        if (xCells.is())
                         {
-                            GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCount);
-                            uno::Reference<container::XEnumeration> xCells(xCellsAccess->createEnumeration());
-                            if (xCells.is())
+                            sal_uInt32 nCount2(0);
+                            while (xCells->hasMoreElements())
                             {
-                                sal_uInt32 nCount2(0);
-                                while (xCells->hasMoreElements())
-                                {
-                                    uno::Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY);
-                                    if (xText.is())
-                                        GetTextParagraphExport()->collectTextAutoStyles(xText, sal_False, sal_False);
-                                    ++nCount2;
-                                    IncrementProgressBar(sal_False);
-                                }
-                                if(nCount2 > nCount)
-                                    GetProgressBarHelper()->SetReference(GetProgressBarHelper()->GetReference() + nCount2 - nCount);
+                                uno::Reference<text::XText> xText(xCells->nextElement(), uno::UNO_QUERY);
+                                if (xText.is())
+                                    GetTextParagraphExport()->collectTextAutoStyles(xText, sal_False, sal_False);
+                                ++nCount2;
+                                IncrementProgressBar(sal_False);
                             }
+                            if(nCount2 > nCount)
+                                GetProgressBarHelper()->SetReference(GetProgressBarHelper()->GetReference() + nCount2 - nCount);
                         }
                     }
                 }
             }
-            IncrementProgressBar(sal_False);
         }
         pChangeTrackingExportHelper->CollectAutoStyles();
 


More information about the Libreoffice-commits mailing list