[Libreoffice-commits] .: Branch 'feature/tubes' - sc/qa sc/source

Michael Meeks michael at kemper.freedesktop.org
Tue Mar 20 05:02:33 PDT 2012


 sc/qa/unit/ucalc.cxx                              |    3 
 sc/source/ui/Accessibility/AccessibleCellBase.cxx |    4 
 sc/source/ui/app/inputwin.cxx                     |    3 
 sc/source/ui/inc/viewdata.hxx                     |    2 
 sc/source/ui/miscdlgs/optsolver.cxx               |    8 
 sc/source/ui/namedlg/namedlg.cxx                  |    5 
 sc/source/ui/undo/undoblk.cxx                     |    3 
 sc/source/ui/unoobj/cellsuno.cxx                  |  196 +++++++---------------
 sc/source/ui/unoobj/docuno.cxx                    |   94 +++-------
 sc/source/ui/unoobj/linkuno.cxx                   |   13 -
 sc/source/ui/unoobj/nameuno.cxx                   |   19 --
 sc/source/ui/unoobj/textuno.cxx                   |    5 
 sc/source/ui/vba/vbarange.cxx                     |   18 --
 sc/source/ui/view/cellsh1.cxx                     |    5 
 sc/source/ui/view/preview.cxx                     |    5 
 sc/source/ui/view/tabvwshf.cxx                    |    6 
 sc/source/ui/view/viewdata.cxx                    |    5 
 sc/source/ui/view/viewfunc.cxx                    |   16 -
 18 files changed, 155 insertions(+), 255 deletions(-)

New commits:
commit 8efc51671b58f9aeb69baf7bee390f177c865290
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Tue Mar 20 11:58:54 2012 +0000

    Don't instantiate ScDocFunc objects, get them from the doc-shell

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 5324601..e506c44 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3347,11 +3347,10 @@ void Test::testMergedCells()
     SCROW nEndRow = 1;
     m_pDoc->ExtendMerge( 1, 1, nEndCol, nEndRow, 0, false);
     CPPUNIT_ASSERT_MESSAGE("did not merge cells", nEndCol == 3 && nEndRow == 3);
-    ScDocFunc aDocFunc(*m_xDocShRef);
     ScRange aRange(0,2,0,MAXCOL,2,0);
     ScMarkData aMark;
     aMark.SetMarkArea(aRange);
-    aDocFunc.InsertCells(aRange, &aMark, INS_INSROWS, true, true);
+    m_xDocShRef->GetDocFunc().InsertCells(aRange, &aMark, INS_INSROWS, true, true);
     m_pDoc->ExtendMerge( 1, 1, nEndCol, nEndRow, 0, false);
     cout << nEndRow << nEndCol;
     //ScEditableTester won't work without an SfxMedium/XStorage
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index 37b92e8..01660ff 100644
--- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -34,6 +34,7 @@
 #include "miscuno.hxx"
 #include "document.hxx"
 #include "docfunc.hxx"
+#include "docsh.hxx"
 #include "cell.hxx"
 #include "scresid.hxx"
 #include "sc.hrc"
@@ -269,8 +270,7 @@ sal_Bool SAL_CALL
         if (IsEditable(xParentStates))
         {
             ScDocShell* pDocShell = (ScDocShell*) mpDoc->GetDocumentShell();
-            ScDocFunc aFunc(*pDocShell);
-            bResult = aFunc.PutCell( maCellAddress, new ScValueCell(fValue), sal_True );
+            bResult = pDocShell->GetDocFunc().PutCell( maCellAddress, new ScValueCell(fValue), sal_True );
         }
     }
     return bResult;
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index c60b6ff..f0fb7a8 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -2397,8 +2397,7 @@ void ScPosWnd::DoEnter()
                         ScRangeData* pNew = new ScRangeData( pDoc, aText, aContent, aCursor );
                         if ( aNewRanges.insert(pNew) )
                         {
-                            ScDocFunc aFunc(*pDocShell);
-                            aFunc.ModifyRangeNames( aNewRanges );
+                            pDocShell->GetDocFunc().ModifyRangeNames( aNewRanges );
                             pViewSh->UpdateInputHandler(true);
                         }
                     }
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index f2ba7d5..6ae8da2 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -94,6 +94,7 @@ enum ScPasteFlags
     SC_PASTE_BORDER = 2,    // Show a border around the source cells
 };
 
+class ScDocFunc;
 class ScDocShell;
 class ScDocument;
 class ScDBFunc;
@@ -246,6 +247,7 @@ public:
     void            InitData( ScDocument* pDocument );
 
     ScDocShell*     GetDocShell() const     { return pDocShell; }
+    ScDocFunc&      GetDocFunc() const;
     ScDBFunc*       GetView() const         { return pView; }
     ScTabViewShell* GetViewShell() const    { return pViewShell; }
 
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx
index fb34d85..d81881d 100644
--- a/sc/source/ui/miscdlgs/optsolver.cxx
+++ b/sc/source/ui/miscdlgs/optsolver.cxx
@@ -1026,12 +1026,12 @@ bool ScOptSolverDlg::CallSolver()       // return true -> close dialog after cal
         if ( aSolution.getLength() == nVarCount )
         {
             mpDocShell->LockPaint();
-            ScDocFunc aFunc(*mpDocShell);
+            ScDocFunc &rFunc = mpDocShell->GetDocFunc();
             for (nVarPos=0; nVarPos<nVarCount; ++nVarPos)
             {
                 ScAddress aCellPos;
                 ScUnoConversion::FillScAddress( aCellPos, aVariables[nVarPos] );
-                aFunc.PutCell( aCellPos, new ScValueCell( aSolution[nVarPos] ), sal_True );
+                rFunc.PutCell( aCellPos, new ScValueCell( aSolution[nVarPos] ), sal_True );
             }
             mpDocShell->UnlockPaint();
         }
@@ -1061,12 +1061,12 @@ bool ScOptSolverDlg::CallSolver()       // return true -> close dialog after cal
     if ( bRestore )         // restore old values
     {
         mpDocShell->LockPaint();
-        ScDocFunc aFunc(*mpDocShell);
+        ScDocFunc &rFunc = mpDocShell->GetDocFunc();
         for (nVarPos=0; nVarPos<nVarCount; ++nVarPos)
         {
             ScAddress aCellPos;
             ScUnoConversion::FillScAddress( aCellPos, aVariables[nVarPos] );
-            aFunc.PutCell( aCellPos, new ScValueCell( aOldValues[nVarPos] ), sal_True );
+            rFunc.PutCell( aCellPos, new ScValueCell( aOldValues[nVarPos] ), sal_True );
         }
         mpDocShell->UnlockPaint();
     }
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 72d95ba..40cf4fd 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -212,10 +212,7 @@ void ScNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
 sal_Bool ScNameDlg::Close()
 {
     if (mbDataChanged && !mbCloseWithoutUndo)
-    {
-        ScDocFunc aFunc(*mpViewData->GetDocShell());
-        aFunc.ModifyAllRangeNames(maRangeMap);
-    }
+        mpViewData->GetDocFunc().ModifyAllRangeNames(maRangeMap);
     return DoClose( ScNameDlgWrapper::GetChildWindowId() );
 }
 
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 2cd5a49..67a36c0 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1983,8 +1983,7 @@ void ScUndoClearItems::Repeat(SfxRepeatTarget& rTarget)
     if (rTarget.ISA(ScTabViewTarget))
     {
         ScViewData* pViewData = ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData();
-        ScDocFunc aFunc(*pViewData->GetDocShell());
-        aFunc.ClearItems( pViewData->GetMarkData(), pWhich, false );
+        pViewData->GetDocFunc().ClearItems( pViewData->GetMarkData(), pWhich, false );
     }
 }
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index c82e56a..24c31e8 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1313,8 +1313,6 @@ sal_Bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
 
     pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
 
-    ScDocFunc aFunc( rDocShell );       // for InterpretEnglishString
-
     sal_Bool bError = false;
     SCROW nDocRow = nStartRow;
     for (long nRow=0; nRow<nRows; nRow++)
@@ -1328,7 +1326,8 @@ sal_Bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
             {
                 String aText(pColArr[nCol]);
                 ScAddress aPos( nDocCol, nDocRow, nTab );
-                ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aPos, aText, rFormulaNmsp, eGrammar );
+                ScBaseCell* pNewCell = rDocShell.GetDocFunc().InterpretEnglishString(
+                                                aPos, aText, rFormulaNmsp, eGrammar );
                 pDoc->PutCell( aPos, pNewCell );
 
                 ++nDocCol;
@@ -1869,8 +1868,7 @@ void SAL_CALL ScCellRangesBase::clearContents( sal_Int32 nContentFlags ) throw(u
         if ( ( nContentFlags & IDF_EDITATTR ) && ( nContentFlags & IDF_CONTENTS ) == 0 )
             nDelFlags |= IDF_EDITATTR;
 
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.DeleteContents( *GetMarkData(), nDelFlags, sal_True, sal_True );
+        pDocShell->GetDocFunc().DeleteContents( *GetMarkData(), nDelFlags, sal_True, sal_True );
     }
     // sonst ist nichts zu tun
 }
@@ -2009,23 +2007,20 @@ void SAL_CALL ScCellRangesBase::setPropertyToDefault( const rtl::OUString& aProp
         {
             if ( !aRanges.empty() )     // leer = nichts zu tun
             {
-                ScDocFunc aFunc(*pDocShell);
-
                 //! Bei Items, die mehrere Properties enthalten (z.B. Hintergrund)
                 //! wird hier zuviel zurueckgesetzt
-
-//               //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
+                //! for ATTR_ROTATE_VALUE, also reset ATTR_ORIENTATION?
 
                 sal_uInt16 aWIDs[3];
                 aWIDs[0] = nItemWhich;
                 if ( nItemWhich == ATTR_VALUE_FORMAT )
                 {
-                    aWIDs[1] = ATTR_LANGUAGE_FORMAT;    // language for number formats
+                    aWIDs[1] = ATTR_LANGUAGE_FORMAT; // language for number formats
                     aWIDs[2] = 0;
                 }
                 else
                     aWIDs[1] = 0;
-                aFunc.ClearItems( *GetMarkData(), aWIDs, sal_True );
+                pDocShell->GetDocFunc().ClearItems( *GetMarkData(), aWIDs, sal_True );
             }
         }
         else if ( pEntry )
@@ -2036,8 +2031,8 @@ void SAL_CALL ScCellRangesBase::setPropertyToDefault( const rtl::OUString& aProp
                 bChartRowAsHdr = false;
             else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
             {
-                ScDocFunc aFunc(*pDocShell);
-                aFunc.ApplyStyle( *GetMarkData(), ScGlobal::GetRscString(STR_STYLENAME_STANDARD), sal_True, sal_True );
+                String aStyleName( ScGlobal::GetRscString( STR_STYLENAME_STANDARD ) );
+                pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aStyleName, sal_True, sal_True );
             }
         }
     }
@@ -2299,7 +2294,6 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
             if ( !aRanges.empty() )     // leer = nichts zu tun
             {
                 ScDocument* pDoc = pDocShell->GetDocument();
-                ScDocFunc aFunc(*pDocShell);
 
                 //  Fuer Teile von zusammengesetzten Items mit mehreren Properties (z.B. Hintergrund)
                 //  muss vorher das alte Item aus dem Dokument geholt werden
@@ -2319,7 +2313,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                     if ( nWhich != nFirstItem && nWhich != nSecondItem )
                         rSet.ClearItem(nWhich);
 
-                aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
+                pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
             }
         }
         else        // implemented here
@@ -2372,8 +2366,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                         aValue >>= aStrVal;
                         String aString(ScStyleNameConversion::ProgrammaticToDisplayName(
                                                             aStrVal, SFX_STYLE_FAMILY_PARA ));
-                        ScDocFunc aFunc(*pDocShell);
-                        aFunc.ApplyStyle( *GetMarkData(), aString, sal_True, sal_True );
+                        pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aString, sal_True, sal_True );
                     }
                     break;
                 case SC_WID_UNO_TBLBORD:
@@ -2426,11 +2419,9 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                                 aNew.AddRangeInfo( pRanges );
                                 sal_uLong nIndex = pDoc->AddCondFormat( aNew );
 
-                                ScDocFunc aFunc(*pDocShell);
-
                                 ScPatternAttr aPattern( pDoc->GetPool() );
                                 aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
-                                aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
+                                pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
                             }
                         }
                     }
@@ -2458,11 +2449,9 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                                 sal_uLong nIndex = pDoc->AddValidationEntry( *pNewData );
                                 delete pNewData;
 
-                                ScDocFunc aFunc(*pDocShell);
-
                                 ScPatternAttr aPattern( pDoc->GetPool() );
                                 aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
-                                aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
+                                pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
                             }
                         }
                     }
@@ -2759,10 +2748,7 @@ void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< rtl::OUS
         }
 
         if ( pNewPattern && !aRanges.empty() )
-        {
-            ScDocFunc aFunc(*pDocShell);
-            aFunc.ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
-        }
+            pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
 
         delete pNewPattern;
         delete pOldPattern;
@@ -2934,10 +2920,7 @@ uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::set
         }
 
         if ( pNewPattern && !aRanges.empty() )
-        {
-            ScDocFunc aFunc(*pDocShell);
-            aFunc.ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
-        }
+            pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, sal_True, sal_True );
 
         delete pNewPattern;
         delete pOldPattern;
@@ -3025,11 +3008,10 @@ void SAL_CALL ScCellRangesBase::decrementIndent() throw(::com::sun::star::uno::R
     SolarMutexGuard aGuard;
     if ( pDocShell && !aRanges.empty() )        // leer = nichts zu tun
     {
-        ScDocFunc aFunc(*pDocShell);
         //#97041#; put only MultiMarked ScMarkData in ChangeIndent
         ScMarkData aMarkData(*GetMarkData());
         aMarkData.MarkToMulti();
-        aFunc.ChangeIndent( aMarkData, false, sal_True );
+        pDocShell->GetDocFunc().ChangeIndent( aMarkData, false, sal_True );
     }
 }
 
@@ -3038,11 +3020,10 @@ void SAL_CALL ScCellRangesBase::incrementIndent() throw(::com::sun::star::uno::R
     SolarMutexGuard aGuard;
     if ( pDocShell && !aRanges.empty() )        // leer = nichts zu tun
     {
-        ScDocFunc aFunc(*pDocShell);
         //#97041#; put only MultiMarked ScMarkData in ChangeIndent
         ScMarkData aMarkData(*GetMarkData());
         aMarkData.MarkToMulti();
-        aFunc.ChangeIndent( aMarkData, sal_True, sal_True );
+        pDocShell->GetDocFunc().ChangeIndent( aMarkData, sal_True, sal_True );
     }
 }
 
@@ -5157,7 +5138,6 @@ void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& rFormula,
     ScDocShell* pDocSh = GetDocShell();
     if (pDocSh)
     {
-        ScDocFunc aFunc(*pDocSh);
         if ( !rFormula.isEmpty() )
         {
             if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
@@ -5166,7 +5146,7 @@ void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& rFormula,
                 throw uno::RuntimeException();
             }
 
-            aFunc.EnterMatrix( aRange, NULL, NULL, rFormula, sal_True, sal_True, rFormulaNmsp, eGrammar );
+            pDocSh->GetDocFunc().EnterMatrix( aRange, NULL, NULL, rFormula, sal_True, sal_True, rFormulaNmsp, eGrammar );
         }
         else
         {
@@ -5174,7 +5154,7 @@ void ScCellRangeObj::SetArrayFormula_Impl( const rtl::OUString& rFormula,
             ScMarkData aMark;
             aMark.SetMarkArea( aRange );
             aMark.SelectTable( aRange.aStart.Tab(), sal_True );
-            aFunc.DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
+            pDocSh->GetDocFunc().DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
         }
     }
 }
@@ -5236,7 +5216,6 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
     ScDocShell* pDocSh = GetDocShell();
     if ( pDocSh )
     {
-        ScDocFunc aFunc(*pDocSh);
         if ( rTokens.getLength() )
         {
             if ( ScTableSheetObj::getImplementation( (cppu::OWeakObject*)this ) )
@@ -5251,7 +5230,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
             // Actually GRAM_PODF_A1 is a don't-care here because of the token
             // array being set, it fits with other API compatibility grammars
             // though.
-            aFunc.EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, sal_True, sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
+            pDocSh->GetDocFunc().EnterMatrix( aRange, NULL, &aTokenArray, EMPTY_STRING, sal_True, sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
         }
         else
         {
@@ -5259,7 +5238,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula
             ScMarkData aMark;
             aMark.SetMarkArea( aRange );
             aMark.SelectTable( aRange.aStart.Tab(), sal_True );
-            aFunc.DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
+            pDocSh->GetDocFunc().DeleteContents( aMark, IDF_CONTENTS, sal_True, sal_True );
         }
     }
 }
