[Libreoffice-commits] .: 3 commits - binfilter/bf_sc binfilter/bf_starmath binfilter/bf_sw binfilter/inc filter/inc filter/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Jul 11 08:41:30 PDT 2011


 binfilter/bf_sc/source/core/tool/sc_refdata.cxx    |   37 -----
 binfilter/bf_starmath/source/cfgitem.hxx           |    3 
 binfilter/bf_starmath/source/mathml.hxx            |    1 
 binfilter/bf_starmath/source/starmath_cfgitem.cxx  |  125 -------------------
 binfilter/bf_starmath/source/starmath_document.cxx |   33 -----
 binfilter/bf_starmath/source/starmath_mathml.cxx   |  132 ---------------------
 binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx    |   14 --
 binfilter/inc/bf_sc/refdata.hxx                    |    1 
 binfilter/inc/bf_starmath/document.hxx             |    5 
 binfilter/inc/bf_sw/crsrsh.hxx                     |    1 
 filter/inc/filter/msfilter/msdffimp.hxx            |   27 +++-
 filter/source/msfilter/msdffimp.cxx                |   90 +++++++++-----
 12 files changed, 78 insertions(+), 391 deletions(-)

New commits:
commit f937d79eca3523a73183823437225b1b4e6beb54
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 11 16:12:59 2011 +0100

    callcatcher: remove various unused save, etc. methods

diff --git a/binfilter/bf_sc/source/core/tool/sc_refdata.cxx b/binfilter/bf_sc/source/core/tool/sc_refdata.cxx
index 7912eea..9317ba5 100644
--- a/binfilter/bf_sc/source/core/tool/sc_refdata.cxx
+++ b/binfilter/bf_sc/source/core/tool/sc_refdata.cxx
@@ -140,43 +140,6 @@ namespace binfilter {
 /*N*/ 		Flags.bTabRel = TRUE;	// ist bei einigen aelteren Dokumenten nicht gesetzt
 /*N*/ }
 
-
-/*
- bis Release 3.1 sah Store so aus
-
-    BYTE n = ( ( r.bOldFlag3D & 0x03 ) << 6 )	// RelName, 3D
-            | ( ( r.bRelTab & 0x03 ) << 4 )		// Relative, RelAbs
-            | ( ( r.bRelRow & 0x03 ) << 2 )
-            |   ( r.bRelCol & 0x03 );
-
- bis Release 3.1 sah Load so aus
-
-    r.bRelCol = ( n & 0x03 );
-    r.bRelRow = ( ( n >> 2 ) & 0x03 );
-    r.bRelTab = ( ( n >> 4 ) & 0x03 );
-    r.bOldFlag3D = ( ( n >> 6 ) & 0x03 );
-
- bRelCol == SR_DELETED war identisch mit bRelCol == (SR_RELATIVE | SR_RELABS)
- leider..
- 3.1 liest Zukunft: Deleted wird nicht unbedingt erkannt, nur wenn auch Relativ.
- Aber immer noch nCol > MAXCOL und gut sollte sein..
- */
-
-/*N*/ BYTE SingleRefData::CreateStoreByteFromFlags() const
-/*N*/ {
-/*N*/ 	return (BYTE)(
-/*N*/ 		  ( (Flags.bRelName  	& 0x01) << 7 )
-/*N*/ 		| ( (Flags.bFlag3D 		& 0x01) << 6 )
-/*N*/ 		| ( (Flags.bTabDeleted 	& 0x01) << 5 )
-/*N*/ 		| ( (Flags.bTabRel 		& 0x01) << 4 )
-/*N*/ 		| ( (Flags.bRowDeleted	& 0x01) << 3 )
-/*N*/ 		| ( (Flags.bRowRel 		& 0x01) << 2 )
-/*N*/ 		| ( (Flags.bColDeleted	& 0x01) << 1 )
-/*N*/ 		|   (Flags.bColRel 		& 0x01)
-/*N*/ 		);
-/*N*/ }
-
-
 /*N*/ void SingleRefData::CreateFlagsFromLoadByte( BYTE n )
 /*N*/ {
 /*N*/ 	Flags.bColRel		= (n & 0x01 );
diff --git a/binfilter/bf_starmath/source/cfgitem.hxx b/binfilter/bf_starmath/source/cfgitem.hxx
index 78a9454..821e46b 100644
--- a/binfilter/bf_starmath/source/cfgitem.hxx
+++ b/binfilter/bf_starmath/source/cfgitem.hxx
@@ -191,11 +191,8 @@ class SmMathConfig
     void	LoadSymbols();
 
     void    LoadOther();
-    void    SaveOther();
     void    LoadFormat();
-    void    SaveFormat();
     void    LoadFontFormatList();
-    void    SaveFontFormatList();
 
 
 
diff --git a/binfilter/bf_starmath/source/mathml.hxx b/binfilter/bf_starmath/source/mathml.hxx
index b720f2b..fcaa87a 100644
--- a/binfilter/bf_starmath/source/mathml.hxx
+++ b/binfilter/bf_starmath/source/mathml.hxx
@@ -53,7 +53,6 @@ public:
     SmXMLWrapper(::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> &rRef)
         : xModel(rRef), bFlat(sal_True) {}
     ULONG Import(SfxMedium &rMedium);
-    sal_Bool Export(SfxMedium &rMedium);
     void SetFlat(sal_Bool bIn) {bFlat = bIn;}
 private:
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> xModel;
diff --git a/binfilter/bf_starmath/source/starmath_cfgitem.cxx b/binfilter/bf_starmath/source/starmath_cfgitem.cxx
index e52e354..a63be00 100644
--- a/binfilter/bf_starmath/source/starmath_cfgitem.cxx
+++ b/binfilter/bf_starmath/source/starmath_cfgitem.cxx
@@ -582,40 +582,6 @@ static const char* aRootName = "Office.Math";
 /*N*/     return aRes;
 /*N*/ }
 
