[PATCH 4/9] removing dead code in calc docshell

pjacquod pjacquod at alumni.ethz.ch
Sat Nov 20 12:25:42 PST 2010


---
 sc/source/ui/docshell/docfunc.cxx        |    7 -----
 sc/source/ui/docshell/docsh2.cxx         |   33 ------------------------
 sc/source/ui/docshell/docsh4.cxx         |   24 ------------------
 sc/source/ui/docshell/externalrefmgr.cxx |   40 ------------------------------
 sc/source/ui/docshell/tablink.cxx        |    4 ---
 5 files changed, 0 insertions(+), 108 deletions(-)

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index dd450e4..555a4da 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -3745,13 +3745,6 @@ BOOL ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
 
         if (bSize)
         {
-/*			SCCOL nCols[2];
-            nCols[0] = nStartCol;
-            nCols[1] = nEndCol;
-            SCROW nRows[2];
-            nRows[0] = nStartRow;
-            nRows[1] = nEndRow;
-*/
             SCCOLROW nCols[2] = { nStartCol, nEndCol };
             SCCOLROW nRows[2] = { nStartRow, nEndRow };
 
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 8686cc7..03ed2e6 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -57,11 +57,6 @@
 #include <sfx2/app.hxx>
 
 // INCLUDE ---------------------------------------------------------------
-/*
-#include <svdrwetc.hxx>
-#include <svdrwobx.hxx>
-#include <sostor.hxx>
-*/
 #include "drwlayer.hxx"
 #include "stlpool.hxx"
 #include "docsh.hxx"
@@ -103,27 +98,6 @@ BOOL __EXPORT ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xSt
 
     InitItems();
     CalcOutputFactor();
-#if 0
-    uno::Any aGlobs;
-        uno::Sequence< uno::Any > aArgs(1);
-        aArgs[ 0 ] <<= GetModel();
-    aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
-    GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
-        // Fake ThisComponent being setup by Activate ( which is a view 
-        // related thing ), 
-        //  a) if another document is opened then in theory  ThisComponent
-        //     will be reset as before, 
-        //  b) when this document is  'really' Activated then ThisComponent
-        //     again will be set as before
-        // The only wrinkle seems if this document is loaded 'InVisible'
-        // but.. I don't see that this is possible from the vba API 
-        // I could be wrong though
-        // There may be implications setting the current component
-        // too early :-/ so I will just manually set the Basic Variables
-        BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
-        if ( pAppMgr )
-            pAppMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[ 0 ] );
-#endif
 
     return bRet;
 }
@@ -147,13 +121,8 @@ void ScDocShell::InitItems()
 {
     // AllItemSet fuer Controller mit benoetigten Items fuellen:
 
-    // if ( pImpl->pFontList )
-    //  delete pImpl->pFontList;
-
     //	Druck-Optionen werden beim Drucken und evtl. in GetPrinter gesetzt
 
-    // pImpl->pFontList = new FontList( GetPrinter(), Application::GetDefaultDevice() );
-    //PutItem( SvxFontListItem( pImpl->pFontList, SID_ATTR_CHAR_FONTLIST ) );
     UpdateFontList();
 
     ScDrawLayer* pDrawLayer = aDocument.GetDrawLayer();
@@ -170,7 +139,6 @@ void ScDocShell::InitItems()
 
         pDrawLayer->SetNotifyUndoActionHdl( LINK( pDocFunc, ScDocFunc, NotifyDrawUndo ) );
 
-        //if (SfxObjectShell::HasSbxObject())
         pDrawLayer->UpdateBasic();			// DocShell-Basic in DrawPages setzen
     }
     else
@@ -200,7 +168,6 @@ void ScDocShell::InitItems()
                     i18n::ForbiddenCharacters aForbidden;
                     aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine );
                     LanguageType eLang = SvxLocaleToLanguage(pLocales[i]);
-                    //pDoc->SetForbiddenCharacters( eLang, aForbidden );
 
                     xForbiddenTable->SetForbiddenCharacters( eLang, aForbidden );
                 }
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index f2bbb52..0814c05 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -309,7 +309,6 @@ void ScDocShell::Execute( SfxRequest& rReq )
             if (pReqArgs)
             {
                 ScDocument* pDoc = GetDocument();
-//                BOOL bUndo (pDoc->IsUndoEnabled());
                 const	SfxPoolItem* pItem;
                 String	aChartName, aRangeName;
 
@@ -459,7 +458,6 @@ void ScDocShell::Execute( SfxRequest& rReq )
                 if (pBindings)
                 {
                     pBindings->Invalidate( FID_AUTO_CALC );
-//					pBindings->Invalidate( FID_RECALC );		// jetzt immer enabled
                 }
                 rReq.AppendItem( SfxBoolItem( FID_AUTO_CALC, bNewVal ) );
                 rReq.Done();
@@ -2127,22 +2125,6 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog,
                     delete pDrawView;
                 }
             }
-
-#if 0
-            if ( n+1 < nCollateCopies &&
-                 (pPrinter->GetDuplexMode() == DUPLEX_SHORTEDGE || pPrinter->GetDuplexMode() == DUPLEX_LONGEDGE) &&
-                 ( nPrinted % 2 ) == 1 )
-            {
-                // #105584# when several collated copies are printed in duplex mode, and there is
-                // an odd number of pages, print an empty page between copies, so the first page of
-                // the second copy isn't printed on the back of the last page of the first copy.
-                // (same as in Writer ViewShell::Prt)
-                
-                // FIXME: needs to be adapted to XRenderable interface
-                pPrinter->StartPage();
-                pPrinter->EndPage();
-            }
-#endif
         }
     }
 
