[Libreoffice-commits] .: 7 commits - chart2/source sc/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri May 20 08:36:44 PDT 2011


 chart2/source/controller/main/ShapeController.cxx |    2 +-
 chart2/source/model/main/ChartModel.cxx           |    4 ++++
 sc/source/core/data/drwlayer.cxx                  |    5 ++---
 sc/source/core/tool/rangeutl.cxx                  |   11 +++++++++--
 sc/source/filter/html/htmlexp.cxx                 |    8 ++++----
 sc/source/filter/html/htmlpars.cxx                |   10 +++++-----
 sc/source/ui/app/inputhdl.cxx                     |    2 +-
 sc/source/ui/app/scmod.cxx                        |    2 +-
 sc/source/ui/docshell/docsh2.cxx                  |    2 +-
 sc/source/ui/drawfunc/drawsh.cxx                  |    2 +-
 sc/source/ui/drawfunc/fuins1.cxx                  |    2 +-
 sc/source/ui/optdlg/opredlin.cxx                  |    7 +++----
 sc/source/ui/optdlg/tpview.cxx                    |    2 +-
 sc/source/ui/view/viewfun4.cxx                    |    6 +++---
 14 files changed, 37 insertions(+), 28 deletions(-)

New commits:
commit 86d8c9c36e2f3a31a24b9d4980a6ebec6430f657
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 20 08:52:59 2011 +0100

    adjust for return by ref instead of pointer

diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index eed8a4a..672f2a2 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -257,12 +257,12 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const String& rBaseURL, ScDocument
     sIndent[0] = 0;
 
     // set HTML configuration
-    SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
-    eDestEnc = (pDoc->IsClipOrUndo() ? RTL_TEXTENCODING_UTF8 : pHtmlOptions->GetTextEncoding());
-    bCopyLocalFileToINet = pHtmlOptions->IsSaveGraphicsLocal();
+    SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
+    eDestEnc = (pDoc->IsClipOrUndo() ? RTL_TEXTENCODING_UTF8 : rHtmlOptions.GetTextEncoding());
+    bCopyLocalFileToINet = rHtmlOptions.IsSaveGraphicsLocal();
     for ( sal_uInt16 j=0; j < SC_HTML_FONTSIZES; j++ )
     {
-        sal_uInt16 nSize = pHtmlOptions->GetFontSize( j );
+        sal_uInt16 nSize = rHtmlOptions.GetFontSize( j );
         // remember in Twips, like our SvxFontHeightItem
         if ( nSize )
             nFontSize[j] = nSize * 20;
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 329bf96..fb749d6 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2640,7 +2640,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
 
         if ( aString.GetChar(0) == '=' )
         {
-            SvxAutoCorrect* pAuto = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+            SvxAutoCorrect* pAuto = SvxAutoCorrCfg::Get().GetAutoCorrect();
             if ( pAuto )
             {
                 sal_Unicode cReplace = pAuto->GetStartDoubleQuote();
commit 45c009cfc8e7f3f8d8a7177aa493ac53657c09dc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 19 23:19:39 2011 +0100

    adjust for return by ref instead of pointer

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 7af88be..0c3531a 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -82,9 +82,9 @@ ScHTMLParser::ScHTMLParser( EditEngine* pEditEngine, ScDocument* pDoc ) :
     ScEEParser( pEditEngine ),
     mpDoc( pDoc )
 {
-    SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+    SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
     for( sal_uInt16 nIndex = 0; nIndex < SC_HTML_FONTSIZES; ++nIndex )
-        maFontHeights[ nIndex ] = pHtmlOptions->GetFontSize( nIndex ) * 20;
+        maFontHeights[ nIndex ] = rHtmlOptions.GetFontSize( nIndex ) * 20;
 }
 
 ScHTMLParser::~ScHTMLParser()
@@ -1285,9 +1285,9 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
 
     sal_uInt16 nFormat;
     Graphic* pGraphic = new Graphic;
-    GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter();
+    GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
     if ( GRFILTER_OK != GraphicFilter::LoadGraphic( pImage->aURL, pImage->aFilterName,
-            *pGraphic, pFilter, &nFormat ) )
+            *pGraphic, &rFilter, &nFormat ) )
     {
         delete pGraphic;
         return ;        // dumm gelaufen
@@ -1297,7 +1297,7 @@ void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
         pActEntry->bHasGraphic = sal_True;
         pActEntry->aAltText.Erase();
     }
-    pImage->aFilterName = pFilter->GetImportFormatName( nFormat );
+    pImage->aFilterName = rFilter.GetImportFormatName( nFormat );
     pImage->pGraphic = pGraphic;
     if ( !(pImage->aSize.Width() && pImage->aSize.Height()) )
     {
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 392497f..30549f6 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -224,7 +224,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell*	pViewSh,
             bAsLink = ((const SfxBoolItem*)pItem)->GetValue();
 
         Graphic aGraphic;
-        int nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, aGraphic, GraphicFilter::GetGraphicFilter() );
+        int nError = GraphicFilter::LoadGraphic( aFileName, aFilterName, aGraphic, &GraphicFilter::GetGraphicFilter() );
         if ( nError == GRFILTER_OK )
         {
             lcl_InsertGraphic( aGraphic, aFileName, aFilterName, bAsLink, sal_True, pViewSh, pWindow, pView );
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 818f3f5..4847428 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -653,15 +653,15 @@ sal_Bool ScViewFunc::PasteFile( const Point& rPos, const String& rFile, sal_Bool
 
     sal_uInt16 nFilterFormat;
     Graphic aGraphic;
-    GraphicFilter* pGraphicFilter = GraphicFilter::GetGraphicFilter();
+    GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
 
 
-    if (!pGraphicFilter->ImportGraphic(aGraphic, aURL,
+    if (!rGraphicFilter.ImportGraphic(aGraphic, aURL,
             GRFILTER_FORMAT_DONTKNOW, &nFilterFormat ))
     {
         if ( bLink )
         {
-            String aFltName = pGraphicFilter->GetImportFormatName(nFilterFormat);
+            String aFltName = rGraphicFilter.GetImportFormatName(nFilterFormat);
             return PasteGraphic( rPos, aGraphic, aStrURL, aFltName );
         }
         else
commit 908f56761eb0b789137c50cfee1e8a84a1db51d2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 18 22:21:04 2011 +0100

    valgrind: fix leak when range isn't transferred to rangelist

diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 3c50143..e80031f 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -557,12 +557,19 @@ sal_Bool ScRangeStringConverter::GetRangeListFromString(
     while( nOffset >= 0 )
     {
         ScRange* pRange = new ScRange;
-        if (  GetRangeFromString( *pRange, rRangeListStr, pDocument, eConv, nOffset, cSeperator, cQuote )
-           && (nOffset >= 0)
+        if (
+             GetRangeFromString( *pRange, rRangeListStr, pDocument, eConv, nOffset, cSeperator, cQuote ) &&
+             (nOffset >= 0)
            )
+        {
             rRangeList.push_back( pRange );
+            pRange = NULL;
+        }
         else if (nOffset > -1)
             bRet = false;
+        //if ownership transferred to rRangeList pRange was NULLed, otherwwise
+        //delete it
+        delete pRange;
     }
     return bRet;
 }
commit 82cb48a7f71b2591dbfa2079ec3ca859fbbe8c47
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 18 15:39:37 2011 +0100

    valgrind: break circular dependency leaks

diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 325dd5d..66f07c7 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -572,6 +572,10 @@ void SAL_CALL ChartModel::dispose() throw(uno::RuntimeException)
     m_xCurrentController.clear();
 
     DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
+
+    if( m_xOldModelAgg.is())
+        m_xOldModelAgg->setDelegator( NULL );
+
     OSL_TRACE( "ChartModel: dispose() called" );
 }
 
commit 43ad627cc85a6a72e2fd5950cc2125db8c226727
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 17 21:42:32 2011 +0100

    adjust to ensure rename

diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 097893f..64a281f 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -167,7 +167,7 @@ ScModule::ScModule( SfxObjectFactory* pFact ) :
 
     //	ErrorHandler anlegen - war in Init()
     //	zwischen OfficeApplication::Init und ScGlobal::Init
-    SvxErrorHandler::Get();
+    SvxErrorHandler::ensure();
     pErrorHdl	 = new SfxErrorHandler( RID_ERRHDLSC,
                                         ERRCODE_AREA_SC,
                                         ERRCODE_AREA_APP2-1,
commit caf9aba1f200b6f2adeca9c933e32747139e7853
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 17 10:03:12 2011 +0100

    adjust for modified singleton

diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx
index 5c8dccb..4e54097 100644
--- a/chart2/source/controller/main/ShapeController.cxx
+++ b/chart2/source/controller/main/ShapeController.cxx
@@ -328,7 +328,7 @@ void ShapeController::executeDispatch_FormatArea()
                     SfxItemPool& rItemPool = pDrawViewWrapper->GetModel()->GetItemPool();
                     SfxItemSet aSet( rItemPool, rItemPool.GetFirstWhich(), rItemPool.GetLastWhich() );
                     const SvxColorTableItem* pColorItem = static_cast< const SvxColorTableItem* >( aSet.GetItem( SID_COLOR_TABLE ) );
-                    if ( pColorItem && pColorItem->GetColorTable() == XColorTable::GetStdColorTable() )
+                    if ( pColorItem && pColorItem->GetColorTable() == &XColorTable::GetStdColorTable() )
                     {
                         pDlg->DontDeleteColorTable();
                     }
commit db61126356b89db63d54b7f76b33008c5e7177ce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 17 10:00:34 2011 +0100

    adjust for modified singleton

diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 8e133fc..9b37ed6 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -242,14 +242,13 @@ ScDrawLayer::ScDrawLayer( ScDocument* pDocument, const String& rName ) :
 
         // set color table
         SvxColorTableItem* pColItem = (SvxColorTableItem*) pObjSh->GetItem( SID_COLOR_TABLE );
-        XColorTable* pXCol = pColItem ? pColItem->GetColorTable() : XColorTable::GetStdColorTable();
+        XColorTable* pXCol = pColItem ? pColItem->GetColorTable() : &XColorTable::GetStdColorTable();
         SetColorTable( pXCol );
     }
     else
-        SetColorTable( XColorTable::GetStdColorTable() );
+        SetColorTable( &XColorTable::GetStdColorTable() );
 
     SetSwapGraphics(sal_True);
-//	SetSwapAsynchron(sal_True);		// an der View
 
     SetScaleUnit(MAP_100TH_MM);
     SfxItemPool& rPool = GetItemPool();
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 0a163a7..a2e676b 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -144,7 +144,7 @@ void ScDocShell::InitItems()
     else
     {
         //	always use global color table instead of local copy
-        PutItem( SvxColorTableItem( XColorTable::GetStdColorTable(), SID_COLOR_TABLE ) );
+        PutItem( SvxColorTableItem( &XColorTable::GetStdColorTable(), SID_COLOR_TABLE ) );
     }
 
     if ( !aDocument.GetForbiddenCharacters().is() ||
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index c8e16b2..45fb2f1 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -422,7 +422,7 @@ void ScDrawShell::ExecuteAreaDlg( SfxRequest& rReq, sal_uInt16 nTabPage )
     // (see SwDrawShell::ExecDrawDlg)
     const SvxColorTableItem* pColorItem =
         static_cast<const SvxColorTableItem*>( pViewData->GetSfxDocShell()->GetItem(SID_COLOR_TABLE) );
-    if (pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
+    if (pColorItem->GetColorTable() == &XColorTable::GetStdColorTable())
         pDlg->DontDeleteColorTable();
 
     if ( nTabPage != 0xffff )
diff --git a/sc/source/ui/optdlg/opredlin.cxx b/sc/source/ui/optdlg/opredlin.cxx
index 03d966d..8c88e22 100644
--- a/sc/source/ui/optdlg/opredlin.cxx
+++ b/sc/source/ui/optdlg/opredlin.cxx
@@ -159,8 +159,6 @@ sal_Bool ScRedlineOptionsTabPage::FillItemSet( SfxItemSet& /* rSet */ )
 
 void ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
 {
-
-    XColorTable* pColorTbl = XColorTable::GetStdColorTable();
     aContentColorLB.InsertEntry(aAuthorStr);
     aMoveColorLB.InsertEntry(aAuthorStr);
     aInsertColorLB.InsertEntry(aAuthorStr);
@@ -171,9 +169,10 @@ void ScRedlineOptionsTabPage::Reset( const SfxItemSet& /* rSet */ )
     aInsertColorLB.SetUpdateMode( false);
     aRemoveColorLB.SetUpdateMode( false);
 
-    for( sal_uInt16 i = 0; i < pColorTbl->Count(); ++i )
+    XColorTable& rColorTbl = XColorTable::GetStdColorTable();
+    for( sal_uInt16 i = 0; i < rColorTbl.Count(); ++i )
     {
-        XColorEntry* pEntry = pColorTbl->GetColor( i );
+        XColorEntry* pEntry = rColorTbl.GetColor( i );
         Color aColor = pEntry->GetColor();
         String sName = pEntry->GetName();
 
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index 9bbc445..ce555fe 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -335,7 +335,7 @@ void ScTpContentOptions::InitGridOpt()
                 pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
         }
         else
-            pColorTable = XColorTable::GetStdColorTable();
+            pColorTable = &XColorTable::GetStdColorTable();
 
         if ( !pColorTable )
             return;


More information about the Libreoffice-commits mailing list