-
-/*N*/ void SmMathConfig::SaveFontFormatList()
-/*N*/ {
-/*N*/     SmFontFormatList &rFntFmtList = GetFontFormatList();
-/*N*/
-/*N*/     if (!rFntFmtList.IsModified())
-/*N*/         return;
-/*N*/
-/*?*/     SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ) );
-/*?*/
-/*?*/     Sequence< OUString > aNames = lcl_GetFontPropertyNames();
-/*?*/     INT32 nSymbolProps = aNames.getLength();
-/*?*/
-/*?*/     USHORT nCount = rFntFmtList.GetCount();
-/*?*/
-/*?*/     Sequence< PropertyValue > aValues( nCount * nSymbolProps );
-/*?*/     PropertyValue *pValues = aValues.getArray();
-/*?*/
-/*?*/     PropertyValue *pVal = pValues;
-/*?*/     OUString aDelim( OUString::valueOf( (sal_Unicode) '/' ) );
-/*?*/     for (USHORT i = 0;  i < nCount;  ++i)
-/*?*/     {
-/*?*/         DBG_BF_ASSERT(0, "STRIP");
-/*?*/     }
-/*?*/     DBG_ASSERT( pVal - pValues == nCount * nSymbolProps, "properties missing" );
-/*?*/     (void)pVal;
-/*?*/     aCfg.ReplaceSetProperties( A2OU( FONT_FORMAT_LIST ) , aValues );
-/*?*/
-/*?*/     rFntFmtList.SetModified( FALSE );
-/*N*/ }
-
-
-
-
 /*N*/ void SmMathConfig::LoadOther()
 /*N*/ {
 /*N*/     if (!pOther)
@@ -677,46 +643,6 @@ static const char* aRootName = "Office.Math";
 /*N*/     }
 /*N*/ }
 
-
-/*N*/ void SmMathConfig::SaveOther()
-/*N*/ {
-/*N*/     if (!pOther || !IsOtherModified())
-/*N*/         return;
-/*N*/
-/*?*/ 	SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ));
-/*?*/
-/*?*/     const Sequence< OUString > aNames( aCfg.GetOtherPropertyNames() );
-/*?*/     INT32 nProps = aNames.getLength();
-/*?*/
-/*?*/     Sequence< Any > aValues( nProps );
-/*?*/     Any *pValues = aValues.getArray();
-/*?*/     Any *pValue  = pValues;
-/*?*/
-/*?*/     // Print/Title
-/*?*/     *pValue++ <<= (BOOL) pOther->bPrintTitle;
-/*?*/     // Print/FormulaText
-/*?*/     *pValue++ <<= (BOOL) pOther->bPrintFormulaText;
-/*?*/     // Print/Frame
-/*?*/     *pValue++ <<= (BOOL) pOther->bPrintFrame;
-/*?*/     // Print/Size
-/*?*/     *pValue++ <<= (INT16) pOther->ePrintSize;
-/*?*/     // Print/ZoomFactor
-/*?*/     *pValue++ <<= (INT16) pOther->nPrintZoomFactor;
-/*?*/     // Misc/IgnoreSpacesRight
-/*?*/     *pValue++ <<= (BOOL) pOther->bIgnoreSpacesRight;
-/*?*/     // View/ToolboxVisible
-/*?*/     *pValue++ <<= (BOOL) pOther->bToolboxVisible;
-/*?*/     // View/AutoRedraw
-/*?*/     *pValue++ <<= (BOOL) pOther->bAutoRedraw;
-/*?*/     // View/FormulaCursor
-/*?*/     *pValue++ <<= (BOOL) pOther->bFormulaCursor;
-/*?*/
-/*?*/     DBG_ASSERT( pValue - pValues == nProps, "property mismatch" );
-/*?*/     aCfg.PutProperties( aNames , aValues );
-/*?*/
-/*?*/     SetOtherModified( FALSE );
-/*N*/ }
-
 /*N*/ void SmMathConfig::LoadFormat()
 /*N*/ {
 /*N*/     if (!pFormat)
@@ -801,57 +727,6 @@ static const char* aRootName = "Office.Math";
 /*N*/     }
 /*N*/ }
 