@@ -5416,10 +5395,7 @@ void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress&
         }
 
         if (!bError)
-        {
-            ScDocFunc aFunc(*pDocSh);
-            aFunc.TabOp( aRange, NULL, aParam, sal_True, sal_True );
-        }
+            pDocSh->GetDocFunc().TabOp( aRange, NULL, aParam, sal_True, sal_True );
     }
 }
 
@@ -5431,15 +5407,14 @@ void SAL_CALL ScCellRangeObj::merge( sal_Bool bMerge ) throw(uno::RuntimeExcepti
     ScDocShell* pDocSh = GetDocShell();
     if ( pDocSh )
     {
-        ScDocFunc aFunc(*pDocSh);
         ScCellMergeOption aMergeOption(
             aRange.aStart.Col(), aRange.aStart.Row(),
             aRange.aEnd.Col(), aRange.aEnd.Row(), false);
         aMergeOption.maTabs.insert(aRange.aStart.Tab());
         if ( bMerge )
-            aFunc.MergeCells( aMergeOption, false, true, true );
+            pDocSh->GetDocFunc().MergeCells( aMergeOption, false, true, true );
         else
-            aFunc.UnmergeCells( aMergeOption, true, true );
+            pDocSh->GetDocFunc().UnmergeCells( aMergeOption, true, true );
 
         //! Fehler abfangen?
     }
@@ -5525,11 +5500,8 @@ void SAL_CALL ScCellRangeObj::fillSeries( sheet::FillDirection nFillDirection,
         }
 
         if (!bError)
-        {
-            ScDocFunc aFunc(*pDocSh);
-            aFunc.FillSeries( aRange, NULL, eDir, eCmd, eDateCmd,
-                                MAXDOUBLE, fStep, fEndValue, sal_True, sal_True );
-        }
+            pDocSh->GetDocFunc().FillSeries( aRange, NULL, eDir, eCmd, eDateCmd,
+                                                MAXDOUBLE, fStep, fEndValue, sal_True, sal_True );
     }
 }
 
@@ -5573,10 +5545,7 @@ void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
             bError = sal_True;
 
         if (!bError)
-        {
-            ScDocFunc aFunc(*pDocSh);
-            aFunc.FillAuto( aSourceRange, NULL, eDir, nCount, sal_True, sal_True );
-        }
+            pDocSh->GetDocFunc().FillAuto( aSourceRange, NULL, eDir, nCount, sal_True, sal_True );
     }
 }
 
@@ -5595,8 +5564,7 @@ void SAL_CALL ScCellRangeObj::autoFormat( const rtl::OUString& aName )
         {
             ScAutoFormat::const_iterator itBeg = pAutoFormat->begin();
             size_t nIndex = std::distance(itBeg, it);
-            ScDocFunc aFunc(*pDocSh);
-            aFunc.AutoFormat(aRange, NULL, nIndex, true, true);
+            pDocSh->GetDocFunc().AutoFormat(aRange, NULL, nIndex, true, true);
         }
         else
             throw lang::IllegalArgumentException();
@@ -5676,7 +5644,7 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a
 
         pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK );       // ggf. Bereich anlegen
 
-        ScDBDocFunc aFunc(*pDocSh);                         // Bereich muss angelegt sein
+        ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein
         aFunc.Sort( nTab, aParam, sal_True, sal_True, sal_True );
     }
 }
@@ -6306,9 +6274,9 @@ void ScCellObj::SetString_Impl(const String& rString, sal_Bool bInterpret, sal_B
     ScDocShell* pDocSh = GetDocShell();
     if ( pDocSh )
     {
-        ScDocFunc aFunc(*pDocSh);
         // GRAM_PODF_A1 for API compatibility.
-        (void)aFunc.SetCellText( aCellPos, rString, bInterpret, bEnglish, sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
+        (void)pDocSh->GetDocFunc().SetCellText( aCellPos, rString, bInterpret, bEnglish,
+                                                   sal_True, EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1 );
     }
 }
 
@@ -6325,10 +6293,7 @@ void ScCellObj::SetValue_Impl(double fValue)
 {
     ScDocShell* pDocSh = GetDocShell();
     if ( pDocSh )
-    {
-        ScDocFunc aFunc(*pDocSh);
-        (void)aFunc.PutCell( aCellPos, new ScValueCell(fValue), sal_True );
-    }
+        (void)pDocSh->GetDocFunc().PutCell( aCellPos, new ScValueCell(fValue), sal_True );
 }
 
 // only for XML import
@@ -6352,9 +6317,9 @@ void ScCellObj::InputEnglishString( const ::rtl::OUString& rText )
         }
         else
         {
-            ScDocFunc aFunc(*pDocSh);
+            ScDocFunc &rFunc = pDocSh->GetDocFunc();
             short nFormatType = 0;
-            ScBaseCell* pNewCell = aFunc.InterpretEnglishString( aCellPos, aString,
+            ScBaseCell* pNewCell = rFunc.InterpretEnglishString( aCellPos, aString,
                                     EMPTY_STRING, formula::FormulaGrammar::GRAM_PODF_A1, &nFormatType );
             if (pNewCell)
             {
@@ -6367,12 +6332,12 @@ void ScCellObj::InputEnglishString( const ::rtl::OUString& rText )
                         ScPatternAttr aPattern( pDoc->GetPool() );
                         aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
                         // ATTR_LANGUAGE_FORMAT remains unchanged
-                        aFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
+                        rFunc.ApplyAttributes( *GetMarkData(), aPattern, sal_True, sal_True );
                     }
                 }
                 // put the cell into the document
                 // (after applying the format, so possible formula recalculation already uses the new format)
-                (void)aFunc.PutCell( aCellPos, pNewCell, sal_True );
+                (void)rFunc.PutCell( aCellPos, pNewCell, sal_True );
             }
             else
                 SetString_Impl(aString, false, false);      // no cell from InterpretEnglishString, probably empty string
@@ -6586,10 +6551,9 @@ void SAL_CALL ScCellObj::setFormulaString( const rtl::OUString& aFormula) throw(
     ScDocShell *pDocSh = GetDocShell();
     if( pDocSh )
     {
-        ScDocFunc aFunc( *pDocSh );
         ScFormulaCell* pCell = new ScFormulaCell( pDocSh->GetDocument(), aCellPos );
         pCell->SetHybridFormula( aFormula, formula::FormulaGrammar::GRAM_NATIVE );
-        aFunc.PutCell( aCellPos, pCell, sal_True );
+        pDocSh->GetDocFunc().PutCell( aCellPos, pCell, sal_True );
     }
 }
 void SAL_CALL ScCellObj::setFormulaResult( double nValue ) throw(uno::RuntimeException)
@@ -6703,9 +6667,8 @@ void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rT
         ScTokenArray aTokenArray;
         (void)ScTokenConversion::ConvertToTokenArray( *pDoc, aTokenArray, rTokens );
 
-        ScDocFunc aFunc( *pDocSh );
         ScBaseCell* pNewCell = new ScFormulaCell( pDoc, aCellPos, &aTokenArray );
-        (void)aFunc.PutCell( aCellPos, pNewCell, sal_True );
+        (void)pDocSh->GetDocFunc().PutCell( aCellPos, pNewCell, sal_True );
     }
 }
 
@@ -7284,8 +7247,7 @@ void SAL_CALL ScTableSheetObj::setName( const rtl::OUString& aNewName )
     if ( pDocSh )
     {
         String aString(aNewName);
-        ScDocFunc aFunc( *pDocSh );
-        aFunc.RenameTable( GetTab_Impl(), aString, sal_True, sal_True );
+        pDocSh->GetDocFunc().RenameTable( GetTab_Impl(), aString, sal_True, sal_True );
     }
 }
 
