[Libreoffice-commits] .: 2 commits - sc/inc sc/source unusedcode.easy

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Fri Nov 4 07:47:17 PDT 2011


 sc/inc/document.hxx               |    4 -
 sc/inc/table.hxx                  |    3 -
 sc/source/core/data/documen9.cxx  |   65 --------------------------
 sc/source/core/data/table1.cxx    |    9 ---
 sc/source/core/data/table2.cxx    |   11 ----
 sc/source/filter/xml/xmlsubti.cxx |   93 ++++++++++++++++----------------------
 sc/source/filter/xml/xmlsubti.hxx |    2 
 unusedcode.easy                   |    2 
 8 files changed, 42 insertions(+), 147 deletions(-)

New commits:
commit c9c98ab207fba4df35261c66b3753b9ce5e997ba
Author: Laurent Godard <oooconv at free.fr>
Date:   Fri Nov 4 15:24:53 2011 +0100

    calc big doc : ScMyTables::NewSheet method cleaning

diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 04f9a8e..2bc5b7c 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -184,17 +184,41 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString&
         ++nCurrentSheet;
 
         maProtectionData = rProtectData;
+        ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
+
+        if (nCurrentSheet > 0)
+        {
+            pDoc->AppendTabOnLoad(sTableName);
+        }
+
+        rImport.SetTableStyle(sStyleName);
+        SetTableStyle(sStyleName);
+    }
+
+    NewTable(1);
+}
+
+void ScMyTables::SetTableStyle(const rtl::OUString& sStyleName)
+{
+    //these uno calls are a bit difficult to remove, XMLTableStyleContext::FillPropertySet uses
+    //SvXMLImportPropertyMapper::FillPropertySet
+    if ( sStyleName.getLength() )
+    {
+        // #i57869# All table style properties for all sheets are now applied here,
+        // before importing the contents.
+        // This is needed for the background color.
+        // Sheet visibility has special handling in ScDocFunc::SetTableVisible to
+        // allow hiding the first sheet.
+        // RTL layout is only remembered, not actually applied, so the shapes can
+        // be loaded before mirroring.
+
         uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( rImport.GetModel(), uno::UNO_QUERY );
+
         if ( xSpreadDoc.is() )
         {
             uno::Reference <sheet::XSpreadsheets> xSheets(xSpreadDoc->getSheets());
-            if (xSheets.is())
+            if ( xSheets.is() )
             {
-                if (nCurrentSheet > 0)
-                {
-                    ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
-                    pDoc->AppendTabOnLoad(sTableName);
-                }
                 uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
                 if ( xIndex.is() )
                 {
@@ -202,65 +226,28 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString&
                     if ( xCurrentSheet.is() )
                     {
                         xCurrentCellRange.set(xCurrentSheet, uno::UNO_QUERY);
-                        if (!(nCurrentSheet > 0))
+                        uno::Reference <beans::XPropertySet> xProperties(xCurrentSheet, uno::UNO_QUERY);
+                        if ( xProperties.is() )
                         {
-                            uno::Reference < container::XNamed > xNamed(xCurrentSheet, uno::UNO_QUERY );
-                            if ( xNamed.is() )
-                                try
-                                {
-                                    xNamed->setName(sTableName);
-                                }
-                                catch ( uno::RuntimeException& )
-                                {
-                                    ScDocument *pDoc = ScXMLConverter::GetScDocument(rImport.GetModel());
-                                    if (pDoc)
-                                    {
-                                        ScXMLImport::MutexGuard aGuard(rImport);
-                                        String sTabName(String::CreateFromAscii("Table"));
-                                        pDoc->CreateValidTabName(sTabName);
-                                        rtl::OUString sOUTabName(sTabName);
-                                        xNamed->setName(sOUTabName);
-                                    }
-                                }
-                        }
-                        rImport.SetTableStyle(sStyleName);
-
-                        if ( sStyleName.getLength() )
-                        {
-                            // #i57869# All table style properties for all sheets are now applied here,
-                            // before importing the contents.
-                            // This is needed for the background color.
-                            // Sheet visibility has special handling in ScDocFunc::SetTableVisible to
-                            // allow hiding the first sheet.
-                            // RTL layout is only remembered, not actually applied, so the shapes can
-                            // be loaded before mirroring.
-
-                            uno::Reference <beans::XPropertySet> xProperties(xCurrentSheet, uno::UNO_QUERY);
-                            if (xProperties.is())
+                            XMLTableStylesContext *pStyles = (XMLTableStylesContext *)rImport.GetAutoStyles();
+                            if ( pStyles )
                             {
-                                XMLTableStylesContext *pStyles = (XMLTableStylesContext *)rImport.GetAutoStyles();
-                                if (pStyles)
-                                {
-                                    XMLTableStyleContext* pStyle = (XMLTableStyleContext *)pStyles->FindStyleChildContext(
+                                XMLTableStyleContext* pStyle = (XMLTableStyleContext *)pStyles->FindStyleChildContext(
                                         XML_STYLE_FAMILY_TABLE_TABLE, sStyleName, true);
-                                    if (pStyle)
-                                    {
-                                        pStyle->FillPropertySet(xProperties);
+                                if ( pStyle )
+                                {
+                                    pStyle->FillPropertySet(xProperties);
 
-                                        ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rImport.GetModel())->GetSheetSaveData();
-                                        pSheetData->AddTableStyle( sStyleName, ScAddress( 0, 0, nCurrentSheet ) );
-                                    }
+                                    ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rImport.GetModel())->GetSheetSaveData();
+                                    pSheetData->AddTableStyle( sStyleName, ScAddress( 0, 0, nCurrentSheet ) );
                                 }
                             }
                         }
                     }
-
                 }
             }
         }
     }
-
-    NewTable(1);
 }
 
 bool ScMyTables::IsMerged (const uno::Reference <table::XCellRange>& xCellRange, const sal_Int32 nCol, const sal_Int32 nRow,
diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx
index e3955e4..cf37bcf 100644
--- a/sc/source/filter/xml/xmlsubti.hxx
+++ b/sc/source/filter/xml/xmlsubti.hxx
@@ -154,6 +154,8 @@ private:
     void                                NewRow();
     void                                InsertColumn();
     void                                NewColumn(bool bIsCovered);
+
+    void                                SetTableStyle(const rtl::OUString& sStyleName);
 public:
                                         ScMyTables(ScXMLImport& rImport);
                                         ~ScMyTables();
commit fbc8aa7f49abc4481fb8f74856eb6b5b298a36a7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Nov 4 04:28:44 2011 +0100

     remove unused methods from ScDocument and ScTable

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 582901c..5c81151 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -720,9 +720,6 @@ public:
     void            SetChartRangeList( const String& rChartName,
                         const ScRangeListRef& rNewRangeListRef );
 
-    sal_Bool            HasControl( SCTAB nTab, const Rectangle& rMMRect );
-    void            InvalidateControls( Window* pWin, SCTAB nTab, const Rectangle& rMMRect );
-
     void            StartAnimations( SCTAB nTab, Window* pWin );
 
     sal_Bool            HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect );
@@ -1546,7 +1543,6 @@ public:
     sal_Bool            GetNoSetDirty() const { return bNoSetDirty; }
     void            SetInsertingFromOtherDoc( sal_Bool bVal ) { bInsertingFromOtherDoc = bVal; }
     sal_Bool            IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; }
-    bool            IsLoadingMedium() const;
     void            SetLoadingMedium( bool bVal );
     void            SetImportingXML( bool bVal );
     bool            IsImportingXML() const { return bImportingXML; }
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 9cd3c57..0a7cbff 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -479,8 +479,6 @@ public:
     void        UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress* pProgress );
     void        UpdateCompile( bool bForceIfNameInUse = false );
     void        SetTabNo(SCTAB nNewTab);
-    bool        IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-                                 sal_uInt16 nIndex) const;
     void        FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                  std::set<sal_uInt16>& rIndexes) const;
     void        ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
@@ -673,7 +671,6 @@ public:
     void        ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
     void        DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
 
-    void        SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags );
     void        SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
     void        SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
 
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 87115e4..b3c25e3 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -531,66 +531,6 @@ void ScDocument::Clear( sal_Bool bFromDestructor )
     }
 }
 
-sal_Bool ScDocument::HasControl( SCTAB nTab, const Rectangle& rMMRect )
-{
-    sal_Bool bFound = false;
-
-    if (pDrawLayer)
-    {
-        SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
-        OSL_ENSURE(pPage,"Page ?");
-        if (pPage)
-        {
-            SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
-            SdrObject* pObject = aIter.Next();
-            while (pObject && !bFound)
-            {
-                if (pObject->ISA(SdrUnoObj))
-                {
-                    Rectangle aObjRect = pObject->GetLogicRect();
-                    if ( aObjRect.IsOver( rMMRect ) )
-                        bFound = sal_True;
-                }
-
-                pObject = aIter.Next();
-            }
-        }
-    }
-
-    return bFound;
-}
-
-void ScDocument::InvalidateControls( Window* pWin, SCTAB nTab, const Rectangle& rMMRect )
-{
-    if (pDrawLayer)
-    {
-        SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
-        OSL_ENSURE(pPage,"Page ?");
-        if (pPage)
-        {
-            SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
-            SdrObject* pObject = aIter.Next();
-            while (pObject)
-            {
-                if (pObject->ISA(SdrUnoObj))
-                {
-                    Rectangle aObjRect = pObject->GetLogicRect();
-                    if ( aObjRect.IsOver( rMMRect ) )
-                    {
-                        //  Uno-Controls zeichnen sich immer komplett, ohne Ruecksicht
-                        //  auf ClippingRegions. Darum muss das ganze Objekt neu gepainted
-                        //  werden, damit die Selektion auf der Tabelle nicht uebermalt wird.
-
-                        pWin->Invalidate( aObjRect );
-                    }
-                }
-
-                pObject = aIter.Next();
-            }
-        }
-    }
-}
-
 sal_Bool ScDocument::HasDetectiveObjects(SCTAB nTab) const
 {
     //  looks for detective objects, annotations don't count
@@ -661,11 +601,6 @@ void ScDocument::UpdateFontCharSet()
     }
 }
 