-
-/*N*/ void SmMathConfig::SaveFormat()
-/*N*/ {
-/*N*/     if (!pFormat || !IsFormatModified())
-/*N*/         return;
-/*N*/
-/*?*/ 	SmMathConfigItem aCfg( String::CreateFromAscii( aRootName ));
-/*?*/
-/*?*/     const Sequence< OUString > aNames( aCfg.GetFormatPropertyNames() );
-/*?*/     INT32 nProps = aNames.getLength();
-/*?*/
-/*?*/     Sequence< Any > aValues( nProps );
-/*?*/     Any *pValues = aValues.getArray();
-/*?*/     Any *pValue  = pValues;
-/*?*/
-/*?*/     // StandardFormat/Textmode
-/*?*/     *pValue++ <<= (BOOL) pFormat->IsTextmode();
-/*?*/     // StandardFormat/ScaleNormalBracket
-/*?*/     *pValue++ <<= (BOOL) pFormat->IsScaleNormalBrackets();
-/*?*/     // StandardFormat/HorizontalAlignment
-/*?*/     *pValue++ <<= (INT16) pFormat->GetHorAlign();
-/*?*/     // StandardFormat/BaseSize
-/*?*/     *pValue++ <<= (INT16) SmRoundFraction( Sm100th_mmToPts(
-/*?*/                                     pFormat->GetBaseSize().Height() ) );
-/*?*/
-/*?*/     USHORT i;
-/*?*/     for (i = SIZ_BEGIN;  i <= SIZ_END;  ++i)
-/*?*/         *pValue++ <<= (INT16) pFormat->GetRelSize( i );
-/*?*/
-/*?*/     for (i = DIS_BEGIN;  i <= DIS_END;  ++i)
-/*?*/         *pValue++ <<= (INT16) pFormat->GetDistance( i );
-/*?*/
-/*?*/     for (i = FNT_BEGIN;  i < FNT_END;  ++i)
-/*?*/     {
-/*?*/         OUString aFntFmtId;
-/*?*/
-/*?*/         if (!pFormat->IsDefaultFont( i ))
-/*?*/         {
-/*?*/             DBG_BF_ASSERT(0, "STRIP");
-/*?*/         }
-/*?*/
-/*?*/         *pValue++ <<= aFntFmtId;
-/*?*/     }
-/*?*/
-/*?*/     DBG_ASSERT( pValue - pValues == nProps, "property mismatch" );
-/*?*/     aCfg.PutProperties( aNames , aValues );
-/*?*/
-/*?*/     SetFormatModified( FALSE );
-/*N*/ }
-
-
 /*N*/ const SmFormat & SmMathConfig::GetStandardFormat() const
 /*N*/ {
 /*N*/     if (!pFormat)
diff --git a/binfilter/bf_starmath/source/starmath_document.cxx b/binfilter/bf_starmath/source/starmath_document.cxx
index 9e9e063..92df294 100644
--- a/binfilter/bf_starmath/source/starmath_document.cxx
+++ b/binfilter/bf_starmath/source/starmath_document.cxx
@@ -487,39 +487,6 @@ static const char pStarMathDoc[] = "StarMathDocument";
 /*N*/ 	return bRet;
 /*N*/ }
 
-
-
-
-//------------------------------------------------------------------
-
-/*N*/ void SmDocShell::ImplSave( SvStorageStreamRef xStrm )
-/*N*/ {
-/*N*/     String aTmp( aText );
-/*N*/     if (SOFFICE_FILEFORMAT_50 >= xStrm->GetVersion())
-/*N*/         ConvertText( aTmp, CONVERT_60_TO_50 );
-/*N*/     ByteString exString( ExportString( aTmp ) );
-/*N*/
-/*N*/ 	*xStrm	<< SM304AIDENT << SM50VERSION
-/*N*/ 			<< 'T';
-/*N*/ 	xStrm->WriteByteString(exString);
-/*N*/ 	*xStrm	<< 'F' << aFormat
-/*N*/             << 'S';
-/*N*/     xStrm->WriteByteString( ExportString(C2S("unknown")) );
-/*N*/     *xStrm  << (USHORT) 0
-/*N*/ 			<< '\0';
-/*N*/ }
-
-/*N*/ void SmDocShell::UpdateText()
-/*N*/ {
-/*N*/     if (pEditEngine && pEditEngine->IsModified())
-/*N*/     {
-/*N*/         String aEngTxt( pEditEngine->GetText( LINEEND_LF ) );
-/*N*/         if (GetText() != aEngTxt)
-/*N*/             SetText( aEngTxt );
-/*N*/     }
-/*N*/ }
-
-
 /*N*/ void SmDocShell::HandsOff()
 /*N*/ {
 /*N*/ 	SfxInPlaceObject::HandsOff();
diff --git a/binfilter/bf_starmath/source/starmath_mathml.cxx b/binfilter/bf_starmath/source/starmath_mathml.cxx
index b62dcd4..8f13ab7 100644
--- a/binfilter/bf_starmath/source/starmath_mathml.cxx
+++ b/binfilter/bf_starmath/source/starmath_mathml.cxx
@@ -783,138 +783,6 @@ sal_Bool SmXMLWrapper::WriteThroughComponent(
     return bRet;
 }
 
-sal_Bool SmXMLWrapper::Export(SfxMedium &rMedium)
-{
-    sal_Bool bRet=sal_True;
-    uno::Reference<lang::XMultiServiceFactory>
-        xServiceFactory(::legacy_binfilters::getLegacyProcessServiceFactory());
-    DBG_ASSERT(xServiceFactory.is(),"got no service manager");
-
-    //Get model
-    uno::Reference< lang::XComponent > xModelComp(xModel, uno::UNO_QUERY );
-
-    sal_Bool bEmbedded = sal_False;
-    uno::Reference <lang::XUnoTunnel> xTunnel;
-    xTunnel = uno::Reference <lang::XUnoTunnel> (xModel,uno::UNO_QUERY);
-    SmModel *pModel = reinterpret_cast<SmModel *>
-        (xTunnel->getSomething(SmModel::getUnoTunnelId()));
-
-    if (pModel)
-    {
-        SmDocShell *pDocShell =
-            static_cast<SmDocShell*>(pModel->GetObjectShell());
-        if( pDocShell &&
-            SFX_CREATE_MODE_EMBEDDED == pDocShell->GetCreateMode() )
-            bEmbedded = sal_True;
-    }
-
-    uno::Reference<task::XStatusIndicator> xStatusIndicator;
-    if (!bEmbedded)
-    {
-        uno::Reference<frame::XController> xController(
-            xModel->getCurrentController());
-        if( xController.is())
-        {
-            uno::Reference<frame::XFrame> xFrame( xController->getFrame());
-            if( xFrame.is())
-            {
-                uno::Reference<task::XStatusIndicatorFactory> xFactory( xFrame,
-                    uno::UNO_QUERY );
-            if( xFactory.is())
-                xStatusIndicator = xFactory->createStatusIndicator();
-            }
-        }
-
-        // set progress range and start status indicator
-        sal_Int32 nSteps=3;
-        if (bFlat)
-            nSteps = 1;
-
-        sal_Int32 nProgressRange(nSteps);
-        if (xStatusIndicator.is())
-        {
-            xStatusIndicator->start(String(SmResId(STR_STATSTR_WRITING)),
-                nProgressRange);
-        }
-    }
-
-
-    // create XPropertySet with three properties for status indicator
-    ::comphelper::PropertyMapEntry aInfoMap[] =
-    {
-        { "UsePrettyPrinting", sizeof("UsePrettyPrinting")-1, 0,
-              &::getBooleanCppuType(),
-              beans::PropertyAttribute::MAYBEVOID, 0},
-        { NULL, 0, 0, NULL, 0, 0 }
-    };
-    uno::Reference< beans::XPropertySet > xInfoSet(
-                ::comphelper::GenericPropertySet_CreateInstance(
-                            new comphelper::PropertySetInfo( aInfoMap ) ) );
-
-    SvtSaveOptions aSaveOpt;
-    OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
-    sal_Bool bUsePrettyPrinting( bFlat || aSaveOpt.IsPrettyPrinting() );
-    Any aAny;
-    aAny.setValue( &bUsePrettyPrinting, ::getBooleanCppuType() );
-    xInfoSet->setPropertyValue( sUsePrettyPrinting, aAny );
-
-
-    sal_Int32 nSteps=0;
-    if (xStatusIndicator.is())
-            xStatusIndicator->setValue(nSteps++);
-    if (!bFlat) //Storage (Package) of Stream
-    {
-        SvStorage *pStg = rMedium.GetOutputStorage(sal_True);
-
-        if( !bEmbedded )
-        {
-            if (xStatusIndicator.is())
-                xStatusIndicator->setValue(nSteps++);
-
-            bRet = WriteThroughComponent(
-                    pStg, xModelComp, "meta.xml", xServiceFactory, xInfoSet,
-                    "com.sun.star.comp.Math.XMLMetaExporter",sal_False);
-        }
-        if( bRet )
-        {
-           if (xStatusIndicator.is())
-                xStatusIndicator->setValue(nSteps++);
-
-            bRet = WriteThroughComponent(
-                    pStg, xModelComp, "content.xml", xServiceFactory, xInfoSet,
-                    "com.sun.star.comp.Math.XMLContentExporter");
-        }
-
-        if( bRet )
-        {
-            if (xStatusIndicator.is())
-                xStatusIndicator->setValue(nSteps++);
-
-            bRet = WriteThroughComponent(
-                    pStg, xModelComp, "settings.xml", xServiceFactory, xInfoSet,
-                    "com.sun.star.comp.Math.XMLSettingsExporter");
-        }
-    }
-    else
-    {
-        SvStream *pStream = rMedium.GetOutStream();
-        uno::Reference<io::XOutputStream> xOut(
-            new ::utl::OOutputStreamWrapper(*pStream) );
-
-        if (xStatusIndicator.is())
-            xStatusIndicator->setValue(nSteps++);
-
-        bRet = WriteThroughComponent(
-            xOut, xModelComp, xServiceFactory, xInfoSet,
-            "com.sun.star.comp.Math.XMLContentExporter");
-    }
-
-    if (xStatusIndicator.is())
-        xStatusIndicator->end();
-
-    return bRet;
-}
-
 sal_uInt32 SmXMLExport::exportDoc(enum XMLTokenEnum eClass)
 {
     if( (getExportFlags() & EXPORT_CONTENT) == 0 )
diff --git a/binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx b/binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx
index e180207..f7026c4 100644
--- a/binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx
+++ b/binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx
@@ -156,20 +156,6 @@ namespace binfilter {
 /*N*/ 	delete pBoxIdx, pBoxIdx = 0;
 /*N*/ 	pBoxPtr = 0;
 /*N*/ }
-
-/*N*/ bool SwCrsrShell::EndAllTblBoxEdit()
-/*N*/ {
-/*N*/ 	bool bRet = FALSE;
-/*N*/ 	ViewShell *pSh = this;
-/*N*/ 	do {
-/*N*/ 		if( pSh->IsA( TYPE( SwCrsrShell ) ) )
-/*N*/ 			bRet |= ((SwCrsrShell*)pSh)->CheckTblBoxCntnt(
-/*N*/ 						((SwCrsrShell*)pSh)->pCurCrsr->GetPoint() );
-/*N*/
-/*N*/ 	} while( this != (pSh = (ViewShell *)pSh->GetNext()) );
-/*N*/ 	return bRet;
-/*N*/ }
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/inc/bf_sc/refdata.hxx b/binfilter/inc/bf_sc/refdata.hxx
index 7789ed6..8e5fe24 100644
--- a/binfilter/inc/bf_sc/refdata.hxx
+++ b/binfilter/inc/bf_sc/refdata.hxx
@@ -112,7 +112,6 @@ struct SingleRefData		// Single reference (one address) into the sheet
             void CalcRelFromAbs( const ScAddress& rPos );
             void CalcAbsIfRel( const ScAddress& rPos );
             void OldBoolsToNewFlags( const OldSingleRefBools& );
-            BYTE CreateStoreByteFromFlags() const;
             void CreateFlagsFromLoadByte( BYTE );
              BOOL operator==( const SingleRefData& ) const;
 };
diff --git a/binfilter/inc/bf_starmath/document.hxx b/binfilter/inc/bf_starmath/document.hxx
index 3be69e4..f432fe5 100644
--- a/binfilter/inc/bf_starmath/document.hxx
+++ b/binfilter/inc/bf_starmath/document.hxx
@@ -147,7 +147,6 @@ class SmDocShell : public SfxObjectShell, public SfxInPlaceObject,
     virtual void		OnDocumentPrinterChanged( Printer * );
     virtual BOOL		InitNew(SvStorage *);
     virtual BOOL		Load(SvStorage *);
-            void		ImplSave(  SvStorageStreamRef xStrm  );
     virtual BOOL		Save() {return false;}
     virtual void		HandsOff();
 
@@ -161,10 +160,6 @@ class SmDocShell : public SfxObjectShell, public SfxInPlaceObject,
     void				SetFormulaArranged(BOOL bVal) { bIsFormulaArranged = bVal; }
     void				ArrangeFormula();
 
-
-
-    void                UpdateText();
-
 public:
     TYPEINFO();
     SFX_DECL_OBJECTFACTORY_DLL(SmDocShell, SM_MOD());
diff --git a/binfilter/inc/bf_sw/crsrsh.hxx b/binfilter/inc/bf_sw/crsrsh.hxx
index 73fef6b..c849550 100644
--- a/binfilter/inc/bf_sw/crsrsh.hxx
+++ b/binfilter/inc/bf_sw/crsrsh.hxx
@@ -528,7 +528,6 @@ public:
 
     bool CheckTblBoxCntnt( const SwPosition* pPos = 0 );
     void ClearTblBoxCntnt();
-    bool EndAllTblBoxEdit();
 
     // wird gerufen, wenn eine Tabellenselektion im UpdateCrsr erzeugt wird,
     // ohne das die UI davon etaws weiss
commit f291c96da103e279e04bcea7b578badf0e9cdfa0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 11 15:54:50 2011 +0100

    check if seek succeeds

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index d8b72de..b65fa1a 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3220,7 +3220,9 @@ void DffRecordManager::Consume( SvStream& rIn, sal_Bool bAppend, sal_uInt32 nStO
             if ( pCList->nCount == DFF_RECORD_MANAGER_BUF_SIZE )
                 pCList = new DffRecordList( pCList );
             rIn >> pCList->mHd[ pCList->nCount ];
-            pCList->mHd[ pCList->nCount++ ].SeekToEndOfRecord( rIn );
+            bool bSeekSucceeded = pCList->mHd[ pCList->nCount++ ].SeekToEndOfRecord(rIn);
+            if (!bSeekSucceeded)
+                break;
         }
         rIn.Seek( nOldPos );
     }