@@ -7341,8 +7303,7 @@ void SAL_CALL ScTableSheetObj::insertCells( const table::CellRangeAddress& rRang
             OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
             ScRange aScRange;
             ScUnoConversion::FillScRange( aScRange, rRangeAddress );
-            ScDocFunc aFunc(*pDocSh);
-            aFunc.InsertCells( aScRange, NULL, eCmd, sal_True, sal_True );
+            pDocSh->GetDocFunc().InsertCells( aScRange, NULL, eCmd, sal_True, sal_True );
         }
     }
 }
@@ -7373,8 +7334,7 @@ void SAL_CALL ScTableSheetObj::removeRange( const table::CellRangeAddress& rRang
             OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "falsche Tabelle in CellRangeAddress" );
             ScRange aScRange;
             ScUnoConversion::FillScRange( aScRange, rRangeAddress );
-            ScDocFunc aFunc(*pDocSh);
-            aFunc.DeleteCells( aScRange, NULL, eCmd, sal_True, sal_True );
+            pDocSh->GetDocFunc().DeleteCells( aScRange, NULL, eCmd, sal_True, sal_True );
         }
     }
 }
@@ -7391,8 +7351,7 @@ void SAL_CALL ScTableSheetObj::moveRange( const table::CellAddress& aDestination
         ScRange aSourceRange;
         ScUnoConversion::FillScRange( aSourceRange, aSource );
         ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
-        ScDocFunc aFunc(*pDocSh);
-        aFunc.MoveBlock( aSourceRange, aDestPos, sal_True, sal_True, sal_True, sal_True );
+        pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, sal_True, sal_True, sal_True, sal_True );
     }
 }
 
@@ -7408,8 +7367,7 @@ void SAL_CALL ScTableSheetObj::copyRange( const table::CellAddress& aDestination
         ScRange aSourceRange;
         ScUnoConversion::FillScRange( aSourceRange, aSource );
         ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet );
-        ScDocFunc aFunc(*pDocSh);
-        aFunc.MoveBlock( aSourceRange, aDestPos, false, sal_True, sal_True, sal_True );
+        pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, false, sal_True, sal_True, sal_True );
     }
 }
 
@@ -7824,8 +7782,7 @@ sal_Bool SAL_CALL ScTableSheetObj::hideDependents( const table::CellAddress& aPo
         SCTAB nTab = GetTab_Impl();
         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
-        ScDocFunc aFunc(*pDocSh);
-        return aFunc.DetectiveDelSucc( aPos );
+        return pDocSh->GetDocFunc().DetectiveDelSucc( aPos );
     }
     return false;
 }
@@ -7840,8 +7797,7 @@ sal_Bool SAL_CALL ScTableSheetObj::hidePrecedents( const table::CellAddress& aPo
         SCTAB nTab = GetTab_Impl();
         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
-        ScDocFunc aFunc(*pDocSh);
-        return aFunc.DetectiveDelPred( aPos );
+        return pDocSh->GetDocFunc().DetectiveDelPred( aPos );
     }
     return false;
 }
@@ -7856,8 +7812,7 @@ sal_Bool SAL_CALL ScTableSheetObj::showDependents( const table::CellAddress& aPo
         SCTAB nTab = GetTab_Impl();
         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
-        ScDocFunc aFunc(*pDocSh);
-        return aFunc.DetectiveAddSucc( aPos );
+        return pDocSh->GetDocFunc().DetectiveAddSucc( aPos );
     }
     return false;
 }
@@ -7872,8 +7827,7 @@ sal_Bool SAL_CALL ScTableSheetObj::showPrecedents( const table::CellAddress& aPo
         SCTAB nTab = GetTab_Impl();
         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
-        ScDocFunc aFunc(*pDocSh);
-        return aFunc.DetectiveAddPred( aPos );
+        return pDocSh->GetDocFunc().DetectiveAddPred( aPos );
     }
     return false;
 }
@@ -7888,8 +7842,7 @@ sal_Bool SAL_CALL ScTableSheetObj::showErrors( const table::CellAddress& aPositi
         SCTAB nTab = GetTab_Impl();
         OSL_ENSURE( aPosition.Sheet == nTab, "falsche Tabelle in CellAddress" );
         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
-        ScDocFunc aFunc(*pDocSh);
-        return aFunc.DetectiveAddError( aPos );
+        return pDocSh->GetDocFunc().DetectiveAddError( aPos );
     }
     return false;
 }
@@ -7899,10 +7852,7 @@ sal_Bool SAL_CALL ScTableSheetObj::showInvalid() throw(uno::RuntimeException)
     SolarMutexGuard aGuard;
     ScDocShell* pDocSh = GetDocShell();
     if ( pDocSh )
-    {
-        ScDocFunc aFunc(*pDocSh);
-        return aFunc.DetectiveMarkInvalid( GetTab_Impl() );
-    }
+        return pDocSh->GetDocFunc().DetectiveMarkInvalid( GetTab_Impl() );
     return false;
 }
 
@@ -7911,10 +7861,7 @@ void SAL_CALL ScTableSheetObj::clearArrows() throw(uno::RuntimeException)
     SolarMutexGuard aGuard;
     ScDocShell* pDocSh = GetDocShell();
     if ( pDocSh )
-    {
-        ScDocFunc aFunc(*pDocSh);
-        aFunc.DetectiveDelAll( GetTab_Impl() );
-    }
+        pDocSh->GetDocFunc().DetectiveDelAll( GetTab_Impl() );
 }
 
 // XSheetOutline
@@ -8030,8 +7977,7 @@ void SAL_CALL ScTableSheetObj::protect( const rtl::OUString& aPassword )
     if ( pDocSh && !pDocSh->GetDocument()->IsTabProtected( GetTab_Impl() ) )
     {
         String aString(aPassword);
-        ScDocFunc aFunc(*pDocSh);
-        aFunc.Protect( GetTab_Impl(), aString, sal_True );
+        pDocSh->GetDocFunc().Protect( GetTab_Impl(), aString, sal_True );
     }
 }
 
@@ -8043,8 +7989,7 @@ void SAL_CALL ScTableSheetObj::unprotect( const rtl::OUString& aPassword )
     if ( pDocSh )
     {
         String aString(aPassword);
-        ScDocFunc aFunc(*pDocSh);
-        sal_Bool bDone = aFunc.Unprotect( GetTab_Impl(), aString, sal_True );
+        sal_Bool bDone = pDocSh->GetDocFunc().Unprotect( GetTab_Impl(), aString, sal_True );
         if (!bDone)
             throw lang::IllegalArgumentException();
     }
@@ -8144,8 +8089,7 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAd
             ScPatternAttr aPattern( pDoc->GetPool() );
             aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) );
             aPattern.GetItemSet().Put( ScProtectionAttr( sal_True ) );
-            ScDocFunc aFunc(*pDocSh);
-            aFunc.ApplyAttributes( aMarkData, aPattern, sal_True, sal_True );
+            pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, sal_True, sal_True );
         }
     }
 }
@@ -8270,7 +8214,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             return;                                                 //! Exception oder so?
         ScDocument* pDoc = pDocSh->GetDocument();
         SCTAB nTab = GetTab_Impl();
-        ScDocFunc aFunc(*pDocSh);
+        ScDocFunc rFunc = pDocSh->GetDocFunc();
 
         if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
         {
@@ -8304,7 +8248,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
         else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
         {
             sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
-            aFunc.SetTableVisible( nTab, bVis, sal_True );
+            rFunc.SetTableVisible( nTab, bVis, sal_True );
         }
         else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
         {
@@ -8535,9 +8479,9 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
             if (aValue >>= nValue)
             {
                 if (nValue == com::sun::star::text::WritingMode2::RL_TB)
-                    aFunc.SetLayoutRTL(nTab, sal_True, sal_True);
+                    rFunc.SetLayoutRTL(nTab, sal_True, sal_True);
                 else
-                    aFunc.SetLayoutRTL(nTab, false, sal_True);
+                    rFunc.SetLayoutRTL(nTab, false, sal_True);
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
@@ -8559,7 +8503,7 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn
                 const Color aColor(static_cast<ColorData>(nColor));
                 if (aColor != pDoc->GetTabBgColor(nTab))
                 {
-                    aFunc.SetTabBgColor(nTab, aColor, true, true);
+                    rFunc.SetTabBgColor(nTab, aColor, true, true);
                 }
             }
         }
@@ -8913,7 +8857,7 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
         OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "zuviele Spalten");
         SCCOL nCol = rRange.aStart.Col();
         SCTAB nTab = rRange.aStart.Tab();
-        ScDocFunc aFunc(*pDocSh);
+        ScDocFunc rFunc = pDocSh->GetDocFunc();
 
         SCCOLROW nColArr[2];
         nColArr[0] = nColArr[1] = nCol;
@@ -8925,7 +8869,7 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
             {
                 //  property is 1/100mm, column width is twips
                 nNewWidth = HMMToTwips(nNewWidth);
-                aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, SC_SIZE_ORIGINAL,
+                rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, SC_SIZE_ORIGINAL,
                                         (sal_uInt16)nNewWidth, sal_True, sal_True );
             }
         }
@@ -8933,14 +8877,14 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
         {
             sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
-            aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, eMode, 0, sal_True, sal_True );
+            rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, eMode, 0, sal_True, sal_True );
             //  SC_SIZE_DIRECT mit Groesse 0 blendet aus
         }
         else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
         {
             sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             if (bOpt)
-                aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab,
+                rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab,
                                         SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, sal_True, sal_True );
             // sal_False bei Spalten momentan ohne Auswirkung
         }
@@ -8948,9 +8892,9 @@ void ScTableColumnObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
         {
             sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             if (bSet)
-                aFunc.InsertPageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
+                rFunc.InsertPageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
             else
-                aFunc.RemovePageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
+                rFunc.RemovePageBreak( sal_True, rRange.aStart, sal_True, sal_True, sal_True );
         }
         else
             ScCellRangeObj::SetOnePropertyValue(pEntry, aValue);        // base class, no Item WID
@@ -9057,7 +9001,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
         OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "zuviele Zeilen");
         SCROW nRow = rRange.aStart.Row();
         SCTAB nTab = rRange.aStart.Tab();
-        ScDocFunc aFunc(*pDocSh);
+        ScDocFunc rFunc = pDocSh->GetDocFunc();
 
         SCCOLROW nRowArr[2];
         nRowArr[0] = nRowArr[1] = nRow;
@@ -9069,7 +9013,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
             {
                 //  property is 1/100mm, row height is twips
                 nNewHeight = HMMToTwips(nNewHeight);
-                aFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL,
+                rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL,
                                         (sal_uInt16)nNewHeight, sal_True, sal_True );
             }
         }
@@ -9077,7 +9021,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
         {
             sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
-            aFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
+            rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
             //  SC_SIZE_DIRECT mit Groesse 0 blendet aus
         }
         else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
@@ -9090,21 +9034,21 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr
         {
             sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             if (bOpt)
-                aFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, sal_True, sal_True );
+                rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, sal_True, sal_True );
             else
             {
                 //  set current height again manually
                 sal_uInt16 nHeight = pDoc->GetOriginalHeight( nRow, nTab );
-                aFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, sal_True, sal_True );
+                rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, sal_True, sal_True );
             }
         }
         else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
         {
             sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             if (bSet)
-                aFunc.InsertPageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
+                rFunc.InsertPageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
             else
-                aFunc.RemovePageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
+                rFunc.RemovePageBreak( false, rRange.aStart, sal_True, sal_True, sal_True );
         }
         else
             ScCellRangeObj::SetOnePropertyValue(pEntry, aValue);        // base class, no Item WID
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 823974a..f4b3c06 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1466,9 +1466,7 @@ void SAL_CALL ScModelObj::protect( const rtl::OUString& aPassword ) throw(uno::R
     if ( pDocShell && !pDocShell->GetDocument()->IsDocProtected() )
     {
         String aString(aPassword);
-
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.Protect( TABLEID_DOC, aString, sal_True );
+        pDocShell->GetDocFunc().Protect( TABLEID_DOC, aString, sal_True );
     }
 }
 
@@ -1479,9 +1477,7 @@ void SAL_CALL ScModelObj::unprotect( const rtl::OUString& aPassword )
     if (pDocShell)
     {
         String aString(aPassword);
-
-        ScDocFunc aFunc(*pDocShell);
-        sal_Bool bDone = aFunc.Unprotect( TABLEID_DOC, aString, sal_True );
+        sal_Bool bDone = pDocShell->GetDocFunc().Unprotect( TABLEID_DOC, aString, sal_True );
         if (!bDone)
             throw lang::IllegalArgumentException();
     }
@@ -1586,10 +1582,7 @@ void SAL_CALL ScModelObj::refreshArrows() throw(uno::RuntimeException)
 {
     SolarMutexGuard aGuard;
     if (pDocShell)
-    {
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.DetectiveRefresh();
-    }
+        pDocShell->GetDocFunc().DetectiveRefresh();
 }
 
 // XViewDataSupplier
@@ -2391,8 +2384,8 @@ uno::Reference<drawing::XDrawPage> SAL_CALL ScDrawPagesObj::insertNewByIndex( sa
     {
         rtl::OUString aNewName;
         pDocShell->GetDocument()->CreateValidTabName(aNewName);
-        ScDocFunc aFunc(*pDocShell);
-        if ( aFunc.InsertTable( static_cast<SCTAB>(nPos), aNewName, true, true ) )
+        if ( pDocShell->GetDocFunc().InsertTable( static_cast<SCTAB>(nPos),
+                                                  aNewName, true, true ) )
             xRet.set(GetObjectByIndex_Impl( nPos ));
     }
     return xRet;
@@ -2409,8 +2402,7 @@ void SAL_CALL ScDrawPagesObj::remove( const uno::Reference<drawing::XDrawPage>&
         if (pPage)
         {
             SCTAB nPageNum = static_cast<SCTAB>(pPage->GetPageNum());
-            ScDocFunc aFunc(*pDocShell);
-            aFunc.DeleteTable( nPageNum, sal_True, sal_True );
+            pDocShell->GetDocFunc().DeleteTable( nPageNum, sal_True, sal_True );
         }
     }
 }
@@ -2503,8 +2495,7 @@ void SAL_CALL ScTableSheetsObj::insertNewByName( const rtl::OUString& aName, sal
     if (pDocShell)
     {
         String aNamStr(aName);
-        ScDocFunc aFunc(*pDocShell);
-        bDone = aFunc.InsertTable( nPosition, aNamStr, sal_True, sal_True );
+        bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr, sal_True, sal_True );
     }
     if (!bDone)
         throw uno::RuntimeException();      // no other exceptions specified
@@ -2546,8 +2537,8 @@ void SAL_CALL ScTableSheetsObj::copyByName( const rtl::OUString& aName,
                 if (nResultTab >= nTabCount)
                     nResultTab = nTabCount - 1;
 
-                ScDocFunc aFunc(*pDocShell);
-                bDone = aFunc.RenameTable( nResultTab, aNewStr, sal_True, sal_True );
+                bDone = pDocShell->GetDocFunc().RenameTable( nResultTab, aNewStr,
+                                                             sal_True, sal_True );
             }
         }
     }