-bool ScDocument::IsLoadingMedium() const
-{
-    return bLoadingMedium;
-}
-
 void ScDocument::SetLoadingMedium( bool bVal )
 {
     bLoadingMedium = bVal;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 941ca36..0505da7 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1490,15 +1490,6 @@ void ScTable::SetTabNo(SCTAB nNewTab)
     for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].SetTabNo(nNewTab);
 }
 
-bool ScTable::IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
-                               sal_uInt16 nIndex) const
-{
-    bool bInUse = false;
-    for (SCCOL i = nCol1; !bInUse && (i <= nCol2) && (ValidCol(i)); i++)
-        bInUse = aCol[i].IsRangeNameInUse(nRow1, nRow2, nIndex);
-    return bInUse;
-}
-
 void ScTable::FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                std::set<sal_uInt16>& rIndexes) const
 {
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 6b18359..d16d990 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2664,17 +2664,6 @@ bool ScTable::IsDataFiltered() const
 }
 
 
-void ScTable::SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags )
-{
-    if (VALIDCOL(nCol) && pColFlags)
-        pColFlags[nCol] = nNewFlags;
-    else
-    {
-        OSL_FAIL("Falsche Spaltennummer oder keine Flags");
-    }
-}
-
-
 void ScTable::SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags )
 {
     if (VALIDROW(nRow) && pRowFlags)
diff --git a/unusedcode.easy b/unusedcode.easy
index ce45052..c041ca0 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -444,8 +444,6 @@ ScSubTotalDescriptorBase::PutData(ScSubTotalParam const&)
 ScTabPageSortFields::GetRanges()
 ScTabPageSortOptions::GetRanges()
 ScTabViewShell::LinkStubHtmlOptionsHdl(void*, void*)
-ScTable::IsRangeNameInUse(short, int, short, int, unsigned short) const
-ScTable::SetColFlags(short, unsigned char)
 ScTpCalcOptions::GetRanges()
 ScTpPrintOptions::GetRanges()
 ScTpSubTotalGroup::GetRanges()


More information about the Libreoffice-commits mailing list