commit ffcc9e80d81ebd3e3618f262a2dbc51da4e59a43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jul 11 11:41:50 2011 +0100

    check seeks for success against short reads

diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index 0960352..2588018 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -78,9 +78,20 @@ public:
     bool        IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
     sal_uLong   GetRecBegFilePos() const { return nFilePos; }
     sal_uLong   GetRecEndFilePos() const { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
-    void SeekToEndOfRecord(SvStream& rIn) const { rIn.Seek(nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen ); }
-    void SeekToContent(    SvStream& rIn) const { rIn.Seek(nFilePos + DFF_COMMON_RECORD_HEADER_SIZE ); }
-    void SeekToBegOfRecord(SvStream& rIn) const { rIn.Seek( nFilePos ); }
+    bool SeekToEndOfRecord(SvStream& rIn) const
+    {
+        sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
+        return nPos == rIn.Seek(nPos);
+    }
+    bool SeekToContent(SvStream& rIn) const
+    {
+        sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
+        return nPos == rIn.Seek(nPos);
+    }
+    bool SeekToBegOfRecord(SvStream& rIn) const
+    {
+        return nFilePos == rIn.Seek(nFilePos);
+    }
 
     MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec);
 
@@ -447,13 +458,13 @@ class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
     SvxMSDffShapeInfos*     pShapeInfos;
     SvxMSDffShapeOrders*    pShapeOrders;
     sal_uLong               nDefaultFontHeight;