@@ -2584,8 +2575,8 @@ void SAL_CALL ScTableSheetsObj::insertByName( const rtl::OUString& aName, const
                 else
                 {
                     SCTAB nPosition = pDoc->GetTableCount();
-                    ScDocFunc aFunc(*pDocShell);
-                    bDone = aFunc.InsertTable( nPosition, aNamStr, sal_True, sal_True );
+                    bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr,
+                                                                 sal_True, sal_True );
                     if (bDone)
                         pSheetObj->InitInsertSheet( pDocShell, nPosition );
                     //  Dokument und neuen Range am Objekt setzen
@@ -2628,12 +2619,11 @@ void SAL_CALL ScTableSheetsObj::replaceByName( const rtl::OUString& aName, const
                 SCTAB nPosition;
                 if ( pDocShell->GetDocument()->GetTable( aName, nPosition ) )
                 {
-                    ScDocFunc aFunc(*pDocShell);
-                    if ( aFunc.DeleteTable( nPosition, sal_True, sal_True ) )
+                    if ( pDocShell->GetDocFunc().DeleteTable( nPosition, sal_True, sal_True ) )
                     {
                         //  InsertTable kann jetzt eigentlich nicht schiefgehen...
                         String aNamStr(aName);
-                        bDone = aFunc.InsertTable( nPosition, aNamStr, sal_True, sal_True );
+                        bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aNamStr, sal_True, sal_True );
                         if (bDone)
                             pSheetObj->InitInsertSheet( pDocShell, nPosition );
                     }
@@ -2670,15 +2660,9 @@ void SAL_CALL ScTableSheetsObj::removeByName( const rtl::OUString& aName )
     {
         SCTAB nIndex;
         if ( pDocShell->GetDocument()->GetTable( aName, nIndex ) )
-        {
-            ScDocFunc aFunc(*pDocShell);
-            bDone = aFunc.DeleteTable( nIndex, sal_True, sal_True );
-        }
-        else
-        {
-            //  not found
+            bDone = pDocShell->GetDocFunc().DeleteTable( nIndex, sal_True, sal_True );
+        else // not found
             throw container::NoSuchElementException();
-        }
     }
 
     if (!bDone)
@@ -2924,10 +2908,9 @@ void SAL_CALL ScTableColumnsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 n
     if ( pDocShell && nCount > 0 && nPosition >= 0 && nStartCol+nPosition <= nEndCol &&
             nStartCol+nPosition+nCount-1 <= MAXCOL )
     {
-        ScDocFunc aFunc(*pDocShell);
         ScRange aRange( (SCCOL)(nStartCol+nPosition), 0, nTab,
                         (SCCOL)(nStartCol+nPosition+nCount-1), MAXROW, nTab );
-        bDone = aFunc.InsertCells( aRange, NULL, INS_INSCOLS, sal_True, sal_True );
+        bDone = pDocShell->GetDocFunc().InsertCells( aRange, NULL, INS_INSCOLS, sal_True, sal_True );
     }
     if (!bDone)
         throw uno::RuntimeException();      // no other exceptions specified
@@ -2941,10 +2924,9 @@ void SAL_CALL ScTableColumnsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCou
     //  Der zu loeschende Bereich muss innerhalb des Objekts liegen
     if ( pDocShell && nCount > 0 && nIndex >= 0 && nStartCol+nIndex+nCount-1 <= nEndCol )
     {
-        ScDocFunc aFunc(*pDocShell);
         ScRange aRange( (SCCOL)(nStartCol+nIndex), 0, nTab,
                         (SCCOL)(nStartCol+nIndex+nCount-1), MAXROW, nTab );
-        bDone = aFunc.DeleteCells( aRange, NULL, DEL_DELCOLS, sal_True, sal_True );
+        bDone = pDocShell->GetDocFunc().DeleteCells( aRange, NULL, DEL_DELCOLS, sal_True, sal_True );
     }
     if (!bDone)
         throw uno::RuntimeException();      // no other exceptions specified
@@ -3050,31 +3032,31 @@ void SAL_CALL ScTableColumnsObj::setPropertyValue(
     if (!pDocShell)
         throw uno::RuntimeException();
 
-    ScDocFunc aFunc(*pDocShell);
     SCCOLROW nColArr[2];
     nColArr[0] = nStartCol;
     nColArr[1] = nEndCol;
     String aNameString(aPropertyName);
+    ScDocFunc& rFunc = pDocShell->GetDocFunc();
 
     if ( aNameString.EqualsAscii( SC_UNONAME_CELLWID ) )
     {
         sal_Int32 nNewWidth = 0;
         if ( aValue >>= nNewWidth )
-            aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, SC_SIZE_ORIGINAL,
+            rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, SC_SIZE_ORIGINAL,
                                     (sal_uInt16)HMMToTwips(nNewWidth), sal_True, sal_True );
     }
     else if ( aNameString.EqualsAscii( SC_UNONAME_CELLVIS ) )
     {
         sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
         ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
-        aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, eMode, 0, sal_True, sal_True );
+        rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab, eMode, 0, sal_True, sal_True );
         //  SC_SIZE_DIRECT with size 0: hide
     }
     else if ( aNameString.EqualsAscii( SC_UNONAME_OWIDTH ) )
     {
         sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
         if (bOpt)
-            aFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab,
+            rFunc.SetWidthOrHeight( sal_True, 1, nColArr, nTab,
                                     SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, sal_True, sal_True );
         // sal_False for columns currently has no effect
     }
@@ -3084,9 +3066,9 @@ void SAL_CALL ScTableColumnsObj::setPropertyValue(
         sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
         for (SCCOL nCol=nStartCol; nCol<=nEndCol; nCol++)
             if (bSet)
-                aFunc.InsertPageBreak( sal_True, ScAddress(nCol,0,nTab), sal_True, sal_True, sal_True );
+                rFunc.InsertPageBreak( sal_True, ScAddress(nCol,0,nTab), sal_True, sal_True, sal_True );
             else
-                aFunc.RemovePageBreak( sal_True, ScAddress(nCol,0,nTab), sal_True, sal_True, sal_True );
+                rFunc.RemovePageBreak( sal_True, ScAddress(nCol,0,nTab), sal_True, sal_True, sal_True );
     }
 }
 
@@ -3185,10 +3167,9 @@ void SAL_CALL ScTableRowsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 nCou
     if ( pDocShell && nCount > 0 && nPosition >= 0 && nStartRow+nPosition <= nEndRow &&
             nStartRow+nPosition+nCount-1 <= MAXROW )
     {
-        ScDocFunc aFunc(*pDocShell);
         ScRange aRange( 0, (SCROW)(nStartRow+nPosition), nTab,
                         MAXCOL, (SCROW)(nStartRow+nPosition+nCount-1), nTab );
-        bDone = aFunc.InsertCells( aRange, NULL, INS_INSROWS, sal_True, sal_True );
+        bDone = pDocShell->GetDocFunc().InsertCells( aRange, NULL, INS_INSROWS, sal_True, sal_True );
     }
     if (!bDone)
         throw uno::RuntimeException();      // no other exceptions specified
@@ -3202,10 +3183,9 @@ void SAL_CALL ScTableRowsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount
     //  Der zu loeschende Bereich muss innerhalb des Objekts liegen
     if ( pDocShell && nCount > 0 && nIndex >= 0 && nStartRow+nIndex+nCount-1 <= nEndRow )
     {
-        ScDocFunc aFunc(*pDocShell);
         ScRange aRange( 0, (SCROW)(nStartRow+nIndex), nTab,
                         MAXCOL, (SCROW)(nStartRow+nIndex+nCount-1), nTab );
-        bDone = aFunc.DeleteCells( aRange, NULL, DEL_DELROWS, sal_True, sal_True );
+        bDone = pDocShell->GetDocFunc().DeleteCells( aRange, NULL, DEL_DELROWS, sal_True, sal_True );
     }
     if (!bDone)
         throw uno::RuntimeException();      // no other exceptions specified
@@ -3273,7 +3253,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
     if (!pDocShell)
         throw uno::RuntimeException();
 
-    ScDocFunc aFunc(*pDocShell);
+    ScDocFunc& rFunc = pDocShell->GetDocFunc();
     ScDocument* pDoc = pDocShell->GetDocument();
     SCCOLROW nRowArr[2];
     nRowArr[0] = nStartRow;
@@ -3295,7 +3275,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
         {
             sal_Bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
             if (bOpt)
-                aFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, sal_True, sal_True );
+                rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_OPTIMAL, 0, sal_True, sal_True );
             else
             {
                 //! manually set old heights again?
@@ -3306,14 +3286,14 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
     {
         sal_Int32 nNewHeight = 0;
         if ( aValue >>= nNewHeight )
-            aFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL,
+            rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, SC_SIZE_ORIGINAL,
                                     (sal_uInt16)HMMToTwips(nNewHeight), sal_True, sal_True );
     }
     else if ( aNameString.EqualsAscii( SC_UNONAME_CELLVIS ) )
     {
         sal_Bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
         ScSizeMode eMode = bVis ? SC_SIZE_SHOW : SC_SIZE_DIRECT;
-        aFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
+        rFunc.SetWidthOrHeight( false, 1, nRowArr, nTab, eMode, 0, sal_True, sal_True );
         //  SC_SIZE_DIRECT with size 0: hide
     }
     else if ( aNameString.EqualsAscii( SC_UNONAME_VISFLAG ) )
@@ -3336,9 +3316,9 @@ void SAL_CALL ScTableRowsObj::setPropertyValue(
         sal_Bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
         for (SCROW nRow=nStartRow; nRow<=nEndRow; nRow++)
             if (bSet)
-                aFunc.InsertPageBreak( false, ScAddress(0,nRow,nTab), sal_True, sal_True, sal_True );
+                rFunc.InsertPageBreak( false, ScAddress(0,nRow,nTab), sal_True, sal_True, sal_True );
             else
-                aFunc.RemovePageBreak( false, ScAddress(0,nRow,nTab), sal_True, sal_True, sal_True );
+                rFunc.RemovePageBreak( false, ScAddress(0,nRow,nTab), sal_True, sal_True, sal_True );
     }
     else if ( aNameString.EqualsAscii( SC_UNONAME_CELLBACK ) || aNameString.EqualsAscii( SC_UNONAME_CELLTRAN ) )
     {
@@ -3530,9 +3510,7 @@ void SAL_CALL ScAnnotationsObj::insertNew(
     {
         OSL_ENSURE( aPosition.Sheet == nTab, "addAnnotation mit falschem Sheet" );
         ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab );
-
-        ScDocFunc aFunc( *pDocShell );
-        aFunc.ReplaceNote( aPos, rText, 0, 0, sal_True );
+        pDocShell->GetDocFunc().ReplaceNote( aPos, rText, 0, 0, sal_True );
     }
 }
 
@@ -3548,8 +3526,7 @@ void SAL_CALL ScAnnotationsObj::removeByIndex( sal_Int32 nIndex ) throw(uno::Run
             aMarkData.SelectTable( aPos.Tab(), sal_True );
             aMarkData.SetMultiMarkArea( ScRange(aPos) );
 
-            ScDocFunc aFunc(*pDocShell);
-            aFunc.DeleteContents( aMarkData, IDF_NOTE, sal_True, sal_True );
+            pDocShell->GetDocFunc().DeleteContents( aMarkData, IDF_NOTE, sal_True, sal_True );
         }
     }
 }
@@ -3713,10 +3690,7 @@ void SAL_CALL ScScenariosObj::removeByName( const rtl::OUString& aName )
     SolarMutexGuard aGuard;
     SCTAB nIndex;
     if ( pDocShell && GetScenarioIndex_Impl( aName, nIndex ) )
-    {
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.DeleteTable( nTab+nIndex+1, sal_True, sal_True );
-    }
+        pDocShell->GetDocFunc().DeleteTable( nTab+nIndex+1, sal_True, sal_True );
 }
 
 // XEnumerationAccess
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index db8ec46..526e11b 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -694,9 +694,8 @@ void ScAreaLinkObj::Modify_Impl( const rtl::OUString* pNewFile, const rtl::OUStr
             ScUnoConversion::FillScRange( aDest, *pNewDest );
             bFitBlock = false;  // neuer Bereich angegeben -> keine Inhalte verschieben
         }
-
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.InsertAreaLink( aFile, aFilter, aOptions, aSource, aDest, nRefresh, bFitBlock, sal_True );
+        pDocShell->GetDocFunc().InsertAreaLink( aFile, aFilter, aOptions, aSource,
+                                                aDest, nRefresh, bFitBlock, sal_True );
     }
 }
 
@@ -983,11 +982,9 @@ void SAL_CALL ScAreaLinksObj::insertAtPosition( const table::CellAddress& aDestP
         ScAddress aDestAddr( (SCCOL)aDestPos.Column, (SCROW)aDestPos.Row, aDestPos.Sheet );
 
         aFileStr = ScGlobal::GetAbsDocName( aFileStr, pDocShell );  //! in InsertAreaLink ???
-
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.InsertAreaLink( aFileStr, aFilterStr, aOptionStr,
-                                aSourceStr, ScRange(aDestAddr),
-                                0, false, sal_True );                   // keine Inhalte verschieben
+        pDocShell->GetDocFunc().InsertAreaLink( aFileStr, aFilterStr, aOptionStr,
+                                                aSourceStr, ScRange(aDestAddr),
+                                                0, false, sal_True ); // don't move contents
     }
 }
 
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 48baee8..5158394 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -212,8 +212,7 @@ void ScNamedRangeObj::Modify_Impl( const String* pNewName, const ScTokenArray* p
     pNewRanges->erase(*pOld);
     if (pNewRanges->insert(pNew))
     {
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.SetNewRangeNames(pNewRanges, mxParent->IsModifyAndBroadcast(), nTab);
+        pDocShell->GetDocFunc().SetNewRangeNames(pNewRanges, mxParent->IsModifyAndBroadcast(), nTab);
 
         aName = aInsName;   //! broadcast?
     }
@@ -554,8 +553,7 @@ void SAL_CALL ScNamedRangesObj::addNewByName( const rtl::OUString& aName,
                                                 aPos, nNewType,formula::FormulaGrammar::GRAM_PODF_A1 );
             if ( pNewRanges->insert(pNew) )
             {
-                ScDocFunc aFunc(*pDocShell);
-                aFunc.SetNewRangeNames(pNewRanges, mbModifyAndBroadcast, GetTab_Impl());
+                pDocShell->GetDocFunc().SetNewRangeNames(pNewRanges, mbModifyAndBroadcast, GetTab_Impl());
                 bDone = true;
             }
             else
@@ -591,10 +589,7 @@ void SAL_CALL ScNamedRangesObj::addNewFromTitles( const table::CellRangeAddress&
     if (bRight)  nFlags |= NAME_RIGHT;
 
     if (nFlags)
-    {
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.CreateNames( aRange, nFlags, sal_True, GetTab_Impl() );
-    }
+        pDocShell->GetDocFunc().CreateNames( aRange, nFlags, sal_True, GetTab_Impl() );
 }
 
 void SAL_CALL ScNamedRangesObj::removeByName( const rtl::OUString& aName )
@@ -612,8 +607,7 @@ void SAL_CALL ScNamedRangesObj::removeByName( const rtl::OUString& aName )
             {
                 ScRangeName* pNewRanges = new ScRangeName(*pNames);
                 pNewRanges->erase(*pData);
-                ScDocFunc aFunc(*pDocShell);
-                aFunc.SetNewRangeNames( pNewRanges, mbModifyAndBroadcast, GetTab_Impl());
+                pDocShell->GetDocFunc().SetNewRangeNames( pNewRanges, mbModifyAndBroadcast, GetTab_Impl());
                 bDone = true;
             }
         }
@@ -629,10 +623,7 @@ void SAL_CALL ScNamedRangesObj::outputList( const table::CellAddress& aOutputPos
     SolarMutexGuard aGuard;
     ScAddress aPos( (SCCOL)aOutputPosition.Column, (SCROW)aOutputPosition.Row, aOutputPosition.Sheet );
     if (pDocShell)
-    {
-        ScDocFunc aFunc(*pDocShell);
-        aFunc.InsertNameList( aPos, sal_True );
-    }
+        pDocShell->GetDocFunc().InsertNameList( aPos, sal_True );
 }
 
 // container::XEnumerationAccess
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 42a0f9f..7c06fb5 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -1059,11 +1059,8 @@ void ScCellTextData::UpdateData()
             //  during the own UpdateData call, bDataValid must not be reset,
             //  or things like attributes after the text would be lost
             //  (are not stored in the cell)
-
             bInUpdate = sal_True;   // prevents bDataValid from being reset
-
-            ScDocFunc aFunc(*pDocShell);
-            aFunc.PutData( aCellPos, *pEditEngine, false, sal_True );   // always as text
+            pDocShell->GetDocFunc().PutData( aCellPos, *pEditEngine, false, sal_True ); // always as text
 
             bInUpdate = false;
             bDirty = false;
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 23a7492..50bf344 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -3980,13 +3980,12 @@ ScVbaRange::setColumnWidth( const uno::Any& _columnwidth ) throw (uno::RuntimeEx
         table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
         sal_uInt16 nTwips = lcl_pointsToTwips( nColWidth );
 
-        ScDocFunc aFunc(*pDocShell);
         SCCOLROW nColArr[2];
         nColArr[0] = thisAddress.StartColumn;
         nColArr[1] = thisAddress.EndColumn;
         // #163561# use mode SC_SIZE_DIRECT: hide for width 0, show for other values
-        aFunc.SetWidthOrHeight( true, 1, nColArr, thisAddress.Sheet,
-                                SC_SIZE_DIRECT, nTwips, true, true );
+        pDocShell->GetDocFunc().SetWidthOrHeight( true, 1, nColArr, thisAddress.Sheet,
+                                                  SC_SIZE_DIRECT, nTwips, true, true );
 
     }
 }