@@ -2223,10 +2205,6 @@ void ScDocShell::GetState( SfxItemSet &rSet )
             //	Wenn eine Formel editiert wird, muss FID_RECALC auf jeden Fall enabled sein.
             //	Recalc fuer das Doc war mal wegen #29898# disabled, wenn AutoCalc an war,
             //	ist jetzt wegen #41540# aber auch immer enabled.
-//			case FID_RECALC:
-//				if ( aDocument.GetAutoCalc() )
-//					rSet.DisableItem( nWhich );
-//				break;
 
             case SID_TABLES_COUNT:
                 rSet.Put( SfxInt16Item( nWhich, aDocument.GetTableCount() ) );
@@ -2276,7 +2254,6 @@ void ScDocShell::GetSbxState( SfxItemSet &rSet )
 
 void __EXPORT ScDocShell::Draw( OutputDevice* pDev, const JobSetup & /* rSetup */, USHORT nAspect )
 {
-//	bIsOle = TRUE;		// jetzt ueber den CreateMode
 
     SCTAB nVisTab = aDocument.GetVisibleTab();
     if (!aDocument.HasTable(nVisTab))
@@ -2319,7 +2296,6 @@ Rectangle __EXPORT ScDocShell::GetVisArea( USHORT nAspect ) const
 
     if( nAspect == ASPECT_THUMBNAIL )
     {
-//		Rectangle aArea( 0,0, 3175,3175 );							//	120x120 Pixel in 1:1
         Rectangle aArea( 0,0, SC_PREVIEW_SIZE_X,SC_PREVIEW_SIZE_Y );
         BOOL bNegativePage = aDocument.IsNegativePage( aDocument.GetVisibleTab() );
         if ( bNegativePage )
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index e1a9f37..5ca9b32 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -587,41 +587,6 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
         ScMatrixRef xMat = new ScMatrix(
             static_cast<SCSIZE>(nDataCol2-nDataCol1+1), static_cast<SCSIZE>(nDataRow2-nDataRow1+1));
 
-#if 0
-        // TODO: Switch to this code block once we have support for sparsely-filled
-        // matrices in ScMatrix.
-
-        // Only fill non-empty cells, for better performance.
-        vector<SCROW> aRows;
-        pTab->getAllRows(aRows, nDataRow1, nDataRow2);
-        for (vector<SCROW>::const_iterator itr = aRows.begin(), itrEnd = aRows.end(); itr != itrEnd; ++itr)
-        {
-            SCROW nRow = *itr;
-            vector<SCCOL> aCols;
-            pTab->getAllCols(nRow, aCols, nDataCol1, nDataCol2);
-            for (vector<SCCOL>::const_iterator itrCol = aCols.begin(), itrColEnd = aCols.end(); itrCol != itrColEnd; ++itrCol)
-            {
-                SCCOL nCol = *itrCol;
-                TokenRef pToken = pTab->getCell(nCol, nRow);
-                if (!pToken)
-                    // This should never happen!
-                    return TokenArrayRef();
-
-                SCSIZE nC = nCol - nDataCol1, nR = nRow - nDataRow1;
-                switch (pToken->GetType())
-                {
-                    case svDouble:
-                        xMat->PutDouble(pToken->GetDouble(), nC, nR);
-                    break;
-                    case svString:
-                        xMat->PutString(pToken->GetString(), nC, nR);
-                    break;
-                    default:
-                        ;
-                }
-            }
-        }
-#else
         vector<SCROW> aRows;
         pTab->getAllRows(aRows, nDataRow1, nDataRow2);
         if (aRows.empty())
@@ -654,7 +619,6 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
                 }
             }
         }
-#endif
 
         if (!bFirstTab)
             pArray->AddOpCode(ocSep);
@@ -1323,20 +1287,17 @@ static FormulaToken* lcl_convertToToken(ScBaseCell* pCell)
             static_cast<ScEditCell*>(pCell)->GetString(aStr);
             return new formula::FormulaStringToken(aStr);
         }
-        //break;
         case CELLTYPE_STRING:
         {
             String aStr;
             static_cast<ScStringCell*>(pCell)->GetString(aStr);
             return new formula::FormulaStringToken(aStr);
         }
-        //break;
         case CELLTYPE_VALUE:
         {
             double fVal = static_cast<ScValueCell*>(pCell)->GetValue();
             return new formula::FormulaDoubleToken(fVal);
         }
-        //break;
         case CELLTYPE_FORMULA:
         {
             ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
@@ -1355,7 +1316,6 @@ static FormulaToken* lcl_convertToToken(ScBaseCell* pCell)
                 return new formula::FormulaStringToken(aStr);
             }
         }
-        //break;
         default:
             DBG_ERROR("attempted to convert an unknown cell type.");
     }
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 65f3119..a656ee0 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -404,7 +404,6 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
 
     //	aufraeumen
 
-//	pSrcShell->DoClose();
     aRef->DoClose();
 
     //	Undo
@@ -577,9 +576,6 @@ ScDocumentLoader::ScDocumentLoader( const String& rFileName,
 
 ScDocumentLoader::~ScDocumentLoader()
 {
-/*  if ( pDocShell )
-        pDocShell->DoClose();
-*/
     if ( aRef.Is() )
         aRef->DoClose();
     else if ( pMedium )
-- 
1.7.1


--------------070903000307090300090306
Content-Type: text/x-patch;
 name="0005-dead-code-removed-in-calc-ui-pagedlg.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0005-dead-code-removed-in-calc-ui-pagedlg.patch"



More information about the LibreOffice mailing list