diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-01 19:01:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-01 19:51:18 +0100 |
commit | 537fff14c233ad85a22588557ff0e9a3caeea155 (patch) | |
tree | c3e425a2aca86b9fd35f03181fbf013b279b2804 | |
parent | adjust cgm import to make testing easier (diff) | |
download | core-537fff14c233ad85a22588557ff0e9a3caeea155.tar.gz core-537fff14c233ad85a22588557ff0e9a3caeea155.zip |
CGM_IMPORT_CGM is always used
Change-Id: I77616b97970486aa6bb3c9af577d4bb412c35ca2
-rw-r--r-- | filter/source/graphicfilter/icgm/cgm.cxx | 53 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/cgm.hxx | 1 | ||||
-rw-r--r-- | sd/source/filter/cgm/sdcgmfilter.cxx | 5 |
3 files changed, 27 insertions, 32 deletions
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index 3e9e0fcdf05e..0183cb2fc539 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -717,42 +717,39 @@ ImportCGM(SvStream& rIn, uno::Reference< frame::XModel > const & rXModel, sal_uI try { std::unique_ptr<CGM> pCGM(new CGM( nMode, rXModel )); - if ( pCGM && pCGM->IsValid() ) + if (pCGM && pCGM->IsValid()) { - if ( nMode & CGM_IMPORT_CGM ) - { - rIn.SetEndian(SvStreamEndian::BIG); - sal_uInt64 const nInSize = rIn.remainingSize(); - rIn.Seek(0); + rIn.SetEndian(SvStreamEndian::BIG); + sal_uInt64 const nInSize = rIn.remainingSize(); + rIn.Seek(0); - sal_uInt32 nNext = 0; - sal_uInt32 nAdd = nInSize / 20; - bool bProgressBar = aXStatInd.is(); - if ( bProgressBar ) - aXStatInd->start( "CGM Import" , nInSize ); + sal_uInt32 nNext = 0; + sal_uInt32 nAdd = nInSize / 20; + bool bProgressBar = aXStatInd.is(); + if ( bProgressBar ) + aXStatInd->start( "CGM Import" , nInSize ); - while (pCGM->IsValid() && (rIn.Tell() < nInSize) && !pCGM->IsFinished()) + while (pCGM->IsValid() && (rIn.Tell() < nInSize) && !pCGM->IsFinished()) + { + if ( bProgressBar ) { - if ( bProgressBar ) + sal_uInt32 nCurrentPos = rIn.Tell(); + if ( nCurrentPos >= nNext ) { - sal_uInt32 nCurrentPos = rIn.Tell(); - if ( nCurrentPos >= nNext ) - { - aXStatInd->setValue( nCurrentPos ); - nNext = nCurrentPos + nAdd; - } + aXStatInd->setValue( nCurrentPos ); + nNext = nCurrentPos + nAdd; } - - if (!pCGM->Write(rIn)) - break; } - if ( pCGM->IsValid() ) - { - nStatus = pCGM->GetBackGroundColor() | 0xff000000; - } - if ( bProgressBar ) - aXStatInd->end(); + + if (!pCGM->Write(rIn)) + break; + } + if ( pCGM->IsValid() ) + { + nStatus = pCGM->GetBackGroundColor() | 0xff000000; } + if ( bProgressBar ) + aXStatInd->end(); } } catch (const css::uno::Exception&) diff --git a/filter/source/graphicfilter/icgm/cgm.hxx b/filter/source/graphicfilter/icgm/cgm.hxx index 777e53913e24..a9e8fbffb70d 100644 --- a/filter/source/graphicfilter/icgm/cgm.hxx +++ b/filter/source/graphicfilter/icgm/cgm.hxx @@ -22,7 +22,6 @@ #include <com/sun/star/frame/XModel.hpp> -#define CGM_IMPORT_CGM 0x00000001 #define CGM_EXPORT_IMPRESS 0x00000100 #include <rtl/ustring.hxx> diff --git a/sd/source/filter/cgm/sdcgmfilter.cxx b/sd/source/filter/cgm/sdcgmfilter.cxx index 6837343e6e79..1dc775256435 100644 --- a/sd/source/filter/cgm/sdcgmfilter.cxx +++ b/sd/source/filter/cgm/sdcgmfilter.cxx @@ -33,7 +33,6 @@ #include "../../ui/inc/DrawDocShell.hxx" -#define CGM_IMPORT_CGM 0x00000001 #define CGM_EXPORT_IMPRESS 0x00000100 #define CGM_BIG_ENDIAN 0x00020000 @@ -97,7 +96,7 @@ bool SdCGMFilter::Import() CreateStatusIndicator(); std::unique_ptr<SvStream> xIn(::utl::UcbStreamHelper::CreateStream(aFileURL, StreamMode::READ)); - nRetValue = xIn ? FncImportCGM(*xIn, mxModel, CGM_IMPORT_CGM | CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, mxStatusIndicator) : 0; + nRetValue = xIn ? FncImportCGM(*xIn, mxModel, CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, mxStatusIndicator) : 0; if( nRetValue ) { @@ -135,7 +134,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportCGM(SvStream &rStream) CGMPointer aPointer; - bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), CGM_IMPORT_CGM | CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, css::uno::Reference<css::task::XStatusIndicator>()) == 0; + bool bRet = aPointer.get()(rStream, xDocShRef->GetModel(), CGM_BIG_ENDIAN | CGM_EXPORT_IMPRESS, css::uno::Reference<css::task::XStatusIndicator>()) == 0; xDocShRef->DoClose(); |