@@ -4144,11 +4143,10 @@ ScVbaRange::setRowHeight( const uno::Any& _rowheight) throw (uno::RuntimeExcepti
     sal_uInt16 nTwips = lcl_pointsToTwips( nHeight );
 
     ScDocShell* pDocShell = excel::GetDocShellFromRange( mxRange );
-    ScDocFunc aFunc(*pDocShell);
     SCCOLROW nRowArr[2];
     nRowArr[0] = thisAddress.StartRow;
     nRowArr[1] = thisAddress.EndRow;
-    aFunc.SetWidthOrHeight( false, 1, nRowArr, thisAddress.Sheet, SC_SIZE_ORIGINAL,
+    pDocShell->GetDocFunc().SetWidthOrHeight( false, 1, nRowArr, thisAddress.Sheet, SC_SIZE_ORIGINAL,
                                                                         nTwips, true, true );
 }
 
@@ -4843,7 +4841,6 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
             RangeHelper thisRange( mxRange );
             table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
 
-            ScDocFunc aFunc(*pDocShell);
             SCCOLROW nColArr[2];
             nColArr[0] = thisAddress.StartColumn;
             nColArr[1] = thisAddress.EndColumn;
@@ -4854,9 +4851,8 @@ ScVbaRange::Autofit() throw (uno::RuntimeException)
                 nColArr[0] = thisAddress.StartRow;
                 nColArr[1] = thisAddress.EndRow;
             }
-            aFunc.SetWidthOrHeight( bDirection, 1, nColArr, thisAddress.Sheet, SC_SIZE_OPTIMAL,
-                                                                                0, true, true );
-
+            pDocShell->GetDocFunc().SetWidthOrHeight( bDirection, 1, nColArr, thisAddress.Sheet,
+                                                      SC_SIZE_OPTIMAL, 0, true, true );
     }
 }
 
@@ -5588,9 +5584,9 @@ ScVbaRange::AutoFill(  const uno::Reference< excel::XRange >& Destination, const
                 break;
         }
     }
-    ScDocFunc aFunc(*pDocSh);
 #ifdef VBA_OOBUILD_HACK
-    aFunc.FillAuto( aSourceRange, NULL, eDir, eCmd, eDateCmd, nCount, fStep, fEndValue, sal_True, sal_True );
+    pDocSh->GetDocFunc().FillAuto( aSourceRange, NULL, eDir, eCmd, eDateCmd,
+                                   nCount, fStep, fEndValue, sal_True, sal_True );
 #endif
 }
 sal_Bool SAL_CALL
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index bdcf456..e357c1f 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2136,9 +2136,8 @@ void ScCellShell::ExecuteExternalSource(
         else
             aLinkRange = ScRange( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() );
 
-        ScDocFunc aFunc(*pData->GetDocShell());
-        aFunc.InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource,
-                                aLinkRange, _nRefresh, bMove, false );
+        pData->GetDocFunc().InsertAreaLink( _rFile, _rFilter, _rOptions, _rSource,
+                                            aLinkRange, _nRefresh, bMove, false );
         _rRequest.Done();
     }
     else
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index 67e6171..023dd65 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -1234,7 +1234,6 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
             if( bMoveRulerAction )
             {
                 long  nNewColWidth = 0;
-                ScDocFunc aFunc(*pDocShell);
                 SCCOLROW nCols[2] = { nColNumberButttonDown, nColNumberButttonDown };
 
                 if( !bLayoutRTL )
@@ -1251,7 +1250,9 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt )
 
                 if( nNewColWidth >= 0 )
                 {
-                    aFunc.SetWidthOrHeight( true, 1,nCols, nTab, SC_SIZE_DIRECT, (sal_uInt16)nNewColWidth, true, true);
+                    pDocShell->GetDocFunc().SetWidthOrHeight(
+                                                true, 1,nCols, nTab, SC_SIZE_DIRECT,
+                                                (sal_uInt16)nNewColWidth, true, true);
                     pDocShell->SetModified(true);
                 }
                 if ( ValidTab( nTab ) )
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 30638e1..c1ccd5b 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -649,7 +649,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
         case FID_TAB_RTL:
             {
                 ScDocShell* pDocSh = pViewData->GetDocShell();
-                ScDocFunc aFunc(*pDocSh);
+                ScDocFunc &rFunc = pDocSh->GetDocFunc();
                 sal_Bool bSet = !pDoc->IsLayoutRTL( nCurrentTab );
 
                 const ScMarkData& rMark = pViewData->GetMarkData();
@@ -663,12 +663,12 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 
                     ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
                     for (; itr != itrEnd; ++itr)
-                        aFunc.SetLayoutRTL( *itr, bSet, false );
+                        rFunc.SetLayoutRTL( *itr, bSet, false );
 
                     pUndoManager->LeaveListAction();
                 }
                 else
-                    aFunc.SetLayoutRTL( nCurrentTab, bSet, false );
+                    rFunc.SetLayoutRTL( nCurrentTab, bSet, false );
             }
             break;
 
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index a0f4cdf..73c79a6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2067,6 +2067,11 @@ SfxObjectShell* ScViewData::GetSfxDocShell() const
     return pDocShell;
 }
 
+ScDocFunc& ScViewData::GetDocFunc() const
+{
+    return pDocShell->GetDocFunc();
+}
+
 SfxBindings& ScViewData::GetBindings()
 {
     OSL_ENSURE( pViewShell, "GetBindings() without ViewShell" );
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 780e483..cf1b9db 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2563,7 +2563,7 @@ void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
     ScMarkData& rMark = GetViewData()->GetMarkData();
     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     ScDocument* pDoc = pDocSh->GetDocument();
-    ScDocFunc aFunc(*pDocSh);
+    ScDocFunc &rFunc = pDocSh->GetDocFunc();
     bool bUndo(pDoc->IsUndoEnabled());
 
     //  modifying several tabs is handled here
@@ -2576,7 +2576,7 @@ void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
 
     ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
     for (; itr != itrEnd; ++itr)
-        aFunc.ProtectSheet(*itr, rProtect);
+        rFunc.ProtectSheet(*itr, rProtect);
 
     if (bUndo)
         pDocSh->GetUndoManager()->LeaveListAction();
@@ -2589,11 +2589,11 @@ void ScViewFunc::Protect( SCTAB nTab, const String& rPassword )
     ScMarkData& rMark = GetViewData()->GetMarkData();
     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     ScDocument* pDoc = pDocSh->GetDocument();
-    ScDocFunc aFunc(*pDocSh);
+    ScDocFunc &rFunc = pDocSh->GetDocFunc();
     sal_Bool bUndo(pDoc->IsUndoEnabled());
 
     if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 )
-        aFunc.Protect( nTab, rPassword, false );
+        rFunc.Protect( nTab, rPassword, false );
     else
     {
         //  modifying several tabs is handled here
@@ -2606,7 +2606,7 @@ void ScViewFunc::Protect( SCTAB nTab, const String& rPassword )
 
         ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
         for (; itr != itrEnd; ++itr)
-            aFunc.Protect( *itr, rPassword, false );
+            rFunc.Protect( *itr, rPassword, false );
 
         if (bUndo)
             pDocSh->GetUndoManager()->LeaveListAction();
@@ -2620,12 +2620,12 @@ sal_Bool ScViewFunc::Unprotect( SCTAB nTab, const String& rPassword )
     ScMarkData& rMark = GetViewData()->GetMarkData();
     ScDocShell* pDocSh = GetViewData()->GetDocShell();
     ScDocument* pDoc = pDocSh->GetDocument();
-    ScDocFunc aFunc(*pDocSh);
+    ScDocFunc &rFunc = pDocSh->GetDocFunc();
     sal_Bool bChanged = false;
     sal_Bool bUndo (pDoc->IsUndoEnabled());
 
     if ( nTab == TABLEID_DOC || rMark.GetSelectCount() <= 1 )
-        bChanged = aFunc.Unprotect( nTab, rPassword, false );
+        bChanged = rFunc.Unprotect( nTab, rPassword, false );
     else
     {
         //  modifying several tabs is handled here
@@ -2638,7 +2638,7 @@ sal_Bool ScViewFunc::Unprotect( SCTAB nTab, const String& rPassword )
 
         ScMarkData::iterator itr = rMark.begin(), itrEnd = rMark.end();
         for (; itr != itrEnd; ++itr)
-            if ( aFunc.Unprotect( *itr, rPassword, false ) )
+            if ( rFunc.Unprotect( *itr, rPassword, false ) )
                     bChanged = sal_True;
 
         if (bUndo)


More information about the Libreoffice-commits mailing list