-    long                    nOffsDgg;
+    sal_uInt32              nOffsDgg;
     sal_uInt16              nBLIPCount;
     sal_uInt16              nShapeCount;
     sal_uInt32              nGroupShapeFlags;
 
     void CheckTxBxStoryChain();
-    void GetFidclData( long nOffsDgg );
+    void GetFidclData(sal_uInt32 nOffsDgg);
 
 protected :
 
@@ -488,7 +499,7 @@ protected :
     */
     SvxMSDffShapeIdContainer    maShapeIdContainer;
 
-    void GetCtrlData( long nOffsDgg );
+    void GetCtrlData(sal_uInt32 nOffsDgg);
     void GetDrawingGroupContainerData( SvStream& rSt,
                                        sal_uLong nLenDgg );
     // #156763#
@@ -610,7 +621,7 @@ public:
 */
     SvxMSDffManager( SvStream& rStCtrl,
                      const String& rBaseURL,
-                     long      nOffsDgg,
+                     sal_uInt32 nOffsDgg,
                      SvStream* pStData,
                      SdrModel* pSdrModel_           =  0,
                      long      nApplicationScale    =  0,
@@ -622,7 +633,7 @@ public:
     // in PPT werden die Parameter DGGContainerOffset und PicStream
     // mit Hilfe einer Init Routine Uebergeben.
     SvxMSDffManager( SvStream& rStCtrl, const String& rBaseURL, MSFilterTracer* pTracer );
-    void InitSvxMSDffManager( long nOffsDgg_, SvStream* pStData_, sal_uInt32 nSvxMSDffOLEConvFlags );
+    void InitSvxMSDffManager(sal_uInt32 nOffsDgg_, SvStream* pStData_, sal_uInt32 nSvxMSDffOLEConvFlags);
     void SetDgContainer( SvStream& rSt );
 
     virtual ~SvxMSDffManager();
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index c3df91a..d8b72de 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -211,7 +211,9 @@ sal_Bool Impl_OlePres::Read( SvStream & rStm )
     }
 
     rStm.ResetError();
-    rStm.Seek( nBeginPos );
+    if (nBeginPos != rStm.Seek(nBeginPos))
+        return sal_False;
+
     nFormat = ReadClipboardFormat( rStm );
     // JobSetup, bzw. TargetDevice ueberlesen
     // Information aufnehmen, um sie beim Schreiben nicht zu verlieren
@@ -231,7 +233,7 @@ sal_Bool Impl_OlePres::Read( SvStream & rStm )
         rStm.SetError( SVSTREAM_GENERALERROR );
         return sal_False;
     }
-    sal_uInt32 nAsp;
+    sal_uInt32 nAsp(0);
     rStm >> nAsp;
     sal_uInt16 nSvAsp = sal_uInt16( nAsp );
     SetAspect( nSvAsp );
@@ -4572,7 +4574,9 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
     if( pShapeId )
         *pShapeId = 0;
 
-    rHd.SeekToContent( rSt );
+    if (!rHd.SeekToContent(rSt))
+        return pRet;
+
     DffRecordHeader aRecHd;		// the first atom has to be the SpContainer for the GroupObject
     rSt >> aRecHd;
     if ( aRecHd.nRecType == DFF_msofbtSpContainer )
@@ -4580,7 +4584,8 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
         sal_Int32 nGroupRotateAngle = 0;
         sal_Int32 nSpFlags = 0;
         mnFix16Angle = 0;
-        aRecHd.SeekToBegOfRecord( rSt );
+        if (!aRecHd.SeekToBegOfRecord(rSt))
+            return pRet;
         pRet = ImportObj( rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId );
         if ( pRet )
         {
@@ -4608,7 +4613,9 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
             }
 
             // now importing the inner objects of the group
-            aRecHd.SeekToEndOfRecord( rSt );
+            if (!aRecHd.SeekToEndOfRecord(rSt))
+                return pRet;
+
             while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) )
             {
                 DffRecordHeader aRecHd2;
@@ -4617,7 +4624,8 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                 {
                     Rectangle aGroupClientAnchor, aGroupChildAnchor;
                     GetGroupAnchors( aRecHd2, rSt, aGroupClientAnchor, aGroupChildAnchor, aClientRect, aGlobalChildRect );
-                    aRecHd2.SeekToBegOfRecord( rSt );
+                    if (!aRecHd2.SeekToBegOfRecord(rSt))
+                        return pRet;
                     sal_Int32 nShapeId;
                     SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId );
                     if ( pTmp && pRet && ((SdrObjGroup*)pRet)->GetSubList() )
@@ -4629,7 +4637,8 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                 }
                 else if ( aRecHd2.nRecType == DFF_msofbtSpContainer )
                 {
-                    aRecHd2.SeekToBegOfRecord( rSt );
+                    if (!aRecHd2.SeekToBegOfRecord(rSt))
+                        return pRet;
                     sal_Int32 nShapeId;
                     SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId );
                     if ( pTmp && pRet && ((SdrObjGroup*)pRet)->GetSubList())
@@ -4639,7 +4648,8 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r
                             insertShapeId( nShapeId, pTmp );
                     }
                 }
-                aRecHd2.SeekToEndOfRecord( rSt );
+                if (!aRecHd2.SeekToEndOfRecord(rSt))
+                    return pRet;
             }
 
             if ( nGroupRotateAngle )
@@ -4673,7 +4683,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
     if( pShapeId )
         *pShapeId = 0;
 
-    rHd.SeekToBegOfRecord( rSt );
+    if (!rHd.SeekToBegOfRecord(rSt))
+        return pRet;
+
     DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
     maShapeRecords.Consume( rSt, sal_False );
     aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING );
@@ -4701,7 +4713,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
     aObjData.bOpt = maShapeRecords.SeekToContent( rSt, DFF_msofbtOPT, SEEK_FROM_CURRENT_AND_RESTART );
     if ( aObjData.bOpt )
     {
-        maShapeRecords.Current()->SeekToBegOfRecord( rSt );
+        if (!maShapeRecords.Current()->SeekToBegOfRecord(rSt))
+            return pRet;
 #ifdef DBG_AUTOSHAPE
         ReadPropSet( rSt, pClientData, (sal_uInt32)aObjData.eShapeType );
 #else
@@ -5265,7 +5278,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
 Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect )
 {
     Rectangle aChildAnchor;
-    rHd.SeekToContent( rSt );
+    if (!rHd.SeekToContent(rSt))
+        return aChildAnchor;
+
     while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) )
     {
         DffRecordHeader aShapeHd;
@@ -5316,10 +5331,12 @@ Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvS
                     aChildAnchor.Union( aChild );
                     break;
                 }
-                aShapeAtom.SeekToEndOfRecord( rSt );
+                if (!aShapeAtom.SeekToEndOfRecord(rSt))
+                    break;
             }
         }
-        aShapeHd.SeekToEndOfRecord( rSt );
+        if (!aShapeHd.SeekToEndOfRecord(rSt))
+            break;
     }
     return aChildAnchor;
 }
@@ -5328,8 +5345,10 @@ void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt
                             Rectangle& rGroupClientAnchor, Rectangle& rGroupChildAnchor,
                                 const Rectangle& rClientRect, const Rectangle& rGlobalChildRect )
 {
+    if (!rHd.SeekToContent(rSt))
+        return;
+
     sal_Bool bFirst = sal_True;
-    rHd.SeekToContent( rSt );
     DffRecordHeader aShapeHd;
     while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) )
     {
@@ -5376,10 +5395,12 @@ void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt
                         rGroupChildAnchor.Union( aChild );
                     break;
                 }
-                aShapeAtom.SeekToEndOfRecord( rSt );
+                if (!aShapeAtom.SeekToEndOfRecord(rSt))
+                    break;
             }
         }
-        aShapeHd.SeekToEndOfRecord( rSt );
+        if (!aShapeHd.SeekToEndOfRecord(rSt))
+            break;
     }
 }
 
@@ -5971,7 +5992,7 @@ SV_IMPL_OP_PTRARR_SORT(MSDffImportRecords, MSDffImportRec_Ptr)
 
 SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_,
                                  const String& rBaseURL,
-                                 long      nOffsDgg_,
+                                 sal_uInt32 nOffsDgg_,
                                  SvStream* pStData_,
                                  SdrModel* pSdrModel_,// s. unten: SetModel()
                                  long      nApplicationScale,
@@ -6067,7 +6088,7 @@ SvxMSDffManager::~SvxMSDffManager()
     delete[] mpFidcls;
 }
 
-void SvxMSDffManager::InitSvxMSDffManager( long nOffsDgg_, SvStream* pStData_, sal_uInt32 nOleConvFlags )
+void SvxMSDffManager::InitSvxMSDffManager( sal_uInt32 nOffsDgg_, SvStream* pStData_, sal_uInt32 nOleConvFlags )
 {
     nOffsDgg = nOffsDgg_;
     pStData = pStData_;
@@ -6107,13 +6128,15 @@ void SvxMSDffManager::SetDgContainer( SvStream& rSt )
     }
 }
 
-void SvxMSDffManager::GetFidclData( long nOffsDggL )
+void SvxMSDffManager::GetFidclData( sal_uInt32 nOffsDggL )
 {
-    if ( nOffsDggL )
-    {
-        sal_uInt32 nDummy, nMerk = rStCtrl.Tell();
-        rStCtrl.Seek( nOffsDggL );
+    if (!nOffsDggL)
+        return;
+
+    sal_uInt32 nDummy, nMerk = rStCtrl.Tell();
 
+    if (nOffsDggL == rStCtrl.Seek(nOffsDggL))
+    {
         DffRecordHeader aRecHd;
         rStCtrl >> aRecHd;
 
@@ -6139,8 +6162,8 @@ void SvxMSDffManager::GetFidclData( long nOffsDggL )
                 }
             }
         }
-        rStCtrl.Seek( nMerk );
     }
+    rStCtrl.Seek( nMerk );
 }
 
 void SvxMSDffManager::CheckTxBxStoryChain()
@@ -6217,13 +6240,14 @@ void SvxMSDffManager::CheckTxBxStoryChain()
     und merken des File-Offsets fuer jedes Blip
                    ============
 ******************************************************************************/
-void SvxMSDffManager::GetCtrlData( long nOffsDgg_ )
+void SvxMSDffManager::GetCtrlData( sal_uInt32 nOffsDgg_ )
 {
     // Start Offset unbedingt merken, falls wir nochmal aufsetzen muessen
-    long nOffsDggL = nOffsDgg_;
+    sal_uInt32 nOffsDggL = nOffsDgg_;
 
     // Kontroll Stream positionieren
-    rStCtrl.Seek( nOffsDggL );
+    if (nOffsDggL != rStCtrl.Seek(nOffsDggL))
+        return;
 
     sal_uInt8   nVer;
     sal_uInt16 nInst;
@@ -6239,21 +6263,23 @@ void SvxMSDffManager::GetCtrlData( long nOffsDgg_ )
     {
         GetDrawingGroupContainerData( rStCtrl, nLength );
 
-         rStCtrl.Seek( STREAM_SEEK_TO_END );
+        rStCtrl.Seek( STREAM_SEEK_TO_END );
         sal_uInt32 nMaxStrPos = rStCtrl.Tell();
 
         nPos += nLength;
         unsigned long nDrawingContainerId = 1;
         do
         {
-            rStCtrl.Seek( nPos );
+            if (nPos != rStCtrl.Seek(nPos))
+                break;
 
             bOk = ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength ) && ( DFF_msofbtDgContainer == nFbt );
 
             if( !bOk )
             {
                 nPos++;
-                rStCtrl.Seek( nPos );
+                if (nPos != rStCtrl.Seek(nPos))
+                    break;
                 bOk = ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength )
                         && ( DFF_msofbtDgContainer == nFbt );
             }


More information about the Libreoffice-commits mailing list