[Libreoffice-commits] .: 2 commits - cui/source sd/source starmath/source sw/source vcl/source

2011-11-06 Thread Ivan Timofeev
 cui/source/dialogs/scriptdlg.cxx  |4 ++--
 sd/source/ui/view/sdview.cxx  |2 +-
 starmath/source/unomodel.cxx  |4 ++--
 sw/source/core/crsr/viscrs.cxx|2 +-
 sw/source/core/doc/docdesc.cxx|   17 +++--
 sw/source/core/text/itrform2.cxx  |   10 --
 sw/source/filter/xml/xmlitmpr.cxx |2 +-
 sw/source/ui/uiview/view2.cxx |3 ++-
 vcl/source/window/decoview.cxx|2 +-
 9 files changed, 21 insertions(+), 25 deletions(-)

New commits:
commit 5122e3413b06125ff45fd10e1ac1f0e58c24afcc
Author: Ivan Timofeev timofeev@gmail.com
Date:   Sun Nov 6 13:20:56 2011 +0400

cppcheck: avoid possible null pointer dereferences

diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 8670778..2e34358 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -623,7 +623,7 @@ sal_Bool View::IsPresObjSelected(sal_Bool bOnPage, sal_Bool 
bOnMasterPage, sal_B
 if ( pObj  ( bCheckPresObjListOnly || pObj-IsEmptyPresObj() || 
pObj-GetUserCall() ) )
 {
 pPage = (SdPage*) pObj-GetPage();
-bMasterPage = pPage-IsMasterPage();
+bMasterPage = pPage  pPage-IsMasterPage();
 
 if ( (bMasterPage  bOnMasterPage) || (!bMasterPage  bOnPage) )
 {
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 4ac9297..fae2579 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -882,9 +882,9 @@ void SmModel::_getPropertyValues( const PropertyMapEntry 
**ppEntries, Any *pValu
 for (size_t i = 0; i  aSymbols.size(); ++i)
 {
 const SmSym * pSymbol = aSymbols[ i ];
-const bool bIsUsedSymbol = rUsedSymbols.find( 
pSymbol-GetName() ) != rUsedSymbols.end();
 if (pSymbol  !pSymbol-IsPredefined() 
-(!bUsedSymbolsOnly || bIsUsedSymbol))
+(!bUsedSymbolsOnly ||
+ rUsedSymbols.find( pSymbol-GetName() ) != 
rUsedSymbols.end()))
 {
 aVector.push_back ( pSymbol );
 nCount++;
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 52312a0..7310b07 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -611,8 +611,9 @@ void SwDoc::PrtDataChanged()
 if ( pTmpRoot )
 {
 ViewShell *pSh = GetCurrentViewShell();
-if( !pSh-GetViewOptions()-getBrowseMode() ||
-pSh-GetViewOptions()-IsPrtFormat() )
+if( pSh 
+(!pSh-GetViewOptions()-getBrowseMode() ||
+ pSh-GetViewOptions()-IsPrtFormat()) )
 {
 if ( GetDocShell() )
 pWait = new SwWait( *GetDocShell(), sal_True );
@@ -632,16 +633,12 @@ void SwDoc::PrtDataChanged()
 std::setSwRootFrm* aAllLayouts = GetAllLayouts();
 std::for_each( aAllLayouts.begin(), 
aAllLayouts.end(),std::bind2nd(std::mem_fun(SwRootFrm::InvalidateAllCntnt), 
INV_SIZE));
 
-if ( pSh )
+do
 {
-do
-{
-pSh-InitPrt( pPrt );
-pSh = (ViewShell*)pSh-GetNext();
-}
-while ( pSh != GetCurrentViewShell() );
+pSh-InitPrt( pPrt );
+pSh = (ViewShell*)pSh-GetNext();
 }
-
+while ( pSh != GetCurrentViewShell() );
 }
 }
 if ( bDraw  pDrawModel )
diff --git a/sw/source/filter/xml/xmlitmpr.cxx 
b/sw/source/filter/xml/xmlitmpr.cxx
index 27c66e9..d61b4df 100644
--- a/sw/source/filter/xml/xmlitmpr.cxx
+++ b/sw/source/filter/xml/xmlitmpr.cxx
@@ -77,7 +77,7 @@ SvXMLItemMapEntry* SvXMLItemMapEntries::getByName(  
sal_uInt16 nNameSpace,
 pMap++;
 }
 
-return (pMap-eLocalName != XML_TOKEN_INVALID) ? pMap : NULL;
+return (pMap  (pMap-eLocalName != XML_TOKEN_INVALID)) ? pMap : NULL;
 }
 
 SvXMLItemMapEntry* SvXMLItemMapEntries::getByIndex( sal_uInt16 nIndex ) const
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 7b69a02..afc6093 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -2282,10 +2282,11 @@ void SwView::GenerateFormLetter(sal_Bool 
bUseCurrentDocument)
 rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer
 // das Mischen von DB-Feldern notwendig.
 AttrChangedNotify( rSh );
-pNewDBMgr-SetMergeType( DBMGR_MERGE );
 
 if (pNewDBMgr)
 {
+pNewDBMgr-SetMergeType( DBMGR_MERGE );
+
 SequencePropertyValue aProperties(3);
 PropertyValue* pValues = aProperties.getArray();
 pValues[0].Name = C2U(DataSourceName);
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index ba41187..ab61741 100644
--- 

[Libreoffice-commits] .: writerfilter/source

2011-11-06 Thread Miklos Vajna
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e4323bd5f5b9acda7cdba965dc27eeeb4487b820
Author: Miklos Vajna vmik...@frugalware.org
Date:   Sun Nov 6 13:55:30 2011 +0100

RTF import: close file descriptor once import finished

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d047065..f0bda24 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -318,6 +318,7 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
 RTFDocumentImpl::~RTFDocumentImpl()
 {
 delete m_pGraphicHelper;
+delete m_pInStream;
 }
 
 SvStream RTFDocumentImpl::Strm()
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: writerfilter/source

2011-11-06 Thread Miklos Vajna
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |8 +++-
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |4 ++--
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit dc060230a15c82c482811ea3eecf1e50e9a20bc4
Author: Miklos Vajna vmik...@frugalware.org
Date:   Sun Nov 6 14:01:22 2011 +0100

RTFDocumentImpl: use boost::shared_ptr for m_pInStream and m_pGraphicHelper

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f0bda24..39bbde2 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -301,7 +301,7 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
 m_bIsInShape(false)
 {
 OSL_ASSERT(xInputStream.is());
-m_pInStream = utl::UcbStreamHelper::CreateStream(xInputStream, sal_True);
+m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, 
sal_True));
 
 m_xModelFactory.set(m_xDstDoc, uno::UNO_QUERY);
 
@@ -309,16 +309,14 @@ 
RTFDocumentImpl::RTFDocumentImpl(uno::Referenceuno::XComponentContext const x
 if (xDocumentPropertiesSupplier.is())
 
m_xDocumentProperties.set(xDocumentPropertiesSupplier-getDocumentProperties(), 
uno::UNO_QUERY);
 
-m_pGraphicHelper = new oox::GraphicHelper(m_xContext, xFrame, m_xStorage);
+m_pGraphicHelper.reset(new oox::GraphicHelper(m_xContext, xFrame, 
m_xStorage));
 
-m_pTokenizer.reset(new RTFTokenizer(*this, m_pInStream));
+m_pTokenizer.reset(new RTFTokenizer(*this, m_pInStream.get()));
 m_pSdrImport.reset(new RTFSdrImport(*this, m_xDstDoc));
 }
 
 RTFDocumentImpl::~RTFDocumentImpl()
 {
-delete m_pGraphicHelper;
-delete m_pInStream;
 }
 
 SvStream RTFDocumentImpl::Strm()
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 66a2839..7b8a7e0 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -351,7 +351,7 @@ namespace writerfilter {
 uno::Referenceframe::XFrame const m_xFrame;
 uno::Referencelang::XMultiServiceFactory m_xModelFactory;
 uno::Referencedocument::XDocumentProperties 
m_xDocumentProperties;
-SvStream* m_pInStream;
+boost::shared_ptrSvStream m_pInStream;
 Stream* m_pMapperStream;
 boost::shared_ptrRTFSdrImport m_pSdrImport;
 boost::shared_ptrRTFTokenizer m_pTokenizer;
@@ -382,7 +382,7 @@ namespace writerfilter {
 RTFSprms m_aSettingsTableSprms;
 
 oox::StorageRef m_xStorage;
-oox::GraphicHelper* m_pGraphicHelper;
+boost::shared_ptroox::GraphicHelper m_pGraphicHelper;
 
 /// Buffered table cells, till cell definitions are not 
reached.
 RTFBuffer_t m_aTableBuffer;
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: 2 commits - svx/source

2011-11-06 Thread Ivan Timofeev
 svx/source/unodraw/UnoGraphicExporter.cxx |   84 --
 1 file changed, 36 insertions(+), 48 deletions(-)

New commits:
commit da5ec5d1e0823cf53f3f70c074cd3d314b89d4e3
Author: Ivan Timofeev timofeev@gmail.com
Date:   Mon Nov 7 09:01:50 2011 +0400

use boost::scoped_ptr

diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx 
b/svx/source/unodraw/UnoGraphicExporter.cxx
index 0b60214..c0b66a4 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -724,15 +724,14 @@ bool GraphicExporter::GetGraphic( ExportSettings 
rSettings, Graphic aGraphic,
 Size aNewSize;
 
 // create a view
-SdrView*pView;
-
+boost::scoped_ptr SdrView  pView;
 if( PTR_CAST( FmFormModel, mpDoc ) )
 {
-pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), 
aVDev );
+pView.reset(new FmFormView( PTR_CAST( FmFormModel, mpDoc 
), aVDev ));
 }
 else
 {
-pView = new SdrView( mpDoc, aVDev );
+pView.reset(new SdrView( mpDoc, aVDev ));
 }
 
 pView-SetBordVisible( sal_False );
@@ -773,7 +772,6 @@ bool GraphicExporter::GetGraphic( ExportSettings 
rSettings, Graphic aGraphic,
 aGraphic = Graphic(aMtf);
 
 pView-HideSdrPage();
-delete pView;
 
 if( rSettings.mbTranslucent )
 {
commit bc858110c2c8c7292a19ed849fd190b2d4aad0b7
Author: Ivan Timofeev timofeev@gmail.com
Date:   Mon Nov 7 08:57:49 2011 +0400

cppcheck: drop redundant check

diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx 
b/svx/source/unodraw/UnoGraphicExporter.cxx
index 956773a..0b60214 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -739,51 +739,41 @@ bool GraphicExporter::GetGraphic( ExportSettings 
rSettings, Graphic aGraphic,
 pView-SetPageVisible( sal_False );
 pView-ShowSdrPage( pPage );
 
-if ( pView  pPage )
-{
-pView-SetBordVisible( sal_False );
-pView-SetPageVisible( sal_False );
-pView-ShowSdrPage( pPage );
-
-const Point aNewOrg( pPage-GetLftBorder(), 
pPage-GetUppBorder() );
-aNewSize = Size( aSize.Width() - pPage-GetLftBorder() - 
pPage-GetRgtBorder(),
-  aSize.Height() - 
pPage-GetUppBorder() - pPage-GetLwrBorder() );
-const Rectangle aClipRect( aNewOrg, aNewSize );
-MapMode aVMap( aMap );
-
-aVDev.Push();
-aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
-aVDev.SetRelativeMapMode( aVMap );
-aVDev.IntersectClipRegion( aClipRect );
-
-// Use new StandardCheckVisisbilityRedirector
-ImplExportCheckVisisbilityRedirector aRedirector( 
mpCurrentPage );
-
-pView-CompleteRedraw(aVDev, Region(Rectangle(Point(), 
aNewSize)), aRedirector);
-
-aVDev.Pop();
-
-aMtf.Stop();
-aMtf.WindStart();
-aMtf.SetPrefMapMode( aMap );
-aMtf.SetPrefSize( aNewSize );
-
-// AW: Here the current version was filtering out the 
META_CLIPREGION_ACTIONs
-// from the metafile. I asked some other developers why 
this was done, but no
-// one knew a direct reason. Since it's in for long time, 
it may be an old
-// piece of code. MetaFiles save and load ClipRegions with 
polygons with preserving
-// the polygons, so a resolution-indepent roundtrip is 
supported. Removed this
-// code since it destroys some MetaFiles where ClipRegions 
are used. Anyways,
-// just filtering them out is a hack, at least the 
encapsulated content would need
-// to be clipped geometrically.
-aGraphic = Graphic(aMtf);
-}
-
-if ( pView )
-{
-pView-HideSdrPage();
-delete pView;
-}
+const Point aNewOrg( pPage-GetLftBorder(), 
pPage-GetUppBorder() );
+aNewSize = Size( aSize.Width() - pPage-GetLftBorder() - 
pPage-GetRgtBorder(),
+ aSize.Height() - pPage-GetUppBorder() - 
pPage-GetLwrBorder() );
+const Rectangle aClipRect( aNewOrg, aNewSize );
+MapMode aVMap( aMap );
+
+aVDev.Push();
+aVMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
+  

[Libreoffice-commits] .: sc/source

2011-11-06 Thread Markus Mohrhard
 sc/source/core/data/document.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bc5b8c53e3dbc8f8151c565eab31fea5bf09a6a6
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Nov 7 06:07:46 2011 +0100

MAC tinderbox does not like OUString::valueOf(sal_Int16)

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 275fca3..588b2ed 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -142,7 +142,7 @@ void ScDocument::MakeTable( SCTAB nTab,bool 
_bNeedsNameCheck )
 if ( ValidTab(nTab)  ( nTab = static_castSCTAB(maTabs.size()) 
||!maTabs[nTab]) )
 {
 rtl::OUString aString = ScGlobal::GetRscString(STR_TABLE_DEF); 
//Table
-aString += rtl::OUString::valueOf(static_castSCTAB(nTab+1));
+aString += rtl::OUString::valueOf(static_castsal_Int32(nTab+1));
 if ( _bNeedsNameCheck )
 CreateValidTabName( aString );  // no doubles
 if (nTab  static_castSCTAB(maTabs.size()))
@@ -334,7 +334,7 @@ void ScDocument::CreateValidTabName(rtl::OUString rName) 
const
 for ( SCTAB i = static_castSCTAB(maTabs.size())+1; !bOk ; i++ )
 {
 rName  = aStrTable;
-rName += rtl::OUString::valueOf(i);
+rName += rtl::OUString::valueOf(static_castSCTAB(i));
 if (bPrefix)
 bOk = ValidNewTabName( rName );
 else
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] .: sc/source

2011-11-06 Thread Markus Mohrhard
 sc/source/core/data/document.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 41ccde126a45223212816271bdc761465c8dbee3
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Mon Nov 7 06:23:49 2011 +0100

SCTAB is sal_Int16 and not sal_Int32

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 588b2ed..78cd569 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -334,7 +334,7 @@ void ScDocument::CreateValidTabName(rtl::OUString rName) 
const
 for ( SCTAB i = static_castSCTAB(maTabs.size())+1; !bOk ; i++ )
 {
 rName  = aStrTable;
-rName += rtl::OUString::valueOf(static_castSCTAB(i));
+rName += rtl::OUString::valueOf(static_castsal_Int32(i));
 if (bPrefix)
 bOk = ValidNewTabName( rName );
 else
___
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits