diff options
Diffstat (limited to 'svtools/source/filter.vcl')
52 files changed, 4122 insertions, 3829 deletions
diff --git a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx index 3c26d8cad9d4..c142aa1ce95d 100644 --- a/svtools/source/filter.vcl/filter/FilterConfigCache.cxx +++ b/svtools/source/filter.vcl/filter/FilterConfigCache.cxx @@ -47,7 +47,7 @@ using namespace ::com::sun::star::container ; // XNameAccess using namespace ::com::sun::star::uno ; // Reference using namespace ::com::sun::star::beans ; // PropertyValue using namespace ::utl ; // getProcessServiceFactory(); -using namespace ::rtl ; +using ::rtl::OUString; const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] = { diff --git a/svtools/source/filter.vcl/filter/FilterConfigItem.cxx b/svtools/source/filter.vcl/filter/FilterConfigItem.cxx index 8ad858a1d877..fddeec1f0482 100644 --- a/svtools/source/filter.vcl/filter/FilterConfigItem.cxx +++ b/svtools/source/filter.vcl/filter/FilterConfigItem.cxx @@ -39,7 +39,7 @@ #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> -using namespace ::rtl; +using ::rtl::OUString; using namespace ::utl ; // getProcessServiceFactory using namespace ::com::sun::star::lang ; // XMultiServiceFactory using namespace ::com::sun::star::beans ; // PropertyValue @@ -429,7 +429,7 @@ void FilterConfigItem::WriteBool( const OUString& rKey, sal_Bool bNewValue ) Any aAny; if ( ImplGetPropertyValue( aAny, xPropSet, rKey, sal_True ) ) { - sal_Bool bOldValue; + sal_Bool bOldValue(sal_True); if ( aAny >>= bOldValue ) { if ( bOldValue != bNewValue ) @@ -463,7 +463,7 @@ void FilterConfigItem::WriteInt32( const OUString& rKey, sal_Int32 nNewValue ) if ( ImplGetPropertyValue( aAny, xPropSet, rKey, sal_True ) ) { - sal_Int32 nOldValue; + sal_Int32 nOldValue = 0; if ( aAny >>= nOldValue ) { if ( nOldValue != nNewValue ) diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx index efe020b1cbda..6f78dd19fb6e 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx @@ -37,9 +37,7 @@ #include <osl/module.hxx> #include <svl/solar.hrc> #include <svtools/fltcall.hxx> -#include "dlgexpor.hxx" -#include "dlgejpg.hxx" -#include "dlgepng.hxx" +#include "exportdialog.hxx" #include <uno/mapping.hxx> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/document/XViewDataSupplier.hpp> @@ -50,12 +48,6 @@ #include <unotools/syslocale.hxx> #include "vcl/svapp.hxx" -#if defined WIN || (defined OS2 && !defined ICC) -#define EXPDLG_FUNCTION_NAME "_DoExportDialog" -#else -#define EXPDLG_FUNCTION_NAME "DoExportDialog" -#endif - using namespace ::rtl; using namespace ::com::sun::star; @@ -94,9 +86,10 @@ uno::Sequence< OUString > SAL_CALL SvFilterOptionsDialog_getSupportedServiceName // ----------------------------------------------------------------------------- -SvFilterOptionsDialog::SvFilterOptionsDialog( const uno::Reference< lang::XMultiServiceFactory > & xMgr ) : - rxMgr ( xMgr ), - eFieldUnit ( FUNIT_CM ) +SvFilterOptionsDialog::SvFilterOptionsDialog( const uno::Reference< lang::XMultiServiceFactory > xMgr ) : + mxMgr ( xMgr ), + meFieldUnit ( FUNIT_CM ), + mbExportSelection ( sal_False ) { } @@ -149,18 +142,18 @@ uno::Sequence< beans::PropertyValue > SvFilterOptionsDialog::getPropertyValues() throw ( uno::RuntimeException ) { sal_Int32 i, nCount; - for ( i = 0, nCount = aMediaDescriptor.getLength(); i < nCount; i++ ) + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( aMediaDescriptor[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FilterData")) ) + if ( maMediaDescriptor[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FilterData")) ) break; } if ( i == nCount ) - aMediaDescriptor.realloc( ++nCount ); + maMediaDescriptor.realloc( ++nCount ); // the "FilterData" Property is an Any that will contain our PropertySequence of Values - aMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) ); - aMediaDescriptor[ i ].Value <<= aFilterDataSequence; - return aMediaDescriptor; + maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( "FilterData" ) ); + maMediaDescriptor[ i ].Value <<= maFilterDataSequence; + return maMediaDescriptor; } void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::PropertyValue > & aProps ) @@ -168,15 +161,18 @@ void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::Prope lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException ) { - aMediaDescriptor = aProps; + maMediaDescriptor = aProps; sal_Int32 i, nCount; - for ( i = 0, nCount = aMediaDescriptor.getLength(); i < nCount; i++ ) + for ( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ ) { - if ( aMediaDescriptor[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FilterData")) ) + if ( maMediaDescriptor[ i ].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FilterData")) ) { - aMediaDescriptor[ i ].Value >>= aFilterDataSequence; - break; + maMediaDescriptor[ i ].Value >>= maFilterDataSequence; + } + else if ( maMediaDescriptor[ i ].Name.equalsAscii( "SelectionOnly" ) ) + { + maMediaDescriptor[ i ].Value >>= mbExportSelection; } } } @@ -185,7 +181,7 @@ void SvFilterOptionsDialog::setPropertyValues( const uno::Sequence< beans::Prope void SvFilterOptionsDialog::setTitle( const OUString& aTitle ) throw ( uno::RuntimeException ) { - aDialogTitle = aTitle; + maDialogTitle = aTitle; } sal_Int16 SvFilterOptionsDialog::execute() @@ -195,13 +191,13 @@ sal_Int16 SvFilterOptionsDialog::execute() String aFilterNameStr( RTL_CONSTASCII_USTRINGPARAM( "FilterName" ) ); String aInternalFilterName; - sal_Int32 j, nCount = aMediaDescriptor.getLength(); + sal_Int32 j, nCount = maMediaDescriptor.getLength(); for ( j = 0; j < nCount; j++ ) { - if ( aMediaDescriptor[ j ].Name.equals( aFilterNameStr ) ) + if ( maMediaDescriptor[ j ].Name.equals( aFilterNameStr ) ) { OUString aStr; - aMediaDescriptor[ j ].Value >>= aStr; + maMediaDescriptor[ j ].Value >>= aStr; aInternalFilterName = aStr; aInternalFilterName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "draw_" ) ), String(), 0 ); aInternalFilterName.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "impress_" ) ), String(), 0 ); @@ -220,79 +216,24 @@ sal_Int16 SvFilterOptionsDialog::execute() } if ( nFormat < nFilterCount ) { - FltCallDialogParameter aFltCallDlgPara( Application::GetDefDialogParent(), NULL, eFieldUnit ); - aFltCallDlgPara.aFilterData = aFilterDataSequence; - - String aFilterName( aGraphicFilter.pConfig->GetExportFilterName( nFormat ) ); - if ( aGraphicFilter.pConfig->IsExportInternalFilter( nFormat ) ) - { - // Export-Dialog fuer Bitmap's, SVM's und WMF's - if( ( aFilterName.EqualsIgnoreCaseAscii( EXP_BMP ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_SVMETAFILE ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_WMF ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_EMF ) ) || - ( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) )|| - ( aFilterName.EqualsIgnoreCaseAscii( EXP_PNG ) ) ) - { - ByteString aResMgrName( "svt", 3 ); - ResMgr* pResMgr; - - pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); - aFltCallDlgPara.pResMgr = pResMgr; - // JPEG-Dialog - if( aFilterName.EqualsIgnoreCaseAscii( EXP_JPEG ) ) - { - if ( DlgExportEJPG( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else if ( aFilterName.EqualsIgnoreCaseAscii( EXP_PNG ) ) - { - if ( DlgExportEPNG( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else if( aFilterName.EqualsIgnoreCaseAscii( EXP_BMP ) ) - { - // Fuer Vektorformate nehmen wir den Vektor-Dialog - aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); - if ( DlgExportPix( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - else - { - aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); - if ( DlgExportVec( aFltCallDlgPara ).Execute() == RET_OK ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - delete pResMgr; - } - } - else // ladbare Filter - { - xub_StrLen i, nTokenCount = aGraphicFilter.aFilterPath.GetTokenCount( ';' ); - for ( i = 0; i < nTokenCount; i++ ) - { - - OUString aPathURL; - - ::osl::FileBase::getFileURLFromSystemPath( aGraphicFilter.aFilterPath.GetToken( i ), aPathURL ); - aPathURL += String( '/' ); - - OUString aSystemPath; - ::osl::FileBase::getSystemPathFromFileURL( aPathURL, aSystemPath ); - aSystemPath += OUString( aFilterName ); - - osl::Module aLibrary( aSystemPath ); - PFilterDlgCall pFunc = (PFilterDlgCall) aLibrary.getFunctionSymbol( UniString::CreateFromAscii( EXPDLG_FUNCTION_NAME ) ); - // Dialog in DLL ausfuehren - if( pFunc ) - { - if ( (*pFunc)( aFltCallDlgPara ) ) - nRet = ui::dialogs::ExecutableDialogResults::OK; - } - } - } + FltCallDialogParameter aFltCallDlgPara( Application::GetDefDialogParent(), NULL, meFieldUnit ); + aFltCallDlgPara.aFilterData = maFilterDataSequence; + + ByteString aResMgrName( "svt", 3 ); + ResMgr* pResMgr; + + pResMgr = ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ); + aFltCallDlgPara.pResMgr = pResMgr; + + aFltCallDlgPara.aFilterExt = aGraphicFilter.pConfig->GetExportFormatShortName( nFormat ); + sal_Bool bIsPixelFormat( aGraphicFilter.pConfig->IsExportPixelFormat( nFormat ) ); + if ( ExportDialog( aFltCallDlgPara, mxMgr, mxSourceDocument, mbExportSelection, bIsPixelFormat ).Execute() == RET_OK ) + nRet = ui::dialogs::ExecutableDialogResults::OK; + + delete pResMgr; + // taking the out parameter from the dialog - aFilterDataSequence = aFltCallDlgPara.aFilterData; + maFilterDataSequence = aFltCallDlgPara.aFilterData; } } return nRet; @@ -302,6 +243,8 @@ sal_Int16 SvFilterOptionsDialog::execute() void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) throw ( lang::IllegalArgumentException, uno::RuntimeException ) { + mxSourceDocument = xDoc; + // try to set the corresponding metric unit String aConfigPath; uno::Reference< lang::XServiceInfo > xServiceInfo @@ -321,7 +264,7 @@ void SvFilterOptionsDialog::setSourceDocument( const uno::Reference< lang::XComp aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "Metric" ) ); else aPropertyName = String( RTL_CONSTASCII_USTRINGPARAM( "NonMetric" ) ); - eFieldUnit = (FieldUnit)aConfigItem.ReadInt32( aPropertyName, FUNIT_CM ); + meFieldUnit = (FieldUnit)aConfigItem.ReadInt32( aPropertyName, FUNIT_CM ); } } } diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx index 3e9fce6cf4ca..6cc10d98d6a7 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.hxx @@ -29,7 +29,7 @@ #ifndef _SV_FILTER_OPTIONS_DIALOG_HXX_ #define _SV_FILTER_OPTIONS_DIALOG_HXX_ -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> #include <cppuhelper/implbase5.hxx> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -47,18 +47,22 @@ class SvFilterOptionsDialog : public cppu::WeakImplHelper5 com::sun::star::lang::XServiceInfo > { - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & - rxMgr; + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + mxMgr; com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - aMediaDescriptor; + maMediaDescriptor; com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > - aFilterDataSequence; - rtl::OUString aDialogTitle; - FieldUnit eFieldUnit; + maFilterDataSequence; + com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + mxSourceDocument; + + rtl::OUString maDialogTitle; + FieldUnit meFieldUnit; + sal_Bool mbExportSelection; public: - SvFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + SvFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > _rxORB ); ~SvFilterOptionsDialog(); // XInterface diff --git a/svtools/source/filter.vcl/filter/dlgejpg.cxx b/svtools/source/filter.vcl/filter/dlgejpg.cxx deleted file mode 100644 index 4cedaf70e509..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "dlgejpg.hxx" -#include "dlgejpg.hrc" -#include "strings.hrc" -#include <svtools/FilterConfigItem.hxx> - -#define KEY_QUALITY "Quality" -#define KEY_GRAYSCALES "ColorMode" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEJPG::DlgExportEJPG( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_JPG, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aFiDescr ( this, ResId( FI_DESCR, *rPara.pResMgr ) ), - aNumFldQuality ( this, ResId( NUM_FLD_QUALITY, *rPara.pResMgr ) ), - aGrpQuality ( this, ResId( GRP_QUALITY, *rPara.pResMgr ) ), - aRbGray ( this, ResId( RB_GRAY, *rPara.pResMgr ) ), - aRbRGB ( this, ResId( RB_RGB, *rPara.pResMgr ) ), - aGrpColors ( this, ResId( GRP_COLORS, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ) -{ - FreeResource(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/JPG" ) ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - // reading filter options - sal_Int32 nQuality = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), 75 ); - sal_Int32 nColorMode = pConfigItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), 0 ); - aNumFldQuality.SetValue( nQuality ); - - if ( nColorMode ) - aRbGray.Check( sal_True ); - else - aRbRGB.Check( sal_True ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEJPG, OK ) ); -} - - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEJPG, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_QUALITY ) ), (sal_Int32)aNumFldQuality.GetValue() ); - pConfigItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( KEY_GRAYSCALES ) ), aRbGray.IsChecked() ? 1 : 0 ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - return 0; -} - -DlgExportEJPG::~DlgExportEJPG() -{ - delete pConfigItem; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc deleted file mode 100644 index fae40f4c3f6f..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.hrc +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define FI_DESCR 1 -#define NUM_FLD_QUALITY 1 -#define GRP_QUALITY 1 -#define GRP_COLORS 2 -#define RB_GRAY 1 -#define RB_RGB 2 diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hxx b/svtools/source/filter.vcl/filter/dlgejpg.hxx deleted file mode 100644 index efc5daa7105c..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEJPG_HXX_ -#define _DLGEJPG_HXX_ - -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/stdctrl.hxx> -#include <svtools/fltcall.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ -class FilterConfigItem; -class DlgExportEJPG : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - FixedInfo aFiDescr; - NumericField aNumFldQuality; - FixedLine aGrpQuality; - RadioButton aRbGray; - RadioButton aRbRGB; - FixedLine aGrpColors; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - FilterConfigItem* pConfigItem; - - DECL_LINK( OK, void * ); - -public: - DlgExportEJPG( FltCallDialogParameter& rDlgPara ); - ~DlgExportEJPG(); -}; - -#endif // _DLGEJPG_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/dlgejpg.src b/svtools/source/filter.vcl/filter/dlgejpg.src deleted file mode 100644 index 0817f7cbf3c7..000000000000 --- a/svtools/source/filter.vcl/filter/dlgejpg.src +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgejpg.hrc" -ModalDialog DLG_EXPORT_JPG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 159 , 92 ) ; - Text [ en-US ] = "JPEG Options" ; - Moveable = TRUE ; - Closeable = TRUE ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 103 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 103 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 103 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_QUALITY - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Quality" ; - }; - FixedText FI_DESCR - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 81 , 16 ) ; - Text [ en-US ] = "1: min. quality\n100: max. quality" ; - }; - NumericField NUM_FLD_QUALITY - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 33 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Minimum = 1; - Maximum = 100 ; - StrictFormat = TRUE ; - Last = 100 ; - Repeat = TRUE ; - }; - FixedLine GRP_COLORS - { - Pos = MAP_APPFONT ( 6 , 51 ) ; - Size = MAP_APPFONT ( 90 , 8 ) ; - Text [ en-US ] = "Color resolution" ; - }; - RadioButton RB_GRAY - { - Pos = MAP_APPFONT ( 12 , 62 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "Grayscale" ; - }; - RadioButton RB_RGB - { - Pos = MAP_APPFONT ( 12 , 76 ) ; - Size = MAP_APPFONT ( 81 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "True Colors" ; - }; -}; diff --git a/svtools/source/filter.vcl/filter/dlgepng.cxx b/svtools/source/filter.vcl/filter/dlgepng.cxx deleted file mode 100644 index 1b400cba87c6..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.cxx +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <tools/ref.hxx> -#include <vcl/msgbox.hxx> -#include "dlgepng.hxx" -#include "dlgepng.hrc" - -using namespace ::rtl; -using namespace ::com::sun::star::uno; - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportEPNG::DlgExportEPNG( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_EPNG, *rPara.pResMgr ) ), - FilterConfigItem ( OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/PNG" ) ), &rPara.aFilterData ), - rFltCallPara ( rPara ), - aGrpCompression ( this, ResId( GRP_COMPRESSION, *rPara.pResMgr ) ), - aFiCompression ( this, ResId( FI_COMPRESSION, *rPara.pResMgr ) ), - aNumCompression ( this, ResId( NUM_COMPRESSION, *rPara.pResMgr ) ), - aCbxInterlaced ( this, ResId( CBX_INTERLACED, *rPara.pResMgr ) ), - aBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ) -{ - FreeResource(); - - // Config-Parameter lesen - sal_Int32 nCompression = ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), 6 ); - if ( ( nCompression < 0 ) || ( nCompression > 9 ) ) - nCompression = 6; - aNumCompression.SetValue( nCompression ); - - sal_Int32 nInterlaced = ReadInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ); - sal_Bool bInterlaced = nInterlaced != 0; - aCbxInterlaced.Check( bInterlaced ); - - aBtnOK.SetClickHdl( LINK( this, DlgExportEPNG, OK ) ); -} - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportEPNG, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), static_cast<sal_Int32>(aNumCompression.GetValue()) ); - sal_Int32 nInterlace = 0; - if ( aCbxInterlaced.IsChecked() ) - nInterlace++; - WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nInterlace ); - rFltCallPara.aFilterData = GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc deleted file mode 100644 index b3ffaab3ab1e..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.hrc +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 -#define GRP_COMPRESSION 1 -#define FI_COMPRESSION 1 -#define NUM_COMPRESSION 1 -#define CBX_INTERLACED 1 diff --git a/svtools/source/filter.vcl/filter/dlgepng.hxx b/svtools/source/filter.vcl/filter/dlgepng.hxx deleted file mode 100644 index b43feafc0d49..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.hxx +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEPNG_HXX_ -#define _DLGEPNG_HXX_ -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <svtools/stdctrl.hxx> -#include <svtools/FilterConfigItem.hxx> - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen -|* -\************************************************************************/ - -class ResMgr; - -class DlgExportEPNG : public ModalDialog, FilterConfigItem -{ - - private: - - FltCallDialogParameter& rFltCallPara; - - FixedLine aGrpCompression; - FixedInfo aFiCompression; - NumericField aNumCompression; - CheckBox aCbxInterlaced; - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - ResMgr* pMgr; - - DECL_LINK( OK, void * ); - - public: - - DlgExportEPNG( FltCallDialogParameter& rPara ); -}; - -#endif // _DLGEPNG_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/dlgepng.src b/svtools/source/filter.vcl/filter/dlgepng.src deleted file mode 100644 index 14c53ad8374b..000000000000 --- a/svtools/source/filter.vcl/filter/dlgepng.src +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "dlgepng.hrc" -ModalDialog DLG_EXPORT_EPNG -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 169 , 64 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - Text [ en-US ] = "PNG Options" ; - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 113 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL - { - Pos = MAP_APPFONT ( 113 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 113 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - FixedLine GRP_COMPRESSION - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 100 , 8 ) ; - Text[ en-US ] = "Mode"; - }; - FixedText FI_COMPRESSION - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 80 , 8 ) ; - Text[ en-US ] = "~Compression 0..9"; - }; - NumericField NUM_COMPRESSION - { - Border = TRUE ; - Pos = MAP_APPFONT ( 12 , 25 ) ; - Size = MAP_APPFONT ( 40 , 12 ) ; - TabStop = TRUE ; - Spin = TRUE ; - Minimum = 0 ; - Maximum = 9 ; - First = 0 ; - Last = 9 ; - StrictFormat = TRUE ; - Repeat = TRUE ; - }; - CheckBox CBX_INTERLACED - { - Pos = MAP_APPFONT ( 12 , 43 ) ; - Size = MAP_APPFONT ( 80 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Interlaced" ; - }; -}; diff --git a/svtools/source/filter.vcl/filter/dlgexpor.cxx b/svtools/source/filter.vcl/filter/dlgexpor.cxx deleted file mode 100644 index 951dd2c1a551..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.cxx +++ /dev/null @@ -1,444 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#ifndef GCC -# pragma hdrstop -#endif - -#include <tools/ref.hxx> -#include <svtools/FilterConfigItem.hxx> -#include <com/sun/star/awt/Size.hpp> -#include <vcl/msgbox.hxx> -#include "dlgexpor.hxx" -#include "dlgexpor.hrc" -#include "strings.hrc" - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportPix::DlgExportPix( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_PIX, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK_PIX, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL_PIX, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP_PIX, *rPara.pResMgr ) ), - aLbColors ( this, ResId( LB_COLORS, *rPara.pResMgr ) ), - aCbxRLE ( this, ResId( CBX_RLE, *rPara.pResMgr ) ), - aGrpColors ( this, ResId( GRP_COLORS, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL_PIX, *rPara.pResMgr ) ), - aRbRes ( this, ResId( RB_RES_PIX, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE_PIX, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX_PIX, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX_PIX, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY_PIX, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY_PIX, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE_PIX, *rPara.pResMgr ) ), - aCbbRes ( this, ResId( CBB_RES_PIX, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ), - aExt ( rPara.aFilterExt ) -{ - aExt.ToUpperAscii(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); - aFilterConfigPath.Append( aExt ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - String aTitle( aExt ); - FreeResource(); - - aBtnOK.SetClickHdl( LINK( this, DlgExportPix, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportPix, ClickRbOriginal ) ); - aRbRes.SetClickHdl( LINK( this, DlgExportPix, ClickRbRes ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportPix, ClickRbSize ) ); - aLbColors.SetSelectHdl( LINK( this, DlgExportPix, SelectLbColors ) ); - - aTitle.ToUpperAscii(); - aTitle += String( ResId( EXPORT_DIALOG_TITLE, *pMgr ) ); - SetText( aTitle ); - - // Config-Parameter lesen - sal_Int32 nColors = pConfigItem->ReadInt32( String( ResId( KEY_COLORS, *pMgr ) ), 0 ); - sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - sal_Int32 nRes = pConfigItem->ReadInt32( String( ResId( KEY_RES, *pMgr ) ), 75 ); - sal_Bool bRleCoding = pConfigItem->ReadBool( String( ResId( KEY_RLE_CODING, *pMgr ) ), sal_True ); - - aLbColors.SelectEntryPos( Min( (sal_uInt16) 7, (sal_uInt16)nColors ) ); - - String aStrRes( String::CreateFromInt32( nRes ) ); - aStrRes.Append( String( RTL_CONSTASCII_USTRINGPARAM( " DPI" ) ) ); - aCbbRes.SetText( aStrRes ); - - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aCbxRLE.Check( bRleCoding ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { -// case FUNIT_NONE : -// case FUNIT_KM : -// case FUNIT_PERCENT : -// case FUNIT_CUSTOM : -// case FUNIT_MILE : -// case FUNIT_FOOT : -// case FUNIT_M : - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - - default: - break; // -Wall multiple values not handled. - } - - switch ( nMode ) - { - case 2 : - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - break; - case 1 : - { - aRbRes.Check( TRUE ); - ClickRbRes( NULL ); - } - break; - default : - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } - break; - } - SelectLbColors( &aLbColors ); -} - -DlgExportPix::~DlgExportPix() -{ - delete pConfigItem; -} - - -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - - sal_Int32 nRes = Max( Min( aCbbRes.GetText().ToInt32(), sal_Int32( 600 ) ), sal_Int32( 75 ) ); - ::com::sun::star::awt::Size aSize( - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeX.GetValue()), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM )), - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeY.GetValue()), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM )) ); - - sal_Int32 nMode; - if ( aRbRes.IsChecked() ) - nMode = 1; - else if ( aRbSize.IsChecked() ) - nMode = 2; - else - nMode = 0; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nMode ); - pConfigItem->WriteInt32( String( ResId( KEY_RES, *pMgr ) ), nRes ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - pConfigItem->WriteInt32( String( ResId( KEY_COLORS, *pMgr ) ), (sal_Int32)aLbColors.GetSelectEntryPos() ); - pConfigItem->WriteBool( String( ResId( KEY_RLE_CODING, *pMgr ) ), aCbxRLE.IsChecked() ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbOriginal, void*, EMPTYARG ) -{ - aCbbRes.Disable(); - - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbRes, void*, EMPTYARG ) -{ - aCbbRes.Enable(); - - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, ClickRbSize, void*, EMPTYARG ) -{ - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - aCbbRes.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportPix, SelectLbColors, void*, EMPTYARG ) -{ - const USHORT nLbPos = aLbColors.GetSelectEntryPos(); - - if ( ( nLbPos >= 3 ) && ( nLbPos <= 6 ) ) - aCbxRLE.Enable(); - else - aCbxRLE.Disable(); - - return 0L; -} - - -/******************************************************************************/ - - -/************************************************************************* -|* -|* Ctor -|* -\************************************************************************/ - -DlgExportVec::DlgExportVec( FltCallDialogParameter& rPara ) : - ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT_VEC, *rPara.pResMgr ) ), - rFltCallPara ( rPara ), - aBtnOK ( this, ResId( BTN_OK_VEC, *rPara.pResMgr ) ), - aBtnCancel ( this, ResId( BTN_CANCEL_VEC, *rPara.pResMgr ) ), - aBtnHelp ( this, ResId( BTN_HELP_VEC, *rPara.pResMgr ) ), - aRbOriginal ( this, ResId( RB_ORIGINAL_VEC, *rPara.pResMgr ) ), - aRbSize ( this, ResId( RB_SIZE_VEC, *rPara.pResMgr ) ), - aGrpMode ( this, ResId( GRP_MODE_VEC, *rPara.pResMgr ) ), - aFtSizeX ( this, ResId( FT_SIZEX_VEC, *rPara.pResMgr ) ), - aMtfSizeX ( this, ResId( MTF_SIZEX_VEC, *rPara.pResMgr ) ), - aFtSizeY ( this, ResId( FT_SIZEY_VEC, *rPara.pResMgr ) ), - aMtfSizeY ( this, ResId( MTF_SIZEY_VEC, *rPara.pResMgr ) ), - aGrpSize ( this, ResId( GRP_SIZE_VEC, *rPara.pResMgr ) ), - pMgr ( rPara.pResMgr ), - aExt ( rPara.aFilterExt ) -{ - aExt.ToUpperAscii(); - String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); - aFilterConfigPath.Append( aExt ); - pConfigItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); - - String aTitle( aExt ); - FreeResource(); - - aBtnOK.SetClickHdl( LINK( this, DlgExportVec, OK ) ); - aRbOriginal.SetClickHdl( LINK( this, DlgExportVec, ClickRbOriginal ) ); - aRbSize.SetClickHdl( LINK( this, DlgExportVec, ClickRbSize ) ); - - aTitle.ToUpperAscii(); - aTitle += String( ResId( EXPORT_DIALOG_TITLE, *pMgr ) ); - SetText( aTitle ); - - // reading config-parameter - sal_Int32 nMode = pConfigItem->ReadInt32( String( ResId( KEY_MODE, *pMgr ) ), 0 ); - - ::com::sun::star::awt::Size aDefault( 10000, 10000 ); - ::com::sun::star::awt::Size aSize; - aSize = pConfigItem->ReadSize( String( ResId( KEY_SIZE, *pMgr ) ), aDefault ); - - aMtfSizeX.SetDefaultUnit( FUNIT_MM ); - aMtfSizeY.SetDefaultUnit( FUNIT_MM ); - aMtfSizeX.SetValue( aSize.Width ); - aMtfSizeY.SetValue( aSize.Height ); - - switch ( rPara.eFieldUnit ) - { -// case FUNIT_NONE : -// case FUNIT_KM : -// case FUNIT_PERCENT : -// case FUNIT_CUSTOM : -// case FUNIT_MILE : -// case FUNIT_FOOT : - case FUNIT_MM : - case FUNIT_CM : - case FUNIT_M : - case FUNIT_TWIP : - case FUNIT_POINT : - case FUNIT_PICA : - case FUNIT_INCH : - case FUNIT_100TH_MM : - { - aMtfSizeX.SetUnit( rPara.eFieldUnit ); - aMtfSizeY.SetUnit( rPara.eFieldUnit ); - } - break; - default: - break; // -Wall Multiple values not handled. - } - - switch ( nMode ) - { - case 1 : - { - aRbSize.Check( TRUE ); - ClickRbSize( NULL ); - } - break; - - default : - { - aRbOriginal.Check( TRUE ); - ClickRbOriginal( NULL ); - } - break; - } -} - -DlgExportVec::~DlgExportVec() -{ - delete pConfigItem; -} -/************************************************************************* -|* -|* Speichert eingestellte Werte in ini-Datei -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, OK, void *, EMPTYARG ) -{ - // Config-Parameter schreiben - ::com::sun::star::awt::Size aSize( - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeX.GetValue()), 2, aMtfSizeX.GetUnit(), MAP_100TH_MM )), - static_cast<long>(MetricField::ConvertDoubleValue( static_cast<double>(aMtfSizeY.GetValue()), 2, aMtfSizeY.GetUnit(), MAP_100TH_MM )) ); - - sal_Int32 nMode; - if ( aRbSize.IsChecked() ) - nMode = 1; - else - nMode = 0; - - pConfigItem->WriteInt32( String( ResId( KEY_MODE, *pMgr ) ), nMode ); - pConfigItem->WriteSize( String( ResId( KEY_SIZE, *pMgr ) ), aSize ); - rFltCallPara.aFilterData = pConfigItem->GetFilterData(); - EndDialog( RET_OK ); - - return 0; -} - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, ClickRbOriginal, void*, EMPTYARG ) -{ - aGrpSize.Disable(); - aFtSizeX.Disable(); - aMtfSizeX.Disable(); - aFtSizeY.Disable(); - aMtfSizeY.Disable(); - - return 0; -} - - -/************************************************************************* -|* -|* Enabled/Disabled Controls -|* -\************************************************************************/ - -IMPL_LINK( DlgExportVec, ClickRbSize, void*, EMPTYARG ) -{ - aGrpSize.Enable(); - aFtSizeX.Enable(); - aMtfSizeX.Enable(); - aFtSizeY.Enable(); - aMtfSizeY.Enable(); - - return 0; -} - - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc deleted file mode 100644 index 69870c9b00b0..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.hrc +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> - -#define BTN_OK_PIX 1 -#define BTN_CANCEL_PIX 1 -#define BTN_HELP_PIX 1 -#define CBX_RES_PIX 1 -#define CBX_SIZE_PIX 2 -#define CBX_RLE 3 -#define CBB_RES_PIX 1 -#define LB_COLORS 1 -#define MTF_SIZEX_PIX 1 -#define MTF_SIZEY_PIX 2 -#define FT_SIZEX_PIX 1 -#define FT_SIZEY_PIX 2 -#define GRP_MODE_PIX 1 -#define GRP_COLORS 4 -#define RB_ORIGINAL_PIX 1 -#define RB_RES_PIX 2 -#define RB_SIZE_PIX 3 - -#define BTN_OK_VEC 1 -#define BTN_CANCEL_VEC 1 -#define BTN_HELP_VEC 1 -#define CBX_SIZE_VEC 2 -#define MTF_SIZEX_VEC 1 -#define MTF_SIZEY_VEC 2 -#define FT_SIZEX_VEC 1 -#define FT_SIZEY_VEC 2 -#define GRP_SIZE_VEC 1 -#define GRP_MODE_VEC 2 -#define RB_ORIGINAL_VEC 1 -#define RB_SIZE_VEC 2 diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hxx b/svtools/source/filter.vcl/filter/dlgexpor.hxx deleted file mode 100644 index 4c8b926335cd..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#ifndef _DLGEXPOR_HXX_ -#define _DLGEXPOR_HXX_ - -#include <svtools/fltcall.hxx> -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/lstbox.hxx> - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Pixelformaten -|* -\************************************************************************/ - -class FilterConfigItem; -class DlgExportPix : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - ListBox aLbColors; - CheckBox aCbxRLE; - FixedLine aGrpColors; - - RadioButton aRbOriginal; - RadioButton aRbRes; - RadioButton aRbSize; - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpMode; - ComboBox aCbbRes; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - String aExt; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbRes,void* p ); - DECL_LINK( ClickRbSize,void* p ); - DECL_LINK( SelectLbColors, void* p ); - -public: - DlgExportPix( FltCallDialogParameter& rPara ); - ~DlgExportPix(); -}; - - -/************************************************************************* -|* -|* Dialog zum Einstellen von Filteroptionen bei Vektorformaten -|* -\************************************************************************/ -class DlgExportVec : public ModalDialog -{ -private: - - FltCallDialogParameter& rFltCallPara; - - OKButton aBtnOK; - CancelButton aBtnCancel; - HelpButton aBtnHelp; - - RadioButton aRbOriginal; - RadioButton aRbSize; - FixedLine aGrpMode; - - FixedText aFtSizeX; - MetricField aMtfSizeX; - FixedText aFtSizeY; - MetricField aMtfSizeY; - FixedLine aGrpSize; - - FilterConfigItem* pConfigItem; - ResMgr* pMgr; - - String aExt; - - DECL_LINK( OK, void* p ); - DECL_LINK( ClickRbOriginal,void* p ); - DECL_LINK( ClickRbSize,void* p ); - -public: - DlgExportVec( FltCallDialogParameter& rPara ); - ~DlgExportVec(); -}; - -#endif // _DLGEXPOR_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/dlgexpor.src b/svtools/source/filter.vcl/filter/dlgexpor.src deleted file mode 100644 index f1e63268fb22..000000000000 --- a/svtools/source/filter.vcl/filter/dlgexpor.src +++ /dev/null @@ -1,276 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "dlgexpor.hrc" - -ModalDialog DLG_EXPORT_PIX -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 135 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - FixedLine GRP_COLORS - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Color resolution" ; - }; - ListBox LB_COLORS - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 90 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - AutoHScroll = TRUE ; - StringList [ en-US ] = - { - < "Original" ; Default ; > ; - < "1 Bit - Threshold Value" ; Default ; > ; - < "1 Bit - Dithering" ; Default ; > ; - < "4 Bit - Grayscale" ; Default ; > ; - < "4 Bit - Color Palette" ; Default ; > ; - < "8 Bit - Grayscales" ; Default ; > ; - < "8 Bit - Color Palette" ; Default ; > ; - < "24 Bit - True Colors" ; Default ; > ; - }; - }; - CheckBox CBX_RLE - { - Pos = MAP_APPFONT ( 12 , 31 ) ; - Size = MAP_APPFONT ( 98 , 12 ) ; - TabStop = TRUE ; - Text [ en-US ] = "RLE coding" ; - }; - FixedLine GRP_MODE_PIX - { - Pos = MAP_APPFONT ( 6 , 48 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; - RadioButton RB_ORIGINAL_PIX - { - Pos = MAP_APPFONT ( 12 , 59 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_RES_PIX - { - Pos = MAP_APPFONT ( 12 , 73 ) ; - Size = MAP_APPFONT ( 55 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Resolution" ; - }; - ComboBox CBB_RES_PIX - { - Pos = MAP_APPFONT ( 70 , 73 ) ; - Size = MAP_APPFONT ( 40 , 50 ) ; - TabStop = TRUE ; - DropDown = TRUE ; - StringList = - { - "75 DPI" ; - "150 DPI" ; - "300 DPI" ; - "600 DPI" ; - }; - }; - RadioButton RB_SIZE_PIX - { - Pos = MAP_APPFONT ( 12 , 87 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - MetricField MTF_SIZEX_PIX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 101 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEX_PIX - { - Pos = MAP_APPFONT ( 18 , 102 ) ; - Size = MAP_APPFONT ( 41 , 10 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MTF_SIZEY_PIX - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 117 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEY_PIX - { - Pos = MAP_APPFONT ( 18 , 118 ) ; - Size = MAP_APPFONT ( 41 , 10 ) ; - Text [ en-US ] = "Height" ; - }; - OKButton BTN_OK_PIX - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL_PIX - { - Pos = MAP_APPFONT ( 122 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP_PIX - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; -ModalDialog DLG_EXPORT_VEC -{ - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 178 , 89 ) ; - Moveable = TRUE ; - Closeable = TRUE ; - - FixedLine GRP_MODE_VEC - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Mode" ; - }; - RadioButton RB_ORIGINAL_VEC - { - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Original" ; - }; - RadioButton RB_SIZE_VEC - { - Pos = MAP_APPFONT ( 12 , 28 ) ; - Size = MAP_APPFONT ( 98 , 10 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Size" ; - }; - FixedLine GRP_SIZE_VEC - { - Pos = MAP_APPFONT ( 6 , 44 ) ; - Size = MAP_APPFONT ( 110 , 8 ) ; - Text [ en-US ] = "Size" ; - }; - FixedText FT_SIZEX_VEC - { - Pos = MAP_APPFONT ( 12 , 56 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Width" ; - }; - MetricField MTF_SIZEX_VEC - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 55 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - FixedText FT_SIZEY_VEC - { - Pos = MAP_APPFONT ( 12 , 72 ) ; - Size = MAP_APPFONT ( 45 , 10 ) ; - Text [ en-US ] = "Height" ; - }; - MetricField MTF_SIZEY_VEC - { - Border = TRUE ; - Pos = MAP_APPFONT ( 60 , 71 ) ; - Size = MAP_APPFONT ( 50 , 12 ) ; - TabStop = TRUE ; - Repeat = TRUE ; - Spin = TRUE ; - Minimum = 100 ; - Maximum = 99999 ; - StrictFormat = TRUE ; - DecimalDigits = 2 ; - Unit = FUNIT_MM ; - First = 100 ; - Last = 99999 ; - SpinSize = 100 ; - }; - OKButton BTN_OK_VEC - { - Pos = MAP_APPFONT ( 122 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BTN_CANCEL_VEC - { - Pos = MAP_APPFONT ( 122 , 24 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - HelpButton BTN_HELP_VEC - { - Pos = MAP_APPFONT ( 122 , 43 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; -}; diff --git a/svtools/source/filter.vcl/filter/exportdialog.cxx b/svtools/source/filter.vcl/filter/exportdialog.cxx new file mode 100644 index 000000000000..701619d31f6c --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.cxx @@ -0,0 +1,1513 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef GCC +# pragma hdrstop +#endif + +#include <tools/ref.hxx> +#include <tools/stream.hxx> +#include <svtools/filter.hxx> +#include <svtools/FilterConfigItem.hxx> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/drawing/XDrawView.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> +#include <com/sun/star/geometry/AffineMatrix2D.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <unotools/streamwrap.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/outdev.hxx> +#include <vcl/graph.hxx> +#include <rtl/ustrbuf.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include "exportdialog.hxx" +#include "exportdialog.hrc" + +#define FORMAT_UNKNOWN 0 +#define FORMAT_JPG 1 +#define FORMAT_PNG 2 +#define FORMAT_BMP 3 +#define FORMAT_GIF 4 +#define FORMAT_PBM 5 +#define FORMAT_PGM 6 +#define FORMAT_PPM 7 +#define FORMAT_PCT 8 +#define FORMAT_RAS 9 +#define FORMAT_TIF 10 +#define FORMAT_XPM 11 +#define FORMAT_WMF 12 +#define FORMAT_EMF 13 +#define FORMAT_EPS 14 +#define FORMAT_MET 15 +#define FORMAT_SVG 16 +#define FORMAT_SVM 17 + +#define UNIT_DEFAULT -1 +#define UNIT_INCH 0 +#define UNIT_CM 1 +#define UNIT_MM 2 +#define UNIT_POINT 3 +#define UNIT_PIXEL 4 +#define UNIT_MAX_ID UNIT_PIXEL + +using namespace ::com::sun::star; + +static sal_Int16 GetFilterFormat( String& rExt ) +{ + sal_Int16 nFormat = FORMAT_UNKNOWN; + ByteString aExt( rExt, RTL_TEXTENCODING_UTF8 ); + if ( aExt.Equals( "JPG" ) ) + nFormat = FORMAT_JPG; + else if ( aExt.Equals( "PNG" ) ) + nFormat = FORMAT_PNG; + else if ( aExt.Equals( "BMP" ) ) + nFormat = FORMAT_BMP; + else if ( aExt.Equals( "GIF" ) ) + nFormat = FORMAT_GIF; + else if ( aExt.Equals( "PBM" ) ) + nFormat = FORMAT_PBM; + else if ( aExt.Equals( "PGM" ) ) + nFormat = FORMAT_PGM; + else if ( aExt.Equals( "PPM" ) ) + nFormat = FORMAT_PPM; + else if ( aExt.Equals( "PCT" ) ) + nFormat = FORMAT_PCT; + else if ( aExt.Equals( "RAS" ) ) + nFormat = FORMAT_RAS; + else if ( aExt.Equals( "TIF" ) ) + nFormat = FORMAT_TIF; + else if ( aExt.Equals( "XPM" ) ) + nFormat = FORMAT_XPM; + else if ( aExt.Equals( "WMF" ) ) + nFormat = FORMAT_WMF; + else if ( aExt.Equals( "EMF" ) ) + nFormat = FORMAT_EMF; + else if ( aExt.Equals( "EPS" ) ) + nFormat = FORMAT_EPS; + else if ( aExt.Equals( "MET" ) ) + nFormat = FORMAT_MET; + else if ( aExt.Equals( "SVG" ) ) + nFormat = FORMAT_SVG; + else if ( aExt.Equals( "SVM" ) ) + nFormat = FORMAT_SVM; + return nFormat; +} + +static MapUnit GetMapUnit( sal_Int32 nUnit ) +{ + MapUnit aMapUnit( MAP_PIXEL ); + switch( nUnit ) + { + case UNIT_INCH : aMapUnit = MAP_INCH; break; + case UNIT_CM : aMapUnit = MAP_CM; break; + case UNIT_MM : aMapUnit = MAP_MM; break; + case UNIT_POINT : aMapUnit = MAP_POINT; break; + case UNIT_PIXEL : aMapUnit = MAP_PIXEL; break; + } + return aMapUnit; +} + +sal_Int32 ExportDialog::GetDefaultUnit() +{ + sal_Int32 nDefaultUnit = UNIT_CM; + switch( mrFltCallPara.eFieldUnit ) + { +// case FUNIT_NONE : +// case FUNIT_PERCENT : +// case FUNIT_CUSTOM : + default: nDefaultUnit = UNIT_CM; break; + + case FUNIT_MILE : // PASSTHROUGH INTENDED + case FUNIT_FOOT : + case FUNIT_TWIP : + case FUNIT_PICA : nDefaultUnit = UNIT_INCH; break; + + case FUNIT_KM : // PASSTHROUGH INTENDED + case FUNIT_M : + case FUNIT_100TH_MM : nDefaultUnit = UNIT_CM; break; + + case FUNIT_INCH : nDefaultUnit = UNIT_INCH; break; + case FUNIT_CM : nDefaultUnit = UNIT_CM; break; + case FUNIT_MM : nDefaultUnit = UNIT_MM; break; + case FUNIT_POINT : nDefaultUnit = UNIT_POINT; break; + } + return nDefaultUnit; +} + +static basegfx::B2DRange GetShapeRangeForXShape( const uno::Reference< drawing::XShape >& rxShape, + const uno::Reference< graphic::XPrimitiveFactory2D >& rxPrimitiveFactory2D, const uno::Sequence< beans::PropertyValue >& rViewInformation ) +{ + basegfx::B2DRange aShapeRange; + + const uno::Sequence< beans::PropertyValue > aParams; + const uno::Sequence< uno::Reference< graphic::XPrimitive2D > > aPrimitiveSequence( rxPrimitiveFactory2D->createPrimitivesFromXShape( rxShape, aParams ) ); + + const sal_Int32 nCount = aPrimitiveSequence.getLength(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + const geometry::RealRectangle2D aRect( aPrimitiveSequence[ nIndex ]->getRange( rViewInformation ) ); + aShapeRange.expand( basegfx::B2DTuple( aRect.X1, aRect.Y1 ) ); + aShapeRange.expand( basegfx::B2DTuple( aRect.X2, aRect.Y2 ) ); + } + return aShapeRange; +} + +uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( sal_Bool bUpdateConfig ) +{ + if ( bUpdateConfig ) + { + sal_Int32 nUnit = maLbSizeX.GetSelectEntryPos(); + if ( nUnit < 0 ) + nUnit = UNIT_CM; + + if ( ( mnInitialResolutionUnit == UNIT_DEFAULT ) && ( nUnit == GetDefaultUnit() ) ) + nUnit = UNIT_DEFAULT; + + // updating ui configuration + if ( mbIsPixelFormat ) + { + if ( nUnit > UNIT_MAX_ID ) + nUnit = UNIT_PIXEL; + + sal_Int32 nResolution = maNfResolution.GetValue(); + if ( nResolution < 1 ) + nResolution = 96; + + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), nUnit ); + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), nResolution ); + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), maLbResolution.GetSelectEntryPos() ); + } + else + { + if ( nUnit >= UNIT_PIXEL ) + nUnit = UNIT_CM; + + mpOptionsItem->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), nUnit ); + } + } + + FilterConfigItem* pFilterOptions; + if ( bUpdateConfig ) + pFilterOptions = mpFilterOptionsItem; + else + { + uno::Sequence< beans::PropertyValue > aFilterData( mpFilterOptionsItem->GetFilterData() ); + pFilterOptions = new FilterConfigItem( &aFilterData ); + } + + const String sLogicalWidth( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalWidth" ) ) ); + const String sLogicalHeight( String( RTL_CONSTASCII_USTRINGPARAM( "LogicalHeight" ) ) ); + if ( mbIsPixelFormat ) + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelWidth" ) ), static_cast< sal_Int32 >( maSize.Width ) ); + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelHeight" ) ), static_cast< sal_Int32 >( maSize.Height ) ); + if ( maResolution.Width && maResolution.Height ) + { + const double f100thmmPerPixelX = 100000.0 / maResolution.Width; + const double f100thmmPerPixelY = 100000.0 / maResolution.Height; + sal_Int32 nLogicalWidth = static_cast< sal_Int32 >( f100thmmPerPixelX * maSize.Width ); + sal_Int32 nLogicalHeight= static_cast< sal_Int32 >( f100thmmPerPixelY * maSize.Height ); + if ( nLogicalWidth && nLogicalHeight ) + { + pFilterOptions->WriteInt32( sLogicalWidth, nLogicalWidth ); + pFilterOptions->WriteInt32( sLogicalHeight, nLogicalHeight ); + } + } + } + else + { + pFilterOptions->WriteInt32( sLogicalWidth, static_cast< sal_Int32 >( maSize.Width ) ); + pFilterOptions->WriteInt32( sLogicalHeight, static_cast< sal_Int32 >( maSize.Height ) ); + } + switch ( mnFormat ) + { + case FORMAT_JPG : + { + sal_Int32 nColor = maLbColorDepth.GetSelectEntryPos(); + if ( nColor == 1 ) + nColor = 0; + else + nColor = 1; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), nColor ); + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) ); + } + break; + + case FORMAT_PNG : + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), static_cast< sal_Int32 >( maSbCompression.GetThumbPos() ) ); + sal_Int32 nInterlace = 0; + if ( maCbInterlaced.IsChecked() ) + nInterlace++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nInterlace ); + } + break; + + case FORMAT_BMP : + { + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), maLbColorDepth.GetSelectEntryPos() + 1 ); + pFilterOptions->WriteBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), maCbRLEEncoding.IsChecked() ); + } + break; + + case FORMAT_GIF : + { + sal_Int32 nValue = 0; + if ( maCbInterlaced.IsChecked() ) + nValue++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), nValue ); + + nValue = 0; + if ( maCbSaveTransparency.IsChecked() ) + nValue++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), nValue ); + } + break; + + case FORMAT_PBM : + case FORMAT_PGM : + case FORMAT_PPM : + { + sal_Int32 nFormat = 0; + if ( maRbText.IsChecked() ) + nFormat++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), nFormat ); + } + break; + + case FORMAT_EPS : + { + sal_Int32 nCheck = 0; + if ( maCbEPSPreviewTIFF.IsChecked() ) + nCheck++; + if ( maCbEPSPreviewEPSI.IsChecked() ) + nCheck += 2; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSLevel2.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSColorFormat2.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), nCheck ); + + nCheck = 1; + if ( maRbEPSCompressionNone.IsChecked() ) + nCheck++; + pFilterOptions->WriteInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), nCheck ); + } + break; + } + + uno::Sequence< beans::PropertyValue > aRet( pFilterOptions->GetFilterData() ); + if ( bUpdateConfig == sal_False ) + delete pFilterOptions; + return aRet; +} + +// +awt::Size ExportDialog::GetOriginalSize() +{ + basegfx::B2DRange aShapesRange; + + if ( mxPage.is () ) + { + uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY ); + if ( xPagePropSet.is() ) + { + sal_Int32 nWidth = 0; + sal_Int32 nHeight= 0; + com::sun::star::uno::Any aAny; + aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ); + aAny >>= nWidth; + aAny = xPagePropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ); + aAny >>= nHeight; + aShapesRange = basegfx::B2DRange( 0, 0, nWidth, nHeight ); + } + } + else + { + uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory( + mxMgr->createInstance( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.graphic.PrimitiveFactory2D" ) ) ), uno::UNO_QUERY ); + if ( xPrimitiveFactory.is() ) + { + basegfx::B2DHomMatrix aViewTransformation( Application::GetDefaultDevice()->GetViewTransformation() ); + com::sun::star::geometry::AffineMatrix2D aTransformation; + aTransformation.m00 = aViewTransformation.get(0,0); + aTransformation.m01 = aViewTransformation.get(0,1); + aTransformation.m02 = aViewTransformation.get(0,2); + aTransformation.m10 = aViewTransformation.get(1,0); + aTransformation.m11 = aViewTransformation.get(1,1); + aTransformation.m12 = aViewTransformation.get(1,2); + + const rtl::OUString sViewTransformation( RTL_CONSTASCII_USTRINGPARAM( "ViewTransformation" ) ); + uno::Sequence< beans::PropertyValue > aViewInformation( 1 ); + aViewInformation[ 0 ].Value <<= aTransformation; + aViewInformation[ 0 ].Name = sViewTransformation; + + if ( mxShape.is() ) + aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation ); + else if ( mxShapes.is() ) + { + const sal_Int32 nCount = mxShapes->getCount(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) + { + uno::Reference< drawing::XShape > xShape; + mxShapes->getByIndex( nIndex ) >>= xShape; + aShapesRange.expand( GetShapeRangeForXShape( xShape, xPrimitiveFactory, aViewInformation ) ); + } + } + } + } + return awt::Size( static_cast<sal_Int32>(aShapesRange.getWidth()), static_cast<sal_Int32>(aShapesRange.getHeight()) ); +} + +void ExportDialog::GetGraphicSource() +{ + if ( mxSourceDocument.is() ) + { + uno::Reference< frame::XModel > xModel( mxSourceDocument, uno::UNO_QUERY ); + if ( xModel.is() ) + { + uno::Reference< frame::XController > xController( xModel->getCurrentController() ); + if ( xController.is() ) + { + if ( mbExportSelection ) // check if there is a selection + { + uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY ); + if ( xSelectionSupplier.is() ) + { + uno::Any aAny( xSelectionSupplier->getSelection() ); + if ( ! ( aAny >>= mxShapes ) ) + aAny >>= mxShape; + } + } + if ( !mxShape.is() && !mxShapes.is() ) + { + uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY ); + if ( xDrawView.is() ) + { + uno::Reference< drawing::XDrawPage > xCurrentPage( xDrawView->getCurrentPage() ); + if ( xCurrentPage.is() ) + { + mxPage = xCurrentPage; // exporting whole page + } + } + } + } + } + } +} + +sal_Bool ExportDialog::GetGraphicStream() +{ + sal_Bool bRet = sal_False; + + if ( !IsTempExportAvailable() ) + { + delete mpTempStream, mpTempStream = new SvMemoryStream(); + maBitmap = Bitmap(); + return bRet; + } + + sal_Bool bRecreateOutputStream = mpTempStream->Tell() == 0; + + static uno::Sequence< beans::PropertyValue > aOldFilterData; + uno::Sequence< beans::PropertyValue > aNewFilterData( GetFilterData( sal_False ) ); + if ( aOldFilterData != aNewFilterData ) + { + aOldFilterData = aNewFilterData; + bRecreateOutputStream = sal_True; + } + try + { + if ( bRecreateOutputStream ) + { + delete mpTempStream, mpTempStream = new SvMemoryStream(); + maBitmap = Bitmap(); + + uno::Reference < io::XStream > xStream( new utl::OStreamWrapper( *mpTempStream ) ); + uno::Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() ); + + uno::Reference< document::XExporter > xGraphicExporter( + mxMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter") ) ), uno::UNO_QUERY_THROW ); + uno::Reference< document::XFilter > xFilter( xGraphicExporter, uno::UNO_QUERY_THROW ); + + sal_Int32 nProperties = 2; + uno::Sequence< beans::PropertyValue > aFilterData( nProperties ); + + + rtl::OUString sFormat( maExt ); + uno::Sequence< beans::PropertyValue > aDescriptor( 3 ); + aDescriptor[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OutputStream") ); + aDescriptor[0].Value <<= xOutputStream; + aDescriptor[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") ); + aDescriptor[1].Value <<= sFormat; + aDescriptor[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") ); + aDescriptor[2].Value <<= aNewFilterData; + + uno::Reference< lang::XComponent > xSourceDoc; + if ( mxPage.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxPage, uno::UNO_QUERY_THROW ); + else if ( mxShapes.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxShapes, uno::UNO_QUERY_THROW ); + else if ( mxShape.is() ) + xSourceDoc = uno::Reference< lang::XComponent >( mxShape, uno::UNO_QUERY_THROW );; + if ( xSourceDoc.is() ) + { + xGraphicExporter->setSourceDocument( xSourceDoc ); + xFilter->filter( aDescriptor ); + bRet = sal_True; + + if ( mnFormat == FORMAT_JPG ) + { + mpTempStream->Seek( STREAM_SEEK_TO_BEGIN ); + maBitmap = GetGraphicBitmap( *mpTempStream ); + mpTempStream->Seek( STREAM_SEEK_TO_END ); + } + } + } + else + bRet = sal_True; + } + catch( uno::Exception& ) + { + + // ups + + } + return bRet; +} + +Bitmap ExportDialog::GetGraphicBitmap( SvStream& rInputStream ) +{ + Bitmap aRet; + Graphic aGraphic; + GraphicFilter aFilter( sal_False ); + if ( aFilter.ImportGraphic( aGraphic, String(), rInputStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, NULL ) == GRFILTER_OK ) + { + aRet = aGraphic.GetBitmap(); + } + return aRet; +} + +sal_uInt32 ExportDialog::GetRawFileSize() const +{ + sal_uInt64 nRawFileSize = 0; + if ( mbIsPixelFormat ) + { + sal_Int32 nBitsPerPixel = 24; + String aEntry( maLbColorDepth.GetSelectEntry() ); + if ( ms1BitTreshold == aEntry ) + nBitsPerPixel = 1; + else if ( ms1BitDithered == aEntry ) + nBitsPerPixel = 1; + else if ( ms4BitGrayscale == aEntry ) + nBitsPerPixel = 4; + else if ( ms4BitColorPalette == aEntry ) + nBitsPerPixel = 8; + else if ( ms8BitGrayscale == aEntry ) + nBitsPerPixel = 8; + else if ( ms8BitColorPalette == aEntry ) + nBitsPerPixel = 8; + else if ( ms24BitColor == aEntry ) + nBitsPerPixel = 24; + + if ( mbIsPixelFormat ) + { + nRawFileSize = ( maSize.Width * nBitsPerPixel + 7 ) &~ 7; // rounding up to 8 bits + nRawFileSize /= 8; // in bytes + nRawFileSize *= maSize.Height; + } + if ( nRawFileSize > SAL_MAX_UINT32 ) + nRawFileSize = 0; + } + return static_cast< sal_uInt32 >( nRawFileSize ); +} + +// checks if the source dimension/resolution is not too big +// to determine the exact graphic output size and preview for jpg +sal_Bool ExportDialog::IsTempExportAvailable() const +{ + return GetRawFileSize() < static_cast< sal_uInt32 >( mnMaxFilesizeForRealtimePreview ); +} + +ExportDialog::ExportDialog( FltCallDialogParameter& rPara, + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument, + sal_Bool bExportSelection, sal_Bool bIsPixelFormat ) : + ModalDialog ( rPara.pWindow, ResId( DLG_EXPORT, *rPara.pResMgr ) ), + mrFltCallPara ( rPara ), + mpMgr ( rPara.pResMgr ), + mxMgr ( rxMgr ), + mxSourceDocument ( rxSourceDocument ), + maFlExportSize ( this, ResId( FL_EXPORT_SIZE, *rPara.pResMgr ) ), + maFtSizeX ( this, ResId( FT_SIZEX, *rPara.pResMgr ) ), + maMfSizeX ( this, ResId( MF_SIZEX, *rPara.pResMgr ) ), + maLbSizeX ( this, ResId( LB_SIZEX, *rPara.pResMgr ) ), + maFtSizeY ( this, ResId( FT_SIZEY, *rPara.pResMgr ) ), + maMfSizeY ( this, ResId( MF_SIZEY, *rPara.pResMgr ) ), + maLbSizeY ( this, ResId( LB_SIZEY, *rPara.pResMgr ) ), + maFtResolution ( this, ResId( FT_RESOLUTION, *rPara.pResMgr ) ), + maNfResolution ( this, ResId( NF_RESOLUTION, *rPara.pResMgr ) ), + maLbResolution ( this, ResId( LB_RESOLUTION, *rPara.pResMgr ) ), + maFlColorDepth ( this, ResId( FL_COLOR_DEPTH, *rPara.pResMgr ) ), + maLbColorDepth ( this, ResId( LB_COLOR_DEPTH, *rPara.pResMgr ) ), + maFlJPGQuality ( this, ResId( FL_JPG_QUALITY, *rPara.pResMgr ) ), + maFlMode ( this, ResId( FL_MODE, *rPara.pResMgr ) ), + maFlPBMOptions ( this, ResId( FL_PBM_OPTIONS, *rPara.pResMgr ) ), + maSbCompression ( this, ResId( SB_COMPRESSION, *rPara.pResMgr ) ), + maNfCompression ( this, ResId( NF_COMPRESSION, *rPara.pResMgr ) ), + maFtJPGMin ( this, ResId( FT_JPG_MIN, *rPara.pResMgr ) ), + maFtJPGMax ( this, ResId( FT_JPG_MAX, *rPara.pResMgr ) ), + maFtPNGMin ( this, ResId( FT_PNG_MIN, *rPara.pResMgr ) ), + maFtPNGMax ( this, ResId( FT_PNG_MAX, *rPara.pResMgr ) ), + maCbJPGPreview ( this, ResId( CB_JPG_PREVIEW, *rPara.pResMgr ) ), + maCbInterlaced ( this, ResId( CB_INTERLACED, *rPara.pResMgr ) ), + maCbRLEEncoding ( this, ResId( CB_RLE_ENCODING, *rPara.pResMgr ) ), + maFlGIFDrawingObjects ( this, ResId( FL_GIF_DRAWING_OBJECTS, *rPara.pResMgr ) ), + maCbSaveTransparency ( this, ResId( CB_SAVE_TRANSPARENCY, *rPara.pResMgr ) ), + maRbBinary ( this, ResId( RB_BINARY, *rPara.pResMgr ) ), + maRbText ( this, ResId( RB_TEXT, *rPara.pResMgr ) ), + maFlEPSPreview ( this, ResId( FL_EPS_PREVIEW, *rPara.pResMgr ) ), + maCbEPSPreviewTIFF ( this, ResId( CB_EPS_PREVIEW_TIFF, *rPara.pResMgr ) ), + maCbEPSPreviewEPSI ( this, ResId( CB_EPS_PREVIEW_EPSI, *rPara.pResMgr ) ), + maFlEPSVersion ( this, ResId( FL_EPS_VERSION, *rPara.pResMgr ) ), + maRbEPSLevel1 ( this, ResId( RB_EPS_LEVEL1, *rPara.pResMgr ) ), + maRbEPSLevel2 ( this, ResId( RB_EPS_LEVEL2, *rPara.pResMgr ) ), + maFlEPSColorFormat ( this, ResId( FL_EPS_COLOR_FORMAT, *rPara.pResMgr ) ), + maRbEPSColorFormat1 ( this, ResId( RB_EPS_COLOR_FORMAT1, *rPara.pResMgr ) ), + maRbEPSColorFormat2 ( this, ResId( RB_EPS_COLOR_FORMAT2, *rPara.pResMgr ) ), + maFlCompression ( this, ResId( FL_COMPRESSION, *rPara.pResMgr ) ), + maRbEPSCompressionLZW ( this, ResId( RB_EPS_COMPRESSION_LZW, *rPara.pResMgr ) ), + maRbEPSCompressionNone ( this, ResId( RB_EPS_COMPRESSION_NONE, *rPara.pResMgr ) ), + maFlEstimatedSize ( this, ResId( FL_ESTIMATED_SIZE, *rPara.pResMgr ) ), + maFtEstimatedSize ( this, ResId( FT_ESTIMATED_SIZE, *rPara.pResMgr ) ), + msEstimatedSizePix1 ( ResId( STR_ESTIMATED_SIZE_PIX_1, *rPara.pResMgr ) ), + msEstimatedSizePix2 ( ResId( STR_ESTIMATED_SIZE_PIX_2, *rPara.pResMgr ) ), + msEstimatedSizeVec ( ResId( STR_ESTIMATED_SIZE_VEC, *rPara.pResMgr ) ), + maFlButtons ( this, ResId( FL_BUTTONS, *rPara.pResMgr ) ), + maFbJPGPreview ( this, ResId( FB_JPG_PREVIEW, *rPara.pResMgr ) ), + maSbZoom ( this, ResId( SB_ZOOM, *rPara.pResMgr ) ), + maNfZoom ( this, ResId( NF_ZOOM, *rPara.pResMgr ) ), + maSbJPGPreviewHorz ( this, ResId( SB_JPG_PREVIEW_HORZ, *rPara.pResMgr ) ), + maSbJPGPreviewVert ( this, ResId( SB_JPG_PREVIEW_VERT, *rPara.pResMgr ) ), + maBtnOK ( this, ResId( BTN_OK, *rPara.pResMgr ) ), + maBtnCancel ( this, ResId( BTN_CANCEL, *rPara.pResMgr ) ), + maBtnHelp ( this, ResId( BTN_HELP, *rPara.pResMgr ) ), + ms1BitTreshold ( ResId( STR_1BIT_THRESHOLD, *rPara.pResMgr ) ), + ms1BitDithered ( ResId( STR_1BIT_DITHERED, *rPara.pResMgr ) ), + ms4BitGrayscale ( ResId( STR_4BIT_GRAYSCALE, *rPara.pResMgr ) ), + ms4BitColorPalette ( ResId( STR_4BIT_COLOR_PALETTE, *rPara.pResMgr ) ), + ms8BitGrayscale ( ResId( STR_8BIT_GRAYSCALE, *rPara.pResMgr ) ), + ms8BitColorPalette ( ResId( STR_8BIT_COLOR_PALETTE, *rPara.pResMgr ) ), + ms24BitColor ( ResId( STR_24BIT_TRUE_COLOR, *rPara.pResMgr ) ), + maExt ( rPara.aFilterExt ), + mnFormat ( FORMAT_UNKNOWN ), + mnMaxFilesizeForRealtimePreview( 0 ), + mpTempStream ( new SvMemoryStream() ), + maOriginalSize ( awt::Size( 0, 0 ) ), + mbPreview ( sal_False ), + mbIsPixelFormat ( bIsPixelFormat ), + mbExportSelection ( bExportSelection ), + mbPreserveAspectRatio ( sal_True ) +{ + GetGraphicSource(); + + maExt.ToUpperAscii(); + + String aFilterConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Graphic/Export/" ) ); + mpOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + aFilterConfigPath.Append( maExt ); + mpFilterOptionsItem = new FilterConfigItem( aFilterConfigPath, &rPara.aFilterData ); + + mnInitialResolutionUnit = mbIsPixelFormat + ? mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportUnit" ) ), UNIT_DEFAULT ) + : mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "VectorExportUnit" ) ), UNIT_DEFAULT ); + + mnMaxFilesizeForRealtimePreview = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "MaxFilesizeForRealtimePreview" ) ), 0 ); + maFtEstimatedSize.SetText( String( RTL_CONSTASCII_USTRINGPARAM( " \n " ) ) ); + + String aTitle( maExt ); + aTitle += String( ResId( DLG_EXPORT_TITLE, *mpMgr ) ); + SetText( aTitle ); + + mnFormat = GetFilterFormat( maExt ); + + Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MAP_CM ) ); + maResolution.Width = aResolution.Width(); + maResolution.Height= aResolution.Height(); + maOriginalSize = GetOriginalSize(); + if ( bIsPixelFormat ) + { + double fPixelsPer100thmm = static_cast< double >( maResolution.Width ) / 100000.0; + maSize = awt::Size( static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Width ) + 0.5 ), + static_cast< sal_Int32 >( ( fPixelsPer100thmm * maOriginalSize.Height ) + 0.5 ) ); + } + else + { + maSize = maOriginalSize; + } + + // Size + maLbSizeX.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maSbCompression.SetScrollHdl( LINK( this, ExportDialog, SbCompressionUpdateHdl ) ); + maNfCompression.SetModifyHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maMfSizeX.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeX ) ); + maMfSizeY.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlMtfSizeY ) ); + + maNfResolution.SetModifyHdl( LINK( this, ExportDialog, UpdateHdlNfResolution ) ); + maLbResolution.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maLbColorDepth.SetSelectHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbInterlaced.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbSaveTransparency.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maCbEPSPreviewTIFF.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maCbEPSPreviewEPSI.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maRbEPSCompressionLZW.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbEPSCompressionNone.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maRbBinary.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbText.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + + // JPG Preview +// maCbJPGPreview.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); +maCbJPGPreview.Enable( sal_False ); + + maSbJPGPreviewVert.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maSbJPGPreviewHorz.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maSbZoom.SetScrollHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + // BMP + maCbRLEEncoding.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + // EPS + maRbEPSLevel1.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + maRbEPSLevel2.SetClickHdl( LINK( this, ExportDialog, UpdateHdl ) ); + + maBtnOK.SetClickHdl( LINK( this, ExportDialog, OK ) ); + + setupLayout(); + updateControls(); + + FreeResource(); +} + +void ExportDialog::createSizeControls( vcl::RowOrColumn& rLayout ) +{ + size_t nIndex; + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + // Size controls + rLayout.addWindow( &maFlExportSize ); + + Size aLbMax( maLbSizeX.GetSizePixel() ); + aLbMax.Width() = Max( aLbMax.Width(), maLbResolution.GetSizePixel().Width() ); + + boost::shared_ptr< vcl::LabelColumn > xSizeColumns( new vcl::LabelColumn( &rLayout ) ); + rLayout.addChild( xSizeColumns ); + + // row 1 + boost::shared_ptr< vcl::RowOrColumn > xColumn( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtSizeX, xColumn, nIndent ); + Size aMinSize( maMfSizeX.GetSizePixel() ); + nIndex = xColumn->addWindow( &maMfSizeX ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbSizeX ); + xColumn->setMinimumSize( nIndex, aLbMax ); + + // row 2 + xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtSizeY, xColumn, nIndent ); + nIndex = xColumn->addWindow( &maMfSizeY ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbSizeY ); + xColumn->setMinimumSize( nIndex, aLbMax ); + + // row 3 + if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport) + { + xColumn = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xSizeColumns.get(), false ) ); + xSizeColumns->addRow( &maFtResolution, xColumn, nIndent ); + nIndex = xColumn->addWindow( &maNfResolution ); + xColumn->setMinimumSize( nIndex, aMinSize ); + nIndex = xColumn->addWindow( &maLbResolution ); + xColumn->setMinimumSize( nIndex, aLbMax ); + } + + sal_Int32 nUnit = mnInitialResolutionUnit; + if ( nUnit == UNIT_DEFAULT ) + nUnit = GetDefaultUnit(); + + if ( !mbIsPixelFormat ) + { + maLbSizeX.RemoveEntry( UNIT_PIXEL ); // removing pixel + if ( nUnit >= UNIT_PIXEL ) + nUnit = UNIT_CM; + } + else if ( nUnit > UNIT_MAX_ID ) + nUnit = UNIT_PIXEL; + if ( nUnit < 0 ) + nUnit = UNIT_CM; + maLbSizeX.SelectEntryPos( static_cast< sal_uInt16 >( nUnit ) ); + + if ( mbIsPixelFormat ) // TODO: (metafileresolutionsupport) should be supported for vector formats also... this makes + { // sense eg for bitmap fillings in metafiles, to preserve high dpi output + // (atm without special vector support the bitmaps are rendered with 96dpi) + sal_Int32 nResolution = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolution" ) ), 96 ); + if ( nResolution < 1 ) + nResolution = 96; + maNfResolution.SetValue( nResolution ); + + sal_Int32 nResolutionUnit = mpOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "PixelExportResolutionUnit" ) ), 1 ); + if ( ( nResolutionUnit < 0 ) || ( nResolutionUnit > 2 ) ) + nResolutionUnit = 1; + maLbResolution.SelectEntryPos( static_cast< sal_uInt16 >( nResolutionUnit ) ); + } + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); +} + +void ExportDialog::createColorDepthControls( vcl::RowOrColumn& rLayout ) +{ + // Color Depth + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + xRow->addWindow( &maFlColorDepth ); + + xRow = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + xRow->addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maLbColorDepth ); + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); +} + +void ExportDialog::createScrollBar( vcl::RowOrColumn& rLayout ) +{ + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xRow ); + + Size aMinSize( maSbCompression.GetSizePixel() ); + size_t nIndex = xRow->addWindow( &maSbCompression ); + xRow->setMinimumSize( nIndex, aMinSize ); + aMinSize = maNfCompression.GetSizePixel(); + nIndex = xRow->addWindow( &maNfCompression ); + xRow->setMinimumSize( nIndex, aMinSize ); +} + +void ExportDialog::createFilterOptions( vcl::RowOrColumn& rLayout ) +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = aBorder.Width(); + + switch( mnFormat ) + { + case FORMAT_JPG : + { + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorMode" ) ), 0 ); + if ( nColor == 1 ) + nColor = 0; + else + nColor = 1; + maLbColorDepth.InsertEntry( ms8BitGrayscale ); + maLbColorDepth.InsertEntry( ms24BitColor ); + maLbColorDepth.SelectEntryPos( nColor ); + createColorDepthControls( maLayout ); + + rLayout.addWindow( &maFlJPGQuality ); + + // Quality + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + createScrollBar( *xRows.get() ); + xRows->addWindow( &maFtJPGMin ); + xRows->addWindow( &maFtJPGMax ); + if ( maCbJPGPreview.IsEnabled() ) + xRows->addWindow( &maCbJPGPreview ); + + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ), 75 ); + if ( ( nQuality < 1 ) || ( nQuality > 100 ) ) + nQuality = 75; + + maSbCompression.SetRangeMin( 1 ); + maSbCompression.SetRangeMax( 100 ); + maNfCompression.SetMin( 1 ); + maNfCompression.SetMax( 100 ); + maNfCompression.SetValue( nQuality ); + maNfCompression.SetStrictFormat( sal_True ); + if ( maCbJPGPreview.IsEnabled() ) + maCbJPGPreview.Check( sal_False ); + } + break; + case FORMAT_PNG : + { + rLayout.addWindow( &maFlCompression ); + + // Compression 1..9 + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + createScrollBar( *xRows.get() ); + xRows->addWindow( &maFtPNGMin ); + xRows->addWindow( &maFtPNGMax ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + // Interlaced + rLayout.addWindow( &maFlMode ); + xIndenter.reset( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + xRows.reset( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbInterlaced ); + + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nCompression = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Compression" ) ), 6 ); + if ( ( nCompression < 1 ) || ( nCompression > 9 ) ) + nCompression = 6; + maSbCompression.SetRangeMin( 1 ); + maSbCompression.SetRangeMax( 9 ); + maNfCompression.SetMin( 1 ); + maNfCompression.SetMax( 9 ); + maNfCompression.SetValue( 9 ); + maNfCompression.SetStrictFormat( sal_True ); + + maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 0 ) != 0 ); + } + break; + case FORMAT_BMP : + { + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), 0 ); + if ( nColor == 0 ) + nColor = 6; + else + nColor--; + maLbColorDepth.InsertEntry( ms1BitTreshold ); + maLbColorDepth.InsertEntry( ms1BitDithered ); + maLbColorDepth.InsertEntry( ms4BitGrayscale ); + maLbColorDepth.InsertEntry( ms4BitColorPalette ); + maLbColorDepth.InsertEntry( ms8BitGrayscale ); + maLbColorDepth.InsertEntry( ms8BitColorPalette ); + maLbColorDepth.InsertEntry( ms24BitColor ); + maLbColorDepth.SelectEntryPos( nColor ); + createColorDepthControls( maLayout ); + + rLayout.addWindow( &maFlCompression ); + // RLE coding + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbRLEEncoding ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + maCbRLEEncoding.Check( mpFilterOptionsItem->ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), sal_True ) ); + } + break; + case FORMAT_GIF : + { + rLayout.addWindow( &maFlMode ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbInterlaced ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + rLayout.addWindow( &maFlGIFDrawingObjects ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbSaveTransparency ); + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + maCbInterlaced.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Interlaced" ) ), 1 ) != 0 ); + maCbSaveTransparency.Check( mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Translucent" ) ), 1 ) != 0 ); + } + break; + case FORMAT_PBM : + case FORMAT_PGM : + case FORMAT_PPM : + { + rLayout.addWindow( &maFlJPGQuality ); + + // RB Binary / Text + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( &rLayout, nIndent ) ); + rLayout.addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( &rLayout, true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbBinary ); + xRows->addWindow( &maRbText ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nFormat = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "FileFormat" ) ), 1 ); + maRbBinary.Check( nFormat == 0 ); + maRbText.Check( nFormat != 0 ); + } + break; + case FORMAT_EPS : + { + boost::shared_ptr< vcl::RowOrColumn > xColumns( new vcl::RowOrColumn( &rLayout, false ) ); + rLayout.addChild( xColumns ); + boost::shared_ptr< vcl::RowOrColumn > xLeft( new vcl::RowOrColumn( &rLayout, true ) ); + xColumns->addChild( xLeft ); + + xLeft->addWindow( &maFlEPSPreview ); + boost::shared_ptr< vcl::Indenter > xIndenter( new vcl::Indenter( xLeft.get(), nIndent ) ); + xLeft->addChild( xIndenter ); + boost::shared_ptr< vcl::RowOrColumn > xRows( new vcl::RowOrColumn( xLeft.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maCbEPSPreviewTIFF ); + xRows->addWindow( &maCbEPSPreviewEPSI ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( xLeft.get(), 2 ) ); + xLeft->addChild( xSpacer ); + + xLeft->addWindow( &maFlEPSVersion ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xLeft.get(), nIndent ) ); + xLeft->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xLeft.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSLevel1 ); + xRows->addWindow( &maRbEPSLevel2 ); + xSpacer.reset( new vcl::Spacer( xLeft.get(), 2 ) ); + xLeft->addChild( xSpacer ); + + boost::shared_ptr< vcl::RowOrColumn > xRight( new vcl::RowOrColumn( &rLayout, true ) ); + xColumns->addChild( xRight ); + + xRight->addWindow( &maFlEPSColorFormat ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) ); + xRight->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSColorFormat1 ); + xRows->addWindow( &maRbEPSColorFormat2 ); + xSpacer.reset( new vcl::Spacer( xRight.get(), 2 ) ); + xRight->addChild( xSpacer ); + + xRight->addWindow( &maFlCompression ); + xIndenter = boost::shared_ptr< vcl::Indenter >( new vcl::Indenter( xRight.get(), nIndent ) ); + xRight->addChild( xIndenter ); + xRows = boost::shared_ptr< vcl::RowOrColumn >( new vcl::RowOrColumn( xRight.get(), true ) ); + xIndenter->setChild( xRows ); + xRows->addWindow( &maRbEPSCompressionLZW ); + xRows->addWindow( &maRbEPSCompressionNone ); + + xSpacer.reset( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + sal_Int32 nPreview = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Preview" ) ), 0 ); + sal_Int32 nVersion = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ), 2 ); + sal_Int32 nColor = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ColorFormat" ) ), 0 ); + sal_Int32 nCompr = mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressionMode" ) ), 2 ); + + mpFilterOptionsItem->ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "TextMode" ) ), 0 ); + + maCbEPSPreviewTIFF.Check( ( nPreview & 1 ) != 0 ); + maCbEPSPreviewEPSI.Check( ( nPreview & 2 ) != 0 ); + + maRbEPSLevel1.Check( nVersion == 1 ); + maRbEPSLevel2.Check( nVersion == 2 ); + + maRbEPSColorFormat1.Check( nColor == 1 ); + maRbEPSColorFormat2.Check( nColor != 1 ); + + maRbEPSCompressionLZW.Check( nCompr == 1 ); + maRbEPSCompressionNone.Check( nCompr != 1 ); + } + break; + } +} + +void ExportDialog::createButtons( vcl::RowOrColumn& rLayout ) +{ + rLayout.addWindow( &maFlButtons ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( &rLayout, 2 ) ); + rLayout.addChild( xSpacer ); + + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + + boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &rLayout, false ) ); + size_t nIndex = rLayout.addChild( xButtons ); + rLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() ); + + Size aMinSize( maBtnCancel.GetSizePixel() ); + // insert help button + xButtons->setMinimumSize( xButtons->addWindow( &maBtnHelp ), aMinSize ); + + // insert a spacer, cancel and OK buttons are right aligned + + xSpacer.reset( new vcl::Spacer( xButtons.get(), 2 ) ); + xButtons->addChild( xSpacer ); + xButtons->setMinimumSize( xButtons->addWindow( &maBtnOK ), aMinSize ); + xButtons->setMinimumSize( xButtons->addWindow( &maBtnCancel ), aMinSize ); +} + +void ExportDialog::setupLayout() +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + maLayout.setParentWindow( this ); + maLayout.setOuterBorder( aBorder.Width() ); + + createSizeControls( maLayout ); + createFilterOptions( maLayout ); + + if ( mnMaxFilesizeForRealtimePreview || mbIsPixelFormat ) + { + maLayout.addWindow( &maFlEstimatedSize ); + maLayout.addWindow( &maFtEstimatedSize ); + } + createButtons( maLayout ); + + maLayout.show(); + maDialogSize = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); + maLayout.setManagedArea( Rectangle( Point(), maDialogSize ) ); + SetOutputSizePixel( Size( mbPreview ? maDialogSize.Width() * 2 : maDialogSize.Width(), maDialogSize.Height() ) ); + + maRectFlButtons = Rectangle( maFlButtons.GetPosPixel(), maFlButtons.GetSizePixel() ); + maRectBtnHelp = Rectangle( maBtnHelp.GetPosPixel(), maBtnHelp.GetSizePixel() ); + maRectBtnOK = Rectangle( maBtnOK.GetPosPixel(), maBtnOK.GetSizePixel() ); + maRectBtnCancel = Rectangle( maBtnCancel.GetPosPixel(), maBtnOK.GetSizePixel() ); + + maLbSizeY.Hide(); +} + +static rtl::OUString ImpValueOfInKB( const sal_Int64& rVal ) +{ + double fVal( static_cast<double>( rVal ) ); + fVal /= ( 1 << 10 ); + fVal += 0.05; + rtl::OUStringBuffer aVal( rtl::OUString::valueOf( fVal ) ); + sal_Int32 nX( rtl::OUString( aVal.getStr() ).indexOf( '.', 0 ) ); + if ( nX > 0 ) + aVal.setLength( nX + 2 ); + return aVal.makeStringAndClear(); +} + +sal_Int32 static GetZoomValueFromThumbPos( sal_Int32 nThumbPos ) +{ + sal_Int32 nProz = 0; + if ( nThumbPos <= 50 ) + nProz = nThumbPos * 2; // so a range of 50 represents 100% + else + nProz = ( ( nThumbPos - 50 ) * 60 ) + 100; // we want to scale up to 3000% + return nProz; +} + +void ExportDialog::updatePreview() +{ + // JPG +// maCbJPGPreview.Enable( IsTempExportAvailable() ); + +// if ( maCbJPGPreview.IsEnabled() && maCbJPGPreview.IsChecked() ) + if ( mbPreview ) + { + long nScrollBarSize = Application::GetSettings().GetStyleSettings().GetScrollBarSize(); + + Point aPreviewPos( maDialogSize.Width(), 0 ); + Size aPreviewSize( maDialogSize.Width(), maFlButtons.GetPosPixel().Y() ); + + Point aFixedBitmapPos( aPreviewPos ); + Size aFixedBitmapSize( aPreviewSize ); + + maSbZoom.Show( sal_False ); + maSbZoom.SetPosPixel( Point( aPreviewPos.X(), aPreviewPos.Y() ) ); + maSbZoom.SetSizePixel( Size( aPreviewSize.Width() / 4, nScrollBarSize ) ); + maNfZoom.Show( sal_False ); + maNfZoom.SetPosPixel( Point( aPreviewPos.X() + aPreviewSize.Width() / 4, aPreviewPos.Y() ) ); + maNfZoom.SetSizePixel( Size( aPreviewSize.Width() / 6, nScrollBarSize ) ); + maNfZoom.SetValue( GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() ) ); + maFbJPGPreview.Show( sal_True ); + + sal_Int32 nZoom = GetZoomValueFromThumbPos( maSbZoom.GetThumbPos() ); + double fSizePixelX = static_cast< double >( maSize.Width * nZoom ) / 100.0; + double fSizePixelY = static_cast< double >( maSize.Height * nZoom ) / 100.0; + + double fXRatio = fSizePixelX / maSize.Width; // the size of each pixel + double fYRatio = fSizePixelY / maSize.Height; + + sal_Bool bHorzSb = fSizePixelX > aFixedBitmapSize.Width(); + sal_Bool bVertSb = fSizePixelY > aFixedBitmapSize.Height(); + if ( bHorzSb ) + { + aFixedBitmapSize.Height() -= nScrollBarSize; + + maSbJPGPreviewHorz.Show( sal_True ); + maSbJPGPreviewHorz.SetPosPixel( Point( aFixedBitmapPos.X(), aFixedBitmapPos.Y() + aFixedBitmapSize.Height() ) ); + maSbJPGPreviewHorz.SetSizePixel( Size( aFixedBitmapSize.Width(), nScrollBarSize ) ); + } + else + { + maSbJPGPreviewHorz.Show( sal_False ); + } + + + if ( bVertSb ) + { + aFixedBitmapSize.Width() -= nScrollBarSize; + + maSbJPGPreviewVert.Show( sal_True ); + maSbJPGPreviewVert.SetPosPixel( Point( aFixedBitmapPos.X() + aFixedBitmapSize.Width(), aFixedBitmapPos.Y() ) ); + maSbJPGPreviewVert.SetSizePixel( Size( nScrollBarSize, aFixedBitmapSize.Height() ) ); + } + else + { + maSbJPGPreviewVert.Show( sal_False ); + } + + Point aPos( 0, 0 ); + Size aSize; + if ( fXRatio > 1.0 ) + { + aSize.Width() = maSize.Width > aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width(); + aSize.Width() /= static_cast<long int>(fXRatio); + } + else + { + aSize.Width() = maSize.Width < aFixedBitmapSize.Width() ? maSize.Width : aFixedBitmapSize.Width(); + aSize.Width() /= static_cast<long int>(fXRatio); + } + + if ( fYRatio > 1.0 ) + { + aSize.Height() = maSize.Height > aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height(); + aSize.Height() /= static_cast<long int>(fYRatio); + } + else + { + aSize.Height() = maSize.Height < aFixedBitmapSize.Height() ? maSize.Height : aFixedBitmapSize.Height(); + aSize.Height() /= static_cast<long int>(fYRatio); + } + + if ( aSize.Width() < maSize.Width ) + { + sal_Int32 nXDiff = static_cast< sal_Int32 >( ( ( ( maSize.Width - aSize.Width() ) * maSbJPGPreviewHorz.GetThumbPos() ) / 100.0 ) ); + aPos.X() += nXDiff; + } + if ( aSize.Height() < maSize.Height ) + { + sal_Int32 nYDiff = static_cast< sal_Int32 >( ( ( ( maSize.Height - aSize.Height() ) * maSbJPGPreviewVert.GetThumbPos() ) / 100.0 ) ); + aPos.Y() += nYDiff; + } + + Bitmap aCroppedBitmap( maBitmap ); + aCroppedBitmap.Crop( Rectangle( aPos, aSize ) ); + aSize = aCroppedBitmap.GetSizePixel(); + aSize = Size( static_cast<long int>(aSize.Width() * fXRatio), static_cast<long int>(aSize.Height() * fYRatio) ); + aCroppedBitmap.Scale( aSize ); + + if ( aSize.Width() > aFixedBitmapSize.Width() ) + aSize.Width() = aFixedBitmapSize.Width(); + if ( aSize.Height() > aFixedBitmapSize.Height() ) + aSize.Height() = aFixedBitmapSize.Height(); + Point aPoint( aFixedBitmapPos ); + if ( aSize.Width() < aFixedBitmapSize.Width() ) + aPoint.X() += ( aFixedBitmapSize.Width() - aSize.Width() ) / 2; + if ( aSize.Height() < aFixedBitmapSize.Height() ) + aPoint.Y() += ( aFixedBitmapSize.Height() - aSize.Height() ) / 2; + + maFbJPGPreview.SetPosPixel( aPoint ); + maFbJPGPreview.SetSizePixel( aSize ); + maFbJPGPreview.SetBitmap( aCroppedBitmap ); + + SetOutputSizePixel( Size( maDialogSize.Width() * 2, maDialogSize.Height() ) ); + + maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth() * 2, maRectFlButtons.GetHeight() ) ); + maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left() + maDialogSize.Width(), maRectBtnHelp.Top() ) ); + maBtnOK.SetPosPixel( Point( maRectBtnOK.Left() + maDialogSize.Width(), maRectBtnOK.Top() ) ); + maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left() + maDialogSize.Width(), maRectBtnCancel.Top() ) ); + } + else + { + maSbZoom.Show( sal_False ); + maNfZoom.Show( sal_False ); + maFbJPGPreview.Show( sal_False ); + maSbJPGPreviewHorz.Show( sal_False ); + maSbJPGPreviewVert.Show( sal_False ); + + SetOutputSizePixel( maDialogSize ); + + maFlButtons.SetSizePixel( Size( maRectFlButtons.GetWidth(), maRectFlButtons.GetHeight() ) ); + maBtnHelp.SetPosPixel( Point( maRectBtnHelp.Left(), maRectBtnHelp.Top() ) ); + maBtnOK.SetPosPixel( Point( maRectBtnOK.Left(), maRectBtnOK.Top() ) ); + maBtnCancel.SetPosPixel( Point( maRectBtnCancel.Left(), maRectBtnCancel.Top() ) ); + } +} + +void ExportDialog::updateControls() +{ + GetGraphicStream(); + + // Size Controls + if ( !mbIsPixelFormat ) + { + awt::Size aSize100thmm( maSize ); + Size aSize( LogicToLogic( Size( aSize100thmm.Width * 100, aSize100thmm.Height * 100 ), MAP_100TH_MM, + MapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) ) ); + maMfSizeX.SetValue( aSize.Width() ); + maMfSizeY.SetValue( aSize.Height() ); + } + else + { + MapUnit aMapUnit( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ); + if ( aMapUnit == MAP_PIXEL ) + { // calculating pixel count via resolution and original graphic size + maMfSizeX.SetDecimalDigits( 0 ); + maMfSizeY.SetDecimalDigits( 0 ); + maMfSizeX.SetValue( maSize.Width ); + maMfSizeY.SetValue( maSize.Height ); + } + else + { + maMfSizeX.SetDecimalDigits( 2 ); + maMfSizeY.SetDecimalDigits( 2 ); + double fRatio; + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : fRatio = static_cast< double >( maResolution.Width ) * 0.0254; break; + case MAP_MM : fRatio = static_cast< double >( maResolution.Width ) * 0.001; break; + case MAP_POINT :fRatio = ( static_cast< double >( maResolution.Width ) * 0.0254 ) / 72.0; break; + default: + case MAP_CM : fRatio = static_cast< double >( maResolution.Width ) * 0.01; break; + } + maMfSizeX.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Width * 100 ) / fRatio ) + 0.5 ) ); + maMfSizeY.SetValue( static_cast< sal_Int32 >( ( static_cast< double >( maSize.Height * 100 ) / fRatio ) + 0.5 ) ); + } + } + sal_Int32 nResolution = 0; + switch( maLbResolution.GetSelectEntryPos() ) + { + case 0 : nResolution = maResolution.Width / 100; break; // pixels / cm + case 2 : nResolution = maResolution.Width; break; // pixels / meter + default: + case 1 : nResolution = static_cast< sal_Int32 >(maResolution.Width * 0.0254); break; // pixels / inch + } + maNfResolution.SetValue( nResolution ); + + if ( maSbCompression.IsVisible() ) + maSbCompression.SetThumbPos( maNfCompression.GetValue() ); + + // updating estimated size + sal_Int64 nRealFileSize( mpTempStream->Tell() ); + if ( mbIsPixelFormat ) + { + String aEst( nRealFileSize ? msEstimatedSizePix2 : msEstimatedSizePix1 ); + sal_Int64 nRawFileSize( GetRawFileSize() ); + xub_StrLen nInd = aEst.Search( '%' ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRawFileSize ) ); + + if ( nRealFileSize ) + { + nInd = aEst.Search( '%', nInd ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) ); + } + maFtEstimatedSize.SetText( aEst ); + } + else + { + if ( mnMaxFilesizeForRealtimePreview ) + { + String aEst( msEstimatedSizeVec ); + xub_StrLen nInd = aEst.Search( '%', 0 ); + aEst.Replace( nInd, 2, ImpValueOfInKB( nRealFileSize ) ); + maFtEstimatedSize.SetText( aEst ); + } + } + updatePreview(); + + // EPS + if ( maRbEPSLevel1.IsVisible() ) + { + sal_Bool bEnabled = maRbEPSLevel1.IsChecked() == sal_False; + maRbEPSColorFormat1.Enable( bEnabled ); + maRbEPSColorFormat2.Enable( bEnabled ); + maRbEPSCompressionLZW.Enable( bEnabled ); + maRbEPSCompressionNone.Enable( bEnabled ); + } +} + +ExportDialog::~ExportDialog() +{ + delete mpFilterOptionsItem; + delete mpOptionsItem; +} + + +/************************************************************************* +|* +|* Speichert eingestellte Werte in ini-Datei +|* +\************************************************************************/ +IMPL_LINK( ExportDialog, UpdateHdl, void *, EMPTYARG ) +{ + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlMtfSizeX, void *, EMPTYARG ) +{ + double fRatio = static_cast< double >( maOriginalSize.Height ) / maOriginalSize.Width; + + if ( mbIsPixelFormat ) + { + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_CM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.01 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_MM : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.001 * maMfSizeX.GetValue() / 100.0 + 0.5 ); break; + case MAP_POINT : maSize.Width = static_cast< sal_Int32 >( static_cast< double >( maResolution.Width ) * 0.0254 * maMfSizeX.GetValue() / 100.0 * 72 + 0.5 ); break; + default: + case MAP_PIXEL : maSize.Width = maMfSizeX.GetValue(); break; + } + maSize.Height = static_cast< sal_Int32 >( fRatio * maSize.Width + 0.5 ); + } + else + { + Fraction aFract( 1, 100 ); + sal_Int32 nWidth = maMfSizeX.GetValue(); + sal_Int32 nHeight= static_cast< sal_Int32 >( nWidth * fRatio ); + const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + + maSize.Width = aDest.Width(); + if ( mbPreserveAspectRatio ) + maSize.Height = aDest.Height(); + } + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlMtfSizeY, void *, EMPTYARG ) +{ + double fRatio = static_cast< double >( maOriginalSize.Width ) / maOriginalSize.Height; + + if ( mbIsPixelFormat ) + { + switch( GetMapUnit( maLbSizeX.GetSelectEntryPos() ) ) + { + case MAP_INCH : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_CM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.01 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_MM : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.001 * maMfSizeY.GetValue() / 100.0 + 0.5 ); break; + case MAP_POINT : maSize.Height = static_cast< sal_Int32 >( static_cast< double >( maResolution.Height ) * 0.0254 * maMfSizeY.GetValue() / 100.0 * 72 + 0.5 ); break; + default: + case MAP_PIXEL : maSize.Height = maMfSizeY.GetValue(); break; + } + maSize.Width = static_cast< sal_Int32 >( fRatio * maSize.Height + 0.5 ); + } + else + { + Fraction aFract( 1, 100 ); + sal_Int32 nHeight= maMfSizeY.GetValue(); + sal_Int32 nWidth = static_cast< sal_Int32 >( nHeight * fRatio ); + const Size aSource( static_cast< sal_Int32 >( nWidth ), static_cast< sal_Int32 >( nHeight ) ); + MapMode aSourceMapMode( GetMapUnit( maLbSizeX.GetSelectEntryPos() ),Point(), aFract, aFract ); + Size aDest( LogicToLogic( aSource, aSourceMapMode, MAP_100TH_MM ) ); + + maSize.Height = aDest.Height(); + if ( mbPreserveAspectRatio ) + maSize.Width = aDest.Width(); + } + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, UpdateHdlNfResolution, void *, EMPTYARG ) +{ + sal_Int32 nResolution = maNfResolution.GetValue(); + if ( maLbResolution.GetSelectEntryPos() == 0 ) // pixels / cm + nResolution *= 100; + else if ( maLbResolution.GetSelectEntryPos() == 1 ) // pixels / inch + nResolution = static_cast< sal_Int32 >( ( ( static_cast< double >( nResolution ) + 0.5 ) / 0.0254 ) ); + maResolution.Width = nResolution; + maResolution.Height= nResolution; + + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, SbCompressionUpdateHdl, void *, EMPTYARG ) +{ + maNfCompression.SetValue( maSbCompression.GetThumbPos() ); + updateControls(); + return 0; +} + +IMPL_LINK( ExportDialog, OK, void *, EMPTYARG ) +{ + // writing config parameter + + + mrFltCallPara.aFilterData = GetFilterData( sal_True ); + EndDialog( RET_OK ); + + return 0; +} + diff --git a/svtools/source/filter.vcl/filter/exportdialog.hrc b/svtools/source/filter.vcl/filter/exportdialog.hrc new file mode 100755 index 000000000000..e230bcd2c5c3 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.hrc @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <svtools/svtools.hrc> + +#define BTN_OK 1 +#define BTN_CANCEL 1 +#define BTN_HELP 1 + +#define FL_EXPORT_SIZE 1 +#define FL_COLOR_DEPTH 2 +#define FL_JPG_QUALITY 3 +#define FL_COMPRESSION 4 +#define FL_MODE 5 +#define FL_GIF_DRAWING_OBJECTS 6 +#define FL_PBM_OPTIONS 7 +#define FL_EPS_PREVIEW 8 +#define FL_EPS_VERSION 9 +#define FL_EPS_COLOR_FORMAT 10 +#define FL_ESTIMATED_SIZE 11 +#define FL_BUTTONS 12 + +#define FT_SIZEX 1 +#define FT_SIZEY 2 +#define FT_RESOLUTION 3 +#define FT_JPG_MIN 4 +#define FT_JPG_MAX 5 +#define FT_PNG_MIN 6 +#define FT_PNG_MAX 7 +#define FT_ESTIMATED_SIZE 8 + +#define NF_RESOLUTION 1 +#define NF_COMPRESSION 2 +#define NF_ZOOM 3 + +#define MF_SIZEX 1 +#define MF_SIZEY 2 + +#define LB_SIZEX 1 +#define LB_SIZEY 2 +#define LB_RESOLUTION 3 +#define LB_COLOR_DEPTH 4 + +#define RB_BINARY 1 +#define RB_TEXT 2 +#define RB_EPS_LEVEL1 3 +#define RB_EPS_LEVEL2 4 +#define RB_EPS_COLOR_FORMAT1 5 +#define RB_EPS_COLOR_FORMAT2 6 +#define RB_EPS_COMPRESSION_LZW 7 +#define RB_EPS_COMPRESSION_NONE 8 + +#define CB_JPG_PREVIEW 1 +#define CB_INTERLACED 2 +#define CB_RLE_ENCODING 3 +#define CB_SAVE_TRANSPARENCY 4 +#define CB_EPS_PREVIEW_TIFF 5 +#define CB_EPS_PREVIEW_EPSI 6 + +#define FB_JPG_PREVIEW 1 + +#define SB_COMPRESSION 1 +#define SB_JPG_PREVIEW_HORZ 2 +#define SB_JPG_PREVIEW_VERT 3 +#define SB_ZOOM 4 + +#define STR_1BIT_THRESHOLD 1 +#define STR_1BIT_DITHERED 2 +#define STR_4BIT_GRAYSCALE 3 +#define STR_4BIT_COLOR_PALETTE 4 +#define STR_8BIT_GRAYSCALE 5 +#define STR_8BIT_COLOR_PALETTE 6 +#define STR_24BIT_TRUE_COLOR 7 +#define STR_ESTIMATED_SIZE_PIX_1 8 +#define STR_ESTIMATED_SIZE_PIX_2 9 +#define STR_ESTIMATED_SIZE_VEC 10 diff --git a/svtools/source/filter.vcl/filter/exportdialog.hxx b/svtools/source/filter.vcl/filter/exportdialog.hxx new file mode 100755 index 000000000000..20a9ac3ea832 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef _EXPORTDIALOG_HXX_ +#define _EXPORTDIALOG_HXX_ + +#include <svtools/fltcall.hxx> +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/field.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/arrange.hxx> +#include <vcl/scrbar.hxx> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> + +/************************************************************************* +|* +|* Dialog zum Einstellen von Filteroptionen bei Pixelformaten +|* +\************************************************************************/ + +class FilterConfigItem; +class ExportDialog : public ModalDialog +{ +private: + + FltCallDialogParameter& + mrFltCallPara; + + ResMgr* mpMgr; + + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > + mxMgr; + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& + mxSourceDocument; + + FixedLine maFlExportSize; + FixedText maFtSizeX; + MetricField maMfSizeX; + ListBox maLbSizeX; + FixedText maFtSizeY; + MetricField maMfSizeY; + ListBox maLbSizeY; + FixedText maFtResolution; + NumericField maNfResolution; + ListBox maLbResolution; + FixedLine maFlColorDepth; + ListBox maLbColorDepth; + FixedLine maFlJPGQuality; + FixedLine maFlMode; + FixedLine maFlPBMOptions; + ScrollBar maSbCompression; + NumericField maNfCompression; + FixedText maFtJPGMin; + FixedText maFtJPGMax; + FixedText maFtPNGMin; + FixedText maFtPNGMax; + CheckBox maCbJPGPreview; + CheckBox maCbInterlaced; + CheckBox maCbRLEEncoding; + FixedLine maFlGIFDrawingObjects; + CheckBox maCbSaveTransparency; + RadioButton maRbBinary; + RadioButton maRbText; + FixedLine maFlEPSPreview; + CheckBox maCbEPSPreviewTIFF; + CheckBox maCbEPSPreviewEPSI; + FixedLine maFlEPSVersion; + RadioButton maRbEPSLevel1; + RadioButton maRbEPSLevel2; + FixedLine maFlEPSColorFormat; + RadioButton maRbEPSColorFormat1; + RadioButton maRbEPSColorFormat2; + FixedLine maFlCompression; + RadioButton maRbEPSCompressionLZW; + RadioButton maRbEPSCompressionNone; + FixedLine maFlEstimatedSize; + FixedText maFtEstimatedSize; + String msEstimatedSizePix1; + String msEstimatedSizePix2; + String msEstimatedSizeVec; + FixedLine maFlButtons; + FixedBitmap maFbJPGPreview; + ScrollBar maSbZoom; + NumericField maNfZoom; + ScrollBar maSbJPGPreviewHorz; + ScrollBar maSbJPGPreviewVert; + OKButton maBtnOK; + CancelButton maBtnCancel; + HelpButton maBtnHelp; + + String ms1BitTreshold; + String ms1BitDithered; + String ms4BitGrayscale; + String ms4BitColorPalette; + String ms8BitGrayscale; + String ms8BitColorPalette; + String ms24BitColor; + + vcl::RowOrColumn maLayout; + Size maDialogSize; + + FilterConfigItem* mpOptionsItem; + FilterConfigItem* mpFilterOptionsItem; + + String maExt; + String maEstimatedSizeText; + sal_Int16 mnFormat; + sal_Int32 mnMaxFilesizeForRealtimePreview; + + Rectangle maRectFlButtons; + Rectangle maRectBtnHelp; + Rectangle maRectBtnOK; + Rectangle maRectBtnCancel; + + SvStream* mpTempStream; + Bitmap maBitmap; + + com::sun::star::awt::Size + maOriginalSize; // the original graphic size in 1/100mm + com::sun::star::awt::Size + maSize; // for vector graphics it always contains the logical size in 1/100mm + + sal_Bool mbPreview; + sal_Bool mbIsPixelFormat; + sal_Bool mbExportSelection; + sal_Bool mbPreserveAspectRatio; + + sal_Int32 mnInitialResolutionUnit; + + // for pixel graphics it always contains the pixel count + com::sun::star::awt::Size + maResolution; // it always contains the number of pixels per meter + + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > + mxShape; + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > + mxShapes; + com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > + mxPage; + + + DECL_LINK( UpdateHdl,void* p ); + DECL_LINK( UpdateHdlMtfSizeX,void* p ); + DECL_LINK( UpdateHdlMtfSizeY,void* p ); + DECL_LINK( UpdateHdlNfResolution,void* p ); + DECL_LINK( SbCompressionUpdateHdl,void* p ); + DECL_LINK( NfCompressionUpdateHdlX,void* p ); + + DECL_LINK( OK, void* p ); + + void createSizeControls( vcl::RowOrColumn& ); + void createColorDepthControls( vcl::RowOrColumn& ); + void createFilterOptions( vcl::RowOrColumn& ); + void createButtons( vcl::RowOrColumn& ); + void createScrollBar( vcl::RowOrColumn& ); + void setupLayout(); + void updatePreview(); + void updateControls(); + + void GetGraphicSource(); + sal_Bool GetGraphicStream(); + Bitmap GetGraphicBitmap( SvStream& rStream ); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + GetFilterData( sal_Bool bUpdateConfig ); + + sal_uInt32 GetRawFileSize() const; + sal_Bool IsTempExportAvailable() const; + + com::sun::star::awt::Size + GetOriginalSize(); + + sal_Int32 GetDefaultUnit(); + +public: + ExportDialog( FltCallDialogParameter& rPara, + const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > rxMgr, + const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument, + sal_Bool bExportSelection, sal_Bool bIsExportVectorFormat ); + ~ExportDialog(); +}; + + + +#endif // _EXPORTDIALOG_HXX_ + diff --git a/svtools/source/filter.vcl/filter/exportdialog.src b/svtools/source/filter.vcl/filter/exportdialog.src new file mode 100644 index 000000000000..c9e87989a314 --- /dev/null +++ b/svtools/source/filter.vcl/filter/exportdialog.src @@ -0,0 +1,529 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "exportdialog.hrc" + +String DLG_EXPORT_TITLE +{ + Text [ en-US ] = " Options" ; +}; + +ModalDialog DLG_EXPORT +{ + HelpID = "svtools:ModalDialog:DLG_EXPORT"; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 178 , 135 ) ; + Moveable = TRUE ; + Closeable = TRUE ; + + FixedLine FL_EXPORT_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Size" ; + }; + FixedText FT_SIZEX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Width:" ; + }; + MetricField MF_SIZEX + { + HelpID = "svtools:MetricField:DLG_EXPORT:MF_SIZEX"; + Hide = TRUE; + Border = TRUE; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE; + Repeat = TRUE; + Spin = FALSE; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_NONE; + Maximum = 99999; + Last = 255; + }; + ListBox LB_SIZEX + { + HelpID = "svtools:ListBox:DLG_EXPORT:LB_SIZEX"; + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "inches" ; > ; + < "cm" ; Default ; > ; + < "mm" ; > ; + < "points" ; > ; + < "pixels" ; > ; + }; + }; + FixedText FT_SIZEY + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Height:" ; + }; + MetricField MF_SIZEY + { + HelpID = "svtools:MetricField:DLG_EXPORT:MF_SIZEY"; + Hide = TRUE; + Border = TRUE; + Size = MAP_APPFONT ( 30, 12 ); + TabStop = TRUE; + Repeat = TRUE; + Spin = FALSE; + StrictFormat = TRUE; + DecimalDigits = 2; + Unit = FUNIT_NONE; + Maximum = 99999; + Last = 255 ; + }; + ListBox LB_SIZEY + { + HelpID = "svtools:ListBox:DLG_EXPORT:LB_SIZEY"; + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "inches" ; > ; + < "cm" ; Default ; > ; + < "mm" ; > ; + < "points" ; > ; + < "pixels" ; > ; + }; + }; + FixedText FT_RESOLUTION + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Resolution:" ; + }; + NumericField NF_RESOLUTION + { + HelpID = "svtools:NumericField:DLG_EXPORT:NF_RESOLUTION"; + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 99999; + Last = 255 ; + }; + ListBox LB_RESOLUTION + { + HelpID = "svtools:ListBox:DLG_EXPORT:LB_RESOLUTION"; + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + StringList [ en-US ] = + { + < "pixels/cm" ; > ; + < "pixels/inch" ; Default ; > ; + < "pixels/meter" ; > ; + }; + }; + FixedLine FL_COLOR_DEPTH + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Color Depth" ; + }; + ListBox LB_COLOR_DEPTH + { + HelpID = "svtools:ListBox:DLG_EXPORT:LB_COLOR_DEPTH"; + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 60, 80 ) ; + DropDown = TRUE ; + Sort = FALSE ; + }; + String STR_1BIT_THRESHOLD + { + Text [ en-US ] = "1 bit threshold"; + }; + String STR_1BIT_DITHERED + { + Text [ en-US ] = "1 bit dithered"; + }; + String STR_4BIT_GRAYSCALE + { + Text [ en-US ] = "4 bit grayscale"; + }; + String STR_4BIT_COLOR_PALETTE + { + Text [ en-US ] = "4 bit color"; + }; + String STR_8BIT_GRAYSCALE + { + Text [ en-US ] = "8 bit grayscale"; + }; + String STR_8BIT_COLOR_PALETTE + { + Text [ en-US ] = "8 bit color"; + }; + String STR_24BIT_TRUE_COLOR + { + Text [ en-US ] = "24 bit true color"; + }; + FixedLine FL_JPG_QUALITY + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Quality" ; + }; + FixedLine FL_COMPRESSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Compression" ; + }; + FixedLine FL_MODE + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Mode" ; + }; + FixedLine FL_PBM_OPTIONS + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "File Format" ; + }; + ScrollBar SB_COMPRESSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ) ; + VScroll = FALSE ; + HScroll = TRUE; + Drag = TRUE ; + }; + NumericField NF_COMPRESSION + { + HelpID = "svtools:NumericField:DLG_EXPORT:NF_COMPRESSION"; + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 99999; + Last = 255 ; + }; + FixedText FT_JPG_MIN + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "1 is minimum Quality and smallest file size." ; + }; + FixedText FT_JPG_MAX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "100 is maximum Quality and biggest file size." ; + }; + FixedText FT_PNG_MIN + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "0 is biggest file size and fastest loading." ; + }; + FixedText FT_PNG_MAX + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "9 is smallest file size and slowest loading." ; + }; + CheckBox CB_JPG_PREVIEW + { + HelpID = "svtools:CheckBox:DLG_EXPORT:CB_JPG_PREVIEW"; + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Preview" ; + }; + CheckBox CB_INTERLACED + { + HelpID = "svtools:CheckBox:DLG_EXPORT:CB_INTERLACED"; + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Interlaced" ; + }; + CheckBox CB_RLE_ENCODING + { + HelpID = "svtools:CheckBox:DLG_EXPORT:CB_RLE_ENCODING"; + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "RLE encoding" ; + }; + FixedLine FL_GIF_DRAWING_OBJECTS + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Drawing Objects" ; + }; + CheckBox CB_SAVE_TRANSPARENCY + { + HelpID = "svtools:CheckBox:DLG_EXPORT:CB_SAVE_TRANSPARENCY"; + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Save transparency" ; + }; + RadioButton RB_BINARY + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_BINARY"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Binary" ; + }; + RadioButton RB_TEXT + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_TEXT"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Text" ; + }; + FixedLine FL_EPS_PREVIEW + { + Hide = TRUE; + Size = MAP_APPFONT ( 110 , 8 ) ; + Text [ en-US ] = "Preview" ; + }; + CheckBox CB_EPS_PREVIEW_TIFF + { + HelpID = "svtools:CheckBox:DLG_EXPORT:CB_EPS_PREVIEW_TIFF"; + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Image Preview (TIFF)" ; + }; + CheckBox CB_EPS_PREVIEW_EPSI + { + HelpID = "svtools:CheckBox:DLG_EXPORT:CB_EPS_PREVIEW_EPSI"; + Hide = TRUE; + Size = MAP_APPFONT ( 60 , 10 ) ; + Text [ en-US ] = "Interchange (EPSI)" ; + }; + FixedLine FL_EPS_VERSION + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Version" ; + }; + RadioButton RB_EPS_LEVEL1 + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_EPS_LEVEL1"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Level 1" ; + }; + RadioButton RB_EPS_LEVEL2 + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_EPS_LEVEL2"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Level 2" ; + }; + FixedLine FL_EPS_COLOR_FORMAT + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + Text [ en-US ] = "Color format" ; + }; + RadioButton RB_EPS_COLOR_FORMAT1 + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_EPS_COLOR_FORMAT1"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Color" ; + }; + RadioButton RB_EPS_COLOR_FORMAT2 + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_EPS_COLOR_FORMAT2"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "Grayscale" ; + }; + RadioButton RB_EPS_COMPRESSION_LZW + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_EPS_COMPRESSION_LZW"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "LZW encoding" ; + }; + RadioButton RB_EPS_COMPRESSION_NONE + { + HelpID = "svtools:RadioButton:DLG_EXPORT:RB_EPS_COMPRESSION_NONE"; + Hide = TRUE; + Size = MAP_APPFONT ( 105 , 10 ) ; + Text [ en-US ] = "None" ; + }; + FixedLine FL_ESTIMATED_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + FixedText FT_ESTIMATED_SIZE + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + String STR_ESTIMATED_SIZE_PIX_1 + { + Text [ en-US ] = "The picture needs about %1 KB of memory."; + }; + String STR_ESTIMATED_SIZE_PIX_2 + { + Text [ en-US ] = "The picture needs about %1 KB of memory,\n the file size is %2 KB."; + }; + String STR_ESTIMATED_SIZE_VEC + { + Text [ en-US ] = "The file size is %1 KB."; + }; + FixedLine FL_BUTTONS + { + Hide = TRUE; + Size = MAP_APPFONT ( 41 , 10 ) ; + }; + FixedBitmap FB_JPG_PREVIEW + { + Hide = TRUE; + OutputSize = TRUE ; + Scale = TRUE; + Border = TRUE; + }; + ScrollBar SB_ZOOM + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = FALSE; + HScroll = TRUE; + Drag = TRUE; + MinPos = 5; + MaxPos = 100; + ThumbPos = 50; + }; + NumericField NF_ZOOM + { + HelpID = "svtools:NumericField:DLG_EXPORT:NF_ZOOM"; + Hide = TRUE; + Border = TRUE ; + Size = MAP_APPFONT ( 30, 12 ) ; + TabStop = TRUE ; + Repeat = TRUE ; + Spin = FALSE ; + Maximum = 3000; + Last = 255 ; + }; + ScrollBar SB_JPG_PREVIEW_HORZ + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = FALSE; + HScroll = TRUE; + Drag = TRUE; + MinPos = 0; + MaxPos = 100; + ThumbPos = 50; + }; + ScrollBar SB_JPG_PREVIEW_VERT + { + Hide = TRUE; + Size = MAP_APPFONT ( 48, 10 ); + VScroll = TRUE; + HScroll = FALSE; + Drag = TRUE; + MinPos = 0; + MaxPos = 100; + ThumbPos = 50; + }; + OKButton BTN_OK + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Hide = TRUE; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index fe6adfa266ba..5ea07d2017f2 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -53,7 +53,7 @@ #include "xbmread.hxx" #include "xpmread.hxx" #include <svl/solar.hrc> -#include "strings.hrc" +#include <svtools/svtools.hrc> #include "sgffilt.hxx" #include "osl/module.hxx" #include <com/sun/star/uno/Reference.h> @@ -78,7 +78,7 @@ #define PMGCHUNG_msOG 0x6d734f47 // Microsoft Office Animated GIF -#if defined WIN || (defined OS2 && !defined ICC) +#if (defined OS2 && !defined ICC) #define IMPORT_FUNCTION_NAME "_GraphicImport" #define EXPORT_FUNCTION_NAME "_GraphicExport" @@ -94,10 +94,6 @@ #endif -// Compilerfehler, wenn Optimierung bei WNT & MSC -#ifdef _MSC_VER -#pragma optimize( "", off ) -#endif // ----------- // - statics - @@ -136,9 +132,9 @@ public: ~ImpFilterOutputStream() {} }; -BOOL ImplDirEntryHelper::Exists( const INetURLObject& rObj ) +sal_Bool ImplDirEntryHelper::Exists( const INetURLObject& rObj ) { - BOOL bExists = FALSE; + sal_Bool bExists = sal_False; try { @@ -191,11 +187,11 @@ void ImplDirEntryHelper::Kill( const String& rMainUrl ) //-------------------------------------------------------------------------- -BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, ULONG nComp, ULONG nSize ) +sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8* pDest, sal_uLong nComp, sal_uLong nSize ) { while ( nComp-- >= nSize ) { - ULONG i; + sal_uLong i; for ( i = 0; i < nSize; i++ ) { if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) @@ -228,9 +224,9 @@ inline String ImpGetExtension( const String &rPath ) |* Eingabe-prarameter: |* rPath - Dateipfad |* rFormatExtension - Inhalt egal -|* bTest - setze FALSE +|* bTest - setze sal_False |* Ausgabe-parameter: -|* Funkionswert - TRUE wenn Erfolg +|* Funkionswert - sal_True wenn Erfolg |* rFormatExtension - Bei Erfolg: uebliche Dateiendung |* des Formats (Grossbuchstaben) |* 2.) Datei anlesen, Dateiformat ueberpruefen @@ -238,32 +234,32 @@ inline String ImpGetExtension( const String &rPath ) |* rPath - Dateipfad |* rFormatExtension - uebliche Dateiendung des Formats |* (Grossbuchstaben) -|* bTest - setze TRUE +|* bTest - setze sal_True |* Ausgabe-parameter: -|* Funkionswert - FALSE, wenn die Datei bestimmt nicht +|* Funkionswert - sal_False, wenn die Datei bestimmt nicht |* vom uebgebenen Format ist. -|* TRUE, wenn die Datei WAHRSCHEINLICH von +|* sal_True, wenn die Datei WAHRSCHEINLICH von |* dem Format ist, ODER WENN DAS FORMAT |* DIESER FUNKTION NICHT BEKANNT IST! |* *************************************************************************/ -static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, BOOL bTest ) +static sal_Bool ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, sal_Bool bTest ) { - USHORT i; - BYTE sFirstBytes[ 256 ]; - ULONG nFirstLong,nSecondLong; - ULONG nStreamPos = rStream.Tell(); + sal_uInt16 i; + sal_uInt8 sFirstBytes[ 256 ]; + sal_uLong nFirstLong,nSecondLong; + sal_uLong nStreamPos = rStream.Tell(); rStream.Seek( STREAM_SEEK_TO_END ); - ULONG nStreamLen = rStream.Tell() - nStreamPos; + sal_uLong nStreamLen = rStream.Tell() - nStreamPos; rStream.Seek( nStreamPos ); if ( !nStreamLen ) { SvLockBytes* pLockBytes = rStream.GetLockBytes(); if ( pLockBytes ) - pLockBytes->SetSynchronMode( TRUE ); + pLockBytes->SetSynchronMode( sal_True ); rStream.Seek( STREAM_SEEK_TO_END ); nStreamLen = rStream.Tell() - nStreamPos; @@ -276,25 +272,25 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B { rStream.Read( sFirstBytes, nStreamLen ); - for( i = (USHORT) nStreamLen; i < 256; i++ ) + for( i = (sal_uInt16) nStreamLen; i < 256; i++ ) sFirstBytes[ i ]=0; } if( rStream.GetError() ) - return FALSE; + return sal_False; // Die ersten 8 Bytes in nFirstLong, nSecondLong unterbringen, // Big-Endian: for( i = 0, nFirstLong = 0L, nSecondLong = 0L; i < 4; i++ ) { - nFirstLong=(nFirstLong<<8)|(ULONG)sFirstBytes[i]; - nSecondLong=(nSecondLong<<8)|(ULONG)sFirstBytes[i+4]; + nFirstLong=(nFirstLong<<8)|(sal_uLong)sFirstBytes[i]; + nSecondLong=(nSecondLong<<8)|(sal_uLong)sFirstBytes[i+4]; } - // Folgende Variable ist nur bei bTest==TRUE interessant. Sie - // bleibt FALSE, wenn das Format (rFormatExtension) hier noch nicht + // Folgende Variable ist nur bei bTest==sal_True interessant. Sie + // bleibt sal_False, wenn das Format (rFormatExtension) hier noch nicht // einprogrammiert wurde. - BOOL bSomethingTested = FALSE; + sal_Bool bSomethingTested = sal_False; // Nun werden die verschieden Formate ueberprueft. Dabei ist die // Reihenfolge nicht egal. Z.b. koennte eine MET-Datei auch durch @@ -303,7 +299,7 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B // Theoretisch waere aber vielleicht auch eine BMP-Datei denkbar, // die durch den MET-Test geht. // Diese Probleme gibt es natuerlich nicht nur bei MET und BMP. - // Deshalb wird im Falle der Uberpruefung eines Formats (bTest==TRUE) + // Deshalb wird im Falle der Uberpruefung eines Formats (bTest==sal_True) // nur genau dieses eine Format getestet. Alles andere koennte fatale // Folgen haben, z.B. wenn der Benutzer sagt, es sei BMP-Datei (und es // ist BMP-Datei), und hier wuerde die Datei durch den MET-Test gehen... @@ -311,26 +307,26 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B //--------------------------- MET ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "MET", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if( sFirstBytes[2] == 0xd3 ) { rStream.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); rStream.Seek( nStreamPos ); - USHORT nFieldSize; - BYTE nMagic; - BOOL bOK=TRUE; + sal_uInt16 nFieldSize; + sal_uInt8 nMagic; + sal_Bool bOK=sal_True; rStream >> nFieldSize >> nMagic; for (i=0; i<3; i++) { - if (nFieldSize<6) { bOK=FALSE; break; } - if (nStreamLen < rStream.Tell() + nFieldSize ) { bOK=FALSE; break; } + if (nFieldSize<6) { bOK=sal_False; break; } + if (nStreamLen < rStream.Tell() + nFieldSize ) { bOK=sal_False; break; } rStream.SeekRel(nFieldSize-3); rStream >> nFieldSize >> nMagic; - if (nMagic!=0xd3) { bOK=FALSE; break; } + if (nMagic!=0xd3) { bOK=sal_False; break; } } rStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); if (bOK && !rStream.GetError()) { rFormatExtension= UniString::CreateFromAscii( "MET", 3 ); - return TRUE; + return sal_True; } } } @@ -338,9 +334,9 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B //--------------------------- BMP ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "BMP", 3 ) == COMPARE_EQUAL ) ) { - BYTE nOffs; + sal_uInt8 nOffs; - bSomethingTested=TRUE; + bSomethingTested=sal_True; // OS/2-Bitmaparray ('BA') koennen wir evtl. auch lesen, // dementspr. muessen wir den Offset anpassen, @@ -364,7 +360,7 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B sFirstBytes[14+nOffs] == 0x0c ) { rFormatExtension = UniString::CreateFromAscii( "BMP", 3 ); - return TRUE; + return sal_True; } } } @@ -375,33 +371,33 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B ( rFormatExtension.CompareToAscii( "WMF", 3 ) == COMPARE_EQUAL ) || ( rFormatExtension.CompareToAscii( "EMF", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested = TRUE; + bSomethingTested = sal_True; if ( nFirstLong==0xd7cdc69a || nFirstLong==0x01000900 ) { rFormatExtension = UniString::CreateFromAscii( "WMF", 3 ); - return TRUE; + return sal_True; } else if( nFirstLong == 0x01000000 && sFirstBytes[ 40 ] == 0x20 && sFirstBytes[ 41 ] == 0x45 && sFirstBytes[ 42 ] == 0x4d && sFirstBytes[ 43 ] == 0x46 ) { rFormatExtension = UniString::CreateFromAscii( "EMF", 3 ); - return TRUE; + return sal_True; } } //--------------------------- PCX ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "PCX", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if (sFirstBytes[0]==0x0a) { - BYTE nVersion=sFirstBytes[1]; - BYTE nEncoding=sFirstBytes[2]; + sal_uInt8 nVersion=sFirstBytes[1]; + sal_uInt8 nEncoding=sFirstBytes[2]; if( ( nVersion==0 || nVersion==2 || nVersion==3 || nVersion==5 ) && nEncoding<=1 ) { rFormatExtension = UniString::CreateFromAscii( "PCX", 3 ); - return TRUE; + return sal_True; } } } @@ -409,69 +405,69 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B //--------------------------- TIF ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "TIF", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if ( nFirstLong==0x49492a00 || nFirstLong==0x4d4d002a ) { rFormatExtension=UniString::CreateFromAscii( "TIF", 3 ); - return TRUE; + return sal_True; } } //--------------------------- GIF ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "GIF", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if ( nFirstLong==0x47494638 && (sFirstBytes[4]==0x37 || sFirstBytes[4]==0x39) && sFirstBytes[5]==0x61 ) { rFormatExtension = UniString::CreateFromAscii( "GIF", 3 ); - return TRUE; + return sal_True; } } //--------------------------- PNG ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "PNG", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if (nFirstLong==0x89504e47 && nSecondLong==0x0d0a1a0a) { rFormatExtension = UniString::CreateFromAscii( "PNG", 3 ); - return TRUE; + return sal_True; } } //--------------------------- JPG ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "JPG", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if ( ( nFirstLong==0xffd8ffe0 && sFirstBytes[6]==0x4a && sFirstBytes[7]==0x46 && sFirstBytes[8]==0x49 && sFirstBytes[9]==0x46 ) || ( nFirstLong==0xffd8fffe ) || ( 0xffd8ff00 == ( nFirstLong & 0xffffff00 ) ) ) { rFormatExtension = UniString::CreateFromAscii( "JPG", 3 ); - return TRUE; + return sal_True; } } //--------------------------- SVM ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "SVM", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if( nFirstLong==0x53564744 && sFirstBytes[4]==0x49 ) { rFormatExtension = UniString::CreateFromAscii( "SVM", 3 ); - return TRUE; + return sal_True; } else if( sFirstBytes[0]==0x56 && sFirstBytes[1]==0x43 && sFirstBytes[2]==0x4C && sFirstBytes[3]==0x4D && sFirstBytes[4]==0x54 && sFirstBytes[5]==0x46 ) { rFormatExtension = UniString::CreateFromAscii( "SVM", 3 ); - return TRUE; + return sal_True; } } //--------------------------- PCD ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "PCD", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested = TRUE; + bSomethingTested = sal_True; if( nStreamLen >= 2055 ) { char sBuf[8]; @@ -481,7 +477,7 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B if( strncmp( sBuf, "PCD_IPI", 7 ) == 0 ) { rFormatExtension = UniString::CreateFromAscii( "PCD", 3 ); - return TRUE; + return sal_True; } } } @@ -489,30 +485,30 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B //--------------------------- PSD ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "PSD", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested = TRUE; + bSomethingTested = sal_True; if ( ( nFirstLong == 0x38425053 ) && ( (nSecondLong >> 16 ) == 1 ) ) { rFormatExtension = UniString::CreateFromAscii( "PSD", 3 ); - return TRUE; + return sal_True; } } //--------------------------- EPS ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "EPS", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested = TRUE; - if ( ( nFirstLong == 0xC5D0D3C6 ) || ( ImplSearchEntry( sFirstBytes, (BYTE*)"%!PS-Adobe", 10, 10 ) && - ImplSearchEntry( &sFirstBytes[15], (BYTE*)"EPS", 3, 3 ) ) ) + bSomethingTested = sal_True; + if ( ( nFirstLong == 0xC5D0D3C6 ) || ( ImplSearchEntry( sFirstBytes, (sal_uInt8*)"%!PS-Adobe", 10, 10 ) && + ImplSearchEntry( &sFirstBytes[15], (sal_uInt8*)"EPS", 3, 3 ) ) ) { rFormatExtension = UniString::CreateFromAscii( "EPS", 3 ); - return TRUE; + return sal_True; } } //--------------------------- DXF ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "DXF", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; i=0; while (i<256 && sFirstBytes[i]<=32) @@ -533,31 +529,63 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B if (strncmp((char*)(sFirstBytes+i),"SECTION",7)==0) { rFormatExtension = UniString::CreateFromAscii( "DXF", 3 ); - return TRUE; + return sal_True; } } if( strncmp( (char*) sFirstBytes, "AutoCAD Binary DXF", 18 ) == 0 ) { rFormatExtension = UniString::CreateFromAscii( "DXF", 3 ); - return TRUE; + return sal_True; } } //--------------------------- PCT ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "PCT", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested = TRUE; - BYTE sBuf[4]; + bSomethingTested = sal_True; + sal_uInt8 sBuf[3]; + // store number format + sal_uInt16 oldNumberFormat = rStream.GetNumberFormatInt(); sal_uInt32 nOffset; // in ms documents the pict format is used without the first 512 bytes - for ( nOffset = 10; ( nOffset <= 522 ) && ( ( nStreamPos + nOffset + 3 ) <= nStreamLen ); nOffset += 512 ) + for ( nOffset = 0; ( nOffset <= 512 ) && ( ( nStreamPos + nOffset + 14 ) <= nStreamLen ); nOffset += 512 ) { - rStream.Seek( nStreamPos + nOffset ); + short y1,x1,y2,x2; + bool bdBoxOk = true; + + rStream.Seek( nStreamPos + nOffset); + // size of the pict in version 1 pict ( 2bytes) : ignored + rStream.SeekRel(2); + // bounding box (bytes 2 -> 9) + rStream.SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN); + rStream >> y1 >> x1 >> y2 >> x2; + rStream.SetNumberFormatInt(oldNumberFormat); // reset format + + if (x1 > x2 || y1 > y2 || // bad bdbox + (x1 == x2 && y1 == y2) || // 1 pixel picture + x2-x1 > 2048 || y2-y1 > 2048 ) // picture anormaly big + bdBoxOk = false; + + // read version op rStream.Read( sBuf,3 ); - if ( sBuf[ 0 ] == 0x00 && sBuf[ 1 ] == 0x11 && ( sBuf[ 2 ] == 0x01 || sBuf[ 2 ] == 0x02 ) ) + // see http://developer.apple.com/legacy/mac/library/documentation/mac/pdf/Imaging_With_QuickDraw/Appendix_A.pdf + // normal version 2 - page A23 and A24 + if ( sBuf[ 0 ] == 0x00 && sBuf[ 1 ] == 0x11 && sBuf[ 2 ] == 0x02) + { + rFormatExtension = UniString::CreateFromAscii( "PCT", 3 ); + return sal_True; + } + // normal version 1 - page A25 + else if (sBuf[ 0 ] == 0x11 && sBuf[ 1 ] == 0x01 && bdBoxOk) { + rFormatExtension = UniString::CreateFromAscii( "PCT", 3 ); + return sal_True; + } + // previous code kept in order to do not break any compatibility + // probably eroneous + else if ( sBuf[ 0 ] == 0x00 && sBuf[ 1 ] == 0x11 && sBuf[ 2 ] == 0x01 && bdBoxOk) { - rFormatExtension = UniString::CreateFromAscii( "PCT", 3 ); - return TRUE; + rFormatExtension = UniString::CreateFromAscii( "PCT", 3 ); + return sal_True; } } } @@ -568,7 +596,7 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B ( rFormatExtension.CompareToAscii( "PGM", 3 ) == COMPARE_EQUAL ) || ( rFormatExtension.CompareToAscii( "PPM", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if ( sFirstBytes[ 0 ] == 'P' ) { switch( sFirstBytes[ 1 ] ) @@ -576,17 +604,17 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B case '1' : case '4' : rFormatExtension = UniString::CreateFromAscii( "PBM", 3 ); - return TRUE; + return sal_True; case '2' : case '5' : rFormatExtension = UniString::CreateFromAscii( "PGM", 3 ); - return TRUE; + return sal_True; case '3' : case '6' : rFormatExtension = UniString::CreateFromAscii( "PPM", 3 ); - return TRUE; + return sal_True; } } } @@ -594,81 +622,81 @@ static BOOL ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtension, B //--------------------------- RAS( SUN RasterFile )------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "RAS", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if( nFirstLong == 0x59a66a95 ) { rFormatExtension = UniString::CreateFromAscii( "RAS", 3 ); - return TRUE; + return sal_True; } } //--------------------------- XPM ------------------------------------ if( !bTest ) { - bSomethingTested = TRUE; - if( ImplSearchEntry( sFirstBytes, (BYTE*)"/* XPM */", 256, 9 ) ) + bSomethingTested = sal_True; + if( ImplSearchEntry( sFirstBytes, (sal_uInt8*)"/* XPM */", 256, 9 ) ) { rFormatExtension = UniString::CreateFromAscii( "XPM", 3 ); - return TRUE; + return sal_True; } } else if( rFormatExtension.CompareToAscii( "XPM", 3 ) == COMPARE_EQUAL ) { - bSomethingTested = TRUE; - return TRUE; + bSomethingTested = sal_True; + return sal_True; } //--------------------------- XBM ------------------------------------ if( !bTest ) { - ULONG nSize = ( nStreamLen > 2048 ) ? 2048 : nStreamLen; - BYTE* pBuf = new BYTE [ nSize ]; + sal_uLong nSize = ( nStreamLen > 2048 ) ? 2048 : nStreamLen; + sal_uInt8* pBuf = new sal_uInt8 [ nSize ]; rStream.Seek( nStreamPos ); rStream.Read( pBuf, nSize ); - BYTE* pPtr = ImplSearchEntry( pBuf, (BYTE*)"#define", nSize, 7 ); + sal_uInt8* pPtr = ImplSearchEntry( pBuf, (sal_uInt8*)"#define", nSize, 7 ); if( pPtr ) { - if( ImplSearchEntry( pPtr, (BYTE*)"_width", pBuf + nSize - pPtr, 6 ) ) + if( ImplSearchEntry( pPtr, (sal_uInt8*)"_width", pBuf + nSize - pPtr, 6 ) ) { rFormatExtension = UniString::CreateFromAscii( "XBM", 3 ); delete[] pBuf; - return TRUE; + return sal_True; } } delete[] pBuf; } else if( rFormatExtension.CompareToAscii( "XBM", 3 ) == COMPARE_EQUAL ) { - bSomethingTested = TRUE; - return TRUE; + bSomethingTested = sal_True; + return sal_True; } //--------------------------- TGA ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "TGA", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested = TRUE; + bSomethingTested = sal_True; if( rFormatExtension.CompareToAscii( "TGA", 3 ) == COMPARE_EQUAL ) - return TRUE; + return sal_True; } //--------------------------- SGV ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "SGV", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested = TRUE; + bSomethingTested = sal_True; if( rFormatExtension.CompareToAscii( "SGV", 3 ) == COMPARE_EQUAL ) - return TRUE; + return sal_True; } //--------------------------- SGF ------------------------------------ if( !bTest || ( rFormatExtension.CompareToAscii( "SGF", 3 ) == COMPARE_EQUAL ) ) { - bSomethingTested=TRUE; + bSomethingTested=sal_True; if( sFirstBytes[ 0 ] == 'J' && sFirstBytes[ 1 ] == 'J' ) { rFormatExtension = UniString::CreateFromAscii( "SGF", 3 ); - return TRUE; + return sal_True; } } @@ -686,7 +714,7 @@ sal_uInt16 GraphicFilter::ImpTestOrFindFormat( const String& rPath, SvStream& rS if( rFormat == GRFILTER_FORMAT_DONTKNOW ) { String aFormatExt; - if( ImpPeekGraphicFormat( rStream, aFormatExt, FALSE ) ) + if( ImpPeekGraphicFormat( rStream, aFormatExt, sal_False ) ) { for( sal_uInt16 i = 0; i < n; i++ ) { @@ -715,7 +743,7 @@ sal_uInt16 GraphicFilter::ImpTestOrFindFormat( const String& rPath, SvStream& rS else { String aTmpStr( pConfig->GetImportFormatExtension( rFormat ) ); - if( !ImpPeekGraphicFormat( rStream, aTmpStr, TRUE ) ) + if( !ImpPeekGraphicFormat( rStream, aTmpStr, sal_True ) ) return GRFILTER_FORMATERROR; if ( pConfig->GetImportFormatExtension( rFormat ).EqualsIgnoreCaseAscii( "pcd" ) ) { @@ -748,7 +776,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r if ( rGraphic.GetType() != GRAPHIC_NONE ) { - sal_Int32 nMode = rConfigItem.ReadInt32( String( ResId( KEY_MODE, *pResMgr ) ), -1 ); + sal_Int32 nMode = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "ExportMode" ) ), -1 ); if ( nMode == -1 ) // the property is not there, this is possible, if the graphic filter { // is called via UnoGraphicExporter and not from a graphic export Dialog @@ -778,7 +806,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r Bitmap aBitmap( rGraphic.GetBitmap() ); MapMode aMap( MAP_100TH_INCH ); - sal_Int32 nDPI = rConfigItem.ReadInt32( String( ResId( KEY_RES, *pResMgr ) ), 75 ); + sal_Int32 nDPI = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ), 75 ); Fraction aFrac( 1, Min( Max( nDPI, sal_Int32( 75 ) ), sal_Int32( 600 ) ) ); aMap.SetScaleX( aFrac ); @@ -802,7 +830,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r else aGraphic = rGraphic; - sal_Int32 nColors = rConfigItem.ReadInt32( String( ResId( KEY_COLORS, *pResMgr ) ), 0 ); // #92767# + sal_Int32 nColors = rConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Color" ) ), 0 ); // #92767# if ( nColors ) // graphic conversion necessary ? { BitmapEx aBmpEx( aGraphic.GetBitmapEx() ); @@ -1047,7 +1075,7 @@ void GraphicFilter::ImplInit() // ------------------------------------------------------------------------ -ULONG GraphicFilter::ImplSetError( ULONG nError, const SvStream* pStm ) +sal_uLong GraphicFilter::ImplSetError( sal_uLong nError, const SvStream* pStm ) { pErrorEx->nFilterError = nError; pErrorEx->nStreamError = pStm ? pStm->GetError() : ERRCODE_NONE; @@ -1055,28 +1083,28 @@ ULONG GraphicFilter::ImplSetError( ULONG nError, const SvStream* pStm ) } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetImportFormatCount() +sal_uInt16 GraphicFilter::GetImportFormatCount() { return pConfig->GetImportFormatCount(); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetImportFormatNumber( const String& rFormatName ) +sal_uInt16 GraphicFilter::GetImportFormatNumber( const String& rFormatName ) { return pConfig->GetImportFormatNumber( rFormatName ); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetImportFormatNumberForMediaType( const String& rMediaType ) +sal_uInt16 GraphicFilter::GetImportFormatNumberForMediaType( const String& rMediaType ) { return pConfig->GetImportFormatNumberForMediaType( rMediaType ); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetImportFormatNumberForShortName( const String& rShortName ) +sal_uInt16 GraphicFilter::GetImportFormatNumberForShortName( const String& rShortName ) { return pConfig->GetImportFormatNumberForShortName( rShortName ); } @@ -1090,35 +1118,35 @@ sal_uInt16 GraphicFilter::GetImportFormatNumberForTypeName( const String& rType // ------------------------------------------------------------------------ -String GraphicFilter::GetImportFormatName( USHORT nFormat ) +String GraphicFilter::GetImportFormatName( sal_uInt16 nFormat ) { return pConfig->GetImportFormatName( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetImportFormatTypeName( USHORT nFormat ) +String GraphicFilter::GetImportFormatTypeName( sal_uInt16 nFormat ) { return pConfig->GetImportFilterTypeName( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetImportFormatMediaType( USHORT nFormat ) +String GraphicFilter::GetImportFormatMediaType( sal_uInt16 nFormat ) { return pConfig->GetImportFormatMediaType( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetImportFormatShortName( USHORT nFormat ) +String GraphicFilter::GetImportFormatShortName( sal_uInt16 nFormat ) { return pConfig->GetImportFormatShortName( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetImportOSFileType( USHORT ) +String GraphicFilter::GetImportOSFileType( sal_uInt16 ) { String aOSFileType; return aOSFileType; @@ -1126,42 +1154,42 @@ String GraphicFilter::GetImportOSFileType( USHORT ) // ------------------------------------------------------------------------ -String GraphicFilter::GetImportWildcard( USHORT nFormat, sal_Int32 nEntry ) +String GraphicFilter::GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry ) { return pConfig->GetImportWildcard( nFormat, nEntry ); } // ------------------------------------------------------------------------ -BOOL GraphicFilter::IsImportPixelFormat( USHORT nFormat ) +sal_Bool GraphicFilter::IsImportPixelFormat( sal_uInt16 nFormat ) { return pConfig->IsImportPixelFormat( nFormat ); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetExportFormatCount() +sal_uInt16 GraphicFilter::GetExportFormatCount() { return pConfig->GetExportFormatCount(); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetExportFormatNumber( const String& rFormatName ) +sal_uInt16 GraphicFilter::GetExportFormatNumber( const String& rFormatName ) { return pConfig->GetExportFormatNumber( rFormatName ); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetExportFormatNumberForMediaType( const String& rMediaType ) +sal_uInt16 GraphicFilter::GetExportFormatNumberForMediaType( const String& rMediaType ) { return pConfig->GetExportFormatNumberForMediaType( rMediaType ); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::GetExportFormatNumberForShortName( const String& rShortName ) +sal_uInt16 GraphicFilter::GetExportFormatNumberForShortName( const String& rShortName ) { return pConfig->GetExportFormatNumberForShortName( rShortName ); } @@ -1175,35 +1203,35 @@ sal_uInt16 GraphicFilter::GetExportFormatNumberForTypeName( const String& rType // ------------------------------------------------------------------------ -String GraphicFilter::GetExportFormatName( USHORT nFormat ) +String GraphicFilter::GetExportFormatName( sal_uInt16 nFormat ) { return pConfig->GetExportFormatName( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetExportFormatTypeName( USHORT nFormat ) +String GraphicFilter::GetExportFormatTypeName( sal_uInt16 nFormat ) { return pConfig->GetExportFilterTypeName( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetExportFormatMediaType( USHORT nFormat ) +String GraphicFilter::GetExportFormatMediaType( sal_uInt16 nFormat ) { return pConfig->GetExportFormatMediaType( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetExportFormatShortName( USHORT nFormat ) +String GraphicFilter::GetExportFormatShortName( sal_uInt16 nFormat ) { return pConfig->GetExportFormatShortName( nFormat ); } // ------------------------------------------------------------------------ -String GraphicFilter::GetExportOSFileType( USHORT ) +String GraphicFilter::GetExportOSFileType( sal_uInt16 ) { String aOSFileType; return aOSFileType; @@ -1211,22 +1239,22 @@ String GraphicFilter::GetExportOSFileType( USHORT ) // ------------------------------------------------------------------------ -String GraphicFilter::GetExportWildcard( USHORT nFormat, sal_Int32 nEntry ) +String GraphicFilter::GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry ) { return pConfig->GetExportWildcard( nFormat, nEntry ); } // ------------------------------------------------------------------------ -BOOL GraphicFilter::IsExportPixelFormat( USHORT nFormat ) +sal_Bool GraphicFilter::IsExportPixelFormat( sal_uInt16 nFormat ) { return pConfig->IsExportPixelFormat( nFormat ); } // ------------------------------------------------------------------------ -USHORT GraphicFilter::CanImportGraphic( const INetURLObject& rPath, - USHORT nFormat, USHORT* pDeterminedFormat ) +sal_uInt16 GraphicFilter::CanImportGraphic( const INetURLObject& rPath, + sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat ) { sal_uInt16 nRetValue = GRFILTER_FORMATERROR; DBG_ASSERT( rPath.GetProtocol() != INET_PROT_NOT_VALID, "GraphicFilter::CanImportGraphic() : ProtType == INET_PROT_NOT_VALID" ); @@ -1243,10 +1271,10 @@ USHORT GraphicFilter::CanImportGraphic( const INetURLObject& rPath, // ------------------------------------------------------------------------ -USHORT GraphicFilter::CanImportGraphic( const String& rMainUrl, SvStream& rIStream, - USHORT nFormat, USHORT* pDeterminedFormat ) +sal_uInt16 GraphicFilter::CanImportGraphic( const String& rMainUrl, SvStream& rIStream, + sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat ) { - ULONG nStreamPos = rIStream.Tell(); + sal_uLong nStreamPos = rIStream.Tell(); sal_uInt16 nRes = ImpTestOrFindFormat( rMainUrl, rIStream, nFormat ); rIStream.Seek(nStreamPos); @@ -1254,13 +1282,13 @@ USHORT GraphicFilter::CanImportGraphic( const String& rMainUrl, SvStream& rIStre if( nRes==GRFILTER_OK && pDeterminedFormat!=NULL ) *pDeterminedFormat = nFormat; - return (USHORT) ImplSetError( nRes, &rIStream ); + return (sal_uInt16) ImplSetError( nRes, &rIStream ); } // ------------------------------------------------------------------------ //SJ: TODO, we need to create a GraphicImporter component -USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath, - USHORT nFormat, USHORT * pDeterminedFormat, sal_uInt32 nImportFlags ) +sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPath, + sal_uInt16 nFormat, sal_uInt16 * pDeterminedFormat, sal_uInt32 nImportFlags ) { sal_uInt16 nRetValue = GRFILTER_FORMATERROR; DBG_ASSERT( rPath.GetProtocol() != INET_PROT_NOT_VALID, "GraphicFilter::ImportGraphic() : ProtType == INET_PROT_NOT_VALID" ); @@ -1275,25 +1303,25 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const INetURLObject& rPa return nRetValue; } -USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, - USHORT nFormat, USHORT* pDeterminedFormat, sal_uInt32 nImportFlags ) +sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, + sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags ) { return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, NULL ); } //------------------------------------------------------------------------- -USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, - USHORT nFormat, USHORT* pDeterminedFormat, sal_uInt32 nImportFlags, +sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvStream& rIStream, + sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, sal_uInt32 nImportFlags, com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >* pFilterData ) { String aFilterName; - ULONG nStmBegin; - USHORT nStatus; + sal_uLong nStmBegin; + sal_uInt16 nStatus; GraphicReader* pContext = rGraphic.GetContext(); GfxLinkType eLinkType = GFX_LINK_TYPE_NONE; - BOOL bDummyContext = ( pContext == (GraphicReader*) 1 ); - const BOOL bLinkSet = rGraphic.IsLink(); + sal_Bool bDummyContext = ( pContext == (GraphicReader*) 1 ); + const sal_Bool bLinkSet = rGraphic.IsLink(); FilterConfigItem* pFilterConfigItem = NULL; Size aPreviewSizeHint( 0, 0 ); @@ -1344,7 +1372,7 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvS else nStmBegin = rIStream.Tell(); - bAbort = FALSE; + bAbort = sal_False; nStatus = ImpTestOrFindFormat( rPath, rIStream, nFormat ); // Falls Pending, geben wir GRFILTER_OK zurueck, // um mehr Bytes anzufordern @@ -1353,13 +1381,13 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvS rGraphic.SetContext( (GraphicReader*) 1 ); rIStream.ResetError(); rIStream.Seek( nStmBegin ); - return (USHORT) ImplSetError( GRFILTER_OK ); + return (sal_uInt16) ImplSetError( GRFILTER_OK ); } rIStream.Seek( nStmBegin ); if( ( nStatus != GRFILTER_OK ) || rIStream.GetError() ) - return (USHORT) ImplSetError( ( nStatus != GRFILTER_OK ) ? nStatus : GRFILTER_OPENERROR, &rIStream ); + return (sal_uInt16) ImplSetError( ( nStatus != GRFILTER_OK ) ? nStatus : GRFILTER_OPENERROR, &rIStream ); if( pDeterminedFormat ) *pDeterminedFormat = nFormat; @@ -1493,7 +1521,7 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvS else if( aFilterName.EqualsIgnoreCaseAscii( IMP_SVSGF ) || aFilterName.EqualsIgnoreCaseAscii( IMP_SVSGV ) ) { - USHORT nVersion; + sal_uInt16 nVersion; unsigned char nTyp = CheckSgfTyp( rIStream, nVersion ); switch( nTyp ) @@ -1605,15 +1633,15 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvS if( nStatus == GRFILTER_OK && bCreateNativeLink && ( eLinkType != GFX_LINK_TYPE_NONE ) && !rGraphic.GetContext() && !bLinkSet ) { - const ULONG nStmEnd = rIStream.Tell(); - const ULONG nBufSize = nStmEnd - nStmBegin; + const sal_uLong nStmEnd = rIStream.Tell(); + const sal_uLong nBufSize = nStmEnd - nStmBegin; if( nBufSize ) { - BYTE* pBuf=0; + sal_uInt8* pBuf=0; try { - pBuf = new BYTE[ nBufSize ]; + pBuf = new sal_uInt8[ nBufSize ]; } catch (std::bad_alloc) { @@ -1624,7 +1652,7 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvS { rIStream.Seek( nStmBegin ); rIStream.Read( pBuf, nBufSize ); - rGraphic.SetLink( GfxLink( pBuf, nBufSize, eLinkType, TRUE ) ); + rGraphic.SetLink( GfxLink( pBuf, nBufSize, eLinkType, sal_True ) ); } } } @@ -1647,12 +1675,12 @@ USHORT GraphicFilter::ImportGraphic( Graphic& rGraphic, const String& rPath, SvS // ------------------------------------------------------------------------ -USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath, +sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObject& rPath, sal_uInt16 nFormat, const uno::Sequence< beans::PropertyValue >* pFilterData ) { sal_uInt16 nRetValue = GRFILTER_FORMATERROR; DBG_ASSERT( rPath.GetProtocol() != INET_PROT_NOT_VALID, "GraphicFilter::ExportGraphic() : ProtType == INET_PROT_NOT_VALID" ); - BOOL bAlreadyExists = ImplDirEntryHelper::Exists( rPath ); + sal_Bool bAlreadyExists = ImplDirEntryHelper::Exists( rPath ); String aMainUrl( rPath.GetMainURL( INetURLObject::NO_DECODE ) ); SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aMainUrl, STREAM_WRITE | STREAM_TRUNC ); @@ -1669,10 +1697,10 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObjec // ------------------------------------------------------------------------ -USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPath, +sal_uInt16 GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPath, SvStream& rOStm, sal_uInt16 nFormat, const uno::Sequence< beans::PropertyValue >* pFilterData ) { - USHORT nFormatCount = GetExportFormatCount(); + sal_uInt16 nFormatCount = GetExportFormatCount(); ResetLastError(); nExpGraphHint = 0; @@ -1683,7 +1711,7 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat String aExt( aURL.GetFileExtension().toAsciiUpperCase() ); - for( USHORT i = 0; i < nFormatCount; i++ ) + for( sal_uInt16 i = 0; i < nFormatCount; i++ ) { if ( pConfig->GetExportFormatExtension( i ).EqualsIgnoreCaseAscii( aExt ) ) { @@ -1693,13 +1721,13 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat } } if( nFormat >= nFormatCount ) - return (USHORT) ImplSetError( GRFILTER_FORMATERROR ); + return (sal_uInt16) ImplSetError( GRFILTER_FORMATERROR ); FilterConfigItem aConfigItem( (uno::Sequence< beans::PropertyValue >*)pFilterData ); String aFilterName( pConfig->GetExportFilterName( nFormat ) ); - bAbort = FALSE; - USHORT nStatus = GRFILTER_OK; + bAbort = sal_False; + sal_uInt16 nStatus = GRFILTER_OK; GraphicType eType; Graphic aGraphic( rGraphic ); @@ -1711,12 +1739,12 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat if( eType != GRAPHIC_BITMAP ) { Size aSizePixel; - ULONG nColorCount,nBitsPerPixel,nNeededMem,nMaxMem; + sal_uLong nColorCount,nBitsPerPixel,nNeededMem,nMaxMem; VirtualDevice aVirDev; // Maximalen Speicherbedarf fuer das Bildes holen: // if( GetOptionsConfig() ) -// nMaxMem = (UINT32)GetOptionsConfig()->ReadKey( "VEC-TO-PIX-MAX-KB", "1024" ).ToInt32(); +// nMaxMem = (sal_uInt32)GetOptionsConfig()->ReadKey( "VEC-TO-PIX-MAX-KB", "1024" ).ToInt32(); // else nMaxMem = 1024; @@ -1733,14 +1761,14 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat else if (nColorCount<=256) nBitsPerPixel=8; else if (nColorCount<=65536) nBitsPerPixel=16; else nBitsPerPixel=24; - nNeededMem=((ULONG)aSizePixel.Width()*(ULONG)aSizePixel.Height()*nBitsPerPixel+7)/8; + nNeededMem=((sal_uLong)aSizePixel.Width()*(sal_uLong)aSizePixel.Height()*nBitsPerPixel+7)/8; // ggf. Groesse des Bildes einschraenken: if (nMaxMem<nNeededMem) { double fFak=sqrt(((double)nMaxMem)/((double)nNeededMem)); - aSizePixel.Width()=(ULONG)(((double)aSizePixel.Width())*fFak); - aSizePixel.Height()=(ULONG)(((double)aSizePixel.Height())*fFak); + aSizePixel.Width()=(sal_uLong)(((double)aSizePixel.Width())*fFak); + aSizePixel.Height()=(sal_uLong)(((double)aSizePixel.Height())*fFak); } aVirDev.SetMapMode(MapMode(MAP_PIXEL)); @@ -1761,13 +1789,13 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat { Bitmap aBmp( aGraphic.GetBitmap() ); sal_Int32 nColorRes = aConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "Colors" ) ), 0 ); - if ( nColorRes && ( nColorRes <= (USHORT)BMP_CONVERSION_24BIT) ) + if ( nColorRes && ( nColorRes <= (sal_uInt16)BMP_CONVERSION_24BIT) ) { if( !aBmp.Convert( (BmpConversion) nColorRes ) ) aBmp = aGraphic.GetBitmap(); } ResMgr* pResMgr = CREATERESMGR( svt ); - sal_Bool bRleCoding = aConfigItem.ReadBool( String( ResId( KEY_RLE_CODING, *pResMgr ) ), sal_True ); + sal_Bool bRleCoding = aConfigItem.ReadBool( String( RTL_CONSTASCII_USTRINGPARAM( "RLE_Coding" ) ), sal_True ); // Wollen wir RLE-Kodiert speichern? aBmp.Write( rOStm, bRleCoding ); delete pResMgr; @@ -1987,16 +2015,16 @@ USHORT GraphicFilter::ExportGraphic( const Graphic& rGraphic, const String& rPat // ------------------------------------------------------------------------ -BOOL GraphicFilter::Setup( USHORT ) +sal_Bool GraphicFilter::Setup( sal_uInt16 ) { - return FALSE; + return sal_False; } /* ------------------------------------------------------------------------ No Import filter has a dialog, so the following two methods are obsolete */ -BOOL GraphicFilter::HasImportDialog( USHORT ) +sal_Bool GraphicFilter::HasImportDialog( sal_uInt16 ) { return sal_True; // return pConfig->IsImportDialog( nFormat ); @@ -2004,26 +2032,26 @@ BOOL GraphicFilter::HasImportDialog( USHORT ) // ------------------------------------------------------------------------ -BOOL GraphicFilter::DoImportDialog( Window*, USHORT ) +sal_Bool GraphicFilter::DoImportDialog( Window*, sal_uInt16 ) { return sal_True; } // ------------------------------------------------------------------------ -BOOL GraphicFilter::HasExportDialog( USHORT nFormat ) +sal_Bool GraphicFilter::HasExportDialog( sal_uInt16 nFormat ) { return pConfig->IsExportDialog( nFormat ); } // ------------------------------------------------------------------------ -BOOL GraphicFilter::DoExportDialog( Window* pWindow, USHORT nFormat ) +sal_Bool GraphicFilter::DoExportDialog( Window* pWindow, sal_uInt16 nFormat ) { return DoExportDialog( pWindow, nFormat, FUNIT_MM ); } -BOOL GraphicFilter::DoExportDialog( Window*, USHORT nFormat, FieldUnit ) +sal_Bool GraphicFilter::DoExportDialog( Window*, sal_uInt16 nFormat, FieldUnit ) { sal_Bool bRet = sal_False; com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > @@ -2081,7 +2109,7 @@ IMPL_LINK( GraphicFilter, FilterCallback, ConvertData*, pData ) if( pData ) { - USHORT nFormat = GRFILTER_FORMAT_DONTKNOW; + sal_uInt16 nFormat = GRFILTER_FORMAT_DONTKNOW; ByteString aShortName; switch( pData->mnFormat ) { @@ -2129,12 +2157,12 @@ GraphicFilter* GraphicFilter::GetGraphicFilter() int GraphicFilter::LoadGraphic( const String &rPath, const String &rFilterName, Graphic& rGraphic, GraphicFilter* pFilter, - USHORT* pDeterminedFormat ) + sal_uInt16* pDeterminedFormat ) { if ( !pFilter ) pFilter = GetGraphicFilter(); - const USHORT nFilter = rFilterName.Len() && pFilter->GetImportFormatCount() + const sal_uInt16 nFilter = rFilterName.Len() && pFilter->GetImportFormatCount() ? pFilter->GetImportFormatNumber( rFilterName ) : GRFILTER_FORMAT_DONTKNOW; diff --git a/svtools/source/filter.vcl/filter/filter2.cxx b/svtools/source/filter.vcl/filter/filter2.cxx index 0220961b657a..586591b4d86c 100644 --- a/svtools/source/filter.vcl/filter/filter2.cxx +++ b/svtools/source/filter.vcl/filter/filter2.cxx @@ -41,30 +41,7 @@ #define DATA_SIZE 640 -BYTE* ImplSearchEntry( BYTE* , BYTE* , ULONG , ULONG ); - - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -GraphicDescriptor::GraphicDescriptor( const String* pPath ) : - pFileStm ( NULL ) -{ - ImpConstruct(); - - if ( pPath ) - { - INetURLObject aURL( *pPath, INET_PROT_FILE ); - aPathExt = aURL.GetFileExtension().toAsciiLowerCase(); - } - bLinked = TRUE; - bLinkChanged = FALSE; - bWideSearch = FALSE; -} - +sal_uInt8* ImplSearchEntry( sal_uInt8* , sal_uInt8* , sal_uLong , sal_uLong ); /************************************************************************* |* @@ -74,19 +51,10 @@ GraphicDescriptor::GraphicDescriptor( const String* pPath ) : GraphicDescriptor::GraphicDescriptor( const INetURLObject& rPath ) : pFileStm( ::utl::UcbStreamHelper::CreateStream( rPath.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ) ), - aPathExt( rPath.GetFileExtension().toAsciiLowerCase() ) + aPathExt( rPath.GetFileExtension().toAsciiLowerCase() ), + bOwnStream( sal_True ) { - if ( pFileStm ) - { - nStmPos = 0; - pFileStm->Seek( nStmPos ); - bDataReady = TRUE; - } - ImpConstruct(); - - if ( pFileStm && !pFileStm->GetError() ) - bDataReady = TRUE; } /************************************************************************* @@ -96,7 +64,8 @@ GraphicDescriptor::GraphicDescriptor( const INetURLObject& rPath ) : \************************************************************************/ GraphicDescriptor::GraphicDescriptor( SvStream& rInStream, const String* pPath) : - pFileStm ( NULL ) + pFileStm ( &rInStream ), + bOwnStream ( sal_False ) { ImpConstruct(); @@ -105,15 +74,8 @@ GraphicDescriptor::GraphicDescriptor( SvStream& rInStream, const String* pPath) INetURLObject aURL( *pPath ); aPathExt = aURL.GetFileExtension().toAsciiLowerCase(); } - nStmPos = rInStream.Tell(); - pBaseStm = &rInStream; - bBaseStm = TRUE; - - if ( !pBaseStm->GetError() ) - bDataReady = TRUE; } - /************************************************************************* |* |* @@ -122,150 +84,54 @@ GraphicDescriptor::GraphicDescriptor( SvStream& rInStream, const String* pPath) GraphicDescriptor::~GraphicDescriptor() { - delete pFileStm; + if ( bOwnStream ) + delete pFileStm; } - /************************************************************************* |* |* |* \************************************************************************/ -BOOL GraphicDescriptor::Detect( BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::Detect( sal_Bool bExtendedInfo ) { - BOOL bRet = FALSE; - - // Link-Status ueberpruefen - if ( bLinked && bLinkChanged ) - { - DBG_ASSERT( aReqLink.IsSet(), "Wo ist der RequestHandler???" ); - pMemStm = (SvStream*) aReqLink.Call( this ); - if ( pMemStm ) - { - nStmPos = pMemStm->Tell(); - bDataReady = TRUE; - } - } - - if ( bDataReady ) + sal_Bool bRet = sal_False; + if ( pFileStm && !pFileStm->GetError() ) { - SvStream& rStm = GetSearchStream(); - UINT16 nOldFormat = rStm.GetNumberFormatInt(); - - if ( ImpDetectGIF( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectJPG( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectBMP( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectPNG( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectTIF( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectPCX( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectDXF( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectMET( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectSGF( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectSGV( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectSVM( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectWMF( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectEMF( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectPCT( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectXBM( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectXPM( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectPBM( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectPGM( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectPPM( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectRAS( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectTGA( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectPSD( rStm, bExtendedInfo ) ) bRet = TRUE; - else if ( ImpDetectEPS( rStm, bExtendedInfo ) ) bRet = TRUE; - - // diese Formate lassen sich nur bei WideSearch im gesamten - // Stream ermitteln - else if ( bWideSearch ) - { - if ( ImpDetectPCD( rStm, bExtendedInfo ) ) - bRet = TRUE; - } + SvStream& rStm = *pFileStm; + sal_uInt16 nOldFormat = rStm.GetNumberFormatInt(); + + if ( ImpDetectGIF( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectJPG( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectBMP( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPNG( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectTIF( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPCX( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectDXF( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectMET( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectSGF( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectSGV( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectSVM( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectWMF( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectEMF( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPCT( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectXBM( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectXPM( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPBM( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPGM( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPPM( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectRAS( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectTGA( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPSD( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectEPS( rStm, bExtendedInfo ) ) bRet = sal_True; + else if ( ImpDetectPCD( rStm, bExtendedInfo ) ) bRet = sal_True; rStm.SetNumberFormatInt( nOldFormat ); - rStm.Seek( nStmPos ); } - return bRet; } - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -BOOL GraphicDescriptor::IsDataReady() const -{ - return bDataReady; -} - - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -BOOL GraphicDescriptor::IsWideSearch() const -{ - return bWideSearch; -} - - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -SvStream& GraphicDescriptor::GetSearchStream() const -{ - DBG_ASSERT( bDataReady, "Was laeuft hier falsch???" ); - - if ( bLinked ) - return *pMemStm; - else if ( bBaseStm ) - return *pBaseStm; - else - return *pFileStm; -} - - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -void GraphicDescriptor::SetRequestHdl( const Link& rRequestLink ) -{ - aReqLink = rRequestLink; - bLinkChanged = TRUE; -} - - -/************************************************************************* -|* -|* -|* -\************************************************************************/ - -ULONG GraphicDescriptor::GetRequestedByteCount() const -{ - return DATA_SIZE; -} - - -/******************************************************************************/ -/* IMP-Methoden */ -/* */ - - /************************************************************************* |* |* @@ -274,17 +140,10 @@ ULONG GraphicDescriptor::GetRequestedByteCount() const void GraphicDescriptor::ImpConstruct() { - if ( !pFileStm ) - pFileStm = new SvStream(); nFormat = GFF_NOT; nBitsPerPixel = 0; nPlanes = 0; - bCompressed = FALSE; - bDataReady = FALSE; - bLinked = FALSE; - bWideSearch = TRUE; - bBaseStm = FALSE; - pMemStm = NULL; + bCompressed = sal_False; } @@ -294,14 +153,13 @@ void GraphicDescriptor::ImpConstruct() |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectBMP( SvStream& rStm, BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::ImpDetectBMP( SvStream& rStm, sal_Bool bExtendedInfo ) { - UINT16 nTemp16; - BOOL bRet = FALSE; + sal_uInt16 nTemp16; + sal_Bool bRet = sal_False; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - rStm.Seek( nStmPos ); - rStm >> nTemp16; // OS/2-BitmapArray @@ -315,12 +173,12 @@ BOOL GraphicDescriptor::ImpDetectBMP( SvStream& rStm, BOOL bExtendedInfo ) if ( nTemp16 == 0x4d42 ) { nFormat = GFF_BMP; - bRet = TRUE; + bRet = sal_True; if ( bExtendedInfo ) { - UINT32 nTemp32; - UINT32 nCompression; + sal_uInt32 nTemp32; + sal_uInt32 nCompression; // bis zur ersten Information rStm.SeekRel( 0x10 ); @@ -361,11 +219,11 @@ BOOL GraphicDescriptor::ImpDetectBMP( SvStream& rStm, BOOL bExtendedInfo ) if ( ( nBitsPerPixel > 24 ) || ( nCompression > 3 ) ) { nFormat = GFF_NOT; - bRet = FALSE; + bRet = sal_False; } } } - + rStm.Seek( nStmPos ); return bRet; } @@ -376,28 +234,28 @@ BOOL GraphicDescriptor::ImpDetectBMP( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectGIF( SvStream& rStm, BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::ImpDetectGIF( SvStream& rStm, sal_Bool bExtendedInfo ) { - UINT32 n32; - UINT16 n16; - BOOL bRet = FALSE; - BYTE cByte; + sal_uInt32 n32; + sal_uInt16 n16; + sal_Bool bRet = sal_False; + sal_uInt8 cByte; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - rStm.Seek( nStmPos ); - rStm >> n32; + if ( n32 == 0x38464947 ) { rStm >> n16; if ( ( n16 == 0x6137 ) || ( n16 == 0x6139 ) ) { nFormat = GFF_GIF; - bRet = TRUE; + bRet = sal_True; if ( bExtendedInfo ) { - UINT16 nTemp16; + sal_uInt16 nTemp16; // PixelBreite auslesen rStm >> nTemp16; @@ -413,7 +271,7 @@ BOOL GraphicDescriptor::ImpDetectGIF( SvStream& rStm, BOOL bExtendedInfo ) } } } - + rStm.Seek( nStmPos ); return bRet; } @@ -424,125 +282,188 @@ BOOL GraphicDescriptor::ImpDetectGIF( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectJPG( SvStream& rStm, BOOL bExtendedInfo ) +// returns the next jpeg marker, a return value of 0 represents an error +sal_uInt8 ImpDetectJPG_GetNextMarker( SvStream& rStm ) { - UINT32 nTemp32; - BOOL bRet = FALSE; - BYTE cByte = 0; - BOOL bM_COM; + sal_uInt8 nByte; + do + { + do + { + rStm >> nByte; + if ( rStm.IsEof() || rStm.GetError() ) // as 0 is not allowed as marker, + return 0; // we can use it as errorcode + } + while ( nByte != 0xff ); + do + { + rStm >> nByte; + if ( rStm.IsEof() || rStm.GetError() ) + return 0; + } + while( nByte == 0xff ); + } + while( nByte == 0 ); // 0xff00 represents 0xff and not a marker, + // the marker detection has to be restartet. + return nByte; +} - rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); - rStm.Seek( nStmPos ); +sal_Bool GraphicDescriptor::ImpDetectJPG( SvStream& rStm, sal_Bool bExtendedInfo ) +{ + sal_uInt32 nTemp32; + sal_Bool bRet = sal_False; + sal_Int32 nStmPos = rStm.Tell(); + + rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); rStm >> nTemp32; - // compare upper 28 bits + // compare upper 24 bits if( 0xffd8ff00 == ( nTemp32 & 0xffffff00 ) ) { nFormat = GFF_JPG; - return TRUE; - } - - bM_COM = ( nTemp32 == 0xffd8fffe ); - if ( ( nTemp32 == 0xffd8ffe0 ) || bM_COM ) - { - if( !bM_COM ) - { - rStm.SeekRel( 2 ); - rStm >> nTemp32; - } + bRet = sal_True; - if( bM_COM || ( nTemp32 == 0x4a464946 ) ) + if ( bExtendedInfo ) { - nFormat = GFF_JPG; - bRet = TRUE; - - if( bExtendedInfo ) - { - MapMode aMap; - UINT16 nTemp16; - ULONG nCount = 9; - ULONG nMax; - ULONG nResX; - ULONG nResY; - BYTE cUnit; - - // Groesse des verbleibenden Puffers ermitteln - if ( bLinked ) - nMax = static_cast< SvMemoryStream& >(rStm).GetEndOfData() - - 16; - else - nMax = DATA_SIZE - 16; + rStm.SeekRel( -2 ); - // max. 8K - nMax = Min( nMax, (ULONG) 8192 ); + sal_uInt32 nError( rStm.GetError() ); - // Res-Unit ermitteln - rStm.SeekRel( 3 ); - rStm >> cUnit; + sal_Bool bScanFailure = sal_False; + sal_Bool bScanFinished = sal_False; - // ResX ermitteln - rStm >> nTemp16; - nResX = nTemp16; - - // ResY ermitteln - rStm >> nTemp16; - nResY = nTemp16; - - // SOF0/1-Marker finden, aber dabei - // nicht mehr als DATA_SIZE Pixel lesen, falls - // kein WideSearch - do + while( !bScanFailure && !bScanFinished && !rStm.IsEof() && !rStm.GetError() ) + { + sal_uInt8 nMarker = ImpDetectJPG_GetNextMarker( rStm ); + switch( nMarker ) { - while ( ( cByte != 0xff ) && - ( bWideSearch || ( nCount++ < nMax ) ) ) + // fixed size marker, not having a two byte length parameter + case 0xd0 : // RST0 + case 0xd1 : + case 0xd2 : + case 0xd3 : + case 0xd4 : + case 0xd5 : + case 0xd6 : + case 0xd7 : // RST7 + case 0x01 : // TEM + break; + + case 0xd8 : // SOI (has already been checked, there should not be a second one) + case 0x00 : // marker is invalid, we should stop now + bScanFailure = sal_True; + break; + + case 0xd9 : // EOI + bScanFinished = sal_True; + break; + + // per default we assume marker segments conaining a length parameter + default : { - rStm >> cByte; - } - - while ( ( cByte == 0xff ) && - ( bWideSearch || ( nCount++ < nMax ) ) ) - { - rStm >> cByte; - } - } - while ( ( cByte != 0xc0 ) && - ( cByte != 0xc1 ) && - ( bWideSearch || ( nCount < nMax ) ) ); - - // wir haben den SOF0/1-Marker - if ( ( cByte == 0xc0 ) || ( cByte == 0xc1 ) ) - { - // Hoehe einlesen - rStm.SeekRel( 3 ); - rStm >> nTemp16; - aPixSize.Height() = nTemp16; - - // Breite einlesen - rStm >> nTemp16; - aPixSize.Width() = nTemp16; + sal_uInt16 nLength; + rStm >> nLength; - // Bit/Pixel einlesen - rStm >> cByte; - nBitsPerPixel = ( cByte == 3 ? 24 : cByte == 1 ? 8 : 0 ); + if ( nLength < 2 ) + bScanFailure = sal_True; + else + { + sal_uInt32 nNextMarkerPos = rStm.Tell() + nLength - 2; + switch( nMarker ) + { + case 0xe0 : // APP0 Marker + { + if ( nLength == 16 ) + { + sal_Int32 nIdentifier; + rStm >> nIdentifier; + if ( nIdentifier == 0x4a464946 ) // JFIF Identifier + { + sal_uInt8 nStringTerminator; + sal_uInt8 nMajorRevision; + sal_uInt8 nMinorRevision; + sal_uInt8 nUnits; + sal_uInt16 nHorizontalResolution; + sal_uInt16 nVerticalResolution; + sal_uInt8 nHorzThumbnailPixelCount; + sal_uInt8 nVertThumbnailPixelCount; + + rStm >> nStringTerminator + >> nMajorRevision + >> nMinorRevision + >> nUnits + >> nHorizontalResolution + >> nVerticalResolution + >> nHorzThumbnailPixelCount + >> nVertThumbnailPixelCount; + + // setting the logical size + if ( nUnits && nHorizontalResolution && nVerticalResolution ) + { + MapMode aMap; + aMap.SetMapUnit( nUnits == 1 ? MAP_INCH : MAP_CM ); + aMap.SetScaleX( Fraction( 1, nHorizontalResolution ) ); + aMap.SetScaleY( Fraction( 1, nVerticalResolution ) ); + aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap, MapMode( MAP_100TH_MM ) ); + } + } + } + } + break; - // logische Groesse setzen - if ( cUnit && nResX && nResY ) - { - aMap.SetMapUnit( cUnit == 1 ? MAP_INCH : MAP_CM ); - aMap.SetScaleX( Fraction( 1, nResX ) ); - aMap.SetScaleY( Fraction( 1, nResY ) ); - aLogSize = OutputDevice::LogicToLogic( aPixSize, aMap, - MapMode( MAP_100TH_MM ) ); + // Start of Frame Markers + case 0xc0 : // SOF0 + case 0xc1 : // SOF1 + case 0xc2 : // SOF2 + case 0xc3 : // SOF3 + case 0xc5 : // SOF5 + case 0xc6 : // SOF6 + case 0xc7 : // SOF7 + case 0xc9 : // SOF9 + case 0xca : // SOF10 + case 0xcb : // SOF11 + case 0xcd : // SOF13 + case 0xce : // SOF14 + case 0xcf : // SOF15 + { + sal_uInt8 nSamplePrecision; + sal_uInt16 nNumberOfLines; + sal_uInt16 nSamplesPerLine; + sal_uInt8 nNumberOfImageComponents; + sal_uInt8 nComponentsIdentifier; + sal_uInt8 nHorizontalSamplingFactor; + sal_uInt8 nVerticalSamplingFactor; + sal_uInt8 nQuantizationTableDestinationSelector; + rStm >> nSamplePrecision + >> nNumberOfLines + >> nSamplesPerLine + >> nNumberOfImageComponents + >> nComponentsIdentifier + >> nHorizontalSamplingFactor + >> nQuantizationTableDestinationSelector; + nVerticalSamplingFactor = nHorizontalSamplingFactor & 0xf; + nHorizontalSamplingFactor >>= 4; + + aPixSize.Height() = nNumberOfLines; + aPixSize.Width() = nSamplesPerLine; + nBitsPerPixel = ( nNumberOfImageComponents == 3 ? 24 : nNumberOfImageComponents == 1 ? 8 : 0 ); + nPlanes = 1; + + bScanFinished = sal_True; + } + break; + } + rStm.Seek( nNextMarkerPos ); + } } - - // Planes immer 1 - nPlanes = 1; + break; } } + rStm.SetError( nError ); } } - + rStm.Seek( nStmPos ); return bRet; } @@ -553,41 +474,30 @@ BOOL GraphicDescriptor::ImpDetectJPG( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPCD( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectPCD( SvStream& rStm, sal_Bool ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - rStm.Seek( nStmPos ); - if ( bWideSearch ) - { - UINT32 nTemp32; - UINT16 nTemp16; - BYTE cByte; + sal_uInt32 nTemp32; + sal_uInt16 nTemp16; + sal_uInt8 cByte; - rStm.SeekRel( 2048 ); - rStm >> nTemp32; - rStm >> nTemp16; - rStm >> cByte; + rStm.SeekRel( 2048 ); + rStm >> nTemp32; + rStm >> nTemp16; + rStm >> cByte; - if ( ( nTemp32 == 0x5f444350 ) && - ( nTemp16 == 0x5049 ) && - ( cByte == 0x49 ) ) - { - nFormat = GFF_PCD; - bRet = TRUE; - } - } - else + if ( ( nTemp32 == 0x5f444350 ) && + ( nTemp16 == 0x5049 ) && + ( cByte == 0x49 ) ) { - bRet = aPathExt.CompareToAscii( "pcd", 3 ) == COMPARE_EQUAL; - if ( bRet ) - { - nFormat = GFF_PCD; - } + nFormat = GFF_PCD; + bRet = sal_True; } - + rStm.Seek( nStmPos ); return bRet; } @@ -598,35 +508,35 @@ BOOL GraphicDescriptor::ImpDetectPCD( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPCX( SvStream& rStm, BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::ImpDetectPCX( SvStream& rStm, sal_Bool bExtendedInfo ) { // ! Because 0x0a can be interpreted as LF too ... // we cant be shure that this special sign represent a PCX file only. // Every Ascii file is possible here :-( // We must detect the whole header. - bExtendedInfo = TRUE; + bExtendedInfo = sal_True; - BOOL bRet = FALSE; - BYTE cByte; + sal_Bool bRet = sal_False; + sal_uInt8 cByte; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - rStm.Seek( nStmPos ); - rStm >> cByte; + if ( cByte == 0x0a ) { nFormat = GFF_PCX; - bRet = TRUE; + bRet = sal_True; if ( bExtendedInfo ) { - UINT16 nTemp16; - USHORT nXmin; - USHORT nXmax; - USHORT nYmin; - USHORT nYmax; - USHORT nDPIx; - USHORT nDPIy; + sal_uInt16 nTemp16; + sal_uInt16 nXmin; + sal_uInt16 nXmax; + sal_uInt16 nYmin; + sal_uInt16 nYmax; + sal_uInt16 nDPIx; + sal_uInt16 nDPIy; rStm.SeekRel( 1 ); @@ -676,6 +586,7 @@ BOOL GraphicDescriptor::ImpDetectPCX( SvStream& rStm, BOOL bExtendedInfo ) } } + rStm.Seek( nStmPos ); return bRet; } @@ -686,26 +597,26 @@ BOOL GraphicDescriptor::ImpDetectPCX( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPNG( SvStream& rStm, BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::ImpDetectPNG( SvStream& rStm, sal_Bool bExtendedInfo ) { - UINT32 nTemp32; - BOOL bRet = FALSE; + sal_uInt32 nTemp32; + sal_Bool bRet = sal_False; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); - rStm.Seek( nStmPos ); - rStm >> nTemp32; + if ( nTemp32 == 0x89504e47 ) { rStm >> nTemp32; if ( nTemp32 == 0x0d0a1a0a ) { nFormat = GFF_PNG; - bRet = TRUE; + bRet = sal_True; if ( bExtendedInfo ) { - BYTE cByte; + sal_uInt8 cByte; // IHDR-Chunk rStm.SeekRel( 8 ); @@ -725,57 +636,54 @@ BOOL GraphicDescriptor::ImpDetectPNG( SvStream& rStm, BOOL bExtendedInfo ) // Planes immer 1; // Kompression immer nPlanes = 1; - bCompressed = TRUE; + bCompressed = sal_True; - if ( bWideSearch ) - { - UINT32 nLen32; + sal_uInt32 nLen32; - rStm.SeekRel( 8 ); + rStm.SeekRel( 8 ); - // so lange ueberlesen, bis wir den pHYs-Chunk haben oder - // den Anfang der Bilddaten + // so lange ueberlesen, bis wir den pHYs-Chunk haben oder + // den Anfang der Bilddaten + rStm >> nLen32; + rStm >> nTemp32; + while( ( nTemp32 != 0x70485973 ) && ( nTemp32 != 0x49444154 ) ) + { + rStm.SeekRel( 4 + nLen32 ); rStm >> nLen32; rStm >> nTemp32; - while( ( nTemp32 != 0x70485973 ) && ( nTemp32 != 0x49444154 ) ) - { - rStm.SeekRel( 4 + nLen32 ); - rStm >> nLen32; - rStm >> nTemp32; - } + } - if ( nTemp32 == 0x70485973 ) - { - ULONG nXRes; - ULONG nYRes; + if ( nTemp32 == 0x70485973 ) + { + sal_uLong nXRes; + sal_uLong nYRes; - // horizontale Aufloesung - rStm >> nTemp32; - nXRes = nTemp32; + // horizontale Aufloesung + rStm >> nTemp32; + nXRes = nTemp32; - // vertikale Aufloesung - rStm >> nTemp32; - nYRes = nTemp32; + // vertikale Aufloesung + rStm >> nTemp32; + nYRes = nTemp32; - // Unit einlesen - rStm >> cByte; + // Unit einlesen + rStm >> cByte; - if ( cByte ) - { - if ( nXRes ) - aLogSize.Width() = ( aPixSize.Width() * 100000 ) / - nTemp32; + if ( cByte ) + { + if ( nXRes ) + aLogSize.Width() = ( aPixSize.Width() * 100000 ) / + nTemp32; - if ( nYRes ) - aLogSize.Height() = ( aPixSize.Height() * 100000 ) / - nTemp32; - } + if ( nYRes ) + aLogSize.Height() = ( aPixSize.Height() * 100000 ) / + nTemp32; } } } } } - + rStm.Seek( nStmPos ); return bRet; } @@ -786,14 +694,14 @@ BOOL GraphicDescriptor::ImpDetectPNG( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectTIF( SvStream& rStm, BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::ImpDetectTIF( SvStream& rStm, sal_Bool bExtendedInfo ) { - BOOL bDetectOk = FALSE; - BOOL bRet = FALSE; - BYTE cByte1; - BYTE cByte2; + sal_Bool bDetectOk = sal_False; + sal_Bool bRet = sal_False; + sal_uInt8 cByte1; + sal_uInt8 cByte2; - rStm.Seek( nStmPos ); + sal_Int32 nStmPos = rStm.Tell(); rStm >> cByte1; rStm >> cByte2; if ( cByte1 == cByte2 ) @@ -801,43 +709,43 @@ BOOL GraphicDescriptor::ImpDetectTIF( SvStream& rStm, BOOL bExtendedInfo ) if ( cByte1 == 0x49 ) { rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - bDetectOk = TRUE; + bDetectOk = sal_True; } else if ( cByte1 == 0x4d ) { rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); - bDetectOk = TRUE; + bDetectOk = sal_True; } if ( bDetectOk ) { - UINT16 nTemp16; + sal_uInt16 nTemp16; rStm >> nTemp16; if ( nTemp16 == 0x2a ) { nFormat = GFF_TIF; - bRet = TRUE; + bRet = sal_True; if ( bExtendedInfo ) { - ULONG nCount; - ULONG nMax = DATA_SIZE - 48; - UINT32 nTemp32; - BOOL bOk = FALSE; + sal_uLong nCount; + sal_uLong nMax = DATA_SIZE - 48; + sal_uInt32 nTemp32; + sal_Bool bOk = sal_False; // Offset des ersten IFD einlesen rStm >> nTemp32; rStm.SeekRel( ( nCount = ( nTemp32 + 2 ) ) - 0x08 ); - if ( bWideSearch || ( nCount < nMax ) ) + if ( nCount < nMax ) { // Tag's lesen, bis wir auf Tag256 ( Width ) treffen // nicht mehr Bytes als DATA_SIZE lesen rStm >> nTemp16; while ( nTemp16 != 256 ) { - bOk = bWideSearch || ( nCount < nMax ); + bOk = nCount < nMax; if ( !bOk ) { break; @@ -913,7 +821,7 @@ BOOL GraphicDescriptor::ImpDetectTIF( SvStream& rStm, BOOL bExtendedInfo ) } } } - + rStm.Seek( nStmPos ); return bRet; } @@ -924,9 +832,9 @@ BOOL GraphicDescriptor::ImpDetectTIF( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectXBM( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectXBM( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "xbm", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "xbm", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_XBM; @@ -940,9 +848,9 @@ BOOL GraphicDescriptor::ImpDetectXBM( SvStream&, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectXPM( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectXPM( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "xpm", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "xpm", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_XPM; @@ -955,22 +863,23 @@ BOOL GraphicDescriptor::ImpDetectXPM( SvStream&, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPBM( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectPBM( SvStream& rStm, sal_Bool ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; // erst auf Datei Extension pruefen, da diese aussagekraeftiger ist // als die 2 ID Bytes if ( aPathExt.CompareToAscii( "pbm", 3 ) == COMPARE_EQUAL ) - bRet = TRUE; + bRet = sal_True; else { - BYTE nFirst, nSecond; - rStm.Seek( nStmPos ); + sal_Int32 nStmPos = rStm.Tell(); + sal_uInt8 nFirst, nSecond; rStm >> nFirst >> nSecond; if ( nFirst == 'P' && ( ( nSecond == '1' ) || ( nSecond == '4' ) ) ) - bRet = TRUE; + bRet = sal_True; + rStm.Seek( nStmPos ); } if ( bRet ) @@ -985,19 +894,20 @@ BOOL GraphicDescriptor::ImpDetectPBM( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPGM( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectPGM( SvStream& rStm, sal_Bool ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if ( aPathExt.CompareToAscii( "pgm", 3 ) == COMPARE_EQUAL ) - bRet = TRUE; + bRet = sal_True; else { - BYTE nFirst, nSecond; - rStm.Seek( nStmPos ); + sal_uInt8 nFirst, nSecond; + sal_Int32 nStmPos = rStm.Tell(); rStm >> nFirst >> nSecond; if ( nFirst == 'P' && ( ( nSecond == '2' ) || ( nSecond == '5' ) ) ) - bRet = TRUE; + bRet = sal_True; + rStm.Seek( nStmPos ); } if ( bRet ) @@ -1012,19 +922,20 @@ BOOL GraphicDescriptor::ImpDetectPGM( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPPM( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectPPM( SvStream& rStm, sal_Bool ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if ( aPathExt.CompareToAscii( "ppm", 3 ) == COMPARE_EQUAL ) - bRet = TRUE; + bRet = sal_True; else { - BYTE nFirst, nSecond; - rStm.Seek( nStmPos ); + sal_uInt8 nFirst, nSecond; + sal_Int32 nStmPos = rStm.Tell(); rStm >> nFirst >> nSecond; if ( nFirst == 'P' && ( ( nSecond == '3' ) || ( nSecond == '6' ) ) ) - bRet = TRUE; + bRet = sal_True; + rStm.Seek( nStmPos ); } if ( bRet ) @@ -1039,19 +950,20 @@ BOOL GraphicDescriptor::ImpDetectPPM( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectRAS( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectRAS( SvStream& rStm, sal_Bool ) { - UINT32 nMagicNumber; - rStm.Seek( nStmPos ); + sal_uInt32 nMagicNumber; + sal_Bool bRet = sal_False; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); rStm >> nMagicNumber; if ( nMagicNumber == 0x59a66a95 ) { nFormat = GFF_RAS; - return TRUE; + bRet = sal_True; } - else - return FALSE; + rStm.Seek( nStmPos ); + return bRet; } /************************************************************************* @@ -1060,9 +972,9 @@ BOOL GraphicDescriptor::ImpDetectRAS( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectTGA( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectTGA( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "tga", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "tga", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_TGA; @@ -1075,28 +987,28 @@ BOOL GraphicDescriptor::ImpDetectTGA( SvStream&, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPSD( SvStream& rStm, BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::ImpDetectPSD( SvStream& rStm, sal_Bool bExtendedInfo ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; - UINT32 nMagicNumber; - rStm.Seek( nStmPos ); + sal_uInt32 nMagicNumber; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); rStm >> nMagicNumber; if ( nMagicNumber == 0x38425053 ) { - UINT16 nVersion; + sal_uInt16 nVersion; rStm >> nVersion; if ( nVersion == 1 ) { - bRet = TRUE; + bRet = sal_True; if ( bExtendedInfo ) { - UINT16 nChannels; - UINT32 nRows; - UINT32 nColumns; - UINT16 nDepth; - UINT16 nMode; + sal_uInt16 nChannels; + sal_uInt32 nRows; + sal_uInt32 nColumns; + sal_uInt16 nDepth; + sal_uInt16 nMode; rStm.SeekRel( 6 ); // Pad rStm >> nChannels >> nRows >> nColumns >> nDepth >> nMode; if ( ( nDepth == 1 ) || ( nDepth == 8 ) || ( nDepth == 16 ) ) @@ -1113,17 +1025,18 @@ BOOL GraphicDescriptor::ImpDetectPSD( SvStream& rStm, BOOL bExtendedInfo ) aPixSize.Height() = nRows; break; default: - bRet = FALSE; + bRet = sal_False; } } else - bRet = FALSE; + bRet = sal_False; } } } if ( bRet ) nFormat = GFF_PSD; + rStm.Seek( nStmPos ); return bRet; } @@ -1133,15 +1046,16 @@ BOOL GraphicDescriptor::ImpDetectPSD( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectEPS( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectEPS( SvStream& rStm, sal_Bool ) { // es wird die EPS mit Vorschaubild Variante und die Extensionuebereinstimmung // geprueft sal_uInt32 nFirstLong; sal_uInt8 nFirstBytes[20]; + sal_Bool bRet = sal_False; - rStm.Seek( nStmPos ); + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); rStm >> nFirstLong; rStm.SeekRel( -4 ); @@ -1152,10 +1066,10 @@ BOOL GraphicDescriptor::ImpDetectEPS( SvStream& rStm, BOOL ) && ImplSearchEntry( &nFirstBytes[15], (sal_uInt8*)"EPS", 3, 3 ) ) ) { nFormat = GFF_EPS; - return TRUE; + bRet = sal_True; } - else - return FALSE; + rStm.Seek( nStmPos ); + return bRet; } /************************************************************************* @@ -1164,9 +1078,9 @@ BOOL GraphicDescriptor::ImpDetectEPS( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectDXF( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectDXF( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "dxf", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "dxf", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_DXF; @@ -1179,9 +1093,9 @@ BOOL GraphicDescriptor::ImpDetectDXF( SvStream&, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectMET( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectMET( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "met", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "met", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_MET; @@ -1195,16 +1109,18 @@ BOOL GraphicDescriptor::ImpDetectMET( SvStream&, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectPCT( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectPCT( SvStream& rStm, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "pct", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "pct", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_PCT; else { - BYTE sBuf[3]={0}; + sal_Int32 nStmPos = rStm.Tell(); - rStm.Seek( nStmPos + 522 ); + sal_uInt8 sBuf[4]; + + rStm.SeekRel( 522 ); rStm.Read( sBuf, 3 ); if( !rStm.GetError() ) @@ -1212,10 +1128,11 @@ BOOL GraphicDescriptor::ImpDetectPCT( SvStream& rStm, BOOL ) if ( ( sBuf[0] == 0x00 ) && ( sBuf[1] == 0x11 ) && ( ( sBuf[2] == 0x01 ) || ( sBuf[2] == 0x02 ) ) ) { - bRet = TRUE; + bRet = sal_True; nFormat = GFF_PCT; } } + rStm.Seek( nStmPos ); } return bRet; @@ -1228,21 +1145,23 @@ BOOL GraphicDescriptor::ImpDetectPCT( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectSGF( SvStream& rStm, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectSGF( SvStream& rStm, sal_Bool ) { - BOOL bRet = FALSE; - + sal_Bool bRet = sal_False; if( aPathExt.CompareToAscii( "sgf", 3 ) == COMPARE_EQUAL ) - bRet = TRUE; + bRet = sal_True; else { - BYTE nFirst, nSecond; + sal_Int32 nStmPos = rStm.Tell(); + + sal_uInt8 nFirst, nSecond; - rStm.Seek( nStmPos ); rStm >> nFirst >> nSecond; if( nFirst == 'J' && nSecond == 'J' ) - bRet = TRUE; + bRet = sal_True; + + rStm.Seek( nStmPos ); } if( bRet ) @@ -1258,9 +1177,9 @@ BOOL GraphicDescriptor::ImpDetectSGF( SvStream& rStm, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectSGV( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectSGV( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "sgv", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "sgv", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_SGV; @@ -1274,15 +1193,14 @@ BOOL GraphicDescriptor::ImpDetectSGV( SvStream&, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectSVM( SvStream& rStm, BOOL bExtendedInfo ) +sal_Bool GraphicDescriptor::ImpDetectSVM( SvStream& rStm, sal_Bool bExtendedInfo ) { - UINT32 n32; - BOOL bRet = FALSE; - BYTE cByte; + sal_uInt32 n32; + sal_Bool bRet = sal_False; + sal_uInt8 cByte; + sal_Int32 nStmPos = rStm.Tell(); rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - rStm.Seek( nStmPos ); - rStm >> n32; if ( n32 == 0x44475653 ) { @@ -1290,12 +1208,12 @@ BOOL GraphicDescriptor::ImpDetectSVM( SvStream& rStm, BOOL bExtendedInfo ) if ( cByte == 0x49 ) { nFormat = GFF_SVM; - bRet = TRUE; + bRet = sal_True; if ( bExtendedInfo ) { - UINT32 nTemp32; - UINT16 nTemp16; + sal_uInt32 nTemp32; + sal_uInt16 nTemp16; rStm.SeekRel( 0x04 ); @@ -1322,14 +1240,14 @@ BOOL GraphicDescriptor::ImpDetectSVM( SvStream& rStm, BOOL bExtendedInfo ) if( n32 == 0x4D4C4356 ) { - UINT16 nTmp16; + sal_uInt16 nTmp16; rStm >> nTmp16; if( nTmp16 == 0x4654 ) { nFormat = GFF_SVM; - bRet = TRUE; + bRet = sal_True; if( bExtendedInfo ) { @@ -1343,7 +1261,7 @@ BOOL GraphicDescriptor::ImpDetectSVM( SvStream& rStm, BOOL bExtendedInfo ) } } } - + rStm.Seek( nStmPos ); return bRet; } @@ -1354,9 +1272,9 @@ BOOL GraphicDescriptor::ImpDetectSVM( SvStream& rStm, BOOL bExtendedInfo ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectWMF( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectWMF( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "wmf",3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "wmf",3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_WMF; @@ -1369,9 +1287,9 @@ BOOL GraphicDescriptor::ImpDetectWMF( SvStream&, BOOL ) |* \************************************************************************/ -BOOL GraphicDescriptor::ImpDetectEMF( SvStream&, BOOL ) +sal_Bool GraphicDescriptor::ImpDetectEMF( SvStream&, sal_Bool ) { - BOOL bRet = aPathExt.CompareToAscii( "emf", 3 ) == COMPARE_EQUAL; + sal_Bool bRet = aPathExt.CompareToAscii( "emf", 3 ) == COMPARE_EQUAL; if (bRet) nFormat = GFF_EMF; diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk deleted file mode 100644 index c1cd42b666c1..000000000000 --- a/svtools/source/filter.vcl/filter/makefile.mk +++ /dev/null @@ -1,97 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=svtools -TARGET=filter -LIBTARGET=NO - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -SOLARINC+=-I../../inc - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES= strings.src \ - dlgexpor.src \ - dlgepng.src \ - dlgejpg.src - -SLOFILES= \ - $(SLO)$/FilterConfigCache.obj \ - $(SLO)$/FilterConfigItem.obj \ - $(SLO)$/SvFilterOptionsDialog.obj \ - $(SLO)$/dlgejpg.obj \ - $(SLO)$/dlgepng.obj \ - $(SLO)$/dlgexpor.obj \ - $(SLO)$/filter.obj \ - $(SLO)$/filter2.obj \ - $(SLO)$/sgfbram.obj \ - $(SLO)$/sgvmain.obj \ - $(SLO)$/sgvspln.obj \ - $(SLO)$/sgvtext.obj - -EXCEPTIONSNOOPTFILES= \ - $(SLO)$/FilterConfigCache.obj \ - $(SLO)$/FilterConfigItem.obj \ - $(SLO)$/SvFilterOptionsDialog.obj \ - $(SLO)$/dlgejpg.obj \ - $(SLO)$/dlgepng.obj \ - $(SLO)$/dlgexpor.obj \ - $(SLO)$/filter.obj \ - $(SLO)$/filter2.obj \ - $(SLO)$/sgfbram.obj \ - $(SLO)$/sgvmain.obj \ - $(SLO)$/sgvtext.obj - -LIB1TARGET= $(SLB)$/$(TARGET).uno.lib -LIB1OBJFILES= \ - $(SLO)$/dlgexpor.obj \ - $(SLO)$/dlgejpg.obj \ - $(SLO)$/dlgepng.obj \ - $(SLO)$/SvFilterOptionsDialog.obj - -LIB2TARGET= $(SLB)$/$(TARGET).lib -LIB2OBJFILES= \ - $(SLO)$/filter.obj \ - $(SLO)$/filter2.obj \ - $(SLO)$/sgfbram.obj \ - $(SLO)$/sgvmain.obj \ - $(SLO)$/sgvtext.obj \ - $(SLO)$/sgvspln.obj \ - $(SLO)$/FilterConfigItem.obj \ - $(SLO)$/FilterConfigCache.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/filter.vcl/filter/sgfbram.cxx b/svtools/source/filter.vcl/filter/sgfbram.cxx index 2fee4470a203..f17b6c2f675a 100644 --- a/svtools/source/filter.vcl/filter/sgfbram.cxx +++ b/svtools/source/filter.vcl/filter/sgfbram.cxx @@ -38,10 +38,6 @@ #include "sgffilt.hxx" #include "sgfbram.hxx" -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "SVTOOLS_FILTER4", "SVTOOLS_CODE" ) -#endif - /************************************************************************* |* |* operator>>( SvStream&, SgfHeader& ) @@ -72,11 +68,11 @@ SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead) |* SgfHeader::ChkMagic() |* *************************************************************************/ -BOOL SgfHeader::ChkMagic() +sal_Bool SgfHeader::ChkMagic() { return Magic=='J'*256+'J'; } -UINT32 SgfHeader::GetOffset() -{ return UINT32(OfsLo)+0x00010000*UINT32(OfsHi); } +sal_uInt32 SgfHeader::GetOffset() +{ return sal_uInt32(OfsLo)+0x00010000*sal_uInt32(OfsHi); } /************************************************************************* @@ -98,8 +94,8 @@ SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr) return rIStream; } -UINT32 SgfEntry::GetOffset() -{ return UINT32(OfsLo)+0x00010000*UINT32(OfsHi); } +sal_uInt32 SgfEntry::GetOffset() +{ return sal_uInt32(OfsLo)+0x00010000*sal_uInt32(OfsHi); } /************************************************************************* @@ -150,21 +146,21 @@ SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead) return rOStream; } -void BmpFileHeader::SetSize(UINT32 Size) +void BmpFileHeader::SetSize(sal_uInt32 Size) { - SizeLo=UINT16(Size & 0x0000FFFF); - SizeHi=UINT16((Size & 0xFFFF0000)>>16); + SizeLo=sal_uInt16(Size & 0x0000FFFF); + SizeHi=sal_uInt16((Size & 0xFFFF0000)>>16); } -void BmpFileHeader::SetOfs(UINT32 Ofs) +void BmpFileHeader::SetOfs(sal_uInt32 Ofs) { - OfsLo=UINT16(Ofs & 0x0000FFFF); - OfsHi=UINT16((Ofs & 0xFFFF0000)>>16); + OfsLo=sal_uInt16(Ofs & 0x0000FFFF); + OfsHi=sal_uInt16((Ofs & 0xFFFF0000)>>16); } -UINT32 BmpFileHeader::GetOfs() +sal_uInt32 BmpFileHeader::GetOfs() { - return UINT32(OfsLo)+0x00010000*UINT32(OfsHi); + return sal_uInt32(OfsLo)+0x00010000*sal_uInt32(OfsHi); } /************************************************************************* @@ -224,14 +220,14 @@ SvStream& operator<<(SvStream& rOStream, const RGBQuad& rQuad) class PcxExpand { private: - USHORT Count; - BYTE Data; + sal_uInt16 Count; + sal_uInt8 Data; public: PcxExpand() { Count=0; } - BYTE GetByte(SvStream& rInp); + sal_uInt8 GetByte(SvStream& rInp); }; -BYTE PcxExpand::GetByte(SvStream& rInp) +sal_uInt8 PcxExpand::GetByte(SvStream& rInp) { if (Count>0) { Count--; @@ -255,21 +251,21 @@ BYTE PcxExpand::GetByte(SvStream& rInp) |* SgfFilterBmp() |* *************************************************************************/ -BOOL SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) +sal_Bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) { BmpFileHeader aBmpHead; BmpInfoHeader aBmpInfo; - USHORT nWdtInp=(rHead.Xsize+7)/8; // Breite der Input-Bitmap in Bytes - USHORT nWdtOut; // Breite der Output-Bitmap in Bytes - USHORT nColors; // Anzahl der Farben (1,16,256) - USHORT nColBits; // Anzahl der Bits/Pixel (2, 4, 8) - USHORT i,j,k; // Spaltenzaehler, Zeilenzaehler, Planezaehler - USHORT a,b; // Hilfsvariable - BYTE pl1 = 0; // Masken fuer die Planes - BYTE* pBuf=NULL; // Buffer fuer eine Pixelzeile + sal_uInt16 nWdtInp=(rHead.Xsize+7)/8; // Breite der Input-Bitmap in Bytes + sal_uInt16 nWdtOut; // Breite der Output-Bitmap in Bytes + sal_uInt16 nColors; // Anzahl der Farben (1,16,256) + sal_uInt16 nColBits; // Anzahl der Bits/Pixel (2, 4, 8) + sal_uInt16 i,j,k; // Spaltenzaehler, Zeilenzaehler, Planezaehler + sal_uInt16 a,b; // Hilfsvariable + sal_uInt8 pl1 = 0; // Masken fuer die Planes + sal_uInt8* pBuf=NULL; // Buffer fuer eine Pixelzeile PcxExpand aPcx; - ULONG nOfs; - BYTE cRGB[4]; + sal_uLong nOfs; + sal_uInt8 cRGB[4]; if (rHead.Planes<=1) nColBits=1; else nColBits=4; if (rHead.Typ==4) nColBits=8; nColors=1<<nColBits; @@ -290,8 +286,8 @@ BOOL SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) aBmpInfo.yDpmm=0; aBmpInfo.ColUsed=0; aBmpInfo.ColMust=0; - pBuf=new BYTE[nWdtOut]; - if (!pBuf) return FALSE; // Fehler: kein Speichel da + pBuf=new sal_uInt8[nWdtOut]; + if (!pBuf) return sal_False; // Fehler: kein Speichel da rOut<<aBmpHead<<aBmpInfo; memset(pBuf,0,nWdtOut); // Buffer mit Nullen fuellen @@ -308,7 +304,7 @@ BOOL SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) pBuf[i]=aPcx.GetByte(rInp); } for(i=nWdtInp;i<nWdtOut;i++) pBuf[i]=0; // noch bis zu 3 Bytes - rOut.Seek(nOfs+((ULONG)rHead.Ysize-j-1L)*(ULONG)nWdtOut); // rueckwaerts schreiben! + rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // rueckwaerts schreiben! rOut.Write((char*)pBuf,nWdtOut); } } else if (nColors==16) { @@ -356,7 +352,7 @@ BOOL SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) } } for(i=nWdtInp*4;i<nWdtOut;i++) pBuf[i]=0; // noch bis zu 3 Bytes - rOut.Seek(nOfs+((ULONG)rHead.Ysize-j-1L)*(ULONG)nWdtOut); // rueckwaerts schreiben! + rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // rueckwaerts schreiben! rOut.Write((char*)pBuf,nWdtOut); } } else if (nColors==256) { @@ -376,12 +372,12 @@ BOOL SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) for(i=0;i<rHead.Xsize;i++) pBuf[i]=aPcx.GetByte(rInp); for(i=rHead.Xsize;i<nWdtOut;i++) pBuf[i]=0; // noch bis zu 3 Bytes - rOut.Seek(nOfs+((ULONG)rHead.Ysize-j-1L)*(ULONG)nWdtOut); // rueckwaerts schreiben! + rOut.Seek(nOfs+((sal_uLong)rHead.Ysize-j-1L)*(sal_uLong)nWdtOut); // rueckwaerts schreiben! rOut.Write((char*)pBuf,nWdtOut); } } delete[] pBuf; - return TRUE; + return sal_True; } @@ -390,14 +386,14 @@ BOOL SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead, SgfEntry&) |* SgfBMapFilter() |* *************************************************************************/ -BOOL SgfBMapFilter(SvStream& rInp, SvStream& rOut) +sal_Bool SgfBMapFilter(SvStream& rInp, SvStream& rOut) { - ULONG nFileStart; // Offset des SgfHeaders. Im allgemeinen 0. + sal_uLong nFileStart; // Offset des SgfHeaders. Im allgemeinen 0. SgfHeader aHead; SgfEntry aEntr; - ULONG nNext; - BOOL bRdFlag=FALSE; // Grafikentry gelesen ? - BOOL bRet=FALSE; // Returncode + sal_uLong nNext; + sal_Bool bRdFlag=sal_False; // Grafikentry gelesen ? + sal_Bool bRet=sal_False; // Returncode nFileStart=rInp.Tell(); rInp>>aHead; @@ -409,7 +405,7 @@ BOOL SgfBMapFilter(SvStream& rInp, SvStream& rOut) rInp>>aEntr; nNext=aEntr.GetOffset(); if (aEntr.Typ==aHead.Typ) { - bRdFlag=TRUE; + bRdFlag=sal_True; switch(aEntr.Typ) { case SgfBitImag0: case SgfBitImag1: @@ -419,7 +415,7 @@ BOOL SgfBMapFilter(SvStream& rInp, SvStream& rOut) } } // while(nNext) } - if (rInp.GetError()) bRet=FALSE; + if (rInp.GetError()) bRet=sal_False; return(bRet); } @@ -435,15 +431,15 @@ long SgfVectXmul=0; long SgfVectYmul=0; long SgfVectXdiv=0; long SgfVectYdiv=0; -BOOL SgfVectScal=FALSE; +sal_Bool SgfVectScal=sal_False; //////////////////////////////////////////////////////////// // Hpgl2SvFarbe //////////////////////////////////////////// //////////////////////////////////////////////////////////// -Color Hpgl2SvFarbe( BYTE nFarb ) +Color Hpgl2SvFarbe( sal_uInt8 nFarb ) { - ULONG nColor = COL_BLACK; + sal_uLong nColor = COL_BLACK; switch (nFarb & 0x07) { case 0: nColor=COL_WHITE; break; @@ -464,20 +460,20 @@ Color Hpgl2SvFarbe( BYTE nFarb ) |* SgfFilterVect() |* *************************************************************************/ -BOOL SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMtf) +sal_Bool SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMtf) { VirtualDevice aOutDev; SgfVector aVect; - BYTE nFarb; - BYTE nFrb0=7; - BYTE nLTyp; - BYTE nOTyp; - BOOL bEoDt=FALSE; - BOOL bPDwn=FALSE; + sal_uInt8 nFarb; + sal_uInt8 nFrb0=7; + sal_uInt8 nLTyp; + sal_uInt8 nOTyp; + sal_Bool bEoDt=sal_False; + sal_Bool bPDwn=sal_False; Point aP0(0,0); Point aP1(0,0); String Msg; - USHORT RecNr=0; + sal_uInt16 RecNr=0; rMtf.Record(&aOutDev); aOutDev.SetLineColor(Color(COL_BLACK)); @@ -485,9 +481,9 @@ BOOL SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMt while (!bEoDt && !rInp.GetError()) { rInp>>aVect; RecNr++; - nFarb=(BYTE) (aVect.Flag & 0x000F); - nLTyp=(BYTE)((aVect.Flag & 0x00F0) >>4); - nOTyp=(BYTE)((aVect.Flag & 0x0F00) >>8); + nFarb=(sal_uInt8) (aVect.Flag & 0x000F); + nLTyp=(sal_uInt8)((aVect.Flag & 0x00F0) >>4); + nOTyp=(sal_uInt8)((aVect.Flag & 0x0F00) >>8); bEoDt=(aVect.Flag & 0x4000) !=0; bPDwn=(aVect.Flag & 0x8000) !=0; @@ -528,7 +524,7 @@ BOOL SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMt Fraction( 1, 4 ), Fraction( 1, 4 ) ); rMtf.SetPrefMapMode( aMap ); rMtf.SetPrefSize( Size( (short)rHead.Xsize, (short)rHead.Ysize ) ); - return TRUE; + return sal_True; } @@ -537,14 +533,14 @@ BOOL SgfFilterVect(SvStream& rInp, SgfHeader& rHead, SgfEntry&, GDIMetaFile& rMt |* SgfVectFilter() |* *************************************************************************/ -BOOL SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) +sal_Bool SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) { - ULONG nFileStart; // Offset des SgfHeaders. Im allgemeinen 0. + sal_uLong nFileStart; // Offset des SgfHeaders. Im allgemeinen 0. SgfHeader aHead; SgfEntry aEntr; - ULONG nNext; - BOOL bRdFlag=FALSE; // Grafikentry gelesen ? - BOOL bRet=FALSE; // Returncode + sal_uLong nNext; + sal_Bool bRdFlag=sal_False; // Grafikentry gelesen ? + sal_Bool bRet=sal_False; // Returncode nFileStart=rInp.Tell(); rInp>>aHead; @@ -559,7 +555,7 @@ BOOL SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) } } // while(nNext) if (bRdFlag) { - if (!rInp.GetError()) bRet=TRUE; // Scheinbar Ok + if (!rInp.GetError()) bRet=sal_True; // Scheinbar Ok } } return(bRet); @@ -571,9 +567,9 @@ BOOL SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf) |* SgfFilterPScr() |* *************************************************************************/ -BOOL SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&) +sal_Bool SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&) { - return FALSE; // PostSrcipt wird noch nicht unterstuetzt ! + return sal_False; // PostSrcipt wird noch nicht unterstuetzt ! } @@ -584,7 +580,7 @@ BOOL SgfFilterPScr(SvStream&, SgfHeader&, SgfEntry&) |* Beschreibung Feststellen, um was fuer ein SGF/SGV es sich handelt. |* *************************************************************************/ -BYTE CheckSgfTyp(SvStream& rInp, USHORT& nVersion) +sal_uInt8 CheckSgfTyp(SvStream& rInp, sal_uInt16& nVersion) { #if OSL_DEBUG_LEVEL > 1 // Recordgroessen checken. Neuer Compiler hat vielleichte anderes Allignment! if (sizeof(SgfHeader)!=SgfHeaderSize || @@ -595,7 +591,7 @@ BYTE CheckSgfTyp(SvStream& rInp, USHORT& nVersion) sizeof(RGBQuad )!=RGBQuadSize ) return SGF_DONTKNOW; #endif - ULONG nPos; + sal_uLong nPos; SgfHeader aHead; nVersion=0; nPos=rInp.Tell(); diff --git a/svtools/source/filter.vcl/filter/sgvmain.cxx b/svtools/source/filter.vcl/filter/sgvmain.cxx index 7d0e45a4c3fb..404e2b5b01a1 100644 --- a/svtools/source/filter.vcl/filter/sgvmain.cxx +++ b/svtools/source/filter.vcl/filter/sgvmain.cxx @@ -55,7 +55,7 @@ p.Paper.RandO =SWAPSHORT(p.Paper.RandO ); \ p.Paper.RandU =SWAPSHORT(p.Paper.RandU ); \ SWAPPOINT(p.U); \ - UINT16 iTemp; \ + sal_uInt16 iTemp; \ for (iTemp=0;iTemp<20;iTemp++) { \ rPage.HlpLnH[iTemp]=SWAPSHORT(rPage.HlpLnH[iTemp]); \ rPage.HlpLnV[iTemp]=SWAPSHORT(rPage.HlpLnV[iTemp]); }} @@ -107,58 +107,49 @@ // //////////////////////////////////////////////////////////////////////////////////////////////////// -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "svtools", "AUTO_CODE" ) -#endif - //////////////////////////////////////////////////////////////////////////////////////////////////// // Fuer Fontuebersetzung /////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// SgfFontLst* pSgfFonts = 0; -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "SVTOOLS_FILTER3", "SVTOOLS_CODE" ) -static void AntiMscBug() {} -#endif - //////////////////////////////////////////////////////////////////////////////////////////////////// // Fuer Kreisunterarten, Text und gedrehte Rechtecke /////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// -void RotatePoint(PointType& P, INT16 cx, INT16 cy, double sn, double cs) +void RotatePoint(PointType& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs) { - INT16 dx,dy; + sal_Int16 dx,dy; double x1,y1; dx=P.x-cx; dy=P.y-cy; x1=dx*cs-dy*sn; y1=dy*cs+dx*sn; - P.x=cx+INT16(x1); - P.y=cy+INT16(y1); + P.x=cx+sal_Int16(x1); + P.y=cy+sal_Int16(y1); } -void RotatePoint(Point& P, INT16 cx, INT16 cy, double sn, double cs) +void RotatePoint(Point& P, sal_Int16 cx, sal_Int16 cy, double sn, double cs) { - INT16 dx,dy; + sal_Int16 dx,dy; double x1,y1; - dx=(INT16)(P.X()-cx); - dy=(INT16)(P.Y()-cy); + dx=(sal_Int16)(P.X()-cx); + dy=(sal_Int16)(P.Y()-cy); x1=dx*cs-dy*sn; y1=dy*cs+dx*sn; - P=Point(cx+INT16(x1),cy+INT16(y1)); + P=Point(cx+sal_Int16(x1),cy+sal_Int16(y1)); } -INT16 iMulDiv(INT16 a, INT16 Mul, INT16 Div) +sal_Int16 iMulDiv(sal_Int16 a, sal_Int16 Mul, sal_Int16 Div) { - INT32 Temp; - Temp=INT32(a)*INT32(Mul)/INT32(Div); - return INT16(Temp); + sal_Int32 Temp; + Temp=sal_Int32(a)*sal_Int32(Mul)/sal_Int32(Div); + return sal_Int16(Temp); } -UINT16 MulDiv(UINT16 a, UINT16 Mul, UINT16 Div) +sal_uInt16 MulDiv(sal_uInt16 a, sal_uInt16 Mul, sal_uInt16 Div) { - UINT32 Temp; - Temp=UINT32(a)*UINT32(Mul)/UINT32(Div); - return UINT16(Temp); + sal_uInt32 Temp; + Temp=sal_uInt32(a)*sal_uInt32(Mul)/sal_uInt32(Div); + return sal_uInt16(Temp); } //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -173,10 +164,10 @@ SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd) void DtHdOverSeek(SvStream& rInp) { - ULONG FPos=rInp.Tell(); - FPos+=(ULONG)DtHdSize; + sal_uLong FPos=rInp.Tell(); + FPos+=(sal_uLong)DtHdSize; rInp.Seek(FPos); -// rInp.seekg(rInp.tellg()+(ULONG)DtHdSize); +// rInp.seekg(rInp.tellg()+(sal_uLong)DtHdSize); } @@ -191,21 +182,21 @@ SvStream& operator>>(SvStream& rIStream, PageType& rPage) void ObjkOverSeek(SvStream& rInp, ObjkType& rObjk) { - ULONG Siz; - Siz=(ULONG)rObjk.MemSize+rObjk.Last; // ObjSize+ObjAnhSize + sal_uLong Siz; + Siz=(sal_uLong)rObjk.MemSize+rObjk.Last; // ObjSize+ObjAnhSize rInp.Seek(rInp.Tell()+Siz); } SvStream& operator>>(SvStream& rInp, ObjkType& rObjk) { // Die Fileposition im Stream bleibt unveraendert! - ULONG nPos; + sal_uLong nPos; nPos=rInp.Tell(); rInp.Read((char*)&rObjk.Last,ObjkSize); #if defined OSL_BIGENDIAN SWAPOBJK(rObjk); #endif #ifdef InArbeit - ULONG nPos1=rInp.Tell(); + sal_uLong nPos1=rInp.Tell(); if(nPos == nPos1) InfoBox( NULL, "tellg funkt nich" ).Execute(); #endif rInp.Seek(nPos); @@ -333,10 +324,10 @@ SvStream& operator>>(SvStream& rInp, GrupType& rGrup) |* Sgv2SvFarbe() |* *************************************************************************/ -Color Sgv2SvFarbe(BYTE nFrb1, BYTE nFrb2, BYTE nInts) +Color Sgv2SvFarbe(sal_uInt8 nFrb1, sal_uInt8 nFrb2, sal_uInt8 nInts) { - UINT16 r1=0,g1=0,b1=0,r2=0,g2=0,b2=0; - BYTE nInt2=100-nInts; + sal_uInt16 r1=0,g1=0,b1=0,r2=0,g2=0,b2=0; + sal_uInt8 nInt2=100-nInts; switch(nFrb1 & 0x07) { case 0: r1=0xFF; g1=0xFF; b1=0xFF; break; case 1: r1=0xFF; g1=0xFF; break; @@ -357,9 +348,9 @@ Color Sgv2SvFarbe(BYTE nFrb1, BYTE nFrb2, BYTE nInts) case 6: b2=0xFF; break; case 7: break; } - r1=(UINT16)((UINT32)r1*nInts/100+(UINT32)r2*nInt2/100); - g1=(UINT16)((UINT32)g1*nInts/100+(UINT32)g2*nInt2/100); - b1=(UINT16)((UINT32)b1*nInts/100+(UINT32)b2*nInt2/100); + r1=(sal_uInt16)((sal_uInt32)r1*nInts/100+(sal_uInt32)r2*nInt2/100); + g1=(sal_uInt16)((sal_uInt32)g1*nInts/100+(sal_uInt32)g2*nInt2/100); + b1=(sal_uInt16)((sal_uInt32)b1*nInts/100+(sal_uInt32)b2*nInt2/100); Color aColor( (sal_uInt8)r1, (sal_uInt8)g1, (sal_uInt8)b1 ); return aColor; } @@ -448,7 +439,7 @@ void StrkType::Draw(OutputDevice& rOut) |* RectType::DrawObjekt() |* *************************************************************************/ -void SgfAreaColorIntens(UINT16 Muster, BYTE Col1, BYTE Col2, BYTE Int, OutputDevice& rOut) +void SgfAreaColorIntens(sal_uInt16 Muster, sal_uInt8 Col1, sal_uInt8 Col2, sal_uInt8 Int, OutputDevice& rOut) { ObjAreaType F; F.FMuster=Muster; @@ -458,15 +449,15 @@ void SgfAreaColorIntens(UINT16 Muster, BYTE Col1, BYTE Col2, BYTE Int, OutputDev SetArea(F,rOut); } -void DrawSlideRect(INT16 x1, INT16 y1, INT16 x2, INT16 y2, ObjAreaType& F, OutputDevice& rOut) +void DrawSlideRect(sal_Int16 x1, sal_Int16 y1, sal_Int16 x2, sal_Int16 y2, ObjAreaType& F, OutputDevice& rOut) { - INT16 i,i0,b,b0; - INT16 Int1,Int2; - INT16 Col1,Col2; + sal_Int16 i,i0,b,b0; + sal_Int16 Int1,Int2; + sal_Int16 Col1,Col2; // ClipMerk: HgdClipRec; - INT16 cx,cy; - INT16 MaxR; - INT32 dx,dy; + sal_Int16 cx,cy; + sal_Int16 MaxR; + sal_Int32 dx,dy; rOut.SetLineColor(); if (x1>x2) { i=x1; x1=x2; x2=i; } @@ -474,7 +465,7 @@ void DrawSlideRect(INT16 x1, INT16 y1, INT16 x2, INT16 y2, ObjAreaType& F, Outpu Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87; Int1=100-F.FIntens; Int2=F.FIntens; if (Int1==Int2) { - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); rOut.DrawRect(Rectangle(x1,y1,x2,y2)); } else { b0=Int1; @@ -483,30 +474,30 @@ void DrawSlideRect(INT16 x1, INT16 y1, INT16 x2, INT16 y2, ObjAreaType& F, Outpu i0=y1; i=y1; while (i<=y2) { - b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-y1) /(INT32)(y2-y1+1)); + b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-y1) /(sal_Int32)(y2-y1+1)); if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); rOut.DrawRect(Rectangle(x1,i0,x2,i-1)); i0=i; b0=b; } i++; } - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); rOut.DrawRect(Rectangle(x1,i0,x2,y2)); } break; case 0x28: { // horizontal i0=x1; i=x1; while (i<=x2) { - b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-x1) /(INT32)(x2-x1+1)); + b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-x1) /(sal_Int32)(x2-x1+1)); if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); rOut.DrawRect(Rectangle(i0,y1,i-1,y2)); i0=i; b0=b; } i++; } - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); rOut.DrawRect(Rectangle(i0,y1,x2,y2)); } break; @@ -520,14 +511,14 @@ void DrawSlideRect(INT16 x1, INT16 y1, INT16 x2, INT16 y2, ObjAreaType& F, Outpu dx=x2-x1+1; dy=y2-y1+1; a=sqrt((double)(dx*dx+dy*dy)); - MaxR=INT16(a) /2 +1; + MaxR=sal_Int16(a) /2 +1; b0=Int2; i0=MaxR; if (MaxR<1) MaxR=1; i=MaxR; while (i>=0) { - b=Int1+INT16((INT32(Int2-Int1)*INT32(i)) /INT32(MaxR)); + b=Int1+sal_Int16((sal_Int32(Int2-Int1)*sal_Int32(i)) /sal_Int32(MaxR)); if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); //if (i0>200 || (Col1 & $80)!=0 || (Col2 & $80)!=0) { // then begin { Fallunterscheidung fuer etwas bessere Performance } // s2:=i0-i+2; @@ -540,7 +531,7 @@ void DrawSlideRect(INT16 x1, INT16 y1, INT16 x2, INT16 y2, ObjAreaType& F, Outpu } i--; } - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int1,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int1,rOut); rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0)); rOut.SetClipRegion(ClipMerk); } break; // Kreis @@ -567,7 +558,7 @@ void RectType::Draw(OutputDevice& rOut) } } else { Point aPts[4]; - USHORT i; + sal_uInt16 i; double sn,cs; sn=sin(double(DrehWink)*3.14159265359/18000); cs=cos(double(DrehWink)*3.14159265359/18000); @@ -594,7 +585,7 @@ void PolyType::Draw(OutputDevice& rOut) if ((Flags & PolyClosBit) !=0) SetArea(F,rOut); SetLine(L,rOut); Polygon aPoly(nPoints); - USHORT i; + sal_uInt16 i; for(i=0;i<nPoints;i++) aPoly.SetPoint(Point(EckP[i].x,EckP[i].y),i); if ((Flags & PolyClosBit) !=0) { rOut.DrawPolygon(aPoly); @@ -614,13 +605,13 @@ void SplnType::Draw(OutputDevice& rOut) SetLine(L,rOut); Polygon aPoly(0); Polygon aSpln(nPoints); - USHORT i; + sal_uInt16 i; for(i=0;i<nPoints;i++) aSpln.SetPoint(Point(EckP[i].x,EckP[i].y),i); if ((Flags & PolyClosBit) !=0) { - Spline2Poly(aSpln,TRUE,aPoly); + Spline2Poly(aSpln,sal_True,aPoly); if (aPoly.GetSize()>0) rOut.DrawPolygon(aPoly); } else { - Spline2Poly(aSpln,FALSE,aPoly); + Spline2Poly(aSpln,sal_False,aPoly); if (aPoly.GetSize()>0) rOut.DrawPolyLine(aPoly); } } @@ -630,22 +621,22 @@ void SplnType::Draw(OutputDevice& rOut) |* CircType::Draw() |* *************************************************************************/ -void DrawSlideCirc(INT16 cx, INT16 cy, INT16 rx, INT16 ry, ObjAreaType& F, OutputDevice& rOut) +void DrawSlideCirc(sal_Int16 cx, sal_Int16 cy, sal_Int16 rx, sal_Int16 ry, ObjAreaType& F, OutputDevice& rOut) { - INT16 x1=cx-rx; - INT16 y1=cy-ry; - INT16 x2=cx+rx; - INT16 y2=cy+ry; + sal_Int16 x1=cx-rx; + sal_Int16 y1=cy-ry; + sal_Int16 x2=cx+rx; + sal_Int16 y2=cy+ry; - INT16 i,i0,b,b0; - INT16 Int1,Int2; - INT16 Col1,Col2; + sal_Int16 i,i0,b,b0; + sal_Int16 Int1,Int2; + sal_Int16 Col1,Col2; rOut.SetLineColor(); Col1=F.FBFarbe & 0x87; Col2=F.FFarbe & 0x87; Int1=100-F.FIntens; Int2=F.FIntens; if (Int1==Int2) { - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); rOut.DrawEllipse(Rectangle(x1,y1,x2,y2)); } else { b0=Int1; @@ -655,16 +646,16 @@ void DrawSlideCirc(INT16 cx, INT16 cy, INT16 rx, INT16 ry, ObjAreaType& F, Outpu i0=y1; i=y1; while (i<=y2) { - b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-y1) /(INT32)(y2-y1+1)); + b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-y1) /(sal_Int32)(y2-y1+1)); if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); rOut.SetClipRegion(Rectangle(x1,i0,x2,i-1)); rOut.DrawEllipse(Rectangle(x1,y1,x2,y2)); i0=i; b0=b; } i++; } - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); rOut.SetClipRegion(Rectangle(x1,i0,x2,y2)); rOut.DrawEllipse(Rectangle(x1,y1,x2,y2)); rOut.SetClipRegion(ClipMerk); @@ -674,23 +665,23 @@ void DrawSlideCirc(INT16 cx, INT16 cy, INT16 rx, INT16 ry, ObjAreaType& F, Outpu i0=x1; i=x1; while (i<=x2) { - b=Int1+INT16((INT32)(Int2-Int1)*(INT32)(i-x1) /(INT32)(x2-x1+1)); + b=Int1+sal_Int16((sal_Int32)(Int2-Int1)*(sal_Int32)(i-x1) /(sal_Int32)(x2-x1+1)); if (b!=b0) { - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); rOut.SetClipRegion(Rectangle(i0,y1,i-1,y2)); rOut.DrawEllipse(Rectangle(x1,y1,x2,y2)); i0=i; b0=b; } i++; } - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int2,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int2,rOut); rOut.SetClipRegion(Rectangle(i0,y1,x2,y2)); rOut.DrawEllipse(Rectangle(x1,y1,x2,y2)); rOut.SetClipRegion(ClipMerk); } break; case 0x18: case 0x38: { // Kreis - INT16 MaxR; + sal_Int16 MaxR; if (rx<1) rx=1; if (ry<1) ry=1; @@ -699,17 +690,17 @@ void DrawSlideCirc(INT16 cx, INT16 cy, INT16 rx, INT16 ry, ObjAreaType& F, Outpu i0=MaxR; if (MaxR<1) MaxR=1; i=MaxR; while (i>=0) { - b=Int1+INT16((INT32(Int2-Int1)*INT32(i)) /INT32(MaxR)); + b=Int1+sal_Int16((sal_Int32(Int2-Int1)*sal_Int32(i)) /sal_Int32(MaxR)); if (b!=b0) { - INT32 temp=INT32(i0)*INT32(ry)/INT32(rx); - INT16 j0=INT16(temp); - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)b0,rOut); + sal_Int32 temp=sal_Int32(i0)*sal_Int32(ry)/sal_Int32(rx); + sal_Int16 j0=sal_Int16(temp); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)b0,rOut); rOut.DrawEllipse(Rectangle(cx-i0,cy-j0,cx+i0,cy+j0)); i0=i; b0=b; } i--; } - SgfAreaColorIntens(F.FMuster,(BYTE)Col1,(BYTE)Col2,(BYTE)Int1,rOut); + SgfAreaColorIntens(F.FMuster,(sal_uInt8)Col1,(sal_uInt8)Col2,(sal_uInt8)Int1,rOut); rOut.DrawEllipse(Rectangle(cx-i0,cy-i0,cx+i0,cy+i0)); } break; // Kreis } @@ -778,7 +769,7 @@ void BmapType::Draw(OutputDevice& rOut) { //ifstream aInp; unsigned char nSgfTyp; - USHORT nVersion; + sal_uInt16 nVersion; String aStr( reinterpret_cast< char const * >(&Filename[ 1 ]), (xub_StrLen)Filename[ 0 ], RTL_TEXTENCODING_UTF8 ); @@ -803,7 +794,7 @@ void BmapType::Draw(OutputDevice& rOut) SgfVectYmul=Pos2.y-Pos1.y; SgfVectXdiv=0; SgfVectYdiv=0; - SgfVectScal=TRUE; + SgfVectScal=sal_True; SgfVectFilter(*pInp,aMtf); SgfVectXofs=0; SgfVectYofs=0; @@ -811,7 +802,7 @@ void BmapType::Draw(OutputDevice& rOut) SgfVectYmul=0; SgfVectXdiv=0; SgfVectYdiv=0; - SgfVectScal=FALSE; + SgfVectScal=sal_False; aMtf.Play(&rOut); } break; } @@ -825,9 +816,9 @@ void BmapType::Draw(OutputDevice& rOut) |* GrupType::... |* *************************************************************************/ -UINT32 GrupType::GetSubPtr() +sal_uInt32 GrupType::GetSubPtr() { - return UINT32(SbLo)+0x00010000*UINT32(SbHi); + return sal_uInt32(SbLo)+0x00010000*sal_uInt32(SbHi); } /************************************************************************* @@ -838,8 +829,8 @@ UINT32 GrupType::GetSubPtr() void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) { ObjkType aObjk; - USHORT nGrpCnt=0; - BOOL bEnde=FALSE; + sal_uInt16 nGrpCnt=0; + sal_Bool bEnde=sal_False; do { rInp>>aObjk; if (!rInp.GetError()) { @@ -906,11 +897,11 @@ void DrawObjkList( SvStream& rInp, OutputDevice& rOut ) } // if rInp if (!rInp.GetError()) { if (aObjk.Next==0L) { - if (nGrpCnt==0) bEnde=TRUE; + if (nGrpCnt==0) bEnde=sal_True; else nGrpCnt--; } } else { - bEnde=TRUE; // Lesefehler + bEnde=sal_True; // Lesefehler } } while (!bEnde); } @@ -942,15 +933,15 @@ void SkipObjkList(SvStream& rInp) |* SgfFilterSDrw() |* *************************************************************************/ -BOOL SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf ) +sal_Bool SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; PageType aPage; VirtualDevice aOutDev; OutputDevice* pOutDev; - ULONG nStdPos; - ULONG nZchPos; - USHORT Num; + sal_uLong nStdPos; + sal_uLong nZchPos; + sal_uInt16 Num; pOutDev=&aOutDev; DtHdOverSeek(rInp); // DataHeader weglesen @@ -986,8 +977,8 @@ BOOL SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf ) rMtf.WindStart(); MapMode aMap(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4)); rMtf.SetPrefMapMode(aMap); - rMtf.SetPrefSize(Size((INT16)aPage.Paper.Size.x,(INT16)aPage.Paper.Size.y)); - bRet=TRUE; + rMtf.SetPrefSize(Size((sal_Int16)aPage.Paper.Size.x,(sal_Int16)aPage.Paper.Size.y)); + bRet=sal_True; return bRet; } @@ -998,18 +989,18 @@ BOOL SgfFilterSDrw( SvStream& rInp, SgfHeader&, SgfEntry&, GDIMetaFile& rMtf ) |* SgfSDrwFilter() |* *************************************************************************/ -BOOL SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath ) +sal_Bool SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath ) { #if OSL_DEBUG_LEVEL > 1 // Recordgroessen checken. Neuer Compiler hat vielleichte anderes Alignment! - if (sizeof(ObjTextType)!=ObjTextTypeSize) return FALSE; + if (sizeof(ObjTextType)!=ObjTextTypeSize) return sal_False; #endif - ULONG nFileStart; // Offset des SgfHeaders. Im allgemeinen 0. + sal_uLong nFileStart; // Offset des SgfHeaders. Im allgemeinen 0. SgfHeader aHead; SgfEntry aEntr; - ULONG nNext; - BOOL bRdFlag=FALSE; // Grafikentry gelesen ? - BOOL bRet=FALSE; // Returncode + sal_uLong nNext; + sal_Bool bRdFlag=sal_False; // Grafikentry gelesen ? + sal_Bool bRet=sal_False; // Returncode aIniPath.Append( String::CreateFromAscii( "sgf.ini", 7 ) ); // aIniPath.ToAbs(); @@ -1030,7 +1021,7 @@ BOOL SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath ) } } // while(nNext) if (bRdFlag) { - if (!rInp.GetError()) bRet=TRUE; // Scheinbar Ok + if (!rInp.GetError()) bRet=sal_True; // Scheinbar Ok } } delete pSgfFonts; @@ -1038,7 +1029,7 @@ BOOL SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath ) } /* -Bitmap Dither(BYTE Intens) +Bitmap Dither(sal_uInt8 Intens) { Bitmap aBmp; BmpInfoHeader Info; @@ -1081,8 +1072,4 @@ for n:=0 to 63 do end; */ -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "svtools", "AUTO_CODE" ) -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/sgvspln.cxx b/svtools/source/filter.vcl/filter/sgvspln.cxx index fb70950b2b2d..0ed81a50d534 100644 --- a/svtools/source/filter.vcl/filter/sgvspln.cxx +++ b/svtools/source/filter.vcl/filter/sgvspln.cxx @@ -34,11 +34,6 @@ #include <tools/poly.hxx> -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "SVTOOLS_FILTER2", "SVTOOLS_CODE" ) -#pragma optimize( "", off ) -#endif - #if defined( PM2 ) && defined( __BORLANDC__ ) #pragma option -Od #endif @@ -146,10 +141,6 @@ short basis() /* BASIS maschinenunabhaengig bestimmen */ #define NEGMAX -POSMIN /* groesste negative Zahl */ #define NEGMIN -POSMAX /* kleinste negative Zahl */ -#define TRUE 1 -#define FALSE 0 - - /* Definition von Funktionsmakros: */ @@ -176,7 +167,7 @@ short basis() /* BASIS maschinenunabhaengig bestimmen */ /*---------------------- MODUL TRIDIAGONAL ------------------------*/ -USHORT TriDiagGS(BOOL rep, USHORT n, double* lower, +sal_uInt16 TriDiagGS(sal_Bool rep, sal_uInt16 n, double* lower, double* diag, double* upper, double* b) /************************/ /* GAUSS-Verfahren fuer */ @@ -213,7 +204,7 @@ USHORT TriDiagGS(BOOL rep, USHORT n, double* lower, /* */ /* Eingabeparameter: */ /* ================ */ -/* n Dimension der Matrix ( > 1 ) USHORT n */ +/* n Dimension der Matrix ( > 1 ) sal_uInt16 n */ /* */ /* lower untere Nebendiagonale double lower[n] */ /* diag Hauptdiagonale double diag[n] */ @@ -223,7 +214,7 @@ USHORT TriDiagGS(BOOL rep, USHORT n, double* lower, /* Dreieckzerlegung der Ausgangsmatrix. */ /* */ /* b rechte Seite des Systems double b[n] */ -/* rep = 0 erstmaliger Aufruf BOOL rep */ +/* rep = 0 erstmaliger Aufruf sal_Bool rep */ /* !=0 wiederholter Aufruf */ /* fuer gleiche Matrix, */ /* aber verschiedenes b. */ @@ -257,7 +248,7 @@ USHORT TriDiagGS(BOOL rep, USHORT n, double* lower, /*.cp 5 */ { - USHORT i; + sal_uInt16 i; short j; // double fabs(double); @@ -308,7 +299,7 @@ USHORT TriDiagGS(BOOL rep, USHORT n, double* lower, /*---------------- MODUL ZYKLISCH TRIDIAGONAL ----------------------*/ -USHORT ZyklTriDiagGS(BOOL rep, USHORT n, double* lower, double* diag, +sal_uInt16 ZyklTriDiagGS(sal_Bool rep, sal_uInt16 n, double* lower, double* diag, double* upper, double* lowrow, double* ricol, double* b) /******************************/ /* Systeme mit zyklisch tri- */ @@ -349,12 +340,12 @@ USHORT ZyklTriDiagGS(BOOL rep, USHORT n, double* lower, double* diag, /* */ /* Eingabeparameter: */ /* ================ */ -/* n Dimension der Matrix ( > 2 ) USHORT n */ +/* n Dimension der Matrix ( > 2 ) sal_uInt16 n */ /* lower untere Nebendiagonale double lower[n] */ /* diag Hauptdiagonale double diag[n] */ /* upper obere Nebendiagonale double upper[n] */ /* b rechte Seite des Systems double b[n] */ -/* rep = 0 erstmaliger Aufruf BOOL rep */ +/* rep = 0 erstmaliger Aufruf sal_Bool rep */ /* !=0 wiederholter Aufruf */ /* fuer gleiche Matrix, */ /* aber verschiedenes b. */ @@ -391,7 +382,7 @@ USHORT ZyklTriDiagGS(BOOL rep, USHORT n, double* lower, double* diag, /*.cp 5 */ { double temp; // fabs(double); - USHORT i; + sal_uInt16 i; short j; if ( n < 3 ) return(1); @@ -462,15 +453,15 @@ USHORT ZyklTriDiagGS(BOOL rep, USHORT n, double* lower, double* diag, |* *************************************************************************/ -USHORT NaturalSpline(USHORT n, double* x, double* y, +sal_uInt16 NaturalSpline(sal_uInt16 n, double* x, double* y, double Marg0, double MargN, - BYTE MargCond, + sal_uInt8 MargCond, double* b, double* c, double* d) { - USHORT i; + sal_uInt16 i; double* a; double* h; - USHORT error; + sal_uInt16 error; if (n<2) return 1; if ( (MargCond & ~3) ) return 2; @@ -520,7 +511,7 @@ USHORT NaturalSpline(USHORT n, double* x, double* y, if (n==2) { c[1]=a[0]/d[0]; } else { - error=TriDiagGS(FALSE,n-1,b,d,c,a); + error=TriDiagGS(sal_False,n-1,b,d,c,a); if (error!=0) { delete[] a; delete[] h; return error+2; } for (i=0;i<n-1;i++) c[i+1]=a[i]; } @@ -569,11 +560,11 @@ USHORT NaturalSpline(USHORT n, double* x, double* y, *************************************************************************/ -USHORT PeriodicSpline(USHORT n, double* x, double* y, +sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y, double* b, double* c, double* d) { // Arrays muessen von [0..n] dimensioniert sein! - USHORT Error; - USHORT i,im1,nm1; //integer + sal_uInt16 Error; + sal_uInt16 i,im1,nm1; //integer double hr,hl; double* a; double* lowrow; @@ -610,7 +601,7 @@ USHORT PeriodicSpline(USHORT n, double* x, double* y, lowrow[0]=hr; ricol[0]=hr; a[nm1]=3.0*((y[1]-y[0])/hr-(y[n]-y[nm1])/hl); - Error=ZyklTriDiagGS(FALSE,n,b,d,c,lowrow,ricol,a); + Error=ZyklTriDiagGS(sal_False,n,b,d,c,lowrow,ricol,a); if ( Error != 0 ) { delete[] a; @@ -645,22 +636,22 @@ USHORT PeriodicSpline(USHORT n, double* x, double* y, |* *************************************************************************/ -USHORT ParaSpline(USHORT n, double* x, double* y, BYTE MargCond, +sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond, double Marg01, double Marg02, double MargN1, double MargN2, - BOOL CondT, double* T, + sal_Bool CondT, double* T, double* bx, double* cx, double* dx, double* by, double* cy, double* dy) { - USHORT Error; - USHORT i; + sal_uInt16 Error; + sal_uInt16 i; double deltX,deltY,delt, alphX = 0,alphY = 0, betX = 0,betY = 0; if (n<2) return 1; if ((MargCond & ~3) && (MargCond != 4)) return 2; // ungueltige Randbedingung - if (CondT==FALSE) { + if (CondT==sal_False) { T[0]=0.0; for (i=0;i<n;i++) { deltX=x[i+1]-x[i]; deltY=y[i+1]-y[i]; @@ -722,21 +713,21 @@ USHORT ParaSpline(USHORT n, double* x, double* y, BYTE MargCond, |* Polygons werden als Stuetzstellen angenommen. |* n liefert die Anzahl der Teilpolynome. |* Ist die Berechnung fehlerfrei verlaufen, so -|* liefert die Funktion TRUE. Nur in diesem Fall +|* liefert die Funktion sal_True. Nur in diesem Fall |* ist Speicher fuer die Koeffizientenarrays |* allokiert, der dann spaeter vom Aufrufer mittels |* delete freizugeben ist. |* *************************************************************************/ -BOOL CalcSpline(Polygon& rPoly, BOOL Periodic, USHORT& n, +sal_Bool CalcSpline(Polygon& rPoly, sal_Bool Periodic, sal_uInt16& n, double*& ax, double*& ay, double*& bx, double*& by, double*& cx, double*& cy, double*& dx, double*& dy, double*& T) { - BYTE Marg; + sal_uInt8 Marg; double Marg01; double MargN1,MargN2; - USHORT i; + sal_uInt16 i; Point P0(-32768,-32768); Point Pt; @@ -777,12 +768,12 @@ BOOL CalcSpline(Polygon& rPoly, BOOL Periodic, USHORT& n, MargN2=0.0; if (n>0) n--; // n Korregieren (Anzahl der Teilpolynome) - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if ( ( Marg == 3 && n >= 3 ) || ( Marg == 2 && n >= 2 ) ) { - bRet = ParaSpline(n,ax,ay,Marg,Marg01,Marg01,MargN1,MargN2,FALSE,T,bx,cx,dx,by,cy,dy) == 0; + bRet = ParaSpline(n,ax,ay,Marg,Marg01,Marg01,MargN1,MargN2,sal_False,T,bx,cx,dx,by,cy,dy) == 0; } - if ( bRet == FALSE ) + if ( bRet == sal_False ) { delete[] ax; delete[] ay; @@ -806,7 +797,7 @@ BOOL CalcSpline(Polygon& rPoly, BOOL Periodic, USHORT& n, |* Beschreibung Konvertiert einen parametrichen kubischen |* Polynomspline Spline (natuerlich oder periodisch) |* in ein angenaehertes Polygon. -|* Die Funktion liefert FALSE, wenn ein Fehler bei +|* Die Funktion liefert sal_False, wenn ein Fehler bei |* der Koeffizientenberechnung aufgetreten ist oder |* das Polygon zu gross wird (>PolyMax=16380). Im 1. |* Fall hat das Polygon 0, im 2. Fall PolyMax Punkte. @@ -814,7 +805,7 @@ BOOL CalcSpline(Polygon& rPoly, BOOL Periodic, USHORT& n, |* auf +/-32000 begrenzt. |* *************************************************************************/ -BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly) +sal_Bool Spline2Poly(Polygon& rSpln, sal_Bool Periodic, Polygon& rPoly) { short MinKoord=-32000; // zur Vermeidung short MaxKoord=32000; // von Ueberlaeufen @@ -832,11 +823,11 @@ BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly) double Step; // Schrittweite fuer t double dt1,dt2,dt3; // Delta t, y, ^3 double t; - BOOL bEnde; // Teilpolynom zu Ende? - USHORT n; // Anzahl der zu zeichnenden Teilpolynome - USHORT i; // aktuelles Teilpolynom - BOOL bOk; // noch alles ok? - USHORT PolyMax=16380;// Maximale Anzahl von Polygonpunkten + sal_Bool bEnde; // Teilpolynom zu Ende? + sal_uInt16 n; // Anzahl der zu zeichnenden Teilpolynome + sal_uInt16 i; // aktuelles Teilpolynom + sal_Bool bOk; // noch alles ok? + sal_uInt16 PolyMax=16380;// Maximale Anzahl von Polygonpunkten long x,y; bOk=CalcSpline(rSpln,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv); @@ -848,7 +839,7 @@ BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly) i=0; while (i<n) { // n Teilpolynome malen t=tv[i]+Step; - bEnde=FALSE; + bEnde=sal_False; while (!bEnde) { // ein Teilpolynom interpolieren bEnde=t>=tv[i+1]; if (bEnde) t=tv[i+1]; @@ -861,7 +852,7 @@ BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly) rPoly.SetSize(rPoly.GetSize()+1); rPoly.SetPoint(Point(short(x),short(y)),rPoly.GetSize()-1); } else { - bOk=FALSE; // Fehler: Polygon wird zu gross + bOk=sal_False; // Fehler: Polygon wird zu gross } t=t+Step; } // Ende von Teilpolynom @@ -879,7 +870,7 @@ BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly) return bOk; } // Ende von if (bOk) rPoly.SetSize(0); - return FALSE; + return sal_False; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/filter/sgvtext.cxx b/svtools/source/filter.vcl/filter/sgvtext.cxx index 538b75245403..5eb0b5e5c1f4 100644 --- a/svtools/source/filter.vcl/filter/sgvtext.cxx +++ b/svtools/source/filter.vcl/filter/sgvtext.cxx @@ -38,10 +38,6 @@ extern SgfFontLst* pSgfFonts; -#if defined( WIN ) && defined( MSC ) -#pragma code_seg( "SVTOOLS_FILTER1", "SVTOOLS_CODE" ) -#endif - #ifndef abs #define abs(x) ((x)<0 ? -(x) : (x)) #endif @@ -217,9 +213,9 @@ extern SgfFontLst* pSgfFonts; ///////////////////////////////////////////////////////////////////////////////// -BOOL CheckTextOutl(ObjAreaType& F, ObjLineType& L); +sal_Bool CheckTextOutl(ObjAreaType& F, ObjLineType& L); -BOOL CheckTextOutl(ObjAreaType& F, ObjLineType& L) +sal_Bool CheckTextOutl(ObjAreaType& F, ObjLineType& L) { return (F.FIntens!=L.LIntens) || ((F.FFarbe!=L.LFarbe) && (F.FIntens>0)) || @@ -265,11 +261,11 @@ short Sgf2hPoint(short a) // Unterkante berechnen. Alles in SGF-Units. // ====================================================================== -USHORT GetTopToBaseLine(USHORT MaxGrad) +sal_uInt16 GetTopToBaseLine(sal_uInt16 MaxGrad) { long ret; ret=long(MaxGrad)*long(CharTopToBase) /long(100); - return USHORT(ret); + return sal_uInt16(ret); } // ====================================================================== @@ -310,9 +306,9 @@ UCHAR ConvertTextChar(UCHAR c) -USHORT GetSchnittBit(UCHAR c) +sal_uInt16 GetSchnittBit(UCHAR c) { - USHORT r=0; + sal_uInt16 r=0; switch (c) { case EscBold : r=TextBoldBit; break; case EscRSlnt: r=TextRSlnBit; break; @@ -353,10 +349,10 @@ long ChgValue(long Def, long Min, long Max, UCHAR FlgVal, long NumVal) -void ChgSchnittBit(USHORT Bit, USHORT Radio1, USHORT Radio2, USHORT Radio3, - UCHAR FlgVal, USHORT Schnitt0, USHORT& Schnitt) +void ChgSchnittBit(sal_uInt16 Bit, sal_uInt16 Radio1, sal_uInt16 Radio2, sal_uInt16 Radio3, + UCHAR FlgVal, sal_uInt16 Schnitt0, sal_uInt16& Schnitt) { - USHORT All,Rad; + sal_uInt16 All,Rad; Rad=Radio1 | Radio2 | Radio3; All=Bit | Rad; @@ -371,9 +367,9 @@ void ChgSchnittBit(USHORT Bit, USHORT Radio1, USHORT Radio2, USHORT Radio3, -UCHAR GetNextChar(UCHAR* TBuf, USHORT Index) +UCHAR GetNextChar(UCHAR* TBuf, sal_uInt16 Index) { - USHORT Cnt; + sal_uInt16 Cnt; while (TBuf[Index]==Escape) { Index++; Cnt=0; @@ -386,24 +382,24 @@ UCHAR GetNextChar(UCHAR* TBuf, USHORT Index) -UCHAR ProcessOne(UCHAR* TBuf, USHORT& Index, +UCHAR ProcessOne(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& AktAtr, - BOOL ScanEsc) + sal_Bool ScanEsc) { UCHAR c; UCHAR Ident; - BOOL Ende; - BOOL q; + sal_Bool Ende; + sal_Bool q; UCHAR FlgVal; long NumVal; long Sgn; short i; - BOOL EoVal; + sal_Bool EoVal; do { c=TBuf[Index]; Index++; Ende=(c!=Escape); - if (Ende==FALSE) { + if (Ende==sal_False) { c=TBuf[Index]; Index++; Ident=c; // Identifer merken FlgVal=EscNoFlg; @@ -417,36 +413,36 @@ UCHAR ProcessOne(UCHAR* TBuf, USHORT& Index, do { NumVal=10*NumVal+c-'0'; EoVal=(TBuf[Index]<'0' || TBuf[Index]>'9'); - if (EoVal==FALSE) { c=TBuf[Index]; Index++; } + if (EoVal==sal_False) { c=TBuf[Index]; Index++; } i--; - } while (i>0 && EoVal==FALSE); + } while (i>0 && EoVal==sal_False); NumVal=Sgn*NumVal; } q=!CheckTextOutl(AktAtr.F,AktAtr.L); switch (Ident) { - case EscFont : AktAtr.SetFont(ULONG (ChgValue(Atr0.GetFont(),0,0 ,FlgVal,NumVal)));break; - case EscGrad : AktAtr.Grad =USHORT(ChgValue(Atr0.Grad, 2,2000 ,FlgVal,NumVal)); break; - case EscBreit: AktAtr.Breite =USHORT(ChgValue(Atr0.Breite, 1,1000 ,FlgVal,NumVal)); break; - case EscKaptS: AktAtr.Kapit =(BYTE)(ChgValue(Atr0.Kapit, 1,255 ,FlgVal,NumVal)); break; - case EscLFeed: AktAtr.LnFeed =USHORT(ChgValue(Atr0.LnFeed, 1,65535 ,FlgVal,NumVal)); break; - case EscSlant: AktAtr.Slant =USHORT(ChgValue(Atr0.Slant, 1,MaxCharSlant ,FlgVal,NumVal)); break; + case EscFont : AktAtr.SetFont(sal_uLong (ChgValue(Atr0.GetFont(),0,0 ,FlgVal,NumVal)));break; + case EscGrad : AktAtr.Grad =sal_uInt16(ChgValue(Atr0.Grad, 2,2000 ,FlgVal,NumVal)); break; + case EscBreit: AktAtr.Breite =sal_uInt16(ChgValue(Atr0.Breite, 1,1000 ,FlgVal,NumVal)); break; + case EscKaptS: AktAtr.Kapit =(sal_uInt8)(ChgValue(Atr0.Kapit, 1,255 ,FlgVal,NumVal)); break; + case EscLFeed: AktAtr.LnFeed =sal_uInt16(ChgValue(Atr0.LnFeed, 1,65535 ,FlgVal,NumVal)); break; + case EscSlant: AktAtr.Slant =sal_uInt16(ChgValue(Atr0.Slant, 1,MaxCharSlant ,FlgVal,NumVal)); break; case EscVPos : AktAtr.ChrVPos=char (ChgValue(Atr0.ChrVPos,-128,127 ,FlgVal,NumVal)); break; - case EscZAbst: AktAtr.ZAbst =(BYTE)(ChgValue(Atr0.ZAbst, 1,255 ,FlgVal,NumVal)); break; - case EscHJust: AktAtr.Justify=(BYTE)(ChgValue(Atr0.Justify & 0x0F,0,5 ,FlgVal,NumVal)); break; - case EscFarbe: { AktAtr.L.LFarbe =(BYTE)(ChgValue(Atr0.L.LFarbe,0,7 ,FlgVal,NumVal)); if (q) AktAtr.F.FFarbe =AktAtr.L.LFarbe; } break; - case EscBFarb: { AktAtr.L.LBFarbe=(BYTE)(ChgValue(Atr0.L.LBFarbe,0,255,FlgVal,NumVal)); if (q) AktAtr.F.FBFarbe=AktAtr.L.LBFarbe; } break; - case EscInts : { AktAtr.L.LIntens=(BYTE)(ChgValue(Atr0.L.LIntens,0,100,FlgVal,NumVal)); if (q) AktAtr.F.FIntens=AktAtr.L.LIntens; } break; - - case EscMustr: { AktAtr.F.FMuster=USHORT(ChgValue(Atr0.F.FMuster,0,65535,FlgVal,NumVal)); } break; - case EscMFarb: { AktAtr.F.FFarbe =(BYTE)(ChgValue(Atr0.F.FFarbe,0,7 ,FlgVal,NumVal)); } break; - case EscMBFrb: { AktAtr.F.FBFarbe=(BYTE)(ChgValue(Atr0.F.FBFarbe,0,255,FlgVal,NumVal)); } break; - case EscMInts: { AktAtr.F.FIntens=(BYTE)(ChgValue(Atr0.F.FIntens,0,100,FlgVal,NumVal)); } break; - - case EscSMstr: { AktAtr.ShdF.FMuster=USHORT(ChgValue(Atr0.ShdF.FMuster,0,65535,FlgVal,NumVal)); } break; - case EscSFarb: { AktAtr.ShdL.LFarbe =(BYTE)(ChgValue(Atr0.ShdL.LFarbe,0,7 ,FlgVal,NumVal)); AktAtr.ShdF.FFarbe =AktAtr.ShdL.LFarbe; } break; - case EscSBFrb: { AktAtr.ShdL.LBFarbe=(BYTE)(ChgValue(Atr0.ShdL.LBFarbe,0,255,FlgVal,NumVal)); AktAtr.ShdF.FBFarbe=AktAtr.ShdL.LBFarbe; } break; - case EscSInts: { AktAtr.ShdL.LIntens=(BYTE)(ChgValue(Atr0.ShdL.LIntens,0,100,FlgVal,NumVal)); AktAtr.ShdF.FIntens=AktAtr.ShdL.LIntens; } break; + case EscZAbst: AktAtr.ZAbst =(sal_uInt8)(ChgValue(Atr0.ZAbst, 1,255 ,FlgVal,NumVal)); break; + case EscHJust: AktAtr.Justify=(sal_uInt8)(ChgValue(Atr0.Justify & 0x0F,0,5 ,FlgVal,NumVal)); break; + case EscFarbe: { AktAtr.L.LFarbe =(sal_uInt8)(ChgValue(Atr0.L.LFarbe,0,7 ,FlgVal,NumVal)); if (q) AktAtr.F.FFarbe =AktAtr.L.LFarbe; } break; + case EscBFarb: { AktAtr.L.LBFarbe=(sal_uInt8)(ChgValue(Atr0.L.LBFarbe,0,255,FlgVal,NumVal)); if (q) AktAtr.F.FBFarbe=AktAtr.L.LBFarbe; } break; + case EscInts : { AktAtr.L.LIntens=(sal_uInt8)(ChgValue(Atr0.L.LIntens,0,100,FlgVal,NumVal)); if (q) AktAtr.F.FIntens=AktAtr.L.LIntens; } break; + + case EscMustr: { AktAtr.F.FMuster=sal_uInt16(ChgValue(Atr0.F.FMuster,0,65535,FlgVal,NumVal)); } break; + case EscMFarb: { AktAtr.F.FFarbe =(sal_uInt8)(ChgValue(Atr0.F.FFarbe,0,7 ,FlgVal,NumVal)); } break; + case EscMBFrb: { AktAtr.F.FBFarbe=(sal_uInt8)(ChgValue(Atr0.F.FBFarbe,0,255,FlgVal,NumVal)); } break; + case EscMInts: { AktAtr.F.FIntens=(sal_uInt8)(ChgValue(Atr0.F.FIntens,0,100,FlgVal,NumVal)); } break; + + case EscSMstr: { AktAtr.ShdF.FMuster=sal_uInt16(ChgValue(Atr0.ShdF.FMuster,0,65535,FlgVal,NumVal)); } break; + case EscSFarb: { AktAtr.ShdL.LFarbe =(sal_uInt8)(ChgValue(Atr0.ShdL.LFarbe,0,7 ,FlgVal,NumVal)); AktAtr.ShdF.FFarbe =AktAtr.ShdL.LFarbe; } break; + case EscSBFrb: { AktAtr.ShdL.LBFarbe=(sal_uInt8)(ChgValue(Atr0.ShdL.LBFarbe,0,255,FlgVal,NumVal)); AktAtr.ShdF.FBFarbe=AktAtr.ShdL.LBFarbe; } break; + case EscSInts: { AktAtr.ShdL.LIntens=(sal_uInt8)(ChgValue(Atr0.ShdL.LIntens,0,100,FlgVal,NumVal)); AktAtr.ShdF.FIntens=AktAtr.ShdL.LIntens; } break; case EscSDist: { AktAtr.ShdVers.x=(short)ChgValue(Atr0.ShdVers.x,0,30000,FlgVal,NumVal); AktAtr.ShdVers.y=AktAtr.ShdVers.x; } break; case EscSXDst: { AktAtr.ShdVers.x=(short)ChgValue(Atr0.ShdVers.x,0,30000,FlgVal,NumVal); } break; case EscSYDst: { AktAtr.ShdVers.y=(short)ChgValue(Atr0.ShdVers.y,0,30000,FlgVal,NumVal); } break; @@ -467,21 +463,21 @@ UCHAR ProcessOne(UCHAR* TBuf, USHORT& Index, case EscEbShd: ChgSchnittBit(TextShEbBit,TextSh2DBit,TextSh3DBit,TextSh4DBit,FlgVal,Atr0.Schnitt,AktAtr.Schnitt); break; } //endcase if (TBuf[Index]==Escape) Index++; // zweites Esc weglesen } - } // if Ende==FALSE - } while (Ende==FALSE && ScanEsc==FALSE); - if (Ende==FALSE) c=Escape; + } // if Ende==sal_False + } while (Ende==sal_False && ScanEsc==sal_False); + if (Ende==sal_False) c=Escape; return c; } // end of ProcessOne -UCHAR GetTextChar(UCHAR* TBuf, USHORT& Index, +UCHAR GetTextChar(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& AktAtr, - USHORT Rest, BOOL ScanEsc) + sal_uInt16 Rest, sal_Bool ScanEsc) { UCHAR c,c0,nc; c=ProcessOne(TBuf,Index,Atr0,AktAtr,ScanEsc); - if (ScanEsc==FALSE) { + if (ScanEsc==sal_False) { if (c==SoftTrennAdd || c==SoftTrennK || c==SoftTrenn) { nc=GetNextChar(TBuf,Index); c0=c; @@ -511,9 +507,9 @@ UCHAR GetTextChar(UCHAR* TBuf, USHORT& Index, -UCHAR GetTextCharConv(UCHAR* TBuf, USHORT& Index, +UCHAR GetTextCharConv(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& AktAtr, - USHORT Rest, BOOL ScanEsc) + sal_uInt16 Rest, sal_Bool ScanEsc) { UCHAR c; @@ -534,23 +530,23 @@ UCHAR GetTextCharConv(UCHAR* TBuf, USHORT& Index, // // Benoetigter Zeilenabstand in SGF-Units. ChrVPos wird beruecksichtigt. // ====================================================================== -USHORT GetLineFeed(UCHAR* TBuf, USHORT Index, ObjTextType Atr0, ObjTextType AktAtr, - USHORT nChar, USHORT& LF, USHORT& MaxGrad) +sal_uInt16 GetLineFeed(UCHAR* TBuf, sal_uInt16 Index, ObjTextType Atr0, ObjTextType AktAtr, + sal_uInt16 nChar, sal_uInt16& LF, sal_uInt16& MaxGrad) { UCHAR c=0; - BOOL AbsEnd=FALSE; - ULONG LF100=0; - ULONG MaxLF100=0; - BOOL LFauto=0; - BOOL First=TRUE; - USHORT Grad; - USHORT i=0; - USHORT r=1; + sal_Bool AbsEnd=sal_False; + sal_uLong LF100=0; + sal_uLong MaxLF100=0; + sal_Bool LFauto=0; + sal_Bool First=sal_True; + sal_uInt16 Grad; + sal_uInt16 i=0; + sal_uInt16 r=1; MaxGrad=0; while (!AbsEnd && nChar>0) { nChar--; - c=GetTextChar(TBuf,Index,Atr0,AktAtr,nChar,FALSE); + c=GetTextChar(TBuf,Index,Atr0,AktAtr,nChar,sal_False); i++; AbsEnd=(c==TextEnd || c==AbsatzEnd); if (First || (!AbsEnd && c!=' ' && c!=HardTrenn)) { @@ -562,15 +558,15 @@ USHORT GetLineFeed(UCHAR* TBuf, USHORT Index, ObjTextType Atr0, ObjTextType AktA Grad=AktAtr.Grad; if (AktAtr.ChrVPos>0) Grad=Grad-AktAtr.ChrVPos; if (Grad>MaxGrad) MaxGrad=Grad; - First=FALSE; + First=sal_False; } if (!AbsEnd && c!=' ') r=i; } MaxGrad=hPoint2Sgf(MaxGrad); if (MaxLF100<=4000) { // sonst Overflowgefahr - LF=USHORT(hPoint2Sgf(short(MaxLF100)) /100); + LF=sal_uInt16(hPoint2Sgf(short(MaxLF100)) /100); } else { - LF=USHORT(hPoint2Sgf(short(MaxLF100) /100)); + LF=sal_uInt16(hPoint2Sgf(short(MaxLF100) /100)); } return r; @@ -592,17 +588,17 @@ USHORT GetLineFeed(UCHAR* TBuf, USHORT Index, ObjTextType Atr0, ObjTextType AktA #define SuperSubFact 60 /* SuperScript/SubScript: 60% vom Schriftgrad */ #define DefaultSpace 40 /* Default: Space ist 40% vom SchriftGrad */ -USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dreh, - USHORT FitXMul, USHORT FitXDiv, USHORT FitYMul, USHORT FitYDiv) +sal_uInt16 SetTextContext(OutputDevice& rOut, ObjTextType& Atr, sal_Bool Kapt, sal_uInt16 Dreh, + sal_uInt16 FitXMul, sal_uInt16 FitXDiv, sal_uInt16 FitYMul, sal_uInt16 FitYDiv) { SgfFontOne* pSgfFont; // Font aus dem IniFile Font aFont; Color aColor; - ULONG Grad; - ULONG Brei; + sal_uLong Grad; + sal_uLong Brei; String FNam; - USHORT StdBrei=50; // Durchschnittliche Zeichenbreite in % von Schriftgrad - BOOL bFit=(FitXMul!=1 || FitXDiv!=1 || FitYMul!=1 || FitYDiv!=1); + sal_uInt16 StdBrei=50; // Durchschnittliche Zeichenbreite in % von Schriftgrad + sal_Bool bFit=(FitXMul!=1 || FitXDiv!=1 || FitYMul!=1 || FitYDiv!=1); pSgfFont = pSgfFonts->GetFontDesc(Atr.GetFont()); @@ -621,7 +617,7 @@ USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dr switch (Atr.GetFont()) { case 92500: case 92501: case 92504: case 92505: { -#if defined(WIN) || defined(WNT) || defined(PM2) +#if defined(WNT) || defined(PM2) FNam=String::CreateFromAscii( "Times New Roman" ); // CG Times ist unter Windows und OS/2 Times New Roman #else FNam=String::CreateFromAscii( "Times" ); // ansonsten ist das einfach Times @@ -630,7 +626,7 @@ USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dr aFont.SetFamily(FAMILY_ROMAN); } break; case 94021: case 94022: case 94023: case 94024: { -#if defined(WIN) || defined(WNT) +#if defined(WNT) FNam=String::CreateFromAscii( "Arial", 5 ); // Univers ist unter Windows Arial #else FNam=String::CreateFromAscii( "Helvetica" ); // und ansonsten Helvetica @@ -639,7 +635,7 @@ USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dr StdBrei=47; } break; case 93950: case 93951: case 93952: case 93953: { -#if defined(WIN) || defined(WNT) +#if defined(WNT) FNam=String::CreateFromAscii( "Courier New" ); // Der Vector-Courierfont unter Windows heisst Courier New #else FNam=String::CreateFromAscii( "Courier" ); // ansonsten ist und bleibt Courier immer Courier @@ -653,25 +649,25 @@ USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dr //aFont.SetCharSet(CHARSET_SYSTEM); } - Grad=ULONG(Atr.Grad); - if ((Atr.Schnitt & TextKaptBit) !=0 && Kapt) Grad=Grad*ULONG(Atr.Kapit)/100; + Grad=sal_uLong(Atr.Grad); + if ((Atr.Schnitt & TextKaptBit) !=0 && Kapt) Grad=Grad*sal_uLong(Atr.Kapit)/100; if ((Atr.Schnitt & TextSupSBit) !=0 || (Atr.Schnitt & TextSubSBit) !=0) Grad=Grad*SuperSubFact/100; Brei=Grad; if (Atr.Breite!=100 || bFit) { if (bFit) { - Grad=Grad*ULONG(FitYMul)/ULONG(FitYDiv); - Brei=Brei*ULONG(FitXMul)/ULONG(FitXDiv); + Grad=Grad*sal_uLong(FitYMul)/sal_uLong(FitYDiv); + Brei=Brei*sal_uLong(FitXMul)/sal_uLong(FitXDiv); } - Brei=Brei*ULONG(Atr.Breite)/100; - Brei=Brei*ULONG(StdBrei)/100; - aFont.SetSize(Size(hPoint2Sgf(USHORT(Brei)),hPoint2Sgf(USHORT(Grad)))); + Brei=Brei*sal_uLong(Atr.Breite)/100; + Brei=Brei*sal_uLong(StdBrei)/100; + aFont.SetSize(Size(hPoint2Sgf(sal_uInt16(Brei)),hPoint2Sgf(sal_uInt16(Grad)))); } else { - aFont.SetSize(Size(0,hPoint2Sgf(USHORT(Grad)))); + aFont.SetSize(Size(0,hPoint2Sgf(sal_uInt16(Grad)))); } aColor=Sgv2SvFarbe(Atr.L.LFarbe,Atr.L.LBFarbe,Atr.L.LIntens); aFont.SetColor(aColor); aColor=Sgv2SvFarbe(Atr.F.FFarbe,Atr.F.FBFarbe,Atr.F.FIntens); aFont.SetFillColor(aColor); - aFont.SetTransparent(TRUE); + aFont.SetTransparent(sal_True); aFont.SetAlign(ALIGN_BASELINE); Dreh/=10; Dreh=3600-Dreh; if (Dreh==3600) Dreh=0; @@ -683,11 +679,11 @@ USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dr if ((Atr.Schnitt & TextDbUnBit) !=0) aFont.SetUnderline(UNDERLINE_DOUBLE); if ((Atr.Schnitt & TextStrkBit) !=0) aFont.SetStrikeout(STRIKEOUT_SINGLE); if ((Atr.Schnitt & TextDbStBit) !=0) aFont.SetStrikeout(STRIKEOUT_DOUBLE); - if ((Atr.Schnitt & TextSh2DBit) !=0) aFont.SetShadow(TRUE); - if ((Atr.Schnitt & TextSh3DBit) !=0) aFont.SetShadow(TRUE); - if ((Atr.Schnitt & TextSh4DBit) !=0) aFont.SetShadow(TRUE); - if ((Atr.Schnitt & TextShEbBit) !=0) aFont.SetShadow(TRUE); - if (CheckTextOutl(Atr.F,Atr.L)) aFont.SetOutline(TRUE); + if ((Atr.Schnitt & TextSh2DBit) !=0) aFont.SetShadow(sal_True); + if ((Atr.Schnitt & TextSh3DBit) !=0) aFont.SetShadow(sal_True); + if ((Atr.Schnitt & TextSh4DBit) !=0) aFont.SetShadow(sal_True); + if ((Atr.Schnitt & TextShEbBit) !=0) aFont.SetShadow(sal_True); + if (CheckTextOutl(Atr.F,Atr.L)) aFont.SetOutline(sal_True); if (aFont!=rOut.GetFont()) rOut.SetFont(aFont); @@ -706,26 +702,26 @@ USHORT SetTextContext(OutputDevice& rOut, ObjTextType& Atr, BOOL Kapt, USHORT Dr // Absatz.Pas struct ProcChrSta { - USHORT Index; - USHORT ChrXP; + sal_uInt16 Index; + sal_uInt16 ChrXP; UCHAR OutCh; - BOOL Kapt; + sal_Bool Kapt; ObjTextType Attrib; }; -void InitProcessCharState(ProcChrSta& State, ObjTextType& AktAtr, USHORT IndexA) +void InitProcessCharState(ProcChrSta& State, ObjTextType& AktAtr, sal_uInt16 IndexA) { State.Attrib=AktAtr; State.OutCh=0; State.Index=IndexA; State.ChrXP=0; - State.Kapt=FALSE; + State.Kapt=sal_False; } -BOOL UpcasePossible(UCHAR c) +sal_Bool UpcasePossible(UCHAR c) { - if ((c>='a' && c<='z') || c == 0xe4 || c == 0xf6 || c == 0xfc ) return TRUE; - else return FALSE; + if ((c>='a' && c<='z') || c == 0xe4 || c == 0xf6 || c == 0xfc ) return sal_True; + else return sal_False; } UCHAR Upcase(UCHAR c) @@ -737,15 +733,15 @@ UCHAR Upcase(UCHAR c) return c; } -USHORT GetCharWidth(OutputDevice& rOut, UCHAR c) +sal_uInt16 GetCharWidth(OutputDevice& rOut, UCHAR c) { UCHAR c1; - USHORT ChrWidth; + sal_uInt16 ChrWidth; c1 = ByteString::Convert((char)c,RTL_TEXTENCODING_IBM_437, gsl_getSystemTextEncoding() ); if (c==' ') { - ChrWidth=(USHORT)rOut.GetTextWidth( String('A') ); + ChrWidth=(sal_uInt16)rOut.GetTextWidth( String('A') ); if (rOut.GetFont().GetPitch()!=PITCH_FIXED) { ChrWidth=MulDiv(ChrWidth,DefaultSpace,100); } @@ -755,30 +751,30 @@ USHORT GetCharWidth(OutputDevice& rOut, UCHAR c) OSL_ENSURE( MaxChar == 255, "MaxChar not 255" ); if (c>=MinChar /*&& c<=MaxChar*/) { - ChrWidth=(USHORT)rOut.GetTextWidth(String((char)c1)); + ChrWidth=(sal_uInt16)rOut.GetTextWidth(String((char)c1)); } else { - ChrWidth=(USHORT)rOut.GetTextWidth(String('A')); + ChrWidth=(sal_uInt16)rOut.GetTextWidth(String('A')); } } return ChrWidth; } UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& Atr0, - USHORT& nChars, USHORT Rest, + sal_uInt16& nChars, sal_uInt16 Rest, short* Line, UCHAR* cLine) { - USHORT KernDist=0; // Wert fuer Kerning - USHORT ChrWidth; + sal_uInt16 KernDist=0; // Wert fuer Kerning + sal_uInt16 ChrWidth; UCHAR c; UCHAR c1; - BOOL AbsEnd; + sal_Bool AbsEnd; - c=GetTextChar(TBuf,R.Index,Atr0,R.Attrib,Rest,FALSE); // versucht evtl. zu trennen, wenn Rest entsprechenden Wert besitzt + c=GetTextChar(TBuf,R.Index,Atr0,R.Attrib,Rest,sal_False); // versucht evtl. zu trennen, wenn Rest entsprechenden Wert besitzt AbsEnd=(c==AbsatzEnd || c==TextEnd); - if (AbsEnd==FALSE) { + if (AbsEnd==sal_False) { R.OutCh=ConvertTextChar(c); // von HardTrenn nach '-', ... R.Kapt=(R.Attrib.Schnitt & TextKaptBit) !=0 && UpcasePossible(R.OutCh); if (R.Kapt) R.OutCh=Upcase(R.OutCh); @@ -788,9 +784,9 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A ChrWidth=GetCharWidth(rOut,c1); if (R.Attrib.ZAbst!=100) { // Spezial-Zeichenabstand ? - ULONG Temp; - Temp=ULONG(ChrWidth)*ULONG(R.Attrib.ZAbst)/100; - ChrWidth=USHORT(Temp); + sal_uLong Temp; + Temp=sal_uLong(ChrWidth)*sal_uLong(R.Attrib.ZAbst)/100; + ChrWidth=sal_uInt16(Temp); } nChars++; if (R.ChrXP>32000) R.ChrXP=32000; @@ -801,44 +797,44 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A return c; } -void FormatLine(UCHAR* TBuf, USHORT& Index, ObjTextType& Atr0, ObjTextType& AktAtr, - USHORT UmbWdt, USHORT AdjWdt, - short* Line, USHORT& nChars, +void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& AktAtr, + sal_uInt16 UmbWdt, sal_uInt16 AdjWdt, + short* Line, sal_uInt16& nChars, double, double, - UCHAR* cLine, BOOL TextFit) + UCHAR* cLine, sal_Bool TextFit) { VirtualDevice vOut; UCHAR c,c0; UCHAR ct; - BOOL First; // erster Char ? - BYTE Just = 0; // Absatzformatierung - BOOL Border; // Rand der Box erreicht ? - BOOL Border0; - BOOL AbsEnd; // Ende des Absatzes erreicht ? + sal_Bool First; // erster Char ? + sal_uInt8 Just = 0; // Absatzformatierung + sal_Bool Border; // Rand der Box erreicht ? + sal_Bool Border0; + sal_Bool AbsEnd; // Ende des Absatzes erreicht ? ProcChrSta* R=new ProcChrSta; ProcChrSta* R0=new ProcChrSta; ProcChrSta* WErec=new ProcChrSta; - USHORT WEnChar; + sal_uInt16 WEnChar; ProcChrSta* WErec0=new ProcChrSta; - USHORT WEnChar0; + sal_uInt16 WEnChar0; ProcChrSta* TRrec=new ProcChrSta; - USHORT TRnChar; + sal_uInt16 TRnChar; - USHORT WordEndCnt; // Justieren und Trennen - BOOL WordEnd; - BOOL Trenn; + sal_uInt16 WordEndCnt; // Justieren und Trennen + sal_Bool WordEnd; + sal_Bool Trenn; short BoxRest; // zum Quetschen und formatieren - USHORT i,j,k,h; - USHORT re,li; + sal_uInt16 i,j,k,h; + sal_uInt16 re,li; vOut.SetMapMode(MapMode(MAP_10TH_MM,Point(),Fraction(1,4),Fraction(1,4))); nChars=0; - SetTextContext(vOut,AktAtr,FALSE,0,1,1,1,1); + SetTextContext(vOut,AktAtr,sal_False,0,1,1,1,1); InitProcessCharState(*R,AktAtr,Index); - (*R0)=(*R); (*WErec)=(*R); WEnChar=0; c0=0; Border0=FALSE; - Border=FALSE; First=TRUE; + (*R0)=(*R); (*WErec)=(*R); WEnChar=0; c0=0; Border0=sal_False; + Border=sal_False; First=sal_True; WordEndCnt=0; do { // mal schauen, wieviele Worte so in die Zeile passen @@ -866,16 +862,16 @@ void FormatLine(UCHAR* TBuf, USHORT& Index, ObjTextType& Atr0, ObjTextType& AktA } (*R0)=(*R); c0=c; Border0=Border; - First=FALSE; + First=sal_False; AbsEnd=AbsEnd || (nChars>=MaxLineChars); } while (!(AbsEnd || (Border && ((WordEndCnt>0) || WordEnd || Trenn)))); if (Border) { // Trennen und Quetschen (*WErec0)=(*WErec); WEnChar0=WEnChar; - AbsEnd=FALSE; c0=0; + AbsEnd=sal_False; c0=0; (*R)=(*WErec); nChars=WEnChar; (*TRrec)=(*R); TRnChar=nChars; - Border0=FALSE; Border=FALSE; + Border0=sal_False; Border=sal_False; do { // erst mal gucken wieviele Silben noch reinpassen ct=ProcessChar(vOut,TBuf,*TRrec,Atr0,TRnChar,DoTrenn,Line,cLine); c=ProcessChar(vOut,TBuf,*R,Atr0,nChars,NoTrenn,Line,cLine); @@ -922,7 +918,7 @@ void FormatLine(UCHAR* TBuf, USHORT& Index, ObjTextType& Atr0, ObjTextType& AktA if (!AbsEnd) { do { // Leerzeichen weglesen (*WErec)=(*R); - c=GetTextChar(TBuf,R->Index,Atr0,R->Attrib,NoTrenn,FALSE); + c=GetTextChar(TBuf,R->Index,Atr0,R->Attrib,NoTrenn,sal_False); nChars++; Line[nChars]=R->ChrXP; cLine[nChars]=c; @@ -938,7 +934,7 @@ void FormatLine(UCHAR* TBuf, USHORT& Index, ObjTextType& Atr0, ObjTextType& AktA nChars++; Line[nChars]=R->ChrXP; // Damit AbsatzEnde auch weggelesen wird Line[nChars+1]=R->ChrXP; // denn die Breite von CR oder #0 ist nun mal sehr klein if (TBuf[R->Index-1]!=AbsatzEnd && TBuf[R->Index-1]!=TextEnd) { - c=GetTextChar(TBuf,R->Index,Atr0,R->Attrib,NoTrenn,FALSE); // Kleine Korrektur. Notig, wenn nur 1 Wort in + c=GetTextChar(TBuf,R->Index,Atr0,R->Attrib,NoTrenn,sal_False); // Kleine Korrektur. Notig, wenn nur 1 Wort in } } @@ -1022,8 +1018,8 @@ void FormatLine(UCHAR* TBuf, USHORT& Index, ObjTextType& Atr0, ObjTextType& AktA ///////////////////////////////////////////////////////////////////////////////// // DrawText.Pas -void DrawChar(OutputDevice& rOut, UCHAR c, ObjTextType T, PointType Pos, USHORT DrehWink, - USHORT FitXMul, USHORT FitXDiv, USHORT FitYMul, USHORT FitYDiv) +void DrawChar(OutputDevice& rOut, UCHAR c, ObjTextType T, PointType Pos, sal_uInt16 DrehWink, + sal_uInt16 FitXMul, sal_uInt16 FitXDiv, sal_uInt16 FitYMul, sal_uInt16 FitYDiv) { SetTextContext(rOut,T,UpcasePossible(c),DrehWink,FitXMul,FitXDiv,FitYMul,FitYDiv); if ((T.Schnitt & TextKaptBit)!=0 && UpcasePossible(c)) c=Upcase(c); @@ -1041,32 +1037,32 @@ void TextType::Draw(OutputDevice& rOut) if ((Flags & TextOutlBit)!=0) return; // Sourcetext fuer Outliner !! ObjTextType T1,T2; - USHORT Index1; - USHORT Index2; + sal_uInt16 Index1; + sal_uInt16 Index2; UCHAR c = TextEnd; - USHORT l; // Anzahl der Zeichen in der Zeile - USHORT i; + sal_uInt16 l; // Anzahl der Zeichen in der Zeile + sal_uInt16 i; short yPos0; short xPos; short yPos; - USHORT LF; - USHORT MaxGrad; + sal_uInt16 LF; + sal_uInt16 MaxGrad; short xSize; short xSAdj; short ySize; double sn,cs; - USHORT TopToBase; - BOOL Ende = 0; - USHORT lc; - BOOL LineFit; // FitSize.x=0? oder Flags -> jede Zeile stretchen - BOOL TextFit; + sal_uInt16 TopToBase; + sal_Bool Ende = 0; + sal_uInt16 lc; + sal_Bool LineFit; // FitSize.x=0? oder Flags -> jede Zeile stretchen + sal_Bool TextFit; short* xLine; UCHAR* cLine; // Buffer fuer FormatLine - USHORT FitXMul; - USHORT FitXDiv; - USHORT FitYMul; - USHORT FitYDiv; - BOOL Fehler; + sal_uInt16 FitXMul; + sal_uInt16 FitXDiv; + sal_uInt16 FitYMul; + sal_uInt16 FitYDiv; + sal_Bool Fehler; UCHAR* Buf=Buffer; // Zeiger auf die Buchstaben pSgfFonts->ReadList(); @@ -1074,9 +1070,9 @@ void TextType::Draw(OutputDevice& rOut) cLine=new UCHAR[CharLineSize]; TextFit=(Flags & TextFitBits)!=0; - LineFit=FALSE; + LineFit=sal_False; LineFit=((Flags & TextFitZBit)!=0); - if (TextFit && FitSize.x==0) LineFit=TRUE; + if (TextFit && FitSize.x==0) LineFit=sal_True; if (DrehWink==0) { sn=0.0; @@ -1091,9 +1087,9 @@ void TextType::Draw(OutputDevice& rOut) ySize=Pos2.y-Pos1.y; xSize=32000 /2; // Umbruch xSAdj=Pos2.x-Pos1.x; // zum Ausrichten bei Zentriert/Blocksatz - //if (xSize<=0) { xSize=32000 /2; LineFit=TRUE; } - FitXMul=sal::static_int_cast< USHORT >(abs(Pos2.x-Pos1.x)); FitXDiv=FitSize.x; if (FitXDiv==0) FitXDiv=1; - FitYMul=sal::static_int_cast< USHORT >(abs(Pos2.y-Pos1.y)); FitYDiv=FitSize.y; if (FitYDiv==0) FitYDiv=1; + //if (xSize<=0) { xSize=32000 /2; LineFit=sal_True; } + FitXMul=sal::static_int_cast< sal_uInt16 >(abs(Pos2.x-Pos1.x)); FitXDiv=FitSize.x; if (FitXDiv==0) FitXDiv=1; + FitYMul=sal::static_int_cast< sal_uInt16 >(abs(Pos2.y-Pos1.y)); FitYDiv=FitSize.y; if (FitYDiv==0) FitYDiv=1; } else { xSize=Pos2.x-Pos1.x; xSAdj=xSize; @@ -1132,7 +1128,7 @@ void TextType::Draw(OutputDevice& rOut) T2=T1; Index2=Index1; i=1; while (i<=l) { - c=GetTextCharConv(Buf,Index2,T,T2,l-i,FALSE); + c=GetTextCharConv(Buf,Index2,T,T2,l-i,sal_False); long xp1,yp1; // wegen Overflowgefahr PointType Pos; xp1=long(Pos1.x)+xPos+long(xLine[i]); @@ -1164,27 +1160,27 @@ void TextType::Draw(OutputDevice& rOut) // (DEC Alpha hat naemlich 64Bit-Pointer!) //UCHAR* TextType::GetBufPtr() //{ -// ULONG Temp; -// Temp=ULONG(BufLo)+0x00010000*ULONG(BufHi); +// sal_uLong Temp; +// Temp=sal_uLong(BufLo)+0x00010000*sal_uLong(BufHi); // return (UCHAR*)Temp; //} // //void TextType::SetBufPtr(UCHAR* Ptr) //{ -// ULONG Temp=(ULONG)Ptr; -// BufLo=USHORT(Temp & 0x0000FFFF); -// BufHi=USHORT((Temp & 0xFFFF0000)>>16); +// sal_uLong Temp=(sal_uLong)Ptr; +// BufLo=sal_uInt16(Temp & 0x0000FFFF); +// BufHi=sal_uInt16((Temp & 0xFFFF0000)>>16); //} -UINT32 ObjTextType::GetFont() +sal_uInt32 ObjTextType::GetFont() { - return ULONG(FontLo)+0x00010000*ULONG(FontHi); + return sal_uLong(FontLo)+0x00010000*sal_uLong(FontHi); } -void ObjTextType::SetFont(UINT32 FontID) +void ObjTextType::SetFont(sal_uInt32 FontID) { - FontLo=USHORT(FontID & 0x0000FFFF); - FontHi=USHORT((FontID & 0xFFFF0000)>>16); + FontLo=sal_uInt16(FontID & 0x0000FFFF); + FontHi=sal_uInt16((FontID & 0xFFFF0000)>>16); } @@ -1195,11 +1191,11 @@ SgfFontOne::SgfFontOne() { Next=NULL; IFID=0; - Bold=FALSE; - Ital=FALSE; - Sans=FALSE; - Serf=FALSE; - Fixd=FALSE; + Bold=sal_False; + Ital=sal_False; + Sans=sal_False; + Serf=sal_False; + Fixd=sal_False; SVFamil=FAMILY_DONTKNOW; SVChSet=RTL_TEXTENCODING_DONTKNOW; SVWidth=40; @@ -1207,7 +1203,7 @@ SgfFontOne::SgfFontOne() void SgfFontOne::ReadOne( ByteString& ID, ByteString& Dsc ) { - USHORT i,j,n; + sal_uInt16 i,j,n; ByteString s; if ( Dsc.Len() < 4 || ( Dsc.GetChar( 0 ) != '(' ) ) @@ -1229,7 +1225,7 @@ void SgfFontOne::ReadOne( ByteString& ID, ByteString& Dsc ) SVFName=String(Dsc,i+1,j); // SV-Fontname rausholen Dsc.Erase(i,j); - IFID = (UINT32)ID.ToInt32(); + IFID = (sal_uInt32)ID.ToInt32(); n=Dsc.GetTokenCount(' '); for (i=0;i<n;i++) { @@ -1237,11 +1233,11 @@ void SgfFontOne::ReadOne( ByteString& ID, ByteString& Dsc ) if ( s.Len() ) { s.ToUpperAscii(); - if ( s.CompareTo( "BOLD", 4 ) == COMPARE_EQUAL ) Bold=TRUE; - else if ( s.CompareTo( "ITAL", 4 ) == COMPARE_EQUAL ) Ital=TRUE; - else if ( s.CompareTo( "SERF", 4 ) == COMPARE_EQUAL ) Serf=TRUE; - else if ( s.CompareTo( "SANS", 4 ) == COMPARE_EQUAL ) Sans=TRUE; - else if ( s.CompareTo( "FIXD", 4 ) == COMPARE_EQUAL ) Fixd=TRUE; + if ( s.CompareTo( "BOLD", 4 ) == COMPARE_EQUAL ) Bold=sal_True; + else if ( s.CompareTo( "ITAL", 4 ) == COMPARE_EQUAL ) Ital=sal_True; + else if ( s.CompareTo( "SERF", 4 ) == COMPARE_EQUAL ) Serf=sal_True; + else if ( s.CompareTo( "SANS", 4 ) == COMPARE_EQUAL ) Sans=sal_True; + else if ( s.CompareTo( "FIXD", 4 ) == COMPARE_EQUAL ) Fixd=sal_True; else if ( s.CompareTo( "ROMAN", 5 ) == COMPARE_EQUAL ) SVFamil=FAMILY_ROMAN; else if ( s.CompareTo( "SWISS", 5 ) == COMPARE_EQUAL ) SVFamil=FAMILY_SWISS; else if ( s.CompareTo( "MODERN", 6 ) == COMPARE_EQUAL ) SVFamil=FAMILY_MODERN; @@ -1252,7 +1248,7 @@ void SgfFontOne::ReadOne( ByteString& ID, ByteString& Dsc ) else if ( s.CompareTo( "MAC", 3 ) == COMPARE_EQUAL ) SVChSet=RTL_TEXTENCODING_APPLE_ROMAN; else if ( s.CompareTo( "SYMBOL", 6 ) == COMPARE_EQUAL ) SVChSet=RTL_TEXTENCODING_SYMBOL; else if ( s.CompareTo( "SYSTEM", 6 ) == COMPARE_EQUAL ) SVChSet = gsl_getSystemTextEncoding(); - else if ( s.IsNumericAscii() ) SVWidth=sal::static_int_cast< USHORT >(s.ToInt32()); + else if ( s.IsNumericAscii() ) SVWidth=sal::static_int_cast< sal_uInt16 >(s.ToInt32()); } } } @@ -1265,7 +1261,7 @@ SgfFontLst::SgfFontLst() Last=NULL; LastID=0; LastLn=NULL; - Tried=FALSE; + Tried=sal_False; } SgfFontLst::~SgfFontLst() @@ -1285,7 +1281,7 @@ void SgfFontLst::RausList() } pList=NULL; Last=NULL; - Tried=FALSE; + Tried=sal_False; LastID=0; LastLn=NULL; } @@ -1296,14 +1292,14 @@ void SgfFontLst::AssignFN(const String& rFName) void SgfFontLst::ReadList() { if (!Tried) { - Tried=TRUE; + Tried=sal_True; LastID=0; LastLn=NULL; SgfFontOne* P,P1; Config aCfg(FNam); aCfg.SetGroup("SGV Fonts fuer StarView"); - USHORT Anz=aCfg.GetKeyCount(); - USHORT i; + sal_uInt16 Anz=aCfg.GetKeyCount(); + sal_uInt16 i; ByteString FID,Dsc; for (i=0;i<Anz;i++) @@ -1321,7 +1317,7 @@ void SgfFontLst::ReadList() } } -SgfFontOne* SgfFontLst::GetFontDesc(UINT32 ID) +SgfFontOne* SgfFontLst::GetFontDesc(sal_uInt32 ID) { if (ID!=LastID) { SgfFontOne* P; diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc deleted file mode 100644 index 0eea67fb2338..000000000000 --- a/svtools/source/filter.vcl/filter/strings.hrc +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include <svtools/svtools.hrc> diff --git a/svtools/source/filter.vcl/filter/strings.src b/svtools/source/filter.vcl/filter/strings.src deleted file mode 100644 index 3087a70f1316..000000000000 --- a/svtools/source/filter.vcl/filter/strings.src +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "strings.hrc" - -String EXPORT_DIALOG_TITLE -{ - Text [ en-US ] = " Options" ; -}; - -String KEY_MODE -{ - Text = "ExportMode" ; -}; - -String KEY_RES -{ - Text = "Resolution" ; -}; - -String KEY_SIZE -{ - Text = "Size" ; -}; - -String KEY_COLORS -{ - Text = "Color" ; -}; - -String KEY_RLE_CODING -{ - Text = "RLE_Coding" ; -}; diff --git a/svtools/source/filter.vcl/igif/decode.cxx b/svtools/source/filter.vcl/igif/decode.cxx index d40cfab7cc50..03a69414cd4b 100644 --- a/svtools/source/filter.vcl/igif/decode.cxx +++ b/svtools/source/filter.vcl/igif/decode.cxx @@ -37,19 +37,19 @@ struct GIFLZWTableEntry { GIFLZWTableEntry* pPrev; GIFLZWTableEntry* pFirst; - BYTE nData; + sal_uInt8 nData; }; // ------------------------------------------------------------------------ -GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) : +GIFLZWDecompressor::GIFLZWDecompressor( sal_uInt8 cDataSize ) : nInputBitsBuf ( 0 ), nOutBufDataLen ( 0 ), nInputBitsBufSize ( 0 ), - bEOIFound ( FALSE ), + bEOIFound ( sal_False ), nDataSize ( cDataSize ) { - pOutBuf = new BYTE[ 4096 ]; + pOutBuf = new sal_uInt8[ 4096 ]; nClearCode = 1 << nDataSize; nEOICode = nClearCode + 1; @@ -60,11 +60,11 @@ GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) : pTable = new GIFLZWTableEntry[ 4098 ]; - for( USHORT i = 0; i < nTableSize; i++ ) + for( sal_uInt16 i = 0; i < nTableSize; i++ ) { pTable[i].pPrev = NULL; pTable[i].pFirst = pTable + i; - pTable[i].nData = (BYTE) i; + pTable[i].nData = (sal_uInt8) i; } } @@ -78,11 +78,11 @@ GIFLZWDecompressor::~GIFLZWDecompressor() // ------------------------------------------------------------------------ -HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, BYTE cBufSize, - ULONG& rCount, BOOL& rEOI ) +HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, + sal_uLong& rCount, sal_Bool& rEOI ) { - ULONG nTargetSize = 4096; - ULONG nCount = 0; + sal_uLong nTargetSize = 4096; + sal_uLong nCount = 0; HPBYTE pTarget = (HPBYTE) rtl_allocateMemory( nTargetSize ); HPBYTE pTmpTarget = pTarget; @@ -96,8 +96,8 @@ HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, BYTE cBufSize, if( nCount > nTargetSize ) { - ULONG nNewSize = nTargetSize << 1; - ULONG nOffset = pTmpTarget - pTarget; + sal_uLong nNewSize = nTargetSize << 1; + sal_uLong nOffset = pTmpTarget - pTarget; HPBYTE pTmp = (HPBYTE) rtl_allocateMemory( nNewSize ); memcpy( pTmp, pTarget, nTargetSize ); @@ -124,7 +124,7 @@ HPBYTE GIFLZWDecompressor::DecompressBlock( HPBYTE pSrc, BYTE cBufSize, // ------------------------------------------------------------------------ -void GIFLZWDecompressor::AddToTable( USHORT nPrevCode, USHORT nCodeFirstData ) +void GIFLZWDecompressor::AddToTable( sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData ) { GIFLZWTableEntry* pE; @@ -136,37 +136,37 @@ void GIFLZWDecompressor::AddToTable( USHORT nPrevCode, USHORT nCodeFirstData ) pE->nData = pTable[ nCodeFirstData ].pFirst->nData; nTableSize++; - if ( ( nTableSize == (USHORT) (1 << nCodeSize) ) && ( nTableSize < 4096 ) ) + if ( ( nTableSize == (sal_uInt16) (1 << nCodeSize) ) && ( nTableSize < 4096 ) ) nCodeSize++; } } // ------------------------------------------------------------------------ -BOOL GIFLZWDecompressor::ProcessOneCode() +sal_Bool GIFLZWDecompressor::ProcessOneCode() { GIFLZWTableEntry* pE; - USHORT nCode; - BOOL bRet = FALSE; - BOOL bEndOfBlock = FALSE; + sal_uInt16 nCode; + sal_Bool bRet = sal_False; + sal_Bool bEndOfBlock = sal_False; while( nInputBitsBufSize < nCodeSize ) { if( nBlockBufPos >= nBlockBufSize ) { - bEndOfBlock = TRUE; + bEndOfBlock = sal_True; break; } - nInputBitsBuf |= ( (ULONG) pBlockBuf[ nBlockBufPos++ ] ) << nInputBitsBufSize; + nInputBitsBuf |= ( (sal_uLong) pBlockBuf[ nBlockBufPos++ ] ) << nInputBitsBufSize; nInputBitsBufSize += 8; } if ( !bEndOfBlock ) { // Einen Code aus dem Eingabe-Buffer holen: - nCode = sal::static_int_cast< USHORT >( - ( (USHORT) nInputBitsBuf ) & ( ~( 0xffff << nCodeSize ) )); + nCode = sal::static_int_cast< sal_uInt16 >( + ( (sal_uInt16) nInputBitsBuf ) & ( ~( 0xffff << nCodeSize ) )); nInputBitsBuf >>= nCodeSize; nInputBitsBufSize = nInputBitsBufSize - nCodeSize; @@ -192,9 +192,9 @@ BOOL GIFLZWDecompressor::ProcessOneCode() nOutBufDataLen = 0; } else - bEOIFound = TRUE; + bEOIFound = sal_True; - return TRUE; + return sal_True; } nOldCode = nCode; @@ -209,7 +209,7 @@ BOOL GIFLZWDecompressor::ProcessOneCode() } while( pE ); - bRet = TRUE; + bRet = sal_True; } return bRet; diff --git a/svtools/source/filter.vcl/igif/decode.hxx b/svtools/source/filter.vcl/igif/decode.hxx index 5bce26b724f1..3dd6328839d9 100644 --- a/svtools/source/filter.vcl/igif/decode.hxx +++ b/svtools/source/filter.vcl/igif/decode.hxx @@ -39,29 +39,29 @@ class GIFLZWDecompressor HPBYTE pOutBuf; HPBYTE pOutBufData; HPBYTE pBlockBuf; - ULONG nInputBitsBuf; - USHORT nTableSize; - USHORT nClearCode; - USHORT nEOICode; - USHORT nCodeSize; - USHORT nOldCode; - USHORT nOutBufDataLen; - USHORT nInputBitsBufSize; - BOOL bEOIFound; - BYTE nDataSize; - BYTE nBlockBufSize; - BYTE nBlockBufPos; + sal_uLong nInputBitsBuf; + sal_uInt16 nTableSize; + sal_uInt16 nClearCode; + sal_uInt16 nEOICode; + sal_uInt16 nCodeSize; + sal_uInt16 nOldCode; + sal_uInt16 nOutBufDataLen; + sal_uInt16 nInputBitsBufSize; + sal_Bool bEOIFound; + sal_uInt8 nDataSize; + sal_uInt8 nBlockBufSize; + sal_uInt8 nBlockBufPos; - void AddToTable(USHORT nPrevCode, USHORT nCodeFirstData); - BOOL ProcessOneCode(); + void AddToTable(sal_uInt16 nPrevCode, sal_uInt16 nCodeFirstData); + sal_Bool ProcessOneCode(); public: - GIFLZWDecompressor( BYTE cDataSize ); + GIFLZWDecompressor( sal_uInt8 cDataSize ); ~GIFLZWDecompressor(); - HPBYTE DecompressBlock( HPBYTE pSrc, BYTE cBufSize, ULONG& rCount, BOOL& rEOI ); + HPBYTE DecompressBlock( HPBYTE pSrc, sal_uInt8 cBufSize, sal_uLong& rCount, sal_Bool& rEOI ); }; #endif diff --git a/svtools/source/filter.vcl/igif/gifread.cxx b/svtools/source/filter.vcl/igif/gifread.cxx index 62d1413e145f..8de8c6c01148 100644 --- a/svtools/source/filter.vcl/igif/gifread.cxx +++ b/svtools/source/filter.vcl/igif/gifread.cxx @@ -55,11 +55,11 @@ GIFReader::GIFReader( SvStream& rStm ) : nLogHeight100 ( 0UL ), nLoops ( 1 ), eActAction ( GLOBAL_HEADER_READING ), - bGCTransparent ( FALSE ), - bImGraphicReady ( FALSE ) + bGCTransparent ( sal_False ), + bImGraphicReady ( sal_False ) { maUpperName = UniString::CreateFromAscii( "SVIGIF", 6 ); - pSrcBuf = new BYTE[ 256 ]; + pSrcBuf = new sal_uInt8[ 256 ]; ClearImageExtensions(); } @@ -83,14 +83,14 @@ GIFReader::~GIFReader() void GIFReader::ClearImageExtensions() { nGCDisposalMethod = 0; - bGCTransparent = FALSE; + bGCTransparent = sal_False; nTimer = 0; } // ------------------------------------------------------------------------ -BOOL GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, - BOOL bWatchForBackgroundColor ) +sal_Bool GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, + sal_Bool bWatchForBackgroundColor ) { const Size aSize( nWidth, nHeight ); @@ -107,11 +107,11 @@ BOOL GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, if( pAcc1 ) { - cTransIndex1 = (BYTE) pAcc1->GetBestPaletteIndex( aWhite ); + cTransIndex1 = (sal_uInt8) pAcc1->GetBestPaletteIndex( aWhite ); cNonTransIndex1 = cTransIndex1 ? 0 : 1; } else - bStatus = FALSE; + bStatus = sal_False; } if( bStatus ) @@ -132,12 +132,12 @@ BOOL GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, // ------------------------------------------------------------------------ -BOOL GIFReader::ReadGlobalHeader() +sal_Bool GIFReader::ReadGlobalHeader() { char pBuf[ 7 ]; - BYTE nRF; - BYTE nAspect; - BOOL bRet = FALSE; + sal_uInt8 nRF; + sal_uInt8 nAspect; + sal_Bool bRet = sal_False; rIStm.Read( pBuf, 6 ); if( NO_PENDING( rIStm ) ) @@ -150,14 +150,14 @@ BOOL GIFReader::ReadGlobalHeader() { SvMemoryStream aMemStm; - aMemStm.SetBuffer( pBuf, 7, FALSE, 7 ); + aMemStm.SetBuffer( pBuf, 7, sal_False, 7 ); aMemStm >> nGlobalWidth; aMemStm >> nGlobalHeight; aMemStm >> nRF; aMemStm >> nBackgroundColor; aMemStm >> nAspect; - bGlobalPalette = (BOOL) ( nRF & 0x80 ); + bGlobalPalette = (sal_Bool) ( nRF & 0x80 ); if( bGlobalPalette ) ReadPaletteEntries( &aGPalette, 1 << ( ( nRF & 7 ) + 1 ) ); @@ -165,11 +165,11 @@ BOOL GIFReader::ReadGlobalHeader() nBackgroundColor = 0; if( NO_PENDING( rIStm ) ) - bRet = TRUE; + bRet = sal_True; } } else - bStatus = FALSE; + bStatus = sal_False; } return bRet; @@ -177,19 +177,19 @@ BOOL GIFReader::ReadGlobalHeader() // ------------------------------------------------------------------------ -void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount ) +void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, sal_uLong nCount ) { - const ULONG nLen = 3UL * nCount; - BYTE* pBuf = new BYTE[ nLen ]; + const sal_uLong nLen = 3UL * nCount; + sal_uInt8* pBuf = new sal_uInt8[ nLen ]; rIStm.Read( pBuf, nLen ); if( NO_PENDING( rIStm ) ) { - BYTE* pTmp = pBuf; + sal_uInt8* pTmp = pBuf; - for( ULONG i = 0UL; i < nCount; ) + for( sal_uLong i = 0UL; i < nCount; ) { - BitmapColor& rColor = (*pPal)[ (USHORT) i++ ]; + BitmapColor& rColor = (*pPal)[ (sal_uInt16) i++ ]; rColor.SetRed( *pTmp++ ); rColor.SetGreen( *pTmp++ ); @@ -211,13 +211,13 @@ void GIFReader::ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount ) // ------------------------------------------------------------------------ -BOOL GIFReader::ReadExtension() +sal_Bool GIFReader::ReadExtension() { - BYTE cFunction; - BYTE cSize; - BYTE cByte; - BOOL bRet = FALSE; - BOOL bOverreadDataBlocks = FALSE; + sal_uInt8 cFunction; + sal_uInt8 cSize; + sal_uInt8 cByte; + sal_Bool bRet = sal_False; + sal_Bool bOverreadDataBlocks = sal_False; // Extension-Label rIStm >> cFunction; @@ -231,7 +231,7 @@ BOOL GIFReader::ReadExtension() // 'Graphic Control Extension' case( 0xf9 ) : { - BYTE cFlags; + sal_uInt8 cFlags; rIStm >> cFlags; rIStm >> nTimer; @@ -241,9 +241,9 @@ BOOL GIFReader::ReadExtension() if ( NO_PENDING( rIStm ) ) { nGCDisposalMethod = ( cFlags >> 2) & 7; - bGCTransparent = ( cFlags & 1 ) ? TRUE : FALSE; + bGCTransparent = ( cFlags & 1 ) ? sal_True : sal_False; bStatus = ( cSize == 4 ) && ( cByte == 0 ); - bRet = TRUE; + bRet = sal_True; } } break; @@ -254,7 +254,7 @@ BOOL GIFReader::ReadExtension() if ( NO_PENDING( rIStm ) ) { // default diese Extension ueberlesen - bOverreadDataBlocks = TRUE; + bOverreadDataBlocks = sal_True; // Appl.-Extension hat Laenge 11 if ( cSize == 0x0b ) @@ -277,12 +277,12 @@ BOOL GIFReader::ReadExtension() rIStm >> cByte; nLoops = cByte; rIStm >> cByte; - nLoops |= ( (USHORT) cByte << 8 ); + nLoops |= ( (sal_uInt16) cByte << 8 ); rIStm >> cByte; bStatus = ( cByte == 0 ); bRet = NO_PENDING( rIStm ); - bOverreadDataBlocks = FALSE; + bOverreadDataBlocks = sal_False; // Netscape interpretiert den LoopCount // als reine Anzahl der _Wiederholungen_; @@ -305,7 +305,7 @@ BOOL GIFReader::ReadExtension() rIStm >> cByte; bStatus = ( cByte == 0 ); bRet = NO_PENDING( rIStm ); - bOverreadDataBlocks = FALSE; + bOverreadDataBlocks = sal_False; } else rIStm.SeekRel( -1 ); @@ -318,25 +318,25 @@ BOOL GIFReader::ReadExtension() // alles andere ueberlesen default: - bOverreadDataBlocks = TRUE; + bOverreadDataBlocks = sal_True; break; } // Sub-Blocks ueberlesen if ( bOverreadDataBlocks ) { - bRet = TRUE; + bRet = sal_True; while( cSize && bStatus && !rIStm.IsEof() ) { - USHORT nCount = (USHORT) cSize + 1; + sal_uInt16 nCount = (sal_uInt16) cSize + 1; char* pBuffer = new char[ nCount ]; - bRet = FALSE; + bRet = sal_False; rIStm.Read( pBuffer, nCount ); if( NO_PENDING( rIStm ) ) { - cSize = (BYTE) pBuffer[ cSize ]; - bRet = TRUE; + cSize = (sal_uInt8) pBuffer[ cSize ]; + bRet = sal_True; } else cSize = 0; @@ -351,19 +351,19 @@ BOOL GIFReader::ReadExtension() // ------------------------------------------------------------------------ -BOOL GIFReader::ReadLocalHeader() +sal_Bool GIFReader::ReadLocalHeader() { - BYTE pBuf[ 9 ]; - BOOL bRet = FALSE; + sal_uInt8 pBuf[ 9 ]; + sal_Bool bRet = sal_False; rIStm.Read( pBuf, 9 ); if( NO_PENDING( rIStm ) ) { SvMemoryStream aMemStm; BitmapPalette* pPal; - BYTE nFlags; + sal_uInt8 nFlags; - aMemStm.SetBuffer( (char*) pBuf, 9, FALSE, 9 ); + aMemStm.SetBuffer( (char*) pBuf, 9, sal_False, 9 ); aMemStm >> nImagePosX; aMemStm >> nImagePosY; aMemStm >> nImageWidth; @@ -391,7 +391,7 @@ BOOL GIFReader::ReadLocalHeader() if( NO_PENDING( rIStm ) ) { CreateBitmaps( nImageWidth, nImageHeight, pPal, bGlobalPalette && ( pPal == &aGPalette ) ); - bRet = TRUE; + bRet = sal_True; } } @@ -400,11 +400,11 @@ BOOL GIFReader::ReadLocalHeader() // ------------------------------------------------------------------------ -ULONG GIFReader::ReadNextBlock() +sal_uLong GIFReader::ReadNextBlock() { - ULONG nRet = 0UL; - ULONG nRead; - BYTE cBlockSize; + sal_uLong nRet = 0UL; + sal_uLong nRead; + sal_uInt8 cBlockSize; rIStm >> cBlockSize; @@ -424,7 +424,7 @@ ULONG GIFReader::ReadNextBlock() nRet = 3UL; else { - BOOL bEOI; + sal_Bool bEOI; HPBYTE pTarget = pDecomp->DecompressBlock( pSrcBuf, cBlockSize, nRead, bEOI ); nRet = ( bEOI ? 3 : 1 ); @@ -443,9 +443,9 @@ ULONG GIFReader::ReadNextBlock() // ------------------------------------------------------------------------ -void GIFReader::FillImages( HPBYTE pBytes, ULONG nCount ) +void GIFReader::FillImages( HPBYTE pBytes, sal_uLong nCount ) { - for( ULONG i = 0UL; i < nCount; i++ ) + for( sal_uLong i = 0UL; i < nCount; i++ ) { if( nImageX >= nImageWidth ) { @@ -464,9 +464,9 @@ void GIFReader::FillImages( HPBYTE pBytes, ULONG nCount ) if( ( nMinY > nLastImageY ) && ( nLastImageY < ( nImageHeight - 1 ) ) ) { HPBYTE pScanline8 = pAcc8->GetScanline( nYAcc ); - ULONG nSize8 = pAcc8->GetScanlineSize(); + sal_uLong nSize8 = pAcc8->GetScanlineSize(); HPBYTE pScanline1 = 0; - ULONG nSize1 = 0; + sal_uLong nSize1 = 0; if( bGCTransparent ) { @@ -508,7 +508,7 @@ void GIFReader::FillImages( HPBYTE pBytes, ULONG nCount ) } } - nLastImageY = (USHORT) nT1; + nLastImageY = (sal_uInt16) nT1; nYAcc = nT1; } else @@ -523,7 +523,7 @@ void GIFReader::FillImages( HPBYTE pBytes, ULONG nCount ) if( nImageY < nImageHeight ) { - const BYTE cTmp = pBytes[ i ]; + const sal_uInt8 cTmp = pBytes[ i ]; if( bGCTransparent ) { @@ -540,7 +540,7 @@ void GIFReader::FillImages( HPBYTE pBytes, ULONG nCount ) } else { - bOverreadBlock = TRUE; + bOverreadBlock = sal_True; break; } } @@ -567,7 +567,7 @@ void GIFReader::CreateNewBitmaps() aAnimBmp.aPosPix = Point( nImagePosX, nImagePosY ); aAnimBmp.aSizePix = Size( nImageWidth, nImageHeight ); aAnimBmp.nWait = ( nTimer != 65535 ) ? nTimer : ANIMATION_TIMEOUT_ON_CLICK; - aAnimBmp.bUserInput = FALSE; + aAnimBmp.bUserInput = sal_False; if( nGCDisposalMethod == 2 ) aAnimBmp.eDisposal = DISPOSE_BACK; @@ -618,10 +618,10 @@ const Graphic& GIFReader::GetIntermediateGraphic() // ------------------------------------------------------------------------ -BOOL GIFReader::ProcessGIF() +sal_Bool GIFReader::ProcessGIF() { - BOOL bRead = FALSE; - BOOL bEnd = FALSE; + sal_Bool bRead = sal_False; + sal_Bool bEnd = sal_False; if ( !bStatus ) eActAction = ABORT_READING; @@ -634,7 +634,7 @@ BOOL GIFReader::ProcessGIF() // naechsten Marker lesen case( MARKER_READING ): { - BYTE cByte; + sal_uInt8 cByte; rIStm >> cByte; @@ -642,7 +642,7 @@ BOOL GIFReader::ProcessGIF() eActAction = END_READING; else if( NO_PENDING( rIStm ) ) { - bRead = TRUE; + bRead = sal_True; if( cByte == '!' ) eActAction = EXTENSION_READING; @@ -659,7 +659,7 @@ BOOL GIFReader::ProcessGIF() // ScreenDescriptor lesen case( GLOBAL_HEADER_READING ): { - if( ( bRead = ReadGlobalHeader() ) == TRUE ) + if( ( bRead = ReadGlobalHeader() ) == sal_True ) { ClearImageExtensions(); eActAction = MARKER_READING; @@ -671,7 +671,7 @@ BOOL GIFReader::ProcessGIF() // Extension lesen case( EXTENSION_READING ): { - if( ( bRead = ReadExtension() ) == TRUE ) + if( ( bRead = ReadExtension() ) == sal_True ) eActAction = MARKER_READING; } break; @@ -680,7 +680,7 @@ BOOL GIFReader::ProcessGIF() // Image-Descriptor lesen case( LOCAL_HEADER_READING ): { - if( ( bRead = ReadLocalHeader() ) == TRUE ) + if( ( bRead = ReadLocalHeader() ) == sal_True ) { nYAcc = nImageX = nImageY = 0; eActAction = FIRST_BLOCK_READING; @@ -692,20 +692,20 @@ BOOL GIFReader::ProcessGIF() // ersten Datenblock lesen case( FIRST_BLOCK_READING ): { - BYTE cDataSize; + sal_uInt8 cDataSize; rIStm >> cDataSize; if( rIStm.IsEof() ) eActAction = ABORT_READING; else if( cDataSize > 12 ) - bStatus = FALSE; + bStatus = sal_False; else if( NO_PENDING( rIStm ) ) { - bRead = TRUE; + bRead = sal_True; pDecomp = new GIFLZWDecompressor( cDataSize ); eActAction = NEXT_BLOCK_READING; - bOverreadBlock = FALSE; + bOverreadBlock = sal_False; } else eActAction = FIRST_BLOCK_READING; @@ -715,20 +715,20 @@ BOOL GIFReader::ProcessGIF() // naechsten Datenblock lesen case( NEXT_BLOCK_READING ): { - USHORT nLastX = nImageX; - USHORT nLastY = nImageY; - ULONG nRet = ReadNextBlock(); + sal_uInt16 nLastX = nImageX; + sal_uInt16 nLastY = nImageY; + sal_uLong nRet = ReadNextBlock(); // Return: 0:Pending / 1:OK; / 2:OK und letzter Block: / 3:EOI / 4:HardAbort if( nRet ) { - bRead = TRUE; + bRead = sal_True; if ( nRet == 1UL ) { - bImGraphicReady = TRUE; + bImGraphicReady = sal_True; eActAction = NEXT_BLOCK_READING; - bOverreadBlock = FALSE; + bOverreadBlock = sal_False; } else { @@ -742,7 +742,7 @@ BOOL GIFReader::ProcessGIF() else if( nRet == 3UL ) { eActAction = NEXT_BLOCK_READING; - bOverreadBlock = TRUE; + bOverreadBlock = sal_True; } else { @@ -764,7 +764,7 @@ BOOL GIFReader::ProcessGIF() // ein Fehler trat auf case( ABORT_READING ): { - bEnd = TRUE; + bEnd = sal_True; eActAction = END_READING; } break; @@ -788,7 +788,7 @@ ReadState GIFReader::ReadGIF( Graphic& rGraphic ) { ReadState eReadState; - bStatus = TRUE; + bStatus = sal_True; while( ProcessGIF() && ( eActAction != END_READING ) ) {} @@ -825,12 +825,12 @@ ReadState GIFReader::ReadGIF( Graphic& rGraphic ) // - ImportGIF - // ------------- -BOOL ImportGIF( SvStream & rStm, Graphic& rGraphic ) +sal_Bool ImportGIF( SvStream & rStm, Graphic& rGraphic ) { GIFReader* pGIFReader = (GIFReader*) rGraphic.GetContext(); - USHORT nOldFormat = rStm.GetNumberFormatInt(); + sal_uInt16 nOldFormat = rStm.GetNumberFormatInt(); ReadState eReadState; - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; rStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); @@ -842,7 +842,7 @@ BOOL ImportGIF( SvStream & rStm, Graphic& rGraphic ) if( eReadState == GIFREAD_ERROR ) { - bRet = FALSE; + bRet = sal_False; delete pGIFReader; } else if( eReadState == GIFREAD_OK ) diff --git a/svtools/source/filter.vcl/igif/makefile.mk b/svtools/source/filter.vcl/igif/makefile.mk deleted file mode 100644 index 0821591e0178..000000000000 --- a/svtools/source/filter.vcl/igif/makefile.mk +++ /dev/null @@ -1,45 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=svtools -TARGET=igif - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk -SOLARINC+=-I../../inc - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/gifread.obj \ - $(SLO)$/decode.obj - -.INCLUDE : target.mk - diff --git a/svtools/source/filter.vcl/ixbm/makefile.mk b/svtools/source/filter.vcl/ixbm/makefile.mk deleted file mode 100644 index 55708d2f2630..000000000000 --- a/svtools/source/filter.vcl/ixbm/makefile.mk +++ /dev/null @@ -1,44 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=svtools -TARGET=ixbm - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk -SOLARINC+=-I../../inc - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/xbmread.obj - -.INCLUDE : target.mk - diff --git a/svtools/source/filter.vcl/ixbm/xbmread.cxx b/svtools/source/filter.vcl/ixbm/xbmread.cxx index 6adb1e4a621b..0870eecb7187 100644 --- a/svtools/source/filter.vcl/ixbm/xbmread.cxx +++ b/svtools/source/filter.vcl/ixbm/xbmread.cxx @@ -45,7 +45,7 @@ XBMReader::XBMReader( SvStream& rStm ) : nLastPos ( rStm.Tell() ), nWidth ( 0 ), nHeight ( 0 ), - bStatus ( TRUE ) + bStatus ( sal_True ) { pHexTable = new short[ 256 ]; maUpperName = String::CreateFromAscii( "SVIXBM", 6 ); @@ -110,7 +110,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1, long nPos2; long nPos3; - bStatus = FALSE; + bStatus = sal_False; do { @@ -121,23 +121,23 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1, { if( ( nPos1 = aRet.Search( pTok1 ) ) != STRING_NOTFOUND ) { - bStatus = TRUE; + bStatus = sal_True; if( pTok2 ) { - bStatus = FALSE; + bStatus = sal_False; if( ( ( nPos2 = aRet.Search( pTok2 ) ) != STRING_NOTFOUND ) && ( nPos2 > nPos1 ) ) { - bStatus = TRUE; + bStatus = sal_True; if( pTok3 ) { - bStatus = FALSE; + bStatus = sal_False; if( ( ( nPos3 = aRet.Search( pTok3 ) ) != STRING_NOTFOUND ) && ( nPos3 > nPos2 ) ) - bStatus = TRUE; + bStatus = sal_True; } } } @@ -200,16 +200,16 @@ long XBMReader::ParseDefine( const sal_Char* pDefine ) // ------------------------------------------------------------------------ -BOOL XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat ) +sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat ) { ByteString aLine; long nRow = 0; long nCol = 0; long nBits = ( eFormat == XBM10 ) ? 16 : 8; long nBit; - USHORT nValue; - USHORT nDigits; - BOOL bFirstLine = TRUE; + sal_uInt16 nValue; + sal_uInt16 nDigits; + sal_Bool bFirstLine = sal_True; while( nRow < nHeight ) { @@ -221,20 +221,20 @@ BOOL XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFor if( (nPos = ( aLine = aLastLine ).Search( '{' ) ) != STRING_NOTFOUND ) aLine.Erase( 0, nPos + 1 ); - bFirstLine = FALSE; + bFirstLine = sal_False; } else if( !pInStm->ReadLine( aLine ) ) break; if( aLine.Len() ) { - const USHORT nCount = aLine.GetTokenCount( ',' ); + const sal_uInt16 nCount = aLine.GetTokenCount( ',' ); - for( USHORT i = 0; ( i < nCount ) && ( nRow < nHeight ); i++ ) + for( sal_uInt16 i = 0; ( i < nCount ) && ( nRow < nHeight ); i++ ) { const ByteString aToken( aLine.GetToken( i, ',' ) ); const xub_StrLen nLen = aToken.Len(); - BOOL bProcessed = FALSE; + sal_Bool bProcessed = sal_False; nBit = nDigits = nValue = 0; @@ -247,11 +247,11 @@ BOOL XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFor { nValue = ( nValue << 4 ) + nTable; nDigits++; - bProcessed = TRUE; + bProcessed = sal_True; } else if( ( nTable < 0 ) && nDigits ) { - bProcessed = TRUE; + bProcessed = sal_True; break; } } @@ -268,7 +268,7 @@ BOOL XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFor } } - return TRUE; + return sal_True; } // ------------------------------------------------------------------------ @@ -276,7 +276,7 @@ BOOL XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFor ReadState XBMReader::ReadXBM( Graphic& rGraphic ) { ReadState eReadState; - BYTE cDummy; + sal_uInt8 cDummy; // sehen, ob wir _alles_ lesen koennen rIStm.Seek( STREAM_SEEK_TO_END ); @@ -289,7 +289,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) ByteString aLine; rIStm.Seek( nLastPos ); - bStatus = FALSE; + bStatus = sal_False; aLine = FindTokenLine( &rIStm, "#define", "_width" ); if ( bStatus ) @@ -309,7 +309,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) } } else - bStatus = FALSE; + bStatus = sal_False; if ( bStatus ) { @@ -327,7 +327,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) else if ( aLine.Search( "char" ) != STRING_NOTFOUND ) eFormat = XBM11; else - bStatus = FALSE; + bStatus = sal_False; if ( bStatus && nWidth && nHeight ) { @@ -341,7 +341,7 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) bStatus = ParseData( &rIStm, aLine, eFormat ); } else - bStatus = FALSE; + bStatus = sal_False; } } } @@ -373,11 +373,11 @@ ReadState XBMReader::ReadXBM( Graphic& rGraphic ) // - ImportXBM - // ------------- -BOOL ImportXBM( SvStream& rStm, Graphic& rGraphic ) +sal_Bool ImportXBM( SvStream& rStm, Graphic& rGraphic ) { XBMReader* pXBMReader = (XBMReader*) rGraphic.GetContext(); ReadState eReadState; - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( !pXBMReader ) pXBMReader = new XBMReader( rStm ); @@ -387,7 +387,7 @@ BOOL ImportXBM( SvStream& rStm, Graphic& rGraphic ) if( eReadState == XBMREAD_ERROR ) { - bRet = FALSE; + bRet = sal_False; delete pXBMReader; } else if( eReadState == XBMREAD_OK ) diff --git a/svtools/source/filter.vcl/ixpm/makefile.mk b/svtools/source/filter.vcl/ixpm/makefile.mk deleted file mode 100644 index 98f93290d325..000000000000 --- a/svtools/source/filter.vcl/ixpm/makefile.mk +++ /dev/null @@ -1,43 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=svtools -TARGET=ixpm - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk -SOLARINC+=-I../../inc - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/xpmread.obj - -.INCLUDE : target.mk diff --git a/svtools/source/filter.vcl/ixpm/rgbtable.hxx b/svtools/source/filter.vcl/ixpm/rgbtable.hxx index f3506a1d0465..738c3f33460c 100644 --- a/svtools/source/filter.vcl/ixpm/rgbtable.hxx +++ b/svtools/source/filter.vcl/ixpm/rgbtable.hxx @@ -29,9 +29,9 @@ struct XPMRGBTab { const char* name; - BYTE red; - BYTE green; - BYTE blue; + sal_uInt8 red; + sal_uInt8 green; + sal_uInt8 blue; }; static XPMRGBTab pRGBTable[] = { diff --git a/svtools/source/filter.vcl/ixpm/xpmread.cxx b/svtools/source/filter.vcl/ixpm/xpmread.cxx index e0bbad0f0ceb..c218cff1630f 100644 --- a/svtools/source/filter.vcl/ixpm/xpmread.cxx +++ b/svtools/source/filter.vcl/ixpm/xpmread.cxx @@ -48,8 +48,8 @@ XPMReader::XPMReader( SvStream& rStm ) : mnHeight ( 0 ), mnColors ( 0 ), mnCpp ( 0 ), - mbTransparent ( FALSE ), - mbStatus ( TRUE ), + mbTransparent ( sal_False ), + mbStatus ( sal_True ), mnStatus ( 0 ), mnIdentifier ( XPMIDENTIFIER ), mcThisByte ( 0 ), @@ -77,7 +77,7 @@ XPMReader::~XPMReader() ReadState XPMReader::ReadXPM( Graphic& rGraphic ) { ReadState eReadState; - BYTE cDummy; + sal_uInt8 cDummy; // sehen, ob wir _alles_ lesen koennen mrIStm.Seek( STREAM_SEEK_TO_END ); @@ -88,14 +88,14 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) if ( mrIStm.GetError() != ERRCODE_IO_PENDING ) { mrIStm.Seek( mnLastPos ); - mbStatus = TRUE; + mbStatus = sal_True; if ( mbStatus ) { - mpStringBuf = new BYTE [ XPMSTRINGBUF ]; - mpTempBuf = new BYTE [ XPMTEMPBUFSIZE ]; + mpStringBuf = new sal_uInt8 [ XPMSTRINGBUF ]; + mpTempBuf = new sal_uInt8 [ XPMTEMPBUFSIZE ]; - if ( ( mbStatus = ImplGetString() ) == TRUE ) + if ( ( mbStatus = ImplGetString() ) == sal_True ) { mnIdentifier = XPMVALUES; // Bitmap informationen einholen mnWidth = ImplGetULONG( 0 ); @@ -115,14 +115,14 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) // Farbe: ( mnCpp )Byte(s)-> ASCII Eintrag der der Farbe zugeordnet ist // 1 Byte -> 0xff wenn Farbe transparent ist // 3 Bytes -> RGB Wert der Farbe - mpColMap = new BYTE[ mnColors * ( 4 + mnCpp ) ]; + mpColMap = new sal_uInt8[ mnColors * ( 4 + mnCpp ) ]; if ( mpColMap ) { - for ( ULONG i = 0; i < mnColors; i++ ) + for ( sal_uLong i = 0; i < mnColors; i++ ) { - if ( ImplGetColor( i ) == FALSE ) + if ( ImplGetColor( i ) == sal_False ) { - mbStatus = FALSE; + mbStatus = sal_False; break; } } @@ -146,35 +146,35 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) maBmp = Bitmap( Size( mnWidth, mnHeight ), nBits ); mpAcc = maBmp.AcquireWriteAccess(); - // mbTransparent ist TRUE wenn mindestens eine Farbe Transparent ist + // mbTransparent ist sal_True wenn mindestens eine Farbe Transparent ist if ( mbTransparent ) { maMaskBmp = Bitmap( Size( mnWidth, mnHeight ), 1 ); if ( ( mpMaskAcc = maMaskBmp.AcquireWriteAccess() ) == NULL ) - mbStatus = FALSE; + mbStatus = sal_False; } if( mpAcc && mbStatus ) { - ULONG i; + sal_uLong i; if ( mnColors <=256 ) // palette is only needed by using less than 257 { // colors - BYTE* pPtr = &mpColMap[mnCpp]; + sal_uInt8* pPtr = &mpColMap[mnCpp]; for ( i = 0; i < mnColors; i++ ) { - mpAcc->SetPaletteColor( (BYTE)i, Color( pPtr[1], pPtr[2], pPtr[3] ) ); + mpAcc->SetPaletteColor( (sal_uInt8)i, Color( pPtr[1], pPtr[2], pPtr[3] ) ); pPtr += ( mnCpp + 4 ); } // using 2 charakters per pixel and less than 257 Colors we speed up if ( mnCpp == 2 ) // by using a 64kb indexing table { - mpFastColorTable = new BYTE[ 256 * 256 ]; + mpFastColorTable = new sal_uInt8[ 256 * 256 ]; for ( pPtr = mpColMap, i = 0; i < mnColors; i++, pPtr += mnCpp + 4 ) { - ULONG j = pPtr[ 0 ] << 8; + sal_uLong j = pPtr[ 0 ] << 8; j += pPtr[ 1 ]; - mpFastColorTable[ j ] = (BYTE)i; + mpFastColorTable[ j ] = (sal_uInt8)i; } } } @@ -182,9 +182,9 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) mnIdentifier = XPMPIXELS; for ( i = 0; i < mnHeight; i++ ) { - if ( ImplGetScanLine( i ) == FALSE ) + if ( ImplGetScanLine( i ) == sal_False ) { - mbStatus = FALSE; + mbStatus = sal_False; break; } } @@ -235,17 +235,17 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) // ------------------------------------------------------------------------ // ImplGetColor ermittelt saemtliche Farbwerte, -// die Rueckgabe ist TRUE wenn saemtliche Farben zugeordnet werden konnten +// die Rueckgabe ist sal_True wenn saemtliche Farben zugeordnet werden konnten -BOOL XPMReader::ImplGetColor( ULONG nNumb ) +sal_Bool XPMReader::ImplGetColor( sal_uLong nNumb ) { - BYTE* pString = mpStringBuf; - BYTE* pPtr = ( mpColMap + nNumb * ( 4 + mnCpp ) ); - BOOL bStatus = ImplGetString(); + sal_uInt8* pString = mpStringBuf; + sal_uInt8* pPtr = ( mpColMap + nNumb * ( 4 + mnCpp ) ); + sal_Bool bStatus = ImplGetString(); if ( bStatus ) { - for ( ULONG i = 0; i < mnCpp; i++ ) + for ( sal_uLong i = 0; i < mnCpp; i++ ) *pPtr++ = *pString++; bStatus = ImplGetColSub ( pPtr ); } @@ -256,11 +256,11 @@ BOOL XPMReader::ImplGetColor( ULONG nNumb ) // ImpGetScanLine liest den String mpBufSize aus und schreibt die Pixel in die // Bitmap. Der Parameter nY gibt die horizontale Position an. -BOOL XPMReader::ImplGetScanLine( ULONG nY ) +sal_Bool XPMReader::ImplGetScanLine( sal_uLong nY ) { - BOOL bStatus = ImplGetString(); - BYTE* pString = mpStringBuf; - BYTE* pColor; + sal_Bool bStatus = ImplGetString(); + sal_uInt8* pString = mpStringBuf; + sal_uInt8* pColor; BitmapColor aWhite; BitmapColor aBlack; @@ -272,18 +272,18 @@ BOOL XPMReader::ImplGetScanLine( ULONG nY ) aBlack = mpMaskAcc->GetBestMatchingColor( Color( COL_BLACK ) ); } if ( mnStringSize != ( mnWidth * mnCpp )) - bStatus = FALSE; + bStatus = sal_False; else { - ULONG i, j; + sal_uLong i, j; if ( mpFastColorTable ) { for ( i = 0; i < mnWidth; i++ ) { j = (*pString++) << 8; j += *pString++; - BYTE k = (BYTE)mpFastColorTable[ j ]; - mpAcc->SetPixel( nY, i, BitmapColor( (BYTE)k ) ); + sal_uInt8 k = (sal_uInt8)mpFastColorTable[ j ]; + mpAcc->SetPixel( nY, i, BitmapColor( (sal_uInt8)k ) ); if ( mpMaskAcc ) mpMaskAcc->SetPixel( nY, i, @@ -295,12 +295,12 @@ BOOL XPMReader::ImplGetScanLine( ULONG nY ) pColor = mpColMap; for ( j = 0; j < mnColors; j++ ) { - if ( ImplCompare( pString, pColor, mnCpp, XPMCASESENSITIVE ) == TRUE ) + if ( ImplCompare( pString, pColor, mnCpp, XPMCASESENSITIVE ) == sal_True ) { if ( mnColors > 256 ) mpAcc->SetPixel( nY, i, Color ( pColor[3], pColor[4], pColor[5] ) ); else - mpAcc->SetPixel( nY, i, BitmapColor( (BYTE) j ) ); + mpAcc->SetPixel( nY, i, BitmapColor( (sal_uInt8) j ) ); if ( mpMaskAcc ) mpMaskAcc->SetPixel( nY, i, ( @@ -323,11 +323,11 @@ BOOL XPMReader::ImplGetScanLine( ULONG nY ) // wurde eine Farbe gefunden wird an pDest[1]..pDest[2] der RGB wert geschrieben // pDest[0] enthaelt 0xff wenn die Farbe transparent ist sonst 0 -BOOL XPMReader::ImplGetColSub( BYTE* pDest ) +sal_Bool XPMReader::ImplGetColSub( sal_uInt8* pDest ) { unsigned char cTransparent[] = "None"; - BOOL bColStatus = FALSE; + sal_Bool bColStatus = sal_False; if ( ImplGetColKey( 'c' ) || ImplGetColKey( 'm' ) || ImplGetColKey( 'g' ) ) { @@ -335,7 +335,7 @@ BOOL XPMReader::ImplGetColSub( BYTE* pDest ) if ( *mpPara == '#' ) { *pDest++ = 0; - bColStatus = TRUE; + bColStatus = sal_True; switch ( mnParaSize ) { case 25 : @@ -348,7 +348,7 @@ BOOL XPMReader::ImplGetColSub( BYTE* pDest ) ImplGetRGBHex ( pDest, 0 ); break; default: - bColStatus = FALSE; + bColStatus = sal_False; break; } } @@ -356,14 +356,14 @@ BOOL XPMReader::ImplGetColSub( BYTE* pDest ) else if ( ImplCompare( &cTransparent[0], mpPara, 4 )) { *pDest++ = 0xff; - bColStatus = TRUE; - mbTransparent = TRUE; + bColStatus = sal_True; + mbTransparent = sal_True; } // last we will try to get the colorname else if ( mnParaSize > 2 ) // name must enlarge the minimum size { - ULONG i = 0; - while ( TRUE ) + sal_uLong i = 0; + while ( sal_True ) { if ( pRGBTable[ i ].name == NULL ) break; @@ -372,7 +372,7 @@ BOOL XPMReader::ImplGetColSub( BYTE* pDest ) if ( ImplCompare ( (unsigned char*)pRGBTable[ i ].name, mpPara, mnParaSize, XPMCASENONSENSITIVE ) ) { - bColStatus = TRUE; + bColStatus = sal_True; *pDest++ = 0; *pDest++ = pRGBTable[ i ].red; *pDest++ = pRGBTable[ i ].green; @@ -388,11 +388,11 @@ BOOL XPMReader::ImplGetColSub( BYTE* pDest ) // ------------------------------------------------------------------------ // ImplGetColKey durchsuch den String mpStringBuf nach einem Parameter 'nKey' -// und gibt einen BOOL zurueck. ( wenn TRUE werden mpPara und mnParaSize gesetzt ) +// und gibt einen sal_Bool zurueck. ( wenn sal_True werden mpPara und mnParaSize gesetzt ) -BOOL XPMReader::ImplGetColKey( BYTE nKey ) +sal_Bool XPMReader::ImplGetColKey( sal_uInt8 nKey ) { - BYTE nTemp, nPrev = ' '; + sal_uInt8 nTemp, nPrev = ' '; mpPara = mpStringBuf + mnCpp + 1; mnParaSize = 0; @@ -427,7 +427,7 @@ BOOL XPMReader::ImplGetColKey( BYTE nKey ) } } } - return ( mnParaSize ) ? TRUE : FALSE; + return ( mnParaSize ) ? sal_True : sal_False; } // ------------------------------------------------------------------------ @@ -439,12 +439,12 @@ BOOL XPMReader::ImplGetColKey( BYTE nKey ) // 6 : '#12345678abcdefab12345678' " " " " -void XPMReader::ImplGetRGBHex( BYTE* pDest,ULONG nAdd ) +void XPMReader::ImplGetRGBHex( sal_uInt8* pDest,sal_uLong nAdd ) { - BYTE* pPtr = mpPara+1; - BYTE nHex, nTemp; + sal_uInt8* pPtr = mpPara+1; + sal_uInt8 nHex, nTemp; - for ( ULONG i = 0; i < 3; i++ ) + for ( sal_uLong i = 0; i < 3; i++ ) { nHex = (*pPtr++) - '0'; if ( nHex > 9 ) @@ -456,24 +456,24 @@ void XPMReader::ImplGetRGBHex( BYTE* pDest,ULONG nAdd ) nHex = ( nHex << 4 ) + nTemp; pPtr += nAdd; - *pDest++ = (BYTE)nHex; + *pDest++ = (sal_uInt8)nHex; } } // ------------------------------------------------------------------------ // ImplGetUlong gibt den wert einer bis zu 6stelligen ASCII-Dezimalzahl zurueck. -ULONG XPMReader::ImplGetULONG( ULONG nPara ) +sal_uLong XPMReader::ImplGetULONG( sal_uLong nPara ) { if ( ImplGetPara ( nPara ) ) { - ULONG nRetValue = 0; - BYTE* pPtr = mpPara; + sal_uLong nRetValue = 0; + sal_uInt8* pPtr = mpPara; if ( ( mnParaSize > 6 ) || ( mnParaSize == 0 ) ) return 0; - for ( ULONG i = 0; i < mnParaSize; i++ ) + for ( sal_uLong i = 0; i < mnParaSize; i++ ) { - BYTE j = (*pPtr++) - 48; + sal_uInt8 j = (*pPtr++) - 48; if ( j > 9 ) return 0; // ascii is invalid nRetValue*=10; nRetValue+=j; @@ -485,28 +485,28 @@ ULONG XPMReader::ImplGetULONG( ULONG nPara ) // ------------------------------------------------------------------------ -BOOL XPMReader::ImplCompare( BYTE* pSource, BYTE* pDest, ULONG nSize, ULONG nMode ) +sal_Bool XPMReader::ImplCompare( sal_uInt8* pSource, sal_uInt8* pDest, sal_uLong nSize, sal_uLong nMode ) { - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if ( nMode == XPMCASENONSENSITIVE ) { - for ( ULONG i = 0; i < nSize; i++ ) + for ( sal_uLong i = 0; i < nSize; i++ ) { if ( ( pSource[i]&~0x20 ) != ( pDest[i]&~0x20 ) ) { - bRet = FALSE; + bRet = sal_False; break; } } } else { - for ( ULONG i = 0; i < nSize; i++ ) + for ( sal_uLong i = 0; i < nSize; i++ ) { if ( pSource[i] != pDest[i] ) { - bRet = FALSE; + bRet = sal_False; break; } } @@ -517,15 +517,15 @@ BOOL XPMReader::ImplCompare( BYTE* pSource, BYTE* pDest, ULONG nSize, ULONG nMod // ------------------------------------------------------------------------ // ImplGetPara versucht den nNumb ( 0...x ) Parameter aus mpStringBuf zu ermitteln. // Ein Parameter ist durch Spaces oder Tabs von den anderen getrennt. -// Konnte der Parameter gefunden werden ist der Rueckgabewert TRUE und mpPara + mnParaSize +// Konnte der Parameter gefunden werden ist der Rueckgabewert sal_True und mpPara + mnParaSize // werden gesetzt. -BOOL XPMReader::ImplGetPara ( ULONG nNumb ) +sal_Bool XPMReader::ImplGetPara ( sal_uLong nNumb ) { - BYTE nByte; - ULONG pSize = 0; - BYTE* pPtr = mpStringBuf; - ULONG nCount = 0; + sal_uInt8 nByte; + sal_uLong pSize = 0; + sal_uInt8* pPtr = mpStringBuf; + sal_uLong nCount = 0; if ( ( *pPtr != ' ' ) && ( *pPtr != 0x09 ) ) { @@ -567,7 +567,7 @@ BOOL XPMReader::ImplGetPara ( ULONG nNumb ) pSize++; pPtr++; } - return ( ( nCount == nNumb ) && ( mpPara ) ) ? TRUE : FALSE; + return ( ( nCount == nNumb ) && ( mpPara ) ) ? sal_True : sal_False; } // ------------------------------------------------------------------------ @@ -575,10 +575,10 @@ BOOL XPMReader::ImplGetPara ( ULONG nNumb ) // mnStringSize enthaelt die Groesse des gelesenen Strings. // Bemerkungen wie '//' und '/*.....*/' werden uebersprungen. -BOOL XPMReader::ImplGetString( void ) +sal_Bool XPMReader::ImplGetString( void ) { - BYTE sID[] = "/* XPM */"; - BYTE* pString = mpStringBuf; + sal_uInt8 sID[] = "/* XPM */"; + sal_uInt8* pString = mpStringBuf; mnStringSize = 0; mpStringBuf[0] = 0; @@ -597,13 +597,13 @@ BOOL XPMReader::ImplGetString( void ) { if ( mnTempAvail <= 50 ) { - mbStatus = FALSE; // file is too short to be a correct XPM format + mbStatus = sal_False; // file is too short to be a correct XPM format break; } for ( int i = 0; i < 9; i++ ) // searching for "/* XPM */" if ( *mpTempPtr++ != sID[i] ) { - mbStatus = FALSE; + mbStatus = sal_False; break; } mnTempAvail-=9; @@ -635,7 +635,7 @@ BOOL XPMReader::ImplGetString( void ) } if ( mnStringSize >= ( XPMSTRINGBUF - 1 ) ) { - mbStatus = FALSE; + mbStatus = sal_False; break; } *pString++ = mcThisByte; @@ -673,11 +673,11 @@ BOOL XPMReader::ImplGetString( void ) // - ImportXPM - // ------------- -BOOL ImportXPM( SvStream& rStm, Graphic& rGraphic ) +sal_Bool ImportXPM( SvStream& rStm, Graphic& rGraphic ) { XPMReader* pXPMReader = (XPMReader*) rGraphic.GetContext(); ReadState eReadState; - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( !pXPMReader ) pXPMReader = new XPMReader( rStm ); @@ -687,7 +687,7 @@ BOOL ImportXPM( SvStream& rStm, Graphic& rGraphic ) if( eReadState == XPMREAD_ERROR ) { - bRet = FALSE; + bRet = sal_False; delete pXPMReader; } else if( eReadState == XPMREAD_OK ) diff --git a/svtools/source/filter.vcl/jpeg/jpeg.cxx b/svtools/source/filter.vcl/jpeg/jpeg.cxx index 146beff287bc..609e4684513e 100644 --- a/svtools/source/filter.vcl/jpeg/jpeg.cxx +++ b/svtools/source/filter.vcl/jpeg/jpeg.cxx @@ -33,12 +33,10 @@ extern "C" { - #define INT32 JPEG_INT32 #include "stdio.h" #include "jpeg.h" #include "jpeglib.h" #include "jerror.h" - #undef INT32 } #define _JPEGPRIVATE @@ -126,7 +124,7 @@ extern "C" int empty_output_buffer (j_compress_ptr cinfo) dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = BUF_SIZE; - return TRUE; + return sal_True; } extern "C" void term_destination (j_compress_ptr cinfo) @@ -190,7 +188,7 @@ extern "C" void init_source (j_decompress_ptr cinfo) * but we don't clear the input buffer. * This is correct behavior for reading a series of images from one source. */ - src->start_of_file = TRUE; + src->start_of_file = sal_True; } long StreamRead( SvStream* pSvStm, void* pBuffer, long nBufferSize ) @@ -239,9 +237,9 @@ extern "C" int fill_input_buffer (j_decompress_ptr cinfo) src->pub.next_input_byte = src->buffer; src->pub.bytes_in_buffer = nbytes; - src->start_of_file = FALSE; + src->start_of_file = sal_False; - return TRUE; + return sal_True; } extern "C" void skip_input_data (j_decompress_ptr cinfo, long num_bytes) @@ -256,7 +254,7 @@ extern "C" void skip_input_data (j_decompress_ptr cinfo, long num_bytes) while (num_bytes > (long) src->pub.bytes_in_buffer) { num_bytes -= (long) src->pub.bytes_in_buffer; (void) fill_input_buffer(cinfo); - /* note we assume that fill_input_buffer will never return FALSE, + /* note we assume that fill_input_buffer will never return sal_False, * so suspension need not be handled. */ } @@ -351,9 +349,9 @@ void* JPEGReader::CreateBitmap( void* pParam ) { BitmapPalette aGrayPal( 256 ); - for( USHORT n = 0; n < 256; n++ ) + for( sal_uInt16 n = 0; n < 256; n++ ) { - const BYTE cGray = (BYTE) n; + const sal_uInt8 cGray = (sal_uInt8) n; aGrayPal[ n ] = BitmapColor( cGray, cGray, cGray ); } @@ -387,7 +385,7 @@ void* JPEGReader::CreateBitmap( void* pParam ) { long nAlignedWidth; - const ULONG nFormat = pAcc->GetScanlineFormat(); + const sal_uLong nFormat = pAcc->GetScanlineFormat(); if( ( bGray && ( BMP_FORMAT_8BIT_PAL == nFormat ) ) || @@ -401,7 +399,7 @@ void* JPEGReader::CreateBitmap( void* pParam ) else { nAlignedWidth = AlignedWidth4Bytes( aSize.Width() * ( bGray ? 8 : 24 ) ); - ((JPEGCreateBitmapParam*)pParam)->bTopDown = TRUE; + ((JPEGCreateBitmapParam*)pParam)->bTopDown = sal_True; pBmpBuf = pBuffer = rtl_allocateMemory( nAlignedWidth * aSize.Height() ); } ((JPEGCreateBitmapParam*)pParam)->nAlignedWidth = nAlignedWidth; @@ -426,9 +424,9 @@ void JPEGReader::FillBitmap() { BitmapColor* pCols = new BitmapColor[ 256 ]; - for( USHORT n = 0; n < 256; n++ ) + for( sal_uInt16 n = 0; n < 256; n++ ) { - const BYTE cGray = (BYTE) n; + const sal_uInt8 cGray = (sal_uInt8) n; pCols[ n ] = pAcc->GetBestMatchingColor( BitmapColor( cGray, cGray, cGray ) ); } @@ -436,7 +434,7 @@ void JPEGReader::FillBitmap() for( long nY = 0L; nY < nHeight; nY++ ) { - pTmp = (BYTE*) pBuffer + nY * nAlignedWidth; + pTmp = (sal_uInt8*) pBuffer + nY * nAlignedWidth; for( long nX = 0L; nX < nWidth; nX++ ) pAcc->SetPixel( nY, nX, pCols[ *pTmp++ ] ); @@ -450,7 +448,7 @@ void JPEGReader::FillBitmap() for( long nY = 0L; nY < nHeight; nY++ ) { - pTmp = (BYTE*) pBuffer + nY * nAlignedWidth; + pTmp = (sal_uInt8*) pBuffer + nY * nAlignedWidth; for( long nX = 0L; nX < nWidth; nX++ ) { @@ -516,8 +514,8 @@ ReadState JPEGReader::Read( Graphic& rGraphic ) long nEndPos; long nLines; ReadState eReadState; - BOOL bRet = FALSE; - BYTE cDummy; + sal_Bool bRet = sal_False; + sal_uInt8 cDummy; #if 1 // TODO: is it possible to get rid of this seek to the end? // check if the stream's end is already available @@ -563,10 +561,10 @@ ReadState JPEGReader::Read( Graphic& rGraphic ) else rGraphic = aBmp; - bRet = TRUE; + bRet = sal_True; } else if( rIStm.GetError() == ERRCODE_IO_PENDING ) - bRet = TRUE; + bRet = sal_True; // Status setzen ( Pending hat immer Vorrang ) if( rIStm.GetError() == ERRCODE_IO_PENDING ) @@ -630,13 +628,13 @@ void* JPEGWriter::GetScanline( long nY ) { BitmapColor aColor; long nWidth = pAcc->Width(); - BYTE* pTmp = pBuffer; + sal_uInt8* pTmp = pBuffer; if( pAcc->HasPalette() ) { for( long nX = 0L; nX < nWidth; nX++ ) { - aColor = pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( nY, nX ) ); + aColor = pAcc->GetPaletteColor( (sal_uInt8) pAcc->GetPixel( nY, nX ) ); *pTmp++ = aColor.GetRed(); if ( bGreys ) continue; @@ -666,9 +664,9 @@ void* JPEGWriter::GetScanline( long nY ) // ------------------------------------------------------------------------ -BOOL JPEGWriter::Write( const Graphic& rGraphic ) +sal_Bool JPEGWriter::Write( const Graphic& rGraphic ) { - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; if ( xStatusIndicator.is() ) { @@ -697,7 +695,7 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic ) BitmapColor aColor; for( long nX = 0L; bIsGrey && ( nX < nWidth ); nX++ ) { - aColor = pAcc->HasPalette() ? pAcc->GetPaletteColor( (BYTE) pAcc->GetPixel( nY, nX ) ) + aColor = pAcc->HasPalette() ? pAcc->GetPaletteColor( (sal_uInt8) pAcc->GetPixel( nY, nX ) ) : pAcc->GetPixel( nY, nX ); bIsGrey = ( aColor.GetRed() == aColor.GetGreen() ) && ( aColor.GetRed() == aColor.GetBlue() ); } @@ -714,11 +712,11 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic ) bNative = ( pAcc->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_RGB ); if( !bNative ) - pBuffer = new BYTE[ AlignedWidth4Bytes( bGreys ? pAcc->Width() * 8L : pAcc->Width() * 24L ) ]; + pBuffer = new sal_uInt8[ AlignedWidth4Bytes( bGreys ? pAcc->Width() * 8L : pAcc->Width() * 24L ) ]; JPEGCallbackStruct aCallbackData; aCallbackData.xStatusIndicator = xStatusIndicator; - bRet = (BOOL) WriteJPEG( this, &rOStm, pAcc->Width(), pAcc->Height(), bGreys, nQuality, &aCallbackData ); + bRet = (sal_Bool) WriteJPEG( this, &rOStm, pAcc->Width(), pAcc->Height(), bGreys, nQuality, &aCallbackData ); delete[] pBuffer; pBuffer = NULL; @@ -736,11 +734,11 @@ BOOL JPEGWriter::Write( const Graphic& rGraphic ) // - ImportJPEG - // -------------- -BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags ) +sal_Bool ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags ) { JPEGReader* pJPEGReader = (JPEGReader*) rGraphic.GetContext(); ReadState eReadState; - BOOL bRet = TRUE; + sal_Bool bRet = sal_True; if( !pJPEGReader ) pJPEGReader = new JPEGReader( rStm, pCallerData, ( nImportFlags & GRFILTER_I_FLAGS_SET_LOGSIZE_FOR_JPEG ) != 0 ); @@ -755,7 +753,7 @@ BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32 if( eReadState == JPEGREAD_ERROR ) { - bRet = FALSE; + bRet = sal_False; delete pJPEGReader; } else if( eReadState == JPEGREAD_OK ) @@ -770,7 +768,7 @@ BOOL ImportJPEG( SvStream& rStm, Graphic& rGraphic, void* pCallerData, sal_Int32 // - ExportJPEG - // -------------- -BOOL ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, +sal_Bool ExportJPEG( SvStream& rOStm, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData, bool* pExportWasGrey ) diff --git a/svtools/source/filter.vcl/jpeg/jpeg.h b/svtools/source/filter.vcl/jpeg/jpeg.h index c5284e968a8d..a77c335d4b66 100644 --- a/svtools/source/filter.vcl/jpeg/jpeg.h +++ b/svtools/source/filter.vcl/jpeg/jpeg.h @@ -51,12 +51,7 @@ struct JPEGCreateBitmapParam }; typedef struct my_error_mgr* my_error_ptr; -typedef unsigned char BYTE; -#ifdef WIN -typedef unsigned char _huge* HPBYTE; -#else typedef unsigned char* HPBYTE; -#endif void* JPEGMalloc( size_t size ); void JPEGFree( void *ptr ); diff --git a/svtools/source/filter.vcl/jpeg/jpegc.c b/svtools/source/filter.vcl/jpeg/jpegc.c index f94d7039920f..06c7d4f69964 100644 --- a/svtools/source/filter.vcl/jpeg/jpegc.c +++ b/svtools/source/filter.vcl/jpeg/jpegc.c @@ -101,13 +101,13 @@ void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines ) jpeg_create_decompress( &cinfo ); bDecompCreated = 1; jpeg_svstream_src( &cinfo, pIStm ); - jpeg_read_header( &cinfo, TRUE ); + jpeg_read_header( &cinfo, sal_True ); cinfo.scale_num = 1; cinfo.scale_denom = 1; cinfo.output_gamma = 1.0; - cinfo.raw_data_out = FALSE; - cinfo.quantize_colors = FALSE; + cinfo.raw_data_out = sal_False; + cinfo.quantize_colors = sal_False; if ( cinfo.jpeg_color_space == JCS_YCbCr ) cinfo.out_color_space = JCS_RGB; else if ( cinfo.jpeg_color_space == JCS_YCCK ) @@ -139,8 +139,8 @@ void ReadJPEG( void* pJPEGReader, void* pIStm, long* pLines ) if( cinfo.scale_denom > 1 ) { cinfo.dct_method = JDCT_FASTEST; - cinfo.do_fancy_upsampling = FALSE; - cinfo.do_block_smoothing = FALSE; + cinfo.do_fancy_upsampling = sal_False; + cinfo.do_block_smoothing = sal_False; } } @@ -254,12 +254,12 @@ long WriteJPEG( void* pJPEGWriter, void* pOStm, } jpeg_set_defaults( &cinfo ); - jpeg_set_quality( &cinfo, (int) nQualityPercent, FALSE ); + jpeg_set_quality( &cinfo, (int) nQualityPercent, sal_False ); if ( ( nWidth > 128 ) || ( nHeight > 128 ) ) jpeg_simple_progression( &cinfo ); - jpeg_start_compress( &cinfo, TRUE ); + jpeg_start_compress( &cinfo, sal_True ); for( nY = 0; nY < nHeight; nY++ ) { diff --git a/svtools/source/filter.vcl/jpeg/makefile.mk b/svtools/source/filter.vcl/jpeg/makefile.mk deleted file mode 100644 index 303398c5e0c9..000000000000 --- a/svtools/source/filter.vcl/jpeg/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=svtools -TARGET=jpeg - -# --- Settings ----------------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -SOLARINC+=-I../../inc - -# --- Files -------------------------------------------------------- - -SLOFILES= $(EXCEPTIONSFILES) \ - $(SLO)$/jpegc.obj - -EXCEPTIONSFILES= \ - $(SLO)$/jpeg.obj - -.INCLUDE : target.mk diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx index 7e10170ffd11..4c7f6b41911f 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.cxx +++ b/svtools/source/filter.vcl/wmf/emfwr.cxx @@ -169,17 +169,17 @@ // - EMFWriter - // ------------- -BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConfigItem ) +sal_Bool EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConfigItem ) { - const ULONG nHeaderPos = m_rStm.Tell(); + const sal_uLong nHeaderPos = m_rStm.Tell(); - mpHandlesUsed = new BOOL[ MAXHANDLES ]; - memset( mpHandlesUsed, 0, MAXHANDLES * sizeof( BOOL ) ); + mpHandlesUsed = new sal_Bool[ MAXHANDLES ]; + memset( mpHandlesUsed, 0, MAXHANDLES * sizeof( sal_Bool ) ); mnHorTextAlign = mnHandleCount = mnLastPercent = mnRecordPos = mnRecordCount = 0; mnLineHandle = mnFillHandle = mnTextHandle = HANDLE_INVALID; - mbRecordOpen = FALSE; + mbRecordOpen = sal_False; - maVDev.EnableOutput( FALSE ); + maVDev.EnableOutput( sal_False ); maVDev.SetMapMode( rMtf.GetPrefMapMode() ); mpFilterConfigItem = pFilterConfigItem; @@ -197,29 +197,29 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConf // set 100th mm map mode in EMF ImplBeginRecord( WIN_EMR_SETMAPMODE ); - m_rStm << (INT32) MM_ANISOTROPIC; + m_rStm << (sal_Int32) MM_ANISOTROPIC; ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETVIEWPORTEXTEX ); - m_rStm << (INT32) maVDev.ImplGetDPIX() << (INT32) maVDev.ImplGetDPIY(); + m_rStm << (sal_Int32) maVDev.ImplGetDPIX() << (sal_Int32) maVDev.ImplGetDPIY(); ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETWINDOWEXTEX ); - m_rStm << (INT32) 2540 << (INT32) 2540; + m_rStm << (sal_Int32) 2540 << (sal_Int32) 2540; ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETVIEWPORTORGEX ); - m_rStm << (INT32) 0 << (INT32) 0; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0; ImplEndRecord(); ImplBeginRecord( WIN_EMR_SETWINDOWORGEX ); - m_rStm << (INT32) 0 << (INT32) 0; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0; ImplEndRecord(); ImplWriteRasterOp( ROP_OVERPAINT ); ImplBeginRecord( WIN_EMR_SETBKMODE ); - m_rStm << (UINT32) 1; // TRANSPARENT + m_rStm << (sal_uInt32) 1; // TRANSPARENT ImplEndRecord(); // write emf data @@ -233,17 +233,17 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConf // write header - const ULONG nEndPos = m_rStm.Tell(); m_rStm.Seek( nHeaderPos ); - - m_rStm << (UINT32) 0x00000001 << (UINT32) 108 //use [MS-EMF 2.2.11] HeaderExtension2 Object - << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizePix.Width() - 1 ) << (INT32) ( aMtfSizePix.Height() - 1 ) - << (INT32) 0 << (INT32) 0 << (INT32) ( aMtfSizeLog.Width() - 1 ) << (INT32) ( aMtfSizeLog.Height() - 1 ) - << (UINT32) 0x464d4520 << (UINT32) 0x10000 << (UINT32) ( nEndPos - nHeaderPos ) - << (UINT32) mnRecordCount << (UINT16) ( mnHandleCount + 1 ) << (UINT16) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 - << (INT32) aMtfSizePix.Width() << (INT32) aMtfSizePix.Height() - << (INT32) ( aMtfSizeLog.Width() / 100 ) << (INT32) ( aMtfSizeLog.Height() / 100 ) - << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 - << (INT32) ( aMtfSizeLog.Width() * 10 ) << (INT32) ( aMtfSizeLog.Height() * 10 ); //use [MS-EMF 2.2.11] HeaderExtension2 Object + const sal_uLong nEndPos = m_rStm.Tell(); m_rStm.Seek( nHeaderPos ); + + m_rStm << (sal_uInt32) 0x00000001 << (sal_uInt32) 108 //use [MS-EMF 2.2.11] HeaderExtension2 Object + << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) ( aMtfSizePix.Width() - 1 ) << (sal_Int32) ( aMtfSizePix.Height() - 1 ) + << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) ( aMtfSizeLog.Width() - 1 ) << (sal_Int32) ( aMtfSizeLog.Height() - 1 ) + << (sal_uInt32) 0x464d4520 << (sal_uInt32) 0x10000 << (sal_uInt32) ( nEndPos - nHeaderPos ) + << (sal_uInt32) mnRecordCount << (sal_uInt16) ( mnHandleCount + 1 ) << (sal_uInt16) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 + << (sal_Int32) aMtfSizePix.Width() << (sal_Int32) aMtfSizePix.Height() + << (sal_Int32) ( aMtfSizeLog.Width() / 100 ) << (sal_Int32) ( aMtfSizeLog.Height() / 100 ) + << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 + << (sal_Int32) ( aMtfSizeLog.Width() * 10 ) << (sal_Int32) ( aMtfSizeLog.Height() * 10 ); //use [MS-EMF 2.2.11] HeaderExtension2 Object m_rStm.Seek( nEndPos ); delete[] mpHandlesUsed; @@ -253,15 +253,15 @@ BOOL EMFWriter::WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pFilterConf // ----------------------------------------------------------------------------- -ULONG EMFWriter::ImplAcquireHandle() +sal_uLong EMFWriter::ImplAcquireHandle() { - ULONG nHandle = HANDLE_INVALID; + sal_uLong nHandle = HANDLE_INVALID; - for( ULONG i = 0; i < MAXHANDLES && ( HANDLE_INVALID == nHandle ); i++ ) + for( sal_uLong i = 0; i < MAXHANDLES && ( HANDLE_INVALID == nHandle ); i++ ) { if( !mpHandlesUsed[ i ] ) { - mpHandlesUsed[ i ] = TRUE; + mpHandlesUsed[ i ] = sal_True; if( ( nHandle = i ) == mnHandleCount ) mnHandleCount++; @@ -274,10 +274,10 @@ ULONG EMFWriter::ImplAcquireHandle() // ----------------------------------------------------------------------------- -void EMFWriter::ImplReleaseHandle( ULONG nHandle ) +void EMFWriter::ImplReleaseHandle( sal_uLong nHandle ) { DBG_ASSERT( nHandle && ( nHandle < MAXHANDLES ), "Handle out of range" ); - mpHandlesUsed[ nHandle - 1 ] = FALSE; + mpHandlesUsed[ nHandle - 1 ] = sal_False; } // ----------------------------------------------------------------------------- @@ -288,7 +288,7 @@ void EMFWriter::ImplBeginRecord( sal_uInt32 nType ) if( !mbRecordOpen ) { - mbRecordOpen = TRUE; + mbRecordOpen = sal_True; mnRecordPos = m_rStm.Tell(); m_rStm << nType; @@ -315,17 +315,17 @@ void EMFWriter::ImplEndRecord() while( nFillBytes-- ) m_rStm << (sal_uInt8)0; mnRecordCount++; - mbRecordOpen = FALSE; + mbRecordOpen = sal_False; } } // ----------------------------------------------------------------------------- -BOOL EMFWriter::ImplPrepareHandleSelect( sal_uInt32& rHandle, ULONG nSelectType ) +sal_Bool EMFWriter::ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSelectType ) { if( rHandle != HANDLE_INVALID ) { - UINT32 nStockObject = 0x80000000; + sal_uInt32 nStockObject = 0x80000000; if( LINE_SELECT == nSelectType ) nStockObject |= 0x00000007; @@ -410,7 +410,7 @@ void EMFWriter::ImplCheckTextAttr() m_rStm << mnTextHandle; ImplWriteExtent( -rFont.GetSize().Height() ); ImplWriteExtent( rFont.GetSize().Width() ); - m_rStm << (INT32) rFont.GetOrientation() << (INT32) rFont.GetOrientation(); + m_rStm << (sal_Int32) rFont.GetOrientation() << (sal_Int32) rFont.GetOrientation(); switch( rFont.GetWeight() ) { @@ -428,11 +428,11 @@ void EMFWriter::ImplCheckTextAttr() } m_rStm << nWeight; - m_rStm << (BYTE) ( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 ); - m_rStm << (BYTE) ( ( UNDERLINE_NONE == rFont.GetUnderline() ) ? 0 : 1 ); - m_rStm << (BYTE) ( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 ); - m_rStm << (BYTE) ( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 ); - m_rStm << (BYTE) 0 << (BYTE) 0 << (BYTE) 0; + m_rStm << (sal_uInt8) ( ( ITALIC_NONE == rFont.GetItalic() ) ? 0 : 1 ); + m_rStm << (sal_uInt8) ( ( UNDERLINE_NONE == rFont.GetUnderline() ) ? 0 : 1 ); + m_rStm << (sal_uInt8) ( ( STRIKEOUT_NONE == rFont.GetStrikeout() ) ? 0 : 1 ); + m_rStm << (sal_uInt8) ( ( RTL_TEXTENCODING_SYMBOL == rFont.GetCharSet() ) ? 2 : 0 ); + m_rStm << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0; switch( rFont.GetPitch() ) { @@ -465,24 +465,24 @@ void EMFWriter::ImplCheckTextAttr() m_rStm << (sal_Unicode) 0; // dummy elfVersion, elfStyleSize, elfMatch, elfReserved - m_rStm << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 << (UINT32) 0 ; + m_rStm << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 << (sal_uInt32) 0 ; // dummy elfVendorId - m_rStm << (UINT32) 0; + m_rStm << (sal_uInt32) 0; // dummy elfCulture - m_rStm << (UINT32) 0; + m_rStm << (sal_uInt32) 0; // dummy elfPanose - m_rStm << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0 << (BYTE) 0; + m_rStm << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0 << (sal_uInt8) 0; // fill record to get a record size divideable by 4 - m_rStm << (UINT16) 0; + m_rStm << (sal_uInt16) 0; ImplEndRecord(); // TextAlign - UINT32 nTextAlign; + sal_uInt32 nTextAlign; switch( rFont.GetAlign() ) { @@ -511,10 +511,10 @@ void EMFWriter::ImplCheckTextAttr() void EMFWriter::ImplWriteColor( const Color& rColor ) { - UINT32 nCol = rColor.GetRed(); + sal_uInt32 nCol = rColor.GetRed(); - nCol |= ( (UINT32) rColor.GetGreen() ) << 8; - nCol |= ( (UINT32) rColor.GetBlue() ) << 16; + nCol |= ( (sal_uInt32) rColor.GetGreen() ) << 8; + nCol |= ( (sal_uInt32) rColor.GetBlue() ) << 16; m_rStm << nCol; } @@ -523,7 +523,7 @@ void EMFWriter::ImplWriteColor( const Color& rColor ) void EMFWriter::ImplWriteRasterOp( RasterOp eRop ) { - UINT32 nROP2; + sal_uInt32 nROP2; switch( eRop ) { @@ -542,7 +542,7 @@ void EMFWriter::ImplWriteRasterOp( RasterOp eRop ) void EMFWriter::ImplWriteExtent( long nExtent ) { nExtent = maVDev.LogicToLogic( Size( nExtent, 0 ), maVDev.GetMapMode(), maDestMapMode ).Width(); - m_rStm << (INT32) nExtent; + m_rStm << (sal_Int32) nExtent; } // ----------------------------------------------------------------------------- @@ -550,7 +550,7 @@ void EMFWriter::ImplWriteExtent( long nExtent ) void EMFWriter::ImplWritePoint( const Point& rPoint ) { const Point aPoint( maVDev.LogicToLogic( rPoint, maVDev.GetMapMode(), maDestMapMode )); - m_rStm << (INT32) aPoint.X() << (INT32) aPoint.Y(); + m_rStm << (sal_Int32) aPoint.X() << (sal_Int32) aPoint.Y(); } // ----------------------------------------------------------------------------- @@ -558,7 +558,7 @@ void EMFWriter::ImplWritePoint( const Point& rPoint ) void EMFWriter::ImplWriteSize( const Size& rSize) { const Size aSize( maVDev.LogicToLogic( rSize, maVDev.GetMapMode(), maDestMapMode )); - m_rStm << (INT32) aSize.Width() << (INT32) aSize.Height(); + m_rStm << (sal_Int32) aSize.Width() << (sal_Int32) aSize.Height(); } // ----------------------------------------------------------------------------- @@ -571,7 +571,7 @@ void EMFWriter::ImplWriteRect( const Rectangle& rRect ) // ----------------------------------------------------------------------------- -void EMFWriter::ImplWritePolygonRecord( const Polygon& rPoly, BOOL bClose ) +void EMFWriter::ImplWritePolygonRecord( const Polygon& rPoly, sal_Bool bClose ) { if( rPoly.GetSize() ) { @@ -586,9 +586,9 @@ void EMFWriter::ImplWritePolygonRecord( const Polygon& rPoly, BOOL bClose ) ImplBeginRecord( bClose ? WIN_EMR_POLYGON : WIN_EMR_POLYLINE ); ImplWriteRect( rPoly.GetBoundRect() ); - m_rStm << (UINT32) rPoly.GetSize(); + m_rStm << (sal_uInt32) rPoly.GetSize(); - for( USHORT i = 0; i < rPoly.GetSize(); i++ ) + for( sal_uInt16 i = 0; i < rPoly.GetSize(); i++ ) ImplWritePoint( rPoly[ i ] ); ImplEndRecord(); @@ -605,7 +605,7 @@ void EMFWriter::ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly ) if( nPolyCount ) { if( 1 == nPolyCount ) - ImplWritePolygonRecord( rPolyPoly[ 0 ], TRUE ); + ImplWritePolygonRecord( rPolyPoly[ 0 ], sal_True ); else { sal_Bool bHasFlags = sal_False; @@ -737,7 +737,7 @@ void EMFWriter::ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClosed ) // ----------------------------------------------------------------------------- void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, - const Size& rSz, UINT32 nROP ) + const Size& rSz, sal_uInt32 nROP ) { if( !!rBmp ) { @@ -747,19 +747,19 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, ImplBeginRecord( WIN_EMR_STRETCHDIBITS ); ImplWriteRect( Rectangle( rPt, rSz ) ); ImplWritePoint( rPt ); - m_rStm << (INT32) 0 << (INT32) 0 << (INT32) aBmpSizePixel.Width() << (INT32) aBmpSizePixel.Height(); + m_rStm << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) aBmpSizePixel.Width() << (sal_Int32) aBmpSizePixel.Height(); // write offset positions and sizes later - const ULONG nOffPos = m_rStm.Tell(); + const sal_uLong nOffPos = m_rStm.Tell(); m_rStm.SeekRel( 16 ); - m_rStm << (UINT32) 0 << ( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP ); + m_rStm << (sal_uInt32) 0 << ( ( ROP_XOR == maVDev.GetRasterOp() && WIN_SRCCOPY == nROP ) ? WIN_SRCINVERT : nROP ); ImplWriteSize( rSz ); - rBmp.Write( aMemStm, TRUE, FALSE ); + rBmp.Write( aMemStm, sal_True, sal_False ); - UINT32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize; - UINT16 nBitCount; + sal_uInt32 nDIBSize = aMemStm.Tell(), nHeaderSize, nCompression, nColsUsed, nPalCount, nImageSize; + sal_uInt16 nBitCount; // get DIB parameters aMemStm.Seek( 0 ); @@ -769,15 +769,15 @@ void EMFWriter::ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, aMemStm.SeekRel( 8 ); aMemStm >> nColsUsed; - nPalCount = ( nBitCount <= 8 ) ? ( nColsUsed ? nColsUsed : ( 1 << (UINT32) nBitCount ) ) : + nPalCount = ( nBitCount <= 8 ) ? ( nColsUsed ? nColsUsed : ( 1 << (sal_uInt32) nBitCount ) ) : ( ( 3 == nCompression ) ? 12 : 0 ); m_rStm.Write( aMemStm.GetData(), nDIBSize ); - const ULONG nEndPos = m_rStm.Tell(); + const sal_uLong nEndPos = m_rStm.Tell(); m_rStm.Seek( nOffPos ); - m_rStm << (UINT32) 80 << (UINT32)( nHeaderSize + ( nPalCount << 2 ) ); - m_rStm << (UINT32)( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ) << nImageSize; + m_rStm << (sal_uInt32) 80 << (sal_uInt32)( nHeaderSize + ( nPalCount << 2 ) ); + m_rStm << (sal_uInt32)( 80 + ( nHeaderSize + ( nPalCount << 2 ) ) ) << nImageSize; m_rStm.Seek( nEndPos ); ImplEndRecord(); @@ -827,12 +827,12 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons ImplBeginRecord( WIN_EMR_EXTTEXTOUTW ); ImplWriteRect( Rectangle( rPos, Size( nNormWidth, maVDev.GetTextHeight() ) ) ); - m_rStm << (UINT32)1; - m_rStm << (INT32) 0 << (INT32) 0; + m_rStm << (sal_uInt32)1; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0; ImplWritePoint( rPos ); - m_rStm << (UINT32) nLen << (UINT32) 76 << (UINT32) 2; - m_rStm << (INT32) 0 << (INT32) 0 << (INT32) 0 << (INT32) 0; - m_rStm << (UINT32) ( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) ); + m_rStm << (sal_uInt32) nLen << (sal_uInt32) 76 << (sal_uInt32) 2; + m_rStm << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) 0 << (sal_Int32) 0; + m_rStm << (sal_uInt32) ( 76 + ( nLen << 1 ) + ( (nLen & 1 ) ? 2 : 0 ) ); // write text for( i = 0; i < nLen; i++ ) @@ -840,7 +840,7 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons // padding word if( nLen & 1 ) - m_rStm << (UINT16) 0; + m_rStm << (sal_uInt16) 0; // write DX array ImplWriteExtent( pDX[ 0 ] ); @@ -874,7 +874,7 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) { const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); - ImplWritePolygonRecord( Polygon(aCandidate), FALSE ); + ImplWritePolygonRecord( Polygon(aCandidate), sal_False ); } } @@ -902,10 +902,10 @@ void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const bas void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { - for( ULONG j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ ) + for( sal_uLong j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ ) { const MetaAction* pAction = rMtf.GetAction( j ); - const USHORT nType = pAction->GetType(); + const sal_uInt16 nType = pAction->GetType(); switch( nType ) { @@ -1073,7 +1073,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { if(pA->GetLineInfo().IsDefault()) { - ImplWritePolygonRecord( rPoly, FALSE ); + ImplWritePolygonRecord( rPoly, sal_False ); } else { @@ -1156,7 +1156,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) const MetaEPSAction* pA = (const MetaEPSAction*) pAction; const GDIMetaFile aSubstitute( pA->GetSubstitute() ); - for( ULONG i = 0, nCount = aSubstitute.GetActionCount(); i < nCount; i++ ) + for( sal_uLong i = 0, nCount = aSubstitute.GetActionCount(); i < nCount; i++ ) { const MetaAction* pSubstAct = aSubstitute.GetAction( i ); if( pSubstAct->GetType() == META_BMPSCALE_ACTION ) @@ -1175,7 +1175,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) maVDev.Pop(); ImplBeginRecord( WIN_EMR_RESTOREDC ); - m_rStm << (INT32) -1; + m_rStm << (sal_Int32) -1; ImplEndRecord(); break; } @@ -1306,14 +1306,14 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) case( META_LINECOLOR_ACTION ): { ( (MetaAction*) pAction )->Execute( &maVDev ); - mbLineChanged = TRUE; + mbLineChanged = sal_True; } break; case( META_FILLCOLOR_ACTION ): { ( (MetaAction*) pAction )->Execute( &maVDev ); - mbFillChanged = TRUE; + mbFillChanged = sal_True; } break; @@ -1324,7 +1324,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) case( META_FONT_ACTION ): { ( (MetaAction*) pAction )->Execute( &maVDev ); - mbTextChanged = TRUE; + mbTextChanged = sal_True; } break; @@ -1365,11 +1365,11 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) ( (MetaAction*) pAction )->Execute( &maVDev ); ImplBeginRecord( WIN_EMR_RESTOREDC ); - m_rStm << (INT32) -1; + m_rStm << (sal_Int32) -1; ImplEndRecord(); ImplWriteRasterOp( maVDev.GetRasterOp() ); - mbLineChanged = mbFillChanged = mbTextChanged = TRUE; + mbLineChanged = mbFillChanged = mbTextChanged = sal_True; } break; diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx index fbee680b1cd0..ee3b723ace3e 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.hxx +++ b/svtools/source/filter.vcl/wmf/emfwr.hxx @@ -51,27 +51,27 @@ private: MapMode maDestMapMode; FilterConfigItem* mpFilterConfigItem; SvStream& m_rStm; - BOOL* mpHandlesUsed; - ULONG mnHandleCount; - ULONG mnLastPercent; - ULONG mnRecordCount; - ULONG mnRecordPos; - BOOL mbRecordOpen; - BOOL mbLineChanged; + sal_Bool* mpHandlesUsed; + sal_uLong mnHandleCount; + sal_uLong mnLastPercent; + sal_uLong mnRecordCount; + sal_uLong mnRecordPos; + sal_Bool mbRecordOpen; + sal_Bool mbLineChanged; sal_uInt32 mnLineHandle; - BOOL mbFillChanged; + sal_Bool mbFillChanged; sal_uInt32 mnFillHandle; - BOOL mbTextChanged; + sal_Bool mbTextChanged; sal_uInt32 mnTextHandle; sal_uInt32 mnHorTextAlign; void ImplBeginRecord( sal_uInt32 nType ); void ImplEndRecord(); - ULONG ImplAcquireHandle(); - void ImplReleaseHandle( ULONG nHandle ); + sal_uLong ImplAcquireHandle(); + void ImplReleaseHandle( sal_uLong nHandle ); - BOOL ImplPrepareHandleSelect( sal_uInt32& rHandle, ULONG nSelectType ); + sal_Bool ImplPrepareHandleSelect( sal_uInt32& rHandle, sal_uLong nSelectType ); void ImplCheckLineAttr(); void ImplCheckFillAttr(); void ImplCheckTextAttr(); @@ -83,9 +83,9 @@ private: void ImplWriteSize( const Size& rSize); void ImplWriteRect( const Rectangle& rRect ); void ImplWritePath( const PolyPolygon& rPolyPoly, sal_Bool bClose ); - void ImplWritePolygonRecord( const Polygon& rPoly, BOOL bClose ); + void ImplWritePolygonRecord( const Polygon& rPoly, sal_Bool bClose ); void ImplWritePolyPolygonRecord( const PolyPolygon& rPolyPoly ); - void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, UINT32 nROP ); + void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, sal_uInt32 nROP ); void ImplWriteTextRecord( const Point& rPos, const String rText, const sal_Int32* pDXArray, sal_uInt32 nWidth ); void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); @@ -95,7 +95,7 @@ public: EMFWriter(SvStream &rStream) : m_rStm(rStream) {} - BOOL WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pConfigItem = NULL ); + sal_Bool WriteEMF( const GDIMetaFile& rMtf, FilterConfigItem* pConfigItem = NULL ); }; #endif // _EMFWR_HXX diff --git a/svtools/source/filter.vcl/wmf/enhwmf.cxx b/svtools/source/filter.vcl/wmf/enhwmf.cxx index 259f518fbf95..f54eca6f6075 100644 --- a/svtools/source/filter.vcl/wmf/enhwmf.cxx +++ b/svtools/source/filter.vcl/wmf/enhwmf.cxx @@ -332,7 +332,7 @@ void EnhWMFReader::ReadGDIComment() } } -BOOL EnhWMFReader::ReadEnhWMF() +sal_Bool EnhWMFReader::ReadEnhWMF() { sal_uInt32 nStretchBltMode = 0; sal_uInt32 nRecType, nRecSize, nNextPos, @@ -357,7 +357,7 @@ BOOL EnhWMFReader::ReadEnhWMF() if ( ( nRecSize < 8 ) || ( nRecSize & 3 ) ) // Parameter sind immer durch 4 teilbar { - bStatus = FALSE; + bStatus = sal_False; break; } @@ -365,7 +365,7 @@ BOOL EnhWMFReader::ReadEnhWMF() if ( nNextPos > nEndPos ) { - bStatus = FALSE; + bStatus = sal_False; break; } @@ -430,8 +430,8 @@ BOOL EnhWMFReader::ReadEnhWMF() { pWMF->SeekRel( 16 ); *pWMF >> nPoints; - Polygon aPoly( (UINT16)nPoints ); - for( UINT16 k = 0; k < (UINT16)nPoints; k++ ) + Polygon aPoly( (sal_uInt16)nPoints ); + for( sal_uInt16 k = 0; k < (sal_uInt16)nPoints; k++ ) { *pWMF >> nX32 >> nY32; aPoly[ k ] = Point( nX32, nY32 ); @@ -446,14 +446,14 @@ BOOL EnhWMFReader::ReadEnhWMF() { pWMF->SeekRel( 0x10 ); *pWMF >> nPoints; - UINT16 i = 0; + sal_uInt16 i = 0; if ( bFlag ) { i++; nPoints++; } - Polygon aPolygon( (UINT16)nPoints ); - for ( ; i < (UINT16)nPoints; i++ ) + Polygon aPolygon( (sal_uInt16)nPoints ); + for ( ; i < (sal_uInt16)nPoints; i++ ) { *pWMF >> nX32 >> nY32; aPolygon[ i ] = Point( nX32, nY32 ); @@ -464,25 +464,25 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_POLYPOLYLINE : { - UINT16* pnPoints; + sal_uInt16* pnPoints; - INT32 i, nPoly; + sal_Int32 i, nPoly; pWMF->SeekRel( 0x10 ); // Anzahl der Polygone: *pWMF >> nPoly >> i; // taking the amount of points of each polygon, retrieving the total number of points - if ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / sizeof(UINT16) ) + if ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) { - if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof(UINT16) ) <= ( nEndPos - pWMF->Tell() ) ) + if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) ) { - pnPoints = new UINT16[ nPoly ]; + pnPoints = new sal_uInt16[ nPoly ]; for ( i = 0; i < nPoly; i++ ) { *pWMF >> nPoints; - pnPoints[ i ] = (UINT16)nPoints; + pnPoints[ i ] = (sal_uInt16)nPoints; } // Polygonpunkte holen: @@ -490,7 +490,7 @@ BOOL EnhWMFReader::ReadEnhWMF() for ( i = 0; ( i < nPoly ) && !pWMF->IsEof(); i++ ) { Polygon aPoly( pnPoints[ i ] ); - for( UINT16 k = 0; k < pnPoints[ i ]; k++ ) + for( sal_uInt16 k = 0; k < pnPoints[ i ]; k++ ) { *pWMF >> nX32 >> nY32; aPoly[ k ] = Point( nX32, nY32 ); @@ -505,25 +505,25 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_POLYPOLYGON : { - UINT16* pnPoints; + sal_uInt16* pnPoints; Point* pPtAry; - UINT32 i, nPoly, nGesPoints; + sal_uInt32 i, nPoly, nGesPoints; pWMF->SeekRel( 0x10 ); // Anzahl der Polygone: *pWMF >> nPoly >> nGesPoints; - if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(UINT16) ) ) + if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) ) { - if ( ( nPoly * sizeof(UINT16) ) <= ( nEndPos - pWMF->Tell() ) ) + if ( ( nPoly * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) ) { - pnPoints = new UINT16[ nPoly ]; + pnPoints = new sal_uInt16[ nPoly ]; for ( i = 0; i < nPoly; i++ ) { *pWMF >> nPoints; - pnPoints[ i ] = (UINT16)nPoints; + pnPoints[ i ] = (sal_uInt16)nPoints; } if ( ( nGesPoints * (sizeof(sal_uInt32)+sizeof(sal_uInt32)) ) <= ( nEndPos - pWMF->Tell() ) ) @@ -537,7 +537,7 @@ BOOL EnhWMFReader::ReadEnhWMF() pPtAry[ i ] = Point( nX32, nY32 ); } // PolyPolygon Actions erzeugen - PolyPolygon aPolyPoly( (UINT16)nPoly, pnPoints, pPtAry ); + PolyPolygon aPolyPoly( (sal_uInt16)nPoly, pnPoints, pPtAry ); pOut->DrawPolyPolygon( aPolyPoly, bRecordPath ); delete[] pPtAry; } @@ -693,7 +693,7 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_MODIFYWORLDTRANSFORM : { - UINT32 nMode; + sal_uInt32 nMode; XForm aTempXForm; *pWMF >> aTempXForm >> nMode; pOut->ModifyWorldTransform( aTempXForm, nMode ); @@ -714,7 +714,7 @@ BOOL EnhWMFReader::ReadEnhWMF() { LineInfo aLineInfo; - UINT32 nStyle; + sal_uInt32 nStyle; Size aSize; *pWMF >> nStyle >> aSize.Width() >> aSize.Height(); @@ -722,9 +722,9 @@ BOOL EnhWMFReader::ReadEnhWMF() if ( aSize.Width() ) aLineInfo.SetWidth( aSize.Width() ); - BOOL bTransparent = FALSE; - UINT16 nDashCount = 0; - UINT16 nDotCount = 0; + sal_Bool bTransparent = sal_False; + sal_uInt16 nDashCount = 0; + sal_uInt16 nDotCount = 0; switch( nStyle ) { case PS_DASHDOTDOT : @@ -738,7 +738,7 @@ BOOL EnhWMFReader::ReadEnhWMF() nDashCount++; break; case PS_NULL : - bTransparent = TRUE; + bTransparent = sal_True; aLineInfo.SetStyle( LINE_NONE ); break; default : @@ -813,12 +813,12 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_CREATEBRUSHINDIRECT : { - UINT32 nStyle; + sal_uInt32 nStyle; *pWMF >> nIndex; if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 ) { *pWMF >> nStyle; - pOut->CreateObject( nIndex, GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? TRUE : FALSE ) ); + pOut->CreateObject( nIndex, GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? sal_True : sal_False ) ); } } break; @@ -855,7 +855,7 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_ARC : { - UINT32 nStartX, nStartY, nEndX, nEndY; + sal_uInt32 nStartX, nStartY, nEndX, nEndY; *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY; pOut->DrawArc( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ) ); } @@ -863,7 +863,7 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_CHORD : { - UINT32 nStartX, nStartY, nEndX, nEndY; + sal_uInt32 nStartX, nStartY, nEndX, nEndY; *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY; pOut->DrawChord( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ) ); } @@ -871,7 +871,7 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_PIE : { - UINT32 nStartX, nStartY, nEndX, nEndY; + sal_uInt32 nStartX, nStartY, nEndX, nEndY; *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY; const Rectangle aRect( ReadRectangle( nX32, nY32, nx32, ny32 )); @@ -893,9 +893,9 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_ARCTO : { - UINT32 nStartX, nStartY, nEndX, nEndY; + sal_uInt32 nStartX, nStartY, nEndX, nEndY; *pWMF >> nX32 >> nY32 >> nx32 >> ny32 >> nStartX >> nStartY >> nEndX >> nEndY; - pOut->DrawArc( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), TRUE ); + pOut->DrawArc( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), sal_True ); } break; @@ -952,11 +952,11 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_BITBLT : // PASSTHROUGH INTENDED case EMR_STRETCHBLT : { - INT32 xDest, yDest, cxDest, cyDest, xSrc, ySrc, cxSrc, cySrc; - UINT32 dwRop, iUsageSrc, offBmiSrc, cbBmiSrc, offBitsSrc, cbBitsSrc; + sal_Int32 xDest, yDest, cxDest, cyDest, xSrc, ySrc, cxSrc, cySrc; + sal_uInt32 dwRop, iUsageSrc, offBmiSrc, cbBmiSrc, offBitsSrc, cbBitsSrc; XForm xformSrc; - UINT32 nStart = pWMF->Tell() - 8; + sal_uInt32 nStart = pWMF->Tell() - 8; pWMF->SeekRel( 0x10 ); *pWMF >> xDest >> yDest >> cxDest >> cyDest >> dwRop >> xSrc >> ySrc @@ -975,27 +975,27 @@ BOOL EnhWMFReader::ReadEnhWMF() cyDest = abs( (int)cyDest ); // and also 122889 if ( (cbBitsSrc > (SAL_MAX_UINT32 - 14)) || ((SAL_MAX_UINT32 - 14) - cbBitsSrc < cbBmiSrc) ) - bStatus = FALSE; + bStatus = sal_False; else { - UINT32 nSize = cbBmiSrc + cbBitsSrc + 14; + sal_uInt32 nSize = cbBmiSrc + cbBitsSrc + 14; if ( nSize <= ( nEndPos - nStartPos ) ) { char* pBuf = new char[ nSize ]; SvMemoryStream aTmp( pBuf, nSize, STREAM_READ | STREAM_WRITE ); - aTmp.ObjectOwnsMemory( TRUE ); - aTmp << (BYTE)'B' - << (BYTE)'M' - << (UINT32)cbBitsSrc - << (UINT16)0 - << (UINT16)0 - << (UINT32)cbBmiSrc + 14; + aTmp.ObjectOwnsMemory( sal_True ); + aTmp << (sal_uInt8)'B' + << (sal_uInt8)'M' + << (sal_uInt32)cbBitsSrc + << (sal_uInt16)0 + << (sal_uInt16)0 + << (sal_uInt32)cbBmiSrc + 14; pWMF->Seek( nStart + offBmiSrc ); pWMF->Read( pBuf + 14, cbBmiSrc ); pWMF->Seek( nStart + offBitsSrc ); pWMF->Read( pBuf + 14 + cbBmiSrc, cbBitsSrc ); aTmp.Seek( 0 ); - aBitmap.Read( aTmp, TRUE ); + aBitmap.Read( aTmp, sal_True ); // test if it is sensible to crop if ( ( cxSrc > 0 ) && ( cySrc > 0 ) && @@ -1017,9 +1017,9 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_STRETCHDIBITS : { - INT32 xDest, yDest, xSrc, ySrc, cxSrc, cySrc, cxDest, cyDest; - UINT32 offBmiSrc, cbBmiSrc, offBitsSrc, cbBitsSrc, iUsageSrc, dwRop; - UINT32 nStart = pWMF->Tell() - 8; + sal_Int32 xDest, yDest, xSrc, ySrc, cxSrc, cySrc, cxDest, cyDest; + sal_uInt32 offBmiSrc, cbBmiSrc, offBitsSrc, cbBitsSrc, iUsageSrc, dwRop; + sal_uInt32 nStart = pWMF->Tell() - 8; pWMF->SeekRel( 0x10 ); *pWMF >> xDest >> yDest >> xSrc >> ySrc >> cxSrc >> cySrc >> offBmiSrc >> cbBmiSrc >> offBitsSrc @@ -1032,27 +1032,27 @@ BOOL EnhWMFReader::ReadEnhWMF() cyDest = abs( (int)cyDest ); // and also 122889 if ( (cbBitsSrc > (SAL_MAX_UINT32 - 14)) || ((SAL_MAX_UINT32 - 14) - cbBitsSrc < cbBmiSrc) ) - bStatus = FALSE; + bStatus = sal_False; else { - UINT32 nSize = cbBmiSrc + cbBitsSrc + 14; + sal_uInt32 nSize = cbBmiSrc + cbBitsSrc + 14; if ( nSize <= ( nEndPos - nStartPos ) ) { char* pBuf = new char[ nSize ]; SvMemoryStream aTmp( pBuf, nSize, STREAM_READ | STREAM_WRITE ); - aTmp.ObjectOwnsMemory( TRUE ); - aTmp << (BYTE)'B' - << (BYTE)'M' - << (UINT32)cbBitsSrc - << (UINT16)0 - << (UINT16)0 - << (UINT32)cbBmiSrc + 14; + aTmp.ObjectOwnsMemory( sal_True ); + aTmp << (sal_uInt8)'B' + << (sal_uInt8)'M' + << (sal_uInt32)cbBitsSrc + << (sal_uInt16)0 + << (sal_uInt16)0 + << (sal_uInt32)cbBmiSrc + 14; pWMF->Seek( nStart + offBmiSrc ); pWMF->Read( pBuf + 14, cbBmiSrc ); pWMF->Seek( nStart + offBitsSrc ); pWMF->Read( pBuf + 14 + cbBmiSrc, cbBitsSrc ); aTmp.Seek( 0 ); - aBitmap.Read( aTmp, TRUE ); + aBitmap.Read( aTmp, sal_True ); // test if it is sensible to crop if ( ( cxSrc > 0 ) && ( cySrc > 0 ) && @@ -1084,7 +1084,7 @@ BOOL EnhWMFReader::ReadEnhWMF() for ( int i = 0; i < LF_FACESIZE; i++ ) { - UINT16 nChar; + sal_uInt16 nChar; *pWMF >> nChar; lfFaceName[ i ] = nChar; } @@ -1188,14 +1188,14 @@ BOOL EnhWMFReader::ReadEnhWMF() { pWMF->SeekRel( 16 ); *pWMF >> nPoints; - UINT16 i = 0; + sal_uInt16 i = 0; if ( bFlag ) { i++; nPoints++; } - Polygon aPoly( (UINT16)nPoints ); - for( ; i < (UINT16)nPoints; i++ ) + Polygon aPoly( (sal_uInt16)nPoints ); + for( ; i < (sal_uInt16)nPoints; i++ ) { *pWMF >> nX16 >> nY16; aPoly[ i ] = Point( nX16, nY16 ); @@ -1208,8 +1208,8 @@ BOOL EnhWMFReader::ReadEnhWMF() { pWMF->SeekRel( 16 ); *pWMF >> nPoints; - Polygon aPoly( (UINT16)nPoints ); - for( UINT16 k = 0; k < (UINT16)nPoints; k++ ) + Polygon aPoly( (sal_uInt16)nPoints ); + for( sal_uInt16 k = 0; k < (sal_uInt16)nPoints; k++ ) { *pWMF >> nX16 >> nY16; aPoly[ k ] = Point( nX16, nY16 ); @@ -1224,15 +1224,15 @@ BOOL EnhWMFReader::ReadEnhWMF() { pWMF->SeekRel( 16 ); *pWMF >> nPoints; - UINT16 i = 0; + sal_uInt16 i = 0; if ( bFlag ) { i++; nPoints++; } - Polygon aPoly( (UINT16)nPoints ); - for( ; i < (UINT16)nPoints; i++ ) + Polygon aPoly( (sal_uInt16)nPoints ); + for( ; i < (sal_uInt16)nPoints; i++ ) { *pWMF >> nX16 >> nY16; aPoly[ i ] = Point( nX16, nY16 ); @@ -1243,29 +1243,29 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_POLYPOLYLINE16 : { - UINT16* pnPoints; + sal_uInt16* pnPoints; - INT32 i, nPoly, nGesPoints; + sal_Int32 i, nPoly, nGesPoints; pWMF->SeekRel( 0x10 ); // Anzahl der Polygone: *pWMF >> nPoly >> nGesPoints; // taking the amount of points of each polygon, retrieving the total number of points - if ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / sizeof(UINT16) ) + if ( static_cast< sal_uInt32 >(nPoly) < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) { - if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof(UINT16) ) <= ( nEndPos - pWMF->Tell() ) ) + if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) ) { - pnPoints = new UINT16[ nPoly ]; + pnPoints = new sal_uInt16[ nPoly ]; for ( i = 0; i < nPoly; i++ ) { *pWMF >> nPoints; - pnPoints[ i ] = (UINT16)nPoints; + pnPoints[ i ] = (sal_uInt16)nPoints; } // Polygonpunkte holen: for ( i = 0; ( i < nPoly ) && !pWMF->IsEof(); i++ ) { Polygon aPolygon( pnPoints[ i ] ); - for ( UINT16 k = 0; k < pnPoints[ i ]; k++ ) + for ( sal_uInt16 k = 0; k < pnPoints[ i ]; k++ ) { *pWMF >> nX16 >> nY16; aPolygon[ k ] = Point( nX16, nY16 ); @@ -1280,22 +1280,22 @@ BOOL EnhWMFReader::ReadEnhWMF() case EMR_POLYPOLYGON16 : { - UINT16* pnPoints; + sal_uInt16* pnPoints; Point* pPtAry; - UINT32 i, nPoly, nGesPoints; + sal_uInt32 i, nPoly, nGesPoints; pWMF->SeekRel( 0x10 ); // Anzahl der Polygone: *pWMF >> nPoly >> nGesPoints; - if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(UINT16) ) ) + if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) ) { - if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof( UINT16 ) ) <= ( nEndPos - pWMF->Tell() ) ) + if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof( sal_uInt16 ) ) <= ( nEndPos - pWMF->Tell() ) ) { - pnPoints = new UINT16[ nPoly ]; + pnPoints = new sal_uInt16[ nPoly ]; for ( i = 0; i < nPoly; i++ ) { *pWMF >> nPoints; - pnPoints[ i ] = (UINT16)nPoints; + pnPoints[ i ] = (sal_uInt16)nPoints; } if ( ( nGesPoints * (sizeof(sal_uInt16)+sizeof(sal_uInt16)) ) <= ( nEndPos - pWMF->Tell() ) ) { @@ -1308,7 +1308,7 @@ BOOL EnhWMFReader::ReadEnhWMF() } // PolyPolygon Actions erzeugen - PolyPolygon aPolyPoly( (UINT16)nPoly, pnPoints, pPtAry ); + PolyPolygon aPolyPoly( (sal_uInt16)nPoly, pnPoints, pPtAry ); pOut->DrawPolyPolygon( aPolyPoly, bRecordPath ); delete[] pPtAry; } @@ -1455,16 +1455,16 @@ BOOL EnhWMFReader::ReadEnhWMF() //----------------------------------------------------------------------------------- -BOOL EnhWMFReader::ReadHeader() +sal_Bool EnhWMFReader::ReadHeader() { - UINT32 nUINT32, nHeaderSize, nPalEntries; - INT32 nLeft, nTop, nRight, nBottom; + sal_uInt32 nUINT32, nHeaderSize, nPalEntries; + sal_Int32 nLeft, nTop, nRight, nBottom; // METAFILEHEADER SPARE ICH MIR HIER // Einlesen des METAHEADER *pWMF >> nUINT32 >> nHeaderSize; if ( nUINT32 != 1 ) // Typ - return FALSE; + return sal_False; // bound size Rectangle rclBounds; // rectangle in logical units 1/100th mm @@ -1485,7 +1485,7 @@ BOOL EnhWMFReader::ReadHeader() *pWMF >> nUINT32; // signature if ( nUINT32 != 0x464d4520 ) - return FALSE; + return sal_False; *pWMF >> nUINT32; // nVersion *pWMF >> nEndPos; // size of metafile @@ -1500,7 +1500,7 @@ BOOL EnhWMFReader::ReadHeader() *pWMF >> nRecordCount; if ( !nRecordCount ) - return FALSE; + return sal_False; pWMF->SeekRel( 0xc ); @@ -1513,12 +1513,12 @@ BOOL EnhWMFReader::ReadHeader() pOut->SetRefMill( Size( nMillX, nMillY ) ); pWMF->Seek( nStartPos + nHeaderSize ); - return TRUE; + return sal_True; } //----------------------------------------------------------------------------------- -Rectangle EnhWMFReader::ReadRectangle( INT32 x1, INT32 y1, INT32 x2, INT32 y2 ) +Rectangle EnhWMFReader::ReadRectangle( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) { Point aTL ( Point( x1, y1 ) ); Point aBR( Point( --x2, --y2 ) ); diff --git a/svtools/source/filter.vcl/wmf/makefile.mk b/svtools/source/filter.vcl/wmf/makefile.mk deleted file mode 100644 index 5c9412bc8387..000000000000 --- a/svtools/source/filter.vcl/wmf/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=svtools -TARGET=wmf -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES= $(SLO)$/wmf.obj \ - $(SLO)$/winmtf.obj \ - $(SLO)$/winwmf.obj \ - $(SLO)$/enhwmf.obj \ - $(SLO)$/emfwr.obj \ - $(SLO)$/wmfwr.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/svtools/source/filter.vcl/wmf/winmtf.cxx b/svtools/source/filter.vcl/wmf/winmtf.cxx index 4e52fb4d548c..6335ee12ade9 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.cxx +++ b/svtools/source/filter.vcl/wmf/winmtf.cxx @@ -316,7 +316,7 @@ WinMtf::WinMtf( WinMtfOutput* pWinMtfOutput, SvStream& rStreamWMF, FilterConfigI SvLockBytes *pLB = pWMF->GetLockBytes(); if ( pLB ) - pLB->SetSynchronMode( TRUE ); + pLB->SetSynchronMode( sal_True ); nStartPos = pWMF->Tell(); @@ -344,7 +344,7 @@ WinMtf::~WinMtf() // ------------------------------------------------------------------------ -void WinMtf::Callback( USHORT nPercent ) +void WinMtf::Callback( sal_uInt16 nPercent ) { if ( xStatusIndicator.is() ) xStatusIndicator->setValue( nPercent ); @@ -354,9 +354,9 @@ void WinMtf::Callback( USHORT nPercent ) Color WinMtf::ReadColor() { - UINT32 nColor; + sal_uInt32 nColor; *pWMF >> nColor; - return Color( (BYTE)nColor, (BYTE)( nColor >> 8 ), (BYTE)( nColor >> 16 ) ); + return Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) ); }; //----------------------------------------------------------------------------------- @@ -522,8 +522,8 @@ void WinMtfOutput::ImplMap( Font& rFont ) Polygon& WinMtfOutput::ImplMap( Polygon& rPolygon ) { - UINT16 nPoints = rPolygon.GetSize(); - for ( UINT16 i = 0; i < nPoints; i++ ) + sal_uInt16 nPoints = rPolygon.GetSize(); + for ( sal_uInt16 i = 0; i < nPoints; i++ ) { rPolygon[ i ] = ImplMap( rPolygon[ i ] ); } @@ -534,14 +534,14 @@ Polygon& WinMtfOutput::ImplMap( Polygon& rPolygon ) PolyPolygon& WinMtfOutput::ImplMap( PolyPolygon& rPolyPolygon ) { - UINT16 nPolys = rPolyPolygon.Count(); - for ( UINT16 i = 0; i < nPolys; ImplMap( rPolyPolygon[ i++ ] ) ) ; + sal_uInt16 nPolys = rPolyPolygon.Count(); + for ( sal_uInt16 i = 0; i < nPolys; ImplMap( rPolyPolygon[ i++ ] ) ) ; return rPolyPolygon; } //----------------------------------------------------------------------------------- -void WinMtfOutput::SelectObject( INT32 nIndex ) +void WinMtfOutput::SelectObject( sal_Int32 nIndex ) { GDIObj* pGDIObj = NULL; @@ -551,7 +551,7 @@ void WinMtfOutput::SelectObject( INT32 nIndex ) { nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen - if ( (UINT32)nIndex < vGDIObj.size() ) + if ( (sal_uInt32)nIndex < vGDIObj.size() ) pGDIObj = vGDIObj[ nIndex ]; } @@ -560,7 +560,7 @@ void WinMtfOutput::SelectObject( INT32 nIndex ) if ( nIndex & ENHMETA_STOCK_OBJECT ) { - UINT16 nStockId = (BYTE)nIndex; + sal_uInt16 nStockId = (sal_uInt8)nIndex; switch( nStockId ) { case WHITE_BRUSH : @@ -586,7 +586,7 @@ void WinMtfOutput::SelectObject( INT32 nIndex ) break; case NULL_BRUSH : { - pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_TRANSPARENT ), TRUE ) ); + pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_TRANSPARENT ), sal_True ) ); } break; case WHITE_PEN : @@ -601,7 +601,7 @@ void WinMtfOutput::SelectObject( INT32 nIndex ) break; case NULL_PEN : { - pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_TRANSPARENT ), TRUE ) ); + pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_TRANSPARENT ), sal_True ) ); } break; default: @@ -662,7 +662,7 @@ sal_uInt32 WinMtfOutput::GetTextLayoutMode() const //----------------------------------------------------------------------------------- -void WinMtfOutput::SetBkMode( UINT32 nMode ) +void WinMtfOutput::SetBkMode( sal_uInt32 nMode ) { mnBkMode = nMode; } @@ -683,14 +683,14 @@ void WinMtfOutput::SetTextColor( const Color& rColor ) //----------------------------------------------------------------------------------- -void WinMtfOutput::SetTextAlign( UINT32 nAlign ) +void WinMtfOutput::SetTextAlign( sal_uInt32 nAlign ) { mnTextAlign = nAlign; } //----------------------------------------------------------------------------------- -void WinMtfOutput::ImplResizeObjectArry( UINT32 nNewEntrys ) +void WinMtfOutput::ImplResizeObjectArry( sal_uInt32 nNewEntrys ) { sal_uInt32 i = vGDIObj.size(); vGDIObj.resize( nNewEntrys ); @@ -756,7 +756,7 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle ) } } } - UINT32 nIndex; + sal_uInt32 nIndex; for ( nIndex = 0; nIndex < vGDIObj.size(); nIndex++ ) { if ( vGDIObj[ nIndex ] == NULL ) @@ -770,7 +770,7 @@ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle ) //----------------------------------------------------------------------------------- -void WinMtfOutput::CreateObject( INT32 nIndex, GDIObjectType eType, void* pStyle ) +void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pStyle ) { if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 ) { @@ -793,7 +793,7 @@ void WinMtfOutput::CreateObject( INT32 nIndex, GDIObjectType eType, void* pStyle } } } - if ( (UINT32)nIndex >= vGDIObj.size() ) + if ( (sal_uInt32)nIndex >= vGDIObj.size() ) ImplResizeObjectArry( nIndex + 16 ); if ( vGDIObj[ nIndex ] != NULL ) @@ -935,7 +935,7 @@ WinMtfOutput::~WinMtfOutput() else mpGDIMetaFile->SetPrefSize( mrclFrame.GetSize() ); - for ( UINT32 i = 0; i < vGDIObj.size(); i++ ) + for ( sal_uInt32 i = 0; i < vGDIObj.size(); i++ ) delete vGDIObj[ i ]; }; @@ -971,7 +971,7 @@ void WinMtfOutput::UpdateClipRegion() void WinMtfOutput::ImplSetNonPersistentLineColorTransparenz() { Color aColor( COL_TRANSPARENT); - WinMtfLineStyle aTransparentLine( aColor, TRUE ); + WinMtfLineStyle aTransparentLine( aColor, sal_True ); if ( ! ( maLatestLineStyle == aTransparentLine ) ) { maLatestLineStyle = aTransparentLine; @@ -1006,7 +1006,7 @@ void WinMtfOutput::UpdateFillStyle() //----------------------------------------------------------------------------------- -sal_uInt32 WinMtfOutput::SetRasterOp( UINT32 nRasterOp ) +sal_uInt32 WinMtfOutput::SetRasterOp( sal_uInt32 nRasterOp ) { sal_uInt32 nRetROP = mnRop; if ( nRasterOp != mnRop ) @@ -1039,8 +1039,8 @@ sal_uInt32 WinMtfOutput::SetRasterOp( UINT32 nRasterOp ) { aNopFillStyle = maFillStyle; aNopLineStyle = maLineStyle; - maFillStyle = WinMtfFillStyle( Color( COL_TRANSPARENT ), TRUE ); - maLineStyle = WinMtfLineStyle( Color( COL_TRANSPARENT ), TRUE ); + maFillStyle = WinMtfFillStyle( Color( COL_TRANSPARENT ), sal_True ); + maLineStyle = WinMtfLineStyle( Color( COL_TRANSPARENT ), sal_True ); mbNopMode = sal_True; } } @@ -1070,7 +1070,7 @@ void WinMtfOutput::StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill ) if ( !bStroke ) { mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) ); - mpGDIMetaFile->AddAction( new MetaLineColorAction( Color(), FALSE ) ); + mpGDIMetaFile->AddAction( new MetaLineColorAction( Color(), sal_False ) ); } if ( aPathObj.Count() == 1 ) mpGDIMetaFile->AddAction( new MetaPolygonAction( aPathObj.GetObject( 0 ) ) ); @@ -1135,7 +1135,7 @@ void WinMtfOutput::DrawLine( const Point& rSource, const Point& rDest ) //----------------------------------------------------------------------------------- -void WinMtfOutput::DrawRect( const Rectangle& rRect, BOOL bEdge ) +void WinMtfOutput::DrawRect( const Rectangle& rRect, sal_Bool bEdge ) { UpdateClipRegion(); UpdateFillStyle(); @@ -1209,7 +1209,7 @@ void WinMtfOutput::DrawEllipse( const Rectangle& rRect ) //----------------------------------------------------------------------------------- -void WinMtfOutput::DrawArc( const Rectangle& rRect, const Point& rStart, const Point& rEnd, BOOL bTo ) +void WinMtfOutput::DrawArc( const Rectangle& rRect, const Point& rStart, const Point& rEnd, sal_Bool bTo ) { UpdateClipRegion(); UpdateLineStyle(); @@ -1311,7 +1311,7 @@ void WinMtfOutput::DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath ) { if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) ) { - USHORT nCount = rPolygon.GetSize(); + sal_uInt16 nCount = rPolygon.GetSize(); if ( nCount ) { if ( rPolygon[ nCount - 1 ] != rPolygon[ 0 ] ) @@ -1554,7 +1554,7 @@ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry pVDev->SetFont( maFont ); if( pDXArry ) { - UINT32 nLen = rText.Len(); + sal_uInt32 nLen = rText.Len(); nTextWidth = pVDev->GetTextWidth( rText.GetChar( (sal_uInt16)( nLen - 1 ) ) ); if( nLen > 1 ) nTextWidth += pDXArry[ nLen - 2 ]; @@ -1634,7 +1634,7 @@ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const B const Point aEmptyPoint; // #i50672# Extract whole VDev content (to match size of rBitmap) - aVDev.EnableMapMode( FALSE ); + aVDev.EnableMapMode( sal_False ); Bitmap aMask( aVDev.GetBitmap( aEmptyPoint, aSizePixel ).CreateMask( Color( COL_WHITE ) ) ); if ( aBmpEx.IsTransparent() ) @@ -1703,7 +1703,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) { // patterns aren't well supported yet sal_uInt32 nOldRop = SetRasterOp( ROP_OVERPAINT ); // in this case nRasterOperation is either 0 or 0xff UpdateFillStyle(); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); SetRasterOp( nOldRop ); } else @@ -1768,7 +1768,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) if ( nOperation == 0x1 ) { SetRasterOp( R2_NOT ); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); } } break; @@ -1786,7 +1786,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) if ( nOperation == 0x7 ) { SetRasterOp( R2_NOT ); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); } } break; @@ -1795,7 +1795,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) case 0xb : { SetRasterOp( R2_NOT ); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); SetRasterOp( R2_COPYPEN ); Bitmap aMask( aBitmap ); aBitmap.Invert(); @@ -1806,7 +1806,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) if ( nOperation == 0xb ) { SetRasterOp( R2_NOT ); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); } } break; @@ -1823,7 +1823,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) if ( nOperation == 0xd ) { SetRasterOp( R2_NOT ); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); } } break; @@ -1835,7 +1835,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) if ( nOperation == 0x9 ) { SetRasterOp( R2_NOT ); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); } } break; @@ -1845,7 +1845,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) { // in this case nRasterOperation is either 0 or 0xff maFillStyle = WinMtfFillStyle( Color( nRasterOperation, nRasterOperation, nRasterOperation ) ); UpdateFillStyle(); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); } break; @@ -1861,7 +1861,7 @@ void WinMtfOutput::ResolveBitmapActions( List& rSaveList ) case 0x5 : // only destination is used { SetRasterOp( R2_NOT ); - DrawRect( aRect, FALSE ); + DrawRect( aRect, sal_False ); } case 0xa : // no operation break; @@ -1890,7 +1890,7 @@ void WinMtfOutput::SetDevOrg( const Point& rPoint ) //----------------------------------------------------------------------------------- -void WinMtfOutput::SetDevOrgOffset( INT32 nXAdd, INT32 nYAdd ) +void WinMtfOutput::SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ) { mnDevOrgX += nXAdd; mnDevOrgY += nYAdd; @@ -1932,7 +1932,7 @@ void WinMtfOutput::SetWinOrg( const Point& rPoint ) //----------------------------------------------------------------------------------- -void WinMtfOutput::SetWinOrgOffset( INT32 nXAdd, INT32 nYAdd ) +void WinMtfOutput::SetWinOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ) { mnWinOrgX += nXAdd; mnWinOrgY += nYAdd; @@ -2026,7 +2026,7 @@ void WinMtfOutput::SetWorldTransform( const XForm& rXForm ) //----------------------------------------------------------------------------------- -void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, UINT32 nMode ) +void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ) { switch( nMode ) { diff --git a/svtools/source/filter.vcl/wmf/winmtf.hxx b/svtools/source/filter.vcl/wmf/winmtf.hxx index a068ad3eb3da..d6db4b6fcdd6 100644 --- a/svtools/source/filter.vcl/wmf/winmtf.hxx +++ b/svtools/source/filter.vcl/wmf/winmtf.hxx @@ -142,19 +142,19 @@ struct LOGFONTW { - INT32 lfHeight; - INT32 lfWidth; - INT32 lfEscapement; - INT32 lfOrientation; - INT32 lfWeight; - BYTE lfItalic; - BYTE lfUnderline; - BYTE lfStrikeOut; - BYTE lfCharSet; - BYTE lfOutPrecision; - BYTE lfClipPrecision; - BYTE lfQuality; - BYTE lfPitchAndFamily; + sal_Int32 lfHeight; + sal_Int32 lfWidth; + sal_Int32 lfEscapement; + sal_Int32 lfOrientation; + sal_Int32 lfWeight; + sal_uInt8 lfItalic; + sal_uInt8 lfUnderline; + sal_uInt8 lfStrikeOut; + sal_uInt8 lfCharSet; + sal_uInt8 lfOutPrecision; + sal_uInt8 lfClipPrecision; + sal_uInt8 lfQuality; + sal_uInt8 lfPitchAndFamily; String alfFaceName; }; @@ -361,18 +361,18 @@ typedef enum { struct WinMtfFillStyle { Color aFillColor; - BOOL bTransparent; + sal_Bool bTransparent; WinMtfFillStyleType aType; Bitmap aBmp; WinMtfFillStyle() : aFillColor(Color(COL_BLACK)) - , bTransparent(FALSE) + , bTransparent(sal_False) , aType(FillStyleSolid) { } - WinMtfFillStyle( const Color& rColor, BOOL bTrans = FALSE ) + WinMtfFillStyle( const Color& rColor, sal_Bool bTrans = sal_False ) : aFillColor(rColor) , bTransparent(bTrans) , aType(FillStyleSolid) @@ -385,9 +385,9 @@ struct WinMtfFillStyle { } - BOOL operator==( const WinMtfFillStyle& rStyle ) + sal_Bool operator==( const WinMtfFillStyle& rStyle ) { return ( ( aFillColor == rStyle.aFillColor ) && ( bTransparent == rStyle.bTransparent ) && ( aType == rStyle.aType ) ); } - BOOL operator==( WinMtfFillStyle* pStyle ) + sal_Bool operator==( WinMtfFillStyle* pStyle ) { return ( ( aFillColor == pStyle->aFillColor ) && ( bTransparent == pStyle->bTransparent ) && ( aType == pStyle->aType ) ); } WinMtfFillStyle& operator=( const WinMtfFillStyle& rStyle ) { aFillColor = rStyle.aFillColor; bTransparent = rStyle.bTransparent; aBmp = rStyle.aBmp; aType = rStyle.aType; return *this; } WinMtfFillStyle& operator=( WinMtfFillStyle* pStyle ) { aFillColor = pStyle->aFillColor; bTransparent = pStyle->bTransparent; aBmp = pStyle->aBmp; aType = pStyle->aType; return *this; } @@ -399,23 +399,23 @@ struct WinMtfLineStyle { Color aLineColor; LineInfo aLineInfo; - BOOL bTransparent; + sal_Bool bTransparent; WinMtfLineStyle() : aLineColor ( COL_BLACK ), - bTransparent( FALSE ) {} + bTransparent( sal_False ) {} - WinMtfLineStyle( const Color& rColor, BOOL bTrans = FALSE ) : + WinMtfLineStyle( const Color& rColor, sal_Bool bTrans = sal_False ) : aLineColor ( rColor ), bTransparent( bTrans ) {} - WinMtfLineStyle( const Color& rColor, const LineInfo rStyle, BOOL bTrans = FALSE ) : + WinMtfLineStyle( const Color& rColor, const LineInfo rStyle, sal_Bool bTrans = sal_False ) : aLineColor ( rColor ), aLineInfo ( rStyle ), bTransparent( bTrans ) {} - BOOL operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); } - BOOL operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); } + sal_Bool operator==( const WinMtfLineStyle& rStyle ) { return ( ( aLineColor == rStyle.aLineColor ) && ( bTransparent == rStyle.bTransparent ) && ( aLineInfo == rStyle.aLineInfo ) ); } + sal_Bool operator==( WinMtfLineStyle* pStyle ) { return ( ( aLineColor == pStyle->aLineColor ) && ( bTransparent == pStyle->bTransparent ) && ( aLineInfo == pStyle->aLineInfo ) ); } WinMtfLineStyle& operator=( const WinMtfLineStyle& rStyle ) { aLineColor = rStyle.aLineColor; @@ -486,10 +486,10 @@ struct BSaveStruct { Bitmap aBmp; Rectangle aOutRect; - UINT32 nWinRop; + sal_uInt32 nWinRop; WinMtfFillStyle aStyle; - BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, UINT32 nRop, WinMtfFillStyle& rStyle ) : + BSaveStruct( const Bitmap& rBmp, const Rectangle& rOutRect, sal_uInt32 nRop, WinMtfFillStyle& rStyle ) : aBmp( rBmp ), aOutRect( rOutRect ), nWinRop( nRop ), aStyle ( rStyle ){} }; @@ -603,7 +603,7 @@ class WinMtfOutput void ImplMap( Font& rFont ); Polygon& ImplMap( Polygon& rPolygon ); PolyPolygon& ImplMap( PolyPolygon& rPolyPolygon ); - void ImplResizeObjectArry( UINT32 nNewEntry ); + void ImplResizeObjectArry( sal_uInt32 nNewEntry ); void ImplSetNonPersistentLineColorTransparenz(); void ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly ); void ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap ); @@ -611,12 +611,12 @@ class WinMtfOutput public: void SetDevOrg( const Point& rPoint ); - void SetDevOrgOffset( INT32 nXAdd, INT32 nYAdd ); + void SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd ); void SetDevExt( const Size& rSize ); void ScaleDevExt( double fX, double fY ); void SetWinOrg( const Point& rPoint ); - void SetWinOrgOffset( INT32 nX, INT32 nY ); + void SetWinOrgOffset( sal_Int32 nX, sal_Int32 nY ); void SetWinExt( const Size& rSize ); void ScaleWinExt( double fX, double fY ); @@ -628,24 +628,24 @@ class WinMtfOutput sal_uInt32 GetMapMode() const { return mnMapMode; }; void SetMapMode( sal_uInt32 mnMapMode ); void SetWorldTransform( const XForm& rXForm ); - void ModifyWorldTransform( const XForm& rXForm, UINT32 nMode ); + void ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode ); void Push(); void Pop(); - UINT32 SetRasterOp( UINT32 nRasterOp ); + sal_uInt32 SetRasterOp( sal_uInt32 nRasterOp ); void StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill ); void SetGfxMode( sal_Int32 nGfxMode ){ mnGfxMode = nGfxMode; }; sal_Int32 GetGfxMode() const { return mnGfxMode; }; - void SetBkMode( UINT32 nMode ); + void SetBkMode( sal_uInt32 nMode ); void SetBkColor( const Color& rColor ); void SetTextColor( const Color& rColor ); - void SetTextAlign( UINT32 nAlign ); + void SetTextAlign( sal_uInt32 nAlign ); void CreateObject( GDIObjectType, void* pStyle = NULL ); - void CreateObject( INT32 nIndex, GDIObjectType, void* pStyle = NULL ); - void DeleteObject( INT32 nIndex ); - void SelectObject( INT32 nIndex ); + void CreateObject( sal_Int32 nIndex, GDIObjectType, void* pStyle = NULL ); + void DeleteObject( sal_Int32 nIndex ); + void SelectObject( sal_Int32 nIndex ); CharSet GetCharSet(){ return maFont.GetCharSet(); }; WinMtfFillStyle& GetFillStyle () { return maFillStyle; } void SetFont( const Font& rFont ); @@ -661,10 +661,10 @@ class WinMtfOutput void LineTo( const Point& rPoint, sal_Bool bRecordPath = sal_False ); void DrawPixel( const Point& rSource, const Color& rColor ); void DrawLine( const Point& rSource, const Point& rDest ); - void DrawRect( const Rectangle& rRect, BOOL bEdge = TRUE ); + void DrawRect( const Rectangle& rRect, sal_Bool bEdge = sal_True ); void DrawRoundRect( const Rectangle& rRect, const Size& rSize ); void DrawEllipse( const Rectangle& rRect ); - void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, BOOL bDrawTo = FALSE ); + void DrawArc( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle, sal_Bool bDrawTo = sal_False ); void DrawPie( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ); void DrawChord( const Rectangle& rRect, const Point& rStartAngle, const Point& rEndAngle ); void DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath = sal_False ); @@ -698,7 +698,7 @@ class WinMtf WinMtfOutput* pOut; // SvStream* pWMF; // Die einzulesende WMF/EMF-Datei - UINT32 nStartPos, nEndPos; + sal_uInt32 nStartPos, nEndPos; List aBmpSaveList; FilterConfigItem* pFilterConfigItem; @@ -708,7 +708,7 @@ class WinMtf // Sorgt dafuer, das aSampledBrush der aktuelle Brush des GDIMetaFiles ist. Color ReadColor(); - void Callback( USHORT nPercent ); + void Callback( sal_uInt16 nPercent ); WinMtf( WinMtfOutput* pOut, SvStream& rStreamWMF, FilterConfigItem* pConfigItem = NULL ); ~WinMtf(); @@ -726,16 +726,16 @@ class EnhWMFReader : public WinMtf BOOL bEMFPlus; - BOOL ReadHeader(); - Rectangle ReadRectangle( INT32, INT32, INT32, INT32 ); // Liesst und konvertiert ein Rechteck - void ImplExtTextOut( BOOL bWideCharakter ); + sal_Bool ReadHeader(); + Rectangle ReadRectangle( sal_Int32, sal_Int32, sal_Int32, sal_Int32 ); // Liesst und konvertiert ein Rechteck + void ImplExtTextOut( sal_Bool bWideCharakter ); public: EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL ) : WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ), bEMFPlus (FALSE) {}; ~EnhWMFReader(); - BOOL ReadEnhWMF(); + sal_Bool ReadEnhWMF(); void ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC); void ReadGDIComment(); }; @@ -747,7 +747,7 @@ class WMFReader : public WinMtf private: VirtualDevice aVDev; // just for the purpose of "IsFontAvailable" - UINT16 nUnitsPerInch; + sal_uInt16 nUnitsPerInch; sal_uInt32 nRecSize; // embedded EMF data @@ -767,10 +767,10 @@ private: sal_uInt32 nUnicodeEscapeAction; // Liesst den Kopf der WMF-Datei - BOOL ReadHeader(); + sal_Bool ReadHeader(); // Liesst die Parameter des Rocords mit der Funktionsnummer nFunction. - void ReadRecordParams( USHORT nFunction ); + void ReadRecordParams( sal_uInt16 nFunction ); Point ReadPoint(); // Liesst und konvertiert einen Punkt (erst X dann Y) Point ReadYX(); // Liesst und konvertiert einen Punkt (erst Y dann X) diff --git a/svtools/source/filter.vcl/wmf/winwmf.cxx b/svtools/source/filter.vcl/wmf/winwmf.cxx index e2e9c4de3bd9..c7d33a824adf 100644 --- a/svtools/source/filter.vcl/wmf/winwmf.cxx +++ b/svtools/source/filter.vcl/wmf/winwmf.cxx @@ -157,7 +157,7 @@ Size WMFReader::ReadYXExt() // ------------------------------------------------------------------------ -void WMFReader::ReadRecordParams( USHORT nFunc ) +void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) { switch( nFunc ) { @@ -169,7 +169,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_SETBKMODE: { - USHORT nDat; + sal_uInt16 nDat; *pWMF >> nDat; pOut->SetBkMode( nDat ); } @@ -186,7 +186,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_SETROP2: { - UINT16 nROP2; + sal_uInt16 nROP2; *pWMF >> nROP2; pOut->SetRasterOp( nROP2 ); } @@ -323,7 +323,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_POLYGON: { - USHORT i,nPoints; + sal_uInt16 i,nPoints; *pWMF >> nPoints; Polygon aPoly( nPoints ); for( i = 0; i < nPoints; i++ ) @@ -334,13 +334,13 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_POLYPOLYGON: { - USHORT i, nPoly, nPoints; - USHORT* pnPoints; + sal_uInt16 i, nPoly, nPoints; + sal_uInt16* pnPoints; Point* pPtAry; // Anzahl der Polygone: *pWMF >> nPoly; // Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln: - pnPoints = new USHORT[ nPoly ]; + pnPoints = new sal_uInt16[ nPoly ]; nPoints = 0; for( i = 0; i < nPoly; i++ ) { @@ -361,7 +361,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_POLYLINE: { - USHORT i,nPoints; + sal_uInt16 i,nPoints; *pWMF >> nPoints; Polygon aPoly( nPoints ); for( i = 0; i < nPoints; i++ ) @@ -397,7 +397,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_TEXTOUT: { - USHORT nLength; + sal_uInt16 nLength; *pWMF >> nLength; if ( nLength ) { @@ -454,7 +454,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) sal_uInt32 nMaxStreamPos = nRecordPos + ( nRecordSize << 1 ); sal_Int32 nDxArySize = nMaxStreamPos - pWMF->Tell(); sal_Int32 nDxAryEntries = nDxArySize >> 1; - sal_Bool bUseDXAry = FALSE; + sal_Bool bUseDXAry = sal_False; if ( ( ( nDxAryEntries % nOriginalTextLen ) == 0 ) && ( nNewTextLen <= nOriginalTextLen ) ) { @@ -482,7 +482,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) pDXAry[ i ] = nDx; } if ( i == nNewTextLen ) - bUseDXAry = TRUE; + bUseDXAry = sal_True; } if ( pDXAry && bUseDXAry ) pOut->DrawText( aPosition, aText, pDXAry ); @@ -497,7 +497,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_SELECTOBJECT: { - INT16 nObjIndex; + sal_Int16 nObjIndex; *pWMF >> nObjIndex; pOut->SelectObject( nObjIndex ); } @@ -505,7 +505,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_SETTEXTALIGN: { - UINT16 nAlign; + sal_uInt16 nAlign; *pWMF >> nAlign; pOut->SetTextAlign( nAlign ); } @@ -603,14 +603,14 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) { if ( nWinROP == PATCOPY ) *pWMF >> nUsage; // i don't know anything of this parameter, so its called nUsage - // pOut->DrawRect( Rectangle( ReadYX(), aDestSize ), FALSE ); + // pOut->DrawRect( Rectangle( ReadYX(), aDestSize ), sal_False ); Size aDestSize( ReadYXExt() ); if ( aDestSize.Width() && aDestSize.Height() ) // #92623# do not try to read buggy bitmaps { Rectangle aDestRect( ReadYX(), aDestSize ); if ( nWinROP != PATCOPY ) - aBmp.Read( *pWMF, FALSE ); + aBmp.Read( *pWMF, sal_False ); // test if it is sensible to crop if ( nSye && nSxe && @@ -630,18 +630,18 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) { Bitmap aBmp; BitmapReadAccess* pBmp; - UINT32 nRed = 0, nGreen = 0, nBlue = 0, nCount = 1; - UINT16 nFunction; + sal_uInt32 nRed = 0, nGreen = 0, nBlue = 0, nCount = 1; + sal_uInt16 nFunction; *pWMF >> nFunction >> nFunction; - aBmp.Read( *pWMF, FALSE ); + aBmp.Read( *pWMF, sal_False ); pBmp = aBmp.AcquireReadAccess(); if ( pBmp ) { - for ( INT32 y = 0; y < pBmp->Height(); y++ ) + for ( sal_Int32 y = 0; y < pBmp->Height(); y++ ) { - for ( INT32 x = 0; x < pBmp->Width(); x++ ) + for ( sal_Int32 x = 0; x < pBmp->Width(); x++ ) { const BitmapColor aColor( pBmp->GetColor( y, x ) ); @@ -655,14 +655,14 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) nCount++; aBmp.ReleaseAccess( pBmp ); } - Color aColor( (BYTE)( nRed / nCount ), (BYTE)( nGreen / nCount ), (BYTE)( nBlue / nCount ) ); - pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( aColor, FALSE ) ); + Color aColor( (sal_uInt8)( nRed / nCount ), (sal_uInt8)( nGreen / nCount ), (sal_uInt8)( nBlue / nCount ) ); + pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( aColor, sal_False ) ); } break; case W_META_DELETEOBJECT: { - INT16 nIndex; + sal_Int16 nIndex; *pWMF >> nIndex; pOut->DeleteObject( nIndex ); } @@ -676,29 +676,29 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_CREATEBRUSH: { - pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ), FALSE ) ); + pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ), sal_False ) ); } break; case W_META_CREATEPATTERNBRUSH: { - pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ), FALSE ) ); + pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ), sal_False ) ); } break; case W_META_CREATEPENINDIRECT: { LineInfo aLineInfo; - USHORT nStyle, nWidth, nHeight; + sal_uInt16 nStyle, nWidth, nHeight; *pWMF >> nStyle >> nWidth >> nHeight; if ( nWidth ) aLineInfo.SetWidth( nWidth ); - BOOL bTransparent = FALSE; - UINT16 nDashCount = 0; - UINT16 nDotCount = 0; + sal_Bool bTransparent = sal_False; + sal_uInt16 nDashCount = 0; + sal_uInt16 nDotCount = 0; switch( nStyle ) { case PS_DASHDOTDOT : @@ -712,7 +712,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) nDashCount++; break; case PS_NULL : - bTransparent = TRUE; + bTransparent = sal_True; aLineInfo.SetStyle( LINE_NONE ); break; default : @@ -732,9 +732,9 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_CREATEBRUSHINDIRECT: { - USHORT nStyle; + sal_uInt16 nStyle; *pWMF >> nStyle; - pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? TRUE : FALSE ) ); + pOut->CreateObject( GDI_BRUSH, new WinMtfFillStyle( ReadColor(), ( nStyle == BS_HOLLOW ) ? sal_True : sal_False ) ); } break; @@ -742,7 +742,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) { Size aFontSize; char lfFaceName[ LF_FACESIZE ]; - INT16 lfEscapement, lfOrientation, lfWeight; // ( ehemals USHORT ) + sal_Int16 lfEscapement, lfOrientation, lfWeight; // ( ehemals sal_uInt16 ) LOGFONTW aLogFont; aFontSize = ReadYXExt(); @@ -797,11 +797,11 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) case W_META_PATBLT: { - UINT32 nROP, nOldROP; + sal_uInt32 nROP, nOldROP; *pWMF >> nROP; Size aSize = ReadYXExt(); nOldROP = pOut->SetRasterOp( nROP ); - pOut->DrawRect( Rectangle( ReadYX(), aSize ), FALSE ); + pOut->DrawRect( Rectangle( ReadYX(), aSize ), sal_False ); pOut->SetRasterOp( nOldROP ); } break; @@ -997,7 +997,7 @@ void WMFReader::ReadRecordParams( USHORT nFunc ) // ------------------------------------------------------------------------ -BOOL WMFReader::ReadHeader() +sal_Bool WMFReader::ReadHeader() { Rectangle aPlaceableBound; sal_uInt32 nl, nStrmPos = pWMF->Tell(); @@ -1008,7 +1008,7 @@ BOOL WMFReader::ReadHeader() Size aWMFSize; if ( nl == 0x9ac6cdd7L ) { - INT16 nVal; + sal_Int16 nVal; // hmf (Unused) ueberlesen wir pWMF->SeekRel(2); @@ -1056,7 +1056,7 @@ BOOL WMFReader::ReadHeader() if( nl != 0x00090001 ) { pWMF->SetError( SVSTREAM_FILEFORMAT_ERROR ); - return FALSE; + return sal_False; } pWMF->SeekRel( 2 ); // Version (von Windows) @@ -1065,13 +1065,13 @@ BOOL WMFReader::ReadHeader() pWMF->SeekRel( 4 ); // MaxRecord (Groesse des groessten Records in Words) pWMF->SeekRel( 2 ); // NoParameters (Unused - return TRUE; + return sal_True; } void WMFReader::ReadWMF() { - USHORT nFunction; - ULONG nPos, nPercent, nLastPercent; + sal_uInt16 nFunction; + sal_uLong nPos, nPercent, nLastPercent; nSkipActions = 0; nCurrentAction = 0; @@ -1091,7 +1091,7 @@ void WMFReader::ReadWMF() nEndPos=pWMF->Seek( STREAM_SEEK_TO_END ); pWMF->Seek( nStartPos ); - Callback( (USHORT) ( nLastPercent = 0 ) ); + Callback( (sal_uInt16) ( nLastPercent = 0 ) ); if ( ReadHeader() ) { @@ -1100,14 +1100,14 @@ void WMFReader::ReadWMF() if( nEndPos - nStartPos ) { - while( TRUE ) + while( sal_True ) { nCurrentAction++; nPercent = ( nPos - nStartPos ) * 100 / ( nEndPos - nStartPos ); if( nLastPercent + 4 <= nPercent ) { - Callback( (USHORT) nPercent ); + Callback( (sal_uInt16) nPercent ); nLastPercent = nPercent; } *pWMF >> nRecSize >> nFunction; @@ -1289,7 +1289,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_POLYGON: { - USHORT i,nPoints; + sal_uInt16 i,nPoints; *pStm >> nPoints; for( i = 0; i < nPoints; i++ ) GetWinExtMax( ReadPoint(), rPlaceableBound, nMapMode ); @@ -1298,7 +1298,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_POLYPOLYGON: { - USHORT i, nPoly, nPoints = 0; + sal_uInt16 i, nPoly, nPoints = 0; *pStm >> nPoly; for( i = 0; i < nPoly; i++ ) { @@ -1313,7 +1313,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_POLYLINE: { - USHORT i,nPoints; + sal_uInt16 i,nPoints; *pStm >> nPoints; for( i = 0; i < nPoints; i++ ) GetWinExtMax( ReadPoint(), rPlaceableBound, nMapMode ); @@ -1329,7 +1329,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_TEXTOUT: { - USHORT nLength; + sal_uInt16 nLength; *pStm >> nLength; // todo: we also have to take care of the text width if ( nLength ) @@ -1383,7 +1383,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt { if ( nWinROP == PATCOPY ) *pStm >> nUsage; // i don't know anything of this parameter, so its called nUsage - // pOut->DrawRect( Rectangle( ReadYX(), aDestSize ), FALSE ); + // pOut->DrawRect( Rectangle( ReadYX(), aDestSize ), sal_False ); Size aDestSize( ReadYXExt() ); if ( aDestSize.Width() && aDestSize.Height() ) // #92623# do not try to read buggy bitmaps @@ -1397,7 +1397,7 @@ sal_Bool WMFReader::GetPlaceableBound( Rectangle& rPlaceableBound, SvStream* pSt case W_META_PATBLT: { - UINT32 nROP; + sal_uInt32 nROP; *pStm >> nROP; Size aSize = ReadYXExt(); GetWinExtMax( Rectangle( ReadYX(), aSize ), rPlaceableBound, nMapMode ); diff --git a/svtools/source/filter.vcl/wmf/wmf.cxx b/svtools/source/filter.vcl/wmf/wmf.cxx index b56d9d07cc28..d78ce2d160bb 100644 --- a/svtools/source/filter.vcl/wmf/wmf.cxx +++ b/svtools/source/filter.vcl/wmf/wmf.cxx @@ -36,18 +36,18 @@ // ----------------------------------------------------------------------------- -BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem ) +sal_Bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem ) { - UINT32 nMetaType; - UINT32 nOrgPos = rStreamWMF.Tell(); - UINT16 nOrigNumberFormat = rStreamWMF.GetNumberFormatInt(); + sal_uInt32 nMetaType; + sal_uInt32 nOrgPos = rStreamWMF.Tell(); + sal_uInt16 nOrigNumberFormat = rStreamWMF.GetNumberFormatInt(); rStreamWMF.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); rStreamWMF.Seek( 0x28 ); rStreamWMF >> nMetaType; rStreamWMF.Seek( nOrgPos ); if ( nMetaType == 0x464d4520 ) { - if ( EnhWMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadEnhWMF() == FALSE ) + if ( EnhWMFReader( rStreamWMF, rGDIMetaFile, pConfigItem ).ReadEnhWMF() == sal_False ) rStreamWMF.SetError( SVSTREAM_FILEFORMAT_ERROR ); } else @@ -60,18 +60,18 @@ BOOL ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, // ----------------------------------------------------------------------------- -BOOL ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pFilterConfigItem ) +sal_Bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* pFilterConfigItem ) { - UINT32 nMetaType; - UINT32 nOrgPos = rStream.Tell(); - UINT16 nOrigNumberFormat = rStream.GetNumberFormatInt(); + sal_uInt32 nMetaType; + sal_uInt32 nOrgPos = rStream.Tell(); + sal_uInt16 nOrigNumberFormat = rStream.GetNumberFormatInt(); rStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); rStream.Seek( 0x28 ); rStream >> nMetaType; rStream.Seek( nOrgPos ); if ( nMetaType == 0x464d4520 ) { - if ( EnhWMFReader( rStream, rMTF, NULL ).ReadEnhWMF() == FALSE ) + if ( EnhWMFReader( rStream, rMTF, NULL ).ReadEnhWMF() == sal_False ) rStream.SetError( SVSTREAM_FILEFORMAT_ERROR ); } else @@ -84,8 +84,8 @@ BOOL ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF, FilterConfigItem* // ----------------------------------------------------------------------------- -BOOL ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, - FilterConfigItem* pConfigItem, BOOL bPlaceable) +sal_Bool ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, + FilterConfigItem* pConfigItem, sal_Bool bPlaceable) { WMFWriter aWMFWriter; return aWMFWriter.WriteWMF( rMTF, rTargetStream, pConfigItem, bPlaceable ); @@ -93,7 +93,7 @@ BOOL ConvertGDIMetaFileToWMF( const GDIMetaFile & rMTF, SvStream & rTargetStream // ----------------------------------------------------------------------------- -BOOL ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, +sal_Bool ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pConfigItem ) { EMFWriter aEMFWriter(rTargetStream); @@ -102,16 +102,16 @@ BOOL ConvertGDIMetaFileToEMF( const GDIMetaFile & rMTF, SvStream & rTargetStream // ----------------------------------------------------------------------------- -BOOL WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ) +sal_Bool WriteWindowMetafile( SvStream& rStream, const GDIMetaFile& rMTF ) { return WMFWriter().WriteWMF( rMTF, rStream, NULL ); } // ----------------------------------------------------------------------------- -BOOL WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ) +sal_Bool WriteWindowMetafileBits( SvStream& rStream, const GDIMetaFile& rMTF ) { - return WMFWriter().WriteWMF( rMTF, rStream, NULL, FALSE ); + return WMFWriter().WriteWMF( rMTF, rStream, NULL, sal_False ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index 5214918b9870..2e507f835e68 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -252,7 +252,7 @@ void WMFWriter::MayCallback() { if ( xStatusIndicator.is() ) { - ULONG nPercent; + sal_uLong nPercent; // Wir gehen mal einfach so davon aus, dass 16386 Actions einer Bitmap entsprechen // (in der Regel wird ein Metafile entweder nur Actions oder einige Bitmaps und fast @@ -273,7 +273,7 @@ void WMFWriter::MayCallback() void WMFWriter::CountActionsAndBitmaps( const GDIMetaFile & rMTF ) { - ULONG nAction, nActionCount; + sal_uLong nAction, nActionCount; nActionCount = rMTF.GetActionCount(); @@ -341,7 +341,7 @@ void WMFWriter::WriteRectangle(const Rectangle & rRect) void WMFWriter::WriteColor(const Color & rColor) { - *pWMF << (BYTE) rColor.GetRed() << (BYTE) rColor.GetGreen() << (BYTE) rColor.GetBlue() << (BYTE) 0; + *pWMF << (sal_uInt8) rColor.GetRed() << (sal_uInt8) rColor.GetGreen() << (sal_uInt8) rColor.GetBlue() << (sal_uInt8) 0; } @@ -355,12 +355,12 @@ void WMFWriter::WriteRecordHeader(sal_uInt32 nSizeWords, sal_uInt16 nType) void WMFWriter::UpdateRecordHeader() { - ULONG nPos; + sal_uLong nPos; sal_uInt32 nSize; nPos=pWMF->Tell(); nSize=nPos-nActRecordPos; if ((nSize & 1)!=0) { - *pWMF << (BYTE)0; + *pWMF << (sal_uInt8)0; nPos++; nSize++; } nSize/=2; @@ -393,19 +393,19 @@ void WMFWriter::WMFRecord_CreateBrushIndirect(const Color& rColor) WriteRecordHeader(0x00000007,W_META_CREATEBRUSHINDIRECT); if( rColor==Color(COL_TRANSPARENT) ) - *pWMF << (UINT16) W_BS_HOLLOW; + *pWMF << (sal_uInt16) W_BS_HOLLOW; else - *pWMF << (UINT16) W_BS_SOLID; + *pWMF << (sal_uInt16) W_BS_SOLID; WriteColor( rColor ); - *pWMF << (UINT16) 0; + *pWMF << (sal_uInt16) 0; } void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont) { - USHORT nWeight,i; - BYTE nPitchFamily; + sal_uInt16 nWeight,i; + sal_uInt8 nPitchFamily; WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT); WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height())); @@ -426,9 +426,9 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont) } *pWMF << nWeight; - if (rFont.GetItalic()==ITALIC_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1; - if (rFont.GetUnderline()==UNDERLINE_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1; - if (rFont.GetStrikeout()==STRIKEOUT_NONE) *pWMF << (BYTE)0; else *pWMF << (BYTE)1; + if (rFont.GetItalic()==ITALIC_NONE) *pWMF << (sal_uInt8)0; else *pWMF << (sal_uInt8)1; + if (rFont.GetUnderline()==UNDERLINE_NONE) *pWMF << (sal_uInt8)0; else *pWMF << (sal_uInt8)1; + if (rFont.GetStrikeout()==STRIKEOUT_NONE) *pWMF << (sal_uInt8)0; else *pWMF << (sal_uInt8)1; CharSet eFontNameEncoding = rFont.GetCharSet(); sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding( eFontNameEncoding ); @@ -438,7 +438,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont) nCharSet = W_ANSI_CHARSET; *pWMF << nCharSet; - *pWMF << (BYTE)0 << (BYTE)0 << (BYTE)0; + *pWMF << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0; switch (rFont.GetPitch()) { case PITCH_FIXED: nPitchFamily=W_FIXED_PITCH; break; @@ -467,7 +467,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont) void WMFWriter::WMFRecord_CreatePenIndirect(const Color& rColor, const LineInfo& rLineInfo ) { WriteRecordHeader(0x00000008,W_META_CREATEPENINDIRECT); - USHORT nStyle = rColor == Color( COL_TRANSPARENT ) ? W_PS_NULL : W_PS_SOLID; + sal_uInt16 nStyle = rColor == Color( COL_TRANSPARENT ) ? W_PS_NULL : W_PS_SOLID; switch( rLineInfo.GetStyle() ) { case LINE_DASH : @@ -500,7 +500,7 @@ void WMFWriter::WMFRecord_CreatePenIndirect(const Color& rColor, const LineInfo& WriteColor( rColor ); } -void WMFWriter::WMFRecord_DeleteObject(USHORT nObjectHandle) +void WMFWriter::WMFRecord_DeleteObject(sal_uInt16 nObjectHandle) { WriteRecordHeader(0x00000004,W_META_DELETEOBJECT); *pWMF << nObjectHandle; @@ -721,7 +721,7 @@ void WMFWriter::WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, c void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly) { - USHORT nSize,i; + sal_uInt16 nSize,i; Polygon aSimplePoly; if ( rPoly.HasFlags() ) @@ -729,7 +729,7 @@ void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly) else aSimplePoly = rPoly; nSize = aSimplePoly.GetSize(); - WriteRecordHeader(((ULONG)nSize)*2+4,W_META_POLYGON); + WriteRecordHeader(((sal_uLong)nSize)*2+4,W_META_POLYGON); *pWMF << nSize; for (i=0; i<nSize; i++) WritePointXY(aSimplePoly.GetPoint(i)); } @@ -737,14 +737,14 @@ void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly) void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly) { - USHORT nSize,i; + sal_uInt16 nSize,i; Polygon aSimplePoly; if ( rPoly.HasFlags() ) rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; nSize=aSimplePoly.GetSize(); - WriteRecordHeader(((ULONG)nSize)*2+4,W_META_POLYLINE); + WriteRecordHeader(((sal_uLong)nSize)*2+4,W_META_POLYLINE); *pWMF << nSize; for (i=0; i<nSize; i++) WritePointXY(aSimplePoly.GetPoint(i)); } @@ -753,7 +753,7 @@ void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly) void WMFWriter::WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly) { const Polygon * pPoly; - USHORT nCount,nSize,i,j; + sal_uInt16 nCount,nSize,i,j; nCount=rPolyPoly.Count(); PolyPolygon aSimplePolyPoly( rPolyPoly ); @@ -768,7 +768,7 @@ void WMFWriter::WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly) } WriteRecordHeader(0,W_META_POLYPOLYGON); *pWMF << nCount; - for (i=0; i<nCount; i++) *pWMF << ((USHORT)(aSimplePolyPoly.GetObject(i).GetSize())); + for (i=0; i<nCount; i++) *pWMF << ((sal_uInt16)(aSimplePolyPoly.GetObject(i).GetSize())); for (i=0; i<nCount; i++) { pPoly=&(aSimplePolyPoly.GetObject(i)); nSize=pPoly->GetSize(); @@ -806,24 +806,24 @@ void WMFWriter::WMFRecord_SaveDC() } -void WMFWriter::WMFRecord_SelectObject(USHORT nObjectHandle) +void WMFWriter::WMFRecord_SelectObject(sal_uInt16 nObjectHandle) { WriteRecordHeader(0x00000004,W_META_SELECTOBJECT); *pWMF << nObjectHandle; } -void WMFWriter::WMFRecord_SetBkMode(BOOL bTransparent) +void WMFWriter::WMFRecord_SetBkMode(sal_Bool bTransparent) { WriteRecordHeader(0x00000004,W_META_SETBKMODE); - if (bTransparent==TRUE) *pWMF << (USHORT)W_TRANSPARENT; - else *pWMF << (USHORT)W_OPAQUE; + if (bTransparent==sal_True) *pWMF << (sal_uInt16)W_TRANSPARENT; + else *pWMF << (sal_uInt16)W_OPAQUE; } void WMFWriter::WMFRecord_SetStretchBltMode() { WriteRecordHeader( 0x00000004, W_META_SETSTRETCHBLTMODE ); - *pWMF << (USHORT) 3; // STRETCH_DELETESCANS + *pWMF << (sal_uInt16) 3; // STRETCH_DELETESCANS } void WMFWriter::WMFRecord_SetPixel(const Point & rPoint, const Color & rColor) @@ -836,7 +836,7 @@ void WMFWriter::WMFRecord_SetPixel(const Point & rPoint, const Color & rColor) void WMFWriter::WMFRecord_SetROP2(RasterOp eROP) { - USHORT nROP2; + sal_uInt16 nROP2; switch (eROP) { case ROP_INVERT: nROP2=W_R2_NOT; break; @@ -848,9 +848,9 @@ void WMFWriter::WMFRecord_SetROP2(RasterOp eROP) } -void WMFWriter::WMFRecord_SetTextAlign(FontAlign eFontAlign, UINT32 eHorTextAlign) +void WMFWriter::WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt32 eHorTextAlign) { - USHORT nAlign; + sal_uInt16 nAlign; switch (eFontAlign) { case ALIGN_TOP: nAlign=W_TA_TOP; break; @@ -889,7 +889,7 @@ void WMFWriter::WMFRecord_SetWindowOrg(const Point & rPoint) void WMFWriter::WMFRecord_StretchDIB( const Point & rPoint, const Size & rSize, const Bitmap & rBitmap, sal_uInt32 nROP ) { - ULONG nPosAnf,nPosEnd; + sal_uLong nPosAnf,nPosEnd; nActBitmapPercent=50; MayCallback(); @@ -949,14 +949,14 @@ void WMFWriter::WMFRecord_TextOut(const Point & rPoint, const String & rStr) void WMFWriter::TrueTextOut(const Point & rPoint, const ByteString& rString) { - USHORT nLen,i; + sal_uInt16 nLen,i; WriteRecordHeader(0,W_META_TEXTOUT); nLen=rString.Len(); *pWMF << nLen; for ( i = 0; i < nLen; i++ ) - *pWMF << (BYTE)rString.GetChar( i ); - if ((nLen&1)!=0) *pWMF << (BYTE)0; + *pWMF << (sal_uInt8)rString.GetChar( i ); + if ((nLen&1)!=0) *pWMF << (sal_uInt8)0; WritePointYX(rPoint); UpdateRecordHeader(); } @@ -974,30 +974,30 @@ void WMFWriter::WMFRecord_IntersectClipRect( const Rectangle& rRect ) } -USHORT WMFWriter::AllocHandle() +sal_uInt16 WMFWriter::AllocHandle() { - USHORT i; + sal_uInt16 i; for (i=0; i<MAXOBJECTHANDLES; i++) { - if (bHandleAllocated[i]==FALSE) { - bHandleAllocated[i]=TRUE; + if (bHandleAllocated[i]==sal_False) { + bHandleAllocated[i]=sal_True; return i; } } - bStatus=FALSE; + bStatus=sal_False; return 0xffff; } -void WMFWriter::FreeHandle(USHORT nObjectHandle) +void WMFWriter::FreeHandle(sal_uInt16 nObjectHandle) { - if (nObjectHandle<MAXOBJECTHANDLES) bHandleAllocated[nObjectHandle]=FALSE; + if (nObjectHandle<MAXOBJECTHANDLES) bHandleAllocated[nObjectHandle]=sal_False; } void WMFWriter::CreateSelectDeletePen( const Color& rColor, const LineInfo& rLineInfo ) { - USHORT nOldHandle; + sal_uInt16 nOldHandle; nOldHandle=nDstPenHandle; nDstPenHandle=AllocHandle(); @@ -1012,7 +1012,7 @@ void WMFWriter::CreateSelectDeletePen( const Color& rColor, const LineInfo& rLin void WMFWriter::CreateSelectDeleteFont(const Font & rFont) { - USHORT nOldHandle; + sal_uInt16 nOldHandle; nOldHandle=nDstFontHandle; nDstFontHandle=AllocHandle(); @@ -1027,7 +1027,7 @@ void WMFWriter::CreateSelectDeleteFont(const Font & rFont) void WMFWriter::CreateSelectDeleteBrush(const Color& rColor) { - USHORT nOldHandle; + sal_uInt16 nOldHandle; nOldHandle=nDstBrushHandle; nDstBrushHandle=AllocHandle(); @@ -1059,7 +1059,7 @@ void WMFWriter::SetLineAndFillAttr() CreateSelectDeleteBrush( aDstFillColor ); } if ( bDstIsClipping != bSrcIsClipping || - (bSrcIsClipping==TRUE && aDstClipRegion!=aSrcClipRegion)) { + (bSrcIsClipping==sal_True && aDstClipRegion!=aSrcClipRegion)) { bDstIsClipping=bSrcIsClipping; aDstClipRegion=aSrcClipRegion; } @@ -1144,7 +1144,7 @@ void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx: void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) { - ULONG nA, nACount; + sal_uLong nA, nACount; MetaAction* pMA; if( bStatus ) @@ -1663,8 +1663,8 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) const MetaEPSAction* pA = (const MetaEPSAction*)pMA; const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() ); - INT32 nCount = aGDIMetaFile.GetActionCount(); - for ( INT32 i = 0; i < nCount; i++ ) + sal_Int32 nCount = aGDIMetaFile.GetActionCount(); + for ( sal_Int32 i = 0; i < nCount; i++ ) { const MetaAction* pMetaAct = aGDIMetaFile.GetAction( i ); if ( pMetaAct->GetType() == META_BMPSCALE_ACTION ) @@ -1767,9 +1767,9 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) MayCallback(); if (pWMF->GetError()) - bStatus=FALSE; + bStatus=sal_False; - if(bStatus==FALSE) + if(bStatus==sal_False) break; } } @@ -1777,13 +1777,13 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) // ------------------------------------------------------------------------ -void WMFWriter::WriteHeader( const GDIMetaFile &, BOOL bPlaceable ) +void WMFWriter::WriteHeader( const GDIMetaFile &, sal_Bool bPlaceable ) { if( bPlaceable ) { - USHORT nCheckSum, nValue; + sal_uInt16 nCheckSum, nValue; Size aSize( pVirDev->LogicToLogic(Size(1,1),MapMode(MAP_INCH), aTargetMapMode) ); - USHORT nUnitsPerInch = (USHORT) ( ( aSize.Width() + aSize.Height() ) >> 1 ); + sal_uInt16 nUnitsPerInch = (sal_uInt16) ( ( aSize.Width() + aSize.Height() ) >> 1 ); nCheckSum=0; nValue=0xcdd7; nCheckSum^=nValue; *pWMF << nValue; @@ -1791,8 +1791,8 @@ void WMFWriter::WriteHeader( const GDIMetaFile &, BOOL bPlaceable ) nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue; nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue; nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue; - nValue=(USHORT) aTargetSize.Width(); nCheckSum^=nValue; *pWMF << nValue; - nValue=(USHORT) aTargetSize.Height(); nCheckSum^=nValue; *pWMF << nValue; + nValue=(sal_uInt16) aTargetSize.Width(); nCheckSum^=nValue; *pWMF << nValue; + nValue=(sal_uInt16) aTargetSize.Height(); nCheckSum^=nValue; *pWMF << nValue; nValue=nUnitsPerInch; nCheckSum^=nValue; *pWMF << nValue; nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue; nValue=0x0000; nCheckSum^=nValue; *pWMF << nValue; @@ -1813,13 +1813,13 @@ void WMFWriter::WriteHeader( const GDIMetaFile &, BOOL bPlaceable ) void WMFWriter::UpdateHeader() { - ULONG nPos; + sal_uLong nPos; sal_uInt32 nFileSize; nPos=pWMF->Tell(); // Endposition = Gesammtgroesse der Datei nFileSize=nPos-nMetafileHeaderPos; // Groesse des 1. Headers abziehen if ((nFileSize&1)!=0) { // ggf. auf ganze Worte aufrunden - *pWMF << (BYTE)0; + *pWMF << (sal_uInt8)0; nPos++; nFileSize++; } @@ -1833,13 +1833,13 @@ void WMFWriter::UpdateHeader() // ------------------------------------------------------------------------ -BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, - FilterConfigItem* pFConfigItem, BOOL bPlaceable ) +sal_Bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, + FilterConfigItem* pFConfigItem, sal_Bool bPlaceable ) { WMFWriterAttrStackMember * pAt; - bEmbedEMF = TRUE; - bStatus=TRUE; + bEmbedEMF = sal_True; + bStatus=sal_True; pConvert = 0; pVirDev = new VirtualDevice; @@ -1886,8 +1886,8 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, pAttrStack=NULL; - for (USHORT i=0; i<MAXOBJECTHANDLES; i++) - bHandleAllocated[i]=FALSE; + for (sal_uInt16 i=0; i<MAXOBJECTHANDLES; i++) + bHandleAllocated[i]=sal_False; nDstPenHandle=0xffff; nDstFontHandle=0xffff; @@ -1906,7 +1906,7 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, WriteEmbeddedEMF( rMTF ); WMFRecord_SetWindowOrg(Point(0,0)); WMFRecord_SetWindowExt(rMTF.GetPrefSize()); - WMFRecord_SetBkMode( TRUE ); + WMFRecord_SetBkMode( sal_True ); eDstROP2 = eSrcRasterOp = ROP_OVERPAINT; WMFRecord_SetROP2(eDstROP2); @@ -1919,7 +1919,7 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, CreateSelectDeleteBrush( aDstFillColor ); aDstClipRegion = aSrcClipRegion = Region(); - bDstIsClipping = bSrcIsClipping = FALSE; + bDstIsClipping = bSrcIsClipping = sal_False; Font aFont; aFont.SetCharSet( GetExtendedTextEncoding( RTL_TEXTENCODING_MS_1252 ) ); @@ -1959,11 +1959,11 @@ BOOL WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream, // ------------------------------------------------------------------------ -USHORT WMFWriter::CalcSaveTargetMapMode(MapMode& rMapMode, +sal_uInt16 WMFWriter::CalcSaveTargetMapMode(MapMode& rMapMode, const Size& rPrefSize) { Fraction aDivFrac(2, 1); - USHORT nDivisor = 1; + sal_uInt16 nDivisor = 1; Size aSize = pVirDev->LogicToLogic( rPrefSize, aSrcMapMode, rMapMode ); diff --git a/svtools/source/filter.vcl/wmf/wmfwr.hxx b/svtools/source/filter.vcl/wmf/wmfwr.hxx index 22fe8efb2256..42aa647d78c2 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.hxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.hxx @@ -70,9 +70,9 @@ class WMFWriter { private: - BOOL bStatus; + sal_Bool bStatus; - ULONG nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde. + sal_uLong nLastPercent; // Mit welcher Zahl pCallback zuletzt aufgerufen wurde. FilterConfigItem* pFilterConfigItem; com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator; @@ -82,11 +82,11 @@ private: StarSymbolToMSMultiFont *pConvert; MapMode aTargetMapMode; Size aTargetSize; - USHORT nTargetDivisor; + sal_uInt16 nTargetDivisor; - ULONG nMetafileHeaderPos; + sal_uLong nMetafileHeaderPos; sal_uInt32 nMaxRecordSize; // in Worten - ULONG nActRecordPos; + sal_uLong nActRecordPos; // Aktuelle Attribute im Quell-Metafile: Color aSrcLineColor; @@ -97,11 +97,11 @@ private: FontAlign eSrcTextAlign; Font aSrcFont; MapMode aSrcMapMode; - BOOL bSrcIsClipping; + sal_Bool bSrcIsClipping; Region aSrcClipRegion; WMFWriterAttrStackMember * pAttrStack; - UINT32 eSrcHorTextAlign; + sal_uInt32 eSrcHorTextAlign; // Aktuelle Attribute im Ziel-Metafile: Color aDstLineColor; @@ -112,28 +112,28 @@ private: FontAlign eDstTextAlign; Font aDstFont; - UINT32 eDstHorTextAlign; + sal_uInt32 eDstHorTextAlign; - BOOL bDstIsClipping; // ???: derzeit unberuecksichtigt + sal_Bool bDstIsClipping; // ???: derzeit unberuecksichtigt Region aDstClipRegion; // ???: derzeit unberuecksichtigt - BOOL bHandleAllocated[MAXOBJECTHANDLES]; // Welche Handles vergeben sind - USHORT nDstPenHandle,nDstFontHandle,nDstBrushHandle; // Welche Handles die jeweiligen + sal_Bool bHandleAllocated[MAXOBJECTHANDLES]; // Welche Handles vergeben sind + sal_uInt16 nDstPenHandle,nDstFontHandle,nDstBrushHandle; // Welche Handles die jeweiligen // Selected-Objects besitzen // 0xffff = keines: // Damit nicht bei jeder Operation alle Attribute verglichen werden muessen: - ULONG nNumberOfActions; // Anzahl der Actions im GDIMetafile - ULONG nNumberOfBitmaps; // Anzahl der Bitmaps - ULONG nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Orders - ULONG nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps - ULONG nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist. + sal_uLong nNumberOfActions; // Anzahl der Actions im GDIMetafile + sal_uLong nNumberOfBitmaps; // Anzahl der Bitmaps + sal_uLong nWrittenActions; // Anzahl der bereits verarbeiteten Actions beim Schreiben der Orders + sal_uLong nWrittenBitmaps; // Anzahl der bereits geschriebenen Bitmaps + sal_uLong nActBitmapPercent; // Wieviel Prozent die naechste Bitmap schon geschrieben ist. - BOOL bEmbedEMF; // optionally embedd EMF data into WMF + sal_Bool bEmbedEMF; // optionally embedd EMF data into WMF void MayCallback(); // Berechnet anhand der obigen 5 Parameter eine Prozentzahl - // und macht dann ggf. einen Callback. Setzt bStatus auf FALSE wenn User abbrechen + // und macht dann ggf. einen Callback. Setzt bStatus auf sal_False wenn User abbrechen // moechte. void CountActionsAndBitmaps(const GDIMetaFile & rMTF); @@ -155,14 +155,14 @@ private: void UpdateRecordHeader(); // berichtig die Groesse des Records nach dem Schreiben der Parameter, wenn // nSizeWords bei Aufruf von WriteRecordHeader(..) unbekannt war. - // fuegt ggf. noch ein BYTE 0 ein damit Anzahl Bytes immer gerade. + // fuegt ggf. noch ein sal_uInt8 0 ein damit Anzahl Bytes immer gerade. void WMFRecord_Arc(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt); void WMFRecord_Chord(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt); void WMFRecord_CreateBrushIndirect(const Color& rColor); void WMFRecord_CreateFontIndirect(const Font & rFont); void WMFRecord_CreatePenIndirect(const Color& rColor, const LineInfo& rLineInfo ); - void WMFRecord_DeleteObject(USHORT nObjectHandle); + void WMFRecord_DeleteObject(sal_uInt16 nObjectHandle); void WMFRecord_Ellipse(const Rectangle & rRect); void WMFRecord_Escape( sal_uInt32 nEsc, sal_uInt32 nLen, const sal_Int8* pData ); sal_Bool WMFRecord_Escape_Unicode( const Point& rPoint, const String& rStr, const sal_Int32 * pDXAry ); @@ -181,12 +181,12 @@ private: void WMFRecord_RestoreDC(); void WMFRecord_RoundRect(const Rectangle & rRect, long nHorzRound, long nVertRound); void WMFRecord_SaveDC(); - void WMFRecord_SelectObject(USHORT nObjectHandle); - void WMFRecord_SetBkMode(BOOL bTransparent); + void WMFRecord_SelectObject(sal_uInt16 nObjectHandle); + void WMFRecord_SetBkMode(sal_Bool bTransparent); void WMFRecord_SetStretchBltMode(); void WMFRecord_SetPixel(const Point & rPoint, const Color & rColor); void WMFRecord_SetROP2(RasterOp eROP); - void WMFRecord_SetTextAlign(FontAlign eFontAlign, UINT32 eHorTextAlign); + void WMFRecord_SetTextAlign(FontAlign eFontAlign, sal_uInt32 eHorTextAlign); void WMFRecord_SetTextColor(const Color & rColor); void WMFRecord_SetWindowExt(const Size & rSize); void WMFRecord_SetWindowOrg(const Point & rPoint); @@ -195,8 +195,8 @@ private: void WMFRecord_EndOfFile(); void WMFRecord_IntersectClipRect( const Rectangle& rRect); - USHORT AllocHandle(); - void FreeHandle(USHORT nObjectHandle); + sal_uInt16 AllocHandle(); + void FreeHandle(sal_uInt16 nObjectHandle); void CreateSelectDeletePen( const Color& rColor, const LineInfo& rLineInfo ); void CreateSelectDeleteFont(const Font & rFont); void CreateSelectDeleteBrush(const Color& rColor); @@ -207,7 +207,7 @@ private: void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void WriteRecords(const GDIMetaFile & rMTF); - void WriteHeader(const GDIMetaFile & rMTF, BOOL bPlaceable); + void WriteHeader(const GDIMetaFile & rMTF, sal_Bool bPlaceable); void UpdateHeader(); void WriteEmbeddedEMF( const GDIMetaFile& rMTF ); @@ -217,13 +217,13 @@ private: sal_uInt32 nRecCounts, sal_uInt16 nCheckSum ); - USHORT CalcSaveTargetMapMode(MapMode& rMapMode, const Size& rPrefSize); + sal_uInt16 CalcSaveTargetMapMode(MapMode& rMapMode, const Size& rPrefSize); public: WMFWriter() {} - BOOL WriteWMF(const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem, BOOL bPlaceable=TRUE); + sal_Bool WriteWMF(const GDIMetaFile & rMTF, SvStream & rTargetStream, FilterConfigItem* pFilterConfigItem, sal_Bool bPlaceable=sal_True); }; #endif |